@hotmeshio/long-tail 0.18.0 → 0.19.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/index.d.ts +1 -1
- package/build/api/escalations/index.js +2 -1
- package/build/api/escalations/list.d.ts +11 -0
- package/build/api/escalations/list.js +31 -2
- package/build/api/settings.js +2 -0
- package/build/api/users.d.ts +11 -0
- package/build/api/users.js +19 -0
- package/build/index.js +6 -0
- package/build/lib/uuid.d.ts +11 -0
- package/build/lib/uuid.js +20 -0
- package/build/modules/search.d.ts +21 -0
- package/build/modules/search.js +55 -0
- package/build/routes/escalations/list.js +10 -1
- package/build/routes/users.js +9 -0
- package/build/scripts/ortho-populate.d.ts +3 -1
- package/build/scripts/ortho-populate.js +15 -5
- package/build/sdk/index.d.ts +1 -0
- package/build/services/escalation/batch.js +3 -0
- package/build/services/escalation/bulk.js +8 -0
- package/build/services/escalation/crud.js +26 -0
- package/build/services/escalation/queries.d.ts +14 -1
- package/build/services/escalation/queries.js +49 -7
- package/build/services/escalation/sql.d.ts +4 -2
- package/build/services/escalation/sql.js +4 -0
- package/build/services/role/types.d.ts +18 -0
- package/build/services/role/types.js +6 -0
- package/build/services/user/auth.js +2 -2
- package/build/services/user/crud.d.ts +13 -0
- package/build/services/user/crud.js +26 -3
- package/build/services/user/index.d.ts +1 -1
- package/build/services/user/index.js +2 -1
- package/build/services/user/sql.d.ts +11 -5
- package/build/services/user/sql.js +18 -6
- package/build/start/adapters.js +2 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/types/startup.d.ts +12 -1
- package/dashboard/dist/assets/{AdminDashboard-mULAQuHV.js → AdminDashboard-DPkWtPc1.js} +2 -2
- package/dashboard/dist/assets/{AdminDashboard-mULAQuHV.js.map → AdminDashboard-DPkWtPc1.js.map} +1 -1
- package/dashboard/dist/assets/{AgentConfigPage-DHdzgXcr.js → AgentConfigPage-DRfnLiQS.js} +6 -6
- package/dashboard/dist/assets/{AgentConfigPage-DHdzgXcr.js.map → AgentConfigPage-DRfnLiQS.js.map} +1 -1
- package/dashboard/dist/assets/{AgentDetailPage-Du_33U2u.js → AgentDetailPage-CufRZXnT.js} +3 -3
- package/dashboard/dist/assets/{AgentDetailPage-Du_33U2u.js.map → AgentDetailPage-CufRZXnT.js.map} +1 -1
- package/dashboard/dist/assets/{AgentsPage-4KkQO2Hl.js → AgentsPage-CoCWGhUd.js} +2 -2
- package/dashboard/dist/assets/{AgentsPage-4KkQO2Hl.js.map → AgentsPage-CoCWGhUd.js.map} +1 -1
- package/dashboard/dist/assets/AvailableEscalationsPage-BSqOctep.js +2 -0
- package/dashboard/dist/assets/AvailableEscalationsPage-BSqOctep.js.map +1 -0
- package/dashboard/dist/assets/{BotPicker-BaFiLa-H.js → BotPicker-DMojDLlV.js} +2 -2
- package/dashboard/dist/assets/{BotPicker-BaFiLa-H.js.map → BotPicker-DMojDLlV.js.map} +1 -1
- package/dashboard/dist/assets/BulkAssignModal-DYbM_6Or.js +2 -0
- package/dashboard/dist/assets/BulkAssignModal-DYbM_6Or.js.map +1 -0
- package/dashboard/dist/assets/CapabilitiesPage-CDQ5JHNP.js +2 -0
- package/dashboard/dist/assets/{CapabilitiesPage-Cewd6Uku.js.map → CapabilitiesPage-CDQ5JHNP.js.map} +1 -1
- package/dashboard/dist/assets/{CollapsibleSection-D1WIbyDa.js → CollapsibleSection-D4VlCEbD.js} +2 -2
- package/dashboard/dist/assets/{CollapsibleSection-D1WIbyDa.js.map → CollapsibleSection-D4VlCEbD.js.map} +1 -1
- package/dashboard/dist/assets/{ConfirmDeleteModal-CQsJUzEa.js → ConfirmDeleteModal-DnNHjJtD.js} +2 -2
- package/dashboard/dist/assets/{ConfirmDeleteModal-CQsJUzEa.js.map → ConfirmDeleteModal-DnNHjJtD.js.map} +1 -1
- package/dashboard/dist/assets/CountdownTimer-DPHMBmgz.js +2 -0
- package/dashboard/dist/assets/CountdownTimer-DPHMBmgz.js.map +1 -0
- package/dashboard/dist/assets/CredentialsPage-CSYZw-rL.js +2 -0
- package/dashboard/dist/assets/{CredentialsPage-CwtkQUG3.js.map → CredentialsPage-CSYZw-rL.js.map} +1 -1
- package/dashboard/dist/assets/{CronLabel-CRC_uNuC.js → CronLabel-CpmqDrlJ.js} +2 -2
- package/dashboard/dist/assets/{CronLabel-CRC_uNuC.js.map → CronLabel-CpmqDrlJ.js.map} +1 -1
- package/dashboard/dist/assets/{DropZone-Pv-v5RAs.js → DropZone-BbXlQnYB.js} +2 -2
- package/dashboard/dist/assets/{DropZone-Pv-v5RAs.js.map → DropZone-BbXlQnYB.js.map} +1 -1
- package/dashboard/dist/assets/{ElapsedCell-CxAi0zN0.js → ElapsedCell-Cul22qBS.js} +2 -2
- package/dashboard/dist/assets/{ElapsedCell-CxAi0zN0.js.map → ElapsedCell-Cul22qBS.js.map} +1 -1
- package/dashboard/dist/assets/EntityTimelinePanel-CtzpJ-j2.js +2 -0
- package/dashboard/dist/assets/EntityTimelinePanel-CtzpJ-j2.js.map +1 -0
- package/dashboard/dist/assets/{EscalationListSchemaPage--yZfsE8s.js → EscalationListSchemaPage-BZQ8Y_UH.js} +3 -3
- package/dashboard/dist/assets/{EscalationListSchemaPage--yZfsE8s.js.map → EscalationListSchemaPage-BZQ8Y_UH.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationSchemaPage-CmoVqaS7.js → EscalationSchemaPage-CydTtq_A.js} +3 -3
- package/dashboard/dist/assets/{EscalationSchemaPage-CmoVqaS7.js.map → EscalationSchemaPage-CydTtq_A.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationsOverview-DDQTW6Jo.js → EscalationsOverview-DSYC0nI7.js} +2 -2
- package/dashboard/dist/assets/{EscalationsOverview-DDQTW6Jo.js.map → EscalationsOverview-DSYC0nI7.js.map} +1 -1
- package/dashboard/dist/assets/{EventTable-C5jN7XT7.js → EventTable-s48cTXIw.js} +2 -2
- package/dashboard/dist/assets/{EventTable-C5jN7XT7.js.map → EventTable-s48cTXIw.js.map} +1 -1
- package/dashboard/dist/assets/{FilterBar-CcIgQH9h.js → FilterBar-B61qKmFD.js} +2 -2
- package/dashboard/dist/assets/{FilterBar-CcIgQH9h.js.map → FilterBar-B61qKmFD.js.map} +1 -1
- package/dashboard/dist/assets/GraphInvokePage-DxZv_KC2.js +2 -0
- package/dashboard/dist/assets/{GraphInvokePage-LACIxaiH.js.map → GraphInvokePage-DxZv_KC2.js.map} +1 -1
- package/dashboard/dist/assets/HomePage-zK3VP_9g.js +2 -0
- package/dashboard/dist/assets/HomePage-zK3VP_9g.js.map +1 -0
- package/dashboard/dist/assets/{ListToolbar-CLwSkmUH.js → ListToolbar-DaxloPQc.js} +2 -2
- package/dashboard/dist/assets/{ListToolbar-CLwSkmUH.js.map → ListToolbar-DaxloPQc.js.map} +1 -1
- package/dashboard/dist/assets/{McpOverview-C2U1XfQw.js → McpOverview-Ciq8r6-p.js} +2 -2
- package/dashboard/dist/assets/{McpOverview-C2U1XfQw.js.map → McpOverview-Ciq8r6-p.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryDetailPage-DYOK8A4D.js → McpQueryDetailPage-DIC0FEEb.js} +3 -3
- package/dashboard/dist/assets/{McpQueryDetailPage-DYOK8A4D.js.map → McpQueryDetailPage-DIC0FEEb.js.map} +1 -1
- package/dashboard/dist/assets/McpQueryPage-BBy0NSNg.js +2 -0
- package/dashboard/dist/assets/{McpQueryPage-Ck75ikSd.js.map → McpQueryPage-BBy0NSNg.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunDetailPage-CA9gWQ4L.js → McpRunDetailPage-BqKNmIyW.js} +2 -2
- package/dashboard/dist/assets/{McpRunDetailPage-CA9gWQ4L.js.map → McpRunDetailPage-BqKNmIyW.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunsPage-BhPshset.js → McpRunsPage-D0RlOpzR.js} +2 -2
- package/dashboard/dist/assets/{McpRunsPage-BhPshset.js.map → McpRunsPage-D0RlOpzR.js.map} +1 -1
- package/dashboard/dist/assets/NamespacePill-Dbtm9R2T.js +2 -0
- package/dashboard/dist/assets/{NamespacePill-DONj6eUU.js.map → NamespacePill-Dbtm9R2T.js.map} +1 -1
- package/dashboard/dist/assets/OperationsPage-BX0SFizr.js +3 -0
- package/dashboard/dist/assets/OperationsPage-BX0SFizr.js.map +1 -0
- package/dashboard/dist/assets/OperatorDashboard-vXG0TjAQ.js +2 -0
- package/dashboard/dist/assets/{OperatorDashboard-DZOfHRE7.js.map → OperatorDashboard-vXG0TjAQ.js.map} +1 -1
- package/dashboard/dist/assets/{PageHeader-CFVw67M6.js → PageHeader-xB92ELs3.js} +2 -2
- package/dashboard/dist/assets/{PageHeader-CFVw67M6.js.map → PageHeader-xB92ELs3.js.map} +1 -1
- package/dashboard/dist/assets/{PageHeaderWithStats-D9tQxILm.js → PageHeaderWithStats-DVo_qqn1.js} +2 -2
- package/dashboard/dist/assets/{PageHeaderWithStats-D9tQxILm.js.map → PageHeaderWithStats-DVo_qqn1.js.map} +1 -1
- package/dashboard/dist/assets/PersonaDetailPage-w5TXcn4Q.js +2 -0
- package/dashboard/dist/assets/{PersonaDetailPage-eyHDupL0.js.map → PersonaDetailPage-w5TXcn4Q.js.map} +1 -1
- package/dashboard/dist/assets/PersonasPage-Dzcinl1L.js +2 -0
- package/dashboard/dist/assets/PersonasPage-Dzcinl1L.js.map +1 -0
- package/dashboard/dist/assets/{ProcessDetailPage-CKiAlpOc.js → ProcessDetailPage-BVXieFX1.js} +2 -2
- package/dashboard/dist/assets/{ProcessDetailPage-CKiAlpOc.js.map → ProcessDetailPage-BVXieFX1.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessesListPage-C4ueZJxU.js → ProcessesListPage-CKKNpk4z.js} +2 -2
- package/dashboard/dist/assets/{ProcessesListPage-C4ueZJxU.js.map → ProcessesListPage-CKKNpk4z.js.map} +1 -1
- package/dashboard/dist/assets/RoleDetailPage-BytSo-YE.js +8 -0
- package/dashboard/dist/assets/RoleDetailPage-BytSo-YE.js.map +1 -0
- package/dashboard/dist/assets/{RolePill-Di_5hfvw.js → RolePill-CYpL3a2d.js} +2 -2
- package/dashboard/dist/assets/{RolePill-Di_5hfvw.js.map → RolePill-CYpL3a2d.js.map} +1 -1
- package/dashboard/dist/assets/RolesPage-eayR9H4f.js +2 -0
- package/dashboard/dist/assets/{RolesPage-B3-9Ek0F.js.map → RolesPage-eayR9H4f.js.map} +1 -1
- package/dashboard/dist/assets/{RunAsSelector-1k1J1_cv.js → RunAsSelector-D7RPwaAl.js} +2 -2
- package/dashboard/dist/assets/{RunAsSelector-1k1J1_cv.js.map → RunAsSelector-D7RPwaAl.js.map} +1 -1
- package/dashboard/dist/assets/{ScanCodesPage-CeuVKnpu.js → ScanCodesPage-C8-ZBXF5.js} +2 -2
- package/dashboard/dist/assets/{ScanCodesPage-CeuVKnpu.js.map → ScanCodesPage-C8-ZBXF5.js.map} +1 -1
- package/dashboard/dist/assets/ScanSchemeDetailPage-tQhEgFKf.js +2 -0
- package/dashboard/dist/assets/{ScanSchemeDetailPage-BnivPUJY.js.map → ScanSchemeDetailPage-tQhEgFKf.js.map} +1 -1
- package/dashboard/dist/assets/ScanStationPage-CuhqsBKo.js +2 -0
- package/dashboard/dist/assets/{ScanStationPage-DCSA7pcV.js.map → ScanStationPage-CuhqsBKo.js.map} +1 -1
- package/dashboard/dist/assets/{ScopeBadge-CqIIeWjK.js → ScopeBadge-BmNzZlSj.js} +2 -2
- package/dashboard/dist/assets/{ScopeBadge-CqIIeWjK.js.map → ScopeBadge-BmNzZlSj.js.map} +1 -1
- package/dashboard/dist/assets/{StickyPagination-BWuKz8uB.js → StickyPagination-BIVTAMnP.js} +2 -2
- package/dashboard/dist/assets/{StickyPagination-BWuKz8uB.js.map → StickyPagination-BIVTAMnP.js.map} +1 -1
- package/dashboard/dist/assets/{StreamMessageDetail-Cq6AGhgJ.js → StreamMessageDetail-CYSC2cO1.js} +2 -2
- package/dashboard/dist/assets/{StreamMessageDetail-Cq6AGhgJ.js.map → StreamMessageDetail-CYSC2cO1.js.map} +1 -1
- package/dashboard/dist/assets/{SwimlaneTimeline-DM88avgt.js → SwimlaneTimeline-BMZAs_2K.js} +2 -2
- package/dashboard/dist/assets/{SwimlaneTimeline-DM88avgt.js.map → SwimlaneTimeline-BMZAs_2K.js.map} +1 -1
- package/dashboard/dist/assets/{TagInput-BLwxTNsI.js → TagInput-D1uszNd2.js} +2 -2
- package/dashboard/dist/assets/{TagInput-BLwxTNsI.js.map → TagInput-D1uszNd2.js.map} +1 -1
- package/dashboard/dist/assets/{TaskDetailPage-Caqe3fG8.js → TaskDetailPage-CVUDUU5Q.js} +2 -2
- package/dashboard/dist/assets/{TaskDetailPage-Caqe3fG8.js.map → TaskDetailPage-CVUDUU5Q.js.map} +1 -1
- package/dashboard/dist/assets/{TaskQueuePill-DVgcqd-h.js → TaskQueuePill-C2H8oRfn.js} +2 -2
- package/dashboard/dist/assets/{TaskQueuePill-DVgcqd-h.js.map → TaskQueuePill-C2H8oRfn.js.map} +1 -1
- package/dashboard/dist/assets/{TasksListPage-DlQwpXOL.js → TasksListPage-DEQymbXC.js} +2 -2
- package/dashboard/dist/assets/{TasksListPage-DlQwpXOL.js.map → TasksListPage-DEQymbXC.js.map} +1 -1
- package/dashboard/dist/assets/{TimeAgo-BinTjiVC.js → TimeAgo-CCxP67Rb.js} +2 -2
- package/dashboard/dist/assets/{TimeAgo-BinTjiVC.js.map → TimeAgo-CCxP67Rb.js.map} +1 -1
- package/dashboard/dist/assets/{TimestampCell-DDcfSVeQ.js → TimestampCell-CE5ZUYhV.js} +2 -2
- package/dashboard/dist/assets/{TimestampCell-DDcfSVeQ.js.map → TimestampCell-CE5ZUYhV.js.map} +1 -1
- package/dashboard/dist/assets/{ToolPill-C6hkOqPx.js → ToolPill-D-h8AoB8.js} +2 -2
- package/dashboard/dist/assets/{ToolPill-C6hkOqPx.js.map → ToolPill-D-h8AoB8.js.map} +1 -1
- package/dashboard/dist/assets/ToolTestPanel-BHuQTyBY.js +2 -0
- package/dashboard/dist/assets/{ToolTestPanel-CZvegH_w.js.map → ToolTestPanel-BHuQTyBY.js.map} +1 -1
- package/dashboard/dist/assets/{TopicDetailPage-CShiCwz8.js → TopicDetailPage-SFuiludx.js} +3 -3
- package/dashboard/dist/assets/{TopicDetailPage-CShiCwz8.js.map → TopicDetailPage-SFuiludx.js.map} +1 -1
- package/dashboard/dist/assets/{TopicsPage-CAYxRRbI.js → TopicsPage-DO8pUmng.js} +2 -2
- package/dashboard/dist/assets/{TopicsPage-CAYxRRbI.js.map → TopicsPage-DO8pUmng.js.map} +1 -1
- package/dashboard/dist/assets/UserName-CsLnT75E.js +2 -0
- package/dashboard/dist/assets/UserName-CsLnT75E.js.map +1 -0
- package/dashboard/dist/assets/{WorkflowExecutionPage-DNdXEFcB.js → WorkflowExecutionPage-BttnEvOd.js} +2 -2
- package/dashboard/dist/assets/{WorkflowExecutionPage-DNdXEFcB.js.map → WorkflowExecutionPage-BttnEvOd.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowPill-CN-952iI.js → WorkflowPill-CZvBbkn4.js} +2 -2
- package/dashboard/dist/assets/{WorkflowPill-CN-952iI.js.map → WorkflowPill-CZvBbkn4.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsDashboard-D7DPDeuQ.js → WorkflowsDashboard-BRboBhlK.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsDashboard-D7DPDeuQ.js.map → WorkflowsDashboard-BRboBhlK.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsOverview-C7Z0SpDH.js → WorkflowsOverview-CDFTYeQo.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsOverview-C7Z0SpDH.js.map → WorkflowsOverview-CDFTYeQo.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-Bxklswko.js → YamlWorkflowDetailPage-CmnZFevp.js} +11 -11
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-Bxklswko.js.map → YamlWorkflowDetailPage-CmnZFevp.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowsPage-CkArsPbi.js → YamlWorkflowsPage-Qq1jfcrH.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowsPage-CkArsPbi.js.map → YamlWorkflowsPage-Qq1jfcrH.js.map} +1 -1
- package/dashboard/dist/assets/{agents-Ca0hOp2Y.js → agents-C7vUIO7e.js} +2 -2
- package/dashboard/dist/assets/{agents-Ca0hOp2Y.js.map → agents-C7vUIO7e.js.map} +1 -1
- package/dashboard/dist/assets/{bots-9GtbGtH9.js → bots-BaOblnW4.js} +2 -2
- package/dashboard/dist/assets/{bots-9GtbGtH9.js.map → bots-BaOblnW4.js.map} +1 -1
- package/dashboard/dist/assets/{capabilities-C0RpEvyY.js → capabilities-RZpmDWoy.js} +2 -2
- package/dashboard/dist/assets/{capabilities-C0RpEvyY.js.map → capabilities-RZpmDWoy.js.map} +1 -1
- package/dashboard/dist/assets/{controlplane-ClQiKGyQ.js → controlplane-BwGdcwXR.js} +2 -2
- package/dashboard/dist/assets/{controlplane-ClQiKGyQ.js.map → controlplane-BwGdcwXR.js.map} +1 -1
- package/dashboard/dist/assets/escalation-columns-B4DG_5v8.js +2 -0
- package/dashboard/dist/assets/escalation-columns-B4DG_5v8.js.map +1 -0
- package/dashboard/dist/assets/index-8LIpvj2e.js +3 -0
- package/dashboard/dist/assets/index-8LIpvj2e.js.map +1 -0
- package/dashboard/dist/assets/index-BICLHYJJ.js +2 -0
- package/dashboard/dist/assets/{index-BLLK2mzy.js.map → index-BICLHYJJ.js.map} +1 -1
- package/dashboard/dist/assets/{index-BLCFN3YR.js → index-BQPUlmmz.js} +2 -2
- package/dashboard/dist/assets/{index-BLCFN3YR.js.map → index-BQPUlmmz.js.map} +1 -1
- package/dashboard/dist/assets/index-BaC3sbJH.js +67 -0
- package/dashboard/dist/assets/index-BaC3sbJH.js.map +1 -0
- package/dashboard/dist/assets/index-BuqpU6ow.js +2 -0
- package/dashboard/dist/assets/{index-DEr9QjVv.js.map → index-BuqpU6ow.js.map} +1 -1
- package/dashboard/dist/assets/index-CD6jtND1.css +1 -0
- package/dashboard/dist/assets/{index-Ba3UsZzz.js → index-CsIw-ZLk.js} +4 -4
- package/dashboard/dist/assets/{index-Ba3UsZzz.js.map → index-CsIw-ZLk.js.map} +1 -1
- package/dashboard/dist/assets/index-CtJkvX9e.js +5 -0
- package/dashboard/dist/assets/{index-Ct_8Tpec.js.map → index-CtJkvX9e.js.map} +1 -1
- package/dashboard/dist/assets/index-D9NtDRtp.js +2 -0
- package/dashboard/dist/assets/{index-BoQirCxt.js.map → index-D9NtDRtp.js.map} +1 -1
- package/dashboard/dist/assets/{index-CeHOGQM4.js → index-DU9-flEo.js} +2 -2
- package/dashboard/dist/assets/{index-CeHOGQM4.js.map → index-DU9-flEo.js.map} +1 -1
- package/dashboard/dist/assets/{index-P1g8r09L.js → index-G3NmdMjt.js} +2 -2
- package/dashboard/dist/assets/{index-P1g8r09L.js.map → index-G3NmdMjt.js.map} +1 -1
- package/dashboard/dist/assets/index-IWufkcH9.js +2 -0
- package/dashboard/dist/assets/{index-DlzW75L4.js.map → index-IWufkcH9.js.map} +1 -1
- package/dashboard/dist/assets/index-iegzyfMv.js +2 -0
- package/dashboard/dist/assets/{index-B-Qpr29t.js.map → index-iegzyfMv.js.map} +1 -1
- package/dashboard/dist/assets/index-xNFTmmsv.js +2 -0
- package/dashboard/dist/assets/{index-CG8oLNHo.js.map → index-xNFTmmsv.js.map} +1 -1
- package/dashboard/dist/assets/{knowledge-DzueDGkw.js → knowledge-CjwCbm3E.js} +2 -2
- package/dashboard/dist/assets/{knowledge-DzueDGkw.js.map → knowledge-CjwCbm3E.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-CCOzN8dH.js → mcp-C-DMktCT.js} +2 -2
- package/dashboard/dist/assets/{mcp-CCOzN8dH.js.map → mcp-C-DMktCT.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-query-UeMDiM6I.js → mcp-query-KBeBNHb4.js} +2 -2
- package/dashboard/dist/assets/{mcp-query-UeMDiM6I.js.map → mcp-query-KBeBNHb4.js.map} +1 -1
- package/dashboard/dist/assets/{personas-CKcrzaQX.js → personas-B32sSCxm.js} +2 -2
- package/dashboard/dist/assets/{personas-CKcrzaQX.js.map → personas-B32sSCxm.js.map} +1 -1
- package/dashboard/dist/assets/{pipelines-orE-1gpj.js → pipelines-DNLwDumm.js} +2 -2
- package/dashboard/dist/assets/{pipelines-orE-1gpj.js.map → pipelines-DNLwDumm.js.map} +1 -1
- package/dashboard/dist/assets/{tasks-ZOmzxynB.js → tasks-DrWSrjmj.js} +2 -2
- package/dashboard/dist/assets/{tasks-ZOmzxynB.js.map → tasks-DrWSrjmj.js.map} +1 -1
- package/dashboard/dist/assets/{topics-CdYaOCi_.js → topics-DgzGU-vR.js} +2 -2
- package/dashboard/dist/assets/{topics-CdYaOCi_.js.map → topics-DgzGU-vR.js.map} +1 -1
- package/dashboard/dist/assets/{useDebouncedValue-D-uGnSj5.js → useDebouncedValue-DG5JOj1F.js} +2 -2
- package/dashboard/dist/assets/{useDebouncedValue-D-uGnSj5.js.map → useDebouncedValue-DG5JOj1F.js.map} +1 -1
- package/dashboard/dist/assets/{useNamespace-DMrjlrJJ.js → useNamespace-CdgF7Jxo.js} +2 -2
- package/dashboard/dist/assets/{useNamespace-DMrjlrJJ.js.map → useNamespace-CdgF7Jxo.js.map} +1 -1
- package/dashboard/dist/assets/{useYamlActivityEvents-ByyQgu8S.js → useYamlActivityEvents-BEaOtgSZ.js} +2 -2
- package/dashboard/dist/assets/{useYamlActivityEvents-ByyQgu8S.js.map → useYamlActivityEvents-BEaOtgSZ.js.map} +1 -1
- package/dashboard/dist/assets/{vendor-icons-h-jlRSb9.js → vendor-icons-BCWsItQ7.js} +138 -133
- package/dashboard/dist/assets/{vendor-icons-h-jlRSb9.js.map → vendor-icons-BCWsItQ7.js.map} +1 -1
- package/dashboard/dist/assets/{workflows-CLn05FRV.js → workflows-CX_oarls.js} +2 -2
- package/dashboard/dist/assets/{workflows-CLn05FRV.js.map → workflows-CX_oarls.js.map} +1 -1
- package/dashboard/dist/assets/{yaml-workflows-DFD_HO__.js → yaml-workflows-YASUDPo0.js} +2 -2
- package/dashboard/dist/assets/{yaml-workflows-DFD_HO__.js.map → yaml-workflows-YASUDPo0.js.map} +1 -1
- package/dashboard/dist/index.html +3 -3
- package/docs/dashboard.md +164 -69
- package/docs/faceted-routing.md +38 -0
- package/docs/hitl/x-lt-list-schema.md +3 -0
- package/docs/operations.md +61 -60
- package/docs/scan-codes.md +18 -0
- package/package.json +1 -1
- package/dashboard/dist/assets/AvailableEscalationsPage-CjcAIm-d.js +0 -2
- package/dashboard/dist/assets/AvailableEscalationsPage-CjcAIm-d.js.map +0 -1
- package/dashboard/dist/assets/BulkAssignModal-DNmji4l-.js +0 -2
- package/dashboard/dist/assets/BulkAssignModal-DNmji4l-.js.map +0 -1
- package/dashboard/dist/assets/CapabilitiesPage-Cewd6Uku.js +0 -2
- package/dashboard/dist/assets/CountdownTimer-BKMmFie6.js +0 -2
- package/dashboard/dist/assets/CountdownTimer-BKMmFie6.js.map +0 -1
- package/dashboard/dist/assets/CredentialsPage-CwtkQUG3.js +0 -2
- package/dashboard/dist/assets/EntityTimelinePanel-DzMuV7ZX.js +0 -2
- package/dashboard/dist/assets/EntityTimelinePanel-DzMuV7ZX.js.map +0 -1
- package/dashboard/dist/assets/GraphInvokePage-LACIxaiH.js +0 -2
- package/dashboard/dist/assets/HomePage-DP9Q-x4a.js +0 -2
- package/dashboard/dist/assets/HomePage-DP9Q-x4a.js.map +0 -1
- package/dashboard/dist/assets/McpQueryPage-Ck75ikSd.js +0 -2
- package/dashboard/dist/assets/Modal-BU7No9NH.js +0 -2
- package/dashboard/dist/assets/Modal-BU7No9NH.js.map +0 -1
- package/dashboard/dist/assets/NamespacePill-DONj6eUU.js +0 -2
- package/dashboard/dist/assets/OperationsPage-MlMzl0Bf.js +0 -3
- package/dashboard/dist/assets/OperationsPage-MlMzl0Bf.js.map +0 -1
- package/dashboard/dist/assets/OperatorDashboard-DZOfHRE7.js +0 -2
- package/dashboard/dist/assets/PersonaDetailPage-eyHDupL0.js +0 -2
- package/dashboard/dist/assets/PersonasPage-CCtRkWiP.js +0 -2
- package/dashboard/dist/assets/PersonasPage-CCtRkWiP.js.map +0 -1
- package/dashboard/dist/assets/RoleDetailPage-BOccQCkx.js +0 -8
- package/dashboard/dist/assets/RoleDetailPage-BOccQCkx.js.map +0 -1
- package/dashboard/dist/assets/RolesPage-B3-9Ek0F.js +0 -2
- package/dashboard/dist/assets/ScanSchemeDetailPage-BnivPUJY.js +0 -2
- package/dashboard/dist/assets/ScanStationPage-DCSA7pcV.js +0 -2
- package/dashboard/dist/assets/ToolTestPanel-CZvegH_w.js +0 -2
- package/dashboard/dist/assets/UserName-BovQxdSY.js +0 -2
- package/dashboard/dist/assets/UserName-BovQxdSY.js.map +0 -1
- package/dashboard/dist/assets/escalation-columns-CZ12_oQF.js +0 -2
- package/dashboard/dist/assets/escalation-columns-CZ12_oQF.js.map +0 -1
- package/dashboard/dist/assets/index-B-Qpr29t.js +0 -2
- package/dashboard/dist/assets/index-BLLK2mzy.js +0 -2
- package/dashboard/dist/assets/index-BoQirCxt.js +0 -2
- package/dashboard/dist/assets/index-C1oOLjdF.js +0 -3
- package/dashboard/dist/assets/index-C1oOLjdF.js.map +0 -1
- package/dashboard/dist/assets/index-CG8oLNHo.js +0 -2
- package/dashboard/dist/assets/index-CdavRyaX.js +0 -67
- package/dashboard/dist/assets/index-CdavRyaX.js.map +0 -1
- package/dashboard/dist/assets/index-Ct_8Tpec.js +0 -5
- package/dashboard/dist/assets/index-DEr9QjVv.js +0 -2
- package/dashboard/dist/assets/index-DlzW75L4.js +0 -2
- package/dashboard/dist/assets/index-fUqvRHOe.css +0 -1
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProcessesListPage-CKKNpk4z.js","./vendor-query-RUZdMvN6.js","./tasks-DrWSrjmj.js","./workflows-CX_oarls.js","./useFilterParams-crmlBw_l.js","./vendor-react-CdqEC2zv.js","./useDebouncedValue-DG5JOj1F.js","./api-path-u2Jf9QXS.js","./DataTable-DFPMeqyQ.js","./EmptyState-lpUFYfun.js","./TimestampCell-CE5ZUYhV.js","./StickyPagination-BIVTAMnP.js","./FilterBar-B61qKmFD.js","./vendor-icons-BCWsItQ7.js","./PageHeader-xB92ELs3.js","./ListToolbar-DaxloPQc.js","./WorkflowPill-CZvBbkn4.js","./ProcessDetailPage-BVXieFX1.js","./PageHeaderWithStats-DVo_qqn1.js","./StatusBadge-BDeUwPtb.js","./RolePill-CYpL3a2d.js","./UserName-CsLnT75E.js","./McpOverview-Ciq8r6-p.js","./mcp-C-DMktCT.js","./pipelines-DNLwDumm.js","./yaml-workflows-YASUDPo0.js","./controlplane-BwGdcwXR.js","./StatCard-BXQ8dD9Y.js","./McpRunsPage-D0RlOpzR.js","./useNamespace-CdgF7Jxo.js","./ElapsedCell-Cul22qBS.js","./RowActions-eYrzgQSj.js","./McpRunDetailPage-BqKNmIyW.js","./SegmentedTabs-DXNzY05q.js","./EventTable-s48cTXIw.js","./SwimlaneTimeline-BMZAs_2K.js","./StreamMessageDetail-CYSC2cO1.js","./CopyableId-4Lqlc5cU.js","./McpQueryPage-BBy0NSNg.js","./mcp-query-KBeBNHb4.js","./McpQueryDetailPage-DIC0FEEb.js","./TagInput-D1uszNd2.js","./CollapsibleSection-D4VlCEbD.js","./useYamlActivityEvents-BEaOtgSZ.js","./helpers-DzO-OGPe.js","./RunAsSelector-D7RPwaAl.js","./BotPicker-DMojDLlV.js","./bots-BaOblnW4.js","./ToolPill-D-h8AoB8.js","./TimeAgo-CCxP67Rb.js","./EscalationsOverview-DSYC0nI7.js","./AvailableEscalationsPage-BSqOctep.js","./task-queues-7-sHKPsN.js","./BulkAssignModal-DYbM_6Or.js","./constants-BHkpVaqx.js","./escalation-columns-B4DG_5v8.js","./EntityTimelinePanel-CtzpJ-j2.js","./PriorityBadge-BETdj4M-.js","./CountdownTimer-DPHMBmgz.js","./OperatorDashboard-vXG0TjAQ.js","./index-8LIpvj2e.js","./metadata-display--TzK0REC.js","./WorkflowsOverview-CDFTYeQo.js","./index-CsIw-ZLk.js","./NamespacePill-Dbtm9R2T.js","./WorkflowsDashboard-BRboBhlK.js","./YamlWorkflowsPage-Qq1jfcrH.js","./GraphInvokePage-DxZv_KC2.js","./YamlWorkflowDetailPage-CmnZFevp.js","./TasksListPage-DEQymbXC.js","./TaskDetailPage-CVUDUU5Q.js","./WorkflowExecutionPage-BttnEvOd.js","./AdminDashboard-DPkWtPc1.js","./index-IWufkcH9.js","./TaskQueuePill-C2H8oRfn.js","./index-CtJkvX9e.js","./ConfirmDeleteModal-DnNHjJtD.js","./index-BuqpU6ow.js","./ToolTestPanel-BHuQTyBY.js","./index-BQPUlmmz.js","./index-iegzyfMv.js","./personas-B32sSCxm.js","./ScopeBadge-BmNzZlSj.js","./RolesPage-eayR9H4f.js","./RoleDetailPage-BytSo-YE.js","./AutoGrowTextarea-DgEQeRQw.js","./PersonasPage-Dzcinl1L.js","./PersonaDetailPage-w5TXcn4Q.js","./EscalationSchemaPage-CydTtq_A.js","./EscalationListSchemaPage-BZQ8Y_UH.js","./ScanCodesPage-C8-ZBXF5.js","./ScanSchemeDetailPage-tQhEgFKf.js","./ScanStationPage-CuhqsBKo.js","./index-xNFTmmsv.js","./OperationsPage-BX0SFizr.js","./index-BICLHYJJ.js","./index-D9NtDRtp.js","./CredentialsPage-CSYZw-rL.js","./index-G3NmdMjt.js","./DropZone-BbXlQnYB.js","./index-DU9-flEo.js","./knowledge-CjwCbm3E.js","./HomePage-zK3VP_9g.js","./AgentsPage-CoCWGhUd.js","./agents-C7vUIO7e.js","./AgentDetailPage-CufRZXnT.js","./CronLabel-CpmqDrlJ.js","./AgentConfigPage-DRfnLiQS.js","./capabilities-RZpmDWoy.js","./topics-DgzGU-vR.js","./CapabilitiesPage-CDQ5JHNP.js","./TopicsPage-DO8pUmng.js","./TopicDetailPage-SFuiludx.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var Cw=Object.defineProperty;var Mw=(r,t,s)=>t in r?Cw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[t]=s;var j=(r,t,s)=>Mw(r,typeof t!="symbol"?t+"":t,s);import{r as Rw,u as We,a as A,j as h,b as Ve,c as et,g as Dw,Q as qw,d as Lw}from"./vendor-query-RUZdMvN6.js";import{r as Bw,u as Zi,a as wn,b as zd,L as kr,N as Ki,c as Bn,O as $i,d as Uw,R as Pw}from"./vendor-react-CdqEC2zv.js";import{X as Jt,E as zw,S as Iw,M as $w,a as Id,b as Hw,c as Fw,C as Tb,d as sd,I as id,U as Gw,B as Vw,G as Yw,T as Kw,R as Cb,e as Jw,Z as Xw,P as ag,f as Mb,g as Qw,h as og,i as lg,L as cg,j as Zw,W as $d,k as Ww,l as eS,F as tS,m as Rb,n as nS,D as rS,N as sS,o as iS,p as Db,q as qb,r as Lb,s as Bb,t as aS,u as oS,v as lS,w as cS,x as uS,y as fS,z as hS,A as dS,H as mS}from"./vendor-icons-BCWsItQ7.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))i(l);new MutationObserver(l=>{for(const c of l)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&i(d)}).observe(document,{childList:!0,subtree:!0});function s(l){const c={};return l.integrity&&(c.integrity=l.integrity),l.referrerPolicy&&(c.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?c.credentials="include":l.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function i(l){if(l.ep)return;l.ep=!0;const c=s(l);fetch(l.href,c)}})();var Ph={exports:{}},Xa={},zh={exports:{}},Ih={};/**
|
|
3
|
+
* @license React
|
|
4
|
+
* scheduler.production.js
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
7
|
+
*
|
|
8
|
+
* This source code is licensed under the MIT license found in the
|
|
9
|
+
* LICENSE file in the root directory of this source tree.
|
|
10
|
+
*/var ug;function pS(){return ug||(ug=1,(function(r){function t(Y,oe){var he=Y.length;Y.push(oe);e:for(;0<he;){var Ae=he-1>>>1,_e=Y[Ae];if(0<l(_e,oe))Y[Ae]=oe,Y[he]=_e,he=Ae;else break e}}function s(Y){return Y.length===0?null:Y[0]}function i(Y){if(Y.length===0)return null;var oe=Y[0],he=Y.pop();if(he!==oe){Y[0]=he;e:for(var Ae=0,_e=Y.length,Ne=_e>>>1;Ae<Ne;){var je=2*(Ae+1)-1,Te=Y[je],rt=je+1,Oe=Y[rt];if(0>l(Te,he))rt<_e&&0>l(Oe,Te)?(Y[Ae]=Oe,Y[rt]=he,Ae=rt):(Y[Ae]=Te,Y[je]=he,Ae=je);else if(rt<_e&&0>l(Oe,he))Y[Ae]=Oe,Y[rt]=he,Ae=rt;else break e}}return oe}function l(Y,oe){var he=Y.sortIndex-oe.sortIndex;return he!==0?he:Y.id-oe.id}if(r.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;r.unstable_now=function(){return c.now()}}else{var d=Date,y=d.now();r.unstable_now=function(){return d.now()-y}}var g=[],f=[],m=1,b=null,x=3,v=!1,w=!1,S=!1,C=!1,L=typeof setTimeout=="function"?setTimeout:null,U=typeof clearTimeout=="function"?clearTimeout:null,ne=typeof setImmediate<"u"?setImmediate:null;function se(Y){for(var oe=s(f);oe!==null;){if(oe.callback===null)i(f);else if(oe.startTime<=Y)i(f),oe.sortIndex=oe.expirationTime,t(g,oe);else break;oe=s(f)}}function D(Y){if(S=!1,se(Y),!w)if(s(g)!==null)w=!0,z||(z=!0,J());else{var oe=s(f);oe!==null&&Re(D,oe.startTime-Y)}}var z=!1,ae=-1,X=5,M=-1;function $(){return C?!0:!(r.unstable_now()-M<X)}function Z(){if(C=!1,z){var Y=r.unstable_now();M=Y;var oe=!0;try{e:{w=!1,S&&(S=!1,U(ae),ae=-1),v=!0;var he=x;try{t:{for(se(Y),b=s(g);b!==null&&!(b.expirationTime>Y&&$());){var Ae=b.callback;if(typeof Ae=="function"){b.callback=null,x=b.priorityLevel;var _e=Ae(b.expirationTime<=Y);if(Y=r.unstable_now(),typeof _e=="function"){b.callback=_e,se(Y),oe=!0;break t}b===s(g)&&i(g),se(Y)}else i(g);b=s(g)}if(b!==null)oe=!0;else{var Ne=s(f);Ne!==null&&Re(D,Ne.startTime-Y),oe=!1}}break e}finally{b=null,x=he,v=!1}oe=void 0}}finally{oe?J():z=!1}}}var J;if(typeof ne=="function")J=function(){ne(Z)};else if(typeof MessageChannel<"u"){var le=new MessageChannel,ve=le.port2;le.port1.onmessage=Z,J=function(){ve.postMessage(null)}}else J=function(){L(Z,0)};function Re(Y,oe){ae=L(function(){Y(r.unstable_now())},oe)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function(Y){Y.callback=null},r.unstable_forceFrameRate=function(Y){0>Y||125<Y?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):X=0<Y?Math.floor(1e3/Y):5},r.unstable_getCurrentPriorityLevel=function(){return x},r.unstable_next=function(Y){switch(x){case 1:case 2:case 3:var oe=3;break;default:oe=x}var he=x;x=oe;try{return Y()}finally{x=he}},r.unstable_requestPaint=function(){C=!0},r.unstable_runWithPriority=function(Y,oe){switch(Y){case 1:case 2:case 3:case 4:case 5:break;default:Y=3}var he=x;x=Y;try{return oe()}finally{x=he}},r.unstable_scheduleCallback=function(Y,oe,he){var Ae=r.unstable_now();switch(typeof he=="object"&&he!==null?(he=he.delay,he=typeof he=="number"&&0<he?Ae+he:Ae):he=Ae,Y){case 1:var _e=-1;break;case 2:_e=250;break;case 5:_e=1073741823;break;case 4:_e=1e4;break;default:_e=5e3}return _e=he+_e,Y={id:m++,callback:oe,priorityLevel:Y,startTime:he,expirationTime:_e,sortIndex:-1},he>Ae?(Y.sortIndex=he,t(f,Y),s(g)===null&&Y===s(f)&&(S?(U(ae),ae=-1):S=!0,Re(D,he-Ae))):(Y.sortIndex=_e,t(g,Y),w||v||(w=!0,z||(z=!0,J()))),Y},r.unstable_shouldYield=$,r.unstable_wrapCallback=function(Y){var oe=x;return function(){var he=x;x=oe;try{return Y.apply(this,arguments)}finally{x=he}}}})(Ih)),Ih}var fg;function yS(){return fg||(fg=1,zh.exports=pS()),zh.exports}/**
|
|
11
|
+
* @license React
|
|
12
|
+
* react-dom-client.production.js
|
|
13
|
+
*
|
|
14
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
15
|
+
*
|
|
16
|
+
* This source code is licensed under the MIT license found in the
|
|
17
|
+
* LICENSE file in the root directory of this source tree.
|
|
18
|
+
*/var hg;function gS(){if(hg)return Xa;hg=1;var r=yS(),t=Rw(),s=Bw();function i(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)n+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){var n=e,a=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(a=n.return),e=n.return;while(e)}return n.tag===3?a:null}function d(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function y(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function g(e){if(c(e)!==e)throw Error(i(188))}function f(e){var n=e.alternate;if(!n){if(n=c(e),n===null)throw Error(i(188));return n!==e?null:e}for(var a=e,o=n;;){var u=a.return;if(u===null)break;var p=u.alternate;if(p===null){if(o=u.return,o!==null){a=o;continue}break}if(u.child===p.child){for(p=u.child;p;){if(p===a)return g(u),e;if(p===o)return g(u),n;p=p.sibling}throw Error(i(188))}if(a.return!==o.return)a=u,o=p;else{for(var _=!1,E=u.child;E;){if(E===a){_=!0,a=u,o=p;break}if(E===o){_=!0,o=u,a=p;break}E=E.sibling}if(!_){for(E=p.child;E;){if(E===a){_=!0,a=p,o=u;break}if(E===o){_=!0,o=p,a=u;break}E=E.sibling}if(!_)throw Error(i(189))}}if(a.alternate!==o)throw Error(i(190))}if(a.tag!==3)throw Error(i(188));return a.stateNode.current===a?e:n}function m(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=m(e),n!==null)return n;e=e.sibling}return null}var b=Object.assign,x=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),U=Symbol.for("react.consumer"),ne=Symbol.for("react.context"),se=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),z=Symbol.for("react.suspense_list"),ae=Symbol.for("react.memo"),X=Symbol.for("react.lazy"),M=Symbol.for("react.activity"),$=Symbol.for("react.memo_cache_sentinel"),Z=Symbol.iterator;function J(e){return e===null||typeof e!="object"?null:(e=Z&&e[Z]||e["@@iterator"],typeof e=="function"?e:null)}var le=Symbol.for("react.client.reference");function ve(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===le?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case S:return"Fragment";case L:return"Profiler";case C:return"StrictMode";case D:return"Suspense";case z:return"SuspenseList";case M:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case w:return"Portal";case ne:return e.displayName||"Context";case U:return(e._context.displayName||"Context")+".Consumer";case se:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ae:return n=e.displayName||null,n!==null?n:ve(e.type)||"Memo";case X:n=e._payload,e=e._init;try{return ve(e(n))}catch{}}return null}var Re=Array.isArray,Y=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,oe=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,he={pending:!1,data:null,method:null,action:null},Ae=[],_e=-1;function Ne(e){return{current:e}}function je(e){0>_e||(e.current=Ae[_e],Ae[_e]=null,_e--)}function Te(e,n){_e++,Ae[_e]=e.current,e.current=n}var rt=Ne(null),Oe=Ne(null),ot=Ne(null),yt=Ne(null);function jt(e,n){switch(Te(ot,n),Te(Oe,e),Te(rt,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?Ny(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=Ny(n),e=Ty(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}je(rt),Te(rt,e)}function ke(){je(rt),je(Oe),je(ot)}function be(e){e.memoizedState!==null&&Te(yt,e);var n=rt.current,a=Ty(n,e.type);n!==a&&(Te(Oe,e),Te(rt,a))}function _t(e){Oe.current===e&&(je(rt),je(Oe)),yt.current===e&&(je(yt),Va._currentValue=he)}var $t,En;function Ut(e){if($t===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);$t=n&&n[1]||"",En=-1<a.stack.indexOf(`
|
|
19
|
+
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
20
|
+
`+$t+e+En}var Xs=!1;function Dr(e,n){if(!e||Xs)return"";Xs=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(n){var re=function(){throw Error()};if(Object.defineProperty(re.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(re,[])}catch(K){var G=K}Reflect.construct(e,[],re)}else{try{re.call()}catch(K){G=K}e.call(re.prototype)}}else{try{throw Error()}catch(K){G=K}(re=e())&&typeof re.catch=="function"&&re.catch(function(){})}}catch(K){if(K&&G&&typeof K.stack=="string")return[K.stack,G.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var p=o.DetermineComponentFrameRoot(),_=p[0],E=p[1];if(_&&E){var R=_.split(`
|
|
21
|
+
`),F=E.split(`
|
|
22
|
+
`);for(u=o=0;o<R.length&&!R[o].includes("DetermineComponentFrameRoot");)o++;for(;u<F.length&&!F[u].includes("DetermineComponentFrameRoot");)u++;if(o===R.length||u===F.length)for(o=R.length-1,u=F.length-1;1<=o&&0<=u&&R[o]!==F[u];)u--;for(;1<=o&&0<=u;o--,u--)if(R[o]!==F[u]){if(o!==1||u!==1)do if(o--,u--,0>u||R[o]!==F[u]){var Q=`
|
|
23
|
+
`+R[o].replace(" at new "," at ");return e.displayName&&Q.includes("<anonymous>")&&(Q=Q.replace("<anonymous>",e.displayName)),Q}while(1<=o&&0<=u);break}}}finally{Xs=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?Ut(a):""}function No(e,n){switch(e.tag){case 26:case 27:case 5:return Ut(e.type);case 16:return Ut("Lazy");case 13:return e.child!==n&&n!==null?Ut("Suspense Fallback"):Ut("Suspense");case 19:return Ut("SuspenseList");case 0:case 15:return Dr(e.type,!1);case 11:return Dr(e.type.render,!1);case 1:return Dr(e.type,!0);case 31:return Ut("Activity");default:return""}}function To(e){try{var n="",a=null;do n+=No(e,a),a=e,e=e.return;while(e);return n}catch(o){return`
|
|
24
|
+
Error generating stack: `+o.message+`
|
|
25
|
+
`+o.stack}}var na=Object.prototype.hasOwnProperty,ra=r.unstable_scheduleCallback,ar=r.unstable_cancelCallback,Co=r.unstable_shouldYield,Qs=r.unstable_requestPaint,lt=r.unstable_now,ku=r.unstable_getCurrentPriorityLevel,Mo=r.unstable_ImmediatePriority,Ro=r.unstable_UserBlockingPriority,Zs=r.unstable_NormalPriority,Nu=r.unstable_LowPriority,Do=r.unstable_IdlePriority,Tu=r.log,qo=r.unstable_setDisableYieldValue,_s=null,gt=null;function rn(e){if(typeof Tu=="function"&&qo(e),gt&&typeof gt.setStrictMode=="function")try{gt.setStrictMode(_s,e)}catch{}}var Pt=Math.clz32?Math.clz32:Ws,sa=Math.log,ia=Math.LN2;function Ws(e){return e>>>=0,e===0?32:31-(sa(e)/ia|0)|0}var qr=256,or=262144,Lr=4194304;function Pn(e){var n=e&42;if(n!==0)return n;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ws(e,n,a){var o=e.pendingLanes;if(o===0)return 0;var u=0,p=e.suspendedLanes,_=e.pingedLanes;e=e.warmLanes;var E=o&134217727;return E!==0?(o=E&~p,o!==0?u=Pn(o):(_&=E,_!==0?u=Pn(_):a||(a=E&~e,a!==0&&(u=Pn(a))))):(E=o&~p,E!==0?u=Pn(E):_!==0?u=Pn(_):a||(a=o&~e,a!==0&&(u=Pn(a)))),u===0?0:n!==0&&n!==u&&(n&p)===0&&(p=u&-u,a=n&-n,p>=a||p===32&&(a&4194048)!==0)?n:u}function Ss(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function aa(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ei(){var e=Lr;return Lr<<=1,(Lr&62914560)===0&&(Lr=4194304),e}function Br(e){for(var n=[],a=0;31>a;a++)n.push(e);return n}function zn(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ur(e,n,a,o,u,p){var _=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var E=e.entanglements,R=e.expirationTimes,F=e.hiddenUpdates;for(a=_&~a;0<a;){var Q=31-Pt(a),re=1<<Q;E[Q]=0,R[Q]=-1;var G=F[Q];if(G!==null)for(F[Q]=null,Q=0;Q<G.length;Q++){var K=G[Q];K!==null&&(K.lane&=-536870913)}a&=~re}o!==0&&Pr(e,o,0),p!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=p&~(_&~n))}function Pr(e,n,a){e.pendingLanes|=n,e.suspendedLanes&=~n;var o=31-Pt(n);e.entangledLanes|=n,e.entanglements[o]=e.entanglements[o]|1073741824|a&261930}function Es(e,n){var a=e.entangledLanes|=n;for(e=e.entanglements;a;){var o=31-Pt(a),u=1<<o;u&n|e[o]&n&&(e[o]|=n),a&=~u}}function zr(e,n){var a=n&-n;return a=(a&42)!==0?1:lr(a),(a&(e.suspendedLanes|n))!==0?0:a}function lr(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 Os(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function oa(){var e=oe.p;return e!==0?e:(e=window.event,e===void 0?32:Wy(e.type))}function Lo(e,n){var a=oe.p;try{return oe.p=e,n()}finally{oe.p=a}}var Qn=Math.random().toString(36).slice(2),tt="__reactFiber$"+Qn,ht="__reactProps$"+Qn,sn="__reactContainer$"+Qn,As="__reactEvents$"+Qn,la="__reactListeners$"+Qn,Bo="__reactHandles$"+Qn,Uo="__reactResources$"+Qn,kt="__reactMarker$"+Qn;function ti(e){delete e[tt],delete e[ht],delete e[As],delete e[la],delete e[Bo]}function O(e){var n=e[tt];if(n)return n;for(var a=e.parentNode;a;){if(n=a[sn]||a[tt]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(e=By(e);e!==null;){if(a=e[tt])return a;e=By(e)}return n}e=a,a=e.parentNode}return null}function N(e){if(e=e[tt]||e[sn]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function k(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(i(33))}function T(e){var n=e[Uo];return n||(n=e[Uo]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function q(e){e[kt]=!0}var I=new Set,te={};function ie(e,n){V(e,n),V(e+"Capture",n)}function V(e,n){for(te[e]=n,e=0;e<n.length;e++)I.add(n[e])}var ee=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),pe={},De={};function st(e){return na.call(De,e)?!0:na.call(pe,e)?!1:ee.test(e)?De[e]=!0:(pe[e]=!0,!1)}function zt(e,n,a){if(st(n))if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var o=n.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+a)}}function In(e,n,a){if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+a)}}function cr(e,n,a,o){if(o===null)e.removeAttribute(a);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(n,a,""+o)}}function On(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function _m(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Ev(e,n,a){var o=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var u=o.get,p=o.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return u.call(this)},set:function(_){a=""+_,p.call(this,_)}}),Object.defineProperty(e,n,{enumerable:o.enumerable}),{getValue:function(){return a},setValue:function(_){a=""+_},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function Cu(e){if(!e._valueTracker){var n=_m(e)?"checked":"value";e._valueTracker=Ev(e,n,""+e[n])}}function wm(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var a=n.getValue(),o="";return e&&(o=_m(e)?e.checked?"true":"false":e.value),e=o,e!==a?(n.setValue(e),!0):!1}function Po(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Ov=/[\n"\\]/g;function An(e){return e.replace(Ov,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Mu(e,n,a,o,u,p,_,E){e.name="",_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?e.type=_:e.removeAttribute("type"),n!=null?_==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+On(n)):e.value!==""+On(n)&&(e.value=""+On(n)):_!=="submit"&&_!=="reset"||e.removeAttribute("value"),n!=null?Ru(e,_,On(n)):a!=null?Ru(e,_,On(a)):o!=null&&e.removeAttribute("value"),u==null&&p!=null&&(e.defaultChecked=!!p),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?e.name=""+On(E):e.removeAttribute("name")}function Sm(e,n,a,o,u,p,_,E){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.type=p),n!=null||a!=null){if(!(p!=="submit"&&p!=="reset"||n!=null)){Cu(e);return}a=a!=null?""+On(a):"",n=n!=null?""+On(n):a,E||n===e.value||(e.value=n),e.defaultValue=n}o=o??u,o=typeof o!="function"&&typeof o!="symbol"&&!!o,e.checked=E?e.checked:!!o,e.defaultChecked=!!o,_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(e.name=_),Cu(e)}function Ru(e,n,a){n==="number"&&Po(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function ni(e,n,a,o){if(e=e.options,n){n={};for(var u=0;u<a.length;u++)n["$"+a[u]]=!0;for(a=0;a<e.length;a++)u=n.hasOwnProperty("$"+e[a].value),e[a].selected!==u&&(e[a].selected=u),u&&o&&(e[a].defaultSelected=!0)}else{for(a=""+On(a),n=null,u=0;u<e.length;u++){if(e[u].value===a){e[u].selected=!0,o&&(e[u].defaultSelected=!0);return}n!==null||e[u].disabled||(n=e[u])}n!==null&&(n.selected=!0)}}function Em(e,n,a){if(n!=null&&(n=""+On(n),n!==e.value&&(e.value=n),a==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=a!=null?""+On(a):""}function Om(e,n,a,o){if(n==null){if(o!=null){if(a!=null)throw Error(i(92));if(Re(o)){if(1<o.length)throw Error(i(93));o=o[0]}a=o}a==null&&(a=""),n=a}a=On(n),e.defaultValue=a,o=e.textContent,o===a&&o!==""&&o!==null&&(e.value=o),Cu(e)}function ri(e,n){if(n){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=n;return}}e.textContent=n}var Av=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 Am(e,n,a){var o=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?o?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":o?e.setProperty(n,a):typeof a!="number"||a===0||Av.has(n)?n==="float"?e.cssFloat=a:e[n]=(""+a).trim():e[n]=a+"px"}function jm(e,n,a){if(n!=null&&typeof n!="object")throw Error(i(62));if(e=e.style,a!=null){for(var o in a)!a.hasOwnProperty(o)||n!=null&&n.hasOwnProperty(o)||(o.indexOf("--")===0?e.setProperty(o,""):o==="float"?e.cssFloat="":e[o]="");for(var u in n)o=n[u],n.hasOwnProperty(u)&&a[u]!==o&&Am(e,u,o)}else for(var p in n)n.hasOwnProperty(p)&&Am(e,p,n[p])}function Du(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 jv=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"]]),kv=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function zo(e){return kv.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ur(){}var qu=null;function Lu(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var si=null,ii=null;function km(e){var n=N(e);if(n&&(e=n.stateNode)){var a=e[ht]||null;e:switch(e=n.stateNode,n.type){case"input":if(Mu(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),n=a.name,a.type==="radio"&&n!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+An(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var o=a[n];if(o!==e&&o.form===e.form){var u=o[ht]||null;if(!u)throw Error(i(90));Mu(o,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(n=0;n<a.length;n++)o=a[n],o.form===e.form&&wm(o)}break e;case"textarea":Em(e,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&ni(e,!!a.multiple,n,!1)}}}var Bu=!1;function Nm(e,n,a){if(Bu)return e(n,a);Bu=!0;try{var o=e(n);return o}finally{if(Bu=!1,(si!==null||ii!==null)&&(jl(),si&&(n=si,e=ii,ii=si=null,km(n),e)))for(n=0;n<e.length;n++)km(e[n])}}function ca(e,n){var a=e.stateNode;if(a===null)return null;var o=a[ht]||null;if(o===null)return null;a=o[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(e=e.type,o=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!o;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(i(231,n,typeof a));return a}var fr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Uu=!1;if(fr)try{var ua={};Object.defineProperty(ua,"passive",{get:function(){Uu=!0}}),window.addEventListener("test",ua,ua),window.removeEventListener("test",ua,ua)}catch{Uu=!1}var Ir=null,Pu=null,Io=null;function Tm(){if(Io)return Io;var e,n=Pu,a=n.length,o,u="value"in Ir?Ir.value:Ir.textContent,p=u.length;for(e=0;e<a&&n[e]===u[e];e++);var _=a-e;for(o=1;o<=_&&n[a-o]===u[p-o];o++);return Io=u.slice(e,1<o?1-o:void 0)}function $o(e){var n=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&n===13&&(e=13)):e=n,e===10&&(e=13),32<=e||e===13?e:0}function Ho(){return!0}function Cm(){return!1}function Xt(e){function n(a,o,u,p,_){this._reactName=a,this._targetInst=u,this.type=o,this.nativeEvent=p,this.target=_,this.currentTarget=null;for(var E in e)e.hasOwnProperty(E)&&(a=e[E],this[E]=a?a(p):p[E]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?Ho:Cm,this.isPropagationStopped=Cm,this}return b(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Ho)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Ho)},persist:function(){},isPersistent:Ho}),n}var js={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Fo=Xt(js),fa=b({},js,{view:0,detail:0}),Nv=Xt(fa),zu,Iu,ha,Go=b({},fa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Hu,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!==ha&&(ha&&e.type==="mousemove"?(zu=e.screenX-ha.screenX,Iu=e.screenY-ha.screenY):Iu=zu=0,ha=e),zu)},movementY:function(e){return"movementY"in e?e.movementY:Iu}}),Mm=Xt(Go),Tv=b({},Go,{dataTransfer:0}),Cv=Xt(Tv),Mv=b({},fa,{relatedTarget:0}),$u=Xt(Mv),Rv=b({},js,{animationName:0,elapsedTime:0,pseudoElement:0}),Dv=Xt(Rv),qv=b({},js,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Lv=Xt(qv),Bv=b({},js,{data:0}),Rm=Xt(Bv),Uv={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Pv={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"},zv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Iv(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=zv[e])?!!n[e]:!1}function Hu(){return Iv}var $v=b({},fa,{key:function(e){if(e.key){var n=Uv[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=$o(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Pv[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Hu,charCode:function(e){return e.type==="keypress"?$o(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?$o(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Hv=Xt($v),Fv=b({},Go,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Dm=Xt(Fv),Gv=b({},fa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Hu}),Vv=Xt(Gv),Yv=b({},js,{propertyName:0,elapsedTime:0,pseudoElement:0}),Kv=Xt(Yv),Jv=b({},Go,{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}),Xv=Xt(Jv),Qv=b({},js,{newState:0,oldState:0}),Zv=Xt(Qv),Wv=[9,13,27,32],Fu=fr&&"CompositionEvent"in window,da=null;fr&&"documentMode"in document&&(da=document.documentMode);var e_=fr&&"TextEvent"in window&&!da,qm=fr&&(!Fu||da&&8<da&&11>=da),Lm=" ",Bm=!1;function Um(e,n){switch(e){case"keyup":return Wv.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Pm(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ai=!1;function t_(e,n){switch(e){case"compositionend":return Pm(n);case"keypress":return n.which!==32?null:(Bm=!0,Lm);case"textInput":return e=n.data,e===Lm&&Bm?null:e;default:return null}}function n_(e,n){if(ai)return e==="compositionend"||!Fu&&Um(e,n)?(e=Tm(),Io=Pu=Ir=null,ai=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return qm&&n.locale!=="ko"?null:n.data;default:return null}}var r_={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function zm(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!r_[e.type]:n==="textarea"}function Im(e,n,a,o){si?ii?ii.push(o):ii=[o]:si=o,n=Dl(n,"onChange"),0<n.length&&(a=new Fo("onChange","change",null,a,o),e.push({event:a,listeners:n}))}var ma=null,pa=null;function s_(e){Sy(e,0)}function Vo(e){var n=k(e);if(wm(n))return e}function $m(e,n){if(e==="change")return n}var Hm=!1;if(fr){var Gu;if(fr){var Vu="oninput"in document;if(!Vu){var Fm=document.createElement("div");Fm.setAttribute("oninput","return;"),Vu=typeof Fm.oninput=="function"}Gu=Vu}else Gu=!1;Hm=Gu&&(!document.documentMode||9<document.documentMode)}function Gm(){ma&&(ma.detachEvent("onpropertychange",Vm),pa=ma=null)}function Vm(e){if(e.propertyName==="value"&&Vo(pa)){var n=[];Im(n,pa,e,Lu(e)),Nm(s_,n)}}function i_(e,n,a){e==="focusin"?(Gm(),ma=n,pa=a,ma.attachEvent("onpropertychange",Vm)):e==="focusout"&&Gm()}function a_(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Vo(pa)}function o_(e,n){if(e==="click")return Vo(n)}function l_(e,n){if(e==="input"||e==="change")return Vo(n)}function c_(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var an=typeof Object.is=="function"?Object.is:c_;function ya(e,n){if(an(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var a=Object.keys(e),o=Object.keys(n);if(a.length!==o.length)return!1;for(o=0;o<a.length;o++){var u=a[o];if(!na.call(n,u)||!an(e[u],n[u]))return!1}return!0}function Ym(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Km(e,n){var a=Ym(e);e=0;for(var o;a;){if(a.nodeType===3){if(o=e+a.textContent.length,e<=n&&o>=n)return{node:a,offset:n-e};e=o}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Ym(a)}}function Jm(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Jm(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Xm(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=Po(e.document);n instanceof e.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)e=n.contentWindow;else break;n=Po(e.document)}return n}function Yu(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var u_=fr&&"documentMode"in document&&11>=document.documentMode,oi=null,Ku=null,ga=null,Ju=!1;function Qm(e,n,a){var o=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Ju||oi==null||oi!==Po(o)||(o=oi,"selectionStart"in o&&Yu(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),ga&&ya(ga,o)||(ga=o,o=Dl(Ku,"onSelect"),0<o.length&&(n=new Fo("onSelect","select",null,n,a),e.push({event:n,listeners:o}),n.target=oi)))}function ks(e,n){var a={};return a[e.toLowerCase()]=n.toLowerCase(),a["Webkit"+e]="webkit"+n,a["Moz"+e]="moz"+n,a}var li={animationend:ks("Animation","AnimationEnd"),animationiteration:ks("Animation","AnimationIteration"),animationstart:ks("Animation","AnimationStart"),transitionrun:ks("Transition","TransitionRun"),transitionstart:ks("Transition","TransitionStart"),transitioncancel:ks("Transition","TransitionCancel"),transitionend:ks("Transition","TransitionEnd")},Xu={},Zm={};fr&&(Zm=document.createElement("div").style,"AnimationEvent"in window||(delete li.animationend.animation,delete li.animationiteration.animation,delete li.animationstart.animation),"TransitionEvent"in window||delete li.transitionend.transition);function Ns(e){if(Xu[e])return Xu[e];if(!li[e])return e;var n=li[e],a;for(a in n)if(n.hasOwnProperty(a)&&a in Zm)return Xu[e]=n[a];return e}var Wm=Ns("animationend"),e0=Ns("animationiteration"),t0=Ns("animationstart"),f_=Ns("transitionrun"),h_=Ns("transitionstart"),d_=Ns("transitioncancel"),n0=Ns("transitionend"),r0=new Map,Qu="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(" ");Qu.push("scrollEnd");function $n(e,n){r0.set(e,n),ie(n,[e])}var Yo=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},jn=[],ci=0,Zu=0;function Ko(){for(var e=ci,n=Zu=ci=0;n<e;){var a=jn[n];jn[n++]=null;var o=jn[n];jn[n++]=null;var u=jn[n];jn[n++]=null;var p=jn[n];if(jn[n++]=null,o!==null&&u!==null){var _=o.pending;_===null?u.next=u:(u.next=_.next,_.next=u),o.pending=u}p!==0&&s0(a,u,p)}}function Jo(e,n,a,o){jn[ci++]=e,jn[ci++]=n,jn[ci++]=a,jn[ci++]=o,Zu|=o,e.lanes|=o,e=e.alternate,e!==null&&(e.lanes|=o)}function Wu(e,n,a,o){return Jo(e,n,a,o),Xo(e)}function Ts(e,n){return Jo(e,null,null,n),Xo(e)}function s0(e,n,a){e.lanes|=a;var o=e.alternate;o!==null&&(o.lanes|=a);for(var u=!1,p=e.return;p!==null;)p.childLanes|=a,o=p.alternate,o!==null&&(o.childLanes|=a),p.tag===22&&(e=p.stateNode,e===null||e._visibility&1||(u=!0)),e=p,p=p.return;return e.tag===3?(p=e.stateNode,u&&n!==null&&(u=31-Pt(a),e=p.hiddenUpdates,o=e[u],o===null?e[u]=[n]:o.push(n),n.lane=a|536870912),p):null}function Xo(e){if(50<Pa)throw Pa=0,ch=null,Error(i(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var ui={};function m_(e,n,a,o){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function on(e,n,a,o){return new m_(e,n,a,o)}function ef(e){return e=e.prototype,!(!e||!e.isReactComponent)}function hr(e,n){var a=e.alternate;return a===null?(a=on(e.tag,n,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=n,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,n=e.dependencies,a.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function i0(e,n){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,n=a.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function Qo(e,n,a,o,u,p){var _=0;if(o=e,typeof e=="function")ef(e)&&(_=1);else if(typeof e=="string")_=xw(e,a,rt.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case M:return e=on(31,a,n,u),e.elementType=M,e.lanes=p,e;case S:return Cs(a.children,u,p,n);case C:_=8,u|=24;break;case L:return e=on(12,a,n,u|2),e.elementType=L,e.lanes=p,e;case D:return e=on(13,a,n,u),e.elementType=D,e.lanes=p,e;case z:return e=on(19,a,n,u),e.elementType=z,e.lanes=p,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ne:_=10;break e;case U:_=9;break e;case se:_=11;break e;case ae:_=14;break e;case X:_=16,o=null;break e}_=29,a=Error(i(130,e===null?"null":typeof e,"")),o=null}return n=on(_,a,n,u),n.elementType=e,n.type=o,n.lanes=p,n}function Cs(e,n,a,o){return e=on(7,e,o,n),e.lanes=a,e}function tf(e,n,a){return e=on(6,e,null,n),e.lanes=a,e}function a0(e){var n=on(18,null,null,0);return n.stateNode=e,n}function nf(e,n,a){return n=on(4,e.children!==null?e.children:[],e.key,n),n.lanes=a,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var o0=new WeakMap;function kn(e,n){if(typeof e=="object"&&e!==null){var a=o0.get(e);return a!==void 0?a:(n={value:e,source:n,stack:To(n)},o0.set(e,n),n)}return{value:e,source:n,stack:To(n)}}var fi=[],hi=0,Zo=null,ba=0,Nn=[],Tn=0,$r=null,Zn=1,Wn="";function dr(e,n){fi[hi++]=ba,fi[hi++]=Zo,Zo=e,ba=n}function l0(e,n,a){Nn[Tn++]=Zn,Nn[Tn++]=Wn,Nn[Tn++]=$r,$r=e;var o=Zn;e=Wn;var u=32-Pt(o)-1;o&=~(1<<u),a+=1;var p=32-Pt(n)+u;if(30<p){var _=u-u%5;p=(o&(1<<_)-1).toString(32),o>>=_,u-=_,Zn=1<<32-Pt(n)+u|a<<u|o,Wn=p+e}else Zn=1<<p|a<<u|o,Wn=e}function rf(e){e.return!==null&&(dr(e,1),l0(e,1,0))}function sf(e){for(;e===Zo;)Zo=fi[--hi],fi[hi]=null,ba=fi[--hi],fi[hi]=null;for(;e===$r;)$r=Nn[--Tn],Nn[Tn]=null,Wn=Nn[--Tn],Nn[Tn]=null,Zn=Nn[--Tn],Nn[Tn]=null}function c0(e,n){Nn[Tn++]=Zn,Nn[Tn++]=Wn,Nn[Tn++]=$r,Zn=n.id,Wn=n.overflow,$r=e}var Rt=null,it=null,Pe=!1,Hr=null,Cn=!1,af=Error(i(519));function Fr(e){var n=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw xa(kn(n,e)),af}function u0(e){var n=e.stateNode,a=e.type,o=e.memoizedProps;switch(n[tt]=e,n[ht]=o,a){case"dialog":Le("cancel",n),Le("close",n);break;case"iframe":case"object":case"embed":Le("load",n);break;case"video":case"audio":for(a=0;a<Ia.length;a++)Le(Ia[a],n);break;case"source":Le("error",n);break;case"img":case"image":case"link":Le("error",n),Le("load",n);break;case"details":Le("toggle",n);break;case"input":Le("invalid",n),Sm(n,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":Le("invalid",n);break;case"textarea":Le("invalid",n),Om(n,o.value,o.defaultValue,o.children)}a=o.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||o.suppressHydrationWarning===!0||jy(n.textContent,a)?(o.popover!=null&&(Le("beforetoggle",n),Le("toggle",n)),o.onScroll!=null&&Le("scroll",n),o.onScrollEnd!=null&&Le("scrollend",n),o.onClick!=null&&(n.onclick=ur),n=!0):n=!1,n||Fr(e,!0)}function f0(e){for(Rt=e.return;Rt;)switch(Rt.tag){case 5:case 31:case 13:Cn=!1;return;case 27:case 3:Cn=!0;return;default:Rt=Rt.return}}function di(e){if(e!==Rt)return!1;if(!Pe)return f0(e),Pe=!0,!1;var n=e.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||Eh(e.type,e.memoizedProps)),a=!a),a&&it&&Fr(e),f0(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));it=Ly(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));it=Ly(e)}else n===27?(n=it,ss(e.type)?(e=Nh,Nh=null,it=e):it=n):it=Rt?Rn(e.stateNode.nextSibling):null;return!0}function Ms(){it=Rt=null,Pe=!1}function of(){var e=Hr;return e!==null&&(en===null?en=e:en.push.apply(en,e),Hr=null),e}function xa(e){Hr===null?Hr=[e]:Hr.push(e)}var lf=Ne(null),Rs=null,mr=null;function Gr(e,n,a){Te(lf,n._currentValue),n._currentValue=a}function pr(e){e._currentValue=lf.current,je(lf)}function cf(e,n,a){for(;e!==null;){var o=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,o!==null&&(o.childLanes|=n)):o!==null&&(o.childLanes&n)!==n&&(o.childLanes|=n),e===a)break;e=e.return}}function uf(e,n,a,o){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var p=u.dependencies;if(p!==null){var _=u.child;p=p.firstContext;e:for(;p!==null;){var E=p;p=u;for(var R=0;R<n.length;R++)if(E.context===n[R]){p.lanes|=a,E=p.alternate,E!==null&&(E.lanes|=a),cf(p.return,a,e),o||(_=null);break e}p=E.next}}else if(u.tag===18){if(_=u.return,_===null)throw Error(i(341));_.lanes|=a,p=_.alternate,p!==null&&(p.lanes|=a),cf(_,a,e),_=null}else _=u.child;if(_!==null)_.return=u;else for(_=u;_!==null;){if(_===e){_=null;break}if(u=_.sibling,u!==null){u.return=_.return,_=u;break}_=_.return}u=_}}function mi(e,n,a,o){e=null;for(var u=n,p=!1;u!==null;){if(!p){if((u.flags&524288)!==0)p=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var _=u.alternate;if(_===null)throw Error(i(387));if(_=_.memoizedProps,_!==null){var E=u.type;an(u.pendingProps.value,_.value)||(e!==null?e.push(E):e=[E])}}else if(u===yt.current){if(_=u.alternate,_===null)throw Error(i(387));_.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(Va):e=[Va])}u=u.return}e!==null&&uf(n,e,a,o),n.flags|=262144}function Wo(e){for(e=e.firstContext;e!==null;){if(!an(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ds(e){Rs=e,mr=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Dt(e){return h0(Rs,e)}function el(e,n){return Rs===null&&Ds(e),h0(e,n)}function h0(e,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},mr===null){if(e===null)throw Error(i(308));mr=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else mr=mr.next=n;return a}var p_=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(a,o){e.push(o)}};this.abort=function(){n.aborted=!0,e.forEach(function(a){return a()})}},y_=r.unstable_scheduleCallback,g_=r.unstable_NormalPriority,wt={$$typeof:ne,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ff(){return{controller:new p_,data:new Map,refCount:0}}function va(e){e.refCount--,e.refCount===0&&y_(g_,function(){e.controller.abort()})}var _a=null,hf=0,pi=0,yi=null;function b_(e,n){if(_a===null){var a=_a=[];hf=0,pi=ph(),yi={status:"pending",value:void 0,then:function(o){a.push(o)}}}return hf++,n.then(d0,d0),n}function d0(){if(--hf===0&&_a!==null){yi!==null&&(yi.status="fulfilled");var e=_a;_a=null,pi=0,yi=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function x_(e,n){var a=[],o={status:"pending",value:null,reason:null,then:function(u){a.push(u)}};return e.then(function(){o.status="fulfilled",o.value=n;for(var u=0;u<a.length;u++)(0,a[u])(n)},function(u){for(o.status="rejected",o.reason=u,u=0;u<a.length;u++)(0,a[u])(void 0)}),o}var m0=Y.S;Y.S=function(e,n){Qp=lt(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&b_(e,n),m0!==null&&m0(e,n)};var qs=Ne(null);function df(){var e=qs.current;return e!==null?e:nt.pooledCache}function tl(e,n){n===null?Te(qs,qs.current):Te(qs,n.pool)}function p0(){var e=df();return e===null?null:{parent:wt._currentValue,pool:e}}var gi=Error(i(460)),mf=Error(i(474)),nl=Error(i(542)),rl={then:function(){}};function y0(e){return e=e.status,e==="fulfilled"||e==="rejected"}function g0(e,n,a){switch(a=e[a],a===void 0?e.push(n):a!==n&&(n.then(ur,ur),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,x0(e),e;default:if(typeof n.status=="string")n.then(ur,ur);else{if(e=nt,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=n,e.status="pending",e.then(function(o){if(n.status==="pending"){var u=n;u.status="fulfilled",u.value=o}},function(o){if(n.status==="pending"){var u=n;u.status="rejected",u.reason=o}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,x0(e),e}throw Bs=n,gi}}function Ls(e){try{var n=e._init;return n(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Bs=a,gi):a}}var Bs=null;function b0(){if(Bs===null)throw Error(i(459));var e=Bs;return Bs=null,e}function x0(e){if(e===gi||e===nl)throw Error(i(483))}var bi=null,wa=0;function sl(e){var n=wa;return wa+=1,bi===null&&(bi=[]),g0(bi,e,n)}function Sa(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function il(e,n){throw n.$$typeof===x?Error(i(525)):(e=Object.prototype.toString.call(n),Error(i(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function v0(e){function n(P,B){if(e){var H=P.deletions;H===null?(P.deletions=[B],P.flags|=16):H.push(B)}}function a(P,B){if(!e)return null;for(;B!==null;)n(P,B),B=B.sibling;return null}function o(P){for(var B=new Map;P!==null;)P.key!==null?B.set(P.key,P):B.set(P.index,P),P=P.sibling;return B}function u(P,B){return P=hr(P,B),P.index=0,P.sibling=null,P}function p(P,B,H){return P.index=H,e?(H=P.alternate,H!==null?(H=H.index,H<B?(P.flags|=67108866,B):H):(P.flags|=67108866,B)):(P.flags|=1048576,B)}function _(P){return e&&P.alternate===null&&(P.flags|=67108866),P}function E(P,B,H,W){return B===null||B.tag!==6?(B=tf(H,P.mode,W),B.return=P,B):(B=u(B,H),B.return=P,B)}function R(P,B,H,W){var we=H.type;return we===S?Q(P,B,H.props.children,W,H.key):B!==null&&(B.elementType===we||typeof we=="object"&&we!==null&&we.$$typeof===X&&Ls(we)===B.type)?(B=u(B,H.props),Sa(B,H),B.return=P,B):(B=Qo(H.type,H.key,H.props,null,P.mode,W),Sa(B,H),B.return=P,B)}function F(P,B,H,W){return B===null||B.tag!==4||B.stateNode.containerInfo!==H.containerInfo||B.stateNode.implementation!==H.implementation?(B=nf(H,P.mode,W),B.return=P,B):(B=u(B,H.children||[]),B.return=P,B)}function Q(P,B,H,W,we){return B===null||B.tag!==7?(B=Cs(H,P.mode,W,we),B.return=P,B):(B=u(B,H),B.return=P,B)}function re(P,B,H){if(typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint")return B=tf(""+B,P.mode,H),B.return=P,B;if(typeof B=="object"&&B!==null){switch(B.$$typeof){case v:return H=Qo(B.type,B.key,B.props,null,P.mode,H),Sa(H,B),H.return=P,H;case w:return B=nf(B,P.mode,H),B.return=P,B;case X:return B=Ls(B),re(P,B,H)}if(Re(B)||J(B))return B=Cs(B,P.mode,H,null),B.return=P,B;if(typeof B.then=="function")return re(P,sl(B),H);if(B.$$typeof===ne)return re(P,el(P,B),H);il(P,B)}return null}function G(P,B,H,W){var we=B!==null?B.key:null;if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return we!==null?null:E(P,B,""+H,W);if(typeof H=="object"&&H!==null){switch(H.$$typeof){case v:return H.key===we?R(P,B,H,W):null;case w:return H.key===we?F(P,B,H,W):null;case X:return H=Ls(H),G(P,B,H,W)}if(Re(H)||J(H))return we!==null?null:Q(P,B,H,W,null);if(typeof H.then=="function")return G(P,B,sl(H),W);if(H.$$typeof===ne)return G(P,B,el(P,H),W);il(P,H)}return null}function K(P,B,H,W,we){if(typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint")return P=P.get(H)||null,E(B,P,""+W,we);if(typeof W=="object"&&W!==null){switch(W.$$typeof){case v:return P=P.get(W.key===null?H:W.key)||null,R(B,P,W,we);case w:return P=P.get(W.key===null?H:W.key)||null,F(B,P,W,we);case X:return W=Ls(W),K(P,B,H,W,we)}if(Re(W)||J(W))return P=P.get(H)||null,Q(B,P,W,we,null);if(typeof W.then=="function")return K(P,B,H,sl(W),we);if(W.$$typeof===ne)return K(P,B,H,el(B,W),we);il(B,W)}return null}function ye(P,B,H,W){for(var we=null,He=null,ge=B,Me=B=0,Ue=null;ge!==null&&Me<H.length;Me++){ge.index>Me?(Ue=ge,ge=null):Ue=ge.sibling;var Fe=G(P,ge,H[Me],W);if(Fe===null){ge===null&&(ge=Ue);break}e&&ge&&Fe.alternate===null&&n(P,ge),B=p(Fe,B,Me),He===null?we=Fe:He.sibling=Fe,He=Fe,ge=Ue}if(Me===H.length)return a(P,ge),Pe&&dr(P,Me),we;if(ge===null){for(;Me<H.length;Me++)ge=re(P,H[Me],W),ge!==null&&(B=p(ge,B,Me),He===null?we=ge:He.sibling=ge,He=ge);return Pe&&dr(P,Me),we}for(ge=o(ge);Me<H.length;Me++)Ue=K(ge,P,Me,H[Me],W),Ue!==null&&(e&&Ue.alternate!==null&&ge.delete(Ue.key===null?Me:Ue.key),B=p(Ue,B,Me),He===null?we=Ue:He.sibling=Ue,He=Ue);return e&&ge.forEach(function(cs){return n(P,cs)}),Pe&&dr(P,Me),we}function Ee(P,B,H,W){if(H==null)throw Error(i(151));for(var we=null,He=null,ge=B,Me=B=0,Ue=null,Fe=H.next();ge!==null&&!Fe.done;Me++,Fe=H.next()){ge.index>Me?(Ue=ge,ge=null):Ue=ge.sibling;var cs=G(P,ge,Fe.value,W);if(cs===null){ge===null&&(ge=Ue);break}e&&ge&&cs.alternate===null&&n(P,ge),B=p(cs,B,Me),He===null?we=cs:He.sibling=cs,He=cs,ge=Ue}if(Fe.done)return a(P,ge),Pe&&dr(P,Me),we;if(ge===null){for(;!Fe.done;Me++,Fe=H.next())Fe=re(P,Fe.value,W),Fe!==null&&(B=p(Fe,B,Me),He===null?we=Fe:He.sibling=Fe,He=Fe);return Pe&&dr(P,Me),we}for(ge=o(ge);!Fe.done;Me++,Fe=H.next())Fe=K(ge,P,Me,Fe.value,W),Fe!==null&&(e&&Fe.alternate!==null&&ge.delete(Fe.key===null?Me:Fe.key),B=p(Fe,B,Me),He===null?we=Fe:He.sibling=Fe,He=Fe);return e&&ge.forEach(function(Tw){return n(P,Tw)}),Pe&&dr(P,Me),we}function Ze(P,B,H,W){if(typeof H=="object"&&H!==null&&H.type===S&&H.key===null&&(H=H.props.children),typeof H=="object"&&H!==null){switch(H.$$typeof){case v:e:{for(var we=H.key;B!==null;){if(B.key===we){if(we=H.type,we===S){if(B.tag===7){a(P,B.sibling),W=u(B,H.props.children),W.return=P,P=W;break e}}else if(B.elementType===we||typeof we=="object"&&we!==null&&we.$$typeof===X&&Ls(we)===B.type){a(P,B.sibling),W=u(B,H.props),Sa(W,H),W.return=P,P=W;break e}a(P,B);break}else n(P,B);B=B.sibling}H.type===S?(W=Cs(H.props.children,P.mode,W,H.key),W.return=P,P=W):(W=Qo(H.type,H.key,H.props,null,P.mode,W),Sa(W,H),W.return=P,P=W)}return _(P);case w:e:{for(we=H.key;B!==null;){if(B.key===we)if(B.tag===4&&B.stateNode.containerInfo===H.containerInfo&&B.stateNode.implementation===H.implementation){a(P,B.sibling),W=u(B,H.children||[]),W.return=P,P=W;break e}else{a(P,B);break}else n(P,B);B=B.sibling}W=nf(H,P.mode,W),W.return=P,P=W}return _(P);case X:return H=Ls(H),Ze(P,B,H,W)}if(Re(H))return ye(P,B,H,W);if(J(H)){if(we=J(H),typeof we!="function")throw Error(i(150));return H=we.call(H),Ee(P,B,H,W)}if(typeof H.then=="function")return Ze(P,B,sl(H),W);if(H.$$typeof===ne)return Ze(P,B,el(P,H),W);il(P,H)}return typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint"?(H=""+H,B!==null&&B.tag===6?(a(P,B.sibling),W=u(B,H),W.return=P,P=W):(a(P,B),W=tf(H,P.mode,W),W.return=P,P=W),_(P)):a(P,B)}return function(P,B,H,W){try{wa=0;var we=Ze(P,B,H,W);return bi=null,we}catch(ge){if(ge===gi||ge===nl)throw ge;var He=on(29,ge,null,P.mode);return He.lanes=W,He.return=P,He}finally{}}}var Us=v0(!0),_0=v0(!1),Vr=!1;function pf(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function yf(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Yr(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Kr(e,n,a){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,(Ge&2)!==0){var u=o.pending;return u===null?n.next=n:(n.next=u.next,u.next=n),o.pending=n,n=Xo(e),s0(e,null,a),n}return Jo(e,o,n,a),Xo(e)}function Ea(e,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var o=n.lanes;o&=e.pendingLanes,a|=o,n.lanes=a,Es(e,a)}}function gf(e,n){var a=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,a===o)){var u=null,p=null;if(a=a.firstBaseUpdate,a!==null){do{var _={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};p===null?u=p=_:p=p.next=_,a=a.next}while(a!==null);p===null?u=p=n:p=p.next=n}else u=p=n;a={baseState:o.baseState,firstBaseUpdate:u,lastBaseUpdate:p,shared:o.shared,callbacks:o.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=n:e.next=n,a.lastBaseUpdate=n}var bf=!1;function Oa(){if(bf){var e=yi;if(e!==null)throw e}}function Aa(e,n,a,o){bf=!1;var u=e.updateQueue;Vr=!1;var p=u.firstBaseUpdate,_=u.lastBaseUpdate,E=u.shared.pending;if(E!==null){u.shared.pending=null;var R=E,F=R.next;R.next=null,_===null?p=F:_.next=F,_=R;var Q=e.alternate;Q!==null&&(Q=Q.updateQueue,E=Q.lastBaseUpdate,E!==_&&(E===null?Q.firstBaseUpdate=F:E.next=F,Q.lastBaseUpdate=R))}if(p!==null){var re=u.baseState;_=0,Q=F=R=null,E=p;do{var G=E.lane&-536870913,K=G!==E.lane;if(K?(Be&G)===G:(o&G)===G){G!==0&&G===pi&&(bf=!0),Q!==null&&(Q=Q.next={lane:0,tag:E.tag,payload:E.payload,callback:null,next:null});e:{var ye=e,Ee=E;G=n;var Ze=a;switch(Ee.tag){case 1:if(ye=Ee.payload,typeof ye=="function"){re=ye.call(Ze,re,G);break e}re=ye;break e;case 3:ye.flags=ye.flags&-65537|128;case 0:if(ye=Ee.payload,G=typeof ye=="function"?ye.call(Ze,re,G):ye,G==null)break e;re=b({},re,G);break e;case 2:Vr=!0}}G=E.callback,G!==null&&(e.flags|=64,K&&(e.flags|=8192),K=u.callbacks,K===null?u.callbacks=[G]:K.push(G))}else K={lane:G,tag:E.tag,payload:E.payload,callback:E.callback,next:null},Q===null?(F=Q=K,R=re):Q=Q.next=K,_|=G;if(E=E.next,E===null){if(E=u.shared.pending,E===null)break;K=E,E=K.next,K.next=null,u.lastBaseUpdate=K,u.shared.pending=null}}while(!0);Q===null&&(R=re),u.baseState=R,u.firstBaseUpdate=F,u.lastBaseUpdate=Q,p===null&&(u.shared.lanes=0),Wr|=_,e.lanes=_,e.memoizedState=re}}function w0(e,n){if(typeof e!="function")throw Error(i(191,e));e.call(n)}function S0(e,n){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)w0(a[e],n)}var xi=Ne(null),al=Ne(0);function E0(e,n){e=Er,Te(al,e),Te(xi,n),Er=e|n.baseLanes}function xf(){Te(al,Er),Te(xi,xi.current)}function vf(){Er=al.current,je(xi),je(al)}var ln=Ne(null),Mn=null;function Jr(e){var n=e.alternate;Te(bt,bt.current&1),Te(ln,e),Mn===null&&(n===null||xi.current!==null||n.memoizedState!==null)&&(Mn=e)}function _f(e){Te(bt,bt.current),Te(ln,e),Mn===null&&(Mn=e)}function O0(e){e.tag===22?(Te(bt,bt.current),Te(ln,e),Mn===null&&(Mn=e)):Xr()}function Xr(){Te(bt,bt.current),Te(ln,ln.current)}function cn(e){je(ln),Mn===e&&(Mn=null),je(bt)}var bt=Ne(0);function ol(e){for(var n=e;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||jh(a)||kh(a)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var yr=0,Ce=null,Xe=null,St=null,ll=!1,vi=!1,Ps=!1,cl=0,ja=0,_i=null,v_=0;function dt(){throw Error(i(321))}function wf(e,n){if(n===null)return!1;for(var a=0;a<n.length&&a<e.length;a++)if(!an(e[a],n[a]))return!1;return!0}function Sf(e,n,a,o,u,p){return yr=p,Ce=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,Y.H=e===null||e.memoizedState===null?lp:Uf,Ps=!1,p=a(o,u),Ps=!1,vi&&(p=j0(n,a,o,u)),A0(e),p}function A0(e){Y.H=Ta;var n=Xe!==null&&Xe.next!==null;if(yr=0,St=Xe=Ce=null,ll=!1,ja=0,_i=null,n)throw Error(i(300));e===null||Et||(e=e.dependencies,e!==null&&Wo(e)&&(Et=!0))}function j0(e,n,a,o){Ce=e;var u=0;do{if(vi&&(_i=null),ja=0,vi=!1,25<=u)throw Error(i(301));if(u+=1,St=Xe=null,e.updateQueue!=null){var p=e.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}Y.H=cp,p=n(a,o)}while(vi);return p}function __(){var e=Y.H,n=e.useState()[0];return n=typeof n.then=="function"?ka(n):n,e=e.useState()[0],(Xe!==null?Xe.memoizedState:null)!==e&&(Ce.flags|=1024),n}function Ef(){var e=cl!==0;return cl=0,e}function Of(e,n,a){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~a}function Af(e){if(ll){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}ll=!1}yr=0,St=Xe=Ce=null,vi=!1,ja=cl=0,_i=null}function Ht(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return St===null?Ce.memoizedState=St=e:St=St.next=e,St}function xt(){if(Xe===null){var e=Ce.alternate;e=e!==null?e.memoizedState:null}else e=Xe.next;var n=St===null?Ce.memoizedState:St.next;if(n!==null)St=n,Xe=e;else{if(e===null)throw Ce.alternate===null?Error(i(467)):Error(i(310));Xe=e,e={memoizedState:Xe.memoizedState,baseState:Xe.baseState,baseQueue:Xe.baseQueue,queue:Xe.queue,next:null},St===null?Ce.memoizedState=St=e:St=St.next=e}return St}function ul(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ka(e){var n=ja;return ja+=1,_i===null&&(_i=[]),e=g0(_i,e,n),n=Ce,(St===null?n.memoizedState:St.next)===null&&(n=n.alternate,Y.H=n===null||n.memoizedState===null?lp:Uf),e}function fl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ka(e);if(e.$$typeof===ne)return Dt(e)}throw Error(i(438,String(e)))}function jf(e){var n=null,a=Ce.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var o=Ce.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(n={data:o.data.map(function(u){return u.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=ul(),Ce.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(e),o=0;o<e;o++)a[o]=$;return n.index++,a}function gr(e,n){return typeof n=="function"?n(e):n}function hl(e){var n=xt();return kf(n,Xe,e)}function kf(e,n,a){var o=e.queue;if(o===null)throw Error(i(311));o.lastRenderedReducer=a;var u=e.baseQueue,p=o.pending;if(p!==null){if(u!==null){var _=u.next;u.next=p.next,p.next=_}n.baseQueue=u=p,o.pending=null}if(p=e.baseState,u===null)e.memoizedState=p;else{n=u.next;var E=_=null,R=null,F=n,Q=!1;do{var re=F.lane&-536870913;if(re!==F.lane?(Be&re)===re:(yr&re)===re){var G=F.revertLane;if(G===0)R!==null&&(R=R.next={lane:0,revertLane:0,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null}),re===pi&&(Q=!0);else if((yr&G)===G){F=F.next,G===pi&&(Q=!0);continue}else re={lane:0,revertLane:F.revertLane,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},R===null?(E=R=re,_=p):R=R.next=re,Ce.lanes|=G,Wr|=G;re=F.action,Ps&&a(p,re),p=F.hasEagerState?F.eagerState:a(p,re)}else G={lane:re,revertLane:F.revertLane,gesture:F.gesture,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},R===null?(E=R=G,_=p):R=R.next=G,Ce.lanes|=re,Wr|=re;F=F.next}while(F!==null&&F!==n);if(R===null?_=p:R.next=E,!an(p,e.memoizedState)&&(Et=!0,Q&&(a=yi,a!==null)))throw a;e.memoizedState=p,e.baseState=_,e.baseQueue=R,o.lastRenderedState=p}return u===null&&(o.lanes=0),[e.memoizedState,o.dispatch]}function Nf(e){var n=xt(),a=n.queue;if(a===null)throw Error(i(311));a.lastRenderedReducer=e;var o=a.dispatch,u=a.pending,p=n.memoizedState;if(u!==null){a.pending=null;var _=u=u.next;do p=e(p,_.action),_=_.next;while(_!==u);an(p,n.memoizedState)||(Et=!0),n.memoizedState=p,n.baseQueue===null&&(n.baseState=p),a.lastRenderedState=p}return[p,o]}function k0(e,n,a){var o=Ce,u=xt(),p=Pe;if(p){if(a===void 0)throw Error(i(407));a=a()}else a=n();var _=!an((Xe||u).memoizedState,a);if(_&&(u.memoizedState=a,Et=!0),u=u.queue,Mf(C0.bind(null,o,u,e),[e]),u.getSnapshot!==n||_||St!==null&&St.memoizedState.tag&1){if(o.flags|=2048,wi(9,{destroy:void 0},T0.bind(null,o,u,a,n),null),nt===null)throw Error(i(349));p||(yr&127)!==0||N0(o,n,a)}return a}function N0(e,n,a){e.flags|=16384,e={getSnapshot:n,value:a},n=Ce.updateQueue,n===null?(n=ul(),Ce.updateQueue=n,n.stores=[e]):(a=n.stores,a===null?n.stores=[e]:a.push(e))}function T0(e,n,a,o){n.value=a,n.getSnapshot=o,M0(n)&&R0(e)}function C0(e,n,a){return a(function(){M0(n)&&R0(e)})}function M0(e){var n=e.getSnapshot;e=e.value;try{var a=n();return!an(e,a)}catch{return!0}}function R0(e){var n=Ts(e,2);n!==null&&tn(n,e,2)}function Tf(e){var n=Ht();if(typeof e=="function"){var a=e;if(e=a(),Ps){rn(!0);try{a()}finally{rn(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:gr,lastRenderedState:e},n}function D0(e,n,a,o){return e.baseState=a,kf(e,Xe,typeof o=="function"?o:gr)}function w_(e,n,a,o,u){if(pl(e))throw Error(i(485));if(e=n.action,e!==null){var p={payload:u,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(_){p.listeners.push(_)}};Y.T!==null?a(!0):p.isTransition=!1,o(p),a=n.pending,a===null?(p.next=n.pending=p,q0(n,p)):(p.next=a.next,n.pending=a.next=p)}}function q0(e,n){var a=n.action,o=n.payload,u=e.state;if(n.isTransition){var p=Y.T,_={};Y.T=_;try{var E=a(u,o),R=Y.S;R!==null&&R(_,E),L0(e,n,E)}catch(F){Cf(e,n,F)}finally{p!==null&&_.types!==null&&(p.types=_.types),Y.T=p}}else try{p=a(u,o),L0(e,n,p)}catch(F){Cf(e,n,F)}}function L0(e,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(o){B0(e,n,o)},function(o){return Cf(e,n,o)}):B0(e,n,a)}function B0(e,n,a){n.status="fulfilled",n.value=a,U0(n),e.state=a,n=e.pending,n!==null&&(a=n.next,a===n?e.pending=null:(a=a.next,n.next=a,q0(e,a)))}function Cf(e,n,a){var o=e.pending;if(e.pending=null,o!==null){o=o.next;do n.status="rejected",n.reason=a,U0(n),n=n.next;while(n!==o)}e.action=null}function U0(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function P0(e,n){return n}function z0(e,n){if(Pe){var a=nt.formState;if(a!==null){e:{var o=Ce;if(Pe){if(it){t:{for(var u=it,p=Cn;u.nodeType!==8;){if(!p){u=null;break t}if(u=Rn(u.nextSibling),u===null){u=null;break t}}p=u.data,u=p==="F!"||p==="F"?u:null}if(u){it=Rn(u.nextSibling),o=u.data==="F!";break e}}Fr(o)}o=!1}o&&(n=a[0])}}return a=Ht(),a.memoizedState=a.baseState=n,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:P0,lastRenderedState:n},a.queue=o,a=ip.bind(null,Ce,o),o.dispatch=a,o=Tf(!1),p=Bf.bind(null,Ce,!1,o.queue),o=Ht(),u={state:n,dispatch:null,action:e,pending:null},o.queue=u,a=w_.bind(null,Ce,u,p,a),u.dispatch=a,o.memoizedState=e,[n,a,!1]}function I0(e){var n=xt();return $0(n,Xe,e)}function $0(e,n,a){if(n=kf(e,n,P0)[0],e=hl(gr)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var o=ka(n)}catch(_){throw _===gi?nl:_}else o=n;n=xt();var u=n.queue,p=u.dispatch;return a!==n.memoizedState&&(Ce.flags|=2048,wi(9,{destroy:void 0},S_.bind(null,u,a),null)),[o,p,e]}function S_(e,n){e.action=n}function H0(e){var n=xt(),a=Xe;if(a!==null)return $0(n,a,e);xt(),n=n.memoizedState,a=xt();var o=a.queue.dispatch;return a.memoizedState=e,[n,o,!1]}function wi(e,n,a,o){return e={tag:e,create:a,deps:o,inst:n,next:null},n=Ce.updateQueue,n===null&&(n=ul(),Ce.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=e.next=e:(o=a.next,a.next=e,e.next=o,n.lastEffect=e),e}function F0(){return xt().memoizedState}function dl(e,n,a,o){var u=Ht();Ce.flags|=e,u.memoizedState=wi(1|n,{destroy:void 0},a,o===void 0?null:o)}function ml(e,n,a,o){var u=xt();o=o===void 0?null:o;var p=u.memoizedState.inst;Xe!==null&&o!==null&&wf(o,Xe.memoizedState.deps)?u.memoizedState=wi(n,p,a,o):(Ce.flags|=e,u.memoizedState=wi(1|n,p,a,o))}function G0(e,n){dl(8390656,8,e,n)}function Mf(e,n){ml(2048,8,e,n)}function E_(e){Ce.flags|=4;var n=Ce.updateQueue;if(n===null)n=ul(),Ce.updateQueue=n,n.events=[e];else{var a=n.events;a===null?n.events=[e]:a.push(e)}}function V0(e){var n=xt().memoizedState;return E_({ref:n,nextImpl:e}),function(){if((Ge&2)!==0)throw Error(i(440));return n.impl.apply(void 0,arguments)}}function Y0(e,n){return ml(4,2,e,n)}function K0(e,n){return ml(4,4,e,n)}function J0(e,n){if(typeof n=="function"){e=e();var a=n(e);return function(){typeof a=="function"?a():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function X0(e,n,a){a=a!=null?a.concat([e]):null,ml(4,4,J0.bind(null,n,e),a)}function Rf(){}function Q0(e,n){var a=xt();n=n===void 0?null:n;var o=a.memoizedState;return n!==null&&wf(n,o[1])?o[0]:(a.memoizedState=[e,n],e)}function Z0(e,n){var a=xt();n=n===void 0?null:n;var o=a.memoizedState;if(n!==null&&wf(n,o[1]))return o[0];if(o=e(),Ps){rn(!0);try{e()}finally{rn(!1)}}return a.memoizedState=[o,n],o}function Df(e,n,a){return a===void 0||(yr&1073741824)!==0&&(Be&261930)===0?e.memoizedState=n:(e.memoizedState=a,e=Wp(),Ce.lanes|=e,Wr|=e,a)}function W0(e,n,a,o){return an(a,n)?a:xi.current!==null?(e=Df(e,a,o),an(e,n)||(Et=!0),e):(yr&42)===0||(yr&1073741824)!==0&&(Be&261930)===0?(Et=!0,e.memoizedState=a):(e=Wp(),Ce.lanes|=e,Wr|=e,n)}function ep(e,n,a,o,u){var p=oe.p;oe.p=p!==0&&8>p?p:8;var _=Y.T,E={};Y.T=E,Bf(e,!1,n,a);try{var R=u(),F=Y.S;if(F!==null&&F(E,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var Q=x_(R,o);Na(e,n,Q,hn(e))}else Na(e,n,o,hn(e))}catch(re){Na(e,n,{then:function(){},status:"rejected",reason:re},hn())}finally{oe.p=p,_!==null&&E.types!==null&&(_.types=E.types),Y.T=_}}function O_(){}function qf(e,n,a,o){if(e.tag!==5)throw Error(i(476));var u=tp(e).queue;ep(e,u,n,he,a===null?O_:function(){return np(e),a(o)})}function tp(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:he,baseState:he,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:gr,lastRenderedState:he},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:gr,lastRenderedState:a},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function np(e){var n=tp(e);n.next===null&&(n=e.alternate.memoizedState),Na(e,n.next.queue,{},hn())}function Lf(){return Dt(Va)}function rp(){return xt().memoizedState}function sp(){return xt().memoizedState}function A_(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var a=hn();e=Yr(a);var o=Kr(n,e,a);o!==null&&(tn(o,n,a),Ea(o,n,a)),n={cache:ff()},e.payload=n;return}n=n.return}}function j_(e,n,a){var o=hn();a={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},pl(e)?ap(n,a):(a=Wu(e,n,a,o),a!==null&&(tn(a,e,o),op(a,n,o)))}function ip(e,n,a){var o=hn();Na(e,n,a,o)}function Na(e,n,a,o){var u={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(pl(e))ap(n,u);else{var p=e.alternate;if(e.lanes===0&&(p===null||p.lanes===0)&&(p=n.lastRenderedReducer,p!==null))try{var _=n.lastRenderedState,E=p(_,a);if(u.hasEagerState=!0,u.eagerState=E,an(E,_))return Jo(e,n,u,0),nt===null&&Ko(),!1}catch{}finally{}if(a=Wu(e,n,u,o),a!==null)return tn(a,e,o),op(a,n,o),!0}return!1}function Bf(e,n,a,o){if(o={lane:2,revertLane:ph(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},pl(e)){if(n)throw Error(i(479))}else n=Wu(e,a,o,2),n!==null&&tn(n,e,2)}function pl(e){var n=e.alternate;return e===Ce||n!==null&&n===Ce}function ap(e,n){vi=ll=!0;var a=e.pending;a===null?n.next=n:(n.next=a.next,a.next=n),e.pending=n}function op(e,n,a){if((a&4194048)!==0){var o=n.lanes;o&=e.pendingLanes,a|=o,n.lanes=a,Es(e,a)}}var Ta={readContext:Dt,use:fl,useCallback:dt,useContext:dt,useEffect:dt,useImperativeHandle:dt,useLayoutEffect:dt,useInsertionEffect:dt,useMemo:dt,useReducer:dt,useRef:dt,useState:dt,useDebugValue:dt,useDeferredValue:dt,useTransition:dt,useSyncExternalStore:dt,useId:dt,useHostTransitionStatus:dt,useFormState:dt,useActionState:dt,useOptimistic:dt,useMemoCache:dt,useCacheRefresh:dt};Ta.useEffectEvent=dt;var lp={readContext:Dt,use:fl,useCallback:function(e,n){return Ht().memoizedState=[e,n===void 0?null:n],e},useContext:Dt,useEffect:G0,useImperativeHandle:function(e,n,a){a=a!=null?a.concat([e]):null,dl(4194308,4,J0.bind(null,n,e),a)},useLayoutEffect:function(e,n){return dl(4194308,4,e,n)},useInsertionEffect:function(e,n){dl(4,2,e,n)},useMemo:function(e,n){var a=Ht();n=n===void 0?null:n;var o=e();if(Ps){rn(!0);try{e()}finally{rn(!1)}}return a.memoizedState=[o,n],o},useReducer:function(e,n,a){var o=Ht();if(a!==void 0){var u=a(n);if(Ps){rn(!0);try{a(n)}finally{rn(!1)}}}else u=n;return o.memoizedState=o.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},o.queue=e,e=e.dispatch=j_.bind(null,Ce,e),[o.memoizedState,e]},useRef:function(e){var n=Ht();return e={current:e},n.memoizedState=e},useState:function(e){e=Tf(e);var n=e.queue,a=ip.bind(null,Ce,n);return n.dispatch=a,[e.memoizedState,a]},useDebugValue:Rf,useDeferredValue:function(e,n){var a=Ht();return Df(a,e,n)},useTransition:function(){var e=Tf(!1);return e=ep.bind(null,Ce,e.queue,!0,!1),Ht().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,a){var o=Ce,u=Ht();if(Pe){if(a===void 0)throw Error(i(407));a=a()}else{if(a=n(),nt===null)throw Error(i(349));(Be&127)!==0||N0(o,n,a)}u.memoizedState=a;var p={value:a,getSnapshot:n};return u.queue=p,G0(C0.bind(null,o,p,e),[e]),o.flags|=2048,wi(9,{destroy:void 0},T0.bind(null,o,p,a,n),null),a},useId:function(){var e=Ht(),n=nt.identifierPrefix;if(Pe){var a=Wn,o=Zn;a=(o&~(1<<32-Pt(o)-1)).toString(32)+a,n="_"+n+"R_"+a,a=cl++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=v_++,n="_"+n+"r_"+a.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:Lf,useFormState:z0,useActionState:z0,useOptimistic:function(e){var n=Ht();n.memoizedState=n.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=Bf.bind(null,Ce,!0,a),a.dispatch=n,[e,n]},useMemoCache:jf,useCacheRefresh:function(){return Ht().memoizedState=A_.bind(null,Ce)},useEffectEvent:function(e){var n=Ht(),a={impl:e};return n.memoizedState=a,function(){if((Ge&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}},Uf={readContext:Dt,use:fl,useCallback:Q0,useContext:Dt,useEffect:Mf,useImperativeHandle:X0,useInsertionEffect:Y0,useLayoutEffect:K0,useMemo:Z0,useReducer:hl,useRef:F0,useState:function(){return hl(gr)},useDebugValue:Rf,useDeferredValue:function(e,n){var a=xt();return W0(a,Xe.memoizedState,e,n)},useTransition:function(){var e=hl(gr)[0],n=xt().memoizedState;return[typeof e=="boolean"?e:ka(e),n]},useSyncExternalStore:k0,useId:rp,useHostTransitionStatus:Lf,useFormState:I0,useActionState:I0,useOptimistic:function(e,n){var a=xt();return D0(a,Xe,e,n)},useMemoCache:jf,useCacheRefresh:sp};Uf.useEffectEvent=V0;var cp={readContext:Dt,use:fl,useCallback:Q0,useContext:Dt,useEffect:Mf,useImperativeHandle:X0,useInsertionEffect:Y0,useLayoutEffect:K0,useMemo:Z0,useReducer:Nf,useRef:F0,useState:function(){return Nf(gr)},useDebugValue:Rf,useDeferredValue:function(e,n){var a=xt();return Xe===null?Df(a,e,n):W0(a,Xe.memoizedState,e,n)},useTransition:function(){var e=Nf(gr)[0],n=xt().memoizedState;return[typeof e=="boolean"?e:ka(e),n]},useSyncExternalStore:k0,useId:rp,useHostTransitionStatus:Lf,useFormState:H0,useActionState:H0,useOptimistic:function(e,n){var a=xt();return Xe!==null?D0(a,Xe,e,n):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:jf,useCacheRefresh:sp};cp.useEffectEvent=V0;function Pf(e,n,a,o){n=e.memoizedState,a=a(o,n),a=a==null?n:b({},n,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var zf={enqueueSetState:function(e,n,a){e=e._reactInternals;var o=hn(),u=Yr(o);u.payload=n,a!=null&&(u.callback=a),n=Kr(e,u,o),n!==null&&(tn(n,e,o),Ea(n,e,o))},enqueueReplaceState:function(e,n,a){e=e._reactInternals;var o=hn(),u=Yr(o);u.tag=1,u.payload=n,a!=null&&(u.callback=a),n=Kr(e,u,o),n!==null&&(tn(n,e,o),Ea(n,e,o))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var a=hn(),o=Yr(a);o.tag=2,n!=null&&(o.callback=n),n=Kr(e,o,a),n!==null&&(tn(n,e,a),Ea(n,e,a))}};function up(e,n,a,o,u,p,_){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(o,p,_):n.prototype&&n.prototype.isPureReactComponent?!ya(a,o)||!ya(u,p):!0}function fp(e,n,a,o){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,o),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,o),n.state!==e&&zf.enqueueReplaceState(n,n.state,null)}function zs(e,n){var a=n;if("ref"in n){a={};for(var o in n)o!=="ref"&&(a[o]=n[o])}if(e=e.defaultProps){a===n&&(a=b({},a));for(var u in e)a[u]===void 0&&(a[u]=e[u])}return a}function hp(e){Yo(e)}function dp(e){console.error(e)}function mp(e){Yo(e)}function yl(e,n){try{var a=e.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(o){setTimeout(function(){throw o})}}function pp(e,n,a){try{var o=e.onCaughtError;o(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function If(e,n,a){return a=Yr(a),a.tag=3,a.payload={element:null},a.callback=function(){yl(e,n)},a}function yp(e){return e=Yr(e),e.tag=3,e}function gp(e,n,a,o){var u=a.type.getDerivedStateFromError;if(typeof u=="function"){var p=o.value;e.payload=function(){return u(p)},e.callback=function(){pp(n,a,o)}}var _=a.stateNode;_!==null&&typeof _.componentDidCatch=="function"&&(e.callback=function(){pp(n,a,o),typeof u!="function"&&(es===null?es=new Set([this]):es.add(this));var E=o.stack;this.componentDidCatch(o.value,{componentStack:E!==null?E:""})})}function k_(e,n,a,o,u){if(a.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(n=a.alternate,n!==null&&mi(n,a,u,!0),a=ln.current,a!==null){switch(a.tag){case 31:case 13:return Mn===null?kl():a.alternate===null&&mt===0&&(mt=3),a.flags&=-257,a.flags|=65536,a.lanes=u,o===rl?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([o]):n.add(o),hh(e,o,u)),!1;case 22:return a.flags|=65536,o===rl?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([o])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([o]):a.add(o)),hh(e,o,u)),!1}throw Error(i(435,a.tag))}return hh(e,o,u),kl(),!1}if(Pe)return n=ln.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=u,o!==af&&(e=Error(i(422),{cause:o}),xa(kn(e,a)))):(o!==af&&(n=Error(i(423),{cause:o}),xa(kn(n,a))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,o=kn(o,a),u=If(e.stateNode,o,u),gf(e,u),mt!==4&&(mt=2)),!1;var p=Error(i(520),{cause:o});if(p=kn(p,a),Ua===null?Ua=[p]:Ua.push(p),mt!==4&&(mt=2),n===null)return!0;o=kn(o,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,e=u&-u,a.lanes|=e,e=If(a.stateNode,o,e),gf(a,e),!1;case 1:if(n=a.type,p=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(es===null||!es.has(p))))return a.flags|=65536,u&=-u,a.lanes|=u,u=yp(u),gp(u,e,a,o),gf(a,u),!1}a=a.return}while(a!==null);return!1}var $f=Error(i(461)),Et=!1;function qt(e,n,a,o){n.child=e===null?_0(n,null,a,o):Us(n,e.child,a,o)}function bp(e,n,a,o,u){a=a.render;var p=n.ref;if("ref"in o){var _={};for(var E in o)E!=="ref"&&(_[E]=o[E])}else _=o;return Ds(n),o=Sf(e,n,a,_,p,u),E=Ef(),e!==null&&!Et?(Of(e,n,u),br(e,n,u)):(Pe&&E&&rf(n),n.flags|=1,qt(e,n,o,u),n.child)}function xp(e,n,a,o,u){if(e===null){var p=a.type;return typeof p=="function"&&!ef(p)&&p.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=p,vp(e,n,p,o,u)):(e=Qo(a.type,null,o,n,n.mode,u),e.ref=n.ref,e.return=n,n.child=e)}if(p=e.child,!Xf(e,u)){var _=p.memoizedProps;if(a=a.compare,a=a!==null?a:ya,a(_,o)&&e.ref===n.ref)return br(e,n,u)}return n.flags|=1,e=hr(p,o),e.ref=n.ref,e.return=n,n.child=e}function vp(e,n,a,o,u){if(e!==null){var p=e.memoizedProps;if(ya(p,o)&&e.ref===n.ref)if(Et=!1,n.pendingProps=o=p,Xf(e,u))(e.flags&131072)!==0&&(Et=!0);else return n.lanes=e.lanes,br(e,n,u)}return Hf(e,n,a,o,u)}function _p(e,n,a,o){var u=o.children,p=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((n.flags&128)!==0){if(p=p!==null?p.baseLanes|a:a,e!==null){for(o=n.child=e.child,u=0;o!==null;)u=u|o.lanes|o.childLanes,o=o.sibling;o=u&~p}else o=0,n.child=null;return wp(e,n,p,a,o)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&tl(n,p!==null?p.cachePool:null),p!==null?E0(n,p):xf(),O0(n);else return o=n.lanes=536870912,wp(e,n,p!==null?p.baseLanes|a:a,a,o)}else p!==null?(tl(n,p.cachePool),E0(n,p),Xr(),n.memoizedState=null):(e!==null&&tl(n,null),xf(),Xr());return qt(e,n,u,a),n.child}function Ca(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function wp(e,n,a,o,u){var p=df();return p=p===null?null:{parent:wt._currentValue,pool:p},n.memoizedState={baseLanes:a,cachePool:p},e!==null&&tl(n,null),xf(),O0(n),e!==null&&mi(e,n,o,!0),n.childLanes=u,null}function gl(e,n){return n=xl({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function Sp(e,n,a){return Us(n,e.child,null,a),e=gl(n,n.pendingProps),e.flags|=2,cn(n),n.memoizedState=null,e}function N_(e,n,a){var o=n.pendingProps,u=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(Pe){if(o.mode==="hidden")return e=gl(n,o),n.lanes=536870912,Ca(null,e);if(_f(n),(e=it)?(e=qy(e,Cn),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:$r!==null?{id:Zn,overflow:Wn}:null,retryLane:536870912,hydrationErrors:null},a=a0(e),a.return=n,n.child=a,Rt=n,it=null)):e=null,e===null)throw Fr(n);return n.lanes=536870912,null}return gl(n,o)}var p=e.memoizedState;if(p!==null){var _=p.dehydrated;if(_f(n),u)if(n.flags&256)n.flags&=-257,n=Sp(e,n,a);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(i(558));else if(Et||mi(e,n,a,!1),u=(a&e.childLanes)!==0,Et||u){if(o=nt,o!==null&&(_=zr(o,a),_!==0&&_!==p.retryLane))throw p.retryLane=_,Ts(e,_),tn(o,e,_),$f;kl(),n=Sp(e,n,a)}else e=p.treeContext,it=Rn(_.nextSibling),Rt=n,Pe=!0,Hr=null,Cn=!1,e!==null&&c0(n,e),n=gl(n,o),n.flags|=4096;return n}return e=hr(e.child,{mode:o.mode,children:o.children}),e.ref=n.ref,n.child=e,e.return=n,e}function bl(e,n){var a=n.ref;if(a===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(i(284));(e===null||e.ref!==a)&&(n.flags|=4194816)}}function Hf(e,n,a,o,u){return Ds(n),a=Sf(e,n,a,o,void 0,u),o=Ef(),e!==null&&!Et?(Of(e,n,u),br(e,n,u)):(Pe&&o&&rf(n),n.flags|=1,qt(e,n,a,u),n.child)}function Ep(e,n,a,o,u,p){return Ds(n),n.updateQueue=null,a=j0(n,o,a,u),A0(e),o=Ef(),e!==null&&!Et?(Of(e,n,p),br(e,n,p)):(Pe&&o&&rf(n),n.flags|=1,qt(e,n,a,p),n.child)}function Op(e,n,a,o,u){if(Ds(n),n.stateNode===null){var p=ui,_=a.contextType;typeof _=="object"&&_!==null&&(p=Dt(_)),p=new a(o,p),n.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=zf,n.stateNode=p,p._reactInternals=n,p=n.stateNode,p.props=o,p.state=n.memoizedState,p.refs={},pf(n),_=a.contextType,p.context=typeof _=="object"&&_!==null?Dt(_):ui,p.state=n.memoizedState,_=a.getDerivedStateFromProps,typeof _=="function"&&(Pf(n,a,_,o),p.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(_=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),_!==p.state&&zf.enqueueReplaceState(p,p.state,null),Aa(n,o,p,u),Oa(),p.state=n.memoizedState),typeof p.componentDidMount=="function"&&(n.flags|=4194308),o=!0}else if(e===null){p=n.stateNode;var E=n.memoizedProps,R=zs(a,E);p.props=R;var F=p.context,Q=a.contextType;_=ui,typeof Q=="object"&&Q!==null&&(_=Dt(Q));var re=a.getDerivedStateFromProps;Q=typeof re=="function"||typeof p.getSnapshotBeforeUpdate=="function",E=n.pendingProps!==E,Q||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(E||F!==_)&&fp(n,p,o,_),Vr=!1;var G=n.memoizedState;p.state=G,Aa(n,o,p,u),Oa(),F=n.memoizedState,E||G!==F||Vr?(typeof re=="function"&&(Pf(n,a,re,o),F=n.memoizedState),(R=Vr||up(n,a,R,o,G,F,_))?(Q||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(n.flags|=4194308)):(typeof p.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=o,n.memoizedState=F),p.props=o,p.state=F,p.context=_,o=R):(typeof p.componentDidMount=="function"&&(n.flags|=4194308),o=!1)}else{p=n.stateNode,yf(e,n),_=n.memoizedProps,Q=zs(a,_),p.props=Q,re=n.pendingProps,G=p.context,F=a.contextType,R=ui,typeof F=="object"&&F!==null&&(R=Dt(F)),E=a.getDerivedStateFromProps,(F=typeof E=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(_!==re||G!==R)&&fp(n,p,o,R),Vr=!1,G=n.memoizedState,p.state=G,Aa(n,o,p,u),Oa();var K=n.memoizedState;_!==re||G!==K||Vr||e!==null&&e.dependencies!==null&&Wo(e.dependencies)?(typeof E=="function"&&(Pf(n,a,E,o),K=n.memoizedState),(Q=Vr||up(n,a,Q,o,G,K,R)||e!==null&&e.dependencies!==null&&Wo(e.dependencies))?(F||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(o,K,R),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(o,K,R)),typeof p.componentDidUpdate=="function"&&(n.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof p.componentDidUpdate!="function"||_===e.memoizedProps&&G===e.memoizedState||(n.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||_===e.memoizedProps&&G===e.memoizedState||(n.flags|=1024),n.memoizedProps=o,n.memoizedState=K),p.props=o,p.state=K,p.context=R,o=Q):(typeof p.componentDidUpdate!="function"||_===e.memoizedProps&&G===e.memoizedState||(n.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||_===e.memoizedProps&&G===e.memoizedState||(n.flags|=1024),o=!1)}return p=o,bl(e,n),o=(n.flags&128)!==0,p||o?(p=n.stateNode,a=o&&typeof a.getDerivedStateFromError!="function"?null:p.render(),n.flags|=1,e!==null&&o?(n.child=Us(n,e.child,null,u),n.child=Us(n,null,a,u)):qt(e,n,a,u),n.memoizedState=p.state,e=n.child):e=br(e,n,u),e}function Ap(e,n,a,o){return Ms(),n.flags|=256,qt(e,n,a,o),n.child}var Ff={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Gf(e){return{baseLanes:e,cachePool:p0()}}function Vf(e,n,a){return e=e!==null?e.childLanes&~a:0,n&&(e|=fn),e}function jp(e,n,a){var o=n.pendingProps,u=!1,p=(n.flags&128)!==0,_;if((_=p)||(_=e!==null&&e.memoizedState===null?!1:(bt.current&2)!==0),_&&(u=!0,n.flags&=-129),_=(n.flags&32)!==0,n.flags&=-33,e===null){if(Pe){if(u?Jr(n):Xr(),(e=it)?(e=qy(e,Cn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:$r!==null?{id:Zn,overflow:Wn}:null,retryLane:536870912,hydrationErrors:null},a=a0(e),a.return=n,n.child=a,Rt=n,it=null)):e=null,e===null)throw Fr(n);return kh(e)?n.lanes=32:n.lanes=536870912,null}var E=o.children;return o=o.fallback,u?(Xr(),u=n.mode,E=xl({mode:"hidden",children:E},u),o=Cs(o,u,a,null),E.return=n,o.return=n,E.sibling=o,n.child=E,o=n.child,o.memoizedState=Gf(a),o.childLanes=Vf(e,_,a),n.memoizedState=Ff,Ca(null,o)):(Jr(n),Yf(n,E))}var R=e.memoizedState;if(R!==null&&(E=R.dehydrated,E!==null)){if(p)n.flags&256?(Jr(n),n.flags&=-257,n=Kf(e,n,a)):n.memoizedState!==null?(Xr(),n.child=e.child,n.flags|=128,n=null):(Xr(),E=o.fallback,u=n.mode,o=xl({mode:"visible",children:o.children},u),E=Cs(E,u,a,null),E.flags|=2,o.return=n,E.return=n,o.sibling=E,n.child=o,Us(n,e.child,null,a),o=n.child,o.memoizedState=Gf(a),o.childLanes=Vf(e,_,a),n.memoizedState=Ff,n=Ca(null,o));else if(Jr(n),kh(E)){if(_=E.nextSibling&&E.nextSibling.dataset,_)var F=_.dgst;_=F,o=Error(i(419)),o.stack="",o.digest=_,xa({value:o,source:null,stack:null}),n=Kf(e,n,a)}else if(Et||mi(e,n,a,!1),_=(a&e.childLanes)!==0,Et||_){if(_=nt,_!==null&&(o=zr(_,a),o!==0&&o!==R.retryLane))throw R.retryLane=o,Ts(e,o),tn(_,e,o),$f;jh(E)||kl(),n=Kf(e,n,a)}else jh(E)?(n.flags|=192,n.child=e.child,n=null):(e=R.treeContext,it=Rn(E.nextSibling),Rt=n,Pe=!0,Hr=null,Cn=!1,e!==null&&c0(n,e),n=Yf(n,o.children),n.flags|=4096);return n}return u?(Xr(),E=o.fallback,u=n.mode,R=e.child,F=R.sibling,o=hr(R,{mode:"hidden",children:o.children}),o.subtreeFlags=R.subtreeFlags&65011712,F!==null?E=hr(F,E):(E=Cs(E,u,a,null),E.flags|=2),E.return=n,o.return=n,o.sibling=E,n.child=o,Ca(null,o),o=n.child,E=e.child.memoizedState,E===null?E=Gf(a):(u=E.cachePool,u!==null?(R=wt._currentValue,u=u.parent!==R?{parent:R,pool:R}:u):u=p0(),E={baseLanes:E.baseLanes|a,cachePool:u}),o.memoizedState=E,o.childLanes=Vf(e,_,a),n.memoizedState=Ff,Ca(e.child,o)):(Jr(n),a=e.child,e=a.sibling,a=hr(a,{mode:"visible",children:o.children}),a.return=n,a.sibling=null,e!==null&&(_=n.deletions,_===null?(n.deletions=[e],n.flags|=16):_.push(e)),n.child=a,n.memoizedState=null,a)}function Yf(e,n){return n=xl({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function xl(e,n){return e=on(22,e,null,n),e.lanes=0,e}function Kf(e,n,a){return Us(n,e.child,null,a),e=Yf(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function kp(e,n,a){e.lanes|=n;var o=e.alternate;o!==null&&(o.lanes|=n),cf(e.return,n,a)}function Jf(e,n,a,o,u,p){var _=e.memoizedState;_===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:o,tail:a,tailMode:u,treeForkCount:p}:(_.isBackwards=n,_.rendering=null,_.renderingStartTime=0,_.last=o,_.tail=a,_.tailMode=u,_.treeForkCount=p)}function Np(e,n,a){var o=n.pendingProps,u=o.revealOrder,p=o.tail;o=o.children;var _=bt.current,E=(_&2)!==0;if(E?(_=_&1|2,n.flags|=128):_&=1,Te(bt,_),qt(e,n,o,a),o=Pe?ba:0,!E&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&kp(e,a,n);else if(e.tag===19)kp(e,a,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(u){case"forwards":for(a=n.child,u=null;a!==null;)e=a.alternate,e!==null&&ol(e)===null&&(u=a),a=a.sibling;a=u,a===null?(u=n.child,n.child=null):(u=a.sibling,a.sibling=null),Jf(n,!1,u,a,p,o);break;case"backwards":case"unstable_legacy-backwards":for(a=null,u=n.child,n.child=null;u!==null;){if(e=u.alternate,e!==null&&ol(e)===null){n.child=u;break}e=u.sibling,u.sibling=a,a=u,u=e}Jf(n,!0,a,null,p,o);break;case"together":Jf(n,!1,null,null,void 0,o);break;default:n.memoizedState=null}return n.child}function br(e,n,a){if(e!==null&&(n.dependencies=e.dependencies),Wr|=n.lanes,(a&n.childLanes)===0)if(e!==null){if(mi(e,n,a,!1),(a&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(i(153));if(n.child!==null){for(e=n.child,a=hr(e,e.pendingProps),n.child=a,a.return=n;e.sibling!==null;)e=e.sibling,a=a.sibling=hr(e,e.pendingProps),a.return=n;a.sibling=null}return n.child}function Xf(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&Wo(e)))}function T_(e,n,a){switch(n.tag){case 3:jt(n,n.stateNode.containerInfo),Gr(n,wt,e.memoizedState.cache),Ms();break;case 27:case 5:be(n);break;case 4:jt(n,n.stateNode.containerInfo);break;case 10:Gr(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,_f(n),null;break;case 13:var o=n.memoizedState;if(o!==null)return o.dehydrated!==null?(Jr(n),n.flags|=128,null):(a&n.child.childLanes)!==0?jp(e,n,a):(Jr(n),e=br(e,n,a),e!==null?e.sibling:null);Jr(n);break;case 19:var u=(e.flags&128)!==0;if(o=(a&n.childLanes)!==0,o||(mi(e,n,a,!1),o=(a&n.childLanes)!==0),u){if(o)return Np(e,n,a);n.flags|=128}if(u=n.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),Te(bt,bt.current),o)break;return null;case 22:return n.lanes=0,_p(e,n,a,n.pendingProps);case 24:Gr(n,wt,e.memoizedState.cache)}return br(e,n,a)}function Tp(e,n,a){if(e!==null)if(e.memoizedProps!==n.pendingProps)Et=!0;else{if(!Xf(e,a)&&(n.flags&128)===0)return Et=!1,T_(e,n,a);Et=(e.flags&131072)!==0}else Et=!1,Pe&&(n.flags&1048576)!==0&&l0(n,ba,n.index);switch(n.lanes=0,n.tag){case 16:e:{var o=n.pendingProps;if(e=Ls(n.elementType),n.type=e,typeof e=="function")ef(e)?(o=zs(e,o),n.tag=1,n=Op(null,n,e,o,a)):(n.tag=0,n=Hf(null,n,e,o,a));else{if(e!=null){var u=e.$$typeof;if(u===se){n.tag=11,n=bp(null,n,e,o,a);break e}else if(u===ae){n.tag=14,n=xp(null,n,e,o,a);break e}}throw n=ve(e)||e,Error(i(306,n,""))}}return n;case 0:return Hf(e,n,n.type,n.pendingProps,a);case 1:return o=n.type,u=zs(o,n.pendingProps),Op(e,n,o,u,a);case 3:e:{if(jt(n,n.stateNode.containerInfo),e===null)throw Error(i(387));o=n.pendingProps;var p=n.memoizedState;u=p.element,yf(e,n),Aa(n,o,null,a);var _=n.memoizedState;if(o=_.cache,Gr(n,wt,o),o!==p.cache&&uf(n,[wt],a,!0),Oa(),o=_.element,p.isDehydrated)if(p={element:o,isDehydrated:!1,cache:_.cache},n.updateQueue.baseState=p,n.memoizedState=p,n.flags&256){n=Ap(e,n,o,a);break e}else if(o!==u){u=kn(Error(i(424)),n),xa(u),n=Ap(e,n,o,a);break e}else{switch(e=n.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(it=Rn(e.firstChild),Rt=n,Pe=!0,Hr=null,Cn=!0,a=_0(n,null,o,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(Ms(),o===u){n=br(e,n,a);break e}qt(e,n,o,a)}n=n.child}return n;case 26:return bl(e,n),e===null?(a=Iy(n.type,null,n.pendingProps,null))?n.memoizedState=a:Pe||(a=n.type,e=n.pendingProps,o=ql(ot.current).createElement(a),o[tt]=n,o[ht]=e,Lt(o,a,e),q(o),n.stateNode=o):n.memoizedState=Iy(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return be(n),e===null&&Pe&&(o=n.stateNode=Uy(n.type,n.pendingProps,ot.current),Rt=n,Cn=!0,u=it,ss(n.type)?(Nh=u,it=Rn(o.firstChild)):it=u),qt(e,n,n.pendingProps.children,a),bl(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&Pe&&((u=o=it)&&(o=aw(o,n.type,n.pendingProps,Cn),o!==null?(n.stateNode=o,Rt=n,it=Rn(o.firstChild),Cn=!1,u=!0):u=!1),u||Fr(n)),be(n),u=n.type,p=n.pendingProps,_=e!==null?e.memoizedProps:null,o=p.children,Eh(u,p)?o=null:_!==null&&Eh(u,_)&&(n.flags|=32),n.memoizedState!==null&&(u=Sf(e,n,__,null,null,a),Va._currentValue=u),bl(e,n),qt(e,n,o,a),n.child;case 6:return e===null&&Pe&&((e=a=it)&&(a=ow(a,n.pendingProps,Cn),a!==null?(n.stateNode=a,Rt=n,it=null,e=!0):e=!1),e||Fr(n)),null;case 13:return jp(e,n,a);case 4:return jt(n,n.stateNode.containerInfo),o=n.pendingProps,e===null?n.child=Us(n,null,o,a):qt(e,n,o,a),n.child;case 11:return bp(e,n,n.type,n.pendingProps,a);case 7:return qt(e,n,n.pendingProps,a),n.child;case 8:return qt(e,n,n.pendingProps.children,a),n.child;case 12:return qt(e,n,n.pendingProps.children,a),n.child;case 10:return o=n.pendingProps,Gr(n,n.type,o.value),qt(e,n,o.children,a),n.child;case 9:return u=n.type._context,o=n.pendingProps.children,Ds(n),u=Dt(u),o=o(u),n.flags|=1,qt(e,n,o,a),n.child;case 14:return xp(e,n,n.type,n.pendingProps,a);case 15:return vp(e,n,n.type,n.pendingProps,a);case 19:return Np(e,n,a);case 31:return N_(e,n,a);case 22:return _p(e,n,a,n.pendingProps);case 24:return Ds(n),o=Dt(wt),e===null?(u=df(),u===null&&(u=nt,p=ff(),u.pooledCache=p,p.refCount++,p!==null&&(u.pooledCacheLanes|=a),u=p),n.memoizedState={parent:o,cache:u},pf(n),Gr(n,wt,u)):((e.lanes&a)!==0&&(yf(e,n),Aa(n,null,null,a),Oa()),u=e.memoizedState,p=n.memoizedState,u.parent!==o?(u={parent:o,cache:o},n.memoizedState=u,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=u),Gr(n,wt,o)):(o=p.cache,Gr(n,wt,o),o!==u.cache&&uf(n,[wt],a,!0))),qt(e,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(i(156,n.tag))}function xr(e){e.flags|=4}function Qf(e,n,a,o,u){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(u&335544128)===u)if(e.stateNode.complete)e.flags|=8192;else if(ry())e.flags|=8192;else throw Bs=rl,mf}else e.flags&=-16777217}function Cp(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Vy(n))if(ry())e.flags|=8192;else throw Bs=rl,mf}function vl(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?ei():536870912,e.lanes|=n,Ai|=n)}function Ma(e,n){if(!Pe)switch(e.tailMode){case"hidden":n=e.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var o=null;a!==null;)a.alternate!==null&&(o=a),a=a.sibling;o===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:o.sibling=null}}function at(e){var n=e.alternate!==null&&e.alternate.child===e.child,a=0,o=0;if(n)for(var u=e.child;u!==null;)a|=u.lanes|u.childLanes,o|=u.subtreeFlags&65011712,o|=u.flags&65011712,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)a|=u.lanes|u.childLanes,o|=u.subtreeFlags,o|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=o,e.childLanes=a,n}function C_(e,n,a){var o=n.pendingProps;switch(sf(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return at(n),null;case 1:return at(n),null;case 3:return a=n.stateNode,o=null,e!==null&&(o=e.memoizedState.cache),n.memoizedState.cache!==o&&(n.flags|=2048),pr(wt),ke(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(di(n)?xr(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,of())),at(n),null;case 26:var u=n.type,p=n.memoizedState;return e===null?(xr(n),p!==null?(at(n),Cp(n,p)):(at(n),Qf(n,u,null,o,a))):p?p!==e.memoizedState?(xr(n),at(n),Cp(n,p)):(at(n),n.flags&=-16777217):(e=e.memoizedProps,e!==o&&xr(n),at(n),Qf(n,u,e,o,a)),null;case 27:if(_t(n),a=ot.current,u=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==o&&xr(n);else{if(!o){if(n.stateNode===null)throw Error(i(166));return at(n),null}e=rt.current,di(n)?u0(n):(e=Uy(u,o,a),n.stateNode=e,xr(n))}return at(n),null;case 5:if(_t(n),u=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==o&&xr(n);else{if(!o){if(n.stateNode===null)throw Error(i(166));return at(n),null}if(p=rt.current,di(n))u0(n);else{var _=ql(ot.current);switch(p){case 1:p=_.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:p=_.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":p=_.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":p=_.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":p=_.createElement("div"),p.innerHTML="<script><\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof o.is=="string"?_.createElement("select",{is:o.is}):_.createElement("select"),o.multiple?p.multiple=!0:o.size&&(p.size=o.size);break;default:p=typeof o.is=="string"?_.createElement(u,{is:o.is}):_.createElement(u)}}p[tt]=n,p[ht]=o;e:for(_=n.child;_!==null;){if(_.tag===5||_.tag===6)p.appendChild(_.stateNode);else if(_.tag!==4&&_.tag!==27&&_.child!==null){_.child.return=_,_=_.child;continue}if(_===n)break e;for(;_.sibling===null;){if(_.return===null||_.return===n)break e;_=_.return}_.sibling.return=_.return,_=_.sibling}n.stateNode=p;e:switch(Lt(p,u,o),u){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&xr(n)}}return at(n),Qf(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,a),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==o&&xr(n);else{if(typeof o!="string"&&n.stateNode===null)throw Error(i(166));if(e=ot.current,di(n)){if(e=n.stateNode,a=n.memoizedProps,o=null,u=Rt,u!==null)switch(u.tag){case 27:case 5:o=u.memoizedProps}e[tt]=n,e=!!(e.nodeValue===a||o!==null&&o.suppressHydrationWarning===!0||jy(e.nodeValue,a)),e||Fr(n,!0)}else e=ql(e).createTextNode(o),e[tt]=n,n.stateNode=e}return at(n),null;case 31:if(a=n.memoizedState,e===null||e.memoizedState!==null){if(o=di(n),a!==null){if(e===null){if(!o)throw Error(i(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(557));e[tt]=n}else Ms(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;at(n),e=!1}else a=of(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return n.flags&256?(cn(n),n):(cn(n),null);if((n.flags&128)!==0)throw Error(i(558))}return at(n),null;case 13:if(o=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=di(n),o!==null&&o.dehydrated!==null){if(e===null){if(!u)throw Error(i(318));if(u=n.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(i(317));u[tt]=n}else Ms(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;at(n),u=!1}else u=of(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return n.flags&256?(cn(n),n):(cn(n),null)}return cn(n),(n.flags&128)!==0?(n.lanes=a,n):(a=o!==null,e=e!==null&&e.memoizedState!==null,a&&(o=n.child,u=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(u=o.alternate.memoizedState.cachePool.pool),p=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(p=o.memoizedState.cachePool.pool),p!==u&&(o.flags|=2048)),a!==e&&a&&(n.child.flags|=8192),vl(n,n.updateQueue),at(n),null);case 4:return ke(),e===null&&xh(n.stateNode.containerInfo),at(n),null;case 10:return pr(n.type),at(n),null;case 19:if(je(bt),o=n.memoizedState,o===null)return at(n),null;if(u=(n.flags&128)!==0,p=o.rendering,p===null)if(u)Ma(o,!1);else{if(mt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(p=ol(e),p!==null){for(n.flags|=128,Ma(o,!1),e=p.updateQueue,n.updateQueue=e,vl(n,e),n.subtreeFlags=0,e=a,a=n.child;a!==null;)i0(a,e),a=a.sibling;return Te(bt,bt.current&1|2),Pe&&dr(n,o.treeForkCount),n.child}e=e.sibling}o.tail!==null&<()>Ol&&(n.flags|=128,u=!0,Ma(o,!1),n.lanes=4194304)}else{if(!u)if(e=ol(p),e!==null){if(n.flags|=128,u=!0,e=e.updateQueue,n.updateQueue=e,vl(n,e),Ma(o,!0),o.tail===null&&o.tailMode==="hidden"&&!p.alternate&&!Pe)return at(n),null}else 2*lt()-o.renderingStartTime>Ol&&a!==536870912&&(n.flags|=128,u=!0,Ma(o,!1),n.lanes=4194304);o.isBackwards?(p.sibling=n.child,n.child=p):(e=o.last,e!==null?e.sibling=p:n.child=p,o.last=p)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=lt(),e.sibling=null,a=bt.current,Te(bt,u?a&1|2:a&1),Pe&&dr(n,o.treeForkCount),e):(at(n),null);case 22:case 23:return cn(n),vf(),o=n.memoizedState!==null,e!==null?e.memoizedState!==null!==o&&(n.flags|=8192):o&&(n.flags|=8192),o?(a&536870912)!==0&&(n.flags&128)===0&&(at(n),n.subtreeFlags&6&&(n.flags|=8192)):at(n),a=n.updateQueue,a!==null&&vl(n,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),o=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),o!==a&&(n.flags|=2048),e!==null&&je(qs),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),pr(wt),at(n),null;case 25:return null;case 30:return null}throw Error(i(156,n.tag))}function M_(e,n){switch(sf(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return pr(wt),ke(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return _t(n),null;case 31:if(n.memoizedState!==null){if(cn(n),n.alternate===null)throw Error(i(340));Ms()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(cn(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(i(340));Ms()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return je(bt),null;case 4:return ke(),null;case 10:return pr(n.type),null;case 22:case 23:return cn(n),vf(),e!==null&&je(qs),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return pr(wt),null;case 25:return null;default:return null}}function Mp(e,n){switch(sf(n),n.tag){case 3:pr(wt),ke();break;case 26:case 27:case 5:_t(n);break;case 4:ke();break;case 31:n.memoizedState!==null&&cn(n);break;case 13:cn(n);break;case 19:je(bt);break;case 10:pr(n.type);break;case 22:case 23:cn(n),vf(),e!==null&&je(qs);break;case 24:pr(wt)}}function Ra(e,n){try{var a=n.updateQueue,o=a!==null?a.lastEffect:null;if(o!==null){var u=o.next;a=u;do{if((a.tag&e)===e){o=void 0;var p=a.create,_=a.inst;o=p(),_.destroy=o}a=a.next}while(a!==u)}}catch(E){Ke(n,n.return,E)}}function Qr(e,n,a){try{var o=n.updateQueue,u=o!==null?o.lastEffect:null;if(u!==null){var p=u.next;o=p;do{if((o.tag&e)===e){var _=o.inst,E=_.destroy;if(E!==void 0){_.destroy=void 0,u=n;var R=a,F=E;try{F()}catch(Q){Ke(u,R,Q)}}}o=o.next}while(o!==p)}}catch(Q){Ke(n,n.return,Q)}}function Rp(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{S0(n,a)}catch(o){Ke(e,e.return,o)}}}function Dp(e,n,a){a.props=zs(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(o){Ke(e,n,o)}}function Da(e,n){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var o=e.stateNode;break;case 30:o=e.stateNode;break;default:o=e.stateNode}typeof a=="function"?e.refCleanup=a(o):a.current=o}}catch(u){Ke(e,n,u)}}function er(e,n){var a=e.ref,o=e.refCleanup;if(a!==null)if(typeof o=="function")try{o()}catch(u){Ke(e,n,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(u){Ke(e,n,u)}else a.current=null}function qp(e){var n=e.type,a=e.memoizedProps,o=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&o.focus();break e;case"img":a.src?o.src=a.src:a.srcSet&&(o.srcset=a.srcSet)}}catch(u){Ke(e,e.return,u)}}function Zf(e,n,a){try{var o=e.stateNode;ew(o,e.type,a,n),o[ht]=n}catch(u){Ke(e,e.return,u)}}function Lp(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ss(e.type)||e.tag===4}function Wf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Lp(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&&ss(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 eh(e,n,a){var o=e.tag;if(o===5||o===6)e=e.stateNode,n?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,n):(n=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,n.appendChild(e),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=ur));else if(o!==4&&(o===27&&ss(e.type)&&(a=e.stateNode,n=null),e=e.child,e!==null))for(eh(e,n,a),e=e.sibling;e!==null;)eh(e,n,a),e=e.sibling}function _l(e,n,a){var o=e.tag;if(o===5||o===6)e=e.stateNode,n?a.insertBefore(e,n):a.appendChild(e);else if(o!==4&&(o===27&&ss(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(_l(e,n,a),e=e.sibling;e!==null;)_l(e,n,a),e=e.sibling}function Bp(e){var n=e.stateNode,a=e.memoizedProps;try{for(var o=e.type,u=n.attributes;u.length;)n.removeAttributeNode(u[0]);Lt(n,o,a),n[tt]=e,n[ht]=a}catch(p){Ke(e,e.return,p)}}var vr=!1,Ot=!1,th=!1,Up=typeof WeakSet=="function"?WeakSet:Set,Tt=null;function R_(e,n){if(e=e.containerInfo,wh=$l,e=Xm(e),Yu(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var o=a.getSelection&&a.getSelection();if(o&&o.rangeCount!==0){a=o.anchorNode;var u=o.anchorOffset,p=o.focusNode;o=o.focusOffset;try{a.nodeType,p.nodeType}catch{a=null;break e}var _=0,E=-1,R=-1,F=0,Q=0,re=e,G=null;t:for(;;){for(var K;re!==a||u!==0&&re.nodeType!==3||(E=_+u),re!==p||o!==0&&re.nodeType!==3||(R=_+o),re.nodeType===3&&(_+=re.nodeValue.length),(K=re.firstChild)!==null;)G=re,re=K;for(;;){if(re===e)break t;if(G===a&&++F===u&&(E=_),G===p&&++Q===o&&(R=_),(K=re.nextSibling)!==null)break;re=G,G=re.parentNode}re=K}a=E===-1||R===-1?null:{start:E,end:R}}else a=null}a=a||{start:0,end:0}}else a=null;for(Sh={focusedElem:e,selectionRange:a},$l=!1,Tt=n;Tt!==null;)if(n=Tt,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,Tt=e;else for(;Tt!==null;){switch(n=Tt,p=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)u=e[a],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&p!==null){e=void 0,a=n,u=p.memoizedProps,p=p.memoizedState,o=a.stateNode;try{var ye=zs(a.type,u);e=o.getSnapshotBeforeUpdate(ye,p),o.__reactInternalSnapshotBeforeUpdate=e}catch(Ee){Ke(a,a.return,Ee)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,a=e.nodeType,a===9)Ah(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Ah(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(i(163))}if(e=n.sibling,e!==null){e.return=n.return,Tt=e;break}Tt=n.return}}function Pp(e,n,a){var o=a.flags;switch(a.tag){case 0:case 11:case 15:wr(e,a),o&4&&Ra(5,a);break;case 1:if(wr(e,a),o&4)if(e=a.stateNode,n===null)try{e.componentDidMount()}catch(_){Ke(a,a.return,_)}else{var u=zs(a.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(u,n,e.__reactInternalSnapshotBeforeUpdate)}catch(_){Ke(a,a.return,_)}}o&64&&Rp(a),o&512&&Da(a,a.return);break;case 3:if(wr(e,a),o&64&&(e=a.updateQueue,e!==null)){if(n=null,a.child!==null)switch(a.child.tag){case 27:case 5:n=a.child.stateNode;break;case 1:n=a.child.stateNode}try{S0(e,n)}catch(_){Ke(a,a.return,_)}}break;case 27:n===null&&o&4&&Bp(a);case 26:case 5:wr(e,a),n===null&&o&4&&qp(a),o&512&&Da(a,a.return);break;case 12:wr(e,a);break;case 31:wr(e,a),o&4&&$p(e,a);break;case 13:wr(e,a),o&4&&Hp(e,a),o&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=$_.bind(null,a),lw(e,a))));break;case 22:if(o=a.memoizedState!==null||vr,!o){n=n!==null&&n.memoizedState!==null||Ot,u=vr;var p=Ot;vr=o,(Ot=n)&&!p?Sr(e,a,(a.subtreeFlags&8772)!==0):wr(e,a),vr=u,Ot=p}break;case 30:break;default:wr(e,a)}}function zp(e){var n=e.alternate;n!==null&&(e.alternate=null,zp(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&ti(n)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var ct=null,Qt=!1;function _r(e,n,a){for(a=a.child;a!==null;)Ip(e,n,a),a=a.sibling}function Ip(e,n,a){if(gt&&typeof gt.onCommitFiberUnmount=="function")try{gt.onCommitFiberUnmount(_s,a)}catch{}switch(a.tag){case 26:Ot||er(a,n),_r(e,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Ot||er(a,n);var o=ct,u=Qt;ss(a.type)&&(ct=a.stateNode,Qt=!1),_r(e,n,a),Ha(a.stateNode),ct=o,Qt=u;break;case 5:Ot||er(a,n);case 6:if(o=ct,u=Qt,ct=null,_r(e,n,a),ct=o,Qt=u,ct!==null)if(Qt)try{(ct.nodeType===9?ct.body:ct.nodeName==="HTML"?ct.ownerDocument.body:ct).removeChild(a.stateNode)}catch(p){Ke(a,n,p)}else try{ct.removeChild(a.stateNode)}catch(p){Ke(a,n,p)}break;case 18:ct!==null&&(Qt?(e=ct,Ry(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),Di(e)):Ry(ct,a.stateNode));break;case 4:o=ct,u=Qt,ct=a.stateNode.containerInfo,Qt=!0,_r(e,n,a),ct=o,Qt=u;break;case 0:case 11:case 14:case 15:Qr(2,a,n),Ot||Qr(4,a,n),_r(e,n,a);break;case 1:Ot||(er(a,n),o=a.stateNode,typeof o.componentWillUnmount=="function"&&Dp(a,n,o)),_r(e,n,a);break;case 21:_r(e,n,a);break;case 22:Ot=(o=Ot)||a.memoizedState!==null,_r(e,n,a),Ot=o;break;default:_r(e,n,a)}}function $p(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Di(e)}catch(a){Ke(n,n.return,a)}}}function Hp(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Di(e)}catch(a){Ke(n,n.return,a)}}function D_(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new Up),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new Up),n;default:throw Error(i(435,e.tag))}}function wl(e,n){var a=D_(e);n.forEach(function(o){if(!a.has(o)){a.add(o);var u=H_.bind(null,e,o);o.then(u,u)}})}function Zt(e,n){var a=n.deletions;if(a!==null)for(var o=0;o<a.length;o++){var u=a[o],p=e,_=n,E=_;e:for(;E!==null;){switch(E.tag){case 27:if(ss(E.type)){ct=E.stateNode,Qt=!1;break e}break;case 5:ct=E.stateNode,Qt=!1;break e;case 3:case 4:ct=E.stateNode.containerInfo,Qt=!0;break e}E=E.return}if(ct===null)throw Error(i(160));Ip(p,_,u),ct=null,Qt=!1,p=u.alternate,p!==null&&(p.return=null),u.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Fp(n,e),n=n.sibling}var Hn=null;function Fp(e,n){var a=e.alternate,o=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Zt(n,e),Wt(e),o&4&&(Qr(3,e,e.return),Ra(3,e),Qr(5,e,e.return));break;case 1:Zt(n,e),Wt(e),o&512&&(Ot||a===null||er(a,a.return)),o&64&&vr&&(e=e.updateQueue,e!==null&&(o=e.callbacks,o!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?o:a.concat(o))));break;case 26:var u=Hn;if(Zt(n,e),Wt(e),o&512&&(Ot||a===null||er(a,a.return)),o&4){var p=a!==null?a.memoizedState:null;if(o=e.memoizedState,a===null)if(o===null)if(e.stateNode===null){e:{o=e.type,a=e.memoizedProps,u=u.ownerDocument||u;t:switch(o){case"title":p=u.getElementsByTagName("title")[0],(!p||p[kt]||p[tt]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=u.createElement(o),u.head.insertBefore(p,u.querySelector("head > title"))),Lt(p,o,a),p[tt]=e,q(p),o=p;break e;case"link":var _=Fy("link","href",u).get(o+(a.href||""));if(_){for(var E=0;E<_.length;E++)if(p=_[E],p.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&p.getAttribute("rel")===(a.rel==null?null:a.rel)&&p.getAttribute("title")===(a.title==null?null:a.title)&&p.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){_.splice(E,1);break t}}p=u.createElement(o),Lt(p,o,a),u.head.appendChild(p);break;case"meta":if(_=Fy("meta","content",u).get(o+(a.content||""))){for(E=0;E<_.length;E++)if(p=_[E],p.getAttribute("content")===(a.content==null?null:""+a.content)&&p.getAttribute("name")===(a.name==null?null:a.name)&&p.getAttribute("property")===(a.property==null?null:a.property)&&p.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&p.getAttribute("charset")===(a.charSet==null?null:a.charSet)){_.splice(E,1);break t}}p=u.createElement(o),Lt(p,o,a),u.head.appendChild(p);break;default:throw Error(i(468,o))}p[tt]=e,q(p),o=p}e.stateNode=o}else Gy(u,e.type,e.stateNode);else e.stateNode=Hy(u,o,e.memoizedProps);else p!==o?(p===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):p.count--,o===null?Gy(u,e.type,e.stateNode):Hy(u,o,e.memoizedProps)):o===null&&e.stateNode!==null&&Zf(e,e.memoizedProps,a.memoizedProps)}break;case 27:Zt(n,e),Wt(e),o&512&&(Ot||a===null||er(a,a.return)),a!==null&&o&4&&Zf(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Zt(n,e),Wt(e),o&512&&(Ot||a===null||er(a,a.return)),e.flags&32){u=e.stateNode;try{ri(u,"")}catch(ye){Ke(e,e.return,ye)}}o&4&&e.stateNode!=null&&(u=e.memoizedProps,Zf(e,u,a!==null?a.memoizedProps:u)),o&1024&&(th=!0);break;case 6:if(Zt(n,e),Wt(e),o&4){if(e.stateNode===null)throw Error(i(162));o=e.memoizedProps,a=e.stateNode;try{a.nodeValue=o}catch(ye){Ke(e,e.return,ye)}}break;case 3:if(Ul=null,u=Hn,Hn=Ll(n.containerInfo),Zt(n,e),Hn=u,Wt(e),o&4&&a!==null&&a.memoizedState.isDehydrated)try{Di(n.containerInfo)}catch(ye){Ke(e,e.return,ye)}th&&(th=!1,Gp(e));break;case 4:o=Hn,Hn=Ll(e.stateNode.containerInfo),Zt(n,e),Wt(e),Hn=o;break;case 12:Zt(n,e),Wt(e);break;case 31:Zt(n,e),Wt(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,wl(e,o)));break;case 13:Zt(n,e),Wt(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(El=lt()),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,wl(e,o)));break;case 22:u=e.memoizedState!==null;var R=a!==null&&a.memoizedState!==null,F=vr,Q=Ot;if(vr=F||u,Ot=Q||R,Zt(n,e),Ot=Q,vr=F,Wt(e),o&8192)e:for(n=e.stateNode,n._visibility=u?n._visibility&-2:n._visibility|1,u&&(a===null||R||vr||Ot||Is(e)),a=null,n=e;;){if(n.tag===5||n.tag===26){if(a===null){R=a=n;try{if(p=R.stateNode,u)_=p.style,typeof _.setProperty=="function"?_.setProperty("display","none","important"):_.display="none";else{E=R.stateNode;var re=R.memoizedProps.style,G=re!=null&&re.hasOwnProperty("display")?re.display:null;E.style.display=G==null||typeof G=="boolean"?"":(""+G).trim()}}catch(ye){Ke(R,R.return,ye)}}}else if(n.tag===6){if(a===null){R=n;try{R.stateNode.nodeValue=u?"":R.memoizedProps}catch(ye){Ke(R,R.return,ye)}}}else if(n.tag===18){if(a===null){R=n;try{var K=R.stateNode;u?Dy(K,!0):Dy(R.stateNode,!1)}catch(ye){Ke(R,R.return,ye)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===e)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;a===n&&(a=null),n=n.return}a===n&&(a=null),n.sibling.return=n.return,n=n.sibling}o&4&&(o=e.updateQueue,o!==null&&(a=o.retryQueue,a!==null&&(o.retryQueue=null,wl(e,a))));break;case 19:Zt(n,e),Wt(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,wl(e,o)));break;case 30:break;case 21:break;default:Zt(n,e),Wt(e)}}function Wt(e){var n=e.flags;if(n&2){try{for(var a,o=e.return;o!==null;){if(Lp(o)){a=o;break}o=o.return}if(a==null)throw Error(i(160));switch(a.tag){case 27:var u=a.stateNode,p=Wf(e);_l(e,p,u);break;case 5:var _=a.stateNode;a.flags&32&&(ri(_,""),a.flags&=-33);var E=Wf(e);_l(e,E,_);break;case 3:case 4:var R=a.stateNode.containerInfo,F=Wf(e);eh(e,F,R);break;default:throw Error(i(161))}}catch(Q){Ke(e,e.return,Q)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Gp(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;Gp(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function wr(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Pp(e,n.alternate,n),n=n.sibling}function Is(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:Qr(4,n,n.return),Is(n);break;case 1:er(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&Dp(n,n.return,a),Is(n);break;case 27:Ha(n.stateNode);case 26:case 5:er(n,n.return),Is(n);break;case 22:n.memoizedState===null&&Is(n);break;case 30:Is(n);break;default:Is(n)}e=e.sibling}}function Sr(e,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var o=n.alternate,u=e,p=n,_=p.flags;switch(p.tag){case 0:case 11:case 15:Sr(u,p,a),Ra(4,p);break;case 1:if(Sr(u,p,a),o=p,u=o.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(F){Ke(o,o.return,F)}if(o=p,u=o.updateQueue,u!==null){var E=o.stateNode;try{var R=u.shared.hiddenCallbacks;if(R!==null)for(u.shared.hiddenCallbacks=null,u=0;u<R.length;u++)w0(R[u],E)}catch(F){Ke(o,o.return,F)}}a&&_&64&&Rp(p),Da(p,p.return);break;case 27:Bp(p);case 26:case 5:Sr(u,p,a),a&&o===null&&_&4&&qp(p),Da(p,p.return);break;case 12:Sr(u,p,a);break;case 31:Sr(u,p,a),a&&_&4&&$p(u,p);break;case 13:Sr(u,p,a),a&&_&4&&Hp(u,p);break;case 22:p.memoizedState===null&&Sr(u,p,a),Da(p,p.return);break;case 30:break;default:Sr(u,p,a)}n=n.sibling}}function nh(e,n){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&va(a))}function rh(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&va(e))}function Fn(e,n,a,o){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Vp(e,n,a,o),n=n.sibling}function Vp(e,n,a,o){var u=n.flags;switch(n.tag){case 0:case 11:case 15:Fn(e,n,a,o),u&2048&&Ra(9,n);break;case 1:Fn(e,n,a,o);break;case 3:Fn(e,n,a,o),u&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&va(e)));break;case 12:if(u&2048){Fn(e,n,a,o),e=n.stateNode;try{var p=n.memoizedProps,_=p.id,E=p.onPostCommit;typeof E=="function"&&E(_,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(R){Ke(n,n.return,R)}}else Fn(e,n,a,o);break;case 31:Fn(e,n,a,o);break;case 13:Fn(e,n,a,o);break;case 23:break;case 22:p=n.stateNode,_=n.alternate,n.memoizedState!==null?p._visibility&2?Fn(e,n,a,o):qa(e,n):p._visibility&2?Fn(e,n,a,o):(p._visibility|=2,Si(e,n,a,o,(n.subtreeFlags&10256)!==0||!1)),u&2048&&nh(_,n);break;case 24:Fn(e,n,a,o),u&2048&&rh(n.alternate,n);break;default:Fn(e,n,a,o)}}function Si(e,n,a,o,u){for(u=u&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var p=e,_=n,E=a,R=o,F=_.flags;switch(_.tag){case 0:case 11:case 15:Si(p,_,E,R,u),Ra(8,_);break;case 23:break;case 22:var Q=_.stateNode;_.memoizedState!==null?Q._visibility&2?Si(p,_,E,R,u):qa(p,_):(Q._visibility|=2,Si(p,_,E,R,u)),u&&F&2048&&nh(_.alternate,_);break;case 24:Si(p,_,E,R,u),u&&F&2048&&rh(_.alternate,_);break;default:Si(p,_,E,R,u)}n=n.sibling}}function qa(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=e,o=n,u=o.flags;switch(o.tag){case 22:qa(a,o),u&2048&&nh(o.alternate,o);break;case 24:qa(a,o),u&2048&&rh(o.alternate,o);break;default:qa(a,o)}n=n.sibling}}var La=8192;function Ei(e,n,a){if(e.subtreeFlags&La)for(e=e.child;e!==null;)Yp(e,n,a),e=e.sibling}function Yp(e,n,a){switch(e.tag){case 26:Ei(e,n,a),e.flags&La&&e.memoizedState!==null&&vw(a,Hn,e.memoizedState,e.memoizedProps);break;case 5:Ei(e,n,a);break;case 3:case 4:var o=Hn;Hn=Ll(e.stateNode.containerInfo),Ei(e,n,a),Hn=o;break;case 22:e.memoizedState===null&&(o=e.alternate,o!==null&&o.memoizedState!==null?(o=La,La=16777216,Ei(e,n,a),La=o):Ei(e,n,a));break;default:Ei(e,n,a)}}function Kp(e){var n=e.alternate;if(n!==null&&(e=n.child,e!==null)){n.child=null;do n=e.sibling,e.sibling=null,e=n;while(e!==null)}}function Ba(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var o=n[a];Tt=o,Xp(o,e)}Kp(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Jp(e),e=e.sibling}function Jp(e){switch(e.tag){case 0:case 11:case 15:Ba(e),e.flags&2048&&Qr(9,e,e.return);break;case 3:Ba(e);break;case 12:Ba(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,Sl(e)):Ba(e);break;default:Ba(e)}}function Sl(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var o=n[a];Tt=o,Xp(o,e)}Kp(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:Qr(8,n,n.return),Sl(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,Sl(n));break;default:Sl(n)}e=e.sibling}}function Xp(e,n){for(;Tt!==null;){var a=Tt;switch(a.tag){case 0:case 11:case 15:Qr(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var o=a.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:va(a.memoizedState.cache)}if(o=a.child,o!==null)o.return=a,Tt=o;else e:for(a=e;Tt!==null;){o=Tt;var u=o.sibling,p=o.return;if(zp(o),o===a){Tt=null;break e}if(u!==null){u.return=p,Tt=u;break e}Tt=p}}}var q_={getCacheForType:function(e){var n=Dt(wt),a=n.data.get(e);return a===void 0&&(a=e(),n.data.set(e,a)),a},cacheSignal:function(){return Dt(wt).controller.signal}},L_=typeof WeakMap=="function"?WeakMap:Map,Ge=0,nt=null,qe=null,Be=0,Ye=0,un=null,Zr=!1,Oi=!1,sh=!1,Er=0,mt=0,Wr=0,$s=0,ih=0,fn=0,Ai=0,Ua=null,en=null,ah=!1,El=0,Qp=0,Ol=1/0,Al=null,es=null,Nt=0,ts=null,ji=null,Or=0,oh=0,lh=null,Zp=null,Pa=0,ch=null;function hn(){return(Ge&2)!==0&&Be!==0?Be&-Be:Y.T!==null?ph():oa()}function Wp(){if(fn===0)if((Be&536870912)===0||Pe){var e=or;or<<=1,(or&3932160)===0&&(or=262144),fn=e}else fn=536870912;return e=ln.current,e!==null&&(e.flags|=32),fn}function tn(e,n,a){(e===nt&&(Ye===2||Ye===9)||e.cancelPendingCommit!==null)&&(ki(e,0),ns(e,Be,fn,!1)),zn(e,a),((Ge&2)===0||e!==nt)&&(e===nt&&((Ge&2)===0&&($s|=a),mt===4&&ns(e,Be,fn,!1)),tr(e))}function ey(e,n,a){if((Ge&6)!==0)throw Error(i(327));var o=!a&&(n&127)===0&&(n&e.expiredLanes)===0||Ss(e,n),u=o?P_(e,n):fh(e,n,!0),p=o;do{if(u===0){Oi&&!o&&ns(e,n,0,!1);break}else{if(a=e.current.alternate,p&&!B_(a)){u=fh(e,n,!1),p=!1;continue}if(u===2){if(p=n,e.errorRecoveryDisabledLanes&p)var _=0;else _=e.pendingLanes&-536870913,_=_!==0?_:_&536870912?536870912:0;if(_!==0){n=_;e:{var E=e;u=Ua;var R=E.current.memoizedState.isDehydrated;if(R&&(ki(E,_).flags|=256),_=fh(E,_,!1),_!==2){if(sh&&!R){E.errorRecoveryDisabledLanes|=p,$s|=p,u=4;break e}p=en,en=u,p!==null&&(en===null?en=p:en.push.apply(en,p))}u=_}if(p=!1,u!==2)continue}}if(u===1){ki(e,0),ns(e,n,0,!0);break}e:{switch(o=e,p=u,p){case 0:case 1:throw Error(i(345));case 4:if((n&4194048)!==n)break;case 6:ns(o,n,fn,!Zr);break e;case 2:en=null;break;case 3:case 5:break;default:throw Error(i(329))}if((n&62914560)===n&&(u=El+300-lt(),10<u)){if(ns(o,n,fn,!Zr),ws(o,0,!0)!==0)break e;Or=n,o.timeoutHandle=Cy(ty.bind(null,o,a,en,Al,ah,n,fn,$s,Ai,Zr,p,"Throttled",-0,0),u);break e}ty(o,a,en,Al,ah,n,fn,$s,Ai,Zr,p,null,-0,0)}}break}while(!0);tr(e)}function ty(e,n,a,o,u,p,_,E,R,F,Q,re,G,K){if(e.timeoutHandle=-1,re=n.subtreeFlags,re&8192||(re&16785408)===16785408){re={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ur},Yp(n,p,re);var ye=(p&62914560)===p?El-lt():(p&4194048)===p?Qp-lt():0;if(ye=_w(re,ye),ye!==null){Or=p,e.cancelPendingCommit=ye(cy.bind(null,e,n,p,a,o,u,_,E,R,Q,re,null,G,K)),ns(e,p,_,!F);return}}cy(e,n,p,a,o,u,_,E,R)}function B_(e){for(var n=e;;){var a=n.tag;if((a===0||a===11||a===15)&&n.flags&16384&&(a=n.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var o=0;o<a.length;o++){var u=a[o],p=u.getSnapshot;u=u.value;try{if(!an(p(),u))return!1}catch{return!1}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function ns(e,n,a,o){n&=~ih,n&=~$s,e.suspendedLanes|=n,e.pingedLanes&=~n,o&&(e.warmLanes|=n),o=e.expirationTimes;for(var u=n;0<u;){var p=31-Pt(u),_=1<<p;o[p]=-1,u&=~_}a!==0&&Pr(e,a,n)}function jl(){return(Ge&6)===0?(za(0),!1):!0}function uh(){if(qe!==null){if(Ye===0)var e=qe.return;else e=qe,mr=Rs=null,Af(e),bi=null,wa=0,e=qe;for(;e!==null;)Mp(e.alternate,e),e=e.return;qe=null}}function ki(e,n){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,rw(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),Or=0,uh(),nt=e,qe=a=hr(e.current,null),Be=n,Ye=0,un=null,Zr=!1,Oi=Ss(e,n),sh=!1,Ai=fn=ih=$s=Wr=mt=0,en=Ua=null,ah=!1,(n&8)!==0&&(n|=n&32);var o=e.entangledLanes;if(o!==0)for(e=e.entanglements,o&=n;0<o;){var u=31-Pt(o),p=1<<u;n|=e[u],o&=~p}return Er=n,Ko(),a}function ny(e,n){Ce=null,Y.H=Ta,n===gi||n===nl?(n=b0(),Ye=3):n===mf?(n=b0(),Ye=4):Ye=n===$f?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,un=n,qe===null&&(mt=1,yl(e,kn(n,e.current)))}function ry(){var e=ln.current;return e===null?!0:(Be&4194048)===Be?Mn===null:(Be&62914560)===Be||(Be&536870912)!==0?e===Mn:!1}function sy(){var e=Y.H;return Y.H=Ta,e===null?Ta:e}function iy(){var e=Y.A;return Y.A=q_,e}function kl(){mt=4,Zr||(Be&4194048)!==Be&&ln.current!==null||(Oi=!0),(Wr&134217727)===0&&($s&134217727)===0||nt===null||ns(nt,Be,fn,!1)}function fh(e,n,a){var o=Ge;Ge|=2;var u=sy(),p=iy();(nt!==e||Be!==n)&&(Al=null,ki(e,n)),n=!1;var _=mt;e:do try{if(Ye!==0&&qe!==null){var E=qe,R=un;switch(Ye){case 8:uh(),_=6;break e;case 3:case 2:case 9:case 6:ln.current===null&&(n=!0);var F=Ye;if(Ye=0,un=null,Ni(e,E,R,F),a&&Oi){_=0;break e}break;default:F=Ye,Ye=0,un=null,Ni(e,E,R,F)}}U_(),_=mt;break}catch(Q){ny(e,Q)}while(!0);return n&&e.shellSuspendCounter++,mr=Rs=null,Ge=o,Y.H=u,Y.A=p,qe===null&&(nt=null,Be=0,Ko()),_}function U_(){for(;qe!==null;)ay(qe)}function P_(e,n){var a=Ge;Ge|=2;var o=sy(),u=iy();nt!==e||Be!==n?(Al=null,Ol=lt()+500,ki(e,n)):Oi=Ss(e,n);e:do try{if(Ye!==0&&qe!==null){n=qe;var p=un;t:switch(Ye){case 1:Ye=0,un=null,Ni(e,n,p,1);break;case 2:case 9:if(y0(p)){Ye=0,un=null,oy(n);break}n=function(){Ye!==2&&Ye!==9||nt!==e||(Ye=7),tr(e)},p.then(n,n);break e;case 3:Ye=7;break e;case 4:Ye=5;break e;case 7:y0(p)?(Ye=0,un=null,oy(n)):(Ye=0,un=null,Ni(e,n,p,7));break;case 5:var _=null;switch(qe.tag){case 26:_=qe.memoizedState;case 5:case 27:var E=qe;if(_?Vy(_):E.stateNode.complete){Ye=0,un=null;var R=E.sibling;if(R!==null)qe=R;else{var F=E.return;F!==null?(qe=F,Nl(F)):qe=null}break t}}Ye=0,un=null,Ni(e,n,p,5);break;case 6:Ye=0,un=null,Ni(e,n,p,6);break;case 8:uh(),mt=6;break e;default:throw Error(i(462))}}z_();break}catch(Q){ny(e,Q)}while(!0);return mr=Rs=null,Y.H=o,Y.A=u,Ge=a,qe!==null?0:(nt=null,Be=0,Ko(),mt)}function z_(){for(;qe!==null&&!Co();)ay(qe)}function ay(e){var n=Tp(e.alternate,e,Er);e.memoizedProps=e.pendingProps,n===null?Nl(e):qe=n}function oy(e){var n=e,a=n.alternate;switch(n.tag){case 15:case 0:n=Ep(a,n,n.pendingProps,n.type,void 0,Be);break;case 11:n=Ep(a,n,n.pendingProps,n.type.render,n.ref,Be);break;case 5:Af(n);default:Mp(a,n),n=qe=i0(n,Er),n=Tp(a,n,Er)}e.memoizedProps=e.pendingProps,n===null?Nl(e):qe=n}function Ni(e,n,a,o){mr=Rs=null,Af(n),bi=null,wa=0;var u=n.return;try{if(k_(e,u,n,a,Be)){mt=1,yl(e,kn(a,e.current)),qe=null;return}}catch(p){if(u!==null)throw qe=u,p;mt=1,yl(e,kn(a,e.current)),qe=null;return}n.flags&32768?(Pe||o===1?e=!0:Oi||(Be&536870912)!==0?e=!1:(Zr=e=!0,(o===2||o===9||o===3||o===6)&&(o=ln.current,o!==null&&o.tag===13&&(o.flags|=16384))),ly(n,e)):Nl(n)}function Nl(e){var n=e;do{if((n.flags&32768)!==0){ly(n,Zr);return}e=n.return;var a=C_(n.alternate,n,Er);if(a!==null){qe=a;return}if(n=n.sibling,n!==null){qe=n;return}qe=n=e}while(n!==null);mt===0&&(mt=5)}function ly(e,n){do{var a=M_(e.alternate,e);if(a!==null){a.flags&=32767,qe=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(e=e.sibling,e!==null)){qe=e;return}qe=e=a}while(e!==null);mt=6,qe=null}function cy(e,n,a,o,u,p,_,E,R){e.cancelPendingCommit=null;do Tl();while(Nt!==0);if((Ge&6)!==0)throw Error(i(327));if(n!==null){if(n===e.current)throw Error(i(177));if(p=n.lanes|n.childLanes,p|=Zu,Ur(e,a,p,_,E,R),e===nt&&(qe=nt=null,Be=0),ji=n,ts=e,Or=a,oh=p,lh=u,Zp=o,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,F_(Zs,function(){return my(),null})):(e.callbackNode=null,e.callbackPriority=0),o=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||o){o=Y.T,Y.T=null,u=oe.p,oe.p=2,_=Ge,Ge|=4;try{R_(e,n,a)}finally{Ge=_,oe.p=u,Y.T=o}}Nt=1,uy(),fy(),hy()}}function uy(){if(Nt===1){Nt=0;var e=ts,n=ji,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=Y.T,Y.T=null;var o=oe.p;oe.p=2;var u=Ge;Ge|=4;try{Fp(n,e);var p=Sh,_=Xm(e.containerInfo),E=p.focusedElem,R=p.selectionRange;if(_!==E&&E&&E.ownerDocument&&Jm(E.ownerDocument.documentElement,E)){if(R!==null&&Yu(E)){var F=R.start,Q=R.end;if(Q===void 0&&(Q=F),"selectionStart"in E)E.selectionStart=F,E.selectionEnd=Math.min(Q,E.value.length);else{var re=E.ownerDocument||document,G=re&&re.defaultView||window;if(G.getSelection){var K=G.getSelection(),ye=E.textContent.length,Ee=Math.min(R.start,ye),Ze=R.end===void 0?Ee:Math.min(R.end,ye);!K.extend&&Ee>Ze&&(_=Ze,Ze=Ee,Ee=_);var P=Km(E,Ee),B=Km(E,Ze);if(P&&B&&(K.rangeCount!==1||K.anchorNode!==P.node||K.anchorOffset!==P.offset||K.focusNode!==B.node||K.focusOffset!==B.offset)){var H=re.createRange();H.setStart(P.node,P.offset),K.removeAllRanges(),Ee>Ze?(K.addRange(H),K.extend(B.node,B.offset)):(H.setEnd(B.node,B.offset),K.addRange(H))}}}}for(re=[],K=E;K=K.parentNode;)K.nodeType===1&&re.push({element:K,left:K.scrollLeft,top:K.scrollTop});for(typeof E.focus=="function"&&E.focus(),E=0;E<re.length;E++){var W=re[E];W.element.scrollLeft=W.left,W.element.scrollTop=W.top}}$l=!!wh,Sh=wh=null}finally{Ge=u,oe.p=o,Y.T=a}}e.current=n,Nt=2}}function fy(){if(Nt===2){Nt=0;var e=ts,n=ji,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=Y.T,Y.T=null;var o=oe.p;oe.p=2;var u=Ge;Ge|=4;try{Pp(e,n.alternate,n)}finally{Ge=u,oe.p=o,Y.T=a}}Nt=3}}function hy(){if(Nt===4||Nt===3){Nt=0,Qs();var e=ts,n=ji,a=Or,o=Zp;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Nt=5:(Nt=0,ji=ts=null,dy(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(es=null),Os(a),n=n.stateNode,gt&&typeof gt.onCommitFiberRoot=="function")try{gt.onCommitFiberRoot(_s,n,void 0,(n.current.flags&128)===128)}catch{}if(o!==null){n=Y.T,u=oe.p,oe.p=2,Y.T=null;try{for(var p=e.onRecoverableError,_=0;_<o.length;_++){var E=o[_];p(E.value,{componentStack:E.stack})}}finally{Y.T=n,oe.p=u}}(Or&3)!==0&&Tl(),tr(e),u=e.pendingLanes,(a&261930)!==0&&(u&42)!==0?e===ch?Pa++:(Pa=0,ch=e):Pa=0,za(0)}}function dy(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,va(n)))}function Tl(){return uy(),fy(),hy(),my()}function my(){if(Nt!==5)return!1;var e=ts,n=oh;oh=0;var a=Os(Or),o=Y.T,u=oe.p;try{oe.p=32>a?32:a,Y.T=null,a=lh,lh=null;var p=ts,_=Or;if(Nt=0,ji=ts=null,Or=0,(Ge&6)!==0)throw Error(i(331));var E=Ge;if(Ge|=4,Jp(p.current),Vp(p,p.current,_,a),Ge=E,za(0,!1),gt&&typeof gt.onPostCommitFiberRoot=="function")try{gt.onPostCommitFiberRoot(_s,p)}catch{}return!0}finally{oe.p=u,Y.T=o,dy(e,n)}}function py(e,n,a){n=kn(a,n),n=If(e.stateNode,n,2),e=Kr(e,n,2),e!==null&&(zn(e,2),tr(e))}function Ke(e,n,a){if(e.tag===3)py(e,e,a);else for(;n!==null;){if(n.tag===3){py(n,e,a);break}else if(n.tag===1){var o=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(es===null||!es.has(o))){e=kn(a,e),a=yp(2),o=Kr(n,a,2),o!==null&&(gp(a,o,n,e),zn(o,2),tr(o));break}}n=n.return}}function hh(e,n,a){var o=e.pingCache;if(o===null){o=e.pingCache=new L_;var u=new Set;o.set(n,u)}else u=o.get(n),u===void 0&&(u=new Set,o.set(n,u));u.has(a)||(sh=!0,u.add(a),e=I_.bind(null,e,n,a),n.then(e,e))}function I_(e,n,a){var o=e.pingCache;o!==null&&o.delete(n),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,nt===e&&(Be&a)===a&&(mt===4||mt===3&&(Be&62914560)===Be&&300>lt()-El?(Ge&2)===0&&ki(e,0):ih|=a,Ai===Be&&(Ai=0)),tr(e)}function yy(e,n){n===0&&(n=ei()),e=Ts(e,n),e!==null&&(zn(e,n),tr(e))}function $_(e){var n=e.memoizedState,a=0;n!==null&&(a=n.retryLane),yy(e,a)}function H_(e,n){var a=0;switch(e.tag){case 31:case 13:var o=e.stateNode,u=e.memoizedState;u!==null&&(a=u.retryLane);break;case 19:o=e.stateNode;break;case 22:o=e.stateNode._retryCache;break;default:throw Error(i(314))}o!==null&&o.delete(n),yy(e,a)}function F_(e,n){return ra(e,n)}var Cl=null,Ti=null,dh=!1,Ml=!1,mh=!1,rs=0;function tr(e){e!==Ti&&e.next===null&&(Ti===null?Cl=Ti=e:Ti=Ti.next=e),Ml=!0,dh||(dh=!0,V_())}function za(e,n){if(!mh&&Ml){mh=!0;do for(var a=!1,o=Cl;o!==null;){if(e!==0){var u=o.pendingLanes;if(u===0)var p=0;else{var _=o.suspendedLanes,E=o.pingedLanes;p=(1<<31-Pt(42|e)+1)-1,p&=u&~(_&~E),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(a=!0,vy(o,p))}else p=Be,p=ws(o,o===nt?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(p&3)===0||Ss(o,p)||(a=!0,vy(o,p));o=o.next}while(a);mh=!1}}function G_(){gy()}function gy(){Ml=dh=!1;var e=0;rs!==0&&nw()&&(e=rs);for(var n=lt(),a=null,o=Cl;o!==null;){var u=o.next,p=by(o,n);p===0?(o.next=null,a===null?Cl=u:a.next=u,u===null&&(Ti=a)):(a=o,(e!==0||(p&3)!==0)&&(Ml=!0)),o=u}Nt!==0&&Nt!==5||za(e),rs!==0&&(rs=0)}function by(e,n){for(var a=e.suspendedLanes,o=e.pingedLanes,u=e.expirationTimes,p=e.pendingLanes&-62914561;0<p;){var _=31-Pt(p),E=1<<_,R=u[_];R===-1?((E&a)===0||(E&o)!==0)&&(u[_]=aa(E,n)):R<=n&&(e.expiredLanes|=E),p&=~E}if(n=nt,a=Be,a=ws(e,e===n?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o=e.callbackNode,a===0||e===n&&(Ye===2||Ye===9)||e.cancelPendingCommit!==null)return o!==null&&o!==null&&ar(o),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||Ss(e,a)){if(n=a&-a,n===e.callbackPriority)return n;switch(o!==null&&ar(o),Os(a)){case 2:case 8:a=Ro;break;case 32:a=Zs;break;case 268435456:a=Do;break;default:a=Zs}return o=xy.bind(null,e),a=ra(a,o),e.callbackPriority=n,e.callbackNode=a,n}return o!==null&&o!==null&&ar(o),e.callbackPriority=2,e.callbackNode=null,2}function xy(e,n){if(Nt!==0&&Nt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Tl()&&e.callbackNode!==a)return null;var o=Be;return o=ws(e,e===nt?o:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o===0?null:(ey(e,o,n),by(e,lt()),e.callbackNode!=null&&e.callbackNode===a?xy.bind(null,e):null)}function vy(e,n){if(Tl())return null;ey(e,n,!0)}function V_(){sw(function(){(Ge&6)!==0?ra(Mo,G_):gy()})}function ph(){if(rs===0){var e=pi;e===0&&(e=qr,qr<<=1,(qr&261888)===0&&(qr=256)),rs=e}return rs}function _y(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:zo(""+e)}function wy(e,n){var a=n.ownerDocument.createElement("input");return a.name=n.name,a.value=n.value,e.id&&a.setAttribute("form",e.id),n.parentNode.insertBefore(a,n),e=new FormData(e),a.parentNode.removeChild(a),e}function Y_(e,n,a,o,u){if(n==="submit"&&a&&a.stateNode===u){var p=_y((u[ht]||null).action),_=o.submitter;_&&(n=(n=_[ht]||null)?_y(n.formAction):_.getAttribute("formAction"),n!==null&&(p=n,_=null));var E=new Fo("action","action",null,o,u);e.push({event:E,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(rs!==0){var R=_?wy(u,_):new FormData(u);qf(a,{pending:!0,data:R,method:u.method,action:p},null,R)}}else typeof p=="function"&&(E.preventDefault(),R=_?wy(u,_):new FormData(u),qf(a,{pending:!0,data:R,method:u.method,action:p},p,R))},currentTarget:u}]})}}for(var yh=0;yh<Qu.length;yh++){var gh=Qu[yh],K_=gh.toLowerCase(),J_=gh[0].toUpperCase()+gh.slice(1);$n(K_,"on"+J_)}$n(Wm,"onAnimationEnd"),$n(e0,"onAnimationIteration"),$n(t0,"onAnimationStart"),$n("dblclick","onDoubleClick"),$n("focusin","onFocus"),$n("focusout","onBlur"),$n(f_,"onTransitionRun"),$n(h_,"onTransitionStart"),$n(d_,"onTransitionCancel"),$n(n0,"onTransitionEnd"),V("onMouseEnter",["mouseout","mouseover"]),V("onMouseLeave",["mouseout","mouseover"]),V("onPointerEnter",["pointerout","pointerover"]),V("onPointerLeave",["pointerout","pointerover"]),ie("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ie("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ie("onBeforeInput",["compositionend","keypress","textInput","paste"]),ie("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ie("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ie("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ia="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(" "),X_=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ia));function Sy(e,n){n=(n&4)!==0;for(var a=0;a<e.length;a++){var o=e[a],u=o.event;o=o.listeners;e:{var p=void 0;if(n)for(var _=o.length-1;0<=_;_--){var E=o[_],R=E.instance,F=E.currentTarget;if(E=E.listener,R!==p&&u.isPropagationStopped())break e;p=E,u.currentTarget=F;try{p(u)}catch(Q){Yo(Q)}u.currentTarget=null,p=R}else for(_=0;_<o.length;_++){if(E=o[_],R=E.instance,F=E.currentTarget,E=E.listener,R!==p&&u.isPropagationStopped())break e;p=E,u.currentTarget=F;try{p(u)}catch(Q){Yo(Q)}u.currentTarget=null,p=R}}}}function Le(e,n){var a=n[As];a===void 0&&(a=n[As]=new Set);var o=e+"__bubble";a.has(o)||(Ey(n,e,2,!1),a.add(o))}function bh(e,n,a){var o=0;n&&(o|=4),Ey(a,e,o,n)}var Rl="_reactListening"+Math.random().toString(36).slice(2);function xh(e){if(!e[Rl]){e[Rl]=!0,I.forEach(function(a){a!=="selectionchange"&&(X_.has(a)||bh(a,!1,e),bh(a,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[Rl]||(n[Rl]=!0,bh("selectionchange",!1,n))}}function Ey(e,n,a,o){switch(Wy(n)){case 2:var u=Ew;break;case 8:u=Ow;break;default:u=Dh}a=u.bind(null,n,a,e),u=void 0,!Uu||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(u=!0),o?u!==void 0?e.addEventListener(n,a,{capture:!0,passive:u}):e.addEventListener(n,a,!0):u!==void 0?e.addEventListener(n,a,{passive:u}):e.addEventListener(n,a,!1)}function vh(e,n,a,o,u){var p=o;if((n&1)===0&&(n&2)===0&&o!==null)e:for(;;){if(o===null)return;var _=o.tag;if(_===3||_===4){var E=o.stateNode.containerInfo;if(E===u)break;if(_===4)for(_=o.return;_!==null;){var R=_.tag;if((R===3||R===4)&&_.stateNode.containerInfo===u)return;_=_.return}for(;E!==null;){if(_=O(E),_===null)return;if(R=_.tag,R===5||R===6||R===26||R===27){o=p=_;continue e}E=E.parentNode}}o=o.return}Nm(function(){var F=p,Q=Lu(a),re=[];e:{var G=r0.get(e);if(G!==void 0){var K=Fo,ye=e;switch(e){case"keypress":if($o(a)===0)break e;case"keydown":case"keyup":K=Hv;break;case"focusin":ye="focus",K=$u;break;case"focusout":ye="blur",K=$u;break;case"beforeblur":case"afterblur":K=$u;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":K=Mm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":K=Cv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":K=Vv;break;case Wm:case e0:case t0:K=Dv;break;case n0:K=Kv;break;case"scroll":case"scrollend":K=Nv;break;case"wheel":K=Xv;break;case"copy":case"cut":case"paste":K=Lv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":K=Dm;break;case"toggle":case"beforetoggle":K=Zv}var Ee=(n&4)!==0,Ze=!Ee&&(e==="scroll"||e==="scrollend"),P=Ee?G!==null?G+"Capture":null:G;Ee=[];for(var B=F,H;B!==null;){var W=B;if(H=W.stateNode,W=W.tag,W!==5&&W!==26&&W!==27||H===null||P===null||(W=ca(B,P),W!=null&&Ee.push($a(B,W,H))),Ze)break;B=B.return}0<Ee.length&&(G=new K(G,ye,null,a,Q),re.push({event:G,listeners:Ee}))}}if((n&7)===0){e:{if(G=e==="mouseover"||e==="pointerover",K=e==="mouseout"||e==="pointerout",G&&a!==qu&&(ye=a.relatedTarget||a.fromElement)&&(O(ye)||ye[sn]))break e;if((K||G)&&(G=Q.window===Q?Q:(G=Q.ownerDocument)?G.defaultView||G.parentWindow:window,K?(ye=a.relatedTarget||a.toElement,K=F,ye=ye?O(ye):null,ye!==null&&(Ze=c(ye),Ee=ye.tag,ye!==Ze||Ee!==5&&Ee!==27&&Ee!==6)&&(ye=null)):(K=null,ye=F),K!==ye)){if(Ee=Mm,W="onMouseLeave",P="onMouseEnter",B="mouse",(e==="pointerout"||e==="pointerover")&&(Ee=Dm,W="onPointerLeave",P="onPointerEnter",B="pointer"),Ze=K==null?G:k(K),H=ye==null?G:k(ye),G=new Ee(W,B+"leave",K,a,Q),G.target=Ze,G.relatedTarget=H,W=null,O(Q)===F&&(Ee=new Ee(P,B+"enter",ye,a,Q),Ee.target=H,Ee.relatedTarget=Ze,W=Ee),Ze=W,K&&ye)t:{for(Ee=Q_,P=K,B=ye,H=0,W=P;W;W=Ee(W))H++;W=0;for(var we=B;we;we=Ee(we))W++;for(;0<H-W;)P=Ee(P),H--;for(;0<W-H;)B=Ee(B),W--;for(;H--;){if(P===B||B!==null&&P===B.alternate){Ee=P;break t}P=Ee(P),B=Ee(B)}Ee=null}else Ee=null;K!==null&&Oy(re,G,K,Ee,!1),ye!==null&&Ze!==null&&Oy(re,Ze,ye,Ee,!0)}}e:{if(G=F?k(F):window,K=G.nodeName&&G.nodeName.toLowerCase(),K==="select"||K==="input"&&G.type==="file")var He=$m;else if(zm(G))if(Hm)He=l_;else{He=a_;var ge=i_}else K=G.nodeName,!K||K.toLowerCase()!=="input"||G.type!=="checkbox"&&G.type!=="radio"?F&&Du(F.elementType)&&(He=$m):He=o_;if(He&&(He=He(e,F))){Im(re,He,a,Q);break e}ge&&ge(e,G,F),e==="focusout"&&F&&G.type==="number"&&F.memoizedProps.value!=null&&Ru(G,"number",G.value)}switch(ge=F?k(F):window,e){case"focusin":(zm(ge)||ge.contentEditable==="true")&&(oi=ge,Ku=F,ga=null);break;case"focusout":ga=Ku=oi=null;break;case"mousedown":Ju=!0;break;case"contextmenu":case"mouseup":case"dragend":Ju=!1,Qm(re,a,Q);break;case"selectionchange":if(u_)break;case"keydown":case"keyup":Qm(re,a,Q)}var Me;if(Fu)e:{switch(e){case"compositionstart":var Ue="onCompositionStart";break e;case"compositionend":Ue="onCompositionEnd";break e;case"compositionupdate":Ue="onCompositionUpdate";break e}Ue=void 0}else ai?Um(e,a)&&(Ue="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Ue="onCompositionStart");Ue&&(qm&&a.locale!=="ko"&&(ai||Ue!=="onCompositionStart"?Ue==="onCompositionEnd"&&ai&&(Me=Tm()):(Ir=Q,Pu="value"in Ir?Ir.value:Ir.textContent,ai=!0)),ge=Dl(F,Ue),0<ge.length&&(Ue=new Rm(Ue,e,null,a,Q),re.push({event:Ue,listeners:ge}),Me?Ue.data=Me:(Me=Pm(a),Me!==null&&(Ue.data=Me)))),(Me=e_?t_(e,a):n_(e,a))&&(Ue=Dl(F,"onBeforeInput"),0<Ue.length&&(ge=new Rm("onBeforeInput","beforeinput",null,a,Q),re.push({event:ge,listeners:Ue}),ge.data=Me)),Y_(re,e,F,a,Q)}Sy(re,n)})}function $a(e,n,a){return{instance:e,listener:n,currentTarget:a}}function Dl(e,n){for(var a=n+"Capture",o=[];e!==null;){var u=e,p=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||p===null||(u=ca(e,a),u!=null&&o.unshift($a(e,u,p)),u=ca(e,n),u!=null&&o.push($a(e,u,p))),e.tag===3)return o;e=e.return}return[]}function Q_(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Oy(e,n,a,o,u){for(var p=n._reactName,_=[];a!==null&&a!==o;){var E=a,R=E.alternate,F=E.stateNode;if(E=E.tag,R!==null&&R===o)break;E!==5&&E!==26&&E!==27||F===null||(R=F,u?(F=ca(a,p),F!=null&&_.unshift($a(a,F,R))):u||(F=ca(a,p),F!=null&&_.push($a(a,F,R)))),a=a.return}_.length!==0&&e.push({event:n,listeners:_})}var Z_=/\r\n?/g,W_=/\u0000|\uFFFD/g;function Ay(e){return(typeof e=="string"?e:""+e).replace(Z_,`
|
|
26
|
+
`).replace(W_,"")}function jy(e,n){return n=Ay(n),Ay(e)===n}function Qe(e,n,a,o,u,p){switch(a){case"children":typeof o=="string"?n==="body"||n==="textarea"&&o===""||ri(e,o):(typeof o=="number"||typeof o=="bigint")&&n!=="body"&&ri(e,""+o);break;case"className":In(e,"class",o);break;case"tabIndex":In(e,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":In(e,a,o);break;case"style":jm(e,o,p);break;case"data":if(n!=="object"){In(e,"data",o);break}case"src":case"href":if(o===""&&(n!=="a"||a!=="href")){e.removeAttribute(a);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(a);break}o=zo(""+o),e.setAttribute(a,o);break;case"action":case"formAction":if(typeof o=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof p=="function"&&(a==="formAction"?(n!=="input"&&Qe(e,n,"name",u.name,u,null),Qe(e,n,"formEncType",u.formEncType,u,null),Qe(e,n,"formMethod",u.formMethod,u,null),Qe(e,n,"formTarget",u.formTarget,u,null)):(Qe(e,n,"encType",u.encType,u,null),Qe(e,n,"method",u.method,u,null),Qe(e,n,"target",u.target,u,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(a);break}o=zo(""+o),e.setAttribute(a,o);break;case"onClick":o!=null&&(e.onclick=ur);break;case"onScroll":o!=null&&Le("scroll",e);break;case"onScrollEnd":o!=null&&Le("scrollend",e);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(i(61));if(a=o.__html,a!=null){if(u.children!=null)throw Error(i(60));e.innerHTML=a}}break;case"multiple":e.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":e.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){e.removeAttribute("xlink:href");break}a=zo(""+o),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(a,""+o):e.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":o&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":o===!0?e.setAttribute(a,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(a,o):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?e.setAttribute(a,o):e.removeAttribute(a);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?e.removeAttribute(a):e.setAttribute(a,o);break;case"popover":Le("beforetoggle",e),Le("toggle",e),zt(e,"popover",o);break;case"xlinkActuate":cr(e,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":cr(e,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":cr(e,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":cr(e,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":cr(e,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":cr(e,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":cr(e,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":cr(e,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":cr(e,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":zt(e,"is",o);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=jv.get(a)||a,zt(e,a,o))}}function _h(e,n,a,o,u,p){switch(a){case"style":jm(e,o,p);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(i(61));if(a=o.__html,a!=null){if(u.children!=null)throw Error(i(60));e.innerHTML=a}}break;case"children":typeof o=="string"?ri(e,o):(typeof o=="number"||typeof o=="bigint")&&ri(e,""+o);break;case"onScroll":o!=null&&Le("scroll",e);break;case"onScrollEnd":o!=null&&Le("scrollend",e);break;case"onClick":o!=null&&(e.onclick=ur);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!te.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(u=a.endsWith("Capture"),n=a.slice(2,u?a.length-7:void 0),p=e[ht]||null,p=p!=null?p[a]:null,typeof p=="function"&&e.removeEventListener(n,p,u),typeof o=="function")){typeof p!="function"&&p!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(n,o,u);break e}a in e?e[a]=o:o===!0?e.setAttribute(a,""):zt(e,a,o)}}}function Lt(e,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Le("error",e),Le("load",e);var o=!1,u=!1,p;for(p in a)if(a.hasOwnProperty(p)){var _=a[p];if(_!=null)switch(p){case"src":o=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:Qe(e,n,p,_,a,null)}}u&&Qe(e,n,"srcSet",a.srcSet,a,null),o&&Qe(e,n,"src",a.src,a,null);return;case"input":Le("invalid",e);var E=p=_=u=null,R=null,F=null;for(o in a)if(a.hasOwnProperty(o)){var Q=a[o];if(Q!=null)switch(o){case"name":u=Q;break;case"type":_=Q;break;case"checked":R=Q;break;case"defaultChecked":F=Q;break;case"value":p=Q;break;case"defaultValue":E=Q;break;case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(i(137,n));break;default:Qe(e,n,o,Q,a,null)}}Sm(e,p,E,R,F,_,u,!1);return;case"select":Le("invalid",e),o=_=p=null;for(u in a)if(a.hasOwnProperty(u)&&(E=a[u],E!=null))switch(u){case"value":p=E;break;case"defaultValue":_=E;break;case"multiple":o=E;default:Qe(e,n,u,E,a,null)}n=p,a=_,e.multiple=!!o,n!=null?ni(e,!!o,n,!1):a!=null&&ni(e,!!o,a,!0);return;case"textarea":Le("invalid",e),p=u=o=null;for(_ in a)if(a.hasOwnProperty(_)&&(E=a[_],E!=null))switch(_){case"value":o=E;break;case"defaultValue":u=E;break;case"children":p=E;break;case"dangerouslySetInnerHTML":if(E!=null)throw Error(i(91));break;default:Qe(e,n,_,E,a,null)}Om(e,o,u,p);return;case"option":for(R in a)if(a.hasOwnProperty(R)&&(o=a[R],o!=null))switch(R){case"selected":e.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:Qe(e,n,R,o,a,null)}return;case"dialog":Le("beforetoggle",e),Le("toggle",e),Le("cancel",e),Le("close",e);break;case"iframe":case"object":Le("load",e);break;case"video":case"audio":for(o=0;o<Ia.length;o++)Le(Ia[o],e);break;case"image":Le("error",e),Le("load",e);break;case"details":Le("toggle",e);break;case"embed":case"source":case"link":Le("error",e),Le("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(F in a)if(a.hasOwnProperty(F)&&(o=a[F],o!=null))switch(F){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:Qe(e,n,F,o,a,null)}return;default:if(Du(n)){for(Q in a)a.hasOwnProperty(Q)&&(o=a[Q],o!==void 0&&_h(e,n,Q,o,a,void 0));return}}for(E in a)a.hasOwnProperty(E)&&(o=a[E],o!=null&&Qe(e,n,E,o,a,null))}function ew(e,n,a,o){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,p=null,_=null,E=null,R=null,F=null,Q=null;for(K in a){var re=a[K];if(a.hasOwnProperty(K)&&re!=null)switch(K){case"checked":break;case"value":break;case"defaultValue":R=re;default:o.hasOwnProperty(K)||Qe(e,n,K,null,o,re)}}for(var G in o){var K=o[G];if(re=a[G],o.hasOwnProperty(G)&&(K!=null||re!=null))switch(G){case"type":p=K;break;case"name":u=K;break;case"checked":F=K;break;case"defaultChecked":Q=K;break;case"value":_=K;break;case"defaultValue":E=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(i(137,n));break;default:K!==re&&Qe(e,n,G,K,o,re)}}Mu(e,_,E,R,F,Q,p,u);return;case"select":K=_=E=G=null;for(p in a)if(R=a[p],a.hasOwnProperty(p)&&R!=null)switch(p){case"value":break;case"multiple":K=R;default:o.hasOwnProperty(p)||Qe(e,n,p,null,o,R)}for(u in o)if(p=o[u],R=a[u],o.hasOwnProperty(u)&&(p!=null||R!=null))switch(u){case"value":G=p;break;case"defaultValue":E=p;break;case"multiple":_=p;default:p!==R&&Qe(e,n,u,p,o,R)}n=E,a=_,o=K,G!=null?ni(e,!!a,G,!1):!!o!=!!a&&(n!=null?ni(e,!!a,n,!0):ni(e,!!a,a?[]:"",!1));return;case"textarea":K=G=null;for(E in a)if(u=a[E],a.hasOwnProperty(E)&&u!=null&&!o.hasOwnProperty(E))switch(E){case"value":break;case"children":break;default:Qe(e,n,E,null,o,u)}for(_ in o)if(u=o[_],p=a[_],o.hasOwnProperty(_)&&(u!=null||p!=null))switch(_){case"value":G=u;break;case"defaultValue":K=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(i(91));break;default:u!==p&&Qe(e,n,_,u,o,p)}Em(e,G,K);return;case"option":for(var ye in a)if(G=a[ye],a.hasOwnProperty(ye)&&G!=null&&!o.hasOwnProperty(ye))switch(ye){case"selected":e.selected=!1;break;default:Qe(e,n,ye,null,o,G)}for(R in o)if(G=o[R],K=a[R],o.hasOwnProperty(R)&&G!==K&&(G!=null||K!=null))switch(R){case"selected":e.selected=G&&typeof G!="function"&&typeof G!="symbol";break;default:Qe(e,n,R,G,o,K)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ee in a)G=a[Ee],a.hasOwnProperty(Ee)&&G!=null&&!o.hasOwnProperty(Ee)&&Qe(e,n,Ee,null,o,G);for(F in o)if(G=o[F],K=a[F],o.hasOwnProperty(F)&&G!==K&&(G!=null||K!=null))switch(F){case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(i(137,n));break;default:Qe(e,n,F,G,o,K)}return;default:if(Du(n)){for(var Ze in a)G=a[Ze],a.hasOwnProperty(Ze)&&G!==void 0&&!o.hasOwnProperty(Ze)&&_h(e,n,Ze,void 0,o,G);for(Q in o)G=o[Q],K=a[Q],!o.hasOwnProperty(Q)||G===K||G===void 0&&K===void 0||_h(e,n,Q,G,o,K);return}}for(var P in a)G=a[P],a.hasOwnProperty(P)&&G!=null&&!o.hasOwnProperty(P)&&Qe(e,n,P,null,o,G);for(re in o)G=o[re],K=a[re],!o.hasOwnProperty(re)||G===K||G==null&&K==null||Qe(e,n,re,G,o,K)}function ky(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function tw(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,a=performance.getEntriesByType("resource"),o=0;o<a.length;o++){var u=a[o],p=u.transferSize,_=u.initiatorType,E=u.duration;if(p&&E&&ky(_)){for(_=0,E=u.responseEnd,o+=1;o<a.length;o++){var R=a[o],F=R.startTime;if(F>E)break;var Q=R.transferSize,re=R.initiatorType;Q&&ky(re)&&(R=R.responseEnd,_+=Q*(R<E?1:(E-F)/(R-F)))}if(--o,n+=8*(p+_)/(u.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var wh=null,Sh=null;function ql(e){return e.nodeType===9?e:e.ownerDocument}function Ny(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 Ty(e,n){if(e===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&n==="foreignObject"?0:e}function Eh(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var Oh=null;function nw(){var e=window.event;return e&&e.type==="popstate"?e===Oh?!1:(Oh=e,!0):(Oh=null,!1)}var Cy=typeof setTimeout=="function"?setTimeout:void 0,rw=typeof clearTimeout=="function"?clearTimeout:void 0,My=typeof Promise=="function"?Promise:void 0,sw=typeof queueMicrotask=="function"?queueMicrotask:typeof My<"u"?function(e){return My.resolve(null).then(e).catch(iw)}:Cy;function iw(e){setTimeout(function(){throw e})}function ss(e){return e==="head"}function Ry(e,n){var a=n,o=0;do{var u=a.nextSibling;if(e.removeChild(a),u&&u.nodeType===8)if(a=u.data,a==="/$"||a==="/&"){if(o===0){e.removeChild(u),Di(n);return}o--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")o++;else if(a==="html")Ha(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,Ha(a);for(var p=a.firstChild;p;){var _=p.nextSibling,E=p.nodeName;p[kt]||E==="SCRIPT"||E==="STYLE"||E==="LINK"&&p.rel.toLowerCase()==="stylesheet"||a.removeChild(p),p=_}}else a==="body"&&Ha(e.ownerDocument.body);a=u}while(a);Di(n)}function Dy(e,n){var a=e;e=0;do{var o=a.nextSibling;if(a.nodeType===1?n?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(n?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),o&&o.nodeType===8)if(a=o.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=o}while(a)}function Ah(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var a=n;switch(n=n.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":Ah(a),ti(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function aw(e,n,a,o){for(;e.nodeType===1;){var u=a;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!o&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(o){if(!e[kt])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(p=e.getAttribute("rel"),p==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(p!==u.rel||e.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||e.getAttribute("title")!==(u.title==null?null:u.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(p=e.getAttribute("src"),(p!==(u.src==null?null:u.src)||e.getAttribute("type")!==(u.type==null?null:u.type)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&p&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var p=u.name==null?null:""+u.name;if(u.type==="hidden"&&e.getAttribute("name")===p)return e}else return e;if(e=Rn(e.nextSibling),e===null)break}return null}function ow(e,n,a){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=Rn(e.nextSibling),e===null))return null;return e}function qy(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Rn(e.nextSibling),e===null))return null;return e}function jh(e){return e.data==="$?"||e.data==="$~"}function kh(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function lw(e,n){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||a.readyState!=="loading")n();else{var o=function(){n(),a.removeEventListener("DOMContentLoaded",o)};a.addEventListener("DOMContentLoaded",o),e._reactRetry=o}}function Rn(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return e}var Nh=null;function Ly(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(n===0)return Rn(e.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}e=e.nextSibling}return null}function By(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(n===0)return e;n--}else a!=="/$"&&a!=="/&"||n++}e=e.previousSibling}return null}function Uy(e,n,a){switch(n=ql(a),e){case"html":if(e=n.documentElement,!e)throw Error(i(452));return e;case"head":if(e=n.head,!e)throw Error(i(453));return e;case"body":if(e=n.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function Ha(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);ti(e)}var Dn=new Map,Py=new Set;function Ll(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ar=oe.d;oe.d={f:cw,r:uw,D:fw,C:hw,L:dw,m:mw,X:yw,S:pw,M:gw};function cw(){var e=Ar.f(),n=jl();return e||n}function uw(e){var n=N(e);n!==null&&n.tag===5&&n.type==="form"?np(n):Ar.r(e)}var Ci=typeof document>"u"?null:document;function zy(e,n,a){var o=Ci;if(o&&typeof n=="string"&&n){var u=An(n);u='link[rel="'+e+'"][href="'+u+'"]',typeof a=="string"&&(u+='[crossorigin="'+a+'"]'),Py.has(u)||(Py.add(u),e={rel:e,crossOrigin:a,href:n},o.querySelector(u)===null&&(n=o.createElement("link"),Lt(n,"link",e),q(n),o.head.appendChild(n)))}}function fw(e){Ar.D(e),zy("dns-prefetch",e,null)}function hw(e,n){Ar.C(e,n),zy("preconnect",e,n)}function dw(e,n,a){Ar.L(e,n,a);var o=Ci;if(o&&e&&n){var u='link[rel="preload"][as="'+An(n)+'"]';n==="image"&&a&&a.imageSrcSet?(u+='[imagesrcset="'+An(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(u+='[imagesizes="'+An(a.imageSizes)+'"]')):u+='[href="'+An(e)+'"]';var p=u;switch(n){case"style":p=Mi(e);break;case"script":p=Ri(e)}Dn.has(p)||(e=b({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:e,as:n},a),Dn.set(p,e),o.querySelector(u)!==null||n==="style"&&o.querySelector(Fa(p))||n==="script"&&o.querySelector(Ga(p))||(n=o.createElement("link"),Lt(n,"link",e),q(n),o.head.appendChild(n)))}}function mw(e,n){Ar.m(e,n);var a=Ci;if(a&&e){var o=n&&typeof n.as=="string"?n.as:"script",u='link[rel="modulepreload"][as="'+An(o)+'"][href="'+An(e)+'"]',p=u;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=Ri(e)}if(!Dn.has(p)&&(e=b({rel:"modulepreload",href:e},n),Dn.set(p,e),a.querySelector(u)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Ga(p)))return}o=a.createElement("link"),Lt(o,"link",e),q(o),a.head.appendChild(o)}}}function pw(e,n,a){Ar.S(e,n,a);var o=Ci;if(o&&e){var u=T(o).hoistableStyles,p=Mi(e);n=n||"default";var _=u.get(p);if(!_){var E={loading:0,preload:null};if(_=o.querySelector(Fa(p)))E.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":n},a),(a=Dn.get(p))&&Th(e,a);var R=_=o.createElement("link");q(R),Lt(R,"link",e),R._p=new Promise(function(F,Q){R.onload=F,R.onerror=Q}),R.addEventListener("load",function(){E.loading|=1}),R.addEventListener("error",function(){E.loading|=2}),E.loading|=4,Bl(_,n,o)}_={type:"stylesheet",instance:_,count:1,state:E},u.set(p,_)}}}function yw(e,n){Ar.X(e,n);var a=Ci;if(a&&e){var o=T(a).hoistableScripts,u=Ri(e),p=o.get(u);p||(p=a.querySelector(Ga(u)),p||(e=b({src:e,async:!0},n),(n=Dn.get(u))&&Ch(e,n),p=a.createElement("script"),q(p),Lt(p,"link",e),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(u,p))}}function gw(e,n){Ar.M(e,n);var a=Ci;if(a&&e){var o=T(a).hoistableScripts,u=Ri(e),p=o.get(u);p||(p=a.querySelector(Ga(u)),p||(e=b({src:e,async:!0,type:"module"},n),(n=Dn.get(u))&&Ch(e,n),p=a.createElement("script"),q(p),Lt(p,"link",e),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(u,p))}}function Iy(e,n,a,o){var u=(u=ot.current)?Ll(u):null;if(!u)throw Error(i(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=Mi(a.href),a=T(u).hoistableStyles,o=a.get(n),o||(o={type:"style",instance:null,count:0,state:null},a.set(n,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=Mi(a.href);var p=T(u).hoistableStyles,_=p.get(e);if(_||(u=u.ownerDocument||u,_={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(e,_),(p=u.querySelector(Fa(e)))&&!p._p&&(_.instance=p,_.state.loading=5),Dn.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Dn.set(e,a),p||bw(u,e,a,_.state))),n&&o===null)throw Error(i(528,""));return _}if(n&&o!==null)throw Error(i(529,""));return null;case"script":return n=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=Ri(a),a=T(u).hoistableScripts,o=a.get(n),o||(o={type:"script",instance:null,count:0,state:null},a.set(n,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Mi(e){return'href="'+An(e)+'"'}function Fa(e){return'link[rel="stylesheet"]['+e+"]"}function $y(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function bw(e,n,a,o){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?o.loading=1:(n=e.createElement("link"),o.preload=n,n.addEventListener("load",function(){return o.loading|=1}),n.addEventListener("error",function(){return o.loading|=2}),Lt(n,"link",a),q(n),e.head.appendChild(n))}function Ri(e){return'[src="'+An(e)+'"]'}function Ga(e){return"script[async]"+e}function Hy(e,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var o=e.querySelector('style[data-href~="'+An(a.href)+'"]');if(o)return n.instance=o,q(o),o;var u=b({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return o=(e.ownerDocument||e).createElement("style"),q(o),Lt(o,"style",u),Bl(o,a.precedence,e),n.instance=o;case"stylesheet":u=Mi(a.href);var p=e.querySelector(Fa(u));if(p)return n.state.loading|=4,n.instance=p,q(p),p;o=$y(a),(u=Dn.get(u))&&Th(o,u),p=(e.ownerDocument||e).createElement("link"),q(p);var _=p;return _._p=new Promise(function(E,R){_.onload=E,_.onerror=R}),Lt(p,"link",o),n.state.loading|=4,Bl(p,a.precedence,e),n.instance=p;case"script":return p=Ri(a.src),(u=e.querySelector(Ga(p)))?(n.instance=u,q(u),u):(o=a,(u=Dn.get(p))&&(o=b({},a),Ch(o,u)),e=e.ownerDocument||e,u=e.createElement("script"),q(u),Lt(u,"link",o),e.head.appendChild(u),n.instance=u);case"void":return null;default:throw Error(i(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(o=n.instance,n.state.loading|=4,Bl(o,a.precedence,e));return n.instance}function Bl(e,n,a){for(var o=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=o.length?o[o.length-1]:null,p=u,_=0;_<o.length;_++){var E=o[_];if(E.dataset.precedence===n)p=E;else if(p!==u)break}p?p.parentNode.insertBefore(e,p.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(e,n.firstChild))}function Th(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function Ch(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var Ul=null;function Fy(e,n,a){if(Ul===null){var o=new Map,u=Ul=new Map;u.set(a,o)}else u=Ul,o=u.get(a),o||(o=new Map,u.set(a,o));if(o.has(e))return o;for(o.set(e,null),a=a.getElementsByTagName(e),u=0;u<a.length;u++){var p=a[u];if(!(p[kt]||p[tt]||e==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var _=p.getAttribute(n)||"";_=e+_;var E=o.get(_);E?E.push(p):o.set(_,[p])}}return o}function Gy(e,n,a){e=e.ownerDocument||e,e.head.insertBefore(a,n==="title"?e.querySelector("head > title"):null)}function xw(e,n,a){if(a===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return e=n.disabled,typeof n.precedence=="string"&&e==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function Vy(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function vw(e,n,a,o){if(a.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var u=Mi(o.href),p=n.querySelector(Fa(u));if(p){n=p._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=Pl.bind(e),n.then(e,e)),a.state.loading|=4,a.instance=p,q(p);return}p=n.ownerDocument||n,o=$y(o),(u=Dn.get(u))&&Th(o,u),p=p.createElement("link"),q(p);var _=p;_._p=new Promise(function(E,R){_.onload=E,_.onerror=R}),Lt(p,"link",o),a.instance=p}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Pl.bind(e),n.addEventListener("load",a),n.addEventListener("error",a))}}var Mh=0;function _w(e,n){return e.stylesheets&&e.count===0&&Il(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var o=setTimeout(function(){if(e.stylesheets&&Il(e,e.stylesheets),e.unsuspend){var p=e.unsuspend;e.unsuspend=null,p()}},6e4+n);0<e.imgBytes&&Mh===0&&(Mh=62500*tw());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Il(e,e.stylesheets),e.unsuspend)){var p=e.unsuspend;e.unsuspend=null,p()}},(e.imgBytes>Mh?50:800)+n);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(o),clearTimeout(u)}}:null}function Pl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Il(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var zl=null;function Il(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,zl=new Map,n.forEach(ww,e),zl=null,Pl.call(e))}function ww(e,n){if(!(n.state.loading&4)){var a=zl.get(e);if(a)var o=a.get(null);else{a=new Map,zl.set(e,a);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<u.length;p++){var _=u[p];(_.nodeName==="LINK"||_.getAttribute("media")!=="not all")&&(a.set(_.dataset.precedence,_),o=_)}o&&a.set(null,o)}u=n.instance,_=u.getAttribute("data-precedence"),p=a.get(_)||o,p===o&&a.set(null,u),a.set(_,u),this.count++,o=Pl.bind(this),u.addEventListener("load",o),u.addEventListener("error",o),p?p.parentNode.insertBefore(u,p.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(u,e.firstChild)),n.state.loading|=4}}var Va={$$typeof:ne,Provider:null,Consumer:null,_currentValue:he,_currentValue2:he,_threadCount:0};function Sw(e,n,a,o,u,p,_,E,R){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Br(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Br(0),this.hiddenUpdates=Br(null),this.identifierPrefix=o,this.onUncaughtError=u,this.onCaughtError=p,this.onRecoverableError=_,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.incompleteTransitions=new Map}function Yy(e,n,a,o,u,p,_,E,R,F,Q,re){return e=new Sw(e,n,a,_,R,F,Q,re,E),n=1,p===!0&&(n|=24),p=on(3,null,null,n),e.current=p,p.stateNode=e,n=ff(),n.refCount++,e.pooledCache=n,n.refCount++,p.memoizedState={element:o,isDehydrated:a,cache:n},pf(p),e}function Ky(e){return e?(e=ui,e):ui}function Jy(e,n,a,o,u,p){u=Ky(u),o.context===null?o.context=u:o.pendingContext=u,o=Yr(n),o.payload={element:a},p=p===void 0?null:p,p!==null&&(o.callback=p),a=Kr(e,o,n),a!==null&&(tn(a,e,n),Ea(a,e,n))}function Xy(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<n?a:n}}function Rh(e,n){Xy(e,n),(e=e.alternate)&&Xy(e,n)}function Qy(e){if(e.tag===13||e.tag===31){var n=Ts(e,67108864);n!==null&&tn(n,e,67108864),Rh(e,67108864)}}function Zy(e){if(e.tag===13||e.tag===31){var n=hn();n=lr(n);var a=Ts(e,n);a!==null&&tn(a,e,n),Rh(e,n)}}var $l=!0;function Ew(e,n,a,o){var u=Y.T;Y.T=null;var p=oe.p;try{oe.p=2,Dh(e,n,a,o)}finally{oe.p=p,Y.T=u}}function Ow(e,n,a,o){var u=Y.T;Y.T=null;var p=oe.p;try{oe.p=8,Dh(e,n,a,o)}finally{oe.p=p,Y.T=u}}function Dh(e,n,a,o){if($l){var u=qh(o);if(u===null)vh(e,n,o,Hl,a),eg(e,o);else if(jw(u,e,n,a,o))o.stopPropagation();else if(eg(e,o),n&4&&-1<Aw.indexOf(e)){for(;u!==null;){var p=N(u);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var _=Pn(p.pendingLanes);if(_!==0){var E=p;for(E.pendingLanes|=2,E.entangledLanes|=2;_;){var R=1<<31-Pt(_);E.entanglements[1]|=R,_&=~R}tr(p),(Ge&6)===0&&(Ol=lt()+500,za(0))}}break;case 31:case 13:E=Ts(p,2),E!==null&&tn(E,p,2),jl(),Rh(p,2)}if(p=qh(o),p===null&&vh(e,n,o,Hl,a),p===u)break;u=p}u!==null&&o.stopPropagation()}else vh(e,n,o,null,a)}}function qh(e){return e=Lu(e),Lh(e)}var Hl=null;function Lh(e){if(Hl=null,e=O(e),e!==null){var n=c(e);if(n===null)e=null;else{var a=n.tag;if(a===13){if(e=d(n),e!==null)return e;e=null}else if(a===31){if(e=y(n),e!==null)return e;e=null}else if(a===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return Hl=e,null}function Wy(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(ku()){case Mo:return 2;case Ro:return 8;case Zs:case Nu:return 32;case Do:return 268435456;default:return 32}default:return 32}}var Bh=!1,is=null,as=null,os=null,Ya=new Map,Ka=new Map,ls=[],Aw="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 eg(e,n){switch(e){case"focusin":case"focusout":is=null;break;case"dragenter":case"dragleave":as=null;break;case"mouseover":case"mouseout":os=null;break;case"pointerover":case"pointerout":Ya.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ka.delete(n.pointerId)}}function Ja(e,n,a,o,u,p){return e===null||e.nativeEvent!==p?(e={blockedOn:n,domEventName:a,eventSystemFlags:o,nativeEvent:p,targetContainers:[u]},n!==null&&(n=N(n),n!==null&&Qy(n)),e):(e.eventSystemFlags|=o,n=e.targetContainers,u!==null&&n.indexOf(u)===-1&&n.push(u),e)}function jw(e,n,a,o,u){switch(n){case"focusin":return is=Ja(is,e,n,a,o,u),!0;case"dragenter":return as=Ja(as,e,n,a,o,u),!0;case"mouseover":return os=Ja(os,e,n,a,o,u),!0;case"pointerover":var p=u.pointerId;return Ya.set(p,Ja(Ya.get(p)||null,e,n,a,o,u)),!0;case"gotpointercapture":return p=u.pointerId,Ka.set(p,Ja(Ka.get(p)||null,e,n,a,o,u)),!0}return!1}function tg(e){var n=O(e.target);if(n!==null){var a=c(n);if(a!==null){if(n=a.tag,n===13){if(n=d(a),n!==null){e.blockedOn=n,Lo(e.priority,function(){Zy(a)});return}}else if(n===31){if(n=y(a),n!==null){e.blockedOn=n,Lo(e.priority,function(){Zy(a)});return}}else if(n===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Fl(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var a=qh(e.nativeEvent);if(a===null){a=e.nativeEvent;var o=new a.constructor(a.type,a);qu=o,a.target.dispatchEvent(o),qu=null}else return n=N(a),n!==null&&Qy(n),e.blockedOn=a,!1;n.shift()}return!0}function ng(e,n,a){Fl(e)&&a.delete(n)}function kw(){Bh=!1,is!==null&&Fl(is)&&(is=null),as!==null&&Fl(as)&&(as=null),os!==null&&Fl(os)&&(os=null),Ya.forEach(ng),Ka.forEach(ng)}function Gl(e,n){e.blockedOn===n&&(e.blockedOn=null,Bh||(Bh=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,kw)))}var Vl=null;function rg(e){Vl!==e&&(Vl=e,r.unstable_scheduleCallback(r.unstable_NormalPriority,function(){Vl===e&&(Vl=null);for(var n=0;n<e.length;n+=3){var a=e[n],o=e[n+1],u=e[n+2];if(typeof o!="function"){if(Lh(o||a)===null)continue;break}var p=N(a);p!==null&&(e.splice(n,3),n-=3,qf(p,{pending:!0,data:u,method:a.method,action:o},o,u))}}))}function Di(e){function n(R){return Gl(R,e)}is!==null&&Gl(is,e),as!==null&&Gl(as,e),os!==null&&Gl(os,e),Ya.forEach(n),Ka.forEach(n);for(var a=0;a<ls.length;a++){var o=ls[a];o.blockedOn===e&&(o.blockedOn=null)}for(;0<ls.length&&(a=ls[0],a.blockedOn===null);)tg(a),a.blockedOn===null&&ls.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(o=0;o<a.length;o+=3){var u=a[o],p=a[o+1],_=u[ht]||null;if(typeof p=="function")_||rg(a);else if(_){var E=null;if(p&&p.hasAttribute("formAction")){if(u=p,_=p[ht]||null)E=_.formAction;else if(Lh(u)!==null)continue}else E=_.action;typeof E=="function"?a[o+1]=E:(a.splice(o,3),o-=3),rg(a)}}}function sg(){function e(p){p.canIntercept&&p.info==="react-transition"&&p.intercept({handler:function(){return new Promise(function(_){return u=_})},focusReset:"manual",scroll:"manual"})}function n(){u!==null&&(u(),u=null),o||setTimeout(a,20)}function a(){if(!o&&!navigation.transition){var p=navigation.currentEntry;p&&p.url!=null&&navigation.navigate(p.url,{state:p.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,u=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){o=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),u!==null&&(u(),u=null)}}}function Uh(e){this._internalRoot=e}Yl.prototype.render=Uh.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(i(409));var a=n.current,o=hn();Jy(a,o,e,n,null,null)},Yl.prototype.unmount=Uh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;Jy(e.current,2,null,e,null,null),jl(),n[sn]=null}};function Yl(e){this._internalRoot=e}Yl.prototype.unstable_scheduleHydration=function(e){if(e){var n=oa();e={blockedOn:null,target:e,priority:n};for(var a=0;a<ls.length&&n!==0&&n<ls[a].priority;a++);ls.splice(a,0,e),a===0&&tg(e)}};var ig=t.version;if(ig!=="19.2.4")throw Error(i(527,ig,"19.2.4"));oe.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(i(188)):(e=Object.keys(e).join(","),Error(i(268,e)));return e=f(n),e=e!==null?m(e):null,e=e===null?null:e.stateNode,e};var Nw={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:Y,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Kl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Kl.isDisabled&&Kl.supportsFiber)try{_s=Kl.inject(Nw),gt=Kl}catch{}}return Xa.createRoot=function(e,n){if(!l(e))throw Error(i(299));var a=!1,o="",u=hp,p=dp,_=mp;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onUncaughtError!==void 0&&(u=n.onUncaughtError),n.onCaughtError!==void 0&&(p=n.onCaughtError),n.onRecoverableError!==void 0&&(_=n.onRecoverableError)),n=Yy(e,1,!1,null,null,a,o,null,u,p,_,sg),e[sn]=n.current,xh(e),new Uh(n)},Xa.hydrateRoot=function(e,n,a){if(!l(e))throw Error(i(299));var o=!1,u="",p=hp,_=dp,E=mp,R=null;return a!=null&&(a.unstable_strictMode===!0&&(o=!0),a.identifierPrefix!==void 0&&(u=a.identifierPrefix),a.onUncaughtError!==void 0&&(p=a.onUncaughtError),a.onCaughtError!==void 0&&(_=a.onCaughtError),a.onRecoverableError!==void 0&&(E=a.onRecoverableError),a.formState!==void 0&&(R=a.formState)),n=Yy(e,1,!0,n,a??null,o,u,R,p,_,E,sg),n.context=Ky(null),a=n.current,o=hn(),o=lr(o),u=Yr(o),u.callback=null,Kr(a,u,o),a=o,n.current.lanes=a,zn(n,a),tr(n),e[sn]=n.current,xh(e),new Yl(n)},Xa.version="19.2.4",Xa}var dg;function bS(){if(dg)return Ph.exports;dg=1;function r(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(t){console.error(t)}}return r(),Ph.exports=gS(),Ph.exports}var xS=bS();const vS="modulepreload",_S=function(r,t){return new URL(r,t).href},mg={},Se=function(t,s,i){let l=Promise.resolve();if(s&&s.length>0){let d=function(m){return Promise.all(m.map(b=>Promise.resolve(b).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};const y=document.getElementsByTagName("link"),g=document.querySelector("meta[property=csp-nonce]"),f=(g==null?void 0:g.nonce)||(g==null?void 0:g.getAttribute("nonce"));l=d(s.map(m=>{if(m=_S(m,i),m in mg)return;mg[m]=!0;const b=m.endsWith(".css"),x=b?'[rel="stylesheet"]':"";if(!!i)for(let S=y.length-1;S>=0;S--){const C=y[S];if(C.href===m&&(!b||C.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${m}"]${x}`))return;const w=document.createElement("link");if(w.rel=b?"stylesheet":vS,b||(w.as="script"),w.crossOrigin="",w.href=m,f&&w.setAttribute("nonce",f),document.head.appendChild(w),b)return new Promise((S,C)=>{w.addEventListener("load",S),w.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${m}`)))})}))}function c(d){const y=new Event("vite:preloadError",{cancelable:!0});if(y.payload=d,window.dispatchEvent(y),!y.defaultPrevented)throw d}return l.then(d=>{for(const y of d||[])y.status==="rejected"&&c(y.reason);return t().catch(c)})};function yu(r){try{const t=r.split(".");if(t.length!==3)return null;const s=atob(t[1].replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(s)}catch{return null}}function Ub(r){const t=yu(r);return!t||typeof t.exp!="number"?null:t.exp}function Hd(r,t=0){const s=Ub(r);return s===null?!0:Date.now()/1e3>=s-t}const Bt=window.__LT_BASE__??"",ad=`${Bt}/api`;class pg extends Error{constructor(t,s,i){super(t),this.status=s,this.body=i,this.name="ApiError"}}let ds=null;function Jl(r){ds=r}function Pb(){return ds}const wS="X-LT-Acting-Token";let Yc=null,Kc=null;function yg(r){Yc=r}function gg(r){Kc=r}function SS(r){const t=r==null?void 0:r.error;return typeof t=="string"&&/acting[- ]identity/i.test(t)}async function bg(){const r=sessionStorage.getItem("lt_credentials");if(!r)return null;try{const{username:t,password:s}=JSON.parse(r),i=await fetch(`${ad}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:t,password:s})});if(!i.ok)return null;const l=await i.json();return l.token&&l.user&&sessionStorage.setItem("lt_user_info",JSON.stringify({displayName:l.user.display_name,username:l.user.external_id})),l.token??null}catch{return null}}let us=null;async function me(r,t={}){const s={"Content-Type":"application/json",...t.headers};if(ds){if(Hd(ds)){us||(us=bg().finally(()=>{us=null}));const c=await us;if(c)ds=c,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:c}}));else throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}s.Authorization=`Bearer ${ds}`}const i=(Yc==null?void 0:Yc())??null;i&&(s[wS]=i);let l=await fetch(`${ad}${r}`,{...t,headers:s});if(l.status===401&&i){const c=await l.clone().json().catch(()=>null);if(SS(c))throw Kc==null||Kc(),new pg(c.error,401,c)}if(l.status===401&&ds){us||(us=bg().finally(()=>{us=null}));const c=await us;if(c&&(ds=c,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:c}})),s.Authorization=`Bearer ${c}`,l=await fetch(`${ad}${r}`,{...t,headers:s})),l.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}else if(l.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired");if(!l.ok){const c=await l.json().catch(()=>({error:l.statusText}));throw new pg(c.message||c.error||l.statusText,l.status,c)}return l.json()}const ES="lt_ai_override";let Xl=null;function Fd(){return Xl||(Xl=fetch(`${Bt}/api/settings`).then(r=>{if(!r.ok)throw new Error(`settings ${r.status}`);return r.json()}).catch(r=>{throw Xl=null,r})),Xl}function OS(){try{if(localStorage.getItem(ES)==="off")return!1}catch{}return null}function Xn(){var s;const r=We({queryKey:["settings"],queryFn:Fd,staleTime:1/0}),t=OS();return r.data&&t===!1&&((s=r.data.ai)!=null&&s.enabled)?{...r,data:{...r.data,ai:{enabled:!1}}}:r}function AS(r){var f,m,b;const{data:t}=Xn(),s=((f=t==null?void 0:t.auth)==null?void 0:f.ssoKeepaliveSeconds)??0,i=((m=t==null?void 0:t.auth)==null?void 0:m.ssoKeepaliveIdleTimeoutSeconds)??0,l=A.useRef(Date.now()),c=A.useRef(Date.now()),d=A.useRef(!1),g=!!r&&((b=yu(r))==null?void 0:b.sso)===!0&&s>0;A.useEffect(()=>{if(!g)return;const x=()=>{l.current=Date.now()};window.addEventListener("pointerdown",x,{passive:!0}),window.addEventListener("keydown",x,{passive:!0}),window.addEventListener("wheel",x,{passive:!0});const v=async()=>{if(!d.current&&document.visibilityState==="visible"&&!(i>0&&Date.now()-l.current>i*1e3)){d.current=!0;try{const C=await fetch(`${Bt}/api/auth/sso`,{method:"POST"});if(C.status===401||C.status===403){window.dispatchEvent(new CustomEvent("auth:unauthorized"));return}if(!C.ok)return;const L=await C.json().catch(()=>null);L!=null&&L.token&&(c.current=Date.now(),window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:L.token}})))}catch{}finally{d.current=!1}}},w=setInterval(v,s*1e3),S=()=>{document.visibilityState==="visible"&&Date.now()-c.current>s*1e3&&v()};return document.addEventListener("visibilitychange",S),()=>{clearInterval(w),document.removeEventListener("visibilitychange",S),window.removeEventListener("pointerdown",x),window.removeEventListener("keydown",x),window.removeEventListener("wheel",x)}},[g,s,i])}const zb=A.createContext(null),jS=300;function $h(r,t){if(Hd(r))return null;const s=yu(r);if(!s)return null;const i=t??(()=>{try{const l=sessionStorage.getItem("lt_user_info");return l?JSON.parse(l):null}catch{return null}})();return{userId:s.userId,displayName:(i==null?void 0:i.displayName)??null,username:(i==null?void 0:i.username)??null,roles:s.roles??[]}}function kS({children:r}){const[t,s]=A.useState(()=>{const b=sessionStorage.getItem("lt_token");return b?Hd(b)?(sessionStorage.removeItem("lt_token"),null):(Jl(b),$h(b)):null}),i=A.useRef(void 0),l=A.useCallback(b=>{clearTimeout(i.current);const x=Ub(b);if(!x)return;const v=(x-jS)*1e3-Date.now();v<=0||(i.current=setTimeout(async()=>{try{const w=yu(b);if(w!=null&&w.sso){const se=await fetch(`${Bt}/api/auth/sso`,{method:"POST"});if(!se.ok)return;const D=await se.json();D.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:D.token}}));return}const S=sessionStorage.getItem("lt_credentials");if(!S)return;const{username:C,password:L}=JSON.parse(S),U=await fetch(`${Bt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:C,password:L})});if(!U.ok)return;const ne=await U.json();ne.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:ne.token}}))}catch{}},v))},[]),c=A.useCallback((b,x,v)=>{const w={displayName:(v==null?void 0:v.displayName)??null,username:(v==null?void 0:v.username)??(x==null?void 0:x.username)??null},S=$h(b,w);S&&(Jl(b),sessionStorage.setItem("lt_token",b),sessionStorage.setItem("lt_user_info",JSON.stringify(w)),x&&sessionStorage.setItem("lt_credentials",JSON.stringify(x)),s(S),l(b))},[l]),d=A.useCallback(()=>{clearTimeout(i.current);const b=sessionStorage.getItem("lt_sso_logout_url");Jl(null),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info"),sessionStorage.removeItem("lt_sso_logout_url"),s(null),b&&(window.location.href=b)},[]);A.useEffect(()=>{const b=()=>d(),x=v=>{var C;const w=(C=v.detail)==null?void 0:C.token;if(!w)return;const S=$h(w);S&&(Jl(w),sessionStorage.setItem("lt_token",w),s(S),l(w))};return window.addEventListener("auth:unauthorized",b),window.addEventListener("auth:refreshed",x),()=>{window.removeEventListener("auth:unauthorized",b),window.removeEventListener("auth:refreshed",x)}},[d,l]),A.useEffect(()=>{const b=sessionStorage.getItem("lt_token");return b&&t&&l(b),()=>clearTimeout(i.current)},[]);const y=(t==null?void 0:t.roles.some(b=>b.type==="superadmin"))??!1,g=A.useCallback(b=>(t==null?void 0:t.roles.some(x=>x.role===b))??!1,[t]),f=A.useCallback(b=>(t==null?void 0:t.roles.some(x=>x.type===b))??!1,[t]),m=(t==null?void 0:t.roles.map(b=>b.role))??[];return h.jsxs(zb.Provider,{value:{user:t,isAuthenticated:!!t,isSuperAdmin:y,login:c,logout:d,hasRole:g,hasRoleType:f,userRoleNames:m},children:[h.jsx(NS,{authenticated:t!==null}),r]})}function NS({authenticated:r}){return AS(r?sessionStorage.getItem("lt_token"):null),null}function It(){const r=A.useContext(zb);if(!r)throw new Error("useAuth must be used within AuthProvider");return r}const vn=new Uint8Array(0),Ks=new TextEncoder,gn=new TextDecoder;function TS(...r){let t=0;for(let l=0;l<r.length;l++)t+=r[l].length;const s=new Uint8Array(t);let i=0;for(let l=0;l<r.length;l++)s.set(r[l],i),i+=r[l].length;return s}function fo(...r){const t=[];for(let s=0;s<r.length;s++)t.push(Ks.encode(r[s]));return t.length===0?vn:t.length===1?t[0]:TS(...t)}function xg(r){return!r||r.length===0?"":gn.decode(r)}const vg="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",_g=36,CS=0xcfd41b9100000,wg=33,MS=333,Sg=22;function RS(r){for(let t=0;t<r.length;t++)r[t]=Math.floor(Math.random()*255)}function DS(r){var t;(t=globalThis==null?void 0:globalThis.crypto)!=null&&t.getRandomValues?globalThis.crypto.getRandomValues(r):RS(r)}class qS{constructor(){j(this,"buf");j(this,"seq");j(this,"inc");j(this,"inited");this.buf=new Uint8Array(Sg),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*CS),this.inc=Math.floor(Math.random()*(MS-wg)+wg)}setPre(){const t=new Uint8Array(12);DS(t);for(let s=0;s<12;s++){const i=t[s]%36;this.buf[s]=vg.charCodeAt(i)}}fillSeq(){let t=this.seq;for(let s=Sg-1;s>=12;s--)this.buf[s]=vg.charCodeAt(t%_g),t=Math.floor(t/_g)}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 xs=new qS;var Nr;(function(r){r.Disconnect="disconnect",r.Reconnect="reconnect",r.Update="update",r.LDM="ldm",r.Error="error"})(Nr||(Nr={}));var Hi;(function(r){r.Reconnecting="reconnecting",r.PingTimer="pingTimer",r.StaleConnection="staleConnection",r.ClientInitiatedReconnect="client initiated reconnect"})(Hi||(Hi={}));var ce;(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"})(ce||(ce={}));function LS(r){return typeof r.code=="string"}class Ib{constructor(){j(this,"messages");this.messages=new Map,this.messages.set(ce.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(ce.BadJson,"Bad JSON"),this.messages.set(ce.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(t){return BS.getMessage(t)}getMessage(t){return this.messages.get(t)||t}}const BS=new Ib;class de extends Error{constructor(s,i,l){super(s);j(this,"name");j(this,"message");j(this,"code");j(this,"permissionContext");j(this,"chainedError");j(this,"api_error");this.name="NatsError",this.message=s,this.code=i,this.chainedError=l}static errorForCode(s,i){const l=Ib.getMessage(s);return new de(l,s,i)}isAuthError(){return this.code===ce.AuthenticationExpired||this.code===ce.AuthorizationViolation||this.code===ce.AccountExpired}isAuthTimeout(){return this.code===ce.AuthenticationTimeout}isPermissionError(){return this.code===ce.PermissionsViolation}isProtocolError(){return this.code===ce.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var pn;(function(r){r[r.Exact=0]="Exact",r[r.CanonicalMIME=1]="CanonicalMIME",r[r.IgnoreCase=2]="IgnoreCase"})(pn||(pn={}));var Kn;(function(r){r.Timer="timer",r.Count="count",r.JitterTimer="jitterTimer",r.SentinelMsg="sentinelMsg"})(Kn||(Kn={}));var ho;(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"})(ho||(ho={}));const nu="Nats-Service-Error",ru="Nats-Service-Error-Code";class su extends Error{constructor(s,i){super(i);j(this,"code");this.code=s}static isServiceError(s){return su.toServiceError(s)!==null}static toServiceError(s){var l,c;const i=((l=s==null?void 0:s.headers)==null?void 0:l.get(ru))||"";if(i!==""){const d=parseInt(i)||400,y=((c=s==null?void 0:s.headers)==null?void 0:c.get(nu))||"";return new su(d,y.length?y:i)}return null}}function Tr(r=""){if(r=r||"_INBOX",typeof r!="string")throw new Error("prefix must be a string");return r.split(".").forEach(t=>{if(t==="*"||t===">")throw new Error(`inbox prefixes cannot have wildcards '${r}'`)}),`${r}.${xs.next()}`}const od="127.0.0.1";var ms;(function(r){r.PING="PING",r.STATS="STATS",r.INFO="INFO"})(ms||(ms={}));function gu(r,...t){for(let s=0;s<t.length;s++){const i=t[s];Object.keys(i).forEach(function(l){r[l]=i[l]})}return r}function Ql(r){return gn.decode(r).replace(/\n/g,"␊").replace(/\r/g,"␍")}function Ji(r,t=!0){const s=t?de.errorForCode(ce.Timeout):null;let i,l;const c=new Promise((d,y)=>{i={cancel:()=>{l&&clearTimeout(l)}},l=setTimeout(()=>{y(s===null?de.errorForCode(ce.Timeout):s)},r)});return Object.assign(c,i)}function Wi(r=0){let t;const s=new Promise(i=>{const l=setTimeout(()=>{i()},r);t={cancel:()=>{l&&clearTimeout(l)}}});return Object.assign(s,t)}function ft(){let r={};const t=new Promise((s,i)=>{r={resolve:s,reject:i}});return Object.assign(t,r)}function $b(r){for(let t=r.length-1;t>0;t--){const s=Math.floor(Math.random()*(t+1));[r[t],r[s]]=[r[s],r[t]]}return r}function US(r){return r===0?0:Math.floor(r/2+Math.random()*r)}function Gd(r=[0,250,250,500,500,3e3,5e3]){Array.isArray(r)||(r=[0,250,250,500,500,3e3,5e3]);const t=r.length-1;return{backoff(s){return US(s>t?r[t]:r[s])}}}function ut(r){return r*1e6}function Vd(r){return Math.floor(r/1e6)}function Eg(r){let i=!0;const l=new Array(r.length);for(let c=0;c<r.length;c++){let d=r.charCodeAt(c);if(d===58||d<33||d>126)throw new de(`'${r[c]}' is not a valid character for a header key`,ce.BadHeader);i&&97<=d&&d<=122?d-=32:!i&&65<=d&&d<=90&&(d+=32),l[c]=d,i=d==45}return String.fromCharCode(...l)}function Cr(r=0,t=""){if(r===0&&t!==""||r>0&&t==="")throw new Error("setting status requires both code and description");return new ps(r,t)}const Hh="NATS/1.0";class ps{constructor(t=0,s=""){j(this,"_code");j(this,"headers");j(this,"_description");this._code=t,this._description=s,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(t){if(t&&this.headers.size===t.headers.size&&this._code===t._code){for(const[s,i]of this.headers){const l=t.values(s);if(i.length!==l.length)return!1;const c=[...i].sort(),d=[...l].sort();for(let y=0;y<c.length;y++)if(c[y]!==d[y])return!1}return!0}return!1}static decode(t){const s=new ps,l=gn.decode(t).split(`\r
|
|
27
|
+
`),c=l[0];if(c!==Hh){let d=c.replace(Hh,"").trim();if(d.length>0){s._code=parseInt(d,10),isNaN(s._code)&&(s._code=0);const y=s._code.toString();d=d.replace(y,""),s._description=d.trim()}}return l.length>=1&&l.slice(1).map(d=>{if(d){const y=d.indexOf(":");if(y>-1){const g=d.slice(0,y),f=d.slice(y+1).trim();s.append(g,f)}}}),s}toString(){if(this.headers.size===0&&this._code===0)return"";let t=Hh;this._code>0&&this._description!==""&&(t+=` ${this._code} ${this._description}`);for(const[s,i]of this.headers)for(let l=0;l<i.length;l++)t=`${t}\r
|
|
28
|
+
${s}: ${i[l]}`;return`${t}\r
|
|
29
|
+
\r
|
|
30
|
+
`}encode(){return Ks.encode(this.toString())}static validHeaderValue(t){if(/[\r\n]/.test(t))throw new de("invalid header value - \\r and \\n are not allowed.",ce.BadHeader);return t.trim()}keys(){const t=[];for(const s of this.headers.keys())t.push(s);return t}findKeys(t,s=pn.Exact){const i=this.keys();switch(s){case pn.Exact:return i.filter(l=>l===t);case pn.CanonicalMIME:return t=Eg(t),i.filter(l=>l===t);default:{const l=t.toLowerCase();return i.filter(c=>l===c.toLowerCase())}}}get(t,s=pn.Exact){const i=this.findKeys(t,s);if(i.length){const l=this.headers.get(i[0]);if(l)return Array.isArray(l)?l[0]:l}return""}last(t,s=pn.Exact){const i=this.findKeys(t,s);if(i.length){const l=this.headers.get(i[0]);if(l)return Array.isArray(l)?l[l.length-1]:l}return""}has(t,s=pn.Exact){return this.findKeys(t,s).length>0}set(t,s,i=pn.Exact){this.delete(t,i),this.append(t,s,i)}append(t,s,i=pn.Exact){const l=Eg(t);i===pn.CanonicalMIME&&(t=l);const c=this.findKeys(t,i);t=c.length>0?c[0]:t;const d=ps.validHeaderValue(s);let y=this.headers.get(t);y||(y=[],this.headers.set(t,y)),y.push(d)}values(t,s=pn.Exact){const i=[];return this.findKeys(t,s).forEach(c=>{const d=this.headers.get(c);d&&i.push(...d)}),i}delete(t,s=pn.Exact){this.findKeys(t,s).forEach(l=>{this.headers.delete(l)})}get hasError(){return this._code>=300}get status(){return`${this._code} ${this._description}`.trim()}toRecord(){const t={};return this.keys().forEach(s=>{t[s]=this.values(s)}),t}get code(){return this._code}get description(){return this._description}static fromRecord(t){const s=new ps;for(const i in t)s.headers.set(i,t[i]);return s}}function ld(){return{encode(r){return Ks.encode(r)},decode(r){return gn.decode(r)}}}function Jn(r){return{encode(t){try{return t===void 0&&(t=null),Ks.encode(JSON.stringify(t))}catch(s){throw de.errorForCode(ce.BadJson,s)}},decode(t){try{return JSON.parse(gn.decode(t),r)}catch(s){throw de.errorForCode(ce.BadJson,s)}}}}function Hb(r){var t;return r&&r.data.length===0&&((t=r.headers)==null?void 0:t.code)===503?de.errorForCode(ce.NoResponders):null}class Yd{constructor(t,s,i){j(this,"_headers");j(this,"_msg");j(this,"_rdata");j(this,"_reply");j(this,"_subject");j(this,"publisher");this._msg=t,this._rdata=s,this.publisher=i}get subject(){return this._subject?this._subject:(this._subject=gn.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=gn.decode(this._msg.reply),this._reply)}get sid(){return this._msg.sid}get headers(){if(this._msg.hdr>-1&&!this._headers){const t=this._rdata.subarray(0,this._msg.hdr);this._headers=ps.decode(t)}return this._headers}get data(){return this._rdata?this._msg.hdr>-1?this._rdata.subarray(this._msg.hdr):this._rdata:new Uint8Array(0)}respond(t=vn,s){return this.reply?(this.publisher.publish(this.reply,t,s),!0):!1}size(){var l;const t=this._msg.subject.length,s=((l=this._msg.reply)==null?void 0:l.length)||0,i=this._msg.size===-1?0:this._msg.size;return t+s+i}json(t){return Jn(t).decode(this.data)}string(){return gn.decode(this.data)}requestInfo(){var s;const t=(s=this.headers)==null?void 0:s.get("Nats-Request-Info");return t?JSON.parse(t,function(i,l){return(i==="start"||i==="stop")&&l!==""?new Date(Date.parse(l)):l}):null}}j(Yd,"jc");function Fi(r){return bu("durable",r)}function Gt(r){return bu("stream",r)}function bu(r,t=""){if(t==="")throw Error(`${r} name required`);return[".","*",">","/","\\"," "," ",`
|
|
31
|
+
`,"\r"].forEach(i=>{if(t.indexOf(i)!==-1){switch(i){case`
|
|
32
|
+
`:i="\\n";break;case"\r":i="\\r";break;case" ":i="\\t";break}throw Error(`invalid ${r} name - ${r} name cannot contain '${i}'`)}}),""}function lo(r,t=""){if(t==="")throw Error(`${r} name required`);const s=PS(t);if(s.length)throw new Error(`invalid ${r} name - ${r} name ${s}`)}function PS(r=""){if(r==="")throw Error("name required");const t=/^[-\w]+$/g;if(r.match(t)===null){for(const i of r.split(""))if(i.match(t)===null)return`cannot contain '${i}'`}return""}function cd(r){if(r.data.length>0)return!1;const t=r.headers;return t?t.code>=100&&t.code<200:!1}function ud(r){var t;return cd(r)&&((t=r.headers)==null?void 0:t.description)==="Idle Heartbeat"}function zS(r,t,s){const i=Cr(r,t),l={hdr:1,sid:0,size:0},c=new Yd(l,vn,{});return c._headers=i,c._subject=s,c}function Gi(r){if(r.data.length!==0)return null;const t=r.headers;return t?Fb(t.code,t.description):null}var Ln;(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"})(Ln||(Ln={}));function IS(r){return r.code!==ce.JetStream409?!1:[Ln.MaxBatchExceeded,Ln.MaxExpiresExceeded,Ln.MaxBytesExceeded,Ln.MaxMessageSizeExceeded,Ln.PushConsumer,Ln.IdleHeartbeatMissed,Ln.ConsumerDeleted].find(s=>r.message.indexOf(s)!==-1)!==void 0}function Fb(r,t=""){if(r<300)return null;switch(t=t.toLowerCase(),r){case 404:return new de(t,ce.JetStream404NoMessages);case 408:return new de(t,ce.JetStream408RequestTimeout);case 409:{const s=t.startsWith(Ln.IdleHeartbeatMissed)?ce.JetStreamIdleHeartBeat:ce.JetStream409;return new de(t,s)}case 503:return de.errorForCode(ce.JetStreamNotEnabled,new Error(t));default:return t===""&&(t=ce.Unknown),new de(t,`${r}`)}}class Mt{constructor(){j(this,"inflight");j(this,"processed");j(this,"received");j(this,"noIterator");j(this,"iterClosed");j(this,"done");j(this,"signal");j(this,"yields");j(this,"filtered");j(this,"pendingFiltered");j(this,"ingestionFilterFn");j(this,"protocolFilterFn");j(this,"dispatchedFn");j(this,"ctx");j(this,"_data");j(this,"err");j(this,"time");j(this,"yielding");this.inflight=0,this.filtered=0,this.pendingFiltered=0,this.processed=0,this.received=0,this.noIterator=!1,this.done=!1,this.signal=ft(),this.yields=[],this.iterClosed=ft(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(t){if(this.done)return;if(typeof t=="function"){this.yields.push(t),this.signal.resolve();return}const{ingest:s,protocol:i}=this.ingestionFilterFn?this.ingestionFilterFn(t,this.ctx||this):{ingest:!0,protocol:!1};s&&(i&&(this.filtered++,this.pendingFiltered++),this.yields.push(t),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new de("unsupported iterator",ce.ApiError);if(this.yielding)throw new de("already yielding",ce.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const t=this.yields;this.inflight=t.length,this.yields=[];for(let s=0;s<t.length;s++){if(typeof t[s]=="function"){const l=t[s];try{l()}catch(c){throw c}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(t[s]):!0){this.processed++;const l=Date.now();yield t[s],this.time=Date.now()-l,this.dispatchedFn&&t[s]&&this.dispatchedFn(t[s])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(t.length=0,this.yields=t,this.signal=ft())}}finally{this.stop()}}stop(t){this.done||(this.err=t,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(t))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class Kd{constructor(t,s,i={maxOut:2}){j(this,"interval");j(this,"maxOut");j(this,"cancelAfter");j(this,"timer");j(this,"autoCancelTimer");j(this,"last");j(this,"missed");j(this,"count");j(this,"callback");this.interval=t,this.maxOut=(i==null?void 0:i.maxOut)||2,this.cancelAfter=(i==null?void 0:i.cancelAfter)||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=s,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(t,s=0,i=2){this.interval=t,this.maxOut=i,this.cancelAfter=s,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(t){console.log(t)}},this.interval)}}var fd;(function(r){r.Limits="limits",r.Interest="interest",r.Workqueue="workqueue"})(fd||(fd={}));var go;(function(r){r.Old="old",r.New="new"})(go||(go={}));var hd;(function(r){r.File="file",r.Memory="memory"})(hd||(hd={}));var vt;(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"})(vt||(vt={}));var Ct;(function(r){r.None="none",r.All="all",r.Explicit="explicit",r.NotSet=""})(Ct||(Ct={}));var Xi;(function(r){r.Instant="instant",r.Original="original"})(Xi||(Xi={}));var vs;(function(r){r.None="none",r.S2="s2"})(vs||(vs={}));var iu;(function(r){r.CreateOrUpdate="",r.Update="update",r.Create="create"})(iu||(iu={}));function $S(r,t={}){return Object.assign({name:r,deliver_policy:vt.All,ack_policy:Ct.Explicit,ack_wait:ut(30*1e3),replay_policy:Xi.Instant},t)}var Og;(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"})(Og||(Og={}));var Kt;(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"})(Kt||(Kt={}));var Vn;(function(r){r.LastValue="",r.AllHistory="history",r.UpdatesOnly="updates"})(Vn||(Vn={}));var Ii;(function(r){r.Stream="Nats-Stream",r.Sequence="Nats-Sequence",r.TimeStamp="Nats-Time-Stamp",r.Subject="Nats-Subject"})(Ii||(Ii={}));var Ag;(function(r){r.Stream="Nats-Stream",r.Subject="Nats-Subject",r.Sequence="Nats-Sequence",r.LastSequence="Nats-Last-Sequence",r.Size="Nats-Msg-Size"})(Ag||(Ag={}));const yn="KV_";class HS{constructor(t){j(this,"config");j(this,"ordered");j(this,"mack");j(this,"stream");j(this,"callbackFn");j(this,"max");j(this,"qname");j(this,"isBind");j(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=$S("",t||{})}getOpts(){var s;const t={};if(t.config=Object.assign({},this.config),t.config.filter_subject&&(this.filterSubject(t.config.filter_subject),t.config.filter_subject=void 0),t.config.filter_subjects&&((s=t.config.filter_subjects)==null||s.forEach(i=>{this.filterSubject(i)}),t.config.filter_subjects=void 0),t.mack=this.mack,t.stream=this.stream,t.callbackFn=this.callbackFn,t.max=this.max,t.queue=this.qname,t.ordered=this.ordered,t.config.ack_policy=t.ordered?Ct.None:t.config.ack_policy,t.isBind=t.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:t.config.filter_subject=this.filters[0];break;default:t.config.filter_subjects=this.filters}return t}description(t){return this.config.description=t,this}deliverTo(t){return this.config.deliver_subject=t,this}durable(t){return Fi(t),this.config.durable_name=t,this}startSequence(t){if(t<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=vt.StartSequence,this.config.opt_start_seq=t,this}startTime(t){return this.config.deliver_policy=vt.StartTime,this.config.opt_start_time=t.toISOString(),this}deliverAll(){return this.config.deliver_policy=vt.All,this}deliverLastPerSubject(){return this.config.deliver_policy=vt.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=vt.Last,this}deliverNew(){return this.config.deliver_policy=vt.New,this}startAtTimeDelta(t){return this.startTime(new Date(Date.now()-t)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=Ct.None,this}ackAll(){return this.config.ack_policy=Ct.All,this}ackExplicit(){return this.config.ack_policy=Ct.Explicit,this}ackWait(t){return this.config.ack_wait=ut(t),this}maxDeliver(t){return this.config.max_deliver=t,this}filterSubject(t){return this.filters=this.filters||[],this.filters.push(t),this}replayInstantly(){return this.config.replay_policy=Xi.Instant,this}replayOriginal(){return this.config.replay_policy=Xi.Original,this}sample(t){if(t=Math.trunc(t),t<0||t>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${t}%`,this}limit(t){return this.config.rate_limit_bps=t,this}maxWaiting(t){return this.config.max_waiting=t,this}maxAckPending(t){return this.config.max_ack_pending=t,this}idleHeartbeat(t){return this.config.idle_heartbeat=ut(t),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(t){return this.queue(t),this}manualAck(){return this.mack=!0,this}maxMessages(t){return this.max=t,this}callback(t){return this.callbackFn=t,this}queue(t){return this.qname=t,this.config.deliver_group=t,this}orderedConsumer(){return this.ordered=!0,this}bind(t,s){return this.stream=t,this.config.durable_name=s,this.isBind=!0,this}bindStream(t){return this.stream=t,this}inactiveEphemeralThreshold(t){return this.config.inactive_threshold=ut(t),this}maxPullBatch(t){return this.config.max_batch=t,this}maxPullRequestExpires(t){return this.config.max_expires=ut(t),this}memory(){return this.config.mem_storage=!0,this}numReplicas(t){return this.config.num_replicas=t,this}consumerName(t){return this.config.name=t,this}}function ys(r){return new HS(r)}function jg(r){return typeof r.getOpts=="function"}class FS{static encode(t){if(typeof t=="string")return btoa(t);const s=Array.from(t);return btoa(String.fromCharCode(...s))}static decode(t,s=!1){const i=atob(t);return s?Uint8Array.from(i,l=>l.charCodeAt(0)):i}}class Vi{static encode(t){return Vi.toB64URLEncoding(FS.encode(t))}static decode(t,s=!1){return Vi.decode(Vi.fromB64URLEncoding(t),s)}static toB64URLEncoding(t){return t.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(t){return t.replace(/_/g,"/").replace(/-/g,"+")}}class Qi{constructor(){j(this,"buffers");j(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...t){let s=0;for(let c=0;c<t.length;c++)s+=t[c].length;const i=new Uint8Array(s);let l=0;for(let c=0;c<t.length;c++)i.set(t[c],l),l+=t[c].length;return i}static fromAscii(t){return t||(t=""),Ks.encode(t)}static toAscii(t){return gn.decode(t)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const t=new Uint8Array(this.byteLength);let s=0;for(let i=0;i<this.buffers.length;i++)t.set(this.buffers[i],s),s+=this.buffers[i].length;this.buffers.length=0,this.buffers.push(t)}}shift(){if(this.buffers.length){const t=this.buffers.shift();if(t)return this.byteLength-=t.length,t}return new Uint8Array(0)}drain(t){if(this.buffers.length){this.pack();const s=this.buffers.pop();if(s){const i=this.byteLength;(t===void 0||t>i)&&(t=i);const l=s.subarray(0,t);return i>t&&this.buffers.push(s.subarray(t)),this.byteLength=i-t,l}}return new Uint8Array(0)}fill(t,...s){t&&(this.buffers.push(t),this.byteLength+=t.length);for(let i=0;i<s.length;i++)s[i]&&s[i].length&&(this.buffers.push(s[i]),this.byteLength+=s[i].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function GS(r,t){return t.forEach(function(s){s&&typeof s!="string"&&!Array.isArray(s)&&Object.keys(s).forEach(function(i){if(i!=="default"&&!(i in r)){var l=Object.getOwnPropertyDescriptor(s,i);Object.defineProperty(r,i,l.get?l:{enumerable:!0,get:function(){return s[i]}})}})}),Object.freeze(r)}var VS=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},Qa=VS.performance||{};Qa.now||Qa.mozNow||Qa.msNow||Qa.oNow||Qa.webkitNow;var kg={versions:{}},YS=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function KS(r){if(r.__esModule)return r;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(r).forEach(function(s){var i=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:function(){return r[s]}})}),t}var Fh,xu={exports:{}},Ng={},Tg=KS(GS({__proto__:null,default:Ng},[Ng]));Fh=xu,(function(){var r="input is invalid type",t=typeof window=="object",s=t?window:{};s.JS_SHA256_NO_WINDOW&&(t=!1);var i=!t&&typeof self=="object",l=!s.JS_SHA256_NO_NODE_JS&&kg.versions&&kg.versions.node;l?s=YS:i&&(s=self);var c=!s.JS_SHA256_NO_COMMON_JS&&Fh.exports,d=!s.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",y="0123456789abcdef".split(""),g=[-2147483648,8388608,32768,128],f=[24,16,8,0],m=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],b=["hex","array","digest","arrayBuffer"],x=[];!s.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(D){return Object.prototype.toString.call(D)==="[object Array]"}),!d||!s.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(D){return typeof D=="object"&&D.buffer&&D.buffer.constructor===ArrayBuffer});var v=function(D,z){return function(ae){return new U(z,!0).update(ae)[D]()}},w=function(D){var z=v("hex",D);l&&(z=S(z,D)),z.create=function(){return new U(D)},z.update=function(M){return z.create().update(M)};for(var ae=0;ae<b.length;++ae){var X=b[ae];z[X]=v(X,D)}return z},S=function(D,z){var ae,X=Tg,M=Tg.Buffer,$=z?"sha224":"sha256";return ae=M.from&&!s.JS_SHA256_NO_BUFFER_FROM?M.from:function(Z){return new M(Z)},function(Z){if(typeof Z=="string")return X.createHash($).update(Z,"utf8").digest("hex");if(Z==null)throw new Error(r);return Z.constructor===ArrayBuffer&&(Z=new Uint8Array(Z)),Array.isArray(Z)||ArrayBuffer.isView(Z)||Z.constructor===M?X.createHash($).update(ae(Z)).digest("hex"):D(Z)}},C=function(D,z){return function(ae,X){return new ne(ae,z,!0).update(X)[D]()}},L=function(D){var z=C("hex",D);z.create=function(M){return new ne(M,D)},z.update=function(M,$){return z.create(M).update($)};for(var ae=0;ae<b.length;++ae){var X=b[ae];z[X]=C(X,D)}return z};function U(D,z){z?(x[0]=x[16]=x[1]=x[2]=x[3]=x[4]=x[5]=x[6]=x[7]=x[8]=x[9]=x[10]=x[11]=x[12]=x[13]=x[14]=x[15]=0,this.blocks=x):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],D?(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=D}function ne(D,z,ae){var X,M=typeof D;if(M==="string"){var $,Z=[],J=D.length,le=0;for(X=0;X<J;++X)($=D.charCodeAt(X))<128?Z[le++]=$:$<2048?(Z[le++]=192|$>>>6,Z[le++]=128|63&$):$<55296||$>=57344?(Z[le++]=224|$>>>12,Z[le++]=128|$>>>6&63,Z[le++]=128|63&$):($=65536+((1023&$)<<10|1023&D.charCodeAt(++X)),Z[le++]=240|$>>>18,Z[le++]=128|$>>>12&63,Z[le++]=128|$>>>6&63,Z[le++]=128|63&$);D=Z}else{if(M!=="object")throw new Error(r);if(D===null)throw new Error(r);if(d&&D.constructor===ArrayBuffer)D=new Uint8Array(D);else if(!(Array.isArray(D)||d&&ArrayBuffer.isView(D)))throw new Error(r)}D.length>64&&(D=new U(z,!0).update(D).array());var ve=[],Re=[];for(X=0;X<64;++X){var Y=D[X]||0;ve[X]=92^Y,Re[X]=54^Y}U.call(this,z,ae),this.update(Re),this.oKeyPad=ve,this.inner=!0,this.sharedMemory=ae}U.prototype.update=function(D){if(!this.finalized){var z,ae=typeof D;if(ae!=="string"){if(ae!=="object")throw new Error(r);if(D===null)throw new Error(r);if(d&&D.constructor===ArrayBuffer)D=new Uint8Array(D);else if(!(Array.isArray(D)||d&&ArrayBuffer.isView(D)))throw new Error(r);z=!0}for(var X,M,$=0,Z=D.length,J=this.blocks;$<Z;){if(this.hashed&&(this.hashed=!1,J[0]=this.block,this.block=J[16]=J[1]=J[2]=J[3]=J[4]=J[5]=J[6]=J[7]=J[8]=J[9]=J[10]=J[11]=J[12]=J[13]=J[14]=J[15]=0),z)for(M=this.start;$<Z&&M<64;++$)J[M>>>2]|=D[$]<<f[3&M++];else for(M=this.start;$<Z&&M<64;++$)(X=D.charCodeAt($))<128?J[M>>>2]|=X<<f[3&M++]:X<2048?(J[M>>>2]|=(192|X>>>6)<<f[3&M++],J[M>>>2]|=(128|63&X)<<f[3&M++]):X<55296||X>=57344?(J[M>>>2]|=(224|X>>>12)<<f[3&M++],J[M>>>2]|=(128|X>>>6&63)<<f[3&M++],J[M>>>2]|=(128|63&X)<<f[3&M++]):(X=65536+((1023&X)<<10|1023&D.charCodeAt(++$)),J[M>>>2]|=(240|X>>>18)<<f[3&M++],J[M>>>2]|=(128|X>>>12&63)<<f[3&M++],J[M>>>2]|=(128|X>>>6&63)<<f[3&M++],J[M>>>2]|=(128|63&X)<<f[3&M++]);this.lastByteIndex=M,this.bytes+=M-this.start,M>=64?(this.block=J[16],this.start=M-64,this.hash(),this.hashed=!0):this.start=M}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},U.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var D=this.blocks,z=this.lastByteIndex;D[16]=this.block,D[z>>>2]|=g[3&z],this.block=D[16],z>=56&&(this.hashed||this.hash(),D[0]=this.block,D[16]=D[1]=D[2]=D[3]=D[4]=D[5]=D[6]=D[7]=D[8]=D[9]=D[10]=D[11]=D[12]=D[13]=D[14]=D[15]=0),D[14]=this.hBytes<<3|this.bytes>>>29,D[15]=this.bytes<<3,this.hash()}},U.prototype.hash=function(){var D,z,ae,X,M,$,Z,J,le,ve=this.h0,Re=this.h1,Y=this.h2,oe=this.h3,he=this.h4,Ae=this.h5,_e=this.h6,Ne=this.h7,je=this.blocks;for(D=16;D<64;++D)z=((M=je[D-15])>>>7|M<<25)^(M>>>18|M<<14)^M>>>3,ae=((M=je[D-2])>>>17|M<<15)^(M>>>19|M<<13)^M>>>10,je[D]=je[D-16]+z+je[D-7]+ae|0;for(le=Re&Y,D=0;D<64;D+=4)this.first?(this.is224?($=300032,Ne=(M=je[0]-1413257819)-150054599|0,oe=M+24177077|0):($=704751109,Ne=(M=je[0]-210244248)-1521486534|0,oe=M+143694565|0),this.first=!1):(z=(ve>>>2|ve<<30)^(ve>>>13|ve<<19)^(ve>>>22|ve<<10),X=($=ve&Re)^ve&Y^le,Ne=oe+(M=Ne+(ae=(he>>>6|he<<26)^(he>>>11|he<<21)^(he>>>25|he<<7))+(he&Ae^~he&_e)+m[D]+je[D])|0,oe=M+(z+X)|0),z=(oe>>>2|oe<<30)^(oe>>>13|oe<<19)^(oe>>>22|oe<<10),X=(Z=oe&ve)^oe&Re^$,_e=Y+(M=_e+(ae=(Ne>>>6|Ne<<26)^(Ne>>>11|Ne<<21)^(Ne>>>25|Ne<<7))+(Ne&he^~Ne&Ae)+m[D+1]+je[D+1])|0,z=((Y=M+(z+X)|0)>>>2|Y<<30)^(Y>>>13|Y<<19)^(Y>>>22|Y<<10),X=(J=Y&oe)^Y&ve^Z,Ae=Re+(M=Ae+(ae=(_e>>>6|_e<<26)^(_e>>>11|_e<<21)^(_e>>>25|_e<<7))+(_e&Ne^~_e&he)+m[D+2]+je[D+2])|0,z=((Re=M+(z+X)|0)>>>2|Re<<30)^(Re>>>13|Re<<19)^(Re>>>22|Re<<10),X=(le=Re&Y)^Re&oe^J,he=ve+(M=he+(ae=(Ae>>>6|Ae<<26)^(Ae>>>11|Ae<<21)^(Ae>>>25|Ae<<7))+(Ae&_e^~Ae&Ne)+m[D+3]+je[D+3])|0,ve=M+(z+X)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+ve|0,this.h1=this.h1+Re|0,this.h2=this.h2+Y|0,this.h3=this.h3+oe|0,this.h4=this.h4+he|0,this.h5=this.h5+Ae|0,this.h6=this.h6+_e|0,this.h7=this.h7+Ne|0},U.prototype.hex=function(){this.finalize();var D=this.h0,z=this.h1,ae=this.h2,X=this.h3,M=this.h4,$=this.h5,Z=this.h6,J=this.h7,le=y[D>>>28&15]+y[D>>>24&15]+y[D>>>20&15]+y[D>>>16&15]+y[D>>>12&15]+y[D>>>8&15]+y[D>>>4&15]+y[15&D]+y[z>>>28&15]+y[z>>>24&15]+y[z>>>20&15]+y[z>>>16&15]+y[z>>>12&15]+y[z>>>8&15]+y[z>>>4&15]+y[15&z]+y[ae>>>28&15]+y[ae>>>24&15]+y[ae>>>20&15]+y[ae>>>16&15]+y[ae>>>12&15]+y[ae>>>8&15]+y[ae>>>4&15]+y[15&ae]+y[X>>>28&15]+y[X>>>24&15]+y[X>>>20&15]+y[X>>>16&15]+y[X>>>12&15]+y[X>>>8&15]+y[X>>>4&15]+y[15&X]+y[M>>>28&15]+y[M>>>24&15]+y[M>>>20&15]+y[M>>>16&15]+y[M>>>12&15]+y[M>>>8&15]+y[M>>>4&15]+y[15&M]+y[$>>>28&15]+y[$>>>24&15]+y[$>>>20&15]+y[$>>>16&15]+y[$>>>12&15]+y[$>>>8&15]+y[$>>>4&15]+y[15&$]+y[Z>>>28&15]+y[Z>>>24&15]+y[Z>>>20&15]+y[Z>>>16&15]+y[Z>>>12&15]+y[Z>>>8&15]+y[Z>>>4&15]+y[15&Z];return this.is224||(le+=y[J>>>28&15]+y[J>>>24&15]+y[J>>>20&15]+y[J>>>16&15]+y[J>>>12&15]+y[J>>>8&15]+y[J>>>4&15]+y[15&J]),le},U.prototype.toString=U.prototype.hex,U.prototype.digest=function(){this.finalize();var D=this.h0,z=this.h1,ae=this.h2,X=this.h3,M=this.h4,$=this.h5,Z=this.h6,J=this.h7,le=[D>>>24&255,D>>>16&255,D>>>8&255,255&D,z>>>24&255,z>>>16&255,z>>>8&255,255&z,ae>>>24&255,ae>>>16&255,ae>>>8&255,255&ae,X>>>24&255,X>>>16&255,X>>>8&255,255&X,M>>>24&255,M>>>16&255,M>>>8&255,255&M,$>>>24&255,$>>>16&255,$>>>8&255,255&$,Z>>>24&255,Z>>>16&255,Z>>>8&255,255&Z];return this.is224||le.push(J>>>24&255,J>>>16&255,J>>>8&255,255&J),le},U.prototype.array=U.prototype.digest,U.prototype.arrayBuffer=function(){this.finalize();var D=new ArrayBuffer(this.is224?28:32),z=new DataView(D);return z.setUint32(0,this.h0),z.setUint32(4,this.h1),z.setUint32(8,this.h2),z.setUint32(12,this.h3),z.setUint32(16,this.h4),z.setUint32(20,this.h5),z.setUint32(24,this.h6),this.is224||z.setUint32(28,this.h7),D},ne.prototype=new U,ne.prototype.finalize=function(){if(U.prototype.finalize.call(this),this.inner){this.inner=!1;var D=this.array();U.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(D),U.prototype.finalize.call(this)}};var se=w();se.sha256=se,se.sha224=w(!0),se.sha256.hmac=L(),se.sha224.hmac=L(!0),c?Fh.exports=se:(s.sha256=se.sha256,s.sha224=se.sha224)})();xu.exports;xu.exports.sha224;var Cg=xu.exports.sha256;function dd(r){return eE(r)}function JS(r){if(!/^[0-9A-Fa-f]+$/.test(r))return!1;const s=/^[0-9A-F]+$/.test(r),i=/^[0-9a-f]+$/.test(r);return s||i?r.length%2===0:!1}function XS(r){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(r)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(r)}function QS(r){return JS(r)?"hex":XS(r)?"b64":""}function ZS(r){if(r.length%2!==0)throw new Error("hex string must have an even length");const t=new Uint8Array(r.length/2);for(let s=0;s<r.length;s+=2)t[s/2]=parseInt(r.substring(s,s+2),16);return t}function WS(r){r=r.replace(/-/g,"+"),r=r.replace(/_/g,"/");const t=atob(r);return Uint8Array.from(t,s=>s.charCodeAt(0))}function eE(r){switch(QS(r)){case"hex":return ZS(r);case"b64":return WS(r)}return null}function tE(r,t){const s=typeof r=="string"?dd(r):r,i=typeof t=="string"?dd(t):t;if(s===null||i===null||s.length!==i.length)return!1;for(let l=0;l<s.length;l++)if(s[l]!==i[l])return!1;return!0}class Gb{constructor(t,s,i=!0){j(this,"token");j(this,"received");j(this,"ctx");j(this,"requestSubject");j(this,"mux");this.mux=t,this.requestSubject=s,this.received=0,this.token=xs.next(),i&&(this.ctx=new Error)}}class nE extends Gb{constructor(s,i,l={maxWait:1e3}){super(s,i);j(this,"callback");j(this,"done");j(this,"timer");j(this,"max");j(this,"opts");if(this.opts=l,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof l.maxMessages=="number"&&l.maxMessages>0?l.maxMessages:-1,this.done=ft(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},l.maxWait)}cancel(s){s&&this.callback(s,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(s,i){s?(this.ctx&&(s.stack+=`
|
|
33
|
+
|
|
34
|
+
${this.ctx.stack}`),this.cancel(s)):(this.callback(null,i),this.opts.strategy===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&&i&&i.data.length===0&&this.cancel())}}class Vb extends Gb{constructor(s,i,l={timeout:1e3},c=!0){super(s,i,c);j(this,"deferred");j(this,"timer");this.deferred=ft(),this.timer=Ji(l.timeout,c)}resolver(s,i){this.timer&&this.timer.cancel(),s?(this.ctx&&(s.stack+=`
|
|
35
|
+
|
|
36
|
+
${this.ctx.stack}`),this.deferred.reject(s)):this.deferred.resolve(i),this.cancel()}cancel(s){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(s||de.errorForCode(ce.Cancelled))}}const rE="$JS.API";function sE(r){return r=r||{},r.domain&&(r.apiPrefix=`$JS.${r.domain}.API`,delete r.domain),gu({apiPrefix:rE,timeout:5e3},r)}class wo{constructor(t,s){j(this,"nc");j(this,"opts");j(this,"prefix");j(this,"timeout");j(this,"jc");this.nc=t,this.opts=sE(s),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=Jn()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let t=this.opts.apiPrefix;if(!t||t.length===0)throw new Error("invalid empty prefix");t[t.length-1]==="."&&(t=t.substr(0,t.length-1)),this.opts.apiPrefix=t}async _request(t,s=null,i){i=i||{},i.timeout=this.timeout;let l=vn;s&&(l=this.jc.encode(s));let{retries:c}=i;c=c||1,c=c===-1?Number.MAX_SAFE_INTEGER:c;const d=Gd();for(let y=0;y<c;y++)try{const g=await this.nc.request(t,l,i);return this.parseJsResponse(g)}catch(g){const f=g;if((f.code==="503"||f.code===ce.Timeout)&&y+1<c)await Wi(d.backoff(y));else throw g}}async findStream(t){const s={subject:t},l=await this._request(`${this.prefix}.STREAM.NAMES`,s);if(!l.streams||l.streams.length!==1)throw new Error("no stream matches subject");return l.streams[0]}getConnection(){return this.nc}parseJsResponse(t){const s=this.jc.decode(t.data),i=s;if(i.error){const l=Fb(i.error.code,i.error.description);if(l!==null)throw l.api_error=i.error,l}return s}}class co{constructor(t,s,i,l){j(this,"err");j(this,"offset");j(this,"pageInfo");j(this,"subject");j(this,"jsm");j(this,"filter");j(this,"payload");if(!t)throw new Error("subject is required");this.subject=t,this.jsm=i,this.offset=0,this.pageInfo={},this.filter=s,this.payload=l||{}}async next(){if(this.err)return[];if(this.pageInfo&&this.offset>=this.pageInfo.total)return[];const t={offset:this.offset};this.payload&&Object.assign(t,this.payload);try{const s=await this.jsm._request(this.subject,t,{timeout:this.jsm.timeout});this.pageInfo=s;const i=this.countResponse(s);return i===0?[]:(this.offset+=i,this.filter(s))}catch(s){throw this.err=s,s}}countResponse(t){var s,i,l;switch(t==null?void 0:t.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return((s=t.streams)==null?void 0:s.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((i=t.consumers)==null?void 0:i.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${t==null?void 0:t.type}`),((l=t.streams)==null?void 0:l.length)||0}return 0}async*[Symbol.asyncIterator](){let t=await this.next();for(;t.length>0;){for(const s of t)yield s;t=await this.next()}}}function Ys(r=""){const t=r.match(/(\d+).(\d+).(\d+)/);if(t)return{major:parseInt(t[1]),minor:parseInt(t[2]),micro:parseInt(t[3])};throw new Error(`'${r}' is not a semver value`)}function md(r,t){return r.major<t.major?-1:r.major>t.major?1:r.minor<t.minor?-1:r.minor>t.minor?1:r.micro<t.micro?-1:r.micro>t.micro?1:0}var $e;(function(r){r.JS_KV="js_kv",r.JS_OBJECTSTORE="js_objectstore",r.JS_PULL_MAX_BYTES="js_pull_max_bytes",r.JS_NEW_CONSUMER_CREATE_API="js_new_consumer_create",r.JS_ALLOW_DIRECT="js_allow_direct",r.JS_MULTIPLE_CONSUMER_FILTER="js_multiple_consumer_filter",r.JS_SIMPLIFICATION="js_simplification",r.JS_STREAM_CONSUMER_METADATA="js_stream_consumer_metadata",r.JS_CONSUMER_FILTER_SUBJECTS="js_consumer_filter_subjects",r.JS_STREAM_FIRST_SEQ="js_stream_first_seq",r.JS_STREAM_SUBJECT_TRANSFORM="js_stream_subject_transform",r.JS_STREAM_SOURCE_SUBJECT_TRANSFORM="js_stream_source_subject_transform",r.JS_STREAM_COMPRESSION="js_stream_compression",r.JS_DEFAULT_CONSUMER_LIMITS="js_default_consumer_limits",r.JS_BATCH_DIRECT_GET="js_batch_direct_get"})($e||($e={}));class iE{constructor(t){j(this,"server");j(this,"features");j(this,"disabled");this.features=new Map,this.disabled=[],this.update(t)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(t){this.disabled.push(t),this.update(this.server)}isDisabled(t){return this.disabled.indexOf(t)!==-1}update(t){typeof t=="string"&&(t=Ys(t)),this.server=t,this.set($e.JS_KV,"2.6.2"),this.set($e.JS_OBJECTSTORE,"2.6.3"),this.set($e.JS_PULL_MAX_BYTES,"2.8.3"),this.set($e.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set($e.JS_ALLOW_DIRECT,"2.9.0"),this.set($e.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set($e.JS_SIMPLIFICATION,"2.9.4"),this.set($e.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set($e.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set($e.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set($e.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set($e.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set($e.JS_STREAM_COMPRESSION,"2.10.0"),this.set($e.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set($e.JS_BATCH_DIRECT_GET,"2.11.0"),this.disabled.forEach(s=>{this.features.delete(s)})}set(t,s){this.features.set(t,{min:s,ok:md(this.server,Ys(s))>=0})}get(t){return this.features.get(t)||{min:"unknown",ok:!1}}supports(t){var s;return((s=this.get(t))==null?void 0:s.ok)||!1}require(t){return typeof t=="string"&&(t=Ys(t)),md(this.server,t)>=0}}class au extends wo{constructor(t,s){super(t,s)}async add(t,s,i=iu.Create){if(Gt(t),s.deliver_group&&s.flow_control)throw new Error("jetstream flow control is not supported with queue groups");if(s.deliver_group&&s.idle_heartbeat)throw new Error("jetstream idle heartbeat is not supported with queue groups");const l={};l.config=s,l.stream_name=t,l.action=i,l.config.durable_name&&Fi(l.config.durable_name);const c=this.nc;let{min:d,ok:y}=c.features.get($e.JS_NEW_CONSUMER_CREATE_API);const g=s.name===""?void 0:s.name;if(g&&!y)throw new Error(`consumer 'name' requires server ${d}`);if(g)try{bu("name",g)}catch(x){const v=x.message,w=v.indexOf("cannot contain");throw w!==-1?new Error(`consumer 'name' ${v.substring(w)}`):x}let f,m="";if(Array.isArray(s.filter_subjects)){const{min:x,ok:v}=c.features.get($e.JS_MULTIPLE_CONSUMER_FILTER);if(!v)throw new Error(`consumer 'filter_subjects' requires server ${x}`);y=!1}if(s.metadata){const{min:x,ok:v}=c.features.get($e.JS_STREAM_CONSUMER_METADATA);if(!v)throw new Error(`consumer 'metadata' requires server ${x}`)}if(y&&(m=s.name??s.durable_name??""),m!==""){let x=s.filter_subject??void 0;x===">"&&(x=void 0),f=x!==void 0?`${this.prefix}.CONSUMER.CREATE.${t}.${m}.${x}`:`${this.prefix}.CONSUMER.CREATE.${t}.${m}`}else f=s.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${t}.${s.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${t}`;return await this._request(f,l)}async update(t,s,i){const l=await this.info(t,s),c=i;return this.add(t,Object.assign(l.config,c),iu.Update)}async info(t,s){return Gt(t),Fi(s),await this._request(`${this.prefix}.CONSUMER.INFO.${t}.${s}`)}async delete(t,s){return Gt(t),Fi(s),(await this._request(`${this.prefix}.CONSUMER.DELETE.${t}.${s}`)).success}list(t){Gt(t);const s=l=>l.consumers,i=`${this.prefix}.CONSUMER.LIST.${t}`;return new co(i,s,this)}pause(t,s,i){const l=`${this.prefix}.CONSUMER.PAUSE.${t}.${s}`,c={pause_until:i.toISOString()};return this._request(l,c)}resume(t,s){return this.pause(t,s,new Date(0))}}function qi(r,t,s=!1){if(s===!0&&!r)throw de.errorForCode(ce.ApiError,new Error(`${t} is not a function`));if(r&&typeof r!="function")throw de.errorForCode(ce.ApiError,new Error(`${t} is not a function`))}class aE extends Mt{constructor(s,i,l){super();j(this,"sub");j(this,"adapter");j(this,"subIterDone");qi(l.adapter,"adapter",!0),this.adapter=l.adapter,l.callback&&qi(l.callback,"callback"),this.noIterator=typeof l.callback=="function",l.ingestionFilterFn&&(qi(l.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=l.ingestionFilterFn),l.protocolFilterFn&&(qi(l.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=l.protocolFilterFn),l.dispatchedFn&&(qi(l.dispatchedFn,"dispatchedFn"),this.dispatchedFn=l.dispatchedFn),l.cleanupFn&&qi(l.cleanupFn,"cleanupFn");let c=(m,b)=>{this.callback(m,b)};if(l.callback){const m=l.callback;c=(b,x)=>{const[v,w]=this.adapter(b,x);if(v){m(v,null);return}const{ingest:S}=this.ingestionFilterFn?this.ingestionFilterFn(w,this):{ingest:!0};S&&(!this.protocolFilterFn||this.protocolFilterFn(w))&&(m(v,w),this.dispatchedFn&&w&&this.dispatchedFn(w))}}const{max:d,queue:y,timeout:g}=l,f={queue:y,timeout:g,callback:c};d&&d>0&&(f.max=d),this.sub=s.subscribe(i,f),l.cleanupFn&&(this.sub.cleanupFn=l.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=ft(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async m=>{await m.closed,this.stop()})(this.sub).then().catch()}unsubscribe(s){this.sub.unsubscribe(s)}drain(){return this.sub.drain()}isDraining(){return this.sub.isDraining()}isClosed(){return this.sub.isClosed()}callback(s,i){this.sub.cancelTimeout();const[l,c]=this.adapter(s,i);l&&this.stop(l),c&&this.push(c)}getSubject(){return this.sub.getSubject()}getReceived(){return this.sub.getReceived()}getProcessed(){return this.sub.getProcessed()}getPending(){return this.sub.getPending()}getID(){return this.sub.getID()}getMax(){return this.sub.getMax()}get closed(){return this.sub.closed}}let bn;function oE(r){bn=r}function Yb(){return bn!==void 0&&bn.defaultPort!==void 0?bn.defaultPort:4222}function Gh(){return bn!==void 0&&bn.urlParseFn?bn.urlParseFn:void 0}function lE(){if(!bn||typeof bn.factory!="function")throw new Error("transport fn is not set");return bn.factory()}function pd(){return bn!==void 0&&bn.dnsResolveFn?bn.dnsResolveFn:void 0}const Jc=`\r
|
|
37
|
+
`,ou=Qi.fromAscii(Jc),cE=new Uint8Array(ou)[0],uE=new Uint8Array(ou)[1];function fE(r){for(let t=0;t<r.length;t++){const s=t+1;if(r.byteLength>s&&r[t]===cE&&r[s]===uE)return s+1}return 0}function hE(r){const t=fE(r);if(t>0){const i=new Uint8Array(r).slice(0,t);return gn.decode(i)}return""}const dE=4,Kb=48,mE=65,pE=97;function yE(r,t,s,i){const l=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((d,y)=>{l[y]=d}),l[12]=r,l[13]=t,l[14]=s,l[15]=i,l}function yd(r){return gE(r)!==void 0}function gE(r){for(let t=0;t<r.length;t++)switch(r[t]){case".":return Jb(r);case":":return bE(r)}}function Jb(r){const t=new Uint8Array(4);for(let s=0;s<4;s++){if(r.length===0)return;if(s>0){if(r[0]!==".")return;r=r.substring(1)}const{n:i,c:l,ok:c}=xE(r);if(!c||i>255)return;r=r.substring(l),t[s]=i}return yE(t[0],t[1],t[2],t[3])}function bE(r){const t=new Uint8Array(16);let s=-1;if(r.length>=2&&r[0]===":"&&r[1]===":"&&(s=0,r=r.substring(2),r.length===0))return t;let i=0;for(;i<16;){const{n:l,c,ok:d}=vE(r);if(!d||l>65535)return;if(c<r.length&&r[c]==="."){if(s<0&&i!=12||i+4>16)return;const y=Jb(r);if(y===void 0)return;t[i]=y[12],t[i+1]=y[13],t[i+2]=y[14],t[i+3]=y[15],r="",i+=dE;break}if(t[i]=l>>8,t[i+1]=l,i+=2,r=r.substring(c),r.length===0)break;if(r[0]!==":"||r.length==1)return;if(r=r.substring(1),r[0]===":"){if(s>=0)return;if(s=i,r=r.substring(1),r.length===0)break}}if(r.length===0){if(i<16){if(s<0)return;const l=16-i;for(let c=i-1;c>=s;c--)t[c+l]=t[c];for(let c=s+l-1;c>=s;c--)t[c]=0}else if(s>=0)return;return t}}function xE(r){let t=0,s=0;for(t=0;t<r.length&&48<=r.charCodeAt(t)&&r.charCodeAt(t)<=57;t++)if(s=s*10+(r.charCodeAt(t)-Kb),s>=16777215)return{n:16777215,c:t,ok:!1};return t===0?{n:0,c:0,ok:!1}:{n:s,c:t,ok:!0}}function vE(r){let t=0,s=0;for(s=0;s<r.length;s++){if(48<=r.charCodeAt(s)&&r.charCodeAt(s)<=57)t*=16,t+=r.charCodeAt(s)-Kb;else if(97<=r.charCodeAt(s)&&r.charCodeAt(s)<=102)t*=16,t+=r.charCodeAt(s)-pE+10;else if(65<=r.charCodeAt(s)&&r.charCodeAt(s)<=70)t*=16,t+=r.charCodeAt(s)-mE+10;else break;if(t>=16777215)return{n:0,c:s,ok:!1}}return s===0?{n:0,c:s,ok:!1}:{n:t,c:s,ok:!0}}function _E(r){return r.indexOf("[")!==-1||r.indexOf("::")!==-1?!1:r.indexOf(".")!==-1||r.split(":").length<=2}function gd(r){return!_E(r)}function wE(r){const t="::FFFF:",s=r.toUpperCase().indexOf(t);if(s!==-1&&r.indexOf(".")!==-1){let i=r.substring(s+t.length);return i=i.replace("[",""),i.replace("]","")}return r}function SE(r){r=r.trim(),r.match(/^(.*:\/\/)(.*)/m)&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2")),r=wE(r),gd(r)&&r.indexOf("[")===-1&&(r=`[${r}]`);const t=gd(r)?r.match(/(]:)(\d+)/):r.match(/(:)(\d+)/),s=t&&t.length===3&&t[1]&&t[2]?parseInt(t[2]):4222,i=s===80?"https":"http",l=new URL(`${i}://${r}`);l.port=`${s}`;let c=l.hostname;return c.charAt(0)==="["&&(c=c.substring(1,c.length-1)),{listen:l.host,hostname:c,port:s}}class mo{constructor(t,s=!1){j(this,"src");j(this,"listen");j(this,"hostname");j(this,"port");j(this,"didConnect");j(this,"reconnects");j(this,"lastConnect");j(this,"gossiped");j(this,"tlsName");j(this,"resolves");this.src=t,this.tlsName="";const i=SE(t);this.listen=i.listen,this.hostname=i.hostname,this.port=i.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=s}toString(){return this.listen}async resolve(t){if(!t.fn||t.resolve===!1)return[this];const s=[];if(yd(this.hostname))return[this];{const i=await t.fn(this.hostname);t.debug&&console.log(`resolve ${this.hostname} = ${i.join(",")}`);for(const l of i){const c=this.port===80?"https":"http",d=new URL(`${c}://${gd(l)?"["+l+"]":l}`);d.port=`${this.port}`;const y=new mo(d.host,!1);y.tlsName=this.hostname,s.push(y)}}return t.randomize&&$b(s),this.resolves=s,s}}class EE{constructor(t=[],s={}){j(this,"firstSelect");j(this,"servers");j(this,"currentServer");j(this,"tlsName");j(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=s.randomize||!1;const i=Gh();t&&(t.forEach(l=>{l=i?i(l):l,this.servers.push(new mo(l))}),this.randomize&&(this.servers=$b(this.servers))),this.servers.length===0&&this.addServer(`${od}:${Yb()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const t=this.getCurrentServer();yd(t.hostname)||(this.tlsName=t.hostname,this.servers.forEach(s=>{s.gossiped&&(s.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(t,s=!1){const i=Gh();t=i?i(t):t;const l=new mo(t,s);yd(l.hostname)&&(l.tlsName=this.tlsName),this.servers.push(l)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const t=this.servers.shift();return t&&(this.servers.push(t),this.currentServer=t),t}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(t){if(t){const s=this.servers.indexOf(t);this.servers.splice(s,1)}}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update(t,s){const i=[];let l=[];const c=Gh(),d=new Map;t.connect_urls&&t.connect_urls.length>0&&t.connect_urls.forEach(g=>{g=c?c(g,s):g;const f=new mo(g,!0);d.set(g,f)});const y=[];return this.servers.forEach((g,f)=>{const m=g.listen;g.gossiped&&this.currentServer.listen!==m&&d.get(m)===void 0&&y.push(f),d.delete(m)}),y.reverse(),y.forEach(g=>{const f=this.servers.splice(g,1);l=l.concat(f[0].listen)}),d.forEach((g,f)=>{this.servers.push(g),i.push(f)}),{added:i,deleted:l}}}class OE{constructor(){j(this,"baseInbox");j(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(t){return this.baseInbox=`${Tr(t)}.`,this.baseInbox}add(t){isNaN(t.received)||(t.received=0),this.reqs.set(t.token,t)}get(t){return this.reqs.get(t)}cancel(t){this.reqs.delete(t.token)}getToken(t){const s=t.subject||"";return s.indexOf(this.baseInbox)===0?s.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(t,s){if(s&&s.permissionContext){if(t)return this.all().forEach(l=>{l.resolver(s,{})}),!0;const i=s.permissionContext;if(i.operation==="publish"){const l=this.all().find(c=>c.requestSubject===i.subject);if(l)return l.resolver(s,{}),!0}}return!1}dispatcher(){return(t,s)=>{const i=this.getToken(s);if(i){const l=this.get(i);l&&(t===null&&s.headers&&(t=Hb(s)),l.resolver(t,s))}}}close(){const t=de.errorForCode(ce.Timeout);this.reqs.forEach(s=>{s.resolver(t,{})})}}class AE{constructor(t,s,i){j(this,"ph");j(this,"interval");j(this,"maxOut");j(this,"timer");j(this,"pendings");this.ph=t,this.interval=s,this.maxOut=i,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(t){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),t&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:Hi.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const t=ft();this.ph.flush(t).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(t),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(t=>(t.resolve(),!1))}}class jE extends Error{constructor(t){super(t),this.name="AssertionError"}}function kE(r,t="Assertion failed."){if(!r)throw new jE(t)}const Mg=32*1024,Vh=2**32-2;function Zl(r,t,s=0){const i=t.byteLength-s;return r.byteLength>i&&(r=r.subarray(0,i)),t.set(r,s),r.byteLength}class Yh{constructor(t){j(this,"_buf");j(this,"_off");if(this._off=0,t==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(t)}bytes(t={copy:!0}){return t.copy===!1?this._buf.subarray(this._off):this._buf.slice(this._off)}empty(){return this._buf.byteLength<=this._off}get length(){return this._buf.byteLength-this._off}get capacity(){return this._buf.buffer.byteLength}truncate(t){if(t===0){this.reset();return}if(t<0||t>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+t)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(t){const s=this._buf.byteLength;return t<=this.capacity-s?(this._reslice(s+t),s):-1}_reslice(t){kE(t<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,t)}readByte(){const t=new Uint8Array(1);return this.read(t)?t[0]:null}read(t){if(this.empty())return this.reset(),t.byteLength===0?0:null;const s=Zl(this._buf.subarray(this._off),t);return this._off+=s,s}writeByte(t){return this.write(Uint8Array.of(t))}writeString(t){return this.write(Ks.encode(t))}write(t){const s=this._grow(t.byteLength);return Zl(t,this._buf,s)}_grow(t){const s=this.length;s===0&&this._off!==0&&this.reset();const i=this._tryGrowByReslice(t);if(i>=0)return i;const l=this.capacity;if(t<=Math.floor(l/2)-s)Zl(this._buf.subarray(this._off),this._buf);else{if(l+t>Vh)throw new Error("The buffer cannot be grown beyond the maximum size.");{const c=new Uint8Array(Math.min(2*l+t,Vh));Zl(this._buf.subarray(this._off),c),this._buf=c}}return this._off=0,this._reslice(Math.min(s+t,Vh)),s}grow(t){if(t<0)throw Error("Buffer._grow: negative count");const s=this._grow(t);this._reslice(s)}readFrom(t){let s=0;const i=new Uint8Array(Mg);for(;;){const l=this.capacity-this.length<Mg,c=l?i:new Uint8Array(this._buf.buffer,this.length),d=t.read(c);if(d===null)return s;l?this.write(c.subarray(0,d)):this._reslice(this.length+d),s+=d}}}var Vt;(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"})(Vt||(Vt={}));function Rg(){const r={};return r.sid=-1,r.hdr=-1,r.size=-1,r}const NE=48;class Dg{constructor(t){j(this,"dispatcher");j(this,"state");j(this,"as");j(this,"drop");j(this,"hdr");j(this,"ma");j(this,"argBuf");j(this,"msgBuf");this.dispatcher=t,this.state=ue.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(t){let s;for(s=0;s<t.length;s++){const i=t[s];switch(this.state){case ue.OP_START:switch(i){case fe.M:case fe.m:this.state=ue.OP_M,this.hdr=-1,this.ma=Rg();break;case fe.H:case fe.h:this.state=ue.OP_H,this.hdr=0,this.ma=Rg();break;case fe.P:case fe.p:this.state=ue.OP_P;break;case fe.PLUS:this.state=ue.OP_PLUS;break;case fe.MINUS:this.state=ue.OP_MINUS;break;case fe.I:case fe.i:this.state=ue.OP_I;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_H:switch(i){case fe.M:case fe.m:this.state=ue.OP_M;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_M:switch(i){case fe.S:case fe.s:this.state=ue.OP_MS;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_MS:switch(i){case fe.G:case fe.g:this.state=ue.OP_MSG;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_MSG:switch(i){case fe.SPACE:case fe.TAB:this.state=ue.OP_MSG_SPC;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_MSG_SPC:switch(i){case fe.SPACE:case fe.TAB:continue;default:this.state=ue.MSG_ARG,this.as=s}break;case ue.MSG_ARG:switch(i){case fe.CR:this.drop=1;break;case fe.NL:{const l=this.argBuf?this.argBuf.bytes():t.subarray(this.as,s-this.drop);this.processMsgArgs(l),this.drop=0,this.as=s+1,this.state=ue.MSG_PAYLOAD,s=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(i)}break;case ue.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const l=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:Vt.MSG,msg:this.ma,data:l}),this.argBuf=void 0,this.msgBuf=void 0,this.state=ue.MSG_END}else{let l=this.ma.size-this.msgBuf.length;const c=t.length-s;c<l&&(l=c),l>0?(this.msgBuf.write(t.subarray(s,s+l)),s=s+l-1):this.msgBuf.writeByte(i)}else s-this.as>=this.ma.size&&(this.dispatcher.push({kind:Vt.MSG,msg:this.ma,data:t.subarray(this.as,s)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=ue.MSG_END);break;case ue.MSG_END:switch(i){case fe.NL:this.drop=0,this.as=s+1,this.state=ue.OP_START;break;default:continue}break;case ue.OP_PLUS:switch(i){case fe.O:case fe.o:this.state=ue.OP_PLUS_O;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_PLUS_O:switch(i){case fe.K:case fe.k:this.state=ue.OP_PLUS_OK;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_PLUS_OK:switch(i){case fe.NL:this.dispatcher.push({kind:Vt.OK}),this.drop=0,this.state=ue.OP_START;break}break;case ue.OP_MINUS:switch(i){case fe.E:case fe.e:this.state=ue.OP_MINUS_E;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_MINUS_E:switch(i){case fe.R:case fe.r:this.state=ue.OP_MINUS_ER;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_MINUS_ER:switch(i){case fe.R:case fe.r:this.state=ue.OP_MINUS_ERR;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_MINUS_ERR:switch(i){case fe.SPACE:case fe.TAB:this.state=ue.OP_MINUS_ERR_SPC;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_MINUS_ERR_SPC:switch(i){case fe.SPACE:case fe.TAB:continue;default:this.state=ue.MINUS_ERR_ARG,this.as=s}break;case ue.MINUS_ERR_ARG:switch(i){case fe.CR:this.drop=1;break;case fe.NL:{let l;this.argBuf?(l=this.argBuf.bytes(),this.argBuf=void 0):l=t.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Vt.ERR,data:l}),this.drop=0,this.as=s+1,this.state=ue.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(i))}break;case ue.OP_P:switch(i){case fe.I:case fe.i:this.state=ue.OP_PI;break;case fe.O:case fe.o:this.state=ue.OP_PO;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_PO:switch(i){case fe.N:case fe.n:this.state=ue.OP_PON;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_PON:switch(i){case fe.G:case fe.g:this.state=ue.OP_PONG;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_PONG:switch(i){case fe.NL:this.dispatcher.push({kind:Vt.PONG}),this.drop=0,this.state=ue.OP_START;break}break;case ue.OP_PI:switch(i){case fe.N:case fe.n:this.state=ue.OP_PIN;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_PIN:switch(i){case fe.G:case fe.g:this.state=ue.OP_PING;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_PING:switch(i){case fe.NL:this.dispatcher.push({kind:Vt.PING}),this.drop=0,this.state=ue.OP_START;break}break;case ue.OP_I:switch(i){case fe.N:case fe.n:this.state=ue.OP_IN;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_IN:switch(i){case fe.F:case fe.f:this.state=ue.OP_INF;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_INF:switch(i){case fe.O:case fe.o:this.state=ue.OP_INFO;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_INFO:switch(i){case fe.SPACE:case fe.TAB:this.state=ue.OP_INFO_SPC;break;default:throw this.fail(t.subarray(s))}break;case ue.OP_INFO_SPC:switch(i){case fe.SPACE:case fe.TAB:continue;default:this.state=ue.INFO_ARG,this.as=s}break;case ue.INFO_ARG:switch(i){case fe.CR:this.drop=1;break;case fe.NL:{let l;this.argBuf?(l=this.argBuf.bytes(),this.argBuf=void 0):l=t.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Vt.INFO,data:l}),this.drop=0,this.as=s+1,this.state=ue.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(i)}break;default:throw this.fail(t.subarray(s))}}(this.state===ue.MSG_ARG||this.state===ue.MINUS_ERR_ARG||this.state===ue.INFO_ARG)&&!this.argBuf&&(this.argBuf=new Yh(t.subarray(this.as,s-this.drop))),this.state===ue.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new Yh(t.subarray(this.as)))}cloneMsgArg(){const t=this.ma.subject.length,s=this.ma.reply?this.ma.reply.length:0,i=new Uint8Array(t+s);i.set(this.ma.subject),this.ma.reply&&i.set(this.ma.reply,t),this.argBuf=new Yh(i),this.ma.subject=i.subarray(0,t),this.ma.reply&&(this.ma.reply=i.subarray(t))}processMsgArgs(t){if(this.hdr>=0)return this.processHeaderMsgArgs(t);const s=[];let i=-1;for(let l=0;l<t.length;l++)switch(t[l]){case fe.SPACE:case fe.TAB:case fe.CR:case fe.NL:i>=0&&(s.push(t.subarray(i,l)),i=-1);break;default:i<0&&(i=l)}switch(i>=0&&s.push(t.subarray(i)),s.length){case 3:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(s[2]);break;case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.size=this.protoParseInt(s[3]);break;default:throw this.fail(t,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(t,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(t,"processMsgArgs Bad or Missing Size Error")}fail(t,s=""){return s?s=`${s} [${this.state}]`:s=`parse error [${this.state}]`,new Error(`${s}: ${gn.decode(t)}`)}processHeaderMsgArgs(t){const s=[];let i=-1;for(let l=0;l<t.length;l++)switch(t[l]){case fe.SPACE:case fe.TAB:case fe.CR:case fe.NL:i>=0&&(s.push(t.subarray(i,l)),i=-1);break;default:i<0&&(i=l)}switch(i>=0&&s.push(t.subarray(i)),s.length){case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(s[2]),this.ma.size=this.protoParseInt(s[3]);break;case 5:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.hdr=this.protoParseInt(s[3]),this.ma.size=this.protoParseInt(s[4]);break;default:throw this.fail(t,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(t){if(t.length===0)return-1;let s=0;for(let i=0;i<t.length;i++){if(t[i]<48||t[i]>57)return-1;s=s*10+(t[i]-NE)}return s}}var ue;(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"})(ue||(ue={}));var fe;(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"})(fe||(fe={}));(function(r){var t=function(O,N){this.hi=O|0,this.lo=N|0},s=function(O){var N,k=new Float64Array(16);if(O)for(N=0;N<O.length;N++)k[N]=O[N];return k},i=function(){throw new Error("no PRNG")},l=new Uint8Array(16),c=new Uint8Array(32);c[0]=9;var d=s(),y=s([1]),g=s([56129,1]),f=s([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),m=s([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),b=s([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),x=s([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),v=s([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function w(O,N){return O<<N|O>>>32-N}function S(O,N){var k=O[N+3]&255;return k=k<<8|O[N+2]&255,k=k<<8|O[N+1]&255,k<<8|O[N+0]&255}function C(O,N){var k=O[N]<<24|O[N+1]<<16|O[N+2]<<8|O[N+3],T=O[N+4]<<24|O[N+5]<<16|O[N+6]<<8|O[N+7];return new t(k,T)}function L(O,N,k){var T;for(T=0;T<4;T++)O[N+T]=k&255,k>>>=8}function U(O,N,k){O[N]=k.hi>>24&255,O[N+1]=k.hi>>16&255,O[N+2]=k.hi>>8&255,O[N+3]=k.hi&255,O[N+4]=k.lo>>24&255,O[N+5]=k.lo>>16&255,O[N+6]=k.lo>>8&255,O[N+7]=k.lo&255}function ne(O,N,k,T,q){var I,te=0;for(I=0;I<q;I++)te|=O[N+I]^k[T+I];return(1&te-1>>>8)-1}function se(O,N,k,T){return ne(O,N,k,T,16)}function D(O,N,k,T){return ne(O,N,k,T,32)}function z(O,N,k,T,q){var I=new Uint32Array(16),te=new Uint32Array(16),ie=new Uint32Array(16),V=new Uint32Array(4),ee,pe,De;for(ee=0;ee<4;ee++)te[5*ee]=S(T,4*ee),te[1+ee]=S(k,4*ee),te[6+ee]=S(N,4*ee),te[11+ee]=S(k,16+4*ee);for(ee=0;ee<16;ee++)ie[ee]=te[ee];for(ee=0;ee<20;ee++){for(pe=0;pe<4;pe++){for(De=0;De<4;De++)V[De]=te[(5*pe+4*De)%16];for(V[1]^=w(V[0]+V[3]|0,7),V[2]^=w(V[1]+V[0]|0,9),V[3]^=w(V[2]+V[1]|0,13),V[0]^=w(V[3]+V[2]|0,18),De=0;De<4;De++)I[4*pe+(pe+De)%4]=V[De]}for(De=0;De<16;De++)te[De]=I[De]}if(q){for(ee=0;ee<16;ee++)te[ee]=te[ee]+ie[ee]|0;for(ee=0;ee<4;ee++)te[5*ee]=te[5*ee]-S(T,4*ee)|0,te[6+ee]=te[6+ee]-S(N,4*ee)|0;for(ee=0;ee<4;ee++)L(O,4*ee,te[5*ee]),L(O,16+4*ee,te[6+ee])}else for(ee=0;ee<16;ee++)L(O,4*ee,te[ee]+ie[ee]|0)}function ae(O,N,k,T){return z(O,N,k,T,!1),0}function X(O,N,k,T){return z(O,N,k,T,!0),0}var M=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function $(O,N,k,T,q,I,te){var ie=new Uint8Array(16),V=new Uint8Array(64),ee,pe;if(!q)return 0;for(pe=0;pe<16;pe++)ie[pe]=0;for(pe=0;pe<8;pe++)ie[pe]=I[pe];for(;q>=64;){for(ae(V,ie,te,M),pe=0;pe<64;pe++)O[N+pe]=(k?k[T+pe]:0)^V[pe];for(ee=1,pe=8;pe<16;pe++)ee=ee+(ie[pe]&255)|0,ie[pe]=ee&255,ee>>>=8;q-=64,N+=64,k&&(T+=64)}if(q>0)for(ae(V,ie,te,M),pe=0;pe<q;pe++)O[N+pe]=(k?k[T+pe]:0)^V[pe];return 0}function Z(O,N,k,T,q){return $(O,N,null,0,k,T,q)}function J(O,N,k,T,q){var I=new Uint8Array(32);return X(I,T,q,M),Z(O,N,k,T.subarray(16),I)}function le(O,N,k,T,q,I,te){var ie=new Uint8Array(32);return X(ie,I,te,M),$(O,N,k,T,q,I.subarray(16),ie)}function ve(O,N){var k,T=0;for(k=0;k<17;k++)T=T+(O[k]+N[k]|0)|0,O[k]=T&255,T>>>=8}var Re=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function Y(O,N,k,T,q,I){var te,ie,V,ee,pe=new Uint32Array(17),De=new Uint32Array(17),st=new Uint32Array(17),zt=new Uint32Array(17),In=new Uint32Array(17);for(V=0;V<17;V++)De[V]=st[V]=0;for(V=0;V<16;V++)De[V]=I[V];for(De[3]&=15,De[4]&=252,De[7]&=15,De[8]&=252,De[11]&=15,De[12]&=252,De[15]&=15;q>0;){for(V=0;V<17;V++)zt[V]=0;for(V=0;V<16&&V<q;++V)zt[V]=k[T+V];for(zt[V]=1,T+=V,q-=V,ve(st,zt),ie=0;ie<17;ie++)for(pe[ie]=0,V=0;V<17;V++)pe[ie]=pe[ie]+st[V]*(V<=ie?De[ie-V]:320*De[ie+17-V]|0)|0|0;for(ie=0;ie<17;ie++)st[ie]=pe[ie];for(ee=0,V=0;V<16;V++)ee=ee+st[V]|0,st[V]=ee&255,ee>>>=8;for(ee=ee+st[16]|0,st[16]=ee&3,ee=5*(ee>>>2)|0,V=0;V<16;V++)ee=ee+st[V]|0,st[V]=ee&255,ee>>>=8;ee=ee+st[16]|0,st[16]=ee}for(V=0;V<17;V++)In[V]=st[V];for(ve(st,Re),te=-(st[16]>>>7)|0,V=0;V<17;V++)st[V]^=te&(In[V]^st[V]);for(V=0;V<16;V++)zt[V]=I[V+16];for(zt[16]=0,ve(st,zt),V=0;V<16;V++)O[N+V]=st[V];return 0}function oe(O,N,k,T,q,I){var te=new Uint8Array(16);return Y(te,0,k,T,q,I),se(O,N,te,0)}function he(O,N,k,T,q){var I;if(k<32)return-1;for(le(O,0,N,0,k,T,q),Y(O,16,O,32,k-32,O),I=0;I<16;I++)O[I]=0;return 0}function Ae(O,N,k,T,q){var I,te=new Uint8Array(32);if(k<32||(J(te,0,32,T,q),oe(N,16,N,32,k-32,te)!==0))return-1;for(le(O,0,N,0,k,T,q),I=0;I<32;I++)O[I]=0;return 0}function _e(O,N){var k;for(k=0;k<16;k++)O[k]=N[k]|0}function Ne(O){var N,k;for(k=0;k<16;k++)O[k]+=65536,N=Math.floor(O[k]/65536),O[(k+1)*(k<15?1:0)]+=N-1+37*(N-1)*(k===15?1:0),O[k]-=N*65536}function je(O,N,k){for(var T,q=~(k-1),I=0;I<16;I++)T=q&(O[I]^N[I]),O[I]^=T,N[I]^=T}function Te(O,N){var k,T,q,I=s(),te=s();for(k=0;k<16;k++)te[k]=N[k];for(Ne(te),Ne(te),Ne(te),T=0;T<2;T++){for(I[0]=te[0]-65517,k=1;k<15;k++)I[k]=te[k]-65535-(I[k-1]>>16&1),I[k-1]&=65535;I[15]=te[15]-32767-(I[14]>>16&1),q=I[15]>>16&1,I[14]&=65535,je(te,I,1-q)}for(k=0;k<16;k++)O[2*k]=te[k]&255,O[2*k+1]=te[k]>>8}function rt(O,N){var k=new Uint8Array(32),T=new Uint8Array(32);return Te(k,O),Te(T,N),D(k,0,T,0)}function Oe(O){var N=new Uint8Array(32);return Te(N,O),N[0]&1}function ot(O,N){var k;for(k=0;k<16;k++)O[k]=N[2*k]+(N[2*k+1]<<8);O[15]&=32767}function yt(O,N,k){var T;for(T=0;T<16;T++)O[T]=N[T]+k[T]|0}function jt(O,N,k){var T;for(T=0;T<16;T++)O[T]=N[T]-k[T]|0}function ke(O,N,k){var T,q,I=new Float64Array(31);for(T=0;T<31;T++)I[T]=0;for(T=0;T<16;T++)for(q=0;q<16;q++)I[T+q]+=N[T]*k[q];for(T=0;T<15;T++)I[T]+=38*I[T+16];for(T=0;T<16;T++)O[T]=I[T];Ne(O),Ne(O)}function be(O,N){ke(O,N,N)}function _t(O,N){var k=s(),T;for(T=0;T<16;T++)k[T]=N[T];for(T=253;T>=0;T--)be(k,k),T!==2&&T!==4&&ke(k,k,N);for(T=0;T<16;T++)O[T]=k[T]}function $t(O,N){var k=s(),T;for(T=0;T<16;T++)k[T]=N[T];for(T=250;T>=0;T--)be(k,k),T!==1&&ke(k,k,N);for(T=0;T<16;T++)O[T]=k[T]}function En(O,N,k){var T=new Uint8Array(32),q=new Float64Array(80),I,te,ie=s(),V=s(),ee=s(),pe=s(),De=s(),st=s();for(te=0;te<31;te++)T[te]=N[te];for(T[31]=N[31]&127|64,T[0]&=248,ot(q,k),te=0;te<16;te++)V[te]=q[te],pe[te]=ie[te]=ee[te]=0;for(ie[0]=pe[0]=1,te=254;te>=0;--te)I=T[te>>>3]>>>(te&7)&1,je(ie,V,I),je(ee,pe,I),yt(De,ie,ee),jt(ie,ie,ee),yt(ee,V,pe),jt(V,V,pe),be(pe,De),be(st,ie),ke(ie,ee,ie),ke(ee,V,De),yt(De,ie,ee),jt(ie,ie,ee),be(V,ie),jt(ee,pe,st),ke(ie,ee,g),yt(ie,ie,pe),ke(ee,ee,ie),ke(ie,pe,st),ke(pe,V,q),be(V,De),je(ie,V,I),je(ee,pe,I);for(te=0;te<16;te++)q[te+16]=ie[te],q[te+32]=ee[te],q[te+48]=V[te],q[te+64]=pe[te];var zt=q.subarray(32),In=q.subarray(16);return _t(zt,zt),ke(In,In,zt),Te(O,In),0}function Ut(O,N){return En(O,N,c)}function Xs(O,N){return i(N,32),Ut(O,N)}function Dr(O,N,k){var T=new Uint8Array(32);return En(T,k,N),X(O,l,T,M)}var No=he,To=Ae;function na(O,N,k,T,q,I){var te=new Uint8Array(32);return Dr(te,q,I),No(O,N,k,T,te)}function ra(O,N,k,T,q,I){var te=new Uint8Array(32);return Dr(te,q,I),To(O,N,k,T,te)}function ar(){var O=0,N=0,k=0,T=0,q=65535,I,te,ie;for(ie=0;ie<arguments.length;ie++)I=arguments[ie].lo,te=arguments[ie].hi,O+=I&q,N+=I>>>16,k+=te&q,T+=te>>>16;return N+=O>>>16,k+=N>>>16,T+=k>>>16,new t(k&q|T<<16,O&q|N<<16)}function Co(O,N){return new t(O.hi>>>N,O.lo>>>N|O.hi<<32-N)}function Qs(){var O=0,N=0,k;for(k=0;k<arguments.length;k++)O^=arguments[k].lo,N^=arguments[k].hi;return new t(N,O)}function lt(O,N){var k,T,q=32-N;return N<32?(k=O.hi>>>N|O.lo<<q,T=O.lo>>>N|O.hi<<q):N<64&&(k=O.lo>>>N|O.hi<<q,T=O.hi>>>N|O.lo<<q),new t(k,T)}function ku(O,N,k){var T=O.hi&N.hi^~O.hi&k.hi,q=O.lo&N.lo^~O.lo&k.lo;return new t(T,q)}function Mo(O,N,k){var T=O.hi&N.hi^O.hi&k.hi^N.hi&k.hi,q=O.lo&N.lo^O.lo&k.lo^N.lo&k.lo;return new t(T,q)}function Ro(O){return Qs(lt(O,28),lt(O,34),lt(O,39))}function Zs(O){return Qs(lt(O,14),lt(O,18),lt(O,41))}function Nu(O){return Qs(lt(O,1),lt(O,8),Co(O,7))}function Do(O){return Qs(lt(O,19),lt(O,61),Co(O,6))}var Tu=[new t(1116352408,3609767458),new t(1899447441,602891725),new t(3049323471,3964484399),new t(3921009573,2173295548),new t(961987163,4081628472),new t(1508970993,3053834265),new t(2453635748,2937671579),new t(2870763221,3664609560),new t(3624381080,2734883394),new t(310598401,1164996542),new t(607225278,1323610764),new t(1426881987,3590304994),new t(1925078388,4068182383),new t(2162078206,991336113),new t(2614888103,633803317),new t(3248222580,3479774868),new t(3835390401,2666613458),new t(4022224774,944711139),new t(264347078,2341262773),new t(604807628,2007800933),new t(770255983,1495990901),new t(1249150122,1856431235),new t(1555081692,3175218132),new t(1996064986,2198950837),new t(2554220882,3999719339),new t(2821834349,766784016),new t(2952996808,2566594879),new t(3210313671,3203337956),new t(3336571891,1034457026),new t(3584528711,2466948901),new t(113926993,3758326383),new t(338241895,168717936),new t(666307205,1188179964),new t(773529912,1546045734),new t(1294757372,1522805485),new t(1396182291,2643833823),new t(1695183700,2343527390),new t(1986661051,1014477480),new t(2177026350,1206759142),new t(2456956037,344077627),new t(2730485921,1290863460),new t(2820302411,3158454273),new t(3259730800,3505952657),new t(3345764771,106217008),new t(3516065817,3606008344),new t(3600352804,1432725776),new t(4094571909,1467031594),new t(275423344,851169720),new t(430227734,3100823752),new t(506948616,1363258195),new t(659060556,3750685593),new t(883997877,3785050280),new t(958139571,3318307427),new t(1322822218,3812723403),new t(1537002063,2003034995),new t(1747873779,3602036899),new t(1955562222,1575990012),new t(2024104815,1125592928),new t(2227730452,2716904306),new t(2361852424,442776044),new t(2428436474,593698344),new t(2756734187,3733110249),new t(3204031479,2999351573),new t(3329325298,3815920427),new t(3391569614,3928383900),new t(3515267271,566280711),new t(3940187606,3454069534),new t(4118630271,4000239992),new t(116418474,1914138554),new t(174292421,2731055270),new t(289380356,3203993006),new t(460393269,320620315),new t(685471733,587496836),new t(852142971,1086792851),new t(1017036298,365543100),new t(1126000580,2618297676),new t(1288033470,3409855158),new t(1501505948,4234509866),new t(1607167915,987167468),new t(1816402316,1246189591)];function qo(O,N,k){var T=[],q=[],I=[],te=[],ie,V,ee;for(V=0;V<8;V++)T[V]=I[V]=C(O,8*V);for(var pe=0;k>=128;){for(V=0;V<16;V++)te[V]=C(N,8*V+pe);for(V=0;V<80;V++){for(ee=0;ee<8;ee++)q[ee]=I[ee];for(ie=ar(I[7],Zs(I[4]),ku(I[4],I[5],I[6]),Tu[V],te[V%16]),q[7]=ar(ie,Ro(I[0]),Mo(I[0],I[1],I[2])),q[3]=ar(q[3],ie),ee=0;ee<8;ee++)I[(ee+1)%8]=q[ee];if(V%16===15)for(ee=0;ee<16;ee++)te[ee]=ar(te[ee],te[(ee+9)%16],Nu(te[(ee+1)%16]),Do(te[(ee+14)%16]))}for(V=0;V<8;V++)I[V]=ar(I[V],T[V]),T[V]=I[V];pe+=128,k-=128}for(V=0;V<8;V++)U(O,8*V,T[V]);return k}var _s=new Uint8Array([106,9,230,103,243,188,201,8,187,103,174,133,132,202,167,59,60,110,243,114,254,148,248,43,165,79,245,58,95,29,54,241,81,14,82,127,173,230,130,209,155,5,104,140,43,62,108,31,31,131,217,171,251,65,189,107,91,224,205,25,19,126,33,121]);function gt(O,N,k){var T=new Uint8Array(64),q=new Uint8Array(256),I,te=k;for(I=0;I<64;I++)T[I]=_s[I];for(qo(T,N,k),k%=128,I=0;I<256;I++)q[I]=0;for(I=0;I<k;I++)q[I]=N[te-k+I];for(q[k]=128,k=256-128*(k<112?1:0),q[k-9]=0,U(q,k-8,new t(te/536870912|0,te<<3)),qo(T,q,k),I=0;I<64;I++)O[I]=T[I];return 0}function rn(O,N){var k=s(),T=s(),q=s(),I=s(),te=s(),ie=s(),V=s(),ee=s(),pe=s();jt(k,O[1],O[0]),jt(pe,N[1],N[0]),ke(k,k,pe),yt(T,O[0],O[1]),yt(pe,N[0],N[1]),ke(T,T,pe),ke(q,O[3],N[3]),ke(q,q,m),ke(I,O[2],N[2]),yt(I,I,I),jt(te,T,k),jt(ie,I,q),yt(V,I,q),yt(ee,T,k),ke(O[0],te,ie),ke(O[1],ee,V),ke(O[2],V,ie),ke(O[3],te,ee)}function Pt(O,N,k){var T;for(T=0;T<4;T++)je(O[T],N[T],k)}function sa(O,N){var k=s(),T=s(),q=s();_t(q,N[2]),ke(k,N[0],q),ke(T,N[1],q),Te(O,T),O[31]^=Oe(k)<<7}function ia(O,N,k){var T,q;for(_e(O[0],d),_e(O[1],y),_e(O[2],y),_e(O[3],d),q=255;q>=0;--q)T=k[q/8|0]>>(q&7)&1,Pt(O,N,T),rn(N,O),rn(O,O),Pt(O,N,T)}function Ws(O,N){var k=[s(),s(),s(),s()];_e(k[0],b),_e(k[1],x),_e(k[2],y),ke(k[3],b,x),ia(O,k,N)}function qr(O,N,k){var T=new Uint8Array(64),q=[s(),s(),s(),s()],I;for(k||i(N,32),gt(T,N,32),T[0]&=248,T[31]&=127,T[31]|=64,Ws(q,T),sa(O,q),I=0;I<32;I++)N[I+32]=O[I];return 0}var or=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 Lr(O,N){var k,T,q,I;for(T=63;T>=32;--T){for(k=0,q=T-32,I=T-12;q<I;++q)N[q]+=k-16*N[T]*or[q-(T-32)],k=Math.floor((N[q]+128)/256),N[q]-=k*256;N[q]+=k,N[T]=0}for(k=0,q=0;q<32;q++)N[q]+=k-(N[31]>>4)*or[q],k=N[q]>>8,N[q]&=255;for(q=0;q<32;q++)N[q]-=k*or[q];for(T=0;T<32;T++)N[T+1]+=N[T]>>8,O[T]=N[T]&255}function Pn(O){var N=new Float64Array(64),k;for(k=0;k<64;k++)N[k]=O[k];for(k=0;k<64;k++)O[k]=0;Lr(O,N)}function ws(O,N,k,T){var q=new Uint8Array(64),I=new Uint8Array(64),te=new Uint8Array(64),ie,V,ee=new Float64Array(64),pe=[s(),s(),s(),s()];gt(q,T,32),q[0]&=248,q[31]&=127,q[31]|=64;var De=k+64;for(ie=0;ie<k;ie++)O[64+ie]=N[ie];for(ie=0;ie<32;ie++)O[32+ie]=q[32+ie];for(gt(te,O.subarray(32),k+32),Pn(te),Ws(pe,te),sa(O,pe),ie=32;ie<64;ie++)O[ie]=T[ie];for(gt(I,O,k+64),Pn(I),ie=0;ie<64;ie++)ee[ie]=0;for(ie=0;ie<32;ie++)ee[ie]=te[ie];for(ie=0;ie<32;ie++)for(V=0;V<32;V++)ee[ie+V]+=I[ie]*q[V];return Lr(O.subarray(32),ee),De}function Ss(O,N){var k=s(),T=s(),q=s(),I=s(),te=s(),ie=s(),V=s();return _e(O[2],y),ot(O[1],N),be(q,O[1]),ke(I,q,f),jt(q,q,O[2]),yt(I,O[2],I),be(te,I),be(ie,te),ke(V,ie,te),ke(k,V,q),ke(k,k,I),$t(k,k),ke(k,k,q),ke(k,k,I),ke(k,k,I),ke(O[0],k,I),be(T,O[0]),ke(T,T,I),rt(T,q)&&ke(O[0],O[0],v),be(T,O[0]),ke(T,T,I),rt(T,q)?-1:(Oe(O[0])===N[31]>>7&&jt(O[0],d,O[0]),ke(O[3],O[0],O[1]),0)}function aa(O,N,k,T){var q,I=new Uint8Array(32),te=new Uint8Array(64),ie=[s(),s(),s(),s()],V=[s(),s(),s(),s()];if(k<64||Ss(V,T))return-1;for(q=0;q<k;q++)O[q]=N[q];for(q=0;q<32;q++)O[q+32]=T[q];if(gt(te,O,k),Pn(te),ia(ie,V,te),Ws(V,N.subarray(32)),rn(ie,V),sa(I,ie),k-=64,D(N,0,I,0)){for(q=0;q<k;q++)O[q]=0;return-1}for(q=0;q<k;q++)O[q]=N[q+64];return k}var ei=32,Br=24,zn=32,Ur=16,Pr=32,Es=32,zr=32,lr=32,Os=32,oa=Br,Lo=zn,Qn=Ur,tt=64,ht=32,sn=64,As=32,la=64;r.lowlevel={crypto_core_hsalsa20:X,crypto_stream_xor:le,crypto_stream:J,crypto_stream_salsa20_xor:$,crypto_stream_salsa20:Z,crypto_onetimeauth:Y,crypto_onetimeauth_verify:oe,crypto_verify_16:se,crypto_verify_32:D,crypto_secretbox:he,crypto_secretbox_open:Ae,crypto_scalarmult:En,crypto_scalarmult_base:Ut,crypto_box_beforenm:Dr,crypto_box_afternm:No,crypto_box:na,crypto_box_open:ra,crypto_box_keypair:Xs,crypto_hash:gt,crypto_sign:ws,crypto_sign_keypair:qr,crypto_sign_open:aa,crypto_secretbox_KEYBYTES:ei,crypto_secretbox_NONCEBYTES:Br,crypto_secretbox_ZEROBYTES:zn,crypto_secretbox_BOXZEROBYTES:Ur,crypto_scalarmult_BYTES:Pr,crypto_scalarmult_SCALARBYTES:Es,crypto_box_PUBLICKEYBYTES:zr,crypto_box_SECRETKEYBYTES:lr,crypto_box_BEFORENMBYTES:Os,crypto_box_NONCEBYTES:oa,crypto_box_ZEROBYTES:Lo,crypto_box_BOXZEROBYTES:Qn,crypto_sign_BYTES:tt,crypto_sign_PUBLICKEYBYTES:ht,crypto_sign_SECRETKEYBYTES:sn,crypto_sign_SEEDBYTES:As,crypto_hash_BYTES:la,gf:s,D:f,L:or,pack25519:Te,unpack25519:ot,M:ke,A:yt,S:be,Z:jt,pow2523:$t,add:rn,set25519:_e,modL:Lr,scalarmult:ia,scalarbase:Ws};function Bo(O,N){if(O.length!==ei)throw new Error("bad key size");if(N.length!==Br)throw new Error("bad nonce size")}function Uo(O,N){if(O.length!==zr)throw new Error("bad public key size");if(N.length!==lr)throw new Error("bad secret key size")}function kt(){for(var O=0;O<arguments.length;O++)if(!(arguments[O]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function ti(O){for(var N=0;N<O.length;N++)O[N]=0}r.randomBytes=function(O){var N=new Uint8Array(O);return i(N,O),N},r.secretbox=function(O,N,k){kt(O,N,k),Bo(k,N);for(var T=new Uint8Array(zn+O.length),q=new Uint8Array(T.length),I=0;I<O.length;I++)T[I+zn]=O[I];return he(q,T,T.length,N,k),q.subarray(Ur)},r.secretbox.open=function(O,N,k){kt(O,N,k),Bo(k,N);for(var T=new Uint8Array(Ur+O.length),q=new Uint8Array(T.length),I=0;I<O.length;I++)T[I+Ur]=O[I];return T.length<32||Ae(q,T,T.length,N,k)!==0?null:q.subarray(zn)},r.secretbox.keyLength=ei,r.secretbox.nonceLength=Br,r.secretbox.overheadLength=Ur,r.scalarMult=function(O,N){if(kt(O,N),O.length!==Es)throw new Error("bad n size");if(N.length!==Pr)throw new Error("bad p size");var k=new Uint8Array(Pr);return En(k,O,N),k},r.scalarMult.base=function(O){if(kt(O),O.length!==Es)throw new Error("bad n size");var N=new Uint8Array(Pr);return Ut(N,O),N},r.scalarMult.scalarLength=Es,r.scalarMult.groupElementLength=Pr,r.box=function(O,N,k,T){var q=r.box.before(k,T);return r.secretbox(O,N,q)},r.box.before=function(O,N){kt(O,N),Uo(O,N);var k=new Uint8Array(Os);return Dr(k,O,N),k},r.box.after=r.secretbox,r.box.open=function(O,N,k,T){var q=r.box.before(k,T);return r.secretbox.open(O,N,q)},r.box.open.after=r.secretbox.open,r.box.keyPair=function(){var O=new Uint8Array(zr),N=new Uint8Array(lr);return Xs(O,N),{publicKey:O,secretKey:N}},r.box.keyPair.fromSecretKey=function(O){if(kt(O),O.length!==lr)throw new Error("bad secret key size");var N=new Uint8Array(zr);return Ut(N,O),{publicKey:N,secretKey:new Uint8Array(O)}},r.box.publicKeyLength=zr,r.box.secretKeyLength=lr,r.box.sharedKeyLength=Os,r.box.nonceLength=oa,r.box.overheadLength=r.secretbox.overheadLength,r.sign=function(O,N){if(kt(O,N),N.length!==sn)throw new Error("bad secret key size");var k=new Uint8Array(tt+O.length);return ws(k,O,O.length,N),k},r.sign.open=function(O,N){if(kt(O,N),N.length!==ht)throw new Error("bad public key size");var k=new Uint8Array(O.length),T=aa(k,O,O.length,N);if(T<0)return null;for(var q=new Uint8Array(T),I=0;I<q.length;I++)q[I]=k[I];return q},r.sign.detached=function(O,N){for(var k=r.sign(O,N),T=new Uint8Array(tt),q=0;q<T.length;q++)T[q]=k[q];return T},r.sign.detached.verify=function(O,N,k){if(kt(O,N,k),N.length!==tt)throw new Error("bad signature size");if(k.length!==ht)throw new Error("bad public key size");var T=new Uint8Array(tt+O.length),q=new Uint8Array(tt+O.length),I;for(I=0;I<tt;I++)T[I]=N[I];for(I=0;I<O.length;I++)T[I+tt]=O[I];return aa(q,T,T.length,k)>=0},r.sign.keyPair=function(){var O=new Uint8Array(ht),N=new Uint8Array(sn);return qr(O,N),{publicKey:O,secretKey:N}},r.sign.keyPair.fromSecretKey=function(O){if(kt(O),O.length!==sn)throw new Error("bad secret key size");for(var N=new Uint8Array(ht),k=0;k<N.length;k++)N[k]=O[32+k];return{publicKey:N,secretKey:new Uint8Array(O)}},r.sign.keyPair.fromSeed=function(O){if(kt(O),O.length!==As)throw new Error("bad seed size");for(var N=new Uint8Array(ht),k=new Uint8Array(sn),T=0;T<32;T++)k[T]=O[T];return qr(N,k,!0),{publicKey:N,secretKey:k}},r.sign.publicKeyLength=ht,r.sign.secretKeyLength=sn,r.sign.seedLength=As,r.sign.signatureLength=tt,r.hash=function(O){kt(O);var N=new Uint8Array(la);return gt(N,O,O.length),N},r.hash.hashLength=la,r.verify=function(O,N){return kt(O,N),O.length===0||N.length===0||O.length!==N.length?!1:ne(O,0,N,0,O.length)===0},r.setPRNG=function(O){i=O},(function(){var O=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(O&&O.getRandomValues){var N=65536;r.setPRNG(function(k,T){var q,I=new Uint8Array(T);for(q=0;q<T;q+=N)O.getRandomValues(I.subarray(q,q+Math.min(T-q,N)));for(q=0;q<T;q++)k[q]=I[q];ti(I)})}else typeof require<"u"&&(O=require("crypto"),O&&O.randomBytes&&r.setPRNG(function(k,T){var q,I=O.randomBytes(T);for(q=0;q<T;q++)k[q]=I[q];ti(I)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const Wl=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;Wl.sign.keyPair.fromSeed,Wl.sign.detached,Wl.sign.detached.verify,Wl.randomBytes;var qg;(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"})(qg||(qg={}));var Lg;(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"})(Lg||(Lg={}));function TE(r){return t=>{let s={};return r.forEach(i=>{const l=i(t)||{};s=Object.assign(s,l)}),s}}function CE(){return()=>{}}function ME(r,t){return()=>{const s=typeof r=="function"?r():r,i=typeof t=="function"?t():t;return{user:s,pass:i}}}function RE(r){return()=>({auth_token:typeof r=="function"?r():r})}const Xb=120*1e3,DE=2,Qb=2*1e3;function qE(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:Xb,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:Qb,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function LE(r){const t=[];return typeof r.authenticator=="function"&&t.push(r.authenticator),Array.isArray(r.authenticator)&&t.push(...r.authenticator),r.token&&t.push(RE(r.token)),r.user&&t.push(ME(r.user,r.pass)),t.length===0?CE():TE(t)}function BE(r){const t=`${od}:${Yb()}`;if(r=r||{servers:[t]},r.servers=r.servers||[],typeof r.servers=="string"&&(r.servers=[r.servers]),r.servers.length>0&&r.port)throw new de("port and servers options are mutually exclusive",ce.InvalidOption);r.servers.length===0&&r.port&&(r.servers=[`${od}:${r.port}`]),r.servers&&r.servers.length===0&&(r.servers=[t]);const s=gu(qE(),r);if(s.authenticator=LE(s),["reconnectDelayHandler","authenticator"].forEach(i=>{if(s[i]&&typeof s[i]!="function")throw new de(`${i} option should be a function`,ce.NotFunction)}),s.reconnectDelayHandler||(s.reconnectDelayHandler=()=>{let i=s.tls?s.reconnectJitterTLS:s.reconnectJitter;return i&&(i++,i=Math.floor(Math.random()*i)),s.reconnectTimeWait+i}),s.inboxPrefix)try{Tr(s.inboxPrefix)}catch(i){throw new de(i.message,ce.ApiError)}if(s.resolve===void 0&&(s.resolve=typeof pd()=="function"),s.resolve&&typeof pd()!="function")throw new de("'resolve' is not supported on this client",ce.InvalidOption);return s}function UE(r,t){const{proto:s,tls_required:i,tls_available:l}=r;if((s===void 0||s<1)&&t.noEcho)throw new de("noEcho",ce.ServerOptionNotAvailable);const c=i||l||!1;if(t.tls&&!c)throw new de("tls",ce.ServerOptionNotAvailable)}const PE=1024*32,zE=/^INFO\s+([^\r\n]+)\r\n/i,IE=fo(`PONG\r
|
|
38
|
+
`),Bg=fo(`PING\r
|
|
39
|
+
`);class $E{constructor(t,s,i){j(this,"echo");j(this,"no_responders");j(this,"protocol");j(this,"verbose");j(this,"pedantic");j(this,"jwt");j(this,"nkey");j(this,"sig");j(this,"user");j(this,"pass");j(this,"auth_token");j(this,"tls_required");j(this,"name");j(this,"lang");j(this,"version");j(this,"headers");this.protocol=1,this.version=t.version,this.lang=t.lang,this.echo=s.noEcho?!1:void 0,this.verbose=s.verbose,this.pedantic=s.pedantic,this.tls_required=s.tls?!0:void 0,this.name=s.name;const l=(s&&typeof s.authenticator=="function"?s.authenticator(i):{})||{};gu(this,l)}}class Zb extends Mt{constructor(s,i,l={}){var d;super();j(this,"sid");j(this,"queue");j(this,"draining");j(this,"max");j(this,"subject");j(this,"drained");j(this,"protocol");j(this,"timer");j(this,"info");j(this,"cleanupFn");j(this,"closed");j(this,"requestSubject");gu(this,l),this.protocol=s,this.subject=i,this.draining=!1,this.noIterator=typeof l.callback=="function",this.closed=ft();const c=!((d=s.options)!=null&&d.noAsyncTraces);l.timeout&&(this.timer=Ji(l.timeout,c),this.timer.then(()=>{this.timer=void 0}).catch(y=>{this.stop(y),this.noIterator&&this.callback(y,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(s){if(this.noIterator){const i=this.callback,l=s.ingestionFilterFn?s.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),c=s.protocolFilterFn?s.protocolFilterFn:()=>!0,d=s.dispatchedFn?s.dispatchedFn:()=>{};this.callback=(y,g)=>{const{ingest:f}=l(g);f&&c(g)&&(i(y,g),d(g))}}else this.protocolFilterFn=s.protocolFilterFn,this.dispatchedFn=s.dispatchedFn}callback(s,i){this.cancelTimeout(),s?this.stop(s):this.push(i)}close(){if(!this.isClosed()){this.cancelTimeout();const s=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?s():this.push(s)}}unsubscribe(s){this.protocol.unsubscribe(this,s)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(de.errorForCode(ce.ConnectionClosed)):this.isClosed()?Promise.reject(de.errorForCode(ce.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(ft()).then(()=>{this.protocol.subscriptions.cancel(this)}).catch(()=>{this.protocol.subscriptions.cancel(this)})),this.drained)}isDraining(){return this.draining}isClosed(){return this.done}getSubject(){return this.subject}getMax(){return this.max}getID(){return this.sid}}class HE{constructor(){j(this,"mux");j(this,"subs");j(this,"sidCounter");this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(t){return this.sidCounter++,t.sid=this.sidCounter,this.subs.set(t.sid,t),t}setMux(t){return this.mux=t,t}getMux(){return this.mux}get(t){return this.subs.get(t)}resub(t){return this.sidCounter++,this.subs.delete(t.sid),t.sid=this.sidCounter,this.subs.set(t.sid,t),t}all(){return Array.from(this.subs.values())}cancel(t){t&&(t.close(),this.subs.delete(t.sid))}handleError(t){if(t&&t.permissionContext){const s=t.permissionContext,i=this.all();let l;if(s.operation==="subscription"&&(l=i.find(c=>c.subject===s.subject&&c.queue===s.queue)),s.operation==="publish"&&(l=i.find(c=>c.requestSubject===s.subject)),l)return l.callback(t,{}),l.close(),this.subs.delete(l.sid),l!==this.mux}return!1}close(){this.subs.forEach(t=>{t.close()})}}class lu{constructor(t,s){j(this,"connected");j(this,"connectedOnce");j(this,"infoReceived");j(this,"info");j(this,"muxSubscriptions");j(this,"options");j(this,"outbound");j(this,"pongs");j(this,"subscriptions");j(this,"transport");j(this,"noMorePublishing");j(this,"connectError");j(this,"publisher");j(this,"_closed");j(this,"closed");j(this,"listeners");j(this,"heartbeats");j(this,"parser");j(this,"outMsgs");j(this,"inMsgs");j(this,"outBytes");j(this,"inBytes");j(this,"pendingLimit");j(this,"lastError");j(this,"abortReconnect");j(this,"whyClosed");j(this,"servers");j(this,"server");j(this,"features");j(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=PE,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=t,this.publisher=s,this.subscriptions=new HE,this.muxSubscriptions=new OE,this.outbound=new Qi,this.pongs=[],this.whyClosed="",this.pendingLimit=t.pendingLimit||this.pendingLimit,this.features=new iE({major:0,minor:0,micro:0}),this.connectPromise=null;const i=typeof t.servers=="string"?[t.servers]:t.servers;this.servers=new EE(i,{randomize:!t.noRandomize}),this.closed=ft(),this.parser=new Dg(this),this.heartbeats=new AE(this,this.options.pingInterval||Xb,this.options.maxPingOut||DE)}resetOutbound(){this.outbound.reset();const t=this.pongs;this.pongs=[];const s=de.errorForCode(ce.Disconnect);s.stack="",t.forEach(i=>{i.reject(s)}),this.parser=new Dg(this),this.infoReceived=!1}dispatchStatus(t){this.listeners.forEach(s=>{s.push(t)})}status(){const t=new Mt;return this.listeners.push(t),t}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const t=ft();return t.catch(()=>{}),this.pongs.unshift(t),this.connectError=s=>{t.reject(s)},this.transport=lE(),this.transport.closed().then(async s=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),t}disconnect(){this.dispatchStatus({type:Hi.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:Hi.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(t){this.dispatchStatus({type:Nr.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var s;this.dispatchStatus({type:Nr.Reconnect,data:this.servers.getCurrentServer().toString()}),((s=this.lastError)==null?void 0:s.code)===ce.AuthenticationExpired&&(this.lastError=void 0)}).catch(s=>{this._close(s)}):await this._close(t)}async dial(t){const s=this.prepare();let i;try{i=Ji(this.options.timeout||2e4);const l=this.transport.connect(t,this.options);await Promise.race([l,i]),(async()=>{try{for await(const c of this.transport)this.parser.parse(c)}catch(c){console.log("reader closed",c)}})().then()}catch(l){s.reject(l)}try{await Promise.race([i,s]),i&&i.cancel(),this.connected=!0,this.connectError=void 0,this.sendSubscriptions(),this.connectedOnce=!0,this.server.didConnect=!0,this.server.reconnects=0,this.flushPending(),this.heartbeats.start()}catch(l){throw i&&i.cancel(),await this.transport.close(l),l}}async _doDial(t){const{resolve:s}=this.options,i=await t.resolve({fn:pd(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:s});let l=null;for(const c of i)try{l=null,this.dispatchStatus({type:Hi.Reconnecting,data:c.toString()}),await this.dial(c);return}catch(d){l=d}throw l}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let t;for(;;){this._closed&&this.servers.clear();const s=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():Qb;let i=s;const l=this.selectServer();if(!l||this.abortReconnect)throw t||(this.lastError?this.lastError:de.errorForCode(ce.ConnectionRefused));const c=Date.now();if(l.lastConnect===0||l.lastConnect+s<=c){l.lastConnect=Date.now();try{await this._doDial(l);break}catch(d){if(t=d,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}l.reconnects++;const y=this.options.maxReconnectAttempts||0;y!==-1&&l.reconnects>=y&&this.servers.removeCurrentServer()}}else i=Math.min(i,l.lastConnect+s-c),await Wi(i)}}static async connect(t,s){const i=new lu(t,s);return await i.dialLoop(),i}static toError(t){const s=t?t.toLowerCase():"";if(s.indexOf("permissions violation")!==-1){const i=new de(t,ce.PermissionsViolation),l=t.match(/(Publish|Subscription) to "(\S+)"/);if(l){i.permissionContext={operation:l[1].toLowerCase(),subject:l[2],queue:void 0};const c=t.match(/using queue "(\S+)"/);c&&(i.permissionContext.queue=c[1])}return i}else return s.indexOf("authorization violation")!==-1?new de(t,ce.AuthorizationViolation):s.indexOf("user authentication expired")!==-1?new de(t,ce.AuthenticationExpired):s.indexOf("account authentication expired")!=-1?new de(t,ce.AccountExpired):s.indexOf("authentication timeout")!==-1?new de(t,ce.AuthenticationTimeout):new de(t,ce.ProtocolError)}processMsg(t,s){if(this.inMsgs++,this.inBytes+=s.length,!this.subscriptions.sidCounter)return;const i=this.subscriptions.get(t.sid);i&&(i.received+=1,i.callback&&i.callback(null,new Yd(t,s,this)),i.max!==void 0&&i.received>=i.max&&i.unsubscribe())}processError(t){const s=xg(t),i=lu.toError(s),l={type:Nr.Error,data:i.code};if(i.isPermissionError()){let c=!1;if(i.permissionContext){l.permissionContext=i.permissionContext;const d=this.subscriptions.getMux();c=(d==null?void 0:d.subject)===i.permissionContext.subject}this.subscriptions.handleError(i),this.muxSubscriptions.handleError(c,i),c&&this.subscriptions.setMux(null)}this.dispatchStatus(l),this.handleError(i)}handleError(t){t.isAuthError()?this.handleAuthError(t):t.isProtocolError()?this.lastError=t:t.isAuthTimeout()&&(this.lastError=t),t.isPermissionError()||(this.lastError=t)}handleAuthError(t){this.lastError&&t.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(t):this.disconnect()}processPing(){this.transport.send(IE)}processPong(){const t=this.pongs.shift();t&&t.resolve()}processInfo(t){const s=JSON.parse(xg(t));this.info=s;const i=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(s,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(Ys(s.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:c,lang:d}=this.transport;try{const y=new $E({version:c,lang:d},this.options,s.nonce);s.headers&&(y.headers=!0,y.no_responders=!0);const g=JSON.stringify(y);this.transport.send(fo(`CONNECT ${g}${Jc}`)),this.transport.send(Bg)}catch(y){this._close(y)}}i&&this.dispatchStatus({type:Nr.Update,data:i}),(s.ldm!==void 0?s.ldm:!1)&&this.dispatchStatus({type:Nr.LDM,data:this.servers.getCurrentServer().toString()})}push(t){switch(t.kind){case Vt.MSG:{const{msg:s,data:i}=t;this.processMsg(s,i);break}case Vt.OK:break;case Vt.ERR:this.processError(t.data);break;case Vt.PING:this.processPing();break;case Vt.PONG:this.processPong();break;case Vt.INFO:this.processInfo(t.data);break}}sendCommand(t,...s){const i=this.outbound.length();let l;typeof t=="string"?l=fo(t):l=t,this.outbound.fill(l,...s),i===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(t,s=vn,i){let l;if(s instanceof Uint8Array)l=s;else if(typeof s=="string")l=Ks.encode(s);else throw de.errorForCode(ce.BadPayload);let c=l.length;i=i||{},i.reply=i.reply||"";let d=vn,y=0;if(i.headers){if(this.info&&!this.info.headers)throw new de("headers",ce.ServerOptionNotAvailable);d=i.headers.encode(),y=d.length,c=l.length+y}if(this.info&&c>this.info.max_payload)throw de.errorForCode(ce.MaxPayloadExceeded);this.outBytes+=c,this.outMsgs++;let g;i.headers?(i.reply?g=`HPUB ${t} ${i.reply} ${y} ${c}\r
|
|
40
|
+
`:g=`HPUB ${t} ${y} ${c}\r
|
|
41
|
+
`,this.sendCommand(g,d,l,ou)):(i.reply?g=`PUB ${t} ${i.reply} ${c}\r
|
|
42
|
+
`:g=`PUB ${t} ${c}\r
|
|
43
|
+
`,this.sendCommand(g,l,ou))}request(t){return this.initMux(),this.muxSubscriptions.add(t),t}subscribe(t){return this.subscriptions.add(t),this._subunsub(t),t}_sub(t){t.queue?this.sendCommand(`SUB ${t.subject} ${t.queue} ${t.sid}\r
|
|
44
|
+
`):this.sendCommand(`SUB ${t.subject} ${t.sid}\r
|
|
45
|
+
`)}_subunsub(t){return this._sub(t),t.max&&this.unsubscribe(t,t.max),t}unsubscribe(t,s){this.unsub(t,s),(t.max===void 0||t.received>=t.max)&&this.subscriptions.cancel(t)}unsub(t,s){!t||this.isClosed()||(s?this.sendCommand(`UNSUB ${t.sid} ${s}\r
|
|
46
|
+
`):this.sendCommand(`UNSUB ${t.sid}\r
|
|
47
|
+
`),t.max=s)}resub(t,s){!t||this.isClosed()||(this.unsub(t),t.subject=s,this.subscriptions.resub(t),this._sub(t))}flush(t){return t||(t=ft()),this.pongs.push(t),this.outbound.fill(Bg),this.flushPending(),t}sendSubscriptions(){const t=[];this.subscriptions.all().forEach(s=>{const i=s;i.queue?t.push(`SUB ${i.subject} ${i.queue} ${i.sid}${Jc}`):t.push(`SUB ${i.subject} ${i.sid}${Jc}`)}),t.length&&this.transport.send(fo(t.join("")))}async _close(t){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(t),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(s=>{s.stop()}),this._closed=!0,await this.transport.close(t),await this.closed.resolve(t))}close(){return this._close()}isClosed(){return this._closed}drain(){const t=this.subscriptions.all(),s=[];return t.forEach(i=>{s.push(i.drain())}),Promise.all(s).then(async()=>(this.noMorePublishing=!0,await this.flush(),this.close())).catch(()=>{})}flushPending(){if(!(!this.infoReceived||!this.connected)&&this.outbound.size()){const t=this.outbound.drain();this.transport.send(t)}}initMux(){if(!this.subscriptions.getMux()){const s=this.muxSubscriptions.init(this.options.inboxPrefix),i=new Zb(this,`${s}*`);i.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(i),this.subscribe(i)}}selectServer(){const t=this.servers.selectServer();if(t!==void 0)return this.server=t,this.server}getServer(){return this.server}}const FE="$SRV";class Ug{constructor(t){j(this,"msg");this.msg=t}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(t,s){return this.msg.respond(t,s)}respondError(t,s,i,l){var c,d;return l=l||{},l.headers=l.headers||Cr(),(c=l.headers)==null||c.set(ru,`${t}`),(d=l.headers)==null||d.set(nu,s),this.msg.respond(i,l)}json(t){return this.msg.json(t)}string(){return this.msg.string()}}class bo{constructor(t,s="",i=""){j(this,"subject");j(this,"queue");j(this,"srv");s!==""&&VE("service group",s);let l="";if(t instanceof So)this.srv=t,l="";else if(t instanceof bo){const c=t;this.srv=c.srv,i===""&&c.queue!==""&&(i=c.queue),l=c.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(l,s),this.queue=i}calcSubject(t,s=""){return s===""?t:t!==""?`${t}.${s}`:s}addEndpoint(t="",s){s=s||{subject:t};const i=typeof s=="function"?{handler:s,subject:t}:s;lo("endpoint",t);let{subject:l,handler:c,metadata:d,queue:y}=i;l=l||t,y=y||this.queue,GE("endpoint subject",l),l=this.calcSubject(this.subject,l);const g={name:t,subject:l,queue:y,handler:c,metadata:d};return this.srv._addEndpoint(g)}addGroup(t="",s=""){return new bo(this,t,s)}}function GE(r,t){if(t==="")throw new Error(`${r} cannot be empty`);if(t.indexOf(" ")!==-1)throw new Error(`${r} cannot contain spaces: '${t}'`);const s=t.split(".");s.forEach((i,l)=>{if(i===">"&&l!==s.length-1)throw new Error(`${r} cannot have internal '>': '${t}'`)})}function VE(r,t){if(t.indexOf(" ")!==-1)throw new Error(`${r} cannot contain spaces: '${t}'`);t.split(".").forEach(i=>{if(i===">")throw new Error(`${r} name cannot contain internal '>': '${t}'`)})}class So{constructor(t,s={name:"",version:""}){j(this,"nc");j(this,"_id");j(this,"config");j(this,"handlers");j(this,"internal");j(this,"_stopped");j(this,"_done");j(this,"started");this.nc=t,this.config=Object.assign({},s),this.config.queue||(this.config.queue="q"),lo("name",this.config.name),lo("queue",this.config.queue),Ys(this.config.version),this._id=xs.next(),this.internal=[],this._done=ft(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(i=>{this.close(i).catch()})}static controlSubject(t,s="",i="",l){const c=l??FE;return s===""&&i===""?`${c}.${t}`:(lo("control subject name",s),i!==""?(lo("control subject id",i),`${c}.${t}.${s}.${i}`):`${c}.${t}.${s}`)}get subjects(){return this.handlers.filter(t=>t.internal===!1).map(t=>t.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(t){const s=Cr();if(t instanceof su){const i=t;s.set(nu,i.message),s.set(ru,`${i.code}`)}else s.set(nu,t.message),s.set(ru,"500");return s}setupHandler(t,s=!1){const i=s?"":t.queue?t.queue:this.config.queue,{name:l,subject:c,handler:d}=t,y=t;y.internal=s,s&&this.internal.push(y),y.stats=new YE(l,c,i),y.queue=i;const g=d?(f,m)=>{if(f){this.close(f);return}const b=Date.now();try{d(f,new Ug(m))}catch(x){y.stats.countError(x),m==null||m.respond(vn,{headers:this.errorToHeader(x)})}finally{y.stats.countLatency(b)}}:void 0;return y.sub=this.nc.subscribe(c,{callback:g,queue:i}),y.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${t.subject} stopped`)).catch()}).catch(f=>{if(!this._stopped){const m=new Error(`required subscription ${t.subject} errored: ${f.message}`);m.stack=f.stack,this.close(m).catch()}}),y}info(){return{type:ho.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(t=>{const{subject:s,metadata:i,name:l,queue:c}=t;return{subject:s,metadata:i,name:l,queue_group:c}})}async stats(){const t=[];for(const s of this.handlers){if(typeof this.config.statsHandler=="function")try{s.stats.data=await this.config.statsHandler(s)}catch(i){s.stats.countError(i)}t.push(s.stats.stats(s.qi))}return{type:ho.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:t}}addInternalHandler(t,s){const i=`${t}`.toUpperCase();this._doAddInternalHandler(`${i}-all`,t,s),this._doAddInternalHandler(`${i}-kind`,t,s,this.name),this._doAddInternalHandler(`${i}`,t,s,this.name,this.id)}_doAddInternalHandler(t,s,i,l="",c=""){const d={};d.name=t,d.subject=So.controlSubject(s,l,c),d.handler=i,this.setupHandler(d,!0)}start(){const t=Jn(),s=(d,y)=>d?(this.close(d),Promise.reject(d)):this.stats().then(g=>(y==null||y.respond(t.encode(g)),Promise.resolve())),i=(d,y)=>d?(this.close(d),Promise.reject(d)):(y==null||y.respond(t.encode(this.info())),Promise.resolve()),l=t.encode(this.ping()),c=(d,y)=>d?(this.close(d).then().catch(),Promise.reject(d)):(y.respond(l),Promise.resolve());return this.addInternalHandler(ms.PING,c),this.addInternalHandler(ms.STATS,s),this.addInternalHandler(ms.INFO,i),this.handlers.forEach(d=>{const{subject:y}=d;typeof y=="string"&&d.handler!==null&&this.setupHandler(d)}),Promise.resolve(this)}close(t){if(this._stopped)return this._done;this._stopped=!0;let s=[];return this.nc.isClosed()||(s=this.handlers.concat(this.internal).map(i=>i.sub.drain())),Promise.allSettled(s).then(()=>{this._done.resolve(t||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(t){return this.close(t)}ping(){return{type:ho.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const t of this.handlers)t.stats.reset(t.qi)}addGroup(t,s){return new bo(this,t,s)}addEndpoint(t,s){return new bo(this).addEndpoint(t,s)}_addEndpoint(t){const s=new Mt;s.noIterator=typeof t.handler=="function",s.noIterator||(t.handler=(l,c)=>{l?this.stop(l).catch():s.push(new Ug(c))},s.iterClosed.then(()=>{this.close().catch()}));const i=this.setupHandler(t,!1);return i.qi=s,this.handlers.push(i),s}}class YE{constructor(t,s,i=""){j(this,"name");j(this,"subject");j(this,"average_processing_time");j(this,"num_requests");j(this,"processing_time");j(this,"num_errors");j(this,"last_error");j(this,"data");j(this,"metadata");j(this,"queue");this.name=t,this.subject=s,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=i}reset(t){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const s=t;s&&(s.time=0,s.processed=0)}countLatency(t){this.num_requests++,this.processing_time+=ut(Date.now()-t),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(t){this.num_errors++,this.last_error=t.message}_stats(){const{name:t,subject:s,average_processing_time:i,num_errors:l,num_requests:c,processing_time:d,last_error:y,data:g,queue:f}=this;return{name:t,subject:s,average_processing_time:i,num_errors:l,num_requests:c,processing_time:d,last_error:y,data:g,queue_group:f}}stats(t){const s=t;return(s==null?void 0:s.noIterator)===!1&&(this.processing_time=ut(s.time),this.num_requests=s.processed,this.average_processing_time=this.processing_time>0&&this.num_requests>0?this.processing_time/this.num_requests:0),this._stats()}}class KE{constructor(t,s={strategy:Kn.JitterTimer,maxWait:2e3},i){j(this,"nc");j(this,"prefix");j(this,"opts");this.nc=t,this.prefix=i,this.opts=s}ping(t="",s=""){return this.q(ms.PING,t,s)}stats(t="",s=""){return this.q(ms.STATS,t,s)}info(t="",s=""){return this.q(ms.INFO,t,s)}async q(t,s="",i=""){const l=new Mt,c=Jn(),d=So.controlSubject(t,s,i,this.prefix),y=await this.nc.requestMany(d,vn,this.opts);return(async()=>{for await(const g of y)try{const f=c.decode(g.data);l.push(f)}catch(f){l.push(()=>{l.stop(f)})}l.push(()=>{l.stop()})})().catch(g=>{l.stop(g)}),l}}function Wb(){return{key:{encode(r){return r},decode(r){return r}},value:{encode(r){return r},decode(r){return r}}}}function JE(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Wb(),storage:hd.File}}const cu="KV-Operation",Pg="$KV",XE=/^[-/=.\w]+$/,QE=/^[-/=.>*\w]+$/,ZE=/^[-\w]+$/;function WE(r){if(r.startsWith(".")||r.endsWith(".")||!XE.test(r))throw new Error(`invalid key: ${r}`)}function e2(r){if(r.startsWith(".")||r.endsWith(".")||!QE.test(r))throw new Error(`invalid key: ${r}`)}function t2(r){if(r.startsWith(".")||r.endsWith("."))throw new Error(`invalid key: ${r}`);const t=r.split(".");let s=!1;for(let i=0;i<t.length;i++)switch(t[i]){case"*":s=!0;break;case">":if(i!==t.length-1)throw new Error(`invalid key: ${r}`);s=!0;break}return s}function Xc(r){if(!ZE.test(r))throw new Error(`invalid bucket name: ${r}`)}var nr;(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"})(nr||(nr={}));class xo{constructor(t,s,i){j(this,"js");j(this,"jsm");j(this,"stream");j(this,"bucket");j(this,"direct");j(this,"codec");j(this,"prefix");j(this,"editPrefix");j(this,"useJsPrefix");j(this,"_prefixLen");j(this,"validateKey",WE);j(this,"validateSearchKey",e2);j(this,"hasWildcards",t2);Xc(t),this.js=s,this.jsm=i,this.bucket=t,this.prefix=Pg,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(t,s,i={}){Xc(s);const l=await t.jetstreamManager(),c=new xo(s,t,l);return await c.init(i),c}static async bind(t,s,i={}){const l=await t.jetstreamManager(),c={config:{allow_direct:i.allow_direct}};Xc(s);const d=new xo(s,t,l);return c.config.name=i.streamName??d.bucketName(),Object.assign(d,c),d.stream=c.config.name,d.codec=i.codec||Wb(),d.direct=c.config.allow_direct??!1,d.initializePrefixes(c),d}async init(t={}){const s=Object.assign(JE(),t);this.codec=s.codec;const i={};this.stream=i.name=t.streamName??this.bucketName(),i.retention=fd.Limits,i.max_msgs_per_subject=s.history,s.maxBucketSize&&(s.max_bytes=s.maxBucketSize),s.max_bytes&&(i.max_bytes=s.max_bytes),i.max_msg_size=s.maxValueSize,i.storage=s.storage;const l=t.placementCluster??"";if(l&&(t.placement={},t.placement.cluster=l,t.placement.tags=[]),t.placement&&(i.placement=t.placement),t.republish&&(i.republish=t.republish),t.description&&(i.description=t.description),t.mirror){const b=Object.assign({},t.mirror);b.name.startsWith(yn)||(b.name=`${yn}${b.name}`),i.mirror=b,i.mirror_direct=!0}else if(t.sources){const b=t.sources.map(x=>{const v=Object.assign({},x),w=v.name.startsWith(yn)?v.name.substring(yn.length):v.name;return v.name.startsWith(yn)||(v.name=`${yn}${v.name}`),!x.external&&w!==this.bucket&&(v.subject_transforms=[{src:`$KV.${w}.>`,dest:`$KV.${this.bucket}.>`}]),v});i.sources=b,i.subjects=[this.subjectForBucket()]}else i.subjects=[this.subjectForBucket()];t.metadata&&(i.metadata=t.metadata),typeof t.compression=="boolean"&&(i.compression=t.compression?vs.S2:vs.None);const c=this.js.nc,d=c.getServerVersion(),y=d?md(d,Ys("2.7.2"))>=0:!1;i.discard=y?go.New:go.Old;const{ok:g,min:f}=c.features.get($e.JS_ALLOW_DIRECT);if(!g&&t.allow_direct===!0){const b=d?`${d.major}.${d.minor}.${d.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${b} - requires ${f}`))}t.allow_direct=typeof t.allow_direct=="boolean"?t.allow_direct:g,i.allow_direct=t.allow_direct,this.direct=i.allow_direct,i.num_replicas=s.replicas,s.ttl&&(i.max_age=ut(s.ttl)),i.allow_rollup_hdrs=!0;let m;try{m=await this.jsm.streams.info(i.name),!m.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(b){if(b.message==="stream not found")m=await this.jsm.streams.add(i);else throw b}this.initializePrefixes(m)}initializePrefixes(t){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:s}=t.config;if(s){let i=s.name;if(i.startsWith(yn)&&(i=i.substring(yn.length)),s.external&&s.external.api!==""){const l=s.name.substring(yn.length);this.useJsPrefix=!1,this.prefix=`$KV.${l}`,this.editPrefix=`${s.external.api}.$KV.${i}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${yn}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(t,s=!1){const i=[];return s?(this.useJsPrefix&&i.push(this.js.apiPrefix),this.editPrefix!==""?i.push(this.editPrefix):i.push(this.prefix)):this.prefix&&i.push(this.prefix),i.push(t),i.join(".")}fullKeyName(t){return this.prefix!==""?`${this.prefix}.${t}`:`${Pg}.${this.bucket}.${t}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(t){const s=[];for(const i of t.split("."))switch(i){case">":case"*":s.push(i);break;default:s.push(this.codec.key.encode(i));break}return s.join(".")}decodeKey(t){const s=[];for(const i of t.split("."))switch(i){case">":case"*":s.push(i);break;default:s.push(this.codec.key.decode(i));break}return s.join(".")}close(){return Promise.resolve()}dataLen(t,s){const i=s&&s.get(Kt.MessageSizeHdr)||"";return i!==""?parseInt(i,10):t.length}smToEntry(t){return new y2(this.bucket,this.prefixLen,t)}jmToEntry(t){const s=this.decodeKey(t.subject.substring(this.prefixLen));return new g2(this.bucket,s,t)}async create(t,s){var c;let i;try{const d=await this.put(t,s,{previousSeq:0});return Promise.resolve(d)}catch(d){if(i=d,((c=d==null?void 0:d.api_error)==null?void 0:c.err_code)!==10071)return Promise.reject(d)}let l=0;try{const d=await this.get(t);return(d==null?void 0:d.operation)==="DEL"||(d==null?void 0:d.operation)==="PURGE"?(l=d!==null?d.revision:0,this.update(t,s,l)):Promise.reject(i)}catch(d){return Promise.reject(d)}}update(t,s,i){if(i<=0)throw new Error("version must be greater than 0");return this.put(t,s,{previousSeq:i})}async put(t,s,i={}){var d,y;const l=this.encodeKey(t);this.validateKey(l);const c={};if(i.previousSeq!==void 0){const g=Cr();c.headers=g,g.set(nr.ExpectedLastSubjectSequenceHdr,`${i.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(l,!0),s,c)).seq}catch(g){const f=g;return f.isJetStreamError()?(f.message=(d=f.api_error)==null?void 0:d.description,f.code=`${(y=f.api_error)==null?void 0:y.code}`,Promise.reject(f)):Promise.reject(g)}}async get(t,s){const i=this.encodeKey(t);this.validateKey(i);let l={last_by_subj:this.subjectForKey(i)};s&&s.revision>0&&(l={seq:s.revision});let c;try{this.direct?c=await this.jsm.direct.getMessage(this.bucketName(),l):c=await this.jsm.streams.getMessage(this.bucketName(),l);const d=this.smToEntry(c);return d.key!==i?null:d}catch(d){if(d.code===ce.JetStream404NoMessages)return null;throw d}}purge(t,s){return this._deleteOrPurge(t,"PURGE",s)}delete(t,s){return this._deleteOrPurge(t,"DEL",s)}async purgeDeletes(t=1800*1e3){const s=ft(),i=[],l=await this.watch({key:">",initializedFn:()=>{s.resolve()}});(async()=>{for await(const g of l)(g.operation==="DEL"||g.operation==="PURGE")&&i.push(g)})().then(),await s,l.stop();const c=Date.now()-t,d=i.map(g=>{const f=this.subjectForKey(g.key);return g.created.getTime()>=c?this.jsm.streams.purge(this.stream,{filter:f,keep:1}):this.jsm.streams.purge(this.stream,{filter:f,keep:0})}),y=await Promise.all(d);return y.unshift({success:!0,purged:0}),y.reduce((g,f)=>(g.purged+=f.purged,g))}async _deleteOrPurge(t,s,i){if(!this.hasWildcards(t))return this._doDeleteOrPurge(t,s,i);const l=await this.keys(t),c=[];for await(const d of l)c.push(this._doDeleteOrPurge(d,s)),c.length===100&&(await Promise.all(c),c.length=0);c.length>0&&await Promise.all(c)}async _doDeleteOrPurge(t,s,i){const l=this.encodeKey(t);this.validateKey(l);const c=Cr();c.set(cu,s),s==="PURGE"&&c.set(Kt.RollupHdr,Kt.RollupValueSubject),i!=null&&i.previousSeq&&c.set(nr.ExpectedLastSubjectSequenceHdr,`${i.previousSeq}`),await this.js.publish(this.subjectForKey(l,!0),vn,{headers:c})}_buildCC(t,s,i={}){let c=(Array.isArray(t)?t:[t]).map(g=>{const f=this.encodeKey(g);return this.validateSearchKey(g),this.fullKeyName(f)}),d=vt.LastPerSubject;s===Vn.AllHistory&&(d=vt.All),s===Vn.UpdatesOnly&&(d=vt.New);let y;return c.length===1&&(y=c[0],c=void 0),Object.assign({deliver_policy:d,ack_policy:Ct.None,filter_subjects:c,filter_subject:y,flow_control:!0,idle_heartbeat:ut(5*1e3)},i)}remove(t){return this.purge(t)}async history(t={}){const s=t.key??">",i=new Mt,l={};l.headers_only=t.headers_only||!1;let c;c=()=>{i.stop()};let d=0;const y=this._buildCC(s,Vn.AllHistory,l),g=y.filter_subject,f=ys(y);f.bindStream(this.stream),f.orderedConsumer(),f.callback((b,x)=>{if(b){i.stop(b);return}if(x){const v=this.jmToEntry(x);i.push(v),i.received++,(c&&d>0&&i.received>=d||x.info.pending===0)&&(i.push(c),c=void 0)}});const m=await this.js.subscribe(g,f);if(c){const{info:{last:b}}=m,x=b.num_pending+b.delivered.consumer_seq;if(x===0||i.received>=x)try{c()}catch(v){i.stop(v)}finally{c=void 0}else d=x}return i._data=m,i.iterClosed.then(()=>{m.unsubscribe()}),m.closed.then(()=>{i.stop()}).catch(b=>{i.stop(b)}),i}canSetWatcherName(){const s=this.js.nc,{ok:i}=s.features.get($e.JS_NEW_CONSUMER_CREATE_API);return i}async watch(t={}){const s=t.key??">",i=new Mt,l={};l.headers_only=t.headers_only||!1;let c=Vn.LastValue;t.include===Vn.AllHistory?c=Vn.AllHistory:t.include===Vn.UpdatesOnly&&(c=Vn.UpdatesOnly);const d=t.ignoreDeletes===!0;let y=t.initializedFn,g=0;const f=this._buildCC(s,c,l),m=f.filter_subject,b=ys(f);this.canSetWatcherName()&&b.consumerName(xs.next()),b.bindStream(this.stream),t.resumeFromRevision&&t.resumeFromRevision>0&&b.startSequence(t.resumeFromRevision),b.orderedConsumer(),b.callback((v,w)=>{if(v){i.stop(v);return}if(w){const S=this.jmToEntry(w);if(d&&S.operation==="DEL")return;i.push(S),i.received++,y&&(g>0&&i.received>=g||w.info.pending===0)&&(i.push(y),y=void 0)}});const x=await this.js.subscribe(m,b);if(y){const{info:{last:v}}=x,w=v.num_pending+v.delivered.consumer_seq;if(w===0||i.received>=w)try{y()}catch(S){i.stop(S)}finally{y=void 0}else g=w}return i._data=x,i.iterClosed.then(()=>{x.unsubscribe()}),x.closed.then(()=>{i.stop()}).catch(v=>{i.stop(v)}),i}async keys(t=">"){const s=new Mt,i=this._buildCC(t,Vn.LastValue,{headers_only:!0}),l=Array.isArray(t)?">":i.filter_subject,c=ys(i);c.bindStream(this.stream),c.orderedConsumer();const d=await this.js.subscribe(l,c);return(async()=>{var g;for await(const f of d){const m=(g=f.headers)==null?void 0:g.get(cu);if(m!=="DEL"&&m!=="PURGE"){const b=this.decodeKey(f.subject.substring(this.prefixLen));s.push(b)}f.info.pending===0&&d.unsubscribe()}})().then(()=>{s.stop()}).catch(g=>{s.stop(g)}),d.info.last.num_pending===0&&d.unsubscribe(),s}purgeBucket(t){return this.jsm.streams.purge(this.bucketName(),t)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var c;const s=((c=this.js.nc.info)==null?void 0:c.cluster)??"",i=this.bucketName(),l=await this.jsm.streams.info(i);return new ex(l,s)}}class ex{constructor(t,s=""){j(this,"si");j(this,"cluster");this.si=t,this.cluster=s}get bucket(){return this.si.config.name.startsWith(yn)?this.si.config.name.substring(yn.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 Vd(this.si.config.max_age)}get bucket_location(){return this.cluster}get backingStore(){return this.si.config.storage}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get description(){return this.si.config.description??""}get maxBucketSize(){return this.si.config.max_bytes}get maxValueSize(){return this.si.config.max_msg_size}get max_bytes(){return this.si.config.max_bytes}get placement(){return this.si.config.placement||{cluster:"",tags:[]}}get placementCluster(){var t;return((t=this.si.config.placement)==null?void 0:t.cluster)??""}get republish(){return this.si.config.republish??{src:"",dest:""}}get streamInfo(){return this.si}get size(){return this.si.state.bytes}get metadata(){return this.si.config.metadata??{}}get compression(){return this.si.config.compression?this.si.config.compression!==vs.None:!1}}const Jd="OBJ_",zg="SHA-256=";function n2(r){return Xc(r),`${Jd}${r}`}function r2(r){return r.startsWith(Jd)?r.substring(4):r}class bd{constructor(t){j(this,"si");j(this,"backingStore");this.si=t,this.backingStore="JetStream"}get bucket(){return r2(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!==vs.None:!1}}function ec(r){if(r===void 0)return;const{domain:t}=r;if(t===void 0)return r;const s=Object.assign({},r);if(delete s.domain,t==="")return s;if(s.external)throw new Error("domain and external are both set");return s.external={api:`$JS.${t}.API`},s}var qn;(function(r){r[r.Unset=-1]="Unset",r[r.Consume=0]="Consume",r[r.Fetch=1]="Fetch"})(qn||(qn={}));var rr;(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"})(rr||(rr={}));var Yi;(function(r){r.DebugEvent="debug",r.Discard="discard",r.Reset="reset",r.Next="next"})(Yi||(Yi={}));const Ig=Uint8Array.of(43,65,67,75),s2=Uint8Array.of(45,78,65,75),Za=Uint8Array.of(43,87,80,73),i2=Uint8Array.of(43,78,88,84),a2=Uint8Array.of(43,84,69,82,77),o2=Uint8Array.of(32);function vo(r,t=5e3){return new E2(r,t)}class Kh extends Mt{constructor(s,i,l=!1){super();j(this,"consumer");j(this,"opts");j(this,"sub");j(this,"monitor");j(this,"pending");j(this,"inbox");j(this,"refilling");j(this,"pong");j(this,"callback");j(this,"timeout");j(this,"cleanupHandler");j(this,"listeners");j(this,"statusIterator");j(this,"forOrderedConsumer");j(this,"resetHandler");j(this,"abortOnMissingResource");j(this,"bind");j(this,"inBackOff");this.consumer=s;const c=i;this.opts=this.parseOptions(i,l),this.callback=c.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=l,this.timeout=null,this.inbox=Tr(s.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=c.abort_on_missing_resource===!0,this.bind=c.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:s,max_bytes:i,idle_heartbeat:l,threshold_bytes:c,threshold_messages:d}=this.opts;this.closed().then(g=>{if(this.cleanupHandler)try{this.cleanupHandler(g)}catch{}});const{sub:y}=this;y&&y.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(g,f)=>{var b,x,v,w;if(g){this.stop(g);return}if((b=this.monitor)==null||b.work(),f.subject===this.inbox){if(ud(f))return;const S=(x=f.headers)==null?void 0:x.code,C=((w=(v=f.headers)==null?void 0:v.description)==null?void 0:w.toLowerCase())||"unknown",{msgsLeft:L,bytesLeft:U}=this.parseDiscard(f.headers);if(L>0||U>0)this.pending.msgs-=L,this.pending.bytes-=U,this.pending.requests--,this.notify(Yi.Discard,{msgsLeft:L,bytesLeft:U});else if(S===400){this.stop(new de(C,`${S}`));return}else if(S===409&&C==="consumer deleted"){if(this.notify(rr.ConsumerDeleted,`${S} ${C}`),!this.refilling||this.abortOnMissingResource){const ne=new de(C,`${S}`);this.stop(ne);return}}else if(S===503){if(this.notify(rr.NoResponders,`${S} No Responders`),!this.refilling||this.abortOnMissingResource){const ne=new de("no responders",`${S}`);this.stop(ne);return}}else this.notify(Yi.DebugEvent,`${S} ${C}`)}else this._push(vo(f,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=f.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(s&&this.pending.msgs<=d||i&&this.pending.bytes<=c){const S=this.pullOptions();this.pull(S)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),l&&(this.monitor=new Kd(l,g=>(this.notify(rr.HeartbeatsMissed,g),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var f;const g=this.consumer.api.nc.status();this.statusIterator=g;for await(const m of g)switch(m.type){case Nr.Disconnect:(f=this.monitor)==null||f.cancel();break;case Nr.Reconnect:this.resetPending().then(b=>{var x;b&&((x=this.monitor)==null||x.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(s){if(!this.callback)super.push(s);else{const i=typeof s=="function"?s:null;try{i?i():this.callback(s)}catch(l){this.stop(l)}}}notify(s,i){this.listeners.length>0&&this.listeners.forEach(l=>{l.done||l.push({type:s,data:i})})}resetPending(){return this.bind?this.resetPendingNoInfo():this.resetPendingWithInfo()}resetPendingNoInfo(){return this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),Promise.resolve(!0)}async resetPendingWithInfo(){if(this.inBackOff)return!1;let s=0,i=0;const l=Gd([this.opts.expires]);let c=0;for(;;){if(this.done)return!1;if(this.consumer.api.nc.isClosed())return console.error("aborting resetPending - connection is closed"),!1;try{return await this.consumer.info(),this.inBackOff=!1,s=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(d){if(d.message==="stream not found"){if(i++,this.notify(rr.StreamNotFound,i),!this.refilling||this.abortOnMissingResource)return this.stop(d),!1}else if(d.message==="consumer not found"){if(s++,this.notify(rr.ConsumerNotFound,s),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(d),!1;if(this.forOrderedConsumer)return!1}else s=0,i=0;this.inBackOff=!0;const y=l.backoff(c),g=Wi(y);await Promise.race([g,this.consumer.api.nc.closed()]),g.cancel(),c++}}}pull(s){this.pending.bytes+=s.max_bytes??0,this.pending.msgs+=s.batch??0,this.pending.requests++;const i=this.consumer.api.nc;this._push(()=>{i.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`,this.consumer.api.jc.encode(s),{reply:this.inbox}),this.notify(Yi.Next,s)})}pullOptions(){const s=this.opts.max_messages-this.pending.msgs,i=this.opts.max_bytes-this.pending.bytes,l=ut(this.opts.idle_heartbeat),c=ut(this.opts.expires);return{batch:s,max_bytes:i,idle_heartbeat:l,expires:c}}parseDiscard(s){const i={msgsLeft:0,bytesLeft:0},l=s==null?void 0:s.get(Kt.PendingMessagesHdr);l&&(i.msgsLeft=parseInt(l));const c=s==null?void 0:s.get(Kt.PendingBytesHdr);return c&&(i.bytesLeft=parseInt(c)),i}trackTimeout(s){this.timeout=s}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var s,i;(s=this.monitor)==null||s.cancel(),this.monitor=null,(i=this.timeout)==null||i.cancel(),this.timeout=null}setCleanupHandler(s){this.cleanupHandler=s}stop(s){var i,l;this.done||((i=this.sub)==null||i.unsubscribe(),this.clearTimers(),(l=this.statusIterator)==null||l.stop(),this._push(()=>{super.stop(s),this.listeners.forEach(c=>{c.stop()})}))}parseOptions(s,i=!1){const l=s||{};if(l.max_messages=l.max_messages||0,l.max_bytes=l.max_bytes||0,l.max_messages!==0&&l.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(l.max_messages===0&&(l.max_messages=100),l.expires=l.expires||3e4,l.expires<1e3)throw new Error("expires should be at least 1000ms");if(l.idle_heartbeat=l.idle_heartbeat||l.expires/2,l.idle_heartbeat=l.idle_heartbeat>3e4?3e4:l.idle_heartbeat,i){const c=Math.round(l.max_messages*.75)||1;l.threshold_messages=l.threshold_messages||c;const d=Math.round(l.max_bytes*.75)||1;l.threshold_bytes=l.threshold_bytes||d}return l}status(){const s=new Mt;return this.listeners.push(s),Promise.resolve(s)}}class l2 extends Mt{constructor(){super();j(this,"src");j(this,"listeners");this.listeners=[]}setSource(s){this.src&&(this.src.resetHandler=void 0,this.src.setCleanupHandler(),this.src.stop()),this.src=s,this.src.setCleanupHandler(i=>{this.stop(i||void 0)}),(async()=>{const i=await this.src.status();for await(const l of i)this.notify(l.type,l.data)})().catch(()=>{})}notify(s,i){this.listeners.length>0&&this.listeners.forEach(l=>{l.done||l.push({type:s,data:i})})}stop(s){var i;this.done||((i=this.src)==null||i.stop(s),super.stop(s),this.listeners.forEach(l=>{l.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const s=new Mt;return this.listeners.push(s),Promise.resolve(s)}}class xd{constructor(t,s){j(this,"api");j(this,"_info");j(this,"stream");j(this,"name");this.api=t,this._info=s,this.stream=s.stream_name,this.name=s.name}consume(t={max_messages:100,expires:3e4}){return Promise.resolve(new Kh(this,t,!0))}fetch(t={max_messages:100,expires:3e4}){const s=new Kh(this,t,!1),i=Math.round(s.opts.expires*1.05),l=Ji(i);return s.closed().catch(()=>{}).finally(()=>{l.cancel()}),l.catch(()=>{s.close().catch()}),s.trackTimeout(l),Promise.resolve(s)}next(t={expires:3e4}){const s=ft(),i=t;i.max_messages=1;const l=new Kh(this,i,!1),c=Math.round(l.opts.expires*1.05);c>=6e4&&(async()=>{for await(const y of await l.status())if(y.type===rr.HeartbeatsMissed&&y.data>=2){s.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const y of l){s.resolve(y);break}})().catch(()=>{});const d=Ji(c);return l.closed().then(y=>{y?s.reject(y):s.resolve(null)}).catch(y=>{s.reject(y)}).finally(()=>{d.cancel()}),d.catch(y=>{s.resolve(null),l.close().catch()}),l.trackTimeout(d),s}delete(){const{stream_name:t,name:s}=this._info;return this.api.delete(t,s)}info(t=!1){if(t)return Promise.resolve(this._info);const{stream_name:s,name:i}=this._info;return this.api.info(s,i).then(l=>(this._info=l,this._info))}}class c2{constructor(t,s,i={}){j(this,"api");j(this,"consumerOpts");j(this,"consumer");j(this,"opts");j(this,"cursor");j(this,"stream");j(this,"namePrefix");j(this,"serial");j(this,"currentConsumer");j(this,"userCallback");j(this,"iter");j(this,"type");j(this,"startSeq");j(this,"maxInitialReset");this.api=t,this.stream=s,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=xs.next(),typeof i.name_prefix=="string"&&(bu("name_prefix",i.name_prefix),this.namePrefix=i.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=qn.Unset,this.consumerOpts=i,this.maxInitialReset=30,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(t){this.serial++;const s=`${this.namePrefix}_${this.serial}`;t=t===0?1:t;const i={name:s,deliver_policy:vt.StartSequence,opt_start_seq:t,ack_policy:Ct.None,inactive_threshold:ut(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(i.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(i.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(i.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(i.replay_policy=this.consumerOpts.replay_policy),t===this.startSeq+1&&(i.deliver_policy=this.consumerOpts.deliver_policy||vt.StartSequence,(this.consumerOpts.deliver_policy===vt.LastPerSubject||this.consumerOpts.deliver_policy===vt.New||this.consumerOpts.deliver_policy===vt.Last)&&(delete i.opt_start_seq,i.deliver_policy=this.consumerOpts.deliver_policy),i.deliver_policy===vt.LastPerSubject&&typeof i.filter_subjects>"u"&&typeof i.filter_subject>"u"&&(i.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete i.opt_start_seq,i.deliver_policy=vt.StartTime,i.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(i.inactive_threshold=ut(this.consumerOpts.inactive_threshold))),i}async resetConsumer(t=0){var d,y,g,f,m;xs.next();const s=this.serial===0;(d=this.consumer)==null||d.delete().catch(()=>{}),t=t===0?1:t,this.cursor.deliver_seq=0;const i=this.getConsumerOpts(t);i.max_deliver=1,i.mem_storage=!0;const l=Gd([((y=this.opts)==null?void 0:y.expires)||3e4]);let c;for(let b=0;;b++)try{c=await this.api.add(this.stream,i),(g=this.iter)==null||g.notify(rr.OrderedConsumerRecreated,c.name);break}catch(x){if(x.message==="stream not found"&&((f=this.iter)==null||f.notify(rr.StreamNotFound,b),this.type===qn.Fetch||this.opts.abort_on_missing_resource===!0))return(m=this.iter)==null||m.stop(x),Promise.reject(x);if(s&&b>=this.maxInitialReset)throw x;await Wi(l.backoff(b+1))}return c}internalHandler(t){return s=>{var l;if(this.serial!==t)return;const i=s.info.deliverySequence;if(i!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=i,this.cursor.stream_seq=s.info.streamSequence,this.userCallback?this.userCallback(s):(l=this.iter)==null||l.push(s)}}async reset(t={max_messages:100,expires:3e4},s){var g,f;s=s||{};const i=s.fromFetch||!1,l=s.orderedReset||!1;if(this.type===qn.Fetch&&l){(g=this.iter)==null||g.src.stop(),await((f=this.iter)==null?void 0:f.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||l)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||i)&&(this.iter=new l2),this.consumer=new xd(this.api,this.currentConsumer);const c=t;c.callback=this.internalHandler(this.serial);let d=null;this.type===qn.Fetch&&i?d=await this.consumer.fetch(t):this.type===qn.Consume&&(d=await this.consumer.consume(t));const y=d;y.forOrderedConsumer=!0,y.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(y)}notifyOrderedResetAndReset(){var t;(t=this.iter)==null||t.notify(Yi.Reset,""),this.reset(this.opts,{orderedReset:!0})}async consume(t={max_messages:100,expires:3e4}){if(t.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===qn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===qn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:i}=t;return i&&(this.userCallback=i),this.type=qn.Consume,this.opts=t,await this.reset(t),this.iter}async fetch(t={max_messages:100,expires:3e4}){var l;if(t.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===qn.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(((l=this.iter)==null?void 0:l.done)===!1)return Promise.reject(new Error("ordered consumer doesn't support concurrent fetch"));const{callback:i}=t;return i&&(this.userCallback=i),this.type=qn.Fetch,this.opts=t,await this.reset(t,{fromFetch:!0}),this.iter}async next(t={expires:3e4}){const s=t;if(s.bind)return Promise.reject(new Error("bind is not supported"));s.max_messages=1;const i=ft();return s.callback=c=>{this.userCallback=null,i.resolve(c)},(await this.fetch(s)).iterClosed.then(c=>{c&&i.reject(c),i.resolve(null)}).catch(c=>{i.reject(c)}),i}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(t=>Promise.resolve(t)).catch(t=>Promise.reject(t)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(t){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):t&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class vd{constructor(t){j(this,"api");j(this,"notified");this.api=t,this.notified=!1}checkVersion(){const t=this.api.nc.features.get($e.JS_SIMPLIFICATION);return t.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${t.min} or better`))}getPullConsumerFor(t){if(t.config.deliver_subject!==void 0)throw new Error("push consumer not supported");return new xd(this.api,t)}async get(t,s={}){return typeof s=="object"?this.ordered(t,s):(await this.checkVersion(),this.api.info(t,s).then(i=>i.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new xd(this.api,i)).catch(i=>Promise.reject(i)))}async ordered(t,s){await this.checkVersion();const i=this.api;return new Xd(i.nc,i.opts).info(t).then(c=>Promise.resolve(new c2(this.api,t,s))).catch(c=>Promise.reject(c))}}class vu{constructor(t,s){j(this,"api");j(this,"_info");this.api=t,this._info=s}get name(){return this._info.config.name}alternates(){return this.info().then(t=>t.alternates?t.alternates:[])}async best(){if(await this.info(),this._info.alternates){const t=await this.api.info(this._info.alternates[0].name);return new vu(this.api,t)}else return this}info(t=!1,s){return t?Promise.resolve(this._info):this.api.info(this.name,s).then(i=>(this._info=i,this._info))}getConsumerFromInfo(t){return new vd(new au(this.api.nc,this.api.opts)).getPullConsumerFor(t)}getConsumer(t){return new vd(new au(this.api.nc,this.api.opts)).get(this.name,t)}getMessage(t){return this.api.getMessage(this.name,t)}deleteMessage(t,s){return this.api.deleteMessage(this.name,t,s)}}class Xd extends wo{constructor(t,s){super(t,s)}checkStreamConfigVersions(t){const s=this.nc;if(t.metadata){const{min:l,ok:c}=s.features.get($e.JS_STREAM_CONSUMER_METADATA);if(!c)throw new Error(`stream 'metadata' requires server ${l}`)}if(t.first_seq){const{min:l,ok:c}=s.features.get($e.JS_STREAM_FIRST_SEQ);if(!c)throw new Error(`stream 'first_seq' requires server ${l}`)}if(t.subject_transform){const{min:l,ok:c}=s.features.get($e.JS_STREAM_SUBJECT_TRANSFORM);if(!c)throw new Error(`stream 'subject_transform' requires server ${l}`)}if(t.compression){const{min:l,ok:c}=s.features.get($e.JS_STREAM_COMPRESSION);if(!c)throw new Error(`stream 'compression' requires server ${l}`)}if(t.consumer_limits){const{min:l,ok:c}=s.features.get($e.JS_DEFAULT_CONSUMER_LIMITS);if(!c)throw new Error(`stream 'consumer_limits' requires server ${l}`)}function i(l,c){var y;if((((y=c==null?void 0:c.subject_transforms)==null?void 0:y.length)||0)>0){const{min:g,ok:f}=s.features.get($e.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!f)throw new Error(`${l} 'subject_transforms' requires server ${g}`)}}t.sources&&t.sources.forEach(l=>{i("stream sources",l)}),t.mirror&&i("stream mirror",t.mirror)}async add(t={}){var l;this.checkStreamConfigVersions(t),Gt(t.name),t.mirror=ec(t.mirror),t.sources=(l=t.sources)==null?void 0:l.map(ec);const i=await this._request(`${this.prefix}.STREAM.CREATE.${t.name}`,t);return this._fixInfo(i),i}async delete(t){return Gt(t),(await this._request(`${this.prefix}.STREAM.DELETE.${t}`)).success}async update(t,s={}){var y;if(typeof t=="object"){const g=t;t=g.name,s=g,console.trace("\x1B[33m >> streams.update(config: StreamConfig) api changed to streams.update(name: string, config: StreamUpdateConfig) - this shim will be removed - update your code. \x1B[0m")}this.checkStreamConfigVersions(s),Gt(t);const i=await this.info(t),l=Object.assign(i.config,s);l.mirror=ec(l.mirror),l.sources=(y=l.sources)==null?void 0:y.map(ec);const d=await this._request(`${this.prefix}.STREAM.UPDATE.${t}`,l);return this._fixInfo(d),d}async info(t,s){Gt(t);const i=`${this.prefix}.STREAM.INFO.${t}`;let c=await this._request(i,s),{total:d,limit:y}=c,g=c.state.subjects?Object.getOwnPropertyNames(c.state.subjects).length:1;if(d&&d>g){const f=[c],m=s||{};let b=0;for(;d>g;){b++,m.offset=y*b;const v=await this._request(i,m);d=v.total,f.push(v);const w=Object.getOwnPropertyNames(v.state.subjects).length;if(g+=w,w<y)break}let x={};for(let v=0;v<f.length;v++)c=f[v],c.state.subjects&&(x=Object.assign(x,c.state.subjects));c.offset=0,c.total=0,c.limit=0,c.state.subjects=x}return this._fixInfo(c),c}list(t=""){const s=t!=null&&t.length?{subject:t}:{},i=c=>{const d=c;return d.streams.forEach(y=>{this._fixInfo(y)}),d.streams},l=`${this.prefix}.STREAM.LIST`;return new co(l,i,this,s)}_fixInfo(t){t.config.sealed=t.config.sealed||!1,t.config.deny_delete=t.config.deny_delete||!1,t.config.deny_purge=t.config.deny_purge||!1,t.config.allow_rollup_hdrs=t.config.allow_rollup_hdrs||!1}async purge(t,s){if(s){const{keep:l,seq:c}=s;if(typeof l=="number"&&typeof c=="number")throw new Error("can specify one of keep or seq")}return Gt(t),await this._request(`${this.prefix}.STREAM.PURGE.${t}`,s)}async deleteMessage(t,s,i=!0){Gt(t);const l={seq:s};return i||(l.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${t}`,l)).success}async getMessage(t,s){Gt(t);const l=await this._request(`${this.prefix}.STREAM.MSG.GET.${t}`,s);return new tx(l)}find(t){return this.findStream(t)}listKvs(){const t=i=>{var g;const c=i.streams.filter(f=>f.config.name.startsWith(yn));c.forEach(f=>{this._fixInfo(f)});let d="";return c.length&&(d=((g=this.nc.info)==null?void 0:g.cluster)??""),c.map(f=>new ex(f,d))},s=`${this.prefix}.STREAM.LIST`;return new co(s,t,this)}listObjectStores(){const t=i=>{const c=i.streams.filter(y=>y.config.name.startsWith(Jd));return c.forEach(y=>{this._fixInfo(y)}),c.map(y=>new bd(y))},s=`${this.prefix}.STREAM.LIST`;return new co(s,t,this)}names(t=""){const s=t!=null&&t.length?{subject:t}:{},i=c=>c.streams,l=`${this.prefix}.STREAM.NAMES`;return new co(l,i,this,s)}async get(t){const s=await this.info(t);return Promise.resolve(new vu(this,s))}}class u2 extends wo{constructor(t,s){super(t,s)}async getMessage(t,s){Gt(t);let i=s;const{last_by_subj:l}=i;l&&(i=null);const c=i?this.jc.encode(i):vn,d=this.opts.apiPrefix||"$JS.API",y=l?`${d}.DIRECT.GET.${t}.${l}`:`${d}.DIRECT.GET.${t}`,g=await this.nc.request(y,c,{timeout:this.timeout}),f=Gi(g);if(f)return Promise.reject(f);const m=new _d(g);return Promise.resolve(m)}async getBatch(t,s){Gt(t);const l=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${t}`;if(!Array.isArray(s.multi_last)||s.multi_last.length===0)return Promise.reject("multi_last is required");const c=JSON.stringify(s,(g,f)=>g==="up_to_time"&&f instanceof Date?f.toISOString():f),d=new Mt,y=await this.nc.requestMany(l,c,{strategy:Kn.SentinelMsg});return(async()=>{var b,x,v;let g=!1,f=!1,m;for await(const w of y){if(!g){g=!0;const S=((b=w.headers)==null?void 0:b.code)||0;if(S!==0&&S<200||S>299){m=(x=w.headers)==null?void 0:x.description.toLowerCase();break}if(((v=w.headers)==null?void 0:v.get("Nats-Num-Pending"))===""){f=!0;break}}if(w.data.length===0)break;d.push(new _d(w))}d.push(()=>{if(f)throw new Error("batch direct get not supported by the server");if(m)throw new Error(`bad request: ${m}`);d.stop()})})(),Promise.resolve(d)}}class _d{constructor(t){j(this,"data");j(this,"header");if(!t.headers)throw new Error("headers expected");this.data=t.data,this.header=t.headers}get subject(){return this.header.last(Ii.Subject)}get seq(){const t=this.header.last(Ii.Sequence);return typeof t=="string"?parseInt(t):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(Ii.TimeStamp)}get stream(){return this.header.last(Ii.Stream)}json(t){return Jn(t).decode(this.data)}string(){return gn.decode(this.data)}}j(_d,"jc");class f2 extends wo{constructor(s,i){super(s,i);j(this,"streams");j(this,"consumers");j(this,"direct");this.streams=new Xd(s,i),this.consumers=new au(s,i),this.direct=new u2(s,i)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const s=new Mt;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(i,l)=>{if(i)throw i;try{const c=this.parseJsResponse(l),d=c.type.split("."),y=d[d.length-1];s.push({kind:y,data:c})}catch(c){s.stop(c)}}}),s}}class tx{constructor(t){j(this,"_header");j(this,"smr");this.smr=t}get subject(){return this.smr.message.subject}get seq(){return this.smr.message.seq}get timestamp(){return this.smr.message.time}get time(){return new Date(Date.parse(this.timestamp))}get data(){return this.smr.message.data?this._parse(this.smr.message.data):vn}get header(){if(!this._header)if(this.smr.message.hdrs){const t=this._parse(this.smr.message.hdrs);this._header=ps.decode(t)}else this._header=Cr();return this._header}_parse(t){const s=atob(t),i=s.length,l=new Uint8Array(i);for(let c=0;c<i;c++)l[c]=s.charCodeAt(c);return l}json(t){return Jn(t).decode(this.data)}string(){return gn.decode(this.data)}}j(tx,"jc");class h2{constructor(t){j(this,"api");this.api=t}get(t){return this.api.info(t).then(s=>new vu(this.api,s))}}class Jh{constructor(t){j(this,"info");j(this,"hdrs");this.info=t}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=ps.fromRecord(this.info.headers||{})),this.hdrs}get options(){return this.info.options}get bucket(){return this.info.bucket}get chunks(){return this.info.chunks}get deleted(){return this.info.deleted??!1}get digest(){return this.info.digest}get mtime(){return this.info.mtime}get nuid(){return this.info.nuid}get size(){return this.info.size}get revision(){return this.info.revision}get metadata(){return this.info.metadata||{}}isLink(){var t,s;return((t=this.info.options)==null?void 0:t.link)!==void 0&&((s=this.info.options)==null?void 0:s.link)!==null}}function $g(r){const t={name:r.name,description:r.description??"",options:r.options,metadata:r.metadata};if(r.headers){const s=r.headers;t.headers=s.toRecord()}return t}function d2(){return new ReadableStream({pull(r){r.enqueue(new Uint8Array(0)),r.close()}})}class po{constructor(t,s,i){j(this,"jsm");j(this,"js");j(this,"stream");j(this,"name");this.name=t,this.jsm=s,this.js=i}_checkNotEmpty(t){return!t||t.length===0?{name:t,error:new Error("name cannot be empty")}:{name:t}}async info(t){const s=await this.rawInfo(t);return s?new Jh(s):null}async list(){const t=[],s=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const i of s){if(i===null)break;t.push(i)}return Promise.resolve(t)}async rawInfo(t){const{name:s,error:i}=this._checkNotEmpty(t);if(i)return Promise.reject(i);const l=this._metaSubject(s);try{const c=await this.jsm.streams.getMessage(this.stream,{last_by_subj:l}),y=Jn().decode(c.data);return y.revision=c.seq,y}catch(c){return c.code==="404"?null:Promise.reject(c)}}async _si(t){try{return await this.jsm.streams.info(this.stream,t)}catch(s){return s.code==="404"?null:Promise.reject(s)}}async seal(){let t=await this._si();return t===null?Promise.reject(new Error("object store not found")):(t.config.sealed=!0,t=await this.jsm.streams.update(this.stream,t.config),Promise.resolve(new bd(t)))}async status(t){const s=await this._si(t);return s===null?Promise.reject(new Error("object store not found")):Promise.resolve(new bd(s))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(t,s,i){var se;const l=this.js.getOptions();i=i||{timeout:l.timeout},i.timeout=i.timeout||l.timeout,i.previousRevision=i.previousRevision??void 0;const{timeout:c,previousRevision:d}=i,y=this.js.nc.info,g=(y==null?void 0:y.max_payload)||1024;t=t||{},t.options=t.options||{};let f=((se=t.options)==null?void 0:se.max_chunk_size)||128*1024;f=f>g?g:f,t.options.max_chunk_size=f;const m=await this.info(t.name),{name:b,error:x}=this._checkNotEmpty(t.name);if(x)return Promise.reject(x);const v=xs.next(),w=this._chunkSubject(v),S=this._metaSubject(b),C=Object.assign({bucket:this.name,nuid:v,size:0,chunks:0},$g(t)),L=ft(),U=[],ne=new Qi;try{const D=s?s.getReader():null,z=Cg.create();for(;;){const{done:ae,value:X}=D?await D.read():{done:!0,value:void 0};if(ae){if(ne.size()>0){const J=ne.drain();z.update(J),C.chunks++,C.size+=J.length,U.push(this.js.publish(w,J,{timeout:c}))}await Promise.all(U),U.length=0,C.mtime=new Date().toISOString();const M=Vi.encode(z.digest());C.digest=`${zg}${M}`,C.deleted=!1;const $=Cr();typeof d=="number"&&$.set(nr.ExpectedLastSubjectSequenceHdr,`${d}`),$.set(Kt.RollupHdr,Kt.RollupValueSubject);const Z=await this.js.publish(S,Jn().encode(C),{headers:$,timeout:c});if(C.revision=Z.seq,m)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${m.nuid}`})}catch{}L.resolve(new Jh(C));break}if(X)for(ne.fill(X);ne.size()>f;){C.chunks++,C.size+=f;const M=ne.drain(t.options.max_chunk_size);z.update(M),U.push(this.js.publish(w,M,{timeout:c}))}}}catch(D){await this.jsm.streams.purge(this.stream,{filter:w}),L.reject(D)}return L}putBlob(t,s,i){function l(c){return new ReadableStream({pull(d){d.enqueue(c),d.close()}})}return s===null&&(s=new Uint8Array(0)),this.put(t,l(s),i)}put(t,s,i){var l;return(l=t==null?void 0:t.options)!=null&&l.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(t,s,i)}async getBlob(t){async function s(c){const d=new Qi,y=c.getReader();for(;;){const{done:g,value:f}=await y.read();if(g)return d.drain();f&&f.length&&d.fill(f)}}const i=await this.get(t);if(i===null)return Promise.resolve(null);const l=await Promise.all([i.error,s(i.data)]);return l[0]?Promise.reject(l[0]):Promise.resolve(l[1])}async get(t){const s=await this.rawInfo(t);if(s===null||s.deleted)return Promise.resolve(null);if(s.options&&s.options.link){const b=s.options.link.name||"";if(b==="")throw new Error("link is a bucket");return(s.options.link.bucket!==this.name?await po.create(this.js,s.options.link.bucket):this).get(b)}if(!s.digest.startsWith(zg))return Promise.reject(new Error(`unknown digest type: ${s.digest}`));const i=dd(s.digest.substring(8));if(i===null)return Promise.reject(new Error(`unable to parse digest: ${s.digest}`));const l=ft(),c={info:new Jh(s),error:l};if(s.size===0)return c.data=d2(),l.resolve(null),Promise.resolve(c);let d;const y=ys();y.orderedConsumer();const g=Cg.create(),f=`$O.${this.name}.C.${s.nuid}`,m=await this.js.subscribe(f,y);return(async()=>{for await(const b of m)b.data.length>0&&(g.update(b.data),d.enqueue(b.data)),b.info.pending===0&&(tE(i,g.digest())?d.close():d.error(new Error(`received a corrupt object, digests do not match received: ${s.digest} calculated ${i}`)),m.unsubscribe())})().then(()=>{l.resolve()}).catch(b=>{d.error(b),l.reject(b)}),c.data=new ReadableStream({start(b){d=b},cancel(){m.unsubscribe()}}),c}linkStore(t,s){if(!(s instanceof po))return Promise.reject("bucket required");const i=s,{name:l,error:c}=this._checkNotEmpty(t);if(c)return Promise.reject(c);const d={name:l,options:{link:{bucket:i.name}}};return this._put(d,null)}async link(t,s){const{name:i,error:l}=this._checkNotEmpty(t);if(l)return Promise.reject(l);if(s.deleted)return Promise.reject(new Error("src object is deleted"));if(s.isLink())return Promise.reject(new Error("src object is a link"));const c=await this.rawInfo(t);if(c!==null&&!c.deleted)return Promise.reject(new Error("an object already exists with that name"));const d={bucket:s.bucket,name:s.name},y={name:i,bucket:s.bucket,options:{link:d}};await this.js.publish(this._metaSubject(t),JSON.stringify(y));const g=await this.info(t);return Promise.resolve(g)}async delete(t){const s=await this.rawInfo(t);if(s===null)return Promise.resolve({purged:0,success:!1});s.deleted=!0,s.size=0,s.chunks=0,s.digest="";const i=Jn(),l=Cr();return l.set(Kt.RollupHdr,Kt.RollupValueSubject),await this.js.publish(this._metaSubject(s.name),i.encode(s),{headers:l}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(s.nuid)})}async update(t,s={}){const i=await this.rawInfo(t);if(i===null)return Promise.reject(new Error("object not found"));if(i.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));s.name=s.name??i.name;const{name:l,error:c}=this._checkNotEmpty(s.name);if(c)return Promise.reject(c);if(t!==s.name){const g=await this.info(s.name);if(g&&!g.deleted)return Promise.reject(new Error("an object already exists with that name"))}s.name=l;const d=Object.assign({},i,$g(s)),y=await this.js.publish(this._metaSubject(d.name),JSON.stringify(d));return t!==s.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(t)}),Promise.resolve(y)}async watch(t={}){t.includeHistory=t.includeHistory??!1,t.ignoreDeletes=t.ignoreDeletes??!1;let s=!1;const i=new Mt,l=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:l})}catch(g){g.code==="404"?(i.push(null),s=!0):i.stop(g)}const c=Jn(),d=ys();d.orderedConsumer(),t.includeHistory?d.deliverLastPerSubject():(s=!0,d.deliverNew()),d.callback((g,f)=>{var m;if(g){i.stop(g);return}if(f!==null){const b=c.decode(f.data);b.deleted&&t.ignoreDeletes===!0||i.push(b),((m=f.info)==null?void 0:m.pending)===0&&!s&&(s=!0,i.push(null))}});const y=await this.js.subscribe(l,d);return i._data=y,i.iterClosed.then(()=>{y.unsubscribe()}),y.closed.then(()=>{i.stop()}).catch(g=>{i.stop(g)}),i}_chunkSubject(t){return`$O.${this.name}.C.${t}`}_metaSubject(t){return`$O.${this.name}.M.${Vi.encode(t)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(t={}){try{this.stream=n2(this.name)}catch(l){return Promise.reject(l)}const s=(t==null?void 0:t.ttl)||0;delete t.ttl;const i=Object.assign({max_age:s},t);i.name=this.stream,i.num_replicas=t.replicas??1,i.allow_direct=!0,i.allow_rollup_hdrs=!0,i.discard=go.New,i.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],t.placement&&(i.placement=t.placement),t.metadata&&(i.metadata=t.metadata),typeof t.compression=="boolean"&&(i.compression=t.compression?vs.S2:vs.None);try{await this.jsm.streams.info(i.name)}catch(l){l.message==="stream not found"&&await this.jsm.streams.add(i)}}static async create(t,s,i={}){const l=await t.jetstreamManager(),c=new po(s,l,t);return await c.init(i),Promise.resolve(c)}}class m2{constructor(t){j(this,"js");this.js=t}kv(t,s={}){const i=this.js,{ok:l,min:c}=i.nc.features.get($e.JS_KV);return l?s.bindOnly?xo.bind(this.js,t,s):xo.create(this.js,t,s):Promise.reject(new Error(`kv is only supported on servers ${c} or better`))}os(t,s={}){var d;if(typeof((d=crypto==null?void 0:crypto.subtle)==null?void 0:d.digest)!="function")return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));const i=this.js,{ok:l,min:c}=i.nc.features.get($e.JS_OBJECTSTORE);return l?po.create(this.js,t,s):Promise.reject(new Error(`objectstore is only supported on servers ${c} or better`))}}class Qd extends wo{constructor(s,i){super(s,i);j(this,"consumers");j(this,"streams");j(this,"consumerAPI");j(this,"streamAPI");this.consumerAPI=new au(s,i),this.streamAPI=new Xd(s,i),this.consumers=new vd(this.consumerAPI),this.streams=new h2(this.streamAPI)}jetstreamManager(s){s===void 0&&(s=this.opts.checkAPI);const i=Object.assign({},this.opts,{checkAPI:s});return this.nc.jetstreamManager(i)}get apiPrefix(){return this.prefix}get views(){return new m2(this)}async publish(s,i=vn,l){l=l||{},l.expect=l.expect||{};const c=(l==null?void 0:l.headers)||Cr();l&&(l.msgID&&c.set(nr.MsgIdHdr,l.msgID),l.expect.lastMsgID&&c.set(nr.ExpectedLastMsgIdHdr,l.expect.lastMsgID),l.expect.streamName&&c.set(nr.ExpectedStreamHdr,l.expect.streamName),typeof l.expect.lastSequence=="number"&&c.set(nr.ExpectedLastSeqHdr,`${l.expect.lastSequence}`),typeof l.expect.lastSubjectSequence=="number"&&c.set(nr.ExpectedLastSubjectSequenceHdr,`${l.expect.lastSubjectSequence}`));const d=l.timeout||this.timeout,y={};d&&(y.timeout=d),l&&(y.headers=c);let{retries:g,retry_delay:f}=l;g=g||1,f=f||250;let m;for(let x=0;x<g;x++)try{m=await this.nc.request(s,i,y);break}catch(v){if(v.code==="503"&&x+1<g)await Wi(f);else throw v}const b=this.parseJsResponse(m);if(b.stream==="")throw de.errorForCode(ce.JetStreamInvalidAck);return b.duplicate=b.duplicate?b.duplicate:!1,b}async pull(s,i,l=0){Gt(s),Fi(i);let c=this.timeout;l>c&&(c=l),l=l<0?0:ut(l);const d={batch:1,no_wait:l===0,expires:l},y=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${i}`,this.jc.encode(d),{noMux:!0,timeout:c}),g=Gi(y);if(g)throw g;return vo(y,this.timeout)}fetch(s,i,l={}){Gt(s),Fi(i);let c=null;const d=(l.max_bytes??0)>0;let y=0;const g=d?l.max_bytes:0;let f=null;const m={};if(m.batch=l.batch||1,g){const U=this.nc.features.get($e.JS_PULL_MAX_BYTES);if(!U.ok)throw new Error(`max_bytes is only supported on servers ${U.min} or better`);m.max_bytes=g}m.no_wait=l.no_wait||!1,m.no_wait&&m.expires&&(m.expires=0);const b=l.expires||0;if(b&&(m.expires=ut(b)),b===0&&m.no_wait===!1)throw new Error("expires or no_wait is required");const x=l.idle_heartbeat||0;x&&(m.idle_heartbeat=ut(x),l.delay_heartbeat===!0&&(m.idle_heartbeat=ut(x*4)));const v=new Mt,w=m.batch;let S=0;v.protocolFilterFn=(U,ne=!1)=>ud(U.msg)?(f==null||f.work(),!1):!0,v.dispatchedFn=U=>{if(U){if(d&&(y+=U.data.length),S++,c&&U.info.pending===0)return;(v.getPending()===1&&U.info.pending===0||w===S||g>0&&y>=g)&&v.stop()}};const C=Tr(this.nc.options.inboxPrefix),L=this.nc.subscribe(C,{max:l.batch,callback:(U,ne)=>{U===null&&(U=Gi(ne)),U!==null?(c&&(c.cancel(),c=null),LS(U)?v.stop(rx(U)===null?void 0:U):v.stop(U)):(f==null||f.work(),v.received++,v.push(vo(ne,this.timeout)))}});return b&&(c=Ji(b),c.catch(()=>{L.isClosed()||(L.drain().catch(()=>{}),c=null),f&&f.cancel()})),(async()=>{try{x&&(f=new Kd(x,U=>(v.push(()=>{v.err=new de(`${Ln.IdleHeartbeatMissed}: ${U}`,ce.JetStreamIdleHeartBeat)}),!0)))}catch{}await L.closed,c!==null&&(c.cancel(),c=null),f&&f.cancel(),v.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${i}`,this.jc.encode(m),{reply:C}),v}async pullSubscribe(s,i=ys()){const l=await this._processOptions(s,i);if(l.ordered)throw new Error("pull subscribers cannot be be ordered");if(l.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const c=l.config.ack_policy;if(c===Ct.None||c===Ct.All)throw new Error("ack policy for pull consumers must be explicit");const d=this._buildTypedSubscriptionOpts(l),y=new b2(this,l.deliver,d);y.info=l;try{await this._maybeCreateConsumer(l)}catch(g){throw y.unsubscribe(),g}return y}async subscribe(s,i=ys()){const l=await this._processOptions(s,i);if(!l.isBind&&!l.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const c=this._buildTypedSubscriptionOpts(l),d=new nx(this,l.deliver,c);d.info=l;try{await this._maybeCreateConsumer(l)}catch(y){throw d.unsubscribe(),y}return d._maybeSetupHbMonitoring(),d}async _processOptions(s,i=ys()){const l=jg(i)?i.getOpts():i;if(l.isBind=jg(i)?i.isBind:!1,l.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},l.ordered){if(l.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},l.config.ack_policy!==Ct.NotSet&&l.config.ack_policy!==Ct.None)throw new de("ordered consumer: ack_policy can only be set to 'none'",ce.ApiError);if(l.config.durable_name&&l.config.durable_name.length>0)throw new de("ordered consumer: durable_name cannot be set",ce.ApiError);if(l.config.deliver_subject&&l.config.deliver_subject.length>0)throw new de("ordered consumer: deliver_subject cannot be set",ce.ApiError);if(l.config.max_deliver!==void 0&&l.config.max_deliver>1)throw new de("ordered consumer: max_deliver cannot be set",ce.ApiError);if(l.config.deliver_group&&l.config.deliver_group.length>0)throw new de("ordered consumer: deliver_group cannot be set",ce.ApiError);l.config.deliver_subject=Tr(this.nc.options.inboxPrefix),l.config.ack_policy=Ct.None,l.config.max_deliver=1,l.config.flow_control=!0,l.config.idle_heartbeat=l.config.idle_heartbeat||ut(5e3),l.config.ack_wait=ut(1320*60*1e3),l.config.mem_storage=!0,l.config.num_replicas=1}if(l.config.ack_policy===Ct.NotSet&&(l.config.ack_policy=Ct.All),l.api=this,l.config=l.config||{},l.stream=l.stream?l.stream:await this.findStream(s),l.attached=!1,l.config.durable_name)try{const c=await this.consumerAPI.info(l.stream,l.config.durable_name);if(c){if(c.config.filter_subject&&c.config.filter_subject!==s)throw new Error("subject does not match consumer");const d=l.config.deliver_group??"";if(d===""&&c.push_bound===!0)throw new Error("duplicate subscription");const y=c.config.deliver_group??"";if(d!==y)throw y===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${y}'`);l.last=c,l.config=c.config,l.attached=!0,l.config.durable_name||(l.name=c.name)}}catch(c){if(c.code!=="404")throw c}return!l.attached&&l.config.filter_subject===void 0&&l.config.filter_subjects===void 0&&(l.config.filter_subject=s),l.deliver=l.config.deliver_subject||Tr(this.nc.options.inboxPrefix),l}_buildTypedSubscriptionOpts(s){const i={};return i.adapter=x2(s.callbackFn===void 0,this.timeout),i.ingestionFilterFn=Qd.ingestionFn(s.ordered),i.protocolFilterFn=(l,c=!1)=>{const d=l;return cd(d.msg)?(c||d.msg.respond(),!1):!0},!s.mack&&s.config.ack_policy!==Ct.None&&(i.dispatchedFn=w2),s.callbackFn&&(i.callback=s.callbackFn),i.max=s.max||0,i.queue=s.queue,i}async _maybeCreateConsumer(s){if(s.attached)return;if(s.isBind)throw new Error(`unable to bind - durable consumer ${s.config.durable_name} doesn't exist in ${s.stream}`);s.config=Object.assign({deliver_policy:vt.All,ack_policy:Ct.Explicit,ack_wait:ut(30*1e3),replay_policy:Xi.Instant},s.config);const i=await this.consumerAPI.add(s.stream,s.config);if(Array.isArray(s.config.filter_subjects&&!Array.isArray(i.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");s.name=i.name,s.config=i.config,s.last=i}static ingestionFn(s){return(i,l)=>{var g;const c=l;if(!i)return{ingest:!1,protocol:!1};const d=i;if(Gi(d.msg)||(g=c.monitor)==null||g.work(),ud(d.msg)){const f=s?c._checkHbOrderConsumer(d.msg):!0;return s||c.info.flow_control.heartbeat_count++,{ingest:f,protocol:!0}}else if(cd(d.msg))return c.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:s?c._checkOrderedConsumer(i):!0,protocol:!1}}}}class Zd{constructor(t){j(this,"options");j(this,"protocol");j(this,"draining");j(this,"listeners");j(this,"_services");this.draining=!1,this.options=BE(t),this.listeners=[]}static connect(t={}){return new Promise((s,i)=>{const l=new Zd(t);lu.connect(l.options,l).then(c=>{l.protocol=c,(async function(){for await(const d of c.status())l.listeners.forEach(y=>{y.push(d)})})(),s(l)}).catch(c=>{i(c)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(t,s,i){if(this.isClosed())throw de.errorForCode(ce.ConnectionClosed);if(s&&this.isDraining()||i&&this.protocol.noMorePublishing)throw de.errorForCode(ce.ConnectionDraining);if(t=t||"",t.length===0)throw de.errorForCode(ce.BadSubject)}publish(t,s,i){this._check(t,!1,!0),this.protocol.publish(t,s,i)}publishMessage(t){return this.publish(t.subject,t.data,{reply:t.reply,headers:t.headers})}respondMessage(t){return t.reply?(this.publish(t.reply,t.data,{reply:t.reply,headers:t.headers}),!0):!1}subscribe(t,s={}){this._check(t,!0,!1);const i=new Zb(this.protocol,t,s);return this.protocol.subscribe(i),i}_resub(t,s,i){this._check(s,!0,!1);const l=t;l.max=i,i&&(l.max=i+l.received),this.protocol.resub(l,s)}requestMany(t,s=vn,i={maxWait:1e3,maxMessages:-1}){const l=!this.protocol.options.noAsyncTraces;try{this._check(t,!0,!0)}catch(g){return Promise.reject(g)}if(i.strategy=i.strategy||Kn.Timer,i.maxWait=i.maxWait||1e3,i.maxWait<1)return Promise.reject(new de("timeout",ce.InvalidOption));const c=new Mt;function d(g){c.push(()=>{c.stop(g)})}function y(g,f){g||f===null?d(g===null?void 0:g):c.push(f)}if(i.noMux){const g=l?new Error().stack:null;let f=typeof i.maxMessages=="number"&&i.maxMessages>0?i.maxMessages:-1;const m=this.subscribe(Tr(this.options.inboxPrefix),{callback:(w,S)=>{var C,L;if(((C=S==null?void 0:S.data)==null?void 0:C.length)===0&&((L=S==null?void 0:S.headers)==null?void 0:L.status)===ce.NoResponders&&(w=de.errorForCode(ce.NoResponders)),w){g&&(w.stack+=`
|
|
48
|
+
|
|
49
|
+
${g}`),b(w);return}y(null,S),i.strategy===Kn.Count&&(f--,f===0&&b()),i.strategy===Kn.JitterTimer&&(v(),x=setTimeout(()=>{b()},300)),i.strategy===Kn.SentinelMsg&&S&&S.data.length===0&&b()}});m.requestSubject=t,m.closed.then(()=>{d()}).catch(w=>{c.stop(w)});const b=w=>{w&&c.push(()=>{throw w}),v(),m.drain().then(()=>{d()}).catch(S=>{d()})};c.iterClosed.then(()=>{v(),m==null||m.unsubscribe()}).catch(w=>{v(),m==null||m.unsubscribe()});try{this.publish(t,s,{reply:m.getSubject()})}catch(w){b(w)}let x=setTimeout(()=>{b()},i.maxWait);const v=()=>{x&&clearTimeout(x)}}else{const g=i;g.callback=y,c.iterClosed.then(()=>{f.cancel()}).catch(m=>{f.cancel(m)});const f=new nE(this.protocol.muxSubscriptions,t,g);this.protocol.request(f);try{this.publish(t,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${f.token}`,headers:i.headers})}catch(m){f.cancel(m)}}return Promise.resolve(c)}request(t,s,i={timeout:1e3,noMux:!1}){try{this._check(t,!0,!0)}catch(c){return Promise.reject(c)}const l=!this.protocol.options.noAsyncTraces;if(i.timeout=i.timeout||1e3,i.timeout<1)return Promise.reject(new de("timeout",ce.InvalidOption));if(!i.noMux&&i.reply)return Promise.reject(new de("reply can only be used with noMux",ce.InvalidOption));if(i.noMux){const c=i.reply?i.reply:Tr(this.options.inboxPrefix),d=ft(),y=l?new Error:null,g=this.subscribe(c,{max:1,timeout:i.timeout,callback:(f,m)=>{f?(y&&f.code!==ce.Timeout&&(f.stack+=`
|
|
50
|
+
|
|
51
|
+
${y.stack}`),g.unsubscribe(),d.reject(f)):(f=Hb(m),f?(y&&(f.stack+=`
|
|
52
|
+
|
|
53
|
+
${y.stack}`),d.reject(f)):d.resolve(m))}});return g.requestSubject=t,this.protocol.publish(t,s,{reply:c,headers:i.headers}),d}else{const c=new Vb(this.protocol.muxSubscriptions,t,i,l);this.protocol.request(c);try{this.publish(t,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${c.token}`,headers:i.headers})}catch(y){c.cancel(y)}const d=Promise.race([c.timer,c.deferred]);return d.catch(()=>{c.cancel()}),d}}flush(){return this.isClosed()?Promise.reject(de.errorForCode(ce.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(de.errorForCode(ce.ConnectionClosed)):this.isDraining()?Promise.reject(de.errorForCode(ce.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const t=this.protocol.getServer();return t?t.listen:""}status(){const t=new Mt;return t.iterClosed.then(()=>{const s=this.listeners.indexOf(t);this.listeners.splice(s,1)}),this.listeners.push(t),t}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((s,i)=>s==="time"?new Date(Date.parse(i)):i)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(t={}){const s=new f2(this,t);if(t.checkAPI!==!1)try{await s.getAccountInfo()}catch(i){const l=i;throw l.code===ce.NoResponders&&(l.code=ce.JetStreamNotEnabled),l}return s}jetstream(t={}){return new Qd(this,t)}getServerVersion(){const t=this.info;return t?Ys(t.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw de.errorForCode(ce.Disconnect);const t=Date.now();return await this.flush(),Date.now()-t}get features(){return this.protocol.features}get services(){return this._services||(this._services=new p2(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(de.errorForCode(ce.ConnectionClosed)):this.isDraining()?Promise.reject(de.errorForCode(ce.ConnectionDraining)):this.protocol.reconnect()}}class p2{constructor(t){j(this,"nc");this.nc=t}add(t){try{return new So(this.nc,t).start()}catch(s){return Promise.reject(s)}}client(t,s){return new KE(this.nc,t,s)}}class y2{constructor(t,s,i){j(this,"bucket");j(this,"sm");j(this,"prefixLen");this.bucket=t,this.prefixLen=s,this.sm=i}get key(){return this.sm.subject.substring(this.prefixLen)}get value(){return this.sm.data}get delta(){return 0}get created(){return this.sm.time}get revision(){return this.sm.seq}get operation(){return this.sm.header.get(cu)||"PUT"}get length(){const t=this.sm.header.get(Kt.MessageSizeHdr)||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class g2{constructor(t,s,i){j(this,"bucket");j(this,"key");j(this,"sm");this.bucket=t,this.key=s,this.sm=i}get value(){return this.sm.data}get created(){return new Date(Vd(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var t;return((t=this.sm.headers)==null?void 0:t.get(cu))||"PUT"}get delta(){return this.sm.info.pending}get length(){var s;const t=((s=this.sm.headers)==null?void 0:s.get(Kt.MessageSizeHdr))||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class nx extends aE{constructor(s,i,l){super(s.nc,i,l);j(this,"js");j(this,"monitor");this.js=s,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(s){this.sub.info=s}get info(){return this.sub.info}_resetOrderedConsumer(s){if(this.info===null||this.sub.isClosed())return;const i=Tr(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,i);const c=this.info;c.config.name=xs.next(),c.ordered_consumer_sequence.delivery_seq=0,c.flow_control.heartbeat_count=0,c.flow_control.fc_count=0,c.flow_control.consumer_restarts++,c.deliver=i,c.config.deliver_subject=i,c.config.deliver_policy=vt.StartSequence,c.config.opt_start_seq=s;const d={};d.stream_name=this.info.stream,d.config=c.config;const y=`${c.api.prefix}.CONSUMER.CREATE.${c.stream}`;this.js._request(y,d,{retries:-1}).then(g=>{const f=g,m=this.sub.info;m.last=f,this.info.config=f.config,this.info.name=f.name}).catch(g=>{const f=new de(`unable to recreate ordered consumer ${c.stream} at seq ${s}`,ce.RequestError,g);this.sub.callback(f,{})})}_maybeSetupHbMonitoring(){var i,l;const s=((l=(i=this.info)==null?void 0:i.config)==null?void 0:l.idle_heartbeat)||0;s&&this._setupHbMonitoring(Vd(s))}_setupHbMonitoring(s,i=0){const l={cancelAfter:0,maxOut:2};i&&(l.cancelAfter=i);const c=this.sub,d=y=>{var m,b,x,v;const g=zS(409,`${Ln.IdleHeartbeatMissed}: ${y}`,this.sub.subject);if(!((m=this.info)==null?void 0:m.ordered))this.sub.callback(null,g);else{if(!this.js.nc.protocol.connected)return!1;const w=((x=(b=this.info)==null?void 0:b.ordered_consumer_sequence)==null?void 0:x.stream_seq)||0;return this._resetOrderedConsumer(w+1),(v=this.monitor)==null||v.restart(),!1}return!c.noIterator};this.monitor=new Kd(s,d,l)}_checkHbOrderConsumer(s){const i=s.headers.get(Kt.ConsumerStalledHdr);i!==""&&this.js.nc.publish(i);const l=parseInt(s.headers.get(Kt.LastConsumerSeqHdr),10),c=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,l!==c.delivery_seq&&this._resetOrderedConsumer(c.stream_seq+1),!1}_checkOrderedConsumer(s){const i=this.info.ordered_consumer_sequence,l=s.info.streamSequence,c=s.info.deliverySequence;return c!=i.delivery_seq+1?(this._resetOrderedConsumer(i.stream_seq+1),!1):(i.delivery_seq=c,i.stream_seq=l,!0)}async destroy(){this.isClosed()||await this.drain();const s=this.sub.info,i=s.config.durable_name||s.name,l=`${s.api.prefix}.CONSUMER.DELETE.${s.stream}.${i}`;await s.api._request(l)}async consumerInfo(){const s=this.sub.info,i=s.config.durable_name||s.name,l=`${s.api.prefix}.CONSUMER.INFO.${s.stream}.${i}`,c=await s.api._request(l);return s.last=c,c}}class b2 extends nx{constructor(t,s,i){super(t,s,i)}pull(t={batch:1}){const{stream:s,config:i,name:l}=this.sub.info,c=i.durable_name??l,d={};if(d.batch=t.batch||1,d.no_wait=t.no_wait||!1,(t.max_bytes??0)>0){const f=this.js.nc.features.get($e.JS_PULL_MAX_BYTES);if(!f.ok)throw new Error(`max_bytes is only supported on servers ${f.min} or better`);d.max_bytes=t.max_bytes}let y=0;t.expires&&t.expires>0&&(y=t.expires,d.expires=ut(y));let g=0;if(t.idle_heartbeat&&t.idle_heartbeat>0&&(g=t.idle_heartbeat,d.idle_heartbeat=ut(g)),g&&y===0)throw new Error("idle_heartbeat requires expires");if(g>y)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),y&&g&&(this.monitor?this.monitor._change(g,y):this._setupHbMonitoring(g,y));const f=this.info.api,m=`${f.prefix}.CONSUMER.MSG.NEXT.${s}.${c}`,b=this.sub.subject;f.nc.publish(m,f.jc.encode(d),{reply:b})}}}function x2(r,t){return r?_2(t):v2(t)}function v2(r){return(t,s)=>t?[t,null]:(t=Gi(s),t?[t,null]:[null,vo(s,r)])}function _2(r){return(t,s)=>{if(t)return[t,null];const i=Gi(s);return i!==null?[rx(i),null]:[null,vo(s,r)]}}function rx(r){if(r!==null)switch(r.code){case ce.JetStream404NoMessages:case ce.JetStream408RequestTimeout:return null;case ce.JetStream409:return IS(r)?r:null;default:return r}return null}function w2(r){r&&r.ack()}function S2(r){const t=r.split(".");if(t.length===9&&t.splice(2,0,"_",""),t.length<11||t[0]!=="$JS"||t[1]!=="ACK")throw new Error("not js message");const s={};return s.domain=t[2]==="_"?"":t[2],s.account_hash=t[3],s.stream=t[4],s.consumer=t[5],s.deliveryCount=parseInt(t[6],10),s.redeliveryCount=s.deliveryCount,s.redelivered=s.deliveryCount>1,s.streamSequence=parseInt(t[7],10),s.deliverySequence=parseInt(t[8],10),s.timestampNanos=parseInt(t[9],10),s.pending=parseInt(t[10],10),s}class E2{constructor(t,s){j(this,"msg");j(this,"di");j(this,"didAck");j(this,"timeout");this.msg=t,this.didAck=!1,this.timeout=s}get subject(){return this.msg.subject}get sid(){return this.msg.sid}get data(){return this.msg.data}get headers(){return this.msg.headers}get info(){return this.di||(this.di=S2(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(t){this.didAck||(this.didAck=!this.isWIP(t),this.msg.respond(t))}isWIP(t){return t.length===4&&t[0]===Za[0]&&t[1]===Za[1]&&t[2]===Za[2]&&t[3]===Za[3]}async ackAck(t){var i;t=t||{},t.timeout=t.timeout||this.timeout;const s=ft();if(this.didAck)s.resolve(!1);else if(this.didAck=!0,this.msg.reply){const c=this.msg.publisher,d=!((i=c.options)!=null&&i.noAsyncTraces),y=new Vb(c.muxSubscriptions,this.msg.reply,{timeout:t.timeout},d);c.request(y);try{c.publish(this.msg.reply,Ig,{reply:`${c.muxSubscriptions.baseInbox}${y.token}`})}catch(g){y.cancel(g)}try{await Promise.race([y.timer,y.deferred]),s.resolve(!0)}catch(g){y.cancel(g),s.reject(g)}}else s.resolve(!1);return s}ack(){this.doAck(Ig)}nak(t){let s=s2;t&&(s=ld().encode(`-NAK ${JSON.stringify({delay:ut(t)})}`)),this.doAck(s)}working(){this.doAck(Za)}next(t,s={batch:1}){const i={};i.batch=s.batch||1,i.no_wait=s.no_wait||!1,s.expires&&s.expires>0&&(i.expires=ut(s.expires));const l=Jn().encode(i),c=Qi.concat(i2,o2,l),d=t?{reply:t}:void 0;this.msg.respond(c,d)}term(t=""){let s=a2;(t==null?void 0:t.length)>0&&(s=ld().encode(`+TERM ${t}`)),this.doAck(s)}json(){return this.msg.json()}string(){return this.msg.string()}}const O2="1.30.3",A2="nats.ws";class j2{constructor(){j(this,"version");j(this,"lang");j(this,"closeError");j(this,"connected");j(this,"done");j(this,"socket");j(this,"options");j(this,"socketClosed");j(this,"encrypted");j(this,"peeked");j(this,"yields");j(this,"signal");j(this,"closedNotification");this.version=O2,this.lang=A2,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=ft(),this.closedNotification=ft()}async connect(t,s){const i=ft();if(s.tls)return i.reject(new de("tls",ce.InvalidOption)),i;this.options=s;const l=t.src;if(s.wsFactory){const{socket:c,encrypted:d}=await s.wsFactory(t.src,s);this.socket=c,this.encrypted=d}else this.encrypted=l.indexOf("wss://")===0,this.socket=new WebSocket(l);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=c=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(c.data)),this.peeked){this.signal.resolve();return}const d=Qi.concat(...this.yields),y=hE(d);if(y!==""){const g=zE.exec(y);if(!g){s.debug&&console.error("!!!",Ql(d)),i.reject(new Error("unexpected response from server"));return}try{const f=JSON.parse(g[1]);UE(f,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),i.resolve()}catch(f){i.reject(f);return}}},this.socket.onclose=c=>{if(this.isDiscarded())return;this.socketClosed=!0;let d;this.done||(c.wasClean||(d=new Error(c.reason)),this._closed(d))},this.socket.onerror=c=>{if(this.isDiscarded())return;const d=c,y=new de(d.message,ce.Unknown,new Error(d.error));i.reject(y)},i}disconnect(){this._closed(void 0,!0)}async _closed(t,s=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=t,!t)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await Wi(100);this.done=!0;try{this.socket.close(t?1002:1e3,t?t.message:void 0)}catch{}s&&this.closedNotification.resolve(t)}}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.isDiscarded())return;this.yields.length===0&&await this.signal;const t=this.yields;this.yields=[];for(let s=0;s<t.length;s++)this.options.debug&&console.info(`> ${Ql(t[s])}`),yield t[s];if(this.done)break;this.yields.length===0&&(t.length=0,this.yields=t,this.signal=ft())}}isEncrypted(){return this.connected&&this.encrypted}send(t){if(!this.isDiscarded())try{this.socket.send(t.buffer),this.options.debug&&console.info(`< ${Ql(t)}`);return}catch(s){this.options.debug&&console.error(`!!! ${Ql(t)}: ${s}`)}}close(t){return this._closed(t,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var t;this.done=!0;try{(t=this.socket)==null||t.close()}catch{}}}function k2(r,t){/^(.*:\/\/)(.*)/.test(r)||(typeof t=="boolean"?r=`${t===!0?"https":"http"}://${r}`:r=`https://${r}`);let i=new URL(r);const l=i.protocol.toLowerCase();l==="ws:"&&(t=!1),l==="wss:"&&(t=!0),l!=="https:"&&l!=="http"&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2"),i=new URL(`http://${r}`));let c,d;const y=i.hostname,g=i.pathname,f=i.search||"";switch(l){case"http:":case"ws:":case"nats:":d=i.port||"80",c="ws:";break;case"https:":case"wss:":case"tls:":d=i.port||"443",c="wss:";break;default:d=i.port||t===!0?"443":"80",c=t===!0?"wss:":"ws:";break}return`${c}//${y}:${d}${g}${f}`}function N2(r={}){return oE({defaultPort:443,urlParseFn:k2,factory:()=>new j2}),Zd.connect(r)}const T2=null,C2=null,Yt="lt.events";function sx(r,t){const s=r.split("."),i=t.split(".");for(let l=0;l<i.length;l++){const c=i[l];if(c===">")return!0;if(l>=s.length||c!=="*"&&c!==s[l])return!1}return s.length===i.length}const ea=A.createContext({connected:!1,subscribe:()=>()=>{}});function ix(){const{connected:r}=A.useContext(ea);return{connected:r}}function xn(r,t){const{subscribe:s}=A.useContext(ea),i=A.useRef(t);i.current=t,A.useEffect(()=>s(r,c=>i.current(c)),[s,r])}function Js(r,t){const{subscribe:s}=A.useContext(ea),i=A.useRef(t);i.current=t;const l=r.join(","),c=A.useMemo(()=>l.split(",").filter(Boolean),[l]);A.useEffect(()=>{const d=g=>i.current(g),y=c.map(g=>s(g,d));return()=>y.forEach(g=>g())},[s,c])}const M2=A.createContext({connected:!1,subscribe:()=>()=>{}}),R2=ld();function D2({children:r,url:t,token:s}){const i=A.useRef(null),[l,c]=A.useState(!1),d=A.useRef(null),y=A.useRef(new Map),g=A.useRef(new Map),f=A.useCallback((v,w)=>{(async()=>{for await(const S of w)try{if(!sx(S.subject,v))continue;const C=JSON.parse(R2.decode(S.data)),L=y.current.get(v);if(!L)continue;for(const U of L)try{U(C)}catch{}}catch{}})()},[]),m=A.useCallback(v=>{var S;const w=i.current;if(!(!w||(S=w.isClosed)!=null&&S.call(w)||g.current.has(v)))try{const C=w.subscribe(v);g.current.set(v,C),f(v,C)}catch{}},[f]),b=A.useCallback((v,w)=>{const S=y.current;return S.has(v)||S.set(v,new Set),S.get(v).add(w),m(v),()=>{const C=S.get(v);if(C&&(C.delete(w),C.size===0)){S.delete(v);const L=g.current.get(v);if(L){g.current.delete(v);try{L.unsubscribe()}catch{}}}}},[m]),x=A.useCallback(async()=>{try{if(i.current)return;const v=t||T2;if(!v){console.error("[lt-nats] no NATS WebSocket URL configured — set NATS_WS_URL on the server");return}const w=await N2({servers:v,token:s||C2||void 0,reconnect:!0,maxReconnectAttempts:-1,reconnectTimeWait:2e3});i.current=w,c(!0);for(const S of y.current.keys())m(S);(async()=>{for await(const S of w.status())S.type==="disconnect"||S.type==="error"?c(!1):S.type==="reconnect"&&c(!0)})()}catch{c(!1),d.current=setTimeout(x,3e3)}},[m]);return A.useEffect(()=>(x(),()=>{d.current&&clearTimeout(d.current);for(const v of g.current.values())try{v.unsubscribe()}catch{}g.current.clear(),i.current&&(i.current.close().catch(()=>{}),i.current=null),c(!1)}),[x]),h.jsx(M2.Provider,{value:{connected:l,subscribe:b},children:h.jsx(ea.Provider,{value:{connected:l,subscribe:b},children:r})})}const ir=Object.create(null);ir.open="0";ir.close="1";ir.ping="2";ir.pong="3";ir.message="4";ir.upgrade="5";ir.noop="6";const Qc=Object.create(null);Object.keys(ir).forEach(r=>{Qc[ir[r]]=r});const wd={type:"error",data:"parser error"},ax=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",ox=typeof ArrayBuffer=="function",lx=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,Wd=({type:r,data:t},s,i)=>ax&&t instanceof Blob?s?i(t):Hg(t,i):ox&&(t instanceof ArrayBuffer||lx(t))?s?i(t):Hg(new Blob([t]),i):i(ir[r]+(t||"")),Hg=(r,t)=>{const s=new FileReader;return s.onload=function(){const i=s.result.split(",")[1];t("b"+(i||""))},s.readAsDataURL(r)};function Fg(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}let Xh;function q2(r,t){if(ax&&r.data instanceof Blob)return r.data.arrayBuffer().then(Fg).then(t);if(ox&&(r.data instanceof ArrayBuffer||lx(r.data)))return t(Fg(r.data));Wd(r,!1,s=>{Xh||(Xh=new TextEncoder),t(Xh.encode(s))})}const Gg="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",uo=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<Gg.length;r++)uo[Gg.charCodeAt(r)]=r;const L2=r=>{let t=r.length*.75,s=r.length,i,l=0,c,d,y,g;r[r.length-1]==="="&&(t--,r[r.length-2]==="="&&t--);const f=new ArrayBuffer(t),m=new Uint8Array(f);for(i=0;i<s;i+=4)c=uo[r.charCodeAt(i)],d=uo[r.charCodeAt(i+1)],y=uo[r.charCodeAt(i+2)],g=uo[r.charCodeAt(i+3)],m[l++]=c<<2|d>>4,m[l++]=(d&15)<<4|y>>2,m[l++]=(y&3)<<6|g&63;return f},B2=typeof ArrayBuffer=="function",em=(r,t)=>{if(typeof r!="string")return{type:"message",data:cx(r,t)};const s=r.charAt(0);return s==="b"?{type:"message",data:U2(r.substring(1),t)}:Qc[s]?r.length>1?{type:Qc[s],data:r.substring(1)}:{type:Qc[s]}:wd},U2=(r,t)=>{if(B2){const s=L2(r);return cx(s,t)}else return{base64:!0,data:r}},cx=(r,t)=>{switch(t){case"blob":return r instanceof Blob?r:new Blob([r]);case"arraybuffer":default:return r instanceof ArrayBuffer?r:r.buffer}},ux="",P2=(r,t)=>{const s=r.length,i=new Array(s);let l=0;r.forEach((c,d)=>{Wd(c,!1,y=>{i[d]=y,++l===s&&t(i.join(ux))})})},z2=(r,t)=>{const s=r.split(ux),i=[];for(let l=0;l<s.length;l++){const c=em(s[l],t);if(i.push(c),c.type==="error")break}return i};function I2(){return new TransformStream({transform(r,t){q2(r,s=>{const i=s.length;let l;if(i<126)l=new Uint8Array(1),new DataView(l.buffer).setUint8(0,i);else if(i<65536){l=new Uint8Array(3);const c=new DataView(l.buffer);c.setUint8(0,126),c.setUint16(1,i)}else{l=new Uint8Array(9);const c=new DataView(l.buffer);c.setUint8(0,127),c.setBigUint64(1,BigInt(i))}r.data&&typeof r.data!="string"&&(l[0]|=128),t.enqueue(l),t.enqueue(s)})}})}let Qh;function tc(r){return r.reduce((t,s)=>t+s.length,0)}function nc(r,t){if(r[0].length===t)return r.shift();const s=new Uint8Array(t);let i=0;for(let l=0;l<t;l++)s[l]=r[0][i++],i===r[0].length&&(r.shift(),i=0);return r.length&&i<r[0].length&&(r[0]=r[0].slice(i)),s}function $2(r,t){Qh||(Qh=new TextDecoder);const s=[];let i=0,l=-1,c=!1;return new TransformStream({transform(d,y){for(s.push(d);;){if(i===0){if(tc(s)<1)break;const g=nc(s,1);c=(g[0]&128)===128,l=g[0]&127,l<126?i=3:l===126?i=1:i=2}else if(i===1){if(tc(s)<2)break;const g=nc(s,2);l=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),i=3}else if(i===2){if(tc(s)<8)break;const g=nc(s,8),f=new DataView(g.buffer,g.byteOffset,g.length),m=f.getUint32(0);if(m>Math.pow(2,21)-1){y.enqueue(wd);break}l=m*Math.pow(2,32)+f.getUint32(4),i=3}else{if(tc(s)<l)break;const g=nc(s,l);y.enqueue(em(c?g:Qh.decode(g),t)),i=0}if(l===0||l>r){y.enqueue(wd);break}}}})}const fx=4;function At(r){if(r)return H2(r)}function H2(r){for(var t in At.prototype)r[t]=At.prototype[t];return r}At.prototype.on=At.prototype.addEventListener=function(r,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(t),this};At.prototype.once=function(r,t){function s(){this.off(r,s),t.apply(this,arguments)}return s.fn=t,this.on(r,s),this};At.prototype.off=At.prototype.removeListener=At.prototype.removeAllListeners=At.prototype.removeEventListener=function(r,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var s=this._callbacks["$"+r];if(!s)return this;if(arguments.length==1)return delete this._callbacks["$"+r],this;for(var i,l=0;l<s.length;l++)if(i=s[l],i===t||i.fn===t){s.splice(l,1);break}return s.length===0&&delete this._callbacks["$"+r],this};At.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),s=this._callbacks["$"+r],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(s){s=s.slice(0);for(var i=0,l=s.length;i<l;++i)s[i].apply(this,t)}return this};At.prototype.emitReserved=At.prototype.emit;At.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]};At.prototype.hasListeners=function(r){return!!this.listeners(r).length};const _u=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,s)=>s(t,0),Un=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),F2="arraybuffer";function hx(r,...t){return t.reduce((s,i)=>(r.hasOwnProperty(i)&&(s[i]=r[i]),s),{})}const G2=Un.setTimeout,V2=Un.clearTimeout;function wu(r,t){t.useNativeTimers?(r.setTimeoutFn=G2.bind(Un),r.clearTimeoutFn=V2.bind(Un)):(r.setTimeoutFn=Un.setTimeout.bind(Un),r.clearTimeoutFn=Un.clearTimeout.bind(Un))}const Y2=1.33;function K2(r){return typeof r=="string"?J2(r):Math.ceil((r.byteLength||r.size)*Y2)}function J2(r){let t=0,s=0;for(let i=0,l=r.length;i<l;i++)t=r.charCodeAt(i),t<128?s+=1:t<2048?s+=2:t<55296||t>=57344?s+=3:(i++,s+=4);return s}function dx(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function X2(r){let t="";for(let s in r)r.hasOwnProperty(s)&&(t.length&&(t+="&"),t+=encodeURIComponent(s)+"="+encodeURIComponent(r[s]));return t}function Q2(r){let t={},s=r.split("&");for(let i=0,l=s.length;i<l;i++){let c=s[i].split("=");t[decodeURIComponent(c[0])]=decodeURIComponent(c[1])}return t}class Z2 extends Error{constructor(t,s,i){super(t),this.description=s,this.context=i,this.type="TransportError"}}class tm extends At{constructor(t){super(),this.writable=!1,wu(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,s,i){return super.emitReserved("error",new Z2(t,s,i)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const s=em(t,this.socket.binaryType);this.onPacket(s)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,s={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(s)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const s=X2(t);return s.length?"?"+s:""}}class W2 extends tm{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const s=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let i=0;this._polling&&(i++,this.once("pollComplete",function(){--i||s()})),this.writable||(i++,this.once("drain",function(){--i||s()}))}else s()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const s=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};z2(t,this.socket.binaryType).forEach(s),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,P2(t,s=>{this.doWrite(s,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",s=this.query||{};return this.opts.timestampRequests!==!1&&(s[this.opts.timestampParam]=dx()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(t,s)}}let mx=!1;try{mx=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const eO=mx;function tO(){}class nO extends W2{constructor(t){if(super(t),typeof location<"u"){const s=location.protocol==="https:";let i=location.port;i||(i=s?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||i!==t.port}}doWrite(t,s){const i=this.request({method:"POST",data:t});i.on("success",s),i.on("error",(l,c)=>{this.onError("xhr post error",l,c)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(s,i)=>{this.onError("xhr poll error",s,i)}),this.pollXhr=t}}class sr extends At{constructor(t,s,i){super(),this.createRequest=t,wu(this,i),this._opts=i,this._method=i.method||"GET",this._uri=s,this._data=i.data!==void 0?i.data:null,this._create()}_create(){var t;const s=hx(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;const i=this._xhr=this.createRequest(s);try{i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let l in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(l)&&i.setRequestHeader(l,this._opts.extraHeaders[l])}}catch{}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{i.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var l;i.readyState===3&&((l=this._opts.cookieJar)===null||l===void 0||l.parseCookies(i.getResponseHeader("set-cookie"))),i.readyState===4&&(i.status===200||i.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof i.status=="number"?i.status:0)},0))},i.send(this._data)}catch(l){this.setTimeoutFn(()=>{this._onError(l)},0);return}typeof document<"u"&&(this._index=sr.requestsCount++,sr.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=tO,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete sr.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}sr.requestsCount=0;sr.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Vg);else if(typeof addEventListener=="function"){const r="onpagehide"in Un?"pagehide":"unload";addEventListener(r,Vg,!1)}}function Vg(){for(let r in sr.requests)sr.requests.hasOwnProperty(r)&&sr.requests[r].abort()}const rO=(function(){const r=px({xdomain:!1});return r&&r.responseType!==null})();class sO extends nO{constructor(t){super(t);const s=t&&t.forceBase64;this.supportsBinary=rO&&!s}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new sr(px,this.uri(),t)}}function px(r){const t=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||eO))return new XMLHttpRequest}catch{}if(!t)try{return new Un[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const yx=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class iO extends tm{get name(){return"websocket"}doOpen(){const t=this.uri(),s=this.opts.protocols,i=yx?{}:hx(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,s,i)}catch(l){return this.emitReserved("error",l)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let s=0;s<t.length;s++){const i=t[s],l=s===t.length-1;Wd(i,this.supportsBinary,c=>{try{this.doWrite(i,c)}catch{}l&&_u(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=dx()),this.supportsBinary||(s.b64=1),this.createUri(t,s)}}const Zh=Un.WebSocket||Un.MozWebSocket;class aO extends iO{createSocket(t,s,i){return yx?new Zh(t,s,i):s?new Zh(t,s):new Zh(t)}doWrite(t,s){this.ws.send(s)}}class oO extends tm{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const s=$2(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=t.readable.pipeThrough(s).getReader(),l=I2();l.readable.pipeTo(t.writable),this._writer=l.writable.getWriter();const c=()=>{i.read().then(({done:y,value:g})=>{y||(this.onPacket(g),c())}).catch(y=>{})};c();const d={type:"open"};this.query.sid&&(d.data=`{"sid":"${this.query.sid}"}`),this._writer.write(d).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let s=0;s<t.length;s++){const i=t[s],l=s===t.length-1;this._writer.write(i).then(()=>{l&&_u(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const lO={websocket:aO,webtransport:oO,polling:sO},cO=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,uO=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Sd(r){if(r.length>8e3)throw"URI too long";const t=r,s=r.indexOf("["),i=r.indexOf("]");s!=-1&&i!=-1&&(r=r.substring(0,s)+r.substring(s,i).replace(/:/g,";")+r.substring(i,r.length));let l=cO.exec(r||""),c={},d=14;for(;d--;)c[uO[d]]=l[d]||"";return s!=-1&&i!=-1&&(c.source=t,c.host=c.host.substring(1,c.host.length-1).replace(/;/g,":"),c.authority=c.authority.replace("[","").replace("]","").replace(/;/g,":"),c.ipv6uri=!0),c.pathNames=fO(c,c.path),c.queryKey=hO(c,c.query),c}function fO(r,t){const s=/\/{2,9}/g,i=t.replace(s,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&i.splice(0,1),t.slice(-1)=="/"&&i.splice(i.length-1,1),i}function hO(r,t){const s={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,l,c){l&&(s[l]=c)}),s}const Ed=typeof addEventListener=="function"&&typeof removeEventListener=="function",Zc=[];Ed&&addEventListener("offline",()=>{Zc.forEach(r=>r())},!1);class gs extends At{constructor(t,s){if(super(),this.binaryType=F2,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(s=t,t=null),t){const i=Sd(t);s.hostname=i.host,s.secure=i.protocol==="https"||i.protocol==="wss",s.port=i.port,i.query&&(s.query=i.query)}else s.host&&(s.hostname=Sd(s.host).host);wu(this,s),this.secure=s.secure!=null?s.secure:typeof location<"u"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=s.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(i=>{const l=i.prototype.name;this.transports.push(l),this._transportsByName[l]=i}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Q2(this.opts.query)),Ed&&(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"})},Zc.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const s=Object.assign({},this.opts.query);s.EIO=fx,s.transport=t,this.id&&(s.sid=this.id);const i=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&gs.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const s=this.createTransport(t);s.open(),this.setTransport(s)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",gs.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const s=new Error("server error");s.code=t.data,this._onError(s);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let i=0;i<this.writeBuffer.length;i++){const l=this.writeBuffer[i].data;if(l&&(s+=K2(l)),i>0&&s>this._maxPayload)return this.writeBuffer.slice(0,i);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,_u(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,s,i){return this._sendPacket("message",t,s,i),this}send(t,s,i){return this._sendPacket("message",t,s,i),this}_sendPacket(t,s,i,l){if(typeof s=="function"&&(l=s,s=void 0),typeof i=="function"&&(l=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;const c={type:t,data:s,options:i};this.emitReserved("packetCreate",c),this.writeBuffer.push(c),l&&this.once("flush",l),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),t()},i=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():t()}):this.upgrading?i():t()),this}_onError(t){if(gs.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Ed&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const i=Zc.indexOf(this._offlineEventListener);i!==-1&&Zc.splice(i,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,s),this.writeBuffer=[],this._prevBufferLen=0}}}gs.protocol=fx;class dO extends gs{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let s=this.createTransport(t),i=!1;gs.priorWebsocketSuccess=!1;const l=()=>{i||(s.send([{type:"ping",data:"probe"}]),s.once("packet",b=>{if(!i)if(b.type==="pong"&&b.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",s),!s)return;gs.priorWebsocketSuccess=s.name==="websocket",this.transport.pause(()=>{i||this.readyState!=="closed"&&(m(),this.setTransport(s),s.send([{type:"upgrade"}]),this.emitReserved("upgrade",s),s=null,this.upgrading=!1,this.flush())})}else{const x=new Error("probe error");x.transport=s.name,this.emitReserved("upgradeError",x)}}))};function c(){i||(i=!0,m(),s.close(),s=null)}const d=b=>{const x=new Error("probe error: "+b);x.transport=s.name,c(),this.emitReserved("upgradeError",x)};function y(){d("transport closed")}function g(){d("socket closed")}function f(b){s&&b.name!==s.name&&c()}const m=()=>{s.removeListener("open",l),s.removeListener("error",d),s.removeListener("close",y),this.off("close",g),this.off("upgrading",f)};s.once("open",l),s.once("error",d),s.once("close",y),this.once("close",g),this.once("upgrading",f),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{i||s.open()},200):s.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const s=[];for(let i=0;i<t.length;i++)~this.transports.indexOf(t[i])&&s.push(t[i]);return s}}let mO=class extends dO{constructor(t,s={}){const i=typeof t=="object"?t:s;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(l=>lO[l]).filter(l=>!!l)),super(t,i)}};function pO(r,t="",s){let i=r;s=s||typeof location<"u"&&location,r==null&&(r=s.protocol+"//"+s.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=s.protocol+r:r=s.host+r),/^(https?|wss?):\/\//.test(r)||(typeof s<"u"?r=s.protocol+"//"+r:r="https://"+r),i=Sd(r)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";const c=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+c+":"+i.port+t,i.href=i.protocol+"://"+c+(s&&s.port===i.port?"":":"+i.port),i}const yO=typeof ArrayBuffer=="function",gO=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,gx=Object.prototype.toString,bO=typeof Blob=="function"||typeof Blob<"u"&&gx.call(Blob)==="[object BlobConstructor]",xO=typeof File=="function"||typeof File<"u"&&gx.call(File)==="[object FileConstructor]";function nm(r){return yO&&(r instanceof ArrayBuffer||gO(r))||bO&&r instanceof Blob||xO&&r instanceof File}function Wc(r,t){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let s=0,i=r.length;s<i;s++)if(Wc(r[s]))return!0;return!1}if(nm(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return Wc(r.toJSON(),!0);for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)&&Wc(r[s]))return!0;return!1}function vO(r){const t=[],s=r.data,i=r;return i.data=Od(s,t),i.attachments=t.length,{packet:i,buffers:t}}function Od(r,t){if(!r)return r;if(nm(r)){const s={_placeholder:!0,num:t.length};return t.push(r),s}else if(Array.isArray(r)){const s=new Array(r.length);for(let i=0;i<r.length;i++)s[i]=Od(r[i],t);return s}else if(typeof r=="object"&&!(r instanceof Date)){const s={};for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&(s[i]=Od(r[i],t));return s}return r}function _O(r,t){return r.data=Ad(r.data,t),delete r.attachments,r}function Ad(r,t){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<t.length)return t[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let s=0;s<r.length;s++)r[s]=Ad(r[s],t);else if(typeof r=="object")for(const s in r)Object.prototype.hasOwnProperty.call(r,s)&&(r[s]=Ad(r[s],t));return r}const wO=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var ze;(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"})(ze||(ze={}));class SO{constructor(t){this.replacer=t}encode(t){return(t.type===ze.EVENT||t.type===ze.ACK)&&Wc(t)?this.encodeAsBinary({type:t.type===ze.EVENT?ze.BINARY_EVENT:ze.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let s=""+t.type;return(t.type===ze.BINARY_EVENT||t.type===ze.BINARY_ACK)&&(s+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(s+=t.nsp+","),t.id!=null&&(s+=t.id),t.data!=null&&(s+=JSON.stringify(t.data,this.replacer)),s}encodeAsBinary(t){const s=vO(t),i=this.encodeAsString(s.packet),l=s.buffers;return l.unshift(i),l}}class rm extends At{constructor(t){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof t=="function"?{reviver:t}:t)}add(t){let s;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");s=this.decodeString(t);const i=s.type===ze.BINARY_EVENT;i||s.type===ze.BINARY_ACK?(s.type=i?ze.EVENT:ze.ACK,this.reconstructor=new EO(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if(nm(t)||t.base64)if(this.reconstructor)s=this.reconstructor.takeBinaryData(t),s&&(this.reconstructor=null,super.emitReserved("decoded",s));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let s=0;const i={type:Number(t.charAt(0))};if(ze[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===ze.BINARY_EVENT||i.type===ze.BINARY_ACK){const c=s+1;for(;t.charAt(++s)!=="-"&&s!=t.length;);const d=t.substring(c,s);if(d!=Number(d)||t.charAt(s)!=="-")throw new Error("Illegal attachments");const y=Number(d);if(!OO(y)||y<0)throw new Error("Illegal attachments");if(y>this.opts.maxAttachments)throw new Error("too many attachments");i.attachments=y}if(t.charAt(s+1)==="/"){const c=s+1;for(;++s&&!(t.charAt(s)===","||s===t.length););i.nsp=t.substring(c,s)}else i.nsp="/";const l=t.charAt(s+1);if(l!==""&&Number(l)==l){const c=s+1;for(;++s;){const d=t.charAt(s);if(d==null||Number(d)!=d){--s;break}if(s===t.length)break}i.id=Number(t.substring(c,s+1))}if(t.charAt(++s)){const c=this.tryParse(t.substr(s));if(rm.isPayloadValid(i.type,c))i.data=c;else throw new Error("invalid payload")}return i}tryParse(t){try{return JSON.parse(t,this.opts.reviver)}catch{return!1}}static isPayloadValid(t,s){switch(t){case ze.CONNECT:return Yg(s);case ze.DISCONNECT:return s===void 0;case ze.CONNECT_ERROR:return typeof s=="string"||Yg(s);case ze.EVENT:case ze.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&wO.indexOf(s[0])===-1);case ze.ACK:case ze.BINARY_ACK:return Array.isArray(s)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class EO{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const s=_O(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const OO=Number.isInteger||function(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r};function Yg(r){return Object.prototype.toString.call(r)==="[object Object]"}const AO=Object.freeze(Object.defineProperty({__proto__:null,Decoder:rm,Encoder:SO,get PacketType(){return ze}},Symbol.toStringTag,{value:"Module"}));function Yn(r,t,s){return r.on(t,s),function(){r.off(t,s)}}const jO=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class bx extends At{constructor(t,s,i){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=s,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Yn(t,"open",this.onopen.bind(this)),Yn(t,"packet",this.onpacket.bind(this)),Yn(t,"error",this.onerror.bind(this)),Yn(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...s){var i,l,c;if(jO.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(s.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(s),this;const d={type:ze.EVENT,data:s};if(d.options={},d.options.compress=this.flags.compress!==!1,typeof s[s.length-1]=="function"){const m=this.ids++,b=s.pop();this._registerAckCallback(m,b),d.id=m}const y=(l=(i=this.io.engine)===null||i===void 0?void 0:i.transport)===null||l===void 0?void 0:l.writable,g=this.connected&&!(!((c=this.io.engine)===null||c===void 0)&&c._hasPingExpired());return this.flags.volatile&&!y||(g?(this.notifyOutgoingListeners(d),this.packet(d)):this.sendBuffer.push(d)),this.flags={},this}_registerAckCallback(t,s){var i;const l=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(l===void 0){this.acks[t]=s;return}const c=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let y=0;y<this.sendBuffer.length;y++)this.sendBuffer[y].id===t&&this.sendBuffer.splice(y,1);s.call(this,new Error("operation has timed out"))},l),d=(...y)=>{this.io.clearTimeoutFn(c),s.apply(this,y)};d.withError=!0,this.acks[t]=d}emitWithAck(t,...s){return new Promise((i,l)=>{const c=(d,y)=>d?l(d):i(y);c.withError=!0,s.push(c),this.emit(t,...s)})}_addToQueue(t){let s;typeof t[t.length-1]=="function"&&(s=t.pop());const i={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((l,...c)=>(this._queue[0],l!==null?i.tryCount>this._opts.retries&&(this._queue.shift(),s&&s(l)):(this._queue.shift(),s&&s(null,...c)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const s=this._queue[0];s.pending&&!t||(s.pending=!0,s.tryCount++,this.flags=s.flags,this.emit.apply(this,s.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:ze.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,s){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(i=>String(i.id)===t)){const i=this.acks[t];delete this.acks[t],i.withError&&i.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case ze.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case ze.EVENT:case ze.BINARY_EVENT:this.onevent(t);break;case ze.ACK:case ze.BINARY_ACK:this.onack(t);break;case ze.DISCONNECT:this.ondisconnect();break;case ze.CONNECT_ERROR:this.destroy();const i=new Error(t.data.message);i.data=t.data.data,this.emitReserved("connect_error",i);break}}onevent(t){const s=t.data||[];t.id!=null&&s.push(this.ack(t.id)),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const s=this._anyListeners.slice();for(const i of s)i.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const s=this;let i=!1;return function(...l){i||(i=!0,s.packet({type:ze.ACK,id:t,data:l}))}}onack(t){const s=this.acks[t.id];typeof s=="function"&&(delete this.acks[t.id],s.withError&&t.data.unshift(null),s.apply(this,t.data))}onconnect(t,s){this.id=t,this.recovered=s&&this._pid===s,this._pid=s,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:ze.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const s=this._anyListeners;for(let i=0;i<s.length;i++)if(t===s[i])return s.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const s=this._anyOutgoingListeners;for(let i=0;i<s.length;i++)if(t===s[i])return s.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const s=this._anyOutgoingListeners.slice();for(const i of s)i.apply(this,t.data)}}}function ta(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}ta.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),s=Math.floor(t*this.jitter*r);r=(Math.floor(t*10)&1)==0?r-s:r+s}return Math.min(r,this.max)|0};ta.prototype.reset=function(){this.attempts=0};ta.prototype.setMin=function(r){this.ms=r};ta.prototype.setMax=function(r){this.max=r};ta.prototype.setJitter=function(r){this.jitter=r};class jd extends At{constructor(t,s){var i;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(s=t,t=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,wu(this,s),this.reconnection(s.reconnection!==!1),this.reconnectionAttempts(s.reconnectionAttempts||1/0),this.reconnectionDelay(s.reconnectionDelay||1e3),this.reconnectionDelayMax(s.reconnectionDelayMax||5e3),this.randomizationFactor((i=s.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new ta({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=t;const l=s.parser||AO;this.encoder=new l.Encoder,this.decoder=new l.Decoder,this._autoConnect=s.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var s;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(s=this.backoff)===null||s===void 0||s.setMin(t),this)}randomizationFactor(t){var s;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(s=this.backoff)===null||s===void 0||s.setJitter(t),this)}reconnectionDelayMax(t){var s;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(s=this.backoff)===null||s===void 0||s.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new mO(this.uri,this.opts);const s=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;const l=Yn(s,"open",function(){i.onopen(),t&&t()}),c=y=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",y),t?t(y):this.maybeReconnectOnOpen()},d=Yn(s,"error",c);if(this._timeout!==!1){const y=this._timeout,g=this.setTimeoutFn(()=>{l(),c(new Error("timeout")),s.close()},y);this.opts.autoUnref&&g.unref(),this.subs.push(()=>{this.clearTimeoutFn(g)})}return this.subs.push(l),this.subs.push(d),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Yn(t,"ping",this.onping.bind(this)),Yn(t,"data",this.ondata.bind(this)),Yn(t,"error",this.onerror.bind(this)),Yn(t,"close",this.onclose.bind(this)),Yn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(s){this.onclose("parse error",s)}}ondecoded(t){_u(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,s){let i=this.nsps[t];return i?this._autoConnect&&!i.active&&i.connect():(i=new bx(this,t,s),this.nsps[t]=i),i}_destroy(t){const s=Object.keys(this.nsps);for(const i of s)if(this.nsps[i].active)return;this._close()}_packet(t){const s=this.encoder.encode(t);for(let i=0;i<s.length;i++)this.engine.write(s[i],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,s){var i;this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,s),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const s=this.backoff.duration();this._reconnecting=!0;const i=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(l=>{l?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",l)):t.onreconnect()}))},s);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const Wa={};function eu(r,t){typeof r=="object"&&(t=r,r=void 0),t=t||{};const s=pO(r,t.path||"/socket.io"),i=s.source,l=s.id,c=s.path,d=Wa[l]&&c in Wa[l].nsps,y=t.forceNew||t["force new connection"]||t.multiplex===!1||d;let g;return y?g=new jd(i,t):(Wa[l]||(Wa[l]=new jd(i,t)),g=Wa[l]),s.query&&!t.query&&(t.query=s.queryKey),g.socket(s.path,t)}Object.assign(eu,{Manager:jd,Socket:bx,io:eu,connect:eu});const kO=A.createContext({connected:!1,subscribe:()=>()=>{}});function NO({children:r}){const t=A.useRef(null),[s,i]=A.useState(!1),l=A.useRef(new Map),c=A.useCallback((y,g)=>{var m;const f=l.current;return f.has(y)||(f.set(y,new Set),(m=t.current)==null||m.emit("lt.subscribe",y)),f.get(y).add(g),()=>{var x;const b=f.get(y);b&&(b.delete(g),b.size===0&&(f.delete(y),(x=t.current)==null||x.emit("lt.unsubscribe",y)))}},[]),d=A.useCallback((y,g)=>{for(const[f,m]of l.current)if(sx(y,f))for(const b of m)try{b(g)}catch{}},[]);return A.useEffect(()=>{const y=Pb(),g=eu({path:`${Bt}/socket.io`,transports:["polling","websocket"],upgrade:!0,reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:2e3,...y?{auth:{token:y}}:{}});return t.current=g,console.log("[lt-socketio] connecting..."),g.on("connect",()=>{console.log("[lt-socketio] connected, id:",g.id),i(!0);for(const f of l.current.keys())g.emit("lt.subscribe",f)}),g.on("disconnect",f=>{console.log("[lt-socketio] disconnected:",f),i(!1)}),g.on("connect_error",f=>{console.warn("[lt-socketio] connect error:",f.message),i(!1)}),g.onAny((f,m)=>{if(f.startsWith("lt."))try{const b=typeof m=="string"?JSON.parse(m):m;d(f,b)}catch{}}),()=>{g.removeAllListeners(),g.disconnect(),t.current=null,i(!1)}},[d]),h.jsx(kO.Provider,{value:{connected:s,subscribe:c},children:h.jsx(ea.Provider,{value:{connected:s,subscribe:c},children:r})})}function TO({children:r}){const[t,s]=A.useState(null),[i,l]=A.useState({url:null,token:null});return A.useEffect(()=>{let c=!1;async function d(){var y;try{console.log("[lt-transport] detecting event transport...");const g=await Fd(),f=(y=g==null?void 0:g.events)==null?void 0:y.transport;if(console.log("[lt-transport] server reports:",f),!c){if(f==="nats"){let m=g.events.natsWsUrl??null,b=null;const x=Pb();if(x)try{const v=await fetch(`${Bt}/api/nats-credentials`,{headers:{Authorization:`Bearer ${x}`}});if(v.ok){const w=await v.json();m=w.natsWsUrl??m,b=w.natsToken??null}}catch{console.warn("[lt-transport] failed to fetch NATS credentials")}l({url:m,token:b})}s(f==="nats"?"nats":"socketio")}}catch(g){console.warn("[lt-transport] settings fetch error, falling back to socketio",g),c||s("socketio")}}return d(),()=>{c=!0}},[]),t==="nats"?h.jsx(D2,{url:i.url,token:i.token,children:r}):t==="socketio"?h.jsx(NO,{children:r}):h.jsx(h.Fragment,{children:r})}const sm="lt_view_as",im="lt_ai_override",kd="lt_graph_enabled",am="lt_scan_override";function xx(){try{const r=localStorage.getItem(im);if(r==="true")return!0;if(r==="false")return!1}catch{}return null}function CO(r){try{localStorage.setItem(im,String(r))}catch{}}function MO(){try{localStorage.removeItem(im)}catch{}}function om(){try{const r=localStorage.getItem(sm);if(r==="admin"||r==="engineer"||r==="operator")return r}catch{}return null}function RO(r){try{localStorage.setItem(sm,r)}catch{}window.location.reload()}function Nd(){try{localStorage.removeItem(sm)}catch{}window.location.reload()}function vx(){try{return localStorage.getItem(kd)==="true"}catch{return!1}}function DO(r){try{r?localStorage.setItem(kd,"true"):localStorage.removeItem(kd)}catch{}}function _x(){try{const r=localStorage.getItem(am);if(r==="true")return!0;if(r==="false")return!1}catch{}return null}function qO(r){try{localStorage.setItem(am,String(r))}catch{}}function LO(){try{localStorage.removeItem(am)}catch{}}function wx(){const{isSuperAdmin:r,hasRoleType:t,hasRole:s}=It(),i=om(),l=r||s("engineer"),c=t("admin"),d=r||t("admin");return{isBuilder:i?!1:l,isOps:i?i==="admin"||i==="engineer":c,canBulk:i?i==="admin":d,viewAs:i,realIsBuilder:l}}function Sx(){var f;const{isSuperAdmin:r,hasRoleType:t,hasRole:s}=It(),{data:i}=Xn(),l=((f=i==null?void 0:i.features)==null?void 0:f.publicPaceBoard)!==!1,c=r?"superadmin":t("admin")?"admin":s("engineer")?"engineer":"operator",d=om(),y=d==="admin"||d==="engineer"||d==="operator"?d:null,g=y??c;return{tier:g,realTier:c,viewAs:y,canSeePaceBoard:l||g==="superadmin"||g==="admin",canSeeWorkflows:g==="superadmin"||g==="engineer",showTaskQueueCards:g==="operator"&&!l}}function Ex(r){return(r??"").replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")||"none"}function Mr(r={}){const t=r.role?Ex(r.role):"*",s=r.id??"*",i=r.verb??">";return`${Yt}.system.escalation.${t}.${s}.${i}`}function Td(r){return r.verbs.map(t=>Mr({role:r.role,verb:t}))}function lm(r){const{user:t,isSuperAdmin:s,hasRoleType:i}=It(),l=s||i("admin"),c=((t==null?void 0:t.roles)??[]).map(y=>y.role).sort().join(","),d=(r??[]).join(",");return A.useMemo(()=>{const y=d?d.split(","):null;return l||!c?y?Td({verbs:y}):[Mr({})]:c.split(",").flatMap(g=>y?Td({role:g,verbs:y}):[Mr({role:g})])},[l,c,d])}const Cd="/escalations/detail/";function BO(r){return r.startsWith(Cd)&&r.slice(Cd.length).split("/")[0]||void 0}function UO(){const{user:r}=It(),t=Zi(),s=wn(),i=A.useRef(s.pathname);i.current=s.pathname;const l=A.useRef(r==null?void 0:r.userId);l.current=r==null?void 0:r.userId;const c=A.useCallback(d=>{var b,x,v;if((d==null?void 0:d.assignedAtCreation)!==!0)return;const y=(d==null?void 0:d.escalationId)??((b=d==null?void 0:d.data)==null?void 0:b.id),g=(x=d==null?void 0:d.data)==null?void 0:x.assigned_to,f=(v=d==null?void 0:d.data)==null?void 0:v.parent_id;if(!y||g!==l.current||!f||f!==BO(i.current))return;const m=`${Cd}${y}`;i.current!==m&&t(m)},[t]);Js(lm(["claimed"]),c)}const cm={staleTime:5*6e4,refetchOnWindowFocus:!1};function S3(r={},t={}){const s=new URLSearchParams;return r.role&&s.set("role",r.role),r.roleType&&s.set("roleType",r.roleType),r.status&&s.set("status",r.status),r.search&&s.set("search",r.search),r.limit&&s.set("limit",String(r.limit)),r.offset!==void 0&&s.set("offset",String(r.offset)),We({queryKey:["users",r],queryFn:()=>me(`/users?${s}`),enabled:t.enabled??!0,...cm})}const Kg=200;async function PO(r){const t=[];for(let s=0;s<r.length;s+=Kg){const i=await me("/users/names",{method:"POST",body:JSON.stringify({ids:r.slice(s,s+Kg)})});t.push(...i.users??[])}return t}let Md=[],Rd=new Map,Dd=!1;function zO(){const r=Md,t=Rd;Md=[],Rd=new Map,Dd=!1,PO(r).then(s=>{const i=new Map(s.map(l=>[l.id,l]));for(const[l,c]of t)c.resolve(i.get(l)??null)}).catch(s=>{for(const i of t.values())i.reject(s)})}function IO(r){return new Promise((t,s)=>{Md.push(r),Rd.set(r,{resolve:t,reject:s}),Dd||(Dd=!0,setTimeout(zO,0))})}function E3(r){return We({queryKey:["user-name",r],queryFn:()=>IO(r),enabled:!!r,...cm})}function $O(r){return We({queryKey:["users",r,"roles"],queryFn:async()=>(await me(`/users/${r}/roles`)).roles??[],enabled:!!r,...cm})}function O3(){const r=Ve();return et({mutationFn:t=>me("/users",{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{r.invalidateQueries({queryKey:["users"]})}})}function A3(){const r=Ve();return et({mutationFn:({id:t,...s})=>me(`/users/${t}`,{method:"PUT",body:JSON.stringify(s)}),onSuccess:()=>{r.invalidateQueries({queryKey:["users"]})}})}function j3(){const r=Ve();return et({mutationFn:({id:t,ops:s})=>me(`/users/${t}/properties`,{method:"PATCH",body:JSON.stringify(s)}),onSuccess:()=>{r.invalidateQueries({queryKey:["users"]})}})}function k3(){return We({queryKey:["users","system-property-keys"],queryFn:()=>me("/users/system-property-keys")})}function N3(){const r=Ve();return et({mutationFn:t=>me(`/users/${t}`,{method:"DELETE"}),onSuccess:()=>{r.invalidateQueries({queryKey:["users"]})}})}function T3(){const r=Ve();return et({mutationFn:({userId:t,role:s,type:i,read_scope:l,write_scope:c})=>me(`/users/${t}/roles`,{method:"POST",body:JSON.stringify({role:s,type:i,read_scope:l,write_scope:c})}),onSuccess:()=>{r.invalidateQueries({queryKey:["users"]})}})}function C3(){const r=Ve();return et({mutationFn:({userId:t,role:s})=>me(`/users/${t}/roles/${encodeURIComponent(s)}`,{method:"DELETE"}),onSuccess:()=>{r.invalidateQueries({queryKey:["users"]})}})}function HO(){return We({queryKey:["roles"],queryFn:()=>me("/roles")})}function Su(r){return We({queryKey:["roles","details"],queryFn:()=>me("/roles/details"),enabled:(r==null?void 0:r.enabled)??!0})}function M3(r,t,s=!0){return We({queryKey:["roles",r,"schema",t??"latest"],queryFn:()=>me(`/roles/${encodeURIComponent(r)}/schema${t!=null?`?version=${t}`:""}`),enabled:s&&!!r})}function R3(r){return We({queryKey:["roles",r,"schema-versions"],queryFn:()=>me(`/roles/${encodeURIComponent(r)}/schema/versions`),enabled:!!r})}function D3(r,t,s=!0){return We({queryKey:["roles",r,"list-schema",t??"latest"],queryFn:()=>me(`/roles/${encodeURIComponent(r)}/list-schema${t!=null?`?version=${t}`:""}`),enabled:s&&!!r})}function q3(r){return We({queryKey:["roles",r,"list-schema-versions"],queryFn:()=>me(`/roles/${encodeURIComponent(r)}/list-schema/versions`),enabled:!!r})}function L3(){const r=Ve();return et({mutationFn:t=>me("/roles",{method:"POST",body:JSON.stringify({role:t})}),onSuccess:()=>{r.invalidateQueries({queryKey:["roles"]})}})}function B3(){const r=Ve();return et({mutationFn:({role:t,...s})=>me(`/roles/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(s)}),onMutate:async({role:t,...s})=>{await r.cancelQueries({queryKey:["roles","details"]});const i=r.getQueryData(["roles","details"]);return i&&r.setQueryData(["roles","details"],{roles:i.roles.map(l=>l.role===t?{...l,...s}:l)}),{previous:i}},onError:(t,s,i)=>{i!=null&&i.previous&&r.setQueryData(["roles","details"],i.previous)},onSuccess:()=>{r.invalidateQueries({queryKey:["roles"]})}})}function U3(){const r=Ve();return et({mutationFn:t=>me(`/roles/${encodeURIComponent(t)}`,{method:"DELETE"}),onSuccess:()=>{r.invalidateQueries({queryKey:["roles"]})}})}const Ox="lt:station:kiosk-role:";function qd(r){return`${Ox}${r}`}const Ld=new Set;function FO(){for(const r of Ld)r()}function GO(r){try{return localStorage.getItem(qd(r))}catch{return null}}function VO(r,t){try{t===null?localStorage.removeItem(qd(r)):localStorage.setItem(qd(r),t)}catch{}FO()}function YO(r){Ld.add(r);const t=s=>{(s.key===null||s.key.startsWith(Ox))&&r()};try{window.addEventListener("storage",t)}catch{}return()=>{Ld.delete(r);try{window.removeEventListener("storage",t)}catch{}}}function KO(r){return A.useSyncExternalStore(YO,()=>r?GO(r):null)}function Ax(){const{user:r}=It(),t=(r==null?void 0:r.userId)??null,{data:s}=$O(t),{data:i}=Su(),l=KO(t),c=A.useCallback(d=>{t&&VO(t,d)},[t]);return A.useMemo(()=>{const d={kiosk:!1,role:null,homePath:null,targets:[],selectable:!1,selectRole:c},y=s??[];if(y.length===0||y.some(v=>v.type!=="member"))return d;const g=v=>{var w,S,C;return((C=(S=(w=i==null?void 0:i.roles)==null?void 0:w.find(L=>L.role===v))==null?void 0:S.properties)==null?void 0:C.kiosk)===!0},f=y.map(v=>v.role).filter(g),m=v=>({kiosk:!0,role:v,homePath:`/escalations/available?role=${encodeURIComponent(v)}&status=available`,targets:f,selectable:f.length>=2,selectRole:c});if(y.length===1)return f.length===1?m(f[0]):d;if(!y.every(v=>v.write_scope==="none")||f.length===0)return d;const x=l&&f.includes(l)?l:f.length===1?f[0]:null;return x?m(x):{...d,targets:f,selectable:!0}},[s,i,l,c])}const JO=["/escalations","/scan","/login"];function XO(r){return JO.some(t=>r===t||r.startsWith(`${t}/`)||r.startsWith(`${t}?`))}const um=A.createContext(null),Wh="lt_sidebar_collapsed",jx="(max-width: 1023px)";function QO(){try{return window.matchMedia(jx).matches}catch{return!1}}function ZO({children:r}){const[t,s]=A.useState(()=>{if(QO())return!0;try{return localStorage.getItem(Wh)==="true"}catch{return!1}});A.useEffect(()=>{let l;try{l=window.matchMedia(jx)}catch{return}const c=d=>{if(d.matches)s(!0);else try{s(localStorage.getItem(Wh)==="true")}catch{s(!1)}};return l.addEventListener("change",c),()=>l.removeEventListener("change",c)},[]);const i=A.useCallback(()=>{s(l=>{const c=!l;try{localStorage.setItem(Wh,String(c))}catch{}return c})},[]);return h.jsx(um.Provider,{value:{collapsed:t,toggle:i},children:r})}function WO({children:r}){return h.jsx(um.Provider,{value:{collapsed:!1,toggle:()=>{}},children:r})}function fm(){const r=A.useContext(um);if(!r)throw new Error("useSidebar must be used within SidebarProvider");return r}const Jg=380,hm=A.createContext(null);function eA({children:r}){const[t,s]=A.useState({node:null,width:Jg,open:!1,ownerKey:null}),i=wn(),l=A.useRef(i.pathname),c=A.useCallback((y,g)=>{s({node:y,width:(g==null?void 0:g.width)??Jg,open:!0,ownerKey:(g==null?void 0:g.key)??null})},[]),d=A.useCallback(y=>{s(g=>typeof y=="string"&&g.ownerKey!==y?g:{...g,open:!1})},[]);return A.useEffect(()=>{i.pathname!==l.current&&(l.current=i.pathname,s(y=>y.open||y.node?{...y,node:null,open:!1,ownerKey:null}:y))},[i.pathname]),h.jsx(hm.Provider,{value:{...t,setPanel:c,closePanel:d},children:r})}function dm(){const r=A.useContext(hm);if(!r)throw new Error("useShellPanel must be used within ShellPanelProvider");return r}function P3(){return A.useContext(hm)}function tA({open:r,width:t=380,children:s,className:i=""}){const[l,c]=A.useState(r);return A.useEffect(()=>{r&&c(!0)},[r]),h.jsx("div",{className:`shrink-0 overflow-hidden transition-[width] duration-300 ease-out ${i}`,style:{width:r?t:0,maxWidth:"50%"},onTransitionEnd:d=>{!r&&d.propertyName==="width"&&c(!1)},children:h.jsx("div",{style:{width:t},className:"h-full",children:l?s:null})})}function z3({label:r,children:t}){return h.jsxs("div",{children:[h.jsx("dt",{className:"text-2xs font-medium text-text-secondary uppercase tracking-wide",children:r}),h.jsx("dd",{className:"text-xs text-text-primary mt-0.5",children:t})]})}function I3({views:r,activeId:t,onViewChange:s,onClose:i,headerActions:l,stickyClassName:c,labelInline:d}){const y=r.find(g=>g.id===t)??r[0];return y?h.jsx("div",{className:"h-full bg-surface-hover",children:h.jsxs("div",{className:`flex flex-col ${c??"sticky top-0 z-10 max-h-[calc(100vh-3.5rem)]"}`,children:[h.jsxs("div",{className:`flex items-center justify-between pl-4 pr-3 shrink-0 ${d?"pt-10 pb-2":"pt-3"}`,children:[h.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[h.jsx("div",{className:"flex items-center gap-1 shrink-0",role:"radiogroup","aria-label":"Panel view",children:r.map(g=>{const f=g.icon,m=g.id===y.id;return h.jsx("button",{role:"radio","aria-checked":m,onClick:()=>s(g.id),title:g.label,className:`p-1.5 rounded-md transition-colors ${m?"bg-accent/10 text-accent":"text-accent/60 hover:text-accent hover:bg-surface-hover"}`,children:h.jsx(f,{className:"w-3.5 h-3.5"})},g.id)})}),d&&h.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-text-secondary truncate",children:y.label})]}),h.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[l,i&&h.jsx("button",{onClick:i,title:"Close panel",className:"p-1 rounded text-accent/60 hover:text-accent hover:bg-surface-hover transition-colors",children:h.jsx(Jt,{className:"w-3.5 h-3.5"})})]})]}),!d&&h.jsx("p",{className:"px-5 pt-2 pb-1 text-2xs font-semibold uppercase tracking-widest text-text-secondary shrink-0",children:y.label}),h.jsx("div",{className:`flex-1 overflow-y-auto px-5 ${d?"pt-4 pb-8":"pb-5 pt-1"}`,children:y.content})]})}):null}function kx(r,t){var s,i,l,c,d;t.facets&&Object.keys(t.facets).length&&r.set("facets",JSON.stringify(t.facets)),(s=t.block)!=null&&s.length&&r.set("block",JSON.stringify(t.block)),(i=t.range)!=null&&i.length&&r.set("range",JSON.stringify(t.range)),(l=t.exists)!=null&&l.length&&r.set("exists",JSON.stringify(t.exists)),(c=t.roles)!=null&&c.length&&r.set("roles",JSON.stringify(t.roles)),(d=t.orderBy)!=null&&d.length&&r.set("orderBy",JSON.stringify(t.orderBy)),t.available!==void 0&&r.set("available",String(t.available)),t.jeopardy===!0&&r.set("jeopardy","1"),t.include&&r.set("include",t.include)}function $3(r,t,s){const i=r??"24h",l=t&&Object.keys(t).length?JSON.stringify(t):null;return We({queryKey:["stationMetrics",i,l],queryFn:()=>me(`/escalations/station-metrics?period=${i}${l?`&facets=${encodeURIComponent(l)}`:""}`),staleTime:5e3,enabled:(s==null?void 0:s.enabled)??!0})}function H3(r){const t=r?`?period=${r}`:"";return We({queryKey:["escalationStats",r],queryFn:()=>me(`/escalations/stats${t}`)})}function F3(){return We({queryKey:["escalationTypes"],queryFn:()=>me("/escalations/types")})}function G3(r=!0){return We({queryKey:["escalationFacetKeys"],queryFn:()=>me("/escalations/facet-keys"),enabled:r,staleTime:6e4})}function nA(r){return We({queryKey:["escalationFacetValues",r],queryFn:()=>me(`/escalations/facet-values?key=${encodeURIComponent(r)}`),enabled:!!r,staleTime:6e4})}function Nx(r){const{enabled:t=!0,staleTime:s,...i}=r,l=new URLSearchParams;return i.status&&l.set("status",i.status),i.role&&l.set("role",i.role),i.type&&l.set("type",i.type),i.subtype&&l.set("subtype",i.subtype),i.assigned_to&&l.set("assigned_to",i.assigned_to),i.parent_id&&l.set("parent_id",i.parent_id),i.claimed&&l.set("claimed","true"),i.priority&&l.set("priority",String(i.priority)),i.limit&&l.set("limit",String(i.limit)),i.offset!==void 0&&l.set("offset",String(i.offset)),i.sort_by&&l.set("sort_by",i.sort_by),i.order&&l.set("order",i.order),i.search&&l.set("search",i.search),kx(l,i),We({queryKey:["escalations",i],queryFn:()=>me(`/escalations?${l}`),enabled:t,...s!==void 0?{staleTime:s}:{}})}function Tx(r){const{enabled:t=!0,staleTime:s,...i}=r,l=new URLSearchParams;return i.role&&l.set("role",i.role),i.type&&l.set("type",i.type),i.subtype&&l.set("subtype",i.subtype),i.priority&&l.set("priority",String(i.priority)),i.limit&&l.set("limit",String(i.limit)),i.offset!==void 0&&l.set("offset",String(i.offset)),i.sort_by&&l.set("sort_by",i.sort_by),i.order&&l.set("order",i.order),i.search&&l.set("search",i.search),kx(l,i),We({queryKey:["escalations","available",i],queryFn:()=>me(`/escalations/available?${l}`),enabled:t,...s!==void 0?{staleTime:s}:{}})}function V3(r){return We({queryKey:["escalations","by-workflow",r],queryFn:()=>me(`/escalations/by-workflow/${r}`),enabled:!!r})}function Y3(r){return We({queryKey:["escalations",r],queryFn:()=>me(`/escalations/${r}`),enabled:!!r})}function K3(r,t){return We({queryKey:["escalations",r,"lookups"],queryFn:()=>me(`/escalations/${r}/lookups`),enabled:!!r&&t,staleTime:1/0})}function J3(){const r=Ve();return et({mutationFn:({id:t,durationMinutes:s})=>me(`/escalations/${t}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:s})}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function X3(){const r=Ve();return et({mutationFn:t=>me(`/escalations/${t}/release`,{method:"POST"}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function Q3(){const r=Ve();return et({mutationFn:({id:t,resolverPayload:s})=>me(`/escalations/${t}/resolve`,{method:"POST",body:JSON.stringify({resolverPayload:s})}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]}),r.resetQueries({queryKey:["tasks"]}),r.resetQueries({queryKey:["jobs"]})}})}function Z3(){const r=Ve();return et({mutationFn:({id:t,targetRole:s})=>me(`/escalations/${t}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:s})}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function W3(){const r=Ve();return et({mutationFn:({ids:t,priority:s})=>me("/escalations/priority",{method:"PATCH",body:JSON.stringify({ids:t,priority:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function eC(){const r=Ve();return et({mutationFn:({ids:t,durationMinutes:s})=>me("/escalations/bulk-claim",{method:"POST",body:JSON.stringify({ids:t,durationMinutes:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function tC(){const r=Ve();return et({mutationFn:({ids:t,targetUserId:s,durationMinutes:i,reassign:l})=>me("/escalations/bulk-assign",{method:"POST",body:JSON.stringify({ids:t,targetUserId:s,durationMinutes:i,...l?{reassign:!0}:{}})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function nC(){const r=Ve();return et({mutationFn:({ids:t})=>me("/escalations/bulk-unassign",{method:"POST",body:JSON.stringify({ids:t})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function rC(){const r=Ve();return et({mutationFn:({ids:t,hint:s})=>me("/escalations/bulk-triage",{method:"POST",body:JSON.stringify({ids:t,...s?{hint:s}:{}})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function sC(){const r=Ve();return et({mutationFn:t=>me(`/escalations/${t}/cancel`,{method:"POST"}),onSuccess:()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]})}})}function iC(){const r=Ve();return et({mutationFn:({ids:t})=>me("/escalations/bulk-cancel",{method:"POST",body:JSON.stringify({ids:t})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function mm(r){const t=[],s=r.type.split(".");switch(s[0]==="system"?s[1]:s[0]){case"task":t.push(["tasks"]),t.push(["jobs"]),t.push(["processes"]),r.workflowId&&(t.push(["workflowExecution",r.workflowId]),t.push(["workflowState",r.workflowId]),t.push(["mcpQueryExecution",r.workflowId])),r.originId&&t.push(["processes",r.originId]);break;case"escalation":t.push(["escalations"]),t.push(["escalationStats"]),t.push(["stationMetrics"]),r.workflowId&&t.push(["workflowExecution",r.workflowId]);break;case"workflow":t.push(["jobs"]),t.push(["tasks"]),t.push(["processes"]),r.workflowId&&(t.push(["workflowExecution",r.workflowId]),t.push(["workflowState",r.workflowId]),t.push(["mcpQueryExecution",r.workflowId]),t.push(["mcpQueryResult",r.workflowId]),t.push(["builderResult",r.workflowId]));break;case"activity":r.workflowId&&t.push(["mcpRunExecution",r.workflowId]),t.push(["mcpRuns"]);break;case"milestone":r.workflowId&&(t.push(["workflowExecution",r.workflowId]),t.push(["mcpQueryExecution",r.workflowId])),t.push(["tasks"]);break;case"knowledge":t.push(["knowledge"]);break;case"file":t.push(["files"]);break;case"agent":t.push(["agents"]);break;default:t.push(["jobs"]),t.push(["tasks"]);break}return t}const rA={DETAIL:{coalesceMs:300,minIntervalMs:2e3},LIST:{coalesceMs:500,minIntervalMs:3e3},SUMMARY:{coalesceMs:1e3,minIntervalMs:1e4}},aC=300,Xg={DETAIL:0,LIST:1,SUMMARY:2};function sA(r){const t=new Map,s={},i={};let l=!1;const c=()=>typeof document<"u"&&document.visibilityState==="hidden";function d(m){delete s[m],i[m]=Date.now();const b=[];for(const[v,w]of t)w===m&&b.push(v);for(const v of b)t.delete(v);if(b.length===0)return;const x=c();x&&(l=!0);for(const v of b)r.invalidateQueries({queryKey:JSON.parse(v),...x?{refetchType:"none"}:{}})}function y(m){if(s[m])return;const{coalesceMs:b,minIntervalMs:x}=rA[m],v=i[m],w=v===void 0?0:v+x-Date.now(),S=Math.max(b,w);s[m]=setTimeout(()=>d(m),S)}function g(m,b){for(const x of b){const v=JSON.stringify(x),w=t.get(v);(w===void 0||Xg[m]<Xg[w])&&t.set(v,m)}y(m)}const f=()=>{typeof document>"u"||document.visibilityState==="visible"&&l&&(l=!1,r.refetchQueries({type:"active",stale:!0}))};return typeof document<"u"&&document.addEventListener("visibilitychange",f),{request:g,dispose(){for(const m of Object.keys(s)){const b=s[m];b&&clearTimeout(b),delete s[m]}t.clear(),typeof document<"u"&&document.removeEventListener("visibilitychange",f)}}}const Qg=new WeakMap;function iA(r){let t=Qg.get(r);return t||(t=sA(r),Qg.set(r,t)),t}function nn(r){const t=Ve();return A.useCallback(s=>{iA(t).request(r,s)},[t,r])}function pm(r){return r?[`${Yt}.system.workflow.>`,`${Yt}.system.activity.>`,`${Yt}.system.milestone.>`,`${Yt}.system.task.>`,`${Yt}.system.escalation.>`]:[]}function oC(){const r=nn("LIST");xn(`${Yt}.system.task.>`,()=>{r([["jobs"]])}),xn(`${Yt}.system.workflow.>`,()=>{r([["jobs"]])})}function lC(r){const t=nn("DETAIL");Js(pm(r),s=>{var y;if(!r||!(s.workflowId===r||((y=s.workflowId)==null?void 0:y.includes(r))))return;const l=s.type.split("."),c=l[0]==="system"?l[1]:l[0],d=mm(s);c==="escalation"&&d.push(["escalations","by-workflow",r]),t(d)})}function cC(r){const t=nn("DETAIL");Js(pm(r),s=>{var y;if(!r||!(s.workflowId===r||((y=s.workflowId)==null?void 0:y.includes(r))))return;const l=s.type.split("."),c=l[0]==="system"?l[1]:l[0],d=mm(s);c==="escalation"&&d.push(["escalations","by-workflow",r]),t(d)})}function uC(r){const t=nn("DETAIL");Js(pm(r),s=>{var c;if(!r||!(s.workflowId===r||((c=s.workflowId)==null?void 0:c.includes(r))))return;const l=mm(s);l.push(["workflowSets"]),l.push(["yamlWorkflows"]),t(l)})}function fC(r){const t=nn("DETAIL"),s=A.useCallback(i=>{r&&(i.originId!==r&&i.workflowId!==r||t([["processes",r]]))},[r,t]);xn(`${Yt}.system.task.>`,s),xn(`${Yt}.system.workflow.>`,s),xn(`${Yt}.system.escalation.>`,s)}function hC(){const r=nn("SUMMARY");xn(Mr({}),()=>{r([["escalationStats"]])})}function dC(){const r=nn("SUMMARY");xn(Mr({}),()=>{r([["stationMetrics"]])})}function mC(){const r=nn("SUMMARY");xn(Mr({}),()=>{r([["escAggregate"],["escTimeline"]])})}function pC(r){const t=nn("LIST"),s=(r==null?void 0:r.role)??null,i=((r==null?void 0:r.verbs)??[]).join(","),l=A.useMemo(()=>{const c=i?i.split(","):null;return c?Td({role:s,verbs:c}):[Mr({role:s})]},[s,i]);Js(l,()=>{t([["escalations"]])})}function yC(r){const t=nn("DETAIL");xn(Mr(r?{id:r}:{id:"__none__"}),s=>{!r||s.escalationId!==r||t([["escalations",r]])})}function gC(){const r=nn("LIST");xn(`${Yt}.system.agent.>`,()=>{r([["agents"]])})}function bC(){const r=nn("LIST");xn(`${Yt}.system.task.>`,()=>{r([["processes"]])}),xn(`${Yt}.system.workflow.>`,()=>{r([["processes"]])})}function aA(){const{user:r}=It(),t=r==null?void 0:r.userId,s=nn("SUMMARY");Js(lm(),()=>{s([["escalations"]])});const{data:i}=Tx({limit:1}),{data:l}=Nx({assigned_to:t,status:"pending",limit:1});return{available:(i==null?void 0:i.total)??0,mine:(l==null?void 0:l.total)??0}}function uu({size:r="sm",hideLabel:t=!1,className:s="",appName:i="LongTail",variant:l="full"}){const c=r==="lg";if(l==="comet")return h.jsx("div",{className:`relative overflow-visible ${s}`,style:{width:"2.5rem",height:"2.5rem",flexShrink:0},children:h.jsx("span",{role:"img","aria-label":i,className:"logo-mark absolute pointer-events-none select-none",style:{"--logo-url":`url(${Bt}/logo512.png)`,width:"82px",height:"82px",top:"-12px",left:"-80px",transform:"rotate(232deg)",zIndex:-1,opacity:.55}})});if(l==="mark")return h.jsx("div",{className:`flex items-center ${s}`,children:h.jsx("span",{role:"img","aria-label":i,className:"logo-mark shrink-0 w-7 h-7",style:{"--logo-url":`url(${Bt}/logo512.png)`}})});const d=c?"w-[16rem] h-[16rem] -rotate-[120deg] opacity-55 -ml-10":"w-[12.5rem] h-[12.5rem] -rotate-[120deg] opacity-55 -ml-8",y=c?"text-[44px] font-normal text-text-primary tracking-[0.15em] -ml-[12.5rem]":"text-[36px] font-normal text-text-primary tracking-[0.15em] -ml-[9.75rem]";return h.jsxs("div",{className:`flex items-center ${s}`,style:{height:"50px"},children:[h.jsx("span",{role:"img","aria-label":i,className:`logo-mark shrink-0 z-0 ${d}`,style:{"--logo-url":`url(${Bt}/logo512.png)`}}),h.jsx("span",{className:`z-[1] transition-opacity duration-300 ${y} ${t?"opacity-0":""}`,children:i})]})}const oA="system.surfaces.dashboard",lA=`${Yt}.${oA}`;function Cx(r=!0){return We({queryKey:["announcements"],queryFn:()=>me("/announcements"),enabled:r,staleTime:3e4})}function cA(){const r=Ve();return et({mutationFn:t=>me("/announcements",{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{r.invalidateQueries({queryKey:["announcements"]})}})}function uA(){const r=Ve();return et({mutationFn:t=>me(`/announcements/${encodeURIComponent(t)}`,{method:"DELETE"}),onSuccess:()=>{r.invalidateQueries({queryKey:["announcements"]})}})}const Mx=6048e5,fA=864e5,Zg=6e4,Wg=525600,e1=43200,t1=1440,n1=Symbol.for("constructDateFrom");function Rr(r,t){return typeof r=="function"?r(t):r&&typeof r=="object"&&n1 in r?r[n1](t):r instanceof Date?new r.constructor(t):new Date(t)}function _n(r,t){return Rr(t||r,r)}let hA={};function Eo(){return hA}function _o(r,t){var y,g,f,m;const s=Eo(),i=(t==null?void 0:t.weekStartsOn)??((g=(y=t==null?void 0:t.locale)==null?void 0:y.options)==null?void 0:g.weekStartsOn)??s.weekStartsOn??((m=(f=s.locale)==null?void 0:f.options)==null?void 0:m.weekStartsOn)??0,l=_n(r,t==null?void 0:t.in),c=l.getDay(),d=(c<i?7:0)+c-i;return l.setDate(l.getDate()-d),l.setHours(0,0,0,0),l}function fu(r,t){return _o(r,{...t,weekStartsOn:1})}function Rx(r,t){const s=_n(r,t==null?void 0:t.in),i=s.getFullYear(),l=Rr(s,0);l.setFullYear(i+1,0,4),l.setHours(0,0,0,0);const c=fu(l),d=Rr(s,0);d.setFullYear(i,0,4),d.setHours(0,0,0,0);const y=fu(d);return s.getTime()>=c.getTime()?i+1:s.getTime()>=y.getTime()?i:i-1}function hu(r){const t=_n(r),s=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return s.setUTCFullYear(t.getFullYear()),+r-+s}function Dx(r,...t){const s=Rr.bind(null,r||t.find(i=>typeof i=="object"));return t.map(s)}function r1(r,t){const s=_n(r,t==null?void 0:t.in);return s.setHours(0,0,0,0),s}function dA(r,t,s){const[i,l]=Dx(s==null?void 0:s.in,r,t),c=r1(i),d=r1(l),y=+c-hu(c),g=+d-hu(d);return Math.round((y-g)/fA)}function mA(r,t){const s=Rx(r,t),i=Rr(r,0);return i.setFullYear(s,0,4),i.setHours(0,0,0,0),fu(i)}function pA(r,t){const s=+_n(r)-+_n(t);return s<0?-1:s>0?1:s}function yA(r){return Rr(r,Date.now())}function gA(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}function bA(r){return!(!gA(r)&&typeof r!="number"||isNaN(+_n(r)))}function xA(r){return t=>{const i=(r?Math[r]:Math.trunc)(t);return i===0?0:i}}function vA(r,t){const s=_n(r,t==null?void 0:t.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}const _A={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"}},wA=(r,t,s)=>{let i;const l=_A[r];return typeof l=="string"?i=l:t===1?i=l.one:i=l.other.replace("{{count}}",t.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+i:i+" ago":i};function ed(r){return(t={})=>{const s=t.width?String(t.width):r.defaultWidth;return r.formats[s]||r.formats[r.defaultWidth]}}const SA={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},EA={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},OA={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},AA={date:ed({formats:SA,defaultWidth:"full"}),time:ed({formats:EA,defaultWidth:"full"}),dateTime:ed({formats:OA,defaultWidth:"full"})},jA={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},kA=(r,t,s,i)=>jA[r];function eo(r){return(t,s)=>{const i=s!=null&&s.context?String(s.context):"standalone";let l;if(i==="formatting"&&r.formattingValues){const d=r.defaultFormattingWidth||r.defaultWidth,y=s!=null&&s.width?String(s.width):d;l=r.formattingValues[y]||r.formattingValues[d]}else{const d=r.defaultWidth,y=s!=null&&s.width?String(s.width):r.defaultWidth;l=r.values[y]||r.values[d]}const c=r.argumentCallback?r.argumentCallback(t):t;return l[c]}}const NA={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},TA={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},CA={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"]},MA={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"]},RA={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"}},DA={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"}},qA=(r,t)=>{const s=Number(r),i=s%100;if(i>20||i<10)switch(i%10){case 1:return s+"st";case 2:return s+"nd";case 3:return s+"rd"}return s+"th"},LA={ordinalNumber:qA,era:eo({values:NA,defaultWidth:"wide"}),quarter:eo({values:TA,defaultWidth:"wide",argumentCallback:r=>r-1}),month:eo({values:CA,defaultWidth:"wide"}),day:eo({values:MA,defaultWidth:"wide"}),dayPeriod:eo({values:RA,defaultWidth:"wide",formattingValues:DA,defaultFormattingWidth:"wide"})};function to(r){return(t,s={})=>{const i=s.width,l=i&&r.matchPatterns[i]||r.matchPatterns[r.defaultMatchWidth],c=t.match(l);if(!c)return null;const d=c[0],y=i&&r.parsePatterns[i]||r.parsePatterns[r.defaultParseWidth],g=Array.isArray(y)?UA(y,b=>b.test(d)):BA(y,b=>b.test(d));let f;f=r.valueCallback?r.valueCallback(g):g,f=s.valueCallback?s.valueCallback(f):f;const m=t.slice(d.length);return{value:f,rest:m}}}function BA(r,t){for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)&&t(r[s]))return s}function UA(r,t){for(let s=0;s<r.length;s++)if(t(r[s]))return s}function PA(r){return(t,s={})=>{const i=t.match(r.matchPattern);if(!i)return null;const l=i[0],c=t.match(r.parsePattern);if(!c)return null;let d=r.valueCallback?r.valueCallback(c[0]):c[0];d=s.valueCallback?s.valueCallback(d):d;const y=t.slice(l.length);return{value:d,rest:y}}}const zA=/^(\d+)(th|st|nd|rd)?/i,IA=/\d+/i,$A={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},HA={any:[/^b/i,/^(a|c)/i]},FA={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},GA={any:[/1/i,/2/i,/3/i,/4/i]},VA={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},YA={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]},KA={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},JA={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]},XA={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},QA={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}},ZA={ordinalNumber:PA({matchPattern:zA,parsePattern:IA,valueCallback:r=>parseInt(r,10)}),era:to({matchPatterns:$A,defaultMatchWidth:"wide",parsePatterns:HA,defaultParseWidth:"any"}),quarter:to({matchPatterns:FA,defaultMatchWidth:"wide",parsePatterns:GA,defaultParseWidth:"any",valueCallback:r=>r+1}),month:to({matchPatterns:VA,defaultMatchWidth:"wide",parsePatterns:YA,defaultParseWidth:"any"}),day:to({matchPatterns:KA,defaultMatchWidth:"wide",parsePatterns:JA,defaultParseWidth:"any"}),dayPeriod:to({matchPatterns:XA,defaultMatchWidth:"any",parsePatterns:QA,defaultParseWidth:"any"})},qx={code:"en-US",formatDistance:wA,formatLong:AA,formatRelative:kA,localize:LA,match:ZA,options:{weekStartsOn:0,firstWeekContainsDate:1}};function WA(r,t){const s=_n(r,t==null?void 0:t.in);return dA(s,vA(s))+1}function ej(r,t){const s=_n(r,t==null?void 0:t.in),i=+fu(s)-+mA(s);return Math.round(i/Mx)+1}function Lx(r,t){var m,b,x,v;const s=_n(r,t==null?void 0:t.in),i=s.getFullYear(),l=Eo(),c=(t==null?void 0:t.firstWeekContainsDate)??((b=(m=t==null?void 0:t.locale)==null?void 0:m.options)==null?void 0:b.firstWeekContainsDate)??l.firstWeekContainsDate??((v=(x=l.locale)==null?void 0:x.options)==null?void 0:v.firstWeekContainsDate)??1,d=Rr((t==null?void 0:t.in)||r,0);d.setFullYear(i+1,0,c),d.setHours(0,0,0,0);const y=_o(d,t),g=Rr((t==null?void 0:t.in)||r,0);g.setFullYear(i,0,c),g.setHours(0,0,0,0);const f=_o(g,t);return+s>=+y?i+1:+s>=+f?i:i-1}function tj(r,t){var y,g,f,m;const s=Eo(),i=(t==null?void 0:t.firstWeekContainsDate)??((g=(y=t==null?void 0:t.locale)==null?void 0:y.options)==null?void 0:g.firstWeekContainsDate)??s.firstWeekContainsDate??((m=(f=s.locale)==null?void 0:f.options)==null?void 0:m.firstWeekContainsDate)??1,l=Lx(r,t),c=Rr((t==null?void 0:t.in)||r,0);return c.setFullYear(l,0,i),c.setHours(0,0,0,0),_o(c,t)}function nj(r,t){const s=_n(r,t==null?void 0:t.in),i=+_o(s,t)-+tj(s,t);return Math.round(i/Mx)+1}function Je(r,t){const s=r<0?"-":"",i=Math.abs(r).toString().padStart(t,"0");return s+i}const fs={y(r,t){const s=r.getFullYear(),i=s>0?s:1-s;return Je(t==="yy"?i%100:i,t.length)},M(r,t){const s=r.getMonth();return t==="M"?String(s+1):Je(s+1,2)},d(r,t){return Je(r.getDate(),t.length)},a(r,t){const s=r.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return s.toUpperCase();case"aaa":return s;case"aaaaa":return s[0];case"aaaa":default:return s==="am"?"a.m.":"p.m."}},h(r,t){return Je(r.getHours()%12||12,t.length)},H(r,t){return Je(r.getHours(),t.length)},m(r,t){return Je(r.getMinutes(),t.length)},s(r,t){return Je(r.getSeconds(),t.length)},S(r,t){const s=t.length,i=r.getMilliseconds(),l=Math.trunc(i*Math.pow(10,s-3));return Je(l,t.length)}},Li={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},s1={G:function(r,t,s){const i=r.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return s.era(i,{width:"abbreviated"});case"GGGGG":return s.era(i,{width:"narrow"});case"GGGG":default:return s.era(i,{width:"wide"})}},y:function(r,t,s){if(t==="yo"){const i=r.getFullYear(),l=i>0?i:1-i;return s.ordinalNumber(l,{unit:"year"})}return fs.y(r,t)},Y:function(r,t,s,i){const l=Lx(r,i),c=l>0?l:1-l;if(t==="YY"){const d=c%100;return Je(d,2)}return t==="Yo"?s.ordinalNumber(c,{unit:"year"}):Je(c,t.length)},R:function(r,t){const s=Rx(r);return Je(s,t.length)},u:function(r,t){const s=r.getFullYear();return Je(s,t.length)},Q:function(r,t,s){const i=Math.ceil((r.getMonth()+1)/3);switch(t){case"Q":return String(i);case"QQ":return Je(i,2);case"Qo":return s.ordinalNumber(i,{unit:"quarter"});case"QQQ":return s.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return s.quarter(i,{width:"narrow",context:"formatting"});case"QQQQ":default:return s.quarter(i,{width:"wide",context:"formatting"})}},q:function(r,t,s){const i=Math.ceil((r.getMonth()+1)/3);switch(t){case"q":return String(i);case"qq":return Je(i,2);case"qo":return s.ordinalNumber(i,{unit:"quarter"});case"qqq":return s.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return s.quarter(i,{width:"narrow",context:"standalone"});case"qqqq":default:return s.quarter(i,{width:"wide",context:"standalone"})}},M:function(r,t,s){const i=r.getMonth();switch(t){case"M":case"MM":return fs.M(r,t);case"Mo":return s.ordinalNumber(i+1,{unit:"month"});case"MMM":return s.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return s.month(i,{width:"narrow",context:"formatting"});case"MMMM":default:return s.month(i,{width:"wide",context:"formatting"})}},L:function(r,t,s){const i=r.getMonth();switch(t){case"L":return String(i+1);case"LL":return Je(i+1,2);case"Lo":return s.ordinalNumber(i+1,{unit:"month"});case"LLL":return s.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return s.month(i,{width:"narrow",context:"standalone"});case"LLLL":default:return s.month(i,{width:"wide",context:"standalone"})}},w:function(r,t,s,i){const l=nj(r,i);return t==="wo"?s.ordinalNumber(l,{unit:"week"}):Je(l,t.length)},I:function(r,t,s){const i=ej(r);return t==="Io"?s.ordinalNumber(i,{unit:"week"}):Je(i,t.length)},d:function(r,t,s){return t==="do"?s.ordinalNumber(r.getDate(),{unit:"date"}):fs.d(r,t)},D:function(r,t,s){const i=WA(r);return t==="Do"?s.ordinalNumber(i,{unit:"dayOfYear"}):Je(i,t.length)},E:function(r,t,s){const i=r.getDay();switch(t){case"E":case"EE":case"EEE":return s.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return s.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(i,{width:"short",context:"formatting"});case"EEEE":default:return s.day(i,{width:"wide",context:"formatting"})}},e:function(r,t,s,i){const l=r.getDay(),c=(l-i.weekStartsOn+8)%7||7;switch(t){case"e":return String(c);case"ee":return Je(c,2);case"eo":return s.ordinalNumber(c,{unit:"day"});case"eee":return s.day(l,{width:"abbreviated",context:"formatting"});case"eeeee":return s.day(l,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(l,{width:"short",context:"formatting"});case"eeee":default:return s.day(l,{width:"wide",context:"formatting"})}},c:function(r,t,s,i){const l=r.getDay(),c=(l-i.weekStartsOn+8)%7||7;switch(t){case"c":return String(c);case"cc":return Je(c,t.length);case"co":return s.ordinalNumber(c,{unit:"day"});case"ccc":return s.day(l,{width:"abbreviated",context:"standalone"});case"ccccc":return s.day(l,{width:"narrow",context:"standalone"});case"cccccc":return s.day(l,{width:"short",context:"standalone"});case"cccc":default:return s.day(l,{width:"wide",context:"standalone"})}},i:function(r,t,s){const i=r.getDay(),l=i===0?7:i;switch(t){case"i":return String(l);case"ii":return Je(l,t.length);case"io":return s.ordinalNumber(l,{unit:"day"});case"iii":return s.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return s.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return s.day(i,{width:"short",context:"formatting"});case"iiii":default:return s.day(i,{width:"wide",context:"formatting"})}},a:function(r,t,s){const l=r.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return s.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"aaa":return s.dayPeriod(l,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return s.dayPeriod(l,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(l,{width:"wide",context:"formatting"})}},b:function(r,t,s){const i=r.getHours();let l;switch(i===12?l=Li.noon:i===0?l=Li.midnight:l=i/12>=1?"pm":"am",t){case"b":case"bb":return s.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"bbb":return s.dayPeriod(l,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return s.dayPeriod(l,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(l,{width:"wide",context:"formatting"})}},B:function(r,t,s){const i=r.getHours();let l;switch(i>=17?l=Li.evening:i>=12?l=Li.afternoon:i>=4?l=Li.morning:l=Li.night,t){case"B":case"BB":case"BBB":return s.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"BBBBB":return s.dayPeriod(l,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(l,{width:"wide",context:"formatting"})}},h:function(r,t,s){if(t==="ho"){let i=r.getHours()%12;return i===0&&(i=12),s.ordinalNumber(i,{unit:"hour"})}return fs.h(r,t)},H:function(r,t,s){return t==="Ho"?s.ordinalNumber(r.getHours(),{unit:"hour"}):fs.H(r,t)},K:function(r,t,s){const i=r.getHours()%12;return t==="Ko"?s.ordinalNumber(i,{unit:"hour"}):Je(i,t.length)},k:function(r,t,s){let i=r.getHours();return i===0&&(i=24),t==="ko"?s.ordinalNumber(i,{unit:"hour"}):Je(i,t.length)},m:function(r,t,s){return t==="mo"?s.ordinalNumber(r.getMinutes(),{unit:"minute"}):fs.m(r,t)},s:function(r,t,s){return t==="so"?s.ordinalNumber(r.getSeconds(),{unit:"second"}):fs.s(r,t)},S:function(r,t){return fs.S(r,t)},X:function(r,t,s){const i=r.getTimezoneOffset();if(i===0)return"Z";switch(t){case"X":return a1(i);case"XXXX":case"XX":return Gs(i);case"XXXXX":case"XXX":default:return Gs(i,":")}},x:function(r,t,s){const i=r.getTimezoneOffset();switch(t){case"x":return a1(i);case"xxxx":case"xx":return Gs(i);case"xxxxx":case"xxx":default:return Gs(i,":")}},O:function(r,t,s){const i=r.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+i1(i,":");case"OOOO":default:return"GMT"+Gs(i,":")}},z:function(r,t,s){const i=r.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+i1(i,":");case"zzzz":default:return"GMT"+Gs(i,":")}},t:function(r,t,s){const i=Math.trunc(+r/1e3);return Je(i,t.length)},T:function(r,t,s){return Je(+r,t.length)}};function i1(r,t=""){const s=r>0?"-":"+",i=Math.abs(r),l=Math.trunc(i/60),c=i%60;return c===0?s+String(l):s+String(l)+t+Je(c,2)}function a1(r,t){return r%60===0?(r>0?"-":"+")+Je(Math.abs(r)/60,2):Gs(r,t)}function Gs(r,t=""){const s=r>0?"-":"+",i=Math.abs(r),l=Je(Math.trunc(i/60),2),c=Je(i%60,2);return s+l+t+c}const o1=(r,t)=>{switch(r){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},Bx=(r,t)=>{switch(r){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},rj=(r,t)=>{const s=r.match(/(P+)(p+)?/)||[],i=s[1],l=s[2];if(!l)return o1(r,t);let c;switch(i){case"P":c=t.dateTime({width:"short"});break;case"PP":c=t.dateTime({width:"medium"});break;case"PPP":c=t.dateTime({width:"long"});break;case"PPPP":default:c=t.dateTime({width:"full"});break}return c.replace("{{date}}",o1(i,t)).replace("{{time}}",Bx(l,t))},sj={p:Bx,P:rj},ij=/^D+$/,aj=/^Y+$/,oj=["D","DD","YY","YYYY"];function lj(r){return ij.test(r)}function cj(r){return aj.test(r)}function uj(r,t,s){const i=fj(r,t,s);if(console.warn(i),oj.includes(r))throw new RangeError(i)}function fj(r,t,s){const i=r[0]==="Y"?"years":"days of the month";return`Use \`${r.toLowerCase()}\` instead of \`${r}\` (in \`${t}\`) for formatting ${i} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const hj=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,dj=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,mj=/^'([^]*?)'?$/,pj=/''/g,yj=/[a-zA-Z]/;function ym(r,t,s){var m,b,x,v;const i=Eo(),l=i.locale??qx,c=i.firstWeekContainsDate??((b=(m=i.locale)==null?void 0:m.options)==null?void 0:b.firstWeekContainsDate)??1,d=i.weekStartsOn??((v=(x=i.locale)==null?void 0:x.options)==null?void 0:v.weekStartsOn)??0,y=_n(r,s==null?void 0:s.in);if(!bA(y))throw new RangeError("Invalid time value");let g=t.match(dj).map(w=>{const S=w[0];if(S==="p"||S==="P"){const C=sj[S];return C(w,l.formatLong)}return w}).join("").match(hj).map(w=>{if(w==="''")return{isToken:!1,value:"'"};const S=w[0];if(S==="'")return{isToken:!1,value:gj(w)};if(s1[S])return{isToken:!0,value:w};if(S.match(yj))throw new RangeError("Format string contains an unescaped latin alphabet character `"+S+"`");return{isToken:!1,value:w}});l.localize.preprocessor&&(g=l.localize.preprocessor(y,g));const f={firstWeekContainsDate:c,weekStartsOn:d,locale:l};return g.map(w=>{if(!w.isToken)return w.value;const S=w.value;(cj(S)||lj(S))&&uj(S,t,String(r));const C=s1[S[0]];return C(y,S,l.localize,f)}).join("")}function gj(r){const t=r.match(mj);return t?t[1].replace(pj,"'"):r}function bj(r,t,s){const i=Eo(),l=(s==null?void 0:s.locale)??i.locale??qx,c=pA(r,t);if(isNaN(c))throw new RangeError("Invalid time value");const d=Object.assign({},s,{addSuffix:s==null?void 0:s.addSuffix,comparison:c}),[y,g]=Dx(s==null?void 0:s.in,...c>0?[t,r]:[r,t]),f=xA((s==null?void 0:s.roundingMethod)??"round"),m=g.getTime()-y.getTime(),b=m/Zg,x=hu(g)-hu(y),v=(m-x)/Zg,w=s==null?void 0:s.unit;let S;if(w?S=w:b<1?S="second":b<60?S="minute":b<t1?S="hour":v<e1?S="day":v<Wg?S="month":S="year",S==="second"){const C=f(m/1e3);return l.formatDistance("xSeconds",C,d)}else if(S==="minute"){const C=f(b);return l.formatDistance("xMinutes",C,d)}else if(S==="hour"){const C=f(b/60);return l.formatDistance("xHours",C,d)}else if(S==="day"){const C=f(v/t1);return l.formatDistance("xDays",C,d)}else if(S==="month"){const C=f(v/e1);return C===12&&w!=="month"?l.formatDistance("xYears",1,d):l.formatDistance("xMonths",C,d)}else{const C=f(v/Wg);return l.formatDistance("xYears",C,d)}}function xj(r,t){return bj(r,yA(r),t)}function xC(r){return r.toLocaleString()}function vC(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 vj(r){const t=new Date(r);return t.getTime()>Date.now()?"just now":xj(t,{addSuffix:!0})}function _C(r){const t=Date.now()-new Date(r).getTime();if(t<0)return"now";const s=Math.floor(t/1e3);if(s<60)return`${s}s`;const i=Math.floor(s/60);if(i<60)return`${i}m`;const l=Math.floor(i/60);if(l<24)return`${l}h`;const c=Math.floor(l/24);return c<7?`${c}d`:c<30?`${Math.floor(c/7)}w`:c<365?`${Math.floor(c/30)}mo`:`${Math.floor(c/365)}y`}function wC(r){return r<=0?"Expired":gm(r)}function _j(r){return r==null?"--":gm(r)}function SC(r){return r?ym(new Date(r),"MMM d, yyyy h:mm a"):"--"}function gm(r){if(r<1e3)return`${Math.round(r)}ms`;if(r<6e4){const d=r/1e3;return Number.isInteger(d)?`${d}s`:`${d.toFixed(1)}s`}const t=Math.floor(r/1e3),s=Math.floor(t/86400),i=Math.floor(t%86400/3600),l=Math.floor(t%3600/60),c=t%60;return s>0?i>0?`${s}d ${i}h`:`${s}d`:i>0?l>0?`${i}h ${l}m`:`${i}h`:c>0?`${l}m ${c}s`:`${l}m`}function EC(r,t){const s=new Date(r).getTime(),i=t?new Date(t).getTime():Date.now();return gm(i-s)}function Ux({options:r,children:t,className:s=""}){const[i,l]=A.useState(!1),[c,d]=A.useState(null),[y,g]=A.useState(null),f=A.useRef(null),m=A.useRef(void 0),b=A.useRef(void 0),x=220,v=A.useCallback(()=>{if(!f.current)return;const L=f.current.getBoundingClientRect(),U=window.innerWidth-x-8,ne=Math.max(8,Math.min(L.left,U));g({top:L.bottom+4,left:ne})},[]),w=A.useCallback(async(L,U)=>{try{await navigator.clipboard.writeText(L),d(U),clearTimeout(m.current),m.current=setTimeout(()=>d(null),1200)}catch{}},[]),S=A.useCallback(()=>{clearTimeout(b.current),v(),l(!0)},[v]),C=A.useCallback(()=>{b.current=setTimeout(()=>l(!1),150)},[]);return A.useEffect(()=>()=>{clearTimeout(m.current),clearTimeout(b.current)},[]),h.jsxs("span",{ref:f,className:`inline-flex items-center cursor-default ${s}`,onMouseEnter:S,onMouseLeave:C,children:[t,i&&y&&zd.createPortal(h.jsx("span",{className:"fixed z-[9999] bg-surface-raised border border-surface-border rounded shadow-lg py-1 min-w-[180px]",style:{top:y.top,left:y.left},onMouseEnter:S,onMouseLeave:C,children:r.map(L=>h.jsxs("button",{onClick:U=>{U.stopPropagation(),w(L.value,L.label)},className:"flex items-center justify-between w-full px-2.5 py-1 text-left hover:bg-surface-hover transition-colors",children:[h.jsx("span",{className:"text-2xs font-medium uppercase tracking-wider text-text-tertiary w-10 shrink-0",children:L.label}),h.jsx("span",{className:"text-2xs font-mono text-text-secondary truncate ml-2",children:c===L.label?"✓":L.value})]},L.label))}),document.body)]})}function wj(r,t){const s=new Date(r);switch(t){case"relative":return vj(r);case"datetime":return ym(s,"MMM d, yyyy h:mm a");case"time":return s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}}function Sj(r){const t=new Date(r);return[{label:"ms",value:String(t.getTime())},{label:"utc",value:t.toISOString()},{label:"local",value:ym(t,"MMM d, yyyy h:mm:ss a")}]}function Px({date:r,format:t="relative",className:s=""}){const[,i]=A.useState(0);A.useEffect(()=>{if(t!=="relative")return;const c=setInterval(()=>i(d=>d+1),3e4);return()=>clearInterval(c)},[t]);const l=A.useMemo(()=>Sj(r),[r]);return h.jsx(Ux,{options:l,children:h.jsx("time",{dateTime:r,className:`text-xs text-text-tertiary ${s}`,children:wj(r,t)})})}function Ej({values:r,options:t,onChange:s,addLabel:i,emptyText:l,ariaLabel:c}){const d=t.filter(y=>!r.includes(y));return h.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[r.map(y=>h.jsxs("button",{type:"button",onClick:()=>s(r.filter(g=>g!==y)),className:"inline-flex items-center gap-1 text-2xs font-mono text-text-primary border border-surface-border px-1.5 py-0.5 hover:text-status-error hover:border-status-error/50 transition-colors",title:`Remove ${y}`,children:[y,h.jsx(Jt,{className:"w-3 h-3",strokeWidth:1.5})]},y)),r.length===0&&l&&h.jsx("span",{className:"text-2xs text-text-tertiary italic",children:l}),d.length>0&&h.jsxs("select",{value:"",onChange:y=>y.target.value&&s([...r,y.target.value]),className:"select font-mono","aria-label":c??i,children:[h.jsx("option",{value:"",children:i}),d.map(y=>h.jsx("option",{value:y,children:y},y))]})]})}const Oj=[{minutes:1,label:"1 minute"},{minutes:15,label:"15 minutes"},{minutes:30,label:"30 minutes"},{minutes:60,label:"1 hour"},{minutes:240,label:"4 hours"},{minutes:1440,label:"24 hours"},{minutes:4320,label:"3 days"},{minutes:10080,label:"7 days"}];function Aj(){const{data:r}=Cx(),{data:t}=HO(),s=cA(),i=uA(),[l,c]=A.useState(""),[d,y]=A.useState(""),[g,f]=A.useState(1440),[m,b]=A.useState([]),x=(r==null?void 0:r.announcements)??[],v=()=>{d.trim()&&s.mutate({body:d.trim(),...l.trim()?{title:l.trim()}:{},...m.length?{roles:m}:{},expiresAt:new Date(Date.now()+g*6e4).toISOString()},{onSuccess:()=>{c(""),y(""),b([])}})};return h.jsxs("div",{children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"Alerts"}),h.jsxs("div",{className:"space-y-3",children:[h.jsxs("label",{className:"block",children:[h.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Title"}),h.jsx("input",{type:"text",value:l,onChange:w=>c(w.target.value),placeholder:"Optional headline",className:"input text-xs w-full"})]}),h.jsxs("label",{className:"block",children:[h.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Summary"}),h.jsx("textarea",{value:d,onChange:w=>y(w.target.value),placeholder:"What everyone should know (markdown supported)",rows:3,className:"input text-xs w-full resize-y"})]}),h.jsxs("label",{className:"block",children:[h.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Visible for"}),h.jsx("select",{value:g,onChange:w=>f(Number(w.target.value)),className:"select text-xs w-full",children:Oj.map(w=>h.jsx("option",{value:w.minutes,children:w.label},w.minutes))})]}),h.jsxs("div",{className:"block",children:[h.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Visible to"}),h.jsx(Ej,{values:m,options:(t==null?void 0:t.roles)??[],onChange:b,addLabel:"Add a role…",emptyText:"Everyone",ariaLabel:"Add a role"})]}),s.error&&h.jsx("p",{className:"text-xs text-status-error",children:s.error.message}),h.jsx("button",{onClick:v,disabled:!d.trim()||s.isPending,className:"btn-primary text-xs w-full disabled:opacity-50",children:s.isPending?"Publishing…":"Publish alert"})]}),x.length>0&&h.jsxs("div",{className:"mt-6",children:[h.jsx("p",{className:"text-2xs text-text-tertiary mb-2",children:"Active now — stacked as banner rows, newest first"}),h.jsx("div",{className:"space-y-1",children:x.map(w=>h.jsxs("div",{className:"flex items-start gap-2 py-1.5 border-b border-surface-border/40 last:border-b-0",children:[h.jsxs("span",{className:"min-w-0 flex-1",children:[h.jsx("span",{className:"block text-xs text-text-primary truncate",children:w.title??w.body.split(`
|
|
54
|
+
`)[0]}),h.jsxs("span",{className:"block text-2xs text-text-tertiary",children:["expires ",h.jsx(Px,{date:w.expires_at,format:"relative"})]})]}),h.jsx("button",{onClick:()=>i.mutate(w.id),disabled:i.isPending,className:"icon-link shrink-0 mt-0.5",title:"Remove for everyone","aria-label":`Remove ${w.title??"announcement"}`,children:h.jsx(Jt,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]},w.id))})]})]})}const jj=[{id:null,label:"Your view",description:"Full access based on your account role",minTier:"operator"},{id:"admin",label:"Admin",description:"Pace Board + identity management",minTier:"superadmin"},{id:"engineer",label:"Engineer",description:"Work queue + identity management",minTier:"admin"},{id:"operator",label:"Operator",description:"Escalation queue only",minTier:"engineer"}],kj=["operator","engineer","admin","superadmin"];function l1(r){return kj.indexOf(r)}function Nj(r,t){return l1(r)>=l1(t)}function Tj({onClose:r}){var he,Ae,_e,Ne,je,Te,rt;const{isSuperAdmin:t,hasRoleType:s,hasRole:i}=It(),{data:l}=Xn(),c=om(),d=!!((he=l==null?void 0:l.ai)!=null&&he.enabled),y=xx(),g=y!==null?y:d,[f,m]=A.useState(g),b=(Ae=l==null?void 0:l.features)==null?void 0:Ae.graphWorkflows,x=b==null,[v,w]=A.useState(b===!0||x&&vx()),S=!!((_e=l==null?void 0:l.features)!=null&&_e.scanCodes),C=_x(),[L,U]=A.useState(C!==null?C:S),ne=t?"superadmin":s("admin")?"admin":i("engineer")?"engineer":"operator",se=((Ne=l==null?void 0:l.branding)==null?void 0:Ne.appName)??"LongTail",D=(je=l==null?void 0:l.environment)==null?void 0:je.longTailVersion,z=(Te=l==null?void 0:l.environment)==null?void 0:Te.hotmeshVersion,ae=(rt=l==null?void 0:l.environment)==null?void 0:rt.nodeEnv;A.useEffect(()=>{const Oe=ot=>{ot.key==="Escape"&&r()};return document.addEventListener("keydown",Oe),()=>document.removeEventListener("keydown",Oe)},[r]);const X=jj.filter(Oe=>Nj(ne,Oe.minTier)),M=X.length>1,$=ne!=="operator",Z=[...M?[{id:"viewas",label:"View As",icon:zw}]:[],{id:"features",label:"Features",icon:Iw},...$?[{id:"alerts",label:"Alerts",icon:$w}]:[]],[J,le]=A.useState(Z[0].id),ve=Oe=>{Oe===null?Nd():RO(Oe)},Re=()=>{const Oe=!f;m(Oe),Oe===d?MO():CO(Oe),window.location.reload()},Y=()=>{const Oe=!v;w(Oe),DO(Oe),window.location.reload()},oe=()=>{const Oe=!L;U(Oe),Oe===S?LO():qO(Oe),window.location.reload()};return h.jsx("div",{className:"fixed inset-0 z-[100] bg-surface-sunken/75 backdrop-blur-sm flex items-center justify-center",onClick:r,children:h.jsxs("div",{className:"relative w-[440px] max-h-[85vh] overflow-y-auto bg-surface-raised px-12 py-10",onClick:Oe=>Oe.stopPropagation(),children:[h.jsx("button",{onClick:r,className:"absolute top-4 right-4 text-text-quaternary hover:text-text-secondary transition-colors p-1","aria-label":"Close",children:h.jsx(Jt,{className:"w-4 h-4",strokeWidth:1.5})}),h.jsxs("div",{className:"flex flex-col items-center gap-3 pb-8",children:[h.jsx("span",{className:"logo-mark block w-20 h-20 opacity-50",style:{"--logo-url":`url(${Bt}/logo512.png)`}}),h.jsxs("div",{className:"text-center",children:[h.jsx("p",{className:"text-2xl font-light text-text-primary tracking-[0.12em]",children:se}),D&&h.jsxs("p",{className:"mt-1 text-2xs text-text-tertiary",children:["v",D,z&&h.jsxs(h.Fragment,{children:[" · HotMesh v",z]}),ae&&ae!=="production"&&h.jsx("span",{className:"ml-1 text-status-warning",children:ae})]})]})]}),h.jsx("hr",{className:"border-surface-border/50 mb-6"}),Z.length>1&&h.jsx("div",{className:"flex items-center justify-center gap-2 mb-8",role:"tablist",children:Z.map(Oe=>{const ot=J===Oe.id;return h.jsxs("button",{role:"tab","aria-selected":ot,onClick:()=>le(Oe.id),title:Oe.label,className:`flex flex-col items-center gap-1.5 px-5 py-2.5 rounded-lg transition-colors ${ot?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-secondary hover:bg-surface-hover"}`,children:[h.jsx(Oe.icon,{className:"w-5 h-5",strokeWidth:1.5,...ot?{fill:"currentColor",fillOpacity:.15}:{}}),h.jsx("span",{className:"text-2xs font-medium",children:Oe.label})]},Oe.id)})}),J==="viewas"&&M&&h.jsxs("div",{className:"space-y-1",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"View As"}),X.map(Oe=>{const ot=c===Oe.id,yt=Oe.id===null?`Your view · ${ne}`:Oe.label;return h.jsxs("button",{onClick:()=>ve(Oe.id),className:"w-full text-left flex items-start gap-3 py-2.5 px-1 group",children:[h.jsx("span",{className:`mt-0.5 w-4 h-4 rounded-full border shrink-0 flex items-center justify-center transition-colors ${ot?"border-accent bg-accent":"border-surface-border group-hover:border-accent/60"}`,children:ot&&h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-text-inverse"})}),h.jsxs("span",{children:[h.jsx("span",{className:`block text-sm font-medium transition-colors ${ot?"text-accent":"text-text-primary group-hover:text-accent"}`,children:yt}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:Oe.description})]})]},String(Oe.id))})]}),J==="features"&&h.jsxs("div",{children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"Features"}),h.jsxs("button",{onClick:Re,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[h.jsxs("span",{children:[h.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"AI features"}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:f?"Enabled — AI assist, agent labels, bulk AI actions":"Hidden — automation labels, no AI surfaces"})]}),h.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${f?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${f?"translate-x-4":"translate-x-0"}`})})]}),x&&h.jsxs("button",{onClick:Y,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[h.jsxs("span",{children:[h.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"Graph workflows"}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:v?"Visible — Graph section shown in Orchestrate sidebar":"Hidden — use Procedural workflows instead"})]}),h.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${v?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${v?"translate-x-4":"translate-x-0"}`})})]}),h.jsxs("button",{onClick:oe,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[h.jsxs("span",{children:[h.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"Scan input"}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:L?"Enabled — header scan affordance, panel, and keyboard-wedge capture":"Hidden — the deployment opts in with features.scanCodes"})]}),h.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${L?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${L?"translate-x-4":"translate-x-0"}`})})]})]}),J==="alerts"&&$&&h.jsx(Aj,{}),h.jsx("hr",{className:"border-surface-border/50 mt-8"}),h.jsx("p",{className:"mt-4 text-2xs text-text-quaternary text-center",children:"Esc or click outside to close"})]})})}const zx=[{id:"violet",label:"Violet",swatch:"#7B3BE0"},{id:"red",label:"Brick",swatch:"#DC382D"},{id:"green",label:"Emerald",swatch:"#059669"},{id:"blue",label:"Electric",swatch:"#2563EB"},{id:"rose",label:"Raspberry",swatch:"#D6246E"},{id:"orange",label:"Harvest",swatch:"#E85D04"}],c1="blue",Ix="lt.theme";let $x=[];function Cj(r){const t=new Set(zx.map(i=>i.id)),s=new Set;$x=r.filter(i=>!(i!=null&&i.id)||t.has(i.id)||s.has(i.id)?!1:(s.add(i.id),!0))}function Mj(){return[...zx,...$x]}function Hx(){try{return localStorage.getItem(Ix)||c1}catch{return c1}}function Fx(r){document.documentElement.dataset.theme=r}function Rj(r){try{localStorage.setItem(Ix,r)}catch{}Fx(r)}const Gx=A.createContext(null);function Dj(){const r=A.useContext(Gx);if(!r)throw new Error("useActingIdentity must be used within ActingIdentityProvider");return r}function qj({children:r}){const[t,s]=A.useState(null),i=A.useRef(t);i.current=t,A.useEffect(()=>{if(!(t!=null&&t.expiresAt))return;const g=new Date(t.expiresAt).getTime()-Date.now();if(g<=0){s(null);return}const f=setTimeout(()=>s(null),g);return()=>clearTimeout(f)},[t]);const l=A.useCallback(g=>{var m;if(!g.actingToken||!g.actor)return null;const f=((m=i.current)==null?void 0:m.actingToken)??null;return s({actingToken:g.actingToken,actorId:g.actor.id,displayName:g.actor.displayName,expiresAt:g.expiresAt??null}),f},[]),c=A.useCallback(()=>s(null),[]);A.useEffect(()=>(yg(()=>{var g;return((g=i.current)==null?void 0:g.actingToken)??null}),gg(c),()=>{yg(null),gg(null)}),[c]);const d=A.useCallback(()=>{var f;const g=(f=i.current)==null?void 0:f.expiresAt;return g?Math.max(0,Math.floor((new Date(g).getTime()-Date.now())/1e3)):0},[]),y=A.useMemo(()=>({identity:t,prime:l,clear:c,remainingSeconds:d}),[t,l,c,d]);return h.jsx(Gx.Provider,{value:y,children:r})}const tu={maxKeyGapMs:500,terminators:["Enter","Tab"],minLength:6,autoFireQuietMs:300,autoFireMaxAvgKeyMs:50},Vx="lt_scan_wedge_config";function Yx(){try{const r=localStorage.getItem(Vx);return r?{...tu,...JSON.parse(r)}:tu}catch{return tu}}function Lj(r){const t={...Yx(),...r};return localStorage.setItem(Vx,JSON.stringify(t)),t}const Bj=[/[1-9][0-9]:[0-9]:[a-zA-Z0-9._-]+$/,/[1-9][0-9]{7,}$/];function u1(r){let t=null;for(const s of Bj){const i=r.match(s);i&&(!t||i[0].length>t.length)&&(t=i[0])}return t}const Uj=new Set(["Shift","CapsLock"]),rc={suppress:!1,emit:null};function Pj(r=tu){let t={buffer:"",times:[],lastKeyMs:0};function s(){t={buffer:"",times:[],lastKeyMs:0}}function i(d){const{key:y,timeMs:g,hasModifier:f,isRepeat:m}=d;if(Uj.has(y))return rc;if(r.terminators.includes(y)){const S=u1(t.buffer);return s(),S&&S.length>=r.minLength?{suppress:!0,emit:S,consumedLength:S.length}:rc}if(f||m||y.length!==1)return s(),rc;const b=g-t.lastKeyMs,x=t.lastKeyMs>0&&b<=r.maxKeyGapMs,v=(x?t.buffer+y:y).slice(-128),w=(x?[...t.times,g]:[g]).slice(-128);return t={buffer:v,times:w,lastKeyMs:g},rc}function l(){return{buffer:t.buffer}}function c(){const d=u1(t.buffer);if(!d||d.length<r.minLength)return null;const y=t.times.slice(-d.length);return y.length<2||(y[y.length-1]-y[0])/(y.length-1)>r.autoFireMaxAvgKeyMs?null:{code:d,consumedLength:d.length}}return{step:i,reset:s,snapshot:l,pendingAutoFire:c}}function zj(){const r=document.activeElement;return r instanceof HTMLInputElement?["text","search","tel","url","email","password","number"].includes(r.type)?r:null:r instanceof HTMLTextAreaElement?r:null}function Ij(r,t,s){var c;const i=r instanceof HTMLInputElement?HTMLInputElement.prototype:HTMLTextAreaElement.prototype,l=(c=Object.getOwnPropertyDescriptor(i,"value"))==null?void 0:c.set;l?l.call(r,t):r.value=t;try{r.setSelectionRange(s,s)}catch{}r.dispatchEvent(new Event("input",{bubbles:!0}))}function f1(r){if(r<=0)return;const t=zj();if(!t)return;const s=t.selectionStart??t.value.length,i=Math.max(0,s-r);Ij(t,t.value.slice(0,i)+t.value.slice(s),i)}function $j({active:r,wedgeConfig:t,diagnosticsOn:s,onScan:i,onDiag:l}){const c=A.useRef({diagnosticsOn:s,onScan:i,onDiag:l});c.current={diagnosticsOn:s,onScan:i,onDiag:l};const d=A.useRef(0),y=A.useRef(0);A.useEffect(()=>{if(!r)return;const g=Pj(t);let f=null;const m=()=>{f&&(clearTimeout(f),f=null)},b=(w,S,C)=>{S&&f1(S),c.current.diagnosticsOn&&(console.debug("[scan]",C),c.current.onDiag({seq:++d.current,key:"(quiet)",code:"",deltaMs:0,buffer:"",note:C})),c.current.onScan(w)},x=()=>{m(),g.pendingAutoFire()&&(f=setTimeout(()=>{f=null;const w=g.pendingAutoFire();w&&(g.reset(),b(w.code,w.consumedLength,`capture → ${w.code} (quiet period — no suffix)`))},t.autoFireQuietMs))},v=w=>{const S=g.snapshot().buffer,{suppress:C,emit:L,consumedLength:U}=g.step({key:w.key,timeMs:w.timeStamp,hasModifier:w.ctrlKey||w.metaKey||w.altKey,isRepeat:w.repeat});if(C&&(w.preventDefault(),w.stopPropagation()),c.current.diagnosticsOn){const ne=g.snapshot().buffer,se=t.terminators.includes(w.key),D=L?`capture → ${L}`:se?`terminator — no code tail in "${S.slice(-24)}"`:ne===S?S?"neutral (chord key)":"ignored":ne===""?"reset (edit/chord/non-printable)":ne.length<=1&&S.length>1?"gap — new episode":"accumulate",z=y.current?Math.round(w.timeStamp-y.current):0,ae={seq:++d.current,key:w.key,code:w.code!==w.key?w.code:"",deltaMs:z,buffer:ne.slice(-24),note:D};console.debug("[scan]",ae.key,ae.code,`${ae.deltaMs}ms`,ae.note),c.current.onDiag(ae)}y.current=w.timeStamp,L?(m(),U&&f1(U),c.current.onScan(L)):x()};return window.addEventListener("keydown",v,{capture:!0}),()=>{m(),window.removeEventListener("keydown",v,{capture:!0})}},[r,t])}const Ie={EXECUTED:"executed",MATCHED_LIST:"matched_list",CONFIRM_REQUIRED:"confirm_required",NO_MATCH_FALLBACK:"no_match_fallback",UNCONFIGURED:"unconfigured",INVALID_CODE:"invalid_code",FORBIDDEN:"forbidden",CONFLICT:"conflict",IDENTITY_PRIMED:"identity_primed",IDENTITY_UNKNOWN:"identity_unknown",NOT_PRIMED:"not_primed",CHOICES:"choices"},sc={SHOW_DETAIL:"show-detail",SHOW_LIST:"show-list",CLAIM:"claim",CLAIM_SHOW_DETAIL:"claim-show-detail",RELEASE:"release",RESOLVE:"resolve",ESCALATE:"escalate",CANCEL:"cancel",PRESENT:"present"},OC={ACTION:"action",IDENTITY:"identity"};function Hj(r,t){return me("/scan-codes/execute",{method:"POST",body:JSON.stringify({code:r,...t!=null&&t.actingToken?{actingToken:t.actingToken}:{},...t!=null&&t.previousActingToken?{previousActingToken:t.previousActingToken}:{}})})}function AC(r){return me("/scan-codes/execute-choice",{method:"POST",body:JSON.stringify(r)})}function jC(){return We({queryKey:["scan-schemes"],queryFn:()=>me("/scan-codes/schemes")})}function kC(r){return We({queryKey:["scan-schemes",r],queryFn:()=>me(`/scan-codes/schemes/${r}`),enabled:r!=null})}function NC(){const r=Ve();return et({mutationFn:t=>me(`/scan-codes/schemes/${t.version}`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:()=>r.invalidateQueries({queryKey:["scan-schemes"]})})}function TC(){const r=Ve();return et({mutationFn:t=>me(`/scan-codes/schemes/${t}`,{method:"DELETE"}),onSuccess:()=>r.invalidateQueries({queryKey:["scan-schemes"]})})}function CC(){const r=Ve();return et({mutationFn:t=>me(`/scan-codes/schemes/${t.scheme_version}/actions/${t.category}`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:(t,s)=>r.invalidateQueries({queryKey:["scan-schemes",s.scheme_version]})})}function MC(){const r=Ve();return et({mutationFn:t=>me(`/scan-codes/schemes/${t.scheme_version}/actions/${t.category}`,{method:"DELETE"}),onSuccess:(t,s)=>r.invalidateQueries({queryKey:["scan-schemes",s.scheme_version]})})}const h1={KEYBOARD_WEDGE:"keyboard-wedge",MANUAL:"manual"},Bi=r=>{if(r)try{return JSON.parse(r)}catch{return}},Vs=r=>r==null||Array.isArray(r)&&r.length===0||typeof r=="object"&&!Array.isArray(r)&&Object.keys(r).length===0;function Fj(r){const t={},s=Bi(r.get("facets"));Vs(s)||(t.facets=s);const i=Bi(r.get("block"));Vs(i)||(t.block=i);const l=Bi(r.get("range"));Vs(l)||(t.range=l);const c=Bi(r.get("exists"));Vs(c)||(t.exists=c);const d=Bi(r.get("roles"));Vs(d)||(t.roles=d);const y=Bi(r.get("orderBy"));Vs(y)||(t.orderBy=y),r.get("available")!=null&&(t.available=r.get("available")==="true");const g=r.get("jeopardy");return(g==="1"||g==="true")&&(t.jeopardy=!0),t}function RC(r,t){const s=(i,l)=>Vs(l)?r.delete(i):r.set(i,JSON.stringify(l));s("facets",t.facets),s("block",t.block),s("range",t.range),s("exists",t.exists),s("roles",t.roles),s("orderBy",t.orderBy),t.available==null?r.delete("available"):r.set("available",String(t.available)),t.jeopardy===!0?r.set("jeopardy","1"):r.delete("jeopardy")}const d1=`&status=all&view=table&orderBy=${encodeURIComponent(JSON.stringify([{field:"created_at",direction:"desc"}]))}`;function Kx(r,t){const s={};for(const[l,c]of Object.entries(r))s[l]=typeof c=="object"&&c!==null?JSON.stringify(c):c;const i=encodeURIComponent(JSON.stringify(s));return t?`/escalations/available?role=${encodeURIComponent(t)}&facets=${i}${d1}`:`/escalations/available?facets=${i}${d1}`}function Gj(r,t,s){return Kx({[r]:t},s)}function DC(r){var t,s,i;return Object.keys(r.facets??{}).length+(((t=r.block)==null?void 0:t.length)??0)+(((s=r.range)==null?void 0:s.length)??0)+(((i=r.exists)==null?void 0:i.length)??0)+(r.available!=null?1:0)+(r.jeopardy===!0?1:0)}function Jx(){var s;const{data:r}=Xn(),t=_x();return t!==null?t:!!((s=r==null?void 0:r.features)!=null&&s.scanCodes)}const Xx=A.createContext(null);function Qx(){const r=A.useContext(Xx);if(!r)throw new Error("useScanInput must be used within ScanInputProvider");return r}const Vj="scanPendingAction",Yj="scanChoices",Kj="/scan/station";function Jj({children:r}){const{user:t}=It(),s=Jx(),i=Zi(),{identity:l,prime:c}=Dj(),[d,y]=A.useState(null),[g,f]=A.useState(!1),[m,b]=A.useState(()=>Yx()),[x,v]=A.useState([]),[w,S]=A.useState(!1),C=A.useCallback(M=>{var Z;const{outcome:$}=M;if($===Ie.CONFIRM_REQUIRED&&M.pendingAction)return i(`/escalations/detail/${M.pendingAction.escalationId}`,{state:{[Vj]:M.pendingAction}}),!0;if($===Ie.EXECUTED&&M.escalation){const J=[sc.SHOW_DETAIL,sc.CLAIM_SHOW_DETAIL,sc.CLAIM,sc.ESCALATE];return M.verb&&J.includes(M.verb)?(i(`/escalations/detail/${M.escalation.id}`),!0):!1}if($===Ie.MATCHED_LIST&&M.listQuery){const{targetFacet:J,target:le,roles:ve}=M.listQuery;return i(Kx({[J]:le},(ve==null?void 0:ve[0])??null)),!0}return $===Ie.CHOICES&&M.choices?(i(Kj,{state:{[Yj]:M}}),!0):$===Ie.NO_MATCH_FALLBACK&&((Z=M.fallback)!=null&&Z.route)?(i(M.fallback.route),!0):!1},[i]),L=A.useRef(null);L.current=(l==null?void 0:l.actingToken)??null;const U=A.useRef(null),ne=A.useRef(null),se=A.useCallback(M=>{ne.current=M},[]),D=A.useCallback(async(M,$=h1.MANUAL)=>{var J;if((J=ne.current)!=null&&J.call(ne,M))return;f(!0);const Z=Date.now();try{const le=await Hj(M,{actingToken:L.current??void 0,previousActingToken:U.current??void 0});le.outcome===Ie.IDENTITY_PRIMED&&(U.current=c(le));const ve=C(le);y({code:M,source:$,at:Z,response:le,error:null,navigated:ve})}catch(le){y({code:M,source:$,at:Z,response:null,error:le.message,navigated:!1})}finally{f(!1)}},[C,c]),z=A.useRef(D);z.current=D,$j({active:!!t&&s,wedgeConfig:m,diagnosticsOn:w,onScan:M=>void z.current(M,h1.KEYBOARD_WEDGE),onDiag:M=>v($=>[...$.slice(-29),M])});const ae=A.useCallback(M=>{b(Lj(M))},[]),X=A.useMemo(()=>({submitCode:D,setCodeInterceptor:se,lastResult:d,busy:g,wedgeConfig:m,updateWedgeConfig:ae,diagnostics:x,diagnosticsOn:w,setDiagnosticsOn:S}),[D,se,d,g,m,ae,x,w]);return h.jsx(Xx.Provider,{value:X,children:r})}var ic={},no={},ac={},m1;function Sn(){if(m1)return ac;m1=1,Object.defineProperty(ac,"__esModule",{value:!0});function r(s,i){if(!(s instanceof i))throw new TypeError("Cannot call a class as a function")}var t=function s(i,l){r(this,s),this.data=i,this.text=l.text||i,this.options=l};return ac.default=t,ac}var p1;function Xj(){if(p1)return no;p1=1,Object.defineProperty(no,"__esModule",{value:!0}),no.CODE39=void 0;var r=(function(){function S(C,L){for(var U=0;U<L.length;U++){var ne=L[U];ne.enumerable=ne.enumerable||!1,ne.configurable=!0,"value"in ne&&(ne.writable=!0),Object.defineProperty(C,ne.key,ne)}}return function(C,L,U){return L&&S(C.prototype,L),U&&S(C,U),C}})(),t=Sn(),s=i(t);function i(S){return S&&S.__esModule?S:{default:S}}function l(S,C){if(!(S instanceof C))throw new TypeError("Cannot call a class as a function")}function c(S,C){if(!S)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return C&&(typeof C=="object"||typeof C=="function")?C:S}function d(S,C){if(typeof C!="function"&&C!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof C);S.prototype=Object.create(C&&C.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}}),C&&(Object.setPrototypeOf?Object.setPrototypeOf(S,C):S.__proto__=C)}var y=(function(S){d(C,S);function C(L,U){return l(this,C),L=L.toUpperCase(),U.mod43&&(L+=x(w(L))),c(this,(C.__proto__||Object.getPrototypeOf(C)).call(this,L,U))}return r(C,[{key:"encode",value:function(){for(var U=m("*"),ne=0;ne<this.data.length;ne++)U+=m(this.data[ne])+"0";return U+=m("*"),{data:U,text:this.text}}},{key:"valid",value:function(){return this.data.search(/^[0-9A-Z\-\.\ \$\/\+\%]+$/)!==-1}}]),C})(s.default),g=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","-","."," ","$","/","+","%","*"],f=[20957,29783,23639,30485,20951,29813,23669,20855,29789,23645,29975,23831,30533,22295,30149,24005,21623,29981,23837,22301,30023,23879,30545,22343,30161,24017,21959,30065,23921,22385,29015,18263,29141,17879,29045,18293,17783,29021,18269,17477,17489,17681,20753,35770];function m(S){return b(v(S))}function b(S){return f[S].toString(2)}function x(S){return g[S]}function v(S){return g.indexOf(S)}function w(S){for(var C=0,L=0;L<S.length;L++)C+=v(S[L]);return C=C%43,C}return no.CODE39=y,no}var Gn={},oc={},lc={},pt={},y1;function Oo(){if(y1)return pt;y1=1,Object.defineProperty(pt,"__esModule",{value:!0});var r;function t(g,f,m){return f in g?Object.defineProperty(g,f,{value:m,enumerable:!0,configurable:!0,writable:!0}):g[f]=m,g}var s=pt.SET_A=0,i=pt.SET_B=1,l=pt.SET_C=2;pt.SHIFT=98;var c=pt.START_A=103,d=pt.START_B=104,y=pt.START_C=105;return pt.MODULO=103,pt.STOP=106,pt.FNC1=207,pt.SET_BY_CODE=(r={},t(r,c,s),t(r,d,i),t(r,y,l),r),pt.SWAP={101:s,100:i,99:l},pt.A_START_CHAR="Ð",pt.B_START_CHAR="Ñ",pt.C_START_CHAR="Ò",pt.A_CHARS="[\0-_È-Ï]",pt.B_CHARS="[ -È-Ï]",pt.C_CHARS="(Ï*[0-9]{2}Ï*)",pt.BARS=[11011001100,11001101100,11001100110,10010011e3,10010001100,10001001100,10011001e3,10011000100,10001100100,11001001e3,11001000100,11000100100,10110011100,10011011100,10011001110,10111001100,10011101100,10011100110,11001110010,11001011100,11001001110,11011100100,11001110100,11101101110,11101001100,11100101100,11100100110,11101100100,11100110100,11100110010,11011011e3,11011000110,11000110110,10100011e3,10001011e3,10001000110,10110001e3,10001101e3,10001100010,11010001e3,11000101e3,11000100010,10110111e3,10110001110,10001101110,10111011e3,10111000110,10001110110,11101110110,11010001110,11000101110,11011101e3,11011100010,11011101110,11101011e3,11101000110,11100010110,11101101e3,11101100010,11100011010,11101111010,11001000010,11110001010,1010011e4,10100001100,1001011e4,10010000110,10000101100,10000100110,1011001e4,10110000100,1001101e4,10011000010,10000110100,10000110010,11000010010,1100101e4,11110111010,11000010100,10001111010,10100111100,10010111100,10010011110,10111100100,10011110100,10011110010,11110100100,11110010100,11110010010,11011011110,11011110110,11110110110,10101111e3,10100011110,10001011110,10111101e3,10111100010,11110101e3,11110100010,10111011110,10111101110,11101011110,11110101110,11010000100,1101001e4,11010011100,1100011101011],pt}var g1;function Eu(){if(g1)return lc;g1=1,Object.defineProperty(lc,"__esModule",{value:!0});var r=(function(){function f(m,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(m,v.key,v)}}return function(m,b,x){return b&&f(m.prototype,b),x&&f(m,x),m}})(),t=Sn(),s=l(t),i=Oo();function l(f){return f&&f.__esModule?f:{default:f}}function c(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function d(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:f}function y(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}var g=(function(f){y(m,f);function m(b,x){c(this,m);var v=d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,b.substring(1),x));return v.bytes=b.split("").map(function(w){return w.charCodeAt(0)}),v}return r(m,[{key:"valid",value:function(){return/^[\x00-\x7F\xC8-\xD3]+$/.test(this.data)}},{key:"encode",value:function(){var x=this.bytes,v=x.shift()-105,w=i.SET_BY_CODE[v];if(w===void 0)throw new RangeError("The encoding does not start with a start character.");this.shouldEncodeAsEan128()===!0&&x.unshift(i.FNC1);var S=m.next(x,1,w);return{text:this.text===this.data?this.text.replace(/[^\x20-\x7E]/g,""):this.text,data:m.getBar(v)+S.result+m.getBar((S.checksum+v)%i.MODULO)+m.getBar(i.STOP)}}},{key:"shouldEncodeAsEan128",value:function(){var x=this.options.ean128||!1;return typeof x=="string"&&(x=x.toLowerCase()==="true"),x}}],[{key:"getBar",value:function(x){return i.BARS[x]?i.BARS[x].toString():""}},{key:"correctIndex",value:function(x,v){if(v===i.SET_A){var w=x.shift();return w<32?w+64:w-32}else return v===i.SET_B?x.shift()-32:(x.shift()-48)*10+x.shift()-48}},{key:"next",value:function(x,v,w){if(!x.length)return{result:"",checksum:0};var S=void 0,C=void 0;if(x[0]>=200){C=x.shift()-105;var L=i.SWAP[C];L!==void 0?S=m.next(x,v+1,L):((w===i.SET_A||w===i.SET_B)&&C===i.SHIFT&&(x[0]=w===i.SET_A?x[0]>95?x[0]-96:x[0]:x[0]<32?x[0]+96:x[0]),S=m.next(x,v+1,w))}else C=m.correctIndex(x,w),S=m.next(x,v+1,w);var U=m.getBar(C),ne=C*v;return{result:U+S.result,checksum:ne+S.checksum}}}]),m})(s.default);return lc.default=g,lc}var cc={},b1;function Qj(){if(b1)return cc;b1=1,Object.defineProperty(cc,"__esModule",{value:!0});var r=Oo(),t=function(y){return y.match(new RegExp("^"+r.A_CHARS+"*"))[0].length},s=function(y){return y.match(new RegExp("^"+r.B_CHARS+"*"))[0].length},i=function(y){return y.match(new RegExp("^"+r.C_CHARS+"*"))[0]};function l(d,y){var g=y?r.A_CHARS:r.B_CHARS,f=d.match(new RegExp("^("+g+"+?)(([0-9]{2}){2,})([^0-9]|$)"));if(f)return f[1]+"Ì"+c(d.substring(f[1].length));var m=d.match(new RegExp("^"+g+"+"))[0];return m.length===d.length?d:m+String.fromCharCode(y?205:206)+l(d.substring(m.length),!y)}function c(d){var y=i(d),g=y.length;if(g===d.length)return d;d=d.substring(g);var f=t(d)>=s(d);return y+String.fromCharCode(f?206:205)+l(d,f)}return cc.default=function(d){var y=void 0,g=i(d).length;if(g>=2)y=r.C_START_CHAR+c(d);else{var f=t(d)>s(d);y=(f?r.A_START_CHAR:r.B_START_CHAR)+l(d,f)}return y.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,function(m,b){return"Ë"+b})},cc}var x1;function Zj(){if(x1)return oc;x1=1,Object.defineProperty(oc,"__esModule",{value:!0});var r=Eu(),t=l(r),s=Qj(),i=l(s);function l(f){return f&&f.__esModule?f:{default:f}}function c(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function d(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:f}function y(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}var g=(function(f){y(m,f);function m(b,x){if(c(this,m),/^[\x00-\x7F\xC8-\xD3]+$/.test(b))var v=d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,(0,i.default)(b),x));else var v=d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,b,x));return d(v)}return m})(t.default);return oc.default=g,oc}var uc={},v1;function Wj(){if(v1)return uc;v1=1,Object.defineProperty(uc,"__esModule",{value:!0});var r=(function(){function f(m,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(m,v.key,v)}}return function(m,b,x){return b&&f(m.prototype,b),x&&f(m,x),m}})(),t=Eu(),s=l(t),i=Oo();function l(f){return f&&f.__esModule?f:{default:f}}function c(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function d(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:f}function y(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}var g=(function(f){y(m,f);function m(b,x){return c(this,m),d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,i.A_START_CHAR+b,x))}return r(m,[{key:"valid",value:function(){return new RegExp("^"+i.A_CHARS+"+$").test(this.data)}}]),m})(s.default);return uc.default=g,uc}var fc={},_1;function ek(){if(_1)return fc;_1=1,Object.defineProperty(fc,"__esModule",{value:!0});var r=(function(){function f(m,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(m,v.key,v)}}return function(m,b,x){return b&&f(m.prototype,b),x&&f(m,x),m}})(),t=Eu(),s=l(t),i=Oo();function l(f){return f&&f.__esModule?f:{default:f}}function c(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function d(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:f}function y(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}var g=(function(f){y(m,f);function m(b,x){return c(this,m),d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,i.B_START_CHAR+b,x))}return r(m,[{key:"valid",value:function(){return new RegExp("^"+i.B_CHARS+"+$").test(this.data)}}]),m})(s.default);return fc.default=g,fc}var hc={},w1;function tk(){if(w1)return hc;w1=1,Object.defineProperty(hc,"__esModule",{value:!0});var r=(function(){function f(m,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(m,v.key,v)}}return function(m,b,x){return b&&f(m.prototype,b),x&&f(m,x),m}})(),t=Eu(),s=l(t),i=Oo();function l(f){return f&&f.__esModule?f:{default:f}}function c(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function d(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:f}function y(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}var g=(function(f){y(m,f);function m(b,x){return c(this,m),d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,i.C_START_CHAR+b,x))}return r(m,[{key:"valid",value:function(){return new RegExp("^"+i.C_CHARS+"+$").test(this.data)}}]),m})(s.default);return hc.default=g,hc}var S1;function nk(){if(S1)return Gn;S1=1,Object.defineProperty(Gn,"__esModule",{value:!0}),Gn.CODE128C=Gn.CODE128B=Gn.CODE128A=Gn.CODE128=void 0;var r=Zj(),t=g(r),s=Wj(),i=g(s),l=ek(),c=g(l),d=tk(),y=g(d);function g(f){return f&&f.__esModule?f:{default:f}}return Gn.CODE128=t.default,Gn.CODE128A=i.default,Gn.CODE128B=c.default,Gn.CODE128C=y.default,Gn}var Ft={},dc={},jr={},E1;function Ao(){return E1||(E1=1,Object.defineProperty(jr,"__esModule",{value:!0}),jr.SIDE_BIN="101",jr.MIDDLE_BIN="01010",jr.BINARIES={L:["0001101","0011001","0010011","0111101","0100011","0110001","0101111","0111011","0110111","0001011"],G:["0100111","0110011","0011011","0100001","0011101","0111001","0000101","0010001","0001001","0010111"],R:["1110010","1100110","1101100","1000010","1011100","1001110","1010000","1000100","1001000","1110100"],O:["0001101","0011001","0010011","0111101","0100011","0110001","0101111","0111011","0110111","0001011"],E:["0100111","0110011","0011011","0100001","0011101","0111001","0000101","0010001","0001001","0010111"]},jr.EAN2_STRUCTURE=["LL","LG","GL","GG"],jr.EAN5_STRUCTURE=["GGLLL","GLGLL","GLLGL","GLLLG","LGGLL","LLGGL","LLLGG","LGLGL","LGLLG","LLGLG"],jr.EAN13_STRUCTURE=["LLLLLL","LLGLGG","LLGGLG","LLGGGL","LGLLGG","LGGLLG","LGGGLL","LGLGLG","LGLGGL","LGGLGL"]),jr}var mc={},pc={},O1;function jo(){if(O1)return pc;O1=1,Object.defineProperty(pc,"__esModule",{value:!0});var r=Ao(),t=function(i,l,c){var d=i.split("").map(function(g,f){return r.BINARIES[l[f]]}).map(function(g,f){return g?g[i[f]]:""});if(c){var y=i.length-1;d=d.map(function(g,f){return f<y?g+c:g})}return d.join("")};return pc.default=t,pc}var A1;function Zx(){if(A1)return mc;A1=1,Object.defineProperty(mc,"__esModule",{value:!0});var r=(function(){function b(x,v){for(var w=0;w<v.length;w++){var S=v[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(x,S.key,S)}}return function(x,v,w){return v&&b(x.prototype,v),w&&b(x,w),x}})(),t=Ao(),s=jo(),i=d(s),l=Sn(),c=d(l);function d(b){return b&&b.__esModule?b:{default:b}}function y(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function g(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function f(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var m=(function(b){f(x,b);function x(v,w){y(this,x);var S=g(this,(x.__proto__||Object.getPrototypeOf(x)).call(this,v,w));return S.fontSize=!w.flat&&w.fontSize>w.width*10?w.width*10:w.fontSize,S.guardHeight=w.height+S.fontSize/2+w.textMargin,S}return r(x,[{key:"encode",value:function(){return this.options.flat?this.encodeFlat():this.encodeGuarded()}},{key:"leftText",value:function(w,S){return this.text.substr(w,S)}},{key:"leftEncode",value:function(w,S){return(0,i.default)(w,S)}},{key:"rightText",value:function(w,S){return this.text.substr(w,S)}},{key:"rightEncode",value:function(w,S){return(0,i.default)(w,S)}},{key:"encodeGuarded",value:function(){var w={fontSize:this.fontSize},S={height:this.guardHeight};return[{data:t.SIDE_BIN,options:S},{data:this.leftEncode(),text:this.leftText(),options:w},{data:t.MIDDLE_BIN,options:S},{data:this.rightEncode(),text:this.rightText(),options:w},{data:t.SIDE_BIN,options:S}]}},{key:"encodeFlat",value:function(){var w=[t.SIDE_BIN,this.leftEncode(),t.MIDDLE_BIN,this.rightEncode(),t.SIDE_BIN];return{data:w.join(""),text:this.text}}}]),x})(c.default);return mc.default=m,mc}var j1;function rk(){if(j1)return dc;j1=1,Object.defineProperty(dc,"__esModule",{value:!0});var r=(function(){function b(x,v){for(var w=0;w<v.length;w++){var S=v[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(x,S.key,S)}}return function(x,v,w){return v&&b(x.prototype,v),w&&b(x,w),x}})(),t=function b(x,v,w){x===null&&(x=Function.prototype);var S=Object.getOwnPropertyDescriptor(x,v);if(S===void 0){var C=Object.getPrototypeOf(x);return C===null?void 0:b(C,v,w)}else{if("value"in S)return S.value;var L=S.get;return L===void 0?void 0:L.call(w)}},s=Ao(),i=Zx(),l=c(i);function c(b){return b&&b.__esModule?b:{default:b}}function d(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function y(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function g(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var f=function(x){var v=x.substr(0,12).split("").map(function(w){return+w}).reduce(function(w,S,C){return C%2?w+S*3:w+S},0);return(10-v%10)%10},m=(function(b){g(x,b);function x(v,w){d(this,x),v.search(/^[0-9]{12}$/)!==-1&&(v+=f(v));var S=y(this,(x.__proto__||Object.getPrototypeOf(x)).call(this,v,w));return S.lastChar=w.lastChar,S}return r(x,[{key:"valid",value:function(){return this.data.search(/^[0-9]{13}$/)!==-1&&+this.data[12]===f(this.data)}},{key:"leftText",value:function(){return t(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"leftText",this).call(this,1,6)}},{key:"leftEncode",value:function(){var w=this.data.substr(1,6),S=s.EAN13_STRUCTURE[this.data[0]];return t(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"leftEncode",this).call(this,w,S)}},{key:"rightText",value:function(){return t(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"rightText",this).call(this,7,6)}},{key:"rightEncode",value:function(){var w=this.data.substr(7,6);return t(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"rightEncode",this).call(this,w,"RRRRRR")}},{key:"encodeGuarded",value:function(){var w=t(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"encodeGuarded",this).call(this);return this.options.displayValue&&(w.unshift({data:"000000000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),this.options.lastChar&&(w.push({data:"00"}),w.push({data:"00000",text:this.options.lastChar,options:{fontSize:this.fontSize}}))),w}}]),x})(l.default);return dc.default=m,dc}var yc={},k1;function sk(){if(k1)return yc;k1=1,Object.defineProperty(yc,"__esModule",{value:!0});var r=(function(){function m(b,x){for(var v=0;v<x.length;v++){var w=x[v];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(b,w.key,w)}}return function(b,x,v){return x&&m(b.prototype,x),v&&m(b,v),b}})(),t=function m(b,x,v){b===null&&(b=Function.prototype);var w=Object.getOwnPropertyDescriptor(b,x);if(w===void 0){var S=Object.getPrototypeOf(b);return S===null?void 0:m(S,x,v)}else{if("value"in w)return w.value;var C=w.get;return C===void 0?void 0:C.call(v)}},s=Zx(),i=l(s);function l(m){return m&&m.__esModule?m:{default:m}}function c(m,b){if(!(m instanceof b))throw new TypeError("Cannot call a class as a function")}function d(m,b){if(!m)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return b&&(typeof b=="object"||typeof b=="function")?b:m}function y(m,b){if(typeof b!="function"&&b!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof b);m.prototype=Object.create(b&&b.prototype,{constructor:{value:m,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(m,b):m.__proto__=b)}var g=function(b){var x=b.substr(0,7).split("").map(function(v){return+v}).reduce(function(v,w,S){return S%2?v+w:v+w*3},0);return(10-x%10)%10},f=(function(m){y(b,m);function b(x,v){return c(this,b),x.search(/^[0-9]{7}$/)!==-1&&(x+=g(x)),d(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,x,v))}return r(b,[{key:"valid",value:function(){return this.data.search(/^[0-9]{8}$/)!==-1&&+this.data[7]===g(this.data)}},{key:"leftText",value:function(){return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"leftText",this).call(this,0,4)}},{key:"leftEncode",value:function(){var v=this.data.substr(0,4);return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"leftEncode",this).call(this,v,"LLLL")}},{key:"rightText",value:function(){return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"rightText",this).call(this,4,4)}},{key:"rightEncode",value:function(){var v=this.data.substr(4,4);return t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"rightEncode",this).call(this,v,"RRRR")}}]),b})(i.default);return yc.default=f,yc}var gc={},N1;function ik(){if(N1)return gc;N1=1,Object.defineProperty(gc,"__esModule",{value:!0});var r=(function(){function x(v,w){for(var S=0;S<w.length;S++){var C=w[S];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(v,C.key,C)}}return function(v,w,S){return w&&x(v.prototype,w),S&&x(v,S),v}})(),t=Ao(),s=jo(),i=d(s),l=Sn(),c=d(l);function d(x){return x&&x.__esModule?x:{default:x}}function y(x,v){if(!(x instanceof v))throw new TypeError("Cannot call a class as a function")}function g(x,v){if(!x)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:x}function f(x,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);x.prototype=Object.create(v&&v.prototype,{constructor:{value:x,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(x,v):x.__proto__=v)}var m=function(v){var w=v.split("").map(function(S){return+S}).reduce(function(S,C,L){return L%2?S+C*9:S+C*3},0);return w%10},b=(function(x){f(v,x);function v(w,S){return y(this,v),g(this,(v.__proto__||Object.getPrototypeOf(v)).call(this,w,S))}return r(v,[{key:"valid",value:function(){return this.data.search(/^[0-9]{5}$/)!==-1}},{key:"encode",value:function(){var S=t.EAN5_STRUCTURE[m(this.data)];return{data:"1011"+(0,i.default)(this.data,S,"01"),text:this.text}}}]),v})(c.default);return gc.default=b,gc}var bc={},T1;function ak(){if(T1)return bc;T1=1,Object.defineProperty(bc,"__esModule",{value:!0});var r=(function(){function b(x,v){for(var w=0;w<v.length;w++){var S=v[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(x,S.key,S)}}return function(x,v,w){return v&&b(x.prototype,v),w&&b(x,w),x}})(),t=Ao(),s=jo(),i=d(s),l=Sn(),c=d(l);function d(b){return b&&b.__esModule?b:{default:b}}function y(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function g(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function f(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var m=(function(b){f(x,b);function x(v,w){return y(this,x),g(this,(x.__proto__||Object.getPrototypeOf(x)).call(this,v,w))}return r(x,[{key:"valid",value:function(){return this.data.search(/^[0-9]{2}$/)!==-1}},{key:"encode",value:function(){var w=t.EAN2_STRUCTURE[parseInt(this.data)%4];return{data:"1011"+(0,i.default)(this.data,w,"01"),text:this.text}}}]),x})(c.default);return bc.default=m,bc}var ro={},C1;function Wx(){if(C1)return ro;C1=1,Object.defineProperty(ro,"__esModule",{value:!0});var r=(function(){function b(x,v){for(var w=0;w<v.length;w++){var S=v[w];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(x,S.key,S)}}return function(x,v,w){return v&&b(x.prototype,v),w&&b(x,w),x}})();ro.checksum=m;var t=jo(),s=c(t),i=Sn(),l=c(i);function c(b){return b&&b.__esModule?b:{default:b}}function d(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function y(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function g(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var f=(function(b){g(x,b);function x(v,w){d(this,x),v.search(/^[0-9]{11}$/)!==-1&&(v+=m(v));var S=y(this,(x.__proto__||Object.getPrototypeOf(x)).call(this,v,w));return S.displayValue=w.displayValue,w.fontSize>w.width*10?S.fontSize=w.width*10:S.fontSize=w.fontSize,S.guardHeight=w.height+S.fontSize/2+w.textMargin,S}return r(x,[{key:"valid",value:function(){return this.data.search(/^[0-9]{12}$/)!==-1&&this.data[11]==m(this.data)}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var w="";return w+="101",w+=(0,s.default)(this.data.substr(0,6),"LLLLLL"),w+="01010",w+=(0,s.default)(this.data.substr(6,6),"RRRRRR"),w+="101",{data:w,text:this.text}}},{key:"guardedEncoding",value:function(){var w=[];return this.displayValue&&w.push({data:"00000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),w.push({data:"101"+(0,s.default)(this.data[0],"L"),options:{height:this.guardHeight}}),w.push({data:(0,s.default)(this.data.substr(1,5),"LLLLL"),text:this.text.substr(1,5),options:{fontSize:this.fontSize}}),w.push({data:"01010",options:{height:this.guardHeight}}),w.push({data:(0,s.default)(this.data.substr(6,5),"RRRRR"),text:this.text.substr(6,5),options:{fontSize:this.fontSize}}),w.push({data:(0,s.default)(this.data[11],"R")+"101",options:{height:this.guardHeight}}),this.displayValue&&w.push({data:"00000000",text:this.text.substr(11,1),options:{textAlign:"right",fontSize:this.fontSize}}),w}}]),x})(l.default);function m(b){var x=0,v;for(v=1;v<11;v+=2)x+=parseInt(b[v]);for(v=0;v<11;v+=2)x+=parseInt(b[v])*3;return(10-x%10)%10}return ro.default=f,ro}var xc={},M1;function ok(){if(M1)return xc;M1=1,Object.defineProperty(xc,"__esModule",{value:!0});var r=(function(){function w(S,C){for(var L=0;L<C.length;L++){var U=C[L];U.enumerable=U.enumerable||!1,U.configurable=!0,"value"in U&&(U.writable=!0),Object.defineProperty(S,U.key,U)}}return function(S,C,L){return C&&w(S.prototype,C),L&&w(S,L),S}})(),t=jo(),s=d(t),i=Sn(),l=d(i),c=Wx();function d(w){return w&&w.__esModule?w:{default:w}}function y(w,S){if(!(w instanceof S))throw new TypeError("Cannot call a class as a function")}function g(w,S){if(!w)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return S&&(typeof S=="object"||typeof S=="function")?S:w}function f(w,S){if(typeof S!="function"&&S!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof S);w.prototype=Object.create(S&&S.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),S&&(Object.setPrototypeOf?Object.setPrototypeOf(w,S):w.__proto__=S)}var m=["XX00000XXX","XX10000XXX","XX20000XXX","XXX00000XX","XXXX00000X","XXXXX00005","XXXXX00006","XXXXX00007","XXXXX00008","XXXXX00009"],b=[["EEEOOO","OOOEEE"],["EEOEOO","OOEOEE"],["EEOOEO","OOEEOE"],["EEOOOE","OOEEEO"],["EOEEOO","OEOOEE"],["EOOEEO","OEEOOE"],["EOOOEE","OEEEOO"],["EOEOEO","OEOEOE"],["EOEOOE","OEOEEO"],["EOOEOE","OEEOEO"]],x=(function(w){f(S,w);function S(C,L){y(this,S);var U=g(this,(S.__proto__||Object.getPrototypeOf(S)).call(this,C,L));if(U.isValid=!1,C.search(/^[0-9]{6}$/)!==-1)U.middleDigits=C,U.upcA=v(C,"0"),U.text=L.text||""+U.upcA[0]+C+U.upcA[U.upcA.length-1],U.isValid=!0;else if(C.search(/^[01][0-9]{7}$/)!==-1)if(U.middleDigits=C.substring(1,C.length-1),U.upcA=v(U.middleDigits,C[0]),U.upcA[U.upcA.length-1]===C[C.length-1])U.isValid=!0;else return g(U);else return g(U);return U.displayValue=L.displayValue,L.fontSize>L.width*10?U.fontSize=L.width*10:U.fontSize=L.fontSize,U.guardHeight=L.height+U.fontSize/2+L.textMargin,U}return r(S,[{key:"valid",value:function(){return this.isValid}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var L="";return L+="101",L+=this.encodeMiddleDigits(),L+="010101",{data:L,text:this.text}}},{key:"guardedEncoding",value:function(){var L=[];return this.displayValue&&L.push({data:"00000000",text:this.text[0],options:{textAlign:"left",fontSize:this.fontSize}}),L.push({data:"101",options:{height:this.guardHeight}}),L.push({data:this.encodeMiddleDigits(),text:this.text.substring(1,7),options:{fontSize:this.fontSize}}),L.push({data:"010101",options:{height:this.guardHeight}}),this.displayValue&&L.push({data:"00000000",text:this.text[7],options:{textAlign:"right",fontSize:this.fontSize}}),L}},{key:"encodeMiddleDigits",value:function(){var L=this.upcA[0],U=this.upcA[this.upcA.length-1],ne=b[parseInt(U)][parseInt(L)];return(0,s.default)(this.middleDigits,ne)}}]),S})(l.default);function v(w,S){for(var C=parseInt(w[w.length-1]),L=m[C],U="",ne=0,se=0;se<L.length;se++){var D=L[se];D==="X"?U+=w[ne++]:U+=D}return U=""+S+U,""+U+(0,c.checksum)(U)}return xc.default=x,xc}var R1;function lk(){if(R1)return Ft;R1=1,Object.defineProperty(Ft,"__esModule",{value:!0}),Ft.UPCE=Ft.UPC=Ft.EAN2=Ft.EAN5=Ft.EAN8=Ft.EAN13=void 0;var r=rk(),t=x(r),s=sk(),i=x(s),l=ik(),c=x(l),d=ak(),y=x(d),g=Wx(),f=x(g),m=ok(),b=x(m);function x(v){return v&&v.__esModule?v:{default:v}}return Ft.EAN13=t.default,Ft.EAN8=i.default,Ft.EAN5=c.default,Ft.EAN2=y.default,Ft.UPC=f.default,Ft.UPCE=b.default,Ft}var Hs={},vc={},Ui={},D1;function ck(){return D1||(D1=1,Object.defineProperty(Ui,"__esModule",{value:!0}),Ui.START_BIN="1010",Ui.END_BIN="11101",Ui.BINARIES=["00110","10001","01001","11000","00101","10100","01100","00011","10010","01010"]),Ui}var q1;function ev(){if(q1)return vc;q1=1,Object.defineProperty(vc,"__esModule",{value:!0});var r=(function(){function f(m,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(m,v.key,v)}}return function(m,b,x){return b&&f(m.prototype,b),x&&f(m,x),m}})(),t=ck(),s=Sn(),i=l(s);function l(f){return f&&f.__esModule?f:{default:f}}function c(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function d(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:f}function y(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}var g=(function(f){y(m,f);function m(){return c(this,m),d(this,(m.__proto__||Object.getPrototypeOf(m)).apply(this,arguments))}return r(m,[{key:"valid",value:function(){return this.data.search(/^([0-9]{2})+$/)!==-1}},{key:"encode",value:function(){var x=this,v=this.data.match(/.{2}/g).map(function(w){return x.encodePair(w)}).join("");return{data:t.START_BIN+v+t.END_BIN,text:this.text}}},{key:"encodePair",value:function(x){var v=t.BINARIES[x[1]];return t.BINARIES[x[0]].split("").map(function(w,S){return(w==="1"?"111":"1")+(v[S]==="1"?"000":"0")}).join("")}}]),m})(i.default);return vc.default=g,vc}var _c={},L1;function uk(){if(L1)return _c;L1=1,Object.defineProperty(_c,"__esModule",{value:!0});var r=(function(){function f(m,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(m,v.key,v)}}return function(m,b,x){return b&&f(m.prototype,b),x&&f(m,x),m}})(),t=ev(),s=i(t);function i(f){return f&&f.__esModule?f:{default:f}}function l(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function c(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:f}function d(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}var y=function(m){var b=m.substr(0,13).split("").map(function(x){return parseInt(x,10)}).reduce(function(x,v,w){return x+v*(3-w%2*2)},0);return Math.ceil(b/10)*10-b},g=(function(f){d(m,f);function m(b,x){return l(this,m),b.search(/^[0-9]{13}$/)!==-1&&(b+=y(b)),c(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,b,x))}return r(m,[{key:"valid",value:function(){return this.data.search(/^[0-9]{14}$/)!==-1&&+this.data[13]===y(this.data)}}]),m})(s.default);return _c.default=g,_c}var B1;function fk(){if(B1)return Hs;B1=1,Object.defineProperty(Hs,"__esModule",{value:!0}),Hs.ITF14=Hs.ITF=void 0;var r=ev(),t=l(r),s=uk(),i=l(s);function l(c){return c&&c.__esModule?c:{default:c}}return Hs.ITF=t.default,Hs.ITF14=i.default,Hs}var dn={},wc={},U1;function ko(){if(U1)return wc;U1=1,Object.defineProperty(wc,"__esModule",{value:!0});var r=(function(){function f(m,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(m,v.key,v)}}return function(m,b,x){return b&&f(m.prototype,b),x&&f(m,x),m}})(),t=Sn(),s=i(t);function i(f){return f&&f.__esModule?f:{default:f}}function l(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function c(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:f}function d(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}var y=(function(f){d(m,f);function m(b,x){return l(this,m),c(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,b,x))}return r(m,[{key:"encode",value:function(){for(var x="110",v=0;v<this.data.length;v++){var w=parseInt(this.data[v]),S=w.toString(2);S=g(S,4-S.length);for(var C=0;C<S.length;C++)x+=S[C]=="0"?"100":"110"}return x+="1001",{data:x,text:this.text}}},{key:"valid",value:function(){return this.data.search(/^[0-9]+$/)!==-1}}]),m})(s.default);function g(f,m){for(var b=0;b<m;b++)f="0"+f;return f}return wc.default=y,wc}var Sc={},so={},P1;function Ou(){if(P1)return so;P1=1,Object.defineProperty(so,"__esModule",{value:!0}),so.mod10=r,so.mod11=t;function r(s){for(var i=0,l=0;l<s.length;l++){var c=parseInt(s[l]);(l+s.length)%2===0?i+=c:i+=c*2%10+Math.floor(c*2/10)}return(10-i%10)%10}function t(s){for(var i=0,l=[2,3,4,5,6,7],c=0;c<s.length;c++){var d=parseInt(s[s.length-1-c]);i+=l[c%l.length]*d}return(11-i%11)%11}return so}var z1;function hk(){if(z1)return Sc;z1=1,Object.defineProperty(Sc,"__esModule",{value:!0});var r=ko(),t=i(r),s=Ou();function i(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function d(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var y=(function(g){d(f,g);function f(m,b){return l(this,f),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,m+(0,s.mod10)(m),b))}return f})(t.default);return Sc.default=y,Sc}var Ec={},I1;function dk(){if(I1)return Ec;I1=1,Object.defineProperty(Ec,"__esModule",{value:!0});var r=ko(),t=i(r),s=Ou();function i(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function d(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var y=(function(g){d(f,g);function f(m,b){return l(this,f),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,m+(0,s.mod11)(m),b))}return f})(t.default);return Ec.default=y,Ec}var Oc={},$1;function mk(){if($1)return Oc;$1=1,Object.defineProperty(Oc,"__esModule",{value:!0});var r=ko(),t=i(r),s=Ou();function i(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function d(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var y=(function(g){d(f,g);function f(m,b){return l(this,f),m+=(0,s.mod10)(m),m+=(0,s.mod10)(m),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,m,b))}return f})(t.default);return Oc.default=y,Oc}var Ac={},H1;function pk(){if(H1)return Ac;H1=1,Object.defineProperty(Ac,"__esModule",{value:!0});var r=ko(),t=i(r),s=Ou();function i(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function d(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var y=(function(g){d(f,g);function f(m,b){return l(this,f),m+=(0,s.mod11)(m),m+=(0,s.mod10)(m),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,m,b))}return f})(t.default);return Ac.default=y,Ac}var F1;function yk(){if(F1)return dn;F1=1,Object.defineProperty(dn,"__esModule",{value:!0}),dn.MSI1110=dn.MSI1010=dn.MSI11=dn.MSI10=dn.MSI=void 0;var r=ko(),t=m(r),s=hk(),i=m(s),l=dk(),c=m(l),d=mk(),y=m(d),g=pk(),f=m(g);function m(b){return b&&b.__esModule?b:{default:b}}return dn.MSI=t.default,dn.MSI10=i.default,dn.MSI11=c.default,dn.MSI1010=y.default,dn.MSI1110=f.default,dn}var io={},G1;function gk(){if(G1)return io;G1=1,Object.defineProperty(io,"__esModule",{value:!0}),io.pharmacode=void 0;var r=(function(){function g(f,m){for(var b=0;b<m.length;b++){var x=m[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(f,x.key,x)}}return function(f,m,b){return m&&g(f.prototype,m),b&&g(f,b),f}})(),t=Sn(),s=i(t);function i(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function d(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var y=(function(g){d(f,g);function f(m,b){l(this,f);var x=c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,m,b));return x.number=parseInt(m,10),x}return r(f,[{key:"encode",value:function(){for(var b=this.number,x="";!isNaN(b)&&b!=0;)b%2===0?(x="11100"+x,b=(b-2)/2):(x="100"+x,b=(b-1)/2);return x=x.slice(0,-2),{data:x,text:this.text}}},{key:"valid",value:function(){return this.number>=3&&this.number<=131070}}]),f})(s.default);return io.pharmacode=y,io}var ao={},V1;function bk(){if(V1)return ao;V1=1,Object.defineProperty(ao,"__esModule",{value:!0}),ao.codabar=void 0;var r=(function(){function g(f,m){for(var b=0;b<m.length;b++){var x=m[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(f,x.key,x)}}return function(f,m,b){return m&&g(f.prototype,m),b&&g(f,b),f}})(),t=Sn(),s=i(t);function i(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function d(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var y=(function(g){d(f,g);function f(m,b){l(this,f),m.search(/^[0-9\-\$\:\.\+\/]+$/)===0&&(m="A"+m+"A");var x=c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,m.toUpperCase(),b));return x.text=x.options.text||x.text.replace(/[A-D]/g,""),x}return r(f,[{key:"valid",value:function(){return this.data.search(/^[A-D][0-9\-\$\:\.\+\/]+[A-D]$/)!==-1}},{key:"encode",value:function(){for(var b=[],x=this.getEncodings(),v=0;v<this.data.length;v++)b.push(x[this.data.charAt(v)]),v!==this.data.length-1&&b.push("0");return{text:this.text,data:b.join("")}}},{key:"getEncodings",value:function(){return{0:"101010011",1:"101011001",2:"101001011",3:"110010101",4:"101101001",5:"110101001",6:"100101011",7:"100101101",8:"100110101",9:"110100101","-":"101001101",$:"101100101",":":"1101011011","/":"1101101011",".":"1101101101","+":"1011011011",A:"1011001001",B:"1001001011",C:"1010010011",D:"1010011001"}}}]),f})(s.default);return ao.codabar=y,ao}var Fs={},jc={},Pi={},Y1;function xk(){return Y1||(Y1=1,Object.defineProperty(Pi,"__esModule",{value:!0}),Pi.SYMBOLS=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","-","."," ","$","/","+","%","($)","(%)","(/)","(+)","ÿ"],Pi.BINARIES=["100010100","101001000","101000100","101000010","100101000","100100100","100100010","101010000","100010010","100001010","110101000","110100100","110100010","110010100","110010010","110001010","101101000","101100100","101100010","100110100","100011010","101011000","101001100","101000110","100101100","100010110","110110100","110110010","110101100","110100110","110010110","110011010","101101100","101100110","100110110","100111010","100101110","111010100","111010010","111001010","101101110","101110110","110101110","100100110","111011010","111010110","100110010","101011110"],Pi.MULTI_SYMBOLS={"\0":["(%)","U"],"":["($)","A"],"":["($)","B"],"":["($)","C"],"":["($)","D"],"":["($)","E"],"":["($)","F"],"\x07":["($)","G"],"\b":["($)","H"]," ":["($)","I"],"\n":["($)","J"],"\v":["($)","K"],"\f":["($)","L"],"\r":["($)","M"],"":["($)","N"],"":["($)","O"],"":["($)","P"],"":["($)","Q"],"":["($)","R"],"":["($)","S"],"":["($)","T"],"":["($)","U"],"":["($)","V"],"":["($)","W"],"":["($)","X"],"":["($)","Y"],"":["($)","Z"],"\x1B":["(%)","A"],"":["(%)","B"],"":["(%)","C"],"":["(%)","D"],"":["(%)","E"],"!":["(/)","A"],'"':["(/)","B"],"#":["(/)","C"],"&":["(/)","F"],"'":["(/)","G"],"(":["(/)","H"],")":["(/)","I"],"*":["(/)","J"],",":["(/)","L"],":":["(/)","Z"],";":["(%)","F"],"<":["(%)","G"],"=":["(%)","H"],">":["(%)","I"],"?":["(%)","J"],"@":["(%)","V"],"[":["(%)","K"],"\\":["(%)","L"],"]":["(%)","M"],"^":["(%)","N"],_:["(%)","O"],"`":["(%)","W"],a:["(+)","A"],b:["(+)","B"],c:["(+)","C"],d:["(+)","D"],e:["(+)","E"],f:["(+)","F"],g:["(+)","G"],h:["(+)","H"],i:["(+)","I"],j:["(+)","J"],k:["(+)","K"],l:["(+)","L"],m:["(+)","M"],n:["(+)","N"],o:["(+)","O"],p:["(+)","P"],q:["(+)","Q"],r:["(+)","R"],s:["(+)","S"],t:["(+)","T"],u:["(+)","U"],v:["(+)","V"],w:["(+)","W"],x:["(+)","X"],y:["(+)","Y"],z:["(+)","Z"],"{":["(%)","P"],"|":["(%)","Q"],"}":["(%)","R"],"~":["(%)","S"],"":["(%)","T"]}),Pi}var K1;function tv(){if(K1)return jc;K1=1,Object.defineProperty(jc,"__esModule",{value:!0});var r=(function(){function f(m,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(m,v.key,v)}}return function(m,b,x){return b&&f(m.prototype,b),x&&f(m,x),m}})(),t=xk(),s=Sn(),i=l(s);function l(f){return f&&f.__esModule?f:{default:f}}function c(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}function d(f,m){if(!f)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:f}function y(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);f.prototype=Object.create(m&&m.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(f,m):f.__proto__=m)}var g=(function(f){y(m,f);function m(b,x){return c(this,m),d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,b,x))}return r(m,[{key:"valid",value:function(){return/^[0-9A-Z\-. $/+%]+$/.test(this.data)}},{key:"encode",value:function(){var x=this.data.split("").flatMap(function(C){return t.MULTI_SYMBOLS[C]||C}),v=x.map(function(C){return m.getEncoding(C)}).join(""),w=m.checksum(x,20),S=m.checksum(x.concat(w),15);return{text:this.text,data:m.getEncoding("ÿ")+v+m.getEncoding(w)+m.getEncoding(S)+m.getEncoding("ÿ")+"1"}}}],[{key:"getEncoding",value:function(x){return t.BINARIES[m.symbolValue(x)]}},{key:"getSymbol",value:function(x){return t.SYMBOLS[x]}},{key:"symbolValue",value:function(x){return t.SYMBOLS.indexOf(x)}},{key:"checksum",value:function(x,v){var w=x.slice().reverse().reduce(function(S,C,L){var U=L%v+1;return S+m.symbolValue(C)*U},0);return m.getSymbol(w%47)}}]),m})(i.default);return jc.default=g,jc}var kc={},J1;function vk(){if(J1)return kc;J1=1,Object.defineProperty(kc,"__esModule",{value:!0});var r=(function(){function g(f,m){for(var b=0;b<m.length;b++){var x=m[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(f,x.key,x)}}return function(f,m,b){return m&&g(f.prototype,m),b&&g(f,b),f}})(),t=tv(),s=i(t);function i(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function d(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var y=(function(g){d(f,g);function f(m,b){return l(this,f),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,m,b))}return r(f,[{key:"valid",value:function(){return/^[\x00-\x7f]+$/.test(this.data)}}]),f})(s.default);return kc.default=y,kc}var X1;function _k(){if(X1)return Fs;X1=1,Object.defineProperty(Fs,"__esModule",{value:!0}),Fs.CODE93FullASCII=Fs.CODE93=void 0;var r=tv(),t=l(r),s=vk(),i=l(s);function l(c){return c&&c.__esModule?c:{default:c}}return Fs.CODE93=t.default,Fs.CODE93FullASCII=i.default,Fs}var oo={},Q1;function wk(){if(Q1)return oo;Q1=1,Object.defineProperty(oo,"__esModule",{value:!0}),oo.GenericBarcode=void 0;var r=(function(){function g(f,m){for(var b=0;b<m.length;b++){var x=m[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(f,x.key,x)}}return function(f,m,b){return m&&g(f.prototype,m),b&&g(f,b),f}})(),t=Sn(),s=i(t);function i(g){return g&&g.__esModule?g:{default:g}}function l(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}function c(g,f){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:g}function d(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);g.prototype=Object.create(f&&f.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(g,f):g.__proto__=f)}var y=(function(g){d(f,g);function f(m,b){return l(this,f),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,m,b))}return r(f,[{key:"encode",value:function(){return{data:"10101010101010101010101010101010101010101",text:this.text}}},{key:"valid",value:function(){return!0}}]),f})(s.default);return oo.GenericBarcode=y,oo}var Z1;function Sk(){if(Z1)return ic;Z1=1,Object.defineProperty(ic,"__esModule",{value:!0});var r=Xj(),t=nk(),s=lk(),i=fk(),l=yk(),c=gk(),d=bk(),y=_k(),g=wk();return ic.default={CODE39:r.CODE39,CODE128:t.CODE128,CODE128A:t.CODE128A,CODE128B:t.CODE128B,CODE128C:t.CODE128C,EAN13:s.EAN13,EAN8:s.EAN8,EAN5:s.EAN5,EAN2:s.EAN2,UPC:s.UPC,UPCE:s.UPCE,ITF14:i.ITF14,ITF:i.ITF,MSI:l.MSI,MSI10:l.MSI10,MSI11:l.MSI11,MSI1010:l.MSI1010,MSI1110:l.MSI1110,pharmacode:c.pharmacode,codabar:d.codabar,CODE93:y.CODE93,CODE93FullASCII:y.CODE93FullASCII,GenericBarcode:g.GenericBarcode},ic}var Nc={},W1;function Au(){if(W1)return Nc;W1=1,Object.defineProperty(Nc,"__esModule",{value:!0});var r=Object.assign||function(t){for(var s=1;s<arguments.length;s++){var i=arguments[s];for(var l in i)Object.prototype.hasOwnProperty.call(i,l)&&(t[l]=i[l])}return t};return Nc.default=function(t,s){return r({},t,s)},Nc}var Tc={},eb;function Ek(){if(eb)return Tc;eb=1,Object.defineProperty(Tc,"__esModule",{value:!0}),Tc.default=r;function r(t){var s=[];function i(l){if(Array.isArray(l))for(var c=0;c<l.length;c++)i(l[c]);else l.text=l.text||"",l.data=l.data||"",s.push(l)}return i(t),s}return Tc}var Cc={},tb;function Ok(){if(tb)return Cc;tb=1,Object.defineProperty(Cc,"__esModule",{value:!0}),Cc.default=r;function r(t){return t.marginTop=t.marginTop||t.margin,t.marginBottom=t.marginBottom||t.margin,t.marginRight=t.marginRight||t.margin,t.marginLeft=t.marginLeft||t.margin,t}return Cc}var Mc={},Rc={},Dc={},nb;function nv(){if(nb)return Dc;nb=1,Object.defineProperty(Dc,"__esModule",{value:!0}),Dc.default=r;function r(t){var s=["width","height","textMargin","fontSize","margin","marginTop","marginBottom","marginLeft","marginRight"];for(var i in s)s.hasOwnProperty(i)&&(i=s[i],typeof t[i]=="string"&&(t[i]=parseInt(t[i],10)));return typeof t.displayValue=="string"&&(t.displayValue=t.displayValue!="false"),t}return Dc}var qc={},rb;function rv(){if(rb)return qc;rb=1,Object.defineProperty(qc,"__esModule",{value:!0});var r={width:2,height:100,format:"auto",displayValue:!0,fontOptions:"",font:"monospace",text:void 0,textAlign:"center",textPosition:"bottom",textMargin:2,fontSize:20,background:"#ffffff",lineColor:"#000000",margin:10,marginTop:void 0,marginBottom:void 0,marginLeft:void 0,marginRight:void 0,valid:function(){}};return qc.default=r,qc}var sb;function Ak(){if(sb)return Rc;sb=1,Object.defineProperty(Rc,"__esModule",{value:!0});var r=nv(),t=l(r),s=rv(),i=l(s);function l(d){return d&&d.__esModule?d:{default:d}}function c(d){var y={};for(var g in i.default)i.default.hasOwnProperty(g)&&(d.hasAttribute("jsbarcode-"+g.toLowerCase())&&(y[g]=d.getAttribute("jsbarcode-"+g.toLowerCase())),d.hasAttribute("data-"+g.toLowerCase())&&(y[g]=d.getAttribute("data-"+g.toLowerCase())));return y.value=d.getAttribute("jsbarcode-value")||d.getAttribute("data-value"),y=(0,t.default)(y),y}return Rc.default=c,Rc}var Lc={},Bc={},mn={},ib;function sv(){if(ib)return mn;ib=1,Object.defineProperty(mn,"__esModule",{value:!0}),mn.getTotalWidthOfEncodings=mn.calculateEncodingAttributes=mn.getBarcodePadding=mn.getEncodingHeight=mn.getMaximumHeightOfEncodings=void 0;var r=Au(),t=s(r);function s(f){return f&&f.__esModule?f:{default:f}}function i(f,m){return m.height+(m.displayValue&&f.text.length>0?m.fontSize+m.textMargin:0)+m.marginTop+m.marginBottom}function l(f,m,b){if(b.displayValue&&m<f){if(b.textAlign=="center")return Math.floor((f-m)/2);if(b.textAlign=="left")return 0;if(b.textAlign=="right")return Math.floor(f-m)}return 0}function c(f,m,b){for(var x=0;x<f.length;x++){var v=f[x],w=(0,t.default)(m,v.options),S;w.displayValue?S=g(v.text,w,b):S=0;var C=v.data.length*w.width;v.width=Math.ceil(Math.max(S,C)),v.height=i(v,w),v.barcodePadding=l(S,C,w)}}function d(f){for(var m=0,b=0;b<f.length;b++)m+=f[b].width;return m}function y(f){for(var m=0,b=0;b<f.length;b++)f[b].height>m&&(m=f[b].height);return m}function g(f,m,b){var x;if(b)x=b;else if(typeof document<"u")x=document.createElement("canvas").getContext("2d");else return 0;x.font=m.fontOptions+" "+m.fontSize+"px "+m.font;var v=x.measureText(f);if(!v)return 0;var w=v.width;return w}return mn.getMaximumHeightOfEncodings=y,mn.getEncodingHeight=i,mn.getBarcodePadding=l,mn.calculateEncodingAttributes=c,mn.getTotalWidthOfEncodings=d,mn}var ab;function jk(){if(ab)return Bc;ab=1,Object.defineProperty(Bc,"__esModule",{value:!0});var r=(function(){function y(g,f){for(var m=0;m<f.length;m++){var b=f[m];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(g,b.key,b)}}return function(g,f,m){return f&&y(g.prototype,f),m&&y(g,m),g}})(),t=Au(),s=l(t),i=sv();function l(y){return y&&y.__esModule?y:{default:y}}function c(y,g){if(!(y instanceof g))throw new TypeError("Cannot call a class as a function")}var d=(function(){function y(g,f,m){c(this,y),this.canvas=g,this.encodings=f,this.options=m}return r(y,[{key:"render",value:function(){if(!this.canvas.getContext)throw new Error("The browser does not support canvas.");this.prepareCanvas();for(var f=0;f<this.encodings.length;f++){var m=(0,s.default)(this.options,this.encodings[f].options);this.drawCanvasBarcode(m,this.encodings[f]),this.drawCanvasText(m,this.encodings[f]),this.moveCanvasDrawing(this.encodings[f])}this.restoreCanvas()}},{key:"prepareCanvas",value:function(){var f=this.canvas.getContext("2d");f.save(),(0,i.calculateEncodingAttributes)(this.encodings,this.options,f);var m=(0,i.getTotalWidthOfEncodings)(this.encodings),b=(0,i.getMaximumHeightOfEncodings)(this.encodings);this.canvas.width=m+this.options.marginLeft+this.options.marginRight,this.canvas.height=b,f.clearRect(0,0,this.canvas.width,this.canvas.height),this.options.background&&(f.fillStyle=this.options.background,f.fillRect(0,0,this.canvas.width,this.canvas.height)),f.translate(this.options.marginLeft,0)}},{key:"drawCanvasBarcode",value:function(f,m){var b=this.canvas.getContext("2d"),x=m.data,v;f.textPosition=="top"?v=f.marginTop+f.fontSize+f.textMargin:v=f.marginTop,b.fillStyle=f.lineColor;for(var w=0;w<x.length;w++){var S=w*f.width+m.barcodePadding;x[w]==="1"?b.fillRect(S,v,f.width,f.height):x[w]&&b.fillRect(S,v,f.width,f.height*x[w])}}},{key:"drawCanvasText",value:function(f,m){var b=this.canvas.getContext("2d"),x=f.fontOptions+" "+f.fontSize+"px "+f.font;if(f.displayValue){var v,w;f.textPosition=="top"?w=f.marginTop+f.fontSize-f.textMargin:w=f.height+f.textMargin+f.marginTop+f.fontSize,b.font=x,f.textAlign=="left"||m.barcodePadding>0?(v=0,b.textAlign="left"):f.textAlign=="right"?(v=m.width-1,b.textAlign="right"):(v=m.width/2,b.textAlign="center"),b.fillText(m.text,v,w)}}},{key:"moveCanvasDrawing",value:function(f){var m=this.canvas.getContext("2d");m.translate(f.width,0)}},{key:"restoreCanvas",value:function(){var f=this.canvas.getContext("2d");f.restore()}}]),y})();return Bc.default=d,Bc}var Uc={},ob;function kk(){if(ob)return Uc;ob=1,Object.defineProperty(Uc,"__esModule",{value:!0});var r=(function(){function g(f,m){for(var b=0;b<m.length;b++){var x=m[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(f,x.key,x)}}return function(f,m,b){return m&&g(f.prototype,m),b&&g(f,b),f}})(),t=Au(),s=l(t),i=sv();function l(g){return g&&g.__esModule?g:{default:g}}function c(g,f){if(!(g instanceof f))throw new TypeError("Cannot call a class as a function")}var d="http://www.w3.org/2000/svg",y=(function(){function g(f,m,b){c(this,g),this.svg=f,this.encodings=m,this.options=b,this.document=b.xmlDocument||document}return r(g,[{key:"render",value:function(){var m=this.options.marginLeft;this.prepareSVG();for(var b=0;b<this.encodings.length;b++){var x=this.encodings[b],v=(0,s.default)(this.options,x.options),w=this.createGroup(m,v.marginTop,this.svg);this.setGroupOptions(w,v),this.drawSvgBarcode(w,v,x),this.drawSVGText(w,v,x),m+=x.width}}},{key:"prepareSVG",value:function(){for(;this.svg.firstChild;)this.svg.removeChild(this.svg.firstChild);(0,i.calculateEncodingAttributes)(this.encodings,this.options);var m=(0,i.getTotalWidthOfEncodings)(this.encodings),b=(0,i.getMaximumHeightOfEncodings)(this.encodings),x=m+this.options.marginLeft+this.options.marginRight;this.setSvgAttributes(x,b),this.options.background&&this.drawRect(0,0,x,b,this.svg).setAttribute("fill",this.options.background)}},{key:"drawSvgBarcode",value:function(m,b,x){var v=x.data,w;b.textPosition=="top"?w=b.fontSize+b.textMargin:w=0;for(var S=0,C=0,L=0;L<v.length;L++)C=L*b.width+x.barcodePadding,v[L]==="1"?S++:S>0&&(this.drawRect(C-b.width*S,w,b.width*S,b.height,m),S=0);S>0&&this.drawRect(C-b.width*(S-1),w,b.width*S,b.height,m)}},{key:"drawSVGText",value:function(m,b,x){var v=this.document.createElementNS(d,"text");if(b.displayValue){var w,S;v.setAttribute("font-family",b.font),v.setAttribute("font-size",b.fontSize),b.fontOptions.includes("bold")&&v.setAttribute("font-weight","bold"),b.fontOptions.includes("italic")&&v.setAttribute("font-style","italic"),b.textPosition=="top"?S=b.fontSize-b.textMargin:S=b.height+b.textMargin+b.fontSize,b.textAlign=="left"||x.barcodePadding>0?(w=0,v.setAttribute("text-anchor","start")):b.textAlign=="right"?(w=x.width-1,v.setAttribute("text-anchor","end")):(w=x.width/2,v.setAttribute("text-anchor","middle")),v.setAttribute("x",w),v.setAttribute("y",S),v.appendChild(this.document.createTextNode(x.text)),m.appendChild(v)}}},{key:"setSvgAttributes",value:function(m,b){var x=this.svg;x.setAttribute("width",m+"px"),x.setAttribute("height",b+"px"),x.setAttribute("x","0px"),x.setAttribute("y","0px"),x.setAttribute("viewBox","0 0 "+m+" "+b),x.setAttribute("xmlns",d),x.setAttribute("version","1.1")}},{key:"createGroup",value:function(m,b,x){var v=this.document.createElementNS(d,"g");return v.setAttribute("transform","translate("+m+", "+b+")"),x.appendChild(v),v}},{key:"setGroupOptions",value:function(m,b){m.setAttribute("fill",b.lineColor)}},{key:"drawRect",value:function(m,b,x,v,w){var S=this.document.createElementNS(d,"rect");return S.setAttribute("x",m),S.setAttribute("y",b),S.setAttribute("width",x),S.setAttribute("height",v),w.appendChild(S),S}}]),g})();return Uc.default=y,Uc}var Pc={},lb;function Nk(){if(lb)return Pc;lb=1,Object.defineProperty(Pc,"__esModule",{value:!0});var r=(function(){function i(l,c){for(var d=0;d<c.length;d++){var y=c[d];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(l,y.key,y)}}return function(l,c,d){return c&&i(l.prototype,c),d&&i(l,d),l}})();function t(i,l){if(!(i instanceof l))throw new TypeError("Cannot call a class as a function")}var s=(function(){function i(l,c,d){t(this,i),this.object=l,this.encodings=c,this.options=d}return r(i,[{key:"render",value:function(){this.object.encodings=this.encodings}}]),i})();return Pc.default=s,Pc}var cb;function Tk(){if(cb)return Lc;cb=1,Object.defineProperty(Lc,"__esModule",{value:!0});var r=jk(),t=d(r),s=kk(),i=d(s),l=Nk(),c=d(l);function d(y){return y&&y.__esModule?y:{default:y}}return Lc.default={CanvasRenderer:t.default,SVGRenderer:i.default,ObjectRenderer:c.default},Lc}var zi={},ub;function iv(){if(ub)return zi;ub=1,Object.defineProperty(zi,"__esModule",{value:!0});function r(d,y){if(!(d instanceof y))throw new TypeError("Cannot call a class as a function")}function t(d,y){if(!d)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return y&&(typeof y=="object"||typeof y=="function")?y:d}function s(d,y){if(typeof y!="function"&&y!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof y);d.prototype=Object.create(y&&y.prototype,{constructor:{value:d,enumerable:!1,writable:!0,configurable:!0}}),y&&(Object.setPrototypeOf?Object.setPrototypeOf(d,y):d.__proto__=y)}var i=(function(d){s(y,d);function y(g,f){r(this,y);var m=t(this,(y.__proto__||Object.getPrototypeOf(y)).call(this));return m.name="InvalidInputException",m.symbology=g,m.input=f,m.message='"'+m.input+'" is not a valid input for '+m.symbology,m}return y})(Error),l=(function(d){s(y,d);function y(){r(this,y);var g=t(this,(y.__proto__||Object.getPrototypeOf(y)).call(this));return g.name="InvalidElementException",g.message="Not supported type to render on",g}return y})(Error),c=(function(d){s(y,d);function y(){r(this,y);var g=t(this,(y.__proto__||Object.getPrototypeOf(y)).call(this));return g.name="NoElementException",g.message="No element to render on.",g}return y})(Error);return zi.InvalidInputException=i,zi.InvalidElementException=l,zi.NoElementException=c,zi}var fb;function Ck(){if(fb)return Mc;fb=1,Object.defineProperty(Mc,"__esModule",{value:!0});var r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(m){return typeof m}:function(m){return m&&typeof Symbol=="function"&&m.constructor===Symbol&&m!==Symbol.prototype?"symbol":typeof m},t=Ak(),s=d(t),i=Tk(),l=d(i),c=iv();function d(m){return m&&m.__esModule?m:{default:m}}function y(m){if(typeof m=="string")return g(m);if(Array.isArray(m)){for(var b=[],x=0;x<m.length;x++)b.push(y(m[x]));return b}else{if(typeof HTMLCanvasElement<"u"&&m instanceof HTMLImageElement)return f(m);if(m&&m.nodeName&&m.nodeName.toLowerCase()==="svg"||typeof SVGElement<"u"&&m instanceof SVGElement)return{element:m,options:(0,s.default)(m),renderer:l.default.SVGRenderer};if(typeof HTMLCanvasElement<"u"&&m instanceof HTMLCanvasElement)return{element:m,options:(0,s.default)(m),renderer:l.default.CanvasRenderer};if(m&&m.getContext)return{element:m,renderer:l.default.CanvasRenderer};if(m&&(typeof m>"u"?"undefined":r(m))==="object"&&!m.nodeName)return{element:m,renderer:l.default.ObjectRenderer};throw new c.InvalidElementException}}function g(m){var b=document.querySelectorAll(m);if(b.length!==0){for(var x=[],v=0;v<b.length;v++)x.push(y(b[v]));return x}}function f(m){var b=document.createElement("canvas");return{element:b,options:(0,s.default)(m),renderer:l.default.CanvasRenderer,afterRender:function(){m.setAttribute("src",b.toDataURL())}}}return Mc.default=y,Mc}var zc={},hb;function Mk(){if(hb)return zc;hb=1,Object.defineProperty(zc,"__esModule",{value:!0});var r=(function(){function i(l,c){for(var d=0;d<c.length;d++){var y=c[d];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(l,y.key,y)}}return function(l,c,d){return c&&i(l.prototype,c),d&&i(l,d),l}})();function t(i,l){if(!(i instanceof l))throw new TypeError("Cannot call a class as a function")}var s=(function(){function i(l){t(this,i),this.api=l}return r(i,[{key:"handleCatch",value:function(c){if(c.name==="InvalidInputException")if(this.api._options.valid!==this.api._defaults.valid)this.api._options.valid(!1);else throw c.message;else throw c;this.api.render=function(){}}},{key:"wrapBarcodeCall",value:function(c){try{var d=c.apply(void 0,arguments);return this.api._options.valid(!0),d}catch(y){return this.handleCatch(y),this.api}}}]),i})();return zc.default=s,zc}var td,db;function Rk(){if(db)return td;db=1;var r=Sk(),t=L(r),s=Au(),i=L(s),l=Ek(),c=L(l),d=Ok(),y=L(d),g=Ck(),f=L(g),m=nv(),b=L(m),x=Mk(),v=L(x),w=iv(),S=rv(),C=L(S);function L(M){return M&&M.__esModule?M:{default:M}}var U=function(){},ne=function($,Z,J){var le=new U;if(typeof $>"u")throw Error("No element to render on was provided.");return le._renderProperties=(0,f.default)($),le._encodings=[],le._options=C.default,le._errorHandler=new v.default(le),typeof Z<"u"&&(J=J||{},J.format||(J.format=ae()),le.options(J)[J.format](Z,J).render()),le};ne.getModule=function(M){return t.default[M]};for(var se in t.default)t.default.hasOwnProperty(se)&&D(t.default,se);function D(M,$){U.prototype[$]=U.prototype[$.toUpperCase()]=U.prototype[$.toLowerCase()]=function(Z,J){var le=this;return le._errorHandler.wrapBarcodeCall(function(){J.text=typeof J.text>"u"?void 0:""+J.text;var ve=(0,i.default)(le._options,J);ve=(0,b.default)(ve);var Re=M[$],Y=z(Z,Re,ve);return le._encodings.push(Y),le})}}function z(M,$,Z){M=""+M;var J=new $(M,Z);if(!J.valid())throw new w.InvalidInputException(J.constructor.name,M);var le=J.encode();le=(0,c.default)(le);for(var ve=0;ve<le.length;ve++)le[ve].options=(0,i.default)(Z,le[ve].options);return le}function ae(){return t.default.CODE128?"CODE128":Object.keys(t.default)[0]}U.prototype.options=function(M){return this._options=(0,i.default)(this._options,M),this},U.prototype.blank=function(M){var $=new Array(M+1).join("0");return this._encodings.push({data:$}),this},U.prototype.init=function(){if(this._renderProperties){Array.isArray(this._renderProperties)||(this._renderProperties=[this._renderProperties]);var M;for(var $ in this._renderProperties){M=this._renderProperties[$];var Z=(0,i.default)(this._options,M.options);Z.format=="auto"&&(Z.format=ae()),this._errorHandler.wrapBarcodeCall(function(){var J=Z.value,le=t.default[Z.format.toUpperCase()],ve=z(J,le,Z);X(M,ve,Z)})}}},U.prototype.render=function(){if(!this._renderProperties)throw new w.NoElementException;if(Array.isArray(this._renderProperties))for(var M=0;M<this._renderProperties.length;M++)X(this._renderProperties[M],this._encodings,this._options);else X(this._renderProperties,this._encodings,this._options);return this},U.prototype._defaults=C.default;function X(M,$,Z){$=(0,c.default)($);for(var J=0;J<$.length;J++)$[J].options=(0,i.default)(Z,$[J].options),(0,y.default)($[J].options);(0,y.default)(Z);var le=M.renderer,ve=new le(M.element,$,Z);ve.render(),M.afterRender&&M.afterRender()}return typeof window<"u"&&(window.JsBarcode=ne),typeof jQuery<"u"&&(jQuery.fn.JsBarcode=function(M,$){var Z=[];return jQuery(this).each(function(){Z.push(this)}),ne(Z,M,$)}),td=ne,td}var Dk=Rk();const qk=Dw(Dk),Lk={[Ie.EXECUTED]:"Executed",[Ie.MATCHED_LIST]:"Matched list",[Ie.CONFIRM_REQUIRED]:"Awaiting confirmation",[Ie.NO_MATCH_FALLBACK]:"No match",[Ie.UNCONFIGURED]:"Not configured",[Ie.INVALID_CODE]:"Invalid code",[Ie.FORBIDDEN]:"Not permitted",[Ie.CONFLICT]:"Conflict",[Ie.IDENTITY_PRIMED]:"Identity primed",[Ie.IDENTITY_UNKNOWN]:"Badge not recognized",[Ie.NOT_PRIMED]:"Badge required",[Ie.CHOICES]:"Choices presented"},av={[Ie.EXECUTED]:"text-status-success",[Ie.MATCHED_LIST]:"text-status-success",[Ie.CONFIRM_REQUIRED]:"text-status-warning",[Ie.NO_MATCH_FALLBACK]:"text-text-secondary",[Ie.UNCONFIGURED]:"text-status-warning",[Ie.INVALID_CODE]:"text-status-error",[Ie.FORBIDDEN]:"text-status-error",[Ie.CONFLICT]:"text-status-warning",[Ie.IDENTITY_PRIMED]:"text-status-success",[Ie.IDENTITY_UNKNOWN]:"text-status-warning",[Ie.NOT_PRIMED]:"text-status-warning",[Ie.CHOICES]:"text-status-success"};function ov(r){return r.outcome===Ie.IDENTITY_PRIMED&&r.actor?`Hi ${r.actor.displayName}`:`${Lk[r.outcome]}${r.rule?` — ${r.rule.name}`:""}`}function du(r){var t,s,i;return r.outcome===Ie.NO_MATCH_FALLBACK?((t=r.fallback)==null?void 0:t.markdown)??null:r.outcome===Ie.IDENTITY_UNKNOWN?((s=r.fallback)==null?void 0:s.markdown)??null:r.outcome===Ie.NOT_PRIMED?((i=r.notPrimed)==null?void 0:i.markdown)??null:null}function hs(r){return r.replace(/`([^`]+)`/g,'<code class="px-1 py-0.5 bg-surface-sunken rounded text-xs font-mono">$1</code>').replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>").replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent-primary hover:underline" target="_blank" rel="noopener noreferrer">$1</a>')}function lv({content:r,compact:t}){const s=[],i=/^```(\w*)\n([\s\S]*?)^```$/gm;let l=0,c;for(;(c=i.exec(r))!==null;)c.index>l&&s.push({type:"text",text:r.slice(l,c.index)}),s.push({type:"code",lang:c[1],code:c[2].replace(/\n$/,"")}),l=c.index+c[0].length;l<r.length&&s.push({type:"text",text:r.slice(l)});const d=t?{text:"text-xs",heading:"text-xs",list:"text-xs",code:"text-2xs"}:{text:"text-sm",heading:"text-sm",list:"text-sm",code:"text-xs"},y=[];for(const g of s){if(g.type==="code"){const f=g.code.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");y.push(`<pre class="my-2 p-2.5 bg-surface-sunken rounded-md overflow-x-auto"><code class="${d.code} font-mono text-text-secondary leading-relaxed">${f}</code></pre>`);continue}y.push(...Bk(g.text,d))}return h.jsx("div",{className:"prose-sm",dangerouslySetInnerHTML:{__html:y.join(`
|
|
55
|
+
`)}})}function Bk(r,t){const s=r.split(`
|
|
56
|
+
`),i=[];let l=!1,c=!1,d=[];for(const y of s){const g=y.trim();if(g.startsWith("|")&&g.endsWith("|")){const f=g.slice(1,-1).split("|").map(m=>m.trim());if(f.every(m=>/^[-:]+$/.test(m)))continue;c||(c=!0,d=[]),d.push(f);continue}if(c){c=!1;const[f,...m]=d;i.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const b of f)i.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${hs(b)}</th>`);i.push("</tr></thead><tbody>");for(const b of m){i.push("<tr>");for(const x of b)i.push(`<td class="py-1 px-2 border-b border-border/50">${hs(x)}</td>`);i.push("</tr>")}i.push("</tbody></table></div>"),d=[]}if(!g){l&&(i.push("</ul>"),l=!1);continue}if(g.startsWith("### ")){l&&(i.push("</ul>"),l=!1),i.push(`<h4 class="${t.heading} font-semibold text-text-primary mt-3 mb-1">${hs(g.slice(4))}</h4>`);continue}if(g.startsWith("## ")){l&&(i.push("</ul>"),l=!1),i.push(`<h3 class="${t.heading} font-semibold text-text-primary mt-3 mb-1">${hs(g.slice(3))}</h3>`);continue}if(/^[-*_]{3,}$/.test(g)){l&&(i.push("</ul>"),l=!1),i.push('<hr class="border-border my-3" />');continue}if(/^[-*] /.test(g)){l||(i.push('<ul class="space-y-1 my-1">'),l=!0),i.push(`<li class="${t.list} text-text-secondary flex gap-2"><span class="text-text-tertiary shrink-0">-</span><span>${hs(g.slice(2))}</span></li>`);continue}l&&(i.push("</ul>"),l=!1),i.push(`<p class="${t.text} text-text-secondary my-1">${hs(g)}</p>`)}if(c&&d.length){const[y,...g]=d;i.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const f of y)i.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${hs(f)}</th>`);i.push("</tr></thead><tbody>");for(const f of g){i.push("<tr>");for(const m of f)i.push(`<td class="py-1 px-2 border-b border-border/50">${hs(m)}</td>`);i.push("</tr>")}i.push("</tbody></table></div>")}return l&&i.push("</ul>"),i}function Uk(r){return r.replace(/[\u2010-\u2015\u2212]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u00A0/g," ").replace(/[\u200B-\u200D\uFEFF]/g,"").replace(/[\x00-\x1F\x7F]/g,"").trim()}function Pk(r){const t=new Set;for(const s of r){const i=s.codePointAt(0);(i>127||i<32)&&t.add(`"${i<32?"\\x"+i.toString(16).padStart(2,"0"):s}" U+${i.toString(16).toUpperCase().padStart(4,"0")}`)}return[...t]}function zk({value:r}){const t=A.useRef(null),[s,i]=A.useState(!1);return A.useEffect(()=>{if(!(!t.current||!r))try{qk(t.current,r,{format:"CODE128",width:2,height:88,margin:12,displayValue:!0,fontSize:13,background:"#ffffff",lineColor:"#000000"}),i(!1)}catch{i(!0)}},[r]),r?h.jsxs("div",{children:[h.jsx("span",{className:"block text-xs uppercase tracking-wide text-text-tertiary mb-1",children:"Barcode"}),s?h.jsxs("p",{className:"text-xs text-status-error",children:["This value has characters Code 128 cannot carry:"," ",h.jsx("span",{className:"font-mono",children:Pk(r).join(", ")||"unknown"})]}):h.jsx("div",{className:"bg-white rounded p-1 inline-block max-w-full overflow-hidden",children:h.jsx("svg",{ref:t,className:"max-w-full"})})]}):null}function Ik({onClose:r}){const{submitCode:t,lastResult:s,busy:i,wedgeConfig:l,updateWedgeConfig:c,diagnostics:d,diagnosticsOn:y,setDiagnosticsOn:g}=Qx(),[f,m]=A.useState(""),[b,x]=A.useState(!1),v=S=>{S.preventDefault();const C=f.trim();C&&(m(""),t(C))},w=(s==null?void 0:s.response)??null;return h.jsxs("div",{className:"flex flex-col h-full",children:[h.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border",children:[h.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-text-primary",children:[h.jsx(Id,{className:"w-4 h-4"}),"Scan"]}),h.jsx("button",{type:"button",onClick:r,className:"text-text-tertiary hover:text-text-primary",title:"Close",children:h.jsx(Jt,{className:"w-4 h-4"})})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-6",children:[h.jsxs("form",{onSubmit:v,className:"space-y-2",children:[h.jsx("label",{className:"block text-xs uppercase tracking-wide text-text-tertiary",children:"Enter a code"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx("input",{value:f,onChange:S=>m(Uk(S.target.value)),placeholder:"10:1:SN-12345",className:"flex-1 px-2 py-1.5 text-sm bg-surface-raised border border-surface-border rounded text-text-primary","data-scan-manual-entry":!0}),h.jsx("button",{type:"submit",disabled:i||!f.trim(),className:"px-3 py-1.5 text-sm rounded bg-accent text-text-inverse disabled:opacity-50",children:"Go"})]}),h.jsx("p",{className:"text-xs text-text-tertiary",children:"Scanning with a connected scanner works from any page — this entry exists for testing and for codes you can read but not scan. Typing here also draws the code below; point the scanner at the screen to fire it for real."})]}),h.jsx(zk,{value:f.trim()}),s&&h.jsxs("div",{className:"space-y-2",children:[h.jsx("div",{className:"text-xs uppercase tracking-wide text-text-tertiary",children:"Last scan"}),h.jsx("div",{className:"text-sm font-mono text-text-primary",children:s.code}),w?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:`text-sm font-medium ${av[w.outcome]}`,children:ov(w)}),w.error&&h.jsx("div",{className:"text-xs text-text-tertiary",children:w.error}),du(w)&&h.jsx("div",{className:"text-sm border-t border-surface-border pt-2",children:h.jsx(lv,{content:du(w),compact:!0})})]}):h.jsx("div",{className:"text-sm text-status-error",children:s.error})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("button",{type:"button",onClick:()=>x(S=>!S),className:"text-xs uppercase tracking-wide text-text-tertiary hover:text-text-primary",children:["Capture settings ",b?"▾":"▸"]}),b&&h.jsxs("div",{className:"space-y-3",children:[h.jsxs("label",{className:"block text-sm text-text-primary",children:[h.jsx("span",{className:"block text-xs text-text-tertiary mb-1",children:"Key gap limit (ms) — a longer pause between keys starts a new capture; raise it for scanners that pace slowly"}),h.jsx("input",{type:"number",min:100,max:2e3,step:50,value:l.maxKeyGapMs,onChange:S=>c({maxKeyGapMs:Number(S.target.value)}),className:"w-24 px-2 py-1 text-sm bg-surface-raised border border-surface-border rounded"})]}),h.jsxs("label",{className:"flex items-center gap-2 text-sm text-text-primary",children:[h.jsx("input",{type:"checkbox",checked:y,onChange:S=>g(S.target.checked)}),h.jsx("span",{children:"Diagnostics — trace every keydown the capture sees (also logged to the console)"})]}),y&&h.jsxs("div",{className:"border border-surface-border rounded",children:[h.jsx("div",{className:"px-2 py-1.5 text-2xs uppercase tracking-wide text-text-tertiary border-b border-surface-border",children:"Keydown trace — scan now, newest last"}),h.jsxs("div",{className:"max-h-64 overflow-y-auto font-mono text-2xs leading-5 px-2 py-1",children:[d.length===0&&h.jsx("div",{className:"text-text-tertiary",children:"Waiting for keys…"}),d.map(S=>h.jsxs("div",{className:"whitespace-nowrap overflow-hidden text-ellipsis",title:`buffer: ${S.buffer}`,children:[h.jsxs("span",{className:"text-text-tertiary",children:[String(S.deltaMs).padStart(4),"ms "]}),h.jsx("span",{className:"text",children:JSON.stringify(S.key)}),S.code&&h.jsxs("span",{className:"text-text-tertiary",children:[" (",S.code,")"]}),h.jsxs("span",{className:"text-text-tertiary",children:[" — ",S.note]})]},S.seq))]}),h.jsxs("div",{className:"px-2 py-1.5 text-2xs text-text-tertiary border-t border-surface-border",children:["Read it like this: a scan should end with an"," ",h.jsx("span",{className:"font-mono",children:'"Enter"'})," row saying"," ",h.jsx("span",{className:"font-mono",children:"capture → …"}),'. An Enter row saying "no code tail" means the buffer split (raise the gap limit, or a key arrived as something other than one character). No Enter row at all means the scanner sends no suffix — program its Enter/CR suffix. Keys named'," ",h.jsx("span",{className:"font-mono",children:'"Unidentified"'})," mean the decode arrives outside the keydown path."]})]})]})]})]})]})}const cv=/^\{lt:([A-Za-z0-9_]+)\}$/;function qC(r){return`{lt:${r}}`}const uv="lt:station:link-vars:";function Bd(r){return`${uv}${r}`}const Ud=new Set;function $k(){for(const r of Ud)r()}let mu,Ic={};function fv(r){let t=null;try{t=localStorage.getItem(Bd(r))}catch{t=null}if(t===mu)return Ic;mu=t;try{const s=t?JSON.parse(t):{};Ic=s&&typeof s=="object"&&!Array.isArray(s)?Object.fromEntries(Object.entries(s).filter(([,i])=>typeof i=="string")):{}}catch{Ic={}}return Ic}function Hk(r,t,s){const i={...fv(r)};s===null||s===""?delete i[t]:i[t]=s;try{Object.keys(i).length===0?localStorage.removeItem(Bd(r)):localStorage.setItem(Bd(r),JSON.stringify(i))}catch{}mu=void 0,$k()}function Fk(r){Ud.add(r);const t=s=>{(s.key===null||s.key.startsWith(uv))&&(mu=void 0,r())};try{window.addEventListener("storage",t)}catch{}return()=>{Ud.delete(r);try{window.removeEventListener("storage",t)}catch{}}}const Gk={};function Vk(r){return A.useSyncExternalStore(Fk,()=>r?fv(r):Gk)}function Yk(r,t,s){let i;try{i=new URL(r,"http://local")}catch{return r}const l=i.searchParams.get("facets");if(!l)return r;let c;try{const y=JSON.parse(l);if(!y||typeof y!="object"||Array.isArray(y))return r;c=y}catch{return r}let d=!1;for(const[y,g]of Object.entries(c)){if(typeof g!="string")continue;const f=cv.exec(g);if(!f)continue;const m=t[f[1]]??s[f[1]];typeof m=="string"&&m!==""?c[y]=m:delete c[y],d=!0}return d?(Object.keys(c).length===0?i.searchParams.delete("facets"):i.searchParams.set("facets",JSON.stringify(c)),i.pathname+i.search):r}function LC(r){let t;try{t=new URL(r,"http://local")}catch{return[]}const s=t.searchParams.get("facets");if(!s)return[];try{const i=JSON.parse(s);if(!i||typeof i!="object"||Array.isArray(i))return[];const l=[];for(const c of Object.values(i)){if(typeof c!="string")continue;const d=cv.exec(c);d&&!l.includes(d[1])&&l.push(d[1])}return l}catch{return[]}}function bm(){const{user:r,isSuperAdmin:t,hasRoleType:s}=It(),i=(r==null?void 0:r.userId)??null,l=t||s("admin"),c=A.useMemo(()=>new Set(((r==null?void 0:r.roles)??[]).map(x=>x.role)),[r]),{data:d}=Su({enabled:l||c.size>0}),y=Vk(i),g=A.useMemo(()=>{var w;const x=[],v=new Set;for(const S of(d==null?void 0:d.roles)??[]){if(!l&&!c.has(S.role))continue;const C=(w=S.properties)==null?void 0:w.link_variables;if(Array.isArray(C))for(const L of C){const U=L==null?void 0:L.name;if(typeof U!="string"||U===""||v.has(U))continue;v.add(U);const ne=L.label,se=L.default;x.push({name:U,...typeof ne=="string"&&ne!==""?{label:ne}:{},...typeof se=="string"&&se!==""?{default:se}:{},fromRole:S.role})}}return x},[d,c,l]),f=A.useMemo(()=>{const x={};for(const v of g)v.default!==void 0&&(x[v.name]=v.default);return x},[g]),m=A.useCallback(x=>Yk(x,y,f),[y,f]),b=A.useCallback((x,v)=>{i&&Hk(i,x,v)},[i]);return{declarations:g,values:y,defaults:f,resolveUrl:m,setValue:b}}function Kk({open:r,onClose:t,title:s,children:i,maxWidth:l}){return A.useEffect(()=>{if(!r)return;const c=d=>{d.key==="Escape"&&t()};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[r,t]),r?zd.createPortal(h.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[h.jsx("div",{className:"absolute inset-0 bg-text-primary/30",onClick:t}),h.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"lt-modal-title",className:`relative bg-surface-raised border border-surface-border rounded-lg shadow-xl w-full ${l??"max-w-md"} mx-4 max-h-[85vh] flex flex-col`,children:[h.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b shrink-0",children:[h.jsx("h2",{id:"lt-modal-title",className:"text-sm font-medium text-text-primary",children:s}),h.jsx("button",{onClick:t,"aria-label":"Close dialog",className:"text-text-tertiary hover:text-text-primary text-lg leading-none",children:"×"})]}),h.jsx("div",{className:"px-6 py-5 overflow-y-auto",children:i})]})]}),document.body):null}function Jk({open:r,onClose:t}){const{declarations:s,values:i,setValue:l}=bm();return h.jsxs(Kk,{open:r,onClose:t,title:"Link Variables",maxWidth:"max-w-lg",children:[h.jsx("p",{className:"text-2xs text-text-tertiary leading-relaxed mb-4",children:"Values bound on this device. Pinned links and the Pace Board open scoped to the value applied; an unbound variable falls back to the role's default, or applies no filter at all."}),h.jsx("div",{className:"divide-y divide-surface-border",children:s.map((c,d)=>h.jsx(Xk,{declaration:c,value:i[c.name]??"",autoFocus:d===0,onChange:y=>l(c.name,y),onClear:()=>l(c.name,null),onEnter:t},c.name))}),s.length===0&&h.jsx("p",{className:"text-xs text-text-tertiary",children:"Your roles declare no link variables."}),s.length>0&&h.jsx("div",{className:"flex justify-end pt-4",children:h.jsx("button",{onClick:t,className:"px-3 py-1.5 text-xs rounded bg-accent text-text-inverse hover:bg-accent-hover transition-colors",children:"OK"})})]})}function Xk({declaration:r,value:t,autoFocus:s,onChange:i,onClear:l,onEnter:c}){const d=A.useId(),{data:y}=nA(r.name),g=(y==null?void 0:y.values)??[];return h.jsxs("div",{className:"py-3 flex items-center gap-3","data-testid":"link-var-row",children:[h.jsxs("div",{className:"w-40 shrink-0 min-w-0",children:[h.jsx("p",{className:"text-xs font-mono text-text-primary truncate",title:r.name,children:r.name}),h.jsx("p",{className:"text-2xs text-text-quaternary truncate",title:`declared by ${r.fromRole}`,children:r.label??r.fromRole})]}),h.jsx("input",{type:"text",list:d,autoFocus:s,value:t,onChange:f=>i(f.target.value),onKeyDown:f=>{f.key==="Enter"&&c()},placeholder:r.default?`${r.default} (default)`:"no filter","aria-label":`Value for ${r.name}`,className:"input text-xs font-mono flex-1 min-w-0"}),h.jsx("datalist",{id:d,children:g.map(f=>h.jsx("option",{value:f},f))}),h.jsx("button",{onClick:l,disabled:t==="",title:`Clear ${r.name}`,className:"p-1 text-text-quaternary hover:text-status-error transition-colors disabled:opacity-30 disabled:cursor-not-allowed shrink-0",children:"×"})]})}const $c=["escalationId","workflowId"],Qk=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,mb="lt:search:facet";function Zk(r,t){return r==="escalationId"||r==="workflowId"?null:Gj(r,t)}function Wk(){const r=Zi(),{data:t}=Xn(),[s,i]=A.useState(""),[l,c]=A.useState(!1),[d,y]=A.useState(null),[g,f]=A.useState(null),[m,b]=A.useState(""),x=A.useRef(null),v=A.useMemo(()=>{var se;return[...$c,...(((se=t==null?void 0:t.search)==null?void 0:se.facets)??[]).filter(D=>!$c.includes(D))]},[t]),[w,S]=A.useState(()=>{try{return localStorage.getItem(mb)??$c[0]}catch{return $c[0]}}),C=v.includes(w)?w:v[0],L=se=>{S(se),y(null);try{localStorage.setItem(mb,se)}catch{}},U=()=>{y(null),f(null)},ne=async()=>{const se=s.trim();if(!se||l)return;U();const D=Zk(C,se);if(D){i(""),r(D);return}if(C==="escalationId"&&!Qk.test(se)){y("That is not a valid escalation id");return}c(!0);try{if(C==="escalationId")await me(`/escalations/${encodeURIComponent(se)}`),i(""),r(`/escalations/detail/${encodeURIComponent(se)}`);else{const z=await me(`/escalations/by-workflow/${encodeURIComponent(se)}`),ae=(z==null?void 0:z.escalations)??[];ae.length===1?(i(""),r(`/escalations/detail/${ae[0].id}`)):(b(se),f(ae),ae.length===0&&y(null))}}catch{y(`No ${C==="escalationId"?"escalation":"workflow"} found for "${se}"`)}finally{c(!1)}};return h.jsxs("div",{className:"hidden md:flex items-center gap-1.5 min-w-0","data-testid":"global-search",children:[h.jsx(Hw,{className:"w-3.5 h-3.5 shrink-0 text-text-quaternary",strokeWidth:1.5}),h.jsx("select",{value:C,onChange:se=>L(se.target.value),"aria-label":"Search facet",className:"bg-transparent text-2xs font-mono text-text-tertiary focus:outline-none cursor-pointer max-w-28 truncate",children:v.map(se=>h.jsx("option",{value:se,children:se},se))}),h.jsxs("div",{className:"relative flex-1 min-w-0",children:[h.jsx("input",{ref:x,type:"text",value:s,onChange:se=>{i(se.target.value),U()},onKeyDown:se=>{se.key==="Enter"&&ne()},placeholder:"Search…","aria-label":"Global search",className:"bg-transparent border-b border-surface-border focus:border-accent text-xs text-text-primary placeholder:text-text-quaternary focus:outline-none w-40 lg:w-56 py-0.5 transition-colors"}),l&&h.jsx("span",{className:"absolute right-1 top-1 text-2xs text-text-quaternary",children:"…"}),d&&h.jsx("p",{className:"absolute top-full left-0 mt-1 text-2xs text-status-error whitespace-nowrap",role:"alert",children:d}),g!==null&&h.jsxs("div",{className:"absolute top-full left-0 mt-1.5 z-50 min-w-72 max-w-96 bg-surface-raised border border-surface-border rounded-md shadow-lg py-1","data-testid":"search-workflow-results",children:[g.map(se=>h.jsxs(kr,{to:`/escalations/detail/${se.id}`,onClick:()=>{f(null),i("")},className:"block px-3 py-1.5 text-xs text-text-secondary hover:bg-surface-hover truncate",children:[h.jsx("span",{className:"font-medium text-text-primary",children:se.role}),h.jsx("span",{className:"mx-1.5 text-text-quaternary",children:"·"}),se.status,h.jsx("span",{className:"mx-1.5 text-text-quaternary",children:"·"}),h.jsx("span",{className:"text-text-tertiary",children:se.type})]},se.id)),g.length===0&&h.jsx("p",{className:"px-3 py-1.5 text-2xs text-text-tertiary",children:"No escalations for this workflow."}),h.jsx("hr",{className:"border-surface-border/60 my-0.5"}),h.jsx(kr,{to:`/workflows/executions/${encodeURIComponent(m)}`,onClick:()=>{f(null),i("")},className:"block px-3 py-1.5 text-xs text-accent hover:bg-surface-hover",children:"Workflow execution →"})]})]})]})}function eN(r){return r.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").split(/[-_\s]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function hv(r){var t;return((t=r.title)==null?void 0:t.trim())||eN(r.role)}const dv="lt:bookmarks",Hc="scan";function tN(){try{const r=localStorage.getItem(dv);if(!r)return[];const t=JSON.parse(r);return Array.isArray(t)?t:[]}catch{return[]}}function pb(r){try{localStorage.setItem(dv,JSON.stringify(r))}catch{}}function nN({onToggleEventFeed:r,onToggleDocs:t,onToggleNav:s}){var yt,jt,ke;const i=Zi(),{user:l,logout:c}=It(),{viewAs:d,realIsBuilder:y}=wx(),{available:g,mine:f}=aA();Sx();const{connected:m}=ix(),{data:b}=Xn(),{role:x,targets:v,selectable:w,selectRole:S}=Ax(),{declarations:C,values:L}=bm(),[U,ne]=A.useState(!1),{data:se}=Su({enabled:w}),{setPanel:D,closePanel:z,open:ae,ownerKey:X}=dm(),M=Jx(),$=wn(),Z=()=>{ae&&X===Hc?z(Hc):D(h.jsx(Ik,{onClose:()=>z(Hc)}),{width:360,key:Hc})},[J,le]=A.useState(!1),[ve,Re]=A.useState(!1),[Y,oe]=A.useState(Hx),[he,Ae]=A.useState(tN),_e=A.useRef(null),Ne=(yt=b==null?void 0:b.branding)==null?void 0:yt.appName,je=(jt=b==null?void 0:b.branding)==null?void 0:jt.themes,Te=A.useMemo(()=>(Cj(je??[]),Mj()),[je]),rt=be=>{Rj(be),oe(be)},Oe=()=>{const be=window.prompt("Bookmark label:");if(!(be!=null&&be.trim()))return;const _t=$.pathname+$.search,$t=[...he,{label:be.trim(),url:_t}].sort((En,Ut)=>En.label.localeCompare(Ut.label));Ae($t),pb($t),le(!1)},ot=be=>{const _t=he.filter($t=>!($t.label===be.label&&$t.url===be.url));Ae(_t),pb(_t)};return A.useEffect(()=>{if(!J)return;const be=_t=>{_e.current&&!_e.current.contains(_t.target)&&le(!1)};return document.addEventListener("mousedown",be),()=>document.removeEventListener("mousedown",be)},[J]),h.jsxs(h.Fragment,{children:[h.jsxs("header",{className:`h-14 shrink-0 border-b border-surface-border bg-surface-raised flex items-center justify-between pl-2 pr-5 relative ${J?"z-[100]":"z-30"}`,children:[h.jsxs("div",{className:"flex items-center gap-1 min-w-0",children:[s&&h.jsx("button",{onClick:s,className:"lg:hidden p-2 text-text-secondary hover:text-text-primary transition-colors","aria-label":"Open navigation",children:h.jsx(Fw,{className:"w-5 h-5",strokeWidth:1.5})}),h.jsxs(kr,{to:"/","aria-label":"Home",className:"shrink-0",onClick:be=>{(be.ctrlKey||be.metaKey)&&(be.preventDefault(),Re(!0))},children:[h.jsx(uu,{appName:Ne,className:"hidden lg:flex"}),h.jsx(uu,{appName:Ne,variant:"comet",className:"flex lg:hidden"})]}),h.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border mx-1"}),h.jsx("button",{onClick:()=>i(-1),className:"p-2 text-accent/60 hover:text-accent transition-colors","aria-label":"Go back",children:h.jsx(Tb,{className:"w-5 h-5",strokeWidth:2})}),h.jsx("button",{onClick:()=>i(1),className:"p-2 text-accent/60 hover:text-accent transition-colors","aria-label":"Go forward",children:h.jsx(sd,{className:"w-5 h-5",strokeWidth:2})})]}),((ke=b==null?void 0:b.search)==null?void 0:ke.enabled)&&h.jsx(Wk,{}),h.jsxs("div",{className:"flex items-center gap-5",children:[h.jsxs(kr,{to:"/escalations/available",className:`flex items-center gap-1.5 text-xs transition-colors ${g>0?"text-status-queued":"text-text-quaternary hover:text-text-secondary"}`,title:"All escalations",children:[h.jsx(id,{className:"w-4 h-4",strokeWidth:1.5}),h.jsx("span",{className:"hidden lg:inline",children:"all"}),g>0&&h.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:g})]}),h.jsxs(kr,{to:"/escalations/queue",className:`flex items-center gap-1.5 text-xs transition-colors ${f>0?"text-status-claimed":"text-text-quaternary hover:text-text-secondary"}`,title:"My escalation queue",children:[h.jsx(id,{className:"w-4 h-4",strokeWidth:1.5}),h.jsx("span",{className:"hidden lg:inline",children:"mine"}),f>0&&h.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:f})]}),d&&h.jsx(h.Fragment,{children:h.jsxs("span",{className:"hidden lg:flex items-center gap-1 pl-2 pr-1 py-0.5 rounded-full bg-accent/10 border border-accent/25 text-2xs text-accent select-none",children:[h.jsxs("span",{className:"capitalize font-medium tracking-wide",children:[d," View"]}),h.jsx("button",{onClick:Nd,title:"Restore your real view",className:"ml-0.5 rounded-full p-0.5 hover:bg-accent/20 transition-colors",children:h.jsx(Jt,{className:"w-2.5 h-2.5"})})]})}),h.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border"}),l&&h.jsxs("div",{className:"relative",ref:_e,children:[h.jsxs("button",{onClick:()=>le(be=>!be),className:"btn-ghost flex items-center gap-1",children:[h.jsxs("span",{className:"relative",children:[h.jsx(Gw,{className:"w-4 h-4 text-accent/75",strokeWidth:1.5}),d&&h.jsx("span",{className:"lg:hidden absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-accent"})]}),h.jsx("span",{className:"hidden lg:inline whitespace-nowrap",children:l.displayName||l.username||l.userId}),h.jsx("svg",{className:"hidden lg:block w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),J&&h.jsxs("div",{className:"absolute right-0 top-full mt-1 w-52 bg-surface-raised border border-surface-border rounded-md shadow-lg py-1 z-[100]",children:[h.jsx(kr,{to:"/credentials",onClick:()=>le(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Credentials"}),M&&h.jsx("button",{onClick:()=>{le(!1),Z()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover","data-testid":"menu-scan",children:"Scan a code"}),h.jsx("button",{onClick:()=>{le(!1),m?r==null||r():window.location.reload()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:m?"Events":"Reconnect events"}),y&&h.jsx("button",{onClick:()=>{le(!1),t==null||t()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover","data-testid":"menu-docs",children:"Docs"}),d&&h.jsxs("button",{onClick:()=>{le(!1),Nd()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-accent hover:bg-surface-hover capitalize",children:["Exit ",d," view"]}),h.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Theme"}),h.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:Te.map(be=>h.jsx("button",{type:"button",onClick:()=>rt(be.id),title:be.label,"aria-label":`${be.label} theme`,className:`w-4 h-4 rounded-full transition-transform hover:scale-110 ${Y===be.id?"ring-2 ring-offset-1 ring-surface-border":""}`,style:{backgroundColor:be.swatch}},be.id))})]}),w&&h.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Station queue"}),h.jsxs("div",{className:"flex flex-col",children:[h.jsxs("button",{type:"button",onClick:()=>{le(!1),S(null),i("/")},className:`flex items-center gap-2 -mx-1 px-1 py-1 text-xs text-left rounded hover:bg-surface-hover ${x?"text-text-secondary":"text-accent"}`,children:[h.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${x?"bg-surface-border":"bg-accent"}`}),h.jsx("span",{className:"truncate",children:"Full dashboard"})]}),v.map(be=>{var En;const _t=(En=se==null?void 0:se.roles)==null?void 0:En.find(Ut=>Ut.role===be),$t=be===x;return h.jsxs("button",{type:"button",onClick:()=>{le(!1),S(be),i(`/escalations/available?role=${encodeURIComponent(be)}&status=available`)},className:`flex items-center gap-2 -mx-1 px-1 py-1 text-xs text-left rounded hover:bg-surface-hover ${$t?"text-accent":"text-text-secondary"}`,children:[h.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${$t?"bg-accent":"bg-surface-border"}`}),h.jsx("span",{className:"truncate",children:hv({role:be,title:_t==null?void 0:_t.title})})]},be)})]})]}),C.length>0&&h.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Link variables"}),h.jsxs("button",{type:"button",onClick:()=>{le(!1),ne(!0)},className:"flex items-center gap-2 -mx-1 px-1 py-1 w-full text-xs text-left rounded text-text-secondary hover:bg-surface-hover","data-testid":"link-vars-menu-entry",children:[h.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${Object.keys(L).length>0?"bg-accent":"bg-surface-border"}`}),h.jsx("span",{className:"truncate",children:Object.keys(L).length>0?Object.entries(L).map(([be,_t])=>`${be} = ${_t}`).join(", "):"Set values for this device"})]})]}),h.jsx("button",{onClick:()=>{le(!1),c()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Sign Out"}),h.jsxs("div",{className:"border-t border-surface-border/60 pt-1",children:[he.map(be=>h.jsxs("div",{className:"flex items-center group px-3 py-1.5 hover:bg-surface-hover",children:[h.jsx(kr,{to:be.url,onClick:()=>le(!1),title:be.url,className:"flex-1 min-w-0 text-xs text-text-secondary hover:text-text-primary truncate",children:be.label}),h.jsx("button",{type:"button",onClick:()=>ot(be),title:`Remove "${be.label}"`,className:"opacity-0 group-hover:opacity-100 transition-opacity ml-1 p-0.5 shrink-0 text-text-quaternary hover:text-status-error",children:h.jsx(Jt,{className:"w-3 h-3"})})]},`${be.label}::${be.url}`)),h.jsx("hr",{className:"border-surface-border/60 mx-3 my-0.5"}),h.jsxs("button",{type:"button",onClick:Oe,className:"flex items-center gap-1.5 w-full px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:[h.jsx(Vw,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:1.5}),"Add Bookmark"]})]})]})]})]})]}),ve&&h.jsx(Tj,{onClose:()=>Re(!1)}),h.jsx(Jk,{open:U,onClose:()=>ne(!1)})]})}function xm({open:r,children:t}){const[s,i]=A.useState(r);return A.useEffect(()=>{r&&i(!0)},[r]),h.jsx("div",{className:`grid transition-[grid-template-rows] duration-300 ease-out ${r?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,onTransitionEnd:()=>{r||i(!1)},children:h.jsx("div",{className:"overflow-hidden",children:s?t:null})})}function Pd(r){return({isActive:t})=>{const s="flex items-center rounded-md transition-colors duration-150",i="bg-surface-hover text-text-primary font-medium",l="text-text-secondary hover:text-text-primary hover:bg-surface-hover";return r?`${s} justify-center w-10 h-10 mx-auto ${t?i:l}`:`${s} gap-3 px-4 py-2 text-sm ${t?i:l}`}}function rN(){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 sN({group:r,collapsed:t}){const{pathname:s}=wn(),i=r.matchPaths.some(y=>s.startsWith(y)),[l,c]=A.useState(i),d=l||i;return t?h.jsx(h.Fragment,{children:r.items.map(y=>h.jsx(Ki,{to:y.to,className:Pd(!0),title:y.label,children:y.icon&&h.jsx(y.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})},y.to))}):h.jsxs("div",{children:[h.jsxs("button",{onClick:()=>c(y=>!y),className:"w-full flex items-center justify-between px-4 py-2 text-sm rounded-md transition-colors duration-150 text-text-secondary hover:text-text-primary hover:bg-surface-hover",children:[h.jsxs("span",{className:"flex items-center gap-3",children:[r.icon&&h.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{children:r.label})]}),h.jsx("svg",{className:`w-3.5 h-3.5 text-text-tertiary transition-transform duration-150 ${d?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),h.jsx(xm,{open:d,children:r.items.map(y=>h.jsxs(Ki,{to:y.to,end:y.end,className:rN(),children:[y.icon&&h.jsx(y.icon,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{children:y.label})]},y.to))})]})}function iN(r){return r.kind==="group"}function aN({entry:r,collapsed:t}){const{pathname:s,search:i}=wn(),l=r.to.includes("?"),c=r.icon&&h.jsx(r.icon,{className:`w-5 h-5 shrink-0 text-accent/75 ${r.iconClassName??""}`,strokeWidth:1.5,...r.solid?{fill:"currentColor"}:{}});if(l){const[d,y]=r.to.split("?"),g=s===d&&i===`?${y}`,f=Pd(t)({isActive:g});return h.jsxs(Ki,{to:r.to,className:f,title:t?r.label:void 0,children:[c,!t&&h.jsx("span",{children:r.label})]})}return h.jsxs(Ki,{to:r.to,end:r.end,className:Pd(t),title:t?r.label:void 0,children:[c,!t&&h.jsx("span",{children:r.label})]})}function bs({heading:r,entries:t}){const{collapsed:s}=fm();return h.jsxs("div",{className:"space-y-1",children:[s?h.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:r}):h.jsx("p",{className:"px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-text-tertiary",children:r}),t.map(i=>iN(i)?h.jsx(sN,{group:i,collapsed:s},i.label):h.jsx(aN,{entry:i,collapsed:s},i.to))]})}function oN({aiEnabled:r=!1,isBuilder:t=!1,isOps:s=!1,viewAs:i=null,canSeePaceBoard:l=!1}){const c=[{to:"/pace",label:"Pace Board",icon:Yw},{to:"/trends",label:"Trend Board",icon:Kw}];if(!t&&(!s||i==="engineer"||i==="operator"))return l?h.jsx(bs,{heading:"Monitor",entries:c}):null;if(!t)return h.jsx(bs,{heading:"Monitor",entries:l?c:[]});const d=[...l?c:[],{to:"/topics",label:"Event Topics",icon:Cb},{to:"/agents",label:r?"Agents":"Automations",icon:Jw},{to:"/capabilities",label:"Capabilities",icon:Xw}];return h.jsx(bs,{heading:"Monitor",entries:d})}function lN(){return We({queryKey:["me","preferences"],queryFn:()=>me("/me/preferences"),staleTime:6e4})}function cN(){const r=Ve();return et({mutationFn:t=>me("/me/preferences",{method:"PATCH",body:JSON.stringify(t)}),onSuccess:t=>{r.setQueryData(["me","preferences"],t)}})}function uN(r,t){const s=(r==null?void 0:r.pinnedViews)??[],i=new Set((r==null?void 0:r.hiddenRolePins)??[]),l=new Set(s.map(y=>y.label)),c=[...s],d=new Set;for(const{role:y,pins:g}of t)for(const f of g)l.has(f.label)||i.has(f.label)||d.has(f.label)||(d.add(f.label),c.push({...f,id:`role:${y}:${f.label}`,fromRole:y}));return c}function fN(r){let t;try{t=new URL(r,"http://local")}catch{return null}if(t.pathname!=="/escalations/available"&&t.pathname!=="/escalations")return null;const s=t.searchParams,i=Fj(s),l=s.get("status")||void 0,c=t.pathname==="/escalations/available"&&(l===void 0||l==="available");return{available:c,params:{...i,role:s.get("role")||void 0,type:s.get("type")||void 0,priority:s.get("priority")?parseInt(s.get("priority"),10):void 0,status:c||l==="all"?void 0:l,search:s.get("search")||void 0}}}function hN(){return`pin-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function dN(){var X;const{collapsed:r}=fm(),{user:t}=It(),s=lN(),i=cN(),l=A.useMemo(()=>new Set(((t==null?void 0:t.roles)??[]).map(M=>M.role)),[t]),{data:c}=Su({enabled:l.size>0}),d=nn("SUMMARY");Js(lm(),()=>{d([["escalations"]])});const y=(X=s.data)==null?void 0:X.preferences,g=A.useMemo(()=>((c==null?void 0:c.roles)??[]).filter(M=>l.has(M.role)&&Array.isArray(M.default_pins)&&M.default_pins.length>0).map(M=>({role:M.role,pins:M.default_pins})),[c,l]),{resolveUrl:f}=bm(),m=A.useMemo(()=>uN(y,g),[y,g]),b=A.useMemo(()=>new Map(m.map(M=>[M.id,M.url])),[m]),x=A.useMemo(()=>m.map(M=>({...M,url:f(M.url)})),[m,f]),v=A.useMemo(()=>new Map(((c==null?void 0:c.roles)??[]).map(M=>[M.role,hv(M)])),[c]),w=A.useMemo(()=>x.filter(M=>!M.fromRole),[x]),S=A.useMemo(()=>g.map(({role:M})=>({role:M,title:v.get(M)??M,pins:x.filter($=>$.fromRole===M)})).filter(M=>M.pins.length>0),[g,v,x]),C=(y==null?void 0:y.pinnedViews)??[],L=A.useRef(null),U=M=>i.mutate({pinnedViews:M}),ne=M=>U(C.filter($=>$.id!==M)),se=M=>U([...C,{id:hN(),label:M.label,url:b.get(M.id)??M.url,badge:M.badge}]),D=M=>i.mutate({hiddenRolePins:[...(y==null?void 0:y.hiddenRolePins)??[],M]}),z=(M,$)=>{if(M===$)return;const Z=[...C],[J]=Z.splice(M,1);Z.splice($,0,J),U(Z)};if(x.length===0)return null;const ae="px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-text-tertiary truncate";return h.jsxs("div",{className:"space-y-1",children:[r&&h.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:"Pinned"}),!r&&w.length>0&&h.jsx("p",{className:ae,children:"Pinned"}),w.map(M=>{const $=C.findIndex(Z=>Z.id===M.id);return h.jsx(yb,{pin:M,collapsed:r,draggable:$!==-1,onDragStart:()=>{L.current=$},onDropOn:()=>{L.current!==null&&$!==-1&&z(L.current,$),L.current=null},onRemove:()=>ne(M.id)},M.id)}),S.map(M=>h.jsxs("div",{children:[!r&&h.jsx("p",{className:ae,title:`${M.title} — pins from the ${M.role} role`,"data-testid":"pin-group-label",children:M.title}),M.pins.map($=>h.jsx(yb,{pin:$,collapsed:r,draggable:!1,onDragStart:()=>{},onDropOn:()=>{},onPromote:()=>se($),onHide:()=>D($.label)},$.id))]},M.role))]})}function yb({pin:r,collapsed:t,draggable:s,onDragStart:i,onDropOn:l,onRemove:c,onPromote:d,onHide:y}){const{pathname:g,search:f}=wn(),[m,b=""]=r.url.split("?"),x=g===m&&f===(b?`?${b}`:""),v="group flex items-center rounded-md transition-colors duration-150",w=x?"bg-surface-hover text-text-primary font-medium":"text-text-secondary hover:text-text-primary hover:bg-surface-hover";return t?h.jsx(Ki,{to:r.url,className:`${v} ${w} justify-center w-10 h-10 mx-auto`,title:r.label,children:h.jsx(ag,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})}):h.jsxs("div",{className:`${v} ${w} relative`,draggable:s,onDragStart:i,onDragOver:S=>S.preventDefault(),onDrop:l,children:[h.jsxs(Ki,{to:r.url,title:r.label,className:"flex items-center gap-2.5 pl-4 pr-3 py-1.5 text-[0.7875rem] flex-1 min-w-0",children:[h.jsx(ag,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5,...r.fromRole?{}:{fill:"currentColor",fillOpacity:.15}}),h.jsx("span",{className:"truncate flex-1 min-w-0",children:r.label}),r.badge&&h.jsx(mN,{url:r.url})]}),h.jsxs("span",{className:"absolute right-1 top-1/2 -translate-y-1/2 flex items-center gap-0.5 rounded px-0.5 bg-surface-hover opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity",children:[d&&h.jsx("button",{onClick:d,title:"Make mine — copy into my pins",className:"p-1 text-text-quaternary hover:text-accent transition-colors",children:h.jsx(Mb,{className:"w-3 h-3"})}),y&&h.jsx("button",{onClick:y,title:"Hide this role pin",className:"p-1 text-text-quaternary hover:text-status-error transition-colors",children:h.jsx(Qw,{className:"w-3 h-3"})}),c&&h.jsx("button",{onClick:c,title:`Remove "${r.label}"`,className:"p-1 text-text-quaternary hover:text-status-error transition-colors",children:h.jsx(Jt,{className:"w-3 h-3"})})]})]})}function mN({url:r}){var d;const t=A.useMemo(()=>fN(r),[r]),s={limit:1,staleTime:15e3},i=Tx({...(t==null?void 0:t.params)??{},...s,enabled:!!t&&t.available}),l=Nx({...(t==null?void 0:t.params)??{},...s,enabled:!!t&&!t.available});if(!t)return null;const c=t.available?i:l;return c.isError||((d=c.data)==null?void 0:d.total)===void 0?null:h.jsx("span",{className:"shrink-0 text-right text-2xs leading-none tabular-nums text-accent/80 relative -top-[0.35em]",title:`${c.data.total} matching now`,children:c.data.total})}function pN(){var c;const{data:r}=Xn(),t=(c=r==null?void 0:r.features)==null?void 0:c.graphWorkflows,s=t===!0||t!==!1&&vx(),i=[{to:"/workflows/registry",label:"Registry",icon:og},{to:"/workflows/durable/invoke",label:"Invoke",icon:lg},{to:"/workflows/executions",label:"Executions",icon:cg}],l=s?[{kind:"group",label:"Procedural",icon:Zw,matchPaths:["/workflows/registry","/workflows/durable/invoke","/workflows/executions","/workflows/durable/executions","/workflows/start","/workflows/workers","/workflows/tasks"],items:i},{kind:"group",label:"Graph",icon:$d,matchPaths:["/mcp/workflows","/mcp/executions"],items:[{to:"/mcp/workflows",label:"Configure",icon:og,end:!0},{to:"/mcp/workflows/invoke",label:"Invoke",icon:lg},{to:"/mcp/executions",label:"Executions",icon:cg}]}]:i;return h.jsx(bs,{heading:"Orchestrate",entries:l})}const yN=[{to:"/mcp/queries",label:"Designer",icon:Ww},{to:"/mcp/servers",label:"Servers & Tools",icon:eS}];function gN(){return h.jsx(bs,{heading:"Design",entries:yN})}const bN=[{to:"/files",label:"Files",icon:tS},{to:"/knowledge",label:"Knowledge Base",icon:Rb}];function xN(){return h.jsx(bs,{heading:"Storage",entries:bN})}function vN({isBuilder:r=!1,isOps:t=!1}){var d;const{data:s}=Xn(),i=((d=s==null?void 0:s.features)==null?void 0:d.dbMaintenance)!==!1,l=[{to:"/admin/users",label:"Accounts",icon:nS},...r||t?[{to:"/admin/roles",label:"Roles",icon:id},{to:"/admin/personas",label:"Personas",icon:rS},{to:"/admin/scan-codes",label:"Scan Codes",icon:Id}]:[]],c=[{to:"/admin/controlplane",label:"Routers",icon:sS},{to:"/admin/streams",label:"Messages",icon:Rb},...i?[{to:"/admin/maintenance",label:"DB Maintenance",icon:iS}]:[]];return h.jsxs(h.Fragment,{children:[h.jsx(bs,{heading:"Identity & Access",entries:l}),r&&h.jsx(bs,{heading:"Infrastructure",entries:c})]})}function mv({aiEnabled:r,isBuilder:t,isOps:s,viewAs:i,canSeePaceBoard:l}){return h.jsxs(h.Fragment,{children:[h.jsx(oN,{aiEnabled:r,isBuilder:t,isOps:s,viewAs:i,canSeePaceBoard:l}),h.jsx(dN,{}),t&&h.jsx(pN,{}),t&&r&&h.jsx(gN,{}),t&&h.jsx(xN,{}),(t||s)&&h.jsx(vN,{isBuilder:t,isOps:s})]})}function _N({open:r,onClose:t,...s}){const i=wn();return A.useEffect(()=>{t()},[i.pathname]),h.jsxs("div",{className:`lg:hidden fixed inset-y-0 left-0 z-40 flex ${r?"":"pointer-events-none"}`,children:[h.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${r?"opacity-100":"opacity-0"}`,onClick:t,"aria-hidden":!0}),h.jsxs("div",{className:`relative w-72 max-w-[85vw] h-full bg-surface-raised border-r border-surface-border shadow-xl flex flex-col transition-transform duration-200 ease-out ${r?"translate-x-0":"-translate-x-full"}`,children:[h.jsx("div",{className:"flex items-center justify-end px-3 pt-3 shrink-0",children:h.jsx("button",{onClick:t,className:"p-1.5 rounded text-text-tertiary hover:text-text-primary hover:bg-surface-hover transition-colors","aria-label":"Close navigation",children:h.jsx(Jt,{className:"w-4 h-4"})})}),h.jsx("nav",{className:"flex-1 px-3 pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:h.jsx(WO,{children:h.jsx(mv,{...s})})})]})]})}const pv="lt_event_feed_patterns";function wN(r,t){if(r.startsWith("/topics/")){const d=decodeURIComponent(r.replace("/topics/",""));if(d&&!d.includes("/"))return`lt.events.${d}`}const s=r.match(/^\/escalations\/detail\/(.+)/);if(s)return`lt.events.system.escalation.*.${s[1]}.>`;if(r.startsWith("/escalations")){const d=new URLSearchParams(t).get("role");return d?`lt.events.system.escalation.${Ex(d)}.>`:"lt.events.system.escalation.>"}const i=r.match(/^\/workflows\/(?:durable\/)?executions\/(.+)/);if(i)return`lt.events.system.workflow.${i[1]}.>`;if(r.startsWith("/workflows"))return"lt.events.system.workflow.>";const l=r.match(/^\/agents\/([^/]+)$/);if(l&&l[1]!=="new")return`lt.events.system.agent.${l[1]}.>`;if(r.startsWith("/agents"))return"lt.events.system.agent.>";if(r.startsWith("/knowledge"))return"lt.events.system.knowledge.>";if(r.startsWith("/files"))return"lt.events.system.file.>";if(r==="/")return"lt.events.system.>";const c=r.match(/^\/mcp\/executions\/(.+)/);return c?`lt.events.system.*.${c[1]}.>`:(r.startsWith("/mcp"),"lt.events.system.>")}function SN(){try{const r=localStorage.getItem(pv);return r?JSON.parse(r):[]}catch{return[]}}function nd(r){try{localStorage.setItem(pv,JSON.stringify(r))}catch{}}function EN(){const{pathname:r,search:t}=wn(),[s,i]=A.useState(SN),l=A.useMemo(()=>wN(r,t),[r,t]),c=A.useMemo(()=>{const f=new Set([l,...s]);return Array.from(f)},[l,s]),d=A.useCallback(f=>{const m=f.startsWith("lt.events.")?f:`lt.events.${f}`;i(b=>{if(b.includes(m))return b;const x=[...b,m];return nd(x),x})},[]),y=A.useCallback(f=>{i(m=>{const b=m.filter(x=>x!==f);return nd(b),b})},[]),g=A.useCallback(()=>{i([]),nd([])},[]);return{patterns:c,pagePattern:l,userPatterns:s,addPattern:d,removePattern:y,clearUserPatterns:g}}function ON({children:r,className:t=""}){return h.jsx("p",{className:`text-2xs font-semibold uppercase tracking-widest text-text-tertiary ${t}`,children:r})}const rd=280,gb="cubic-bezier(0.4, 0, 0.2, 1)",Fc=40;function AN(r){if(!r)return"scale(0.92)";const t=window.innerWidth,s=window.innerHeight,i=t-Fc*2,l=s-Fc*2,c=r.width/i,d=r.height/l,y=r.left+r.width/2-(Fc+i/2),g=r.top+r.height/2-(Fc+l/2);return`translate(${y}px, ${g}px) scale(${c}, ${d})`}function yv({open:r,onClose:t,sourceRef:s,children:i}){const[l,c]=A.useState(null),d=A.useRef(null),y=A.useRef(!1);A.useEffect(()=>{var x,v;r&&!y.current?(d.current=((x=s==null?void 0:s.current)==null?void 0:x.getBoundingClientRect())??null,c("entering")):!r&&y.current&&l==="open"&&(d.current=((v=s==null?void 0:s.current)==null?void 0:v.getBoundingClientRect())??null,c("exiting")),y.current=r},[r,s,l]),A.useEffect(()=>{if(l!=="entering")return;const x=requestAnimationFrame(()=>{requestAnimationFrame(()=>c("open"))});return()=>cancelAnimationFrame(x)},[l]),A.useEffect(()=>{if(l)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[l]),A.useEffect(()=>{if(!l)return;const x=v=>{v.key==="Escape"&&t()};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[l,t]);const g=A.useCallback(x=>{x.propertyName==="transform"&&l==="exiting"&&c(null)},[l]);if(A.useEffect(()=>{if(l!=="exiting")return;const x=setTimeout(()=>c(null),rd+50);return()=>clearTimeout(x)},[l]),!l)return null;const f=l==="entering"||l==="exiting",m=f?AN(d.current):"none",b=f?0:1;return zd.createPortal(h.jsx("div",{className:"fixed inset-0 z-50 overflow-auto p-10",style:{transformOrigin:"center center",transition:`transform ${rd}ms ${gb}, opacity ${rd}ms ${gb}`,transform:m,opacity:b,backgroundColor:"rgb(var(--lt-surface))"},onTransitionEnd:g,children:i}),document.body)}function jN({className:r}){return h.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h8M4 18h12"})})}function kN({className:r}){return h.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 7l-5 5 5 5M16 7l5 5-5 5"})})}function NN({className:r}){return h.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3"})})}function TN({className:r}){return h.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}function CN({className:r}){return h.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 9V4.5M9 9H4.5M9 9L3.5 3.5M9 15v4.5M9 15H4.5M9 15l-5.5 5.5M15 9h4.5M15 9V4.5M15 9l5.5-5.5M15 15h4.5M15 15v4.5m0-4.5l5.5 5.5"})})}function MN({className:r}){return h.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}function RN(r){const t=r.trim().split(`
|
|
57
|
+
`);if(t.length<2)return r;const s=y=>y.split("|").map(g=>g.trim()).filter(Boolean),i=s(t[0]),l=t.slice(2),c=i.map(y=>`<th class="px-3 py-1.5 text-left text-2xs font-semibold uppercase tracking-wider text-text-tertiary">${y}</th>`).join(""),d=l.map(y=>`<tr class="border-t border-surface-border">${s(y).map(m=>`<td class="px-3 py-1.5 text-xs text-text-secondary">${m}</td>`).join("")}</tr>`).join("");return`<table class="w-full my-3 text-xs"><thead><tr class="border-b border-surface-border">${c}</tr></thead><tbody>${d}</tbody></table>`}function Gc(r){return r.toLowerCase().replace(/<[^>]+>/g,"").replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").trim()}function DN(r){const t=[];let s=r.replace(/```(\w*)\n([\s\S]*?)```/g,(g,f,m)=>{const b=t.length;return t.push(`<pre class="bg-surface-sunken rounded p-3 my-2 overflow-x-auto text-2xs leading-relaxed"><code>${m}</code></pre>`),`\0CODE${b}\0`});const i=/^(\|.+\|)\n(\|[-| :]+\|)\n((?:\|.+\|\n?)+)/gm;s=s.replace(i,(g,f,m,b)=>RN(`${f}
|
|
58
|
+
${m}
|
|
59
|
+
${b.trimEnd()}`)),s=s.replace(/`([^`]+)`/g,'<code class="bg-surface-sunken px-1 py-0.5 rounded text-2xs">$1</code>'),s=s.replace(/^#### (.+)$/gm,(g,f)=>`<h4 id="${Gc(f)}" class="text-xs font-semibold text-text-primary mt-4 mb-1">${f}</h4>`).replace(/^### (.+)$/gm,(g,f)=>`<h3 id="${Gc(f)}" class="text-sm font-semibold text-text-primary mt-5 mb-1.5">${f}</h3>`).replace(/^## (.+)$/gm,(g,f)=>`<h2 id="${Gc(f)}" class="text-base font-semibold text-text-primary mt-6 mb-2 pb-1 border-b border-surface-border">${f}</h2>`).replace(/^# (.+)$/gm,(g,f)=>`<h1 id="${Gc(f)}" class="text-lg font-bold text-text-primary mb-3">${f}</h1>`),s=s.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(#([^)]+)\)/g,'<a data-anchor="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]*\.md(?:#[^)]*)?)\)/g,'<a data-doc-link="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent hover:underline">$1</a>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^- (.+)$/gm,'<li class="ml-4 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^\d+\. (.+)$/gm,'<li class="ml-4 list-decimal text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^---+$/gm,'<hr class="border-surface-border my-4" />').replace(/(?:^> (.+)$\n?)+/gm,g=>{const f=g.replace(/^> /gm,"").trim(),m=/⚠️|warning|caution/i.test(f),b=/note:|ℹ️|info/i.test(f);return`<div class="${m?"bg-status-warning/5":b?"bg-accent/5":"bg-surface-sunken/50"} ${m?"border-status-warning":b?"border-accent":"border-text-tertiary"} border-l-2 rounded-r-md px-3 py-2 my-3 text-xs text-text-secondary leading-relaxed">${f}</div>`}).replace(/\n\n/g,"\0PARA\0").replace(/\n/g,"<br/>");const l=g=>g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=g=>new RegExp(`(${l(g)}[\\s\\S]*?<\\/li>(?:<br\\/>)?)+`,"g");s=s.replace(c('<li class="ml-8 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(c('<li class="ml-4 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(c('<li class="ml-4 list-decimal'),g=>`<ol class="list-decimal mb-3">${g}</ol>`),s=s.replace(/\x00CODE(\d+)\x00/g,(g,f)=>t[parseInt(f,10)]);const d="text-xs leading-relaxed text-text-secondary mb-2",y=/<\/(h[1-4]|pre|table|ul|ol|hr|div)>/;return s=s.split("\0PARA\0").map(g=>{const f=g.trim();if(!f)return"";const m=[];let b=f,x;for(;(x=y.exec(b))!==null;){const v=x.index+x[0].length;m.push(b.slice(0,v)),b=b.slice(v).replace(/^<br\/>/,"").trim(),y.lastIndex=0}return b&&m.push(b),m.map(v=>{const w=v.trim();return w?/^\s*<(h[1-4]|pre|table|ul|ol|hr|div)/.test(w)?w:`<p class="${d}">${w}</p>`:""}).join("")}).join(""),s}const qN=/(\*\*|^#{1,4}\s|^- |^\d+\.\s|```|^\|.*\|$|\[.+\]\(.+\))/m;function LN(r){return qN.test(r)}function ju({content:r,className:t,onClick:s}){const i=A.useMemo(()=>DN(r),[r]);return h.jsx("div",{className:t,onClick:s,dangerouslySetInnerHTML:{__html:i}})}function pu({data:r,depth:t=0,generation:s}){const l=s!==void 0&&s>0&&s%2===1?!1:t>0,[c,d]=A.useState(l),[y,g]=A.useState(s);if(s!==void 0&&s!==y&&(g(s),d(s%2===0&&t>0)),r==null)return h.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof r=="string")return h.jsxs("span",{className:"text-text-primary",children:['"',r,'"']});if(typeof r=="number"||typeof r=="boolean")return h.jsx("span",{className:"text-text-primary font-medium",children:String(r)});if(Array.isArray(r))return r.length===0?h.jsx("span",{className:"text-text-tertiary",children:"[]"}):c?h.jsxs("button",{onClick:()=>d(!1),className:"text-text-secondary hover:text-text-primary",children:["[",r.length," items]"]}):h.jsxs("span",{children:[h.jsx("button",{onClick:()=>d(!0),className:"text-text-tertiary hover:text-text-primary",children:"["}),h.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:r.map((f,m)=>h.jsxs("div",{children:[h.jsx(pu,{data:f,depth:t+1,generation:s}),m<r.length-1&&h.jsx("span",{className:"text-text-tertiary",children:","})]},m))}),h.jsx("span",{className:"text-text-tertiary",children:"]"})]});if(typeof r=="object"){const f=Object.entries(r);return f.length===0?h.jsx("span",{className:"text-text-tertiary",children:"{}"}):c?h.jsxs("button",{onClick:()=>d(!1),className:"text-text-secondary hover:text-text-primary",children:["{","...","}"]}):h.jsxs("span",{children:[h.jsx("button",{onClick:()=>d(!0),className:"text-text-tertiary hover:text-text-primary",children:"{"}),h.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:f.map(([m,b],x)=>h.jsxs("div",{children:[h.jsx("span",{className:"text-text-secondary",children:m}),h.jsx("span",{className:"text-text-tertiary",children:": "}),h.jsx(pu,{data:b,depth:t+1,generation:s}),x<f.length-1&&h.jsx("span",{className:"text-text-tertiary",children:","})]},m))}),h.jsx("span",{className:"text-text-tertiary",children:"}"})]})}return h.jsx("span",{children:String(r)})}function yo({data:r,depth:t=0}){if(r==null)return h.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof r=="string")return r.length>40&&LN(r)?h.jsx(ju,{content:r}):h.jsx("span",{className:"text-text-primary",children:r});if(typeof r=="number"||typeof r=="boolean")return h.jsx("span",{className:"text-text-primary font-medium",children:String(r)});if(Array.isArray(r))return r.length===0?h.jsx("span",{className:"text-text-tertiary italic",children:"empty list"}):h.jsx("div",{className:"space-y-2",children:r.map((s,i)=>h.jsxs("div",{className:"flex items-baseline gap-2",children:[h.jsxs("span",{className:"text-text-tertiary text-2xs shrink-0",children:[i+1,"."]}),h.jsx("div",{className:"flex-1",children:h.jsx(yo,{data:s,depth:t+1})})]},i))});if(typeof r=="object"){const s=Object.entries(r);return s.length===0?h.jsx("span",{className:"text-text-tertiary italic",children:"empty"}):h.jsx("div",{className:t>0?"pl-4 border-l border-surface-border space-y-3":"space-y-3",children:s.map(([i,l])=>{const c=l===null||typeof l!="object";return h.jsxs("div",{children:[h.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-0.5",children:i.replace(/[_-]/g," ")}),c?h.jsx("p",{className:"text-sm text-text-primary",children:h.jsx(yo,{data:l,depth:t+1})}):h.jsx(yo,{data:l,depth:t+1})]},i)})})}return h.jsx("span",{children:String(r)})}function bb({mode:r,setMode:t,isCollapsed:s,onToggleCollapse:i,onCopy:l,copied:c,onFullscreen:d,onClose:y,large:g}){const f=g?"w-5 h-5":"w-3.5 h-3.5",m=`${g?"p-2":"p-1.5"} rounded text-accent/60 hover:text-accent hover:bg-surface-raised transition-colors duration-150`;return h.jsxs("div",{className:"flex items-center gap-0.5 bg-surface-sunken/80 rounded-md backdrop-blur-sm",children:[r==="json"&&h.jsx("button",{onClick:i,className:m,title:s?"Expand all":"Collapse all",children:s?h.jsx(MN,{className:f}):h.jsx(CN,{className:f})}),h.jsx("button",{onClick:()=>t(r==="json"?"tree":"json"),className:m,title:r==="json"?"Outline view":"JSON view",children:r==="json"?h.jsx(jN,{className:f}):h.jsx(kN,{className:f})}),h.jsx("button",{onClick:l,className:m,title:"Copy to clipboard",children:c?h.jsx(TN,{className:`${f} text-status-success`}):h.jsx(NN,{className:f})}),d&&h.jsx("button",{onClick:d,className:m,title:"Fullscreen",children:h.jsx(Db,{className:f})}),y&&h.jsx("button",{onClick:y,className:m,title:"Close (Esc)",children:h.jsx(qb,{className:f})})]})}function BN({data:r,label:t,variant:s,defaultCollapsed:i=!1,defaultMode:l}){const c=A.useRef(null),[d,y]=A.useState(l??"json"),[g,f]=A.useState(!1),[m,b]=A.useState(!1),[x,v]=A.useState(i?0:1),[w,S]=A.useState(1),C=x%2===0,L=w%2===0,U=A.useCallback(()=>v($=>$+1),[]),ne=A.useCallback(()=>S($=>$+1),[]);let se=r;if(typeof r=="string")try{se=JSON.parse(r)}catch{}const D=async()=>{const $=typeof r=="string"?r:JSON.stringify(se,null,2);await navigator.clipboard.writeText($),f(!0),setTimeout(()=>f(!1),2e3)},z=A.useCallback(()=>{S(1),b(!0)},[]),ae=s==="panel",X=ae?"border border-accent-muted/40 rounded-lg p-3 bg-surface-hover/30":"",M=ae?"font-mono text-xs leading-relaxed bg-surface-raised rounded-md p-4 overflow-x-auto break-all":"font-mono text-xs leading-relaxed bg-surface-sunken border border-surface-border rounded-md p-4 overflow-x-auto break-all";return h.jsxs("div",{className:X,children:[t&&h.jsx(ON,{children:t}),h.jsxs("div",{ref:c,className:"relative",children:[h.jsx("div",{className:"absolute top-2 right-2 z-[5]",children:h.jsx(bb,{mode:d,setMode:y,isCollapsed:C,onToggleCollapse:U,onCopy:D,copied:g,onFullscreen:z})}),h.jsx("div",{className:M,children:d==="json"?h.jsx(pu,{data:se,generation:x}):h.jsx(yo,{data:se})})]}),h.jsxs(yv,{open:m,onClose:()=>b(!1),sourceRef:c,children:[h.jsx("div",{className:"sticky top-0 float-right z-10",children:h.jsx(bb,{mode:d,setMode:y,isCollapsed:L,onToggleCollapse:ne,onCopy:D,copied:g,onClose:()=>b(!1),large:!0})}),h.jsx("div",{className:"font-mono text-sm leading-relaxed",children:d==="json"?h.jsx(pu,{data:se,generation:w}):h.jsx(yo,{data:se})})]})]})}const UN=100,xb=500;let PN=0;const gv={"escalation.created":"text-status-active","escalation.claimed":"text-status-warning","escalation.released":"text-text-tertiary","escalation.resolved":"text-status-success","task.created":"text-accent","task.completed":"text-status-success","task.failed":"text-status-error","task.escalated":"text-status-warning","workflow.started":"text-accent","workflow.completed":"text-status-success","workflow.failed":"text-status-error","activity.started":"text-status-active","activity.completed":"text-status-success","activity.failed":"text-status-error","knowledge.stored":"text-accent","knowledge.deleted":"text-text-tertiary","agent.started":"text-accent","agent.completed":"text-status-success","agent.failed":"text-status-error","agent.status_changed":"text-status-active",milestone:"text-accent"};function bv(r){const t=r.split(".");return t[0]==="system"&&t.length>=3?`${t[1]}.${t[t.length-1]}`:r}function vb({event:r,forceExpanded:t=!1}){var x,v;const[s,i]=A.useState(t),l=gv[bv(r.type)]||"text-text-tertiary";A.useEffect(()=>{i(t)},[t]);const c=t,d=c?"text-xs":"text-2xs",y=c?"text-xs":"text-2xs",g=c?"text-xs":"text-2xs",f=c?"w-3.5 h-3.5":"w-2.5 h-2.5",m=c?"py-2 px-4":"py-1 px-3",b=c?"pb-4 px-4":"pb-2 px-3";return h.jsxs("div",{className:"border-b border-surface-border/30 last:border-b-0",children:[h.jsxs("button",{onClick:()=>i(!s),className:`flex items-center gap-2 ${m} w-full text-left hover:bg-surface-hover/50 transition-colors`,children:[h.jsx("span",{className:`${d} font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0`,children:new Date(r.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),h.jsx("span",{className:`${y} font-medium px-1 py-0.5 rounded ${l} bg-surface-sunken whitespace-nowrap shrink-0`,children:r.type}),h.jsxs("span",{className:`${g} text-text-tertiary font-mono flex-1 min-w-0 truncate`,children:[(x=r.data)!=null&&x.workflowId?String(r.data.workflowId):"",(v=r.data)!=null&&v.escalationId?` esc:${String(r.data.escalationId).slice(0,12)}`:""]}),h.jsx("svg",{className:`${f} text-text-tertiary shrink-0 transition-transform duration-150 ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),h.jsx(xm,{open:s,children:h.jsx("div",{className:b,children:h.jsx(BN,{data:r.data})})})]})}function zN({open:r,onToggle:t,configOpen:s,onToggleConfig:i}){const[l,c]=A.useState([]),[d,y]=A.useState(!1),[g,f]=A.useState(""),m=A.useRef(null),b=A.useRef(new Map),{subscribe:x}=A.useContext(ea),{connected:v}=ix(),{patterns:w,pagePattern:S,userPatterns:C,addPattern:L,removePattern:U}=EN(),ne=A.useCallback(z=>{const ae=String(z.type||"unknown");if(ae.startsWith("mesh."))return;const X=`${ae}:${z.timestamp||""}:${z.escalationId||z.workflowId||z.taskId||""}`,M=Date.now(),$=b.current.get(X);if(!($&&M-$<xb)){if(b.current.set(X,M),b.current.size>200)for(const[Z,J]of b.current)M-J>xb*2&&b.current.delete(Z);c(Z=>[{id:++PN,type:ae,timestamp:z.timestamp||new Date().toISOString(),data:z},...Z].slice(0,UN))}},[]),se=A.useRef(ne);se.current=ne;const D=r||d||s;return A.useEffect(()=>{if(!D)return;const z=w.map(ae=>x(ae,X=>se.current(X)));return()=>z.forEach(ae=>ae())},[x,w.join(","),D]),A.useEffect(()=>{r&&m.current&&(m.current.scrollTop=0)},[l.length,r]),h.jsxs("div",{className:"shrink-0 border-t border-surface-border bg-surface-raised",children:[h.jsxs("button",{onClick:t,className:"flex items-center gap-2 w-full px-4 py-1.5 text-left hover:bg-surface-hover transition-colors",children:[r?h.jsx(Lb,{className:"w-3 h-3 text-text-tertiary"}):h.jsx(Bb,{className:"w-3 h-3 text-text-tertiary"}),h.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:"Event Stream"}),l.length>0&&h.jsxs("span",{className:"text-2xs text-text-tertiary",children:[l.length," events"]}),l.length>0&&!r&&h.jsx("span",{className:`text-2xs font-medium px-1 py-0.5 rounded ${gv[bv(l[0].type)]||"text-text-tertiary"} bg-surface-sunken`,children:l[0].type}),h.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[h.jsx("span",{className:`p-0.5 ${v?"text-status-success":"text-text-quaternary hover:text-text-secondary cursor-pointer"}`,title:v?"Live events connected":"Events disconnected — click to reconnect",onClick:z=>{z.stopPropagation(),v||window.location.reload()},children:h.jsx(Cb,{className:"w-3 h-3"})}),h.jsx("span",{className:`p-0.5 cursor-pointer ${s?"text-accent":"text-text-tertiary hover:text-text-primary"}`,title:"Subscription config",onClick:z=>{z.stopPropagation(),i()},children:h.jsx(aS,{className:"w-3 h-3"})}),l.length>0&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Fullscreen",onClick:z=>{z.stopPropagation(),y(!0)},children:h.jsx(Db,{className:"w-3 h-3"})}),h.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Clear events",onClick:z=>{z.stopPropagation(),c([])},children:h.jsx(oS,{className:"w-3 h-3"})})]})]})]}),s&&h.jsxs("div",{className:"px-4 py-2 border-t border-surface-border/50 bg-surface-sunken/30",children:[h.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mb-1.5",children:[h.jsx("span",{className:"text-2xs text-text-quaternary uppercase tracking-wider shrink-0",children:"Subscribed:"}),h.jsx("span",{className:"text-2xs font-mono text-accent px-1.5 py-0.5 bg-accent/10 rounded",children:S.replace("lt.events.","")}),C.map(z=>h.jsxs("span",{className:"inline-flex items-center gap-1 text-2xs font-mono text-text-secondary px-1.5 py-0.5 bg-surface-sunken rounded",children:[z.replace("lt.events.",""),h.jsx("button",{onClick:()=>U(z),className:"text-text-quaternary hover:text-status-error",children:h.jsx(Jt,{className:"w-2 h-2"})})]},z))]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("input",{type:"text",value:g,onChange:z=>f(z.target.value),onKeyDown:z=>{z.key==="Enter"&&g.trim()&&(L(g.trim()),f(""))},placeholder:"task.> or file.stored",className:"input text-2xs font-mono flex-1 py-1"}),h.jsxs("button",{onClick:()=>{g.trim()&&(L(g.trim()),f(""))},className:"text-2xs text-accent hover:text-accent-hover flex items-center gap-0.5",children:[h.jsx(Mb,{className:"w-2.5 h-2.5"})," Add"]})]})]}),h.jsx(xm,{open:r,children:h.jsx("div",{ref:m,className:"h-48 overflow-y-auto",children:l.length===0?h.jsx("p",{className:"text-2xs text-text-tertiary py-4 text-center",children:"Waiting for events..."}):l.map(z=>h.jsx(vb,{event:z},z.id))})}),h.jsxs(yv,{open:d,onClose:()=>y(!1),sourceRef:m,children:[h.jsx("div",{className:"sticky top-0 float-right z-10",children:h.jsx("button",{onClick:()=>y(!1),className:"p-2 rounded text-text-tertiary hover:text-text-primary hover:bg-surface-raised transition-colors duration-150 bg-surface-sunken/80 backdrop-blur-sm",title:"Close (Esc)",children:h.jsx(qb,{className:"w-5 h-5"})})}),l.length===0?h.jsx("p",{className:"text-sm text-text-tertiary py-8",children:"No events captured"}):l.map(z=>h.jsx(vb,{event:z,forceExpanded:!0},z.id))]})]})}function IN(){return We({queryKey:["docs"],queryFn:()=>me("/docs"),staleTime:5*6e4})}function $N(r){return We({queryKey:["docs",r],queryFn:()=>me(`/docs/read?path=${encodeURIComponent(r)}`),enabled:!!r,staleTime:5*6e4})}function HN(){const[r,t]=A.useState([]),[s,i]=A.useState([]),[l,c]=A.useState(null),d=A.useRef(l),y=A.useRef(r),g=A.useRef(s);d.current=l,y.current=r,g.current=s;const f=A.useCallback((w,S)=>{var L;const C=d.current;if(C){const U=((L=S==null?void 0:S.current)==null?void 0:L.scrollTop)??0;t([...y.current,{...C,scrollTop:U}])}i([]),c({path:w,scrollTop:0})},[]),m=A.useCallback(w=>{var U;const S=y.current;if(S.length===0)return;const C=S[S.length-1],L=d.current;if(L){const ne=((U=w==null?void 0:w.current)==null?void 0:U.scrollTop)??0;i([...g.current,{...L,scrollTop:ne}])}t(S.slice(0,-1)),c(C),requestAnimationFrame(()=>{w!=null&&w.current&&(w.current.scrollTop=C.scrollTop)})},[]),b=A.useCallback(w=>{var U;const S=g.current;if(S.length===0)return;const C=S[S.length-1],L=d.current;if(L){const ne=((U=w==null?void 0:w.current)==null?void 0:U.scrollTop)??0;t([...y.current,{...L,scrollTop:ne}])}i(S.slice(0,-1)),c(C),requestAnimationFrame(()=>{w!=null&&w.current&&(w.current.scrollTop=C.scrollTop)})},[]),x=A.useCallback(w=>{var L,U;const S=d.current;if(!S)return;const C=((L=w==null?void 0:w.current)==null?void 0:L.scrollTop)??0;t([...y.current,{...S,scrollTop:C}]),i([]),c({...S,scrollTop:((U=w==null?void 0:w.current)==null?void 0:U.scrollTop)??0})},[]),v=A.useCallback(()=>{t([]),i([]),c(null)},[]);return{current:l,backStack:r,forwardStack:s,navigate:f,goBack:m,goForward:b,pushScrollPosition:x,reset:v}}function FN(r,t){const[s,i]=r.split("#");let l=s;if(l.startsWith("./")||l.startsWith("../")){const d=((t?t.replace(/[^/]+$/,""):"")+l).split("/"),y=[];for(const g of d)g===".."?y.pop():g&&g!=="."&&y.push(g);l=y.join("/")}return{path:l,anchor:i}}function GN(r){if(!r.startsWith("#docs"))return null;const t=r.slice(1).split(":"),s=t[1]||"README.md",i=t[2]||void 0;return{path:s,anchor:i}}function VN(r){return!r||r==="README.md"?"#docs":`#docs:${r}`}function YN({content:r,currentPath:t,onNavigate:s,onAnchorClick:i}){const l=c=>{var f;const d=c.target,y=d.closest("[data-anchor]");if(y){c.preventDefault(),i();const m=y.dataset.anchor,b=(f=y.closest(".docs-content"))==null?void 0:f.querySelector(`#${CSS.escape(m)}`);b==null||b.scrollIntoView({behavior:"smooth",block:"start"});return}const g=d.closest("[data-doc-link]");if(g){c.preventDefault();const{path:m,anchor:b}=FN(g.dataset.docLink,t);s(m,b);return}};return h.jsx(ju,{content:r,className:"docs-content",onClick:l})}function KN(r){const t=[],s=new Map;for(const i of r){const l=i.path.split("/");if(l.length===1){t.push(i);continue}let c=s;for(let d=0;d<l.length-1;d++){const y=l[d];c.has(y)||c.set(y,{label:y,children:[],subdirs:new Map});const g=c.get(y);d===l.length-2?g.children.push(i):c=g.subdirs}}return{topLevel:t,dirs:s}}function JN({docs:r,selected:t,onSelect:s}){const{topLevel:i,dirs:l}=KN(r),c=y=>`block w-full text-left px-3 py-1 text-xs rounded truncate transition-colors ${t===y?"bg-accent/10 text-accent":"text-text-secondary hover:bg-surface-hover"}`;function d(y,g){return h.jsxs("details",{open:!0,children:[h.jsxs("summary",{className:"flex items-center gap-1.5 px-3 py-1 text-2xs font-semibold uppercase tracking-widest text-text-tertiary cursor-pointer",children:[h.jsx(lS,{className:"w-3 h-3",strokeWidth:1.5}),y.label]}),h.jsxs("div",{className:"pl-2 space-y-0.5",children:[[...y.subdirs.values()].map(f=>d(f)),y.children.map(f=>h.jsx("button",{className:c(f.path),onClick:()=>s(f.path),children:f.title},f.path))]})]},y.label)}return h.jsxs("div",{className:"space-y-0.5",children:[i.map(y=>h.jsx("button",{className:c(y.path),onClick:()=>s(y.path),children:y.title},y.path)),[...l.values()].map(y=>d(y))]})}function XN({open:r,onClose:t}){var ae,X,M;const[s,i]=A.useState(!1),{data:l}=IN(),c=HN(),{data:d,isLoading:y}=$N(((ae=c.current)==null?void 0:ae.path)??null),g=A.useRef(null),[f,m]=A.useState(null);A.useEffect(()=>{f&&(d!=null&&d.content)&&g.current&&requestAnimationFrame(()=>{var Z;const $=(Z=g.current)==null?void 0:Z.querySelector(`#${CSS.escape(f)}`);$==null||$.scrollIntoView({behavior:"smooth",block:"start"}),m(null)})},[f,d]);const b=A.useCallback(()=>{var J;const $=GN(window.location.hash),Z=($==null?void 0:$.path)??"README.md";((J=c.current)==null?void 0:J.path)!==Z&&c.navigate(Z,g),$!=null&&$.anchor&&m($.anchor)},[c]),x=A.useRef(!0);A.useEffect(()=>{if(!r||!c.current)return;if(x.current){x.current=!1;return}const $=VN(c.current.path);window.location.hash!==$&&window.history.replaceState(null,"",window.location.pathname+window.location.search+$)},[r,(X=c.current)==null?void 0:X.path]),A.useEffect(()=>{if(!r)return;const $=()=>{window.location.hash.startsWith("#docs")&&b()};return window.addEventListener("hashchange",$),()=>window.removeEventListener("hashchange",$)},[r,b]);const v=A.useCallback(($,Z)=>{Z&&m(Z),c.navigate($,g)},[c]),w=A.useCallback($=>{c.navigate($,g)},[c]),S=A.useCallback(()=>{c.goBack(g)},[c]),C=A.useCallback(()=>{c.goForward(g)},[c]),L=A.useCallback(()=>{c.pushScrollPosition(g)},[c]);if(A.useEffect(()=>{if(r){x.current=!0,b();const $=requestAnimationFrame(()=>i(!0));return()=>cancelAnimationFrame($)}},[r]),!(r||s))return null;const ne=()=>{i(!1),setTimeout(()=>{t(),c.reset()},200)},se=((M=c.current)==null?void 0:M.path)??null,D=c.backStack.length>0,z=c.forwardStack.length>0;return h.jsxs("div",{className:"fixed inset-y-0 right-0 z-50 flex",children:[h.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${s&&r?"opacity-100":"opacity-0"}`,onClick:ne}),h.jsxs("div",{className:`relative ml-auto w-[40vw] min-w-[800px] max-w-[90vw] h-full bg-surface-raised border-l border-surface-border flex flex-col shadow-xl transition-transform duration-200 ease-out ${s&&r?"translate-x-0":"translate-x-full"}`,children:[h.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border shrink-0",children:[h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("button",{onClick:S,disabled:!D,className:`p-0.5 transition-colors ${D?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Back",children:h.jsx(Tb,{className:"w-4 h-4"})}),h.jsx("button",{onClick:C,disabled:!z,className:`p-0.5 transition-colors ${z?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Forward",children:h.jsx(sd,{className:"w-4 h-4"})}),h.jsx(cS,{className:"w-4 h-4 text-accent ml-1",strokeWidth:1.5}),h.jsx("span",{className:"text-sm font-medium text-text-primary",children:"Documentation"})]}),h.jsx("button",{onClick:ne,className:"p-1 text-text-tertiary hover:text-text-primary",children:h.jsx(Jt,{className:"w-4 h-4"})})]}),h.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[h.jsx("div",{className:"w-48 shrink-0 border-r border-surface-border overflow-y-auto py-2",children:l!=null&&l.docs?h.jsx(JN,{docs:l.docs,selected:se,onSelect:w}):h.jsx("div",{className:"px-3 py-2 text-xs text-text-tertiary",children:"Loading..."})}),h.jsx("div",{ref:g,className:"flex-1 overflow-y-auto px-6 py-4",children:se?y?h.jsxs("div",{className:"animate-pulse space-y-2",children:[h.jsx("div",{className:"h-6 bg-surface-sunken rounded w-48"}),h.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),h.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"})]}):d!=null&&d.content?h.jsx(YN,{content:d.content,currentPath:se,onNavigate:v,onAnchorClick:L}):h.jsx("p",{className:"text-xs text-text-tertiary",children:"Document not found."}):h.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-text-tertiary",children:[h.jsx(sd,{className:"w-5 h-5 mb-2"}),h.jsx("p",{className:"text-xs",children:"Select a document"})]})})]})]})]})}function QN(r){if(r.includes("/escalations"))return["escalation","human-queue"]}const _b=2e3;function ZN(r){const s=r.filter(l=>!l.pending).slice(-8);return s.length===0?"":`[Prior conversation]
|
|
60
|
+
${s.map(l=>`${l.role==="user"?"User":"Assistant"}: ${l.content}`).join(`
|
|
61
|
+
`)}
|
|
62
|
+
[End prior conversation]
|
|
63
|
+
|
|
64
|
+
`}function WN(r){const t=r.summary,s=r.title;if(t){const i=t.search(/\n\s*\{[\s\S]*"title"\s*:/);return i>0?t.slice(0,i).trim():t}return s||(typeof r=="string"?r:"Query completed.")}const xv=A.createContext(null);function eT({children:r}){const t=wn(),[s,i]=A.useState(!1),[l,c]=A.useState([]),[d,y]=A.useState(null),[g,f]=A.useState({}),m=A.useRef(null),b={page:t.pathname.split("/").filter(Boolean).join("-")||"home",route:t.pathname,params:{},...g,suggestedTags:g.suggestedTags??QN(t.pathname)};A.useEffect(()=>()=>{m.current&&clearInterval(m.current)},[]);const x=A.useCallback(()=>i(L=>!L),[]),v=A.useCallback(L=>{f(L)},[]),w=A.useCallback(()=>{c([]),y(null)},[]),S=A.useCallback(async L=>{var X;const U=new Date().toISOString(),ne={id:`user-${Date.now()}`,role:"user",content:L,timestamp:U},se={id:`pending-${Date.now()}`,role:"assistant",content:"",timestamp:U,pending:!0};c(M=>[...M,ne,se]);const D={...b};(X=D.entities)!=null&&X.yamlContent&&D.entities.yamlContent.length>_b&&(D.entities={...D.entities,yamlContent:D.entities.yamlContent.slice(0,_b)+`
|
|
65
|
+
... (truncated)`});const ae=`${ZN(l.concat(ne))}${L}`;try{const $=(await me("/insight/mcp-query",{method:"POST",body:JSON.stringify({prompt:ae,tags:D.suggestedTags,context:D,wait:!1,direct:!0})})).workflow_id;y($),c(Z=>Z.map(J=>J.id===se.id?{...J,workflowId:$}:J)),m.current&&clearInterval(m.current),m.current=setInterval(async()=>{var Z;try{const J=await me(`/workflows/${$}/result`),le=(Z=J==null?void 0:J.result)==null?void 0:Z.data;if(le){m.current&&clearInterval(m.current),m.current=null,y(null);const ve=WN(le);let Re;try{Re=(await me(`/workflow-states/${$}/execution`)).duration_ms}catch{}c(Y=>Y.map(oe=>oe.id===se.id?{...oe,content:ve,timestamp:new Date().toISOString(),pending:!1,durationMs:Re}:oe))}}catch{}},3e3)}catch{c(M=>M.map($=>$.id===se.id?{...$,content:"Failed to submit query. Please try again.",pending:!1}:$))}},[l,b]),C=A.useCallback(async L=>{const U=l.find(D=>D.id===L);if(!(U!=null&&U.workflowId)||U.compilationStatus==="compiling"||U.compilationStatus==="done")return;const ne=l.indexOf(U),se=l.slice(0,ne).reverse().find(D=>D.role==="user");if(se){c(D=>D.map(z=>z.id===L?{...z,compilationStatus:"compiling"}:z));try{const D=await me("/insight/mcp-query/describe",{method:"POST",body:JSON.stringify({prompt:se.content,summary:U.content})}),z=await me("/yaml-workflows",{method:"POST",body:JSON.stringify({workflow_id:U.workflowId,task_queue:"long-tail-system",workflow_name:"mcpQuery",name:D.tool_name,description:D.description,tags:D.tags,app_id:""})});await me(`/yaml-workflows/${z.id}/deploy`,{method:"POST"}),c(ae=>ae.map(X=>X.id===L?{...X,compilationStatus:"done"}:X))}catch(D){const z=D instanceof Error?D.message:"Compilation failed";c(ae=>ae.map(X=>X.id===L?{...X,compilationStatus:"error",compilationError:z}:X))}}},[l]);return h.jsx(xv.Provider,{value:{helpOpen:s,setHelpOpen:i,toggleHelp:x,messages:l,sendMessage:S,pageContext:b,setPageContext:v,activeWorkflowId:d,clearMessages:w,compileMessage:C},children:r})}function vv(){const r=A.useContext(xv);if(!r)throw new Error("useHelpAssistant must be used within HelpAssistantProvider");return r}function tT(){const{helpOpen:r,toggleHelp:t}=vv();return h.jsx("button",{onClick:t,className:"fixed right-3 z-[45] flex items-center justify-center w-10 h-10 rounded-full bg-surface-raised shadow-lg hover:scale-110 transition-transform duration-150 border border-accent/30",style:{bottom:"44px"},"aria-label":r?"Close help":"Ask for help",children:r?h.jsx(Jt,{className:"w-5 h-5 text-text-tertiary",strokeWidth:1.5}):h.jsx("span",{role:"img","aria-label":"Help",className:"logo-mark w-8 h-8 -rotate-[120deg]",style:{"--logo-url":`url(${Bt}/logo512.png)`}})})}function nT({ms:r,className:t=""}){const s=_j(r),i=A.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?h.jsx("span",{className:`text-xs text-text-tertiary ${t}`,children:"--"}):h.jsx(Ux,{options:i,children:h.jsx("span",{className:`text-xs text-text-tertiary ${t}`,children:s})})}const rT=["sm","md","lg","full"],wb={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"},Sb={sm:"Small",md:"Medium",lg:"Large",full:"Fullscreen"};function sT({which:r}){const t="stroke-current";switch(r){case"sm":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"5",y:"5",width:"7",height:"7",rx:"1.5",className:t,strokeWidth:"1.5"})});case"md":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"3",y:"3",width:"9",height:"9",rx:"1.5",className:t,strokeWidth:"1.5"})});case"lg":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"1.5",y:"1.5",width:"11",height:"11",rx:"1.5",className:t,strokeWidth:"1.5"})});case"full":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"0.75",y:"0.75",width:"12.5",height:"12.5",rx:"1.5",className:t,strokeWidth:"1.5"})})}}function iT({msg:r}){const[t,s]=A.useState(0);A.useEffect(()=>{const d=new Date(r.timestamp).getTime(),y=()=>s(Math.floor((Date.now()-d)/1e3));y();const g=setInterval(y,1e3);return()=>clearInterval(g)},[r.timestamp]);const i=Math.floor(t/60),l=t%60,c=i>0?`${i}m ${l}s`:`${l}s`;return h.jsxs("span",{className:"inline-flex flex-col gap-1.5",children:[h.jsxs("span",{className:"inline-flex items-center gap-1",children:[h.jsx("span",{className:"text-text-tertiary",children:"Thinking"}),h.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse"}),h.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:150ms]"}),h.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:300ms]"}),h.jsx("span",{className:"text-text-muted ml-1 tabular-nums",children:c})]}),r.workflowId&&h.jsxs(kr,{to:`/workflows/executions/${r.workflowId}`,className:"inline-flex items-center gap-1 text-2xs text-accent/70 hover:text-accent transition-colors",children:[h.jsx($d,{className:"w-2.5 h-2.5",strokeWidth:1.5}),"watch execution"]})]})}function aT({msg:r,compileMessage:t}){const s=r.role==="assistant";return h.jsxs("div",{className:`flex items-center gap-1.5 ${s?"justify-start":"justify-end"}`,children:[h.jsx(Px,{date:r.timestamp,format:"time",className:"!text-2xs text-text-muted/50"}),r.durationMs!=null&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-text-muted/30 text-2xs",children:"·"}),h.jsx(nT,{ms:r.durationMs,className:"!text-2xs text-text-muted/50"})]}),r.workflowId&&h.jsx(kr,{to:`/workflows/executions/${r.workflowId}`,className:"text-text-muted/40 hover:text-accent transition-colors",title:"View workflow execution",children:h.jsx($d,{className:"w-2.5 h-2.5",strokeWidth:1.5})}),s&&r.workflowId&&!r.pending&&h.jsx("button",{onClick:()=>t(r.id),disabled:r.compilationStatus==="compiling"||r.compilationStatus==="done",className:"transition-colors",title:r.compilationStatus==="done"?"Compiled — future queries will match this pipeline":r.compilationStatus==="error"?r.compilationError??"Compilation failed":r.compilationStatus==="compiling"?"Compiling...":"Compile to fast pipeline",children:h.jsx(uS,{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 oT(){const{helpOpen:r,setHelpOpen:t,messages:s,sendMessage:i,pageContext:l,activeWorkflowId:c,clearMessages:d,compileMessage:y}=vv(),[g,f]=A.useState(""),[m,b]=A.useState("md"),[x,v]=A.useState(!0),w=A.useRef(null),S=A.useRef(null);if(A.useEffect(()=>{w.current&&(w.current.scrollTop=w.current.scrollHeight)},[s]),A.useEffect(()=>{r&&S.current&&S.current.focus()},[r]),A.useEffect(()=>{if(!r)return;const D=z=>{z.key==="Escape"&&(m==="full"?b("lg"):m==="lg"?b("md"):m==="md"?b("sm"):t(!1))};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[r,m,t]),!r)return null;const C=()=>{const D=g.trim();!D||c||(i(D),f(""),S.current&&(S.current.style.height="auto"))},L=D=>{D.key==="Enter"&&!D.shiftKey&&(D.preventDefault(),C())},U=m==="full",ne=l.page.replace(/-/g," "),se=U?{}:{bottom:"108px"};return h.jsxs("div",{className:`fixed z-[45] flex flex-col border border-surface-border rounded-lg overflow-hidden transition-all duration-300 ${U?wb.full:`right-6 ${wb[m]}`} ${x?"bg-surface-raised shadow-xl":"bg-surface-raised/[0.03] shadow-lg shadow-black/5"}`,style:se,onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1),children:[h.jsxs("div",{className:`flex items-center justify-between px-4 py-2.5 border-b border-surface-border shrink-0 transition-all duration-300 ${x?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsx("p",{className:"text-xs font-medium text-text-primary truncate",children:"Help Assistant"}),h.jsx("p",{className:"text-2xs text-text-tertiary truncate",children:ne})]}),h.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[h.jsx("div",{className:"flex items-center gap-0.5 border border-surface-border rounded p-0.5",role:"radiogroup","aria-label":"Panel size",children:rT.map(D=>h.jsx("button",{onClick:()=>b(D),className:`p-1 rounded transition-colors ${D===m?"bg-accent/15 text-accent":"text-text-muted hover:text-text-secondary hover:bg-surface-hover"}`,role:"radio","aria-checked":D===m,"aria-label":Sb[D],title:Sb[D],children:h.jsx(sT,{which:D})},D))}),s.length>0&&h.jsx("button",{onClick:d,className:"p-1 text-text-tertiary hover:text-text-secondary transition-colors","aria-label":"Clear conversation",title:"Clear conversation",children:h.jsx(fS,{className:"w-3.5 h-3.5",strokeWidth:1.5})}),h.jsx("button",{onClick:()=>t(!1),className:"p-1 text-text-tertiary hover:text-text-primary transition-colors","aria-label":"Close",title:"Close",children:h.jsx(Jt,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]})]}),h.jsxs("div",{ref:w,className:`flex-1 overflow-y-auto px-4 py-3 space-y-3 min-h-[120px] transition-all duration-300 ${x?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[s.length===0&&h.jsx("p",{className:"text-xs text-text-tertiary text-center py-6",children:"Ask anything about what you're viewing."}),s.map(D=>h.jsxs("div",{className:`text-xs leading-relaxed ${D.role==="user"?"text-right":"text-left"}`,children:[h.jsx("div",{className:`inline-block max-w-[85%] px-3 py-2 rounded-md whitespace-pre-wrap ${D.role==="user"?"bg-accent/10 text-text-primary":"bg-surface-sunken text-text-secondary"}`,children:D.pending?h.jsx(iT,{msg:D}):D.role==="assistant"?h.jsx(ju,{content:D.content}):D.content}),!D.pending&&h.jsx("div",{className:"mt-0.5",children:h.jsx(aT,{msg:D,compileMessage:y})})]},D.id))]}),h.jsxs("div",{className:`border-t border-surface-border px-3 py-2.5 flex gap-2 shrink-0 transition-all duration-300 ${x?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[h.jsx("textarea",{ref:S,value:g,onChange:D=>{f(D.target.value);const z=D.target;z.style.height="auto",z.style.height=`${Math.min(z.scrollHeight,120)}px`},onKeyDown:L,placeholder:"Ask a question...",rows:2,className:"flex-1 resize-none bg-surface text-xs text-text-primary placeholder:text-text-tertiary rounded px-2.5 py-1.5 border border-surface-border focus:outline-none focus:border-accent",style:{minHeight:"2.5rem"},disabled:!!c}),h.jsx("button",{onClick:C,disabled:!g.trim()||!!c,className:"px-2.5 py-1.5 text-accent hover:text-accent-hover disabled:text-text-muted transition-colors self-end","aria-label":"Send",children:h.jsx(hS,{className:"w-4 h-4",strokeWidth:1.5})})]})]})}const lT=6e3,cT="scan";function uT(){const{lastResult:r}=Qx(),{open:t,ownerKey:s}=dm(),[i,l]=A.useState(null);if(A.useEffect(()=>{if(!r)return;const d=setTimeout(()=>l(r.at),lT);return()=>clearTimeout(d)},[r]),!r||r.navigated||i===r.at||t&&s===cT)return null;const{response:c}=r;return h.jsx("div",{role:"status",className:"fixed bottom-14 right-4 z-[60] w-80 max-w-[calc(100vw-2rem)] bg-surface-raised border border-surface-border shadow-lg rounded-md animate-page-in",children:h.jsxs("div",{className:"flex items-start gap-2.5 px-3.5 py-3",children:[h.jsx(Id,{className:"w-4 h-4 mt-0.5 text-accent-muted shrink-0",strokeWidth:1.5}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("div",{className:"text-sm font-mono text-text-secondary truncate",children:r.code}),c?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:`text-sm font-medium ${av[c.outcome]}`,children:ov(c)}),c.error&&h.jsx("div",{className:"text-xs text-text-tertiary mt-0.5",children:c.error}),du(c)&&h.jsx("div",{className:"text-xs text-text-secondary mt-1.5",children:h.jsx(lv,{content:du(c),compact:!0})})]}):h.jsx("div",{className:"text-sm text-status-error",children:r.error})]}),h.jsx("button",{type:"button",onClick:()=>l(r.at),className:"text-text-tertiary hover:text-text-primary shrink-0",title:"Dismiss",children:h.jsx(Jt,{className:"w-3.5 h-3.5"})})]})})}const _v="lt-announcement-dismissed:";function fT(r){return r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function hT(r){try{return localStorage.getItem(`${_v}${r}`)==="1"}catch{return!1}}function dT(){const{isAuthenticated:r,userRoleNames:t}=It(),{data:s}=Cx(r),i=Ve(),[l,c]=A.useState(null),[d,y]=A.useState(0);xn(lA,()=>{i.invalidateQueries({queryKey:["announcements"]})});const g=Date.now(),f=((s==null?void 0:s.announcements)??[]).filter(b=>!hT(b.id)&&new Date(b.expires_at).getTime()>g&&(b.roles.length===0||b.roles.some(x=>t.includes(x))));if(A.useEffect(()=>{const b=((s==null?void 0:s.announcements)??[]).map(v=>new Date(v.expires_at).getTime()-Date.now()).filter(v=>v>0);if(b.length===0)return;const x=setTimeout(()=>y(v=>v+1),Math.min(...b)+250);return()=>clearTimeout(x)},[s,d]),f.length===0)return null;const m=b=>{try{localStorage.setItem(`${_v}${b}`,"1")}catch{}y(x=>x+1)};return h.jsx("div",{"data-testid":"announcement-banner",className:"relative z-40",children:f.map(b=>{const x=l===b.id,v=b.title??b.body.split(`
|
|
66
|
+
`)[0];return h.jsxs("div",{className:"border-b border-accent/25 bg-accent/10",children:[h.jsxs("div",{className:"flex items-center gap-2 px-4 py-1.5",children:[h.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-accent",children:"Notice"}),h.jsxs("button",{type:"button",onClick:()=>c(x?null:b.id),className:"flex items-center gap-1.5 text-xs text-text-primary hover:text-accent transition-colors min-w-0",children:[h.jsx("span",{className:"truncate",children:v}),x?h.jsx(Bb,{className:"w-3 h-3 shrink-0",strokeWidth:1.5}):h.jsx(Lb,{className:"w-3 h-3 shrink-0",strokeWidth:1.5})]}),h.jsx("div",{className:"flex-1"}),h.jsx("button",{type:"button",onClick:()=>m(b.id),className:"icon-link",title:"Dismiss","aria-label":`Dismiss ${v}`,children:h.jsx(Jt,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]}),x&&h.jsx("div",{className:"px-4 pb-3 text-sm text-text-secondary max-w-measure",children:h.jsx(ju,{content:fT(b.body)})})]},b.id)})})}function mT(){var D;const{isBuilder:r,isOps:t,viewAs:s}=wx(),{canSeePaceBoard:i}=Sx();UO();const{data:l}=Xn(),c=xx(),d=c!==null?c:!!((D=l==null?void 0:l.ai)!=null&&D.enabled),{collapsed:y,toggle:g}=fm(),[f,m]=A.useState(!1),[b,x]=A.useState(!1),[v,w]=A.useState(!1),[S,C]=A.useState(()=>window.location.hash.startsWith("#docs")),L=wn(),U=A.useRef(null),{kiosk:ne,homePath:se}=Ax();return A.useEffect(()=>{const z=U.current;z&&(z.classList.remove("animate-page-in"),z.offsetWidth,z.classList.add("animate-page-in"))},[L.pathname]),A.useEffect(()=>{const z=()=>{window.location.hash.startsWith("#docs")&&C(!0)};return window.addEventListener("hashchange",z),()=>window.removeEventListener("hashchange",z)},[]),ne&&se&&!XO(L.pathname)?h.jsx(Bn,{to:se,replace:!0}):h.jsxs("div",{className:"h-screen bg-surface flex flex-col",children:[h.jsx(nN,{onToggleEventFeed:()=>m(z=>!z),onToggleDocs:()=>C(z=>!z),onToggleNav:ne?void 0:()=>x(z=>!z)}),h.jsx(dT,{}),h.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[!ne&&h.jsxs("aside",{className:`${y?"w-16":"w-60"} shrink-0 bg-surface-raised border-r border-surface-border hidden lg:flex flex-col transition-[width] duration-200 ease-out overflow-hidden relative z-20`,children:[h.jsx("nav",{className:"flex-1 px-3 pt-[36px] pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:h.jsx(mv,{aiEnabled:d,isBuilder:r,isOps:t,viewAs:s,canSeePaceBoard:i})}),h.jsx("button",{onClick:g,className:`shrink-0 py-3 text-text-tertiary hover:text-text-secondary transition-colors duration-150 ${y?"flex justify-center":"flex items-center px-7"}`,"aria-label":y?"Expand sidebar":"Collapse sidebar",children:y?h.jsx(dS,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):h.jsx(mS,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5})}),!y&&(l==null?void 0:l.environment)&&h.jsxs("div",{className:"shrink-0 px-5 pb-3 text-2xs leading-tight text-text-tertiary whitespace-nowrap overflow-hidden text-ellipsis",title:`long-tail v${l.environment.longTailVersion} · HotMesh v${l.environment.hotmeshVersion} · Node ${l.environment.nodeVersion} · ${l.environment.nodeEnv}`,children:["long-tail v",l.environment.longTailVersion,h.jsx("span",{className:"mx-1 text-surface-border",children:"·"}),"HotMesh v",l.environment.hotmeshVersion]})]}),h.jsx("main",{className:"flex-1 min-w-0 overflow-y-auto",children:h.jsx("div",{ref:U,className:"w-full px-page-x py-8 pb-16 animate-page-in h-full flex flex-col @container",children:h.jsx($i,{})})}),h.jsx(pT,{})]}),!ne&&h.jsx(_N,{open:b,onClose:()=>x(!1),aiEnabled:d,isBuilder:r,isOps:t,viewAs:s,canSeePaceBoard:i}),h.jsx(zN,{open:f,onToggle:()=>m(z=>!z),configOpen:v,onToggleConfig:()=>w(z=>!z)}),h.jsx(XN,{open:S,onClose:()=>{C(!1),history.replaceState(null,"",window.location.pathname+window.location.search)}}),d&&h.jsx(tT,{}),d&&h.jsx(oT,{}),h.jsx(uT,{})]})}function pT(){const{node:r,width:t,open:s}=dm();return h.jsx(tA,{open:s,width:t,className:"border-l border-surface-border bg-surface-raised",children:r})}function yT(){const{isAuthenticated:r}=It(),t=wn();return r?h.jsx(ZO,{children:h.jsx(eA,{children:h.jsx(eT,{children:h.jsx(qj,{children:h.jsx(Jj,{children:h.jsx(mT,{})})})})})}):h.jsx(Bn,{to:"/login",state:{from:t.pathname},replace:!0})}function wv({provider:r,className:t="w-5 h-5"}){switch(r){case"google":return h.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:[h.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z",fill:"#4285F4"}),h.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),h.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),h.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]});case"github":return h.jsx("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:h.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12.017C22 6.484 17.522 2 12 2z"})});case"microsoft":return h.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:[h.jsx("path",{d:"M3 3h8.5v8.5H3z",fill:"#F25022"}),h.jsx("path",{d:"M12.5 3H21v8.5h-8.5z",fill:"#7FBA00"}),h.jsx("path",{d:"M3 12.5h8.5V21H3z",fill:"#00A4EF"}),h.jsx("path",{d:"M12.5 12.5H21V21h-8.5z",fill:"#FFB900"})]});case"anthropic":return h.jsx("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:h.jsx("path",{d:"M13.827 3.52h3.603L24 20.48h-3.603l-6.57-16.96zm-7.258 0h3.767L16.906 20.48h-3.674l-1.343-3.461H6.396l-1.34 3.461H1.5l5.07-16.96zm2.327 5.14l-2.065 5.326h4.108l-2.043-5.326z"})});default:return h.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[h.jsx("circle",{cx:"12",cy:"12",r:"10"}),h.jsx("path",{d:"M12 8v4l3 3"})]})}}async function gT(){return me("/auth/oauth/providers")}async function bT(r,t){const s=t?`?label=${encodeURIComponent(t)}`:"";return me(`/auth/oauth/connections/${r}${s}`,{method:"DELETE"})}function BC(){return We({queryKey:["oauth-connections"],queryFn:()=>me("/auth/oauth/connections")})}function UC(){const r=Ve();return et({mutationFn:({provider:t,label:s})=>bT(t,s),onSuccess:()=>{r.invalidateQueries({queryKey:["oauth-connections"]})}})}function xT(){var ae;const{login:r,isAuthenticated:t}=It(),s=Zi(),i=wn(),l=new URLSearchParams(i.search),c=l.get("token"),d=l.get("error"),y=((ae=i.state)==null?void 0:ae.from)??l.get("returnTo")??"/",g=A.useRef(!1);c&&!g.current&&(g.current=!0,r(c,void 0,{displayName:l.get("displayName"),username:l.get("username")}));const[f,m]=A.useState(""),[b,x]=A.useState(""),[v,w]=A.useState(d||""),[S,C]=A.useState(!1),[L,U]=A.useState(!!c),[ne,se]=A.useState([]),D=A.useRef(!1);if(A.useEffect(()=>{c||D.current||(D.current=!0,(async()=>{var X,M,$,Z;try{const J=await Fd().catch(()=>null);if(!((X=J==null?void 0:J.auth)!=null&&X.sso))return;const le=await fetch(`${Bt}/api/auth/sso`,{method:"POST"});if(!le.ok){w("Host authentication required — please log in to your organization first");return}const ve=await le.json();ve.token&&((M=J.auth)!=null&&M.ssoLogoutUrl&&sessionStorage.setItem("lt_sso_logout_url",J.auth.ssoLogoutUrl),U(!0),r(ve.token,void 0,{displayName:($=ve.user)==null?void 0:$.display_name,username:(Z=ve.user)==null?void 0:Z.external_id}))}catch{}})())},[]),A.useEffect(()=>{c||gT().then(se).catch(()=>{})},[]),A.useEffect(()=>{if(!L)return;const X=setTimeout(()=>s(y,{replace:!0}),1500);return()=>clearTimeout(X)},[L]),t&&!L)return h.jsx(Bn,{to:y,replace:!0});const z=async X=>{var M,$;if(X.preventDefault(),w(""),!f.trim()||!b){w("Username and password are required");return}C(!0);try{const Z=await fetch(`${Bt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:f.trim(),password:b})}),J=await Z.json();if(!Z.ok){w(J.error||"Login failed");return}U(!0),r(J.token,{username:f.trim(),password:b},{displayName:(M=J.user)==null?void 0:M.display_name,username:($=J.user)==null?void 0:$.external_id})}catch{w("Unable to connect to server")}finally{C(!1)}};return h.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center overflow-hidden",children:h.jsxs("div",{className:"w-full max-w-md p-10",children:[h.jsx("div",{className:`mb-10 transition-all duration-[1500ms] ease-in ${L?"translate-x-[120vw] -translate-y-[60vh] scale-[3] opacity-0":""}`,children:h.jsx(uu,{size:"lg",hideLabel:L})}),h.jsxs("form",{onSubmit:z,className:`space-y-5 transition-opacity duration-300 ${L?"opacity-0":""}`,children:[h.jsxs("div",{children:[h.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-text-secondary mb-2",children:"Username"}),h.jsx("input",{id:"username",type:"text",value:f,onChange:X=>m(X.target.value),className:"input",placeholder:"Enter your username",autoFocus:!L,autoComplete:"username"})]}),h.jsxs("div",{children:[h.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-text-secondary mb-2",children:"Password"}),h.jsx("input",{id:"password",type:"password",value:b,onChange:X=>x(X.target.value),className:"input",placeholder:"Enter your password",autoComplete:"current-password"})]}),v&&h.jsx("p",{className:"text-sm text-status-error",children:v}),h.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:S||L,children:S?"Signing in...":"Sign In"}),ne.length>0&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex items-center gap-3 mt-6",children:[h.jsx("div",{className:"flex-1 h-px bg-border"}),h.jsx("span",{className:"text-xs text-text-tertiary",children:"or continue with"}),h.jsx("div",{className:"flex-1 h-px bg-border"})]}),h.jsx("div",{className:"space-y-2",children:ne.filter(X=>X.provider!=="anthropic").map(X=>h.jsxs("a",{href:`${Bt}/api/auth/oauth/${X.provider}?returnTo=${encodeURIComponent(y)}`,className:"btn-secondary w-full flex items-center justify-center gap-2",children:[h.jsx(wv,{provider:X.provider}),"Sign in with ",X.name]},X.provider))})]})]})]})})}function Eb(){const{isAuthenticated:r}=It(),t=Zi(),s=wn(),i=new URLSearchParams(s.search),l=i.get("state")||"";A.useEffect(()=>{r||t(`/login?returnTo=${encodeURIComponent(s.pathname+s.search)}`)},[r]);const[c,d]=A.useState(""),[y,g]=A.useState(i.get("label")||"default"),[f,m]=A.useState(""),[b,x]=A.useState(!1),v=c.trim().startsWith("sk-ant-oat"),w=c.trim().startsWith("sk-ant-api"),S=C=>{C.preventDefault();const L=c.trim();if(!L){m("A token or API key is required");return}if(!L.startsWith("sk-ant-")){m('Invalid format. Must start with "sk-ant-oat" (OAuth token) or "sk-ant-api" (API key)');return}x(!0),m("");const U=`${Bt}/api/auth/oauth/anthropic/callback?code=${encodeURIComponent(L)}&state=${encodeURIComponent(l)}`;window.location.href=U};return h.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:h.jsxs("div",{className:"w-full max-w-md p-10",children:[h.jsx("div",{className:"mb-10",children:h.jsx(uu,{size:"lg"})}),h.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[h.jsx(wv,{provider:"anthropic",className:"w-6 h-6"}),h.jsx("h2",{className:"heading-3",children:"Connect Anthropic"})]}),h.jsx("p",{className:"text-sm text-text-secondary mb-4",children:"Connect your Anthropic account so Claude Code tasks run under your credentials. Your token is encrypted at rest."}),h.jsxs("form",{onSubmit:S,className:"space-y-5",children:[h.jsxs("div",{children:[h.jsx("label",{htmlFor:"token",className:"block text-sm font-medium text-text-secondary mb-2",children:"OAuth Token or API Key"}),h.jsx("input",{id:"token",type:"password",value:c,onChange:C=>d(C.target.value),className:"input",placeholder:"sk-ant-oat01-... or sk-ant-api03-...",autoFocus:!0,autoComplete:"off"}),v&&h.jsx("p",{className:"text-xs text-status-success mt-1",children:"OAuth token detected — uses your Claude subscription (flat rate)"}),w&&h.jsx("p",{className:"text-xs text-status-warning mt-1",children:"API key detected — billed per-token from your Anthropic API account"})]}),h.jsxs("div",{children:[h.jsx("label",{htmlFor:"label",className:"block text-sm font-medium text-text-secondary mb-2",children:"Label"}),h.jsx("input",{id:"label",type:"text",value:y,onChange:C=>g(C.target.value.replace(/\s+/g,"-").toLowerCase()),className:"input",placeholder:"default",autoComplete:"off"}),h.jsx("p",{className:"text-xs text-text-tertiary mt-1",children:'A name for this credential. Use different labels to store multiple credentials (e.g., "subscription", "api-batch").'})]}),f&&h.jsx("p",{className:"text-sm text-status-error",children:f}),h.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:b,children:b?"Validating...":"Connect"}),h.jsx("a",{href:"/",className:"block text-center text-sm text-text-tertiary hover:text-text-secondary",children:"Cancel"})]}),h.jsxs("div",{className:"mt-6 space-y-3 text-xs text-text-tertiary",children:[h.jsxs("div",{children:[h.jsx("span",{className:"font-medium text-text-secondary",children:"Recommended:"})," ","Run"," ",h.jsx("code",{className:"px-1 py-0.5 bg-surface-sunken rounded text-2xs",children:"claude setup-token"})," ","in your terminal to generate an OAuth token that uses your subscription."]}),h.jsxs("div",{children:[h.jsx("span",{className:"font-medium text-text-secondary",children:"Alternative:"})," ","Use an API key from"," ",h.jsx("a",{href:"https://console.anthropic.com/settings/keys",target:"_blank",rel:"noopener noreferrer",className:"text-accent-secondary hover:underline",children:"console.anthropic.com"})," ","(billed per-token)."]})]})]})})}function Vc({roleTypes:r,roleNames:t,redirectTo:s="/"}){const{isSuperAdmin:i,hasRole:l,hasRoleType:c}=It();return i?h.jsx($i,{}):r&&r.some(d=>c(d))?h.jsx($i,{}):t&&t.some(d=>l(d))?h.jsx($i,{}):h.jsx(Bn,{to:s,replace:!0})}function vT({redirectTo:r="/"}){var i;const{data:t,isLoading:s}=Xn();return s||!t?null:(i=t.ai)!=null&&i.enabled?h.jsx($i,{}):h.jsx(Bn,{to:r,replace:!0})}function _T({flag:r,redirectTo:t="/"}){var l;const{data:s,isLoading:i}=Xn();return i||!s?null:((l=s.features)==null?void 0:l[r])===!1?h.jsx(Bn,{to:t,replace:!0}):h.jsx($i,{})}const wT=A.lazy(()=>Se(()=>import("./ProcessesListPage-CKKNpk4z.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]),import.meta.url).then(r=>({default:r.ProcessesListPage}))),ST=A.lazy(()=>Se(()=>import("./ProcessDetailPage-BVXieFX1.js"),__vite__mapDeps([17,1,2,18,13,19,16,10,5,20,21]),import.meta.url).then(r=>({default:r.ProcessDetailPage}))),ET=A.lazy(()=>Se(()=>import("./McpOverview-Ciq8r6-p.js"),__vite__mapDeps([22,1,23,24,25,26,14,13,27,5]),import.meta.url).then(r=>({default:r.McpOverview}))),OT=A.lazy(()=>Se(()=>import("./McpRunsPage-D0RlOpzR.js"),__vite__mapDeps([28,1,24,25,4,5,29,26,7,8,9,16,13,30,14,12,11,15,31]),import.meta.url).then(r=>({default:r.McpRunsPage}))),AT=A.lazy(()=>Se(()=>import("./McpRunDetailPage-BqKNmIyW.js"),__vite__mapDeps([32,1,24,14,13,33,34,12,35,19,5,36,15,37]),import.meta.url).then(r=>({default:r.McpRunDetailPage}))),jT=A.lazy(()=>Se(()=>import("./McpQueryPage-BBy0NSNg.js"),__vite__mapDeps([38,1,14,13,8,9,12,11,15,7,10,30,16,31,4,5,39]),import.meta.url).then(r=>({default:r.McpQueryPage}))),kT=A.lazy(()=>Se(()=>import("./McpQueryDetailPage-DIC0FEEb.js"),__vite__mapDeps([40,1,14,13,19,39,5,25,41,42,24,3,2,43,44,45,46,47,48,37,49,35,36]),import.meta.url).then(r=>({default:r.McpQueryDetailPage}))),NT=A.lazy(()=>Se(()=>import("./EscalationsOverview-DSYC0nI7.js"),__vite__mapDeps([50,1,14,13,27,5]),import.meta.url).then(r=>({default:r.EscalationsOverview}))),TT=A.lazy(()=>Se(()=>import("./AvailableEscalationsPage-BSqOctep.js"),__vite__mapDeps([51,1,5,52,13,53,54,6,55,56,12,57,20,16,21,58,8,9,19,11,4,31]),import.meta.url).then(r=>({default:r.AvailableEscalationsPage}))),CT=A.lazy(()=>Se(()=>import("./OperatorDashboard-vXG0TjAQ.js"),__vite__mapDeps([59,1,4,5,6,7,52,8,9,11,31,55,13,56,12,57,20,16,21,58,19,15]),import.meta.url).then(r=>({default:r.OperatorDashboard}))),MT=A.lazy(()=>Se(()=>import("./index-8LIpvj2e.js"),__vite__mapDeps([60,1,53,54,6,5,14,13,15,58,8,9,19,21,11,3,20,37,61]),import.meta.url).then(r=>({default:r.EscalationDetailPage}))),RT=A.lazy(()=>Se(()=>import("./WorkflowsOverview-CDFTYeQo.js"),__vite__mapDeps([62,1,3,14,13,27,5]),import.meta.url).then(r=>({default:r.WorkflowsOverview}))),DT=A.lazy(()=>Se(()=>import("./index-CsIw-ZLk.js"),__vite__mapDeps([63,1,3,14,13,12,16,64,46,47,5]),import.meta.url).then(r=>({default:r.StartWorkflowPage}))),qT=A.lazy(()=>Se(()=>import("./index-CsIw-ZLk.js"),__vite__mapDeps([63,1,3,14,13,12,16,64,46,47,5]),import.meta.url).then(r=>({default:r.DurableInvokePage}))),LT=A.lazy(()=>Se(()=>import("./WorkflowsDashboard-BRboBhlK.js"),__vite__mapDeps([65,1,30,3,29,26,5,4,7,8,9,16,13,14,12,11,15,31]),import.meta.url).then(r=>({default:()=>r.WorkflowsDashboard({tier:"durable"})}))),BT=A.lazy(()=>Se(()=>import("./WorkflowsDashboard-BRboBhlK.js"),__vite__mapDeps([65,1,30,3,29,26,5,4,7,8,9,16,13,14,12,11,15,31]),import.meta.url).then(r=>({default:()=>r.WorkflowsDashboard({tier:"all"})}))),UT=A.lazy(()=>Se(()=>import("./YamlWorkflowsPage-Qq1jfcrH.js"),__vite__mapDeps([66,1,25,4,5,14,13,12,9,48,64,19]),import.meta.url).then(r=>({default:r.YamlWorkflowsPage}))),PT=A.lazy(()=>Se(()=>import("./GraphInvokePage-DxZv_KC2.js"),__vite__mapDeps([67,1,25,14,13,43,45,46,47,44,5,48,64]),import.meta.url).then(r=>({default:r.GraphInvokePage}))),zT=A.lazy(()=>Se(()=>import("./YamlWorkflowDetailPage-CmnZFevp.js"),__vite__mapDeps([68,1,25,19,64,13,5]),import.meta.url).then(r=>({default:r.YamlWorkflowDetailPage}))),IT=A.lazy(()=>Se(()=>import("./TasksListPage-DEQymbXC.js"),__vite__mapDeps([69,1,2,3,4,5,8,9,19,57,49,11,12,13,14,16]),import.meta.url).then(r=>({default:r.TasksListPage}))),$T=A.lazy(()=>Se(()=>import("./TaskDetailPage-CVUDUU5Q.js"),__vite__mapDeps([70,1,2,19,57,14,13,5]),import.meta.url).then(r=>({default:r.TaskDetailPage}))),Ob=A.lazy(()=>Se(()=>import("./WorkflowExecutionPage-BttnEvOd.js"),__vite__mapDeps([71,1,3,34,12,13,35,19,5,36,2,14,33,15,37]),import.meta.url).then(r=>({default:r.WorkflowExecutionPage}))),HT=A.lazy(()=>Se(()=>import("./AdminDashboard-DPkWtPc1.js"),__vite__mapDeps([72,1,2,23,18,13,5]),import.meta.url).then(r=>({default:r.AdminDashboard}))),FT=A.lazy(()=>Se(()=>import("./index-IWufkcH9.js"),__vite__mapDeps([73,1,3,8,9,12,13,31,4,5,14,74,16]),import.meta.url).then(r=>({default:r.WorkersPage}))),GT=A.lazy(()=>Se(()=>import("./index-CtJkvX9e.js"),__vite__mapDeps([75,1,3,12,13,76,20,16,14,5,46,47,64]),import.meta.url).then(r=>({default:r.WorkflowConfigsPage}))),Ab=A.lazy(()=>Se(()=>import("./index-CtJkvX9e.js"),__vite__mapDeps([75,1,3,12,13,76,20,16,14,5,46,47,64]),import.meta.url).then(r=>({default:r.WorkflowConfigDetailPage}))),VT=A.lazy(()=>Se(()=>import("./index-BuqpU6ow.js"),__vite__mapDeps([77,1,23,9,76,14,13,12,11,4,5,78,45,46,47,48,44,31,19]),import.meta.url).then(r=>({default:r.McpServersPage}))),jb=A.lazy(()=>Se(()=>import("./index-BQPUlmmz.js"),__vite__mapDeps([79,1,23,14,13,41,5]),import.meta.url).then(r=>({default:r.McpServerDetailPage}))),YT=A.lazy(()=>Se(()=>import("./index-iegzyfMv.js"),__vite__mapDeps([80,1,4,5,8,9,11,12,13,76,31,14,20,47,49,81,82,33]),import.meta.url).then(r=>({default:r.UsersPage}))),KT=A.lazy(()=>Se(()=>import("./RolesPage-eayR9H4f.js"),__vite__mapDeps([83,1,12,13,14,20,5]),import.meta.url).then(r=>({default:r.RolesPage}))),JT=A.lazy(()=>Se(()=>import("./RoleDetailPage-BytSo-YE.js"),__vite__mapDeps([84,1,85,76,13,5]),import.meta.url).then(r=>({default:r.RoleDetailPage}))),XT=A.lazy(()=>Se(()=>import("./PersonasPage-Dzcinl1L.js"),__vite__mapDeps([86,1,81,12,13,14,20,5,6]),import.meta.url).then(r=>({default:r.PersonasPage}))),QT=A.lazy(()=>Se(()=>import("./PersonaDetailPage-w5TXcn4Q.js"),__vite__mapDeps([87,1,81,20,13,82,85,76,5]),import.meta.url).then(r=>({default:r.PersonaDetailPage}))),ZT=A.lazy(()=>Se(()=>import("./EscalationSchemaPage-CydTtq_A.js"),__vite__mapDeps([88,1,13,5]),import.meta.url).then(r=>({default:r.EscalationSchemaPage}))),WT=A.lazy(()=>Se(()=>import("./EscalationListSchemaPage-BZQ8Y_UH.js"),__vite__mapDeps([89,1,13,5]),import.meta.url).then(r=>({default:r.EscalationListSchemaPage}))),e3=A.lazy(()=>Se(()=>import("./ScanCodesPage-C8-ZBXF5.js"),__vite__mapDeps([90,1,14,13,5]),import.meta.url).then(r=>({default:r.ScanCodesPage}))),t3=A.lazy(()=>Se(()=>import("./ScanSchemeDetailPage-tQhEgFKf.js"),__vite__mapDeps([91,1,76,14,13,5]),import.meta.url).then(r=>({default:r.ScanSchemeDetailPage}))),n3=A.lazy(()=>Se(()=>import("./ScanStationPage-CuhqsBKo.js"),__vite__mapDeps([92,1,13,61,5]),import.meta.url).then(r=>({default:r.ScanStationPage}))),r3=A.lazy(()=>Se(()=>import("./index-xNFTmmsv.js"),__vite__mapDeps([93,1,14,13,54,5]),import.meta.url).then(r=>({default:r.MaintenancePage}))),kb=A.lazy(()=>Se(()=>import("./OperationsPage-BX0SFizr.js").then(r=>r.O),__vite__mapDeps([94,1,56,13,5,14]),import.meta.url).then(r=>({default:r.OperationsPage}))),s3=A.lazy(()=>Se(()=>import("./index-BICLHYJJ.js"),__vite__mapDeps([95,1,18,13,12,4,5,29,26,42,74,8,9,31]),import.meta.url).then(r=>({default:r.ControlPlanePage}))),i3=A.lazy(()=>Se(()=>import("./index-D9NtDRtp.js"),__vite__mapDeps([96,1,36,13,4,5,29,26,7,8,9,11,12,14,15]),import.meta.url).then(r=>({default:r.StreamMessagesPage}))),a3=A.lazy(()=>Se(()=>import("./CredentialsPage-CSYZw-rL.js"),__vite__mapDeps([97,1,14,13,49,76,5]),import.meta.url).then(r=>({default:r.CredentialsPage}))),o3=A.lazy(()=>Se(()=>import("./index-G3NmdMjt.js"),__vite__mapDeps([98,1,5,14,13,12,15,7,9,99,49]),import.meta.url).then(r=>({default:r.FilesPage}))),l3=A.lazy(()=>Se(()=>import("./index-DU9-flEo.js"),__vite__mapDeps([100,1,14,13,12,15,11,9,99,49,101,41,5]),import.meta.url).then(r=>({default:r.KnowledgePage}))),c3=A.lazy(()=>Se(()=>import("./HomePage-zK3VP_9g.js"),__vite__mapDeps([102,1,3,24,26,20,13,16,15,94,56,5,14,52]),import.meta.url).then(r=>({default:r.HomePage}))),u3=A.lazy(()=>Se(()=>import("./AgentsPage-CoCWGhUd.js"),__vite__mapDeps([103,1,104,4,5,7,8,9,11,12,13,14,15]),import.meta.url).then(r=>({default:r.AgentsPage}))),f3=A.lazy(()=>Se(()=>import("./AgentDetailPage-CufRZXnT.js"),__vite__mapDeps([105,1,104,106,13,16,5]),import.meta.url).then(r=>({default:r.AgentDetailPage}))),Nb=A.lazy(()=>Se(()=>import("./AgentConfigPage-DRfnLiQS.js"),__vite__mapDeps([107,1,104,106,13,14,101,45,46,47,3,25,108,109,16,5]),import.meta.url).then(r=>({default:r.AgentConfigPage}))),h3=A.lazy(()=>Se(()=>import("./CapabilitiesPage-CDQ5JHNP.js"),__vite__mapDeps([110,1,108,78,23,45,46,47,13,48,5,44,14,12]),import.meta.url).then(r=>({default:r.CapabilitiesPage}))),d3=A.lazy(()=>Se(()=>import("./TopicsPage-DO8pUmng.js"),__vite__mapDeps([111,1,109,14,13,12,5]),import.meta.url).then(r=>({default:r.TopicsPage}))),m3=A.lazy(()=>Se(()=>import("./TopicDetailPage-SFuiludx.js"),__vite__mapDeps([112,1,109,15,13,5]),import.meta.url).then(r=>({default:r.TopicDetailPage})));function p3(){return h.jsxs("div",{className:"animate-pulse space-y-4",children:[h.jsx("div",{className:"h-8 bg-surface-sunken rounded w-48"}),h.jsx("div",{className:"h-40 bg-surface-sunken rounded"})]})}function xe({children:r}){return h.jsx(A.Suspense,{fallback:h.jsx(p3,{}),children:h.jsx("div",{className:"animate-page-enter flex flex-col flex-1 min-h-0",children:r})})}const Sv=new qw({defaultOptions:{queries:{staleTime:1e4,retry:(r,t)=>t instanceof Error&&t.message==="Session expired"?!1:r<1}}});window.addEventListener("auth:unauthorized",()=>{Sv.clear(),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info");const r=window.__LT_BASE__||"",t=`${r}/login`;if(window.location.pathname!==t){const s=window.location.pathname+window.location.search,i=r&&s.startsWith(r)?s.slice(r.length)||"/":s;window.location.href=`${t}?returnTo=${encodeURIComponent(i)}`}});const y3=Uw([{path:"/login",element:h.jsx(xT,{})},{path:"/connect/anthropic",element:h.jsx(Eb,{})},{path:"/connect/:provider",element:h.jsx(Eb,{})},{path:"/",element:h.jsx(yT,{}),children:[{index:!0,element:h.jsx(xe,{children:h.jsx(c3,{})})},{path:"processes/all",element:h.jsx(xe,{children:h.jsx(wT,{})})},{path:"processes/detail/:originId",element:h.jsx(xe,{children:h.jsx(ST,{})})},{path:"credentials",element:h.jsx(xe,{children:h.jsx(a3,{})})},{path:"connections",element:h.jsx(Bn,{to:"/credentials",replace:!0})},{path:"escalations",element:h.jsx(xe,{children:h.jsx(NT,{})})},{path:"escalations/available",element:h.jsx(xe,{children:h.jsx(TT,{})})},{path:"escalations/queue",element:h.jsx(xe,{children:h.jsx(CT,{})})},{path:"escalations/detail/:id",element:h.jsx(xe,{children:h.jsx(MT,{})})},{path:"scan/station",element:h.jsx(xe,{children:h.jsx(n3,{})})},{path:"capabilities",element:h.jsx(xe,{children:h.jsx(h3,{})})},{path:"agents",element:h.jsx(xe,{children:h.jsx(u3,{})})},{path:"agents/new",element:h.jsx(xe,{children:h.jsx(Nb,{})})},{path:"agents/:id",element:h.jsx(xe,{children:h.jsx(f3,{})})},{path:"agents/:id/edit",element:h.jsx(xe,{children:h.jsx(Nb,{})})},{path:"topics",element:h.jsx(xe,{children:h.jsx(d3,{})})},{path:"topics/:topic",element:h.jsx(xe,{children:h.jsx(m3,{})})},{element:h.jsx(Vc,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:h.jsx(xe,{children:h.jsx(RT,{})})},{path:"workflows/executions",element:h.jsx(xe,{children:h.jsx(BT,{})})},{path:"workflows/durable/executions",element:h.jsx(xe,{children:h.jsx(LT,{})})},{path:"workflows/durable/executions/:workflowId",element:h.jsx(xe,{children:h.jsx(Ob,{})})},{path:"workflows/tasks",element:h.jsx(xe,{children:h.jsx(IT,{})})},{path:"workflows/tasks/detail/:id",element:h.jsx(xe,{children:h.jsx($T,{})})},{path:"workflows/executions/:workflowId",element:h.jsx(xe,{children:h.jsx(Ob,{})})},{path:"workflows/start",element:h.jsx(xe,{children:h.jsx(DT,{})})},{path:"workflows/durable/invoke",element:h.jsx(xe,{children:h.jsx(qT,{})})},{path:"workflows/cron",element:h.jsx(Bn,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:h.jsx(xe,{children:h.jsx(FT,{})})},{path:"workflows/registry",element:h.jsx(xe,{children:h.jsx(GT,{})})},{path:"workflows/registry/new",element:h.jsx(xe,{children:h.jsx(Ab,{})})},{path:"workflows/registry/:workflowType",element:h.jsx(xe,{children:h.jsx(Ab,{})})}]},{element:h.jsx(Vc,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"mcp/workflows",element:h.jsx(xe,{children:h.jsx(UT,{})})},{path:"mcp/workflows/invoke",element:h.jsx(xe,{children:h.jsx(PT,{})})},{path:"mcp/workflows/:id",element:h.jsx(xe,{children:h.jsx(zT,{})})},{path:"mcp/executions",element:h.jsx(xe,{children:h.jsx(OT,{})})},{path:"mcp/executions/:jobId",element:h.jsx(xe,{children:h.jsx(AT,{})})},{path:"files",element:h.jsx(xe,{children:h.jsx(o3,{})})},{path:"knowledge",element:h.jsx(xe,{children:h.jsx(l3,{})})},{element:h.jsx(vT,{}),children:[{path:"mcp",element:h.jsx(xe,{children:h.jsx(ET,{})})},{path:"mcp/queries",element:h.jsx(xe,{children:h.jsx(jT,{})})},{path:"mcp/queries/:workflowId",element:h.jsx(xe,{children:h.jsx(kT,{})})},{path:"mcp/tools",element:h.jsx(Bn,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:h.jsx(xe,{children:h.jsx(VT,{})})},{path:"mcp/servers/new",element:h.jsx(xe,{children:h.jsx(jb,{})})},{path:"mcp/servers/:serverId",element:h.jsx(xe,{children:h.jsx(jb,{})})}]}]},{path:"pace",element:h.jsx(xe,{children:h.jsx(kb,{})})},{path:"trends",element:h.jsx(xe,{children:h.jsx(kb,{})})},{path:"operations",element:h.jsx(Bn,{to:"/pace",replace:!0})},{element:h.jsx(Vc,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"admin",element:h.jsx(xe,{children:h.jsx(HT,{})})},{path:"admin/users",element:h.jsx(xe,{children:h.jsx(YT,{})})},{path:"admin/escalation-chains",element:h.jsx(Bn,{to:"/admin/roles",replace:!0})},{path:"admin/roles",element:h.jsx(xe,{children:h.jsx(KT,{})})},{path:"admin/roles/:role",element:h.jsx(xe,{children:h.jsx(JT,{})})},{path:"admin/roles/:role/schema",element:h.jsx(xe,{children:h.jsx(ZT,{})})},{path:"admin/roles/:role/list-schema",element:h.jsx(xe,{children:h.jsx(WT,{})})},{path:"admin/scan-codes",element:h.jsx(xe,{children:h.jsx(e3,{})})},{path:"admin/scan-codes/:version",element:h.jsx(xe,{children:h.jsx(t3,{})})},{path:"admin/personas",element:h.jsx(xe,{children:h.jsx(XT,{})})},{path:"admin/personas/:key",element:h.jsx(xe,{children:h.jsx(QT,{})})}]},{element:h.jsx(Vc,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"admin/bots",element:h.jsx(Bn,{to:"/admin/users?tab=service-accounts",replace:!0})},{element:h.jsx(_T,{flag:"dbMaintenance"}),children:[{path:"admin/maintenance",element:h.jsx(xe,{children:h.jsx(r3,{})})}]},{path:"admin/controlplane",element:h.jsx(xe,{children:h.jsx(s3,{})})},{path:"admin/streams",element:h.jsx(xe,{children:h.jsx(i3,{})})}]}]}],{basename:window.__LT_BASE__||"/"});function g3(){return h.jsx(Lw,{client:Sv,children:h.jsx(kS,{children:h.jsx(TO,{children:h.jsx(Pw,{router:y3})})})})}Fx(Hx());const vm=document.createElement("link");vm.rel="stylesheet";vm.href=`${Bt}/api/settings/custom.css`;document.head.appendChild(vm);xS.createRoot(document.getElementById("root")).render(h.jsx(A.StrictMode,{children:h.jsx(g3,{})}));export{hv as $,RC as A,G3 as B,xm as C,nT as D,DC as E,yv as F,dm as G,lN as H,cN as I,BN as J,hN as K,wx as L,Kk as M,Yt as N,Ax as O,z3 as P,W3 as Q,eC as R,ON as S,tC as T,nC as U,rC as V,iC as W,HO as X,Su as Y,F3 as Z,It as _,fC as a,UC as a$,D3 as a0,M3 as a1,Tx as a2,Nx as a3,gm as a4,X3 as a5,eN as a6,_C as a7,P3 as a8,Vj as a9,U3 as aA,B3 as aB,qC as aC,R3 as aD,xC as aE,Bt as aF,Pb as aG,mC as aH,SC as aI,q3 as aJ,jC as aK,OC as aL,NC as aM,Ej as aN,CC as aO,MC as aP,kC as aQ,TC as aR,Qx as aS,vj as aT,Yj as aU,AC as aV,Ie as aW,$3 as aX,dC as aY,Jk as aZ,BC as a_,sc as aa,ju as ab,lv as ac,Y3 as ad,Dj as ae,Jx as af,yC as ag,K3 as ah,Z3 as ai,sC as aj,pg as ak,S3 as al,Kx as am,ym as an,Ux as ao,wC as ap,E3 as aq,lC as ar,O3 as as,A3 as at,T3 as au,C3 as av,j3 as aw,k3 as ax,N3 as ay,L3 as az,Xn as b,wv as b0,Js as b1,lm as b2,Sx as b3,vC as b4,gC as b5,EC as c,aC as d,Px as e,_j as f,tA as g,I3 as h,nn as i,xn as j,oC as k,me as l,cC as m,uC as n,V3 as o,J3 as p,Q3 as q,hC as r,H3 as s,bm as t,bC as u,LC as v,xx as w,Gj as x,pC as y,Fj as z};
|
|
67
|
+
//# sourceMappingURL=index-BaC3sbJH.js.map
|