@hotmeshio/long-tail 0.6.2 → 0.7.0
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/build/api/escalations/create.js +45 -0
- package/build/api/escalations/index.d.ts +1 -1
- package/build/api/escalations/index.js +2 -1
- package/build/api/escalations/list.d.ts +3 -0
- package/build/api/escalations/list.js +14 -0
- package/build/api/roles.d.ts +17 -0
- package/build/api/roles.js +46 -0
- package/build/bin/ltc.js +1 -0
- package/build/lib/cli/commands/escalations.d.ts +1 -0
- package/build/lib/cli/commands/escalations.js +2 -0
- package/build/lib/db/migrate.js +22 -2
- package/build/lib/db/schemas/014_roles_v2.sql +19 -0
- package/build/lib/db/schemas/015_role_ops.sql +50 -0
- package/build/lib/db/schemas/016_station_metrics_indexes.sql +13 -0
- package/build/lib/events/system-events.js +3 -0
- package/build/modules/auth.d.ts +9 -0
- package/build/modules/auth.js +38 -1
- package/build/routes/escalations/list.js +10 -0
- package/build/routes/roles.js +16 -5
- package/build/scripts/ortho-populate.d.ts +37 -0
- package/build/scripts/ortho-populate.js +228 -0
- package/build/sdk/index.d.ts +4 -0
- package/build/sdk/index.js +2 -0
- package/build/services/escalation/client.js +93 -2
- package/build/services/escalation/crud.js +18 -9
- package/build/services/escalation/metrics-cache.d.ts +14 -0
- package/build/services/escalation/metrics-cache.js +53 -0
- package/build/services/escalation/queries.d.ts +14 -2
- package/build/services/escalation/queries.js +121 -11
- package/build/services/escalation/sql.d.ts +29 -2
- package/build/services/escalation/sql.js +156 -27
- package/build/services/escalation/types.d.ts +17 -0
- package/build/services/escalation/types.js +1 -0
- package/build/services/mcp/external-server.js +5 -1
- package/build/services/orchestrator/condition.d.ts +20 -0
- package/build/services/orchestrator/condition.js +20 -0
- package/build/services/role/index.d.ts +22 -3
- package/build/services/role/index.js +50 -2
- package/build/services/role/sql.d.ts +11 -1
- package/build/services/role/sql.js +38 -1
- package/build/services/role/types.d.ts +32 -0
- package/build/system/mcp-servers/admin/escalations.js +8 -7
- package/build/system/mcp-servers/admin/index.js +5 -3
- package/build/system/mcp-servers/admin/ortho.d.ts +10 -0
- package/build/system/mcp-servers/admin/ortho.js +242 -0
- package/build/system/mcp-servers/admin/schemas.d.ts +40 -3
- package/build/system/mcp-servers/admin/schemas.js +17 -4
- package/build/system/mcp-servers/admin/users.js +31 -0
- package/build/system/seed/tool-manifests-admin.d.ts +4016 -712
- package/build/system/seed/tool-manifests-admin.js +14 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/types/escalation.d.ts +3 -1
- package/dashboard/dist/assets/{AdminDashboard-C5gfVEeL.js → AdminDashboard-Bg1HgukI.js} +2 -2
- package/dashboard/dist/assets/{AdminDashboard-C5gfVEeL.js.map → AdminDashboard-Bg1HgukI.js.map} +1 -1
- package/dashboard/dist/assets/{AgentConfigPage-CWEnuiGN.js → AgentConfigPage-HBe_YDU_.js} +6 -6
- package/dashboard/dist/assets/{AgentConfigPage-CWEnuiGN.js.map → AgentConfigPage-HBe_YDU_.js.map} +1 -1
- package/dashboard/dist/assets/{AgentDetailPage-B6IE27iK.js → AgentDetailPage-BsaiYbwL.js} +4 -4
- package/dashboard/dist/assets/{AgentDetailPage-B6IE27iK.js.map → AgentDetailPage-BsaiYbwL.js.map} +1 -1
- package/dashboard/dist/assets/AgentsPage-DhN2lIBh.js +2 -0
- package/dashboard/dist/assets/{AgentsPage-Blhh2RsK.js.map → AgentsPage-DhN2lIBh.js.map} +1 -1
- package/dashboard/dist/assets/AvailableEscalationsPage-_xcWvlIz.js +2 -0
- package/dashboard/dist/assets/AvailableEscalationsPage-_xcWvlIz.js.map +1 -0
- package/dashboard/dist/assets/{BotPicker-DSozotGk.js → BotPicker-DY6iUVC9.js} +2 -2
- package/dashboard/dist/assets/{BotPicker-DSozotGk.js.map → BotPicker-DY6iUVC9.js.map} +1 -1
- package/dashboard/dist/assets/{CapabilitiesPage-CrS_DTA1.js → CapabilitiesPage-w1owqsmN.js} +2 -2
- package/dashboard/dist/assets/{CapabilitiesPage-CrS_DTA1.js.map → CapabilitiesPage-w1owqsmN.js.map} +1 -1
- package/dashboard/dist/assets/{CollapsibleSection-1i6bOQ1L.js → CollapsibleSection-DIMGjlJ-.js} +2 -2
- package/dashboard/dist/assets/{CollapsibleSection-1i6bOQ1L.js.map → CollapsibleSection-DIMGjlJ-.js.map} +1 -1
- package/dashboard/dist/assets/{CredentialsPage-BxJio06E.js → CredentialsPage-D1OmMHux.js} +2 -2
- package/dashboard/dist/assets/{CredentialsPage-BxJio06E.js.map → CredentialsPage-D1OmMHux.js.map} +1 -1
- package/dashboard/dist/assets/{CronLabel-BAfIHHz4.js → CronLabel-CQy3DrUQ.js} +2 -2
- package/dashboard/dist/assets/{CronLabel-BAfIHHz4.js.map → CronLabel-CQy3DrUQ.js.map} +1 -1
- package/dashboard/dist/assets/{CustomDurationPicker-BLF0NFJK.js → CustomDurationPicker-BoBkl9tw.js} +2 -2
- package/dashboard/dist/assets/{CustomDurationPicker-BLF0NFJK.js.map → CustomDurationPicker-BoBkl9tw.js.map} +1 -1
- package/dashboard/dist/assets/{DropZone-CEx_wk-g.js → DropZone-QXbiuU0b.js} +2 -2
- package/dashboard/dist/assets/{DropZone-CEx_wk-g.js.map → DropZone-QXbiuU0b.js.map} +1 -1
- package/dashboard/dist/assets/{ElapsedCell-nKGJvznH.js → ElapsedCell-Donjm9gT.js} +2 -2
- package/dashboard/dist/assets/{ElapsedCell-nKGJvznH.js.map → ElapsedCell-Donjm9gT.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationsOverview-bNNVA6R2.js → EscalationsOverview-CvHIJ_GG.js} +2 -2
- package/dashboard/dist/assets/{EscalationsOverview-bNNVA6R2.js.map → EscalationsOverview-CvHIJ_GG.js.map} +1 -1
- package/dashboard/dist/assets/{EventTable-BCuDdqlU.js → EventTable-DpAXMmT3.js} +2 -2
- package/dashboard/dist/assets/{EventTable-BCuDdqlU.js.map → EventTable-DpAXMmT3.js.map} +1 -1
- package/dashboard/dist/assets/{GraphInvokePage-BPAvqHls.js → GraphInvokePage-De1XVx5d.js} +2 -2
- package/dashboard/dist/assets/{GraphInvokePage-BPAvqHls.js.map → GraphInvokePage-De1XVx5d.js.map} +1 -1
- package/dashboard/dist/assets/HomePage-BYR5VXXw.js +2 -0
- package/dashboard/dist/assets/HomePage-BYR5VXXw.js.map +1 -0
- package/dashboard/dist/assets/{ListToolbar-DIJZfEgu.js → ListToolbar-Bx7jGzPA.js} +2 -2
- package/dashboard/dist/assets/{ListToolbar-DIJZfEgu.js.map → ListToolbar-Bx7jGzPA.js.map} +1 -1
- package/dashboard/dist/assets/{McpOverview-DCfSCfPg.js → McpOverview-DXRKcJN0.js} +2 -2
- package/dashboard/dist/assets/{McpOverview-DCfSCfPg.js.map → McpOverview-DXRKcJN0.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryDetailPage-mb7rmtNe.js → McpQueryDetailPage-CmW15w5e.js} +2 -2
- package/dashboard/dist/assets/{McpQueryDetailPage-mb7rmtNe.js.map → McpQueryDetailPage-CmW15w5e.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryPage-D9b1T0I3.js → McpQueryPage-BE6I011z.js} +2 -2
- package/dashboard/dist/assets/{McpQueryPage-D9b1T0I3.js.map → McpQueryPage-BE6I011z.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunDetailPage-Bz2UyuNm.js → McpRunDetailPage-Dsa3G3XQ.js} +2 -2
- package/dashboard/dist/assets/{McpRunDetailPage-Bz2UyuNm.js.map → McpRunDetailPage-Dsa3G3XQ.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunsPage-Dw7w_ZO-.js → McpRunsPage-uTbym66Y.js} +2 -2
- package/dashboard/dist/assets/{McpRunsPage-Dw7w_ZO-.js.map → McpRunsPage-uTbym66Y.js.map} +1 -1
- package/dashboard/dist/assets/{NamespacePill-D27vqDXy.js → NamespacePill-BGf0jHwE.js} +2 -2
- package/dashboard/dist/assets/{NamespacePill-D27vqDXy.js.map → NamespacePill-BGf0jHwE.js.map} +1 -1
- package/dashboard/dist/assets/OperationsPage-CAmiFHI6.js +2 -0
- package/dashboard/dist/assets/OperationsPage-CAmiFHI6.js.map +1 -0
- package/dashboard/dist/assets/{OperatorDashboard-CTzSDW3N.js → OperatorDashboard-i8cxaDlk.js} +2 -2
- package/dashboard/dist/assets/{OperatorDashboard-CTzSDW3N.js.map → OperatorDashboard-i8cxaDlk.js.map} +1 -1
- package/dashboard/dist/assets/{PageHeader-B_1zTx2q.js → PageHeader-BZJsEVOC.js} +2 -2
- package/dashboard/dist/assets/{PageHeader-B_1zTx2q.js.map → PageHeader-BZJsEVOC.js.map} +1 -1
- package/dashboard/dist/assets/{PageHeaderWithStats-D-cPg7UD.js → PageHeaderWithStats-BWuD7s9c.js} +2 -2
- package/dashboard/dist/assets/{PageHeaderWithStats-D-cPg7UD.js.map → PageHeaderWithStats-BWuD7s9c.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessDetailPage-olG2CS-h.js → ProcessDetailPage-CP7GZhgs.js} +2 -2
- package/dashboard/dist/assets/{ProcessDetailPage-olG2CS-h.js.map → ProcessDetailPage-CP7GZhgs.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessesListPage-CUZSL06Y.js → ProcessesListPage-btsU6hBR.js} +2 -2
- package/dashboard/dist/assets/{ProcessesListPage-CUZSL06Y.js.map → ProcessesListPage-btsU6hBR.js.map} +1 -1
- package/dashboard/dist/assets/RoleDetailPage-BB_e330f.js +16 -0
- package/dashboard/dist/assets/RoleDetailPage-BB_e330f.js.map +1 -0
- package/dashboard/dist/assets/{RolePill-B-V-31lC.js → RolePill-Pb9TKSQN.js} +2 -2
- package/dashboard/dist/assets/{RolePill-B-V-31lC.js.map → RolePill-Pb9TKSQN.js.map} +1 -1
- package/dashboard/dist/assets/RolesPage-1DBoEMsb.js +2 -0
- package/dashboard/dist/assets/RolesPage-1DBoEMsb.js.map +1 -0
- package/dashboard/dist/assets/{RunAsSelector-BoLHF4fy.js → RunAsSelector-Cp6j3FEY.js} +2 -2
- package/dashboard/dist/assets/{RunAsSelector-BoLHF4fy.js.map → RunAsSelector-Cp6j3FEY.js.map} +1 -1
- package/dashboard/dist/assets/StatusBadge-D9MeQHrh.js +2 -0
- package/dashboard/dist/assets/StatusBadge-D9MeQHrh.js.map +1 -0
- package/dashboard/dist/assets/{StickyPagination-BEMY1L-H.js → StickyPagination-Pr8kawv8.js} +2 -2
- package/dashboard/dist/assets/{StickyPagination-BEMY1L-H.js.map → StickyPagination-Pr8kawv8.js.map} +1 -1
- package/dashboard/dist/assets/StreamMessageDetail-BqmQ-N3y.js +2 -0
- package/dashboard/dist/assets/{StreamMessageDetail-CVRVWXcU.js.map → StreamMessageDetail-BqmQ-N3y.js.map} +1 -1
- package/dashboard/dist/assets/{SwimlaneTimeline-DDpU0-Jn.js → SwimlaneTimeline-y1YmXrsj.js} +2 -2
- package/dashboard/dist/assets/{SwimlaneTimeline-DDpU0-Jn.js.map → SwimlaneTimeline-y1YmXrsj.js.map} +1 -1
- package/dashboard/dist/assets/{TagInput-BHVfG307.js → TagInput-Df4myuYF.js} +2 -2
- package/dashboard/dist/assets/{TagInput-BHVfG307.js.map → TagInput-Df4myuYF.js.map} +1 -1
- package/dashboard/dist/assets/{TaskDetailPage-B_xQtJMg.js → TaskDetailPage-CT5rXHK5.js} +2 -2
- package/dashboard/dist/assets/{TaskDetailPage-B_xQtJMg.js.map → TaskDetailPage-CT5rXHK5.js.map} +1 -1
- package/dashboard/dist/assets/{TaskQueuePill-CGlxXqWt.js → TaskQueuePill-YalYdCNo.js} +2 -2
- package/dashboard/dist/assets/{TaskQueuePill-CGlxXqWt.js.map → TaskQueuePill-YalYdCNo.js.map} +1 -1
- package/dashboard/dist/assets/{TasksListPage-CsrdIOKk.js → TasksListPage-DOy6JlKS.js} +2 -2
- package/dashboard/dist/assets/{TasksListPage-CsrdIOKk.js.map → TasksListPage-DOy6JlKS.js.map} +1 -1
- package/dashboard/dist/assets/{TimeAgo-DmicaxjT.js → TimeAgo-BAQwZSpq.js} +2 -2
- package/dashboard/dist/assets/{TimeAgo-DmicaxjT.js.map → TimeAgo-BAQwZSpq.js.map} +1 -1
- package/dashboard/dist/assets/{TimestampCell-DeK89eRV.js → TimestampCell-BK_jufns.js} +2 -2
- package/dashboard/dist/assets/{TimestampCell-DeK89eRV.js.map → TimestampCell-BK_jufns.js.map} +1 -1
- package/dashboard/dist/assets/{ToolPill-NV7PxSpA.js → ToolPill-VGpT6Quy.js} +2 -2
- package/dashboard/dist/assets/{ToolPill-NV7PxSpA.js.map → ToolPill-VGpT6Quy.js.map} +1 -1
- package/dashboard/dist/assets/{ToolTestPanel-D3s2n9-9.js → ToolTestPanel-5PMQyUCe.js} +2 -2
- package/dashboard/dist/assets/{ToolTestPanel-D3s2n9-9.js.map → ToolTestPanel-5PMQyUCe.js.map} +1 -1
- package/dashboard/dist/assets/{TopicDetailPage-qyv7UWT_.js → TopicDetailPage-Cn1ShfR8.js} +3 -3
- package/dashboard/dist/assets/{TopicDetailPage-qyv7UWT_.js.map → TopicDetailPage-Cn1ShfR8.js.map} +1 -1
- package/dashboard/dist/assets/{TopicsPage-CEUfMoed.js → TopicsPage-D67tjS8L.js} +2 -2
- package/dashboard/dist/assets/{TopicsPage-CEUfMoed.js.map → TopicsPage-D67tjS8L.js.map} +1 -1
- package/dashboard/dist/assets/{UserName-Bn_BxI8K.js → UserName-Dsu1Jk4N.js} +2 -2
- package/dashboard/dist/assets/{UserName-Bn_BxI8K.js.map → UserName-Dsu1Jk4N.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowExecutionPage-DAk2RqpB.js → WorkflowExecutionPage-BwQoOmUE.js} +2 -2
- package/dashboard/dist/assets/{WorkflowExecutionPage-DAk2RqpB.js.map → WorkflowExecutionPage-BwQoOmUE.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowPill-DDR0B6DN.js → WorkflowPill-pPUqmx6Q.js} +2 -2
- package/dashboard/dist/assets/{WorkflowPill-DDR0B6DN.js.map → WorkflowPill-pPUqmx6Q.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsDashboard-DfBgM80t.js → WorkflowsDashboard-D3z7COgH.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsDashboard-DfBgM80t.js.map → WorkflowsDashboard-D3z7COgH.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsOverview--Dkoo9Jq.js → WorkflowsOverview-C15JcxyY.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsOverview--Dkoo9Jq.js.map → WorkflowsOverview-C15JcxyY.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-B6HYbfFj.js → YamlWorkflowDetailPage-BYq3t7E-.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-B6HYbfFj.js.map → YamlWorkflowDetailPage-BYq3t7E-.js.map} +1 -1
- package/dashboard/dist/assets/YamlWorkflowsPage-B44WgwE_.js +2 -0
- package/dashboard/dist/assets/{YamlWorkflowsPage-CJE-PxC0.js.map → YamlWorkflowsPage-B44WgwE_.js.map} +1 -1
- package/dashboard/dist/assets/{agents-DUciUZpt.js → agents-BRmmK6Y9.js} +2 -2
- package/dashboard/dist/assets/{agents-DUciUZpt.js.map → agents-BRmmK6Y9.js.map} +1 -1
- package/dashboard/dist/assets/{bots-BnyqCfuC.js → bots-BD75mzGG.js} +2 -2
- package/dashboard/dist/assets/{bots-BnyqCfuC.js.map → bots-BD75mzGG.js.map} +1 -1
- package/dashboard/dist/assets/{capabilities-CkTWWT0q.js → capabilities-DDgC_Kds.js} +2 -2
- package/dashboard/dist/assets/{capabilities-CkTWWT0q.js.map → capabilities-DDgC_Kds.js.map} +1 -1
- package/dashboard/dist/assets/controlplane-BJh12lMv.js +2 -0
- package/dashboard/dist/assets/controlplane-BJh12lMv.js.map +1 -0
- package/dashboard/dist/assets/{escalation-De9JnTKI.js → escalation-DIJt2sgn.js} +2 -2
- package/dashboard/dist/assets/{escalation-De9JnTKI.js.map → escalation-DIJt2sgn.js.map} +1 -1
- package/dashboard/dist/assets/{escalation-columns-Df7Pluzg.js → escalation-columns-zl6E94Up.js} +2 -2
- package/dashboard/dist/assets/{escalation-columns-Df7Pluzg.js.map → escalation-columns-zl6E94Up.js.map} +1 -1
- package/dashboard/dist/assets/{index-Cqjf-yVP.js → index-B0kmiSmt.js} +2 -2
- package/dashboard/dist/assets/{index-Cqjf-yVP.js.map → index-B0kmiSmt.js.map} +1 -1
- package/dashboard/dist/assets/index-BRtKQtQZ.css +1 -0
- package/dashboard/dist/assets/{index-BxdiKgnH.js → index-BUbzfEA9.js} +2 -2
- package/dashboard/dist/assets/{index-BxdiKgnH.js.map → index-BUbzfEA9.js.map} +1 -1
- package/dashboard/dist/assets/{index-DpAS4-DA.js → index-BhznDv-4.js} +2 -2
- package/dashboard/dist/assets/{index-DpAS4-DA.js.map → index-BhznDv-4.js.map} +1 -1
- package/dashboard/dist/assets/{index-BAhkWcOq.js → index-CDPBXB4e.js} +4 -4
- package/dashboard/dist/assets/{index-BAhkWcOq.js.map → index-CDPBXB4e.js.map} +1 -1
- package/dashboard/dist/assets/{index-CgD9fA9P.js → index-CV4lEd4I.js} +2 -2
- package/dashboard/dist/assets/{index-CgD9fA9P.js.map → index-CV4lEd4I.js.map} +1 -1
- package/dashboard/dist/assets/{index-DjxTV3cn.js → index-CknKy4RA.js} +2 -2
- package/dashboard/dist/assets/{index-DjxTV3cn.js.map → index-CknKy4RA.js.map} +1 -1
- package/dashboard/dist/assets/{index-DNugmBs7.js → index-CpgV4Kkp.js} +2 -2
- package/dashboard/dist/assets/{index-DNugmBs7.js.map → index-CpgV4Kkp.js.map} +1 -1
- package/dashboard/dist/assets/{index-B1kc6itM.js → index-CtDf8vvQ.js} +24 -24
- package/dashboard/dist/assets/index-CtDf8vvQ.js.map +1 -0
- package/dashboard/dist/assets/{index-BzMsh6Ui.js → index-DU7YumVJ.js} +2 -2
- package/dashboard/dist/assets/{index-BzMsh6Ui.js.map → index-DU7YumVJ.js.map} +1 -1
- package/dashboard/dist/assets/{index-BsIaUbKD.js → index-DVVIeBBk.js} +2 -2
- package/dashboard/dist/assets/{index-BsIaUbKD.js.map → index-DVVIeBBk.js.map} +1 -1
- package/dashboard/dist/assets/index-DccCwyZl.js +6 -0
- package/dashboard/dist/assets/{index-CN0efCE9.js.map → index-DccCwyZl.js.map} +1 -1
- package/dashboard/dist/assets/{index-7hqtQI43.js → index-DrUkTcn-.js} +2 -2
- package/dashboard/dist/assets/{index-7hqtQI43.js.map → index-DrUkTcn-.js.map} +1 -1
- package/dashboard/dist/assets/{index-B07xLlyz.js → index-j-C7g_Ej.js} +2 -2
- package/dashboard/dist/assets/{index-B07xLlyz.js.map → index-j-C7g_Ej.js.map} +1 -1
- package/dashboard/dist/assets/{knowledge-D4SvdNv5.js → knowledge-pNDWACXB.js} +2 -2
- package/dashboard/dist/assets/{knowledge-D4SvdNv5.js.map → knowledge-pNDWACXB.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-query-CLP9EnnU.js → mcp-query-CmNjvxTG.js} +2 -2
- package/dashboard/dist/assets/{mcp-query-CLP9EnnU.js.map → mcp-query-CmNjvxTG.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-DVxt4T9J.js → mcp-xddLBwUW.js} +2 -2
- package/dashboard/dist/assets/{mcp-DVxt4T9J.js.map → mcp-xddLBwUW.js.map} +1 -1
- package/dashboard/dist/assets/pipelines-B05sd2nB.js +2 -0
- package/dashboard/dist/assets/pipelines-B05sd2nB.js.map +1 -0
- package/dashboard/dist/assets/roles-bRgaMcdy.js +2 -0
- package/dashboard/dist/assets/roles-bRgaMcdy.js.map +1 -0
- package/dashboard/dist/assets/tasks-Bm1OKrJA.js +2 -0
- package/dashboard/dist/assets/{tasks-1eTuP02d.js.map → tasks-Bm1OKrJA.js.map} +1 -1
- package/dashboard/dist/assets/{topics-B3p8K0PW.js → topics-BVIqtmd4.js} +2 -2
- package/dashboard/dist/assets/{topics-B3p8K0PW.js.map → topics-BVIqtmd4.js.map} +1 -1
- package/dashboard/dist/assets/useEventHooks-_qCzU74s.js +2 -0
- package/dashboard/dist/assets/useEventHooks-_qCzU74s.js.map +1 -0
- package/dashboard/dist/assets/{useNamespace-Dx81_JM0.js → useNamespace-CDnCSFpG.js} +2 -2
- package/dashboard/dist/assets/{useNamespace-Dx81_JM0.js.map → useNamespace-CDnCSFpG.js.map} +1 -1
- package/dashboard/dist/assets/{useYamlActivityEvents-D5T3TbE7.js → useYamlActivityEvents-zrHMhaFM.js} +2 -2
- package/dashboard/dist/assets/{useYamlActivityEvents-D5T3TbE7.js.map → useYamlActivityEvents-zrHMhaFM.js.map} +1 -1
- package/dashboard/dist/assets/{users-BEMysNdR.js → users-BPBMZg27.js} +2 -2
- package/dashboard/dist/assets/{users-BEMysNdR.js.map → users-BPBMZg27.js.map} +1 -1
- package/dashboard/dist/assets/{vendor-icons--Ivmp-RX.js → vendor-icons-C1zVP_dv.js} +125 -115
- package/dashboard/dist/assets/vendor-icons-C1zVP_dv.js.map +1 -0
- package/dashboard/dist/assets/workflows-CT6nTL1I.js +2 -0
- package/dashboard/dist/assets/workflows-CT6nTL1I.js.map +1 -0
- package/dashboard/dist/assets/{yaml-workflows-4rJ5v5rJ.js → yaml-workflows-CdfjkOKU.js} +2 -2
- package/dashboard/dist/assets/{yaml-workflows-4rJ5v5rJ.js.map → yaml-workflows-CdfjkOKU.js.map} +1 -1
- package/dashboard/dist/index.html +3 -3
- package/docs/api/http/escalations.md +82 -6
- package/docs/api/http/roles.md +82 -3
- package/docs/api/mcp/admin.md +127 -1
- package/docs/api/sdk/escalations.md +65 -4
- package/docs/api/sdk/roles.md +81 -0
- package/docs/cli.md +2 -0
- package/docs/dashboard.md +17 -2
- package/docs/hitl-guide.md +12 -3
- package/docs/operations.md +113 -0
- package/package.json +3 -2
- package/dashboard/dist/assets/AgentsPage-Blhh2RsK.js +0 -2
- package/dashboard/dist/assets/AvailableEscalationsPage-ClwAle76.js +0 -2
- package/dashboard/dist/assets/AvailableEscalationsPage-ClwAle76.js.map +0 -1
- package/dashboard/dist/assets/HomePage-BZ1YTrjR.js +0 -2
- package/dashboard/dist/assets/HomePage-BZ1YTrjR.js.map +0 -1
- package/dashboard/dist/assets/RolesPage-DLnaW6iD.js +0 -2
- package/dashboard/dist/assets/RolesPage-DLnaW6iD.js.map +0 -1
- package/dashboard/dist/assets/StatusBadge-Bl3FXVmF.js +0 -2
- package/dashboard/dist/assets/StatusBadge-Bl3FXVmF.js.map +0 -1
- package/dashboard/dist/assets/StreamMessageDetail-CVRVWXcU.js +0 -2
- package/dashboard/dist/assets/YamlWorkflowsPage-CJE-PxC0.js +0 -2
- package/dashboard/dist/assets/controlplane-D9HaFZsC.js +0 -2
- package/dashboard/dist/assets/controlplane-D9HaFZsC.js.map +0 -1
- package/dashboard/dist/assets/index-B1kc6itM.js.map +0 -1
- package/dashboard/dist/assets/index-CN0efCE9.js +0 -6
- package/dashboard/dist/assets/index-nO0cim3_.css +0 -1
- package/dashboard/dist/assets/pipelines-C_x0LTBN.js +0 -2
- package/dashboard/dist/assets/pipelines-C_x0LTBN.js.map +0 -1
- package/dashboard/dist/assets/roles-QaGFZQ58.js +0 -2
- package/dashboard/dist/assets/roles-QaGFZQ58.js.map +0 -1
- package/dashboard/dist/assets/tasks-1eTuP02d.js +0 -2
- package/dashboard/dist/assets/useEventHooks-BNZky4xM.js +0 -2
- package/dashboard/dist/assets/useEventHooks-BNZky4xM.js.map +0 -1
- package/dashboard/dist/assets/vendor-icons--Ivmp-RX.js.map +0 -1
- package/dashboard/dist/assets/workflows-C4rjvQbI.js +0 -2
- package/dashboard/dist/assets/workflows-C4rjvQbI.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProcessesListPage-
|
|
2
|
-
var
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProcessesListPage-btsU6hBR.js","./vendor-query-B2UbickB.js","./tasks-Bm1OKrJA.js","./workflows-CT6nTL1I.js","./useEventHooks-_qCzU74s.js","./useFilterParams-x-Dg0Vgz.js","./vendor-react-CXumBFUA.js","./useDebouncedValue-BA5S7V54.js","./api-path-u2Jf9QXS.js","./DataTable-ZWgVQg7F.js","./EmptyState-BcsfPq9T.js","./TimestampCell-BK_jufns.js","./StickyPagination-Pr8kawv8.js","./FilterBar-BQ2JGg8U.js","./PageHeader-BZJsEVOC.js","./vendor-icons-C1zVP_dv.js","./ListToolbar-Bx7jGzPA.js","./WorkflowPill-pPUqmx6Q.js","./ProcessDetailPage-CP7GZhgs.js","./PageHeaderWithStats-BWuD7s9c.js","./StatusBadge-D9MeQHrh.js","./RolePill-Pb9TKSQN.js","./UserName-Dsu1Jk4N.js","./users-BPBMZg27.js","./McpOverview-DXRKcJN0.js","./mcp-xddLBwUW.js","./pipelines-B05sd2nB.js","./yaml-workflows-CdfjkOKU.js","./controlplane-BJh12lMv.js","./StatCard-DlgF0CJC.js","./McpRunsPage-uTbym66Y.js","./useNamespace-CDnCSFpG.js","./ElapsedCell-Donjm9gT.js","./RowActions-BA9L9djf.js","./McpRunDetailPage-Dsa3G3XQ.js","./CopyableId-blg-gZvT.js","./CollapsibleSection-DIMGjlJ-.js","./useCollapsedSections-BU5HULGs.js","./SwimlaneTimeline-y1YmXrsj.js","./StreamMessageDetail-BqmQ-N3y.js","./EventTable-DpAXMmT3.js","./McpQueryPage-BE6I011z.js","./mcp-query-CmNjvxTG.js","./McpQueryDetailPage-CmW15w5e.js","./TagInput-Df4myuYF.js","./useYamlActivityEvents-zrHMhaFM.js","./helpers-DzO-OGPe.js","./RunAsSelector-Cp6j3FEY.js","./BotPicker-DY6iUVC9.js","./bots-BD75mzGG.js","./ToolPill-VGpT6Quy.js","./TimeAgo-BAQwZSpq.js","./EscalationsOverview-CvHIJ_GG.js","./AvailableEscalationsPage-_xcWvlIz.js","./CustomDurationPicker-BoBkl9tw.js","./Modal-CSrxpXeM.js","./constants-BHkpVaqx.js","./roles-bRgaMcdy.js","./escalation-columns-zl6E94Up.js","./PriorityBadge-B4ykBH7f.js","./escalation-DIJt2sgn.js","./OperatorDashboard-i8cxaDlk.js","./index-DccCwyZl.js","./WorkflowsOverview-C15JcxyY.js","./index-BUbzfEA9.js","./NamespacePill-BGf0jHwE.js","./WorkflowsDashboard-D3z7COgH.js","./YamlWorkflowsPage-B44WgwE_.js","./GraphInvokePage-De1XVx5d.js","./YamlWorkflowDetailPage-BYq3t7E-.js","./TasksListPage-DOy6JlKS.js","./TaskDetailPage-CT5rXHK5.js","./WorkflowExecutionPage-BwQoOmUE.js","./AdminDashboard-Bg1HgukI.js","./index-CknKy4RA.js","./TaskQueuePill-YalYdCNo.js","./index-CDPBXB4e.js","./ConfirmDeleteModal-D9_1b4MW.js","./index-DU7YumVJ.js","./ToolTestPanel-5PMQyUCe.js","./index-DVVIeBBk.js","./index-BhznDv-4.js","./RolesPage-1DBoEMsb.js","./RoleDetailPage-BB_e330f.js","./index-CV4lEd4I.js","./OperationsPage-CAmiFHI6.js","./index-CpgV4Kkp.js","./index-B0kmiSmt.js","./CredentialsPage-D1OmMHux.js","./index-DrUkTcn-.js","./DropZone-QXbiuU0b.js","./index-j-C7g_Ej.js","./knowledge-pNDWACXB.js","./HomePage-BYR5VXXw.js","./AgentsPage-DhN2lIBh.js","./agents-BRmmK6Y9.js","./AgentDetailPage-BsaiYbwL.js","./CronLabel-CQy3DrUQ.js","./AgentConfigPage-HBe_YDU_.js","./capabilities-DDgC_Kds.js","./topics-BVIqtmd4.js","./CapabilitiesPage-w1owqsmN.js","./TopicsPage-D67tjS8L.js","./TopicDetailPage-Cn1ShfR8.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var Sx=Object.defineProperty;var Ex=(r,n,s)=>n in r?Sx(r,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[n]=s;var v=(r,n,s)=>Ex(r,typeof n!="symbol"?n+"":n,s);import{r as Ax,a as O,j as d,u as _n,b as rn,c as wn,Q as jx,d as Ox}from"./vendor-query-B2UbickB.js";import{r as Tx,L as yr,u as ei,N as Co,a as fg,b as Bn,O as xr,c as hg,d as Nx,R as Cx}from"./vendor-react-CXumBFUA.js";import{I as Ef,R as dg,B as mg,U as kx,L as Af,a as s0,b as Mx,Z as Rx,S as i0,P as r0,C as Dx,W as Kf,c as zx,d as qx,F as Ux,e as Bx,f as Lx,T as Hx,N as Px,g as $x,D as Yx,M as pg,h as gg,i as Gx,j as Vx,k as Fx,E as Jx,X as $o,l as Ix,m as Qx,n as Xx,o as a0,G as Kx,p as Zx,q as Wx,r as ev,s as tv}from"./vendor-icons-C1zVP_dv.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))a(o);new MutationObserver(o=>{for(const f of o)if(f.type==="childList")for(const h of f.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&a(h)}).observe(document,{childList:!0,subtree:!0});function s(o){const f={};return o.integrity&&(f.integrity=o.integrity),o.referrerPolicy&&(f.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?f.credentials="include":o.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function a(o){if(o.ep)return;o.ep=!0;const f=s(o);fetch(o.href,f)}})();var lf={exports:{}},Ea={},of={exports:{}},cf={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* scheduler.production.js
|
|
5
5
|
*
|
|
@@ -7,7 +7,7 @@ var wx=Object.defineProperty;var Sx=(r,n,s)=>n in r?wx(r,n,{enumerable:!0,config
|
|
|
7
7
|
*
|
|
8
8
|
* This source code is licensed under the MIT license found in the
|
|
9
9
|
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/var
|
|
10
|
+
*/var l0;function nv(){return l0||(l0=1,(function(r){function n($,te){var de=$.length;$.push(te);e:for(;0<de;){var _e=de-1>>>1,be=$[_e];if(0<o(be,te))$[_e]=te,$[de]=be,de=_e;else break e}}function s($){return $.length===0?null:$[0]}function a($){if($.length===0)return null;var te=$[0],de=$.pop();if(de!==te){$[0]=de;e:for(var _e=0,be=$.length,Oe=be>>>1;_e<Oe;){var we=2*(_e+1)-1,Te=$[we],lt=we+1,Pt=$[lt];if(0>o(Te,de))lt<be&&0>o(Pt,Te)?($[_e]=Pt,$[lt]=de,_e=lt):($[_e]=Te,$[we]=de,_e=we);else if(lt<be&&0>o(Pt,de))$[_e]=Pt,$[lt]=de,_e=lt;else break e}}return te}function o($,te){var de=$.sortIndex-te.sortIndex;return de!==0?de:$.id-te.id}if(r.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;r.unstable_now=function(){return f.now()}}else{var h=Date,m=h.now();r.unstable_now=function(){return h.now()-m}}var g=[],y=[],E=1,w=null,T=3,q=!1,M=!1,D=!1,W=!1,se=typeof setTimeout=="function"?setTimeout:null,ee=typeof clearTimeout=="function"?clearTimeout:null,me=typeof setImmediate<"u"?setImmediate:null;function re($){for(var te=s(y);te!==null;){if(te.callback===null)a(y);else if(te.startTime<=$)a(y),te.sortIndex=te.expirationTime,n(g,te);else break;te=s(y)}}function C($){if(D=!1,re($),!M)if(s(g)!==null)M=!0,X||(X=!0,ne());else{var te=s(y);te!==null&&Me(C,te.startTime-$)}}var X=!1,ce=-1,V=5,G=-1;function K(){return W?!0:!(r.unstable_now()-G<V)}function ae(){if(W=!1,X){var $=r.unstable_now();G=$;var te=!0;try{e:{M=!1,D&&(D=!1,ee(ce),ce=-1),q=!0;var de=T;try{t:{for(re($),w=s(g);w!==null&&!(w.expirationTime>$&&K());){var _e=w.callback;if(typeof _e=="function"){w.callback=null,T=w.priorityLevel;var be=_e(w.expirationTime<=$);if($=r.unstable_now(),typeof be=="function"){w.callback=be,re($),te=!0;break t}w===s(g)&&a(g),re($)}else a(g);w=s(g)}if(w!==null)te=!0;else{var Oe=s(y);Oe!==null&&Me(C,Oe.startTime-$),te=!1}}break e}finally{w=null,T=de,q=!1}te=void 0}}finally{te?ne():X=!1}}}var ne;if(typeof me=="function")ne=function(){me(ae)};else if(typeof MessageChannel<"u"){var ke=new MessageChannel,He=ke.port2;ke.port1.onmessage=ae,ne=function(){He.postMessage(null)}}else ne=function(){se(ae,0)};function Me($,te){ce=se(function(){$(r.unstable_now())},te)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function($){$.callback=null},r.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):V=0<$?Math.floor(1e3/$):5},r.unstable_getCurrentPriorityLevel=function(){return T},r.unstable_next=function($){switch(T){case 1:case 2:case 3:var te=3;break;default:te=T}var de=T;T=te;try{return $()}finally{T=de}},r.unstable_requestPaint=function(){W=!0},r.unstable_runWithPriority=function($,te){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var de=T;T=$;try{return te()}finally{T=de}},r.unstable_scheduleCallback=function($,te,de){var _e=r.unstable_now();switch(typeof de=="object"&&de!==null?(de=de.delay,de=typeof de=="number"&&0<de?_e+de:_e):de=_e,$){case 1:var be=-1;break;case 2:be=250;break;case 5:be=1073741823;break;case 4:be=1e4;break;default:be=5e3}return be=de+be,$={id:E++,callback:te,priorityLevel:$,startTime:de,expirationTime:be,sortIndex:-1},de>_e?($.sortIndex=de,n(y,$),s(g)===null&&$===s(y)&&(D?(ee(ce),ce=-1):D=!0,Me(C,de-_e))):($.sortIndex=be,n(g,$),M||q||(M=!0,X||(X=!0,ne()))),$},r.unstable_shouldYield=K,r.unstable_wrapCallback=function($){var te=T;return function(){var de=T;T=te;try{return $.apply(this,arguments)}finally{T=de}}}})(cf)),cf}var o0;function sv(){return o0||(o0=1,of.exports=nv()),of.exports}/**
|
|
11
11
|
* @license React
|
|
12
12
|
* react-dom-client.production.js
|
|
13
13
|
*
|
|
@@ -15,28 +15,28 @@ var wx=Object.defineProperty;var Sx=(r,n,s)=>n in r?wx(r,n,{enumerable:!0,config
|
|
|
15
15
|
*
|
|
16
16
|
* This source code is licensed under the MIT license found in the
|
|
17
17
|
* LICENSE file in the root directory of this source tree.
|
|
18
|
-
*/var
|
|
18
|
+
*/var c0;function iv(){if(c0)return Ea;c0=1;var r=sv(),n=Ax(),s=Tx();function a(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)t+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(e){var t=e,i=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(i=t.return),e=t.return;while(e)}return t.tag===3?i:null}function h(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function 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 i=e,l=t;;){var c=i.return;if(c===null)break;var u=c.alternate;if(u===null){if(l=c.return,l!==null){i=l;continue}break}if(c.child===u.child){for(u=c.child;u;){if(u===i)return g(c),e;if(u===l)return g(c),t;u=u.sibling}throw Error(a(188))}if(i.return!==l.return)i=c,l=u;else{for(var p=!1,b=c.child;b;){if(b===i){p=!0,i=c,l=u;break}if(b===l){p=!0,l=c,i=u;break}b=b.sibling}if(!p){for(b=u.child;b;){if(b===i){p=!0,i=u,l=c;break}if(b===l){p=!0,l=u,i=c;break}b=b.sibling}if(!p)throw Error(a(189))}}if(i.alternate!==l)throw Error(a(190))}if(i.tag!==3)throw Error(a(188));return i.stateNode.current===i?e:t}function E(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=E(e),t!==null)return t;e=e.sibling}return null}var w=Object.assign,T=Symbol.for("react.element"),q=Symbol.for("react.transitional.element"),M=Symbol.for("react.portal"),D=Symbol.for("react.fragment"),W=Symbol.for("react.strict_mode"),se=Symbol.for("react.profiler"),ee=Symbol.for("react.consumer"),me=Symbol.for("react.context"),re=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),X=Symbol.for("react.suspense_list"),ce=Symbol.for("react.memo"),V=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),K=Symbol.for("react.memo_cache_sentinel"),ae=Symbol.iterator;function ne(e){return e===null||typeof e!="object"?null:(e=ae&&e[ae]||e["@@iterator"],typeof e=="function"?e:null)}var ke=Symbol.for("react.client.reference");function He(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ke?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case D:return"Fragment";case se:return"Profiler";case W:return"StrictMode";case C:return"Suspense";case X:return"SuspenseList";case G:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case M:return"Portal";case me:return e.displayName||"Context";case ee:return(e._context.displayName||"Context")+".Consumer";case re:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ce:return t=e.displayName||null,t!==null?t:He(e.type)||"Memo";case V:t=e._payload,e=e._init;try{return He(e(t))}catch{}}return null}var Me=Array.isArray,$=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,de={pending:!1,data:null,method:null,action:null},_e=[],be=-1;function Oe(e){return{current:e}}function we(e){0>be||(e.current=_e[be],_e[be]=null,be--)}function Te(e,t){be++,_e[be]=e.current,e.current=t}var lt=Oe(null),Pt=Oe(null),an=Oe(null),jt=Oe(null);function Ot(e,t){switch(Te(an,t),Te(Pt,e),Te(lt,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?jp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=jp(t),e=Op(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}we(lt),Te(lt,e)}function Se(){we(lt),we(Pt),we(an)}function Tt(e){e.memoizedState!==null&&Te(jt,e);var t=lt.current,i=Op(t,e.type);t!==i&&(Te(Pt,e),Te(lt,i))}function ti(e){Pt.current===e&&(we(lt),we(Pt)),jt.current===e&&(we(jt),va._currentValue=de)}var Ni,ni;function ln(e){if(Ni===void 0)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);Ni=t&&t[1]||"",ni=-1<i.stack.indexOf(`
|
|
19
19
|
at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
20
|
-
`+Ni+e+
|
|
20
|
+
`+Ni+e+ni}var Ci=!1;function ms(e,t){if(!e||Ci)return"";Ci=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(t){var Q=function(){throw Error()};if(Object.defineProperty(Q.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Q,[])}catch(P){var L=P}Reflect.construct(e,[],Q)}else{try{Q.call()}catch(P){L=P}e.call(Q.prototype)}}else{try{throw Error()}catch(P){L=P}(Q=e())&&typeof Q.catch=="function"&&Q.catch(function(){})}}catch(P){if(P&&L&&typeof P.stack=="string")return[P.stack,L.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var c=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");c&&c.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var u=l.DetermineComponentFrameRoot(),p=u[0],b=u[1];if(p&&b){var j=p.split(`
|
|
21
21
|
`),B=b.split(`
|
|
22
22
|
`);for(c=l=0;l<j.length&&!j[l].includes("DetermineComponentFrameRoot");)l++;for(;c<B.length&&!B[c].includes("DetermineComponentFrameRoot");)c++;if(l===j.length||c===B.length)for(l=j.length-1,c=B.length-1;1<=l&&0<=c&&j[l]!==B[c];)c--;for(;1<=l&&0<=c;l--,c--)if(j[l]!==B[c]){if(l!==1||c!==1)do if(l--,c--,0>c||j[l]!==B[c]){var Y=`
|
|
23
|
-
`+j[l].replace(" at new "," at ");return e.displayName&&Y.includes("<anonymous>")&&(Y=Y.replace("<anonymous>",e.displayName)),Y}while(1<=l&&0<=c);break}}}finally{Ci=!1,Error.prepareStackTrace=i}return(i=e?e.displayName||e.name:"")?ln(i):""}function
|
|
23
|
+
`+j[l].replace(" at new "," at ");return e.displayName&&Y.includes("<anonymous>")&&(Y=Y.replace("<anonymous>",e.displayName)),Y}while(1<=l&&0<=c);break}}}finally{Ci=!1,Error.prepareStackTrace=i}return(i=e?e.displayName||e.name:"")?ln(i):""}function Ia(e,t){switch(e.tag){case 26:case 27:case 5:return ln(e.type);case 16:return ln("Lazy");case 13:return e.child!==t&&t!==null?ln("Suspense Fallback"):ln("Suspense");case 19:return ln("SuspenseList");case 0:case 15:return ms(e.type,!1);case 11:return ms(e.type.render,!1);case 1:return ms(e.type,!0);case 31:return ln("Activity");default:return""}}function Qa(e){try{var t="",i=null;do t+=Ia(e,i),i=e,e=e.return;while(e);return t}catch(l){return`
|
|
24
24
|
Error generating stack: `+l.message+`
|
|
25
|
-
`+l.stack}}var Cr=Object.prototype.hasOwnProperty,kr=r.unstable_scheduleCallback,Yn=r.unstable_cancelCallback,Ia=r.unstable_shouldYield,ki=r.unstable_requestPaint,et=r.unstable_now,Xo=r.unstable_getCurrentPriorityLevel,Xa=r.unstable_ImmediatePriority,Ka=r.unstable_UserBlockingPriority,Mi=r.unstable_NormalPriority,Ko=r.unstable_LowPriority,Za=r.unstable_IdlePriority,Zo=r.log,Wa=r.unstable_setDisableYieldValue,ni=null,ot=null;function $t(e){if(typeof Zo=="function"&&Wa(e),ot&&typeof ot.setStrictMode=="function")try{ot.setStrictMode(ni,e)}catch{}}var Nt=Math.clz32?Math.clz32:Ri,Mr=Math.log,Rr=Math.LN2;function Ri(e){return e>>>=0,e===0?32:31-(Mr(e)/Rr|0)|0}var ps=256,Gn=262144,gs=4194304;function wn(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function si(e,t,i){var l=e.pendingLanes;if(l===0)return 0;var c=0,u=e.suspendedLanes,p=e.pingedLanes;e=e.warmLanes;var b=l&134217727;return b!==0?(l=b&~u,l!==0?c=wn(l):(p&=b,p!==0?c=wn(p):i||(i=b&~e,i!==0&&(c=wn(i))))):(b=l&~u,b!==0?c=wn(b):p!==0?c=wn(p):i||(i=l&~e,i!==0&&(c=wn(i)))),c===0?0:t!==0&&t!==c&&(t&u)===0&&(u=c&-c,i=t&-t,u>=i||u===32&&(i&4194048)!==0)?t:c}function ii(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Dr(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 Di(){var e=gs;return gs<<=1,(gs&62914560)===0&&(gs=4194304),e}function ys(e){for(var t=[],i=0;31>i;i++)t.push(e);return t}function Sn(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function bs(e,t,i,l,c,u){var p=e.pendingLanes;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=i,e.entangledLanes&=i,e.errorRecoveryDisabledLanes&=i,e.shellSuspendCounter=0;var b=e.entanglements,j=e.expirationTimes,B=e.hiddenUpdates;for(i=p&~i;0<i;){var Y=31-Nt(i),I=1<<Y;b[Y]=0,j[Y]=-1;var L=B[Y];if(L!==null)for(B[Y]=null,Y=0;Y<L.length;Y++){var P=L[Y];P!==null&&(P.lane&=-536870913)}i&=~I}l!==0&&xs(e,l,0),u!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=u&~(p&~t))}function xs(e,t,i){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-Nt(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|i&261930}function ri(e,t){var i=e.entangledLanes|=t;for(e=e.entanglements;i;){var l=31-Nt(i),c=1<<l;c&t|e[l]&t&&(e[l]|=t),i&=~c}}function vs(e,t){var i=t&-t;return i=(i&42)!==0?1:Vn(i),(i&(e.suspendedLanes|t))!==0?0:i}function Vn(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function ai(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function zr(){var e=te.p;return e!==0?e:(e=window.event,e===void 0?32:Xp(e.type))}function el(e,t){var i=te.p;try{return te.p=e,t()}finally{te.p=i}}var Rn=Math.random().toString(36).slice(2),Ie="__reactFiber$"+Rn,it="__reactProps$"+Rn,Yt="__reactContainer$"+Rn,li="__reactEvents$"+Rn,qr="__reactListeners$"+Rn,tl="__reactHandles$"+Rn,nl="__reactResources$"+Rn,yt="__reactMarker$"+Rn;function zi(e){delete e[Ie],delete e[it],delete e[li],delete e[qr],delete e[tl]}function x(e){var t=e[Ie];if(t)return t;for(var i=e.parentNode;i;){if(t=i[Yt]||i[Ie]){if(i=t.alternate,t.child!==null||i!==null&&i.child!==null)for(e=Dp(e);e!==null;){if(i=e[Ie])return i;e=Dp(e)}return t}e=i,i=e.parentNode}return null}function S(e){if(e=e[Ie]||e[Yt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function _(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(a(33))}function A(e){var t=e[nl];return t||(t=e[nl]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function N(e){e[yt]=!0}var z=new Set,Q={};function Z(e,t){H(e,t),H(e+"Capture",t)}function H(e,t){for(Q[e]=t,e=0;e<t.length;e++)z.add(t[e])}var J=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),fe={},je={};function Ke(e){return Cr.call(je,e)?!0:Cr.call(fe,e)?!1:J.test(e)?je[e]=!0:(fe[e]=!0,!1)}function Ct(e,t,i){if(Ke(t))if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var l=t.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+i)}}function En(e,t,i){if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+i)}}function Fn(e,t,i,l){if(l===null)e.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(i);return}e.setAttributeNS(t,i,""+l)}}function on(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function bh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function py(e,t,i){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var c=l.get,u=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(p){i=""+p,u.call(this,p)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return i},setValue:function(p){i=""+p},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Wo(e){if(!e._valueTracker){var t=bh(e)?"checked":"value";e._valueTracker=py(e,t,""+e[t])}}function xh(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),l="";return e&&(l=bh(e)?e.checked?"true":"false":e.value),e=l,e!==i?(t.setValue(e),!0):!1}function sl(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var gy=/[\n"\\]/g;function cn(e){return e.replace(gy,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function ec(e,t,i,l,c,u,p,b){e.name="",p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"?e.type=p:e.removeAttribute("type"),t!=null?p==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+on(t)):e.value!==""+on(t)&&(e.value=""+on(t)):p!=="submit"&&p!=="reset"||e.removeAttribute("value"),t!=null?tc(e,p,on(t)):i!=null?tc(e,p,on(i)):l!=null&&e.removeAttribute("value"),c==null&&u!=null&&(e.defaultChecked=!!u),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.name=""+on(b):e.removeAttribute("name")}function vh(e,t,i,l,c,u,p,b){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(e.type=u),t!=null||i!=null){if(!(u!=="submit"&&u!=="reset"||t!=null)){Wo(e);return}i=i!=null?""+on(i):"",t=t!=null?""+on(t):i,b||t===e.value||(e.value=t),e.defaultValue=t}l=l??c,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=b?e.checked:!!l,e.defaultChecked=!!l,p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.name=p),Wo(e)}function tc(e,t,i){t==="number"&&sl(e.ownerDocument)===e||e.defaultValue===""+i||(e.defaultValue=""+i)}function qi(e,t,i,l){if(e=e.options,t){t={};for(var c=0;c<i.length;c++)t["$"+i[c]]=!0;for(i=0;i<e.length;i++)c=t.hasOwnProperty("$"+e[i].value),e[i].selected!==c&&(e[i].selected=c),c&&l&&(e[i].defaultSelected=!0)}else{for(i=""+on(i),t=null,c=0;c<e.length;c++){if(e[c].value===i){e[c].selected=!0,l&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function _h(e,t,i){if(t!=null&&(t=""+on(t),t!==e.value&&(e.value=t),i==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=i!=null?""+on(i):""}function wh(e,t,i,l){if(t==null){if(l!=null){if(i!=null)throw Error(a(92));if(Me(l)){if(1<l.length)throw Error(a(93));l=l[0]}i=l}i==null&&(i=""),t=i}i=on(t),e.defaultValue=i,l=e.textContent,l===i&&l!==""&&l!==null&&(e.value=l),Wo(e)}function Ui(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}var yy=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 Sh(e,t,i){var l=t.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?l?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":l?e.setProperty(t,i):typeof i!="number"||i===0||yy.has(t)?t==="float"?e.cssFloat=i:e[t]=(""+i).trim():e[t]=i+"px"}function Eh(e,t,i){if(t!=null&&typeof t!="object")throw Error(a(62));if(e=e.style,i!=null){for(var l in i)!i.hasOwnProperty(l)||t!=null&&t.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var c in t)l=t[c],t.hasOwnProperty(c)&&i[c]!==l&&Sh(e,c,l)}else for(var u in t)t.hasOwnProperty(u)&&Sh(e,u,t[u])}function nc(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 by=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"]]),xy=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function il(e){return xy.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Jn(){}var sc=null;function ic(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Bi=null,Li=null;function Ah(e){var t=S(e);if(t&&(e=t.stateNode)){var i=e[it]||null;e:switch(e=t.stateNode,t.type){case"input":if(ec(e,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),t=i.name,i.type==="radio"&&t!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+cn(""+t)+'"][type="radio"]'),t=0;t<i.length;t++){var l=i[t];if(l!==e&&l.form===e.form){var c=l[it]||null;if(!c)throw Error(a(90));ec(l,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(t=0;t<i.length;t++)l=i[t],l.form===e.form&&xh(l)}break e;case"textarea":_h(e,i.value,i.defaultValue);break e;case"select":t=i.value,t!=null&&qi(e,!!i.multiple,t,!1)}}}var rc=!1;function jh(e,t,i){if(rc)return e(t,i);rc=!0;try{var l=e(t);return l}finally{if(rc=!1,(Bi!==null||Li!==null)&&(Vl(),Bi&&(t=Bi,e=Li,Li=Bi=null,Ah(t),e)))for(t=0;t<e.length;t++)Ah(e[t])}}function Ur(e,t){var i=e.stateNode;if(i===null)return null;var l=i[it]||null;if(l===null)return null;i=l[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(a(231,t,typeof i));return i}var Qn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ac=!1;if(Qn)try{var Br={};Object.defineProperty(Br,"passive",{get:function(){ac=!0}}),window.addEventListener("test",Br,Br),window.removeEventListener("test",Br,Br)}catch{ac=!1}var _s=null,lc=null,rl=null;function Oh(){if(rl)return rl;var e,t=lc,i=t.length,l,c="value"in _s?_s.value:_s.textContent,u=c.length;for(e=0;e<i&&t[e]===c[e];e++);var p=i-e;for(l=1;l<=p&&t[i-l]===c[u-l];l++);return rl=c.slice(e,1<l?1-l:void 0)}function al(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function ll(){return!0}function Th(){return!1}function zt(e){function t(i,l,c,u,p){this._reactName=i,this._targetInst=c,this.type=l,this.nativeEvent=u,this.target=p,this.currentTarget=null;for(var b in e)e.hasOwnProperty(b)&&(i=e[b],this[b]=i?i(u):u[b]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?ll:Th,this.isPropagationStopped=Th,this}return w(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=ll)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=ll)},persist:function(){},isPersistent:ll}),t}var oi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ol=zt(oi),Lr=w({},oi,{view:0,detail:0}),vy=zt(Lr),oc,cc,Hr,cl=w({},Lr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:fc,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!==Hr&&(Hr&&e.type==="mousemove"?(oc=e.screenX-Hr.screenX,cc=e.screenY-Hr.screenY):cc=oc=0,Hr=e),oc)},movementY:function(e){return"movementY"in e?e.movementY:cc}}),Nh=zt(cl),_y=w({},cl,{dataTransfer:0}),wy=zt(_y),Sy=w({},Lr,{relatedTarget:0}),uc=zt(Sy),Ey=w({},oi,{animationName:0,elapsedTime:0,pseudoElement:0}),Ay=zt(Ey),jy=w({},oi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Oy=zt(jy),Ty=w({},oi,{data:0}),Ch=zt(Ty),Ny={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Cy={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"},ky={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function My(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=ky[e])?!!t[e]:!1}function fc(){return My}var Ry=w({},Lr,{key:function(e){if(e.key){var t=Ny[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=al(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Cy[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:fc,charCode:function(e){return e.type==="keypress"?al(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?al(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Dy=zt(Ry),zy=w({},cl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),kh=zt(zy),qy=w({},Lr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:fc}),Uy=zt(qy),By=w({},oi,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ly=zt(By),Hy=w({},cl,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Py=zt(Hy),$y=w({},oi,{newState:0,oldState:0}),Yy=zt($y),Gy=[9,13,27,32],hc=Qn&&"CompositionEvent"in window,Pr=null;Qn&&"documentMode"in document&&(Pr=document.documentMode);var Vy=Qn&&"TextEvent"in window&&!Pr,Mh=Qn&&(!hc||Pr&&8<Pr&&11>=Pr),Rh=" ",Dh=!1;function zh(e,t){switch(e){case"keyup":return Gy.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function qh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Hi=!1;function Fy(e,t){switch(e){case"compositionend":return qh(t);case"keypress":return t.which!==32?null:(Dh=!0,Rh);case"textInput":return e=t.data,e===Rh&&Dh?null:e;default:return null}}function Jy(e,t){if(Hi)return e==="compositionend"||!hc&&zh(e,t)?(e=Oh(),rl=lc=_s=null,Hi=!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 Mh&&t.locale!=="ko"?null:t.data;default:return null}}var Qy={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 Uh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Qy[e.type]:t==="textarea"}function Bh(e,t,i,l){Bi?Li?Li.push(l):Li=[l]:Bi=l,t=Zl(t,"onChange"),0<t.length&&(i=new ol("onChange","change",null,i,l),e.push({event:i,listeners:t}))}var $r=null,Yr=null;function Iy(e){vp(e,0)}function ul(e){var t=_(e);if(xh(t))return e}function Lh(e,t){if(e==="change")return t}var Hh=!1;if(Qn){var dc;if(Qn){var mc="oninput"in document;if(!mc){var Ph=document.createElement("div");Ph.setAttribute("oninput","return;"),mc=typeof Ph.oninput=="function"}dc=mc}else dc=!1;Hh=dc&&(!document.documentMode||9<document.documentMode)}function $h(){$r&&($r.detachEvent("onpropertychange",Yh),Yr=$r=null)}function Yh(e){if(e.propertyName==="value"&&ul(Yr)){var t=[];Bh(t,Yr,e,ic(e)),jh(Iy,t)}}function Xy(e,t,i){e==="focusin"?($h(),$r=t,Yr=i,$r.attachEvent("onpropertychange",Yh)):e==="focusout"&&$h()}function Ky(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ul(Yr)}function Zy(e,t){if(e==="click")return ul(t)}function Wy(e,t){if(e==="input"||e==="change")return ul(t)}function eb(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Gt=typeof Object.is=="function"?Object.is:eb;function Gr(e,t){if(Gt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var i=Object.keys(e),l=Object.keys(t);if(i.length!==l.length)return!1;for(l=0;l<i.length;l++){var c=i[l];if(!Cr.call(t,c)||!Gt(e[c],t[c]))return!1}return!0}function Gh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Vh(e,t){var i=Gh(e);e=0;for(var l;i;){if(i.nodeType===3){if(l=e+i.textContent.length,e<=t&&l>=t)return{node:i,offset:t-e};e=l}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Gh(i)}}function Fh(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Fh(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Jh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=sl(e.document);t instanceof e.HTMLIFrameElement;){try{var i=typeof t.contentWindow.location.href=="string"}catch{i=!1}if(i)e=t.contentWindow;else break;t=sl(e.document)}return t}function pc(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 tb=Qn&&"documentMode"in document&&11>=document.documentMode,Pi=null,gc=null,Vr=null,yc=!1;function Qh(e,t,i){var l=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;yc||Pi==null||Pi!==sl(l)||(l=Pi,"selectionStart"in l&&pc(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}),Vr&&Gr(Vr,l)||(Vr=l,l=Zl(gc,"onSelect"),0<l.length&&(t=new ol("onSelect","select",null,t,i),e.push({event:t,listeners:l}),t.target=Pi)))}function ci(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var $i={animationend:ci("Animation","AnimationEnd"),animationiteration:ci("Animation","AnimationIteration"),animationstart:ci("Animation","AnimationStart"),transitionrun:ci("Transition","TransitionRun"),transitionstart:ci("Transition","TransitionStart"),transitioncancel:ci("Transition","TransitionCancel"),transitionend:ci("Transition","TransitionEnd")},bc={},Ih={};Qn&&(Ih=document.createElement("div").style,"AnimationEvent"in window||(delete $i.animationend.animation,delete $i.animationiteration.animation,delete $i.animationstart.animation),"TransitionEvent"in window||delete $i.transitionend.transition);function ui(e){if(bc[e])return bc[e];if(!$i[e])return e;var t=$i[e],i;for(i in t)if(t.hasOwnProperty(i)&&i in Ih)return bc[e]=t[i];return e}var Xh=ui("animationend"),Kh=ui("animationiteration"),Zh=ui("animationstart"),nb=ui("transitionrun"),sb=ui("transitionstart"),ib=ui("transitioncancel"),Wh=ui("transitionend"),ed=new Map,xc="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(" ");xc.push("scrollEnd");function An(e,t){ed.set(e,t),Z(t,[e])}var fl=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},un=[],Yi=0,vc=0;function hl(){for(var e=Yi,t=vc=Yi=0;t<e;){var i=un[t];un[t++]=null;var l=un[t];un[t++]=null;var c=un[t];un[t++]=null;var u=un[t];if(un[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&&td(i,c,u)}}function dl(e,t,i,l){un[Yi++]=e,un[Yi++]=t,un[Yi++]=i,un[Yi++]=l,vc|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function _c(e,t,i,l){return dl(e,t,i,l),ml(e)}function fi(e,t){return dl(e,null,null,t),ml(e)}function td(e,t,i){e.lanes|=i;var l=e.alternate;l!==null&&(l.lanes|=i);for(var c=!1,u=e.return;u!==null;)u.childLanes|=i,l=u.alternate,l!==null&&(l.childLanes|=i),u.tag===22&&(e=u.stateNode,e===null||e._visibility&1||(c=!0)),e=u,u=u.return;return e.tag===3?(u=e.stateNode,c&&t!==null&&(c=31-Nt(i),e=u.hiddenUpdates,l=e[c],l===null?e[c]=[t]:l.push(t),t.lane=i|536870912),u):null}function ml(e){if(50<da)throw da=0,Cu=null,Error(a(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Gi={};function rb(e,t,i,l){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Vt(e,t,i,l){return new rb(e,t,i,l)}function wc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function In(e,t){var i=e.alternate;return i===null?(i=Vt(e.tag,t,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&65011712,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i.refCleanup=e.refCleanup,i}function nd(e,t){e.flags&=65011714;var i=e.alternate;return i===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=i.childLanes,e.lanes=i.lanes,e.child=i.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=i.memoizedProps,e.memoizedState=i.memoizedState,e.updateQueue=i.updateQueue,e.type=i.type,t=i.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function pl(e,t,i,l,c,u){var p=0;if(l=e,typeof e=="function")wc(e)&&(p=1);else if(typeof e=="string")p=ux(e,i,lt.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case G:return e=Vt(31,i,t,c),e.elementType=G,e.lanes=u,e;case D:return hi(i.children,c,u,t);case W:p=8,c|=24;break;case se:return e=Vt(12,i,t,c|2),e.elementType=se,e.lanes=u,e;case C:return e=Vt(13,i,t,c),e.elementType=C,e.lanes=u,e;case X:return e=Vt(19,i,t,c),e.elementType=X,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case me:p=10;break e;case ee:p=9;break e;case re:p=11;break e;case ce:p=14;break e;case V:p=16,l=null;break e}p=29,i=Error(a(130,e===null?"null":typeof e,"")),l=null}return t=Vt(p,i,t,c),t.elementType=e,t.type=l,t.lanes=u,t}function hi(e,t,i,l){return e=Vt(7,e,l,t),e.lanes=i,e}function Sc(e,t,i){return e=Vt(6,e,null,t),e.lanes=i,e}function sd(e){var t=Vt(18,null,null,0);return t.stateNode=e,t}function Ec(e,t,i){return t=Vt(4,e.children!==null?e.children:[],e.key,t),t.lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var id=new WeakMap;function fn(e,t){if(typeof e=="object"&&e!==null){var i=id.get(e);return i!==void 0?i:(t={value:e,source:t,stack:Qa(t)},id.set(e,t),t)}return{value:e,source:t,stack:Qa(t)}}var Vi=[],Fi=0,gl=null,Fr=0,hn=[],dn=0,ws=null,Dn=1,zn="";function Xn(e,t){Vi[Fi++]=Fr,Vi[Fi++]=gl,gl=e,Fr=t}function rd(e,t,i){hn[dn++]=Dn,hn[dn++]=zn,hn[dn++]=ws,ws=e;var l=Dn;e=zn;var c=32-Nt(l)-1;l&=~(1<<c),i+=1;var u=32-Nt(t)+c;if(30<u){var p=c-c%5;u=(l&(1<<p)-1).toString(32),l>>=p,c-=p,Dn=1<<32-Nt(t)+c|i<<c|l,zn=u+e}else Dn=1<<u|i<<c|l,zn=e}function Ac(e){e.return!==null&&(Xn(e,1),rd(e,1,0))}function jc(e){for(;e===gl;)gl=Vi[--Fi],Vi[Fi]=null,Fr=Vi[--Fi],Vi[Fi]=null;for(;e===ws;)ws=hn[--dn],hn[dn]=null,zn=hn[--dn],hn[dn]=null,Dn=hn[--dn],hn[dn]=null}function ad(e,t){hn[dn++]=Dn,hn[dn++]=zn,hn[dn++]=ws,Dn=t.id,zn=t.overflow,ws=e}var wt=null,Ze=null,ze=!1,Ss=null,mn=!1,Oc=Error(a(519));function Es(e){var t=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Jr(fn(t,e)),Oc}function ld(e){var t=e.stateNode,i=e.type,l=e.memoizedProps;switch(t[Ie]=e,t[it]=l,i){case"dialog":Ce("cancel",t),Ce("close",t);break;case"iframe":case"object":case"embed":Ce("load",t);break;case"video":case"audio":for(i=0;i<pa.length;i++)Ce(pa[i],t);break;case"source":Ce("error",t);break;case"img":case"image":case"link":Ce("error",t),Ce("load",t);break;case"details":Ce("toggle",t);break;case"input":Ce("invalid",t),vh(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Ce("invalid",t);break;case"textarea":Ce("invalid",t),wh(t,l.value,l.defaultValue,l.children)}i=l.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||t.textContent===""+i||l.suppressHydrationWarning===!0||Ep(t.textContent,i)?(l.popover!=null&&(Ce("beforetoggle",t),Ce("toggle",t)),l.onScroll!=null&&Ce("scroll",t),l.onScrollEnd!=null&&Ce("scrollend",t),l.onClick!=null&&(t.onclick=Jn),t=!0):t=!1,t||Es(e,!0)}function od(e){for(wt=e.return;wt;)switch(wt.tag){case 5:case 31:case 13:mn=!1;return;case 27:case 3:mn=!0;return;default:wt=wt.return}}function Ji(e){if(e!==wt)return!1;if(!ze)return od(e),ze=!0,!1;var t=e.tag,i;if((i=t!==3&&t!==27)&&((i=t===5)&&(i=e.type,i=!(i!=="form"&&i!=="button")||Vu(e.type,e.memoizedProps)),i=!i),i&&Ze&&Es(e),od(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));Ze=Rp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));Ze=Rp(e)}else t===27?(t=Ze,Bs(e.type)?(e=Xu,Xu=null,Ze=e):Ze=t):Ze=wt?gn(e.stateNode.nextSibling):null;return!0}function di(){Ze=wt=null,ze=!1}function Tc(){var e=Ss;return e!==null&&(Lt===null?Lt=e:Lt.push.apply(Lt,e),Ss=null),e}function Jr(e){Ss===null?Ss=[e]:Ss.push(e)}var Nc=Oe(null),mi=null,Kn=null;function As(e,t,i){Te(Nc,t._currentValue),t._currentValue=i}function Zn(e){e._currentValue=Nc.current,we(Nc)}function Cc(e,t,i){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===i)break;e=e.return}}function kc(e,t,i,l){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var u=c.dependencies;if(u!==null){var p=c.child;u=u.firstContext;e:for(;u!==null;){var b=u;u=c;for(var j=0;j<t.length;j++)if(b.context===t[j]){u.lanes|=i,b=u.alternate,b!==null&&(b.lanes|=i),Cc(u.return,i,e),l||(p=null);break e}u=b.next}}else if(c.tag===18){if(p=c.return,p===null)throw Error(a(341));p.lanes|=i,u=p.alternate,u!==null&&(u.lanes|=i),Cc(p,i,e),p=null}else p=c.child;if(p!==null)p.return=c;else for(p=c;p!==null;){if(p===e){p=null;break}if(c=p.sibling,c!==null){c.return=p.return,p=c;break}p=p.return}c=p}}function Qi(e,t,i,l){e=null;for(var c=t,u=!1;c!==null;){if(!u){if((c.flags&524288)!==0)u=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var p=c.alternate;if(p===null)throw Error(a(387));if(p=p.memoizedProps,p!==null){var b=c.type;Gt(c.pendingProps.value,p.value)||(e!==null?e.push(b):e=[b])}}else if(c===jt.current){if(p=c.alternate,p===null)throw Error(a(387));p.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(va):e=[va])}c=c.return}e!==null&&kc(t,e,i,l),t.flags|=262144}function yl(e){for(e=e.firstContext;e!==null;){if(!Gt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function pi(e){mi=e,Kn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function St(e){return cd(mi,e)}function bl(e,t){return mi===null&&pi(e),cd(e,t)}function cd(e,t){var i=t._currentValue;if(t={context:t,memoizedValue:i,next:null},Kn===null){if(e===null)throw Error(a(308));Kn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Kn=Kn.next=t;return i}var ab=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(i,l){e.push(l)}};this.abort=function(){t.aborted=!0,e.forEach(function(i){return i()})}},lb=r.unstable_scheduleCallback,ob=r.unstable_NormalPriority,ht={$$typeof:me,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Mc(){return{controller:new ab,data:new Map,refCount:0}}function Qr(e){e.refCount--,e.refCount===0&&lb(ob,function(){e.controller.abort()})}var Ir=null,Rc=0,Ii=0,Xi=null;function cb(e,t){if(Ir===null){var i=Ir=[];Rc=0,Ii=qu(),Xi={status:"pending",value:void 0,then:function(l){i.push(l)}}}return Rc++,t.then(ud,ud),t}function ud(){if(--Rc===0&&Ir!==null){Xi!==null&&(Xi.status="fulfilled");var e=Ir;Ir=null,Ii=0,Xi=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ub(e,t){var i=[],l={status:"pending",value:null,reason:null,then:function(c){i.push(c)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var c=0;c<i.length;c++)(0,i[c])(t)},function(c){for(l.status="rejected",l.reason=c,c=0;c<i.length;c++)(0,i[c])(void 0)}),l}var fd=$.S;$.S=function(e,t){Qm=et(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&cb(e,t),fd!==null&&fd(e,t)};var gi=Oe(null);function Dc(){var e=gi.current;return e!==null?e:Xe.pooledCache}function xl(e,t){t===null?Te(gi,gi.current):Te(gi,t.pool)}function hd(){var e=Dc();return e===null?null:{parent:ht._currentValue,pool:e}}var Ki=Error(a(460)),zc=Error(a(474)),vl=Error(a(542)),_l={then:function(){}};function dd(e){return e=e.status,e==="fulfilled"||e==="rejected"}function md(e,t,i){switch(i=e[i],i===void 0?e.push(t):i!==t&&(t.then(Jn,Jn),t=i),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,gd(e),e;default:if(typeof t.status=="string")t.then(Jn,Jn);else{if(e=Xe,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,gd(e),e}throw bi=t,Ki}}function yi(e){try{var t=e._init;return t(e._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(bi=i,Ki):i}}var bi=null;function pd(){if(bi===null)throw Error(a(459));var e=bi;return bi=null,e}function gd(e){if(e===Ki||e===vl)throw Error(a(483))}var Zi=null,Xr=0;function wl(e){var t=Xr;return Xr+=1,Zi===null&&(Zi=[]),md(Zi,e,t)}function Kr(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Sl(e,t){throw t.$$typeof===O?Error(a(525)):(e=Object.prototype.toString.call(t),Error(a(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function yd(e){function t(R,k){if(e){var U=R.deletions;U===null?(R.deletions=[k],R.flags|=16):U.push(k)}}function i(R,k){if(!e)return null;for(;k!==null;)t(R,k),k=k.sibling;return null}function l(R){for(var k=new Map;R!==null;)R.key!==null?k.set(R.key,R):k.set(R.index,R),R=R.sibling;return k}function c(R,k){return R=In(R,k),R.index=0,R.sibling=null,R}function u(R,k,U){return R.index=U,e?(U=R.alternate,U!==null?(U=U.index,U<k?(R.flags|=67108866,k):U):(R.flags|=67108866,k)):(R.flags|=1048576,k)}function p(R){return e&&R.alternate===null&&(R.flags|=67108866),R}function b(R,k,U,F){return k===null||k.tag!==6?(k=Sc(U,R.mode,F),k.return=R,k):(k=c(k,U),k.return=R,k)}function j(R,k,U,F){var ge=U.type;return ge===D?Y(R,k,U.props.children,F,U.key):k!==null&&(k.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===V&&yi(ge)===k.type)?(k=c(k,U.props),Kr(k,U),k.return=R,k):(k=pl(U.type,U.key,U.props,null,R.mode,F),Kr(k,U),k.return=R,k)}function B(R,k,U,F){return k===null||k.tag!==4||k.stateNode.containerInfo!==U.containerInfo||k.stateNode.implementation!==U.implementation?(k=Ec(U,R.mode,F),k.return=R,k):(k=c(k,U.children||[]),k.return=R,k)}function Y(R,k,U,F,ge){return k===null||k.tag!==7?(k=hi(U,R.mode,F,ge),k.return=R,k):(k=c(k,U),k.return=R,k)}function I(R,k,U){if(typeof k=="string"&&k!==""||typeof k=="number"||typeof k=="bigint")return k=Sc(""+k,R.mode,U),k.return=R,k;if(typeof k=="object"&&k!==null){switch(k.$$typeof){case q:return U=pl(k.type,k.key,k.props,null,R.mode,U),Kr(U,k),U.return=R,U;case M:return k=Ec(k,R.mode,U),k.return=R,k;case V:return k=yi(k),I(R,k,U)}if(Me(k)||ne(k))return k=hi(k,R.mode,U,null),k.return=R,k;if(typeof k.then=="function")return I(R,wl(k),U);if(k.$$typeof===me)return I(R,bl(R,k),U);Sl(R,k)}return null}function L(R,k,U,F){var ge=k!==null?k.key:null;if(typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint")return ge!==null?null:b(R,k,""+U,F);if(typeof U=="object"&&U!==null){switch(U.$$typeof){case q:return U.key===ge?j(R,k,U,F):null;case M:return U.key===ge?B(R,k,U,F):null;case V:return U=yi(U),L(R,k,U,F)}if(Me(U)||ne(U))return ge!==null?null:Y(R,k,U,F,null);if(typeof U.then=="function")return L(R,k,wl(U),F);if(U.$$typeof===me)return L(R,k,bl(R,U),F);Sl(R,U)}return null}function P(R,k,U,F,ge){if(typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint")return R=R.get(U)||null,b(k,R,""+F,ge);if(typeof F=="object"&&F!==null){switch(F.$$typeof){case q:return R=R.get(F.key===null?U:F.key)||null,j(k,R,F,ge);case M:return R=R.get(F.key===null?U:F.key)||null,B(k,R,F,ge);case V:return F=yi(F),P(R,k,U,F,ge)}if(Me(F)||ne(F))return R=R.get(U)||null,Y(k,R,F,ge,null);if(typeof F.then=="function")return P(R,k,U,wl(F),ge);if(F.$$typeof===me)return P(R,k,U,bl(k,F),ge);Sl(k,F)}return null}function he(R,k,U,F){for(var ge=null,Be=null,pe=k,Ae=k=0,De=null;pe!==null&&Ae<U.length;Ae++){pe.index>Ae?(De=pe,pe=null):De=pe.sibling;var Le=L(R,pe,U[Ae],F);if(Le===null){pe===null&&(pe=De);break}e&&pe&&Le.alternate===null&&t(R,pe),k=u(Le,k,Ae),Be===null?ge=Le:Be.sibling=Le,Be=Le,pe=De}if(Ae===U.length)return i(R,pe),ze&&Xn(R,Ae),ge;if(pe===null){for(;Ae<U.length;Ae++)pe=I(R,U[Ae],F),pe!==null&&(k=u(pe,k,Ae),Be===null?ge=pe:Be.sibling=pe,Be=pe);return ze&&Xn(R,Ae),ge}for(pe=l(pe);Ae<U.length;Ae++)De=P(pe,R,Ae,U[Ae],F),De!==null&&(e&&De.alternate!==null&&pe.delete(De.key===null?Ae:De.key),k=u(De,k,Ae),Be===null?ge=De:Be.sibling=De,Be=De);return e&&pe.forEach(function(Ys){return t(R,Ys)}),ze&&Xn(R,Ae),ge}function ye(R,k,U,F){if(U==null)throw Error(a(151));for(var ge=null,Be=null,pe=k,Ae=k=0,De=null,Le=U.next();pe!==null&&!Le.done;Ae++,Le=U.next()){pe.index>Ae?(De=pe,pe=null):De=pe.sibling;var Ys=L(R,pe,Le.value,F);if(Ys===null){pe===null&&(pe=De);break}e&&pe&&Ys.alternate===null&&t(R,pe),k=u(Ys,k,Ae),Be===null?ge=Ys:Be.sibling=Ys,Be=Ys,pe=De}if(Le.done)return i(R,pe),ze&&Xn(R,Ae),ge;if(pe===null){for(;!Le.done;Ae++,Le=U.next())Le=I(R,Le.value,F),Le!==null&&(k=u(Le,k,Ae),Be===null?ge=Le:Be.sibling=Le,Be=Le);return ze&&Xn(R,Ae),ge}for(pe=l(pe);!Le.done;Ae++,Le=U.next())Le=P(pe,R,Ae,Le.value,F),Le!==null&&(e&&Le.alternate!==null&&pe.delete(Le.key===null?Ae:Le.key),k=u(Le,k,Ae),Be===null?ge=Le:Be.sibling=Le,Be=Le);return e&&pe.forEach(function(_x){return t(R,_x)}),ze&&Xn(R,Ae),ge}function Qe(R,k,U,F){if(typeof U=="object"&&U!==null&&U.type===D&&U.key===null&&(U=U.props.children),typeof U=="object"&&U!==null){switch(U.$$typeof){case q:e:{for(var ge=U.key;k!==null;){if(k.key===ge){if(ge=U.type,ge===D){if(k.tag===7){i(R,k.sibling),F=c(k,U.props.children),F.return=R,R=F;break e}}else if(k.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===V&&yi(ge)===k.type){i(R,k.sibling),F=c(k,U.props),Kr(F,U),F.return=R,R=F;break e}i(R,k);break}else t(R,k);k=k.sibling}U.type===D?(F=hi(U.props.children,R.mode,F,U.key),F.return=R,R=F):(F=pl(U.type,U.key,U.props,null,R.mode,F),Kr(F,U),F.return=R,R=F)}return p(R);case M:e:{for(ge=U.key;k!==null;){if(k.key===ge)if(k.tag===4&&k.stateNode.containerInfo===U.containerInfo&&k.stateNode.implementation===U.implementation){i(R,k.sibling),F=c(k,U.children||[]),F.return=R,R=F;break e}else{i(R,k);break}else t(R,k);k=k.sibling}F=Ec(U,R.mode,F),F.return=R,R=F}return p(R);case V:return U=yi(U),Qe(R,k,U,F)}if(Me(U))return he(R,k,U,F);if(ne(U)){if(ge=ne(U),typeof ge!="function")throw Error(a(150));return U=ge.call(U),ye(R,k,U,F)}if(typeof U.then=="function")return Qe(R,k,wl(U),F);if(U.$$typeof===me)return Qe(R,k,bl(R,U),F);Sl(R,U)}return typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint"?(U=""+U,k!==null&&k.tag===6?(i(R,k.sibling),F=c(k,U),F.return=R,R=F):(i(R,k),F=Sc(U,R.mode,F),F.return=R,R=F),p(R)):i(R,k)}return function(R,k,U,F){try{Xr=0;var ge=Qe(R,k,U,F);return Zi=null,ge}catch(pe){if(pe===Ki||pe===vl)throw pe;var Be=Vt(29,pe,null,R.mode);return Be.lanes=F,Be.return=R,Be}finally{}}}var xi=yd(!0),bd=yd(!1),js=!1;function qc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Uc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Os(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ts(e,t,i){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Pe&2)!==0){var c=l.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),l.pending=t,t=ml(e),td(e,null,i),t}return dl(e,l,t,i),ml(e)}function Zr(e,t,i){if(t=t.updateQueue,t!==null&&(t=t.shared,(i&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,i|=l,t.lanes=i,ri(e,i)}}function Bc(e,t){var i=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,i===l)){var c=null,u=null;if(i=i.firstBaseUpdate,i!==null){do{var p={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};u===null?c=u=p:u=u.next=p,i=i.next}while(i!==null);u===null?c=u=t:u=u.next=t}else c=u=t;i={baseState:l.baseState,firstBaseUpdate:c,lastBaseUpdate:u,shared:l.shared,callbacks:l.callbacks},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}var Lc=!1;function Wr(){if(Lc){var e=Xi;if(e!==null)throw e}}function ea(e,t,i,l){Lc=!1;var c=e.updateQueue;js=!1;var u=c.firstBaseUpdate,p=c.lastBaseUpdate,b=c.shared.pending;if(b!==null){c.shared.pending=null;var j=b,B=j.next;j.next=null,p===null?u=B:p.next=B,p=j;var Y=e.alternate;Y!==null&&(Y=Y.updateQueue,b=Y.lastBaseUpdate,b!==p&&(b===null?Y.firstBaseUpdate=B:b.next=B,Y.lastBaseUpdate=j))}if(u!==null){var I=c.baseState;p=0,Y=B=j=null,b=u;do{var L=b.lane&-536870913,P=L!==b.lane;if(P?(Re&L)===L:(l&L)===L){L!==0&&L===Ii&&(Lc=!0),Y!==null&&(Y=Y.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var he=e,ye=b;L=t;var Qe=i;switch(ye.tag){case 1:if(he=ye.payload,typeof he=="function"){I=he.call(Qe,I,L);break e}I=he;break e;case 3:he.flags=he.flags&-65537|128;case 0:if(he=ye.payload,L=typeof he=="function"?he.call(Qe,I,L):he,L==null)break e;I=w({},I,L);break e;case 2:js=!0}}L=b.callback,L!==null&&(e.flags|=64,P&&(e.flags|=8192),P=c.callbacks,P===null?c.callbacks=[L]:P.push(L))}else P={lane:L,tag:b.tag,payload:b.payload,callback:b.callback,next:null},Y===null?(B=Y=P,j=I):Y=Y.next=P,p|=L;if(b=b.next,b===null){if(b=c.shared.pending,b===null)break;P=b,b=P.next,P.next=null,c.lastBaseUpdate=P,c.shared.pending=null}}while(!0);Y===null&&(j=I),c.baseState=j,c.firstBaseUpdate=B,c.lastBaseUpdate=Y,u===null&&(c.shared.lanes=0),Rs|=p,e.lanes=p,e.memoizedState=I}}function xd(e,t){if(typeof e!="function")throw Error(a(191,e));e.call(t)}function vd(e,t){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;e<i.length;e++)xd(i[e],t)}var Wi=Oe(null),El=Oe(0);function _d(e,t){e=ls,Te(El,e),Te(Wi,t),ls=e|t.baseLanes}function Hc(){Te(El,ls),Te(Wi,Wi.current)}function Pc(){ls=El.current,we(Wi),we(El)}var Ft=Oe(null),pn=null;function Ns(e){var t=e.alternate;Te(ct,ct.current&1),Te(Ft,e),pn===null&&(t===null||Wi.current!==null||t.memoizedState!==null)&&(pn=e)}function $c(e){Te(ct,ct.current),Te(Ft,e),pn===null&&(pn=e)}function wd(e){e.tag===22?(Te(ct,ct.current),Te(Ft,e),pn===null&&(pn=e)):Cs()}function Cs(){Te(ct,ct.current),Te(Ft,Ft.current)}function Jt(e){we(Ft),pn===e&&(pn=null),we(ct)}var ct=Oe(0);function Al(e){for(var t=e;t!==null;){if(t.tag===13){var i=t.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||Qu(i)||Iu(i)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Wn=0,Ee=null,Fe=null,dt=null,jl=!1,er=!1,vi=!1,Ol=0,ta=0,tr=null,fb=0;function rt(){throw Error(a(321))}function Yc(e,t){if(t===null)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!Gt(e[i],t[i]))return!1;return!0}function Gc(e,t,i,l,c,u){return Wn=u,Ee=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,$.H=e===null||e.memoizedState===null?rm:ru,vi=!1,u=i(l,c),vi=!1,er&&(u=Ed(t,i,l,c)),Sd(e),u}function Sd(e){$.H=ia;var t=Fe!==null&&Fe.next!==null;if(Wn=0,dt=Fe=Ee=null,jl=!1,ta=0,tr=null,t)throw Error(a(300));e===null||mt||(e=e.dependencies,e!==null&&yl(e)&&(mt=!0))}function Ed(e,t,i,l){Ee=e;var c=0;do{if(er&&(tr=null),ta=0,er=!1,25<=c)throw Error(a(301));if(c+=1,dt=Fe=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=am,u=t(i,l)}while(er);return u}function hb(){var e=$.H,t=e.useState()[0];return t=typeof t.then=="function"?na(t):t,e=e.useState()[0],(Fe!==null?Fe.memoizedState:null)!==e&&(Ee.flags|=1024),t}function Vc(){var e=Ol!==0;return Ol=0,e}function Fc(e,t,i){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i}function Jc(e){if(jl){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}jl=!1}Wn=0,dt=Fe=Ee=null,er=!1,ta=Ol=0,tr=null}function kt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return dt===null?Ee.memoizedState=dt=e:dt=dt.next=e,dt}function ut(){if(Fe===null){var e=Ee.alternate;e=e!==null?e.memoizedState:null}else e=Fe.next;var t=dt===null?Ee.memoizedState:dt.next;if(t!==null)dt=t,Fe=e;else{if(e===null)throw Ee.alternate===null?Error(a(467)):Error(a(310));Fe=e,e={memoizedState:Fe.memoizedState,baseState:Fe.baseState,baseQueue:Fe.baseQueue,queue:Fe.queue,next:null},dt===null?Ee.memoizedState=dt=e:dt=dt.next=e}return dt}function Tl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function na(e){var t=ta;return ta+=1,tr===null&&(tr=[]),e=md(tr,e,t),t=Ee,(dt===null?t.memoizedState:dt.next)===null&&(t=t.alternate,$.H=t===null||t.memoizedState===null?rm:ru),e}function Nl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return na(e);if(e.$$typeof===me)return St(e)}throw Error(a(438,String(e)))}function Qc(e){var t=null,i=Ee.updateQueue;if(i!==null&&(t=i.memoCache),t==null){var l=Ee.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(c){return c.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),i===null&&(i=Tl(),Ee.updateQueue=i),i.memoCache=t,i=t.data[t.index],i===void 0)for(i=t.data[t.index]=Array(e),l=0;l<e;l++)i[l]=K;return t.index++,i}function es(e,t){return typeof t=="function"?t(e):t}function Cl(e){var t=ut();return Ic(t,Fe,e)}function Ic(e,t,i){var l=e.queue;if(l===null)throw Error(a(311));l.lastRenderedReducer=i;var c=e.baseQueue,u=l.pending;if(u!==null){if(c!==null){var p=c.next;c.next=u.next,u.next=p}t.baseQueue=c=u,l.pending=null}if(u=e.baseState,c===null)e.memoizedState=u;else{t=c.next;var b=p=null,j=null,B=t,Y=!1;do{var I=B.lane&-536870913;if(I!==B.lane?(Re&I)===I:(Wn&I)===I){var L=B.revertLane;if(L===0)j!==null&&(j=j.next={lane:0,revertLane:0,gesture:null,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null}),I===Ii&&(Y=!0);else if((Wn&L)===L){B=B.next,L===Ii&&(Y=!0);continue}else I={lane:0,revertLane:B.revertLane,gesture:null,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null},j===null?(b=j=I,p=u):j=j.next=I,Ee.lanes|=L,Rs|=L;I=B.action,vi&&i(u,I),u=B.hasEagerState?B.eagerState:i(u,I)}else L={lane:I,revertLane:B.revertLane,gesture:B.gesture,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null},j===null?(b=j=L,p=u):j=j.next=L,Ee.lanes|=I,Rs|=I;B=B.next}while(B!==null&&B!==t);if(j===null?p=u:j.next=b,!Gt(u,e.memoizedState)&&(mt=!0,Y&&(i=Xi,i!==null)))throw i;e.memoizedState=u,e.baseState=p,e.baseQueue=j,l.lastRenderedState=u}return c===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Xc(e){var t=ut(),i=t.queue;if(i===null)throw Error(a(311));i.lastRenderedReducer=e;var l=i.dispatch,c=i.pending,u=t.memoizedState;if(c!==null){i.pending=null;var p=c=c.next;do u=e(u,p.action),p=p.next;while(p!==c);Gt(u,t.memoizedState)||(mt=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),i.lastRenderedState=u}return[u,l]}function Ad(e,t,i){var l=Ee,c=ut(),u=ze;if(u){if(i===void 0)throw Error(a(407));i=i()}else i=t();var p=!Gt((Fe||c).memoizedState,i);if(p&&(c.memoizedState=i,mt=!0),c=c.queue,Wc(Td.bind(null,l,c,e),[e]),c.getSnapshot!==t||p||dt!==null&&dt.memoizedState.tag&1){if(l.flags|=2048,nr(9,{destroy:void 0},Od.bind(null,l,c,i,t),null),Xe===null)throw Error(a(349));u||(Wn&127)!==0||jd(l,t,i)}return i}function jd(e,t,i){e.flags|=16384,e={getSnapshot:t,value:i},t=Ee.updateQueue,t===null?(t=Tl(),Ee.updateQueue=t,t.stores=[e]):(i=t.stores,i===null?t.stores=[e]:i.push(e))}function Od(e,t,i,l){t.value=i,t.getSnapshot=l,Nd(t)&&Cd(e)}function Td(e,t,i){return i(function(){Nd(t)&&Cd(e)})}function Nd(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!Gt(e,i)}catch{return!0}}function Cd(e){var t=fi(e,2);t!==null&&Ht(t,e,2)}function Kc(e){var t=kt();if(typeof e=="function"){var i=e;if(e=i(),vi){$t(!0);try{i()}finally{$t(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:es,lastRenderedState:e},t}function kd(e,t,i,l){return e.baseState=i,Ic(e,Fe,typeof l=="function"?l:es)}function db(e,t,i,l,c){if(Rl(e))throw Error(a(485));if(e=t.action,e!==null){var u={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(p){u.listeners.push(p)}};$.T!==null?i(!0):u.isTransition=!1,l(u),i=t.pending,i===null?(u.next=t.pending=u,Md(t,u)):(u.next=i.next,t.pending=i.next=u)}}function Md(e,t){var i=t.action,l=t.payload,c=e.state;if(t.isTransition){var u=$.T,p={};$.T=p;try{var b=i(c,l),j=$.S;j!==null&&j(p,b),Rd(e,t,b)}catch(B){Zc(e,t,B)}finally{u!==null&&p.types!==null&&(u.types=p.types),$.T=u}}else try{u=i(c,l),Rd(e,t,u)}catch(B){Zc(e,t,B)}}function Rd(e,t,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(l){Dd(e,t,l)},function(l){return Zc(e,t,l)}):Dd(e,t,i)}function Dd(e,t,i){t.status="fulfilled",t.value=i,zd(t),e.state=i,t=e.pending,t!==null&&(i=t.next,i===t?e.pending=null:(i=i.next,t.next=i,Md(e,i)))}function Zc(e,t,i){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=i,zd(t),t=t.next;while(t!==l)}e.action=null}function zd(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function qd(e,t){return t}function Ud(e,t){if(ze){var i=Xe.formState;if(i!==null){e:{var l=Ee;if(ze){if(Ze){t:{for(var c=Ze,u=mn;c.nodeType!==8;){if(!u){c=null;break t}if(c=gn(c.nextSibling),c===null){c=null;break t}}u=c.data,c=u==="F!"||u==="F"?c:null}if(c){Ze=gn(c.nextSibling),l=c.data==="F!";break e}}Es(l)}l=!1}l&&(t=i[0])}}return i=kt(),i.memoizedState=i.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:qd,lastRenderedState:t},i.queue=l,i=nm.bind(null,Ee,l),l.dispatch=i,l=Kc(!1),u=iu.bind(null,Ee,!1,l.queue),l=kt(),c={state:t,dispatch:null,action:e,pending:null},l.queue=c,i=db.bind(null,Ee,c,u,i),c.dispatch=i,l.memoizedState=e,[t,i,!1]}function Bd(e){var t=ut();return Ld(t,Fe,e)}function Ld(e,t,i){if(t=Ic(e,t,qd)[0],e=Cl(es)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=na(t)}catch(p){throw p===Ki?vl:p}else l=t;t=ut();var c=t.queue,u=c.dispatch;return i!==t.memoizedState&&(Ee.flags|=2048,nr(9,{destroy:void 0},mb.bind(null,c,i),null)),[l,u,e]}function mb(e,t){e.action=t}function Hd(e){var t=ut(),i=Fe;if(i!==null)return Ld(t,i,e);ut(),t=t.memoizedState,i=ut();var l=i.queue.dispatch;return i.memoizedState=e,[t,l,!1]}function nr(e,t,i,l){return e={tag:e,create:i,deps:l,inst:t,next:null},t=Ee.updateQueue,t===null&&(t=Tl(),Ee.updateQueue=t),i=t.lastEffect,i===null?t.lastEffect=e.next=e:(l=i.next,i.next=e,e.next=l,t.lastEffect=e),e}function Pd(){return ut().memoizedState}function kl(e,t,i,l){var c=kt();Ee.flags|=e,c.memoizedState=nr(1|t,{destroy:void 0},i,l===void 0?null:l)}function Ml(e,t,i,l){var c=ut();l=l===void 0?null:l;var u=c.memoizedState.inst;Fe!==null&&l!==null&&Yc(l,Fe.memoizedState.deps)?c.memoizedState=nr(t,u,i,l):(Ee.flags|=e,c.memoizedState=nr(1|t,u,i,l))}function $d(e,t){kl(8390656,8,e,t)}function Wc(e,t){Ml(2048,8,e,t)}function pb(e){Ee.flags|=4;var t=Ee.updateQueue;if(t===null)t=Tl(),Ee.updateQueue=t,t.events=[e];else{var i=t.events;i===null?t.events=[e]:i.push(e)}}function Yd(e){var t=ut().memoizedState;return pb({ref:t,nextImpl:e}),function(){if((Pe&2)!==0)throw Error(a(440));return t.impl.apply(void 0,arguments)}}function Gd(e,t){return Ml(4,2,e,t)}function Vd(e,t){return Ml(4,4,e,t)}function Fd(e,t){if(typeof t=="function"){e=e();var i=t(e);return function(){typeof i=="function"?i():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Jd(e,t,i){i=i!=null?i.concat([e]):null,Ml(4,4,Fd.bind(null,t,e),i)}function eu(){}function Qd(e,t){var i=ut();t=t===void 0?null:t;var l=i.memoizedState;return t!==null&&Yc(t,l[1])?l[0]:(i.memoizedState=[e,t],e)}function Id(e,t){var i=ut();t=t===void 0?null:t;var l=i.memoizedState;if(t!==null&&Yc(t,l[1]))return l[0];if(l=e(),vi){$t(!0);try{e()}finally{$t(!1)}}return i.memoizedState=[l,t],l}function tu(e,t,i){return i===void 0||(Wn&1073741824)!==0&&(Re&261930)===0?e.memoizedState=t:(e.memoizedState=i,e=Xm(),Ee.lanes|=e,Rs|=e,i)}function Xd(e,t,i,l){return Gt(i,t)?i:Wi.current!==null?(e=tu(e,i,l),Gt(e,t)||(mt=!0),e):(Wn&42)===0||(Wn&1073741824)!==0&&(Re&261930)===0?(mt=!0,e.memoizedState=i):(e=Xm(),Ee.lanes|=e,Rs|=e,t)}function Kd(e,t,i,l,c){var u=te.p;te.p=u!==0&&8>u?u:8;var p=$.T,b={};$.T=b,iu(e,!1,t,i);try{var j=c(),B=$.S;if(B!==null&&B(b,j),j!==null&&typeof j=="object"&&typeof j.then=="function"){var Y=ub(j,l);sa(e,t,Y,Xt(e))}else sa(e,t,l,Xt(e))}catch(I){sa(e,t,{then:function(){},status:"rejected",reason:I},Xt())}finally{te.p=u,p!==null&&b.types!==null&&(p.types=b.types),$.T=p}}function gb(){}function nu(e,t,i,l){if(e.tag!==5)throw Error(a(476));var c=Zd(e).queue;Kd(e,c,t,de,i===null?gb:function(){return Wd(e),i(l)})}function Zd(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:de,baseState:de,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:es,lastRenderedState:de},next:null};var i={};return t.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:es,lastRenderedState:i},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Wd(e){var t=Zd(e);t.next===null&&(t=e.alternate.memoizedState),sa(e,t.next.queue,{},Xt())}function su(){return St(va)}function em(){return ut().memoizedState}function tm(){return ut().memoizedState}function yb(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var i=Xt();e=Os(i);var l=Ts(t,e,i);l!==null&&(Ht(l,t,i),Zr(l,t,i)),t={cache:Mc()},e.payload=t;return}t=t.return}}function bb(e,t,i){var l=Xt();i={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Rl(e)?sm(t,i):(i=_c(e,t,i,l),i!==null&&(Ht(i,e,l),im(i,t,l)))}function nm(e,t,i){var l=Xt();sa(e,t,i,l)}function sa(e,t,i,l){var c={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(Rl(e))sm(t,c);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var p=t.lastRenderedState,b=u(p,i);if(c.hasEagerState=!0,c.eagerState=b,Gt(b,p))return dl(e,t,c,0),Xe===null&&hl(),!1}catch{}finally{}if(i=_c(e,t,c,l),i!==null)return Ht(i,e,l),im(i,t,l),!0}return!1}function iu(e,t,i,l){if(l={lane:2,revertLane:qu(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Rl(e)){if(t)throw Error(a(479))}else t=_c(e,i,l,2),t!==null&&Ht(t,e,2)}function Rl(e){var t=e.alternate;return e===Ee||t!==null&&t===Ee}function sm(e,t){er=jl=!0;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function im(e,t,i){if((i&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,i|=l,t.lanes=i,ri(e,i)}}var ia={readContext:St,use:Nl,useCallback:rt,useContext:rt,useEffect:rt,useImperativeHandle:rt,useLayoutEffect:rt,useInsertionEffect:rt,useMemo:rt,useReducer:rt,useRef:rt,useState:rt,useDebugValue:rt,useDeferredValue:rt,useTransition:rt,useSyncExternalStore:rt,useId:rt,useHostTransitionStatus:rt,useFormState:rt,useActionState:rt,useOptimistic:rt,useMemoCache:rt,useCacheRefresh:rt};ia.useEffectEvent=rt;var rm={readContext:St,use:Nl,useCallback:function(e,t){return kt().memoizedState=[e,t===void 0?null:t],e},useContext:St,useEffect:$d,useImperativeHandle:function(e,t,i){i=i!=null?i.concat([e]):null,kl(4194308,4,Fd.bind(null,t,e),i)},useLayoutEffect:function(e,t){return kl(4194308,4,e,t)},useInsertionEffect:function(e,t){kl(4,2,e,t)},useMemo:function(e,t){var i=kt();t=t===void 0?null:t;var l=e();if(vi){$t(!0);try{e()}finally{$t(!1)}}return i.memoizedState=[l,t],l},useReducer:function(e,t,i){var l=kt();if(i!==void 0){var c=i(t);if(vi){$t(!0);try{i(t)}finally{$t(!1)}}}else c=t;return l.memoizedState=l.baseState=c,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:c},l.queue=e,e=e.dispatch=bb.bind(null,Ee,e),[l.memoizedState,e]},useRef:function(e){var t=kt();return e={current:e},t.memoizedState=e},useState:function(e){e=Kc(e);var t=e.queue,i=nm.bind(null,Ee,t);return t.dispatch=i,[e.memoizedState,i]},useDebugValue:eu,useDeferredValue:function(e,t){var i=kt();return tu(i,e,t)},useTransition:function(){var e=Kc(!1);return e=Kd.bind(null,Ee,e.queue,!0,!1),kt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,i){var l=Ee,c=kt();if(ze){if(i===void 0)throw Error(a(407));i=i()}else{if(i=t(),Xe===null)throw Error(a(349));(Re&127)!==0||jd(l,t,i)}c.memoizedState=i;var u={value:i,getSnapshot:t};return c.queue=u,$d(Td.bind(null,l,u,e),[e]),l.flags|=2048,nr(9,{destroy:void 0},Od.bind(null,l,u,i,t),null),i},useId:function(){var e=kt(),t=Xe.identifierPrefix;if(ze){var i=zn,l=Dn;i=(l&~(1<<32-Nt(l)-1)).toString(32)+i,t="_"+t+"R_"+i,i=Ol++,0<i&&(t+="H"+i.toString(32)),t+="_"}else i=fb++,t="_"+t+"r_"+i.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:su,useFormState:Ud,useActionState:Ud,useOptimistic:function(e){var t=kt();t.memoizedState=t.baseState=e;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=i,t=iu.bind(null,Ee,!0,i),i.dispatch=t,[e,t]},useMemoCache:Qc,useCacheRefresh:function(){return kt().memoizedState=yb.bind(null,Ee)},useEffectEvent:function(e){var t=kt(),i={impl:e};return t.memoizedState=i,function(){if((Pe&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}},ru={readContext:St,use:Nl,useCallback:Qd,useContext:St,useEffect:Wc,useImperativeHandle:Jd,useInsertionEffect:Gd,useLayoutEffect:Vd,useMemo:Id,useReducer:Cl,useRef:Pd,useState:function(){return Cl(es)},useDebugValue:eu,useDeferredValue:function(e,t){var i=ut();return Xd(i,Fe.memoizedState,e,t)},useTransition:function(){var e=Cl(es)[0],t=ut().memoizedState;return[typeof e=="boolean"?e:na(e),t]},useSyncExternalStore:Ad,useId:em,useHostTransitionStatus:su,useFormState:Bd,useActionState:Bd,useOptimistic:function(e,t){var i=ut();return kd(i,Fe,e,t)},useMemoCache:Qc,useCacheRefresh:tm};ru.useEffectEvent=Yd;var am={readContext:St,use:Nl,useCallback:Qd,useContext:St,useEffect:Wc,useImperativeHandle:Jd,useInsertionEffect:Gd,useLayoutEffect:Vd,useMemo:Id,useReducer:Xc,useRef:Pd,useState:function(){return Xc(es)},useDebugValue:eu,useDeferredValue:function(e,t){var i=ut();return Fe===null?tu(i,e,t):Xd(i,Fe.memoizedState,e,t)},useTransition:function(){var e=Xc(es)[0],t=ut().memoizedState;return[typeof e=="boolean"?e:na(e),t]},useSyncExternalStore:Ad,useId:em,useHostTransitionStatus:su,useFormState:Hd,useActionState:Hd,useOptimistic:function(e,t){var i=ut();return Fe!==null?kd(i,Fe,e,t):(i.baseState=e,[e,i.queue.dispatch])},useMemoCache:Qc,useCacheRefresh:tm};am.useEffectEvent=Yd;function au(e,t,i,l){t=e.memoizedState,i=i(l,t),i=i==null?t:w({},t,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var lu={enqueueSetState:function(e,t,i){e=e._reactInternals;var l=Xt(),c=Os(l);c.payload=t,i!=null&&(c.callback=i),t=Ts(e,c,l),t!==null&&(Ht(t,e,l),Zr(t,e,l))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var l=Xt(),c=Os(l);c.tag=1,c.payload=t,i!=null&&(c.callback=i),t=Ts(e,c,l),t!==null&&(Ht(t,e,l),Zr(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=Xt(),l=Os(i);l.tag=2,t!=null&&(l.callback=t),t=Ts(e,l,i),t!==null&&(Ht(t,e,i),Zr(t,e,i))}};function lm(e,t,i,l,c,u,p){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,u,p):t.prototype&&t.prototype.isPureReactComponent?!Gr(i,l)||!Gr(c,u):!0}function om(e,t,i,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(i,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(i,l),t.state!==e&&lu.enqueueReplaceState(t,t.state,null)}function _i(e,t){var i=t;if("ref"in t){i={};for(var l in t)l!=="ref"&&(i[l]=t[l])}if(e=e.defaultProps){i===t&&(i=w({},i));for(var c in e)i[c]===void 0&&(i[c]=e[c])}return i}function cm(e){fl(e)}function um(e){console.error(e)}function fm(e){fl(e)}function Dl(e,t){try{var i=e.onUncaughtError;i(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function hm(e,t,i){try{var l=e.onCaughtError;l(i.value,{componentStack:i.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function ou(e,t,i){return i=Os(i),i.tag=3,i.payload={element:null},i.callback=function(){Dl(e,t)},i}function dm(e){return e=Os(e),e.tag=3,e}function mm(e,t,i,l){var c=i.type.getDerivedStateFromError;if(typeof c=="function"){var u=l.value;e.payload=function(){return c(u)},e.callback=function(){hm(t,i,l)}}var p=i.stateNode;p!==null&&typeof p.componentDidCatch=="function"&&(e.callback=function(){hm(t,i,l),typeof c!="function"&&(Ds===null?Ds=new Set([this]):Ds.add(this));var b=l.stack;this.componentDidCatch(l.value,{componentStack:b!==null?b:""})})}function xb(e,t,i,l,c){if(i.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=i.alternate,t!==null&&Qi(t,i,c,!0),i=Ft.current,i!==null){switch(i.tag){case 31:case 13:return pn===null?Fl():i.alternate===null&&at===0&&(at=3),i.flags&=-257,i.flags|=65536,i.lanes=c,l===_l?i.flags|=16384:(t=i.updateQueue,t===null?i.updateQueue=new Set([l]):t.add(l),Ru(e,l,c)),!1;case 22:return i.flags|=65536,l===_l?i.flags|=16384:(t=i.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([l])},i.updateQueue=t):(i=t.retryQueue,i===null?t.retryQueue=new Set([l]):i.add(l)),Ru(e,l,c)),!1}throw Error(a(435,i.tag))}return Ru(e,l,c),Fl(),!1}if(ze)return t=Ft.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,l!==Oc&&(e=Error(a(422),{cause:l}),Jr(fn(e,i)))):(l!==Oc&&(t=Error(a(423),{cause:l}),Jr(fn(t,i))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,l=fn(l,i),c=ou(e.stateNode,l,c),Bc(e,c),at!==4&&(at=2)),!1;var u=Error(a(520),{cause:l});if(u=fn(u,i),ha===null?ha=[u]:ha.push(u),at!==4&&(at=2),t===null)return!0;l=fn(l,i),i=t;do{switch(i.tag){case 3:return i.flags|=65536,e=c&-c,i.lanes|=e,e=ou(i.stateNode,l,e),Bc(i,e),!1;case 1:if(t=i.type,u=i.stateNode,(i.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(Ds===null||!Ds.has(u))))return i.flags|=65536,c&=-c,i.lanes|=c,c=dm(c),mm(c,e,i,l),Bc(i,c),!1}i=i.return}while(i!==null);return!1}var cu=Error(a(461)),mt=!1;function Et(e,t,i,l){t.child=e===null?bd(t,null,i,l):xi(t,e.child,i,l)}function pm(e,t,i,l,c){i=i.render;var u=t.ref;if("ref"in l){var p={};for(var b in l)b!=="ref"&&(p[b]=l[b])}else p=l;return pi(t),l=Gc(e,t,i,p,u,c),b=Vc(),e!==null&&!mt?(Fc(e,t,c),ts(e,t,c)):(ze&&b&&Ac(t),t.flags|=1,Et(e,t,l,c),t.child)}function gm(e,t,i,l,c){if(e===null){var u=i.type;return typeof u=="function"&&!wc(u)&&u.defaultProps===void 0&&i.compare===null?(t.tag=15,t.type=u,ym(e,t,u,l,c)):(e=pl(i.type,null,l,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!yu(e,c)){var p=u.memoizedProps;if(i=i.compare,i=i!==null?i:Gr,i(p,l)&&e.ref===t.ref)return ts(e,t,c)}return t.flags|=1,e=In(u,l),e.ref=t.ref,e.return=t,t.child=e}function ym(e,t,i,l,c){if(e!==null){var u=e.memoizedProps;if(Gr(u,l)&&e.ref===t.ref)if(mt=!1,t.pendingProps=l=u,yu(e,c))(e.flags&131072)!==0&&(mt=!0);else return t.lanes=e.lanes,ts(e,t,c)}return uu(e,t,i,l,c)}function bm(e,t,i,l){var c=l.children,u=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((t.flags&128)!==0){if(u=u!==null?u.baseLanes|i:i,e!==null){for(l=t.child=e.child,c=0;l!==null;)c=c|l.lanes|l.childLanes,l=l.sibling;l=c&~u}else l=0,t.child=null;return xm(e,t,u,i,l)}if((i&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&xl(t,u!==null?u.cachePool:null),u!==null?_d(t,u):Hc(),wd(t);else return l=t.lanes=536870912,xm(e,t,u!==null?u.baseLanes|i:i,i,l)}else u!==null?(xl(t,u.cachePool),_d(t,u),Cs(),t.memoizedState=null):(e!==null&&xl(t,null),Hc(),Cs());return Et(e,t,c,i),t.child}function ra(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function xm(e,t,i,l,c){var u=Dc();return u=u===null?null:{parent:ht._currentValue,pool:u},t.memoizedState={baseLanes:i,cachePool:u},e!==null&&xl(t,null),Hc(),wd(t),e!==null&&Qi(e,t,l,!0),t.childLanes=c,null}function zl(e,t){return t=Ul({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function vm(e,t,i){return xi(t,e.child,null,i),e=zl(t,t.pendingProps),e.flags|=2,Jt(t),t.memoizedState=null,e}function vb(e,t,i){var l=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(ze){if(l.mode==="hidden")return e=zl(t,l),t.lanes=536870912,ra(null,e);if($c(t),(e=Ze)?(e=Mp(e,mn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ws!==null?{id:Dn,overflow:zn}:null,retryLane:536870912,hydrationErrors:null},i=sd(e),i.return=t,t.child=i,wt=t,Ze=null)):e=null,e===null)throw Es(t);return t.lanes=536870912,null}return zl(t,l)}var u=e.memoizedState;if(u!==null){var p=u.dehydrated;if($c(t),c)if(t.flags&256)t.flags&=-257,t=vm(e,t,i);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(a(558));else if(mt||Qi(e,t,i,!1),c=(i&e.childLanes)!==0,mt||c){if(l=Xe,l!==null&&(p=vs(l,i),p!==0&&p!==u.retryLane))throw u.retryLane=p,fi(e,p),Ht(l,e,p),cu;Fl(),t=vm(e,t,i)}else e=u.treeContext,Ze=gn(p.nextSibling),wt=t,ze=!0,Ss=null,mn=!1,e!==null&&ad(t,e),t=zl(t,l),t.flags|=4096;return t}return e=In(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function ql(e,t){var i=t.ref;if(i===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(a(284));(e===null||e.ref!==i)&&(t.flags|=4194816)}}function uu(e,t,i,l,c){return pi(t),i=Gc(e,t,i,l,void 0,c),l=Vc(),e!==null&&!mt?(Fc(e,t,c),ts(e,t,c)):(ze&&l&&Ac(t),t.flags|=1,Et(e,t,i,c),t.child)}function _m(e,t,i,l,c,u){return pi(t),t.updateQueue=null,i=Ed(t,l,i,c),Sd(e),l=Vc(),e!==null&&!mt?(Fc(e,t,u),ts(e,t,u)):(ze&&l&&Ac(t),t.flags|=1,Et(e,t,i,u),t.child)}function wm(e,t,i,l,c){if(pi(t),t.stateNode===null){var u=Gi,p=i.contextType;typeof p=="object"&&p!==null&&(u=St(p)),u=new i(l,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=lu,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=l,u.state=t.memoizedState,u.refs={},qc(t),p=i.contextType,u.context=typeof p=="object"&&p!==null?St(p):Gi,u.state=t.memoizedState,p=i.getDerivedStateFromProps,typeof p=="function"&&(au(t,i,p,l),u.state=t.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(p=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),p!==u.state&&lu.enqueueReplaceState(u,u.state,null),ea(t,l,u,c),Wr(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){u=t.stateNode;var b=t.memoizedProps,j=_i(i,b);u.props=j;var B=u.context,Y=i.contextType;p=Gi,typeof Y=="object"&&Y!==null&&(p=St(Y));var I=i.getDerivedStateFromProps;Y=typeof I=="function"||typeof u.getSnapshotBeforeUpdate=="function",b=t.pendingProps!==b,Y||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(b||B!==p)&&om(t,u,l,p),js=!1;var L=t.memoizedState;u.state=L,ea(t,l,u,c),Wr(),B=t.memoizedState,b||L!==B||js?(typeof I=="function"&&(au(t,i,I,l),B=t.memoizedState),(j=js||lm(t,i,j,l,L,B,p))?(Y||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=B),u.props=l,u.state=B,u.context=p,l=j):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{u=t.stateNode,Uc(e,t),p=t.memoizedProps,Y=_i(i,p),u.props=Y,I=t.pendingProps,L=u.context,B=i.contextType,j=Gi,typeof B=="object"&&B!==null&&(j=St(B)),b=i.getDerivedStateFromProps,(B=typeof b=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(p!==I||L!==j)&&om(t,u,l,j),js=!1,L=t.memoizedState,u.state=L,ea(t,l,u,c),Wr();var P=t.memoizedState;p!==I||L!==P||js||e!==null&&e.dependencies!==null&&yl(e.dependencies)?(typeof b=="function"&&(au(t,i,b,l),P=t.memoizedState),(Y=js||lm(t,i,Y,l,L,P,j)||e!==null&&e.dependencies!==null&&yl(e.dependencies))?(B||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(l,P,j),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(l,P,j)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=P),u.props=l,u.state=P,u.context=j,l=Y):(typeof u.componentDidUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),l=!1)}return u=l,ql(e,t),l=(t.flags&128)!==0,u||l?(u=t.stateNode,i=l&&typeof i.getDerivedStateFromError!="function"?null:u.render(),t.flags|=1,e!==null&&l?(t.child=xi(t,e.child,null,c),t.child=xi(t,null,i,c)):Et(e,t,i,c),t.memoizedState=u.state,e=t.child):e=ts(e,t,c),e}function Sm(e,t,i,l){return di(),t.flags|=256,Et(e,t,i,l),t.child}var fu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function hu(e){return{baseLanes:e,cachePool:hd()}}function du(e,t,i){return e=e!==null?e.childLanes&~i:0,t&&(e|=It),e}function Em(e,t,i){var l=t.pendingProps,c=!1,u=(t.flags&128)!==0,p;if((p=u)||(p=e!==null&&e.memoizedState===null?!1:(ct.current&2)!==0),p&&(c=!0,t.flags&=-129),p=(t.flags&32)!==0,t.flags&=-33,e===null){if(ze){if(c?Ns(t):Cs(),(e=Ze)?(e=Mp(e,mn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ws!==null?{id:Dn,overflow:zn}:null,retryLane:536870912,hydrationErrors:null},i=sd(e),i.return=t,t.child=i,wt=t,Ze=null)):e=null,e===null)throw Es(t);return Iu(e)?t.lanes=32:t.lanes=536870912,null}var b=l.children;return l=l.fallback,c?(Cs(),c=t.mode,b=Ul({mode:"hidden",children:b},c),l=hi(l,c,i,null),b.return=t,l.return=t,b.sibling=l,t.child=b,l=t.child,l.memoizedState=hu(i),l.childLanes=du(e,p,i),t.memoizedState=fu,ra(null,l)):(Ns(t),mu(t,b))}var j=e.memoizedState;if(j!==null&&(b=j.dehydrated,b!==null)){if(u)t.flags&256?(Ns(t),t.flags&=-257,t=pu(e,t,i)):t.memoizedState!==null?(Cs(),t.child=e.child,t.flags|=128,t=null):(Cs(),b=l.fallback,c=t.mode,l=Ul({mode:"visible",children:l.children},c),b=hi(b,c,i,null),b.flags|=2,l.return=t,b.return=t,l.sibling=b,t.child=l,xi(t,e.child,null,i),l=t.child,l.memoizedState=hu(i),l.childLanes=du(e,p,i),t.memoizedState=fu,t=ra(null,l));else if(Ns(t),Iu(b)){if(p=b.nextSibling&&b.nextSibling.dataset,p)var B=p.dgst;p=B,l=Error(a(419)),l.stack="",l.digest=p,Jr({value:l,source:null,stack:null}),t=pu(e,t,i)}else if(mt||Qi(e,t,i,!1),p=(i&e.childLanes)!==0,mt||p){if(p=Xe,p!==null&&(l=vs(p,i),l!==0&&l!==j.retryLane))throw j.retryLane=l,fi(e,l),Ht(p,e,l),cu;Qu(b)||Fl(),t=pu(e,t,i)}else Qu(b)?(t.flags|=192,t.child=e.child,t=null):(e=j.treeContext,Ze=gn(b.nextSibling),wt=t,ze=!0,Ss=null,mn=!1,e!==null&&ad(t,e),t=mu(t,l.children),t.flags|=4096);return t}return c?(Cs(),b=l.fallback,c=t.mode,j=e.child,B=j.sibling,l=In(j,{mode:"hidden",children:l.children}),l.subtreeFlags=j.subtreeFlags&65011712,B!==null?b=In(B,b):(b=hi(b,c,i,null),b.flags|=2),b.return=t,l.return=t,l.sibling=b,t.child=l,ra(null,l),l=t.child,b=e.child.memoizedState,b===null?b=hu(i):(c=b.cachePool,c!==null?(j=ht._currentValue,c=c.parent!==j?{parent:j,pool:j}:c):c=hd(),b={baseLanes:b.baseLanes|i,cachePool:c}),l.memoizedState=b,l.childLanes=du(e,p,i),t.memoizedState=fu,ra(e.child,l)):(Ns(t),i=e.child,e=i.sibling,i=In(i,{mode:"visible",children:l.children}),i.return=t,i.sibling=null,e!==null&&(p=t.deletions,p===null?(t.deletions=[e],t.flags|=16):p.push(e)),t.child=i,t.memoizedState=null,i)}function mu(e,t){return t=Ul({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Ul(e,t){return e=Vt(22,e,null,t),e.lanes=0,e}function pu(e,t,i){return xi(t,e.child,null,i),e=mu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Am(e,t,i){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),Cc(e.return,t,i)}function gu(e,t,i,l,c,u){var p=e.memoizedState;p===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:i,tailMode:c,treeForkCount:u}:(p.isBackwards=t,p.rendering=null,p.renderingStartTime=0,p.last=l,p.tail=i,p.tailMode=c,p.treeForkCount=u)}function jm(e,t,i){var l=t.pendingProps,c=l.revealOrder,u=l.tail;l=l.children;var p=ct.current,b=(p&2)!==0;if(b?(p=p&1|2,t.flags|=128):p&=1,Te(ct,p),Et(e,t,l,i),l=ze?Fr:0,!b&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Am(e,i,t);else if(e.tag===19)Am(e,i,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(c){case"forwards":for(i=t.child,c=null;i!==null;)e=i.alternate,e!==null&&Al(e)===null&&(c=i),i=i.sibling;i=c,i===null?(c=t.child,t.child=null):(c=i.sibling,i.sibling=null),gu(t,!1,c,i,u,l);break;case"backwards":case"unstable_legacy-backwards":for(i=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&Al(e)===null){t.child=c;break}e=c.sibling,c.sibling=i,i=c,c=e}gu(t,!0,i,null,u,l);break;case"together":gu(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function ts(e,t,i){if(e!==null&&(t.dependencies=e.dependencies),Rs|=t.lanes,(i&t.childLanes)===0)if(e!==null){if(Qi(e,t,i,!1),(i&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(a(153));if(t.child!==null){for(e=t.child,i=In(e,e.pendingProps),t.child=i,i.return=t;e.sibling!==null;)e=e.sibling,i=i.sibling=In(e,e.pendingProps),i.return=t;i.sibling=null}return t.child}function yu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&yl(e)))}function _b(e,t,i){switch(t.tag){case 3:Ot(t,t.stateNode.containerInfo),As(t,ht,e.memoizedState.cache),di();break;case 27:case 5:Tt(t);break;case 4:Ot(t,t.stateNode.containerInfo);break;case 10:As(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,$c(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(Ns(t),t.flags|=128,null):(i&t.child.childLanes)!==0?Em(e,t,i):(Ns(t),e=ts(e,t,i),e!==null?e.sibling:null);Ns(t);break;case 19:var c=(e.flags&128)!==0;if(l=(i&t.childLanes)!==0,l||(Qi(e,t,i,!1),l=(i&t.childLanes)!==0),c){if(l)return jm(e,t,i);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),Te(ct,ct.current),l)break;return null;case 22:return t.lanes=0,bm(e,t,i,t.pendingProps);case 24:As(t,ht,e.memoizedState.cache)}return ts(e,t,i)}function Om(e,t,i){if(e!==null)if(e.memoizedProps!==t.pendingProps)mt=!0;else{if(!yu(e,i)&&(t.flags&128)===0)return mt=!1,_b(e,t,i);mt=(e.flags&131072)!==0}else mt=!1,ze&&(t.flags&1048576)!==0&&rd(t,Fr,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=yi(t.elementType),t.type=e,typeof e=="function")wc(e)?(l=_i(e,l),t.tag=1,t=wm(null,t,e,l,i)):(t.tag=0,t=uu(null,t,e,l,i));else{if(e!=null){var c=e.$$typeof;if(c===re){t.tag=11,t=pm(null,t,e,l,i);break e}else if(c===ce){t.tag=14,t=gm(null,t,e,l,i);break e}}throw t=He(e)||e,Error(a(306,t,""))}}return t;case 0:return uu(e,t,t.type,t.pendingProps,i);case 1:return l=t.type,c=_i(l,t.pendingProps),wm(e,t,l,c,i);case 3:e:{if(Ot(t,t.stateNode.containerInfo),e===null)throw Error(a(387));l=t.pendingProps;var u=t.memoizedState;c=u.element,Uc(e,t),ea(t,l,null,i);var p=t.memoizedState;if(l=p.cache,As(t,ht,l),l!==u.cache&&kc(t,[ht],i,!0),Wr(),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=Sm(e,t,l,i);break e}else if(l!==c){c=fn(Error(a(424)),t),Jr(c),t=Sm(e,t,l,i);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Ze=gn(e.firstChild),wt=t,ze=!0,Ss=null,mn=!0,i=bd(t,null,l,i),t.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(di(),l===c){t=ts(e,t,i);break e}Et(e,t,l,i)}t=t.child}return t;case 26:return ql(e,t),e===null?(i=Bp(t.type,null,t.pendingProps,null))?t.memoizedState=i:ze||(i=t.type,e=t.pendingProps,l=Wl(an.current).createElement(i),l[Ie]=t,l[it]=e,At(l,i,e),N(l),t.stateNode=l):t.memoizedState=Bp(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Tt(t),e===null&&ze&&(l=t.stateNode=zp(t.type,t.pendingProps,an.current),wt=t,mn=!0,c=Ze,Bs(t.type)?(Xu=c,Ze=gn(l.firstChild)):Ze=c),Et(e,t,t.pendingProps.children,i),ql(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ze&&((c=l=Ze)&&(l=Kb(l,t.type,t.pendingProps,mn),l!==null?(t.stateNode=l,wt=t,Ze=gn(l.firstChild),mn=!1,c=!0):c=!1),c||Es(t)),Tt(t),c=t.type,u=t.pendingProps,p=e!==null?e.memoizedProps:null,l=u.children,Vu(c,u)?l=null:p!==null&&Vu(c,p)&&(t.flags|=32),t.memoizedState!==null&&(c=Gc(e,t,hb,null,null,i),va._currentValue=c),ql(e,t),Et(e,t,l,i),t.child;case 6:return e===null&&ze&&((e=i=Ze)&&(i=Zb(i,t.pendingProps,mn),i!==null?(t.stateNode=i,wt=t,Ze=null,e=!0):e=!1),e||Es(t)),null;case 13:return Em(e,t,i);case 4:return Ot(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=xi(t,null,l,i):Et(e,t,l,i),t.child;case 11:return pm(e,t,t.type,t.pendingProps,i);case 7:return Et(e,t,t.pendingProps,i),t.child;case 8:return Et(e,t,t.pendingProps.children,i),t.child;case 12:return Et(e,t,t.pendingProps.children,i),t.child;case 10:return l=t.pendingProps,As(t,t.type,l.value),Et(e,t,l.children,i),t.child;case 9:return c=t.type._context,l=t.pendingProps.children,pi(t),c=St(c),l=l(c),t.flags|=1,Et(e,t,l,i),t.child;case 14:return gm(e,t,t.type,t.pendingProps,i);case 15:return ym(e,t,t.type,t.pendingProps,i);case 19:return jm(e,t,i);case 31:return vb(e,t,i);case 22:return bm(e,t,i,t.pendingProps);case 24:return pi(t),l=St(ht),e===null?(c=Dc(),c===null&&(c=Xe,u=Mc(),c.pooledCache=u,u.refCount++,u!==null&&(c.pooledCacheLanes|=i),c=u),t.memoizedState={parent:l,cache:c},qc(t),As(t,ht,c)):((e.lanes&i)!==0&&(Uc(e,t),ea(t,null,null,i),Wr()),c=e.memoizedState,u=t.memoizedState,c.parent!==l?(c={parent:l,cache:l},t.memoizedState=c,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=c),As(t,ht,l)):(l=u.cache,As(t,ht,l),l!==c.cache&&kc(t,[ht],i,!0))),Et(e,t,t.pendingProps.children,i),t.child;case 29:throw t.pendingProps}throw Error(a(156,t.tag))}function ns(e){e.flags|=4}function bu(e,t,i,l,c){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(c&335544128)===c)if(e.stateNode.complete)e.flags|=8192;else if(ep())e.flags|=8192;else throw bi=_l,zc}else e.flags&=-16777217}function Tm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Yp(t))if(ep())e.flags|=8192;else throw bi=_l,zc}function Bl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Di():536870912,e.lanes|=t,ar|=t)}function aa(e,t){if(!ze)switch(e.tailMode){case"hidden":t=e.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var l=null;i!==null;)i.alternate!==null&&(l=i),i=i.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function We(e){var t=e.alternate!==null&&e.alternate.child===e.child,i=0,l=0;if(t)for(var c=e.child;c!==null;)i|=c.lanes|c.childLanes,l|=c.subtreeFlags&65011712,l|=c.flags&65011712,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)i|=c.lanes|c.childLanes,l|=c.subtreeFlags,l|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=l,e.childLanes=i,t}function wb(e,t,i){var l=t.pendingProps;switch(jc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return We(t),null;case 1:return We(t),null;case 3:return i=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),Zn(ht),Se(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Ji(t)?ns(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Tc())),We(t),null;case 26:var c=t.type,u=t.memoizedState;return e===null?(ns(t),u!==null?(We(t),Tm(t,u)):(We(t),bu(t,c,null,l,i))):u?u!==e.memoizedState?(ns(t),We(t),Tm(t,u)):(We(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&ns(t),We(t),bu(t,c,e,l,i)),null;case 27:if(ei(t),i=an.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&ns(t);else{if(!l){if(t.stateNode===null)throw Error(a(166));return We(t),null}e=lt.current,Ji(t)?ld(t):(e=zp(c,l,i),t.stateNode=e,ns(t))}return We(t),null;case 5:if(ei(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&ns(t);else{if(!l){if(t.stateNode===null)throw Error(a(166));return We(t),null}if(u=lt.current,Ji(t))ld(t);else{var p=Wl(an.current);switch(u){case 1:u=p.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:u=p.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":u=p.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":u=p.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":u=p.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof l.is=="string"?p.createElement("select",{is:l.is}):p.createElement("select"),l.multiple?u.multiple=!0:l.size&&(u.size=l.size);break;default:u=typeof l.is=="string"?p.createElement(c,{is:l.is}):p.createElement(c)}}u[Ie]=t,u[it]=l;e:for(p=t.child;p!==null;){if(p.tag===5||p.tag===6)u.appendChild(p.stateNode);else if(p.tag!==4&&p.tag!==27&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===t)break e;for(;p.sibling===null;){if(p.return===null||p.return===t)break e;p=p.return}p.sibling.return=p.return,p=p.sibling}t.stateNode=u;e:switch(At(u,c,l),c){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&ns(t)}}return We(t),bu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,i),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&ns(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(a(166));if(e=an.current,Ji(t)){if(e=t.stateNode,i=t.memoizedProps,l=null,c=wt,c!==null)switch(c.tag){case 27:case 5:l=c.memoizedProps}e[Ie]=t,e=!!(e.nodeValue===i||l!==null&&l.suppressHydrationWarning===!0||Ep(e.nodeValue,i)),e||Es(t,!0)}else e=Wl(e).createTextNode(l),e[Ie]=t,t.stateNode=e}return We(t),null;case 31:if(i=t.memoizedState,e===null||e.memoizedState!==null){if(l=Ji(t),i!==null){if(e===null){if(!l)throw Error(a(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(557));e[Ie]=t}else di(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),e=!1}else i=Tc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),e=!0;if(!e)return t.flags&256?(Jt(t),t):(Jt(t),null);if((t.flags&128)!==0)throw Error(a(558))}return We(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=Ji(t),l!==null&&l.dehydrated!==null){if(e===null){if(!c)throw Error(a(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(a(317));c[Ie]=t}else di(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),c=!1}else c=Tc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(Jt(t),t):(Jt(t),null)}return Jt(t),(t.flags&128)!==0?(t.lanes=i,t):(i=l!==null,e=e!==null&&e.memoizedState!==null,i&&(l=t.child,c=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(c=l.alternate.memoizedState.cachePool.pool),u=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(u=l.memoizedState.cachePool.pool),u!==c&&(l.flags|=2048)),i!==e&&i&&(t.child.flags|=8192),Bl(t,t.updateQueue),We(t),null);case 4:return Se(),e===null&&Hu(t.stateNode.containerInfo),We(t),null;case 10:return Zn(t.type),We(t),null;case 19:if(we(ct),l=t.memoizedState,l===null)return We(t),null;if(c=(t.flags&128)!==0,u=l.rendering,u===null)if(c)aa(l,!1);else{if(at!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=Al(e),u!==null){for(t.flags|=128,aa(l,!1),e=u.updateQueue,t.updateQueue=e,Bl(t,e),t.subtreeFlags=0,e=i,i=t.child;i!==null;)nd(i,e),i=i.sibling;return Te(ct,ct.current&1|2),ze&&Xn(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&et()>Yl&&(t.flags|=128,c=!0,aa(l,!1),t.lanes=4194304)}else{if(!c)if(e=Al(u),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,Bl(t,e),aa(l,!0),l.tail===null&&l.tailMode==="hidden"&&!u.alternate&&!ze)return We(t),null}else 2*et()-l.renderingStartTime>Yl&&i!==536870912&&(t.flags|=128,c=!0,aa(l,!1),t.lanes=4194304);l.isBackwards?(u.sibling=t.child,t.child=u):(e=l.last,e!==null?e.sibling=u:t.child=u,l.last=u)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=et(),e.sibling=null,i=ct.current,Te(ct,c?i&1|2:i&1),ze&&Xn(t,l.treeForkCount),e):(We(t),null);case 22:case 23:return Jt(t),Pc(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(i&536870912)!==0&&(t.flags&128)===0&&(We(t),t.subtreeFlags&6&&(t.flags|=8192)):We(t),i=t.updateQueue,i!==null&&Bl(t,i.retryQueue),i=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==i&&(t.flags|=2048),e!==null&&we(gi),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),Zn(ht),We(t),null;case 25:return null;case 30:return null}throw Error(a(156,t.tag))}function Sb(e,t){switch(jc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Zn(ht),Se(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ei(t),null;case 31:if(t.memoizedState!==null){if(Jt(t),t.alternate===null)throw Error(a(340));di()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Jt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));di()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return we(ct),null;case 4:return Se(),null;case 10:return Zn(t.type),null;case 22:case 23:return Jt(t),Pc(),e!==null&&we(gi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Zn(ht),null;case 25:return null;default:return null}}function Nm(e,t){switch(jc(t),t.tag){case 3:Zn(ht),Se();break;case 26:case 27:case 5:ei(t);break;case 4:Se();break;case 31:t.memoizedState!==null&&Jt(t);break;case 13:Jt(t);break;case 19:we(ct);break;case 10:Zn(t.type);break;case 22:case 23:Jt(t),Pc(),e!==null&&we(gi);break;case 24:Zn(ht)}}function la(e,t){try{var i=t.updateQueue,l=i!==null?i.lastEffect:null;if(l!==null){var c=l.next;i=c;do{if((i.tag&e)===e){l=void 0;var u=i.create,p=i.inst;l=u(),p.destroy=l}i=i.next}while(i!==c)}}catch(b){Ge(t,t.return,b)}}function ks(e,t,i){try{var l=t.updateQueue,c=l!==null?l.lastEffect:null;if(c!==null){var u=c.next;l=u;do{if((l.tag&e)===e){var p=l.inst,b=p.destroy;if(b!==void 0){p.destroy=void 0,c=t;var j=i,B=b;try{B()}catch(Y){Ge(c,j,Y)}}}l=l.next}while(l!==u)}}catch(Y){Ge(t,t.return,Y)}}function Cm(e){var t=e.updateQueue;if(t!==null){var i=e.stateNode;try{vd(t,i)}catch(l){Ge(e,e.return,l)}}}function km(e,t,i){i.props=_i(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(l){Ge(e,t,l)}}function oa(e,t){try{var i=e.ref;if(i!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof i=="function"?e.refCleanup=i(l):i.current=l}}catch(c){Ge(e,t,c)}}function qn(e,t){var i=e.ref,l=e.refCleanup;if(i!==null)if(typeof l=="function")try{l()}catch(c){Ge(e,t,c)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(c){Ge(e,t,c)}else i.current=null}function Mm(e){var t=e.type,i=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":i.autoFocus&&l.focus();break e;case"img":i.src?l.src=i.src:i.srcSet&&(l.srcset=i.srcSet)}}catch(c){Ge(e,e.return,c)}}function xu(e,t,i){try{var l=e.stateNode;Vb(l,e.type,i,t),l[it]=t}catch(c){Ge(e,e.return,c)}}function Rm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Bs(e.type)||e.tag===4}function vu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Rm(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Bs(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function _u(e,t,i){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(e,t):(t=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,t.appendChild(e),i=i._reactRootContainer,i!=null||t.onclick!==null||(t.onclick=Jn));else if(l!==4&&(l===27&&Bs(e.type)&&(i=e.stateNode,t=null),e=e.child,e!==null))for(_u(e,t,i),e=e.sibling;e!==null;)_u(e,t,i),e=e.sibling}function Ll(e,t,i){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?i.insertBefore(e,t):i.appendChild(e);else if(l!==4&&(l===27&&Bs(e.type)&&(i=e.stateNode),e=e.child,e!==null))for(Ll(e,t,i),e=e.sibling;e!==null;)Ll(e,t,i),e=e.sibling}function Dm(e){var t=e.stateNode,i=e.memoizedProps;try{for(var l=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);At(t,l,i),t[Ie]=e,t[it]=i}catch(u){Ge(e,e.return,u)}}var ss=!1,pt=!1,wu=!1,zm=typeof WeakSet=="function"?WeakSet:Set,xt=null;function Eb(e,t){if(e=e.containerInfo,Yu=ao,e=Jh(e),pc(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var l=i.getSelection&&i.getSelection();if(l&&l.rangeCount!==0){i=l.anchorNode;var c=l.anchorOffset,u=l.focusNode;l=l.focusOffset;try{i.nodeType,u.nodeType}catch{i=null;break e}var p=0,b=-1,j=-1,B=0,Y=0,I=e,L=null;t:for(;;){for(var P;I!==i||c!==0&&I.nodeType!==3||(b=p+c),I!==u||l!==0&&I.nodeType!==3||(j=p+l),I.nodeType===3&&(p+=I.nodeValue.length),(P=I.firstChild)!==null;)L=I,I=P;for(;;){if(I===e)break t;if(L===i&&++B===c&&(b=p),L===u&&++Y===l&&(j=p),(P=I.nextSibling)!==null)break;I=L,L=I.parentNode}I=P}i=b===-1||j===-1?null:{start:b,end:j}}else i=null}i=i||{start:0,end:0}}else i=null;for(Gu={focusedElem:e,selectionRange:i},ao=!1,xt=t;xt!==null;)if(t=xt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,xt=e;else for(;xt!==null;){switch(t=xt,u=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(i=0;i<e.length;i++)c=e[i],c.ref.impl=c.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&u!==null){e=void 0,i=t,c=u.memoizedProps,u=u.memoizedState,l=i.stateNode;try{var he=_i(i.type,c);e=l.getSnapshotBeforeUpdate(he,u),l.__reactInternalSnapshotBeforeUpdate=e}catch(ye){Ge(i,i.return,ye)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,i=e.nodeType,i===9)Ju(e);else if(i===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Ju(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(a(163))}if(e=t.sibling,e!==null){e.return=t.return,xt=e;break}xt=t.return}}function qm(e,t,i){var l=i.flags;switch(i.tag){case 0:case 11:case 15:rs(e,i),l&4&&la(5,i);break;case 1:if(rs(e,i),l&4)if(e=i.stateNode,t===null)try{e.componentDidMount()}catch(p){Ge(i,i.return,p)}else{var c=_i(i.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(p){Ge(i,i.return,p)}}l&64&&Cm(i),l&512&&oa(i,i.return);break;case 3:if(rs(e,i),l&64&&(e=i.updateQueue,e!==null)){if(t=null,i.child!==null)switch(i.child.tag){case 27:case 5:t=i.child.stateNode;break;case 1:t=i.child.stateNode}try{vd(e,t)}catch(p){Ge(i,i.return,p)}}break;case 27:t===null&&l&4&&Dm(i);case 26:case 5:rs(e,i),t===null&&l&4&&Mm(i),l&512&&oa(i,i.return);break;case 12:rs(e,i);break;case 31:rs(e,i),l&4&&Lm(e,i);break;case 13:rs(e,i),l&4&&Hm(e,i),l&64&&(e=i.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(i=Rb.bind(null,i),Wb(e,i))));break;case 22:if(l=i.memoizedState!==null||ss,!l){t=t!==null&&t.memoizedState!==null||pt,c=ss;var u=pt;ss=l,(pt=t)&&!u?as(e,i,(i.subtreeFlags&8772)!==0):rs(e,i),ss=c,pt=u}break;case 30:break;default:rs(e,i)}}function Um(e){var t=e.alternate;t!==null&&(e.alternate=null,Um(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&zi(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var tt=null,qt=!1;function is(e,t,i){for(i=i.child;i!==null;)Bm(e,t,i),i=i.sibling}function Bm(e,t,i){if(ot&&typeof ot.onCommitFiberUnmount=="function")try{ot.onCommitFiberUnmount(ni,i)}catch{}switch(i.tag){case 26:pt||qn(i,t),is(e,t,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:pt||qn(i,t);var l=tt,c=qt;Bs(i.type)&&(tt=i.stateNode,qt=!1),is(e,t,i),ya(i.stateNode),tt=l,qt=c;break;case 5:pt||qn(i,t);case 6:if(l=tt,c=qt,tt=null,is(e,t,i),tt=l,qt=c,tt!==null)if(qt)try{(tt.nodeType===9?tt.body:tt.nodeName==="HTML"?tt.ownerDocument.body:tt).removeChild(i.stateNode)}catch(u){Ge(i,t,u)}else try{tt.removeChild(i.stateNode)}catch(u){Ge(i,t,u)}break;case 18:tt!==null&&(qt?(e=tt,Cp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,i.stateNode),mr(e)):Cp(tt,i.stateNode));break;case 4:l=tt,c=qt,tt=i.stateNode.containerInfo,qt=!0,is(e,t,i),tt=l,qt=c;break;case 0:case 11:case 14:case 15:ks(2,i,t),pt||ks(4,i,t),is(e,t,i);break;case 1:pt||(qn(i,t),l=i.stateNode,typeof l.componentWillUnmount=="function"&&km(i,t,l)),is(e,t,i);break;case 21:is(e,t,i);break;case 22:pt=(l=pt)||i.memoizedState!==null,is(e,t,i),pt=l;break;default:is(e,t,i)}}function Lm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{mr(e)}catch(i){Ge(t,t.return,i)}}}function Hm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{mr(e)}catch(i){Ge(t,t.return,i)}}function Ab(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new zm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new zm),t;default:throw Error(a(435,e.tag))}}function Hl(e,t){var i=Ab(e);t.forEach(function(l){if(!i.has(l)){i.add(l);var c=Db.bind(null,e,l);l.then(c,c)}})}function Ut(e,t){var i=t.deletions;if(i!==null)for(var l=0;l<i.length;l++){var c=i[l],u=e,p=t,b=p;e:for(;b!==null;){switch(b.tag){case 27:if(Bs(b.type)){tt=b.stateNode,qt=!1;break e}break;case 5:tt=b.stateNode,qt=!1;break e;case 3:case 4:tt=b.stateNode.containerInfo,qt=!0;break e}b=b.return}if(tt===null)throw Error(a(160));Bm(u,p,c),tt=null,qt=!1,u=c.alternate,u!==null&&(u.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Pm(t,e),t=t.sibling}var jn=null;function Pm(e,t){var i=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ut(t,e),Bt(e),l&4&&(ks(3,e,e.return),la(3,e),ks(5,e,e.return));break;case 1:Ut(t,e),Bt(e),l&512&&(pt||i===null||qn(i,i.return)),l&64&&ss&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(i=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=i===null?l:i.concat(l))));break;case 26:var c=jn;if(Ut(t,e),Bt(e),l&512&&(pt||i===null||qn(i,i.return)),l&4){var u=i!==null?i.memoizedState:null;if(l=e.memoizedState,i===null)if(l===null)if(e.stateNode===null){e:{l=e.type,i=e.memoizedProps,c=c.ownerDocument||c;t:switch(l){case"title":u=c.getElementsByTagName("title")[0],(!u||u[yt]||u[Ie]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=c.createElement(l),c.head.insertBefore(u,c.querySelector("head > title"))),At(u,l,i),u[Ie]=e,N(u),l=u;break e;case"link":var p=Pp("link","href",c).get(l+(i.href||""));if(p){for(var b=0;b<p.length;b++)if(u=p[b],u.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&u.getAttribute("rel")===(i.rel==null?null:i.rel)&&u.getAttribute("title")===(i.title==null?null:i.title)&&u.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){p.splice(b,1);break t}}u=c.createElement(l),At(u,l,i),c.head.appendChild(u);break;case"meta":if(p=Pp("meta","content",c).get(l+(i.content||""))){for(b=0;b<p.length;b++)if(u=p[b],u.getAttribute("content")===(i.content==null?null:""+i.content)&&u.getAttribute("name")===(i.name==null?null:i.name)&&u.getAttribute("property")===(i.property==null?null:i.property)&&u.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&u.getAttribute("charset")===(i.charSet==null?null:i.charSet)){p.splice(b,1);break t}}u=c.createElement(l),At(u,l,i),c.head.appendChild(u);break;default:throw Error(a(468,l))}u[Ie]=e,N(u),l=u}e.stateNode=l}else $p(c,e.type,e.stateNode);else e.stateNode=Hp(c,l,e.memoizedProps);else u!==l?(u===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):u.count--,l===null?$p(c,e.type,e.stateNode):Hp(c,l,e.memoizedProps)):l===null&&e.stateNode!==null&&xu(e,e.memoizedProps,i.memoizedProps)}break;case 27:Ut(t,e),Bt(e),l&512&&(pt||i===null||qn(i,i.return)),i!==null&&l&4&&xu(e,e.memoizedProps,i.memoizedProps);break;case 5:if(Ut(t,e),Bt(e),l&512&&(pt||i===null||qn(i,i.return)),e.flags&32){c=e.stateNode;try{Ui(c,"")}catch(he){Ge(e,e.return,he)}}l&4&&e.stateNode!=null&&(c=e.memoizedProps,xu(e,c,i!==null?i.memoizedProps:c)),l&1024&&(wu=!0);break;case 6:if(Ut(t,e),Bt(e),l&4){if(e.stateNode===null)throw Error(a(162));l=e.memoizedProps,i=e.stateNode;try{i.nodeValue=l}catch(he){Ge(e,e.return,he)}}break;case 3:if(no=null,c=jn,jn=eo(t.containerInfo),Ut(t,e),jn=c,Bt(e),l&4&&i!==null&&i.memoizedState.isDehydrated)try{mr(t.containerInfo)}catch(he){Ge(e,e.return,he)}wu&&(wu=!1,$m(e));break;case 4:l=jn,jn=eo(e.stateNode.containerInfo),Ut(t,e),Bt(e),jn=l;break;case 12:Ut(t,e),Bt(e);break;case 31:Ut(t,e),Bt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Hl(e,l)));break;case 13:Ut(t,e),Bt(e),e.child.flags&8192&&e.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&($l=et()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Hl(e,l)));break;case 22:c=e.memoizedState!==null;var j=i!==null&&i.memoizedState!==null,B=ss,Y=pt;if(ss=B||c,pt=Y||j,Ut(t,e),pt=Y,ss=B,Bt(e),l&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(i===null||j||ss||pt||wi(e)),i=null,t=e;;){if(t.tag===5||t.tag===26){if(i===null){j=i=t;try{if(u=j.stateNode,c)p=u.style,typeof p.setProperty=="function"?p.setProperty("display","none","important"):p.display="none";else{b=j.stateNode;var I=j.memoizedProps.style,L=I!=null&&I.hasOwnProperty("display")?I.display:null;b.style.display=L==null||typeof L=="boolean"?"":(""+L).trim()}}catch(he){Ge(j,j.return,he)}}}else if(t.tag===6){if(i===null){j=t;try{j.stateNode.nodeValue=c?"":j.memoizedProps}catch(he){Ge(j,j.return,he)}}}else if(t.tag===18){if(i===null){j=t;try{var P=j.stateNode;c?kp(P,!0):kp(j.stateNode,!1)}catch(he){Ge(j,j.return,he)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;i===t&&(i=null),t=t.return}i===t&&(i=null),t.sibling.return=t.return,t=t.sibling}l&4&&(l=e.updateQueue,l!==null&&(i=l.retryQueue,i!==null&&(l.retryQueue=null,Hl(e,i))));break;case 19:Ut(t,e),Bt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Hl(e,l)));break;case 30:break;case 21:break;default:Ut(t,e),Bt(e)}}function Bt(e){var t=e.flags;if(t&2){try{for(var i,l=e.return;l!==null;){if(Rm(l)){i=l;break}l=l.return}if(i==null)throw Error(a(160));switch(i.tag){case 27:var c=i.stateNode,u=vu(e);Ll(e,u,c);break;case 5:var p=i.stateNode;i.flags&32&&(Ui(p,""),i.flags&=-33);var b=vu(e);Ll(e,b,p);break;case 3:case 4:var j=i.stateNode.containerInfo,B=vu(e);_u(e,B,j);break;default:throw Error(a(161))}}catch(Y){Ge(e,e.return,Y)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function $m(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;$m(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function rs(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)qm(e,t.alternate,t),t=t.sibling}function wi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:ks(4,t,t.return),wi(t);break;case 1:qn(t,t.return);var i=t.stateNode;typeof i.componentWillUnmount=="function"&&km(t,t.return,i),wi(t);break;case 27:ya(t.stateNode);case 26:case 5:qn(t,t.return),wi(t);break;case 22:t.memoizedState===null&&wi(t);break;case 30:wi(t);break;default:wi(t)}e=e.sibling}}function as(e,t,i){for(i=i&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,c=e,u=t,p=u.flags;switch(u.tag){case 0:case 11:case 15:as(c,u,i),la(4,u);break;case 1:if(as(c,u,i),l=u,c=l.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(B){Ge(l,l.return,B)}if(l=u,c=l.updateQueue,c!==null){var b=l.stateNode;try{var j=c.shared.hiddenCallbacks;if(j!==null)for(c.shared.hiddenCallbacks=null,c=0;c<j.length;c++)xd(j[c],b)}catch(B){Ge(l,l.return,B)}}i&&p&64&&Cm(u),oa(u,u.return);break;case 27:Dm(u);case 26:case 5:as(c,u,i),i&&l===null&&p&4&&Mm(u),oa(u,u.return);break;case 12:as(c,u,i);break;case 31:as(c,u,i),i&&p&4&&Lm(c,u);break;case 13:as(c,u,i),i&&p&4&&Hm(c,u);break;case 22:u.memoizedState===null&&as(c,u,i),oa(u,u.return);break;case 30:break;default:as(c,u,i)}t=t.sibling}}function Su(e,t){var i=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==i&&(e!=null&&e.refCount++,i!=null&&Qr(i))}function Eu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Qr(e))}function On(e,t,i,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Ym(e,t,i,l),t=t.sibling}function Ym(e,t,i,l){var c=t.flags;switch(t.tag){case 0:case 11:case 15:On(e,t,i,l),c&2048&&la(9,t);break;case 1:On(e,t,i,l);break;case 3:On(e,t,i,l),c&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Qr(e)));break;case 12:if(c&2048){On(e,t,i,l),e=t.stateNode;try{var u=t.memoizedProps,p=u.id,b=u.onPostCommit;typeof b=="function"&&b(p,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(j){Ge(t,t.return,j)}}else On(e,t,i,l);break;case 31:On(e,t,i,l);break;case 13:On(e,t,i,l);break;case 23:break;case 22:u=t.stateNode,p=t.alternate,t.memoizedState!==null?u._visibility&2?On(e,t,i,l):ca(e,t):u._visibility&2?On(e,t,i,l):(u._visibility|=2,sr(e,t,i,l,(t.subtreeFlags&10256)!==0||!1)),c&2048&&Su(p,t);break;case 24:On(e,t,i,l),c&2048&&Eu(t.alternate,t);break;default:On(e,t,i,l)}}function sr(e,t,i,l,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,p=t,b=i,j=l,B=p.flags;switch(p.tag){case 0:case 11:case 15:sr(u,p,b,j,c),la(8,p);break;case 23:break;case 22:var Y=p.stateNode;p.memoizedState!==null?Y._visibility&2?sr(u,p,b,j,c):ca(u,p):(Y._visibility|=2,sr(u,p,b,j,c)),c&&B&2048&&Su(p.alternate,p);break;case 24:sr(u,p,b,j,c),c&&B&2048&&Eu(p.alternate,p);break;default:sr(u,p,b,j,c)}t=t.sibling}}function ca(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var i=e,l=t,c=l.flags;switch(l.tag){case 22:ca(i,l),c&2048&&Su(l.alternate,l);break;case 24:ca(i,l),c&2048&&Eu(l.alternate,l);break;default:ca(i,l)}t=t.sibling}}var ua=8192;function ir(e,t,i){if(e.subtreeFlags&ua)for(e=e.child;e!==null;)Gm(e,t,i),e=e.sibling}function Gm(e,t,i){switch(e.tag){case 26:ir(e,t,i),e.flags&ua&&e.memoizedState!==null&&fx(i,jn,e.memoizedState,e.memoizedProps);break;case 5:ir(e,t,i);break;case 3:case 4:var l=jn;jn=eo(e.stateNode.containerInfo),ir(e,t,i),jn=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=ua,ua=16777216,ir(e,t,i),ua=l):ir(e,t,i));break;default:ir(e,t,i)}}function Vm(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 fa(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var i=0;i<t.length;i++){var l=t[i];xt=l,Jm(l,e)}Vm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Fm(e),e=e.sibling}function Fm(e){switch(e.tag){case 0:case 11:case 15:fa(e),e.flags&2048&&ks(9,e,e.return);break;case 3:fa(e);break;case 12:fa(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Pl(e)):fa(e);break;default:fa(e)}}function Pl(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var i=0;i<t.length;i++){var l=t[i];xt=l,Jm(l,e)}Vm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:ks(8,t,t.return),Pl(t);break;case 22:i=t.stateNode,i._visibility&2&&(i._visibility&=-3,Pl(t));break;default:Pl(t)}e=e.sibling}}function Jm(e,t){for(;xt!==null;){var i=xt;switch(i.tag){case 0:case 11:case 15:ks(8,i,t);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var l=i.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Qr(i.memoizedState.cache)}if(l=i.child,l!==null)l.return=i,xt=l;else e:for(i=e;xt!==null;){l=xt;var c=l.sibling,u=l.return;if(Um(l),l===i){xt=null;break e}if(c!==null){c.return=u,xt=c;break e}xt=u}}}var jb={getCacheForType:function(e){var t=St(ht),i=t.data.get(e);return i===void 0&&(i=e(),t.data.set(e,i)),i},cacheSignal:function(){return St(ht).controller.signal}},Ob=typeof WeakMap=="function"?WeakMap:Map,Pe=0,Xe=null,Ne=null,Re=0,Ye=0,Qt=null,Ms=!1,rr=!1,Au=!1,ls=0,at=0,Rs=0,Si=0,ju=0,It=0,ar=0,ha=null,Lt=null,Ou=!1,$l=0,Qm=0,Yl=1/0,Gl=null,Ds=null,bt=0,zs=null,lr=null,os=0,Tu=0,Nu=null,Im=null,da=0,Cu=null;function Xt(){return(Pe&2)!==0&&Re!==0?Re&-Re:$.T!==null?qu():zr()}function Xm(){if(It===0)if((Re&536870912)===0||ze){var e=Gn;Gn<<=1,(Gn&3932160)===0&&(Gn=262144),It=e}else It=536870912;return e=Ft.current,e!==null&&(e.flags|=32),It}function Ht(e,t,i){(e===Xe&&(Ye===2||Ye===9)||e.cancelPendingCommit!==null)&&(or(e,0),qs(e,Re,It,!1)),Sn(e,i),((Pe&2)===0||e!==Xe)&&(e===Xe&&((Pe&2)===0&&(Si|=i),at===4&&qs(e,Re,It,!1)),Un(e))}function Km(e,t,i){if((Pe&6)!==0)throw Error(a(327));var l=!i&&(t&127)===0&&(t&e.expiredLanes)===0||ii(e,t),c=l?Cb(e,t):Mu(e,t,!0),u=l;do{if(c===0){rr&&!l&&qs(e,t,0,!1);break}else{if(i=e.current.alternate,u&&!Tb(i)){c=Mu(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=ha;var j=b.current.memoizedState.isDehydrated;if(j&&(or(b,p).flags|=256),p=Mu(b,p,!1),p!==2){if(Au&&!j){b.errorRecoveryDisabledLanes|=u,Si|=u,c=4;break e}u=Lt,Lt=c,u!==null&&(Lt===null?Lt=u:Lt.push.apply(Lt,u))}c=p}if(u=!1,c!==2)continue}}if(c===1){or(e,0),qs(e,t,0,!0);break}e:{switch(l=e,u=c,u){case 0:case 1:throw Error(a(345));case 4:if((t&4194048)!==t)break;case 6:qs(l,t,It,!Ms);break e;case 2:Lt=null;break;case 3:case 5:break;default:throw Error(a(329))}if((t&62914560)===t&&(c=$l+300-et(),10<c)){if(qs(l,t,It,!Ms),si(l,0,!0)!==0)break e;os=t,l.timeoutHandle=Tp(Zm.bind(null,l,i,Lt,Gl,Ou,t,It,Si,ar,Ms,u,"Throttled",-0,0),c);break e}Zm(l,i,Lt,Gl,Ou,t,It,Si,ar,Ms,u,null,-0,0)}}break}while(!0);Un(e)}function Zm(e,t,i,l,c,u,p,b,j,B,Y,I,L,P){if(e.timeoutHandle=-1,I=t.subtreeFlags,I&8192||(I&16785408)===16785408){I={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Jn},Gm(t,u,I);var he=(u&62914560)===u?$l-et():(u&4194048)===u?Qm-et():0;if(he=hx(I,he),he!==null){os=u,e.cancelPendingCommit=he(ap.bind(null,e,t,u,i,l,c,p,b,j,Y,I,null,L,P)),qs(e,u,p,!B);return}}ap(e,t,u,i,l,c,p,b,j)}function Tb(e){for(var t=e;;){var i=t.tag;if((i===0||i===11||i===15)&&t.flags&16384&&(i=t.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var l=0;l<i.length;l++){var c=i[l],u=c.getSnapshot;c=c.value;try{if(!Gt(u(),c))return!1}catch{return!1}}if(i=t.child,t.subtreeFlags&16384&&i!==null)i.return=t,t=i;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function qs(e,t,i,l){t&=~ju,t&=~Si,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var c=t;0<c;){var u=31-Nt(c),p=1<<u;l[u]=-1,c&=~p}i!==0&&xs(e,i,t)}function Vl(){return(Pe&6)===0?(ma(0),!1):!0}function ku(){if(Ne!==null){if(Ye===0)var e=Ne.return;else e=Ne,Kn=mi=null,Jc(e),Zi=null,Xr=0,e=Ne;for(;e!==null;)Nm(e.alternate,e),e=e.return;Ne=null}}function or(e,t){var i=e.timeoutHandle;i!==-1&&(e.timeoutHandle=-1,Qb(i)),i=e.cancelPendingCommit,i!==null&&(e.cancelPendingCommit=null,i()),os=0,ku(),Xe=e,Ne=i=In(e.current,null),Re=t,Ye=0,Qt=null,Ms=!1,rr=ii(e,t),Au=!1,ar=It=ju=Si=Rs=at=0,Lt=ha=null,Ou=!1,(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var c=31-Nt(l),u=1<<c;t|=e[c],l&=~u}return ls=t,hl(),i}function Wm(e,t){Ee=null,$.H=ia,t===Ki||t===vl?(t=pd(),Ye=3):t===zc?(t=pd(),Ye=4):Ye=t===cu?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Qt=t,Ne===null&&(at=1,Dl(e,fn(t,e.current)))}function ep(){var e=Ft.current;return e===null?!0:(Re&4194048)===Re?pn===null:(Re&62914560)===Re||(Re&536870912)!==0?e===pn:!1}function tp(){var e=$.H;return $.H=ia,e===null?ia:e}function np(){var e=$.A;return $.A=jb,e}function Fl(){at=4,Ms||(Re&4194048)!==Re&&Ft.current!==null||(rr=!0),(Rs&134217727)===0&&(Si&134217727)===0||Xe===null||qs(Xe,Re,It,!1)}function Mu(e,t,i){var l=Pe;Pe|=2;var c=tp(),u=np();(Xe!==e||Re!==t)&&(Gl=null,or(e,t)),t=!1;var p=at;e:do try{if(Ye!==0&&Ne!==null){var b=Ne,j=Qt;switch(Ye){case 8:ku(),p=6;break e;case 3:case 2:case 9:case 6:Ft.current===null&&(t=!0);var B=Ye;if(Ye=0,Qt=null,cr(e,b,j,B),i&&rr){p=0;break e}break;default:B=Ye,Ye=0,Qt=null,cr(e,b,j,B)}}Nb(),p=at;break}catch(Y){Wm(e,Y)}while(!0);return t&&e.shellSuspendCounter++,Kn=mi=null,Pe=l,$.H=c,$.A=u,Ne===null&&(Xe=null,Re=0,hl()),p}function Nb(){for(;Ne!==null;)sp(Ne)}function Cb(e,t){var i=Pe;Pe|=2;var l=tp(),c=np();Xe!==e||Re!==t?(Gl=null,Yl=et()+500,or(e,t)):rr=ii(e,t);e:do try{if(Ye!==0&&Ne!==null){t=Ne;var u=Qt;t:switch(Ye){case 1:Ye=0,Qt=null,cr(e,t,u,1);break;case 2:case 9:if(dd(u)){Ye=0,Qt=null,ip(t);break}t=function(){Ye!==2&&Ye!==9||Xe!==e||(Ye=7),Un(e)},u.then(t,t);break e;case 3:Ye=7;break e;case 4:Ye=5;break e;case 7:dd(u)?(Ye=0,Qt=null,ip(t)):(Ye=0,Qt=null,cr(e,t,u,7));break;case 5:var p=null;switch(Ne.tag){case 26:p=Ne.memoizedState;case 5:case 27:var b=Ne;if(p?Yp(p):b.stateNode.complete){Ye=0,Qt=null;var j=b.sibling;if(j!==null)Ne=j;else{var B=b.return;B!==null?(Ne=B,Jl(B)):Ne=null}break t}}Ye=0,Qt=null,cr(e,t,u,5);break;case 6:Ye=0,Qt=null,cr(e,t,u,6);break;case 8:ku(),at=6;break e;default:throw Error(a(462))}}kb();break}catch(Y){Wm(e,Y)}while(!0);return Kn=mi=null,$.H=l,$.A=c,Pe=i,Ne!==null?0:(Xe=null,Re=0,hl(),at)}function kb(){for(;Ne!==null&&!Ia();)sp(Ne)}function sp(e){var t=Om(e.alternate,e,ls);e.memoizedProps=e.pendingProps,t===null?Jl(e):Ne=t}function ip(e){var t=e,i=t.alternate;switch(t.tag){case 15:case 0:t=_m(i,t,t.pendingProps,t.type,void 0,Re);break;case 11:t=_m(i,t,t.pendingProps,t.type.render,t.ref,Re);break;case 5:Jc(t);default:Nm(i,t),t=Ne=nd(t,ls),t=Om(i,t,ls)}e.memoizedProps=e.pendingProps,t===null?Jl(e):Ne=t}function cr(e,t,i,l){Kn=mi=null,Jc(t),Zi=null,Xr=0;var c=t.return;try{if(xb(e,c,t,i,Re)){at=1,Dl(e,fn(i,e.current)),Ne=null;return}}catch(u){if(c!==null)throw Ne=c,u;at=1,Dl(e,fn(i,e.current)),Ne=null;return}t.flags&32768?(ze||l===1?e=!0:rr||(Re&536870912)!==0?e=!1:(Ms=e=!0,(l===2||l===9||l===3||l===6)&&(l=Ft.current,l!==null&&l.tag===13&&(l.flags|=16384))),rp(t,e)):Jl(t)}function Jl(e){var t=e;do{if((t.flags&32768)!==0){rp(t,Ms);return}e=t.return;var i=wb(t.alternate,t,ls);if(i!==null){Ne=i;return}if(t=t.sibling,t!==null){Ne=t;return}Ne=t=e}while(t!==null);at===0&&(at=5)}function rp(e,t){do{var i=Sb(e.alternate,e);if(i!==null){i.flags&=32767,Ne=i;return}if(i=e.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!t&&(e=e.sibling,e!==null)){Ne=e;return}Ne=e=i}while(e!==null);at=6,Ne=null}function ap(e,t,i,l,c,u,p,b,j){e.cancelPendingCommit=null;do Ql();while(bt!==0);if((Pe&6)!==0)throw Error(a(327));if(t!==null){if(t===e.current)throw Error(a(177));if(u=t.lanes|t.childLanes,u|=vc,bs(e,i,u,p,b,j),e===Xe&&(Ne=Xe=null,Re=0),lr=t,zs=e,os=i,Tu=u,Nu=c,Im=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,zb(Mi,function(){return fp(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=$.T,$.T=null,c=te.p,te.p=2,p=Pe,Pe|=4;try{Eb(e,t,i)}finally{Pe=p,te.p=c,$.T=l}}bt=1,lp(),op(),cp()}}function lp(){if(bt===1){bt=0;var e=zs,t=lr,i=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||i){i=$.T,$.T=null;var l=te.p;te.p=2;var c=Pe;Pe|=4;try{Pm(t,e);var u=Gu,p=Jh(e.containerInfo),b=u.focusedElem,j=u.selectionRange;if(p!==b&&b&&b.ownerDocument&&Fh(b.ownerDocument.documentElement,b)){if(j!==null&&pc(b)){var B=j.start,Y=j.end;if(Y===void 0&&(Y=B),"selectionStart"in b)b.selectionStart=B,b.selectionEnd=Math.min(Y,b.value.length);else{var I=b.ownerDocument||document,L=I&&I.defaultView||window;if(L.getSelection){var P=L.getSelection(),he=b.textContent.length,ye=Math.min(j.start,he),Qe=j.end===void 0?ye:Math.min(j.end,he);!P.extend&&ye>Qe&&(p=Qe,Qe=ye,ye=p);var R=Vh(b,ye),k=Vh(b,Qe);if(R&&k&&(P.rangeCount!==1||P.anchorNode!==R.node||P.anchorOffset!==R.offset||P.focusNode!==k.node||P.focusOffset!==k.offset)){var U=I.createRange();U.setStart(R.node,R.offset),P.removeAllRanges(),ye>Qe?(P.addRange(U),P.extend(k.node,k.offset)):(U.setEnd(k.node,k.offset),P.addRange(U))}}}}for(I=[],P=b;P=P.parentNode;)P.nodeType===1&&I.push({element:P,left:P.scrollLeft,top:P.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<I.length;b++){var F=I[b];F.element.scrollLeft=F.left,F.element.scrollTop=F.top}}ao=!!Yu,Gu=Yu=null}finally{Pe=c,te.p=l,$.T=i}}e.current=t,bt=2}}function op(){if(bt===2){bt=0;var e=zs,t=lr,i=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||i){i=$.T,$.T=null;var l=te.p;te.p=2;var c=Pe;Pe|=4;try{qm(e,t.alternate,t)}finally{Pe=c,te.p=l,$.T=i}}bt=3}}function cp(){if(bt===4||bt===3){bt=0,ki();var e=zs,t=lr,i=os,l=Im;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?bt=5:(bt=0,lr=zs=null,up(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(Ds=null),ai(i),t=t.stateNode,ot&&typeof ot.onCommitFiberRoot=="function")try{ot.onCommitFiberRoot(ni,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=$.T,c=te.p,te.p=2,$.T=null;try{for(var u=e.onRecoverableError,p=0;p<l.length;p++){var b=l[p];u(b.value,{componentStack:b.stack})}}finally{$.T=t,te.p=c}}(os&3)!==0&&Ql(),Un(e),c=e.pendingLanes,(i&261930)!==0&&(c&42)!==0?e===Cu?da++:(da=0,Cu=e):da=0,ma(0)}}function up(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Qr(t)))}function Ql(){return lp(),op(),cp(),fp()}function fp(){if(bt!==5)return!1;var e=zs,t=Tu;Tu=0;var i=ai(os),l=$.T,c=te.p;try{te.p=32>i?32:i,$.T=null,i=Nu,Nu=null;var u=zs,p=os;if(bt=0,lr=zs=null,os=0,(Pe&6)!==0)throw Error(a(331));var b=Pe;if(Pe|=4,Fm(u.current),Ym(u,u.current,p,i),Pe=b,ma(0,!1),ot&&typeof ot.onPostCommitFiberRoot=="function")try{ot.onPostCommitFiberRoot(ni,u)}catch{}return!0}finally{te.p=c,$.T=l,up(e,t)}}function hp(e,t,i){t=fn(i,t),t=ou(e.stateNode,t,2),e=Ts(e,t,2),e!==null&&(Sn(e,2),Un(e))}function Ge(e,t,i){if(e.tag===3)hp(e,e,i);else for(;t!==null;){if(t.tag===3){hp(t,e,i);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Ds===null||!Ds.has(l))){e=fn(i,e),i=dm(2),l=Ts(t,i,2),l!==null&&(mm(i,l,t,e),Sn(l,2),Un(l));break}}t=t.return}}function Ru(e,t,i){var l=e.pingCache;if(l===null){l=e.pingCache=new Ob;var c=new Set;l.set(t,c)}else c=l.get(t),c===void 0&&(c=new Set,l.set(t,c));c.has(i)||(Au=!0,c.add(i),e=Mb.bind(null,e,t,i),t.then(e,e))}function Mb(e,t,i){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,Xe===e&&(Re&i)===i&&(at===4||at===3&&(Re&62914560)===Re&&300>et()-$l?(Pe&2)===0&&or(e,0):ju|=i,ar===Re&&(ar=0)),Un(e)}function dp(e,t){t===0&&(t=Di()),e=fi(e,t),e!==null&&(Sn(e,t),Un(e))}function Rb(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),dp(e,i)}function Db(e,t){var i=0;switch(e.tag){case 31:case 13:var l=e.stateNode,c=e.memoizedState;c!==null&&(i=c.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(a(314))}l!==null&&l.delete(t),dp(e,i)}function zb(e,t){return kr(e,t)}var Il=null,ur=null,Du=!1,Xl=!1,zu=!1,Us=0;function Un(e){e!==ur&&e.next===null&&(ur===null?Il=ur=e:ur=ur.next=e),Xl=!0,Du||(Du=!0,Ub())}function ma(e,t){if(!zu&&Xl){zu=!0;do for(var i=!1,l=Il;l!==null;){if(e!==0){var c=l.pendingLanes;if(c===0)var u=0;else{var p=l.suspendedLanes,b=l.pingedLanes;u=(1<<31-Nt(42|e)+1)-1,u&=c&~(p&~b),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(i=!0,yp(l,u))}else u=Re,u=si(l,l===Xe?u:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(u&3)===0||ii(l,u)||(i=!0,yp(l,u));l=l.next}while(i);zu=!1}}function qb(){mp()}function mp(){Xl=Du=!1;var e=0;Us!==0&&Jb()&&(e=Us);for(var t=et(),i=null,l=Il;l!==null;){var c=l.next,u=pp(l,t);u===0?(l.next=null,i===null?Il=c:i.next=c,c===null&&(ur=i)):(i=l,(e!==0||(u&3)!==0)&&(Xl=!0)),l=c}bt!==0&&bt!==5||ma(e),Us!==0&&(Us=0)}function pp(e,t){for(var i=e.suspendedLanes,l=e.pingedLanes,c=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var p=31-Nt(u),b=1<<p,j=c[p];j===-1?((b&i)===0||(b&l)!==0)&&(c[p]=Dr(b,t)):j<=t&&(e.expiredLanes|=b),u&=~b}if(t=Xe,i=Re,i=si(e,e===t?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,i===0||e===t&&(Ye===2||Ye===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&Yn(l),e.callbackNode=null,e.callbackPriority=0;if((i&3)===0||ii(e,i)){if(t=i&-i,t===e.callbackPriority)return t;switch(l!==null&&Yn(l),ai(i)){case 2:case 8:i=Ka;break;case 32:i=Mi;break;case 268435456:i=Za;break;default:i=Mi}return l=gp.bind(null,e),i=kr(i,l),e.callbackPriority=t,e.callbackNode=i,t}return l!==null&&l!==null&&Yn(l),e.callbackPriority=2,e.callbackNode=null,2}function gp(e,t){if(bt!==0&&bt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var i=e.callbackNode;if(Ql()&&e.callbackNode!==i)return null;var l=Re;return l=si(e,e===Xe?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Km(e,l,t),pp(e,et()),e.callbackNode!=null&&e.callbackNode===i?gp.bind(null,e):null)}function yp(e,t){if(Ql())return null;Km(e,t,!0)}function Ub(){Ib(function(){(Pe&6)!==0?kr(Xa,qb):mp()})}function qu(){if(Us===0){var e=Ii;e===0&&(e=ps,ps<<=1,(ps&261888)===0&&(ps=256)),Us=e}return Us}function bp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:il(""+e)}function xp(e,t){var i=t.ownerDocument.createElement("input");return i.name=t.name,i.value=t.value,e.id&&i.setAttribute("form",e.id),t.parentNode.insertBefore(i,t),e=new FormData(e),i.parentNode.removeChild(i),e}function Bb(e,t,i,l,c){if(t==="submit"&&i&&i.stateNode===c){var u=bp((c[it]||null).action),p=l.submitter;p&&(t=(t=p[it]||null)?bp(t.formAction):p.getAttribute("formAction"),t!==null&&(u=t,p=null));var b=new ol("action","action",null,l,c);e.push({event:b,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Us!==0){var j=p?xp(c,p):new FormData(c);nu(i,{pending:!0,data:j,method:c.method,action:u},null,j)}}else typeof u=="function"&&(b.preventDefault(),j=p?xp(c,p):new FormData(c),nu(i,{pending:!0,data:j,method:c.method,action:u},u,j))},currentTarget:c}]})}}for(var Uu=0;Uu<xc.length;Uu++){var Bu=xc[Uu],Lb=Bu.toLowerCase(),Hb=Bu[0].toUpperCase()+Bu.slice(1);An(Lb,"on"+Hb)}An(Xh,"onAnimationEnd"),An(Kh,"onAnimationIteration"),An(Zh,"onAnimationStart"),An("dblclick","onDoubleClick"),An("focusin","onFocus"),An("focusout","onBlur"),An(nb,"onTransitionRun"),An(sb,"onTransitionStart"),An(ib,"onTransitionCancel"),An(Wh,"onTransitionEnd"),H("onMouseEnter",["mouseout","mouseover"]),H("onMouseLeave",["mouseout","mouseover"]),H("onPointerEnter",["pointerout","pointerover"]),H("onPointerLeave",["pointerout","pointerover"]),Z("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Z("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Z("onBeforeInput",["compositionend","keypress","textInput","paste"]),Z("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Z("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Z("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var pa="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(" "),Pb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(pa));function vp(e,t){t=(t&4)!==0;for(var i=0;i<e.length;i++){var l=e[i],c=l.event;l=l.listeners;e:{var u=void 0;if(t)for(var p=l.length-1;0<=p;p--){var b=l[p],j=b.instance,B=b.currentTarget;if(b=b.listener,j!==u&&c.isPropagationStopped())break e;u=b,c.currentTarget=B;try{u(c)}catch(Y){fl(Y)}c.currentTarget=null,u=j}else for(p=0;p<l.length;p++){if(b=l[p],j=b.instance,B=b.currentTarget,b=b.listener,j!==u&&c.isPropagationStopped())break e;u=b,c.currentTarget=B;try{u(c)}catch(Y){fl(Y)}c.currentTarget=null,u=j}}}}function Ce(e,t){var i=t[li];i===void 0&&(i=t[li]=new Set);var l=e+"__bubble";i.has(l)||(_p(t,e,2,!1),i.add(l))}function Lu(e,t,i){var l=0;t&&(l|=4),_p(i,e,l,t)}var Kl="_reactListening"+Math.random().toString(36).slice(2);function Hu(e){if(!e[Kl]){e[Kl]=!0,z.forEach(function(i){i!=="selectionchange"&&(Pb.has(i)||Lu(i,!1,e),Lu(i,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Kl]||(t[Kl]=!0,Lu("selectionchange",!1,t))}}function _p(e,t,i,l){switch(Xp(t)){case 2:var c=px;break;case 8:c=gx;break;default:c=tf}i=c.bind(null,t,i,e),c=void 0,!ac||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),l?c!==void 0?e.addEventListener(t,i,{capture:!0,passive:c}):e.addEventListener(t,i,!0):c!==void 0?e.addEventListener(t,i,{passive:c}):e.addEventListener(t,i,!1)}function Pu(e,t,i,l,c){var u=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var p=l.tag;if(p===3||p===4){var b=l.stateNode.containerInfo;if(b===c)break;if(p===4)for(p=l.return;p!==null;){var j=p.tag;if((j===3||j===4)&&p.stateNode.containerInfo===c)return;p=p.return}for(;b!==null;){if(p=x(b),p===null)return;if(j=p.tag,j===5||j===6||j===26||j===27){l=u=p;continue e}b=b.parentNode}}l=l.return}jh(function(){var B=u,Y=ic(i),I=[];e:{var L=ed.get(e);if(L!==void 0){var P=ol,he=e;switch(e){case"keypress":if(al(i)===0)break e;case"keydown":case"keyup":P=Dy;break;case"focusin":he="focus",P=uc;break;case"focusout":he="blur",P=uc;break;case"beforeblur":case"afterblur":P=uc;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":P=Nh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":P=wy;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":P=Uy;break;case Xh:case Kh:case Zh:P=Ay;break;case Wh:P=Ly;break;case"scroll":case"scrollend":P=vy;break;case"wheel":P=Py;break;case"copy":case"cut":case"paste":P=Oy;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":P=kh;break;case"toggle":case"beforetoggle":P=Yy}var ye=(t&4)!==0,Qe=!ye&&(e==="scroll"||e==="scrollend"),R=ye?L!==null?L+"Capture":null:L;ye=[];for(var k=B,U;k!==null;){var F=k;if(U=F.stateNode,F=F.tag,F!==5&&F!==26&&F!==27||U===null||R===null||(F=Ur(k,R),F!=null&&ye.push(ga(k,F,U))),Qe)break;k=k.return}0<ye.length&&(L=new P(L,he,null,i,Y),I.push({event:L,listeners:ye}))}}if((t&7)===0){e:{if(L=e==="mouseover"||e==="pointerover",P=e==="mouseout"||e==="pointerout",L&&i!==sc&&(he=i.relatedTarget||i.fromElement)&&(x(he)||he[Yt]))break e;if((P||L)&&(L=Y.window===Y?Y:(L=Y.ownerDocument)?L.defaultView||L.parentWindow:window,P?(he=i.relatedTarget||i.toElement,P=B,he=he?x(he):null,he!==null&&(Qe=f(he),ye=he.tag,he!==Qe||ye!==5&&ye!==27&&ye!==6)&&(he=null)):(P=null,he=B),P!==he)){if(ye=Nh,F="onMouseLeave",R="onMouseEnter",k="mouse",(e==="pointerout"||e==="pointerover")&&(ye=kh,F="onPointerLeave",R="onPointerEnter",k="pointer"),Qe=P==null?L:_(P),U=he==null?L:_(he),L=new ye(F,k+"leave",P,i,Y),L.target=Qe,L.relatedTarget=U,F=null,x(Y)===B&&(ye=new ye(R,k+"enter",he,i,Y),ye.target=U,ye.relatedTarget=Qe,F=ye),Qe=F,P&&he)t:{for(ye=$b,R=P,k=he,U=0,F=R;F;F=ye(F))U++;F=0;for(var ge=k;ge;ge=ye(ge))F++;for(;0<U-F;)R=ye(R),U--;for(;0<F-U;)k=ye(k),F--;for(;U--;){if(R===k||k!==null&&R===k.alternate){ye=R;break t}R=ye(R),k=ye(k)}ye=null}else ye=null;P!==null&&wp(I,L,P,ye,!1),he!==null&&Qe!==null&&wp(I,Qe,he,ye,!0)}}e:{if(L=B?_(B):window,P=L.nodeName&&L.nodeName.toLowerCase(),P==="select"||P==="input"&&L.type==="file")var Be=Lh;else if(Uh(L))if(Hh)Be=Wy;else{Be=Ky;var pe=Xy}else P=L.nodeName,!P||P.toLowerCase()!=="input"||L.type!=="checkbox"&&L.type!=="radio"?B&&nc(B.elementType)&&(Be=Lh):Be=Zy;if(Be&&(Be=Be(e,B))){Bh(I,Be,i,Y);break e}pe&&pe(e,L,B),e==="focusout"&&B&&L.type==="number"&&B.memoizedProps.value!=null&&tc(L,"number",L.value)}switch(pe=B?_(B):window,e){case"focusin":(Uh(pe)||pe.contentEditable==="true")&&(Pi=pe,gc=B,Vr=null);break;case"focusout":Vr=gc=Pi=null;break;case"mousedown":yc=!0;break;case"contextmenu":case"mouseup":case"dragend":yc=!1,Qh(I,i,Y);break;case"selectionchange":if(tb)break;case"keydown":case"keyup":Qh(I,i,Y)}var Ae;if(hc)e:{switch(e){case"compositionstart":var De="onCompositionStart";break e;case"compositionend":De="onCompositionEnd";break e;case"compositionupdate":De="onCompositionUpdate";break e}De=void 0}else Hi?zh(e,i)&&(De="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(De="onCompositionStart");De&&(Mh&&i.locale!=="ko"&&(Hi||De!=="onCompositionStart"?De==="onCompositionEnd"&&Hi&&(Ae=Oh()):(_s=Y,lc="value"in _s?_s.value:_s.textContent,Hi=!0)),pe=Zl(B,De),0<pe.length&&(De=new Ch(De,e,null,i,Y),I.push({event:De,listeners:pe}),Ae?De.data=Ae:(Ae=qh(i),Ae!==null&&(De.data=Ae)))),(Ae=Vy?Fy(e,i):Jy(e,i))&&(De=Zl(B,"onBeforeInput"),0<De.length&&(pe=new Ch("onBeforeInput","beforeinput",null,i,Y),I.push({event:pe,listeners:De}),pe.data=Ae)),Bb(I,e,B,i,Y)}vp(I,t)})}function ga(e,t,i){return{instance:e,listener:t,currentTarget:i}}function Zl(e,t){for(var i=t+"Capture",l=[];e!==null;){var c=e,u=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||u===null||(c=Ur(e,i),c!=null&&l.unshift(ga(e,c,u)),c=Ur(e,t),c!=null&&l.push(ga(e,c,u))),e.tag===3)return l;e=e.return}return[]}function $b(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function wp(e,t,i,l,c){for(var u=t._reactName,p=[];i!==null&&i!==l;){var b=i,j=b.alternate,B=b.stateNode;if(b=b.tag,j!==null&&j===l)break;b!==5&&b!==26&&b!==27||B===null||(j=B,c?(B=Ur(i,u),B!=null&&p.unshift(ga(i,B,j))):c||(B=Ur(i,u),B!=null&&p.push(ga(i,B,j)))),i=i.return}p.length!==0&&e.push({event:t,listeners:p})}var Yb=/\r\n?/g,Gb=/\u0000|\uFFFD/g;function Sp(e){return(typeof e=="string"?e:""+e).replace(Yb,`
|
|
26
|
-
`).replace(Gb,"")}function Ep(e,t){return t=Sp(t),Sp(e)===t}function Je(e,t,i,l,c,u){switch(i){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||Ui(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&Ui(e,""+l);break;case"className":En(e,"class",l);break;case"tabIndex":En(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":En(e,i,l);break;case"style":Eh(e,l,u);break;case"data":if(t!=="object"){En(e,"data",l);break}case"src":case"href":if(l===""&&(t!=="a"||i!=="href")){e.removeAttribute(i);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(i);break}l=il(""+l),e.setAttribute(i,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(i,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof u=="function"&&(i==="formAction"?(t!=="input"&&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(i);break}l=il(""+l),e.setAttribute(i,l);break;case"onClick":l!=null&&(e.onclick=Jn);break;case"onScroll":l!=null&&Ce("scroll",e);break;case"onScrollEnd":l!=null&&Ce("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(i=l.__html,i!=null){if(c.children!=null)throw Error(a(60));e.innerHTML=i}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}i=il(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,""+l):e.removeAttribute(i);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,""):e.removeAttribute(i);break;case"capture":case"download":l===!0?e.setAttribute(i,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,l):e.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(i,l):e.removeAttribute(i);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(i):e.setAttribute(i,l);break;case"popover":Ce("beforetoggle",e),Ce("toggle",e),Ct(e,"popover",l);break;case"xlinkActuate":Fn(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Fn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Fn(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Fn(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Fn(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Fn(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Fn(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Fn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Fn(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Ct(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=by.get(i)||i,Ct(e,i,l))}}function $u(e,t,i,l,c,u){switch(i){case"style":Eh(e,l,u);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(i=l.__html,i!=null){if(c.children!=null)throw Error(a(60));e.innerHTML=i}}break;case"children":typeof l=="string"?Ui(e,l):(typeof l=="number"||typeof l=="bigint")&&Ui(e,""+l);break;case"onScroll":l!=null&&Ce("scroll",e);break;case"onScrollEnd":l!=null&&Ce("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Jn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Q.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(c=i.endsWith("Capture"),t=i.slice(2,c?i.length-7:void 0),u=e[it]||null,u=u!=null?u[i]:null,typeof u=="function"&&e.removeEventListener(t,u,c),typeof l=="function")){typeof u!="function"&&u!==null&&(i in e?e[i]=null:e.hasAttribute(i)&&e.removeAttribute(i)),e.addEventListener(t,l,c);break e}i in e?e[i]=l:l===!0?e.setAttribute(i,""):Ct(e,i,l)}}}function At(e,t,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ce("error",e),Ce("load",e);var l=!1,c=!1,u;for(u in i)if(i.hasOwnProperty(u)){var p=i[u];if(p!=null)switch(u){case"src":l=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,t));default:Je(e,t,u,p,i,null)}}c&&Je(e,t,"srcSet",i.srcSet,i,null),l&&Je(e,t,"src",i.src,i,null);return;case"input":Ce("invalid",e);var b=u=p=c=null,j=null,B=null;for(l in i)if(i.hasOwnProperty(l)){var Y=i[l];if(Y!=null)switch(l){case"name":c=Y;break;case"type":p=Y;break;case"checked":j=Y;break;case"defaultChecked":B=Y;break;case"value":u=Y;break;case"defaultValue":b=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(a(137,t));break;default:Je(e,t,l,Y,i,null)}}vh(e,u,b,j,B,p,c,!1);return;case"select":Ce("invalid",e),l=p=u=null;for(c in i)if(i.hasOwnProperty(c)&&(b=i[c],b!=null))switch(c){case"value":u=b;break;case"defaultValue":p=b;break;case"multiple":l=b;default:Je(e,t,c,b,i,null)}t=u,i=p,e.multiple=!!l,t!=null?qi(e,!!l,t,!1):i!=null&&qi(e,!!l,i,!0);return;case"textarea":Ce("invalid",e),u=c=l=null;for(p in i)if(i.hasOwnProperty(p)&&(b=i[p],b!=null))switch(p){case"value":l=b;break;case"defaultValue":c=b;break;case"children":u=b;break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(a(91));break;default:Je(e,t,p,b,i,null)}wh(e,l,c,u);return;case"option":for(j in i)if(i.hasOwnProperty(j)&&(l=i[j],l!=null))switch(j){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:Je(e,t,j,l,i,null)}return;case"dialog":Ce("beforetoggle",e),Ce("toggle",e),Ce("cancel",e),Ce("close",e);break;case"iframe":case"object":Ce("load",e);break;case"video":case"audio":for(l=0;l<pa.length;l++)Ce(pa[l],e);break;case"image":Ce("error",e),Ce("load",e);break;case"details":Ce("toggle",e);break;case"embed":case"source":case"link":Ce("error",e),Ce("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(B in i)if(i.hasOwnProperty(B)&&(l=i[B],l!=null))switch(B){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,t));default:Je(e,t,B,l,i,null)}return;default:if(nc(t)){for(Y in i)i.hasOwnProperty(Y)&&(l=i[Y],l!==void 0&&$u(e,t,Y,l,i,void 0));return}}for(b in i)i.hasOwnProperty(b)&&(l=i[b],l!=null&&Je(e,t,b,l,i,null))}function Vb(e,t,i,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,u=null,p=null,b=null,j=null,B=null,Y=null;for(P in i){var I=i[P];if(i.hasOwnProperty(P)&&I!=null)switch(P){case"checked":break;case"value":break;case"defaultValue":j=I;default:l.hasOwnProperty(P)||Je(e,t,P,null,l,I)}}for(var L in l){var P=l[L];if(I=i[L],l.hasOwnProperty(L)&&(P!=null||I!=null))switch(L){case"type":u=P;break;case"name":c=P;break;case"checked":B=P;break;case"defaultChecked":Y=P;break;case"value":p=P;break;case"defaultValue":b=P;break;case"children":case"dangerouslySetInnerHTML":if(P!=null)throw Error(a(137,t));break;default:P!==I&&Je(e,t,L,P,l,I)}}ec(e,p,b,j,B,Y,u,c);return;case"select":P=p=b=L=null;for(u in i)if(j=i[u],i.hasOwnProperty(u)&&j!=null)switch(u){case"value":break;case"multiple":P=j;default:l.hasOwnProperty(u)||Je(e,t,u,null,l,j)}for(c in l)if(u=l[c],j=i[c],l.hasOwnProperty(c)&&(u!=null||j!=null))switch(c){case"value":L=u;break;case"defaultValue":b=u;break;case"multiple":p=u;default:u!==j&&Je(e,t,c,u,l,j)}t=b,i=p,l=P,L!=null?qi(e,!!i,L,!1):!!l!=!!i&&(t!=null?qi(e,!!i,t,!0):qi(e,!!i,i?[]:"",!1));return;case"textarea":P=L=null;for(b in i)if(c=i[b],i.hasOwnProperty(b)&&c!=null&&!l.hasOwnProperty(b))switch(b){case"value":break;case"children":break;default:Je(e,t,b,null,l,c)}for(p in l)if(c=l[p],u=i[p],l.hasOwnProperty(p)&&(c!=null||u!=null))switch(p){case"value":L=c;break;case"defaultValue":P=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(a(91));break;default:c!==u&&Je(e,t,p,c,l,u)}_h(e,L,P);return;case"option":for(var he in i)if(L=i[he],i.hasOwnProperty(he)&&L!=null&&!l.hasOwnProperty(he))switch(he){case"selected":e.selected=!1;break;default:Je(e,t,he,null,l,L)}for(j in l)if(L=l[j],P=i[j],l.hasOwnProperty(j)&&L!==P&&(L!=null||P!=null))switch(j){case"selected":e.selected=L&&typeof L!="function"&&typeof L!="symbol";break;default:Je(e,t,j,L,l,P)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ye in i)L=i[ye],i.hasOwnProperty(ye)&&L!=null&&!l.hasOwnProperty(ye)&&Je(e,t,ye,null,l,L);for(B in l)if(L=l[B],P=i[B],l.hasOwnProperty(B)&&L!==P&&(L!=null||P!=null))switch(B){case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(a(137,t));break;default:Je(e,t,B,L,l,P)}return;default:if(nc(t)){for(var Qe in i)L=i[Qe],i.hasOwnProperty(Qe)&&L!==void 0&&!l.hasOwnProperty(Qe)&&$u(e,t,Qe,void 0,l,L);for(Y in l)L=l[Y],P=i[Y],!l.hasOwnProperty(Y)||L===P||L===void 0&&P===void 0||$u(e,t,Y,L,l,P);return}}for(var R in i)L=i[R],i.hasOwnProperty(R)&&L!=null&&!l.hasOwnProperty(R)&&Je(e,t,R,null,l,L);for(I in l)L=l[I],P=i[I],!l.hasOwnProperty(I)||L===P||L==null&&P==null||Je(e,t,I,L,l,P)}function Ap(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Fb(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,i=performance.getEntriesByType("resource"),l=0;l<i.length;l++){var c=i[l],u=c.transferSize,p=c.initiatorType,b=c.duration;if(u&&b&&Ap(p)){for(p=0,b=c.responseEnd,l+=1;l<i.length;l++){var j=i[l],B=j.startTime;if(B>b)break;var Y=j.transferSize,I=j.initiatorType;Y&&Ap(I)&&(j=j.responseEnd,p+=Y*(j<b?1:(b-B)/(j-B)))}if(--l,t+=8*(u+p)/(c.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Yu=null,Gu=null;function Wl(e){return e.nodeType===9?e:e.ownerDocument}function jp(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 Op(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 Vu(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 Fu=null;function Jb(){var e=window.event;return e&&e.type==="popstate"?e===Fu?!1:(Fu=e,!0):(Fu=null,!1)}var Tp=typeof setTimeout=="function"?setTimeout:void 0,Qb=typeof clearTimeout=="function"?clearTimeout:void 0,Np=typeof Promise=="function"?Promise:void 0,Ib=typeof queueMicrotask=="function"?queueMicrotask:typeof Np<"u"?function(e){return Np.resolve(null).then(e).catch(Xb)}:Tp;function Xb(e){setTimeout(function(){throw e})}function Bs(e){return e==="head"}function Cp(e,t){var i=t,l=0;do{var c=i.nextSibling;if(e.removeChild(i),c&&c.nodeType===8)if(i=c.data,i==="/$"||i==="/&"){if(l===0){e.removeChild(c),mr(t);return}l--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")l++;else if(i==="html")ya(e.ownerDocument.documentElement);else if(i==="head"){i=e.ownerDocument.head,ya(i);for(var u=i.firstChild;u;){var p=u.nextSibling,b=u.nodeName;u[yt]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&u.rel.toLowerCase()==="stylesheet"||i.removeChild(u),u=p}}else i==="body"&&ya(e.ownerDocument.body);i=c}while(i);mr(t)}function kp(e,t){var i=e;e=0;do{var l=i.nextSibling;if(i.nodeType===1?t?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(t?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),l&&l.nodeType===8)if(i=l.data,i==="/$"){if(e===0)break;e--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||e++;i=l}while(i)}function Ju(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var i=t;switch(t=t.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":Ju(i),zi(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}e.removeChild(i)}}function Kb(e,t,i,l){for(;e.nodeType===1;){var c=i;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[yt])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(u=e.getAttribute("rel"),u==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(u!==c.rel||e.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||e.getAttribute("title")!==(c.title==null?null:c.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(u=e.getAttribute("src"),(u!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&u&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var u=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===u)return e}else return e;if(e=gn(e.nextSibling),e===null)break}return null}function Zb(e,t,i){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=gn(e.nextSibling),e===null))return null;return e}function Mp(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=gn(e.nextSibling),e===null))return null;return e}function Qu(e){return e.data==="$?"||e.data==="$~"}function Iu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Wb(e,t){var i=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||i.readyState!=="loading")t();else{var l=function(){t(),i.removeEventListener("DOMContentLoaded",l)};i.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function gn(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 Xu=null;function Rp(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"||i==="/&"){if(t===0)return gn(e.nextSibling);t--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||t++}e=e.nextSibling}return null}function Dp(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(t===0)return e;t--}else i!=="/$"&&i!=="/&"||t++}e=e.previousSibling}return null}function zp(e,t,i){switch(t=Wl(i),e){case"html":if(e=t.documentElement,!e)throw Error(a(452));return e;case"head":if(e=t.head,!e)throw Error(a(453));return e;case"body":if(e=t.body,!e)throw Error(a(454));return e;default:throw Error(a(451))}}function ya(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);zi(e)}var yn=new Map,qp=new Set;function eo(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var cs=te.d;te.d={f:ex,r:tx,D:nx,C:sx,L:ix,m:rx,X:lx,S:ax,M:ox};function ex(){var e=cs.f(),t=Vl();return e||t}function tx(e){var t=S(e);t!==null&&t.tag===5&&t.type==="form"?Wd(t):cs.r(e)}var fr=typeof document>"u"?null:document;function Up(e,t,i){var l=fr;if(l&&typeof t=="string"&&t){var c=cn(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof i=="string"&&(c+='[crossorigin="'+i+'"]'),qp.has(c)||(qp.add(c),e={rel:e,crossOrigin:i,href:t},l.querySelector(c)===null&&(t=l.createElement("link"),At(t,"link",e),N(t),l.head.appendChild(t)))}}function nx(e){cs.D(e),Up("dns-prefetch",e,null)}function sx(e,t){cs.C(e,t),Up("preconnect",e,t)}function ix(e,t,i){cs.L(e,t,i);var l=fr;if(l&&e&&t){var c='link[rel="preload"][as="'+cn(t)+'"]';t==="image"&&i&&i.imageSrcSet?(c+='[imagesrcset="'+cn(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(c+='[imagesizes="'+cn(i.imageSizes)+'"]')):c+='[href="'+cn(e)+'"]';var u=c;switch(t){case"style":u=hr(e);break;case"script":u=dr(e)}yn.has(u)||(e=w({rel:"preload",href:t==="image"&&i&&i.imageSrcSet?void 0:e,as:t},i),yn.set(u,e),l.querySelector(c)!==null||t==="style"&&l.querySelector(ba(u))||t==="script"&&l.querySelector(xa(u))||(t=l.createElement("link"),At(t,"link",e),N(t),l.head.appendChild(t)))}}function rx(e,t){cs.m(e,t);var i=fr;if(i&&e){var l=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+cn(l)+'"][href="'+cn(e)+'"]',u=c;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=dr(e)}if(!yn.has(u)&&(e=w({rel:"modulepreload",href:e},t),yn.set(u,e),i.querySelector(c)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(xa(u)))return}l=i.createElement("link"),At(l,"link",e),N(l),i.head.appendChild(l)}}}function ax(e,t,i){cs.S(e,t,i);var l=fr;if(l&&e){var c=A(l).hoistableStyles,u=hr(e);t=t||"default";var p=c.get(u);if(!p){var b={loading:0,preload:null};if(p=l.querySelector(ba(u)))b.loading=5;else{e=w({rel:"stylesheet",href:e,"data-precedence":t},i),(i=yn.get(u))&&Ku(e,i);var j=p=l.createElement("link");N(j),At(j,"link",e),j._p=new Promise(function(B,Y){j.onload=B,j.onerror=Y}),j.addEventListener("load",function(){b.loading|=1}),j.addEventListener("error",function(){b.loading|=2}),b.loading|=4,to(p,t,l)}p={type:"stylesheet",instance:p,count:1,state:b},c.set(u,p)}}}function lx(e,t){cs.X(e,t);var i=fr;if(i&&e){var l=A(i).hoistableScripts,c=dr(e),u=l.get(c);u||(u=i.querySelector(xa(c)),u||(e=w({src:e,async:!0},t),(t=yn.get(c))&&Zu(e,t),u=i.createElement("script"),N(u),At(u,"link",e),i.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(c,u))}}function ox(e,t){cs.M(e,t);var i=fr;if(i&&e){var l=A(i).hoistableScripts,c=dr(e),u=l.get(c);u||(u=i.querySelector(xa(c)),u||(e=w({src:e,async:!0,type:"module"},t),(t=yn.get(c))&&Zu(e,t),u=i.createElement("script"),N(u),At(u,"link",e),i.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(c,u))}}function Bp(e,t,i,l){var c=(c=an.current)?eo(c):null;if(!c)throw Error(a(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(t=hr(i.href),i=A(c).hoistableStyles,l=i.get(t),l||(l={type:"style",instance:null,count:0,state:null},i.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){e=hr(i.href);var u=A(c).hoistableStyles,p=u.get(e);if(p||(c=c.ownerDocument||c,p={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,p),(u=c.querySelector(ba(e)))&&!u._p&&(p.instance=u,p.state.loading=5),yn.has(e)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},yn.set(e,i),u||cx(c,e,i,p.state))),t&&l===null)throw Error(a(528,""));return p}if(t&&l!==null)throw Error(a(529,""));return null;case"script":return t=i.async,i=i.src,typeof i=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=dr(i),i=A(c).hoistableScripts,l=i.get(t),l||(l={type:"script",instance:null,count:0,state:null},i.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,e))}}function hr(e){return'href="'+cn(e)+'"'}function ba(e){return'link[rel="stylesheet"]['+e+"]"}function Lp(e){return w({},e,{"data-precedence":e.precedence,precedence:null})}function cx(e,t,i,l){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=e.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),At(t,"link",i),N(t),e.head.appendChild(t))}function dr(e){return'[src="'+cn(e)+'"]'}function xa(e){return"script[async]"+e}function Hp(e,t,i){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+cn(i.href)+'"]');if(l)return t.instance=l,N(l),l;var c=w({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),N(l),At(l,"style",c),to(l,i.precedence,e),t.instance=l;case"stylesheet":c=hr(i.href);var u=e.querySelector(ba(c));if(u)return t.state.loading|=4,t.instance=u,N(u),u;l=Lp(i),(c=yn.get(c))&&Ku(l,c),u=(e.ownerDocument||e).createElement("link"),N(u);var p=u;return p._p=new Promise(function(b,j){p.onload=b,p.onerror=j}),At(u,"link",l),t.state.loading|=4,to(u,i.precedence,e),t.instance=u;case"script":return u=dr(i.src),(c=e.querySelector(xa(u)))?(t.instance=c,N(c),c):(l=i,(c=yn.get(u))&&(l=w({},i),Zu(l,c)),e=e.ownerDocument||e,c=e.createElement("script"),N(c),At(c,"link",l),e.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(a(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,to(l,i.precedence,e));return t.instance}function to(e,t,i){for(var l=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=l.length?l[l.length-1]:null,u=c,p=0;p<l.length;p++){var b=l[p];if(b.dataset.precedence===t)u=b;else if(u!==c)break}u?u.parentNode.insertBefore(e,u.nextSibling):(t=i.nodeType===9?i.head:i,t.insertBefore(e,t.firstChild))}function Ku(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Zu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var no=null;function Pp(e,t,i){if(no===null){var l=new Map,c=no=new Map;c.set(i,l)}else c=no,l=c.get(i),l||(l=new Map,c.set(i,l));if(l.has(e))return l;for(l.set(e,null),i=i.getElementsByTagName(e),c=0;c<i.length;c++){var u=i[c];if(!(u[yt]||u[Ie]||e==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var p=u.getAttribute(t)||"";p=e+p;var b=l.get(p);b?b.push(u):l.set(p,[u])}}return l}function $p(e,t,i){e=e.ownerDocument||e,e.head.insertBefore(i,t==="title"?e.querySelector("head > title"):null)}function ux(e,t,i){if(i===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Yp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function fx(e,t,i,l){if(i.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var c=hr(l.href),u=t.querySelector(ba(c));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=so.bind(e),t.then(e,e)),i.state.loading|=4,i.instance=u,N(u);return}u=t.ownerDocument||t,l=Lp(l),(c=yn.get(c))&&Ku(l,c),u=u.createElement("link"),N(u);var p=u;p._p=new Promise(function(b,j){p.onload=b,p.onerror=j}),At(u,"link",l),i.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(i,t),(t=i.state.preload)&&(i.state.loading&3)===0&&(e.count++,i=so.bind(e),t.addEventListener("load",i),t.addEventListener("error",i))}}var Wu=0;function hx(e,t){return e.stylesheets&&e.count===0&&ro(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var l=setTimeout(function(){if(e.stylesheets&&ro(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&Wu===0&&(Wu=62500*Fb());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ro(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>Wu?50:800)+t);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(c)}}:null}function so(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ro(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var io=null;function ro(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,io=new Map,t.forEach(dx,e),io=null,so.call(e))}function dx(e,t){if(!(t.state.loading&4)){var i=io.get(e);if(i)var l=i.get(null);else{i=new Map,io.set(e,i);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<c.length;u++){var p=c[u];(p.nodeName==="LINK"||p.getAttribute("media")!=="not all")&&(i.set(p.dataset.precedence,p),l=p)}l&&i.set(null,l)}c=t.instance,p=c.getAttribute("data-precedence"),u=i.get(p)||l,u===l&&i.set(null,c),i.set(p,c),this.count++,l=so.bind(this),c.addEventListener("load",l),c.addEventListener("error",l),u?u.parentNode.insertBefore(c,u.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(c,e.firstChild)),t.state.loading|=4}}var va={$$typeof:me,Provider:null,Consumer:null,_currentValue:de,_currentValue2:de,_threadCount:0};function mx(e,t,i,l,c,u,p,b,j){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ys(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ys(0),this.hiddenUpdates=ys(null),this.identifierPrefix=l,this.onUncaughtError=c,this.onCaughtError=u,this.onRecoverableError=p,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=j,this.incompleteTransitions=new Map}function Gp(e,t,i,l,c,u,p,b,j,B,Y,I){return e=new mx(e,t,i,p,j,B,Y,I,b),t=1,u===!0&&(t|=24),u=Vt(3,null,null,t),e.current=u,u.stateNode=e,t=Mc(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:l,isDehydrated:i,cache:t},qc(u),e}function Vp(e){return e?(e=Gi,e):Gi}function Fp(e,t,i,l,c,u){c=Vp(c),l.context===null?l.context=c:l.pendingContext=c,l=Os(t),l.payload={element:i},u=u===void 0?null:u,u!==null&&(l.callback=u),i=Ts(e,l,t),i!==null&&(Ht(i,e,t),Zr(i,e,t))}function Jp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<t?i:t}}function ef(e,t){Jp(e,t),(e=e.alternate)&&Jp(e,t)}function Qp(e){if(e.tag===13||e.tag===31){var t=fi(e,67108864);t!==null&&Ht(t,e,67108864),ef(e,67108864)}}function Ip(e){if(e.tag===13||e.tag===31){var t=Xt();t=Vn(t);var i=fi(e,t);i!==null&&Ht(i,e,t),ef(e,t)}}var ao=!0;function px(e,t,i,l){var c=$.T;$.T=null;var u=te.p;try{te.p=2,tf(e,t,i,l)}finally{te.p=u,$.T=c}}function gx(e,t,i,l){var c=$.T;$.T=null;var u=te.p;try{te.p=8,tf(e,t,i,l)}finally{te.p=u,$.T=c}}function tf(e,t,i,l){if(ao){var c=nf(l);if(c===null)Pu(e,t,l,lo,i),Kp(e,l);else if(bx(c,e,t,i,l))l.stopPropagation();else if(Kp(e,l),t&4&&-1<yx.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=wn(u.pendingLanes);if(p!==0){var b=u;for(b.pendingLanes|=2,b.entangledLanes|=2;p;){var j=1<<31-Nt(p);b.entanglements[1]|=j,p&=~j}Un(u),(Pe&6)===0&&(Yl=et()+500,ma(0))}}break;case 31:case 13:b=fi(u,2),b!==null&&Ht(b,u,2),Vl(),ef(u,2)}if(u=nf(l),u===null&&Pu(e,t,l,lo,i),u===c)break;c=u}c!==null&&l.stopPropagation()}else Pu(e,t,l,null,i)}}function nf(e){return e=ic(e),sf(e)}var lo=null;function sf(e){if(lo=null,e=x(e),e!==null){var t=f(e);if(t===null)e=null;else{var i=t.tag;if(i===13){if(e=h(t),e!==null)return e;e=null}else if(i===31){if(e=m(t),e!==null)return e;e=null}else if(i===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return lo=e,null}function Xp(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(Xo()){case Xa:return 2;case Ka:return 8;case Mi:case Ko:return 32;case Za:return 268435456;default:return 32}default:return 32}}var rf=!1,Ls=null,Hs=null,Ps=null,_a=new Map,wa=new Map,$s=[],yx="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 Kp(e,t){switch(e){case"focusin":case"focusout":Ls=null;break;case"dragenter":case"dragleave":Hs=null;break;case"mouseover":case"mouseout":Ps=null;break;case"pointerover":case"pointerout":_a.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":wa.delete(t.pointerId)}}function Sa(e,t,i,l,c,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:i,eventSystemFlags:l,nativeEvent:u,targetContainers:[c]},t!==null&&(t=S(t),t!==null&&Qp(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function bx(e,t,i,l,c){switch(t){case"focusin":return Ls=Sa(Ls,e,t,i,l,c),!0;case"dragenter":return Hs=Sa(Hs,e,t,i,l,c),!0;case"mouseover":return Ps=Sa(Ps,e,t,i,l,c),!0;case"pointerover":var u=c.pointerId;return _a.set(u,Sa(_a.get(u)||null,e,t,i,l,c)),!0;case"gotpointercapture":return u=c.pointerId,wa.set(u,Sa(wa.get(u)||null,e,t,i,l,c)),!0}return!1}function Zp(e){var t=x(e.target);if(t!==null){var i=f(t);if(i!==null){if(t=i.tag,t===13){if(t=h(i),t!==null){e.blockedOn=t,el(e.priority,function(){Ip(i)});return}}else if(t===31){if(t=m(i),t!==null){e.blockedOn=t,el(e.priority,function(){Ip(i)});return}}else if(t===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function oo(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var i=nf(e.nativeEvent);if(i===null){i=e.nativeEvent;var l=new i.constructor(i.type,i);sc=l,i.target.dispatchEvent(l),sc=null}else return t=S(i),t!==null&&Qp(t),e.blockedOn=i,!1;t.shift()}return!0}function Wp(e,t,i){oo(e)&&i.delete(t)}function xx(){rf=!1,Ls!==null&&oo(Ls)&&(Ls=null),Hs!==null&&oo(Hs)&&(Hs=null),Ps!==null&&oo(Ps)&&(Ps=null),_a.forEach(Wp),wa.forEach(Wp)}function co(e,t){e.blockedOn===t&&(e.blockedOn=null,rf||(rf=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,xx)))}var uo=null;function e0(e){uo!==e&&(uo=e,r.unstable_scheduleCallback(r.unstable_NormalPriority,function(){uo===e&&(uo=null);for(var t=0;t<e.length;t+=3){var i=e[t],l=e[t+1],c=e[t+2];if(typeof l!="function"){if(sf(l||i)===null)continue;break}var u=S(i);u!==null&&(e.splice(t,3),t-=3,nu(u,{pending:!0,data:c,method:i.method,action:l},l,c))}}))}function mr(e){function t(j){return co(j,e)}Ls!==null&&co(Ls,e),Hs!==null&&co(Hs,e),Ps!==null&&co(Ps,e),_a.forEach(t),wa.forEach(t);for(var i=0;i<$s.length;i++){var l=$s[i];l.blockedOn===e&&(l.blockedOn=null)}for(;0<$s.length&&(i=$s[0],i.blockedOn===null);)Zp(i),i.blockedOn===null&&$s.shift();if(i=(e.ownerDocument||e).$$reactFormReplay,i!=null)for(l=0;l<i.length;l+=3){var c=i[l],u=i[l+1],p=c[it]||null;if(typeof u=="function")p||e0(i);else if(p){var b=null;if(u&&u.hasAttribute("formAction")){if(c=u,p=u[it]||null)b=p.formAction;else if(sf(c)!==null)continue}else b=p.action;typeof b=="function"?i[l+1]=b:(i.splice(l,3),l-=3),e0(i)}}}function t0(){function e(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(p){return c=p})},focusReset:"manual",scroll:"manual"})}function t(){c!==null&&(c(),c=null),l||setTimeout(i,20)}function i(){if(!l&&!navigation.transition){var u=navigation.currentEntry;u&&u.url!=null&&navigation.navigate(u.url,{state:u.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,c=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(i,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),c!==null&&(c(),c=null)}}}function af(e){this._internalRoot=e}fo.prototype.render=af.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(a(409));var i=t.current,l=Xt();Fp(i,l,e,t,null,null)},fo.prototype.unmount=af.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Fp(e.current,2,null,e,null,null),Vl(),t[Yt]=null}};function fo(e){this._internalRoot=e}fo.prototype.unstable_scheduleHydration=function(e){if(e){var t=zr();e={blockedOn:null,target:e,priority:t};for(var i=0;i<$s.length&&t!==0&&t<$s[i].priority;i++);$s.splice(i,0,e),i===0&&Zp(e)}};var n0=n.version;if(n0!=="19.2.4")throw Error(a(527,n0,"19.2.4"));te.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(a(188)):(e=Object.keys(e).join(","),Error(a(268,e)));return e=y(t),e=e!==null?E(e):null,e=e===null?null:e.stateNode,e};var vx={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:$,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ho=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ho.isDisabled&&ho.supportsFiber)try{ni=ho.inject(vx),ot=ho}catch{}}return Ea.createRoot=function(e,t){if(!o(e))throw Error(a(299));var i=!1,l="",c=cm,u=um,p=fm;return t!=null&&(t.unstable_strictMode===!0&&(i=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(c=t.onUncaughtError),t.onCaughtError!==void 0&&(u=t.onCaughtError),t.onRecoverableError!==void 0&&(p=t.onRecoverableError)),t=Gp(e,1,!1,null,null,i,l,null,c,u,p,t0),e[Yt]=t.current,Hu(e),new af(t)},Ea.hydrateRoot=function(e,t,i){if(!o(e))throw Error(a(299));var l=!1,c="",u=cm,p=um,b=fm,j=null;return i!=null&&(i.unstable_strictMode===!0&&(l=!0),i.identifierPrefix!==void 0&&(c=i.identifierPrefix),i.onUncaughtError!==void 0&&(u=i.onUncaughtError),i.onCaughtError!==void 0&&(p=i.onCaughtError),i.onRecoverableError!==void 0&&(b=i.onRecoverableError),i.formState!==void 0&&(j=i.formState)),t=Gp(e,1,!0,t,i??null,l,c,j,u,p,b,t0),t.context=Vp(null),i=t.current,l=Xt(),l=Vn(l),c=Os(l),c.callback=null,Ts(i,c,l),i=l,t.current.lanes=i,Sn(t,i),Un(t),e[Yt]=t.current,Hu(e),new fo(t)},Ea.version="19.2.4",Ea}var c0;function iv(){if(c0)return lf.exports;c0=1;function r(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(n){console.error(n)}}return r(),lf.exports=sv(),lf.exports}var rv=iv();const av="modulepreload",lv=function(r,n){return new URL(r,n).href},u0={},_e=function(n,s,a){let o=Promise.resolve();if(s&&s.length>0){let h=function(E){return Promise.all(E.map(w=>Promise.resolve(w).then(O=>({status:"fulfilled",value:O}),O=>({status:"rejected",reason:O}))))};const 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=h(s.map(E=>{if(E=lv(E,a),E in u0)return;u0[E]=!0;const w=E.endsWith(".css"),O=w?'[rel="stylesheet"]':"";if(!!a)for(let D=m.length-1;D>=0;D--){const W=m[D];if(W.href===E&&(!w||W.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${E}"]${O}`))return;const M=document.createElement("link");if(M.rel=w?"stylesheet":av,w||(M.as="script"),M.crossOrigin="",M.href=E,y&&M.setAttribute("nonce",y),document.head.appendChild(M),w)return new Promise((D,W)=>{M.addEventListener("load",D),M.addEventListener("error",()=>W(new Error(`Unable to preload CSS for ${E}`)))})}))}function f(h){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=h,window.dispatchEvent(m),!m.defaultPrevented)throw h}return o.then(h=>{for(const m of h||[])m.status==="rejected"&&f(m.reason);return n().catch(f)})};function Zf(r){try{const n=r.split(".");if(n.length!==3)return null;const s=atob(n[1].replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(s)}catch{return null}}function gg(r){const n=Zf(r);return!n||typeof n.exp!="number"?null:n.exp}function Wf(r,n=0){const s=gg(r);return s===null?!0:Date.now()/1e3>=s-n}const Wt=window.__LT_BASE__??"",jf=`${Wt}/api`;let Fs=null;function mo(r){Fs=r}function yg(){return Fs}async function f0(){const r=sessionStorage.getItem("lt_credentials");if(!r)return null;try{const{username:n,password:s}=JSON.parse(r),a=await fetch(`${jf}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:n,password:s})});if(!a.ok)return null;const o=await a.json();return o.token&&o.user&&sessionStorage.setItem("lt_user_info",JSON.stringify({displayName:o.user.display_name,username:o.user.external_id})),o.token??null}catch{return null}}let Gs=null;async function $e(r,n={}){const s={"Content-Type":"application/json",...n.headers};if(Fs){if(Wf(Fs)){Gs||(Gs=f0().finally(()=>{Gs=null}));const o=await Gs;if(o)Fs=o,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:o}}));else throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}s.Authorization=`Bearer ${Fs}`}let a=await fetch(`${jf}${r}`,{...n,headers:s});if(a.status===401&&Fs){Gs||(Gs=f0().finally(()=>{Gs=null}));const o=await Gs;if(o&&(Fs=o,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:o}})),s.Authorization=`Bearer ${o}`,a=await fetch(`${jf}${r}`,{...n,headers:s})),a.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}else if(a.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired");if(!a.ok){const o=await a.json().catch(()=>({error:a.statusText}));throw new Error(o.message||o.error||a.statusText)}return a.json()}const bg=T.createContext(null),ov=300;function uf(r,n){if(Wf(r))return null;const s=Zf(r);if(!s)return null;const a=n??(()=>{try{const o=sessionStorage.getItem("lt_user_info");return o?JSON.parse(o):null}catch{return null}})();return{userId:s.userId,displayName:(a==null?void 0:a.displayName)??null,username:(a==null?void 0:a.username)??null,roles:s.roles??[]}}function cv({children:r}){const[n,s]=T.useState(()=>{const w=sessionStorage.getItem("lt_token");return w?Wf(w)?(sessionStorage.removeItem("lt_token"),null):(mo(w),uf(w)):null}),a=T.useRef(void 0),o=T.useCallback(w=>{clearTimeout(a.current);const O=gg(w);if(!O)return;const q=(O-ov)*1e3-Date.now();q<=0||(a.current=setTimeout(async()=>{try{const M=Zf(w);if(M!=null&&M.sso){const re=await fetch(`${Wt}/api/auth/sso`,{method:"POST"});if(!re.ok)return;const C=await re.json();C.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:C.token}}));return}const D=sessionStorage.getItem("lt_credentials");if(!D)return;const{username:W,password:se}=JSON.parse(D),ee=await fetch(`${Wt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:W,password:se})});if(!ee.ok)return;const me=await ee.json();me.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:me.token}}))}catch{}},q))},[]),f=T.useCallback((w,O,q)=>{const M={displayName:(q==null?void 0:q.displayName)??null,username:(q==null?void 0:q.username)??(O==null?void 0:O.username)??null},D=uf(w,M);D&&(mo(w),sessionStorage.setItem("lt_token",w),sessionStorage.setItem("lt_user_info",JSON.stringify(M)),O&&sessionStorage.setItem("lt_credentials",JSON.stringify(O)),s(D),o(w))},[o]),h=T.useCallback(()=>{clearTimeout(a.current);const w=sessionStorage.getItem("lt_sso_logout_url");mo(null),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info"),sessionStorage.removeItem("lt_sso_logout_url"),s(null),w&&(window.location.href=w)},[]);T.useEffect(()=>{const w=()=>h(),O=q=>{var W;const M=(W=q.detail)==null?void 0:W.token;if(!M)return;const D=uf(M);D&&(mo(M),sessionStorage.setItem("lt_token",M),s(D),o(M))};return window.addEventListener("auth:unauthorized",w),window.addEventListener("auth:refreshed",O),()=>{window.removeEventListener("auth:unauthorized",w),window.removeEventListener("auth:refreshed",O)}},[h,o]),T.useEffect(()=>{const w=sessionStorage.getItem("lt_token");return w&&n&&o(w),()=>clearTimeout(a.current)},[]);const m=(n==null?void 0:n.roles.some(w=>w.type==="superadmin"))??!1,g=T.useCallback(w=>(n==null?void 0:n.roles.some(O=>O.role===w))??!1,[n]),y=T.useCallback(w=>(n==null?void 0:n.roles.some(O=>O.type===w))??!1,[n]),E=(n==null?void 0:n.roles.map(w=>w.role))??[];return d.jsx(bg.Provider,{value:{user:n,isAuthenticated:!!n,isSuperAdmin:m,login:f,logout:h,hasRole:g,hasRoleType:y,userRoleNames:E},children:r})}function Oi(){const r=T.useContext(bg);if(!r)throw new Error("useAuth must be used within AuthProvider");return r}const nn=new Uint8Array(0),Ti=new TextEncoder,en=new TextDecoder;function uv(...r){let n=0;for(let o=0;o<r.length;o++)n+=r[o].length;const s=new Uint8Array(n);let a=0;for(let o=0;o<r.length;o++)s.set(r[o],a),a+=r[o].length;return s}function Ra(...r){const n=[];for(let s=0;s<r.length;s++)n.push(Ti.encode(r[s]));return n.length===0?nn:n.length===1?n[0]:uv(...n)}function h0(r){return!r||r.length===0?"":en.decode(r)}const d0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",m0=36,fv=0xcfd41b9100000,p0=33,hv=333,g0=22;function dv(r){for(let n=0;n<r.length;n++)r[n]=Math.floor(Math.random()*255)}function mv(r){var n;(n=globalThis==null?void 0:globalThis.crypto)!=null&&n.getRandomValues?globalThis.crypto.getRandomValues(r):dv(r)}class pv{constructor(){v(this,"buf");v(this,"seq");v(this,"inc");v(this,"inited");this.buf=new Uint8Array(g0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*fv),this.inc=Math.floor(Math.random()*(hv-p0)+p0)}setPre(){const n=new Uint8Array(12);mv(n);for(let s=0;s<12;s++){const a=n[s]%36;this.buf[s]=d0.charCodeAt(a)}}fillSeq(){let n=this.seq;for(let s=g0-1;s>=12;s--)this.buf[s]=d0.charCodeAt(n%m0),n=Math.floor(n/m0)}next(){return this.inited||this.init(),this.seq+=this.inc,this.seq>0xcfd41b9100000&&(this.setPre(),this.initSeqAndInc()),this.fillSeq(),String.fromCharCode.apply(String,this.buf)}reset(){this.init()}}const Ks=new pv;var us;(function(r){r.Disconnect="disconnect",r.Reconnect="reconnect",r.Update="update",r.LDM="ldm",r.Error="error"})(us||(us={}));var vr;(function(r){r.Reconnecting="reconnecting",r.PingTimer="pingTimer",r.StaleConnection="staleConnection",r.ClientInitiatedReconnect="client initiated reconnect"})(vr||(vr={}));var ie;(function(r){r.ApiError="BAD API",r.BadAuthentication="BAD_AUTHENTICATION",r.BadCreds="BAD_CREDS",r.BadHeader="BAD_HEADER",r.BadJson="BAD_JSON",r.BadPayload="BAD_PAYLOAD",r.BadSubject="BAD_SUBJECT",r.Cancelled="CANCELLED",r.ConnectionClosed="CONNECTION_CLOSED",r.ConnectionDraining="CONNECTION_DRAINING",r.ConnectionRefused="CONNECTION_REFUSED",r.ConnectionTimeout="CONNECTION_TIMEOUT",r.Disconnect="DISCONNECT",r.InvalidOption="INVALID_OPTION",r.InvalidPayload="INVALID_PAYLOAD",r.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",r.NoResponders="503",r.NotFunction="NOT_FUNC",r.RequestError="REQUEST_ERROR",r.ServerOptionNotAvailable="SERVER_OPT_NA",r.SubClosed="SUB_CLOSED",r.SubDraining="SUB_DRAINING",r.Timeout="TIMEOUT",r.Tls="TLS",r.Unknown="UNKNOWN_ERROR",r.WssRequired="WSS_REQUIRED",r.JetStreamInvalidAck="JESTREAM_INVALID_ACK",r.JetStream404NoMessages="404",r.JetStream408RequestTimeout="408",r.JetStream409MaxAckPendingExceeded="409",r.JetStream409="409",r.JetStreamNotEnabled="503",r.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",r.AuthorizationViolation="AUTHORIZATION_VIOLATION",r.AuthenticationExpired="AUTHENTICATION_EXPIRED",r.ProtocolError="NATS_PROTOCOL_ERR",r.PermissionsViolation="PERMISSIONS_VIOLATION",r.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",r.AccountExpired="ACCOUNT_EXPIRED"})(ie||(ie={}));function gv(r){return typeof r.code=="string"}class xg{constructor(){v(this,"messages");this.messages=new Map,this.messages.set(ie.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(ie.BadJson,"Bad JSON"),this.messages.set(ie.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(n){return yv.getMessage(n)}getMessage(n){return this.messages.get(n)||n}}const yv=new xg;class ue extends Error{constructor(s,a,o){super(s);v(this,"name");v(this,"message");v(this,"code");v(this,"permissionContext");v(this,"chainedError");v(this,"api_error");this.name="NatsError",this.message=s,this.code=a,this.chainedError=o}static errorForCode(s,a){const o=xg.getMessage(s);return new ue(o,s,a)}isAuthError(){return this.code===ie.AuthenticationExpired||this.code===ie.AuthorizationViolation||this.code===ie.AccountExpired}isAuthTimeout(){return this.code===ie.AuthenticationTimeout}isPermissionError(){return this.code===ie.PermissionsViolation}isProtocolError(){return this.code===ie.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var Kt;(function(r){r[r.Exact=0]="Exact",r[r.CanonicalMIME=1]="CanonicalMIME",r[r.IgnoreCase=2]="IgnoreCase"})(Kt||(Kt={}));var Cn;(function(r){r.Timer="timer",r.Count="count",r.JitterTimer="jitterTimer",r.SentinelMsg="sentinelMsg"})(Cn||(Cn={}));var Da;(function(r){r.STATS="io.nats.micro.v1.stats_response",r.INFO="io.nats.micro.v1.info_response",r.PING="io.nats.micro.v1.ping_response"})(Da||(Da={}));const ko="Nats-Service-Error",Mo="Nats-Service-Error-Code";class Ro extends Error{constructor(s,a){super(a);v(this,"code");this.code=s}static isServiceError(s){return Ro.toServiceError(s)!==null}static toServiceError(s){var o,f;const a=((o=s==null?void 0:s.headers)==null?void 0:o.get(Mo))||"";if(a!==""){const h=parseInt(a)||400,m=((f=s==null?void 0:s.headers)==null?void 0:f.get(ko))||"";return new Ro(h,m.length?m:a)}return null}}function fs(r=""){if(r=r||"_INBOX",typeof r!="string")throw new Error("prefix must be a string");return r.split(".").forEach(n=>{if(n==="*"||n===">")throw new Error(`inbox prefixes cannot have wildcards '${r}'`)}),`${r}.${Ks.next()}`}const Of="127.0.0.1";var Js;(function(r){r.PING="PING",r.STATS="STATS",r.INFO="INFO"})(Js||(Js={}));function Yo(r,...n){for(let s=0;s<n.length;s++){const a=n[s];Object.keys(a).forEach(function(o){r[o]=a[o]})}return r}function po(r){return en.decode(r).replace(/\n/g,"␊").replace(/\r/g,"␍")}function Ar(r,n=!0){const s=n?ue.errorForCode(ie.Timeout):null;let a,o;const f=new Promise((h,m)=>{a={cancel:()=>{o&&clearTimeout(o)}},o=setTimeout(()=>{m(s===null?ue.errorForCode(ie.Timeout):s)},r)});return Object.assign(f,a)}function Tr(r=0){let n;const s=new Promise(a=>{const o=setTimeout(()=>{a()},r);n={cancel:()=>{o&&clearTimeout(o)}}});return Object.assign(s,n)}function st(){let r={};const n=new Promise((s,a)=>{r={resolve:s,reject:a}});return Object.assign(n,r)}function vg(r){for(let n=r.length-1;n>0;n--){const s=Math.floor(Math.random()*(n+1));[r[n],r[s]]=[r[s],r[n]]}return r}function bv(r){return r===0?0:Math.floor(r/2+Math.random()*r)}function eh(r=[0,250,250,500,500,3e3,5e3]){Array.isArray(r)||(r=[0,250,250,500,500,3e3,5e3]);const n=r.length-1;return{backoff(s){return bv(s>n?r[n]:r[s])}}}function nt(r){return r*1e6}function th(r){return Math.floor(r/1e6)}function y0(r){let a=!0;const o=new Array(r.length);for(let f=0;f<r.length;f++){let h=r.charCodeAt(f);if(h===58||h<33||h>126)throw new ue(`'${r[f]}' is not a valid character for a header key`,ie.BadHeader);a&&97<=h&&h<=122?h-=32:!a&&65<=h&&h<=90&&(h+=32),o[f]=h,a=h==45}return String.fromCharCode(...o)}function hs(r=0,n=""){if(r===0&&n!==""||r>0&&n==="")throw new Error("setting status requires both code and description");return new Qs(r,n)}const ff="NATS/1.0";class Qs{constructor(n=0,s=""){v(this,"_code");v(this,"headers");v(this,"_description");this._code=n,this._description=s,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(n){if(n&&this.headers.size===n.headers.size&&this._code===n._code){for(const[s,a]of this.headers){const o=n.values(s);if(a.length!==o.length)return!1;const f=[...a].sort(),h=[...o].sort();for(let m=0;m<f.length;m++)if(f[m]!==h[m])return!1}return!0}return!1}static decode(n){const s=new Qs,o=en.decode(n).split(`\r
|
|
25
|
+
`+l.stack}}var Cr=Object.prototype.hasOwnProperty,kr=r.unstable_scheduleCallback,Yn=r.unstable_cancelCallback,Xa=r.unstable_shouldYield,ki=r.unstable_requestPaint,et=r.unstable_now,Xo=r.unstable_getCurrentPriorityLevel,Ka=r.unstable_ImmediatePriority,Za=r.unstable_UserBlockingPriority,Mi=r.unstable_NormalPriority,Ko=r.unstable_LowPriority,Wa=r.unstable_IdlePriority,Zo=r.log,el=r.unstable_setDisableYieldValue,si=null,ot=null;function $t(e){if(typeof Zo=="function"&&el(e),ot&&typeof ot.setStrictMode=="function")try{ot.setStrictMode(si,e)}catch{}}var Nt=Math.clz32?Math.clz32:Ri,Mr=Math.log,Rr=Math.LN2;function Ri(e){return e>>>=0,e===0?32:31-(Mr(e)/Rr|0)|0}var ps=256,Gn=262144,gs=4194304;function Sn(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 ii(e,t,i){var l=e.pendingLanes;if(l===0)return 0;var c=0,u=e.suspendedLanes,p=e.pingedLanes;e=e.warmLanes;var b=l&134217727;return b!==0?(l=b&~u,l!==0?c=Sn(l):(p&=b,p!==0?c=Sn(p):i||(i=b&~e,i!==0&&(c=Sn(i))))):(b=l&~u,b!==0?c=Sn(b):p!==0?c=Sn(p):i||(i=l&~e,i!==0&&(c=Sn(i)))),c===0?0:t!==0&&t!==c&&(t&u)===0&&(u=c&-c,i=t&-t,u>=i||u===32&&(i&4194048)!==0)?t:c}function ri(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Dr(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 Di(){var e=gs;return gs<<=1,(gs&62914560)===0&&(gs=4194304),e}function ys(e){for(var t=[],i=0;31>i;i++)t.push(e);return t}function En(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function bs(e,t,i,l,c,u){var p=e.pendingLanes;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=i,e.entangledLanes&=i,e.errorRecoveryDisabledLanes&=i,e.shellSuspendCounter=0;var b=e.entanglements,j=e.expirationTimes,B=e.hiddenUpdates;for(i=p&~i;0<i;){var Y=31-Nt(i),Q=1<<Y;b[Y]=0,j[Y]=-1;var L=B[Y];if(L!==null)for(B[Y]=null,Y=0;Y<L.length;Y++){var P=L[Y];P!==null&&(P.lane&=-536870913)}i&=~Q}l!==0&&xs(e,l,0),u!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=u&~(p&~t))}function xs(e,t,i){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-Nt(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|i&261930}function ai(e,t){var i=e.entangledLanes|=t;for(e=e.entanglements;i;){var l=31-Nt(i),c=1<<l;c&t|e[l]&t&&(e[l]|=t),i&=~c}}function vs(e,t){var i=t&-t;return i=(i&42)!==0?1:Vn(i),(i&(e.suspendedLanes|t))!==0?0:i}function Vn(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 li(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function zr(){var e=te.p;return e!==0?e:(e=window.event,e===void 0?32:Xp(e.type))}function tl(e,t){var i=te.p;try{return te.p=e,t()}finally{te.p=i}}var Rn=Math.random().toString(36).slice(2),Qe="__reactFiber$"+Rn,it="__reactProps$"+Rn,Yt="__reactContainer$"+Rn,oi="__reactEvents$"+Rn,qr="__reactListeners$"+Rn,nl="__reactHandles$"+Rn,sl="__reactResources$"+Rn,yt="__reactMarker$"+Rn;function zi(e){delete e[Qe],delete e[it],delete e[oi],delete e[qr],delete e[nl]}function x(e){var t=e[Qe];if(t)return t;for(var i=e.parentNode;i;){if(t=i[Yt]||i[Qe]){if(i=t.alternate,t.child!==null||i!==null&&i.child!==null)for(e=Dp(e);e!==null;){if(i=e[Qe])return i;e=Dp(e)}return t}e=i,i=e.parentNode}return null}function S(e){if(e=e[Qe]||e[Yt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function _(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(a(33))}function A(e){var t=e[sl];return t||(t=e[sl]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function N(e){e[yt]=!0}var z=new Set,I={};function Z(e,t){H(e,t),H(e+"Capture",t)}function H(e,t){for(I[e]=t,e=0;e<t.length;e++)z.add(t[e])}var J=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),fe={},je={};function Ke(e){return Cr.call(je,e)?!0:Cr.call(fe,e)?!1:J.test(e)?je[e]=!0:(fe[e]=!0,!1)}function Ct(e,t,i){if(Ke(t))if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var l=t.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+i)}}function An(e,t,i){if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+i)}}function Fn(e,t,i,l){if(l===null)e.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(i);return}e.setAttributeNS(t,i,""+l)}}function on(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function bh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function gy(e,t,i){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var c=l.get,u=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(p){i=""+p,u.call(this,p)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return i},setValue:function(p){i=""+p},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Wo(e){if(!e._valueTracker){var t=bh(e)?"checked":"value";e._valueTracker=gy(e,t,""+e[t])}}function xh(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),l="";return e&&(l=bh(e)?e.checked?"true":"false":e.value),e=l,e!==i?(t.setValue(e),!0):!1}function il(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 yy=/[\n"\\]/g;function cn(e){return e.replace(yy,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function ec(e,t,i,l,c,u,p,b){e.name="",p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"?e.type=p:e.removeAttribute("type"),t!=null?p==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+on(t)):e.value!==""+on(t)&&(e.value=""+on(t)):p!=="submit"&&p!=="reset"||e.removeAttribute("value"),t!=null?tc(e,p,on(t)):i!=null?tc(e,p,on(i)):l!=null&&e.removeAttribute("value"),c==null&&u!=null&&(e.defaultChecked=!!u),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.name=""+on(b):e.removeAttribute("name")}function vh(e,t,i,l,c,u,p,b){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(e.type=u),t!=null||i!=null){if(!(u!=="submit"&&u!=="reset"||t!=null)){Wo(e);return}i=i!=null?""+on(i):"",t=t!=null?""+on(t):i,b||t===e.value||(e.value=t),e.defaultValue=t}l=l??c,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=b?e.checked:!!l,e.defaultChecked=!!l,p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.name=p),Wo(e)}function tc(e,t,i){t==="number"&&il(e.ownerDocument)===e||e.defaultValue===""+i||(e.defaultValue=""+i)}function qi(e,t,i,l){if(e=e.options,t){t={};for(var c=0;c<i.length;c++)t["$"+i[c]]=!0;for(i=0;i<e.length;i++)c=t.hasOwnProperty("$"+e[i].value),e[i].selected!==c&&(e[i].selected=c),c&&l&&(e[i].defaultSelected=!0)}else{for(i=""+on(i),t=null,c=0;c<e.length;c++){if(e[c].value===i){e[c].selected=!0,l&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function _h(e,t,i){if(t!=null&&(t=""+on(t),t!==e.value&&(e.value=t),i==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=i!=null?""+on(i):""}function wh(e,t,i,l){if(t==null){if(l!=null){if(i!=null)throw Error(a(92));if(Me(l)){if(1<l.length)throw Error(a(93));l=l[0]}i=l}i==null&&(i=""),t=i}i=on(t),e.defaultValue=i,l=e.textContent,l===i&&l!==""&&l!==null&&(e.value=l),Wo(e)}function Ui(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}var by=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 Sh(e,t,i){var l=t.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?l?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":l?e.setProperty(t,i):typeof i!="number"||i===0||by.has(t)?t==="float"?e.cssFloat=i:e[t]=(""+i).trim():e[t]=i+"px"}function Eh(e,t,i){if(t!=null&&typeof t!="object")throw Error(a(62));if(e=e.style,i!=null){for(var l in i)!i.hasOwnProperty(l)||t!=null&&t.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var c in t)l=t[c],t.hasOwnProperty(c)&&i[c]!==l&&Sh(e,c,l)}else for(var u in t)t.hasOwnProperty(u)&&Sh(e,u,t[u])}function nc(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 xy=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"]]),vy=/^[\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 rl(e){return vy.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Jn(){}var sc=null;function ic(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Bi=null,Li=null;function Ah(e){var t=S(e);if(t&&(e=t.stateNode)){var i=e[it]||null;e:switch(e=t.stateNode,t.type){case"input":if(ec(e,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),t=i.name,i.type==="radio"&&t!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+cn(""+t)+'"][type="radio"]'),t=0;t<i.length;t++){var l=i[t];if(l!==e&&l.form===e.form){var c=l[it]||null;if(!c)throw Error(a(90));ec(l,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(t=0;t<i.length;t++)l=i[t],l.form===e.form&&xh(l)}break e;case"textarea":_h(e,i.value,i.defaultValue);break e;case"select":t=i.value,t!=null&&qi(e,!!i.multiple,t,!1)}}}var rc=!1;function jh(e,t,i){if(rc)return e(t,i);rc=!0;try{var l=e(t);return l}finally{if(rc=!1,(Bi!==null||Li!==null)&&(Fl(),Bi&&(t=Bi,e=Li,Li=Bi=null,Ah(t),e)))for(t=0;t<e.length;t++)Ah(e[t])}}function Ur(e,t){var i=e.stateNode;if(i===null)return null;var l=i[it]||null;if(l===null)return null;i=l[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(a(231,t,typeof i));return i}var In=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ac=!1;if(In)try{var Br={};Object.defineProperty(Br,"passive",{get:function(){ac=!0}}),window.addEventListener("test",Br,Br),window.removeEventListener("test",Br,Br)}catch{ac=!1}var _s=null,lc=null,al=null;function Oh(){if(al)return al;var e,t=lc,i=t.length,l,c="value"in _s?_s.value:_s.textContent,u=c.length;for(e=0;e<i&&t[e]===c[e];e++);var p=i-e;for(l=1;l<=p&&t[i-l]===c[u-l];l++);return al=c.slice(e,1<l?1-l:void 0)}function ll(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 ol(){return!0}function Th(){return!1}function zt(e){function t(i,l,c,u,p){this._reactName=i,this._targetInst=c,this.type=l,this.nativeEvent=u,this.target=p,this.currentTarget=null;for(var b in e)e.hasOwnProperty(b)&&(i=e[b],this[b]=i?i(u):u[b]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?ol:Th,this.isPropagationStopped=Th,this}return w(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=ol)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=ol)},persist:function(){},isPersistent:ol}),t}var ci={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},cl=zt(ci),Lr=w({},ci,{view:0,detail:0}),_y=zt(Lr),oc,cc,Hr,ul=w({},Lr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:fc,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!==Hr&&(Hr&&e.type==="mousemove"?(oc=e.screenX-Hr.screenX,cc=e.screenY-Hr.screenY):cc=oc=0,Hr=e),oc)},movementY:function(e){return"movementY"in e?e.movementY:cc}}),Nh=zt(ul),wy=w({},ul,{dataTransfer:0}),Sy=zt(wy),Ey=w({},Lr,{relatedTarget:0}),uc=zt(Ey),Ay=w({},ci,{animationName:0,elapsedTime:0,pseudoElement:0}),jy=zt(Ay),Oy=w({},ci,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Ty=zt(Oy),Ny=w({},ci,{data:0}),Ch=zt(Ny),Cy={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ky={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"},My={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ry(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=My[e])?!!t[e]:!1}function fc(){return Ry}var Dy=w({},Lr,{key:function(e){if(e.key){var t=Cy[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=ll(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?ky[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:fc,charCode:function(e){return e.type==="keypress"?ll(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ll(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),zy=zt(Dy),qy=w({},ul,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),kh=zt(qy),Uy=w({},Lr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:fc}),By=zt(Uy),Ly=w({},ci,{propertyName:0,elapsedTime:0,pseudoElement:0}),Hy=zt(Ly),Py=w({},ul,{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}),$y=zt(Py),Yy=w({},ci,{newState:0,oldState:0}),Gy=zt(Yy),Vy=[9,13,27,32],hc=In&&"CompositionEvent"in window,Pr=null;In&&"documentMode"in document&&(Pr=document.documentMode);var Fy=In&&"TextEvent"in window&&!Pr,Mh=In&&(!hc||Pr&&8<Pr&&11>=Pr),Rh=" ",Dh=!1;function zh(e,t){switch(e){case"keyup":return Vy.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function qh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Hi=!1;function Jy(e,t){switch(e){case"compositionend":return qh(t);case"keypress":return t.which!==32?null:(Dh=!0,Rh);case"textInput":return e=t.data,e===Rh&&Dh?null:e;default:return null}}function Iy(e,t){if(Hi)return e==="compositionend"||!hc&&zh(e,t)?(e=Oh(),al=lc=_s=null,Hi=!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 Mh&&t.locale!=="ko"?null:t.data;default:return null}}var Qy={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 Uh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Qy[e.type]:t==="textarea"}function Bh(e,t,i,l){Bi?Li?Li.push(l):Li=[l]:Bi=l,t=Wl(t,"onChange"),0<t.length&&(i=new cl("onChange","change",null,i,l),e.push({event:i,listeners:t}))}var $r=null,Yr=null;function Xy(e){vp(e,0)}function fl(e){var t=_(e);if(xh(t))return e}function Lh(e,t){if(e==="change")return t}var Hh=!1;if(In){var dc;if(In){var mc="oninput"in document;if(!mc){var Ph=document.createElement("div");Ph.setAttribute("oninput","return;"),mc=typeof Ph.oninput=="function"}dc=mc}else dc=!1;Hh=dc&&(!document.documentMode||9<document.documentMode)}function $h(){$r&&($r.detachEvent("onpropertychange",Yh),Yr=$r=null)}function Yh(e){if(e.propertyName==="value"&&fl(Yr)){var t=[];Bh(t,Yr,e,ic(e)),jh(Xy,t)}}function Ky(e,t,i){e==="focusin"?($h(),$r=t,Yr=i,$r.attachEvent("onpropertychange",Yh)):e==="focusout"&&$h()}function Zy(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return fl(Yr)}function Wy(e,t){if(e==="click")return fl(t)}function eb(e,t){if(e==="input"||e==="change")return fl(t)}function tb(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Gt=typeof Object.is=="function"?Object.is:tb;function Gr(e,t){if(Gt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var i=Object.keys(e),l=Object.keys(t);if(i.length!==l.length)return!1;for(l=0;l<i.length;l++){var c=i[l];if(!Cr.call(t,c)||!Gt(e[c],t[c]))return!1}return!0}function Gh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Vh(e,t){var i=Gh(e);e=0;for(var l;i;){if(i.nodeType===3){if(l=e+i.textContent.length,e<=t&&l>=t)return{node:i,offset:t-e};e=l}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Gh(i)}}function Fh(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Fh(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Jh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=il(e.document);t instanceof e.HTMLIFrameElement;){try{var i=typeof t.contentWindow.location.href=="string"}catch{i=!1}if(i)e=t.contentWindow;else break;t=il(e.document)}return t}function pc(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=In&&"documentMode"in document&&11>=document.documentMode,Pi=null,gc=null,Vr=null,yc=!1;function Ih(e,t,i){var l=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;yc||Pi==null||Pi!==il(l)||(l=Pi,"selectionStart"in l&&pc(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}),Vr&&Gr(Vr,l)||(Vr=l,l=Wl(gc,"onSelect"),0<l.length&&(t=new cl("onSelect","select",null,t,i),e.push({event:t,listeners:l}),t.target=Pi)))}function ui(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var $i={animationend:ui("Animation","AnimationEnd"),animationiteration:ui("Animation","AnimationIteration"),animationstart:ui("Animation","AnimationStart"),transitionrun:ui("Transition","TransitionRun"),transitionstart:ui("Transition","TransitionStart"),transitioncancel:ui("Transition","TransitionCancel"),transitionend:ui("Transition","TransitionEnd")},bc={},Qh={};In&&(Qh=document.createElement("div").style,"AnimationEvent"in window||(delete $i.animationend.animation,delete $i.animationiteration.animation,delete $i.animationstart.animation),"TransitionEvent"in window||delete $i.transitionend.transition);function fi(e){if(bc[e])return bc[e];if(!$i[e])return e;var t=$i[e],i;for(i in t)if(t.hasOwnProperty(i)&&i in Qh)return bc[e]=t[i];return e}var Xh=fi("animationend"),Kh=fi("animationiteration"),Zh=fi("animationstart"),sb=fi("transitionrun"),ib=fi("transitionstart"),rb=fi("transitioncancel"),Wh=fi("transitionend"),ed=new Map,xc="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(" ");xc.push("scrollEnd");function jn(e,t){ed.set(e,t),Z(t,[e])}var hl=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)},un=[],Yi=0,vc=0;function dl(){for(var e=Yi,t=vc=Yi=0;t<e;){var i=un[t];un[t++]=null;var l=un[t];un[t++]=null;var c=un[t];un[t++]=null;var u=un[t];if(un[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&&td(i,c,u)}}function ml(e,t,i,l){un[Yi++]=e,un[Yi++]=t,un[Yi++]=i,un[Yi++]=l,vc|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function _c(e,t,i,l){return ml(e,t,i,l),pl(e)}function hi(e,t){return ml(e,null,null,t),pl(e)}function td(e,t,i){e.lanes|=i;var l=e.alternate;l!==null&&(l.lanes|=i);for(var c=!1,u=e.return;u!==null;)u.childLanes|=i,l=u.alternate,l!==null&&(l.childLanes|=i),u.tag===22&&(e=u.stateNode,e===null||e._visibility&1||(c=!0)),e=u,u=u.return;return e.tag===3?(u=e.stateNode,c&&t!==null&&(c=31-Nt(i),e=u.hiddenUpdates,l=e[c],l===null?e[c]=[t]:l.push(t),t.lane=i|536870912),u):null}function pl(e){if(50<da)throw da=0,Cu=null,Error(a(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Gi={};function ab(e,t,i,l){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Vt(e,t,i,l){return new ab(e,t,i,l)}function wc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Qn(e,t){var i=e.alternate;return i===null?(i=Vt(e.tag,t,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&65011712,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i.refCleanup=e.refCleanup,i}function nd(e,t){e.flags&=65011714;var i=e.alternate;return i===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=i.childLanes,e.lanes=i.lanes,e.child=i.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=i.memoizedProps,e.memoizedState=i.memoizedState,e.updateQueue=i.updateQueue,e.type=i.type,t=i.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function gl(e,t,i,l,c,u){var p=0;if(l=e,typeof e=="function")wc(e)&&(p=1);else if(typeof e=="string")p=fx(e,i,lt.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case G:return e=Vt(31,i,t,c),e.elementType=G,e.lanes=u,e;case D:return di(i.children,c,u,t);case W:p=8,c|=24;break;case se:return e=Vt(12,i,t,c|2),e.elementType=se,e.lanes=u,e;case C:return e=Vt(13,i,t,c),e.elementType=C,e.lanes=u,e;case X:return e=Vt(19,i,t,c),e.elementType=X,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case me:p=10;break e;case ee:p=9;break e;case re:p=11;break e;case ce:p=14;break e;case V:p=16,l=null;break e}p=29,i=Error(a(130,e===null?"null":typeof e,"")),l=null}return t=Vt(p,i,t,c),t.elementType=e,t.type=l,t.lanes=u,t}function di(e,t,i,l){return e=Vt(7,e,l,t),e.lanes=i,e}function Sc(e,t,i){return e=Vt(6,e,null,t),e.lanes=i,e}function sd(e){var t=Vt(18,null,null,0);return t.stateNode=e,t}function Ec(e,t,i){return t=Vt(4,e.children!==null?e.children:[],e.key,t),t.lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var id=new WeakMap;function fn(e,t){if(typeof e=="object"&&e!==null){var i=id.get(e);return i!==void 0?i:(t={value:e,source:t,stack:Qa(t)},id.set(e,t),t)}return{value:e,source:t,stack:Qa(t)}}var Vi=[],Fi=0,yl=null,Fr=0,hn=[],dn=0,ws=null,Dn=1,zn="";function Xn(e,t){Vi[Fi++]=Fr,Vi[Fi++]=yl,yl=e,Fr=t}function rd(e,t,i){hn[dn++]=Dn,hn[dn++]=zn,hn[dn++]=ws,ws=e;var l=Dn;e=zn;var c=32-Nt(l)-1;l&=~(1<<c),i+=1;var u=32-Nt(t)+c;if(30<u){var p=c-c%5;u=(l&(1<<p)-1).toString(32),l>>=p,c-=p,Dn=1<<32-Nt(t)+c|i<<c|l,zn=u+e}else Dn=1<<u|i<<c|l,zn=e}function Ac(e){e.return!==null&&(Xn(e,1),rd(e,1,0))}function jc(e){for(;e===yl;)yl=Vi[--Fi],Vi[Fi]=null,Fr=Vi[--Fi],Vi[Fi]=null;for(;e===ws;)ws=hn[--dn],hn[dn]=null,zn=hn[--dn],hn[dn]=null,Dn=hn[--dn],hn[dn]=null}function ad(e,t){hn[dn++]=Dn,hn[dn++]=zn,hn[dn++]=ws,Dn=t.id,zn=t.overflow,ws=e}var wt=null,Ze=null,ze=!1,Ss=null,mn=!1,Oc=Error(a(519));function Es(e){var t=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Jr(fn(t,e)),Oc}function ld(e){var t=e.stateNode,i=e.type,l=e.memoizedProps;switch(t[Qe]=e,t[it]=l,i){case"dialog":Ce("cancel",t),Ce("close",t);break;case"iframe":case"object":case"embed":Ce("load",t);break;case"video":case"audio":for(i=0;i<pa.length;i++)Ce(pa[i],t);break;case"source":Ce("error",t);break;case"img":case"image":case"link":Ce("error",t),Ce("load",t);break;case"details":Ce("toggle",t);break;case"input":Ce("invalid",t),vh(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Ce("invalid",t);break;case"textarea":Ce("invalid",t),wh(t,l.value,l.defaultValue,l.children)}i=l.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||t.textContent===""+i||l.suppressHydrationWarning===!0||Ep(t.textContent,i)?(l.popover!=null&&(Ce("beforetoggle",t),Ce("toggle",t)),l.onScroll!=null&&Ce("scroll",t),l.onScrollEnd!=null&&Ce("scrollend",t),l.onClick!=null&&(t.onclick=Jn),t=!0):t=!1,t||Es(e,!0)}function od(e){for(wt=e.return;wt;)switch(wt.tag){case 5:case 31:case 13:mn=!1;return;case 27:case 3:mn=!0;return;default:wt=wt.return}}function Ji(e){if(e!==wt)return!1;if(!ze)return od(e),ze=!0,!1;var t=e.tag,i;if((i=t!==3&&t!==27)&&((i=t===5)&&(i=e.type,i=!(i!=="form"&&i!=="button")||Vu(e.type,e.memoizedProps)),i=!i),i&&Ze&&Es(e),od(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));Ze=Rp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));Ze=Rp(e)}else t===27?(t=Ze,Bs(e.type)?(e=Xu,Xu=null,Ze=e):Ze=t):Ze=wt?gn(e.stateNode.nextSibling):null;return!0}function mi(){Ze=wt=null,ze=!1}function Tc(){var e=Ss;return e!==null&&(Lt===null?Lt=e:Lt.push.apply(Lt,e),Ss=null),e}function Jr(e){Ss===null?Ss=[e]:Ss.push(e)}var Nc=Oe(null),pi=null,Kn=null;function As(e,t,i){Te(Nc,t._currentValue),t._currentValue=i}function Zn(e){e._currentValue=Nc.current,we(Nc)}function Cc(e,t,i){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===i)break;e=e.return}}function kc(e,t,i,l){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var u=c.dependencies;if(u!==null){var p=c.child;u=u.firstContext;e:for(;u!==null;){var b=u;u=c;for(var j=0;j<t.length;j++)if(b.context===t[j]){u.lanes|=i,b=u.alternate,b!==null&&(b.lanes|=i),Cc(u.return,i,e),l||(p=null);break e}u=b.next}}else if(c.tag===18){if(p=c.return,p===null)throw Error(a(341));p.lanes|=i,u=p.alternate,u!==null&&(u.lanes|=i),Cc(p,i,e),p=null}else p=c.child;if(p!==null)p.return=c;else for(p=c;p!==null;){if(p===e){p=null;break}if(c=p.sibling,c!==null){c.return=p.return,p=c;break}p=p.return}c=p}}function Ii(e,t,i,l){e=null;for(var c=t,u=!1;c!==null;){if(!u){if((c.flags&524288)!==0)u=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var p=c.alternate;if(p===null)throw Error(a(387));if(p=p.memoizedProps,p!==null){var b=c.type;Gt(c.pendingProps.value,p.value)||(e!==null?e.push(b):e=[b])}}else if(c===jt.current){if(p=c.alternate,p===null)throw Error(a(387));p.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(va):e=[va])}c=c.return}e!==null&&kc(t,e,i,l),t.flags|=262144}function bl(e){for(e=e.firstContext;e!==null;){if(!Gt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function gi(e){pi=e,Kn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function St(e){return cd(pi,e)}function xl(e,t){return pi===null&&gi(e),cd(e,t)}function cd(e,t){var i=t._currentValue;if(t={context:t,memoizedValue:i,next:null},Kn===null){if(e===null)throw Error(a(308));Kn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Kn=Kn.next=t;return i}var lb=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(i,l){e.push(l)}};this.abort=function(){t.aborted=!0,e.forEach(function(i){return i()})}},ob=r.unstable_scheduleCallback,cb=r.unstable_NormalPriority,ht={$$typeof:me,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Mc(){return{controller:new lb,data:new Map,refCount:0}}function Ir(e){e.refCount--,e.refCount===0&&ob(cb,function(){e.controller.abort()})}var Qr=null,Rc=0,Qi=0,Xi=null;function ub(e,t){if(Qr===null){var i=Qr=[];Rc=0,Qi=qu(),Xi={status:"pending",value:void 0,then:function(l){i.push(l)}}}return Rc++,t.then(ud,ud),t}function ud(){if(--Rc===0&&Qr!==null){Xi!==null&&(Xi.status="fulfilled");var e=Qr;Qr=null,Qi=0,Xi=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function fb(e,t){var i=[],l={status:"pending",value:null,reason:null,then:function(c){i.push(c)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var c=0;c<i.length;c++)(0,i[c])(t)},function(c){for(l.status="rejected",l.reason=c,c=0;c<i.length;c++)(0,i[c])(void 0)}),l}var fd=$.S;$.S=function(e,t){Im=et(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&ub(e,t),fd!==null&&fd(e,t)};var yi=Oe(null);function Dc(){var e=yi.current;return e!==null?e:Xe.pooledCache}function vl(e,t){t===null?Te(yi,yi.current):Te(yi,t.pool)}function hd(){var e=Dc();return e===null?null:{parent:ht._currentValue,pool:e}}var Ki=Error(a(460)),zc=Error(a(474)),_l=Error(a(542)),wl={then:function(){}};function dd(e){return e=e.status,e==="fulfilled"||e==="rejected"}function md(e,t,i){switch(i=e[i],i===void 0?e.push(t):i!==t&&(t.then(Jn,Jn),t=i),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,gd(e),e;default:if(typeof t.status=="string")t.then(Jn,Jn);else{if(e=Xe,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,gd(e),e}throw xi=t,Ki}}function bi(e){try{var t=e._init;return t(e._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(xi=i,Ki):i}}var xi=null;function pd(){if(xi===null)throw Error(a(459));var e=xi;return xi=null,e}function gd(e){if(e===Ki||e===_l)throw Error(a(483))}var Zi=null,Xr=0;function Sl(e){var t=Xr;return Xr+=1,Zi===null&&(Zi=[]),md(Zi,e,t)}function Kr(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function El(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 yd(e){function t(R,k){if(e){var U=R.deletions;U===null?(R.deletions=[k],R.flags|=16):U.push(k)}}function i(R,k){if(!e)return null;for(;k!==null;)t(R,k),k=k.sibling;return null}function l(R){for(var k=new Map;R!==null;)R.key!==null?k.set(R.key,R):k.set(R.index,R),R=R.sibling;return k}function c(R,k){return R=Qn(R,k),R.index=0,R.sibling=null,R}function u(R,k,U){return R.index=U,e?(U=R.alternate,U!==null?(U=U.index,U<k?(R.flags|=67108866,k):U):(R.flags|=67108866,k)):(R.flags|=1048576,k)}function p(R){return e&&R.alternate===null&&(R.flags|=67108866),R}function b(R,k,U,F){return k===null||k.tag!==6?(k=Sc(U,R.mode,F),k.return=R,k):(k=c(k,U),k.return=R,k)}function j(R,k,U,F){var ge=U.type;return ge===D?Y(R,k,U.props.children,F,U.key):k!==null&&(k.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===V&&bi(ge)===k.type)?(k=c(k,U.props),Kr(k,U),k.return=R,k):(k=gl(U.type,U.key,U.props,null,R.mode,F),Kr(k,U),k.return=R,k)}function B(R,k,U,F){return k===null||k.tag!==4||k.stateNode.containerInfo!==U.containerInfo||k.stateNode.implementation!==U.implementation?(k=Ec(U,R.mode,F),k.return=R,k):(k=c(k,U.children||[]),k.return=R,k)}function Y(R,k,U,F,ge){return k===null||k.tag!==7?(k=di(U,R.mode,F,ge),k.return=R,k):(k=c(k,U),k.return=R,k)}function Q(R,k,U){if(typeof k=="string"&&k!==""||typeof k=="number"||typeof k=="bigint")return k=Sc(""+k,R.mode,U),k.return=R,k;if(typeof k=="object"&&k!==null){switch(k.$$typeof){case q:return U=gl(k.type,k.key,k.props,null,R.mode,U),Kr(U,k),U.return=R,U;case M:return k=Ec(k,R.mode,U),k.return=R,k;case V:return k=bi(k),Q(R,k,U)}if(Me(k)||ne(k))return k=di(k,R.mode,U,null),k.return=R,k;if(typeof k.then=="function")return Q(R,Sl(k),U);if(k.$$typeof===me)return Q(R,xl(R,k),U);El(R,k)}return null}function L(R,k,U,F){var ge=k!==null?k.key:null;if(typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint")return ge!==null?null:b(R,k,""+U,F);if(typeof U=="object"&&U!==null){switch(U.$$typeof){case q:return U.key===ge?j(R,k,U,F):null;case M:return U.key===ge?B(R,k,U,F):null;case V:return U=bi(U),L(R,k,U,F)}if(Me(U)||ne(U))return ge!==null?null:Y(R,k,U,F,null);if(typeof U.then=="function")return L(R,k,Sl(U),F);if(U.$$typeof===me)return L(R,k,xl(R,U),F);El(R,U)}return null}function P(R,k,U,F,ge){if(typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint")return R=R.get(U)||null,b(k,R,""+F,ge);if(typeof F=="object"&&F!==null){switch(F.$$typeof){case q:return R=R.get(F.key===null?U:F.key)||null,j(k,R,F,ge);case M:return R=R.get(F.key===null?U:F.key)||null,B(k,R,F,ge);case V:return F=bi(F),P(R,k,U,F,ge)}if(Me(F)||ne(F))return R=R.get(U)||null,Y(k,R,F,ge,null);if(typeof F.then=="function")return P(R,k,U,Sl(F),ge);if(F.$$typeof===me)return P(R,k,U,xl(k,F),ge);El(k,F)}return null}function he(R,k,U,F){for(var ge=null,Be=null,pe=k,Ae=k=0,De=null;pe!==null&&Ae<U.length;Ae++){pe.index>Ae?(De=pe,pe=null):De=pe.sibling;var Le=L(R,pe,U[Ae],F);if(Le===null){pe===null&&(pe=De);break}e&&pe&&Le.alternate===null&&t(R,pe),k=u(Le,k,Ae),Be===null?ge=Le:Be.sibling=Le,Be=Le,pe=De}if(Ae===U.length)return i(R,pe),ze&&Xn(R,Ae),ge;if(pe===null){for(;Ae<U.length;Ae++)pe=Q(R,U[Ae],F),pe!==null&&(k=u(pe,k,Ae),Be===null?ge=pe:Be.sibling=pe,Be=pe);return ze&&Xn(R,Ae),ge}for(pe=l(pe);Ae<U.length;Ae++)De=P(pe,R,Ae,U[Ae],F),De!==null&&(e&&De.alternate!==null&&pe.delete(De.key===null?Ae:De.key),k=u(De,k,Ae),Be===null?ge=De:Be.sibling=De,Be=De);return e&&pe.forEach(function(Ys){return t(R,Ys)}),ze&&Xn(R,Ae),ge}function ye(R,k,U,F){if(U==null)throw Error(a(151));for(var ge=null,Be=null,pe=k,Ae=k=0,De=null,Le=U.next();pe!==null&&!Le.done;Ae++,Le=U.next()){pe.index>Ae?(De=pe,pe=null):De=pe.sibling;var Ys=L(R,pe,Le.value,F);if(Ys===null){pe===null&&(pe=De);break}e&&pe&&Ys.alternate===null&&t(R,pe),k=u(Ys,k,Ae),Be===null?ge=Ys:Be.sibling=Ys,Be=Ys,pe=De}if(Le.done)return i(R,pe),ze&&Xn(R,Ae),ge;if(pe===null){for(;!Le.done;Ae++,Le=U.next())Le=Q(R,Le.value,F),Le!==null&&(k=u(Le,k,Ae),Be===null?ge=Le:Be.sibling=Le,Be=Le);return ze&&Xn(R,Ae),ge}for(pe=l(pe);!Le.done;Ae++,Le=U.next())Le=P(pe,R,Ae,Le.value,F),Le!==null&&(e&&Le.alternate!==null&&pe.delete(Le.key===null?Ae:Le.key),k=u(Le,k,Ae),Be===null?ge=Le:Be.sibling=Le,Be=Le);return e&&pe.forEach(function(wx){return t(R,wx)}),ze&&Xn(R,Ae),ge}function Ie(R,k,U,F){if(typeof U=="object"&&U!==null&&U.type===D&&U.key===null&&(U=U.props.children),typeof U=="object"&&U!==null){switch(U.$$typeof){case q:e:{for(var ge=U.key;k!==null;){if(k.key===ge){if(ge=U.type,ge===D){if(k.tag===7){i(R,k.sibling),F=c(k,U.props.children),F.return=R,R=F;break e}}else if(k.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===V&&bi(ge)===k.type){i(R,k.sibling),F=c(k,U.props),Kr(F,U),F.return=R,R=F;break e}i(R,k);break}else t(R,k);k=k.sibling}U.type===D?(F=di(U.props.children,R.mode,F,U.key),F.return=R,R=F):(F=gl(U.type,U.key,U.props,null,R.mode,F),Kr(F,U),F.return=R,R=F)}return p(R);case M:e:{for(ge=U.key;k!==null;){if(k.key===ge)if(k.tag===4&&k.stateNode.containerInfo===U.containerInfo&&k.stateNode.implementation===U.implementation){i(R,k.sibling),F=c(k,U.children||[]),F.return=R,R=F;break e}else{i(R,k);break}else t(R,k);k=k.sibling}F=Ec(U,R.mode,F),F.return=R,R=F}return p(R);case V:return U=bi(U),Ie(R,k,U,F)}if(Me(U))return he(R,k,U,F);if(ne(U)){if(ge=ne(U),typeof ge!="function")throw Error(a(150));return U=ge.call(U),ye(R,k,U,F)}if(typeof U.then=="function")return Ie(R,k,Sl(U),F);if(U.$$typeof===me)return Ie(R,k,xl(R,U),F);El(R,U)}return typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint"?(U=""+U,k!==null&&k.tag===6?(i(R,k.sibling),F=c(k,U),F.return=R,R=F):(i(R,k),F=Sc(U,R.mode,F),F.return=R,R=F),p(R)):i(R,k)}return function(R,k,U,F){try{Xr=0;var ge=Ie(R,k,U,F);return Zi=null,ge}catch(pe){if(pe===Ki||pe===_l)throw pe;var Be=Vt(29,pe,null,R.mode);return Be.lanes=F,Be.return=R,Be}finally{}}}var vi=yd(!0),bd=yd(!1),js=!1;function qc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Uc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Os(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ts(e,t,i){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Pe&2)!==0){var c=l.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),l.pending=t,t=pl(e),td(e,null,i),t}return ml(e,l,t,i),pl(e)}function Zr(e,t,i){if(t=t.updateQueue,t!==null&&(t=t.shared,(i&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,i|=l,t.lanes=i,ai(e,i)}}function Bc(e,t){var i=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,i===l)){var c=null,u=null;if(i=i.firstBaseUpdate,i!==null){do{var p={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};u===null?c=u=p:u=u.next=p,i=i.next}while(i!==null);u===null?c=u=t:u=u.next=t}else c=u=t;i={baseState:l.baseState,firstBaseUpdate:c,lastBaseUpdate:u,shared:l.shared,callbacks:l.callbacks},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}var Lc=!1;function Wr(){if(Lc){var e=Xi;if(e!==null)throw e}}function ea(e,t,i,l){Lc=!1;var c=e.updateQueue;js=!1;var u=c.firstBaseUpdate,p=c.lastBaseUpdate,b=c.shared.pending;if(b!==null){c.shared.pending=null;var j=b,B=j.next;j.next=null,p===null?u=B:p.next=B,p=j;var Y=e.alternate;Y!==null&&(Y=Y.updateQueue,b=Y.lastBaseUpdate,b!==p&&(b===null?Y.firstBaseUpdate=B:b.next=B,Y.lastBaseUpdate=j))}if(u!==null){var Q=c.baseState;p=0,Y=B=j=null,b=u;do{var L=b.lane&-536870913,P=L!==b.lane;if(P?(Re&L)===L:(l&L)===L){L!==0&&L===Qi&&(Lc=!0),Y!==null&&(Y=Y.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var he=e,ye=b;L=t;var Ie=i;switch(ye.tag){case 1:if(he=ye.payload,typeof he=="function"){Q=he.call(Ie,Q,L);break e}Q=he;break e;case 3:he.flags=he.flags&-65537|128;case 0:if(he=ye.payload,L=typeof he=="function"?he.call(Ie,Q,L):he,L==null)break e;Q=w({},Q,L);break e;case 2:js=!0}}L=b.callback,L!==null&&(e.flags|=64,P&&(e.flags|=8192),P=c.callbacks,P===null?c.callbacks=[L]:P.push(L))}else P={lane:L,tag:b.tag,payload:b.payload,callback:b.callback,next:null},Y===null?(B=Y=P,j=Q):Y=Y.next=P,p|=L;if(b=b.next,b===null){if(b=c.shared.pending,b===null)break;P=b,b=P.next,P.next=null,c.lastBaseUpdate=P,c.shared.pending=null}}while(!0);Y===null&&(j=Q),c.baseState=j,c.firstBaseUpdate=B,c.lastBaseUpdate=Y,u===null&&(c.shared.lanes=0),Rs|=p,e.lanes=p,e.memoizedState=Q}}function xd(e,t){if(typeof e!="function")throw Error(a(191,e));e.call(t)}function vd(e,t){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;e<i.length;e++)xd(i[e],t)}var Wi=Oe(null),Al=Oe(0);function _d(e,t){e=ls,Te(Al,e),Te(Wi,t),ls=e|t.baseLanes}function Hc(){Te(Al,ls),Te(Wi,Wi.current)}function Pc(){ls=Al.current,we(Wi),we(Al)}var Ft=Oe(null),pn=null;function Ns(e){var t=e.alternate;Te(ct,ct.current&1),Te(Ft,e),pn===null&&(t===null||Wi.current!==null||t.memoizedState!==null)&&(pn=e)}function $c(e){Te(ct,ct.current),Te(Ft,e),pn===null&&(pn=e)}function wd(e){e.tag===22?(Te(ct,ct.current),Te(Ft,e),pn===null&&(pn=e)):Cs()}function Cs(){Te(ct,ct.current),Te(Ft,Ft.current)}function Jt(e){we(Ft),pn===e&&(pn=null),we(ct)}var ct=Oe(0);function jl(e){for(var t=e;t!==null;){if(t.tag===13){var i=t.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||Iu(i)||Qu(i)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Wn=0,Ee=null,Fe=null,dt=null,Ol=!1,er=!1,_i=!1,Tl=0,ta=0,tr=null,hb=0;function rt(){throw Error(a(321))}function Yc(e,t){if(t===null)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!Gt(e[i],t[i]))return!1;return!0}function Gc(e,t,i,l,c,u){return Wn=u,Ee=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,$.H=e===null||e.memoizedState===null?rm:ru,_i=!1,u=i(l,c),_i=!1,er&&(u=Ed(t,i,l,c)),Sd(e),u}function Sd(e){$.H=ia;var t=Fe!==null&&Fe.next!==null;if(Wn=0,dt=Fe=Ee=null,Ol=!1,ta=0,tr=null,t)throw Error(a(300));e===null||mt||(e=e.dependencies,e!==null&&bl(e)&&(mt=!0))}function Ed(e,t,i,l){Ee=e;var c=0;do{if(er&&(tr=null),ta=0,er=!1,25<=c)throw Error(a(301));if(c+=1,dt=Fe=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=am,u=t(i,l)}while(er);return u}function db(){var e=$.H,t=e.useState()[0];return t=typeof t.then=="function"?na(t):t,e=e.useState()[0],(Fe!==null?Fe.memoizedState:null)!==e&&(Ee.flags|=1024),t}function Vc(){var e=Tl!==0;return Tl=0,e}function Fc(e,t,i){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i}function Jc(e){if(Ol){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Ol=!1}Wn=0,dt=Fe=Ee=null,er=!1,ta=Tl=0,tr=null}function kt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return dt===null?Ee.memoizedState=dt=e:dt=dt.next=e,dt}function ut(){if(Fe===null){var e=Ee.alternate;e=e!==null?e.memoizedState:null}else e=Fe.next;var t=dt===null?Ee.memoizedState:dt.next;if(t!==null)dt=t,Fe=e;else{if(e===null)throw Ee.alternate===null?Error(a(467)):Error(a(310));Fe=e,e={memoizedState:Fe.memoizedState,baseState:Fe.baseState,baseQueue:Fe.baseQueue,queue:Fe.queue,next:null},dt===null?Ee.memoizedState=dt=e:dt=dt.next=e}return dt}function Nl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function na(e){var t=ta;return ta+=1,tr===null&&(tr=[]),e=md(tr,e,t),t=Ee,(dt===null?t.memoizedState:dt.next)===null&&(t=t.alternate,$.H=t===null||t.memoizedState===null?rm:ru),e}function Cl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return na(e);if(e.$$typeof===me)return St(e)}throw Error(a(438,String(e)))}function Ic(e){var t=null,i=Ee.updateQueue;if(i!==null&&(t=i.memoCache),t==null){var l=Ee.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(c){return c.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),i===null&&(i=Nl(),Ee.updateQueue=i),i.memoCache=t,i=t.data[t.index],i===void 0)for(i=t.data[t.index]=Array(e),l=0;l<e;l++)i[l]=K;return t.index++,i}function es(e,t){return typeof t=="function"?t(e):t}function kl(e){var t=ut();return Qc(t,Fe,e)}function Qc(e,t,i){var l=e.queue;if(l===null)throw Error(a(311));l.lastRenderedReducer=i;var c=e.baseQueue,u=l.pending;if(u!==null){if(c!==null){var p=c.next;c.next=u.next,u.next=p}t.baseQueue=c=u,l.pending=null}if(u=e.baseState,c===null)e.memoizedState=u;else{t=c.next;var b=p=null,j=null,B=t,Y=!1;do{var Q=B.lane&-536870913;if(Q!==B.lane?(Re&Q)===Q:(Wn&Q)===Q){var L=B.revertLane;if(L===0)j!==null&&(j=j.next={lane:0,revertLane:0,gesture:null,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null}),Q===Qi&&(Y=!0);else if((Wn&L)===L){B=B.next,L===Qi&&(Y=!0);continue}else Q={lane:0,revertLane:B.revertLane,gesture:null,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null},j===null?(b=j=Q,p=u):j=j.next=Q,Ee.lanes|=L,Rs|=L;Q=B.action,_i&&i(u,Q),u=B.hasEagerState?B.eagerState:i(u,Q)}else L={lane:Q,revertLane:B.revertLane,gesture:B.gesture,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null},j===null?(b=j=L,p=u):j=j.next=L,Ee.lanes|=Q,Rs|=Q;B=B.next}while(B!==null&&B!==t);if(j===null?p=u:j.next=b,!Gt(u,e.memoizedState)&&(mt=!0,Y&&(i=Xi,i!==null)))throw i;e.memoizedState=u,e.baseState=p,e.baseQueue=j,l.lastRenderedState=u}return c===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Xc(e){var t=ut(),i=t.queue;if(i===null)throw Error(a(311));i.lastRenderedReducer=e;var l=i.dispatch,c=i.pending,u=t.memoizedState;if(c!==null){i.pending=null;var p=c=c.next;do u=e(u,p.action),p=p.next;while(p!==c);Gt(u,t.memoizedState)||(mt=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),i.lastRenderedState=u}return[u,l]}function Ad(e,t,i){var l=Ee,c=ut(),u=ze;if(u){if(i===void 0)throw Error(a(407));i=i()}else i=t();var p=!Gt((Fe||c).memoizedState,i);if(p&&(c.memoizedState=i,mt=!0),c=c.queue,Wc(Td.bind(null,l,c,e),[e]),c.getSnapshot!==t||p||dt!==null&&dt.memoizedState.tag&1){if(l.flags|=2048,nr(9,{destroy:void 0},Od.bind(null,l,c,i,t),null),Xe===null)throw Error(a(349));u||(Wn&127)!==0||jd(l,t,i)}return i}function jd(e,t,i){e.flags|=16384,e={getSnapshot:t,value:i},t=Ee.updateQueue,t===null?(t=Nl(),Ee.updateQueue=t,t.stores=[e]):(i=t.stores,i===null?t.stores=[e]:i.push(e))}function Od(e,t,i,l){t.value=i,t.getSnapshot=l,Nd(t)&&Cd(e)}function Td(e,t,i){return i(function(){Nd(t)&&Cd(e)})}function Nd(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!Gt(e,i)}catch{return!0}}function Cd(e){var t=hi(e,2);t!==null&&Ht(t,e,2)}function Kc(e){var t=kt();if(typeof e=="function"){var i=e;if(e=i(),_i){$t(!0);try{i()}finally{$t(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:es,lastRenderedState:e},t}function kd(e,t,i,l){return e.baseState=i,Qc(e,Fe,typeof l=="function"?l:es)}function mb(e,t,i,l,c){if(Dl(e))throw Error(a(485));if(e=t.action,e!==null){var u={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(p){u.listeners.push(p)}};$.T!==null?i(!0):u.isTransition=!1,l(u),i=t.pending,i===null?(u.next=t.pending=u,Md(t,u)):(u.next=i.next,t.pending=i.next=u)}}function Md(e,t){var i=t.action,l=t.payload,c=e.state;if(t.isTransition){var u=$.T,p={};$.T=p;try{var b=i(c,l),j=$.S;j!==null&&j(p,b),Rd(e,t,b)}catch(B){Zc(e,t,B)}finally{u!==null&&p.types!==null&&(u.types=p.types),$.T=u}}else try{u=i(c,l),Rd(e,t,u)}catch(B){Zc(e,t,B)}}function Rd(e,t,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(l){Dd(e,t,l)},function(l){return Zc(e,t,l)}):Dd(e,t,i)}function Dd(e,t,i){t.status="fulfilled",t.value=i,zd(t),e.state=i,t=e.pending,t!==null&&(i=t.next,i===t?e.pending=null:(i=i.next,t.next=i,Md(e,i)))}function Zc(e,t,i){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=i,zd(t),t=t.next;while(t!==l)}e.action=null}function zd(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function qd(e,t){return t}function Ud(e,t){if(ze){var i=Xe.formState;if(i!==null){e:{var l=Ee;if(ze){if(Ze){t:{for(var c=Ze,u=mn;c.nodeType!==8;){if(!u){c=null;break t}if(c=gn(c.nextSibling),c===null){c=null;break t}}u=c.data,c=u==="F!"||u==="F"?c:null}if(c){Ze=gn(c.nextSibling),l=c.data==="F!";break e}}Es(l)}l=!1}l&&(t=i[0])}}return i=kt(),i.memoizedState=i.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:qd,lastRenderedState:t},i.queue=l,i=nm.bind(null,Ee,l),l.dispatch=i,l=Kc(!1),u=iu.bind(null,Ee,!1,l.queue),l=kt(),c={state:t,dispatch:null,action:e,pending:null},l.queue=c,i=mb.bind(null,Ee,c,u,i),c.dispatch=i,l.memoizedState=e,[t,i,!1]}function Bd(e){var t=ut();return Ld(t,Fe,e)}function Ld(e,t,i){if(t=Qc(e,t,qd)[0],e=kl(es)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=na(t)}catch(p){throw p===Ki?_l:p}else l=t;t=ut();var c=t.queue,u=c.dispatch;return i!==t.memoizedState&&(Ee.flags|=2048,nr(9,{destroy:void 0},pb.bind(null,c,i),null)),[l,u,e]}function pb(e,t){e.action=t}function Hd(e){var t=ut(),i=Fe;if(i!==null)return Ld(t,i,e);ut(),t=t.memoizedState,i=ut();var l=i.queue.dispatch;return i.memoizedState=e,[t,l,!1]}function nr(e,t,i,l){return e={tag:e,create:i,deps:l,inst:t,next:null},t=Ee.updateQueue,t===null&&(t=Nl(),Ee.updateQueue=t),i=t.lastEffect,i===null?t.lastEffect=e.next=e:(l=i.next,i.next=e,e.next=l,t.lastEffect=e),e}function Pd(){return ut().memoizedState}function Ml(e,t,i,l){var c=kt();Ee.flags|=e,c.memoizedState=nr(1|t,{destroy:void 0},i,l===void 0?null:l)}function Rl(e,t,i,l){var c=ut();l=l===void 0?null:l;var u=c.memoizedState.inst;Fe!==null&&l!==null&&Yc(l,Fe.memoizedState.deps)?c.memoizedState=nr(t,u,i,l):(Ee.flags|=e,c.memoizedState=nr(1|t,u,i,l))}function $d(e,t){Ml(8390656,8,e,t)}function Wc(e,t){Rl(2048,8,e,t)}function gb(e){Ee.flags|=4;var t=Ee.updateQueue;if(t===null)t=Nl(),Ee.updateQueue=t,t.events=[e];else{var i=t.events;i===null?t.events=[e]:i.push(e)}}function Yd(e){var t=ut().memoizedState;return gb({ref:t,nextImpl:e}),function(){if((Pe&2)!==0)throw Error(a(440));return t.impl.apply(void 0,arguments)}}function Gd(e,t){return Rl(4,2,e,t)}function Vd(e,t){return Rl(4,4,e,t)}function Fd(e,t){if(typeof t=="function"){e=e();var i=t(e);return function(){typeof i=="function"?i():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Jd(e,t,i){i=i!=null?i.concat([e]):null,Rl(4,4,Fd.bind(null,t,e),i)}function eu(){}function Id(e,t){var i=ut();t=t===void 0?null:t;var l=i.memoizedState;return t!==null&&Yc(t,l[1])?l[0]:(i.memoizedState=[e,t],e)}function Qd(e,t){var i=ut();t=t===void 0?null:t;var l=i.memoizedState;if(t!==null&&Yc(t,l[1]))return l[0];if(l=e(),_i){$t(!0);try{e()}finally{$t(!1)}}return i.memoizedState=[l,t],l}function tu(e,t,i){return i===void 0||(Wn&1073741824)!==0&&(Re&261930)===0?e.memoizedState=t:(e.memoizedState=i,e=Xm(),Ee.lanes|=e,Rs|=e,i)}function Xd(e,t,i,l){return Gt(i,t)?i:Wi.current!==null?(e=tu(e,i,l),Gt(e,t)||(mt=!0),e):(Wn&42)===0||(Wn&1073741824)!==0&&(Re&261930)===0?(mt=!0,e.memoizedState=i):(e=Xm(),Ee.lanes|=e,Rs|=e,t)}function Kd(e,t,i,l,c){var u=te.p;te.p=u!==0&&8>u?u:8;var p=$.T,b={};$.T=b,iu(e,!1,t,i);try{var j=c(),B=$.S;if(B!==null&&B(b,j),j!==null&&typeof j=="object"&&typeof j.then=="function"){var Y=fb(j,l);sa(e,t,Y,Xt(e))}else sa(e,t,l,Xt(e))}catch(Q){sa(e,t,{then:function(){},status:"rejected",reason:Q},Xt())}finally{te.p=u,p!==null&&b.types!==null&&(p.types=b.types),$.T=p}}function yb(){}function nu(e,t,i,l){if(e.tag!==5)throw Error(a(476));var c=Zd(e).queue;Kd(e,c,t,de,i===null?yb:function(){return Wd(e),i(l)})}function Zd(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:de,baseState:de,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:es,lastRenderedState:de},next:null};var i={};return t.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:es,lastRenderedState:i},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Wd(e){var t=Zd(e);t.next===null&&(t=e.alternate.memoizedState),sa(e,t.next.queue,{},Xt())}function su(){return St(va)}function em(){return ut().memoizedState}function tm(){return ut().memoizedState}function bb(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var i=Xt();e=Os(i);var l=Ts(t,e,i);l!==null&&(Ht(l,t,i),Zr(l,t,i)),t={cache:Mc()},e.payload=t;return}t=t.return}}function xb(e,t,i){var l=Xt();i={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Dl(e)?sm(t,i):(i=_c(e,t,i,l),i!==null&&(Ht(i,e,l),im(i,t,l)))}function nm(e,t,i){var l=Xt();sa(e,t,i,l)}function sa(e,t,i,l){var c={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(Dl(e))sm(t,c);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var p=t.lastRenderedState,b=u(p,i);if(c.hasEagerState=!0,c.eagerState=b,Gt(b,p))return ml(e,t,c,0),Xe===null&&dl(),!1}catch{}finally{}if(i=_c(e,t,c,l),i!==null)return Ht(i,e,l),im(i,t,l),!0}return!1}function iu(e,t,i,l){if(l={lane:2,revertLane:qu(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Dl(e)){if(t)throw Error(a(479))}else t=_c(e,i,l,2),t!==null&&Ht(t,e,2)}function Dl(e){var t=e.alternate;return e===Ee||t!==null&&t===Ee}function sm(e,t){er=Ol=!0;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function im(e,t,i){if((i&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,i|=l,t.lanes=i,ai(e,i)}}var ia={readContext:St,use:Cl,useCallback:rt,useContext:rt,useEffect:rt,useImperativeHandle:rt,useLayoutEffect:rt,useInsertionEffect:rt,useMemo:rt,useReducer:rt,useRef:rt,useState:rt,useDebugValue:rt,useDeferredValue:rt,useTransition:rt,useSyncExternalStore:rt,useId:rt,useHostTransitionStatus:rt,useFormState:rt,useActionState:rt,useOptimistic:rt,useMemoCache:rt,useCacheRefresh:rt};ia.useEffectEvent=rt;var rm={readContext:St,use:Cl,useCallback:function(e,t){return kt().memoizedState=[e,t===void 0?null:t],e},useContext:St,useEffect:$d,useImperativeHandle:function(e,t,i){i=i!=null?i.concat([e]):null,Ml(4194308,4,Fd.bind(null,t,e),i)},useLayoutEffect:function(e,t){return Ml(4194308,4,e,t)},useInsertionEffect:function(e,t){Ml(4,2,e,t)},useMemo:function(e,t){var i=kt();t=t===void 0?null:t;var l=e();if(_i){$t(!0);try{e()}finally{$t(!1)}}return i.memoizedState=[l,t],l},useReducer:function(e,t,i){var l=kt();if(i!==void 0){var c=i(t);if(_i){$t(!0);try{i(t)}finally{$t(!1)}}}else c=t;return l.memoizedState=l.baseState=c,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:c},l.queue=e,e=e.dispatch=xb.bind(null,Ee,e),[l.memoizedState,e]},useRef:function(e){var t=kt();return e={current:e},t.memoizedState=e},useState:function(e){e=Kc(e);var t=e.queue,i=nm.bind(null,Ee,t);return t.dispatch=i,[e.memoizedState,i]},useDebugValue:eu,useDeferredValue:function(e,t){var i=kt();return tu(i,e,t)},useTransition:function(){var e=Kc(!1);return e=Kd.bind(null,Ee,e.queue,!0,!1),kt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,i){var l=Ee,c=kt();if(ze){if(i===void 0)throw Error(a(407));i=i()}else{if(i=t(),Xe===null)throw Error(a(349));(Re&127)!==0||jd(l,t,i)}c.memoizedState=i;var u={value:i,getSnapshot:t};return c.queue=u,$d(Td.bind(null,l,u,e),[e]),l.flags|=2048,nr(9,{destroy:void 0},Od.bind(null,l,u,i,t),null),i},useId:function(){var e=kt(),t=Xe.identifierPrefix;if(ze){var i=zn,l=Dn;i=(l&~(1<<32-Nt(l)-1)).toString(32)+i,t="_"+t+"R_"+i,i=Tl++,0<i&&(t+="H"+i.toString(32)),t+="_"}else i=hb++,t="_"+t+"r_"+i.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:su,useFormState:Ud,useActionState:Ud,useOptimistic:function(e){var t=kt();t.memoizedState=t.baseState=e;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=i,t=iu.bind(null,Ee,!0,i),i.dispatch=t,[e,t]},useMemoCache:Ic,useCacheRefresh:function(){return kt().memoizedState=bb.bind(null,Ee)},useEffectEvent:function(e){var t=kt(),i={impl:e};return t.memoizedState=i,function(){if((Pe&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}},ru={readContext:St,use:Cl,useCallback:Id,useContext:St,useEffect:Wc,useImperativeHandle:Jd,useInsertionEffect:Gd,useLayoutEffect:Vd,useMemo:Qd,useReducer:kl,useRef:Pd,useState:function(){return kl(es)},useDebugValue:eu,useDeferredValue:function(e,t){var i=ut();return Xd(i,Fe.memoizedState,e,t)},useTransition:function(){var e=kl(es)[0],t=ut().memoizedState;return[typeof e=="boolean"?e:na(e),t]},useSyncExternalStore:Ad,useId:em,useHostTransitionStatus:su,useFormState:Bd,useActionState:Bd,useOptimistic:function(e,t){var i=ut();return kd(i,Fe,e,t)},useMemoCache:Ic,useCacheRefresh:tm};ru.useEffectEvent=Yd;var am={readContext:St,use:Cl,useCallback:Id,useContext:St,useEffect:Wc,useImperativeHandle:Jd,useInsertionEffect:Gd,useLayoutEffect:Vd,useMemo:Qd,useReducer:Xc,useRef:Pd,useState:function(){return Xc(es)},useDebugValue:eu,useDeferredValue:function(e,t){var i=ut();return Fe===null?tu(i,e,t):Xd(i,Fe.memoizedState,e,t)},useTransition:function(){var e=Xc(es)[0],t=ut().memoizedState;return[typeof e=="boolean"?e:na(e),t]},useSyncExternalStore:Ad,useId:em,useHostTransitionStatus:su,useFormState:Hd,useActionState:Hd,useOptimistic:function(e,t){var i=ut();return Fe!==null?kd(i,Fe,e,t):(i.baseState=e,[e,i.queue.dispatch])},useMemoCache:Ic,useCacheRefresh:tm};am.useEffectEvent=Yd;function au(e,t,i,l){t=e.memoizedState,i=i(l,t),i=i==null?t:w({},t,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var lu={enqueueSetState:function(e,t,i){e=e._reactInternals;var l=Xt(),c=Os(l);c.payload=t,i!=null&&(c.callback=i),t=Ts(e,c,l),t!==null&&(Ht(t,e,l),Zr(t,e,l))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var l=Xt(),c=Os(l);c.tag=1,c.payload=t,i!=null&&(c.callback=i),t=Ts(e,c,l),t!==null&&(Ht(t,e,l),Zr(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=Xt(),l=Os(i);l.tag=2,t!=null&&(l.callback=t),t=Ts(e,l,i),t!==null&&(Ht(t,e,i),Zr(t,e,i))}};function lm(e,t,i,l,c,u,p){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,u,p):t.prototype&&t.prototype.isPureReactComponent?!Gr(i,l)||!Gr(c,u):!0}function om(e,t,i,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(i,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(i,l),t.state!==e&&lu.enqueueReplaceState(t,t.state,null)}function wi(e,t){var i=t;if("ref"in t){i={};for(var l in t)l!=="ref"&&(i[l]=t[l])}if(e=e.defaultProps){i===t&&(i=w({},i));for(var c in e)i[c]===void 0&&(i[c]=e[c])}return i}function cm(e){hl(e)}function um(e){console.error(e)}function fm(e){hl(e)}function zl(e,t){try{var i=e.onUncaughtError;i(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function hm(e,t,i){try{var l=e.onCaughtError;l(i.value,{componentStack:i.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function ou(e,t,i){return i=Os(i),i.tag=3,i.payload={element:null},i.callback=function(){zl(e,t)},i}function dm(e){return e=Os(e),e.tag=3,e}function mm(e,t,i,l){var c=i.type.getDerivedStateFromError;if(typeof c=="function"){var u=l.value;e.payload=function(){return c(u)},e.callback=function(){hm(t,i,l)}}var p=i.stateNode;p!==null&&typeof p.componentDidCatch=="function"&&(e.callback=function(){hm(t,i,l),typeof c!="function"&&(Ds===null?Ds=new Set([this]):Ds.add(this));var b=l.stack;this.componentDidCatch(l.value,{componentStack:b!==null?b:""})})}function vb(e,t,i,l,c){if(i.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=i.alternate,t!==null&&Ii(t,i,c,!0),i=Ft.current,i!==null){switch(i.tag){case 31:case 13:return pn===null?Jl():i.alternate===null&&at===0&&(at=3),i.flags&=-257,i.flags|=65536,i.lanes=c,l===wl?i.flags|=16384:(t=i.updateQueue,t===null?i.updateQueue=new Set([l]):t.add(l),Ru(e,l,c)),!1;case 22:return i.flags|=65536,l===wl?i.flags|=16384:(t=i.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([l])},i.updateQueue=t):(i=t.retryQueue,i===null?t.retryQueue=new Set([l]):i.add(l)),Ru(e,l,c)),!1}throw Error(a(435,i.tag))}return Ru(e,l,c),Jl(),!1}if(ze)return t=Ft.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,l!==Oc&&(e=Error(a(422),{cause:l}),Jr(fn(e,i)))):(l!==Oc&&(t=Error(a(423),{cause:l}),Jr(fn(t,i))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,l=fn(l,i),c=ou(e.stateNode,l,c),Bc(e,c),at!==4&&(at=2)),!1;var u=Error(a(520),{cause:l});if(u=fn(u,i),ha===null?ha=[u]:ha.push(u),at!==4&&(at=2),t===null)return!0;l=fn(l,i),i=t;do{switch(i.tag){case 3:return i.flags|=65536,e=c&-c,i.lanes|=e,e=ou(i.stateNode,l,e),Bc(i,e),!1;case 1:if(t=i.type,u=i.stateNode,(i.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(Ds===null||!Ds.has(u))))return i.flags|=65536,c&=-c,i.lanes|=c,c=dm(c),mm(c,e,i,l),Bc(i,c),!1}i=i.return}while(i!==null);return!1}var cu=Error(a(461)),mt=!1;function Et(e,t,i,l){t.child=e===null?bd(t,null,i,l):vi(t,e.child,i,l)}function pm(e,t,i,l,c){i=i.render;var u=t.ref;if("ref"in l){var p={};for(var b in l)b!=="ref"&&(p[b]=l[b])}else p=l;return gi(t),l=Gc(e,t,i,p,u,c),b=Vc(),e!==null&&!mt?(Fc(e,t,c),ts(e,t,c)):(ze&&b&&Ac(t),t.flags|=1,Et(e,t,l,c),t.child)}function gm(e,t,i,l,c){if(e===null){var u=i.type;return typeof u=="function"&&!wc(u)&&u.defaultProps===void 0&&i.compare===null?(t.tag=15,t.type=u,ym(e,t,u,l,c)):(e=gl(i.type,null,l,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!yu(e,c)){var p=u.memoizedProps;if(i=i.compare,i=i!==null?i:Gr,i(p,l)&&e.ref===t.ref)return ts(e,t,c)}return t.flags|=1,e=Qn(u,l),e.ref=t.ref,e.return=t,t.child=e}function ym(e,t,i,l,c){if(e!==null){var u=e.memoizedProps;if(Gr(u,l)&&e.ref===t.ref)if(mt=!1,t.pendingProps=l=u,yu(e,c))(e.flags&131072)!==0&&(mt=!0);else return t.lanes=e.lanes,ts(e,t,c)}return uu(e,t,i,l,c)}function bm(e,t,i,l){var c=l.children,u=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((t.flags&128)!==0){if(u=u!==null?u.baseLanes|i:i,e!==null){for(l=t.child=e.child,c=0;l!==null;)c=c|l.lanes|l.childLanes,l=l.sibling;l=c&~u}else l=0,t.child=null;return xm(e,t,u,i,l)}if((i&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&vl(t,u!==null?u.cachePool:null),u!==null?_d(t,u):Hc(),wd(t);else return l=t.lanes=536870912,xm(e,t,u!==null?u.baseLanes|i:i,i,l)}else u!==null?(vl(t,u.cachePool),_d(t,u),Cs(),t.memoizedState=null):(e!==null&&vl(t,null),Hc(),Cs());return Et(e,t,c,i),t.child}function ra(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function xm(e,t,i,l,c){var u=Dc();return u=u===null?null:{parent:ht._currentValue,pool:u},t.memoizedState={baseLanes:i,cachePool:u},e!==null&&vl(t,null),Hc(),wd(t),e!==null&&Ii(e,t,l,!0),t.childLanes=c,null}function ql(e,t){return t=Bl({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function vm(e,t,i){return vi(t,e.child,null,i),e=ql(t,t.pendingProps),e.flags|=2,Jt(t),t.memoizedState=null,e}function _b(e,t,i){var l=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(ze){if(l.mode==="hidden")return e=ql(t,l),t.lanes=536870912,ra(null,e);if($c(t),(e=Ze)?(e=Mp(e,mn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ws!==null?{id:Dn,overflow:zn}:null,retryLane:536870912,hydrationErrors:null},i=sd(e),i.return=t,t.child=i,wt=t,Ze=null)):e=null,e===null)throw Es(t);return t.lanes=536870912,null}return ql(t,l)}var u=e.memoizedState;if(u!==null){var p=u.dehydrated;if($c(t),c)if(t.flags&256)t.flags&=-257,t=vm(e,t,i);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(a(558));else if(mt||Ii(e,t,i,!1),c=(i&e.childLanes)!==0,mt||c){if(l=Xe,l!==null&&(p=vs(l,i),p!==0&&p!==u.retryLane))throw u.retryLane=p,hi(e,p),Ht(l,e,p),cu;Jl(),t=vm(e,t,i)}else e=u.treeContext,Ze=gn(p.nextSibling),wt=t,ze=!0,Ss=null,mn=!1,e!==null&&ad(t,e),t=ql(t,l),t.flags|=4096;return t}return e=Qn(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Ul(e,t){var i=t.ref;if(i===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(a(284));(e===null||e.ref!==i)&&(t.flags|=4194816)}}function uu(e,t,i,l,c){return gi(t),i=Gc(e,t,i,l,void 0,c),l=Vc(),e!==null&&!mt?(Fc(e,t,c),ts(e,t,c)):(ze&&l&&Ac(t),t.flags|=1,Et(e,t,i,c),t.child)}function _m(e,t,i,l,c,u){return gi(t),t.updateQueue=null,i=Ed(t,l,i,c),Sd(e),l=Vc(),e!==null&&!mt?(Fc(e,t,u),ts(e,t,u)):(ze&&l&&Ac(t),t.flags|=1,Et(e,t,i,u),t.child)}function wm(e,t,i,l,c){if(gi(t),t.stateNode===null){var u=Gi,p=i.contextType;typeof p=="object"&&p!==null&&(u=St(p)),u=new i(l,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=lu,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=l,u.state=t.memoizedState,u.refs={},qc(t),p=i.contextType,u.context=typeof p=="object"&&p!==null?St(p):Gi,u.state=t.memoizedState,p=i.getDerivedStateFromProps,typeof p=="function"&&(au(t,i,p,l),u.state=t.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(p=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),p!==u.state&&lu.enqueueReplaceState(u,u.state,null),ea(t,l,u,c),Wr(),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=wi(i,b);u.props=j;var B=u.context,Y=i.contextType;p=Gi,typeof Y=="object"&&Y!==null&&(p=St(Y));var Q=i.getDerivedStateFromProps;Y=typeof Q=="function"||typeof u.getSnapshotBeforeUpdate=="function",b=t.pendingProps!==b,Y||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(b||B!==p)&&om(t,u,l,p),js=!1;var L=t.memoizedState;u.state=L,ea(t,l,u,c),Wr(),B=t.memoizedState,b||L!==B||js?(typeof Q=="function"&&(au(t,i,Q,l),B=t.memoizedState),(j=js||lm(t,i,j,l,L,B,p))?(Y||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=B),u.props=l,u.state=B,u.context=p,l=j):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{u=t.stateNode,Uc(e,t),p=t.memoizedProps,Y=wi(i,p),u.props=Y,Q=t.pendingProps,L=u.context,B=i.contextType,j=Gi,typeof B=="object"&&B!==null&&(j=St(B)),b=i.getDerivedStateFromProps,(B=typeof b=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(p!==Q||L!==j)&&om(t,u,l,j),js=!1,L=t.memoizedState,u.state=L,ea(t,l,u,c),Wr();var P=t.memoizedState;p!==Q||L!==P||js||e!==null&&e.dependencies!==null&&bl(e.dependencies)?(typeof b=="function"&&(au(t,i,b,l),P=t.memoizedState),(Y=js||lm(t,i,Y,l,L,P,j)||e!==null&&e.dependencies!==null&&bl(e.dependencies))?(B||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(l,P,j),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(l,P,j)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=P),u.props=l,u.state=P,u.context=j,l=Y):(typeof u.componentDidUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),l=!1)}return u=l,Ul(e,t),l=(t.flags&128)!==0,u||l?(u=t.stateNode,i=l&&typeof i.getDerivedStateFromError!="function"?null:u.render(),t.flags|=1,e!==null&&l?(t.child=vi(t,e.child,null,c),t.child=vi(t,null,i,c)):Et(e,t,i,c),t.memoizedState=u.state,e=t.child):e=ts(e,t,c),e}function Sm(e,t,i,l){return mi(),t.flags|=256,Et(e,t,i,l),t.child}var fu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function hu(e){return{baseLanes:e,cachePool:hd()}}function du(e,t,i){return e=e!==null?e.childLanes&~i:0,t&&(e|=Qt),e}function Em(e,t,i){var l=t.pendingProps,c=!1,u=(t.flags&128)!==0,p;if((p=u)||(p=e!==null&&e.memoizedState===null?!1:(ct.current&2)!==0),p&&(c=!0,t.flags&=-129),p=(t.flags&32)!==0,t.flags&=-33,e===null){if(ze){if(c?Ns(t):Cs(),(e=Ze)?(e=Mp(e,mn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ws!==null?{id:Dn,overflow:zn}:null,retryLane:536870912,hydrationErrors:null},i=sd(e),i.return=t,t.child=i,wt=t,Ze=null)):e=null,e===null)throw Es(t);return Qu(e)?t.lanes=32:t.lanes=536870912,null}var b=l.children;return l=l.fallback,c?(Cs(),c=t.mode,b=Bl({mode:"hidden",children:b},c),l=di(l,c,i,null),b.return=t,l.return=t,b.sibling=l,t.child=b,l=t.child,l.memoizedState=hu(i),l.childLanes=du(e,p,i),t.memoizedState=fu,ra(null,l)):(Ns(t),mu(t,b))}var j=e.memoizedState;if(j!==null&&(b=j.dehydrated,b!==null)){if(u)t.flags&256?(Ns(t),t.flags&=-257,t=pu(e,t,i)):t.memoizedState!==null?(Cs(),t.child=e.child,t.flags|=128,t=null):(Cs(),b=l.fallback,c=t.mode,l=Bl({mode:"visible",children:l.children},c),b=di(b,c,i,null),b.flags|=2,l.return=t,b.return=t,l.sibling=b,t.child=l,vi(t,e.child,null,i),l=t.child,l.memoizedState=hu(i),l.childLanes=du(e,p,i),t.memoizedState=fu,t=ra(null,l));else if(Ns(t),Qu(b)){if(p=b.nextSibling&&b.nextSibling.dataset,p)var B=p.dgst;p=B,l=Error(a(419)),l.stack="",l.digest=p,Jr({value:l,source:null,stack:null}),t=pu(e,t,i)}else if(mt||Ii(e,t,i,!1),p=(i&e.childLanes)!==0,mt||p){if(p=Xe,p!==null&&(l=vs(p,i),l!==0&&l!==j.retryLane))throw j.retryLane=l,hi(e,l),Ht(p,e,l),cu;Iu(b)||Jl(),t=pu(e,t,i)}else Iu(b)?(t.flags|=192,t.child=e.child,t=null):(e=j.treeContext,Ze=gn(b.nextSibling),wt=t,ze=!0,Ss=null,mn=!1,e!==null&&ad(t,e),t=mu(t,l.children),t.flags|=4096);return t}return c?(Cs(),b=l.fallback,c=t.mode,j=e.child,B=j.sibling,l=Qn(j,{mode:"hidden",children:l.children}),l.subtreeFlags=j.subtreeFlags&65011712,B!==null?b=Qn(B,b):(b=di(b,c,i,null),b.flags|=2),b.return=t,l.return=t,l.sibling=b,t.child=l,ra(null,l),l=t.child,b=e.child.memoizedState,b===null?b=hu(i):(c=b.cachePool,c!==null?(j=ht._currentValue,c=c.parent!==j?{parent:j,pool:j}:c):c=hd(),b={baseLanes:b.baseLanes|i,cachePool:c}),l.memoizedState=b,l.childLanes=du(e,p,i),t.memoizedState=fu,ra(e.child,l)):(Ns(t),i=e.child,e=i.sibling,i=Qn(i,{mode:"visible",children:l.children}),i.return=t,i.sibling=null,e!==null&&(p=t.deletions,p===null?(t.deletions=[e],t.flags|=16):p.push(e)),t.child=i,t.memoizedState=null,i)}function mu(e,t){return t=Bl({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Bl(e,t){return e=Vt(22,e,null,t),e.lanes=0,e}function pu(e,t,i){return vi(t,e.child,null,i),e=mu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Am(e,t,i){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),Cc(e.return,t,i)}function gu(e,t,i,l,c,u){var p=e.memoizedState;p===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:i,tailMode:c,treeForkCount:u}:(p.isBackwards=t,p.rendering=null,p.renderingStartTime=0,p.last=l,p.tail=i,p.tailMode=c,p.treeForkCount=u)}function jm(e,t,i){var l=t.pendingProps,c=l.revealOrder,u=l.tail;l=l.children;var p=ct.current,b=(p&2)!==0;if(b?(p=p&1|2,t.flags|=128):p&=1,Te(ct,p),Et(e,t,l,i),l=ze?Fr:0,!b&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Am(e,i,t);else if(e.tag===19)Am(e,i,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(c){case"forwards":for(i=t.child,c=null;i!==null;)e=i.alternate,e!==null&&jl(e)===null&&(c=i),i=i.sibling;i=c,i===null?(c=t.child,t.child=null):(c=i.sibling,i.sibling=null),gu(t,!1,c,i,u,l);break;case"backwards":case"unstable_legacy-backwards":for(i=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&jl(e)===null){t.child=c;break}e=c.sibling,c.sibling=i,i=c,c=e}gu(t,!0,i,null,u,l);break;case"together":gu(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function ts(e,t,i){if(e!==null&&(t.dependencies=e.dependencies),Rs|=t.lanes,(i&t.childLanes)===0)if(e!==null){if(Ii(e,t,i,!1),(i&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(a(153));if(t.child!==null){for(e=t.child,i=Qn(e,e.pendingProps),t.child=i,i.return=t;e.sibling!==null;)e=e.sibling,i=i.sibling=Qn(e,e.pendingProps),i.return=t;i.sibling=null}return t.child}function yu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&bl(e)))}function wb(e,t,i){switch(t.tag){case 3:Ot(t,t.stateNode.containerInfo),As(t,ht,e.memoizedState.cache),mi();break;case 27:case 5:Tt(t);break;case 4:Ot(t,t.stateNode.containerInfo);break;case 10:As(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,$c(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(Ns(t),t.flags|=128,null):(i&t.child.childLanes)!==0?Em(e,t,i):(Ns(t),e=ts(e,t,i),e!==null?e.sibling:null);Ns(t);break;case 19:var c=(e.flags&128)!==0;if(l=(i&t.childLanes)!==0,l||(Ii(e,t,i,!1),l=(i&t.childLanes)!==0),c){if(l)return jm(e,t,i);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),Te(ct,ct.current),l)break;return null;case 22:return t.lanes=0,bm(e,t,i,t.pendingProps);case 24:As(t,ht,e.memoizedState.cache)}return ts(e,t,i)}function Om(e,t,i){if(e!==null)if(e.memoizedProps!==t.pendingProps)mt=!0;else{if(!yu(e,i)&&(t.flags&128)===0)return mt=!1,wb(e,t,i);mt=(e.flags&131072)!==0}else mt=!1,ze&&(t.flags&1048576)!==0&&rd(t,Fr,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=bi(t.elementType),t.type=e,typeof e=="function")wc(e)?(l=wi(e,l),t.tag=1,t=wm(null,t,e,l,i)):(t.tag=0,t=uu(null,t,e,l,i));else{if(e!=null){var c=e.$$typeof;if(c===re){t.tag=11,t=pm(null,t,e,l,i);break e}else if(c===ce){t.tag=14,t=gm(null,t,e,l,i);break e}}throw t=He(e)||e,Error(a(306,t,""))}}return t;case 0:return uu(e,t,t.type,t.pendingProps,i);case 1:return l=t.type,c=wi(l,t.pendingProps),wm(e,t,l,c,i);case 3:e:{if(Ot(t,t.stateNode.containerInfo),e===null)throw Error(a(387));l=t.pendingProps;var u=t.memoizedState;c=u.element,Uc(e,t),ea(t,l,null,i);var p=t.memoizedState;if(l=p.cache,As(t,ht,l),l!==u.cache&&kc(t,[ht],i,!0),Wr(),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=Sm(e,t,l,i);break e}else if(l!==c){c=fn(Error(a(424)),t),Jr(c),t=Sm(e,t,l,i);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Ze=gn(e.firstChild),wt=t,ze=!0,Ss=null,mn=!0,i=bd(t,null,l,i),t.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(mi(),l===c){t=ts(e,t,i);break e}Et(e,t,l,i)}t=t.child}return t;case 26:return Ul(e,t),e===null?(i=Bp(t.type,null,t.pendingProps,null))?t.memoizedState=i:ze||(i=t.type,e=t.pendingProps,l=eo(an.current).createElement(i),l[Qe]=t,l[it]=e,At(l,i,e),N(l),t.stateNode=l):t.memoizedState=Bp(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Tt(t),e===null&&ze&&(l=t.stateNode=zp(t.type,t.pendingProps,an.current),wt=t,mn=!0,c=Ze,Bs(t.type)?(Xu=c,Ze=gn(l.firstChild)):Ze=c),Et(e,t,t.pendingProps.children,i),Ul(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ze&&((c=l=Ze)&&(l=Zb(l,t.type,t.pendingProps,mn),l!==null?(t.stateNode=l,wt=t,Ze=gn(l.firstChild),mn=!1,c=!0):c=!1),c||Es(t)),Tt(t),c=t.type,u=t.pendingProps,p=e!==null?e.memoizedProps:null,l=u.children,Vu(c,u)?l=null:p!==null&&Vu(c,p)&&(t.flags|=32),t.memoizedState!==null&&(c=Gc(e,t,db,null,null,i),va._currentValue=c),Ul(e,t),Et(e,t,l,i),t.child;case 6:return e===null&&ze&&((e=i=Ze)&&(i=Wb(i,t.pendingProps,mn),i!==null?(t.stateNode=i,wt=t,Ze=null,e=!0):e=!1),e||Es(t)),null;case 13:return Em(e,t,i);case 4:return Ot(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=vi(t,null,l,i):Et(e,t,l,i),t.child;case 11:return pm(e,t,t.type,t.pendingProps,i);case 7:return Et(e,t,t.pendingProps,i),t.child;case 8:return Et(e,t,t.pendingProps.children,i),t.child;case 12:return Et(e,t,t.pendingProps.children,i),t.child;case 10:return l=t.pendingProps,As(t,t.type,l.value),Et(e,t,l.children,i),t.child;case 9:return c=t.type._context,l=t.pendingProps.children,gi(t),c=St(c),l=l(c),t.flags|=1,Et(e,t,l,i),t.child;case 14:return gm(e,t,t.type,t.pendingProps,i);case 15:return ym(e,t,t.type,t.pendingProps,i);case 19:return jm(e,t,i);case 31:return _b(e,t,i);case 22:return bm(e,t,i,t.pendingProps);case 24:return gi(t),l=St(ht),e===null?(c=Dc(),c===null&&(c=Xe,u=Mc(),c.pooledCache=u,u.refCount++,u!==null&&(c.pooledCacheLanes|=i),c=u),t.memoizedState={parent:l,cache:c},qc(t),As(t,ht,c)):((e.lanes&i)!==0&&(Uc(e,t),ea(t,null,null,i),Wr()),c=e.memoizedState,u=t.memoizedState,c.parent!==l?(c={parent:l,cache:l},t.memoizedState=c,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=c),As(t,ht,l)):(l=u.cache,As(t,ht,l),l!==c.cache&&kc(t,[ht],i,!0))),Et(e,t,t.pendingProps.children,i),t.child;case 29:throw t.pendingProps}throw Error(a(156,t.tag))}function ns(e){e.flags|=4}function bu(e,t,i,l,c){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(c&335544128)===c)if(e.stateNode.complete)e.flags|=8192;else if(ep())e.flags|=8192;else throw xi=wl,zc}else e.flags&=-16777217}function Tm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Yp(t))if(ep())e.flags|=8192;else throw xi=wl,zc}function Ll(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Di():536870912,e.lanes|=t,ar|=t)}function aa(e,t){if(!ze)switch(e.tailMode){case"hidden":t=e.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var l=null;i!==null;)i.alternate!==null&&(l=i),i=i.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function We(e){var t=e.alternate!==null&&e.alternate.child===e.child,i=0,l=0;if(t)for(var c=e.child;c!==null;)i|=c.lanes|c.childLanes,l|=c.subtreeFlags&65011712,l|=c.flags&65011712,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)i|=c.lanes|c.childLanes,l|=c.subtreeFlags,l|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=l,e.childLanes=i,t}function Sb(e,t,i){var l=t.pendingProps;switch(jc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return We(t),null;case 1:return We(t),null;case 3:return i=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),Zn(ht),Se(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Ji(t)?ns(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Tc())),We(t),null;case 26:var c=t.type,u=t.memoizedState;return e===null?(ns(t),u!==null?(We(t),Tm(t,u)):(We(t),bu(t,c,null,l,i))):u?u!==e.memoizedState?(ns(t),We(t),Tm(t,u)):(We(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&ns(t),We(t),bu(t,c,e,l,i)),null;case 27:if(ti(t),i=an.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&ns(t);else{if(!l){if(t.stateNode===null)throw Error(a(166));return We(t),null}e=lt.current,Ji(t)?ld(t):(e=zp(c,l,i),t.stateNode=e,ns(t))}return We(t),null;case 5:if(ti(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&ns(t);else{if(!l){if(t.stateNode===null)throw Error(a(166));return We(t),null}if(u=lt.current,Ji(t))ld(t);else{var p=eo(an.current);switch(u){case 1:u=p.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:u=p.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":u=p.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":u=p.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":u=p.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof l.is=="string"?p.createElement("select",{is:l.is}):p.createElement("select"),l.multiple?u.multiple=!0:l.size&&(u.size=l.size);break;default:u=typeof l.is=="string"?p.createElement(c,{is:l.is}):p.createElement(c)}}u[Qe]=t,u[it]=l;e:for(p=t.child;p!==null;){if(p.tag===5||p.tag===6)u.appendChild(p.stateNode);else if(p.tag!==4&&p.tag!==27&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===t)break e;for(;p.sibling===null;){if(p.return===null||p.return===t)break e;p=p.return}p.sibling.return=p.return,p=p.sibling}t.stateNode=u;e:switch(At(u,c,l),c){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&ns(t)}}return We(t),bu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,i),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&ns(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(a(166));if(e=an.current,Ji(t)){if(e=t.stateNode,i=t.memoizedProps,l=null,c=wt,c!==null)switch(c.tag){case 27:case 5:l=c.memoizedProps}e[Qe]=t,e=!!(e.nodeValue===i||l!==null&&l.suppressHydrationWarning===!0||Ep(e.nodeValue,i)),e||Es(t,!0)}else e=eo(e).createTextNode(l),e[Qe]=t,t.stateNode=e}return We(t),null;case 31:if(i=t.memoizedState,e===null||e.memoizedState!==null){if(l=Ji(t),i!==null){if(e===null){if(!l)throw Error(a(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(557));e[Qe]=t}else mi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),e=!1}else i=Tc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),e=!0;if(!e)return t.flags&256?(Jt(t),t):(Jt(t),null);if((t.flags&128)!==0)throw Error(a(558))}return We(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=Ji(t),l!==null&&l.dehydrated!==null){if(e===null){if(!c)throw Error(a(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(a(317));c[Qe]=t}else mi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),c=!1}else c=Tc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(Jt(t),t):(Jt(t),null)}return Jt(t),(t.flags&128)!==0?(t.lanes=i,t):(i=l!==null,e=e!==null&&e.memoizedState!==null,i&&(l=t.child,c=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(c=l.alternate.memoizedState.cachePool.pool),u=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(u=l.memoizedState.cachePool.pool),u!==c&&(l.flags|=2048)),i!==e&&i&&(t.child.flags|=8192),Ll(t,t.updateQueue),We(t),null);case 4:return Se(),e===null&&Hu(t.stateNode.containerInfo),We(t),null;case 10:return Zn(t.type),We(t),null;case 19:if(we(ct),l=t.memoizedState,l===null)return We(t),null;if(c=(t.flags&128)!==0,u=l.rendering,u===null)if(c)aa(l,!1);else{if(at!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=jl(e),u!==null){for(t.flags|=128,aa(l,!1),e=u.updateQueue,t.updateQueue=e,Ll(t,e),t.subtreeFlags=0,e=i,i=t.child;i!==null;)nd(i,e),i=i.sibling;return Te(ct,ct.current&1|2),ze&&Xn(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&et()>Gl&&(t.flags|=128,c=!0,aa(l,!1),t.lanes=4194304)}else{if(!c)if(e=jl(u),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,Ll(t,e),aa(l,!0),l.tail===null&&l.tailMode==="hidden"&&!u.alternate&&!ze)return We(t),null}else 2*et()-l.renderingStartTime>Gl&&i!==536870912&&(t.flags|=128,c=!0,aa(l,!1),t.lanes=4194304);l.isBackwards?(u.sibling=t.child,t.child=u):(e=l.last,e!==null?e.sibling=u:t.child=u,l.last=u)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=et(),e.sibling=null,i=ct.current,Te(ct,c?i&1|2:i&1),ze&&Xn(t,l.treeForkCount),e):(We(t),null);case 22:case 23:return Jt(t),Pc(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(i&536870912)!==0&&(t.flags&128)===0&&(We(t),t.subtreeFlags&6&&(t.flags|=8192)):We(t),i=t.updateQueue,i!==null&&Ll(t,i.retryQueue),i=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==i&&(t.flags|=2048),e!==null&&we(yi),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),Zn(ht),We(t),null;case 25:return null;case 30:return null}throw Error(a(156,t.tag))}function Eb(e,t){switch(jc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Zn(ht),Se(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ti(t),null;case 31:if(t.memoizedState!==null){if(Jt(t),t.alternate===null)throw Error(a(340));mi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Jt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));mi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return we(ct),null;case 4:return Se(),null;case 10:return Zn(t.type),null;case 22:case 23:return Jt(t),Pc(),e!==null&&we(yi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Zn(ht),null;case 25:return null;default:return null}}function Nm(e,t){switch(jc(t),t.tag){case 3:Zn(ht),Se();break;case 26:case 27:case 5:ti(t);break;case 4:Se();break;case 31:t.memoizedState!==null&&Jt(t);break;case 13:Jt(t);break;case 19:we(ct);break;case 10:Zn(t.type);break;case 22:case 23:Jt(t),Pc(),e!==null&&we(yi);break;case 24:Zn(ht)}}function la(e,t){try{var i=t.updateQueue,l=i!==null?i.lastEffect:null;if(l!==null){var c=l.next;i=c;do{if((i.tag&e)===e){l=void 0;var u=i.create,p=i.inst;l=u(),p.destroy=l}i=i.next}while(i!==c)}}catch(b){Ge(t,t.return,b)}}function ks(e,t,i){try{var l=t.updateQueue,c=l!==null?l.lastEffect:null;if(c!==null){var u=c.next;l=u;do{if((l.tag&e)===e){var p=l.inst,b=p.destroy;if(b!==void 0){p.destroy=void 0,c=t;var j=i,B=b;try{B()}catch(Y){Ge(c,j,Y)}}}l=l.next}while(l!==u)}}catch(Y){Ge(t,t.return,Y)}}function Cm(e){var t=e.updateQueue;if(t!==null){var i=e.stateNode;try{vd(t,i)}catch(l){Ge(e,e.return,l)}}}function km(e,t,i){i.props=wi(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(l){Ge(e,t,l)}}function oa(e,t){try{var i=e.ref;if(i!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof i=="function"?e.refCleanup=i(l):i.current=l}}catch(c){Ge(e,t,c)}}function qn(e,t){var i=e.ref,l=e.refCleanup;if(i!==null)if(typeof l=="function")try{l()}catch(c){Ge(e,t,c)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(c){Ge(e,t,c)}else i.current=null}function Mm(e){var t=e.type,i=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":i.autoFocus&&l.focus();break e;case"img":i.src?l.src=i.src:i.srcSet&&(l.srcset=i.srcSet)}}catch(c){Ge(e,e.return,c)}}function xu(e,t,i){try{var l=e.stateNode;Fb(l,e.type,i,t),l[it]=t}catch(c){Ge(e,e.return,c)}}function Rm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Bs(e.type)||e.tag===4}function vu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Rm(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Bs(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function _u(e,t,i){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(e,t):(t=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,t.appendChild(e),i=i._reactRootContainer,i!=null||t.onclick!==null||(t.onclick=Jn));else if(l!==4&&(l===27&&Bs(e.type)&&(i=e.stateNode,t=null),e=e.child,e!==null))for(_u(e,t,i),e=e.sibling;e!==null;)_u(e,t,i),e=e.sibling}function Hl(e,t,i){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?i.insertBefore(e,t):i.appendChild(e);else if(l!==4&&(l===27&&Bs(e.type)&&(i=e.stateNode),e=e.child,e!==null))for(Hl(e,t,i),e=e.sibling;e!==null;)Hl(e,t,i),e=e.sibling}function Dm(e){var t=e.stateNode,i=e.memoizedProps;try{for(var l=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);At(t,l,i),t[Qe]=e,t[it]=i}catch(u){Ge(e,e.return,u)}}var ss=!1,pt=!1,wu=!1,zm=typeof WeakSet=="function"?WeakSet:Set,xt=null;function Ab(e,t){if(e=e.containerInfo,Yu=lo,e=Jh(e),pc(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var l=i.getSelection&&i.getSelection();if(l&&l.rangeCount!==0){i=l.anchorNode;var c=l.anchorOffset,u=l.focusNode;l=l.focusOffset;try{i.nodeType,u.nodeType}catch{i=null;break e}var p=0,b=-1,j=-1,B=0,Y=0,Q=e,L=null;t:for(;;){for(var P;Q!==i||c!==0&&Q.nodeType!==3||(b=p+c),Q!==u||l!==0&&Q.nodeType!==3||(j=p+l),Q.nodeType===3&&(p+=Q.nodeValue.length),(P=Q.firstChild)!==null;)L=Q,Q=P;for(;;){if(Q===e)break t;if(L===i&&++B===c&&(b=p),L===u&&++Y===l&&(j=p),(P=Q.nextSibling)!==null)break;Q=L,L=Q.parentNode}Q=P}i=b===-1||j===-1?null:{start:b,end:j}}else i=null}i=i||{start:0,end:0}}else i=null;for(Gu={focusedElem:e,selectionRange:i},lo=!1,xt=t;xt!==null;)if(t=xt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,xt=e;else for(;xt!==null;){switch(t=xt,u=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(i=0;i<e.length;i++)c=e[i],c.ref.impl=c.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&u!==null){e=void 0,i=t,c=u.memoizedProps,u=u.memoizedState,l=i.stateNode;try{var he=wi(i.type,c);e=l.getSnapshotBeforeUpdate(he,u),l.__reactInternalSnapshotBeforeUpdate=e}catch(ye){Ge(i,i.return,ye)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,i=e.nodeType,i===9)Ju(e);else if(i===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Ju(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(a(163))}if(e=t.sibling,e!==null){e.return=t.return,xt=e;break}xt=t.return}}function qm(e,t,i){var l=i.flags;switch(i.tag){case 0:case 11:case 15:rs(e,i),l&4&&la(5,i);break;case 1:if(rs(e,i),l&4)if(e=i.stateNode,t===null)try{e.componentDidMount()}catch(p){Ge(i,i.return,p)}else{var c=wi(i.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(p){Ge(i,i.return,p)}}l&64&&Cm(i),l&512&&oa(i,i.return);break;case 3:if(rs(e,i),l&64&&(e=i.updateQueue,e!==null)){if(t=null,i.child!==null)switch(i.child.tag){case 27:case 5:t=i.child.stateNode;break;case 1:t=i.child.stateNode}try{vd(e,t)}catch(p){Ge(i,i.return,p)}}break;case 27:t===null&&l&4&&Dm(i);case 26:case 5:rs(e,i),t===null&&l&4&&Mm(i),l&512&&oa(i,i.return);break;case 12:rs(e,i);break;case 31:rs(e,i),l&4&&Lm(e,i);break;case 13:rs(e,i),l&4&&Hm(e,i),l&64&&(e=i.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(i=Db.bind(null,i),ex(e,i))));break;case 22:if(l=i.memoizedState!==null||ss,!l){t=t!==null&&t.memoizedState!==null||pt,c=ss;var u=pt;ss=l,(pt=t)&&!u?as(e,i,(i.subtreeFlags&8772)!==0):rs(e,i),ss=c,pt=u}break;case 30:break;default:rs(e,i)}}function Um(e){var t=e.alternate;t!==null&&(e.alternate=null,Um(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&zi(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var tt=null,qt=!1;function is(e,t,i){for(i=i.child;i!==null;)Bm(e,t,i),i=i.sibling}function Bm(e,t,i){if(ot&&typeof ot.onCommitFiberUnmount=="function")try{ot.onCommitFiberUnmount(si,i)}catch{}switch(i.tag){case 26:pt||qn(i,t),is(e,t,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:pt||qn(i,t);var l=tt,c=qt;Bs(i.type)&&(tt=i.stateNode,qt=!1),is(e,t,i),ya(i.stateNode),tt=l,qt=c;break;case 5:pt||qn(i,t);case 6:if(l=tt,c=qt,tt=null,is(e,t,i),tt=l,qt=c,tt!==null)if(qt)try{(tt.nodeType===9?tt.body:tt.nodeName==="HTML"?tt.ownerDocument.body:tt).removeChild(i.stateNode)}catch(u){Ge(i,t,u)}else try{tt.removeChild(i.stateNode)}catch(u){Ge(i,t,u)}break;case 18:tt!==null&&(qt?(e=tt,Cp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,i.stateNode),mr(e)):Cp(tt,i.stateNode));break;case 4:l=tt,c=qt,tt=i.stateNode.containerInfo,qt=!0,is(e,t,i),tt=l,qt=c;break;case 0:case 11:case 14:case 15:ks(2,i,t),pt||ks(4,i,t),is(e,t,i);break;case 1:pt||(qn(i,t),l=i.stateNode,typeof l.componentWillUnmount=="function"&&km(i,t,l)),is(e,t,i);break;case 21:is(e,t,i);break;case 22:pt=(l=pt)||i.memoizedState!==null,is(e,t,i),pt=l;break;default:is(e,t,i)}}function Lm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{mr(e)}catch(i){Ge(t,t.return,i)}}}function Hm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{mr(e)}catch(i){Ge(t,t.return,i)}}function jb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new zm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new zm),t;default:throw Error(a(435,e.tag))}}function Pl(e,t){var i=jb(e);t.forEach(function(l){if(!i.has(l)){i.add(l);var c=zb.bind(null,e,l);l.then(c,c)}})}function Ut(e,t){var i=t.deletions;if(i!==null)for(var l=0;l<i.length;l++){var c=i[l],u=e,p=t,b=p;e:for(;b!==null;){switch(b.tag){case 27:if(Bs(b.type)){tt=b.stateNode,qt=!1;break e}break;case 5:tt=b.stateNode,qt=!1;break e;case 3:case 4:tt=b.stateNode.containerInfo,qt=!0;break e}b=b.return}if(tt===null)throw Error(a(160));Bm(u,p,c),tt=null,qt=!1,u=c.alternate,u!==null&&(u.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Pm(t,e),t=t.sibling}var On=null;function Pm(e,t){var i=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ut(t,e),Bt(e),l&4&&(ks(3,e,e.return),la(3,e),ks(5,e,e.return));break;case 1:Ut(t,e),Bt(e),l&512&&(pt||i===null||qn(i,i.return)),l&64&&ss&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(i=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=i===null?l:i.concat(l))));break;case 26:var c=On;if(Ut(t,e),Bt(e),l&512&&(pt||i===null||qn(i,i.return)),l&4){var u=i!==null?i.memoizedState:null;if(l=e.memoizedState,i===null)if(l===null)if(e.stateNode===null){e:{l=e.type,i=e.memoizedProps,c=c.ownerDocument||c;t:switch(l){case"title":u=c.getElementsByTagName("title")[0],(!u||u[yt]||u[Qe]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=c.createElement(l),c.head.insertBefore(u,c.querySelector("head > title"))),At(u,l,i),u[Qe]=e,N(u),l=u;break e;case"link":var p=Pp("link","href",c).get(l+(i.href||""));if(p){for(var b=0;b<p.length;b++)if(u=p[b],u.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&u.getAttribute("rel")===(i.rel==null?null:i.rel)&&u.getAttribute("title")===(i.title==null?null:i.title)&&u.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){p.splice(b,1);break t}}u=c.createElement(l),At(u,l,i),c.head.appendChild(u);break;case"meta":if(p=Pp("meta","content",c).get(l+(i.content||""))){for(b=0;b<p.length;b++)if(u=p[b],u.getAttribute("content")===(i.content==null?null:""+i.content)&&u.getAttribute("name")===(i.name==null?null:i.name)&&u.getAttribute("property")===(i.property==null?null:i.property)&&u.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&u.getAttribute("charset")===(i.charSet==null?null:i.charSet)){p.splice(b,1);break t}}u=c.createElement(l),At(u,l,i),c.head.appendChild(u);break;default:throw Error(a(468,l))}u[Qe]=e,N(u),l=u}e.stateNode=l}else $p(c,e.type,e.stateNode);else e.stateNode=Hp(c,l,e.memoizedProps);else u!==l?(u===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):u.count--,l===null?$p(c,e.type,e.stateNode):Hp(c,l,e.memoizedProps)):l===null&&e.stateNode!==null&&xu(e,e.memoizedProps,i.memoizedProps)}break;case 27:Ut(t,e),Bt(e),l&512&&(pt||i===null||qn(i,i.return)),i!==null&&l&4&&xu(e,e.memoizedProps,i.memoizedProps);break;case 5:if(Ut(t,e),Bt(e),l&512&&(pt||i===null||qn(i,i.return)),e.flags&32){c=e.stateNode;try{Ui(c,"")}catch(he){Ge(e,e.return,he)}}l&4&&e.stateNode!=null&&(c=e.memoizedProps,xu(e,c,i!==null?i.memoizedProps:c)),l&1024&&(wu=!0);break;case 6:if(Ut(t,e),Bt(e),l&4){if(e.stateNode===null)throw Error(a(162));l=e.memoizedProps,i=e.stateNode;try{i.nodeValue=l}catch(he){Ge(e,e.return,he)}}break;case 3:if(so=null,c=On,On=to(t.containerInfo),Ut(t,e),On=c,Bt(e),l&4&&i!==null&&i.memoizedState.isDehydrated)try{mr(t.containerInfo)}catch(he){Ge(e,e.return,he)}wu&&(wu=!1,$m(e));break;case 4:l=On,On=to(e.stateNode.containerInfo),Ut(t,e),Bt(e),On=l;break;case 12:Ut(t,e),Bt(e);break;case 31:Ut(t,e),Bt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Pl(e,l)));break;case 13:Ut(t,e),Bt(e),e.child.flags&8192&&e.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(Yl=et()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Pl(e,l)));break;case 22:c=e.memoizedState!==null;var j=i!==null&&i.memoizedState!==null,B=ss,Y=pt;if(ss=B||c,pt=Y||j,Ut(t,e),pt=Y,ss=B,Bt(e),l&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(i===null||j||ss||pt||Si(e)),i=null,t=e;;){if(t.tag===5||t.tag===26){if(i===null){j=i=t;try{if(u=j.stateNode,c)p=u.style,typeof p.setProperty=="function"?p.setProperty("display","none","important"):p.display="none";else{b=j.stateNode;var Q=j.memoizedProps.style,L=Q!=null&&Q.hasOwnProperty("display")?Q.display:null;b.style.display=L==null||typeof L=="boolean"?"":(""+L).trim()}}catch(he){Ge(j,j.return,he)}}}else if(t.tag===6){if(i===null){j=t;try{j.stateNode.nodeValue=c?"":j.memoizedProps}catch(he){Ge(j,j.return,he)}}}else if(t.tag===18){if(i===null){j=t;try{var P=j.stateNode;c?kp(P,!0):kp(j.stateNode,!1)}catch(he){Ge(j,j.return,he)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;i===t&&(i=null),t=t.return}i===t&&(i=null),t.sibling.return=t.return,t=t.sibling}l&4&&(l=e.updateQueue,l!==null&&(i=l.retryQueue,i!==null&&(l.retryQueue=null,Pl(e,i))));break;case 19:Ut(t,e),Bt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Pl(e,l)));break;case 30:break;case 21:break;default:Ut(t,e),Bt(e)}}function Bt(e){var t=e.flags;if(t&2){try{for(var i,l=e.return;l!==null;){if(Rm(l)){i=l;break}l=l.return}if(i==null)throw Error(a(160));switch(i.tag){case 27:var c=i.stateNode,u=vu(e);Hl(e,u,c);break;case 5:var p=i.stateNode;i.flags&32&&(Ui(p,""),i.flags&=-33);var b=vu(e);Hl(e,b,p);break;case 3:case 4:var j=i.stateNode.containerInfo,B=vu(e);_u(e,B,j);break;default:throw Error(a(161))}}catch(Y){Ge(e,e.return,Y)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function $m(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;$m(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function rs(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)qm(e,t.alternate,t),t=t.sibling}function Si(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:ks(4,t,t.return),Si(t);break;case 1:qn(t,t.return);var i=t.stateNode;typeof i.componentWillUnmount=="function"&&km(t,t.return,i),Si(t);break;case 27:ya(t.stateNode);case 26:case 5:qn(t,t.return),Si(t);break;case 22:t.memoizedState===null&&Si(t);break;case 30:Si(t);break;default:Si(t)}e=e.sibling}}function as(e,t,i){for(i=i&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,c=e,u=t,p=u.flags;switch(u.tag){case 0:case 11:case 15:as(c,u,i),la(4,u);break;case 1:if(as(c,u,i),l=u,c=l.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(B){Ge(l,l.return,B)}if(l=u,c=l.updateQueue,c!==null){var b=l.stateNode;try{var j=c.shared.hiddenCallbacks;if(j!==null)for(c.shared.hiddenCallbacks=null,c=0;c<j.length;c++)xd(j[c],b)}catch(B){Ge(l,l.return,B)}}i&&p&64&&Cm(u),oa(u,u.return);break;case 27:Dm(u);case 26:case 5:as(c,u,i),i&&l===null&&p&4&&Mm(u),oa(u,u.return);break;case 12:as(c,u,i);break;case 31:as(c,u,i),i&&p&4&&Lm(c,u);break;case 13:as(c,u,i),i&&p&4&&Hm(c,u);break;case 22:u.memoizedState===null&&as(c,u,i),oa(u,u.return);break;case 30:break;default:as(c,u,i)}t=t.sibling}}function Su(e,t){var i=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==i&&(e!=null&&e.refCount++,i!=null&&Ir(i))}function Eu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ir(e))}function Tn(e,t,i,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Ym(e,t,i,l),t=t.sibling}function Ym(e,t,i,l){var c=t.flags;switch(t.tag){case 0:case 11:case 15:Tn(e,t,i,l),c&2048&&la(9,t);break;case 1:Tn(e,t,i,l);break;case 3:Tn(e,t,i,l),c&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ir(e)));break;case 12:if(c&2048){Tn(e,t,i,l),e=t.stateNode;try{var u=t.memoizedProps,p=u.id,b=u.onPostCommit;typeof b=="function"&&b(p,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(j){Ge(t,t.return,j)}}else Tn(e,t,i,l);break;case 31:Tn(e,t,i,l);break;case 13:Tn(e,t,i,l);break;case 23:break;case 22:u=t.stateNode,p=t.alternate,t.memoizedState!==null?u._visibility&2?Tn(e,t,i,l):ca(e,t):u._visibility&2?Tn(e,t,i,l):(u._visibility|=2,sr(e,t,i,l,(t.subtreeFlags&10256)!==0||!1)),c&2048&&Su(p,t);break;case 24:Tn(e,t,i,l),c&2048&&Eu(t.alternate,t);break;default:Tn(e,t,i,l)}}function sr(e,t,i,l,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,p=t,b=i,j=l,B=p.flags;switch(p.tag){case 0:case 11:case 15:sr(u,p,b,j,c),la(8,p);break;case 23:break;case 22:var Y=p.stateNode;p.memoizedState!==null?Y._visibility&2?sr(u,p,b,j,c):ca(u,p):(Y._visibility|=2,sr(u,p,b,j,c)),c&&B&2048&&Su(p.alternate,p);break;case 24:sr(u,p,b,j,c),c&&B&2048&&Eu(p.alternate,p);break;default:sr(u,p,b,j,c)}t=t.sibling}}function ca(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var i=e,l=t,c=l.flags;switch(l.tag){case 22:ca(i,l),c&2048&&Su(l.alternate,l);break;case 24:ca(i,l),c&2048&&Eu(l.alternate,l);break;default:ca(i,l)}t=t.sibling}}var ua=8192;function ir(e,t,i){if(e.subtreeFlags&ua)for(e=e.child;e!==null;)Gm(e,t,i),e=e.sibling}function Gm(e,t,i){switch(e.tag){case 26:ir(e,t,i),e.flags&ua&&e.memoizedState!==null&&hx(i,On,e.memoizedState,e.memoizedProps);break;case 5:ir(e,t,i);break;case 3:case 4:var l=On;On=to(e.stateNode.containerInfo),ir(e,t,i),On=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=ua,ua=16777216,ir(e,t,i),ua=l):ir(e,t,i));break;default:ir(e,t,i)}}function Vm(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 fa(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var i=0;i<t.length;i++){var l=t[i];xt=l,Jm(l,e)}Vm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Fm(e),e=e.sibling}function Fm(e){switch(e.tag){case 0:case 11:case 15:fa(e),e.flags&2048&&ks(9,e,e.return);break;case 3:fa(e);break;case 12:fa(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,$l(e)):fa(e);break;default:fa(e)}}function $l(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var i=0;i<t.length;i++){var l=t[i];xt=l,Jm(l,e)}Vm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:ks(8,t,t.return),$l(t);break;case 22:i=t.stateNode,i._visibility&2&&(i._visibility&=-3,$l(t));break;default:$l(t)}e=e.sibling}}function Jm(e,t){for(;xt!==null;){var i=xt;switch(i.tag){case 0:case 11:case 15:ks(8,i,t);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var l=i.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Ir(i.memoizedState.cache)}if(l=i.child,l!==null)l.return=i,xt=l;else e:for(i=e;xt!==null;){l=xt;var c=l.sibling,u=l.return;if(Um(l),l===i){xt=null;break e}if(c!==null){c.return=u,xt=c;break e}xt=u}}}var Ob={getCacheForType:function(e){var t=St(ht),i=t.data.get(e);return i===void 0&&(i=e(),t.data.set(e,i)),i},cacheSignal:function(){return St(ht).controller.signal}},Tb=typeof WeakMap=="function"?WeakMap:Map,Pe=0,Xe=null,Ne=null,Re=0,Ye=0,It=null,Ms=!1,rr=!1,Au=!1,ls=0,at=0,Rs=0,Ei=0,ju=0,Qt=0,ar=0,ha=null,Lt=null,Ou=!1,Yl=0,Im=0,Gl=1/0,Vl=null,Ds=null,bt=0,zs=null,lr=null,os=0,Tu=0,Nu=null,Qm=null,da=0,Cu=null;function Xt(){return(Pe&2)!==0&&Re!==0?Re&-Re:$.T!==null?qu():zr()}function Xm(){if(Qt===0)if((Re&536870912)===0||ze){var e=Gn;Gn<<=1,(Gn&3932160)===0&&(Gn=262144),Qt=e}else Qt=536870912;return e=Ft.current,e!==null&&(e.flags|=32),Qt}function Ht(e,t,i){(e===Xe&&(Ye===2||Ye===9)||e.cancelPendingCommit!==null)&&(or(e,0),qs(e,Re,Qt,!1)),En(e,i),((Pe&2)===0||e!==Xe)&&(e===Xe&&((Pe&2)===0&&(Ei|=i),at===4&&qs(e,Re,Qt,!1)),Un(e))}function Km(e,t,i){if((Pe&6)!==0)throw Error(a(327));var l=!i&&(t&127)===0&&(t&e.expiredLanes)===0||ri(e,t),c=l?kb(e,t):Mu(e,t,!0),u=l;do{if(c===0){rr&&!l&&qs(e,t,0,!1);break}else{if(i=e.current.alternate,u&&!Nb(i)){c=Mu(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=ha;var j=b.current.memoizedState.isDehydrated;if(j&&(or(b,p).flags|=256),p=Mu(b,p,!1),p!==2){if(Au&&!j){b.errorRecoveryDisabledLanes|=u,Ei|=u,c=4;break e}u=Lt,Lt=c,u!==null&&(Lt===null?Lt=u:Lt.push.apply(Lt,u))}c=p}if(u=!1,c!==2)continue}}if(c===1){or(e,0),qs(e,t,0,!0);break}e:{switch(l=e,u=c,u){case 0:case 1:throw Error(a(345));case 4:if((t&4194048)!==t)break;case 6:qs(l,t,Qt,!Ms);break e;case 2:Lt=null;break;case 3:case 5:break;default:throw Error(a(329))}if((t&62914560)===t&&(c=Yl+300-et(),10<c)){if(qs(l,t,Qt,!Ms),ii(l,0,!0)!==0)break e;os=t,l.timeoutHandle=Tp(Zm.bind(null,l,i,Lt,Vl,Ou,t,Qt,Ei,ar,Ms,u,"Throttled",-0,0),c);break e}Zm(l,i,Lt,Vl,Ou,t,Qt,Ei,ar,Ms,u,null,-0,0)}}break}while(!0);Un(e)}function Zm(e,t,i,l,c,u,p,b,j,B,Y,Q,L,P){if(e.timeoutHandle=-1,Q=t.subtreeFlags,Q&8192||(Q&16785408)===16785408){Q={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Jn},Gm(t,u,Q);var he=(u&62914560)===u?Yl-et():(u&4194048)===u?Im-et():0;if(he=dx(Q,he),he!==null){os=u,e.cancelPendingCommit=he(ap.bind(null,e,t,u,i,l,c,p,b,j,Y,Q,null,L,P)),qs(e,u,p,!B);return}}ap(e,t,u,i,l,c,p,b,j)}function Nb(e){for(var t=e;;){var i=t.tag;if((i===0||i===11||i===15)&&t.flags&16384&&(i=t.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var l=0;l<i.length;l++){var c=i[l],u=c.getSnapshot;c=c.value;try{if(!Gt(u(),c))return!1}catch{return!1}}if(i=t.child,t.subtreeFlags&16384&&i!==null)i.return=t,t=i;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function qs(e,t,i,l){t&=~ju,t&=~Ei,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var c=t;0<c;){var u=31-Nt(c),p=1<<u;l[u]=-1,c&=~p}i!==0&&xs(e,i,t)}function Fl(){return(Pe&6)===0?(ma(0),!1):!0}function ku(){if(Ne!==null){if(Ye===0)var e=Ne.return;else e=Ne,Kn=pi=null,Jc(e),Zi=null,Xr=0,e=Ne;for(;e!==null;)Nm(e.alternate,e),e=e.return;Ne=null}}function or(e,t){var i=e.timeoutHandle;i!==-1&&(e.timeoutHandle=-1,Qb(i)),i=e.cancelPendingCommit,i!==null&&(e.cancelPendingCommit=null,i()),os=0,ku(),Xe=e,Ne=i=Qn(e.current,null),Re=t,Ye=0,It=null,Ms=!1,rr=ri(e,t),Au=!1,ar=Qt=ju=Ei=Rs=at=0,Lt=ha=null,Ou=!1,(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var c=31-Nt(l),u=1<<c;t|=e[c],l&=~u}return ls=t,dl(),i}function Wm(e,t){Ee=null,$.H=ia,t===Ki||t===_l?(t=pd(),Ye=3):t===zc?(t=pd(),Ye=4):Ye=t===cu?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,It=t,Ne===null&&(at=1,zl(e,fn(t,e.current)))}function ep(){var e=Ft.current;return e===null?!0:(Re&4194048)===Re?pn===null:(Re&62914560)===Re||(Re&536870912)!==0?e===pn:!1}function tp(){var e=$.H;return $.H=ia,e===null?ia:e}function np(){var e=$.A;return $.A=Ob,e}function Jl(){at=4,Ms||(Re&4194048)!==Re&&Ft.current!==null||(rr=!0),(Rs&134217727)===0&&(Ei&134217727)===0||Xe===null||qs(Xe,Re,Qt,!1)}function Mu(e,t,i){var l=Pe;Pe|=2;var c=tp(),u=np();(Xe!==e||Re!==t)&&(Vl=null,or(e,t)),t=!1;var p=at;e:do try{if(Ye!==0&&Ne!==null){var b=Ne,j=It;switch(Ye){case 8:ku(),p=6;break e;case 3:case 2:case 9:case 6:Ft.current===null&&(t=!0);var B=Ye;if(Ye=0,It=null,cr(e,b,j,B),i&&rr){p=0;break e}break;default:B=Ye,Ye=0,It=null,cr(e,b,j,B)}}Cb(),p=at;break}catch(Y){Wm(e,Y)}while(!0);return t&&e.shellSuspendCounter++,Kn=pi=null,Pe=l,$.H=c,$.A=u,Ne===null&&(Xe=null,Re=0,dl()),p}function Cb(){for(;Ne!==null;)sp(Ne)}function kb(e,t){var i=Pe;Pe|=2;var l=tp(),c=np();Xe!==e||Re!==t?(Vl=null,Gl=et()+500,or(e,t)):rr=ri(e,t);e:do try{if(Ye!==0&&Ne!==null){t=Ne;var u=It;t:switch(Ye){case 1:Ye=0,It=null,cr(e,t,u,1);break;case 2:case 9:if(dd(u)){Ye=0,It=null,ip(t);break}t=function(){Ye!==2&&Ye!==9||Xe!==e||(Ye=7),Un(e)},u.then(t,t);break e;case 3:Ye=7;break e;case 4:Ye=5;break e;case 7:dd(u)?(Ye=0,It=null,ip(t)):(Ye=0,It=null,cr(e,t,u,7));break;case 5:var p=null;switch(Ne.tag){case 26:p=Ne.memoizedState;case 5:case 27:var b=Ne;if(p?Yp(p):b.stateNode.complete){Ye=0,It=null;var j=b.sibling;if(j!==null)Ne=j;else{var B=b.return;B!==null?(Ne=B,Il(B)):Ne=null}break t}}Ye=0,It=null,cr(e,t,u,5);break;case 6:Ye=0,It=null,cr(e,t,u,6);break;case 8:ku(),at=6;break e;default:throw Error(a(462))}}Mb();break}catch(Y){Wm(e,Y)}while(!0);return Kn=pi=null,$.H=l,$.A=c,Pe=i,Ne!==null?0:(Xe=null,Re=0,dl(),at)}function Mb(){for(;Ne!==null&&!Xa();)sp(Ne)}function sp(e){var t=Om(e.alternate,e,ls);e.memoizedProps=e.pendingProps,t===null?Il(e):Ne=t}function ip(e){var t=e,i=t.alternate;switch(t.tag){case 15:case 0:t=_m(i,t,t.pendingProps,t.type,void 0,Re);break;case 11:t=_m(i,t,t.pendingProps,t.type.render,t.ref,Re);break;case 5:Jc(t);default:Nm(i,t),t=Ne=nd(t,ls),t=Om(i,t,ls)}e.memoizedProps=e.pendingProps,t===null?Il(e):Ne=t}function cr(e,t,i,l){Kn=pi=null,Jc(t),Zi=null,Xr=0;var c=t.return;try{if(vb(e,c,t,i,Re)){at=1,zl(e,fn(i,e.current)),Ne=null;return}}catch(u){if(c!==null)throw Ne=c,u;at=1,zl(e,fn(i,e.current)),Ne=null;return}t.flags&32768?(ze||l===1?e=!0:rr||(Re&536870912)!==0?e=!1:(Ms=e=!0,(l===2||l===9||l===3||l===6)&&(l=Ft.current,l!==null&&l.tag===13&&(l.flags|=16384))),rp(t,e)):Il(t)}function Il(e){var t=e;do{if((t.flags&32768)!==0){rp(t,Ms);return}e=t.return;var i=Sb(t.alternate,t,ls);if(i!==null){Ne=i;return}if(t=t.sibling,t!==null){Ne=t;return}Ne=t=e}while(t!==null);at===0&&(at=5)}function rp(e,t){do{var i=Eb(e.alternate,e);if(i!==null){i.flags&=32767,Ne=i;return}if(i=e.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!t&&(e=e.sibling,e!==null)){Ne=e;return}Ne=e=i}while(e!==null);at=6,Ne=null}function ap(e,t,i,l,c,u,p,b,j){e.cancelPendingCommit=null;do Ql();while(bt!==0);if((Pe&6)!==0)throw Error(a(327));if(t!==null){if(t===e.current)throw Error(a(177));if(u=t.lanes|t.childLanes,u|=vc,bs(e,i,u,p,b,j),e===Xe&&(Ne=Xe=null,Re=0),lr=t,zs=e,os=i,Tu=u,Nu=c,Qm=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,qb(Mi,function(){return fp(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=$.T,$.T=null,c=te.p,te.p=2,p=Pe,Pe|=4;try{Ab(e,t,i)}finally{Pe=p,te.p=c,$.T=l}}bt=1,lp(),op(),cp()}}function lp(){if(bt===1){bt=0;var e=zs,t=lr,i=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||i){i=$.T,$.T=null;var l=te.p;te.p=2;var c=Pe;Pe|=4;try{Pm(t,e);var u=Gu,p=Jh(e.containerInfo),b=u.focusedElem,j=u.selectionRange;if(p!==b&&b&&b.ownerDocument&&Fh(b.ownerDocument.documentElement,b)){if(j!==null&&pc(b)){var B=j.start,Y=j.end;if(Y===void 0&&(Y=B),"selectionStart"in b)b.selectionStart=B,b.selectionEnd=Math.min(Y,b.value.length);else{var Q=b.ownerDocument||document,L=Q&&Q.defaultView||window;if(L.getSelection){var P=L.getSelection(),he=b.textContent.length,ye=Math.min(j.start,he),Ie=j.end===void 0?ye:Math.min(j.end,he);!P.extend&&ye>Ie&&(p=Ie,Ie=ye,ye=p);var R=Vh(b,ye),k=Vh(b,Ie);if(R&&k&&(P.rangeCount!==1||P.anchorNode!==R.node||P.anchorOffset!==R.offset||P.focusNode!==k.node||P.focusOffset!==k.offset)){var U=Q.createRange();U.setStart(R.node,R.offset),P.removeAllRanges(),ye>Ie?(P.addRange(U),P.extend(k.node,k.offset)):(U.setEnd(k.node,k.offset),P.addRange(U))}}}}for(Q=[],P=b;P=P.parentNode;)P.nodeType===1&&Q.push({element:P,left:P.scrollLeft,top:P.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<Q.length;b++){var F=Q[b];F.element.scrollLeft=F.left,F.element.scrollTop=F.top}}lo=!!Yu,Gu=Yu=null}finally{Pe=c,te.p=l,$.T=i}}e.current=t,bt=2}}function op(){if(bt===2){bt=0;var e=zs,t=lr,i=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||i){i=$.T,$.T=null;var l=te.p;te.p=2;var c=Pe;Pe|=4;try{qm(e,t.alternate,t)}finally{Pe=c,te.p=l,$.T=i}}bt=3}}function cp(){if(bt===4||bt===3){bt=0,ki();var e=zs,t=lr,i=os,l=Qm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?bt=5:(bt=0,lr=zs=null,up(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(Ds=null),li(i),t=t.stateNode,ot&&typeof ot.onCommitFiberRoot=="function")try{ot.onCommitFiberRoot(si,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=$.T,c=te.p,te.p=2,$.T=null;try{for(var u=e.onRecoverableError,p=0;p<l.length;p++){var b=l[p];u(b.value,{componentStack:b.stack})}}finally{$.T=t,te.p=c}}(os&3)!==0&&Ql(),Un(e),c=e.pendingLanes,(i&261930)!==0&&(c&42)!==0?e===Cu?da++:(da=0,Cu=e):da=0,ma(0)}}function up(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Ir(t)))}function Ql(){return lp(),op(),cp(),fp()}function fp(){if(bt!==5)return!1;var e=zs,t=Tu;Tu=0;var i=li(os),l=$.T,c=te.p;try{te.p=32>i?32:i,$.T=null,i=Nu,Nu=null;var u=zs,p=os;if(bt=0,lr=zs=null,os=0,(Pe&6)!==0)throw Error(a(331));var b=Pe;if(Pe|=4,Fm(u.current),Ym(u,u.current,p,i),Pe=b,ma(0,!1),ot&&typeof ot.onPostCommitFiberRoot=="function")try{ot.onPostCommitFiberRoot(si,u)}catch{}return!0}finally{te.p=c,$.T=l,up(e,t)}}function hp(e,t,i){t=fn(i,t),t=ou(e.stateNode,t,2),e=Ts(e,t,2),e!==null&&(En(e,2),Un(e))}function Ge(e,t,i){if(e.tag===3)hp(e,e,i);else for(;t!==null;){if(t.tag===3){hp(t,e,i);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Ds===null||!Ds.has(l))){e=fn(i,e),i=dm(2),l=Ts(t,i,2),l!==null&&(mm(i,l,t,e),En(l,2),Un(l));break}}t=t.return}}function Ru(e,t,i){var l=e.pingCache;if(l===null){l=e.pingCache=new Tb;var c=new Set;l.set(t,c)}else c=l.get(t),c===void 0&&(c=new Set,l.set(t,c));c.has(i)||(Au=!0,c.add(i),e=Rb.bind(null,e,t,i),t.then(e,e))}function Rb(e,t,i){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,Xe===e&&(Re&i)===i&&(at===4||at===3&&(Re&62914560)===Re&&300>et()-Yl?(Pe&2)===0&&or(e,0):ju|=i,ar===Re&&(ar=0)),Un(e)}function dp(e,t){t===0&&(t=Di()),e=hi(e,t),e!==null&&(En(e,t),Un(e))}function Db(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),dp(e,i)}function zb(e,t){var i=0;switch(e.tag){case 31:case 13:var l=e.stateNode,c=e.memoizedState;c!==null&&(i=c.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(a(314))}l!==null&&l.delete(t),dp(e,i)}function qb(e,t){return kr(e,t)}var Xl=null,ur=null,Du=!1,Kl=!1,zu=!1,Us=0;function Un(e){e!==ur&&e.next===null&&(ur===null?Xl=ur=e:ur=ur.next=e),Kl=!0,Du||(Du=!0,Bb())}function ma(e,t){if(!zu&&Kl){zu=!0;do for(var i=!1,l=Xl;l!==null;){if(e!==0){var c=l.pendingLanes;if(c===0)var u=0;else{var p=l.suspendedLanes,b=l.pingedLanes;u=(1<<31-Nt(42|e)+1)-1,u&=c&~(p&~b),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(i=!0,yp(l,u))}else u=Re,u=ii(l,l===Xe?u:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(u&3)===0||ri(l,u)||(i=!0,yp(l,u));l=l.next}while(i);zu=!1}}function Ub(){mp()}function mp(){Kl=Du=!1;var e=0;Us!==0&&Ib()&&(e=Us);for(var t=et(),i=null,l=Xl;l!==null;){var c=l.next,u=pp(l,t);u===0?(l.next=null,i===null?Xl=c:i.next=c,c===null&&(ur=i)):(i=l,(e!==0||(u&3)!==0)&&(Kl=!0)),l=c}bt!==0&&bt!==5||ma(e),Us!==0&&(Us=0)}function pp(e,t){for(var i=e.suspendedLanes,l=e.pingedLanes,c=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var p=31-Nt(u),b=1<<p,j=c[p];j===-1?((b&i)===0||(b&l)!==0)&&(c[p]=Dr(b,t)):j<=t&&(e.expiredLanes|=b),u&=~b}if(t=Xe,i=Re,i=ii(e,e===t?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,i===0||e===t&&(Ye===2||Ye===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&Yn(l),e.callbackNode=null,e.callbackPriority=0;if((i&3)===0||ri(e,i)){if(t=i&-i,t===e.callbackPriority)return t;switch(l!==null&&Yn(l),li(i)){case 2:case 8:i=Za;break;case 32:i=Mi;break;case 268435456:i=Wa;break;default:i=Mi}return l=gp.bind(null,e),i=kr(i,l),e.callbackPriority=t,e.callbackNode=i,t}return l!==null&&l!==null&&Yn(l),e.callbackPriority=2,e.callbackNode=null,2}function gp(e,t){if(bt!==0&&bt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var i=e.callbackNode;if(Ql()&&e.callbackNode!==i)return null;var l=Re;return l=ii(e,e===Xe?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Km(e,l,t),pp(e,et()),e.callbackNode!=null&&e.callbackNode===i?gp.bind(null,e):null)}function yp(e,t){if(Ql())return null;Km(e,t,!0)}function Bb(){Xb(function(){(Pe&6)!==0?kr(Ka,Ub):mp()})}function qu(){if(Us===0){var e=Qi;e===0&&(e=ps,ps<<=1,(ps&261888)===0&&(ps=256)),Us=e}return Us}function bp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:rl(""+e)}function xp(e,t){var i=t.ownerDocument.createElement("input");return i.name=t.name,i.value=t.value,e.id&&i.setAttribute("form",e.id),t.parentNode.insertBefore(i,t),e=new FormData(e),i.parentNode.removeChild(i),e}function Lb(e,t,i,l,c){if(t==="submit"&&i&&i.stateNode===c){var u=bp((c[it]||null).action),p=l.submitter;p&&(t=(t=p[it]||null)?bp(t.formAction):p.getAttribute("formAction"),t!==null&&(u=t,p=null));var b=new cl("action","action",null,l,c);e.push({event:b,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Us!==0){var j=p?xp(c,p):new FormData(c);nu(i,{pending:!0,data:j,method:c.method,action:u},null,j)}}else typeof u=="function"&&(b.preventDefault(),j=p?xp(c,p):new FormData(c),nu(i,{pending:!0,data:j,method:c.method,action:u},u,j))},currentTarget:c}]})}}for(var Uu=0;Uu<xc.length;Uu++){var Bu=xc[Uu],Hb=Bu.toLowerCase(),Pb=Bu[0].toUpperCase()+Bu.slice(1);jn(Hb,"on"+Pb)}jn(Xh,"onAnimationEnd"),jn(Kh,"onAnimationIteration"),jn(Zh,"onAnimationStart"),jn("dblclick","onDoubleClick"),jn("focusin","onFocus"),jn("focusout","onBlur"),jn(sb,"onTransitionRun"),jn(ib,"onTransitionStart"),jn(rb,"onTransitionCancel"),jn(Wh,"onTransitionEnd"),H("onMouseEnter",["mouseout","mouseover"]),H("onMouseLeave",["mouseout","mouseover"]),H("onPointerEnter",["pointerout","pointerover"]),H("onPointerLeave",["pointerout","pointerover"]),Z("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Z("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Z("onBeforeInput",["compositionend","keypress","textInput","paste"]),Z("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Z("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Z("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var pa="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(" "),$b=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(pa));function vp(e,t){t=(t&4)!==0;for(var i=0;i<e.length;i++){var l=e[i],c=l.event;l=l.listeners;e:{var u=void 0;if(t)for(var p=l.length-1;0<=p;p--){var b=l[p],j=b.instance,B=b.currentTarget;if(b=b.listener,j!==u&&c.isPropagationStopped())break e;u=b,c.currentTarget=B;try{u(c)}catch(Y){hl(Y)}c.currentTarget=null,u=j}else for(p=0;p<l.length;p++){if(b=l[p],j=b.instance,B=b.currentTarget,b=b.listener,j!==u&&c.isPropagationStopped())break e;u=b,c.currentTarget=B;try{u(c)}catch(Y){hl(Y)}c.currentTarget=null,u=j}}}}function Ce(e,t){var i=t[oi];i===void 0&&(i=t[oi]=new Set);var l=e+"__bubble";i.has(l)||(_p(t,e,2,!1),i.add(l))}function Lu(e,t,i){var l=0;t&&(l|=4),_p(i,e,l,t)}var Zl="_reactListening"+Math.random().toString(36).slice(2);function Hu(e){if(!e[Zl]){e[Zl]=!0,z.forEach(function(i){i!=="selectionchange"&&($b.has(i)||Lu(i,!1,e),Lu(i,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Zl]||(t[Zl]=!0,Lu("selectionchange",!1,t))}}function _p(e,t,i,l){switch(Xp(t)){case 2:var c=gx;break;case 8:c=yx;break;default:c=tf}i=c.bind(null,t,i,e),c=void 0,!ac||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),l?c!==void 0?e.addEventListener(t,i,{capture:!0,passive:c}):e.addEventListener(t,i,!0):c!==void 0?e.addEventListener(t,i,{passive:c}):e.addEventListener(t,i,!1)}function Pu(e,t,i,l,c){var u=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var p=l.tag;if(p===3||p===4){var b=l.stateNode.containerInfo;if(b===c)break;if(p===4)for(p=l.return;p!==null;){var j=p.tag;if((j===3||j===4)&&p.stateNode.containerInfo===c)return;p=p.return}for(;b!==null;){if(p=x(b),p===null)return;if(j=p.tag,j===5||j===6||j===26||j===27){l=u=p;continue e}b=b.parentNode}}l=l.return}jh(function(){var B=u,Y=ic(i),Q=[];e:{var L=ed.get(e);if(L!==void 0){var P=cl,he=e;switch(e){case"keypress":if(ll(i)===0)break e;case"keydown":case"keyup":P=zy;break;case"focusin":he="focus",P=uc;break;case"focusout":he="blur",P=uc;break;case"beforeblur":case"afterblur":P=uc;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":P=Nh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":P=Sy;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":P=By;break;case Xh:case Kh:case Zh:P=jy;break;case Wh:P=Hy;break;case"scroll":case"scrollend":P=_y;break;case"wheel":P=$y;break;case"copy":case"cut":case"paste":P=Ty;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":P=kh;break;case"toggle":case"beforetoggle":P=Gy}var ye=(t&4)!==0,Ie=!ye&&(e==="scroll"||e==="scrollend"),R=ye?L!==null?L+"Capture":null:L;ye=[];for(var k=B,U;k!==null;){var F=k;if(U=F.stateNode,F=F.tag,F!==5&&F!==26&&F!==27||U===null||R===null||(F=Ur(k,R),F!=null&&ye.push(ga(k,F,U))),Ie)break;k=k.return}0<ye.length&&(L=new P(L,he,null,i,Y),Q.push({event:L,listeners:ye}))}}if((t&7)===0){e:{if(L=e==="mouseover"||e==="pointerover",P=e==="mouseout"||e==="pointerout",L&&i!==sc&&(he=i.relatedTarget||i.fromElement)&&(x(he)||he[Yt]))break e;if((P||L)&&(L=Y.window===Y?Y:(L=Y.ownerDocument)?L.defaultView||L.parentWindow:window,P?(he=i.relatedTarget||i.toElement,P=B,he=he?x(he):null,he!==null&&(Ie=f(he),ye=he.tag,he!==Ie||ye!==5&&ye!==27&&ye!==6)&&(he=null)):(P=null,he=B),P!==he)){if(ye=Nh,F="onMouseLeave",R="onMouseEnter",k="mouse",(e==="pointerout"||e==="pointerover")&&(ye=kh,F="onPointerLeave",R="onPointerEnter",k="pointer"),Ie=P==null?L:_(P),U=he==null?L:_(he),L=new ye(F,k+"leave",P,i,Y),L.target=Ie,L.relatedTarget=U,F=null,x(Y)===B&&(ye=new ye(R,k+"enter",he,i,Y),ye.target=U,ye.relatedTarget=Ie,F=ye),Ie=F,P&&he)t:{for(ye=Yb,R=P,k=he,U=0,F=R;F;F=ye(F))U++;F=0;for(var ge=k;ge;ge=ye(ge))F++;for(;0<U-F;)R=ye(R),U--;for(;0<F-U;)k=ye(k),F--;for(;U--;){if(R===k||k!==null&&R===k.alternate){ye=R;break t}R=ye(R),k=ye(k)}ye=null}else ye=null;P!==null&&wp(Q,L,P,ye,!1),he!==null&&Ie!==null&&wp(Q,Ie,he,ye,!0)}}e:{if(L=B?_(B):window,P=L.nodeName&&L.nodeName.toLowerCase(),P==="select"||P==="input"&&L.type==="file")var Be=Lh;else if(Uh(L))if(Hh)Be=eb;else{Be=Zy;var pe=Ky}else P=L.nodeName,!P||P.toLowerCase()!=="input"||L.type!=="checkbox"&&L.type!=="radio"?B&&nc(B.elementType)&&(Be=Lh):Be=Wy;if(Be&&(Be=Be(e,B))){Bh(Q,Be,i,Y);break e}pe&&pe(e,L,B),e==="focusout"&&B&&L.type==="number"&&B.memoizedProps.value!=null&&tc(L,"number",L.value)}switch(pe=B?_(B):window,e){case"focusin":(Uh(pe)||pe.contentEditable==="true")&&(Pi=pe,gc=B,Vr=null);break;case"focusout":Vr=gc=Pi=null;break;case"mousedown":yc=!0;break;case"contextmenu":case"mouseup":case"dragend":yc=!1,Ih(Q,i,Y);break;case"selectionchange":if(nb)break;case"keydown":case"keyup":Ih(Q,i,Y)}var Ae;if(hc)e:{switch(e){case"compositionstart":var De="onCompositionStart";break e;case"compositionend":De="onCompositionEnd";break e;case"compositionupdate":De="onCompositionUpdate";break e}De=void 0}else Hi?zh(e,i)&&(De="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(De="onCompositionStart");De&&(Mh&&i.locale!=="ko"&&(Hi||De!=="onCompositionStart"?De==="onCompositionEnd"&&Hi&&(Ae=Oh()):(_s=Y,lc="value"in _s?_s.value:_s.textContent,Hi=!0)),pe=Wl(B,De),0<pe.length&&(De=new Ch(De,e,null,i,Y),Q.push({event:De,listeners:pe}),Ae?De.data=Ae:(Ae=qh(i),Ae!==null&&(De.data=Ae)))),(Ae=Fy?Jy(e,i):Iy(e,i))&&(De=Wl(B,"onBeforeInput"),0<De.length&&(pe=new Ch("onBeforeInput","beforeinput",null,i,Y),Q.push({event:pe,listeners:De}),pe.data=Ae)),Lb(Q,e,B,i,Y)}vp(Q,t)})}function ga(e,t,i){return{instance:e,listener:t,currentTarget:i}}function Wl(e,t){for(var i=t+"Capture",l=[];e!==null;){var c=e,u=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||u===null||(c=Ur(e,i),c!=null&&l.unshift(ga(e,c,u)),c=Ur(e,t),c!=null&&l.push(ga(e,c,u))),e.tag===3)return l;e=e.return}return[]}function Yb(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function wp(e,t,i,l,c){for(var u=t._reactName,p=[];i!==null&&i!==l;){var b=i,j=b.alternate,B=b.stateNode;if(b=b.tag,j!==null&&j===l)break;b!==5&&b!==26&&b!==27||B===null||(j=B,c?(B=Ur(i,u),B!=null&&p.unshift(ga(i,B,j))):c||(B=Ur(i,u),B!=null&&p.push(ga(i,B,j)))),i=i.return}p.length!==0&&e.push({event:t,listeners:p})}var Gb=/\r\n?/g,Vb=/\u0000|\uFFFD/g;function Sp(e){return(typeof e=="string"?e:""+e).replace(Gb,`
|
|
26
|
+
`).replace(Vb,"")}function Ep(e,t){return t=Sp(t),Sp(e)===t}function Je(e,t,i,l,c,u){switch(i){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||Ui(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&Ui(e,""+l);break;case"className":An(e,"class",l);break;case"tabIndex":An(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":An(e,i,l);break;case"style":Eh(e,l,u);break;case"data":if(t!=="object"){An(e,"data",l);break}case"src":case"href":if(l===""&&(t!=="a"||i!=="href")){e.removeAttribute(i);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(i);break}l=rl(""+l),e.setAttribute(i,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(i,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof u=="function"&&(i==="formAction"?(t!=="input"&&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(i);break}l=rl(""+l),e.setAttribute(i,l);break;case"onClick":l!=null&&(e.onclick=Jn);break;case"onScroll":l!=null&&Ce("scroll",e);break;case"onScrollEnd":l!=null&&Ce("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(i=l.__html,i!=null){if(c.children!=null)throw Error(a(60));e.innerHTML=i}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}i=rl(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,""+l):e.removeAttribute(i);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,""):e.removeAttribute(i);break;case"capture":case"download":l===!0?e.setAttribute(i,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,l):e.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(i,l):e.removeAttribute(i);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(i):e.setAttribute(i,l);break;case"popover":Ce("beforetoggle",e),Ce("toggle",e),Ct(e,"popover",l);break;case"xlinkActuate":Fn(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Fn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Fn(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Fn(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Fn(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Fn(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Fn(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Fn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Fn(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Ct(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=xy.get(i)||i,Ct(e,i,l))}}function $u(e,t,i,l,c,u){switch(i){case"style":Eh(e,l,u);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(i=l.__html,i!=null){if(c.children!=null)throw Error(a(60));e.innerHTML=i}}break;case"children":typeof l=="string"?Ui(e,l):(typeof l=="number"||typeof l=="bigint")&&Ui(e,""+l);break;case"onScroll":l!=null&&Ce("scroll",e);break;case"onScrollEnd":l!=null&&Ce("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Jn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!I.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(c=i.endsWith("Capture"),t=i.slice(2,c?i.length-7:void 0),u=e[it]||null,u=u!=null?u[i]:null,typeof u=="function"&&e.removeEventListener(t,u,c),typeof l=="function")){typeof u!="function"&&u!==null&&(i in e?e[i]=null:e.hasAttribute(i)&&e.removeAttribute(i)),e.addEventListener(t,l,c);break e}i in e?e[i]=l:l===!0?e.setAttribute(i,""):Ct(e,i,l)}}}function At(e,t,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ce("error",e),Ce("load",e);var l=!1,c=!1,u;for(u in i)if(i.hasOwnProperty(u)){var p=i[u];if(p!=null)switch(u){case"src":l=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,t));default:Je(e,t,u,p,i,null)}}c&&Je(e,t,"srcSet",i.srcSet,i,null),l&&Je(e,t,"src",i.src,i,null);return;case"input":Ce("invalid",e);var b=u=p=c=null,j=null,B=null;for(l in i)if(i.hasOwnProperty(l)){var Y=i[l];if(Y!=null)switch(l){case"name":c=Y;break;case"type":p=Y;break;case"checked":j=Y;break;case"defaultChecked":B=Y;break;case"value":u=Y;break;case"defaultValue":b=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(a(137,t));break;default:Je(e,t,l,Y,i,null)}}vh(e,u,b,j,B,p,c,!1);return;case"select":Ce("invalid",e),l=p=u=null;for(c in i)if(i.hasOwnProperty(c)&&(b=i[c],b!=null))switch(c){case"value":u=b;break;case"defaultValue":p=b;break;case"multiple":l=b;default:Je(e,t,c,b,i,null)}t=u,i=p,e.multiple=!!l,t!=null?qi(e,!!l,t,!1):i!=null&&qi(e,!!l,i,!0);return;case"textarea":Ce("invalid",e),u=c=l=null;for(p in i)if(i.hasOwnProperty(p)&&(b=i[p],b!=null))switch(p){case"value":l=b;break;case"defaultValue":c=b;break;case"children":u=b;break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(a(91));break;default:Je(e,t,p,b,i,null)}wh(e,l,c,u);return;case"option":for(j in i)if(i.hasOwnProperty(j)&&(l=i[j],l!=null))switch(j){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:Je(e,t,j,l,i,null)}return;case"dialog":Ce("beforetoggle",e),Ce("toggle",e),Ce("cancel",e),Ce("close",e);break;case"iframe":case"object":Ce("load",e);break;case"video":case"audio":for(l=0;l<pa.length;l++)Ce(pa[l],e);break;case"image":Ce("error",e),Ce("load",e);break;case"details":Ce("toggle",e);break;case"embed":case"source":case"link":Ce("error",e),Ce("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(B in i)if(i.hasOwnProperty(B)&&(l=i[B],l!=null))switch(B){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,t));default:Je(e,t,B,l,i,null)}return;default:if(nc(t)){for(Y in i)i.hasOwnProperty(Y)&&(l=i[Y],l!==void 0&&$u(e,t,Y,l,i,void 0));return}}for(b in i)i.hasOwnProperty(b)&&(l=i[b],l!=null&&Je(e,t,b,l,i,null))}function Fb(e,t,i,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,u=null,p=null,b=null,j=null,B=null,Y=null;for(P in i){var Q=i[P];if(i.hasOwnProperty(P)&&Q!=null)switch(P){case"checked":break;case"value":break;case"defaultValue":j=Q;default:l.hasOwnProperty(P)||Je(e,t,P,null,l,Q)}}for(var L in l){var P=l[L];if(Q=i[L],l.hasOwnProperty(L)&&(P!=null||Q!=null))switch(L){case"type":u=P;break;case"name":c=P;break;case"checked":B=P;break;case"defaultChecked":Y=P;break;case"value":p=P;break;case"defaultValue":b=P;break;case"children":case"dangerouslySetInnerHTML":if(P!=null)throw Error(a(137,t));break;default:P!==Q&&Je(e,t,L,P,l,Q)}}ec(e,p,b,j,B,Y,u,c);return;case"select":P=p=b=L=null;for(u in i)if(j=i[u],i.hasOwnProperty(u)&&j!=null)switch(u){case"value":break;case"multiple":P=j;default:l.hasOwnProperty(u)||Je(e,t,u,null,l,j)}for(c in l)if(u=l[c],j=i[c],l.hasOwnProperty(c)&&(u!=null||j!=null))switch(c){case"value":L=u;break;case"defaultValue":b=u;break;case"multiple":p=u;default:u!==j&&Je(e,t,c,u,l,j)}t=b,i=p,l=P,L!=null?qi(e,!!i,L,!1):!!l!=!!i&&(t!=null?qi(e,!!i,t,!0):qi(e,!!i,i?[]:"",!1));return;case"textarea":P=L=null;for(b in i)if(c=i[b],i.hasOwnProperty(b)&&c!=null&&!l.hasOwnProperty(b))switch(b){case"value":break;case"children":break;default:Je(e,t,b,null,l,c)}for(p in l)if(c=l[p],u=i[p],l.hasOwnProperty(p)&&(c!=null||u!=null))switch(p){case"value":L=c;break;case"defaultValue":P=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(a(91));break;default:c!==u&&Je(e,t,p,c,l,u)}_h(e,L,P);return;case"option":for(var he in i)if(L=i[he],i.hasOwnProperty(he)&&L!=null&&!l.hasOwnProperty(he))switch(he){case"selected":e.selected=!1;break;default:Je(e,t,he,null,l,L)}for(j in l)if(L=l[j],P=i[j],l.hasOwnProperty(j)&&L!==P&&(L!=null||P!=null))switch(j){case"selected":e.selected=L&&typeof L!="function"&&typeof L!="symbol";break;default:Je(e,t,j,L,l,P)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ye in i)L=i[ye],i.hasOwnProperty(ye)&&L!=null&&!l.hasOwnProperty(ye)&&Je(e,t,ye,null,l,L);for(B in l)if(L=l[B],P=i[B],l.hasOwnProperty(B)&&L!==P&&(L!=null||P!=null))switch(B){case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(a(137,t));break;default:Je(e,t,B,L,l,P)}return;default:if(nc(t)){for(var Ie in i)L=i[Ie],i.hasOwnProperty(Ie)&&L!==void 0&&!l.hasOwnProperty(Ie)&&$u(e,t,Ie,void 0,l,L);for(Y in l)L=l[Y],P=i[Y],!l.hasOwnProperty(Y)||L===P||L===void 0&&P===void 0||$u(e,t,Y,L,l,P);return}}for(var R in i)L=i[R],i.hasOwnProperty(R)&&L!=null&&!l.hasOwnProperty(R)&&Je(e,t,R,null,l,L);for(Q in l)L=l[Q],P=i[Q],!l.hasOwnProperty(Q)||L===P||L==null&&P==null||Je(e,t,Q,L,l,P)}function Ap(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Jb(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,i=performance.getEntriesByType("resource"),l=0;l<i.length;l++){var c=i[l],u=c.transferSize,p=c.initiatorType,b=c.duration;if(u&&b&&Ap(p)){for(p=0,b=c.responseEnd,l+=1;l<i.length;l++){var j=i[l],B=j.startTime;if(B>b)break;var Y=j.transferSize,Q=j.initiatorType;Y&&Ap(Q)&&(j=j.responseEnd,p+=Y*(j<b?1:(b-B)/(j-B)))}if(--l,t+=8*(u+p)/(c.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Yu=null,Gu=null;function eo(e){return e.nodeType===9?e:e.ownerDocument}function jp(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 Op(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 Vu(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 Fu=null;function Ib(){var e=window.event;return e&&e.type==="popstate"?e===Fu?!1:(Fu=e,!0):(Fu=null,!1)}var Tp=typeof setTimeout=="function"?setTimeout:void 0,Qb=typeof clearTimeout=="function"?clearTimeout:void 0,Np=typeof Promise=="function"?Promise:void 0,Xb=typeof queueMicrotask=="function"?queueMicrotask:typeof Np<"u"?function(e){return Np.resolve(null).then(e).catch(Kb)}:Tp;function Kb(e){setTimeout(function(){throw e})}function Bs(e){return e==="head"}function Cp(e,t){var i=t,l=0;do{var c=i.nextSibling;if(e.removeChild(i),c&&c.nodeType===8)if(i=c.data,i==="/$"||i==="/&"){if(l===0){e.removeChild(c),mr(t);return}l--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")l++;else if(i==="html")ya(e.ownerDocument.documentElement);else if(i==="head"){i=e.ownerDocument.head,ya(i);for(var u=i.firstChild;u;){var p=u.nextSibling,b=u.nodeName;u[yt]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&u.rel.toLowerCase()==="stylesheet"||i.removeChild(u),u=p}}else i==="body"&&ya(e.ownerDocument.body);i=c}while(i);mr(t)}function kp(e,t){var i=e;e=0;do{var l=i.nextSibling;if(i.nodeType===1?t?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(t?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),l&&l.nodeType===8)if(i=l.data,i==="/$"){if(e===0)break;e--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||e++;i=l}while(i)}function Ju(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var i=t;switch(t=t.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":Ju(i),zi(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}e.removeChild(i)}}function Zb(e,t,i,l){for(;e.nodeType===1;){var c=i;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[yt])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(u=e.getAttribute("rel"),u==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(u!==c.rel||e.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||e.getAttribute("title")!==(c.title==null?null:c.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(u=e.getAttribute("src"),(u!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&u&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var u=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===u)return e}else return e;if(e=gn(e.nextSibling),e===null)break}return null}function Wb(e,t,i){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=gn(e.nextSibling),e===null))return null;return e}function Mp(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=gn(e.nextSibling),e===null))return null;return e}function Iu(e){return e.data==="$?"||e.data==="$~"}function Qu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function ex(e,t){var i=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||i.readyState!=="loading")t();else{var l=function(){t(),i.removeEventListener("DOMContentLoaded",l)};i.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function gn(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 Xu=null;function Rp(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"||i==="/&"){if(t===0)return gn(e.nextSibling);t--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||t++}e=e.nextSibling}return null}function Dp(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(t===0)return e;t--}else i!=="/$"&&i!=="/&"||t++}e=e.previousSibling}return null}function zp(e,t,i){switch(t=eo(i),e){case"html":if(e=t.documentElement,!e)throw Error(a(452));return e;case"head":if(e=t.head,!e)throw Error(a(453));return e;case"body":if(e=t.body,!e)throw Error(a(454));return e;default:throw Error(a(451))}}function ya(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);zi(e)}var yn=new Map,qp=new Set;function to(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var cs=te.d;te.d={f:tx,r:nx,D:sx,C:ix,L:rx,m:ax,X:ox,S:lx,M:cx};function tx(){var e=cs.f(),t=Fl();return e||t}function nx(e){var t=S(e);t!==null&&t.tag===5&&t.type==="form"?Wd(t):cs.r(e)}var fr=typeof document>"u"?null:document;function Up(e,t,i){var l=fr;if(l&&typeof t=="string"&&t){var c=cn(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof i=="string"&&(c+='[crossorigin="'+i+'"]'),qp.has(c)||(qp.add(c),e={rel:e,crossOrigin:i,href:t},l.querySelector(c)===null&&(t=l.createElement("link"),At(t,"link",e),N(t),l.head.appendChild(t)))}}function sx(e){cs.D(e),Up("dns-prefetch",e,null)}function ix(e,t){cs.C(e,t),Up("preconnect",e,t)}function rx(e,t,i){cs.L(e,t,i);var l=fr;if(l&&e&&t){var c='link[rel="preload"][as="'+cn(t)+'"]';t==="image"&&i&&i.imageSrcSet?(c+='[imagesrcset="'+cn(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(c+='[imagesizes="'+cn(i.imageSizes)+'"]')):c+='[href="'+cn(e)+'"]';var u=c;switch(t){case"style":u=hr(e);break;case"script":u=dr(e)}yn.has(u)||(e=w({rel:"preload",href:t==="image"&&i&&i.imageSrcSet?void 0:e,as:t},i),yn.set(u,e),l.querySelector(c)!==null||t==="style"&&l.querySelector(ba(u))||t==="script"&&l.querySelector(xa(u))||(t=l.createElement("link"),At(t,"link",e),N(t),l.head.appendChild(t)))}}function ax(e,t){cs.m(e,t);var i=fr;if(i&&e){var l=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+cn(l)+'"][href="'+cn(e)+'"]',u=c;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=dr(e)}if(!yn.has(u)&&(e=w({rel:"modulepreload",href:e},t),yn.set(u,e),i.querySelector(c)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(xa(u)))return}l=i.createElement("link"),At(l,"link",e),N(l),i.head.appendChild(l)}}}function lx(e,t,i){cs.S(e,t,i);var l=fr;if(l&&e){var c=A(l).hoistableStyles,u=hr(e);t=t||"default";var p=c.get(u);if(!p){var b={loading:0,preload:null};if(p=l.querySelector(ba(u)))b.loading=5;else{e=w({rel:"stylesheet",href:e,"data-precedence":t},i),(i=yn.get(u))&&Ku(e,i);var j=p=l.createElement("link");N(j),At(j,"link",e),j._p=new Promise(function(B,Y){j.onload=B,j.onerror=Y}),j.addEventListener("load",function(){b.loading|=1}),j.addEventListener("error",function(){b.loading|=2}),b.loading|=4,no(p,t,l)}p={type:"stylesheet",instance:p,count:1,state:b},c.set(u,p)}}}function ox(e,t){cs.X(e,t);var i=fr;if(i&&e){var l=A(i).hoistableScripts,c=dr(e),u=l.get(c);u||(u=i.querySelector(xa(c)),u||(e=w({src:e,async:!0},t),(t=yn.get(c))&&Zu(e,t),u=i.createElement("script"),N(u),At(u,"link",e),i.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(c,u))}}function cx(e,t){cs.M(e,t);var i=fr;if(i&&e){var l=A(i).hoistableScripts,c=dr(e),u=l.get(c);u||(u=i.querySelector(xa(c)),u||(e=w({src:e,async:!0,type:"module"},t),(t=yn.get(c))&&Zu(e,t),u=i.createElement("script"),N(u),At(u,"link",e),i.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(c,u))}}function Bp(e,t,i,l){var c=(c=an.current)?to(c):null;if(!c)throw Error(a(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(t=hr(i.href),i=A(c).hoistableStyles,l=i.get(t),l||(l={type:"style",instance:null,count:0,state:null},i.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){e=hr(i.href);var u=A(c).hoistableStyles,p=u.get(e);if(p||(c=c.ownerDocument||c,p={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,p),(u=c.querySelector(ba(e)))&&!u._p&&(p.instance=u,p.state.loading=5),yn.has(e)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},yn.set(e,i),u||ux(c,e,i,p.state))),t&&l===null)throw Error(a(528,""));return p}if(t&&l!==null)throw Error(a(529,""));return null;case"script":return t=i.async,i=i.src,typeof i=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=dr(i),i=A(c).hoistableScripts,l=i.get(t),l||(l={type:"script",instance:null,count:0,state:null},i.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,e))}}function hr(e){return'href="'+cn(e)+'"'}function ba(e){return'link[rel="stylesheet"]['+e+"]"}function Lp(e){return w({},e,{"data-precedence":e.precedence,precedence:null})}function ux(e,t,i,l){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=e.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),At(t,"link",i),N(t),e.head.appendChild(t))}function dr(e){return'[src="'+cn(e)+'"]'}function xa(e){return"script[async]"+e}function Hp(e,t,i){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+cn(i.href)+'"]');if(l)return t.instance=l,N(l),l;var c=w({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),N(l),At(l,"style",c),no(l,i.precedence,e),t.instance=l;case"stylesheet":c=hr(i.href);var u=e.querySelector(ba(c));if(u)return t.state.loading|=4,t.instance=u,N(u),u;l=Lp(i),(c=yn.get(c))&&Ku(l,c),u=(e.ownerDocument||e).createElement("link"),N(u);var p=u;return p._p=new Promise(function(b,j){p.onload=b,p.onerror=j}),At(u,"link",l),t.state.loading|=4,no(u,i.precedence,e),t.instance=u;case"script":return u=dr(i.src),(c=e.querySelector(xa(u)))?(t.instance=c,N(c),c):(l=i,(c=yn.get(u))&&(l=w({},i),Zu(l,c)),e=e.ownerDocument||e,c=e.createElement("script"),N(c),At(c,"link",l),e.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(a(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,no(l,i.precedence,e));return t.instance}function no(e,t,i){for(var l=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=l.length?l[l.length-1]:null,u=c,p=0;p<l.length;p++){var b=l[p];if(b.dataset.precedence===t)u=b;else if(u!==c)break}u?u.parentNode.insertBefore(e,u.nextSibling):(t=i.nodeType===9?i.head:i,t.insertBefore(e,t.firstChild))}function Ku(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Zu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var so=null;function Pp(e,t,i){if(so===null){var l=new Map,c=so=new Map;c.set(i,l)}else c=so,l=c.get(i),l||(l=new Map,c.set(i,l));if(l.has(e))return l;for(l.set(e,null),i=i.getElementsByTagName(e),c=0;c<i.length;c++){var u=i[c];if(!(u[yt]||u[Qe]||e==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var p=u.getAttribute(t)||"";p=e+p;var b=l.get(p);b?b.push(u):l.set(p,[u])}}return l}function $p(e,t,i){e=e.ownerDocument||e,e.head.insertBefore(i,t==="title"?e.querySelector("head > title"):null)}function fx(e,t,i){if(i===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Yp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function hx(e,t,i,l){if(i.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var c=hr(l.href),u=t.querySelector(ba(c));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=io.bind(e),t.then(e,e)),i.state.loading|=4,i.instance=u,N(u);return}u=t.ownerDocument||t,l=Lp(l),(c=yn.get(c))&&Ku(l,c),u=u.createElement("link"),N(u);var p=u;p._p=new Promise(function(b,j){p.onload=b,p.onerror=j}),At(u,"link",l),i.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(i,t),(t=i.state.preload)&&(i.state.loading&3)===0&&(e.count++,i=io.bind(e),t.addEventListener("load",i),t.addEventListener("error",i))}}var Wu=0;function dx(e,t){return e.stylesheets&&e.count===0&&ao(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var l=setTimeout(function(){if(e.stylesheets&&ao(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&Wu===0&&(Wu=62500*Jb());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ao(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>Wu?50:800)+t);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(c)}}:null}function io(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ao(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ro=null;function ao(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ro=new Map,t.forEach(mx,e),ro=null,io.call(e))}function mx(e,t){if(!(t.state.loading&4)){var i=ro.get(e);if(i)var l=i.get(null);else{i=new Map,ro.set(e,i);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<c.length;u++){var p=c[u];(p.nodeName==="LINK"||p.getAttribute("media")!=="not all")&&(i.set(p.dataset.precedence,p),l=p)}l&&i.set(null,l)}c=t.instance,p=c.getAttribute("data-precedence"),u=i.get(p)||l,u===l&&i.set(null,c),i.set(p,c),this.count++,l=io.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 va={$$typeof:me,Provider:null,Consumer:null,_currentValue:de,_currentValue2:de,_threadCount:0};function px(e,t,i,l,c,u,p,b,j){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ys(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ys(0),this.hiddenUpdates=ys(null),this.identifierPrefix=l,this.onUncaughtError=c,this.onCaughtError=u,this.onRecoverableError=p,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=j,this.incompleteTransitions=new Map}function Gp(e,t,i,l,c,u,p,b,j,B,Y,Q){return e=new px(e,t,i,p,j,B,Y,Q,b),t=1,u===!0&&(t|=24),u=Vt(3,null,null,t),e.current=u,u.stateNode=e,t=Mc(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:l,isDehydrated:i,cache:t},qc(u),e}function Vp(e){return e?(e=Gi,e):Gi}function Fp(e,t,i,l,c,u){c=Vp(c),l.context===null?l.context=c:l.pendingContext=c,l=Os(t),l.payload={element:i},u=u===void 0?null:u,u!==null&&(l.callback=u),i=Ts(e,l,t),i!==null&&(Ht(i,e,t),Zr(i,e,t))}function Jp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<t?i:t}}function ef(e,t){Jp(e,t),(e=e.alternate)&&Jp(e,t)}function Ip(e){if(e.tag===13||e.tag===31){var t=hi(e,67108864);t!==null&&Ht(t,e,67108864),ef(e,67108864)}}function Qp(e){if(e.tag===13||e.tag===31){var t=Xt();t=Vn(t);var i=hi(e,t);i!==null&&Ht(i,e,t),ef(e,t)}}var lo=!0;function gx(e,t,i,l){var c=$.T;$.T=null;var u=te.p;try{te.p=2,tf(e,t,i,l)}finally{te.p=u,$.T=c}}function yx(e,t,i,l){var c=$.T;$.T=null;var u=te.p;try{te.p=8,tf(e,t,i,l)}finally{te.p=u,$.T=c}}function tf(e,t,i,l){if(lo){var c=nf(l);if(c===null)Pu(e,t,l,oo,i),Kp(e,l);else if(xx(c,e,t,i,l))l.stopPropagation();else if(Kp(e,l),t&4&&-1<bx.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=Sn(u.pendingLanes);if(p!==0){var b=u;for(b.pendingLanes|=2,b.entangledLanes|=2;p;){var j=1<<31-Nt(p);b.entanglements[1]|=j,p&=~j}Un(u),(Pe&6)===0&&(Gl=et()+500,ma(0))}}break;case 31:case 13:b=hi(u,2),b!==null&&Ht(b,u,2),Fl(),ef(u,2)}if(u=nf(l),u===null&&Pu(e,t,l,oo,i),u===c)break;c=u}c!==null&&l.stopPropagation()}else Pu(e,t,l,null,i)}}function nf(e){return e=ic(e),sf(e)}var oo=null;function sf(e){if(oo=null,e=x(e),e!==null){var t=f(e);if(t===null)e=null;else{var i=t.tag;if(i===13){if(e=h(t),e!==null)return e;e=null}else if(i===31){if(e=m(t),e!==null)return e;e=null}else if(i===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return oo=e,null}function Xp(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(Xo()){case Ka:return 2;case Za:return 8;case Mi:case Ko:return 32;case Wa:return 268435456;default:return 32}default:return 32}}var rf=!1,Ls=null,Hs=null,Ps=null,_a=new Map,wa=new Map,$s=[],bx="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 Kp(e,t){switch(e){case"focusin":case"focusout":Ls=null;break;case"dragenter":case"dragleave":Hs=null;break;case"mouseover":case"mouseout":Ps=null;break;case"pointerover":case"pointerout":_a.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":wa.delete(t.pointerId)}}function Sa(e,t,i,l,c,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:i,eventSystemFlags:l,nativeEvent:u,targetContainers:[c]},t!==null&&(t=S(t),t!==null&&Ip(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function xx(e,t,i,l,c){switch(t){case"focusin":return Ls=Sa(Ls,e,t,i,l,c),!0;case"dragenter":return Hs=Sa(Hs,e,t,i,l,c),!0;case"mouseover":return Ps=Sa(Ps,e,t,i,l,c),!0;case"pointerover":var u=c.pointerId;return _a.set(u,Sa(_a.get(u)||null,e,t,i,l,c)),!0;case"gotpointercapture":return u=c.pointerId,wa.set(u,Sa(wa.get(u)||null,e,t,i,l,c)),!0}return!1}function Zp(e){var t=x(e.target);if(t!==null){var i=f(t);if(i!==null){if(t=i.tag,t===13){if(t=h(i),t!==null){e.blockedOn=t,tl(e.priority,function(){Qp(i)});return}}else if(t===31){if(t=m(i),t!==null){e.blockedOn=t,tl(e.priority,function(){Qp(i)});return}}else if(t===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function co(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var i=nf(e.nativeEvent);if(i===null){i=e.nativeEvent;var l=new i.constructor(i.type,i);sc=l,i.target.dispatchEvent(l),sc=null}else return t=S(i),t!==null&&Ip(t),e.blockedOn=i,!1;t.shift()}return!0}function Wp(e,t,i){co(e)&&i.delete(t)}function vx(){rf=!1,Ls!==null&&co(Ls)&&(Ls=null),Hs!==null&&co(Hs)&&(Hs=null),Ps!==null&&co(Ps)&&(Ps=null),_a.forEach(Wp),wa.forEach(Wp)}function uo(e,t){e.blockedOn===t&&(e.blockedOn=null,rf||(rf=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,vx)))}var fo=null;function e0(e){fo!==e&&(fo=e,r.unstable_scheduleCallback(r.unstable_NormalPriority,function(){fo===e&&(fo=null);for(var t=0;t<e.length;t+=3){var i=e[t],l=e[t+1],c=e[t+2];if(typeof l!="function"){if(sf(l||i)===null)continue;break}var u=S(i);u!==null&&(e.splice(t,3),t-=3,nu(u,{pending:!0,data:c,method:i.method,action:l},l,c))}}))}function mr(e){function t(j){return uo(j,e)}Ls!==null&&uo(Ls,e),Hs!==null&&uo(Hs,e),Ps!==null&&uo(Ps,e),_a.forEach(t),wa.forEach(t);for(var i=0;i<$s.length;i++){var l=$s[i];l.blockedOn===e&&(l.blockedOn=null)}for(;0<$s.length&&(i=$s[0],i.blockedOn===null);)Zp(i),i.blockedOn===null&&$s.shift();if(i=(e.ownerDocument||e).$$reactFormReplay,i!=null)for(l=0;l<i.length;l+=3){var c=i[l],u=i[l+1],p=c[it]||null;if(typeof u=="function")p||e0(i);else if(p){var b=null;if(u&&u.hasAttribute("formAction")){if(c=u,p=u[it]||null)b=p.formAction;else if(sf(c)!==null)continue}else b=p.action;typeof b=="function"?i[l+1]=b:(i.splice(l,3),l-=3),e0(i)}}}function t0(){function e(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(p){return c=p})},focusReset:"manual",scroll:"manual"})}function t(){c!==null&&(c(),c=null),l||setTimeout(i,20)}function i(){if(!l&&!navigation.transition){var u=navigation.currentEntry;u&&u.url!=null&&navigation.navigate(u.url,{state:u.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,c=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(i,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),c!==null&&(c(),c=null)}}}function af(e){this._internalRoot=e}ho.prototype.render=af.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(a(409));var i=t.current,l=Xt();Fp(i,l,e,t,null,null)},ho.prototype.unmount=af.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Fp(e.current,2,null,e,null,null),Fl(),t[Yt]=null}};function ho(e){this._internalRoot=e}ho.prototype.unstable_scheduleHydration=function(e){if(e){var t=zr();e={blockedOn:null,target:e,priority:t};for(var i=0;i<$s.length&&t!==0&&t<$s[i].priority;i++);$s.splice(i,0,e),i===0&&Zp(e)}};var n0=n.version;if(n0!=="19.2.4")throw Error(a(527,n0,"19.2.4"));te.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(a(188)):(e=Object.keys(e).join(","),Error(a(268,e)));return e=y(t),e=e!==null?E(e):null,e=e===null?null:e.stateNode,e};var _x={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:$,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var mo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!mo.isDisabled&&mo.supportsFiber)try{si=mo.inject(_x),ot=mo}catch{}}return Ea.createRoot=function(e,t){if(!o(e))throw Error(a(299));var i=!1,l="",c=cm,u=um,p=fm;return t!=null&&(t.unstable_strictMode===!0&&(i=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(c=t.onUncaughtError),t.onCaughtError!==void 0&&(u=t.onCaughtError),t.onRecoverableError!==void 0&&(p=t.onRecoverableError)),t=Gp(e,1,!1,null,null,i,l,null,c,u,p,t0),e[Yt]=t.current,Hu(e),new af(t)},Ea.hydrateRoot=function(e,t,i){if(!o(e))throw Error(a(299));var l=!1,c="",u=cm,p=um,b=fm,j=null;return i!=null&&(i.unstable_strictMode===!0&&(l=!0),i.identifierPrefix!==void 0&&(c=i.identifierPrefix),i.onUncaughtError!==void 0&&(u=i.onUncaughtError),i.onCaughtError!==void 0&&(p=i.onCaughtError),i.onRecoverableError!==void 0&&(b=i.onRecoverableError),i.formState!==void 0&&(j=i.formState)),t=Gp(e,1,!0,t,i??null,l,c,j,u,p,b,t0),t.context=Vp(null),i=t.current,l=Xt(),l=Vn(l),c=Os(l),c.callback=null,Ts(i,c,l),i=l,t.current.lanes=i,En(t,i),Un(t),e[Yt]=t.current,Hu(e),new ho(t)},Ea.version="19.2.4",Ea}var u0;function rv(){if(u0)return lf.exports;u0=1;function r(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(n){console.error(n)}}return r(),lf.exports=iv(),lf.exports}var av=rv();const lv="modulepreload",ov=function(r,n){return new URL(r,n).href},f0={},ve=function(n,s,a){let o=Promise.resolve();if(s&&s.length>0){let h=function(E){return Promise.all(E.map(w=>Promise.resolve(w).then(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=h(s.map(E=>{if(E=ov(E,a),E in f0)return;f0[E]=!0;const w=E.endsWith(".css"),T=w?'[rel="stylesheet"]':"";if(!!a)for(let D=m.length-1;D>=0;D--){const W=m[D];if(W.href===E&&(!w||W.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${E}"]${T}`))return;const M=document.createElement("link");if(M.rel=w?"stylesheet":lv,w||(M.as="script"),M.crossOrigin="",M.href=E,y&&M.setAttribute("nonce",y),document.head.appendChild(M),w)return new Promise((D,W)=>{M.addEventListener("load",D),M.addEventListener("error",()=>W(new Error(`Unable to preload CSS for ${E}`)))})}))}function f(h){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=h,window.dispatchEvent(m),!m.defaultPrevented)throw h}return o.then(h=>{for(const m of h||[])m.status==="rejected"&&f(m.reason);return n().catch(f)})};function Zf(r){try{const n=r.split(".");if(n.length!==3)return null;const s=atob(n[1].replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(s)}catch{return null}}function yg(r){const n=Zf(r);return!n||typeof n.exp!="number"?null:n.exp}function Wf(r,n=0){const s=yg(r);return s===null?!0:Date.now()/1e3>=s-n}const Wt=window.__LT_BASE__??"",jf=`${Wt}/api`;let Fs=null;function po(r){Fs=r}function bg(){return Fs}async function h0(){const r=sessionStorage.getItem("lt_credentials");if(!r)return null;try{const{username:n,password:s}=JSON.parse(r),a=await fetch(`${jf}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:n,password:s})});if(!a.ok)return null;const o=await a.json();return o.token&&o.user&&sessionStorage.setItem("lt_user_info",JSON.stringify({displayName:o.user.display_name,username:o.user.external_id})),o.token??null}catch{return null}}let Gs=null;async function $e(r,n={}){const s={"Content-Type":"application/json",...n.headers};if(Fs){if(Wf(Fs)){Gs||(Gs=h0().finally(()=>{Gs=null}));const o=await Gs;if(o)Fs=o,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:o}}));else throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}s.Authorization=`Bearer ${Fs}`}let a=await fetch(`${jf}${r}`,{...n,headers:s});if(a.status===401&&Fs){Gs||(Gs=h0().finally(()=>{Gs=null}));const o=await Gs;if(o&&(Fs=o,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:o}})),s.Authorization=`Bearer ${o}`,a=await fetch(`${jf}${r}`,{...n,headers:s})),a.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}else if(a.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired");if(!a.ok){const o=await a.json().catch(()=>({error:a.statusText}));throw new Error(o.message||o.error||a.statusText)}return a.json()}const xg=O.createContext(null),cv=300;function uf(r,n){if(Wf(r))return null;const s=Zf(r);if(!s)return null;const a=n??(()=>{try{const o=sessionStorage.getItem("lt_user_info");return o?JSON.parse(o):null}catch{return null}})();return{userId:s.userId,displayName:(a==null?void 0:a.displayName)??null,username:(a==null?void 0:a.username)??null,roles:s.roles??[]}}function uv({children:r}){const[n,s]=O.useState(()=>{const w=sessionStorage.getItem("lt_token");return w?Wf(w)?(sessionStorage.removeItem("lt_token"),null):(po(w),uf(w)):null}),a=O.useRef(void 0),o=O.useCallback(w=>{clearTimeout(a.current);const T=yg(w);if(!T)return;const q=(T-cv)*1e3-Date.now();q<=0||(a.current=setTimeout(async()=>{try{const M=Zf(w);if(M!=null&&M.sso){const re=await fetch(`${Wt}/api/auth/sso`,{method:"POST"});if(!re.ok)return;const C=await re.json();C.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:C.token}}));return}const D=sessionStorage.getItem("lt_credentials");if(!D)return;const{username:W,password:se}=JSON.parse(D),ee=await fetch(`${Wt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:W,password:se})});if(!ee.ok)return;const me=await ee.json();me.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:me.token}}))}catch{}},q))},[]),f=O.useCallback((w,T,q)=>{const M={displayName:(q==null?void 0:q.displayName)??null,username:(q==null?void 0:q.username)??(T==null?void 0:T.username)??null},D=uf(w,M);D&&(po(w),sessionStorage.setItem("lt_token",w),sessionStorage.setItem("lt_user_info",JSON.stringify(M)),T&&sessionStorage.setItem("lt_credentials",JSON.stringify(T)),s(D),o(w))},[o]),h=O.useCallback(()=>{clearTimeout(a.current);const w=sessionStorage.getItem("lt_sso_logout_url");po(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=()=>h(),T=q=>{var W;const M=(W=q.detail)==null?void 0:W.token;if(!M)return;const D=uf(M);D&&(po(M),sessionStorage.setItem("lt_token",M),s(D),o(M))};return window.addEventListener("auth:unauthorized",w),window.addEventListener("auth:refreshed",T),()=>{window.removeEventListener("auth:unauthorized",w),window.removeEventListener("auth:refreshed",T)}},[h,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 d.jsx(xg.Provider,{value:{user:n,isAuthenticated:!!n,isSuperAdmin:m,login:f,logout:h,hasRole:g,hasRoleType:y,userRoleNames:E},children:r})}function Oi(){const r=O.useContext(xg);if(!r)throw new Error("useAuth must be used within AuthProvider");return r}const nn=new Uint8Array(0),Ti=new TextEncoder,en=new TextDecoder;function fv(...r){let n=0;for(let o=0;o<r.length;o++)n+=r[o].length;const s=new Uint8Array(n);let a=0;for(let o=0;o<r.length;o++)s.set(r[o],a),a+=r[o].length;return s}function Da(...r){const n=[];for(let s=0;s<r.length;s++)n.push(Ti.encode(r[s]));return n.length===0?nn:n.length===1?n[0]:fv(...n)}function d0(r){return!r||r.length===0?"":en.decode(r)}const m0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",p0=36,hv=0xcfd41b9100000,g0=33,dv=333,y0=22;function mv(r){for(let n=0;n<r.length;n++)r[n]=Math.floor(Math.random()*255)}function pv(r){var n;(n=globalThis==null?void 0:globalThis.crypto)!=null&&n.getRandomValues?globalThis.crypto.getRandomValues(r):mv(r)}class gv{constructor(){v(this,"buf");v(this,"seq");v(this,"inc");v(this,"inited");this.buf=new Uint8Array(y0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*hv),this.inc=Math.floor(Math.random()*(dv-g0)+g0)}setPre(){const n=new Uint8Array(12);pv(n);for(let s=0;s<12;s++){const a=n[s]%36;this.buf[s]=m0.charCodeAt(a)}}fillSeq(){let n=this.seq;for(let s=y0-1;s>=12;s--)this.buf[s]=m0.charCodeAt(n%p0),n=Math.floor(n/p0)}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 Zs=new gv;var us;(function(r){r.Disconnect="disconnect",r.Reconnect="reconnect",r.Update="update",r.LDM="ldm",r.Error="error"})(us||(us={}));var vr;(function(r){r.Reconnecting="reconnecting",r.PingTimer="pingTimer",r.StaleConnection="staleConnection",r.ClientInitiatedReconnect="client initiated reconnect"})(vr||(vr={}));var ie;(function(r){r.ApiError="BAD API",r.BadAuthentication="BAD_AUTHENTICATION",r.BadCreds="BAD_CREDS",r.BadHeader="BAD_HEADER",r.BadJson="BAD_JSON",r.BadPayload="BAD_PAYLOAD",r.BadSubject="BAD_SUBJECT",r.Cancelled="CANCELLED",r.ConnectionClosed="CONNECTION_CLOSED",r.ConnectionDraining="CONNECTION_DRAINING",r.ConnectionRefused="CONNECTION_REFUSED",r.ConnectionTimeout="CONNECTION_TIMEOUT",r.Disconnect="DISCONNECT",r.InvalidOption="INVALID_OPTION",r.InvalidPayload="INVALID_PAYLOAD",r.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",r.NoResponders="503",r.NotFunction="NOT_FUNC",r.RequestError="REQUEST_ERROR",r.ServerOptionNotAvailable="SERVER_OPT_NA",r.SubClosed="SUB_CLOSED",r.SubDraining="SUB_DRAINING",r.Timeout="TIMEOUT",r.Tls="TLS",r.Unknown="UNKNOWN_ERROR",r.WssRequired="WSS_REQUIRED",r.JetStreamInvalidAck="JESTREAM_INVALID_ACK",r.JetStream404NoMessages="404",r.JetStream408RequestTimeout="408",r.JetStream409MaxAckPendingExceeded="409",r.JetStream409="409",r.JetStreamNotEnabled="503",r.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",r.AuthorizationViolation="AUTHORIZATION_VIOLATION",r.AuthenticationExpired="AUTHENTICATION_EXPIRED",r.ProtocolError="NATS_PROTOCOL_ERR",r.PermissionsViolation="PERMISSIONS_VIOLATION",r.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",r.AccountExpired="ACCOUNT_EXPIRED"})(ie||(ie={}));function yv(r){return typeof r.code=="string"}class vg{constructor(){v(this,"messages");this.messages=new Map,this.messages.set(ie.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(ie.BadJson,"Bad JSON"),this.messages.set(ie.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(n){return bv.getMessage(n)}getMessage(n){return this.messages.get(n)||n}}const bv=new vg;class ue extends Error{constructor(s,a,o){super(s);v(this,"name");v(this,"message");v(this,"code");v(this,"permissionContext");v(this,"chainedError");v(this,"api_error");this.name="NatsError",this.message=s,this.code=a,this.chainedError=o}static errorForCode(s,a){const o=vg.getMessage(s);return new ue(o,s,a)}isAuthError(){return this.code===ie.AuthenticationExpired||this.code===ie.AuthorizationViolation||this.code===ie.AccountExpired}isAuthTimeout(){return this.code===ie.AuthenticationTimeout}isPermissionError(){return this.code===ie.PermissionsViolation}isProtocolError(){return this.code===ie.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var Kt;(function(r){r[r.Exact=0]="Exact",r[r.CanonicalMIME=1]="CanonicalMIME",r[r.IgnoreCase=2]="IgnoreCase"})(Kt||(Kt={}));var kn;(function(r){r.Timer="timer",r.Count="count",r.JitterTimer="jitterTimer",r.SentinelMsg="sentinelMsg"})(kn||(kn={}));var za;(function(r){r.STATS="io.nats.micro.v1.stats_response",r.INFO="io.nats.micro.v1.info_response",r.PING="io.nats.micro.v1.ping_response"})(za||(za={}));const ko="Nats-Service-Error",Mo="Nats-Service-Error-Code";class Ro extends Error{constructor(s,a){super(a);v(this,"code");this.code=s}static isServiceError(s){return Ro.toServiceError(s)!==null}static toServiceError(s){var o,f;const a=((o=s==null?void 0:s.headers)==null?void 0:o.get(Mo))||"";if(a!==""){const h=parseInt(a)||400,m=((f=s==null?void 0:s.headers)==null?void 0:f.get(ko))||"";return new Ro(h,m.length?m:a)}return null}}function fs(r=""){if(r=r||"_INBOX",typeof r!="string")throw new Error("prefix must be a string");return r.split(".").forEach(n=>{if(n==="*"||n===">")throw new Error(`inbox prefixes cannot have wildcards '${r}'`)}),`${r}.${Zs.next()}`}const Of="127.0.0.1";var Js;(function(r){r.PING="PING",r.STATS="STATS",r.INFO="INFO"})(Js||(Js={}));function Yo(r,...n){for(let s=0;s<n.length;s++){const a=n[s];Object.keys(a).forEach(function(o){r[o]=a[o]})}return r}function go(r){return en.decode(r).replace(/\n/g,"␊").replace(/\r/g,"␍")}function Ar(r,n=!0){const s=n?ue.errorForCode(ie.Timeout):null;let a,o;const f=new Promise((h,m)=>{a={cancel:()=>{o&&clearTimeout(o)}},o=setTimeout(()=>{m(s===null?ue.errorForCode(ie.Timeout):s)},r)});return Object.assign(f,a)}function Tr(r=0){let n;const s=new Promise(a=>{const o=setTimeout(()=>{a()},r);n={cancel:()=>{o&&clearTimeout(o)}}});return Object.assign(s,n)}function st(){let r={};const n=new Promise((s,a)=>{r={resolve:s,reject:a}});return Object.assign(n,r)}function _g(r){for(let n=r.length-1;n>0;n--){const s=Math.floor(Math.random()*(n+1));[r[n],r[s]]=[r[s],r[n]]}return r}function xv(r){return r===0?0:Math.floor(r/2+Math.random()*r)}function eh(r=[0,250,250,500,500,3e3,5e3]){Array.isArray(r)||(r=[0,250,250,500,500,3e3,5e3]);const n=r.length-1;return{backoff(s){return xv(s>n?r[n]:r[s])}}}function nt(r){return r*1e6}function th(r){return Math.floor(r/1e6)}function b0(r){let a=!0;const o=new Array(r.length);for(let f=0;f<r.length;f++){let h=r.charCodeAt(f);if(h===58||h<33||h>126)throw new ue(`'${r[f]}' is not a valid character for a header key`,ie.BadHeader);a&&97<=h&&h<=122?h-=32:!a&&65<=h&&h<=90&&(h+=32),o[f]=h,a=h==45}return String.fromCharCode(...o)}function hs(r=0,n=""){if(r===0&&n!==""||r>0&&n==="")throw new Error("setting status requires both code and description");return new Is(r,n)}const ff="NATS/1.0";class Is{constructor(n=0,s=""){v(this,"_code");v(this,"headers");v(this,"_description");this._code=n,this._description=s,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(n){if(n&&this.headers.size===n.headers.size&&this._code===n._code){for(const[s,a]of this.headers){const o=n.values(s);if(a.length!==o.length)return!1;const f=[...a].sort(),h=[...o].sort();for(let m=0;m<f.length;m++)if(f[m]!==h[m])return!1}return!0}return!1}static decode(n){const s=new Is,o=en.decode(n).split(`\r
|
|
27
27
|
`),f=o[0];if(f!==ff){let h=f.replace(ff,"").trim();if(h.length>0){s._code=parseInt(h,10),isNaN(s._code)&&(s._code=0);const m=s._code.toString();h=h.replace(m,""),s._description=h.trim()}}return o.length>=1&&o.slice(1).map(h=>{if(h){const m=h.indexOf(":");if(m>-1){const g=h.slice(0,m),y=h.slice(m+1).trim();s.append(g,y)}}}),s}toString(){if(this.headers.size===0&&this._code===0)return"";let n=ff;this._code>0&&this._description!==""&&(n+=` ${this._code} ${this._description}`);for(const[s,a]of this.headers)for(let o=0;o<a.length;o++)n=`${n}\r
|
|
28
28
|
${s}: ${a[o]}`;return`${n}\r
|
|
29
29
|
\r
|
|
30
|
-
`}encode(){return Ti.encode(this.toString())}static validHeaderValue(n){if(/[\r\n]/.test(n))throw new ue("invalid header value - \\r and \\n are not allowed.",ie.BadHeader);return n.trim()}keys(){const n=[];for(const s of this.headers.keys())n.push(s);return n}findKeys(n,s=Kt.Exact){const a=this.keys();switch(s){case Kt.Exact:return a.filter(o=>o===n);case Kt.CanonicalMIME:return n=
|
|
30
|
+
`}encode(){return Ti.encode(this.toString())}static validHeaderValue(n){if(/[\r\n]/.test(n))throw new ue("invalid header value - \\r and \\n are not allowed.",ie.BadHeader);return n.trim()}keys(){const n=[];for(const s of this.headers.keys())n.push(s);return n}findKeys(n,s=Kt.Exact){const a=this.keys();switch(s){case Kt.Exact:return a.filter(o=>o===n);case Kt.CanonicalMIME:return n=b0(n),a.filter(o=>o===n);default:{const o=n.toLowerCase();return a.filter(f=>o===f.toLowerCase())}}}get(n,s=Kt.Exact){const a=this.findKeys(n,s);if(a.length){const o=this.headers.get(a[0]);if(o)return Array.isArray(o)?o[0]:o}return""}last(n,s=Kt.Exact){const a=this.findKeys(n,s);if(a.length){const o=this.headers.get(a[0]);if(o)return Array.isArray(o)?o[o.length-1]:o}return""}has(n,s=Kt.Exact){return this.findKeys(n,s).length>0}set(n,s,a=Kt.Exact){this.delete(n,a),this.append(n,s,a)}append(n,s,a=Kt.Exact){const o=b0(n);a===Kt.CanonicalMIME&&(n=o);const f=this.findKeys(n,a);n=f.length>0?f[0]:n;const h=Is.validHeaderValue(s);let m=this.headers.get(n);m||(m=[],this.headers.set(n,m)),m.push(h)}values(n,s=Kt.Exact){const a=[];return this.findKeys(n,s).forEach(f=>{const h=this.headers.get(f);h&&a.push(...h)}),a}delete(n,s=Kt.Exact){this.findKeys(n,s).forEach(o=>{this.headers.delete(o)})}get hasError(){return this._code>=300}get status(){return`${this._code} ${this._description}`.trim()}toRecord(){const n={};return this.keys().forEach(s=>{n[s]=this.values(s)}),n}get code(){return this._code}get description(){return this._description}static fromRecord(n){const s=new Is;for(const a in n)s.headers.set(a,n[a]);return s}}function Tf(){return{encode(r){return Ti.encode(r)},decode(r){return en.decode(r)}}}function Mn(r){return{encode(n){try{return n===void 0&&(n=null),Ti.encode(JSON.stringify(n))}catch(s){throw ue.errorForCode(ie.BadJson,s)}},decode(n){try{return JSON.parse(en.decode(n),r)}catch(s){throw ue.errorForCode(ie.BadJson,s)}}}}function wg(r){var n;return r&&r.data.length===0&&((n=r.headers)==null?void 0:n.code)===503?ue.errorForCode(ie.NoResponders):null}class nh{constructor(n,s,a){v(this,"_headers");v(this,"_msg");v(this,"_rdata");v(this,"_reply");v(this,"_subject");v(this,"publisher");this._msg=n,this._rdata=s,this.publisher=a}get subject(){return this._subject?this._subject:(this._subject=en.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=en.decode(this._msg.reply),this._reply)}get sid(){return this._msg.sid}get headers(){if(this._msg.hdr>-1&&!this._headers){const n=this._rdata.subarray(0,this._msg.hdr);this._headers=Is.decode(n)}return this._headers}get data(){return this._rdata?this._msg.hdr>-1?this._rdata.subarray(this._msg.hdr):this._rdata:new Uint8Array(0)}respond(n=nn,s){return this.reply?(this.publisher.publish(this.reply,n,s),!0):!1}size(){var o;const n=this._msg.subject.length,s=((o=this._msg.reply)==null?void 0:o.length)||0,a=this._msg.size===-1?0:this._msg.size;return n+s+a}json(n){return Mn(n).decode(this.data)}string(){return en.decode(this.data)}requestInfo(){var s;const n=(s=this.headers)==null?void 0:s.get("Nats-Request-Info");return n?JSON.parse(n,function(a,o){return(a==="start"||a==="stop")&&o!==""?new Date(Date.parse(o)):o}):null}}v(nh,"jc");function _r(r){return Go("durable",r)}function Mt(r){return Go("stream",r)}function Go(r,n=""){if(n==="")throw Error(`${r} name required`);return[".","*",">","/","\\"," "," ",`
|
|
31
31
|
`,"\r"].forEach(a=>{if(n.indexOf(a)!==-1){switch(a){case`
|
|
32
|
-
`:a="\\n";break;case"\r":a="\\r";break;case" ":a="\\t";break}throw Error(`invalid ${r} name - ${r} name cannot contain '${a}'`)}}),""}function Ca(r,n=""){if(n==="")throw Error(`${r} name required`);const s=xv(n);if(s.length)throw new Error(`invalid ${r} name - ${r} name ${s}`)}function xv(r=""){if(r==="")throw Error("name required");const n=/^[-\w]+$/g;if(r.match(n)===null){for(const a of r.split(""))if(a.match(n)===null)return`cannot contain '${a}'`}return""}function Nf(r){if(r.data.length>0)return!1;const n=r.headers;return n?n.code>=100&&n.code<200:!1}function Cf(r){var n;return Nf(r)&&((n=r.headers)==null?void 0:n.description)==="Idle Heartbeat"}function vv(r,n,s){const a=hs(r,n),o={hdr:1,sid:0,size:0},f=new nh(o,nn,{});return f._headers=a,f._subject=s,f}function wr(r){if(r.data.length!==0)return null;const n=r.headers;return n?wg(n.code,n.description):null}var xn;(function(r){r.MaxBatchExceeded="exceeded maxrequestbatch of",r.MaxExpiresExceeded="exceeded maxrequestexpires of",r.MaxBytesExceeded="exceeded maxrequestmaxbytes of",r.MaxMessageSizeExceeded="message size exceeds maxbytes",r.PushConsumer="consumer is push based",r.MaxWaitingExceeded="exceeded maxwaiting",r.IdleHeartbeatMissed="idle heartbeats missed",r.ConsumerDeleted="consumer deleted"})(xn||(xn={}));function _v(r){return r.code!==ie.JetStream409?!1:[xn.MaxBatchExceeded,xn.MaxExpiresExceeded,xn.MaxBytesExceeded,xn.MaxMessageSizeExceeded,xn.PushConsumer,xn.IdleHeartbeatMissed,xn.ConsumerDeleted].find(s=>r.message.indexOf(s)!==-1)!==void 0}function wg(r,n=""){if(r<300)return null;switch(n=n.toLowerCase(),r){case 404:return new ue(n,ie.JetStream404NoMessages);case 408:return new ue(n,ie.JetStream408RequestTimeout);case 409:{const s=n.startsWith(xn.IdleHeartbeatMissed)?ie.JetStreamIdleHeartBeat:ie.JetStream409;return new ue(n,s)}case 503:return ue.errorForCode(ie.JetStreamNotEnabled,new Error(n));default:return n===""&&(n=ie.Unknown),new ue(n,`${r}`)}}class _t{constructor(){v(this,"inflight");v(this,"processed");v(this,"received");v(this,"noIterator");v(this,"iterClosed");v(this,"done");v(this,"signal");v(this,"yields");v(this,"filtered");v(this,"pendingFiltered");v(this,"ingestionFilterFn");v(this,"protocolFilterFn");v(this,"dispatchedFn");v(this,"ctx");v(this,"_data");v(this,"err");v(this,"time");v(this,"yielding");this.inflight=0,this.filtered=0,this.pendingFiltered=0,this.processed=0,this.received=0,this.noIterator=!1,this.done=!1,this.signal=st(),this.yields=[],this.iterClosed=st(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(n){if(this.done)return;if(typeof n=="function"){this.yields.push(n),this.signal.resolve();return}const{ingest:s,protocol:a}=this.ingestionFilterFn?this.ingestionFilterFn(n,this.ctx||this):{ingest:!0,protocol:!1};s&&(a&&(this.filtered++,this.pendingFiltered++),this.yields.push(n),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new ue("unsupported iterator",ie.ApiError);if(this.yielding)throw new ue("already yielding",ie.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const n=this.yields;this.inflight=n.length,this.yields=[];for(let s=0;s<n.length;s++){if(typeof n[s]=="function"){const o=n[s];try{o()}catch(f){throw f}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(n[s]):!0){this.processed++;const o=Date.now();yield n[s],this.time=Date.now()-o,this.dispatchedFn&&n[s]&&this.dispatchedFn(n[s])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=st())}}finally{this.stop()}}stop(n){this.done||(this.err=n,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(n))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class sh{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 kf;(function(r){r.Limits="limits",r.Interest="interest",r.Workqueue="workqueue"})(kf||(kf={}));var Ba;(function(r){r.Old="old",r.New="new"})(Ba||(Ba={}));var Mf;(function(r){r.File="file",r.Memory="memory"})(Mf||(Mf={}));var ft;(function(r){r.All="all",r.Last="last",r.New="new",r.StartSequence="by_start_sequence",r.StartTime="by_start_time",r.LastPerSubject="last_per_subject"})(ft||(ft={}));var vt;(function(r){r.None="none",r.All="all",r.Explicit="explicit",r.NotSet=""})(vt||(vt={}));var jr;(function(r){r.Instant="instant",r.Original="original"})(jr||(jr={}));var Zs;(function(r){r.None="none",r.S2="s2"})(Zs||(Zs={}));var Do;(function(r){r.CreateOrUpdate="",r.Update="update",r.Create="create"})(Do||(Do={}));function wv(r,n={}){return Object.assign({name:r,deliver_policy:ft.All,ack_policy:vt.Explicit,ack_wait:nt(30*1e3),replay_policy:jr.Instant},n)}var b0;(function(r){r.API="api_audit",r.StreamAction="stream_action",r.ConsumerAction="consumer_action",r.SnapshotCreate="snapshot_create",r.SnapshotComplete="snapshot_complete",r.RestoreCreate="restore_create",r.RestoreComplete="restore_complete",r.MaxDeliver="max_deliver",r.Terminated="terminated",r.Ack="consumer_ack",r.StreamLeaderElected="stream_leader_elected",r.StreamQuorumLost="stream_quorum_lost",r.ConsumerLeaderElected="consumer_leader_elected",r.ConsumerQuorumLost="consumer_quorum_lost"})(b0||(b0={}));var Dt;(function(r){r.StreamSourceHdr="Nats-Stream-Source",r.LastConsumerSeqHdr="Nats-Last-Consumer",r.LastStreamSeqHdr="Nats-Last-Stream",r.ConsumerStalledHdr="Nats-Consumer-Stalled",r.MessageSizeHdr="Nats-Msg-Size",r.RollupHdr="Nats-Rollup",r.RollupValueSubject="sub",r.RollupValueAll="all",r.PendingMessagesHdr="Nats-Pending-Messages",r.PendingBytesHdr="Nats-Pending-Bytes"})(Dt||(Dt={}));var Tn;(function(r){r.LastValue="",r.AllHistory="history",r.UpdatesOnly="updates"})(Tn||(Tn={}));var br;(function(r){r.Stream="Nats-Stream",r.Sequence="Nats-Sequence",r.TimeStamp="Nats-Time-Stamp",r.Subject="Nats-Subject"})(br||(br={}));var x0;(function(r){r.Stream="Nats-Stream",r.Subject="Nats-Subject",r.Sequence="Nats-Sequence",r.LastSequence="Nats-Last-Sequence",r.Size="Nats-Msg-Size"})(x0||(x0={}));const Zt="KV_";class Sv{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=wv("",n||{})}getOpts(){var s;const n={};if(n.config=Object.assign({},this.config),n.config.filter_subject&&(this.filterSubject(n.config.filter_subject),n.config.filter_subject=void 0),n.config.filter_subjects&&((s=n.config.filter_subjects)==null||s.forEach(a=>{this.filterSubject(a)}),n.config.filter_subjects=void 0),n.mack=this.mack,n.stream=this.stream,n.callbackFn=this.callbackFn,n.max=this.max,n.queue=this.qname,n.ordered=this.ordered,n.config.ack_policy=n.ordered?vt.None:n.config.ack_policy,n.isBind=n.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:n.config.filter_subject=this.filters[0];break;default:n.config.filter_subjects=this.filters}return n}description(n){return this.config.description=n,this}deliverTo(n){return this.config.deliver_subject=n,this}durable(n){return _r(n),this.config.durable_name=n,this}startSequence(n){if(n<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=ft.StartSequence,this.config.opt_start_seq=n,this}startTime(n){return this.config.deliver_policy=ft.StartTime,this.config.opt_start_time=n.toISOString(),this}deliverAll(){return this.config.deliver_policy=ft.All,this}deliverLastPerSubject(){return this.config.deliver_policy=ft.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=ft.Last,this}deliverNew(){return this.config.deliver_policy=ft.New,this}startAtTimeDelta(n){return this.startTime(new Date(Date.now()-n)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=vt.None,this}ackAll(){return this.config.ack_policy=vt.All,this}ackExplicit(){return this.config.ack_policy=vt.Explicit,this}ackWait(n){return this.config.ack_wait=nt(n),this}maxDeliver(n){return this.config.max_deliver=n,this}filterSubject(n){return this.filters=this.filters||[],this.filters.push(n),this}replayInstantly(){return this.config.replay_policy=jr.Instant,this}replayOriginal(){return this.config.replay_policy=jr.Original,this}sample(n){if(n=Math.trunc(n),n<0||n>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${n}%`,this}limit(n){return this.config.rate_limit_bps=n,this}maxWaiting(n){return this.config.max_waiting=n,this}maxAckPending(n){return this.config.max_ack_pending=n,this}idleHeartbeat(n){return this.config.idle_heartbeat=nt(n),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(n){return this.queue(n),this}manualAck(){return this.mack=!0,this}maxMessages(n){return this.max=n,this}callback(n){return this.callbackFn=n,this}queue(n){return this.qname=n,this.config.deliver_group=n,this}orderedConsumer(){return this.ordered=!0,this}bind(n,s){return this.stream=n,this.config.durable_name=s,this.isBind=!0,this}bindStream(n){return this.stream=n,this}inactiveEphemeralThreshold(n){return this.config.inactive_threshold=nt(n),this}maxPullBatch(n){return this.config.max_batch=n,this}maxPullRequestExpires(n){return this.config.max_expires=nt(n),this}memory(){return this.config.mem_storage=!0,this}numReplicas(n){return this.config.num_replicas=n,this}consumerName(n){return this.config.name=n,this}}function Is(r){return new Sv(r)}function v0(r){return typeof r.getOpts=="function"}class Ev{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 Sr{static encode(n){return Sr.toB64URLEncoding(Ev.encode(n))}static decode(n,s=!1){return Sr.decode(Sr.fromB64URLEncoding(n),s)}static toB64URLEncoding(n){return n.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(n){return n.replace(/_/g,"/").replace(/-/g,"+")}}class Or{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=""),Ti.encode(n)}static toAscii(n){return en.decode(n)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const n=new Uint8Array(this.byteLength);let s=0;for(let a=0;a<this.buffers.length;a++)n.set(this.buffers[a],s),s+=this.buffers[a].length;this.buffers.length=0,this.buffers.push(n)}}shift(){if(this.buffers.length){const n=this.buffers.shift();if(n)return this.byteLength-=n.length,n}return new Uint8Array(0)}drain(n){if(this.buffers.length){this.pack();const s=this.buffers.pop();if(s){const a=this.byteLength;(n===void 0||n>a)&&(n=a);const o=s.subarray(0,n);return a>n&&this.buffers.push(s.subarray(n)),this.byteLength=a-n,o}}return new Uint8Array(0)}fill(n,...s){n&&(this.buffers.push(n),this.byteLength+=n.length);for(let a=0;a<s.length;a++)s[a]&&s[a].length&&(this.buffers.push(s[a]),this.byteLength+=s[a].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function Av(r,n){return n.forEach(function(s){s&&typeof s!="string"&&!Array.isArray(s)&&Object.keys(s).forEach(function(a){if(a!=="default"&&!(a in r)){var o=Object.getOwnPropertyDescriptor(s,a);Object.defineProperty(r,a,o.get?o:{enumerable:!0,get:function(){return s[a]}})}})}),Object.freeze(r)}var jv=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},Aa=jv.performance||{};Aa.now||Aa.mozNow||Aa.msNow||Aa.oNow||Aa.webkitNow;var _0={versions:{}},Ov=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Tv(r){if(r.__esModule)return r;var n=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(r).forEach(function(s){var a=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(n,s,a.get?a:{enumerable:!0,get:function(){return r[s]}})}),n}var hf,Vo={exports:{}},w0={},S0=Tv(Av({__proto__:null,default:w0},[w0]));hf=Vo,(function(){var r="input is invalid type",n=typeof window=="object",s=n?window:{};s.JS_SHA256_NO_WINDOW&&(n=!1);var a=!n&&typeof self=="object",o=!s.JS_SHA256_NO_NODE_JS&&_0.versions&&_0.versions.node;o?s=Ov:a&&(s=self);var f=!s.JS_SHA256_NO_COMMON_JS&&hf.exports,h=!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"],O=[];!s.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(C){return Object.prototype.toString.call(C)==="[object Array]"}),!h||!s.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(C){return typeof C=="object"&&C.buffer&&C.buffer.constructor===ArrayBuffer});var q=function(C,X){return function(ce){return new ee(X,!0).update(ce)[C]()}},M=function(C){var X=q("hex",C);o&&(X=D(X,C)),X.create=function(){return new ee(C)},X.update=function(G){return X.create().update(G)};for(var ce=0;ce<w.length;++ce){var V=w[ce];X[V]=q(V,C)}return X},D=function(C,X){var ce,V=S0,G=S0.Buffer,K=X?"sha224":"sha256";return ce=G.from&&!s.JS_SHA256_NO_BUFFER_FROM?G.from:function(ae){return new G(ae)},function(ae){if(typeof ae=="string")return V.createHash(K).update(ae,"utf8").digest("hex");if(ae==null)throw new Error(r);return ae.constructor===ArrayBuffer&&(ae=new Uint8Array(ae)),Array.isArray(ae)||ArrayBuffer.isView(ae)||ae.constructor===G?V.createHash(K).update(ce(ae)).digest("hex"):C(ae)}},W=function(C,X){return function(ce,V){return new me(ce,X,!0).update(V)[C]()}},se=function(C){var X=W("hex",C);X.create=function(G){return new me(G,C)},X.update=function(G,K){return X.create(G).update(K)};for(var ce=0;ce<w.length;++ce){var V=w[ce];X[V]=W(V,C)}return X};function ee(C,X){X?(O[0]=O[16]=O[1]=O[2]=O[3]=O[4]=O[5]=O[6]=O[7]=O[8]=O[9]=O[10]=O[11]=O[12]=O[13]=O[14]=O[15]=0,this.blocks=O):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],C?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=C}function me(C,X,ce){var V,G=typeof C;if(G==="string"){var K,ae=[],ne=C.length,ke=0;for(V=0;V<ne;++V)(K=C.charCodeAt(V))<128?ae[ke++]=K:K<2048?(ae[ke++]=192|K>>>6,ae[ke++]=128|63&K):K<55296||K>=57344?(ae[ke++]=224|K>>>12,ae[ke++]=128|K>>>6&63,ae[ke++]=128|63&K):(K=65536+((1023&K)<<10|1023&C.charCodeAt(++V)),ae[ke++]=240|K>>>18,ae[ke++]=128|K>>>12&63,ae[ke++]=128|K>>>6&63,ae[ke++]=128|63&K);C=ae}else{if(G!=="object")throw new Error(r);if(C===null)throw new Error(r);if(h&&C.constructor===ArrayBuffer)C=new Uint8Array(C);else if(!(Array.isArray(C)||h&&ArrayBuffer.isView(C)))throw new Error(r)}C.length>64&&(C=new ee(X,!0).update(C).array());var He=[],Me=[];for(V=0;V<64;++V){var $=C[V]||0;He[V]=92^$,Me[V]=54^$}ee.call(this,X,ce),this.update(Me),this.oKeyPad=He,this.inner=!0,this.sharedMemory=ce}ee.prototype.update=function(C){if(!this.finalized){var X,ce=typeof C;if(ce!=="string"){if(ce!=="object")throw new Error(r);if(C===null)throw new Error(r);if(h&&C.constructor===ArrayBuffer)C=new Uint8Array(C);else if(!(Array.isArray(C)||h&&ArrayBuffer.isView(C)))throw new Error(r);X=!0}for(var V,G,K=0,ae=C.length,ne=this.blocks;K<ae;){if(this.hashed&&(this.hashed=!1,ne[0]=this.block,this.block=ne[16]=ne[1]=ne[2]=ne[3]=ne[4]=ne[5]=ne[6]=ne[7]=ne[8]=ne[9]=ne[10]=ne[11]=ne[12]=ne[13]=ne[14]=ne[15]=0),X)for(G=this.start;K<ae&&G<64;++K)ne[G>>>2]|=C[K]<<y[3&G++];else for(G=this.start;K<ae&&G<64;++K)(V=C.charCodeAt(K))<128?ne[G>>>2]|=V<<y[3&G++]:V<2048?(ne[G>>>2]|=(192|V>>>6)<<y[3&G++],ne[G>>>2]|=(128|63&V)<<y[3&G++]):V<55296||V>=57344?(ne[G>>>2]|=(224|V>>>12)<<y[3&G++],ne[G>>>2]|=(128|V>>>6&63)<<y[3&G++],ne[G>>>2]|=(128|63&V)<<y[3&G++]):(V=65536+((1023&V)<<10|1023&C.charCodeAt(++K)),ne[G>>>2]|=(240|V>>>18)<<y[3&G++],ne[G>>>2]|=(128|V>>>12&63)<<y[3&G++],ne[G>>>2]|=(128|V>>>6&63)<<y[3&G++],ne[G>>>2]|=(128|63&V)<<y[3&G++]);this.lastByteIndex=G,this.bytes+=G-this.start,G>=64?(this.block=ne[16],this.start=G-64,this.hash(),this.hashed=!0):this.start=G}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},ee.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var C=this.blocks,X=this.lastByteIndex;C[16]=this.block,C[X>>>2]|=g[3&X],this.block=C[16],X>=56&&(this.hashed||this.hash(),C[0]=this.block,C[16]=C[1]=C[2]=C[3]=C[4]=C[5]=C[6]=C[7]=C[8]=C[9]=C[10]=C[11]=C[12]=C[13]=C[14]=C[15]=0),C[14]=this.hBytes<<3|this.bytes>>>29,C[15]=this.bytes<<3,this.hash()}},ee.prototype.hash=function(){var C,X,ce,V,G,K,ae,ne,ke,He=this.h0,Me=this.h1,$=this.h2,te=this.h3,de=this.h4,ve=this.h5,be=this.h6,Oe=this.h7,we=this.blocks;for(C=16;C<64;++C)X=((G=we[C-15])>>>7|G<<25)^(G>>>18|G<<14)^G>>>3,ce=((G=we[C-2])>>>17|G<<15)^(G>>>19|G<<13)^G>>>10,we[C]=we[C-16]+X+we[C-7]+ce|0;for(ke=Me&$,C=0;C<64;C+=4)this.first?(this.is224?(K=300032,Oe=(G=we[0]-1413257819)-150054599|0,te=G+24177077|0):(K=704751109,Oe=(G=we[0]-210244248)-1521486534|0,te=G+143694565|0),this.first=!1):(X=(He>>>2|He<<30)^(He>>>13|He<<19)^(He>>>22|He<<10),V=(K=He&Me)^He&$^ke,Oe=te+(G=Oe+(ce=(de>>>6|de<<26)^(de>>>11|de<<21)^(de>>>25|de<<7))+(de&ve^~de&be)+E[C]+we[C])|0,te=G+(X+V)|0),X=(te>>>2|te<<30)^(te>>>13|te<<19)^(te>>>22|te<<10),V=(ae=te&He)^te&Me^K,be=$+(G=be+(ce=(Oe>>>6|Oe<<26)^(Oe>>>11|Oe<<21)^(Oe>>>25|Oe<<7))+(Oe&de^~Oe&ve)+E[C+1]+we[C+1])|0,X=(($=G+(X+V)|0)>>>2|$<<30)^($>>>13|$<<19)^($>>>22|$<<10),V=(ne=$&te)^$&He^ae,ve=Me+(G=ve+(ce=(be>>>6|be<<26)^(be>>>11|be<<21)^(be>>>25|be<<7))+(be&Oe^~be&de)+E[C+2]+we[C+2])|0,X=((Me=G+(X+V)|0)>>>2|Me<<30)^(Me>>>13|Me<<19)^(Me>>>22|Me<<10),V=(ke=Me&$)^Me&te^ne,de=He+(G=de+(ce=(ve>>>6|ve<<26)^(ve>>>11|ve<<21)^(ve>>>25|ve<<7))+(ve&be^~ve&Oe)+E[C+3]+we[C+3])|0,He=G+(X+V)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+He|0,this.h1=this.h1+Me|0,this.h2=this.h2+$|0,this.h3=this.h3+te|0,this.h4=this.h4+de|0,this.h5=this.h5+ve|0,this.h6=this.h6+be|0,this.h7=this.h7+Oe|0},ee.prototype.hex=function(){this.finalize();var C=this.h0,X=this.h1,ce=this.h2,V=this.h3,G=this.h4,K=this.h5,ae=this.h6,ne=this.h7,ke=m[C>>>28&15]+m[C>>>24&15]+m[C>>>20&15]+m[C>>>16&15]+m[C>>>12&15]+m[C>>>8&15]+m[C>>>4&15]+m[15&C]+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[ce>>>28&15]+m[ce>>>24&15]+m[ce>>>20&15]+m[ce>>>16&15]+m[ce>>>12&15]+m[ce>>>8&15]+m[ce>>>4&15]+m[15&ce]+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[G>>>28&15]+m[G>>>24&15]+m[G>>>20&15]+m[G>>>16&15]+m[G>>>12&15]+m[G>>>8&15]+m[G>>>4&15]+m[15&G]+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[ae>>>28&15]+m[ae>>>24&15]+m[ae>>>20&15]+m[ae>>>16&15]+m[ae>>>12&15]+m[ae>>>8&15]+m[ae>>>4&15]+m[15&ae];return this.is224||(ke+=m[ne>>>28&15]+m[ne>>>24&15]+m[ne>>>20&15]+m[ne>>>16&15]+m[ne>>>12&15]+m[ne>>>8&15]+m[ne>>>4&15]+m[15&ne]),ke},ee.prototype.toString=ee.prototype.hex,ee.prototype.digest=function(){this.finalize();var C=this.h0,X=this.h1,ce=this.h2,V=this.h3,G=this.h4,K=this.h5,ae=this.h6,ne=this.h7,ke=[C>>>24&255,C>>>16&255,C>>>8&255,255&C,X>>>24&255,X>>>16&255,X>>>8&255,255&X,ce>>>24&255,ce>>>16&255,ce>>>8&255,255&ce,V>>>24&255,V>>>16&255,V>>>8&255,255&V,G>>>24&255,G>>>16&255,G>>>8&255,255&G,K>>>24&255,K>>>16&255,K>>>8&255,255&K,ae>>>24&255,ae>>>16&255,ae>>>8&255,255&ae];return this.is224||ke.push(ne>>>24&255,ne>>>16&255,ne>>>8&255,255&ne),ke},ee.prototype.array=ee.prototype.digest,ee.prototype.arrayBuffer=function(){this.finalize();var C=new ArrayBuffer(this.is224?28:32),X=new DataView(C);return X.setUint32(0,this.h0),X.setUint32(4,this.h1),X.setUint32(8,this.h2),X.setUint32(12,this.h3),X.setUint32(16,this.h4),X.setUint32(20,this.h5),X.setUint32(24,this.h6),this.is224||X.setUint32(28,this.h7),C},me.prototype=new ee,me.prototype.finalize=function(){if(ee.prototype.finalize.call(this),this.inner){this.inner=!1;var C=this.array();ee.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(C),ee.prototype.finalize.call(this)}};var re=M();re.sha256=re,re.sha224=M(!0),re.sha256.hmac=se(),re.sha224.hmac=se(!0),f?hf.exports=re:(s.sha256=re.sha256,s.sha224=re.sha224)})();Vo.exports;Vo.exports.sha224;var E0=Vo.exports.sha256;function Rf(r){return Dv(r)}function Nv(r){if(!/^[0-9A-Fa-f]+$/.test(r))return!1;const s=/^[0-9A-F]+$/.test(r),a=/^[0-9a-f]+$/.test(r);return s||a?r.length%2===0:!1}function Cv(r){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(r)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(r)}function kv(r){return Nv(r)?"hex":Cv(r)?"b64":""}function Mv(r){if(r.length%2!==0)throw new Error("hex string must have an even length");const n=new Uint8Array(r.length/2);for(let s=0;s<r.length;s+=2)n[s/2]=parseInt(r.substring(s,s+2),16);return n}function Rv(r){r=r.replace(/-/g,"+"),r=r.replace(/_/g,"/");const n=atob(r);return Uint8Array.from(n,s=>s.charCodeAt(0))}function Dv(r){switch(kv(r)){case"hex":return Mv(r);case"b64":return Rv(r)}return null}function zv(r,n){const s=typeof r=="string"?Rf(r):r,a=typeof n=="string"?Rf(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 Sg{constructor(n,s,a=!0){v(this,"token");v(this,"received");v(this,"ctx");v(this,"requestSubject");v(this,"mux");this.mux=n,this.requestSubject=s,this.received=0,this.token=Ks.next(),a&&(this.ctx=new Error)}}class qv extends Sg{constructor(s,a,o={maxWait:1e3}){super(s,a);v(this,"callback");v(this,"done");v(this,"timer");v(this,"max");v(this,"opts");if(this.opts=o,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof o.maxMessages=="number"&&o.maxMessages>0?o.maxMessages:-1,this.done=st(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},o.maxWait)}cancel(s){s&&this.callback(s,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(s,a){s?(this.ctx&&(s.stack+=`
|
|
32
|
+
`:a="\\n";break;case"\r":a="\\r";break;case" ":a="\\t";break}throw Error(`invalid ${r} name - ${r} name cannot contain '${a}'`)}}),""}function ka(r,n=""){if(n==="")throw Error(`${r} name required`);const s=vv(n);if(s.length)throw new Error(`invalid ${r} name - ${r} name ${s}`)}function vv(r=""){if(r==="")throw Error("name required");const n=/^[-\w]+$/g;if(r.match(n)===null){for(const a of r.split(""))if(a.match(n)===null)return`cannot contain '${a}'`}return""}function Nf(r){if(r.data.length>0)return!1;const n=r.headers;return n?n.code>=100&&n.code<200:!1}function Cf(r){var n;return Nf(r)&&((n=r.headers)==null?void 0:n.description)==="Idle Heartbeat"}function _v(r,n,s){const a=hs(r,n),o={hdr:1,sid:0,size:0},f=new nh(o,nn,{});return f._headers=a,f._subject=s,f}function wr(r){if(r.data.length!==0)return null;const n=r.headers;return n?Sg(n.code,n.description):null}var xn;(function(r){r.MaxBatchExceeded="exceeded maxrequestbatch of",r.MaxExpiresExceeded="exceeded maxrequestexpires of",r.MaxBytesExceeded="exceeded maxrequestmaxbytes of",r.MaxMessageSizeExceeded="message size exceeds maxbytes",r.PushConsumer="consumer is push based",r.MaxWaitingExceeded="exceeded maxwaiting",r.IdleHeartbeatMissed="idle heartbeats missed",r.ConsumerDeleted="consumer deleted"})(xn||(xn={}));function wv(r){return r.code!==ie.JetStream409?!1:[xn.MaxBatchExceeded,xn.MaxExpiresExceeded,xn.MaxBytesExceeded,xn.MaxMessageSizeExceeded,xn.PushConsumer,xn.IdleHeartbeatMissed,xn.ConsumerDeleted].find(s=>r.message.indexOf(s)!==-1)!==void 0}function Sg(r,n=""){if(r<300)return null;switch(n=n.toLowerCase(),r){case 404:return new ue(n,ie.JetStream404NoMessages);case 408:return new ue(n,ie.JetStream408RequestTimeout);case 409:{const s=n.startsWith(xn.IdleHeartbeatMissed)?ie.JetStreamIdleHeartBeat:ie.JetStream409;return new ue(n,s)}case 503:return ue.errorForCode(ie.JetStreamNotEnabled,new Error(n));default:return n===""&&(n=ie.Unknown),new ue(n,`${r}`)}}class _t{constructor(){v(this,"inflight");v(this,"processed");v(this,"received");v(this,"noIterator");v(this,"iterClosed");v(this,"done");v(this,"signal");v(this,"yields");v(this,"filtered");v(this,"pendingFiltered");v(this,"ingestionFilterFn");v(this,"protocolFilterFn");v(this,"dispatchedFn");v(this,"ctx");v(this,"_data");v(this,"err");v(this,"time");v(this,"yielding");this.inflight=0,this.filtered=0,this.pendingFiltered=0,this.processed=0,this.received=0,this.noIterator=!1,this.done=!1,this.signal=st(),this.yields=[],this.iterClosed=st(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(n){if(this.done)return;if(typeof n=="function"){this.yields.push(n),this.signal.resolve();return}const{ingest:s,protocol:a}=this.ingestionFilterFn?this.ingestionFilterFn(n,this.ctx||this):{ingest:!0,protocol:!1};s&&(a&&(this.filtered++,this.pendingFiltered++),this.yields.push(n),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new ue("unsupported iterator",ie.ApiError);if(this.yielding)throw new ue("already yielding",ie.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const n=this.yields;this.inflight=n.length,this.yields=[];for(let s=0;s<n.length;s++){if(typeof n[s]=="function"){const o=n[s];try{o()}catch(f){throw f}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(n[s]):!0){this.processed++;const o=Date.now();yield n[s],this.time=Date.now()-o,this.dispatchedFn&&n[s]&&this.dispatchedFn(n[s])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=st())}}finally{this.stop()}}stop(n){this.done||(this.err=n,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(n))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class sh{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 kf;(function(r){r.Limits="limits",r.Interest="interest",r.Workqueue="workqueue"})(kf||(kf={}));var La;(function(r){r.Old="old",r.New="new"})(La||(La={}));var Mf;(function(r){r.File="file",r.Memory="memory"})(Mf||(Mf={}));var ft;(function(r){r.All="all",r.Last="last",r.New="new",r.StartSequence="by_start_sequence",r.StartTime="by_start_time",r.LastPerSubject="last_per_subject"})(ft||(ft={}));var vt;(function(r){r.None="none",r.All="all",r.Explicit="explicit",r.NotSet=""})(vt||(vt={}));var jr;(function(r){r.Instant="instant",r.Original="original"})(jr||(jr={}));var Ws;(function(r){r.None="none",r.S2="s2"})(Ws||(Ws={}));var Do;(function(r){r.CreateOrUpdate="",r.Update="update",r.Create="create"})(Do||(Do={}));function Sv(r,n={}){return Object.assign({name:r,deliver_policy:ft.All,ack_policy:vt.Explicit,ack_wait:nt(30*1e3),replay_policy:jr.Instant},n)}var x0;(function(r){r.API="api_audit",r.StreamAction="stream_action",r.ConsumerAction="consumer_action",r.SnapshotCreate="snapshot_create",r.SnapshotComplete="snapshot_complete",r.RestoreCreate="restore_create",r.RestoreComplete="restore_complete",r.MaxDeliver="max_deliver",r.Terminated="terminated",r.Ack="consumer_ack",r.StreamLeaderElected="stream_leader_elected",r.StreamQuorumLost="stream_quorum_lost",r.ConsumerLeaderElected="consumer_leader_elected",r.ConsumerQuorumLost="consumer_quorum_lost"})(x0||(x0={}));var Dt;(function(r){r.StreamSourceHdr="Nats-Stream-Source",r.LastConsumerSeqHdr="Nats-Last-Consumer",r.LastStreamSeqHdr="Nats-Last-Stream",r.ConsumerStalledHdr="Nats-Consumer-Stalled",r.MessageSizeHdr="Nats-Msg-Size",r.RollupHdr="Nats-Rollup",r.RollupValueSubject="sub",r.RollupValueAll="all",r.PendingMessagesHdr="Nats-Pending-Messages",r.PendingBytesHdr="Nats-Pending-Bytes"})(Dt||(Dt={}));var Nn;(function(r){r.LastValue="",r.AllHistory="history",r.UpdatesOnly="updates"})(Nn||(Nn={}));var br;(function(r){r.Stream="Nats-Stream",r.Sequence="Nats-Sequence",r.TimeStamp="Nats-Time-Stamp",r.Subject="Nats-Subject"})(br||(br={}));var v0;(function(r){r.Stream="Nats-Stream",r.Subject="Nats-Subject",r.Sequence="Nats-Sequence",r.LastSequence="Nats-Last-Sequence",r.Size="Nats-Msg-Size"})(v0||(v0={}));const Zt="KV_";class Ev{constructor(n){v(this,"config");v(this,"ordered");v(this,"mack");v(this,"stream");v(this,"callbackFn");v(this,"max");v(this,"qname");v(this,"isBind");v(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=Sv("",n||{})}getOpts(){var s;const n={};if(n.config=Object.assign({},this.config),n.config.filter_subject&&(this.filterSubject(n.config.filter_subject),n.config.filter_subject=void 0),n.config.filter_subjects&&((s=n.config.filter_subjects)==null||s.forEach(a=>{this.filterSubject(a)}),n.config.filter_subjects=void 0),n.mack=this.mack,n.stream=this.stream,n.callbackFn=this.callbackFn,n.max=this.max,n.queue=this.qname,n.ordered=this.ordered,n.config.ack_policy=n.ordered?vt.None:n.config.ack_policy,n.isBind=n.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:n.config.filter_subject=this.filters[0];break;default:n.config.filter_subjects=this.filters}return n}description(n){return this.config.description=n,this}deliverTo(n){return this.config.deliver_subject=n,this}durable(n){return _r(n),this.config.durable_name=n,this}startSequence(n){if(n<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=ft.StartSequence,this.config.opt_start_seq=n,this}startTime(n){return this.config.deliver_policy=ft.StartTime,this.config.opt_start_time=n.toISOString(),this}deliverAll(){return this.config.deliver_policy=ft.All,this}deliverLastPerSubject(){return this.config.deliver_policy=ft.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=ft.Last,this}deliverNew(){return this.config.deliver_policy=ft.New,this}startAtTimeDelta(n){return this.startTime(new Date(Date.now()-n)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=vt.None,this}ackAll(){return this.config.ack_policy=vt.All,this}ackExplicit(){return this.config.ack_policy=vt.Explicit,this}ackWait(n){return this.config.ack_wait=nt(n),this}maxDeliver(n){return this.config.max_deliver=n,this}filterSubject(n){return this.filters=this.filters||[],this.filters.push(n),this}replayInstantly(){return this.config.replay_policy=jr.Instant,this}replayOriginal(){return this.config.replay_policy=jr.Original,this}sample(n){if(n=Math.trunc(n),n<0||n>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${n}%`,this}limit(n){return this.config.rate_limit_bps=n,this}maxWaiting(n){return this.config.max_waiting=n,this}maxAckPending(n){return this.config.max_ack_pending=n,this}idleHeartbeat(n){return this.config.idle_heartbeat=nt(n),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(n){return this.queue(n),this}manualAck(){return this.mack=!0,this}maxMessages(n){return this.max=n,this}callback(n){return this.callbackFn=n,this}queue(n){return this.qname=n,this.config.deliver_group=n,this}orderedConsumer(){return this.ordered=!0,this}bind(n,s){return this.stream=n,this.config.durable_name=s,this.isBind=!0,this}bindStream(n){return this.stream=n,this}inactiveEphemeralThreshold(n){return this.config.inactive_threshold=nt(n),this}maxPullBatch(n){return this.config.max_batch=n,this}maxPullRequestExpires(n){return this.config.max_expires=nt(n),this}memory(){return this.config.mem_storage=!0,this}numReplicas(n){return this.config.num_replicas=n,this}consumerName(n){return this.config.name=n,this}}function Qs(r){return new Ev(r)}function _0(r){return typeof r.getOpts=="function"}class Av{static encode(n){if(typeof n=="string")return btoa(n);const s=Array.from(n);return btoa(String.fromCharCode(...s))}static decode(n,s=!1){const a=atob(n);return s?Uint8Array.from(a,o=>o.charCodeAt(0)):a}}class Sr{static encode(n){return Sr.toB64URLEncoding(Av.encode(n))}static decode(n,s=!1){return Sr.decode(Sr.fromB64URLEncoding(n),s)}static toB64URLEncoding(n){return n.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(n){return n.replace(/_/g,"/").replace(/-/g,"+")}}class Or{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=""),Ti.encode(n)}static toAscii(n){return en.decode(n)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const n=new Uint8Array(this.byteLength);let s=0;for(let a=0;a<this.buffers.length;a++)n.set(this.buffers[a],s),s+=this.buffers[a].length;this.buffers.length=0,this.buffers.push(n)}}shift(){if(this.buffers.length){const n=this.buffers.shift();if(n)return this.byteLength-=n.length,n}return new Uint8Array(0)}drain(n){if(this.buffers.length){this.pack();const s=this.buffers.pop();if(s){const a=this.byteLength;(n===void 0||n>a)&&(n=a);const o=s.subarray(0,n);return a>n&&this.buffers.push(s.subarray(n)),this.byteLength=a-n,o}}return new Uint8Array(0)}fill(n,...s){n&&(this.buffers.push(n),this.byteLength+=n.length);for(let a=0;a<s.length;a++)s[a]&&s[a].length&&(this.buffers.push(s[a]),this.byteLength+=s[a].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function jv(r,n){return n.forEach(function(s){s&&typeof s!="string"&&!Array.isArray(s)&&Object.keys(s).forEach(function(a){if(a!=="default"&&!(a in r)){var o=Object.getOwnPropertyDescriptor(s,a);Object.defineProperty(r,a,o.get?o:{enumerable:!0,get:function(){return s[a]}})}})}),Object.freeze(r)}var Ov=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},Aa=Ov.performance||{};Aa.now||Aa.mozNow||Aa.msNow||Aa.oNow||Aa.webkitNow;var w0={versions:{}},Tv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Nv(r){if(r.__esModule)return r;var n=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(r).forEach(function(s){var a=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(n,s,a.get?a:{enumerable:!0,get:function(){return r[s]}})}),n}var hf,Vo={exports:{}},S0={},E0=Nv(jv({__proto__:null,default:S0},[S0]));hf=Vo,(function(){var r="input is invalid type",n=typeof window=="object",s=n?window:{};s.JS_SHA256_NO_WINDOW&&(n=!1);var a=!n&&typeof self=="object",o=!s.JS_SHA256_NO_NODE_JS&&w0.versions&&w0.versions.node;o?s=Tv:a&&(s=self);var f=!s.JS_SHA256_NO_COMMON_JS&&hf.exports,h=!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(C){return Object.prototype.toString.call(C)==="[object Array]"}),!h||!s.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(C){return typeof C=="object"&&C.buffer&&C.buffer.constructor===ArrayBuffer});var q=function(C,X){return function(ce){return new ee(X,!0).update(ce)[C]()}},M=function(C){var X=q("hex",C);o&&(X=D(X,C)),X.create=function(){return new ee(C)},X.update=function(G){return X.create().update(G)};for(var ce=0;ce<w.length;++ce){var V=w[ce];X[V]=q(V,C)}return X},D=function(C,X){var ce,V=E0,G=E0.Buffer,K=X?"sha224":"sha256";return ce=G.from&&!s.JS_SHA256_NO_BUFFER_FROM?G.from:function(ae){return new G(ae)},function(ae){if(typeof ae=="string")return V.createHash(K).update(ae,"utf8").digest("hex");if(ae==null)throw new Error(r);return ae.constructor===ArrayBuffer&&(ae=new Uint8Array(ae)),Array.isArray(ae)||ArrayBuffer.isView(ae)||ae.constructor===G?V.createHash(K).update(ce(ae)).digest("hex"):C(ae)}},W=function(C,X){return function(ce,V){return new me(ce,X,!0).update(V)[C]()}},se=function(C){var X=W("hex",C);X.create=function(G){return new me(G,C)},X.update=function(G,K){return X.create(G).update(K)};for(var ce=0;ce<w.length;++ce){var V=w[ce];X[V]=W(V,C)}return X};function ee(C,X){X?(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],C?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=C}function me(C,X,ce){var V,G=typeof C;if(G==="string"){var K,ae=[],ne=C.length,ke=0;for(V=0;V<ne;++V)(K=C.charCodeAt(V))<128?ae[ke++]=K:K<2048?(ae[ke++]=192|K>>>6,ae[ke++]=128|63&K):K<55296||K>=57344?(ae[ke++]=224|K>>>12,ae[ke++]=128|K>>>6&63,ae[ke++]=128|63&K):(K=65536+((1023&K)<<10|1023&C.charCodeAt(++V)),ae[ke++]=240|K>>>18,ae[ke++]=128|K>>>12&63,ae[ke++]=128|K>>>6&63,ae[ke++]=128|63&K);C=ae}else{if(G!=="object")throw new Error(r);if(C===null)throw new Error(r);if(h&&C.constructor===ArrayBuffer)C=new Uint8Array(C);else if(!(Array.isArray(C)||h&&ArrayBuffer.isView(C)))throw new Error(r)}C.length>64&&(C=new ee(X,!0).update(C).array());var He=[],Me=[];for(V=0;V<64;++V){var $=C[V]||0;He[V]=92^$,Me[V]=54^$}ee.call(this,X,ce),this.update(Me),this.oKeyPad=He,this.inner=!0,this.sharedMemory=ce}ee.prototype.update=function(C){if(!this.finalized){var X,ce=typeof C;if(ce!=="string"){if(ce!=="object")throw new Error(r);if(C===null)throw new Error(r);if(h&&C.constructor===ArrayBuffer)C=new Uint8Array(C);else if(!(Array.isArray(C)||h&&ArrayBuffer.isView(C)))throw new Error(r);X=!0}for(var V,G,K=0,ae=C.length,ne=this.blocks;K<ae;){if(this.hashed&&(this.hashed=!1,ne[0]=this.block,this.block=ne[16]=ne[1]=ne[2]=ne[3]=ne[4]=ne[5]=ne[6]=ne[7]=ne[8]=ne[9]=ne[10]=ne[11]=ne[12]=ne[13]=ne[14]=ne[15]=0),X)for(G=this.start;K<ae&&G<64;++K)ne[G>>>2]|=C[K]<<y[3&G++];else for(G=this.start;K<ae&&G<64;++K)(V=C.charCodeAt(K))<128?ne[G>>>2]|=V<<y[3&G++]:V<2048?(ne[G>>>2]|=(192|V>>>6)<<y[3&G++],ne[G>>>2]|=(128|63&V)<<y[3&G++]):V<55296||V>=57344?(ne[G>>>2]|=(224|V>>>12)<<y[3&G++],ne[G>>>2]|=(128|V>>>6&63)<<y[3&G++],ne[G>>>2]|=(128|63&V)<<y[3&G++]):(V=65536+((1023&V)<<10|1023&C.charCodeAt(++K)),ne[G>>>2]|=(240|V>>>18)<<y[3&G++],ne[G>>>2]|=(128|V>>>12&63)<<y[3&G++],ne[G>>>2]|=(128|V>>>6&63)<<y[3&G++],ne[G>>>2]|=(128|63&V)<<y[3&G++]);this.lastByteIndex=G,this.bytes+=G-this.start,G>=64?(this.block=ne[16],this.start=G-64,this.hash(),this.hashed=!0):this.start=G}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},ee.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var C=this.blocks,X=this.lastByteIndex;C[16]=this.block,C[X>>>2]|=g[3&X],this.block=C[16],X>=56&&(this.hashed||this.hash(),C[0]=this.block,C[16]=C[1]=C[2]=C[3]=C[4]=C[5]=C[6]=C[7]=C[8]=C[9]=C[10]=C[11]=C[12]=C[13]=C[14]=C[15]=0),C[14]=this.hBytes<<3|this.bytes>>>29,C[15]=this.bytes<<3,this.hash()}},ee.prototype.hash=function(){var C,X,ce,V,G,K,ae,ne,ke,He=this.h0,Me=this.h1,$=this.h2,te=this.h3,de=this.h4,_e=this.h5,be=this.h6,Oe=this.h7,we=this.blocks;for(C=16;C<64;++C)X=((G=we[C-15])>>>7|G<<25)^(G>>>18|G<<14)^G>>>3,ce=((G=we[C-2])>>>17|G<<15)^(G>>>19|G<<13)^G>>>10,we[C]=we[C-16]+X+we[C-7]+ce|0;for(ke=Me&$,C=0;C<64;C+=4)this.first?(this.is224?(K=300032,Oe=(G=we[0]-1413257819)-150054599|0,te=G+24177077|0):(K=704751109,Oe=(G=we[0]-210244248)-1521486534|0,te=G+143694565|0),this.first=!1):(X=(He>>>2|He<<30)^(He>>>13|He<<19)^(He>>>22|He<<10),V=(K=He&Me)^He&$^ke,Oe=te+(G=Oe+(ce=(de>>>6|de<<26)^(de>>>11|de<<21)^(de>>>25|de<<7))+(de&_e^~de&be)+E[C]+we[C])|0,te=G+(X+V)|0),X=(te>>>2|te<<30)^(te>>>13|te<<19)^(te>>>22|te<<10),V=(ae=te&He)^te&Me^K,be=$+(G=be+(ce=(Oe>>>6|Oe<<26)^(Oe>>>11|Oe<<21)^(Oe>>>25|Oe<<7))+(Oe&de^~Oe&_e)+E[C+1]+we[C+1])|0,X=(($=G+(X+V)|0)>>>2|$<<30)^($>>>13|$<<19)^($>>>22|$<<10),V=(ne=$&te)^$&He^ae,_e=Me+(G=_e+(ce=(be>>>6|be<<26)^(be>>>11|be<<21)^(be>>>25|be<<7))+(be&Oe^~be&de)+E[C+2]+we[C+2])|0,X=((Me=G+(X+V)|0)>>>2|Me<<30)^(Me>>>13|Me<<19)^(Me>>>22|Me<<10),V=(ke=Me&$)^Me&te^ne,de=He+(G=de+(ce=(_e>>>6|_e<<26)^(_e>>>11|_e<<21)^(_e>>>25|_e<<7))+(_e&be^~_e&Oe)+E[C+3]+we[C+3])|0,He=G+(X+V)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+He|0,this.h1=this.h1+Me|0,this.h2=this.h2+$|0,this.h3=this.h3+te|0,this.h4=this.h4+de|0,this.h5=this.h5+_e|0,this.h6=this.h6+be|0,this.h7=this.h7+Oe|0},ee.prototype.hex=function(){this.finalize();var C=this.h0,X=this.h1,ce=this.h2,V=this.h3,G=this.h4,K=this.h5,ae=this.h6,ne=this.h7,ke=m[C>>>28&15]+m[C>>>24&15]+m[C>>>20&15]+m[C>>>16&15]+m[C>>>12&15]+m[C>>>8&15]+m[C>>>4&15]+m[15&C]+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[ce>>>28&15]+m[ce>>>24&15]+m[ce>>>20&15]+m[ce>>>16&15]+m[ce>>>12&15]+m[ce>>>8&15]+m[ce>>>4&15]+m[15&ce]+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[G>>>28&15]+m[G>>>24&15]+m[G>>>20&15]+m[G>>>16&15]+m[G>>>12&15]+m[G>>>8&15]+m[G>>>4&15]+m[15&G]+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[ae>>>28&15]+m[ae>>>24&15]+m[ae>>>20&15]+m[ae>>>16&15]+m[ae>>>12&15]+m[ae>>>8&15]+m[ae>>>4&15]+m[15&ae];return this.is224||(ke+=m[ne>>>28&15]+m[ne>>>24&15]+m[ne>>>20&15]+m[ne>>>16&15]+m[ne>>>12&15]+m[ne>>>8&15]+m[ne>>>4&15]+m[15&ne]),ke},ee.prototype.toString=ee.prototype.hex,ee.prototype.digest=function(){this.finalize();var C=this.h0,X=this.h1,ce=this.h2,V=this.h3,G=this.h4,K=this.h5,ae=this.h6,ne=this.h7,ke=[C>>>24&255,C>>>16&255,C>>>8&255,255&C,X>>>24&255,X>>>16&255,X>>>8&255,255&X,ce>>>24&255,ce>>>16&255,ce>>>8&255,255&ce,V>>>24&255,V>>>16&255,V>>>8&255,255&V,G>>>24&255,G>>>16&255,G>>>8&255,255&G,K>>>24&255,K>>>16&255,K>>>8&255,255&K,ae>>>24&255,ae>>>16&255,ae>>>8&255,255&ae];return this.is224||ke.push(ne>>>24&255,ne>>>16&255,ne>>>8&255,255&ne),ke},ee.prototype.array=ee.prototype.digest,ee.prototype.arrayBuffer=function(){this.finalize();var C=new ArrayBuffer(this.is224?28:32),X=new DataView(C);return X.setUint32(0,this.h0),X.setUint32(4,this.h1),X.setUint32(8,this.h2),X.setUint32(12,this.h3),X.setUint32(16,this.h4),X.setUint32(20,this.h5),X.setUint32(24,this.h6),this.is224||X.setUint32(28,this.h7),C},me.prototype=new ee,me.prototype.finalize=function(){if(ee.prototype.finalize.call(this),this.inner){this.inner=!1;var C=this.array();ee.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(C),ee.prototype.finalize.call(this)}};var re=M();re.sha256=re,re.sha224=M(!0),re.sha256.hmac=se(),re.sha224.hmac=se(!0),f?hf.exports=re:(s.sha256=re.sha256,s.sha224=re.sha224)})();Vo.exports;Vo.exports.sha224;var A0=Vo.exports.sha256;function Rf(r){return zv(r)}function Cv(r){if(!/^[0-9A-Fa-f]+$/.test(r))return!1;const s=/^[0-9A-F]+$/.test(r),a=/^[0-9a-f]+$/.test(r);return s||a?r.length%2===0:!1}function kv(r){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(r)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(r)}function Mv(r){return Cv(r)?"hex":kv(r)?"b64":""}function Rv(r){if(r.length%2!==0)throw new Error("hex string must have an even length");const n=new Uint8Array(r.length/2);for(let s=0;s<r.length;s+=2)n[s/2]=parseInt(r.substring(s,s+2),16);return n}function Dv(r){r=r.replace(/-/g,"+"),r=r.replace(/_/g,"/");const n=atob(r);return Uint8Array.from(n,s=>s.charCodeAt(0))}function zv(r){switch(Mv(r)){case"hex":return Rv(r);case"b64":return Dv(r)}return null}function qv(r,n){const s=typeof r=="string"?Rf(r):r,a=typeof n=="string"?Rf(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 Eg{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=Zs.next(),a&&(this.ctx=new Error)}}class Uv extends Eg{constructor(s,a,o={maxWait:1e3}){super(s,a);v(this,"callback");v(this,"done");v(this,"timer");v(this,"max");v(this,"opts");if(this.opts=o,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof o.maxMessages=="number"&&o.maxMessages>0?o.maxMessages:-1,this.done=st(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},o.maxWait)}cancel(s){s&&this.callback(s,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(s,a){s?(this.ctx&&(s.stack+=`
|
|
33
33
|
|
|
34
|
-
${this.ctx.stack}`),this.cancel(s)):(this.callback(null,a),this.opts.strategy===
|
|
34
|
+
${this.ctx.stack}`),this.cancel(s)):(this.callback(null,a),this.opts.strategy===kn.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===kn.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===kn.SentinelMsg&&a&&a.data.length===0&&this.cancel())}}class Ag extends Eg{constructor(s,a,o={timeout:1e3},f=!0){super(s,a,f);v(this,"deferred");v(this,"timer");this.deferred=st(),this.timer=Ar(o.timeout,f)}resolver(s,a){this.timer&&this.timer.cancel(),s?(this.ctx&&(s.stack+=`
|
|
35
35
|
|
|
36
|
-
${this.ctx.stack}`),this.deferred.reject(s)):this.deferred.resolve(a),this.cancel()}cancel(s){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(s||ue.errorForCode(ie.Cancelled))}}const
|
|
37
|
-
`,qo=Or.fromAscii(Eo),Yv=new Uint8Array(qo)[0],Gv=new Uint8Array(qo)[1];function Vv(r){for(let n=0;n<r.length;n++){const s=n+1;if(r.byteLength>s&&r[n]===Yv&&r[s]===Gv)return s+1}return 0}function Fv(r){const n=Vv(r);if(n>0){const a=new Uint8Array(r).slice(0,n);return en.decode(a)}return""}const Jv=4,jg=48,Qv=65,Iv=97;function Xv(r,n,s,a){const o=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((h,m)=>{o[m]=h}),o[12]=r,o[13]=n,o[14]=s,o[15]=a,o}function qf(r){return Kv(r)!==void 0}function Kv(r){for(let n=0;n<r.length;n++)switch(r[n]){case".":return Og(r);case":":return Zv(r)}}function Og(r){const n=new Uint8Array(4);for(let s=0;s<4;s++){if(r.length===0)return;if(s>0){if(r[0]!==".")return;r=r.substring(1)}const{n:a,c:o,ok:f}=Wv(r);if(!f||a>255)return;r=r.substring(o),n[s]=a}return Xv(n[0],n[1],n[2],n[3])}function Zv(r){const n=new Uint8Array(16);let s=-1;if(r.length>=2&&r[0]===":"&&r[1]===":"&&(s=0,r=r.substring(2),r.length===0))return n;let a=0;for(;a<16;){const{n:o,c:f,ok:h}=e1(r);if(!h||o>65535)return;if(f<r.length&&r[f]==="."){if(s<0&&a!=12||a+4>16)return;const m=Og(r);if(m===void 0)return;n[a]=m[12],n[a+1]=m[13],n[a+2]=m[14],n[a+3]=m[15],r="",a+=Jv;break}if(n[a]=o>>8,n[a+1]=o,a+=2,r=r.substring(f),r.length===0)break;if(r[0]!==":"||r.length==1)return;if(r=r.substring(1),r[0]===":"){if(s>=0)return;if(s=a,r=r.substring(1),r.length===0)break}}if(r.length===0){if(a<16){if(s<0)return;const o=16-a;for(let f=a-1;f>=s;f--)n[f+o]=n[f];for(let f=s+o-1;f>=s;f--)n[f]=0}else if(s>=0)return;return n}}function Wv(r){let n=0,s=0;for(n=0;n<r.length&&48<=r.charCodeAt(n)&&r.charCodeAt(n)<=57;n++)if(s=s*10+(r.charCodeAt(n)-jg),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 e1(r){let n=0,s=0;for(s=0;s<r.length;s++){if(48<=r.charCodeAt(s)&&r.charCodeAt(s)<=57)n*=16,n+=r.charCodeAt(s)-jg;else if(97<=r.charCodeAt(s)&&r.charCodeAt(s)<=102)n*=16,n+=r.charCodeAt(s)-Iv+10;else if(65<=r.charCodeAt(s)&&r.charCodeAt(s)<=70)n*=16,n+=r.charCodeAt(s)-Qv+10;else break;if(n>=16777215)return{n:0,c:s,ok:!1}}return s===0?{n:0,c:s,ok:!1}:{n,c:s,ok:!0}}function t1(r){return r.indexOf("[")!==-1||r.indexOf("::")!==-1?!1:r.indexOf(".")!==-1||r.split(":").length<=2}function Uf(r){return!t1(r)}function n1(r){const n="::FFFF:",s=r.toUpperCase().indexOf(n);if(s!==-1&&r.indexOf(".")!==-1){let a=r.substring(s+n.length);return a=a.replace("[",""),a.replace("]","")}return r}function s1(r){r=r.trim(),r.match(/^(.*:\/\/)(.*)/m)&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2")),r=n1(r),Uf(r)&&r.indexOf("[")===-1&&(r=`[${r}]`);const n=Uf(r)?r.match(/(]:)(\d+)/):r.match(/(:)(\d+)/),s=n&&n.length===3&&n[1]&&n[2]?parseInt(n[2]):4222,a=s===80?"https":"http",o=new URL(`${a}://${r}`);o.port=`${s}`;let f=o.hostname;return f.charAt(0)==="["&&(f=f.substring(1,f.length-1)),{listen:o.host,hostname:f,port:s}}class za{constructor(n,s=!1){v(this,"src");v(this,"listen");v(this,"hostname");v(this,"port");v(this,"didConnect");v(this,"reconnects");v(this,"lastConnect");v(this,"gossiped");v(this,"tlsName");v(this,"resolves");this.src=n,this.tlsName="";const a=s1(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(qf(this.hostname))return[this];{const a=await n.fn(this.hostname);n.debug&&console.log(`resolve ${this.hostname} = ${a.join(",")}`);for(const o of a){const f=this.port===80?"https":"http",h=new URL(`${f}://${Uf(o)?"["+o+"]":o}`);h.port=`${this.port}`;const m=new za(h.host,!1);m.tlsName=this.hostname,s.push(m)}}return n.randomize&&vg(s),this.resolves=s,s}}class i1{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=df();n&&(n.forEach(o=>{o=a?a(o):o,this.servers.push(new za(o))}),this.randomize&&(this.servers=vg(this.servers))),this.servers.length===0&&this.addServer(`${Of}:${Ag()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const n=this.getCurrentServer();qf(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=df();n=a?a(n):n;const o=new za(n,s);qf(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=df(),h=new Map;n.connect_urls&&n.connect_urls.length>0&&n.connect_urls.forEach(g=>{g=f?f(g,s):g;const y=new za(g,!0);h.set(g,y)});const m=[];return this.servers.forEach((g,y)=>{const E=g.listen;g.gossiped&&this.currentServer.listen!==E&&h.get(E)===void 0&&m.push(y),h.delete(E)}),m.reverse(),m.forEach(g=>{const y=this.servers.splice(g,1);o=o.concat(y[0].listen)}),h.forEach((g,y)=>{this.servers.push(g),a.push(y)}),{added:a,deleted:o}}}class r1{constructor(){v(this,"baseInbox");v(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(n){return this.baseInbox=`${fs(n)}.`,this.baseInbox}add(n){isNaN(n.received)||(n.received=0),this.reqs.set(n.token,n)}get(n){return this.reqs.get(n)}cancel(n){this.reqs.delete(n.token)}getToken(n){const s=n.subject||"";return s.indexOf(this.baseInbox)===0?s.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(n,s){if(s&&s.permissionContext){if(n)return this.all().forEach(o=>{o.resolver(s,{})}),!0;const a=s.permissionContext;if(a.operation==="publish"){const o=this.all().find(f=>f.requestSubject===a.subject);if(o)return o.resolver(s,{}),!0}}return!1}dispatcher(){return(n,s)=>{const a=this.getToken(s);if(a){const o=this.get(a);o&&(n===null&&s.headers&&(n=_g(s)),o.resolver(n,s))}}}close(){const n=ue.errorForCode(ie.Timeout);this.reqs.forEach(s=>{s.resolver(n,{})})}}class a1{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:vr.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const n=st();this.ph.flush(n).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(n),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(n=>(n.resolve(),!1))}}class l1 extends Error{constructor(n){super(n),this.name="AssertionError"}}function o1(r,n="Assertion failed."){if(!r)throw new l1(n)}const A0=32*1024,mf=2**32-2;function go(r,n,s=0){const a=n.byteLength-s;return r.byteLength>a&&(r=r.subarray(0,a)),n.set(r,s),r.byteLength}class pf{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){o1(n<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,n)}readByte(){const n=new Uint8Array(1);return this.read(n)?n[0]:null}read(n){if(this.empty())return this.reset(),n.byteLength===0?0:null;const s=go(this._buf.subarray(this._off),n);return this._off+=s,s}writeByte(n){return this.write(Uint8Array.of(n))}writeString(n){return this.write(Ti.encode(n))}write(n){const s=this._grow(n.byteLength);return go(n,this._buf,s)}_grow(n){const s=this.length;s===0&&this._off!==0&&this.reset();const a=this._tryGrowByReslice(n);if(a>=0)return a;const o=this.capacity;if(n<=Math.floor(o/2)-s)go(this._buf.subarray(this._off),this._buf);else{if(o+n>mf)throw new Error("The buffer cannot be grown beyond the maximum size.");{const f=new Uint8Array(Math.min(2*o+n,mf));go(this._buf.subarray(this._off),f),this._buf=f}}return this._off=0,this._reslice(Math.min(s+n,mf)),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(A0);for(;;){const o=this.capacity-this.length<A0,f=o?a:new Uint8Array(this._buf.buffer,this.length),h=n.read(f);if(h===null)return s;o?this.write(f.subarray(0,h)):this._reslice(this.length+h),s+=h}}}var Rt;(function(r){r[r.OK=0]="OK",r[r.ERR=1]="ERR",r[r.MSG=2]="MSG",r[r.INFO=3]="INFO",r[r.PING=4]="PING",r[r.PONG=5]="PONG"})(Rt||(Rt={}));function j0(){const r={};return r.sid=-1,r.hdr=-1,r.size=-1,r}const c1=48;class O0{constructor(n){v(this,"dispatcher");v(this,"state");v(this,"as");v(this,"drop");v(this,"hdr");v(this,"ma");v(this,"argBuf");v(this,"msgBuf");this.dispatcher=n,this.state=le.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(n){let s;for(s=0;s<n.length;s++){const a=n[s];switch(this.state){case le.OP_START:switch(a){case oe.M:case oe.m:this.state=le.OP_M,this.hdr=-1,this.ma=j0();break;case oe.H:case oe.h:this.state=le.OP_H,this.hdr=0,this.ma=j0();break;case oe.P:case oe.p:this.state=le.OP_P;break;case oe.PLUS:this.state=le.OP_PLUS;break;case oe.MINUS:this.state=le.OP_MINUS;break;case oe.I:case oe.i:this.state=le.OP_I;break;default:throw this.fail(n.subarray(s))}break;case le.OP_H:switch(a){case oe.M:case oe.m:this.state=le.OP_M;break;default:throw this.fail(n.subarray(s))}break;case le.OP_M:switch(a){case oe.S:case oe.s:this.state=le.OP_MS;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MS:switch(a){case oe.G:case oe.g:this.state=le.OP_MSG;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MSG:switch(a){case oe.SPACE:case oe.TAB:this.state=le.OP_MSG_SPC;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MSG_SPC:switch(a){case oe.SPACE:case oe.TAB:continue;default:this.state=le.MSG_ARG,this.as=s}break;case le.MSG_ARG:switch(a){case oe.CR:this.drop=1;break;case oe.NL:{const o=this.argBuf?this.argBuf.bytes():n.subarray(this.as,s-this.drop);this.processMsgArgs(o),this.drop=0,this.as=s+1,this.state=le.MSG_PAYLOAD,s=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;case le.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const o=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:Rt.MSG,msg:this.ma,data:o}),this.argBuf=void 0,this.msgBuf=void 0,this.state=le.MSG_END}else{let o=this.ma.size-this.msgBuf.length;const f=n.length-s;f<o&&(o=f),o>0?(this.msgBuf.write(n.subarray(s,s+o)),s=s+o-1):this.msgBuf.writeByte(a)}else s-this.as>=this.ma.size&&(this.dispatcher.push({kind:Rt.MSG,msg:this.ma,data:n.subarray(this.as,s)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=le.MSG_END);break;case le.MSG_END:switch(a){case oe.NL:this.drop=0,this.as=s+1,this.state=le.OP_START;break;default:continue}break;case le.OP_PLUS:switch(a){case oe.O:case oe.o:this.state=le.OP_PLUS_O;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PLUS_O:switch(a){case oe.K:case oe.k:this.state=le.OP_PLUS_OK;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PLUS_OK:switch(a){case oe.NL:this.dispatcher.push({kind:Rt.OK}),this.drop=0,this.state=le.OP_START;break}break;case le.OP_MINUS:switch(a){case oe.E:case oe.e:this.state=le.OP_MINUS_E;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_E:switch(a){case oe.R:case oe.r:this.state=le.OP_MINUS_ER;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_ER:switch(a){case oe.R:case oe.r:this.state=le.OP_MINUS_ERR;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_ERR:switch(a){case oe.SPACE:case oe.TAB:this.state=le.OP_MINUS_ERR_SPC;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_ERR_SPC:switch(a){case oe.SPACE:case oe.TAB:continue;default:this.state=le.MINUS_ERR_ARG,this.as=s}break;case le.MINUS_ERR_ARG:switch(a){case oe.CR:this.drop=1;break;case oe.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=n.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Rt.ERR,data:o}),this.drop=0,this.as=s+1,this.state=le.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(a))}break;case le.OP_P:switch(a){case oe.I:case oe.i:this.state=le.OP_PI;break;case oe.O:case oe.o:this.state=le.OP_PO;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PO:switch(a){case oe.N:case oe.n:this.state=le.OP_PON;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PON:switch(a){case oe.G:case oe.g:this.state=le.OP_PONG;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PONG:switch(a){case oe.NL:this.dispatcher.push({kind:Rt.PONG}),this.drop=0,this.state=le.OP_START;break}break;case le.OP_PI:switch(a){case oe.N:case oe.n:this.state=le.OP_PIN;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PIN:switch(a){case oe.G:case oe.g:this.state=le.OP_PING;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PING:switch(a){case oe.NL:this.dispatcher.push({kind:Rt.PING}),this.drop=0,this.state=le.OP_START;break}break;case le.OP_I:switch(a){case oe.N:case oe.n:this.state=le.OP_IN;break;default:throw this.fail(n.subarray(s))}break;case le.OP_IN:switch(a){case oe.F:case oe.f:this.state=le.OP_INF;break;default:throw this.fail(n.subarray(s))}break;case le.OP_INF:switch(a){case oe.O:case oe.o:this.state=le.OP_INFO;break;default:throw this.fail(n.subarray(s))}break;case le.OP_INFO:switch(a){case oe.SPACE:case oe.TAB:this.state=le.OP_INFO_SPC;break;default:throw this.fail(n.subarray(s))}break;case le.OP_INFO_SPC:switch(a){case oe.SPACE:case oe.TAB:continue;default:this.state=le.INFO_ARG,this.as=s}break;case le.INFO_ARG:switch(a){case oe.CR:this.drop=1;break;case oe.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=n.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Rt.INFO,data:o}),this.drop=0,this.as=s+1,this.state=le.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;default:throw this.fail(n.subarray(s))}}(this.state===le.MSG_ARG||this.state===le.MINUS_ERR_ARG||this.state===le.INFO_ARG)&&!this.argBuf&&(this.argBuf=new pf(n.subarray(this.as,s-this.drop))),this.state===le.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new pf(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 pf(a),this.ma.subject=a.subarray(0,n),this.ma.reply&&(this.ma.reply=a.subarray(n))}processMsgArgs(n){if(this.hdr>=0)return this.processHeaderMsgArgs(n);const s=[];let a=-1;for(let o=0;o<n.length;o++)switch(n[o]){case oe.SPACE:case oe.TAB:case oe.CR:case oe.NL:a>=0&&(s.push(n.subarray(a,o)),a=-1);break;default:a<0&&(a=o)}switch(a>=0&&s.push(n.subarray(a)),s.length){case 3:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(s[2]);break;case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.size=this.protoParseInt(s[3]);break;default:throw this.fail(n,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(n,"processMsgArgs Bad or Missing Size Error")}fail(n,s=""){return s?s=`${s} [${this.state}]`:s=`parse error [${this.state}]`,new Error(`${s}: ${en.decode(n)}`)}processHeaderMsgArgs(n){const s=[];let a=-1;for(let o=0;o<n.length;o++)switch(n[o]){case oe.SPACE:case oe.TAB:case oe.CR:case oe.NL:a>=0&&(s.push(n.subarray(a,o)),a=-1);break;default:a<0&&(a=o)}switch(a>=0&&s.push(n.subarray(a)),s.length){case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(s[2]),this.ma.size=this.protoParseInt(s[3]);break;case 5:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.hdr=this.protoParseInt(s[3]),this.ma.size=this.protoParseInt(s[4]);break;default:throw this.fail(n,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(n){if(n.length===0)return-1;let s=0;for(let a=0;a<n.length;a++){if(n[a]<48||n[a]>57)return-1;s=s*10+(n[a]-c1)}return s}}var le;(function(r){r[r.OP_START=0]="OP_START",r[r.OP_PLUS=1]="OP_PLUS",r[r.OP_PLUS_O=2]="OP_PLUS_O",r[r.OP_PLUS_OK=3]="OP_PLUS_OK",r[r.OP_MINUS=4]="OP_MINUS",r[r.OP_MINUS_E=5]="OP_MINUS_E",r[r.OP_MINUS_ER=6]="OP_MINUS_ER",r[r.OP_MINUS_ERR=7]="OP_MINUS_ERR",r[r.OP_MINUS_ERR_SPC=8]="OP_MINUS_ERR_SPC",r[r.MINUS_ERR_ARG=9]="MINUS_ERR_ARG",r[r.OP_M=10]="OP_M",r[r.OP_MS=11]="OP_MS",r[r.OP_MSG=12]="OP_MSG",r[r.OP_MSG_SPC=13]="OP_MSG_SPC",r[r.MSG_ARG=14]="MSG_ARG",r[r.MSG_PAYLOAD=15]="MSG_PAYLOAD",r[r.MSG_END=16]="MSG_END",r[r.OP_H=17]="OP_H",r[r.OP_P=18]="OP_P",r[r.OP_PI=19]="OP_PI",r[r.OP_PIN=20]="OP_PIN",r[r.OP_PING=21]="OP_PING",r[r.OP_PO=22]="OP_PO",r[r.OP_PON=23]="OP_PON",r[r.OP_PONG=24]="OP_PONG",r[r.OP_I=25]="OP_I",r[r.OP_IN=26]="OP_IN",r[r.OP_INF=27]="OP_INF",r[r.OP_INFO=28]="OP_INFO",r[r.OP_INFO_SPC=29]="OP_INFO_SPC",r[r.INFO_ARG=30]="INFO_ARG"})(le||(le={}));var oe;(function(r){r[r.CR=13]="CR",r[r.E=69]="E",r[r.e=101]="e",r[r.F=70]="F",r[r.f=102]="f",r[r.G=71]="G",r[r.g=103]="g",r[r.H=72]="H",r[r.h=104]="h",r[r.I=73]="I",r[r.i=105]="i",r[r.K=75]="K",r[r.k=107]="k",r[r.M=77]="M",r[r.m=109]="m",r[r.MINUS=45]="MINUS",r[r.N=78]="N",r[r.n=110]="n",r[r.NL=10]="NL",r[r.O=79]="O",r[r.o=111]="o",r[r.P=80]="P",r[r.p=112]="p",r[r.PLUS=43]="PLUS",r[r.R=82]="R",r[r.r=114]="r",r[r.S=83]="S",r[r.s=115]="s",r[r.SPACE=32]="SPACE",r[r.TAB=9]="TAB"})(oe||(oe={}));(function(r){var n=function(x,S){this.hi=x|0,this.lo=S|0},s=function(x){var S,_=new Float64Array(16);if(x)for(S=0;S<x.length;S++)_[S]=x[S];return _},a=function(){throw new Error("no PRNG")},o=new Uint8Array(16),f=new Uint8Array(32);f[0]=9;var h=s(),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]),O=s([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),q=s([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function M(x,S){return x<<S|x>>>32-S}function D(x,S){var _=x[S+3]&255;return _=_<<8|x[S+2]&255,_=_<<8|x[S+1]&255,_<<8|x[S+0]&255}function W(x,S){var _=x[S]<<24|x[S+1]<<16|x[S+2]<<8|x[S+3],A=x[S+4]<<24|x[S+5]<<16|x[S+6]<<8|x[S+7];return new n(_,A)}function se(x,S,_){var A;for(A=0;A<4;A++)x[S+A]=_&255,_>>>=8}function ee(x,S,_){x[S]=_.hi>>24&255,x[S+1]=_.hi>>16&255,x[S+2]=_.hi>>8&255,x[S+3]=_.hi&255,x[S+4]=_.lo>>24&255,x[S+5]=_.lo>>16&255,x[S+6]=_.lo>>8&255,x[S+7]=_.lo&255}function me(x,S,_,A,N){var z,Q=0;for(z=0;z<N;z++)Q|=x[S+z]^_[A+z];return(1&Q-1>>>8)-1}function re(x,S,_,A){return me(x,S,_,A,16)}function C(x,S,_,A){return me(x,S,_,A,32)}function X(x,S,_,A,N){var z=new Uint32Array(16),Q=new Uint32Array(16),Z=new Uint32Array(16),H=new Uint32Array(4),J,fe,je;for(J=0;J<4;J++)Q[5*J]=D(A,4*J),Q[1+J]=D(_,4*J),Q[6+J]=D(S,4*J),Q[11+J]=D(_,16+4*J);for(J=0;J<16;J++)Z[J]=Q[J];for(J=0;J<20;J++){for(fe=0;fe<4;fe++){for(je=0;je<4;je++)H[je]=Q[(5*fe+4*je)%16];for(H[1]^=M(H[0]+H[3]|0,7),H[2]^=M(H[1]+H[0]|0,9),H[3]^=M(H[2]+H[1]|0,13),H[0]^=M(H[3]+H[2]|0,18),je=0;je<4;je++)z[4*fe+(fe+je)%4]=H[je]}for(je=0;je<16;je++)Q[je]=z[je]}if(N){for(J=0;J<16;J++)Q[J]=Q[J]+Z[J]|0;for(J=0;J<4;J++)Q[5*J]=Q[5*J]-D(A,4*J)|0,Q[6+J]=Q[6+J]-D(S,4*J)|0;for(J=0;J<4;J++)se(x,4*J,Q[5*J]),se(x,16+4*J,Q[6+J])}else for(J=0;J<16;J++)se(x,4*J,Q[J]+Z[J]|0)}function ce(x,S,_,A){return X(x,S,_,A,!1),0}function V(x,S,_,A){return X(x,S,_,A,!0),0}var G=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function K(x,S,_,A,N,z,Q){var Z=new Uint8Array(16),H=new Uint8Array(64),J,fe;if(!N)return 0;for(fe=0;fe<16;fe++)Z[fe]=0;for(fe=0;fe<8;fe++)Z[fe]=z[fe];for(;N>=64;){for(ce(H,Z,Q,G),fe=0;fe<64;fe++)x[S+fe]=(_?_[A+fe]:0)^H[fe];for(J=1,fe=8;fe<16;fe++)J=J+(Z[fe]&255)|0,Z[fe]=J&255,J>>>=8;N-=64,S+=64,_&&(A+=64)}if(N>0)for(ce(H,Z,Q,G),fe=0;fe<N;fe++)x[S+fe]=(_?_[A+fe]:0)^H[fe];return 0}function ae(x,S,_,A,N){return K(x,S,null,0,_,A,N)}function ne(x,S,_,A,N){var z=new Uint8Array(32);return V(z,A,N,G),ae(x,S,_,A.subarray(16),z)}function ke(x,S,_,A,N,z,Q){var Z=new Uint8Array(32);return V(Z,z,Q,G),K(x,S,_,A,N,z.subarray(16),Z)}function He(x,S){var _,A=0;for(_=0;_<17;_++)A=A+(x[_]+S[_]|0)|0,x[_]=A&255,A>>>=8}var Me=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function $(x,S,_,A,N,z){var Q,Z,H,J,fe=new Uint32Array(17),je=new Uint32Array(17),Ke=new Uint32Array(17),Ct=new Uint32Array(17),En=new Uint32Array(17);for(H=0;H<17;H++)je[H]=Ke[H]=0;for(H=0;H<16;H++)je[H]=z[H];for(je[3]&=15,je[4]&=252,je[7]&=15,je[8]&=252,je[11]&=15,je[12]&=252,je[15]&=15;N>0;){for(H=0;H<17;H++)Ct[H]=0;for(H=0;H<16&&H<N;++H)Ct[H]=_[A+H];for(Ct[H]=1,A+=H,N-=H,He(Ke,Ct),Z=0;Z<17;Z++)for(fe[Z]=0,H=0;H<17;H++)fe[Z]=fe[Z]+Ke[H]*(H<=Z?je[Z-H]:320*je[Z+17-H]|0)|0|0;for(Z=0;Z<17;Z++)Ke[Z]=fe[Z];for(J=0,H=0;H<16;H++)J=J+Ke[H]|0,Ke[H]=J&255,J>>>=8;for(J=J+Ke[16]|0,Ke[16]=J&3,J=5*(J>>>2)|0,H=0;H<16;H++)J=J+Ke[H]|0,Ke[H]=J&255,J>>>=8;J=J+Ke[16]|0,Ke[16]=J}for(H=0;H<17;H++)En[H]=Ke[H];for(He(Ke,Me),Q=-(Ke[16]>>>7)|0,H=0;H<17;H++)Ke[H]^=Q&(En[H]^Ke[H]);for(H=0;H<16;H++)Ct[H]=z[H+16];for(Ct[16]=0,He(Ke,Ct),H=0;H<16;H++)x[S+H]=Ke[H];return 0}function te(x,S,_,A,N,z){var Q=new Uint8Array(16);return $(Q,0,_,A,N,z),re(x,S,Q,0)}function de(x,S,_,A,N){var z;if(_<32)return-1;for(ke(x,0,S,0,_,A,N),$(x,16,x,32,_-32,x),z=0;z<16;z++)x[z]=0;return 0}function ve(x,S,_,A,N){var z,Q=new Uint8Array(32);if(_<32||(ne(Q,0,32,A,N),te(S,16,S,32,_-32,Q)!==0))return-1;for(ke(x,0,S,0,_,A,N),z=0;z<32;z++)x[z]=0;return 0}function be(x,S){var _;for(_=0;_<16;_++)x[_]=S[_]|0}function Oe(x){var S,_;for(_=0;_<16;_++)x[_]+=65536,S=Math.floor(x[_]/65536),x[(_+1)*(_<15?1:0)]+=S-1+37*(S-1)*(_===15?1:0),x[_]-=S*65536}function we(x,S,_){for(var A,N=~(_-1),z=0;z<16;z++)A=N&(x[z]^S[z]),x[z]^=A,S[z]^=A}function Te(x,S){var _,A,N,z=s(),Q=s();for(_=0;_<16;_++)Q[_]=S[_];for(Oe(Q),Oe(Q),Oe(Q),A=0;A<2;A++){for(z[0]=Q[0]-65517,_=1;_<15;_++)z[_]=Q[_]-65535-(z[_-1]>>16&1),z[_-1]&=65535;z[15]=Q[15]-32767-(z[14]>>16&1),N=z[15]>>16&1,z[14]&=65535,we(Q,z,1-N)}for(_=0;_<16;_++)x[2*_]=Q[_]&255,x[2*_+1]=Q[_]>>8}function lt(x,S){var _=new Uint8Array(32),A=new Uint8Array(32);return Te(_,x),Te(A,S),C(_,0,A,0)}function Pt(x){var S=new Uint8Array(32);return Te(S,x),S[0]&1}function an(x,S){var _;for(_=0;_<16;_++)x[_]=S[2*_]+(S[2*_+1]<<8);x[15]&=32767}function jt(x,S,_){var A;for(A=0;A<16;A++)x[A]=S[A]+_[A]|0}function Ot(x,S,_){var A;for(A=0;A<16;A++)x[A]=S[A]-_[A]|0}function Se(x,S,_){var A,N,z=new Float64Array(31);for(A=0;A<31;A++)z[A]=0;for(A=0;A<16;A++)for(N=0;N<16;N++)z[A+N]+=S[A]*_[N];for(A=0;A<15;A++)z[A]+=38*z[A+16];for(A=0;A<16;A++)x[A]=z[A];Oe(x),Oe(x)}function Tt(x,S){Se(x,S,S)}function ei(x,S){var _=s(),A;for(A=0;A<16;A++)_[A]=S[A];for(A=253;A>=0;A--)Tt(_,_),A!==2&&A!==4&&Se(_,_,S);for(A=0;A<16;A++)x[A]=_[A]}function Ni(x,S){var _=s(),A;for(A=0;A<16;A++)_[A]=S[A];for(A=250;A>=0;A--)Tt(_,_),A!==1&&Se(_,_,S);for(A=0;A<16;A++)x[A]=_[A]}function ti(x,S,_){var A=new Uint8Array(32),N=new Float64Array(80),z,Q,Z=s(),H=s(),J=s(),fe=s(),je=s(),Ke=s();for(Q=0;Q<31;Q++)A[Q]=S[Q];for(A[31]=S[31]&127|64,A[0]&=248,an(N,_),Q=0;Q<16;Q++)H[Q]=N[Q],fe[Q]=Z[Q]=J[Q]=0;for(Z[0]=fe[0]=1,Q=254;Q>=0;--Q)z=A[Q>>>3]>>>(Q&7)&1,we(Z,H,z),we(J,fe,z),jt(je,Z,J),Ot(Z,Z,J),jt(J,H,fe),Ot(H,H,fe),Tt(fe,je),Tt(Ke,Z),Se(Z,J,Z),Se(J,H,je),jt(je,Z,J),Ot(Z,Z,J),Tt(H,Z),Ot(J,fe,Ke),Se(Z,J,g),jt(Z,Z,fe),Se(J,J,Z),Se(Z,fe,Ke),Se(fe,H,N),Tt(H,je),we(Z,H,z),we(J,fe,z);for(Q=0;Q<16;Q++)N[Q+16]=Z[Q],N[Q+32]=J[Q],N[Q+48]=H[Q],N[Q+64]=fe[Q];var Ct=N.subarray(32),En=N.subarray(16);return ei(Ct,Ct),Se(En,En,Ct),Te(x,En),0}function ln(x,S){return ti(x,S,f)}function Ci(x,S){return a(S,32),ln(x,S)}function ms(x,S,_){var A=new Uint8Array(32);return ti(A,_,S),V(x,o,A,G)}var Ja=de,Qa=ve;function Cr(x,S,_,A,N,z){var Q=new Uint8Array(32);return ms(Q,N,z),Ja(x,S,_,A,Q)}function kr(x,S,_,A,N,z){var Q=new Uint8Array(32);return ms(Q,N,z),Qa(x,S,_,A,Q)}function Yn(){var x=0,S=0,_=0,A=0,N=65535,z,Q,Z;for(Z=0;Z<arguments.length;Z++)z=arguments[Z].lo,Q=arguments[Z].hi,x+=z&N,S+=z>>>16,_+=Q&N,A+=Q>>>16;return S+=x>>>16,_+=S>>>16,A+=_>>>16,new n(_&N|A<<16,x&N|S<<16)}function Ia(x,S){return new n(x.hi>>>S,x.lo>>>S|x.hi<<32-S)}function ki(){var x=0,S=0,_;for(_=0;_<arguments.length;_++)x^=arguments[_].lo,S^=arguments[_].hi;return new n(S,x)}function et(x,S){var _,A,N=32-S;return S<32?(_=x.hi>>>S|x.lo<<N,A=x.lo>>>S|x.hi<<N):S<64&&(_=x.lo>>>S|x.hi<<N,A=x.hi>>>S|x.lo<<N),new n(_,A)}function Xo(x,S,_){var A=x.hi&S.hi^~x.hi&_.hi,N=x.lo&S.lo^~x.lo&_.lo;return new n(A,N)}function Xa(x,S,_){var A=x.hi&S.hi^x.hi&_.hi^S.hi&_.hi,N=x.lo&S.lo^x.lo&_.lo^S.lo&_.lo;return new n(A,N)}function Ka(x){return ki(et(x,28),et(x,34),et(x,39))}function Mi(x){return ki(et(x,14),et(x,18),et(x,41))}function Ko(x){return ki(et(x,1),et(x,8),Ia(x,7))}function Za(x){return ki(et(x,19),et(x,61),Ia(x,6))}var Zo=[new n(1116352408,3609767458),new n(1899447441,602891725),new n(3049323471,3964484399),new n(3921009573,2173295548),new n(961987163,4081628472),new n(1508970993,3053834265),new n(2453635748,2937671579),new n(2870763221,3664609560),new n(3624381080,2734883394),new n(310598401,1164996542),new n(607225278,1323610764),new n(1426881987,3590304994),new n(1925078388,4068182383),new n(2162078206,991336113),new n(2614888103,633803317),new n(3248222580,3479774868),new n(3835390401,2666613458),new n(4022224774,944711139),new n(264347078,2341262773),new n(604807628,2007800933),new n(770255983,1495990901),new n(1249150122,1856431235),new n(1555081692,3175218132),new n(1996064986,2198950837),new n(2554220882,3999719339),new n(2821834349,766784016),new n(2952996808,2566594879),new n(3210313671,3203337956),new n(3336571891,1034457026),new n(3584528711,2466948901),new n(113926993,3758326383),new n(338241895,168717936),new n(666307205,1188179964),new n(773529912,1546045734),new n(1294757372,1522805485),new n(1396182291,2643833823),new n(1695183700,2343527390),new n(1986661051,1014477480),new n(2177026350,1206759142),new n(2456956037,344077627),new n(2730485921,1290863460),new n(2820302411,3158454273),new n(3259730800,3505952657),new n(3345764771,106217008),new n(3516065817,3606008344),new n(3600352804,1432725776),new n(4094571909,1467031594),new n(275423344,851169720),new n(430227734,3100823752),new n(506948616,1363258195),new n(659060556,3750685593),new n(883997877,3785050280),new n(958139571,3318307427),new n(1322822218,3812723403),new n(1537002063,2003034995),new n(1747873779,3602036899),new n(1955562222,1575990012),new n(2024104815,1125592928),new n(2227730452,2716904306),new n(2361852424,442776044),new n(2428436474,593698344),new n(2756734187,3733110249),new n(3204031479,2999351573),new n(3329325298,3815920427),new n(3391569614,3928383900),new n(3515267271,566280711),new n(3940187606,3454069534),new n(4118630271,4000239992),new n(116418474,1914138554),new n(174292421,2731055270),new n(289380356,3203993006),new n(460393269,320620315),new n(685471733,587496836),new n(852142971,1086792851),new n(1017036298,365543100),new n(1126000580,2618297676),new n(1288033470,3409855158),new n(1501505948,4234509866),new n(1607167915,987167468),new n(1816402316,1246189591)];function Wa(x,S,_){var A=[],N=[],z=[],Q=[],Z,H,J;for(H=0;H<8;H++)A[H]=z[H]=W(x,8*H);for(var fe=0;_>=128;){for(H=0;H<16;H++)Q[H]=W(S,8*H+fe);for(H=0;H<80;H++){for(J=0;J<8;J++)N[J]=z[J];for(Z=Yn(z[7],Mi(z[4]),Xo(z[4],z[5],z[6]),Zo[H],Q[H%16]),N[7]=Yn(Z,Ka(z[0]),Xa(z[0],z[1],z[2])),N[3]=Yn(N[3],Z),J=0;J<8;J++)z[(J+1)%8]=N[J];if(H%16===15)for(J=0;J<16;J++)Q[J]=Yn(Q[J],Q[(J+9)%16],Ko(Q[(J+1)%16]),Za(Q[(J+14)%16]))}for(H=0;H<8;H++)z[H]=Yn(z[H],A[H]),A[H]=z[H];fe+=128,_-=128}for(H=0;H<8;H++)ee(x,8*H,A[H]);return _}var ni=new Uint8Array([106,9,230,103,243,188,201,8,187,103,174,133,132,202,167,59,60,110,243,114,254,148,248,43,165,79,245,58,95,29,54,241,81,14,82,127,173,230,130,209,155,5,104,140,43,62,108,31,31,131,217,171,251,65,189,107,91,224,205,25,19,126,33,121]);function ot(x,S,_){var A=new Uint8Array(64),N=new Uint8Array(256),z,Q=_;for(z=0;z<64;z++)A[z]=ni[z];for(Wa(A,S,_),_%=128,z=0;z<256;z++)N[z]=0;for(z=0;z<_;z++)N[z]=S[Q-_+z];for(N[_]=128,_=256-128*(_<112?1:0),N[_-9]=0,ee(N,_-8,new n(Q/536870912|0,Q<<3)),Wa(A,N,_),z=0;z<64;z++)x[z]=A[z];return 0}function $t(x,S){var _=s(),A=s(),N=s(),z=s(),Q=s(),Z=s(),H=s(),J=s(),fe=s();Ot(_,x[1],x[0]),Ot(fe,S[1],S[0]),Se(_,_,fe),jt(A,x[0],x[1]),jt(fe,S[0],S[1]),Se(A,A,fe),Se(N,x[3],S[3]),Se(N,N,E),Se(z,x[2],S[2]),jt(z,z,z),Ot(Q,A,_),Ot(Z,z,N),jt(H,z,N),jt(J,A,_),Se(x[0],Q,Z),Se(x[1],J,H),Se(x[2],H,Z),Se(x[3],Q,J)}function Nt(x,S,_){var A;for(A=0;A<4;A++)we(x[A],S[A],_)}function Mr(x,S){var _=s(),A=s(),N=s();ei(N,S[2]),Se(_,S[0],N),Se(A,S[1],N),Te(x,A),x[31]^=Pt(_)<<7}function Rr(x,S,_){var A,N;for(be(x[0],h),be(x[1],m),be(x[2],m),be(x[3],h),N=255;N>=0;--N)A=_[N/8|0]>>(N&7)&1,Nt(x,S,A),$t(S,x),$t(x,x),Nt(x,S,A)}function Ri(x,S){var _=[s(),s(),s(),s()];be(_[0],w),be(_[1],O),be(_[2],m),Se(_[3],w,O),Rr(x,_,S)}function ps(x,S,_){var A=new Uint8Array(64),N=[s(),s(),s(),s()],z;for(_||a(S,32),ot(A,S,32),A[0]&=248,A[31]&=127,A[31]|=64,Ri(N,A),Mr(x,N),z=0;z<32;z++)S[z+32]=x[z];return 0}var Gn=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function gs(x,S){var _,A,N,z;for(A=63;A>=32;--A){for(_=0,N=A-32,z=A-12;N<z;++N)S[N]+=_-16*S[A]*Gn[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)*Gn[N],_=S[N]>>8,S[N]&=255;for(N=0;N<32;N++)S[N]-=_*Gn[N];for(A=0;A<32;A++)S[A+1]+=S[A]>>8,x[A]=S[A]&255}function wn(x){var S=new Float64Array(64),_;for(_=0;_<64;_++)S[_]=x[_];for(_=0;_<64;_++)x[_]=0;gs(x,S)}function si(x,S,_,A){var N=new Uint8Array(64),z=new Uint8Array(64),Q=new Uint8Array(64),Z,H,J=new Float64Array(64),fe=[s(),s(),s(),s()];ot(N,A,32),N[0]&=248,N[31]&=127,N[31]|=64;var je=_+64;for(Z=0;Z<_;Z++)x[64+Z]=S[Z];for(Z=0;Z<32;Z++)x[32+Z]=N[32+Z];for(ot(Q,x.subarray(32),_+32),wn(Q),Ri(fe,Q),Mr(x,fe),Z=32;Z<64;Z++)x[Z]=A[Z];for(ot(z,x,_+64),wn(z),Z=0;Z<64;Z++)J[Z]=0;for(Z=0;Z<32;Z++)J[Z]=Q[Z];for(Z=0;Z<32;Z++)for(H=0;H<32;H++)J[Z+H]+=z[Z]*N[H];return gs(x.subarray(32),J),je}function ii(x,S){var _=s(),A=s(),N=s(),z=s(),Q=s(),Z=s(),H=s();return be(x[2],m),an(x[1],S),Tt(N,x[1]),Se(z,N,y),Ot(N,N,x[2]),jt(z,x[2],z),Tt(Q,z),Tt(Z,Q),Se(H,Z,Q),Se(_,H,N),Se(_,_,z),Ni(_,_),Se(_,_,N),Se(_,_,z),Se(_,_,z),Se(x[0],_,z),Tt(A,x[0]),Se(A,A,z),lt(A,N)&&Se(x[0],x[0],q),Tt(A,x[0]),Se(A,A,z),lt(A,N)?-1:(Pt(x[0])===S[31]>>7&&Ot(x[0],h,x[0]),Se(x[3],x[0],x[1]),0)}function Dr(x,S,_,A){var N,z=new Uint8Array(32),Q=new Uint8Array(64),Z=[s(),s(),s(),s()],H=[s(),s(),s(),s()];if(_<64||ii(H,A))return-1;for(N=0;N<_;N++)x[N]=S[N];for(N=0;N<32;N++)x[N+32]=A[N];if(ot(Q,x,_),wn(Q),Rr(Z,H,Q),Ri(H,S.subarray(32)),$t(Z,H),Mr(z,Z),_-=64,C(S,0,z,0)){for(N=0;N<_;N++)x[N]=0;return-1}for(N=0;N<_;N++)x[N]=S[N+64];return _}var Di=32,ys=24,Sn=32,bs=16,xs=32,ri=32,vs=32,Vn=32,ai=32,zr=ys,el=Sn,Rn=bs,Ie=64,it=32,Yt=64,li=32,qr=64;r.lowlevel={crypto_core_hsalsa20:V,crypto_stream_xor:ke,crypto_stream:ne,crypto_stream_salsa20_xor:K,crypto_stream_salsa20:ae,crypto_onetimeauth:$,crypto_onetimeauth_verify:te,crypto_verify_16:re,crypto_verify_32:C,crypto_secretbox:de,crypto_secretbox_open:ve,crypto_scalarmult:ti,crypto_scalarmult_base:ln,crypto_box_beforenm:ms,crypto_box_afternm:Ja,crypto_box:Cr,crypto_box_open:kr,crypto_box_keypair:Ci,crypto_hash:ot,crypto_sign:si,crypto_sign_keypair:ps,crypto_sign_open:Dr,crypto_secretbox_KEYBYTES:Di,crypto_secretbox_NONCEBYTES:ys,crypto_secretbox_ZEROBYTES:Sn,crypto_secretbox_BOXZEROBYTES:bs,crypto_scalarmult_BYTES:xs,crypto_scalarmult_SCALARBYTES:ri,crypto_box_PUBLICKEYBYTES:vs,crypto_box_SECRETKEYBYTES:Vn,crypto_box_BEFORENMBYTES:ai,crypto_box_NONCEBYTES:zr,crypto_box_ZEROBYTES:el,crypto_box_BOXZEROBYTES:Rn,crypto_sign_BYTES:Ie,crypto_sign_PUBLICKEYBYTES:it,crypto_sign_SECRETKEYBYTES:Yt,crypto_sign_SEEDBYTES:li,crypto_hash_BYTES:qr,gf:s,D:y,L:Gn,pack25519:Te,unpack25519:an,M:Se,A:jt,S:Tt,Z:Ot,pow2523:Ni,add:$t,set25519:be,modL:gs,scalarmult:Rr,scalarbase:Ri};function tl(x,S){if(x.length!==Di)throw new Error("bad key size");if(S.length!==ys)throw new Error("bad nonce size")}function nl(x,S){if(x.length!==vs)throw new Error("bad public key size");if(S.length!==Vn)throw new Error("bad secret key size")}function yt(){for(var x=0;x<arguments.length;x++)if(!(arguments[x]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function zi(x){for(var S=0;S<x.length;S++)x[S]=0}r.randomBytes=function(x){var S=new Uint8Array(x);return a(S,x),S},r.secretbox=function(x,S,_){yt(x,S,_),tl(_,S);for(var A=new Uint8Array(Sn+x.length),N=new Uint8Array(A.length),z=0;z<x.length;z++)A[z+Sn]=x[z];return de(N,A,A.length,S,_),N.subarray(bs)},r.secretbox.open=function(x,S,_){yt(x,S,_),tl(_,S);for(var A=new Uint8Array(bs+x.length),N=new Uint8Array(A.length),z=0;z<x.length;z++)A[z+bs]=x[z];return A.length<32||ve(N,A,A.length,S,_)!==0?null:N.subarray(Sn)},r.secretbox.keyLength=Di,r.secretbox.nonceLength=ys,r.secretbox.overheadLength=bs,r.scalarMult=function(x,S){if(yt(x,S),x.length!==ri)throw new Error("bad n size");if(S.length!==xs)throw new Error("bad p size");var _=new Uint8Array(xs);return ti(_,x,S),_},r.scalarMult.base=function(x){if(yt(x),x.length!==ri)throw new Error("bad n size");var S=new Uint8Array(xs);return ln(S,x),S},r.scalarMult.scalarLength=ri,r.scalarMult.groupElementLength=xs,r.box=function(x,S,_,A){var N=r.box.before(_,A);return r.secretbox(x,S,N)},r.box.before=function(x,S){yt(x,S),nl(x,S);var _=new Uint8Array(ai);return ms(_,x,S),_},r.box.after=r.secretbox,r.box.open=function(x,S,_,A){var N=r.box.before(_,A);return r.secretbox.open(x,S,N)},r.box.open.after=r.secretbox.open,r.box.keyPair=function(){var x=new Uint8Array(vs),S=new Uint8Array(Vn);return Ci(x,S),{publicKey:x,secretKey:S}},r.box.keyPair.fromSecretKey=function(x){if(yt(x),x.length!==Vn)throw new Error("bad secret key size");var S=new Uint8Array(vs);return ln(S,x),{publicKey:S,secretKey:new Uint8Array(x)}},r.box.publicKeyLength=vs,r.box.secretKeyLength=Vn,r.box.sharedKeyLength=ai,r.box.nonceLength=zr,r.box.overheadLength=r.secretbox.overheadLength,r.sign=function(x,S){if(yt(x,S),S.length!==Yt)throw new Error("bad secret key size");var _=new Uint8Array(Ie+x.length);return si(_,x,x.length,S),_},r.sign.open=function(x,S){if(yt(x,S),S.length!==it)throw new Error("bad public key size");var _=new Uint8Array(x.length),A=Dr(_,x,x.length,S);if(A<0)return null;for(var N=new Uint8Array(A),z=0;z<N.length;z++)N[z]=_[z];return N},r.sign.detached=function(x,S){for(var _=r.sign(x,S),A=new Uint8Array(Ie),N=0;N<A.length;N++)A[N]=_[N];return A},r.sign.detached.verify=function(x,S,_){if(yt(x,S,_),S.length!==Ie)throw new Error("bad signature size");if(_.length!==it)throw new Error("bad public key size");var A=new Uint8Array(Ie+x.length),N=new Uint8Array(Ie+x.length),z;for(z=0;z<Ie;z++)A[z]=S[z];for(z=0;z<x.length;z++)A[z+Ie]=x[z];return Dr(N,A,A.length,_)>=0},r.sign.keyPair=function(){var x=new Uint8Array(it),S=new Uint8Array(Yt);return ps(x,S),{publicKey:x,secretKey:S}},r.sign.keyPair.fromSecretKey=function(x){if(yt(x),x.length!==Yt)throw new Error("bad secret key size");for(var S=new Uint8Array(it),_=0;_<S.length;_++)S[_]=x[32+_];return{publicKey:S,secretKey:new Uint8Array(x)}},r.sign.keyPair.fromSeed=function(x){if(yt(x),x.length!==li)throw new Error("bad seed size");for(var S=new Uint8Array(it),_=new Uint8Array(Yt),A=0;A<32;A++)_[A]=x[A];return ps(S,_,!0),{publicKey:S,secretKey:_}},r.sign.publicKeyLength=it,r.sign.secretKeyLength=Yt,r.sign.seedLength=li,r.sign.signatureLength=Ie,r.hash=function(x){yt(x);var S=new Uint8Array(qr);return ot(S,x,x.length),S},r.hash.hashLength=qr,r.verify=function(x,S){return yt(x,S),x.length===0||S.length===0||x.length!==S.length?!1:me(x,0,S,0,x.length)===0},r.setPRNG=function(x){a=x},(function(){var x=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(x&&x.getRandomValues){var S=65536;r.setPRNG(function(_,A){var N,z=new Uint8Array(A);for(N=0;N<A;N+=S)x.getRandomValues(z.subarray(N,N+Math.min(A-N,S)));for(N=0;N<A;N++)_[N]=z[N];zi(z)})}else typeof require<"u"&&(x=require("crypto"),x&&x.randomBytes&&r.setPRNG(function(_,A){var N,z=x.randomBytes(A);for(N=0;N<A;N++)_[N]=z[N];zi(z)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const yo=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;yo.sign.keyPair.fromSeed,yo.sign.detached,yo.sign.detached.verify,yo.randomBytes;var T0;(function(r){r.InvalidPrefixByte="nkeys: invalid prefix byte",r.InvalidKey="nkeys: invalid key",r.InvalidPublicKey="nkeys: invalid public key",r.InvalidSeedLen="nkeys: invalid seed length",r.InvalidSeed="nkeys: invalid seed",r.InvalidEncoding="nkeys: invalid encoded key",r.InvalidSignature="nkeys: signature verification failed",r.CannotSign="nkeys: cannot sign, no private key available",r.PublicKeyOnly="nkeys: no seed or private key available",r.InvalidChecksum="nkeys: invalid checksum",r.SerializationError="nkeys: serialization error",r.ApiError="nkeys: api error",r.ClearedPair="nkeys: pair is cleared"})(T0||(T0={}));var N0;(function(r){r[r.Seed=144]="Seed",r[r.Private=120]="Private",r[r.Operator=112]="Operator",r[r.Server=104]="Server",r[r.Cluster=16]="Cluster",r[r.Account=0]="Account",r[r.User=160]="User"})(N0||(N0={}));function u1(r){return n=>{let s={};return r.forEach(a=>{const o=a(n)||{};s=Object.assign(s,o)}),s}}function f1(){return()=>{}}function h1(r,n){return()=>{const s=typeof r=="function"?r():r,a=typeof n=="function"?n():n;return{user:s,pass:a}}}function d1(r){return()=>({auth_token:typeof r=="function"?r():r})}const Tg=120*1e3,m1=2,Ng=2*1e3;function p1(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:Tg,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:Ng,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function g1(r){const n=[];return typeof r.authenticator=="function"&&n.push(r.authenticator),Array.isArray(r.authenticator)&&n.push(...r.authenticator),r.token&&n.push(d1(r.token)),r.user&&n.push(h1(r.user,r.pass)),n.length===0?f1():u1(n)}function y1(r){const n=`${Of}:${Ag()}`;if(r=r||{servers:[n]},r.servers=r.servers||[],typeof r.servers=="string"&&(r.servers=[r.servers]),r.servers.length>0&&r.port)throw new ue("port and servers options are mutually exclusive",ie.InvalidOption);r.servers.length===0&&r.port&&(r.servers=[`${Of}:${r.port}`]),r.servers&&r.servers.length===0&&(r.servers=[n]);const s=Yo(p1(),r);if(s.authenticator=g1(s),["reconnectDelayHandler","authenticator"].forEach(a=>{if(s[a]&&typeof s[a]!="function")throw new ue(`${a} option should be a function`,ie.NotFunction)}),s.reconnectDelayHandler||(s.reconnectDelayHandler=()=>{let a=s.tls?s.reconnectJitterTLS:s.reconnectJitter;return a&&(a++,a=Math.floor(Math.random()*a)),s.reconnectTimeWait+a}),s.inboxPrefix)try{fs(s.inboxPrefix)}catch(a){throw new ue(a.message,ie.ApiError)}if(s.resolve===void 0&&(s.resolve=typeof zf()=="function"),s.resolve&&typeof zf()!="function")throw new ue("'resolve' is not supported on this client",ie.InvalidOption);return s}function b1(r,n){const{proto:s,tls_required:a,tls_available:o}=r;if((s===void 0||s<1)&&n.noEcho)throw new ue("noEcho",ie.ServerOptionNotAvailable);const f=a||o||!1;if(n.tls&&!f)throw new ue("tls",ie.ServerOptionNotAvailable)}const x1=1024*32,v1=/^INFO\s+([^\r\n]+)\r\n/i,_1=Ra(`PONG\r
|
|
38
|
-
`),
|
|
39
|
-
`);class w1{constructor(n,s,a){v(this,"echo");v(this,"no_responders");v(this,"protocol");v(this,"verbose");v(this,"pedantic");v(this,"jwt");v(this,"nkey");v(this,"sig");v(this,"user");v(this,"pass");v(this,"auth_token");v(this,"tls_required");v(this,"name");v(this,"lang");v(this,"version");v(this,"headers");this.protocol=1,this.version=n.version,this.lang=n.lang,this.echo=s.noEcho?!1:void 0,this.verbose=s.verbose,this.pedantic=s.pedantic,this.tls_required=s.tls?!0:void 0,this.name=s.name;const o=(s&&typeof s.authenticator=="function"?s.authenticator(a):{})||{};Yo(this,o)}}class Cg extends _t{constructor(s,a,o={}){var h;super();v(this,"sid");v(this,"queue");v(this,"draining");v(this,"max");v(this,"subject");v(this,"drained");v(this,"protocol");v(this,"timer");v(this,"info");v(this,"cleanupFn");v(this,"closed");v(this,"requestSubject");Yo(this,o),this.protocol=s,this.subject=a,this.draining=!1,this.noIterator=typeof o.callback=="function",this.closed=st();const f=!((h=s.options)!=null&&h.noAsyncTraces);o.timeout&&(this.timer=Ar(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,h=s.dispatchedFn?s.dispatchedFn:()=>{};this.callback=(m,g)=>{const{ingest:y}=o(g);y&&f(g)&&(a(m,g),h(g))}}else this.protocolFilterFn=s.protocolFilterFn,this.dispatchedFn=s.dispatchedFn}callback(s,a){this.cancelTimeout(),s?this.stop(s):this.push(a)}close(){if(!this.isClosed()){this.cancelTimeout();const s=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?s():this.push(s)}}unsubscribe(s){this.protocol.unsubscribe(this,s)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(ue.errorForCode(ie.ConnectionClosed)):this.isClosed()?Promise.reject(ue.errorForCode(ie.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(st()).then(()=>{this.protocol.subscriptions.cancel(this)}).catch(()=>{this.protocol.subscriptions.cancel(this)})),this.drained)}isDraining(){return this.draining}isClosed(){return this.done}getSubject(){return this.subject}getMax(){return this.max}getID(){return this.sid}}class S1{constructor(){v(this,"mux");v(this,"subs");v(this,"sidCounter");this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(n){return this.sidCounter++,n.sid=this.sidCounter,this.subs.set(n.sid,n),n}setMux(n){return this.mux=n,n}getMux(){return this.mux}get(n){return this.subs.get(n)}resub(n){return this.sidCounter++,this.subs.delete(n.sid),n.sid=this.sidCounter,this.subs.set(n.sid,n),n}all(){return Array.from(this.subs.values())}cancel(n){n&&(n.close(),this.subs.delete(n.sid))}handleError(n){if(n&&n.permissionContext){const s=n.permissionContext,a=this.all();let o;if(s.operation==="subscription"&&(o=a.find(f=>f.subject===s.subject&&f.queue===s.queue)),s.operation==="publish"&&(o=a.find(f=>f.requestSubject===s.subject)),o)return o.callback(n,{}),o.close(),this.subs.delete(o.sid),o!==this.mux}return!1}close(){this.subs.forEach(n=>{n.close()})}}class Uo{constructor(n,s){v(this,"connected");v(this,"connectedOnce");v(this,"infoReceived");v(this,"info");v(this,"muxSubscriptions");v(this,"options");v(this,"outbound");v(this,"pongs");v(this,"subscriptions");v(this,"transport");v(this,"noMorePublishing");v(this,"connectError");v(this,"publisher");v(this,"_closed");v(this,"closed");v(this,"listeners");v(this,"heartbeats");v(this,"parser");v(this,"outMsgs");v(this,"inMsgs");v(this,"outBytes");v(this,"inBytes");v(this,"pendingLimit");v(this,"lastError");v(this,"abortReconnect");v(this,"whyClosed");v(this,"servers");v(this,"server");v(this,"features");v(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=x1,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=n,this.publisher=s,this.subscriptions=new S1,this.muxSubscriptions=new r1,this.outbound=new Or,this.pongs=[],this.whyClosed="",this.pendingLimit=n.pendingLimit||this.pendingLimit,this.features=new Lv({major:0,minor:0,micro:0}),this.connectPromise=null;const a=typeof n.servers=="string"?[n.servers]:n.servers;this.servers=new i1(a,{randomize:!n.noRandomize}),this.closed=st(),this.parser=new O0(this),this.heartbeats=new a1(this,this.options.pingInterval||Tg,this.options.maxPingOut||m1)}resetOutbound(){this.outbound.reset();const n=this.pongs;this.pongs=[];const s=ue.errorForCode(ie.Disconnect);s.stack="",n.forEach(a=>{a.reject(s)}),this.parser=new O0(this),this.infoReceived=!1}dispatchStatus(n){this.listeners.forEach(s=>{s.push(n)})}status(){const n=new _t;return this.listeners.push(n),n}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const n=st();return n.catch(()=>{}),this.pongs.unshift(n),this.connectError=s=>{n.reject(s)},this.transport=$v(),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:vr.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:vr.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(n){this.dispatchStatus({type:us.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var s;this.dispatchStatus({type:us.Reconnect,data:this.servers.getCurrentServer().toString()}),((s=this.lastError)==null?void 0:s.code)===ie.AuthenticationExpired&&(this.lastError=void 0)}).catch(s=>{this._close(s)}):await this._close(n)}async dial(n){const s=this.prepare();let a;try{a=Ar(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:zf(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:s});let o=null;for(const f of a)try{o=null,this.dispatchStatus({type:vr.Reconnecting,data:f.toString()}),await this.dial(f);return}catch(h){o=h}throw o}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let n;for(;;){this._closed&&this.servers.clear();const s=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():Ng;let a=s;const o=this.selectServer();if(!o||this.abortReconnect)throw n||(this.lastError?this.lastError:ue.errorForCode(ie.ConnectionRefused));const f=Date.now();if(o.lastConnect===0||o.lastConnect+s<=f){o.lastConnect=Date.now();try{await this._doDial(o);break}catch(h){if(n=h,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}o.reconnects++;const m=this.options.maxReconnectAttempts||0;m!==-1&&o.reconnects>=m&&this.servers.removeCurrentServer()}}else a=Math.min(a,o.lastConnect+s-f),await Tr(a)}}static async connect(n,s){const a=new Uo(n,s);return await a.dialLoop(),a}static toError(n){const s=n?n.toLowerCase():"";if(s.indexOf("permissions violation")!==-1){const a=new ue(n,ie.PermissionsViolation),o=n.match(/(Publish|Subscription) to "(\S+)"/);if(o){a.permissionContext={operation:o[1].toLowerCase(),subject:o[2],queue:void 0};const f=n.match(/using queue "(\S+)"/);f&&(a.permissionContext.queue=f[1])}return a}else return s.indexOf("authorization violation")!==-1?new ue(n,ie.AuthorizationViolation):s.indexOf("user authentication expired")!==-1?new ue(n,ie.AuthenticationExpired):s.indexOf("account authentication expired")!=-1?new ue(n,ie.AccountExpired):s.indexOf("authentication timeout")!==-1?new ue(n,ie.AuthenticationTimeout):new ue(n,ie.ProtocolError)}processMsg(n,s){if(this.inMsgs++,this.inBytes+=s.length,!this.subscriptions.sidCounter)return;const a=this.subscriptions.get(n.sid);a&&(a.received+=1,a.callback&&a.callback(null,new nh(n,s,this)),a.max!==void 0&&a.received>=a.max&&a.unsubscribe())}processError(n){const s=h0(n),a=Uo.toError(s),o={type:us.Error,data:a.code};if(a.isPermissionError()){let f=!1;if(a.permissionContext){o.permissionContext=a.permissionContext;const h=this.subscriptions.getMux();f=(h==null?void 0:h.subject)===a.permissionContext.subject}this.subscriptions.handleError(a),this.muxSubscriptions.handleError(f,a),f&&this.subscriptions.setMux(null)}this.dispatchStatus(o),this.handleError(a)}handleError(n){n.isAuthError()?this.handleAuthError(n):n.isProtocolError()?this.lastError=n:n.isAuthTimeout()&&(this.lastError=n),n.isPermissionError()||(this.lastError=n)}handleAuthError(n){this.lastError&&n.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(n):this.disconnect()}processPing(){this.transport.send(_1)}processPong(){const n=this.pongs.shift();n&&n.resolve()}processInfo(n){const s=JSON.parse(h0(n));this.info=s;const a=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(s,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(Ai(s.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:f,lang:h}=this.transport;try{const m=new w1({version:f,lang:h},this.options,s.nonce);s.headers&&(m.headers=!0,m.no_responders=!0);const g=JSON.stringify(m);this.transport.send(Ra(`CONNECT ${g}${Eo}`)),this.transport.send(C0)}catch(m){this._close(m)}}a&&this.dispatchStatus({type:us.Update,data:a}),(s.ldm!==void 0?s.ldm:!1)&&this.dispatchStatus({type:us.LDM,data:this.servers.getCurrentServer().toString()})}push(n){switch(n.kind){case Rt.MSG:{const{msg:s,data:a}=n;this.processMsg(s,a);break}case Rt.OK:break;case Rt.ERR:this.processError(n.data);break;case Rt.PING:this.processPing();break;case Rt.PONG:this.processPong();break;case Rt.INFO:this.processInfo(n.data);break}}sendCommand(n,...s){const a=this.outbound.length();let o;typeof n=="string"?o=Ra(n):o=n,this.outbound.fill(o,...s),a===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(n,s=nn,a){let o;if(s instanceof Uint8Array)o=s;else if(typeof s=="string")o=Ti.encode(s);else throw ue.errorForCode(ie.BadPayload);let f=o.length;a=a||{},a.reply=a.reply||"";let h=nn,m=0;if(a.headers){if(this.info&&!this.info.headers)throw new ue("headers",ie.ServerOptionNotAvailable);h=a.headers.encode(),m=h.length,f=o.length+m}if(this.info&&f>this.info.max_payload)throw ue.errorForCode(ie.MaxPayloadExceeded);this.outBytes+=f,this.outMsgs++;let g;a.headers?(a.reply?g=`HPUB ${n} ${a.reply} ${m} ${f}\r
|
|
36
|
+
${this.ctx.stack}`),this.deferred.reject(s)):this.deferred.resolve(a),this.cancel()}cancel(s){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(s||ue.errorForCode(ie.Cancelled))}}const Bv="$JS.API";function Lv(r){return r=r||{},r.domain&&(r.apiPrefix=`$JS.${r.domain}.API`,delete r.domain),Yo({apiPrefix:Bv,timeout:5e3},r)}class Ga{constructor(n,s){v(this,"nc");v(this,"opts");v(this,"prefix");v(this,"timeout");v(this,"jc");this.nc=n,this.opts=Lv(s),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=Mn()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let n=this.opts.apiPrefix;if(!n||n.length===0)throw new Error("invalid empty prefix");n[n.length-1]==="."&&(n=n.substr(0,n.length-1)),this.opts.apiPrefix=n}async _request(n,s=null,a){a=a||{},a.timeout=this.timeout;let o=nn;s&&(o=this.jc.encode(s));let{retries:f}=a;f=f||1,f=f===-1?Number.MAX_SAFE_INTEGER:f;const h=eh();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===ie.Timeout)&&m+1<f)await Tr(h.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=Sg(a.error.code,a.error.description);if(o!==null)throw o.api_error=a.error,o}return s}}class Ma{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 ji(r=""){const n=r.match(/(\d+).(\d+).(\d+)/);if(n)return{major:parseInt(n[1]),minor:parseInt(n[2]),micro:parseInt(n[3])};throw new Error(`'${r}' is not a semver value`)}function Df(r,n){return r.major<n.major?-1:r.major>n.major?1:r.minor<n.minor?-1:r.minor>n.minor?1:r.micro<n.micro?-1:r.micro>n.micro?1:0}var Ue;(function(r){r.JS_KV="js_kv",r.JS_OBJECTSTORE="js_objectstore",r.JS_PULL_MAX_BYTES="js_pull_max_bytes",r.JS_NEW_CONSUMER_CREATE_API="js_new_consumer_create",r.JS_ALLOW_DIRECT="js_allow_direct",r.JS_MULTIPLE_CONSUMER_FILTER="js_multiple_consumer_filter",r.JS_SIMPLIFICATION="js_simplification",r.JS_STREAM_CONSUMER_METADATA="js_stream_consumer_metadata",r.JS_CONSUMER_FILTER_SUBJECTS="js_consumer_filter_subjects",r.JS_STREAM_FIRST_SEQ="js_stream_first_seq",r.JS_STREAM_SUBJECT_TRANSFORM="js_stream_subject_transform",r.JS_STREAM_SOURCE_SUBJECT_TRANSFORM="js_stream_source_subject_transform",r.JS_STREAM_COMPRESSION="js_stream_compression",r.JS_DEFAULT_CONSUMER_LIMITS="js_default_consumer_limits",r.JS_BATCH_DIRECT_GET="js_batch_direct_get"})(Ue||(Ue={}));class Hv{constructor(n){v(this,"server");v(this,"features");v(this,"disabled");this.features=new Map,this.disabled=[],this.update(n)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(n){this.disabled.push(n),this.update(this.server)}isDisabled(n){return this.disabled.indexOf(n)!==-1}update(n){typeof n=="string"&&(n=ji(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:Df(this.server,ji(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=ji(n)),Df(this.server,n)>=0}}class zo extends Ga{constructor(n,s){super(n,s)}async add(n,s,a=Do.Create){if(Mt(n),s.deliver_group&&s.flow_control)throw new Error("jetstream flow control is not supported with queue groups");if(s.deliver_group&&s.idle_heartbeat)throw new Error("jetstream idle heartbeat is not supported with queue groups");const o={};o.config=s,o.stream_name=n,o.action=a,o.config.durable_name&&_r(o.config.durable_name);const f=this.nc;let{min:h,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 ${h}`);if(g)try{Go("name",g)}catch(T){const q=T.message,M=q.indexOf("cannot contain");throw M!==-1?new Error(`consumer 'name' ${q.substring(M)}`):T}let y,E="";if(Array.isArray(s.filter_subjects)){const{min:T,ok:q}=f.features.get(Ue.JS_MULTIPLE_CONSUMER_FILTER);if(!q)throw new Error(`consumer 'filter_subjects' requires server ${T}`);m=!1}if(s.metadata){const{min:T,ok:q}=f.features.get(Ue.JS_STREAM_CONSUMER_METADATA);if(!q)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),Do.Update)}async info(n,s){return Mt(n),_r(s),await this._request(`${this.prefix}.CONSUMER.INFO.${n}.${s}`)}async delete(n,s){return Mt(n),_r(s),(await this._request(`${this.prefix}.CONSUMER.DELETE.${n}.${s}`)).success}list(n){Mt(n);const s=o=>o.consumers,a=`${this.prefix}.CONSUMER.LIST.${n}`;return new Ma(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 pr(r,n,s=!1){if(s===!0&&!r)throw ue.errorForCode(ie.ApiError,new Error(`${n} is not a function`));if(r&&typeof r!="function")throw ue.errorForCode(ie.ApiError,new Error(`${n} is not a function`))}class Pv extends _t{constructor(s,a,o){super();v(this,"sub");v(this,"adapter");v(this,"subIterDone");pr(o.adapter,"adapter",!0),this.adapter=o.adapter,o.callback&&pr(o.callback,"callback"),this.noIterator=typeof o.callback=="function",o.ingestionFilterFn&&(pr(o.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=o.ingestionFilterFn),o.protocolFilterFn&&(pr(o.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=o.protocolFilterFn),o.dispatchedFn&&(pr(o.dispatchedFn,"dispatchedFn"),this.dispatchedFn=o.dispatchedFn),o.cleanupFn&&pr(o.cleanupFn,"cleanupFn");let f=(E,w)=>{this.callback(E,w)};if(o.callback){const E=o.callback;f=(w,T)=>{const[q,M]=this.adapter(w,T);if(q){E(q,null);return}const{ingest:D}=this.ingestionFilterFn?this.ingestionFilterFn(M,this):{ingest:!0};D&&(!this.protocolFilterFn||this.protocolFilterFn(M))&&(E(q,M),this.dispatchedFn&&M&&this.dispatchedFn(M))}}const{max:h,queue:m,timeout:g}=o,y={queue:m,timeout:g,callback:f};h&&h>0&&(y.max=h),this.sub=s.subscribe(a,y),o.cleanupFn&&(this.sub.cleanupFn=o.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=st(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async E=>{await E.closed,this.stop()})(this.sub).then().catch()}unsubscribe(s){this.sub.unsubscribe(s)}drain(){return this.sub.drain()}isDraining(){return this.sub.isDraining()}isClosed(){return this.sub.isClosed()}callback(s,a){this.sub.cancelTimeout();const[o,f]=this.adapter(s,a);o&&this.stop(o),f&&this.push(f)}getSubject(){return this.sub.getSubject()}getReceived(){return this.sub.getReceived()}getProcessed(){return this.sub.getProcessed()}getPending(){return this.sub.getPending()}getID(){return this.sub.getID()}getMax(){return this.sub.getMax()}get closed(){return this.sub.closed}}let tn;function $v(r){tn=r}function jg(){return tn!==void 0&&tn.defaultPort!==void 0?tn.defaultPort:4222}function df(){return tn!==void 0&&tn.urlParseFn?tn.urlParseFn:void 0}function Yv(){if(!tn||typeof tn.factory!="function")throw new Error("transport fn is not set");return tn.factory()}function zf(){return tn!==void 0&&tn.dnsResolveFn?tn.dnsResolveFn:void 0}const Eo=`\r
|
|
37
|
+
`,qo=Or.fromAscii(Eo),Gv=new Uint8Array(qo)[0],Vv=new Uint8Array(qo)[1];function Fv(r){for(let n=0;n<r.length;n++){const s=n+1;if(r.byteLength>s&&r[n]===Gv&&r[s]===Vv)return s+1}return 0}function Jv(r){const n=Fv(r);if(n>0){const a=new Uint8Array(r).slice(0,n);return en.decode(a)}return""}const Iv=4,Og=48,Qv=65,Xv=97;function Kv(r,n,s,a){const o=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((h,m)=>{o[m]=h}),o[12]=r,o[13]=n,o[14]=s,o[15]=a,o}function qf(r){return Zv(r)!==void 0}function Zv(r){for(let n=0;n<r.length;n++)switch(r[n]){case".":return Tg(r);case":":return Wv(r)}}function Tg(r){const n=new Uint8Array(4);for(let s=0;s<4;s++){if(r.length===0)return;if(s>0){if(r[0]!==".")return;r=r.substring(1)}const{n:a,c:o,ok:f}=e1(r);if(!f||a>255)return;r=r.substring(o),n[s]=a}return Kv(n[0],n[1],n[2],n[3])}function Wv(r){const n=new Uint8Array(16);let s=-1;if(r.length>=2&&r[0]===":"&&r[1]===":"&&(s=0,r=r.substring(2),r.length===0))return n;let a=0;for(;a<16;){const{n:o,c:f,ok:h}=t1(r);if(!h||o>65535)return;if(f<r.length&&r[f]==="."){if(s<0&&a!=12||a+4>16)return;const m=Tg(r);if(m===void 0)return;n[a]=m[12],n[a+1]=m[13],n[a+2]=m[14],n[a+3]=m[15],r="",a+=Iv;break}if(n[a]=o>>8,n[a+1]=o,a+=2,r=r.substring(f),r.length===0)break;if(r[0]!==":"||r.length==1)return;if(r=r.substring(1),r[0]===":"){if(s>=0)return;if(s=a,r=r.substring(1),r.length===0)break}}if(r.length===0){if(a<16){if(s<0)return;const o=16-a;for(let f=a-1;f>=s;f--)n[f+o]=n[f];for(let f=s+o-1;f>=s;f--)n[f]=0}else if(s>=0)return;return n}}function e1(r){let n=0,s=0;for(n=0;n<r.length&&48<=r.charCodeAt(n)&&r.charCodeAt(n)<=57;n++)if(s=s*10+(r.charCodeAt(n)-Og),s>=16777215)return{n:16777215,c:n,ok:!1};return n===0?{n:0,c:0,ok:!1}:{n:s,c:n,ok:!0}}function t1(r){let n=0,s=0;for(s=0;s<r.length;s++){if(48<=r.charCodeAt(s)&&r.charCodeAt(s)<=57)n*=16,n+=r.charCodeAt(s)-Og;else if(97<=r.charCodeAt(s)&&r.charCodeAt(s)<=102)n*=16,n+=r.charCodeAt(s)-Xv+10;else if(65<=r.charCodeAt(s)&&r.charCodeAt(s)<=70)n*=16,n+=r.charCodeAt(s)-Qv+10;else break;if(n>=16777215)return{n:0,c:s,ok:!1}}return s===0?{n:0,c:s,ok:!1}:{n,c:s,ok:!0}}function n1(r){return r.indexOf("[")!==-1||r.indexOf("::")!==-1?!1:r.indexOf(".")!==-1||r.split(":").length<=2}function Uf(r){return!n1(r)}function s1(r){const n="::FFFF:",s=r.toUpperCase().indexOf(n);if(s!==-1&&r.indexOf(".")!==-1){let a=r.substring(s+n.length);return a=a.replace("[",""),a.replace("]","")}return r}function i1(r){r=r.trim(),r.match(/^(.*:\/\/)(.*)/m)&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2")),r=s1(r),Uf(r)&&r.indexOf("[")===-1&&(r=`[${r}]`);const n=Uf(r)?r.match(/(]:)(\d+)/):r.match(/(:)(\d+)/),s=n&&n.length===3&&n[1]&&n[2]?parseInt(n[2]):4222,a=s===80?"https":"http",o=new URL(`${a}://${r}`);o.port=`${s}`;let f=o.hostname;return f.charAt(0)==="["&&(f=f.substring(1,f.length-1)),{listen:o.host,hostname:f,port:s}}class qa{constructor(n,s=!1){v(this,"src");v(this,"listen");v(this,"hostname");v(this,"port");v(this,"didConnect");v(this,"reconnects");v(this,"lastConnect");v(this,"gossiped");v(this,"tlsName");v(this,"resolves");this.src=n,this.tlsName="";const a=i1(n);this.listen=a.listen,this.hostname=a.hostname,this.port=a.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=s}toString(){return this.listen}async resolve(n){if(!n.fn||n.resolve===!1)return[this];const s=[];if(qf(this.hostname))return[this];{const a=await n.fn(this.hostname);n.debug&&console.log(`resolve ${this.hostname} = ${a.join(",")}`);for(const o of a){const f=this.port===80?"https":"http",h=new URL(`${f}://${Uf(o)?"["+o+"]":o}`);h.port=`${this.port}`;const m=new qa(h.host,!1);m.tlsName=this.hostname,s.push(m)}}return n.randomize&&_g(s),this.resolves=s,s}}class r1{constructor(n=[],s={}){v(this,"firstSelect");v(this,"servers");v(this,"currentServer");v(this,"tlsName");v(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=s.randomize||!1;const a=df();n&&(n.forEach(o=>{o=a?a(o):o,this.servers.push(new qa(o))}),this.randomize&&(this.servers=_g(this.servers))),this.servers.length===0&&this.addServer(`${Of}:${jg()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const n=this.getCurrentServer();qf(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=df();n=a?a(n):n;const o=new qa(n,s);qf(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=df(),h=new Map;n.connect_urls&&n.connect_urls.length>0&&n.connect_urls.forEach(g=>{g=f?f(g,s):g;const y=new qa(g,!0);h.set(g,y)});const m=[];return this.servers.forEach((g,y)=>{const E=g.listen;g.gossiped&&this.currentServer.listen!==E&&h.get(E)===void 0&&m.push(y),h.delete(E)}),m.reverse(),m.forEach(g=>{const y=this.servers.splice(g,1);o=o.concat(y[0].listen)}),h.forEach((g,y)=>{this.servers.push(g),a.push(y)}),{added:a,deleted:o}}}class a1{constructor(){v(this,"baseInbox");v(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(n){return this.baseInbox=`${fs(n)}.`,this.baseInbox}add(n){isNaN(n.received)||(n.received=0),this.reqs.set(n.token,n)}get(n){return this.reqs.get(n)}cancel(n){this.reqs.delete(n.token)}getToken(n){const s=n.subject||"";return s.indexOf(this.baseInbox)===0?s.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(n,s){if(s&&s.permissionContext){if(n)return this.all().forEach(o=>{o.resolver(s,{})}),!0;const a=s.permissionContext;if(a.operation==="publish"){const o=this.all().find(f=>f.requestSubject===a.subject);if(o)return o.resolver(s,{}),!0}}return!1}dispatcher(){return(n,s)=>{const a=this.getToken(s);if(a){const o=this.get(a);o&&(n===null&&s.headers&&(n=wg(s)),o.resolver(n,s))}}}close(){const n=ue.errorForCode(ie.Timeout);this.reqs.forEach(s=>{s.resolver(n,{})})}}class l1{constructor(n,s,a){v(this,"ph");v(this,"interval");v(this,"maxOut");v(this,"timer");v(this,"pendings");this.ph=n,this.interval=s,this.maxOut=a,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(n){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),n&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:vr.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const n=st();this.ph.flush(n).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(n),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(n=>(n.resolve(),!1))}}class o1 extends Error{constructor(n){super(n),this.name="AssertionError"}}function c1(r,n="Assertion failed."){if(!r)throw new o1(n)}const j0=32*1024,mf=2**32-2;function yo(r,n,s=0){const a=n.byteLength-s;return r.byteLength>a&&(r=r.subarray(0,a)),n.set(r,s),r.byteLength}class pf{constructor(n){v(this,"_buf");v(this,"_off");if(this._off=0,n==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(n)}bytes(n={copy:!0}){return n.copy===!1?this._buf.subarray(this._off):this._buf.slice(this._off)}empty(){return this._buf.byteLength<=this._off}get length(){return this._buf.byteLength-this._off}get capacity(){return this._buf.buffer.byteLength}truncate(n){if(n===0){this.reset();return}if(n<0||n>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+n)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(n){const s=this._buf.byteLength;return n<=this.capacity-s?(this._reslice(s+n),s):-1}_reslice(n){c1(n<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,n)}readByte(){const n=new Uint8Array(1);return this.read(n)?n[0]:null}read(n){if(this.empty())return this.reset(),n.byteLength===0?0:null;const s=yo(this._buf.subarray(this._off),n);return this._off+=s,s}writeByte(n){return this.write(Uint8Array.of(n))}writeString(n){return this.write(Ti.encode(n))}write(n){const s=this._grow(n.byteLength);return yo(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)yo(this._buf.subarray(this._off),this._buf);else{if(o+n>mf)throw new Error("The buffer cannot be grown beyond the maximum size.");{const f=new Uint8Array(Math.min(2*o+n,mf));yo(this._buf.subarray(this._off),f),this._buf=f}}return this._off=0,this._reslice(Math.min(s+n,mf)),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(j0);for(;;){const o=this.capacity-this.length<j0,f=o?a:new Uint8Array(this._buf.buffer,this.length),h=n.read(f);if(h===null)return s;o?this.write(f.subarray(0,h)):this._reslice(this.length+h),s+=h}}}var Rt;(function(r){r[r.OK=0]="OK",r[r.ERR=1]="ERR",r[r.MSG=2]="MSG",r[r.INFO=3]="INFO",r[r.PING=4]="PING",r[r.PONG=5]="PONG"})(Rt||(Rt={}));function O0(){const r={};return r.sid=-1,r.hdr=-1,r.size=-1,r}const u1=48;class T0{constructor(n){v(this,"dispatcher");v(this,"state");v(this,"as");v(this,"drop");v(this,"hdr");v(this,"ma");v(this,"argBuf");v(this,"msgBuf");this.dispatcher=n,this.state=le.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(n){let s;for(s=0;s<n.length;s++){const a=n[s];switch(this.state){case le.OP_START:switch(a){case oe.M:case oe.m:this.state=le.OP_M,this.hdr=-1,this.ma=O0();break;case oe.H:case oe.h:this.state=le.OP_H,this.hdr=0,this.ma=O0();break;case oe.P:case oe.p:this.state=le.OP_P;break;case oe.PLUS:this.state=le.OP_PLUS;break;case oe.MINUS:this.state=le.OP_MINUS;break;case oe.I:case oe.i:this.state=le.OP_I;break;default:throw this.fail(n.subarray(s))}break;case le.OP_H:switch(a){case oe.M:case oe.m:this.state=le.OP_M;break;default:throw this.fail(n.subarray(s))}break;case le.OP_M:switch(a){case oe.S:case oe.s:this.state=le.OP_MS;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MS:switch(a){case oe.G:case oe.g:this.state=le.OP_MSG;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MSG:switch(a){case oe.SPACE:case oe.TAB:this.state=le.OP_MSG_SPC;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MSG_SPC:switch(a){case oe.SPACE:case oe.TAB:continue;default:this.state=le.MSG_ARG,this.as=s}break;case le.MSG_ARG:switch(a){case oe.CR:this.drop=1;break;case oe.NL:{const o=this.argBuf?this.argBuf.bytes():n.subarray(this.as,s-this.drop);this.processMsgArgs(o),this.drop=0,this.as=s+1,this.state=le.MSG_PAYLOAD,s=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;case le.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const o=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:Rt.MSG,msg:this.ma,data:o}),this.argBuf=void 0,this.msgBuf=void 0,this.state=le.MSG_END}else{let o=this.ma.size-this.msgBuf.length;const f=n.length-s;f<o&&(o=f),o>0?(this.msgBuf.write(n.subarray(s,s+o)),s=s+o-1):this.msgBuf.writeByte(a)}else s-this.as>=this.ma.size&&(this.dispatcher.push({kind:Rt.MSG,msg:this.ma,data:n.subarray(this.as,s)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=le.MSG_END);break;case le.MSG_END:switch(a){case oe.NL:this.drop=0,this.as=s+1,this.state=le.OP_START;break;default:continue}break;case le.OP_PLUS:switch(a){case oe.O:case oe.o:this.state=le.OP_PLUS_O;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PLUS_O:switch(a){case oe.K:case oe.k:this.state=le.OP_PLUS_OK;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PLUS_OK:switch(a){case oe.NL:this.dispatcher.push({kind:Rt.OK}),this.drop=0,this.state=le.OP_START;break}break;case le.OP_MINUS:switch(a){case oe.E:case oe.e:this.state=le.OP_MINUS_E;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_E:switch(a){case oe.R:case oe.r:this.state=le.OP_MINUS_ER;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_ER:switch(a){case oe.R:case oe.r:this.state=le.OP_MINUS_ERR;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_ERR:switch(a){case oe.SPACE:case oe.TAB:this.state=le.OP_MINUS_ERR_SPC;break;default:throw this.fail(n.subarray(s))}break;case le.OP_MINUS_ERR_SPC:switch(a){case oe.SPACE:case oe.TAB:continue;default:this.state=le.MINUS_ERR_ARG,this.as=s}break;case le.MINUS_ERR_ARG:switch(a){case oe.CR:this.drop=1;break;case oe.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=n.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Rt.ERR,data:o}),this.drop=0,this.as=s+1,this.state=le.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(a))}break;case le.OP_P:switch(a){case oe.I:case oe.i:this.state=le.OP_PI;break;case oe.O:case oe.o:this.state=le.OP_PO;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PO:switch(a){case oe.N:case oe.n:this.state=le.OP_PON;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PON:switch(a){case oe.G:case oe.g:this.state=le.OP_PONG;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PONG:switch(a){case oe.NL:this.dispatcher.push({kind:Rt.PONG}),this.drop=0,this.state=le.OP_START;break}break;case le.OP_PI:switch(a){case oe.N:case oe.n:this.state=le.OP_PIN;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PIN:switch(a){case oe.G:case oe.g:this.state=le.OP_PING;break;default:throw this.fail(n.subarray(s))}break;case le.OP_PING:switch(a){case oe.NL:this.dispatcher.push({kind:Rt.PING}),this.drop=0,this.state=le.OP_START;break}break;case le.OP_I:switch(a){case oe.N:case oe.n:this.state=le.OP_IN;break;default:throw this.fail(n.subarray(s))}break;case le.OP_IN:switch(a){case oe.F:case oe.f:this.state=le.OP_INF;break;default:throw this.fail(n.subarray(s))}break;case le.OP_INF:switch(a){case oe.O:case oe.o:this.state=le.OP_INFO;break;default:throw this.fail(n.subarray(s))}break;case le.OP_INFO:switch(a){case oe.SPACE:case oe.TAB:this.state=le.OP_INFO_SPC;break;default:throw this.fail(n.subarray(s))}break;case le.OP_INFO_SPC:switch(a){case oe.SPACE:case oe.TAB:continue;default:this.state=le.INFO_ARG,this.as=s}break;case le.INFO_ARG:switch(a){case oe.CR:this.drop=1;break;case oe.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=n.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Rt.INFO,data:o}),this.drop=0,this.as=s+1,this.state=le.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;default:throw this.fail(n.subarray(s))}}(this.state===le.MSG_ARG||this.state===le.MINUS_ERR_ARG||this.state===le.INFO_ARG)&&!this.argBuf&&(this.argBuf=new pf(n.subarray(this.as,s-this.drop))),this.state===le.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new pf(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 pf(a),this.ma.subject=a.subarray(0,n),this.ma.reply&&(this.ma.reply=a.subarray(n))}processMsgArgs(n){if(this.hdr>=0)return this.processHeaderMsgArgs(n);const s=[];let a=-1;for(let o=0;o<n.length;o++)switch(n[o]){case oe.SPACE:case oe.TAB:case oe.CR:case oe.NL:a>=0&&(s.push(n.subarray(a,o)),a=-1);break;default:a<0&&(a=o)}switch(a>=0&&s.push(n.subarray(a)),s.length){case 3:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(s[2]);break;case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.size=this.protoParseInt(s[3]);break;default:throw this.fail(n,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(n,"processMsgArgs Bad or Missing Size Error")}fail(n,s=""){return s?s=`${s} [${this.state}]`:s=`parse error [${this.state}]`,new Error(`${s}: ${en.decode(n)}`)}processHeaderMsgArgs(n){const s=[];let a=-1;for(let o=0;o<n.length;o++)switch(n[o]){case oe.SPACE:case oe.TAB:case oe.CR:case oe.NL:a>=0&&(s.push(n.subarray(a,o)),a=-1);break;default:a<0&&(a=o)}switch(a>=0&&s.push(n.subarray(a)),s.length){case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(s[2]),this.ma.size=this.protoParseInt(s[3]);break;case 5:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.hdr=this.protoParseInt(s[3]),this.ma.size=this.protoParseInt(s[4]);break;default:throw this.fail(n,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(n){if(n.length===0)return-1;let s=0;for(let a=0;a<n.length;a++){if(n[a]<48||n[a]>57)return-1;s=s*10+(n[a]-u1)}return s}}var le;(function(r){r[r.OP_START=0]="OP_START",r[r.OP_PLUS=1]="OP_PLUS",r[r.OP_PLUS_O=2]="OP_PLUS_O",r[r.OP_PLUS_OK=3]="OP_PLUS_OK",r[r.OP_MINUS=4]="OP_MINUS",r[r.OP_MINUS_E=5]="OP_MINUS_E",r[r.OP_MINUS_ER=6]="OP_MINUS_ER",r[r.OP_MINUS_ERR=7]="OP_MINUS_ERR",r[r.OP_MINUS_ERR_SPC=8]="OP_MINUS_ERR_SPC",r[r.MINUS_ERR_ARG=9]="MINUS_ERR_ARG",r[r.OP_M=10]="OP_M",r[r.OP_MS=11]="OP_MS",r[r.OP_MSG=12]="OP_MSG",r[r.OP_MSG_SPC=13]="OP_MSG_SPC",r[r.MSG_ARG=14]="MSG_ARG",r[r.MSG_PAYLOAD=15]="MSG_PAYLOAD",r[r.MSG_END=16]="MSG_END",r[r.OP_H=17]="OP_H",r[r.OP_P=18]="OP_P",r[r.OP_PI=19]="OP_PI",r[r.OP_PIN=20]="OP_PIN",r[r.OP_PING=21]="OP_PING",r[r.OP_PO=22]="OP_PO",r[r.OP_PON=23]="OP_PON",r[r.OP_PONG=24]="OP_PONG",r[r.OP_I=25]="OP_I",r[r.OP_IN=26]="OP_IN",r[r.OP_INF=27]="OP_INF",r[r.OP_INFO=28]="OP_INFO",r[r.OP_INFO_SPC=29]="OP_INFO_SPC",r[r.INFO_ARG=30]="INFO_ARG"})(le||(le={}));var oe;(function(r){r[r.CR=13]="CR",r[r.E=69]="E",r[r.e=101]="e",r[r.F=70]="F",r[r.f=102]="f",r[r.G=71]="G",r[r.g=103]="g",r[r.H=72]="H",r[r.h=104]="h",r[r.I=73]="I",r[r.i=105]="i",r[r.K=75]="K",r[r.k=107]="k",r[r.M=77]="M",r[r.m=109]="m",r[r.MINUS=45]="MINUS",r[r.N=78]="N",r[r.n=110]="n",r[r.NL=10]="NL",r[r.O=79]="O",r[r.o=111]="o",r[r.P=80]="P",r[r.p=112]="p",r[r.PLUS=43]="PLUS",r[r.R=82]="R",r[r.r=114]="r",r[r.S=83]="S",r[r.s=115]="s",r[r.SPACE=32]="SPACE",r[r.TAB=9]="TAB"})(oe||(oe={}));(function(r){var n=function(x,S){this.hi=x|0,this.lo=S|0},s=function(x){var S,_=new Float64Array(16);if(x)for(S=0;S<x.length;S++)_[S]=x[S];return _},a=function(){throw new Error("no PRNG")},o=new Uint8Array(16),f=new Uint8Array(32);f[0]=9;var h=s(),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]),q=s([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function M(x,S){return x<<S|x>>>32-S}function D(x,S){var _=x[S+3]&255;return _=_<<8|x[S+2]&255,_=_<<8|x[S+1]&255,_<<8|x[S+0]&255}function W(x,S){var _=x[S]<<24|x[S+1]<<16|x[S+2]<<8|x[S+3],A=x[S+4]<<24|x[S+5]<<16|x[S+6]<<8|x[S+7];return new n(_,A)}function se(x,S,_){var A;for(A=0;A<4;A++)x[S+A]=_&255,_>>>=8}function ee(x,S,_){x[S]=_.hi>>24&255,x[S+1]=_.hi>>16&255,x[S+2]=_.hi>>8&255,x[S+3]=_.hi&255,x[S+4]=_.lo>>24&255,x[S+5]=_.lo>>16&255,x[S+6]=_.lo>>8&255,x[S+7]=_.lo&255}function me(x,S,_,A,N){var z,I=0;for(z=0;z<N;z++)I|=x[S+z]^_[A+z];return(1&I-1>>>8)-1}function re(x,S,_,A){return me(x,S,_,A,16)}function C(x,S,_,A){return me(x,S,_,A,32)}function X(x,S,_,A,N){var z=new Uint32Array(16),I=new Uint32Array(16),Z=new Uint32Array(16),H=new Uint32Array(4),J,fe,je;for(J=0;J<4;J++)I[5*J]=D(A,4*J),I[1+J]=D(_,4*J),I[6+J]=D(S,4*J),I[11+J]=D(_,16+4*J);for(J=0;J<16;J++)Z[J]=I[J];for(J=0;J<20;J++){for(fe=0;fe<4;fe++){for(je=0;je<4;je++)H[je]=I[(5*fe+4*je)%16];for(H[1]^=M(H[0]+H[3]|0,7),H[2]^=M(H[1]+H[0]|0,9),H[3]^=M(H[2]+H[1]|0,13),H[0]^=M(H[3]+H[2]|0,18),je=0;je<4;je++)z[4*fe+(fe+je)%4]=H[je]}for(je=0;je<16;je++)I[je]=z[je]}if(N){for(J=0;J<16;J++)I[J]=I[J]+Z[J]|0;for(J=0;J<4;J++)I[5*J]=I[5*J]-D(A,4*J)|0,I[6+J]=I[6+J]-D(S,4*J)|0;for(J=0;J<4;J++)se(x,4*J,I[5*J]),se(x,16+4*J,I[6+J])}else for(J=0;J<16;J++)se(x,4*J,I[J]+Z[J]|0)}function ce(x,S,_,A){return X(x,S,_,A,!1),0}function V(x,S,_,A){return X(x,S,_,A,!0),0}var G=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function K(x,S,_,A,N,z,I){var Z=new Uint8Array(16),H=new Uint8Array(64),J,fe;if(!N)return 0;for(fe=0;fe<16;fe++)Z[fe]=0;for(fe=0;fe<8;fe++)Z[fe]=z[fe];for(;N>=64;){for(ce(H,Z,I,G),fe=0;fe<64;fe++)x[S+fe]=(_?_[A+fe]:0)^H[fe];for(J=1,fe=8;fe<16;fe++)J=J+(Z[fe]&255)|0,Z[fe]=J&255,J>>>=8;N-=64,S+=64,_&&(A+=64)}if(N>0)for(ce(H,Z,I,G),fe=0;fe<N;fe++)x[S+fe]=(_?_[A+fe]:0)^H[fe];return 0}function ae(x,S,_,A,N){return K(x,S,null,0,_,A,N)}function ne(x,S,_,A,N){var z=new Uint8Array(32);return V(z,A,N,G),ae(x,S,_,A.subarray(16),z)}function ke(x,S,_,A,N,z,I){var Z=new Uint8Array(32);return V(Z,z,I,G),K(x,S,_,A,N,z.subarray(16),Z)}function He(x,S){var _,A=0;for(_=0;_<17;_++)A=A+(x[_]+S[_]|0)|0,x[_]=A&255,A>>>=8}var Me=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function $(x,S,_,A,N,z){var I,Z,H,J,fe=new Uint32Array(17),je=new Uint32Array(17),Ke=new Uint32Array(17),Ct=new Uint32Array(17),An=new Uint32Array(17);for(H=0;H<17;H++)je[H]=Ke[H]=0;for(H=0;H<16;H++)je[H]=z[H];for(je[3]&=15,je[4]&=252,je[7]&=15,je[8]&=252,je[11]&=15,je[12]&=252,je[15]&=15;N>0;){for(H=0;H<17;H++)Ct[H]=0;for(H=0;H<16&&H<N;++H)Ct[H]=_[A+H];for(Ct[H]=1,A+=H,N-=H,He(Ke,Ct),Z=0;Z<17;Z++)for(fe[Z]=0,H=0;H<17;H++)fe[Z]=fe[Z]+Ke[H]*(H<=Z?je[Z-H]:320*je[Z+17-H]|0)|0|0;for(Z=0;Z<17;Z++)Ke[Z]=fe[Z];for(J=0,H=0;H<16;H++)J=J+Ke[H]|0,Ke[H]=J&255,J>>>=8;for(J=J+Ke[16]|0,Ke[16]=J&3,J=5*(J>>>2)|0,H=0;H<16;H++)J=J+Ke[H]|0,Ke[H]=J&255,J>>>=8;J=J+Ke[16]|0,Ke[16]=J}for(H=0;H<17;H++)An[H]=Ke[H];for(He(Ke,Me),I=-(Ke[16]>>>7)|0,H=0;H<17;H++)Ke[H]^=I&(An[H]^Ke[H]);for(H=0;H<16;H++)Ct[H]=z[H+16];for(Ct[16]=0,He(Ke,Ct),H=0;H<16;H++)x[S+H]=Ke[H];return 0}function te(x,S,_,A,N,z){var I=new Uint8Array(16);return $(I,0,_,A,N,z),re(x,S,I,0)}function de(x,S,_,A,N){var z;if(_<32)return-1;for(ke(x,0,S,0,_,A,N),$(x,16,x,32,_-32,x),z=0;z<16;z++)x[z]=0;return 0}function _e(x,S,_,A,N){var z,I=new Uint8Array(32);if(_<32||(ne(I,0,32,A,N),te(S,16,S,32,_-32,I)!==0))return-1;for(ke(x,0,S,0,_,A,N),z=0;z<32;z++)x[z]=0;return 0}function be(x,S){var _;for(_=0;_<16;_++)x[_]=S[_]|0}function Oe(x){var S,_;for(_=0;_<16;_++)x[_]+=65536,S=Math.floor(x[_]/65536),x[(_+1)*(_<15?1:0)]+=S-1+37*(S-1)*(_===15?1:0),x[_]-=S*65536}function we(x,S,_){for(var A,N=~(_-1),z=0;z<16;z++)A=N&(x[z]^S[z]),x[z]^=A,S[z]^=A}function Te(x,S){var _,A,N,z=s(),I=s();for(_=0;_<16;_++)I[_]=S[_];for(Oe(I),Oe(I),Oe(I),A=0;A<2;A++){for(z[0]=I[0]-65517,_=1;_<15;_++)z[_]=I[_]-65535-(z[_-1]>>16&1),z[_-1]&=65535;z[15]=I[15]-32767-(z[14]>>16&1),N=z[15]>>16&1,z[14]&=65535,we(I,z,1-N)}for(_=0;_<16;_++)x[2*_]=I[_]&255,x[2*_+1]=I[_]>>8}function lt(x,S){var _=new Uint8Array(32),A=new Uint8Array(32);return Te(_,x),Te(A,S),C(_,0,A,0)}function Pt(x){var S=new Uint8Array(32);return Te(S,x),S[0]&1}function an(x,S){var _;for(_=0;_<16;_++)x[_]=S[2*_]+(S[2*_+1]<<8);x[15]&=32767}function jt(x,S,_){var A;for(A=0;A<16;A++)x[A]=S[A]+_[A]|0}function Ot(x,S,_){var A;for(A=0;A<16;A++)x[A]=S[A]-_[A]|0}function Se(x,S,_){var A,N,z=new Float64Array(31);for(A=0;A<31;A++)z[A]=0;for(A=0;A<16;A++)for(N=0;N<16;N++)z[A+N]+=S[A]*_[N];for(A=0;A<15;A++)z[A]+=38*z[A+16];for(A=0;A<16;A++)x[A]=z[A];Oe(x),Oe(x)}function Tt(x,S){Se(x,S,S)}function ti(x,S){var _=s(),A;for(A=0;A<16;A++)_[A]=S[A];for(A=253;A>=0;A--)Tt(_,_),A!==2&&A!==4&&Se(_,_,S);for(A=0;A<16;A++)x[A]=_[A]}function Ni(x,S){var _=s(),A;for(A=0;A<16;A++)_[A]=S[A];for(A=250;A>=0;A--)Tt(_,_),A!==1&&Se(_,_,S);for(A=0;A<16;A++)x[A]=_[A]}function ni(x,S,_){var A=new Uint8Array(32),N=new Float64Array(80),z,I,Z=s(),H=s(),J=s(),fe=s(),je=s(),Ke=s();for(I=0;I<31;I++)A[I]=S[I];for(A[31]=S[31]&127|64,A[0]&=248,an(N,_),I=0;I<16;I++)H[I]=N[I],fe[I]=Z[I]=J[I]=0;for(Z[0]=fe[0]=1,I=254;I>=0;--I)z=A[I>>>3]>>>(I&7)&1,we(Z,H,z),we(J,fe,z),jt(je,Z,J),Ot(Z,Z,J),jt(J,H,fe),Ot(H,H,fe),Tt(fe,je),Tt(Ke,Z),Se(Z,J,Z),Se(J,H,je),jt(je,Z,J),Ot(Z,Z,J),Tt(H,Z),Ot(J,fe,Ke),Se(Z,J,g),jt(Z,Z,fe),Se(J,J,Z),Se(Z,fe,Ke),Se(fe,H,N),Tt(H,je),we(Z,H,z),we(J,fe,z);for(I=0;I<16;I++)N[I+16]=Z[I],N[I+32]=J[I],N[I+48]=H[I],N[I+64]=fe[I];var Ct=N.subarray(32),An=N.subarray(16);return ti(Ct,Ct),Se(An,An,Ct),Te(x,An),0}function ln(x,S){return ni(x,S,f)}function Ci(x,S){return a(S,32),ln(x,S)}function ms(x,S,_){var A=new Uint8Array(32);return ni(A,_,S),V(x,o,A,G)}var Ia=de,Qa=_e;function Cr(x,S,_,A,N,z){var I=new Uint8Array(32);return ms(I,N,z),Ia(x,S,_,A,I)}function kr(x,S,_,A,N,z){var I=new Uint8Array(32);return ms(I,N,z),Qa(x,S,_,A,I)}function Yn(){var x=0,S=0,_=0,A=0,N=65535,z,I,Z;for(Z=0;Z<arguments.length;Z++)z=arguments[Z].lo,I=arguments[Z].hi,x+=z&N,S+=z>>>16,_+=I&N,A+=I>>>16;return S+=x>>>16,_+=S>>>16,A+=_>>>16,new n(_&N|A<<16,x&N|S<<16)}function Xa(x,S){return new n(x.hi>>>S,x.lo>>>S|x.hi<<32-S)}function ki(){var x=0,S=0,_;for(_=0;_<arguments.length;_++)x^=arguments[_].lo,S^=arguments[_].hi;return new n(S,x)}function et(x,S){var _,A,N=32-S;return S<32?(_=x.hi>>>S|x.lo<<N,A=x.lo>>>S|x.hi<<N):S<64&&(_=x.lo>>>S|x.hi<<N,A=x.hi>>>S|x.lo<<N),new n(_,A)}function Xo(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 Ka(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 Za(x){return ki(et(x,28),et(x,34),et(x,39))}function Mi(x){return ki(et(x,14),et(x,18),et(x,41))}function Ko(x){return ki(et(x,1),et(x,8),Xa(x,7))}function Wa(x){return ki(et(x,19),et(x,61),Xa(x,6))}var Zo=[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 el(x,S,_){var A=[],N=[],z=[],I=[],Z,H,J;for(H=0;H<8;H++)A[H]=z[H]=W(x,8*H);for(var fe=0;_>=128;){for(H=0;H<16;H++)I[H]=W(S,8*H+fe);for(H=0;H<80;H++){for(J=0;J<8;J++)N[J]=z[J];for(Z=Yn(z[7],Mi(z[4]),Xo(z[4],z[5],z[6]),Zo[H],I[H%16]),N[7]=Yn(Z,Za(z[0]),Ka(z[0],z[1],z[2])),N[3]=Yn(N[3],Z),J=0;J<8;J++)z[(J+1)%8]=N[J];if(H%16===15)for(J=0;J<16;J++)I[J]=Yn(I[J],I[(J+9)%16],Ko(I[(J+1)%16]),Wa(I[(J+14)%16]))}for(H=0;H<8;H++)z[H]=Yn(z[H],A[H]),A[H]=z[H];fe+=128,_-=128}for(H=0;H<8;H++)ee(x,8*H,A[H]);return _}var si=new Uint8Array([106,9,230,103,243,188,201,8,187,103,174,133,132,202,167,59,60,110,243,114,254,148,248,43,165,79,245,58,95,29,54,241,81,14,82,127,173,230,130,209,155,5,104,140,43,62,108,31,31,131,217,171,251,65,189,107,91,224,205,25,19,126,33,121]);function ot(x,S,_){var A=new Uint8Array(64),N=new Uint8Array(256),z,I=_;for(z=0;z<64;z++)A[z]=si[z];for(el(A,S,_),_%=128,z=0;z<256;z++)N[z]=0;for(z=0;z<_;z++)N[z]=S[I-_+z];for(N[_]=128,_=256-128*(_<112?1:0),N[_-9]=0,ee(N,_-8,new n(I/536870912|0,I<<3)),el(A,N,_),z=0;z<64;z++)x[z]=A[z];return 0}function $t(x,S){var _=s(),A=s(),N=s(),z=s(),I=s(),Z=s(),H=s(),J=s(),fe=s();Ot(_,x[1],x[0]),Ot(fe,S[1],S[0]),Se(_,_,fe),jt(A,x[0],x[1]),jt(fe,S[0],S[1]),Se(A,A,fe),Se(N,x[3],S[3]),Se(N,N,E),Se(z,x[2],S[2]),jt(z,z,z),Ot(I,A,_),Ot(Z,z,N),jt(H,z,N),jt(J,A,_),Se(x[0],I,Z),Se(x[1],J,H),Se(x[2],H,Z),Se(x[3],I,J)}function Nt(x,S,_){var A;for(A=0;A<4;A++)we(x[A],S[A],_)}function Mr(x,S){var _=s(),A=s(),N=s();ti(N,S[2]),Se(_,S[0],N),Se(A,S[1],N),Te(x,A),x[31]^=Pt(_)<<7}function Rr(x,S,_){var A,N;for(be(x[0],h),be(x[1],m),be(x[2],m),be(x[3],h),N=255;N>=0;--N)A=_[N/8|0]>>(N&7)&1,Nt(x,S,A),$t(S,x),$t(x,x),Nt(x,S,A)}function Ri(x,S){var _=[s(),s(),s(),s()];be(_[0],w),be(_[1],T),be(_[2],m),Se(_[3],w,T),Rr(x,_,S)}function ps(x,S,_){var A=new Uint8Array(64),N=[s(),s(),s(),s()],z;for(_||a(S,32),ot(A,S,32),A[0]&=248,A[31]&=127,A[31]|=64,Ri(N,A),Mr(x,N),z=0;z<32;z++)S[z+32]=x[z];return 0}var Gn=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function gs(x,S){var _,A,N,z;for(A=63;A>=32;--A){for(_=0,N=A-32,z=A-12;N<z;++N)S[N]+=_-16*S[A]*Gn[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)*Gn[N],_=S[N]>>8,S[N]&=255;for(N=0;N<32;N++)S[N]-=_*Gn[N];for(A=0;A<32;A++)S[A+1]+=S[A]>>8,x[A]=S[A]&255}function Sn(x){var S=new Float64Array(64),_;for(_=0;_<64;_++)S[_]=x[_];for(_=0;_<64;_++)x[_]=0;gs(x,S)}function ii(x,S,_,A){var N=new Uint8Array(64),z=new Uint8Array(64),I=new Uint8Array(64),Z,H,J=new Float64Array(64),fe=[s(),s(),s(),s()];ot(N,A,32),N[0]&=248,N[31]&=127,N[31]|=64;var je=_+64;for(Z=0;Z<_;Z++)x[64+Z]=S[Z];for(Z=0;Z<32;Z++)x[32+Z]=N[32+Z];for(ot(I,x.subarray(32),_+32),Sn(I),Ri(fe,I),Mr(x,fe),Z=32;Z<64;Z++)x[Z]=A[Z];for(ot(z,x,_+64),Sn(z),Z=0;Z<64;Z++)J[Z]=0;for(Z=0;Z<32;Z++)J[Z]=I[Z];for(Z=0;Z<32;Z++)for(H=0;H<32;H++)J[Z+H]+=z[Z]*N[H];return gs(x.subarray(32),J),je}function ri(x,S){var _=s(),A=s(),N=s(),z=s(),I=s(),Z=s(),H=s();return be(x[2],m),an(x[1],S),Tt(N,x[1]),Se(z,N,y),Ot(N,N,x[2]),jt(z,x[2],z),Tt(I,z),Tt(Z,I),Se(H,Z,I),Se(_,H,N),Se(_,_,z),Ni(_,_),Se(_,_,N),Se(_,_,z),Se(_,_,z),Se(x[0],_,z),Tt(A,x[0]),Se(A,A,z),lt(A,N)&&Se(x[0],x[0],q),Tt(A,x[0]),Se(A,A,z),lt(A,N)?-1:(Pt(x[0])===S[31]>>7&&Ot(x[0],h,x[0]),Se(x[3],x[0],x[1]),0)}function Dr(x,S,_,A){var N,z=new Uint8Array(32),I=new Uint8Array(64),Z=[s(),s(),s(),s()],H=[s(),s(),s(),s()];if(_<64||ri(H,A))return-1;for(N=0;N<_;N++)x[N]=S[N];for(N=0;N<32;N++)x[N+32]=A[N];if(ot(I,x,_),Sn(I),Rr(Z,H,I),Ri(H,S.subarray(32)),$t(Z,H),Mr(z,Z),_-=64,C(S,0,z,0)){for(N=0;N<_;N++)x[N]=0;return-1}for(N=0;N<_;N++)x[N]=S[N+64];return _}var Di=32,ys=24,En=32,bs=16,xs=32,ai=32,vs=32,Vn=32,li=32,zr=ys,tl=En,Rn=bs,Qe=64,it=32,Yt=64,oi=32,qr=64;r.lowlevel={crypto_core_hsalsa20:V,crypto_stream_xor:ke,crypto_stream:ne,crypto_stream_salsa20_xor:K,crypto_stream_salsa20:ae,crypto_onetimeauth:$,crypto_onetimeauth_verify:te,crypto_verify_16:re,crypto_verify_32:C,crypto_secretbox:de,crypto_secretbox_open:_e,crypto_scalarmult:ni,crypto_scalarmult_base:ln,crypto_box_beforenm:ms,crypto_box_afternm:Ia,crypto_box:Cr,crypto_box_open:kr,crypto_box_keypair:Ci,crypto_hash:ot,crypto_sign:ii,crypto_sign_keypair:ps,crypto_sign_open:Dr,crypto_secretbox_KEYBYTES:Di,crypto_secretbox_NONCEBYTES:ys,crypto_secretbox_ZEROBYTES:En,crypto_secretbox_BOXZEROBYTES:bs,crypto_scalarmult_BYTES:xs,crypto_scalarmult_SCALARBYTES:ai,crypto_box_PUBLICKEYBYTES:vs,crypto_box_SECRETKEYBYTES:Vn,crypto_box_BEFORENMBYTES:li,crypto_box_NONCEBYTES:zr,crypto_box_ZEROBYTES:tl,crypto_box_BOXZEROBYTES:Rn,crypto_sign_BYTES:Qe,crypto_sign_PUBLICKEYBYTES:it,crypto_sign_SECRETKEYBYTES:Yt,crypto_sign_SEEDBYTES:oi,crypto_hash_BYTES:qr,gf:s,D:y,L:Gn,pack25519:Te,unpack25519:an,M:Se,A:jt,S:Tt,Z:Ot,pow2523:Ni,add:$t,set25519:be,modL:gs,scalarmult:Rr,scalarbase:Ri};function nl(x,S){if(x.length!==Di)throw new Error("bad key size");if(S.length!==ys)throw new Error("bad nonce size")}function sl(x,S){if(x.length!==vs)throw new Error("bad public key size");if(S.length!==Vn)throw new Error("bad secret key size")}function yt(){for(var x=0;x<arguments.length;x++)if(!(arguments[x]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function zi(x){for(var S=0;S<x.length;S++)x[S]=0}r.randomBytes=function(x){var S=new Uint8Array(x);return a(S,x),S},r.secretbox=function(x,S,_){yt(x,S,_),nl(_,S);for(var A=new Uint8Array(En+x.length),N=new Uint8Array(A.length),z=0;z<x.length;z++)A[z+En]=x[z];return de(N,A,A.length,S,_),N.subarray(bs)},r.secretbox.open=function(x,S,_){yt(x,S,_),nl(_,S);for(var A=new Uint8Array(bs+x.length),N=new Uint8Array(A.length),z=0;z<x.length;z++)A[z+bs]=x[z];return A.length<32||_e(N,A,A.length,S,_)!==0?null:N.subarray(En)},r.secretbox.keyLength=Di,r.secretbox.nonceLength=ys,r.secretbox.overheadLength=bs,r.scalarMult=function(x,S){if(yt(x,S),x.length!==ai)throw new Error("bad n size");if(S.length!==xs)throw new Error("bad p size");var _=new Uint8Array(xs);return ni(_,x,S),_},r.scalarMult.base=function(x){if(yt(x),x.length!==ai)throw new Error("bad n size");var S=new Uint8Array(xs);return ln(S,x),S},r.scalarMult.scalarLength=ai,r.scalarMult.groupElementLength=xs,r.box=function(x,S,_,A){var N=r.box.before(_,A);return r.secretbox(x,S,N)},r.box.before=function(x,S){yt(x,S),sl(x,S);var _=new Uint8Array(li);return ms(_,x,S),_},r.box.after=r.secretbox,r.box.open=function(x,S,_,A){var N=r.box.before(_,A);return r.secretbox.open(x,S,N)},r.box.open.after=r.secretbox.open,r.box.keyPair=function(){var x=new Uint8Array(vs),S=new Uint8Array(Vn);return Ci(x,S),{publicKey:x,secretKey:S}},r.box.keyPair.fromSecretKey=function(x){if(yt(x),x.length!==Vn)throw new Error("bad secret key size");var S=new Uint8Array(vs);return ln(S,x),{publicKey:S,secretKey:new Uint8Array(x)}},r.box.publicKeyLength=vs,r.box.secretKeyLength=Vn,r.box.sharedKeyLength=li,r.box.nonceLength=zr,r.box.overheadLength=r.secretbox.overheadLength,r.sign=function(x,S){if(yt(x,S),S.length!==Yt)throw new Error("bad secret key size");var _=new Uint8Array(Qe+x.length);return ii(_,x,x.length,S),_},r.sign.open=function(x,S){if(yt(x,S),S.length!==it)throw new Error("bad public key size");var _=new Uint8Array(x.length),A=Dr(_,x,x.length,S);if(A<0)return null;for(var N=new Uint8Array(A),z=0;z<N.length;z++)N[z]=_[z];return N},r.sign.detached=function(x,S){for(var _=r.sign(x,S),A=new Uint8Array(Qe),N=0;N<A.length;N++)A[N]=_[N];return A},r.sign.detached.verify=function(x,S,_){if(yt(x,S,_),S.length!==Qe)throw new Error("bad signature size");if(_.length!==it)throw new Error("bad public key size");var A=new Uint8Array(Qe+x.length),N=new Uint8Array(Qe+x.length),z;for(z=0;z<Qe;z++)A[z]=S[z];for(z=0;z<x.length;z++)A[z+Qe]=x[z];return Dr(N,A,A.length,_)>=0},r.sign.keyPair=function(){var x=new Uint8Array(it),S=new Uint8Array(Yt);return ps(x,S),{publicKey:x,secretKey:S}},r.sign.keyPair.fromSecretKey=function(x){if(yt(x),x.length!==Yt)throw new Error("bad secret key size");for(var S=new Uint8Array(it),_=0;_<S.length;_++)S[_]=x[32+_];return{publicKey:S,secretKey:new Uint8Array(x)}},r.sign.keyPair.fromSeed=function(x){if(yt(x),x.length!==oi)throw new Error("bad seed size");for(var S=new Uint8Array(it),_=new Uint8Array(Yt),A=0;A<32;A++)_[A]=x[A];return ps(S,_,!0),{publicKey:S,secretKey:_}},r.sign.publicKeyLength=it,r.sign.secretKeyLength=Yt,r.sign.seedLength=oi,r.sign.signatureLength=Qe,r.hash=function(x){yt(x);var S=new Uint8Array(qr);return ot(S,x,x.length),S},r.hash.hashLength=qr,r.verify=function(x,S){return yt(x,S),x.length===0||S.length===0||x.length!==S.length?!1:me(x,0,S,0,x.length)===0},r.setPRNG=function(x){a=x},(function(){var x=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(x&&x.getRandomValues){var S=65536;r.setPRNG(function(_,A){var N,z=new Uint8Array(A);for(N=0;N<A;N+=S)x.getRandomValues(z.subarray(N,N+Math.min(A-N,S)));for(N=0;N<A;N++)_[N]=z[N];zi(z)})}else typeof require<"u"&&(x=require("crypto"),x&&x.randomBytes&&r.setPRNG(function(_,A){var N,z=x.randomBytes(A);for(N=0;N<A;N++)_[N]=z[N];zi(z)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const bo=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;bo.sign.keyPair.fromSeed,bo.sign.detached,bo.sign.detached.verify,bo.randomBytes;var N0;(function(r){r.InvalidPrefixByte="nkeys: invalid prefix byte",r.InvalidKey="nkeys: invalid key",r.InvalidPublicKey="nkeys: invalid public key",r.InvalidSeedLen="nkeys: invalid seed length",r.InvalidSeed="nkeys: invalid seed",r.InvalidEncoding="nkeys: invalid encoded key",r.InvalidSignature="nkeys: signature verification failed",r.CannotSign="nkeys: cannot sign, no private key available",r.PublicKeyOnly="nkeys: no seed or private key available",r.InvalidChecksum="nkeys: invalid checksum",r.SerializationError="nkeys: serialization error",r.ApiError="nkeys: api error",r.ClearedPair="nkeys: pair is cleared"})(N0||(N0={}));var C0;(function(r){r[r.Seed=144]="Seed",r[r.Private=120]="Private",r[r.Operator=112]="Operator",r[r.Server=104]="Server",r[r.Cluster=16]="Cluster",r[r.Account=0]="Account",r[r.User=160]="User"})(C0||(C0={}));function f1(r){return n=>{let s={};return r.forEach(a=>{const o=a(n)||{};s=Object.assign(s,o)}),s}}function h1(){return()=>{}}function d1(r,n){return()=>{const s=typeof r=="function"?r():r,a=typeof n=="function"?n():n;return{user:s,pass:a}}}function m1(r){return()=>({auth_token:typeof r=="function"?r():r})}const Ng=120*1e3,p1=2,Cg=2*1e3;function g1(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:Ng,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:Cg,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function y1(r){const n=[];return typeof r.authenticator=="function"&&n.push(r.authenticator),Array.isArray(r.authenticator)&&n.push(...r.authenticator),r.token&&n.push(m1(r.token)),r.user&&n.push(d1(r.user,r.pass)),n.length===0?h1():f1(n)}function b1(r){const n=`${Of}:${jg()}`;if(r=r||{servers:[n]},r.servers=r.servers||[],typeof r.servers=="string"&&(r.servers=[r.servers]),r.servers.length>0&&r.port)throw new ue("port and servers options are mutually exclusive",ie.InvalidOption);r.servers.length===0&&r.port&&(r.servers=[`${Of}:${r.port}`]),r.servers&&r.servers.length===0&&(r.servers=[n]);const s=Yo(g1(),r);if(s.authenticator=y1(s),["reconnectDelayHandler","authenticator"].forEach(a=>{if(s[a]&&typeof s[a]!="function")throw new ue(`${a} option should be a function`,ie.NotFunction)}),s.reconnectDelayHandler||(s.reconnectDelayHandler=()=>{let a=s.tls?s.reconnectJitterTLS:s.reconnectJitter;return a&&(a++,a=Math.floor(Math.random()*a)),s.reconnectTimeWait+a}),s.inboxPrefix)try{fs(s.inboxPrefix)}catch(a){throw new ue(a.message,ie.ApiError)}if(s.resolve===void 0&&(s.resolve=typeof zf()=="function"),s.resolve&&typeof zf()!="function")throw new ue("'resolve' is not supported on this client",ie.InvalidOption);return s}function x1(r,n){const{proto:s,tls_required:a,tls_available:o}=r;if((s===void 0||s<1)&&n.noEcho)throw new ue("noEcho",ie.ServerOptionNotAvailable);const f=a||o||!1;if(n.tls&&!f)throw new ue("tls",ie.ServerOptionNotAvailable)}const v1=1024*32,_1=/^INFO\s+([^\r\n]+)\r\n/i,w1=Da(`PONG\r
|
|
38
|
+
`),k0=Da(`PING\r
|
|
39
|
+
`);class S1{constructor(n,s,a){v(this,"echo");v(this,"no_responders");v(this,"protocol");v(this,"verbose");v(this,"pedantic");v(this,"jwt");v(this,"nkey");v(this,"sig");v(this,"user");v(this,"pass");v(this,"auth_token");v(this,"tls_required");v(this,"name");v(this,"lang");v(this,"version");v(this,"headers");this.protocol=1,this.version=n.version,this.lang=n.lang,this.echo=s.noEcho?!1:void 0,this.verbose=s.verbose,this.pedantic=s.pedantic,this.tls_required=s.tls?!0:void 0,this.name=s.name;const o=(s&&typeof s.authenticator=="function"?s.authenticator(a):{})||{};Yo(this,o)}}class kg extends _t{constructor(s,a,o={}){var h;super();v(this,"sid");v(this,"queue");v(this,"draining");v(this,"max");v(this,"subject");v(this,"drained");v(this,"protocol");v(this,"timer");v(this,"info");v(this,"cleanupFn");v(this,"closed");v(this,"requestSubject");Yo(this,o),this.protocol=s,this.subject=a,this.draining=!1,this.noIterator=typeof o.callback=="function",this.closed=st();const f=!((h=s.options)!=null&&h.noAsyncTraces);o.timeout&&(this.timer=Ar(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,h=s.dispatchedFn?s.dispatchedFn:()=>{};this.callback=(m,g)=>{const{ingest:y}=o(g);y&&f(g)&&(a(m,g),h(g))}}else this.protocolFilterFn=s.protocolFilterFn,this.dispatchedFn=s.dispatchedFn}callback(s,a){this.cancelTimeout(),s?this.stop(s):this.push(a)}close(){if(!this.isClosed()){this.cancelTimeout();const s=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?s():this.push(s)}}unsubscribe(s){this.protocol.unsubscribe(this,s)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(ue.errorForCode(ie.ConnectionClosed)):this.isClosed()?Promise.reject(ue.errorForCode(ie.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(st()).then(()=>{this.protocol.subscriptions.cancel(this)}).catch(()=>{this.protocol.subscriptions.cancel(this)})),this.drained)}isDraining(){return this.draining}isClosed(){return this.done}getSubject(){return this.subject}getMax(){return this.max}getID(){return this.sid}}class E1{constructor(){v(this,"mux");v(this,"subs");v(this,"sidCounter");this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(n){return this.sidCounter++,n.sid=this.sidCounter,this.subs.set(n.sid,n),n}setMux(n){return this.mux=n,n}getMux(){return this.mux}get(n){return this.subs.get(n)}resub(n){return this.sidCounter++,this.subs.delete(n.sid),n.sid=this.sidCounter,this.subs.set(n.sid,n),n}all(){return Array.from(this.subs.values())}cancel(n){n&&(n.close(),this.subs.delete(n.sid))}handleError(n){if(n&&n.permissionContext){const s=n.permissionContext,a=this.all();let o;if(s.operation==="subscription"&&(o=a.find(f=>f.subject===s.subject&&f.queue===s.queue)),s.operation==="publish"&&(o=a.find(f=>f.requestSubject===s.subject)),o)return o.callback(n,{}),o.close(),this.subs.delete(o.sid),o!==this.mux}return!1}close(){this.subs.forEach(n=>{n.close()})}}class Uo{constructor(n,s){v(this,"connected");v(this,"connectedOnce");v(this,"infoReceived");v(this,"info");v(this,"muxSubscriptions");v(this,"options");v(this,"outbound");v(this,"pongs");v(this,"subscriptions");v(this,"transport");v(this,"noMorePublishing");v(this,"connectError");v(this,"publisher");v(this,"_closed");v(this,"closed");v(this,"listeners");v(this,"heartbeats");v(this,"parser");v(this,"outMsgs");v(this,"inMsgs");v(this,"outBytes");v(this,"inBytes");v(this,"pendingLimit");v(this,"lastError");v(this,"abortReconnect");v(this,"whyClosed");v(this,"servers");v(this,"server");v(this,"features");v(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=v1,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=n,this.publisher=s,this.subscriptions=new E1,this.muxSubscriptions=new a1,this.outbound=new Or,this.pongs=[],this.whyClosed="",this.pendingLimit=n.pendingLimit||this.pendingLimit,this.features=new Hv({major:0,minor:0,micro:0}),this.connectPromise=null;const a=typeof n.servers=="string"?[n.servers]:n.servers;this.servers=new r1(a,{randomize:!n.noRandomize}),this.closed=st(),this.parser=new T0(this),this.heartbeats=new l1(this,this.options.pingInterval||Ng,this.options.maxPingOut||p1)}resetOutbound(){this.outbound.reset();const n=this.pongs;this.pongs=[];const s=ue.errorForCode(ie.Disconnect);s.stack="",n.forEach(a=>{a.reject(s)}),this.parser=new T0(this),this.infoReceived=!1}dispatchStatus(n){this.listeners.forEach(s=>{s.push(n)})}status(){const n=new _t;return this.listeners.push(n),n}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const n=st();return n.catch(()=>{}),this.pongs.unshift(n),this.connectError=s=>{n.reject(s)},this.transport=Yv(),this.transport.closed().then(async s=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),n}disconnect(){this.dispatchStatus({type:vr.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:vr.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(n){this.dispatchStatus({type:us.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var s;this.dispatchStatus({type:us.Reconnect,data:this.servers.getCurrentServer().toString()}),((s=this.lastError)==null?void 0:s.code)===ie.AuthenticationExpired&&(this.lastError=void 0)}).catch(s=>{this._close(s)}):await this._close(n)}async dial(n){const s=this.prepare();let a;try{a=Ar(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:zf(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:s});let o=null;for(const f of a)try{o=null,this.dispatchStatus({type:vr.Reconnecting,data:f.toString()}),await this.dial(f);return}catch(h){o=h}throw o}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let n;for(;;){this._closed&&this.servers.clear();const s=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():Cg;let a=s;const o=this.selectServer();if(!o||this.abortReconnect)throw n||(this.lastError?this.lastError:ue.errorForCode(ie.ConnectionRefused));const f=Date.now();if(o.lastConnect===0||o.lastConnect+s<=f){o.lastConnect=Date.now();try{await this._doDial(o);break}catch(h){if(n=h,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}o.reconnects++;const m=this.options.maxReconnectAttempts||0;m!==-1&&o.reconnects>=m&&this.servers.removeCurrentServer()}}else a=Math.min(a,o.lastConnect+s-f),await Tr(a)}}static async connect(n,s){const a=new Uo(n,s);return await a.dialLoop(),a}static toError(n){const s=n?n.toLowerCase():"";if(s.indexOf("permissions violation")!==-1){const a=new ue(n,ie.PermissionsViolation),o=n.match(/(Publish|Subscription) to "(\S+)"/);if(o){a.permissionContext={operation:o[1].toLowerCase(),subject:o[2],queue:void 0};const f=n.match(/using queue "(\S+)"/);f&&(a.permissionContext.queue=f[1])}return a}else return s.indexOf("authorization violation")!==-1?new ue(n,ie.AuthorizationViolation):s.indexOf("user authentication expired")!==-1?new ue(n,ie.AuthenticationExpired):s.indexOf("account authentication expired")!=-1?new ue(n,ie.AccountExpired):s.indexOf("authentication timeout")!==-1?new ue(n,ie.AuthenticationTimeout):new ue(n,ie.ProtocolError)}processMsg(n,s){if(this.inMsgs++,this.inBytes+=s.length,!this.subscriptions.sidCounter)return;const a=this.subscriptions.get(n.sid);a&&(a.received+=1,a.callback&&a.callback(null,new nh(n,s,this)),a.max!==void 0&&a.received>=a.max&&a.unsubscribe())}processError(n){const s=d0(n),a=Uo.toError(s),o={type:us.Error,data:a.code};if(a.isPermissionError()){let f=!1;if(a.permissionContext){o.permissionContext=a.permissionContext;const h=this.subscriptions.getMux();f=(h==null?void 0:h.subject)===a.permissionContext.subject}this.subscriptions.handleError(a),this.muxSubscriptions.handleError(f,a),f&&this.subscriptions.setMux(null)}this.dispatchStatus(o),this.handleError(a)}handleError(n){n.isAuthError()?this.handleAuthError(n):n.isProtocolError()?this.lastError=n:n.isAuthTimeout()&&(this.lastError=n),n.isPermissionError()||(this.lastError=n)}handleAuthError(n){this.lastError&&n.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(n):this.disconnect()}processPing(){this.transport.send(w1)}processPong(){const n=this.pongs.shift();n&&n.resolve()}processInfo(n){const s=JSON.parse(d0(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(ji(s.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:f,lang:h}=this.transport;try{const m=new S1({version:f,lang:h},this.options,s.nonce);s.headers&&(m.headers=!0,m.no_responders=!0);const g=JSON.stringify(m);this.transport.send(Da(`CONNECT ${g}${Eo}`)),this.transport.send(k0)}catch(m){this._close(m)}}a&&this.dispatchStatus({type:us.Update,data:a}),(s.ldm!==void 0?s.ldm:!1)&&this.dispatchStatus({type:us.LDM,data:this.servers.getCurrentServer().toString()})}push(n){switch(n.kind){case Rt.MSG:{const{msg:s,data:a}=n;this.processMsg(s,a);break}case Rt.OK:break;case Rt.ERR:this.processError(n.data);break;case Rt.PING:this.processPing();break;case Rt.PONG:this.processPong();break;case Rt.INFO:this.processInfo(n.data);break}}sendCommand(n,...s){const a=this.outbound.length();let o;typeof n=="string"?o=Da(n):o=n,this.outbound.fill(o,...s),a===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(n,s=nn,a){let o;if(s instanceof Uint8Array)o=s;else if(typeof s=="string")o=Ti.encode(s);else throw ue.errorForCode(ie.BadPayload);let f=o.length;a=a||{},a.reply=a.reply||"";let h=nn,m=0;if(a.headers){if(this.info&&!this.info.headers)throw new ue("headers",ie.ServerOptionNotAvailable);h=a.headers.encode(),m=h.length,f=o.length+m}if(this.info&&f>this.info.max_payload)throw ue.errorForCode(ie.MaxPayloadExceeded);this.outBytes+=f,this.outMsgs++;let g;a.headers?(a.reply?g=`HPUB ${n} ${a.reply} ${m} ${f}\r
|
|
40
40
|
`:g=`HPUB ${n} ${m} ${f}\r
|
|
41
41
|
`,this.sendCommand(g,h,o,qo)):(a.reply?g=`PUB ${n} ${a.reply} ${f}\r
|
|
42
42
|
`:g=`PUB ${n} ${f}\r
|
|
@@ -44,20 +44,20 @@ ${this.ctx.stack}`),this.deferred.reject(s)):this.deferred.resolve(a),this.cance
|
|
|
44
44
|
`):this.sendCommand(`SUB ${n.subject} ${n.sid}\r
|
|
45
45
|
`)}_subunsub(n){return this._sub(n),n.max&&this.unsubscribe(n,n.max),n}unsubscribe(n,s){this.unsub(n,s),(n.max===void 0||n.received>=n.max)&&this.subscriptions.cancel(n)}unsub(n,s){!n||this.isClosed()||(s?this.sendCommand(`UNSUB ${n.sid} ${s}\r
|
|
46
46
|
`):this.sendCommand(`UNSUB ${n.sid}\r
|
|
47
|
-
`),n.max=s)}resub(n,s){!n||this.isClosed()||(this.unsub(n),n.subject=s,this.subscriptions.resub(n),this._sub(n))}flush(n){return n||(n=st()),this.pongs.push(n),this.outbound.fill(C0),this.flushPending(),n}sendSubscriptions(){const n=[];this.subscriptions.all().forEach(s=>{const a=s;a.queue?n.push(`SUB ${a.subject} ${a.queue} ${a.sid}${Eo}`):n.push(`SUB ${a.subject} ${a.sid}${Eo}`)}),n.length&&this.transport.send(Ra(n.join("")))}async _close(n){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(n),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(s=>{s.stop()}),this._closed=!0,await this.transport.close(n),await this.closed.resolve(n))}close(){return this._close()}isClosed(){return this._closed}drain(){const n=this.subscriptions.all(),s=[];return n.forEach(a=>{s.push(a.drain())}),Promise.all(s).then(async()=>(this.noMorePublishing=!0,await this.flush(),this.close())).catch(()=>{})}flushPending(){if(!(!this.infoReceived||!this.connected)&&this.outbound.size()){const n=this.outbound.drain();this.transport.send(n)}}initMux(){if(!this.subscriptions.getMux()){const s=this.muxSubscriptions.init(this.options.inboxPrefix),a=new Cg(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 E1="$SRV";class k0{constructor(n){v(this,"msg");this.msg=n}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(n,s){return this.msg.respond(n,s)}respondError(n,s,a,o){var f,h;return o=o||{},o.headers=o.headers||hs(),(f=o.headers)==null||f.set(Mo,`${n}`),(h=o.headers)==null||h.set(ko,s),this.msg.respond(a,o)}json(n){return this.msg.json(n)}string(){return this.msg.string()}}class La{constructor(n,s="",a=""){v(this,"subject");v(this,"queue");v(this,"srv");s!==""&&j1("service group",s);let o="";if(n instanceof Ga)this.srv=n,o="";else if(n instanceof La){const f=n;this.srv=f.srv,a===""&&f.queue!==""&&(a=f.queue),o=f.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(o,s),this.queue=a}calcSubject(n,s=""){return s===""?n:n!==""?`${n}.${s}`:s}addEndpoint(n="",s){s=s||{subject:n};const a=typeof s=="function"?{handler:s,subject:n}:s;Ca("endpoint",n);let{subject:o,handler:f,metadata:h,queue:m}=a;o=o||n,m=m||this.queue,A1("endpoint subject",o),o=this.calcSubject(this.subject,o);const g={name:n,subject:o,queue:m,handler:f,metadata:h};return this.srv._addEndpoint(g)}addGroup(n="",s=""){return new La(this,n,s)}}function A1(r,n){if(n==="")throw new Error(`${r} cannot be empty`);if(n.indexOf(" ")!==-1)throw new Error(`${r} cannot contain spaces: '${n}'`);const s=n.split(".");s.forEach((a,o)=>{if(a===">"&&o!==s.length-1)throw new Error(`${r} cannot have internal '>': '${n}'`)})}function j1(r,n){if(n.indexOf(" ")!==-1)throw new Error(`${r} cannot contain spaces: '${n}'`);n.split(".").forEach(a=>{if(a===">")throw new Error(`${r} name cannot contain internal '>': '${n}'`)})}class Ga{constructor(n,s={name:"",version:""}){v(this,"nc");v(this,"_id");v(this,"config");v(this,"handlers");v(this,"internal");v(this,"_stopped");v(this,"_done");v(this,"started");this.nc=n,this.config=Object.assign({},s),this.config.queue||(this.config.queue="q"),Ca("name",this.config.name),Ca("queue",this.config.queue),Ai(this.config.version),this._id=Ks.next(),this.internal=[],this._done=st(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(a=>{this.close(a).catch()})}static controlSubject(n,s="",a="",o){const f=o??E1;return s===""&&a===""?`${f}.${n}`:(Ca("control subject name",s),a!==""?(Ca("control subject id",a),`${f}.${n}.${s}.${a}`):`${f}.${n}.${s}`)}get subjects(){return this.handlers.filter(n=>n.internal===!1).map(n=>n.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(n){const s=hs();if(n instanceof Ro){const a=n;s.set(ko,a.message),s.set(Mo,`${a.code}`)}else s.set(ko,n.message),s.set(Mo,"500");return s}setupHandler(n,s=!1){const a=s?"":n.queue?n.queue:this.config.queue,{name:o,subject:f,handler:h}=n,m=n;m.internal=s,s&&this.internal.push(m),m.stats=new O1(o,f,a),m.queue=a;const g=h?(y,E)=>{if(y){this.close(y);return}const w=Date.now();try{h(y,new k0(E))}catch(O){m.stats.countError(O),E==null||E.respond(nn,{headers:this.errorToHeader(O)})}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:Da.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(n=>{const{subject:s,metadata:a,name:o,queue:f}=n;return{subject:s,metadata:a,name:o,queue_group:f}})}async stats(){const n=[];for(const s of this.handlers){if(typeof this.config.statsHandler=="function")try{s.stats.data=await this.config.statsHandler(s)}catch(a){s.stats.countError(a)}n.push(s.stats.stats(s.qi))}return{type:Da.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:n}}addInternalHandler(n,s){const a=`${n}`.toUpperCase();this._doAddInternalHandler(`${a}-all`,n,s),this._doAddInternalHandler(`${a}-kind`,n,s,this.name),this._doAddInternalHandler(`${a}`,n,s,this.name,this.id)}_doAddInternalHandler(n,s,a,o="",f=""){const h={};h.name=n,h.subject=Ga.controlSubject(s,o,f),h.handler=a,this.setupHandler(h,!0)}start(){const n=kn(),s=(h,m)=>h?(this.close(h),Promise.reject(h)):this.stats().then(g=>(m==null||m.respond(n.encode(g)),Promise.resolve())),a=(h,m)=>h?(this.close(h),Promise.reject(h)):(m==null||m.respond(n.encode(this.info())),Promise.resolve()),o=n.encode(this.ping()),f=(h,m)=>h?(this.close(h).then().catch(),Promise.reject(h)):(m.respond(o),Promise.resolve());return this.addInternalHandler(Js.PING,f),this.addInternalHandler(Js.STATS,s),this.addInternalHandler(Js.INFO,a),this.handlers.forEach(h=>{const{subject:m}=h;typeof m=="string"&&h.handler!==null&&this.setupHandler(h)}),Promise.resolve(this)}close(n){if(this._stopped)return this._done;this._stopped=!0;let s=[];return this.nc.isClosed()||(s=this.handlers.concat(this.internal).map(a=>a.sub.drain())),Promise.allSettled(s).then(()=>{this._done.resolve(n||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(n){return this.close(n)}ping(){return{type:Da.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const n of this.handlers)n.stats.reset(n.qi)}addGroup(n,s){return new La(this,n,s)}addEndpoint(n,s){return new La(this).addEndpoint(n,s)}_addEndpoint(n){const s=new _t;s.noIterator=typeof n.handler=="function",s.noIterator||(n.handler=(o,f)=>{o?this.stop(o).catch():s.push(new k0(f))},s.iterClosed.then(()=>{this.close().catch()}));const a=this.setupHandler(n,!1);return a.qi=s,this.handlers.push(a),s}}class O1{constructor(n,s,a=""){v(this,"name");v(this,"subject");v(this,"average_processing_time");v(this,"num_requests");v(this,"processing_time");v(this,"num_errors");v(this,"last_error");v(this,"data");v(this,"metadata");v(this,"queue");this.name=n,this.subject=s,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=a}reset(n){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const s=n;s&&(s.time=0,s.processed=0)}countLatency(n){this.num_requests++,this.processing_time+=nt(Date.now()-n),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(n){this.num_errors++,this.last_error=n.message}_stats(){const{name:n,subject:s,average_processing_time:a,num_errors:o,num_requests:f,processing_time:h,last_error:m,data:g,queue:y}=this;return{name:n,subject:s,average_processing_time:a,num_errors:o,num_requests:f,processing_time:h,last_error:m,data:g,queue_group:y}}stats(n){const s=n;return(s==null?void 0:s.noIterator)===!1&&(this.processing_time=nt(s.time),this.num_requests=s.processed,this.average_processing_time=this.processing_time>0&&this.num_requests>0?this.processing_time/this.num_requests:0),this._stats()}}class T1{constructor(n,s={strategy:Cn.JitterTimer,maxWait:2e3},a){v(this,"nc");v(this,"prefix");v(this,"opts");this.nc=n,this.prefix=a,this.opts=s}ping(n="",s=""){return this.q(Js.PING,n,s)}stats(n="",s=""){return this.q(Js.STATS,n,s)}info(n="",s=""){return this.q(Js.INFO,n,s)}async q(n,s="",a=""){const o=new _t,f=kn(),h=Ga.controlSubject(n,s,a,this.prefix),m=await this.nc.requestMany(h,nn,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 kg(){return{key:{encode(r){return r},decode(r){return r}},value:{encode(r){return r},decode(r){return r}}}}function N1(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:kg(),storage:Mf.File}}const Bo="KV-Operation",M0="$KV",C1=/^[-/=.\w]+$/,k1=/^[-/=.>*\w]+$/,M1=/^[-\w]+$/;function R1(r){if(r.startsWith(".")||r.endsWith(".")||!C1.test(r))throw new Error(`invalid key: ${r}`)}function D1(r){if(r.startsWith(".")||r.endsWith(".")||!k1.test(r))throw new Error(`invalid key: ${r}`)}function z1(r){if(r.startsWith(".")||r.endsWith("."))throw new Error(`invalid key: ${r}`);const n=r.split(".");let s=!1;for(let a=0;a<n.length;a++)switch(n[a]){case"*":s=!0;break;case">":if(a!==n.length-1)throw new Error(`invalid key: ${r}`);s=!0;break}return s}function Ao(r){if(!M1.test(r))throw new Error(`invalid bucket name: ${r}`)}var Ln;(function(r){r.MsgIdHdr="Nats-Msg-Id",r.ExpectedStreamHdr="Nats-Expected-Stream",r.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",r.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",r.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})(Ln||(Ln={}));class Ha{constructor(n,s,a){v(this,"js");v(this,"jsm");v(this,"stream");v(this,"bucket");v(this,"direct");v(this,"codec");v(this,"prefix");v(this,"editPrefix");v(this,"useJsPrefix");v(this,"_prefixLen");v(this,"validateKey",R1);v(this,"validateSearchKey",D1);v(this,"hasWildcards",z1);Ao(n),this.js=s,this.jsm=a,this.bucket=n,this.prefix=M0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(n,s,a={}){Ao(s);const o=await n.jetstreamManager(),f=new Ha(s,n,o);return await f.init(a),f}static async bind(n,s,a={}){const o=await n.jetstreamManager(),f={config:{allow_direct:a.allow_direct}};Ao(s);const h=new Ha(s,n,o);return f.config.name=a.streamName??h.bucketName(),Object.assign(h,f),h.stream=f.config.name,h.codec=a.codec||kg(),h.direct=f.config.allow_direct??!1,h.initializePrefixes(f),h}async init(n={}){const s=Object.assign(N1(),n);this.codec=s.codec;const a={};this.stream=a.name=n.streamName??this.bucketName(),a.retention=kf.Limits,a.max_msgs_per_subject=s.history,s.maxBucketSize&&(s.max_bytes=s.maxBucketSize),s.max_bytes&&(a.max_bytes=s.max_bytes),a.max_msg_size=s.maxValueSize,a.storage=s.storage;const o=n.placementCluster??"";if(o&&(n.placement={},n.placement.cluster=o,n.placement.tags=[]),n.placement&&(a.placement=n.placement),n.republish&&(a.republish=n.republish),n.description&&(a.description=n.description),n.mirror){const w=Object.assign({},n.mirror);w.name.startsWith(Zt)||(w.name=`${Zt}${w.name}`),a.mirror=w,a.mirror_direct=!0}else if(n.sources){const w=n.sources.map(O=>{const q=Object.assign({},O),M=q.name.startsWith(Zt)?q.name.substring(Zt.length):q.name;return q.name.startsWith(Zt)||(q.name=`${Zt}${q.name}`),!O.external&&M!==this.bucket&&(q.subject_transforms=[{src:`$KV.${M}.>`,dest:`$KV.${this.bucket}.>`}]),q});a.sources=w,a.subjects=[this.subjectForBucket()]}else a.subjects=[this.subjectForBucket()];n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?Zs.S2:Zs.None);const f=this.js.nc,h=f.getServerVersion(),m=h?Df(h,Ai("2.7.2"))>=0:!1;a.discard=m?Ba.New:Ba.Old;const{ok:g,min:y}=f.features.get(Ue.JS_ALLOW_DIRECT);if(!g&&n.allow_direct===!0){const w=h?`${h.major}.${h.minor}.${h.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${w} - requires ${y}`))}n.allow_direct=typeof n.allow_direct=="boolean"?n.allow_direct:g,a.allow_direct=n.allow_direct,this.direct=a.allow_direct,a.num_replicas=s.replicas,s.ttl&&(a.max_age=nt(s.ttl)),a.allow_rollup_hdrs=!0;let E;try{E=await this.jsm.streams.info(a.name),!E.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(w){if(w.message==="stream not found")E=await this.jsm.streams.add(a);else throw w}this.initializePrefixes(E)}initializePrefixes(n){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:s}=n.config;if(s){let a=s.name;if(a.startsWith(Zt)&&(a=a.substring(Zt.length)),s.external&&s.external.api!==""){const o=s.name.substring(Zt.length);this.useJsPrefix=!1,this.prefix=`$KV.${o}`,this.editPrefix=`${s.external.api}.$KV.${a}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${Zt}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(n,s=!1){const a=[];return s?(this.useJsPrefix&&a.push(this.js.apiPrefix),this.editPrefix!==""?a.push(this.editPrefix):a.push(this.prefix)):this.prefix&&a.push(this.prefix),a.push(n),a.join(".")}fullKeyName(n){return this.prefix!==""?`${this.prefix}.${n}`:`${M0}.${this.bucket}.${n}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(n){const s=[];for(const a of n.split("."))switch(a){case">":case"*":s.push(a);break;default:s.push(this.codec.key.encode(a));break}return s.join(".")}decodeKey(n){const s=[];for(const a of n.split("."))switch(a){case">":case"*":s.push(a);break;default:s.push(this.codec.key.decode(a));break}return s.join(".")}close(){return Promise.resolve()}dataLen(n,s){const a=s&&s.get(Dt.MessageSizeHdr)||"";return a!==""?parseInt(a,10):n.length}smToEntry(n){return new X1(this.bucket,this.prefixLen,n)}jmToEntry(n){const s=this.decodeKey(n.subject.substring(this.prefixLen));return new K1(this.bucket,s,n)}async create(n,s){var f;let a;try{const h=await this.put(n,s,{previousSeq:0});return Promise.resolve(h)}catch(h){if(a=h,((f=h==null?void 0:h.api_error)==null?void 0:f.err_code)!==10071)return Promise.reject(h)}let o=0;try{const h=await this.get(n);return(h==null?void 0:h.operation)==="DEL"||(h==null?void 0:h.operation)==="PURGE"?(o=h!==null?h.revision:0,this.update(n,s,o)):Promise.reject(a)}catch(h){return Promise.reject(h)}}update(n,s,a){if(a<=0)throw new Error("version must be greater than 0");return this.put(n,s,{previousSeq:a})}async put(n,s,a={}){var h,m;const o=this.encodeKey(n);this.validateKey(o);const f={};if(a.previousSeq!==void 0){const g=hs();f.headers=g,g.set(Ln.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(o,!0),s,f)).seq}catch(g){const y=g;return y.isJetStreamError()?(y.message=(h=y.api_error)==null?void 0:h.description,y.code=`${(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 h=this.smToEntry(f);return h.key!==a?null:h}catch(h){if(h.code===ie.JetStream404NoMessages)return null;throw h}}purge(n,s){return this._deleteOrPurge(n,"PURGE",s)}delete(n,s){return this._deleteOrPurge(n,"DEL",s)}async purgeDeletes(n=1800*1e3){const s=st(),a=[],o=await this.watch({key:">",initializedFn:()=>{s.resolve()}});(async()=>{for await(const g of o)(g.operation==="DEL"||g.operation==="PURGE")&&a.push(g)})().then(),await s,o.stop();const f=Date.now()-n,h=a.map(g=>{const y=this.subjectForKey(g.key);return g.created.getTime()>=f?this.jsm.streams.purge(this.stream,{filter:y,keep:1}):this.jsm.streams.purge(this.stream,{filter:y,keep:0})}),m=await Promise.all(h);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 h of o)f.push(this._doDeleteOrPurge(h,s)),f.length===100&&(await Promise.all(f),f.length=0);f.length>0&&await Promise.all(f)}async _doDeleteOrPurge(n,s,a){const o=this.encodeKey(n);this.validateKey(o);const f=hs();f.set(Bo,s),s==="PURGE"&&f.set(Dt.RollupHdr,Dt.RollupValueSubject),a!=null&&a.previousSeq&&f.set(Ln.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`),await this.js.publish(this.subjectForKey(o,!0),nn,{headers:f})}_buildCC(n,s,a={}){let f=(Array.isArray(n)?n:[n]).map(g=>{const y=this.encodeKey(g);return this.validateSearchKey(g),this.fullKeyName(y)}),h=ft.LastPerSubject;s===Tn.AllHistory&&(h=ft.All),s===Tn.UpdatesOnly&&(h=ft.New);let m;return f.length===1&&(m=f[0],f=void 0),Object.assign({deliver_policy:h,ack_policy:vt.None,filter_subjects:f,filter_subject:m,flow_control:!0,idle_heartbeat:nt(5*1e3)},a)}remove(n){return this.purge(n)}async history(n={}){const s=n.key??">",a=new _t,o={};o.headers_only=n.headers_only||!1;let f;f=()=>{a.stop()};let h=0;const m=this._buildCC(s,Tn.AllHistory,o),g=m.filter_subject,y=Is(m);y.bindStream(this.stream),y.orderedConsumer(),y.callback((w,O)=>{if(w){a.stop(w);return}if(O){const q=this.jmToEntry(O);a.push(q),a.received++,(f&&h>0&&a.received>=h||O.info.pending===0)&&(a.push(f),f=void 0)}});const E=await this.js.subscribe(g,y);if(f){const{info:{last:w}}=E,O=w.num_pending+w.delivered.consumer_seq;if(O===0||a.received>=O)try{f()}catch(q){a.stop(q)}finally{f=void 0}else h=O}return a._data=E,a.iterClosed.then(()=>{E.unsubscribe()}),E.closed.then(()=>{a.stop()}).catch(w=>{a.stop(w)}),a}canSetWatcherName(){const s=this.js.nc,{ok:a}=s.features.get(Ue.JS_NEW_CONSUMER_CREATE_API);return a}async watch(n={}){const s=n.key??">",a=new _t,o={};o.headers_only=n.headers_only||!1;let f=Tn.LastValue;n.include===Tn.AllHistory?f=Tn.AllHistory:n.include===Tn.UpdatesOnly&&(f=Tn.UpdatesOnly);const h=n.ignoreDeletes===!0;let m=n.initializedFn,g=0;const y=this._buildCC(s,f,o),E=y.filter_subject,w=Is(y);this.canSetWatcherName()&&w.consumerName(Ks.next()),w.bindStream(this.stream),n.resumeFromRevision&&n.resumeFromRevision>0&&w.startSequence(n.resumeFromRevision),w.orderedConsumer(),w.callback((q,M)=>{if(q){a.stop(q);return}if(M){const D=this.jmToEntry(M);if(h&&D.operation==="DEL")return;a.push(D),a.received++,m&&(g>0&&a.received>=g||M.info.pending===0)&&(a.push(m),m=void 0)}});const O=await this.js.subscribe(E,w);if(m){const{info:{last:q}}=O,M=q.num_pending+q.delivered.consumer_seq;if(M===0||a.received>=M)try{m()}catch(D){a.stop(D)}finally{m=void 0}else g=M}return a._data=O,a.iterClosed.then(()=>{O.unsubscribe()}),O.closed.then(()=>{a.stop()}).catch(q=>{a.stop(q)}),a}async keys(n=">"){const s=new _t,a=this._buildCC(n,Tn.LastValue,{headers_only:!0}),o=Array.isArray(n)?">":a.filter_subject,f=Is(a);f.bindStream(this.stream),f.orderedConsumer();const h=await this.js.subscribe(o,f);return(async()=>{var g;for await(const y of h){const E=(g=y.headers)==null?void 0:g.get(Bo);if(E!=="DEL"&&E!=="PURGE"){const w=this.decodeKey(y.subject.substring(this.prefixLen));s.push(w)}y.info.pending===0&&h.unsubscribe()}})().then(()=>{s.stop()}).catch(g=>{s.stop(g)}),h.info.last.num_pending===0&&h.unsubscribe(),s}purgeBucket(n){return this.jsm.streams.purge(this.bucketName(),n)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var f;const s=((f=this.js.nc.info)==null?void 0:f.cluster)??"",a=this.bucketName(),o=await this.jsm.streams.info(a);return new Mg(o,s)}}class Mg{constructor(n,s=""){v(this,"si");v(this,"cluster");this.si=n,this.cluster=s}get bucket(){return this.si.config.name.startsWith(Zt)?this.si.config.name.substring(Zt.length):this.si.config.name}get values(){return this.si.state.messages}get history(){return this.si.config.max_msgs_per_subject}get ttl(){return th(this.si.config.max_age)}get bucket_location(){return this.cluster}get backingStore(){return this.si.config.storage}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get description(){return this.si.config.description??""}get maxBucketSize(){return this.si.config.max_bytes}get maxValueSize(){return this.si.config.max_msg_size}get max_bytes(){return this.si.config.max_bytes}get placement(){return this.si.config.placement||{cluster:"",tags:[]}}get placementCluster(){var n;return((n=this.si.config.placement)==null?void 0:n.cluster)??""}get republish(){return this.si.config.republish??{src:"",dest:""}}get streamInfo(){return this.si}get size(){return this.si.state.bytes}get metadata(){return this.si.config.metadata??{}}get compression(){return this.si.config.compression?this.si.config.compression!==Zs.None:!1}}const ih="OBJ_",R0="SHA-256=";function q1(r){return Ao(r),`${ih}${r}`}function U1(r){return r.startsWith(ih)?r.substring(4):r}class Bf{constructor(n){v(this,"si");v(this,"backingStore");this.si=n,this.backingStore="JetStream"}get bucket(){return U1(this.si.config.name)}get description(){return this.si.config.description??""}get ttl(){return this.si.config.max_age}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get sealed(){return this.si.config.sealed}get size(){return this.si.state.bytes}get streamInfo(){return this.si}get metadata(){return this.si.config.metadata}get compression(){return this.si.config.compression?this.si.config.compression!==Zs.None:!1}}function bo(r){if(r===void 0)return;const{domain:n}=r;if(n===void 0)return r;const s=Object.assign({},r);if(delete s.domain,n==="")return s;if(s.external)throw new Error("domain and external are both set");return s.external={api:`$JS.${n}.API`},s}var bn;(function(r){r[r.Unset=-1]="Unset",r[r.Consume=0]="Consume",r[r.Fetch=1]="Fetch"})(bn||(bn={}));var Hn;(function(r){r.HeartbeatsMissed="heartbeats_missed",r.ConsumerNotFound="consumer_not_found",r.StreamNotFound="stream_not_found",r.ConsumerDeleted="consumer_deleted",r.OrderedConsumerRecreated="ordered_consumer_recreated",r.NoResponders="no_responders"})(Hn||(Hn={}));var Er;(function(r){r.DebugEvent="debug",r.Discard="discard",r.Reset="reset",r.Next="next"})(Er||(Er={}));const D0=Uint8Array.of(43,65,67,75),B1=Uint8Array.of(45,78,65,75),ja=Uint8Array.of(43,87,80,73),L1=Uint8Array.of(43,78,88,84),H1=Uint8Array.of(43,84,69,82,77),P1=Uint8Array.of(32);function Pa(r,n=5e3){return new i_(r,n)}class gf extends _t{constructor(s,a,o=!1){super();v(this,"consumer");v(this,"opts");v(this,"sub");v(this,"monitor");v(this,"pending");v(this,"inbox");v(this,"refilling");v(this,"pong");v(this,"callback");v(this,"timeout");v(this,"cleanupHandler");v(this,"listeners");v(this,"statusIterator");v(this,"forOrderedConsumer");v(this,"resetHandler");v(this,"abortOnMissingResource");v(this,"bind");v(this,"inBackOff");this.consumer=s;const f=a;this.opts=this.parseOptions(a,o),this.callback=f.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=o,this.timeout=null,this.inbox=fs(s.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=f.abort_on_missing_resource===!0,this.bind=f.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:s,max_bytes:a,idle_heartbeat:o,threshold_bytes:f,threshold_messages:h}=this.opts;this.closed().then(g=>{if(this.cleanupHandler)try{this.cleanupHandler(g)}catch{}});const{sub:m}=this;m&&m.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(g,y)=>{var w,O,q,M;if(g){this.stop(g);return}if((w=this.monitor)==null||w.work(),y.subject===this.inbox){if(Cf(y))return;const D=(O=y.headers)==null?void 0:O.code,W=((M=(q=y.headers)==null?void 0:q.description)==null?void 0:M.toLowerCase())||"unknown",{msgsLeft:se,bytesLeft:ee}=this.parseDiscard(y.headers);if(se>0||ee>0)this.pending.msgs-=se,this.pending.bytes-=ee,this.pending.requests--,this.notify(Er.Discard,{msgsLeft:se,bytesLeft:ee});else if(D===400){this.stop(new ue(W,`${D}`));return}else if(D===409&&W==="consumer deleted"){if(this.notify(Hn.ConsumerDeleted,`${D} ${W}`),!this.refilling||this.abortOnMissingResource){const me=new ue(W,`${D}`);this.stop(me);return}}else if(D===503){if(this.notify(Hn.NoResponders,`${D} No Responders`),!this.refilling||this.abortOnMissingResource){const me=new ue("no responders",`${D}`);this.stop(me);return}}else this.notify(Er.DebugEvent,`${D} ${W}`)}else this._push(Pa(y,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=y.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(s&&this.pending.msgs<=h||a&&this.pending.bytes<=f){const D=this.pullOptions();this.pull(D)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),o&&(this.monitor=new sh(o,g=>(this.notify(Hn.HeartbeatsMissed,g),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var y;const g=this.consumer.api.nc.status();this.statusIterator=g;for await(const E of g)switch(E.type){case us.Disconnect:(y=this.monitor)==null||y.cancel();break;case us.Reconnect:this.resetPending().then(w=>{var O;w&&((O=this.monitor)==null||O.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(s){if(!this.callback)super.push(s);else{const a=typeof s=="function"?s:null;try{a?a():this.callback(s)}catch(o){this.stop(o)}}}notify(s,a){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.push({type:s,data:a})})}resetPending(){return this.bind?this.resetPendingNoInfo():this.resetPendingWithInfo()}resetPendingNoInfo(){return this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),Promise.resolve(!0)}async resetPendingWithInfo(){if(this.inBackOff)return!1;let s=0,a=0;const o=eh([this.opts.expires]);let f=0;for(;;){if(this.done)return!1;if(this.consumer.api.nc.isClosed())return console.error("aborting resetPending - connection is closed"),!1;try{return await this.consumer.info(),this.inBackOff=!1,s=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(h){if(h.message==="stream not found"){if(a++,this.notify(Hn.StreamNotFound,a),!this.refilling||this.abortOnMissingResource)return this.stop(h),!1}else if(h.message==="consumer not found"){if(s++,this.notify(Hn.ConsumerNotFound,s),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(h),!1;if(this.forOrderedConsumer)return!1}else s=0,a=0;this.inBackOff=!0;const m=o.backoff(f),g=Tr(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(Er.Next,s)})}pullOptions(){const s=this.opts.max_messages-this.pending.msgs,a=this.opts.max_bytes-this.pending.bytes,o=nt(this.opts.idle_heartbeat),f=nt(this.opts.expires);return{batch:s,max_bytes:a,idle_heartbeat:o,expires:f}}parseDiscard(s){const a={msgsLeft:0,bytesLeft:0},o=s==null?void 0:s.get(Dt.PendingMessagesHdr);o&&(a.msgsLeft=parseInt(o));const f=s==null?void 0:s.get(Dt.PendingBytesHdr);return f&&(a.bytesLeft=parseInt(f)),a}trackTimeout(s){this.timeout=s}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var s,a;(s=this.monitor)==null||s.cancel(),this.monitor=null,(a=this.timeout)==null||a.cancel(),this.timeout=null}setCleanupHandler(s){this.cleanupHandler=s}stop(s){var a,o;this.done||((a=this.sub)==null||a.unsubscribe(),this.clearTimers(),(o=this.statusIterator)==null||o.stop(),this._push(()=>{super.stop(s),this.listeners.forEach(f=>{f.stop()})}))}parseOptions(s,a=!1){const o=s||{};if(o.max_messages=o.max_messages||0,o.max_bytes=o.max_bytes||0,o.max_messages!==0&&o.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(o.max_messages===0&&(o.max_messages=100),o.expires=o.expires||3e4,o.expires<1e3)throw new Error("expires should be at least 1000ms");if(o.idle_heartbeat=o.idle_heartbeat||o.expires/2,o.idle_heartbeat=o.idle_heartbeat>3e4?3e4:o.idle_heartbeat,a){const f=Math.round(o.max_messages*.75)||1;o.threshold_messages=o.threshold_messages||f;const h=Math.round(o.max_bytes*.75)||1;o.threshold_bytes=o.threshold_bytes||h}return o}status(){const s=new _t;return this.listeners.push(s),Promise.resolve(s)}}class $1 extends _t{constructor(){super();v(this,"src");v(this,"listeners");this.listeners=[]}setSource(s){this.src&&(this.src.resetHandler=void 0,this.src.setCleanupHandler(),this.src.stop()),this.src=s,this.src.setCleanupHandler(a=>{this.stop(a||void 0)}),(async()=>{const a=await this.src.status();for await(const o of a)this.notify(o.type,o.data)})().catch(()=>{})}notify(s,a){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.push({type:s,data:a})})}stop(s){var a;this.done||((a=this.src)==null||a.stop(s),super.stop(s),this.listeners.forEach(o=>{o.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const s=new _t;return this.listeners.push(s),Promise.resolve(s)}}class Lf{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 gf(this,n,!0))}fetch(n={max_messages:100,expires:3e4}){const s=new gf(this,n,!1),a=Math.round(s.opts.expires*1.05),o=Ar(a);return s.closed().catch(()=>{}).finally(()=>{o.cancel()}),o.catch(()=>{s.close().catch()}),s.trackTimeout(o),Promise.resolve(s)}next(n={expires:3e4}){const s=st(),a=n;a.max_messages=1;const o=new gf(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===Hn.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 h=Ar(f);return o.closed().then(m=>{m?s.reject(m):s.resolve(null)}).catch(m=>{s.reject(m)}).finally(()=>{h.cancel()}),h.catch(m=>{s.resolve(null),o.close().catch()}),o.trackTimeout(h),s}delete(){const{stream_name:n,name:s}=this._info;return this.api.delete(n,s)}info(n=!1){if(n)return Promise.resolve(this._info);const{stream_name:s,name:a}=this._info;return this.api.info(s,a).then(o=>(this._info=o,this._info))}}class Y1{constructor(n,s,a={}){v(this,"api");v(this,"consumerOpts");v(this,"consumer");v(this,"opts");v(this,"cursor");v(this,"stream");v(this,"namePrefix");v(this,"serial");v(this,"currentConsumer");v(this,"userCallback");v(this,"iter");v(this,"type");v(this,"startSeq");v(this,"maxInitialReset");this.api=n,this.stream=s,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=Ks.next(),typeof a.name_prefix=="string"&&(Go("name_prefix",a.name_prefix),this.namePrefix=a.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=bn.Unset,this.consumerOpts=a,this.maxInitialReset=30,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(n){this.serial++;const s=`${this.namePrefix}_${this.serial}`;n=n===0?1:n;const a={name:s,deliver_policy:ft.StartSequence,opt_start_seq:n,ack_policy:vt.None,inactive_threshold:nt(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(a.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(a.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(a.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(a.replay_policy=this.consumerOpts.replay_policy),n===this.startSeq+1&&(a.deliver_policy=this.consumerOpts.deliver_policy||ft.StartSequence,(this.consumerOpts.deliver_policy===ft.LastPerSubject||this.consumerOpts.deliver_policy===ft.New||this.consumerOpts.deliver_policy===ft.Last)&&(delete a.opt_start_seq,a.deliver_policy=this.consumerOpts.deliver_policy),a.deliver_policy===ft.LastPerSubject&&typeof a.filter_subjects>"u"&&typeof a.filter_subject>"u"&&(a.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete a.opt_start_seq,a.deliver_policy=ft.StartTime,a.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(a.inactive_threshold=nt(this.consumerOpts.inactive_threshold))),a}async resetConsumer(n=0){var h,m,g,y,E;Ks.next();const s=this.serial===0;(h=this.consumer)==null||h.delete().catch(()=>{}),n=n===0?1:n,this.cursor.deliver_seq=0;const a=this.getConsumerOpts(n);a.max_deliver=1,a.mem_storage=!0;const o=eh([((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(Hn.OrderedConsumerRecreated,f.name);break}catch(O){if(O.message==="stream not found"&&((y=this.iter)==null||y.notify(Hn.StreamNotFound,w),this.type===bn.Fetch||this.opts.abort_on_missing_resource===!0))return(E=this.iter)==null||E.stop(O),Promise.reject(O);if(s&&w>=this.maxInitialReset)throw O;await Tr(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===bn.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 $1),this.consumer=new Lf(this.api,this.currentConsumer);const f=n;f.callback=this.internalHandler(this.serial);let h=null;this.type===bn.Fetch&&a?h=await this.consumer.fetch(n):this.type===bn.Consume&&(h=await this.consumer.consume(n));const m=h;m.forOrderedConsumer=!0,m.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(m)}notifyOrderedResetAndReset(){var n;(n=this.iter)==null||n.notify(Er.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===bn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===bn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:a}=n;return a&&(this.userCallback=a),this.type=bn.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===bn.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=bn.Fetch,this.opts=n,await this.reset(n,{fromFetch:!0}),this.iter}async next(n={expires:3e4}){const s=n;if(s.bind)return Promise.reject(new Error("bind is not supported"));s.max_messages=1;const a=st();return s.callback=f=>{this.userCallback=null,a.resolve(f)},(await this.fetch(s)).iterClosed.then(f=>{f&&a.reject(f),a.resolve(null)}).catch(f=>{a.reject(f)}),a}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(n=>Promise.resolve(n)).catch(n=>Promise.reject(n)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(n){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):n&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class Hf{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 Lf(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 Lf(this.api,a)).catch(a=>Promise.reject(a)))}async ordered(n,s){await this.checkVersion();const a=this.api;return new rh(a.nc,a.opts).info(n).then(f=>Promise.resolve(new Y1(this.api,n,s))).catch(f=>Promise.reject(f))}}class Fo{constructor(n,s){v(this,"api");v(this,"_info");this.api=n,this._info=s}get name(){return this._info.config.name}alternates(){return this.info().then(n=>n.alternates?n.alternates:[])}async best(){if(await this.info(),this._info.alternates){const n=await this.api.info(this._info.alternates[0].name);return new Fo(this.api,n)}else return this}info(n=!1,s){return n?Promise.resolve(this._info):this.api.info(this.name,s).then(a=>(this._info=a,this._info))}getConsumerFromInfo(n){return new Hf(new zo(this.api.nc,this.api.opts)).getPullConsumerFor(n)}getConsumer(n){return new Hf(new zo(this.api.nc,this.api.opts)).get(this.name,n)}getMessage(n){return this.api.getMessage(this.name,n)}deleteMessage(n,s){return this.api.deleteMessage(this.name,n,s)}}class rh extends Ya{constructor(n,s){super(n,s)}checkStreamConfigVersions(n){const s=this.nc;if(n.metadata){const{min:o,ok:f}=s.features.get(Ue.JS_STREAM_CONSUMER_METADATA);if(!f)throw new Error(`stream 'metadata' requires server ${o}`)}if(n.first_seq){const{min:o,ok:f}=s.features.get(Ue.JS_STREAM_FIRST_SEQ);if(!f)throw new Error(`stream 'first_seq' requires server ${o}`)}if(n.subject_transform){const{min:o,ok:f}=s.features.get(Ue.JS_STREAM_SUBJECT_TRANSFORM);if(!f)throw new Error(`stream 'subject_transform' requires server ${o}`)}if(n.compression){const{min:o,ok:f}=s.features.get(Ue.JS_STREAM_COMPRESSION);if(!f)throw new Error(`stream 'compression' requires server ${o}`)}if(n.consumer_limits){const{min:o,ok:f}=s.features.get(Ue.JS_DEFAULT_CONSUMER_LIMITS);if(!f)throw new Error(`stream 'consumer_limits' requires server ${o}`)}function a(o,f){var 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),Mt(n.name),n.mirror=bo(n.mirror),n.sources=(o=n.sources)==null?void 0:o.map(bo);const a=await this._request(`${this.prefix}.STREAM.CREATE.${n.name}`,n);return this._fixInfo(a),a}async delete(n){return Mt(n),(await this._request(`${this.prefix}.STREAM.DELETE.${n}`)).success}async update(n,s={}){var 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),Mt(n);const a=await this.info(n),o=Object.assign(a.config,s);o.mirror=bo(o.mirror),o.sources=(m=o.sources)==null?void 0:m.map(bo);const h=await this._request(`${this.prefix}.STREAM.UPDATE.${n}`,o);return this._fixInfo(h),h}async info(n,s){Mt(n);const a=`${this.prefix}.STREAM.INFO.${n}`;let f=await this._request(a,s),{total:h,limit:m}=f,g=f.state.subjects?Object.getOwnPropertyNames(f.state.subjects).length:1;if(h&&h>g){const y=[f],E=s||{};let w=0;for(;h>g;){w++,E.offset=m*w;const q=await this._request(a,E);h=q.total,y.push(q);const M=Object.getOwnPropertyNames(q.state.subjects).length;if(g+=M,M<m)break}let O={};for(let q=0;q<y.length;q++)f=y[q],f.state.subjects&&(O=Object.assign(O,f.state.subjects));f.offset=0,f.total=0,f.limit=0,f.state.subjects=O}return this._fixInfo(f),f}list(n=""){const s=n!=null&&n.length?{subject:n}:{},a=f=>{const h=f;return h.streams.forEach(m=>{this._fixInfo(m)}),h.streams},o=`${this.prefix}.STREAM.LIST`;return new ka(o,a,this,s)}_fixInfo(n){n.config.sealed=n.config.sealed||!1,n.config.deny_delete=n.config.deny_delete||!1,n.config.deny_purge=n.config.deny_purge||!1,n.config.allow_rollup_hdrs=n.config.allow_rollup_hdrs||!1}async purge(n,s){if(s){const{keep:o,seq:f}=s;if(typeof o=="number"&&typeof f=="number")throw new Error("can specify one of keep or seq")}return Mt(n),await this._request(`${this.prefix}.STREAM.PURGE.${n}`,s)}async deleteMessage(n,s,a=!0){Mt(n);const o={seq:s};return a||(o.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${n}`,o)).success}async getMessage(n,s){Mt(n);const o=await this._request(`${this.prefix}.STREAM.MSG.GET.${n}`,s);return new Rg(o)}find(n){return this.findStream(n)}listKvs(){const n=a=>{var g;const f=a.streams.filter(y=>y.config.name.startsWith(Zt));f.forEach(y=>{this._fixInfo(y)});let h="";return f.length&&(h=((g=this.nc.info)==null?void 0:g.cluster)??""),f.map(y=>new Mg(y,h))},s=`${this.prefix}.STREAM.LIST`;return new ka(s,n,this)}listObjectStores(){const n=a=>{const f=a.streams.filter(m=>m.config.name.startsWith(ih));return f.forEach(m=>{this._fixInfo(m)}),f.map(m=>new Bf(m))},s=`${this.prefix}.STREAM.LIST`;return new ka(s,n,this)}names(n=""){const s=n!=null&&n.length?{subject:n}:{},a=f=>f.streams,o=`${this.prefix}.STREAM.NAMES`;return new ka(o,a,this,s)}async get(n){const s=await this.info(n);return Promise.resolve(new Fo(this,s))}}class G1 extends Ya{constructor(n,s){super(n,s)}async getMessage(n,s){Mt(n);let a=s;const{last_by_subj:o}=a;o&&(a=null);const f=a?this.jc.encode(a):nn,h=this.opts.apiPrefix||"$JS.API",m=o?`${h}.DIRECT.GET.${n}.${o}`:`${h}.DIRECT.GET.${n}`,g=await this.nc.request(m,f,{timeout:this.timeout}),y=wr(g);if(y)return Promise.reject(y);const E=new Pf(g);return Promise.resolve(E)}async getBatch(n,s){Mt(n);const o=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${n}`;if(!Array.isArray(s.multi_last)||s.multi_last.length===0)return Promise.reject("multi_last is required");const f=JSON.stringify(s,(g,y)=>g==="up_to_time"&&y instanceof Date?y.toISOString():y),h=new _t,m=await this.nc.requestMany(o,f,{strategy:Cn.SentinelMsg});return(async()=>{var w,O,q;let g=!1,y=!1,E;for await(const M of m){if(!g){g=!0;const D=((w=M.headers)==null?void 0:w.code)||0;if(D!==0&&D<200||D>299){E=(O=M.headers)==null?void 0:O.description.toLowerCase();break}if(((q=M.headers)==null?void 0:q.get("Nats-Num-Pending"))===""){y=!0;break}}if(M.data.length===0)break;h.push(new Pf(M))}h.push(()=>{if(y)throw new Error("batch direct get not supported by the server");if(E)throw new Error(`bad request: ${E}`);h.stop()})})(),Promise.resolve(h)}}class Pf{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(br.Subject)}get seq(){const n=this.header.last(br.Sequence);return typeof n=="string"?parseInt(n):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(br.TimeStamp)}get stream(){return this.header.last(br.Stream)}json(n){return kn(n).decode(this.data)}string(){return en.decode(this.data)}}v(Pf,"jc");class V1 extends Ya{constructor(s,a){super(s,a);v(this,"streams");v(this,"consumers");v(this,"direct");this.streams=new rh(s,a),this.consumers=new zo(s,a),this.direct=new G1(s,a)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const s=new _t;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(a,o)=>{if(a)throw a;try{const f=this.parseJsResponse(o),h=f.type.split("."),m=h[h.length-1];s.push({kind:m,data:f})}catch(f){s.stop(f)}}}),s}}class Rg{constructor(n){v(this,"_header");v(this,"smr");this.smr=n}get subject(){return this.smr.message.subject}get seq(){return this.smr.message.seq}get timestamp(){return this.smr.message.time}get time(){return new Date(Date.parse(this.timestamp))}get data(){return this.smr.message.data?this._parse(this.smr.message.data):nn}get header(){if(!this._header)if(this.smr.message.hdrs){const n=this._parse(this.smr.message.hdrs);this._header=Qs.decode(n)}else this._header=hs();return this._header}_parse(n){const s=atob(n),a=s.length,o=new Uint8Array(a);for(let f=0;f<a;f++)o[f]=s.charCodeAt(f);return o}json(n){return kn(n).decode(this.data)}string(){return en.decode(this.data)}}v(Rg,"jc");class F1{constructor(n){v(this,"api");this.api=n}get(n){return this.api.info(n).then(s=>new Fo(this.api,s))}}class yf{constructor(n){v(this,"info");v(this,"hdrs");this.info=n}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=Qs.fromRecord(this.info.headers||{})),this.hdrs}get options(){return this.info.options}get bucket(){return this.info.bucket}get chunks(){return this.info.chunks}get deleted(){return this.info.deleted??!1}get digest(){return this.info.digest}get mtime(){return this.info.mtime}get nuid(){return this.info.nuid}get size(){return this.info.size}get revision(){return this.info.revision}get metadata(){return this.info.metadata||{}}isLink(){var n,s;return((n=this.info.options)==null?void 0:n.link)!==void 0&&((s=this.info.options)==null?void 0:s.link)!==null}}function z0(r){const n={name:r.name,description:r.description??"",options:r.options,metadata:r.metadata};if(r.headers){const s=r.headers;n.headers=s.toRecord()}return n}function J1(){return new ReadableStream({pull(r){r.enqueue(new Uint8Array(0)),r.close()}})}class qa{constructor(n,s,a){v(this,"jsm");v(this,"js");v(this,"stream");v(this,"name");this.name=n,this.jsm=s,this.js=a}_checkNotEmpty(n){return!n||n.length===0?{name:n,error:new Error("name cannot be empty")}:{name:n}}async info(n){const s=await this.rawInfo(n);return s?new yf(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=kn().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 Bf(n)))}async status(n){const s=await this._si(n);return s===null?Promise.reject(new Error("object store not found")):Promise.resolve(new Bf(s))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(n,s,a){var re;const o=this.js.getOptions();a=a||{timeout:o.timeout},a.timeout=a.timeout||o.timeout,a.previousRevision=a.previousRevision??void 0;const{timeout:f,previousRevision:h}=a,m=this.js.nc.info,g=(m==null?void 0:m.max_payload)||1024;n=n||{},n.options=n.options||{};let y=((re=n.options)==null?void 0:re.max_chunk_size)||128*1024;y=y>g?g:y,n.options.max_chunk_size=y;const E=await this.info(n.name),{name:w,error:O}=this._checkNotEmpty(n.name);if(O)return Promise.reject(O);const q=Ks.next(),M=this._chunkSubject(q),D=this._metaSubject(w),W=Object.assign({bucket:this.name,nuid:q,size:0,chunks:0},z0(n)),se=st(),ee=[],me=new Or;try{const C=s?s.getReader():null,X=E0.create();for(;;){const{done:ce,value:V}=C?await C.read():{done:!0,value:void 0};if(ce){if(me.size()>0){const ne=me.drain();X.update(ne),W.chunks++,W.size+=ne.length,ee.push(this.js.publish(M,ne,{timeout:f}))}await Promise.all(ee),ee.length=0,W.mtime=new Date().toISOString();const G=Sr.encode(X.digest());W.digest=`${R0}${G}`,W.deleted=!1;const K=hs();typeof h=="number"&&K.set(Ln.ExpectedLastSubjectSequenceHdr,`${h}`),K.set(Dt.RollupHdr,Dt.RollupValueSubject);const ae=await this.js.publish(D,kn().encode(W),{headers:K,timeout:f});if(W.revision=ae.seq,E)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${E.nuid}`})}catch{}se.resolve(new yf(W));break}if(V)for(me.fill(V);me.size()>y;){W.chunks++,W.size+=y;const G=me.drain(n.options.max_chunk_size);X.update(G),ee.push(this.js.publish(M,G,{timeout:f}))}}}catch(C){await this.jsm.streams.purge(this.stream,{filter:M}),se.reject(C)}return se}putBlob(n,s,a){function o(f){return new ReadableStream({pull(h){h.enqueue(f),h.close()}})}return s===null&&(s=new Uint8Array(0)),this.put(n,o(s),a)}put(n,s,a){var o;return(o=n==null?void 0:n.options)!=null&&o.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(n,s,a)}async getBlob(n){async function s(f){const h=new Or,m=f.getReader();for(;;){const{done:g,value:y}=await m.read();if(g)return h.drain();y&&y.length&&h.fill(y)}}const a=await this.get(n);if(a===null)return Promise.resolve(null);const o=await Promise.all([a.error,s(a.data)]);return o[0]?Promise.reject(o[0]):Promise.resolve(o[1])}async get(n){const s=await this.rawInfo(n);if(s===null||s.deleted)return Promise.resolve(null);if(s.options&&s.options.link){const w=s.options.link.name||"";if(w==="")throw new Error("link is a bucket");return(s.options.link.bucket!==this.name?await qa.create(this.js,s.options.link.bucket):this).get(w)}if(!s.digest.startsWith(R0))return Promise.reject(new Error(`unknown digest type: ${s.digest}`));const a=Rf(s.digest.substring(8));if(a===null)return Promise.reject(new Error(`unable to parse digest: ${s.digest}`));const o=st(),f={info:new yf(s),error:o};if(s.size===0)return f.data=J1(),o.resolve(null),Promise.resolve(f);let h;const m=Is();m.orderedConsumer();const g=E0.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),h.enqueue(w.data)),w.info.pending===0&&(zv(a,g.digest())?h.close():h.error(new Error(`received a corrupt object, digests do not match received: ${s.digest} calculated ${a}`)),E.unsubscribe())})().then(()=>{o.resolve()}).catch(w=>{h.error(w),o.reject(w)}),f.data=new ReadableStream({start(w){h=w},cancel(){E.unsubscribe()}}),f}linkStore(n,s){if(!(s instanceof qa))return Promise.reject("bucket required");const a=s,{name:o,error:f}=this._checkNotEmpty(n);if(f)return Promise.reject(f);const h={name:o,options:{link:{bucket:a.name}}};return this._put(h,null)}async link(n,s){const{name:a,error:o}=this._checkNotEmpty(n);if(o)return Promise.reject(o);if(s.deleted)return Promise.reject(new Error("src object is deleted"));if(s.isLink())return Promise.reject(new Error("src object is a link"));const f=await this.rawInfo(n);if(f!==null&&!f.deleted)return Promise.reject(new Error("an object already exists with that name"));const h={bucket:s.bucket,name:s.name},m={name:a,bucket:s.bucket,options:{link:h}};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=kn(),o=hs();return o.set(Dt.RollupHdr,Dt.RollupValueSubject),await this.js.publish(this._metaSubject(s.name),a.encode(s),{headers:o}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(s.nuid)})}async update(n,s={}){const a=await this.rawInfo(n);if(a===null)return Promise.reject(new Error("object not found"));if(a.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));s.name=s.name??a.name;const{name:o,error:f}=this._checkNotEmpty(s.name);if(f)return Promise.reject(f);if(n!==s.name){const g=await this.info(s.name);if(g&&!g.deleted)return Promise.reject(new Error("an object already exists with that name"))}s.name=o;const h=Object.assign({},a,z0(s)),m=await this.js.publish(this._metaSubject(h.name),JSON.stringify(h));return n!==s.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(n)}),Promise.resolve(m)}async watch(n={}){n.includeHistory=n.includeHistory??!1,n.ignoreDeletes=n.ignoreDeletes??!1;let s=!1;const a=new _t,o=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:o})}catch(g){g.code==="404"?(a.push(null),s=!0):a.stop(g)}const f=kn(),h=Is();h.orderedConsumer(),n.includeHistory?h.deliverLastPerSubject():(s=!0,h.deliverNew()),h.callback((g,y)=>{var E;if(g){a.stop(g);return}if(y!==null){const w=f.decode(y.data);w.deleted&&n.ignoreDeletes===!0||a.push(w),((E=y.info)==null?void 0:E.pending)===0&&!s&&(s=!0,a.push(null))}});const m=await this.js.subscribe(o,h);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.${Sr.encode(n)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(n={}){try{this.stream=q1(this.name)}catch(o){return Promise.reject(o)}const s=(n==null?void 0:n.ttl)||0;delete n.ttl;const a=Object.assign({max_age:s},n);a.name=this.stream,a.num_replicas=n.replicas??1,a.allow_direct=!0,a.allow_rollup_hdrs=!0,a.discard=Ba.New,a.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],n.placement&&(a.placement=n.placement),n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?Zs.S2:Zs.None);try{await this.jsm.streams.info(a.name)}catch(o){o.message==="stream not found"&&await this.jsm.streams.add(a)}}static async create(n,s,a={}){const o=await n.jetstreamManager(),f=new qa(s,o,n);return await f.init(a),Promise.resolve(f)}}class Q1{constructor(n){v(this,"js");this.js=n}kv(n,s={}){const a=this.js,{ok:o,min:f}=a.nc.features.get(Ue.JS_KV);return o?s.bindOnly?Ha.bind(this.js,n,s):Ha.create(this.js,n,s):Promise.reject(new Error(`kv is only supported on servers ${f} or better`))}os(n,s={}){var h;if(typeof((h=crypto==null?void 0:crypto.subtle)==null?void 0:h.digest)!="function")return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));const a=this.js,{ok:o,min:f}=a.nc.features.get(Ue.JS_OBJECTSTORE);return o?qa.create(this.js,n,s):Promise.reject(new Error(`objectstore is only supported on servers ${f} or better`))}}class ah extends Ya{constructor(s,a){super(s,a);v(this,"consumers");v(this,"streams");v(this,"consumerAPI");v(this,"streamAPI");this.consumerAPI=new zo(s,a),this.streamAPI=new rh(s,a),this.consumers=new Hf(this.consumerAPI),this.streams=new F1(this.streamAPI)}jetstreamManager(s){s===void 0&&(s=this.opts.checkAPI);const a=Object.assign({},this.opts,{checkAPI:s});return this.nc.jetstreamManager(a)}get apiPrefix(){return this.prefix}get views(){return new Q1(this)}async publish(s,a=nn,o){o=o||{},o.expect=o.expect||{};const f=(o==null?void 0:o.headers)||hs();o&&(o.msgID&&f.set(Ln.MsgIdHdr,o.msgID),o.expect.lastMsgID&&f.set(Ln.ExpectedLastMsgIdHdr,o.expect.lastMsgID),o.expect.streamName&&f.set(Ln.ExpectedStreamHdr,o.expect.streamName),typeof o.expect.lastSequence=="number"&&f.set(Ln.ExpectedLastSeqHdr,`${o.expect.lastSequence}`),typeof o.expect.lastSubjectSequence=="number"&&f.set(Ln.ExpectedLastSubjectSequenceHdr,`${o.expect.lastSubjectSequence}`));const h=o.timeout||this.timeout,m={};h&&(m.timeout=h),o&&(m.headers=f);let{retries:g,retry_delay:y}=o;g=g||1,y=y||250;let E;for(let O=0;O<g;O++)try{E=await this.nc.request(s,a,m);break}catch(q){if(q.code==="503"&&O+1<g)await Tr(y);else throw q}const w=this.parseJsResponse(E);if(w.stream==="")throw ue.errorForCode(ie.JetStreamInvalidAck);return w.duplicate=w.duplicate?w.duplicate:!1,w}async pull(s,a,o=0){Mt(s),_r(a);let f=this.timeout;o>f&&(f=o),o=o<0?0:nt(o);const h={batch:1,no_wait:o===0,expires:o},m=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${a}`,this.jc.encode(h),{noMux:!0,timeout:f}),g=wr(m);if(g)throw g;return Pa(m,this.timeout)}fetch(s,a,o={}){Mt(s),_r(a);let f=null;const h=(o.max_bytes??0)>0;let m=0;const g=h?o.max_bytes:0;let y=null;const E={};if(E.batch=o.batch||1,g){const ee=this.nc.features.get(Ue.JS_PULL_MAX_BYTES);if(!ee.ok)throw new Error(`max_bytes is only supported on servers ${ee.min} or better`);E.max_bytes=g}E.no_wait=o.no_wait||!1,E.no_wait&&E.expires&&(E.expires=0);const w=o.expires||0;if(w&&(E.expires=nt(w)),w===0&&E.no_wait===!1)throw new Error("expires or no_wait is required");const O=o.idle_heartbeat||0;O&&(E.idle_heartbeat=nt(O),o.delay_heartbeat===!0&&(E.idle_heartbeat=nt(O*4)));const q=new _t,M=E.batch;let D=0;q.protocolFilterFn=(ee,me=!1)=>Cf(ee.msg)?(y==null||y.work(),!1):!0,q.dispatchedFn=ee=>{if(ee){if(h&&(m+=ee.data.length),D++,f&&ee.info.pending===0)return;(q.getPending()===1&&ee.info.pending===0||M===D||g>0&&m>=g)&&q.stop()}};const W=fs(this.nc.options.inboxPrefix),se=this.nc.subscribe(W,{max:o.batch,callback:(ee,me)=>{ee===null&&(ee=wr(me)),ee!==null?(f&&(f.cancel(),f=null),gv(ee)?q.stop(zg(ee)===null?void 0:ee):q.stop(ee)):(y==null||y.work(),q.received++,q.push(Pa(me,this.timeout)))}});return w&&(f=Ar(w),f.catch(()=>{se.isClosed()||(se.drain().catch(()=>{}),f=null),y&&y.cancel()})),(async()=>{try{O&&(y=new sh(O,ee=>(q.push(()=>{q.err=new ue(`${xn.IdleHeartbeatMissed}: ${ee}`,ie.JetStreamIdleHeartBeat)}),!0)))}catch{}await se.closed,f!==null&&(f.cancel(),f=null),y&&y.cancel(),q.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${a}`,this.jc.encode(E),{reply:W}),q}async pullSubscribe(s,a=Is()){const o=await this._processOptions(s,a);if(o.ordered)throw new Error("pull subscribers cannot be be ordered");if(o.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const f=o.config.ack_policy;if(f===vt.None||f===vt.All)throw new Error("ack policy for pull consumers must be explicit");const h=this._buildTypedSubscriptionOpts(o),m=new Z1(this,o.deliver,h);m.info=o;try{await this._maybeCreateConsumer(o)}catch(g){throw m.unsubscribe(),g}return m}async subscribe(s,a=Is()){const o=await this._processOptions(s,a);if(!o.isBind&&!o.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const f=this._buildTypedSubscriptionOpts(o),h=new Dg(this,o.deliver,f);h.info=o;try{await this._maybeCreateConsumer(o)}catch(m){throw h.unsubscribe(),m}return h._maybeSetupHbMonitoring(),h}async _processOptions(s,a=Is()){const o=v0(a)?a.getOpts():a;if(o.isBind=v0(a)?a.isBind:!1,o.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},o.ordered){if(o.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},o.config.ack_policy!==vt.NotSet&&o.config.ack_policy!==vt.None)throw new ue("ordered consumer: ack_policy can only be set to 'none'",ie.ApiError);if(o.config.durable_name&&o.config.durable_name.length>0)throw new ue("ordered consumer: durable_name cannot be set",ie.ApiError);if(o.config.deliver_subject&&o.config.deliver_subject.length>0)throw new ue("ordered consumer: deliver_subject cannot be set",ie.ApiError);if(o.config.max_deliver!==void 0&&o.config.max_deliver>1)throw new ue("ordered consumer: max_deliver cannot be set",ie.ApiError);if(o.config.deliver_group&&o.config.deliver_group.length>0)throw new ue("ordered consumer: deliver_group cannot be set",ie.ApiError);o.config.deliver_subject=fs(this.nc.options.inboxPrefix),o.config.ack_policy=vt.None,o.config.max_deliver=1,o.config.flow_control=!0,o.config.idle_heartbeat=o.config.idle_heartbeat||nt(5e3),o.config.ack_wait=nt(1320*60*1e3),o.config.mem_storage=!0,o.config.num_replicas=1}if(o.config.ack_policy===vt.NotSet&&(o.config.ack_policy=vt.All),o.api=this,o.config=o.config||{},o.stream=o.stream?o.stream:await this.findStream(s),o.attached=!1,o.config.durable_name)try{const f=await this.consumerAPI.info(o.stream,o.config.durable_name);if(f){if(f.config.filter_subject&&f.config.filter_subject!==s)throw new Error("subject does not match consumer");const h=o.config.deliver_group??"";if(h===""&&f.push_bound===!0)throw new Error("duplicate subscription");const m=f.config.deliver_group??"";if(h!==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||fs(this.nc.options.inboxPrefix),o}_buildTypedSubscriptionOpts(s){const a={};return a.adapter=W1(s.callbackFn===void 0,this.timeout),a.ingestionFilterFn=ah.ingestionFn(s.ordered),a.protocolFilterFn=(o,f=!1)=>{const h=o;return Nf(h.msg)?(f||h.msg.respond(),!1):!0},!s.mack&&s.config.ack_policy!==vt.None&&(a.dispatchedFn=n_),s.callbackFn&&(a.callback=s.callbackFn),a.max=s.max||0,a.queue=s.queue,a}async _maybeCreateConsumer(s){if(s.attached)return;if(s.isBind)throw new Error(`unable to bind - durable consumer ${s.config.durable_name} doesn't exist in ${s.stream}`);s.config=Object.assign({deliver_policy:ft.All,ack_policy:vt.Explicit,ack_wait:nt(30*1e3),replay_policy:jr.Instant},s.config);const a=await this.consumerAPI.add(s.stream,s.config);if(Array.isArray(s.config.filter_subjects&&!Array.isArray(a.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");s.name=a.name,s.config=a.config,s.last=a}static ingestionFn(s){return(a,o)=>{var g;const f=o;if(!a)return{ingest:!1,protocol:!1};const h=a;if(wr(h.msg)||(g=f.monitor)==null||g.work(),Cf(h.msg)){const y=s?f._checkHbOrderConsumer(h.msg):!0;return s||f.info.flow_control.heartbeat_count++,{ingest:y,protocol:!0}}else if(Nf(h.msg))return f.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:s?f._checkOrderedConsumer(a):!0,protocol:!1}}}}class lh{constructor(n){v(this,"options");v(this,"protocol");v(this,"draining");v(this,"listeners");v(this,"_services");this.draining=!1,this.options=y1(n),this.listeners=[]}static connect(n={}){return new Promise((s,a)=>{const o=new lh(n);Uo.connect(o.options,o).then(f=>{o.protocol=f,(async function(){for await(const h of f.status())o.listeners.forEach(m=>{m.push(h)})})(),s(o)}).catch(f=>{a(f)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(n,s,a){if(this.isClosed())throw ue.errorForCode(ie.ConnectionClosed);if(s&&this.isDraining()||a&&this.protocol.noMorePublishing)throw ue.errorForCode(ie.ConnectionDraining);if(n=n||"",n.length===0)throw ue.errorForCode(ie.BadSubject)}publish(n,s,a){this._check(n,!1,!0),this.protocol.publish(n,s,a)}publishMessage(n){return this.publish(n.subject,n.data,{reply:n.reply,headers:n.headers})}respondMessage(n){return n.reply?(this.publish(n.reply,n.data,{reply:n.reply,headers:n.headers}),!0):!1}subscribe(n,s={}){this._check(n,!0,!1);const a=new Cg(this.protocol,n,s);return this.protocol.subscribe(a),a}_resub(n,s,a){this._check(s,!0,!1);const o=n;o.max=a,a&&(o.max=a+o.received),this.protocol.resub(o,s)}requestMany(n,s=nn,a={maxWait:1e3,maxMessages:-1}){const o=!this.protocol.options.noAsyncTraces;try{this._check(n,!0,!0)}catch(g){return Promise.reject(g)}if(a.strategy=a.strategy||Cn.Timer,a.maxWait=a.maxWait||1e3,a.maxWait<1)return Promise.reject(new ue("timeout",ie.InvalidOption));const f=new _t;function h(g){f.push(()=>{f.stop(g)})}function m(g,y){g||y===null?h(g===null?void 0:g):f.push(y)}if(a.noMux){const g=o?new Error().stack:null;let y=typeof a.maxMessages=="number"&&a.maxMessages>0?a.maxMessages:-1;const E=this.subscribe(fs(this.options.inboxPrefix),{callback:(M,D)=>{var W,se;if(((W=D==null?void 0:D.data)==null?void 0:W.length)===0&&((se=D==null?void 0:D.headers)==null?void 0:se.status)===ie.NoResponders&&(M=ue.errorForCode(ie.NoResponders)),M){g&&(M.stack+=`
|
|
47
|
+
`),n.max=s)}resub(n,s){!n||this.isClosed()||(this.unsub(n),n.subject=s,this.subscriptions.resub(n),this._sub(n))}flush(n){return n||(n=st()),this.pongs.push(n),this.outbound.fill(k0),this.flushPending(),n}sendSubscriptions(){const n=[];this.subscriptions.all().forEach(s=>{const a=s;a.queue?n.push(`SUB ${a.subject} ${a.queue} ${a.sid}${Eo}`):n.push(`SUB ${a.subject} ${a.sid}${Eo}`)}),n.length&&this.transport.send(Da(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 kg(this,`${s}*`);a.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(a),this.subscribe(a)}}selectServer(){const n=this.servers.selectServer();if(n!==void 0)return this.server=n,this.server}getServer(){return this.server}}const A1="$SRV";class M0{constructor(n){v(this,"msg");this.msg=n}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(n,s){return this.msg.respond(n,s)}respondError(n,s,a,o){var f,h;return o=o||{},o.headers=o.headers||hs(),(f=o.headers)==null||f.set(Mo,`${n}`),(h=o.headers)==null||h.set(ko,s),this.msg.respond(a,o)}json(n){return this.msg.json(n)}string(){return this.msg.string()}}class Ha{constructor(n,s="",a=""){v(this,"subject");v(this,"queue");v(this,"srv");s!==""&&O1("service group",s);let o="";if(n instanceof Va)this.srv=n,o="";else if(n instanceof Ha){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;ka("endpoint",n);let{subject:o,handler:f,metadata:h,queue:m}=a;o=o||n,m=m||this.queue,j1("endpoint subject",o),o=this.calcSubject(this.subject,o);const g={name:n,subject:o,queue:m,handler:f,metadata:h};return this.srv._addEndpoint(g)}addGroup(n="",s=""){return new Ha(this,n,s)}}function j1(r,n){if(n==="")throw new Error(`${r} cannot be empty`);if(n.indexOf(" ")!==-1)throw new Error(`${r} cannot contain spaces: '${n}'`);const s=n.split(".");s.forEach((a,o)=>{if(a===">"&&o!==s.length-1)throw new Error(`${r} cannot have internal '>': '${n}'`)})}function O1(r,n){if(n.indexOf(" ")!==-1)throw new Error(`${r} cannot contain spaces: '${n}'`);n.split(".").forEach(a=>{if(a===">")throw new Error(`${r} name cannot contain internal '>': '${n}'`)})}class Va{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"),ka("name",this.config.name),ka("queue",this.config.queue),ji(this.config.version),this._id=Zs.next(),this.internal=[],this._done=st(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(a=>{this.close(a).catch()})}static controlSubject(n,s="",a="",o){const f=o??A1;return s===""&&a===""?`${f}.${n}`:(ka("control subject name",s),a!==""?(ka("control subject id",a),`${f}.${n}.${s}.${a}`):`${f}.${n}.${s}`)}get subjects(){return this.handlers.filter(n=>n.internal===!1).map(n=>n.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(n){const s=hs();if(n instanceof Ro){const a=n;s.set(ko,a.message),s.set(Mo,`${a.code}`)}else s.set(ko,n.message),s.set(Mo,"500");return s}setupHandler(n,s=!1){const a=s?"":n.queue?n.queue:this.config.queue,{name:o,subject:f,handler:h}=n,m=n;m.internal=s,s&&this.internal.push(m),m.stats=new T1(o,f,a),m.queue=a;const g=h?(y,E)=>{if(y){this.close(y);return}const w=Date.now();try{h(y,new M0(E))}catch(T){m.stats.countError(T),E==null||E.respond(nn,{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:za.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:za.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:n}}addInternalHandler(n,s){const a=`${n}`.toUpperCase();this._doAddInternalHandler(`${a}-all`,n,s),this._doAddInternalHandler(`${a}-kind`,n,s,this.name),this._doAddInternalHandler(`${a}`,n,s,this.name,this.id)}_doAddInternalHandler(n,s,a,o="",f=""){const h={};h.name=n,h.subject=Va.controlSubject(s,o,f),h.handler=a,this.setupHandler(h,!0)}start(){const n=Mn(),s=(h,m)=>h?(this.close(h),Promise.reject(h)):this.stats().then(g=>(m==null||m.respond(n.encode(g)),Promise.resolve())),a=(h,m)=>h?(this.close(h),Promise.reject(h)):(m==null||m.respond(n.encode(this.info())),Promise.resolve()),o=n.encode(this.ping()),f=(h,m)=>h?(this.close(h).then().catch(),Promise.reject(h)):(m.respond(o),Promise.resolve());return this.addInternalHandler(Js.PING,f),this.addInternalHandler(Js.STATS,s),this.addInternalHandler(Js.INFO,a),this.handlers.forEach(h=>{const{subject:m}=h;typeof m=="string"&&h.handler!==null&&this.setupHandler(h)}),Promise.resolve(this)}close(n){if(this._stopped)return this._done;this._stopped=!0;let s=[];return this.nc.isClosed()||(s=this.handlers.concat(this.internal).map(a=>a.sub.drain())),Promise.allSettled(s).then(()=>{this._done.resolve(n||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(n){return this.close(n)}ping(){return{type:za.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 Ha(this,n,s)}addEndpoint(n,s){return new Ha(this).addEndpoint(n,s)}_addEndpoint(n){const s=new _t;s.noIterator=typeof n.handler=="function",s.noIterator||(n.handler=(o,f)=>{o?this.stop(o).catch():s.push(new M0(f))},s.iterClosed.then(()=>{this.close().catch()}));const a=this.setupHandler(n,!1);return a.qi=s,this.handlers.push(a),s}}class T1{constructor(n,s,a=""){v(this,"name");v(this,"subject");v(this,"average_processing_time");v(this,"num_requests");v(this,"processing_time");v(this,"num_errors");v(this,"last_error");v(this,"data");v(this,"metadata");v(this,"queue");this.name=n,this.subject=s,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=a}reset(n){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const s=n;s&&(s.time=0,s.processed=0)}countLatency(n){this.num_requests++,this.processing_time+=nt(Date.now()-n),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(n){this.num_errors++,this.last_error=n.message}_stats(){const{name:n,subject:s,average_processing_time:a,num_errors:o,num_requests:f,processing_time:h,last_error:m,data:g,queue:y}=this;return{name:n,subject:s,average_processing_time:a,num_errors:o,num_requests:f,processing_time:h,last_error:m,data:g,queue_group:y}}stats(n){const s=n;return(s==null?void 0:s.noIterator)===!1&&(this.processing_time=nt(s.time),this.num_requests=s.processed,this.average_processing_time=this.processing_time>0&&this.num_requests>0?this.processing_time/this.num_requests:0),this._stats()}}class N1{constructor(n,s={strategy:kn.JitterTimer,maxWait:2e3},a){v(this,"nc");v(this,"prefix");v(this,"opts");this.nc=n,this.prefix=a,this.opts=s}ping(n="",s=""){return this.q(Js.PING,n,s)}stats(n="",s=""){return this.q(Js.STATS,n,s)}info(n="",s=""){return this.q(Js.INFO,n,s)}async q(n,s="",a=""){const o=new _t,f=Mn(),h=Va.controlSubject(n,s,a,this.prefix),m=await this.nc.requestMany(h,nn,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 Mg(){return{key:{encode(r){return r},decode(r){return r}},value:{encode(r){return r},decode(r){return r}}}}function C1(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Mg(),storage:Mf.File}}const Bo="KV-Operation",R0="$KV",k1=/^[-/=.\w]+$/,M1=/^[-/=.>*\w]+$/,R1=/^[-\w]+$/;function D1(r){if(r.startsWith(".")||r.endsWith(".")||!k1.test(r))throw new Error(`invalid key: ${r}`)}function z1(r){if(r.startsWith(".")||r.endsWith(".")||!M1.test(r))throw new Error(`invalid key: ${r}`)}function q1(r){if(r.startsWith(".")||r.endsWith("."))throw new Error(`invalid key: ${r}`);const n=r.split(".");let s=!1;for(let a=0;a<n.length;a++)switch(n[a]){case"*":s=!0;break;case">":if(a!==n.length-1)throw new Error(`invalid key: ${r}`);s=!0;break}return s}function Ao(r){if(!R1.test(r))throw new Error(`invalid bucket name: ${r}`)}var Ln;(function(r){r.MsgIdHdr="Nats-Msg-Id",r.ExpectedStreamHdr="Nats-Expected-Stream",r.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",r.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",r.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})(Ln||(Ln={}));class Pa{constructor(n,s,a){v(this,"js");v(this,"jsm");v(this,"stream");v(this,"bucket");v(this,"direct");v(this,"codec");v(this,"prefix");v(this,"editPrefix");v(this,"useJsPrefix");v(this,"_prefixLen");v(this,"validateKey",D1);v(this,"validateSearchKey",z1);v(this,"hasWildcards",q1);Ao(n),this.js=s,this.jsm=a,this.bucket=n,this.prefix=R0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(n,s,a={}){Ao(s);const o=await n.jetstreamManager(),f=new Pa(s,n,o);return await f.init(a),f}static async bind(n,s,a={}){const o=await n.jetstreamManager(),f={config:{allow_direct:a.allow_direct}};Ao(s);const h=new Pa(s,n,o);return f.config.name=a.streamName??h.bucketName(),Object.assign(h,f),h.stream=f.config.name,h.codec=a.codec||Mg(),h.direct=f.config.allow_direct??!1,h.initializePrefixes(f),h}async init(n={}){const s=Object.assign(C1(),n);this.codec=s.codec;const a={};this.stream=a.name=n.streamName??this.bucketName(),a.retention=kf.Limits,a.max_msgs_per_subject=s.history,s.maxBucketSize&&(s.max_bytes=s.maxBucketSize),s.max_bytes&&(a.max_bytes=s.max_bytes),a.max_msg_size=s.maxValueSize,a.storage=s.storage;const o=n.placementCluster??"";if(o&&(n.placement={},n.placement.cluster=o,n.placement.tags=[]),n.placement&&(a.placement=n.placement),n.republish&&(a.republish=n.republish),n.description&&(a.description=n.description),n.mirror){const w=Object.assign({},n.mirror);w.name.startsWith(Zt)||(w.name=`${Zt}${w.name}`),a.mirror=w,a.mirror_direct=!0}else if(n.sources){const w=n.sources.map(T=>{const q=Object.assign({},T),M=q.name.startsWith(Zt)?q.name.substring(Zt.length):q.name;return q.name.startsWith(Zt)||(q.name=`${Zt}${q.name}`),!T.external&&M!==this.bucket&&(q.subject_transforms=[{src:`$KV.${M}.>`,dest:`$KV.${this.bucket}.>`}]),q});a.sources=w,a.subjects=[this.subjectForBucket()]}else a.subjects=[this.subjectForBucket()];n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?Ws.S2:Ws.None);const f=this.js.nc,h=f.getServerVersion(),m=h?Df(h,ji("2.7.2"))>=0:!1;a.discard=m?La.New:La.Old;const{ok:g,min:y}=f.features.get(Ue.JS_ALLOW_DIRECT);if(!g&&n.allow_direct===!0){const w=h?`${h.major}.${h.minor}.${h.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${w} - requires ${y}`))}n.allow_direct=typeof n.allow_direct=="boolean"?n.allow_direct:g,a.allow_direct=n.allow_direct,this.direct=a.allow_direct,a.num_replicas=s.replicas,s.ttl&&(a.max_age=nt(s.ttl)),a.allow_rollup_hdrs=!0;let E;try{E=await this.jsm.streams.info(a.name),!E.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(w){if(w.message==="stream not found")E=await this.jsm.streams.add(a);else throw w}this.initializePrefixes(E)}initializePrefixes(n){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:s}=n.config;if(s){let a=s.name;if(a.startsWith(Zt)&&(a=a.substring(Zt.length)),s.external&&s.external.api!==""){const o=s.name.substring(Zt.length);this.useJsPrefix=!1,this.prefix=`$KV.${o}`,this.editPrefix=`${s.external.api}.$KV.${a}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${Zt}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(n,s=!1){const a=[];return s?(this.useJsPrefix&&a.push(this.js.apiPrefix),this.editPrefix!==""?a.push(this.editPrefix):a.push(this.prefix)):this.prefix&&a.push(this.prefix),a.push(n),a.join(".")}fullKeyName(n){return this.prefix!==""?`${this.prefix}.${n}`:`${R0}.${this.bucket}.${n}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(n){const s=[];for(const a of n.split("."))switch(a){case">":case"*":s.push(a);break;default:s.push(this.codec.key.encode(a));break}return s.join(".")}decodeKey(n){const s=[];for(const a of n.split("."))switch(a){case">":case"*":s.push(a);break;default:s.push(this.codec.key.decode(a));break}return s.join(".")}close(){return Promise.resolve()}dataLen(n,s){const a=s&&s.get(Dt.MessageSizeHdr)||"";return a!==""?parseInt(a,10):n.length}smToEntry(n){return new K1(this.bucket,this.prefixLen,n)}jmToEntry(n){const s=this.decodeKey(n.subject.substring(this.prefixLen));return new Z1(this.bucket,s,n)}async create(n,s){var f;let a;try{const h=await this.put(n,s,{previousSeq:0});return Promise.resolve(h)}catch(h){if(a=h,((f=h==null?void 0:h.api_error)==null?void 0:f.err_code)!==10071)return Promise.reject(h)}let o=0;try{const h=await this.get(n);return(h==null?void 0:h.operation)==="DEL"||(h==null?void 0:h.operation)==="PURGE"?(o=h!==null?h.revision:0,this.update(n,s,o)):Promise.reject(a)}catch(h){return Promise.reject(h)}}update(n,s,a){if(a<=0)throw new Error("version must be greater than 0");return this.put(n,s,{previousSeq:a})}async put(n,s,a={}){var h,m;const o=this.encodeKey(n);this.validateKey(o);const f={};if(a.previousSeq!==void 0){const g=hs();f.headers=g,g.set(Ln.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(o,!0),s,f)).seq}catch(g){const y=g;return y.isJetStreamError()?(y.message=(h=y.api_error)==null?void 0:h.description,y.code=`${(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 h=this.smToEntry(f);return h.key!==a?null:h}catch(h){if(h.code===ie.JetStream404NoMessages)return null;throw h}}purge(n,s){return this._deleteOrPurge(n,"PURGE",s)}delete(n,s){return this._deleteOrPurge(n,"DEL",s)}async purgeDeletes(n=1800*1e3){const s=st(),a=[],o=await this.watch({key:">",initializedFn:()=>{s.resolve()}});(async()=>{for await(const g of o)(g.operation==="DEL"||g.operation==="PURGE")&&a.push(g)})().then(),await s,o.stop();const f=Date.now()-n,h=a.map(g=>{const y=this.subjectForKey(g.key);return g.created.getTime()>=f?this.jsm.streams.purge(this.stream,{filter:y,keep:1}):this.jsm.streams.purge(this.stream,{filter:y,keep:0})}),m=await Promise.all(h);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 h of o)f.push(this._doDeleteOrPurge(h,s)),f.length===100&&(await Promise.all(f),f.length=0);f.length>0&&await Promise.all(f)}async _doDeleteOrPurge(n,s,a){const o=this.encodeKey(n);this.validateKey(o);const f=hs();f.set(Bo,s),s==="PURGE"&&f.set(Dt.RollupHdr,Dt.RollupValueSubject),a!=null&&a.previousSeq&&f.set(Ln.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`),await this.js.publish(this.subjectForKey(o,!0),nn,{headers:f})}_buildCC(n,s,a={}){let f=(Array.isArray(n)?n:[n]).map(g=>{const y=this.encodeKey(g);return this.validateSearchKey(g),this.fullKeyName(y)}),h=ft.LastPerSubject;s===Nn.AllHistory&&(h=ft.All),s===Nn.UpdatesOnly&&(h=ft.New);let m;return f.length===1&&(m=f[0],f=void 0),Object.assign({deliver_policy:h,ack_policy:vt.None,filter_subjects:f,filter_subject:m,flow_control:!0,idle_heartbeat:nt(5*1e3)},a)}remove(n){return this.purge(n)}async history(n={}){const s=n.key??">",a=new _t,o={};o.headers_only=n.headers_only||!1;let f;f=()=>{a.stop()};let h=0;const m=this._buildCC(s,Nn.AllHistory,o),g=m.filter_subject,y=Qs(m);y.bindStream(this.stream),y.orderedConsumer(),y.callback((w,T)=>{if(w){a.stop(w);return}if(T){const q=this.jmToEntry(T);a.push(q),a.received++,(f&&h>0&&a.received>=h||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(q){a.stop(q)}finally{f=void 0}else h=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 _t,o={};o.headers_only=n.headers_only||!1;let f=Nn.LastValue;n.include===Nn.AllHistory?f=Nn.AllHistory:n.include===Nn.UpdatesOnly&&(f=Nn.UpdatesOnly);const h=n.ignoreDeletes===!0;let m=n.initializedFn,g=0;const y=this._buildCC(s,f,o),E=y.filter_subject,w=Qs(y);this.canSetWatcherName()&&w.consumerName(Zs.next()),w.bindStream(this.stream),n.resumeFromRevision&&n.resumeFromRevision>0&&w.startSequence(n.resumeFromRevision),w.orderedConsumer(),w.callback((q,M)=>{if(q){a.stop(q);return}if(M){const D=this.jmToEntry(M);if(h&&D.operation==="DEL")return;a.push(D),a.received++,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:q}}=T,M=q.num_pending+q.delivered.consumer_seq;if(M===0||a.received>=M)try{m()}catch(D){a.stop(D)}finally{m=void 0}else g=M}return a._data=T,a.iterClosed.then(()=>{T.unsubscribe()}),T.closed.then(()=>{a.stop()}).catch(q=>{a.stop(q)}),a}async keys(n=">"){const s=new _t,a=this._buildCC(n,Nn.LastValue,{headers_only:!0}),o=Array.isArray(n)?">":a.filter_subject,f=Qs(a);f.bindStream(this.stream),f.orderedConsumer();const h=await this.js.subscribe(o,f);return(async()=>{var g;for await(const y of h){const E=(g=y.headers)==null?void 0:g.get(Bo);if(E!=="DEL"&&E!=="PURGE"){const w=this.decodeKey(y.subject.substring(this.prefixLen));s.push(w)}y.info.pending===0&&h.unsubscribe()}})().then(()=>{s.stop()}).catch(g=>{s.stop(g)}),h.info.last.num_pending===0&&h.unsubscribe(),s}purgeBucket(n){return this.jsm.streams.purge(this.bucketName(),n)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var f;const s=((f=this.js.nc.info)==null?void 0:f.cluster)??"",a=this.bucketName(),o=await this.jsm.streams.info(a);return new Rg(o,s)}}class Rg{constructor(n,s=""){v(this,"si");v(this,"cluster");this.si=n,this.cluster=s}get bucket(){return this.si.config.name.startsWith(Zt)?this.si.config.name.substring(Zt.length):this.si.config.name}get values(){return this.si.state.messages}get history(){return this.si.config.max_msgs_per_subject}get ttl(){return th(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!==Ws.None:!1}}const ih="OBJ_",D0="SHA-256=";function U1(r){return Ao(r),`${ih}${r}`}function B1(r){return r.startsWith(ih)?r.substring(4):r}class Bf{constructor(n){v(this,"si");v(this,"backingStore");this.si=n,this.backingStore="JetStream"}get bucket(){return B1(this.si.config.name)}get description(){return this.si.config.description??""}get ttl(){return this.si.config.max_age}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get sealed(){return this.si.config.sealed}get size(){return this.si.state.bytes}get streamInfo(){return this.si}get metadata(){return this.si.config.metadata}get compression(){return this.si.config.compression?this.si.config.compression!==Ws.None:!1}}function xo(r){if(r===void 0)return;const{domain:n}=r;if(n===void 0)return r;const s=Object.assign({},r);if(delete s.domain,n==="")return s;if(s.external)throw new Error("domain and external are both set");return s.external={api:`$JS.${n}.API`},s}var bn;(function(r){r[r.Unset=-1]="Unset",r[r.Consume=0]="Consume",r[r.Fetch=1]="Fetch"})(bn||(bn={}));var Hn;(function(r){r.HeartbeatsMissed="heartbeats_missed",r.ConsumerNotFound="consumer_not_found",r.StreamNotFound="stream_not_found",r.ConsumerDeleted="consumer_deleted",r.OrderedConsumerRecreated="ordered_consumer_recreated",r.NoResponders="no_responders"})(Hn||(Hn={}));var Er;(function(r){r.DebugEvent="debug",r.Discard="discard",r.Reset="reset",r.Next="next"})(Er||(Er={}));const z0=Uint8Array.of(43,65,67,75),L1=Uint8Array.of(45,78,65,75),ja=Uint8Array.of(43,87,80,73),H1=Uint8Array.of(43,78,88,84),P1=Uint8Array.of(43,84,69,82,77),$1=Uint8Array.of(32);function $a(r,n=5e3){return new r_(r,n)}class gf extends _t{constructor(s,a,o=!1){super();v(this,"consumer");v(this,"opts");v(this,"sub");v(this,"monitor");v(this,"pending");v(this,"inbox");v(this,"refilling");v(this,"pong");v(this,"callback");v(this,"timeout");v(this,"cleanupHandler");v(this,"listeners");v(this,"statusIterator");v(this,"forOrderedConsumer");v(this,"resetHandler");v(this,"abortOnMissingResource");v(this,"bind");v(this,"inBackOff");this.consumer=s;const f=a;this.opts=this.parseOptions(a,o),this.callback=f.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=o,this.timeout=null,this.inbox=fs(s.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=f.abort_on_missing_resource===!0,this.bind=f.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:s,max_bytes:a,idle_heartbeat:o,threshold_bytes:f,threshold_messages:h}=this.opts;this.closed().then(g=>{if(this.cleanupHandler)try{this.cleanupHandler(g)}catch{}});const{sub:m}=this;m&&m.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(g,y)=>{var w,T,q,M;if(g){this.stop(g);return}if((w=this.monitor)==null||w.work(),y.subject===this.inbox){if(Cf(y))return;const D=(T=y.headers)==null?void 0:T.code,W=((M=(q=y.headers)==null?void 0:q.description)==null?void 0:M.toLowerCase())||"unknown",{msgsLeft:se,bytesLeft:ee}=this.parseDiscard(y.headers);if(se>0||ee>0)this.pending.msgs-=se,this.pending.bytes-=ee,this.pending.requests--,this.notify(Er.Discard,{msgsLeft:se,bytesLeft:ee});else if(D===400){this.stop(new ue(W,`${D}`));return}else if(D===409&&W==="consumer deleted"){if(this.notify(Hn.ConsumerDeleted,`${D} ${W}`),!this.refilling||this.abortOnMissingResource){const me=new ue(W,`${D}`);this.stop(me);return}}else if(D===503){if(this.notify(Hn.NoResponders,`${D} No Responders`),!this.refilling||this.abortOnMissingResource){const me=new ue("no responders",`${D}`);this.stop(me);return}}else this.notify(Er.DebugEvent,`${D} ${W}`)}else this._push($a(y,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=y.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(s&&this.pending.msgs<=h||a&&this.pending.bytes<=f){const D=this.pullOptions();this.pull(D)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),o&&(this.monitor=new sh(o,g=>(this.notify(Hn.HeartbeatsMissed,g),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var y;const g=this.consumer.api.nc.status();this.statusIterator=g;for await(const E of g)switch(E.type){case us.Disconnect:(y=this.monitor)==null||y.cancel();break;case us.Reconnect:this.resetPending().then(w=>{var 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=eh([this.opts.expires]);let f=0;for(;;){if(this.done)return!1;if(this.consumer.api.nc.isClosed())return console.error("aborting resetPending - connection is closed"),!1;try{return await this.consumer.info(),this.inBackOff=!1,s=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(h){if(h.message==="stream not found"){if(a++,this.notify(Hn.StreamNotFound,a),!this.refilling||this.abortOnMissingResource)return this.stop(h),!1}else if(h.message==="consumer not found"){if(s++,this.notify(Hn.ConsumerNotFound,s),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(h),!1;if(this.forOrderedConsumer)return!1}else s=0,a=0;this.inBackOff=!0;const m=o.backoff(f),g=Tr(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(Er.Next,s)})}pullOptions(){const s=this.opts.max_messages-this.pending.msgs,a=this.opts.max_bytes-this.pending.bytes,o=nt(this.opts.idle_heartbeat),f=nt(this.opts.expires);return{batch:s,max_bytes:a,idle_heartbeat:o,expires:f}}parseDiscard(s){const a={msgsLeft:0,bytesLeft:0},o=s==null?void 0:s.get(Dt.PendingMessagesHdr);o&&(a.msgsLeft=parseInt(o));const f=s==null?void 0:s.get(Dt.PendingBytesHdr);return f&&(a.bytesLeft=parseInt(f)),a}trackTimeout(s){this.timeout=s}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var s,a;(s=this.monitor)==null||s.cancel(),this.monitor=null,(a=this.timeout)==null||a.cancel(),this.timeout=null}setCleanupHandler(s){this.cleanupHandler=s}stop(s){var a,o;this.done||((a=this.sub)==null||a.unsubscribe(),this.clearTimers(),(o=this.statusIterator)==null||o.stop(),this._push(()=>{super.stop(s),this.listeners.forEach(f=>{f.stop()})}))}parseOptions(s,a=!1){const o=s||{};if(o.max_messages=o.max_messages||0,o.max_bytes=o.max_bytes||0,o.max_messages!==0&&o.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(o.max_messages===0&&(o.max_messages=100),o.expires=o.expires||3e4,o.expires<1e3)throw new Error("expires should be at least 1000ms");if(o.idle_heartbeat=o.idle_heartbeat||o.expires/2,o.idle_heartbeat=o.idle_heartbeat>3e4?3e4:o.idle_heartbeat,a){const f=Math.round(o.max_messages*.75)||1;o.threshold_messages=o.threshold_messages||f;const h=Math.round(o.max_bytes*.75)||1;o.threshold_bytes=o.threshold_bytes||h}return o}status(){const s=new _t;return this.listeners.push(s),Promise.resolve(s)}}class Y1 extends _t{constructor(){super();v(this,"src");v(this,"listeners");this.listeners=[]}setSource(s){this.src&&(this.src.resetHandler=void 0,this.src.setCleanupHandler(),this.src.stop()),this.src=s,this.src.setCleanupHandler(a=>{this.stop(a||void 0)}),(async()=>{const a=await this.src.status();for await(const o of a)this.notify(o.type,o.data)})().catch(()=>{})}notify(s,a){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.push({type:s,data:a})})}stop(s){var a;this.done||((a=this.src)==null||a.stop(s),super.stop(s),this.listeners.forEach(o=>{o.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const s=new _t;return this.listeners.push(s),Promise.resolve(s)}}class Lf{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 gf(this,n,!0))}fetch(n={max_messages:100,expires:3e4}){const s=new gf(this,n,!1),a=Math.round(s.opts.expires*1.05),o=Ar(a);return s.closed().catch(()=>{}).finally(()=>{o.cancel()}),o.catch(()=>{s.close().catch()}),s.trackTimeout(o),Promise.resolve(s)}next(n={expires:3e4}){const s=st(),a=n;a.max_messages=1;const o=new gf(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===Hn.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 h=Ar(f);return o.closed().then(m=>{m?s.reject(m):s.resolve(null)}).catch(m=>{s.reject(m)}).finally(()=>{h.cancel()}),h.catch(m=>{s.resolve(null),o.close().catch()}),o.trackTimeout(h),s}delete(){const{stream_name:n,name:s}=this._info;return this.api.delete(n,s)}info(n=!1){if(n)return Promise.resolve(this._info);const{stream_name:s,name:a}=this._info;return this.api.info(s,a).then(o=>(this._info=o,this._info))}}class G1{constructor(n,s,a={}){v(this,"api");v(this,"consumerOpts");v(this,"consumer");v(this,"opts");v(this,"cursor");v(this,"stream");v(this,"namePrefix");v(this,"serial");v(this,"currentConsumer");v(this,"userCallback");v(this,"iter");v(this,"type");v(this,"startSeq");v(this,"maxInitialReset");this.api=n,this.stream=s,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=Zs.next(),typeof a.name_prefix=="string"&&(Go("name_prefix",a.name_prefix),this.namePrefix=a.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=bn.Unset,this.consumerOpts=a,this.maxInitialReset=30,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(n){this.serial++;const s=`${this.namePrefix}_${this.serial}`;n=n===0?1:n;const a={name:s,deliver_policy:ft.StartSequence,opt_start_seq:n,ack_policy:vt.None,inactive_threshold:nt(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(a.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(a.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(a.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(a.replay_policy=this.consumerOpts.replay_policy),n===this.startSeq+1&&(a.deliver_policy=this.consumerOpts.deliver_policy||ft.StartSequence,(this.consumerOpts.deliver_policy===ft.LastPerSubject||this.consumerOpts.deliver_policy===ft.New||this.consumerOpts.deliver_policy===ft.Last)&&(delete a.opt_start_seq,a.deliver_policy=this.consumerOpts.deliver_policy),a.deliver_policy===ft.LastPerSubject&&typeof a.filter_subjects>"u"&&typeof a.filter_subject>"u"&&(a.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete a.opt_start_seq,a.deliver_policy=ft.StartTime,a.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(a.inactive_threshold=nt(this.consumerOpts.inactive_threshold))),a}async resetConsumer(n=0){var h,m,g,y,E;Zs.next();const s=this.serial===0;(h=this.consumer)==null||h.delete().catch(()=>{}),n=n===0?1:n,this.cursor.deliver_seq=0;const a=this.getConsumerOpts(n);a.max_deliver=1,a.mem_storage=!0;const o=eh([((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(Hn.OrderedConsumerRecreated,f.name);break}catch(T){if(T.message==="stream not found"&&((y=this.iter)==null||y.notify(Hn.StreamNotFound,w),this.type===bn.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 Tr(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===bn.Fetch&&o){(g=this.iter)==null||g.src.stop(),await((y=this.iter)==null?void 0:y.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||o)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||a)&&(this.iter=new Y1),this.consumer=new Lf(this.api,this.currentConsumer);const f=n;f.callback=this.internalHandler(this.serial);let h=null;this.type===bn.Fetch&&a?h=await this.consumer.fetch(n):this.type===bn.Consume&&(h=await this.consumer.consume(n));const m=h;m.forOrderedConsumer=!0,m.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(m)}notifyOrderedResetAndReset(){var n;(n=this.iter)==null||n.notify(Er.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===bn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===bn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:a}=n;return a&&(this.userCallback=a),this.type=bn.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===bn.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=bn.Fetch,this.opts=n,await this.reset(n,{fromFetch:!0}),this.iter}async next(n={expires:3e4}){const s=n;if(s.bind)return Promise.reject(new Error("bind is not supported"));s.max_messages=1;const a=st();return s.callback=f=>{this.userCallback=null,a.resolve(f)},(await this.fetch(s)).iterClosed.then(f=>{f&&a.reject(f),a.resolve(null)}).catch(f=>{a.reject(f)}),a}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(n=>Promise.resolve(n)).catch(n=>Promise.reject(n)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(n){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):n&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class Hf{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 Lf(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 Lf(this.api,a)).catch(a=>Promise.reject(a)))}async ordered(n,s){await this.checkVersion();const a=this.api;return new rh(a.nc,a.opts).info(n).then(f=>Promise.resolve(new G1(this.api,n,s))).catch(f=>Promise.reject(f))}}class Fo{constructor(n,s){v(this,"api");v(this,"_info");this.api=n,this._info=s}get name(){return this._info.config.name}alternates(){return this.info().then(n=>n.alternates?n.alternates:[])}async best(){if(await this.info(),this._info.alternates){const n=await this.api.info(this._info.alternates[0].name);return new Fo(this.api,n)}else return this}info(n=!1,s){return n?Promise.resolve(this._info):this.api.info(this.name,s).then(a=>(this._info=a,this._info))}getConsumerFromInfo(n){return new Hf(new zo(this.api.nc,this.api.opts)).getPullConsumerFor(n)}getConsumer(n){return new Hf(new zo(this.api.nc,this.api.opts)).get(this.name,n)}getMessage(n){return this.api.getMessage(this.name,n)}deleteMessage(n,s){return this.api.deleteMessage(this.name,n,s)}}class rh extends Ga{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),Mt(n.name),n.mirror=xo(n.mirror),n.sources=(o=n.sources)==null?void 0:o.map(xo);const a=await this._request(`${this.prefix}.STREAM.CREATE.${n.name}`,n);return this._fixInfo(a),a}async delete(n){return Mt(n),(await this._request(`${this.prefix}.STREAM.DELETE.${n}`)).success}async update(n,s={}){var 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),Mt(n);const a=await this.info(n),o=Object.assign(a.config,s);o.mirror=xo(o.mirror),o.sources=(m=o.sources)==null?void 0:m.map(xo);const h=await this._request(`${this.prefix}.STREAM.UPDATE.${n}`,o);return this._fixInfo(h),h}async info(n,s){Mt(n);const a=`${this.prefix}.STREAM.INFO.${n}`;let f=await this._request(a,s),{total:h,limit:m}=f,g=f.state.subjects?Object.getOwnPropertyNames(f.state.subjects).length:1;if(h&&h>g){const y=[f],E=s||{};let w=0;for(;h>g;){w++,E.offset=m*w;const q=await this._request(a,E);h=q.total,y.push(q);const M=Object.getOwnPropertyNames(q.state.subjects).length;if(g+=M,M<m)break}let T={};for(let q=0;q<y.length;q++)f=y[q],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 h=f;return h.streams.forEach(m=>{this._fixInfo(m)}),h.streams},o=`${this.prefix}.STREAM.LIST`;return new Ma(o,a,this,s)}_fixInfo(n){n.config.sealed=n.config.sealed||!1,n.config.deny_delete=n.config.deny_delete||!1,n.config.deny_purge=n.config.deny_purge||!1,n.config.allow_rollup_hdrs=n.config.allow_rollup_hdrs||!1}async purge(n,s){if(s){const{keep:o,seq:f}=s;if(typeof o=="number"&&typeof f=="number")throw new Error("can specify one of keep or seq")}return Mt(n),await this._request(`${this.prefix}.STREAM.PURGE.${n}`,s)}async deleteMessage(n,s,a=!0){Mt(n);const o={seq:s};return a||(o.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${n}`,o)).success}async getMessage(n,s){Mt(n);const o=await this._request(`${this.prefix}.STREAM.MSG.GET.${n}`,s);return new Dg(o)}find(n){return this.findStream(n)}listKvs(){const n=a=>{var g;const f=a.streams.filter(y=>y.config.name.startsWith(Zt));f.forEach(y=>{this._fixInfo(y)});let h="";return f.length&&(h=((g=this.nc.info)==null?void 0:g.cluster)??""),f.map(y=>new Rg(y,h))},s=`${this.prefix}.STREAM.LIST`;return new Ma(s,n,this)}listObjectStores(){const n=a=>{const f=a.streams.filter(m=>m.config.name.startsWith(ih));return f.forEach(m=>{this._fixInfo(m)}),f.map(m=>new Bf(m))},s=`${this.prefix}.STREAM.LIST`;return new Ma(s,n,this)}names(n=""){const s=n!=null&&n.length?{subject:n}:{},a=f=>f.streams,o=`${this.prefix}.STREAM.NAMES`;return new Ma(o,a,this,s)}async get(n){const s=await this.info(n);return Promise.resolve(new Fo(this,s))}}class V1 extends Ga{constructor(n,s){super(n,s)}async getMessage(n,s){Mt(n);let a=s;const{last_by_subj:o}=a;o&&(a=null);const f=a?this.jc.encode(a):nn,h=this.opts.apiPrefix||"$JS.API",m=o?`${h}.DIRECT.GET.${n}.${o}`:`${h}.DIRECT.GET.${n}`,g=await this.nc.request(m,f,{timeout:this.timeout}),y=wr(g);if(y)return Promise.reject(y);const E=new Pf(g);return Promise.resolve(E)}async getBatch(n,s){Mt(n);const o=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${n}`;if(!Array.isArray(s.multi_last)||s.multi_last.length===0)return Promise.reject("multi_last is required");const f=JSON.stringify(s,(g,y)=>g==="up_to_time"&&y instanceof Date?y.toISOString():y),h=new _t,m=await this.nc.requestMany(o,f,{strategy:kn.SentinelMsg});return(async()=>{var w,T,q;let g=!1,y=!1,E;for await(const M of m){if(!g){g=!0;const D=((w=M.headers)==null?void 0:w.code)||0;if(D!==0&&D<200||D>299){E=(T=M.headers)==null?void 0:T.description.toLowerCase();break}if(((q=M.headers)==null?void 0:q.get("Nats-Num-Pending"))===""){y=!0;break}}if(M.data.length===0)break;h.push(new Pf(M))}h.push(()=>{if(y)throw new Error("batch direct get not supported by the server");if(E)throw new Error(`bad request: ${E}`);h.stop()})})(),Promise.resolve(h)}}class Pf{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(br.Subject)}get seq(){const n=this.header.last(br.Sequence);return typeof n=="string"?parseInt(n):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(br.TimeStamp)}get stream(){return this.header.last(br.Stream)}json(n){return Mn(n).decode(this.data)}string(){return en.decode(this.data)}}v(Pf,"jc");class F1 extends Ga{constructor(s,a){super(s,a);v(this,"streams");v(this,"consumers");v(this,"direct");this.streams=new rh(s,a),this.consumers=new zo(s,a),this.direct=new V1(s,a)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const s=new _t;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(a,o)=>{if(a)throw a;try{const f=this.parseJsResponse(o),h=f.type.split("."),m=h[h.length-1];s.push({kind:m,data:f})}catch(f){s.stop(f)}}}),s}}class Dg{constructor(n){v(this,"_header");v(this,"smr");this.smr=n}get subject(){return this.smr.message.subject}get seq(){return this.smr.message.seq}get timestamp(){return this.smr.message.time}get time(){return new Date(Date.parse(this.timestamp))}get data(){return this.smr.message.data?this._parse(this.smr.message.data):nn}get header(){if(!this._header)if(this.smr.message.hdrs){const n=this._parse(this.smr.message.hdrs);this._header=Is.decode(n)}else this._header=hs();return this._header}_parse(n){const s=atob(n),a=s.length,o=new Uint8Array(a);for(let f=0;f<a;f++)o[f]=s.charCodeAt(f);return o}json(n){return Mn(n).decode(this.data)}string(){return en.decode(this.data)}}v(Dg,"jc");class J1{constructor(n){v(this,"api");this.api=n}get(n){return this.api.info(n).then(s=>new Fo(this.api,s))}}class yf{constructor(n){v(this,"info");v(this,"hdrs");this.info=n}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=Is.fromRecord(this.info.headers||{})),this.hdrs}get options(){return this.info.options}get bucket(){return this.info.bucket}get chunks(){return this.info.chunks}get deleted(){return this.info.deleted??!1}get digest(){return this.info.digest}get mtime(){return this.info.mtime}get nuid(){return this.info.nuid}get size(){return this.info.size}get revision(){return this.info.revision}get metadata(){return this.info.metadata||{}}isLink(){var n,s;return((n=this.info.options)==null?void 0:n.link)!==void 0&&((s=this.info.options)==null?void 0:s.link)!==null}}function q0(r){const n={name:r.name,description:r.description??"",options:r.options,metadata:r.metadata};if(r.headers){const s=r.headers;n.headers=s.toRecord()}return n}function I1(){return new ReadableStream({pull(r){r.enqueue(new Uint8Array(0)),r.close()}})}class Ua{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 yf(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=Mn().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 Bf(n)))}async status(n){const s=await this._si(n);return s===null?Promise.reject(new Error("object store not found")):Promise.resolve(new Bf(s))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(n,s,a){var re;const o=this.js.getOptions();a=a||{timeout:o.timeout},a.timeout=a.timeout||o.timeout,a.previousRevision=a.previousRevision??void 0;const{timeout:f,previousRevision:h}=a,m=this.js.nc.info,g=(m==null?void 0:m.max_payload)||1024;n=n||{},n.options=n.options||{};let y=((re=n.options)==null?void 0:re.max_chunk_size)||128*1024;y=y>g?g:y,n.options.max_chunk_size=y;const E=await this.info(n.name),{name:w,error:T}=this._checkNotEmpty(n.name);if(T)return Promise.reject(T);const q=Zs.next(),M=this._chunkSubject(q),D=this._metaSubject(w),W=Object.assign({bucket:this.name,nuid:q,size:0,chunks:0},q0(n)),se=st(),ee=[],me=new Or;try{const C=s?s.getReader():null,X=A0.create();for(;;){const{done:ce,value:V}=C?await C.read():{done:!0,value:void 0};if(ce){if(me.size()>0){const ne=me.drain();X.update(ne),W.chunks++,W.size+=ne.length,ee.push(this.js.publish(M,ne,{timeout:f}))}await Promise.all(ee),ee.length=0,W.mtime=new Date().toISOString();const G=Sr.encode(X.digest());W.digest=`${D0}${G}`,W.deleted=!1;const K=hs();typeof h=="number"&&K.set(Ln.ExpectedLastSubjectSequenceHdr,`${h}`),K.set(Dt.RollupHdr,Dt.RollupValueSubject);const ae=await this.js.publish(D,Mn().encode(W),{headers:K,timeout:f});if(W.revision=ae.seq,E)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${E.nuid}`})}catch{}se.resolve(new yf(W));break}if(V)for(me.fill(V);me.size()>y;){W.chunks++,W.size+=y;const G=me.drain(n.options.max_chunk_size);X.update(G),ee.push(this.js.publish(M,G,{timeout:f}))}}}catch(C){await this.jsm.streams.purge(this.stream,{filter:M}),se.reject(C)}return se}putBlob(n,s,a){function o(f){return new ReadableStream({pull(h){h.enqueue(f),h.close()}})}return s===null&&(s=new Uint8Array(0)),this.put(n,o(s),a)}put(n,s,a){var o;return(o=n==null?void 0:n.options)!=null&&o.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(n,s,a)}async getBlob(n){async function s(f){const h=new Or,m=f.getReader();for(;;){const{done:g,value:y}=await m.read();if(g)return h.drain();y&&y.length&&h.fill(y)}}const a=await this.get(n);if(a===null)return Promise.resolve(null);const o=await Promise.all([a.error,s(a.data)]);return o[0]?Promise.reject(o[0]):Promise.resolve(o[1])}async get(n){const s=await this.rawInfo(n);if(s===null||s.deleted)return Promise.resolve(null);if(s.options&&s.options.link){const w=s.options.link.name||"";if(w==="")throw new Error("link is a bucket");return(s.options.link.bucket!==this.name?await Ua.create(this.js,s.options.link.bucket):this).get(w)}if(!s.digest.startsWith(D0))return Promise.reject(new Error(`unknown digest type: ${s.digest}`));const a=Rf(s.digest.substring(8));if(a===null)return Promise.reject(new Error(`unable to parse digest: ${s.digest}`));const o=st(),f={info:new yf(s),error:o};if(s.size===0)return f.data=I1(),o.resolve(null),Promise.resolve(f);let h;const m=Qs();m.orderedConsumer();const g=A0.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),h.enqueue(w.data)),w.info.pending===0&&(qv(a,g.digest())?h.close():h.error(new Error(`received a corrupt object, digests do not match received: ${s.digest} calculated ${a}`)),E.unsubscribe())})().then(()=>{o.resolve()}).catch(w=>{h.error(w),o.reject(w)}),f.data=new ReadableStream({start(w){h=w},cancel(){E.unsubscribe()}}),f}linkStore(n,s){if(!(s instanceof Ua))return Promise.reject("bucket required");const a=s,{name:o,error:f}=this._checkNotEmpty(n);if(f)return Promise.reject(f);const h={name:o,options:{link:{bucket:a.name}}};return this._put(h,null)}async link(n,s){const{name:a,error:o}=this._checkNotEmpty(n);if(o)return Promise.reject(o);if(s.deleted)return Promise.reject(new Error("src object is deleted"));if(s.isLink())return Promise.reject(new Error("src object is a link"));const f=await this.rawInfo(n);if(f!==null&&!f.deleted)return Promise.reject(new Error("an object already exists with that name"));const h={bucket:s.bucket,name:s.name},m={name:a,bucket:s.bucket,options:{link:h}};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=Mn(),o=hs();return o.set(Dt.RollupHdr,Dt.RollupValueSubject),await this.js.publish(this._metaSubject(s.name),a.encode(s),{headers:o}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(s.nuid)})}async update(n,s={}){const a=await this.rawInfo(n);if(a===null)return Promise.reject(new Error("object not found"));if(a.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));s.name=s.name??a.name;const{name:o,error:f}=this._checkNotEmpty(s.name);if(f)return Promise.reject(f);if(n!==s.name){const g=await this.info(s.name);if(g&&!g.deleted)return Promise.reject(new Error("an object already exists with that name"))}s.name=o;const h=Object.assign({},a,q0(s)),m=await this.js.publish(this._metaSubject(h.name),JSON.stringify(h));return n!==s.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(n)}),Promise.resolve(m)}async watch(n={}){n.includeHistory=n.includeHistory??!1,n.ignoreDeletes=n.ignoreDeletes??!1;let s=!1;const a=new _t,o=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:o})}catch(g){g.code==="404"?(a.push(null),s=!0):a.stop(g)}const f=Mn(),h=Qs();h.orderedConsumer(),n.includeHistory?h.deliverLastPerSubject():(s=!0,h.deliverNew()),h.callback((g,y)=>{var E;if(g){a.stop(g);return}if(y!==null){const w=f.decode(y.data);w.deleted&&n.ignoreDeletes===!0||a.push(w),((E=y.info)==null?void 0:E.pending)===0&&!s&&(s=!0,a.push(null))}});const m=await this.js.subscribe(o,h);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.${Sr.encode(n)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(n={}){try{this.stream=U1(this.name)}catch(o){return Promise.reject(o)}const s=(n==null?void 0:n.ttl)||0;delete n.ttl;const a=Object.assign({max_age:s},n);a.name=this.stream,a.num_replicas=n.replicas??1,a.allow_direct=!0,a.allow_rollup_hdrs=!0,a.discard=La.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?Ws.S2:Ws.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 Ua(s,o,n);return await f.init(a),Promise.resolve(f)}}class Q1{constructor(n){v(this,"js");this.js=n}kv(n,s={}){const a=this.js,{ok:o,min:f}=a.nc.features.get(Ue.JS_KV);return o?s.bindOnly?Pa.bind(this.js,n,s):Pa.create(this.js,n,s):Promise.reject(new Error(`kv is only supported on servers ${f} or better`))}os(n,s={}){var h;if(typeof((h=crypto==null?void 0:crypto.subtle)==null?void 0:h.digest)!="function")return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));const a=this.js,{ok:o,min:f}=a.nc.features.get(Ue.JS_OBJECTSTORE);return o?Ua.create(this.js,n,s):Promise.reject(new Error(`objectstore is only supported on servers ${f} or better`))}}class ah extends Ga{constructor(s,a){super(s,a);v(this,"consumers");v(this,"streams");v(this,"consumerAPI");v(this,"streamAPI");this.consumerAPI=new zo(s,a),this.streamAPI=new rh(s,a),this.consumers=new Hf(this.consumerAPI),this.streams=new J1(this.streamAPI)}jetstreamManager(s){s===void 0&&(s=this.opts.checkAPI);const a=Object.assign({},this.opts,{checkAPI:s});return this.nc.jetstreamManager(a)}get apiPrefix(){return this.prefix}get views(){return new Q1(this)}async publish(s,a=nn,o){o=o||{},o.expect=o.expect||{};const f=(o==null?void 0:o.headers)||hs();o&&(o.msgID&&f.set(Ln.MsgIdHdr,o.msgID),o.expect.lastMsgID&&f.set(Ln.ExpectedLastMsgIdHdr,o.expect.lastMsgID),o.expect.streamName&&f.set(Ln.ExpectedStreamHdr,o.expect.streamName),typeof o.expect.lastSequence=="number"&&f.set(Ln.ExpectedLastSeqHdr,`${o.expect.lastSequence}`),typeof o.expect.lastSubjectSequence=="number"&&f.set(Ln.ExpectedLastSubjectSequenceHdr,`${o.expect.lastSubjectSequence}`));const h=o.timeout||this.timeout,m={};h&&(m.timeout=h),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(q){if(q.code==="503"&&T+1<g)await Tr(y);else throw q}const w=this.parseJsResponse(E);if(w.stream==="")throw ue.errorForCode(ie.JetStreamInvalidAck);return w.duplicate=w.duplicate?w.duplicate:!1,w}async pull(s,a,o=0){Mt(s),_r(a);let f=this.timeout;o>f&&(f=o),o=o<0?0:nt(o);const h={batch:1,no_wait:o===0,expires:o},m=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${a}`,this.jc.encode(h),{noMux:!0,timeout:f}),g=wr(m);if(g)throw g;return $a(m,this.timeout)}fetch(s,a,o={}){Mt(s),_r(a);let f=null;const h=(o.max_bytes??0)>0;let m=0;const g=h?o.max_bytes:0;let y=null;const E={};if(E.batch=o.batch||1,g){const ee=this.nc.features.get(Ue.JS_PULL_MAX_BYTES);if(!ee.ok)throw new Error(`max_bytes is only supported on servers ${ee.min} or better`);E.max_bytes=g}E.no_wait=o.no_wait||!1,E.no_wait&&E.expires&&(E.expires=0);const w=o.expires||0;if(w&&(E.expires=nt(w)),w===0&&E.no_wait===!1)throw new Error("expires or no_wait is required");const T=o.idle_heartbeat||0;T&&(E.idle_heartbeat=nt(T),o.delay_heartbeat===!0&&(E.idle_heartbeat=nt(T*4)));const q=new _t,M=E.batch;let D=0;q.protocolFilterFn=(ee,me=!1)=>Cf(ee.msg)?(y==null||y.work(),!1):!0,q.dispatchedFn=ee=>{if(ee){if(h&&(m+=ee.data.length),D++,f&&ee.info.pending===0)return;(q.getPending()===1&&ee.info.pending===0||M===D||g>0&&m>=g)&&q.stop()}};const W=fs(this.nc.options.inboxPrefix),se=this.nc.subscribe(W,{max:o.batch,callback:(ee,me)=>{ee===null&&(ee=wr(me)),ee!==null?(f&&(f.cancel(),f=null),yv(ee)?q.stop(qg(ee)===null?void 0:ee):q.stop(ee)):(y==null||y.work(),q.received++,q.push($a(me,this.timeout)))}});return w&&(f=Ar(w),f.catch(()=>{se.isClosed()||(se.drain().catch(()=>{}),f=null),y&&y.cancel()})),(async()=>{try{T&&(y=new sh(T,ee=>(q.push(()=>{q.err=new ue(`${xn.IdleHeartbeatMissed}: ${ee}`,ie.JetStreamIdleHeartBeat)}),!0)))}catch{}await se.closed,f!==null&&(f.cancel(),f=null),y&&y.cancel(),q.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${a}`,this.jc.encode(E),{reply:W}),q}async pullSubscribe(s,a=Qs()){const o=await this._processOptions(s,a);if(o.ordered)throw new Error("pull subscribers cannot be be ordered");if(o.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const f=o.config.ack_policy;if(f===vt.None||f===vt.All)throw new Error("ack policy for pull consumers must be explicit");const h=this._buildTypedSubscriptionOpts(o),m=new W1(this,o.deliver,h);m.info=o;try{await this._maybeCreateConsumer(o)}catch(g){throw m.unsubscribe(),g}return m}async subscribe(s,a=Qs()){const o=await this._processOptions(s,a);if(!o.isBind&&!o.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const f=this._buildTypedSubscriptionOpts(o),h=new zg(this,o.deliver,f);h.info=o;try{await this._maybeCreateConsumer(o)}catch(m){throw h.unsubscribe(),m}return h._maybeSetupHbMonitoring(),h}async _processOptions(s,a=Qs()){const o=_0(a)?a.getOpts():a;if(o.isBind=_0(a)?a.isBind:!1,o.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},o.ordered){if(o.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},o.config.ack_policy!==vt.NotSet&&o.config.ack_policy!==vt.None)throw new ue("ordered consumer: ack_policy can only be set to 'none'",ie.ApiError);if(o.config.durable_name&&o.config.durable_name.length>0)throw new ue("ordered consumer: durable_name cannot be set",ie.ApiError);if(o.config.deliver_subject&&o.config.deliver_subject.length>0)throw new ue("ordered consumer: deliver_subject cannot be set",ie.ApiError);if(o.config.max_deliver!==void 0&&o.config.max_deliver>1)throw new ue("ordered consumer: max_deliver cannot be set",ie.ApiError);if(o.config.deliver_group&&o.config.deliver_group.length>0)throw new ue("ordered consumer: deliver_group cannot be set",ie.ApiError);o.config.deliver_subject=fs(this.nc.options.inboxPrefix),o.config.ack_policy=vt.None,o.config.max_deliver=1,o.config.flow_control=!0,o.config.idle_heartbeat=o.config.idle_heartbeat||nt(5e3),o.config.ack_wait=nt(1320*60*1e3),o.config.mem_storage=!0,o.config.num_replicas=1}if(o.config.ack_policy===vt.NotSet&&(o.config.ack_policy=vt.All),o.api=this,o.config=o.config||{},o.stream=o.stream?o.stream:await this.findStream(s),o.attached=!1,o.config.durable_name)try{const f=await this.consumerAPI.info(o.stream,o.config.durable_name);if(f){if(f.config.filter_subject&&f.config.filter_subject!==s)throw new Error("subject does not match consumer");const h=o.config.deliver_group??"";if(h===""&&f.push_bound===!0)throw new Error("duplicate subscription");const m=f.config.deliver_group??"";if(h!==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||fs(this.nc.options.inboxPrefix),o}_buildTypedSubscriptionOpts(s){const a={};return a.adapter=e_(s.callbackFn===void 0,this.timeout),a.ingestionFilterFn=ah.ingestionFn(s.ordered),a.protocolFilterFn=(o,f=!1)=>{const h=o;return Nf(h.msg)?(f||h.msg.respond(),!1):!0},!s.mack&&s.config.ack_policy!==vt.None&&(a.dispatchedFn=s_),s.callbackFn&&(a.callback=s.callbackFn),a.max=s.max||0,a.queue=s.queue,a}async _maybeCreateConsumer(s){if(s.attached)return;if(s.isBind)throw new Error(`unable to bind - durable consumer ${s.config.durable_name} doesn't exist in ${s.stream}`);s.config=Object.assign({deliver_policy:ft.All,ack_policy:vt.Explicit,ack_wait:nt(30*1e3),replay_policy:jr.Instant},s.config);const a=await this.consumerAPI.add(s.stream,s.config);if(Array.isArray(s.config.filter_subjects&&!Array.isArray(a.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");s.name=a.name,s.config=a.config,s.last=a}static ingestionFn(s){return(a,o)=>{var g;const f=o;if(!a)return{ingest:!1,protocol:!1};const h=a;if(wr(h.msg)||(g=f.monitor)==null||g.work(),Cf(h.msg)){const y=s?f._checkHbOrderConsumer(h.msg):!0;return s||f.info.flow_control.heartbeat_count++,{ingest:y,protocol:!0}}else if(Nf(h.msg))return f.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:s?f._checkOrderedConsumer(a):!0,protocol:!1}}}}class lh{constructor(n){v(this,"options");v(this,"protocol");v(this,"draining");v(this,"listeners");v(this,"_services");this.draining=!1,this.options=b1(n),this.listeners=[]}static connect(n={}){return new Promise((s,a)=>{const o=new lh(n);Uo.connect(o.options,o).then(f=>{o.protocol=f,(async function(){for await(const h of f.status())o.listeners.forEach(m=>{m.push(h)})})(),s(o)}).catch(f=>{a(f)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(n,s,a){if(this.isClosed())throw ue.errorForCode(ie.ConnectionClosed);if(s&&this.isDraining()||a&&this.protocol.noMorePublishing)throw ue.errorForCode(ie.ConnectionDraining);if(n=n||"",n.length===0)throw ue.errorForCode(ie.BadSubject)}publish(n,s,a){this._check(n,!1,!0),this.protocol.publish(n,s,a)}publishMessage(n){return this.publish(n.subject,n.data,{reply:n.reply,headers:n.headers})}respondMessage(n){return n.reply?(this.publish(n.reply,n.data,{reply:n.reply,headers:n.headers}),!0):!1}subscribe(n,s={}){this._check(n,!0,!1);const a=new kg(this.protocol,n,s);return this.protocol.subscribe(a),a}_resub(n,s,a){this._check(s,!0,!1);const o=n;o.max=a,a&&(o.max=a+o.received),this.protocol.resub(o,s)}requestMany(n,s=nn,a={maxWait:1e3,maxMessages:-1}){const o=!this.protocol.options.noAsyncTraces;try{this._check(n,!0,!0)}catch(g){return Promise.reject(g)}if(a.strategy=a.strategy||kn.Timer,a.maxWait=a.maxWait||1e3,a.maxWait<1)return Promise.reject(new ue("timeout",ie.InvalidOption));const f=new _t;function h(g){f.push(()=>{f.stop(g)})}function m(g,y){g||y===null?h(g===null?void 0:g):f.push(y)}if(a.noMux){const g=o?new Error().stack:null;let y=typeof a.maxMessages=="number"&&a.maxMessages>0?a.maxMessages:-1;const E=this.subscribe(fs(this.options.inboxPrefix),{callback:(M,D)=>{var W,se;if(((W=D==null?void 0:D.data)==null?void 0:W.length)===0&&((se=D==null?void 0:D.headers)==null?void 0:se.status)===ie.NoResponders&&(M=ue.errorForCode(ie.NoResponders)),M){g&&(M.stack+=`
|
|
48
48
|
|
|
49
|
-
${g}`),w(M);return}m(null,D),a.strategy===
|
|
49
|
+
${g}`),w(M);return}m(null,D),a.strategy===kn.Count&&(y--,y===0&&w()),a.strategy===kn.JitterTimer&&(q(),T=setTimeout(()=>{w()},300)),a.strategy===kn.SentinelMsg&&D&&D.data.length===0&&w()}});E.requestSubject=n,E.closed.then(()=>{h()}).catch(M=>{f.stop(M)});const w=M=>{M&&f.push(()=>{throw M}),q(),E.drain().then(()=>{h()}).catch(D=>{h()})};f.iterClosed.then(()=>{q(),E==null||E.unsubscribe()}).catch(M=>{q(),E==null||E.unsubscribe()});try{this.publish(n,s,{reply:E.getSubject()})}catch(M){w(M)}let T=setTimeout(()=>{w()},a.maxWait);const q=()=>{T&&clearTimeout(T)}}else{const g=a;g.callback=m,f.iterClosed.then(()=>{y.cancel()}).catch(E=>{y.cancel(E)});const y=new Uv(this.protocol.muxSubscriptions,n,g);this.protocol.request(y);try{this.publish(n,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${y.token}`,headers:a.headers})}catch(E){y.cancel(E)}}return Promise.resolve(f)}request(n,s,a={timeout:1e3,noMux:!1}){try{this._check(n,!0,!0)}catch(f){return Promise.reject(f)}const o=!this.protocol.options.noAsyncTraces;if(a.timeout=a.timeout||1e3,a.timeout<1)return Promise.reject(new ue("timeout",ie.InvalidOption));if(!a.noMux&&a.reply)return Promise.reject(new ue("reply can only be used with noMux",ie.InvalidOption));if(a.noMux){const f=a.reply?a.reply:fs(this.options.inboxPrefix),h=st(),m=o?new Error:null,g=this.subscribe(f,{max:1,timeout:a.timeout,callback:(y,E)=>{y?(m&&y.code!==ie.Timeout&&(y.stack+=`
|
|
50
50
|
|
|
51
|
-
${m.stack}`),g.unsubscribe(),h.reject(y)):(y=
|
|
51
|
+
${m.stack}`),g.unsubscribe(),h.reject(y)):(y=wg(E),y?(m&&(y.stack+=`
|
|
52
52
|
|
|
53
|
-
${m.stack}`),h.reject(y)):h.resolve(E))}});return g.requestSubject=n,this.protocol.publish(n,s,{reply:f,headers:a.headers}),h}else{const f=new Eg(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 h=Promise.race([f.timer,f.deferred]);return h.catch(()=>{f.cancel()}),h}}flush(){return this.isClosed()?Promise.reject(ue.errorForCode(ie.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(ue.errorForCode(ie.ConnectionClosed)):this.isDraining()?Promise.reject(ue.errorForCode(ie.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const n=this.protocol.getServer();return n?n.listen:""}status(){const n=new _t;return n.iterClosed.then(()=>{const s=this.listeners.indexOf(n);this.listeners.splice(s,1)}),this.listeners.push(n),n}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((s,a)=>s==="time"?new Date(Date.parse(a)):a)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(n={}){const s=new V1(this,n);if(n.checkAPI!==!1)try{await s.getAccountInfo()}catch(a){const o=a;throw o.code===ie.NoResponders&&(o.code=ie.JetStreamNotEnabled),o}return s}jetstream(n={}){return new ah(this,n)}getServerVersion(){const n=this.info;return n?Ai(n.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw ue.errorForCode(ie.Disconnect);const n=Date.now();return await this.flush(),Date.now()-n}get features(){return this.protocol.features}get services(){return this._services||(this._services=new I1(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(ue.errorForCode(ie.ConnectionClosed)):this.isDraining()?Promise.reject(ue.errorForCode(ie.ConnectionDraining)):this.protocol.reconnect()}}class I1{constructor(n){v(this,"nc");this.nc=n}add(n){try{return new Ga(this.nc,n).start()}catch(s){return Promise.reject(s)}}client(n,s){return new T1(this.nc,n,s)}}class X1{constructor(n,s,a){v(this,"bucket");v(this,"sm");v(this,"prefixLen");this.bucket=n,this.prefixLen=s,this.sm=a}get key(){return this.sm.subject.substring(this.prefixLen)}get value(){return this.sm.data}get delta(){return 0}get created(){return this.sm.time}get revision(){return this.sm.seq}get operation(){return this.sm.header.get(Bo)||"PUT"}get length(){const n=this.sm.header.get(Dt.MessageSizeHdr)||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class K1{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(th(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var n;return((n=this.sm.headers)==null?void 0:n.get(Bo))||"PUT"}get delta(){return this.sm.info.pending}get length(){var s;const n=((s=this.sm.headers)==null?void 0:s.get(Dt.MessageSizeHdr))||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Dg extends Hv{constructor(s,a,o){super(s.nc,a,o);v(this,"js");v(this,"monitor");this.js=s,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(s){this.sub.info=s}get info(){return this.sub.info}_resetOrderedConsumer(s){if(this.info===null||this.sub.isClosed())return;const a=fs(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,a);const f=this.info;f.config.name=Ks.next(),f.ordered_consumer_sequence.delivery_seq=0,f.flow_control.heartbeat_count=0,f.flow_control.fc_count=0,f.flow_control.consumer_restarts++,f.deliver=a,f.config.deliver_subject=a,f.config.deliver_policy=ft.StartSequence,f.config.opt_start_seq=s;const h={};h.stream_name=this.info.stream,h.config=f.config;const m=`${f.api.prefix}.CONSUMER.CREATE.${f.stream}`;this.js._request(m,h,{retries:-1}).then(g=>{const y=g,E=this.sub.info;E.last=y,this.info.config=y.config,this.info.name=y.name}).catch(g=>{const y=new ue(`unable to recreate ordered consumer ${f.stream} at seq ${s}`,ie.RequestError,g);this.sub.callback(y,{})})}_maybeSetupHbMonitoring(){var a,o;const s=((o=(a=this.info)==null?void 0:a.config)==null?void 0:o.idle_heartbeat)||0;s&&this._setupHbMonitoring(th(s))}_setupHbMonitoring(s,a=0){const o={cancelAfter:0,maxOut:2};a&&(o.cancelAfter=a);const f=this.sub,h=m=>{var E,w,O,q;const g=vv(409,`${xn.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=((O=(w=this.info)==null?void 0:w.ordered_consumer_sequence)==null?void 0:O.stream_seq)||0;return this._resetOrderedConsumer(M+1),(q=this.monitor)==null||q.restart(),!1}return!f.noIterator};this.monitor=new sh(s,h,o)}_checkHbOrderConsumer(s){const a=s.headers.get(Dt.ConsumerStalledHdr);a!==""&&this.js.nc.publish(a);const o=parseInt(s.headers.get(Dt.LastConsumerSeqHdr),10),f=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,o!==f.delivery_seq&&this._resetOrderedConsumer(f.stream_seq+1),!1}_checkOrderedConsumer(s){const a=this.info.ordered_consumer_sequence,o=s.info.streamSequence,f=s.info.deliverySequence;return f!=a.delivery_seq+1?(this._resetOrderedConsumer(a.stream_seq+1),!1):(a.delivery_seq=f,a.stream_seq=o,!0)}async destroy(){this.isClosed()||await this.drain();const s=this.sub.info,a=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.DELETE.${s.stream}.${a}`;await s.api._request(o)}async consumerInfo(){const s=this.sub.info,a=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.INFO.${s.stream}.${a}`,f=await s.api._request(o);return s.last=f,f}}class Z1 extends Dg{constructor(n,s,a){super(n,s,a)}pull(n={batch:1}){const{stream:s,config:a,name:o}=this.sub.info,f=a.durable_name??o,h={};if(h.batch=n.batch||1,h.no_wait=n.no_wait||!1,(n.max_bytes??0)>0){const y=this.js.nc.features.get(Ue.JS_PULL_MAX_BYTES);if(!y.ok)throw new Error(`max_bytes is only supported on servers ${y.min} or better`);h.max_bytes=n.max_bytes}let m=0;n.expires&&n.expires>0&&(m=n.expires,h.expires=nt(m));let g=0;if(n.idle_heartbeat&&n.idle_heartbeat>0&&(g=n.idle_heartbeat,h.idle_heartbeat=nt(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(h),{reply:w})}}}function W1(r,n){return r?t_(n):e_(n)}function e_(r){return(n,s)=>n?[n,null]:(n=wr(s),n?[n,null]:[null,Pa(s,r)])}function t_(r){return(n,s)=>{if(n)return[n,null];const a=wr(s);return a!==null?[zg(a),null]:[null,Pa(s,r)]}}function zg(r){if(r!==null)switch(r.code){case ie.JetStream404NoMessages:case ie.JetStream408RequestTimeout:return null;case ie.JetStream409:return _v(r)?r:null;default:return r}return null}function n_(r){r&&r.ack()}function s_(r){const n=r.split(".");if(n.length===9&&n.splice(2,0,"_",""),n.length<11||n[0]!=="$JS"||n[1]!=="ACK")throw new Error("not js message");const s={};return s.domain=n[2]==="_"?"":n[2],s.account_hash=n[3],s.stream=n[4],s.consumer=n[5],s.deliveryCount=parseInt(n[6],10),s.redeliveryCount=s.deliveryCount,s.redelivered=s.deliveryCount>1,s.streamSequence=parseInt(n[7],10),s.deliverySequence=parseInt(n[8],10),s.timestampNanos=parseInt(n[9],10),s.pending=parseInt(n[10],10),s}class i_{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=s_(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]===ja[0]&&n[1]===ja[1]&&n[2]===ja[2]&&n[3]===ja[3]}async ackAck(n){var a;n=n||{},n.timeout=n.timeout||this.timeout;const s=st();if(this.didAck)s.resolve(!1);else if(this.didAck=!0,this.msg.reply){const f=this.msg.publisher,h=!((a=f.options)!=null&&a.noAsyncTraces),m=new Eg(f.muxSubscriptions,this.msg.reply,{timeout:n.timeout},h);f.request(m);try{f.publish(this.msg.reply,D0,{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(D0)}nak(n){let s=B1;n&&(s=Tf().encode(`-NAK ${JSON.stringify({delay:nt(n)})}`)),this.doAck(s)}working(){this.doAck(ja)}next(n,s={batch:1}){const a={};a.batch=s.batch||1,a.no_wait=s.no_wait||!1,s.expires&&s.expires>0&&(a.expires=nt(s.expires));const o=kn().encode(a),f=Or.concat(L1,P1,o),h=n?{reply:n}:void 0;this.msg.respond(f,h)}term(n=""){let s=H1;(n==null?void 0:n.length)>0&&(s=Tf().encode(`+TERM ${n}`)),this.doAck(s)}json(){return this.msg.json()}string(){return this.msg.string()}}const r_="1.30.3",a_="nats.ws";class l_{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=r_,this.lang=a_,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=st(),this.closedNotification=st()}async connect(n,s){const a=st();if(s.tls)return a.reject(new ue("tls",ie.InvalidOption)),a;this.options=s;const o=n.src;if(s.wsFactory){const{socket:f,encrypted:h}=await s.wsFactory(n.src,s);this.socket=f,this.encrypted=h}else this.encrypted=o.indexOf("wss://")===0,this.socket=new WebSocket(o);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=f=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(f.data)),this.peeked){this.signal.resolve();return}const h=Or.concat(...this.yields),m=Fv(h);if(m!==""){const g=v1.exec(m);if(!g){s.debug&&console.error("!!!",po(h)),a.reject(new Error("unexpected response from server"));return}try{const y=JSON.parse(g[1]);b1(y,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),a.resolve()}catch(y){a.reject(y);return}}},this.socket.onclose=f=>{if(this.isDiscarded())return;this.socketClosed=!0;let h;this.done||(f.wasClean||(h=new Error(f.reason)),this._closed(h))},this.socket.onerror=f=>{if(this.isDiscarded())return;const h=f,m=new ue(h.message,ie.Unknown,new Error(h.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 Tr(100);this.done=!0;try{this.socket.close(n?1002:1e3,n?n.message:void 0)}catch{}s&&this.closedNotification.resolve(n)}}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.isDiscarded())return;this.yields.length===0&&await this.signal;const n=this.yields;this.yields=[];for(let s=0;s<n.length;s++)this.options.debug&&console.info(`> ${po(n[s])}`),yield n[s];if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=st())}}isEncrypted(){return this.connected&&this.encrypted}send(n){if(!this.isDiscarded())try{this.socket.send(n.buffer),this.options.debug&&console.info(`< ${po(n)}`);return}catch(s){this.options.debug&&console.error(`!!! ${po(n)}: ${s}`)}}close(n){return this._closed(n,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var n;this.done=!0;try{(n=this.socket)==null||n.close()}catch{}}}function o_(r,n){/^(.*:\/\/)(.*)/.test(r)||(typeof n=="boolean"?r=`${n===!0?"https":"http"}://${r}`:r=`https://${r}`);let a=new URL(r);const o=a.protocol.toLowerCase();o==="ws:"&&(n=!1),o==="wss:"&&(n=!0),o!=="https:"&&o!=="http"&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2"),a=new URL(`http://${r}`));let f,h;const m=a.hostname,g=a.pathname,y=a.search||"";switch(o){case"http:":case"ws:":case"nats:":h=a.port||"80",f="ws:";break;case"https:":case"wss:":case"tls:":h=a.port||"443",f="wss:";break;default:h=a.port||n===!0?"443":"80",f=n===!0?"wss:":"ws:";break}return`${f}//${m}:${h}${g}${y}`}function c_(r={}){return Pv({defaultPort:443,urlParseFn:o_,factory:()=>new l_}),lh.connect(r)}const u_=null,f_=null,h_="lt.events";function qg(r,n){const s=r.split("."),a=n.split(".");for(let o=0;o<a.length;o++){const f=a[o];if(f===">")return!0;if(o>=s.length||f!=="*"&&f!==s[o])return!1}return s.length===a.length}const Va=T.createContext({connected:!1,subscribe:()=>()=>{}});function d_(){const{connected:r}=T.useContext(Va);return{connected:r}}function m_(r,n){const{subscribe:s}=T.useContext(Va),a=T.useRef(n);a.current=n,T.useEffect(()=>s(r,f=>a.current(f)),[s,r])}const p_=T.createContext({connected:!1,subscribe:()=>()=>{}}),g_=Tf();function y_({children:r,url:n,token:s}){const a=T.useRef(null),o=T.useRef(null),[f,h]=T.useState(!1),m=T.useRef(null),g=T.useRef(new Map),y=T.useCallback((O,q)=>{const M=g.current;return M.has(O)||M.set(O,new Set),M.get(O).add(q),()=>{const D=M.get(O);D&&(D.delete(q),D.size===0&&M.delete(O))}},[]),E=T.useCallback((O,q)=>{for(const[M,D]of g.current)if(qg(O,M))for(const W of D)try{W(q)}catch{}},[]),w=T.useCallback(async()=>{try{if(a.current)return;const O=n||u_;if(!O){console.error("[lt-nats] no NATS WebSocket URL configured — set NATS_WS_URL on the server");return}const q=await c_({servers:O,token:s||f_||void 0,reconnect:!0,maxReconnectAttempts:-1,reconnectTimeWait:2e3});a.current=q,h(!0);const M=q.subscribe("lt.>");o.current=M,(async()=>{for await(const D of M)try{const W=JSON.parse(g_.decode(D.data));E(D.subject,W)}catch{}})(),(async()=>{for await(const D of q.status())D.type==="disconnect"||D.type==="error"?h(!1):D.type==="reconnect"&&h(!0)})()}catch{h(!1),m.current=setTimeout(w,3e3)}},[E]);return T.useEffect(()=>(w(),()=>{m.current&&clearTimeout(m.current),o.current&&o.current.unsubscribe(),a.current&&(a.current.close().catch(()=>{}),a.current=null),h(!1)}),[w]),d.jsx(p_.Provider,{value:{connected:f,subscribe:y},children:d.jsx(Va.Provider,{value:{connected:f,subscribe:y},children:r})})}const $n=Object.create(null);$n.open="0";$n.close="1";$n.ping="2";$n.pong="3";$n.message="4";$n.upgrade="5";$n.noop="6";const jo=Object.create(null);Object.keys($n).forEach(r=>{jo[$n[r]]=r});const $f={type:"error",data:"parser error"},Ug=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Bg=typeof ArrayBuffer=="function",Lg=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,oh=({type:r,data:n},s,a)=>Ug&&n instanceof Blob?s?a(n):q0(n,a):Bg&&(n instanceof ArrayBuffer||Lg(n))?s?a(n):q0(new Blob([n]),a):a($n[r]+(n||"")),q0=(r,n)=>{const s=new FileReader;return s.onload=function(){const a=s.result.split(",")[1];n("b"+(a||""))},s.readAsDataURL(r)};function U0(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}let bf;function b_(r,n){if(Ug&&r.data instanceof Blob)return r.data.arrayBuffer().then(U0).then(n);if(Bg&&(r.data instanceof ArrayBuffer||Lg(r.data)))return n(U0(r.data));oh(r,!1,s=>{bf||(bf=new TextEncoder),n(bf.encode(s))})}const B0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ma=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<B0.length;r++)Ma[B0.charCodeAt(r)]=r;const x_=r=>{let n=r.length*.75,s=r.length,a,o=0,f,h,m,g;r[r.length-1]==="="&&(n--,r[r.length-2]==="="&&n--);const y=new ArrayBuffer(n),E=new Uint8Array(y);for(a=0;a<s;a+=4)f=Ma[r.charCodeAt(a)],h=Ma[r.charCodeAt(a+1)],m=Ma[r.charCodeAt(a+2)],g=Ma[r.charCodeAt(a+3)],E[o++]=f<<2|h>>4,E[o++]=(h&15)<<4|m>>2,E[o++]=(m&3)<<6|g&63;return y},v_=typeof ArrayBuffer=="function",ch=(r,n)=>{if(typeof r!="string")return{type:"message",data:Hg(r,n)};const s=r.charAt(0);return s==="b"?{type:"message",data:__(r.substring(1),n)}:jo[s]?r.length>1?{type:jo[s],data:r.substring(1)}:{type:jo[s]}:$f},__=(r,n)=>{if(v_){const s=x_(r);return Hg(s,n)}else return{base64:!0,data:r}},Hg=(r,n)=>{switch(n){case"blob":return r instanceof Blob?r:new Blob([r]);case"arraybuffer":default:return r instanceof ArrayBuffer?r:r.buffer}},Pg="",w_=(r,n)=>{const s=r.length,a=new Array(s);let o=0;r.forEach((f,h)=>{oh(f,!1,m=>{a[h]=m,++o===s&&n(a.join(Pg))})})},S_=(r,n)=>{const s=r.split(Pg),a=[];for(let o=0;o<s.length;o++){const f=ch(s[o],n);if(a.push(f),f.type==="error")break}return a};function E_(){return new TransformStream({transform(r,n){b_(r,s=>{const a=s.length;let o;if(a<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,a);else if(a<65536){o=new Uint8Array(3);const f=new DataView(o.buffer);f.setUint8(0,126),f.setUint16(1,a)}else{o=new Uint8Array(9);const f=new DataView(o.buffer);f.setUint8(0,127),f.setBigUint64(1,BigInt(a))}r.data&&typeof r.data!="string"&&(o[0]|=128),n.enqueue(o),n.enqueue(s)})}})}let xf;function xo(r){return r.reduce((n,s)=>n+s.length,0)}function vo(r,n){if(r[0].length===n)return r.shift();const s=new Uint8Array(n);let a=0;for(let o=0;o<n;o++)s[o]=r[0][a++],a===r[0].length&&(r.shift(),a=0);return r.length&&a<r[0].length&&(r[0]=r[0].slice(a)),s}function A_(r,n){xf||(xf=new TextDecoder);const s=[];let a=0,o=-1,f=!1;return new TransformStream({transform(h,m){for(s.push(h);;){if(a===0){if(xo(s)<1)break;const g=vo(s,1);f=(g[0]&128)===128,o=g[0]&127,o<126?a=3:o===126?a=1:a=2}else if(a===1){if(xo(s)<2)break;const g=vo(s,2);o=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),a=3}else if(a===2){if(xo(s)<8)break;const g=vo(s,8),y=new DataView(g.buffer,g.byteOffset,g.length),E=y.getUint32(0);if(E>Math.pow(2,21)-1){m.enqueue($f);break}o=E*Math.pow(2,32)+y.getUint32(4),a=3}else{if(xo(s)<o)break;const g=vo(s,o);m.enqueue(ch(f?g:xf.decode(g),n)),a=0}if(o===0||o>r){m.enqueue($f);break}}}})}const $g=4;function gt(r){if(r)return j_(r)}function j_(r){for(var n in gt.prototype)r[n]=gt.prototype[n];return r}gt.prototype.on=gt.prototype.addEventListener=function(r,n){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(n),this};gt.prototype.once=function(r,n){function s(){this.off(r,s),n.apply(this,arguments)}return s.fn=n,this.on(r,s),this};gt.prototype.off=gt.prototype.removeListener=gt.prototype.removeAllListeners=gt.prototype.removeEventListener=function(r,n){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var s=this._callbacks["$"+r];if(!s)return this;if(arguments.length==1)return delete this._callbacks["$"+r],this;for(var a,o=0;o<s.length;o++)if(a=s[o],a===n||a.fn===n){s.splice(o,1);break}return s.length===0&&delete this._callbacks["$"+r],this};gt.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var n=new Array(arguments.length-1),s=this._callbacks["$"+r],a=1;a<arguments.length;a++)n[a-1]=arguments[a];if(s){s=s.slice(0);for(var a=0,o=s.length;a<o;++a)s[a].apply(this,n)}return this};gt.prototype.emitReserved=gt.prototype.emit;gt.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]};gt.prototype.hasListeners=function(r){return!!this.listeners(r).length};const Jo=typeof Promise=="function"&&typeof Promise.resolve=="function"?n=>Promise.resolve().then(n):(n,s)=>s(n,0),vn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),O_="arraybuffer";function Yg(r,...n){return n.reduce((s,a)=>(r.hasOwnProperty(a)&&(s[a]=r[a]),s),{})}const T_=vn.setTimeout,N_=vn.clearTimeout;function Qo(r,n){n.useNativeTimers?(r.setTimeoutFn=T_.bind(vn),r.clearTimeoutFn=N_.bind(vn)):(r.setTimeoutFn=vn.setTimeout.bind(vn),r.clearTimeoutFn=vn.clearTimeout.bind(vn))}const C_=1.33;function k_(r){return typeof r=="string"?M_(r):Math.ceil((r.byteLength||r.size)*C_)}function M_(r){let n=0,s=0;for(let a=0,o=r.length;a<o;a++)n=r.charCodeAt(a),n<128?s+=1:n<2048?s+=2:n<55296||n>=57344?s+=3:(a++,s+=4);return s}function Gg(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function R_(r){let n="";for(let s in r)r.hasOwnProperty(s)&&(n.length&&(n+="&"),n+=encodeURIComponent(s)+"="+encodeURIComponent(r[s]));return n}function D_(r){let n={},s=r.split("&");for(let a=0,o=s.length;a<o;a++){let f=s[a].split("=");n[decodeURIComponent(f[0])]=decodeURIComponent(f[1])}return n}class z_ extends Error{constructor(n,s,a){super(n),this.description=s,this.context=a,this.type="TransportError"}}class uh extends gt{constructor(n){super(),this.writable=!1,Qo(this,n),this.opts=n,this.query=n.query,this.socket=n.socket,this.supportsBinary=!n.forceBase64}onError(n,s,a){return super.emitReserved("error",new z_(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=ch(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=R_(n);return s.length?"?"+s:""}}class q_ extends uh{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)};S_(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,w_(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]=Gg()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(n,s)}}let Vg=!1;try{Vg=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const U_=Vg;function B_(){}class L_ extends q_{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 Pn extends gt{constructor(n,s,a){super(),this.createRequest=n,Qo(this,a),this._opts=a,this._method=a.method||"GET",this._uri=s,this._data=a.data!==void 0?a.data:null,this._create()}_create(){var n;const s=Yg(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=Pn.requestsCount++,Pn.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=B_,n)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Pn.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()}}Pn.requestsCount=0;Pn.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",L0);else if(typeof addEventListener=="function"){const r="onpagehide"in vn?"pagehide":"unload";addEventListener(r,L0,!1)}}function L0(){for(let r in Pn.requests)Pn.requests.hasOwnProperty(r)&&Pn.requests[r].abort()}const H_=(function(){const r=Fg({xdomain:!1});return r&&r.responseType!==null})();class P_ extends L_{constructor(n){super(n);const s=n&&n.forceBase64;this.supportsBinary=H_&&!s}request(n={}){return Object.assign(n,{xd:this.xd},this.opts),new Pn(Fg,this.uri(),n)}}function Fg(r){const n=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!n||U_))return new XMLHttpRequest}catch{}if(!n)try{return new vn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Jg=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class $_ extends uh{get name(){return"websocket"}doOpen(){const n=this.uri(),s=this.opts.protocols,a=Jg?{}:Yg(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;oh(a,this.supportsBinary,f=>{try{this.doWrite(a,f)}catch{}o&&Jo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const n=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=Gg()),this.supportsBinary||(s.b64=1),this.createUri(n,s)}}const vf=vn.WebSocket||vn.MozWebSocket;class Y_ extends $_{createSocket(n,s,a){return Jg?new vf(n,s,a):s?new vf(n,s):new vf(n)}doWrite(n,s){this.ws.send(s)}}class G_ extends uh{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=A_(Number.MAX_SAFE_INTEGER,this.socket.binaryType),a=n.readable.pipeThrough(s).getReader(),o=E_();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 h={type:"open"};this.query.sid&&(h.data=`{"sid":"${this.query.sid}"}`),this._writer.write(h).then(()=>this.onOpen())})})}write(n){this.writable=!1;for(let s=0;s<n.length;s++){const a=n[s],o=s===n.length-1;this._writer.write(a).then(()=>{o&&Jo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var n;(n=this._transport)===null||n===void 0||n.close()}}const V_={websocket:Y_,webtransport:G_,polling:P_},F_=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,J_=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Yf(r){if(r.length>8e3)throw"URI too long";const n=r,s=r.indexOf("["),a=r.indexOf("]");s!=-1&&a!=-1&&(r=r.substring(0,s)+r.substring(s,a).replace(/:/g,";")+r.substring(a,r.length));let o=F_.exec(r||""),f={},h=14;for(;h--;)f[J_[h]]=o[h]||"";return s!=-1&&a!=-1&&(f.source=n,f.host=f.host.substring(1,f.host.length-1).replace(/;/g,":"),f.authority=f.authority.replace("[","").replace("]","").replace(/;/g,":"),f.ipv6uri=!0),f.pathNames=Q_(f,f.path),f.queryKey=I_(f,f.query),f}function Q_(r,n){const s=/\/{2,9}/g,a=n.replace(s,"/").split("/");return(n.slice(0,1)=="/"||n.length===0)&&a.splice(0,1),n.slice(-1)=="/"&&a.splice(a.length-1,1),a}function I_(r,n){const s={};return n.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(a,o,f){o&&(s[o]=f)}),s}const Gf=typeof addEventListener=="function"&&typeof removeEventListener=="function",Oo=[];Gf&&addEventListener("offline",()=>{Oo.forEach(r=>r())},!1);class Xs extends gt{constructor(n,s){if(super(),this.binaryType=O_,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=Yf(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=Yf(s.host).host);Qo(this,s),this.secure=s.secure!=null?s.secure:typeof location<"u"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=s.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(a=>{const o=a.prototype.name;this.transports.push(o),this._transportsByName[o]=a}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=D_(this.opts.query)),Gf&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Oo.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(n){const s=Object.assign({},this.opts.query);s.EIO=$g,s.transport=n,this.id&&(s.sid=this.id);const a=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[n]);return new this._transportsByName[n](a)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const n=this.opts.rememberUpgrade&&Xs.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const s=this.createTransport(n);s.open(),this.setTransport(s)}setTransport(n){this.transport&&this.transport.removeAllListeners(),this.transport=n,n.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",Xs.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",n),this.emitReserved("heartbeat"),n.type){case"open":this.onHandshake(JSON.parse(n.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const s=new Error("server error");s.code=n.data,this._onError(s);break;case"message":this.emitReserved("data",n.data),this.emitReserved("message",n.data);break}}onHandshake(n){this.emitReserved("handshake",n),this.id=n.sid,this.transport.query.sid=n.sid,this._pingInterval=n.pingInterval,this._pingTimeout=n.pingTimeout,this._maxPayload=n.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const n=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+n,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},n),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const n=this._getWritablePackets();this.transport.send(n),this._prevBufferLen=n.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let a=0;a<this.writeBuffer.length;a++){const o=this.writeBuffer[a].data;if(o&&(s+=k_(o)),a>0&&s>this._maxPayload)return this.writeBuffer.slice(0,a);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const n=Date.now()>this._pingTimeoutTime;return n&&(this._pingTimeoutTime=0,Jo(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),n}write(n,s,a){return this._sendPacket("message",n,s,a),this}send(n,s,a){return this._sendPacket("message",n,s,a),this}_sendPacket(n,s,a,o){if(typeof s=="function"&&(o=s,s=void 0),typeof a=="function"&&(o=a,a=null),this.readyState==="closing"||this.readyState==="closed")return;a=a||{},a.compress=a.compress!==!1;const f={type:n,data:s,options:a};this.emitReserved("packetCreate",f),this.writeBuffer.push(f),o&&this.once("flush",o),this.flush()}close(){const n=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),n()},a=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?a():n()}):this.upgrading?a():n()),this}_onError(n){if(Xs.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",n),this._onClose("transport error",n)}_onClose(n,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Gf&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const a=Oo.indexOf(this._offlineEventListener);a!==-1&&Oo.splice(a,1)}this.readyState="closed",this.id=null,this.emitReserved("close",n,s),this.writeBuffer=[],this._prevBufferLen=0}}}Xs.protocol=$g;class X_ extends Xs{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let n=0;n<this._upgrades.length;n++)this._probe(this._upgrades[n])}_probe(n){let s=this.createTransport(n),a=!1;Xs.priorWebsocketSuccess=!1;const o=()=>{a||(s.send([{type:"ping",data:"probe"}]),s.once("packet",w=>{if(!a)if(w.type==="pong"&&w.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",s),!s)return;Xs.priorWebsocketSuccess=s.name==="websocket",this.transport.pause(()=>{a||this.readyState!=="closed"&&(E(),this.setTransport(s),s.send([{type:"upgrade"}]),this.emitReserved("upgrade",s),s=null,this.upgrading=!1,this.flush())})}else{const O=new Error("probe error");O.transport=s.name,this.emitReserved("upgradeError",O)}}))};function f(){a||(a=!0,E(),s.close(),s=null)}const h=w=>{const O=new Error("probe error: "+w);O.transport=s.name,f(),this.emitReserved("upgradeError",O)};function m(){h("transport closed")}function g(){h("socket closed")}function y(w){s&&w.name!==s.name&&f()}const E=()=>{s.removeListener("open",o),s.removeListener("error",h),s.removeListener("close",m),this.off("close",g),this.off("upgrading",y)};s.once("open",o),s.once("error",h),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 K_=class extends X_{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=>V_[o]).filter(o=>!!o)),super(n,a)}};function Z_(r,n="",s){let a=r;s=s||typeof location<"u"&&location,r==null&&(r=s.protocol+"//"+s.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=s.protocol+r:r=s.host+r),/^(https?|wss?):\/\//.test(r)||(typeof s<"u"?r=s.protocol+"//"+r:r="https://"+r),a=Yf(r)),a.port||(/^(http|ws)$/.test(a.protocol)?a.port="80":/^(http|ws)s$/.test(a.protocol)&&(a.port="443")),a.path=a.path||"/";const f=a.host.indexOf(":")!==-1?"["+a.host+"]":a.host;return a.id=a.protocol+"://"+f+":"+a.port+n,a.href=a.protocol+"://"+f+(s&&s.port===a.port?"":":"+a.port),a}const W_=typeof ArrayBuffer=="function",ew=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,Qg=Object.prototype.toString,tw=typeof Blob=="function"||typeof Blob<"u"&&Qg.call(Blob)==="[object BlobConstructor]",nw=typeof File=="function"||typeof File<"u"&&Qg.call(File)==="[object FileConstructor]";function fh(r){return W_&&(r instanceof ArrayBuffer||ew(r))||tw&&r instanceof Blob||nw&&r instanceof File}function To(r,n){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let s=0,a=r.length;s<a;s++)if(To(r[s]))return!0;return!1}if(fh(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return To(r.toJSON(),!0);for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)&&To(r[s]))return!0;return!1}function sw(r){const n=[],s=r.data,a=r;return a.data=Vf(s,n),a.attachments=n.length,{packet:a,buffers:n}}function Vf(r,n){if(!r)return r;if(fh(r)){const s={_placeholder:!0,num:n.length};return n.push(r),s}else if(Array.isArray(r)){const s=new Array(r.length);for(let a=0;a<r.length;a++)s[a]=Vf(r[a],n);return s}else if(typeof r=="object"&&!(r instanceof Date)){const s={};for(const a in r)Object.prototype.hasOwnProperty.call(r,a)&&(s[a]=Vf(r[a],n));return s}return r}function iw(r,n){return r.data=Ff(r.data,n),delete r.attachments,r}function Ff(r,n){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<n.length)return n[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let s=0;s<r.length;s++)r[s]=Ff(r[s],n);else if(typeof r=="object")for(const s in r)Object.prototype.hasOwnProperty.call(r,s)&&(r[s]=Ff(r[s],n));return r}const rw=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var qe;(function(r){r[r.CONNECT=0]="CONNECT",r[r.DISCONNECT=1]="DISCONNECT",r[r.EVENT=2]="EVENT",r[r.ACK=3]="ACK",r[r.CONNECT_ERROR=4]="CONNECT_ERROR",r[r.BINARY_EVENT=5]="BINARY_EVENT",r[r.BINARY_ACK=6]="BINARY_ACK"})(qe||(qe={}));class aw{constructor(n){this.replacer=n}encode(n){return(n.type===qe.EVENT||n.type===qe.ACK)&&To(n)?this.encodeAsBinary({type:n.type===qe.EVENT?qe.BINARY_EVENT:qe.BINARY_ACK,nsp:n.nsp,data:n.data,id:n.id}):[this.encodeAsString(n)]}encodeAsString(n){let s=""+n.type;return(n.type===qe.BINARY_EVENT||n.type===qe.BINARY_ACK)&&(s+=n.attachments+"-"),n.nsp&&n.nsp!=="/"&&(s+=n.nsp+","),n.id!=null&&(s+=n.id),n.data!=null&&(s+=JSON.stringify(n.data,this.replacer)),s}encodeAsBinary(n){const s=sw(n),a=this.encodeAsString(s.packet),o=s.buffers;return o.unshift(a),o}}class hh extends gt{constructor(n){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof n=="function"?{reviver:n}:n)}add(n){let s;if(typeof n=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");s=this.decodeString(n);const a=s.type===qe.BINARY_EVENT;a||s.type===qe.BINARY_ACK?(s.type=a?qe.EVENT:qe.ACK,this.reconstructor=new lw(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if(fh(n)||n.base64)if(this.reconstructor)s=this.reconstructor.takeBinaryData(n),s&&(this.reconstructor=null,super.emitReserved("decoded",s));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+n)}decodeString(n){let s=0;const a={type:Number(n.charAt(0))};if(qe[a.type]===void 0)throw new Error("unknown packet type "+a.type);if(a.type===qe.BINARY_EVENT||a.type===qe.BINARY_ACK){const f=s+1;for(;n.charAt(++s)!=="-"&&s!=n.length;);const h=n.substring(f,s);if(h!=Number(h)||n.charAt(s)!=="-")throw new Error("Illegal attachments");const m=Number(h);if(!ow(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 h=n.charAt(s);if(h==null||Number(h)!=h){--s;break}if(s===n.length)break}a.id=Number(n.substring(f,s+1))}if(n.charAt(++s)){const f=this.tryParse(n.substr(s));if(hh.isPayloadValid(a.type,f))a.data=f;else throw new Error("invalid payload")}return a}tryParse(n){try{return JSON.parse(n,this.opts.reviver)}catch{return!1}}static isPayloadValid(n,s){switch(n){case qe.CONNECT:return H0(s);case qe.DISCONNECT:return s===void 0;case qe.CONNECT_ERROR:return typeof s=="string"||H0(s);case qe.EVENT:case qe.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&rw.indexOf(s[0])===-1);case qe.ACK:case qe.BINARY_ACK:return Array.isArray(s)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class lw{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=iw(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const ow=Number.isInteger||function(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r};function H0(r){return Object.prototype.toString.call(r)==="[object Object]"}const cw=Object.freeze(Object.defineProperty({__proto__:null,Decoder:hh,Encoder:aw,get PacketType(){return qe}},Symbol.toStringTag,{value:"Module"}));function Nn(r,n,s){return r.on(n,s),function(){r.off(n,s)}}const uw=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Ig extends gt{constructor(n,s,a){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=n,this.nsp=s,a&&a.auth&&(this.auth=a.auth),this._opts=Object.assign({},a),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const n=this.io;this.subs=[Nn(n,"open",this.onopen.bind(this)),Nn(n,"packet",this.onpacket.bind(this)),Nn(n,"error",this.onerror.bind(this)),Nn(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(uw.hasOwnProperty(n))throw new Error('"'+n.toString()+'" is a reserved event name');if(s.unshift(n),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(s),this;const h={type:qe.EVENT,data:s};if(h.options={},h.options.compress=this.flags.compress!==!1,typeof s[s.length-1]=="function"){const E=this.ids++,w=s.pop();this._registerAckCallback(E,w),h.id=E}const 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(h),this.packet(h)):this.sendBuffer.push(h)),this.flags={},this}_registerAckCallback(n,s){var a;const o=(a=this.flags.timeout)!==null&&a!==void 0?a:this._opts.ackTimeout;if(o===void 0){this.acks[n]=s;return}const f=this.io.setTimeoutFn(()=>{delete this.acks[n];for(let 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),h=(...m)=>{this.io.clearTimeoutFn(f),s.apply(this,m)};h.withError=!0,this.acks[n]=h}emitWithAck(n,...s){return new Promise((a,o)=>{const f=(h,m)=>h?o(h):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:qe.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},n):n})}onerror(n){this.connected||this.emitReserved("connect_error",n)}onclose(n,s){this.connected=!1,delete this.id,this.emitReserved("disconnect",n,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(n=>{if(!this.sendBuffer.some(a=>String(a.id)===n)){const a=this.acks[n];delete this.acks[n],a.withError&&a.call(this,new Error("socket has been disconnected"))}})}onpacket(n){if(n.nsp===this.nsp)switch(n.type){case qe.CONNECT:n.data&&n.data.sid?this.onconnect(n.data.sid,n.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case qe.EVENT:case qe.BINARY_EVENT:this.onevent(n);break;case qe.ACK:case qe.BINARY_ACK:this.onack(n);break;case qe.DISCONNECT:this.ondisconnect();break;case qe.CONNECT_ERROR:this.destroy();const a=new Error(n.data.message);a.data=n.data.data,this.emitReserved("connect_error",a);break}}onevent(n){const s=n.data||[];n.id!=null&&s.push(this.ack(n.id)),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(n){if(this._anyListeners&&this._anyListeners.length){const s=this._anyListeners.slice();for(const a of s)a.apply(this,n)}super.emit.apply(this,n),this._pid&&n.length&&typeof n[n.length-1]=="string"&&(this._lastOffset=n[n.length-1])}ack(n){const s=this;let a=!1;return function(...o){a||(a=!0,s.packet({type:qe.ACK,id:n,data:o}))}}onack(n){const s=this.acks[n.id];typeof s=="function"&&(delete this.acks[n.id],s.withError&&n.data.unshift(null),s.apply(this,n.data))}onconnect(n,s){this.id=n,this.recovered=s&&this._pid===s,this._pid=s,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(n=>this.emitEvent(n)),this.receiveBuffer=[],this.sendBuffer.forEach(n=>{this.notifyOutgoingListeners(n),this.packet(n)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(n=>n()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:qe.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(n){return this.flags.compress=n,this}get volatile(){return this.flags.volatile=!0,this}timeout(n){return this.flags.timeout=n,this}onAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(n),this}prependAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(n),this}offAny(n){if(!this._anyListeners)return this;if(n){const s=this._anyListeners;for(let a=0;a<s.length;a++)if(n===s[a])return s.splice(a,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(n),this}prependAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(n),this}offAnyOutgoing(n){if(!this._anyOutgoingListeners)return this;if(n){const s=this._anyOutgoingListeners;for(let a=0;a<s.length;a++)if(n===s[a])return s.splice(a,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(n){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const s=this._anyOutgoingListeners.slice();for(const a of s)a.apply(this,n.data)}}}function Nr(r){r=r||{},this.ms=r.min||100,this.max=r.max||1e4,this.factor=r.factor||2,this.jitter=r.jitter>0&&r.jitter<=1?r.jitter:0,this.attempts=0}Nr.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var n=Math.random(),s=Math.floor(n*this.jitter*r);r=(Math.floor(n*10)&1)==0?r-s:r+s}return Math.min(r,this.max)|0};Nr.prototype.reset=function(){this.attempts=0};Nr.prototype.setMin=function(r){this.ms=r};Nr.prototype.setMax=function(r){this.max=r};Nr.prototype.setJitter=function(r){this.jitter=r};class Jf extends gt{constructor(n,s){var a;super(),this.nsps={},this.subs=[],n&&typeof n=="object"&&(s=n,n=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,Qo(this,s),this.reconnection(s.reconnection!==!1),this.reconnectionAttempts(s.reconnectionAttempts||1/0),this.reconnectionDelay(s.reconnectionDelay||1e3),this.reconnectionDelayMax(s.reconnectionDelayMax||5e3),this.randomizationFactor((a=s.randomizationFactor)!==null&&a!==void 0?a:.5),this.backoff=new Nr({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||cw;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 K_(this.uri,this.opts);const s=this.engine,a=this;this._readyState="opening",this.skipReconnect=!1;const o=Nn(s,"open",function(){a.onopen(),n&&n()}),f=m=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",m),n?n(m):this.maybeReconnectOnOpen()},h=Nn(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(h),this}connect(n){return this.open(n)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const n=this.engine;this.subs.push(Nn(n,"ping",this.onping.bind(this)),Nn(n,"data",this.ondata.bind(this)),Nn(n,"error",this.onerror.bind(this)),Nn(n,"close",this.onclose.bind(this)),Nn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(n){try{this.decoder.add(n)}catch(s){this.onclose("parse error",s)}}ondecoded(n){Jo(()=>{this.emitReserved("packet",n)},this.setTimeoutFn)}onerror(n){this.emitReserved("error",n)}socket(n,s){let a=this.nsps[n];return a?this._autoConnect&&!a.active&&a.connect():(a=new Ig(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 Oa={};function No(r,n){typeof r=="object"&&(n=r,r=void 0),n=n||{};const s=Z_(r,n.path||"/socket.io"),a=s.source,o=s.id,f=s.path,h=Oa[o]&&f in Oa[o].nsps,m=n.forceNew||n["force new connection"]||n.multiplex===!1||h;let g;return m?g=new Jf(a,n):(Oa[o]||(Oa[o]=new Jf(a,n)),g=Oa[o]),s.query&&!n.query&&(n.query=s.queryKey),g.socket(s.path,n)}Object.assign(No,{Manager:Jf,Socket:Ig,io:No,connect:No});const fw=T.createContext({connected:!1,subscribe:()=>()=>{}});function hw({children:r}){const n=T.useRef(null),[s,a]=T.useState(!1),o=T.useRef(new Map),f=T.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))}},[]),h=T.useCallback((m,g)=>{for(const[y,E]of o.current)if(qg(m,y))for(const w of E)try{w(g)}catch{}},[]);return T.useEffect(()=>{const m=yg(),g=No({path:`${Wt}/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;h(y,w)}catch{}}),()=>{g.removeAllListeners(),g.disconnect(),n.current=null,a(!1)}},[h]),d.jsx(fw.Provider,{value:{connected:s,subscribe:f},children:d.jsx(Va.Provider,{value:{connected:s,subscribe:f},children:r})})}function dw({children:r}){const[n,s]=T.useState(null),[a,o]=T.useState({url:null,token:null});return T.useEffect(()=>{let f=!1;async function h(){var m;try{console.log("[lt-transport] detecting event transport...");const g=await fetch(`${Wt}/api/settings`);if(!g.ok){console.warn("[lt-transport] settings fetch failed, falling back to socketio"),f||s("socketio");return}const y=await g.json(),E=(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,O=null;const q=yg();if(q)try{const M=await fetch(`${Wt}/api/nats-credentials`,{headers:{Authorization:`Bearer ${q}`}});if(M.ok){const D=await M.json();w=D.natsWsUrl??w,O=D.natsToken??null}}catch{console.warn("[lt-transport] failed to fetch NATS credentials")}o({url:w,token:O})}s(E==="nats"?"nats":"socketio")}}catch(g){console.warn("[lt-transport] settings fetch error, falling back to socketio",g),f||s("socketio")}}return h(),()=>{f=!0}},[]),n==="nats"?d.jsx(y_,{url:a.url,token:a.token,children:r}):n==="socketio"?d.jsx(hw,{children:r}):d.jsx(d.Fragment,{children:r})}function Xg(){const{isSuperAdmin:r,hasRoleType:n,hasRole:s}=Oi(),a=r||s("engineer"),o=n("admin"),f=r||n("admin");return{isBuilder:a,isOps:o,canBulk:f}}const Qf="lt_ai_override";function mw(){return $e("/settings")}function If(){try{if(localStorage.getItem(Qf)==="off")return!1}catch{}return null}function Io(){var s;const r=Mn({queryKey:["settings"],queryFn:mw,staleTime:1/0}),n=If();return r.data&&n===!1&&((s=r.data.ai)!=null&&s.enabled)?{...r,data:{...r.data,ai:{enabled:!1}}}:r}function pw(){const[r,n]=T.useState(()=>If()===!1),s=T.useCallback(()=>{const a=If()===!1;try{a?localStorage.removeItem(Qf):localStorage.setItem(Qf,"off")}catch{}n(!a),window.location.reload()},[]);return{aiOverrideActive:r,toggleAIOverride:s}}const Kg=T.createContext(null),P0="lt_sidebar_collapsed";function gw({children:r}){const[n,s]=T.useState(()=>{try{return localStorage.getItem(P0)==="true"}catch{return!1}}),a=T.useCallback(()=>{s(o=>{const f=!o;try{localStorage.setItem(P0,String(f))}catch{}return f})},[]);return d.jsx(Kg.Provider,{value:{collapsed:n,toggle:a},children:r})}function Zg(){const r=T.useContext(Kg);if(!r)throw new Error("useSidebar must be used within SidebarProvider");return r}function Wg(r,n){var s,a,o,f,h;n.facets&&Object.keys(n.facets).length&&r.set("facets",JSON.stringify(n.facets)),(s=n.block)!=null&&s.length&&r.set("block",JSON.stringify(n.block)),(a=n.range)!=null&&a.length&&r.set("range",JSON.stringify(n.range)),(o=n.exists)!=null&&o.length&&r.set("exists",JSON.stringify(n.exists)),(f=n.roles)!=null&&f.length&&r.set("roles",JSON.stringify(n.roles)),(h=n.orderBy)!=null&&h.length&&r.set("orderBy",JSON.stringify(n.orderBy)),n.available!==void 0&&r.set("available",String(n.available))}function ME(r){const n=r?`?period=${r}`:"";return Mn({queryKey:["escalationStats",r],queryFn:()=>$e(`/escalations/stats${n}`)})}function RE(){return Mn({queryKey:["escalationTypes"],queryFn:()=>$e("/escalations/types")})}function DE(r=!0){return Mn({queryKey:["escalationFacetKeys"],queryFn:()=>$e("/escalations/facet-keys"),enabled:r,staleTime:6e4})}function yw(r){const{enabled:n=!0,staleTime:s,...a}=r,o=new URLSearchParams;return a.status&&o.set("status",a.status),a.role&&o.set("role",a.role),a.type&&o.set("type",a.type),a.subtype&&o.set("subtype",a.subtype),a.assigned_to&&o.set("assigned_to",a.assigned_to),a.claimed&&o.set("claimed","true"),a.priority&&o.set("priority",String(a.priority)),a.limit&&o.set("limit",String(a.limit)),a.offset!==void 0&&o.set("offset",String(a.offset)),a.sort_by&&o.set("sort_by",a.sort_by),a.order&&o.set("order",a.order),a.search&&o.set("search",a.search),Wg(o,a),Mn({queryKey:["escalations",a],queryFn:()=>$e(`/escalations?${o}`),enabled:n,...s!==void 0?{staleTime:s}:{}})}function bw(r){const{enabled:n=!0,staleTime:s,...a}=r,o=new URLSearchParams;return a.role&&o.set("role",a.role),a.type&&o.set("type",a.type),a.subtype&&o.set("subtype",a.subtype),a.priority&&o.set("priority",String(a.priority)),a.limit&&o.set("limit",String(a.limit)),a.offset!==void 0&&o.set("offset",String(a.offset)),a.sort_by&&o.set("sort_by",a.sort_by),a.order&&o.set("order",a.order),a.search&&o.set("search",a.search),Wg(o,a),Mn({queryKey:["escalations","available",a],queryFn:()=>$e(`/escalations/available?${o}`),enabled:n,...s!==void 0?{staleTime:s}:{}})}function zE(r){return Mn({queryKey:["escalations","by-workflow",r],queryFn:()=>$e(`/escalations/by-workflow/${r}`),enabled:!!r})}function qE(r){return Mn({queryKey:["escalations",r],queryFn:()=>$e(`/escalations/${r}`),enabled:!!r})}function UE(){const r=rn();return _n({mutationFn:({id:n,durationMinutes:s})=>$e(`/escalations/${n}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:s})}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function BE(){const r=rn();return _n({mutationFn:n=>$e(`/escalations/${n}/release`,{method:"POST"}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function LE(){const r=rn();return _n({mutationFn:({id:n,resolverPayload:s})=>$e(`/escalations/${n}/resolve`,{method:"POST",body:JSON.stringify({resolverPayload:s})}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]}),r.resetQueries({queryKey:["tasks"]}),r.resetQueries({queryKey:["jobs"]})}})}function HE(){const r=rn();return _n({mutationFn:({id:n,targetRole:s})=>$e(`/escalations/${n}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:s})}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function PE(){const r=rn();return _n({mutationFn:({ids:n,priority:s})=>$e("/escalations/priority",{method:"PATCH",body:JSON.stringify({ids:n,priority:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function $E(){const r=rn();return _n({mutationFn:({ids:n,durationMinutes:s})=>$e("/escalations/bulk-claim",{method:"POST",body:JSON.stringify({ids:n,durationMinutes:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function YE(){const r=rn();return _n({mutationFn:({ids:n,targetUserId:s,durationMinutes:a})=>$e("/escalations/bulk-assign",{method:"POST",body:JSON.stringify({ids:n,targetUserId:s,durationMinutes:a})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function GE(){const r=rn();return _n({mutationFn:({ids:n,targetRole:s})=>$e("/escalations/bulk-escalate",{method:"PATCH",body:JSON.stringify({ids:n,targetRole:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function VE(){const r=rn();return _n({mutationFn:({ids:n,hint:s})=>$e("/escalations/bulk-triage",{method:"POST",body:JSON.stringify({ids:n,...s?{hint:s}:{}})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function FE(){const r=rn();return _n({mutationFn:n=>$e(`/escalations/${n}/cancel`,{method:"POST"}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function JE(){const r=rn();return _n({mutationFn:({ids:n})=>$e("/escalations/bulk-cancel",{method:"POST",body:JSON.stringify({ids:n})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function xw(){const{user:r}=Oi(),n=r==null?void 0:r.userId,s=rn(),a=T.useRef(null),o=T.useCallback(()=>{a.current||(a.current=setTimeout(()=>{a.current=null,s.invalidateQueries({queryKey:["escalations"]})},15e3))},[s]);m_(`${h_}.system.escalation.>`,o);const{data:f}=bw({limit:1}),{data:h}=yw({assigned_to:n,status:"pending",limit:1});return{available:(f==null?void 0:f.total)??0,mine:(h==null?void 0:h.total)??0}}function dh({size:r="sm",hideLabel:n=!1,className:s=""}){const a=r==="lg",o=a?"w-[16rem] h-[16rem] -rotate-[120deg] opacity-40 -ml-10":"w-[12.5rem] h-[12.5rem] -rotate-[120deg] opacity-40 -ml-8",f=a?"text-[44px] font-normal text-text-primary tracking-[0.15em] -ml-[12.5rem]":"text-[36px] font-normal text-text-primary tracking-[0.15em] -ml-[9.75rem]";return d.jsxs("div",{className:`flex items-center ${s}`,style:{height:"50px"},children:[d.jsx("img",{src:`${Wt}/logo512.png`,alt:"LongTail",className:`shrink-0 z-0 ${o}`}),d.jsx("span",{className:`z-[1] transition-opacity duration-300 ${f} ${n?"opacity-0":""}`,children:"LongTail"})]})}function vw({onToggleEventFeed:r,onToggleDocs:n}){const{user:s,logout:a}=Oi(),{isBuilder:o}=Xg(),{available:f,mine:h}=xw(),{connected:m}=d_(),{toggleAIOverride:g}=pw(),[y,E]=T.useState(!1),w=T.useRef(null);return T.useEffect(()=>{if(!y)return;const O=q=>{w.current&&!w.current.contains(q.target)&&E(!1)};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[y]),d.jsxs("header",{className:"h-14 shrink-0 border-b border-surface-border bg-surface-raised flex items-center justify-between px-5 relative z-30",children:[d.jsx("div",{className:"flex items-center gap-4",children:d.jsx(yr,{to:"/","aria-label":"Home",onClick:O=>{(O.ctrlKey||O.metaKey)&&(O.preventDefault(),g())},children:d.jsx(dh,{})})}),d.jsxs("div",{className:"flex items-center gap-5",children:[d.jsxs(yr,{to:"/escalations/available",className:`flex items-center gap-1.5 text-[11px] transition-colors ${f>0?"text-blue-400 hover:text-blue-300":"text-text-quaternary hover:text-text-secondary"}`,title:"Available escalations",children:[d.jsx(Ef,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"available",f>0&&d.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:f})]}),d.jsxs(yr,{to:"/escalations/queue",className:`flex items-center gap-1.5 text-[11px] transition-colors ${h>0?"text-status-warning hover:text-amber-300":"text-text-quaternary hover:text-text-secondary"}`,title:"My escalation queue",children:[d.jsx(Ef,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"mine",h>0&&d.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:h})]}),o&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"w-px h-4 bg-surface-border"}),d.jsxs("button",{type:"button",onClick:()=>{m?r==null||r():window.location.reload()},className:`flex items-center gap-1.5 text-[11px] transition-colors ${m?"text-emerald-400 hover:text-emerald-300":"text-text-quaternary hover:text-text-secondary"}`,title:m?"Live events — click to toggle feed":"Events disconnected — click to reconnect",children:[d.jsx(hg,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"events"]}),d.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:[d.jsx(dg,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"docs"]})]}),d.jsx("div",{className:"w-px h-4 bg-surface-border"}),s&&d.jsxs("div",{className:"relative",ref:w,children:[d.jsxs("button",{onClick:()=>E(O=>!O),className:"btn-ghost text-xs flex items-center gap-1",children:[d.jsx(Cx,{className:"w-3.5 h-3.5 text-accent/75",strokeWidth:1.5}),s.displayName||s.username||s.userId,d.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),y&&d.jsxs("div",{className:"absolute right-0 top-full mt-1 w-48 bg-surface-raised border border-surface-border rounded-md shadow-lg py-1 z-50",children:[d.jsx(yr,{to:"/credentials",onClick:()=>E(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Credentials"}),d.jsx("button",{onClick:()=>{E(!1),a()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Sign Out"})]})]})]})]})}function mh({open:r,children:n}){const[s,a]=T.useState(r);return T.useEffect(()=>{r&&a(!0)},[r]),d.jsx("div",{className:`grid transition-[grid-template-rows] duration-300 ease-out ${r?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,onTransitionEnd:()=>{r||a(!1)},children:d.jsx("div",{className:"overflow-hidden",children:s?n:null})})}function Xf(r){return({isActive:n})=>{const s="flex items-center rounded-md transition-colors duration-150",a="bg-surface-hover text-text-primary font-medium",o="text-text-secondary hover:text-text-primary hover:bg-surface-hover";return r?`${s} justify-center w-10 h-10 mx-auto ${n?a:o}`:`${s} gap-3 px-4 py-2 text-sm ${n?a:o}`}}function _w(){return({isActive:r})=>`flex items-center gap-3 pl-11 pr-4 py-1.5 text-xs rounded-md transition-colors duration-150 ${r?"text-text-primary font-medium":"text-text-secondary hover:text-text-primary"}`}function ww({group:r,collapsed:n}){const{pathname:s}=Ws(),a=r.matchPaths.some(m=>s.startsWith(m)),[o,f]=T.useState(a),h=o||a;return n?d.jsx(d.Fragment,{children:r.items.map(m=>d.jsx(Co,{to:m.to,className:Xf(!0),title:m.label,children:m.icon&&d.jsx(m.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})},m.to))}):d.jsxs("div",{children:[d.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:[d.jsxs("span",{className:"flex items-center gap-3",children:[r.icon&&d.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),d.jsx("span",{children:r.label})]}),d.jsx("svg",{className:`w-3.5 h-3.5 text-text-tertiary transition-transform duration-150 ${h?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),d.jsx(mh,{open:h,children:r.items.map(m=>d.jsxs(Co,{to:m.to,end:m.end,className:_w(),children:[m.icon&&d.jsx(m.icon,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),d.jsx("span",{children:m.label})]},m.to))})]})}function Sw(r){return r.kind==="group"}function Ew({entry:r,collapsed:n}){const{pathname:s,search:a}=Ws();if(r.to.includes("?")){const[f,h]=r.to.split("?"),m=s===f&&a===`?${h}`,g=Xf(n)({isActive:m});return d.jsxs(Co,{to:r.to,className:g,title:n?r.label:void 0,children:[r.icon&&d.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),!n&&d.jsx("span",{children:r.label})]})}return d.jsxs(Co,{to:r.to,end:r.end,className:Xf(n),title:n?r.label:void 0,children:[r.icon&&d.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),!n&&d.jsx("span",{children:r.label})]})}function ji({heading:r,entries:n}){const{collapsed:s}=Zg();return d.jsxs("div",{className:"space-y-1",children:[s?d.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:r}):d.jsx("p",{className:"px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-accent/80",children:r}),n.map(a=>Sw(a)?d.jsx(ww,{group:a,collapsed:s},a.label):d.jsx(Ew,{entry:a,collapsed:s},a.to))]})}function Aw({aiEnabled:r=!1,isBuilder:n=!1}){if(!n){const a=[{to:"/escalations/queue",label:"My Queue",icon:Ef},{to:"/escalations/available",label:"Available",icon:Af}];return d.jsx(ji,{heading:"Work",entries:a})}const s=[{to:"/topics",label:"Event Topics",icon:hg},{to:"/agents",label:r?"Agents":"Automations",icon:kx},{to:"/capabilities",label:"Capabilities",icon:Mx}];return d.jsx(ji,{heading:"React",entries:s})}function jw(){const r=[{kind:"group",label:"Procedural",icon:Rx,matchPaths:["/workflows/registry","/workflows/durable/invoke","/workflows/executions","/workflows/durable/executions","/workflows/start","/workflows/workers","/workflows/tasks"],items:[{to:"/workflows/registry",label:"Registry",icon:s0},{to:"/workflows/durable/invoke",label:"Invoke",icon:i0},{to:"/workflows/executions",label:"Executions",icon:Af}]},{kind:"group",label:"Graph",icon:Kf,matchPaths:["/mcp/workflows","/mcp/executions"],items:[{to:"/mcp/workflows",label:"Configure",icon:s0,end:!0},{to:"/mcp/workflows/invoke",label:"Invoke",icon:i0},{to:"/mcp/executions",label:"Executions",icon:Af}]}];return d.jsx(ji,{heading:"Orchestrate",entries:r})}const Ow=[{to:"/mcp/queries",label:"Designer",icon:Dx},{to:"/mcp/servers",label:"Servers & Tools",icon:zx}];function Tw(){return d.jsx(ji,{heading:"Design",entries:Ow})}const Nw=[{to:"/files",label:"Files",icon:qx},{to:"/knowledge",label:"Knowledge",icon:Ux}];function Cw(){return d.jsx(ji,{heading:"Storage",entries:Nw})}function kw({isBuilder:r=!1}){var f;const{data:n}=Io(),s=((f=n==null?void 0:n.features)==null?void 0:f.dbMaintenance)!==!1,a=[{to:"/admin/users",label:"Accounts",icon:Bx},...r?[{to:"/admin/roles",label:"Roles",icon:Lx}]:[]],o=[{to:"/admin/controlplane",label:"Routers",icon:Hx},{to:"/admin/streams",label:"Messages",icon:Px},...s?[{to:"/admin/maintenance",label:"DB Maintenance",icon:$x}]:[]];return d.jsxs(d.Fragment,{children:[d.jsx(ji,{heading:"Identity & Access",entries:a}),r&&d.jsx(ji,{heading:"Infrastructure",entries:o})]})}const ey="lt_event_feed_patterns";function Mw(r){if(r.startsWith("/topics/")){const f=decodeURIComponent(r.replace("/topics/",""));if(f&&!f.includes("/"))return`lt.events.${f}`}const n=r.match(/^\/escalations\/detail\/(.+)/);if(n)return`lt.events.system.escalation.${n[1]}.>`;if(r.startsWith("/escalations"))return"lt.events.system.escalation.>";const s=r.match(/^\/workflows\/(?:durable\/)?executions\/(.+)/);if(s)return`lt.events.system.workflow.${s[1]}.>`;if(r.startsWith("/workflows"))return"lt.events.system.workflow.>";const a=r.match(/^\/agents\/([^/]+)$/);if(a&&a[1]!=="new")return`lt.events.system.agent.${a[1]}.>`;if(r.startsWith("/agents"))return"lt.events.system.agent.>";if(r.startsWith("/knowledge"))return"lt.events.system.knowledge.>";if(r.startsWith("/files"))return"lt.events.system.file.>";if(r==="/")return"lt.events.system.>";const o=r.match(/^\/mcp\/executions\/(.+)/);return o?`lt.events.system.*.${o[1]}.>`:(r.startsWith("/mcp"),"lt.events.system.>")}function Rw(){try{const r=localStorage.getItem(ey);return r?JSON.parse(r):[]}catch{return[]}}function _f(r){try{localStorage.setItem(ey,JSON.stringify(r))}catch{}}function Dw(){const{pathname:r}=Ws(),[n,s]=T.useState(Rw),a=T.useMemo(()=>Mw(r),[r]),o=T.useMemo(()=>{const g=new Set([a,...n]);return Array.from(g)},[a,n]),f=T.useCallback(g=>{const y=g.startsWith("lt.events.")?g:`lt.events.${g}`;s(E=>{if(E.includes(y))return E;const w=[...E,y];return _f(w),w})},[]),h=T.useCallback(g=>{s(y=>{const E=y.filter(w=>w!==g);return _f(E),E})},[]),m=T.useCallback(()=>{s([]),_f([])},[]);return{patterns:o,pagePattern:a,userPatterns:n,addPattern:f,removePattern:h,clearUserPatterns:m}}function zw({children:r,className:n=""}){return d.jsx("p",{className:`text-[10px] font-semibold uppercase tracking-widest text-text-tertiary ${n}`,children:r})}const wf=280,$0="cubic-bezier(0.4, 0, 0.2, 1)",_o=40;function qw(r){if(!r)return"scale(0.92)";const n=window.innerWidth,s=window.innerHeight,a=n-_o*2,o=s-_o*2,f=r.width/a,h=r.height/o,m=r.left+r.width/2-(_o+a/2),g=r.top+r.height/2-(_o+o/2);return`translate(${m}px, ${g}px) scale(${f}, ${h})`}function ty({open:r,onClose:n,sourceRef:s,children:a}){const[o,f]=T.useState(null),h=T.useRef(null),m=T.useRef(!1);T.useEffect(()=>{var O,q;r&&!m.current?(h.current=((O=s==null?void 0:s.current)==null?void 0:O.getBoundingClientRect())??null,f("entering")):!r&&m.current&&o==="open"&&(h.current=((q=s==null?void 0:s.current)==null?void 0:q.getBoundingClientRect())??null,f("exiting")),m.current=r},[r,s,o]),T.useEffect(()=>{if(o!=="entering")return;const O=requestAnimationFrame(()=>{requestAnimationFrame(()=>f("open"))});return()=>cancelAnimationFrame(O)},[o]),T.useEffect(()=>{if(o)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[o]),T.useEffect(()=>{if(!o)return;const O=q=>{q.key==="Escape"&&n()};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[o,n]);const g=T.useCallback(O=>{O.propertyName==="transform"&&o==="exiting"&&f(null)},[o]);if(T.useEffect(()=>{if(o!=="exiting")return;const O=setTimeout(()=>f(null),wf+50);return()=>clearTimeout(O)},[o]),!o)return null;const y=o==="entering"||o==="exiting",E=y?qw(h.current):"none",w=y?0:1;return ug.createPortal(d.jsx("div",{className:"fixed inset-0 z-50 overflow-auto p-10",style:{transformOrigin:"center center",transition:`transform ${wf}ms ${$0}, opacity ${wf}ms ${$0}`,transform:E,opacity:w,backgroundColor:"#FFFFFF"},onTransitionEnd:g,children:a}),document.body)}function Uw({className:r}){return d.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h8M4 18h12"})})}function Bw({className:r}){return d.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 7l-5 5 5 5M16 7l5 5-5 5"})})}function Lw({className:r}){return d.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d.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 Hw({className:r}){return d.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}function Pw({className:r}){return d.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d.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 $w({className:r}){return d.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d.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 Yw(r){const n=r.trim().split(`
|
|
54
|
-
`);if(n.length<2)return r;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(""),h=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>${h}</tbody></table>`}function
|
|
53
|
+
${m.stack}`),h.reject(y)):h.resolve(E))}});return g.requestSubject=n,this.protocol.publish(n,s,{reply:f,headers:a.headers}),h}else{const f=new Ag(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 h=Promise.race([f.timer,f.deferred]);return h.catch(()=>{f.cancel()}),h}}flush(){return this.isClosed()?Promise.reject(ue.errorForCode(ie.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(ue.errorForCode(ie.ConnectionClosed)):this.isDraining()?Promise.reject(ue.errorForCode(ie.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const n=this.protocol.getServer();return n?n.listen:""}status(){const n=new _t;return n.iterClosed.then(()=>{const s=this.listeners.indexOf(n);this.listeners.splice(s,1)}),this.listeners.push(n),n}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((s,a)=>s==="time"?new Date(Date.parse(a)):a)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(n={}){const s=new F1(this,n);if(n.checkAPI!==!1)try{await s.getAccountInfo()}catch(a){const o=a;throw o.code===ie.NoResponders&&(o.code=ie.JetStreamNotEnabled),o}return s}jetstream(n={}){return new ah(this,n)}getServerVersion(){const n=this.info;return n?ji(n.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw ue.errorForCode(ie.Disconnect);const n=Date.now();return await this.flush(),Date.now()-n}get features(){return this.protocol.features}get services(){return this._services||(this._services=new X1(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(ue.errorForCode(ie.ConnectionClosed)):this.isDraining()?Promise.reject(ue.errorForCode(ie.ConnectionDraining)):this.protocol.reconnect()}}class X1{constructor(n){v(this,"nc");this.nc=n}add(n){try{return new Va(this.nc,n).start()}catch(s){return Promise.reject(s)}}client(n,s){return new N1(this.nc,n,s)}}class K1{constructor(n,s,a){v(this,"bucket");v(this,"sm");v(this,"prefixLen");this.bucket=n,this.prefixLen=s,this.sm=a}get key(){return this.sm.subject.substring(this.prefixLen)}get value(){return this.sm.data}get delta(){return 0}get created(){return this.sm.time}get revision(){return this.sm.seq}get operation(){return this.sm.header.get(Bo)||"PUT"}get length(){const n=this.sm.header.get(Dt.MessageSizeHdr)||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Z1{constructor(n,s,a){v(this,"bucket");v(this,"key");v(this,"sm");this.bucket=n,this.key=s,this.sm=a}get value(){return this.sm.data}get created(){return new Date(th(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var n;return((n=this.sm.headers)==null?void 0:n.get(Bo))||"PUT"}get delta(){return this.sm.info.pending}get length(){var s;const n=((s=this.sm.headers)==null?void 0:s.get(Dt.MessageSizeHdr))||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class zg extends Pv{constructor(s,a,o){super(s.nc,a,o);v(this,"js");v(this,"monitor");this.js=s,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(s){this.sub.info=s}get info(){return this.sub.info}_resetOrderedConsumer(s){if(this.info===null||this.sub.isClosed())return;const a=fs(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,a);const f=this.info;f.config.name=Zs.next(),f.ordered_consumer_sequence.delivery_seq=0,f.flow_control.heartbeat_count=0,f.flow_control.fc_count=0,f.flow_control.consumer_restarts++,f.deliver=a,f.config.deliver_subject=a,f.config.deliver_policy=ft.StartSequence,f.config.opt_start_seq=s;const h={};h.stream_name=this.info.stream,h.config=f.config;const m=`${f.api.prefix}.CONSUMER.CREATE.${f.stream}`;this.js._request(m,h,{retries:-1}).then(g=>{const y=g,E=this.sub.info;E.last=y,this.info.config=y.config,this.info.name=y.name}).catch(g=>{const y=new ue(`unable to recreate ordered consumer ${f.stream} at seq ${s}`,ie.RequestError,g);this.sub.callback(y,{})})}_maybeSetupHbMonitoring(){var a,o;const s=((o=(a=this.info)==null?void 0:a.config)==null?void 0:o.idle_heartbeat)||0;s&&this._setupHbMonitoring(th(s))}_setupHbMonitoring(s,a=0){const o={cancelAfter:0,maxOut:2};a&&(o.cancelAfter=a);const f=this.sub,h=m=>{var E,w,T,q;const g=_v(409,`${xn.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),(q=this.monitor)==null||q.restart(),!1}return!f.noIterator};this.monitor=new sh(s,h,o)}_checkHbOrderConsumer(s){const a=s.headers.get(Dt.ConsumerStalledHdr);a!==""&&this.js.nc.publish(a);const o=parseInt(s.headers.get(Dt.LastConsumerSeqHdr),10),f=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,o!==f.delivery_seq&&this._resetOrderedConsumer(f.stream_seq+1),!1}_checkOrderedConsumer(s){const a=this.info.ordered_consumer_sequence,o=s.info.streamSequence,f=s.info.deliverySequence;return f!=a.delivery_seq+1?(this._resetOrderedConsumer(a.stream_seq+1),!1):(a.delivery_seq=f,a.stream_seq=o,!0)}async destroy(){this.isClosed()||await this.drain();const s=this.sub.info,a=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.DELETE.${s.stream}.${a}`;await s.api._request(o)}async consumerInfo(){const s=this.sub.info,a=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.INFO.${s.stream}.${a}`,f=await s.api._request(o);return s.last=f,f}}class W1 extends 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,h={};if(h.batch=n.batch||1,h.no_wait=n.no_wait||!1,(n.max_bytes??0)>0){const y=this.js.nc.features.get(Ue.JS_PULL_MAX_BYTES);if(!y.ok)throw new Error(`max_bytes is only supported on servers ${y.min} or better`);h.max_bytes=n.max_bytes}let m=0;n.expires&&n.expires>0&&(m=n.expires,h.expires=nt(m));let g=0;if(n.idle_heartbeat&&n.idle_heartbeat>0&&(g=n.idle_heartbeat,h.idle_heartbeat=nt(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(h),{reply:w})}}}function e_(r,n){return r?n_(n):t_(n)}function t_(r){return(n,s)=>n?[n,null]:(n=wr(s),n?[n,null]:[null,$a(s,r)])}function n_(r){return(n,s)=>{if(n)return[n,null];const a=wr(s);return a!==null?[qg(a),null]:[null,$a(s,r)]}}function qg(r){if(r!==null)switch(r.code){case ie.JetStream404NoMessages:case ie.JetStream408RequestTimeout:return null;case ie.JetStream409:return wv(r)?r:null;default:return r}return null}function s_(r){r&&r.ack()}function i_(r){const n=r.split(".");if(n.length===9&&n.splice(2,0,"_",""),n.length<11||n[0]!=="$JS"||n[1]!=="ACK")throw new Error("not js message");const s={};return s.domain=n[2]==="_"?"":n[2],s.account_hash=n[3],s.stream=n[4],s.consumer=n[5],s.deliveryCount=parseInt(n[6],10),s.redeliveryCount=s.deliveryCount,s.redelivered=s.deliveryCount>1,s.streamSequence=parseInt(n[7],10),s.deliverySequence=parseInt(n[8],10),s.timestampNanos=parseInt(n[9],10),s.pending=parseInt(n[10],10),s}class r_{constructor(n,s){v(this,"msg");v(this,"di");v(this,"didAck");v(this,"timeout");this.msg=n,this.didAck=!1,this.timeout=s}get subject(){return this.msg.subject}get sid(){return this.msg.sid}get data(){return this.msg.data}get headers(){return this.msg.headers}get info(){return this.di||(this.di=i_(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(n){this.didAck||(this.didAck=!this.isWIP(n),this.msg.respond(n))}isWIP(n){return n.length===4&&n[0]===ja[0]&&n[1]===ja[1]&&n[2]===ja[2]&&n[3]===ja[3]}async ackAck(n){var a;n=n||{},n.timeout=n.timeout||this.timeout;const s=st();if(this.didAck)s.resolve(!1);else if(this.didAck=!0,this.msg.reply){const f=this.msg.publisher,h=!((a=f.options)!=null&&a.noAsyncTraces),m=new Ag(f.muxSubscriptions,this.msg.reply,{timeout:n.timeout},h);f.request(m);try{f.publish(this.msg.reply,z0,{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(z0)}nak(n){let s=L1;n&&(s=Tf().encode(`-NAK ${JSON.stringify({delay:nt(n)})}`)),this.doAck(s)}working(){this.doAck(ja)}next(n,s={batch:1}){const a={};a.batch=s.batch||1,a.no_wait=s.no_wait||!1,s.expires&&s.expires>0&&(a.expires=nt(s.expires));const o=Mn().encode(a),f=Or.concat(H1,$1,o),h=n?{reply:n}:void 0;this.msg.respond(f,h)}term(n=""){let s=P1;(n==null?void 0:n.length)>0&&(s=Tf().encode(`+TERM ${n}`)),this.doAck(s)}json(){return this.msg.json()}string(){return this.msg.string()}}const a_="1.30.3",l_="nats.ws";class o_{constructor(){v(this,"version");v(this,"lang");v(this,"closeError");v(this,"connected");v(this,"done");v(this,"socket");v(this,"options");v(this,"socketClosed");v(this,"encrypted");v(this,"peeked");v(this,"yields");v(this,"signal");v(this,"closedNotification");this.version=a_,this.lang=l_,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=st(),this.closedNotification=st()}async connect(n,s){const a=st();if(s.tls)return a.reject(new ue("tls",ie.InvalidOption)),a;this.options=s;const o=n.src;if(s.wsFactory){const{socket:f,encrypted:h}=await s.wsFactory(n.src,s);this.socket=f,this.encrypted=h}else this.encrypted=o.indexOf("wss://")===0,this.socket=new WebSocket(o);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=f=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(f.data)),this.peeked){this.signal.resolve();return}const h=Or.concat(...this.yields),m=Jv(h);if(m!==""){const g=_1.exec(m);if(!g){s.debug&&console.error("!!!",go(h)),a.reject(new Error("unexpected response from server"));return}try{const y=JSON.parse(g[1]);x1(y,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),a.resolve()}catch(y){a.reject(y);return}}},this.socket.onclose=f=>{if(this.isDiscarded())return;this.socketClosed=!0;let h;this.done||(f.wasClean||(h=new Error(f.reason)),this._closed(h))},this.socket.onerror=f=>{if(this.isDiscarded())return;const h=f,m=new ue(h.message,ie.Unknown,new Error(h.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 Tr(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(`> ${go(n[s])}`),yield n[s];if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=st())}}isEncrypted(){return this.connected&&this.encrypted}send(n){if(!this.isDiscarded())try{this.socket.send(n.buffer),this.options.debug&&console.info(`< ${go(n)}`);return}catch(s){this.options.debug&&console.error(`!!! ${go(n)}: ${s}`)}}close(n){return this._closed(n,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var n;this.done=!0;try{(n=this.socket)==null||n.close()}catch{}}}function c_(r,n){/^(.*:\/\/)(.*)/.test(r)||(typeof n=="boolean"?r=`${n===!0?"https":"http"}://${r}`:r=`https://${r}`);let a=new URL(r);const o=a.protocol.toLowerCase();o==="ws:"&&(n=!1),o==="wss:"&&(n=!0),o!=="https:"&&o!=="http"&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2"),a=new URL(`http://${r}`));let f,h;const m=a.hostname,g=a.pathname,y=a.search||"";switch(o){case"http:":case"ws:":case"nats:":h=a.port||"80",f="ws:";break;case"https:":case"wss:":case"tls:":h=a.port||"443",f="wss:";break;default:h=a.port||n===!0?"443":"80",f=n===!0?"wss:":"ws:";break}return`${f}//${m}:${h}${g}${y}`}function u_(r={}){return $v({defaultPort:443,urlParseFn:c_,factory:()=>new o_}),lh.connect(r)}const f_=null,h_=null,d_="lt.events";function Ug(r,n){const s=r.split("."),a=n.split(".");for(let o=0;o<a.length;o++){const f=a[o];if(f===">")return!0;if(o>=s.length||f!=="*"&&f!==s[o])return!1}return s.length===a.length}const Fa=O.createContext({connected:!1,subscribe:()=>()=>{}});function m_(){const{connected:r}=O.useContext(Fa);return{connected:r}}function p_(r,n){const{subscribe:s}=O.useContext(Fa),a=O.useRef(n);a.current=n,O.useEffect(()=>s(r,f=>a.current(f)),[s,r])}const g_=O.createContext({connected:!1,subscribe:()=>()=>{}}),y_=Tf();function b_({children:r,url:n,token:s}){const a=O.useRef(null),o=O.useRef(null),[f,h]=O.useState(!1),m=O.useRef(null),g=O.useRef(new Map),y=O.useCallback((T,q)=>{const M=g.current;return M.has(T)||M.set(T,new Set),M.get(T).add(q),()=>{const D=M.get(T);D&&(D.delete(q),D.size===0&&M.delete(T))}},[]),E=O.useCallback((T,q)=>{for(const[M,D]of g.current)if(Ug(T,M))for(const W of D)try{W(q)}catch{}},[]),w=O.useCallback(async()=>{try{if(a.current)return;const T=n||f_;if(!T){console.error("[lt-nats] no NATS WebSocket URL configured — set NATS_WS_URL on the server");return}const q=await u_({servers:T,token:s||h_||void 0,reconnect:!0,maxReconnectAttempts:-1,reconnectTimeWait:2e3});a.current=q,h(!0);const M=q.subscribe("lt.>");o.current=M,(async()=>{for await(const D of M)try{const W=JSON.parse(y_.decode(D.data));E(D.subject,W)}catch{}})(),(async()=>{for await(const D of q.status())D.type==="disconnect"||D.type==="error"?h(!1):D.type==="reconnect"&&h(!0)})()}catch{h(!1),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),h(!1)}),[w]),d.jsx(g_.Provider,{value:{connected:f,subscribe:y},children:d.jsx(Fa.Provider,{value:{connected:f,subscribe:y},children:r})})}const $n=Object.create(null);$n.open="0";$n.close="1";$n.ping="2";$n.pong="3";$n.message="4";$n.upgrade="5";$n.noop="6";const jo=Object.create(null);Object.keys($n).forEach(r=>{jo[$n[r]]=r});const $f={type:"error",data:"parser error"},Bg=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Lg=typeof ArrayBuffer=="function",Hg=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,oh=({type:r,data:n},s,a)=>Bg&&n instanceof Blob?s?a(n):U0(n,a):Lg&&(n instanceof ArrayBuffer||Hg(n))?s?a(n):U0(new Blob([n]),a):a($n[r]+(n||"")),U0=(r,n)=>{const s=new FileReader;return s.onload=function(){const a=s.result.split(",")[1];n("b"+(a||""))},s.readAsDataURL(r)};function B0(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}let bf;function x_(r,n){if(Bg&&r.data instanceof Blob)return r.data.arrayBuffer().then(B0).then(n);if(Lg&&(r.data instanceof ArrayBuffer||Hg(r.data)))return n(B0(r.data));oh(r,!1,s=>{bf||(bf=new TextEncoder),n(bf.encode(s))})}const L0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ra=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<L0.length;r++)Ra[L0.charCodeAt(r)]=r;const v_=r=>{let n=r.length*.75,s=r.length,a,o=0,f,h,m,g;r[r.length-1]==="="&&(n--,r[r.length-2]==="="&&n--);const y=new ArrayBuffer(n),E=new Uint8Array(y);for(a=0;a<s;a+=4)f=Ra[r.charCodeAt(a)],h=Ra[r.charCodeAt(a+1)],m=Ra[r.charCodeAt(a+2)],g=Ra[r.charCodeAt(a+3)],E[o++]=f<<2|h>>4,E[o++]=(h&15)<<4|m>>2,E[o++]=(m&3)<<6|g&63;return y},__=typeof ArrayBuffer=="function",ch=(r,n)=>{if(typeof r!="string")return{type:"message",data:Pg(r,n)};const s=r.charAt(0);return s==="b"?{type:"message",data:w_(r.substring(1),n)}:jo[s]?r.length>1?{type:jo[s],data:r.substring(1)}:{type:jo[s]}:$f},w_=(r,n)=>{if(__){const s=v_(r);return Pg(s,n)}else return{base64:!0,data:r}},Pg=(r,n)=>{switch(n){case"blob":return r instanceof Blob?r:new Blob([r]);case"arraybuffer":default:return r instanceof ArrayBuffer?r:r.buffer}},$g="",S_=(r,n)=>{const s=r.length,a=new Array(s);let o=0;r.forEach((f,h)=>{oh(f,!1,m=>{a[h]=m,++o===s&&n(a.join($g))})})},E_=(r,n)=>{const s=r.split($g),a=[];for(let o=0;o<s.length;o++){const f=ch(s[o],n);if(a.push(f),f.type==="error")break}return a};function A_(){return new TransformStream({transform(r,n){x_(r,s=>{const a=s.length;let o;if(a<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,a);else if(a<65536){o=new Uint8Array(3);const f=new DataView(o.buffer);f.setUint8(0,126),f.setUint16(1,a)}else{o=new Uint8Array(9);const f=new DataView(o.buffer);f.setUint8(0,127),f.setBigUint64(1,BigInt(a))}r.data&&typeof r.data!="string"&&(o[0]|=128),n.enqueue(o),n.enqueue(s)})}})}let xf;function vo(r){return r.reduce((n,s)=>n+s.length,0)}function _o(r,n){if(r[0].length===n)return r.shift();const s=new Uint8Array(n);let a=0;for(let o=0;o<n;o++)s[o]=r[0][a++],a===r[0].length&&(r.shift(),a=0);return r.length&&a<r[0].length&&(r[0]=r[0].slice(a)),s}function j_(r,n){xf||(xf=new TextDecoder);const s=[];let a=0,o=-1,f=!1;return new TransformStream({transform(h,m){for(s.push(h);;){if(a===0){if(vo(s)<1)break;const g=_o(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(vo(s)<2)break;const g=_o(s,2);o=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),a=3}else if(a===2){if(vo(s)<8)break;const g=_o(s,8),y=new DataView(g.buffer,g.byteOffset,g.length),E=y.getUint32(0);if(E>Math.pow(2,21)-1){m.enqueue($f);break}o=E*Math.pow(2,32)+y.getUint32(4),a=3}else{if(vo(s)<o)break;const g=_o(s,o);m.enqueue(ch(f?g:xf.decode(g),n)),a=0}if(o===0||o>r){m.enqueue($f);break}}}})}const Yg=4;function gt(r){if(r)return O_(r)}function O_(r){for(var n in gt.prototype)r[n]=gt.prototype[n];return r}gt.prototype.on=gt.prototype.addEventListener=function(r,n){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(n),this};gt.prototype.once=function(r,n){function s(){this.off(r,s),n.apply(this,arguments)}return s.fn=n,this.on(r,s),this};gt.prototype.off=gt.prototype.removeListener=gt.prototype.removeAllListeners=gt.prototype.removeEventListener=function(r,n){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var s=this._callbacks["$"+r];if(!s)return this;if(arguments.length==1)return delete this._callbacks["$"+r],this;for(var a,o=0;o<s.length;o++)if(a=s[o],a===n||a.fn===n){s.splice(o,1);break}return s.length===0&&delete this._callbacks["$"+r],this};gt.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var n=new Array(arguments.length-1),s=this._callbacks["$"+r],a=1;a<arguments.length;a++)n[a-1]=arguments[a];if(s){s=s.slice(0);for(var a=0,o=s.length;a<o;++a)s[a].apply(this,n)}return this};gt.prototype.emitReserved=gt.prototype.emit;gt.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]};gt.prototype.hasListeners=function(r){return!!this.listeners(r).length};const Jo=typeof Promise=="function"&&typeof Promise.resolve=="function"?n=>Promise.resolve().then(n):(n,s)=>s(n,0),vn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),T_="arraybuffer";function Gg(r,...n){return n.reduce((s,a)=>(r.hasOwnProperty(a)&&(s[a]=r[a]),s),{})}const N_=vn.setTimeout,C_=vn.clearTimeout;function Io(r,n){n.useNativeTimers?(r.setTimeoutFn=N_.bind(vn),r.clearTimeoutFn=C_.bind(vn)):(r.setTimeoutFn=vn.setTimeout.bind(vn),r.clearTimeoutFn=vn.clearTimeout.bind(vn))}const k_=1.33;function M_(r){return typeof r=="string"?R_(r):Math.ceil((r.byteLength||r.size)*k_)}function R_(r){let n=0,s=0;for(let a=0,o=r.length;a<o;a++)n=r.charCodeAt(a),n<128?s+=1:n<2048?s+=2:n<55296||n>=57344?s+=3:(a++,s+=4);return s}function Vg(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function D_(r){let n="";for(let s in r)r.hasOwnProperty(s)&&(n.length&&(n+="&"),n+=encodeURIComponent(s)+"="+encodeURIComponent(r[s]));return n}function z_(r){let n={},s=r.split("&");for(let a=0,o=s.length;a<o;a++){let f=s[a].split("=");n[decodeURIComponent(f[0])]=decodeURIComponent(f[1])}return n}class q_ extends Error{constructor(n,s,a){super(n),this.description=s,this.context=a,this.type="TransportError"}}class uh extends gt{constructor(n){super(),this.writable=!1,Io(this,n),this.opts=n,this.query=n.query,this.socket=n.socket,this.supportsBinary=!n.forceBase64}onError(n,s,a){return super.emitReserved("error",new q_(n,s,a)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(n){this.readyState==="open"&&this.write(n)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(n){const s=ch(n,this.socket.binaryType);this.onPacket(s)}onPacket(n){super.emitReserved("packet",n)}onClose(n){this.readyState="closed",super.emitReserved("close",n)}pause(n){}createUri(n,s={}){return n+"://"+this._hostname()+this._port()+this.opts.path+this._query(s)}_hostname(){const n=this.opts.hostname;return n.indexOf(":")===-1?n:"["+n+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(n){const s=D_(n);return s.length?"?"+s:""}}class U_ extends uh{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(n){this.readyState="pausing";const s=()=>{this.readyState="paused",n()};if(this._polling||!this.writable){let a=0;this._polling&&(a++,this.once("pollComplete",function(){--a||s()})),this.writable||(a++,this.once("drain",function(){--a||s()}))}else s()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(n){const s=a=>{if(this.readyState==="opening"&&a.type==="open"&&this.onOpen(),a.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(a)};E_(n,this.socket.binaryType).forEach(s),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const n=()=>{this.write([{type:"close"}])};this.readyState==="open"?n():this.once("open",n)}write(n){this.writable=!1,S_(n,s=>{this.doWrite(s,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const n=this.opts.secure?"https":"http",s=this.query||{};return this.opts.timestampRequests!==!1&&(s[this.opts.timestampParam]=Vg()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(n,s)}}let Fg=!1;try{Fg=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const B_=Fg;function L_(){}class H_ extends U_{constructor(n){if(super(n),typeof location<"u"){const s=location.protocol==="https:";let a=location.port;a||(a=s?"443":"80"),this.xd=typeof location<"u"&&n.hostname!==location.hostname||a!==n.port}}doWrite(n,s){const a=this.request({method:"POST",data:n});a.on("success",s),a.on("error",(o,f)=>{this.onError("xhr post error",o,f)})}doPoll(){const n=this.request();n.on("data",this.onData.bind(this)),n.on("error",(s,a)=>{this.onError("xhr poll error",s,a)}),this.pollXhr=n}}class Pn extends gt{constructor(n,s,a){super(),this.createRequest=n,Io(this,a),this._opts=a,this._method=a.method||"GET",this._uri=s,this._data=a.data!==void 0?a.data:null,this._create()}_create(){var n;const s=Gg(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=Pn.requestsCount++,Pn.requests[this._index]=this)}_onError(n){this.emitReserved("error",n,this._xhr),this._cleanup(!0)}_cleanup(n){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=L_,n)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Pn.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()}}Pn.requestsCount=0;Pn.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",H0);else if(typeof addEventListener=="function"){const r="onpagehide"in vn?"pagehide":"unload";addEventListener(r,H0,!1)}}function H0(){for(let r in Pn.requests)Pn.requests.hasOwnProperty(r)&&Pn.requests[r].abort()}const P_=(function(){const r=Jg({xdomain:!1});return r&&r.responseType!==null})();class $_ extends H_{constructor(n){super(n);const s=n&&n.forceBase64;this.supportsBinary=P_&&!s}request(n={}){return Object.assign(n,{xd:this.xd},this.opts),new Pn(Jg,this.uri(),n)}}function Jg(r){const n=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!n||B_))return new XMLHttpRequest}catch{}if(!n)try{return new vn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Ig=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Y_ extends uh{get name(){return"websocket"}doOpen(){const n=this.uri(),s=this.opts.protocols,a=Ig?{}:Gg(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;oh(a,this.supportsBinary,f=>{try{this.doWrite(a,f)}catch{}o&&Jo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const n=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=Vg()),this.supportsBinary||(s.b64=1),this.createUri(n,s)}}const vf=vn.WebSocket||vn.MozWebSocket;class G_ extends Y_{createSocket(n,s,a){return Ig?new vf(n,s,a):s?new vf(n,s):new vf(n)}doWrite(n,s){this.ws.send(s)}}class V_ extends uh{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(n){return this.emitReserved("error",n)}this._transport.closed.then(()=>{this.onClose()}).catch(n=>{this.onError("webtransport error",n)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(n=>{const s=j_(Number.MAX_SAFE_INTEGER,this.socket.binaryType),a=n.readable.pipeThrough(s).getReader(),o=A_();o.readable.pipeTo(n.writable),this._writer=o.writable.getWriter();const f=()=>{a.read().then(({done:m,value:g})=>{m||(this.onPacket(g),f())}).catch(m=>{})};f();const h={type:"open"};this.query.sid&&(h.data=`{"sid":"${this.query.sid}"}`),this._writer.write(h).then(()=>this.onOpen())})})}write(n){this.writable=!1;for(let s=0;s<n.length;s++){const a=n[s],o=s===n.length-1;this._writer.write(a).then(()=>{o&&Jo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var n;(n=this._transport)===null||n===void 0||n.close()}}const F_={websocket:G_,webtransport:V_,polling:$_},J_=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,I_=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Yf(r){if(r.length>8e3)throw"URI too long";const n=r,s=r.indexOf("["),a=r.indexOf("]");s!=-1&&a!=-1&&(r=r.substring(0,s)+r.substring(s,a).replace(/:/g,";")+r.substring(a,r.length));let o=J_.exec(r||""),f={},h=14;for(;h--;)f[I_[h]]=o[h]||"";return s!=-1&&a!=-1&&(f.source=n,f.host=f.host.substring(1,f.host.length-1).replace(/;/g,":"),f.authority=f.authority.replace("[","").replace("]","").replace(/;/g,":"),f.ipv6uri=!0),f.pathNames=Q_(f,f.path),f.queryKey=X_(f,f.query),f}function Q_(r,n){const s=/\/{2,9}/g,a=n.replace(s,"/").split("/");return(n.slice(0,1)=="/"||n.length===0)&&a.splice(0,1),n.slice(-1)=="/"&&a.splice(a.length-1,1),a}function X_(r,n){const s={};return n.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(a,o,f){o&&(s[o]=f)}),s}const Gf=typeof addEventListener=="function"&&typeof removeEventListener=="function",Oo=[];Gf&&addEventListener("offline",()=>{Oo.forEach(r=>r())},!1);class Xs extends gt{constructor(n,s){if(super(),this.binaryType=T_,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,n&&typeof n=="object"&&(s=n,n=null),n){const a=Yf(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=Yf(s.host).host);Io(this,s),this.secure=s.secure!=null?s.secure:typeof location<"u"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=s.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(a=>{const o=a.prototype.name;this.transports.push(o),this._transportsByName[o]=a}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=z_(this.opts.query)),Gf&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Oo.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(n){const s=Object.assign({},this.opts.query);s.EIO=Yg,s.transport=n,this.id&&(s.sid=this.id);const a=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[n]);return new this._transportsByName[n](a)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const n=this.opts.rememberUpgrade&&Xs.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const s=this.createTransport(n);s.open(),this.setTransport(s)}setTransport(n){this.transport&&this.transport.removeAllListeners(),this.transport=n,n.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",Xs.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",n),this.emitReserved("heartbeat"),n.type){case"open":this.onHandshake(JSON.parse(n.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const s=new Error("server error");s.code=n.data,this._onError(s);break;case"message":this.emitReserved("data",n.data),this.emitReserved("message",n.data);break}}onHandshake(n){this.emitReserved("handshake",n),this.id=n.sid,this.transport.query.sid=n.sid,this._pingInterval=n.pingInterval,this._pingTimeout=n.pingTimeout,this._maxPayload=n.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const n=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+n,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},n),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const n=this._getWritablePackets();this.transport.send(n),this._prevBufferLen=n.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let a=0;a<this.writeBuffer.length;a++){const o=this.writeBuffer[a].data;if(o&&(s+=M_(o)),a>0&&s>this._maxPayload)return this.writeBuffer.slice(0,a);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const n=Date.now()>this._pingTimeoutTime;return n&&(this._pingTimeoutTime=0,Jo(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),n}write(n,s,a){return this._sendPacket("message",n,s,a),this}send(n,s,a){return this._sendPacket("message",n,s,a),this}_sendPacket(n,s,a,o){if(typeof s=="function"&&(o=s,s=void 0),typeof a=="function"&&(o=a,a=null),this.readyState==="closing"||this.readyState==="closed")return;a=a||{},a.compress=a.compress!==!1;const f={type:n,data:s,options:a};this.emitReserved("packetCreate",f),this.writeBuffer.push(f),o&&this.once("flush",o),this.flush()}close(){const n=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),n()},a=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?a():n()}):this.upgrading?a():n()),this}_onError(n){if(Xs.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",n),this._onClose("transport error",n)}_onClose(n,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Gf&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const a=Oo.indexOf(this._offlineEventListener);a!==-1&&Oo.splice(a,1)}this.readyState="closed",this.id=null,this.emitReserved("close",n,s),this.writeBuffer=[],this._prevBufferLen=0}}}Xs.protocol=Yg;class K_ extends Xs{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let n=0;n<this._upgrades.length;n++)this._probe(this._upgrades[n])}_probe(n){let s=this.createTransport(n),a=!1;Xs.priorWebsocketSuccess=!1;const o=()=>{a||(s.send([{type:"ping",data:"probe"}]),s.once("packet",w=>{if(!a)if(w.type==="pong"&&w.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",s),!s)return;Xs.priorWebsocketSuccess=s.name==="websocket",this.transport.pause(()=>{a||this.readyState!=="closed"&&(E(),this.setTransport(s),s.send([{type:"upgrade"}]),this.emitReserved("upgrade",s),s=null,this.upgrading=!1,this.flush())})}else{const T=new Error("probe error");T.transport=s.name,this.emitReserved("upgradeError",T)}}))};function f(){a||(a=!0,E(),s.close(),s=null)}const h=w=>{const T=new Error("probe error: "+w);T.transport=s.name,f(),this.emitReserved("upgradeError",T)};function m(){h("transport closed")}function g(){h("socket closed")}function y(w){s&&w.name!==s.name&&f()}const E=()=>{s.removeListener("open",o),s.removeListener("error",h),s.removeListener("close",m),this.off("close",g),this.off("upgrading",y)};s.once("open",o),s.once("error",h),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 Z_=class extends K_{constructor(n,s={}){const a=typeof n=="object"?n:s;(!a.transports||a.transports&&typeof a.transports[0]=="string")&&(a.transports=(a.transports||["polling","websocket","webtransport"]).map(o=>F_[o]).filter(o=>!!o)),super(n,a)}};function W_(r,n="",s){let a=r;s=s||typeof location<"u"&&location,r==null&&(r=s.protocol+"//"+s.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=s.protocol+r:r=s.host+r),/^(https?|wss?):\/\//.test(r)||(typeof s<"u"?r=s.protocol+"//"+r:r="https://"+r),a=Yf(r)),a.port||(/^(http|ws)$/.test(a.protocol)?a.port="80":/^(http|ws)s$/.test(a.protocol)&&(a.port="443")),a.path=a.path||"/";const f=a.host.indexOf(":")!==-1?"["+a.host+"]":a.host;return a.id=a.protocol+"://"+f+":"+a.port+n,a.href=a.protocol+"://"+f+(s&&s.port===a.port?"":":"+a.port),a}const ew=typeof ArrayBuffer=="function",tw=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,Qg=Object.prototype.toString,nw=typeof Blob=="function"||typeof Blob<"u"&&Qg.call(Blob)==="[object BlobConstructor]",sw=typeof File=="function"||typeof File<"u"&&Qg.call(File)==="[object FileConstructor]";function fh(r){return ew&&(r instanceof ArrayBuffer||tw(r))||nw&&r instanceof Blob||sw&&r instanceof File}function To(r,n){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let s=0,a=r.length;s<a;s++)if(To(r[s]))return!0;return!1}if(fh(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return To(r.toJSON(),!0);for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)&&To(r[s]))return!0;return!1}function iw(r){const n=[],s=r.data,a=r;return a.data=Vf(s,n),a.attachments=n.length,{packet:a,buffers:n}}function Vf(r,n){if(!r)return r;if(fh(r)){const s={_placeholder:!0,num:n.length};return n.push(r),s}else if(Array.isArray(r)){const s=new Array(r.length);for(let a=0;a<r.length;a++)s[a]=Vf(r[a],n);return s}else if(typeof r=="object"&&!(r instanceof Date)){const s={};for(const a in r)Object.prototype.hasOwnProperty.call(r,a)&&(s[a]=Vf(r[a],n));return s}return r}function rw(r,n){return r.data=Ff(r.data,n),delete r.attachments,r}function Ff(r,n){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<n.length)return n[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let s=0;s<r.length;s++)r[s]=Ff(r[s],n);else if(typeof r=="object")for(const s in r)Object.prototype.hasOwnProperty.call(r,s)&&(r[s]=Ff(r[s],n));return r}const aw=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var qe;(function(r){r[r.CONNECT=0]="CONNECT",r[r.DISCONNECT=1]="DISCONNECT",r[r.EVENT=2]="EVENT",r[r.ACK=3]="ACK",r[r.CONNECT_ERROR=4]="CONNECT_ERROR",r[r.BINARY_EVENT=5]="BINARY_EVENT",r[r.BINARY_ACK=6]="BINARY_ACK"})(qe||(qe={}));class lw{constructor(n){this.replacer=n}encode(n){return(n.type===qe.EVENT||n.type===qe.ACK)&&To(n)?this.encodeAsBinary({type:n.type===qe.EVENT?qe.BINARY_EVENT:qe.BINARY_ACK,nsp:n.nsp,data:n.data,id:n.id}):[this.encodeAsString(n)]}encodeAsString(n){let s=""+n.type;return(n.type===qe.BINARY_EVENT||n.type===qe.BINARY_ACK)&&(s+=n.attachments+"-"),n.nsp&&n.nsp!=="/"&&(s+=n.nsp+","),n.id!=null&&(s+=n.id),n.data!=null&&(s+=JSON.stringify(n.data,this.replacer)),s}encodeAsBinary(n){const s=iw(n),a=this.encodeAsString(s.packet),o=s.buffers;return o.unshift(a),o}}class hh extends gt{constructor(n){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof n=="function"?{reviver:n}:n)}add(n){let s;if(typeof n=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");s=this.decodeString(n);const a=s.type===qe.BINARY_EVENT;a||s.type===qe.BINARY_ACK?(s.type=a?qe.EVENT:qe.ACK,this.reconstructor=new ow(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if(fh(n)||n.base64)if(this.reconstructor)s=this.reconstructor.takeBinaryData(n),s&&(this.reconstructor=null,super.emitReserved("decoded",s));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+n)}decodeString(n){let s=0;const a={type:Number(n.charAt(0))};if(qe[a.type]===void 0)throw new Error("unknown packet type "+a.type);if(a.type===qe.BINARY_EVENT||a.type===qe.BINARY_ACK){const f=s+1;for(;n.charAt(++s)!=="-"&&s!=n.length;);const h=n.substring(f,s);if(h!=Number(h)||n.charAt(s)!=="-")throw new Error("Illegal attachments");const m=Number(h);if(!cw(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 h=n.charAt(s);if(h==null||Number(h)!=h){--s;break}if(s===n.length)break}a.id=Number(n.substring(f,s+1))}if(n.charAt(++s)){const f=this.tryParse(n.substr(s));if(hh.isPayloadValid(a.type,f))a.data=f;else throw new Error("invalid payload")}return a}tryParse(n){try{return JSON.parse(n,this.opts.reviver)}catch{return!1}}static isPayloadValid(n,s){switch(n){case qe.CONNECT:return P0(s);case qe.DISCONNECT:return s===void 0;case qe.CONNECT_ERROR:return typeof s=="string"||P0(s);case qe.EVENT:case qe.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&aw.indexOf(s[0])===-1);case qe.ACK:case qe.BINARY_ACK:return Array.isArray(s)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class ow{constructor(n){this.packet=n,this.buffers=[],this.reconPack=n}takeBinaryData(n){if(this.buffers.push(n),this.buffers.length===this.reconPack.attachments){const s=rw(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const cw=Number.isInteger||function(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r};function P0(r){return Object.prototype.toString.call(r)==="[object Object]"}const uw=Object.freeze(Object.defineProperty({__proto__:null,Decoder:hh,Encoder:lw,get PacketType(){return qe}},Symbol.toStringTag,{value:"Module"}));function Cn(r,n,s){return r.on(n,s),function(){r.off(n,s)}}const fw=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Xg extends gt{constructor(n,s,a){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=n,this.nsp=s,a&&a.auth&&(this.auth=a.auth),this._opts=Object.assign({},a),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const n=this.io;this.subs=[Cn(n,"open",this.onopen.bind(this)),Cn(n,"packet",this.onpacket.bind(this)),Cn(n,"error",this.onerror.bind(this)),Cn(n,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...n){return n.unshift("message"),this.emit.apply(this,n),this}emit(n,...s){var a,o,f;if(fw.hasOwnProperty(n))throw new Error('"'+n.toString()+'" is a reserved event name');if(s.unshift(n),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(s),this;const h={type:qe.EVENT,data:s};if(h.options={},h.options.compress=this.flags.compress!==!1,typeof s[s.length-1]=="function"){const E=this.ids++,w=s.pop();this._registerAckCallback(E,w),h.id=E}const 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(h),this.packet(h)):this.sendBuffer.push(h)),this.flags={},this}_registerAckCallback(n,s){var a;const o=(a=this.flags.timeout)!==null&&a!==void 0?a:this._opts.ackTimeout;if(o===void 0){this.acks[n]=s;return}const f=this.io.setTimeoutFn(()=>{delete this.acks[n];for(let 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),h=(...m)=>{this.io.clearTimeoutFn(f),s.apply(this,m)};h.withError=!0,this.acks[n]=h}emitWithAck(n,...s){return new Promise((a,o)=>{const f=(h,m)=>h?o(h):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:qe.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},n):n})}onerror(n){this.connected||this.emitReserved("connect_error",n)}onclose(n,s){this.connected=!1,delete this.id,this.emitReserved("disconnect",n,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(n=>{if(!this.sendBuffer.some(a=>String(a.id)===n)){const a=this.acks[n];delete this.acks[n],a.withError&&a.call(this,new Error("socket has been disconnected"))}})}onpacket(n){if(n.nsp===this.nsp)switch(n.type){case qe.CONNECT:n.data&&n.data.sid?this.onconnect(n.data.sid,n.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case qe.EVENT:case qe.BINARY_EVENT:this.onevent(n);break;case qe.ACK:case qe.BINARY_ACK:this.onack(n);break;case qe.DISCONNECT:this.ondisconnect();break;case qe.CONNECT_ERROR:this.destroy();const a=new Error(n.data.message);a.data=n.data.data,this.emitReserved("connect_error",a);break}}onevent(n){const s=n.data||[];n.id!=null&&s.push(this.ack(n.id)),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(n){if(this._anyListeners&&this._anyListeners.length){const s=this._anyListeners.slice();for(const a of s)a.apply(this,n)}super.emit.apply(this,n),this._pid&&n.length&&typeof n[n.length-1]=="string"&&(this._lastOffset=n[n.length-1])}ack(n){const s=this;let a=!1;return function(...o){a||(a=!0,s.packet({type:qe.ACK,id:n,data:o}))}}onack(n){const s=this.acks[n.id];typeof s=="function"&&(delete this.acks[n.id],s.withError&&n.data.unshift(null),s.apply(this,n.data))}onconnect(n,s){this.id=n,this.recovered=s&&this._pid===s,this._pid=s,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(n=>this.emitEvent(n)),this.receiveBuffer=[],this.sendBuffer.forEach(n=>{this.notifyOutgoingListeners(n),this.packet(n)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(n=>n()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:qe.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(n){return this.flags.compress=n,this}get volatile(){return this.flags.volatile=!0,this}timeout(n){return this.flags.timeout=n,this}onAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(n),this}prependAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(n),this}offAny(n){if(!this._anyListeners)return this;if(n){const s=this._anyListeners;for(let a=0;a<s.length;a++)if(n===s[a])return s.splice(a,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(n),this}prependAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(n),this}offAnyOutgoing(n){if(!this._anyOutgoingListeners)return this;if(n){const s=this._anyOutgoingListeners;for(let a=0;a<s.length;a++)if(n===s[a])return s.splice(a,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(n){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const s=this._anyOutgoingListeners.slice();for(const a of s)a.apply(this,n.data)}}}function Nr(r){r=r||{},this.ms=r.min||100,this.max=r.max||1e4,this.factor=r.factor||2,this.jitter=r.jitter>0&&r.jitter<=1?r.jitter:0,this.attempts=0}Nr.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var n=Math.random(),s=Math.floor(n*this.jitter*r);r=(Math.floor(n*10)&1)==0?r-s:r+s}return Math.min(r,this.max)|0};Nr.prototype.reset=function(){this.attempts=0};Nr.prototype.setMin=function(r){this.ms=r};Nr.prototype.setMax=function(r){this.max=r};Nr.prototype.setJitter=function(r){this.jitter=r};class Jf extends gt{constructor(n,s){var a;super(),this.nsps={},this.subs=[],n&&typeof n=="object"&&(s=n,n=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,Io(this,s),this.reconnection(s.reconnection!==!1),this.reconnectionAttempts(s.reconnectionAttempts||1/0),this.reconnectionDelay(s.reconnectionDelay||1e3),this.reconnectionDelayMax(s.reconnectionDelayMax||5e3),this.randomizationFactor((a=s.randomizationFactor)!==null&&a!==void 0?a:.5),this.backoff=new Nr({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=n;const o=s.parser||uw;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=s.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(n){return arguments.length?(this._reconnection=!!n,n||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(n){return n===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=n,this)}reconnectionDelay(n){var s;return n===void 0?this._reconnectionDelay:(this._reconnectionDelay=n,(s=this.backoff)===null||s===void 0||s.setMin(n),this)}randomizationFactor(n){var s;return n===void 0?this._randomizationFactor:(this._randomizationFactor=n,(s=this.backoff)===null||s===void 0||s.setJitter(n),this)}reconnectionDelayMax(n){var s;return n===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=n,(s=this.backoff)===null||s===void 0||s.setMax(n),this)}timeout(n){return arguments.length?(this._timeout=n,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(n){if(~this._readyState.indexOf("open"))return this;this.engine=new Z_(this.uri,this.opts);const s=this.engine,a=this;this._readyState="opening",this.skipReconnect=!1;const o=Cn(s,"open",function(){a.onopen(),n&&n()}),f=m=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",m),n?n(m):this.maybeReconnectOnOpen()},h=Cn(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(h),this}connect(n){return this.open(n)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const n=this.engine;this.subs.push(Cn(n,"ping",this.onping.bind(this)),Cn(n,"data",this.ondata.bind(this)),Cn(n,"error",this.onerror.bind(this)),Cn(n,"close",this.onclose.bind(this)),Cn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(n){try{this.decoder.add(n)}catch(s){this.onclose("parse error",s)}}ondecoded(n){Jo(()=>{this.emitReserved("packet",n)},this.setTimeoutFn)}onerror(n){this.emitReserved("error",n)}socket(n,s){let a=this.nsps[n];return a?this._autoConnect&&!a.active&&a.connect():(a=new Xg(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 Oa={};function No(r,n){typeof r=="object"&&(n=r,r=void 0),n=n||{};const s=W_(r,n.path||"/socket.io"),a=s.source,o=s.id,f=s.path,h=Oa[o]&&f in Oa[o].nsps,m=n.forceNew||n["force new connection"]||n.multiplex===!1||h;let g;return m?g=new Jf(a,n):(Oa[o]||(Oa[o]=new Jf(a,n)),g=Oa[o]),s.query&&!n.query&&(n.query=s.queryKey),g.socket(s.path,n)}Object.assign(No,{Manager:Jf,Socket:Xg,io:No,connect:No});const hw=O.createContext({connected:!1,subscribe:()=>()=>{}});function dw({children:r}){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))}},[]),h=O.useCallback((m,g)=>{for(const[y,E]of o.current)if(Ug(m,y))for(const w of E)try{w(g)}catch{}},[]);return O.useEffect(()=>{const m=bg(),g=No({path:`${Wt}/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;h(y,w)}catch{}}),()=>{g.removeAllListeners(),g.disconnect(),n.current=null,a(!1)}},[h]),d.jsx(hw.Provider,{value:{connected:s,subscribe:f},children:d.jsx(Fa.Provider,{value:{connected:s,subscribe:f},children:r})})}function mw({children:r}){const[n,s]=O.useState(null),[a,o]=O.useState({url:null,token:null});return O.useEffect(()=>{let f=!1;async function h(){var m;try{console.log("[lt-transport] detecting event transport...");const g=await fetch(`${Wt}/api/settings`);if(!g.ok){console.warn("[lt-transport] settings fetch failed, falling back to socketio"),f||s("socketio");return}const y=await g.json(),E=(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 q=bg();if(q)try{const M=await fetch(`${Wt}/api/nats-credentials`,{headers:{Authorization:`Bearer ${q}`}});if(M.ok){const D=await M.json();w=D.natsWsUrl??w,T=D.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 h(),()=>{f=!0}},[]),n==="nats"?d.jsx(b_,{url:a.url,token:a.token,children:r}):n==="socketio"?d.jsx(dw,{children:r}):d.jsx(d.Fragment,{children:r})}function Kg(){const{isSuperAdmin:r,hasRoleType:n,hasRole:s}=Oi(),a=r||s("engineer"),o=n("admin"),f=r||n("admin");return{isBuilder:a,isOps:o,canBulk:f}}const If="lt_ai_override";function pw(){return $e("/settings")}function Qf(){try{if(localStorage.getItem(If)==="off")return!1}catch{}return null}function Qo(){var s;const r=_n({queryKey:["settings"],queryFn:pw,staleTime:1/0}),n=Qf();return r.data&&n===!1&&((s=r.data.ai)!=null&&s.enabled)?{...r,data:{...r.data,ai:{enabled:!1}}}:r}function gw(){const[r,n]=O.useState(()=>Qf()===!1),s=O.useCallback(()=>{const a=Qf()===!1;try{a?localStorage.removeItem(If):localStorage.setItem(If,"off")}catch{}n(!a),window.location.reload()},[]);return{aiOverrideActive:r,toggleAIOverride:s}}const Zg=O.createContext(null),$0="lt_sidebar_collapsed";function yw({children:r}){const[n,s]=O.useState(()=>{try{return localStorage.getItem($0)==="true"}catch{return!1}}),a=O.useCallback(()=>{s(o=>{const f=!o;try{localStorage.setItem($0,String(f))}catch{}return f})},[]);return d.jsx(Zg.Provider,{value:{collapsed:n,toggle:a},children:r})}function Wg(){const r=O.useContext(Zg);if(!r)throw new Error("useSidebar must be used within SidebarProvider");return r}function ey(r,n){var s,a,o,f,h;n.facets&&Object.keys(n.facets).length&&r.set("facets",JSON.stringify(n.facets)),(s=n.block)!=null&&s.length&&r.set("block",JSON.stringify(n.block)),(a=n.range)!=null&&a.length&&r.set("range",JSON.stringify(n.range)),(o=n.exists)!=null&&o.length&&r.set("exists",JSON.stringify(n.exists)),(f=n.roles)!=null&&f.length&&r.set("roles",JSON.stringify(n.roles)),(h=n.orderBy)!=null&&h.length&&r.set("orderBy",JSON.stringify(n.orderBy)),n.available!==void 0&&r.set("available",String(n.available))}function zE(r){const n=r??"24h";return _n({queryKey:["stationMetrics",n],queryFn:()=>$e(`/escalations/station-metrics?period=${n}`),staleTime:5e3})}function qE(r){const n=r?`?period=${r}`:"";return _n({queryKey:["escalationStats",r],queryFn:()=>$e(`/escalations/stats${n}`)})}function UE(){return _n({queryKey:["escalationTypes"],queryFn:()=>$e("/escalations/types")})}function BE(r=!0){return _n({queryKey:["escalationFacetKeys"],queryFn:()=>$e("/escalations/facet-keys"),enabled:r,staleTime:6e4})}function bw(r){const{enabled:n=!0,staleTime:s,...a}=r,o=new URLSearchParams;return a.status&&o.set("status",a.status),a.role&&o.set("role",a.role),a.type&&o.set("type",a.type),a.subtype&&o.set("subtype",a.subtype),a.assigned_to&&o.set("assigned_to",a.assigned_to),a.claimed&&o.set("claimed","true"),a.priority&&o.set("priority",String(a.priority)),a.limit&&o.set("limit",String(a.limit)),a.offset!==void 0&&o.set("offset",String(a.offset)),a.sort_by&&o.set("sort_by",a.sort_by),a.order&&o.set("order",a.order),a.search&&o.set("search",a.search),ey(o,a),_n({queryKey:["escalations",a],queryFn:()=>$e(`/escalations?${o}`),enabled:n,...s!==void 0?{staleTime:s}:{}})}function xw(r){const{enabled:n=!0,staleTime:s,...a}=r,o=new URLSearchParams;return a.role&&o.set("role",a.role),a.type&&o.set("type",a.type),a.subtype&&o.set("subtype",a.subtype),a.priority&&o.set("priority",String(a.priority)),a.limit&&o.set("limit",String(a.limit)),a.offset!==void 0&&o.set("offset",String(a.offset)),a.sort_by&&o.set("sort_by",a.sort_by),a.order&&o.set("order",a.order),a.search&&o.set("search",a.search),ey(o,a),_n({queryKey:["escalations","available",a],queryFn:()=>$e(`/escalations/available?${o}`),enabled:n,...s!==void 0?{staleTime:s}:{}})}function LE(r){return _n({queryKey:["escalations","by-workflow",r],queryFn:()=>$e(`/escalations/by-workflow/${r}`),enabled:!!r})}function HE(r){return _n({queryKey:["escalations",r],queryFn:()=>$e(`/escalations/${r}`),enabled:!!r})}function PE(){const r=rn();return wn({mutationFn:({id:n,durationMinutes:s})=>$e(`/escalations/${n}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:s})}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function $E(){const r=rn();return wn({mutationFn:n=>$e(`/escalations/${n}/release`,{method:"POST"}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function YE(){const r=rn();return wn({mutationFn:({id:n,resolverPayload:s})=>$e(`/escalations/${n}/resolve`,{method:"POST",body:JSON.stringify({resolverPayload:s})}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]}),r.resetQueries({queryKey:["tasks"]}),r.resetQueries({queryKey:["jobs"]})}})}function GE(){const r=rn();return wn({mutationFn:({id:n,targetRole:s})=>$e(`/escalations/${n}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:s})}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function VE(){const r=rn();return wn({mutationFn:({ids:n,priority:s})=>$e("/escalations/priority",{method:"PATCH",body:JSON.stringify({ids:n,priority:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function FE(){const r=rn();return wn({mutationFn:({ids:n,durationMinutes:s})=>$e("/escalations/bulk-claim",{method:"POST",body:JSON.stringify({ids:n,durationMinutes:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function JE(){const r=rn();return wn({mutationFn:({ids:n,targetUserId:s,durationMinutes:a})=>$e("/escalations/bulk-assign",{method:"POST",body:JSON.stringify({ids:n,targetUserId:s,durationMinutes:a})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function IE(){const r=rn();return wn({mutationFn:({ids:n,targetRole:s})=>$e("/escalations/bulk-escalate",{method:"PATCH",body:JSON.stringify({ids:n,targetRole:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function QE(){const r=rn();return wn({mutationFn:({ids:n,hint:s})=>$e("/escalations/bulk-triage",{method:"POST",body:JSON.stringify({ids:n,...s?{hint:s}:{}})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function XE(){const r=rn();return wn({mutationFn:n=>$e(`/escalations/${n}/cancel`,{method:"POST"}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function KE(){const r=rn();return wn({mutationFn:({ids:n})=>$e("/escalations/bulk-cancel",{method:"POST",body:JSON.stringify({ids:n})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function vw(){const{user:r}=Oi(),n=r==null?void 0:r.userId,s=rn(),a=O.useRef(null),o=O.useCallback(()=>{a.current||(a.current=setTimeout(()=>{a.current=null,s.invalidateQueries({queryKey:["escalations"]})},15e3))},[s]);p_(`${d_}.system.escalation.>`,o);const{data:f}=xw({limit:1}),{data:h}=bw({assigned_to:n,status:"pending",limit:1});return{available:(f==null?void 0:f.total)??0,mine:(h==null?void 0:h.total)??0}}function dh({size:r="sm",hideLabel:n=!1,className:s=""}){const a=r==="lg",o=a?"w-[16rem] h-[16rem] -rotate-[120deg] opacity-40 -ml-10":"w-[12.5rem] h-[12.5rem] -rotate-[120deg] opacity-40 -ml-8",f=a?"text-[44px] font-normal text-text-primary tracking-[0.15em] -ml-[12.5rem]":"text-[36px] font-normal text-text-primary tracking-[0.15em] -ml-[9.75rem]";return d.jsxs("div",{className:`flex items-center ${s}`,style:{height:"50px"},children:[d.jsx("img",{src:`${Wt}/logo512.png`,alt:"LongTail",className:`shrink-0 z-0 ${o}`}),d.jsx("span",{className:`z-[1] transition-opacity duration-300 ${f} ${n?"opacity-0":""}`,children:"LongTail"})]})}function _w({onToggleEventFeed:r,onToggleDocs:n}){const{user:s,logout:a}=Oi(),{isBuilder:o}=Kg(),{available:f,mine:h}=vw(),{connected:m}=m_(),{toggleAIOverride:g}=gw(),[y,E]=O.useState(!1),w=O.useRef(null);return O.useEffect(()=>{if(!y)return;const T=q=>{w.current&&!w.current.contains(q.target)&&E(!1)};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[y]),d.jsxs("header",{className:"h-14 shrink-0 border-b border-surface-border bg-surface-raised flex items-center justify-between px-5 relative z-30",children:[d.jsx("div",{className:"flex items-center gap-4",children:d.jsx(yr,{to:"/","aria-label":"Home",onClick:T=>{(T.ctrlKey||T.metaKey)&&(T.preventDefault(),g())},children:d.jsx(dh,{})})}),d.jsxs("div",{className:"flex items-center gap-5",children:[d.jsxs(yr,{to:"/escalations/available",className:`flex items-center gap-1.5 text-[11px] transition-colors ${f>0?"text-blue-400 hover:text-blue-300":"text-text-quaternary hover:text-text-secondary"}`,title:"Available escalations",children:[d.jsx(Ef,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"available",f>0&&d.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:f})]}),d.jsxs(yr,{to:"/escalations/queue",className:`flex items-center gap-1.5 text-[11px] transition-colors ${h>0?"text-status-warning hover:text-amber-300":"text-text-quaternary hover:text-text-secondary"}`,title:"My escalation queue",children:[d.jsx(Ef,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"mine",h>0&&d.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:h})]}),o&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"w-px h-4 bg-surface-border"}),d.jsxs("button",{type:"button",onClick:()=>{m?r==null||r():window.location.reload()},className:`flex items-center gap-1.5 text-[11px] transition-colors ${m?"text-emerald-400 hover:text-emerald-300":"text-text-quaternary hover:text-text-secondary"}`,title:m?"Live events — click to toggle feed":"Events disconnected — click to reconnect",children:[d.jsx(dg,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"events"]}),d.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:[d.jsx(mg,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"docs"]})]}),d.jsx("div",{className:"w-px h-4 bg-surface-border"}),s&&d.jsxs("div",{className:"relative",ref:w,children:[d.jsxs("button",{onClick:()=>E(T=>!T),className:"btn-ghost text-xs flex items-center gap-1",children:[d.jsx(kx,{className:"w-3.5 h-3.5 text-accent/75",strokeWidth:1.5}),s.displayName||s.username||s.userId,d.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),y&&d.jsxs("div",{className:"absolute right-0 top-full mt-1 w-48 bg-surface-raised border border-surface-border rounded-md shadow-lg py-1 z-50",children:[d.jsx(yr,{to:"/credentials",onClick:()=>E(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Credentials"}),d.jsx("button",{onClick:()=>{E(!1),a()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Sign Out"})]})]})]})]})}function mh({open:r,children:n}){const[s,a]=O.useState(r);return O.useEffect(()=>{r&&a(!0)},[r]),d.jsx("div",{className:`grid transition-[grid-template-rows] duration-300 ease-out ${r?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,onTransitionEnd:()=>{r||a(!1)},children:d.jsx("div",{className:"overflow-hidden",children:s?n:null})})}function Xf(r){return({isActive:n})=>{const s="flex items-center rounded-md transition-colors duration-150",a="bg-surface-hover text-text-primary font-medium",o="text-text-secondary hover:text-text-primary hover:bg-surface-hover";return r?`${s} justify-center w-10 h-10 mx-auto ${n?a:o}`:`${s} gap-3 px-4 py-2 text-sm ${n?a:o}`}}function ww(){return({isActive:r})=>`flex items-center gap-3 pl-11 pr-4 py-1.5 text-xs rounded-md transition-colors duration-150 ${r?"text-text-primary font-medium":"text-text-secondary hover:text-text-primary"}`}function Sw({group:r,collapsed:n}){const{pathname:s}=ei(),a=r.matchPaths.some(m=>s.startsWith(m)),[o,f]=O.useState(a),h=o||a;return n?d.jsx(d.Fragment,{children:r.items.map(m=>d.jsx(Co,{to:m.to,className:Xf(!0),title:m.label,children:m.icon&&d.jsx(m.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})},m.to))}):d.jsxs("div",{children:[d.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:[d.jsxs("span",{className:"flex items-center gap-3",children:[r.icon&&d.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),d.jsx("span",{children:r.label})]}),d.jsx("svg",{className:`w-3.5 h-3.5 text-text-tertiary transition-transform duration-150 ${h?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),d.jsx(mh,{open:h,children:r.items.map(m=>d.jsxs(Co,{to:m.to,end:m.end,className:ww(),children:[m.icon&&d.jsx(m.icon,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),d.jsx("span",{children:m.label})]},m.to))})]})}function Ew(r){return r.kind==="group"}function Aw({entry:r,collapsed:n}){const{pathname:s,search:a}=ei();if(r.to.includes("?")){const[f,h]=r.to.split("?"),m=s===f&&a===`?${h}`,g=Xf(n)({isActive:m});return d.jsxs(Co,{to:r.to,className:g,title:n?r.label:void 0,children:[r.icon&&d.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),!n&&d.jsx("span",{children:r.label})]})}return d.jsxs(Co,{to:r.to,end:r.end,className:Xf(n),title:n?r.label:void 0,children:[r.icon&&d.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),!n&&d.jsx("span",{children:r.label})]})}function Ks({heading:r,entries:n}){const{collapsed:s}=Wg();return d.jsxs("div",{className:"space-y-1",children:[s?d.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:r}):d.jsx("p",{className:"px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-accent/80",children:r}),n.map(a=>Ew(a)?d.jsx(Sw,{group:a,collapsed:s},a.label):d.jsx(Aw,{entry:a,collapsed:s},a.to))]})}function jw({aiEnabled:r=!1,isBuilder:n=!1,isOps:s=!1}){if(!n&&!s){const o=[{to:"/escalations/queue",label:"My Queue",icon:Ef},{to:"/escalations/available",label:"Available",icon:Af}];return d.jsx(Ks,{heading:"Work",entries:o})}if(!n)return d.jsx(Ks,{heading:"React",entries:[{to:"/operations",label:"Operations",icon:s0}]});const a=[...s||n?[{to:"/operations",label:"Operations",icon:s0}]:[],{to:"/topics",label:"Event Topics",icon:dg},{to:"/agents",label:r?"Agents":"Automations",icon:Mx},{to:"/capabilities",label:"Capabilities",icon:Rx}];return d.jsx(Ks,{heading:"React",entries:a})}function Ow(){const r=[{kind:"group",label:"Procedural",icon:Dx,matchPaths:["/workflows/registry","/workflows/durable/invoke","/workflows/executions","/workflows/durable/executions","/workflows/start","/workflows/workers","/workflows/tasks"],items:[{to:"/workflows/registry",label:"Registry",icon:i0},{to:"/workflows/durable/invoke",label:"Invoke",icon:r0},{to:"/workflows/executions",label:"Executions",icon:Af}]},{kind:"group",label:"Graph",icon:Kf,matchPaths:["/mcp/workflows","/mcp/executions"],items:[{to:"/mcp/workflows",label:"Configure",icon:i0,end:!0},{to:"/mcp/workflows/invoke",label:"Invoke",icon:r0},{to:"/mcp/executions",label:"Executions",icon:Af}]}];return d.jsx(Ks,{heading:"Orchestrate",entries:r})}const Tw=[{to:"/mcp/queries",label:"Designer",icon:zx},{to:"/mcp/servers",label:"Servers & Tools",icon:qx}];function Nw(){return d.jsx(Ks,{heading:"Design",entries:Tw})}const Cw=[{to:"/files",label:"Files",icon:Ux},{to:"/knowledge",label:"Knowledge",icon:Bx}];function kw(){return d.jsx(Ks,{heading:"Storage",entries:Cw})}function Mw({isBuilder:r=!1,isOps:n=!1}){var h;const{data:s}=Qo(),a=((h=s==null?void 0:s.features)==null?void 0:h.dbMaintenance)!==!1,o=[{to:"/admin/users",label:"Accounts",icon:Lx},...r||n?[{to:"/admin/roles",label:"Roles",icon:Hx}]:[]],f=[{to:"/admin/controlplane",label:"Routers",icon:Px},{to:"/admin/streams",label:"Messages",icon:$x},...a?[{to:"/admin/maintenance",label:"DB Maintenance",icon:Yx}]:[]];return d.jsxs(d.Fragment,{children:[d.jsx(Ks,{heading:"Identity & Access",entries:o}),r&&d.jsx(Ks,{heading:"Infrastructure",entries:f})]})}const ty="lt_event_feed_patterns";function Rw(r){if(r.startsWith("/topics/")){const f=decodeURIComponent(r.replace("/topics/",""));if(f&&!f.includes("/"))return`lt.events.${f}`}const n=r.match(/^\/escalations\/detail\/(.+)/);if(n)return`lt.events.system.escalation.${n[1]}.>`;if(r.startsWith("/escalations"))return"lt.events.system.escalation.>";const s=r.match(/^\/workflows\/(?:durable\/)?executions\/(.+)/);if(s)return`lt.events.system.workflow.${s[1]}.>`;if(r.startsWith("/workflows"))return"lt.events.system.workflow.>";const a=r.match(/^\/agents\/([^/]+)$/);if(a&&a[1]!=="new")return`lt.events.system.agent.${a[1]}.>`;if(r.startsWith("/agents"))return"lt.events.system.agent.>";if(r.startsWith("/knowledge"))return"lt.events.system.knowledge.>";if(r.startsWith("/files"))return"lt.events.system.file.>";if(r==="/")return"lt.events.system.>";const o=r.match(/^\/mcp\/executions\/(.+)/);return o?`lt.events.system.*.${o[1]}.>`:(r.startsWith("/mcp"),"lt.events.system.>")}function Dw(){try{const r=localStorage.getItem(ty);return r?JSON.parse(r):[]}catch{return[]}}function _f(r){try{localStorage.setItem(ty,JSON.stringify(r))}catch{}}function zw(){const{pathname:r}=ei(),[n,s]=O.useState(Dw),a=O.useMemo(()=>Rw(r),[r]),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 _f(w),w})},[]),h=O.useCallback(g=>{s(y=>{const E=y.filter(w=>w!==g);return _f(E),E})},[]),m=O.useCallback(()=>{s([]),_f([])},[]);return{patterns:o,pagePattern:a,userPatterns:n,addPattern:f,removePattern:h,clearUserPatterns:m}}function qw({children:r,className:n=""}){return d.jsx("p",{className:`text-[10px] font-semibold uppercase tracking-widest text-text-tertiary ${n}`,children:r})}const wf=280,Y0="cubic-bezier(0.4, 0, 0.2, 1)",wo=40;function Uw(r){if(!r)return"scale(0.92)";const n=window.innerWidth,s=window.innerHeight,a=n-wo*2,o=s-wo*2,f=r.width/a,h=r.height/o,m=r.left+r.width/2-(wo+a/2),g=r.top+r.height/2-(wo+o/2);return`translate(${m}px, ${g}px) scale(${f}, ${h})`}function ny({open:r,onClose:n,sourceRef:s,children:a}){const[o,f]=O.useState(null),h=O.useRef(null),m=O.useRef(!1);O.useEffect(()=>{var T,q;r&&!m.current?(h.current=((T=s==null?void 0:s.current)==null?void 0:T.getBoundingClientRect())??null,f("entering")):!r&&m.current&&o==="open"&&(h.current=((q=s==null?void 0:s.current)==null?void 0:q.getBoundingClientRect())??null,f("exiting")),m.current=r},[r,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=q=>{q.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),wf+50);return()=>clearTimeout(T)},[o]),!o)return null;const y=o==="entering"||o==="exiting",E=y?Uw(h.current):"none",w=y?0:1;return fg.createPortal(d.jsx("div",{className:"fixed inset-0 z-50 overflow-auto p-10",style:{transformOrigin:"center center",transition:`transform ${wf}ms ${Y0}, opacity ${wf}ms ${Y0}`,transform:E,opacity:w,backgroundColor:"#FFFFFF"},onTransitionEnd:g,children:a}),document.body)}function Bw({className:r}){return d.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h8M4 18h12"})})}function Lw({className:r}){return d.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 7l-5 5 5 5M16 7l5 5-5 5"})})}function Hw({className:r}){return d.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3"})})}function Pw({className:r}){return d.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}function $w({className:r}){return d.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 9V4.5M9 9H4.5M9 9L3.5 3.5M9 15v4.5M9 15H4.5M9 15l-5.5 5.5M15 9h4.5M15 9V4.5M15 9l5.5-5.5M15 15h4.5M15 15v4.5m0-4.5l5.5 5.5"})})}function Yw({className:r}){return d.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}function Gw(r){const n=r.trim().split(`
|
|
54
|
+
`);if(n.length<2)return r;const s=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(""),h=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>${h}</tbody></table>`}function So(r){return r.toLowerCase().replace(/<[^>]+>/g,"").replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").trim()}function Vw(r){const n=[];let s=r.replace(/```(\w*)\n([\s\S]*?)```/g,(g,y,E)=>{const w=n.length;return n.push(`<pre class="bg-surface-sunken rounded p-3 my-2 overflow-x-auto text-[11px] leading-relaxed"><code>${E}</code></pre>`),`\0CODE${w}\0`});const a=/^(\|.+\|)\n(\|[-| :]+\|)\n((?:\|.+\|\n?)+)/gm;s=s.replace(a,(g,y,E,w)=>Gw(`${y}
|
|
55
55
|
${E}
|
|
56
|
-
${w.trimEnd()}`)),s=s.replace(/`([^`]+)`/g,'<code class="bg-surface-sunken px-1 py-0.5 rounded text-[11px]">$1</code>'),s=s.replace(/^#### (.+)$/gm,(g,y)=>`<h4 id="${wo(y)}" class="text-xs font-semibold text-text-primary mt-4 mb-1">${y}</h4>`).replace(/^### (.+)$/gm,(g,y)=>`<h3 id="${wo(y)}" class="text-sm font-semibold text-text-primary mt-5 mb-1.5">${y}</h3>`).replace(/^## (.+)$/gm,(g,y)=>`<h2 id="${wo(y)}" class="text-base font-semibold text-text-primary mt-6 mb-2 pb-1 border-b border-surface-border">${y}</h2>`).replace(/^# (.+)$/gm,(g,y)=>`<h1 id="${wo(y)}" class="text-lg font-bold text-text-primary mb-3">${y}</h1>`),s=s.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(#([^)]+)\)/g,'<a data-anchor="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]*\.md(?:#[^)]*)?)\)/g,'<a data-doc-link="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent hover:underline">$1</a>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^- (.+)$/gm,'<li class="ml-4 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^\d+\. (.+)$/gm,'<li class="ml-4 list-decimal text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^---+$/gm,'<hr class="border-surface-border my-4" />').replace(/(?:^> (.+)$\n?)+/gm,g=>{const y=g.replace(/^> /gm,"").trim(),E=/⚠️|warning|caution/i.test(y),w=/note:|ℹ️|info/i.test(y);return`<div class="${E?"bg-status-warning/5":w?"bg-accent/5":"bg-surface-sunken/50"} ${E?"border-status-warning":w?"border-accent":"border-text-tertiary"} border-l-2 rounded-r-md px-3 py-2 my-3 text-xs text-text-secondary leading-relaxed">${y}</div>`}).replace(/\n\n/g,"\0PARA\0").replace(/\n/g,"<br/>");const o=g=>g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),f=g=>new RegExp(`(${o(g)}[\\s\\S]*?<\\/li>(?:<br\\/>)?)+`,"g");s=s.replace(f('<li class="ml-8 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(f('<li class="ml-4 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(f('<li class="ml-4 list-decimal'),g=>`<ol class="list-decimal mb-3">${g}</ol>`),s=s.replace(/\x00CODE(\d+)\x00/g,(g,y)=>n[parseInt(y,10)]);const h="text-xs leading-relaxed text-text-secondary mb-2",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,O;for(;(O=m.exec(w))!==null;){const q=O.index+O[0].length;E.push(w.slice(0,q)),w=w.slice(q).replace(/^<br\/>/,"").trim(),m.lastIndex=0}return w&&E.push(w),E.map(q=>{const M=q.trim();return M?/^\s*<(h[1-4]|pre|table|ul|ol|hr|div)/.test(M)?M:`<p class="${h}">${M}</p>`:""}).join("")}).join(""),s}const Vw=/(\*\*|^#{1,4}\s|^- |^\d+\.\s|```|^\|.*\|$|\[.+\]\(.+\))/m;function Fw(r){return Vw.test(r)}function ph({content:r,className:n,onClick:s}){const a=T.useMemo(()=>Gw(r),[r]);return d.jsx("div",{className:n,onClick:s,dangerouslySetInnerHTML:{__html:a}})}function Lo({data:r,depth:n=0,generation:s}){const o=s!==void 0&&s>0&&s%2===1?!1:n>0,[f,h]=T.useState(o),[m,g]=T.useState(s);if(s!==void 0&&s!==m&&(g(s),h(s%2===0&&n>0)),r==null)return d.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof r=="string")return d.jsxs("span",{className:"text-text-primary",children:['"',r,'"']});if(typeof r=="number"||typeof r=="boolean")return d.jsx("span",{className:"text-text-primary font-medium",children:String(r)});if(Array.isArray(r))return r.length===0?d.jsx("span",{className:"text-text-tertiary",children:"[]"}):f?d.jsxs("button",{onClick:()=>h(!1),className:"text-text-secondary hover:text-text-primary",children:["[",r.length," items]"]}):d.jsxs("span",{children:[d.jsx("button",{onClick:()=>h(!0),className:"text-text-tertiary hover:text-text-primary",children:"["}),d.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:r.map((y,E)=>d.jsxs("div",{children:[d.jsx(Lo,{data:y,depth:n+1,generation:s}),E<r.length-1&&d.jsx("span",{className:"text-text-tertiary",children:","})]},E))}),d.jsx("span",{className:"text-text-tertiary",children:"]"})]});if(typeof r=="object"){const y=Object.entries(r);return y.length===0?d.jsx("span",{className:"text-text-tertiary",children:"{}"}):f?d.jsxs("button",{onClick:()=>h(!1),className:"text-text-secondary hover:text-text-primary",children:["{","...","}"]}):d.jsxs("span",{children:[d.jsx("button",{onClick:()=>h(!0),className:"text-text-tertiary hover:text-text-primary",children:"{"}),d.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:y.map(([E,w],O)=>d.jsxs("div",{children:[d.jsx("span",{className:"text-text-secondary",children:E}),d.jsx("span",{className:"text-text-tertiary",children:": "}),d.jsx(Lo,{data:w,depth:n+1,generation:s}),O<y.length-1&&d.jsx("span",{className:"text-text-tertiary",children:","})]},E))}),d.jsx("span",{className:"text-text-tertiary",children:"}"})]})}return d.jsx("span",{children:String(r)})}function Ua({data:r,depth:n=0}){if(r==null)return d.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof r=="string")return r.length>40&&Fw(r)?d.jsx(ph,{content:r}):d.jsx("span",{className:"text-text-primary",children:r});if(typeof r=="number"||typeof r=="boolean")return d.jsx("span",{className:"text-text-primary font-medium",children:String(r)});if(Array.isArray(r))return r.length===0?d.jsx("span",{className:"text-text-tertiary italic",children:"empty list"}):d.jsx("div",{className:"space-y-2",children:r.map((s,a)=>d.jsxs("div",{className:"flex items-baseline gap-2",children:[d.jsxs("span",{className:"text-text-tertiary text-[10px] shrink-0",children:[a+1,"."]}),d.jsx("div",{className:"flex-1",children:d.jsx(Ua,{data:s,depth:n+1})})]},a))});if(typeof r=="object"){const s=Object.entries(r);return s.length===0?d.jsx("span",{className:"text-text-tertiary italic",children:"empty"}):d.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 d.jsxs("div",{children:[d.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-0.5",children:a.replace(/[_-]/g," ")}),f?d.jsx("p",{className:"text-sm text-text-primary",children:d.jsx(Ua,{data:o,depth:n+1})}):d.jsx(Ua,{data:o,depth:n+1})]},a)})})}return d.jsx("span",{children:String(r)})}function Y0({mode:r,setMode:n,isCollapsed:s,onToggleCollapse:a,onCopy:o,copied:f,onFullscreen:h,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 d.jsxs("div",{className:"flex items-center gap-0.5 bg-surface-sunken/80 rounded-md backdrop-blur-sm",children:[r==="json"&&d.jsx("button",{onClick:a,className:E,title:s?"Expand all":"Collapse all",children:s?d.jsx($w,{className:y}):d.jsx(Pw,{className:y})}),d.jsx("button",{onClick:()=>n(r==="json"?"tree":"json"),className:E,title:r==="json"?"Outline view":"JSON view",children:r==="json"?d.jsx(Uw,{className:y}):d.jsx(Bw,{className:y})}),d.jsx("button",{onClick:o,className:E,title:"Copy to clipboard",children:f?d.jsx(Hw,{className:`${y} text-status-success`}):d.jsx(Lw,{className:y})}),h&&d.jsx("button",{onClick:h,className:E,title:"Fullscreen",children:d.jsx(mg,{className:y})}),m&&d.jsx("button",{onClick:m,className:E,title:"Close (Esc)",children:d.jsx(pg,{className:y})})]})}function Jw({data:r,label:n,variant:s,defaultCollapsed:a=!1,defaultMode:o}){const f=T.useRef(null),[h,m]=T.useState(o??"json"),[g,y]=T.useState(!1),[E,w]=T.useState(!1),[O,q]=T.useState(a?0:1),[M,D]=T.useState(1),W=O%2===0,se=M%2===0,ee=T.useCallback(()=>q(K=>K+1),[]),me=T.useCallback(()=>D(K=>K+1),[]);let re=r;if(typeof r=="string")try{re=JSON.parse(r)}catch{}const C=async()=>{const K=typeof r=="string"?r:JSON.stringify(re,null,2);await navigator.clipboard.writeText(K),y(!0),setTimeout(()=>y(!1),2e3)},X=T.useCallback(()=>{D(1),w(!0)},[]),ce=s==="panel",V=ce?"border border-accent-muted/40 rounded-lg p-3 bg-surface-hover/30":"",G=ce?"font-mono text-xs leading-relaxed bg-white rounded-md p-4 overflow-x-auto break-all":"font-mono text-xs leading-relaxed bg-surface-sunken rounded-md p-4 overflow-x-auto break-all";return d.jsxs("div",{className:V,children:[n&&d.jsx(zw,{children:n}),d.jsxs("div",{ref:f,className:"relative",children:[d.jsx("div",{className:"absolute top-2 right-2 z-[5]",children:d.jsx(Y0,{mode:h,setMode:m,isCollapsed:W,onToggleCollapse:ee,onCopy:C,copied:g,onFullscreen:X})}),d.jsx("div",{className:G,children:h==="json"?d.jsx(Lo,{data:re,generation:O}):d.jsx(Ua,{data:re})})]}),d.jsxs(ty,{open:E,onClose:()=>w(!1),sourceRef:f,children:[d.jsx("div",{className:"sticky top-0 float-right z-10",children:d.jsx(Y0,{mode:h,setMode:m,isCollapsed:se,onToggleCollapse:me,onCopy:C,copied:g,onClose:()=>w(!1),large:!0})}),d.jsx("div",{className:"font-mono text-sm leading-relaxed",children:h==="json"?d.jsx(Lo,{data:re,generation:M}):d.jsx(Ua,{data:re})})]})]})}const Qw=100,G0=500;let Iw=0;const ny={"escalation.created":"text-blue-400","escalation.claimed":"text-status-warning","escalation.released":"text-text-tertiary","escalation.resolved":"text-status-success","task.created":"text-accent","task.completed":"text-status-success","task.failed":"text-status-error","task.escalated":"text-status-warning","workflow.started":"text-accent","workflow.completed":"text-status-success","workflow.failed":"text-status-error","activity.started":"text-blue-400","activity.completed":"text-status-success","activity.failed":"text-status-error","knowledge.stored":"text-violet-400","knowledge.deleted":"text-text-tertiary","agent.started":"text-accent","agent.completed":"text-status-success","agent.failed":"text-status-error","agent.status_changed":"text-blue-400",milestone:"text-violet-400"};function sy(r){const n=r.split(".");return n[0]==="system"&&n.length>=3?`${n[1]}.${n[n.length-1]}`:r}function V0({event:r,forceExpanded:n=!1}){var O,q;const[s,a]=T.useState(n),o=ny[sy(r.type)]||"text-text-tertiary";T.useEffect(()=>{a(n)},[n]);const f=n,h=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 d.jsxs("div",{className:"border-b border-surface-border/30 last:border-b-0",children:[d.jsxs("button",{onClick:()=>a(!s),className:`flex items-center gap-2 ${E} w-full text-left hover:bg-surface-hover/50 transition-colors`,children:[d.jsx("span",{className:`${h} font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0`,children:new Date(r.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),d.jsx("span",{className:`${m} font-medium px-1 py-0.5 rounded ${o} bg-surface-sunken whitespace-nowrap shrink-0`,children:r.type}),d.jsxs("span",{className:`${g} text-text-tertiary font-mono flex-1 min-w-0 truncate`,children:[(O=r.data)!=null&&O.workflowId?String(r.data.workflowId):"",(q=r.data)!=null&&q.escalationId?` esc:${String(r.data.escalationId).slice(0,12)}`:""]}),d.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:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),d.jsx(mh,{open:s,children:d.jsx("div",{className:w,children:d.jsx(Jw,{data:r.data})})})]})}function Xw({open:r,onToggle:n,configOpen:s,onToggleConfig:a}){const[o,f]=T.useState([]),[h,m]=T.useState(!1),[g,y]=T.useState(""),E=T.useRef(null),w=T.useRef(new Map),{subscribe:O}=T.useContext(Va),{patterns:q,pagePattern:M,userPatterns:D,addPattern:W,removePattern:se}=Dw(),ee=T.useCallback(re=>{const C=String(re.type||"unknown");if(C.startsWith("mesh."))return;const X=`${C}:${re.timestamp||""}:${re.escalationId||re.workflowId||re.taskId||""}`,ce=Date.now(),V=w.current.get(X);if(!(V&&ce-V<G0)){if(w.current.set(X,ce),w.current.size>200)for(const[G,K]of w.current)ce-K>G0*2&&w.current.delete(G);f(G=>[{id:++Iw,type:C,timestamp:re.timestamp||new Date().toISOString(),data:re},...G].slice(0,Qw))}},[]),me=T.useRef(ee);return me.current=ee,T.useEffect(()=>{const re=q.map(C=>O(C,X=>me.current(X)));return()=>re.forEach(C=>C())},[O,q.join(",")]),T.useEffect(()=>{r&&E.current&&(E.current.scrollTop=0)},[o.length,r]),d.jsxs("div",{className:"shrink-0 border-t border-surface-border bg-surface-raised",children:[d.jsxs("button",{onClick:n,className:"flex items-center gap-2 w-full px-4 py-1.5 text-left hover:bg-surface-hover transition-colors",children:[r?d.jsx(Yx,{className:"w-3 h-3 text-text-tertiary"}):d.jsx(Gx,{className:"w-3 h-3 text-text-tertiary"}),d.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:"Event Stream"}),o.length>0&&d.jsxs("span",{className:"text-[9px] text-text-tertiary",children:[o.length," events"]}),o.length>0&&!r&&d.jsx("span",{className:`text-[9px] font-medium px-1 py-0.5 rounded ${ny[sy(o[0].type)]||"text-text-tertiary"} bg-surface-sunken`,children:o[0].type}),d.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[d.jsx("span",{className:`p-0.5 cursor-pointer ${s?"text-accent":"text-text-tertiary hover:text-text-primary"}`,title:"Subscription config",onClick:re=>{re.stopPropagation(),a()},children:d.jsx(Vx,{className:"w-3 h-3"})}),o.length>0&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Fullscreen",onClick:re=>{re.stopPropagation(),m(!0)},children:d.jsx(mg,{className:"w-3 h-3"})}),d.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Clear events",onClick:re=>{re.stopPropagation(),f([])},children:d.jsx(Fx,{className:"w-3 h-3"})})]})]})]}),s&&d.jsxs("div",{className:"px-4 py-2 border-t border-surface-border/50 bg-surface-sunken/30",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mb-1.5",children:[d.jsx("span",{className:"text-[9px] text-text-quaternary uppercase tracking-wider shrink-0",children:"Subscribed:"}),d.jsx("span",{className:"text-[9px] font-mono text-accent px-1.5 py-0.5 bg-accent/10 rounded",children:M.replace("lt.events.","")}),D.map(re=>d.jsxs("span",{className:"inline-flex items-center gap-1 text-[9px] font-mono text-text-secondary px-1.5 py-0.5 bg-surface-sunken rounded",children:[re.replace("lt.events.",""),d.jsx("button",{onClick:()=>se(re),className:"text-text-quaternary hover:text-status-error",children:d.jsx($o,{className:"w-2 h-2"})})]},re))]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("input",{type:"text",value:g,onChange:re=>y(re.target.value),onKeyDown:re=>{re.key==="Enter"&&g.trim()&&(W(g.trim()),y(""))},placeholder:"task.> or file.stored",className:"input text-[10px] font-mono flex-1 py-1"}),d.jsxs("button",{onClick:()=>{g.trim()&&(W(g.trim()),y(""))},className:"text-[10px] text-accent hover:text-accent-hover flex items-center gap-0.5",children:[d.jsx(Jx,{className:"w-2.5 h-2.5"})," Add"]})]})]}),d.jsx(mh,{open:r,children:d.jsx("div",{ref:E,className:"h-48 overflow-y-auto",children:o.length===0?d.jsx("p",{className:"text-[10px] text-text-tertiary py-4 text-center",children:"Waiting for events..."}):o.map(re=>d.jsx(V0,{event:re},re.id))})}),d.jsxs(ty,{open:h,onClose:()=>m(!1),sourceRef:E,children:[d.jsx("div",{className:"sticky top-0 float-right z-10",children:d.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:d.jsx(pg,{className:"w-5 h-5"})})}),o.length===0?d.jsx("p",{className:"text-sm text-text-tertiary py-8",children:"No events captured"}):o.map(re=>d.jsx(V0,{event:re,forceExpanded:!0},re.id))]})]})}function Kw(){return Mn({queryKey:["docs"],queryFn:()=>$e("/docs"),staleTime:5*6e4})}function Zw(r){return Mn({queryKey:["docs",r],queryFn:()=>$e(`/docs/read?path=${encodeURIComponent(r)}`),enabled:!!r,staleTime:5*6e4})}function Ww(){const[r,n]=T.useState([]),[s,a]=T.useState([]),[o,f]=T.useState(null),h=T.useRef(o),m=T.useRef(r),g=T.useRef(s);h.current=o,m.current=r,g.current=s;const y=T.useCallback((M,D)=>{var se;const W=h.current;if(W){const ee=((se=D==null?void 0:D.current)==null?void 0:se.scrollTop)??0;n([...m.current,{...W,scrollTop:ee}])}a([]),f({path:M,scrollTop:0})},[]),E=T.useCallback(M=>{var ee;const D=m.current;if(D.length===0)return;const W=D[D.length-1],se=h.current;if(se){const me=((ee=M==null?void 0:M.current)==null?void 0:ee.scrollTop)??0;a([...g.current,{...se,scrollTop:me}])}n(D.slice(0,-1)),f(W),requestAnimationFrame(()=>{M!=null&&M.current&&(M.current.scrollTop=W.scrollTop)})},[]),w=T.useCallback(M=>{var ee;const D=g.current;if(D.length===0)return;const W=D[D.length-1],se=h.current;if(se){const me=((ee=M==null?void 0:M.current)==null?void 0:ee.scrollTop)??0;n([...m.current,{...se,scrollTop:me}])}a(D.slice(0,-1)),f(W),requestAnimationFrame(()=>{M!=null&&M.current&&(M.current.scrollTop=W.scrollTop)})},[]),O=T.useCallback(M=>{var se,ee;const D=h.current;if(!D)return;const W=((se=M==null?void 0:M.current)==null?void 0:se.scrollTop)??0;n([...m.current,{...D,scrollTop:W}]),a([]),f({...D,scrollTop:((ee=M==null?void 0:M.current)==null?void 0:ee.scrollTop)??0})},[]),q=T.useCallback(()=>{n([]),a([]),f(null)},[]);return{current:o,backStack:r,forwardStack:s,navigate:y,goBack:E,goForward:w,pushScrollPosition:O,reset:q}}function eS(r,n){const[s,a]=r.split("#");let o=s;if(o.startsWith("./")||o.startsWith("../")){const h=((n?n.replace(/[^/]+$/,""):"")+o).split("/"),m=[];for(const g of h)g===".."?m.pop():g&&g!=="."&&m.push(g);o=m.join("/")}return{path:o,anchor:a}}function tS(r){if(!r.startsWith("#docs"))return null;const n=r.slice(1).split(":"),s=n[1]||"README.md",a=n[2]||void 0;return{path:s,anchor:a}}function nS(r){return!r||r==="README.md"?"#docs":`#docs:${r}`}function sS({content:r,currentPath:n,onNavigate:s,onAnchorClick:a}){const o=f=>{var y;const h=f.target,m=h.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=h.closest("[data-doc-link]");if(g){f.preventDefault();const{path:E,anchor:w}=eS(g.dataset.docLink,n);s(E,w);return}};return d.jsx(ph,{content:r,className:"docs-content",onClick:o})}function iS(r){const n=[],s=new Map;for(const a of r){const o=a.path.split("/");if(o.length===1){n.push(a);continue}let f=s;for(let h=0;h<o.length-1;h++){const m=o[h];f.has(m)||f.set(m,{label:m,children:[],subdirs:new Map});const g=f.get(m);h===o.length-2?g.children.push(a):f=g.subdirs}}return{topLevel:n,dirs:s}}function rS({docs:r,selected:n,onSelect:s}){const{topLevel:a,dirs:o}=iS(r),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 h(m,g){return d.jsxs("details",{open:!0,children:[d.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:[d.jsx(Qx,{className:"w-3 h-3",strokeWidth:1.5}),m.label]}),d.jsxs("div",{className:"pl-2 space-y-0.5",children:[[...m.subdirs.values()].map(y=>h(y)),m.children.map(y=>d.jsx("button",{className:f(y.path),onClick:()=>s(y.path),children:y.title},y.path))]})]},m.label)}return d.jsxs("div",{className:"space-y-0.5",children:[a.map(m=>d.jsx("button",{className:f(m.path),onClick:()=>s(m.path),children:m.title},m.path)),[...o.values()].map(m=>h(m))]})}function aS({open:r,onClose:n}){var ce,V,G;const[s,a]=T.useState(!1),{data:o}=Kw(),f=Ww(),{data:h,isLoading:m}=Zw(((ce=f.current)==null?void 0:ce.path)??null),g=T.useRef(null),[y,E]=T.useState(null);T.useEffect(()=>{y&&(h!=null&&h.content)&&g.current&&requestAnimationFrame(()=>{var ae;const K=(ae=g.current)==null?void 0:ae.querySelector(`#${CSS.escape(y)}`);K==null||K.scrollIntoView({behavior:"smooth",block:"start"}),E(null)})},[y,h]);const w=T.useCallback(()=>{var ne;const K=tS(window.location.hash),ae=(K==null?void 0:K.path)??"README.md";((ne=f.current)==null?void 0:ne.path)!==ae&&f.navigate(ae,g),K!=null&&K.anchor&&E(K.anchor)},[f]),O=T.useRef(!0);T.useEffect(()=>{if(!r||!f.current)return;if(O.current){O.current=!1;return}const K=nS(f.current.path);window.location.hash!==K&&window.history.replaceState(null,"",window.location.pathname+window.location.search+K)},[r,(V=f.current)==null?void 0:V.path]),T.useEffect(()=>{if(!r)return;const K=()=>{window.location.hash.startsWith("#docs")&&w()};return window.addEventListener("hashchange",K),()=>window.removeEventListener("hashchange",K)},[r,w]);const q=T.useCallback((K,ae)=>{ae&&E(ae),f.navigate(K,g)},[f]),M=T.useCallback(K=>{f.navigate(K,g)},[f]),D=T.useCallback(()=>{f.goBack(g)},[f]),W=T.useCallback(()=>{f.goForward(g)},[f]),se=T.useCallback(()=>{f.pushScrollPosition(g)},[f]);if(T.useEffect(()=>{if(r){O.current=!0,w();const K=requestAnimationFrame(()=>a(!0));return()=>cancelAnimationFrame(K)}},[r]),!(r||s))return null;const me=()=>{a(!1),setTimeout(()=>{n(),f.reset()},200)},re=((G=f.current)==null?void 0:G.path)??null,C=f.backStack.length>0,X=f.forwardStack.length>0;return d.jsxs("div",{className:"fixed inset-y-0 right-0 z-50 flex",children:[d.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${s&&r?"opacity-100":"opacity-0"}`,onClick:me}),d.jsxs("div",{className:`relative ml-auto w-[40vw] min-w-[800px] max-w-[90vw] h-full bg-surface-raised border-l border-surface-border flex flex-col shadow-xl transition-transform duration-200 ease-out ${s&&r?"translate-x-0":"translate-x-full"}`,children:[d.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border shrink-0",children:[d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx("button",{onClick:D,disabled:!C,className:`p-0.5 transition-colors ${C?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Back",children:d.jsx(Ix,{className:"w-4 h-4"})}),d.jsx("button",{onClick:W,disabled:!X,className:`p-0.5 transition-colors ${X?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Forward",children:d.jsx(r0,{className:"w-4 h-4"})}),d.jsx(dg,{className:"w-4 h-4 text-accent ml-1",strokeWidth:1.5}),d.jsx("span",{className:"text-sm font-medium text-text-primary",children:"Documentation"})]}),d.jsx("button",{onClick:me,className:"p-1 text-text-tertiary hover:text-text-primary",children:d.jsx($o,{className:"w-4 h-4"})})]}),d.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[d.jsx("div",{className:"w-48 shrink-0 border-r border-surface-border overflow-y-auto py-2",children:o!=null&&o.docs?d.jsx(rS,{docs:o.docs,selected:re,onSelect:M}):d.jsx("div",{className:"px-3 py-2 text-xs text-text-tertiary",children:"Loading..."})}),d.jsx("div",{ref:g,className:"flex-1 overflow-y-auto px-6 py-4",children:re?m?d.jsxs("div",{className:"animate-pulse space-y-2",children:[d.jsx("div",{className:"h-6 bg-surface-sunken rounded w-48"}),d.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),d.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"})]}):h!=null&&h.content?d.jsx(sS,{content:h.content,currentPath:re,onNavigate:q,onAnchorClick:se}):d.jsx("p",{className:"text-xs text-text-tertiary",children:"Document not found."}):d.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-text-tertiary",children:[d.jsx(r0,{className:"w-5 h-5 mb-2"}),d.jsx("p",{className:"text-xs",children:"Select a document"})]})})]})]})]})}function lS(r){if(r.includes("/escalations"))return["escalation","human-queue"]}const F0=2e3;function oS(r){const s=r.filter(o=>!o.pending).slice(-8);return s.length===0?"":`[Prior conversation]
|
|
56
|
+
${w.trimEnd()}`)),s=s.replace(/`([^`]+)`/g,'<code class="bg-surface-sunken px-1 py-0.5 rounded text-[11px]">$1</code>'),s=s.replace(/^#### (.+)$/gm,(g,y)=>`<h4 id="${So(y)}" class="text-xs font-semibold text-text-primary mt-4 mb-1">${y}</h4>`).replace(/^### (.+)$/gm,(g,y)=>`<h3 id="${So(y)}" class="text-sm font-semibold text-text-primary mt-5 mb-1.5">${y}</h3>`).replace(/^## (.+)$/gm,(g,y)=>`<h2 id="${So(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="${So(y)}" class="text-lg font-bold text-text-primary mb-3">${y}</h1>`),s=s.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(#([^)]+)\)/g,'<a data-anchor="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]*\.md(?:#[^)]*)?)\)/g,'<a data-doc-link="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent hover:underline">$1</a>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^- (.+)$/gm,'<li class="ml-4 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^\d+\. (.+)$/gm,'<li class="ml-4 list-decimal text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^---+$/gm,'<hr class="border-surface-border my-4" />').replace(/(?:^> (.+)$\n?)+/gm,g=>{const y=g.replace(/^> /gm,"").trim(),E=/⚠️|warning|caution/i.test(y),w=/note:|ℹ️|info/i.test(y);return`<div class="${E?"bg-status-warning/5":w?"bg-accent/5":"bg-surface-sunken/50"} ${E?"border-status-warning":w?"border-accent":"border-text-tertiary"} border-l-2 rounded-r-md px-3 py-2 my-3 text-xs text-text-secondary leading-relaxed">${y}</div>`}).replace(/\n\n/g,"\0PARA\0").replace(/\n/g,"<br/>");const o=g=>g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),f=g=>new RegExp(`(${o(g)}[\\s\\S]*?<\\/li>(?:<br\\/>)?)+`,"g");s=s.replace(f('<li class="ml-8 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(f('<li class="ml-4 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(f('<li class="ml-4 list-decimal'),g=>`<ol class="list-decimal mb-3">${g}</ol>`),s=s.replace(/\x00CODE(\d+)\x00/g,(g,y)=>n[parseInt(y,10)]);const h="text-xs leading-relaxed text-text-secondary mb-2",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 q=T.index+T[0].length;E.push(w.slice(0,q)),w=w.slice(q).replace(/^<br\/>/,"").trim(),m.lastIndex=0}return w&&E.push(w),E.map(q=>{const M=q.trim();return M?/^\s*<(h[1-4]|pre|table|ul|ol|hr|div)/.test(M)?M:`<p class="${h}">${M}</p>`:""}).join("")}).join(""),s}const Fw=/(\*\*|^#{1,4}\s|^- |^\d+\.\s|```|^\|.*\|$|\[.+\]\(.+\))/m;function Jw(r){return Fw.test(r)}function ph({content:r,className:n,onClick:s}){const a=O.useMemo(()=>Vw(r),[r]);return d.jsx("div",{className:n,onClick:s,dangerouslySetInnerHTML:{__html:a}})}function Lo({data:r,depth:n=0,generation:s}){const o=s!==void 0&&s>0&&s%2===1?!1:n>0,[f,h]=O.useState(o),[m,g]=O.useState(s);if(s!==void 0&&s!==m&&(g(s),h(s%2===0&&n>0)),r==null)return d.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof r=="string")return d.jsxs("span",{className:"text-text-primary",children:['"',r,'"']});if(typeof r=="number"||typeof r=="boolean")return d.jsx("span",{className:"text-text-primary font-medium",children:String(r)});if(Array.isArray(r))return r.length===0?d.jsx("span",{className:"text-text-tertiary",children:"[]"}):f?d.jsxs("button",{onClick:()=>h(!1),className:"text-text-secondary hover:text-text-primary",children:["[",r.length," items]"]}):d.jsxs("span",{children:[d.jsx("button",{onClick:()=>h(!0),className:"text-text-tertiary hover:text-text-primary",children:"["}),d.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:r.map((y,E)=>d.jsxs("div",{children:[d.jsx(Lo,{data:y,depth:n+1,generation:s}),E<r.length-1&&d.jsx("span",{className:"text-text-tertiary",children:","})]},E))}),d.jsx("span",{className:"text-text-tertiary",children:"]"})]});if(typeof r=="object"){const y=Object.entries(r);return y.length===0?d.jsx("span",{className:"text-text-tertiary",children:"{}"}):f?d.jsxs("button",{onClick:()=>h(!1),className:"text-text-secondary hover:text-text-primary",children:["{","...","}"]}):d.jsxs("span",{children:[d.jsx("button",{onClick:()=>h(!0),className:"text-text-tertiary hover:text-text-primary",children:"{"}),d.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:y.map(([E,w],T)=>d.jsxs("div",{children:[d.jsx("span",{className:"text-text-secondary",children:E}),d.jsx("span",{className:"text-text-tertiary",children:": "}),d.jsx(Lo,{data:w,depth:n+1,generation:s}),T<y.length-1&&d.jsx("span",{className:"text-text-tertiary",children:","})]},E))}),d.jsx("span",{className:"text-text-tertiary",children:"}"})]})}return d.jsx("span",{children:String(r)})}function Ba({data:r,depth:n=0}){if(r==null)return d.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof r=="string")return r.length>40&&Jw(r)?d.jsx(ph,{content:r}):d.jsx("span",{className:"text-text-primary",children:r});if(typeof r=="number"||typeof r=="boolean")return d.jsx("span",{className:"text-text-primary font-medium",children:String(r)});if(Array.isArray(r))return r.length===0?d.jsx("span",{className:"text-text-tertiary italic",children:"empty list"}):d.jsx("div",{className:"space-y-2",children:r.map((s,a)=>d.jsxs("div",{className:"flex items-baseline gap-2",children:[d.jsxs("span",{className:"text-text-tertiary text-[10px] shrink-0",children:[a+1,"."]}),d.jsx("div",{className:"flex-1",children:d.jsx(Ba,{data:s,depth:n+1})})]},a))});if(typeof r=="object"){const s=Object.entries(r);return s.length===0?d.jsx("span",{className:"text-text-tertiary italic",children:"empty"}):d.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 d.jsxs("div",{children:[d.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-0.5",children:a.replace(/[_-]/g," ")}),f?d.jsx("p",{className:"text-sm text-text-primary",children:d.jsx(Ba,{data:o,depth:n+1})}):d.jsx(Ba,{data:o,depth:n+1})]},a)})})}return d.jsx("span",{children:String(r)})}function G0({mode:r,setMode:n,isCollapsed:s,onToggleCollapse:a,onCopy:o,copied:f,onFullscreen:h,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 d.jsxs("div",{className:"flex items-center gap-0.5 bg-surface-sunken/80 rounded-md backdrop-blur-sm",children:[r==="json"&&d.jsx("button",{onClick:a,className:E,title:s?"Expand all":"Collapse all",children:s?d.jsx(Yw,{className:y}):d.jsx($w,{className:y})}),d.jsx("button",{onClick:()=>n(r==="json"?"tree":"json"),className:E,title:r==="json"?"Outline view":"JSON view",children:r==="json"?d.jsx(Bw,{className:y}):d.jsx(Lw,{className:y})}),d.jsx("button",{onClick:o,className:E,title:"Copy to clipboard",children:f?d.jsx(Pw,{className:`${y} text-status-success`}):d.jsx(Hw,{className:y})}),h&&d.jsx("button",{onClick:h,className:E,title:"Fullscreen",children:d.jsx(pg,{className:y})}),m&&d.jsx("button",{onClick:m,className:E,title:"Close (Esc)",children:d.jsx(gg,{className:y})})]})}function Iw({data:r,label:n,variant:s,defaultCollapsed:a=!1,defaultMode:o}){const f=O.useRef(null),[h,m]=O.useState(o??"json"),[g,y]=O.useState(!1),[E,w]=O.useState(!1),[T,q]=O.useState(a?0:1),[M,D]=O.useState(1),W=T%2===0,se=M%2===0,ee=O.useCallback(()=>q(K=>K+1),[]),me=O.useCallback(()=>D(K=>K+1),[]);let re=r;if(typeof r=="string")try{re=JSON.parse(r)}catch{}const C=async()=>{const K=typeof r=="string"?r:JSON.stringify(re,null,2);await navigator.clipboard.writeText(K),y(!0),setTimeout(()=>y(!1),2e3)},X=O.useCallback(()=>{D(1),w(!0)},[]),ce=s==="panel",V=ce?"border border-accent-muted/40 rounded-lg p-3 bg-surface-hover/30":"",G=ce?"font-mono text-xs leading-relaxed bg-white rounded-md p-4 overflow-x-auto break-all":"font-mono text-xs leading-relaxed bg-surface-sunken rounded-md p-4 overflow-x-auto break-all";return d.jsxs("div",{className:V,children:[n&&d.jsx(qw,{children:n}),d.jsxs("div",{ref:f,className:"relative",children:[d.jsx("div",{className:"absolute top-2 right-2 z-[5]",children:d.jsx(G0,{mode:h,setMode:m,isCollapsed:W,onToggleCollapse:ee,onCopy:C,copied:g,onFullscreen:X})}),d.jsx("div",{className:G,children:h==="json"?d.jsx(Lo,{data:re,generation:T}):d.jsx(Ba,{data:re})})]}),d.jsxs(ny,{open:E,onClose:()=>w(!1),sourceRef:f,children:[d.jsx("div",{className:"sticky top-0 float-right z-10",children:d.jsx(G0,{mode:h,setMode:m,isCollapsed:se,onToggleCollapse:me,onCopy:C,copied:g,onClose:()=>w(!1),large:!0})}),d.jsx("div",{className:"font-mono text-sm leading-relaxed",children:h==="json"?d.jsx(Lo,{data:re,generation:M}):d.jsx(Ba,{data:re})})]})]})}const Qw=100,V0=500;let Xw=0;const sy={"escalation.created":"text-blue-400","escalation.claimed":"text-status-warning","escalation.released":"text-text-tertiary","escalation.resolved":"text-status-success","task.created":"text-accent","task.completed":"text-status-success","task.failed":"text-status-error","task.escalated":"text-status-warning","workflow.started":"text-accent","workflow.completed":"text-status-success","workflow.failed":"text-status-error","activity.started":"text-blue-400","activity.completed":"text-status-success","activity.failed":"text-status-error","knowledge.stored":"text-violet-400","knowledge.deleted":"text-text-tertiary","agent.started":"text-accent","agent.completed":"text-status-success","agent.failed":"text-status-error","agent.status_changed":"text-blue-400",milestone:"text-violet-400"};function iy(r){const n=r.split(".");return n[0]==="system"&&n.length>=3?`${n[1]}.${n[n.length-1]}`:r}function F0({event:r,forceExpanded:n=!1}){var T,q;const[s,a]=O.useState(n),o=sy[iy(r.type)]||"text-text-tertiary";O.useEffect(()=>{a(n)},[n]);const f=n,h=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 d.jsxs("div",{className:"border-b border-surface-border/30 last:border-b-0",children:[d.jsxs("button",{onClick:()=>a(!s),className:`flex items-center gap-2 ${E} w-full text-left hover:bg-surface-hover/50 transition-colors`,children:[d.jsx("span",{className:`${h} font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0`,children:new Date(r.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),d.jsx("span",{className:`${m} font-medium px-1 py-0.5 rounded ${o} bg-surface-sunken whitespace-nowrap shrink-0`,children:r.type}),d.jsxs("span",{className:`${g} text-text-tertiary font-mono flex-1 min-w-0 truncate`,children:[(T=r.data)!=null&&T.workflowId?String(r.data.workflowId):"",(q=r.data)!=null&&q.escalationId?` esc:${String(r.data.escalationId).slice(0,12)}`:""]}),d.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:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),d.jsx(mh,{open:s,children:d.jsx("div",{className:w,children:d.jsx(Iw,{data:r.data})})})]})}function Kw({open:r,onToggle:n,configOpen:s,onToggleConfig:a}){const[o,f]=O.useState([]),[h,m]=O.useState(!1),[g,y]=O.useState(""),E=O.useRef(null),w=O.useRef(new Map),{subscribe:T}=O.useContext(Fa),{patterns:q,pagePattern:M,userPatterns:D,addPattern:W,removePattern:se}=zw(),ee=O.useCallback(re=>{const C=String(re.type||"unknown");if(C.startsWith("mesh."))return;const X=`${C}:${re.timestamp||""}:${re.escalationId||re.workflowId||re.taskId||""}`,ce=Date.now(),V=w.current.get(X);if(!(V&&ce-V<V0)){if(w.current.set(X,ce),w.current.size>200)for(const[G,K]of w.current)ce-K>V0*2&&w.current.delete(G);f(G=>[{id:++Xw,type:C,timestamp:re.timestamp||new Date().toISOString(),data:re},...G].slice(0,Qw))}},[]),me=O.useRef(ee);return me.current=ee,O.useEffect(()=>{const re=q.map(C=>T(C,X=>me.current(X)));return()=>re.forEach(C=>C())},[T,q.join(",")]),O.useEffect(()=>{r&&E.current&&(E.current.scrollTop=0)},[o.length,r]),d.jsxs("div",{className:"shrink-0 border-t border-surface-border bg-surface-raised",children:[d.jsxs("button",{onClick:n,className:"flex items-center gap-2 w-full px-4 py-1.5 text-left hover:bg-surface-hover transition-colors",children:[r?d.jsx(Gx,{className:"w-3 h-3 text-text-tertiary"}):d.jsx(Vx,{className:"w-3 h-3 text-text-tertiary"}),d.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:"Event Stream"}),o.length>0&&d.jsxs("span",{className:"text-[9px] text-text-tertiary",children:[o.length," events"]}),o.length>0&&!r&&d.jsx("span",{className:`text-[9px] font-medium px-1 py-0.5 rounded ${sy[iy(o[0].type)]||"text-text-tertiary"} bg-surface-sunken`,children:o[0].type}),d.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[d.jsx("span",{className:`p-0.5 cursor-pointer ${s?"text-accent":"text-text-tertiary hover:text-text-primary"}`,title:"Subscription config",onClick:re=>{re.stopPropagation(),a()},children:d.jsx(Fx,{className:"w-3 h-3"})}),o.length>0&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Fullscreen",onClick:re=>{re.stopPropagation(),m(!0)},children:d.jsx(pg,{className:"w-3 h-3"})}),d.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Clear events",onClick:re=>{re.stopPropagation(),f([])},children:d.jsx(Jx,{className:"w-3 h-3"})})]})]})]}),s&&d.jsxs("div",{className:"px-4 py-2 border-t border-surface-border/50 bg-surface-sunken/30",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mb-1.5",children:[d.jsx("span",{className:"text-[9px] text-text-quaternary uppercase tracking-wider shrink-0",children:"Subscribed:"}),d.jsx("span",{className:"text-[9px] font-mono text-accent px-1.5 py-0.5 bg-accent/10 rounded",children:M.replace("lt.events.","")}),D.map(re=>d.jsxs("span",{className:"inline-flex items-center gap-1 text-[9px] font-mono text-text-secondary px-1.5 py-0.5 bg-surface-sunken rounded",children:[re.replace("lt.events.",""),d.jsx("button",{onClick:()=>se(re),className:"text-text-quaternary hover:text-status-error",children:d.jsx($o,{className:"w-2 h-2"})})]},re))]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("input",{type:"text",value:g,onChange:re=>y(re.target.value),onKeyDown:re=>{re.key==="Enter"&&g.trim()&&(W(g.trim()),y(""))},placeholder:"task.> or file.stored",className:"input text-[10px] font-mono flex-1 py-1"}),d.jsxs("button",{onClick:()=>{g.trim()&&(W(g.trim()),y(""))},className:"text-[10px] text-accent hover:text-accent-hover flex items-center gap-0.5",children:[d.jsx(Ix,{className:"w-2.5 h-2.5"})," Add"]})]})]}),d.jsx(mh,{open:r,children:d.jsx("div",{ref:E,className:"h-48 overflow-y-auto",children:o.length===0?d.jsx("p",{className:"text-[10px] text-text-tertiary py-4 text-center",children:"Waiting for events..."}):o.map(re=>d.jsx(F0,{event:re},re.id))})}),d.jsxs(ny,{open:h,onClose:()=>m(!1),sourceRef:E,children:[d.jsx("div",{className:"sticky top-0 float-right z-10",children:d.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:d.jsx(gg,{className:"w-5 h-5"})})}),o.length===0?d.jsx("p",{className:"text-sm text-text-tertiary py-8",children:"No events captured"}):o.map(re=>d.jsx(F0,{event:re,forceExpanded:!0},re.id))]})]})}function Zw(){return _n({queryKey:["docs"],queryFn:()=>$e("/docs"),staleTime:5*6e4})}function Ww(r){return _n({queryKey:["docs",r],queryFn:()=>$e(`/docs/read?path=${encodeURIComponent(r)}`),enabled:!!r,staleTime:5*6e4})}function eS(){const[r,n]=O.useState([]),[s,a]=O.useState([]),[o,f]=O.useState(null),h=O.useRef(o),m=O.useRef(r),g=O.useRef(s);h.current=o,m.current=r,g.current=s;const y=O.useCallback((M,D)=>{var se;const W=h.current;if(W){const ee=((se=D==null?void 0:D.current)==null?void 0:se.scrollTop)??0;n([...m.current,{...W,scrollTop:ee}])}a([]),f({path:M,scrollTop:0})},[]),E=O.useCallback(M=>{var ee;const D=m.current;if(D.length===0)return;const W=D[D.length-1],se=h.current;if(se){const me=((ee=M==null?void 0:M.current)==null?void 0:ee.scrollTop)??0;a([...g.current,{...se,scrollTop:me}])}n(D.slice(0,-1)),f(W),requestAnimationFrame(()=>{M!=null&&M.current&&(M.current.scrollTop=W.scrollTop)})},[]),w=O.useCallback(M=>{var ee;const D=g.current;if(D.length===0)return;const W=D[D.length-1],se=h.current;if(se){const me=((ee=M==null?void 0:M.current)==null?void 0:ee.scrollTop)??0;n([...m.current,{...se,scrollTop:me}])}a(D.slice(0,-1)),f(W),requestAnimationFrame(()=>{M!=null&&M.current&&(M.current.scrollTop=W.scrollTop)})},[]),T=O.useCallback(M=>{var se,ee;const D=h.current;if(!D)return;const W=((se=M==null?void 0:M.current)==null?void 0:se.scrollTop)??0;n([...m.current,{...D,scrollTop:W}]),a([]),f({...D,scrollTop:((ee=M==null?void 0:M.current)==null?void 0:ee.scrollTop)??0})},[]),q=O.useCallback(()=>{n([]),a([]),f(null)},[]);return{current:o,backStack:r,forwardStack:s,navigate:y,goBack:E,goForward:w,pushScrollPosition:T,reset:q}}function tS(r,n){const[s,a]=r.split("#");let o=s;if(o.startsWith("./")||o.startsWith("../")){const h=((n?n.replace(/[^/]+$/,""):"")+o).split("/"),m=[];for(const g of h)g===".."?m.pop():g&&g!=="."&&m.push(g);o=m.join("/")}return{path:o,anchor:a}}function nS(r){if(!r.startsWith("#docs"))return null;const n=r.slice(1).split(":"),s=n[1]||"README.md",a=n[2]||void 0;return{path:s,anchor:a}}function sS(r){return!r||r==="README.md"?"#docs":`#docs:${r}`}function iS({content:r,currentPath:n,onNavigate:s,onAnchorClick:a}){const o=f=>{var y;const h=f.target,m=h.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=h.closest("[data-doc-link]");if(g){f.preventDefault();const{path:E,anchor:w}=tS(g.dataset.docLink,n);s(E,w);return}};return d.jsx(ph,{content:r,className:"docs-content",onClick:o})}function rS(r){const n=[],s=new Map;for(const a of r){const o=a.path.split("/");if(o.length===1){n.push(a);continue}let f=s;for(let h=0;h<o.length-1;h++){const m=o[h];f.has(m)||f.set(m,{label:m,children:[],subdirs:new Map});const g=f.get(m);h===o.length-2?g.children.push(a):f=g.subdirs}}return{topLevel:n,dirs:s}}function aS({docs:r,selected:n,onSelect:s}){const{topLevel:a,dirs:o}=rS(r),f=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 h(m,g){return d.jsxs("details",{open:!0,children:[d.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:[d.jsx(Qx,{className:"w-3 h-3",strokeWidth:1.5}),m.label]}),d.jsxs("div",{className:"pl-2 space-y-0.5",children:[[...m.subdirs.values()].map(y=>h(y)),m.children.map(y=>d.jsx("button",{className:f(y.path),onClick:()=>s(y.path),children:y.title},y.path))]})]},m.label)}return d.jsxs("div",{className:"space-y-0.5",children:[a.map(m=>d.jsx("button",{className:f(m.path),onClick:()=>s(m.path),children:m.title},m.path)),[...o.values()].map(m=>h(m))]})}function lS({open:r,onClose:n}){var ce,V,G;const[s,a]=O.useState(!1),{data:o}=Zw(),f=eS(),{data:h,isLoading:m}=Ww(((ce=f.current)==null?void 0:ce.path)??null),g=O.useRef(null),[y,E]=O.useState(null);O.useEffect(()=>{y&&(h!=null&&h.content)&&g.current&&requestAnimationFrame(()=>{var ae;const K=(ae=g.current)==null?void 0:ae.querySelector(`#${CSS.escape(y)}`);K==null||K.scrollIntoView({behavior:"smooth",block:"start"}),E(null)})},[y,h]);const w=O.useCallback(()=>{var ne;const K=nS(window.location.hash),ae=(K==null?void 0:K.path)??"README.md";((ne=f.current)==null?void 0:ne.path)!==ae&&f.navigate(ae,g),K!=null&&K.anchor&&E(K.anchor)},[f]),T=O.useRef(!0);O.useEffect(()=>{if(!r||!f.current)return;if(T.current){T.current=!1;return}const K=sS(f.current.path);window.location.hash!==K&&window.history.replaceState(null,"",window.location.pathname+window.location.search+K)},[r,(V=f.current)==null?void 0:V.path]),O.useEffect(()=>{if(!r)return;const K=()=>{window.location.hash.startsWith("#docs")&&w()};return window.addEventListener("hashchange",K),()=>window.removeEventListener("hashchange",K)},[r,w]);const q=O.useCallback((K,ae)=>{ae&&E(ae),f.navigate(K,g)},[f]),M=O.useCallback(K=>{f.navigate(K,g)},[f]),D=O.useCallback(()=>{f.goBack(g)},[f]),W=O.useCallback(()=>{f.goForward(g)},[f]),se=O.useCallback(()=>{f.pushScrollPosition(g)},[f]);if(O.useEffect(()=>{if(r){T.current=!0,w();const K=requestAnimationFrame(()=>a(!0));return()=>cancelAnimationFrame(K)}},[r]),!(r||s))return null;const me=()=>{a(!1),setTimeout(()=>{n(),f.reset()},200)},re=((G=f.current)==null?void 0:G.path)??null,C=f.backStack.length>0,X=f.forwardStack.length>0;return d.jsxs("div",{className:"fixed inset-y-0 right-0 z-50 flex",children:[d.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${s&&r?"opacity-100":"opacity-0"}`,onClick:me}),d.jsxs("div",{className:`relative ml-auto w-[40vw] min-w-[800px] max-w-[90vw] h-full bg-surface-raised border-l border-surface-border flex flex-col shadow-xl transition-transform duration-200 ease-out ${s&&r?"translate-x-0":"translate-x-full"}`,children:[d.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border shrink-0",children:[d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx("button",{onClick:D,disabled:!C,className:`p-0.5 transition-colors ${C?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Back",children:d.jsx(Xx,{className:"w-4 h-4"})}),d.jsx("button",{onClick:W,disabled:!X,className:`p-0.5 transition-colors ${X?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Forward",children:d.jsx(a0,{className:"w-4 h-4"})}),d.jsx(mg,{className:"w-4 h-4 text-accent ml-1",strokeWidth:1.5}),d.jsx("span",{className:"text-sm font-medium text-text-primary",children:"Documentation"})]}),d.jsx("button",{onClick:me,className:"p-1 text-text-tertiary hover:text-text-primary",children:d.jsx($o,{className:"w-4 h-4"})})]}),d.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[d.jsx("div",{className:"w-48 shrink-0 border-r border-surface-border overflow-y-auto py-2",children:o!=null&&o.docs?d.jsx(aS,{docs:o.docs,selected:re,onSelect:M}):d.jsx("div",{className:"px-3 py-2 text-xs text-text-tertiary",children:"Loading..."})}),d.jsx("div",{ref:g,className:"flex-1 overflow-y-auto px-6 py-4",children:re?m?d.jsxs("div",{className:"animate-pulse space-y-2",children:[d.jsx("div",{className:"h-6 bg-surface-sunken rounded w-48"}),d.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),d.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"})]}):h!=null&&h.content?d.jsx(iS,{content:h.content,currentPath:re,onNavigate:q,onAnchorClick:se}):d.jsx("p",{className:"text-xs text-text-tertiary",children:"Document not found."}):d.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-text-tertiary",children:[d.jsx(a0,{className:"w-5 h-5 mb-2"}),d.jsx("p",{className:"text-xs",children:"Select a document"})]})})]})]})]})}function oS(r){if(r.includes("/escalations"))return["escalation","human-queue"]}const J0=2e3;function cS(r){const s=r.filter(o=>!o.pending).slice(-8);return s.length===0?"":`[Prior conversation]
|
|
57
57
|
${s.map(o=>`${o.role==="user"?"User":"Assistant"}: ${o.content}`).join(`
|
|
58
58
|
`)}
|
|
59
59
|
[End prior conversation]
|
|
60
60
|
|
|
61
|
-
`}function
|
|
62
|
-
... (truncated)`});const ce=`${oS(o.concat(me))}${se}`;try{const K=(await $e("/insight/mcp-query",{method:"POST",body:JSON.stringify({prompt:ce,tags:C.suggestedTags,context:C,wait:!1,direct:!0})})).workflow_id;m(K),f(ae=>ae.map(ne=>ne.id===re.id?{...ne,workflowId:K}:ne)),E.current&&clearInterval(E.current),E.current=setInterval(async()=>{var ae;try{const ne=await $e(`/workflows/${K}/result`),ke=(ae=ne==null?void 0:ne.result)==null?void 0:ae.data;if(ke){E.current&&clearInterval(E.current),E.current=null,m(null);const He=cS(ke);let Me;try{Me=(await $e(`/workflow-states/${K}/execution`)).duration_ms}catch{}f($=>$.map(te=>te.id===re.id?{...te,content:He,timestamp:new Date().toISOString(),pending:!1,durationMs:Me}:te))}}catch{}},3e3)}catch{f(G=>G.map(K=>K.id===re.id?{...K,content:"Failed to submit query. Please try again.",pending:!1}:K))}},[o,w]),W=T.useCallback(async se=>{const ee=o.find(C=>C.id===se);if(!(ee!=null&&ee.workflowId)||ee.compilationStatus==="compiling"||ee.compilationStatus==="done")return;const me=o.indexOf(ee),re=o.slice(0,me).reverse().find(C=>C.role==="user");if(re){f(C=>C.map(X=>X.id===se?{...X,compilationStatus:"compiling"}:X));try{const C=await $e("/insight/mcp-query/describe",{method:"POST",body:JSON.stringify({prompt:re.content,summary:ee.content})}),X=await $e("/yaml-workflows",{method:"POST",body:JSON.stringify({workflow_id:ee.workflowId,task_queue:"long-tail-system",workflow_name:"mcpQuery",name:C.tool_name,description:C.description,tags:C.tags,app_id:""})});await $e(`/yaml-workflows/${X.id}/deploy`,{method:"POST"}),f(ce=>ce.map(V=>V.id===se?{...V,compilationStatus:"done"}:V))}catch(C){const X=C instanceof Error?C.message:"Compilation failed";f(ce=>ce.map(V=>V.id===se?{...V,compilationStatus:"error",compilationError:X}:V))}}},[o]);return d.jsx(iy.Provider,{value:{helpOpen:s,setHelpOpen:a,toggleHelp:O,messages:o,sendMessage:D,pageContext:w,setPageContext:q,activeWorkflowId:h,clearMessages:M,compileMessage:W},children:r})}function ry(){const r=T.useContext(iy);if(!r)throw new Error("useHelpAssistant must be used within HelpAssistantProvider");return r}function fS(){const{helpOpen:r,toggleHelp:n}=ry();return d.jsx("button",{onClick:n,className:"fixed right-3 z-[45] flex items-center justify-center w-10 h-10 rounded-full bg-surface-raised shadow-lg hover:scale-110 transition-transform duration-150 border border-accent/30",style:{bottom:"44px"},"aria-label":r?"Close help":"Ask for help",children:r?d.jsx($o,{className:"w-5 h-5 text-text-tertiary",strokeWidth:1.5}):d.jsx("img",{src:`${Wt}/logo512.png`,alt:"Help",className:"w-8 h-8 -rotate-[120deg]"})})}const ay=6048e5,hS=864e5,J0=6e4,Q0=525600,I0=43200,X0=1440,K0=Symbol.for("constructDateFrom");function ds(r,n){return typeof r=="function"?r(n):r&&typeof r=="object"&&K0 in r?r[K0](n):r instanceof Date?new r.constructor(n):new Date(n)}function sn(r,n){return ds(n||r,r)}let dS={};function Fa(){return dS}function $a(r,n){var m,g,y,E;const s=Fa(),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=sn(r,n==null?void 0:n.in),f=o.getDay(),h=(f<a?7:0)+f-a;return o.setDate(o.getDate()-h),o.setHours(0,0,0,0),o}function Ho(r,n){return $a(r,{...n,weekStartsOn:1})}function ly(r,n){const s=sn(r,n==null?void 0:n.in),a=s.getFullYear(),o=ds(s,0);o.setFullYear(a+1,0,4),o.setHours(0,0,0,0);const f=Ho(o),h=ds(s,0);h.setFullYear(a,0,4),h.setHours(0,0,0,0);const m=Ho(h);return s.getTime()>=f.getTime()?a+1:s.getTime()>=m.getTime()?a:a-1}function Po(r){const n=sn(r),s=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return s.setUTCFullYear(n.getFullYear()),+r-+s}function oy(r,...n){const s=ds.bind(null,r||n.find(a=>typeof a=="object"));return n.map(s)}function Z0(r,n){const s=sn(r,n==null?void 0:n.in);return s.setHours(0,0,0,0),s}function mS(r,n,s){const[a,o]=oy(s==null?void 0:s.in,r,n),f=Z0(a),h=Z0(o),m=+f-Po(f),g=+h-Po(h);return Math.round((m-g)/hS)}function pS(r,n){const s=ly(r,n),a=ds(r,0);return a.setFullYear(s,0,4),a.setHours(0,0,0,0),Ho(a)}function gS(r,n){const s=+sn(r)-+sn(n);return s<0?-1:s>0?1:s}function yS(r){return ds(r,Date.now())}function bS(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}function xS(r){return!(!bS(r)&&typeof r!="number"||isNaN(+sn(r)))}function vS(r){return n=>{const a=(r?Math[r]:Math.trunc)(n);return a===0?0:a}}function _S(r,n){const s=sn(r,n==null?void 0:n.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}const wS={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"}},SS=(r,n,s)=>{let a;const o=wS[r];return typeof o=="string"?a=o:n===1?a=o.one:a=o.other.replace("{{count}}",n.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+a:a+" ago":a};function Sf(r){return(n={})=>{const s=n.width?String(n.width):r.defaultWidth;return r.formats[s]||r.formats[r.defaultWidth]}}const ES={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},AS={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},jS={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},OS={date:Sf({formats:ES,defaultWidth:"full"}),time:Sf({formats:AS,defaultWidth:"full"}),dateTime:Sf({formats:jS,defaultWidth:"full"})},TS={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},NS=(r,n,s,a)=>TS[r];function Ta(r){return(n,s)=>{const a=s!=null&&s.context?String(s.context):"standalone";let o;if(a==="formatting"&&r.formattingValues){const h=r.defaultFormattingWidth||r.defaultWidth,m=s!=null&&s.width?String(s.width):h;o=r.formattingValues[m]||r.formattingValues[h]}else{const h=r.defaultWidth,m=s!=null&&s.width?String(s.width):r.defaultWidth;o=r.values[m]||r.values[h]}const f=r.argumentCallback?r.argumentCallback(n):n;return o[f]}}const CS={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},kS={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},MS={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"]},RS={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"]},DS={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"}},zS={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"}},qS=(r,n)=>{const s=Number(r),a=s%100;if(a>20||a<10)switch(a%10){case 1:return s+"st";case 2:return s+"nd";case 3:return s+"rd"}return s+"th"},US={ordinalNumber:qS,era:Ta({values:CS,defaultWidth:"wide"}),quarter:Ta({values:kS,defaultWidth:"wide",argumentCallback:r=>r-1}),month:Ta({values:MS,defaultWidth:"wide"}),day:Ta({values:RS,defaultWidth:"wide"}),dayPeriod:Ta({values:DS,defaultWidth:"wide",formattingValues:zS,defaultFormattingWidth:"wide"})};function Na(r){return(n,s={})=>{const a=s.width,o=a&&r.matchPatterns[a]||r.matchPatterns[r.defaultMatchWidth],f=n.match(o);if(!f)return null;const h=f[0],m=a&&r.parsePatterns[a]||r.parsePatterns[r.defaultParseWidth],g=Array.isArray(m)?LS(m,w=>w.test(h)):BS(m,w=>w.test(h));let y;y=r.valueCallback?r.valueCallback(g):g,y=s.valueCallback?s.valueCallback(y):y;const E=n.slice(h.length);return{value:y,rest:E}}}function BS(r,n){for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)&&n(r[s]))return s}function LS(r,n){for(let s=0;s<r.length;s++)if(n(r[s]))return s}function HS(r){return(n,s={})=>{const a=n.match(r.matchPattern);if(!a)return null;const o=a[0],f=n.match(r.parsePattern);if(!f)return null;let h=r.valueCallback?r.valueCallback(f[0]):f[0];h=s.valueCallback?s.valueCallback(h):h;const m=n.slice(o.length);return{value:h,rest:m}}}const PS=/^(\d+)(th|st|nd|rd)?/i,$S=/\d+/i,YS={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},GS={any:[/^b/i,/^(a|c)/i]},VS={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},FS={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]},IS={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},XS={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]},KS={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},ZS={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}},WS={ordinalNumber:HS({matchPattern:PS,parsePattern:$S,valueCallback:r=>parseInt(r,10)}),era:Na({matchPatterns:YS,defaultMatchWidth:"wide",parsePatterns:GS,defaultParseWidth:"any"}),quarter:Na({matchPatterns:VS,defaultMatchWidth:"wide",parsePatterns:FS,defaultParseWidth:"any",valueCallback:r=>r+1}),month:Na({matchPatterns:JS,defaultMatchWidth:"wide",parsePatterns:QS,defaultParseWidth:"any"}),day:Na({matchPatterns:IS,defaultMatchWidth:"wide",parsePatterns:XS,defaultParseWidth:"any"}),dayPeriod:Na({matchPatterns:KS,defaultMatchWidth:"any",parsePatterns:ZS,defaultParseWidth:"any"})},cy={code:"en-US",formatDistance:SS,formatLong:OS,formatRelative:NS,localize:US,match:WS,options:{weekStartsOn:0,firstWeekContainsDate:1}};function e2(r,n){const s=sn(r,n==null?void 0:n.in);return mS(s,_S(s))+1}function t2(r,n){const s=sn(r,n==null?void 0:n.in),a=+Ho(s)-+pS(s);return Math.round(a/ay)+1}function uy(r,n){var E,w,O,q;const s=sn(r,n==null?void 0:n.in),a=s.getFullYear(),o=Fa(),f=(n==null?void 0:n.firstWeekContainsDate)??((w=(E=n==null?void 0:n.locale)==null?void 0:E.options)==null?void 0:w.firstWeekContainsDate)??o.firstWeekContainsDate??((q=(O=o.locale)==null?void 0:O.options)==null?void 0:q.firstWeekContainsDate)??1,h=ds((n==null?void 0:n.in)||r,0);h.setFullYear(a+1,0,f),h.setHours(0,0,0,0);const m=$a(h,n),g=ds((n==null?void 0:n.in)||r,0);g.setFullYear(a,0,f),g.setHours(0,0,0,0);const y=$a(g,n);return+s>=+m?a+1:+s>=+y?a:a-1}function n2(r,n){var m,g,y,E;const s=Fa(),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=uy(r,n),f=ds((n==null?void 0:n.in)||r,0);return f.setFullYear(o,0,a),f.setHours(0,0,0,0),$a(f,n)}function s2(r,n){const s=sn(r,n==null?void 0:n.in),a=+$a(s,n)-+n2(s,n);return Math.round(a/ay)+1}function Ve(r,n){const s=r<0?"-":"",a=Math.abs(r).toString().padStart(n,"0");return s+a}const Vs={y(r,n){const s=r.getFullYear(),a=s>0?s:1-s;return Ve(n==="yy"?a%100:a,n.length)},M(r,n){const s=r.getMonth();return n==="M"?String(s+1):Ve(s+1,2)},d(r,n){return Ve(r.getDate(),n.length)},a(r,n){const s=r.getHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return s.toUpperCase();case"aaa":return s;case"aaaaa":return s[0];case"aaaa":default:return s==="am"?"a.m.":"p.m."}},h(r,n){return Ve(r.getHours()%12||12,n.length)},H(r,n){return Ve(r.getHours(),n.length)},m(r,n){return Ve(r.getMinutes(),n.length)},s(r,n){return Ve(r.getSeconds(),n.length)},S(r,n){const s=n.length,a=r.getMilliseconds(),o=Math.trunc(a*Math.pow(10,s-3));return Ve(o,n.length)}},gr={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},W0={G:function(r,n,s){const a=r.getFullYear()>0?1:0;switch(n){case"G":case"GG":case"GGG":return s.era(a,{width:"abbreviated"});case"GGGGG":return s.era(a,{width:"narrow"});case"GGGG":default:return s.era(a,{width:"wide"})}},y:function(r,n,s){if(n==="yo"){const a=r.getFullYear(),o=a>0?a:1-a;return s.ordinalNumber(o,{unit:"year"})}return Vs.y(r,n)},Y:function(r,n,s,a){const o=uy(r,a),f=o>0?o:1-o;if(n==="YY"){const h=f%100;return Ve(h,2)}return n==="Yo"?s.ordinalNumber(f,{unit:"year"}):Ve(f,n.length)},R:function(r,n){const s=ly(r);return Ve(s,n.length)},u:function(r,n){const s=r.getFullYear();return Ve(s,n.length)},Q:function(r,n,s){const a=Math.ceil((r.getMonth()+1)/3);switch(n){case"Q":return String(a);case"QQ":return Ve(a,2);case"Qo":return s.ordinalNumber(a,{unit:"quarter"});case"QQQ":return s.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return s.quarter(a,{width:"narrow",context:"formatting"});case"QQQQ":default:return s.quarter(a,{width:"wide",context:"formatting"})}},q:function(r,n,s){const a=Math.ceil((r.getMonth()+1)/3);switch(n){case"q":return String(a);case"qq":return Ve(a,2);case"qo":return s.ordinalNumber(a,{unit:"quarter"});case"qqq":return s.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return s.quarter(a,{width:"narrow",context:"standalone"});case"qqqq":default:return s.quarter(a,{width:"wide",context:"standalone"})}},M:function(r,n,s){const a=r.getMonth();switch(n){case"M":case"MM":return Vs.M(r,n);case"Mo":return s.ordinalNumber(a+1,{unit:"month"});case"MMM":return s.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return s.month(a,{width:"narrow",context:"formatting"});case"MMMM":default:return s.month(a,{width:"wide",context:"formatting"})}},L:function(r,n,s){const a=r.getMonth();switch(n){case"L":return String(a+1);case"LL":return Ve(a+1,2);case"Lo":return s.ordinalNumber(a+1,{unit:"month"});case"LLL":return s.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return s.month(a,{width:"narrow",context:"standalone"});case"LLLL":default:return s.month(a,{width:"wide",context:"standalone"})}},w:function(r,n,s,a){const o=s2(r,a);return n==="wo"?s.ordinalNumber(o,{unit:"week"}):Ve(o,n.length)},I:function(r,n,s){const a=t2(r);return n==="Io"?s.ordinalNumber(a,{unit:"week"}):Ve(a,n.length)},d:function(r,n,s){return n==="do"?s.ordinalNumber(r.getDate(),{unit:"date"}):Vs.d(r,n)},D:function(r,n,s){const a=e2(r);return n==="Do"?s.ordinalNumber(a,{unit:"dayOfYear"}):Ve(a,n.length)},E:function(r,n,s){const a=r.getDay();switch(n){case"E":case"EE":case"EEE":return s.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return s.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(a,{width:"short",context:"formatting"});case"EEEE":default:return s.day(a,{width:"wide",context:"formatting"})}},e:function(r,n,s,a){const o=r.getDay(),f=(o-a.weekStartsOn+8)%7||7;switch(n){case"e":return String(f);case"ee":return Ve(f,2);case"eo":return s.ordinalNumber(f,{unit:"day"});case"eee":return s.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return s.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(o,{width:"short",context:"formatting"});case"eeee":default:return s.day(o,{width:"wide",context:"formatting"})}},c:function(r,n,s,a){const o=r.getDay(),f=(o-a.weekStartsOn+8)%7||7;switch(n){case"c":return String(f);case"cc":return Ve(f,n.length);case"co":return s.ordinalNumber(f,{unit:"day"});case"ccc":return s.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return s.day(o,{width:"narrow",context:"standalone"});case"cccccc":return s.day(o,{width:"short",context:"standalone"});case"cccc":default:return s.day(o,{width:"wide",context:"standalone"})}},i:function(r,n,s){const a=r.getDay(),o=a===0?7:a;switch(n){case"i":return String(o);case"ii":return Ve(o,n.length);case"io":return s.ordinalNumber(o,{unit:"day"});case"iii":return s.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return s.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return s.day(a,{width:"short",context:"formatting"});case"iiii":default:return s.day(a,{width:"wide",context:"formatting"})}},a:function(r,n,s){const o=r.getHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(r,n,s){const a=r.getHours();let o;switch(a===12?o=gr.noon:a===0?o=gr.midnight:o=a/12>=1?"pm":"am",n){case"b":case"bb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(r,n,s){const a=r.getHours();let o;switch(a>=17?o=gr.evening:a>=12?o=gr.afternoon:a>=4?o=gr.morning:o=gr.night,n){case"B":case"BB":case"BBB":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(r,n,s){if(n==="ho"){let a=r.getHours()%12;return a===0&&(a=12),s.ordinalNumber(a,{unit:"hour"})}return Vs.h(r,n)},H:function(r,n,s){return n==="Ho"?s.ordinalNumber(r.getHours(),{unit:"hour"}):Vs.H(r,n)},K:function(r,n,s){const a=r.getHours()%12;return n==="Ko"?s.ordinalNumber(a,{unit:"hour"}):Ve(a,n.length)},k:function(r,n,s){let a=r.getHours();return a===0&&(a=24),n==="ko"?s.ordinalNumber(a,{unit:"hour"}):Ve(a,n.length)},m:function(r,n,s){return n==="mo"?s.ordinalNumber(r.getMinutes(),{unit:"minute"}):Vs.m(r,n)},s:function(r,n,s){return n==="so"?s.ordinalNumber(r.getSeconds(),{unit:"second"}):Vs.s(r,n)},S:function(r,n){return Vs.S(r,n)},X:function(r,n,s){const a=r.getTimezoneOffset();if(a===0)return"Z";switch(n){case"X":return tg(a);case"XXXX":case"XX":return Ei(a);case"XXXXX":case"XXX":default:return Ei(a,":")}},x:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"x":return tg(a);case"xxxx":case"xx":return Ei(a);case"xxxxx":case"xxx":default:return Ei(a,":")}},O:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"O":case"OO":case"OOO":return"GMT"+eg(a,":");case"OOOO":default:return"GMT"+Ei(a,":")}},z:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"z":case"zz":case"zzz":return"GMT"+eg(a,":");case"zzzz":default:return"GMT"+Ei(a,":")}},t:function(r,n,s){const a=Math.trunc(+r/1e3);return Ve(a,n.length)},T:function(r,n,s){return Ve(+r,n.length)}};function eg(r,n=""){const s=r>0?"-":"+",a=Math.abs(r),o=Math.trunc(a/60),f=a%60;return f===0?s+String(o):s+String(o)+n+Ve(f,2)}function tg(r,n){return r%60===0?(r>0?"-":"+")+Ve(Math.abs(r)/60,2):Ei(r,n)}function Ei(r,n=""){const s=r>0?"-":"+",a=Math.abs(r),o=Ve(Math.trunc(a/60),2),f=Ve(a%60,2);return s+o+n+f}const ng=(r,n)=>{switch(r){case"P":return n.date({width:"short"});case"PP":return n.date({width:"medium"});case"PPP":return n.date({width:"long"});case"PPPP":default:return n.date({width:"full"})}},fy=(r,n)=>{switch(r){case"p":return n.time({width:"short"});case"pp":return n.time({width:"medium"});case"ppp":return n.time({width:"long"});case"pppp":default:return n.time({width:"full"})}},i2=(r,n)=>{const s=r.match(/(P+)(p+)?/)||[],a=s[1],o=s[2];if(!o)return ng(r,n);let f;switch(a){case"P":f=n.dateTime({width:"short"});break;case"PP":f=n.dateTime({width:"medium"});break;case"PPP":f=n.dateTime({width:"long"});break;case"PPPP":default:f=n.dateTime({width:"full"});break}return f.replace("{{date}}",ng(a,n)).replace("{{time}}",fy(o,n))},r2={p:fy,P:i2},a2=/^D+$/,l2=/^Y+$/,o2=["D","DD","YY","YYYY"];function c2(r){return a2.test(r)}function u2(r){return l2.test(r)}function f2(r,n,s){const a=h2(r,n,s);if(console.warn(a),o2.includes(r))throw new RangeError(a)}function h2(r,n,s){const a=r[0]==="Y"?"years":"days of the month";return`Use \`${r.toLowerCase()}\` instead of \`${r}\` (in \`${n}\`) for formatting ${a} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const d2=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,m2=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,p2=/^'([^]*?)'?$/,g2=/''/g,y2=/[a-zA-Z]/;function gh(r,n,s){var E,w,O,q;const a=Fa(),o=a.locale??cy,f=a.firstWeekContainsDate??((w=(E=a.locale)==null?void 0:E.options)==null?void 0:w.firstWeekContainsDate)??1,h=a.weekStartsOn??((q=(O=a.locale)==null?void 0:O.options)==null?void 0:q.weekStartsOn)??0,m=sn(r,s==null?void 0:s.in);if(!xS(m))throw new RangeError("Invalid time value");let g=n.match(m2).map(M=>{const D=M[0];if(D==="p"||D==="P"){const W=r2[D];return W(M,o.formatLong)}return M}).join("").match(d2).map(M=>{if(M==="''")return{isToken:!1,value:"'"};const D=M[0];if(D==="'")return{isToken:!1,value:b2(M)};if(W0[D])return{isToken:!0,value:M};if(D.match(y2))throw new RangeError("Format string contains an unescaped latin alphabet character `"+D+"`");return{isToken:!1,value:M}});o.localize.preprocessor&&(g=o.localize.preprocessor(m,g));const y={firstWeekContainsDate:f,weekStartsOn:h,locale:o};return g.map(M=>{if(!M.isToken)return M.value;const D=M.value;(u2(D)||c2(D))&&f2(D,n,String(r));const W=W0[D[0]];return W(m,D,o.localize,y)}).join("")}function b2(r){const n=r.match(p2);return n?n[1].replace(g2,"'"):r}function x2(r,n,s){const a=Fa(),o=(s==null?void 0:s.locale)??a.locale??cy,f=gS(r,n);if(isNaN(f))throw new RangeError("Invalid time value");const h=Object.assign({},s,{addSuffix:s==null?void 0:s.addSuffix,comparison:f}),[m,g]=oy(s==null?void 0:s.in,...f>0?[n,r]:[r,n]),y=vS((s==null?void 0:s.roundingMethod)??"round"),E=g.getTime()-m.getTime(),w=E/J0,O=Po(g)-Po(m),q=(E-O)/J0,M=s==null?void 0:s.unit;let D;if(M?D=M:w<1?D="second":w<60?D="minute":w<X0?D="hour":q<I0?D="day":q<Q0?D="month":D="year",D==="second"){const W=y(E/1e3);return o.formatDistance("xSeconds",W,h)}else if(D==="minute"){const W=y(w);return o.formatDistance("xMinutes",W,h)}else if(D==="hour"){const W=y(w/60);return o.formatDistance("xHours",W,h)}else if(D==="day"){const W=y(q/X0);return o.formatDistance("xDays",W,h)}else if(D==="month"){const W=y(q/I0);return W===12&&M!=="month"?o.formatDistance("xYears",1,h):o.formatDistance("xMonths",W,h)}else{const W=y(q/Q0);return o.formatDistance("xYears",W,h)}}function v2(r,n){return x2(r,yS(r),n)}function QE(r){return r.toLocaleString()}function IE(r){return r>=1e9?`${(r/1e9).toFixed(1).replace(/\.0$/,"")}B`:r>=1e6?`${(r/1e6).toFixed(1).replace(/\.0$/,"")}M`:r>=1e4?`${(r/1e3).toFixed(1).replace(/\.0$/,"")}K`:r.toLocaleString()}function _2(r){const n=new Date(r);return n.getTime()>Date.now()?"just now":v2(n,{addSuffix:!0})}function XE(r){const n=Date.now()-new Date(r).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 KE(r){return r<=0?"Expired":yh(r)}function w2(r){return r==null?"--":yh(r)}function ZE(r){return r?gh(new Date(r),"MMM d, yyyy h:mm a"):"--"}function yh(r){if(r<1e3)return`${Math.round(r)}ms`;if(r<6e4){const h=r/1e3;return Number.isInteger(h)?`${h}s`:`${h.toFixed(1)}s`}const n=Math.floor(r/1e3),s=Math.floor(n/86400),a=Math.floor(n%86400/3600),o=Math.floor(n%3600/60),f=n%60;return s>0?a>0?`${s}d ${a}h`:`${s}d`:a>0?o>0?`${a}h ${o}m`:`${a}h`:f>0?`${o}m ${f}s`:`${o}m`}function WE(r,n){const s=new Date(r).getTime(),a=n?new Date(n).getTime():Date.now();return yh(a-s)}function hy({options:r,children:n,className:s=""}){const[a,o]=T.useState(!1),[f,h]=T.useState(null),[m,g]=T.useState(null),y=T.useRef(null),E=T.useRef(void 0),w=T.useRef(void 0),O=220,q=T.useCallback(()=>{if(!y.current)return;const se=y.current.getBoundingClientRect(),ee=window.innerWidth-O-8,me=Math.max(8,Math.min(se.left,ee));g({top:se.bottom+4,left:me})},[]),M=T.useCallback(async(se,ee)=>{try{await navigator.clipboard.writeText(se),h(ee),clearTimeout(E.current),E.current=setTimeout(()=>h(null),1200)}catch{}},[]),D=T.useCallback(()=>{clearTimeout(w.current),q(),o(!0)},[q]),W=T.useCallback(()=>{w.current=setTimeout(()=>o(!1),150)},[]);return T.useEffect(()=>()=>{clearTimeout(E.current),clearTimeout(w.current)},[]),d.jsxs("span",{ref:y,className:`inline-flex items-center cursor-default ${s}`,onMouseEnter:D,onMouseLeave:W,children:[n,a&&m&&ug.createPortal(d.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:D,onMouseLeave:W,children:r.map(se=>d.jsxs("button",{onClick:ee=>{ee.stopPropagation(),M(se.value,se.label)},className:"flex items-center justify-between w-full px-2.5 py-1 text-left hover:bg-surface-hover transition-colors",children:[d.jsx("span",{className:"text-[9px] font-medium uppercase tracking-wider text-text-tertiary w-10 shrink-0",children:se.label}),d.jsx("span",{className:"text-[10px] font-mono text-text-secondary truncate ml-2",children:f===se.label?"✓":se.value})]},se.label))}),document.body)]})}function S2(r,n){const s=new Date(r);switch(n){case"relative":return _2(r);case"datetime":return gh(s,"MMM d, yyyy h:mm a");case"time":return s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}}function E2(r){const n=new Date(r);return[{label:"ms",value:String(n.getTime())},{label:"utc",value:n.toISOString()},{label:"local",value:gh(n,"MMM d, yyyy h:mm:ss a")}]}function A2({date:r,format:n="relative",className:s=""}){const[,a]=T.useState(0);T.useEffect(()=>{if(n!=="relative")return;const f=setInterval(()=>a(h=>h+1),3e4);return()=>clearInterval(f)},[n]);const o=T.useMemo(()=>E2(r),[r]);return d.jsx(hy,{options:o,children:d.jsx("time",{dateTime:r,className:`text-xs text-text-tertiary ${s}`,children:S2(r,n)})})}function j2({ms:r,className:n=""}){const s=w2(r),a=T.useMemo(()=>r==null?[]:[{label:"ms",value:String(r)},{label:"sec",value:`${(r/1e3).toFixed(3)}s`},{label:"text",value:s}],[r,s]);return r==null?d.jsx("span",{className:`text-xs text-text-tertiary ${n}`,children:"--"}):d.jsx(hy,{options:a,children:d.jsx("span",{className:`text-xs text-text-tertiary ${n}`,children:s})})}const O2=["sm","md","lg","full"],sg={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"},ig={sm:"Small",md:"Medium",lg:"Large",full:"Fullscreen"};function T2({which:r}){const n="stroke-current";switch(r){case"sm":return d.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:d.jsx("rect",{x:"5",y:"5",width:"7",height:"7",rx:"1.5",className:n,strokeWidth:"1.5"})});case"md":return d.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:d.jsx("rect",{x:"3",y:"3",width:"9",height:"9",rx:"1.5",className:n,strokeWidth:"1.5"})});case"lg":return d.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:d.jsx("rect",{x:"1.5",y:"1.5",width:"11",height:"11",rx:"1.5",className:n,strokeWidth:"1.5"})});case"full":return d.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:d.jsx("rect",{x:"0.75",y:"0.75",width:"12.5",height:"12.5",rx:"1.5",className:n,strokeWidth:"1.5"})})}}function N2({msg:r}){const[n,s]=T.useState(0);T.useEffect(()=>{const h=new Date(r.timestamp).getTime(),m=()=>s(Math.floor((Date.now()-h)/1e3));m();const g=setInterval(m,1e3);return()=>clearInterval(g)},[r.timestamp]);const a=Math.floor(n/60),o=n%60,f=a>0?`${a}m ${o}s`:`${o}s`;return d.jsxs("span",{className:"inline-flex flex-col gap-1.5",children:[d.jsxs("span",{className:"inline-flex items-center gap-1",children:[d.jsx("span",{className:"text-text-tertiary",children:"Thinking"}),d.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse"}),d.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:150ms]"}),d.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:300ms]"}),d.jsx("span",{className:"text-text-muted ml-1 tabular-nums",children:f})]}),r.workflowId&&d.jsxs(yr,{to:`/workflows/executions/${r.workflowId}`,className:"inline-flex items-center gap-1 text-[10px] text-accent/70 hover:text-accent transition-colors",children:[d.jsx(Kf,{className:"w-2.5 h-2.5",strokeWidth:1.5}),"watch execution"]})]})}function C2({msg:r,compileMessage:n}){const s=r.role==="assistant";return d.jsxs("div",{className:`flex items-center gap-1.5 ${s?"justify-start":"justify-end"}`,children:[d.jsx(A2,{date:r.timestamp,format:"time",className:"!text-[9px] text-text-muted/50"}),r.durationMs!=null&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"text-text-muted/30 text-[8px]",children:"·"}),d.jsx(j2,{ms:r.durationMs,className:"!text-[9px] text-text-muted/50"})]}),r.workflowId&&d.jsx(yr,{to:`/workflows/executions/${r.workflowId}`,className:"text-text-muted/40 hover:text-accent transition-colors",title:"View workflow execution",children:d.jsx(Kf,{className:"w-2.5 h-2.5",strokeWidth:1.5})}),s&&r.workflowId&&!r.pending&&d.jsx("button",{onClick:()=>n(r.id),disabled:r.compilationStatus==="compiling"||r.compilationStatus==="done",className:"transition-colors",title:r.compilationStatus==="done"?"Compiled — future queries will match this pipeline":r.compilationStatus==="error"?r.compilationError??"Compilation failed":r.compilationStatus==="compiling"?"Compiling...":"Compile to fast pipeline",children:d.jsx(Xx,{className:`w-2.5 h-2.5 ${r.compilationStatus==="done"?"text-status-success":r.compilationStatus==="error"?"text-status-error":r.compilationStatus==="compiling"?"text-accent/40 animate-pulse":"text-text-muted/40 hover:text-accent"}`,strokeWidth:1.5})})]})}function k2(){const{helpOpen:r,setHelpOpen:n,messages:s,sendMessage:a,pageContext:o,activeWorkflowId:f,clearMessages:h,compileMessage:m}=ry(),[g,y]=T.useState(""),[E,w]=T.useState("md"),[O,q]=T.useState(!0),M=T.useRef(null),D=T.useRef(null);if(T.useEffect(()=>{M.current&&(M.current.scrollTop=M.current.scrollHeight)},[s]),T.useEffect(()=>{r&&D.current&&D.current.focus()},[r]),T.useEffect(()=>{if(!r)return;const C=X=>{X.key==="Escape"&&(E==="full"?w("lg"):E==="lg"?w("md"):E==="md"?w("sm"):n(!1))};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[r,E,n]),!r)return null;const W=()=>{const C=g.trim();!C||f||(a(C),y(""),D.current&&(D.current.style.height="auto"))},se=C=>{C.key==="Enter"&&!C.shiftKey&&(C.preventDefault(),W())},ee=E==="full",me=o.page.replace(/-/g," "),re=ee?{}:{bottom:"108px"};return d.jsxs("div",{className:`fixed z-[45] flex flex-col border border-surface-border rounded-lg overflow-hidden transition-all duration-300 ${ee?sg.full:`right-6 ${sg[E]}`} ${O?"bg-surface-raised shadow-xl":"bg-surface-raised/[0.03] shadow-lg shadow-black/5"}`,style:re,onMouseEnter:()=>q(!0),onMouseLeave:()=>q(!1),children:[d.jsxs("div",{className:`flex items-center justify-between px-4 py-2.5 border-b border-surface-border shrink-0 transition-all duration-300 ${O?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsx("p",{className:"text-xs font-medium text-text-primary truncate",children:"Help Assistant"}),d.jsx("p",{className:"text-[10px] text-text-tertiary truncate",children:me})]}),d.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[d.jsx("div",{className:"flex items-center gap-0.5 border border-surface-border rounded p-0.5",role:"radiogroup","aria-label":"Panel size",children:O2.map(C=>d.jsx("button",{onClick:()=>w(C),className:`p-1 rounded transition-colors ${C===E?"bg-accent/15 text-accent":"text-text-muted hover:text-text-secondary hover:bg-surface-hover"}`,role:"radio","aria-checked":C===E,"aria-label":ig[C],title:ig[C],children:d.jsx(T2,{which:C})},C))}),s.length>0&&d.jsx("button",{onClick:h,className:"p-1 text-text-tertiary hover:text-text-secondary transition-colors","aria-label":"Clear conversation",title:"Clear conversation",children:d.jsx(Kx,{className:"w-3.5 h-3.5",strokeWidth:1.5})}),d.jsx("button",{onClick:()=>n(!1),className:"p-1 text-text-tertiary hover:text-text-primary transition-colors","aria-label":"Close",title:"Close",children:d.jsx($o,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]})]}),d.jsxs("div",{ref:M,className:`flex-1 overflow-y-auto px-4 py-3 space-y-3 min-h-[120px] transition-all duration-300 ${O?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[s.length===0&&d.jsx("p",{className:"text-xs text-text-tertiary text-center py-6",children:"Ask anything about what you're viewing."}),s.map(C=>d.jsxs("div",{className:`text-xs leading-relaxed ${C.role==="user"?"text-right":"text-left"}`,children:[d.jsx("div",{className:`inline-block max-w-[85%] px-3 py-2 rounded-md whitespace-pre-wrap ${C.role==="user"?"bg-accent/10 text-text-primary":"bg-surface-sunken text-text-secondary"}`,children:C.pending?d.jsx(N2,{msg:C}):C.role==="assistant"?d.jsx(ph,{content:C.content}):C.content}),!C.pending&&d.jsx("div",{className:"mt-0.5",children:d.jsx(C2,{msg:C,compileMessage:m})})]},C.id))]}),d.jsxs("div",{className:`border-t border-surface-border px-3 py-2.5 flex gap-2 shrink-0 transition-all duration-300 ${O?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[d.jsx("textarea",{ref:D,value:g,onChange:C=>{y(C.target.value);const X=C.target;X.style.height="auto",X.style.height=`${Math.min(X.scrollHeight,120)}px`},onKeyDown:se,placeholder:"Ask a question...",rows:2,className:"flex-1 resize-none bg-surface text-xs text-text-primary placeholder:text-text-tertiary rounded px-2.5 py-1.5 border border-surface-border focus:outline-none focus:border-accent",style:{minHeight:"2.5rem"},disabled:!!f}),d.jsx("button",{onClick:W,disabled:!g.trim()||!!f,className:"px-2.5 py-1.5 text-accent hover:text-accent-hover disabled:text-text-muted transition-colors self-end","aria-label":"Send",children:d.jsx(Zx,{className:"w-4 h-4",strokeWidth:1.5})})]})]})}function M2(){var M;const{isBuilder:r,isOps:n}=Xg(),{data:s}=Io(),a=!!((M=s==null?void 0:s.ai)!=null&&M.enabled),{collapsed:o,toggle:f}=Zg(),[h,m]=T.useState(!1),[g,y]=T.useState(!1),[E,w]=T.useState(()=>window.location.hash.startsWith("#docs")),O=Ws(),q=T.useRef(null);return T.useEffect(()=>{const D=q.current;D&&(D.classList.remove("animate-page-in"),D.offsetWidth,D.classList.add("animate-page-in"))},[O.pathname]),T.useEffect(()=>{const D=()=>{window.location.hash.startsWith("#docs")&&w(!0)};return window.addEventListener("hashchange",D),()=>window.removeEventListener("hashchange",D)},[]),d.jsxs("div",{className:"h-screen bg-surface flex flex-col",children:[d.jsx(vw,{onToggleEventFeed:()=>m(D=>!D),onToggleDocs:()=>w(D=>!D)}),d.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[d.jsxs("aside",{className:`${o?"w-16":"w-60"} shrink-0 bg-surface-raised border-r border-surface-border flex flex-col transition-[width] duration-200 ease-out overflow-hidden relative z-20`,children:[d.jsxs("nav",{className:"flex-1 px-3 pt-[36px] pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:[d.jsx(Aw,{aiEnabled:a,isBuilder:r}),r&&d.jsx(jw,{}),r&&a&&d.jsx(Tw,{}),r&&d.jsx(Cw,{}),(r||n)&&d.jsx(kw,{isBuilder:r})]}),d.jsx("button",{onClick:f,className:`shrink-0 py-3 text-text-tertiary hover:text-text-secondary transition-colors duration-150 ${o?"flex justify-center":"flex items-center px-7"}`,"aria-label":o?"Expand sidebar":"Collapse sidebar",children:o?d.jsx(Wx,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):d.jsx(ev,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5})}),!o&&(s==null?void 0:s.environment)&&d.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${s.environment.longTailVersion} · HotMesh v${s.environment.hotmeshVersion} · Node ${s.environment.nodeVersion} · ${s.environment.nodeEnv}`,children:["long-tail v",s.environment.longTailVersion,d.jsx("span",{className:"mx-1 text-surface-border",children:"·"}),"HotMesh v",s.environment.hotmeshVersion]})]}),d.jsx("main",{className:"flex-1 overflow-y-auto",children:d.jsx("div",{ref:q,className:"max-w-dashboard mx-auto px-10 py-10 pb-16 animate-page-in",children:d.jsx(xr,{})})})]}),d.jsx(Xw,{open:h,onToggle:()=>m(D=>!D),configOpen:g,onToggleConfig:()=>y(D=>!D)}),d.jsx(aS,{open:E,onClose:()=>{w(!1),history.replaceState(null,"",window.location.pathname+window.location.search)}}),a&&d.jsx(fS,{}),a&&d.jsx(k2,{})]})}function R2(){const{isAuthenticated:r}=Oi(),n=Ws();return r?d.jsx(gw,{children:d.jsx(uS,{children:d.jsx(M2,{})})}):d.jsx(Bn,{to:"/login",state:{from:n.pathname},replace:!0})}function dy({provider:r,className:n="w-5 h-5"}){switch(r){case"google":return d.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:[d.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"}),d.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"}),d.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"}),d.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 d.jsx("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:d.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 d.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:[d.jsx("path",{d:"M3 3h8.5v8.5H3z",fill:"#F25022"}),d.jsx("path",{d:"M12.5 3H21v8.5h-8.5z",fill:"#7FBA00"}),d.jsx("path",{d:"M3 12.5h8.5V21H3z",fill:"#00A4EF"}),d.jsx("path",{d:"M12.5 12.5H21V21h-8.5z",fill:"#FFB900"})]});case"anthropic":return d.jsx("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:d.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 d.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[d.jsx("circle",{cx:"12",cy:"12",r:"10"}),d.jsx("path",{d:"M12 8v4l3 3"})]})}}async function D2(){return $e("/auth/oauth/providers")}async function z2(r,n){const s=n?`?label=${encodeURIComponent(n)}`:"";return $e(`/auth/oauth/connections/${r}${s}`,{method:"DELETE"})}function e3(){return Mn({queryKey:["oauth-connections"],queryFn:()=>$e("/auth/oauth/connections")})}function t3(){const r=rn();return _n({mutationFn:({provider:n,label:s})=>z2(n,s),onSuccess:()=>{r.invalidateQueries({queryKey:["oauth-connections"]})}})}function q2(){var ce;const{login:r,isAuthenticated:n}=Oi(),s=fg(),a=Ws(),o=new URLSearchParams(a.search),f=o.get("token"),h=o.get("error"),m=((ce=a.state)==null?void 0:ce.from)??o.get("returnTo")??"/",g=T.useRef(!1);f&&!g.current&&(g.current=!0,r(f,void 0,{displayName:o.get("displayName"),username:o.get("username")}));const[y,E]=T.useState(""),[w,O]=T.useState(""),[q,M]=T.useState(h||""),[D,W]=T.useState(!1),[se,ee]=T.useState(!!f),[me,re]=T.useState([]),C=T.useRef(!1);if(T.useEffect(()=>{f||C.current||(C.current=!0,(async()=>{var V,G,K,ae;try{const ne=await fetch(`${Wt}/api/settings`);if(!ne.ok)return;const ke=await ne.json();if(!((V=ke.auth)!=null&&V.sso))return;const He=await fetch(`${Wt}/api/auth/sso`,{method:"POST"});if(!He.ok){M("Host authentication required — please log in to your organization first");return}const Me=await He.json();Me.token&&((G=ke.auth)!=null&&G.ssoLogoutUrl&&sessionStorage.setItem("lt_sso_logout_url",ke.auth.ssoLogoutUrl),ee(!0),r(Me.token,void 0,{displayName:(K=Me.user)==null?void 0:K.display_name,username:(ae=Me.user)==null?void 0:ae.external_id}))}catch{}})())},[]),T.useEffect(()=>{f||D2().then(re).catch(()=>{})},[]),T.useEffect(()=>{if(!se)return;const V=setTimeout(()=>s(m,{replace:!0}),1500);return()=>clearTimeout(V)},[se]),n&&!se)return d.jsx(Bn,{to:m,replace:!0});const X=async V=>{var G,K;if(V.preventDefault(),M(""),!y.trim()||!w){M("Username and password are required");return}W(!0);try{const ae=await fetch(`${Wt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:y.trim(),password:w})}),ne=await ae.json();if(!ae.ok){M(ne.error||"Login failed");return}ee(!0),r(ne.token,{username:y.trim(),password:w},{displayName:(G=ne.user)==null?void 0:G.display_name,username:(K=ne.user)==null?void 0:K.external_id})}catch{M("Unable to connect to server")}finally{W(!1)}};return d.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center overflow-hidden",children:d.jsxs("div",{className:"w-full max-w-md p-10",children:[d.jsx("div",{className:`mb-10 transition-all duration-[1500ms] ease-in ${se?"translate-x-[120vw] -translate-y-[60vh] scale-[3] opacity-0":""}`,children:d.jsx(dh,{size:"lg",hideLabel:se})}),d.jsxs("form",{onSubmit:X,className:`space-y-5 transition-opacity duration-300 ${se?"opacity-0":""}`,children:[d.jsxs("div",{children:[d.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-text-secondary mb-2",children:"Username"}),d.jsx("input",{id:"username",type:"text",value:y,onChange:V=>E(V.target.value),className:"input",placeholder:"Enter your username",autoFocus:!se,autoComplete:"username"})]}),d.jsxs("div",{children:[d.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-text-secondary mb-2",children:"Password"}),d.jsx("input",{id:"password",type:"password",value:w,onChange:V=>O(V.target.value),className:"input",placeholder:"Enter your password",autoComplete:"current-password"})]}),q&&d.jsx("p",{className:"text-sm text-status-error",children:q}),d.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:D||se,children:D?"Signing in...":"Sign In"}),me.length>0&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex items-center gap-3 mt-6",children:[d.jsx("div",{className:"flex-1 h-px bg-border"}),d.jsx("span",{className:"text-xs text-text-tertiary",children:"or continue with"}),d.jsx("div",{className:"flex-1 h-px bg-border"})]}),d.jsx("div",{className:"space-y-2",children:me.filter(V=>V.provider!=="anthropic").map(V=>d.jsxs("a",{href:`${Wt}/api/auth/oauth/${V.provider}?returnTo=${encodeURIComponent(m)}`,className:"btn-secondary w-full flex items-center justify-center gap-2",children:[d.jsx(dy,{provider:V.provider}),"Sign in with ",V.name]},V.provider))})]})]})]})})}function rg(){const{isAuthenticated:r}=Oi(),n=fg(),s=Ws(),a=new URLSearchParams(s.search),o=a.get("state")||"";T.useEffect(()=>{r||n(`/login?returnTo=${encodeURIComponent(s.pathname+s.search)}`)},[r]);const[f,h]=T.useState(""),[m,g]=T.useState(a.get("label")||"default"),[y,E]=T.useState(""),[w,O]=T.useState(!1),q=f.trim().startsWith("sk-ant-oat"),M=f.trim().startsWith("sk-ant-api"),D=W=>{W.preventDefault();const se=f.trim();if(!se){E("A token or API key is required");return}if(!se.startsWith("sk-ant-")){E('Invalid format. Must start with "sk-ant-oat" (OAuth token) or "sk-ant-api" (API key)');return}O(!0),E("");const ee=`${Wt}/api/auth/oauth/anthropic/callback?code=${encodeURIComponent(se)}&state=${encodeURIComponent(o)}`;window.location.href=ee};return d.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:d.jsxs("div",{className:"w-full max-w-md p-10",children:[d.jsx("div",{className:"mb-10",children:d.jsx(dh,{size:"lg"})}),d.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[d.jsx(dy,{provider:"anthropic",className:"w-6 h-6"}),d.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Connect Anthropic"})]}),d.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."}),d.jsxs("form",{onSubmit:D,className:"space-y-5",children:[d.jsxs("div",{children:[d.jsx("label",{htmlFor:"token",className:"block text-sm font-medium text-text-secondary mb-2",children:"OAuth Token or API Key"}),d.jsx("input",{id:"token",type:"password",value:f,onChange:W=>h(W.target.value),className:"input",placeholder:"sk-ant-oat01-... or sk-ant-api03-...",autoFocus:!0,autoComplete:"off"}),q&&d.jsx("p",{className:"text-xs text-status-success mt-1",children:"OAuth token detected — uses your Claude subscription (flat rate)"}),M&&d.jsx("p",{className:"text-xs text-status-warning mt-1",children:"API key detected — billed per-token from your Anthropic API account"})]}),d.jsxs("div",{children:[d.jsx("label",{htmlFor:"label",className:"block text-sm font-medium text-text-secondary mb-2",children:"Label"}),d.jsx("input",{id:"label",type:"text",value:m,onChange:W=>g(W.target.value.replace(/\s+/g,"-").toLowerCase()),className:"input",placeholder:"default",autoComplete:"off"}),d.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&&d.jsx("p",{className:"text-sm text-status-error",children:y}),d.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:w,children:w?"Validating...":"Connect"}),d.jsx("a",{href:"/",className:"block text-center text-sm text-text-tertiary hover:text-text-secondary",children:"Cancel"})]}),d.jsxs("div",{className:"mt-6 space-y-3 text-xs text-text-tertiary",children:[d.jsxs("div",{children:[d.jsx("span",{className:"font-medium text-text-secondary",children:"Recommended:"})," ","Run"," ",d.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."]}),d.jsxs("div",{children:[d.jsx("span",{className:"font-medium text-text-secondary",children:"Alternative:"})," ","Use an API key from"," ",d.jsx("a",{href:"https://console.anthropic.com/settings/keys",target:"_blank",rel:"noopener noreferrer",className:"text-accent-secondary hover:underline",children:"console.anthropic.com"})," ","(billed per-token)."]})]})]})})}function So({roleTypes:r,roleNames:n,redirectTo:s="/"}){const{isSuperAdmin:a,hasRole:o,hasRoleType:f}=Oi();return a?d.jsx(xr,{}):r&&r.some(h=>f(h))?d.jsx(xr,{}):n&&n.some(h=>o(h))?d.jsx(xr,{}):d.jsx(Bn,{to:s,replace:!0})}function U2({redirectTo:r="/"}){var a;const{data:n,isLoading:s}=Io();return s||!n?null:(a=n.ai)!=null&&a.enabled?d.jsx(xr,{}):d.jsx(Bn,{to:r,replace:!0})}function B2({flag:r,redirectTo:n="/"}){var o;const{data:s,isLoading:a}=Io();return a||!s?null:((o=s.features)==null?void 0:o[r])===!1?d.jsx(Bn,{to:n,replace:!0}):d.jsx(xr,{})}const L2=T.lazy(()=>_e(()=>import("./ProcessesListPage-CUZSL06Y.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(r=>({default:r.ProcessesListPage}))),H2=T.lazy(()=>_e(()=>import("./ProcessDetailPage-olG2CS-h.js"),__vite__mapDeps([18,1,2,4,19,15,20,17,11,6,21,22,23]),import.meta.url).then(r=>({default:r.ProcessDetailPage}))),P2=T.lazy(()=>_e(()=>import("./McpOverview-DCfSCfPg.js"),__vite__mapDeps([24,1,25,26,27,28,14,15,29,6]),import.meta.url).then(r=>({default:r.McpOverview}))),$2=T.lazy(()=>_e(()=>import("./McpRunsPage-Dw7w_ZO-.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(r=>({default:r.McpRunsPage}))),Y2=T.lazy(()=>_e(()=>import("./McpRunDetailPage-Bz2UyuNm.js"),__vite__mapDeps([34,1,26,20,14,15,35,6,36,37,16,38,39,40,13]),import.meta.url).then(r=>({default:r.McpRunDetailPage}))),G2=T.lazy(()=>_e(()=>import("./McpQueryPage-D9b1T0I3.js"),__vite__mapDeps([41,1,14,15,9,10,13,12,16,8,11,32,17,33,5,6,4,42]),import.meta.url).then(r=>({default:r.McpQueryPage}))),V2=T.lazy(()=>_e(()=>import("./McpQueryDetailPage-mb7rmtNe.js"),__vite__mapDeps([43,1,14,15,20,42,6,27,4,44,36,26,3,2,45,46,47,48,49,50,35,51,38,39]),import.meta.url).then(r=>({default:r.McpQueryDetailPage}))),F2=T.lazy(()=>_e(()=>import("./EscalationsOverview-bNNVA6R2.js"),__vite__mapDeps([52,1,4,14,15,29,6]),import.meta.url).then(r=>({default:r.EscalationsOverview}))),J2=T.lazy(()=>_e(()=>import("./AvailableEscalationsPage-ClwAle76.js"),__vite__mapDeps([53,1,6,4,54,55,56,57,5,7,8,9,10,12,14,15,23,58,13,59,21,17,60,33,16]),import.meta.url).then(r=>({default:r.AvailableEscalationsPage}))),Q2=T.lazy(()=>_e(()=>import("./OperatorDashboard-CTzSDW3N.js"),__vite__mapDeps([61,1,4,57,5,6,7,8,9,10,14,15,12,33,58,13,59,21,17,60,16]),import.meta.url).then(r=>({default:r.OperatorDashboard}))),I2=T.lazy(()=>_e(()=>import("./index-CN0efCE9.js"),__vite__mapDeps([62,1,37,54,55,6,56,57,14,15,60,16,3,4,22,23,20,21,35,36]),import.meta.url).then(r=>({default:r.EscalationDetailPage}))),X2=T.lazy(()=>_e(()=>import("./WorkflowsOverview--Dkoo9Jq.js"),__vite__mapDeps([63,1,3,4,14,15,29,6]),import.meta.url).then(r=>({default:r.WorkflowsOverview}))),K2=T.lazy(()=>_e(()=>import("./index-BxdiKgnH.js"),__vite__mapDeps([64,1,3,14,15,17,65,48,49,6]),import.meta.url).then(r=>({default:r.StartWorkflowPage}))),Z2=T.lazy(()=>_e(()=>import("./index-BxdiKgnH.js"),__vite__mapDeps([64,1,3,14,15,17,65,48,49,6]),import.meta.url).then(r=>({default:r.DurableInvokePage}))),W2=T.lazy(()=>_e(()=>import("./WorkflowsDashboard-DfBgM80t.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(r=>({default:()=>r.WorkflowsDashboard({tier:"durable"})}))),eE=T.lazy(()=>_e(()=>import("./WorkflowsDashboard-DfBgM80t.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(r=>({default:()=>r.WorkflowsDashboard({tier:"all"})}))),tE=T.lazy(()=>_e(()=>import("./YamlWorkflowsPage-CJE-PxC0.js"),__vite__mapDeps([67,1,27,5,6,14,15,13,10,50,65,20]),import.meta.url).then(r=>({default:r.YamlWorkflowsPage}))),nE=T.lazy(()=>_e(()=>import("./GraphInvokePage-BPAvqHls.js"),__vite__mapDeps([68,1,27,14,15,45,47,48,49,46,6,50,65]),import.meta.url).then(r=>({default:r.GraphInvokePage}))),sE=T.lazy(()=>_e(()=>import("./YamlWorkflowDetailPage-B6HYbfFj.js"),__vite__mapDeps([69,1,27,20,65,15,6]),import.meta.url).then(r=>({default:r.YamlWorkflowDetailPage}))),iE=T.lazy(()=>_e(()=>import("./TasksListPage-CsrdIOKk.js"),__vite__mapDeps([70,1,2,3,5,6,9,10,20,59,51,12,13,14,15,17]),import.meta.url).then(r=>({default:r.TasksListPage}))),rE=T.lazy(()=>_e(()=>import("./TaskDetailPage-B_xQtJMg.js"),__vite__mapDeps([71,1,2,20,59,14,15,6]),import.meta.url).then(r=>({default:r.TaskDetailPage}))),ag=T.lazy(()=>_e(()=>import("./WorkflowExecutionPage-DAk2RqpB.js"),__vite__mapDeps([72,1,3,4,37,2,14,15,36,16,20,35,6,38,39,40,13]),import.meta.url).then(r=>({default:r.WorkflowExecutionPage}))),aE=T.lazy(()=>_e(()=>import("./AdminDashboard-C5gfVEeL.js"),__vite__mapDeps([73,1,2,4,25,19,15,6]),import.meta.url).then(r=>({default:r.AdminDashboard}))),lE=T.lazy(()=>_e(()=>import("./index-DjxTV3cn.js"),__vite__mapDeps([74,1,3,9,10,13,33,5,6,14,15,75,17]),import.meta.url).then(r=>({default:r.WorkersPage}))),oE=T.lazy(()=>_e(()=>import("./index-BAhkWcOq.js"),__vite__mapDeps([76,1,3,77,55,6,21,15,17,14,57,48,49,65]),import.meta.url).then(r=>({default:r.WorkflowConfigsPage}))),lg=T.lazy(()=>_e(()=>import("./index-BAhkWcOq.js"),__vite__mapDeps([76,1,3,77,55,6,21,15,17,14,57,48,49,65]),import.meta.url).then(r=>({default:r.WorkflowConfigDetailPage}))),cE=T.lazy(()=>_e(()=>import("./index-BzMsh6Ui.js"),__vite__mapDeps([78,1,25,10,77,55,6,14,15,13,12,5,79,47,48,49,50,46,33,20]),import.meta.url).then(r=>({default:r.McpServersPage}))),og=T.lazy(()=>_e(()=>import("./index-BsIaUbKD.js"),__vite__mapDeps([80,1,25,14,15,44,6]),import.meta.url).then(r=>({default:r.McpServerDetailPage}))),uE=T.lazy(()=>_e(()=>import("./index-DpAS4-DA.js"),__vite__mapDeps([81,1,23,5,6,9,10,12,13,11,77,55,33,14,15,21,49,57,51]),import.meta.url).then(r=>({default:r.UsersPage}))),fE=T.lazy(()=>_e(()=>import("./RolesPage-DLnaW6iD.js"),__vite__mapDeps([82,1,57,9,10,77,55,6,14,15,33]),import.meta.url).then(r=>({default:r.RolesPage}))),hE=T.lazy(()=>_e(()=>import("./index-CgD9fA9P.js"),__vite__mapDeps([83,1,14,15,55,6,56]),import.meta.url).then(r=>({default:r.MaintenancePage}))),dE=T.lazy(()=>_e(()=>import("./index-DNugmBs7.js"),__vite__mapDeps([84,1,19,15,13,5,6,31,28,55,36,75,9,10,33]),import.meta.url).then(r=>({default:r.ControlPlanePage}))),mE=T.lazy(()=>_e(()=>import("./index-Cqjf-yVP.js"),__vite__mapDeps([85,1,6,39,15,5,31,28,8,9,10,12,13,11,14,16]),import.meta.url).then(r=>({default:r.StreamMessagesPage}))),pE=T.lazy(()=>_e(()=>import("./CredentialsPage-BxJio06E.js"),__vite__mapDeps([86,1,14,15,51,77,55,6]),import.meta.url).then(r=>({default:r.CredentialsPage}))),gE=T.lazy(()=>_e(()=>import("./index-7hqtQI43.js"),__vite__mapDeps([87,1,6,14,15,13,16,8,10,88,51]),import.meta.url).then(r=>({default:r.FilesPage}))),yE=T.lazy(()=>_e(()=>import("./index-B07xLlyz.js"),__vite__mapDeps([89,1,14,15,13,16,12,10,88,51,90,44,6]),import.meta.url).then(r=>({default:r.KnowledgePage}))),bE=T.lazy(()=>_e(()=>import("./HomePage-BZ1YTrjR.js"),__vite__mapDeps([91,1,3,26,28,2,4,21,15,17,16,6]),import.meta.url).then(r=>({default:r.HomePage}))),xE=T.lazy(()=>_e(()=>import("./AgentsPage-Blhh2RsK.js"),__vite__mapDeps([92,1,93,4,5,6,8,9,10,12,13,14,15,16]),import.meta.url).then(r=>({default:r.AgentsPage}))),vE=T.lazy(()=>_e(()=>import("./AgentDetailPage-B6IE27iK.js"),__vite__mapDeps([94,1,93,95,15,4,17,6]),import.meta.url).then(r=>({default:r.AgentDetailPage}))),cg=T.lazy(()=>_e(()=>import("./AgentConfigPage-CWEnuiGN.js"),__vite__mapDeps([96,1,93,95,15,14,90,47,48,49,3,27,97,98,17,6]),import.meta.url).then(r=>({default:r.AgentConfigPage}))),_E=T.lazy(()=>_e(()=>import("./CapabilitiesPage-CrS_DTA1.js"),__vite__mapDeps([99,1,97,79,25,47,48,49,15,50,6,46,14]),import.meta.url).then(r=>({default:r.CapabilitiesPage}))),wE=T.lazy(()=>_e(()=>import("./TopicsPage-CEUfMoed.js"),__vite__mapDeps([100,1,98,14,15,6]),import.meta.url).then(r=>({default:r.TopicsPage}))),SE=T.lazy(()=>_e(()=>import("./TopicDetailPage-qyv7UWT_.js"),__vite__mapDeps([101,1,98,16,15,6]),import.meta.url).then(r=>({default:r.TopicDetailPage})));function EE(){return d.jsxs("div",{className:"animate-pulse space-y-4",children:[d.jsx("div",{className:"h-8 bg-surface-sunken rounded w-48"}),d.jsx("div",{className:"h-40 bg-surface-sunken rounded"})]})}function xe({children:r}){return d.jsx(T.Suspense,{fallback:d.jsx(EE,{}),children:d.jsx("div",{className:"animate-page-enter",children:r})})}const my=new Ax({defaultOptions:{queries:{staleTime:1e4,retry:(r,n)=>n instanceof Error&&n.message==="Session expired"?!1:r<1}}});window.addEventListener("auth:unauthorized",()=>{my.clear(),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info");const r=window.__LT_BASE__||"",n=`${r}/login`;if(window.location.pathname!==n){const s=window.location.pathname+window.location.search,a=r&&s.startsWith(r)?s.slice(r.length)||"/":s;window.location.href=`${n}?returnTo=${encodeURIComponent(a)}`}});const AE=Tx([{path:"/login",element:d.jsx(q2,{})},{path:"/connect/anthropic",element:d.jsx(rg,{})},{path:"/connect/:provider",element:d.jsx(rg,{})},{path:"/",element:d.jsx(R2,{}),children:[{index:!0,element:d.jsx(xe,{children:d.jsx(bE,{})})},{path:"processes/all",element:d.jsx(xe,{children:d.jsx(L2,{})})},{path:"processes/detail/:originId",element:d.jsx(xe,{children:d.jsx(H2,{})})},{path:"credentials",element:d.jsx(xe,{children:d.jsx(pE,{})})},{path:"connections",element:d.jsx(Bn,{to:"/credentials",replace:!0})},{path:"escalations",element:d.jsx(xe,{children:d.jsx(F2,{})})},{path:"escalations/available",element:d.jsx(xe,{children:d.jsx(J2,{})})},{path:"escalations/queue",element:d.jsx(xe,{children:d.jsx(Q2,{})})},{path:"escalations/detail/:id",element:d.jsx(xe,{children:d.jsx(I2,{})})},{path:"capabilities",element:d.jsx(xe,{children:d.jsx(_E,{})})},{path:"agents",element:d.jsx(xe,{children:d.jsx(xE,{})})},{path:"agents/new",element:d.jsx(xe,{children:d.jsx(cg,{})})},{path:"agents/:id",element:d.jsx(xe,{children:d.jsx(vE,{})})},{path:"agents/:id/edit",element:d.jsx(xe,{children:d.jsx(cg,{})})},{path:"topics",element:d.jsx(xe,{children:d.jsx(wE,{})})},{path:"topics/:topic",element:d.jsx(xe,{children:d.jsx(SE,{})})},{element:d.jsx(So,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:d.jsx(xe,{children:d.jsx(X2,{})})},{path:"workflows/executions",element:d.jsx(xe,{children:d.jsx(eE,{})})},{path:"workflows/durable/executions",element:d.jsx(xe,{children:d.jsx(W2,{})})},{path:"workflows/durable/executions/:workflowId",element:d.jsx(xe,{children:d.jsx(ag,{})})},{path:"workflows/tasks",element:d.jsx(xe,{children:d.jsx(iE,{})})},{path:"workflows/tasks/detail/:id",element:d.jsx(xe,{children:d.jsx(rE,{})})},{path:"workflows/executions/:workflowId",element:d.jsx(xe,{children:d.jsx(ag,{})})},{path:"workflows/start",element:d.jsx(xe,{children:d.jsx(K2,{})})},{path:"workflows/durable/invoke",element:d.jsx(xe,{children:d.jsx(Z2,{})})},{path:"workflows/cron",element:d.jsx(Bn,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:d.jsx(xe,{children:d.jsx(lE,{})})},{path:"workflows/registry",element:d.jsx(xe,{children:d.jsx(oE,{})})},{path:"workflows/registry/new",element:d.jsx(xe,{children:d.jsx(lg,{})})},{path:"workflows/registry/:workflowType",element:d.jsx(xe,{children:d.jsx(lg,{})})}]},{element:d.jsx(So,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"mcp/workflows",element:d.jsx(xe,{children:d.jsx(tE,{})})},{path:"mcp/workflows/invoke",element:d.jsx(xe,{children:d.jsx(nE,{})})},{path:"mcp/workflows/:id",element:d.jsx(xe,{children:d.jsx(sE,{})})},{path:"mcp/executions",element:d.jsx(xe,{children:d.jsx($2,{})})},{path:"mcp/executions/:jobId",element:d.jsx(xe,{children:d.jsx(Y2,{})})},{path:"files",element:d.jsx(xe,{children:d.jsx(gE,{})})},{path:"knowledge",element:d.jsx(xe,{children:d.jsx(yE,{})})},{element:d.jsx(U2,{}),children:[{path:"mcp",element:d.jsx(xe,{children:d.jsx(P2,{})})},{path:"mcp/queries",element:d.jsx(xe,{children:d.jsx(G2,{})})},{path:"mcp/queries/:workflowId",element:d.jsx(xe,{children:d.jsx(V2,{})})},{path:"mcp/tools",element:d.jsx(Bn,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:d.jsx(xe,{children:d.jsx(cE,{})})},{path:"mcp/servers/new",element:d.jsx(xe,{children:d.jsx(og,{})})},{path:"mcp/servers/:serverId",element:d.jsx(xe,{children:d.jsx(og,{})})}]}]},{element:d.jsx(So,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"admin",element:d.jsx(xe,{children:d.jsx(aE,{})})},{path:"admin/users",element:d.jsx(xe,{children:d.jsx(uE,{})})}]},{element:d.jsx(So,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"admin/bots",element:d.jsx(Bn,{to:"/admin/users?tab=service-accounts",replace:!0})},{path:"admin/escalation-chains",element:d.jsx(Bn,{to:"/admin/roles",replace:!0})},{path:"admin/roles",element:d.jsx(xe,{children:d.jsx(fE,{})})},{element:d.jsx(B2,{flag:"dbMaintenance"}),children:[{path:"admin/maintenance",element:d.jsx(xe,{children:d.jsx(hE,{})})}]},{path:"admin/controlplane",element:d.jsx(xe,{children:d.jsx(dE,{})})},{path:"admin/streams",element:d.jsx(xe,{children:d.jsx(mE,{})})}]}]}],{basename:window.__LT_BASE__||"/"});function jE(){return d.jsx(jx,{client:my,children:d.jsx(cv,{children:d.jsx(dw,{children:d.jsx(Nx,{router:AE})})})})}rv.createRoot(document.getElementById("root")).render(d.jsx(T.StrictMode,{children:d.jsx(jE,{})}));export{qE as A,HE as B,mh as C,j2 as D,FE as E,ty as F,gh as G,hy as H,KE as I,Jw as J,e3 as K,t3 as L,Wt as M,h_ as N,dy as O,yg as P,QE as Q,IE as R,zw as S,WE as a,A2 as b,m_ as c,$e as d,zE as e,w2 as f,UE as g,LE as h,ME as i,Oi as j,DE as k,PE as l,$E as m,YE as n,GE as o,VE as p,JE as q,RE as r,bw as s,yw as t,Io as u,Xg as v,BE as w,ZE as x,XE as y,yh as z};
|
|
63
|
-
//# sourceMappingURL=index-
|
|
61
|
+
`}function uS(r){const n=r.summary,s=r.title;if(n){const a=n.search(/\n\s*\{[\s\S]*"title"\s*:/);return a>0?n.slice(0,a).trim():n}return s||(typeof r=="string"?r:"Query completed.")}const ry=O.createContext(null);function fS({children:r}){const n=ei(),[s,a]=O.useState(!1),[o,f]=O.useState([]),[h,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(se=>!se),[]),q=O.useCallback(se=>{y(se)},[]),M=O.useCallback(()=>{f([]),m(null)},[]),D=O.useCallback(async se=>{var V;const ee=new Date().toISOString(),me={id:`user-${Date.now()}`,role:"user",content:se,timestamp:ee},re={id:`pending-${Date.now()}`,role:"assistant",content:"",timestamp:ee,pending:!0};f(G=>[...G,me,re]);const C={...w};(V=C.entities)!=null&&V.yamlContent&&C.entities.yamlContent.length>J0&&(C.entities={...C.entities,yamlContent:C.entities.yamlContent.slice(0,J0)+`
|
|
62
|
+
... (truncated)`});const ce=`${cS(o.concat(me))}${se}`;try{const K=(await $e("/insight/mcp-query",{method:"POST",body:JSON.stringify({prompt:ce,tags:C.suggestedTags,context:C,wait:!1,direct:!0})})).workflow_id;m(K),f(ae=>ae.map(ne=>ne.id===re.id?{...ne,workflowId:K}:ne)),E.current&&clearInterval(E.current),E.current=setInterval(async()=>{var ae;try{const ne=await $e(`/workflows/${K}/result`),ke=(ae=ne==null?void 0:ne.result)==null?void 0:ae.data;if(ke){E.current&&clearInterval(E.current),E.current=null,m(null);const He=uS(ke);let Me;try{Me=(await $e(`/workflow-states/${K}/execution`)).duration_ms}catch{}f($=>$.map(te=>te.id===re.id?{...te,content:He,timestamp:new Date().toISOString(),pending:!1,durationMs:Me}:te))}}catch{}},3e3)}catch{f(G=>G.map(K=>K.id===re.id?{...K,content:"Failed to submit query. Please try again.",pending:!1}:K))}},[o,w]),W=O.useCallback(async se=>{const ee=o.find(C=>C.id===se);if(!(ee!=null&&ee.workflowId)||ee.compilationStatus==="compiling"||ee.compilationStatus==="done")return;const me=o.indexOf(ee),re=o.slice(0,me).reverse().find(C=>C.role==="user");if(re){f(C=>C.map(X=>X.id===se?{...X,compilationStatus:"compiling"}:X));try{const C=await $e("/insight/mcp-query/describe",{method:"POST",body:JSON.stringify({prompt:re.content,summary:ee.content})}),X=await $e("/yaml-workflows",{method:"POST",body:JSON.stringify({workflow_id:ee.workflowId,task_queue:"long-tail-system",workflow_name:"mcpQuery",name:C.tool_name,description:C.description,tags:C.tags,app_id:""})});await $e(`/yaml-workflows/${X.id}/deploy`,{method:"POST"}),f(ce=>ce.map(V=>V.id===se?{...V,compilationStatus:"done"}:V))}catch(C){const X=C instanceof Error?C.message:"Compilation failed";f(ce=>ce.map(V=>V.id===se?{...V,compilationStatus:"error",compilationError:X}:V))}}},[o]);return d.jsx(ry.Provider,{value:{helpOpen:s,setHelpOpen:a,toggleHelp:T,messages:o,sendMessage:D,pageContext:w,setPageContext:q,activeWorkflowId:h,clearMessages:M,compileMessage:W},children:r})}function ay(){const r=O.useContext(ry);if(!r)throw new Error("useHelpAssistant must be used within HelpAssistantProvider");return r}function hS(){const{helpOpen:r,toggleHelp:n}=ay();return d.jsx("button",{onClick:n,className:"fixed right-3 z-[45] flex items-center justify-center w-10 h-10 rounded-full bg-surface-raised shadow-lg hover:scale-110 transition-transform duration-150 border border-accent/30",style:{bottom:"44px"},"aria-label":r?"Close help":"Ask for help",children:r?d.jsx($o,{className:"w-5 h-5 text-text-tertiary",strokeWidth:1.5}):d.jsx("img",{src:`${Wt}/logo512.png`,alt:"Help",className:"w-8 h-8 -rotate-[120deg]"})})}const ly=6048e5,dS=864e5,I0=6e4,Q0=525600,X0=43200,K0=1440,Z0=Symbol.for("constructDateFrom");function ds(r,n){return typeof r=="function"?r(n):r&&typeof r=="object"&&Z0 in r?r[Z0](n):r instanceof Date?new r.constructor(n):new Date(n)}function sn(r,n){return ds(n||r,r)}let mS={};function Ja(){return mS}function Ya(r,n){var m,g,y,E;const s=Ja(),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=sn(r,n==null?void 0:n.in),f=o.getDay(),h=(f<a?7:0)+f-a;return o.setDate(o.getDate()-h),o.setHours(0,0,0,0),o}function Ho(r,n){return Ya(r,{...n,weekStartsOn:1})}function oy(r,n){const s=sn(r,n==null?void 0:n.in),a=s.getFullYear(),o=ds(s,0);o.setFullYear(a+1,0,4),o.setHours(0,0,0,0);const f=Ho(o),h=ds(s,0);h.setFullYear(a,0,4),h.setHours(0,0,0,0);const m=Ho(h);return s.getTime()>=f.getTime()?a+1:s.getTime()>=m.getTime()?a:a-1}function Po(r){const n=sn(r),s=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return s.setUTCFullYear(n.getFullYear()),+r-+s}function cy(r,...n){const s=ds.bind(null,r||n.find(a=>typeof a=="object"));return n.map(s)}function W0(r,n){const s=sn(r,n==null?void 0:n.in);return s.setHours(0,0,0,0),s}function pS(r,n,s){const[a,o]=cy(s==null?void 0:s.in,r,n),f=W0(a),h=W0(o),m=+f-Po(f),g=+h-Po(h);return Math.round((m-g)/dS)}function gS(r,n){const s=oy(r,n),a=ds(r,0);return a.setFullYear(s,0,4),a.setHours(0,0,0,0),Ho(a)}function yS(r,n){const s=+sn(r)-+sn(n);return s<0?-1:s>0?1:s}function bS(r){return ds(r,Date.now())}function xS(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}function vS(r){return!(!xS(r)&&typeof r!="number"||isNaN(+sn(r)))}function _S(r){return n=>{const a=(r?Math[r]:Math.trunc)(n);return a===0?0:a}}function wS(r,n){const s=sn(r,n==null?void 0:n.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}const SS={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},ES=(r,n,s)=>{let a;const o=SS[r];return typeof o=="string"?a=o:n===1?a=o.one:a=o.other.replace("{{count}}",n.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+a:a+" ago":a};function Sf(r){return(n={})=>{const s=n.width?String(n.width):r.defaultWidth;return r.formats[s]||r.formats[r.defaultWidth]}}const AS={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},jS={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},OS={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},TS={date:Sf({formats:AS,defaultWidth:"full"}),time:Sf({formats:jS,defaultWidth:"full"}),dateTime:Sf({formats:OS,defaultWidth:"full"})},NS={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},CS=(r,n,s,a)=>NS[r];function Ta(r){return(n,s)=>{const a=s!=null&&s.context?String(s.context):"standalone";let o;if(a==="formatting"&&r.formattingValues){const h=r.defaultFormattingWidth||r.defaultWidth,m=s!=null&&s.width?String(s.width):h;o=r.formattingValues[m]||r.formattingValues[h]}else{const h=r.defaultWidth,m=s!=null&&s.width?String(s.width):r.defaultWidth;o=r.values[m]||r.values[h]}const f=r.argumentCallback?r.argumentCallback(n):n;return o[f]}}const kS={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},MS={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},RS={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},DS={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},zS={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},qS={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},US=(r,n)=>{const s=Number(r),a=s%100;if(a>20||a<10)switch(a%10){case 1:return s+"st";case 2:return s+"nd";case 3:return s+"rd"}return s+"th"},BS={ordinalNumber:US,era:Ta({values:kS,defaultWidth:"wide"}),quarter:Ta({values:MS,defaultWidth:"wide",argumentCallback:r=>r-1}),month:Ta({values:RS,defaultWidth:"wide"}),day:Ta({values:DS,defaultWidth:"wide"}),dayPeriod:Ta({values:zS,defaultWidth:"wide",formattingValues:qS,defaultFormattingWidth:"wide"})};function Na(r){return(n,s={})=>{const a=s.width,o=a&&r.matchPatterns[a]||r.matchPatterns[r.defaultMatchWidth],f=n.match(o);if(!f)return null;const h=f[0],m=a&&r.parsePatterns[a]||r.parsePatterns[r.defaultParseWidth],g=Array.isArray(m)?HS(m,w=>w.test(h)):LS(m,w=>w.test(h));let y;y=r.valueCallback?r.valueCallback(g):g,y=s.valueCallback?s.valueCallback(y):y;const E=n.slice(h.length);return{value:y,rest:E}}}function LS(r,n){for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)&&n(r[s]))return s}function HS(r,n){for(let s=0;s<r.length;s++)if(n(r[s]))return s}function PS(r){return(n,s={})=>{const a=n.match(r.matchPattern);if(!a)return null;const o=a[0],f=n.match(r.parsePattern);if(!f)return null;let h=r.valueCallback?r.valueCallback(f[0]):f[0];h=s.valueCallback?s.valueCallback(h):h;const m=n.slice(o.length);return{value:h,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},JS={any:[/1/i,/2/i,/3/i,/4/i]},IS={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},QS={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},XS={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},KS={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},ZS={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},WS={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},e2={ordinalNumber:PS({matchPattern:$S,parsePattern:YS,valueCallback:r=>parseInt(r,10)}),era:Na({matchPatterns:GS,defaultMatchWidth:"wide",parsePatterns:VS,defaultParseWidth:"any"}),quarter:Na({matchPatterns:FS,defaultMatchWidth:"wide",parsePatterns:JS,defaultParseWidth:"any",valueCallback:r=>r+1}),month:Na({matchPatterns:IS,defaultMatchWidth:"wide",parsePatterns:QS,defaultParseWidth:"any"}),day:Na({matchPatterns:XS,defaultMatchWidth:"wide",parsePatterns:KS,defaultParseWidth:"any"}),dayPeriod:Na({matchPatterns:ZS,defaultMatchWidth:"any",parsePatterns:WS,defaultParseWidth:"any"})},uy={code:"en-US",formatDistance:ES,formatLong:TS,formatRelative:CS,localize:BS,match:e2,options:{weekStartsOn:0,firstWeekContainsDate:1}};function t2(r,n){const s=sn(r,n==null?void 0:n.in);return pS(s,wS(s))+1}function n2(r,n){const s=sn(r,n==null?void 0:n.in),a=+Ho(s)-+gS(s);return Math.round(a/ly)+1}function fy(r,n){var E,w,T,q;const s=sn(r,n==null?void 0:n.in),a=s.getFullYear(),o=Ja(),f=(n==null?void 0:n.firstWeekContainsDate)??((w=(E=n==null?void 0:n.locale)==null?void 0:E.options)==null?void 0:w.firstWeekContainsDate)??o.firstWeekContainsDate??((q=(T=o.locale)==null?void 0:T.options)==null?void 0:q.firstWeekContainsDate)??1,h=ds((n==null?void 0:n.in)||r,0);h.setFullYear(a+1,0,f),h.setHours(0,0,0,0);const m=Ya(h,n),g=ds((n==null?void 0:n.in)||r,0);g.setFullYear(a,0,f),g.setHours(0,0,0,0);const y=Ya(g,n);return+s>=+m?a+1:+s>=+y?a:a-1}function s2(r,n){var m,g,y,E;const s=Ja(),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=fy(r,n),f=ds((n==null?void 0:n.in)||r,0);return f.setFullYear(o,0,a),f.setHours(0,0,0,0),Ya(f,n)}function i2(r,n){const s=sn(r,n==null?void 0:n.in),a=+Ya(s,n)-+s2(s,n);return Math.round(a/ly)+1}function Ve(r,n){const s=r<0?"-":"",a=Math.abs(r).toString().padStart(n,"0");return s+a}const Vs={y(r,n){const s=r.getFullYear(),a=s>0?s:1-s;return Ve(n==="yy"?a%100:a,n.length)},M(r,n){const s=r.getMonth();return n==="M"?String(s+1):Ve(s+1,2)},d(r,n){return Ve(r.getDate(),n.length)},a(r,n){const s=r.getHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return s.toUpperCase();case"aaa":return s;case"aaaaa":return s[0];case"aaaa":default:return s==="am"?"a.m.":"p.m."}},h(r,n){return Ve(r.getHours()%12||12,n.length)},H(r,n){return Ve(r.getHours(),n.length)},m(r,n){return Ve(r.getMinutes(),n.length)},s(r,n){return Ve(r.getSeconds(),n.length)},S(r,n){const s=n.length,a=r.getMilliseconds(),o=Math.trunc(a*Math.pow(10,s-3));return Ve(o,n.length)}},gr={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},eg={G:function(r,n,s){const a=r.getFullYear()>0?1:0;switch(n){case"G":case"GG":case"GGG":return s.era(a,{width:"abbreviated"});case"GGGGG":return s.era(a,{width:"narrow"});case"GGGG":default:return s.era(a,{width:"wide"})}},y:function(r,n,s){if(n==="yo"){const a=r.getFullYear(),o=a>0?a:1-a;return s.ordinalNumber(o,{unit:"year"})}return Vs.y(r,n)},Y:function(r,n,s,a){const o=fy(r,a),f=o>0?o:1-o;if(n==="YY"){const h=f%100;return Ve(h,2)}return n==="Yo"?s.ordinalNumber(f,{unit:"year"}):Ve(f,n.length)},R:function(r,n){const s=oy(r);return Ve(s,n.length)},u:function(r,n){const s=r.getFullYear();return Ve(s,n.length)},Q:function(r,n,s){const a=Math.ceil((r.getMonth()+1)/3);switch(n){case"Q":return String(a);case"QQ":return Ve(a,2);case"Qo":return s.ordinalNumber(a,{unit:"quarter"});case"QQQ":return s.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return s.quarter(a,{width:"narrow",context:"formatting"});case"QQQQ":default:return s.quarter(a,{width:"wide",context:"formatting"})}},q:function(r,n,s){const a=Math.ceil((r.getMonth()+1)/3);switch(n){case"q":return String(a);case"qq":return Ve(a,2);case"qo":return s.ordinalNumber(a,{unit:"quarter"});case"qqq":return s.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return s.quarter(a,{width:"narrow",context:"standalone"});case"qqqq":default:return s.quarter(a,{width:"wide",context:"standalone"})}},M:function(r,n,s){const a=r.getMonth();switch(n){case"M":case"MM":return Vs.M(r,n);case"Mo":return s.ordinalNumber(a+1,{unit:"month"});case"MMM":return s.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return s.month(a,{width:"narrow",context:"formatting"});case"MMMM":default:return s.month(a,{width:"wide",context:"formatting"})}},L:function(r,n,s){const a=r.getMonth();switch(n){case"L":return String(a+1);case"LL":return Ve(a+1,2);case"Lo":return s.ordinalNumber(a+1,{unit:"month"});case"LLL":return s.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return s.month(a,{width:"narrow",context:"standalone"});case"LLLL":default:return s.month(a,{width:"wide",context:"standalone"})}},w:function(r,n,s,a){const o=i2(r,a);return n==="wo"?s.ordinalNumber(o,{unit:"week"}):Ve(o,n.length)},I:function(r,n,s){const a=n2(r);return n==="Io"?s.ordinalNumber(a,{unit:"week"}):Ve(a,n.length)},d:function(r,n,s){return n==="do"?s.ordinalNumber(r.getDate(),{unit:"date"}):Vs.d(r,n)},D:function(r,n,s){const a=t2(r);return n==="Do"?s.ordinalNumber(a,{unit:"dayOfYear"}):Ve(a,n.length)},E:function(r,n,s){const a=r.getDay();switch(n){case"E":case"EE":case"EEE":return s.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return s.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(a,{width:"short",context:"formatting"});case"EEEE":default:return s.day(a,{width:"wide",context:"formatting"})}},e:function(r,n,s,a){const o=r.getDay(),f=(o-a.weekStartsOn+8)%7||7;switch(n){case"e":return String(f);case"ee":return Ve(f,2);case"eo":return s.ordinalNumber(f,{unit:"day"});case"eee":return s.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return s.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(o,{width:"short",context:"formatting"});case"eeee":default:return s.day(o,{width:"wide",context:"formatting"})}},c:function(r,n,s,a){const o=r.getDay(),f=(o-a.weekStartsOn+8)%7||7;switch(n){case"c":return String(f);case"cc":return Ve(f,n.length);case"co":return s.ordinalNumber(f,{unit:"day"});case"ccc":return s.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return s.day(o,{width:"narrow",context:"standalone"});case"cccccc":return s.day(o,{width:"short",context:"standalone"});case"cccc":default:return s.day(o,{width:"wide",context:"standalone"})}},i:function(r,n,s){const a=r.getDay(),o=a===0?7:a;switch(n){case"i":return String(o);case"ii":return Ve(o,n.length);case"io":return s.ordinalNumber(o,{unit:"day"});case"iii":return s.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return s.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return s.day(a,{width:"short",context:"formatting"});case"iiii":default:return s.day(a,{width:"wide",context:"formatting"})}},a:function(r,n,s){const o=r.getHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(r,n,s){const a=r.getHours();let o;switch(a===12?o=gr.noon:a===0?o=gr.midnight:o=a/12>=1?"pm":"am",n){case"b":case"bb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(r,n,s){const a=r.getHours();let o;switch(a>=17?o=gr.evening:a>=12?o=gr.afternoon:a>=4?o=gr.morning:o=gr.night,n){case"B":case"BB":case"BBB":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(r,n,s){if(n==="ho"){let a=r.getHours()%12;return a===0&&(a=12),s.ordinalNumber(a,{unit:"hour"})}return Vs.h(r,n)},H:function(r,n,s){return n==="Ho"?s.ordinalNumber(r.getHours(),{unit:"hour"}):Vs.H(r,n)},K:function(r,n,s){const a=r.getHours()%12;return n==="Ko"?s.ordinalNumber(a,{unit:"hour"}):Ve(a,n.length)},k:function(r,n,s){let a=r.getHours();return a===0&&(a=24),n==="ko"?s.ordinalNumber(a,{unit:"hour"}):Ve(a,n.length)},m:function(r,n,s){return n==="mo"?s.ordinalNumber(r.getMinutes(),{unit:"minute"}):Vs.m(r,n)},s:function(r,n,s){return n==="so"?s.ordinalNumber(r.getSeconds(),{unit:"second"}):Vs.s(r,n)},S:function(r,n){return Vs.S(r,n)},X:function(r,n,s){const a=r.getTimezoneOffset();if(a===0)return"Z";switch(n){case"X":return ng(a);case"XXXX":case"XX":return Ai(a);case"XXXXX":case"XXX":default:return Ai(a,":")}},x:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"x":return ng(a);case"xxxx":case"xx":return Ai(a);case"xxxxx":case"xxx":default:return Ai(a,":")}},O:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"O":case"OO":case"OOO":return"GMT"+tg(a,":");case"OOOO":default:return"GMT"+Ai(a,":")}},z:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"z":case"zz":case"zzz":return"GMT"+tg(a,":");case"zzzz":default:return"GMT"+Ai(a,":")}},t:function(r,n,s){const a=Math.trunc(+r/1e3);return Ve(a,n.length)},T:function(r,n,s){return Ve(+r,n.length)}};function tg(r,n=""){const s=r>0?"-":"+",a=Math.abs(r),o=Math.trunc(a/60),f=a%60;return f===0?s+String(o):s+String(o)+n+Ve(f,2)}function ng(r,n){return r%60===0?(r>0?"-":"+")+Ve(Math.abs(r)/60,2):Ai(r,n)}function Ai(r,n=""){const s=r>0?"-":"+",a=Math.abs(r),o=Ve(Math.trunc(a/60),2),f=Ve(a%60,2);return s+o+n+f}const sg=(r,n)=>{switch(r){case"P":return n.date({width:"short"});case"PP":return n.date({width:"medium"});case"PPP":return n.date({width:"long"});case"PPPP":default:return n.date({width:"full"})}},hy=(r,n)=>{switch(r){case"p":return n.time({width:"short"});case"pp":return n.time({width:"medium"});case"ppp":return n.time({width:"long"});case"pppp":default:return n.time({width:"full"})}},r2=(r,n)=>{const s=r.match(/(P+)(p+)?/)||[],a=s[1],o=s[2];if(!o)return sg(r,n);let f;switch(a){case"P":f=n.dateTime({width:"short"});break;case"PP":f=n.dateTime({width:"medium"});break;case"PPP":f=n.dateTime({width:"long"});break;case"PPPP":default:f=n.dateTime({width:"full"});break}return f.replace("{{date}}",sg(a,n)).replace("{{time}}",hy(o,n))},a2={p:hy,P:r2},l2=/^D+$/,o2=/^Y+$/,c2=["D","DD","YY","YYYY"];function u2(r){return l2.test(r)}function f2(r){return o2.test(r)}function h2(r,n,s){const a=d2(r,n,s);if(console.warn(a),c2.includes(r))throw new RangeError(a)}function d2(r,n,s){const a=r[0]==="Y"?"years":"days of the month";return`Use \`${r.toLowerCase()}\` instead of \`${r}\` (in \`${n}\`) for formatting ${a} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const m2=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,p2=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,g2=/^'([^]*?)'?$/,y2=/''/g,b2=/[a-zA-Z]/;function gh(r,n,s){var E,w,T,q;const a=Ja(),o=a.locale??uy,f=a.firstWeekContainsDate??((w=(E=a.locale)==null?void 0:E.options)==null?void 0:w.firstWeekContainsDate)??1,h=a.weekStartsOn??((q=(T=a.locale)==null?void 0:T.options)==null?void 0:q.weekStartsOn)??0,m=sn(r,s==null?void 0:s.in);if(!vS(m))throw new RangeError("Invalid time value");let g=n.match(p2).map(M=>{const D=M[0];if(D==="p"||D==="P"){const W=a2[D];return W(M,o.formatLong)}return M}).join("").match(m2).map(M=>{if(M==="''")return{isToken:!1,value:"'"};const D=M[0];if(D==="'")return{isToken:!1,value:x2(M)};if(eg[D])return{isToken:!0,value:M};if(D.match(b2))throw new RangeError("Format string contains an unescaped latin alphabet character `"+D+"`");return{isToken:!1,value:M}});o.localize.preprocessor&&(g=o.localize.preprocessor(m,g));const y={firstWeekContainsDate:f,weekStartsOn:h,locale:o};return g.map(M=>{if(!M.isToken)return M.value;const D=M.value;(f2(D)||u2(D))&&h2(D,n,String(r));const W=eg[D[0]];return W(m,D,o.localize,y)}).join("")}function x2(r){const n=r.match(g2);return n?n[1].replace(y2,"'"):r}function v2(r,n,s){const a=Ja(),o=(s==null?void 0:s.locale)??a.locale??uy,f=yS(r,n);if(isNaN(f))throw new RangeError("Invalid time value");const h=Object.assign({},s,{addSuffix:s==null?void 0:s.addSuffix,comparison:f}),[m,g]=cy(s==null?void 0:s.in,...f>0?[n,r]:[r,n]),y=_S((s==null?void 0:s.roundingMethod)??"round"),E=g.getTime()-m.getTime(),w=E/I0,T=Po(g)-Po(m),q=(E-T)/I0,M=s==null?void 0:s.unit;let D;if(M?D=M:w<1?D="second":w<60?D="minute":w<K0?D="hour":q<X0?D="day":q<Q0?D="month":D="year",D==="second"){const W=y(E/1e3);return o.formatDistance("xSeconds",W,h)}else if(D==="minute"){const W=y(w);return o.formatDistance("xMinutes",W,h)}else if(D==="hour"){const W=y(w/60);return o.formatDistance("xHours",W,h)}else if(D==="day"){const W=y(q/K0);return o.formatDistance("xDays",W,h)}else if(D==="month"){const W=y(q/X0);return W===12&&M!=="month"?o.formatDistance("xYears",1,h):o.formatDistance("xMonths",W,h)}else{const W=y(q/Q0);return o.formatDistance("xYears",W,h)}}function _2(r,n){return v2(r,bS(r),n)}function ZE(r){return r.toLocaleString()}function WE(r){return r>=1e9?`${(r/1e9).toFixed(1).replace(/\.0$/,"")}B`:r>=1e6?`${(r/1e6).toFixed(1).replace(/\.0$/,"")}M`:r>=1e4?`${(r/1e3).toFixed(1).replace(/\.0$/,"")}K`:r.toLocaleString()}function w2(r){const n=new Date(r);return n.getTime()>Date.now()?"just now":_2(n,{addSuffix:!0})}function e3(r){const n=Date.now()-new Date(r).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 t3(r){return r<=0?"Expired":yh(r)}function S2(r){return r==null?"--":yh(r)}function n3(r){return r?gh(new Date(r),"MMM d, yyyy h:mm a"):"--"}function yh(r){if(r<1e3)return`${Math.round(r)}ms`;if(r<6e4){const h=r/1e3;return Number.isInteger(h)?`${h}s`:`${h.toFixed(1)}s`}const n=Math.floor(r/1e3),s=Math.floor(n/86400),a=Math.floor(n%86400/3600),o=Math.floor(n%3600/60),f=n%60;return s>0?a>0?`${s}d ${a}h`:`${s}d`:a>0?o>0?`${a}h ${o}m`:`${a}h`:f>0?`${o}m ${f}s`:`${o}m`}function s3(r,n){const s=new Date(r).getTime(),a=n?new Date(n).getTime():Date.now();return yh(a-s)}function dy({options:r,children:n,className:s=""}){const[a,o]=O.useState(!1),[f,h]=O.useState(null),[m,g]=O.useState(null),y=O.useRef(null),E=O.useRef(void 0),w=O.useRef(void 0),T=220,q=O.useCallback(()=>{if(!y.current)return;const se=y.current.getBoundingClientRect(),ee=window.innerWidth-T-8,me=Math.max(8,Math.min(se.left,ee));g({top:se.bottom+4,left:me})},[]),M=O.useCallback(async(se,ee)=>{try{await navigator.clipboard.writeText(se),h(ee),clearTimeout(E.current),E.current=setTimeout(()=>h(null),1200)}catch{}},[]),D=O.useCallback(()=>{clearTimeout(w.current),q(),o(!0)},[q]),W=O.useCallback(()=>{w.current=setTimeout(()=>o(!1),150)},[]);return O.useEffect(()=>()=>{clearTimeout(E.current),clearTimeout(w.current)},[]),d.jsxs("span",{ref:y,className:`inline-flex items-center cursor-default ${s}`,onMouseEnter:D,onMouseLeave:W,children:[n,a&&m&&fg.createPortal(d.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:D,onMouseLeave:W,children:r.map(se=>d.jsxs("button",{onClick:ee=>{ee.stopPropagation(),M(se.value,se.label)},className:"flex items-center justify-between w-full px-2.5 py-1 text-left hover:bg-surface-hover transition-colors",children:[d.jsx("span",{className:"text-[9px] font-medium uppercase tracking-wider text-text-tertiary w-10 shrink-0",children:se.label}),d.jsx("span",{className:"text-[10px] font-mono text-text-secondary truncate ml-2",children:f===se.label?"✓":se.value})]},se.label))}),document.body)]})}function E2(r,n){const s=new Date(r);switch(n){case"relative":return w2(r);case"datetime":return gh(s,"MMM d, yyyy h:mm a");case"time":return s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}}function A2(r){const n=new Date(r);return[{label:"ms",value:String(n.getTime())},{label:"utc",value:n.toISOString()},{label:"local",value:gh(n,"MMM d, yyyy h:mm:ss a")}]}function j2({date:r,format:n="relative",className:s=""}){const[,a]=O.useState(0);O.useEffect(()=>{if(n!=="relative")return;const f=setInterval(()=>a(h=>h+1),3e4);return()=>clearInterval(f)},[n]);const o=O.useMemo(()=>A2(r),[r]);return d.jsx(dy,{options:o,children:d.jsx("time",{dateTime:r,className:`text-xs text-text-tertiary ${s}`,children:E2(r,n)})})}function O2({ms:r,className:n=""}){const s=S2(r),a=O.useMemo(()=>r==null?[]:[{label:"ms",value:String(r)},{label:"sec",value:`${(r/1e3).toFixed(3)}s`},{label:"text",value:s}],[r,s]);return r==null?d.jsx("span",{className:`text-xs text-text-tertiary ${n}`,children:"--"}):d.jsx(dy,{options:a,children:d.jsx("span",{className:`text-xs text-text-tertiary ${n}`,children:s})})}const T2=["sm","md","lg","full"],ig={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"},rg={sm:"Small",md:"Medium",lg:"Large",full:"Fullscreen"};function N2({which:r}){const n="stroke-current";switch(r){case"sm":return d.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:d.jsx("rect",{x:"5",y:"5",width:"7",height:"7",rx:"1.5",className:n,strokeWidth:"1.5"})});case"md":return d.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:d.jsx("rect",{x:"3",y:"3",width:"9",height:"9",rx:"1.5",className:n,strokeWidth:"1.5"})});case"lg":return d.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:d.jsx("rect",{x:"1.5",y:"1.5",width:"11",height:"11",rx:"1.5",className:n,strokeWidth:"1.5"})});case"full":return d.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:d.jsx("rect",{x:"0.75",y:"0.75",width:"12.5",height:"12.5",rx:"1.5",className:n,strokeWidth:"1.5"})})}}function C2({msg:r}){const[n,s]=O.useState(0);O.useEffect(()=>{const h=new Date(r.timestamp).getTime(),m=()=>s(Math.floor((Date.now()-h)/1e3));m();const g=setInterval(m,1e3);return()=>clearInterval(g)},[r.timestamp]);const a=Math.floor(n/60),o=n%60,f=a>0?`${a}m ${o}s`:`${o}s`;return d.jsxs("span",{className:"inline-flex flex-col gap-1.5",children:[d.jsxs("span",{className:"inline-flex items-center gap-1",children:[d.jsx("span",{className:"text-text-tertiary",children:"Thinking"}),d.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse"}),d.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:150ms]"}),d.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:300ms]"}),d.jsx("span",{className:"text-text-muted ml-1 tabular-nums",children:f})]}),r.workflowId&&d.jsxs(yr,{to:`/workflows/executions/${r.workflowId}`,className:"inline-flex items-center gap-1 text-[10px] text-accent/70 hover:text-accent transition-colors",children:[d.jsx(Kf,{className:"w-2.5 h-2.5",strokeWidth:1.5}),"watch execution"]})]})}function k2({msg:r,compileMessage:n}){const s=r.role==="assistant";return d.jsxs("div",{className:`flex items-center gap-1.5 ${s?"justify-start":"justify-end"}`,children:[d.jsx(j2,{date:r.timestamp,format:"time",className:"!text-[9px] text-text-muted/50"}),r.durationMs!=null&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"text-text-muted/30 text-[8px]",children:"·"}),d.jsx(O2,{ms:r.durationMs,className:"!text-[9px] text-text-muted/50"})]}),r.workflowId&&d.jsx(yr,{to:`/workflows/executions/${r.workflowId}`,className:"text-text-muted/40 hover:text-accent transition-colors",title:"View workflow execution",children:d.jsx(Kf,{className:"w-2.5 h-2.5",strokeWidth:1.5})}),s&&r.workflowId&&!r.pending&&d.jsx("button",{onClick:()=>n(r.id),disabled:r.compilationStatus==="compiling"||r.compilationStatus==="done",className:"transition-colors",title:r.compilationStatus==="done"?"Compiled — future queries will match this pipeline":r.compilationStatus==="error"?r.compilationError??"Compilation failed":r.compilationStatus==="compiling"?"Compiling...":"Compile to fast pipeline",children:d.jsx(Kx,{className:`w-2.5 h-2.5 ${r.compilationStatus==="done"?"text-status-success":r.compilationStatus==="error"?"text-status-error":r.compilationStatus==="compiling"?"text-accent/40 animate-pulse":"text-text-muted/40 hover:text-accent"}`,strokeWidth:1.5})})]})}function M2(){const{helpOpen:r,setHelpOpen:n,messages:s,sendMessage:a,pageContext:o,activeWorkflowId:f,clearMessages:h,compileMessage:m}=ay(),[g,y]=O.useState(""),[E,w]=O.useState("md"),[T,q]=O.useState(!0),M=O.useRef(null),D=O.useRef(null);if(O.useEffect(()=>{M.current&&(M.current.scrollTop=M.current.scrollHeight)},[s]),O.useEffect(()=>{r&&D.current&&D.current.focus()},[r]),O.useEffect(()=>{if(!r)return;const C=X=>{X.key==="Escape"&&(E==="full"?w("lg"):E==="lg"?w("md"):E==="md"?w("sm"):n(!1))};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[r,E,n]),!r)return null;const W=()=>{const C=g.trim();!C||f||(a(C),y(""),D.current&&(D.current.style.height="auto"))},se=C=>{C.key==="Enter"&&!C.shiftKey&&(C.preventDefault(),W())},ee=E==="full",me=o.page.replace(/-/g," "),re=ee?{}:{bottom:"108px"};return d.jsxs("div",{className:`fixed z-[45] flex flex-col border border-surface-border rounded-lg overflow-hidden transition-all duration-300 ${ee?ig.full:`right-6 ${ig[E]}`} ${T?"bg-surface-raised shadow-xl":"bg-surface-raised/[0.03] shadow-lg shadow-black/5"}`,style:re,onMouseEnter:()=>q(!0),onMouseLeave:()=>q(!1),children:[d.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:[d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsx("p",{className:"text-xs font-medium text-text-primary truncate",children:"Help Assistant"}),d.jsx("p",{className:"text-[10px] text-text-tertiary truncate",children:me})]}),d.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[d.jsx("div",{className:"flex items-center gap-0.5 border border-surface-border rounded p-0.5",role:"radiogroup","aria-label":"Panel size",children:T2.map(C=>d.jsx("button",{onClick:()=>w(C),className:`p-1 rounded transition-colors ${C===E?"bg-accent/15 text-accent":"text-text-muted hover:text-text-secondary hover:bg-surface-hover"}`,role:"radio","aria-checked":C===E,"aria-label":rg[C],title:rg[C],children:d.jsx(N2,{which:C})},C))}),s.length>0&&d.jsx("button",{onClick:h,className:"p-1 text-text-tertiary hover:text-text-secondary transition-colors","aria-label":"Clear conversation",title:"Clear conversation",children:d.jsx(Zx,{className:"w-3.5 h-3.5",strokeWidth:1.5})}),d.jsx("button",{onClick:()=>n(!1),className:"p-1 text-text-tertiary hover:text-text-primary transition-colors","aria-label":"Close",title:"Close",children:d.jsx($o,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]})]}),d.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&&d.jsx("p",{className:"text-xs text-text-tertiary text-center py-6",children:"Ask anything about what you're viewing."}),s.map(C=>d.jsxs("div",{className:`text-xs leading-relaxed ${C.role==="user"?"text-right":"text-left"}`,children:[d.jsx("div",{className:`inline-block max-w-[85%] px-3 py-2 rounded-md whitespace-pre-wrap ${C.role==="user"?"bg-accent/10 text-text-primary":"bg-surface-sunken text-text-secondary"}`,children:C.pending?d.jsx(C2,{msg:C}):C.role==="assistant"?d.jsx(ph,{content:C.content}):C.content}),!C.pending&&d.jsx("div",{className:"mt-0.5",children:d.jsx(k2,{msg:C,compileMessage:m})})]},C.id))]}),d.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:[d.jsx("textarea",{ref:D,value:g,onChange:C=>{y(C.target.value);const X=C.target;X.style.height="auto",X.style.height=`${Math.min(X.scrollHeight,120)}px`},onKeyDown:se,placeholder:"Ask a question...",rows:2,className:"flex-1 resize-none bg-surface text-xs text-text-primary placeholder:text-text-tertiary rounded px-2.5 py-1.5 border border-surface-border focus:outline-none focus:border-accent",style:{minHeight:"2.5rem"},disabled:!!f}),d.jsx("button",{onClick:W,disabled:!g.trim()||!!f,className:"px-2.5 py-1.5 text-accent hover:text-accent-hover disabled:text-text-muted transition-colors self-end","aria-label":"Send",children:d.jsx(Wx,{className:"w-4 h-4",strokeWidth:1.5})})]})]})}function R2(){var M;const{isBuilder:r,isOps:n}=Kg(),{data:s}=Qo(),a=!!((M=s==null?void 0:s.ai)!=null&&M.enabled),{collapsed:o,toggle:f}=Wg(),[h,m]=O.useState(!1),[g,y]=O.useState(!1),[E,w]=O.useState(()=>window.location.hash.startsWith("#docs")),T=ei(),q=O.useRef(null);return O.useEffect(()=>{const D=q.current;D&&(D.classList.remove("animate-page-in"),D.offsetWidth,D.classList.add("animate-page-in"))},[T.pathname]),O.useEffect(()=>{const D=()=>{window.location.hash.startsWith("#docs")&&w(!0)};return window.addEventListener("hashchange",D),()=>window.removeEventListener("hashchange",D)},[]),d.jsxs("div",{className:"h-screen bg-surface flex flex-col",children:[d.jsx(_w,{onToggleEventFeed:()=>m(D=>!D),onToggleDocs:()=>w(D=>!D)}),d.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[d.jsxs("aside",{className:`${o?"w-16":"w-60"} shrink-0 bg-surface-raised border-r border-surface-border flex flex-col transition-[width] duration-200 ease-out overflow-hidden relative z-20`,children:[d.jsxs("nav",{className:"flex-1 px-3 pt-[36px] pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:[d.jsx(jw,{aiEnabled:a,isBuilder:r,isOps:n}),r&&d.jsx(Ow,{}),r&&a&&d.jsx(Nw,{}),r&&d.jsx(kw,{}),(r||n)&&d.jsx(Mw,{isBuilder:r,isOps:n})]}),d.jsx("button",{onClick:f,className:`shrink-0 py-3 text-text-tertiary hover:text-text-secondary transition-colors duration-150 ${o?"flex justify-center":"flex items-center px-7"}`,"aria-label":o?"Expand sidebar":"Collapse sidebar",children:o?d.jsx(ev,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):d.jsx(tv,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5})}),!o&&(s==null?void 0:s.environment)&&d.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${s.environment.longTailVersion} · HotMesh v${s.environment.hotmeshVersion} · Node ${s.environment.nodeVersion} · ${s.environment.nodeEnv}`,children:["long-tail v",s.environment.longTailVersion,d.jsx("span",{className:"mx-1 text-surface-border",children:"·"}),"HotMesh v",s.environment.hotmeshVersion]})]}),d.jsx("main",{className:"flex-1 overflow-y-auto",children:d.jsx("div",{ref:q,className:"max-w-dashboard mx-auto px-10 py-10 pb-16 animate-page-in h-full flex flex-col",children:d.jsx(xr,{})})})]}),d.jsx(Kw,{open:h,onToggle:()=>m(D=>!D),configOpen:g,onToggleConfig:()=>y(D=>!D)}),d.jsx(lS,{open:E,onClose:()=>{w(!1),history.replaceState(null,"",window.location.pathname+window.location.search)}}),a&&d.jsx(hS,{}),a&&d.jsx(M2,{})]})}function D2(){const{isAuthenticated:r}=Oi(),n=ei();return r?d.jsx(yw,{children:d.jsx(fS,{children:d.jsx(R2,{})})}):d.jsx(Bn,{to:"/login",state:{from:n.pathname},replace:!0})}function my({provider:r,className:n="w-5 h-5"}){switch(r){case"google":return d.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:[d.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"}),d.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"}),d.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"}),d.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 d.jsx("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:d.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 d.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:[d.jsx("path",{d:"M3 3h8.5v8.5H3z",fill:"#F25022"}),d.jsx("path",{d:"M12.5 3H21v8.5h-8.5z",fill:"#7FBA00"}),d.jsx("path",{d:"M3 12.5h8.5V21H3z",fill:"#00A4EF"}),d.jsx("path",{d:"M12.5 12.5H21V21h-8.5z",fill:"#FFB900"})]});case"anthropic":return d.jsx("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:d.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 d.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[d.jsx("circle",{cx:"12",cy:"12",r:"10"}),d.jsx("path",{d:"M12 8v4l3 3"})]})}}async function z2(){return $e("/auth/oauth/providers")}async function q2(r,n){const s=n?`?label=${encodeURIComponent(n)}`:"";return $e(`/auth/oauth/connections/${r}${s}`,{method:"DELETE"})}function i3(){return _n({queryKey:["oauth-connections"],queryFn:()=>$e("/auth/oauth/connections")})}function r3(){const r=rn();return wn({mutationFn:({provider:n,label:s})=>q2(n,s),onSuccess:()=>{r.invalidateQueries({queryKey:["oauth-connections"]})}})}function U2(){var ce;const{login:r,isAuthenticated:n}=Oi(),s=hg(),a=ei(),o=new URLSearchParams(a.search),f=o.get("token"),h=o.get("error"),m=((ce=a.state)==null?void 0:ce.from)??o.get("returnTo")??"/",g=O.useRef(!1);f&&!g.current&&(g.current=!0,r(f,void 0,{displayName:o.get("displayName"),username:o.get("username")}));const[y,E]=O.useState(""),[w,T]=O.useState(""),[q,M]=O.useState(h||""),[D,W]=O.useState(!1),[se,ee]=O.useState(!!f),[me,re]=O.useState([]),C=O.useRef(!1);if(O.useEffect(()=>{f||C.current||(C.current=!0,(async()=>{var V,G,K,ae;try{const ne=await fetch(`${Wt}/api/settings`);if(!ne.ok)return;const ke=await ne.json();if(!((V=ke.auth)!=null&&V.sso))return;const He=await fetch(`${Wt}/api/auth/sso`,{method:"POST"});if(!He.ok){M("Host authentication required — please log in to your organization first");return}const Me=await He.json();Me.token&&((G=ke.auth)!=null&&G.ssoLogoutUrl&&sessionStorage.setItem("lt_sso_logout_url",ke.auth.ssoLogoutUrl),ee(!0),r(Me.token,void 0,{displayName:(K=Me.user)==null?void 0:K.display_name,username:(ae=Me.user)==null?void 0:ae.external_id}))}catch{}})())},[]),O.useEffect(()=>{f||z2().then(re).catch(()=>{})},[]),O.useEffect(()=>{if(!se)return;const V=setTimeout(()=>s(m,{replace:!0}),1500);return()=>clearTimeout(V)},[se]),n&&!se)return d.jsx(Bn,{to:m,replace:!0});const X=async V=>{var G,K;if(V.preventDefault(),M(""),!y.trim()||!w){M("Username and password are required");return}W(!0);try{const ae=await fetch(`${Wt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:y.trim(),password:w})}),ne=await ae.json();if(!ae.ok){M(ne.error||"Login failed");return}ee(!0),r(ne.token,{username:y.trim(),password:w},{displayName:(G=ne.user)==null?void 0:G.display_name,username:(K=ne.user)==null?void 0:K.external_id})}catch{M("Unable to connect to server")}finally{W(!1)}};return d.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center overflow-hidden",children:d.jsxs("div",{className:"w-full max-w-md p-10",children:[d.jsx("div",{className:`mb-10 transition-all duration-[1500ms] ease-in ${se?"translate-x-[120vw] -translate-y-[60vh] scale-[3] opacity-0":""}`,children:d.jsx(dh,{size:"lg",hideLabel:se})}),d.jsxs("form",{onSubmit:X,className:`space-y-5 transition-opacity duration-300 ${se?"opacity-0":""}`,children:[d.jsxs("div",{children:[d.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-text-secondary mb-2",children:"Username"}),d.jsx("input",{id:"username",type:"text",value:y,onChange:V=>E(V.target.value),className:"input",placeholder:"Enter your username",autoFocus:!se,autoComplete:"username"})]}),d.jsxs("div",{children:[d.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-text-secondary mb-2",children:"Password"}),d.jsx("input",{id:"password",type:"password",value:w,onChange:V=>T(V.target.value),className:"input",placeholder:"Enter your password",autoComplete:"current-password"})]}),q&&d.jsx("p",{className:"text-sm text-status-error",children:q}),d.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:D||se,children:D?"Signing in...":"Sign In"}),me.length>0&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex items-center gap-3 mt-6",children:[d.jsx("div",{className:"flex-1 h-px bg-border"}),d.jsx("span",{className:"text-xs text-text-tertiary",children:"or continue with"}),d.jsx("div",{className:"flex-1 h-px bg-border"})]}),d.jsx("div",{className:"space-y-2",children:me.filter(V=>V.provider!=="anthropic").map(V=>d.jsxs("a",{href:`${Wt}/api/auth/oauth/${V.provider}?returnTo=${encodeURIComponent(m)}`,className:"btn-secondary w-full flex items-center justify-center gap-2",children:[d.jsx(my,{provider:V.provider}),"Sign in with ",V.name]},V.provider))})]})]})]})})}function ag(){const{isAuthenticated:r}=Oi(),n=hg(),s=ei(),a=new URLSearchParams(s.search),o=a.get("state")||"";O.useEffect(()=>{r||n(`/login?returnTo=${encodeURIComponent(s.pathname+s.search)}`)},[r]);const[f,h]=O.useState(""),[m,g]=O.useState(a.get("label")||"default"),[y,E]=O.useState(""),[w,T]=O.useState(!1),q=f.trim().startsWith("sk-ant-oat"),M=f.trim().startsWith("sk-ant-api"),D=W=>{W.preventDefault();const se=f.trim();if(!se){E("A token or API key is required");return}if(!se.startsWith("sk-ant-")){E('Invalid format. Must start with "sk-ant-oat" (OAuth token) or "sk-ant-api" (API key)');return}T(!0),E("");const ee=`${Wt}/api/auth/oauth/anthropic/callback?code=${encodeURIComponent(se)}&state=${encodeURIComponent(o)}`;window.location.href=ee};return d.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:d.jsxs("div",{className:"w-full max-w-md p-10",children:[d.jsx("div",{className:"mb-10",children:d.jsx(dh,{size:"lg"})}),d.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[d.jsx(my,{provider:"anthropic",className:"w-6 h-6"}),d.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Connect Anthropic"})]}),d.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."}),d.jsxs("form",{onSubmit:D,className:"space-y-5",children:[d.jsxs("div",{children:[d.jsx("label",{htmlFor:"token",className:"block text-sm font-medium text-text-secondary mb-2",children:"OAuth Token or API Key"}),d.jsx("input",{id:"token",type:"password",value:f,onChange:W=>h(W.target.value),className:"input",placeholder:"sk-ant-oat01-... or sk-ant-api03-...",autoFocus:!0,autoComplete:"off"}),q&&d.jsx("p",{className:"text-xs text-status-success mt-1",children:"OAuth token detected — uses your Claude subscription (flat rate)"}),M&&d.jsx("p",{className:"text-xs text-status-warning mt-1",children:"API key detected — billed per-token from your Anthropic API account"})]}),d.jsxs("div",{children:[d.jsx("label",{htmlFor:"label",className:"block text-sm font-medium text-text-secondary mb-2",children:"Label"}),d.jsx("input",{id:"label",type:"text",value:m,onChange:W=>g(W.target.value.replace(/\s+/g,"-").toLowerCase()),className:"input",placeholder:"default",autoComplete:"off"}),d.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&&d.jsx("p",{className:"text-sm text-status-error",children:y}),d.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:w,children:w?"Validating...":"Connect"}),d.jsx("a",{href:"/",className:"block text-center text-sm text-text-tertiary hover:text-text-secondary",children:"Cancel"})]}),d.jsxs("div",{className:"mt-6 space-y-3 text-xs text-text-tertiary",children:[d.jsxs("div",{children:[d.jsx("span",{className:"font-medium text-text-secondary",children:"Recommended:"})," ","Run"," ",d.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."]}),d.jsxs("div",{children:[d.jsx("span",{className:"font-medium text-text-secondary",children:"Alternative:"})," ","Use an API key from"," ",d.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 Ca({roleTypes:r,roleNames:n,redirectTo:s="/"}){const{isSuperAdmin:a,hasRole:o,hasRoleType:f}=Oi();return a?d.jsx(xr,{}):r&&r.some(h=>f(h))?d.jsx(xr,{}):n&&n.some(h=>o(h))?d.jsx(xr,{}):d.jsx(Bn,{to:s,replace:!0})}function B2({redirectTo:r="/"}){var a;const{data:n,isLoading:s}=Qo();return s||!n?null:(a=n.ai)!=null&&a.enabled?d.jsx(xr,{}):d.jsx(Bn,{to:r,replace:!0})}function L2({flag:r,redirectTo:n="/"}){var o;const{data:s,isLoading:a}=Qo();return a||!s?null:((o=s.features)==null?void 0:o[r])===!1?d.jsx(Bn,{to:n,replace:!0}):d.jsx(xr,{})}const H2=O.lazy(()=>ve(()=>import("./ProcessesListPage-btsU6hBR.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(r=>({default:r.ProcessesListPage}))),P2=O.lazy(()=>ve(()=>import("./ProcessDetailPage-CP7GZhgs.js"),__vite__mapDeps([18,1,2,4,19,15,20,17,11,6,21,22,23]),import.meta.url).then(r=>({default:r.ProcessDetailPage}))),$2=O.lazy(()=>ve(()=>import("./McpOverview-DXRKcJN0.js"),__vite__mapDeps([24,1,25,26,27,28,14,15,29,6]),import.meta.url).then(r=>({default:r.McpOverview}))),Y2=O.lazy(()=>ve(()=>import("./McpRunsPage-uTbym66Y.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(r=>({default:r.McpRunsPage}))),G2=O.lazy(()=>ve(()=>import("./McpRunDetailPage-Dsa3G3XQ.js"),__vite__mapDeps([34,1,26,20,14,15,35,6,36,37,16,38,39,40,13]),import.meta.url).then(r=>({default:r.McpRunDetailPage}))),V2=O.lazy(()=>ve(()=>import("./McpQueryPage-BE6I011z.js"),__vite__mapDeps([41,1,14,15,9,10,13,12,16,8,11,32,17,33,5,6,4,42]),import.meta.url).then(r=>({default:r.McpQueryPage}))),F2=O.lazy(()=>ve(()=>import("./McpQueryDetailPage-CmW15w5e.js"),__vite__mapDeps([43,1,14,15,20,42,6,27,4,44,36,26,3,2,45,46,47,48,49,50,35,51,38,39]),import.meta.url).then(r=>({default:r.McpQueryDetailPage}))),J2=O.lazy(()=>ve(()=>import("./EscalationsOverview-CvHIJ_GG.js"),__vite__mapDeps([52,1,4,14,15,29,6]),import.meta.url).then(r=>({default:r.EscalationsOverview}))),I2=O.lazy(()=>ve(()=>import("./AvailableEscalationsPage-_xcWvlIz.js"),__vite__mapDeps([53,1,6,4,54,55,56,57,5,7,8,9,10,12,14,15,23,58,13,59,21,17,60,33,16]),import.meta.url).then(r=>({default:r.AvailableEscalationsPage}))),Q2=O.lazy(()=>ve(()=>import("./OperatorDashboard-i8cxaDlk.js"),__vite__mapDeps([61,1,4,57,5,6,7,8,9,10,14,15,12,33,58,13,59,21,17,60,16]),import.meta.url).then(r=>({default:r.OperatorDashboard}))),X2=O.lazy(()=>ve(()=>import("./index-DccCwyZl.js"),__vite__mapDeps([62,1,37,54,55,6,56,57,14,15,60,16,3,4,22,23,20,21,35,36]),import.meta.url).then(r=>({default:r.EscalationDetailPage}))),K2=O.lazy(()=>ve(()=>import("./WorkflowsOverview-C15JcxyY.js"),__vite__mapDeps([63,1,3,4,14,15,29,6]),import.meta.url).then(r=>({default:r.WorkflowsOverview}))),Z2=O.lazy(()=>ve(()=>import("./index-BUbzfEA9.js"),__vite__mapDeps([64,1,3,14,15,17,65,48,49,6]),import.meta.url).then(r=>({default:r.StartWorkflowPage}))),W2=O.lazy(()=>ve(()=>import("./index-BUbzfEA9.js"),__vite__mapDeps([64,1,3,14,15,17,65,48,49,6]),import.meta.url).then(r=>({default:r.DurableInvokePage}))),eE=O.lazy(()=>ve(()=>import("./WorkflowsDashboard-D3z7COgH.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(r=>({default:()=>r.WorkflowsDashboard({tier:"durable"})}))),tE=O.lazy(()=>ve(()=>import("./WorkflowsDashboard-D3z7COgH.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(r=>({default:()=>r.WorkflowsDashboard({tier:"all"})}))),nE=O.lazy(()=>ve(()=>import("./YamlWorkflowsPage-B44WgwE_.js"),__vite__mapDeps([67,1,27,5,6,14,15,13,10,50,65,20]),import.meta.url).then(r=>({default:r.YamlWorkflowsPage}))),sE=O.lazy(()=>ve(()=>import("./GraphInvokePage-De1XVx5d.js"),__vite__mapDeps([68,1,27,14,15,45,47,48,49,46,6,50,65]),import.meta.url).then(r=>({default:r.GraphInvokePage}))),iE=O.lazy(()=>ve(()=>import("./YamlWorkflowDetailPage-BYq3t7E-.js"),__vite__mapDeps([69,1,27,20,65,15,6]),import.meta.url).then(r=>({default:r.YamlWorkflowDetailPage}))),rE=O.lazy(()=>ve(()=>import("./TasksListPage-DOy6JlKS.js"),__vite__mapDeps([70,1,2,3,5,6,9,10,20,59,51,12,13,14,15,17]),import.meta.url).then(r=>({default:r.TasksListPage}))),aE=O.lazy(()=>ve(()=>import("./TaskDetailPage-CT5rXHK5.js"),__vite__mapDeps([71,1,2,20,59,14,15,6]),import.meta.url).then(r=>({default:r.TaskDetailPage}))),lg=O.lazy(()=>ve(()=>import("./WorkflowExecutionPage-BwQoOmUE.js"),__vite__mapDeps([72,1,3,4,37,2,14,15,36,16,20,35,6,38,39,40,13]),import.meta.url).then(r=>({default:r.WorkflowExecutionPage}))),lE=O.lazy(()=>ve(()=>import("./AdminDashboard-Bg1HgukI.js"),__vite__mapDeps([73,1,2,4,25,19,15,6]),import.meta.url).then(r=>({default:r.AdminDashboard}))),oE=O.lazy(()=>ve(()=>import("./index-CknKy4RA.js"),__vite__mapDeps([74,1,3,9,10,13,33,5,6,14,15,75,17]),import.meta.url).then(r=>({default:r.WorkersPage}))),cE=O.lazy(()=>ve(()=>import("./index-CDPBXB4e.js"),__vite__mapDeps([76,1,3,77,55,6,21,15,17,14,57,48,49,65]),import.meta.url).then(r=>({default:r.WorkflowConfigsPage}))),og=O.lazy(()=>ve(()=>import("./index-CDPBXB4e.js"),__vite__mapDeps([76,1,3,77,55,6,21,15,17,14,57,48,49,65]),import.meta.url).then(r=>({default:r.WorkflowConfigDetailPage}))),uE=O.lazy(()=>ve(()=>import("./index-DU7YumVJ.js"),__vite__mapDeps([78,1,25,10,77,55,6,14,15,13,12,5,79,47,48,49,50,46,33,20]),import.meta.url).then(r=>({default:r.McpServersPage}))),cg=O.lazy(()=>ve(()=>import("./index-DVVIeBBk.js"),__vite__mapDeps([80,1,25,14,15,44,6]),import.meta.url).then(r=>({default:r.McpServerDetailPage}))),fE=O.lazy(()=>ve(()=>import("./index-BhznDv-4.js"),__vite__mapDeps([81,1,23,5,6,9,10,12,13,11,77,55,33,14,15,21,49,57,51]),import.meta.url).then(r=>({default:r.UsersPage}))),hE=O.lazy(()=>ve(()=>import("./RolesPage-1DBoEMsb.js"),__vite__mapDeps([82,1,57,14,15,55,6]),import.meta.url).then(r=>({default:r.RolesPage}))),dE=O.lazy(()=>ve(()=>import("./RoleDetailPage-BB_e330f.js"),__vite__mapDeps([83,1,57,77,55,6,15]),import.meta.url).then(r=>({default:r.RoleDetailPage}))),mE=O.lazy(()=>ve(()=>import("./index-CV4lEd4I.js"),__vite__mapDeps([84,1,14,15,55,6,56]),import.meta.url).then(r=>({default:r.MaintenancePage}))),pE=O.lazy(()=>ve(()=>import("./OperationsPage-CAmiFHI6.js"),__vite__mapDeps([85,1,57,4,14,15,6]),import.meta.url).then(r=>({default:r.OperationsPage}))),gE=O.lazy(()=>ve(()=>import("./index-CpgV4Kkp.js"),__vite__mapDeps([86,1,19,15,13,5,6,31,28,55,36,75,9,10,33]),import.meta.url).then(r=>({default:r.ControlPlanePage}))),yE=O.lazy(()=>ve(()=>import("./index-B0kmiSmt.js"),__vite__mapDeps([87,1,6,39,15,5,31,28,8,9,10,12,13,11,14,16]),import.meta.url).then(r=>({default:r.StreamMessagesPage}))),bE=O.lazy(()=>ve(()=>import("./CredentialsPage-D1OmMHux.js"),__vite__mapDeps([88,1,14,15,51,77,55,6]),import.meta.url).then(r=>({default:r.CredentialsPage}))),xE=O.lazy(()=>ve(()=>import("./index-DrUkTcn-.js"),__vite__mapDeps([89,1,6,14,15,13,16,8,10,90,51]),import.meta.url).then(r=>({default:r.FilesPage}))),vE=O.lazy(()=>ve(()=>import("./index-j-C7g_Ej.js"),__vite__mapDeps([91,1,14,15,13,16,12,10,90,51,92,44,6]),import.meta.url).then(r=>({default:r.KnowledgePage}))),_E=O.lazy(()=>ve(()=>import("./HomePage-BYR5VXXw.js"),__vite__mapDeps([93,1,3,26,28,2,4,21,15,17,16,6]),import.meta.url).then(r=>({default:r.HomePage}))),wE=O.lazy(()=>ve(()=>import("./AgentsPage-DhN2lIBh.js"),__vite__mapDeps([94,1,95,4,5,6,8,9,10,12,13,14,15,16]),import.meta.url).then(r=>({default:r.AgentsPage}))),SE=O.lazy(()=>ve(()=>import("./AgentDetailPage-BsaiYbwL.js"),__vite__mapDeps([96,1,95,97,15,4,17,6]),import.meta.url).then(r=>({default:r.AgentDetailPage}))),ug=O.lazy(()=>ve(()=>import("./AgentConfigPage-HBe_YDU_.js"),__vite__mapDeps([98,1,95,97,15,14,92,47,48,49,3,27,99,100,17,6]),import.meta.url).then(r=>({default:r.AgentConfigPage}))),EE=O.lazy(()=>ve(()=>import("./CapabilitiesPage-w1owqsmN.js"),__vite__mapDeps([101,1,99,79,25,47,48,49,15,50,6,46,14]),import.meta.url).then(r=>({default:r.CapabilitiesPage}))),AE=O.lazy(()=>ve(()=>import("./TopicsPage-D67tjS8L.js"),__vite__mapDeps([102,1,100,14,15,6]),import.meta.url).then(r=>({default:r.TopicsPage}))),jE=O.lazy(()=>ve(()=>import("./TopicDetailPage-Cn1ShfR8.js"),__vite__mapDeps([103,1,100,16,15,6]),import.meta.url).then(r=>({default:r.TopicDetailPage})));function OE(){return d.jsxs("div",{className:"animate-pulse space-y-4",children:[d.jsx("div",{className:"h-8 bg-surface-sunken rounded w-48"}),d.jsx("div",{className:"h-40 bg-surface-sunken rounded"})]})}function xe({children:r}){return d.jsx(O.Suspense,{fallback:d.jsx(OE,{}),children:d.jsx("div",{className:"animate-page-enter",children:r})})}const py=new jx({defaultOptions:{queries:{staleTime:1e4,retry:(r,n)=>n instanceof Error&&n.message==="Session expired"?!1:r<1}}});window.addEventListener("auth:unauthorized",()=>{py.clear(),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info");const r=window.__LT_BASE__||"",n=`${r}/login`;if(window.location.pathname!==n){const s=window.location.pathname+window.location.search,a=r&&s.startsWith(r)?s.slice(r.length)||"/":s;window.location.href=`${n}?returnTo=${encodeURIComponent(a)}`}});const TE=Nx([{path:"/login",element:d.jsx(U2,{})},{path:"/connect/anthropic",element:d.jsx(ag,{})},{path:"/connect/:provider",element:d.jsx(ag,{})},{path:"/",element:d.jsx(D2,{}),children:[{index:!0,element:d.jsx(xe,{children:d.jsx(_E,{})})},{path:"processes/all",element:d.jsx(xe,{children:d.jsx(H2,{})})},{path:"processes/detail/:originId",element:d.jsx(xe,{children:d.jsx(P2,{})})},{path:"credentials",element:d.jsx(xe,{children:d.jsx(bE,{})})},{path:"connections",element:d.jsx(Bn,{to:"/credentials",replace:!0})},{path:"escalations",element:d.jsx(xe,{children:d.jsx(J2,{})})},{path:"escalations/available",element:d.jsx(xe,{children:d.jsx(I2,{})})},{path:"escalations/queue",element:d.jsx(xe,{children:d.jsx(Q2,{})})},{path:"escalations/detail/:id",element:d.jsx(xe,{children:d.jsx(X2,{})})},{path:"capabilities",element:d.jsx(xe,{children:d.jsx(EE,{})})},{path:"agents",element:d.jsx(xe,{children:d.jsx(wE,{})})},{path:"agents/new",element:d.jsx(xe,{children:d.jsx(ug,{})})},{path:"agents/:id",element:d.jsx(xe,{children:d.jsx(SE,{})})},{path:"agents/:id/edit",element:d.jsx(xe,{children:d.jsx(ug,{})})},{path:"topics",element:d.jsx(xe,{children:d.jsx(AE,{})})},{path:"topics/:topic",element:d.jsx(xe,{children:d.jsx(jE,{})})},{element:d.jsx(Ca,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:d.jsx(xe,{children:d.jsx(K2,{})})},{path:"workflows/executions",element:d.jsx(xe,{children:d.jsx(tE,{})})},{path:"workflows/durable/executions",element:d.jsx(xe,{children:d.jsx(eE,{})})},{path:"workflows/durable/executions/:workflowId",element:d.jsx(xe,{children:d.jsx(lg,{})})},{path:"workflows/tasks",element:d.jsx(xe,{children:d.jsx(rE,{})})},{path:"workflows/tasks/detail/:id",element:d.jsx(xe,{children:d.jsx(aE,{})})},{path:"workflows/executions/:workflowId",element:d.jsx(xe,{children:d.jsx(lg,{})})},{path:"workflows/start",element:d.jsx(xe,{children:d.jsx(Z2,{})})},{path:"workflows/durable/invoke",element:d.jsx(xe,{children:d.jsx(W2,{})})},{path:"workflows/cron",element:d.jsx(Bn,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:d.jsx(xe,{children:d.jsx(oE,{})})},{path:"workflows/registry",element:d.jsx(xe,{children:d.jsx(cE,{})})},{path:"workflows/registry/new",element:d.jsx(xe,{children:d.jsx(og,{})})},{path:"workflows/registry/:workflowType",element:d.jsx(xe,{children:d.jsx(og,{})})}]},{element:d.jsx(Ca,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"mcp/workflows",element:d.jsx(xe,{children:d.jsx(nE,{})})},{path:"mcp/workflows/invoke",element:d.jsx(xe,{children:d.jsx(sE,{})})},{path:"mcp/workflows/:id",element:d.jsx(xe,{children:d.jsx(iE,{})})},{path:"mcp/executions",element:d.jsx(xe,{children:d.jsx(Y2,{})})},{path:"mcp/executions/:jobId",element:d.jsx(xe,{children:d.jsx(G2,{})})},{path:"files",element:d.jsx(xe,{children:d.jsx(xE,{})})},{path:"knowledge",element:d.jsx(xe,{children:d.jsx(vE,{})})},{element:d.jsx(B2,{}),children:[{path:"mcp",element:d.jsx(xe,{children:d.jsx($2,{})})},{path:"mcp/queries",element:d.jsx(xe,{children:d.jsx(V2,{})})},{path:"mcp/queries/:workflowId",element:d.jsx(xe,{children:d.jsx(F2,{})})},{path:"mcp/tools",element:d.jsx(Bn,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:d.jsx(xe,{children:d.jsx(uE,{})})},{path:"mcp/servers/new",element:d.jsx(xe,{children:d.jsx(cg,{})})},{path:"mcp/servers/:serverId",element:d.jsx(xe,{children:d.jsx(cg,{})})}]}]},{element:d.jsx(Ca,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"operations",element:d.jsx(xe,{children:d.jsx(pE,{})})}]},{element:d.jsx(Ca,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"admin",element:d.jsx(xe,{children:d.jsx(lE,{})})},{path:"admin/users",element:d.jsx(xe,{children:d.jsx(fE,{})})},{path:"admin/escalation-chains",element:d.jsx(Bn,{to:"/admin/roles",replace:!0})},{path:"admin/roles",element:d.jsx(xe,{children:d.jsx(hE,{})})},{path:"admin/roles/:role",element:d.jsx(xe,{children:d.jsx(dE,{})})}]},{element:d.jsx(Ca,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"admin/bots",element:d.jsx(Bn,{to:"/admin/users?tab=service-accounts",replace:!0})},{element:d.jsx(L2,{flag:"dbMaintenance"}),children:[{path:"admin/maintenance",element:d.jsx(xe,{children:d.jsx(mE,{})})}]},{path:"admin/controlplane",element:d.jsx(xe,{children:d.jsx(gE,{})})},{path:"admin/streams",element:d.jsx(xe,{children:d.jsx(yE,{})})}]}]}],{basename:window.__LT_BASE__||"/"});function NE(){return d.jsx(Ox,{client:py,children:d.jsx(uv,{children:d.jsx(mw,{children:d.jsx(Cx,{router:TE})})})})}av.createRoot(document.getElementById("root")).render(d.jsx(O.StrictMode,{children:d.jsx(NE,{})}));export{HE as A,GE as B,mh as C,O2 as D,XE as E,ny as F,gh as G,dy as H,t3 as I,Iw as J,zE as K,ZE as L,Wt as M,d_ as N,bg as O,i3 as P,r3 as Q,my as R,qw as S,WE as T,s3 as a,j2 as b,p_ as c,$e as d,LE as e,S2 as f,PE as g,YE as h,qE as i,Oi as j,BE as k,VE as l,FE as m,JE as n,IE as o,QE as p,KE as q,UE as r,xw as s,bw as t,Qo as u,Kg as v,$E as w,n3 as x,e3 as y,yh as z};
|
|
63
|
+
//# sourceMappingURL=index-CtDf8vvQ.js.map
|