@hotmeshio/long-tail 0.4.12 → 0.4.13
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/README.md +76 -100
- package/build/api/index.d.ts +2 -1
- package/build/api/index.js +3 -2
- package/build/api/{mcp-runs.d.ts → pipelines.d.ts} +18 -0
- package/build/api/{mcp-runs.js → pipelines.js} +36 -4
- package/build/api/workflows/discovery.js +1 -1
- package/build/routes/index.js +3 -2
- package/build/routes/{mcp-runs.js → pipelines.js} +17 -4
- package/build/sdk/index.d.ts +11 -4
- package/build/sdk/index.js +12 -5
- package/build/services/{mcp-runs → pipelines}/sql.js +1 -1
- package/build/start/adapters.js +3 -6
- package/build/start/server.js +5 -2
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/types/startup.d.ts +3 -3
- package/dashboard/dist/assets/{AdminDashboard-B7AFFt4L.js → AdminDashboard-Jwr3Fsaz.js} +2 -2
- package/dashboard/dist/assets/{AdminDashboard-B7AFFt4L.js.map → AdminDashboard-Jwr3Fsaz.js.map} +1 -1
- package/dashboard/dist/assets/{AgentConfigPage-CjuCbr5J.js → AgentConfigPage-DbqbFXEq.js} +4 -4
- package/dashboard/dist/assets/{AgentConfigPage-CjuCbr5J.js.map → AgentConfigPage-DbqbFXEq.js.map} +1 -1
- package/dashboard/dist/assets/{AgentDetailPage-DnHaUCS5.js → AgentDetailPage-Cw7foCHd.js} +3 -3
- package/dashboard/dist/assets/{AgentDetailPage-DnHaUCS5.js.map → AgentDetailPage-Cw7foCHd.js.map} +1 -1
- package/dashboard/dist/assets/{AgentsPage-BR2-PdTq.js → AgentsPage-DzpWsTFO.js} +2 -2
- package/dashboard/dist/assets/{AgentsPage-BR2-PdTq.js.map → AgentsPage-DzpWsTFO.js.map} +1 -1
- package/dashboard/dist/assets/{AvailableEscalationsPage-CEkeo_N4.js → AvailableEscalationsPage-D2cxvpAK.js} +2 -2
- package/dashboard/dist/assets/{AvailableEscalationsPage-CEkeo_N4.js.map → AvailableEscalationsPage-D2cxvpAK.js.map} +1 -1
- package/dashboard/dist/assets/BotPicker-Ddu4V0uf.js +2 -0
- package/dashboard/dist/assets/{BotPicker-CAowL3ib.js.map → BotPicker-Ddu4V0uf.js.map} +1 -1
- package/dashboard/dist/assets/CapabilitiesPage-BTd-uYTM.js +2 -0
- package/dashboard/dist/assets/{CapabilitiesPage-CSUKBvEN.js.map → CapabilitiesPage-BTd-uYTM.js.map} +1 -1
- package/dashboard/dist/assets/{CollapsibleSection-Bv6ixURp.js → CollapsibleSection-DM-75khr.js} +2 -2
- package/dashboard/dist/assets/{CollapsibleSection-Bv6ixURp.js.map → CollapsibleSection-DM-75khr.js.map} +1 -1
- package/dashboard/dist/assets/{CredentialsPage-CdPKxRBj.js → CredentialsPage-BQNraRZu.js} +2 -2
- package/dashboard/dist/assets/{CredentialsPage-CdPKxRBj.js.map → CredentialsPage-BQNraRZu.js.map} +1 -1
- package/dashboard/dist/assets/{CronLabel-BtdXRDqs.js → CronLabel-CPuMNBua.js} +2 -2
- package/dashboard/dist/assets/{CronLabel-BtdXRDqs.js.map → CronLabel-CPuMNBua.js.map} +1 -1
- package/dashboard/dist/assets/{CustomDurationPicker-Mq3SLUuv.js → CustomDurationPicker-CLq8B89Y.js} +2 -2
- package/dashboard/dist/assets/{CustomDurationPicker-Mq3SLUuv.js.map → CustomDurationPicker-CLq8B89Y.js.map} +1 -1
- package/dashboard/dist/assets/{DropZone-lw2wmqty.js → DropZone-BkfRoUcm.js} +2 -2
- package/dashboard/dist/assets/{DropZone-lw2wmqty.js.map → DropZone-BkfRoUcm.js.map} +1 -1
- package/dashboard/dist/assets/{ElapsedCell-DOTqB4ZX.js → ElapsedCell-8lk94nZt.js} +2 -2
- package/dashboard/dist/assets/{ElapsedCell-DOTqB4ZX.js.map → ElapsedCell-8lk94nZt.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationsOverview-DSM8Mnb-.js → EscalationsOverview-BfSrQ7A5.js} +2 -2
- package/dashboard/dist/assets/{EscalationsOverview-DSM8Mnb-.js.map → EscalationsOverview-BfSrQ7A5.js.map} +1 -1
- package/dashboard/dist/assets/{EventTable-C-HagWbs.js → EventTable-D3IOLoxv.js} +2 -2
- package/dashboard/dist/assets/{EventTable-C-HagWbs.js.map → EventTable-D3IOLoxv.js.map} +1 -1
- package/dashboard/dist/assets/{EventTopicPill-RaASGdZz.js → EventTopicPill-CCWCs07y.js} +2 -2
- package/dashboard/dist/assets/{EventTopicPill-RaASGdZz.js.map → EventTopicPill-CCWCs07y.js.map} +1 -1
- package/dashboard/dist/assets/HomePage-RO3qbF38.js +2 -0
- package/dashboard/dist/assets/HomePage-RO3qbF38.js.map +1 -0
- package/dashboard/dist/assets/ListToolbar-4lObXT3_.js +2 -0
- package/dashboard/dist/assets/{ListToolbar-o8xSCSVv.js.map → ListToolbar-4lObXT3_.js.map} +1 -1
- package/dashboard/dist/assets/McpOverview-BdLivZv8.js +2 -0
- package/dashboard/dist/assets/McpOverview-BdLivZv8.js.map +1 -0
- package/dashboard/dist/assets/{McpQueryDetailPage-UR0bySPJ.js → McpQueryDetailPage-DKFkH1qa.js} +2 -2
- package/dashboard/dist/assets/McpQueryDetailPage-DKFkH1qa.js.map +1 -0
- package/dashboard/dist/assets/{McpQueryPage-C-mzOcGH.js → McpQueryPage-AFV_QPwm.js} +2 -2
- package/dashboard/dist/assets/{McpQueryPage-C-mzOcGH.js.map → McpQueryPage-AFV_QPwm.js.map} +1 -1
- package/dashboard/dist/assets/McpRunDetailPage-DQJ41oKW.js +2 -0
- package/dashboard/dist/assets/McpRunDetailPage-DQJ41oKW.js.map +1 -0
- package/dashboard/dist/assets/McpRunsPage-CzVS7zcc.js +2 -0
- package/dashboard/dist/assets/McpRunsPage-CzVS7zcc.js.map +1 -0
- package/dashboard/dist/assets/{OperatorDashboard-DLpqyLle.js → OperatorDashboard-B_QmNzLw.js} +2 -2
- package/dashboard/dist/assets/{OperatorDashboard-DLpqyLle.js.map → OperatorDashboard-B_QmNzLw.js.map} +1 -1
- package/dashboard/dist/assets/{PageHeader-B4w-LDUF.js → PageHeader-CR6TpJG_.js} +2 -2
- package/dashboard/dist/assets/{PageHeader-B4w-LDUF.js.map → PageHeader-CR6TpJG_.js.map} +1 -1
- package/dashboard/dist/assets/{PageHeaderWithStats-DQmNXYcG.js → PageHeaderWithStats-CRcQEAO1.js} +2 -2
- package/dashboard/dist/assets/{PageHeaderWithStats-DQmNXYcG.js.map → PageHeaderWithStats-CRcQEAO1.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessDetailPage-8cJEBC_E.js → ProcessDetailPage-qibro3Dm.js} +2 -2
- package/dashboard/dist/assets/{ProcessDetailPage-8cJEBC_E.js.map → ProcessDetailPage-qibro3Dm.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessesListPage-CiprI5Wj.js → ProcessesListPage-CPgiDbdS.js} +2 -2
- package/dashboard/dist/assets/{ProcessesListPage-CiprI5Wj.js.map → ProcessesListPage-CPgiDbdS.js.map} +1 -1
- package/dashboard/dist/assets/{RolePill-Dk-YUxCm.js → RolePill-BC54Vn-U.js} +2 -2
- package/dashboard/dist/assets/{RolePill-Dk-YUxCm.js.map → RolePill-BC54Vn-U.js.map} +1 -1
- package/dashboard/dist/assets/{RolesPage-xo6AgPym.js → RolesPage-BAj88I_Y.js} +2 -2
- package/dashboard/dist/assets/{RolesPage-xo6AgPym.js.map → RolesPage-BAj88I_Y.js.map} +1 -1
- package/dashboard/dist/assets/{RunAsSelector-DPXWgduq.js → RunAsSelector-IdZ-qOfl.js} +2 -2
- package/dashboard/dist/assets/{RunAsSelector-DPXWgduq.js.map → RunAsSelector-IdZ-qOfl.js.map} +1 -1
- package/dashboard/dist/assets/{ServerName-A6Wlv3vZ.js → ServerName-Q6okiv4f.js} +2 -2
- package/dashboard/dist/assets/{ServerName-A6Wlv3vZ.js.map → ServerName-Q6okiv4f.js.map} +1 -1
- package/dashboard/dist/assets/{SwimlaneTimeline-BzG8QxYs.js → SwimlaneTimeline-WQ6VMuqg.js} +2 -2
- package/dashboard/dist/assets/{SwimlaneTimeline-BzG8QxYs.js.map → SwimlaneTimeline-WQ6VMuqg.js.map} +1 -1
- package/dashboard/dist/assets/{TagInput-CYh3PFNq.js → TagInput-D6l1SPWd.js} +2 -2
- package/dashboard/dist/assets/{TagInput-CYh3PFNq.js.map → TagInput-D6l1SPWd.js.map} +1 -1
- package/dashboard/dist/assets/{TaskDetailPage-Ck_0-iO2.js → TaskDetailPage-buNgjwiz.js} +2 -2
- package/dashboard/dist/assets/{TaskDetailPage-Ck_0-iO2.js.map → TaskDetailPage-buNgjwiz.js.map} +1 -1
- package/dashboard/dist/assets/{TaskQueuePill-BSFLiBcf.js → TaskQueuePill-iDBVCEQQ.js} +2 -2
- package/dashboard/dist/assets/{TaskQueuePill-BSFLiBcf.js.map → TaskQueuePill-iDBVCEQQ.js.map} +1 -1
- package/dashboard/dist/assets/{TasksListPage-DtR4F0ho.js → TasksListPage-BQjjNjRC.js} +2 -2
- package/dashboard/dist/assets/{TasksListPage-DtR4F0ho.js.map → TasksListPage-BQjjNjRC.js.map} +1 -1
- package/dashboard/dist/assets/{TimeAgo-BLNstYO1.js → TimeAgo-Dvkw4shy.js} +2 -2
- package/dashboard/dist/assets/{TimeAgo-BLNstYO1.js.map → TimeAgo-Dvkw4shy.js.map} +1 -1
- package/dashboard/dist/assets/{TimestampCell-DxIz3l1J.js → TimestampCell-DGEGdbOW.js} +2 -2
- package/dashboard/dist/assets/{TimestampCell-DxIz3l1J.js.map → TimestampCell-DGEGdbOW.js.map} +1 -1
- package/dashboard/dist/assets/{ToolPill-CcKNnnrK.js → ToolPill-HcRTggHo.js} +2 -2
- package/dashboard/dist/assets/{ToolPill-CcKNnnrK.js.map → ToolPill-HcRTggHo.js.map} +1 -1
- package/dashboard/dist/assets/{ToolTestPanel-AVDlqGQI.js → ToolTestPanel-GY3n1V12.js} +2 -2
- package/dashboard/dist/assets/{ToolTestPanel-AVDlqGQI.js.map → ToolTestPanel-GY3n1V12.js.map} +1 -1
- package/dashboard/dist/assets/TopicDetailPage-CGim5yi0.js +9 -0
- package/dashboard/dist/assets/TopicDetailPage-CGim5yi0.js.map +1 -0
- package/dashboard/dist/assets/{TopicsPage-BdnJ7E_S.js → TopicsPage-DLyRlo0A.js} +2 -2
- package/dashboard/dist/assets/{TopicsPage-BdnJ7E_S.js.map → TopicsPage-DLyRlo0A.js.map} +1 -1
- package/dashboard/dist/assets/{UserName-Bk-pzKYb.js → UserName-B8dGlxj9.js} +2 -2
- package/dashboard/dist/assets/{UserName-Bk-pzKYb.js.map → UserName-B8dGlxj9.js.map} +1 -1
- package/dashboard/dist/assets/WorkflowExecutionPage-BQbIIdIA.js +2 -0
- package/dashboard/dist/assets/WorkflowExecutionPage-BQbIIdIA.js.map +1 -0
- package/dashboard/dist/assets/WorkflowPill-54px0YiY.js +2 -0
- package/dashboard/dist/assets/WorkflowPill-54px0YiY.js.map +1 -0
- package/dashboard/dist/assets/{WorkflowsDashboard-nXLTR0OO.js → WorkflowsDashboard-DL6oRbka.js} +2 -2
- package/dashboard/dist/assets/WorkflowsDashboard-DL6oRbka.js.map +1 -0
- package/dashboard/dist/assets/{WorkflowsOverview-BdSHBzzd.js → WorkflowsOverview-Reab_xHT.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsOverview-BdSHBzzd.js.map → WorkflowsOverview-Reab_xHT.js.map} +1 -1
- package/dashboard/dist/assets/YamlWorkflowsPage-BoFstOcp.js +2 -0
- package/dashboard/dist/assets/{YamlWorkflowsPage-BsO4L_SW.js.map → YamlWorkflowsPage-BoFstOcp.js.map} +1 -1
- package/dashboard/dist/assets/{agents-CtF0uBav.js → agents-CQsJU21y.js} +2 -2
- package/dashboard/dist/assets/{agents-CtF0uBav.js.map → agents-CQsJU21y.js.map} +1 -1
- package/dashboard/dist/assets/{bots-DOP_eck8.js → bots-t1FPESbm.js} +2 -2
- package/dashboard/dist/assets/{bots-DOP_eck8.js.map → bots-t1FPESbm.js.map} +1 -1
- package/dashboard/dist/assets/{capabilities-DvxG02aF.js → capabilities-D1Y3hVvf.js} +2 -2
- package/dashboard/dist/assets/{capabilities-DvxG02aF.js.map → capabilities-D1Y3hVvf.js.map} +1 -1
- package/dashboard/dist/assets/{controlplane-Dmq81vAY.js → controlplane-CV-y8cfH.js} +2 -2
- package/dashboard/dist/assets/{controlplane-Dmq81vAY.js.map → controlplane-CV-y8cfH.js.map} +1 -1
- package/dashboard/dist/assets/{escalation-BP3UWfIe.js → escalation-Bf_SO_75.js} +2 -2
- package/dashboard/dist/assets/{escalation-BP3UWfIe.js.map → escalation-Bf_SO_75.js.map} +1 -1
- package/dashboard/dist/assets/{escalation-columns-BayccZzU.js → escalation-columns-DgY8c1hM.js} +2 -2
- package/dashboard/dist/assets/{escalation-columns-BayccZzU.js.map → escalation-columns-DgY8c1hM.js.map} +1 -1
- package/dashboard/dist/assets/{helpers-B_PYr0pL.js → helpers-nWSTagzD.js} +2 -2
- package/dashboard/dist/assets/{helpers-B_PYr0pL.js.map → helpers-nWSTagzD.js.map} +1 -1
- package/dashboard/dist/assets/{index-DzQBDt3K.js → index-0i5oHs_4.js} +2 -2
- package/dashboard/dist/assets/{index-DzQBDt3K.js.map → index-0i5oHs_4.js.map} +1 -1
- package/dashboard/dist/assets/index-B77P0ssX.js +2 -0
- package/dashboard/dist/assets/{index-Bb1ycul8.js.map → index-B77P0ssX.js.map} +1 -1
- package/dashboard/dist/assets/index-BRYCB_g0.js +2 -0
- package/dashboard/dist/assets/index-BRYCB_g0.js.map +1 -0
- package/dashboard/dist/assets/{index-B80zLZVl.js → index-BVXXvXlF.js} +2 -2
- package/dashboard/dist/assets/{index-B80zLZVl.js.map → index-BVXXvXlF.js.map} +1 -1
- package/dashboard/dist/assets/{index-BnB7G5bA.js → index-BZu5zewH.js} +23 -23
- package/dashboard/dist/assets/index-BZu5zewH.js.map +1 -0
- package/dashboard/dist/assets/index-C42ACUTi.js +2 -0
- package/dashboard/dist/assets/index-C42ACUTi.js.map +1 -0
- package/dashboard/dist/assets/{index-DQs-LMoa.js → index-CHBiEYmf.js} +2 -2
- package/dashboard/dist/assets/{index-DQs-LMoa.js.map → index-CHBiEYmf.js.map} +1 -1
- package/dashboard/dist/assets/index-CdUj8mKq.js +15 -0
- package/dashboard/dist/assets/index-CdUj8mKq.js.map +1 -0
- package/dashboard/dist/assets/{index-Bv0eLXZq.js → index-DAQvhgrL.js} +4 -4
- package/dashboard/dist/assets/{index-Bv0eLXZq.js.map → index-DAQvhgrL.js.map} +1 -1
- package/dashboard/dist/assets/{index-CkcPZdQm.js → index-DUaF8VYe.js} +2 -2
- package/dashboard/dist/assets/{index-CkcPZdQm.js.map → index-DUaF8VYe.js.map} +1 -1
- package/dashboard/dist/assets/{index-Do1x4kN0.js → index-Dp8iH4i2.js} +2 -2
- package/dashboard/dist/assets/{index-Do1x4kN0.js.map → index-Dp8iH4i2.js.map} +1 -1
- package/dashboard/dist/assets/index-MO0YnTPi.js +2 -0
- package/dashboard/dist/assets/{index-EqKHsaVz.js.map → index-MO0YnTPi.js.map} +1 -1
- package/dashboard/dist/assets/index-ib-nDwd6.css +1 -0
- package/dashboard/dist/assets/{index-B3wGNZN2.js → index-wlL3EZ14.js} +2 -2
- package/dashboard/dist/assets/{index-B3wGNZN2.js.map → index-wlL3EZ14.js.map} +1 -1
- package/dashboard/dist/assets/{knowledge--SApApck.js → knowledge-DJhm5z0p.js} +2 -2
- package/dashboard/dist/assets/{knowledge--SApApck.js.map → knowledge-DJhm5z0p.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-dn9iPrzm.js → mcp-DMYXb9fv.js} +2 -2
- package/dashboard/dist/assets/{mcp-dn9iPrzm.js.map → mcp-DMYXb9fv.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-query-CgiU2UR6.js → mcp-query-DE-oPOvi.js} +2 -2
- package/dashboard/dist/assets/{mcp-query-CgiU2UR6.js.map → mcp-query-DE-oPOvi.js.map} +1 -1
- package/dashboard/dist/assets/{namespaces-D93H3wFO.js → namespaces-Bjjm4EG1.js} +2 -2
- package/dashboard/dist/assets/{namespaces-D93H3wFO.js.map → namespaces-Bjjm4EG1.js.map} +1 -1
- package/dashboard/dist/assets/pipelines-C8aRprVr.js +2 -0
- package/dashboard/dist/assets/pipelines-C8aRprVr.js.map +1 -0
- package/dashboard/dist/assets/{roles-DuOWZTpx.js → roles-CQsPYJXe.js} +2 -2
- package/dashboard/dist/assets/{roles-DuOWZTpx.js.map → roles-CQsPYJXe.js.map} +1 -1
- package/dashboard/dist/assets/{tasks-DoCbLKz4.js → tasks-BQ1c7trT.js} +2 -2
- package/dashboard/dist/assets/{tasks-DoCbLKz4.js.map → tasks-BQ1c7trT.js.map} +1 -1
- package/dashboard/dist/assets/{topics-CS7Sxf_-.js → topics-DIziCjqg.js} +2 -2
- package/dashboard/dist/assets/{topics-CS7Sxf_-.js.map → topics-DIziCjqg.js.map} +1 -1
- package/dashboard/dist/assets/{useEventHooks-CrIe_Ulh.js → useEventHooks-CPxcH6zx.js} +2 -2
- package/dashboard/dist/assets/{useEventHooks-CrIe_Ulh.js.map → useEventHooks-CPxcH6zx.js.map} +1 -1
- package/dashboard/dist/assets/{useYamlActivityEvents-JzvzGsUR.js → useYamlActivityEvents-DnPywDgy.js} +2 -2
- package/dashboard/dist/assets/{useYamlActivityEvents-JzvzGsUR.js.map → useYamlActivityEvents-DnPywDgy.js.map} +1 -1
- package/dashboard/dist/assets/{users-DnxSh2dX.js → users-CMGaVe_B.js} +2 -2
- package/dashboard/dist/assets/{users-DnxSh2dX.js.map → users-CMGaVe_B.js.map} +1 -1
- package/dashboard/dist/assets/{vendor-icons-5gSix3t2.js → vendor-icons-CrrAvF2g.js} +131 -111
- package/dashboard/dist/assets/vendor-icons-CrrAvF2g.js.map +1 -0
- package/dashboard/dist/assets/{workflows-zFmmxc08.js → workflows-CD7-d5w8.js} +2 -2
- package/dashboard/dist/assets/{workflows-zFmmxc08.js.map → workflows-CD7-d5w8.js.map} +1 -1
- package/dashboard/dist/assets/{yaml-workflows-VSax0tKa.js → yaml-workflows-CIeymjZr.js} +2 -2
- package/dashboard/dist/assets/{yaml-workflows-VSax0tKa.js.map → yaml-workflows-CIeymjZr.js.map} +1 -1
- package/dashboard/dist/index.html +3 -3
- package/docs/api/http/{mcp-runs.md → pipelines.md} +39 -25
- package/docs/dashboard.md +1 -1
- package/docs/sdk.md +1 -1
- package/package.json +1 -1
- package/dashboard/dist/assets/BotPicker-CAowL3ib.js +0 -2
- package/dashboard/dist/assets/CapabilitiesPage-CSUKBvEN.js +0 -2
- package/dashboard/dist/assets/HomePage-BkMEYnRK.js +0 -2
- package/dashboard/dist/assets/HomePage-BkMEYnRK.js.map +0 -1
- package/dashboard/dist/assets/ListToolbar-o8xSCSVv.js +0 -2
- package/dashboard/dist/assets/McpOverview-C4man2br.js +0 -2
- package/dashboard/dist/assets/McpOverview-C4man2br.js.map +0 -1
- package/dashboard/dist/assets/McpQueryDetailPage-UR0bySPJ.js.map +0 -1
- package/dashboard/dist/assets/McpRunDetailPage-bJl08JSG.js +0 -2
- package/dashboard/dist/assets/McpRunDetailPage-bJl08JSG.js.map +0 -1
- package/dashboard/dist/assets/McpRunsPage-i2FGJ6yf.js +0 -2
- package/dashboard/dist/assets/McpRunsPage-i2FGJ6yf.js.map +0 -1
- package/dashboard/dist/assets/TopicDetailPage-DQkoAlsj.js +0 -9
- package/dashboard/dist/assets/TopicDetailPage-DQkoAlsj.js.map +0 -1
- package/dashboard/dist/assets/WorkflowExecutionPage-B6mBqWq6.js +0 -2
- package/dashboard/dist/assets/WorkflowExecutionPage-B6mBqWq6.js.map +0 -1
- package/dashboard/dist/assets/WorkflowPill-BkfIn8N3.js +0 -2
- package/dashboard/dist/assets/WorkflowPill-BkfIn8N3.js.map +0 -1
- package/dashboard/dist/assets/WorkflowsDashboard-nXLTR0OO.js.map +0 -1
- package/dashboard/dist/assets/YamlWorkflowsPage-BsO4L_SW.js +0 -2
- package/dashboard/dist/assets/index-Bb1ycul8.js +0 -2
- package/dashboard/dist/assets/index-BnB7G5bA.js.map +0 -1
- package/dashboard/dist/assets/index-BnVnJcXw.js +0 -2
- package/dashboard/dist/assets/index-BnVnJcXw.js.map +0 -1
- package/dashboard/dist/assets/index-CsagXf3M.js +0 -2
- package/dashboard/dist/assets/index-CsagXf3M.js.map +0 -1
- package/dashboard/dist/assets/index-DZI2L4ag.css +0 -1
- package/dashboard/dist/assets/index-EqKHsaVz.js +0 -2
- package/dashboard/dist/assets/index-ox042ec_.js +0 -15
- package/dashboard/dist/assets/index-ox042ec_.js.map +0 -1
- package/dashboard/dist/assets/mcp-runs-BN5MrKai.js +0 -2
- package/dashboard/dist/assets/mcp-runs-BN5MrKai.js.map +0 -1
- package/dashboard/dist/assets/vendor-icons-5gSix3t2.js.map +0 -1
- /package/build/routes/{mcp-runs.d.ts → pipelines.d.ts} +0 -0
- /package/build/services/{mcp-runs → pipelines}/enrichment.d.ts +0 -0
- /package/build/services/{mcp-runs → pipelines}/enrichment.js +0 -0
- /package/build/services/{mcp-runs → pipelines}/events.d.ts +0 -0
- /package/build/services/{mcp-runs → pipelines}/events.js +0 -0
- /package/build/services/{mcp-runs → pipelines}/execution-builder.d.ts +0 -0
- /package/build/services/{mcp-runs → pipelines}/execution-builder.js +0 -0
- /package/build/services/{mcp-runs → pipelines}/index.d.ts +0 -0
- /package/build/services/{mcp-runs → pipelines}/index.js +0 -0
- /package/build/services/{mcp-runs → pipelines}/queries.d.ts +0 -0
- /package/build/services/{mcp-runs → pipelines}/queries.js +0 -0
- /package/build/services/{mcp-runs → pipelines}/sql.d.ts +0 -0
- /package/build/services/{mcp-runs → pipelines}/types.d.ts +0 -0
- /package/build/services/{mcp-runs → pipelines}/types.js +0 -0
- /package/docs/api/sdk/{mcp-runs.md → pipelines.md} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProcessesListPage-
|
|
2
|
-
var
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProcessesListPage-CPgiDbdS.js","./vendor-query-B2UbickB.js","./tasks-BQ1c7trT.js","./workflows-CD7-d5w8.js","./useEventHooks-CPxcH6zx.js","./useFilterParams-x-Dg0Vgz.js","./vendor-react-CXumBFUA.js","./DataTable-D9yuBv0w.js","./EmptyState-BcsfPq9T.js","./TimestampCell-DGEGdbOW.js","./StickyPagination-BWhFSr2d.js","./FilterBar-Ck4K4rzu.js","./PageHeader-CR6TpJG_.js","./vendor-icons-CrrAvF2g.js","./ListToolbar-4lObXT3_.js","./WorkflowPill-54px0YiY.js","./ProcessDetailPage-qibro3Dm.js","./PageHeaderWithStats-CRcQEAO1.js","./StatusBadge-XQlNFwmH.js","./RolePill-BC54Vn-U.js","./UserName-B8dGlxj9.js","./users-CMGaVe_B.js","./McpOverview-BdLivZv8.js","./mcp-DMYXb9fv.js","./pipelines-C8aRprVr.js","./yaml-workflows-CIeymjZr.js","./namespaces-Bjjm4EG1.js","./StatCard-DlgF0CJC.js","./McpRunsPage-CzVS7zcc.js","./ElapsedCell-8lk94nZt.js","./RowActions-Dg-Fsm5O.js","./McpRunDetailPage-DQJ41oKW.js","./CopyableId-DaT0ZRHg.js","./CollapsibleSection-DM-75khr.js","./useCollapsedSections-BU5HULGs.js","./SwimlaneTimeline-WQ6VMuqg.js","./EventTable-D3IOLoxv.js","./McpQueryPage-AFV_QPwm.js","./mcp-query-DE-oPOvi.js","./McpQueryDetailPage-DKFkH1qa.js","./useYamlActivityEvents-DnPywDgy.js","./TagInput-D6l1SPWd.js","./ToolPill-HcRTggHo.js","./RunAsSelector-IdZ-qOfl.js","./BotPicker-Ddu4V0uf.js","./bots-t1FPESbm.js","./TimeAgo-Dvkw4shy.js","./EscalationsOverview-BfSrQ7A5.js","./AvailableEscalationsPage-D2cxvpAK.js","./roles-CQsPYJXe.js","./constants-BHkpVaqx.js","./CustomDurationPicker-CLq8B89Y.js","./Modal-CSrxpXeM.js","./escalation-columns-DgY8c1hM.js","./PriorityBadge-DfQY9St9.js","./escalation-Bf_SO_75.js","./OperatorDashboard-B_QmNzLw.js","./index-DUaF8VYe.js","./WorkflowsOverview-Reab_xHT.js","./index-DAQvhgrL.js","./helpers-nWSTagzD.js","./WorkflowsDashboard-DL6oRbka.js","./YamlWorkflowsPage-BoFstOcp.js","./useExpandedRows-CkcEntB-.js","./ServerName-Q6okiv4f.js","./TasksListPage-BQjjNjRC.js","./TaskDetailPage-buNgjwiz.js","./WorkflowExecutionPage-BQbIIdIA.js","./AdminDashboard-Jwr3Fsaz.js","./index-wlL3EZ14.js","./TaskQueuePill-iDBVCEQQ.js","./index-CdUj8mKq.js","./ConfirmDeleteModal-D9_1b4MW.js","./StepIndicator-CuUIGxKk.js","./index-C42ACUTi.js","./ToolTestPanel-GY3n1V12.js","./index-BVXXvXlF.js","./index-MO0YnTPi.js","./RolesPage-BAj88I_Y.js","./index-CHBiEYmf.js","./index-Dp8iH4i2.js","./controlplane-CV-y8cfH.js","./index-BRYCB_g0.js","./CredentialsPage-BQNraRZu.js","./index-B77P0ssX.js","./DropZone-BkfRoUcm.js","./index-0i5oHs_4.js","./knowledge-DJhm5z0p.js","./HomePage-RO3qbF38.js","./EventTopicPill-CCWCs07y.js","./AgentsPage-DzpWsTFO.js","./agents-CQsJU21y.js","./AgentDetailPage-Cw7foCHd.js","./CronLabel-CPuMNBua.js","./AgentConfigPage-DbqbFXEq.js","./capabilities-D1Y3hVvf.js","./topics-DIziCjqg.js","./CapabilitiesPage-BTd-uYTM.js","./TopicsPage-DLyRlo0A.js","./TopicDetailPage-CGim5yi0.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var mx=Object.defineProperty;var px=(r,n,s)=>n in r?mx(r,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[n]=s;var v=(r,n,s)=>px(r,typeof n!="symbol"?n+"":n,s);import{r as gx,a as T,j as m,u as Hn,b as Nn,c as Pn,Q as yx,d as bx}from"./vendor-query-B2UbickB.js";import{r as xx,L as gr,u as Ws,N as No,a as ng,b as Fs,O as wo,c as sg,d as vx,R as _x}from"./vendor-react-CXumBFUA.js";import{C as wx,I as Sx,R as ig,B as rg,U as Ex,A as Ax,Z as Ox,a as jx,S as Tx,P as Nx,b as Cx,c as kx,G as Mx,L as Rx,W as Dx,d as zx,e as qx,F as Ux,f as Bx,g as Lx,T as Hx,h as Px,N as $x,i as Yx,D as Gx,j as Vx,M as ag,k as lg,l as Fx,m as Jx,n as Qx,E as Ix,X as Po,o as Xx,p as Kx,q as Zx,r as Kp,s as og,t as Wx,u as ev,v as tv,w as nv,x as sv}from"./vendor-icons-CrrAvF2g.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))a(o);new MutationObserver(o=>{for(const f of o)if(f.type==="childList")for(const h of f.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&a(h)}).observe(document,{childList:!0,subtree:!0});function s(o){const f={};return o.integrity&&(f.integrity=o.integrity),o.referrerPolicy&&(f.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?f.credentials="include":o.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function a(o){if(o.ep)return;o.ep=!0;const f=s(o);fetch(o.href,f)}})();var rf={exports:{}},wa={},af={exports:{}},lf={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* scheduler.production.js
|
|
5
5
|
*
|
|
@@ -7,7 +7,7 @@ var yx=Object.defineProperty;var bx=(r,n,s)=>n in r?yx(r,n,{enumerable:!0,config
|
|
|
7
7
|
*
|
|
8
8
|
* This source code is licensed under the MIT license found in the
|
|
9
9
|
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/var
|
|
10
|
+
*/var Zp;function iv(){return Zp||(Zp=1,(function(r){function n($,te){var de=$.length;$.push(te);e:for(;0<de;){var ve=de-1>>>1,be=$[ve];if(0<o(be,te))$[ve]=te,$[de]=be,de=ve;else break e}}function s($){return $.length===0?null:$[0]}function a($){if($.length===0)return null;var te=$[0],de=$.pop();if(de!==te){$[0]=de;e:for(var ve=0,be=$.length,je=be>>>1;ve<je;){var _e=2*(ve+1)-1,Te=$[_e],lt=_e+1,Pt=$[lt];if(0>o(Te,de))lt<be&&0>o(Pt,Te)?($[ve]=Pt,$[lt]=de,ve=lt):($[ve]=Te,$[_e]=de,ve=_e);else if(lt<be&&0>o(Pt,de))$[ve]=Pt,$[lt]=de,ve=lt;else break e}}return te}function o($,te){var de=$.sortIndex-te.sortIndex;return de!==0?de:$.id-te.id}if(r.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;r.unstable_now=function(){return f.now()}}else{var h=Date,d=h.now();r.unstable_now=function(){return h.now()-d}}var g=[],y=[],E=1,w=null,j=3,z=!1,M=!1,B=!1,V=!1,ne=typeof setTimeout=="function"?setTimeout:null,ee=typeof clearTimeout=="function"?clearTimeout:null,pe=typeof setImmediate<"u"?setImmediate:null;function ae($){for(var te=s(y);te!==null;){if(te.callback===null)a(y);else if(te.startTime<=$)a(y),te.sortIndex=te.expirationTime,n(g,te);else break;te=s(y)}}function k($){if(B=!1,ae($),!M)if(s(g)!==null)M=!0,X||(X=!0,re());else{var te=s(y);te!==null&&Le(k,te.startTime-$)}}var X=!1,se=-1,W=5,F=-1;function Z(){return V?!0:!(r.unstable_now()-F<W)}function le(){if(V=!1,X){var $=r.unstable_now();F=$;var te=!0;try{e:{M=!1,B&&(B=!1,ee(se),se=-1),z=!0;var de=j;try{t:{for(ae($),w=s(g);w!==null&&!(w.expirationTime>$&&Z());){var ve=w.callback;if(typeof ve=="function"){w.callback=null,j=w.priorityLevel;var be=ve(w.expirationTime<=$);if($=r.unstable_now(),typeof be=="function"){w.callback=be,ae($),te=!0;break t}w===s(g)&&a(g),ae($)}else a(g);w=s(g)}if(w!==null)te=!0;else{var je=s(y);je!==null&&Le(k,je.startTime-$),te=!1}}break e}finally{w=null,j=de,z=!1}te=void 0}}finally{te?re():X=!1}}}var re;if(typeof pe=="function")re=function(){pe(le)};else if(typeof MessageChannel<"u"){var qe=new MessageChannel,Ge=qe.port2;qe.port1.onmessage=le,re=function(){Ge.postMessage(null)}}else re=function(){ne(le,0)};function Le($,te){se=ne(function(){$(r.unstable_now())},te)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function($){$.callback=null},r.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):W=0<$?Math.floor(1e3/$):5},r.unstable_getCurrentPriorityLevel=function(){return j},r.unstable_next=function($){switch(j){case 1:case 2:case 3:var te=3;break;default:te=j}var de=j;j=te;try{return $()}finally{j=de}},r.unstable_requestPaint=function(){V=!0},r.unstable_runWithPriority=function($,te){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var de=j;j=$;try{return te()}finally{j=de}},r.unstable_scheduleCallback=function($,te,de){var ve=r.unstable_now();switch(typeof de=="object"&&de!==null?(de=de.delay,de=typeof de=="number"&&0<de?ve+de:ve):de=ve,$){case 1:var be=-1;break;case 2:be=250;break;case 5:be=1073741823;break;case 4:be=1e4;break;default:be=5e3}return be=de+be,$={id:E++,callback:te,priorityLevel:$,startTime:de,expirationTime:be,sortIndex:-1},de>ve?($.sortIndex=de,n(y,$),s(g)===null&&$===s(y)&&(B?(ee(se),se=-1):B=!0,Le(k,de-ve))):($.sortIndex=be,n(g,$),M||z||(M=!0,X||(X=!0,re()))),$},r.unstable_shouldYield=Z,r.unstable_wrapCallback=function($){var te=j;return function(){var de=j;j=te;try{return $.apply(this,arguments)}finally{j=de}}}})(lf)),lf}var Wp;function rv(){return Wp||(Wp=1,af.exports=iv()),af.exports}/**
|
|
11
11
|
* @license React
|
|
12
12
|
* react-dom-client.production.js
|
|
13
13
|
*
|
|
@@ -15,28 +15,28 @@ var yx=Object.defineProperty;var bx=(r,n,s)=>n in r?yx(r,n,{enumerable:!0,config
|
|
|
15
15
|
*
|
|
16
16
|
* This source code is licensed under the MIT license found in the
|
|
17
17
|
* LICENSE file in the root directory of this source tree.
|
|
18
|
-
*/var
|
|
18
|
+
*/var e0;function av(){if(e0)return wa;e0=1;var r=rv(),n=gx(),s=xx();function a(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)t+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(e){var t=e,i=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(i=t.return),e=t.return;while(e)}return t.tag===3?i:null}function h(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function g(e){if(f(e)!==e)throw Error(a(188))}function y(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(a(188));return t!==e?null:e}for(var i=e,l=t;;){var c=i.return;if(c===null)break;var u=c.alternate;if(u===null){if(l=c.return,l!==null){i=l;continue}break}if(c.child===u.child){for(u=c.child;u;){if(u===i)return g(c),e;if(u===l)return g(c),t;u=u.sibling}throw Error(a(188))}if(i.return!==l.return)i=c,l=u;else{for(var p=!1,b=c.child;b;){if(b===i){p=!0,i=c,l=u;break}if(b===l){p=!0,l=c,i=u;break}b=b.sibling}if(!p){for(b=u.child;b;){if(b===i){p=!0,i=u,l=c;break}if(b===l){p=!0,l=u,i=c;break}b=b.sibling}if(!p)throw Error(a(189))}}if(i.alternate!==l)throw Error(a(190))}if(i.tag!==3)throw Error(a(188));return i.stateNode.current===i?e:t}function E(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=E(e),t!==null)return t;e=e.sibling}return null}var w=Object.assign,j=Symbol.for("react.element"),z=Symbol.for("react.transitional.element"),M=Symbol.for("react.portal"),B=Symbol.for("react.fragment"),V=Symbol.for("react.strict_mode"),ne=Symbol.for("react.profiler"),ee=Symbol.for("react.consumer"),pe=Symbol.for("react.context"),ae=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),X=Symbol.for("react.suspense_list"),se=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),F=Symbol.for("react.activity"),Z=Symbol.for("react.memo_cache_sentinel"),le=Symbol.iterator;function re(e){return e===null||typeof e!="object"?null:(e=le&&e[le]||e["@@iterator"],typeof e=="function"?e:null)}var qe=Symbol.for("react.client.reference");function Ge(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===qe?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case B:return"Fragment";case ne:return"Profiler";case V:return"StrictMode";case k:return"Suspense";case X:return"SuspenseList";case F:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case M:return"Portal";case pe:return e.displayName||"Context";case ee:return(e._context.displayName||"Context")+".Consumer";case ae:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case se:return t=e.displayName||null,t!==null?t:Ge(e.type)||"Memo";case W:t=e._payload,e=e._init;try{return Ge(e(t))}catch{}}return null}var Le=Array.isArray,$=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,de={pending:!1,data:null,method:null,action:null},ve=[],be=-1;function je(e){return{current:e}}function _e(e){0>be||(e.current=ve[be],ve[be]=null,be--)}function Te(e,t){be++,ve[be]=e.current,e.current=t}var lt=je(null),Pt=je(null),sn=je(null),Ot=je(null);function jt(e,t){switch(Te(sn,t),Te(Pt,e),Te(lt,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?vp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=vp(t),e=_p(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}_e(lt),Te(lt,e)}function we(){_e(lt),_e(Pt),_e(sn)}function Tt(e){e.memoizedState!==null&&Te(Ot,e);var t=lt.current,i=_p(t,e.type);t!==i&&(Te(Pt,e),Te(lt,i))}function ei(e){Pt.current===e&&(_e(lt),_e(Pt)),Ot.current===e&&(_e(Ot),ba._currentValue=de)}var Ti,ti;function rn(e){if(Ti===void 0)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);Ti=t&&t[1]||"",ti=-1<i.stack.indexOf(`
|
|
19
19
|
at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
20
20
|
`+Ti+e+ti}var Ni=!1;function ds(e,t){if(!e||Ni)return"";Ni=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(t){var I=function(){throw Error()};if(Object.defineProperty(I.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(I,[])}catch(P){var L=P}Reflect.construct(e,[],I)}else{try{I.call()}catch(P){L=P}e.call(I.prototype)}}else{try{throw Error()}catch(P){L=P}(I=e())&&typeof I.catch=="function"&&I.catch(function(){})}}catch(P){if(P&&L&&typeof P.stack=="string")return[P.stack,L.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var c=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");c&&c.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var u=l.DetermineComponentFrameRoot(),p=u[0],b=u[1];if(p&&b){var O=p.split(`
|
|
21
21
|
`),U=b.split(`
|
|
22
22
|
`);for(c=l=0;l<O.length&&!O[l].includes("DetermineComponentFrameRoot");)l++;for(;c<U.length&&!U[c].includes("DetermineComponentFrameRoot");)c++;if(l===O.length||c===U.length)for(l=O.length-1,c=U.length-1;1<=l&&0<=c&&O[l]!==U[c];)c--;for(;1<=l&&0<=c;l--,c--)if(O[l]!==U[c]){if(l!==1||c!==1)do if(l--,c--,0>c||O[l]!==U[c]){var Y=`
|
|
23
23
|
`+O[l].replace(" at new "," at ");return e.displayName&&Y.includes("<anonymous>")&&(Y=Y.replace("<anonymous>",e.displayName)),Y}while(1<=l&&0<=c);break}}}finally{Ni=!1,Error.prepareStackTrace=i}return(i=e?e.displayName||e.name:"")?rn(i):""}function Fa(e,t){switch(e.tag){case 26:case 27:case 5:return rn(e.type);case 16:return rn("Lazy");case 13:return e.child!==t&&t!==null?rn("Suspense Fallback"):rn("Suspense");case 19:return rn("SuspenseList");case 0:case 15:return ds(e.type,!1);case 11:return ds(e.type.render,!1);case 1:return ds(e.type,!0);case 31:return rn("Activity");default:return""}}function Ja(e){try{var t="",i=null;do t+=Fa(e,i),i=e,e=e.return;while(e);return t}catch(l){return`
|
|
24
24
|
Error generating stack: `+l.message+`
|
|
25
|
-
`+l.stack}}var Tr=Object.prototype.hasOwnProperty,Nr=r.unstable_scheduleCallback,$n=r.unstable_cancelCallback,Qa=r.unstable_shouldYield,Ci=r.unstable_requestPaint,et=r.unstable_now,Io=r.unstable_getCurrentPriorityLevel,Ia=r.unstable_ImmediatePriority,Xa=r.unstable_UserBlockingPriority,ki=r.unstable_NormalPriority,Xo=r.unstable_LowPriority,Ka=r.unstable_IdlePriority,Ko=r.log,Za=r.unstable_setDisableYieldValue,ni=null,ot=null;function $t(e){if(typeof Ko=="function"&&Za(e),ot&&typeof ot.setStrictMode=="function")try{ot.setStrictMode(ni,e)}catch{}}var Nt=Math.clz32?Math.clz32:Mi,Cr=Math.log,kr=Math.LN2;function Mi(e){return e>>>=0,e===0?32:31-(Cr(e)/kr|0)|0}var ms=256,Yn=262144,ps=4194304;function xn(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function si(e,t,i){var l=e.pendingLanes;if(l===0)return 0;var c=0,u=e.suspendedLanes,p=e.pingedLanes;e=e.warmLanes;var b=l&134217727;return b!==0?(l=b&~u,l!==0?c=xn(l):(p&=b,p!==0?c=xn(p):i||(i=b&~e,i!==0&&(c=xn(i))))):(b=l&~u,b!==0?c=xn(b):p!==0?c=xn(p):i||(i=l&~e,i!==0&&(c=xn(i)))),c===0?0:t!==0&&t!==c&&(t&u)===0&&(u=c&-c,i=t&-t,u>=i||u===32&&(i&4194048)!==0)?t:c}function ii(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Mr(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ri(){var e=ps;return ps<<=1,(ps&62914560)===0&&(ps=4194304),e}function gs(e){for(var t=[],i=0;31>i;i++)t.push(e);return t}function vn(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ys(e,t,i,l,c,u){var p=e.pendingLanes;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=i,e.entangledLanes&=i,e.errorRecoveryDisabledLanes&=i,e.shellSuspendCounter=0;var b=e.entanglements,O=e.expirationTimes,U=e.hiddenUpdates;for(i=p&~i;0<i;){var Y=31-Nt(i),I=1<<Y;b[Y]=0,O[Y]=-1;var L=U[Y];if(L!==null)for(U[Y]=null,Y=0;Y<L.length;Y++){var P=L[Y];P!==null&&(P.lane&=-536870913)}i&=~I}l!==0&&bs(e,l,0),u!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=u&~(p&~t))}function bs(e,t,i){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-Nt(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|i&261930}function ri(e,t){var i=e.entangledLanes|=t;for(e=e.entanglements;i;){var l=31-Nt(i),c=1<<l;c&t|e[l]&t&&(e[l]|=t),i&=~c}}function xs(e,t){var i=t&-t;return i=(i&42)!==0?1:Gn(i),(i&(e.suspendedLanes|t))!==0?0:i}function Gn(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function ai(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Rr(){var e=te.p;return e!==0?e:(e=window.event,e===void 0?32:Jp(e.type))}function Wa(e,t){var i=te.p;try{return te.p=e,t()}finally{te.p=i}}var Cn=Math.random().toString(36).slice(2),Qe="__reactFiber$"+Cn,it="__reactProps$"+Cn,Yt="__reactContainer$"+Cn,li="__reactEvents$"+Cn,Dr="__reactListeners$"+Cn,el="__reactHandles$"+Cn,tl="__reactResources$"+Cn,yt="__reactMarker$"+Cn;function Di(e){delete e[Qe],delete e[it],delete e[li],delete e[Dr],delete e[el]}function x(e){var t=e[Qe];if(t)return t;for(var i=e.parentNode;i;){if(t=i[Yt]||i[Qe]){if(i=t.alternate,t.child!==null||i!==null&&i.child!==null)for(e=kp(e);e!==null;){if(i=e[Qe])return i;e=kp(e)}return t}e=i,i=e.parentNode}return null}function S(e){if(e=e[Qe]||e[Yt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function _(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(a(33))}function A(e){var t=e[tl];return t||(t=e[tl]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function N(e){e[yt]=!0}var D=new Set,Q={};function K(e,t){H(e,t),H(e+"Capture",t)}function H(e,t){for(Q[e]=t,e=0;e<t.length;e++)D.add(t[e])}var J=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),fe={},Oe={};function Ke(e){return Tr.call(Oe,e)?!0:Tr.call(fe,e)?!1:J.test(e)?Oe[e]=!0:(fe[e]=!0,!1)}function Ct(e,t,i){if(Ke(t))if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var l=t.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+i)}}function _n(e,t,i){if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+i)}}function Vn(e,t,i,l){if(l===null)e.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(i);return}e.setAttributeNS(t,i,""+l)}}function an(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ph(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function uy(e,t,i){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var c=l.get,u=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(p){i=""+p,u.call(this,p)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return i},setValue:function(p){i=""+p},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Zo(e){if(!e._valueTracker){var t=ph(e)?"checked":"value";e._valueTracker=uy(e,t,""+e[t])}}function gh(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),l="";return e&&(l=ph(e)?e.checked?"true":"false":e.value),e=l,e!==i?(t.setValue(e),!0):!1}function nl(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 fy=/[\n"\\]/g;function ln(e){return e.replace(fy,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Wo(e,t,i,l,c,u,p,b){e.name="",p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"?e.type=p:e.removeAttribute("type"),t!=null?p==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+an(t)):e.value!==""+an(t)&&(e.value=""+an(t)):p!=="submit"&&p!=="reset"||e.removeAttribute("value"),t!=null?ec(e,p,an(t)):i!=null?ec(e,p,an(i)):l!=null&&e.removeAttribute("value"),c==null&&u!=null&&(e.defaultChecked=!!u),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.name=""+an(b):e.removeAttribute("name")}function yh(e,t,i,l,c,u,p,b){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(e.type=u),t!=null||i!=null){if(!(u!=="submit"&&u!=="reset"||t!=null)){Zo(e);return}i=i!=null?""+an(i):"",t=t!=null?""+an(t):i,b||t===e.value||(e.value=t),e.defaultValue=t}l=l??c,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=b?e.checked:!!l,e.defaultChecked=!!l,p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.name=p),Zo(e)}function ec(e,t,i){t==="number"&&nl(e.ownerDocument)===e||e.defaultValue===""+i||(e.defaultValue=""+i)}function zi(e,t,i,l){if(e=e.options,t){t={};for(var c=0;c<i.length;c++)t["$"+i[c]]=!0;for(i=0;i<e.length;i++)c=t.hasOwnProperty("$"+e[i].value),e[i].selected!==c&&(e[i].selected=c),c&&l&&(e[i].defaultSelected=!0)}else{for(i=""+an(i),t=null,c=0;c<e.length;c++){if(e[c].value===i){e[c].selected=!0,l&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function bh(e,t,i){if(t!=null&&(t=""+an(t),t!==e.value&&(e.value=t),i==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=i!=null?""+an(i):""}function xh(e,t,i,l){if(t==null){if(l!=null){if(i!=null)throw Error(a(92));if(Le(l)){if(1<l.length)throw Error(a(93));l=l[0]}i=l}i==null&&(i=""),t=i}i=an(t),e.defaultValue=i,l=e.textContent,l===i&&l!==""&&l!==null&&(e.value=l),Zo(e)}function qi(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}var hy=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 vh(e,t,i){var l=t.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?l?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":l?e.setProperty(t,i):typeof i!="number"||i===0||hy.has(t)?t==="float"?e.cssFloat=i:e[t]=(""+i).trim():e[t]=i+"px"}function _h(e,t,i){if(t!=null&&typeof t!="object")throw Error(a(62));if(e=e.style,i!=null){for(var l in i)!i.hasOwnProperty(l)||t!=null&&t.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var c in t)l=t[c],t.hasOwnProperty(c)&&i[c]!==l&&vh(e,c,l)}else for(var u in t)t.hasOwnProperty(u)&&vh(e,u,t[u])}function tc(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 dy=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"]]),my=/^[\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 sl(e){return my.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Fn(){}var nc=null;function sc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ui=null,Bi=null;function wh(e){var t=S(e);if(t&&(e=t.stateNode)){var i=e[it]||null;e:switch(e=t.stateNode,t.type){case"input":if(Wo(e,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),t=i.name,i.type==="radio"&&t!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+ln(""+t)+'"][type="radio"]'),t=0;t<i.length;t++){var l=i[t];if(l!==e&&l.form===e.form){var c=l[it]||null;if(!c)throw Error(a(90));Wo(l,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(t=0;t<i.length;t++)l=i[t],l.form===e.form&&gh(l)}break e;case"textarea":bh(e,i.value,i.defaultValue);break e;case"select":t=i.value,t!=null&&zi(e,!!i.multiple,t,!1)}}}var ic=!1;function Sh(e,t,i){if(ic)return e(t,i);ic=!0;try{var l=e(t);return l}finally{if(ic=!1,(Ui!==null||Bi!==null)&&(Gl(),Ui&&(t=Ui,e=Bi,Bi=Ui=null,wh(t),e)))for(t=0;t<e.length;t++)wh(e[t])}}function zr(e,t){var i=e.stateNode;if(i===null)return null;var l=i[it]||null;if(l===null)return null;i=l[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(a(231,t,typeof i));return i}var Jn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),rc=!1;if(Jn)try{var qr={};Object.defineProperty(qr,"passive",{get:function(){rc=!0}}),window.addEventListener("test",qr,qr),window.removeEventListener("test",qr,qr)}catch{rc=!1}var vs=null,ac=null,il=null;function Eh(){if(il)return il;var e,t=ac,i=t.length,l,c="value"in vs?vs.value:vs.textContent,u=c.length;for(e=0;e<i&&t[e]===c[e];e++);var p=i-e;for(l=1;l<=p&&t[i-l]===c[u-l];l++);return il=c.slice(e,1<l?1-l:void 0)}function rl(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function al(){return!0}function Ah(){return!1}function zt(e){function t(i,l,c,u,p){this._reactName=i,this._targetInst=c,this.type=l,this.nativeEvent=u,this.target=p,this.currentTarget=null;for(var b in e)e.hasOwnProperty(b)&&(i=e[b],this[b]=i?i(u):u[b]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?al:Ah,this.isPropagationStopped=Ah,this}return w(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=al)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=al)},persist:function(){},isPersistent:al}),t}var oi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ll=zt(oi),Ur=w({},oi,{view:0,detail:0}),py=zt(Ur),lc,oc,Br,ol=w({},Ur,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:uc,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!==Br&&(Br&&e.type==="mousemove"?(lc=e.screenX-Br.screenX,oc=e.screenY-Br.screenY):oc=lc=0,Br=e),lc)},movementY:function(e){return"movementY"in e?e.movementY:oc}}),Oh=zt(ol),gy=w({},ol,{dataTransfer:0}),yy=zt(gy),by=w({},Ur,{relatedTarget:0}),cc=zt(by),xy=w({},oi,{animationName:0,elapsedTime:0,pseudoElement:0}),vy=zt(xy),_y=w({},oi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),wy=zt(_y),Sy=w({},oi,{data:0}),jh=zt(Sy),Ey={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ay={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"},Oy={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function jy(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Oy[e])?!!t[e]:!1}function uc(){return jy}var Ty=w({},Ur,{key:function(e){if(e.key){var t=Ey[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=rl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Ay[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:uc,charCode:function(e){return e.type==="keypress"?rl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?rl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Ny=zt(Ty),Cy=w({},ol,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Th=zt(Cy),ky=w({},Ur,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:uc}),My=zt(ky),Ry=w({},oi,{propertyName:0,elapsedTime:0,pseudoElement:0}),Dy=zt(Ry),zy=w({},ol,{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}),qy=zt(zy),Uy=w({},oi,{newState:0,oldState:0}),By=zt(Uy),Ly=[9,13,27,32],fc=Jn&&"CompositionEvent"in window,Lr=null;Jn&&"documentMode"in document&&(Lr=document.documentMode);var Hy=Jn&&"TextEvent"in window&&!Lr,Nh=Jn&&(!fc||Lr&&8<Lr&&11>=Lr),Ch=" ",kh=!1;function Mh(e,t){switch(e){case"keyup":return Ly.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Rh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Li=!1;function Py(e,t){switch(e){case"compositionend":return Rh(t);case"keypress":return t.which!==32?null:(kh=!0,Ch);case"textInput":return e=t.data,e===Ch&&kh?null:e;default:return null}}function $y(e,t){if(Li)return e==="compositionend"||!fc&&Mh(e,t)?(e=Eh(),il=ac=vs=null,Li=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Nh&&t.locale!=="ko"?null:t.data;default:return null}}var Yy={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 Dh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Yy[e.type]:t==="textarea"}function zh(e,t,i,l){Ui?Bi?Bi.push(l):Bi=[l]:Ui=l,t=Kl(t,"onChange"),0<t.length&&(i=new ll("onChange","change",null,i,l),e.push({event:i,listeners:t}))}var Hr=null,Pr=null;function Gy(e){yp(e,0)}function cl(e){var t=_(e);if(gh(t))return e}function qh(e,t){if(e==="change")return t}var Uh=!1;if(Jn){var hc;if(Jn){var dc="oninput"in document;if(!dc){var Bh=document.createElement("div");Bh.setAttribute("oninput","return;"),dc=typeof Bh.oninput=="function"}hc=dc}else hc=!1;Uh=hc&&(!document.documentMode||9<document.documentMode)}function Lh(){Hr&&(Hr.detachEvent("onpropertychange",Hh),Pr=Hr=null)}function Hh(e){if(e.propertyName==="value"&&cl(Pr)){var t=[];zh(t,Pr,e,sc(e)),Sh(Gy,t)}}function Vy(e,t,i){e==="focusin"?(Lh(),Hr=t,Pr=i,Hr.attachEvent("onpropertychange",Hh)):e==="focusout"&&Lh()}function Fy(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return cl(Pr)}function Jy(e,t){if(e==="click")return cl(t)}function Qy(e,t){if(e==="input"||e==="change")return cl(t)}function Iy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Gt=typeof Object.is=="function"?Object.is:Iy;function $r(e,t){if(Gt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var i=Object.keys(e),l=Object.keys(t);if(i.length!==l.length)return!1;for(l=0;l<i.length;l++){var c=i[l];if(!Tr.call(t,c)||!Gt(e[c],t[c]))return!1}return!0}function Ph(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function $h(e,t){var i=Ph(e);e=0;for(var l;i;){if(i.nodeType===3){if(l=e+i.textContent.length,e<=t&&l>=t)return{node:i,offset:t-e};e=l}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Ph(i)}}function Yh(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Yh(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Gh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=nl(e.document);t instanceof e.HTMLIFrameElement;){try{var i=typeof t.contentWindow.location.href=="string"}catch{i=!1}if(i)e=t.contentWindow;else break;t=nl(e.document)}return t}function mc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Xy=Jn&&"documentMode"in document&&11>=document.documentMode,Hi=null,pc=null,Yr=null,gc=!1;function Vh(e,t,i){var l=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;gc||Hi==null||Hi!==nl(l)||(l=Hi,"selectionStart"in l&&mc(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Yr&&$r(Yr,l)||(Yr=l,l=Kl(pc,"onSelect"),0<l.length&&(t=new ll("onSelect","select",null,t,i),e.push({event:t,listeners:l}),t.target=Hi)))}function ci(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var Pi={animationend:ci("Animation","AnimationEnd"),animationiteration:ci("Animation","AnimationIteration"),animationstart:ci("Animation","AnimationStart"),transitionrun:ci("Transition","TransitionRun"),transitionstart:ci("Transition","TransitionStart"),transitioncancel:ci("Transition","TransitionCancel"),transitionend:ci("Transition","TransitionEnd")},yc={},Fh={};Jn&&(Fh=document.createElement("div").style,"AnimationEvent"in window||(delete Pi.animationend.animation,delete Pi.animationiteration.animation,delete Pi.animationstart.animation),"TransitionEvent"in window||delete Pi.transitionend.transition);function ui(e){if(yc[e])return yc[e];if(!Pi[e])return e;var t=Pi[e],i;for(i in t)if(t.hasOwnProperty(i)&&i in Fh)return yc[e]=t[i];return e}var Jh=ui("animationend"),Qh=ui("animationiteration"),Ih=ui("animationstart"),Ky=ui("transitionrun"),Zy=ui("transitionstart"),Wy=ui("transitioncancel"),Xh=ui("transitionend"),Kh=new Map,bc="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(" ");bc.push("scrollEnd");function wn(e,t){Kh.set(e,t),K(t,[e])}var ul=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},on=[],$i=0,xc=0;function fl(){for(var e=$i,t=xc=$i=0;t<e;){var i=on[t];on[t++]=null;var l=on[t];on[t++]=null;var c=on[t];on[t++]=null;var u=on[t];if(on[t++]=null,l!==null&&c!==null){var p=l.pending;p===null?c.next=c:(c.next=p.next,p.next=c),l.pending=c}u!==0&&Zh(i,c,u)}}function hl(e,t,i,l){on[$i++]=e,on[$i++]=t,on[$i++]=i,on[$i++]=l,xc|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function vc(e,t,i,l){return hl(e,t,i,l),dl(e)}function fi(e,t){return hl(e,null,null,t),dl(e)}function Zh(e,t,i){e.lanes|=i;var l=e.alternate;l!==null&&(l.lanes|=i);for(var c=!1,u=e.return;u!==null;)u.childLanes|=i,l=u.alternate,l!==null&&(l.childLanes|=i),u.tag===22&&(e=u.stateNode,e===null||e._visibility&1||(c=!0)),e=u,u=u.return;return e.tag===3?(u=e.stateNode,c&&t!==null&&(c=31-Nt(i),e=u.hiddenUpdates,l=e[c],l===null?e[c]=[t]:l.push(t),t.lane=i|536870912),u):null}function dl(e){if(50<fa)throw fa=0,Nu=null,Error(a(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Yi={};function eb(e,t,i,l){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Vt(e,t,i,l){return new eb(e,t,i,l)}function _c(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Qn(e,t){var i=e.alternate;return i===null?(i=Vt(e.tag,t,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&65011712,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i.refCleanup=e.refCleanup,i}function Wh(e,t){e.flags&=65011714;var i=e.alternate;return i===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=i.childLanes,e.lanes=i.lanes,e.child=i.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=i.memoizedProps,e.memoizedState=i.memoizedState,e.updateQueue=i.updateQueue,e.type=i.type,t=i.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function ml(e,t,i,l,c,u){var p=0;if(l=e,typeof e=="function")_c(e)&&(p=1);else if(typeof e=="string")p=rx(e,i,lt.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case F:return e=Vt(31,i,t,c),e.elementType=F,e.lanes=u,e;case B:return hi(i.children,c,u,t);case V:p=8,c|=24;break;case ne:return e=Vt(12,i,t,c|2),e.elementType=ne,e.lanes=u,e;case k:return e=Vt(13,i,t,c),e.elementType=k,e.lanes=u,e;case X:return e=Vt(19,i,t,c),e.elementType=X,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case pe:p=10;break e;case ee:p=9;break e;case ae:p=11;break e;case se:p=14;break e;case W:p=16,l=null;break e}p=29,i=Error(a(130,e===null?"null":typeof e,"")),l=null}return t=Vt(p,i,t,c),t.elementType=e,t.type=l,t.lanes=u,t}function hi(e,t,i,l){return e=Vt(7,e,l,t),e.lanes=i,e}function wc(e,t,i){return e=Vt(6,e,null,t),e.lanes=i,e}function ed(e){var t=Vt(18,null,null,0);return t.stateNode=e,t}function Sc(e,t,i){return t=Vt(4,e.children!==null?e.children:[],e.key,t),t.lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var td=new WeakMap;function cn(e,t){if(typeof e=="object"&&e!==null){var i=td.get(e);return i!==void 0?i:(t={value:e,source:t,stack:Ja(t)},td.set(e,t),t)}return{value:e,source:t,stack:Ja(t)}}var Gi=[],Vi=0,pl=null,Gr=0,un=[],fn=0,_s=null,kn=1,Mn="";function In(e,t){Gi[Vi++]=Gr,Gi[Vi++]=pl,pl=e,Gr=t}function nd(e,t,i){un[fn++]=kn,un[fn++]=Mn,un[fn++]=_s,_s=e;var l=kn;e=Mn;var c=32-Nt(l)-1;l&=~(1<<c),i+=1;var u=32-Nt(t)+c;if(30<u){var p=c-c%5;u=(l&(1<<p)-1).toString(32),l>>=p,c-=p,kn=1<<32-Nt(t)+c|i<<c|l,Mn=u+e}else kn=1<<u|i<<c|l,Mn=e}function Ec(e){e.return!==null&&(In(e,1),nd(e,1,0))}function Ac(e){for(;e===pl;)pl=Gi[--Vi],Gi[Vi]=null,Gr=Gi[--Vi],Gi[Vi]=null;for(;e===_s;)_s=un[--fn],un[fn]=null,Mn=un[--fn],un[fn]=null,kn=un[--fn],un[fn]=null}function sd(e,t){un[fn++]=kn,un[fn++]=Mn,un[fn++]=_s,kn=t.id,Mn=t.overflow,_s=e}var wt=null,Ze=null,Re=!1,ws=null,hn=!1,Oc=Error(a(519));function Ss(e){var t=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Vr(cn(t,e)),Oc}function id(e){var t=e.stateNode,i=e.type,l=e.memoizedProps;switch(t[Qe]=e,t[it]=l,i){case"dialog":Ce("cancel",t),Ce("close",t);break;case"iframe":case"object":case"embed":Ce("load",t);break;case"video":case"audio":for(i=0;i<da.length;i++)Ce(da[i],t);break;case"source":Ce("error",t);break;case"img":case"image":case"link":Ce("error",t),Ce("load",t);break;case"details":Ce("toggle",t);break;case"input":Ce("invalid",t),yh(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Ce("invalid",t);break;case"textarea":Ce("invalid",t),xh(t,l.value,l.defaultValue,l.children)}i=l.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||t.textContent===""+i||l.suppressHydrationWarning===!0||_p(t.textContent,i)?(l.popover!=null&&(Ce("beforetoggle",t),Ce("toggle",t)),l.onScroll!=null&&Ce("scroll",t),l.onScrollEnd!=null&&Ce("scrollend",t),l.onClick!=null&&(t.onclick=Fn),t=!0):t=!1,t||Ss(e,!0)}function rd(e){for(wt=e.return;wt;)switch(wt.tag){case 5:case 31:case 13:hn=!1;return;case 27:case 3:hn=!0;return;default:wt=wt.return}}function Fi(e){if(e!==wt)return!1;if(!Re)return rd(e),Re=!0,!1;var t=e.tag,i;if((i=t!==3&&t!==27)&&((i=t===5)&&(i=e.type,i=!(i!=="form"&&i!=="button")||Gu(e.type,e.memoizedProps)),i=!i),i&&Ze&&Ss(e),rd(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));Ze=Cp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));Ze=Cp(e)}else t===27?(t=Ze,Us(e.type)?(e=Iu,Iu=null,Ze=e):Ze=t):Ze=wt?mn(e.stateNode.nextSibling):null;return!0}function di(){Ze=wt=null,Re=!1}function jc(){var e=ws;return e!==null&&(Lt===null?Lt=e:Lt.push.apply(Lt,e),ws=null),e}function Vr(e){ws===null?ws=[e]:ws.push(e)}var Tc=je(null),mi=null,Xn=null;function Es(e,t,i){Te(Tc,t._currentValue),t._currentValue=i}function Kn(e){e._currentValue=Tc.current,_e(Tc)}function Nc(e,t,i){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===i)break;e=e.return}}function Cc(e,t,i,l){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var u=c.dependencies;if(u!==null){var p=c.child;u=u.firstContext;e:for(;u!==null;){var b=u;u=c;for(var O=0;O<t.length;O++)if(b.context===t[O]){u.lanes|=i,b=u.alternate,b!==null&&(b.lanes|=i),Nc(u.return,i,e),l||(p=null);break e}u=b.next}}else if(c.tag===18){if(p=c.return,p===null)throw Error(a(341));p.lanes|=i,u=p.alternate,u!==null&&(u.lanes|=i),Nc(p,i,e),p=null}else p=c.child;if(p!==null)p.return=c;else for(p=c;p!==null;){if(p===e){p=null;break}if(c=p.sibling,c!==null){c.return=p.return,p=c;break}p=p.return}c=p}}function Ji(e,t,i,l){e=null;for(var c=t,u=!1;c!==null;){if(!u){if((c.flags&524288)!==0)u=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var p=c.alternate;if(p===null)throw Error(a(387));if(p=p.memoizedProps,p!==null){var b=c.type;Gt(c.pendingProps.value,p.value)||(e!==null?e.push(b):e=[b])}}else if(c===Ot.current){if(p=c.alternate,p===null)throw Error(a(387));p.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(ba):e=[ba])}c=c.return}e!==null&&Cc(t,e,i,l),t.flags|=262144}function gl(e){for(e=e.firstContext;e!==null;){if(!Gt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function pi(e){mi=e,Xn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function St(e){return ad(mi,e)}function yl(e,t){return mi===null&&pi(e),ad(e,t)}function ad(e,t){var i=t._currentValue;if(t={context:t,memoizedValue:i,next:null},Xn===null){if(e===null)throw Error(a(308));Xn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Xn=Xn.next=t;return i}var tb=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(i,l){e.push(l)}};this.abort=function(){t.aborted=!0,e.forEach(function(i){return i()})}},nb=r.unstable_scheduleCallback,sb=r.unstable_NormalPriority,ht={$$typeof:pe,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function kc(){return{controller:new tb,data:new Map,refCount:0}}function Fr(e){e.refCount--,e.refCount===0&&nb(sb,function(){e.controller.abort()})}var Jr=null,Mc=0,Qi=0,Ii=null;function ib(e,t){if(Jr===null){var i=Jr=[];Mc=0,Qi=zu(),Ii={status:"pending",value:void 0,then:function(l){i.push(l)}}}return Mc++,t.then(ld,ld),t}function ld(){if(--Mc===0&&Jr!==null){Ii!==null&&(Ii.status="fulfilled");var e=Jr;Jr=null,Qi=0,Ii=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function rb(e,t){var i=[],l={status:"pending",value:null,reason:null,then:function(c){i.push(c)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var c=0;c<i.length;c++)(0,i[c])(t)},function(c){for(l.status="rejected",l.reason=c,c=0;c<i.length;c++)(0,i[c])(void 0)}),l}var od=$.S;$.S=function(e,t){Vm=et(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&ib(e,t),od!==null&&od(e,t)};var gi=je(null);function Rc(){var e=gi.current;return e!==null?e:Ie.pooledCache}function bl(e,t){t===null?Te(gi,gi.current):Te(gi,t.pool)}function cd(){var e=Rc();return e===null?null:{parent:ht._currentValue,pool:e}}var Xi=Error(a(460)),Dc=Error(a(474)),xl=Error(a(542)),vl={then:function(){}};function ud(e){return e=e.status,e==="fulfilled"||e==="rejected"}function fd(e,t,i){switch(i=e[i],i===void 0?e.push(t):i!==t&&(t.then(Fn,Fn),t=i),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,dd(e),e;default:if(typeof t.status=="string")t.then(Fn,Fn);else{if(e=Ie,e!==null&&100<e.shellSuspendCounter)throw Error(a(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var c=t;c.status="fulfilled",c.value=l}},function(l){if(t.status==="pending"){var c=t;c.status="rejected",c.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,dd(e),e}throw bi=t,Xi}}function yi(e){try{var t=e._init;return t(e._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(bi=i,Xi):i}}var bi=null;function hd(){if(bi===null)throw Error(a(459));var e=bi;return bi=null,e}function dd(e){if(e===Xi||e===xl)throw Error(a(483))}var Ki=null,Qr=0;function _l(e){var t=Qr;return Qr+=1,Ki===null&&(Ki=[]),fd(Ki,e,t)}function Ir(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function wl(e,t){throw t.$$typeof===j?Error(a(525)):(e=Object.prototype.toString.call(t),Error(a(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function md(e){function t(R,C){if(e){var q=R.deletions;q===null?(R.deletions=[C],R.flags|=16):q.push(C)}}function i(R,C){if(!e)return null;for(;C!==null;)t(R,C),C=C.sibling;return null}function l(R){for(var C=new Map;R!==null;)R.key!==null?C.set(R.key,R):C.set(R.index,R),R=R.sibling;return C}function c(R,C){return R=Qn(R,C),R.index=0,R.sibling=null,R}function u(R,C,q){return R.index=q,e?(q=R.alternate,q!==null?(q=q.index,q<C?(R.flags|=67108866,C):q):(R.flags|=67108866,C)):(R.flags|=1048576,C)}function p(R){return e&&R.alternate===null&&(R.flags|=67108866),R}function b(R,C,q,G){return C===null||C.tag!==6?(C=wc(q,R.mode,G),C.return=R,C):(C=c(C,q),C.return=R,C)}function O(R,C,q,G){var ge=q.type;return ge===B?Y(R,C,q.props.children,G,q.key):C!==null&&(C.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===W&&yi(ge)===C.type)?(C=c(C,q.props),Ir(C,q),C.return=R,C):(C=ml(q.type,q.key,q.props,null,R.mode,G),Ir(C,q),C.return=R,C)}function U(R,C,q,G){return C===null||C.tag!==4||C.stateNode.containerInfo!==q.containerInfo||C.stateNode.implementation!==q.implementation?(C=Sc(q,R.mode,G),C.return=R,C):(C=c(C,q.children||[]),C.return=R,C)}function Y(R,C,q,G,ge){return C===null||C.tag!==7?(C=hi(q,R.mode,G,ge),C.return=R,C):(C=c(C,q),C.return=R,C)}function I(R,C,q){if(typeof C=="string"&&C!==""||typeof C=="number"||typeof C=="bigint")return C=wc(""+C,R.mode,q),C.return=R,C;if(typeof C=="object"&&C!==null){switch(C.$$typeof){case z:return q=ml(C.type,C.key,C.props,null,R.mode,q),Ir(q,C),q.return=R,q;case M:return C=Sc(C,R.mode,q),C.return=R,C;case W:return C=yi(C),I(R,C,q)}if(Le(C)||re(C))return C=hi(C,R.mode,q,null),C.return=R,C;if(typeof C.then=="function")return I(R,_l(C),q);if(C.$$typeof===pe)return I(R,yl(R,C),q);wl(R,C)}return null}function L(R,C,q,G){var ge=C!==null?C.key:null;if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return ge!==null?null:b(R,C,""+q,G);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case z:return q.key===ge?O(R,C,q,G):null;case M:return q.key===ge?U(R,C,q,G):null;case W:return q=yi(q),L(R,C,q,G)}if(Le(q)||re(q))return ge!==null?null:Y(R,C,q,G,null);if(typeof q.then=="function")return L(R,C,_l(q),G);if(q.$$typeof===pe)return L(R,C,yl(R,q),G);wl(R,q)}return null}function P(R,C,q,G,ge){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return R=R.get(q)||null,b(C,R,""+G,ge);if(typeof G=="object"&&G!==null){switch(G.$$typeof){case z:return R=R.get(G.key===null?q:G.key)||null,O(C,R,G,ge);case M:return R=R.get(G.key===null?q:G.key)||null,U(C,R,G,ge);case W:return G=yi(G),P(R,C,q,G,ge)}if(Le(G)||re(G))return R=R.get(q)||null,Y(C,R,G,ge,null);if(typeof G.then=="function")return P(R,C,q,_l(G),ge);if(G.$$typeof===pe)return P(R,C,q,yl(C,G),ge);wl(C,G)}return null}function he(R,C,q,G){for(var ge=null,Ue=null,me=C,Ee=C=0,Me=null;me!==null&&Ee<q.length;Ee++){me.index>Ee?(Me=me,me=null):Me=me.sibling;var Be=L(R,me,q[Ee],G);if(Be===null){me===null&&(me=Me);break}e&&me&&Be.alternate===null&&t(R,me),C=u(Be,C,Ee),Ue===null?ge=Be:Ue.sibling=Be,Ue=Be,me=Me}if(Ee===q.length)return i(R,me),Re&&In(R,Ee),ge;if(me===null){for(;Ee<q.length;Ee++)me=I(R,q[Ee],G),me!==null&&(C=u(me,C,Ee),Ue===null?ge=me:Ue.sibling=me,Ue=me);return Re&&In(R,Ee),ge}for(me=l(me);Ee<q.length;Ee++)Me=P(me,R,Ee,q[Ee],G),Me!==null&&(e&&Me.alternate!==null&&me.delete(Me.key===null?Ee:Me.key),C=u(Me,C,Ee),Ue===null?ge=Me:Ue.sibling=Me,Ue=Me);return e&&me.forEach(function($s){return t(R,$s)}),Re&&In(R,Ee),ge}function ye(R,C,q,G){if(q==null)throw Error(a(151));for(var ge=null,Ue=null,me=C,Ee=C=0,Me=null,Be=q.next();me!==null&&!Be.done;Ee++,Be=q.next()){me.index>Ee?(Me=me,me=null):Me=me.sibling;var $s=L(R,me,Be.value,G);if($s===null){me===null&&(me=Me);break}e&&me&&$s.alternate===null&&t(R,me),C=u($s,C,Ee),Ue===null?ge=$s:Ue.sibling=$s,Ue=$s,me=Me}if(Be.done)return i(R,me),Re&&In(R,Ee),ge;if(me===null){for(;!Be.done;Ee++,Be=q.next())Be=I(R,Be.value,G),Be!==null&&(C=u(Be,C,Ee),Ue===null?ge=Be:Ue.sibling=Be,Ue=Be);return Re&&In(R,Ee),ge}for(me=l(me);!Be.done;Ee++,Be=q.next())Be=P(me,R,Ee,Be.value,G),Be!==null&&(e&&Be.alternate!==null&&me.delete(Be.key===null?Ee:Be.key),C=u(Be,C,Ee),Ue===null?ge=Be:Ue.sibling=Be,Ue=Be);return e&&me.forEach(function(gx){return t(R,gx)}),Re&&In(R,Ee),ge}function Je(R,C,q,G){if(typeof q=="object"&&q!==null&&q.type===B&&q.key===null&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case z:e:{for(var ge=q.key;C!==null;){if(C.key===ge){if(ge=q.type,ge===B){if(C.tag===7){i(R,C.sibling),G=c(C,q.props.children),G.return=R,R=G;break e}}else if(C.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===W&&yi(ge)===C.type){i(R,C.sibling),G=c(C,q.props),Ir(G,q),G.return=R,R=G;break e}i(R,C);break}else t(R,C);C=C.sibling}q.type===B?(G=hi(q.props.children,R.mode,G,q.key),G.return=R,R=G):(G=ml(q.type,q.key,q.props,null,R.mode,G),Ir(G,q),G.return=R,R=G)}return p(R);case M:e:{for(ge=q.key;C!==null;){if(C.key===ge)if(C.tag===4&&C.stateNode.containerInfo===q.containerInfo&&C.stateNode.implementation===q.implementation){i(R,C.sibling),G=c(C,q.children||[]),G.return=R,R=G;break e}else{i(R,C);break}else t(R,C);C=C.sibling}G=Sc(q,R.mode,G),G.return=R,R=G}return p(R);case W:return q=yi(q),Je(R,C,q,G)}if(Le(q))return he(R,C,q,G);if(re(q)){if(ge=re(q),typeof ge!="function")throw Error(a(150));return q=ge.call(q),ye(R,C,q,G)}if(typeof q.then=="function")return Je(R,C,_l(q),G);if(q.$$typeof===pe)return Je(R,C,yl(R,q),G);wl(R,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,C!==null&&C.tag===6?(i(R,C.sibling),G=c(C,q),G.return=R,R=G):(i(R,C),G=wc(q,R.mode,G),G.return=R,R=G),p(R)):i(R,C)}return function(R,C,q,G){try{Qr=0;var ge=Je(R,C,q,G);return Ki=null,ge}catch(me){if(me===Xi||me===xl)throw me;var Ue=Vt(29,me,null,R.mode);return Ue.lanes=G,Ue.return=R,Ue}finally{}}}var xi=md(!0),pd=md(!1),As=!1;function zc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function qc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Os(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function js(e,t,i){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(He&2)!==0){var c=l.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),l.pending=t,t=dl(e),Zh(e,null,i),t}return hl(e,l,t,i),dl(e)}function Xr(e,t,i){if(t=t.updateQueue,t!==null&&(t=t.shared,(i&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,i|=l,t.lanes=i,ri(e,i)}}function Uc(e,t){var i=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,i===l)){var c=null,u=null;if(i=i.firstBaseUpdate,i!==null){do{var p={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};u===null?c=u=p:u=u.next=p,i=i.next}while(i!==null);u===null?c=u=t:u=u.next=t}else c=u=t;i={baseState:l.baseState,firstBaseUpdate:c,lastBaseUpdate:u,shared:l.shared,callbacks:l.callbacks},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}var Bc=!1;function Kr(){if(Bc){var e=Ii;if(e!==null)throw e}}function Zr(e,t,i,l){Bc=!1;var c=e.updateQueue;As=!1;var u=c.firstBaseUpdate,p=c.lastBaseUpdate,b=c.shared.pending;if(b!==null){c.shared.pending=null;var O=b,U=O.next;O.next=null,p===null?u=U:p.next=U,p=O;var Y=e.alternate;Y!==null&&(Y=Y.updateQueue,b=Y.lastBaseUpdate,b!==p&&(b===null?Y.firstBaseUpdate=U:b.next=U,Y.lastBaseUpdate=O))}if(u!==null){var I=c.baseState;p=0,Y=U=O=null,b=u;do{var L=b.lane&-536870913,P=L!==b.lane;if(P?(ke&L)===L:(l&L)===L){L!==0&&L===Qi&&(Bc=!0),Y!==null&&(Y=Y.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var he=e,ye=b;L=t;var Je=i;switch(ye.tag){case 1:if(he=ye.payload,typeof he=="function"){I=he.call(Je,I,L);break e}I=he;break e;case 3:he.flags=he.flags&-65537|128;case 0:if(he=ye.payload,L=typeof he=="function"?he.call(Je,I,L):he,L==null)break e;I=w({},I,L);break e;case 2:As=!0}}L=b.callback,L!==null&&(e.flags|=64,P&&(e.flags|=8192),P=c.callbacks,P===null?c.callbacks=[L]:P.push(L))}else P={lane:L,tag:b.tag,payload:b.payload,callback:b.callback,next:null},Y===null?(U=Y=P,O=I):Y=Y.next=P,p|=L;if(b=b.next,b===null){if(b=c.shared.pending,b===null)break;P=b,b=P.next,P.next=null,c.lastBaseUpdate=P,c.shared.pending=null}}while(!0);Y===null&&(O=I),c.baseState=O,c.firstBaseUpdate=U,c.lastBaseUpdate=Y,u===null&&(c.shared.lanes=0),Ms|=p,e.lanes=p,e.memoizedState=I}}function gd(e,t){if(typeof e!="function")throw Error(a(191,e));e.call(t)}function yd(e,t){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;e<i.length;e++)gd(i[e],t)}var Zi=je(null),Sl=je(0);function bd(e,t){e=as,Te(Sl,e),Te(Zi,t),as=e|t.baseLanes}function Lc(){Te(Sl,as),Te(Zi,Zi.current)}function Hc(){as=Sl.current,_e(Zi),_e(Sl)}var Ft=je(null),dn=null;function Ts(e){var t=e.alternate;Te(ct,ct.current&1),Te(Ft,e),dn===null&&(t===null||Zi.current!==null||t.memoizedState!==null)&&(dn=e)}function Pc(e){Te(ct,ct.current),Te(Ft,e),dn===null&&(dn=e)}function xd(e){e.tag===22?(Te(ct,ct.current),Te(Ft,e),dn===null&&(dn=e)):Ns()}function Ns(){Te(ct,ct.current),Te(Ft,Ft.current)}function Jt(e){_e(Ft),dn===e&&(dn=null),_e(ct)}var ct=je(0);function El(e){for(var t=e;t!==null;){if(t.tag===13){var i=t.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||Ju(i)||Qu(i)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Zn=0,Se=null,Ve=null,dt=null,Al=!1,Wi=!1,vi=!1,Ol=0,Wr=0,er=null,ab=0;function rt(){throw Error(a(321))}function $c(e,t){if(t===null)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!Gt(e[i],t[i]))return!1;return!0}function Yc(e,t,i,l,c,u){return Zn=u,Se=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,$.H=e===null||e.memoizedState===null?nm:iu,vi=!1,u=i(l,c),vi=!1,Wi&&(u=_d(t,i,l,c)),vd(e),u}function vd(e){$.H=na;var t=Ve!==null&&Ve.next!==null;if(Zn=0,dt=Ve=Se=null,Al=!1,Wr=0,er=null,t)throw Error(a(300));e===null||mt||(e=e.dependencies,e!==null&&gl(e)&&(mt=!0))}function _d(e,t,i,l){Se=e;var c=0;do{if(Wi&&(er=null),Wr=0,Wi=!1,25<=c)throw Error(a(301));if(c+=1,dt=Ve=null,e.updateQueue!=null){var u=e.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}$.H=sm,u=t(i,l)}while(Wi);return u}function lb(){var e=$.H,t=e.useState()[0];return t=typeof t.then=="function"?ea(t):t,e=e.useState()[0],(Ve!==null?Ve.memoizedState:null)!==e&&(Se.flags|=1024),t}function Gc(){var e=Ol!==0;return Ol=0,e}function Vc(e,t,i){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i}function Fc(e){if(Al){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Al=!1}Zn=0,dt=Ve=Se=null,Wi=!1,Wr=Ol=0,er=null}function kt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return dt===null?Se.memoizedState=dt=e:dt=dt.next=e,dt}function ut(){if(Ve===null){var e=Se.alternate;e=e!==null?e.memoizedState:null}else e=Ve.next;var t=dt===null?Se.memoizedState:dt.next;if(t!==null)dt=t,Ve=e;else{if(e===null)throw Se.alternate===null?Error(a(467)):Error(a(310));Ve=e,e={memoizedState:Ve.memoizedState,baseState:Ve.baseState,baseQueue:Ve.baseQueue,queue:Ve.queue,next:null},dt===null?Se.memoizedState=dt=e:dt=dt.next=e}return dt}function jl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ea(e){var t=Wr;return Wr+=1,er===null&&(er=[]),e=fd(er,e,t),t=Se,(dt===null?t.memoizedState:dt.next)===null&&(t=t.alternate,$.H=t===null||t.memoizedState===null?nm:iu),e}function Tl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ea(e);if(e.$$typeof===pe)return St(e)}throw Error(a(438,String(e)))}function Jc(e){var t=null,i=Se.updateQueue;if(i!==null&&(t=i.memoCache),t==null){var l=Se.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(c){return c.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),i===null&&(i=jl(),Se.updateQueue=i),i.memoCache=t,i=t.data[t.index],i===void 0)for(i=t.data[t.index]=Array(e),l=0;l<e;l++)i[l]=Z;return t.index++,i}function Wn(e,t){return typeof t=="function"?t(e):t}function Nl(e){var t=ut();return Qc(t,Ve,e)}function Qc(e,t,i){var l=e.queue;if(l===null)throw Error(a(311));l.lastRenderedReducer=i;var c=e.baseQueue,u=l.pending;if(u!==null){if(c!==null){var p=c.next;c.next=u.next,u.next=p}t.baseQueue=c=u,l.pending=null}if(u=e.baseState,c===null)e.memoizedState=u;else{t=c.next;var b=p=null,O=null,U=t,Y=!1;do{var I=U.lane&-536870913;if(I!==U.lane?(ke&I)===I:(Zn&I)===I){var L=U.revertLane;if(L===0)O!==null&&(O=O.next={lane:0,revertLane:0,gesture:null,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null}),I===Qi&&(Y=!0);else if((Zn&L)===L){U=U.next,L===Qi&&(Y=!0);continue}else I={lane:0,revertLane:U.revertLane,gesture:null,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null},O===null?(b=O=I,p=u):O=O.next=I,Se.lanes|=L,Ms|=L;I=U.action,vi&&i(u,I),u=U.hasEagerState?U.eagerState:i(u,I)}else L={lane:I,revertLane:U.revertLane,gesture:U.gesture,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null},O===null?(b=O=L,p=u):O=O.next=L,Se.lanes|=I,Ms|=I;U=U.next}while(U!==null&&U!==t);if(O===null?p=u:O.next=b,!Gt(u,e.memoizedState)&&(mt=!0,Y&&(i=Ii,i!==null)))throw i;e.memoizedState=u,e.baseState=p,e.baseQueue=O,l.lastRenderedState=u}return c===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Ic(e){var t=ut(),i=t.queue;if(i===null)throw Error(a(311));i.lastRenderedReducer=e;var l=i.dispatch,c=i.pending,u=t.memoizedState;if(c!==null){i.pending=null;var p=c=c.next;do u=e(u,p.action),p=p.next;while(p!==c);Gt(u,t.memoizedState)||(mt=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),i.lastRenderedState=u}return[u,l]}function wd(e,t,i){var l=Se,c=ut(),u=Re;if(u){if(i===void 0)throw Error(a(407));i=i()}else i=t();var p=!Gt((Ve||c).memoizedState,i);if(p&&(c.memoizedState=i,mt=!0),c=c.queue,Zc(Ad.bind(null,l,c,e),[e]),c.getSnapshot!==t||p||dt!==null&&dt.memoizedState.tag&1){if(l.flags|=2048,tr(9,{destroy:void 0},Ed.bind(null,l,c,i,t),null),Ie===null)throw Error(a(349));u||(Zn&127)!==0||Sd(l,t,i)}return i}function Sd(e,t,i){e.flags|=16384,e={getSnapshot:t,value:i},t=Se.updateQueue,t===null?(t=jl(),Se.updateQueue=t,t.stores=[e]):(i=t.stores,i===null?t.stores=[e]:i.push(e))}function Ed(e,t,i,l){t.value=i,t.getSnapshot=l,Od(t)&&jd(e)}function Ad(e,t,i){return i(function(){Od(t)&&jd(e)})}function Od(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!Gt(e,i)}catch{return!0}}function jd(e){var t=fi(e,2);t!==null&&Ht(t,e,2)}function Xc(e){var t=kt();if(typeof e=="function"){var i=e;if(e=i(),vi){$t(!0);try{i()}finally{$t(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wn,lastRenderedState:e},t}function Td(e,t,i,l){return e.baseState=i,Qc(e,Ve,typeof l=="function"?l:Wn)}function ob(e,t,i,l,c){if(Ml(e))throw Error(a(485));if(e=t.action,e!==null){var u={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(p){u.listeners.push(p)}};$.T!==null?i(!0):u.isTransition=!1,l(u),i=t.pending,i===null?(u.next=t.pending=u,Nd(t,u)):(u.next=i.next,t.pending=i.next=u)}}function Nd(e,t){var i=t.action,l=t.payload,c=e.state;if(t.isTransition){var u=$.T,p={};$.T=p;try{var b=i(c,l),O=$.S;O!==null&&O(p,b),Cd(e,t,b)}catch(U){Kc(e,t,U)}finally{u!==null&&p.types!==null&&(u.types=p.types),$.T=u}}else try{u=i(c,l),Cd(e,t,u)}catch(U){Kc(e,t,U)}}function Cd(e,t,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(l){kd(e,t,l)},function(l){return Kc(e,t,l)}):kd(e,t,i)}function kd(e,t,i){t.status="fulfilled",t.value=i,Md(t),e.state=i,t=e.pending,t!==null&&(i=t.next,i===t?e.pending=null:(i=i.next,t.next=i,Nd(e,i)))}function Kc(e,t,i){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=i,Md(t),t=t.next;while(t!==l)}e.action=null}function Md(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Rd(e,t){return t}function Dd(e,t){if(Re){var i=Ie.formState;if(i!==null){e:{var l=Se;if(Re){if(Ze){t:{for(var c=Ze,u=hn;c.nodeType!==8;){if(!u){c=null;break t}if(c=mn(c.nextSibling),c===null){c=null;break t}}u=c.data,c=u==="F!"||u==="F"?c:null}if(c){Ze=mn(c.nextSibling),l=c.data==="F!";break e}}Ss(l)}l=!1}l&&(t=i[0])}}return i=kt(),i.memoizedState=i.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rd,lastRenderedState:t},i.queue=l,i=Wd.bind(null,Se,l),l.dispatch=i,l=Xc(!1),u=su.bind(null,Se,!1,l.queue),l=kt(),c={state:t,dispatch:null,action:e,pending:null},l.queue=c,i=ob.bind(null,Se,c,u,i),c.dispatch=i,l.memoizedState=e,[t,i,!1]}function zd(e){var t=ut();return qd(t,Ve,e)}function qd(e,t,i){if(t=Qc(e,t,Rd)[0],e=Nl(Wn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=ea(t)}catch(p){throw p===Xi?xl:p}else l=t;t=ut();var c=t.queue,u=c.dispatch;return i!==t.memoizedState&&(Se.flags|=2048,tr(9,{destroy:void 0},cb.bind(null,c,i),null)),[l,u,e]}function cb(e,t){e.action=t}function Ud(e){var t=ut(),i=Ve;if(i!==null)return qd(t,i,e);ut(),t=t.memoizedState,i=ut();var l=i.queue.dispatch;return i.memoizedState=e,[t,l,!1]}function tr(e,t,i,l){return e={tag:e,create:i,deps:l,inst:t,next:null},t=Se.updateQueue,t===null&&(t=jl(),Se.updateQueue=t),i=t.lastEffect,i===null?t.lastEffect=e.next=e:(l=i.next,i.next=e,e.next=l,t.lastEffect=e),e}function Bd(){return ut().memoizedState}function Cl(e,t,i,l){var c=kt();Se.flags|=e,c.memoizedState=tr(1|t,{destroy:void 0},i,l===void 0?null:l)}function kl(e,t,i,l){var c=ut();l=l===void 0?null:l;var u=c.memoizedState.inst;Ve!==null&&l!==null&&$c(l,Ve.memoizedState.deps)?c.memoizedState=tr(t,u,i,l):(Se.flags|=e,c.memoizedState=tr(1|t,u,i,l))}function Ld(e,t){Cl(8390656,8,e,t)}function Zc(e,t){kl(2048,8,e,t)}function ub(e){Se.flags|=4;var t=Se.updateQueue;if(t===null)t=jl(),Se.updateQueue=t,t.events=[e];else{var i=t.events;i===null?t.events=[e]:i.push(e)}}function Hd(e){var t=ut().memoizedState;return ub({ref:t,nextImpl:e}),function(){if((He&2)!==0)throw Error(a(440));return t.impl.apply(void 0,arguments)}}function Pd(e,t){return kl(4,2,e,t)}function $d(e,t){return kl(4,4,e,t)}function Yd(e,t){if(typeof t=="function"){e=e();var i=t(e);return function(){typeof i=="function"?i():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Gd(e,t,i){i=i!=null?i.concat([e]):null,kl(4,4,Yd.bind(null,t,e),i)}function Wc(){}function Vd(e,t){var i=ut();t=t===void 0?null:t;var l=i.memoizedState;return t!==null&&$c(t,l[1])?l[0]:(i.memoizedState=[e,t],e)}function Fd(e,t){var i=ut();t=t===void 0?null:t;var l=i.memoizedState;if(t!==null&&$c(t,l[1]))return l[0];if(l=e(),vi){$t(!0);try{e()}finally{$t(!1)}}return i.memoizedState=[l,t],l}function eu(e,t,i){return i===void 0||(Zn&1073741824)!==0&&(ke&261930)===0?e.memoizedState=t:(e.memoizedState=i,e=Jm(),Se.lanes|=e,Ms|=e,i)}function Jd(e,t,i,l){return Gt(i,t)?i:Zi.current!==null?(e=eu(e,i,l),Gt(e,t)||(mt=!0),e):(Zn&42)===0||(Zn&1073741824)!==0&&(ke&261930)===0?(mt=!0,e.memoizedState=i):(e=Jm(),Se.lanes|=e,Ms|=e,t)}function Qd(e,t,i,l,c){var u=te.p;te.p=u!==0&&8>u?u:8;var p=$.T,b={};$.T=b,su(e,!1,t,i);try{var O=c(),U=$.S;if(U!==null&&U(b,O),O!==null&&typeof O=="object"&&typeof O.then=="function"){var Y=rb(O,l);ta(e,t,Y,Xt(e))}else ta(e,t,l,Xt(e))}catch(I){ta(e,t,{then:function(){},status:"rejected",reason:I},Xt())}finally{te.p=u,p!==null&&b.types!==null&&(p.types=b.types),$.T=p}}function fb(){}function tu(e,t,i,l){if(e.tag!==5)throw Error(a(476));var c=Id(e).queue;Qd(e,c,t,de,i===null?fb:function(){return Xd(e),i(l)})}function Id(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:de,baseState:de,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wn,lastRenderedState:de},next:null};var i={};return t.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wn,lastRenderedState:i},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Xd(e){var t=Id(e);t.next===null&&(t=e.alternate.memoizedState),ta(e,t.next.queue,{},Xt())}function nu(){return St(ba)}function Kd(){return ut().memoizedState}function Zd(){return ut().memoizedState}function hb(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var i=Xt();e=Os(i);var l=js(t,e,i);l!==null&&(Ht(l,t,i),Xr(l,t,i)),t={cache:kc()},e.payload=t;return}t=t.return}}function db(e,t,i){var l=Xt();i={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Ml(e)?em(t,i):(i=vc(e,t,i,l),i!==null&&(Ht(i,e,l),tm(i,t,l)))}function Wd(e,t,i){var l=Xt();ta(e,t,i,l)}function ta(e,t,i,l){var c={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(Ml(e))em(t,c);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var p=t.lastRenderedState,b=u(p,i);if(c.hasEagerState=!0,c.eagerState=b,Gt(b,p))return hl(e,t,c,0),Ie===null&&fl(),!1}catch{}finally{}if(i=vc(e,t,c,l),i!==null)return Ht(i,e,l),tm(i,t,l),!0}return!1}function su(e,t,i,l){if(l={lane:2,revertLane:zu(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Ml(e)){if(t)throw Error(a(479))}else t=vc(e,i,l,2),t!==null&&Ht(t,e,2)}function Ml(e){var t=e.alternate;return e===Se||t!==null&&t===Se}function em(e,t){Wi=Al=!0;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function tm(e,t,i){if((i&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,i|=l,t.lanes=i,ri(e,i)}}var na={readContext:St,use:Tl,useCallback:rt,useContext:rt,useEffect:rt,useImperativeHandle:rt,useLayoutEffect:rt,useInsertionEffect:rt,useMemo:rt,useReducer:rt,useRef:rt,useState:rt,useDebugValue:rt,useDeferredValue:rt,useTransition:rt,useSyncExternalStore:rt,useId:rt,useHostTransitionStatus:rt,useFormState:rt,useActionState:rt,useOptimistic:rt,useMemoCache:rt,useCacheRefresh:rt};na.useEffectEvent=rt;var nm={readContext:St,use:Tl,useCallback:function(e,t){return kt().memoizedState=[e,t===void 0?null:t],e},useContext:St,useEffect:Ld,useImperativeHandle:function(e,t,i){i=i!=null?i.concat([e]):null,Cl(4194308,4,Yd.bind(null,t,e),i)},useLayoutEffect:function(e,t){return Cl(4194308,4,e,t)},useInsertionEffect:function(e,t){Cl(4,2,e,t)},useMemo:function(e,t){var i=kt();t=t===void 0?null:t;var l=e();if(vi){$t(!0);try{e()}finally{$t(!1)}}return i.memoizedState=[l,t],l},useReducer:function(e,t,i){var l=kt();if(i!==void 0){var c=i(t);if(vi){$t(!0);try{i(t)}finally{$t(!1)}}}else c=t;return l.memoizedState=l.baseState=c,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:c},l.queue=e,e=e.dispatch=db.bind(null,Se,e),[l.memoizedState,e]},useRef:function(e){var t=kt();return e={current:e},t.memoizedState=e},useState:function(e){e=Xc(e);var t=e.queue,i=Wd.bind(null,Se,t);return t.dispatch=i,[e.memoizedState,i]},useDebugValue:Wc,useDeferredValue:function(e,t){var i=kt();return eu(i,e,t)},useTransition:function(){var e=Xc(!1);return e=Qd.bind(null,Se,e.queue,!0,!1),kt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,i){var l=Se,c=kt();if(Re){if(i===void 0)throw Error(a(407));i=i()}else{if(i=t(),Ie===null)throw Error(a(349));(ke&127)!==0||Sd(l,t,i)}c.memoizedState=i;var u={value:i,getSnapshot:t};return c.queue=u,Ld(Ad.bind(null,l,u,e),[e]),l.flags|=2048,tr(9,{destroy:void 0},Ed.bind(null,l,u,i,t),null),i},useId:function(){var e=kt(),t=Ie.identifierPrefix;if(Re){var i=Mn,l=kn;i=(l&~(1<<32-Nt(l)-1)).toString(32)+i,t="_"+t+"R_"+i,i=Ol++,0<i&&(t+="H"+i.toString(32)),t+="_"}else i=ab++,t="_"+t+"r_"+i.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:nu,useFormState:Dd,useActionState:Dd,useOptimistic:function(e){var t=kt();t.memoizedState=t.baseState=e;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=i,t=su.bind(null,Se,!0,i),i.dispatch=t,[e,t]},useMemoCache:Jc,useCacheRefresh:function(){return kt().memoizedState=hb.bind(null,Se)},useEffectEvent:function(e){var t=kt(),i={impl:e};return t.memoizedState=i,function(){if((He&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}},iu={readContext:St,use:Tl,useCallback:Vd,useContext:St,useEffect:Zc,useImperativeHandle:Gd,useInsertionEffect:Pd,useLayoutEffect:$d,useMemo:Fd,useReducer:Nl,useRef:Bd,useState:function(){return Nl(Wn)},useDebugValue:Wc,useDeferredValue:function(e,t){var i=ut();return Jd(i,Ve.memoizedState,e,t)},useTransition:function(){var e=Nl(Wn)[0],t=ut().memoizedState;return[typeof e=="boolean"?e:ea(e),t]},useSyncExternalStore:wd,useId:Kd,useHostTransitionStatus:nu,useFormState:zd,useActionState:zd,useOptimistic:function(e,t){var i=ut();return Td(i,Ve,e,t)},useMemoCache:Jc,useCacheRefresh:Zd};iu.useEffectEvent=Hd;var sm={readContext:St,use:Tl,useCallback:Vd,useContext:St,useEffect:Zc,useImperativeHandle:Gd,useInsertionEffect:Pd,useLayoutEffect:$d,useMemo:Fd,useReducer:Ic,useRef:Bd,useState:function(){return Ic(Wn)},useDebugValue:Wc,useDeferredValue:function(e,t){var i=ut();return Ve===null?eu(i,e,t):Jd(i,Ve.memoizedState,e,t)},useTransition:function(){var e=Ic(Wn)[0],t=ut().memoizedState;return[typeof e=="boolean"?e:ea(e),t]},useSyncExternalStore:wd,useId:Kd,useHostTransitionStatus:nu,useFormState:Ud,useActionState:Ud,useOptimistic:function(e,t){var i=ut();return Ve!==null?Td(i,Ve,e,t):(i.baseState=e,[e,i.queue.dispatch])},useMemoCache:Jc,useCacheRefresh:Zd};sm.useEffectEvent=Hd;function ru(e,t,i,l){t=e.memoizedState,i=i(l,t),i=i==null?t:w({},t,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var au={enqueueSetState:function(e,t,i){e=e._reactInternals;var l=Xt(),c=Os(l);c.payload=t,i!=null&&(c.callback=i),t=js(e,c,l),t!==null&&(Ht(t,e,l),Xr(t,e,l))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var l=Xt(),c=Os(l);c.tag=1,c.payload=t,i!=null&&(c.callback=i),t=js(e,c,l),t!==null&&(Ht(t,e,l),Xr(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=Xt(),l=Os(i);l.tag=2,t!=null&&(l.callback=t),t=js(e,l,i),t!==null&&(Ht(t,e,i),Xr(t,e,i))}};function im(e,t,i,l,c,u,p){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,u,p):t.prototype&&t.prototype.isPureReactComponent?!$r(i,l)||!$r(c,u):!0}function rm(e,t,i,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(i,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(i,l),t.state!==e&&au.enqueueReplaceState(t,t.state,null)}function _i(e,t){var i=t;if("ref"in t){i={};for(var l in t)l!=="ref"&&(i[l]=t[l])}if(e=e.defaultProps){i===t&&(i=w({},i));for(var c in e)i[c]===void 0&&(i[c]=e[c])}return i}function am(e){ul(e)}function lm(e){console.error(e)}function om(e){ul(e)}function Rl(e,t){try{var i=e.onUncaughtError;i(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function cm(e,t,i){try{var l=e.onCaughtError;l(i.value,{componentStack:i.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function lu(e,t,i){return i=Os(i),i.tag=3,i.payload={element:null},i.callback=function(){Rl(e,t)},i}function um(e){return e=Os(e),e.tag=3,e}function fm(e,t,i,l){var c=i.type.getDerivedStateFromError;if(typeof c=="function"){var u=l.value;e.payload=function(){return c(u)},e.callback=function(){cm(t,i,l)}}var p=i.stateNode;p!==null&&typeof p.componentDidCatch=="function"&&(e.callback=function(){cm(t,i,l),typeof c!="function"&&(Rs===null?Rs=new Set([this]):Rs.add(this));var b=l.stack;this.componentDidCatch(l.value,{componentStack:b!==null?b:""})})}function mb(e,t,i,l,c){if(i.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=i.alternate,t!==null&&Ji(t,i,c,!0),i=Ft.current,i!==null){switch(i.tag){case 31:case 13:return dn===null?Vl():i.alternate===null&&at===0&&(at=3),i.flags&=-257,i.flags|=65536,i.lanes=c,l===vl?i.flags|=16384:(t=i.updateQueue,t===null?i.updateQueue=new Set([l]):t.add(l),Mu(e,l,c)),!1;case 22:return i.flags|=65536,l===vl?i.flags|=16384:(t=i.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([l])},i.updateQueue=t):(i=t.retryQueue,i===null?t.retryQueue=new Set([l]):i.add(l)),Mu(e,l,c)),!1}throw Error(a(435,i.tag))}return Mu(e,l,c),Vl(),!1}if(Re)return t=Ft.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,l!==Oc&&(e=Error(a(422),{cause:l}),Vr(cn(e,i)))):(l!==Oc&&(t=Error(a(423),{cause:l}),Vr(cn(t,i))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,l=cn(l,i),c=lu(e.stateNode,l,c),Uc(e,c),at!==4&&(at=2)),!1;var u=Error(a(520),{cause:l});if(u=cn(u,i),ua===null?ua=[u]:ua.push(u),at!==4&&(at=2),t===null)return!0;l=cn(l,i),i=t;do{switch(i.tag){case 3:return i.flags|=65536,e=c&-c,i.lanes|=e,e=lu(i.stateNode,l,e),Uc(i,e),!1;case 1:if(t=i.type,u=i.stateNode,(i.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(Rs===null||!Rs.has(u))))return i.flags|=65536,c&=-c,i.lanes|=c,c=um(c),fm(c,e,i,l),Uc(i,c),!1}i=i.return}while(i!==null);return!1}var ou=Error(a(461)),mt=!1;function Et(e,t,i,l){t.child=e===null?pd(t,null,i,l):xi(t,e.child,i,l)}function hm(e,t,i,l,c){i=i.render;var u=t.ref;if("ref"in l){var p={};for(var b in l)b!=="ref"&&(p[b]=l[b])}else p=l;return pi(t),l=Yc(e,t,i,p,u,c),b=Gc(),e!==null&&!mt?(Vc(e,t,c),es(e,t,c)):(Re&&b&&Ec(t),t.flags|=1,Et(e,t,l,c),t.child)}function dm(e,t,i,l,c){if(e===null){var u=i.type;return typeof u=="function"&&!_c(u)&&u.defaultProps===void 0&&i.compare===null?(t.tag=15,t.type=u,mm(e,t,u,l,c)):(e=ml(i.type,null,l,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!gu(e,c)){var p=u.memoizedProps;if(i=i.compare,i=i!==null?i:$r,i(p,l)&&e.ref===t.ref)return es(e,t,c)}return t.flags|=1,e=Qn(u,l),e.ref=t.ref,e.return=t,t.child=e}function mm(e,t,i,l,c){if(e!==null){var u=e.memoizedProps;if($r(u,l)&&e.ref===t.ref)if(mt=!1,t.pendingProps=l=u,gu(e,c))(e.flags&131072)!==0&&(mt=!0);else return t.lanes=e.lanes,es(e,t,c)}return cu(e,t,i,l,c)}function pm(e,t,i,l){var c=l.children,u=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((t.flags&128)!==0){if(u=u!==null?u.baseLanes|i:i,e!==null){for(l=t.child=e.child,c=0;l!==null;)c=c|l.lanes|l.childLanes,l=l.sibling;l=c&~u}else l=0,t.child=null;return gm(e,t,u,i,l)}if((i&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&bl(t,u!==null?u.cachePool:null),u!==null?bd(t,u):Lc(),xd(t);else return l=t.lanes=536870912,gm(e,t,u!==null?u.baseLanes|i:i,i,l)}else u!==null?(bl(t,u.cachePool),bd(t,u),Ns(),t.memoizedState=null):(e!==null&&bl(t,null),Lc(),Ns());return Et(e,t,c,i),t.child}function sa(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function gm(e,t,i,l,c){var u=Rc();return u=u===null?null:{parent:ht._currentValue,pool:u},t.memoizedState={baseLanes:i,cachePool:u},e!==null&&bl(t,null),Lc(),xd(t),e!==null&&Ji(e,t,l,!0),t.childLanes=c,null}function Dl(e,t){return t=ql({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function ym(e,t,i){return xi(t,e.child,null,i),e=Dl(t,t.pendingProps),e.flags|=2,Jt(t),t.memoizedState=null,e}function pb(e,t,i){var l=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Re){if(l.mode==="hidden")return e=Dl(t,l),t.lanes=536870912,sa(null,e);if(Pc(t),(e=Ze)?(e=Np(e,hn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:_s!==null?{id:kn,overflow:Mn}:null,retryLane:536870912,hydrationErrors:null},i=ed(e),i.return=t,t.child=i,wt=t,Ze=null)):e=null,e===null)throw Ss(t);return t.lanes=536870912,null}return Dl(t,l)}var u=e.memoizedState;if(u!==null){var p=u.dehydrated;if(Pc(t),c)if(t.flags&256)t.flags&=-257,t=ym(e,t,i);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(a(558));else if(mt||Ji(e,t,i,!1),c=(i&e.childLanes)!==0,mt||c){if(l=Ie,l!==null&&(p=xs(l,i),p!==0&&p!==u.retryLane))throw u.retryLane=p,fi(e,p),Ht(l,e,p),ou;Vl(),t=ym(e,t,i)}else e=u.treeContext,Ze=mn(p.nextSibling),wt=t,Re=!0,ws=null,hn=!1,e!==null&&sd(t,e),t=Dl(t,l),t.flags|=4096;return t}return e=Qn(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function zl(e,t){var i=t.ref;if(i===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(a(284));(e===null||e.ref!==i)&&(t.flags|=4194816)}}function cu(e,t,i,l,c){return pi(t),i=Yc(e,t,i,l,void 0,c),l=Gc(),e!==null&&!mt?(Vc(e,t,c),es(e,t,c)):(Re&&l&&Ec(t),t.flags|=1,Et(e,t,i,c),t.child)}function bm(e,t,i,l,c,u){return pi(t),t.updateQueue=null,i=_d(t,l,i,c),vd(e),l=Gc(),e!==null&&!mt?(Vc(e,t,u),es(e,t,u)):(Re&&l&&Ec(t),t.flags|=1,Et(e,t,i,u),t.child)}function xm(e,t,i,l,c){if(pi(t),t.stateNode===null){var u=Yi,p=i.contextType;typeof p=="object"&&p!==null&&(u=St(p)),u=new i(l,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=au,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=l,u.state=t.memoizedState,u.refs={},zc(t),p=i.contextType,u.context=typeof p=="object"&&p!==null?St(p):Yi,u.state=t.memoizedState,p=i.getDerivedStateFromProps,typeof p=="function"&&(ru(t,i,p,l),u.state=t.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(p=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),p!==u.state&&au.enqueueReplaceState(u,u.state,null),Zr(t,l,u,c),Kr(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){u=t.stateNode;var b=t.memoizedProps,O=_i(i,b);u.props=O;var U=u.context,Y=i.contextType;p=Yi,typeof Y=="object"&&Y!==null&&(p=St(Y));var I=i.getDerivedStateFromProps;Y=typeof I=="function"||typeof u.getSnapshotBeforeUpdate=="function",b=t.pendingProps!==b,Y||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(b||U!==p)&&rm(t,u,l,p),As=!1;var L=t.memoizedState;u.state=L,Zr(t,l,u,c),Kr(),U=t.memoizedState,b||L!==U||As?(typeof I=="function"&&(ru(t,i,I,l),U=t.memoizedState),(O=As||im(t,i,O,l,L,U,p))?(Y||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=U),u.props=l,u.state=U,u.context=p,l=O):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{u=t.stateNode,qc(e,t),p=t.memoizedProps,Y=_i(i,p),u.props=Y,I=t.pendingProps,L=u.context,U=i.contextType,O=Yi,typeof U=="object"&&U!==null&&(O=St(U)),b=i.getDerivedStateFromProps,(U=typeof b=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(p!==I||L!==O)&&rm(t,u,l,O),As=!1,L=t.memoizedState,u.state=L,Zr(t,l,u,c),Kr();var P=t.memoizedState;p!==I||L!==P||As||e!==null&&e.dependencies!==null&&gl(e.dependencies)?(typeof b=="function"&&(ru(t,i,b,l),P=t.memoizedState),(Y=As||im(t,i,Y,l,L,P,O)||e!==null&&e.dependencies!==null&&gl(e.dependencies))?(U||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(l,P,O),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(l,P,O)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=P),u.props=l,u.state=P,u.context=O,l=Y):(typeof u.componentDidUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),l=!1)}return u=l,zl(e,t),l=(t.flags&128)!==0,u||l?(u=t.stateNode,i=l&&typeof i.getDerivedStateFromError!="function"?null:u.render(),t.flags|=1,e!==null&&l?(t.child=xi(t,e.child,null,c),t.child=xi(t,null,i,c)):Et(e,t,i,c),t.memoizedState=u.state,e=t.child):e=es(e,t,c),e}function vm(e,t,i,l){return di(),t.flags|=256,Et(e,t,i,l),t.child}var uu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function fu(e){return{baseLanes:e,cachePool:cd()}}function hu(e,t,i){return e=e!==null?e.childLanes&~i:0,t&&(e|=It),e}function _m(e,t,i){var l=t.pendingProps,c=!1,u=(t.flags&128)!==0,p;if((p=u)||(p=e!==null&&e.memoizedState===null?!1:(ct.current&2)!==0),p&&(c=!0,t.flags&=-129),p=(t.flags&32)!==0,t.flags&=-33,e===null){if(Re){if(c?Ts(t):Ns(),(e=Ze)?(e=Np(e,hn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:_s!==null?{id:kn,overflow:Mn}:null,retryLane:536870912,hydrationErrors:null},i=ed(e),i.return=t,t.child=i,wt=t,Ze=null)):e=null,e===null)throw Ss(t);return Qu(e)?t.lanes=32:t.lanes=536870912,null}var b=l.children;return l=l.fallback,c?(Ns(),c=t.mode,b=ql({mode:"hidden",children:b},c),l=hi(l,c,i,null),b.return=t,l.return=t,b.sibling=l,t.child=b,l=t.child,l.memoizedState=fu(i),l.childLanes=hu(e,p,i),t.memoizedState=uu,sa(null,l)):(Ts(t),du(t,b))}var O=e.memoizedState;if(O!==null&&(b=O.dehydrated,b!==null)){if(u)t.flags&256?(Ts(t),t.flags&=-257,t=mu(e,t,i)):t.memoizedState!==null?(Ns(),t.child=e.child,t.flags|=128,t=null):(Ns(),b=l.fallback,c=t.mode,l=ql({mode:"visible",children:l.children},c),b=hi(b,c,i,null),b.flags|=2,l.return=t,b.return=t,l.sibling=b,t.child=l,xi(t,e.child,null,i),l=t.child,l.memoizedState=fu(i),l.childLanes=hu(e,p,i),t.memoizedState=uu,t=sa(null,l));else if(Ts(t),Qu(b)){if(p=b.nextSibling&&b.nextSibling.dataset,p)var U=p.dgst;p=U,l=Error(a(419)),l.stack="",l.digest=p,Vr({value:l,source:null,stack:null}),t=mu(e,t,i)}else if(mt||Ji(e,t,i,!1),p=(i&e.childLanes)!==0,mt||p){if(p=Ie,p!==null&&(l=xs(p,i),l!==0&&l!==O.retryLane))throw O.retryLane=l,fi(e,l),Ht(p,e,l),ou;Ju(b)||Vl(),t=mu(e,t,i)}else Ju(b)?(t.flags|=192,t.child=e.child,t=null):(e=O.treeContext,Ze=mn(b.nextSibling),wt=t,Re=!0,ws=null,hn=!1,e!==null&&sd(t,e),t=du(t,l.children),t.flags|=4096);return t}return c?(Ns(),b=l.fallback,c=t.mode,O=e.child,U=O.sibling,l=Qn(O,{mode:"hidden",children:l.children}),l.subtreeFlags=O.subtreeFlags&65011712,U!==null?b=Qn(U,b):(b=hi(b,c,i,null),b.flags|=2),b.return=t,l.return=t,l.sibling=b,t.child=l,sa(null,l),l=t.child,b=e.child.memoizedState,b===null?b=fu(i):(c=b.cachePool,c!==null?(O=ht._currentValue,c=c.parent!==O?{parent:O,pool:O}:c):c=cd(),b={baseLanes:b.baseLanes|i,cachePool:c}),l.memoizedState=b,l.childLanes=hu(e,p,i),t.memoizedState=uu,sa(e.child,l)):(Ts(t),i=e.child,e=i.sibling,i=Qn(i,{mode:"visible",children:l.children}),i.return=t,i.sibling=null,e!==null&&(p=t.deletions,p===null?(t.deletions=[e],t.flags|=16):p.push(e)),t.child=i,t.memoizedState=null,i)}function du(e,t){return t=ql({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function ql(e,t){return e=Vt(22,e,null,t),e.lanes=0,e}function mu(e,t,i){return xi(t,e.child,null,i),e=du(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function wm(e,t,i){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),Nc(e.return,t,i)}function pu(e,t,i,l,c,u){var p=e.memoizedState;p===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:i,tailMode:c,treeForkCount:u}:(p.isBackwards=t,p.rendering=null,p.renderingStartTime=0,p.last=l,p.tail=i,p.tailMode=c,p.treeForkCount=u)}function Sm(e,t,i){var l=t.pendingProps,c=l.revealOrder,u=l.tail;l=l.children;var p=ct.current,b=(p&2)!==0;if(b?(p=p&1|2,t.flags|=128):p&=1,Te(ct,p),Et(e,t,l,i),l=Re?Gr:0,!b&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&wm(e,i,t);else if(e.tag===19)wm(e,i,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(c){case"forwards":for(i=t.child,c=null;i!==null;)e=i.alternate,e!==null&&El(e)===null&&(c=i),i=i.sibling;i=c,i===null?(c=t.child,t.child=null):(c=i.sibling,i.sibling=null),pu(t,!1,c,i,u,l);break;case"backwards":case"unstable_legacy-backwards":for(i=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&El(e)===null){t.child=c;break}e=c.sibling,c.sibling=i,i=c,c=e}pu(t,!0,i,null,u,l);break;case"together":pu(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function es(e,t,i){if(e!==null&&(t.dependencies=e.dependencies),Ms|=t.lanes,(i&t.childLanes)===0)if(e!==null){if(Ji(e,t,i,!1),(i&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(a(153));if(t.child!==null){for(e=t.child,i=Qn(e,e.pendingProps),t.child=i,i.return=t;e.sibling!==null;)e=e.sibling,i=i.sibling=Qn(e,e.pendingProps),i.return=t;i.sibling=null}return t.child}function gu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&gl(e)))}function gb(e,t,i){switch(t.tag){case 3:jt(t,t.stateNode.containerInfo),Es(t,ht,e.memoizedState.cache),di();break;case 27:case 5:Tt(t);break;case 4:jt(t,t.stateNode.containerInfo);break;case 10:Es(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Pc(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(Ts(t),t.flags|=128,null):(i&t.child.childLanes)!==0?_m(e,t,i):(Ts(t),e=es(e,t,i),e!==null?e.sibling:null);Ts(t);break;case 19:var c=(e.flags&128)!==0;if(l=(i&t.childLanes)!==0,l||(Ji(e,t,i,!1),l=(i&t.childLanes)!==0),c){if(l)return Sm(e,t,i);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),Te(ct,ct.current),l)break;return null;case 22:return t.lanes=0,pm(e,t,i,t.pendingProps);case 24:Es(t,ht,e.memoizedState.cache)}return es(e,t,i)}function Em(e,t,i){if(e!==null)if(e.memoizedProps!==t.pendingProps)mt=!0;else{if(!gu(e,i)&&(t.flags&128)===0)return mt=!1,gb(e,t,i);mt=(e.flags&131072)!==0}else mt=!1,Re&&(t.flags&1048576)!==0&&nd(t,Gr,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=yi(t.elementType),t.type=e,typeof e=="function")_c(e)?(l=_i(e,l),t.tag=1,t=xm(null,t,e,l,i)):(t.tag=0,t=cu(null,t,e,l,i));else{if(e!=null){var c=e.$$typeof;if(c===ae){t.tag=11,t=hm(null,t,e,l,i);break e}else if(c===se){t.tag=14,t=dm(null,t,e,l,i);break e}}throw t=Ge(e)||e,Error(a(306,t,""))}}return t;case 0:return cu(e,t,t.type,t.pendingProps,i);case 1:return l=t.type,c=_i(l,t.pendingProps),xm(e,t,l,c,i);case 3:e:{if(jt(t,t.stateNode.containerInfo),e===null)throw Error(a(387));l=t.pendingProps;var u=t.memoizedState;c=u.element,qc(e,t),Zr(t,l,null,i);var p=t.memoizedState;if(l=p.cache,Es(t,ht,l),l!==u.cache&&Cc(t,[ht],i,!0),Kr(),l=p.element,u.isDehydrated)if(u={element:l,isDehydrated:!1,cache:p.cache},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){t=vm(e,t,l,i);break e}else if(l!==c){c=cn(Error(a(424)),t),Vr(c),t=vm(e,t,l,i);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Ze=mn(e.firstChild),wt=t,Re=!0,ws=null,hn=!0,i=pd(t,null,l,i),t.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(di(),l===c){t=es(e,t,i);break e}Et(e,t,l,i)}t=t.child}return t;case 26:return zl(e,t),e===null?(i=zp(t.type,null,t.pendingProps,null))?t.memoizedState=i:Re||(i=t.type,e=t.pendingProps,l=Zl(sn.current).createElement(i),l[Qe]=t,l[it]=e,At(l,i,e),N(l),t.stateNode=l):t.memoizedState=zp(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Tt(t),e===null&&Re&&(l=t.stateNode=Mp(t.type,t.pendingProps,sn.current),wt=t,hn=!0,c=Ze,Us(t.type)?(Iu=c,Ze=mn(l.firstChild)):Ze=c),Et(e,t,t.pendingProps.children,i),zl(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Re&&((c=l=Ze)&&(l=Fb(l,t.type,t.pendingProps,hn),l!==null?(t.stateNode=l,wt=t,Ze=mn(l.firstChild),hn=!1,c=!0):c=!1),c||Ss(t)),Tt(t),c=t.type,u=t.pendingProps,p=e!==null?e.memoizedProps:null,l=u.children,Gu(c,u)?l=null:p!==null&&Gu(c,p)&&(t.flags|=32),t.memoizedState!==null&&(c=Yc(e,t,lb,null,null,i),ba._currentValue=c),zl(e,t),Et(e,t,l,i),t.child;case 6:return e===null&&Re&&((e=i=Ze)&&(i=Jb(i,t.pendingProps,hn),i!==null?(t.stateNode=i,wt=t,Ze=null,e=!0):e=!1),e||Ss(t)),null;case 13:return _m(e,t,i);case 4:return jt(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=xi(t,null,l,i):Et(e,t,l,i),t.child;case 11:return hm(e,t,t.type,t.pendingProps,i);case 7:return Et(e,t,t.pendingProps,i),t.child;case 8:return Et(e,t,t.pendingProps.children,i),t.child;case 12:return Et(e,t,t.pendingProps.children,i),t.child;case 10:return l=t.pendingProps,Es(t,t.type,l.value),Et(e,t,l.children,i),t.child;case 9:return c=t.type._context,l=t.pendingProps.children,pi(t),c=St(c),l=l(c),t.flags|=1,Et(e,t,l,i),t.child;case 14:return dm(e,t,t.type,t.pendingProps,i);case 15:return mm(e,t,t.type,t.pendingProps,i);case 19:return Sm(e,t,i);case 31:return pb(e,t,i);case 22:return pm(e,t,i,t.pendingProps);case 24:return pi(t),l=St(ht),e===null?(c=Rc(),c===null&&(c=Ie,u=kc(),c.pooledCache=u,u.refCount++,u!==null&&(c.pooledCacheLanes|=i),c=u),t.memoizedState={parent:l,cache:c},zc(t),Es(t,ht,c)):((e.lanes&i)!==0&&(qc(e,t),Zr(t,null,null,i),Kr()),c=e.memoizedState,u=t.memoizedState,c.parent!==l?(c={parent:l,cache:l},t.memoizedState=c,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=c),Es(t,ht,l)):(l=u.cache,Es(t,ht,l),l!==c.cache&&Cc(t,[ht],i,!0))),Et(e,t,t.pendingProps.children,i),t.child;case 29:throw t.pendingProps}throw Error(a(156,t.tag))}function ts(e){e.flags|=4}function yu(e,t,i,l,c){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(c&335544128)===c)if(e.stateNode.complete)e.flags|=8192;else if(Km())e.flags|=8192;else throw bi=vl,Dc}else e.flags&=-16777217}function Am(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Hp(t))if(Km())e.flags|=8192;else throw bi=vl,Dc}function Ul(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Ri():536870912,e.lanes|=t,rr|=t)}function ia(e,t){if(!Re)switch(e.tailMode){case"hidden":t=e.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var l=null;i!==null;)i.alternate!==null&&(l=i),i=i.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function We(e){var t=e.alternate!==null&&e.alternate.child===e.child,i=0,l=0;if(t)for(var c=e.child;c!==null;)i|=c.lanes|c.childLanes,l|=c.subtreeFlags&65011712,l|=c.flags&65011712,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)i|=c.lanes|c.childLanes,l|=c.subtreeFlags,l|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=l,e.childLanes=i,t}function yb(e,t,i){var l=t.pendingProps;switch(Ac(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return We(t),null;case 1:return We(t),null;case 3:return i=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),Kn(ht),we(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Fi(t)?ts(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,jc())),We(t),null;case 26:var c=t.type,u=t.memoizedState;return e===null?(ts(t),u!==null?(We(t),Am(t,u)):(We(t),yu(t,c,null,l,i))):u?u!==e.memoizedState?(ts(t),We(t),Am(t,u)):(We(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&ts(t),We(t),yu(t,c,e,l,i)),null;case 27:if(ei(t),i=sn.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&ts(t);else{if(!l){if(t.stateNode===null)throw Error(a(166));return We(t),null}e=lt.current,Fi(t)?id(t):(e=Mp(c,l,i),t.stateNode=e,ts(t))}return We(t),null;case 5:if(ei(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&ts(t);else{if(!l){if(t.stateNode===null)throw Error(a(166));return We(t),null}if(u=lt.current,Fi(t))id(t);else{var p=Zl(sn.current);switch(u){case 1:u=p.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:u=p.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":u=p.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":u=p.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":u=p.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof l.is=="string"?p.createElement("select",{is:l.is}):p.createElement("select"),l.multiple?u.multiple=!0:l.size&&(u.size=l.size);break;default:u=typeof l.is=="string"?p.createElement(c,{is:l.is}):p.createElement(c)}}u[Qe]=t,u[it]=l;e:for(p=t.child;p!==null;){if(p.tag===5||p.tag===6)u.appendChild(p.stateNode);else if(p.tag!==4&&p.tag!==27&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===t)break e;for(;p.sibling===null;){if(p.return===null||p.return===t)break e;p=p.return}p.sibling.return=p.return,p=p.sibling}t.stateNode=u;e:switch(At(u,c,l),c){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&ts(t)}}return We(t),yu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,i),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&ts(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(a(166));if(e=sn.current,Fi(t)){if(e=t.stateNode,i=t.memoizedProps,l=null,c=wt,c!==null)switch(c.tag){case 27:case 5:l=c.memoizedProps}e[Qe]=t,e=!!(e.nodeValue===i||l!==null&&l.suppressHydrationWarning===!0||_p(e.nodeValue,i)),e||Ss(t,!0)}else e=Zl(e).createTextNode(l),e[Qe]=t,t.stateNode=e}return We(t),null;case 31:if(i=t.memoizedState,e===null||e.memoizedState!==null){if(l=Fi(t),i!==null){if(e===null){if(!l)throw Error(a(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(557));e[Qe]=t}else di(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),e=!1}else i=jc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),e=!0;if(!e)return t.flags&256?(Jt(t),t):(Jt(t),null);if((t.flags&128)!==0)throw Error(a(558))}return We(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=Fi(t),l!==null&&l.dehydrated!==null){if(e===null){if(!c)throw Error(a(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(a(317));c[Qe]=t}else di(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),c=!1}else c=jc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(Jt(t),t):(Jt(t),null)}return Jt(t),(t.flags&128)!==0?(t.lanes=i,t):(i=l!==null,e=e!==null&&e.memoizedState!==null,i&&(l=t.child,c=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(c=l.alternate.memoizedState.cachePool.pool),u=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(u=l.memoizedState.cachePool.pool),u!==c&&(l.flags|=2048)),i!==e&&i&&(t.child.flags|=8192),Ul(t,t.updateQueue),We(t),null);case 4:return we(),e===null&&Lu(t.stateNode.containerInfo),We(t),null;case 10:return Kn(t.type),We(t),null;case 19:if(_e(ct),l=t.memoizedState,l===null)return We(t),null;if(c=(t.flags&128)!==0,u=l.rendering,u===null)if(c)ia(l,!1);else{if(at!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=El(e),u!==null){for(t.flags|=128,ia(l,!1),e=u.updateQueue,t.updateQueue=e,Ul(t,e),t.subtreeFlags=0,e=i,i=t.child;i!==null;)Wh(i,e),i=i.sibling;return Te(ct,ct.current&1|2),Re&&In(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&et()>$l&&(t.flags|=128,c=!0,ia(l,!1),t.lanes=4194304)}else{if(!c)if(e=El(u),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,Ul(t,e),ia(l,!0),l.tail===null&&l.tailMode==="hidden"&&!u.alternate&&!Re)return We(t),null}else 2*et()-l.renderingStartTime>$l&&i!==536870912&&(t.flags|=128,c=!0,ia(l,!1),t.lanes=4194304);l.isBackwards?(u.sibling=t.child,t.child=u):(e=l.last,e!==null?e.sibling=u:t.child=u,l.last=u)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=et(),e.sibling=null,i=ct.current,Te(ct,c?i&1|2:i&1),Re&&In(t,l.treeForkCount),e):(We(t),null);case 22:case 23:return Jt(t),Hc(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(i&536870912)!==0&&(t.flags&128)===0&&(We(t),t.subtreeFlags&6&&(t.flags|=8192)):We(t),i=t.updateQueue,i!==null&&Ul(t,i.retryQueue),i=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==i&&(t.flags|=2048),e!==null&&_e(gi),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),Kn(ht),We(t),null;case 25:return null;case 30:return null}throw Error(a(156,t.tag))}function bb(e,t){switch(Ac(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Kn(ht),we(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ei(t),null;case 31:if(t.memoizedState!==null){if(Jt(t),t.alternate===null)throw Error(a(340));di()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Jt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));di()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return _e(ct),null;case 4:return we(),null;case 10:return Kn(t.type),null;case 22:case 23:return Jt(t),Hc(),e!==null&&_e(gi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Kn(ht),null;case 25:return null;default:return null}}function Om(e,t){switch(Ac(t),t.tag){case 3:Kn(ht),we();break;case 26:case 27:case 5:ei(t);break;case 4:we();break;case 31:t.memoizedState!==null&&Jt(t);break;case 13:Jt(t);break;case 19:_e(ct);break;case 10:Kn(t.type);break;case 22:case 23:Jt(t),Hc(),e!==null&&_e(gi);break;case 24:Kn(ht)}}function ra(e,t){try{var i=t.updateQueue,l=i!==null?i.lastEffect:null;if(l!==null){var c=l.next;i=c;do{if((i.tag&e)===e){l=void 0;var u=i.create,p=i.inst;l=u(),p.destroy=l}i=i.next}while(i!==c)}}catch(b){$e(t,t.return,b)}}function Cs(e,t,i){try{var l=t.updateQueue,c=l!==null?l.lastEffect:null;if(c!==null){var u=c.next;l=u;do{if((l.tag&e)===e){var p=l.inst,b=p.destroy;if(b!==void 0){p.destroy=void 0,c=t;var O=i,U=b;try{U()}catch(Y){$e(c,O,Y)}}}l=l.next}while(l!==u)}}catch(Y){$e(t,t.return,Y)}}function jm(e){var t=e.updateQueue;if(t!==null){var i=e.stateNode;try{yd(t,i)}catch(l){$e(e,e.return,l)}}}function Tm(e,t,i){i.props=_i(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(l){$e(e,t,l)}}function aa(e,t){try{var i=e.ref;if(i!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof i=="function"?e.refCleanup=i(l):i.current=l}}catch(c){$e(e,t,c)}}function Rn(e,t){var i=e.ref,l=e.refCleanup;if(i!==null)if(typeof l=="function")try{l()}catch(c){$e(e,t,c)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(c){$e(e,t,c)}else i.current=null}function Nm(e){var t=e.type,i=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":i.autoFocus&&l.focus();break e;case"img":i.src?l.src=i.src:i.srcSet&&(l.srcset=i.srcSet)}}catch(c){$e(e,e.return,c)}}function bu(e,t,i){try{var l=e.stateNode;Hb(l,e.type,i,t),l[it]=t}catch(c){$e(e,e.return,c)}}function Cm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Us(e.type)||e.tag===4}function xu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Cm(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&&Us(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 vu(e,t,i){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(e,t):(t=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,t.appendChild(e),i=i._reactRootContainer,i!=null||t.onclick!==null||(t.onclick=Fn));else if(l!==4&&(l===27&&Us(e.type)&&(i=e.stateNode,t=null),e=e.child,e!==null))for(vu(e,t,i),e=e.sibling;e!==null;)vu(e,t,i),e=e.sibling}function Bl(e,t,i){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?i.insertBefore(e,t):i.appendChild(e);else if(l!==4&&(l===27&&Us(e.type)&&(i=e.stateNode),e=e.child,e!==null))for(Bl(e,t,i),e=e.sibling;e!==null;)Bl(e,t,i),e=e.sibling}function km(e){var t=e.stateNode,i=e.memoizedProps;try{for(var l=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);At(t,l,i),t[Qe]=e,t[it]=i}catch(u){$e(e,e.return,u)}}var ns=!1,pt=!1,_u=!1,Mm=typeof WeakSet=="function"?WeakSet:Set,xt=null;function xb(e,t){if(e=e.containerInfo,$u=ro,e=Gh(e),mc(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var l=i.getSelection&&i.getSelection();if(l&&l.rangeCount!==0){i=l.anchorNode;var c=l.anchorOffset,u=l.focusNode;l=l.focusOffset;try{i.nodeType,u.nodeType}catch{i=null;break e}var p=0,b=-1,O=-1,U=0,Y=0,I=e,L=null;t:for(;;){for(var P;I!==i||c!==0&&I.nodeType!==3||(b=p+c),I!==u||l!==0&&I.nodeType!==3||(O=p+l),I.nodeType===3&&(p+=I.nodeValue.length),(P=I.firstChild)!==null;)L=I,I=P;for(;;){if(I===e)break t;if(L===i&&++U===c&&(b=p),L===u&&++Y===l&&(O=p),(P=I.nextSibling)!==null)break;I=L,L=I.parentNode}I=P}i=b===-1||O===-1?null:{start:b,end:O}}else i=null}i=i||{start:0,end:0}}else i=null;for(Yu={focusedElem:e,selectionRange:i},ro=!1,xt=t;xt!==null;)if(t=xt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,xt=e;else for(;xt!==null;){switch(t=xt,u=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(i=0;i<e.length;i++)c=e[i],c.ref.impl=c.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&u!==null){e=void 0,i=t,c=u.memoizedProps,u=u.memoizedState,l=i.stateNode;try{var he=_i(i.type,c);e=l.getSnapshotBeforeUpdate(he,u),l.__reactInternalSnapshotBeforeUpdate=e}catch(ye){$e(i,i.return,ye)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,i=e.nodeType,i===9)Fu(e);else if(i===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Fu(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(a(163))}if(e=t.sibling,e!==null){e.return=t.return,xt=e;break}xt=t.return}}function Rm(e,t,i){var l=i.flags;switch(i.tag){case 0:case 11:case 15:is(e,i),l&4&&ra(5,i);break;case 1:if(is(e,i),l&4)if(e=i.stateNode,t===null)try{e.componentDidMount()}catch(p){$e(i,i.return,p)}else{var c=_i(i.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(p){$e(i,i.return,p)}}l&64&&jm(i),l&512&&aa(i,i.return);break;case 3:if(is(e,i),l&64&&(e=i.updateQueue,e!==null)){if(t=null,i.child!==null)switch(i.child.tag){case 27:case 5:t=i.child.stateNode;break;case 1:t=i.child.stateNode}try{yd(e,t)}catch(p){$e(i,i.return,p)}}break;case 27:t===null&&l&4&&km(i);case 26:case 5:is(e,i),t===null&&l&4&&Nm(i),l&512&&aa(i,i.return);break;case 12:is(e,i);break;case 31:is(e,i),l&4&&qm(e,i);break;case 13:is(e,i),l&4&&Um(e,i),l&64&&(e=i.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(i=Tb.bind(null,i),Qb(e,i))));break;case 22:if(l=i.memoizedState!==null||ns,!l){t=t!==null&&t.memoizedState!==null||pt,c=ns;var u=pt;ns=l,(pt=t)&&!u?rs(e,i,(i.subtreeFlags&8772)!==0):is(e,i),ns=c,pt=u}break;case 30:break;default:is(e,i)}}function Dm(e){var t=e.alternate;t!==null&&(e.alternate=null,Dm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Di(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var tt=null,qt=!1;function ss(e,t,i){for(i=i.child;i!==null;)zm(e,t,i),i=i.sibling}function zm(e,t,i){if(ot&&typeof ot.onCommitFiberUnmount=="function")try{ot.onCommitFiberUnmount(ni,i)}catch{}switch(i.tag){case 26:pt||Rn(i,t),ss(e,t,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:pt||Rn(i,t);var l=tt,c=qt;Us(i.type)&&(tt=i.stateNode,qt=!1),ss(e,t,i),pa(i.stateNode),tt=l,qt=c;break;case 5:pt||Rn(i,t);case 6:if(l=tt,c=qt,tt=null,ss(e,t,i),tt=l,qt=c,tt!==null)if(qt)try{(tt.nodeType===9?tt.body:tt.nodeName==="HTML"?tt.ownerDocument.body:tt).removeChild(i.stateNode)}catch(u){$e(i,t,u)}else try{tt.removeChild(i.stateNode)}catch(u){$e(i,t,u)}break;case 18:tt!==null&&(qt?(e=tt,jp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,i.stateNode),dr(e)):jp(tt,i.stateNode));break;case 4:l=tt,c=qt,tt=i.stateNode.containerInfo,qt=!0,ss(e,t,i),tt=l,qt=c;break;case 0:case 11:case 14:case 15:Cs(2,i,t),pt||Cs(4,i,t),ss(e,t,i);break;case 1:pt||(Rn(i,t),l=i.stateNode,typeof l.componentWillUnmount=="function"&&Tm(i,t,l)),ss(e,t,i);break;case 21:ss(e,t,i);break;case 22:pt=(l=pt)||i.memoizedState!==null,ss(e,t,i),pt=l;break;default:ss(e,t,i)}}function qm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{dr(e)}catch(i){$e(t,t.return,i)}}}function Um(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{dr(e)}catch(i){$e(t,t.return,i)}}function vb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Mm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Mm),t;default:throw Error(a(435,e.tag))}}function Ll(e,t){var i=vb(e);t.forEach(function(l){if(!i.has(l)){i.add(l);var c=Nb.bind(null,e,l);l.then(c,c)}})}function Ut(e,t){var i=t.deletions;if(i!==null)for(var l=0;l<i.length;l++){var c=i[l],u=e,p=t,b=p;e:for(;b!==null;){switch(b.tag){case 27:if(Us(b.type)){tt=b.stateNode,qt=!1;break e}break;case 5:tt=b.stateNode,qt=!1;break e;case 3:case 4:tt=b.stateNode.containerInfo,qt=!0;break e}b=b.return}if(tt===null)throw Error(a(160));zm(u,p,c),tt=null,qt=!1,u=c.alternate,u!==null&&(u.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Bm(t,e),t=t.sibling}var Sn=null;function Bm(e,t){var i=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ut(t,e),Bt(e),l&4&&(Cs(3,e,e.return),ra(3,e),Cs(5,e,e.return));break;case 1:Ut(t,e),Bt(e),l&512&&(pt||i===null||Rn(i,i.return)),l&64&&ns&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(i=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=i===null?l:i.concat(l))));break;case 26:var c=Sn;if(Ut(t,e),Bt(e),l&512&&(pt||i===null||Rn(i,i.return)),l&4){var u=i!==null?i.memoizedState:null;if(l=e.memoizedState,i===null)if(l===null)if(e.stateNode===null){e:{l=e.type,i=e.memoizedProps,c=c.ownerDocument||c;t:switch(l){case"title":u=c.getElementsByTagName("title")[0],(!u||u[yt]||u[Qe]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=c.createElement(l),c.head.insertBefore(u,c.querySelector("head > title"))),At(u,l,i),u[Qe]=e,N(u),l=u;break e;case"link":var p=Bp("link","href",c).get(l+(i.href||""));if(p){for(var b=0;b<p.length;b++)if(u=p[b],u.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&u.getAttribute("rel")===(i.rel==null?null:i.rel)&&u.getAttribute("title")===(i.title==null?null:i.title)&&u.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){p.splice(b,1);break t}}u=c.createElement(l),At(u,l,i),c.head.appendChild(u);break;case"meta":if(p=Bp("meta","content",c).get(l+(i.content||""))){for(b=0;b<p.length;b++)if(u=p[b],u.getAttribute("content")===(i.content==null?null:""+i.content)&&u.getAttribute("name")===(i.name==null?null:i.name)&&u.getAttribute("property")===(i.property==null?null:i.property)&&u.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&u.getAttribute("charset")===(i.charSet==null?null:i.charSet)){p.splice(b,1);break t}}u=c.createElement(l),At(u,l,i),c.head.appendChild(u);break;default:throw Error(a(468,l))}u[Qe]=e,N(u),l=u}e.stateNode=l}else Lp(c,e.type,e.stateNode);else e.stateNode=Up(c,l,e.memoizedProps);else u!==l?(u===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):u.count--,l===null?Lp(c,e.type,e.stateNode):Up(c,l,e.memoizedProps)):l===null&&e.stateNode!==null&&bu(e,e.memoizedProps,i.memoizedProps)}break;case 27:Ut(t,e),Bt(e),l&512&&(pt||i===null||Rn(i,i.return)),i!==null&&l&4&&bu(e,e.memoizedProps,i.memoizedProps);break;case 5:if(Ut(t,e),Bt(e),l&512&&(pt||i===null||Rn(i,i.return)),e.flags&32){c=e.stateNode;try{qi(c,"")}catch(he){$e(e,e.return,he)}}l&4&&e.stateNode!=null&&(c=e.memoizedProps,bu(e,c,i!==null?i.memoizedProps:c)),l&1024&&(_u=!0);break;case 6:if(Ut(t,e),Bt(e),l&4){if(e.stateNode===null)throw Error(a(162));l=e.memoizedProps,i=e.stateNode;try{i.nodeValue=l}catch(he){$e(e,e.return,he)}}break;case 3:if(to=null,c=Sn,Sn=Wl(t.containerInfo),Ut(t,e),Sn=c,Bt(e),l&4&&i!==null&&i.memoizedState.isDehydrated)try{dr(t.containerInfo)}catch(he){$e(e,e.return,he)}_u&&(_u=!1,Lm(e));break;case 4:l=Sn,Sn=Wl(e.stateNode.containerInfo),Ut(t,e),Bt(e),Sn=l;break;case 12:Ut(t,e),Bt(e);break;case 31:Ut(t,e),Bt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Ll(e,l)));break;case 13:Ut(t,e),Bt(e),e.child.flags&8192&&e.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(Pl=et()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Ll(e,l)));break;case 22:c=e.memoizedState!==null;var O=i!==null&&i.memoizedState!==null,U=ns,Y=pt;if(ns=U||c,pt=Y||O,Ut(t,e),pt=Y,ns=U,Bt(e),l&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(i===null||O||ns||pt||wi(e)),i=null,t=e;;){if(t.tag===5||t.tag===26){if(i===null){O=i=t;try{if(u=O.stateNode,c)p=u.style,typeof p.setProperty=="function"?p.setProperty("display","none","important"):p.display="none";else{b=O.stateNode;var I=O.memoizedProps.style,L=I!=null&&I.hasOwnProperty("display")?I.display:null;b.style.display=L==null||typeof L=="boolean"?"":(""+L).trim()}}catch(he){$e(O,O.return,he)}}}else if(t.tag===6){if(i===null){O=t;try{O.stateNode.nodeValue=c?"":O.memoizedProps}catch(he){$e(O,O.return,he)}}}else if(t.tag===18){if(i===null){O=t;try{var P=O.stateNode;c?Tp(P,!0):Tp(O.stateNode,!1)}catch(he){$e(O,O.return,he)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;i===t&&(i=null),t=t.return}i===t&&(i=null),t.sibling.return=t.return,t=t.sibling}l&4&&(l=e.updateQueue,l!==null&&(i=l.retryQueue,i!==null&&(l.retryQueue=null,Ll(e,i))));break;case 19:Ut(t,e),Bt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Ll(e,l)));break;case 30:break;case 21:break;default:Ut(t,e),Bt(e)}}function Bt(e){var t=e.flags;if(t&2){try{for(var i,l=e.return;l!==null;){if(Cm(l)){i=l;break}l=l.return}if(i==null)throw Error(a(160));switch(i.tag){case 27:var c=i.stateNode,u=xu(e);Bl(e,u,c);break;case 5:var p=i.stateNode;i.flags&32&&(qi(p,""),i.flags&=-33);var b=xu(e);Bl(e,b,p);break;case 3:case 4:var O=i.stateNode.containerInfo,U=xu(e);vu(e,U,O);break;default:throw Error(a(161))}}catch(Y){$e(e,e.return,Y)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Lm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Lm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function is(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Rm(e,t.alternate,t),t=t.sibling}function wi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Cs(4,t,t.return),wi(t);break;case 1:Rn(t,t.return);var i=t.stateNode;typeof i.componentWillUnmount=="function"&&Tm(t,t.return,i),wi(t);break;case 27:pa(t.stateNode);case 26:case 5:Rn(t,t.return),wi(t);break;case 22:t.memoizedState===null&&wi(t);break;case 30:wi(t);break;default:wi(t)}e=e.sibling}}function rs(e,t,i){for(i=i&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,c=e,u=t,p=u.flags;switch(u.tag){case 0:case 11:case 15:rs(c,u,i),ra(4,u);break;case 1:if(rs(c,u,i),l=u,c=l.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(U){$e(l,l.return,U)}if(l=u,c=l.updateQueue,c!==null){var b=l.stateNode;try{var O=c.shared.hiddenCallbacks;if(O!==null)for(c.shared.hiddenCallbacks=null,c=0;c<O.length;c++)gd(O[c],b)}catch(U){$e(l,l.return,U)}}i&&p&64&&jm(u),aa(u,u.return);break;case 27:km(u);case 26:case 5:rs(c,u,i),i&&l===null&&p&4&&Nm(u),aa(u,u.return);break;case 12:rs(c,u,i);break;case 31:rs(c,u,i),i&&p&4&&qm(c,u);break;case 13:rs(c,u,i),i&&p&4&&Um(c,u);break;case 22:u.memoizedState===null&&rs(c,u,i),aa(u,u.return);break;case 30:break;default:rs(c,u,i)}t=t.sibling}}function wu(e,t){var i=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==i&&(e!=null&&e.refCount++,i!=null&&Fr(i))}function Su(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Fr(e))}function En(e,t,i,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Hm(e,t,i,l),t=t.sibling}function Hm(e,t,i,l){var c=t.flags;switch(t.tag){case 0:case 11:case 15:En(e,t,i,l),c&2048&&ra(9,t);break;case 1:En(e,t,i,l);break;case 3:En(e,t,i,l),c&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Fr(e)));break;case 12:if(c&2048){En(e,t,i,l),e=t.stateNode;try{var u=t.memoizedProps,p=u.id,b=u.onPostCommit;typeof b=="function"&&b(p,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(O){$e(t,t.return,O)}}else En(e,t,i,l);break;case 31:En(e,t,i,l);break;case 13:En(e,t,i,l);break;case 23:break;case 22:u=t.stateNode,p=t.alternate,t.memoizedState!==null?u._visibility&2?En(e,t,i,l):la(e,t):u._visibility&2?En(e,t,i,l):(u._visibility|=2,nr(e,t,i,l,(t.subtreeFlags&10256)!==0||!1)),c&2048&&wu(p,t);break;case 24:En(e,t,i,l),c&2048&&Su(t.alternate,t);break;default:En(e,t,i,l)}}function nr(e,t,i,l,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,p=t,b=i,O=l,U=p.flags;switch(p.tag){case 0:case 11:case 15:nr(u,p,b,O,c),ra(8,p);break;case 23:break;case 22:var Y=p.stateNode;p.memoizedState!==null?Y._visibility&2?nr(u,p,b,O,c):la(u,p):(Y._visibility|=2,nr(u,p,b,O,c)),c&&U&2048&&wu(p.alternate,p);break;case 24:nr(u,p,b,O,c),c&&U&2048&&Su(p.alternate,p);break;default:nr(u,p,b,O,c)}t=t.sibling}}function la(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var i=e,l=t,c=l.flags;switch(l.tag){case 22:la(i,l),c&2048&&wu(l.alternate,l);break;case 24:la(i,l),c&2048&&Su(l.alternate,l);break;default:la(i,l)}t=t.sibling}}var oa=8192;function sr(e,t,i){if(e.subtreeFlags&oa)for(e=e.child;e!==null;)Pm(e,t,i),e=e.sibling}function Pm(e,t,i){switch(e.tag){case 26:sr(e,t,i),e.flags&oa&&e.memoizedState!==null&&ax(i,Sn,e.memoizedState,e.memoizedProps);break;case 5:sr(e,t,i);break;case 3:case 4:var l=Sn;Sn=Wl(e.stateNode.containerInfo),sr(e,t,i),Sn=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=oa,oa=16777216,sr(e,t,i),oa=l):sr(e,t,i));break;default:sr(e,t,i)}}function $m(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function ca(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var i=0;i<t.length;i++){var l=t[i];xt=l,Gm(l,e)}$m(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Ym(e),e=e.sibling}function Ym(e){switch(e.tag){case 0:case 11:case 15:ca(e),e.flags&2048&&Cs(9,e,e.return);break;case 3:ca(e);break;case 12:ca(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Hl(e)):ca(e);break;default:ca(e)}}function Hl(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var i=0;i<t.length;i++){var l=t[i];xt=l,Gm(l,e)}$m(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Cs(8,t,t.return),Hl(t);break;case 22:i=t.stateNode,i._visibility&2&&(i._visibility&=-3,Hl(t));break;default:Hl(t)}e=e.sibling}}function Gm(e,t){for(;xt!==null;){var i=xt;switch(i.tag){case 0:case 11:case 15:Cs(8,i,t);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var l=i.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Fr(i.memoizedState.cache)}if(l=i.child,l!==null)l.return=i,xt=l;else e:for(i=e;xt!==null;){l=xt;var c=l.sibling,u=l.return;if(Dm(l),l===i){xt=null;break e}if(c!==null){c.return=u,xt=c;break e}xt=u}}}var _b={getCacheForType:function(e){var t=St(ht),i=t.data.get(e);return i===void 0&&(i=e(),t.data.set(e,i)),i},cacheSignal:function(){return St(ht).controller.signal}},wb=typeof WeakMap=="function"?WeakMap:Map,He=0,Ie=null,Ne=null,ke=0,Pe=0,Qt=null,ks=!1,ir=!1,Eu=!1,as=0,at=0,Ms=0,Si=0,Au=0,It=0,rr=0,ua=null,Lt=null,Ou=!1,Pl=0,Vm=0,$l=1/0,Yl=null,Rs=null,bt=0,Ds=null,ar=null,ls=0,ju=0,Tu=null,Fm=null,fa=0,Nu=null;function Xt(){return(He&2)!==0&&ke!==0?ke&-ke:$.T!==null?zu():Rr()}function Jm(){if(It===0)if((ke&536870912)===0||Re){var e=Yn;Yn<<=1,(Yn&3932160)===0&&(Yn=262144),It=e}else It=536870912;return e=Ft.current,e!==null&&(e.flags|=32),It}function Ht(e,t,i){(e===Ie&&(Pe===2||Pe===9)||e.cancelPendingCommit!==null)&&(lr(e,0),zs(e,ke,It,!1)),vn(e,i),((He&2)===0||e!==Ie)&&(e===Ie&&((He&2)===0&&(Si|=i),at===4&&zs(e,ke,It,!1)),Dn(e))}function Qm(e,t,i){if((He&6)!==0)throw Error(a(327));var l=!i&&(t&127)===0&&(t&e.expiredLanes)===0||ii(e,t),c=l?Ab(e,t):ku(e,t,!0),u=l;do{if(c===0){ir&&!l&&zs(e,t,0,!1);break}else{if(i=e.current.alternate,u&&!Sb(i)){c=ku(e,t,!1),u=!1;continue}if(c===2){if(u=t,e.errorRecoveryDisabledLanes&u)var p=0;else p=e.pendingLanes&-536870913,p=p!==0?p:p&536870912?536870912:0;if(p!==0){t=p;e:{var b=e;c=ua;var O=b.current.memoizedState.isDehydrated;if(O&&(lr(b,p).flags|=256),p=ku(b,p,!1),p!==2){if(Eu&&!O){b.errorRecoveryDisabledLanes|=u,Si|=u,c=4;break e}u=Lt,Lt=c,u!==null&&(Lt===null?Lt=u:Lt.push.apply(Lt,u))}c=p}if(u=!1,c!==2)continue}}if(c===1){lr(e,0),zs(e,t,0,!0);break}e:{switch(l=e,u=c,u){case 0:case 1:throw Error(a(345));case 4:if((t&4194048)!==t)break;case 6:zs(l,t,It,!ks);break e;case 2:Lt=null;break;case 3:case 5:break;default:throw Error(a(329))}if((t&62914560)===t&&(c=Pl+300-et(),10<c)){if(zs(l,t,It,!ks),si(l,0,!0)!==0)break e;ls=t,l.timeoutHandle=Ap(Im.bind(null,l,i,Lt,Yl,Ou,t,It,Si,rr,ks,u,"Throttled",-0,0),c);break e}Im(l,i,Lt,Yl,Ou,t,It,Si,rr,ks,u,null,-0,0)}}break}while(!0);Dn(e)}function Im(e,t,i,l,c,u,p,b,O,U,Y,I,L,P){if(e.timeoutHandle=-1,I=t.subtreeFlags,I&8192||(I&16785408)===16785408){I={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Fn},Pm(t,u,I);var he=(u&62914560)===u?Pl-et():(u&4194048)===u?Vm-et():0;if(he=lx(I,he),he!==null){ls=u,e.cancelPendingCommit=he(sp.bind(null,e,t,u,i,l,c,p,b,O,Y,I,null,L,P)),zs(e,u,p,!U);return}}sp(e,t,u,i,l,c,p,b,O)}function Sb(e){for(var t=e;;){var i=t.tag;if((i===0||i===11||i===15)&&t.flags&16384&&(i=t.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var l=0;l<i.length;l++){var c=i[l],u=c.getSnapshot;c=c.value;try{if(!Gt(u(),c))return!1}catch{return!1}}if(i=t.child,t.subtreeFlags&16384&&i!==null)i.return=t,t=i;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function zs(e,t,i,l){t&=~Au,t&=~Si,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var c=t;0<c;){var u=31-Nt(c),p=1<<u;l[u]=-1,c&=~p}i!==0&&bs(e,i,t)}function Gl(){return(He&6)===0?(ha(0),!1):!0}function Cu(){if(Ne!==null){if(Pe===0)var e=Ne.return;else e=Ne,Xn=mi=null,Fc(e),Ki=null,Qr=0,e=Ne;for(;e!==null;)Om(e.alternate,e),e=e.return;Ne=null}}function lr(e,t){var i=e.timeoutHandle;i!==-1&&(e.timeoutHandle=-1,Yb(i)),i=e.cancelPendingCommit,i!==null&&(e.cancelPendingCommit=null,i()),ls=0,Cu(),Ie=e,Ne=i=Qn(e.current,null),ke=t,Pe=0,Qt=null,ks=!1,ir=ii(e,t),Eu=!1,rr=It=Au=Si=Ms=at=0,Lt=ua=null,Ou=!1,(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var c=31-Nt(l),u=1<<c;t|=e[c],l&=~u}return as=t,fl(),i}function Xm(e,t){Se=null,$.H=na,t===Xi||t===xl?(t=hd(),Pe=3):t===Dc?(t=hd(),Pe=4):Pe=t===ou?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Qt=t,Ne===null&&(at=1,Rl(e,cn(t,e.current)))}function Km(){var e=Ft.current;return e===null?!0:(ke&4194048)===ke?dn===null:(ke&62914560)===ke||(ke&536870912)!==0?e===dn:!1}function Zm(){var e=$.H;return $.H=na,e===null?na:e}function Wm(){var e=$.A;return $.A=_b,e}function Vl(){at=4,ks||(ke&4194048)!==ke&&Ft.current!==null||(ir=!0),(Ms&134217727)===0&&(Si&134217727)===0||Ie===null||zs(Ie,ke,It,!1)}function ku(e,t,i){var l=He;He|=2;var c=Zm(),u=Wm();(Ie!==e||ke!==t)&&(Yl=null,lr(e,t)),t=!1;var p=at;e:do try{if(Pe!==0&&Ne!==null){var b=Ne,O=Qt;switch(Pe){case 8:Cu(),p=6;break e;case 3:case 2:case 9:case 6:Ft.current===null&&(t=!0);var U=Pe;if(Pe=0,Qt=null,or(e,b,O,U),i&&ir){p=0;break e}break;default:U=Pe,Pe=0,Qt=null,or(e,b,O,U)}}Eb(),p=at;break}catch(Y){Xm(e,Y)}while(!0);return t&&e.shellSuspendCounter++,Xn=mi=null,He=l,$.H=c,$.A=u,Ne===null&&(Ie=null,ke=0,fl()),p}function Eb(){for(;Ne!==null;)ep(Ne)}function Ab(e,t){var i=He;He|=2;var l=Zm(),c=Wm();Ie!==e||ke!==t?(Yl=null,$l=et()+500,lr(e,t)):ir=ii(e,t);e:do try{if(Pe!==0&&Ne!==null){t=Ne;var u=Qt;t:switch(Pe){case 1:Pe=0,Qt=null,or(e,t,u,1);break;case 2:case 9:if(ud(u)){Pe=0,Qt=null,tp(t);break}t=function(){Pe!==2&&Pe!==9||Ie!==e||(Pe=7),Dn(e)},u.then(t,t);break e;case 3:Pe=7;break e;case 4:Pe=5;break e;case 7:ud(u)?(Pe=0,Qt=null,tp(t)):(Pe=0,Qt=null,or(e,t,u,7));break;case 5:var p=null;switch(Ne.tag){case 26:p=Ne.memoizedState;case 5:case 27:var b=Ne;if(p?Hp(p):b.stateNode.complete){Pe=0,Qt=null;var O=b.sibling;if(O!==null)Ne=O;else{var U=b.return;U!==null?(Ne=U,Fl(U)):Ne=null}break t}}Pe=0,Qt=null,or(e,t,u,5);break;case 6:Pe=0,Qt=null,or(e,t,u,6);break;case 8:Cu(),at=6;break e;default:throw Error(a(462))}}Ob();break}catch(Y){Xm(e,Y)}while(!0);return Xn=mi=null,$.H=l,$.A=c,He=i,Ne!==null?0:(Ie=null,ke=0,fl(),at)}function Ob(){for(;Ne!==null&&!Qa();)ep(Ne)}function ep(e){var t=Em(e.alternate,e,as);e.memoizedProps=e.pendingProps,t===null?Fl(e):Ne=t}function tp(e){var t=e,i=t.alternate;switch(t.tag){case 15:case 0:t=bm(i,t,t.pendingProps,t.type,void 0,ke);break;case 11:t=bm(i,t,t.pendingProps,t.type.render,t.ref,ke);break;case 5:Fc(t);default:Om(i,t),t=Ne=Wh(t,as),t=Em(i,t,as)}e.memoizedProps=e.pendingProps,t===null?Fl(e):Ne=t}function or(e,t,i,l){Xn=mi=null,Fc(t),Ki=null,Qr=0;var c=t.return;try{if(mb(e,c,t,i,ke)){at=1,Rl(e,cn(i,e.current)),Ne=null;return}}catch(u){if(c!==null)throw Ne=c,u;at=1,Rl(e,cn(i,e.current)),Ne=null;return}t.flags&32768?(Re||l===1?e=!0:ir||(ke&536870912)!==0?e=!1:(ks=e=!0,(l===2||l===9||l===3||l===6)&&(l=Ft.current,l!==null&&l.tag===13&&(l.flags|=16384))),np(t,e)):Fl(t)}function Fl(e){var t=e;do{if((t.flags&32768)!==0){np(t,ks);return}e=t.return;var i=yb(t.alternate,t,as);if(i!==null){Ne=i;return}if(t=t.sibling,t!==null){Ne=t;return}Ne=t=e}while(t!==null);at===0&&(at=5)}function np(e,t){do{var i=bb(e.alternate,e);if(i!==null){i.flags&=32767,Ne=i;return}if(i=e.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!t&&(e=e.sibling,e!==null)){Ne=e;return}Ne=e=i}while(e!==null);at=6,Ne=null}function sp(e,t,i,l,c,u,p,b,O){e.cancelPendingCommit=null;do Jl();while(bt!==0);if((He&6)!==0)throw Error(a(327));if(t!==null){if(t===e.current)throw Error(a(177));if(u=t.lanes|t.childLanes,u|=xc,ys(e,i,u,p,b,O),e===Ie&&(Ne=Ie=null,ke=0),ar=t,Ds=e,ls=i,ju=u,Tu=c,Fm=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Cb(ki,function(){return op(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=$.T,$.T=null,c=te.p,te.p=2,p=He,He|=4;try{xb(e,t,i)}finally{He=p,te.p=c,$.T=l}}bt=1,ip(),rp(),ap()}}function ip(){if(bt===1){bt=0;var e=Ds,t=ar,i=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||i){i=$.T,$.T=null;var l=te.p;te.p=2;var c=He;He|=4;try{Bm(t,e);var u=Yu,p=Gh(e.containerInfo),b=u.focusedElem,O=u.selectionRange;if(p!==b&&b&&b.ownerDocument&&Yh(b.ownerDocument.documentElement,b)){if(O!==null&&mc(b)){var U=O.start,Y=O.end;if(Y===void 0&&(Y=U),"selectionStart"in b)b.selectionStart=U,b.selectionEnd=Math.min(Y,b.value.length);else{var I=b.ownerDocument||document,L=I&&I.defaultView||window;if(L.getSelection){var P=L.getSelection(),he=b.textContent.length,ye=Math.min(O.start,he),Je=O.end===void 0?ye:Math.min(O.end,he);!P.extend&&ye>Je&&(p=Je,Je=ye,ye=p);var R=$h(b,ye),C=$h(b,Je);if(R&&C&&(P.rangeCount!==1||P.anchorNode!==R.node||P.anchorOffset!==R.offset||P.focusNode!==C.node||P.focusOffset!==C.offset)){var q=I.createRange();q.setStart(R.node,R.offset),P.removeAllRanges(),ye>Je?(P.addRange(q),P.extend(C.node,C.offset)):(q.setEnd(C.node,C.offset),P.addRange(q))}}}}for(I=[],P=b;P=P.parentNode;)P.nodeType===1&&I.push({element:P,left:P.scrollLeft,top:P.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<I.length;b++){var G=I[b];G.element.scrollLeft=G.left,G.element.scrollTop=G.top}}ro=!!$u,Yu=$u=null}finally{He=c,te.p=l,$.T=i}}e.current=t,bt=2}}function rp(){if(bt===2){bt=0;var e=Ds,t=ar,i=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||i){i=$.T,$.T=null;var l=te.p;te.p=2;var c=He;He|=4;try{Rm(e,t.alternate,t)}finally{He=c,te.p=l,$.T=i}}bt=3}}function ap(){if(bt===4||bt===3){bt=0,Ci();var e=Ds,t=ar,i=ls,l=Fm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?bt=5:(bt=0,ar=Ds=null,lp(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(Rs=null),ai(i),t=t.stateNode,ot&&typeof ot.onCommitFiberRoot=="function")try{ot.onCommitFiberRoot(ni,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=$.T,c=te.p,te.p=2,$.T=null;try{for(var u=e.onRecoverableError,p=0;p<l.length;p++){var b=l[p];u(b.value,{componentStack:b.stack})}}finally{$.T=t,te.p=c}}(ls&3)!==0&&Jl(),Dn(e),c=e.pendingLanes,(i&261930)!==0&&(c&42)!==0?e===Nu?fa++:(fa=0,Nu=e):fa=0,ha(0)}}function lp(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Fr(t)))}function Jl(){return ip(),rp(),ap(),op()}function op(){if(bt!==5)return!1;var e=Ds,t=ju;ju=0;var i=ai(ls),l=$.T,c=te.p;try{te.p=32>i?32:i,$.T=null,i=Tu,Tu=null;var u=Ds,p=ls;if(bt=0,ar=Ds=null,ls=0,(He&6)!==0)throw Error(a(331));var b=He;if(He|=4,Ym(u.current),Hm(u,u.current,p,i),He=b,ha(0,!1),ot&&typeof ot.onPostCommitFiberRoot=="function")try{ot.onPostCommitFiberRoot(ni,u)}catch{}return!0}finally{te.p=c,$.T=l,lp(e,t)}}function cp(e,t,i){t=cn(i,t),t=lu(e.stateNode,t,2),e=js(e,t,2),e!==null&&(vn(e,2),Dn(e))}function $e(e,t,i){if(e.tag===3)cp(e,e,i);else for(;t!==null;){if(t.tag===3){cp(t,e,i);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Rs===null||!Rs.has(l))){e=cn(i,e),i=um(2),l=js(t,i,2),l!==null&&(fm(i,l,t,e),vn(l,2),Dn(l));break}}t=t.return}}function Mu(e,t,i){var l=e.pingCache;if(l===null){l=e.pingCache=new wb;var c=new Set;l.set(t,c)}else c=l.get(t),c===void 0&&(c=new Set,l.set(t,c));c.has(i)||(Eu=!0,c.add(i),e=jb.bind(null,e,t,i),t.then(e,e))}function jb(e,t,i){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,Ie===e&&(ke&i)===i&&(at===4||at===3&&(ke&62914560)===ke&&300>et()-Pl?(He&2)===0&&lr(e,0):Au|=i,rr===ke&&(rr=0)),Dn(e)}function up(e,t){t===0&&(t=Ri()),e=fi(e,t),e!==null&&(vn(e,t),Dn(e))}function Tb(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),up(e,i)}function Nb(e,t){var i=0;switch(e.tag){case 31:case 13:var l=e.stateNode,c=e.memoizedState;c!==null&&(i=c.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(a(314))}l!==null&&l.delete(t),up(e,i)}function Cb(e,t){return Nr(e,t)}var Ql=null,cr=null,Ru=!1,Il=!1,Du=!1,qs=0;function Dn(e){e!==cr&&e.next===null&&(cr===null?Ql=cr=e:cr=cr.next=e),Il=!0,Ru||(Ru=!0,Mb())}function ha(e,t){if(!Du&&Il){Du=!0;do for(var i=!1,l=Ql;l!==null;){if(e!==0){var c=l.pendingLanes;if(c===0)var u=0;else{var p=l.suspendedLanes,b=l.pingedLanes;u=(1<<31-Nt(42|e)+1)-1,u&=c&~(p&~b),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(i=!0,mp(l,u))}else u=ke,u=si(l,l===Ie?u:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(u&3)===0||ii(l,u)||(i=!0,mp(l,u));l=l.next}while(i);Du=!1}}function kb(){fp()}function fp(){Il=Ru=!1;var e=0;qs!==0&&$b()&&(e=qs);for(var t=et(),i=null,l=Ql;l!==null;){var c=l.next,u=hp(l,t);u===0?(l.next=null,i===null?Ql=c:i.next=c,c===null&&(cr=i)):(i=l,(e!==0||(u&3)!==0)&&(Il=!0)),l=c}bt!==0&&bt!==5||ha(e),qs!==0&&(qs=0)}function hp(e,t){for(var i=e.suspendedLanes,l=e.pingedLanes,c=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var p=31-Nt(u),b=1<<p,O=c[p];O===-1?((b&i)===0||(b&l)!==0)&&(c[p]=Mr(b,t)):O<=t&&(e.expiredLanes|=b),u&=~b}if(t=Ie,i=ke,i=si(e,e===t?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,i===0||e===t&&(Pe===2||Pe===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&$n(l),e.callbackNode=null,e.callbackPriority=0;if((i&3)===0||ii(e,i)){if(t=i&-i,t===e.callbackPriority)return t;switch(l!==null&&$n(l),ai(i)){case 2:case 8:i=Xa;break;case 32:i=ki;break;case 268435456:i=Ka;break;default:i=ki}return l=dp.bind(null,e),i=Nr(i,l),e.callbackPriority=t,e.callbackNode=i,t}return l!==null&&l!==null&&$n(l),e.callbackPriority=2,e.callbackNode=null,2}function dp(e,t){if(bt!==0&&bt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var i=e.callbackNode;if(Jl()&&e.callbackNode!==i)return null;var l=ke;return l=si(e,e===Ie?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Qm(e,l,t),hp(e,et()),e.callbackNode!=null&&e.callbackNode===i?dp.bind(null,e):null)}function mp(e,t){if(Jl())return null;Qm(e,t,!0)}function Mb(){Gb(function(){(He&6)!==0?Nr(Ia,kb):fp()})}function zu(){if(qs===0){var e=Qi;e===0&&(e=ms,ms<<=1,(ms&261888)===0&&(ms=256)),qs=e}return qs}function pp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:sl(""+e)}function gp(e,t){var i=t.ownerDocument.createElement("input");return i.name=t.name,i.value=t.value,e.id&&i.setAttribute("form",e.id),t.parentNode.insertBefore(i,t),e=new FormData(e),i.parentNode.removeChild(i),e}function Rb(e,t,i,l,c){if(t==="submit"&&i&&i.stateNode===c){var u=pp((c[it]||null).action),p=l.submitter;p&&(t=(t=p[it]||null)?pp(t.formAction):p.getAttribute("formAction"),t!==null&&(u=t,p=null));var b=new ll("action","action",null,l,c);e.push({event:b,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(qs!==0){var O=p?gp(c,p):new FormData(c);tu(i,{pending:!0,data:O,method:c.method,action:u},null,O)}}else typeof u=="function"&&(b.preventDefault(),O=p?gp(c,p):new FormData(c),tu(i,{pending:!0,data:O,method:c.method,action:u},u,O))},currentTarget:c}]})}}for(var qu=0;qu<bc.length;qu++){var Uu=bc[qu],Db=Uu.toLowerCase(),zb=Uu[0].toUpperCase()+Uu.slice(1);wn(Db,"on"+zb)}wn(Jh,"onAnimationEnd"),wn(Qh,"onAnimationIteration"),wn(Ih,"onAnimationStart"),wn("dblclick","onDoubleClick"),wn("focusin","onFocus"),wn("focusout","onBlur"),wn(Ky,"onTransitionRun"),wn(Zy,"onTransitionStart"),wn(Wy,"onTransitionCancel"),wn(Xh,"onTransitionEnd"),H("onMouseEnter",["mouseout","mouseover"]),H("onMouseLeave",["mouseout","mouseover"]),H("onPointerEnter",["pointerout","pointerover"]),H("onPointerLeave",["pointerout","pointerover"]),K("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),K("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),K("onBeforeInput",["compositionend","keypress","textInput","paste"]),K("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),K("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),K("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var da="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(" "),qb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(da));function yp(e,t){t=(t&4)!==0;for(var i=0;i<e.length;i++){var l=e[i],c=l.event;l=l.listeners;e:{var u=void 0;if(t)for(var p=l.length-1;0<=p;p--){var b=l[p],O=b.instance,U=b.currentTarget;if(b=b.listener,O!==u&&c.isPropagationStopped())break e;u=b,c.currentTarget=U;try{u(c)}catch(Y){ul(Y)}c.currentTarget=null,u=O}else for(p=0;p<l.length;p++){if(b=l[p],O=b.instance,U=b.currentTarget,b=b.listener,O!==u&&c.isPropagationStopped())break e;u=b,c.currentTarget=U;try{u(c)}catch(Y){ul(Y)}c.currentTarget=null,u=O}}}}function Ce(e,t){var i=t[li];i===void 0&&(i=t[li]=new Set);var l=e+"__bubble";i.has(l)||(bp(t,e,2,!1),i.add(l))}function Bu(e,t,i){var l=0;t&&(l|=4),bp(i,e,l,t)}var Xl="_reactListening"+Math.random().toString(36).slice(2);function Lu(e){if(!e[Xl]){e[Xl]=!0,D.forEach(function(i){i!=="selectionchange"&&(qb.has(i)||Bu(i,!1,e),Bu(i,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Xl]||(t[Xl]=!0,Bu("selectionchange",!1,t))}}function bp(e,t,i,l){switch(Jp(t)){case 2:var c=ux;break;case 8:c=fx;break;default:c=ef}i=c.bind(null,t,i,e),c=void 0,!rc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),l?c!==void 0?e.addEventListener(t,i,{capture:!0,passive:c}):e.addEventListener(t,i,!0):c!==void 0?e.addEventListener(t,i,{passive:c}):e.addEventListener(t,i,!1)}function Hu(e,t,i,l,c){var u=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var p=l.tag;if(p===3||p===4){var b=l.stateNode.containerInfo;if(b===c)break;if(p===4)for(p=l.return;p!==null;){var O=p.tag;if((O===3||O===4)&&p.stateNode.containerInfo===c)return;p=p.return}for(;b!==null;){if(p=x(b),p===null)return;if(O=p.tag,O===5||O===6||O===26||O===27){l=u=p;continue e}b=b.parentNode}}l=l.return}Sh(function(){var U=u,Y=sc(i),I=[];e:{var L=Kh.get(e);if(L!==void 0){var P=ll,he=e;switch(e){case"keypress":if(rl(i)===0)break e;case"keydown":case"keyup":P=Ny;break;case"focusin":he="focus",P=cc;break;case"focusout":he="blur",P=cc;break;case"beforeblur":case"afterblur":P=cc;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":P=Oh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":P=yy;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":P=My;break;case Jh:case Qh:case Ih:P=vy;break;case Xh:P=Dy;break;case"scroll":case"scrollend":P=py;break;case"wheel":P=qy;break;case"copy":case"cut":case"paste":P=wy;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":P=Th;break;case"toggle":case"beforetoggle":P=By}var ye=(t&4)!==0,Je=!ye&&(e==="scroll"||e==="scrollend"),R=ye?L!==null?L+"Capture":null:L;ye=[];for(var C=U,q;C!==null;){var G=C;if(q=G.stateNode,G=G.tag,G!==5&&G!==26&&G!==27||q===null||R===null||(G=zr(C,R),G!=null&&ye.push(ma(C,G,q))),Je)break;C=C.return}0<ye.length&&(L=new P(L,he,null,i,Y),I.push({event:L,listeners:ye}))}}if((t&7)===0){e:{if(L=e==="mouseover"||e==="pointerover",P=e==="mouseout"||e==="pointerout",L&&i!==nc&&(he=i.relatedTarget||i.fromElement)&&(x(he)||he[Yt]))break e;if((P||L)&&(L=Y.window===Y?Y:(L=Y.ownerDocument)?L.defaultView||L.parentWindow:window,P?(he=i.relatedTarget||i.toElement,P=U,he=he?x(he):null,he!==null&&(Je=f(he),ye=he.tag,he!==Je||ye!==5&&ye!==27&&ye!==6)&&(he=null)):(P=null,he=U),P!==he)){if(ye=Oh,G="onMouseLeave",R="onMouseEnter",C="mouse",(e==="pointerout"||e==="pointerover")&&(ye=Th,G="onPointerLeave",R="onPointerEnter",C="pointer"),Je=P==null?L:_(P),q=he==null?L:_(he),L=new ye(G,C+"leave",P,i,Y),L.target=Je,L.relatedTarget=q,G=null,x(Y)===U&&(ye=new ye(R,C+"enter",he,i,Y),ye.target=q,ye.relatedTarget=Je,G=ye),Je=G,P&&he)t:{for(ye=Ub,R=P,C=he,q=0,G=R;G;G=ye(G))q++;G=0;for(var ge=C;ge;ge=ye(ge))G++;for(;0<q-G;)R=ye(R),q--;for(;0<G-q;)C=ye(C),G--;for(;q--;){if(R===C||C!==null&&R===C.alternate){ye=R;break t}R=ye(R),C=ye(C)}ye=null}else ye=null;P!==null&&xp(I,L,P,ye,!1),he!==null&&Je!==null&&xp(I,Je,he,ye,!0)}}e:{if(L=U?_(U):window,P=L.nodeName&&L.nodeName.toLowerCase(),P==="select"||P==="input"&&L.type==="file")var Ue=qh;else if(Dh(L))if(Uh)Ue=Qy;else{Ue=Fy;var me=Vy}else P=L.nodeName,!P||P.toLowerCase()!=="input"||L.type!=="checkbox"&&L.type!=="radio"?U&&tc(U.elementType)&&(Ue=qh):Ue=Jy;if(Ue&&(Ue=Ue(e,U))){zh(I,Ue,i,Y);break e}me&&me(e,L,U),e==="focusout"&&U&&L.type==="number"&&U.memoizedProps.value!=null&&ec(L,"number",L.value)}switch(me=U?_(U):window,e){case"focusin":(Dh(me)||me.contentEditable==="true")&&(Hi=me,pc=U,Yr=null);break;case"focusout":Yr=pc=Hi=null;break;case"mousedown":gc=!0;break;case"contextmenu":case"mouseup":case"dragend":gc=!1,Vh(I,i,Y);break;case"selectionchange":if(Xy)break;case"keydown":case"keyup":Vh(I,i,Y)}var Ee;if(fc)e:{switch(e){case"compositionstart":var Me="onCompositionStart";break e;case"compositionend":Me="onCompositionEnd";break e;case"compositionupdate":Me="onCompositionUpdate";break e}Me=void 0}else Li?Mh(e,i)&&(Me="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(Me="onCompositionStart");Me&&(Nh&&i.locale!=="ko"&&(Li||Me!=="onCompositionStart"?Me==="onCompositionEnd"&&Li&&(Ee=Eh()):(vs=Y,ac="value"in vs?vs.value:vs.textContent,Li=!0)),me=Kl(U,Me),0<me.length&&(Me=new jh(Me,e,null,i,Y),I.push({event:Me,listeners:me}),Ee?Me.data=Ee:(Ee=Rh(i),Ee!==null&&(Me.data=Ee)))),(Ee=Hy?Py(e,i):$y(e,i))&&(Me=Kl(U,"onBeforeInput"),0<Me.length&&(me=new jh("onBeforeInput","beforeinput",null,i,Y),I.push({event:me,listeners:Me}),me.data=Ee)),Rb(I,e,U,i,Y)}yp(I,t)})}function ma(e,t,i){return{instance:e,listener:t,currentTarget:i}}function Kl(e,t){for(var i=t+"Capture",l=[];e!==null;){var c=e,u=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||u===null||(c=zr(e,i),c!=null&&l.unshift(ma(e,c,u)),c=zr(e,t),c!=null&&l.push(ma(e,c,u))),e.tag===3)return l;e=e.return}return[]}function Ub(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function xp(e,t,i,l,c){for(var u=t._reactName,p=[];i!==null&&i!==l;){var b=i,O=b.alternate,U=b.stateNode;if(b=b.tag,O!==null&&O===l)break;b!==5&&b!==26&&b!==27||U===null||(O=U,c?(U=zr(i,u),U!=null&&p.unshift(ma(i,U,O))):c||(U=zr(i,u),U!=null&&p.push(ma(i,U,O)))),i=i.return}p.length!==0&&e.push({event:t,listeners:p})}var Bb=/\r\n?/g,Lb=/\u0000|\uFFFD/g;function vp(e){return(typeof e=="string"?e:""+e).replace(Bb,`
|
|
26
|
-
`).replace(Lb,"")}function _p(e,t){return t=vp(t),vp(e)===t}function Fe(e,t,i,l,c,u){switch(i){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||qi(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&qi(e,""+l);break;case"className":_n(e,"class",l);break;case"tabIndex":_n(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":_n(e,i,l);break;case"style":_h(e,l,u);break;case"data":if(t!=="object"){_n(e,"data",l);break}case"src":case"href":if(l===""&&(t!=="a"||i!=="href")){e.removeAttribute(i);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(i);break}l=sl(""+l),e.setAttribute(i,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(i,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof u=="function"&&(i==="formAction"?(t!=="input"&&Fe(e,t,"name",c.name,c,null),Fe(e,t,"formEncType",c.formEncType,c,null),Fe(e,t,"formMethod",c.formMethod,c,null),Fe(e,t,"formTarget",c.formTarget,c,null)):(Fe(e,t,"encType",c.encType,c,null),Fe(e,t,"method",c.method,c,null),Fe(e,t,"target",c.target,c,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(i);break}l=sl(""+l),e.setAttribute(i,l);break;case"onClick":l!=null&&(e.onclick=Fn);break;case"onScroll":l!=null&&Ce("scroll",e);break;case"onScrollEnd":l!=null&&Ce("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(i=l.__html,i!=null){if(c.children!=null)throw Error(a(60));e.innerHTML=i}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}i=sl(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,""+l):e.removeAttribute(i);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,""):e.removeAttribute(i);break;case"capture":case"download":l===!0?e.setAttribute(i,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,l):e.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(i,l):e.removeAttribute(i);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(i):e.setAttribute(i,l);break;case"popover":Ce("beforetoggle",e),Ce("toggle",e),Ct(e,"popover",l);break;case"xlinkActuate":Vn(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Vn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Vn(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Vn(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Vn(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Vn(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Vn(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Vn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Vn(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Ct(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=dy.get(i)||i,Ct(e,i,l))}}function Pu(e,t,i,l,c,u){switch(i){case"style":_h(e,l,u);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(i=l.__html,i!=null){if(c.children!=null)throw Error(a(60));e.innerHTML=i}}break;case"children":typeof l=="string"?qi(e,l):(typeof l=="number"||typeof l=="bigint")&&qi(e,""+l);break;case"onScroll":l!=null&&Ce("scroll",e);break;case"onScrollEnd":l!=null&&Ce("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Fn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Q.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(c=i.endsWith("Capture"),t=i.slice(2,c?i.length-7:void 0),u=e[it]||null,u=u!=null?u[i]:null,typeof u=="function"&&e.removeEventListener(t,u,c),typeof l=="function")){typeof u!="function"&&u!==null&&(i in e?e[i]=null:e.hasAttribute(i)&&e.removeAttribute(i)),e.addEventListener(t,l,c);break e}i in e?e[i]=l:l===!0?e.setAttribute(i,""):Ct(e,i,l)}}}function At(e,t,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ce("error",e),Ce("load",e);var l=!1,c=!1,u;for(u in i)if(i.hasOwnProperty(u)){var p=i[u];if(p!=null)switch(u){case"src":l=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,t));default:Fe(e,t,u,p,i,null)}}c&&Fe(e,t,"srcSet",i.srcSet,i,null),l&&Fe(e,t,"src",i.src,i,null);return;case"input":Ce("invalid",e);var b=u=p=c=null,O=null,U=null;for(l in i)if(i.hasOwnProperty(l)){var Y=i[l];if(Y!=null)switch(l){case"name":c=Y;break;case"type":p=Y;break;case"checked":O=Y;break;case"defaultChecked":U=Y;break;case"value":u=Y;break;case"defaultValue":b=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(a(137,t));break;default:Fe(e,t,l,Y,i,null)}}yh(e,u,b,O,U,p,c,!1);return;case"select":Ce("invalid",e),l=p=u=null;for(c in i)if(i.hasOwnProperty(c)&&(b=i[c],b!=null))switch(c){case"value":u=b;break;case"defaultValue":p=b;break;case"multiple":l=b;default:Fe(e,t,c,b,i,null)}t=u,i=p,e.multiple=!!l,t!=null?zi(e,!!l,t,!1):i!=null&&zi(e,!!l,i,!0);return;case"textarea":Ce("invalid",e),u=c=l=null;for(p in i)if(i.hasOwnProperty(p)&&(b=i[p],b!=null))switch(p){case"value":l=b;break;case"defaultValue":c=b;break;case"children":u=b;break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(a(91));break;default:Fe(e,t,p,b,i,null)}xh(e,l,c,u);return;case"option":for(O in i)if(i.hasOwnProperty(O)&&(l=i[O],l!=null))switch(O){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:Fe(e,t,O,l,i,null)}return;case"dialog":Ce("beforetoggle",e),Ce("toggle",e),Ce("cancel",e),Ce("close",e);break;case"iframe":case"object":Ce("load",e);break;case"video":case"audio":for(l=0;l<da.length;l++)Ce(da[l],e);break;case"image":Ce("error",e),Ce("load",e);break;case"details":Ce("toggle",e);break;case"embed":case"source":case"link":Ce("error",e),Ce("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(U in i)if(i.hasOwnProperty(U)&&(l=i[U],l!=null))switch(U){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,t));default:Fe(e,t,U,l,i,null)}return;default:if(tc(t)){for(Y in i)i.hasOwnProperty(Y)&&(l=i[Y],l!==void 0&&Pu(e,t,Y,l,i,void 0));return}}for(b in i)i.hasOwnProperty(b)&&(l=i[b],l!=null&&Fe(e,t,b,l,i,null))}function Hb(e,t,i,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,u=null,p=null,b=null,O=null,U=null,Y=null;for(P in i){var I=i[P];if(i.hasOwnProperty(P)&&I!=null)switch(P){case"checked":break;case"value":break;case"defaultValue":O=I;default:l.hasOwnProperty(P)||Fe(e,t,P,null,l,I)}}for(var L in l){var P=l[L];if(I=i[L],l.hasOwnProperty(L)&&(P!=null||I!=null))switch(L){case"type":u=P;break;case"name":c=P;break;case"checked":U=P;break;case"defaultChecked":Y=P;break;case"value":p=P;break;case"defaultValue":b=P;break;case"children":case"dangerouslySetInnerHTML":if(P!=null)throw Error(a(137,t));break;default:P!==I&&Fe(e,t,L,P,l,I)}}Wo(e,p,b,O,U,Y,u,c);return;case"select":P=p=b=L=null;for(u in i)if(O=i[u],i.hasOwnProperty(u)&&O!=null)switch(u){case"value":break;case"multiple":P=O;default:l.hasOwnProperty(u)||Fe(e,t,u,null,l,O)}for(c in l)if(u=l[c],O=i[c],l.hasOwnProperty(c)&&(u!=null||O!=null))switch(c){case"value":L=u;break;case"defaultValue":b=u;break;case"multiple":p=u;default:u!==O&&Fe(e,t,c,u,l,O)}t=b,i=p,l=P,L!=null?zi(e,!!i,L,!1):!!l!=!!i&&(t!=null?zi(e,!!i,t,!0):zi(e,!!i,i?[]:"",!1));return;case"textarea":P=L=null;for(b in i)if(c=i[b],i.hasOwnProperty(b)&&c!=null&&!l.hasOwnProperty(b))switch(b){case"value":break;case"children":break;default:Fe(e,t,b,null,l,c)}for(p in l)if(c=l[p],u=i[p],l.hasOwnProperty(p)&&(c!=null||u!=null))switch(p){case"value":L=c;break;case"defaultValue":P=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(a(91));break;default:c!==u&&Fe(e,t,p,c,l,u)}bh(e,L,P);return;case"option":for(var he in i)if(L=i[he],i.hasOwnProperty(he)&&L!=null&&!l.hasOwnProperty(he))switch(he){case"selected":e.selected=!1;break;default:Fe(e,t,he,null,l,L)}for(O in l)if(L=l[O],P=i[O],l.hasOwnProperty(O)&&L!==P&&(L!=null||P!=null))switch(O){case"selected":e.selected=L&&typeof L!="function"&&typeof L!="symbol";break;default:Fe(e,t,O,L,l,P)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ye in i)L=i[ye],i.hasOwnProperty(ye)&&L!=null&&!l.hasOwnProperty(ye)&&Fe(e,t,ye,null,l,L);for(U in l)if(L=l[U],P=i[U],l.hasOwnProperty(U)&&L!==P&&(L!=null||P!=null))switch(U){case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(a(137,t));break;default:Fe(e,t,U,L,l,P)}return;default:if(tc(t)){for(var Je in i)L=i[Je],i.hasOwnProperty(Je)&&L!==void 0&&!l.hasOwnProperty(Je)&&Pu(e,t,Je,void 0,l,L);for(Y in l)L=l[Y],P=i[Y],!l.hasOwnProperty(Y)||L===P||L===void 0&&P===void 0||Pu(e,t,Y,L,l,P);return}}for(var R in i)L=i[R],i.hasOwnProperty(R)&&L!=null&&!l.hasOwnProperty(R)&&Fe(e,t,R,null,l,L);for(I in l)L=l[I],P=i[I],!l.hasOwnProperty(I)||L===P||L==null&&P==null||Fe(e,t,I,L,l,P)}function wp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Pb(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,i=performance.getEntriesByType("resource"),l=0;l<i.length;l++){var c=i[l],u=c.transferSize,p=c.initiatorType,b=c.duration;if(u&&b&&wp(p)){for(p=0,b=c.responseEnd,l+=1;l<i.length;l++){var O=i[l],U=O.startTime;if(U>b)break;var Y=O.transferSize,I=O.initiatorType;Y&&wp(I)&&(O=O.responseEnd,p+=Y*(O<b?1:(b-U)/(O-U)))}if(--l,t+=8*(u+p)/(c.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var $u=null,Yu=null;function Zl(e){return e.nodeType===9?e:e.ownerDocument}function Sp(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 Ep(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Gu(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Vu=null;function $b(){var e=window.event;return e&&e.type==="popstate"?e===Vu?!1:(Vu=e,!0):(Vu=null,!1)}var Ap=typeof setTimeout=="function"?setTimeout:void 0,Yb=typeof clearTimeout=="function"?clearTimeout:void 0,Op=typeof Promise=="function"?Promise:void 0,Gb=typeof queueMicrotask=="function"?queueMicrotask:typeof Op<"u"?function(e){return Op.resolve(null).then(e).catch(Vb)}:Ap;function Vb(e){setTimeout(function(){throw e})}function Us(e){return e==="head"}function jp(e,t){var i=t,l=0;do{var c=i.nextSibling;if(e.removeChild(i),c&&c.nodeType===8)if(i=c.data,i==="/$"||i==="/&"){if(l===0){e.removeChild(c),dr(t);return}l--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")l++;else if(i==="html")pa(e.ownerDocument.documentElement);else if(i==="head"){i=e.ownerDocument.head,pa(i);for(var u=i.firstChild;u;){var p=u.nextSibling,b=u.nodeName;u[yt]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&u.rel.toLowerCase()==="stylesheet"||i.removeChild(u),u=p}}else i==="body"&&pa(e.ownerDocument.body);i=c}while(i);dr(t)}function Tp(e,t){var i=e;e=0;do{var l=i.nextSibling;if(i.nodeType===1?t?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(t?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),l&&l.nodeType===8)if(i=l.data,i==="/$"){if(e===0)break;e--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||e++;i=l}while(i)}function Fu(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var i=t;switch(t=t.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":Fu(i),Di(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}e.removeChild(i)}}function Fb(e,t,i,l){for(;e.nodeType===1;){var c=i;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[yt])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(u=e.getAttribute("rel"),u==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(u!==c.rel||e.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||e.getAttribute("title")!==(c.title==null?null:c.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(u=e.getAttribute("src"),(u!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&u&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var u=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===u)return e}else return e;if(e=mn(e.nextSibling),e===null)break}return null}function Jb(e,t,i){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=mn(e.nextSibling),e===null))return null;return e}function Np(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=mn(e.nextSibling),e===null))return null;return e}function Ju(e){return e.data==="$?"||e.data==="$~"}function Qu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Qb(e,t){var i=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||i.readyState!=="loading")t();else{var l=function(){t(),i.removeEventListener("DOMContentLoaded",l)};i.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function mn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Iu=null;function Cp(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"||i==="/&"){if(t===0)return mn(e.nextSibling);t--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||t++}e=e.nextSibling}return null}function kp(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(t===0)return e;t--}else i!=="/$"&&i!=="/&"||t++}e=e.previousSibling}return null}function Mp(e,t,i){switch(t=Zl(i),e){case"html":if(e=t.documentElement,!e)throw Error(a(452));return e;case"head":if(e=t.head,!e)throw Error(a(453));return e;case"body":if(e=t.body,!e)throw Error(a(454));return e;default:throw Error(a(451))}}function pa(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Di(e)}var pn=new Map,Rp=new Set;function Wl(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var os=te.d;te.d={f:Ib,r:Xb,D:Kb,C:Zb,L:Wb,m:ex,X:nx,S:tx,M:sx};function Ib(){var e=os.f(),t=Gl();return e||t}function Xb(e){var t=S(e);t!==null&&t.tag===5&&t.type==="form"?Xd(t):os.r(e)}var ur=typeof document>"u"?null:document;function Dp(e,t,i){var l=ur;if(l&&typeof t=="string"&&t){var c=ln(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof i=="string"&&(c+='[crossorigin="'+i+'"]'),Rp.has(c)||(Rp.add(c),e={rel:e,crossOrigin:i,href:t},l.querySelector(c)===null&&(t=l.createElement("link"),At(t,"link",e),N(t),l.head.appendChild(t)))}}function Kb(e){os.D(e),Dp("dns-prefetch",e,null)}function Zb(e,t){os.C(e,t),Dp("preconnect",e,t)}function Wb(e,t,i){os.L(e,t,i);var l=ur;if(l&&e&&t){var c='link[rel="preload"][as="'+ln(t)+'"]';t==="image"&&i&&i.imageSrcSet?(c+='[imagesrcset="'+ln(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(c+='[imagesizes="'+ln(i.imageSizes)+'"]')):c+='[href="'+ln(e)+'"]';var u=c;switch(t){case"style":u=fr(e);break;case"script":u=hr(e)}pn.has(u)||(e=w({rel:"preload",href:t==="image"&&i&&i.imageSrcSet?void 0:e,as:t},i),pn.set(u,e),l.querySelector(c)!==null||t==="style"&&l.querySelector(ga(u))||t==="script"&&l.querySelector(ya(u))||(t=l.createElement("link"),At(t,"link",e),N(t),l.head.appendChild(t)))}}function ex(e,t){os.m(e,t);var i=ur;if(i&&e){var l=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+ln(l)+'"][href="'+ln(e)+'"]',u=c;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=hr(e)}if(!pn.has(u)&&(e=w({rel:"modulepreload",href:e},t),pn.set(u,e),i.querySelector(c)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(ya(u)))return}l=i.createElement("link"),At(l,"link",e),N(l),i.head.appendChild(l)}}}function tx(e,t,i){os.S(e,t,i);var l=ur;if(l&&e){var c=A(l).hoistableStyles,u=fr(e);t=t||"default";var p=c.get(u);if(!p){var b={loading:0,preload:null};if(p=l.querySelector(ga(u)))b.loading=5;else{e=w({rel:"stylesheet",href:e,"data-precedence":t},i),(i=pn.get(u))&&Xu(e,i);var O=p=l.createElement("link");N(O),At(O,"link",e),O._p=new Promise(function(U,Y){O.onload=U,O.onerror=Y}),O.addEventListener("load",function(){b.loading|=1}),O.addEventListener("error",function(){b.loading|=2}),b.loading|=4,eo(p,t,l)}p={type:"stylesheet",instance:p,count:1,state:b},c.set(u,p)}}}function nx(e,t){os.X(e,t);var i=ur;if(i&&e){var l=A(i).hoistableScripts,c=hr(e),u=l.get(c);u||(u=i.querySelector(ya(c)),u||(e=w({src:e,async:!0},t),(t=pn.get(c))&&Ku(e,t),u=i.createElement("script"),N(u),At(u,"link",e),i.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(c,u))}}function sx(e,t){os.M(e,t);var i=ur;if(i&&e){var l=A(i).hoistableScripts,c=hr(e),u=l.get(c);u||(u=i.querySelector(ya(c)),u||(e=w({src:e,async:!0,type:"module"},t),(t=pn.get(c))&&Ku(e,t),u=i.createElement("script"),N(u),At(u,"link",e),i.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(c,u))}}function zp(e,t,i,l){var c=(c=sn.current)?Wl(c):null;if(!c)throw Error(a(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(t=fr(i.href),i=A(c).hoistableStyles,l=i.get(t),l||(l={type:"style",instance:null,count:0,state:null},i.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){e=fr(i.href);var u=A(c).hoistableStyles,p=u.get(e);if(p||(c=c.ownerDocument||c,p={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,p),(u=c.querySelector(ga(e)))&&!u._p&&(p.instance=u,p.state.loading=5),pn.has(e)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},pn.set(e,i),u||ix(c,e,i,p.state))),t&&l===null)throw Error(a(528,""));return p}if(t&&l!==null)throw Error(a(529,""));return null;case"script":return t=i.async,i=i.src,typeof i=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=hr(i),i=A(c).hoistableScripts,l=i.get(t),l||(l={type:"script",instance:null,count:0,state:null},i.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,e))}}function fr(e){return'href="'+ln(e)+'"'}function ga(e){return'link[rel="stylesheet"]['+e+"]"}function qp(e){return w({},e,{"data-precedence":e.precedence,precedence:null})}function ix(e,t,i,l){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=e.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),At(t,"link",i),N(t),e.head.appendChild(t))}function hr(e){return'[src="'+ln(e)+'"]'}function ya(e){return"script[async]"+e}function Up(e,t,i){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+ln(i.href)+'"]');if(l)return t.instance=l,N(l),l;var c=w({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),N(l),At(l,"style",c),eo(l,i.precedence,e),t.instance=l;case"stylesheet":c=fr(i.href);var u=e.querySelector(ga(c));if(u)return t.state.loading|=4,t.instance=u,N(u),u;l=qp(i),(c=pn.get(c))&&Xu(l,c),u=(e.ownerDocument||e).createElement("link"),N(u);var p=u;return p._p=new Promise(function(b,O){p.onload=b,p.onerror=O}),At(u,"link",l),t.state.loading|=4,eo(u,i.precedence,e),t.instance=u;case"script":return u=hr(i.src),(c=e.querySelector(ya(u)))?(t.instance=c,N(c),c):(l=i,(c=pn.get(u))&&(l=w({},i),Ku(l,c)),e=e.ownerDocument||e,c=e.createElement("script"),N(c),At(c,"link",l),e.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(a(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,eo(l,i.precedence,e));return t.instance}function eo(e,t,i){for(var l=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=l.length?l[l.length-1]:null,u=c,p=0;p<l.length;p++){var b=l[p];if(b.dataset.precedence===t)u=b;else if(u!==c)break}u?u.parentNode.insertBefore(e,u.nextSibling):(t=i.nodeType===9?i.head:i,t.insertBefore(e,t.firstChild))}function Xu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Ku(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var to=null;function Bp(e,t,i){if(to===null){var l=new Map,c=to=new Map;c.set(i,l)}else c=to,l=c.get(i),l||(l=new Map,c.set(i,l));if(l.has(e))return l;for(l.set(e,null),i=i.getElementsByTagName(e),c=0;c<i.length;c++){var u=i[c];if(!(u[yt]||u[Qe]||e==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var p=u.getAttribute(t)||"";p=e+p;var b=l.get(p);b?b.push(u):l.set(p,[u])}}return l}function Lp(e,t,i){e=e.ownerDocument||e,e.head.insertBefore(i,t==="title"?e.querySelector("head > title"):null)}function rx(e,t,i){if(i===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Hp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function ax(e,t,i,l){if(i.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var c=fr(l.href),u=t.querySelector(ga(c));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=no.bind(e),t.then(e,e)),i.state.loading|=4,i.instance=u,N(u);return}u=t.ownerDocument||t,l=qp(l),(c=pn.get(c))&&Xu(l,c),u=u.createElement("link"),N(u);var p=u;p._p=new Promise(function(b,O){p.onload=b,p.onerror=O}),At(u,"link",l),i.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(i,t),(t=i.state.preload)&&(i.state.loading&3)===0&&(e.count++,i=no.bind(e),t.addEventListener("load",i),t.addEventListener("error",i))}}var Zu=0;function lx(e,t){return e.stylesheets&&e.count===0&&io(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var l=setTimeout(function(){if(e.stylesheets&&io(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&Zu===0&&(Zu=62500*Pb());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&io(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>Zu?50:800)+t);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(c)}}:null}function no(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)io(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var so=null;function io(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,so=new Map,t.forEach(ox,e),so=null,no.call(e))}function ox(e,t){if(!(t.state.loading&4)){var i=so.get(e);if(i)var l=i.get(null);else{i=new Map,so.set(e,i);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<c.length;u++){var p=c[u];(p.nodeName==="LINK"||p.getAttribute("media")!=="not all")&&(i.set(p.dataset.precedence,p),l=p)}l&&i.set(null,l)}c=t.instance,p=c.getAttribute("data-precedence"),u=i.get(p)||l,u===l&&i.set(null,c),i.set(p,c),this.count++,l=no.bind(this),c.addEventListener("load",l),c.addEventListener("error",l),u?u.parentNode.insertBefore(c,u.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(c,e.firstChild)),t.state.loading|=4}}var ba={$$typeof:pe,Provider:null,Consumer:null,_currentValue:de,_currentValue2:de,_threadCount:0};function cx(e,t,i,l,c,u,p,b,O){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=gs(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gs(0),this.hiddenUpdates=gs(null),this.identifierPrefix=l,this.onUncaughtError=c,this.onCaughtError=u,this.onRecoverableError=p,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=O,this.incompleteTransitions=new Map}function Pp(e,t,i,l,c,u,p,b,O,U,Y,I){return e=new cx(e,t,i,p,O,U,Y,I,b),t=1,u===!0&&(t|=24),u=Vt(3,null,null,t),e.current=u,u.stateNode=e,t=kc(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:l,isDehydrated:i,cache:t},zc(u),e}function $p(e){return e?(e=Yi,e):Yi}function Yp(e,t,i,l,c,u){c=$p(c),l.context===null?l.context=c:l.pendingContext=c,l=Os(t),l.payload={element:i},u=u===void 0?null:u,u!==null&&(l.callback=u),i=js(e,l,t),i!==null&&(Ht(i,e,t),Xr(i,e,t))}function Gp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<t?i:t}}function Wu(e,t){Gp(e,t),(e=e.alternate)&&Gp(e,t)}function Vp(e){if(e.tag===13||e.tag===31){var t=fi(e,67108864);t!==null&&Ht(t,e,67108864),Wu(e,67108864)}}function Fp(e){if(e.tag===13||e.tag===31){var t=Xt();t=Gn(t);var i=fi(e,t);i!==null&&Ht(i,e,t),Wu(e,t)}}var ro=!0;function ux(e,t,i,l){var c=$.T;$.T=null;var u=te.p;try{te.p=2,ef(e,t,i,l)}finally{te.p=u,$.T=c}}function fx(e,t,i,l){var c=$.T;$.T=null;var u=te.p;try{te.p=8,ef(e,t,i,l)}finally{te.p=u,$.T=c}}function ef(e,t,i,l){if(ro){var c=tf(l);if(c===null)Hu(e,t,l,ao,i),Qp(e,l);else if(dx(c,e,t,i,l))l.stopPropagation();else if(Qp(e,l),t&4&&-1<hx.indexOf(e)){for(;c!==null;){var u=S(c);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var p=xn(u.pendingLanes);if(p!==0){var b=u;for(b.pendingLanes|=2,b.entangledLanes|=2;p;){var O=1<<31-Nt(p);b.entanglements[1]|=O,p&=~O}Dn(u),(He&6)===0&&($l=et()+500,ha(0))}}break;case 31:case 13:b=fi(u,2),b!==null&&Ht(b,u,2),Gl(),Wu(u,2)}if(u=tf(l),u===null&&Hu(e,t,l,ao,i),u===c)break;c=u}c!==null&&l.stopPropagation()}else Hu(e,t,l,null,i)}}function tf(e){return e=sc(e),nf(e)}var ao=null;function nf(e){if(ao=null,e=x(e),e!==null){var t=f(e);if(t===null)e=null;else{var i=t.tag;if(i===13){if(e=h(t),e!==null)return e;e=null}else if(i===31){if(e=d(t),e!==null)return e;e=null}else if(i===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return ao=e,null}function Jp(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(Io()){case Ia:return 2;case Xa:return 8;case ki:case Xo:return 32;case Ka:return 268435456;default:return 32}default:return 32}}var sf=!1,Bs=null,Ls=null,Hs=null,xa=new Map,va=new Map,Ps=[],hx="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 Qp(e,t){switch(e){case"focusin":case"focusout":Bs=null;break;case"dragenter":case"dragleave":Ls=null;break;case"mouseover":case"mouseout":Hs=null;break;case"pointerover":case"pointerout":xa.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":va.delete(t.pointerId)}}function _a(e,t,i,l,c,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:i,eventSystemFlags:l,nativeEvent:u,targetContainers:[c]},t!==null&&(t=S(t),t!==null&&Vp(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function dx(e,t,i,l,c){switch(t){case"focusin":return Bs=_a(Bs,e,t,i,l,c),!0;case"dragenter":return Ls=_a(Ls,e,t,i,l,c),!0;case"mouseover":return Hs=_a(Hs,e,t,i,l,c),!0;case"pointerover":var u=c.pointerId;return xa.set(u,_a(xa.get(u)||null,e,t,i,l,c)),!0;case"gotpointercapture":return u=c.pointerId,va.set(u,_a(va.get(u)||null,e,t,i,l,c)),!0}return!1}function Ip(e){var t=x(e.target);if(t!==null){var i=f(t);if(i!==null){if(t=i.tag,t===13){if(t=h(i),t!==null){e.blockedOn=t,Wa(e.priority,function(){Fp(i)});return}}else if(t===31){if(t=d(i),t!==null){e.blockedOn=t,Wa(e.priority,function(){Fp(i)});return}}else if(t===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function lo(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var i=tf(e.nativeEvent);if(i===null){i=e.nativeEvent;var l=new i.constructor(i.type,i);nc=l,i.target.dispatchEvent(l),nc=null}else return t=S(i),t!==null&&Vp(t),e.blockedOn=i,!1;t.shift()}return!0}function Xp(e,t,i){lo(e)&&i.delete(t)}function mx(){sf=!1,Bs!==null&&lo(Bs)&&(Bs=null),Ls!==null&&lo(Ls)&&(Ls=null),Hs!==null&&lo(Hs)&&(Hs=null),xa.forEach(Xp),va.forEach(Xp)}function oo(e,t){e.blockedOn===t&&(e.blockedOn=null,sf||(sf=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,mx)))}var co=null;function Kp(e){co!==e&&(co=e,r.unstable_scheduleCallback(r.unstable_NormalPriority,function(){co===e&&(co=null);for(var t=0;t<e.length;t+=3){var i=e[t],l=e[t+1],c=e[t+2];if(typeof l!="function"){if(nf(l||i)===null)continue;break}var u=S(i);u!==null&&(e.splice(t,3),t-=3,tu(u,{pending:!0,data:c,method:i.method,action:l},l,c))}}))}function dr(e){function t(O){return oo(O,e)}Bs!==null&&oo(Bs,e),Ls!==null&&oo(Ls,e),Hs!==null&&oo(Hs,e),xa.forEach(t),va.forEach(t);for(var i=0;i<Ps.length;i++){var l=Ps[i];l.blockedOn===e&&(l.blockedOn=null)}for(;0<Ps.length&&(i=Ps[0],i.blockedOn===null);)Ip(i),i.blockedOn===null&&Ps.shift();if(i=(e.ownerDocument||e).$$reactFormReplay,i!=null)for(l=0;l<i.length;l+=3){var c=i[l],u=i[l+1],p=c[it]||null;if(typeof u=="function")p||Kp(i);else if(p){var b=null;if(u&&u.hasAttribute("formAction")){if(c=u,p=u[it]||null)b=p.formAction;else if(nf(c)!==null)continue}else b=p.action;typeof b=="function"?i[l+1]=b:(i.splice(l,3),l-=3),Kp(i)}}}function Zp(){function e(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(p){return c=p})},focusReset:"manual",scroll:"manual"})}function t(){c!==null&&(c(),c=null),l||setTimeout(i,20)}function i(){if(!l&&!navigation.transition){var u=navigation.currentEntry;u&&u.url!=null&&navigation.navigate(u.url,{state:u.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,c=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(i,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),c!==null&&(c(),c=null)}}}function rf(e){this._internalRoot=e}uo.prototype.render=rf.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(a(409));var i=t.current,l=Xt();Yp(i,l,e,t,null,null)},uo.prototype.unmount=rf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Yp(e.current,2,null,e,null,null),Gl(),t[Yt]=null}};function uo(e){this._internalRoot=e}uo.prototype.unstable_scheduleHydration=function(e){if(e){var t=Rr();e={blockedOn:null,target:e,priority:t};for(var i=0;i<Ps.length&&t!==0&&t<Ps[i].priority;i++);Ps.splice(i,0,e),i===0&&Ip(e)}};var Wp=n.version;if(Wp!=="19.2.4")throw Error(a(527,Wp,"19.2.4"));te.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(a(188)):(e=Object.keys(e).join(","),Error(a(268,e)));return e=y(t),e=e!==null?E(e):null,e=e===null?null:e.stateNode,e};var px={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:$,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var fo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!fo.isDisabled&&fo.supportsFiber)try{ni=fo.inject(px),ot=fo}catch{}}return wa.createRoot=function(e,t){if(!o(e))throw Error(a(299));var i=!1,l="",c=am,u=lm,p=om;return t!=null&&(t.unstable_strictMode===!0&&(i=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(c=t.onUncaughtError),t.onCaughtError!==void 0&&(u=t.onCaughtError),t.onRecoverableError!==void 0&&(p=t.onRecoverableError)),t=Pp(e,1,!1,null,null,i,l,null,c,u,p,Zp),e[Yt]=t.current,Lu(e),new rf(t)},wa.hydrateRoot=function(e,t,i){if(!o(e))throw Error(a(299));var l=!1,c="",u=am,p=lm,b=om,O=null;return i!=null&&(i.unstable_strictMode===!0&&(l=!0),i.identifierPrefix!==void 0&&(c=i.identifierPrefix),i.onUncaughtError!==void 0&&(u=i.onUncaughtError),i.onCaughtError!==void 0&&(p=i.onCaughtError),i.onRecoverableError!==void 0&&(b=i.onRecoverableError),i.formState!==void 0&&(O=i.formState)),t=Pp(e,1,!0,t,i??null,l,c,O,u,p,b,Zp),t.context=$p(null),i=t.current,l=Xt(),l=Gn(l),c=Os(l),c.callback=null,js(i,c,l),i=l,t.current.lanes=i,vn(t,i),Dn(t),e[Yt]=t.current,Lu(e),new uo(t)},wa.version="19.2.4",wa}var i0;function nv(){if(i0)return of.exports;i0=1;function r(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(n){console.error(n)}}return r(),of.exports=tv(),of.exports}var sv=nv();const iv="modulepreload",rv=function(r,n){return new URL(r,n).href},r0={},Ae=function(n,s,a){let o=Promise.resolve();if(s&&s.length>0){let h=function(E){return Promise.all(E.map(w=>Promise.resolve(w).then(j=>({status:"fulfilled",value:j}),j=>({status:"rejected",reason:j}))))};const d=document.getElementsByTagName("link"),g=document.querySelector("meta[property=csp-nonce]"),y=(g==null?void 0:g.nonce)||(g==null?void 0:g.getAttribute("nonce"));o=h(s.map(E=>{if(E=rv(E,a),E in r0)return;r0[E]=!0;const w=E.endsWith(".css"),j=w?'[rel="stylesheet"]':"";if(!!a)for(let B=d.length-1;B>=0;B--){const V=d[B];if(V.href===E&&(!w||V.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${E}"]${j}`))return;const M=document.createElement("link");if(M.rel=w?"stylesheet":iv,w||(M.as="script"),M.crossOrigin="",M.href=E,y&&M.setAttribute("nonce",y),document.head.appendChild(M),w)return new Promise((B,V)=>{M.addEventListener("load",B),M.addEventListener("error",()=>V(new Error(`Unable to preload CSS for ${E}`)))})}))}function f(h){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=h,window.dispatchEvent(d),!d.defaultPrevented)throw h}return o.then(h=>{for(const d of h||[])d.status==="rejected"&&f(d.reason);return n().catch(f)})};function hg(r){try{const n=r.split(".");if(n.length!==3)return null;const s=atob(n[1].replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(s)}catch{return null}}function dg(r){const n=hg(r);return!n||typeof n.exp!="number"?null:n.exp}function Kf(r,n=0){const s=dg(r);return s===null?!0:Date.now()/1e3>=s-n}const Bn=window.__LT_BASE__??"",Of=`${Bn}/api`;let Vs=null;function ho(r){Vs=r}function mg(){return Vs}async function a0(){const r=sessionStorage.getItem("lt_credentials");if(!r)return null;try{const{username:n,password:s}=JSON.parse(r),a=await fetch(`${Of}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:n,password:s})});if(!a.ok)return null;const o=await a.json();return o.token&&o.user&&sessionStorage.setItem("lt_user_info",JSON.stringify({displayName:o.user.display_name,username:o.user.external_id})),o.token??null}catch{return null}}let Ys=null;async function Xe(r,n={}){const s={"Content-Type":"application/json",...n.headers};if(Vs){if(Kf(Vs)){Ys||(Ys=a0().finally(()=>{Ys=null}));const o=await Ys;if(o)Vs=o,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:o}}));else throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}s.Authorization=`Bearer ${Vs}`}let a=await fetch(`${Of}${r}`,{...n,headers:s});if(a.status===401&&Vs){Ys||(Ys=a0().finally(()=>{Ys=null}));const o=await Ys;if(o&&(Vs=o,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:o}})),s.Authorization=`Bearer ${o}`,a=await fetch(`${Of}${r}`,{...n,headers:s})),a.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}else if(a.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired");if(!a.ok){const o=await a.json().catch(()=>({error:a.statusText}));throw new Error(o.message||o.error||a.statusText)}return a.json()}const pg=T.createContext(null),av=300;function ff(r,n){if(Kf(r))return null;const s=hg(r);if(!s)return null;const a=n??(()=>{try{const o=sessionStorage.getItem("lt_user_info");return o?JSON.parse(o):null}catch{return null}})();return{userId:s.userId,displayName:(a==null?void 0:a.displayName)??null,username:(a==null?void 0:a.username)??null,roles:s.roles??[]}}function lv({children:r}){const[n,s]=T.useState(()=>{const w=sessionStorage.getItem("lt_token");return w?Kf(w)?(sessionStorage.removeItem("lt_token"),null):(ho(w),ff(w)):null}),a=T.useRef(void 0),o=T.useCallback(w=>{clearTimeout(a.current);const j=dg(w);if(!j)return;const z=(j-av)*1e3-Date.now();z<=0||(a.current=setTimeout(async()=>{const M=sessionStorage.getItem("lt_credentials");if(M)try{const{username:B,password:V}=JSON.parse(M),ne=await fetch(`${Bn}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:B,password:V})});if(!ne.ok)return;const ee=await ne.json();ee.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:ee.token}}))}catch{}},z))},[]),f=T.useCallback((w,j,z)=>{const M={displayName:(z==null?void 0:z.displayName)??null,username:(z==null?void 0:z.username)??(j==null?void 0:j.username)??null},B=ff(w,M);B&&(ho(w),sessionStorage.setItem("lt_token",w),sessionStorage.setItem("lt_user_info",JSON.stringify(M)),j&&sessionStorage.setItem("lt_credentials",JSON.stringify(j)),s(B),o(w))},[o]),h=T.useCallback(()=>{clearTimeout(a.current),ho(null),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info"),s(null)},[]);T.useEffect(()=>{const w=()=>h(),j=z=>{var V;const M=(V=z.detail)==null?void 0:V.token;if(!M)return;const B=ff(M);B&&(ho(M),sessionStorage.setItem("lt_token",M),s(B),o(M))};return window.addEventListener("auth:unauthorized",w),window.addEventListener("auth:refreshed",j),()=>{window.removeEventListener("auth:unauthorized",w),window.removeEventListener("auth:refreshed",j)}},[h,o]),T.useEffect(()=>{const w=sessionStorage.getItem("lt_token");return w&&n&&o(w),()=>clearTimeout(a.current)},[]);const d=(n==null?void 0:n.roles.some(w=>w.type==="superadmin"))??!1,g=T.useCallback(w=>(n==null?void 0:n.roles.some(j=>j.role===w))??!1,[n]),y=T.useCallback(w=>(n==null?void 0:n.roles.some(j=>j.type===w))??!1,[n]),E=(n==null?void 0:n.roles.map(w=>w.role))??[];return m.jsx(pg.Provider,{value:{user:n,isAuthenticated:!!n,isSuperAdmin:d,login:f,logout:h,hasRole:g,hasRoleType:y,userRoleNames:E},children:r})}function Oi(){const r=T.useContext(pg);if(!r)throw new Error("useAuth must be used within AuthProvider");return r}const tn=new Uint8Array(0),ji=new TextEncoder,Wt=new TextDecoder;function ov(...r){let n=0;for(let o=0;o<r.length;o++)n+=r[o].length;const s=new Uint8Array(n);let a=0;for(let o=0;o<r.length;o++)s.set(r[o],a),a+=r[o].length;return s}function Ma(...r){const n=[];for(let s=0;s<r.length;s++)n.push(ji.encode(r[s]));return n.length===0?tn:n.length===1?n[0]:ov(...n)}function l0(r){return!r||r.length===0?"":Wt.decode(r)}const o0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",c0=36,cv=0xcfd41b9100000,u0=33,uv=333,f0=22;function fv(r){for(let n=0;n<r.length;n++)r[n]=Math.floor(Math.random()*255)}function hv(r){var n;(n=globalThis==null?void 0:globalThis.crypto)!=null&&n.getRandomValues?globalThis.crypto.getRandomValues(r):fv(r)}class dv{constructor(){v(this,"buf");v(this,"seq");v(this,"inc");v(this,"inited");this.buf=new Uint8Array(f0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*cv),this.inc=Math.floor(Math.random()*(uv-u0)+u0)}setPre(){const n=new Uint8Array(12);hv(n);for(let s=0;s<12;s++){const a=n[s]%36;this.buf[s]=o0.charCodeAt(a)}}fillSeq(){let n=this.seq;for(let s=f0-1;s>=12;s--)this.buf[s]=o0.charCodeAt(n%c0),n=Math.floor(n/c0)}next(){return this.inited||this.init(),this.seq+=this.inc,this.seq>0xcfd41b9100000&&(this.setPre(),this.initSeqAndInc()),this.fillSeq(),String.fromCharCode.apply(String,this.buf)}reset(){this.init()}}const Ks=new dv;var cs;(function(r){r.Disconnect="disconnect",r.Reconnect="reconnect",r.Update="update",r.LDM="ldm",r.Error="error"})(cs||(cs={}));var br;(function(r){r.Reconnecting="reconnecting",r.PingTimer="pingTimer",r.StaleConnection="staleConnection",r.ClientInitiatedReconnect="client initiated reconnect"})(br||(br={}));var ie;(function(r){r.ApiError="BAD API",r.BadAuthentication="BAD_AUTHENTICATION",r.BadCreds="BAD_CREDS",r.BadHeader="BAD_HEADER",r.BadJson="BAD_JSON",r.BadPayload="BAD_PAYLOAD",r.BadSubject="BAD_SUBJECT",r.Cancelled="CANCELLED",r.ConnectionClosed="CONNECTION_CLOSED",r.ConnectionDraining="CONNECTION_DRAINING",r.ConnectionRefused="CONNECTION_REFUSED",r.ConnectionTimeout="CONNECTION_TIMEOUT",r.Disconnect="DISCONNECT",r.InvalidOption="INVALID_OPTION",r.InvalidPayload="INVALID_PAYLOAD",r.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",r.NoResponders="503",r.NotFunction="NOT_FUNC",r.RequestError="REQUEST_ERROR",r.ServerOptionNotAvailable="SERVER_OPT_NA",r.SubClosed="SUB_CLOSED",r.SubDraining="SUB_DRAINING",r.Timeout="TIMEOUT",r.Tls="TLS",r.Unknown="UNKNOWN_ERROR",r.WssRequired="WSS_REQUIRED",r.JetStreamInvalidAck="JESTREAM_INVALID_ACK",r.JetStream404NoMessages="404",r.JetStream408RequestTimeout="408",r.JetStream409MaxAckPendingExceeded="409",r.JetStream409="409",r.JetStreamNotEnabled="503",r.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",r.AuthorizationViolation="AUTHORIZATION_VIOLATION",r.AuthenticationExpired="AUTHENTICATION_EXPIRED",r.ProtocolError="NATS_PROTOCOL_ERR",r.PermissionsViolation="PERMISSIONS_VIOLATION",r.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",r.AccountExpired="ACCOUNT_EXPIRED"})(ie||(ie={}));function mv(r){return typeof r.code=="string"}class gg{constructor(){v(this,"messages");this.messages=new Map,this.messages.set(ie.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(ie.BadJson,"Bad JSON"),this.messages.set(ie.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(n){return pv.getMessage(n)}getMessage(n){return this.messages.get(n)||n}}const pv=new gg;class ue extends Error{constructor(s,a,o){super(s);v(this,"name");v(this,"message");v(this,"code");v(this,"permissionContext");v(this,"chainedError");v(this,"api_error");this.name="NatsError",this.message=s,this.code=a,this.chainedError=o}static errorForCode(s,a){const o=gg.getMessage(s);return new ue(o,s,a)}isAuthError(){return this.code===ie.AuthenticationExpired||this.code===ie.AuthorizationViolation||this.code===ie.AccountExpired}isAuthTimeout(){return this.code===ie.AuthenticationTimeout}isPermissionError(){return this.code===ie.PermissionsViolation}isProtocolError(){return this.code===ie.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var Kt;(function(r){r[r.Exact=0]="Exact",r[r.CanonicalMIME=1]="CanonicalMIME",r[r.IgnoreCase=2]="IgnoreCase"})(Kt||(Kt={}));var jn;(function(r){r.Timer="timer",r.Count="count",r.JitterTimer="jitterTimer",r.SentinelMsg="sentinelMsg"})(jn||(jn={}));var Ra;(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"})(Ra||(Ra={}));const Co="Nats-Service-Error",ko="Nats-Service-Error-Code";class Mo extends Error{constructor(s,a){super(a);v(this,"code");this.code=s}static isServiceError(s){return Mo.toServiceError(s)!==null}static toServiceError(s){var o,f;const a=((o=s==null?void 0:s.headers)==null?void 0:o.get(ko))||"";if(a!==""){const h=parseInt(a)||400,d=((f=s==null?void 0:s.headers)==null?void 0:f.get(Co))||"";return new Mo(h,d.length?d:a)}return null}}function us(r=""){if(r=r||"_INBOX",typeof r!="string")throw new Error("prefix must be a string");return r.split(".").forEach(n=>{if(n==="*"||n===">")throw new Error(`inbox prefixes cannot have wildcards '${r}'`)}),`${r}.${Ks.next()}`}const jf="127.0.0.1";var Js;(function(r){r.PING="PING",r.STATS="STATS",r.INFO="INFO"})(Js||(Js={}));function $o(r,...n){for(let s=0;s<n.length;s++){const a=n[s];Object.keys(a).forEach(function(o){r[o]=a[o]})}return r}function mo(r){return Wt.decode(r).replace(/\n/g,"␊").replace(/\r/g,"␍")}function Sr(r,n=!0){const s=n?ue.errorForCode(ie.Timeout):null;let a,o;const f=new Promise((h,d)=>{a={cancel:()=>{o&&clearTimeout(o)}},o=setTimeout(()=>{d(s===null?ue.errorForCode(ie.Timeout):s)},r)});return Object.assign(f,a)}function Or(r=0){let n;const s=new Promise(a=>{const o=setTimeout(()=>{a()},r);n={cancel:()=>{o&&clearTimeout(o)}}});return Object.assign(s,n)}function st(){let r={};const n=new Promise((s,a)=>{r={resolve:s,reject:a}});return Object.assign(n,r)}function yg(r){for(let n=r.length-1;n>0;n--){const s=Math.floor(Math.random()*(n+1));[r[n],r[s]]=[r[s],r[n]]}return r}function gv(r){return r===0?0:Math.floor(r/2+Math.random()*r)}function Zf(r=[0,250,250,500,500,3e3,5e3]){Array.isArray(r)||(r=[0,250,250,500,500,3e3,5e3]);const n=r.length-1;return{backoff(s){return gv(s>n?r[n]:r[s])}}}function nt(r){return r*1e6}function Wf(r){return Math.floor(r/1e6)}function h0(r){let a=!0;const o=new Array(r.length);for(let f=0;f<r.length;f++){let h=r.charCodeAt(f);if(h===58||h<33||h>126)throw new ue(`'${r[f]}' is not a valid character for a header key`,ie.BadHeader);a&&97<=h&&h<=122?h-=32:!a&&65<=h&&h<=90&&(h+=32),o[f]=h,a=h==45}return String.fromCharCode(...o)}function fs(r=0,n=""){if(r===0&&n!==""||r>0&&n==="")throw new Error("setting status requires both code and description");return new Qs(r,n)}const hf="NATS/1.0";class Qs{constructor(n=0,s=""){v(this,"_code");v(this,"headers");v(this,"_description");this._code=n,this._description=s,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(n){if(n&&this.headers.size===n.headers.size&&this._code===n._code){for(const[s,a]of this.headers){const o=n.values(s);if(a.length!==o.length)return!1;const f=[...a].sort(),h=[...o].sort();for(let d=0;d<f.length;d++)if(f[d]!==h[d])return!1}return!0}return!1}static decode(n){const s=new Qs,o=Wt.decode(n).split(`\r
|
|
27
|
-
`),f=o[0];if(f!==
|
|
25
|
+
`+l.stack}}var Tr=Object.prototype.hasOwnProperty,Nr=r.unstable_scheduleCallback,$n=r.unstable_cancelCallback,Qa=r.unstable_shouldYield,Ci=r.unstable_requestPaint,et=r.unstable_now,Qo=r.unstable_getCurrentPriorityLevel,Ia=r.unstable_ImmediatePriority,Xa=r.unstable_UserBlockingPriority,ki=r.unstable_NormalPriority,Io=r.unstable_LowPriority,Ka=r.unstable_IdlePriority,Xo=r.log,Za=r.unstable_setDisableYieldValue,ni=null,ot=null;function $t(e){if(typeof Xo=="function"&&Za(e),ot&&typeof ot.setStrictMode=="function")try{ot.setStrictMode(ni,e)}catch{}}var Nt=Math.clz32?Math.clz32:Mi,Cr=Math.log,kr=Math.LN2;function Mi(e){return e>>>=0,e===0?32:31-(Cr(e)/kr|0)|0}var ms=256,Yn=262144,ps=4194304;function xn(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function si(e,t,i){var l=e.pendingLanes;if(l===0)return 0;var c=0,u=e.suspendedLanes,p=e.pingedLanes;e=e.warmLanes;var b=l&134217727;return b!==0?(l=b&~u,l!==0?c=xn(l):(p&=b,p!==0?c=xn(p):i||(i=b&~e,i!==0&&(c=xn(i))))):(b=l&~u,b!==0?c=xn(b):p!==0?c=xn(p):i||(i=l&~e,i!==0&&(c=xn(i)))),c===0?0:t!==0&&t!==c&&(t&u)===0&&(u=c&-c,i=t&-t,u>=i||u===32&&(i&4194048)!==0)?t:c}function ii(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Mr(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ri(){var e=ps;return ps<<=1,(ps&62914560)===0&&(ps=4194304),e}function gs(e){for(var t=[],i=0;31>i;i++)t.push(e);return t}function vn(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ys(e,t,i,l,c,u){var p=e.pendingLanes;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=i,e.entangledLanes&=i,e.errorRecoveryDisabledLanes&=i,e.shellSuspendCounter=0;var b=e.entanglements,O=e.expirationTimes,U=e.hiddenUpdates;for(i=p&~i;0<i;){var Y=31-Nt(i),I=1<<Y;b[Y]=0,O[Y]=-1;var L=U[Y];if(L!==null)for(U[Y]=null,Y=0;Y<L.length;Y++){var P=L[Y];P!==null&&(P.lane&=-536870913)}i&=~I}l!==0&&bs(e,l,0),u!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=u&~(p&~t))}function bs(e,t,i){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-Nt(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|i&261930}function ri(e,t){var i=e.entangledLanes|=t;for(e=e.entanglements;i;){var l=31-Nt(i),c=1<<l;c&t|e[l]&t&&(e[l]|=t),i&=~c}}function xs(e,t){var i=t&-t;return i=(i&42)!==0?1:Gn(i),(i&(e.suspendedLanes|t))!==0?0:i}function Gn(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function ai(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Rr(){var e=te.p;return e!==0?e:(e=window.event,e===void 0?32:Gp(e.type))}function Wa(e,t){var i=te.p;try{return te.p=e,t()}finally{te.p=i}}var Cn=Math.random().toString(36).slice(2),Qe="__reactFiber$"+Cn,it="__reactProps$"+Cn,Yt="__reactContainer$"+Cn,li="__reactEvents$"+Cn,Dr="__reactListeners$"+Cn,el="__reactHandles$"+Cn,tl="__reactResources$"+Cn,yt="__reactMarker$"+Cn;function Di(e){delete e[Qe],delete e[it],delete e[li],delete e[Dr],delete e[el]}function x(e){var t=e[Qe];if(t)return t;for(var i=e.parentNode;i;){if(t=i[Yt]||i[Qe]){if(i=t.alternate,t.child!==null||i!==null&&i.child!==null)for(e=Tp(e);e!==null;){if(i=e[Qe])return i;e=Tp(e)}return t}e=i,i=e.parentNode}return null}function S(e){if(e=e[Qe]||e[Yt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function _(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(a(33))}function A(e){var t=e[tl];return t||(t=e[tl]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function N(e){e[yt]=!0}var D=new Set,Q={};function K(e,t){H(e,t),H(e+"Capture",t)}function H(e,t){for(Q[e]=t,e=0;e<t.length;e++)D.add(t[e])}var J=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),fe={},Oe={};function Ke(e){return Tr.call(Oe,e)?!0:Tr.call(fe,e)?!1:J.test(e)?Oe[e]=!0:(fe[e]=!0,!1)}function Ct(e,t,i){if(Ke(t))if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var l=t.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+i)}}function _n(e,t,i){if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+i)}}function Vn(e,t,i,l){if(l===null)e.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(i);return}e.setAttributeNS(t,i,""+l)}}function an(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function hh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ly(e,t,i){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var c=l.get,u=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(p){i=""+p,u.call(this,p)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return i},setValue:function(p){i=""+p},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ko(e){if(!e._valueTracker){var t=hh(e)?"checked":"value";e._valueTracker=ly(e,t,""+e[t])}}function dh(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),l="";return e&&(l=hh(e)?e.checked?"true":"false":e.value),e=l,e!==i?(t.setValue(e),!0):!1}function nl(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 oy=/[\n"\\]/g;function ln(e){return e.replace(oy,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Zo(e,t,i,l,c,u,p,b){e.name="",p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"?e.type=p:e.removeAttribute("type"),t!=null?p==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+an(t)):e.value!==""+an(t)&&(e.value=""+an(t)):p!=="submit"&&p!=="reset"||e.removeAttribute("value"),t!=null?Wo(e,p,an(t)):i!=null?Wo(e,p,an(i)):l!=null&&e.removeAttribute("value"),c==null&&u!=null&&(e.defaultChecked=!!u),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.name=""+an(b):e.removeAttribute("name")}function mh(e,t,i,l,c,u,p,b){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(e.type=u),t!=null||i!=null){if(!(u!=="submit"&&u!=="reset"||t!=null)){Ko(e);return}i=i!=null?""+an(i):"",t=t!=null?""+an(t):i,b||t===e.value||(e.value=t),e.defaultValue=t}l=l??c,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=b?e.checked:!!l,e.defaultChecked=!!l,p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.name=p),Ko(e)}function Wo(e,t,i){t==="number"&&nl(e.ownerDocument)===e||e.defaultValue===""+i||(e.defaultValue=""+i)}function zi(e,t,i,l){if(e=e.options,t){t={};for(var c=0;c<i.length;c++)t["$"+i[c]]=!0;for(i=0;i<e.length;i++)c=t.hasOwnProperty("$"+e[i].value),e[i].selected!==c&&(e[i].selected=c),c&&l&&(e[i].defaultSelected=!0)}else{for(i=""+an(i),t=null,c=0;c<e.length;c++){if(e[c].value===i){e[c].selected=!0,l&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function ph(e,t,i){if(t!=null&&(t=""+an(t),t!==e.value&&(e.value=t),i==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=i!=null?""+an(i):""}function gh(e,t,i,l){if(t==null){if(l!=null){if(i!=null)throw Error(a(92));if(Le(l)){if(1<l.length)throw Error(a(93));l=l[0]}i=l}i==null&&(i=""),t=i}i=an(t),e.defaultValue=i,l=e.textContent,l===i&&l!==""&&l!==null&&(e.value=l),Ko(e)}function qi(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}var cy=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 yh(e,t,i){var l=t.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?l?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":l?e.setProperty(t,i):typeof i!="number"||i===0||cy.has(t)?t==="float"?e.cssFloat=i:e[t]=(""+i).trim():e[t]=i+"px"}function bh(e,t,i){if(t!=null&&typeof t!="object")throw Error(a(62));if(e=e.style,i!=null){for(var l in i)!i.hasOwnProperty(l)||t!=null&&t.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var c in t)l=t[c],t.hasOwnProperty(c)&&i[c]!==l&&yh(e,c,l)}else for(var u in t)t.hasOwnProperty(u)&&yh(e,u,t[u])}function ec(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 uy=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"]]),fy=/^[\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 sl(e){return fy.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Fn(){}var tc=null;function nc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ui=null,Bi=null;function xh(e){var t=S(e);if(t&&(e=t.stateNode)){var i=e[it]||null;e:switch(e=t.stateNode,t.type){case"input":if(Zo(e,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),t=i.name,i.type==="radio"&&t!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+ln(""+t)+'"][type="radio"]'),t=0;t<i.length;t++){var l=i[t];if(l!==e&&l.form===e.form){var c=l[it]||null;if(!c)throw Error(a(90));Zo(l,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(t=0;t<i.length;t++)l=i[t],l.form===e.form&&dh(l)}break e;case"textarea":ph(e,i.value,i.defaultValue);break e;case"select":t=i.value,t!=null&&zi(e,!!i.multiple,t,!1)}}}var sc=!1;function vh(e,t,i){if(sc)return e(t,i);sc=!0;try{var l=e(t);return l}finally{if(sc=!1,(Ui!==null||Bi!==null)&&(Gl(),Ui&&(t=Ui,e=Bi,Bi=Ui=null,xh(t),e)))for(t=0;t<e.length;t++)xh(e[t])}}function zr(e,t){var i=e.stateNode;if(i===null)return null;var l=i[it]||null;if(l===null)return null;i=l[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(a(231,t,typeof i));return i}var Jn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ic=!1;if(Jn)try{var qr={};Object.defineProperty(qr,"passive",{get:function(){ic=!0}}),window.addEventListener("test",qr,qr),window.removeEventListener("test",qr,qr)}catch{ic=!1}var vs=null,rc=null,il=null;function _h(){if(il)return il;var e,t=rc,i=t.length,l,c="value"in vs?vs.value:vs.textContent,u=c.length;for(e=0;e<i&&t[e]===c[e];e++);var p=i-e;for(l=1;l<=p&&t[i-l]===c[u-l];l++);return il=c.slice(e,1<l?1-l:void 0)}function rl(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function al(){return!0}function wh(){return!1}function zt(e){function t(i,l,c,u,p){this._reactName=i,this._targetInst=c,this.type=l,this.nativeEvent=u,this.target=p,this.currentTarget=null;for(var b in e)e.hasOwnProperty(b)&&(i=e[b],this[b]=i?i(u):u[b]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?al:wh,this.isPropagationStopped=wh,this}return w(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=al)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=al)},persist:function(){},isPersistent:al}),t}var oi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ll=zt(oi),Ur=w({},oi,{view:0,detail:0}),hy=zt(Ur),ac,lc,Br,ol=w({},Ur,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:cc,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!==Br&&(Br&&e.type==="mousemove"?(ac=e.screenX-Br.screenX,lc=e.screenY-Br.screenY):lc=ac=0,Br=e),ac)},movementY:function(e){return"movementY"in e?e.movementY:lc}}),Sh=zt(ol),dy=w({},ol,{dataTransfer:0}),my=zt(dy),py=w({},Ur,{relatedTarget:0}),oc=zt(py),gy=w({},oi,{animationName:0,elapsedTime:0,pseudoElement:0}),yy=zt(gy),by=w({},oi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),xy=zt(by),vy=w({},oi,{data:0}),Eh=zt(vy),_y={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},wy={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"},Sy={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ey(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Sy[e])?!!t[e]:!1}function cc(){return Ey}var Ay=w({},Ur,{key:function(e){if(e.key){var t=_y[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=rl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?wy[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:cc,charCode:function(e){return e.type==="keypress"?rl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?rl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Oy=zt(Ay),jy=w({},ol,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ah=zt(jy),Ty=w({},Ur,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:cc}),Ny=zt(Ty),Cy=w({},oi,{propertyName:0,elapsedTime:0,pseudoElement:0}),ky=zt(Cy),My=w({},ol,{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}),Ry=zt(My),Dy=w({},oi,{newState:0,oldState:0}),zy=zt(Dy),qy=[9,13,27,32],uc=Jn&&"CompositionEvent"in window,Lr=null;Jn&&"documentMode"in document&&(Lr=document.documentMode);var Uy=Jn&&"TextEvent"in window&&!Lr,Oh=Jn&&(!uc||Lr&&8<Lr&&11>=Lr),jh=" ",Th=!1;function Nh(e,t){switch(e){case"keyup":return qy.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ch(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Li=!1;function By(e,t){switch(e){case"compositionend":return Ch(t);case"keypress":return t.which!==32?null:(Th=!0,jh);case"textInput":return e=t.data,e===jh&&Th?null:e;default:return null}}function Ly(e,t){if(Li)return e==="compositionend"||!uc&&Nh(e,t)?(e=_h(),il=rc=vs=null,Li=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Oh&&t.locale!=="ko"?null:t.data;default:return null}}var Hy={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 kh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Hy[e.type]:t==="textarea"}function Mh(e,t,i,l){Ui?Bi?Bi.push(l):Bi=[l]:Ui=l,t=Kl(t,"onChange"),0<t.length&&(i=new ll("onChange","change",null,i,l),e.push({event:i,listeners:t}))}var Hr=null,Pr=null;function Py(e){mp(e,0)}function cl(e){var t=_(e);if(dh(t))return e}function Rh(e,t){if(e==="change")return t}var Dh=!1;if(Jn){var fc;if(Jn){var hc="oninput"in document;if(!hc){var zh=document.createElement("div");zh.setAttribute("oninput","return;"),hc=typeof zh.oninput=="function"}fc=hc}else fc=!1;Dh=fc&&(!document.documentMode||9<document.documentMode)}function qh(){Hr&&(Hr.detachEvent("onpropertychange",Uh),Pr=Hr=null)}function Uh(e){if(e.propertyName==="value"&&cl(Pr)){var t=[];Mh(t,Pr,e,nc(e)),vh(Py,t)}}function $y(e,t,i){e==="focusin"?(qh(),Hr=t,Pr=i,Hr.attachEvent("onpropertychange",Uh)):e==="focusout"&&qh()}function Yy(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return cl(Pr)}function Gy(e,t){if(e==="click")return cl(t)}function Vy(e,t){if(e==="input"||e==="change")return cl(t)}function Fy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Gt=typeof Object.is=="function"?Object.is:Fy;function $r(e,t){if(Gt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var i=Object.keys(e),l=Object.keys(t);if(i.length!==l.length)return!1;for(l=0;l<i.length;l++){var c=i[l];if(!Tr.call(t,c)||!Gt(e[c],t[c]))return!1}return!0}function Bh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Lh(e,t){var i=Bh(e);e=0;for(var l;i;){if(i.nodeType===3){if(l=e+i.textContent.length,e<=t&&l>=t)return{node:i,offset:t-e};e=l}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Bh(i)}}function Hh(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Hh(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ph(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=nl(e.document);t instanceof e.HTMLIFrameElement;){try{var i=typeof t.contentWindow.location.href=="string"}catch{i=!1}if(i)e=t.contentWindow;else break;t=nl(e.document)}return t}function dc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Jy=Jn&&"documentMode"in document&&11>=document.documentMode,Hi=null,mc=null,Yr=null,pc=!1;function $h(e,t,i){var l=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;pc||Hi==null||Hi!==nl(l)||(l=Hi,"selectionStart"in l&&dc(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Yr&&$r(Yr,l)||(Yr=l,l=Kl(mc,"onSelect"),0<l.length&&(t=new ll("onSelect","select",null,t,i),e.push({event:t,listeners:l}),t.target=Hi)))}function ci(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var Pi={animationend:ci("Animation","AnimationEnd"),animationiteration:ci("Animation","AnimationIteration"),animationstart:ci("Animation","AnimationStart"),transitionrun:ci("Transition","TransitionRun"),transitionstart:ci("Transition","TransitionStart"),transitioncancel:ci("Transition","TransitionCancel"),transitionend:ci("Transition","TransitionEnd")},gc={},Yh={};Jn&&(Yh=document.createElement("div").style,"AnimationEvent"in window||(delete Pi.animationend.animation,delete Pi.animationiteration.animation,delete Pi.animationstart.animation),"TransitionEvent"in window||delete Pi.transitionend.transition);function ui(e){if(gc[e])return gc[e];if(!Pi[e])return e;var t=Pi[e],i;for(i in t)if(t.hasOwnProperty(i)&&i in Yh)return gc[e]=t[i];return e}var Gh=ui("animationend"),Vh=ui("animationiteration"),Fh=ui("animationstart"),Qy=ui("transitionrun"),Iy=ui("transitionstart"),Xy=ui("transitioncancel"),Jh=ui("transitionend"),Qh=new Map,yc="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(" ");yc.push("scrollEnd");function wn(e,t){Qh.set(e,t),K(t,[e])}var ul=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},on=[],$i=0,bc=0;function fl(){for(var e=$i,t=bc=$i=0;t<e;){var i=on[t];on[t++]=null;var l=on[t];on[t++]=null;var c=on[t];on[t++]=null;var u=on[t];if(on[t++]=null,l!==null&&c!==null){var p=l.pending;p===null?c.next=c:(c.next=p.next,p.next=c),l.pending=c}u!==0&&Ih(i,c,u)}}function hl(e,t,i,l){on[$i++]=e,on[$i++]=t,on[$i++]=i,on[$i++]=l,bc|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function xc(e,t,i,l){return hl(e,t,i,l),dl(e)}function fi(e,t){return hl(e,null,null,t),dl(e)}function Ih(e,t,i){e.lanes|=i;var l=e.alternate;l!==null&&(l.lanes|=i);for(var c=!1,u=e.return;u!==null;)u.childLanes|=i,l=u.alternate,l!==null&&(l.childLanes|=i),u.tag===22&&(e=u.stateNode,e===null||e._visibility&1||(c=!0)),e=u,u=u.return;return e.tag===3?(u=e.stateNode,c&&t!==null&&(c=31-Nt(i),e=u.hiddenUpdates,l=e[c],l===null?e[c]=[t]:l.push(t),t.lane=i|536870912),u):null}function dl(e){if(50<fa)throw fa=0,Tu=null,Error(a(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Yi={};function Ky(e,t,i,l){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Vt(e,t,i,l){return new Ky(e,t,i,l)}function vc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Qn(e,t){var i=e.alternate;return i===null?(i=Vt(e.tag,t,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&65011712,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i.refCleanup=e.refCleanup,i}function Xh(e,t){e.flags&=65011714;var i=e.alternate;return i===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=i.childLanes,e.lanes=i.lanes,e.child=i.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=i.memoizedProps,e.memoizedState=i.memoizedState,e.updateQueue=i.updateQueue,e.type=i.type,t=i.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function ml(e,t,i,l,c,u){var p=0;if(l=e,typeof e=="function")vc(e)&&(p=1);else if(typeof e=="string")p=nx(e,i,lt.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case F:return e=Vt(31,i,t,c),e.elementType=F,e.lanes=u,e;case B:return hi(i.children,c,u,t);case V:p=8,c|=24;break;case ne:return e=Vt(12,i,t,c|2),e.elementType=ne,e.lanes=u,e;case k:return e=Vt(13,i,t,c),e.elementType=k,e.lanes=u,e;case X:return e=Vt(19,i,t,c),e.elementType=X,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case pe:p=10;break e;case ee:p=9;break e;case ae:p=11;break e;case se:p=14;break e;case W:p=16,l=null;break e}p=29,i=Error(a(130,e===null?"null":typeof e,"")),l=null}return t=Vt(p,i,t,c),t.elementType=e,t.type=l,t.lanes=u,t}function hi(e,t,i,l){return e=Vt(7,e,l,t),e.lanes=i,e}function _c(e,t,i){return e=Vt(6,e,null,t),e.lanes=i,e}function Kh(e){var t=Vt(18,null,null,0);return t.stateNode=e,t}function wc(e,t,i){return t=Vt(4,e.children!==null?e.children:[],e.key,t),t.lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Zh=new WeakMap;function cn(e,t){if(typeof e=="object"&&e!==null){var i=Zh.get(e);return i!==void 0?i:(t={value:e,source:t,stack:Ja(t)},Zh.set(e,t),t)}return{value:e,source:t,stack:Ja(t)}}var Gi=[],Vi=0,pl=null,Gr=0,un=[],fn=0,_s=null,kn=1,Mn="";function In(e,t){Gi[Vi++]=Gr,Gi[Vi++]=pl,pl=e,Gr=t}function Wh(e,t,i){un[fn++]=kn,un[fn++]=Mn,un[fn++]=_s,_s=e;var l=kn;e=Mn;var c=32-Nt(l)-1;l&=~(1<<c),i+=1;var u=32-Nt(t)+c;if(30<u){var p=c-c%5;u=(l&(1<<p)-1).toString(32),l>>=p,c-=p,kn=1<<32-Nt(t)+c|i<<c|l,Mn=u+e}else kn=1<<u|i<<c|l,Mn=e}function Sc(e){e.return!==null&&(In(e,1),Wh(e,1,0))}function Ec(e){for(;e===pl;)pl=Gi[--Vi],Gi[Vi]=null,Gr=Gi[--Vi],Gi[Vi]=null;for(;e===_s;)_s=un[--fn],un[fn]=null,Mn=un[--fn],un[fn]=null,kn=un[--fn],un[fn]=null}function ed(e,t){un[fn++]=kn,un[fn++]=Mn,un[fn++]=_s,kn=t.id,Mn=t.overflow,_s=e}var wt=null,Ze=null,Re=!1,ws=null,hn=!1,Ac=Error(a(519));function Ss(e){var t=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Vr(cn(t,e)),Ac}function td(e){var t=e.stateNode,i=e.type,l=e.memoizedProps;switch(t[Qe]=e,t[it]=l,i){case"dialog":Ce("cancel",t),Ce("close",t);break;case"iframe":case"object":case"embed":Ce("load",t);break;case"video":case"audio":for(i=0;i<da.length;i++)Ce(da[i],t);break;case"source":Ce("error",t);break;case"img":case"image":case"link":Ce("error",t),Ce("load",t);break;case"details":Ce("toggle",t);break;case"input":Ce("invalid",t),mh(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Ce("invalid",t);break;case"textarea":Ce("invalid",t),gh(t,l.value,l.defaultValue,l.children)}i=l.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||t.textContent===""+i||l.suppressHydrationWarning===!0||bp(t.textContent,i)?(l.popover!=null&&(Ce("beforetoggle",t),Ce("toggle",t)),l.onScroll!=null&&Ce("scroll",t),l.onScrollEnd!=null&&Ce("scrollend",t),l.onClick!=null&&(t.onclick=Fn),t=!0):t=!1,t||Ss(e,!0)}function nd(e){for(wt=e.return;wt;)switch(wt.tag){case 5:case 31:case 13:hn=!1;return;case 27:case 3:hn=!0;return;default:wt=wt.return}}function Fi(e){if(e!==wt)return!1;if(!Re)return nd(e),Re=!0,!1;var t=e.tag,i;if((i=t!==3&&t!==27)&&((i=t===5)&&(i=e.type,i=!(i!=="form"&&i!=="button")||Yu(e.type,e.memoizedProps)),i=!i),i&&Ze&&Ss(e),nd(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));Ze=jp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));Ze=jp(e)}else t===27?(t=Ze,Us(e.type)?(e=Qu,Qu=null,Ze=e):Ze=t):Ze=wt?mn(e.stateNode.nextSibling):null;return!0}function di(){Ze=wt=null,Re=!1}function Oc(){var e=ws;return e!==null&&(Lt===null?Lt=e:Lt.push.apply(Lt,e),ws=null),e}function Vr(e){ws===null?ws=[e]:ws.push(e)}var jc=je(null),mi=null,Xn=null;function Es(e,t,i){Te(jc,t._currentValue),t._currentValue=i}function Kn(e){e._currentValue=jc.current,_e(jc)}function Tc(e,t,i){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===i)break;e=e.return}}function Nc(e,t,i,l){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var u=c.dependencies;if(u!==null){var p=c.child;u=u.firstContext;e:for(;u!==null;){var b=u;u=c;for(var O=0;O<t.length;O++)if(b.context===t[O]){u.lanes|=i,b=u.alternate,b!==null&&(b.lanes|=i),Tc(u.return,i,e),l||(p=null);break e}u=b.next}}else if(c.tag===18){if(p=c.return,p===null)throw Error(a(341));p.lanes|=i,u=p.alternate,u!==null&&(u.lanes|=i),Tc(p,i,e),p=null}else p=c.child;if(p!==null)p.return=c;else for(p=c;p!==null;){if(p===e){p=null;break}if(c=p.sibling,c!==null){c.return=p.return,p=c;break}p=p.return}c=p}}function Ji(e,t,i,l){e=null;for(var c=t,u=!1;c!==null;){if(!u){if((c.flags&524288)!==0)u=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var p=c.alternate;if(p===null)throw Error(a(387));if(p=p.memoizedProps,p!==null){var b=c.type;Gt(c.pendingProps.value,p.value)||(e!==null?e.push(b):e=[b])}}else if(c===Ot.current){if(p=c.alternate,p===null)throw Error(a(387));p.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(ba):e=[ba])}c=c.return}e!==null&&Nc(t,e,i,l),t.flags|=262144}function gl(e){for(e=e.firstContext;e!==null;){if(!Gt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function pi(e){mi=e,Xn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function St(e){return sd(mi,e)}function yl(e,t){return mi===null&&pi(e),sd(e,t)}function sd(e,t){var i=t._currentValue;if(t={context:t,memoizedValue:i,next:null},Xn===null){if(e===null)throw Error(a(308));Xn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Xn=Xn.next=t;return i}var Zy=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(i,l){e.push(l)}};this.abort=function(){t.aborted=!0,e.forEach(function(i){return i()})}},Wy=r.unstable_scheduleCallback,eb=r.unstable_NormalPriority,ht={$$typeof:pe,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Cc(){return{controller:new Zy,data:new Map,refCount:0}}function Fr(e){e.refCount--,e.refCount===0&&Wy(eb,function(){e.controller.abort()})}var Jr=null,kc=0,Qi=0,Ii=null;function tb(e,t){if(Jr===null){var i=Jr=[];kc=0,Qi=Du(),Ii={status:"pending",value:void 0,then:function(l){i.push(l)}}}return kc++,t.then(id,id),t}function id(){if(--kc===0&&Jr!==null){Ii!==null&&(Ii.status="fulfilled");var e=Jr;Jr=null,Qi=0,Ii=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function nb(e,t){var i=[],l={status:"pending",value:null,reason:null,then:function(c){i.push(c)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var c=0;c<i.length;c++)(0,i[c])(t)},function(c){for(l.status="rejected",l.reason=c,c=0;c<i.length;c++)(0,i[c])(void 0)}),l}var rd=$.S;$.S=function(e,t){$m=et(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&tb(e,t),rd!==null&&rd(e,t)};var gi=je(null);function Mc(){var e=gi.current;return e!==null?e:Ie.pooledCache}function bl(e,t){t===null?Te(gi,gi.current):Te(gi,t.pool)}function ad(){var e=Mc();return e===null?null:{parent:ht._currentValue,pool:e}}var Xi=Error(a(460)),Rc=Error(a(474)),xl=Error(a(542)),vl={then:function(){}};function ld(e){return e=e.status,e==="fulfilled"||e==="rejected"}function od(e,t,i){switch(i=e[i],i===void 0?e.push(t):i!==t&&(t.then(Fn,Fn),t=i),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,ud(e),e;default:if(typeof t.status=="string")t.then(Fn,Fn);else{if(e=Ie,e!==null&&100<e.shellSuspendCounter)throw Error(a(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var c=t;c.status="fulfilled",c.value=l}},function(l){if(t.status==="pending"){var c=t;c.status="rejected",c.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,ud(e),e}throw bi=t,Xi}}function yi(e){try{var t=e._init;return t(e._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(bi=i,Xi):i}}var bi=null;function cd(){if(bi===null)throw Error(a(459));var e=bi;return bi=null,e}function ud(e){if(e===Xi||e===xl)throw Error(a(483))}var Ki=null,Qr=0;function _l(e){var t=Qr;return Qr+=1,Ki===null&&(Ki=[]),od(Ki,e,t)}function Ir(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function wl(e,t){throw t.$$typeof===j?Error(a(525)):(e=Object.prototype.toString.call(t),Error(a(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function fd(e){function t(R,C){if(e){var q=R.deletions;q===null?(R.deletions=[C],R.flags|=16):q.push(C)}}function i(R,C){if(!e)return null;for(;C!==null;)t(R,C),C=C.sibling;return null}function l(R){for(var C=new Map;R!==null;)R.key!==null?C.set(R.key,R):C.set(R.index,R),R=R.sibling;return C}function c(R,C){return R=Qn(R,C),R.index=0,R.sibling=null,R}function u(R,C,q){return R.index=q,e?(q=R.alternate,q!==null?(q=q.index,q<C?(R.flags|=67108866,C):q):(R.flags|=67108866,C)):(R.flags|=1048576,C)}function p(R){return e&&R.alternate===null&&(R.flags|=67108866),R}function b(R,C,q,G){return C===null||C.tag!==6?(C=_c(q,R.mode,G),C.return=R,C):(C=c(C,q),C.return=R,C)}function O(R,C,q,G){var ge=q.type;return ge===B?Y(R,C,q.props.children,G,q.key):C!==null&&(C.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===W&&yi(ge)===C.type)?(C=c(C,q.props),Ir(C,q),C.return=R,C):(C=ml(q.type,q.key,q.props,null,R.mode,G),Ir(C,q),C.return=R,C)}function U(R,C,q,G){return C===null||C.tag!==4||C.stateNode.containerInfo!==q.containerInfo||C.stateNode.implementation!==q.implementation?(C=wc(q,R.mode,G),C.return=R,C):(C=c(C,q.children||[]),C.return=R,C)}function Y(R,C,q,G,ge){return C===null||C.tag!==7?(C=hi(q,R.mode,G,ge),C.return=R,C):(C=c(C,q),C.return=R,C)}function I(R,C,q){if(typeof C=="string"&&C!==""||typeof C=="number"||typeof C=="bigint")return C=_c(""+C,R.mode,q),C.return=R,C;if(typeof C=="object"&&C!==null){switch(C.$$typeof){case z:return q=ml(C.type,C.key,C.props,null,R.mode,q),Ir(q,C),q.return=R,q;case M:return C=wc(C,R.mode,q),C.return=R,C;case W:return C=yi(C),I(R,C,q)}if(Le(C)||re(C))return C=hi(C,R.mode,q,null),C.return=R,C;if(typeof C.then=="function")return I(R,_l(C),q);if(C.$$typeof===pe)return I(R,yl(R,C),q);wl(R,C)}return null}function L(R,C,q,G){var ge=C!==null?C.key:null;if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return ge!==null?null:b(R,C,""+q,G);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case z:return q.key===ge?O(R,C,q,G):null;case M:return q.key===ge?U(R,C,q,G):null;case W:return q=yi(q),L(R,C,q,G)}if(Le(q)||re(q))return ge!==null?null:Y(R,C,q,G,null);if(typeof q.then=="function")return L(R,C,_l(q),G);if(q.$$typeof===pe)return L(R,C,yl(R,q),G);wl(R,q)}return null}function P(R,C,q,G,ge){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return R=R.get(q)||null,b(C,R,""+G,ge);if(typeof G=="object"&&G!==null){switch(G.$$typeof){case z:return R=R.get(G.key===null?q:G.key)||null,O(C,R,G,ge);case M:return R=R.get(G.key===null?q:G.key)||null,U(C,R,G,ge);case W:return G=yi(G),P(R,C,q,G,ge)}if(Le(G)||re(G))return R=R.get(q)||null,Y(C,R,G,ge,null);if(typeof G.then=="function")return P(R,C,q,_l(G),ge);if(G.$$typeof===pe)return P(R,C,q,yl(C,G),ge);wl(C,G)}return null}function he(R,C,q,G){for(var ge=null,Ue=null,me=C,Ee=C=0,Me=null;me!==null&&Ee<q.length;Ee++){me.index>Ee?(Me=me,me=null):Me=me.sibling;var Be=L(R,me,q[Ee],G);if(Be===null){me===null&&(me=Me);break}e&&me&&Be.alternate===null&&t(R,me),C=u(Be,C,Ee),Ue===null?ge=Be:Ue.sibling=Be,Ue=Be,me=Me}if(Ee===q.length)return i(R,me),Re&&In(R,Ee),ge;if(me===null){for(;Ee<q.length;Ee++)me=I(R,q[Ee],G),me!==null&&(C=u(me,C,Ee),Ue===null?ge=me:Ue.sibling=me,Ue=me);return Re&&In(R,Ee),ge}for(me=l(me);Ee<q.length;Ee++)Me=P(me,R,Ee,q[Ee],G),Me!==null&&(e&&Me.alternate!==null&&me.delete(Me.key===null?Ee:Me.key),C=u(Me,C,Ee),Ue===null?ge=Me:Ue.sibling=Me,Ue=Me);return e&&me.forEach(function($s){return t(R,$s)}),Re&&In(R,Ee),ge}function ye(R,C,q,G){if(q==null)throw Error(a(151));for(var ge=null,Ue=null,me=C,Ee=C=0,Me=null,Be=q.next();me!==null&&!Be.done;Ee++,Be=q.next()){me.index>Ee?(Me=me,me=null):Me=me.sibling;var $s=L(R,me,Be.value,G);if($s===null){me===null&&(me=Me);break}e&&me&&$s.alternate===null&&t(R,me),C=u($s,C,Ee),Ue===null?ge=$s:Ue.sibling=$s,Ue=$s,me=Me}if(Be.done)return i(R,me),Re&&In(R,Ee),ge;if(me===null){for(;!Be.done;Ee++,Be=q.next())Be=I(R,Be.value,G),Be!==null&&(C=u(Be,C,Ee),Ue===null?ge=Be:Ue.sibling=Be,Ue=Be);return Re&&In(R,Ee),ge}for(me=l(me);!Be.done;Ee++,Be=q.next())Be=P(me,R,Ee,Be.value,G),Be!==null&&(e&&Be.alternate!==null&&me.delete(Be.key===null?Ee:Be.key),C=u(Be,C,Ee),Ue===null?ge=Be:Ue.sibling=Be,Ue=Be);return e&&me.forEach(function(dx){return t(R,dx)}),Re&&In(R,Ee),ge}function Je(R,C,q,G){if(typeof q=="object"&&q!==null&&q.type===B&&q.key===null&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case z:e:{for(var ge=q.key;C!==null;){if(C.key===ge){if(ge=q.type,ge===B){if(C.tag===7){i(R,C.sibling),G=c(C,q.props.children),G.return=R,R=G;break e}}else if(C.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===W&&yi(ge)===C.type){i(R,C.sibling),G=c(C,q.props),Ir(G,q),G.return=R,R=G;break e}i(R,C);break}else t(R,C);C=C.sibling}q.type===B?(G=hi(q.props.children,R.mode,G,q.key),G.return=R,R=G):(G=ml(q.type,q.key,q.props,null,R.mode,G),Ir(G,q),G.return=R,R=G)}return p(R);case M:e:{for(ge=q.key;C!==null;){if(C.key===ge)if(C.tag===4&&C.stateNode.containerInfo===q.containerInfo&&C.stateNode.implementation===q.implementation){i(R,C.sibling),G=c(C,q.children||[]),G.return=R,R=G;break e}else{i(R,C);break}else t(R,C);C=C.sibling}G=wc(q,R.mode,G),G.return=R,R=G}return p(R);case W:return q=yi(q),Je(R,C,q,G)}if(Le(q))return he(R,C,q,G);if(re(q)){if(ge=re(q),typeof ge!="function")throw Error(a(150));return q=ge.call(q),ye(R,C,q,G)}if(typeof q.then=="function")return Je(R,C,_l(q),G);if(q.$$typeof===pe)return Je(R,C,yl(R,q),G);wl(R,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,C!==null&&C.tag===6?(i(R,C.sibling),G=c(C,q),G.return=R,R=G):(i(R,C),G=_c(q,R.mode,G),G.return=R,R=G),p(R)):i(R,C)}return function(R,C,q,G){try{Qr=0;var ge=Je(R,C,q,G);return Ki=null,ge}catch(me){if(me===Xi||me===xl)throw me;var Ue=Vt(29,me,null,R.mode);return Ue.lanes=G,Ue.return=R,Ue}finally{}}}var xi=fd(!0),hd=fd(!1),As=!1;function Dc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function zc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Os(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function js(e,t,i){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(He&2)!==0){var c=l.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),l.pending=t,t=dl(e),Ih(e,null,i),t}return hl(e,l,t,i),dl(e)}function Xr(e,t,i){if(t=t.updateQueue,t!==null&&(t=t.shared,(i&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,i|=l,t.lanes=i,ri(e,i)}}function qc(e,t){var i=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,i===l)){var c=null,u=null;if(i=i.firstBaseUpdate,i!==null){do{var p={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};u===null?c=u=p:u=u.next=p,i=i.next}while(i!==null);u===null?c=u=t:u=u.next=t}else c=u=t;i={baseState:l.baseState,firstBaseUpdate:c,lastBaseUpdate:u,shared:l.shared,callbacks:l.callbacks},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}var Uc=!1;function Kr(){if(Uc){var e=Ii;if(e!==null)throw e}}function Zr(e,t,i,l){Uc=!1;var c=e.updateQueue;As=!1;var u=c.firstBaseUpdate,p=c.lastBaseUpdate,b=c.shared.pending;if(b!==null){c.shared.pending=null;var O=b,U=O.next;O.next=null,p===null?u=U:p.next=U,p=O;var Y=e.alternate;Y!==null&&(Y=Y.updateQueue,b=Y.lastBaseUpdate,b!==p&&(b===null?Y.firstBaseUpdate=U:b.next=U,Y.lastBaseUpdate=O))}if(u!==null){var I=c.baseState;p=0,Y=U=O=null,b=u;do{var L=b.lane&-536870913,P=L!==b.lane;if(P?(ke&L)===L:(l&L)===L){L!==0&&L===Qi&&(Uc=!0),Y!==null&&(Y=Y.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var he=e,ye=b;L=t;var Je=i;switch(ye.tag){case 1:if(he=ye.payload,typeof he=="function"){I=he.call(Je,I,L);break e}I=he;break e;case 3:he.flags=he.flags&-65537|128;case 0:if(he=ye.payload,L=typeof he=="function"?he.call(Je,I,L):he,L==null)break e;I=w({},I,L);break e;case 2:As=!0}}L=b.callback,L!==null&&(e.flags|=64,P&&(e.flags|=8192),P=c.callbacks,P===null?c.callbacks=[L]:P.push(L))}else P={lane:L,tag:b.tag,payload:b.payload,callback:b.callback,next:null},Y===null?(U=Y=P,O=I):Y=Y.next=P,p|=L;if(b=b.next,b===null){if(b=c.shared.pending,b===null)break;P=b,b=P.next,P.next=null,c.lastBaseUpdate=P,c.shared.pending=null}}while(!0);Y===null&&(O=I),c.baseState=O,c.firstBaseUpdate=U,c.lastBaseUpdate=Y,u===null&&(c.shared.lanes=0),Ms|=p,e.lanes=p,e.memoizedState=I}}function dd(e,t){if(typeof e!="function")throw Error(a(191,e));e.call(t)}function md(e,t){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;e<i.length;e++)dd(i[e],t)}var Zi=je(null),Sl=je(0);function pd(e,t){e=as,Te(Sl,e),Te(Zi,t),as=e|t.baseLanes}function Bc(){Te(Sl,as),Te(Zi,Zi.current)}function Lc(){as=Sl.current,_e(Zi),_e(Sl)}var Ft=je(null),dn=null;function Ts(e){var t=e.alternate;Te(ct,ct.current&1),Te(Ft,e),dn===null&&(t===null||Zi.current!==null||t.memoizedState!==null)&&(dn=e)}function Hc(e){Te(ct,ct.current),Te(Ft,e),dn===null&&(dn=e)}function gd(e){e.tag===22?(Te(ct,ct.current),Te(Ft,e),dn===null&&(dn=e)):Ns()}function Ns(){Te(ct,ct.current),Te(Ft,Ft.current)}function Jt(e){_e(Ft),dn===e&&(dn=null),_e(ct)}var ct=je(0);function El(e){for(var t=e;t!==null;){if(t.tag===13){var i=t.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||Fu(i)||Ju(i)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Zn=0,Se=null,Ve=null,dt=null,Al=!1,Wi=!1,vi=!1,Ol=0,Wr=0,er=null,sb=0;function rt(){throw Error(a(321))}function Pc(e,t){if(t===null)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!Gt(e[i],t[i]))return!1;return!0}function $c(e,t,i,l,c,u){return Zn=u,Se=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,$.H=e===null||e.memoizedState===null?Wd:su,vi=!1,u=i(l,c),vi=!1,Wi&&(u=bd(t,i,l,c)),yd(e),u}function yd(e){$.H=na;var t=Ve!==null&&Ve.next!==null;if(Zn=0,dt=Ve=Se=null,Al=!1,Wr=0,er=null,t)throw Error(a(300));e===null||mt||(e=e.dependencies,e!==null&&gl(e)&&(mt=!0))}function bd(e,t,i,l){Se=e;var c=0;do{if(Wi&&(er=null),Wr=0,Wi=!1,25<=c)throw Error(a(301));if(c+=1,dt=Ve=null,e.updateQueue!=null){var u=e.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}$.H=em,u=t(i,l)}while(Wi);return u}function ib(){var e=$.H,t=e.useState()[0];return t=typeof t.then=="function"?ea(t):t,e=e.useState()[0],(Ve!==null?Ve.memoizedState:null)!==e&&(Se.flags|=1024),t}function Yc(){var e=Ol!==0;return Ol=0,e}function Gc(e,t,i){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i}function Vc(e){if(Al){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Al=!1}Zn=0,dt=Ve=Se=null,Wi=!1,Wr=Ol=0,er=null}function kt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return dt===null?Se.memoizedState=dt=e:dt=dt.next=e,dt}function ut(){if(Ve===null){var e=Se.alternate;e=e!==null?e.memoizedState:null}else e=Ve.next;var t=dt===null?Se.memoizedState:dt.next;if(t!==null)dt=t,Ve=e;else{if(e===null)throw Se.alternate===null?Error(a(467)):Error(a(310));Ve=e,e={memoizedState:Ve.memoizedState,baseState:Ve.baseState,baseQueue:Ve.baseQueue,queue:Ve.queue,next:null},dt===null?Se.memoizedState=dt=e:dt=dt.next=e}return dt}function jl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ea(e){var t=Wr;return Wr+=1,er===null&&(er=[]),e=od(er,e,t),t=Se,(dt===null?t.memoizedState:dt.next)===null&&(t=t.alternate,$.H=t===null||t.memoizedState===null?Wd:su),e}function Tl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ea(e);if(e.$$typeof===pe)return St(e)}throw Error(a(438,String(e)))}function Fc(e){var t=null,i=Se.updateQueue;if(i!==null&&(t=i.memoCache),t==null){var l=Se.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(c){return c.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),i===null&&(i=jl(),Se.updateQueue=i),i.memoCache=t,i=t.data[t.index],i===void 0)for(i=t.data[t.index]=Array(e),l=0;l<e;l++)i[l]=Z;return t.index++,i}function Wn(e,t){return typeof t=="function"?t(e):t}function Nl(e){var t=ut();return Jc(t,Ve,e)}function Jc(e,t,i){var l=e.queue;if(l===null)throw Error(a(311));l.lastRenderedReducer=i;var c=e.baseQueue,u=l.pending;if(u!==null){if(c!==null){var p=c.next;c.next=u.next,u.next=p}t.baseQueue=c=u,l.pending=null}if(u=e.baseState,c===null)e.memoizedState=u;else{t=c.next;var b=p=null,O=null,U=t,Y=!1;do{var I=U.lane&-536870913;if(I!==U.lane?(ke&I)===I:(Zn&I)===I){var L=U.revertLane;if(L===0)O!==null&&(O=O.next={lane:0,revertLane:0,gesture:null,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null}),I===Qi&&(Y=!0);else if((Zn&L)===L){U=U.next,L===Qi&&(Y=!0);continue}else I={lane:0,revertLane:U.revertLane,gesture:null,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null},O===null?(b=O=I,p=u):O=O.next=I,Se.lanes|=L,Ms|=L;I=U.action,vi&&i(u,I),u=U.hasEagerState?U.eagerState:i(u,I)}else L={lane:I,revertLane:U.revertLane,gesture:U.gesture,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null},O===null?(b=O=L,p=u):O=O.next=L,Se.lanes|=I,Ms|=I;U=U.next}while(U!==null&&U!==t);if(O===null?p=u:O.next=b,!Gt(u,e.memoizedState)&&(mt=!0,Y&&(i=Ii,i!==null)))throw i;e.memoizedState=u,e.baseState=p,e.baseQueue=O,l.lastRenderedState=u}return c===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Qc(e){var t=ut(),i=t.queue;if(i===null)throw Error(a(311));i.lastRenderedReducer=e;var l=i.dispatch,c=i.pending,u=t.memoizedState;if(c!==null){i.pending=null;var p=c=c.next;do u=e(u,p.action),p=p.next;while(p!==c);Gt(u,t.memoizedState)||(mt=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),i.lastRenderedState=u}return[u,l]}function xd(e,t,i){var l=Se,c=ut(),u=Re;if(u){if(i===void 0)throw Error(a(407));i=i()}else i=t();var p=!Gt((Ve||c).memoizedState,i);if(p&&(c.memoizedState=i,mt=!0),c=c.queue,Kc(wd.bind(null,l,c,e),[e]),c.getSnapshot!==t||p||dt!==null&&dt.memoizedState.tag&1){if(l.flags|=2048,tr(9,{destroy:void 0},_d.bind(null,l,c,i,t),null),Ie===null)throw Error(a(349));u||(Zn&127)!==0||vd(l,t,i)}return i}function vd(e,t,i){e.flags|=16384,e={getSnapshot:t,value:i},t=Se.updateQueue,t===null?(t=jl(),Se.updateQueue=t,t.stores=[e]):(i=t.stores,i===null?t.stores=[e]:i.push(e))}function _d(e,t,i,l){t.value=i,t.getSnapshot=l,Sd(t)&&Ed(e)}function wd(e,t,i){return i(function(){Sd(t)&&Ed(e)})}function Sd(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!Gt(e,i)}catch{return!0}}function Ed(e){var t=fi(e,2);t!==null&&Ht(t,e,2)}function Ic(e){var t=kt();if(typeof e=="function"){var i=e;if(e=i(),vi){$t(!0);try{i()}finally{$t(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wn,lastRenderedState:e},t}function Ad(e,t,i,l){return e.baseState=i,Jc(e,Ve,typeof l=="function"?l:Wn)}function rb(e,t,i,l,c){if(Ml(e))throw Error(a(485));if(e=t.action,e!==null){var u={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(p){u.listeners.push(p)}};$.T!==null?i(!0):u.isTransition=!1,l(u),i=t.pending,i===null?(u.next=t.pending=u,Od(t,u)):(u.next=i.next,t.pending=i.next=u)}}function Od(e,t){var i=t.action,l=t.payload,c=e.state;if(t.isTransition){var u=$.T,p={};$.T=p;try{var b=i(c,l),O=$.S;O!==null&&O(p,b),jd(e,t,b)}catch(U){Xc(e,t,U)}finally{u!==null&&p.types!==null&&(u.types=p.types),$.T=u}}else try{u=i(c,l),jd(e,t,u)}catch(U){Xc(e,t,U)}}function jd(e,t,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(l){Td(e,t,l)},function(l){return Xc(e,t,l)}):Td(e,t,i)}function Td(e,t,i){t.status="fulfilled",t.value=i,Nd(t),e.state=i,t=e.pending,t!==null&&(i=t.next,i===t?e.pending=null:(i=i.next,t.next=i,Od(e,i)))}function Xc(e,t,i){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=i,Nd(t),t=t.next;while(t!==l)}e.action=null}function Nd(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Cd(e,t){return t}function kd(e,t){if(Re){var i=Ie.formState;if(i!==null){e:{var l=Se;if(Re){if(Ze){t:{for(var c=Ze,u=hn;c.nodeType!==8;){if(!u){c=null;break t}if(c=mn(c.nextSibling),c===null){c=null;break t}}u=c.data,c=u==="F!"||u==="F"?c:null}if(c){Ze=mn(c.nextSibling),l=c.data==="F!";break e}}Ss(l)}l=!1}l&&(t=i[0])}}return i=kt(),i.memoizedState=i.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cd,lastRenderedState:t},i.queue=l,i=Xd.bind(null,Se,l),l.dispatch=i,l=Ic(!1),u=nu.bind(null,Se,!1,l.queue),l=kt(),c={state:t,dispatch:null,action:e,pending:null},l.queue=c,i=rb.bind(null,Se,c,u,i),c.dispatch=i,l.memoizedState=e,[t,i,!1]}function Md(e){var t=ut();return Rd(t,Ve,e)}function Rd(e,t,i){if(t=Jc(e,t,Cd)[0],e=Nl(Wn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=ea(t)}catch(p){throw p===Xi?xl:p}else l=t;t=ut();var c=t.queue,u=c.dispatch;return i!==t.memoizedState&&(Se.flags|=2048,tr(9,{destroy:void 0},ab.bind(null,c,i),null)),[l,u,e]}function ab(e,t){e.action=t}function Dd(e){var t=ut(),i=Ve;if(i!==null)return Rd(t,i,e);ut(),t=t.memoizedState,i=ut();var l=i.queue.dispatch;return i.memoizedState=e,[t,l,!1]}function tr(e,t,i,l){return e={tag:e,create:i,deps:l,inst:t,next:null},t=Se.updateQueue,t===null&&(t=jl(),Se.updateQueue=t),i=t.lastEffect,i===null?t.lastEffect=e.next=e:(l=i.next,i.next=e,e.next=l,t.lastEffect=e),e}function zd(){return ut().memoizedState}function Cl(e,t,i,l){var c=kt();Se.flags|=e,c.memoizedState=tr(1|t,{destroy:void 0},i,l===void 0?null:l)}function kl(e,t,i,l){var c=ut();l=l===void 0?null:l;var u=c.memoizedState.inst;Ve!==null&&l!==null&&Pc(l,Ve.memoizedState.deps)?c.memoizedState=tr(t,u,i,l):(Se.flags|=e,c.memoizedState=tr(1|t,u,i,l))}function qd(e,t){Cl(8390656,8,e,t)}function Kc(e,t){kl(2048,8,e,t)}function lb(e){Se.flags|=4;var t=Se.updateQueue;if(t===null)t=jl(),Se.updateQueue=t,t.events=[e];else{var i=t.events;i===null?t.events=[e]:i.push(e)}}function Ud(e){var t=ut().memoizedState;return lb({ref:t,nextImpl:e}),function(){if((He&2)!==0)throw Error(a(440));return t.impl.apply(void 0,arguments)}}function Bd(e,t){return kl(4,2,e,t)}function Ld(e,t){return kl(4,4,e,t)}function Hd(e,t){if(typeof t=="function"){e=e();var i=t(e);return function(){typeof i=="function"?i():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Pd(e,t,i){i=i!=null?i.concat([e]):null,kl(4,4,Hd.bind(null,t,e),i)}function Zc(){}function $d(e,t){var i=ut();t=t===void 0?null:t;var l=i.memoizedState;return t!==null&&Pc(t,l[1])?l[0]:(i.memoizedState=[e,t],e)}function Yd(e,t){var i=ut();t=t===void 0?null:t;var l=i.memoizedState;if(t!==null&&Pc(t,l[1]))return l[0];if(l=e(),vi){$t(!0);try{e()}finally{$t(!1)}}return i.memoizedState=[l,t],l}function Wc(e,t,i){return i===void 0||(Zn&1073741824)!==0&&(ke&261930)===0?e.memoizedState=t:(e.memoizedState=i,e=Gm(),Se.lanes|=e,Ms|=e,i)}function Gd(e,t,i,l){return Gt(i,t)?i:Zi.current!==null?(e=Wc(e,i,l),Gt(e,t)||(mt=!0),e):(Zn&42)===0||(Zn&1073741824)!==0&&(ke&261930)===0?(mt=!0,e.memoizedState=i):(e=Gm(),Se.lanes|=e,Ms|=e,t)}function Vd(e,t,i,l,c){var u=te.p;te.p=u!==0&&8>u?u:8;var p=$.T,b={};$.T=b,nu(e,!1,t,i);try{var O=c(),U=$.S;if(U!==null&&U(b,O),O!==null&&typeof O=="object"&&typeof O.then=="function"){var Y=nb(O,l);ta(e,t,Y,Xt(e))}else ta(e,t,l,Xt(e))}catch(I){ta(e,t,{then:function(){},status:"rejected",reason:I},Xt())}finally{te.p=u,p!==null&&b.types!==null&&(p.types=b.types),$.T=p}}function ob(){}function eu(e,t,i,l){if(e.tag!==5)throw Error(a(476));var c=Fd(e).queue;Vd(e,c,t,de,i===null?ob:function(){return Jd(e),i(l)})}function Fd(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:de,baseState:de,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wn,lastRenderedState:de},next:null};var i={};return t.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wn,lastRenderedState:i},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Jd(e){var t=Fd(e);t.next===null&&(t=e.alternate.memoizedState),ta(e,t.next.queue,{},Xt())}function tu(){return St(ba)}function Qd(){return ut().memoizedState}function Id(){return ut().memoizedState}function cb(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var i=Xt();e=Os(i);var l=js(t,e,i);l!==null&&(Ht(l,t,i),Xr(l,t,i)),t={cache:Cc()},e.payload=t;return}t=t.return}}function ub(e,t,i){var l=Xt();i={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Ml(e)?Kd(t,i):(i=xc(e,t,i,l),i!==null&&(Ht(i,e,l),Zd(i,t,l)))}function Xd(e,t,i){var l=Xt();ta(e,t,i,l)}function ta(e,t,i,l){var c={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(Ml(e))Kd(t,c);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var p=t.lastRenderedState,b=u(p,i);if(c.hasEagerState=!0,c.eagerState=b,Gt(b,p))return hl(e,t,c,0),Ie===null&&fl(),!1}catch{}finally{}if(i=xc(e,t,c,l),i!==null)return Ht(i,e,l),Zd(i,t,l),!0}return!1}function nu(e,t,i,l){if(l={lane:2,revertLane:Du(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Ml(e)){if(t)throw Error(a(479))}else t=xc(e,i,l,2),t!==null&&Ht(t,e,2)}function Ml(e){var t=e.alternate;return e===Se||t!==null&&t===Se}function Kd(e,t){Wi=Al=!0;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function Zd(e,t,i){if((i&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,i|=l,t.lanes=i,ri(e,i)}}var na={readContext:St,use:Tl,useCallback:rt,useContext:rt,useEffect:rt,useImperativeHandle:rt,useLayoutEffect:rt,useInsertionEffect:rt,useMemo:rt,useReducer:rt,useRef:rt,useState:rt,useDebugValue:rt,useDeferredValue:rt,useTransition:rt,useSyncExternalStore:rt,useId:rt,useHostTransitionStatus:rt,useFormState:rt,useActionState:rt,useOptimistic:rt,useMemoCache:rt,useCacheRefresh:rt};na.useEffectEvent=rt;var Wd={readContext:St,use:Tl,useCallback:function(e,t){return kt().memoizedState=[e,t===void 0?null:t],e},useContext:St,useEffect:qd,useImperativeHandle:function(e,t,i){i=i!=null?i.concat([e]):null,Cl(4194308,4,Hd.bind(null,t,e),i)},useLayoutEffect:function(e,t){return Cl(4194308,4,e,t)},useInsertionEffect:function(e,t){Cl(4,2,e,t)},useMemo:function(e,t){var i=kt();t=t===void 0?null:t;var l=e();if(vi){$t(!0);try{e()}finally{$t(!1)}}return i.memoizedState=[l,t],l},useReducer:function(e,t,i){var l=kt();if(i!==void 0){var c=i(t);if(vi){$t(!0);try{i(t)}finally{$t(!1)}}}else c=t;return l.memoizedState=l.baseState=c,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:c},l.queue=e,e=e.dispatch=ub.bind(null,Se,e),[l.memoizedState,e]},useRef:function(e){var t=kt();return e={current:e},t.memoizedState=e},useState:function(e){e=Ic(e);var t=e.queue,i=Xd.bind(null,Se,t);return t.dispatch=i,[e.memoizedState,i]},useDebugValue:Zc,useDeferredValue:function(e,t){var i=kt();return Wc(i,e,t)},useTransition:function(){var e=Ic(!1);return e=Vd.bind(null,Se,e.queue,!0,!1),kt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,i){var l=Se,c=kt();if(Re){if(i===void 0)throw Error(a(407));i=i()}else{if(i=t(),Ie===null)throw Error(a(349));(ke&127)!==0||vd(l,t,i)}c.memoizedState=i;var u={value:i,getSnapshot:t};return c.queue=u,qd(wd.bind(null,l,u,e),[e]),l.flags|=2048,tr(9,{destroy:void 0},_d.bind(null,l,u,i,t),null),i},useId:function(){var e=kt(),t=Ie.identifierPrefix;if(Re){var i=Mn,l=kn;i=(l&~(1<<32-Nt(l)-1)).toString(32)+i,t="_"+t+"R_"+i,i=Ol++,0<i&&(t+="H"+i.toString(32)),t+="_"}else i=sb++,t="_"+t+"r_"+i.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:tu,useFormState:kd,useActionState:kd,useOptimistic:function(e){var t=kt();t.memoizedState=t.baseState=e;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=i,t=nu.bind(null,Se,!0,i),i.dispatch=t,[e,t]},useMemoCache:Fc,useCacheRefresh:function(){return kt().memoizedState=cb.bind(null,Se)},useEffectEvent:function(e){var t=kt(),i={impl:e};return t.memoizedState=i,function(){if((He&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}},su={readContext:St,use:Tl,useCallback:$d,useContext:St,useEffect:Kc,useImperativeHandle:Pd,useInsertionEffect:Bd,useLayoutEffect:Ld,useMemo:Yd,useReducer:Nl,useRef:zd,useState:function(){return Nl(Wn)},useDebugValue:Zc,useDeferredValue:function(e,t){var i=ut();return Gd(i,Ve.memoizedState,e,t)},useTransition:function(){var e=Nl(Wn)[0],t=ut().memoizedState;return[typeof e=="boolean"?e:ea(e),t]},useSyncExternalStore:xd,useId:Qd,useHostTransitionStatus:tu,useFormState:Md,useActionState:Md,useOptimistic:function(e,t){var i=ut();return Ad(i,Ve,e,t)},useMemoCache:Fc,useCacheRefresh:Id};su.useEffectEvent=Ud;var em={readContext:St,use:Tl,useCallback:$d,useContext:St,useEffect:Kc,useImperativeHandle:Pd,useInsertionEffect:Bd,useLayoutEffect:Ld,useMemo:Yd,useReducer:Qc,useRef:zd,useState:function(){return Qc(Wn)},useDebugValue:Zc,useDeferredValue:function(e,t){var i=ut();return Ve===null?Wc(i,e,t):Gd(i,Ve.memoizedState,e,t)},useTransition:function(){var e=Qc(Wn)[0],t=ut().memoizedState;return[typeof e=="boolean"?e:ea(e),t]},useSyncExternalStore:xd,useId:Qd,useHostTransitionStatus:tu,useFormState:Dd,useActionState:Dd,useOptimistic:function(e,t){var i=ut();return Ve!==null?Ad(i,Ve,e,t):(i.baseState=e,[e,i.queue.dispatch])},useMemoCache:Fc,useCacheRefresh:Id};em.useEffectEvent=Ud;function iu(e,t,i,l){t=e.memoizedState,i=i(l,t),i=i==null?t:w({},t,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var ru={enqueueSetState:function(e,t,i){e=e._reactInternals;var l=Xt(),c=Os(l);c.payload=t,i!=null&&(c.callback=i),t=js(e,c,l),t!==null&&(Ht(t,e,l),Xr(t,e,l))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var l=Xt(),c=Os(l);c.tag=1,c.payload=t,i!=null&&(c.callback=i),t=js(e,c,l),t!==null&&(Ht(t,e,l),Xr(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=Xt(),l=Os(i);l.tag=2,t!=null&&(l.callback=t),t=js(e,l,i),t!==null&&(Ht(t,e,i),Xr(t,e,i))}};function tm(e,t,i,l,c,u,p){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,u,p):t.prototype&&t.prototype.isPureReactComponent?!$r(i,l)||!$r(c,u):!0}function nm(e,t,i,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(i,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(i,l),t.state!==e&&ru.enqueueReplaceState(t,t.state,null)}function _i(e,t){var i=t;if("ref"in t){i={};for(var l in t)l!=="ref"&&(i[l]=t[l])}if(e=e.defaultProps){i===t&&(i=w({},i));for(var c in e)i[c]===void 0&&(i[c]=e[c])}return i}function sm(e){ul(e)}function im(e){console.error(e)}function rm(e){ul(e)}function Rl(e,t){try{var i=e.onUncaughtError;i(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function am(e,t,i){try{var l=e.onCaughtError;l(i.value,{componentStack:i.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function au(e,t,i){return i=Os(i),i.tag=3,i.payload={element:null},i.callback=function(){Rl(e,t)},i}function lm(e){return e=Os(e),e.tag=3,e}function om(e,t,i,l){var c=i.type.getDerivedStateFromError;if(typeof c=="function"){var u=l.value;e.payload=function(){return c(u)},e.callback=function(){am(t,i,l)}}var p=i.stateNode;p!==null&&typeof p.componentDidCatch=="function"&&(e.callback=function(){am(t,i,l),typeof c!="function"&&(Rs===null?Rs=new Set([this]):Rs.add(this));var b=l.stack;this.componentDidCatch(l.value,{componentStack:b!==null?b:""})})}function fb(e,t,i,l,c){if(i.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=i.alternate,t!==null&&Ji(t,i,c,!0),i=Ft.current,i!==null){switch(i.tag){case 31:case 13:return dn===null?Vl():i.alternate===null&&at===0&&(at=3),i.flags&=-257,i.flags|=65536,i.lanes=c,l===vl?i.flags|=16384:(t=i.updateQueue,t===null?i.updateQueue=new Set([l]):t.add(l),ku(e,l,c)),!1;case 22:return i.flags|=65536,l===vl?i.flags|=16384:(t=i.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([l])},i.updateQueue=t):(i=t.retryQueue,i===null?t.retryQueue=new Set([l]):i.add(l)),ku(e,l,c)),!1}throw Error(a(435,i.tag))}return ku(e,l,c),Vl(),!1}if(Re)return t=Ft.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,l!==Ac&&(e=Error(a(422),{cause:l}),Vr(cn(e,i)))):(l!==Ac&&(t=Error(a(423),{cause:l}),Vr(cn(t,i))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,l=cn(l,i),c=au(e.stateNode,l,c),qc(e,c),at!==4&&(at=2)),!1;var u=Error(a(520),{cause:l});if(u=cn(u,i),ua===null?ua=[u]:ua.push(u),at!==4&&(at=2),t===null)return!0;l=cn(l,i),i=t;do{switch(i.tag){case 3:return i.flags|=65536,e=c&-c,i.lanes|=e,e=au(i.stateNode,l,e),qc(i,e),!1;case 1:if(t=i.type,u=i.stateNode,(i.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(Rs===null||!Rs.has(u))))return i.flags|=65536,c&=-c,i.lanes|=c,c=lm(c),om(c,e,i,l),qc(i,c),!1}i=i.return}while(i!==null);return!1}var lu=Error(a(461)),mt=!1;function Et(e,t,i,l){t.child=e===null?hd(t,null,i,l):xi(t,e.child,i,l)}function cm(e,t,i,l,c){i=i.render;var u=t.ref;if("ref"in l){var p={};for(var b in l)b!=="ref"&&(p[b]=l[b])}else p=l;return pi(t),l=$c(e,t,i,p,u,c),b=Yc(),e!==null&&!mt?(Gc(e,t,c),es(e,t,c)):(Re&&b&&Sc(t),t.flags|=1,Et(e,t,l,c),t.child)}function um(e,t,i,l,c){if(e===null){var u=i.type;return typeof u=="function"&&!vc(u)&&u.defaultProps===void 0&&i.compare===null?(t.tag=15,t.type=u,fm(e,t,u,l,c)):(e=ml(i.type,null,l,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!pu(e,c)){var p=u.memoizedProps;if(i=i.compare,i=i!==null?i:$r,i(p,l)&&e.ref===t.ref)return es(e,t,c)}return t.flags|=1,e=Qn(u,l),e.ref=t.ref,e.return=t,t.child=e}function fm(e,t,i,l,c){if(e!==null){var u=e.memoizedProps;if($r(u,l)&&e.ref===t.ref)if(mt=!1,t.pendingProps=l=u,pu(e,c))(e.flags&131072)!==0&&(mt=!0);else return t.lanes=e.lanes,es(e,t,c)}return ou(e,t,i,l,c)}function hm(e,t,i,l){var c=l.children,u=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((t.flags&128)!==0){if(u=u!==null?u.baseLanes|i:i,e!==null){for(l=t.child=e.child,c=0;l!==null;)c=c|l.lanes|l.childLanes,l=l.sibling;l=c&~u}else l=0,t.child=null;return dm(e,t,u,i,l)}if((i&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&bl(t,u!==null?u.cachePool:null),u!==null?pd(t,u):Bc(),gd(t);else return l=t.lanes=536870912,dm(e,t,u!==null?u.baseLanes|i:i,i,l)}else u!==null?(bl(t,u.cachePool),pd(t,u),Ns(),t.memoizedState=null):(e!==null&&bl(t,null),Bc(),Ns());return Et(e,t,c,i),t.child}function sa(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function dm(e,t,i,l,c){var u=Mc();return u=u===null?null:{parent:ht._currentValue,pool:u},t.memoizedState={baseLanes:i,cachePool:u},e!==null&&bl(t,null),Bc(),gd(t),e!==null&&Ji(e,t,l,!0),t.childLanes=c,null}function Dl(e,t){return t=ql({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function mm(e,t,i){return xi(t,e.child,null,i),e=Dl(t,t.pendingProps),e.flags|=2,Jt(t),t.memoizedState=null,e}function hb(e,t,i){var l=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Re){if(l.mode==="hidden")return e=Dl(t,l),t.lanes=536870912,sa(null,e);if(Hc(t),(e=Ze)?(e=Op(e,hn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:_s!==null?{id:kn,overflow:Mn}:null,retryLane:536870912,hydrationErrors:null},i=Kh(e),i.return=t,t.child=i,wt=t,Ze=null)):e=null,e===null)throw Ss(t);return t.lanes=536870912,null}return Dl(t,l)}var u=e.memoizedState;if(u!==null){var p=u.dehydrated;if(Hc(t),c)if(t.flags&256)t.flags&=-257,t=mm(e,t,i);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(a(558));else if(mt||Ji(e,t,i,!1),c=(i&e.childLanes)!==0,mt||c){if(l=Ie,l!==null&&(p=xs(l,i),p!==0&&p!==u.retryLane))throw u.retryLane=p,fi(e,p),Ht(l,e,p),lu;Vl(),t=mm(e,t,i)}else e=u.treeContext,Ze=mn(p.nextSibling),wt=t,Re=!0,ws=null,hn=!1,e!==null&&ed(t,e),t=Dl(t,l),t.flags|=4096;return t}return e=Qn(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function zl(e,t){var i=t.ref;if(i===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(a(284));(e===null||e.ref!==i)&&(t.flags|=4194816)}}function ou(e,t,i,l,c){return pi(t),i=$c(e,t,i,l,void 0,c),l=Yc(),e!==null&&!mt?(Gc(e,t,c),es(e,t,c)):(Re&&l&&Sc(t),t.flags|=1,Et(e,t,i,c),t.child)}function pm(e,t,i,l,c,u){return pi(t),t.updateQueue=null,i=bd(t,l,i,c),yd(e),l=Yc(),e!==null&&!mt?(Gc(e,t,u),es(e,t,u)):(Re&&l&&Sc(t),t.flags|=1,Et(e,t,i,u),t.child)}function gm(e,t,i,l,c){if(pi(t),t.stateNode===null){var u=Yi,p=i.contextType;typeof p=="object"&&p!==null&&(u=St(p)),u=new i(l,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=ru,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=l,u.state=t.memoizedState,u.refs={},Dc(t),p=i.contextType,u.context=typeof p=="object"&&p!==null?St(p):Yi,u.state=t.memoizedState,p=i.getDerivedStateFromProps,typeof p=="function"&&(iu(t,i,p,l),u.state=t.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(p=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),p!==u.state&&ru.enqueueReplaceState(u,u.state,null),Zr(t,l,u,c),Kr(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){u=t.stateNode;var b=t.memoizedProps,O=_i(i,b);u.props=O;var U=u.context,Y=i.contextType;p=Yi,typeof Y=="object"&&Y!==null&&(p=St(Y));var I=i.getDerivedStateFromProps;Y=typeof I=="function"||typeof u.getSnapshotBeforeUpdate=="function",b=t.pendingProps!==b,Y||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(b||U!==p)&&nm(t,u,l,p),As=!1;var L=t.memoizedState;u.state=L,Zr(t,l,u,c),Kr(),U=t.memoizedState,b||L!==U||As?(typeof I=="function"&&(iu(t,i,I,l),U=t.memoizedState),(O=As||tm(t,i,O,l,L,U,p))?(Y||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=U),u.props=l,u.state=U,u.context=p,l=O):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{u=t.stateNode,zc(e,t),p=t.memoizedProps,Y=_i(i,p),u.props=Y,I=t.pendingProps,L=u.context,U=i.contextType,O=Yi,typeof U=="object"&&U!==null&&(O=St(U)),b=i.getDerivedStateFromProps,(U=typeof b=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(p!==I||L!==O)&&nm(t,u,l,O),As=!1,L=t.memoizedState,u.state=L,Zr(t,l,u,c),Kr();var P=t.memoizedState;p!==I||L!==P||As||e!==null&&e.dependencies!==null&&gl(e.dependencies)?(typeof b=="function"&&(iu(t,i,b,l),P=t.memoizedState),(Y=As||tm(t,i,Y,l,L,P,O)||e!==null&&e.dependencies!==null&&gl(e.dependencies))?(U||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(l,P,O),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(l,P,O)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=P),u.props=l,u.state=P,u.context=O,l=Y):(typeof u.componentDidUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),l=!1)}return u=l,zl(e,t),l=(t.flags&128)!==0,u||l?(u=t.stateNode,i=l&&typeof i.getDerivedStateFromError!="function"?null:u.render(),t.flags|=1,e!==null&&l?(t.child=xi(t,e.child,null,c),t.child=xi(t,null,i,c)):Et(e,t,i,c),t.memoizedState=u.state,e=t.child):e=es(e,t,c),e}function ym(e,t,i,l){return di(),t.flags|=256,Et(e,t,i,l),t.child}var cu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function uu(e){return{baseLanes:e,cachePool:ad()}}function fu(e,t,i){return e=e!==null?e.childLanes&~i:0,t&&(e|=It),e}function bm(e,t,i){var l=t.pendingProps,c=!1,u=(t.flags&128)!==0,p;if((p=u)||(p=e!==null&&e.memoizedState===null?!1:(ct.current&2)!==0),p&&(c=!0,t.flags&=-129),p=(t.flags&32)!==0,t.flags&=-33,e===null){if(Re){if(c?Ts(t):Ns(),(e=Ze)?(e=Op(e,hn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:_s!==null?{id:kn,overflow:Mn}:null,retryLane:536870912,hydrationErrors:null},i=Kh(e),i.return=t,t.child=i,wt=t,Ze=null)):e=null,e===null)throw Ss(t);return Ju(e)?t.lanes=32:t.lanes=536870912,null}var b=l.children;return l=l.fallback,c?(Ns(),c=t.mode,b=ql({mode:"hidden",children:b},c),l=hi(l,c,i,null),b.return=t,l.return=t,b.sibling=l,t.child=b,l=t.child,l.memoizedState=uu(i),l.childLanes=fu(e,p,i),t.memoizedState=cu,sa(null,l)):(Ts(t),hu(t,b))}var O=e.memoizedState;if(O!==null&&(b=O.dehydrated,b!==null)){if(u)t.flags&256?(Ts(t),t.flags&=-257,t=du(e,t,i)):t.memoizedState!==null?(Ns(),t.child=e.child,t.flags|=128,t=null):(Ns(),b=l.fallback,c=t.mode,l=ql({mode:"visible",children:l.children},c),b=hi(b,c,i,null),b.flags|=2,l.return=t,b.return=t,l.sibling=b,t.child=l,xi(t,e.child,null,i),l=t.child,l.memoizedState=uu(i),l.childLanes=fu(e,p,i),t.memoizedState=cu,t=sa(null,l));else if(Ts(t),Ju(b)){if(p=b.nextSibling&&b.nextSibling.dataset,p)var U=p.dgst;p=U,l=Error(a(419)),l.stack="",l.digest=p,Vr({value:l,source:null,stack:null}),t=du(e,t,i)}else if(mt||Ji(e,t,i,!1),p=(i&e.childLanes)!==0,mt||p){if(p=Ie,p!==null&&(l=xs(p,i),l!==0&&l!==O.retryLane))throw O.retryLane=l,fi(e,l),Ht(p,e,l),lu;Fu(b)||Vl(),t=du(e,t,i)}else Fu(b)?(t.flags|=192,t.child=e.child,t=null):(e=O.treeContext,Ze=mn(b.nextSibling),wt=t,Re=!0,ws=null,hn=!1,e!==null&&ed(t,e),t=hu(t,l.children),t.flags|=4096);return t}return c?(Ns(),b=l.fallback,c=t.mode,O=e.child,U=O.sibling,l=Qn(O,{mode:"hidden",children:l.children}),l.subtreeFlags=O.subtreeFlags&65011712,U!==null?b=Qn(U,b):(b=hi(b,c,i,null),b.flags|=2),b.return=t,l.return=t,l.sibling=b,t.child=l,sa(null,l),l=t.child,b=e.child.memoizedState,b===null?b=uu(i):(c=b.cachePool,c!==null?(O=ht._currentValue,c=c.parent!==O?{parent:O,pool:O}:c):c=ad(),b={baseLanes:b.baseLanes|i,cachePool:c}),l.memoizedState=b,l.childLanes=fu(e,p,i),t.memoizedState=cu,sa(e.child,l)):(Ts(t),i=e.child,e=i.sibling,i=Qn(i,{mode:"visible",children:l.children}),i.return=t,i.sibling=null,e!==null&&(p=t.deletions,p===null?(t.deletions=[e],t.flags|=16):p.push(e)),t.child=i,t.memoizedState=null,i)}function hu(e,t){return t=ql({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function ql(e,t){return e=Vt(22,e,null,t),e.lanes=0,e}function du(e,t,i){return xi(t,e.child,null,i),e=hu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function xm(e,t,i){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),Tc(e.return,t,i)}function mu(e,t,i,l,c,u){var p=e.memoizedState;p===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:i,tailMode:c,treeForkCount:u}:(p.isBackwards=t,p.rendering=null,p.renderingStartTime=0,p.last=l,p.tail=i,p.tailMode=c,p.treeForkCount=u)}function vm(e,t,i){var l=t.pendingProps,c=l.revealOrder,u=l.tail;l=l.children;var p=ct.current,b=(p&2)!==0;if(b?(p=p&1|2,t.flags|=128):p&=1,Te(ct,p),Et(e,t,l,i),l=Re?Gr:0,!b&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&xm(e,i,t);else if(e.tag===19)xm(e,i,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(c){case"forwards":for(i=t.child,c=null;i!==null;)e=i.alternate,e!==null&&El(e)===null&&(c=i),i=i.sibling;i=c,i===null?(c=t.child,t.child=null):(c=i.sibling,i.sibling=null),mu(t,!1,c,i,u,l);break;case"backwards":case"unstable_legacy-backwards":for(i=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&El(e)===null){t.child=c;break}e=c.sibling,c.sibling=i,i=c,c=e}mu(t,!0,i,null,u,l);break;case"together":mu(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function es(e,t,i){if(e!==null&&(t.dependencies=e.dependencies),Ms|=t.lanes,(i&t.childLanes)===0)if(e!==null){if(Ji(e,t,i,!1),(i&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(a(153));if(t.child!==null){for(e=t.child,i=Qn(e,e.pendingProps),t.child=i,i.return=t;e.sibling!==null;)e=e.sibling,i=i.sibling=Qn(e,e.pendingProps),i.return=t;i.sibling=null}return t.child}function pu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&gl(e)))}function db(e,t,i){switch(t.tag){case 3:jt(t,t.stateNode.containerInfo),Es(t,ht,e.memoizedState.cache),di();break;case 27:case 5:Tt(t);break;case 4:jt(t,t.stateNode.containerInfo);break;case 10:Es(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Hc(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(Ts(t),t.flags|=128,null):(i&t.child.childLanes)!==0?bm(e,t,i):(Ts(t),e=es(e,t,i),e!==null?e.sibling:null);Ts(t);break;case 19:var c=(e.flags&128)!==0;if(l=(i&t.childLanes)!==0,l||(Ji(e,t,i,!1),l=(i&t.childLanes)!==0),c){if(l)return vm(e,t,i);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),Te(ct,ct.current),l)break;return null;case 22:return t.lanes=0,hm(e,t,i,t.pendingProps);case 24:Es(t,ht,e.memoizedState.cache)}return es(e,t,i)}function _m(e,t,i){if(e!==null)if(e.memoizedProps!==t.pendingProps)mt=!0;else{if(!pu(e,i)&&(t.flags&128)===0)return mt=!1,db(e,t,i);mt=(e.flags&131072)!==0}else mt=!1,Re&&(t.flags&1048576)!==0&&Wh(t,Gr,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=yi(t.elementType),t.type=e,typeof e=="function")vc(e)?(l=_i(e,l),t.tag=1,t=gm(null,t,e,l,i)):(t.tag=0,t=ou(null,t,e,l,i));else{if(e!=null){var c=e.$$typeof;if(c===ae){t.tag=11,t=cm(null,t,e,l,i);break e}else if(c===se){t.tag=14,t=um(null,t,e,l,i);break e}}throw t=Ge(e)||e,Error(a(306,t,""))}}return t;case 0:return ou(e,t,t.type,t.pendingProps,i);case 1:return l=t.type,c=_i(l,t.pendingProps),gm(e,t,l,c,i);case 3:e:{if(jt(t,t.stateNode.containerInfo),e===null)throw Error(a(387));l=t.pendingProps;var u=t.memoizedState;c=u.element,zc(e,t),Zr(t,l,null,i);var p=t.memoizedState;if(l=p.cache,Es(t,ht,l),l!==u.cache&&Nc(t,[ht],i,!0),Kr(),l=p.element,u.isDehydrated)if(u={element:l,isDehydrated:!1,cache:p.cache},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){t=ym(e,t,l,i);break e}else if(l!==c){c=cn(Error(a(424)),t),Vr(c),t=ym(e,t,l,i);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Ze=mn(e.firstChild),wt=t,Re=!0,ws=null,hn=!0,i=hd(t,null,l,i),t.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(di(),l===c){t=es(e,t,i);break e}Et(e,t,l,i)}t=t.child}return t;case 26:return zl(e,t),e===null?(i=Mp(t.type,null,t.pendingProps,null))?t.memoizedState=i:Re||(i=t.type,e=t.pendingProps,l=Zl(sn.current).createElement(i),l[Qe]=t,l[it]=e,At(l,i,e),N(l),t.stateNode=l):t.memoizedState=Mp(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Tt(t),e===null&&Re&&(l=t.stateNode=Np(t.type,t.pendingProps,sn.current),wt=t,hn=!0,c=Ze,Us(t.type)?(Qu=c,Ze=mn(l.firstChild)):Ze=c),Et(e,t,t.pendingProps.children,i),zl(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Re&&((c=l=Ze)&&(l=Yb(l,t.type,t.pendingProps,hn),l!==null?(t.stateNode=l,wt=t,Ze=mn(l.firstChild),hn=!1,c=!0):c=!1),c||Ss(t)),Tt(t),c=t.type,u=t.pendingProps,p=e!==null?e.memoizedProps:null,l=u.children,Yu(c,u)?l=null:p!==null&&Yu(c,p)&&(t.flags|=32),t.memoizedState!==null&&(c=$c(e,t,ib,null,null,i),ba._currentValue=c),zl(e,t),Et(e,t,l,i),t.child;case 6:return e===null&&Re&&((e=i=Ze)&&(i=Gb(i,t.pendingProps,hn),i!==null?(t.stateNode=i,wt=t,Ze=null,e=!0):e=!1),e||Ss(t)),null;case 13:return bm(e,t,i);case 4:return jt(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=xi(t,null,l,i):Et(e,t,l,i),t.child;case 11:return cm(e,t,t.type,t.pendingProps,i);case 7:return Et(e,t,t.pendingProps,i),t.child;case 8:return Et(e,t,t.pendingProps.children,i),t.child;case 12:return Et(e,t,t.pendingProps.children,i),t.child;case 10:return l=t.pendingProps,Es(t,t.type,l.value),Et(e,t,l.children,i),t.child;case 9:return c=t.type._context,l=t.pendingProps.children,pi(t),c=St(c),l=l(c),t.flags|=1,Et(e,t,l,i),t.child;case 14:return um(e,t,t.type,t.pendingProps,i);case 15:return fm(e,t,t.type,t.pendingProps,i);case 19:return vm(e,t,i);case 31:return hb(e,t,i);case 22:return hm(e,t,i,t.pendingProps);case 24:return pi(t),l=St(ht),e===null?(c=Mc(),c===null&&(c=Ie,u=Cc(),c.pooledCache=u,u.refCount++,u!==null&&(c.pooledCacheLanes|=i),c=u),t.memoizedState={parent:l,cache:c},Dc(t),Es(t,ht,c)):((e.lanes&i)!==0&&(zc(e,t),Zr(t,null,null,i),Kr()),c=e.memoizedState,u=t.memoizedState,c.parent!==l?(c={parent:l,cache:l},t.memoizedState=c,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=c),Es(t,ht,l)):(l=u.cache,Es(t,ht,l),l!==c.cache&&Nc(t,[ht],i,!0))),Et(e,t,t.pendingProps.children,i),t.child;case 29:throw t.pendingProps}throw Error(a(156,t.tag))}function ts(e){e.flags|=4}function gu(e,t,i,l,c){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(c&335544128)===c)if(e.stateNode.complete)e.flags|=8192;else if(Qm())e.flags|=8192;else throw bi=vl,Rc}else e.flags&=-16777217}function wm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Up(t))if(Qm())e.flags|=8192;else throw bi=vl,Rc}function Ul(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Ri():536870912,e.lanes|=t,rr|=t)}function ia(e,t){if(!Re)switch(e.tailMode){case"hidden":t=e.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var l=null;i!==null;)i.alternate!==null&&(l=i),i=i.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function We(e){var t=e.alternate!==null&&e.alternate.child===e.child,i=0,l=0;if(t)for(var c=e.child;c!==null;)i|=c.lanes|c.childLanes,l|=c.subtreeFlags&65011712,l|=c.flags&65011712,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)i|=c.lanes|c.childLanes,l|=c.subtreeFlags,l|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=l,e.childLanes=i,t}function mb(e,t,i){var l=t.pendingProps;switch(Ec(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return We(t),null;case 1:return We(t),null;case 3:return i=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),Kn(ht),we(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Fi(t)?ts(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Oc())),We(t),null;case 26:var c=t.type,u=t.memoizedState;return e===null?(ts(t),u!==null?(We(t),wm(t,u)):(We(t),gu(t,c,null,l,i))):u?u!==e.memoizedState?(ts(t),We(t),wm(t,u)):(We(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&ts(t),We(t),gu(t,c,e,l,i)),null;case 27:if(ei(t),i=sn.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&ts(t);else{if(!l){if(t.stateNode===null)throw Error(a(166));return We(t),null}e=lt.current,Fi(t)?td(t):(e=Np(c,l,i),t.stateNode=e,ts(t))}return We(t),null;case 5:if(ei(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&ts(t);else{if(!l){if(t.stateNode===null)throw Error(a(166));return We(t),null}if(u=lt.current,Fi(t))td(t);else{var p=Zl(sn.current);switch(u){case 1:u=p.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:u=p.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":u=p.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":u=p.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":u=p.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof l.is=="string"?p.createElement("select",{is:l.is}):p.createElement("select"),l.multiple?u.multiple=!0:l.size&&(u.size=l.size);break;default:u=typeof l.is=="string"?p.createElement(c,{is:l.is}):p.createElement(c)}}u[Qe]=t,u[it]=l;e:for(p=t.child;p!==null;){if(p.tag===5||p.tag===6)u.appendChild(p.stateNode);else if(p.tag!==4&&p.tag!==27&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===t)break e;for(;p.sibling===null;){if(p.return===null||p.return===t)break e;p=p.return}p.sibling.return=p.return,p=p.sibling}t.stateNode=u;e:switch(At(u,c,l),c){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&ts(t)}}return We(t),gu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,i),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&ts(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(a(166));if(e=sn.current,Fi(t)){if(e=t.stateNode,i=t.memoizedProps,l=null,c=wt,c!==null)switch(c.tag){case 27:case 5:l=c.memoizedProps}e[Qe]=t,e=!!(e.nodeValue===i||l!==null&&l.suppressHydrationWarning===!0||bp(e.nodeValue,i)),e||Ss(t,!0)}else e=Zl(e).createTextNode(l),e[Qe]=t,t.stateNode=e}return We(t),null;case 31:if(i=t.memoizedState,e===null||e.memoizedState!==null){if(l=Fi(t),i!==null){if(e===null){if(!l)throw Error(a(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(557));e[Qe]=t}else di(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),e=!1}else i=Oc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),e=!0;if(!e)return t.flags&256?(Jt(t),t):(Jt(t),null);if((t.flags&128)!==0)throw Error(a(558))}return We(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=Fi(t),l!==null&&l.dehydrated!==null){if(e===null){if(!c)throw Error(a(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(a(317));c[Qe]=t}else di(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),c=!1}else c=Oc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(Jt(t),t):(Jt(t),null)}return Jt(t),(t.flags&128)!==0?(t.lanes=i,t):(i=l!==null,e=e!==null&&e.memoizedState!==null,i&&(l=t.child,c=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(c=l.alternate.memoizedState.cachePool.pool),u=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(u=l.memoizedState.cachePool.pool),u!==c&&(l.flags|=2048)),i!==e&&i&&(t.child.flags|=8192),Ul(t,t.updateQueue),We(t),null);case 4:return we(),e===null&&Bu(t.stateNode.containerInfo),We(t),null;case 10:return Kn(t.type),We(t),null;case 19:if(_e(ct),l=t.memoizedState,l===null)return We(t),null;if(c=(t.flags&128)!==0,u=l.rendering,u===null)if(c)ia(l,!1);else{if(at!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=El(e),u!==null){for(t.flags|=128,ia(l,!1),e=u.updateQueue,t.updateQueue=e,Ul(t,e),t.subtreeFlags=0,e=i,i=t.child;i!==null;)Xh(i,e),i=i.sibling;return Te(ct,ct.current&1|2),Re&&In(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&et()>$l&&(t.flags|=128,c=!0,ia(l,!1),t.lanes=4194304)}else{if(!c)if(e=El(u),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,Ul(t,e),ia(l,!0),l.tail===null&&l.tailMode==="hidden"&&!u.alternate&&!Re)return We(t),null}else 2*et()-l.renderingStartTime>$l&&i!==536870912&&(t.flags|=128,c=!0,ia(l,!1),t.lanes=4194304);l.isBackwards?(u.sibling=t.child,t.child=u):(e=l.last,e!==null?e.sibling=u:t.child=u,l.last=u)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=et(),e.sibling=null,i=ct.current,Te(ct,c?i&1|2:i&1),Re&&In(t,l.treeForkCount),e):(We(t),null);case 22:case 23:return Jt(t),Lc(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(i&536870912)!==0&&(t.flags&128)===0&&(We(t),t.subtreeFlags&6&&(t.flags|=8192)):We(t),i=t.updateQueue,i!==null&&Ul(t,i.retryQueue),i=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==i&&(t.flags|=2048),e!==null&&_e(gi),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),Kn(ht),We(t),null;case 25:return null;case 30:return null}throw Error(a(156,t.tag))}function pb(e,t){switch(Ec(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Kn(ht),we(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ei(t),null;case 31:if(t.memoizedState!==null){if(Jt(t),t.alternate===null)throw Error(a(340));di()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Jt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));di()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return _e(ct),null;case 4:return we(),null;case 10:return Kn(t.type),null;case 22:case 23:return Jt(t),Lc(),e!==null&&_e(gi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Kn(ht),null;case 25:return null;default:return null}}function Sm(e,t){switch(Ec(t),t.tag){case 3:Kn(ht),we();break;case 26:case 27:case 5:ei(t);break;case 4:we();break;case 31:t.memoizedState!==null&&Jt(t);break;case 13:Jt(t);break;case 19:_e(ct);break;case 10:Kn(t.type);break;case 22:case 23:Jt(t),Lc(),e!==null&&_e(gi);break;case 24:Kn(ht)}}function ra(e,t){try{var i=t.updateQueue,l=i!==null?i.lastEffect:null;if(l!==null){var c=l.next;i=c;do{if((i.tag&e)===e){l=void 0;var u=i.create,p=i.inst;l=u(),p.destroy=l}i=i.next}while(i!==c)}}catch(b){$e(t,t.return,b)}}function Cs(e,t,i){try{var l=t.updateQueue,c=l!==null?l.lastEffect:null;if(c!==null){var u=c.next;l=u;do{if((l.tag&e)===e){var p=l.inst,b=p.destroy;if(b!==void 0){p.destroy=void 0,c=t;var O=i,U=b;try{U()}catch(Y){$e(c,O,Y)}}}l=l.next}while(l!==u)}}catch(Y){$e(t,t.return,Y)}}function Em(e){var t=e.updateQueue;if(t!==null){var i=e.stateNode;try{md(t,i)}catch(l){$e(e,e.return,l)}}}function Am(e,t,i){i.props=_i(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(l){$e(e,t,l)}}function aa(e,t){try{var i=e.ref;if(i!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof i=="function"?e.refCleanup=i(l):i.current=l}}catch(c){$e(e,t,c)}}function Rn(e,t){var i=e.ref,l=e.refCleanup;if(i!==null)if(typeof l=="function")try{l()}catch(c){$e(e,t,c)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(c){$e(e,t,c)}else i.current=null}function Om(e){var t=e.type,i=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":i.autoFocus&&l.focus();break e;case"img":i.src?l.src=i.src:i.srcSet&&(l.srcset=i.srcSet)}}catch(c){$e(e,e.return,c)}}function yu(e,t,i){try{var l=e.stateNode;Ub(l,e.type,i,t),l[it]=t}catch(c){$e(e,e.return,c)}}function jm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Us(e.type)||e.tag===4}function bu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||jm(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&&Us(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 xu(e,t,i){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(e,t):(t=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,t.appendChild(e),i=i._reactRootContainer,i!=null||t.onclick!==null||(t.onclick=Fn));else if(l!==4&&(l===27&&Us(e.type)&&(i=e.stateNode,t=null),e=e.child,e!==null))for(xu(e,t,i),e=e.sibling;e!==null;)xu(e,t,i),e=e.sibling}function Bl(e,t,i){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?i.insertBefore(e,t):i.appendChild(e);else if(l!==4&&(l===27&&Us(e.type)&&(i=e.stateNode),e=e.child,e!==null))for(Bl(e,t,i),e=e.sibling;e!==null;)Bl(e,t,i),e=e.sibling}function Tm(e){var t=e.stateNode,i=e.memoizedProps;try{for(var l=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);At(t,l,i),t[Qe]=e,t[it]=i}catch(u){$e(e,e.return,u)}}var ns=!1,pt=!1,vu=!1,Nm=typeof WeakSet=="function"?WeakSet:Set,xt=null;function gb(e,t){if(e=e.containerInfo,Pu=ro,e=Ph(e),dc(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var l=i.getSelection&&i.getSelection();if(l&&l.rangeCount!==0){i=l.anchorNode;var c=l.anchorOffset,u=l.focusNode;l=l.focusOffset;try{i.nodeType,u.nodeType}catch{i=null;break e}var p=0,b=-1,O=-1,U=0,Y=0,I=e,L=null;t:for(;;){for(var P;I!==i||c!==0&&I.nodeType!==3||(b=p+c),I!==u||l!==0&&I.nodeType!==3||(O=p+l),I.nodeType===3&&(p+=I.nodeValue.length),(P=I.firstChild)!==null;)L=I,I=P;for(;;){if(I===e)break t;if(L===i&&++U===c&&(b=p),L===u&&++Y===l&&(O=p),(P=I.nextSibling)!==null)break;I=L,L=I.parentNode}I=P}i=b===-1||O===-1?null:{start:b,end:O}}else i=null}i=i||{start:0,end:0}}else i=null;for($u={focusedElem:e,selectionRange:i},ro=!1,xt=t;xt!==null;)if(t=xt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,xt=e;else for(;xt!==null;){switch(t=xt,u=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(i=0;i<e.length;i++)c=e[i],c.ref.impl=c.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&u!==null){e=void 0,i=t,c=u.memoizedProps,u=u.memoizedState,l=i.stateNode;try{var he=_i(i.type,c);e=l.getSnapshotBeforeUpdate(he,u),l.__reactInternalSnapshotBeforeUpdate=e}catch(ye){$e(i,i.return,ye)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,i=e.nodeType,i===9)Vu(e);else if(i===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Vu(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(a(163))}if(e=t.sibling,e!==null){e.return=t.return,xt=e;break}xt=t.return}}function Cm(e,t,i){var l=i.flags;switch(i.tag){case 0:case 11:case 15:is(e,i),l&4&&ra(5,i);break;case 1:if(is(e,i),l&4)if(e=i.stateNode,t===null)try{e.componentDidMount()}catch(p){$e(i,i.return,p)}else{var c=_i(i.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(p){$e(i,i.return,p)}}l&64&&Em(i),l&512&&aa(i,i.return);break;case 3:if(is(e,i),l&64&&(e=i.updateQueue,e!==null)){if(t=null,i.child!==null)switch(i.child.tag){case 27:case 5:t=i.child.stateNode;break;case 1:t=i.child.stateNode}try{md(e,t)}catch(p){$e(i,i.return,p)}}break;case 27:t===null&&l&4&&Tm(i);case 26:case 5:is(e,i),t===null&&l&4&&Om(i),l&512&&aa(i,i.return);break;case 12:is(e,i);break;case 31:is(e,i),l&4&&Rm(e,i);break;case 13:is(e,i),l&4&&Dm(e,i),l&64&&(e=i.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(i=Ab.bind(null,i),Vb(e,i))));break;case 22:if(l=i.memoizedState!==null||ns,!l){t=t!==null&&t.memoizedState!==null||pt,c=ns;var u=pt;ns=l,(pt=t)&&!u?rs(e,i,(i.subtreeFlags&8772)!==0):is(e,i),ns=c,pt=u}break;case 30:break;default:is(e,i)}}function km(e){var t=e.alternate;t!==null&&(e.alternate=null,km(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Di(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var tt=null,qt=!1;function ss(e,t,i){for(i=i.child;i!==null;)Mm(e,t,i),i=i.sibling}function Mm(e,t,i){if(ot&&typeof ot.onCommitFiberUnmount=="function")try{ot.onCommitFiberUnmount(ni,i)}catch{}switch(i.tag){case 26:pt||Rn(i,t),ss(e,t,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:pt||Rn(i,t);var l=tt,c=qt;Us(i.type)&&(tt=i.stateNode,qt=!1),ss(e,t,i),pa(i.stateNode),tt=l,qt=c;break;case 5:pt||Rn(i,t);case 6:if(l=tt,c=qt,tt=null,ss(e,t,i),tt=l,qt=c,tt!==null)if(qt)try{(tt.nodeType===9?tt.body:tt.nodeName==="HTML"?tt.ownerDocument.body:tt).removeChild(i.stateNode)}catch(u){$e(i,t,u)}else try{tt.removeChild(i.stateNode)}catch(u){$e(i,t,u)}break;case 18:tt!==null&&(qt?(e=tt,Ep(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,i.stateNode),dr(e)):Ep(tt,i.stateNode));break;case 4:l=tt,c=qt,tt=i.stateNode.containerInfo,qt=!0,ss(e,t,i),tt=l,qt=c;break;case 0:case 11:case 14:case 15:Cs(2,i,t),pt||Cs(4,i,t),ss(e,t,i);break;case 1:pt||(Rn(i,t),l=i.stateNode,typeof l.componentWillUnmount=="function"&&Am(i,t,l)),ss(e,t,i);break;case 21:ss(e,t,i);break;case 22:pt=(l=pt)||i.memoizedState!==null,ss(e,t,i),pt=l;break;default:ss(e,t,i)}}function Rm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{dr(e)}catch(i){$e(t,t.return,i)}}}function Dm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{dr(e)}catch(i){$e(t,t.return,i)}}function yb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Nm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Nm),t;default:throw Error(a(435,e.tag))}}function Ll(e,t){var i=yb(e);t.forEach(function(l){if(!i.has(l)){i.add(l);var c=Ob.bind(null,e,l);l.then(c,c)}})}function Ut(e,t){var i=t.deletions;if(i!==null)for(var l=0;l<i.length;l++){var c=i[l],u=e,p=t,b=p;e:for(;b!==null;){switch(b.tag){case 27:if(Us(b.type)){tt=b.stateNode,qt=!1;break e}break;case 5:tt=b.stateNode,qt=!1;break e;case 3:case 4:tt=b.stateNode.containerInfo,qt=!0;break e}b=b.return}if(tt===null)throw Error(a(160));Mm(u,p,c),tt=null,qt=!1,u=c.alternate,u!==null&&(u.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)zm(t,e),t=t.sibling}var Sn=null;function zm(e,t){var i=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ut(t,e),Bt(e),l&4&&(Cs(3,e,e.return),ra(3,e),Cs(5,e,e.return));break;case 1:Ut(t,e),Bt(e),l&512&&(pt||i===null||Rn(i,i.return)),l&64&&ns&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(i=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=i===null?l:i.concat(l))));break;case 26:var c=Sn;if(Ut(t,e),Bt(e),l&512&&(pt||i===null||Rn(i,i.return)),l&4){var u=i!==null?i.memoizedState:null;if(l=e.memoizedState,i===null)if(l===null)if(e.stateNode===null){e:{l=e.type,i=e.memoizedProps,c=c.ownerDocument||c;t:switch(l){case"title":u=c.getElementsByTagName("title")[0],(!u||u[yt]||u[Qe]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=c.createElement(l),c.head.insertBefore(u,c.querySelector("head > title"))),At(u,l,i),u[Qe]=e,N(u),l=u;break e;case"link":var p=zp("link","href",c).get(l+(i.href||""));if(p){for(var b=0;b<p.length;b++)if(u=p[b],u.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&u.getAttribute("rel")===(i.rel==null?null:i.rel)&&u.getAttribute("title")===(i.title==null?null:i.title)&&u.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){p.splice(b,1);break t}}u=c.createElement(l),At(u,l,i),c.head.appendChild(u);break;case"meta":if(p=zp("meta","content",c).get(l+(i.content||""))){for(b=0;b<p.length;b++)if(u=p[b],u.getAttribute("content")===(i.content==null?null:""+i.content)&&u.getAttribute("name")===(i.name==null?null:i.name)&&u.getAttribute("property")===(i.property==null?null:i.property)&&u.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&u.getAttribute("charset")===(i.charSet==null?null:i.charSet)){p.splice(b,1);break t}}u=c.createElement(l),At(u,l,i),c.head.appendChild(u);break;default:throw Error(a(468,l))}u[Qe]=e,N(u),l=u}e.stateNode=l}else qp(c,e.type,e.stateNode);else e.stateNode=Dp(c,l,e.memoizedProps);else u!==l?(u===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):u.count--,l===null?qp(c,e.type,e.stateNode):Dp(c,l,e.memoizedProps)):l===null&&e.stateNode!==null&&yu(e,e.memoizedProps,i.memoizedProps)}break;case 27:Ut(t,e),Bt(e),l&512&&(pt||i===null||Rn(i,i.return)),i!==null&&l&4&&yu(e,e.memoizedProps,i.memoizedProps);break;case 5:if(Ut(t,e),Bt(e),l&512&&(pt||i===null||Rn(i,i.return)),e.flags&32){c=e.stateNode;try{qi(c,"")}catch(he){$e(e,e.return,he)}}l&4&&e.stateNode!=null&&(c=e.memoizedProps,yu(e,c,i!==null?i.memoizedProps:c)),l&1024&&(vu=!0);break;case 6:if(Ut(t,e),Bt(e),l&4){if(e.stateNode===null)throw Error(a(162));l=e.memoizedProps,i=e.stateNode;try{i.nodeValue=l}catch(he){$e(e,e.return,he)}}break;case 3:if(to=null,c=Sn,Sn=Wl(t.containerInfo),Ut(t,e),Sn=c,Bt(e),l&4&&i!==null&&i.memoizedState.isDehydrated)try{dr(t.containerInfo)}catch(he){$e(e,e.return,he)}vu&&(vu=!1,qm(e));break;case 4:l=Sn,Sn=Wl(e.stateNode.containerInfo),Ut(t,e),Bt(e),Sn=l;break;case 12:Ut(t,e),Bt(e);break;case 31:Ut(t,e),Bt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Ll(e,l)));break;case 13:Ut(t,e),Bt(e),e.child.flags&8192&&e.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(Pl=et()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Ll(e,l)));break;case 22:c=e.memoizedState!==null;var O=i!==null&&i.memoizedState!==null,U=ns,Y=pt;if(ns=U||c,pt=Y||O,Ut(t,e),pt=Y,ns=U,Bt(e),l&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(i===null||O||ns||pt||wi(e)),i=null,t=e;;){if(t.tag===5||t.tag===26){if(i===null){O=i=t;try{if(u=O.stateNode,c)p=u.style,typeof p.setProperty=="function"?p.setProperty("display","none","important"):p.display="none";else{b=O.stateNode;var I=O.memoizedProps.style,L=I!=null&&I.hasOwnProperty("display")?I.display:null;b.style.display=L==null||typeof L=="boolean"?"":(""+L).trim()}}catch(he){$e(O,O.return,he)}}}else if(t.tag===6){if(i===null){O=t;try{O.stateNode.nodeValue=c?"":O.memoizedProps}catch(he){$e(O,O.return,he)}}}else if(t.tag===18){if(i===null){O=t;try{var P=O.stateNode;c?Ap(P,!0):Ap(O.stateNode,!1)}catch(he){$e(O,O.return,he)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;i===t&&(i=null),t=t.return}i===t&&(i=null),t.sibling.return=t.return,t=t.sibling}l&4&&(l=e.updateQueue,l!==null&&(i=l.retryQueue,i!==null&&(l.retryQueue=null,Ll(e,i))));break;case 19:Ut(t,e),Bt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Ll(e,l)));break;case 30:break;case 21:break;default:Ut(t,e),Bt(e)}}function Bt(e){var t=e.flags;if(t&2){try{for(var i,l=e.return;l!==null;){if(jm(l)){i=l;break}l=l.return}if(i==null)throw Error(a(160));switch(i.tag){case 27:var c=i.stateNode,u=bu(e);Bl(e,u,c);break;case 5:var p=i.stateNode;i.flags&32&&(qi(p,""),i.flags&=-33);var b=bu(e);Bl(e,b,p);break;case 3:case 4:var O=i.stateNode.containerInfo,U=bu(e);xu(e,U,O);break;default:throw Error(a(161))}}catch(Y){$e(e,e.return,Y)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function qm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;qm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function is(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Cm(e,t.alternate,t),t=t.sibling}function wi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Cs(4,t,t.return),wi(t);break;case 1:Rn(t,t.return);var i=t.stateNode;typeof i.componentWillUnmount=="function"&&Am(t,t.return,i),wi(t);break;case 27:pa(t.stateNode);case 26:case 5:Rn(t,t.return),wi(t);break;case 22:t.memoizedState===null&&wi(t);break;case 30:wi(t);break;default:wi(t)}e=e.sibling}}function rs(e,t,i){for(i=i&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,c=e,u=t,p=u.flags;switch(u.tag){case 0:case 11:case 15:rs(c,u,i),ra(4,u);break;case 1:if(rs(c,u,i),l=u,c=l.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(U){$e(l,l.return,U)}if(l=u,c=l.updateQueue,c!==null){var b=l.stateNode;try{var O=c.shared.hiddenCallbacks;if(O!==null)for(c.shared.hiddenCallbacks=null,c=0;c<O.length;c++)dd(O[c],b)}catch(U){$e(l,l.return,U)}}i&&p&64&&Em(u),aa(u,u.return);break;case 27:Tm(u);case 26:case 5:rs(c,u,i),i&&l===null&&p&4&&Om(u),aa(u,u.return);break;case 12:rs(c,u,i);break;case 31:rs(c,u,i),i&&p&4&&Rm(c,u);break;case 13:rs(c,u,i),i&&p&4&&Dm(c,u);break;case 22:u.memoizedState===null&&rs(c,u,i),aa(u,u.return);break;case 30:break;default:rs(c,u,i)}t=t.sibling}}function _u(e,t){var i=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==i&&(e!=null&&e.refCount++,i!=null&&Fr(i))}function wu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Fr(e))}function En(e,t,i,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Um(e,t,i,l),t=t.sibling}function Um(e,t,i,l){var c=t.flags;switch(t.tag){case 0:case 11:case 15:En(e,t,i,l),c&2048&&ra(9,t);break;case 1:En(e,t,i,l);break;case 3:En(e,t,i,l),c&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Fr(e)));break;case 12:if(c&2048){En(e,t,i,l),e=t.stateNode;try{var u=t.memoizedProps,p=u.id,b=u.onPostCommit;typeof b=="function"&&b(p,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(O){$e(t,t.return,O)}}else En(e,t,i,l);break;case 31:En(e,t,i,l);break;case 13:En(e,t,i,l);break;case 23:break;case 22:u=t.stateNode,p=t.alternate,t.memoizedState!==null?u._visibility&2?En(e,t,i,l):la(e,t):u._visibility&2?En(e,t,i,l):(u._visibility|=2,nr(e,t,i,l,(t.subtreeFlags&10256)!==0||!1)),c&2048&&_u(p,t);break;case 24:En(e,t,i,l),c&2048&&wu(t.alternate,t);break;default:En(e,t,i,l)}}function nr(e,t,i,l,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,p=t,b=i,O=l,U=p.flags;switch(p.tag){case 0:case 11:case 15:nr(u,p,b,O,c),ra(8,p);break;case 23:break;case 22:var Y=p.stateNode;p.memoizedState!==null?Y._visibility&2?nr(u,p,b,O,c):la(u,p):(Y._visibility|=2,nr(u,p,b,O,c)),c&&U&2048&&_u(p.alternate,p);break;case 24:nr(u,p,b,O,c),c&&U&2048&&wu(p.alternate,p);break;default:nr(u,p,b,O,c)}t=t.sibling}}function la(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var i=e,l=t,c=l.flags;switch(l.tag){case 22:la(i,l),c&2048&&_u(l.alternate,l);break;case 24:la(i,l),c&2048&&wu(l.alternate,l);break;default:la(i,l)}t=t.sibling}}var oa=8192;function sr(e,t,i){if(e.subtreeFlags&oa)for(e=e.child;e!==null;)Bm(e,t,i),e=e.sibling}function Bm(e,t,i){switch(e.tag){case 26:sr(e,t,i),e.flags&oa&&e.memoizedState!==null&&sx(i,Sn,e.memoizedState,e.memoizedProps);break;case 5:sr(e,t,i);break;case 3:case 4:var l=Sn;Sn=Wl(e.stateNode.containerInfo),sr(e,t,i),Sn=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=oa,oa=16777216,sr(e,t,i),oa=l):sr(e,t,i));break;default:sr(e,t,i)}}function Lm(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function ca(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var i=0;i<t.length;i++){var l=t[i];xt=l,Pm(l,e)}Lm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Hm(e),e=e.sibling}function Hm(e){switch(e.tag){case 0:case 11:case 15:ca(e),e.flags&2048&&Cs(9,e,e.return);break;case 3:ca(e);break;case 12:ca(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Hl(e)):ca(e);break;default:ca(e)}}function Hl(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var i=0;i<t.length;i++){var l=t[i];xt=l,Pm(l,e)}Lm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Cs(8,t,t.return),Hl(t);break;case 22:i=t.stateNode,i._visibility&2&&(i._visibility&=-3,Hl(t));break;default:Hl(t)}e=e.sibling}}function Pm(e,t){for(;xt!==null;){var i=xt;switch(i.tag){case 0:case 11:case 15:Cs(8,i,t);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var l=i.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Fr(i.memoizedState.cache)}if(l=i.child,l!==null)l.return=i,xt=l;else e:for(i=e;xt!==null;){l=xt;var c=l.sibling,u=l.return;if(km(l),l===i){xt=null;break e}if(c!==null){c.return=u,xt=c;break e}xt=u}}}var bb={getCacheForType:function(e){var t=St(ht),i=t.data.get(e);return i===void 0&&(i=e(),t.data.set(e,i)),i},cacheSignal:function(){return St(ht).controller.signal}},xb=typeof WeakMap=="function"?WeakMap:Map,He=0,Ie=null,Ne=null,ke=0,Pe=0,Qt=null,ks=!1,ir=!1,Su=!1,as=0,at=0,Ms=0,Si=0,Eu=0,It=0,rr=0,ua=null,Lt=null,Au=!1,Pl=0,$m=0,$l=1/0,Yl=null,Rs=null,bt=0,Ds=null,ar=null,ls=0,Ou=0,ju=null,Ym=null,fa=0,Tu=null;function Xt(){return(He&2)!==0&&ke!==0?ke&-ke:$.T!==null?Du():Rr()}function Gm(){if(It===0)if((ke&536870912)===0||Re){var e=Yn;Yn<<=1,(Yn&3932160)===0&&(Yn=262144),It=e}else It=536870912;return e=Ft.current,e!==null&&(e.flags|=32),It}function Ht(e,t,i){(e===Ie&&(Pe===2||Pe===9)||e.cancelPendingCommit!==null)&&(lr(e,0),zs(e,ke,It,!1)),vn(e,i),((He&2)===0||e!==Ie)&&(e===Ie&&((He&2)===0&&(Si|=i),at===4&&zs(e,ke,It,!1)),Dn(e))}function Vm(e,t,i){if((He&6)!==0)throw Error(a(327));var l=!i&&(t&127)===0&&(t&e.expiredLanes)===0||ii(e,t),c=l?wb(e,t):Cu(e,t,!0),u=l;do{if(c===0){ir&&!l&&zs(e,t,0,!1);break}else{if(i=e.current.alternate,u&&!vb(i)){c=Cu(e,t,!1),u=!1;continue}if(c===2){if(u=t,e.errorRecoveryDisabledLanes&u)var p=0;else p=e.pendingLanes&-536870913,p=p!==0?p:p&536870912?536870912:0;if(p!==0){t=p;e:{var b=e;c=ua;var O=b.current.memoizedState.isDehydrated;if(O&&(lr(b,p).flags|=256),p=Cu(b,p,!1),p!==2){if(Su&&!O){b.errorRecoveryDisabledLanes|=u,Si|=u,c=4;break e}u=Lt,Lt=c,u!==null&&(Lt===null?Lt=u:Lt.push.apply(Lt,u))}c=p}if(u=!1,c!==2)continue}}if(c===1){lr(e,0),zs(e,t,0,!0);break}e:{switch(l=e,u=c,u){case 0:case 1:throw Error(a(345));case 4:if((t&4194048)!==t)break;case 6:zs(l,t,It,!ks);break e;case 2:Lt=null;break;case 3:case 5:break;default:throw Error(a(329))}if((t&62914560)===t&&(c=Pl+300-et(),10<c)){if(zs(l,t,It,!ks),si(l,0,!0)!==0)break e;ls=t,l.timeoutHandle=wp(Fm.bind(null,l,i,Lt,Yl,Au,t,It,Si,rr,ks,u,"Throttled",-0,0),c);break e}Fm(l,i,Lt,Yl,Au,t,It,Si,rr,ks,u,null,-0,0)}}break}while(!0);Dn(e)}function Fm(e,t,i,l,c,u,p,b,O,U,Y,I,L,P){if(e.timeoutHandle=-1,I=t.subtreeFlags,I&8192||(I&16785408)===16785408){I={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Fn},Bm(t,u,I);var he=(u&62914560)===u?Pl-et():(u&4194048)===u?$m-et():0;if(he=ix(I,he),he!==null){ls=u,e.cancelPendingCommit=he(ep.bind(null,e,t,u,i,l,c,p,b,O,Y,I,null,L,P)),zs(e,u,p,!U);return}}ep(e,t,u,i,l,c,p,b,O)}function vb(e){for(var t=e;;){var i=t.tag;if((i===0||i===11||i===15)&&t.flags&16384&&(i=t.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var l=0;l<i.length;l++){var c=i[l],u=c.getSnapshot;c=c.value;try{if(!Gt(u(),c))return!1}catch{return!1}}if(i=t.child,t.subtreeFlags&16384&&i!==null)i.return=t,t=i;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function zs(e,t,i,l){t&=~Eu,t&=~Si,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var c=t;0<c;){var u=31-Nt(c),p=1<<u;l[u]=-1,c&=~p}i!==0&&bs(e,i,t)}function Gl(){return(He&6)===0?(ha(0),!1):!0}function Nu(){if(Ne!==null){if(Pe===0)var e=Ne.return;else e=Ne,Xn=mi=null,Vc(e),Ki=null,Qr=0,e=Ne;for(;e!==null;)Sm(e.alternate,e),e=e.return;Ne=null}}function lr(e,t){var i=e.timeoutHandle;i!==-1&&(e.timeoutHandle=-1,Hb(i)),i=e.cancelPendingCommit,i!==null&&(e.cancelPendingCommit=null,i()),ls=0,Nu(),Ie=e,Ne=i=Qn(e.current,null),ke=t,Pe=0,Qt=null,ks=!1,ir=ii(e,t),Su=!1,rr=It=Eu=Si=Ms=at=0,Lt=ua=null,Au=!1,(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var c=31-Nt(l),u=1<<c;t|=e[c],l&=~u}return as=t,fl(),i}function Jm(e,t){Se=null,$.H=na,t===Xi||t===xl?(t=cd(),Pe=3):t===Rc?(t=cd(),Pe=4):Pe=t===lu?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Qt=t,Ne===null&&(at=1,Rl(e,cn(t,e.current)))}function Qm(){var e=Ft.current;return e===null?!0:(ke&4194048)===ke?dn===null:(ke&62914560)===ke||(ke&536870912)!==0?e===dn:!1}function Im(){var e=$.H;return $.H=na,e===null?na:e}function Xm(){var e=$.A;return $.A=bb,e}function Vl(){at=4,ks||(ke&4194048)!==ke&&Ft.current!==null||(ir=!0),(Ms&134217727)===0&&(Si&134217727)===0||Ie===null||zs(Ie,ke,It,!1)}function Cu(e,t,i){var l=He;He|=2;var c=Im(),u=Xm();(Ie!==e||ke!==t)&&(Yl=null,lr(e,t)),t=!1;var p=at;e:do try{if(Pe!==0&&Ne!==null){var b=Ne,O=Qt;switch(Pe){case 8:Nu(),p=6;break e;case 3:case 2:case 9:case 6:Ft.current===null&&(t=!0);var U=Pe;if(Pe=0,Qt=null,or(e,b,O,U),i&&ir){p=0;break e}break;default:U=Pe,Pe=0,Qt=null,or(e,b,O,U)}}_b(),p=at;break}catch(Y){Jm(e,Y)}while(!0);return t&&e.shellSuspendCounter++,Xn=mi=null,He=l,$.H=c,$.A=u,Ne===null&&(Ie=null,ke=0,fl()),p}function _b(){for(;Ne!==null;)Km(Ne)}function wb(e,t){var i=He;He|=2;var l=Im(),c=Xm();Ie!==e||ke!==t?(Yl=null,$l=et()+500,lr(e,t)):ir=ii(e,t);e:do try{if(Pe!==0&&Ne!==null){t=Ne;var u=Qt;t:switch(Pe){case 1:Pe=0,Qt=null,or(e,t,u,1);break;case 2:case 9:if(ld(u)){Pe=0,Qt=null,Zm(t);break}t=function(){Pe!==2&&Pe!==9||Ie!==e||(Pe=7),Dn(e)},u.then(t,t);break e;case 3:Pe=7;break e;case 4:Pe=5;break e;case 7:ld(u)?(Pe=0,Qt=null,Zm(t)):(Pe=0,Qt=null,or(e,t,u,7));break;case 5:var p=null;switch(Ne.tag){case 26:p=Ne.memoizedState;case 5:case 27:var b=Ne;if(p?Up(p):b.stateNode.complete){Pe=0,Qt=null;var O=b.sibling;if(O!==null)Ne=O;else{var U=b.return;U!==null?(Ne=U,Fl(U)):Ne=null}break t}}Pe=0,Qt=null,or(e,t,u,5);break;case 6:Pe=0,Qt=null,or(e,t,u,6);break;case 8:Nu(),at=6;break e;default:throw Error(a(462))}}Sb();break}catch(Y){Jm(e,Y)}while(!0);return Xn=mi=null,$.H=l,$.A=c,He=i,Ne!==null?0:(Ie=null,ke=0,fl(),at)}function Sb(){for(;Ne!==null&&!Qa();)Km(Ne)}function Km(e){var t=_m(e.alternate,e,as);e.memoizedProps=e.pendingProps,t===null?Fl(e):Ne=t}function Zm(e){var t=e,i=t.alternate;switch(t.tag){case 15:case 0:t=pm(i,t,t.pendingProps,t.type,void 0,ke);break;case 11:t=pm(i,t,t.pendingProps,t.type.render,t.ref,ke);break;case 5:Vc(t);default:Sm(i,t),t=Ne=Xh(t,as),t=_m(i,t,as)}e.memoizedProps=e.pendingProps,t===null?Fl(e):Ne=t}function or(e,t,i,l){Xn=mi=null,Vc(t),Ki=null,Qr=0;var c=t.return;try{if(fb(e,c,t,i,ke)){at=1,Rl(e,cn(i,e.current)),Ne=null;return}}catch(u){if(c!==null)throw Ne=c,u;at=1,Rl(e,cn(i,e.current)),Ne=null;return}t.flags&32768?(Re||l===1?e=!0:ir||(ke&536870912)!==0?e=!1:(ks=e=!0,(l===2||l===9||l===3||l===6)&&(l=Ft.current,l!==null&&l.tag===13&&(l.flags|=16384))),Wm(t,e)):Fl(t)}function Fl(e){var t=e;do{if((t.flags&32768)!==0){Wm(t,ks);return}e=t.return;var i=mb(t.alternate,t,as);if(i!==null){Ne=i;return}if(t=t.sibling,t!==null){Ne=t;return}Ne=t=e}while(t!==null);at===0&&(at=5)}function Wm(e,t){do{var i=pb(e.alternate,e);if(i!==null){i.flags&=32767,Ne=i;return}if(i=e.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!t&&(e=e.sibling,e!==null)){Ne=e;return}Ne=e=i}while(e!==null);at=6,Ne=null}function ep(e,t,i,l,c,u,p,b,O){e.cancelPendingCommit=null;do Jl();while(bt!==0);if((He&6)!==0)throw Error(a(327));if(t!==null){if(t===e.current)throw Error(a(177));if(u=t.lanes|t.childLanes,u|=bc,ys(e,i,u,p,b,O),e===Ie&&(Ne=Ie=null,ke=0),ar=t,Ds=e,ls=i,Ou=u,ju=c,Ym=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,jb(ki,function(){return rp(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=$.T,$.T=null,c=te.p,te.p=2,p=He,He|=4;try{gb(e,t,i)}finally{He=p,te.p=c,$.T=l}}bt=1,tp(),np(),sp()}}function tp(){if(bt===1){bt=0;var e=Ds,t=ar,i=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||i){i=$.T,$.T=null;var l=te.p;te.p=2;var c=He;He|=4;try{zm(t,e);var u=$u,p=Ph(e.containerInfo),b=u.focusedElem,O=u.selectionRange;if(p!==b&&b&&b.ownerDocument&&Hh(b.ownerDocument.documentElement,b)){if(O!==null&&dc(b)){var U=O.start,Y=O.end;if(Y===void 0&&(Y=U),"selectionStart"in b)b.selectionStart=U,b.selectionEnd=Math.min(Y,b.value.length);else{var I=b.ownerDocument||document,L=I&&I.defaultView||window;if(L.getSelection){var P=L.getSelection(),he=b.textContent.length,ye=Math.min(O.start,he),Je=O.end===void 0?ye:Math.min(O.end,he);!P.extend&&ye>Je&&(p=Je,Je=ye,ye=p);var R=Lh(b,ye),C=Lh(b,Je);if(R&&C&&(P.rangeCount!==1||P.anchorNode!==R.node||P.anchorOffset!==R.offset||P.focusNode!==C.node||P.focusOffset!==C.offset)){var q=I.createRange();q.setStart(R.node,R.offset),P.removeAllRanges(),ye>Je?(P.addRange(q),P.extend(C.node,C.offset)):(q.setEnd(C.node,C.offset),P.addRange(q))}}}}for(I=[],P=b;P=P.parentNode;)P.nodeType===1&&I.push({element:P,left:P.scrollLeft,top:P.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<I.length;b++){var G=I[b];G.element.scrollLeft=G.left,G.element.scrollTop=G.top}}ro=!!Pu,$u=Pu=null}finally{He=c,te.p=l,$.T=i}}e.current=t,bt=2}}function np(){if(bt===2){bt=0;var e=Ds,t=ar,i=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||i){i=$.T,$.T=null;var l=te.p;te.p=2;var c=He;He|=4;try{Cm(e,t.alternate,t)}finally{He=c,te.p=l,$.T=i}}bt=3}}function sp(){if(bt===4||bt===3){bt=0,Ci();var e=Ds,t=ar,i=ls,l=Ym;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?bt=5:(bt=0,ar=Ds=null,ip(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(Rs=null),ai(i),t=t.stateNode,ot&&typeof ot.onCommitFiberRoot=="function")try{ot.onCommitFiberRoot(ni,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=$.T,c=te.p,te.p=2,$.T=null;try{for(var u=e.onRecoverableError,p=0;p<l.length;p++){var b=l[p];u(b.value,{componentStack:b.stack})}}finally{$.T=t,te.p=c}}(ls&3)!==0&&Jl(),Dn(e),c=e.pendingLanes,(i&261930)!==0&&(c&42)!==0?e===Tu?fa++:(fa=0,Tu=e):fa=0,ha(0)}}function ip(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Fr(t)))}function Jl(){return tp(),np(),sp(),rp()}function rp(){if(bt!==5)return!1;var e=Ds,t=Ou;Ou=0;var i=ai(ls),l=$.T,c=te.p;try{te.p=32>i?32:i,$.T=null,i=ju,ju=null;var u=Ds,p=ls;if(bt=0,ar=Ds=null,ls=0,(He&6)!==0)throw Error(a(331));var b=He;if(He|=4,Hm(u.current),Um(u,u.current,p,i),He=b,ha(0,!1),ot&&typeof ot.onPostCommitFiberRoot=="function")try{ot.onPostCommitFiberRoot(ni,u)}catch{}return!0}finally{te.p=c,$.T=l,ip(e,t)}}function ap(e,t,i){t=cn(i,t),t=au(e.stateNode,t,2),e=js(e,t,2),e!==null&&(vn(e,2),Dn(e))}function $e(e,t,i){if(e.tag===3)ap(e,e,i);else for(;t!==null;){if(t.tag===3){ap(t,e,i);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Rs===null||!Rs.has(l))){e=cn(i,e),i=lm(2),l=js(t,i,2),l!==null&&(om(i,l,t,e),vn(l,2),Dn(l));break}}t=t.return}}function ku(e,t,i){var l=e.pingCache;if(l===null){l=e.pingCache=new xb;var c=new Set;l.set(t,c)}else c=l.get(t),c===void 0&&(c=new Set,l.set(t,c));c.has(i)||(Su=!0,c.add(i),e=Eb.bind(null,e,t,i),t.then(e,e))}function Eb(e,t,i){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,Ie===e&&(ke&i)===i&&(at===4||at===3&&(ke&62914560)===ke&&300>et()-Pl?(He&2)===0&&lr(e,0):Eu|=i,rr===ke&&(rr=0)),Dn(e)}function lp(e,t){t===0&&(t=Ri()),e=fi(e,t),e!==null&&(vn(e,t),Dn(e))}function Ab(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),lp(e,i)}function Ob(e,t){var i=0;switch(e.tag){case 31:case 13:var l=e.stateNode,c=e.memoizedState;c!==null&&(i=c.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(a(314))}l!==null&&l.delete(t),lp(e,i)}function jb(e,t){return Nr(e,t)}var Ql=null,cr=null,Mu=!1,Il=!1,Ru=!1,qs=0;function Dn(e){e!==cr&&e.next===null&&(cr===null?Ql=cr=e:cr=cr.next=e),Il=!0,Mu||(Mu=!0,Nb())}function ha(e,t){if(!Ru&&Il){Ru=!0;do for(var i=!1,l=Ql;l!==null;){if(e!==0){var c=l.pendingLanes;if(c===0)var u=0;else{var p=l.suspendedLanes,b=l.pingedLanes;u=(1<<31-Nt(42|e)+1)-1,u&=c&~(p&~b),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(i=!0,fp(l,u))}else u=ke,u=si(l,l===Ie?u:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(u&3)===0||ii(l,u)||(i=!0,fp(l,u));l=l.next}while(i);Ru=!1}}function Tb(){op()}function op(){Il=Mu=!1;var e=0;qs!==0&&Lb()&&(e=qs);for(var t=et(),i=null,l=Ql;l!==null;){var c=l.next,u=cp(l,t);u===0?(l.next=null,i===null?Ql=c:i.next=c,c===null&&(cr=i)):(i=l,(e!==0||(u&3)!==0)&&(Il=!0)),l=c}bt!==0&&bt!==5||ha(e),qs!==0&&(qs=0)}function cp(e,t){for(var i=e.suspendedLanes,l=e.pingedLanes,c=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var p=31-Nt(u),b=1<<p,O=c[p];O===-1?((b&i)===0||(b&l)!==0)&&(c[p]=Mr(b,t)):O<=t&&(e.expiredLanes|=b),u&=~b}if(t=Ie,i=ke,i=si(e,e===t?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,i===0||e===t&&(Pe===2||Pe===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&$n(l),e.callbackNode=null,e.callbackPriority=0;if((i&3)===0||ii(e,i)){if(t=i&-i,t===e.callbackPriority)return t;switch(l!==null&&$n(l),ai(i)){case 2:case 8:i=Xa;break;case 32:i=ki;break;case 268435456:i=Ka;break;default:i=ki}return l=up.bind(null,e),i=Nr(i,l),e.callbackPriority=t,e.callbackNode=i,t}return l!==null&&l!==null&&$n(l),e.callbackPriority=2,e.callbackNode=null,2}function up(e,t){if(bt!==0&&bt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var i=e.callbackNode;if(Jl()&&e.callbackNode!==i)return null;var l=ke;return l=si(e,e===Ie?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Vm(e,l,t),cp(e,et()),e.callbackNode!=null&&e.callbackNode===i?up.bind(null,e):null)}function fp(e,t){if(Jl())return null;Vm(e,t,!0)}function Nb(){Pb(function(){(He&6)!==0?Nr(Ia,Tb):op()})}function Du(){if(qs===0){var e=Qi;e===0&&(e=ms,ms<<=1,(ms&261888)===0&&(ms=256)),qs=e}return qs}function hp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:sl(""+e)}function dp(e,t){var i=t.ownerDocument.createElement("input");return i.name=t.name,i.value=t.value,e.id&&i.setAttribute("form",e.id),t.parentNode.insertBefore(i,t),e=new FormData(e),i.parentNode.removeChild(i),e}function Cb(e,t,i,l,c){if(t==="submit"&&i&&i.stateNode===c){var u=hp((c[it]||null).action),p=l.submitter;p&&(t=(t=p[it]||null)?hp(t.formAction):p.getAttribute("formAction"),t!==null&&(u=t,p=null));var b=new ll("action","action",null,l,c);e.push({event:b,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(qs!==0){var O=p?dp(c,p):new FormData(c);eu(i,{pending:!0,data:O,method:c.method,action:u},null,O)}}else typeof u=="function"&&(b.preventDefault(),O=p?dp(c,p):new FormData(c),eu(i,{pending:!0,data:O,method:c.method,action:u},u,O))},currentTarget:c}]})}}for(var zu=0;zu<yc.length;zu++){var qu=yc[zu],kb=qu.toLowerCase(),Mb=qu[0].toUpperCase()+qu.slice(1);wn(kb,"on"+Mb)}wn(Gh,"onAnimationEnd"),wn(Vh,"onAnimationIteration"),wn(Fh,"onAnimationStart"),wn("dblclick","onDoubleClick"),wn("focusin","onFocus"),wn("focusout","onBlur"),wn(Qy,"onTransitionRun"),wn(Iy,"onTransitionStart"),wn(Xy,"onTransitionCancel"),wn(Jh,"onTransitionEnd"),H("onMouseEnter",["mouseout","mouseover"]),H("onMouseLeave",["mouseout","mouseover"]),H("onPointerEnter",["pointerout","pointerover"]),H("onPointerLeave",["pointerout","pointerover"]),K("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),K("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),K("onBeforeInput",["compositionend","keypress","textInput","paste"]),K("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),K("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),K("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var da="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(" "),Rb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(da));function mp(e,t){t=(t&4)!==0;for(var i=0;i<e.length;i++){var l=e[i],c=l.event;l=l.listeners;e:{var u=void 0;if(t)for(var p=l.length-1;0<=p;p--){var b=l[p],O=b.instance,U=b.currentTarget;if(b=b.listener,O!==u&&c.isPropagationStopped())break e;u=b,c.currentTarget=U;try{u(c)}catch(Y){ul(Y)}c.currentTarget=null,u=O}else for(p=0;p<l.length;p++){if(b=l[p],O=b.instance,U=b.currentTarget,b=b.listener,O!==u&&c.isPropagationStopped())break e;u=b,c.currentTarget=U;try{u(c)}catch(Y){ul(Y)}c.currentTarget=null,u=O}}}}function Ce(e,t){var i=t[li];i===void 0&&(i=t[li]=new Set);var l=e+"__bubble";i.has(l)||(pp(t,e,2,!1),i.add(l))}function Uu(e,t,i){var l=0;t&&(l|=4),pp(i,e,l,t)}var Xl="_reactListening"+Math.random().toString(36).slice(2);function Bu(e){if(!e[Xl]){e[Xl]=!0,D.forEach(function(i){i!=="selectionchange"&&(Rb.has(i)||Uu(i,!1,e),Uu(i,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Xl]||(t[Xl]=!0,Uu("selectionchange",!1,t))}}function pp(e,t,i,l){switch(Gp(t)){case 2:var c=lx;break;case 8:c=ox;break;default:c=Wu}i=c.bind(null,t,i,e),c=void 0,!ic||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),l?c!==void 0?e.addEventListener(t,i,{capture:!0,passive:c}):e.addEventListener(t,i,!0):c!==void 0?e.addEventListener(t,i,{passive:c}):e.addEventListener(t,i,!1)}function Lu(e,t,i,l,c){var u=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var p=l.tag;if(p===3||p===4){var b=l.stateNode.containerInfo;if(b===c)break;if(p===4)for(p=l.return;p!==null;){var O=p.tag;if((O===3||O===4)&&p.stateNode.containerInfo===c)return;p=p.return}for(;b!==null;){if(p=x(b),p===null)return;if(O=p.tag,O===5||O===6||O===26||O===27){l=u=p;continue e}b=b.parentNode}}l=l.return}vh(function(){var U=u,Y=nc(i),I=[];e:{var L=Qh.get(e);if(L!==void 0){var P=ll,he=e;switch(e){case"keypress":if(rl(i)===0)break e;case"keydown":case"keyup":P=Oy;break;case"focusin":he="focus",P=oc;break;case"focusout":he="blur",P=oc;break;case"beforeblur":case"afterblur":P=oc;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":P=Sh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":P=my;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":P=Ny;break;case Gh:case Vh:case Fh:P=yy;break;case Jh:P=ky;break;case"scroll":case"scrollend":P=hy;break;case"wheel":P=Ry;break;case"copy":case"cut":case"paste":P=xy;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":P=Ah;break;case"toggle":case"beforetoggle":P=zy}var ye=(t&4)!==0,Je=!ye&&(e==="scroll"||e==="scrollend"),R=ye?L!==null?L+"Capture":null:L;ye=[];for(var C=U,q;C!==null;){var G=C;if(q=G.stateNode,G=G.tag,G!==5&&G!==26&&G!==27||q===null||R===null||(G=zr(C,R),G!=null&&ye.push(ma(C,G,q))),Je)break;C=C.return}0<ye.length&&(L=new P(L,he,null,i,Y),I.push({event:L,listeners:ye}))}}if((t&7)===0){e:{if(L=e==="mouseover"||e==="pointerover",P=e==="mouseout"||e==="pointerout",L&&i!==tc&&(he=i.relatedTarget||i.fromElement)&&(x(he)||he[Yt]))break e;if((P||L)&&(L=Y.window===Y?Y:(L=Y.ownerDocument)?L.defaultView||L.parentWindow:window,P?(he=i.relatedTarget||i.toElement,P=U,he=he?x(he):null,he!==null&&(Je=f(he),ye=he.tag,he!==Je||ye!==5&&ye!==27&&ye!==6)&&(he=null)):(P=null,he=U),P!==he)){if(ye=Sh,G="onMouseLeave",R="onMouseEnter",C="mouse",(e==="pointerout"||e==="pointerover")&&(ye=Ah,G="onPointerLeave",R="onPointerEnter",C="pointer"),Je=P==null?L:_(P),q=he==null?L:_(he),L=new ye(G,C+"leave",P,i,Y),L.target=Je,L.relatedTarget=q,G=null,x(Y)===U&&(ye=new ye(R,C+"enter",he,i,Y),ye.target=q,ye.relatedTarget=Je,G=ye),Je=G,P&&he)t:{for(ye=Db,R=P,C=he,q=0,G=R;G;G=ye(G))q++;G=0;for(var ge=C;ge;ge=ye(ge))G++;for(;0<q-G;)R=ye(R),q--;for(;0<G-q;)C=ye(C),G--;for(;q--;){if(R===C||C!==null&&R===C.alternate){ye=R;break t}R=ye(R),C=ye(C)}ye=null}else ye=null;P!==null&&gp(I,L,P,ye,!1),he!==null&&Je!==null&&gp(I,Je,he,ye,!0)}}e:{if(L=U?_(U):window,P=L.nodeName&&L.nodeName.toLowerCase(),P==="select"||P==="input"&&L.type==="file")var Ue=Rh;else if(kh(L))if(Dh)Ue=Vy;else{Ue=Yy;var me=$y}else P=L.nodeName,!P||P.toLowerCase()!=="input"||L.type!=="checkbox"&&L.type!=="radio"?U&&ec(U.elementType)&&(Ue=Rh):Ue=Gy;if(Ue&&(Ue=Ue(e,U))){Mh(I,Ue,i,Y);break e}me&&me(e,L,U),e==="focusout"&&U&&L.type==="number"&&U.memoizedProps.value!=null&&Wo(L,"number",L.value)}switch(me=U?_(U):window,e){case"focusin":(kh(me)||me.contentEditable==="true")&&(Hi=me,mc=U,Yr=null);break;case"focusout":Yr=mc=Hi=null;break;case"mousedown":pc=!0;break;case"contextmenu":case"mouseup":case"dragend":pc=!1,$h(I,i,Y);break;case"selectionchange":if(Jy)break;case"keydown":case"keyup":$h(I,i,Y)}var Ee;if(uc)e:{switch(e){case"compositionstart":var Me="onCompositionStart";break e;case"compositionend":Me="onCompositionEnd";break e;case"compositionupdate":Me="onCompositionUpdate";break e}Me=void 0}else Li?Nh(e,i)&&(Me="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(Me="onCompositionStart");Me&&(Oh&&i.locale!=="ko"&&(Li||Me!=="onCompositionStart"?Me==="onCompositionEnd"&&Li&&(Ee=_h()):(vs=Y,rc="value"in vs?vs.value:vs.textContent,Li=!0)),me=Kl(U,Me),0<me.length&&(Me=new Eh(Me,e,null,i,Y),I.push({event:Me,listeners:me}),Ee?Me.data=Ee:(Ee=Ch(i),Ee!==null&&(Me.data=Ee)))),(Ee=Uy?By(e,i):Ly(e,i))&&(Me=Kl(U,"onBeforeInput"),0<Me.length&&(me=new Eh("onBeforeInput","beforeinput",null,i,Y),I.push({event:me,listeners:Me}),me.data=Ee)),Cb(I,e,U,i,Y)}mp(I,t)})}function ma(e,t,i){return{instance:e,listener:t,currentTarget:i}}function Kl(e,t){for(var i=t+"Capture",l=[];e!==null;){var c=e,u=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||u===null||(c=zr(e,i),c!=null&&l.unshift(ma(e,c,u)),c=zr(e,t),c!=null&&l.push(ma(e,c,u))),e.tag===3)return l;e=e.return}return[]}function Db(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function gp(e,t,i,l,c){for(var u=t._reactName,p=[];i!==null&&i!==l;){var b=i,O=b.alternate,U=b.stateNode;if(b=b.tag,O!==null&&O===l)break;b!==5&&b!==26&&b!==27||U===null||(O=U,c?(U=zr(i,u),U!=null&&p.unshift(ma(i,U,O))):c||(U=zr(i,u),U!=null&&p.push(ma(i,U,O)))),i=i.return}p.length!==0&&e.push({event:t,listeners:p})}var zb=/\r\n?/g,qb=/\u0000|\uFFFD/g;function yp(e){return(typeof e=="string"?e:""+e).replace(zb,`
|
|
26
|
+
`).replace(qb,"")}function bp(e,t){return t=yp(t),yp(e)===t}function Fe(e,t,i,l,c,u){switch(i){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||qi(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&qi(e,""+l);break;case"className":_n(e,"class",l);break;case"tabIndex":_n(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":_n(e,i,l);break;case"style":bh(e,l,u);break;case"data":if(t!=="object"){_n(e,"data",l);break}case"src":case"href":if(l===""&&(t!=="a"||i!=="href")){e.removeAttribute(i);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(i);break}l=sl(""+l),e.setAttribute(i,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(i,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof u=="function"&&(i==="formAction"?(t!=="input"&&Fe(e,t,"name",c.name,c,null),Fe(e,t,"formEncType",c.formEncType,c,null),Fe(e,t,"formMethod",c.formMethod,c,null),Fe(e,t,"formTarget",c.formTarget,c,null)):(Fe(e,t,"encType",c.encType,c,null),Fe(e,t,"method",c.method,c,null),Fe(e,t,"target",c.target,c,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(i);break}l=sl(""+l),e.setAttribute(i,l);break;case"onClick":l!=null&&(e.onclick=Fn);break;case"onScroll":l!=null&&Ce("scroll",e);break;case"onScrollEnd":l!=null&&Ce("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(i=l.__html,i!=null){if(c.children!=null)throw Error(a(60));e.innerHTML=i}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}i=sl(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,""+l):e.removeAttribute(i);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,""):e.removeAttribute(i);break;case"capture":case"download":l===!0?e.setAttribute(i,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,l):e.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(i,l):e.removeAttribute(i);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(i):e.setAttribute(i,l);break;case"popover":Ce("beforetoggle",e),Ce("toggle",e),Ct(e,"popover",l);break;case"xlinkActuate":Vn(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Vn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Vn(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Vn(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Vn(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Vn(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Vn(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Vn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Vn(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Ct(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=uy.get(i)||i,Ct(e,i,l))}}function Hu(e,t,i,l,c,u){switch(i){case"style":bh(e,l,u);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(i=l.__html,i!=null){if(c.children!=null)throw Error(a(60));e.innerHTML=i}}break;case"children":typeof l=="string"?qi(e,l):(typeof l=="number"||typeof l=="bigint")&&qi(e,""+l);break;case"onScroll":l!=null&&Ce("scroll",e);break;case"onScrollEnd":l!=null&&Ce("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Fn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Q.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(c=i.endsWith("Capture"),t=i.slice(2,c?i.length-7:void 0),u=e[it]||null,u=u!=null?u[i]:null,typeof u=="function"&&e.removeEventListener(t,u,c),typeof l=="function")){typeof u!="function"&&u!==null&&(i in e?e[i]=null:e.hasAttribute(i)&&e.removeAttribute(i)),e.addEventListener(t,l,c);break e}i in e?e[i]=l:l===!0?e.setAttribute(i,""):Ct(e,i,l)}}}function At(e,t,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ce("error",e),Ce("load",e);var l=!1,c=!1,u;for(u in i)if(i.hasOwnProperty(u)){var p=i[u];if(p!=null)switch(u){case"src":l=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,t));default:Fe(e,t,u,p,i,null)}}c&&Fe(e,t,"srcSet",i.srcSet,i,null),l&&Fe(e,t,"src",i.src,i,null);return;case"input":Ce("invalid",e);var b=u=p=c=null,O=null,U=null;for(l in i)if(i.hasOwnProperty(l)){var Y=i[l];if(Y!=null)switch(l){case"name":c=Y;break;case"type":p=Y;break;case"checked":O=Y;break;case"defaultChecked":U=Y;break;case"value":u=Y;break;case"defaultValue":b=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(a(137,t));break;default:Fe(e,t,l,Y,i,null)}}mh(e,u,b,O,U,p,c,!1);return;case"select":Ce("invalid",e),l=p=u=null;for(c in i)if(i.hasOwnProperty(c)&&(b=i[c],b!=null))switch(c){case"value":u=b;break;case"defaultValue":p=b;break;case"multiple":l=b;default:Fe(e,t,c,b,i,null)}t=u,i=p,e.multiple=!!l,t!=null?zi(e,!!l,t,!1):i!=null&&zi(e,!!l,i,!0);return;case"textarea":Ce("invalid",e),u=c=l=null;for(p in i)if(i.hasOwnProperty(p)&&(b=i[p],b!=null))switch(p){case"value":l=b;break;case"defaultValue":c=b;break;case"children":u=b;break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(a(91));break;default:Fe(e,t,p,b,i,null)}gh(e,l,c,u);return;case"option":for(O in i)if(i.hasOwnProperty(O)&&(l=i[O],l!=null))switch(O){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:Fe(e,t,O,l,i,null)}return;case"dialog":Ce("beforetoggle",e),Ce("toggle",e),Ce("cancel",e),Ce("close",e);break;case"iframe":case"object":Ce("load",e);break;case"video":case"audio":for(l=0;l<da.length;l++)Ce(da[l],e);break;case"image":Ce("error",e),Ce("load",e);break;case"details":Ce("toggle",e);break;case"embed":case"source":case"link":Ce("error",e),Ce("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(U in i)if(i.hasOwnProperty(U)&&(l=i[U],l!=null))switch(U){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,t));default:Fe(e,t,U,l,i,null)}return;default:if(ec(t)){for(Y in i)i.hasOwnProperty(Y)&&(l=i[Y],l!==void 0&&Hu(e,t,Y,l,i,void 0));return}}for(b in i)i.hasOwnProperty(b)&&(l=i[b],l!=null&&Fe(e,t,b,l,i,null))}function Ub(e,t,i,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,u=null,p=null,b=null,O=null,U=null,Y=null;for(P in i){var I=i[P];if(i.hasOwnProperty(P)&&I!=null)switch(P){case"checked":break;case"value":break;case"defaultValue":O=I;default:l.hasOwnProperty(P)||Fe(e,t,P,null,l,I)}}for(var L in l){var P=l[L];if(I=i[L],l.hasOwnProperty(L)&&(P!=null||I!=null))switch(L){case"type":u=P;break;case"name":c=P;break;case"checked":U=P;break;case"defaultChecked":Y=P;break;case"value":p=P;break;case"defaultValue":b=P;break;case"children":case"dangerouslySetInnerHTML":if(P!=null)throw Error(a(137,t));break;default:P!==I&&Fe(e,t,L,P,l,I)}}Zo(e,p,b,O,U,Y,u,c);return;case"select":P=p=b=L=null;for(u in i)if(O=i[u],i.hasOwnProperty(u)&&O!=null)switch(u){case"value":break;case"multiple":P=O;default:l.hasOwnProperty(u)||Fe(e,t,u,null,l,O)}for(c in l)if(u=l[c],O=i[c],l.hasOwnProperty(c)&&(u!=null||O!=null))switch(c){case"value":L=u;break;case"defaultValue":b=u;break;case"multiple":p=u;default:u!==O&&Fe(e,t,c,u,l,O)}t=b,i=p,l=P,L!=null?zi(e,!!i,L,!1):!!l!=!!i&&(t!=null?zi(e,!!i,t,!0):zi(e,!!i,i?[]:"",!1));return;case"textarea":P=L=null;for(b in i)if(c=i[b],i.hasOwnProperty(b)&&c!=null&&!l.hasOwnProperty(b))switch(b){case"value":break;case"children":break;default:Fe(e,t,b,null,l,c)}for(p in l)if(c=l[p],u=i[p],l.hasOwnProperty(p)&&(c!=null||u!=null))switch(p){case"value":L=c;break;case"defaultValue":P=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(a(91));break;default:c!==u&&Fe(e,t,p,c,l,u)}ph(e,L,P);return;case"option":for(var he in i)if(L=i[he],i.hasOwnProperty(he)&&L!=null&&!l.hasOwnProperty(he))switch(he){case"selected":e.selected=!1;break;default:Fe(e,t,he,null,l,L)}for(O in l)if(L=l[O],P=i[O],l.hasOwnProperty(O)&&L!==P&&(L!=null||P!=null))switch(O){case"selected":e.selected=L&&typeof L!="function"&&typeof L!="symbol";break;default:Fe(e,t,O,L,l,P)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ye in i)L=i[ye],i.hasOwnProperty(ye)&&L!=null&&!l.hasOwnProperty(ye)&&Fe(e,t,ye,null,l,L);for(U in l)if(L=l[U],P=i[U],l.hasOwnProperty(U)&&L!==P&&(L!=null||P!=null))switch(U){case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(a(137,t));break;default:Fe(e,t,U,L,l,P)}return;default:if(ec(t)){for(var Je in i)L=i[Je],i.hasOwnProperty(Je)&&L!==void 0&&!l.hasOwnProperty(Je)&&Hu(e,t,Je,void 0,l,L);for(Y in l)L=l[Y],P=i[Y],!l.hasOwnProperty(Y)||L===P||L===void 0&&P===void 0||Hu(e,t,Y,L,l,P);return}}for(var R in i)L=i[R],i.hasOwnProperty(R)&&L!=null&&!l.hasOwnProperty(R)&&Fe(e,t,R,null,l,L);for(I in l)L=l[I],P=i[I],!l.hasOwnProperty(I)||L===P||L==null&&P==null||Fe(e,t,I,L,l,P)}function xp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Bb(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,i=performance.getEntriesByType("resource"),l=0;l<i.length;l++){var c=i[l],u=c.transferSize,p=c.initiatorType,b=c.duration;if(u&&b&&xp(p)){for(p=0,b=c.responseEnd,l+=1;l<i.length;l++){var O=i[l],U=O.startTime;if(U>b)break;var Y=O.transferSize,I=O.initiatorType;Y&&xp(I)&&(O=O.responseEnd,p+=Y*(O<b?1:(b-U)/(O-U)))}if(--l,t+=8*(u+p)/(c.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Pu=null,$u=null;function Zl(e){return e.nodeType===9?e:e.ownerDocument}function vp(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 _p(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Yu(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Gu=null;function Lb(){var e=window.event;return e&&e.type==="popstate"?e===Gu?!1:(Gu=e,!0):(Gu=null,!1)}var wp=typeof setTimeout=="function"?setTimeout:void 0,Hb=typeof clearTimeout=="function"?clearTimeout:void 0,Sp=typeof Promise=="function"?Promise:void 0,Pb=typeof queueMicrotask=="function"?queueMicrotask:typeof Sp<"u"?function(e){return Sp.resolve(null).then(e).catch($b)}:wp;function $b(e){setTimeout(function(){throw e})}function Us(e){return e==="head"}function Ep(e,t){var i=t,l=0;do{var c=i.nextSibling;if(e.removeChild(i),c&&c.nodeType===8)if(i=c.data,i==="/$"||i==="/&"){if(l===0){e.removeChild(c),dr(t);return}l--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")l++;else if(i==="html")pa(e.ownerDocument.documentElement);else if(i==="head"){i=e.ownerDocument.head,pa(i);for(var u=i.firstChild;u;){var p=u.nextSibling,b=u.nodeName;u[yt]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&u.rel.toLowerCase()==="stylesheet"||i.removeChild(u),u=p}}else i==="body"&&pa(e.ownerDocument.body);i=c}while(i);dr(t)}function Ap(e,t){var i=e;e=0;do{var l=i.nextSibling;if(i.nodeType===1?t?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(t?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),l&&l.nodeType===8)if(i=l.data,i==="/$"){if(e===0)break;e--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||e++;i=l}while(i)}function Vu(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var i=t;switch(t=t.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":Vu(i),Di(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}e.removeChild(i)}}function Yb(e,t,i,l){for(;e.nodeType===1;){var c=i;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[yt])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(u=e.getAttribute("rel"),u==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(u!==c.rel||e.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||e.getAttribute("title")!==(c.title==null?null:c.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(u=e.getAttribute("src"),(u!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&u&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var u=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===u)return e}else return e;if(e=mn(e.nextSibling),e===null)break}return null}function Gb(e,t,i){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=mn(e.nextSibling),e===null))return null;return e}function Op(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=mn(e.nextSibling),e===null))return null;return e}function Fu(e){return e.data==="$?"||e.data==="$~"}function Ju(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Vb(e,t){var i=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||i.readyState!=="loading")t();else{var l=function(){t(),i.removeEventListener("DOMContentLoaded",l)};i.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function mn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Qu=null;function jp(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"||i==="/&"){if(t===0)return mn(e.nextSibling);t--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||t++}e=e.nextSibling}return null}function Tp(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(t===0)return e;t--}else i!=="/$"&&i!=="/&"||t++}e=e.previousSibling}return null}function Np(e,t,i){switch(t=Zl(i),e){case"html":if(e=t.documentElement,!e)throw Error(a(452));return e;case"head":if(e=t.head,!e)throw Error(a(453));return e;case"body":if(e=t.body,!e)throw Error(a(454));return e;default:throw Error(a(451))}}function pa(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Di(e)}var pn=new Map,Cp=new Set;function Wl(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var os=te.d;te.d={f:Fb,r:Jb,D:Qb,C:Ib,L:Xb,m:Kb,X:Wb,S:Zb,M:ex};function Fb(){var e=os.f(),t=Gl();return e||t}function Jb(e){var t=S(e);t!==null&&t.tag===5&&t.type==="form"?Jd(t):os.r(e)}var ur=typeof document>"u"?null:document;function kp(e,t,i){var l=ur;if(l&&typeof t=="string"&&t){var c=ln(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof i=="string"&&(c+='[crossorigin="'+i+'"]'),Cp.has(c)||(Cp.add(c),e={rel:e,crossOrigin:i,href:t},l.querySelector(c)===null&&(t=l.createElement("link"),At(t,"link",e),N(t),l.head.appendChild(t)))}}function Qb(e){os.D(e),kp("dns-prefetch",e,null)}function Ib(e,t){os.C(e,t),kp("preconnect",e,t)}function Xb(e,t,i){os.L(e,t,i);var l=ur;if(l&&e&&t){var c='link[rel="preload"][as="'+ln(t)+'"]';t==="image"&&i&&i.imageSrcSet?(c+='[imagesrcset="'+ln(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(c+='[imagesizes="'+ln(i.imageSizes)+'"]')):c+='[href="'+ln(e)+'"]';var u=c;switch(t){case"style":u=fr(e);break;case"script":u=hr(e)}pn.has(u)||(e=w({rel:"preload",href:t==="image"&&i&&i.imageSrcSet?void 0:e,as:t},i),pn.set(u,e),l.querySelector(c)!==null||t==="style"&&l.querySelector(ga(u))||t==="script"&&l.querySelector(ya(u))||(t=l.createElement("link"),At(t,"link",e),N(t),l.head.appendChild(t)))}}function Kb(e,t){os.m(e,t);var i=ur;if(i&&e){var l=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+ln(l)+'"][href="'+ln(e)+'"]',u=c;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=hr(e)}if(!pn.has(u)&&(e=w({rel:"modulepreload",href:e},t),pn.set(u,e),i.querySelector(c)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(ya(u)))return}l=i.createElement("link"),At(l,"link",e),N(l),i.head.appendChild(l)}}}function Zb(e,t,i){os.S(e,t,i);var l=ur;if(l&&e){var c=A(l).hoistableStyles,u=fr(e);t=t||"default";var p=c.get(u);if(!p){var b={loading:0,preload:null};if(p=l.querySelector(ga(u)))b.loading=5;else{e=w({rel:"stylesheet",href:e,"data-precedence":t},i),(i=pn.get(u))&&Iu(e,i);var O=p=l.createElement("link");N(O),At(O,"link",e),O._p=new Promise(function(U,Y){O.onload=U,O.onerror=Y}),O.addEventListener("load",function(){b.loading|=1}),O.addEventListener("error",function(){b.loading|=2}),b.loading|=4,eo(p,t,l)}p={type:"stylesheet",instance:p,count:1,state:b},c.set(u,p)}}}function Wb(e,t){os.X(e,t);var i=ur;if(i&&e){var l=A(i).hoistableScripts,c=hr(e),u=l.get(c);u||(u=i.querySelector(ya(c)),u||(e=w({src:e,async:!0},t),(t=pn.get(c))&&Xu(e,t),u=i.createElement("script"),N(u),At(u,"link",e),i.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(c,u))}}function ex(e,t){os.M(e,t);var i=ur;if(i&&e){var l=A(i).hoistableScripts,c=hr(e),u=l.get(c);u||(u=i.querySelector(ya(c)),u||(e=w({src:e,async:!0,type:"module"},t),(t=pn.get(c))&&Xu(e,t),u=i.createElement("script"),N(u),At(u,"link",e),i.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(c,u))}}function Mp(e,t,i,l){var c=(c=sn.current)?Wl(c):null;if(!c)throw Error(a(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(t=fr(i.href),i=A(c).hoistableStyles,l=i.get(t),l||(l={type:"style",instance:null,count:0,state:null},i.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){e=fr(i.href);var u=A(c).hoistableStyles,p=u.get(e);if(p||(c=c.ownerDocument||c,p={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,p),(u=c.querySelector(ga(e)))&&!u._p&&(p.instance=u,p.state.loading=5),pn.has(e)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},pn.set(e,i),u||tx(c,e,i,p.state))),t&&l===null)throw Error(a(528,""));return p}if(t&&l!==null)throw Error(a(529,""));return null;case"script":return t=i.async,i=i.src,typeof i=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=hr(i),i=A(c).hoistableScripts,l=i.get(t),l||(l={type:"script",instance:null,count:0,state:null},i.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,e))}}function fr(e){return'href="'+ln(e)+'"'}function ga(e){return'link[rel="stylesheet"]['+e+"]"}function Rp(e){return w({},e,{"data-precedence":e.precedence,precedence:null})}function tx(e,t,i,l){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=e.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),At(t,"link",i),N(t),e.head.appendChild(t))}function hr(e){return'[src="'+ln(e)+'"]'}function ya(e){return"script[async]"+e}function Dp(e,t,i){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+ln(i.href)+'"]');if(l)return t.instance=l,N(l),l;var c=w({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),N(l),At(l,"style",c),eo(l,i.precedence,e),t.instance=l;case"stylesheet":c=fr(i.href);var u=e.querySelector(ga(c));if(u)return t.state.loading|=4,t.instance=u,N(u),u;l=Rp(i),(c=pn.get(c))&&Iu(l,c),u=(e.ownerDocument||e).createElement("link"),N(u);var p=u;return p._p=new Promise(function(b,O){p.onload=b,p.onerror=O}),At(u,"link",l),t.state.loading|=4,eo(u,i.precedence,e),t.instance=u;case"script":return u=hr(i.src),(c=e.querySelector(ya(u)))?(t.instance=c,N(c),c):(l=i,(c=pn.get(u))&&(l=w({},i),Xu(l,c)),e=e.ownerDocument||e,c=e.createElement("script"),N(c),At(c,"link",l),e.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(a(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,eo(l,i.precedence,e));return t.instance}function eo(e,t,i){for(var l=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=l.length?l[l.length-1]:null,u=c,p=0;p<l.length;p++){var b=l[p];if(b.dataset.precedence===t)u=b;else if(u!==c)break}u?u.parentNode.insertBefore(e,u.nextSibling):(t=i.nodeType===9?i.head:i,t.insertBefore(e,t.firstChild))}function Iu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Xu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var to=null;function zp(e,t,i){if(to===null){var l=new Map,c=to=new Map;c.set(i,l)}else c=to,l=c.get(i),l||(l=new Map,c.set(i,l));if(l.has(e))return l;for(l.set(e,null),i=i.getElementsByTagName(e),c=0;c<i.length;c++){var u=i[c];if(!(u[yt]||u[Qe]||e==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var p=u.getAttribute(t)||"";p=e+p;var b=l.get(p);b?b.push(u):l.set(p,[u])}}return l}function qp(e,t,i){e=e.ownerDocument||e,e.head.insertBefore(i,t==="title"?e.querySelector("head > title"):null)}function nx(e,t,i){if(i===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Up(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function sx(e,t,i,l){if(i.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var c=fr(l.href),u=t.querySelector(ga(c));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=no.bind(e),t.then(e,e)),i.state.loading|=4,i.instance=u,N(u);return}u=t.ownerDocument||t,l=Rp(l),(c=pn.get(c))&&Iu(l,c),u=u.createElement("link"),N(u);var p=u;p._p=new Promise(function(b,O){p.onload=b,p.onerror=O}),At(u,"link",l),i.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(i,t),(t=i.state.preload)&&(i.state.loading&3)===0&&(e.count++,i=no.bind(e),t.addEventListener("load",i),t.addEventListener("error",i))}}var Ku=0;function ix(e,t){return e.stylesheets&&e.count===0&&io(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var l=setTimeout(function(){if(e.stylesheets&&io(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&Ku===0&&(Ku=62500*Bb());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&io(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>Ku?50:800)+t);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(c)}}:null}function no(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)io(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var so=null;function io(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,so=new Map,t.forEach(rx,e),so=null,no.call(e))}function rx(e,t){if(!(t.state.loading&4)){var i=so.get(e);if(i)var l=i.get(null);else{i=new Map,so.set(e,i);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<c.length;u++){var p=c[u];(p.nodeName==="LINK"||p.getAttribute("media")!=="not all")&&(i.set(p.dataset.precedence,p),l=p)}l&&i.set(null,l)}c=t.instance,p=c.getAttribute("data-precedence"),u=i.get(p)||l,u===l&&i.set(null,c),i.set(p,c),this.count++,l=no.bind(this),c.addEventListener("load",l),c.addEventListener("error",l),u?u.parentNode.insertBefore(c,u.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(c,e.firstChild)),t.state.loading|=4}}var ba={$$typeof:pe,Provider:null,Consumer:null,_currentValue:de,_currentValue2:de,_threadCount:0};function ax(e,t,i,l,c,u,p,b,O){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=gs(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gs(0),this.hiddenUpdates=gs(null),this.identifierPrefix=l,this.onUncaughtError=c,this.onCaughtError=u,this.onRecoverableError=p,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=O,this.incompleteTransitions=new Map}function Bp(e,t,i,l,c,u,p,b,O,U,Y,I){return e=new ax(e,t,i,p,O,U,Y,I,b),t=1,u===!0&&(t|=24),u=Vt(3,null,null,t),e.current=u,u.stateNode=e,t=Cc(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:l,isDehydrated:i,cache:t},Dc(u),e}function Lp(e){return e?(e=Yi,e):Yi}function Hp(e,t,i,l,c,u){c=Lp(c),l.context===null?l.context=c:l.pendingContext=c,l=Os(t),l.payload={element:i},u=u===void 0?null:u,u!==null&&(l.callback=u),i=js(e,l,t),i!==null&&(Ht(i,e,t),Xr(i,e,t))}function Pp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<t?i:t}}function Zu(e,t){Pp(e,t),(e=e.alternate)&&Pp(e,t)}function $p(e){if(e.tag===13||e.tag===31){var t=fi(e,67108864);t!==null&&Ht(t,e,67108864),Zu(e,67108864)}}function Yp(e){if(e.tag===13||e.tag===31){var t=Xt();t=Gn(t);var i=fi(e,t);i!==null&&Ht(i,e,t),Zu(e,t)}}var ro=!0;function lx(e,t,i,l){var c=$.T;$.T=null;var u=te.p;try{te.p=2,Wu(e,t,i,l)}finally{te.p=u,$.T=c}}function ox(e,t,i,l){var c=$.T;$.T=null;var u=te.p;try{te.p=8,Wu(e,t,i,l)}finally{te.p=u,$.T=c}}function Wu(e,t,i,l){if(ro){var c=ef(l);if(c===null)Lu(e,t,l,ao,i),Vp(e,l);else if(ux(c,e,t,i,l))l.stopPropagation();else if(Vp(e,l),t&4&&-1<cx.indexOf(e)){for(;c!==null;){var u=S(c);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var p=xn(u.pendingLanes);if(p!==0){var b=u;for(b.pendingLanes|=2,b.entangledLanes|=2;p;){var O=1<<31-Nt(p);b.entanglements[1]|=O,p&=~O}Dn(u),(He&6)===0&&($l=et()+500,ha(0))}}break;case 31:case 13:b=fi(u,2),b!==null&&Ht(b,u,2),Gl(),Zu(u,2)}if(u=ef(l),u===null&&Lu(e,t,l,ao,i),u===c)break;c=u}c!==null&&l.stopPropagation()}else Lu(e,t,l,null,i)}}function ef(e){return e=nc(e),tf(e)}var ao=null;function tf(e){if(ao=null,e=x(e),e!==null){var t=f(e);if(t===null)e=null;else{var i=t.tag;if(i===13){if(e=h(t),e!==null)return e;e=null}else if(i===31){if(e=d(t),e!==null)return e;e=null}else if(i===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return ao=e,null}function Gp(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(Qo()){case Ia:return 2;case Xa:return 8;case ki:case Io:return 32;case Ka:return 268435456;default:return 32}default:return 32}}var nf=!1,Bs=null,Ls=null,Hs=null,xa=new Map,va=new Map,Ps=[],cx="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 Vp(e,t){switch(e){case"focusin":case"focusout":Bs=null;break;case"dragenter":case"dragleave":Ls=null;break;case"mouseover":case"mouseout":Hs=null;break;case"pointerover":case"pointerout":xa.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":va.delete(t.pointerId)}}function _a(e,t,i,l,c,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:i,eventSystemFlags:l,nativeEvent:u,targetContainers:[c]},t!==null&&(t=S(t),t!==null&&$p(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function ux(e,t,i,l,c){switch(t){case"focusin":return Bs=_a(Bs,e,t,i,l,c),!0;case"dragenter":return Ls=_a(Ls,e,t,i,l,c),!0;case"mouseover":return Hs=_a(Hs,e,t,i,l,c),!0;case"pointerover":var u=c.pointerId;return xa.set(u,_a(xa.get(u)||null,e,t,i,l,c)),!0;case"gotpointercapture":return u=c.pointerId,va.set(u,_a(va.get(u)||null,e,t,i,l,c)),!0}return!1}function Fp(e){var t=x(e.target);if(t!==null){var i=f(t);if(i!==null){if(t=i.tag,t===13){if(t=h(i),t!==null){e.blockedOn=t,Wa(e.priority,function(){Yp(i)});return}}else if(t===31){if(t=d(i),t!==null){e.blockedOn=t,Wa(e.priority,function(){Yp(i)});return}}else if(t===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function lo(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var i=ef(e.nativeEvent);if(i===null){i=e.nativeEvent;var l=new i.constructor(i.type,i);tc=l,i.target.dispatchEvent(l),tc=null}else return t=S(i),t!==null&&$p(t),e.blockedOn=i,!1;t.shift()}return!0}function Jp(e,t,i){lo(e)&&i.delete(t)}function fx(){nf=!1,Bs!==null&&lo(Bs)&&(Bs=null),Ls!==null&&lo(Ls)&&(Ls=null),Hs!==null&&lo(Hs)&&(Hs=null),xa.forEach(Jp),va.forEach(Jp)}function oo(e,t){e.blockedOn===t&&(e.blockedOn=null,nf||(nf=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,fx)))}var co=null;function Qp(e){co!==e&&(co=e,r.unstable_scheduleCallback(r.unstable_NormalPriority,function(){co===e&&(co=null);for(var t=0;t<e.length;t+=3){var i=e[t],l=e[t+1],c=e[t+2];if(typeof l!="function"){if(tf(l||i)===null)continue;break}var u=S(i);u!==null&&(e.splice(t,3),t-=3,eu(u,{pending:!0,data:c,method:i.method,action:l},l,c))}}))}function dr(e){function t(O){return oo(O,e)}Bs!==null&&oo(Bs,e),Ls!==null&&oo(Ls,e),Hs!==null&&oo(Hs,e),xa.forEach(t),va.forEach(t);for(var i=0;i<Ps.length;i++){var l=Ps[i];l.blockedOn===e&&(l.blockedOn=null)}for(;0<Ps.length&&(i=Ps[0],i.blockedOn===null);)Fp(i),i.blockedOn===null&&Ps.shift();if(i=(e.ownerDocument||e).$$reactFormReplay,i!=null)for(l=0;l<i.length;l+=3){var c=i[l],u=i[l+1],p=c[it]||null;if(typeof u=="function")p||Qp(i);else if(p){var b=null;if(u&&u.hasAttribute("formAction")){if(c=u,p=u[it]||null)b=p.formAction;else if(tf(c)!==null)continue}else b=p.action;typeof b=="function"?i[l+1]=b:(i.splice(l,3),l-=3),Qp(i)}}}function Ip(){function e(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(p){return c=p})},focusReset:"manual",scroll:"manual"})}function t(){c!==null&&(c(),c=null),l||setTimeout(i,20)}function i(){if(!l&&!navigation.transition){var u=navigation.currentEntry;u&&u.url!=null&&navigation.navigate(u.url,{state:u.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,c=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(i,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),c!==null&&(c(),c=null)}}}function sf(e){this._internalRoot=e}uo.prototype.render=sf.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(a(409));var i=t.current,l=Xt();Hp(i,l,e,t,null,null)},uo.prototype.unmount=sf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Hp(e.current,2,null,e,null,null),Gl(),t[Yt]=null}};function uo(e){this._internalRoot=e}uo.prototype.unstable_scheduleHydration=function(e){if(e){var t=Rr();e={blockedOn:null,target:e,priority:t};for(var i=0;i<Ps.length&&t!==0&&t<Ps[i].priority;i++);Ps.splice(i,0,e),i===0&&Fp(e)}};var Xp=n.version;if(Xp!=="19.2.4")throw Error(a(527,Xp,"19.2.4"));te.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(a(188)):(e=Object.keys(e).join(","),Error(a(268,e)));return e=y(t),e=e!==null?E(e):null,e=e===null?null:e.stateNode,e};var hx={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:$,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var fo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!fo.isDisabled&&fo.supportsFiber)try{ni=fo.inject(hx),ot=fo}catch{}}return wa.createRoot=function(e,t){if(!o(e))throw Error(a(299));var i=!1,l="",c=sm,u=im,p=rm;return t!=null&&(t.unstable_strictMode===!0&&(i=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(c=t.onUncaughtError),t.onCaughtError!==void 0&&(u=t.onCaughtError),t.onRecoverableError!==void 0&&(p=t.onRecoverableError)),t=Bp(e,1,!1,null,null,i,l,null,c,u,p,Ip),e[Yt]=t.current,Bu(e),new sf(t)},wa.hydrateRoot=function(e,t,i){if(!o(e))throw Error(a(299));var l=!1,c="",u=sm,p=im,b=rm,O=null;return i!=null&&(i.unstable_strictMode===!0&&(l=!0),i.identifierPrefix!==void 0&&(c=i.identifierPrefix),i.onUncaughtError!==void 0&&(u=i.onUncaughtError),i.onCaughtError!==void 0&&(p=i.onCaughtError),i.onRecoverableError!==void 0&&(b=i.onRecoverableError),i.formState!==void 0&&(O=i.formState)),t=Bp(e,1,!0,t,i??null,l,c,O,u,p,b,Ip),t.context=Lp(null),i=t.current,l=Xt(),l=Gn(l),c=Os(l),c.callback=null,js(i,c,l),i=l,t.current.lanes=i,vn(t,i),Dn(t),e[Yt]=t.current,Bu(e),new uo(t)},wa.version="19.2.4",wa}var t0;function lv(){if(t0)return rf.exports;t0=1;function r(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(n){console.error(n)}}return r(),rf.exports=av(),rf.exports}var ov=lv();const cv="modulepreload",uv=function(r,n){return new URL(r,n).href},n0={},Ae=function(n,s,a){let o=Promise.resolve();if(s&&s.length>0){let h=function(E){return Promise.all(E.map(w=>Promise.resolve(w).then(j=>({status:"fulfilled",value:j}),j=>({status:"rejected",reason:j}))))};const d=document.getElementsByTagName("link"),g=document.querySelector("meta[property=csp-nonce]"),y=(g==null?void 0:g.nonce)||(g==null?void 0:g.getAttribute("nonce"));o=h(s.map(E=>{if(E=uv(E,a),E in n0)return;n0[E]=!0;const w=E.endsWith(".css"),j=w?'[rel="stylesheet"]':"";if(!!a)for(let B=d.length-1;B>=0;B--){const V=d[B];if(V.href===E&&(!w||V.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${E}"]${j}`))return;const M=document.createElement("link");if(M.rel=w?"stylesheet":cv,w||(M.as="script"),M.crossOrigin="",M.href=E,y&&M.setAttribute("nonce",y),document.head.appendChild(M),w)return new Promise((B,V)=>{M.addEventListener("load",B),M.addEventListener("error",()=>V(new Error(`Unable to preload CSS for ${E}`)))})}))}function f(h){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=h,window.dispatchEvent(d),!d.defaultPrevented)throw h}return o.then(h=>{for(const d of h||[])d.status==="rejected"&&f(d.reason);return n().catch(f)})};function cg(r){try{const n=r.split(".");if(n.length!==3)return null;const s=atob(n[1].replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(s)}catch{return null}}function ug(r){const n=cg(r);return!n||typeof n.exp!="number"?null:n.exp}function Qf(r,n=0){const s=ug(r);return s===null?!0:Date.now()/1e3>=s-n}const Bn=window.__LT_BASE__??"",Sf=`${Bn}/api`;let Vs=null;function ho(r){Vs=r}function fg(){return Vs}async function s0(){const r=sessionStorage.getItem("lt_credentials");if(!r)return null;try{const{username:n,password:s}=JSON.parse(r),a=await fetch(`${Sf}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:n,password:s})});if(!a.ok)return null;const o=await a.json();return o.token&&o.user&&sessionStorage.setItem("lt_user_info",JSON.stringify({displayName:o.user.display_name,username:o.user.external_id})),o.token??null}catch{return null}}let Ys=null;async function Xe(r,n={}){const s={"Content-Type":"application/json",...n.headers};if(Vs){if(Qf(Vs)){Ys||(Ys=s0().finally(()=>{Ys=null}));const o=await Ys;if(o)Vs=o,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:o}}));else throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}s.Authorization=`Bearer ${Vs}`}let a=await fetch(`${Sf}${r}`,{...n,headers:s});if(a.status===401&&Vs){Ys||(Ys=s0().finally(()=>{Ys=null}));const o=await Ys;if(o&&(Vs=o,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:o}})),s.Authorization=`Bearer ${o}`,a=await fetch(`${Sf}${r}`,{...n,headers:s})),a.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}else if(a.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired");if(!a.ok){const o=await a.json().catch(()=>({error:a.statusText}));throw new Error(o.message||o.error||a.statusText)}return a.json()}const hg=T.createContext(null),fv=300;function of(r,n){if(Qf(r))return null;const s=cg(r);if(!s)return null;const a=n??(()=>{try{const o=sessionStorage.getItem("lt_user_info");return o?JSON.parse(o):null}catch{return null}})();return{userId:s.userId,displayName:(a==null?void 0:a.displayName)??null,username:(a==null?void 0:a.username)??null,roles:s.roles??[]}}function hv({children:r}){const[n,s]=T.useState(()=>{const w=sessionStorage.getItem("lt_token");return w?Qf(w)?(sessionStorage.removeItem("lt_token"),null):(ho(w),of(w)):null}),a=T.useRef(void 0),o=T.useCallback(w=>{clearTimeout(a.current);const j=ug(w);if(!j)return;const z=(j-fv)*1e3-Date.now();z<=0||(a.current=setTimeout(async()=>{const M=sessionStorage.getItem("lt_credentials");if(M)try{const{username:B,password:V}=JSON.parse(M),ne=await fetch(`${Bn}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:B,password:V})});if(!ne.ok)return;const ee=await ne.json();ee.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:ee.token}}))}catch{}},z))},[]),f=T.useCallback((w,j,z)=>{const M={displayName:(z==null?void 0:z.displayName)??null,username:(z==null?void 0:z.username)??(j==null?void 0:j.username)??null},B=of(w,M);B&&(ho(w),sessionStorage.setItem("lt_token",w),sessionStorage.setItem("lt_user_info",JSON.stringify(M)),j&&sessionStorage.setItem("lt_credentials",JSON.stringify(j)),s(B),o(w))},[o]),h=T.useCallback(()=>{clearTimeout(a.current),ho(null),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info"),s(null)},[]);T.useEffect(()=>{const w=()=>h(),j=z=>{var V;const M=(V=z.detail)==null?void 0:V.token;if(!M)return;const B=of(M);B&&(ho(M),sessionStorage.setItem("lt_token",M),s(B),o(M))};return window.addEventListener("auth:unauthorized",w),window.addEventListener("auth:refreshed",j),()=>{window.removeEventListener("auth:unauthorized",w),window.removeEventListener("auth:refreshed",j)}},[h,o]),T.useEffect(()=>{const w=sessionStorage.getItem("lt_token");return w&&n&&o(w),()=>clearTimeout(a.current)},[]);const d=(n==null?void 0:n.roles.some(w=>w.type==="superadmin"))??!1,g=T.useCallback(w=>(n==null?void 0:n.roles.some(j=>j.role===w))??!1,[n]),y=T.useCallback(w=>(n==null?void 0:n.roles.some(j=>j.type===w))??!1,[n]),E=(n==null?void 0:n.roles.map(w=>w.role))??[];return m.jsx(hg.Provider,{value:{user:n,isAuthenticated:!!n,isSuperAdmin:d,login:f,logout:h,hasRole:g,hasRoleType:y,userRoleNames:E},children:r})}function Oi(){const r=T.useContext(hg);if(!r)throw new Error("useAuth must be used within AuthProvider");return r}const tn=new Uint8Array(0),ji=new TextEncoder,Wt=new TextDecoder;function dv(...r){let n=0;for(let o=0;o<r.length;o++)n+=r[o].length;const s=new Uint8Array(n);let a=0;for(let o=0;o<r.length;o++)s.set(r[o],a),a+=r[o].length;return s}function ka(...r){const n=[];for(let s=0;s<r.length;s++)n.push(ji.encode(r[s]));return n.length===0?tn:n.length===1?n[0]:dv(...n)}function i0(r){return!r||r.length===0?"":Wt.decode(r)}const r0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",a0=36,mv=0xcfd41b9100000,l0=33,pv=333,o0=22;function gv(r){for(let n=0;n<r.length;n++)r[n]=Math.floor(Math.random()*255)}function yv(r){var n;(n=globalThis==null?void 0:globalThis.crypto)!=null&&n.getRandomValues?globalThis.crypto.getRandomValues(r):gv(r)}class bv{constructor(){v(this,"buf");v(this,"seq");v(this,"inc");v(this,"inited");this.buf=new Uint8Array(o0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*mv),this.inc=Math.floor(Math.random()*(pv-l0)+l0)}setPre(){const n=new Uint8Array(12);yv(n);for(let s=0;s<12;s++){const a=n[s]%36;this.buf[s]=r0.charCodeAt(a)}}fillSeq(){let n=this.seq;for(let s=o0-1;s>=12;s--)this.buf[s]=r0.charCodeAt(n%a0),n=Math.floor(n/a0)}next(){return this.inited||this.init(),this.seq+=this.inc,this.seq>0xcfd41b9100000&&(this.setPre(),this.initSeqAndInc()),this.fillSeq(),String.fromCharCode.apply(String,this.buf)}reset(){this.init()}}const Ks=new bv;var cs;(function(r){r.Disconnect="disconnect",r.Reconnect="reconnect",r.Update="update",r.LDM="ldm",r.Error="error"})(cs||(cs={}));var br;(function(r){r.Reconnecting="reconnecting",r.PingTimer="pingTimer",r.StaleConnection="staleConnection",r.ClientInitiatedReconnect="client initiated reconnect"})(br||(br={}));var ie;(function(r){r.ApiError="BAD API",r.BadAuthentication="BAD_AUTHENTICATION",r.BadCreds="BAD_CREDS",r.BadHeader="BAD_HEADER",r.BadJson="BAD_JSON",r.BadPayload="BAD_PAYLOAD",r.BadSubject="BAD_SUBJECT",r.Cancelled="CANCELLED",r.ConnectionClosed="CONNECTION_CLOSED",r.ConnectionDraining="CONNECTION_DRAINING",r.ConnectionRefused="CONNECTION_REFUSED",r.ConnectionTimeout="CONNECTION_TIMEOUT",r.Disconnect="DISCONNECT",r.InvalidOption="INVALID_OPTION",r.InvalidPayload="INVALID_PAYLOAD",r.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",r.NoResponders="503",r.NotFunction="NOT_FUNC",r.RequestError="REQUEST_ERROR",r.ServerOptionNotAvailable="SERVER_OPT_NA",r.SubClosed="SUB_CLOSED",r.SubDraining="SUB_DRAINING",r.Timeout="TIMEOUT",r.Tls="TLS",r.Unknown="UNKNOWN_ERROR",r.WssRequired="WSS_REQUIRED",r.JetStreamInvalidAck="JESTREAM_INVALID_ACK",r.JetStream404NoMessages="404",r.JetStream408RequestTimeout="408",r.JetStream409MaxAckPendingExceeded="409",r.JetStream409="409",r.JetStreamNotEnabled="503",r.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",r.AuthorizationViolation="AUTHORIZATION_VIOLATION",r.AuthenticationExpired="AUTHENTICATION_EXPIRED",r.ProtocolError="NATS_PROTOCOL_ERR",r.PermissionsViolation="PERMISSIONS_VIOLATION",r.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",r.AccountExpired="ACCOUNT_EXPIRED"})(ie||(ie={}));function xv(r){return typeof r.code=="string"}class dg{constructor(){v(this,"messages");this.messages=new Map,this.messages.set(ie.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(ie.BadJson,"Bad JSON"),this.messages.set(ie.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(n){return vv.getMessage(n)}getMessage(n){return this.messages.get(n)||n}}const vv=new dg;class ue extends Error{constructor(s,a,o){super(s);v(this,"name");v(this,"message");v(this,"code");v(this,"permissionContext");v(this,"chainedError");v(this,"api_error");this.name="NatsError",this.message=s,this.code=a,this.chainedError=o}static errorForCode(s,a){const o=dg.getMessage(s);return new ue(o,s,a)}isAuthError(){return this.code===ie.AuthenticationExpired||this.code===ie.AuthorizationViolation||this.code===ie.AccountExpired}isAuthTimeout(){return this.code===ie.AuthenticationTimeout}isPermissionError(){return this.code===ie.PermissionsViolation}isProtocolError(){return this.code===ie.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var Kt;(function(r){r[r.Exact=0]="Exact",r[r.CanonicalMIME=1]="CanonicalMIME",r[r.IgnoreCase=2]="IgnoreCase"})(Kt||(Kt={}));var jn;(function(r){r.Timer="timer",r.Count="count",r.JitterTimer="jitterTimer",r.SentinelMsg="sentinelMsg"})(jn||(jn={}));var Ma;(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"})(Ma||(Ma={}));const Co="Nats-Service-Error",ko="Nats-Service-Error-Code";class Mo extends Error{constructor(s,a){super(a);v(this,"code");this.code=s}static isServiceError(s){return Mo.toServiceError(s)!==null}static toServiceError(s){var o,f;const a=((o=s==null?void 0:s.headers)==null?void 0:o.get(ko))||"";if(a!==""){const h=parseInt(a)||400,d=((f=s==null?void 0:s.headers)==null?void 0:f.get(Co))||"";return new Mo(h,d.length?d:a)}return null}}function us(r=""){if(r=r||"_INBOX",typeof r!="string")throw new Error("prefix must be a string");return r.split(".").forEach(n=>{if(n==="*"||n===">")throw new Error(`inbox prefixes cannot have wildcards '${r}'`)}),`${r}.${Ks.next()}`}const Ef="127.0.0.1";var Js;(function(r){r.PING="PING",r.STATS="STATS",r.INFO="INFO"})(Js||(Js={}));function $o(r,...n){for(let s=0;s<n.length;s++){const a=n[s];Object.keys(a).forEach(function(o){r[o]=a[o]})}return r}function mo(r){return Wt.decode(r).replace(/\n/g,"␊").replace(/\r/g,"␍")}function Sr(r,n=!0){const s=n?ue.errorForCode(ie.Timeout):null;let a,o;const f=new Promise((h,d)=>{a={cancel:()=>{o&&clearTimeout(o)}},o=setTimeout(()=>{d(s===null?ue.errorForCode(ie.Timeout):s)},r)});return Object.assign(f,a)}function Or(r=0){let n;const s=new Promise(a=>{const o=setTimeout(()=>{a()},r);n={cancel:()=>{o&&clearTimeout(o)}}});return Object.assign(s,n)}function st(){let r={};const n=new Promise((s,a)=>{r={resolve:s,reject:a}});return Object.assign(n,r)}function mg(r){for(let n=r.length-1;n>0;n--){const s=Math.floor(Math.random()*(n+1));[r[n],r[s]]=[r[s],r[n]]}return r}function _v(r){return r===0?0:Math.floor(r/2+Math.random()*r)}function If(r=[0,250,250,500,500,3e3,5e3]){Array.isArray(r)||(r=[0,250,250,500,500,3e3,5e3]);const n=r.length-1;return{backoff(s){return _v(s>n?r[n]:r[s])}}}function nt(r){return r*1e6}function Xf(r){return Math.floor(r/1e6)}function c0(r){let a=!0;const o=new Array(r.length);for(let f=0;f<r.length;f++){let h=r.charCodeAt(f);if(h===58||h<33||h>126)throw new ue(`'${r[f]}' is not a valid character for a header key`,ie.BadHeader);a&&97<=h&&h<=122?h-=32:!a&&65<=h&&h<=90&&(h+=32),o[f]=h,a=h==45}return String.fromCharCode(...o)}function fs(r=0,n=""){if(r===0&&n!==""||r>0&&n==="")throw new Error("setting status requires both code and description");return new Qs(r,n)}const cf="NATS/1.0";class Qs{constructor(n=0,s=""){v(this,"_code");v(this,"headers");v(this,"_description");this._code=n,this._description=s,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(n){if(n&&this.headers.size===n.headers.size&&this._code===n._code){for(const[s,a]of this.headers){const o=n.values(s);if(a.length!==o.length)return!1;const f=[...a].sort(),h=[...o].sort();for(let d=0;d<f.length;d++)if(f[d]!==h[d])return!1}return!0}return!1}static decode(n){const s=new Qs,o=Wt.decode(n).split(`\r
|
|
27
|
+
`),f=o[0];if(f!==cf){let h=f.replace(cf,"").trim();if(h.length>0){s._code=parseInt(h,10),isNaN(s._code)&&(s._code=0);const d=s._code.toString();h=h.replace(d,""),s._description=h.trim()}}return o.length>=1&&o.slice(1).map(h=>{if(h){const d=h.indexOf(":");if(d>-1){const g=h.slice(0,d),y=h.slice(d+1).trim();s.append(g,y)}}}),s}toString(){if(this.headers.size===0&&this._code===0)return"";let n=cf;this._code>0&&this._description!==""&&(n+=` ${this._code} ${this._description}`);for(const[s,a]of this.headers)for(let o=0;o<a.length;o++)n=`${n}\r
|
|
28
28
|
${s}: ${a[o]}`;return`${n}\r
|
|
29
29
|
\r
|
|
30
|
-
`}encode(){return ji.encode(this.toString())}static validHeaderValue(n){if(/[\r\n]/.test(n))throw new ue("invalid header value - \\r and \\n are not allowed.",ie.BadHeader);return n.trim()}keys(){const n=[];for(const s of this.headers.keys())n.push(s);return n}findKeys(n,s=Kt.Exact){const a=this.keys();switch(s){case Kt.Exact:return a.filter(o=>o===n);case Kt.CanonicalMIME:return n=
|
|
30
|
+
`}encode(){return ji.encode(this.toString())}static validHeaderValue(n){if(/[\r\n]/.test(n))throw new ue("invalid header value - \\r and \\n are not allowed.",ie.BadHeader);return n.trim()}keys(){const n=[];for(const s of this.headers.keys())n.push(s);return n}findKeys(n,s=Kt.Exact){const a=this.keys();switch(s){case Kt.Exact:return a.filter(o=>o===n);case Kt.CanonicalMIME:return n=c0(n),a.filter(o=>o===n);default:{const o=n.toLowerCase();return a.filter(f=>o===f.toLowerCase())}}}get(n,s=Kt.Exact){const a=this.findKeys(n,s);if(a.length){const o=this.headers.get(a[0]);if(o)return Array.isArray(o)?o[0]:o}return""}last(n,s=Kt.Exact){const a=this.findKeys(n,s);if(a.length){const o=this.headers.get(a[0]);if(o)return Array.isArray(o)?o[o.length-1]:o}return""}has(n,s=Kt.Exact){return this.findKeys(n,s).length>0}set(n,s,a=Kt.Exact){this.delete(n,a),this.append(n,s,a)}append(n,s,a=Kt.Exact){const o=c0(n);a===Kt.CanonicalMIME&&(n=o);const f=this.findKeys(n,a);n=f.length>0?f[0]:n;const h=Qs.validHeaderValue(s);let d=this.headers.get(n);d||(d=[],this.headers.set(n,d)),d.push(h)}values(n,s=Kt.Exact){const a=[];return this.findKeys(n,s).forEach(f=>{const h=this.headers.get(f);h&&a.push(...h)}),a}delete(n,s=Kt.Exact){this.findKeys(n,s).forEach(o=>{this.headers.delete(o)})}get hasError(){return this._code>=300}get status(){return`${this._code} ${this._description}`.trim()}toRecord(){const n={};return this.keys().forEach(s=>{n[s]=this.values(s)}),n}get code(){return this._code}get description(){return this._description}static fromRecord(n){const s=new Qs;for(const a in n)s.headers.set(a,n[a]);return s}}function Af(){return{encode(r){return ji.encode(r)},decode(r){return Wt.decode(r)}}}function Tn(r){return{encode(n){try{return n===void 0&&(n=null),ji.encode(JSON.stringify(n))}catch(s){throw ue.errorForCode(ie.BadJson,s)}},decode(n){try{return JSON.parse(Wt.decode(n),r)}catch(s){throw ue.errorForCode(ie.BadJson,s)}}}}function pg(r){var n;return r&&r.data.length===0&&((n=r.headers)==null?void 0:n.code)===503?ue.errorForCode(ie.NoResponders):null}class Kf{constructor(n,s,a){v(this,"_headers");v(this,"_msg");v(this,"_rdata");v(this,"_reply");v(this,"_subject");v(this,"publisher");this._msg=n,this._rdata=s,this.publisher=a}get subject(){return this._subject?this._subject:(this._subject=Wt.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=Wt.decode(this._msg.reply),this._reply)}get sid(){return this._msg.sid}get headers(){if(this._msg.hdr>-1&&!this._headers){const n=this._rdata.subarray(0,this._msg.hdr);this._headers=Qs.decode(n)}return this._headers}get data(){return this._rdata?this._msg.hdr>-1?this._rdata.subarray(this._msg.hdr):this._rdata:new Uint8Array(0)}respond(n=tn,s){return this.reply?(this.publisher.publish(this.reply,n,s),!0):!1}size(){var o;const n=this._msg.subject.length,s=((o=this._msg.reply)==null?void 0:o.length)||0,a=this._msg.size===-1?0:this._msg.size;return n+s+a}json(n){return Tn(n).decode(this.data)}string(){return Wt.decode(this.data)}requestInfo(){var s;const n=(s=this.headers)==null?void 0:s.get("Nats-Request-Info");return n?JSON.parse(n,function(a,o){return(a==="start"||a==="stop")&&o!==""?new Date(Date.parse(o)):o}):null}}v(Kf,"jc");function xr(r){return Yo("durable",r)}function Mt(r){return Yo("stream",r)}function Yo(r,n=""){if(n==="")throw Error(`${r} name required`);return[".","*",">","/","\\"," "," ",`
|
|
31
31
|
`,"\r"].forEach(a=>{if(n.indexOf(a)!==-1){switch(a){case`
|
|
32
|
-
`:a="\\n";break;case"\r":a="\\r";break;case" ":a="\\t";break}throw Error(`invalid ${r} name - ${r} name cannot contain '${a}'`)}}),""}function Ta(r,n=""){if(n==="")throw Error(`${r} name required`);const s=yv(n);if(s.length)throw new Error(`invalid ${r} name - ${r} name ${s}`)}function yv(r=""){if(r==="")throw Error("name required");const n=/^[-\w]+$/g;if(r.match(n)===null){for(const a of r.split(""))if(a.match(n)===null)return`cannot contain '${a}'`}return""}function Nf(r){if(r.data.length>0)return!1;const n=r.headers;return n?n.code>=100&&n.code<200:!1}function Cf(r){var n;return Nf(r)&&((n=r.headers)==null?void 0:n.description)==="Idle Heartbeat"}function bv(r,n,s){const a=fs(r,n),o={hdr:1,sid:0,size:0},f=new eh(o,tn,{});return f._headers=a,f._subject=s,f}function vr(r){if(r.data.length!==0)return null;const n=r.headers;return n?xg(n.code,n.description):null}var yn;(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"})(yn||(yn={}));function xv(r){return r.code!==ie.JetStream409?!1:[yn.MaxBatchExceeded,yn.MaxExpiresExceeded,yn.MaxBytesExceeded,yn.MaxMessageSizeExceeded,yn.PushConsumer,yn.IdleHeartbeatMissed,yn.ConsumerDeleted].find(s=>r.message.indexOf(s)!==-1)!==void 0}function xg(r,n=""){if(r<300)return null;switch(n=n.toLowerCase(),r){case 404:return new ue(n,ie.JetStream404NoMessages);case 408:return new ue(n,ie.JetStream408RequestTimeout);case 409:{const s=n.startsWith(yn.IdleHeartbeatMissed)?ie.JetStreamIdleHeartBeat:ie.JetStream409;return new ue(n,s)}case 503:return ue.errorForCode(ie.JetStreamNotEnabled,new Error(n));default:return n===""&&(n=ie.Unknown),new ue(n,`${r}`)}}class _t{constructor(){v(this,"inflight");v(this,"processed");v(this,"received");v(this,"noIterator");v(this,"iterClosed");v(this,"done");v(this,"signal");v(this,"yields");v(this,"filtered");v(this,"pendingFiltered");v(this,"ingestionFilterFn");v(this,"protocolFilterFn");v(this,"dispatchedFn");v(this,"ctx");v(this,"_data");v(this,"err");v(this,"time");v(this,"yielding");this.inflight=0,this.filtered=0,this.pendingFiltered=0,this.processed=0,this.received=0,this.noIterator=!1,this.done=!1,this.signal=st(),this.yields=[],this.iterClosed=st(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(n){if(this.done)return;if(typeof n=="function"){this.yields.push(n),this.signal.resolve();return}const{ingest:s,protocol:a}=this.ingestionFilterFn?this.ingestionFilterFn(n,this.ctx||this):{ingest:!0,protocol:!1};s&&(a&&(this.filtered++,this.pendingFiltered++),this.yields.push(n),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new ue("unsupported iterator",ie.ApiError);if(this.yielding)throw new ue("already yielding",ie.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const n=this.yields;this.inflight=n.length,this.yields=[];for(let s=0;s<n.length;s++){if(typeof n[s]=="function"){const o=n[s];try{o()}catch(f){throw f}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(n[s]):!0){this.processed++;const o=Date.now();yield n[s],this.time=Date.now()-o,this.dispatchedFn&&n[s]&&this.dispatchedFn(n[s])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=st())}}finally{this.stop()}}stop(n){this.done||(this.err=n,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(n))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class th{constructor(n,s,a={maxOut:2}){v(this,"interval");v(this,"maxOut");v(this,"cancelAfter");v(this,"timer");v(this,"autoCancelTimer");v(this,"last");v(this,"missed");v(this,"count");v(this,"callback");this.interval=n,this.maxOut=(a==null?void 0:a.maxOut)||2,this.cancelAfter=(a==null?void 0:a.cancelAfter)||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=s,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(n,s=0,a=2){this.interval=n,this.maxOut=a,this.cancelAfter=s,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(n){console.log(n)}},this.interval)}}var kf;(function(r){r.Limits="limits",r.Interest="interest",r.Workqueue="workqueue"})(kf||(kf={}));var Ua;(function(r){r.Old="old",r.New="new"})(Ua||(Ua={}));var Mf;(function(r){r.File="file",r.Memory="memory"})(Mf||(Mf={}));var ft;(function(r){r.All="all",r.Last="last",r.New="new",r.StartSequence="by_start_sequence",r.StartTime="by_start_time",r.LastPerSubject="last_per_subject"})(ft||(ft={}));var vt;(function(r){r.None="none",r.All="all",r.Explicit="explicit",r.NotSet=""})(vt||(vt={}));var Er;(function(r){r.Instant="instant",r.Original="original"})(Er||(Er={}));var Zs;(function(r){r.None="none",r.S2="s2"})(Zs||(Zs={}));var Ro;(function(r){r.CreateOrUpdate="",r.Update="update",r.Create="create"})(Ro||(Ro={}));function vv(r,n={}){return Object.assign({name:r,deliver_policy:ft.All,ack_policy:vt.Explicit,ack_wait:nt(30*1e3),replay_policy:Er.Instant},n)}var d0;(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"})(d0||(d0={}));var Dt;(function(r){r.StreamSourceHdr="Nats-Stream-Source",r.LastConsumerSeqHdr="Nats-Last-Consumer",r.LastStreamSeqHdr="Nats-Last-Stream",r.ConsumerStalledHdr="Nats-Consumer-Stalled",r.MessageSizeHdr="Nats-Msg-Size",r.RollupHdr="Nats-Rollup",r.RollupValueSubject="sub",r.RollupValueAll="all",r.PendingMessagesHdr="Nats-Pending-Messages",r.PendingBytesHdr="Nats-Pending-Bytes"})(Dt||(Dt={}));var An;(function(r){r.LastValue="",r.AllHistory="history",r.UpdatesOnly="updates"})(An||(An={}));var yr;(function(r){r.Stream="Nats-Stream",r.Sequence="Nats-Sequence",r.TimeStamp="Nats-Time-Stamp",r.Subject="Nats-Subject"})(yr||(yr={}));var m0;(function(r){r.Stream="Nats-Stream",r.Subject="Nats-Subject",r.Sequence="Nats-Sequence",r.LastSequence="Nats-Last-Sequence",r.Size="Nats-Msg-Size"})(m0||(m0={}));const Zt="KV_";class _v{constructor(n){v(this,"config");v(this,"ordered");v(this,"mack");v(this,"stream");v(this,"callbackFn");v(this,"max");v(this,"qname");v(this,"isBind");v(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=vv("",n||{})}getOpts(){var s;const n={};if(n.config=Object.assign({},this.config),n.config.filter_subject&&(this.filterSubject(n.config.filter_subject),n.config.filter_subject=void 0),n.config.filter_subjects&&((s=n.config.filter_subjects)==null||s.forEach(a=>{this.filterSubject(a)}),n.config.filter_subjects=void 0),n.mack=this.mack,n.stream=this.stream,n.callbackFn=this.callbackFn,n.max=this.max,n.queue=this.qname,n.ordered=this.ordered,n.config.ack_policy=n.ordered?vt.None:n.config.ack_policy,n.isBind=n.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:n.config.filter_subject=this.filters[0];break;default:n.config.filter_subjects=this.filters}return n}description(n){return this.config.description=n,this}deliverTo(n){return this.config.deliver_subject=n,this}durable(n){return xr(n),this.config.durable_name=n,this}startSequence(n){if(n<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=ft.StartSequence,this.config.opt_start_seq=n,this}startTime(n){return this.config.deliver_policy=ft.StartTime,this.config.opt_start_time=n.toISOString(),this}deliverAll(){return this.config.deliver_policy=ft.All,this}deliverLastPerSubject(){return this.config.deliver_policy=ft.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=ft.Last,this}deliverNew(){return this.config.deliver_policy=ft.New,this}startAtTimeDelta(n){return this.startTime(new Date(Date.now()-n)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=vt.None,this}ackAll(){return this.config.ack_policy=vt.All,this}ackExplicit(){return this.config.ack_policy=vt.Explicit,this}ackWait(n){return this.config.ack_wait=nt(n),this}maxDeliver(n){return this.config.max_deliver=n,this}filterSubject(n){return this.filters=this.filters||[],this.filters.push(n),this}replayInstantly(){return this.config.replay_policy=Er.Instant,this}replayOriginal(){return this.config.replay_policy=Er.Original,this}sample(n){if(n=Math.trunc(n),n<0||n>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${n}%`,this}limit(n){return this.config.rate_limit_bps=n,this}maxWaiting(n){return this.config.max_waiting=n,this}maxAckPending(n){return this.config.max_ack_pending=n,this}idleHeartbeat(n){return this.config.idle_heartbeat=nt(n),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(n){return this.queue(n),this}manualAck(){return this.mack=!0,this}maxMessages(n){return this.max=n,this}callback(n){return this.callbackFn=n,this}queue(n){return this.qname=n,this.config.deliver_group=n,this}orderedConsumer(){return this.ordered=!0,this}bind(n,s){return this.stream=n,this.config.durable_name=s,this.isBind=!0,this}bindStream(n){return this.stream=n,this}inactiveEphemeralThreshold(n){return this.config.inactive_threshold=nt(n),this}maxPullBatch(n){return this.config.max_batch=n,this}maxPullRequestExpires(n){return this.config.max_expires=nt(n),this}memory(){return this.config.mem_storage=!0,this}numReplicas(n){return this.config.num_replicas=n,this}consumerName(n){return this.config.name=n,this}}function Is(r){return new _v(r)}function p0(r){return typeof r.getOpts=="function"}class wv{static encode(n){if(typeof n=="string")return btoa(n);const s=Array.from(n);return btoa(String.fromCharCode(...s))}static decode(n,s=!1){const a=atob(n);return s?Uint8Array.from(a,o=>o.charCodeAt(0)):a}}class _r{static encode(n){return _r.toB64URLEncoding(wv.encode(n))}static decode(n,s=!1){return _r.decode(_r.fromB64URLEncoding(n),s)}static toB64URLEncoding(n){return n.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(n){return n.replace(/_/g,"/").replace(/-/g,"+")}}class Ar{constructor(){v(this,"buffers");v(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...n){let s=0;for(let f=0;f<n.length;f++)s+=n[f].length;const a=new Uint8Array(s);let o=0;for(let f=0;f<n.length;f++)a.set(n[f],o),o+=n[f].length;return a}static fromAscii(n){return n||(n=""),ji.encode(n)}static toAscii(n){return Wt.decode(n)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const n=new Uint8Array(this.byteLength);let s=0;for(let a=0;a<this.buffers.length;a++)n.set(this.buffers[a],s),s+=this.buffers[a].length;this.buffers.length=0,this.buffers.push(n)}}shift(){if(this.buffers.length){const n=this.buffers.shift();if(n)return this.byteLength-=n.length,n}return new Uint8Array(0)}drain(n){if(this.buffers.length){this.pack();const s=this.buffers.pop();if(s){const a=this.byteLength;(n===void 0||n>a)&&(n=a);const o=s.subarray(0,n);return a>n&&this.buffers.push(s.subarray(n)),this.byteLength=a-n,o}}return new Uint8Array(0)}fill(n,...s){n&&(this.buffers.push(n),this.byteLength+=n.length);for(let a=0;a<s.length;a++)s[a]&&s[a].length&&(this.buffers.push(s[a]),this.byteLength+=s[a].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function Sv(r,n){return n.forEach(function(s){s&&typeof s!="string"&&!Array.isArray(s)&&Object.keys(s).forEach(function(a){if(a!=="default"&&!(a in r)){var o=Object.getOwnPropertyDescriptor(s,a);Object.defineProperty(r,a,o.get?o:{enumerable:!0,get:function(){return s[a]}})}})}),Object.freeze(r)}var Ev=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},Sa=Ev.performance||{};Sa.now||Sa.mozNow||Sa.msNow||Sa.oNow||Sa.webkitNow;var g0={versions:{}},Av=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ov(r){if(r.__esModule)return r;var n=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(r).forEach(function(s){var a=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(n,s,a.get?a:{enumerable:!0,get:function(){return r[s]}})}),n}var df,Go={exports:{}},y0={},b0=Ov(Sv({__proto__:null,default:y0},[y0]));df=Go,(function(){var r="input is invalid type",n=typeof window=="object",s=n?window:{};s.JS_SHA256_NO_WINDOW&&(n=!1);var a=!n&&typeof self=="object",o=!s.JS_SHA256_NO_NODE_JS&&g0.versions&&g0.versions.node;o?s=Av:a&&(s=self);var f=!s.JS_SHA256_NO_COMMON_JS&&df.exports,h=!s.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",d="0123456789abcdef".split(""),g=[-2147483648,8388608,32768,128],y=[24,16,8,0],E=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],w=["hex","array","digest","arrayBuffer"],j=[];!s.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(k){return Object.prototype.toString.call(k)==="[object Array]"}),!h||!s.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(k){return typeof k=="object"&&k.buffer&&k.buffer.constructor===ArrayBuffer});var z=function(k,X){return function(se){return new ee(X,!0).update(se)[k]()}},M=function(k){var X=z("hex",k);o&&(X=B(X,k)),X.create=function(){return new ee(k)},X.update=function(F){return X.create().update(F)};for(var se=0;se<w.length;++se){var W=w[se];X[W]=z(W,k)}return X},B=function(k,X){var se,W=b0,F=b0.Buffer,Z=X?"sha224":"sha256";return se=F.from&&!s.JS_SHA256_NO_BUFFER_FROM?F.from:function(le){return new F(le)},function(le){if(typeof le=="string")return W.createHash(Z).update(le,"utf8").digest("hex");if(le==null)throw new Error(r);return le.constructor===ArrayBuffer&&(le=new Uint8Array(le)),Array.isArray(le)||ArrayBuffer.isView(le)||le.constructor===F?W.createHash(Z).update(se(le)).digest("hex"):k(le)}},V=function(k,X){return function(se,W){return new pe(se,X,!0).update(W)[k]()}},ne=function(k){var X=V("hex",k);X.create=function(F){return new pe(F,k)},X.update=function(F,Z){return X.create(F).update(Z)};for(var se=0;se<w.length;++se){var W=w[se];X[W]=V(W,k)}return X};function ee(k,X){X?(j[0]=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,this.blocks=j):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],k?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=k}function pe(k,X,se){var W,F=typeof k;if(F==="string"){var Z,le=[],re=k.length,qe=0;for(W=0;W<re;++W)(Z=k.charCodeAt(W))<128?le[qe++]=Z:Z<2048?(le[qe++]=192|Z>>>6,le[qe++]=128|63&Z):Z<55296||Z>=57344?(le[qe++]=224|Z>>>12,le[qe++]=128|Z>>>6&63,le[qe++]=128|63&Z):(Z=65536+((1023&Z)<<10|1023&k.charCodeAt(++W)),le[qe++]=240|Z>>>18,le[qe++]=128|Z>>>12&63,le[qe++]=128|Z>>>6&63,le[qe++]=128|63&Z);k=le}else{if(F!=="object")throw new Error(r);if(k===null)throw new Error(r);if(h&&k.constructor===ArrayBuffer)k=new Uint8Array(k);else if(!(Array.isArray(k)||h&&ArrayBuffer.isView(k)))throw new Error(r)}k.length>64&&(k=new ee(X,!0).update(k).array());var Ge=[],Le=[];for(W=0;W<64;++W){var $=k[W]||0;Ge[W]=92^$,Le[W]=54^$}ee.call(this,X,se),this.update(Le),this.oKeyPad=Ge,this.inner=!0,this.sharedMemory=se}ee.prototype.update=function(k){if(!this.finalized){var X,se=typeof k;if(se!=="string"){if(se!=="object")throw new Error(r);if(k===null)throw new Error(r);if(h&&k.constructor===ArrayBuffer)k=new Uint8Array(k);else if(!(Array.isArray(k)||h&&ArrayBuffer.isView(k)))throw new Error(r);X=!0}for(var W,F,Z=0,le=k.length,re=this.blocks;Z<le;){if(this.hashed&&(this.hashed=!1,re[0]=this.block,this.block=re[16]=re[1]=re[2]=re[3]=re[4]=re[5]=re[6]=re[7]=re[8]=re[9]=re[10]=re[11]=re[12]=re[13]=re[14]=re[15]=0),X)for(F=this.start;Z<le&&F<64;++Z)re[F>>>2]|=k[Z]<<y[3&F++];else for(F=this.start;Z<le&&F<64;++Z)(W=k.charCodeAt(Z))<128?re[F>>>2]|=W<<y[3&F++]:W<2048?(re[F>>>2]|=(192|W>>>6)<<y[3&F++],re[F>>>2]|=(128|63&W)<<y[3&F++]):W<55296||W>=57344?(re[F>>>2]|=(224|W>>>12)<<y[3&F++],re[F>>>2]|=(128|W>>>6&63)<<y[3&F++],re[F>>>2]|=(128|63&W)<<y[3&F++]):(W=65536+((1023&W)<<10|1023&k.charCodeAt(++Z)),re[F>>>2]|=(240|W>>>18)<<y[3&F++],re[F>>>2]|=(128|W>>>12&63)<<y[3&F++],re[F>>>2]|=(128|W>>>6&63)<<y[3&F++],re[F>>>2]|=(128|63&W)<<y[3&F++]);this.lastByteIndex=F,this.bytes+=F-this.start,F>=64?(this.block=re[16],this.start=F-64,this.hash(),this.hashed=!0):this.start=F}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},ee.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var k=this.blocks,X=this.lastByteIndex;k[16]=this.block,k[X>>>2]|=g[3&X],this.block=k[16],X>=56&&(this.hashed||this.hash(),k[0]=this.block,k[16]=k[1]=k[2]=k[3]=k[4]=k[5]=k[6]=k[7]=k[8]=k[9]=k[10]=k[11]=k[12]=k[13]=k[14]=k[15]=0),k[14]=this.hBytes<<3|this.bytes>>>29,k[15]=this.bytes<<3,this.hash()}},ee.prototype.hash=function(){var k,X,se,W,F,Z,le,re,qe,Ge=this.h0,Le=this.h1,$=this.h2,te=this.h3,de=this.h4,ve=this.h5,be=this.h6,je=this.h7,_e=this.blocks;for(k=16;k<64;++k)X=((F=_e[k-15])>>>7|F<<25)^(F>>>18|F<<14)^F>>>3,se=((F=_e[k-2])>>>17|F<<15)^(F>>>19|F<<13)^F>>>10,_e[k]=_e[k-16]+X+_e[k-7]+se|0;for(qe=Le&$,k=0;k<64;k+=4)this.first?(this.is224?(Z=300032,je=(F=_e[0]-1413257819)-150054599|0,te=F+24177077|0):(Z=704751109,je=(F=_e[0]-210244248)-1521486534|0,te=F+143694565|0),this.first=!1):(X=(Ge>>>2|Ge<<30)^(Ge>>>13|Ge<<19)^(Ge>>>22|Ge<<10),W=(Z=Ge&Le)^Ge&$^qe,je=te+(F=je+(se=(de>>>6|de<<26)^(de>>>11|de<<21)^(de>>>25|de<<7))+(de&ve^~de&be)+E[k]+_e[k])|0,te=F+(X+W)|0),X=(te>>>2|te<<30)^(te>>>13|te<<19)^(te>>>22|te<<10),W=(le=te&Ge)^te&Le^Z,be=$+(F=be+(se=(je>>>6|je<<26)^(je>>>11|je<<21)^(je>>>25|je<<7))+(je&de^~je&ve)+E[k+1]+_e[k+1])|0,X=(($=F+(X+W)|0)>>>2|$<<30)^($>>>13|$<<19)^($>>>22|$<<10),W=(re=$&te)^$&Ge^le,ve=Le+(F=ve+(se=(be>>>6|be<<26)^(be>>>11|be<<21)^(be>>>25|be<<7))+(be&je^~be&de)+E[k+2]+_e[k+2])|0,X=((Le=F+(X+W)|0)>>>2|Le<<30)^(Le>>>13|Le<<19)^(Le>>>22|Le<<10),W=(qe=Le&$)^Le&te^re,de=Ge+(F=de+(se=(ve>>>6|ve<<26)^(ve>>>11|ve<<21)^(ve>>>25|ve<<7))+(ve&be^~ve&je)+E[k+3]+_e[k+3])|0,Ge=F+(X+W)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+Ge|0,this.h1=this.h1+Le|0,this.h2=this.h2+$|0,this.h3=this.h3+te|0,this.h4=this.h4+de|0,this.h5=this.h5+ve|0,this.h6=this.h6+be|0,this.h7=this.h7+je|0},ee.prototype.hex=function(){this.finalize();var k=this.h0,X=this.h1,se=this.h2,W=this.h3,F=this.h4,Z=this.h5,le=this.h6,re=this.h7,qe=d[k>>>28&15]+d[k>>>24&15]+d[k>>>20&15]+d[k>>>16&15]+d[k>>>12&15]+d[k>>>8&15]+d[k>>>4&15]+d[15&k]+d[X>>>28&15]+d[X>>>24&15]+d[X>>>20&15]+d[X>>>16&15]+d[X>>>12&15]+d[X>>>8&15]+d[X>>>4&15]+d[15&X]+d[se>>>28&15]+d[se>>>24&15]+d[se>>>20&15]+d[se>>>16&15]+d[se>>>12&15]+d[se>>>8&15]+d[se>>>4&15]+d[15&se]+d[W>>>28&15]+d[W>>>24&15]+d[W>>>20&15]+d[W>>>16&15]+d[W>>>12&15]+d[W>>>8&15]+d[W>>>4&15]+d[15&W]+d[F>>>28&15]+d[F>>>24&15]+d[F>>>20&15]+d[F>>>16&15]+d[F>>>12&15]+d[F>>>8&15]+d[F>>>4&15]+d[15&F]+d[Z>>>28&15]+d[Z>>>24&15]+d[Z>>>20&15]+d[Z>>>16&15]+d[Z>>>12&15]+d[Z>>>8&15]+d[Z>>>4&15]+d[15&Z]+d[le>>>28&15]+d[le>>>24&15]+d[le>>>20&15]+d[le>>>16&15]+d[le>>>12&15]+d[le>>>8&15]+d[le>>>4&15]+d[15&le];return this.is224||(qe+=d[re>>>28&15]+d[re>>>24&15]+d[re>>>20&15]+d[re>>>16&15]+d[re>>>12&15]+d[re>>>8&15]+d[re>>>4&15]+d[15&re]),qe},ee.prototype.toString=ee.prototype.hex,ee.prototype.digest=function(){this.finalize();var k=this.h0,X=this.h1,se=this.h2,W=this.h3,F=this.h4,Z=this.h5,le=this.h6,re=this.h7,qe=[k>>>24&255,k>>>16&255,k>>>8&255,255&k,X>>>24&255,X>>>16&255,X>>>8&255,255&X,se>>>24&255,se>>>16&255,se>>>8&255,255&se,W>>>24&255,W>>>16&255,W>>>8&255,255&W,F>>>24&255,F>>>16&255,F>>>8&255,255&F,Z>>>24&255,Z>>>16&255,Z>>>8&255,255&Z,le>>>24&255,le>>>16&255,le>>>8&255,255&le];return this.is224||qe.push(re>>>24&255,re>>>16&255,re>>>8&255,255&re),qe},ee.prototype.array=ee.prototype.digest,ee.prototype.arrayBuffer=function(){this.finalize();var k=new ArrayBuffer(this.is224?28:32),X=new DataView(k);return X.setUint32(0,this.h0),X.setUint32(4,this.h1),X.setUint32(8,this.h2),X.setUint32(12,this.h3),X.setUint32(16,this.h4),X.setUint32(20,this.h5),X.setUint32(24,this.h6),this.is224||X.setUint32(28,this.h7),k},pe.prototype=new ee,pe.prototype.finalize=function(){if(ee.prototype.finalize.call(this),this.inner){this.inner=!1;var k=this.array();ee.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(k),ee.prototype.finalize.call(this)}};var ae=M();ae.sha256=ae,ae.sha224=M(!0),ae.sha256.hmac=ne(),ae.sha224.hmac=ne(!0),f?df.exports=ae:(s.sha256=ae.sha256,s.sha224=ae.sha224)})();Go.exports;Go.exports.sha224;var x0=Go.exports.sha256;function Rf(r){return Mv(r)}function jv(r){if(!/^[0-9A-Fa-f]+$/.test(r))return!1;const s=/^[0-9A-F]+$/.test(r),a=/^[0-9a-f]+$/.test(r);return s||a?r.length%2===0:!1}function Tv(r){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(r)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(r)}function Nv(r){return jv(r)?"hex":Tv(r)?"b64":""}function Cv(r){if(r.length%2!==0)throw new Error("hex string must have an even length");const n=new Uint8Array(r.length/2);for(let s=0;s<r.length;s+=2)n[s/2]=parseInt(r.substring(s,s+2),16);return n}function kv(r){r=r.replace(/-/g,"+"),r=r.replace(/_/g,"/");const n=atob(r);return Uint8Array.from(n,s=>s.charCodeAt(0))}function Mv(r){switch(Nv(r)){case"hex":return Cv(r);case"b64":return kv(r)}return null}function Rv(r,n){const s=typeof r=="string"?Rf(r):r,a=typeof n=="string"?Rf(n):n;if(s===null||a===null||s.length!==a.length)return!1;for(let o=0;o<s.length;o++)if(s[o]!==a[o])return!1;return!0}class vg{constructor(n,s,a=!0){v(this,"token");v(this,"received");v(this,"ctx");v(this,"requestSubject");v(this,"mux");this.mux=n,this.requestSubject=s,this.received=0,this.token=Ks.next(),a&&(this.ctx=new Error)}}class Dv extends vg{constructor(s,a,o={maxWait:1e3}){super(s,a);v(this,"callback");v(this,"done");v(this,"timer");v(this,"max");v(this,"opts");if(this.opts=o,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof o.maxMessages=="number"&&o.maxMessages>0?o.maxMessages:-1,this.done=st(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},o.maxWait)}cancel(s){s&&this.callback(s,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(s,a){s?(this.ctx&&(s.stack+=`
|
|
32
|
+
`:a="\\n";break;case"\r":a="\\r";break;case" ":a="\\t";break}throw Error(`invalid ${r} name - ${r} name cannot contain '${a}'`)}}),""}function Ta(r,n=""){if(n==="")throw Error(`${r} name required`);const s=wv(n);if(s.length)throw new Error(`invalid ${r} name - ${r} name ${s}`)}function wv(r=""){if(r==="")throw Error("name required");const n=/^[-\w]+$/g;if(r.match(n)===null){for(const a of r.split(""))if(a.match(n)===null)return`cannot contain '${a}'`}return""}function Of(r){if(r.data.length>0)return!1;const n=r.headers;return n?n.code>=100&&n.code<200:!1}function jf(r){var n;return Of(r)&&((n=r.headers)==null?void 0:n.description)==="Idle Heartbeat"}function Sv(r,n,s){const a=fs(r,n),o={hdr:1,sid:0,size:0},f=new Kf(o,tn,{});return f._headers=a,f._subject=s,f}function vr(r){if(r.data.length!==0)return null;const n=r.headers;return n?gg(n.code,n.description):null}var yn;(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"})(yn||(yn={}));function Ev(r){return r.code!==ie.JetStream409?!1:[yn.MaxBatchExceeded,yn.MaxExpiresExceeded,yn.MaxBytesExceeded,yn.MaxMessageSizeExceeded,yn.PushConsumer,yn.IdleHeartbeatMissed,yn.ConsumerDeleted].find(s=>r.message.indexOf(s)!==-1)!==void 0}function gg(r,n=""){if(r<300)return null;switch(n=n.toLowerCase(),r){case 404:return new ue(n,ie.JetStream404NoMessages);case 408:return new ue(n,ie.JetStream408RequestTimeout);case 409:{const s=n.startsWith(yn.IdleHeartbeatMissed)?ie.JetStreamIdleHeartBeat:ie.JetStream409;return new ue(n,s)}case 503:return ue.errorForCode(ie.JetStreamNotEnabled,new Error(n));default:return n===""&&(n=ie.Unknown),new ue(n,`${r}`)}}class _t{constructor(){v(this,"inflight");v(this,"processed");v(this,"received");v(this,"noIterator");v(this,"iterClosed");v(this,"done");v(this,"signal");v(this,"yields");v(this,"filtered");v(this,"pendingFiltered");v(this,"ingestionFilterFn");v(this,"protocolFilterFn");v(this,"dispatchedFn");v(this,"ctx");v(this,"_data");v(this,"err");v(this,"time");v(this,"yielding");this.inflight=0,this.filtered=0,this.pendingFiltered=0,this.processed=0,this.received=0,this.noIterator=!1,this.done=!1,this.signal=st(),this.yields=[],this.iterClosed=st(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(n){if(this.done)return;if(typeof n=="function"){this.yields.push(n),this.signal.resolve();return}const{ingest:s,protocol:a}=this.ingestionFilterFn?this.ingestionFilterFn(n,this.ctx||this):{ingest:!0,protocol:!1};s&&(a&&(this.filtered++,this.pendingFiltered++),this.yields.push(n),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new ue("unsupported iterator",ie.ApiError);if(this.yielding)throw new ue("already yielding",ie.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const n=this.yields;this.inflight=n.length,this.yields=[];for(let s=0;s<n.length;s++){if(typeof n[s]=="function"){const o=n[s];try{o()}catch(f){throw f}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(n[s]):!0){this.processed++;const o=Date.now();yield n[s],this.time=Date.now()-o,this.dispatchedFn&&n[s]&&this.dispatchedFn(n[s])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=st())}}finally{this.stop()}}stop(n){this.done||(this.err=n,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(n))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class Zf{constructor(n,s,a={maxOut:2}){v(this,"interval");v(this,"maxOut");v(this,"cancelAfter");v(this,"timer");v(this,"autoCancelTimer");v(this,"last");v(this,"missed");v(this,"count");v(this,"callback");this.interval=n,this.maxOut=(a==null?void 0:a.maxOut)||2,this.cancelAfter=(a==null?void 0:a.cancelAfter)||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=s,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(n,s=0,a=2){this.interval=n,this.maxOut=a,this.cancelAfter=s,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(n){console.log(n)}},this.interval)}}var Tf;(function(r){r.Limits="limits",r.Interest="interest",r.Workqueue="workqueue"})(Tf||(Tf={}));var qa;(function(r){r.Old="old",r.New="new"})(qa||(qa={}));var Nf;(function(r){r.File="file",r.Memory="memory"})(Nf||(Nf={}));var ft;(function(r){r.All="all",r.Last="last",r.New="new",r.StartSequence="by_start_sequence",r.StartTime="by_start_time",r.LastPerSubject="last_per_subject"})(ft||(ft={}));var vt;(function(r){r.None="none",r.All="all",r.Explicit="explicit",r.NotSet=""})(vt||(vt={}));var Er;(function(r){r.Instant="instant",r.Original="original"})(Er||(Er={}));var Zs;(function(r){r.None="none",r.S2="s2"})(Zs||(Zs={}));var Ro;(function(r){r.CreateOrUpdate="",r.Update="update",r.Create="create"})(Ro||(Ro={}));function Av(r,n={}){return Object.assign({name:r,deliver_policy:ft.All,ack_policy:vt.Explicit,ack_wait:nt(30*1e3),replay_policy:Er.Instant},n)}var u0;(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"})(u0||(u0={}));var Dt;(function(r){r.StreamSourceHdr="Nats-Stream-Source",r.LastConsumerSeqHdr="Nats-Last-Consumer",r.LastStreamSeqHdr="Nats-Last-Stream",r.ConsumerStalledHdr="Nats-Consumer-Stalled",r.MessageSizeHdr="Nats-Msg-Size",r.RollupHdr="Nats-Rollup",r.RollupValueSubject="sub",r.RollupValueAll="all",r.PendingMessagesHdr="Nats-Pending-Messages",r.PendingBytesHdr="Nats-Pending-Bytes"})(Dt||(Dt={}));var An;(function(r){r.LastValue="",r.AllHistory="history",r.UpdatesOnly="updates"})(An||(An={}));var yr;(function(r){r.Stream="Nats-Stream",r.Sequence="Nats-Sequence",r.TimeStamp="Nats-Time-Stamp",r.Subject="Nats-Subject"})(yr||(yr={}));var f0;(function(r){r.Stream="Nats-Stream",r.Subject="Nats-Subject",r.Sequence="Nats-Sequence",r.LastSequence="Nats-Last-Sequence",r.Size="Nats-Msg-Size"})(f0||(f0={}));const Zt="KV_";class Ov{constructor(n){v(this,"config");v(this,"ordered");v(this,"mack");v(this,"stream");v(this,"callbackFn");v(this,"max");v(this,"qname");v(this,"isBind");v(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=Av("",n||{})}getOpts(){var s;const n={};if(n.config=Object.assign({},this.config),n.config.filter_subject&&(this.filterSubject(n.config.filter_subject),n.config.filter_subject=void 0),n.config.filter_subjects&&((s=n.config.filter_subjects)==null||s.forEach(a=>{this.filterSubject(a)}),n.config.filter_subjects=void 0),n.mack=this.mack,n.stream=this.stream,n.callbackFn=this.callbackFn,n.max=this.max,n.queue=this.qname,n.ordered=this.ordered,n.config.ack_policy=n.ordered?vt.None:n.config.ack_policy,n.isBind=n.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:n.config.filter_subject=this.filters[0];break;default:n.config.filter_subjects=this.filters}return n}description(n){return this.config.description=n,this}deliverTo(n){return this.config.deliver_subject=n,this}durable(n){return xr(n),this.config.durable_name=n,this}startSequence(n){if(n<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=ft.StartSequence,this.config.opt_start_seq=n,this}startTime(n){return this.config.deliver_policy=ft.StartTime,this.config.opt_start_time=n.toISOString(),this}deliverAll(){return this.config.deliver_policy=ft.All,this}deliverLastPerSubject(){return this.config.deliver_policy=ft.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=ft.Last,this}deliverNew(){return this.config.deliver_policy=ft.New,this}startAtTimeDelta(n){return this.startTime(new Date(Date.now()-n)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=vt.None,this}ackAll(){return this.config.ack_policy=vt.All,this}ackExplicit(){return this.config.ack_policy=vt.Explicit,this}ackWait(n){return this.config.ack_wait=nt(n),this}maxDeliver(n){return this.config.max_deliver=n,this}filterSubject(n){return this.filters=this.filters||[],this.filters.push(n),this}replayInstantly(){return this.config.replay_policy=Er.Instant,this}replayOriginal(){return this.config.replay_policy=Er.Original,this}sample(n){if(n=Math.trunc(n),n<0||n>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${n}%`,this}limit(n){return this.config.rate_limit_bps=n,this}maxWaiting(n){return this.config.max_waiting=n,this}maxAckPending(n){return this.config.max_ack_pending=n,this}idleHeartbeat(n){return this.config.idle_heartbeat=nt(n),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(n){return this.queue(n),this}manualAck(){return this.mack=!0,this}maxMessages(n){return this.max=n,this}callback(n){return this.callbackFn=n,this}queue(n){return this.qname=n,this.config.deliver_group=n,this}orderedConsumer(){return this.ordered=!0,this}bind(n,s){return this.stream=n,this.config.durable_name=s,this.isBind=!0,this}bindStream(n){return this.stream=n,this}inactiveEphemeralThreshold(n){return this.config.inactive_threshold=nt(n),this}maxPullBatch(n){return this.config.max_batch=n,this}maxPullRequestExpires(n){return this.config.max_expires=nt(n),this}memory(){return this.config.mem_storage=!0,this}numReplicas(n){return this.config.num_replicas=n,this}consumerName(n){return this.config.name=n,this}}function Is(r){return new Ov(r)}function h0(r){return typeof r.getOpts=="function"}class jv{static encode(n){if(typeof n=="string")return btoa(n);const s=Array.from(n);return btoa(String.fromCharCode(...s))}static decode(n,s=!1){const a=atob(n);return s?Uint8Array.from(a,o=>o.charCodeAt(0)):a}}class _r{static encode(n){return _r.toB64URLEncoding(jv.encode(n))}static decode(n,s=!1){return _r.decode(_r.fromB64URLEncoding(n),s)}static toB64URLEncoding(n){return n.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(n){return n.replace(/_/g,"/").replace(/-/g,"+")}}class Ar{constructor(){v(this,"buffers");v(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...n){let s=0;for(let f=0;f<n.length;f++)s+=n[f].length;const a=new Uint8Array(s);let o=0;for(let f=0;f<n.length;f++)a.set(n[f],o),o+=n[f].length;return a}static fromAscii(n){return n||(n=""),ji.encode(n)}static toAscii(n){return Wt.decode(n)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const n=new Uint8Array(this.byteLength);let s=0;for(let a=0;a<this.buffers.length;a++)n.set(this.buffers[a],s),s+=this.buffers[a].length;this.buffers.length=0,this.buffers.push(n)}}shift(){if(this.buffers.length){const n=this.buffers.shift();if(n)return this.byteLength-=n.length,n}return new Uint8Array(0)}drain(n){if(this.buffers.length){this.pack();const s=this.buffers.pop();if(s){const a=this.byteLength;(n===void 0||n>a)&&(n=a);const o=s.subarray(0,n);return a>n&&this.buffers.push(s.subarray(n)),this.byteLength=a-n,o}}return new Uint8Array(0)}fill(n,...s){n&&(this.buffers.push(n),this.byteLength+=n.length);for(let a=0;a<s.length;a++)s[a]&&s[a].length&&(this.buffers.push(s[a]),this.byteLength+=s[a].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function Tv(r,n){return n.forEach(function(s){s&&typeof s!="string"&&!Array.isArray(s)&&Object.keys(s).forEach(function(a){if(a!=="default"&&!(a in r)){var o=Object.getOwnPropertyDescriptor(s,a);Object.defineProperty(r,a,o.get?o:{enumerable:!0,get:function(){return s[a]}})}})}),Object.freeze(r)}var Nv=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},Sa=Nv.performance||{};Sa.now||Sa.mozNow||Sa.msNow||Sa.oNow||Sa.webkitNow;var d0={versions:{}},Cv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function kv(r){if(r.__esModule)return r;var n=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(r).forEach(function(s){var a=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(n,s,a.get?a:{enumerable:!0,get:function(){return r[s]}})}),n}var uf,Go={exports:{}},m0={},p0=kv(Tv({__proto__:null,default:m0},[m0]));uf=Go,(function(){var r="input is invalid type",n=typeof window=="object",s=n?window:{};s.JS_SHA256_NO_WINDOW&&(n=!1);var a=!n&&typeof self=="object",o=!s.JS_SHA256_NO_NODE_JS&&d0.versions&&d0.versions.node;o?s=Cv:a&&(s=self);var f=!s.JS_SHA256_NO_COMMON_JS&&uf.exports,h=!s.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",d="0123456789abcdef".split(""),g=[-2147483648,8388608,32768,128],y=[24,16,8,0],E=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],w=["hex","array","digest","arrayBuffer"],j=[];!s.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(k){return Object.prototype.toString.call(k)==="[object Array]"}),!h||!s.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(k){return typeof k=="object"&&k.buffer&&k.buffer.constructor===ArrayBuffer});var z=function(k,X){return function(se){return new ee(X,!0).update(se)[k]()}},M=function(k){var X=z("hex",k);o&&(X=B(X,k)),X.create=function(){return new ee(k)},X.update=function(F){return X.create().update(F)};for(var se=0;se<w.length;++se){var W=w[se];X[W]=z(W,k)}return X},B=function(k,X){var se,W=p0,F=p0.Buffer,Z=X?"sha224":"sha256";return se=F.from&&!s.JS_SHA256_NO_BUFFER_FROM?F.from:function(le){return new F(le)},function(le){if(typeof le=="string")return W.createHash(Z).update(le,"utf8").digest("hex");if(le==null)throw new Error(r);return le.constructor===ArrayBuffer&&(le=new Uint8Array(le)),Array.isArray(le)||ArrayBuffer.isView(le)||le.constructor===F?W.createHash(Z).update(se(le)).digest("hex"):k(le)}},V=function(k,X){return function(se,W){return new pe(se,X,!0).update(W)[k]()}},ne=function(k){var X=V("hex",k);X.create=function(F){return new pe(F,k)},X.update=function(F,Z){return X.create(F).update(Z)};for(var se=0;se<w.length;++se){var W=w[se];X[W]=V(W,k)}return X};function ee(k,X){X?(j[0]=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,this.blocks=j):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],k?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=k}function pe(k,X,se){var W,F=typeof k;if(F==="string"){var Z,le=[],re=k.length,qe=0;for(W=0;W<re;++W)(Z=k.charCodeAt(W))<128?le[qe++]=Z:Z<2048?(le[qe++]=192|Z>>>6,le[qe++]=128|63&Z):Z<55296||Z>=57344?(le[qe++]=224|Z>>>12,le[qe++]=128|Z>>>6&63,le[qe++]=128|63&Z):(Z=65536+((1023&Z)<<10|1023&k.charCodeAt(++W)),le[qe++]=240|Z>>>18,le[qe++]=128|Z>>>12&63,le[qe++]=128|Z>>>6&63,le[qe++]=128|63&Z);k=le}else{if(F!=="object")throw new Error(r);if(k===null)throw new Error(r);if(h&&k.constructor===ArrayBuffer)k=new Uint8Array(k);else if(!(Array.isArray(k)||h&&ArrayBuffer.isView(k)))throw new Error(r)}k.length>64&&(k=new ee(X,!0).update(k).array());var Ge=[],Le=[];for(W=0;W<64;++W){var $=k[W]||0;Ge[W]=92^$,Le[W]=54^$}ee.call(this,X,se),this.update(Le),this.oKeyPad=Ge,this.inner=!0,this.sharedMemory=se}ee.prototype.update=function(k){if(!this.finalized){var X,se=typeof k;if(se!=="string"){if(se!=="object")throw new Error(r);if(k===null)throw new Error(r);if(h&&k.constructor===ArrayBuffer)k=new Uint8Array(k);else if(!(Array.isArray(k)||h&&ArrayBuffer.isView(k)))throw new Error(r);X=!0}for(var W,F,Z=0,le=k.length,re=this.blocks;Z<le;){if(this.hashed&&(this.hashed=!1,re[0]=this.block,this.block=re[16]=re[1]=re[2]=re[3]=re[4]=re[5]=re[6]=re[7]=re[8]=re[9]=re[10]=re[11]=re[12]=re[13]=re[14]=re[15]=0),X)for(F=this.start;Z<le&&F<64;++Z)re[F>>>2]|=k[Z]<<y[3&F++];else for(F=this.start;Z<le&&F<64;++Z)(W=k.charCodeAt(Z))<128?re[F>>>2]|=W<<y[3&F++]:W<2048?(re[F>>>2]|=(192|W>>>6)<<y[3&F++],re[F>>>2]|=(128|63&W)<<y[3&F++]):W<55296||W>=57344?(re[F>>>2]|=(224|W>>>12)<<y[3&F++],re[F>>>2]|=(128|W>>>6&63)<<y[3&F++],re[F>>>2]|=(128|63&W)<<y[3&F++]):(W=65536+((1023&W)<<10|1023&k.charCodeAt(++Z)),re[F>>>2]|=(240|W>>>18)<<y[3&F++],re[F>>>2]|=(128|W>>>12&63)<<y[3&F++],re[F>>>2]|=(128|W>>>6&63)<<y[3&F++],re[F>>>2]|=(128|63&W)<<y[3&F++]);this.lastByteIndex=F,this.bytes+=F-this.start,F>=64?(this.block=re[16],this.start=F-64,this.hash(),this.hashed=!0):this.start=F}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},ee.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var k=this.blocks,X=this.lastByteIndex;k[16]=this.block,k[X>>>2]|=g[3&X],this.block=k[16],X>=56&&(this.hashed||this.hash(),k[0]=this.block,k[16]=k[1]=k[2]=k[3]=k[4]=k[5]=k[6]=k[7]=k[8]=k[9]=k[10]=k[11]=k[12]=k[13]=k[14]=k[15]=0),k[14]=this.hBytes<<3|this.bytes>>>29,k[15]=this.bytes<<3,this.hash()}},ee.prototype.hash=function(){var k,X,se,W,F,Z,le,re,qe,Ge=this.h0,Le=this.h1,$=this.h2,te=this.h3,de=this.h4,ve=this.h5,be=this.h6,je=this.h7,_e=this.blocks;for(k=16;k<64;++k)X=((F=_e[k-15])>>>7|F<<25)^(F>>>18|F<<14)^F>>>3,se=((F=_e[k-2])>>>17|F<<15)^(F>>>19|F<<13)^F>>>10,_e[k]=_e[k-16]+X+_e[k-7]+se|0;for(qe=Le&$,k=0;k<64;k+=4)this.first?(this.is224?(Z=300032,je=(F=_e[0]-1413257819)-150054599|0,te=F+24177077|0):(Z=704751109,je=(F=_e[0]-210244248)-1521486534|0,te=F+143694565|0),this.first=!1):(X=(Ge>>>2|Ge<<30)^(Ge>>>13|Ge<<19)^(Ge>>>22|Ge<<10),W=(Z=Ge&Le)^Ge&$^qe,je=te+(F=je+(se=(de>>>6|de<<26)^(de>>>11|de<<21)^(de>>>25|de<<7))+(de&ve^~de&be)+E[k]+_e[k])|0,te=F+(X+W)|0),X=(te>>>2|te<<30)^(te>>>13|te<<19)^(te>>>22|te<<10),W=(le=te&Ge)^te&Le^Z,be=$+(F=be+(se=(je>>>6|je<<26)^(je>>>11|je<<21)^(je>>>25|je<<7))+(je&de^~je&ve)+E[k+1]+_e[k+1])|0,X=(($=F+(X+W)|0)>>>2|$<<30)^($>>>13|$<<19)^($>>>22|$<<10),W=(re=$&te)^$&Ge^le,ve=Le+(F=ve+(se=(be>>>6|be<<26)^(be>>>11|be<<21)^(be>>>25|be<<7))+(be&je^~be&de)+E[k+2]+_e[k+2])|0,X=((Le=F+(X+W)|0)>>>2|Le<<30)^(Le>>>13|Le<<19)^(Le>>>22|Le<<10),W=(qe=Le&$)^Le&te^re,de=Ge+(F=de+(se=(ve>>>6|ve<<26)^(ve>>>11|ve<<21)^(ve>>>25|ve<<7))+(ve&be^~ve&je)+E[k+3]+_e[k+3])|0,Ge=F+(X+W)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+Ge|0,this.h1=this.h1+Le|0,this.h2=this.h2+$|0,this.h3=this.h3+te|0,this.h4=this.h4+de|0,this.h5=this.h5+ve|0,this.h6=this.h6+be|0,this.h7=this.h7+je|0},ee.prototype.hex=function(){this.finalize();var k=this.h0,X=this.h1,se=this.h2,W=this.h3,F=this.h4,Z=this.h5,le=this.h6,re=this.h7,qe=d[k>>>28&15]+d[k>>>24&15]+d[k>>>20&15]+d[k>>>16&15]+d[k>>>12&15]+d[k>>>8&15]+d[k>>>4&15]+d[15&k]+d[X>>>28&15]+d[X>>>24&15]+d[X>>>20&15]+d[X>>>16&15]+d[X>>>12&15]+d[X>>>8&15]+d[X>>>4&15]+d[15&X]+d[se>>>28&15]+d[se>>>24&15]+d[se>>>20&15]+d[se>>>16&15]+d[se>>>12&15]+d[se>>>8&15]+d[se>>>4&15]+d[15&se]+d[W>>>28&15]+d[W>>>24&15]+d[W>>>20&15]+d[W>>>16&15]+d[W>>>12&15]+d[W>>>8&15]+d[W>>>4&15]+d[15&W]+d[F>>>28&15]+d[F>>>24&15]+d[F>>>20&15]+d[F>>>16&15]+d[F>>>12&15]+d[F>>>8&15]+d[F>>>4&15]+d[15&F]+d[Z>>>28&15]+d[Z>>>24&15]+d[Z>>>20&15]+d[Z>>>16&15]+d[Z>>>12&15]+d[Z>>>8&15]+d[Z>>>4&15]+d[15&Z]+d[le>>>28&15]+d[le>>>24&15]+d[le>>>20&15]+d[le>>>16&15]+d[le>>>12&15]+d[le>>>8&15]+d[le>>>4&15]+d[15&le];return this.is224||(qe+=d[re>>>28&15]+d[re>>>24&15]+d[re>>>20&15]+d[re>>>16&15]+d[re>>>12&15]+d[re>>>8&15]+d[re>>>4&15]+d[15&re]),qe},ee.prototype.toString=ee.prototype.hex,ee.prototype.digest=function(){this.finalize();var k=this.h0,X=this.h1,se=this.h2,W=this.h3,F=this.h4,Z=this.h5,le=this.h6,re=this.h7,qe=[k>>>24&255,k>>>16&255,k>>>8&255,255&k,X>>>24&255,X>>>16&255,X>>>8&255,255&X,se>>>24&255,se>>>16&255,se>>>8&255,255&se,W>>>24&255,W>>>16&255,W>>>8&255,255&W,F>>>24&255,F>>>16&255,F>>>8&255,255&F,Z>>>24&255,Z>>>16&255,Z>>>8&255,255&Z,le>>>24&255,le>>>16&255,le>>>8&255,255&le];return this.is224||qe.push(re>>>24&255,re>>>16&255,re>>>8&255,255&re),qe},ee.prototype.array=ee.prototype.digest,ee.prototype.arrayBuffer=function(){this.finalize();var k=new ArrayBuffer(this.is224?28:32),X=new DataView(k);return X.setUint32(0,this.h0),X.setUint32(4,this.h1),X.setUint32(8,this.h2),X.setUint32(12,this.h3),X.setUint32(16,this.h4),X.setUint32(20,this.h5),X.setUint32(24,this.h6),this.is224||X.setUint32(28,this.h7),k},pe.prototype=new ee,pe.prototype.finalize=function(){if(ee.prototype.finalize.call(this),this.inner){this.inner=!1;var k=this.array();ee.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(k),ee.prototype.finalize.call(this)}};var ae=M();ae.sha256=ae,ae.sha224=M(!0),ae.sha256.hmac=ne(),ae.sha224.hmac=ne(!0),f?uf.exports=ae:(s.sha256=ae.sha256,s.sha224=ae.sha224)})();Go.exports;Go.exports.sha224;var g0=Go.exports.sha256;function Cf(r){return Uv(r)}function Mv(r){if(!/^[0-9A-Fa-f]+$/.test(r))return!1;const s=/^[0-9A-F]+$/.test(r),a=/^[0-9a-f]+$/.test(r);return s||a?r.length%2===0:!1}function Rv(r){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(r)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(r)}function Dv(r){return Mv(r)?"hex":Rv(r)?"b64":""}function zv(r){if(r.length%2!==0)throw new Error("hex string must have an even length");const n=new Uint8Array(r.length/2);for(let s=0;s<r.length;s+=2)n[s/2]=parseInt(r.substring(s,s+2),16);return n}function qv(r){r=r.replace(/-/g,"+"),r=r.replace(/_/g,"/");const n=atob(r);return Uint8Array.from(n,s=>s.charCodeAt(0))}function Uv(r){switch(Dv(r)){case"hex":return zv(r);case"b64":return qv(r)}return null}function Bv(r,n){const s=typeof r=="string"?Cf(r):r,a=typeof n=="string"?Cf(n):n;if(s===null||a===null||s.length!==a.length)return!1;for(let o=0;o<s.length;o++)if(s[o]!==a[o])return!1;return!0}class yg{constructor(n,s,a=!0){v(this,"token");v(this,"received");v(this,"ctx");v(this,"requestSubject");v(this,"mux");this.mux=n,this.requestSubject=s,this.received=0,this.token=Ks.next(),a&&(this.ctx=new Error)}}class Lv extends yg{constructor(s,a,o={maxWait:1e3}){super(s,a);v(this,"callback");v(this,"done");v(this,"timer");v(this,"max");v(this,"opts");if(this.opts=o,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof o.maxMessages=="number"&&o.maxMessages>0?o.maxMessages:-1,this.done=st(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},o.maxWait)}cancel(s){s&&this.callback(s,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(s,a){s?(this.ctx&&(s.stack+=`
|
|
33
33
|
|
|
34
|
-
${this.ctx.stack}`),this.cancel(s)):(this.callback(null,a),this.opts.strategy===jn.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===jn.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===jn.SentinelMsg&&a&&a.data.length===0&&this.cancel())}}class
|
|
34
|
+
${this.ctx.stack}`),this.cancel(s)):(this.callback(null,a),this.opts.strategy===jn.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===jn.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===jn.SentinelMsg&&a&&a.data.length===0&&this.cancel())}}class bg extends yg{constructor(s,a,o={timeout:1e3},f=!0){super(s,a,f);v(this,"deferred");v(this,"timer");this.deferred=st(),this.timer=Sr(o.timeout,f)}resolver(s,a){this.timer&&this.timer.cancel(),s?(this.ctx&&(s.stack+=`
|
|
35
35
|
|
|
36
|
-
${this.ctx.stack}`),this.deferred.reject(s)):this.deferred.resolve(a),this.cancel()}cancel(s){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(s||ue.errorForCode(ie.Cancelled))}}const
|
|
37
|
-
`,zo=Ar.fromAscii(So),Pv=new Uint8Array(zo)[0],$v=new Uint8Array(zo)[1];function Yv(r){for(let n=0;n<r.length;n++){const s=n+1;if(r.byteLength>s&&r[n]===Pv&&r[s]===$v)return s+1}return 0}function Gv(r){const n=Yv(r);if(n>0){const a=new Uint8Array(r).slice(0,n);return Wt.decode(a)}return""}const Vv=4,Sg=48,Fv=65,Jv=97;function Qv(r,n,s,a){const o=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((h,d)=>{o[d]=h}),o[12]=r,o[13]=n,o[14]=s,o[15]=a,o}function qf(r){return Iv(r)!==void 0}function Iv(r){for(let n=0;n<r.length;n++)switch(r[n]){case".":return Eg(r);case":":return Xv(r)}}function Eg(r){const n=new Uint8Array(4);for(let s=0;s<4;s++){if(r.length===0)return;if(s>0){if(r[0]!==".")return;r=r.substring(1)}const{n:a,c:o,ok:f}=Kv(r);if(!f||a>255)return;r=r.substring(o),n[s]=a}return Qv(n[0],n[1],n[2],n[3])}function Xv(r){const n=new Uint8Array(16);let s=-1;if(r.length>=2&&r[0]===":"&&r[1]===":"&&(s=0,r=r.substring(2),r.length===0))return n;let a=0;for(;a<16;){const{n:o,c:f,ok:h}=Zv(r);if(!h||o>65535)return;if(f<r.length&&r[f]==="."){if(s<0&&a!=12||a+4>16)return;const d=Eg(r);if(d===void 0)return;n[a]=d[12],n[a+1]=d[13],n[a+2]=d[14],n[a+3]=d[15],r="",a+=Vv;break}if(n[a]=o>>8,n[a+1]=o,a+=2,r=r.substring(f),r.length===0)break;if(r[0]!==":"||r.length==1)return;if(r=r.substring(1),r[0]===":"){if(s>=0)return;if(s=a,r=r.substring(1),r.length===0)break}}if(r.length===0){if(a<16){if(s<0)return;const o=16-a;for(let f=a-1;f>=s;f--)n[f+o]=n[f];for(let f=s+o-1;f>=s;f--)n[f]=0}else if(s>=0)return;return n}}function Kv(r){let n=0,s=0;for(n=0;n<r.length&&48<=r.charCodeAt(n)&&r.charCodeAt(n)<=57;n++)if(s=s*10+(r.charCodeAt(n)-Sg),s>=16777215)return{n:16777215,c:n,ok:!1};return n===0?{n:0,c:0,ok:!1}:{n:s,c:n,ok:!0}}function Zv(r){let n=0,s=0;for(s=0;s<r.length;s++){if(48<=r.charCodeAt(s)&&r.charCodeAt(s)<=57)n*=16,n+=r.charCodeAt(s)-Sg;else if(97<=r.charCodeAt(s)&&r.charCodeAt(s)<=102)n*=16,n+=r.charCodeAt(s)-Jv+10;else if(65<=r.charCodeAt(s)&&r.charCodeAt(s)<=70)n*=16,n+=r.charCodeAt(s)-Fv+10;else break;if(n>=16777215)return{n:0,c:s,ok:!1}}return s===0?{n:0,c:s,ok:!1}:{n,c:s,ok:!0}}function Wv(r){return r.indexOf("[")!==-1||r.indexOf("::")!==-1?!1:r.indexOf(".")!==-1||r.split(":").length<=2}function Uf(r){return!Wv(r)}function e1(r){const n="::FFFF:",s=r.toUpperCase().indexOf(n);if(s!==-1&&r.indexOf(".")!==-1){let a=r.substring(s+n.length);return a=a.replace("[",""),a.replace("]","")}return r}function t1(r){r=r.trim(),r.match(/^(.*:\/\/)(.*)/m)&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2")),r=e1(r),Uf(r)&&r.indexOf("[")===-1&&(r=`[${r}]`);const n=Uf(r)?r.match(/(]:)(\d+)/):r.match(/(:)(\d+)/),s=n&&n.length===3&&n[1]&&n[2]?parseInt(n[2]):4222,a=s===80?"https":"http",o=new URL(`${a}://${r}`);o.port=`${s}`;let f=o.hostname;return f.charAt(0)==="["&&(f=f.substring(1,f.length-1)),{listen:o.host,hostname:f,port:s}}class Da{constructor(n,s=!1){v(this,"src");v(this,"listen");v(this,"hostname");v(this,"port");v(this,"didConnect");v(this,"reconnects");v(this,"lastConnect");v(this,"gossiped");v(this,"tlsName");v(this,"resolves");this.src=n,this.tlsName="";const a=t1(n);this.listen=a.listen,this.hostname=a.hostname,this.port=a.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=s}toString(){return this.listen}async resolve(n){if(!n.fn||n.resolve===!1)return[this];const s=[];if(qf(this.hostname))return[this];{const a=await n.fn(this.hostname);n.debug&&console.log(`resolve ${this.hostname} = ${a.join(",")}`);for(const o of a){const f=this.port===80?"https":"http",h=new URL(`${f}://${Uf(o)?"["+o+"]":o}`);h.port=`${this.port}`;const d=new Da(h.host,!1);d.tlsName=this.hostname,s.push(d)}}return n.randomize&&yg(s),this.resolves=s,s}}class n1{constructor(n=[],s={}){v(this,"firstSelect");v(this,"servers");v(this,"currentServer");v(this,"tlsName");v(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=s.randomize||!1;const a=mf();n&&(n.forEach(o=>{o=a?a(o):o,this.servers.push(new Da(o))}),this.randomize&&(this.servers=yg(this.servers))),this.servers.length===0&&this.addServer(`${jf}:${wg()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const n=this.getCurrentServer();qf(n.hostname)||(this.tlsName=n.hostname,this.servers.forEach(s=>{s.gossiped&&(s.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(n,s=!1){const a=mf();n=a?a(n):n;const o=new Da(n,s);qf(o.hostname)&&(o.tlsName=this.tlsName),this.servers.push(o)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const n=this.servers.shift();return n&&(this.servers.push(n),this.currentServer=n),n}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(n){if(n){const s=this.servers.indexOf(n);this.servers.splice(s,1)}}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update(n,s){const a=[];let o=[];const f=mf(),h=new Map;n.connect_urls&&n.connect_urls.length>0&&n.connect_urls.forEach(g=>{g=f?f(g,s):g;const y=new Da(g,!0);h.set(g,y)});const d=[];return this.servers.forEach((g,y)=>{const E=g.listen;g.gossiped&&this.currentServer.listen!==E&&h.get(E)===void 0&&d.push(y),h.delete(E)}),d.reverse(),d.forEach(g=>{const y=this.servers.splice(g,1);o=o.concat(y[0].listen)}),h.forEach((g,y)=>{this.servers.push(g),a.push(y)}),{added:a,deleted:o}}}class s1{constructor(){v(this,"baseInbox");v(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(n){return this.baseInbox=`${us(n)}.`,this.baseInbox}add(n){isNaN(n.received)||(n.received=0),this.reqs.set(n.token,n)}get(n){return this.reqs.get(n)}cancel(n){this.reqs.delete(n.token)}getToken(n){const s=n.subject||"";return s.indexOf(this.baseInbox)===0?s.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(n,s){if(s&&s.permissionContext){if(n)return this.all().forEach(o=>{o.resolver(s,{})}),!0;const a=s.permissionContext;if(a.operation==="publish"){const o=this.all().find(f=>f.requestSubject===a.subject);if(o)return o.resolver(s,{}),!0}}return!1}dispatcher(){return(n,s)=>{const a=this.getToken(s);if(a){const o=this.get(a);o&&(n===null&&s.headers&&(n=bg(s)),o.resolver(n,s))}}}close(){const n=ue.errorForCode(ie.Timeout);this.reqs.forEach(s=>{s.resolver(n,{})})}}class i1{constructor(n,s,a){v(this,"ph");v(this,"interval");v(this,"maxOut");v(this,"timer");v(this,"pendings");this.ph=n,this.interval=s,this.maxOut=a,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(n){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),n&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:br.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const n=st();this.ph.flush(n).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(n),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(n=>(n.resolve(),!1))}}class r1 extends Error{constructor(n){super(n),this.name="AssertionError"}}function a1(r,n="Assertion failed."){if(!r)throw new r1(n)}const v0=32*1024,pf=2**32-2;function po(r,n,s=0){const a=n.byteLength-s;return r.byteLength>a&&(r=r.subarray(0,a)),n.set(r,s),r.byteLength}class gf{constructor(n){v(this,"_buf");v(this,"_off");if(this._off=0,n==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(n)}bytes(n={copy:!0}){return n.copy===!1?this._buf.subarray(this._off):this._buf.slice(this._off)}empty(){return this._buf.byteLength<=this._off}get length(){return this._buf.byteLength-this._off}get capacity(){return this._buf.buffer.byteLength}truncate(n){if(n===0){this.reset();return}if(n<0||n>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+n)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(n){const s=this._buf.byteLength;return n<=this.capacity-s?(this._reslice(s+n),s):-1}_reslice(n){a1(n<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,n)}readByte(){const n=new Uint8Array(1);return this.read(n)?n[0]:null}read(n){if(this.empty())return this.reset(),n.byteLength===0?0:null;const s=po(this._buf.subarray(this._off),n);return this._off+=s,s}writeByte(n){return this.write(Uint8Array.of(n))}writeString(n){return this.write(ji.encode(n))}write(n){const s=this._grow(n.byteLength);return po(n,this._buf,s)}_grow(n){const s=this.length;s===0&&this._off!==0&&this.reset();const a=this._tryGrowByReslice(n);if(a>=0)return a;const o=this.capacity;if(n<=Math.floor(o/2)-s)po(this._buf.subarray(this._off),this._buf);else{if(o+n>pf)throw new Error("The buffer cannot be grown beyond the maximum size.");{const f=new Uint8Array(Math.min(2*o+n,pf));po(this._buf.subarray(this._off),f),this._buf=f}}return this._off=0,this._reslice(Math.min(s+n,pf)),s}grow(n){if(n<0)throw Error("Buffer._grow: negative count");const s=this._grow(n);this._reslice(s)}readFrom(n){let s=0;const a=new Uint8Array(v0);for(;;){const o=this.capacity-this.length<v0,f=o?a:new Uint8Array(this._buf.buffer,this.length),h=n.read(f);if(h===null)return s;o?this.write(f.subarray(0,h)):this._reslice(this.length+h),s+=h}}}var Rt;(function(r){r[r.OK=0]="OK",r[r.ERR=1]="ERR",r[r.MSG=2]="MSG",r[r.INFO=3]="INFO",r[r.PING=4]="PING",r[r.PONG=5]="PONG"})(Rt||(Rt={}));function _0(){const r={};return r.sid=-1,r.hdr=-1,r.size=-1,r}const l1=48;class w0{constructor(n){v(this,"dispatcher");v(this,"state");v(this,"as");v(this,"drop");v(this,"hdr");v(this,"ma");v(this,"argBuf");v(this,"msgBuf");this.dispatcher=n,this.state=oe.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(n){let s;for(s=0;s<n.length;s++){const a=n[s];switch(this.state){case oe.OP_START:switch(a){case ce.M:case ce.m:this.state=oe.OP_M,this.hdr=-1,this.ma=_0();break;case ce.H:case ce.h:this.state=oe.OP_H,this.hdr=0,this.ma=_0();break;case ce.P:case ce.p:this.state=oe.OP_P;break;case ce.PLUS:this.state=oe.OP_PLUS;break;case ce.MINUS:this.state=oe.OP_MINUS;break;case ce.I:case ce.i:this.state=oe.OP_I;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_H:switch(a){case ce.M:case ce.m:this.state=oe.OP_M;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_M:switch(a){case ce.S:case ce.s:this.state=oe.OP_MS;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_MS:switch(a){case ce.G:case ce.g:this.state=oe.OP_MSG;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_MSG:switch(a){case ce.SPACE:case ce.TAB:this.state=oe.OP_MSG_SPC;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_MSG_SPC:switch(a){case ce.SPACE:case ce.TAB:continue;default:this.state=oe.MSG_ARG,this.as=s}break;case oe.MSG_ARG:switch(a){case ce.CR:this.drop=1;break;case ce.NL:{const o=this.argBuf?this.argBuf.bytes():n.subarray(this.as,s-this.drop);this.processMsgArgs(o),this.drop=0,this.as=s+1,this.state=oe.MSG_PAYLOAD,s=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;case oe.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const o=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:Rt.MSG,msg:this.ma,data:o}),this.argBuf=void 0,this.msgBuf=void 0,this.state=oe.MSG_END}else{let o=this.ma.size-this.msgBuf.length;const f=n.length-s;f<o&&(o=f),o>0?(this.msgBuf.write(n.subarray(s,s+o)),s=s+o-1):this.msgBuf.writeByte(a)}else s-this.as>=this.ma.size&&(this.dispatcher.push({kind:Rt.MSG,msg:this.ma,data:n.subarray(this.as,s)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=oe.MSG_END);break;case oe.MSG_END:switch(a){case ce.NL:this.drop=0,this.as=s+1,this.state=oe.OP_START;break;default:continue}break;case oe.OP_PLUS:switch(a){case ce.O:case ce.o:this.state=oe.OP_PLUS_O;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_PLUS_O:switch(a){case ce.K:case ce.k:this.state=oe.OP_PLUS_OK;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_PLUS_OK:switch(a){case ce.NL:this.dispatcher.push({kind:Rt.OK}),this.drop=0,this.state=oe.OP_START;break}break;case oe.OP_MINUS:switch(a){case ce.E:case ce.e:this.state=oe.OP_MINUS_E;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_MINUS_E:switch(a){case ce.R:case ce.r:this.state=oe.OP_MINUS_ER;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_MINUS_ER:switch(a){case ce.R:case ce.r:this.state=oe.OP_MINUS_ERR;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_MINUS_ERR:switch(a){case ce.SPACE:case ce.TAB:this.state=oe.OP_MINUS_ERR_SPC;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_MINUS_ERR_SPC:switch(a){case ce.SPACE:case ce.TAB:continue;default:this.state=oe.MINUS_ERR_ARG,this.as=s}break;case oe.MINUS_ERR_ARG:switch(a){case ce.CR:this.drop=1;break;case ce.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=n.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Rt.ERR,data:o}),this.drop=0,this.as=s+1,this.state=oe.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(a))}break;case oe.OP_P:switch(a){case ce.I:case ce.i:this.state=oe.OP_PI;break;case ce.O:case ce.o:this.state=oe.OP_PO;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_PO:switch(a){case ce.N:case ce.n:this.state=oe.OP_PON;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_PON:switch(a){case ce.G:case ce.g:this.state=oe.OP_PONG;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_PONG:switch(a){case ce.NL:this.dispatcher.push({kind:Rt.PONG}),this.drop=0,this.state=oe.OP_START;break}break;case oe.OP_PI:switch(a){case ce.N:case ce.n:this.state=oe.OP_PIN;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_PIN:switch(a){case ce.G:case ce.g:this.state=oe.OP_PING;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_PING:switch(a){case ce.NL:this.dispatcher.push({kind:Rt.PING}),this.drop=0,this.state=oe.OP_START;break}break;case oe.OP_I:switch(a){case ce.N:case ce.n:this.state=oe.OP_IN;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_IN:switch(a){case ce.F:case ce.f:this.state=oe.OP_INF;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_INF:switch(a){case ce.O:case ce.o:this.state=oe.OP_INFO;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_INFO:switch(a){case ce.SPACE:case ce.TAB:this.state=oe.OP_INFO_SPC;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_INFO_SPC:switch(a){case ce.SPACE:case ce.TAB:continue;default:this.state=oe.INFO_ARG,this.as=s}break;case oe.INFO_ARG:switch(a){case ce.CR:this.drop=1;break;case ce.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=n.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Rt.INFO,data:o}),this.drop=0,this.as=s+1,this.state=oe.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;default:throw this.fail(n.subarray(s))}}(this.state===oe.MSG_ARG||this.state===oe.MINUS_ERR_ARG||this.state===oe.INFO_ARG)&&!this.argBuf&&(this.argBuf=new gf(n.subarray(this.as,s-this.drop))),this.state===oe.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new gf(n.subarray(this.as)))}cloneMsgArg(){const n=this.ma.subject.length,s=this.ma.reply?this.ma.reply.length:0,a=new Uint8Array(n+s);a.set(this.ma.subject),this.ma.reply&&a.set(this.ma.reply,n),this.argBuf=new gf(a),this.ma.subject=a.subarray(0,n),this.ma.reply&&(this.ma.reply=a.subarray(n))}processMsgArgs(n){if(this.hdr>=0)return this.processHeaderMsgArgs(n);const s=[];let a=-1;for(let o=0;o<n.length;o++)switch(n[o]){case ce.SPACE:case ce.TAB:case ce.CR:case ce.NL:a>=0&&(s.push(n.subarray(a,o)),a=-1);break;default:a<0&&(a=o)}switch(a>=0&&s.push(n.subarray(a)),s.length){case 3:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(s[2]);break;case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.size=this.protoParseInt(s[3]);break;default:throw this.fail(n,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(n,"processMsgArgs Bad or Missing Size Error")}fail(n,s=""){return s?s=`${s} [${this.state}]`:s=`parse error [${this.state}]`,new Error(`${s}: ${Wt.decode(n)}`)}processHeaderMsgArgs(n){const s=[];let a=-1;for(let o=0;o<n.length;o++)switch(n[o]){case ce.SPACE:case ce.TAB:case ce.CR:case ce.NL:a>=0&&(s.push(n.subarray(a,o)),a=-1);break;default:a<0&&(a=o)}switch(a>=0&&s.push(n.subarray(a)),s.length){case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(s[2]),this.ma.size=this.protoParseInt(s[3]);break;case 5:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.hdr=this.protoParseInt(s[3]),this.ma.size=this.protoParseInt(s[4]);break;default:throw this.fail(n,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(n){if(n.length===0)return-1;let s=0;for(let a=0;a<n.length;a++){if(n[a]<48||n[a]>57)return-1;s=s*10+(n[a]-l1)}return s}}var oe;(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"})(oe||(oe={}));var ce;(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"})(ce||(ce={}));(function(r){var n=function(x,S){this.hi=x|0,this.lo=S|0},s=function(x){var S,_=new Float64Array(16);if(x)for(S=0;S<x.length;S++)_[S]=x[S];return _},a=function(){throw new Error("no PRNG")},o=new Uint8Array(16),f=new Uint8Array(32);f[0]=9;var h=s(),d=s([1]),g=s([56129,1]),y=s([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),E=s([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),w=s([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),j=s([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),z=s([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function M(x,S){return x<<S|x>>>32-S}function B(x,S){var _=x[S+3]&255;return _=_<<8|x[S+2]&255,_=_<<8|x[S+1]&255,_<<8|x[S+0]&255}function V(x,S){var _=x[S]<<24|x[S+1]<<16|x[S+2]<<8|x[S+3],A=x[S+4]<<24|x[S+5]<<16|x[S+6]<<8|x[S+7];return new n(_,A)}function ne(x,S,_){var A;for(A=0;A<4;A++)x[S+A]=_&255,_>>>=8}function ee(x,S,_){x[S]=_.hi>>24&255,x[S+1]=_.hi>>16&255,x[S+2]=_.hi>>8&255,x[S+3]=_.hi&255,x[S+4]=_.lo>>24&255,x[S+5]=_.lo>>16&255,x[S+6]=_.lo>>8&255,x[S+7]=_.lo&255}function pe(x,S,_,A,N){var D,Q=0;for(D=0;D<N;D++)Q|=x[S+D]^_[A+D];return(1&Q-1>>>8)-1}function ae(x,S,_,A){return pe(x,S,_,A,16)}function k(x,S,_,A){return pe(x,S,_,A,32)}function X(x,S,_,A,N){var D=new Uint32Array(16),Q=new Uint32Array(16),K=new Uint32Array(16),H=new Uint32Array(4),J,fe,Oe;for(J=0;J<4;J++)Q[5*J]=B(A,4*J),Q[1+J]=B(_,4*J),Q[6+J]=B(S,4*J),Q[11+J]=B(_,16+4*J);for(J=0;J<16;J++)K[J]=Q[J];for(J=0;J<20;J++){for(fe=0;fe<4;fe++){for(Oe=0;Oe<4;Oe++)H[Oe]=Q[(5*fe+4*Oe)%16];for(H[1]^=M(H[0]+H[3]|0,7),H[2]^=M(H[1]+H[0]|0,9),H[3]^=M(H[2]+H[1]|0,13),H[0]^=M(H[3]+H[2]|0,18),Oe=0;Oe<4;Oe++)D[4*fe+(fe+Oe)%4]=H[Oe]}for(Oe=0;Oe<16;Oe++)Q[Oe]=D[Oe]}if(N){for(J=0;J<16;J++)Q[J]=Q[J]+K[J]|0;for(J=0;J<4;J++)Q[5*J]=Q[5*J]-B(A,4*J)|0,Q[6+J]=Q[6+J]-B(S,4*J)|0;for(J=0;J<4;J++)ne(x,4*J,Q[5*J]),ne(x,16+4*J,Q[6+J])}else for(J=0;J<16;J++)ne(x,4*J,Q[J]+K[J]|0)}function se(x,S,_,A){return X(x,S,_,A,!1),0}function W(x,S,_,A){return X(x,S,_,A,!0),0}var F=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function Z(x,S,_,A,N,D,Q){var K=new Uint8Array(16),H=new Uint8Array(64),J,fe;if(!N)return 0;for(fe=0;fe<16;fe++)K[fe]=0;for(fe=0;fe<8;fe++)K[fe]=D[fe];for(;N>=64;){for(se(H,K,Q,F),fe=0;fe<64;fe++)x[S+fe]=(_?_[A+fe]:0)^H[fe];for(J=1,fe=8;fe<16;fe++)J=J+(K[fe]&255)|0,K[fe]=J&255,J>>>=8;N-=64,S+=64,_&&(A+=64)}if(N>0)for(se(H,K,Q,F),fe=0;fe<N;fe++)x[S+fe]=(_?_[A+fe]:0)^H[fe];return 0}function le(x,S,_,A,N){return Z(x,S,null,0,_,A,N)}function re(x,S,_,A,N){var D=new Uint8Array(32);return W(D,A,N,F),le(x,S,_,A.subarray(16),D)}function qe(x,S,_,A,N,D,Q){var K=new Uint8Array(32);return W(K,D,Q,F),Z(x,S,_,A,N,D.subarray(16),K)}function Ge(x,S){var _,A=0;for(_=0;_<17;_++)A=A+(x[_]+S[_]|0)|0,x[_]=A&255,A>>>=8}var Le=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function $(x,S,_,A,N,D){var Q,K,H,J,fe=new Uint32Array(17),Oe=new Uint32Array(17),Ke=new Uint32Array(17),Ct=new Uint32Array(17),_n=new Uint32Array(17);for(H=0;H<17;H++)Oe[H]=Ke[H]=0;for(H=0;H<16;H++)Oe[H]=D[H];for(Oe[3]&=15,Oe[4]&=252,Oe[7]&=15,Oe[8]&=252,Oe[11]&=15,Oe[12]&=252,Oe[15]&=15;N>0;){for(H=0;H<17;H++)Ct[H]=0;for(H=0;H<16&&H<N;++H)Ct[H]=_[A+H];for(Ct[H]=1,A+=H,N-=H,Ge(Ke,Ct),K=0;K<17;K++)for(fe[K]=0,H=0;H<17;H++)fe[K]=fe[K]+Ke[H]*(H<=K?Oe[K-H]:320*Oe[K+17-H]|0)|0|0;for(K=0;K<17;K++)Ke[K]=fe[K];for(J=0,H=0;H<16;H++)J=J+Ke[H]|0,Ke[H]=J&255,J>>>=8;for(J=J+Ke[16]|0,Ke[16]=J&3,J=5*(J>>>2)|0,H=0;H<16;H++)J=J+Ke[H]|0,Ke[H]=J&255,J>>>=8;J=J+Ke[16]|0,Ke[16]=J}for(H=0;H<17;H++)_n[H]=Ke[H];for(Ge(Ke,Le),Q=-(Ke[16]>>>7)|0,H=0;H<17;H++)Ke[H]^=Q&(_n[H]^Ke[H]);for(H=0;H<16;H++)Ct[H]=D[H+16];for(Ct[16]=0,Ge(Ke,Ct),H=0;H<16;H++)x[S+H]=Ke[H];return 0}function te(x,S,_,A,N,D){var Q=new Uint8Array(16);return $(Q,0,_,A,N,D),ae(x,S,Q,0)}function de(x,S,_,A,N){var D;if(_<32)return-1;for(qe(x,0,S,0,_,A,N),$(x,16,x,32,_-32,x),D=0;D<16;D++)x[D]=0;return 0}function ve(x,S,_,A,N){var D,Q=new Uint8Array(32);if(_<32||(re(Q,0,32,A,N),te(S,16,S,32,_-32,Q)!==0))return-1;for(qe(x,0,S,0,_,A,N),D=0;D<32;D++)x[D]=0;return 0}function be(x,S){var _;for(_=0;_<16;_++)x[_]=S[_]|0}function je(x){var S,_;for(_=0;_<16;_++)x[_]+=65536,S=Math.floor(x[_]/65536),x[(_+1)*(_<15?1:0)]+=S-1+37*(S-1)*(_===15?1:0),x[_]-=S*65536}function _e(x,S,_){for(var A,N=~(_-1),D=0;D<16;D++)A=N&(x[D]^S[D]),x[D]^=A,S[D]^=A}function Te(x,S){var _,A,N,D=s(),Q=s();for(_=0;_<16;_++)Q[_]=S[_];for(je(Q),je(Q),je(Q),A=0;A<2;A++){for(D[0]=Q[0]-65517,_=1;_<15;_++)D[_]=Q[_]-65535-(D[_-1]>>16&1),D[_-1]&=65535;D[15]=Q[15]-32767-(D[14]>>16&1),N=D[15]>>16&1,D[14]&=65535,_e(Q,D,1-N)}for(_=0;_<16;_++)x[2*_]=Q[_]&255,x[2*_+1]=Q[_]>>8}function lt(x,S){var _=new Uint8Array(32),A=new Uint8Array(32);return Te(_,x),Te(A,S),k(_,0,A,0)}function Pt(x){var S=new Uint8Array(32);return Te(S,x),S[0]&1}function sn(x,S){var _;for(_=0;_<16;_++)x[_]=S[2*_]+(S[2*_+1]<<8);x[15]&=32767}function Ot(x,S,_){var A;for(A=0;A<16;A++)x[A]=S[A]+_[A]|0}function jt(x,S,_){var A;for(A=0;A<16;A++)x[A]=S[A]-_[A]|0}function we(x,S,_){var A,N,D=new Float64Array(31);for(A=0;A<31;A++)D[A]=0;for(A=0;A<16;A++)for(N=0;N<16;N++)D[A+N]+=S[A]*_[N];for(A=0;A<15;A++)D[A]+=38*D[A+16];for(A=0;A<16;A++)x[A]=D[A];je(x),je(x)}function Tt(x,S){we(x,S,S)}function ei(x,S){var _=s(),A;for(A=0;A<16;A++)_[A]=S[A];for(A=253;A>=0;A--)Tt(_,_),A!==2&&A!==4&&we(_,_,S);for(A=0;A<16;A++)x[A]=_[A]}function Ti(x,S){var _=s(),A;for(A=0;A<16;A++)_[A]=S[A];for(A=250;A>=0;A--)Tt(_,_),A!==1&&we(_,_,S);for(A=0;A<16;A++)x[A]=_[A]}function ti(x,S,_){var A=new Uint8Array(32),N=new Float64Array(80),D,Q,K=s(),H=s(),J=s(),fe=s(),Oe=s(),Ke=s();for(Q=0;Q<31;Q++)A[Q]=S[Q];for(A[31]=S[31]&127|64,A[0]&=248,sn(N,_),Q=0;Q<16;Q++)H[Q]=N[Q],fe[Q]=K[Q]=J[Q]=0;for(K[0]=fe[0]=1,Q=254;Q>=0;--Q)D=A[Q>>>3]>>>(Q&7)&1,_e(K,H,D),_e(J,fe,D),Ot(Oe,K,J),jt(K,K,J),Ot(J,H,fe),jt(H,H,fe),Tt(fe,Oe),Tt(Ke,K),we(K,J,K),we(J,H,Oe),Ot(Oe,K,J),jt(K,K,J),Tt(H,K),jt(J,fe,Ke),we(K,J,g),Ot(K,K,fe),we(J,J,K),we(K,fe,Ke),we(fe,H,N),Tt(H,Oe),_e(K,H,D),_e(J,fe,D);for(Q=0;Q<16;Q++)N[Q+16]=K[Q],N[Q+32]=J[Q],N[Q+48]=H[Q],N[Q+64]=fe[Q];var Ct=N.subarray(32),_n=N.subarray(16);return ei(Ct,Ct),we(_n,_n,Ct),Te(x,_n),0}function rn(x,S){return ti(x,S,f)}function Ni(x,S){return a(S,32),rn(x,S)}function ds(x,S,_){var A=new Uint8Array(32);return ti(A,_,S),W(x,o,A,F)}var Fa=de,Ja=ve;function Tr(x,S,_,A,N,D){var Q=new Uint8Array(32);return ds(Q,N,D),Fa(x,S,_,A,Q)}function Nr(x,S,_,A,N,D){var Q=new Uint8Array(32);return ds(Q,N,D),Ja(x,S,_,A,Q)}function $n(){var x=0,S=0,_=0,A=0,N=65535,D,Q,K;for(K=0;K<arguments.length;K++)D=arguments[K].lo,Q=arguments[K].hi,x+=D&N,S+=D>>>16,_+=Q&N,A+=Q>>>16;return S+=x>>>16,_+=S>>>16,A+=_>>>16,new n(_&N|A<<16,x&N|S<<16)}function Qa(x,S){return new n(x.hi>>>S,x.lo>>>S|x.hi<<32-S)}function Ci(){var x=0,S=0,_;for(_=0;_<arguments.length;_++)x^=arguments[_].lo,S^=arguments[_].hi;return new n(S,x)}function et(x,S){var _,A,N=32-S;return S<32?(_=x.hi>>>S|x.lo<<N,A=x.lo>>>S|x.hi<<N):S<64&&(_=x.lo>>>S|x.hi<<N,A=x.hi>>>S|x.lo<<N),new n(_,A)}function Io(x,S,_){var A=x.hi&S.hi^~x.hi&_.hi,N=x.lo&S.lo^~x.lo&_.lo;return new n(A,N)}function Ia(x,S,_){var A=x.hi&S.hi^x.hi&_.hi^S.hi&_.hi,N=x.lo&S.lo^x.lo&_.lo^S.lo&_.lo;return new n(A,N)}function Xa(x){return Ci(et(x,28),et(x,34),et(x,39))}function ki(x){return Ci(et(x,14),et(x,18),et(x,41))}function Xo(x){return Ci(et(x,1),et(x,8),Qa(x,7))}function Ka(x){return Ci(et(x,19),et(x,61),Qa(x,6))}var Ko=[new n(1116352408,3609767458),new n(1899447441,602891725),new n(3049323471,3964484399),new n(3921009573,2173295548),new n(961987163,4081628472),new n(1508970993,3053834265),new n(2453635748,2937671579),new n(2870763221,3664609560),new n(3624381080,2734883394),new n(310598401,1164996542),new n(607225278,1323610764),new n(1426881987,3590304994),new n(1925078388,4068182383),new n(2162078206,991336113),new n(2614888103,633803317),new n(3248222580,3479774868),new n(3835390401,2666613458),new n(4022224774,944711139),new n(264347078,2341262773),new n(604807628,2007800933),new n(770255983,1495990901),new n(1249150122,1856431235),new n(1555081692,3175218132),new n(1996064986,2198950837),new n(2554220882,3999719339),new n(2821834349,766784016),new n(2952996808,2566594879),new n(3210313671,3203337956),new n(3336571891,1034457026),new n(3584528711,2466948901),new n(113926993,3758326383),new n(338241895,168717936),new n(666307205,1188179964),new n(773529912,1546045734),new n(1294757372,1522805485),new n(1396182291,2643833823),new n(1695183700,2343527390),new n(1986661051,1014477480),new n(2177026350,1206759142),new n(2456956037,344077627),new n(2730485921,1290863460),new n(2820302411,3158454273),new n(3259730800,3505952657),new n(3345764771,106217008),new n(3516065817,3606008344),new n(3600352804,1432725776),new n(4094571909,1467031594),new n(275423344,851169720),new n(430227734,3100823752),new n(506948616,1363258195),new n(659060556,3750685593),new n(883997877,3785050280),new n(958139571,3318307427),new n(1322822218,3812723403),new n(1537002063,2003034995),new n(1747873779,3602036899),new n(1955562222,1575990012),new n(2024104815,1125592928),new n(2227730452,2716904306),new n(2361852424,442776044),new n(2428436474,593698344),new n(2756734187,3733110249),new n(3204031479,2999351573),new n(3329325298,3815920427),new n(3391569614,3928383900),new n(3515267271,566280711),new n(3940187606,3454069534),new n(4118630271,4000239992),new n(116418474,1914138554),new n(174292421,2731055270),new n(289380356,3203993006),new n(460393269,320620315),new n(685471733,587496836),new n(852142971,1086792851),new n(1017036298,365543100),new n(1126000580,2618297676),new n(1288033470,3409855158),new n(1501505948,4234509866),new n(1607167915,987167468),new n(1816402316,1246189591)];function Za(x,S,_){var A=[],N=[],D=[],Q=[],K,H,J;for(H=0;H<8;H++)A[H]=D[H]=V(x,8*H);for(var fe=0;_>=128;){for(H=0;H<16;H++)Q[H]=V(S,8*H+fe);for(H=0;H<80;H++){for(J=0;J<8;J++)N[J]=D[J];for(K=$n(D[7],ki(D[4]),Io(D[4],D[5],D[6]),Ko[H],Q[H%16]),N[7]=$n(K,Xa(D[0]),Ia(D[0],D[1],D[2])),N[3]=$n(N[3],K),J=0;J<8;J++)D[(J+1)%8]=N[J];if(H%16===15)for(J=0;J<16;J++)Q[J]=$n(Q[J],Q[(J+9)%16],Xo(Q[(J+1)%16]),Ka(Q[(J+14)%16]))}for(H=0;H<8;H++)D[H]=$n(D[H],A[H]),A[H]=D[H];fe+=128,_-=128}for(H=0;H<8;H++)ee(x,8*H,A[H]);return _}var ni=new Uint8Array([106,9,230,103,243,188,201,8,187,103,174,133,132,202,167,59,60,110,243,114,254,148,248,43,165,79,245,58,95,29,54,241,81,14,82,127,173,230,130,209,155,5,104,140,43,62,108,31,31,131,217,171,251,65,189,107,91,224,205,25,19,126,33,121]);function ot(x,S,_){var A=new Uint8Array(64),N=new Uint8Array(256),D,Q=_;for(D=0;D<64;D++)A[D]=ni[D];for(Za(A,S,_),_%=128,D=0;D<256;D++)N[D]=0;for(D=0;D<_;D++)N[D]=S[Q-_+D];for(N[_]=128,_=256-128*(_<112?1:0),N[_-9]=0,ee(N,_-8,new n(Q/536870912|0,Q<<3)),Za(A,N,_),D=0;D<64;D++)x[D]=A[D];return 0}function $t(x,S){var _=s(),A=s(),N=s(),D=s(),Q=s(),K=s(),H=s(),J=s(),fe=s();jt(_,x[1],x[0]),jt(fe,S[1],S[0]),we(_,_,fe),Ot(A,x[0],x[1]),Ot(fe,S[0],S[1]),we(A,A,fe),we(N,x[3],S[3]),we(N,N,E),we(D,x[2],S[2]),Ot(D,D,D),jt(Q,A,_),jt(K,D,N),Ot(H,D,N),Ot(J,A,_),we(x[0],Q,K),we(x[1],J,H),we(x[2],H,K),we(x[3],Q,J)}function Nt(x,S,_){var A;for(A=0;A<4;A++)_e(x[A],S[A],_)}function Cr(x,S){var _=s(),A=s(),N=s();ei(N,S[2]),we(_,S[0],N),we(A,S[1],N),Te(x,A),x[31]^=Pt(_)<<7}function kr(x,S,_){var A,N;for(be(x[0],h),be(x[1],d),be(x[2],d),be(x[3],h),N=255;N>=0;--N)A=_[N/8|0]>>(N&7)&1,Nt(x,S,A),$t(S,x),$t(x,x),Nt(x,S,A)}function Mi(x,S){var _=[s(),s(),s(),s()];be(_[0],w),be(_[1],j),be(_[2],d),we(_[3],w,j),kr(x,_,S)}function ms(x,S,_){var A=new Uint8Array(64),N=[s(),s(),s(),s()],D;for(_||a(S,32),ot(A,S,32),A[0]&=248,A[31]&=127,A[31]|=64,Mi(N,A),Cr(x,N),D=0;D<32;D++)S[D+32]=x[D];return 0}var Yn=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 ps(x,S){var _,A,N,D;for(A=63;A>=32;--A){for(_=0,N=A-32,D=A-12;N<D;++N)S[N]+=_-16*S[A]*Yn[N-(A-32)],_=Math.floor((S[N]+128)/256),S[N]-=_*256;S[N]+=_,S[A]=0}for(_=0,N=0;N<32;N++)S[N]+=_-(S[31]>>4)*Yn[N],_=S[N]>>8,S[N]&=255;for(N=0;N<32;N++)S[N]-=_*Yn[N];for(A=0;A<32;A++)S[A+1]+=S[A]>>8,x[A]=S[A]&255}function xn(x){var S=new Float64Array(64),_;for(_=0;_<64;_++)S[_]=x[_];for(_=0;_<64;_++)x[_]=0;ps(x,S)}function si(x,S,_,A){var N=new Uint8Array(64),D=new Uint8Array(64),Q=new Uint8Array(64),K,H,J=new Float64Array(64),fe=[s(),s(),s(),s()];ot(N,A,32),N[0]&=248,N[31]&=127,N[31]|=64;var Oe=_+64;for(K=0;K<_;K++)x[64+K]=S[K];for(K=0;K<32;K++)x[32+K]=N[32+K];for(ot(Q,x.subarray(32),_+32),xn(Q),Mi(fe,Q),Cr(x,fe),K=32;K<64;K++)x[K]=A[K];for(ot(D,x,_+64),xn(D),K=0;K<64;K++)J[K]=0;for(K=0;K<32;K++)J[K]=Q[K];for(K=0;K<32;K++)for(H=0;H<32;H++)J[K+H]+=D[K]*N[H];return ps(x.subarray(32),J),Oe}function ii(x,S){var _=s(),A=s(),N=s(),D=s(),Q=s(),K=s(),H=s();return be(x[2],d),sn(x[1],S),Tt(N,x[1]),we(D,N,y),jt(N,N,x[2]),Ot(D,x[2],D),Tt(Q,D),Tt(K,Q),we(H,K,Q),we(_,H,N),we(_,_,D),Ti(_,_),we(_,_,N),we(_,_,D),we(_,_,D),we(x[0],_,D),Tt(A,x[0]),we(A,A,D),lt(A,N)&&we(x[0],x[0],z),Tt(A,x[0]),we(A,A,D),lt(A,N)?-1:(Pt(x[0])===S[31]>>7&&jt(x[0],h,x[0]),we(x[3],x[0],x[1]),0)}function Mr(x,S,_,A){var N,D=new Uint8Array(32),Q=new Uint8Array(64),K=[s(),s(),s(),s()],H=[s(),s(),s(),s()];if(_<64||ii(H,A))return-1;for(N=0;N<_;N++)x[N]=S[N];for(N=0;N<32;N++)x[N+32]=A[N];if(ot(Q,x,_),xn(Q),kr(K,H,Q),Mi(H,S.subarray(32)),$t(K,H),Cr(D,K),_-=64,k(S,0,D,0)){for(N=0;N<_;N++)x[N]=0;return-1}for(N=0;N<_;N++)x[N]=S[N+64];return _}var Ri=32,gs=24,vn=32,ys=16,bs=32,ri=32,xs=32,Gn=32,ai=32,Rr=gs,Wa=vn,Cn=ys,Qe=64,it=32,Yt=64,li=32,Dr=64;r.lowlevel={crypto_core_hsalsa20:W,crypto_stream_xor:qe,crypto_stream:re,crypto_stream_salsa20_xor:Z,crypto_stream_salsa20:le,crypto_onetimeauth:$,crypto_onetimeauth_verify:te,crypto_verify_16:ae,crypto_verify_32:k,crypto_secretbox:de,crypto_secretbox_open:ve,crypto_scalarmult:ti,crypto_scalarmult_base:rn,crypto_box_beforenm:ds,crypto_box_afternm:Fa,crypto_box:Tr,crypto_box_open:Nr,crypto_box_keypair:Ni,crypto_hash:ot,crypto_sign:si,crypto_sign_keypair:ms,crypto_sign_open:Mr,crypto_secretbox_KEYBYTES:Ri,crypto_secretbox_NONCEBYTES:gs,crypto_secretbox_ZEROBYTES:vn,crypto_secretbox_BOXZEROBYTES:ys,crypto_scalarmult_BYTES:bs,crypto_scalarmult_SCALARBYTES:ri,crypto_box_PUBLICKEYBYTES:xs,crypto_box_SECRETKEYBYTES:Gn,crypto_box_BEFORENMBYTES:ai,crypto_box_NONCEBYTES:Rr,crypto_box_ZEROBYTES:Wa,crypto_box_BOXZEROBYTES:Cn,crypto_sign_BYTES:Qe,crypto_sign_PUBLICKEYBYTES:it,crypto_sign_SECRETKEYBYTES:Yt,crypto_sign_SEEDBYTES:li,crypto_hash_BYTES:Dr,gf:s,D:y,L:Yn,pack25519:Te,unpack25519:sn,M:we,A:Ot,S:Tt,Z:jt,pow2523:Ti,add:$t,set25519:be,modL:ps,scalarmult:kr,scalarbase:Mi};function el(x,S){if(x.length!==Ri)throw new Error("bad key size");if(S.length!==gs)throw new Error("bad nonce size")}function tl(x,S){if(x.length!==xs)throw new Error("bad public key size");if(S.length!==Gn)throw new Error("bad secret key size")}function yt(){for(var x=0;x<arguments.length;x++)if(!(arguments[x]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Di(x){for(var S=0;S<x.length;S++)x[S]=0}r.randomBytes=function(x){var S=new Uint8Array(x);return a(S,x),S},r.secretbox=function(x,S,_){yt(x,S,_),el(_,S);for(var A=new Uint8Array(vn+x.length),N=new Uint8Array(A.length),D=0;D<x.length;D++)A[D+vn]=x[D];return de(N,A,A.length,S,_),N.subarray(ys)},r.secretbox.open=function(x,S,_){yt(x,S,_),el(_,S);for(var A=new Uint8Array(ys+x.length),N=new Uint8Array(A.length),D=0;D<x.length;D++)A[D+ys]=x[D];return A.length<32||ve(N,A,A.length,S,_)!==0?null:N.subarray(vn)},r.secretbox.keyLength=Ri,r.secretbox.nonceLength=gs,r.secretbox.overheadLength=ys,r.scalarMult=function(x,S){if(yt(x,S),x.length!==ri)throw new Error("bad n size");if(S.length!==bs)throw new Error("bad p size");var _=new Uint8Array(bs);return ti(_,x,S),_},r.scalarMult.base=function(x){if(yt(x),x.length!==ri)throw new Error("bad n size");var S=new Uint8Array(bs);return rn(S,x),S},r.scalarMult.scalarLength=ri,r.scalarMult.groupElementLength=bs,r.box=function(x,S,_,A){var N=r.box.before(_,A);return r.secretbox(x,S,N)},r.box.before=function(x,S){yt(x,S),tl(x,S);var _=new Uint8Array(ai);return ds(_,x,S),_},r.box.after=r.secretbox,r.box.open=function(x,S,_,A){var N=r.box.before(_,A);return r.secretbox.open(x,S,N)},r.box.open.after=r.secretbox.open,r.box.keyPair=function(){var x=new Uint8Array(xs),S=new Uint8Array(Gn);return Ni(x,S),{publicKey:x,secretKey:S}},r.box.keyPair.fromSecretKey=function(x){if(yt(x),x.length!==Gn)throw new Error("bad secret key size");var S=new Uint8Array(xs);return rn(S,x),{publicKey:S,secretKey:new Uint8Array(x)}},r.box.publicKeyLength=xs,r.box.secretKeyLength=Gn,r.box.sharedKeyLength=ai,r.box.nonceLength=Rr,r.box.overheadLength=r.secretbox.overheadLength,r.sign=function(x,S){if(yt(x,S),S.length!==Yt)throw new Error("bad secret key size");var _=new Uint8Array(Qe+x.length);return si(_,x,x.length,S),_},r.sign.open=function(x,S){if(yt(x,S),S.length!==it)throw new Error("bad public key size");var _=new Uint8Array(x.length),A=Mr(_,x,x.length,S);if(A<0)return null;for(var N=new Uint8Array(A),D=0;D<N.length;D++)N[D]=_[D];return N},r.sign.detached=function(x,S){for(var _=r.sign(x,S),A=new Uint8Array(Qe),N=0;N<A.length;N++)A[N]=_[N];return A},r.sign.detached.verify=function(x,S,_){if(yt(x,S,_),S.length!==Qe)throw new Error("bad signature size");if(_.length!==it)throw new Error("bad public key size");var A=new Uint8Array(Qe+x.length),N=new Uint8Array(Qe+x.length),D;for(D=0;D<Qe;D++)A[D]=S[D];for(D=0;D<x.length;D++)A[D+Qe]=x[D];return Mr(N,A,A.length,_)>=0},r.sign.keyPair=function(){var x=new Uint8Array(it),S=new Uint8Array(Yt);return ms(x,S),{publicKey:x,secretKey:S}},r.sign.keyPair.fromSecretKey=function(x){if(yt(x),x.length!==Yt)throw new Error("bad secret key size");for(var S=new Uint8Array(it),_=0;_<S.length;_++)S[_]=x[32+_];return{publicKey:S,secretKey:new Uint8Array(x)}},r.sign.keyPair.fromSeed=function(x){if(yt(x),x.length!==li)throw new Error("bad seed size");for(var S=new Uint8Array(it),_=new Uint8Array(Yt),A=0;A<32;A++)_[A]=x[A];return ms(S,_,!0),{publicKey:S,secretKey:_}},r.sign.publicKeyLength=it,r.sign.secretKeyLength=Yt,r.sign.seedLength=li,r.sign.signatureLength=Qe,r.hash=function(x){yt(x);var S=new Uint8Array(Dr);return ot(S,x,x.length),S},r.hash.hashLength=Dr,r.verify=function(x,S){return yt(x,S),x.length===0||S.length===0||x.length!==S.length?!1:pe(x,0,S,0,x.length)===0},r.setPRNG=function(x){a=x},(function(){var x=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(x&&x.getRandomValues){var S=65536;r.setPRNG(function(_,A){var N,D=new Uint8Array(A);for(N=0;N<A;N+=S)x.getRandomValues(D.subarray(N,N+Math.min(A-N,S)));for(N=0;N<A;N++)_[N]=D[N];Di(D)})}else typeof require<"u"&&(x=require("crypto"),x&&x.randomBytes&&r.setPRNG(function(_,A){var N,D=x.randomBytes(A);for(N=0;N<A;N++)_[N]=D[N];Di(D)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const go=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;go.sign.keyPair.fromSeed,go.sign.detached,go.sign.detached.verify,go.randomBytes;var S0;(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"})(S0||(S0={}));var E0;(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"})(E0||(E0={}));function o1(r){return n=>{let s={};return r.forEach(a=>{const o=a(n)||{};s=Object.assign(s,o)}),s}}function c1(){return()=>{}}function u1(r,n){return()=>{const s=typeof r=="function"?r():r,a=typeof n=="function"?n():n;return{user:s,pass:a}}}function f1(r){return()=>({auth_token:typeof r=="function"?r():r})}const Ag=120*1e3,h1=2,Og=2*1e3;function d1(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:Ag,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:Og,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function m1(r){const n=[];return typeof r.authenticator=="function"&&n.push(r.authenticator),Array.isArray(r.authenticator)&&n.push(...r.authenticator),r.token&&n.push(f1(r.token)),r.user&&n.push(u1(r.user,r.pass)),n.length===0?c1():o1(n)}function p1(r){const n=`${jf}:${wg()}`;if(r=r||{servers:[n]},r.servers=r.servers||[],typeof r.servers=="string"&&(r.servers=[r.servers]),r.servers.length>0&&r.port)throw new ue("port and servers options are mutually exclusive",ie.InvalidOption);r.servers.length===0&&r.port&&(r.servers=[`${jf}:${r.port}`]),r.servers&&r.servers.length===0&&(r.servers=[n]);const s=$o(d1(),r);if(s.authenticator=m1(s),["reconnectDelayHandler","authenticator"].forEach(a=>{if(s[a]&&typeof s[a]!="function")throw new ue(`${a} option should be a function`,ie.NotFunction)}),s.reconnectDelayHandler||(s.reconnectDelayHandler=()=>{let a=s.tls?s.reconnectJitterTLS:s.reconnectJitter;return a&&(a++,a=Math.floor(Math.random()*a)),s.reconnectTimeWait+a}),s.inboxPrefix)try{us(s.inboxPrefix)}catch(a){throw new ue(a.message,ie.ApiError)}if(s.resolve===void 0&&(s.resolve=typeof zf()=="function"),s.resolve&&typeof zf()!="function")throw new ue("'resolve' is not supported on this client",ie.InvalidOption);return s}function g1(r,n){const{proto:s,tls_required:a,tls_available:o}=r;if((s===void 0||s<1)&&n.noEcho)throw new ue("noEcho",ie.ServerOptionNotAvailable);const f=a||o||!1;if(n.tls&&!f)throw new ue("tls",ie.ServerOptionNotAvailable)}const y1=1024*32,b1=/^INFO\s+([^\r\n]+)\r\n/i,x1=Ma(`PONG\r
|
|
38
|
-
`),
|
|
39
|
-
`);class v1{constructor(n,s,a){v(this,"echo");v(this,"no_responders");v(this,"protocol");v(this,"verbose");v(this,"pedantic");v(this,"jwt");v(this,"nkey");v(this,"sig");v(this,"user");v(this,"pass");v(this,"auth_token");v(this,"tls_required");v(this,"name");v(this,"lang");v(this,"version");v(this,"headers");this.protocol=1,this.version=n.version,this.lang=n.lang,this.echo=s.noEcho?!1:void 0,this.verbose=s.verbose,this.pedantic=s.pedantic,this.tls_required=s.tls?!0:void 0,this.name=s.name;const o=(s&&typeof s.authenticator=="function"?s.authenticator(a):{})||{};$o(this,o)}}class jg extends _t{constructor(s,a,o={}){var h;super();v(this,"sid");v(this,"queue");v(this,"draining");v(this,"max");v(this,"subject");v(this,"drained");v(this,"protocol");v(this,"timer");v(this,"info");v(this,"cleanupFn");v(this,"closed");v(this,"requestSubject");$o(this,o),this.protocol=s,this.subject=a,this.draining=!1,this.noIterator=typeof o.callback=="function",this.closed=st();const f=!((h=s.options)!=null&&h.noAsyncTraces);o.timeout&&(this.timer=Sr(o.timeout,f),this.timer.then(()=>{this.timer=void 0}).catch(d=>{this.stop(d),this.noIterator&&this.callback(d,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(s){if(this.noIterator){const a=this.callback,o=s.ingestionFilterFn?s.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),f=s.protocolFilterFn?s.protocolFilterFn:()=>!0,h=s.dispatchedFn?s.dispatchedFn:()=>{};this.callback=(d,g)=>{const{ingest:y}=o(g);y&&f(g)&&(a(d,g),h(g))}}else this.protocolFilterFn=s.protocolFilterFn,this.dispatchedFn=s.dispatchedFn}callback(s,a){this.cancelTimeout(),s?this.stop(s):this.push(a)}close(){if(!this.isClosed()){this.cancelTimeout();const s=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?s():this.push(s)}}unsubscribe(s){this.protocol.unsubscribe(this,s)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(ue.errorForCode(ie.ConnectionClosed)):this.isClosed()?Promise.reject(ue.errorForCode(ie.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(st()).then(()=>{this.protocol.subscriptions.cancel(this)}).catch(()=>{this.protocol.subscriptions.cancel(this)})),this.drained)}isDraining(){return this.draining}isClosed(){return this.done}getSubject(){return this.subject}getMax(){return this.max}getID(){return this.sid}}class _1{constructor(){v(this,"mux");v(this,"subs");v(this,"sidCounter");this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(n){return this.sidCounter++,n.sid=this.sidCounter,this.subs.set(n.sid,n),n}setMux(n){return this.mux=n,n}getMux(){return this.mux}get(n){return this.subs.get(n)}resub(n){return this.sidCounter++,this.subs.delete(n.sid),n.sid=this.sidCounter,this.subs.set(n.sid,n),n}all(){return Array.from(this.subs.values())}cancel(n){n&&(n.close(),this.subs.delete(n.sid))}handleError(n){if(n&&n.permissionContext){const s=n.permissionContext,a=this.all();let o;if(s.operation==="subscription"&&(o=a.find(f=>f.subject===s.subject&&f.queue===s.queue)),s.operation==="publish"&&(o=a.find(f=>f.requestSubject===s.subject)),o)return o.callback(n,{}),o.close(),this.subs.delete(o.sid),o!==this.mux}return!1}close(){this.subs.forEach(n=>{n.close()})}}class qo{constructor(n,s){v(this,"connected");v(this,"connectedOnce");v(this,"infoReceived");v(this,"info");v(this,"muxSubscriptions");v(this,"options");v(this,"outbound");v(this,"pongs");v(this,"subscriptions");v(this,"transport");v(this,"noMorePublishing");v(this,"connectError");v(this,"publisher");v(this,"_closed");v(this,"closed");v(this,"listeners");v(this,"heartbeats");v(this,"parser");v(this,"outMsgs");v(this,"inMsgs");v(this,"outBytes");v(this,"inBytes");v(this,"pendingLimit");v(this,"lastError");v(this,"abortReconnect");v(this,"whyClosed");v(this,"servers");v(this,"server");v(this,"features");v(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=y1,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=n,this.publisher=s,this.subscriptions=new _1,this.muxSubscriptions=new s1,this.outbound=new Ar,this.pongs=[],this.whyClosed="",this.pendingLimit=n.pendingLimit||this.pendingLimit,this.features=new Uv({major:0,minor:0,micro:0}),this.connectPromise=null;const a=typeof n.servers=="string"?[n.servers]:n.servers;this.servers=new n1(a,{randomize:!n.noRandomize}),this.closed=st(),this.parser=new w0(this),this.heartbeats=new i1(this,this.options.pingInterval||Ag,this.options.maxPingOut||h1)}resetOutbound(){this.outbound.reset();const n=this.pongs;this.pongs=[];const s=ue.errorForCode(ie.Disconnect);s.stack="",n.forEach(a=>{a.reject(s)}),this.parser=new w0(this),this.infoReceived=!1}dispatchStatus(n){this.listeners.forEach(s=>{s.push(n)})}status(){const n=new _t;return this.listeners.push(n),n}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const n=st();return n.catch(()=>{}),this.pongs.unshift(n),this.connectError=s=>{n.reject(s)},this.transport=Hv(),this.transport.closed().then(async s=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),n}disconnect(){this.dispatchStatus({type:br.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:br.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(n){this.dispatchStatus({type:cs.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var s;this.dispatchStatus({type:cs.Reconnect,data:this.servers.getCurrentServer().toString()}),((s=this.lastError)==null?void 0:s.code)===ie.AuthenticationExpired&&(this.lastError=void 0)}).catch(s=>{this._close(s)}):await this._close(n)}async dial(n){const s=this.prepare();let a;try{a=Sr(this.options.timeout||2e4);const o=this.transport.connect(n,this.options);await Promise.race([o,a]),(async()=>{try{for await(const f of this.transport)this.parser.parse(f)}catch(f){console.log("reader closed",f)}})().then()}catch(o){s.reject(o)}try{await Promise.race([a,s]),a&&a.cancel(),this.connected=!0,this.connectError=void 0,this.sendSubscriptions(),this.connectedOnce=!0,this.server.didConnect=!0,this.server.reconnects=0,this.flushPending(),this.heartbeats.start()}catch(o){throw a&&a.cancel(),await this.transport.close(o),o}}async _doDial(n){const{resolve:s}=this.options,a=await n.resolve({fn:zf(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:s});let o=null;for(const f of a)try{o=null,this.dispatchStatus({type:br.Reconnecting,data:f.toString()}),await this.dial(f);return}catch(h){o=h}throw o}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let n;for(;;){this._closed&&this.servers.clear();const s=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():Og;let a=s;const o=this.selectServer();if(!o||this.abortReconnect)throw n||(this.lastError?this.lastError:ue.errorForCode(ie.ConnectionRefused));const f=Date.now();if(o.lastConnect===0||o.lastConnect+s<=f){o.lastConnect=Date.now();try{await this._doDial(o);break}catch(h){if(n=h,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}o.reconnects++;const d=this.options.maxReconnectAttempts||0;d!==-1&&o.reconnects>=d&&this.servers.removeCurrentServer()}}else a=Math.min(a,o.lastConnect+s-f),await Or(a)}}static async connect(n,s){const a=new qo(n,s);return await a.dialLoop(),a}static toError(n){const s=n?n.toLowerCase():"";if(s.indexOf("permissions violation")!==-1){const a=new ue(n,ie.PermissionsViolation),o=n.match(/(Publish|Subscription) to "(\S+)"/);if(o){a.permissionContext={operation:o[1].toLowerCase(),subject:o[2],queue:void 0};const f=n.match(/using queue "(\S+)"/);f&&(a.permissionContext.queue=f[1])}return a}else return s.indexOf("authorization violation")!==-1?new ue(n,ie.AuthorizationViolation):s.indexOf("user authentication expired")!==-1?new ue(n,ie.AuthenticationExpired):s.indexOf("account authentication expired")!=-1?new ue(n,ie.AccountExpired):s.indexOf("authentication timeout")!==-1?new ue(n,ie.AuthenticationTimeout):new ue(n,ie.ProtocolError)}processMsg(n,s){if(this.inMsgs++,this.inBytes+=s.length,!this.subscriptions.sidCounter)return;const a=this.subscriptions.get(n.sid);a&&(a.received+=1,a.callback&&a.callback(null,new eh(n,s,this)),a.max!==void 0&&a.received>=a.max&&a.unsubscribe())}processError(n){const s=l0(n),a=qo.toError(s),o={type:cs.Error,data:a.code};if(a.isPermissionError()){let f=!1;if(a.permissionContext){o.permissionContext=a.permissionContext;const h=this.subscriptions.getMux();f=(h==null?void 0:h.subject)===a.permissionContext.subject}this.subscriptions.handleError(a),this.muxSubscriptions.handleError(f,a),f&&this.subscriptions.setMux(null)}this.dispatchStatus(o),this.handleError(a)}handleError(n){n.isAuthError()?this.handleAuthError(n):n.isProtocolError()?this.lastError=n:n.isAuthTimeout()&&(this.lastError=n),n.isPermissionError()||(this.lastError=n)}handleAuthError(n){this.lastError&&n.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(n):this.disconnect()}processPing(){this.transport.send(x1)}processPong(){const n=this.pongs.shift();n&&n.resolve()}processInfo(n){const s=JSON.parse(l0(n));this.info=s;const a=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(s,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(Ai(s.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:f,lang:h}=this.transport;try{const d=new v1({version:f,lang:h},this.options,s.nonce);s.headers&&(d.headers=!0,d.no_responders=!0);const g=JSON.stringify(d);this.transport.send(Ma(`CONNECT ${g}${So}`)),this.transport.send(A0)}catch(d){this._close(d)}}a&&this.dispatchStatus({type:cs.Update,data:a}),(s.ldm!==void 0?s.ldm:!1)&&this.dispatchStatus({type:cs.LDM,data:this.servers.getCurrentServer().toString()})}push(n){switch(n.kind){case Rt.MSG:{const{msg:s,data:a}=n;this.processMsg(s,a);break}case Rt.OK:break;case Rt.ERR:this.processError(n.data);break;case Rt.PING:this.processPing();break;case Rt.PONG:this.processPong();break;case Rt.INFO:this.processInfo(n.data);break}}sendCommand(n,...s){const a=this.outbound.length();let o;typeof n=="string"?o=Ma(n):o=n,this.outbound.fill(o,...s),a===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(n,s=tn,a){let o;if(s instanceof Uint8Array)o=s;else if(typeof s=="string")o=ji.encode(s);else throw ue.errorForCode(ie.BadPayload);let f=o.length;a=a||{},a.reply=a.reply||"";let h=tn,d=0;if(a.headers){if(this.info&&!this.info.headers)throw new ue("headers",ie.ServerOptionNotAvailable);h=a.headers.encode(),d=h.length,f=o.length+d}if(this.info&&f>this.info.max_payload)throw ue.errorForCode(ie.MaxPayloadExceeded);this.outBytes+=f,this.outMsgs++;let g;a.headers?(a.reply?g=`HPUB ${n} ${a.reply} ${d} ${f}\r
|
|
36
|
+
${this.ctx.stack}`),this.deferred.reject(s)):this.deferred.resolve(a),this.cancel()}cancel(s){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(s||ue.errorForCode(ie.Cancelled))}}const Hv="$JS.API";function Pv(r){return r=r||{},r.domain&&(r.apiPrefix=`$JS.${r.domain}.API`,delete r.domain),$o({apiPrefix:Hv,timeout:5e3},r)}class Pa{constructor(n,s){v(this,"nc");v(this,"opts");v(this,"prefix");v(this,"timeout");v(this,"jc");this.nc=n,this.opts=Pv(s),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=Tn()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let n=this.opts.apiPrefix;if(!n||n.length===0)throw new Error("invalid empty prefix");n[n.length-1]==="."&&(n=n.substr(0,n.length-1)),this.opts.apiPrefix=n}async _request(n,s=null,a){a=a||{},a.timeout=this.timeout;let o=tn;s&&(o=this.jc.encode(s));let{retries:f}=a;f=f||1,f=f===-1?Number.MAX_SAFE_INTEGER:f;const h=If();for(let d=0;d<f;d++)try{const g=await this.nc.request(n,o,a);return this.parseJsResponse(g)}catch(g){const y=g;if((y.code==="503"||y.code===ie.Timeout)&&d+1<f)await Or(h.backoff(d));else throw g}}async findStream(n){const s={subject:n},o=await this._request(`${this.prefix}.STREAM.NAMES`,s);if(!o.streams||o.streams.length!==1)throw new Error("no stream matches subject");return o.streams[0]}getConnection(){return this.nc}parseJsResponse(n){const s=this.jc.decode(n.data),a=s;if(a.error){const o=gg(a.error.code,a.error.description);if(o!==null)throw o.api_error=a.error,o}return s}}class Na{constructor(n,s,a,o){v(this,"err");v(this,"offset");v(this,"pageInfo");v(this,"subject");v(this,"jsm");v(this,"filter");v(this,"payload");if(!n)throw new Error("subject is required");this.subject=n,this.jsm=a,this.offset=0,this.pageInfo={},this.filter=s,this.payload=o||{}}async next(){if(this.err)return[];if(this.pageInfo&&this.offset>=this.pageInfo.total)return[];const n={offset:this.offset};this.payload&&Object.assign(n,this.payload);try{const s=await this.jsm._request(this.subject,n,{timeout:this.jsm.timeout});this.pageInfo=s;const a=this.countResponse(s);return a===0?[]:(this.offset+=a,this.filter(s))}catch(s){throw this.err=s,s}}countResponse(n){var s,a,o;switch(n==null?void 0:n.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return((s=n.streams)==null?void 0:s.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((a=n.consumers)==null?void 0:a.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${n==null?void 0:n.type}`),((o=n.streams)==null?void 0:o.length)||0}return 0}async*[Symbol.asyncIterator](){let n=await this.next();for(;n.length>0;){for(const s of n)yield s;n=await this.next()}}}function Ai(r=""){const n=r.match(/(\d+).(\d+).(\d+)/);if(n)return{major:parseInt(n[1]),minor:parseInt(n[2]),micro:parseInt(n[3])};throw new Error(`'${r}' is not a semver value`)}function kf(r,n){return r.major<n.major?-1:r.major>n.major?1:r.minor<n.minor?-1:r.minor>n.minor?1:r.micro<n.micro?-1:r.micro>n.micro?1:0}var ze;(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"})(ze||(ze={}));class $v{constructor(n){v(this,"server");v(this,"features");v(this,"disabled");this.features=new Map,this.disabled=[],this.update(n)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(n){this.disabled.push(n),this.update(this.server)}isDisabled(n){return this.disabled.indexOf(n)!==-1}update(n){typeof n=="string"&&(n=Ai(n)),this.server=n,this.set(ze.JS_KV,"2.6.2"),this.set(ze.JS_OBJECTSTORE,"2.6.3"),this.set(ze.JS_PULL_MAX_BYTES,"2.8.3"),this.set(ze.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(ze.JS_ALLOW_DIRECT,"2.9.0"),this.set(ze.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(ze.JS_SIMPLIFICATION,"2.9.4"),this.set(ze.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(ze.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(ze.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(ze.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(ze.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(ze.JS_STREAM_COMPRESSION,"2.10.0"),this.set(ze.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(ze.JS_BATCH_DIRECT_GET,"2.11.0"),this.disabled.forEach(s=>{this.features.delete(s)})}set(n,s){this.features.set(n,{min:s,ok:kf(this.server,Ai(s))>=0})}get(n){return this.features.get(n)||{min:"unknown",ok:!1}}supports(n){var s;return((s=this.get(n))==null?void 0:s.ok)||!1}require(n){return typeof n=="string"&&(n=Ai(n)),kf(this.server,n)>=0}}class Do extends Pa{constructor(n,s){super(n,s)}async add(n,s,a=Ro.Create){if(Mt(n),s.deliver_group&&s.flow_control)throw new Error("jetstream flow control is not supported with queue groups");if(s.deliver_group&&s.idle_heartbeat)throw new Error("jetstream idle heartbeat is not supported with queue groups");const o={};o.config=s,o.stream_name=n,o.action=a,o.config.durable_name&&xr(o.config.durable_name);const f=this.nc;let{min:h,ok:d}=f.features.get(ze.JS_NEW_CONSUMER_CREATE_API);const g=s.name===""?void 0:s.name;if(g&&!d)throw new Error(`consumer 'name' requires server ${h}`);if(g)try{Yo("name",g)}catch(j){const z=j.message,M=z.indexOf("cannot contain");throw M!==-1?new Error(`consumer 'name' ${z.substring(M)}`):j}let y,E="";if(Array.isArray(s.filter_subjects)){const{min:j,ok:z}=f.features.get(ze.JS_MULTIPLE_CONSUMER_FILTER);if(!z)throw new Error(`consumer 'filter_subjects' requires server ${j}`);d=!1}if(s.metadata){const{min:j,ok:z}=f.features.get(ze.JS_STREAM_CONSUMER_METADATA);if(!z)throw new Error(`consumer 'metadata' requires server ${j}`)}if(d&&(E=s.name??s.durable_name??""),E!==""){let j=s.filter_subject??void 0;j===">"&&(j=void 0),y=j!==void 0?`${this.prefix}.CONSUMER.CREATE.${n}.${E}.${j}`:`${this.prefix}.CONSUMER.CREATE.${n}.${E}`}else y=s.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${n}.${s.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${n}`;return await this._request(y,o)}async update(n,s,a){const o=await this.info(n,s),f=a;return this.add(n,Object.assign(o.config,f),Ro.Update)}async info(n,s){return Mt(n),xr(s),await this._request(`${this.prefix}.CONSUMER.INFO.${n}.${s}`)}async delete(n,s){return Mt(n),xr(s),(await this._request(`${this.prefix}.CONSUMER.DELETE.${n}.${s}`)).success}list(n){Mt(n);const s=o=>o.consumers,a=`${this.prefix}.CONSUMER.LIST.${n}`;return new Na(a,s,this)}pause(n,s,a){const o=`${this.prefix}.CONSUMER.PAUSE.${n}.${s}`,f={pause_until:a.toISOString()};return this._request(o,f)}resume(n,s){return this.pause(n,s,new Date(0))}}function mr(r,n,s=!1){if(s===!0&&!r)throw ue.errorForCode(ie.ApiError,new Error(`${n} is not a function`));if(r&&typeof r!="function")throw ue.errorForCode(ie.ApiError,new Error(`${n} is not a function`))}class Yv extends _t{constructor(s,a,o){super();v(this,"sub");v(this,"adapter");v(this,"subIterDone");mr(o.adapter,"adapter",!0),this.adapter=o.adapter,o.callback&&mr(o.callback,"callback"),this.noIterator=typeof o.callback=="function",o.ingestionFilterFn&&(mr(o.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=o.ingestionFilterFn),o.protocolFilterFn&&(mr(o.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=o.protocolFilterFn),o.dispatchedFn&&(mr(o.dispatchedFn,"dispatchedFn"),this.dispatchedFn=o.dispatchedFn),o.cleanupFn&&mr(o.cleanupFn,"cleanupFn");let f=(E,w)=>{this.callback(E,w)};if(o.callback){const E=o.callback;f=(w,j)=>{const[z,M]=this.adapter(w,j);if(z){E(z,null);return}const{ingest:B}=this.ingestionFilterFn?this.ingestionFilterFn(M,this):{ingest:!0};B&&(!this.protocolFilterFn||this.protocolFilterFn(M))&&(E(z,M),this.dispatchedFn&&M&&this.dispatchedFn(M))}}const{max:h,queue:d,timeout:g}=o,y={queue:d,timeout:g,callback:f};h&&h>0&&(y.max=h),this.sub=s.subscribe(a,y),o.cleanupFn&&(this.sub.cleanupFn=o.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=st(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async E=>{await E.closed,this.stop()})(this.sub).then().catch()}unsubscribe(s){this.sub.unsubscribe(s)}drain(){return this.sub.drain()}isDraining(){return this.sub.isDraining()}isClosed(){return this.sub.isClosed()}callback(s,a){this.sub.cancelTimeout();const[o,f]=this.adapter(s,a);o&&this.stop(o),f&&this.push(f)}getSubject(){return this.sub.getSubject()}getReceived(){return this.sub.getReceived()}getProcessed(){return this.sub.getProcessed()}getPending(){return this.sub.getPending()}getID(){return this.sub.getID()}getMax(){return this.sub.getMax()}get closed(){return this.sub.closed}}let en;function Gv(r){en=r}function xg(){return en!==void 0&&en.defaultPort!==void 0?en.defaultPort:4222}function ff(){return en!==void 0&&en.urlParseFn?en.urlParseFn:void 0}function Vv(){if(!en||typeof en.factory!="function")throw new Error("transport fn is not set");return en.factory()}function Mf(){return en!==void 0&&en.dnsResolveFn?en.dnsResolveFn:void 0}const So=`\r
|
|
37
|
+
`,zo=Ar.fromAscii(So),Fv=new Uint8Array(zo)[0],Jv=new Uint8Array(zo)[1];function Qv(r){for(let n=0;n<r.length;n++){const s=n+1;if(r.byteLength>s&&r[n]===Fv&&r[s]===Jv)return s+1}return 0}function Iv(r){const n=Qv(r);if(n>0){const a=new Uint8Array(r).slice(0,n);return Wt.decode(a)}return""}const Xv=4,vg=48,Kv=65,Zv=97;function Wv(r,n,s,a){const o=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((h,d)=>{o[d]=h}),o[12]=r,o[13]=n,o[14]=s,o[15]=a,o}function Rf(r){return e1(r)!==void 0}function e1(r){for(let n=0;n<r.length;n++)switch(r[n]){case".":return _g(r);case":":return t1(r)}}function _g(r){const n=new Uint8Array(4);for(let s=0;s<4;s++){if(r.length===0)return;if(s>0){if(r[0]!==".")return;r=r.substring(1)}const{n:a,c:o,ok:f}=n1(r);if(!f||a>255)return;r=r.substring(o),n[s]=a}return Wv(n[0],n[1],n[2],n[3])}function t1(r){const n=new Uint8Array(16);let s=-1;if(r.length>=2&&r[0]===":"&&r[1]===":"&&(s=0,r=r.substring(2),r.length===0))return n;let a=0;for(;a<16;){const{n:o,c:f,ok:h}=s1(r);if(!h||o>65535)return;if(f<r.length&&r[f]==="."){if(s<0&&a!=12||a+4>16)return;const d=_g(r);if(d===void 0)return;n[a]=d[12],n[a+1]=d[13],n[a+2]=d[14],n[a+3]=d[15],r="",a+=Xv;break}if(n[a]=o>>8,n[a+1]=o,a+=2,r=r.substring(f),r.length===0)break;if(r[0]!==":"||r.length==1)return;if(r=r.substring(1),r[0]===":"){if(s>=0)return;if(s=a,r=r.substring(1),r.length===0)break}}if(r.length===0){if(a<16){if(s<0)return;const o=16-a;for(let f=a-1;f>=s;f--)n[f+o]=n[f];for(let f=s+o-1;f>=s;f--)n[f]=0}else if(s>=0)return;return n}}function n1(r){let n=0,s=0;for(n=0;n<r.length&&48<=r.charCodeAt(n)&&r.charCodeAt(n)<=57;n++)if(s=s*10+(r.charCodeAt(n)-vg),s>=16777215)return{n:16777215,c:n,ok:!1};return n===0?{n:0,c:0,ok:!1}:{n:s,c:n,ok:!0}}function s1(r){let n=0,s=0;for(s=0;s<r.length;s++){if(48<=r.charCodeAt(s)&&r.charCodeAt(s)<=57)n*=16,n+=r.charCodeAt(s)-vg;else if(97<=r.charCodeAt(s)&&r.charCodeAt(s)<=102)n*=16,n+=r.charCodeAt(s)-Zv+10;else if(65<=r.charCodeAt(s)&&r.charCodeAt(s)<=70)n*=16,n+=r.charCodeAt(s)-Kv+10;else break;if(n>=16777215)return{n:0,c:s,ok:!1}}return s===0?{n:0,c:s,ok:!1}:{n,c:s,ok:!0}}function i1(r){return r.indexOf("[")!==-1||r.indexOf("::")!==-1?!1:r.indexOf(".")!==-1||r.split(":").length<=2}function Df(r){return!i1(r)}function r1(r){const n="::FFFF:",s=r.toUpperCase().indexOf(n);if(s!==-1&&r.indexOf(".")!==-1){let a=r.substring(s+n.length);return a=a.replace("[",""),a.replace("]","")}return r}function a1(r){r=r.trim(),r.match(/^(.*:\/\/)(.*)/m)&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2")),r=r1(r),Df(r)&&r.indexOf("[")===-1&&(r=`[${r}]`);const n=Df(r)?r.match(/(]:)(\d+)/):r.match(/(:)(\d+)/),s=n&&n.length===3&&n[1]&&n[2]?parseInt(n[2]):4222,a=s===80?"https":"http",o=new URL(`${a}://${r}`);o.port=`${s}`;let f=o.hostname;return f.charAt(0)==="["&&(f=f.substring(1,f.length-1)),{listen:o.host,hostname:f,port:s}}class Ra{constructor(n,s=!1){v(this,"src");v(this,"listen");v(this,"hostname");v(this,"port");v(this,"didConnect");v(this,"reconnects");v(this,"lastConnect");v(this,"gossiped");v(this,"tlsName");v(this,"resolves");this.src=n,this.tlsName="";const a=a1(n);this.listen=a.listen,this.hostname=a.hostname,this.port=a.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=s}toString(){return this.listen}async resolve(n){if(!n.fn||n.resolve===!1)return[this];const s=[];if(Rf(this.hostname))return[this];{const a=await n.fn(this.hostname);n.debug&&console.log(`resolve ${this.hostname} = ${a.join(",")}`);for(const o of a){const f=this.port===80?"https":"http",h=new URL(`${f}://${Df(o)?"["+o+"]":o}`);h.port=`${this.port}`;const d=new Ra(h.host,!1);d.tlsName=this.hostname,s.push(d)}}return n.randomize&&mg(s),this.resolves=s,s}}class l1{constructor(n=[],s={}){v(this,"firstSelect");v(this,"servers");v(this,"currentServer");v(this,"tlsName");v(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=s.randomize||!1;const a=ff();n&&(n.forEach(o=>{o=a?a(o):o,this.servers.push(new Ra(o))}),this.randomize&&(this.servers=mg(this.servers))),this.servers.length===0&&this.addServer(`${Ef}:${xg()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const n=this.getCurrentServer();Rf(n.hostname)||(this.tlsName=n.hostname,this.servers.forEach(s=>{s.gossiped&&(s.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(n,s=!1){const a=ff();n=a?a(n):n;const o=new Ra(n,s);Rf(o.hostname)&&(o.tlsName=this.tlsName),this.servers.push(o)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const n=this.servers.shift();return n&&(this.servers.push(n),this.currentServer=n),n}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(n){if(n){const s=this.servers.indexOf(n);this.servers.splice(s,1)}}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update(n,s){const a=[];let o=[];const f=ff(),h=new Map;n.connect_urls&&n.connect_urls.length>0&&n.connect_urls.forEach(g=>{g=f?f(g,s):g;const y=new Ra(g,!0);h.set(g,y)});const d=[];return this.servers.forEach((g,y)=>{const E=g.listen;g.gossiped&&this.currentServer.listen!==E&&h.get(E)===void 0&&d.push(y),h.delete(E)}),d.reverse(),d.forEach(g=>{const y=this.servers.splice(g,1);o=o.concat(y[0].listen)}),h.forEach((g,y)=>{this.servers.push(g),a.push(y)}),{added:a,deleted:o}}}class o1{constructor(){v(this,"baseInbox");v(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(n){return this.baseInbox=`${us(n)}.`,this.baseInbox}add(n){isNaN(n.received)||(n.received=0),this.reqs.set(n.token,n)}get(n){return this.reqs.get(n)}cancel(n){this.reqs.delete(n.token)}getToken(n){const s=n.subject||"";return s.indexOf(this.baseInbox)===0?s.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(n,s){if(s&&s.permissionContext){if(n)return this.all().forEach(o=>{o.resolver(s,{})}),!0;const a=s.permissionContext;if(a.operation==="publish"){const o=this.all().find(f=>f.requestSubject===a.subject);if(o)return o.resolver(s,{}),!0}}return!1}dispatcher(){return(n,s)=>{const a=this.getToken(s);if(a){const o=this.get(a);o&&(n===null&&s.headers&&(n=pg(s)),o.resolver(n,s))}}}close(){const n=ue.errorForCode(ie.Timeout);this.reqs.forEach(s=>{s.resolver(n,{})})}}class c1{constructor(n,s,a){v(this,"ph");v(this,"interval");v(this,"maxOut");v(this,"timer");v(this,"pendings");this.ph=n,this.interval=s,this.maxOut=a,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(n){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),n&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:br.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const n=st();this.ph.flush(n).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(n),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(n=>(n.resolve(),!1))}}class u1 extends Error{constructor(n){super(n),this.name="AssertionError"}}function f1(r,n="Assertion failed."){if(!r)throw new u1(n)}const y0=32*1024,hf=2**32-2;function po(r,n,s=0){const a=n.byteLength-s;return r.byteLength>a&&(r=r.subarray(0,a)),n.set(r,s),r.byteLength}class df{constructor(n){v(this,"_buf");v(this,"_off");if(this._off=0,n==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(n)}bytes(n={copy:!0}){return n.copy===!1?this._buf.subarray(this._off):this._buf.slice(this._off)}empty(){return this._buf.byteLength<=this._off}get length(){return this._buf.byteLength-this._off}get capacity(){return this._buf.buffer.byteLength}truncate(n){if(n===0){this.reset();return}if(n<0||n>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+n)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(n){const s=this._buf.byteLength;return n<=this.capacity-s?(this._reslice(s+n),s):-1}_reslice(n){f1(n<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,n)}readByte(){const n=new Uint8Array(1);return this.read(n)?n[0]:null}read(n){if(this.empty())return this.reset(),n.byteLength===0?0:null;const s=po(this._buf.subarray(this._off),n);return this._off+=s,s}writeByte(n){return this.write(Uint8Array.of(n))}writeString(n){return this.write(ji.encode(n))}write(n){const s=this._grow(n.byteLength);return po(n,this._buf,s)}_grow(n){const s=this.length;s===0&&this._off!==0&&this.reset();const a=this._tryGrowByReslice(n);if(a>=0)return a;const o=this.capacity;if(n<=Math.floor(o/2)-s)po(this._buf.subarray(this._off),this._buf);else{if(o+n>hf)throw new Error("The buffer cannot be grown beyond the maximum size.");{const f=new Uint8Array(Math.min(2*o+n,hf));po(this._buf.subarray(this._off),f),this._buf=f}}return this._off=0,this._reslice(Math.min(s+n,hf)),s}grow(n){if(n<0)throw Error("Buffer._grow: negative count");const s=this._grow(n);this._reslice(s)}readFrom(n){let s=0;const a=new Uint8Array(y0);for(;;){const o=this.capacity-this.length<y0,f=o?a:new Uint8Array(this._buf.buffer,this.length),h=n.read(f);if(h===null)return s;o?this.write(f.subarray(0,h)):this._reslice(this.length+h),s+=h}}}var Rt;(function(r){r[r.OK=0]="OK",r[r.ERR=1]="ERR",r[r.MSG=2]="MSG",r[r.INFO=3]="INFO",r[r.PING=4]="PING",r[r.PONG=5]="PONG"})(Rt||(Rt={}));function b0(){const r={};return r.sid=-1,r.hdr=-1,r.size=-1,r}const h1=48;class x0{constructor(n){v(this,"dispatcher");v(this,"state");v(this,"as");v(this,"drop");v(this,"hdr");v(this,"ma");v(this,"argBuf");v(this,"msgBuf");this.dispatcher=n,this.state=oe.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(n){let s;for(s=0;s<n.length;s++){const a=n[s];switch(this.state){case oe.OP_START:switch(a){case ce.M:case ce.m:this.state=oe.OP_M,this.hdr=-1,this.ma=b0();break;case ce.H:case ce.h:this.state=oe.OP_H,this.hdr=0,this.ma=b0();break;case ce.P:case ce.p:this.state=oe.OP_P;break;case ce.PLUS:this.state=oe.OP_PLUS;break;case ce.MINUS:this.state=oe.OP_MINUS;break;case ce.I:case ce.i:this.state=oe.OP_I;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_H:switch(a){case ce.M:case ce.m:this.state=oe.OP_M;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_M:switch(a){case ce.S:case ce.s:this.state=oe.OP_MS;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_MS:switch(a){case ce.G:case ce.g:this.state=oe.OP_MSG;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_MSG:switch(a){case ce.SPACE:case ce.TAB:this.state=oe.OP_MSG_SPC;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_MSG_SPC:switch(a){case ce.SPACE:case ce.TAB:continue;default:this.state=oe.MSG_ARG,this.as=s}break;case oe.MSG_ARG:switch(a){case ce.CR:this.drop=1;break;case ce.NL:{const o=this.argBuf?this.argBuf.bytes():n.subarray(this.as,s-this.drop);this.processMsgArgs(o),this.drop=0,this.as=s+1,this.state=oe.MSG_PAYLOAD,s=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;case oe.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const o=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:Rt.MSG,msg:this.ma,data:o}),this.argBuf=void 0,this.msgBuf=void 0,this.state=oe.MSG_END}else{let o=this.ma.size-this.msgBuf.length;const f=n.length-s;f<o&&(o=f),o>0?(this.msgBuf.write(n.subarray(s,s+o)),s=s+o-1):this.msgBuf.writeByte(a)}else s-this.as>=this.ma.size&&(this.dispatcher.push({kind:Rt.MSG,msg:this.ma,data:n.subarray(this.as,s)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=oe.MSG_END);break;case oe.MSG_END:switch(a){case ce.NL:this.drop=0,this.as=s+1,this.state=oe.OP_START;break;default:continue}break;case oe.OP_PLUS:switch(a){case ce.O:case ce.o:this.state=oe.OP_PLUS_O;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_PLUS_O:switch(a){case ce.K:case ce.k:this.state=oe.OP_PLUS_OK;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_PLUS_OK:switch(a){case ce.NL:this.dispatcher.push({kind:Rt.OK}),this.drop=0,this.state=oe.OP_START;break}break;case oe.OP_MINUS:switch(a){case ce.E:case ce.e:this.state=oe.OP_MINUS_E;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_MINUS_E:switch(a){case ce.R:case ce.r:this.state=oe.OP_MINUS_ER;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_MINUS_ER:switch(a){case ce.R:case ce.r:this.state=oe.OP_MINUS_ERR;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_MINUS_ERR:switch(a){case ce.SPACE:case ce.TAB:this.state=oe.OP_MINUS_ERR_SPC;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_MINUS_ERR_SPC:switch(a){case ce.SPACE:case ce.TAB:continue;default:this.state=oe.MINUS_ERR_ARG,this.as=s}break;case oe.MINUS_ERR_ARG:switch(a){case ce.CR:this.drop=1;break;case ce.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=n.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Rt.ERR,data:o}),this.drop=0,this.as=s+1,this.state=oe.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(a))}break;case oe.OP_P:switch(a){case ce.I:case ce.i:this.state=oe.OP_PI;break;case ce.O:case ce.o:this.state=oe.OP_PO;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_PO:switch(a){case ce.N:case ce.n:this.state=oe.OP_PON;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_PON:switch(a){case ce.G:case ce.g:this.state=oe.OP_PONG;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_PONG:switch(a){case ce.NL:this.dispatcher.push({kind:Rt.PONG}),this.drop=0,this.state=oe.OP_START;break}break;case oe.OP_PI:switch(a){case ce.N:case ce.n:this.state=oe.OP_PIN;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_PIN:switch(a){case ce.G:case ce.g:this.state=oe.OP_PING;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_PING:switch(a){case ce.NL:this.dispatcher.push({kind:Rt.PING}),this.drop=0,this.state=oe.OP_START;break}break;case oe.OP_I:switch(a){case ce.N:case ce.n:this.state=oe.OP_IN;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_IN:switch(a){case ce.F:case ce.f:this.state=oe.OP_INF;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_INF:switch(a){case ce.O:case ce.o:this.state=oe.OP_INFO;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_INFO:switch(a){case ce.SPACE:case ce.TAB:this.state=oe.OP_INFO_SPC;break;default:throw this.fail(n.subarray(s))}break;case oe.OP_INFO_SPC:switch(a){case ce.SPACE:case ce.TAB:continue;default:this.state=oe.INFO_ARG,this.as=s}break;case oe.INFO_ARG:switch(a){case ce.CR:this.drop=1;break;case ce.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=n.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Rt.INFO,data:o}),this.drop=0,this.as=s+1,this.state=oe.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;default:throw this.fail(n.subarray(s))}}(this.state===oe.MSG_ARG||this.state===oe.MINUS_ERR_ARG||this.state===oe.INFO_ARG)&&!this.argBuf&&(this.argBuf=new df(n.subarray(this.as,s-this.drop))),this.state===oe.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new df(n.subarray(this.as)))}cloneMsgArg(){const n=this.ma.subject.length,s=this.ma.reply?this.ma.reply.length:0,a=new Uint8Array(n+s);a.set(this.ma.subject),this.ma.reply&&a.set(this.ma.reply,n),this.argBuf=new df(a),this.ma.subject=a.subarray(0,n),this.ma.reply&&(this.ma.reply=a.subarray(n))}processMsgArgs(n){if(this.hdr>=0)return this.processHeaderMsgArgs(n);const s=[];let a=-1;for(let o=0;o<n.length;o++)switch(n[o]){case ce.SPACE:case ce.TAB:case ce.CR:case ce.NL:a>=0&&(s.push(n.subarray(a,o)),a=-1);break;default:a<0&&(a=o)}switch(a>=0&&s.push(n.subarray(a)),s.length){case 3:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(s[2]);break;case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.size=this.protoParseInt(s[3]);break;default:throw this.fail(n,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(n,"processMsgArgs Bad or Missing Size Error")}fail(n,s=""){return s?s=`${s} [${this.state}]`:s=`parse error [${this.state}]`,new Error(`${s}: ${Wt.decode(n)}`)}processHeaderMsgArgs(n){const s=[];let a=-1;for(let o=0;o<n.length;o++)switch(n[o]){case ce.SPACE:case ce.TAB:case ce.CR:case ce.NL:a>=0&&(s.push(n.subarray(a,o)),a=-1);break;default:a<0&&(a=o)}switch(a>=0&&s.push(n.subarray(a)),s.length){case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(s[2]),this.ma.size=this.protoParseInt(s[3]);break;case 5:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.hdr=this.protoParseInt(s[3]),this.ma.size=this.protoParseInt(s[4]);break;default:throw this.fail(n,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(n){if(n.length===0)return-1;let s=0;for(let a=0;a<n.length;a++){if(n[a]<48||n[a]>57)return-1;s=s*10+(n[a]-h1)}return s}}var oe;(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"})(oe||(oe={}));var ce;(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"})(ce||(ce={}));(function(r){var n=function(x,S){this.hi=x|0,this.lo=S|0},s=function(x){var S,_=new Float64Array(16);if(x)for(S=0;S<x.length;S++)_[S]=x[S];return _},a=function(){throw new Error("no PRNG")},o=new Uint8Array(16),f=new Uint8Array(32);f[0]=9;var h=s(),d=s([1]),g=s([56129,1]),y=s([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),E=s([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),w=s([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),j=s([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),z=s([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function M(x,S){return x<<S|x>>>32-S}function B(x,S){var _=x[S+3]&255;return _=_<<8|x[S+2]&255,_=_<<8|x[S+1]&255,_<<8|x[S+0]&255}function V(x,S){var _=x[S]<<24|x[S+1]<<16|x[S+2]<<8|x[S+3],A=x[S+4]<<24|x[S+5]<<16|x[S+6]<<8|x[S+7];return new n(_,A)}function ne(x,S,_){var A;for(A=0;A<4;A++)x[S+A]=_&255,_>>>=8}function ee(x,S,_){x[S]=_.hi>>24&255,x[S+1]=_.hi>>16&255,x[S+2]=_.hi>>8&255,x[S+3]=_.hi&255,x[S+4]=_.lo>>24&255,x[S+5]=_.lo>>16&255,x[S+6]=_.lo>>8&255,x[S+7]=_.lo&255}function pe(x,S,_,A,N){var D,Q=0;for(D=0;D<N;D++)Q|=x[S+D]^_[A+D];return(1&Q-1>>>8)-1}function ae(x,S,_,A){return pe(x,S,_,A,16)}function k(x,S,_,A){return pe(x,S,_,A,32)}function X(x,S,_,A,N){var D=new Uint32Array(16),Q=new Uint32Array(16),K=new Uint32Array(16),H=new Uint32Array(4),J,fe,Oe;for(J=0;J<4;J++)Q[5*J]=B(A,4*J),Q[1+J]=B(_,4*J),Q[6+J]=B(S,4*J),Q[11+J]=B(_,16+4*J);for(J=0;J<16;J++)K[J]=Q[J];for(J=0;J<20;J++){for(fe=0;fe<4;fe++){for(Oe=0;Oe<4;Oe++)H[Oe]=Q[(5*fe+4*Oe)%16];for(H[1]^=M(H[0]+H[3]|0,7),H[2]^=M(H[1]+H[0]|0,9),H[3]^=M(H[2]+H[1]|0,13),H[0]^=M(H[3]+H[2]|0,18),Oe=0;Oe<4;Oe++)D[4*fe+(fe+Oe)%4]=H[Oe]}for(Oe=0;Oe<16;Oe++)Q[Oe]=D[Oe]}if(N){for(J=0;J<16;J++)Q[J]=Q[J]+K[J]|0;for(J=0;J<4;J++)Q[5*J]=Q[5*J]-B(A,4*J)|0,Q[6+J]=Q[6+J]-B(S,4*J)|0;for(J=0;J<4;J++)ne(x,4*J,Q[5*J]),ne(x,16+4*J,Q[6+J])}else for(J=0;J<16;J++)ne(x,4*J,Q[J]+K[J]|0)}function se(x,S,_,A){return X(x,S,_,A,!1),0}function W(x,S,_,A){return X(x,S,_,A,!0),0}var F=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function Z(x,S,_,A,N,D,Q){var K=new Uint8Array(16),H=new Uint8Array(64),J,fe;if(!N)return 0;for(fe=0;fe<16;fe++)K[fe]=0;for(fe=0;fe<8;fe++)K[fe]=D[fe];for(;N>=64;){for(se(H,K,Q,F),fe=0;fe<64;fe++)x[S+fe]=(_?_[A+fe]:0)^H[fe];for(J=1,fe=8;fe<16;fe++)J=J+(K[fe]&255)|0,K[fe]=J&255,J>>>=8;N-=64,S+=64,_&&(A+=64)}if(N>0)for(se(H,K,Q,F),fe=0;fe<N;fe++)x[S+fe]=(_?_[A+fe]:0)^H[fe];return 0}function le(x,S,_,A,N){return Z(x,S,null,0,_,A,N)}function re(x,S,_,A,N){var D=new Uint8Array(32);return W(D,A,N,F),le(x,S,_,A.subarray(16),D)}function qe(x,S,_,A,N,D,Q){var K=new Uint8Array(32);return W(K,D,Q,F),Z(x,S,_,A,N,D.subarray(16),K)}function Ge(x,S){var _,A=0;for(_=0;_<17;_++)A=A+(x[_]+S[_]|0)|0,x[_]=A&255,A>>>=8}var Le=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function $(x,S,_,A,N,D){var Q,K,H,J,fe=new Uint32Array(17),Oe=new Uint32Array(17),Ke=new Uint32Array(17),Ct=new Uint32Array(17),_n=new Uint32Array(17);for(H=0;H<17;H++)Oe[H]=Ke[H]=0;for(H=0;H<16;H++)Oe[H]=D[H];for(Oe[3]&=15,Oe[4]&=252,Oe[7]&=15,Oe[8]&=252,Oe[11]&=15,Oe[12]&=252,Oe[15]&=15;N>0;){for(H=0;H<17;H++)Ct[H]=0;for(H=0;H<16&&H<N;++H)Ct[H]=_[A+H];for(Ct[H]=1,A+=H,N-=H,Ge(Ke,Ct),K=0;K<17;K++)for(fe[K]=0,H=0;H<17;H++)fe[K]=fe[K]+Ke[H]*(H<=K?Oe[K-H]:320*Oe[K+17-H]|0)|0|0;for(K=0;K<17;K++)Ke[K]=fe[K];for(J=0,H=0;H<16;H++)J=J+Ke[H]|0,Ke[H]=J&255,J>>>=8;for(J=J+Ke[16]|0,Ke[16]=J&3,J=5*(J>>>2)|0,H=0;H<16;H++)J=J+Ke[H]|0,Ke[H]=J&255,J>>>=8;J=J+Ke[16]|0,Ke[16]=J}for(H=0;H<17;H++)_n[H]=Ke[H];for(Ge(Ke,Le),Q=-(Ke[16]>>>7)|0,H=0;H<17;H++)Ke[H]^=Q&(_n[H]^Ke[H]);for(H=0;H<16;H++)Ct[H]=D[H+16];for(Ct[16]=0,Ge(Ke,Ct),H=0;H<16;H++)x[S+H]=Ke[H];return 0}function te(x,S,_,A,N,D){var Q=new Uint8Array(16);return $(Q,0,_,A,N,D),ae(x,S,Q,0)}function de(x,S,_,A,N){var D;if(_<32)return-1;for(qe(x,0,S,0,_,A,N),$(x,16,x,32,_-32,x),D=0;D<16;D++)x[D]=0;return 0}function ve(x,S,_,A,N){var D,Q=new Uint8Array(32);if(_<32||(re(Q,0,32,A,N),te(S,16,S,32,_-32,Q)!==0))return-1;for(qe(x,0,S,0,_,A,N),D=0;D<32;D++)x[D]=0;return 0}function be(x,S){var _;for(_=0;_<16;_++)x[_]=S[_]|0}function je(x){var S,_;for(_=0;_<16;_++)x[_]+=65536,S=Math.floor(x[_]/65536),x[(_+1)*(_<15?1:0)]+=S-1+37*(S-1)*(_===15?1:0),x[_]-=S*65536}function _e(x,S,_){for(var A,N=~(_-1),D=0;D<16;D++)A=N&(x[D]^S[D]),x[D]^=A,S[D]^=A}function Te(x,S){var _,A,N,D=s(),Q=s();for(_=0;_<16;_++)Q[_]=S[_];for(je(Q),je(Q),je(Q),A=0;A<2;A++){for(D[0]=Q[0]-65517,_=1;_<15;_++)D[_]=Q[_]-65535-(D[_-1]>>16&1),D[_-1]&=65535;D[15]=Q[15]-32767-(D[14]>>16&1),N=D[15]>>16&1,D[14]&=65535,_e(Q,D,1-N)}for(_=0;_<16;_++)x[2*_]=Q[_]&255,x[2*_+1]=Q[_]>>8}function lt(x,S){var _=new Uint8Array(32),A=new Uint8Array(32);return Te(_,x),Te(A,S),k(_,0,A,0)}function Pt(x){var S=new Uint8Array(32);return Te(S,x),S[0]&1}function sn(x,S){var _;for(_=0;_<16;_++)x[_]=S[2*_]+(S[2*_+1]<<8);x[15]&=32767}function Ot(x,S,_){var A;for(A=0;A<16;A++)x[A]=S[A]+_[A]|0}function jt(x,S,_){var A;for(A=0;A<16;A++)x[A]=S[A]-_[A]|0}function we(x,S,_){var A,N,D=new Float64Array(31);for(A=0;A<31;A++)D[A]=0;for(A=0;A<16;A++)for(N=0;N<16;N++)D[A+N]+=S[A]*_[N];for(A=0;A<15;A++)D[A]+=38*D[A+16];for(A=0;A<16;A++)x[A]=D[A];je(x),je(x)}function Tt(x,S){we(x,S,S)}function ei(x,S){var _=s(),A;for(A=0;A<16;A++)_[A]=S[A];for(A=253;A>=0;A--)Tt(_,_),A!==2&&A!==4&&we(_,_,S);for(A=0;A<16;A++)x[A]=_[A]}function Ti(x,S){var _=s(),A;for(A=0;A<16;A++)_[A]=S[A];for(A=250;A>=0;A--)Tt(_,_),A!==1&&we(_,_,S);for(A=0;A<16;A++)x[A]=_[A]}function ti(x,S,_){var A=new Uint8Array(32),N=new Float64Array(80),D,Q,K=s(),H=s(),J=s(),fe=s(),Oe=s(),Ke=s();for(Q=0;Q<31;Q++)A[Q]=S[Q];for(A[31]=S[31]&127|64,A[0]&=248,sn(N,_),Q=0;Q<16;Q++)H[Q]=N[Q],fe[Q]=K[Q]=J[Q]=0;for(K[0]=fe[0]=1,Q=254;Q>=0;--Q)D=A[Q>>>3]>>>(Q&7)&1,_e(K,H,D),_e(J,fe,D),Ot(Oe,K,J),jt(K,K,J),Ot(J,H,fe),jt(H,H,fe),Tt(fe,Oe),Tt(Ke,K),we(K,J,K),we(J,H,Oe),Ot(Oe,K,J),jt(K,K,J),Tt(H,K),jt(J,fe,Ke),we(K,J,g),Ot(K,K,fe),we(J,J,K),we(K,fe,Ke),we(fe,H,N),Tt(H,Oe),_e(K,H,D),_e(J,fe,D);for(Q=0;Q<16;Q++)N[Q+16]=K[Q],N[Q+32]=J[Q],N[Q+48]=H[Q],N[Q+64]=fe[Q];var Ct=N.subarray(32),_n=N.subarray(16);return ei(Ct,Ct),we(_n,_n,Ct),Te(x,_n),0}function rn(x,S){return ti(x,S,f)}function Ni(x,S){return a(S,32),rn(x,S)}function ds(x,S,_){var A=new Uint8Array(32);return ti(A,_,S),W(x,o,A,F)}var Fa=de,Ja=ve;function Tr(x,S,_,A,N,D){var Q=new Uint8Array(32);return ds(Q,N,D),Fa(x,S,_,A,Q)}function Nr(x,S,_,A,N,D){var Q=new Uint8Array(32);return ds(Q,N,D),Ja(x,S,_,A,Q)}function $n(){var x=0,S=0,_=0,A=0,N=65535,D,Q,K;for(K=0;K<arguments.length;K++)D=arguments[K].lo,Q=arguments[K].hi,x+=D&N,S+=D>>>16,_+=Q&N,A+=Q>>>16;return S+=x>>>16,_+=S>>>16,A+=_>>>16,new n(_&N|A<<16,x&N|S<<16)}function Qa(x,S){return new n(x.hi>>>S,x.lo>>>S|x.hi<<32-S)}function Ci(){var x=0,S=0,_;for(_=0;_<arguments.length;_++)x^=arguments[_].lo,S^=arguments[_].hi;return new n(S,x)}function et(x,S){var _,A,N=32-S;return S<32?(_=x.hi>>>S|x.lo<<N,A=x.lo>>>S|x.hi<<N):S<64&&(_=x.lo>>>S|x.hi<<N,A=x.hi>>>S|x.lo<<N),new n(_,A)}function Qo(x,S,_){var A=x.hi&S.hi^~x.hi&_.hi,N=x.lo&S.lo^~x.lo&_.lo;return new n(A,N)}function Ia(x,S,_){var A=x.hi&S.hi^x.hi&_.hi^S.hi&_.hi,N=x.lo&S.lo^x.lo&_.lo^S.lo&_.lo;return new n(A,N)}function Xa(x){return Ci(et(x,28),et(x,34),et(x,39))}function ki(x){return Ci(et(x,14),et(x,18),et(x,41))}function Io(x){return Ci(et(x,1),et(x,8),Qa(x,7))}function Ka(x){return Ci(et(x,19),et(x,61),Qa(x,6))}var Xo=[new n(1116352408,3609767458),new n(1899447441,602891725),new n(3049323471,3964484399),new n(3921009573,2173295548),new n(961987163,4081628472),new n(1508970993,3053834265),new n(2453635748,2937671579),new n(2870763221,3664609560),new n(3624381080,2734883394),new n(310598401,1164996542),new n(607225278,1323610764),new n(1426881987,3590304994),new n(1925078388,4068182383),new n(2162078206,991336113),new n(2614888103,633803317),new n(3248222580,3479774868),new n(3835390401,2666613458),new n(4022224774,944711139),new n(264347078,2341262773),new n(604807628,2007800933),new n(770255983,1495990901),new n(1249150122,1856431235),new n(1555081692,3175218132),new n(1996064986,2198950837),new n(2554220882,3999719339),new n(2821834349,766784016),new n(2952996808,2566594879),new n(3210313671,3203337956),new n(3336571891,1034457026),new n(3584528711,2466948901),new n(113926993,3758326383),new n(338241895,168717936),new n(666307205,1188179964),new n(773529912,1546045734),new n(1294757372,1522805485),new n(1396182291,2643833823),new n(1695183700,2343527390),new n(1986661051,1014477480),new n(2177026350,1206759142),new n(2456956037,344077627),new n(2730485921,1290863460),new n(2820302411,3158454273),new n(3259730800,3505952657),new n(3345764771,106217008),new n(3516065817,3606008344),new n(3600352804,1432725776),new n(4094571909,1467031594),new n(275423344,851169720),new n(430227734,3100823752),new n(506948616,1363258195),new n(659060556,3750685593),new n(883997877,3785050280),new n(958139571,3318307427),new n(1322822218,3812723403),new n(1537002063,2003034995),new n(1747873779,3602036899),new n(1955562222,1575990012),new n(2024104815,1125592928),new n(2227730452,2716904306),new n(2361852424,442776044),new n(2428436474,593698344),new n(2756734187,3733110249),new n(3204031479,2999351573),new n(3329325298,3815920427),new n(3391569614,3928383900),new n(3515267271,566280711),new n(3940187606,3454069534),new n(4118630271,4000239992),new n(116418474,1914138554),new n(174292421,2731055270),new n(289380356,3203993006),new n(460393269,320620315),new n(685471733,587496836),new n(852142971,1086792851),new n(1017036298,365543100),new n(1126000580,2618297676),new n(1288033470,3409855158),new n(1501505948,4234509866),new n(1607167915,987167468),new n(1816402316,1246189591)];function Za(x,S,_){var A=[],N=[],D=[],Q=[],K,H,J;for(H=0;H<8;H++)A[H]=D[H]=V(x,8*H);for(var fe=0;_>=128;){for(H=0;H<16;H++)Q[H]=V(S,8*H+fe);for(H=0;H<80;H++){for(J=0;J<8;J++)N[J]=D[J];for(K=$n(D[7],ki(D[4]),Qo(D[4],D[5],D[6]),Xo[H],Q[H%16]),N[7]=$n(K,Xa(D[0]),Ia(D[0],D[1],D[2])),N[3]=$n(N[3],K),J=0;J<8;J++)D[(J+1)%8]=N[J];if(H%16===15)for(J=0;J<16;J++)Q[J]=$n(Q[J],Q[(J+9)%16],Io(Q[(J+1)%16]),Ka(Q[(J+14)%16]))}for(H=0;H<8;H++)D[H]=$n(D[H],A[H]),A[H]=D[H];fe+=128,_-=128}for(H=0;H<8;H++)ee(x,8*H,A[H]);return _}var ni=new Uint8Array([106,9,230,103,243,188,201,8,187,103,174,133,132,202,167,59,60,110,243,114,254,148,248,43,165,79,245,58,95,29,54,241,81,14,82,127,173,230,130,209,155,5,104,140,43,62,108,31,31,131,217,171,251,65,189,107,91,224,205,25,19,126,33,121]);function ot(x,S,_){var A=new Uint8Array(64),N=new Uint8Array(256),D,Q=_;for(D=0;D<64;D++)A[D]=ni[D];for(Za(A,S,_),_%=128,D=0;D<256;D++)N[D]=0;for(D=0;D<_;D++)N[D]=S[Q-_+D];for(N[_]=128,_=256-128*(_<112?1:0),N[_-9]=0,ee(N,_-8,new n(Q/536870912|0,Q<<3)),Za(A,N,_),D=0;D<64;D++)x[D]=A[D];return 0}function $t(x,S){var _=s(),A=s(),N=s(),D=s(),Q=s(),K=s(),H=s(),J=s(),fe=s();jt(_,x[1],x[0]),jt(fe,S[1],S[0]),we(_,_,fe),Ot(A,x[0],x[1]),Ot(fe,S[0],S[1]),we(A,A,fe),we(N,x[3],S[3]),we(N,N,E),we(D,x[2],S[2]),Ot(D,D,D),jt(Q,A,_),jt(K,D,N),Ot(H,D,N),Ot(J,A,_),we(x[0],Q,K),we(x[1],J,H),we(x[2],H,K),we(x[3],Q,J)}function Nt(x,S,_){var A;for(A=0;A<4;A++)_e(x[A],S[A],_)}function Cr(x,S){var _=s(),A=s(),N=s();ei(N,S[2]),we(_,S[0],N),we(A,S[1],N),Te(x,A),x[31]^=Pt(_)<<7}function kr(x,S,_){var A,N;for(be(x[0],h),be(x[1],d),be(x[2],d),be(x[3],h),N=255;N>=0;--N)A=_[N/8|0]>>(N&7)&1,Nt(x,S,A),$t(S,x),$t(x,x),Nt(x,S,A)}function Mi(x,S){var _=[s(),s(),s(),s()];be(_[0],w),be(_[1],j),be(_[2],d),we(_[3],w,j),kr(x,_,S)}function ms(x,S,_){var A=new Uint8Array(64),N=[s(),s(),s(),s()],D;for(_||a(S,32),ot(A,S,32),A[0]&=248,A[31]&=127,A[31]|=64,Mi(N,A),Cr(x,N),D=0;D<32;D++)S[D+32]=x[D];return 0}var Yn=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 ps(x,S){var _,A,N,D;for(A=63;A>=32;--A){for(_=0,N=A-32,D=A-12;N<D;++N)S[N]+=_-16*S[A]*Yn[N-(A-32)],_=Math.floor((S[N]+128)/256),S[N]-=_*256;S[N]+=_,S[A]=0}for(_=0,N=0;N<32;N++)S[N]+=_-(S[31]>>4)*Yn[N],_=S[N]>>8,S[N]&=255;for(N=0;N<32;N++)S[N]-=_*Yn[N];for(A=0;A<32;A++)S[A+1]+=S[A]>>8,x[A]=S[A]&255}function xn(x){var S=new Float64Array(64),_;for(_=0;_<64;_++)S[_]=x[_];for(_=0;_<64;_++)x[_]=0;ps(x,S)}function si(x,S,_,A){var N=new Uint8Array(64),D=new Uint8Array(64),Q=new Uint8Array(64),K,H,J=new Float64Array(64),fe=[s(),s(),s(),s()];ot(N,A,32),N[0]&=248,N[31]&=127,N[31]|=64;var Oe=_+64;for(K=0;K<_;K++)x[64+K]=S[K];for(K=0;K<32;K++)x[32+K]=N[32+K];for(ot(Q,x.subarray(32),_+32),xn(Q),Mi(fe,Q),Cr(x,fe),K=32;K<64;K++)x[K]=A[K];for(ot(D,x,_+64),xn(D),K=0;K<64;K++)J[K]=0;for(K=0;K<32;K++)J[K]=Q[K];for(K=0;K<32;K++)for(H=0;H<32;H++)J[K+H]+=D[K]*N[H];return ps(x.subarray(32),J),Oe}function ii(x,S){var _=s(),A=s(),N=s(),D=s(),Q=s(),K=s(),H=s();return be(x[2],d),sn(x[1],S),Tt(N,x[1]),we(D,N,y),jt(N,N,x[2]),Ot(D,x[2],D),Tt(Q,D),Tt(K,Q),we(H,K,Q),we(_,H,N),we(_,_,D),Ti(_,_),we(_,_,N),we(_,_,D),we(_,_,D),we(x[0],_,D),Tt(A,x[0]),we(A,A,D),lt(A,N)&&we(x[0],x[0],z),Tt(A,x[0]),we(A,A,D),lt(A,N)?-1:(Pt(x[0])===S[31]>>7&&jt(x[0],h,x[0]),we(x[3],x[0],x[1]),0)}function Mr(x,S,_,A){var N,D=new Uint8Array(32),Q=new Uint8Array(64),K=[s(),s(),s(),s()],H=[s(),s(),s(),s()];if(_<64||ii(H,A))return-1;for(N=0;N<_;N++)x[N]=S[N];for(N=0;N<32;N++)x[N+32]=A[N];if(ot(Q,x,_),xn(Q),kr(K,H,Q),Mi(H,S.subarray(32)),$t(K,H),Cr(D,K),_-=64,k(S,0,D,0)){for(N=0;N<_;N++)x[N]=0;return-1}for(N=0;N<_;N++)x[N]=S[N+64];return _}var Ri=32,gs=24,vn=32,ys=16,bs=32,ri=32,xs=32,Gn=32,ai=32,Rr=gs,Wa=vn,Cn=ys,Qe=64,it=32,Yt=64,li=32,Dr=64;r.lowlevel={crypto_core_hsalsa20:W,crypto_stream_xor:qe,crypto_stream:re,crypto_stream_salsa20_xor:Z,crypto_stream_salsa20:le,crypto_onetimeauth:$,crypto_onetimeauth_verify:te,crypto_verify_16:ae,crypto_verify_32:k,crypto_secretbox:de,crypto_secretbox_open:ve,crypto_scalarmult:ti,crypto_scalarmult_base:rn,crypto_box_beforenm:ds,crypto_box_afternm:Fa,crypto_box:Tr,crypto_box_open:Nr,crypto_box_keypair:Ni,crypto_hash:ot,crypto_sign:si,crypto_sign_keypair:ms,crypto_sign_open:Mr,crypto_secretbox_KEYBYTES:Ri,crypto_secretbox_NONCEBYTES:gs,crypto_secretbox_ZEROBYTES:vn,crypto_secretbox_BOXZEROBYTES:ys,crypto_scalarmult_BYTES:bs,crypto_scalarmult_SCALARBYTES:ri,crypto_box_PUBLICKEYBYTES:xs,crypto_box_SECRETKEYBYTES:Gn,crypto_box_BEFORENMBYTES:ai,crypto_box_NONCEBYTES:Rr,crypto_box_ZEROBYTES:Wa,crypto_box_BOXZEROBYTES:Cn,crypto_sign_BYTES:Qe,crypto_sign_PUBLICKEYBYTES:it,crypto_sign_SECRETKEYBYTES:Yt,crypto_sign_SEEDBYTES:li,crypto_hash_BYTES:Dr,gf:s,D:y,L:Yn,pack25519:Te,unpack25519:sn,M:we,A:Ot,S:Tt,Z:jt,pow2523:Ti,add:$t,set25519:be,modL:ps,scalarmult:kr,scalarbase:Mi};function el(x,S){if(x.length!==Ri)throw new Error("bad key size");if(S.length!==gs)throw new Error("bad nonce size")}function tl(x,S){if(x.length!==xs)throw new Error("bad public key size");if(S.length!==Gn)throw new Error("bad secret key size")}function yt(){for(var x=0;x<arguments.length;x++)if(!(arguments[x]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Di(x){for(var S=0;S<x.length;S++)x[S]=0}r.randomBytes=function(x){var S=new Uint8Array(x);return a(S,x),S},r.secretbox=function(x,S,_){yt(x,S,_),el(_,S);for(var A=new Uint8Array(vn+x.length),N=new Uint8Array(A.length),D=0;D<x.length;D++)A[D+vn]=x[D];return de(N,A,A.length,S,_),N.subarray(ys)},r.secretbox.open=function(x,S,_){yt(x,S,_),el(_,S);for(var A=new Uint8Array(ys+x.length),N=new Uint8Array(A.length),D=0;D<x.length;D++)A[D+ys]=x[D];return A.length<32||ve(N,A,A.length,S,_)!==0?null:N.subarray(vn)},r.secretbox.keyLength=Ri,r.secretbox.nonceLength=gs,r.secretbox.overheadLength=ys,r.scalarMult=function(x,S){if(yt(x,S),x.length!==ri)throw new Error("bad n size");if(S.length!==bs)throw new Error("bad p size");var _=new Uint8Array(bs);return ti(_,x,S),_},r.scalarMult.base=function(x){if(yt(x),x.length!==ri)throw new Error("bad n size");var S=new Uint8Array(bs);return rn(S,x),S},r.scalarMult.scalarLength=ri,r.scalarMult.groupElementLength=bs,r.box=function(x,S,_,A){var N=r.box.before(_,A);return r.secretbox(x,S,N)},r.box.before=function(x,S){yt(x,S),tl(x,S);var _=new Uint8Array(ai);return ds(_,x,S),_},r.box.after=r.secretbox,r.box.open=function(x,S,_,A){var N=r.box.before(_,A);return r.secretbox.open(x,S,N)},r.box.open.after=r.secretbox.open,r.box.keyPair=function(){var x=new Uint8Array(xs),S=new Uint8Array(Gn);return Ni(x,S),{publicKey:x,secretKey:S}},r.box.keyPair.fromSecretKey=function(x){if(yt(x),x.length!==Gn)throw new Error("bad secret key size");var S=new Uint8Array(xs);return rn(S,x),{publicKey:S,secretKey:new Uint8Array(x)}},r.box.publicKeyLength=xs,r.box.secretKeyLength=Gn,r.box.sharedKeyLength=ai,r.box.nonceLength=Rr,r.box.overheadLength=r.secretbox.overheadLength,r.sign=function(x,S){if(yt(x,S),S.length!==Yt)throw new Error("bad secret key size");var _=new Uint8Array(Qe+x.length);return si(_,x,x.length,S),_},r.sign.open=function(x,S){if(yt(x,S),S.length!==it)throw new Error("bad public key size");var _=new Uint8Array(x.length),A=Mr(_,x,x.length,S);if(A<0)return null;for(var N=new Uint8Array(A),D=0;D<N.length;D++)N[D]=_[D];return N},r.sign.detached=function(x,S){for(var _=r.sign(x,S),A=new Uint8Array(Qe),N=0;N<A.length;N++)A[N]=_[N];return A},r.sign.detached.verify=function(x,S,_){if(yt(x,S,_),S.length!==Qe)throw new Error("bad signature size");if(_.length!==it)throw new Error("bad public key size");var A=new Uint8Array(Qe+x.length),N=new Uint8Array(Qe+x.length),D;for(D=0;D<Qe;D++)A[D]=S[D];for(D=0;D<x.length;D++)A[D+Qe]=x[D];return Mr(N,A,A.length,_)>=0},r.sign.keyPair=function(){var x=new Uint8Array(it),S=new Uint8Array(Yt);return ms(x,S),{publicKey:x,secretKey:S}},r.sign.keyPair.fromSecretKey=function(x){if(yt(x),x.length!==Yt)throw new Error("bad secret key size");for(var S=new Uint8Array(it),_=0;_<S.length;_++)S[_]=x[32+_];return{publicKey:S,secretKey:new Uint8Array(x)}},r.sign.keyPair.fromSeed=function(x){if(yt(x),x.length!==li)throw new Error("bad seed size");for(var S=new Uint8Array(it),_=new Uint8Array(Yt),A=0;A<32;A++)_[A]=x[A];return ms(S,_,!0),{publicKey:S,secretKey:_}},r.sign.publicKeyLength=it,r.sign.secretKeyLength=Yt,r.sign.seedLength=li,r.sign.signatureLength=Qe,r.hash=function(x){yt(x);var S=new Uint8Array(Dr);return ot(S,x,x.length),S},r.hash.hashLength=Dr,r.verify=function(x,S){return yt(x,S),x.length===0||S.length===0||x.length!==S.length?!1:pe(x,0,S,0,x.length)===0},r.setPRNG=function(x){a=x},(function(){var x=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(x&&x.getRandomValues){var S=65536;r.setPRNG(function(_,A){var N,D=new Uint8Array(A);for(N=0;N<A;N+=S)x.getRandomValues(D.subarray(N,N+Math.min(A-N,S)));for(N=0;N<A;N++)_[N]=D[N];Di(D)})}else typeof require<"u"&&(x=require("crypto"),x&&x.randomBytes&&r.setPRNG(function(_,A){var N,D=x.randomBytes(A);for(N=0;N<A;N++)_[N]=D[N];Di(D)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const go=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;go.sign.keyPair.fromSeed,go.sign.detached,go.sign.detached.verify,go.randomBytes;var v0;(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"})(v0||(v0={}));var _0;(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"})(_0||(_0={}));function d1(r){return n=>{let s={};return r.forEach(a=>{const o=a(n)||{};s=Object.assign(s,o)}),s}}function m1(){return()=>{}}function p1(r,n){return()=>{const s=typeof r=="function"?r():r,a=typeof n=="function"?n():n;return{user:s,pass:a}}}function g1(r){return()=>({auth_token:typeof r=="function"?r():r})}const wg=120*1e3,y1=2,Sg=2*1e3;function b1(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:wg,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:Sg,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function x1(r){const n=[];return typeof r.authenticator=="function"&&n.push(r.authenticator),Array.isArray(r.authenticator)&&n.push(...r.authenticator),r.token&&n.push(g1(r.token)),r.user&&n.push(p1(r.user,r.pass)),n.length===0?m1():d1(n)}function v1(r){const n=`${Ef}:${xg()}`;if(r=r||{servers:[n]},r.servers=r.servers||[],typeof r.servers=="string"&&(r.servers=[r.servers]),r.servers.length>0&&r.port)throw new ue("port and servers options are mutually exclusive",ie.InvalidOption);r.servers.length===0&&r.port&&(r.servers=[`${Ef}:${r.port}`]),r.servers&&r.servers.length===0&&(r.servers=[n]);const s=$o(b1(),r);if(s.authenticator=x1(s),["reconnectDelayHandler","authenticator"].forEach(a=>{if(s[a]&&typeof s[a]!="function")throw new ue(`${a} option should be a function`,ie.NotFunction)}),s.reconnectDelayHandler||(s.reconnectDelayHandler=()=>{let a=s.tls?s.reconnectJitterTLS:s.reconnectJitter;return a&&(a++,a=Math.floor(Math.random()*a)),s.reconnectTimeWait+a}),s.inboxPrefix)try{us(s.inboxPrefix)}catch(a){throw new ue(a.message,ie.ApiError)}if(s.resolve===void 0&&(s.resolve=typeof Mf()=="function"),s.resolve&&typeof Mf()!="function")throw new ue("'resolve' is not supported on this client",ie.InvalidOption);return s}function _1(r,n){const{proto:s,tls_required:a,tls_available:o}=r;if((s===void 0||s<1)&&n.noEcho)throw new ue("noEcho",ie.ServerOptionNotAvailable);const f=a||o||!1;if(n.tls&&!f)throw new ue("tls",ie.ServerOptionNotAvailable)}const w1=1024*32,S1=/^INFO\s+([^\r\n]+)\r\n/i,E1=ka(`PONG\r
|
|
38
|
+
`),w0=ka(`PING\r
|
|
39
|
+
`);class A1{constructor(n,s,a){v(this,"echo");v(this,"no_responders");v(this,"protocol");v(this,"verbose");v(this,"pedantic");v(this,"jwt");v(this,"nkey");v(this,"sig");v(this,"user");v(this,"pass");v(this,"auth_token");v(this,"tls_required");v(this,"name");v(this,"lang");v(this,"version");v(this,"headers");this.protocol=1,this.version=n.version,this.lang=n.lang,this.echo=s.noEcho?!1:void 0,this.verbose=s.verbose,this.pedantic=s.pedantic,this.tls_required=s.tls?!0:void 0,this.name=s.name;const o=(s&&typeof s.authenticator=="function"?s.authenticator(a):{})||{};$o(this,o)}}class Eg extends _t{constructor(s,a,o={}){var h;super();v(this,"sid");v(this,"queue");v(this,"draining");v(this,"max");v(this,"subject");v(this,"drained");v(this,"protocol");v(this,"timer");v(this,"info");v(this,"cleanupFn");v(this,"closed");v(this,"requestSubject");$o(this,o),this.protocol=s,this.subject=a,this.draining=!1,this.noIterator=typeof o.callback=="function",this.closed=st();const f=!((h=s.options)!=null&&h.noAsyncTraces);o.timeout&&(this.timer=Sr(o.timeout,f),this.timer.then(()=>{this.timer=void 0}).catch(d=>{this.stop(d),this.noIterator&&this.callback(d,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(s){if(this.noIterator){const a=this.callback,o=s.ingestionFilterFn?s.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),f=s.protocolFilterFn?s.protocolFilterFn:()=>!0,h=s.dispatchedFn?s.dispatchedFn:()=>{};this.callback=(d,g)=>{const{ingest:y}=o(g);y&&f(g)&&(a(d,g),h(g))}}else this.protocolFilterFn=s.protocolFilterFn,this.dispatchedFn=s.dispatchedFn}callback(s,a){this.cancelTimeout(),s?this.stop(s):this.push(a)}close(){if(!this.isClosed()){this.cancelTimeout();const s=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?s():this.push(s)}}unsubscribe(s){this.protocol.unsubscribe(this,s)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(ue.errorForCode(ie.ConnectionClosed)):this.isClosed()?Promise.reject(ue.errorForCode(ie.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(st()).then(()=>{this.protocol.subscriptions.cancel(this)}).catch(()=>{this.protocol.subscriptions.cancel(this)})),this.drained)}isDraining(){return this.draining}isClosed(){return this.done}getSubject(){return this.subject}getMax(){return this.max}getID(){return this.sid}}class O1{constructor(){v(this,"mux");v(this,"subs");v(this,"sidCounter");this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(n){return this.sidCounter++,n.sid=this.sidCounter,this.subs.set(n.sid,n),n}setMux(n){return this.mux=n,n}getMux(){return this.mux}get(n){return this.subs.get(n)}resub(n){return this.sidCounter++,this.subs.delete(n.sid),n.sid=this.sidCounter,this.subs.set(n.sid,n),n}all(){return Array.from(this.subs.values())}cancel(n){n&&(n.close(),this.subs.delete(n.sid))}handleError(n){if(n&&n.permissionContext){const s=n.permissionContext,a=this.all();let o;if(s.operation==="subscription"&&(o=a.find(f=>f.subject===s.subject&&f.queue===s.queue)),s.operation==="publish"&&(o=a.find(f=>f.requestSubject===s.subject)),o)return o.callback(n,{}),o.close(),this.subs.delete(o.sid),o!==this.mux}return!1}close(){this.subs.forEach(n=>{n.close()})}}class qo{constructor(n,s){v(this,"connected");v(this,"connectedOnce");v(this,"infoReceived");v(this,"info");v(this,"muxSubscriptions");v(this,"options");v(this,"outbound");v(this,"pongs");v(this,"subscriptions");v(this,"transport");v(this,"noMorePublishing");v(this,"connectError");v(this,"publisher");v(this,"_closed");v(this,"closed");v(this,"listeners");v(this,"heartbeats");v(this,"parser");v(this,"outMsgs");v(this,"inMsgs");v(this,"outBytes");v(this,"inBytes");v(this,"pendingLimit");v(this,"lastError");v(this,"abortReconnect");v(this,"whyClosed");v(this,"servers");v(this,"server");v(this,"features");v(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=w1,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=n,this.publisher=s,this.subscriptions=new O1,this.muxSubscriptions=new o1,this.outbound=new Ar,this.pongs=[],this.whyClosed="",this.pendingLimit=n.pendingLimit||this.pendingLimit,this.features=new $v({major:0,minor:0,micro:0}),this.connectPromise=null;const a=typeof n.servers=="string"?[n.servers]:n.servers;this.servers=new l1(a,{randomize:!n.noRandomize}),this.closed=st(),this.parser=new x0(this),this.heartbeats=new c1(this,this.options.pingInterval||wg,this.options.maxPingOut||y1)}resetOutbound(){this.outbound.reset();const n=this.pongs;this.pongs=[];const s=ue.errorForCode(ie.Disconnect);s.stack="",n.forEach(a=>{a.reject(s)}),this.parser=new x0(this),this.infoReceived=!1}dispatchStatus(n){this.listeners.forEach(s=>{s.push(n)})}status(){const n=new _t;return this.listeners.push(n),n}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const n=st();return n.catch(()=>{}),this.pongs.unshift(n),this.connectError=s=>{n.reject(s)},this.transport=Vv(),this.transport.closed().then(async s=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),n}disconnect(){this.dispatchStatus({type:br.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:br.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(n){this.dispatchStatus({type:cs.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var s;this.dispatchStatus({type:cs.Reconnect,data:this.servers.getCurrentServer().toString()}),((s=this.lastError)==null?void 0:s.code)===ie.AuthenticationExpired&&(this.lastError=void 0)}).catch(s=>{this._close(s)}):await this._close(n)}async dial(n){const s=this.prepare();let a;try{a=Sr(this.options.timeout||2e4);const o=this.transport.connect(n,this.options);await Promise.race([o,a]),(async()=>{try{for await(const f of this.transport)this.parser.parse(f)}catch(f){console.log("reader closed",f)}})().then()}catch(o){s.reject(o)}try{await Promise.race([a,s]),a&&a.cancel(),this.connected=!0,this.connectError=void 0,this.sendSubscriptions(),this.connectedOnce=!0,this.server.didConnect=!0,this.server.reconnects=0,this.flushPending(),this.heartbeats.start()}catch(o){throw a&&a.cancel(),await this.transport.close(o),o}}async _doDial(n){const{resolve:s}=this.options,a=await n.resolve({fn:Mf(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:s});let o=null;for(const f of a)try{o=null,this.dispatchStatus({type:br.Reconnecting,data:f.toString()}),await this.dial(f);return}catch(h){o=h}throw o}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let n;for(;;){this._closed&&this.servers.clear();const s=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():Sg;let a=s;const o=this.selectServer();if(!o||this.abortReconnect)throw n||(this.lastError?this.lastError:ue.errorForCode(ie.ConnectionRefused));const f=Date.now();if(o.lastConnect===0||o.lastConnect+s<=f){o.lastConnect=Date.now();try{await this._doDial(o);break}catch(h){if(n=h,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}o.reconnects++;const d=this.options.maxReconnectAttempts||0;d!==-1&&o.reconnects>=d&&this.servers.removeCurrentServer()}}else a=Math.min(a,o.lastConnect+s-f),await Or(a)}}static async connect(n,s){const a=new qo(n,s);return await a.dialLoop(),a}static toError(n){const s=n?n.toLowerCase():"";if(s.indexOf("permissions violation")!==-1){const a=new ue(n,ie.PermissionsViolation),o=n.match(/(Publish|Subscription) to "(\S+)"/);if(o){a.permissionContext={operation:o[1].toLowerCase(),subject:o[2],queue:void 0};const f=n.match(/using queue "(\S+)"/);f&&(a.permissionContext.queue=f[1])}return a}else return s.indexOf("authorization violation")!==-1?new ue(n,ie.AuthorizationViolation):s.indexOf("user authentication expired")!==-1?new ue(n,ie.AuthenticationExpired):s.indexOf("account authentication expired")!=-1?new ue(n,ie.AccountExpired):s.indexOf("authentication timeout")!==-1?new ue(n,ie.AuthenticationTimeout):new ue(n,ie.ProtocolError)}processMsg(n,s){if(this.inMsgs++,this.inBytes+=s.length,!this.subscriptions.sidCounter)return;const a=this.subscriptions.get(n.sid);a&&(a.received+=1,a.callback&&a.callback(null,new Kf(n,s,this)),a.max!==void 0&&a.received>=a.max&&a.unsubscribe())}processError(n){const s=i0(n),a=qo.toError(s),o={type:cs.Error,data:a.code};if(a.isPermissionError()){let f=!1;if(a.permissionContext){o.permissionContext=a.permissionContext;const h=this.subscriptions.getMux();f=(h==null?void 0:h.subject)===a.permissionContext.subject}this.subscriptions.handleError(a),this.muxSubscriptions.handleError(f,a),f&&this.subscriptions.setMux(null)}this.dispatchStatus(o),this.handleError(a)}handleError(n){n.isAuthError()?this.handleAuthError(n):n.isProtocolError()?this.lastError=n:n.isAuthTimeout()&&(this.lastError=n),n.isPermissionError()||(this.lastError=n)}handleAuthError(n){this.lastError&&n.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(n):this.disconnect()}processPing(){this.transport.send(E1)}processPong(){const n=this.pongs.shift();n&&n.resolve()}processInfo(n){const s=JSON.parse(i0(n));this.info=s;const a=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(s,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(Ai(s.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:f,lang:h}=this.transport;try{const d=new A1({version:f,lang:h},this.options,s.nonce);s.headers&&(d.headers=!0,d.no_responders=!0);const g=JSON.stringify(d);this.transport.send(ka(`CONNECT ${g}${So}`)),this.transport.send(w0)}catch(d){this._close(d)}}a&&this.dispatchStatus({type:cs.Update,data:a}),(s.ldm!==void 0?s.ldm:!1)&&this.dispatchStatus({type:cs.LDM,data:this.servers.getCurrentServer().toString()})}push(n){switch(n.kind){case Rt.MSG:{const{msg:s,data:a}=n;this.processMsg(s,a);break}case Rt.OK:break;case Rt.ERR:this.processError(n.data);break;case Rt.PING:this.processPing();break;case Rt.PONG:this.processPong();break;case Rt.INFO:this.processInfo(n.data);break}}sendCommand(n,...s){const a=this.outbound.length();let o;typeof n=="string"?o=ka(n):o=n,this.outbound.fill(o,...s),a===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(n,s=tn,a){let o;if(s instanceof Uint8Array)o=s;else if(typeof s=="string")o=ji.encode(s);else throw ue.errorForCode(ie.BadPayload);let f=o.length;a=a||{},a.reply=a.reply||"";let h=tn,d=0;if(a.headers){if(this.info&&!this.info.headers)throw new ue("headers",ie.ServerOptionNotAvailable);h=a.headers.encode(),d=h.length,f=o.length+d}if(this.info&&f>this.info.max_payload)throw ue.errorForCode(ie.MaxPayloadExceeded);this.outBytes+=f,this.outMsgs++;let g;a.headers?(a.reply?g=`HPUB ${n} ${a.reply} ${d} ${f}\r
|
|
40
40
|
`:g=`HPUB ${n} ${d} ${f}\r
|
|
41
41
|
`,this.sendCommand(g,h,o,zo)):(a.reply?g=`PUB ${n} ${a.reply} ${f}\r
|
|
42
42
|
`:g=`PUB ${n} ${f}\r
|
|
@@ -44,20 +44,20 @@ ${this.ctx.stack}`),this.deferred.reject(s)):this.deferred.resolve(a),this.cance
|
|
|
44
44
|
`):this.sendCommand(`SUB ${n.subject} ${n.sid}\r
|
|
45
45
|
`)}_subunsub(n){return this._sub(n),n.max&&this.unsubscribe(n,n.max),n}unsubscribe(n,s){this.unsub(n,s),(n.max===void 0||n.received>=n.max)&&this.subscriptions.cancel(n)}unsub(n,s){!n||this.isClosed()||(s?this.sendCommand(`UNSUB ${n.sid} ${s}\r
|
|
46
46
|
`):this.sendCommand(`UNSUB ${n.sid}\r
|
|
47
|
-
`),n.max=s)}resub(n,s){!n||this.isClosed()||(this.unsub(n),n.subject=s,this.subscriptions.resub(n),this._sub(n))}flush(n){return n||(n=st()),this.pongs.push(n),this.outbound.fill(A0),this.flushPending(),n}sendSubscriptions(){const n=[];this.subscriptions.all().forEach(s=>{const a=s;a.queue?n.push(`SUB ${a.subject} ${a.queue} ${a.sid}${So}`):n.push(`SUB ${a.subject} ${a.sid}${So}`)}),n.length&&this.transport.send(Ma(n.join("")))}async _close(n){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(n),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(s=>{s.stop()}),this._closed=!0,await this.transport.close(n),await this.closed.resolve(n))}close(){return this._close()}isClosed(){return this._closed}drain(){const n=this.subscriptions.all(),s=[];return n.forEach(a=>{s.push(a.drain())}),Promise.all(s).then(async()=>(this.noMorePublishing=!0,await this.flush(),this.close())).catch(()=>{})}flushPending(){if(!(!this.infoReceived||!this.connected)&&this.outbound.size()){const n=this.outbound.drain();this.transport.send(n)}}initMux(){if(!this.subscriptions.getMux()){const s=this.muxSubscriptions.init(this.options.inboxPrefix),a=new jg(this,`${s}*`);a.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(a),this.subscribe(a)}}selectServer(){const n=this.servers.selectServer();if(n!==void 0)return this.server=n,this.server}getServer(){return this.server}}const w1="$SRV";class O0{constructor(n){v(this,"msg");this.msg=n}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(n,s){return this.msg.respond(n,s)}respondError(n,s,a,o){var f,h;return o=o||{},o.headers=o.headers||fs(),(f=o.headers)==null||f.set(ko,`${n}`),(h=o.headers)==null||h.set(Co,s),this.msg.respond(a,o)}json(n){return this.msg.json(n)}string(){return this.msg.string()}}class Ba{constructor(n,s="",a=""){v(this,"subject");v(this,"queue");v(this,"srv");s!==""&&E1("service group",s);let o="";if(n instanceof Ya)this.srv=n,o="";else if(n instanceof Ba){const f=n;this.srv=f.srv,a===""&&f.queue!==""&&(a=f.queue),o=f.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(o,s),this.queue=a}calcSubject(n,s=""){return s===""?n:n!==""?`${n}.${s}`:s}addEndpoint(n="",s){s=s||{subject:n};const a=typeof s=="function"?{handler:s,subject:n}:s;Ta("endpoint",n);let{subject:o,handler:f,metadata:h,queue:d}=a;o=o||n,d=d||this.queue,S1("endpoint subject",o),o=this.calcSubject(this.subject,o);const g={name:n,subject:o,queue:d,handler:f,metadata:h};return this.srv._addEndpoint(g)}addGroup(n="",s=""){return new Ba(this,n,s)}}function S1(r,n){if(n==="")throw new Error(`${r} cannot be empty`);if(n.indexOf(" ")!==-1)throw new Error(`${r} cannot contain spaces: '${n}'`);const s=n.split(".");s.forEach((a,o)=>{if(a===">"&&o!==s.length-1)throw new Error(`${r} cannot have internal '>': '${n}'`)})}function E1(r,n){if(n.indexOf(" ")!==-1)throw new Error(`${r} cannot contain spaces: '${n}'`);n.split(".").forEach(a=>{if(a===">")throw new Error(`${r} name cannot contain internal '>': '${n}'`)})}class Ya{constructor(n,s={name:"",version:""}){v(this,"nc");v(this,"_id");v(this,"config");v(this,"handlers");v(this,"internal");v(this,"_stopped");v(this,"_done");v(this,"started");this.nc=n,this.config=Object.assign({},s),this.config.queue||(this.config.queue="q"),Ta("name",this.config.name),Ta("queue",this.config.queue),Ai(this.config.version),this._id=Ks.next(),this.internal=[],this._done=st(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(a=>{this.close(a).catch()})}static controlSubject(n,s="",a="",o){const f=o??w1;return s===""&&a===""?`${f}.${n}`:(Ta("control subject name",s),a!==""?(Ta("control subject id",a),`${f}.${n}.${s}.${a}`):`${f}.${n}.${s}`)}get subjects(){return this.handlers.filter(n=>n.internal===!1).map(n=>n.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(n){const s=fs();if(n instanceof Mo){const a=n;s.set(Co,a.message),s.set(ko,`${a.code}`)}else s.set(Co,n.message),s.set(ko,"500");return s}setupHandler(n,s=!1){const a=s?"":n.queue?n.queue:this.config.queue,{name:o,subject:f,handler:h}=n,d=n;d.internal=s,s&&this.internal.push(d),d.stats=new A1(o,f,a),d.queue=a;const g=h?(y,E)=>{if(y){this.close(y);return}const w=Date.now();try{h(y,new O0(E))}catch(j){d.stats.countError(j),E==null||E.respond(tn,{headers:this.errorToHeader(j)})}finally{d.stats.countLatency(w)}}:void 0;return d.sub=this.nc.subscribe(f,{callback:g,queue:a}),d.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${n.subject} stopped`)).catch()}).catch(y=>{if(!this._stopped){const E=new Error(`required subscription ${n.subject} errored: ${y.message}`);E.stack=y.stack,this.close(E).catch()}}),d}info(){return{type:Ra.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(n=>{const{subject:s,metadata:a,name:o,queue:f}=n;return{subject:s,metadata:a,name:o,queue_group:f}})}async stats(){const n=[];for(const s of this.handlers){if(typeof this.config.statsHandler=="function")try{s.stats.data=await this.config.statsHandler(s)}catch(a){s.stats.countError(a)}n.push(s.stats.stats(s.qi))}return{type:Ra.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:n}}addInternalHandler(n,s){const a=`${n}`.toUpperCase();this._doAddInternalHandler(`${a}-all`,n,s),this._doAddInternalHandler(`${a}-kind`,n,s,this.name),this._doAddInternalHandler(`${a}`,n,s,this.name,this.id)}_doAddInternalHandler(n,s,a,o="",f=""){const h={};h.name=n,h.subject=Ya.controlSubject(s,o,f),h.handler=a,this.setupHandler(h,!0)}start(){const n=Tn(),s=(h,d)=>h?(this.close(h),Promise.reject(h)):this.stats().then(g=>(d==null||d.respond(n.encode(g)),Promise.resolve())),a=(h,d)=>h?(this.close(h),Promise.reject(h)):(d==null||d.respond(n.encode(this.info())),Promise.resolve()),o=n.encode(this.ping()),f=(h,d)=>h?(this.close(h).then().catch(),Promise.reject(h)):(d.respond(o),Promise.resolve());return this.addInternalHandler(Js.PING,f),this.addInternalHandler(Js.STATS,s),this.addInternalHandler(Js.INFO,a),this.handlers.forEach(h=>{const{subject:d}=h;typeof d=="string"&&h.handler!==null&&this.setupHandler(h)}),Promise.resolve(this)}close(n){if(this._stopped)return this._done;this._stopped=!0;let s=[];return this.nc.isClosed()||(s=this.handlers.concat(this.internal).map(a=>a.sub.drain())),Promise.allSettled(s).then(()=>{this._done.resolve(n||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(n){return this.close(n)}ping(){return{type:Ra.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const n of this.handlers)n.stats.reset(n.qi)}addGroup(n,s){return new Ba(this,n,s)}addEndpoint(n,s){return new Ba(this).addEndpoint(n,s)}_addEndpoint(n){const s=new _t;s.noIterator=typeof n.handler=="function",s.noIterator||(n.handler=(o,f)=>{o?this.stop(o).catch():s.push(new O0(f))},s.iterClosed.then(()=>{this.close().catch()}));const a=this.setupHandler(n,!1);return a.qi=s,this.handlers.push(a),s}}class A1{constructor(n,s,a=""){v(this,"name");v(this,"subject");v(this,"average_processing_time");v(this,"num_requests");v(this,"processing_time");v(this,"num_errors");v(this,"last_error");v(this,"data");v(this,"metadata");v(this,"queue");this.name=n,this.subject=s,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=a}reset(n){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const s=n;s&&(s.time=0,s.processed=0)}countLatency(n){this.num_requests++,this.processing_time+=nt(Date.now()-n),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(n){this.num_errors++,this.last_error=n.message}_stats(){const{name:n,subject:s,average_processing_time:a,num_errors:o,num_requests:f,processing_time:h,last_error:d,data:g,queue:y}=this;return{name:n,subject:s,average_processing_time:a,num_errors:o,num_requests:f,processing_time:h,last_error:d,data:g,queue_group:y}}stats(n){const s=n;return(s==null?void 0:s.noIterator)===!1&&(this.processing_time=nt(s.time),this.num_requests=s.processed,this.average_processing_time=this.processing_time>0&&this.num_requests>0?this.processing_time/this.num_requests:0),this._stats()}}class O1{constructor(n,s={strategy:jn.JitterTimer,maxWait:2e3},a){v(this,"nc");v(this,"prefix");v(this,"opts");this.nc=n,this.prefix=a,this.opts=s}ping(n="",s=""){return this.q(Js.PING,n,s)}stats(n="",s=""){return this.q(Js.STATS,n,s)}info(n="",s=""){return this.q(Js.INFO,n,s)}async q(n,s="",a=""){const o=new _t,f=Tn(),h=Ya.controlSubject(n,s,a,this.prefix),d=await this.nc.requestMany(h,tn,this.opts);return(async()=>{for await(const g of d)try{const y=f.decode(g.data);o.push(y)}catch(y){o.push(()=>{o.stop(y)})}o.push(()=>{o.stop()})})().catch(g=>{o.stop(g)}),o}}function Tg(){return{key:{encode(r){return r},decode(r){return r}},value:{encode(r){return r},decode(r){return r}}}}function j1(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Tg(),storage:Mf.File}}const Uo="KV-Operation",j0="$KV",T1=/^[-/=.\w]+$/,N1=/^[-/=.>*\w]+$/,C1=/^[-\w]+$/;function k1(r){if(r.startsWith(".")||r.endsWith(".")||!T1.test(r))throw new Error(`invalid key: ${r}`)}function M1(r){if(r.startsWith(".")||r.endsWith(".")||!N1.test(r))throw new Error(`invalid key: ${r}`)}function R1(r){if(r.startsWith(".")||r.endsWith("."))throw new Error(`invalid key: ${r}`);const n=r.split(".");let s=!1;for(let a=0;a<n.length;a++)switch(n[a]){case"*":s=!0;break;case">":if(a!==n.length-1)throw new Error(`invalid key: ${r}`);s=!0;break}return s}function Eo(r){if(!C1.test(r))throw new Error(`invalid bucket name: ${r}`)}var zn;(function(r){r.MsgIdHdr="Nats-Msg-Id",r.ExpectedStreamHdr="Nats-Expected-Stream",r.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",r.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",r.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})(zn||(zn={}));class La{constructor(n,s,a){v(this,"js");v(this,"jsm");v(this,"stream");v(this,"bucket");v(this,"direct");v(this,"codec");v(this,"prefix");v(this,"editPrefix");v(this,"useJsPrefix");v(this,"_prefixLen");v(this,"validateKey",k1);v(this,"validateSearchKey",M1);v(this,"hasWildcards",R1);Eo(n),this.js=s,this.jsm=a,this.bucket=n,this.prefix=j0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(n,s,a={}){Eo(s);const o=await n.jetstreamManager(),f=new La(s,n,o);return await f.init(a),f}static async bind(n,s,a={}){const o=await n.jetstreamManager(),f={config:{allow_direct:a.allow_direct}};Eo(s);const h=new La(s,n,o);return f.config.name=a.streamName??h.bucketName(),Object.assign(h,f),h.stream=f.config.name,h.codec=a.codec||Tg(),h.direct=f.config.allow_direct??!1,h.initializePrefixes(f),h}async init(n={}){const s=Object.assign(j1(),n);this.codec=s.codec;const a={};this.stream=a.name=n.streamName??this.bucketName(),a.retention=kf.Limits,a.max_msgs_per_subject=s.history,s.maxBucketSize&&(s.max_bytes=s.maxBucketSize),s.max_bytes&&(a.max_bytes=s.max_bytes),a.max_msg_size=s.maxValueSize,a.storage=s.storage;const o=n.placementCluster??"";if(o&&(n.placement={},n.placement.cluster=o,n.placement.tags=[]),n.placement&&(a.placement=n.placement),n.republish&&(a.republish=n.republish),n.description&&(a.description=n.description),n.mirror){const w=Object.assign({},n.mirror);w.name.startsWith(Zt)||(w.name=`${Zt}${w.name}`),a.mirror=w,a.mirror_direct=!0}else if(n.sources){const w=n.sources.map(j=>{const z=Object.assign({},j),M=z.name.startsWith(Zt)?z.name.substring(Zt.length):z.name;return z.name.startsWith(Zt)||(z.name=`${Zt}${z.name}`),!j.external&&M!==this.bucket&&(z.subject_transforms=[{src:`$KV.${M}.>`,dest:`$KV.${this.bucket}.>`}]),z});a.sources=w,a.subjects=[this.subjectForBucket()]}else a.subjects=[this.subjectForBucket()];n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?Zs.S2:Zs.None);const f=this.js.nc,h=f.getServerVersion(),d=h?Df(h,Ai("2.7.2"))>=0:!1;a.discard=d?Ua.New:Ua.Old;const{ok:g,min:y}=f.features.get(ze.JS_ALLOW_DIRECT);if(!g&&n.allow_direct===!0){const w=h?`${h.major}.${h.minor}.${h.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${w} - requires ${y}`))}n.allow_direct=typeof n.allow_direct=="boolean"?n.allow_direct:g,a.allow_direct=n.allow_direct,this.direct=a.allow_direct,a.num_replicas=s.replicas,s.ttl&&(a.max_age=nt(s.ttl)),a.allow_rollup_hdrs=!0;let E;try{E=await this.jsm.streams.info(a.name),!E.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(w){if(w.message==="stream not found")E=await this.jsm.streams.add(a);else throw w}this.initializePrefixes(E)}initializePrefixes(n){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:s}=n.config;if(s){let a=s.name;if(a.startsWith(Zt)&&(a=a.substring(Zt.length)),s.external&&s.external.api!==""){const o=s.name.substring(Zt.length);this.useJsPrefix=!1,this.prefix=`$KV.${o}`,this.editPrefix=`${s.external.api}.$KV.${a}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${Zt}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(n,s=!1){const a=[];return s?(this.useJsPrefix&&a.push(this.js.apiPrefix),this.editPrefix!==""?a.push(this.editPrefix):a.push(this.prefix)):this.prefix&&a.push(this.prefix),a.push(n),a.join(".")}fullKeyName(n){return this.prefix!==""?`${this.prefix}.${n}`:`${j0}.${this.bucket}.${n}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(n){const s=[];for(const a of n.split("."))switch(a){case">":case"*":s.push(a);break;default:s.push(this.codec.key.encode(a));break}return s.join(".")}decodeKey(n){const s=[];for(const a of n.split("."))switch(a){case">":case"*":s.push(a);break;default:s.push(this.codec.key.decode(a));break}return s.join(".")}close(){return Promise.resolve()}dataLen(n,s){const a=s&&s.get(Dt.MessageSizeHdr)||"";return a!==""?parseInt(a,10):n.length}smToEntry(n){return new Q1(this.bucket,this.prefixLen,n)}jmToEntry(n){const s=this.decodeKey(n.subject.substring(this.prefixLen));return new I1(this.bucket,s,n)}async create(n,s){var f;let a;try{const h=await this.put(n,s,{previousSeq:0});return Promise.resolve(h)}catch(h){if(a=h,((f=h==null?void 0:h.api_error)==null?void 0:f.err_code)!==10071)return Promise.reject(h)}let o=0;try{const h=await this.get(n);return(h==null?void 0:h.operation)==="DEL"||(h==null?void 0:h.operation)==="PURGE"?(o=h!==null?h.revision:0,this.update(n,s,o)):Promise.reject(a)}catch(h){return Promise.reject(h)}}update(n,s,a){if(a<=0)throw new Error("version must be greater than 0");return this.put(n,s,{previousSeq:a})}async put(n,s,a={}){var h,d;const o=this.encodeKey(n);this.validateKey(o);const f={};if(a.previousSeq!==void 0){const g=fs();f.headers=g,g.set(zn.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(o,!0),s,f)).seq}catch(g){const y=g;return y.isJetStreamError()?(y.message=(h=y.api_error)==null?void 0:h.description,y.code=`${(d=y.api_error)==null?void 0:d.code}`,Promise.reject(y)):Promise.reject(g)}}async get(n,s){const a=this.encodeKey(n);this.validateKey(a);let o={last_by_subj:this.subjectForKey(a)};s&&s.revision>0&&(o={seq:s.revision});let f;try{this.direct?f=await this.jsm.direct.getMessage(this.bucketName(),o):f=await this.jsm.streams.getMessage(this.bucketName(),o);const h=this.smToEntry(f);return h.key!==a?null:h}catch(h){if(h.code===ie.JetStream404NoMessages)return null;throw h}}purge(n,s){return this._deleteOrPurge(n,"PURGE",s)}delete(n,s){return this._deleteOrPurge(n,"DEL",s)}async purgeDeletes(n=1800*1e3){const s=st(),a=[],o=await this.watch({key:">",initializedFn:()=>{s.resolve()}});(async()=>{for await(const g of o)(g.operation==="DEL"||g.operation==="PURGE")&&a.push(g)})().then(),await s,o.stop();const f=Date.now()-n,h=a.map(g=>{const y=this.subjectForKey(g.key);return g.created.getTime()>=f?this.jsm.streams.purge(this.stream,{filter:y,keep:1}):this.jsm.streams.purge(this.stream,{filter:y,keep:0})}),d=await Promise.all(h);return d.unshift({success:!0,purged:0}),d.reduce((g,y)=>(g.purged+=y.purged,g))}async _deleteOrPurge(n,s,a){if(!this.hasWildcards(n))return this._doDeleteOrPurge(n,s,a);const o=await this.keys(n),f=[];for await(const h of o)f.push(this._doDeleteOrPurge(h,s)),f.length===100&&(await Promise.all(f),f.length=0);f.length>0&&await Promise.all(f)}async _doDeleteOrPurge(n,s,a){const o=this.encodeKey(n);this.validateKey(o);const f=fs();f.set(Uo,s),s==="PURGE"&&f.set(Dt.RollupHdr,Dt.RollupValueSubject),a!=null&&a.previousSeq&&f.set(zn.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`),await this.js.publish(this.subjectForKey(o,!0),tn,{headers:f})}_buildCC(n,s,a={}){let f=(Array.isArray(n)?n:[n]).map(g=>{const y=this.encodeKey(g);return this.validateSearchKey(g),this.fullKeyName(y)}),h=ft.LastPerSubject;s===An.AllHistory&&(h=ft.All),s===An.UpdatesOnly&&(h=ft.New);let d;return f.length===1&&(d=f[0],f=void 0),Object.assign({deliver_policy:h,ack_policy:vt.None,filter_subjects:f,filter_subject:d,flow_control:!0,idle_heartbeat:nt(5*1e3)},a)}remove(n){return this.purge(n)}async history(n={}){const s=n.key??">",a=new _t,o={};o.headers_only=n.headers_only||!1;let f;f=()=>{a.stop()};let h=0;const d=this._buildCC(s,An.AllHistory,o),g=d.filter_subject,y=Is(d);y.bindStream(this.stream),y.orderedConsumer(),y.callback((w,j)=>{if(w){a.stop(w);return}if(j){const z=this.jmToEntry(j);a.push(z),a.received++,(f&&h>0&&a.received>=h||j.info.pending===0)&&(a.push(f),f=void 0)}});const E=await this.js.subscribe(g,y);if(f){const{info:{last:w}}=E,j=w.num_pending+w.delivered.consumer_seq;if(j===0||a.received>=j)try{f()}catch(z){a.stop(z)}finally{f=void 0}else h=j}return a._data=E,a.iterClosed.then(()=>{E.unsubscribe()}),E.closed.then(()=>{a.stop()}).catch(w=>{a.stop(w)}),a}canSetWatcherName(){const s=this.js.nc,{ok:a}=s.features.get(ze.JS_NEW_CONSUMER_CREATE_API);return a}async watch(n={}){const s=n.key??">",a=new _t,o={};o.headers_only=n.headers_only||!1;let f=An.LastValue;n.include===An.AllHistory?f=An.AllHistory:n.include===An.UpdatesOnly&&(f=An.UpdatesOnly);const h=n.ignoreDeletes===!0;let d=n.initializedFn,g=0;const y=this._buildCC(s,f,o),E=y.filter_subject,w=Is(y);this.canSetWatcherName()&&w.consumerName(Ks.next()),w.bindStream(this.stream),n.resumeFromRevision&&n.resumeFromRevision>0&&w.startSequence(n.resumeFromRevision),w.orderedConsumer(),w.callback((z,M)=>{if(z){a.stop(z);return}if(M){const B=this.jmToEntry(M);if(h&&B.operation==="DEL")return;a.push(B),a.received++,d&&(g>0&&a.received>=g||M.info.pending===0)&&(a.push(d),d=void 0)}});const j=await this.js.subscribe(E,w);if(d){const{info:{last:z}}=j,M=z.num_pending+z.delivered.consumer_seq;if(M===0||a.received>=M)try{d()}catch(B){a.stop(B)}finally{d=void 0}else g=M}return a._data=j,a.iterClosed.then(()=>{j.unsubscribe()}),j.closed.then(()=>{a.stop()}).catch(z=>{a.stop(z)}),a}async keys(n=">"){const s=new _t,a=this._buildCC(n,An.LastValue,{headers_only:!0}),o=Array.isArray(n)?">":a.filter_subject,f=Is(a);f.bindStream(this.stream),f.orderedConsumer();const h=await this.js.subscribe(o,f);return(async()=>{var g;for await(const y of h){const E=(g=y.headers)==null?void 0:g.get(Uo);if(E!=="DEL"&&E!=="PURGE"){const w=this.decodeKey(y.subject.substring(this.prefixLen));s.push(w)}y.info.pending===0&&h.unsubscribe()}})().then(()=>{s.stop()}).catch(g=>{s.stop(g)}),h.info.last.num_pending===0&&h.unsubscribe(),s}purgeBucket(n){return this.jsm.streams.purge(this.bucketName(),n)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var f;const s=((f=this.js.nc.info)==null?void 0:f.cluster)??"",a=this.bucketName(),o=await this.jsm.streams.info(a);return new Ng(o,s)}}class Ng{constructor(n,s=""){v(this,"si");v(this,"cluster");this.si=n,this.cluster=s}get bucket(){return this.si.config.name.startsWith(Zt)?this.si.config.name.substring(Zt.length):this.si.config.name}get values(){return this.si.state.messages}get history(){return this.si.config.max_msgs_per_subject}get ttl(){return Wf(this.si.config.max_age)}get bucket_location(){return this.cluster}get backingStore(){return this.si.config.storage}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get description(){return this.si.config.description??""}get maxBucketSize(){return this.si.config.max_bytes}get maxValueSize(){return this.si.config.max_msg_size}get max_bytes(){return this.si.config.max_bytes}get placement(){return this.si.config.placement||{cluster:"",tags:[]}}get placementCluster(){var n;return((n=this.si.config.placement)==null?void 0:n.cluster)??""}get republish(){return this.si.config.republish??{src:"",dest:""}}get streamInfo(){return this.si}get size(){return this.si.state.bytes}get metadata(){return this.si.config.metadata??{}}get compression(){return this.si.config.compression?this.si.config.compression!==Zs.None:!1}}const nh="OBJ_",T0="SHA-256=";function D1(r){return Eo(r),`${nh}${r}`}function z1(r){return r.startsWith(nh)?r.substring(4):r}class Bf{constructor(n){v(this,"si");v(this,"backingStore");this.si=n,this.backingStore="JetStream"}get bucket(){return z1(this.si.config.name)}get description(){return this.si.config.description??""}get ttl(){return this.si.config.max_age}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get sealed(){return this.si.config.sealed}get size(){return this.si.state.bytes}get streamInfo(){return this.si}get metadata(){return this.si.config.metadata}get compression(){return this.si.config.compression?this.si.config.compression!==Zs.None:!1}}function yo(r){if(r===void 0)return;const{domain:n}=r;if(n===void 0)return r;const s=Object.assign({},r);if(delete s.domain,n==="")return s;if(s.external)throw new Error("domain and external are both set");return s.external={api:`$JS.${n}.API`},s}var gn;(function(r){r[r.Unset=-1]="Unset",r[r.Consume=0]="Consume",r[r.Fetch=1]="Fetch"})(gn||(gn={}));var qn;(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"})(qn||(qn={}));var wr;(function(r){r.DebugEvent="debug",r.Discard="discard",r.Reset="reset",r.Next="next"})(wr||(wr={}));const N0=Uint8Array.of(43,65,67,75),q1=Uint8Array.of(45,78,65,75),Ea=Uint8Array.of(43,87,80,73),U1=Uint8Array.of(43,78,88,84),B1=Uint8Array.of(43,84,69,82,77),L1=Uint8Array.of(32);function Ha(r,n=5e3){return new n_(r,n)}class yf extends _t{constructor(s,a,o=!1){super();v(this,"consumer");v(this,"opts");v(this,"sub");v(this,"monitor");v(this,"pending");v(this,"inbox");v(this,"refilling");v(this,"pong");v(this,"callback");v(this,"timeout");v(this,"cleanupHandler");v(this,"listeners");v(this,"statusIterator");v(this,"forOrderedConsumer");v(this,"resetHandler");v(this,"abortOnMissingResource");v(this,"bind");v(this,"inBackOff");this.consumer=s;const f=a;this.opts=this.parseOptions(a,o),this.callback=f.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=o,this.timeout=null,this.inbox=us(s.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=f.abort_on_missing_resource===!0,this.bind=f.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:s,max_bytes:a,idle_heartbeat:o,threshold_bytes:f,threshold_messages:h}=this.opts;this.closed().then(g=>{if(this.cleanupHandler)try{this.cleanupHandler(g)}catch{}});const{sub:d}=this;d&&d.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(g,y)=>{var w,j,z,M;if(g){this.stop(g);return}if((w=this.monitor)==null||w.work(),y.subject===this.inbox){if(Cf(y))return;const B=(j=y.headers)==null?void 0:j.code,V=((M=(z=y.headers)==null?void 0:z.description)==null?void 0:M.toLowerCase())||"unknown",{msgsLeft:ne,bytesLeft:ee}=this.parseDiscard(y.headers);if(ne>0||ee>0)this.pending.msgs-=ne,this.pending.bytes-=ee,this.pending.requests--,this.notify(wr.Discard,{msgsLeft:ne,bytesLeft:ee});else if(B===400){this.stop(new ue(V,`${B}`));return}else if(B===409&&V==="consumer deleted"){if(this.notify(qn.ConsumerDeleted,`${B} ${V}`),!this.refilling||this.abortOnMissingResource){const pe=new ue(V,`${B}`);this.stop(pe);return}}else if(B===503){if(this.notify(qn.NoResponders,`${B} No Responders`),!this.refilling||this.abortOnMissingResource){const pe=new ue("no responders",`${B}`);this.stop(pe);return}}else this.notify(wr.DebugEvent,`${B} ${V}`)}else this._push(Ha(y,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=y.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(s&&this.pending.msgs<=h||a&&this.pending.bytes<=f){const B=this.pullOptions();this.pull(B)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),o&&(this.monitor=new th(o,g=>(this.notify(qn.HeartbeatsMissed,g),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var y;const g=this.consumer.api.nc.status();this.statusIterator=g;for await(const E of g)switch(E.type){case cs.Disconnect:(y=this.monitor)==null||y.cancel();break;case cs.Reconnect:this.resetPending().then(w=>{var j;w&&((j=this.monitor)==null||j.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(s){if(!this.callback)super.push(s);else{const a=typeof s=="function"?s:null;try{a?a():this.callback(s)}catch(o){this.stop(o)}}}notify(s,a){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.push({type:s,data:a})})}resetPending(){return this.bind?this.resetPendingNoInfo():this.resetPendingWithInfo()}resetPendingNoInfo(){return this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),Promise.resolve(!0)}async resetPendingWithInfo(){if(this.inBackOff)return!1;let s=0,a=0;const o=Zf([this.opts.expires]);let f=0;for(;;){if(this.done)return!1;if(this.consumer.api.nc.isClosed())return console.error("aborting resetPending - connection is closed"),!1;try{return await this.consumer.info(),this.inBackOff=!1,s=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(h){if(h.message==="stream not found"){if(a++,this.notify(qn.StreamNotFound,a),!this.refilling||this.abortOnMissingResource)return this.stop(h),!1}else if(h.message==="consumer not found"){if(s++,this.notify(qn.ConsumerNotFound,s),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(h),!1;if(this.forOrderedConsumer)return!1}else s=0,a=0;this.inBackOff=!0;const d=o.backoff(f),g=Or(d);await Promise.race([g,this.consumer.api.nc.closed()]),g.cancel(),f++}}}pull(s){this.pending.bytes+=s.max_bytes??0,this.pending.msgs+=s.batch??0,this.pending.requests++;const a=this.consumer.api.nc;this._push(()=>{a.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`,this.consumer.api.jc.encode(s),{reply:this.inbox}),this.notify(wr.Next,s)})}pullOptions(){const s=this.opts.max_messages-this.pending.msgs,a=this.opts.max_bytes-this.pending.bytes,o=nt(this.opts.idle_heartbeat),f=nt(this.opts.expires);return{batch:s,max_bytes:a,idle_heartbeat:o,expires:f}}parseDiscard(s){const a={msgsLeft:0,bytesLeft:0},o=s==null?void 0:s.get(Dt.PendingMessagesHdr);o&&(a.msgsLeft=parseInt(o));const f=s==null?void 0:s.get(Dt.PendingBytesHdr);return f&&(a.bytesLeft=parseInt(f)),a}trackTimeout(s){this.timeout=s}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var s,a;(s=this.monitor)==null||s.cancel(),this.monitor=null,(a=this.timeout)==null||a.cancel(),this.timeout=null}setCleanupHandler(s){this.cleanupHandler=s}stop(s){var a,o;this.done||((a=this.sub)==null||a.unsubscribe(),this.clearTimers(),(o=this.statusIterator)==null||o.stop(),this._push(()=>{super.stop(s),this.listeners.forEach(f=>{f.stop()})}))}parseOptions(s,a=!1){const o=s||{};if(o.max_messages=o.max_messages||0,o.max_bytes=o.max_bytes||0,o.max_messages!==0&&o.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(o.max_messages===0&&(o.max_messages=100),o.expires=o.expires||3e4,o.expires<1e3)throw new Error("expires should be at least 1000ms");if(o.idle_heartbeat=o.idle_heartbeat||o.expires/2,o.idle_heartbeat=o.idle_heartbeat>3e4?3e4:o.idle_heartbeat,a){const f=Math.round(o.max_messages*.75)||1;o.threshold_messages=o.threshold_messages||f;const h=Math.round(o.max_bytes*.75)||1;o.threshold_bytes=o.threshold_bytes||h}return o}status(){const s=new _t;return this.listeners.push(s),Promise.resolve(s)}}class H1 extends _t{constructor(){super();v(this,"src");v(this,"listeners");this.listeners=[]}setSource(s){this.src&&(this.src.resetHandler=void 0,this.src.setCleanupHandler(),this.src.stop()),this.src=s,this.src.setCleanupHandler(a=>{this.stop(a||void 0)}),(async()=>{const a=await this.src.status();for await(const o of a)this.notify(o.type,o.data)})().catch(()=>{})}notify(s,a){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.push({type:s,data:a})})}stop(s){var a;this.done||((a=this.src)==null||a.stop(s),super.stop(s),this.listeners.forEach(o=>{o.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const s=new _t;return this.listeners.push(s),Promise.resolve(s)}}class Lf{constructor(n,s){v(this,"api");v(this,"_info");v(this,"stream");v(this,"name");this.api=n,this._info=s,this.stream=s.stream_name,this.name=s.name}consume(n={max_messages:100,expires:3e4}){return Promise.resolve(new yf(this,n,!0))}fetch(n={max_messages:100,expires:3e4}){const s=new yf(this,n,!1),a=Math.round(s.opts.expires*1.05),o=Sr(a);return s.closed().catch(()=>{}).finally(()=>{o.cancel()}),o.catch(()=>{s.close().catch()}),s.trackTimeout(o),Promise.resolve(s)}next(n={expires:3e4}){const s=st(),a=n;a.max_messages=1;const o=new yf(this,a,!1),f=Math.round(o.opts.expires*1.05);f>=6e4&&(async()=>{for await(const d of await o.status())if(d.type===qn.HeartbeatsMissed&&d.data>=2){s.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const d of o){s.resolve(d);break}})().catch(()=>{});const h=Sr(f);return o.closed().then(d=>{d?s.reject(d):s.resolve(null)}).catch(d=>{s.reject(d)}).finally(()=>{h.cancel()}),h.catch(d=>{s.resolve(null),o.close().catch()}),o.trackTimeout(h),s}delete(){const{stream_name:n,name:s}=this._info;return this.api.delete(n,s)}info(n=!1){if(n)return Promise.resolve(this._info);const{stream_name:s,name:a}=this._info;return this.api.info(s,a).then(o=>(this._info=o,this._info))}}class P1{constructor(n,s,a={}){v(this,"api");v(this,"consumerOpts");v(this,"consumer");v(this,"opts");v(this,"cursor");v(this,"stream");v(this,"namePrefix");v(this,"serial");v(this,"currentConsumer");v(this,"userCallback");v(this,"iter");v(this,"type");v(this,"startSeq");v(this,"maxInitialReset");this.api=n,this.stream=s,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=Ks.next(),typeof a.name_prefix=="string"&&(Yo("name_prefix",a.name_prefix),this.namePrefix=a.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=gn.Unset,this.consumerOpts=a,this.maxInitialReset=30,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(n){this.serial++;const s=`${this.namePrefix}_${this.serial}`;n=n===0?1:n;const a={name:s,deliver_policy:ft.StartSequence,opt_start_seq:n,ack_policy:vt.None,inactive_threshold:nt(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(a.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(a.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(a.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(a.replay_policy=this.consumerOpts.replay_policy),n===this.startSeq+1&&(a.deliver_policy=this.consumerOpts.deliver_policy||ft.StartSequence,(this.consumerOpts.deliver_policy===ft.LastPerSubject||this.consumerOpts.deliver_policy===ft.New||this.consumerOpts.deliver_policy===ft.Last)&&(delete a.opt_start_seq,a.deliver_policy=this.consumerOpts.deliver_policy),a.deliver_policy===ft.LastPerSubject&&typeof a.filter_subjects>"u"&&typeof a.filter_subject>"u"&&(a.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete a.opt_start_seq,a.deliver_policy=ft.StartTime,a.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(a.inactive_threshold=nt(this.consumerOpts.inactive_threshold))),a}async resetConsumer(n=0){var h,d,g,y,E;Ks.next();const s=this.serial===0;(h=this.consumer)==null||h.delete().catch(()=>{}),n=n===0?1:n,this.cursor.deliver_seq=0;const a=this.getConsumerOpts(n);a.max_deliver=1,a.mem_storage=!0;const o=Zf([((d=this.opts)==null?void 0:d.expires)||3e4]);let f;for(let w=0;;w++)try{f=await this.api.add(this.stream,a),(g=this.iter)==null||g.notify(qn.OrderedConsumerRecreated,f.name);break}catch(j){if(j.message==="stream not found"&&((y=this.iter)==null||y.notify(qn.StreamNotFound,w),this.type===gn.Fetch||this.opts.abort_on_missing_resource===!0))return(E=this.iter)==null||E.stop(j),Promise.reject(j);if(s&&w>=this.maxInitialReset)throw j;await Or(o.backoff(w+1))}return f}internalHandler(n){return s=>{var o;if(this.serial!==n)return;const a=s.info.deliverySequence;if(a!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=a,this.cursor.stream_seq=s.info.streamSequence,this.userCallback?this.userCallback(s):(o=this.iter)==null||o.push(s)}}async reset(n={max_messages:100,expires:3e4},s){var g,y;s=s||{};const a=s.fromFetch||!1,o=s.orderedReset||!1;if(this.type===gn.Fetch&&o){(g=this.iter)==null||g.src.stop(),await((y=this.iter)==null?void 0:y.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||o)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||a)&&(this.iter=new H1),this.consumer=new Lf(this.api,this.currentConsumer);const f=n;f.callback=this.internalHandler(this.serial);let h=null;this.type===gn.Fetch&&a?h=await this.consumer.fetch(n):this.type===gn.Consume&&(h=await this.consumer.consume(n));const d=h;d.forOrderedConsumer=!0,d.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(d)}notifyOrderedResetAndReset(){var n;(n=this.iter)==null||n.notify(wr.Reset,""),this.reset(this.opts,{orderedReset:!0})}async consume(n={max_messages:100,expires:3e4}){if(n.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===gn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===gn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:a}=n;return a&&(this.userCallback=a),this.type=gn.Consume,this.opts=n,await this.reset(n),this.iter}async fetch(n={max_messages:100,expires:3e4}){var o;if(n.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===gn.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(((o=this.iter)==null?void 0:o.done)===!1)return Promise.reject(new Error("ordered consumer doesn't support concurrent fetch"));const{callback:a}=n;return a&&(this.userCallback=a),this.type=gn.Fetch,this.opts=n,await this.reset(n,{fromFetch:!0}),this.iter}async next(n={expires:3e4}){const s=n;if(s.bind)return Promise.reject(new Error("bind is not supported"));s.max_messages=1;const a=st();return s.callback=f=>{this.userCallback=null,a.resolve(f)},(await this.fetch(s)).iterClosed.then(f=>{f&&a.reject(f),a.resolve(null)}).catch(f=>{a.reject(f)}),a}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(n=>Promise.resolve(n)).catch(n=>Promise.reject(n)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(n){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):n&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class Hf{constructor(n){v(this,"api");v(this,"notified");this.api=n,this.notified=!1}checkVersion(){const n=this.api.nc.features.get(ze.JS_SIMPLIFICATION);return n.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${n.min} or better`))}getPullConsumerFor(n){if(n.config.deliver_subject!==void 0)throw new Error("push consumer not supported");return new Lf(this.api,n)}async get(n,s={}){return typeof s=="object"?this.ordered(n,s):(await this.checkVersion(),this.api.info(n,s).then(a=>a.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new Lf(this.api,a)).catch(a=>Promise.reject(a)))}async ordered(n,s){await this.checkVersion();const a=this.api;return new sh(a.nc,a.opts).info(n).then(f=>Promise.resolve(new P1(this.api,n,s))).catch(f=>Promise.reject(f))}}class Vo{constructor(n,s){v(this,"api");v(this,"_info");this.api=n,this._info=s}get name(){return this._info.config.name}alternates(){return this.info().then(n=>n.alternates?n.alternates:[])}async best(){if(await this.info(),this._info.alternates){const n=await this.api.info(this._info.alternates[0].name);return new Vo(this.api,n)}else return this}info(n=!1,s){return n?Promise.resolve(this._info):this.api.info(this.name,s).then(a=>(this._info=a,this._info))}getConsumerFromInfo(n){return new Hf(new Do(this.api.nc,this.api.opts)).getPullConsumerFor(n)}getConsumer(n){return new Hf(new Do(this.api.nc,this.api.opts)).get(this.name,n)}getMessage(n){return this.api.getMessage(this.name,n)}deleteMessage(n,s){return this.api.deleteMessage(this.name,n,s)}}class sh extends $a{constructor(n,s){super(n,s)}checkStreamConfigVersions(n){const s=this.nc;if(n.metadata){const{min:o,ok:f}=s.features.get(ze.JS_STREAM_CONSUMER_METADATA);if(!f)throw new Error(`stream 'metadata' requires server ${o}`)}if(n.first_seq){const{min:o,ok:f}=s.features.get(ze.JS_STREAM_FIRST_SEQ);if(!f)throw new Error(`stream 'first_seq' requires server ${o}`)}if(n.subject_transform){const{min:o,ok:f}=s.features.get(ze.JS_STREAM_SUBJECT_TRANSFORM);if(!f)throw new Error(`stream 'subject_transform' requires server ${o}`)}if(n.compression){const{min:o,ok:f}=s.features.get(ze.JS_STREAM_COMPRESSION);if(!f)throw new Error(`stream 'compression' requires server ${o}`)}if(n.consumer_limits){const{min:o,ok:f}=s.features.get(ze.JS_DEFAULT_CONSUMER_LIMITS);if(!f)throw new Error(`stream 'consumer_limits' requires server ${o}`)}function a(o,f){var d;if((((d=f==null?void 0:f.subject_transforms)==null?void 0:d.length)||0)>0){const{min:g,ok:y}=s.features.get(ze.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!y)throw new Error(`${o} 'subject_transforms' requires server ${g}`)}}n.sources&&n.sources.forEach(o=>{a("stream sources",o)}),n.mirror&&a("stream mirror",n.mirror)}async add(n={}){var o;this.checkStreamConfigVersions(n),Mt(n.name),n.mirror=yo(n.mirror),n.sources=(o=n.sources)==null?void 0:o.map(yo);const a=await this._request(`${this.prefix}.STREAM.CREATE.${n.name}`,n);return this._fixInfo(a),a}async delete(n){return Mt(n),(await this._request(`${this.prefix}.STREAM.DELETE.${n}`)).success}async update(n,s={}){var d;if(typeof n=="object"){const g=n;n=g.name,s=g,console.trace("\x1B[33m >> streams.update(config: StreamConfig) api changed to streams.update(name: string, config: StreamUpdateConfig) - this shim will be removed - update your code. \x1B[0m")}this.checkStreamConfigVersions(s),Mt(n);const a=await this.info(n),o=Object.assign(a.config,s);o.mirror=yo(o.mirror),o.sources=(d=o.sources)==null?void 0:d.map(yo);const h=await this._request(`${this.prefix}.STREAM.UPDATE.${n}`,o);return this._fixInfo(h),h}async info(n,s){Mt(n);const a=`${this.prefix}.STREAM.INFO.${n}`;let f=await this._request(a,s),{total:h,limit:d}=f,g=f.state.subjects?Object.getOwnPropertyNames(f.state.subjects).length:1;if(h&&h>g){const y=[f],E=s||{};let w=0;for(;h>g;){w++,E.offset=d*w;const z=await this._request(a,E);h=z.total,y.push(z);const M=Object.getOwnPropertyNames(z.state.subjects).length;if(g+=M,M<d)break}let j={};for(let z=0;z<y.length;z++)f=y[z],f.state.subjects&&(j=Object.assign(j,f.state.subjects));f.offset=0,f.total=0,f.limit=0,f.state.subjects=j}return this._fixInfo(f),f}list(n=""){const s=n!=null&&n.length?{subject:n}:{},a=f=>{const h=f;return h.streams.forEach(d=>{this._fixInfo(d)}),h.streams},o=`${this.prefix}.STREAM.LIST`;return new Na(o,a,this,s)}_fixInfo(n){n.config.sealed=n.config.sealed||!1,n.config.deny_delete=n.config.deny_delete||!1,n.config.deny_purge=n.config.deny_purge||!1,n.config.allow_rollup_hdrs=n.config.allow_rollup_hdrs||!1}async purge(n,s){if(s){const{keep:o,seq:f}=s;if(typeof o=="number"&&typeof f=="number")throw new Error("can specify one of keep or seq")}return Mt(n),await this._request(`${this.prefix}.STREAM.PURGE.${n}`,s)}async deleteMessage(n,s,a=!0){Mt(n);const o={seq:s};return a||(o.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${n}`,o)).success}async getMessage(n,s){Mt(n);const o=await this._request(`${this.prefix}.STREAM.MSG.GET.${n}`,s);return new Cg(o)}find(n){return this.findStream(n)}listKvs(){const n=a=>{var g;const f=a.streams.filter(y=>y.config.name.startsWith(Zt));f.forEach(y=>{this._fixInfo(y)});let h="";return f.length&&(h=((g=this.nc.info)==null?void 0:g.cluster)??""),f.map(y=>new Ng(y,h))},s=`${this.prefix}.STREAM.LIST`;return new Na(s,n,this)}listObjectStores(){const n=a=>{const f=a.streams.filter(d=>d.config.name.startsWith(nh));return f.forEach(d=>{this._fixInfo(d)}),f.map(d=>new Bf(d))},s=`${this.prefix}.STREAM.LIST`;return new Na(s,n,this)}names(n=""){const s=n!=null&&n.length?{subject:n}:{},a=f=>f.streams,o=`${this.prefix}.STREAM.NAMES`;return new Na(o,a,this,s)}async get(n){const s=await this.info(n);return Promise.resolve(new Vo(this,s))}}class $1 extends $a{constructor(n,s){super(n,s)}async getMessage(n,s){Mt(n);let a=s;const{last_by_subj:o}=a;o&&(a=null);const f=a?this.jc.encode(a):tn,h=this.opts.apiPrefix||"$JS.API",d=o?`${h}.DIRECT.GET.${n}.${o}`:`${h}.DIRECT.GET.${n}`,g=await this.nc.request(d,f,{timeout:this.timeout}),y=vr(g);if(y)return Promise.reject(y);const E=new Pf(g);return Promise.resolve(E)}async getBatch(n,s){Mt(n);const o=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${n}`;if(!Array.isArray(s.multi_last)||s.multi_last.length===0)return Promise.reject("multi_last is required");const f=JSON.stringify(s,(g,y)=>g==="up_to_time"&&y instanceof Date?y.toISOString():y),h=new _t,d=await this.nc.requestMany(o,f,{strategy:jn.SentinelMsg});return(async()=>{var w,j,z;let g=!1,y=!1,E;for await(const M of d){if(!g){g=!0;const B=((w=M.headers)==null?void 0:w.code)||0;if(B!==0&&B<200||B>299){E=(j=M.headers)==null?void 0:j.description.toLowerCase();break}if(((z=M.headers)==null?void 0:z.get("Nats-Num-Pending"))===""){y=!0;break}}if(M.data.length===0)break;h.push(new Pf(M))}h.push(()=>{if(y)throw new Error("batch direct get not supported by the server");if(E)throw new Error(`bad request: ${E}`);h.stop()})})(),Promise.resolve(h)}}class Pf{constructor(n){v(this,"data");v(this,"header");if(!n.headers)throw new Error("headers expected");this.data=n.data,this.header=n.headers}get subject(){return this.header.last(yr.Subject)}get seq(){const n=this.header.last(yr.Sequence);return typeof n=="string"?parseInt(n):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(yr.TimeStamp)}get stream(){return this.header.last(yr.Stream)}json(n){return Tn(n).decode(this.data)}string(){return Wt.decode(this.data)}}v(Pf,"jc");class Y1 extends $a{constructor(s,a){super(s,a);v(this,"streams");v(this,"consumers");v(this,"direct");this.streams=new sh(s,a),this.consumers=new Do(s,a),this.direct=new $1(s,a)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const s=new _t;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(a,o)=>{if(a)throw a;try{const f=this.parseJsResponse(o),h=f.type.split("."),d=h[h.length-1];s.push({kind:d,data:f})}catch(f){s.stop(f)}}}),s}}class Cg{constructor(n){v(this,"_header");v(this,"smr");this.smr=n}get subject(){return this.smr.message.subject}get seq(){return this.smr.message.seq}get timestamp(){return this.smr.message.time}get time(){return new Date(Date.parse(this.timestamp))}get data(){return this.smr.message.data?this._parse(this.smr.message.data):tn}get header(){if(!this._header)if(this.smr.message.hdrs){const n=this._parse(this.smr.message.hdrs);this._header=Qs.decode(n)}else this._header=fs();return this._header}_parse(n){const s=atob(n),a=s.length,o=new Uint8Array(a);for(let f=0;f<a;f++)o[f]=s.charCodeAt(f);return o}json(n){return Tn(n).decode(this.data)}string(){return Wt.decode(this.data)}}v(Cg,"jc");class G1{constructor(n){v(this,"api");this.api=n}get(n){return this.api.info(n).then(s=>new Vo(this.api,s))}}class bf{constructor(n){v(this,"info");v(this,"hdrs");this.info=n}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=Qs.fromRecord(this.info.headers||{})),this.hdrs}get options(){return this.info.options}get bucket(){return this.info.bucket}get chunks(){return this.info.chunks}get deleted(){return this.info.deleted??!1}get digest(){return this.info.digest}get mtime(){return this.info.mtime}get nuid(){return this.info.nuid}get size(){return this.info.size}get revision(){return this.info.revision}get metadata(){return this.info.metadata||{}}isLink(){var n,s;return((n=this.info.options)==null?void 0:n.link)!==void 0&&((s=this.info.options)==null?void 0:s.link)!==null}}function C0(r){const n={name:r.name,description:r.description??"",options:r.options,metadata:r.metadata};if(r.headers){const s=r.headers;n.headers=s.toRecord()}return n}function V1(){return new ReadableStream({pull(r){r.enqueue(new Uint8Array(0)),r.close()}})}class za{constructor(n,s,a){v(this,"jsm");v(this,"js");v(this,"stream");v(this,"name");this.name=n,this.jsm=s,this.js=a}_checkNotEmpty(n){return!n||n.length===0?{name:n,error:new Error("name cannot be empty")}:{name:n}}async info(n){const s=await this.rawInfo(n);return s?new bf(s):null}async list(){const n=[],s=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const a of s){if(a===null)break;n.push(a)}return Promise.resolve(n)}async rawInfo(n){const{name:s,error:a}=this._checkNotEmpty(n);if(a)return Promise.reject(a);const o=this._metaSubject(s);try{const f=await this.jsm.streams.getMessage(this.stream,{last_by_subj:o}),d=Tn().decode(f.data);return d.revision=f.seq,d}catch(f){return f.code==="404"?null:Promise.reject(f)}}async _si(n){try{return await this.jsm.streams.info(this.stream,n)}catch(s){return s.code==="404"?null:Promise.reject(s)}}async seal(){let n=await this._si();return n===null?Promise.reject(new Error("object store not found")):(n.config.sealed=!0,n=await this.jsm.streams.update(this.stream,n.config),Promise.resolve(new Bf(n)))}async status(n){const s=await this._si(n);return s===null?Promise.reject(new Error("object store not found")):Promise.resolve(new Bf(s))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(n,s,a){var ae;const o=this.js.getOptions();a=a||{timeout:o.timeout},a.timeout=a.timeout||o.timeout,a.previousRevision=a.previousRevision??void 0;const{timeout:f,previousRevision:h}=a,d=this.js.nc.info,g=(d==null?void 0:d.max_payload)||1024;n=n||{},n.options=n.options||{};let y=((ae=n.options)==null?void 0:ae.max_chunk_size)||128*1024;y=y>g?g:y,n.options.max_chunk_size=y;const E=await this.info(n.name),{name:w,error:j}=this._checkNotEmpty(n.name);if(j)return Promise.reject(j);const z=Ks.next(),M=this._chunkSubject(z),B=this._metaSubject(w),V=Object.assign({bucket:this.name,nuid:z,size:0,chunks:0},C0(n)),ne=st(),ee=[],pe=new Ar;try{const k=s?s.getReader():null,X=x0.create();for(;;){const{done:se,value:W}=k?await k.read():{done:!0,value:void 0};if(se){if(pe.size()>0){const re=pe.drain();X.update(re),V.chunks++,V.size+=re.length,ee.push(this.js.publish(M,re,{timeout:f}))}await Promise.all(ee),ee.length=0,V.mtime=new Date().toISOString();const F=_r.encode(X.digest());V.digest=`${T0}${F}`,V.deleted=!1;const Z=fs();typeof h=="number"&&Z.set(zn.ExpectedLastSubjectSequenceHdr,`${h}`),Z.set(Dt.RollupHdr,Dt.RollupValueSubject);const le=await this.js.publish(B,Tn().encode(V),{headers:Z,timeout:f});if(V.revision=le.seq,E)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${E.nuid}`})}catch{}ne.resolve(new bf(V));break}if(W)for(pe.fill(W);pe.size()>y;){V.chunks++,V.size+=y;const F=pe.drain(n.options.max_chunk_size);X.update(F),ee.push(this.js.publish(M,F,{timeout:f}))}}}catch(k){await this.jsm.streams.purge(this.stream,{filter:M}),ne.reject(k)}return ne}putBlob(n,s,a){function o(f){return new ReadableStream({pull(h){h.enqueue(f),h.close()}})}return s===null&&(s=new Uint8Array(0)),this.put(n,o(s),a)}put(n,s,a){var o;return(o=n==null?void 0:n.options)!=null&&o.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(n,s,a)}async getBlob(n){async function s(f){const h=new Ar,d=f.getReader();for(;;){const{done:g,value:y}=await d.read();if(g)return h.drain();y&&y.length&&h.fill(y)}}const a=await this.get(n);if(a===null)return Promise.resolve(null);const o=await Promise.all([a.error,s(a.data)]);return o[0]?Promise.reject(o[0]):Promise.resolve(o[1])}async get(n){const s=await this.rawInfo(n);if(s===null||s.deleted)return Promise.resolve(null);if(s.options&&s.options.link){const w=s.options.link.name||"";if(w==="")throw new Error("link is a bucket");return(s.options.link.bucket!==this.name?await za.create(this.js,s.options.link.bucket):this).get(w)}if(!s.digest.startsWith(T0))return Promise.reject(new Error(`unknown digest type: ${s.digest}`));const a=Rf(s.digest.substring(8));if(a===null)return Promise.reject(new Error(`unable to parse digest: ${s.digest}`));const o=st(),f={info:new bf(s),error:o};if(s.size===0)return f.data=V1(),o.resolve(null),Promise.resolve(f);let h;const d=Is();d.orderedConsumer();const g=x0.create(),y=`$O.${this.name}.C.${s.nuid}`,E=await this.js.subscribe(y,d);return(async()=>{for await(const w of E)w.data.length>0&&(g.update(w.data),h.enqueue(w.data)),w.info.pending===0&&(Rv(a,g.digest())?h.close():h.error(new Error(`received a corrupt object, digests do not match received: ${s.digest} calculated ${a}`)),E.unsubscribe())})().then(()=>{o.resolve()}).catch(w=>{h.error(w),o.reject(w)}),f.data=new ReadableStream({start(w){h=w},cancel(){E.unsubscribe()}}),f}linkStore(n,s){if(!(s instanceof za))return Promise.reject("bucket required");const a=s,{name:o,error:f}=this._checkNotEmpty(n);if(f)return Promise.reject(f);const h={name:o,options:{link:{bucket:a.name}}};return this._put(h,null)}async link(n,s){const{name:a,error:o}=this._checkNotEmpty(n);if(o)return Promise.reject(o);if(s.deleted)return Promise.reject(new Error("src object is deleted"));if(s.isLink())return Promise.reject(new Error("src object is a link"));const f=await this.rawInfo(n);if(f!==null&&!f.deleted)return Promise.reject(new Error("an object already exists with that name"));const h={bucket:s.bucket,name:s.name},d={name:a,bucket:s.bucket,options:{link:h}};await this.js.publish(this._metaSubject(n),JSON.stringify(d));const g=await this.info(n);return Promise.resolve(g)}async delete(n){const s=await this.rawInfo(n);if(s===null)return Promise.resolve({purged:0,success:!1});s.deleted=!0,s.size=0,s.chunks=0,s.digest="";const a=Tn(),o=fs();return o.set(Dt.RollupHdr,Dt.RollupValueSubject),await this.js.publish(this._metaSubject(s.name),a.encode(s),{headers:o}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(s.nuid)})}async update(n,s={}){const a=await this.rawInfo(n);if(a===null)return Promise.reject(new Error("object not found"));if(a.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));s.name=s.name??a.name;const{name:o,error:f}=this._checkNotEmpty(s.name);if(f)return Promise.reject(f);if(n!==s.name){const g=await this.info(s.name);if(g&&!g.deleted)return Promise.reject(new Error("an object already exists with that name"))}s.name=o;const h=Object.assign({},a,C0(s)),d=await this.js.publish(this._metaSubject(h.name),JSON.stringify(h));return n!==s.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(n)}),Promise.resolve(d)}async watch(n={}){n.includeHistory=n.includeHistory??!1,n.ignoreDeletes=n.ignoreDeletes??!1;let s=!1;const a=new _t,o=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:o})}catch(g){g.code==="404"?(a.push(null),s=!0):a.stop(g)}const f=Tn(),h=Is();h.orderedConsumer(),n.includeHistory?h.deliverLastPerSubject():(s=!0,h.deliverNew()),h.callback((g,y)=>{var E;if(g){a.stop(g);return}if(y!==null){const w=f.decode(y.data);w.deleted&&n.ignoreDeletes===!0||a.push(w),((E=y.info)==null?void 0:E.pending)===0&&!s&&(s=!0,a.push(null))}});const d=await this.js.subscribe(o,h);return a._data=d,a.iterClosed.then(()=>{d.unsubscribe()}),d.closed.then(()=>{a.stop()}).catch(g=>{a.stop(g)}),a}_chunkSubject(n){return`$O.${this.name}.C.${n}`}_metaSubject(n){return`$O.${this.name}.M.${_r.encode(n)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(n={}){try{this.stream=D1(this.name)}catch(o){return Promise.reject(o)}const s=(n==null?void 0:n.ttl)||0;delete n.ttl;const a=Object.assign({max_age:s},n);a.name=this.stream,a.num_replicas=n.replicas??1,a.allow_direct=!0,a.allow_rollup_hdrs=!0,a.discard=Ua.New,a.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],n.placement&&(a.placement=n.placement),n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?Zs.S2:Zs.None);try{await this.jsm.streams.info(a.name)}catch(o){o.message==="stream not found"&&await this.jsm.streams.add(a)}}static async create(n,s,a={}){const o=await n.jetstreamManager(),f=new za(s,o,n);return await f.init(a),Promise.resolve(f)}}class F1{constructor(n){v(this,"js");this.js=n}kv(n,s={}){const a=this.js,{ok:o,min:f}=a.nc.features.get(ze.JS_KV);return o?s.bindOnly?La.bind(this.js,n,s):La.create(this.js,n,s):Promise.reject(new Error(`kv is only supported on servers ${f} or better`))}os(n,s={}){var h;if(typeof((h=crypto==null?void 0:crypto.subtle)==null?void 0:h.digest)!="function")return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));const a=this.js,{ok:o,min:f}=a.nc.features.get(ze.JS_OBJECTSTORE);return o?za.create(this.js,n,s):Promise.reject(new Error(`objectstore is only supported on servers ${f} or better`))}}class ih extends $a{constructor(s,a){super(s,a);v(this,"consumers");v(this,"streams");v(this,"consumerAPI");v(this,"streamAPI");this.consumerAPI=new Do(s,a),this.streamAPI=new sh(s,a),this.consumers=new Hf(this.consumerAPI),this.streams=new G1(this.streamAPI)}jetstreamManager(s){s===void 0&&(s=this.opts.checkAPI);const a=Object.assign({},this.opts,{checkAPI:s});return this.nc.jetstreamManager(a)}get apiPrefix(){return this.prefix}get views(){return new F1(this)}async publish(s,a=tn,o){o=o||{},o.expect=o.expect||{};const f=(o==null?void 0:o.headers)||fs();o&&(o.msgID&&f.set(zn.MsgIdHdr,o.msgID),o.expect.lastMsgID&&f.set(zn.ExpectedLastMsgIdHdr,o.expect.lastMsgID),o.expect.streamName&&f.set(zn.ExpectedStreamHdr,o.expect.streamName),typeof o.expect.lastSequence=="number"&&f.set(zn.ExpectedLastSeqHdr,`${o.expect.lastSequence}`),typeof o.expect.lastSubjectSequence=="number"&&f.set(zn.ExpectedLastSubjectSequenceHdr,`${o.expect.lastSubjectSequence}`));const h=o.timeout||this.timeout,d={};h&&(d.timeout=h),o&&(d.headers=f);let{retries:g,retry_delay:y}=o;g=g||1,y=y||250;let E;for(let j=0;j<g;j++)try{E=await this.nc.request(s,a,d);break}catch(z){if(z.code==="503"&&j+1<g)await Or(y);else throw z}const w=this.parseJsResponse(E);if(w.stream==="")throw ue.errorForCode(ie.JetStreamInvalidAck);return w.duplicate=w.duplicate?w.duplicate:!1,w}async pull(s,a,o=0){Mt(s),xr(a);let f=this.timeout;o>f&&(f=o),o=o<0?0:nt(o);const h={batch:1,no_wait:o===0,expires:o},d=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${a}`,this.jc.encode(h),{noMux:!0,timeout:f}),g=vr(d);if(g)throw g;return Ha(d,this.timeout)}fetch(s,a,o={}){Mt(s),xr(a);let f=null;const h=(o.max_bytes??0)>0;let d=0;const g=h?o.max_bytes:0;let y=null;const E={};if(E.batch=o.batch||1,g){const ee=this.nc.features.get(ze.JS_PULL_MAX_BYTES);if(!ee.ok)throw new Error(`max_bytes is only supported on servers ${ee.min} or better`);E.max_bytes=g}E.no_wait=o.no_wait||!1,E.no_wait&&E.expires&&(E.expires=0);const w=o.expires||0;if(w&&(E.expires=nt(w)),w===0&&E.no_wait===!1)throw new Error("expires or no_wait is required");const j=o.idle_heartbeat||0;j&&(E.idle_heartbeat=nt(j),o.delay_heartbeat===!0&&(E.idle_heartbeat=nt(j*4)));const z=new _t,M=E.batch;let B=0;z.protocolFilterFn=(ee,pe=!1)=>Cf(ee.msg)?(y==null||y.work(),!1):!0,z.dispatchedFn=ee=>{if(ee){if(h&&(d+=ee.data.length),B++,f&&ee.info.pending===0)return;(z.getPending()===1&&ee.info.pending===0||M===B||g>0&&d>=g)&&z.stop()}};const V=us(this.nc.options.inboxPrefix),ne=this.nc.subscribe(V,{max:o.batch,callback:(ee,pe)=>{ee===null&&(ee=vr(pe)),ee!==null?(f&&(f.cancel(),f=null),mv(ee)?z.stop(Mg(ee)===null?void 0:ee):z.stop(ee)):(y==null||y.work(),z.received++,z.push(Ha(pe,this.timeout)))}});return w&&(f=Sr(w),f.catch(()=>{ne.isClosed()||(ne.drain().catch(()=>{}),f=null),y&&y.cancel()})),(async()=>{try{j&&(y=new th(j,ee=>(z.push(()=>{z.err=new ue(`${yn.IdleHeartbeatMissed}: ${ee}`,ie.JetStreamIdleHeartBeat)}),!0)))}catch{}await ne.closed,f!==null&&(f.cancel(),f=null),y&&y.cancel(),z.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${a}`,this.jc.encode(E),{reply:V}),z}async pullSubscribe(s,a=Is()){const o=await this._processOptions(s,a);if(o.ordered)throw new Error("pull subscribers cannot be be ordered");if(o.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const f=o.config.ack_policy;if(f===vt.None||f===vt.All)throw new Error("ack policy for pull consumers must be explicit");const h=this._buildTypedSubscriptionOpts(o),d=new X1(this,o.deliver,h);d.info=o;try{await this._maybeCreateConsumer(o)}catch(g){throw d.unsubscribe(),g}return d}async subscribe(s,a=Is()){const o=await this._processOptions(s,a);if(!o.isBind&&!o.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const f=this._buildTypedSubscriptionOpts(o),h=new kg(this,o.deliver,f);h.info=o;try{await this._maybeCreateConsumer(o)}catch(d){throw h.unsubscribe(),d}return h._maybeSetupHbMonitoring(),h}async _processOptions(s,a=Is()){const o=p0(a)?a.getOpts():a;if(o.isBind=p0(a)?a.isBind:!1,o.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},o.ordered){if(o.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},o.config.ack_policy!==vt.NotSet&&o.config.ack_policy!==vt.None)throw new ue("ordered consumer: ack_policy can only be set to 'none'",ie.ApiError);if(o.config.durable_name&&o.config.durable_name.length>0)throw new ue("ordered consumer: durable_name cannot be set",ie.ApiError);if(o.config.deliver_subject&&o.config.deliver_subject.length>0)throw new ue("ordered consumer: deliver_subject cannot be set",ie.ApiError);if(o.config.max_deliver!==void 0&&o.config.max_deliver>1)throw new ue("ordered consumer: max_deliver cannot be set",ie.ApiError);if(o.config.deliver_group&&o.config.deliver_group.length>0)throw new ue("ordered consumer: deliver_group cannot be set",ie.ApiError);o.config.deliver_subject=us(this.nc.options.inboxPrefix),o.config.ack_policy=vt.None,o.config.max_deliver=1,o.config.flow_control=!0,o.config.idle_heartbeat=o.config.idle_heartbeat||nt(5e3),o.config.ack_wait=nt(1320*60*1e3),o.config.mem_storage=!0,o.config.num_replicas=1}if(o.config.ack_policy===vt.NotSet&&(o.config.ack_policy=vt.All),o.api=this,o.config=o.config||{},o.stream=o.stream?o.stream:await this.findStream(s),o.attached=!1,o.config.durable_name)try{const f=await this.consumerAPI.info(o.stream,o.config.durable_name);if(f){if(f.config.filter_subject&&f.config.filter_subject!==s)throw new Error("subject does not match consumer");const h=o.config.deliver_group??"";if(h===""&&f.push_bound===!0)throw new Error("duplicate subscription");const d=f.config.deliver_group??"";if(h!==d)throw d===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${d}'`);o.last=f,o.config=f.config,o.attached=!0,o.config.durable_name||(o.name=f.name)}}catch(f){if(f.code!=="404")throw f}return!o.attached&&o.config.filter_subject===void 0&&o.config.filter_subjects===void 0&&(o.config.filter_subject=s),o.deliver=o.config.deliver_subject||us(this.nc.options.inboxPrefix),o}_buildTypedSubscriptionOpts(s){const a={};return a.adapter=K1(s.callbackFn===void 0,this.timeout),a.ingestionFilterFn=ih.ingestionFn(s.ordered),a.protocolFilterFn=(o,f=!1)=>{const h=o;return Nf(h.msg)?(f||h.msg.respond(),!1):!0},!s.mack&&s.config.ack_policy!==vt.None&&(a.dispatchedFn=e_),s.callbackFn&&(a.callback=s.callbackFn),a.max=s.max||0,a.queue=s.queue,a}async _maybeCreateConsumer(s){if(s.attached)return;if(s.isBind)throw new Error(`unable to bind - durable consumer ${s.config.durable_name} doesn't exist in ${s.stream}`);s.config=Object.assign({deliver_policy:ft.All,ack_policy:vt.Explicit,ack_wait:nt(30*1e3),replay_policy:Er.Instant},s.config);const a=await this.consumerAPI.add(s.stream,s.config);if(Array.isArray(s.config.filter_subjects&&!Array.isArray(a.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");s.name=a.name,s.config=a.config,s.last=a}static ingestionFn(s){return(a,o)=>{var g;const f=o;if(!a)return{ingest:!1,protocol:!1};const h=a;if(vr(h.msg)||(g=f.monitor)==null||g.work(),Cf(h.msg)){const y=s?f._checkHbOrderConsumer(h.msg):!0;return s||f.info.flow_control.heartbeat_count++,{ingest:y,protocol:!0}}else if(Nf(h.msg))return f.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:s?f._checkOrderedConsumer(a):!0,protocol:!1}}}}class rh{constructor(n){v(this,"options");v(this,"protocol");v(this,"draining");v(this,"listeners");v(this,"_services");this.draining=!1,this.options=p1(n),this.listeners=[]}static connect(n={}){return new Promise((s,a)=>{const o=new rh(n);qo.connect(o.options,o).then(f=>{o.protocol=f,(async function(){for await(const h of f.status())o.listeners.forEach(d=>{d.push(h)})})(),s(o)}).catch(f=>{a(f)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(n,s,a){if(this.isClosed())throw ue.errorForCode(ie.ConnectionClosed);if(s&&this.isDraining()||a&&this.protocol.noMorePublishing)throw ue.errorForCode(ie.ConnectionDraining);if(n=n||"",n.length===0)throw ue.errorForCode(ie.BadSubject)}publish(n,s,a){this._check(n,!1,!0),this.protocol.publish(n,s,a)}publishMessage(n){return this.publish(n.subject,n.data,{reply:n.reply,headers:n.headers})}respondMessage(n){return n.reply?(this.publish(n.reply,n.data,{reply:n.reply,headers:n.headers}),!0):!1}subscribe(n,s={}){this._check(n,!0,!1);const a=new jg(this.protocol,n,s);return this.protocol.subscribe(a),a}_resub(n,s,a){this._check(s,!0,!1);const o=n;o.max=a,a&&(o.max=a+o.received),this.protocol.resub(o,s)}requestMany(n,s=tn,a={maxWait:1e3,maxMessages:-1}){const o=!this.protocol.options.noAsyncTraces;try{this._check(n,!0,!0)}catch(g){return Promise.reject(g)}if(a.strategy=a.strategy||jn.Timer,a.maxWait=a.maxWait||1e3,a.maxWait<1)return Promise.reject(new ue("timeout",ie.InvalidOption));const f=new _t;function h(g){f.push(()=>{f.stop(g)})}function d(g,y){g||y===null?h(g===null?void 0:g):f.push(y)}if(a.noMux){const g=o?new Error().stack:null;let y=typeof a.maxMessages=="number"&&a.maxMessages>0?a.maxMessages:-1;const E=this.subscribe(us(this.options.inboxPrefix),{callback:(M,B)=>{var V,ne;if(((V=B==null?void 0:B.data)==null?void 0:V.length)===0&&((ne=B==null?void 0:B.headers)==null?void 0:ne.status)===ie.NoResponders&&(M=ue.errorForCode(ie.NoResponders)),M){g&&(M.stack+=`
|
|
47
|
+
`),n.max=s)}resub(n,s){!n||this.isClosed()||(this.unsub(n),n.subject=s,this.subscriptions.resub(n),this._sub(n))}flush(n){return n||(n=st()),this.pongs.push(n),this.outbound.fill(w0),this.flushPending(),n}sendSubscriptions(){const n=[];this.subscriptions.all().forEach(s=>{const a=s;a.queue?n.push(`SUB ${a.subject} ${a.queue} ${a.sid}${So}`):n.push(`SUB ${a.subject} ${a.sid}${So}`)}),n.length&&this.transport.send(ka(n.join("")))}async _close(n){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(n),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(s=>{s.stop()}),this._closed=!0,await this.transport.close(n),await this.closed.resolve(n))}close(){return this._close()}isClosed(){return this._closed}drain(){const n=this.subscriptions.all(),s=[];return n.forEach(a=>{s.push(a.drain())}),Promise.all(s).then(async()=>(this.noMorePublishing=!0,await this.flush(),this.close())).catch(()=>{})}flushPending(){if(!(!this.infoReceived||!this.connected)&&this.outbound.size()){const n=this.outbound.drain();this.transport.send(n)}}initMux(){if(!this.subscriptions.getMux()){const s=this.muxSubscriptions.init(this.options.inboxPrefix),a=new Eg(this,`${s}*`);a.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(a),this.subscribe(a)}}selectServer(){const n=this.servers.selectServer();if(n!==void 0)return this.server=n,this.server}getServer(){return this.server}}const j1="$SRV";class S0{constructor(n){v(this,"msg");this.msg=n}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(n,s){return this.msg.respond(n,s)}respondError(n,s,a,o){var f,h;return o=o||{},o.headers=o.headers||fs(),(f=o.headers)==null||f.set(ko,`${n}`),(h=o.headers)==null||h.set(Co,s),this.msg.respond(a,o)}json(n){return this.msg.json(n)}string(){return this.msg.string()}}class Ua{constructor(n,s="",a=""){v(this,"subject");v(this,"queue");v(this,"srv");s!==""&&N1("service group",s);let o="";if(n instanceof $a)this.srv=n,o="";else if(n instanceof Ua){const f=n;this.srv=f.srv,a===""&&f.queue!==""&&(a=f.queue),o=f.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(o,s),this.queue=a}calcSubject(n,s=""){return s===""?n:n!==""?`${n}.${s}`:s}addEndpoint(n="",s){s=s||{subject:n};const a=typeof s=="function"?{handler:s,subject:n}:s;Ta("endpoint",n);let{subject:o,handler:f,metadata:h,queue:d}=a;o=o||n,d=d||this.queue,T1("endpoint subject",o),o=this.calcSubject(this.subject,o);const g={name:n,subject:o,queue:d,handler:f,metadata:h};return this.srv._addEndpoint(g)}addGroup(n="",s=""){return new Ua(this,n,s)}}function T1(r,n){if(n==="")throw new Error(`${r} cannot be empty`);if(n.indexOf(" ")!==-1)throw new Error(`${r} cannot contain spaces: '${n}'`);const s=n.split(".");s.forEach((a,o)=>{if(a===">"&&o!==s.length-1)throw new Error(`${r} cannot have internal '>': '${n}'`)})}function N1(r,n){if(n.indexOf(" ")!==-1)throw new Error(`${r} cannot contain spaces: '${n}'`);n.split(".").forEach(a=>{if(a===">")throw new Error(`${r} name cannot contain internal '>': '${n}'`)})}class $a{constructor(n,s={name:"",version:""}){v(this,"nc");v(this,"_id");v(this,"config");v(this,"handlers");v(this,"internal");v(this,"_stopped");v(this,"_done");v(this,"started");this.nc=n,this.config=Object.assign({},s),this.config.queue||(this.config.queue="q"),Ta("name",this.config.name),Ta("queue",this.config.queue),Ai(this.config.version),this._id=Ks.next(),this.internal=[],this._done=st(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(a=>{this.close(a).catch()})}static controlSubject(n,s="",a="",o){const f=o??j1;return s===""&&a===""?`${f}.${n}`:(Ta("control subject name",s),a!==""?(Ta("control subject id",a),`${f}.${n}.${s}.${a}`):`${f}.${n}.${s}`)}get subjects(){return this.handlers.filter(n=>n.internal===!1).map(n=>n.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(n){const s=fs();if(n instanceof Mo){const a=n;s.set(Co,a.message),s.set(ko,`${a.code}`)}else s.set(Co,n.message),s.set(ko,"500");return s}setupHandler(n,s=!1){const a=s?"":n.queue?n.queue:this.config.queue,{name:o,subject:f,handler:h}=n,d=n;d.internal=s,s&&this.internal.push(d),d.stats=new C1(o,f,a),d.queue=a;const g=h?(y,E)=>{if(y){this.close(y);return}const w=Date.now();try{h(y,new S0(E))}catch(j){d.stats.countError(j),E==null||E.respond(tn,{headers:this.errorToHeader(j)})}finally{d.stats.countLatency(w)}}:void 0;return d.sub=this.nc.subscribe(f,{callback:g,queue:a}),d.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${n.subject} stopped`)).catch()}).catch(y=>{if(!this._stopped){const E=new Error(`required subscription ${n.subject} errored: ${y.message}`);E.stack=y.stack,this.close(E).catch()}}),d}info(){return{type:Ma.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(n=>{const{subject:s,metadata:a,name:o,queue:f}=n;return{subject:s,metadata:a,name:o,queue_group:f}})}async stats(){const n=[];for(const s of this.handlers){if(typeof this.config.statsHandler=="function")try{s.stats.data=await this.config.statsHandler(s)}catch(a){s.stats.countError(a)}n.push(s.stats.stats(s.qi))}return{type:Ma.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:n}}addInternalHandler(n,s){const a=`${n}`.toUpperCase();this._doAddInternalHandler(`${a}-all`,n,s),this._doAddInternalHandler(`${a}-kind`,n,s,this.name),this._doAddInternalHandler(`${a}`,n,s,this.name,this.id)}_doAddInternalHandler(n,s,a,o="",f=""){const h={};h.name=n,h.subject=$a.controlSubject(s,o,f),h.handler=a,this.setupHandler(h,!0)}start(){const n=Tn(),s=(h,d)=>h?(this.close(h),Promise.reject(h)):this.stats().then(g=>(d==null||d.respond(n.encode(g)),Promise.resolve())),a=(h,d)=>h?(this.close(h),Promise.reject(h)):(d==null||d.respond(n.encode(this.info())),Promise.resolve()),o=n.encode(this.ping()),f=(h,d)=>h?(this.close(h).then().catch(),Promise.reject(h)):(d.respond(o),Promise.resolve());return this.addInternalHandler(Js.PING,f),this.addInternalHandler(Js.STATS,s),this.addInternalHandler(Js.INFO,a),this.handlers.forEach(h=>{const{subject:d}=h;typeof d=="string"&&h.handler!==null&&this.setupHandler(h)}),Promise.resolve(this)}close(n){if(this._stopped)return this._done;this._stopped=!0;let s=[];return this.nc.isClosed()||(s=this.handlers.concat(this.internal).map(a=>a.sub.drain())),Promise.allSettled(s).then(()=>{this._done.resolve(n||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(n){return this.close(n)}ping(){return{type:Ma.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const n of this.handlers)n.stats.reset(n.qi)}addGroup(n,s){return new Ua(this,n,s)}addEndpoint(n,s){return new Ua(this).addEndpoint(n,s)}_addEndpoint(n){const s=new _t;s.noIterator=typeof n.handler=="function",s.noIterator||(n.handler=(o,f)=>{o?this.stop(o).catch():s.push(new S0(f))},s.iterClosed.then(()=>{this.close().catch()}));const a=this.setupHandler(n,!1);return a.qi=s,this.handlers.push(a),s}}class C1{constructor(n,s,a=""){v(this,"name");v(this,"subject");v(this,"average_processing_time");v(this,"num_requests");v(this,"processing_time");v(this,"num_errors");v(this,"last_error");v(this,"data");v(this,"metadata");v(this,"queue");this.name=n,this.subject=s,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=a}reset(n){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const s=n;s&&(s.time=0,s.processed=0)}countLatency(n){this.num_requests++,this.processing_time+=nt(Date.now()-n),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(n){this.num_errors++,this.last_error=n.message}_stats(){const{name:n,subject:s,average_processing_time:a,num_errors:o,num_requests:f,processing_time:h,last_error:d,data:g,queue:y}=this;return{name:n,subject:s,average_processing_time:a,num_errors:o,num_requests:f,processing_time:h,last_error:d,data:g,queue_group:y}}stats(n){const s=n;return(s==null?void 0:s.noIterator)===!1&&(this.processing_time=nt(s.time),this.num_requests=s.processed,this.average_processing_time=this.processing_time>0&&this.num_requests>0?this.processing_time/this.num_requests:0),this._stats()}}class k1{constructor(n,s={strategy:jn.JitterTimer,maxWait:2e3},a){v(this,"nc");v(this,"prefix");v(this,"opts");this.nc=n,this.prefix=a,this.opts=s}ping(n="",s=""){return this.q(Js.PING,n,s)}stats(n="",s=""){return this.q(Js.STATS,n,s)}info(n="",s=""){return this.q(Js.INFO,n,s)}async q(n,s="",a=""){const o=new _t,f=Tn(),h=$a.controlSubject(n,s,a,this.prefix),d=await this.nc.requestMany(h,tn,this.opts);return(async()=>{for await(const g of d)try{const y=f.decode(g.data);o.push(y)}catch(y){o.push(()=>{o.stop(y)})}o.push(()=>{o.stop()})})().catch(g=>{o.stop(g)}),o}}function Ag(){return{key:{encode(r){return r},decode(r){return r}},value:{encode(r){return r},decode(r){return r}}}}function M1(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Ag(),storage:Nf.File}}const Uo="KV-Operation",E0="$KV",R1=/^[-/=.\w]+$/,D1=/^[-/=.>*\w]+$/,z1=/^[-\w]+$/;function q1(r){if(r.startsWith(".")||r.endsWith(".")||!R1.test(r))throw new Error(`invalid key: ${r}`)}function U1(r){if(r.startsWith(".")||r.endsWith(".")||!D1.test(r))throw new Error(`invalid key: ${r}`)}function B1(r){if(r.startsWith(".")||r.endsWith("."))throw new Error(`invalid key: ${r}`);const n=r.split(".");let s=!1;for(let a=0;a<n.length;a++)switch(n[a]){case"*":s=!0;break;case">":if(a!==n.length-1)throw new Error(`invalid key: ${r}`);s=!0;break}return s}function Eo(r){if(!z1.test(r))throw new Error(`invalid bucket name: ${r}`)}var zn;(function(r){r.MsgIdHdr="Nats-Msg-Id",r.ExpectedStreamHdr="Nats-Expected-Stream",r.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",r.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",r.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})(zn||(zn={}));class Ba{constructor(n,s,a){v(this,"js");v(this,"jsm");v(this,"stream");v(this,"bucket");v(this,"direct");v(this,"codec");v(this,"prefix");v(this,"editPrefix");v(this,"useJsPrefix");v(this,"_prefixLen");v(this,"validateKey",q1);v(this,"validateSearchKey",U1);v(this,"hasWildcards",B1);Eo(n),this.js=s,this.jsm=a,this.bucket=n,this.prefix=E0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(n,s,a={}){Eo(s);const o=await n.jetstreamManager(),f=new Ba(s,n,o);return await f.init(a),f}static async bind(n,s,a={}){const o=await n.jetstreamManager(),f={config:{allow_direct:a.allow_direct}};Eo(s);const h=new Ba(s,n,o);return f.config.name=a.streamName??h.bucketName(),Object.assign(h,f),h.stream=f.config.name,h.codec=a.codec||Ag(),h.direct=f.config.allow_direct??!1,h.initializePrefixes(f),h}async init(n={}){const s=Object.assign(M1(),n);this.codec=s.codec;const a={};this.stream=a.name=n.streamName??this.bucketName(),a.retention=Tf.Limits,a.max_msgs_per_subject=s.history,s.maxBucketSize&&(s.max_bytes=s.maxBucketSize),s.max_bytes&&(a.max_bytes=s.max_bytes),a.max_msg_size=s.maxValueSize,a.storage=s.storage;const o=n.placementCluster??"";if(o&&(n.placement={},n.placement.cluster=o,n.placement.tags=[]),n.placement&&(a.placement=n.placement),n.republish&&(a.republish=n.republish),n.description&&(a.description=n.description),n.mirror){const w=Object.assign({},n.mirror);w.name.startsWith(Zt)||(w.name=`${Zt}${w.name}`),a.mirror=w,a.mirror_direct=!0}else if(n.sources){const w=n.sources.map(j=>{const z=Object.assign({},j),M=z.name.startsWith(Zt)?z.name.substring(Zt.length):z.name;return z.name.startsWith(Zt)||(z.name=`${Zt}${z.name}`),!j.external&&M!==this.bucket&&(z.subject_transforms=[{src:`$KV.${M}.>`,dest:`$KV.${this.bucket}.>`}]),z});a.sources=w,a.subjects=[this.subjectForBucket()]}else a.subjects=[this.subjectForBucket()];n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?Zs.S2:Zs.None);const f=this.js.nc,h=f.getServerVersion(),d=h?kf(h,Ai("2.7.2"))>=0:!1;a.discard=d?qa.New:qa.Old;const{ok:g,min:y}=f.features.get(ze.JS_ALLOW_DIRECT);if(!g&&n.allow_direct===!0){const w=h?`${h.major}.${h.minor}.${h.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${w} - requires ${y}`))}n.allow_direct=typeof n.allow_direct=="boolean"?n.allow_direct:g,a.allow_direct=n.allow_direct,this.direct=a.allow_direct,a.num_replicas=s.replicas,s.ttl&&(a.max_age=nt(s.ttl)),a.allow_rollup_hdrs=!0;let E;try{E=await this.jsm.streams.info(a.name),!E.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(w){if(w.message==="stream not found")E=await this.jsm.streams.add(a);else throw w}this.initializePrefixes(E)}initializePrefixes(n){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:s}=n.config;if(s){let a=s.name;if(a.startsWith(Zt)&&(a=a.substring(Zt.length)),s.external&&s.external.api!==""){const o=s.name.substring(Zt.length);this.useJsPrefix=!1,this.prefix=`$KV.${o}`,this.editPrefix=`${s.external.api}.$KV.${a}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${Zt}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(n,s=!1){const a=[];return s?(this.useJsPrefix&&a.push(this.js.apiPrefix),this.editPrefix!==""?a.push(this.editPrefix):a.push(this.prefix)):this.prefix&&a.push(this.prefix),a.push(n),a.join(".")}fullKeyName(n){return this.prefix!==""?`${this.prefix}.${n}`:`${E0}.${this.bucket}.${n}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(n){const s=[];for(const a of n.split("."))switch(a){case">":case"*":s.push(a);break;default:s.push(this.codec.key.encode(a));break}return s.join(".")}decodeKey(n){const s=[];for(const a of n.split("."))switch(a){case">":case"*":s.push(a);break;default:s.push(this.codec.key.decode(a));break}return s.join(".")}close(){return Promise.resolve()}dataLen(n,s){const a=s&&s.get(Dt.MessageSizeHdr)||"";return a!==""?parseInt(a,10):n.length}smToEntry(n){return new W1(this.bucket,this.prefixLen,n)}jmToEntry(n){const s=this.decodeKey(n.subject.substring(this.prefixLen));return new e_(this.bucket,s,n)}async create(n,s){var f;let a;try{const h=await this.put(n,s,{previousSeq:0});return Promise.resolve(h)}catch(h){if(a=h,((f=h==null?void 0:h.api_error)==null?void 0:f.err_code)!==10071)return Promise.reject(h)}let o=0;try{const h=await this.get(n);return(h==null?void 0:h.operation)==="DEL"||(h==null?void 0:h.operation)==="PURGE"?(o=h!==null?h.revision:0,this.update(n,s,o)):Promise.reject(a)}catch(h){return Promise.reject(h)}}update(n,s,a){if(a<=0)throw new Error("version must be greater than 0");return this.put(n,s,{previousSeq:a})}async put(n,s,a={}){var h,d;const o=this.encodeKey(n);this.validateKey(o);const f={};if(a.previousSeq!==void 0){const g=fs();f.headers=g,g.set(zn.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(o,!0),s,f)).seq}catch(g){const y=g;return y.isJetStreamError()?(y.message=(h=y.api_error)==null?void 0:h.description,y.code=`${(d=y.api_error)==null?void 0:d.code}`,Promise.reject(y)):Promise.reject(g)}}async get(n,s){const a=this.encodeKey(n);this.validateKey(a);let o={last_by_subj:this.subjectForKey(a)};s&&s.revision>0&&(o={seq:s.revision});let f;try{this.direct?f=await this.jsm.direct.getMessage(this.bucketName(),o):f=await this.jsm.streams.getMessage(this.bucketName(),o);const h=this.smToEntry(f);return h.key!==a?null:h}catch(h){if(h.code===ie.JetStream404NoMessages)return null;throw h}}purge(n,s){return this._deleteOrPurge(n,"PURGE",s)}delete(n,s){return this._deleteOrPurge(n,"DEL",s)}async purgeDeletes(n=1800*1e3){const s=st(),a=[],o=await this.watch({key:">",initializedFn:()=>{s.resolve()}});(async()=>{for await(const g of o)(g.operation==="DEL"||g.operation==="PURGE")&&a.push(g)})().then(),await s,o.stop();const f=Date.now()-n,h=a.map(g=>{const y=this.subjectForKey(g.key);return g.created.getTime()>=f?this.jsm.streams.purge(this.stream,{filter:y,keep:1}):this.jsm.streams.purge(this.stream,{filter:y,keep:0})}),d=await Promise.all(h);return d.unshift({success:!0,purged:0}),d.reduce((g,y)=>(g.purged+=y.purged,g))}async _deleteOrPurge(n,s,a){if(!this.hasWildcards(n))return this._doDeleteOrPurge(n,s,a);const o=await this.keys(n),f=[];for await(const h of o)f.push(this._doDeleteOrPurge(h,s)),f.length===100&&(await Promise.all(f),f.length=0);f.length>0&&await Promise.all(f)}async _doDeleteOrPurge(n,s,a){const o=this.encodeKey(n);this.validateKey(o);const f=fs();f.set(Uo,s),s==="PURGE"&&f.set(Dt.RollupHdr,Dt.RollupValueSubject),a!=null&&a.previousSeq&&f.set(zn.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`),await this.js.publish(this.subjectForKey(o,!0),tn,{headers:f})}_buildCC(n,s,a={}){let f=(Array.isArray(n)?n:[n]).map(g=>{const y=this.encodeKey(g);return this.validateSearchKey(g),this.fullKeyName(y)}),h=ft.LastPerSubject;s===An.AllHistory&&(h=ft.All),s===An.UpdatesOnly&&(h=ft.New);let d;return f.length===1&&(d=f[0],f=void 0),Object.assign({deliver_policy:h,ack_policy:vt.None,filter_subjects:f,filter_subject:d,flow_control:!0,idle_heartbeat:nt(5*1e3)},a)}remove(n){return this.purge(n)}async history(n={}){const s=n.key??">",a=new _t,o={};o.headers_only=n.headers_only||!1;let f;f=()=>{a.stop()};let h=0;const d=this._buildCC(s,An.AllHistory,o),g=d.filter_subject,y=Is(d);y.bindStream(this.stream),y.orderedConsumer(),y.callback((w,j)=>{if(w){a.stop(w);return}if(j){const z=this.jmToEntry(j);a.push(z),a.received++,(f&&h>0&&a.received>=h||j.info.pending===0)&&(a.push(f),f=void 0)}});const E=await this.js.subscribe(g,y);if(f){const{info:{last:w}}=E,j=w.num_pending+w.delivered.consumer_seq;if(j===0||a.received>=j)try{f()}catch(z){a.stop(z)}finally{f=void 0}else h=j}return a._data=E,a.iterClosed.then(()=>{E.unsubscribe()}),E.closed.then(()=>{a.stop()}).catch(w=>{a.stop(w)}),a}canSetWatcherName(){const s=this.js.nc,{ok:a}=s.features.get(ze.JS_NEW_CONSUMER_CREATE_API);return a}async watch(n={}){const s=n.key??">",a=new _t,o={};o.headers_only=n.headers_only||!1;let f=An.LastValue;n.include===An.AllHistory?f=An.AllHistory:n.include===An.UpdatesOnly&&(f=An.UpdatesOnly);const h=n.ignoreDeletes===!0;let d=n.initializedFn,g=0;const y=this._buildCC(s,f,o),E=y.filter_subject,w=Is(y);this.canSetWatcherName()&&w.consumerName(Ks.next()),w.bindStream(this.stream),n.resumeFromRevision&&n.resumeFromRevision>0&&w.startSequence(n.resumeFromRevision),w.orderedConsumer(),w.callback((z,M)=>{if(z){a.stop(z);return}if(M){const B=this.jmToEntry(M);if(h&&B.operation==="DEL")return;a.push(B),a.received++,d&&(g>0&&a.received>=g||M.info.pending===0)&&(a.push(d),d=void 0)}});const j=await this.js.subscribe(E,w);if(d){const{info:{last:z}}=j,M=z.num_pending+z.delivered.consumer_seq;if(M===0||a.received>=M)try{d()}catch(B){a.stop(B)}finally{d=void 0}else g=M}return a._data=j,a.iterClosed.then(()=>{j.unsubscribe()}),j.closed.then(()=>{a.stop()}).catch(z=>{a.stop(z)}),a}async keys(n=">"){const s=new _t,a=this._buildCC(n,An.LastValue,{headers_only:!0}),o=Array.isArray(n)?">":a.filter_subject,f=Is(a);f.bindStream(this.stream),f.orderedConsumer();const h=await this.js.subscribe(o,f);return(async()=>{var g;for await(const y of h){const E=(g=y.headers)==null?void 0:g.get(Uo);if(E!=="DEL"&&E!=="PURGE"){const w=this.decodeKey(y.subject.substring(this.prefixLen));s.push(w)}y.info.pending===0&&h.unsubscribe()}})().then(()=>{s.stop()}).catch(g=>{s.stop(g)}),h.info.last.num_pending===0&&h.unsubscribe(),s}purgeBucket(n){return this.jsm.streams.purge(this.bucketName(),n)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var f;const s=((f=this.js.nc.info)==null?void 0:f.cluster)??"",a=this.bucketName(),o=await this.jsm.streams.info(a);return new Og(o,s)}}class Og{constructor(n,s=""){v(this,"si");v(this,"cluster");this.si=n,this.cluster=s}get bucket(){return this.si.config.name.startsWith(Zt)?this.si.config.name.substring(Zt.length):this.si.config.name}get values(){return this.si.state.messages}get history(){return this.si.config.max_msgs_per_subject}get ttl(){return Xf(this.si.config.max_age)}get bucket_location(){return this.cluster}get backingStore(){return this.si.config.storage}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get description(){return this.si.config.description??""}get maxBucketSize(){return this.si.config.max_bytes}get maxValueSize(){return this.si.config.max_msg_size}get max_bytes(){return this.si.config.max_bytes}get placement(){return this.si.config.placement||{cluster:"",tags:[]}}get placementCluster(){var n;return((n=this.si.config.placement)==null?void 0:n.cluster)??""}get republish(){return this.si.config.republish??{src:"",dest:""}}get streamInfo(){return this.si}get size(){return this.si.state.bytes}get metadata(){return this.si.config.metadata??{}}get compression(){return this.si.config.compression?this.si.config.compression!==Zs.None:!1}}const Wf="OBJ_",A0="SHA-256=";function L1(r){return Eo(r),`${Wf}${r}`}function H1(r){return r.startsWith(Wf)?r.substring(4):r}class zf{constructor(n){v(this,"si");v(this,"backingStore");this.si=n,this.backingStore="JetStream"}get bucket(){return H1(this.si.config.name)}get description(){return this.si.config.description??""}get ttl(){return this.si.config.max_age}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get sealed(){return this.si.config.sealed}get size(){return this.si.state.bytes}get streamInfo(){return this.si}get metadata(){return this.si.config.metadata}get compression(){return this.si.config.compression?this.si.config.compression!==Zs.None:!1}}function yo(r){if(r===void 0)return;const{domain:n}=r;if(n===void 0)return r;const s=Object.assign({},r);if(delete s.domain,n==="")return s;if(s.external)throw new Error("domain and external are both set");return s.external={api:`$JS.${n}.API`},s}var gn;(function(r){r[r.Unset=-1]="Unset",r[r.Consume=0]="Consume",r[r.Fetch=1]="Fetch"})(gn||(gn={}));var qn;(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"})(qn||(qn={}));var wr;(function(r){r.DebugEvent="debug",r.Discard="discard",r.Reset="reset",r.Next="next"})(wr||(wr={}));const O0=Uint8Array.of(43,65,67,75),P1=Uint8Array.of(45,78,65,75),Ea=Uint8Array.of(43,87,80,73),$1=Uint8Array.of(43,78,88,84),Y1=Uint8Array.of(43,84,69,82,77),G1=Uint8Array.of(32);function La(r,n=5e3){return new l_(r,n)}class mf extends _t{constructor(s,a,o=!1){super();v(this,"consumer");v(this,"opts");v(this,"sub");v(this,"monitor");v(this,"pending");v(this,"inbox");v(this,"refilling");v(this,"pong");v(this,"callback");v(this,"timeout");v(this,"cleanupHandler");v(this,"listeners");v(this,"statusIterator");v(this,"forOrderedConsumer");v(this,"resetHandler");v(this,"abortOnMissingResource");v(this,"bind");v(this,"inBackOff");this.consumer=s;const f=a;this.opts=this.parseOptions(a,o),this.callback=f.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=o,this.timeout=null,this.inbox=us(s.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=f.abort_on_missing_resource===!0,this.bind=f.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:s,max_bytes:a,idle_heartbeat:o,threshold_bytes:f,threshold_messages:h}=this.opts;this.closed().then(g=>{if(this.cleanupHandler)try{this.cleanupHandler(g)}catch{}});const{sub:d}=this;d&&d.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(g,y)=>{var w,j,z,M;if(g){this.stop(g);return}if((w=this.monitor)==null||w.work(),y.subject===this.inbox){if(jf(y))return;const B=(j=y.headers)==null?void 0:j.code,V=((M=(z=y.headers)==null?void 0:z.description)==null?void 0:M.toLowerCase())||"unknown",{msgsLeft:ne,bytesLeft:ee}=this.parseDiscard(y.headers);if(ne>0||ee>0)this.pending.msgs-=ne,this.pending.bytes-=ee,this.pending.requests--,this.notify(wr.Discard,{msgsLeft:ne,bytesLeft:ee});else if(B===400){this.stop(new ue(V,`${B}`));return}else if(B===409&&V==="consumer deleted"){if(this.notify(qn.ConsumerDeleted,`${B} ${V}`),!this.refilling||this.abortOnMissingResource){const pe=new ue(V,`${B}`);this.stop(pe);return}}else if(B===503){if(this.notify(qn.NoResponders,`${B} No Responders`),!this.refilling||this.abortOnMissingResource){const pe=new ue("no responders",`${B}`);this.stop(pe);return}}else this.notify(wr.DebugEvent,`${B} ${V}`)}else this._push(La(y,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=y.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(s&&this.pending.msgs<=h||a&&this.pending.bytes<=f){const B=this.pullOptions();this.pull(B)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),o&&(this.monitor=new Zf(o,g=>(this.notify(qn.HeartbeatsMissed,g),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var y;const g=this.consumer.api.nc.status();this.statusIterator=g;for await(const E of g)switch(E.type){case cs.Disconnect:(y=this.monitor)==null||y.cancel();break;case cs.Reconnect:this.resetPending().then(w=>{var j;w&&((j=this.monitor)==null||j.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(s){if(!this.callback)super.push(s);else{const a=typeof s=="function"?s:null;try{a?a():this.callback(s)}catch(o){this.stop(o)}}}notify(s,a){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.push({type:s,data:a})})}resetPending(){return this.bind?this.resetPendingNoInfo():this.resetPendingWithInfo()}resetPendingNoInfo(){return this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),Promise.resolve(!0)}async resetPendingWithInfo(){if(this.inBackOff)return!1;let s=0,a=0;const o=If([this.opts.expires]);let f=0;for(;;){if(this.done)return!1;if(this.consumer.api.nc.isClosed())return console.error("aborting resetPending - connection is closed"),!1;try{return await this.consumer.info(),this.inBackOff=!1,s=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(h){if(h.message==="stream not found"){if(a++,this.notify(qn.StreamNotFound,a),!this.refilling||this.abortOnMissingResource)return this.stop(h),!1}else if(h.message==="consumer not found"){if(s++,this.notify(qn.ConsumerNotFound,s),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(h),!1;if(this.forOrderedConsumer)return!1}else s=0,a=0;this.inBackOff=!0;const d=o.backoff(f),g=Or(d);await Promise.race([g,this.consumer.api.nc.closed()]),g.cancel(),f++}}}pull(s){this.pending.bytes+=s.max_bytes??0,this.pending.msgs+=s.batch??0,this.pending.requests++;const a=this.consumer.api.nc;this._push(()=>{a.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`,this.consumer.api.jc.encode(s),{reply:this.inbox}),this.notify(wr.Next,s)})}pullOptions(){const s=this.opts.max_messages-this.pending.msgs,a=this.opts.max_bytes-this.pending.bytes,o=nt(this.opts.idle_heartbeat),f=nt(this.opts.expires);return{batch:s,max_bytes:a,idle_heartbeat:o,expires:f}}parseDiscard(s){const a={msgsLeft:0,bytesLeft:0},o=s==null?void 0:s.get(Dt.PendingMessagesHdr);o&&(a.msgsLeft=parseInt(o));const f=s==null?void 0:s.get(Dt.PendingBytesHdr);return f&&(a.bytesLeft=parseInt(f)),a}trackTimeout(s){this.timeout=s}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var s,a;(s=this.monitor)==null||s.cancel(),this.monitor=null,(a=this.timeout)==null||a.cancel(),this.timeout=null}setCleanupHandler(s){this.cleanupHandler=s}stop(s){var a,o;this.done||((a=this.sub)==null||a.unsubscribe(),this.clearTimers(),(o=this.statusIterator)==null||o.stop(),this._push(()=>{super.stop(s),this.listeners.forEach(f=>{f.stop()})}))}parseOptions(s,a=!1){const o=s||{};if(o.max_messages=o.max_messages||0,o.max_bytes=o.max_bytes||0,o.max_messages!==0&&o.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(o.max_messages===0&&(o.max_messages=100),o.expires=o.expires||3e4,o.expires<1e3)throw new Error("expires should be at least 1000ms");if(o.idle_heartbeat=o.idle_heartbeat||o.expires/2,o.idle_heartbeat=o.idle_heartbeat>3e4?3e4:o.idle_heartbeat,a){const f=Math.round(o.max_messages*.75)||1;o.threshold_messages=o.threshold_messages||f;const h=Math.round(o.max_bytes*.75)||1;o.threshold_bytes=o.threshold_bytes||h}return o}status(){const s=new _t;return this.listeners.push(s),Promise.resolve(s)}}class V1 extends _t{constructor(){super();v(this,"src");v(this,"listeners");this.listeners=[]}setSource(s){this.src&&(this.src.resetHandler=void 0,this.src.setCleanupHandler(),this.src.stop()),this.src=s,this.src.setCleanupHandler(a=>{this.stop(a||void 0)}),(async()=>{const a=await this.src.status();for await(const o of a)this.notify(o.type,o.data)})().catch(()=>{})}notify(s,a){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.push({type:s,data:a})})}stop(s){var a;this.done||((a=this.src)==null||a.stop(s),super.stop(s),this.listeners.forEach(o=>{o.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const s=new _t;return this.listeners.push(s),Promise.resolve(s)}}class qf{constructor(n,s){v(this,"api");v(this,"_info");v(this,"stream");v(this,"name");this.api=n,this._info=s,this.stream=s.stream_name,this.name=s.name}consume(n={max_messages:100,expires:3e4}){return Promise.resolve(new mf(this,n,!0))}fetch(n={max_messages:100,expires:3e4}){const s=new mf(this,n,!1),a=Math.round(s.opts.expires*1.05),o=Sr(a);return s.closed().catch(()=>{}).finally(()=>{o.cancel()}),o.catch(()=>{s.close().catch()}),s.trackTimeout(o),Promise.resolve(s)}next(n={expires:3e4}){const s=st(),a=n;a.max_messages=1;const o=new mf(this,a,!1),f=Math.round(o.opts.expires*1.05);f>=6e4&&(async()=>{for await(const d of await o.status())if(d.type===qn.HeartbeatsMissed&&d.data>=2){s.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const d of o){s.resolve(d);break}})().catch(()=>{});const h=Sr(f);return o.closed().then(d=>{d?s.reject(d):s.resolve(null)}).catch(d=>{s.reject(d)}).finally(()=>{h.cancel()}),h.catch(d=>{s.resolve(null),o.close().catch()}),o.trackTimeout(h),s}delete(){const{stream_name:n,name:s}=this._info;return this.api.delete(n,s)}info(n=!1){if(n)return Promise.resolve(this._info);const{stream_name:s,name:a}=this._info;return this.api.info(s,a).then(o=>(this._info=o,this._info))}}class F1{constructor(n,s,a={}){v(this,"api");v(this,"consumerOpts");v(this,"consumer");v(this,"opts");v(this,"cursor");v(this,"stream");v(this,"namePrefix");v(this,"serial");v(this,"currentConsumer");v(this,"userCallback");v(this,"iter");v(this,"type");v(this,"startSeq");v(this,"maxInitialReset");this.api=n,this.stream=s,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=Ks.next(),typeof a.name_prefix=="string"&&(Yo("name_prefix",a.name_prefix),this.namePrefix=a.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=gn.Unset,this.consumerOpts=a,this.maxInitialReset=30,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(n){this.serial++;const s=`${this.namePrefix}_${this.serial}`;n=n===0?1:n;const a={name:s,deliver_policy:ft.StartSequence,opt_start_seq:n,ack_policy:vt.None,inactive_threshold:nt(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(a.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(a.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(a.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(a.replay_policy=this.consumerOpts.replay_policy),n===this.startSeq+1&&(a.deliver_policy=this.consumerOpts.deliver_policy||ft.StartSequence,(this.consumerOpts.deliver_policy===ft.LastPerSubject||this.consumerOpts.deliver_policy===ft.New||this.consumerOpts.deliver_policy===ft.Last)&&(delete a.opt_start_seq,a.deliver_policy=this.consumerOpts.deliver_policy),a.deliver_policy===ft.LastPerSubject&&typeof a.filter_subjects>"u"&&typeof a.filter_subject>"u"&&(a.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete a.opt_start_seq,a.deliver_policy=ft.StartTime,a.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(a.inactive_threshold=nt(this.consumerOpts.inactive_threshold))),a}async resetConsumer(n=0){var h,d,g,y,E;Ks.next();const s=this.serial===0;(h=this.consumer)==null||h.delete().catch(()=>{}),n=n===0?1:n,this.cursor.deliver_seq=0;const a=this.getConsumerOpts(n);a.max_deliver=1,a.mem_storage=!0;const o=If([((d=this.opts)==null?void 0:d.expires)||3e4]);let f;for(let w=0;;w++)try{f=await this.api.add(this.stream,a),(g=this.iter)==null||g.notify(qn.OrderedConsumerRecreated,f.name);break}catch(j){if(j.message==="stream not found"&&((y=this.iter)==null||y.notify(qn.StreamNotFound,w),this.type===gn.Fetch||this.opts.abort_on_missing_resource===!0))return(E=this.iter)==null||E.stop(j),Promise.reject(j);if(s&&w>=this.maxInitialReset)throw j;await Or(o.backoff(w+1))}return f}internalHandler(n){return s=>{var o;if(this.serial!==n)return;const a=s.info.deliverySequence;if(a!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=a,this.cursor.stream_seq=s.info.streamSequence,this.userCallback?this.userCallback(s):(o=this.iter)==null||o.push(s)}}async reset(n={max_messages:100,expires:3e4},s){var g,y;s=s||{};const a=s.fromFetch||!1,o=s.orderedReset||!1;if(this.type===gn.Fetch&&o){(g=this.iter)==null||g.src.stop(),await((y=this.iter)==null?void 0:y.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||o)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||a)&&(this.iter=new V1),this.consumer=new qf(this.api,this.currentConsumer);const f=n;f.callback=this.internalHandler(this.serial);let h=null;this.type===gn.Fetch&&a?h=await this.consumer.fetch(n):this.type===gn.Consume&&(h=await this.consumer.consume(n));const d=h;d.forOrderedConsumer=!0,d.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(d)}notifyOrderedResetAndReset(){var n;(n=this.iter)==null||n.notify(wr.Reset,""),this.reset(this.opts,{orderedReset:!0})}async consume(n={max_messages:100,expires:3e4}){if(n.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===gn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===gn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:a}=n;return a&&(this.userCallback=a),this.type=gn.Consume,this.opts=n,await this.reset(n),this.iter}async fetch(n={max_messages:100,expires:3e4}){var o;if(n.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===gn.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(((o=this.iter)==null?void 0:o.done)===!1)return Promise.reject(new Error("ordered consumer doesn't support concurrent fetch"));const{callback:a}=n;return a&&(this.userCallback=a),this.type=gn.Fetch,this.opts=n,await this.reset(n,{fromFetch:!0}),this.iter}async next(n={expires:3e4}){const s=n;if(s.bind)return Promise.reject(new Error("bind is not supported"));s.max_messages=1;const a=st();return s.callback=f=>{this.userCallback=null,a.resolve(f)},(await this.fetch(s)).iterClosed.then(f=>{f&&a.reject(f),a.resolve(null)}).catch(f=>{a.reject(f)}),a}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(n=>Promise.resolve(n)).catch(n=>Promise.reject(n)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(n){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):n&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class Uf{constructor(n){v(this,"api");v(this,"notified");this.api=n,this.notified=!1}checkVersion(){const n=this.api.nc.features.get(ze.JS_SIMPLIFICATION);return n.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${n.min} or better`))}getPullConsumerFor(n){if(n.config.deliver_subject!==void 0)throw new Error("push consumer not supported");return new qf(this.api,n)}async get(n,s={}){return typeof s=="object"?this.ordered(n,s):(await this.checkVersion(),this.api.info(n,s).then(a=>a.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new qf(this.api,a)).catch(a=>Promise.reject(a)))}async ordered(n,s){await this.checkVersion();const a=this.api;return new eh(a.nc,a.opts).info(n).then(f=>Promise.resolve(new F1(this.api,n,s))).catch(f=>Promise.reject(f))}}class Vo{constructor(n,s){v(this,"api");v(this,"_info");this.api=n,this._info=s}get name(){return this._info.config.name}alternates(){return this.info().then(n=>n.alternates?n.alternates:[])}async best(){if(await this.info(),this._info.alternates){const n=await this.api.info(this._info.alternates[0].name);return new Vo(this.api,n)}else return this}info(n=!1,s){return n?Promise.resolve(this._info):this.api.info(this.name,s).then(a=>(this._info=a,this._info))}getConsumerFromInfo(n){return new Uf(new Do(this.api.nc,this.api.opts)).getPullConsumerFor(n)}getConsumer(n){return new Uf(new Do(this.api.nc,this.api.opts)).get(this.name,n)}getMessage(n){return this.api.getMessage(this.name,n)}deleteMessage(n,s){return this.api.deleteMessage(this.name,n,s)}}class eh extends Pa{constructor(n,s){super(n,s)}checkStreamConfigVersions(n){const s=this.nc;if(n.metadata){const{min:o,ok:f}=s.features.get(ze.JS_STREAM_CONSUMER_METADATA);if(!f)throw new Error(`stream 'metadata' requires server ${o}`)}if(n.first_seq){const{min:o,ok:f}=s.features.get(ze.JS_STREAM_FIRST_SEQ);if(!f)throw new Error(`stream 'first_seq' requires server ${o}`)}if(n.subject_transform){const{min:o,ok:f}=s.features.get(ze.JS_STREAM_SUBJECT_TRANSFORM);if(!f)throw new Error(`stream 'subject_transform' requires server ${o}`)}if(n.compression){const{min:o,ok:f}=s.features.get(ze.JS_STREAM_COMPRESSION);if(!f)throw new Error(`stream 'compression' requires server ${o}`)}if(n.consumer_limits){const{min:o,ok:f}=s.features.get(ze.JS_DEFAULT_CONSUMER_LIMITS);if(!f)throw new Error(`stream 'consumer_limits' requires server ${o}`)}function a(o,f){var d;if((((d=f==null?void 0:f.subject_transforms)==null?void 0:d.length)||0)>0){const{min:g,ok:y}=s.features.get(ze.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!y)throw new Error(`${o} 'subject_transforms' requires server ${g}`)}}n.sources&&n.sources.forEach(o=>{a("stream sources",o)}),n.mirror&&a("stream mirror",n.mirror)}async add(n={}){var o;this.checkStreamConfigVersions(n),Mt(n.name),n.mirror=yo(n.mirror),n.sources=(o=n.sources)==null?void 0:o.map(yo);const a=await this._request(`${this.prefix}.STREAM.CREATE.${n.name}`,n);return this._fixInfo(a),a}async delete(n){return Mt(n),(await this._request(`${this.prefix}.STREAM.DELETE.${n}`)).success}async update(n,s={}){var d;if(typeof n=="object"){const g=n;n=g.name,s=g,console.trace("\x1B[33m >> streams.update(config: StreamConfig) api changed to streams.update(name: string, config: StreamUpdateConfig) - this shim will be removed - update your code. \x1B[0m")}this.checkStreamConfigVersions(s),Mt(n);const a=await this.info(n),o=Object.assign(a.config,s);o.mirror=yo(o.mirror),o.sources=(d=o.sources)==null?void 0:d.map(yo);const h=await this._request(`${this.prefix}.STREAM.UPDATE.${n}`,o);return this._fixInfo(h),h}async info(n,s){Mt(n);const a=`${this.prefix}.STREAM.INFO.${n}`;let f=await this._request(a,s),{total:h,limit:d}=f,g=f.state.subjects?Object.getOwnPropertyNames(f.state.subjects).length:1;if(h&&h>g){const y=[f],E=s||{};let w=0;for(;h>g;){w++,E.offset=d*w;const z=await this._request(a,E);h=z.total,y.push(z);const M=Object.getOwnPropertyNames(z.state.subjects).length;if(g+=M,M<d)break}let j={};for(let z=0;z<y.length;z++)f=y[z],f.state.subjects&&(j=Object.assign(j,f.state.subjects));f.offset=0,f.total=0,f.limit=0,f.state.subjects=j}return this._fixInfo(f),f}list(n=""){const s=n!=null&&n.length?{subject:n}:{},a=f=>{const h=f;return h.streams.forEach(d=>{this._fixInfo(d)}),h.streams},o=`${this.prefix}.STREAM.LIST`;return new Na(o,a,this,s)}_fixInfo(n){n.config.sealed=n.config.sealed||!1,n.config.deny_delete=n.config.deny_delete||!1,n.config.deny_purge=n.config.deny_purge||!1,n.config.allow_rollup_hdrs=n.config.allow_rollup_hdrs||!1}async purge(n,s){if(s){const{keep:o,seq:f}=s;if(typeof o=="number"&&typeof f=="number")throw new Error("can specify one of keep or seq")}return Mt(n),await this._request(`${this.prefix}.STREAM.PURGE.${n}`,s)}async deleteMessage(n,s,a=!0){Mt(n);const o={seq:s};return a||(o.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${n}`,o)).success}async getMessage(n,s){Mt(n);const o=await this._request(`${this.prefix}.STREAM.MSG.GET.${n}`,s);return new jg(o)}find(n){return this.findStream(n)}listKvs(){const n=a=>{var g;const f=a.streams.filter(y=>y.config.name.startsWith(Zt));f.forEach(y=>{this._fixInfo(y)});let h="";return f.length&&(h=((g=this.nc.info)==null?void 0:g.cluster)??""),f.map(y=>new Og(y,h))},s=`${this.prefix}.STREAM.LIST`;return new Na(s,n,this)}listObjectStores(){const n=a=>{const f=a.streams.filter(d=>d.config.name.startsWith(Wf));return f.forEach(d=>{this._fixInfo(d)}),f.map(d=>new zf(d))},s=`${this.prefix}.STREAM.LIST`;return new Na(s,n,this)}names(n=""){const s=n!=null&&n.length?{subject:n}:{},a=f=>f.streams,o=`${this.prefix}.STREAM.NAMES`;return new Na(o,a,this,s)}async get(n){const s=await this.info(n);return Promise.resolve(new Vo(this,s))}}class J1 extends Pa{constructor(n,s){super(n,s)}async getMessage(n,s){Mt(n);let a=s;const{last_by_subj:o}=a;o&&(a=null);const f=a?this.jc.encode(a):tn,h=this.opts.apiPrefix||"$JS.API",d=o?`${h}.DIRECT.GET.${n}.${o}`:`${h}.DIRECT.GET.${n}`,g=await this.nc.request(d,f,{timeout:this.timeout}),y=vr(g);if(y)return Promise.reject(y);const E=new Bf(g);return Promise.resolve(E)}async getBatch(n,s){Mt(n);const o=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${n}`;if(!Array.isArray(s.multi_last)||s.multi_last.length===0)return Promise.reject("multi_last is required");const f=JSON.stringify(s,(g,y)=>g==="up_to_time"&&y instanceof Date?y.toISOString():y),h=new _t,d=await this.nc.requestMany(o,f,{strategy:jn.SentinelMsg});return(async()=>{var w,j,z;let g=!1,y=!1,E;for await(const M of d){if(!g){g=!0;const B=((w=M.headers)==null?void 0:w.code)||0;if(B!==0&&B<200||B>299){E=(j=M.headers)==null?void 0:j.description.toLowerCase();break}if(((z=M.headers)==null?void 0:z.get("Nats-Num-Pending"))===""){y=!0;break}}if(M.data.length===0)break;h.push(new Bf(M))}h.push(()=>{if(y)throw new Error("batch direct get not supported by the server");if(E)throw new Error(`bad request: ${E}`);h.stop()})})(),Promise.resolve(h)}}class Bf{constructor(n){v(this,"data");v(this,"header");if(!n.headers)throw new Error("headers expected");this.data=n.data,this.header=n.headers}get subject(){return this.header.last(yr.Subject)}get seq(){const n=this.header.last(yr.Sequence);return typeof n=="string"?parseInt(n):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(yr.TimeStamp)}get stream(){return this.header.last(yr.Stream)}json(n){return Tn(n).decode(this.data)}string(){return Wt.decode(this.data)}}v(Bf,"jc");class Q1 extends Pa{constructor(s,a){super(s,a);v(this,"streams");v(this,"consumers");v(this,"direct");this.streams=new eh(s,a),this.consumers=new Do(s,a),this.direct=new J1(s,a)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const s=new _t;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(a,o)=>{if(a)throw a;try{const f=this.parseJsResponse(o),h=f.type.split("."),d=h[h.length-1];s.push({kind:d,data:f})}catch(f){s.stop(f)}}}),s}}class jg{constructor(n){v(this,"_header");v(this,"smr");this.smr=n}get subject(){return this.smr.message.subject}get seq(){return this.smr.message.seq}get timestamp(){return this.smr.message.time}get time(){return new Date(Date.parse(this.timestamp))}get data(){return this.smr.message.data?this._parse(this.smr.message.data):tn}get header(){if(!this._header)if(this.smr.message.hdrs){const n=this._parse(this.smr.message.hdrs);this._header=Qs.decode(n)}else this._header=fs();return this._header}_parse(n){const s=atob(n),a=s.length,o=new Uint8Array(a);for(let f=0;f<a;f++)o[f]=s.charCodeAt(f);return o}json(n){return Tn(n).decode(this.data)}string(){return Wt.decode(this.data)}}v(jg,"jc");class I1{constructor(n){v(this,"api");this.api=n}get(n){return this.api.info(n).then(s=>new Vo(this.api,s))}}class pf{constructor(n){v(this,"info");v(this,"hdrs");this.info=n}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=Qs.fromRecord(this.info.headers||{})),this.hdrs}get options(){return this.info.options}get bucket(){return this.info.bucket}get chunks(){return this.info.chunks}get deleted(){return this.info.deleted??!1}get digest(){return this.info.digest}get mtime(){return this.info.mtime}get nuid(){return this.info.nuid}get size(){return this.info.size}get revision(){return this.info.revision}get metadata(){return this.info.metadata||{}}isLink(){var n,s;return((n=this.info.options)==null?void 0:n.link)!==void 0&&((s=this.info.options)==null?void 0:s.link)!==null}}function j0(r){const n={name:r.name,description:r.description??"",options:r.options,metadata:r.metadata};if(r.headers){const s=r.headers;n.headers=s.toRecord()}return n}function X1(){return new ReadableStream({pull(r){r.enqueue(new Uint8Array(0)),r.close()}})}class Da{constructor(n,s,a){v(this,"jsm");v(this,"js");v(this,"stream");v(this,"name");this.name=n,this.jsm=s,this.js=a}_checkNotEmpty(n){return!n||n.length===0?{name:n,error:new Error("name cannot be empty")}:{name:n}}async info(n){const s=await this.rawInfo(n);return s?new pf(s):null}async list(){const n=[],s=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const a of s){if(a===null)break;n.push(a)}return Promise.resolve(n)}async rawInfo(n){const{name:s,error:a}=this._checkNotEmpty(n);if(a)return Promise.reject(a);const o=this._metaSubject(s);try{const f=await this.jsm.streams.getMessage(this.stream,{last_by_subj:o}),d=Tn().decode(f.data);return d.revision=f.seq,d}catch(f){return f.code==="404"?null:Promise.reject(f)}}async _si(n){try{return await this.jsm.streams.info(this.stream,n)}catch(s){return s.code==="404"?null:Promise.reject(s)}}async seal(){let n=await this._si();return n===null?Promise.reject(new Error("object store not found")):(n.config.sealed=!0,n=await this.jsm.streams.update(this.stream,n.config),Promise.resolve(new zf(n)))}async status(n){const s=await this._si(n);return s===null?Promise.reject(new Error("object store not found")):Promise.resolve(new zf(s))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(n,s,a){var ae;const o=this.js.getOptions();a=a||{timeout:o.timeout},a.timeout=a.timeout||o.timeout,a.previousRevision=a.previousRevision??void 0;const{timeout:f,previousRevision:h}=a,d=this.js.nc.info,g=(d==null?void 0:d.max_payload)||1024;n=n||{},n.options=n.options||{};let y=((ae=n.options)==null?void 0:ae.max_chunk_size)||128*1024;y=y>g?g:y,n.options.max_chunk_size=y;const E=await this.info(n.name),{name:w,error:j}=this._checkNotEmpty(n.name);if(j)return Promise.reject(j);const z=Ks.next(),M=this._chunkSubject(z),B=this._metaSubject(w),V=Object.assign({bucket:this.name,nuid:z,size:0,chunks:0},j0(n)),ne=st(),ee=[],pe=new Ar;try{const k=s?s.getReader():null,X=g0.create();for(;;){const{done:se,value:W}=k?await k.read():{done:!0,value:void 0};if(se){if(pe.size()>0){const re=pe.drain();X.update(re),V.chunks++,V.size+=re.length,ee.push(this.js.publish(M,re,{timeout:f}))}await Promise.all(ee),ee.length=0,V.mtime=new Date().toISOString();const F=_r.encode(X.digest());V.digest=`${A0}${F}`,V.deleted=!1;const Z=fs();typeof h=="number"&&Z.set(zn.ExpectedLastSubjectSequenceHdr,`${h}`),Z.set(Dt.RollupHdr,Dt.RollupValueSubject);const le=await this.js.publish(B,Tn().encode(V),{headers:Z,timeout:f});if(V.revision=le.seq,E)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${E.nuid}`})}catch{}ne.resolve(new pf(V));break}if(W)for(pe.fill(W);pe.size()>y;){V.chunks++,V.size+=y;const F=pe.drain(n.options.max_chunk_size);X.update(F),ee.push(this.js.publish(M,F,{timeout:f}))}}}catch(k){await this.jsm.streams.purge(this.stream,{filter:M}),ne.reject(k)}return ne}putBlob(n,s,a){function o(f){return new ReadableStream({pull(h){h.enqueue(f),h.close()}})}return s===null&&(s=new Uint8Array(0)),this.put(n,o(s),a)}put(n,s,a){var o;return(o=n==null?void 0:n.options)!=null&&o.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(n,s,a)}async getBlob(n){async function s(f){const h=new Ar,d=f.getReader();for(;;){const{done:g,value:y}=await d.read();if(g)return h.drain();y&&y.length&&h.fill(y)}}const a=await this.get(n);if(a===null)return Promise.resolve(null);const o=await Promise.all([a.error,s(a.data)]);return o[0]?Promise.reject(o[0]):Promise.resolve(o[1])}async get(n){const s=await this.rawInfo(n);if(s===null||s.deleted)return Promise.resolve(null);if(s.options&&s.options.link){const w=s.options.link.name||"";if(w==="")throw new Error("link is a bucket");return(s.options.link.bucket!==this.name?await Da.create(this.js,s.options.link.bucket):this).get(w)}if(!s.digest.startsWith(A0))return Promise.reject(new Error(`unknown digest type: ${s.digest}`));const a=Cf(s.digest.substring(8));if(a===null)return Promise.reject(new Error(`unable to parse digest: ${s.digest}`));const o=st(),f={info:new pf(s),error:o};if(s.size===0)return f.data=X1(),o.resolve(null),Promise.resolve(f);let h;const d=Is();d.orderedConsumer();const g=g0.create(),y=`$O.${this.name}.C.${s.nuid}`,E=await this.js.subscribe(y,d);return(async()=>{for await(const w of E)w.data.length>0&&(g.update(w.data),h.enqueue(w.data)),w.info.pending===0&&(Bv(a,g.digest())?h.close():h.error(new Error(`received a corrupt object, digests do not match received: ${s.digest} calculated ${a}`)),E.unsubscribe())})().then(()=>{o.resolve()}).catch(w=>{h.error(w),o.reject(w)}),f.data=new ReadableStream({start(w){h=w},cancel(){E.unsubscribe()}}),f}linkStore(n,s){if(!(s instanceof Da))return Promise.reject("bucket required");const a=s,{name:o,error:f}=this._checkNotEmpty(n);if(f)return Promise.reject(f);const h={name:o,options:{link:{bucket:a.name}}};return this._put(h,null)}async link(n,s){const{name:a,error:o}=this._checkNotEmpty(n);if(o)return Promise.reject(o);if(s.deleted)return Promise.reject(new Error("src object is deleted"));if(s.isLink())return Promise.reject(new Error("src object is a link"));const f=await this.rawInfo(n);if(f!==null&&!f.deleted)return Promise.reject(new Error("an object already exists with that name"));const h={bucket:s.bucket,name:s.name},d={name:a,bucket:s.bucket,options:{link:h}};await this.js.publish(this._metaSubject(n),JSON.stringify(d));const g=await this.info(n);return Promise.resolve(g)}async delete(n){const s=await this.rawInfo(n);if(s===null)return Promise.resolve({purged:0,success:!1});s.deleted=!0,s.size=0,s.chunks=0,s.digest="";const a=Tn(),o=fs();return o.set(Dt.RollupHdr,Dt.RollupValueSubject),await this.js.publish(this._metaSubject(s.name),a.encode(s),{headers:o}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(s.nuid)})}async update(n,s={}){const a=await this.rawInfo(n);if(a===null)return Promise.reject(new Error("object not found"));if(a.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));s.name=s.name??a.name;const{name:o,error:f}=this._checkNotEmpty(s.name);if(f)return Promise.reject(f);if(n!==s.name){const g=await this.info(s.name);if(g&&!g.deleted)return Promise.reject(new Error("an object already exists with that name"))}s.name=o;const h=Object.assign({},a,j0(s)),d=await this.js.publish(this._metaSubject(h.name),JSON.stringify(h));return n!==s.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(n)}),Promise.resolve(d)}async watch(n={}){n.includeHistory=n.includeHistory??!1,n.ignoreDeletes=n.ignoreDeletes??!1;let s=!1;const a=new _t,o=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:o})}catch(g){g.code==="404"?(a.push(null),s=!0):a.stop(g)}const f=Tn(),h=Is();h.orderedConsumer(),n.includeHistory?h.deliverLastPerSubject():(s=!0,h.deliverNew()),h.callback((g,y)=>{var E;if(g){a.stop(g);return}if(y!==null){const w=f.decode(y.data);w.deleted&&n.ignoreDeletes===!0||a.push(w),((E=y.info)==null?void 0:E.pending)===0&&!s&&(s=!0,a.push(null))}});const d=await this.js.subscribe(o,h);return a._data=d,a.iterClosed.then(()=>{d.unsubscribe()}),d.closed.then(()=>{a.stop()}).catch(g=>{a.stop(g)}),a}_chunkSubject(n){return`$O.${this.name}.C.${n}`}_metaSubject(n){return`$O.${this.name}.M.${_r.encode(n)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(n={}){try{this.stream=L1(this.name)}catch(o){return Promise.reject(o)}const s=(n==null?void 0:n.ttl)||0;delete n.ttl;const a=Object.assign({max_age:s},n);a.name=this.stream,a.num_replicas=n.replicas??1,a.allow_direct=!0,a.allow_rollup_hdrs=!0,a.discard=qa.New,a.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],n.placement&&(a.placement=n.placement),n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?Zs.S2:Zs.None);try{await this.jsm.streams.info(a.name)}catch(o){o.message==="stream not found"&&await this.jsm.streams.add(a)}}static async create(n,s,a={}){const o=await n.jetstreamManager(),f=new Da(s,o,n);return await f.init(a),Promise.resolve(f)}}class K1{constructor(n){v(this,"js");this.js=n}kv(n,s={}){const a=this.js,{ok:o,min:f}=a.nc.features.get(ze.JS_KV);return o?s.bindOnly?Ba.bind(this.js,n,s):Ba.create(this.js,n,s):Promise.reject(new Error(`kv is only supported on servers ${f} or better`))}os(n,s={}){var h;if(typeof((h=crypto==null?void 0:crypto.subtle)==null?void 0:h.digest)!="function")return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));const a=this.js,{ok:o,min:f}=a.nc.features.get(ze.JS_OBJECTSTORE);return o?Da.create(this.js,n,s):Promise.reject(new Error(`objectstore is only supported on servers ${f} or better`))}}class th extends Pa{constructor(s,a){super(s,a);v(this,"consumers");v(this,"streams");v(this,"consumerAPI");v(this,"streamAPI");this.consumerAPI=new Do(s,a),this.streamAPI=new eh(s,a),this.consumers=new Uf(this.consumerAPI),this.streams=new I1(this.streamAPI)}jetstreamManager(s){s===void 0&&(s=this.opts.checkAPI);const a=Object.assign({},this.opts,{checkAPI:s});return this.nc.jetstreamManager(a)}get apiPrefix(){return this.prefix}get views(){return new K1(this)}async publish(s,a=tn,o){o=o||{},o.expect=o.expect||{};const f=(o==null?void 0:o.headers)||fs();o&&(o.msgID&&f.set(zn.MsgIdHdr,o.msgID),o.expect.lastMsgID&&f.set(zn.ExpectedLastMsgIdHdr,o.expect.lastMsgID),o.expect.streamName&&f.set(zn.ExpectedStreamHdr,o.expect.streamName),typeof o.expect.lastSequence=="number"&&f.set(zn.ExpectedLastSeqHdr,`${o.expect.lastSequence}`),typeof o.expect.lastSubjectSequence=="number"&&f.set(zn.ExpectedLastSubjectSequenceHdr,`${o.expect.lastSubjectSequence}`));const h=o.timeout||this.timeout,d={};h&&(d.timeout=h),o&&(d.headers=f);let{retries:g,retry_delay:y}=o;g=g||1,y=y||250;let E;for(let j=0;j<g;j++)try{E=await this.nc.request(s,a,d);break}catch(z){if(z.code==="503"&&j+1<g)await Or(y);else throw z}const w=this.parseJsResponse(E);if(w.stream==="")throw ue.errorForCode(ie.JetStreamInvalidAck);return w.duplicate=w.duplicate?w.duplicate:!1,w}async pull(s,a,o=0){Mt(s),xr(a);let f=this.timeout;o>f&&(f=o),o=o<0?0:nt(o);const h={batch:1,no_wait:o===0,expires:o},d=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${a}`,this.jc.encode(h),{noMux:!0,timeout:f}),g=vr(d);if(g)throw g;return La(d,this.timeout)}fetch(s,a,o={}){Mt(s),xr(a);let f=null;const h=(o.max_bytes??0)>0;let d=0;const g=h?o.max_bytes:0;let y=null;const E={};if(E.batch=o.batch||1,g){const ee=this.nc.features.get(ze.JS_PULL_MAX_BYTES);if(!ee.ok)throw new Error(`max_bytes is only supported on servers ${ee.min} or better`);E.max_bytes=g}E.no_wait=o.no_wait||!1,E.no_wait&&E.expires&&(E.expires=0);const w=o.expires||0;if(w&&(E.expires=nt(w)),w===0&&E.no_wait===!1)throw new Error("expires or no_wait is required");const j=o.idle_heartbeat||0;j&&(E.idle_heartbeat=nt(j),o.delay_heartbeat===!0&&(E.idle_heartbeat=nt(j*4)));const z=new _t,M=E.batch;let B=0;z.protocolFilterFn=(ee,pe=!1)=>jf(ee.msg)?(y==null||y.work(),!1):!0,z.dispatchedFn=ee=>{if(ee){if(h&&(d+=ee.data.length),B++,f&&ee.info.pending===0)return;(z.getPending()===1&&ee.info.pending===0||M===B||g>0&&d>=g)&&z.stop()}};const V=us(this.nc.options.inboxPrefix),ne=this.nc.subscribe(V,{max:o.batch,callback:(ee,pe)=>{ee===null&&(ee=vr(pe)),ee!==null?(f&&(f.cancel(),f=null),xv(ee)?z.stop(Ng(ee)===null?void 0:ee):z.stop(ee)):(y==null||y.work(),z.received++,z.push(La(pe,this.timeout)))}});return w&&(f=Sr(w),f.catch(()=>{ne.isClosed()||(ne.drain().catch(()=>{}),f=null),y&&y.cancel()})),(async()=>{try{j&&(y=new Zf(j,ee=>(z.push(()=>{z.err=new ue(`${yn.IdleHeartbeatMissed}: ${ee}`,ie.JetStreamIdleHeartBeat)}),!0)))}catch{}await ne.closed,f!==null&&(f.cancel(),f=null),y&&y.cancel(),z.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${a}`,this.jc.encode(E),{reply:V}),z}async pullSubscribe(s,a=Is()){const o=await this._processOptions(s,a);if(o.ordered)throw new Error("pull subscribers cannot be be ordered");if(o.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const f=o.config.ack_policy;if(f===vt.None||f===vt.All)throw new Error("ack policy for pull consumers must be explicit");const h=this._buildTypedSubscriptionOpts(o),d=new t_(this,o.deliver,h);d.info=o;try{await this._maybeCreateConsumer(o)}catch(g){throw d.unsubscribe(),g}return d}async subscribe(s,a=Is()){const o=await this._processOptions(s,a);if(!o.isBind&&!o.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const f=this._buildTypedSubscriptionOpts(o),h=new Tg(this,o.deliver,f);h.info=o;try{await this._maybeCreateConsumer(o)}catch(d){throw h.unsubscribe(),d}return h._maybeSetupHbMonitoring(),h}async _processOptions(s,a=Is()){const o=h0(a)?a.getOpts():a;if(o.isBind=h0(a)?a.isBind:!1,o.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},o.ordered){if(o.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},o.config.ack_policy!==vt.NotSet&&o.config.ack_policy!==vt.None)throw new ue("ordered consumer: ack_policy can only be set to 'none'",ie.ApiError);if(o.config.durable_name&&o.config.durable_name.length>0)throw new ue("ordered consumer: durable_name cannot be set",ie.ApiError);if(o.config.deliver_subject&&o.config.deliver_subject.length>0)throw new ue("ordered consumer: deliver_subject cannot be set",ie.ApiError);if(o.config.max_deliver!==void 0&&o.config.max_deliver>1)throw new ue("ordered consumer: max_deliver cannot be set",ie.ApiError);if(o.config.deliver_group&&o.config.deliver_group.length>0)throw new ue("ordered consumer: deliver_group cannot be set",ie.ApiError);o.config.deliver_subject=us(this.nc.options.inboxPrefix),o.config.ack_policy=vt.None,o.config.max_deliver=1,o.config.flow_control=!0,o.config.idle_heartbeat=o.config.idle_heartbeat||nt(5e3),o.config.ack_wait=nt(1320*60*1e3),o.config.mem_storage=!0,o.config.num_replicas=1}if(o.config.ack_policy===vt.NotSet&&(o.config.ack_policy=vt.All),o.api=this,o.config=o.config||{},o.stream=o.stream?o.stream:await this.findStream(s),o.attached=!1,o.config.durable_name)try{const f=await this.consumerAPI.info(o.stream,o.config.durable_name);if(f){if(f.config.filter_subject&&f.config.filter_subject!==s)throw new Error("subject does not match consumer");const h=o.config.deliver_group??"";if(h===""&&f.push_bound===!0)throw new Error("duplicate subscription");const d=f.config.deliver_group??"";if(h!==d)throw d===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${d}'`);o.last=f,o.config=f.config,o.attached=!0,o.config.durable_name||(o.name=f.name)}}catch(f){if(f.code!=="404")throw f}return!o.attached&&o.config.filter_subject===void 0&&o.config.filter_subjects===void 0&&(o.config.filter_subject=s),o.deliver=o.config.deliver_subject||us(this.nc.options.inboxPrefix),o}_buildTypedSubscriptionOpts(s){const a={};return a.adapter=n_(s.callbackFn===void 0,this.timeout),a.ingestionFilterFn=th.ingestionFn(s.ordered),a.protocolFilterFn=(o,f=!1)=>{const h=o;return Of(h.msg)?(f||h.msg.respond(),!1):!0},!s.mack&&s.config.ack_policy!==vt.None&&(a.dispatchedFn=r_),s.callbackFn&&(a.callback=s.callbackFn),a.max=s.max||0,a.queue=s.queue,a}async _maybeCreateConsumer(s){if(s.attached)return;if(s.isBind)throw new Error(`unable to bind - durable consumer ${s.config.durable_name} doesn't exist in ${s.stream}`);s.config=Object.assign({deliver_policy:ft.All,ack_policy:vt.Explicit,ack_wait:nt(30*1e3),replay_policy:Er.Instant},s.config);const a=await this.consumerAPI.add(s.stream,s.config);if(Array.isArray(s.config.filter_subjects&&!Array.isArray(a.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");s.name=a.name,s.config=a.config,s.last=a}static ingestionFn(s){return(a,o)=>{var g;const f=o;if(!a)return{ingest:!1,protocol:!1};const h=a;if(vr(h.msg)||(g=f.monitor)==null||g.work(),jf(h.msg)){const y=s?f._checkHbOrderConsumer(h.msg):!0;return s||f.info.flow_control.heartbeat_count++,{ingest:y,protocol:!0}}else if(Of(h.msg))return f.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:s?f._checkOrderedConsumer(a):!0,protocol:!1}}}}class nh{constructor(n){v(this,"options");v(this,"protocol");v(this,"draining");v(this,"listeners");v(this,"_services");this.draining=!1,this.options=v1(n),this.listeners=[]}static connect(n={}){return new Promise((s,a)=>{const o=new nh(n);qo.connect(o.options,o).then(f=>{o.protocol=f,(async function(){for await(const h of f.status())o.listeners.forEach(d=>{d.push(h)})})(),s(o)}).catch(f=>{a(f)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(n,s,a){if(this.isClosed())throw ue.errorForCode(ie.ConnectionClosed);if(s&&this.isDraining()||a&&this.protocol.noMorePublishing)throw ue.errorForCode(ie.ConnectionDraining);if(n=n||"",n.length===0)throw ue.errorForCode(ie.BadSubject)}publish(n,s,a){this._check(n,!1,!0),this.protocol.publish(n,s,a)}publishMessage(n){return this.publish(n.subject,n.data,{reply:n.reply,headers:n.headers})}respondMessage(n){return n.reply?(this.publish(n.reply,n.data,{reply:n.reply,headers:n.headers}),!0):!1}subscribe(n,s={}){this._check(n,!0,!1);const a=new Eg(this.protocol,n,s);return this.protocol.subscribe(a),a}_resub(n,s,a){this._check(s,!0,!1);const o=n;o.max=a,a&&(o.max=a+o.received),this.protocol.resub(o,s)}requestMany(n,s=tn,a={maxWait:1e3,maxMessages:-1}){const o=!this.protocol.options.noAsyncTraces;try{this._check(n,!0,!0)}catch(g){return Promise.reject(g)}if(a.strategy=a.strategy||jn.Timer,a.maxWait=a.maxWait||1e3,a.maxWait<1)return Promise.reject(new ue("timeout",ie.InvalidOption));const f=new _t;function h(g){f.push(()=>{f.stop(g)})}function d(g,y){g||y===null?h(g===null?void 0:g):f.push(y)}if(a.noMux){const g=o?new Error().stack:null;let y=typeof a.maxMessages=="number"&&a.maxMessages>0?a.maxMessages:-1;const E=this.subscribe(us(this.options.inboxPrefix),{callback:(M,B)=>{var V,ne;if(((V=B==null?void 0:B.data)==null?void 0:V.length)===0&&((ne=B==null?void 0:B.headers)==null?void 0:ne.status)===ie.NoResponders&&(M=ue.errorForCode(ie.NoResponders)),M){g&&(M.stack+=`
|
|
48
48
|
|
|
49
|
-
${g}`),w(M);return}d(null,B),a.strategy===jn.Count&&(y--,y===0&&w()),a.strategy===jn.JitterTimer&&(z(),j=setTimeout(()=>{w()},300)),a.strategy===jn.SentinelMsg&&B&&B.data.length===0&&w()}});E.requestSubject=n,E.closed.then(()=>{h()}).catch(M=>{f.stop(M)});const w=M=>{M&&f.push(()=>{throw M}),z(),E.drain().then(()=>{h()}).catch(B=>{h()})};f.iterClosed.then(()=>{z(),E==null||E.unsubscribe()}).catch(M=>{z(),E==null||E.unsubscribe()});try{this.publish(n,s,{reply:E.getSubject()})}catch(M){w(M)}let j=setTimeout(()=>{w()},a.maxWait);const z=()=>{j&&clearTimeout(j)}}else{const g=a;g.callback=d,f.iterClosed.then(()=>{y.cancel()}).catch(E=>{y.cancel(E)});const y=new
|
|
49
|
+
${g}`),w(M);return}d(null,B),a.strategy===jn.Count&&(y--,y===0&&w()),a.strategy===jn.JitterTimer&&(z(),j=setTimeout(()=>{w()},300)),a.strategy===jn.SentinelMsg&&B&&B.data.length===0&&w()}});E.requestSubject=n,E.closed.then(()=>{h()}).catch(M=>{f.stop(M)});const w=M=>{M&&f.push(()=>{throw M}),z(),E.drain().then(()=>{h()}).catch(B=>{h()})};f.iterClosed.then(()=>{z(),E==null||E.unsubscribe()}).catch(M=>{z(),E==null||E.unsubscribe()});try{this.publish(n,s,{reply:E.getSubject()})}catch(M){w(M)}let j=setTimeout(()=>{w()},a.maxWait);const z=()=>{j&&clearTimeout(j)}}else{const g=a;g.callback=d,f.iterClosed.then(()=>{y.cancel()}).catch(E=>{y.cancel(E)});const y=new Lv(this.protocol.muxSubscriptions,n,g);this.protocol.request(y);try{this.publish(n,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${y.token}`,headers:a.headers})}catch(E){y.cancel(E)}}return Promise.resolve(f)}request(n,s,a={timeout:1e3,noMux:!1}){try{this._check(n,!0,!0)}catch(f){return Promise.reject(f)}const o=!this.protocol.options.noAsyncTraces;if(a.timeout=a.timeout||1e3,a.timeout<1)return Promise.reject(new ue("timeout",ie.InvalidOption));if(!a.noMux&&a.reply)return Promise.reject(new ue("reply can only be used with noMux",ie.InvalidOption));if(a.noMux){const f=a.reply?a.reply:us(this.options.inboxPrefix),h=st(),d=o?new Error:null,g=this.subscribe(f,{max:1,timeout:a.timeout,callback:(y,E)=>{y?(d&&y.code!==ie.Timeout&&(y.stack+=`
|
|
50
50
|
|
|
51
|
-
${d.stack}`),g.unsubscribe(),h.reject(y)):(y=
|
|
51
|
+
${d.stack}`),g.unsubscribe(),h.reject(y)):(y=pg(E),y?(d&&(y.stack+=`
|
|
52
52
|
|
|
53
|
-
${d.stack}`),h.reject(y)):h.resolve(E))}});return g.requestSubject=n,this.protocol.publish(n,s,{reply:f,headers:a.headers}),h}else{const f=new _g(this.protocol.muxSubscriptions,n,a,o);this.protocol.request(f);try{this.publish(n,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${f.token}`,headers:a.headers})}catch(d){f.cancel(d)}const h=Promise.race([f.timer,f.deferred]);return h.catch(()=>{f.cancel()}),h}}flush(){return this.isClosed()?Promise.reject(ue.errorForCode(ie.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(ue.errorForCode(ie.ConnectionClosed)):this.isDraining()?Promise.reject(ue.errorForCode(ie.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const n=this.protocol.getServer();return n?n.listen:""}status(){const n=new _t;return n.iterClosed.then(()=>{const s=this.listeners.indexOf(n);this.listeners.splice(s,1)}),this.listeners.push(n),n}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((s,a)=>s==="time"?new Date(Date.parse(a)):a)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(n={}){const s=new Y1(this,n);if(n.checkAPI!==!1)try{await s.getAccountInfo()}catch(a){const o=a;throw o.code===ie.NoResponders&&(o.code=ie.JetStreamNotEnabled),o}return s}jetstream(n={}){return new ih(this,n)}getServerVersion(){const n=this.info;return n?Ai(n.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw ue.errorForCode(ie.Disconnect);const n=Date.now();return await this.flush(),Date.now()-n}get features(){return this.protocol.features}get services(){return this._services||(this._services=new J1(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(ue.errorForCode(ie.ConnectionClosed)):this.isDraining()?Promise.reject(ue.errorForCode(ie.ConnectionDraining)):this.protocol.reconnect()}}class J1{constructor(n){v(this,"nc");this.nc=n}add(n){try{return new Ya(this.nc,n).start()}catch(s){return Promise.reject(s)}}client(n,s){return new O1(this.nc,n,s)}}class Q1{constructor(n,s,a){v(this,"bucket");v(this,"sm");v(this,"prefixLen");this.bucket=n,this.prefixLen=s,this.sm=a}get key(){return this.sm.subject.substring(this.prefixLen)}get value(){return this.sm.data}get delta(){return 0}get created(){return this.sm.time}get revision(){return this.sm.seq}get operation(){return this.sm.header.get(Uo)||"PUT"}get length(){const n=this.sm.header.get(Dt.MessageSizeHdr)||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class I1{constructor(n,s,a){v(this,"bucket");v(this,"key");v(this,"sm");this.bucket=n,this.key=s,this.sm=a}get value(){return this.sm.data}get created(){return new Date(Wf(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var n;return((n=this.sm.headers)==null?void 0:n.get(Uo))||"PUT"}get delta(){return this.sm.info.pending}get length(){var s;const n=((s=this.sm.headers)==null?void 0:s.get(Dt.MessageSizeHdr))||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class kg extends Bv{constructor(s,a,o){super(s.nc,a,o);v(this,"js");v(this,"monitor");this.js=s,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(s){this.sub.info=s}get info(){return this.sub.info}_resetOrderedConsumer(s){if(this.info===null||this.sub.isClosed())return;const a=us(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,a);const f=this.info;f.config.name=Ks.next(),f.ordered_consumer_sequence.delivery_seq=0,f.flow_control.heartbeat_count=0,f.flow_control.fc_count=0,f.flow_control.consumer_restarts++,f.deliver=a,f.config.deliver_subject=a,f.config.deliver_policy=ft.StartSequence,f.config.opt_start_seq=s;const h={};h.stream_name=this.info.stream,h.config=f.config;const d=`${f.api.prefix}.CONSUMER.CREATE.${f.stream}`;this.js._request(d,h,{retries:-1}).then(g=>{const y=g,E=this.sub.info;E.last=y,this.info.config=y.config,this.info.name=y.name}).catch(g=>{const y=new ue(`unable to recreate ordered consumer ${f.stream} at seq ${s}`,ie.RequestError,g);this.sub.callback(y,{})})}_maybeSetupHbMonitoring(){var a,o;const s=((o=(a=this.info)==null?void 0:a.config)==null?void 0:o.idle_heartbeat)||0;s&&this._setupHbMonitoring(Wf(s))}_setupHbMonitoring(s,a=0){const o={cancelAfter:0,maxOut:2};a&&(o.cancelAfter=a);const f=this.sub,h=d=>{var E,w,j,z;const g=bv(409,`${yn.IdleHeartbeatMissed}: ${d}`,this.sub.subject);if(!((E=this.info)==null?void 0:E.ordered))this.sub.callback(null,g);else{if(!this.js.nc.protocol.connected)return!1;const M=((j=(w=this.info)==null?void 0:w.ordered_consumer_sequence)==null?void 0:j.stream_seq)||0;return this._resetOrderedConsumer(M+1),(z=this.monitor)==null||z.restart(),!1}return!f.noIterator};this.monitor=new th(s,h,o)}_checkHbOrderConsumer(s){const a=s.headers.get(Dt.ConsumerStalledHdr);a!==""&&this.js.nc.publish(a);const o=parseInt(s.headers.get(Dt.LastConsumerSeqHdr),10),f=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,o!==f.delivery_seq&&this._resetOrderedConsumer(f.stream_seq+1),!1}_checkOrderedConsumer(s){const a=this.info.ordered_consumer_sequence,o=s.info.streamSequence,f=s.info.deliverySequence;return f!=a.delivery_seq+1?(this._resetOrderedConsumer(a.stream_seq+1),!1):(a.delivery_seq=f,a.stream_seq=o,!0)}async destroy(){this.isClosed()||await this.drain();const s=this.sub.info,a=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.DELETE.${s.stream}.${a}`;await s.api._request(o)}async consumerInfo(){const s=this.sub.info,a=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.INFO.${s.stream}.${a}`,f=await s.api._request(o);return s.last=f,f}}class X1 extends kg{constructor(n,s,a){super(n,s,a)}pull(n={batch:1}){const{stream:s,config:a,name:o}=this.sub.info,f=a.durable_name??o,h={};if(h.batch=n.batch||1,h.no_wait=n.no_wait||!1,(n.max_bytes??0)>0){const y=this.js.nc.features.get(ze.JS_PULL_MAX_BYTES);if(!y.ok)throw new Error(`max_bytes is only supported on servers ${y.min} or better`);h.max_bytes=n.max_bytes}let d=0;n.expires&&n.expires>0&&(d=n.expires,h.expires=nt(d));let g=0;if(n.idle_heartbeat&&n.idle_heartbeat>0&&(g=n.idle_heartbeat,h.idle_heartbeat=nt(g)),g&&d===0)throw new Error("idle_heartbeat requires expires");if(g>d)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),d&&g&&(this.monitor?this.monitor._change(g,d):this._setupHbMonitoring(g,d));const y=this.info.api,E=`${y.prefix}.CONSUMER.MSG.NEXT.${s}.${f}`,w=this.sub.subject;y.nc.publish(E,y.jc.encode(h),{reply:w})}}}function K1(r,n){return r?W1(n):Z1(n)}function Z1(r){return(n,s)=>n?[n,null]:(n=vr(s),n?[n,null]:[null,Ha(s,r)])}function W1(r){return(n,s)=>{if(n)return[n,null];const a=vr(s);return a!==null?[Mg(a),null]:[null,Ha(s,r)]}}function Mg(r){if(r!==null)switch(r.code){case ie.JetStream404NoMessages:case ie.JetStream408RequestTimeout:return null;case ie.JetStream409:return xv(r)?r:null;default:return r}return null}function e_(r){r&&r.ack()}function t_(r){const n=r.split(".");if(n.length===9&&n.splice(2,0,"_",""),n.length<11||n[0]!=="$JS"||n[1]!=="ACK")throw new Error("not js message");const s={};return s.domain=n[2]==="_"?"":n[2],s.account_hash=n[3],s.stream=n[4],s.consumer=n[5],s.deliveryCount=parseInt(n[6],10),s.redeliveryCount=s.deliveryCount,s.redelivered=s.deliveryCount>1,s.streamSequence=parseInt(n[7],10),s.deliverySequence=parseInt(n[8],10),s.timestampNanos=parseInt(n[9],10),s.pending=parseInt(n[10],10),s}class n_{constructor(n,s){v(this,"msg");v(this,"di");v(this,"didAck");v(this,"timeout");this.msg=n,this.didAck=!1,this.timeout=s}get subject(){return this.msg.subject}get sid(){return this.msg.sid}get data(){return this.msg.data}get headers(){return this.msg.headers}get info(){return this.di||(this.di=t_(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(n){this.didAck||(this.didAck=!this.isWIP(n),this.msg.respond(n))}isWIP(n){return n.length===4&&n[0]===Ea[0]&&n[1]===Ea[1]&&n[2]===Ea[2]&&n[3]===Ea[3]}async ackAck(n){var a;n=n||{},n.timeout=n.timeout||this.timeout;const s=st();if(this.didAck)s.resolve(!1);else if(this.didAck=!0,this.msg.reply){const f=this.msg.publisher,h=!((a=f.options)!=null&&a.noAsyncTraces),d=new _g(f.muxSubscriptions,this.msg.reply,{timeout:n.timeout},h);f.request(d);try{f.publish(this.msg.reply,N0,{reply:`${f.muxSubscriptions.baseInbox}${d.token}`})}catch(g){d.cancel(g)}try{await Promise.race([d.timer,d.deferred]),s.resolve(!0)}catch(g){d.cancel(g),s.reject(g)}}else s.resolve(!1);return s}ack(){this.doAck(N0)}nak(n){let s=q1;n&&(s=Tf().encode(`-NAK ${JSON.stringify({delay:nt(n)})}`)),this.doAck(s)}working(){this.doAck(Ea)}next(n,s={batch:1}){const a={};a.batch=s.batch||1,a.no_wait=s.no_wait||!1,s.expires&&s.expires>0&&(a.expires=nt(s.expires));const o=Tn().encode(a),f=Ar.concat(U1,L1,o),h=n?{reply:n}:void 0;this.msg.respond(f,h)}term(n=""){let s=B1;(n==null?void 0:n.length)>0&&(s=Tf().encode(`+TERM ${n}`)),this.doAck(s)}json(){return this.msg.json()}string(){return this.msg.string()}}const s_="1.30.3",i_="nats.ws";class r_{constructor(){v(this,"version");v(this,"lang");v(this,"closeError");v(this,"connected");v(this,"done");v(this,"socket");v(this,"options");v(this,"socketClosed");v(this,"encrypted");v(this,"peeked");v(this,"yields");v(this,"signal");v(this,"closedNotification");this.version=s_,this.lang=i_,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=st(),this.closedNotification=st()}async connect(n,s){const a=st();if(s.tls)return a.reject(new ue("tls",ie.InvalidOption)),a;this.options=s;const o=n.src;if(s.wsFactory){const{socket:f,encrypted:h}=await s.wsFactory(n.src,s);this.socket=f,this.encrypted=h}else this.encrypted=o.indexOf("wss://")===0,this.socket=new WebSocket(o);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=f=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(f.data)),this.peeked){this.signal.resolve();return}const h=Ar.concat(...this.yields),d=Gv(h);if(d!==""){const g=b1.exec(d);if(!g){s.debug&&console.error("!!!",mo(h)),a.reject(new Error("unexpected response from server"));return}try{const y=JSON.parse(g[1]);g1(y,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),a.resolve()}catch(y){a.reject(y);return}}},this.socket.onclose=f=>{if(this.isDiscarded())return;this.socketClosed=!0;let h;this.done||(f.wasClean||(h=new Error(f.reason)),this._closed(h))},this.socket.onerror=f=>{if(this.isDiscarded())return;const h=f,d=new ue(h.message,ie.Unknown,new Error(h.error));a.reject(d)},a}disconnect(){this._closed(void 0,!0)}async _closed(n,s=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=n,!n)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await Or(100);this.done=!0;try{this.socket.close(n?1002:1e3,n?n.message:void 0)}catch{}s&&this.closedNotification.resolve(n)}}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.isDiscarded())return;this.yields.length===0&&await this.signal;const n=this.yields;this.yields=[];for(let s=0;s<n.length;s++)this.options.debug&&console.info(`> ${mo(n[s])}`),yield n[s];if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=st())}}isEncrypted(){return this.connected&&this.encrypted}send(n){if(!this.isDiscarded())try{this.socket.send(n.buffer),this.options.debug&&console.info(`< ${mo(n)}`);return}catch(s){this.options.debug&&console.error(`!!! ${mo(n)}: ${s}`)}}close(n){return this._closed(n,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var n;this.done=!0;try{(n=this.socket)==null||n.close()}catch{}}}function a_(r,n){/^(.*:\/\/)(.*)/.test(r)||(typeof n=="boolean"?r=`${n===!0?"https":"http"}://${r}`:r=`https://${r}`);let a=new URL(r);const o=a.protocol.toLowerCase();o==="ws:"&&(n=!1),o==="wss:"&&(n=!0),o!=="https:"&&o!=="http"&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2"),a=new URL(`http://${r}`));let f,h;const d=a.hostname,g=a.pathname,y=a.search||"";switch(o){case"http:":case"ws:":case"nats:":h=a.port||"80",f="ws:";break;case"https:":case"wss:":case"tls:":h=a.port||"443",f="wss:";break;default:h=a.port||n===!0?"443":"80",f=n===!0?"wss:":"ws:";break}return`${f}//${d}:${h}${g}${y}`}function l_(r={}){return Lv({defaultPort:443,urlParseFn:a_,factory:()=>new r_}),rh.connect(r)}const o_="ws://localhost:9222",c_="dev_api_secret",u_="lt.events";function Rg(r,n){const s=r.split("."),a=n.split(".");for(let o=0;o<a.length;o++){const f=a[o];if(f===">")return!0;if(o>=s.length||f!=="*"&&f!==s[o])return!1}return s.length===a.length}const Ga=T.createContext({connected:!1,subscribe:()=>()=>{}});function f_(){const{connected:r}=T.useContext(Ga);return{connected:r}}function h_(r,n){const{subscribe:s}=T.useContext(Ga),a=T.useRef(n);a.current=n,T.useEffect(()=>s(r,f=>a.current(f)),[s,r])}const d_=T.createContext({connected:!1,subscribe:()=>()=>{}}),m_=Tf();function p_({children:r,url:n,token:s}){const a=T.useRef(null),o=T.useRef(null),[f,h]=T.useState(!1),d=T.useRef(null),g=T.useRef(new Map),y=T.useCallback((j,z)=>{const M=g.current;return M.has(j)||M.set(j,new Set),M.get(j).add(z),()=>{const B=M.get(j);B&&(B.delete(z),B.size===0&&M.delete(j))}},[]),E=T.useCallback((j,z)=>{for(const[M,B]of g.current)if(Rg(j,M))for(const V of B)try{V(z)}catch{}},[]),w=T.useCallback(async()=>{try{if(a.current)return;const j=await l_({servers:n||o_,token:s||c_,reconnect:!0,maxReconnectAttempts:-1,reconnectTimeWait:2e3});a.current=j,h(!0);const z=j.subscribe("lt.>");o.current=z,(async()=>{for await(const M of z)try{const B=JSON.parse(m_.decode(M.data));E(M.subject,B)}catch{}})(),(async()=>{for await(const M of j.status())M.type==="disconnect"||M.type==="error"?h(!1):M.type==="reconnect"&&h(!0)})()}catch{h(!1),d.current=setTimeout(w,3e3)}},[E]);return T.useEffect(()=>(w(),()=>{d.current&&clearTimeout(d.current),o.current&&o.current.unsubscribe(),a.current&&(a.current.close().catch(()=>{}),a.current=null),h(!1)}),[w]),m.jsx(d_.Provider,{value:{connected:f,subscribe:y},children:m.jsx(Ga.Provider,{value:{connected:f,subscribe:y},children:r})})}const Ln=Object.create(null);Ln.open="0";Ln.close="1";Ln.ping="2";Ln.pong="3";Ln.message="4";Ln.upgrade="5";Ln.noop="6";const Ao=Object.create(null);Object.keys(Ln).forEach(r=>{Ao[Ln[r]]=r});const $f={type:"error",data:"parser error"},Dg=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",zg=typeof ArrayBuffer=="function",qg=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,ah=({type:r,data:n},s,a)=>Dg&&n instanceof Blob?s?a(n):k0(n,a):zg&&(n instanceof ArrayBuffer||qg(n))?s?a(n):k0(new Blob([n]),a):a(Ln[r]+(n||"")),k0=(r,n)=>{const s=new FileReader;return s.onload=function(){const a=s.result.split(",")[1];n("b"+(a||""))},s.readAsDataURL(r)};function M0(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}let xf;function g_(r,n){if(Dg&&r.data instanceof Blob)return r.data.arrayBuffer().then(M0).then(n);if(zg&&(r.data instanceof ArrayBuffer||qg(r.data)))return n(M0(r.data));ah(r,!1,s=>{xf||(xf=new TextEncoder),n(xf.encode(s))})}const R0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ca=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<R0.length;r++)Ca[R0.charCodeAt(r)]=r;const y_=r=>{let n=r.length*.75,s=r.length,a,o=0,f,h,d,g;r[r.length-1]==="="&&(n--,r[r.length-2]==="="&&n--);const y=new ArrayBuffer(n),E=new Uint8Array(y);for(a=0;a<s;a+=4)f=Ca[r.charCodeAt(a)],h=Ca[r.charCodeAt(a+1)],d=Ca[r.charCodeAt(a+2)],g=Ca[r.charCodeAt(a+3)],E[o++]=f<<2|h>>4,E[o++]=(h&15)<<4|d>>2,E[o++]=(d&3)<<6|g&63;return y},b_=typeof ArrayBuffer=="function",lh=(r,n)=>{if(typeof r!="string")return{type:"message",data:Ug(r,n)};const s=r.charAt(0);return s==="b"?{type:"message",data:x_(r.substring(1),n)}:Ao[s]?r.length>1?{type:Ao[s],data:r.substring(1)}:{type:Ao[s]}:$f},x_=(r,n)=>{if(b_){const s=y_(r);return Ug(s,n)}else return{base64:!0,data:r}},Ug=(r,n)=>{switch(n){case"blob":return r instanceof Blob?r:new Blob([r]);case"arraybuffer":default:return r instanceof ArrayBuffer?r:r.buffer}},Bg="",v_=(r,n)=>{const s=r.length,a=new Array(s);let o=0;r.forEach((f,h)=>{ah(f,!1,d=>{a[h]=d,++o===s&&n(a.join(Bg))})})},__=(r,n)=>{const s=r.split(Bg),a=[];for(let o=0;o<s.length;o++){const f=lh(s[o],n);if(a.push(f),f.type==="error")break}return a};function w_(){return new TransformStream({transform(r,n){g_(r,s=>{const a=s.length;let o;if(a<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,a);else if(a<65536){o=new Uint8Array(3);const f=new DataView(o.buffer);f.setUint8(0,126),f.setUint16(1,a)}else{o=new Uint8Array(9);const f=new DataView(o.buffer);f.setUint8(0,127),f.setBigUint64(1,BigInt(a))}r.data&&typeof r.data!="string"&&(o[0]|=128),n.enqueue(o),n.enqueue(s)})}})}let vf;function bo(r){return r.reduce((n,s)=>n+s.length,0)}function xo(r,n){if(r[0].length===n)return r.shift();const s=new Uint8Array(n);let a=0;for(let o=0;o<n;o++)s[o]=r[0][a++],a===r[0].length&&(r.shift(),a=0);return r.length&&a<r[0].length&&(r[0]=r[0].slice(a)),s}function S_(r,n){vf||(vf=new TextDecoder);const s=[];let a=0,o=-1,f=!1;return new TransformStream({transform(h,d){for(s.push(h);;){if(a===0){if(bo(s)<1)break;const g=xo(s,1);f=(g[0]&128)===128,o=g[0]&127,o<126?a=3:o===126?a=1:a=2}else if(a===1){if(bo(s)<2)break;const g=xo(s,2);o=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),a=3}else if(a===2){if(bo(s)<8)break;const g=xo(s,8),y=new DataView(g.buffer,g.byteOffset,g.length),E=y.getUint32(0);if(E>Math.pow(2,21)-1){d.enqueue($f);break}o=E*Math.pow(2,32)+y.getUint32(4),a=3}else{if(bo(s)<o)break;const g=xo(s,o);d.enqueue(lh(f?g:vf.decode(g),n)),a=0}if(o===0||o>r){d.enqueue($f);break}}}})}const Lg=4;function gt(r){if(r)return E_(r)}function E_(r){for(var n in gt.prototype)r[n]=gt.prototype[n];return r}gt.prototype.on=gt.prototype.addEventListener=function(r,n){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(n),this};gt.prototype.once=function(r,n){function s(){this.off(r,s),n.apply(this,arguments)}return s.fn=n,this.on(r,s),this};gt.prototype.off=gt.prototype.removeListener=gt.prototype.removeAllListeners=gt.prototype.removeEventListener=function(r,n){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var s=this._callbacks["$"+r];if(!s)return this;if(arguments.length==1)return delete this._callbacks["$"+r],this;for(var a,o=0;o<s.length;o++)if(a=s[o],a===n||a.fn===n){s.splice(o,1);break}return s.length===0&&delete this._callbacks["$"+r],this};gt.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var n=new Array(arguments.length-1),s=this._callbacks["$"+r],a=1;a<arguments.length;a++)n[a-1]=arguments[a];if(s){s=s.slice(0);for(var a=0,o=s.length;a<o;++a)s[a].apply(this,n)}return this};gt.prototype.emitReserved=gt.prototype.emit;gt.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]};gt.prototype.hasListeners=function(r){return!!this.listeners(r).length};const Fo=typeof Promise=="function"&&typeof Promise.resolve=="function"?n=>Promise.resolve().then(n):(n,s)=>s(n,0),bn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),A_="arraybuffer";function Hg(r,...n){return n.reduce((s,a)=>(r.hasOwnProperty(a)&&(s[a]=r[a]),s),{})}const O_=bn.setTimeout,j_=bn.clearTimeout;function Jo(r,n){n.useNativeTimers?(r.setTimeoutFn=O_.bind(bn),r.clearTimeoutFn=j_.bind(bn)):(r.setTimeoutFn=bn.setTimeout.bind(bn),r.clearTimeoutFn=bn.clearTimeout.bind(bn))}const T_=1.33;function N_(r){return typeof r=="string"?C_(r):Math.ceil((r.byteLength||r.size)*T_)}function C_(r){let n=0,s=0;for(let a=0,o=r.length;a<o;a++)n=r.charCodeAt(a),n<128?s+=1:n<2048?s+=2:n<55296||n>=57344?s+=3:(a++,s+=4);return s}function Pg(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function k_(r){let n="";for(let s in r)r.hasOwnProperty(s)&&(n.length&&(n+="&"),n+=encodeURIComponent(s)+"="+encodeURIComponent(r[s]));return n}function M_(r){let n={},s=r.split("&");for(let a=0,o=s.length;a<o;a++){let f=s[a].split("=");n[decodeURIComponent(f[0])]=decodeURIComponent(f[1])}return n}class R_ extends Error{constructor(n,s,a){super(n),this.description=s,this.context=a,this.type="TransportError"}}class oh extends gt{constructor(n){super(),this.writable=!1,Jo(this,n),this.opts=n,this.query=n.query,this.socket=n.socket,this.supportsBinary=!n.forceBase64}onError(n,s,a){return super.emitReserved("error",new R_(n,s,a)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(n){this.readyState==="open"&&this.write(n)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(n){const s=lh(n,this.socket.binaryType);this.onPacket(s)}onPacket(n){super.emitReserved("packet",n)}onClose(n){this.readyState="closed",super.emitReserved("close",n)}pause(n){}createUri(n,s={}){return n+"://"+this._hostname()+this._port()+this.opts.path+this._query(s)}_hostname(){const n=this.opts.hostname;return n.indexOf(":")===-1?n:"["+n+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(n){const s=k_(n);return s.length?"?"+s:""}}class D_ extends oh{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(n){this.readyState="pausing";const s=()=>{this.readyState="paused",n()};if(this._polling||!this.writable){let a=0;this._polling&&(a++,this.once("pollComplete",function(){--a||s()})),this.writable||(a++,this.once("drain",function(){--a||s()}))}else s()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(n){const s=a=>{if(this.readyState==="opening"&&a.type==="open"&&this.onOpen(),a.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(a)};__(n,this.socket.binaryType).forEach(s),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const n=()=>{this.write([{type:"close"}])};this.readyState==="open"?n():this.once("open",n)}write(n){this.writable=!1,v_(n,s=>{this.doWrite(s,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const n=this.opts.secure?"https":"http",s=this.query||{};return this.opts.timestampRequests!==!1&&(s[this.opts.timestampParam]=Pg()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(n,s)}}let $g=!1;try{$g=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const z_=$g;function q_(){}class U_ extends D_{constructor(n){if(super(n),typeof location<"u"){const s=location.protocol==="https:";let a=location.port;a||(a=s?"443":"80"),this.xd=typeof location<"u"&&n.hostname!==location.hostname||a!==n.port}}doWrite(n,s){const a=this.request({method:"POST",data:n});a.on("success",s),a.on("error",(o,f)=>{this.onError("xhr post error",o,f)})}doPoll(){const n=this.request();n.on("data",this.onData.bind(this)),n.on("error",(s,a)=>{this.onError("xhr poll error",s,a)}),this.pollXhr=n}}class Un extends gt{constructor(n,s,a){super(),this.createRequest=n,Jo(this,a),this._opts=a,this._method=a.method||"GET",this._uri=s,this._data=a.data!==void 0?a.data:null,this._create()}_create(){var n;const s=Hg(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;const a=this._xhr=this.createRequest(s);try{a.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){a.setDisableHeaderCheck&&a.setDisableHeaderCheck(!0);for(let o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&a.setRequestHeader(o,this._opts.extraHeaders[o])}}catch{}if(this._method==="POST")try{a.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{a.setRequestHeader("Accept","*/*")}catch{}(n=this._opts.cookieJar)===null||n===void 0||n.addCookies(a),"withCredentials"in a&&(a.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(a.timeout=this._opts.requestTimeout),a.onreadystatechange=()=>{var o;a.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.parseCookies(a.getResponseHeader("set-cookie"))),a.readyState===4&&(a.status===200||a.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof a.status=="number"?a.status:0)},0))},a.send(this._data)}catch(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=Un.requestsCount++,Un.requests[this._index]=this)}_onError(n){this.emitReserved("error",n,this._xhr),this._cleanup(!0)}_cleanup(n){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=q_,n)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Un.requests[this._index],this._xhr=null}}_onLoad(){const n=this._xhr.responseText;n!==null&&(this.emitReserved("data",n),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Un.requestsCount=0;Un.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",D0);else if(typeof addEventListener=="function"){const r="onpagehide"in bn?"pagehide":"unload";addEventListener(r,D0,!1)}}function D0(){for(let r in Un.requests)Un.requests.hasOwnProperty(r)&&Un.requests[r].abort()}const B_=(function(){const r=Yg({xdomain:!1});return r&&r.responseType!==null})();class L_ extends U_{constructor(n){super(n);const s=n&&n.forceBase64;this.supportsBinary=B_&&!s}request(n={}){return Object.assign(n,{xd:this.xd},this.opts),new Un(Yg,this.uri(),n)}}function Yg(r){const n=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!n||z_))return new XMLHttpRequest}catch{}if(!n)try{return new bn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Gg=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class H_ extends oh{get name(){return"websocket"}doOpen(){const n=this.uri(),s=this.opts.protocols,a=Gg?{}:Hg(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(a.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(n,s,a)}catch(o){return this.emitReserved("error",o)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=n=>this.onClose({description:"websocket connection closed",context:n}),this.ws.onmessage=n=>this.onData(n.data),this.ws.onerror=n=>this.onError("websocket error",n)}write(n){this.writable=!1;for(let s=0;s<n.length;s++){const a=n[s],o=s===n.length-1;ah(a,this.supportsBinary,f=>{try{this.doWrite(a,f)}catch{}o&&Fo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const n=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=Pg()),this.supportsBinary||(s.b64=1),this.createUri(n,s)}}const _f=bn.WebSocket||bn.MozWebSocket;class P_ extends H_{createSocket(n,s,a){return Gg?new _f(n,s,a):s?new _f(n,s):new _f(n)}doWrite(n,s){this.ws.send(s)}}class $_ extends oh{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(n){return this.emitReserved("error",n)}this._transport.closed.then(()=>{this.onClose()}).catch(n=>{this.onError("webtransport error",n)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(n=>{const s=S_(Number.MAX_SAFE_INTEGER,this.socket.binaryType),a=n.readable.pipeThrough(s).getReader(),o=w_();o.readable.pipeTo(n.writable),this._writer=o.writable.getWriter();const f=()=>{a.read().then(({done:d,value:g})=>{d||(this.onPacket(g),f())}).catch(d=>{})};f();const h={type:"open"};this.query.sid&&(h.data=`{"sid":"${this.query.sid}"}`),this._writer.write(h).then(()=>this.onOpen())})})}write(n){this.writable=!1;for(let s=0;s<n.length;s++){const a=n[s],o=s===n.length-1;this._writer.write(a).then(()=>{o&&Fo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var n;(n=this._transport)===null||n===void 0||n.close()}}const Y_={websocket:P_,webtransport:$_,polling:L_},G_=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,V_=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Yf(r){if(r.length>8e3)throw"URI too long";const n=r,s=r.indexOf("["),a=r.indexOf("]");s!=-1&&a!=-1&&(r=r.substring(0,s)+r.substring(s,a).replace(/:/g,";")+r.substring(a,r.length));let o=G_.exec(r||""),f={},h=14;for(;h--;)f[V_[h]]=o[h]||"";return s!=-1&&a!=-1&&(f.source=n,f.host=f.host.substring(1,f.host.length-1).replace(/;/g,":"),f.authority=f.authority.replace("[","").replace("]","").replace(/;/g,":"),f.ipv6uri=!0),f.pathNames=F_(f,f.path),f.queryKey=J_(f,f.query),f}function F_(r,n){const s=/\/{2,9}/g,a=n.replace(s,"/").split("/");return(n.slice(0,1)=="/"||n.length===0)&&a.splice(0,1),n.slice(-1)=="/"&&a.splice(a.length-1,1),a}function J_(r,n){const s={};return n.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(a,o,f){o&&(s[o]=f)}),s}const Gf=typeof addEventListener=="function"&&typeof removeEventListener=="function",Oo=[];Gf&&addEventListener("offline",()=>{Oo.forEach(r=>r())},!1);class Xs extends gt{constructor(n,s){if(super(),this.binaryType=A_,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,n&&typeof n=="object"&&(s=n,n=null),n){const a=Yf(n);s.hostname=a.host,s.secure=a.protocol==="https"||a.protocol==="wss",s.port=a.port,a.query&&(s.query=a.query)}else s.host&&(s.hostname=Yf(s.host).host);Jo(this,s),this.secure=s.secure!=null?s.secure:typeof location<"u"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=s.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(a=>{const o=a.prototype.name;this.transports.push(o),this._transportsByName[o]=a}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=M_(this.opts.query)),Gf&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Oo.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(n){const s=Object.assign({},this.opts.query);s.EIO=Lg,s.transport=n,this.id&&(s.sid=this.id);const a=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[n]);return new this._transportsByName[n](a)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const n=this.opts.rememberUpgrade&&Xs.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const s=this.createTransport(n);s.open(),this.setTransport(s)}setTransport(n){this.transport&&this.transport.removeAllListeners(),this.transport=n,n.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",Xs.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",n),this.emitReserved("heartbeat"),n.type){case"open":this.onHandshake(JSON.parse(n.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const s=new Error("server error");s.code=n.data,this._onError(s);break;case"message":this.emitReserved("data",n.data),this.emitReserved("message",n.data);break}}onHandshake(n){this.emitReserved("handshake",n),this.id=n.sid,this.transport.query.sid=n.sid,this._pingInterval=n.pingInterval,this._pingTimeout=n.pingTimeout,this._maxPayload=n.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const n=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+n,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},n),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const n=this._getWritablePackets();this.transport.send(n),this._prevBufferLen=n.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let a=0;a<this.writeBuffer.length;a++){const o=this.writeBuffer[a].data;if(o&&(s+=N_(o)),a>0&&s>this._maxPayload)return this.writeBuffer.slice(0,a);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const n=Date.now()>this._pingTimeoutTime;return n&&(this._pingTimeoutTime=0,Fo(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),n}write(n,s,a){return this._sendPacket("message",n,s,a),this}send(n,s,a){return this._sendPacket("message",n,s,a),this}_sendPacket(n,s,a,o){if(typeof s=="function"&&(o=s,s=void 0),typeof a=="function"&&(o=a,a=null),this.readyState==="closing"||this.readyState==="closed")return;a=a||{},a.compress=a.compress!==!1;const f={type:n,data:s,options:a};this.emitReserved("packetCreate",f),this.writeBuffer.push(f),o&&this.once("flush",o),this.flush()}close(){const n=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),n()},a=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?a():n()}):this.upgrading?a():n()),this}_onError(n){if(Xs.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",n),this._onClose("transport error",n)}_onClose(n,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Gf&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const a=Oo.indexOf(this._offlineEventListener);a!==-1&&Oo.splice(a,1)}this.readyState="closed",this.id=null,this.emitReserved("close",n,s),this.writeBuffer=[],this._prevBufferLen=0}}}Xs.protocol=Lg;class Q_ extends Xs{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let n=0;n<this._upgrades.length;n++)this._probe(this._upgrades[n])}_probe(n){let s=this.createTransport(n),a=!1;Xs.priorWebsocketSuccess=!1;const o=()=>{a||(s.send([{type:"ping",data:"probe"}]),s.once("packet",w=>{if(!a)if(w.type==="pong"&&w.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",s),!s)return;Xs.priorWebsocketSuccess=s.name==="websocket",this.transport.pause(()=>{a||this.readyState!=="closed"&&(E(),this.setTransport(s),s.send([{type:"upgrade"}]),this.emitReserved("upgrade",s),s=null,this.upgrading=!1,this.flush())})}else{const j=new Error("probe error");j.transport=s.name,this.emitReserved("upgradeError",j)}}))};function f(){a||(a=!0,E(),s.close(),s=null)}const h=w=>{const j=new Error("probe error: "+w);j.transport=s.name,f(),this.emitReserved("upgradeError",j)};function d(){h("transport closed")}function g(){h("socket closed")}function y(w){s&&w.name!==s.name&&f()}const E=()=>{s.removeListener("open",o),s.removeListener("error",h),s.removeListener("close",d),this.off("close",g),this.off("upgrading",y)};s.once("open",o),s.once("error",h),s.once("close",d),this.once("close",g),this.once("upgrading",y),this._upgrades.indexOf("webtransport")!==-1&&n!=="webtransport"?this.setTimeoutFn(()=>{a||s.open()},200):s.open()}onHandshake(n){this._upgrades=this._filterUpgrades(n.upgrades),super.onHandshake(n)}_filterUpgrades(n){const s=[];for(let a=0;a<n.length;a++)~this.transports.indexOf(n[a])&&s.push(n[a]);return s}}let I_=class extends Q_{constructor(n,s={}){const a=typeof n=="object"?n:s;(!a.transports||a.transports&&typeof a.transports[0]=="string")&&(a.transports=(a.transports||["polling","websocket","webtransport"]).map(o=>Y_[o]).filter(o=>!!o)),super(n,a)}};function X_(r,n="",s){let a=r;s=s||typeof location<"u"&&location,r==null&&(r=s.protocol+"//"+s.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=s.protocol+r:r=s.host+r),/^(https?|wss?):\/\//.test(r)||(typeof s<"u"?r=s.protocol+"//"+r:r="https://"+r),a=Yf(r)),a.port||(/^(http|ws)$/.test(a.protocol)?a.port="80":/^(http|ws)s$/.test(a.protocol)&&(a.port="443")),a.path=a.path||"/";const f=a.host.indexOf(":")!==-1?"["+a.host+"]":a.host;return a.id=a.protocol+"://"+f+":"+a.port+n,a.href=a.protocol+"://"+f+(s&&s.port===a.port?"":":"+a.port),a}const K_=typeof ArrayBuffer=="function",Z_=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,Vg=Object.prototype.toString,W_=typeof Blob=="function"||typeof Blob<"u"&&Vg.call(Blob)==="[object BlobConstructor]",ew=typeof File=="function"||typeof File<"u"&&Vg.call(File)==="[object FileConstructor]";function ch(r){return K_&&(r instanceof ArrayBuffer||Z_(r))||W_&&r instanceof Blob||ew&&r instanceof File}function jo(r,n){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let s=0,a=r.length;s<a;s++)if(jo(r[s]))return!0;return!1}if(ch(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return jo(r.toJSON(),!0);for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)&&jo(r[s]))return!0;return!1}function tw(r){const n=[],s=r.data,a=r;return a.data=Vf(s,n),a.attachments=n.length,{packet:a,buffers:n}}function Vf(r,n){if(!r)return r;if(ch(r)){const s={_placeholder:!0,num:n.length};return n.push(r),s}else if(Array.isArray(r)){const s=new Array(r.length);for(let a=0;a<r.length;a++)s[a]=Vf(r[a],n);return s}else if(typeof r=="object"&&!(r instanceof Date)){const s={};for(const a in r)Object.prototype.hasOwnProperty.call(r,a)&&(s[a]=Vf(r[a],n));return s}return r}function nw(r,n){return r.data=Ff(r.data,n),delete r.attachments,r}function Ff(r,n){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<n.length)return n[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let s=0;s<r.length;s++)r[s]=Ff(r[s],n);else if(typeof r=="object")for(const s in r)Object.prototype.hasOwnProperty.call(r,s)&&(r[s]=Ff(r[s],n));return r}const sw=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var De;(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"})(De||(De={}));class iw{constructor(n){this.replacer=n}encode(n){return(n.type===De.EVENT||n.type===De.ACK)&&jo(n)?this.encodeAsBinary({type:n.type===De.EVENT?De.BINARY_EVENT:De.BINARY_ACK,nsp:n.nsp,data:n.data,id:n.id}):[this.encodeAsString(n)]}encodeAsString(n){let s=""+n.type;return(n.type===De.BINARY_EVENT||n.type===De.BINARY_ACK)&&(s+=n.attachments+"-"),n.nsp&&n.nsp!=="/"&&(s+=n.nsp+","),n.id!=null&&(s+=n.id),n.data!=null&&(s+=JSON.stringify(n.data,this.replacer)),s}encodeAsBinary(n){const s=tw(n),a=this.encodeAsString(s.packet),o=s.buffers;return o.unshift(a),o}}class uh extends gt{constructor(n){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof n=="function"?{reviver:n}:n)}add(n){let s;if(typeof n=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");s=this.decodeString(n);const a=s.type===De.BINARY_EVENT;a||s.type===De.BINARY_ACK?(s.type=a?De.EVENT:De.ACK,this.reconstructor=new rw(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if(ch(n)||n.base64)if(this.reconstructor)s=this.reconstructor.takeBinaryData(n),s&&(this.reconstructor=null,super.emitReserved("decoded",s));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+n)}decodeString(n){let s=0;const a={type:Number(n.charAt(0))};if(De[a.type]===void 0)throw new Error("unknown packet type "+a.type);if(a.type===De.BINARY_EVENT||a.type===De.BINARY_ACK){const f=s+1;for(;n.charAt(++s)!=="-"&&s!=n.length;);const h=n.substring(f,s);if(h!=Number(h)||n.charAt(s)!=="-")throw new Error("Illegal attachments");const d=Number(h);if(!aw(d)||d<0)throw new Error("Illegal attachments");if(d>this.opts.maxAttachments)throw new Error("too many attachments");a.attachments=d}if(n.charAt(s+1)==="/"){const f=s+1;for(;++s&&!(n.charAt(s)===","||s===n.length););a.nsp=n.substring(f,s)}else a.nsp="/";const o=n.charAt(s+1);if(o!==""&&Number(o)==o){const f=s+1;for(;++s;){const h=n.charAt(s);if(h==null||Number(h)!=h){--s;break}if(s===n.length)break}a.id=Number(n.substring(f,s+1))}if(n.charAt(++s)){const f=this.tryParse(n.substr(s));if(uh.isPayloadValid(a.type,f))a.data=f;else throw new Error("invalid payload")}return a}tryParse(n){try{return JSON.parse(n,this.opts.reviver)}catch{return!1}}static isPayloadValid(n,s){switch(n){case De.CONNECT:return z0(s);case De.DISCONNECT:return s===void 0;case De.CONNECT_ERROR:return typeof s=="string"||z0(s);case De.EVENT:case De.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&sw.indexOf(s[0])===-1);case De.ACK:case De.BINARY_ACK:return Array.isArray(s)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class rw{constructor(n){this.packet=n,this.buffers=[],this.reconPack=n}takeBinaryData(n){if(this.buffers.push(n),this.buffers.length===this.reconPack.attachments){const s=nw(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const aw=Number.isInteger||function(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r};function z0(r){return Object.prototype.toString.call(r)==="[object Object]"}const lw=Object.freeze(Object.defineProperty({__proto__:null,Decoder:uh,Encoder:iw,get PacketType(){return De}},Symbol.toStringTag,{value:"Module"}));function On(r,n,s){return r.on(n,s),function(){r.off(n,s)}}const ow=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Fg extends gt{constructor(n,s,a){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=n,this.nsp=s,a&&a.auth&&(this.auth=a.auth),this._opts=Object.assign({},a),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const n=this.io;this.subs=[On(n,"open",this.onopen.bind(this)),On(n,"packet",this.onpacket.bind(this)),On(n,"error",this.onerror.bind(this)),On(n,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...n){return n.unshift("message"),this.emit.apply(this,n),this}emit(n,...s){var a,o,f;if(ow.hasOwnProperty(n))throw new Error('"'+n.toString()+'" is a reserved event name');if(s.unshift(n),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(s),this;const h={type:De.EVENT,data:s};if(h.options={},h.options.compress=this.flags.compress!==!1,typeof s[s.length-1]=="function"){const E=this.ids++,w=s.pop();this._registerAckCallback(E,w),h.id=E}const d=(o=(a=this.io.engine)===null||a===void 0?void 0:a.transport)===null||o===void 0?void 0:o.writable,g=this.connected&&!(!((f=this.io.engine)===null||f===void 0)&&f._hasPingExpired());return this.flags.volatile&&!d||(g?(this.notifyOutgoingListeners(h),this.packet(h)):this.sendBuffer.push(h)),this.flags={},this}_registerAckCallback(n,s){var a;const o=(a=this.flags.timeout)!==null&&a!==void 0?a:this._opts.ackTimeout;if(o===void 0){this.acks[n]=s;return}const f=this.io.setTimeoutFn(()=>{delete this.acks[n];for(let d=0;d<this.sendBuffer.length;d++)this.sendBuffer[d].id===n&&this.sendBuffer.splice(d,1);s.call(this,new Error("operation has timed out"))},o),h=(...d)=>{this.io.clearTimeoutFn(f),s.apply(this,d)};h.withError=!0,this.acks[n]=h}emitWithAck(n,...s){return new Promise((a,o)=>{const f=(h,d)=>h?o(h):a(d);f.withError=!0,s.push(f),this.emit(n,...s)})}_addToQueue(n){let s;typeof n[n.length-1]=="function"&&(s=n.pop());const a={id:this._queueSeq++,tryCount:0,pending:!1,args:n,flags:Object.assign({fromQueue:!0},this.flags)};n.push((o,...f)=>(this._queue[0],o!==null?a.tryCount>this._opts.retries&&(this._queue.shift(),s&&s(o)):(this._queue.shift(),s&&s(null,...f)),a.pending=!1,this._drainQueue())),this._queue.push(a),this._drainQueue()}_drainQueue(n=!1){if(!this.connected||this._queue.length===0)return;const s=this._queue[0];s.pending&&!n||(s.pending=!0,s.tryCount++,this.flags=s.flags,this.emit.apply(this,s.args))}packet(n){n.nsp=this.nsp,this.io._packet(n)}onopen(){typeof this.auth=="function"?this.auth(n=>{this._sendConnectPacket(n)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(n){this.packet({type:De.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},n):n})}onerror(n){this.connected||this.emitReserved("connect_error",n)}onclose(n,s){this.connected=!1,delete this.id,this.emitReserved("disconnect",n,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(n=>{if(!this.sendBuffer.some(a=>String(a.id)===n)){const a=this.acks[n];delete this.acks[n],a.withError&&a.call(this,new Error("socket has been disconnected"))}})}onpacket(n){if(n.nsp===this.nsp)switch(n.type){case De.CONNECT:n.data&&n.data.sid?this.onconnect(n.data.sid,n.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case De.EVENT:case De.BINARY_EVENT:this.onevent(n);break;case De.ACK:case De.BINARY_ACK:this.onack(n);break;case De.DISCONNECT:this.ondisconnect();break;case De.CONNECT_ERROR:this.destroy();const a=new Error(n.data.message);a.data=n.data.data,this.emitReserved("connect_error",a);break}}onevent(n){const s=n.data||[];n.id!=null&&s.push(this.ack(n.id)),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(n){if(this._anyListeners&&this._anyListeners.length){const s=this._anyListeners.slice();for(const a of s)a.apply(this,n)}super.emit.apply(this,n),this._pid&&n.length&&typeof n[n.length-1]=="string"&&(this._lastOffset=n[n.length-1])}ack(n){const s=this;let a=!1;return function(...o){a||(a=!0,s.packet({type:De.ACK,id:n,data:o}))}}onack(n){const s=this.acks[n.id];typeof s=="function"&&(delete this.acks[n.id],s.withError&&n.data.unshift(null),s.apply(this,n.data))}onconnect(n,s){this.id=n,this.recovered=s&&this._pid===s,this._pid=s,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(n=>this.emitEvent(n)),this.receiveBuffer=[],this.sendBuffer.forEach(n=>{this.notifyOutgoingListeners(n),this.packet(n)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(n=>n()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:De.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(n){return this.flags.compress=n,this}get volatile(){return this.flags.volatile=!0,this}timeout(n){return this.flags.timeout=n,this}onAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(n),this}prependAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(n),this}offAny(n){if(!this._anyListeners)return this;if(n){const s=this._anyListeners;for(let a=0;a<s.length;a++)if(n===s[a])return s.splice(a,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(n),this}prependAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(n),this}offAnyOutgoing(n){if(!this._anyOutgoingListeners)return this;if(n){const s=this._anyOutgoingListeners;for(let a=0;a<s.length;a++)if(n===s[a])return s.splice(a,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(n){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const s=this._anyOutgoingListeners.slice();for(const a of s)a.apply(this,n.data)}}}function jr(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}jr.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var n=Math.random(),s=Math.floor(n*this.jitter*r);r=(Math.floor(n*10)&1)==0?r-s:r+s}return Math.min(r,this.max)|0};jr.prototype.reset=function(){this.attempts=0};jr.prototype.setMin=function(r){this.ms=r};jr.prototype.setMax=function(r){this.max=r};jr.prototype.setJitter=function(r){this.jitter=r};class Jf extends gt{constructor(n,s){var a;super(),this.nsps={},this.subs=[],n&&typeof n=="object"&&(s=n,n=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,Jo(this,s),this.reconnection(s.reconnection!==!1),this.reconnectionAttempts(s.reconnectionAttempts||1/0),this.reconnectionDelay(s.reconnectionDelay||1e3),this.reconnectionDelayMax(s.reconnectionDelayMax||5e3),this.randomizationFactor((a=s.randomizationFactor)!==null&&a!==void 0?a:.5),this.backoff=new jr({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=n;const o=s.parser||lw;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=s.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(n){return arguments.length?(this._reconnection=!!n,n||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(n){return n===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=n,this)}reconnectionDelay(n){var s;return n===void 0?this._reconnectionDelay:(this._reconnectionDelay=n,(s=this.backoff)===null||s===void 0||s.setMin(n),this)}randomizationFactor(n){var s;return n===void 0?this._randomizationFactor:(this._randomizationFactor=n,(s=this.backoff)===null||s===void 0||s.setJitter(n),this)}reconnectionDelayMax(n){var s;return n===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=n,(s=this.backoff)===null||s===void 0||s.setMax(n),this)}timeout(n){return arguments.length?(this._timeout=n,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(n){if(~this._readyState.indexOf("open"))return this;this.engine=new I_(this.uri,this.opts);const s=this.engine,a=this;this._readyState="opening",this.skipReconnect=!1;const o=On(s,"open",function(){a.onopen(),n&&n()}),f=d=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",d),n?n(d):this.maybeReconnectOnOpen()},h=On(s,"error",f);if(this._timeout!==!1){const d=this._timeout,g=this.setTimeoutFn(()=>{o(),f(new Error("timeout")),s.close()},d);this.opts.autoUnref&&g.unref(),this.subs.push(()=>{this.clearTimeoutFn(g)})}return this.subs.push(o),this.subs.push(h),this}connect(n){return this.open(n)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const n=this.engine;this.subs.push(On(n,"ping",this.onping.bind(this)),On(n,"data",this.ondata.bind(this)),On(n,"error",this.onerror.bind(this)),On(n,"close",this.onclose.bind(this)),On(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(n){try{this.decoder.add(n)}catch(s){this.onclose("parse error",s)}}ondecoded(n){Fo(()=>{this.emitReserved("packet",n)},this.setTimeoutFn)}onerror(n){this.emitReserved("error",n)}socket(n,s){let a=this.nsps[n];return a?this._autoConnect&&!a.active&&a.connect():(a=new Fg(this,n,s),this.nsps[n]=a),a}_destroy(n){const s=Object.keys(this.nsps);for(const a of s)if(this.nsps[a].active)return;this._close()}_packet(n){const s=this.encoder.encode(n);for(let a=0;a<s.length;a++)this.engine.write(s[a],n.options)}cleanup(){this.subs.forEach(n=>n()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(n,s){var a;this.cleanup(),(a=this.engine)===null||a===void 0||a.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",n,s),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const n=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const s=this.backoff.duration();this._reconnecting=!0;const a=this.setTimeoutFn(()=>{n.skipReconnect||(this.emitReserved("reconnect_attempt",n.backoff.attempts),!n.skipReconnect&&n.open(o=>{o?(n._reconnecting=!1,n.reconnect(),this.emitReserved("reconnect_error",o)):n.onreconnect()}))},s);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}}onreconnect(){const n=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",n)}}const Aa={};function To(r,n){typeof r=="object"&&(n=r,r=void 0),n=n||{};const s=X_(r,n.path||"/socket.io"),a=s.source,o=s.id,f=s.path,h=Aa[o]&&f in Aa[o].nsps,d=n.forceNew||n["force new connection"]||n.multiplex===!1||h;let g;return d?g=new Jf(a,n):(Aa[o]||(Aa[o]=new Jf(a,n)),g=Aa[o]),s.query&&!n.query&&(n.query=s.queryKey),g.socket(s.path,n)}Object.assign(To,{Manager:Jf,Socket:Fg,io:To,connect:To});const cw=T.createContext({connected:!1,subscribe:()=>()=>{}});function uw({children:r}){const n=T.useRef(null),[s,a]=T.useState(!1),o=T.useRef(new Map),f=T.useCallback((d,g)=>{const y=o.current;return y.has(d)||y.set(d,new Set),y.get(d).add(g),()=>{const E=y.get(d);E&&(E.delete(g),E.size===0&&y.delete(d))}},[]),h=T.useCallback((d,g)=>{for(const[y,E]of o.current)if(Rg(d,y))for(const w of E)try{w(g)}catch{}},[]);return T.useEffect(()=>{const d=mg(),g=To({path:`${Bn}/socket.io`,transports:["polling","websocket"],upgrade:!0,reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:2e3,...d?{auth:{token:d}}:{}});return n.current=g,console.log("[lt-socketio] connecting..."),g.on("connect",()=>{console.log("[lt-socketio] connected, id:",g.id),a(!0)}),g.on("disconnect",y=>{console.log("[lt-socketio] disconnected:",y),a(!1)}),g.on("connect_error",y=>{console.warn("[lt-socketio] connect error:",y.message),a(!1)}),g.onAny((y,E)=>{if(y.startsWith("lt."))try{const w=typeof E=="string"?JSON.parse(E):E;h(y,w)}catch{}}),()=>{g.removeAllListeners(),g.disconnect(),n.current=null,a(!1)}},[h]),m.jsx(cw.Provider,{value:{connected:s,subscribe:f},children:m.jsx(Ga.Provider,{value:{connected:s,subscribe:f},children:r})})}function fw({children:r}){const[n,s]=T.useState(null),[a,o]=T.useState({url:null,token:null});return T.useEffect(()=>{let f=!1;async function h(){var d;try{console.log("[lt-transport] detecting event transport...");const g=await fetch(`${Bn}/api/settings`);if(!g.ok){console.warn("[lt-transport] settings fetch failed, falling back to socketio"),f||s("socketio");return}const y=await g.json(),E=(d=y==null?void 0:y.events)==null?void 0:d.transport;if(console.log("[lt-transport] server reports:",E),!f){if(E==="nats"){let w=y.events.natsWsUrl??null,j=null;const z=mg();if(z)try{const M=await fetch(`${Bn}/api/nats-credentials`,{headers:{Authorization:`Bearer ${z}`}});if(M.ok){const B=await M.json();w=B.natsWsUrl??w,j=B.natsToken??null}}catch{console.warn("[lt-transport] failed to fetch NATS credentials")}o({url:w,token:j})}s(E==="nats"?"nats":"socketio")}}catch(g){console.warn("[lt-transport] settings fetch error, falling back to socketio",g),f||s("socketio")}}return h(),()=>{f=!0}},[]),n==="nats"?m.jsx(p_,{url:a.url,token:a.token,children:r}):n==="socketio"?m.jsx(uw,{children:r}):m.jsx(m.Fragment,{children:r})}const Qf="lt_ai_override";function hw(){return Xe("/settings")}function If(){try{if(localStorage.getItem(Qf)==="off")return!1}catch{}return null}function dw(){var s;const r=Hn({queryKey:["settings"],queryFn:hw,staleTime:1/0}),n=If();return r.data&&n===!1&&((s=r.data.ai)!=null&&s.enabled)?{...r,data:{...r.data,ai:{enabled:!1}}}:r}function mw(){const[r,n]=T.useState(()=>If()===!1),s=T.useCallback(()=>{const a=If()===!1;try{a?localStorage.removeItem(Qf):localStorage.setItem(Qf,"off")}catch{}n(!a),window.location.reload()},[]);return{aiOverrideActive:r,toggleAIOverride:s}}const Jg=T.createContext(null),q0="lt_sidebar_collapsed";function pw({children:r}){const[n,s]=T.useState(()=>{try{return localStorage.getItem(q0)==="true"}catch{return!1}}),a=T.useCallback(()=>{s(o=>{const f=!o;try{localStorage.setItem(q0,String(f))}catch{}return f})},[]);return m.jsx(Jg.Provider,{value:{collapsed:n,toggle:a},children:r})}function Qg(){const r=T.useContext(Jg);if(!r)throw new Error("useSidebar must be used within SidebarProvider");return r}function OE(r){const n=r?`?period=${r}`:"";return Hn({queryKey:["escalationStats",r],queryFn:()=>Xe(`/escalations/stats${n}`)})}function jE(){return Hn({queryKey:["escalationTypes"],queryFn:()=>Xe("/escalations/types")})}function gw(r){const{enabled:n=!0,...s}=r,a=new URLSearchParams;return s.status&&a.set("status",s.status),s.role&&a.set("role",s.role),s.type&&a.set("type",s.type),s.subtype&&a.set("subtype",s.subtype),s.assigned_to&&a.set("assigned_to",s.assigned_to),s.priority&&a.set("priority",String(s.priority)),s.limit&&a.set("limit",String(s.limit)),s.offset!==void 0&&a.set("offset",String(s.offset)),s.sort_by&&a.set("sort_by",s.sort_by),s.order&&a.set("order",s.order),Hn({queryKey:["escalations",s],queryFn:()=>Xe(`/escalations?${a}`),enabled:n})}function yw(r){const{enabled:n=!0,...s}=r,a=new URLSearchParams;return s.role&&a.set("role",s.role),s.type&&a.set("type",s.type),s.subtype&&a.set("subtype",s.subtype),s.priority&&a.set("priority",String(s.priority)),s.limit&&a.set("limit",String(s.limit)),s.offset!==void 0&&a.set("offset",String(s.offset)),s.sort_by&&a.set("sort_by",s.sort_by),s.order&&a.set("order",s.order),Hn({queryKey:["escalations","available",s],queryFn:()=>Xe(`/escalations/available?${a}`),enabled:n})}function TE(r){return Hn({queryKey:["escalations","by-workflow",r],queryFn:()=>Xe(`/escalations/by-workflow/${r}`),enabled:!!r})}function NE(r){return Hn({queryKey:["escalations",r],queryFn:()=>Xe(`/escalations/${r}`),enabled:!!r})}function CE(){const r=Nn();return Pn({mutationFn:({id:n,durationMinutes:s})=>Xe(`/escalations/${n}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function kE(){const r=Nn();return Pn({mutationFn:n=>Xe(`/escalations/${n}/release`,{method:"POST"}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function ME(){const r=Nn();return Pn({mutationFn:({id:n,resolverPayload:s})=>Xe(`/escalations/${n}/resolve`,{method:"POST",body:JSON.stringify({resolverPayload:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"}),r.invalidateQueries({queryKey:["tasks"],refetchType:"all"}),r.invalidateQueries({queryKey:["jobs"],refetchType:"all"})}})}function RE(){const r=Nn();return Pn({mutationFn:({id:n,targetRole:s})=>Xe(`/escalations/${n}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function DE(){const r=Nn();return Pn({mutationFn:({ids:n,priority:s})=>Xe("/escalations/priority",{method:"PATCH",body:JSON.stringify({ids:n,priority:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function zE(){const r=Nn();return Pn({mutationFn:({ids:n,durationMinutes:s})=>Xe("/escalations/bulk-claim",{method:"POST",body:JSON.stringify({ids:n,durationMinutes:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function qE(){const r=Nn();return Pn({mutationFn:({ids:n,targetUserId:s,durationMinutes:a})=>Xe("/escalations/bulk-assign",{method:"POST",body:JSON.stringify({ids:n,targetUserId:s,durationMinutes:a})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function UE(){const r=Nn();return Pn({mutationFn:({ids:n,targetRole:s})=>Xe("/escalations/bulk-escalate",{method:"PATCH",body:JSON.stringify({ids:n,targetRole:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function BE(){const r=Nn();return Pn({mutationFn:({ids:n,hint:s})=>Xe("/escalations/bulk-triage",{method:"POST",body:JSON.stringify({ids:n,...s?{hint:s}:{}})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function bw(){const{user:r}=Oi(),n=r==null?void 0:r.userId,s=Nn(),a=T.useRef(null),o=T.useCallback(()=>{a.current||(a.current=setTimeout(()=>{a.current=null,s.invalidateQueries({queryKey:["escalations"]})},15e3))},[s]);h_(`${u_}.escalation.>`,o);const{data:f}=yw({limit:1}),{data:h}=gw({assigned_to:n,status:"pending",limit:200}),d=new Date,g=((h==null?void 0:h.escalations)??[]).filter(y=>y.assigned_until&&new Date(y.assigned_until)>d);return{available:(f==null?void 0:f.total)??0,mine:g.length}}function fh({size:r="sm",hideLabel:n=!1,className:s=""}){const a=r==="lg",o=a?"w-[16rem] h-[16rem] -rotate-[120deg] opacity-40 -ml-10":"w-[12.5rem] h-[12.5rem] -rotate-[120deg] opacity-40 -ml-8",f=a?"text-[44px] font-normal text-text-primary tracking-[0.15em] -ml-[12.5rem]":"text-[36px] font-normal text-text-primary tracking-[0.15em] -ml-[9.75rem]";return m.jsxs("div",{className:`flex items-center ${s}`,style:{height:"50px"},children:[m.jsx("img",{src:`${Bn}/logo512.png`,alt:"LongTail",className:`shrink-0 z-0 ${o}`}),m.jsx("span",{className:`z-[1] transition-opacity duration-300 ${f} ${n?"opacity-0":""}`,children:"LongTail"})]})}function xw({onToggleEventFeed:r,onToggleDocs:n}){const{user:s,logout:a}=Oi(),{available:o,mine:f}=bw(),{connected:h}=f_(),{toggleAIOverride:d}=mw(),[g,y]=T.useState(!1),E=T.useRef(null);return T.useEffect(()=>{if(!g)return;const w=j=>{E.current&&!E.current.contains(j.target)&&y(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[g]),m.jsxs("header",{className:"h-14 shrink-0 border-b border-surface-border bg-surface-raised flex items-center justify-between px-5 relative z-30",children:[m.jsx("div",{className:"flex items-center gap-4",children:m.jsx(gr,{to:"/","aria-label":"Home",onClick:w=>{(w.ctrlKey||w.metaKey)&&(w.preventDefault(),d())},children:m.jsx(fh,{})})}),m.jsxs("div",{className:"flex items-center gap-5",children:[m.jsxs(gr,{to:"/escalations/available",className:`flex items-center gap-1.5 text-[11px] transition-colors ${o>0?"text-blue-400 hover:text-blue-300":"text-text-quaternary hover:text-text-secondary"}`,title:"Available escalations",children:[m.jsx(Ax,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"all",o>0&&m.jsx("span",{className:"tabular-nums font-medium",children:o})]}),m.jsxs(gr,{to:"/escalations/queue",className:`flex items-center gap-1.5 text-[11px] transition-colors ${f>0?"text-status-warning hover:text-amber-300":"text-text-quaternary hover:text-text-secondary"}`,title:"My escalation queue",children:[m.jsx(Ox,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"mine",f>0&&m.jsx("span",{className:"tabular-nums font-medium",children:f})]}),m.jsx("div",{className:"w-px h-4 bg-surface-border"}),m.jsxs("button",{type:"button",onClick:r,className:`flex items-center gap-1.5 text-[11px] transition-colors ${h?"text-emerald-400 hover:text-emerald-300":"text-text-quaternary hover:text-text-secondary"}`,title:h?"Live events — click to toggle feed":"Events disconnected",children:[m.jsx(lg,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"events"]}),m.jsxs("button",{onClick:n,className:"flex items-center gap-1.5 text-[11px] text-text-quaternary hover:text-text-secondary transition-colors",title:"Documentation",children:[m.jsx(og,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"docs"]}),m.jsx("div",{className:"w-px h-4 bg-surface-border"}),s&&m.jsxs("div",{className:"relative",ref:E,children:[m.jsxs("button",{onClick:()=>y(w=>!w),className:"btn-ghost text-xs flex items-center gap-1",children:[m.jsx(jx,{className:"w-3.5 h-3.5 text-accent/75",strokeWidth:1.5}),s.displayName||s.username||s.userId,m.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),g&&m.jsxs("div",{className:"absolute right-0 top-full mt-1 w-48 bg-surface-raised border border-surface-border rounded-md shadow-lg py-1 z-50",children:[m.jsx(gr,{to:"/credentials",onClick:()=>y(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Credentials"}),m.jsx("button",{onClick:()=>{y(!1),a()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Sign Out"})]})]})]})]})}function hh({open:r,children:n}){const[s,a]=T.useState(r);return T.useEffect(()=>{r&&a(!0)},[r]),m.jsx("div",{className:`grid transition-[grid-template-rows] duration-300 ease-out ${r?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,onTransitionEnd:()=>{r||a(!1)},children:m.jsx("div",{className:"overflow-hidden",children:s?n:null})})}function Xf(r){return({isActive:n})=>{const s="flex items-center rounded-md transition-colors duration-150",a="bg-surface-hover text-text-primary font-medium",o="text-text-secondary hover:text-text-primary hover:bg-surface-hover";return r?`${s} justify-center w-10 h-10 mx-auto ${n?a:o}`:`${s} gap-3 px-4 py-2 text-sm ${n?a:o}`}}function vw(){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 _w({group:r,collapsed:n}){const{pathname:s}=Ws(),a=r.matchPaths.some(d=>s.startsWith(d)),[o,f]=T.useState(a),h=o||a;return n?m.jsx(m.Fragment,{children:r.items.map(d=>m.jsx(No,{to:d.to,className:Xf(!0),title:d.label,children:d.icon&&m.jsx(d.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})},d.to))}):m.jsxs("div",{children:[m.jsxs("button",{onClick:()=>f(d=>!d),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:[m.jsxs("span",{className:"flex items-center gap-3",children:[r.icon&&m.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),m.jsx("span",{children:r.label})]}),m.jsx("svg",{className:`w-3.5 h-3.5 text-text-tertiary transition-transform duration-150 ${h?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),m.jsx(hh,{open:h,children:r.items.map(d=>m.jsxs(No,{to:d.to,end:d.end,className:vw(),children:[d.icon&&m.jsx(d.icon,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),m.jsx("span",{children:d.label})]},d.to))})]})}function ww(r){return r.kind==="group"}function Sw({entry:r,collapsed:n}){const{pathname:s,search:a}=Ws();if(r.to.includes("?")){const[f,h]=r.to.split("?"),d=s===f&&a===`?${h}`,g=Xf(n)({isActive:d});return m.jsxs(No,{to:r.to,className:g,title:n?r.label:void 0,children:[r.icon&&m.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),!n&&m.jsx("span",{children:r.label})]})}return m.jsxs(No,{to:r.to,end:r.end,className:Xf(n),title:n?r.label:void 0,children:[r.icon&&m.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),!n&&m.jsx("span",{children:r.label})]})}function Qo({heading:r,entries:n}){const{collapsed:s}=Qg();return m.jsxs("div",{className:"space-y-1",children:[s?m.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:r}):m.jsx("p",{className:"px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-accent/80",children:r}),n.map(a=>ww(a)?m.jsx(_w,{group:a,collapsed:s},a.label):m.jsx(Sw,{entry:a,collapsed:s},a.to))]})}function Ew({aiEnabled:r=!1}){const n=[{to:"/",label:"Recent Activity",icon:Tx,end:!0},{to:"/capabilities",label:"Capabilities",icon:Nx},{to:"/agents",label:r?"Agents":"Automations",icon:Cx},{to:"/topics",label:"Topics",icon:lg}];return m.jsx(Qo,{heading:"Work",entries:n})}function Aw({aiEnabled:r=!1}){const n=[{to:"/workflows/registry",label:"Registry",icon:af},{to:"/workflows/start",label:"Invoke",icon:kx}];r&&n.push({to:"/workflows/executions",label:"Executions",icon:lf});const s=[{kind:"group",label:"Workflows",icon:af,matchPaths:["/workflows"],items:n}];return r?s.push({kind:"group",label:"Pipelines",icon:ka,matchPaths:["/mcp"],items:[{to:"/mcp/queries",label:"Designer",icon:Mx},{to:"/mcp/servers",label:"Servers & Tools",icon:cg},{to:"/mcp/workflows",label:"Pipeline Tools",icon:ka},{to:"/mcp/executions",label:"Executions",icon:lf}]}):s.push({kind:"group",label:"Executions",icon:lf,matchPaths:["/mcp","/workflows/executions"],items:[{to:"/workflows/executions",label:"Workflows",icon:af},{to:"/mcp/executions",label:"Pipelines",icon:ka}]}),m.jsx(Qo,{heading:"Build",entries:s})}const Ow=[{to:"/files",label:"Files",icon:Rx},{to:"/knowledge",label:"Knowledge",icon:Dx}];function jw(){return m.jsx(Qo,{heading:"Storage",entries:Ow})}const Tw=[{kind:"group",label:"Identity & Access",icon:Ux,matchPaths:["/admin/users","/admin/roles"],items:[{to:"/admin/users",label:"Accounts",icon:zx},{to:"/admin/roles",label:"Roles & Permissions",icon:qx}]},{kind:"group",label:"Infrastructure",icon:cg,matchPaths:["/admin/controlplane","/admin/streams","/admin/maintenance"],items:[{to:"/admin/controlplane",label:"Routers",icon:Bx},{to:"/admin/streams",label:"Messages",icon:Lx},{to:"/admin/maintenance",label:"DB Maintenance",icon:Hx}]}];function Nw(){return m.jsx(Qo,{heading:"Admin",entries:Tw})}const Ig="lt_event_feed_patterns";function Cw(r){if(r.startsWith("/topics/")){const n=decodeURIComponent(r.replace("/topics/",""));if(n&&!n.includes("/"))return`lt.events.${n}`}return r.startsWith("/escalations")?"lt.events.escalation.>":r.startsWith("/workflows")?"lt.events.workflow.>":r.startsWith("/agents")?"lt.events.agent.>":r.startsWith("/knowledge")?"lt.events.knowledge.>":r.startsWith("/files")?"lt.events.file.>":r==="/"?"lt.events.>":r.startsWith("/mcp")?"lt.events.activity.>":"lt.events.>"}function kw(){try{const r=localStorage.getItem(Ig);return r?JSON.parse(r):[]}catch{return[]}}function wf(r){try{localStorage.setItem(Ig,JSON.stringify(r))}catch{}}function Mw(){const{pathname:r}=Ws(),[n,s]=T.useState(kw),a=T.useMemo(()=>Cw(r),[r]),o=T.useMemo(()=>{const g=new Set([a,...n]);return Array.from(g)},[a,n]),f=T.useCallback(g=>{const y=g.startsWith("lt.events.")?g:`lt.events.${g}`;s(E=>{if(E.includes(y))return E;const w=[...E,y];return wf(w),w})},[]),h=T.useCallback(g=>{s(y=>{const E=y.filter(w=>w!==g);return wf(E),E})},[]),d=T.useCallback(()=>{s([]),wf([])},[]);return{patterns:o,pagePattern:a,userPatterns:n,addPattern:f,removePattern:h,clearUserPatterns:d}}function Rw({children:r,className:n=""}){return m.jsx("p",{className:`text-[10px] font-semibold uppercase tracking-widest text-text-tertiary ${n}`,children:r})}const Sf=280,U0="cubic-bezier(0.4, 0, 0.2, 1)",vo=40;function Dw(r){if(!r)return"scale(0.92)";const n=window.innerWidth,s=window.innerHeight,a=n-vo*2,o=s-vo*2,f=r.width/a,h=r.height/o,d=r.left+r.width/2-(vo+a/2),g=r.top+r.height/2-(vo+o/2);return`translate(${d}px, ${g}px) scale(${f}, ${h})`}function Xg({open:r,onClose:n,sourceRef:s,children:a}){const[o,f]=T.useState(null),h=T.useRef(null),d=T.useRef(!1);T.useEffect(()=>{var j,z;r&&!d.current?(h.current=((j=s==null?void 0:s.current)==null?void 0:j.getBoundingClientRect())??null,f("entering")):!r&&d.current&&o==="open"&&(h.current=((z=s==null?void 0:s.current)==null?void 0:z.getBoundingClientRect())??null,f("exiting")),d.current=r},[r,s,o]),T.useEffect(()=>{if(o!=="entering")return;const j=requestAnimationFrame(()=>{requestAnimationFrame(()=>f("open"))});return()=>cancelAnimationFrame(j)},[o]),T.useEffect(()=>{if(o)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[o]),T.useEffect(()=>{if(!o)return;const j=z=>{z.key==="Escape"&&n()};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[o,n]);const g=T.useCallback(j=>{j.propertyName==="transform"&&o==="exiting"&&f(null)},[o]);if(T.useEffect(()=>{if(o!=="exiting")return;const j=setTimeout(()=>f(null),Sf+50);return()=>clearTimeout(j)},[o]),!o)return null;const y=o==="entering"||o==="exiting",E=y?Dw(h.current):"none",w=y?0:1;return rg.createPortal(m.jsx("div",{className:"fixed inset-0 z-50 overflow-auto p-10",style:{transformOrigin:"center center",transition:`transform ${Sf}ms ${U0}, opacity ${Sf}ms ${U0}`,transform:E,opacity:w,backgroundColor:"#FFFFFF"},onTransitionEnd:g,children:a}),document.body)}function zw({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h8M4 18h12"})})}function qw({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 7l-5 5 5 5M16 7l5 5-5 5"})})}function Uw({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.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 Bw({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}function Lw({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.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 Hw({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.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 Pw(r){const n=r.trim().split(`
|
|
54
|
-
`);if(n.length<2)return r;const s=d=>d.split("|").map(g=>g.trim()).filter(Boolean),a=s(n[0]),o=n.slice(2),f=a.map(d=>`<th class="px-3 py-1.5 text-left text-[10px] font-semibold uppercase tracking-wider text-text-tertiary">${d}</th>`).join(""),h=o.map(d=>`<tr class="border-t border-surface-border">${s(d).map(E=>`<td class="px-3 py-1.5 text-xs text-text-secondary">${E}</td>`).join("")}</tr>`).join("");return`<table class="w-full my-3 text-xs"><thead><tr class="border-b border-surface-border">${f}</tr></thead><tbody>${h}</tbody></table>`}function _o(r){return r.toLowerCase().replace(/<[^>]+>/g,"").replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").trim()}function
|
|
53
|
+
${d.stack}`),h.reject(y)):h.resolve(E))}});return g.requestSubject=n,this.protocol.publish(n,s,{reply:f,headers:a.headers}),h}else{const f=new bg(this.protocol.muxSubscriptions,n,a,o);this.protocol.request(f);try{this.publish(n,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${f.token}`,headers:a.headers})}catch(d){f.cancel(d)}const h=Promise.race([f.timer,f.deferred]);return h.catch(()=>{f.cancel()}),h}}flush(){return this.isClosed()?Promise.reject(ue.errorForCode(ie.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(ue.errorForCode(ie.ConnectionClosed)):this.isDraining()?Promise.reject(ue.errorForCode(ie.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const n=this.protocol.getServer();return n?n.listen:""}status(){const n=new _t;return n.iterClosed.then(()=>{const s=this.listeners.indexOf(n);this.listeners.splice(s,1)}),this.listeners.push(n),n}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((s,a)=>s==="time"?new Date(Date.parse(a)):a)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(n={}){const s=new Q1(this,n);if(n.checkAPI!==!1)try{await s.getAccountInfo()}catch(a){const o=a;throw o.code===ie.NoResponders&&(o.code=ie.JetStreamNotEnabled),o}return s}jetstream(n={}){return new th(this,n)}getServerVersion(){const n=this.info;return n?Ai(n.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw ue.errorForCode(ie.Disconnect);const n=Date.now();return await this.flush(),Date.now()-n}get features(){return this.protocol.features}get services(){return this._services||(this._services=new Z1(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(ue.errorForCode(ie.ConnectionClosed)):this.isDraining()?Promise.reject(ue.errorForCode(ie.ConnectionDraining)):this.protocol.reconnect()}}class Z1{constructor(n){v(this,"nc");this.nc=n}add(n){try{return new $a(this.nc,n).start()}catch(s){return Promise.reject(s)}}client(n,s){return new k1(this.nc,n,s)}}class W1{constructor(n,s,a){v(this,"bucket");v(this,"sm");v(this,"prefixLen");this.bucket=n,this.prefixLen=s,this.sm=a}get key(){return this.sm.subject.substring(this.prefixLen)}get value(){return this.sm.data}get delta(){return 0}get created(){return this.sm.time}get revision(){return this.sm.seq}get operation(){return this.sm.header.get(Uo)||"PUT"}get length(){const n=this.sm.header.get(Dt.MessageSizeHdr)||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class e_{constructor(n,s,a){v(this,"bucket");v(this,"key");v(this,"sm");this.bucket=n,this.key=s,this.sm=a}get value(){return this.sm.data}get created(){return new Date(Xf(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var n;return((n=this.sm.headers)==null?void 0:n.get(Uo))||"PUT"}get delta(){return this.sm.info.pending}get length(){var s;const n=((s=this.sm.headers)==null?void 0:s.get(Dt.MessageSizeHdr))||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Tg extends Yv{constructor(s,a,o){super(s.nc,a,o);v(this,"js");v(this,"monitor");this.js=s,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(s){this.sub.info=s}get info(){return this.sub.info}_resetOrderedConsumer(s){if(this.info===null||this.sub.isClosed())return;const a=us(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,a);const f=this.info;f.config.name=Ks.next(),f.ordered_consumer_sequence.delivery_seq=0,f.flow_control.heartbeat_count=0,f.flow_control.fc_count=0,f.flow_control.consumer_restarts++,f.deliver=a,f.config.deliver_subject=a,f.config.deliver_policy=ft.StartSequence,f.config.opt_start_seq=s;const h={};h.stream_name=this.info.stream,h.config=f.config;const d=`${f.api.prefix}.CONSUMER.CREATE.${f.stream}`;this.js._request(d,h,{retries:-1}).then(g=>{const y=g,E=this.sub.info;E.last=y,this.info.config=y.config,this.info.name=y.name}).catch(g=>{const y=new ue(`unable to recreate ordered consumer ${f.stream} at seq ${s}`,ie.RequestError,g);this.sub.callback(y,{})})}_maybeSetupHbMonitoring(){var a,o;const s=((o=(a=this.info)==null?void 0:a.config)==null?void 0:o.idle_heartbeat)||0;s&&this._setupHbMonitoring(Xf(s))}_setupHbMonitoring(s,a=0){const o={cancelAfter:0,maxOut:2};a&&(o.cancelAfter=a);const f=this.sub,h=d=>{var E,w,j,z;const g=Sv(409,`${yn.IdleHeartbeatMissed}: ${d}`,this.sub.subject);if(!((E=this.info)==null?void 0:E.ordered))this.sub.callback(null,g);else{if(!this.js.nc.protocol.connected)return!1;const M=((j=(w=this.info)==null?void 0:w.ordered_consumer_sequence)==null?void 0:j.stream_seq)||0;return this._resetOrderedConsumer(M+1),(z=this.monitor)==null||z.restart(),!1}return!f.noIterator};this.monitor=new Zf(s,h,o)}_checkHbOrderConsumer(s){const a=s.headers.get(Dt.ConsumerStalledHdr);a!==""&&this.js.nc.publish(a);const o=parseInt(s.headers.get(Dt.LastConsumerSeqHdr),10),f=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,o!==f.delivery_seq&&this._resetOrderedConsumer(f.stream_seq+1),!1}_checkOrderedConsumer(s){const a=this.info.ordered_consumer_sequence,o=s.info.streamSequence,f=s.info.deliverySequence;return f!=a.delivery_seq+1?(this._resetOrderedConsumer(a.stream_seq+1),!1):(a.delivery_seq=f,a.stream_seq=o,!0)}async destroy(){this.isClosed()||await this.drain();const s=this.sub.info,a=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.DELETE.${s.stream}.${a}`;await s.api._request(o)}async consumerInfo(){const s=this.sub.info,a=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.INFO.${s.stream}.${a}`,f=await s.api._request(o);return s.last=f,f}}class t_ extends Tg{constructor(n,s,a){super(n,s,a)}pull(n={batch:1}){const{stream:s,config:a,name:o}=this.sub.info,f=a.durable_name??o,h={};if(h.batch=n.batch||1,h.no_wait=n.no_wait||!1,(n.max_bytes??0)>0){const y=this.js.nc.features.get(ze.JS_PULL_MAX_BYTES);if(!y.ok)throw new Error(`max_bytes is only supported on servers ${y.min} or better`);h.max_bytes=n.max_bytes}let d=0;n.expires&&n.expires>0&&(d=n.expires,h.expires=nt(d));let g=0;if(n.idle_heartbeat&&n.idle_heartbeat>0&&(g=n.idle_heartbeat,h.idle_heartbeat=nt(g)),g&&d===0)throw new Error("idle_heartbeat requires expires");if(g>d)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),d&&g&&(this.monitor?this.monitor._change(g,d):this._setupHbMonitoring(g,d));const y=this.info.api,E=`${y.prefix}.CONSUMER.MSG.NEXT.${s}.${f}`,w=this.sub.subject;y.nc.publish(E,y.jc.encode(h),{reply:w})}}}function n_(r,n){return r?i_(n):s_(n)}function s_(r){return(n,s)=>n?[n,null]:(n=vr(s),n?[n,null]:[null,La(s,r)])}function i_(r){return(n,s)=>{if(n)return[n,null];const a=vr(s);return a!==null?[Ng(a),null]:[null,La(s,r)]}}function Ng(r){if(r!==null)switch(r.code){case ie.JetStream404NoMessages:case ie.JetStream408RequestTimeout:return null;case ie.JetStream409:return Ev(r)?r:null;default:return r}return null}function r_(r){r&&r.ack()}function a_(r){const n=r.split(".");if(n.length===9&&n.splice(2,0,"_",""),n.length<11||n[0]!=="$JS"||n[1]!=="ACK")throw new Error("not js message");const s={};return s.domain=n[2]==="_"?"":n[2],s.account_hash=n[3],s.stream=n[4],s.consumer=n[5],s.deliveryCount=parseInt(n[6],10),s.redeliveryCount=s.deliveryCount,s.redelivered=s.deliveryCount>1,s.streamSequence=parseInt(n[7],10),s.deliverySequence=parseInt(n[8],10),s.timestampNanos=parseInt(n[9],10),s.pending=parseInt(n[10],10),s}class l_{constructor(n,s){v(this,"msg");v(this,"di");v(this,"didAck");v(this,"timeout");this.msg=n,this.didAck=!1,this.timeout=s}get subject(){return this.msg.subject}get sid(){return this.msg.sid}get data(){return this.msg.data}get headers(){return this.msg.headers}get info(){return this.di||(this.di=a_(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(n){this.didAck||(this.didAck=!this.isWIP(n),this.msg.respond(n))}isWIP(n){return n.length===4&&n[0]===Ea[0]&&n[1]===Ea[1]&&n[2]===Ea[2]&&n[3]===Ea[3]}async ackAck(n){var a;n=n||{},n.timeout=n.timeout||this.timeout;const s=st();if(this.didAck)s.resolve(!1);else if(this.didAck=!0,this.msg.reply){const f=this.msg.publisher,h=!((a=f.options)!=null&&a.noAsyncTraces),d=new bg(f.muxSubscriptions,this.msg.reply,{timeout:n.timeout},h);f.request(d);try{f.publish(this.msg.reply,O0,{reply:`${f.muxSubscriptions.baseInbox}${d.token}`})}catch(g){d.cancel(g)}try{await Promise.race([d.timer,d.deferred]),s.resolve(!0)}catch(g){d.cancel(g),s.reject(g)}}else s.resolve(!1);return s}ack(){this.doAck(O0)}nak(n){let s=P1;n&&(s=Af().encode(`-NAK ${JSON.stringify({delay:nt(n)})}`)),this.doAck(s)}working(){this.doAck(Ea)}next(n,s={batch:1}){const a={};a.batch=s.batch||1,a.no_wait=s.no_wait||!1,s.expires&&s.expires>0&&(a.expires=nt(s.expires));const o=Tn().encode(a),f=Ar.concat($1,G1,o),h=n?{reply:n}:void 0;this.msg.respond(f,h)}term(n=""){let s=Y1;(n==null?void 0:n.length)>0&&(s=Af().encode(`+TERM ${n}`)),this.doAck(s)}json(){return this.msg.json()}string(){return this.msg.string()}}const o_="1.30.3",c_="nats.ws";class u_{constructor(){v(this,"version");v(this,"lang");v(this,"closeError");v(this,"connected");v(this,"done");v(this,"socket");v(this,"options");v(this,"socketClosed");v(this,"encrypted");v(this,"peeked");v(this,"yields");v(this,"signal");v(this,"closedNotification");this.version=o_,this.lang=c_,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=st(),this.closedNotification=st()}async connect(n,s){const a=st();if(s.tls)return a.reject(new ue("tls",ie.InvalidOption)),a;this.options=s;const o=n.src;if(s.wsFactory){const{socket:f,encrypted:h}=await s.wsFactory(n.src,s);this.socket=f,this.encrypted=h}else this.encrypted=o.indexOf("wss://")===0,this.socket=new WebSocket(o);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=f=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(f.data)),this.peeked){this.signal.resolve();return}const h=Ar.concat(...this.yields),d=Iv(h);if(d!==""){const g=S1.exec(d);if(!g){s.debug&&console.error("!!!",mo(h)),a.reject(new Error("unexpected response from server"));return}try{const y=JSON.parse(g[1]);_1(y,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),a.resolve()}catch(y){a.reject(y);return}}},this.socket.onclose=f=>{if(this.isDiscarded())return;this.socketClosed=!0;let h;this.done||(f.wasClean||(h=new Error(f.reason)),this._closed(h))},this.socket.onerror=f=>{if(this.isDiscarded())return;const h=f,d=new ue(h.message,ie.Unknown,new Error(h.error));a.reject(d)},a}disconnect(){this._closed(void 0,!0)}async _closed(n,s=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=n,!n)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await Or(100);this.done=!0;try{this.socket.close(n?1002:1e3,n?n.message:void 0)}catch{}s&&this.closedNotification.resolve(n)}}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.isDiscarded())return;this.yields.length===0&&await this.signal;const n=this.yields;this.yields=[];for(let s=0;s<n.length;s++)this.options.debug&&console.info(`> ${mo(n[s])}`),yield n[s];if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=st())}}isEncrypted(){return this.connected&&this.encrypted}send(n){if(!this.isDiscarded())try{this.socket.send(n.buffer),this.options.debug&&console.info(`< ${mo(n)}`);return}catch(s){this.options.debug&&console.error(`!!! ${mo(n)}: ${s}`)}}close(n){return this._closed(n,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var n;this.done=!0;try{(n=this.socket)==null||n.close()}catch{}}}function f_(r,n){/^(.*:\/\/)(.*)/.test(r)||(typeof n=="boolean"?r=`${n===!0?"https":"http"}://${r}`:r=`https://${r}`);let a=new URL(r);const o=a.protocol.toLowerCase();o==="ws:"&&(n=!1),o==="wss:"&&(n=!0),o!=="https:"&&o!=="http"&&(r=r.replace(/^(.*:\/\/)(.*)/gm,"$2"),a=new URL(`http://${r}`));let f,h;const d=a.hostname,g=a.pathname,y=a.search||"";switch(o){case"http:":case"ws:":case"nats:":h=a.port||"80",f="ws:";break;case"https:":case"wss:":case"tls:":h=a.port||"443",f="wss:";break;default:h=a.port||n===!0?"443":"80",f=n===!0?"wss:":"ws:";break}return`${f}//${d}:${h}${g}${y}`}function h_(r={}){return Gv({defaultPort:443,urlParseFn:f_,factory:()=>new u_}),nh.connect(r)}const d_="ws://localhost:9222",m_="dev_api_secret",p_="lt.events";function Cg(r,n){const s=r.split("."),a=n.split(".");for(let o=0;o<a.length;o++){const f=a[o];if(f===">")return!0;if(o>=s.length||f!=="*"&&f!==s[o])return!1}return s.length===a.length}const Ya=T.createContext({connected:!1,subscribe:()=>()=>{}});function g_(){const{connected:r}=T.useContext(Ya);return{connected:r}}function y_(r,n){const{subscribe:s}=T.useContext(Ya),a=T.useRef(n);a.current=n,T.useEffect(()=>s(r,f=>a.current(f)),[s,r])}const b_=T.createContext({connected:!1,subscribe:()=>()=>{}}),x_=Af();function v_({children:r,url:n,token:s}){const a=T.useRef(null),o=T.useRef(null),[f,h]=T.useState(!1),d=T.useRef(null),g=T.useRef(new Map),y=T.useCallback((j,z)=>{const M=g.current;return M.has(j)||M.set(j,new Set),M.get(j).add(z),()=>{const B=M.get(j);B&&(B.delete(z),B.size===0&&M.delete(j))}},[]),E=T.useCallback((j,z)=>{for(const[M,B]of g.current)if(Cg(j,M))for(const V of B)try{V(z)}catch{}},[]),w=T.useCallback(async()=>{try{if(a.current)return;const j=await h_({servers:n||d_,token:s||m_,reconnect:!0,maxReconnectAttempts:-1,reconnectTimeWait:2e3});a.current=j,h(!0);const z=j.subscribe("lt.>");o.current=z,(async()=>{for await(const M of z)try{const B=JSON.parse(x_.decode(M.data));E(M.subject,B)}catch{}})(),(async()=>{for await(const M of j.status())M.type==="disconnect"||M.type==="error"?h(!1):M.type==="reconnect"&&h(!0)})()}catch{h(!1),d.current=setTimeout(w,3e3)}},[E]);return T.useEffect(()=>(w(),()=>{d.current&&clearTimeout(d.current),o.current&&o.current.unsubscribe(),a.current&&(a.current.close().catch(()=>{}),a.current=null),h(!1)}),[w]),m.jsx(b_.Provider,{value:{connected:f,subscribe:y},children:m.jsx(Ya.Provider,{value:{connected:f,subscribe:y},children:r})})}const Ln=Object.create(null);Ln.open="0";Ln.close="1";Ln.ping="2";Ln.pong="3";Ln.message="4";Ln.upgrade="5";Ln.noop="6";const Ao=Object.create(null);Object.keys(Ln).forEach(r=>{Ao[Ln[r]]=r});const Lf={type:"error",data:"parser error"},kg=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Mg=typeof ArrayBuffer=="function",Rg=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,sh=({type:r,data:n},s,a)=>kg&&n instanceof Blob?s?a(n):T0(n,a):Mg&&(n instanceof ArrayBuffer||Rg(n))?s?a(n):T0(new Blob([n]),a):a(Ln[r]+(n||"")),T0=(r,n)=>{const s=new FileReader;return s.onload=function(){const a=s.result.split(",")[1];n("b"+(a||""))},s.readAsDataURL(r)};function N0(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}let gf;function __(r,n){if(kg&&r.data instanceof Blob)return r.data.arrayBuffer().then(N0).then(n);if(Mg&&(r.data instanceof ArrayBuffer||Rg(r.data)))return n(N0(r.data));sh(r,!1,s=>{gf||(gf=new TextEncoder),n(gf.encode(s))})}const C0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ca=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<C0.length;r++)Ca[C0.charCodeAt(r)]=r;const w_=r=>{let n=r.length*.75,s=r.length,a,o=0,f,h,d,g;r[r.length-1]==="="&&(n--,r[r.length-2]==="="&&n--);const y=new ArrayBuffer(n),E=new Uint8Array(y);for(a=0;a<s;a+=4)f=Ca[r.charCodeAt(a)],h=Ca[r.charCodeAt(a+1)],d=Ca[r.charCodeAt(a+2)],g=Ca[r.charCodeAt(a+3)],E[o++]=f<<2|h>>4,E[o++]=(h&15)<<4|d>>2,E[o++]=(d&3)<<6|g&63;return y},S_=typeof ArrayBuffer=="function",ih=(r,n)=>{if(typeof r!="string")return{type:"message",data:Dg(r,n)};const s=r.charAt(0);return s==="b"?{type:"message",data:E_(r.substring(1),n)}:Ao[s]?r.length>1?{type:Ao[s],data:r.substring(1)}:{type:Ao[s]}:Lf},E_=(r,n)=>{if(S_){const s=w_(r);return Dg(s,n)}else return{base64:!0,data:r}},Dg=(r,n)=>{switch(n){case"blob":return r instanceof Blob?r:new Blob([r]);case"arraybuffer":default:return r instanceof ArrayBuffer?r:r.buffer}},zg="",A_=(r,n)=>{const s=r.length,a=new Array(s);let o=0;r.forEach((f,h)=>{sh(f,!1,d=>{a[h]=d,++o===s&&n(a.join(zg))})})},O_=(r,n)=>{const s=r.split(zg),a=[];for(let o=0;o<s.length;o++){const f=ih(s[o],n);if(a.push(f),f.type==="error")break}return a};function j_(){return new TransformStream({transform(r,n){__(r,s=>{const a=s.length;let o;if(a<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,a);else if(a<65536){o=new Uint8Array(3);const f=new DataView(o.buffer);f.setUint8(0,126),f.setUint16(1,a)}else{o=new Uint8Array(9);const f=new DataView(o.buffer);f.setUint8(0,127),f.setBigUint64(1,BigInt(a))}r.data&&typeof r.data!="string"&&(o[0]|=128),n.enqueue(o),n.enqueue(s)})}})}let yf;function bo(r){return r.reduce((n,s)=>n+s.length,0)}function xo(r,n){if(r[0].length===n)return r.shift();const s=new Uint8Array(n);let a=0;for(let o=0;o<n;o++)s[o]=r[0][a++],a===r[0].length&&(r.shift(),a=0);return r.length&&a<r[0].length&&(r[0]=r[0].slice(a)),s}function T_(r,n){yf||(yf=new TextDecoder);const s=[];let a=0,o=-1,f=!1;return new TransformStream({transform(h,d){for(s.push(h);;){if(a===0){if(bo(s)<1)break;const g=xo(s,1);f=(g[0]&128)===128,o=g[0]&127,o<126?a=3:o===126?a=1:a=2}else if(a===1){if(bo(s)<2)break;const g=xo(s,2);o=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),a=3}else if(a===2){if(bo(s)<8)break;const g=xo(s,8),y=new DataView(g.buffer,g.byteOffset,g.length),E=y.getUint32(0);if(E>Math.pow(2,21)-1){d.enqueue(Lf);break}o=E*Math.pow(2,32)+y.getUint32(4),a=3}else{if(bo(s)<o)break;const g=xo(s,o);d.enqueue(ih(f?g:yf.decode(g),n)),a=0}if(o===0||o>r){d.enqueue(Lf);break}}}})}const qg=4;function gt(r){if(r)return N_(r)}function N_(r){for(var n in gt.prototype)r[n]=gt.prototype[n];return r}gt.prototype.on=gt.prototype.addEventListener=function(r,n){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(n),this};gt.prototype.once=function(r,n){function s(){this.off(r,s),n.apply(this,arguments)}return s.fn=n,this.on(r,s),this};gt.prototype.off=gt.prototype.removeListener=gt.prototype.removeAllListeners=gt.prototype.removeEventListener=function(r,n){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var s=this._callbacks["$"+r];if(!s)return this;if(arguments.length==1)return delete this._callbacks["$"+r],this;for(var a,o=0;o<s.length;o++)if(a=s[o],a===n||a.fn===n){s.splice(o,1);break}return s.length===0&&delete this._callbacks["$"+r],this};gt.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var n=new Array(arguments.length-1),s=this._callbacks["$"+r],a=1;a<arguments.length;a++)n[a-1]=arguments[a];if(s){s=s.slice(0);for(var a=0,o=s.length;a<o;++a)s[a].apply(this,n)}return this};gt.prototype.emitReserved=gt.prototype.emit;gt.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]};gt.prototype.hasListeners=function(r){return!!this.listeners(r).length};const Fo=typeof Promise=="function"&&typeof Promise.resolve=="function"?n=>Promise.resolve().then(n):(n,s)=>s(n,0),bn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),C_="arraybuffer";function Ug(r,...n){return n.reduce((s,a)=>(r.hasOwnProperty(a)&&(s[a]=r[a]),s),{})}const k_=bn.setTimeout,M_=bn.clearTimeout;function Jo(r,n){n.useNativeTimers?(r.setTimeoutFn=k_.bind(bn),r.clearTimeoutFn=M_.bind(bn)):(r.setTimeoutFn=bn.setTimeout.bind(bn),r.clearTimeoutFn=bn.clearTimeout.bind(bn))}const R_=1.33;function D_(r){return typeof r=="string"?z_(r):Math.ceil((r.byteLength||r.size)*R_)}function z_(r){let n=0,s=0;for(let a=0,o=r.length;a<o;a++)n=r.charCodeAt(a),n<128?s+=1:n<2048?s+=2:n<55296||n>=57344?s+=3:(a++,s+=4);return s}function Bg(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function q_(r){let n="";for(let s in r)r.hasOwnProperty(s)&&(n.length&&(n+="&"),n+=encodeURIComponent(s)+"="+encodeURIComponent(r[s]));return n}function U_(r){let n={},s=r.split("&");for(let a=0,o=s.length;a<o;a++){let f=s[a].split("=");n[decodeURIComponent(f[0])]=decodeURIComponent(f[1])}return n}class B_ extends Error{constructor(n,s,a){super(n),this.description=s,this.context=a,this.type="TransportError"}}class rh extends gt{constructor(n){super(),this.writable=!1,Jo(this,n),this.opts=n,this.query=n.query,this.socket=n.socket,this.supportsBinary=!n.forceBase64}onError(n,s,a){return super.emitReserved("error",new B_(n,s,a)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(n){this.readyState==="open"&&this.write(n)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(n){const s=ih(n,this.socket.binaryType);this.onPacket(s)}onPacket(n){super.emitReserved("packet",n)}onClose(n){this.readyState="closed",super.emitReserved("close",n)}pause(n){}createUri(n,s={}){return n+"://"+this._hostname()+this._port()+this.opts.path+this._query(s)}_hostname(){const n=this.opts.hostname;return n.indexOf(":")===-1?n:"["+n+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(n){const s=q_(n);return s.length?"?"+s:""}}class L_ extends rh{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(n){this.readyState="pausing";const s=()=>{this.readyState="paused",n()};if(this._polling||!this.writable){let a=0;this._polling&&(a++,this.once("pollComplete",function(){--a||s()})),this.writable||(a++,this.once("drain",function(){--a||s()}))}else s()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(n){const s=a=>{if(this.readyState==="opening"&&a.type==="open"&&this.onOpen(),a.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(a)};O_(n,this.socket.binaryType).forEach(s),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const n=()=>{this.write([{type:"close"}])};this.readyState==="open"?n():this.once("open",n)}write(n){this.writable=!1,A_(n,s=>{this.doWrite(s,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const n=this.opts.secure?"https":"http",s=this.query||{};return this.opts.timestampRequests!==!1&&(s[this.opts.timestampParam]=Bg()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(n,s)}}let Lg=!1;try{Lg=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const H_=Lg;function P_(){}class $_ extends L_{constructor(n){if(super(n),typeof location<"u"){const s=location.protocol==="https:";let a=location.port;a||(a=s?"443":"80"),this.xd=typeof location<"u"&&n.hostname!==location.hostname||a!==n.port}}doWrite(n,s){const a=this.request({method:"POST",data:n});a.on("success",s),a.on("error",(o,f)=>{this.onError("xhr post error",o,f)})}doPoll(){const n=this.request();n.on("data",this.onData.bind(this)),n.on("error",(s,a)=>{this.onError("xhr poll error",s,a)}),this.pollXhr=n}}class Un extends gt{constructor(n,s,a){super(),this.createRequest=n,Jo(this,a),this._opts=a,this._method=a.method||"GET",this._uri=s,this._data=a.data!==void 0?a.data:null,this._create()}_create(){var n;const s=Ug(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;const a=this._xhr=this.createRequest(s);try{a.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){a.setDisableHeaderCheck&&a.setDisableHeaderCheck(!0);for(let o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&a.setRequestHeader(o,this._opts.extraHeaders[o])}}catch{}if(this._method==="POST")try{a.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{a.setRequestHeader("Accept","*/*")}catch{}(n=this._opts.cookieJar)===null||n===void 0||n.addCookies(a),"withCredentials"in a&&(a.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(a.timeout=this._opts.requestTimeout),a.onreadystatechange=()=>{var o;a.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.parseCookies(a.getResponseHeader("set-cookie"))),a.readyState===4&&(a.status===200||a.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof a.status=="number"?a.status:0)},0))},a.send(this._data)}catch(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=Un.requestsCount++,Un.requests[this._index]=this)}_onError(n){this.emitReserved("error",n,this._xhr),this._cleanup(!0)}_cleanup(n){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=P_,n)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Un.requests[this._index],this._xhr=null}}_onLoad(){const n=this._xhr.responseText;n!==null&&(this.emitReserved("data",n),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Un.requestsCount=0;Un.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",k0);else if(typeof addEventListener=="function"){const r="onpagehide"in bn?"pagehide":"unload";addEventListener(r,k0,!1)}}function k0(){for(let r in Un.requests)Un.requests.hasOwnProperty(r)&&Un.requests[r].abort()}const Y_=(function(){const r=Hg({xdomain:!1});return r&&r.responseType!==null})();class G_ extends $_{constructor(n){super(n);const s=n&&n.forceBase64;this.supportsBinary=Y_&&!s}request(n={}){return Object.assign(n,{xd:this.xd},this.opts),new Un(Hg,this.uri(),n)}}function Hg(r){const n=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!n||H_))return new XMLHttpRequest}catch{}if(!n)try{return new bn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Pg=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class V_ extends rh{get name(){return"websocket"}doOpen(){const n=this.uri(),s=this.opts.protocols,a=Pg?{}:Ug(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(a.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(n,s,a)}catch(o){return this.emitReserved("error",o)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=n=>this.onClose({description:"websocket connection closed",context:n}),this.ws.onmessage=n=>this.onData(n.data),this.ws.onerror=n=>this.onError("websocket error",n)}write(n){this.writable=!1;for(let s=0;s<n.length;s++){const a=n[s],o=s===n.length-1;sh(a,this.supportsBinary,f=>{try{this.doWrite(a,f)}catch{}o&&Fo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const n=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=Bg()),this.supportsBinary||(s.b64=1),this.createUri(n,s)}}const bf=bn.WebSocket||bn.MozWebSocket;class F_ extends V_{createSocket(n,s,a){return Pg?new bf(n,s,a):s?new bf(n,s):new bf(n)}doWrite(n,s){this.ws.send(s)}}class J_ extends rh{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(n){return this.emitReserved("error",n)}this._transport.closed.then(()=>{this.onClose()}).catch(n=>{this.onError("webtransport error",n)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(n=>{const s=T_(Number.MAX_SAFE_INTEGER,this.socket.binaryType),a=n.readable.pipeThrough(s).getReader(),o=j_();o.readable.pipeTo(n.writable),this._writer=o.writable.getWriter();const f=()=>{a.read().then(({done:d,value:g})=>{d||(this.onPacket(g),f())}).catch(d=>{})};f();const h={type:"open"};this.query.sid&&(h.data=`{"sid":"${this.query.sid}"}`),this._writer.write(h).then(()=>this.onOpen())})})}write(n){this.writable=!1;for(let s=0;s<n.length;s++){const a=n[s],o=s===n.length-1;this._writer.write(a).then(()=>{o&&Fo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var n;(n=this._transport)===null||n===void 0||n.close()}}const Q_={websocket:F_,webtransport:J_,polling:G_},I_=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,X_=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Hf(r){if(r.length>8e3)throw"URI too long";const n=r,s=r.indexOf("["),a=r.indexOf("]");s!=-1&&a!=-1&&(r=r.substring(0,s)+r.substring(s,a).replace(/:/g,";")+r.substring(a,r.length));let o=I_.exec(r||""),f={},h=14;for(;h--;)f[X_[h]]=o[h]||"";return s!=-1&&a!=-1&&(f.source=n,f.host=f.host.substring(1,f.host.length-1).replace(/;/g,":"),f.authority=f.authority.replace("[","").replace("]","").replace(/;/g,":"),f.ipv6uri=!0),f.pathNames=K_(f,f.path),f.queryKey=Z_(f,f.query),f}function K_(r,n){const s=/\/{2,9}/g,a=n.replace(s,"/").split("/");return(n.slice(0,1)=="/"||n.length===0)&&a.splice(0,1),n.slice(-1)=="/"&&a.splice(a.length-1,1),a}function Z_(r,n){const s={};return n.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(a,o,f){o&&(s[o]=f)}),s}const Pf=typeof addEventListener=="function"&&typeof removeEventListener=="function",Oo=[];Pf&&addEventListener("offline",()=>{Oo.forEach(r=>r())},!1);class Xs extends gt{constructor(n,s){if(super(),this.binaryType=C_,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,n&&typeof n=="object"&&(s=n,n=null),n){const a=Hf(n);s.hostname=a.host,s.secure=a.protocol==="https"||a.protocol==="wss",s.port=a.port,a.query&&(s.query=a.query)}else s.host&&(s.hostname=Hf(s.host).host);Jo(this,s),this.secure=s.secure!=null?s.secure:typeof location<"u"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=s.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(a=>{const o=a.prototype.name;this.transports.push(o),this._transportsByName[o]=a}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=U_(this.opts.query)),Pf&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Oo.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(n){const s=Object.assign({},this.opts.query);s.EIO=qg,s.transport=n,this.id&&(s.sid=this.id);const a=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[n]);return new this._transportsByName[n](a)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const n=this.opts.rememberUpgrade&&Xs.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const s=this.createTransport(n);s.open(),this.setTransport(s)}setTransport(n){this.transport&&this.transport.removeAllListeners(),this.transport=n,n.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",Xs.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",n),this.emitReserved("heartbeat"),n.type){case"open":this.onHandshake(JSON.parse(n.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const s=new Error("server error");s.code=n.data,this._onError(s);break;case"message":this.emitReserved("data",n.data),this.emitReserved("message",n.data);break}}onHandshake(n){this.emitReserved("handshake",n),this.id=n.sid,this.transport.query.sid=n.sid,this._pingInterval=n.pingInterval,this._pingTimeout=n.pingTimeout,this._maxPayload=n.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const n=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+n,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},n),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const n=this._getWritablePackets();this.transport.send(n),this._prevBufferLen=n.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let a=0;a<this.writeBuffer.length;a++){const o=this.writeBuffer[a].data;if(o&&(s+=D_(o)),a>0&&s>this._maxPayload)return this.writeBuffer.slice(0,a);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const n=Date.now()>this._pingTimeoutTime;return n&&(this._pingTimeoutTime=0,Fo(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),n}write(n,s,a){return this._sendPacket("message",n,s,a),this}send(n,s,a){return this._sendPacket("message",n,s,a),this}_sendPacket(n,s,a,o){if(typeof s=="function"&&(o=s,s=void 0),typeof a=="function"&&(o=a,a=null),this.readyState==="closing"||this.readyState==="closed")return;a=a||{},a.compress=a.compress!==!1;const f={type:n,data:s,options:a};this.emitReserved("packetCreate",f),this.writeBuffer.push(f),o&&this.once("flush",o),this.flush()}close(){const n=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),n()},a=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?a():n()}):this.upgrading?a():n()),this}_onError(n){if(Xs.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",n),this._onClose("transport error",n)}_onClose(n,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Pf&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const a=Oo.indexOf(this._offlineEventListener);a!==-1&&Oo.splice(a,1)}this.readyState="closed",this.id=null,this.emitReserved("close",n,s),this.writeBuffer=[],this._prevBufferLen=0}}}Xs.protocol=qg;class W_ extends Xs{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let n=0;n<this._upgrades.length;n++)this._probe(this._upgrades[n])}_probe(n){let s=this.createTransport(n),a=!1;Xs.priorWebsocketSuccess=!1;const o=()=>{a||(s.send([{type:"ping",data:"probe"}]),s.once("packet",w=>{if(!a)if(w.type==="pong"&&w.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",s),!s)return;Xs.priorWebsocketSuccess=s.name==="websocket",this.transport.pause(()=>{a||this.readyState!=="closed"&&(E(),this.setTransport(s),s.send([{type:"upgrade"}]),this.emitReserved("upgrade",s),s=null,this.upgrading=!1,this.flush())})}else{const j=new Error("probe error");j.transport=s.name,this.emitReserved("upgradeError",j)}}))};function f(){a||(a=!0,E(),s.close(),s=null)}const h=w=>{const j=new Error("probe error: "+w);j.transport=s.name,f(),this.emitReserved("upgradeError",j)};function d(){h("transport closed")}function g(){h("socket closed")}function y(w){s&&w.name!==s.name&&f()}const E=()=>{s.removeListener("open",o),s.removeListener("error",h),s.removeListener("close",d),this.off("close",g),this.off("upgrading",y)};s.once("open",o),s.once("error",h),s.once("close",d),this.once("close",g),this.once("upgrading",y),this._upgrades.indexOf("webtransport")!==-1&&n!=="webtransport"?this.setTimeoutFn(()=>{a||s.open()},200):s.open()}onHandshake(n){this._upgrades=this._filterUpgrades(n.upgrades),super.onHandshake(n)}_filterUpgrades(n){const s=[];for(let a=0;a<n.length;a++)~this.transports.indexOf(n[a])&&s.push(n[a]);return s}}let ew=class extends W_{constructor(n,s={}){const a=typeof n=="object"?n:s;(!a.transports||a.transports&&typeof a.transports[0]=="string")&&(a.transports=(a.transports||["polling","websocket","webtransport"]).map(o=>Q_[o]).filter(o=>!!o)),super(n,a)}};function tw(r,n="",s){let a=r;s=s||typeof location<"u"&&location,r==null&&(r=s.protocol+"//"+s.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=s.protocol+r:r=s.host+r),/^(https?|wss?):\/\//.test(r)||(typeof s<"u"?r=s.protocol+"//"+r:r="https://"+r),a=Hf(r)),a.port||(/^(http|ws)$/.test(a.protocol)?a.port="80":/^(http|ws)s$/.test(a.protocol)&&(a.port="443")),a.path=a.path||"/";const f=a.host.indexOf(":")!==-1?"["+a.host+"]":a.host;return a.id=a.protocol+"://"+f+":"+a.port+n,a.href=a.protocol+"://"+f+(s&&s.port===a.port?"":":"+a.port),a}const nw=typeof ArrayBuffer=="function",sw=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,$g=Object.prototype.toString,iw=typeof Blob=="function"||typeof Blob<"u"&&$g.call(Blob)==="[object BlobConstructor]",rw=typeof File=="function"||typeof File<"u"&&$g.call(File)==="[object FileConstructor]";function ah(r){return nw&&(r instanceof ArrayBuffer||sw(r))||iw&&r instanceof Blob||rw&&r instanceof File}function jo(r,n){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let s=0,a=r.length;s<a;s++)if(jo(r[s]))return!0;return!1}if(ah(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return jo(r.toJSON(),!0);for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)&&jo(r[s]))return!0;return!1}function aw(r){const n=[],s=r.data,a=r;return a.data=$f(s,n),a.attachments=n.length,{packet:a,buffers:n}}function $f(r,n){if(!r)return r;if(ah(r)){const s={_placeholder:!0,num:n.length};return n.push(r),s}else if(Array.isArray(r)){const s=new Array(r.length);for(let a=0;a<r.length;a++)s[a]=$f(r[a],n);return s}else if(typeof r=="object"&&!(r instanceof Date)){const s={};for(const a in r)Object.prototype.hasOwnProperty.call(r,a)&&(s[a]=$f(r[a],n));return s}return r}function lw(r,n){return r.data=Yf(r.data,n),delete r.attachments,r}function Yf(r,n){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<n.length)return n[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let s=0;s<r.length;s++)r[s]=Yf(r[s],n);else if(typeof r=="object")for(const s in r)Object.prototype.hasOwnProperty.call(r,s)&&(r[s]=Yf(r[s],n));return r}const ow=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var De;(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"})(De||(De={}));class cw{constructor(n){this.replacer=n}encode(n){return(n.type===De.EVENT||n.type===De.ACK)&&jo(n)?this.encodeAsBinary({type:n.type===De.EVENT?De.BINARY_EVENT:De.BINARY_ACK,nsp:n.nsp,data:n.data,id:n.id}):[this.encodeAsString(n)]}encodeAsString(n){let s=""+n.type;return(n.type===De.BINARY_EVENT||n.type===De.BINARY_ACK)&&(s+=n.attachments+"-"),n.nsp&&n.nsp!=="/"&&(s+=n.nsp+","),n.id!=null&&(s+=n.id),n.data!=null&&(s+=JSON.stringify(n.data,this.replacer)),s}encodeAsBinary(n){const s=aw(n),a=this.encodeAsString(s.packet),o=s.buffers;return o.unshift(a),o}}class lh extends gt{constructor(n){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof n=="function"?{reviver:n}:n)}add(n){let s;if(typeof n=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");s=this.decodeString(n);const a=s.type===De.BINARY_EVENT;a||s.type===De.BINARY_ACK?(s.type=a?De.EVENT:De.ACK,this.reconstructor=new uw(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if(ah(n)||n.base64)if(this.reconstructor)s=this.reconstructor.takeBinaryData(n),s&&(this.reconstructor=null,super.emitReserved("decoded",s));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+n)}decodeString(n){let s=0;const a={type:Number(n.charAt(0))};if(De[a.type]===void 0)throw new Error("unknown packet type "+a.type);if(a.type===De.BINARY_EVENT||a.type===De.BINARY_ACK){const f=s+1;for(;n.charAt(++s)!=="-"&&s!=n.length;);const h=n.substring(f,s);if(h!=Number(h)||n.charAt(s)!=="-")throw new Error("Illegal attachments");const d=Number(h);if(!fw(d)||d<0)throw new Error("Illegal attachments");if(d>this.opts.maxAttachments)throw new Error("too many attachments");a.attachments=d}if(n.charAt(s+1)==="/"){const f=s+1;for(;++s&&!(n.charAt(s)===","||s===n.length););a.nsp=n.substring(f,s)}else a.nsp="/";const o=n.charAt(s+1);if(o!==""&&Number(o)==o){const f=s+1;for(;++s;){const h=n.charAt(s);if(h==null||Number(h)!=h){--s;break}if(s===n.length)break}a.id=Number(n.substring(f,s+1))}if(n.charAt(++s)){const f=this.tryParse(n.substr(s));if(lh.isPayloadValid(a.type,f))a.data=f;else throw new Error("invalid payload")}return a}tryParse(n){try{return JSON.parse(n,this.opts.reviver)}catch{return!1}}static isPayloadValid(n,s){switch(n){case De.CONNECT:return M0(s);case De.DISCONNECT:return s===void 0;case De.CONNECT_ERROR:return typeof s=="string"||M0(s);case De.EVENT:case De.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&ow.indexOf(s[0])===-1);case De.ACK:case De.BINARY_ACK:return Array.isArray(s)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class uw{constructor(n){this.packet=n,this.buffers=[],this.reconPack=n}takeBinaryData(n){if(this.buffers.push(n),this.buffers.length===this.reconPack.attachments){const s=lw(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const fw=Number.isInteger||function(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r};function M0(r){return Object.prototype.toString.call(r)==="[object Object]"}const hw=Object.freeze(Object.defineProperty({__proto__:null,Decoder:lh,Encoder:cw,get PacketType(){return De}},Symbol.toStringTag,{value:"Module"}));function On(r,n,s){return r.on(n,s),function(){r.off(n,s)}}const dw=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Yg extends gt{constructor(n,s,a){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=n,this.nsp=s,a&&a.auth&&(this.auth=a.auth),this._opts=Object.assign({},a),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const n=this.io;this.subs=[On(n,"open",this.onopen.bind(this)),On(n,"packet",this.onpacket.bind(this)),On(n,"error",this.onerror.bind(this)),On(n,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...n){return n.unshift("message"),this.emit.apply(this,n),this}emit(n,...s){var a,o,f;if(dw.hasOwnProperty(n))throw new Error('"'+n.toString()+'" is a reserved event name');if(s.unshift(n),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(s),this;const h={type:De.EVENT,data:s};if(h.options={},h.options.compress=this.flags.compress!==!1,typeof s[s.length-1]=="function"){const E=this.ids++,w=s.pop();this._registerAckCallback(E,w),h.id=E}const d=(o=(a=this.io.engine)===null||a===void 0?void 0:a.transport)===null||o===void 0?void 0:o.writable,g=this.connected&&!(!((f=this.io.engine)===null||f===void 0)&&f._hasPingExpired());return this.flags.volatile&&!d||(g?(this.notifyOutgoingListeners(h),this.packet(h)):this.sendBuffer.push(h)),this.flags={},this}_registerAckCallback(n,s){var a;const o=(a=this.flags.timeout)!==null&&a!==void 0?a:this._opts.ackTimeout;if(o===void 0){this.acks[n]=s;return}const f=this.io.setTimeoutFn(()=>{delete this.acks[n];for(let d=0;d<this.sendBuffer.length;d++)this.sendBuffer[d].id===n&&this.sendBuffer.splice(d,1);s.call(this,new Error("operation has timed out"))},o),h=(...d)=>{this.io.clearTimeoutFn(f),s.apply(this,d)};h.withError=!0,this.acks[n]=h}emitWithAck(n,...s){return new Promise((a,o)=>{const f=(h,d)=>h?o(h):a(d);f.withError=!0,s.push(f),this.emit(n,...s)})}_addToQueue(n){let s;typeof n[n.length-1]=="function"&&(s=n.pop());const a={id:this._queueSeq++,tryCount:0,pending:!1,args:n,flags:Object.assign({fromQueue:!0},this.flags)};n.push((o,...f)=>(this._queue[0],o!==null?a.tryCount>this._opts.retries&&(this._queue.shift(),s&&s(o)):(this._queue.shift(),s&&s(null,...f)),a.pending=!1,this._drainQueue())),this._queue.push(a),this._drainQueue()}_drainQueue(n=!1){if(!this.connected||this._queue.length===0)return;const s=this._queue[0];s.pending&&!n||(s.pending=!0,s.tryCount++,this.flags=s.flags,this.emit.apply(this,s.args))}packet(n){n.nsp=this.nsp,this.io._packet(n)}onopen(){typeof this.auth=="function"?this.auth(n=>{this._sendConnectPacket(n)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(n){this.packet({type:De.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},n):n})}onerror(n){this.connected||this.emitReserved("connect_error",n)}onclose(n,s){this.connected=!1,delete this.id,this.emitReserved("disconnect",n,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(n=>{if(!this.sendBuffer.some(a=>String(a.id)===n)){const a=this.acks[n];delete this.acks[n],a.withError&&a.call(this,new Error("socket has been disconnected"))}})}onpacket(n){if(n.nsp===this.nsp)switch(n.type){case De.CONNECT:n.data&&n.data.sid?this.onconnect(n.data.sid,n.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case De.EVENT:case De.BINARY_EVENT:this.onevent(n);break;case De.ACK:case De.BINARY_ACK:this.onack(n);break;case De.DISCONNECT:this.ondisconnect();break;case De.CONNECT_ERROR:this.destroy();const a=new Error(n.data.message);a.data=n.data.data,this.emitReserved("connect_error",a);break}}onevent(n){const s=n.data||[];n.id!=null&&s.push(this.ack(n.id)),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(n){if(this._anyListeners&&this._anyListeners.length){const s=this._anyListeners.slice();for(const a of s)a.apply(this,n)}super.emit.apply(this,n),this._pid&&n.length&&typeof n[n.length-1]=="string"&&(this._lastOffset=n[n.length-1])}ack(n){const s=this;let a=!1;return function(...o){a||(a=!0,s.packet({type:De.ACK,id:n,data:o}))}}onack(n){const s=this.acks[n.id];typeof s=="function"&&(delete this.acks[n.id],s.withError&&n.data.unshift(null),s.apply(this,n.data))}onconnect(n,s){this.id=n,this.recovered=s&&this._pid===s,this._pid=s,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(n=>this.emitEvent(n)),this.receiveBuffer=[],this.sendBuffer.forEach(n=>{this.notifyOutgoingListeners(n),this.packet(n)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(n=>n()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:De.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(n){return this.flags.compress=n,this}get volatile(){return this.flags.volatile=!0,this}timeout(n){return this.flags.timeout=n,this}onAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(n),this}prependAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(n),this}offAny(n){if(!this._anyListeners)return this;if(n){const s=this._anyListeners;for(let a=0;a<s.length;a++)if(n===s[a])return s.splice(a,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(n),this}prependAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(n),this}offAnyOutgoing(n){if(!this._anyOutgoingListeners)return this;if(n){const s=this._anyOutgoingListeners;for(let a=0;a<s.length;a++)if(n===s[a])return s.splice(a,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(n){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const s=this._anyOutgoingListeners.slice();for(const a of s)a.apply(this,n.data)}}}function jr(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}jr.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var n=Math.random(),s=Math.floor(n*this.jitter*r);r=(Math.floor(n*10)&1)==0?r-s:r+s}return Math.min(r,this.max)|0};jr.prototype.reset=function(){this.attempts=0};jr.prototype.setMin=function(r){this.ms=r};jr.prototype.setMax=function(r){this.max=r};jr.prototype.setJitter=function(r){this.jitter=r};class Gf extends gt{constructor(n,s){var a;super(),this.nsps={},this.subs=[],n&&typeof n=="object"&&(s=n,n=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,Jo(this,s),this.reconnection(s.reconnection!==!1),this.reconnectionAttempts(s.reconnectionAttempts||1/0),this.reconnectionDelay(s.reconnectionDelay||1e3),this.reconnectionDelayMax(s.reconnectionDelayMax||5e3),this.randomizationFactor((a=s.randomizationFactor)!==null&&a!==void 0?a:.5),this.backoff=new jr({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=n;const o=s.parser||hw;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=s.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(n){return arguments.length?(this._reconnection=!!n,n||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(n){return n===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=n,this)}reconnectionDelay(n){var s;return n===void 0?this._reconnectionDelay:(this._reconnectionDelay=n,(s=this.backoff)===null||s===void 0||s.setMin(n),this)}randomizationFactor(n){var s;return n===void 0?this._randomizationFactor:(this._randomizationFactor=n,(s=this.backoff)===null||s===void 0||s.setJitter(n),this)}reconnectionDelayMax(n){var s;return n===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=n,(s=this.backoff)===null||s===void 0||s.setMax(n),this)}timeout(n){return arguments.length?(this._timeout=n,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(n){if(~this._readyState.indexOf("open"))return this;this.engine=new ew(this.uri,this.opts);const s=this.engine,a=this;this._readyState="opening",this.skipReconnect=!1;const o=On(s,"open",function(){a.onopen(),n&&n()}),f=d=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",d),n?n(d):this.maybeReconnectOnOpen()},h=On(s,"error",f);if(this._timeout!==!1){const d=this._timeout,g=this.setTimeoutFn(()=>{o(),f(new Error("timeout")),s.close()},d);this.opts.autoUnref&&g.unref(),this.subs.push(()=>{this.clearTimeoutFn(g)})}return this.subs.push(o),this.subs.push(h),this}connect(n){return this.open(n)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const n=this.engine;this.subs.push(On(n,"ping",this.onping.bind(this)),On(n,"data",this.ondata.bind(this)),On(n,"error",this.onerror.bind(this)),On(n,"close",this.onclose.bind(this)),On(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(n){try{this.decoder.add(n)}catch(s){this.onclose("parse error",s)}}ondecoded(n){Fo(()=>{this.emitReserved("packet",n)},this.setTimeoutFn)}onerror(n){this.emitReserved("error",n)}socket(n,s){let a=this.nsps[n];return a?this._autoConnect&&!a.active&&a.connect():(a=new Yg(this,n,s),this.nsps[n]=a),a}_destroy(n){const s=Object.keys(this.nsps);for(const a of s)if(this.nsps[a].active)return;this._close()}_packet(n){const s=this.encoder.encode(n);for(let a=0;a<s.length;a++)this.engine.write(s[a],n.options)}cleanup(){this.subs.forEach(n=>n()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(n,s){var a;this.cleanup(),(a=this.engine)===null||a===void 0||a.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",n,s),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const n=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const s=this.backoff.duration();this._reconnecting=!0;const a=this.setTimeoutFn(()=>{n.skipReconnect||(this.emitReserved("reconnect_attempt",n.backoff.attempts),!n.skipReconnect&&n.open(o=>{o?(n._reconnecting=!1,n.reconnect(),this.emitReserved("reconnect_error",o)):n.onreconnect()}))},s);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}}onreconnect(){const n=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",n)}}const Aa={};function To(r,n){typeof r=="object"&&(n=r,r=void 0),n=n||{};const s=tw(r,n.path||"/socket.io"),a=s.source,o=s.id,f=s.path,h=Aa[o]&&f in Aa[o].nsps,d=n.forceNew||n["force new connection"]||n.multiplex===!1||h;let g;return d?g=new Gf(a,n):(Aa[o]||(Aa[o]=new Gf(a,n)),g=Aa[o]),s.query&&!n.query&&(n.query=s.queryKey),g.socket(s.path,n)}Object.assign(To,{Manager:Gf,Socket:Yg,io:To,connect:To});const mw=T.createContext({connected:!1,subscribe:()=>()=>{}});function pw({children:r}){const n=T.useRef(null),[s,a]=T.useState(!1),o=T.useRef(new Map),f=T.useCallback((d,g)=>{const y=o.current;return y.has(d)||y.set(d,new Set),y.get(d).add(g),()=>{const E=y.get(d);E&&(E.delete(g),E.size===0&&y.delete(d))}},[]),h=T.useCallback((d,g)=>{for(const[y,E]of o.current)if(Cg(d,y))for(const w of E)try{w(g)}catch{}},[]);return T.useEffect(()=>{const d=fg(),g=To({path:`${Bn}/socket.io`,transports:["polling","websocket"],upgrade:!0,reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:2e3,...d?{auth:{token:d}}:{}});return n.current=g,console.log("[lt-socketio] connecting..."),g.on("connect",()=>{console.log("[lt-socketio] connected, id:",g.id),a(!0)}),g.on("disconnect",y=>{console.log("[lt-socketio] disconnected:",y),a(!1)}),g.on("connect_error",y=>{console.warn("[lt-socketio] connect error:",y.message),a(!1)}),g.onAny((y,E)=>{if(y.startsWith("lt."))try{const w=typeof E=="string"?JSON.parse(E):E;h(y,w)}catch{}}),()=>{g.removeAllListeners(),g.disconnect(),n.current=null,a(!1)}},[h]),m.jsx(mw.Provider,{value:{connected:s,subscribe:f},children:m.jsx(Ya.Provider,{value:{connected:s,subscribe:f},children:r})})}function gw({children:r}){const[n,s]=T.useState(null),[a,o]=T.useState({url:null,token:null});return T.useEffect(()=>{let f=!1;async function h(){var d;try{console.log("[lt-transport] detecting event transport...");const g=await fetch(`${Bn}/api/settings`);if(!g.ok){console.warn("[lt-transport] settings fetch failed, falling back to socketio"),f||s("socketio");return}const y=await g.json(),E=(d=y==null?void 0:y.events)==null?void 0:d.transport;if(console.log("[lt-transport] server reports:",E),!f){if(E==="nats"){let w=y.events.natsWsUrl??null,j=null;const z=fg();if(z)try{const M=await fetch(`${Bn}/api/nats-credentials`,{headers:{Authorization:`Bearer ${z}`}});if(M.ok){const B=await M.json();w=B.natsWsUrl??w,j=B.natsToken??null}}catch{console.warn("[lt-transport] failed to fetch NATS credentials")}o({url:w,token:j})}s(E==="nats"?"nats":"socketio")}}catch(g){console.warn("[lt-transport] settings fetch error, falling back to socketio",g),f||s("socketio")}}return h(),()=>{f=!0}},[]),n==="nats"?m.jsx(v_,{url:a.url,token:a.token,children:r}):n==="socketio"?m.jsx(pw,{children:r}):m.jsx(m.Fragment,{children:r})}const Vf="lt_ai_override";function yw(){return Xe("/settings")}function Ff(){try{if(localStorage.getItem(Vf)==="off")return!1}catch{}return null}function bw(){var s;const r=Hn({queryKey:["settings"],queryFn:yw,staleTime:1/0}),n=Ff();return r.data&&n===!1&&((s=r.data.ai)!=null&&s.enabled)?{...r,data:{...r.data,ai:{enabled:!1}}}:r}function xw(){const[r,n]=T.useState(()=>Ff()===!1),s=T.useCallback(()=>{const a=Ff()===!1;try{a?localStorage.removeItem(Vf):localStorage.setItem(Vf,"off")}catch{}n(!a),window.location.reload()},[]);return{aiOverrideActive:r,toggleAIOverride:s}}const Gg=T.createContext(null),R0="lt_sidebar_collapsed";function vw({children:r}){const[n,s]=T.useState(()=>{try{return localStorage.getItem(R0)==="true"}catch{return!1}}),a=T.useCallback(()=>{s(o=>{const f=!o;try{localStorage.setItem(R0,String(f))}catch{}return f})},[]);return m.jsx(Gg.Provider,{value:{collapsed:n,toggle:a},children:r})}function Vg(){const r=T.useContext(Gg);if(!r)throw new Error("useSidebar must be used within SidebarProvider");return r}function RE(r){const n=r?`?period=${r}`:"";return Hn({queryKey:["escalationStats",r],queryFn:()=>Xe(`/escalations/stats${n}`)})}function DE(){return Hn({queryKey:["escalationTypes"],queryFn:()=>Xe("/escalations/types")})}function _w(r){const{enabled:n=!0,...s}=r,a=new URLSearchParams;return s.status&&a.set("status",s.status),s.role&&a.set("role",s.role),s.type&&a.set("type",s.type),s.subtype&&a.set("subtype",s.subtype),s.assigned_to&&a.set("assigned_to",s.assigned_to),s.priority&&a.set("priority",String(s.priority)),s.limit&&a.set("limit",String(s.limit)),s.offset!==void 0&&a.set("offset",String(s.offset)),s.sort_by&&a.set("sort_by",s.sort_by),s.order&&a.set("order",s.order),Hn({queryKey:["escalations",s],queryFn:()=>Xe(`/escalations?${a}`),enabled:n})}function ww(r){const{enabled:n=!0,...s}=r,a=new URLSearchParams;return s.role&&a.set("role",s.role),s.type&&a.set("type",s.type),s.subtype&&a.set("subtype",s.subtype),s.priority&&a.set("priority",String(s.priority)),s.limit&&a.set("limit",String(s.limit)),s.offset!==void 0&&a.set("offset",String(s.offset)),s.sort_by&&a.set("sort_by",s.sort_by),s.order&&a.set("order",s.order),Hn({queryKey:["escalations","available",s],queryFn:()=>Xe(`/escalations/available?${a}`),enabled:n})}function zE(r){return Hn({queryKey:["escalations","by-workflow",r],queryFn:()=>Xe(`/escalations/by-workflow/${r}`),enabled:!!r})}function qE(r){return Hn({queryKey:["escalations",r],queryFn:()=>Xe(`/escalations/${r}`),enabled:!!r})}function UE(){const r=Nn();return Pn({mutationFn:({id:n,durationMinutes:s})=>Xe(`/escalations/${n}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function BE(){const r=Nn();return Pn({mutationFn:n=>Xe(`/escalations/${n}/release`,{method:"POST"}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function LE(){const r=Nn();return Pn({mutationFn:({id:n,resolverPayload:s})=>Xe(`/escalations/${n}/resolve`,{method:"POST",body:JSON.stringify({resolverPayload:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"}),r.invalidateQueries({queryKey:["tasks"],refetchType:"all"}),r.invalidateQueries({queryKey:["jobs"],refetchType:"all"})}})}function HE(){const r=Nn();return Pn({mutationFn:({id:n,targetRole:s})=>Xe(`/escalations/${n}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function PE(){const r=Nn();return Pn({mutationFn:({ids:n,priority:s})=>Xe("/escalations/priority",{method:"PATCH",body:JSON.stringify({ids:n,priority:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function $E(){const r=Nn();return Pn({mutationFn:({ids:n,durationMinutes:s})=>Xe("/escalations/bulk-claim",{method:"POST",body:JSON.stringify({ids:n,durationMinutes:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function YE(){const r=Nn();return Pn({mutationFn:({ids:n,targetUserId:s,durationMinutes:a})=>Xe("/escalations/bulk-assign",{method:"POST",body:JSON.stringify({ids:n,targetUserId:s,durationMinutes:a})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function GE(){const r=Nn();return Pn({mutationFn:({ids:n,targetRole:s})=>Xe("/escalations/bulk-escalate",{method:"PATCH",body:JSON.stringify({ids:n,targetRole:s})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function VE(){const r=Nn();return Pn({mutationFn:({ids:n,hint:s})=>Xe("/escalations/bulk-triage",{method:"POST",body:JSON.stringify({ids:n,...s?{hint:s}:{}})}),onSuccess:()=>{r.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),r.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function Sw(){const{user:r}=Oi(),n=r==null?void 0:r.userId,s=Nn(),a=T.useRef(null),o=T.useCallback(()=>{a.current||(a.current=setTimeout(()=>{a.current=null,s.invalidateQueries({queryKey:["escalations"]})},15e3))},[s]);y_(`${p_}.escalation.>`,o);const{data:f}=ww({limit:1}),{data:h}=_w({assigned_to:n,status:"pending",limit:200}),d=new Date,g=((h==null?void 0:h.escalations)??[]).filter(y=>y.assigned_until&&new Date(y.assigned_until)>d);return{available:(f==null?void 0:f.total)??0,mine:g.length}}function oh({size:r="sm",hideLabel:n=!1,className:s=""}){const a=r==="lg",o=a?"w-[16rem] h-[16rem] -rotate-[120deg] opacity-40 -ml-10":"w-[12.5rem] h-[12.5rem] -rotate-[120deg] opacity-40 -ml-8",f=a?"text-[44px] font-normal text-text-primary tracking-[0.15em] -ml-[12.5rem]":"text-[36px] font-normal text-text-primary tracking-[0.15em] -ml-[9.75rem]";return m.jsxs("div",{className:`flex items-center ${s}`,style:{height:"50px"},children:[m.jsx("img",{src:`${Bn}/logo512.png`,alt:"LongTail",className:`shrink-0 z-0 ${o}`}),m.jsx("span",{className:`z-[1] transition-opacity duration-300 ${f} ${n?"opacity-0":""}`,children:"LongTail"})]})}function Ew({onToggleEventFeed:r,onToggleDocs:n}){const{user:s,logout:a}=Oi(),{available:o,mine:f}=Sw(),{connected:h}=g_(),{toggleAIOverride:d}=xw(),[g,y]=T.useState(!1),E=T.useRef(null);return T.useEffect(()=>{if(!g)return;const w=j=>{E.current&&!E.current.contains(j.target)&&y(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[g]),m.jsxs("header",{className:"h-14 shrink-0 border-b border-surface-border bg-surface-raised flex items-center justify-between px-5 relative z-30",children:[m.jsx("div",{className:"flex items-center gap-4",children:m.jsx(gr,{to:"/","aria-label":"Home",onClick:w=>{(w.ctrlKey||w.metaKey)&&(w.preventDefault(),d())},children:m.jsx(oh,{})})}),m.jsxs("div",{className:"flex items-center gap-5",children:[m.jsxs(gr,{to:"/escalations/available",className:`flex items-center gap-1.5 text-[11px] transition-colors ${o>0?"text-blue-400 hover:text-blue-300":"text-text-quaternary hover:text-text-secondary"}`,title:"Available escalations",children:[m.jsx(wx,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"all",o>0&&m.jsx("span",{className:"tabular-nums font-medium",children:o})]}),m.jsxs(gr,{to:"/escalations/queue",className:`flex items-center gap-1.5 text-[11px] transition-colors ${f>0?"text-status-warning hover:text-amber-300":"text-text-quaternary hover:text-text-secondary"}`,title:"My escalation queue",children:[m.jsx(Sx,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"mine",f>0&&m.jsx("span",{className:"tabular-nums font-medium",children:f})]}),m.jsx("div",{className:"w-px h-4 bg-surface-border"}),m.jsxs("button",{type:"button",onClick:r,className:`flex items-center gap-1.5 text-[11px] transition-colors ${h?"text-emerald-400 hover:text-emerald-300":"text-text-quaternary hover:text-text-secondary"}`,title:h?"Live events — click to toggle feed":"Events disconnected",children:[m.jsx(ig,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"events"]}),m.jsxs("button",{onClick:n,className:"flex items-center gap-1.5 text-[11px] text-text-quaternary hover:text-text-secondary transition-colors",title:"Documentation",children:[m.jsx(rg,{className:"w-3.5 h-3.5",strokeWidth:1.5}),"docs"]}),m.jsx("div",{className:"w-px h-4 bg-surface-border"}),s&&m.jsxs("div",{className:"relative",ref:E,children:[m.jsxs("button",{onClick:()=>y(w=>!w),className:"btn-ghost text-xs flex items-center gap-1",children:[m.jsx(Ex,{className:"w-3.5 h-3.5 text-accent/75",strokeWidth:1.5}),s.displayName||s.username||s.userId,m.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),g&&m.jsxs("div",{className:"absolute right-0 top-full mt-1 w-48 bg-surface-raised border border-surface-border rounded-md shadow-lg py-1 z-50",children:[m.jsx(gr,{to:"/credentials",onClick:()=>y(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Credentials"}),m.jsx("button",{onClick:()=>{y(!1),a()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Sign Out"})]})]})]})]})}function ch({open:r,children:n}){const[s,a]=T.useState(r);return T.useEffect(()=>{r&&a(!0)},[r]),m.jsx("div",{className:`grid transition-[grid-template-rows] duration-300 ease-out ${r?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,onTransitionEnd:()=>{r||a(!1)},children:m.jsx("div",{className:"overflow-hidden",children:s?n:null})})}function Jf(r){return({isActive:n})=>{const s="flex items-center rounded-md transition-colors duration-150",a="bg-surface-hover text-text-primary font-medium",o="text-text-secondary hover:text-text-primary hover:bg-surface-hover";return r?`${s} justify-center w-10 h-10 mx-auto ${n?a:o}`:`${s} gap-3 px-4 py-2 text-sm ${n?a:o}`}}function Aw(){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 Ow({group:r,collapsed:n}){const{pathname:s}=Ws(),a=r.matchPaths.some(d=>s.startsWith(d)),[o,f]=T.useState(a),h=o||a;return n?m.jsx(m.Fragment,{children:r.items.map(d=>m.jsx(No,{to:d.to,className:Jf(!0),title:d.label,children:d.icon&&m.jsx(d.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})},d.to))}):m.jsxs("div",{children:[m.jsxs("button",{onClick:()=>f(d=>!d),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:[m.jsxs("span",{className:"flex items-center gap-3",children:[r.icon&&m.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),m.jsx("span",{children:r.label})]}),m.jsx("svg",{className:`w-3.5 h-3.5 text-text-tertiary transition-transform duration-150 ${h?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),m.jsx(ch,{open:h,children:r.items.map(d=>m.jsxs(No,{to:d.to,end:d.end,className:Aw(),children:[d.icon&&m.jsx(d.icon,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),m.jsx("span",{children:d.label})]},d.to))})]})}function jw(r){return r.kind==="group"}function Tw({entry:r,collapsed:n}){const{pathname:s,search:a}=Ws();if(r.to.includes("?")){const[f,h]=r.to.split("?"),d=s===f&&a===`?${h}`,g=Jf(n)({isActive:d});return m.jsxs(No,{to:r.to,className:g,title:n?r.label:void 0,children:[r.icon&&m.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),!n&&m.jsx("span",{children:r.label})]})}return m.jsxs(No,{to:r.to,end:r.end,className:Jf(n),title:n?r.label:void 0,children:[r.icon&&m.jsx(r.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),!n&&m.jsx("span",{children:r.label})]})}function Ga({heading:r,entries:n}){const{collapsed:s}=Vg();return m.jsxs("div",{className:"space-y-1",children:[s?m.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:r}):m.jsx("p",{className:"px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-accent/80",children:r}),n.map(a=>jw(a)?m.jsx(Ow,{group:a,collapsed:s},a.label):m.jsx(Tw,{entry:a,collapsed:s},a.to))]})}function Nw({aiEnabled:r=!1}){const n=[{to:"/",label:"Recent Activity",icon:Ax,end:!0},{to:"/capabilities",label:"Capabilities",icon:Ox},{to:"/agents",label:r?"Agents":"Automations",icon:jx},{to:"/topics",label:"Topics",icon:ig}];return m.jsx(Ga,{heading:"Work",entries:n})}function Cw(){const r=[{kind:"group",label:"Durable Workflows",icon:Cx,matchPaths:["/workflows"],items:[{to:"/workflows/registry",label:"Configure",icon:Tx},{to:"/workflows/start",label:"Invoke",icon:Nx}]},{kind:"group",label:"Executions",icon:Rx,matchPaths:["/workflows/executions","/mcp/executions"],items:[{to:"/workflows/executions",label:"Workflow",icon:kx},{to:"/mcp/executions",label:"Pipelines",icon:Mx}]}];return m.jsx(Ga,{heading:"Build",entries:r})}const kw=[{to:"/mcp/queries",label:"Designer",icon:Dx},{to:"/mcp/servers",label:"Servers & Tools",icon:zx},{to:"/mcp/workflows",label:"Pipeline Tools",icon:qx}];function Mw(){return m.jsx(Ga,{heading:"Design",entries:kw})}const Rw=[{to:"/files",label:"Files",icon:Ux},{to:"/knowledge",label:"Knowledge",icon:Bx}];function Dw(){return m.jsx(Ga,{heading:"Storage",entries:Rw})}const zw=[{kind:"group",label:"Identity & Access",icon:Px,matchPaths:["/admin/users","/admin/roles"],items:[{to:"/admin/users",label:"Accounts",icon:Lx},{to:"/admin/roles",label:"Roles & Permissions",icon:Hx}]},{kind:"group",label:"Infrastructure",icon:Vx,matchPaths:["/admin/controlplane","/admin/streams","/admin/maintenance"],items:[{to:"/admin/controlplane",label:"Routers",icon:$x},{to:"/admin/streams",label:"Messages",icon:Yx},{to:"/admin/maintenance",label:"DB Maintenance",icon:Gx}]}];function qw(){return m.jsx(Ga,{heading:"Admin",entries:zw})}const Fg="lt_event_feed_patterns";function Uw(r){if(r.startsWith("/topics/")){const n=decodeURIComponent(r.replace("/topics/",""));if(n&&!n.includes("/"))return`lt.events.${n}`}return r.startsWith("/escalations")?"lt.events.escalation.>":r.startsWith("/workflows")?"lt.events.workflow.>":r.startsWith("/agents")?"lt.events.agent.>":r.startsWith("/knowledge")?"lt.events.knowledge.>":r.startsWith("/files")?"lt.events.file.>":r==="/"?"lt.events.>":r.startsWith("/mcp")?"lt.events.activity.>":"lt.events.>"}function Bw(){try{const r=localStorage.getItem(Fg);return r?JSON.parse(r):[]}catch{return[]}}function xf(r){try{localStorage.setItem(Fg,JSON.stringify(r))}catch{}}function Lw(){const{pathname:r}=Ws(),[n,s]=T.useState(Bw),a=T.useMemo(()=>Uw(r),[r]),o=T.useMemo(()=>{const g=new Set([a,...n]);return Array.from(g)},[a,n]),f=T.useCallback(g=>{const y=g.startsWith("lt.events.")?g:`lt.events.${g}`;s(E=>{if(E.includes(y))return E;const w=[...E,y];return xf(w),w})},[]),h=T.useCallback(g=>{s(y=>{const E=y.filter(w=>w!==g);return xf(E),E})},[]),d=T.useCallback(()=>{s([]),xf([])},[]);return{patterns:o,pagePattern:a,userPatterns:n,addPattern:f,removePattern:h,clearUserPatterns:d}}function Hw({children:r,className:n=""}){return m.jsx("p",{className:`text-[10px] font-semibold uppercase tracking-widest text-text-tertiary ${n}`,children:r})}const vf=280,D0="cubic-bezier(0.4, 0, 0.2, 1)",vo=40;function Pw(r){if(!r)return"scale(0.92)";const n=window.innerWidth,s=window.innerHeight,a=n-vo*2,o=s-vo*2,f=r.width/a,h=r.height/o,d=r.left+r.width/2-(vo+a/2),g=r.top+r.height/2-(vo+o/2);return`translate(${d}px, ${g}px) scale(${f}, ${h})`}function Jg({open:r,onClose:n,sourceRef:s,children:a}){const[o,f]=T.useState(null),h=T.useRef(null),d=T.useRef(!1);T.useEffect(()=>{var j,z;r&&!d.current?(h.current=((j=s==null?void 0:s.current)==null?void 0:j.getBoundingClientRect())??null,f("entering")):!r&&d.current&&o==="open"&&(h.current=((z=s==null?void 0:s.current)==null?void 0:z.getBoundingClientRect())??null,f("exiting")),d.current=r},[r,s,o]),T.useEffect(()=>{if(o!=="entering")return;const j=requestAnimationFrame(()=>{requestAnimationFrame(()=>f("open"))});return()=>cancelAnimationFrame(j)},[o]),T.useEffect(()=>{if(o)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[o]),T.useEffect(()=>{if(!o)return;const j=z=>{z.key==="Escape"&&n()};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[o,n]);const g=T.useCallback(j=>{j.propertyName==="transform"&&o==="exiting"&&f(null)},[o]);if(T.useEffect(()=>{if(o!=="exiting")return;const j=setTimeout(()=>f(null),vf+50);return()=>clearTimeout(j)},[o]),!o)return null;const y=o==="entering"||o==="exiting",E=y?Pw(h.current):"none",w=y?0:1;return ng.createPortal(m.jsx("div",{className:"fixed inset-0 z-50 overflow-auto p-10",style:{transformOrigin:"center center",transition:`transform ${vf}ms ${D0}, opacity ${vf}ms ${D0}`,transform:E,opacity:w,backgroundColor:"#FFFFFF"},onTransitionEnd:g,children:a}),document.body)}function $w({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h8M4 18h12"})})}function Yw({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 7l-5 5 5 5M16 7l5 5-5 5"})})}function Gw({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.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 Vw({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}function Fw({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.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 Jw({className:r}){return m.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.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 Qw(r){const n=r.trim().split(`
|
|
54
|
+
`);if(n.length<2)return r;const s=d=>d.split("|").map(g=>g.trim()).filter(Boolean),a=s(n[0]),o=n.slice(2),f=a.map(d=>`<th class="px-3 py-1.5 text-left text-[10px] font-semibold uppercase tracking-wider text-text-tertiary">${d}</th>`).join(""),h=o.map(d=>`<tr class="border-t border-surface-border">${s(d).map(E=>`<td class="px-3 py-1.5 text-xs text-text-secondary">${E}</td>`).join("")}</tr>`).join("");return`<table class="w-full my-3 text-xs"><thead><tr class="border-b border-surface-border">${f}</tr></thead><tbody>${h}</tbody></table>`}function _o(r){return r.toLowerCase().replace(/<[^>]+>/g,"").replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").trim()}function Iw(r){const n=[];let s=r.replace(/```(\w*)\n([\s\S]*?)```/g,(g,y,E)=>{const w=n.length;return n.push(`<pre class="bg-surface-sunken rounded p-3 my-2 overflow-x-auto text-[11px] leading-relaxed"><code>${E}</code></pre>`),`\0CODE${w}\0`});const a=/^(\|.+\|)\n(\|[-| :]+\|)\n((?:\|.+\|\n?)+)/gm;s=s.replace(a,(g,y,E,w)=>Qw(`${y}
|
|
55
55
|
${E}
|
|
56
|
-
${w.trimEnd()}`)),s=s.replace(/`([^`]+)`/g,'<code class="bg-surface-sunken px-1 py-0.5 rounded text-[11px]">$1</code>'),s=s.replace(/^#### (.+)$/gm,(g,y)=>`<h4 id="${_o(y)}" class="text-xs font-semibold text-text-primary mt-4 mb-1">${y}</h4>`).replace(/^### (.+)$/gm,(g,y)=>`<h3 id="${_o(y)}" class="text-sm font-semibold text-text-primary mt-5 mb-1.5">${y}</h3>`).replace(/^## (.+)$/gm,(g,y)=>`<h2 id="${_o(y)}" class="text-base font-semibold text-text-primary mt-6 mb-2 pb-1 border-b border-surface-border">${y}</h2>`).replace(/^# (.+)$/gm,(g,y)=>`<h1 id="${_o(y)}" class="text-lg font-bold text-text-primary mb-3">${y}</h1>`),s=s.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(#([^)]+)\)/g,'<a data-anchor="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]*\.md(?:#[^)]*)?)\)/g,'<a data-doc-link="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent hover:underline">$1</a>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^- (.+)$/gm,'<li class="ml-4 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^\d+\. (.+)$/gm,'<li class="ml-4 list-decimal text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^---+$/gm,'<hr class="border-surface-border my-4" />').replace(/(?:^> (.+)$\n?)+/gm,g=>{const y=g.replace(/^> /gm,"").trim(),E=/⚠️|warning|caution/i.test(y),w=/note:|ℹ️|info/i.test(y);return`<div class="${E?"bg-status-warning/5":w?"bg-accent/5":"bg-surface-sunken/50"} ${E?"border-status-warning":w?"border-accent":"border-text-tertiary"} border-l-2 rounded-r-md px-3 py-2 my-3 text-xs text-text-secondary leading-relaxed">${y}</div>`}).replace(/\n\n/g,"\0PARA\0").replace(/\n/g,"<br/>");const o=g=>g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),f=g=>new RegExp(`(${o(g)}[\\s\\S]*?<\\/li>(?:<br\\/>)?)+`,"g");s=s.replace(f('<li class="ml-8 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(f('<li class="ml-4 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(f('<li class="ml-4 list-decimal'),g=>`<ol class="list-decimal mb-3">${g}</ol>`),s=s.replace(/\x00CODE(\d+)\x00/g,(g,y)=>n[parseInt(y,10)]);const h="text-xs leading-relaxed text-text-secondary mb-2",d=/<\/(h[1-4]|pre|table|ul|ol|hr|div)>/;return s=s.split("\0PARA\0").map(g=>{const y=g.trim();if(!y)return"";const E=[];let w=y,j;for(;(j=d.exec(w))!==null;){const z=j.index+j[0].length;E.push(w.slice(0,z)),w=w.slice(z).replace(/^<br\/>/,"").trim(),d.lastIndex=0}return w&&E.push(w),E.map(z=>{const M=z.trim();return M?/^\s*<(h[1-4]|pre|table|ul|ol|hr|div)/.test(M)?M:`<p class="${h}">${M}</p>`:""}).join("")}).join(""),s}const Yw=/(\*\*|^#{1,4}\s|^- |^\d+\.\s|```|^\|.*\|$|\[.+\]\(.+\))/m;function Gw(r){return Yw.test(r)}function dh({content:r,className:n,onClick:s}){const a=T.useMemo(()=>$w(r),[r]);return m.jsx("div",{className:n,onClick:s,dangerouslySetInnerHTML:{__html:a}})}function Bo({data:r,depth:n=0,generation:s}){const o=s!==void 0&&s>0&&s%2===1?!1:n>0,[f,h]=T.useState(o),[d,g]=T.useState(s);if(s!==void 0&&s!==d&&(g(s),h(s%2===0&&n>0)),r==null)return m.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof r=="string")return m.jsxs("span",{className:"text-text-primary",children:['"',r,'"']});if(typeof r=="number"||typeof r=="boolean")return m.jsx("span",{className:"text-text-primary font-medium",children:String(r)});if(Array.isArray(r))return r.length===0?m.jsx("span",{className:"text-text-tertiary",children:"[]"}):f?m.jsxs("button",{onClick:()=>h(!1),className:"text-text-secondary hover:text-text-primary",children:["[",r.length," items]"]}):m.jsxs("span",{children:[m.jsx("button",{onClick:()=>h(!0),className:"text-text-tertiary hover:text-text-primary",children:"["}),m.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:r.map((y,E)=>m.jsxs("div",{children:[m.jsx(Bo,{data:y,depth:n+1,generation:s}),E<r.length-1&&m.jsx("span",{className:"text-text-tertiary",children:","})]},E))}),m.jsx("span",{className:"text-text-tertiary",children:"]"})]});if(typeof r=="object"){const y=Object.entries(r);return y.length===0?m.jsx("span",{className:"text-text-tertiary",children:"{}"}):f?m.jsxs("button",{onClick:()=>h(!1),className:"text-text-secondary hover:text-text-primary",children:["{","...","}"]}):m.jsxs("span",{children:[m.jsx("button",{onClick:()=>h(!0),className:"text-text-tertiary hover:text-text-primary",children:"{"}),m.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:y.map(([E,w],j)=>m.jsxs("div",{children:[m.jsx("span",{className:"text-text-secondary",children:E}),m.jsx("span",{className:"text-text-tertiary",children:": "}),m.jsx(Bo,{data:w,depth:n+1,generation:s}),j<y.length-1&&m.jsx("span",{className:"text-text-tertiary",children:","})]},E))}),m.jsx("span",{className:"text-text-tertiary",children:"}"})]})}return m.jsx("span",{children:String(r)})}function qa({data:r,depth:n=0}){if(r==null)return m.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof r=="string")return r.length>40&&Gw(r)?m.jsx(dh,{content:r}):m.jsx("span",{className:"text-text-primary",children:r});if(typeof r=="number"||typeof r=="boolean")return m.jsx("span",{className:"text-text-primary font-medium",children:String(r)});if(Array.isArray(r))return r.length===0?m.jsx("span",{className:"text-text-tertiary italic",children:"empty list"}):m.jsx("div",{className:"space-y-2",children:r.map((s,a)=>m.jsxs("div",{className:"flex items-baseline gap-2",children:[m.jsxs("span",{className:"text-text-tertiary text-[10px] shrink-0",children:[a+1,"."]}),m.jsx("div",{className:"flex-1",children:m.jsx(qa,{data:s,depth:n+1})})]},a))});if(typeof r=="object"){const s=Object.entries(r);return s.length===0?m.jsx("span",{className:"text-text-tertiary italic",children:"empty"}):m.jsx("div",{className:n>0?"pl-4 border-l border-surface-border space-y-3":"space-y-3",children:s.map(([a,o])=>{const f=o===null||typeof o!="object";return m.jsxs("div",{children:[m.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-0.5",children:a.replace(/[_-]/g," ")}),f?m.jsx("p",{className:"text-sm text-text-primary",children:m.jsx(qa,{data:o,depth:n+1})}):m.jsx(qa,{data:o,depth:n+1})]},a)})})}return m.jsx("span",{children:String(r)})}function B0({mode:r,setMode:n,isCollapsed:s,onToggleCollapse:a,onCopy:o,copied:f,onFullscreen:h,onClose:d,large:g}){const y=g?"w-5 h-5":"w-3.5 h-3.5",E=`${g?"p-2":"p-1.5"} rounded text-text-tertiary hover:text-text-primary hover:bg-surface-raised transition-colors duration-150`;return m.jsxs("div",{className:"flex items-center gap-0.5 bg-surface-sunken/80 rounded-md backdrop-blur-sm",children:[r==="json"&&m.jsx("button",{onClick:a,className:E,title:s?"Expand all":"Collapse all",children:s?m.jsx(Hw,{className:y}):m.jsx(Lw,{className:y})}),m.jsx("button",{onClick:()=>n(r==="json"?"tree":"json"),className:E,title:r==="json"?"Outline view":"JSON view",children:r==="json"?m.jsx(zw,{className:y}):m.jsx(qw,{className:y})}),m.jsx("button",{onClick:o,className:E,title:"Copy to clipboard",children:f?m.jsx(Bw,{className:`${y} text-status-success`}):m.jsx(Uw,{className:y})}),h&&m.jsx("button",{onClick:h,className:E,title:"Fullscreen",children:m.jsx(ug,{className:y})}),d&&m.jsx("button",{onClick:d,className:E,title:"Close (Esc)",children:m.jsx(fg,{className:y})})]})}function Vw({data:r,label:n,variant:s,defaultCollapsed:a=!1,defaultMode:o}){const f=T.useRef(null),[h,d]=T.useState(o??"json"),[g,y]=T.useState(!1),[E,w]=T.useState(!1),[j,z]=T.useState(a?0:1),[M,B]=T.useState(1),V=j%2===0,ne=M%2===0,ee=T.useCallback(()=>z(Z=>Z+1),[]),pe=T.useCallback(()=>B(Z=>Z+1),[]);let ae=r;if(typeof r=="string")try{ae=JSON.parse(r)}catch{}const k=async()=>{const Z=typeof r=="string"?r:JSON.stringify(ae,null,2);await navigator.clipboard.writeText(Z),y(!0),setTimeout(()=>y(!1),2e3)},X=T.useCallback(()=>{B(1),w(!0)},[]),se=s==="panel",W=se?"border border-accent-muted/40 rounded-lg p-3 bg-surface-hover/30":"",F=se?"font-mono text-xs leading-relaxed bg-white rounded-md p-4 overflow-x-auto break-all":"font-mono text-xs leading-relaxed bg-surface-sunken rounded-md p-4 overflow-x-auto break-all";return m.jsxs("div",{className:W,children:[n&&m.jsx(Rw,{children:n}),m.jsxs("div",{ref:f,className:"relative",children:[m.jsx("div",{className:"absolute top-2 right-2 z-[5]",children:m.jsx(B0,{mode:h,setMode:d,isCollapsed:V,onToggleCollapse:ee,onCopy:k,copied:g,onFullscreen:X})}),m.jsx("div",{className:F,children:h==="json"?m.jsx(Bo,{data:ae,generation:j}):m.jsx(qa,{data:ae})})]}),m.jsxs(Xg,{open:E,onClose:()=>w(!1),sourceRef:f,children:[m.jsx("div",{className:"sticky top-0 float-right z-10",children:m.jsx(B0,{mode:h,setMode:d,isCollapsed:ne,onToggleCollapse:pe,onCopy:k,copied:g,onClose:()=>w(!1),large:!0})}),m.jsx("div",{className:"font-mono text-sm leading-relaxed",children:h==="json"?m.jsx(Bo,{data:ae,generation:M}):m.jsx(qa,{data:ae})})]})]})}const Fw=100,L0=500;let Jw=0;const Kg={"escalation.created":"text-status-warning","escalation.claimed":"text-blue-400","escalation.released":"text-text-tertiary","escalation.resolved":"text-status-success","task.created":"text-accent","task.completed":"text-status-success","task.failed":"text-status-error","task.escalated":"text-status-warning","workflow.started":"text-accent","workflow.completed":"text-status-success","workflow.failed":"text-status-error","activity.started":"text-blue-400","activity.completed":"text-status-success","activity.failed":"text-status-error","knowledge.stored":"text-violet-400","knowledge.deleted":"text-text-tertiary","agent.started":"text-accent","agent.completed":"text-status-success","agent.failed":"text-status-error","agent.status_changed":"text-blue-400",milestone:"text-violet-400"};function H0({event:r,forceExpanded:n=!1}){var j,z;const[s,a]=T.useState(n),o=Kg[r.type]||"text-text-tertiary";T.useEffect(()=>{a(n)},[n]);const f=n,h=f?"text-xs":"text-[9px]",d=f?"text-xs":"text-[9px]",g=f?"text-xs":"text-[9px]",y=f?"w-3.5 h-3.5":"w-2.5 h-2.5",E=f?"py-2 px-4":"py-1 px-3",w=f?"pb-4 px-4":"pb-2 px-3";return m.jsxs("div",{className:"border-b border-surface-border/30 last:border-b-0",children:[m.jsxs("button",{onClick:()=>a(!s),className:`flex items-center gap-2 ${E} w-full text-left hover:bg-surface-hover/50 transition-colors`,children:[m.jsx("span",{className:`${h} font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0`,children:new Date(r.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),m.jsx("span",{className:`${d} font-medium px-1 py-0.5 rounded ${o} bg-surface-sunken whitespace-nowrap shrink-0`,children:r.type}),m.jsxs("span",{className:`${g} text-text-tertiary font-mono flex-1 min-w-0 truncate`,children:[(j=r.data)!=null&&j.workflowId?String(r.data.workflowId):"",(z=r.data)!=null&&z.escalationId?` esc:${String(r.data.escalationId).slice(0,12)}`:""]}),m.jsx("svg",{className:`${y} text-text-tertiary shrink-0 transition-transform duration-150 ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),m.jsx(hh,{open:s,children:m.jsx("div",{className:w,children:m.jsx(Vw,{data:r.data})})})]})}function Qw({open:r,onToggle:n,configOpen:s,onToggleConfig:a}){const[o,f]=T.useState([]),[h,d]=T.useState(!1),[g,y]=T.useState(""),E=T.useRef(null),w=T.useRef(new Map),{subscribe:j}=T.useContext(Ga),{patterns:z,pagePattern:M,userPatterns:B,addPattern:V,removePattern:ne}=Mw(),ee=T.useCallback(ae=>{const k=String(ae.type||"unknown");if(k.startsWith("mesh."))return;const X=`${k}:${ae.timestamp||""}:${ae.escalationId||ae.workflowId||ae.taskId||""}`,se=Date.now(),W=w.current.get(X);if(!(W&&se-W<L0)){if(w.current.set(X,se),w.current.size>200)for(const[F,Z]of w.current)se-Z>L0*2&&w.current.delete(F);f(F=>[{id:++Jw,type:k,timestamp:ae.timestamp||new Date().toISOString(),data:ae},...F].slice(0,Fw))}},[]),pe=T.useRef(ee);return pe.current=ee,T.useEffect(()=>{const ae=z.map(k=>j(k,X=>pe.current(X)));return()=>ae.forEach(k=>k())},[j,z.join(",")]),T.useEffect(()=>{r&&E.current&&(E.current.scrollTop=0)},[o.length,r]),m.jsxs("div",{className:"shrink-0 border-t border-surface-border bg-surface-raised",children:[m.jsxs("button",{onClick:n,className:"flex items-center gap-2 w-full px-4 py-1.5 text-left hover:bg-surface-hover transition-colors",children:[r?m.jsx(Px,{className:"w-3 h-3 text-text-tertiary"}):m.jsx($x,{className:"w-3 h-3 text-text-tertiary"}),m.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:"Event Stream"}),o.length>0&&m.jsxs("span",{className:"text-[9px] text-text-tertiary",children:[o.length," events"]}),o.length>0&&!r&&m.jsx("span",{className:`text-[9px] font-medium px-1 py-0.5 rounded ${Kg[o[0].type]||"text-text-tertiary"} bg-surface-sunken`,children:o[0].type}),m.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[m.jsx("span",{className:`p-0.5 cursor-pointer ${s?"text-accent":"text-text-tertiary hover:text-text-primary"}`,title:"Subscription config",onClick:ae=>{ae.stopPropagation(),a()},children:m.jsx(Yx,{className:"w-3 h-3"})}),o.length>0&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Fullscreen",onClick:ae=>{ae.stopPropagation(),d(!0)},children:m.jsx(ug,{className:"w-3 h-3"})}),m.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Clear events",onClick:ae=>{ae.stopPropagation(),f([])},children:m.jsx(Gx,{className:"w-3 h-3"})})]})]})]}),s&&m.jsxs("div",{className:"px-4 py-2 border-t border-surface-border/50 bg-surface-sunken/30",children:[m.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mb-1.5",children:[m.jsx("span",{className:"text-[9px] text-text-quaternary uppercase tracking-wider shrink-0",children:"Subscribed:"}),m.jsx("span",{className:"text-[9px] font-mono text-accent px-1.5 py-0.5 bg-accent/10 rounded",children:M.replace("lt.events.","")}),B.map(ae=>m.jsxs("span",{className:"inline-flex items-center gap-1 text-[9px] font-mono text-text-secondary px-1.5 py-0.5 bg-surface-sunken rounded",children:[ae.replace("lt.events.",""),m.jsx("button",{onClick:()=>ne(ae),className:"text-text-quaternary hover:text-status-error",children:m.jsx(Po,{className:"w-2 h-2"})})]},ae))]}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("input",{type:"text",value:g,onChange:ae=>y(ae.target.value),onKeyDown:ae=>{ae.key==="Enter"&&g.trim()&&(V(g.trim()),y(""))},placeholder:"task.> or file.stored",className:"input text-[10px] font-mono flex-1 py-1"}),m.jsxs("button",{onClick:()=>{g.trim()&&(V(g.trim()),y(""))},className:"text-[10px] text-accent hover:text-accent-hover flex items-center gap-0.5",children:[m.jsx(Vx,{className:"w-2.5 h-2.5"})," Add"]})]})]}),m.jsx(hh,{open:r,children:m.jsx("div",{ref:E,className:"h-48 overflow-y-auto",children:o.length===0?m.jsx("p",{className:"text-[10px] text-text-tertiary py-4 text-center",children:"Waiting for events..."}):o.map(ae=>m.jsx(H0,{event:ae},ae.id))})}),m.jsxs(Xg,{open:h,onClose:()=>d(!1),sourceRef:E,children:[m.jsx("div",{className:"sticky top-0 float-right z-10",children:m.jsx("button",{onClick:()=>d(!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:m.jsx(fg,{className:"w-5 h-5"})})}),o.length===0?m.jsx("p",{className:"text-sm text-text-tertiary py-8",children:"No events captured"}):o.map(ae=>m.jsx(H0,{event:ae,forceExpanded:!0},ae.id))]})]})}function Iw(){return Hn({queryKey:["docs"],queryFn:()=>Xe("/docs"),staleTime:5*6e4})}function Xw(r){return Hn({queryKey:["docs",r],queryFn:()=>Xe(`/docs/read?path=${encodeURIComponent(r)}`),enabled:!!r,staleTime:5*6e4})}function Kw(){const[r,n]=T.useState([]),[s,a]=T.useState([]),[o,f]=T.useState(null),h=T.useRef(o),d=T.useRef(r),g=T.useRef(s);h.current=o,d.current=r,g.current=s;const y=T.useCallback((M,B)=>{var ne;const V=h.current;if(V){const ee=((ne=B==null?void 0:B.current)==null?void 0:ne.scrollTop)??0;n([...d.current,{...V,scrollTop:ee}])}a([]),f({path:M,scrollTop:0})},[]),E=T.useCallback(M=>{var ee;const B=d.current;if(B.length===0)return;const V=B[B.length-1],ne=h.current;if(ne){const pe=((ee=M==null?void 0:M.current)==null?void 0:ee.scrollTop)??0;a([...g.current,{...ne,scrollTop:pe}])}n(B.slice(0,-1)),f(V),requestAnimationFrame(()=>{M!=null&&M.current&&(M.current.scrollTop=V.scrollTop)})},[]),w=T.useCallback(M=>{var ee;const B=g.current;if(B.length===0)return;const V=B[B.length-1],ne=h.current;if(ne){const pe=((ee=M==null?void 0:M.current)==null?void 0:ee.scrollTop)??0;n([...d.current,{...ne,scrollTop:pe}])}a(B.slice(0,-1)),f(V),requestAnimationFrame(()=>{M!=null&&M.current&&(M.current.scrollTop=V.scrollTop)})},[]),j=T.useCallback(M=>{var ne,ee;const B=h.current;if(!B)return;const V=((ne=M==null?void 0:M.current)==null?void 0:ne.scrollTop)??0;n([...d.current,{...B,scrollTop:V}]),a([]),f({...B,scrollTop:((ee=M==null?void 0:M.current)==null?void 0:ee.scrollTop)??0})},[]),z=T.useCallback(()=>{n([]),a([]),f(null)},[]);return{current:o,backStack:r,forwardStack:s,navigate:y,goBack:E,goForward:w,pushScrollPosition:j,reset:z}}function Zw(r,n){const[s,a]=r.split("#");let o=s;if(o.startsWith("./")||o.startsWith("../")){const h=((n?n.replace(/[^/]+$/,""):"")+o).split("/"),d=[];for(const g of h)g===".."?d.pop():g&&g!=="."&&d.push(g);o=d.join("/")}return{path:o,anchor:a}}function Ww(r){if(!r.startsWith("#docs"))return null;const n=r.slice(1).split(":"),s=n[1]||"README.md",a=n[2]||void 0;return{path:s,anchor:a}}function e2(r){return!r||r==="README.md"?"#docs":`#docs:${r}`}function t2({content:r,currentPath:n,onNavigate:s,onAnchorClick:a}){const o=f=>{var y;const h=f.target,d=h.closest("[data-anchor]");if(d){f.preventDefault(),a();const E=d.dataset.anchor,w=(y=d.closest(".docs-content"))==null?void 0:y.querySelector(`#${CSS.escape(E)}`);w==null||w.scrollIntoView({behavior:"smooth",block:"start"});return}const g=h.closest("[data-doc-link]");if(g){f.preventDefault();const{path:E,anchor:w}=Zw(g.dataset.docLink,n);s(E,w);return}};return m.jsx(dh,{content:r,className:"docs-content",onClick:o})}function n2(r){const n=[],s=new Map;for(const a of r){const o=a.path.split("/");if(o.length===1){n.push(a);continue}let f=s;for(let h=0;h<o.length-1;h++){const d=o[h];f.has(d)||f.set(d,{label:d,children:[],subdirs:new Map});const g=f.get(d);h===o.length-2?g.children.push(a):f=g.subdirs}}return{topLevel:n,dirs:s}}function s2({docs:r,selected:n,onSelect:s}){const{topLevel:a,dirs:o}=n2(r),f=d=>`block w-full text-left px-3 py-1 text-xs rounded truncate transition-colors ${n===d?"bg-accent/10 text-accent":"text-text-secondary hover:bg-surface-hover"}`;function h(d,g){return m.jsxs("details",{open:!0,children:[m.jsxs("summary",{className:"flex items-center gap-1.5 px-3 py-1 text-[10px] font-semibold uppercase tracking-widest text-text-tertiary cursor-pointer",children:[m.jsx(Fx,{className:"w-3 h-3",strokeWidth:1.5}),d.label]}),m.jsxs("div",{className:"pl-2 space-y-0.5",children:[[...d.subdirs.values()].map(y=>h(y)),d.children.map(y=>m.jsx("button",{className:f(y.path),onClick:()=>s(y.path),children:y.title},y.path))]})]},d.label)}return m.jsxs("div",{className:"space-y-0.5",children:[a.map(d=>m.jsx("button",{className:f(d.path),onClick:()=>s(d.path),children:d.title},d.path)),[...o.values()].map(d=>h(d))]})}function i2({open:r,onClose:n}){var se,W,F;const[s,a]=T.useState(!1),{data:o}=Iw(),f=Kw(),{data:h,isLoading:d}=Xw(((se=f.current)==null?void 0:se.path)??null),g=T.useRef(null),[y,E]=T.useState(null);T.useEffect(()=>{y&&(h!=null&&h.content)&&g.current&&requestAnimationFrame(()=>{var le;const Z=(le=g.current)==null?void 0:le.querySelector(`#${CSS.escape(y)}`);Z==null||Z.scrollIntoView({behavior:"smooth",block:"start"}),E(null)})},[y,h]);const w=T.useCallback(()=>{var re;const Z=Ww(window.location.hash),le=(Z==null?void 0:Z.path)??"README.md";((re=f.current)==null?void 0:re.path)!==le&&f.navigate(le,g),Z!=null&&Z.anchor&&E(Z.anchor)},[f]),j=T.useRef(!0);T.useEffect(()=>{if(!r||!f.current)return;if(j.current){j.current=!1;return}const Z=e2(f.current.path);window.location.hash!==Z&&window.history.replaceState(null,"",window.location.pathname+window.location.search+Z)},[r,(W=f.current)==null?void 0:W.path]),T.useEffect(()=>{if(!r)return;const Z=()=>{window.location.hash.startsWith("#docs")&&w()};return window.addEventListener("hashchange",Z),()=>window.removeEventListener("hashchange",Z)},[r,w]);const z=T.useCallback((Z,le)=>{le&&E(le),f.navigate(Z,g)},[f]),M=T.useCallback(Z=>{f.navigate(Z,g)},[f]),B=T.useCallback(()=>{f.goBack(g)},[f]),V=T.useCallback(()=>{f.goForward(g)},[f]),ne=T.useCallback(()=>{f.pushScrollPosition(g)},[f]);if(T.useEffect(()=>{if(r){j.current=!0,w();const Z=requestAnimationFrame(()=>a(!0));return()=>cancelAnimationFrame(Z)}},[r]),!(r||s))return null;const pe=()=>{a(!1),setTimeout(()=>{n(),f.reset()},200)},ae=((F=f.current)==null?void 0:F.path)??null,k=f.backStack.length>0,X=f.forwardStack.length>0;return m.jsxs("div",{className:"fixed inset-y-0 right-0 z-50 flex",children:[m.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${s&&r?"opacity-100":"opacity-0"}`,onClick:pe}),m.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:[m.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border shrink-0",children:[m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx("button",{onClick:B,disabled:!k,className:`p-0.5 transition-colors ${k?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Back",children:m.jsx(Jx,{className:"w-4 h-4"})}),m.jsx("button",{onClick:V,disabled:!X,className:`p-0.5 transition-colors ${X?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Forward",children:m.jsx(e0,{className:"w-4 h-4"})}),m.jsx(og,{className:"w-4 h-4 text-accent ml-1",strokeWidth:1.5}),m.jsx("span",{className:"text-sm font-medium text-text-primary",children:"Documentation"})]}),m.jsx("button",{onClick:pe,className:"p-1 text-text-tertiary hover:text-text-primary",children:m.jsx(Po,{className:"w-4 h-4"})})]}),m.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[m.jsx("div",{className:"w-48 shrink-0 border-r border-surface-border overflow-y-auto py-2",children:o!=null&&o.docs?m.jsx(s2,{docs:o.docs,selected:ae,onSelect:M}):m.jsx("div",{className:"px-3 py-2 text-xs text-text-tertiary",children:"Loading..."})}),m.jsx("div",{ref:g,className:"flex-1 overflow-y-auto px-6 py-4",children:ae?d?m.jsxs("div",{className:"animate-pulse space-y-2",children:[m.jsx("div",{className:"h-6 bg-surface-sunken rounded w-48"}),m.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),m.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"})]}):h!=null&&h.content?m.jsx(t2,{content:h.content,currentPath:ae,onNavigate:z,onAnchorClick:ne}):m.jsx("p",{className:"text-xs text-text-tertiary",children:"Document not found."}):m.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-text-tertiary",children:[m.jsx(e0,{className:"w-5 h-5 mb-2"}),m.jsx("p",{className:"text-xs",children:"Select a document"})]})})]})]})]})}function r2(r){if(r.includes("/escalations"))return["escalation","human-queue"]}const P0=2e3;function a2(r){const s=r.filter(o=>!o.pending).slice(-8);return s.length===0?"":`[Prior conversation]
|
|
56
|
+
${w.trimEnd()}`)),s=s.replace(/`([^`]+)`/g,'<code class="bg-surface-sunken px-1 py-0.5 rounded text-[11px]">$1</code>'),s=s.replace(/^#### (.+)$/gm,(g,y)=>`<h4 id="${_o(y)}" class="text-xs font-semibold text-text-primary mt-4 mb-1">${y}</h4>`).replace(/^### (.+)$/gm,(g,y)=>`<h3 id="${_o(y)}" class="text-sm font-semibold text-text-primary mt-5 mb-1.5">${y}</h3>`).replace(/^## (.+)$/gm,(g,y)=>`<h2 id="${_o(y)}" class="text-base font-semibold text-text-primary mt-6 mb-2 pb-1 border-b border-surface-border">${y}</h2>`).replace(/^# (.+)$/gm,(g,y)=>`<h1 id="${_o(y)}" class="text-lg font-bold text-text-primary mb-3">${y}</h1>`),s=s.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(#([^)]+)\)/g,'<a data-anchor="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]*\.md(?:#[^)]*)?)\)/g,'<a data-doc-link="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent hover:underline">$1</a>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^- (.+)$/gm,'<li class="ml-4 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^\d+\. (.+)$/gm,'<li class="ml-4 list-decimal text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^---+$/gm,'<hr class="border-surface-border my-4" />').replace(/(?:^> (.+)$\n?)+/gm,g=>{const y=g.replace(/^> /gm,"").trim(),E=/⚠️|warning|caution/i.test(y),w=/note:|ℹ️|info/i.test(y);return`<div class="${E?"bg-status-warning/5":w?"bg-accent/5":"bg-surface-sunken/50"} ${E?"border-status-warning":w?"border-accent":"border-text-tertiary"} border-l-2 rounded-r-md px-3 py-2 my-3 text-xs text-text-secondary leading-relaxed">${y}</div>`}).replace(/\n\n/g,"\0PARA\0").replace(/\n/g,"<br/>");const o=g=>g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),f=g=>new RegExp(`(${o(g)}[\\s\\S]*?<\\/li>(?:<br\\/>)?)+`,"g");s=s.replace(f('<li class="ml-8 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(f('<li class="ml-4 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(f('<li class="ml-4 list-decimal'),g=>`<ol class="list-decimal mb-3">${g}</ol>`),s=s.replace(/\x00CODE(\d+)\x00/g,(g,y)=>n[parseInt(y,10)]);const h="text-xs leading-relaxed text-text-secondary mb-2",d=/<\/(h[1-4]|pre|table|ul|ol|hr|div)>/;return s=s.split("\0PARA\0").map(g=>{const y=g.trim();if(!y)return"";const E=[];let w=y,j;for(;(j=d.exec(w))!==null;){const z=j.index+j[0].length;E.push(w.slice(0,z)),w=w.slice(z).replace(/^<br\/>/,"").trim(),d.lastIndex=0}return w&&E.push(w),E.map(z=>{const M=z.trim();return M?/^\s*<(h[1-4]|pre|table|ul|ol|hr|div)/.test(M)?M:`<p class="${h}">${M}</p>`:""}).join("")}).join(""),s}const Xw=/(\*\*|^#{1,4}\s|^- |^\d+\.\s|```|^\|.*\|$|\[.+\]\(.+\))/m;function Kw(r){return Xw.test(r)}function uh({content:r,className:n,onClick:s}){const a=T.useMemo(()=>Iw(r),[r]);return m.jsx("div",{className:n,onClick:s,dangerouslySetInnerHTML:{__html:a}})}function Bo({data:r,depth:n=0,generation:s}){const o=s!==void 0&&s>0&&s%2===1?!1:n>0,[f,h]=T.useState(o),[d,g]=T.useState(s);if(s!==void 0&&s!==d&&(g(s),h(s%2===0&&n>0)),r==null)return m.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof r=="string")return m.jsxs("span",{className:"text-text-primary",children:['"',r,'"']});if(typeof r=="number"||typeof r=="boolean")return m.jsx("span",{className:"text-text-primary font-medium",children:String(r)});if(Array.isArray(r))return r.length===0?m.jsx("span",{className:"text-text-tertiary",children:"[]"}):f?m.jsxs("button",{onClick:()=>h(!1),className:"text-text-secondary hover:text-text-primary",children:["[",r.length," items]"]}):m.jsxs("span",{children:[m.jsx("button",{onClick:()=>h(!0),className:"text-text-tertiary hover:text-text-primary",children:"["}),m.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:r.map((y,E)=>m.jsxs("div",{children:[m.jsx(Bo,{data:y,depth:n+1,generation:s}),E<r.length-1&&m.jsx("span",{className:"text-text-tertiary",children:","})]},E))}),m.jsx("span",{className:"text-text-tertiary",children:"]"})]});if(typeof r=="object"){const y=Object.entries(r);return y.length===0?m.jsx("span",{className:"text-text-tertiary",children:"{}"}):f?m.jsxs("button",{onClick:()=>h(!1),className:"text-text-secondary hover:text-text-primary",children:["{","...","}"]}):m.jsxs("span",{children:[m.jsx("button",{onClick:()=>h(!0),className:"text-text-tertiary hover:text-text-primary",children:"{"}),m.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:y.map(([E,w],j)=>m.jsxs("div",{children:[m.jsx("span",{className:"text-text-secondary",children:E}),m.jsx("span",{className:"text-text-tertiary",children:": "}),m.jsx(Bo,{data:w,depth:n+1,generation:s}),j<y.length-1&&m.jsx("span",{className:"text-text-tertiary",children:","})]},E))}),m.jsx("span",{className:"text-text-tertiary",children:"}"})]})}return m.jsx("span",{children:String(r)})}function za({data:r,depth:n=0}){if(r==null)return m.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof r=="string")return r.length>40&&Kw(r)?m.jsx(uh,{content:r}):m.jsx("span",{className:"text-text-primary",children:r});if(typeof r=="number"||typeof r=="boolean")return m.jsx("span",{className:"text-text-primary font-medium",children:String(r)});if(Array.isArray(r))return r.length===0?m.jsx("span",{className:"text-text-tertiary italic",children:"empty list"}):m.jsx("div",{className:"space-y-2",children:r.map((s,a)=>m.jsxs("div",{className:"flex items-baseline gap-2",children:[m.jsxs("span",{className:"text-text-tertiary text-[10px] shrink-0",children:[a+1,"."]}),m.jsx("div",{className:"flex-1",children:m.jsx(za,{data:s,depth:n+1})})]},a))});if(typeof r=="object"){const s=Object.entries(r);return s.length===0?m.jsx("span",{className:"text-text-tertiary italic",children:"empty"}):m.jsx("div",{className:n>0?"pl-4 border-l border-surface-border space-y-3":"space-y-3",children:s.map(([a,o])=>{const f=o===null||typeof o!="object";return m.jsxs("div",{children:[m.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-0.5",children:a.replace(/[_-]/g," ")}),f?m.jsx("p",{className:"text-sm text-text-primary",children:m.jsx(za,{data:o,depth:n+1})}):m.jsx(za,{data:o,depth:n+1})]},a)})})}return m.jsx("span",{children:String(r)})}function z0({mode:r,setMode:n,isCollapsed:s,onToggleCollapse:a,onCopy:o,copied:f,onFullscreen:h,onClose:d,large:g}){const y=g?"w-5 h-5":"w-3.5 h-3.5",E=`${g?"p-2":"p-1.5"} rounded text-text-tertiary hover:text-text-primary hover:bg-surface-raised transition-colors duration-150`;return m.jsxs("div",{className:"flex items-center gap-0.5 bg-surface-sunken/80 rounded-md backdrop-blur-sm",children:[r==="json"&&m.jsx("button",{onClick:a,className:E,title:s?"Expand all":"Collapse all",children:s?m.jsx(Jw,{className:y}):m.jsx(Fw,{className:y})}),m.jsx("button",{onClick:()=>n(r==="json"?"tree":"json"),className:E,title:r==="json"?"Outline view":"JSON view",children:r==="json"?m.jsx($w,{className:y}):m.jsx(Yw,{className:y})}),m.jsx("button",{onClick:o,className:E,title:"Copy to clipboard",children:f?m.jsx(Vw,{className:`${y} text-status-success`}):m.jsx(Gw,{className:y})}),h&&m.jsx("button",{onClick:h,className:E,title:"Fullscreen",children:m.jsx(ag,{className:y})}),d&&m.jsx("button",{onClick:d,className:E,title:"Close (Esc)",children:m.jsx(lg,{className:y})})]})}function Zw({data:r,label:n,variant:s,defaultCollapsed:a=!1,defaultMode:o}){const f=T.useRef(null),[h,d]=T.useState(o??"json"),[g,y]=T.useState(!1),[E,w]=T.useState(!1),[j,z]=T.useState(a?0:1),[M,B]=T.useState(1),V=j%2===0,ne=M%2===0,ee=T.useCallback(()=>z(Z=>Z+1),[]),pe=T.useCallback(()=>B(Z=>Z+1),[]);let ae=r;if(typeof r=="string")try{ae=JSON.parse(r)}catch{}const k=async()=>{const Z=typeof r=="string"?r:JSON.stringify(ae,null,2);await navigator.clipboard.writeText(Z),y(!0),setTimeout(()=>y(!1),2e3)},X=T.useCallback(()=>{B(1),w(!0)},[]),se=s==="panel",W=se?"border border-accent-muted/40 rounded-lg p-3 bg-surface-hover/30":"",F=se?"font-mono text-xs leading-relaxed bg-white rounded-md p-4 overflow-x-auto break-all":"font-mono text-xs leading-relaxed bg-surface-sunken rounded-md p-4 overflow-x-auto break-all";return m.jsxs("div",{className:W,children:[n&&m.jsx(Hw,{children:n}),m.jsxs("div",{ref:f,className:"relative",children:[m.jsx("div",{className:"absolute top-2 right-2 z-[5]",children:m.jsx(z0,{mode:h,setMode:d,isCollapsed:V,onToggleCollapse:ee,onCopy:k,copied:g,onFullscreen:X})}),m.jsx("div",{className:F,children:h==="json"?m.jsx(Bo,{data:ae,generation:j}):m.jsx(za,{data:ae})})]}),m.jsxs(Jg,{open:E,onClose:()=>w(!1),sourceRef:f,children:[m.jsx("div",{className:"sticky top-0 float-right z-10",children:m.jsx(z0,{mode:h,setMode:d,isCollapsed:ne,onToggleCollapse:pe,onCopy:k,copied:g,onClose:()=>w(!1),large:!0})}),m.jsx("div",{className:"font-mono text-sm leading-relaxed",children:h==="json"?m.jsx(Bo,{data:ae,generation:M}):m.jsx(za,{data:ae})})]})]})}const Ww=100,q0=500;let e2=0;const Qg={"escalation.created":"text-status-warning","escalation.claimed":"text-blue-400","escalation.released":"text-text-tertiary","escalation.resolved":"text-status-success","task.created":"text-accent","task.completed":"text-status-success","task.failed":"text-status-error","task.escalated":"text-status-warning","workflow.started":"text-accent","workflow.completed":"text-status-success","workflow.failed":"text-status-error","activity.started":"text-blue-400","activity.completed":"text-status-success","activity.failed":"text-status-error","knowledge.stored":"text-violet-400","knowledge.deleted":"text-text-tertiary","agent.started":"text-accent","agent.completed":"text-status-success","agent.failed":"text-status-error","agent.status_changed":"text-blue-400",milestone:"text-violet-400"};function U0({event:r,forceExpanded:n=!1}){var j,z;const[s,a]=T.useState(n),o=Qg[r.type]||"text-text-tertiary";T.useEffect(()=>{a(n)},[n]);const f=n,h=f?"text-xs":"text-[9px]",d=f?"text-xs":"text-[9px]",g=f?"text-xs":"text-[9px]",y=f?"w-3.5 h-3.5":"w-2.5 h-2.5",E=f?"py-2 px-4":"py-1 px-3",w=f?"pb-4 px-4":"pb-2 px-3";return m.jsxs("div",{className:"border-b border-surface-border/30 last:border-b-0",children:[m.jsxs("button",{onClick:()=>a(!s),className:`flex items-center gap-2 ${E} w-full text-left hover:bg-surface-hover/50 transition-colors`,children:[m.jsx("span",{className:`${h} font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0`,children:new Date(r.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),m.jsx("span",{className:`${d} font-medium px-1 py-0.5 rounded ${o} bg-surface-sunken whitespace-nowrap shrink-0`,children:r.type}),m.jsxs("span",{className:`${g} text-text-tertiary font-mono flex-1 min-w-0 truncate`,children:[(j=r.data)!=null&&j.workflowId?String(r.data.workflowId):"",(z=r.data)!=null&&z.escalationId?` esc:${String(r.data.escalationId).slice(0,12)}`:""]}),m.jsx("svg",{className:`${y} text-text-tertiary shrink-0 transition-transform duration-150 ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),m.jsx(ch,{open:s,children:m.jsx("div",{className:w,children:m.jsx(Zw,{data:r.data})})})]})}function t2({open:r,onToggle:n,configOpen:s,onToggleConfig:a}){const[o,f]=T.useState([]),[h,d]=T.useState(!1),[g,y]=T.useState(""),E=T.useRef(null),w=T.useRef(new Map),{subscribe:j}=T.useContext(Ya),{patterns:z,pagePattern:M,userPatterns:B,addPattern:V,removePattern:ne}=Lw(),ee=T.useCallback(ae=>{const k=String(ae.type||"unknown");if(k.startsWith("mesh."))return;const X=`${k}:${ae.timestamp||""}:${ae.escalationId||ae.workflowId||ae.taskId||""}`,se=Date.now(),W=w.current.get(X);if(!(W&&se-W<q0)){if(w.current.set(X,se),w.current.size>200)for(const[F,Z]of w.current)se-Z>q0*2&&w.current.delete(F);f(F=>[{id:++e2,type:k,timestamp:ae.timestamp||new Date().toISOString(),data:ae},...F].slice(0,Ww))}},[]),pe=T.useRef(ee);return pe.current=ee,T.useEffect(()=>{const ae=z.map(k=>j(k,X=>pe.current(X)));return()=>ae.forEach(k=>k())},[j,z.join(",")]),T.useEffect(()=>{r&&E.current&&(E.current.scrollTop=0)},[o.length,r]),m.jsxs("div",{className:"shrink-0 border-t border-surface-border bg-surface-raised",children:[m.jsxs("button",{onClick:n,className:"flex items-center gap-2 w-full px-4 py-1.5 text-left hover:bg-surface-hover transition-colors",children:[r?m.jsx(Fx,{className:"w-3 h-3 text-text-tertiary"}):m.jsx(Jx,{className:"w-3 h-3 text-text-tertiary"}),m.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:"Event Stream"}),o.length>0&&m.jsxs("span",{className:"text-[9px] text-text-tertiary",children:[o.length," events"]}),o.length>0&&!r&&m.jsx("span",{className:`text-[9px] font-medium px-1 py-0.5 rounded ${Qg[o[0].type]||"text-text-tertiary"} bg-surface-sunken`,children:o[0].type}),m.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[m.jsx("span",{className:`p-0.5 cursor-pointer ${s?"text-accent":"text-text-tertiary hover:text-text-primary"}`,title:"Subscription config",onClick:ae=>{ae.stopPropagation(),a()},children:m.jsx(Qx,{className:"w-3 h-3"})}),o.length>0&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Fullscreen",onClick:ae=>{ae.stopPropagation(),d(!0)},children:m.jsx(ag,{className:"w-3 h-3"})}),m.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Clear events",onClick:ae=>{ae.stopPropagation(),f([])},children:m.jsx(Ix,{className:"w-3 h-3"})})]})]})]}),s&&m.jsxs("div",{className:"px-4 py-2 border-t border-surface-border/50 bg-surface-sunken/30",children:[m.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mb-1.5",children:[m.jsx("span",{className:"text-[9px] text-text-quaternary uppercase tracking-wider shrink-0",children:"Subscribed:"}),m.jsx("span",{className:"text-[9px] font-mono text-accent px-1.5 py-0.5 bg-accent/10 rounded",children:M.replace("lt.events.","")}),B.map(ae=>m.jsxs("span",{className:"inline-flex items-center gap-1 text-[9px] font-mono text-text-secondary px-1.5 py-0.5 bg-surface-sunken rounded",children:[ae.replace("lt.events.",""),m.jsx("button",{onClick:()=>ne(ae),className:"text-text-quaternary hover:text-status-error",children:m.jsx(Po,{className:"w-2 h-2"})})]},ae))]}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("input",{type:"text",value:g,onChange:ae=>y(ae.target.value),onKeyDown:ae=>{ae.key==="Enter"&&g.trim()&&(V(g.trim()),y(""))},placeholder:"task.> or file.stored",className:"input text-[10px] font-mono flex-1 py-1"}),m.jsxs("button",{onClick:()=>{g.trim()&&(V(g.trim()),y(""))},className:"text-[10px] text-accent hover:text-accent-hover flex items-center gap-0.5",children:[m.jsx(Xx,{className:"w-2.5 h-2.5"})," Add"]})]})]}),m.jsx(ch,{open:r,children:m.jsx("div",{ref:E,className:"h-48 overflow-y-auto",children:o.length===0?m.jsx("p",{className:"text-[10px] text-text-tertiary py-4 text-center",children:"Waiting for events..."}):o.map(ae=>m.jsx(U0,{event:ae},ae.id))})}),m.jsxs(Jg,{open:h,onClose:()=>d(!1),sourceRef:E,children:[m.jsx("div",{className:"sticky top-0 float-right z-10",children:m.jsx("button",{onClick:()=>d(!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:m.jsx(lg,{className:"w-5 h-5"})})}),o.length===0?m.jsx("p",{className:"text-sm text-text-tertiary py-8",children:"No events captured"}):o.map(ae=>m.jsx(U0,{event:ae,forceExpanded:!0},ae.id))]})]})}function n2(){return Hn({queryKey:["docs"],queryFn:()=>Xe("/docs"),staleTime:5*6e4})}function s2(r){return Hn({queryKey:["docs",r],queryFn:()=>Xe(`/docs/read?path=${encodeURIComponent(r)}`),enabled:!!r,staleTime:5*6e4})}function i2(){const[r,n]=T.useState([]),[s,a]=T.useState([]),[o,f]=T.useState(null),h=T.useRef(o),d=T.useRef(r),g=T.useRef(s);h.current=o,d.current=r,g.current=s;const y=T.useCallback((M,B)=>{var ne;const V=h.current;if(V){const ee=((ne=B==null?void 0:B.current)==null?void 0:ne.scrollTop)??0;n([...d.current,{...V,scrollTop:ee}])}a([]),f({path:M,scrollTop:0})},[]),E=T.useCallback(M=>{var ee;const B=d.current;if(B.length===0)return;const V=B[B.length-1],ne=h.current;if(ne){const pe=((ee=M==null?void 0:M.current)==null?void 0:ee.scrollTop)??0;a([...g.current,{...ne,scrollTop:pe}])}n(B.slice(0,-1)),f(V),requestAnimationFrame(()=>{M!=null&&M.current&&(M.current.scrollTop=V.scrollTop)})},[]),w=T.useCallback(M=>{var ee;const B=g.current;if(B.length===0)return;const V=B[B.length-1],ne=h.current;if(ne){const pe=((ee=M==null?void 0:M.current)==null?void 0:ee.scrollTop)??0;n([...d.current,{...ne,scrollTop:pe}])}a(B.slice(0,-1)),f(V),requestAnimationFrame(()=>{M!=null&&M.current&&(M.current.scrollTop=V.scrollTop)})},[]),j=T.useCallback(M=>{var ne,ee;const B=h.current;if(!B)return;const V=((ne=M==null?void 0:M.current)==null?void 0:ne.scrollTop)??0;n([...d.current,{...B,scrollTop:V}]),a([]),f({...B,scrollTop:((ee=M==null?void 0:M.current)==null?void 0:ee.scrollTop)??0})},[]),z=T.useCallback(()=>{n([]),a([]),f(null)},[]);return{current:o,backStack:r,forwardStack:s,navigate:y,goBack:E,goForward:w,pushScrollPosition:j,reset:z}}function r2(r,n){const[s,a]=r.split("#");let o=s;if(o.startsWith("./")||o.startsWith("../")){const h=((n?n.replace(/[^/]+$/,""):"")+o).split("/"),d=[];for(const g of h)g===".."?d.pop():g&&g!=="."&&d.push(g);o=d.join("/")}return{path:o,anchor:a}}function a2(r){if(!r.startsWith("#docs"))return null;const n=r.slice(1).split(":"),s=n[1]||"README.md",a=n[2]||void 0;return{path:s,anchor:a}}function l2(r){return!r||r==="README.md"?"#docs":`#docs:${r}`}function o2({content:r,currentPath:n,onNavigate:s,onAnchorClick:a}){const o=f=>{var y;const h=f.target,d=h.closest("[data-anchor]");if(d){f.preventDefault(),a();const E=d.dataset.anchor,w=(y=d.closest(".docs-content"))==null?void 0:y.querySelector(`#${CSS.escape(E)}`);w==null||w.scrollIntoView({behavior:"smooth",block:"start"});return}const g=h.closest("[data-doc-link]");if(g){f.preventDefault();const{path:E,anchor:w}=r2(g.dataset.docLink,n);s(E,w);return}};return m.jsx(uh,{content:r,className:"docs-content",onClick:o})}function c2(r){const n=[],s=new Map;for(const a of r){const o=a.path.split("/");if(o.length===1){n.push(a);continue}let f=s;for(let h=0;h<o.length-1;h++){const d=o[h];f.has(d)||f.set(d,{label:d,children:[],subdirs:new Map});const g=f.get(d);h===o.length-2?g.children.push(a):f=g.subdirs}}return{topLevel:n,dirs:s}}function u2({docs:r,selected:n,onSelect:s}){const{topLevel:a,dirs:o}=c2(r),f=d=>`block w-full text-left px-3 py-1 text-xs rounded truncate transition-colors ${n===d?"bg-accent/10 text-accent":"text-text-secondary hover:bg-surface-hover"}`;function h(d,g){return m.jsxs("details",{open:!0,children:[m.jsxs("summary",{className:"flex items-center gap-1.5 px-3 py-1 text-[10px] font-semibold uppercase tracking-widest text-text-tertiary cursor-pointer",children:[m.jsx(Kx,{className:"w-3 h-3",strokeWidth:1.5}),d.label]}),m.jsxs("div",{className:"pl-2 space-y-0.5",children:[[...d.subdirs.values()].map(y=>h(y)),d.children.map(y=>m.jsx("button",{className:f(y.path),onClick:()=>s(y.path),children:y.title},y.path))]})]},d.label)}return m.jsxs("div",{className:"space-y-0.5",children:[a.map(d=>m.jsx("button",{className:f(d.path),onClick:()=>s(d.path),children:d.title},d.path)),[...o.values()].map(d=>h(d))]})}function f2({open:r,onClose:n}){var se,W,F;const[s,a]=T.useState(!1),{data:o}=n2(),f=i2(),{data:h,isLoading:d}=s2(((se=f.current)==null?void 0:se.path)??null),g=T.useRef(null),[y,E]=T.useState(null);T.useEffect(()=>{y&&(h!=null&&h.content)&&g.current&&requestAnimationFrame(()=>{var le;const Z=(le=g.current)==null?void 0:le.querySelector(`#${CSS.escape(y)}`);Z==null||Z.scrollIntoView({behavior:"smooth",block:"start"}),E(null)})},[y,h]);const w=T.useCallback(()=>{var re;const Z=a2(window.location.hash),le=(Z==null?void 0:Z.path)??"README.md";((re=f.current)==null?void 0:re.path)!==le&&f.navigate(le,g),Z!=null&&Z.anchor&&E(Z.anchor)},[f]),j=T.useRef(!0);T.useEffect(()=>{if(!r||!f.current)return;if(j.current){j.current=!1;return}const Z=l2(f.current.path);window.location.hash!==Z&&window.history.replaceState(null,"",window.location.pathname+window.location.search+Z)},[r,(W=f.current)==null?void 0:W.path]),T.useEffect(()=>{if(!r)return;const Z=()=>{window.location.hash.startsWith("#docs")&&w()};return window.addEventListener("hashchange",Z),()=>window.removeEventListener("hashchange",Z)},[r,w]);const z=T.useCallback((Z,le)=>{le&&E(le),f.navigate(Z,g)},[f]),M=T.useCallback(Z=>{f.navigate(Z,g)},[f]),B=T.useCallback(()=>{f.goBack(g)},[f]),V=T.useCallback(()=>{f.goForward(g)},[f]),ne=T.useCallback(()=>{f.pushScrollPosition(g)},[f]);if(T.useEffect(()=>{if(r){j.current=!0,w();const Z=requestAnimationFrame(()=>a(!0));return()=>cancelAnimationFrame(Z)}},[r]),!(r||s))return null;const pe=()=>{a(!1),setTimeout(()=>{n(),f.reset()},200)},ae=((F=f.current)==null?void 0:F.path)??null,k=f.backStack.length>0,X=f.forwardStack.length>0;return m.jsxs("div",{className:"fixed inset-y-0 right-0 z-50 flex",children:[m.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${s&&r?"opacity-100":"opacity-0"}`,onClick:pe}),m.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:[m.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border shrink-0",children:[m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx("button",{onClick:B,disabled:!k,className:`p-0.5 transition-colors ${k?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Back",children:m.jsx(Zx,{className:"w-4 h-4"})}),m.jsx("button",{onClick:V,disabled:!X,className:`p-0.5 transition-colors ${X?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Forward",children:m.jsx(Kp,{className:"w-4 h-4"})}),m.jsx(rg,{className:"w-4 h-4 text-accent ml-1",strokeWidth:1.5}),m.jsx("span",{className:"text-sm font-medium text-text-primary",children:"Documentation"})]}),m.jsx("button",{onClick:pe,className:"p-1 text-text-tertiary hover:text-text-primary",children:m.jsx(Po,{className:"w-4 h-4"})})]}),m.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[m.jsx("div",{className:"w-48 shrink-0 border-r border-surface-border overflow-y-auto py-2",children:o!=null&&o.docs?m.jsx(u2,{docs:o.docs,selected:ae,onSelect:M}):m.jsx("div",{className:"px-3 py-2 text-xs text-text-tertiary",children:"Loading..."})}),m.jsx("div",{ref:g,className:"flex-1 overflow-y-auto px-6 py-4",children:ae?d?m.jsxs("div",{className:"animate-pulse space-y-2",children:[m.jsx("div",{className:"h-6 bg-surface-sunken rounded w-48"}),m.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),m.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"})]}):h!=null&&h.content?m.jsx(o2,{content:h.content,currentPath:ae,onNavigate:z,onAnchorClick:ne}):m.jsx("p",{className:"text-xs text-text-tertiary",children:"Document not found."}):m.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-text-tertiary",children:[m.jsx(Kp,{className:"w-5 h-5 mb-2"}),m.jsx("p",{className:"text-xs",children:"Select a document"})]})})]})]})]})}function h2(r){if(r.includes("/escalations"))return["escalation","human-queue"]}const B0=2e3;function d2(r){const s=r.filter(o=>!o.pending).slice(-8);return s.length===0?"":`[Prior conversation]
|
|
57
57
|
${s.map(o=>`${o.role==="user"?"User":"Assistant"}: ${o.content}`).join(`
|
|
58
58
|
`)}
|
|
59
59
|
[End prior conversation]
|
|
60
60
|
|
|
61
|
-
`}function
|
|
62
|
-
... (truncated)`});const se=`${a2(o.concat(pe))}${ne}`;try{const Z=(await Xe("/insight/mcp-query",{method:"POST",body:JSON.stringify({prompt:se,tags:k.suggestedTags,context:k,wait:!1,direct:!0})})).workflow_id;d(Z),f(le=>le.map(re=>re.id===ae.id?{...re,workflowId:Z}:re)),E.current&&clearInterval(E.current),E.current=setInterval(async()=>{var le;try{const re=await Xe(`/workflows/${Z}/result`),qe=(le=re==null?void 0:re.result)==null?void 0:le.data;if(qe){E.current&&clearInterval(E.current),E.current=null,d(null);const Ge=l2(qe);let Le;try{Le=(await Xe(`/workflow-states/${Z}/execution`)).duration_ms}catch{}f($=>$.map(te=>te.id===ae.id?{...te,content:Ge,timestamp:new Date().toISOString(),pending:!1,durationMs:Le}:te))}}catch{}},3e3)}catch{f(F=>F.map(Z=>Z.id===ae.id?{...Z,content:"Failed to submit query. Please try again.",pending:!1}:Z))}},[o,w]),V=T.useCallback(async ne=>{const ee=o.find(k=>k.id===ne);if(!(ee!=null&&ee.workflowId)||ee.compilationStatus==="compiling"||ee.compilationStatus==="done")return;const pe=o.indexOf(ee),ae=o.slice(0,pe).reverse().find(k=>k.role==="user");if(ae){f(k=>k.map(X=>X.id===ne?{...X,compilationStatus:"compiling"}:X));try{const k=await Xe("/insight/mcp-query/describe",{method:"POST",body:JSON.stringify({prompt:ae.content,summary:ee.content})}),X=await Xe("/yaml-workflows",{method:"POST",body:JSON.stringify({workflow_id:ee.workflowId,task_queue:"long-tail-system",workflow_name:"mcpQuery",name:k.tool_name,description:k.description,tags:k.tags,app_id:"longtail"})});await Xe(`/yaml-workflows/${X.id}/deploy`,{method:"POST"}),f(se=>se.map(W=>W.id===ne?{...W,compilationStatus:"done"}:W))}catch(k){const X=k instanceof Error?k.message:"Compilation failed";f(se=>se.map(W=>W.id===ne?{...W,compilationStatus:"error",compilationError:X}:W))}}},[o]);return m.jsx(Zg.Provider,{value:{helpOpen:s,setHelpOpen:a,toggleHelp:j,messages:o,sendMessage:B,pageContext:w,setPageContext:z,activeWorkflowId:h,clearMessages:M,compileMessage:V},children:r})}function Wg(){const r=T.useContext(Zg);if(!r)throw new Error("useHelpAssistant must be used within HelpAssistantProvider");return r}function c2(){const{helpOpen:r,toggleHelp:n}=Wg();return m.jsx("button",{onClick:n,className:"fixed right-3 z-[45] flex items-center justify-center w-10 h-10 rounded-full bg-surface-raised shadow-lg hover:scale-110 transition-transform duration-150 border border-accent/30",style:{bottom:"44px"},"aria-label":r?"Close help":"Ask for help",children:r?m.jsx(Po,{className:"w-5 h-5 text-text-tertiary",strokeWidth:1.5}):m.jsx("img",{src:`${Bn}/logo512.png`,alt:"Help",className:"w-8 h-8 -rotate-[120deg]"})})}const ey=6048e5,u2=864e5,$0=6e4,Y0=525600,G0=43200,V0=1440,F0=Symbol.for("constructDateFrom");function hs(r,n){return typeof r=="function"?r(n):r&&typeof r=="object"&&F0 in r?r[F0](n):r instanceof Date?new r.constructor(n):new Date(n)}function nn(r,n){return hs(n||r,r)}let f2={};function Va(){return f2}function Pa(r,n){var d,g,y,E;const s=Va(),a=(n==null?void 0:n.weekStartsOn)??((g=(d=n==null?void 0:n.locale)==null?void 0:d.options)==null?void 0:g.weekStartsOn)??s.weekStartsOn??((E=(y=s.locale)==null?void 0:y.options)==null?void 0:E.weekStartsOn)??0,o=nn(r,n==null?void 0:n.in),f=o.getDay(),h=(f<a?7:0)+f-a;return o.setDate(o.getDate()-h),o.setHours(0,0,0,0),o}function Lo(r,n){return Pa(r,{...n,weekStartsOn:1})}function ty(r,n){const s=nn(r,n==null?void 0:n.in),a=s.getFullYear(),o=hs(s,0);o.setFullYear(a+1,0,4),o.setHours(0,0,0,0);const f=Lo(o),h=hs(s,0);h.setFullYear(a,0,4),h.setHours(0,0,0,0);const d=Lo(h);return s.getTime()>=f.getTime()?a+1:s.getTime()>=d.getTime()?a:a-1}function Ho(r){const n=nn(r),s=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return s.setUTCFullYear(n.getFullYear()),+r-+s}function ny(r,...n){const s=hs.bind(null,r||n.find(a=>typeof a=="object"));return n.map(s)}function J0(r,n){const s=nn(r,n==null?void 0:n.in);return s.setHours(0,0,0,0),s}function h2(r,n,s){const[a,o]=ny(s==null?void 0:s.in,r,n),f=J0(a),h=J0(o),d=+f-Ho(f),g=+h-Ho(h);return Math.round((d-g)/u2)}function d2(r,n){const s=ty(r,n),a=hs(r,0);return a.setFullYear(s,0,4),a.setHours(0,0,0,0),Lo(a)}function m2(r,n){const s=+nn(r)-+nn(n);return s<0?-1:s>0?1:s}function p2(r){return hs(r,Date.now())}function g2(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}function y2(r){return!(!g2(r)&&typeof r!="number"||isNaN(+nn(r)))}function b2(r){return n=>{const a=(r?Math[r]:Math.trunc)(n);return a===0?0:a}}function x2(r,n){const s=nn(r,n==null?void 0:n.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}const v2={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"}},_2=(r,n,s)=>{let a;const o=v2[r];return typeof o=="string"?a=o:n===1?a=o.one:a=o.other.replace("{{count}}",n.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+a:a+" ago":a};function Ef(r){return(n={})=>{const s=n.width?String(n.width):r.defaultWidth;return r.formats[s]||r.formats[r.defaultWidth]}}const w2={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},S2={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},E2={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},A2={date:Ef({formats:w2,defaultWidth:"full"}),time:Ef({formats:S2,defaultWidth:"full"}),dateTime:Ef({formats:E2,defaultWidth:"full"})},O2={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},j2=(r,n,s,a)=>O2[r];function Oa(r){return(n,s)=>{const a=s!=null&&s.context?String(s.context):"standalone";let o;if(a==="formatting"&&r.formattingValues){const h=r.defaultFormattingWidth||r.defaultWidth,d=s!=null&&s.width?String(s.width):h;o=r.formattingValues[d]||r.formattingValues[h]}else{const h=r.defaultWidth,d=s!=null&&s.width?String(s.width):r.defaultWidth;o=r.values[d]||r.values[h]}const f=r.argumentCallback?r.argumentCallback(n):n;return o[f]}}const T2={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},N2={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},C2={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"]},k2={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"]},M2={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"}},R2={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"}},D2=(r,n)=>{const s=Number(r),a=s%100;if(a>20||a<10)switch(a%10){case 1:return s+"st";case 2:return s+"nd";case 3:return s+"rd"}return s+"th"},z2={ordinalNumber:D2,era:Oa({values:T2,defaultWidth:"wide"}),quarter:Oa({values:N2,defaultWidth:"wide",argumentCallback:r=>r-1}),month:Oa({values:C2,defaultWidth:"wide"}),day:Oa({values:k2,defaultWidth:"wide"}),dayPeriod:Oa({values:M2,defaultWidth:"wide",formattingValues:R2,defaultFormattingWidth:"wide"})};function ja(r){return(n,s={})=>{const a=s.width,o=a&&r.matchPatterns[a]||r.matchPatterns[r.defaultMatchWidth],f=n.match(o);if(!f)return null;const h=f[0],d=a&&r.parsePatterns[a]||r.parsePatterns[r.defaultParseWidth],g=Array.isArray(d)?U2(d,w=>w.test(h)):q2(d,w=>w.test(h));let y;y=r.valueCallback?r.valueCallback(g):g,y=s.valueCallback?s.valueCallback(y):y;const E=n.slice(h.length);return{value:y,rest:E}}}function q2(r,n){for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)&&n(r[s]))return s}function U2(r,n){for(let s=0;s<r.length;s++)if(n(r[s]))return s}function B2(r){return(n,s={})=>{const a=n.match(r.matchPattern);if(!a)return null;const o=a[0],f=n.match(r.parsePattern);if(!f)return null;let h=r.valueCallback?r.valueCallback(f[0]):f[0];h=s.valueCallback?s.valueCallback(h):h;const d=n.slice(o.length);return{value:h,rest:d}}}const L2=/^(\d+)(th|st|nd|rd)?/i,H2=/\d+/i,P2={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},$2={any:[/^b/i,/^(a|c)/i]},Y2={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},G2={any:[/1/i,/2/i,/3/i,/4/i]},V2={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},F2={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]},J2={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},Q2={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]},I2={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},X2={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}},K2={ordinalNumber:B2({matchPattern:L2,parsePattern:H2,valueCallback:r=>parseInt(r,10)}),era:ja({matchPatterns:P2,defaultMatchWidth:"wide",parsePatterns:$2,defaultParseWidth:"any"}),quarter:ja({matchPatterns:Y2,defaultMatchWidth:"wide",parsePatterns:G2,defaultParseWidth:"any",valueCallback:r=>r+1}),month:ja({matchPatterns:V2,defaultMatchWidth:"wide",parsePatterns:F2,defaultParseWidth:"any"}),day:ja({matchPatterns:J2,defaultMatchWidth:"wide",parsePatterns:Q2,defaultParseWidth:"any"}),dayPeriod:ja({matchPatterns:I2,defaultMatchWidth:"any",parsePatterns:X2,defaultParseWidth:"any"})},sy={code:"en-US",formatDistance:_2,formatLong:A2,formatRelative:j2,localize:z2,match:K2,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Z2(r,n){const s=nn(r,n==null?void 0:n.in);return h2(s,x2(s))+1}function W2(r,n){const s=nn(r,n==null?void 0:n.in),a=+Lo(s)-+d2(s);return Math.round(a/ey)+1}function iy(r,n){var E,w,j,z;const s=nn(r,n==null?void 0:n.in),a=s.getFullYear(),o=Va(),f=(n==null?void 0:n.firstWeekContainsDate)??((w=(E=n==null?void 0:n.locale)==null?void 0:E.options)==null?void 0:w.firstWeekContainsDate)??o.firstWeekContainsDate??((z=(j=o.locale)==null?void 0:j.options)==null?void 0:z.firstWeekContainsDate)??1,h=hs((n==null?void 0:n.in)||r,0);h.setFullYear(a+1,0,f),h.setHours(0,0,0,0);const d=Pa(h,n),g=hs((n==null?void 0:n.in)||r,0);g.setFullYear(a,0,f),g.setHours(0,0,0,0);const y=Pa(g,n);return+s>=+d?a+1:+s>=+y?a:a-1}function eS(r,n){var d,g,y,E;const s=Va(),a=(n==null?void 0:n.firstWeekContainsDate)??((g=(d=n==null?void 0:n.locale)==null?void 0:d.options)==null?void 0:g.firstWeekContainsDate)??s.firstWeekContainsDate??((E=(y=s.locale)==null?void 0:y.options)==null?void 0:E.firstWeekContainsDate)??1,o=iy(r,n),f=hs((n==null?void 0:n.in)||r,0);return f.setFullYear(o,0,a),f.setHours(0,0,0,0),Pa(f,n)}function tS(r,n){const s=nn(r,n==null?void 0:n.in),a=+Pa(s,n)-+eS(s,n);return Math.round(a/ey)+1}function Ye(r,n){const s=r<0?"-":"",a=Math.abs(r).toString().padStart(n,"0");return s+a}const Gs={y(r,n){const s=r.getFullYear(),a=s>0?s:1-s;return Ye(n==="yy"?a%100:a,n.length)},M(r,n){const s=r.getMonth();return n==="M"?String(s+1):Ye(s+1,2)},d(r,n){return Ye(r.getDate(),n.length)},a(r,n){const s=r.getHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return s.toUpperCase();case"aaa":return s;case"aaaaa":return s[0];case"aaaa":default:return s==="am"?"a.m.":"p.m."}},h(r,n){return Ye(r.getHours()%12||12,n.length)},H(r,n){return Ye(r.getHours(),n.length)},m(r,n){return Ye(r.getMinutes(),n.length)},s(r,n){return Ye(r.getSeconds(),n.length)},S(r,n){const s=n.length,a=r.getMilliseconds(),o=Math.trunc(a*Math.pow(10,s-3));return Ye(o,n.length)}},pr={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Q0={G:function(r,n,s){const a=r.getFullYear()>0?1:0;switch(n){case"G":case"GG":case"GGG":return s.era(a,{width:"abbreviated"});case"GGGGG":return s.era(a,{width:"narrow"});case"GGGG":default:return s.era(a,{width:"wide"})}},y:function(r,n,s){if(n==="yo"){const a=r.getFullYear(),o=a>0?a:1-a;return s.ordinalNumber(o,{unit:"year"})}return Gs.y(r,n)},Y:function(r,n,s,a){const o=iy(r,a),f=o>0?o:1-o;if(n==="YY"){const h=f%100;return Ye(h,2)}return n==="Yo"?s.ordinalNumber(f,{unit:"year"}):Ye(f,n.length)},R:function(r,n){const s=ty(r);return Ye(s,n.length)},u:function(r,n){const s=r.getFullYear();return Ye(s,n.length)},Q:function(r,n,s){const a=Math.ceil((r.getMonth()+1)/3);switch(n){case"Q":return String(a);case"QQ":return Ye(a,2);case"Qo":return s.ordinalNumber(a,{unit:"quarter"});case"QQQ":return s.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return s.quarter(a,{width:"narrow",context:"formatting"});case"QQQQ":default:return s.quarter(a,{width:"wide",context:"formatting"})}},q:function(r,n,s){const a=Math.ceil((r.getMonth()+1)/3);switch(n){case"q":return String(a);case"qq":return Ye(a,2);case"qo":return s.ordinalNumber(a,{unit:"quarter"});case"qqq":return s.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return s.quarter(a,{width:"narrow",context:"standalone"});case"qqqq":default:return s.quarter(a,{width:"wide",context:"standalone"})}},M:function(r,n,s){const a=r.getMonth();switch(n){case"M":case"MM":return Gs.M(r,n);case"Mo":return s.ordinalNumber(a+1,{unit:"month"});case"MMM":return s.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return s.month(a,{width:"narrow",context:"formatting"});case"MMMM":default:return s.month(a,{width:"wide",context:"formatting"})}},L:function(r,n,s){const a=r.getMonth();switch(n){case"L":return String(a+1);case"LL":return Ye(a+1,2);case"Lo":return s.ordinalNumber(a+1,{unit:"month"});case"LLL":return s.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return s.month(a,{width:"narrow",context:"standalone"});case"LLLL":default:return s.month(a,{width:"wide",context:"standalone"})}},w:function(r,n,s,a){const o=tS(r,a);return n==="wo"?s.ordinalNumber(o,{unit:"week"}):Ye(o,n.length)},I:function(r,n,s){const a=W2(r);return n==="Io"?s.ordinalNumber(a,{unit:"week"}):Ye(a,n.length)},d:function(r,n,s){return n==="do"?s.ordinalNumber(r.getDate(),{unit:"date"}):Gs.d(r,n)},D:function(r,n,s){const a=Z2(r);return n==="Do"?s.ordinalNumber(a,{unit:"dayOfYear"}):Ye(a,n.length)},E:function(r,n,s){const a=r.getDay();switch(n){case"E":case"EE":case"EEE":return s.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return s.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(a,{width:"short",context:"formatting"});case"EEEE":default:return s.day(a,{width:"wide",context:"formatting"})}},e:function(r,n,s,a){const o=r.getDay(),f=(o-a.weekStartsOn+8)%7||7;switch(n){case"e":return String(f);case"ee":return Ye(f,2);case"eo":return s.ordinalNumber(f,{unit:"day"});case"eee":return s.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return s.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(o,{width:"short",context:"formatting"});case"eeee":default:return s.day(o,{width:"wide",context:"formatting"})}},c:function(r,n,s,a){const o=r.getDay(),f=(o-a.weekStartsOn+8)%7||7;switch(n){case"c":return String(f);case"cc":return Ye(f,n.length);case"co":return s.ordinalNumber(f,{unit:"day"});case"ccc":return s.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return s.day(o,{width:"narrow",context:"standalone"});case"cccccc":return s.day(o,{width:"short",context:"standalone"});case"cccc":default:return s.day(o,{width:"wide",context:"standalone"})}},i:function(r,n,s){const a=r.getDay(),o=a===0?7:a;switch(n){case"i":return String(o);case"ii":return Ye(o,n.length);case"io":return s.ordinalNumber(o,{unit:"day"});case"iii":return s.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return s.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return s.day(a,{width:"short",context:"formatting"});case"iiii":default:return s.day(a,{width:"wide",context:"formatting"})}},a:function(r,n,s){const o=r.getHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(r,n,s){const a=r.getHours();let o;switch(a===12?o=pr.noon:a===0?o=pr.midnight:o=a/12>=1?"pm":"am",n){case"b":case"bb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(r,n,s){const a=r.getHours();let o;switch(a>=17?o=pr.evening:a>=12?o=pr.afternoon:a>=4?o=pr.morning:o=pr.night,n){case"B":case"BB":case"BBB":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(r,n,s){if(n==="ho"){let a=r.getHours()%12;return a===0&&(a=12),s.ordinalNumber(a,{unit:"hour"})}return Gs.h(r,n)},H:function(r,n,s){return n==="Ho"?s.ordinalNumber(r.getHours(),{unit:"hour"}):Gs.H(r,n)},K:function(r,n,s){const a=r.getHours()%12;return n==="Ko"?s.ordinalNumber(a,{unit:"hour"}):Ye(a,n.length)},k:function(r,n,s){let a=r.getHours();return a===0&&(a=24),n==="ko"?s.ordinalNumber(a,{unit:"hour"}):Ye(a,n.length)},m:function(r,n,s){return n==="mo"?s.ordinalNumber(r.getMinutes(),{unit:"minute"}):Gs.m(r,n)},s:function(r,n,s){return n==="so"?s.ordinalNumber(r.getSeconds(),{unit:"second"}):Gs.s(r,n)},S:function(r,n){return Gs.S(r,n)},X:function(r,n,s){const a=r.getTimezoneOffset();if(a===0)return"Z";switch(n){case"X":return X0(a);case"XXXX":case"XX":return Ei(a);case"XXXXX":case"XXX":default:return Ei(a,":")}},x:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"x":return X0(a);case"xxxx":case"xx":return Ei(a);case"xxxxx":case"xxx":default:return Ei(a,":")}},O:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"O":case"OO":case"OOO":return"GMT"+I0(a,":");case"OOOO":default:return"GMT"+Ei(a,":")}},z:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"z":case"zz":case"zzz":return"GMT"+I0(a,":");case"zzzz":default:return"GMT"+Ei(a,":")}},t:function(r,n,s){const a=Math.trunc(+r/1e3);return Ye(a,n.length)},T:function(r,n,s){return Ye(+r,n.length)}};function I0(r,n=""){const s=r>0?"-":"+",a=Math.abs(r),o=Math.trunc(a/60),f=a%60;return f===0?s+String(o):s+String(o)+n+Ye(f,2)}function X0(r,n){return r%60===0?(r>0?"-":"+")+Ye(Math.abs(r)/60,2):Ei(r,n)}function Ei(r,n=""){const s=r>0?"-":"+",a=Math.abs(r),o=Ye(Math.trunc(a/60),2),f=Ye(a%60,2);return s+o+n+f}const K0=(r,n)=>{switch(r){case"P":return n.date({width:"short"});case"PP":return n.date({width:"medium"});case"PPP":return n.date({width:"long"});case"PPPP":default:return n.date({width:"full"})}},ry=(r,n)=>{switch(r){case"p":return n.time({width:"short"});case"pp":return n.time({width:"medium"});case"ppp":return n.time({width:"long"});case"pppp":default:return n.time({width:"full"})}},nS=(r,n)=>{const s=r.match(/(P+)(p+)?/)||[],a=s[1],o=s[2];if(!o)return K0(r,n);let f;switch(a){case"P":f=n.dateTime({width:"short"});break;case"PP":f=n.dateTime({width:"medium"});break;case"PPP":f=n.dateTime({width:"long"});break;case"PPPP":default:f=n.dateTime({width:"full"});break}return f.replace("{{date}}",K0(a,n)).replace("{{time}}",ry(o,n))},sS={p:ry,P:nS},iS=/^D+$/,rS=/^Y+$/,aS=["D","DD","YY","YYYY"];function lS(r){return iS.test(r)}function oS(r){return rS.test(r)}function cS(r,n,s){const a=uS(r,n,s);if(console.warn(a),aS.includes(r))throw new RangeError(a)}function uS(r,n,s){const a=r[0]==="Y"?"years":"days of the month";return`Use \`${r.toLowerCase()}\` instead of \`${r}\` (in \`${n}\`) for formatting ${a} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const fS=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,hS=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,dS=/^'([^]*?)'?$/,mS=/''/g,pS=/[a-zA-Z]/;function ay(r,n,s){var E,w,j,z;const a=Va(),o=a.locale??sy,f=a.firstWeekContainsDate??((w=(E=a.locale)==null?void 0:E.options)==null?void 0:w.firstWeekContainsDate)??1,h=a.weekStartsOn??((z=(j=a.locale)==null?void 0:j.options)==null?void 0:z.weekStartsOn)??0,d=nn(r,s==null?void 0:s.in);if(!y2(d))throw new RangeError("Invalid time value");let g=n.match(hS).map(M=>{const B=M[0];if(B==="p"||B==="P"){const V=sS[B];return V(M,o.formatLong)}return M}).join("").match(fS).map(M=>{if(M==="''")return{isToken:!1,value:"'"};const B=M[0];if(B==="'")return{isToken:!1,value:gS(M)};if(Q0[B])return{isToken:!0,value:M};if(B.match(pS))throw new RangeError("Format string contains an unescaped latin alphabet character `"+B+"`");return{isToken:!1,value:M}});o.localize.preprocessor&&(g=o.localize.preprocessor(d,g));const y={firstWeekContainsDate:f,weekStartsOn:h,locale:o};return g.map(M=>{if(!M.isToken)return M.value;const B=M.value;(oS(B)||lS(B))&&cS(B,n,String(r));const V=Q0[B[0]];return V(d,B,o.localize,y)}).join("")}function gS(r){const n=r.match(dS);return n?n[1].replace(mS,"'"):r}function yS(r,n,s){const a=Va(),o=(s==null?void 0:s.locale)??a.locale??sy,f=m2(r,n);if(isNaN(f))throw new RangeError("Invalid time value");const h=Object.assign({},s,{addSuffix:s==null?void 0:s.addSuffix,comparison:f}),[d,g]=ny(s==null?void 0:s.in,...f>0?[n,r]:[r,n]),y=b2((s==null?void 0:s.roundingMethod)??"round"),E=g.getTime()-d.getTime(),w=E/$0,j=Ho(g)-Ho(d),z=(E-j)/$0,M=s==null?void 0:s.unit;let B;if(M?B=M:w<1?B="second":w<60?B="minute":w<V0?B="hour":z<G0?B="day":z<Y0?B="month":B="year",B==="second"){const V=y(E/1e3);return o.formatDistance("xSeconds",V,h)}else if(B==="minute"){const V=y(w);return o.formatDistance("xMinutes",V,h)}else if(B==="hour"){const V=y(w/60);return o.formatDistance("xHours",V,h)}else if(B==="day"){const V=y(z/V0);return o.formatDistance("xDays",V,h)}else if(B==="month"){const V=y(z/G0);return V===12&&M!=="month"?o.formatDistance("xYears",1,h):o.formatDistance("xMonths",V,h)}else{const V=y(z/Y0);return o.formatDistance("xYears",V,h)}}function bS(r,n){return yS(r,p2(r),n)}function xS(r){const n=new Date(r);return n.getTime()>Date.now()?"just now":bS(n,{addSuffix:!0})}function LE(r){return r<=0?"Expired":mh(r)}function vS(r){return r==null?"--":mh(r)}function mh(r){if(r<1e3)return`${Math.round(r)}ms`;if(r<6e4){const h=r/1e3;return Number.isInteger(h)?`${h}s`:`${h.toFixed(1)}s`}const n=Math.floor(r/1e3),s=Math.floor(n/86400),a=Math.floor(n%86400/3600),o=Math.floor(n%3600/60),f=n%60;return s>0?a>0?`${s}d ${a}h`:`${s}d`:a>0?o>0?`${a}h ${o}m`:`${a}h`:f>0?`${o}m ${f}s`:`${o}m`}function HE(r,n){const s=new Date(r).getTime(),a=n?new Date(n).getTime():Date.now();return mh(a-s)}function ly({options:r,children:n,className:s=""}){const[a,o]=T.useState(!1),[f,h]=T.useState(null),[d,g]=T.useState(null),y=T.useRef(null),E=T.useRef(void 0),w=T.useRef(void 0),j=220,z=T.useCallback(()=>{if(!y.current)return;const ne=y.current.getBoundingClientRect(),ee=window.innerWidth-j-8,pe=Math.max(8,Math.min(ne.left,ee));g({top:ne.bottom+4,left:pe})},[]),M=T.useCallback(async(ne,ee)=>{try{await navigator.clipboard.writeText(ne),h(ee),clearTimeout(E.current),E.current=setTimeout(()=>h(null),1200)}catch{}},[]),B=T.useCallback(()=>{clearTimeout(w.current),z(),o(!0)},[z]),V=T.useCallback(()=>{w.current=setTimeout(()=>o(!1),150)},[]);return T.useEffect(()=>()=>{clearTimeout(E.current),clearTimeout(w.current)},[]),m.jsxs("span",{ref:y,className:`inline-flex items-center cursor-default ${s}`,onMouseEnter:B,onMouseLeave:V,children:[n,a&&d&&rg.createPortal(m.jsx("span",{className:"fixed z-[9999] bg-surface-raised border border-surface-border rounded shadow-lg py-1 min-w-[180px]",style:{top:d.top,left:d.left},onMouseEnter:B,onMouseLeave:V,children:r.map(ne=>m.jsxs("button",{onClick:ee=>{ee.stopPropagation(),M(ne.value,ne.label)},className:"flex items-center justify-between w-full px-2.5 py-1 text-left hover:bg-surface-hover transition-colors",children:[m.jsx("span",{className:"text-[9px] font-medium uppercase tracking-wider text-text-tertiary w-10 shrink-0",children:ne.label}),m.jsx("span",{className:"text-[10px] font-mono text-text-secondary truncate ml-2",children:f===ne.label?"✓":ne.value})]},ne.label))}),document.body)]})}function _S(r,n){const s=new Date(r);switch(n){case"relative":return xS(r);case"datetime":return ay(s,"MMM d, yyyy h:mm a");case"time":return s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}}function wS(r){const n=new Date(r);return[{label:"ms",value:String(n.getTime())},{label:"utc",value:n.toISOString()},{label:"local",value:ay(n,"MMM d, yyyy h:mm:ss a")}]}function SS({date:r,format:n="relative",className:s=""}){const[,a]=T.useState(0);T.useEffect(()=>{if(n!=="relative")return;const f=setInterval(()=>a(h=>h+1),3e4);return()=>clearInterval(f)},[n]);const o=T.useMemo(()=>wS(r),[r]);return m.jsx(ly,{options:o,children:m.jsx("time",{dateTime:r,className:`text-xs text-text-tertiary ${s}`,children:_S(r,n)})})}function ES({ms:r,className:n=""}){const s=vS(r),a=T.useMemo(()=>r==null?[]:[{label:"ms",value:String(r)},{label:"sec",value:`${(r/1e3).toFixed(3)}s`},{label:"text",value:s}],[r,s]);return r==null?m.jsx("span",{className:`text-xs text-text-tertiary ${n}`,children:"--"}):m.jsx(ly,{options:a,children:m.jsx("span",{className:`text-xs text-text-tertiary ${n}`,children:s})})}const AS=["sm","md","lg","full"],Z0={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"},W0={sm:"Small",md:"Medium",lg:"Large",full:"Fullscreen"};function OS({which:r}){const n="stroke-current";switch(r){case"sm":return m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:m.jsx("rect",{x:"5",y:"5",width:"7",height:"7",rx:"1.5",className:n,strokeWidth:"1.5"})});case"md":return m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:m.jsx("rect",{x:"3",y:"3",width:"9",height:"9",rx:"1.5",className:n,strokeWidth:"1.5"})});case"lg":return m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:m.jsx("rect",{x:"1.5",y:"1.5",width:"11",height:"11",rx:"1.5",className:n,strokeWidth:"1.5"})});case"full":return m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:m.jsx("rect",{x:"0.75",y:"0.75",width:"12.5",height:"12.5",rx:"1.5",className:n,strokeWidth:"1.5"})})}}function jS({msg:r}){const[n,s]=T.useState(0);T.useEffect(()=>{const h=new Date(r.timestamp).getTime(),d=()=>s(Math.floor((Date.now()-h)/1e3));d();const g=setInterval(d,1e3);return()=>clearInterval(g)},[r.timestamp]);const a=Math.floor(n/60),o=n%60,f=a>0?`${a}m ${o}s`:`${o}s`;return m.jsxs("span",{className:"inline-flex flex-col gap-1.5",children:[m.jsxs("span",{className:"inline-flex items-center gap-1",children:[m.jsx("span",{className:"text-text-tertiary",children:"Thinking"}),m.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse"}),m.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:150ms]"}),m.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:300ms]"}),m.jsx("span",{className:"text-text-muted ml-1 tabular-nums",children:f})]}),r.workflowId&&m.jsxs(gr,{to:`/workflows/executions/${r.workflowId}`,className:"inline-flex items-center gap-1 text-[10px] text-accent/70 hover:text-accent transition-colors",children:[m.jsx(ka,{className:"w-2.5 h-2.5",strokeWidth:1.5}),"watch execution"]})]})}function TS({msg:r,compileMessage:n}){const s=r.role==="assistant";return m.jsxs("div",{className:`flex items-center gap-1.5 ${s?"justify-start":"justify-end"}`,children:[m.jsx(SS,{date:r.timestamp,format:"time",className:"!text-[9px] text-text-muted/50"}),r.durationMs!=null&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"text-text-muted/30 text-[8px]",children:"·"}),m.jsx(ES,{ms:r.durationMs,className:"!text-[9px] text-text-muted/50"})]}),r.workflowId&&m.jsx(gr,{to:`/workflows/executions/${r.workflowId}`,className:"text-text-muted/40 hover:text-accent transition-colors",title:"View workflow execution",children:m.jsx(ka,{className:"w-2.5 h-2.5",strokeWidth:1.5})}),s&&r.workflowId&&!r.pending&&m.jsx("button",{onClick:()=>n(r.id),disabled:r.compilationStatus==="compiling"||r.compilationStatus==="done",className:"transition-colors",title:r.compilationStatus==="done"?"Compiled — future queries will match this pipeline":r.compilationStatus==="error"?r.compilationError??"Compilation failed":r.compilationStatus==="compiling"?"Compiling...":"Compile to fast pipeline",children:m.jsx(Qx,{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 NS(){const{helpOpen:r,setHelpOpen:n,messages:s,sendMessage:a,pageContext:o,activeWorkflowId:f,clearMessages:h,compileMessage:d}=Wg(),[g,y]=T.useState(""),[E,w]=T.useState("md"),[j,z]=T.useState(!0),M=T.useRef(null),B=T.useRef(null);if(T.useEffect(()=>{M.current&&(M.current.scrollTop=M.current.scrollHeight)},[s]),T.useEffect(()=>{r&&B.current&&B.current.focus()},[r]),T.useEffect(()=>{if(!r)return;const k=X=>{X.key==="Escape"&&(E==="full"?w("lg"):E==="lg"?w("md"):E==="md"?w("sm"):n(!1))};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[r,E,n]),!r)return null;const V=()=>{const k=g.trim();!k||f||(a(k),y(""),B.current&&(B.current.style.height="auto"))},ne=k=>{k.key==="Enter"&&!k.shiftKey&&(k.preventDefault(),V())},ee=E==="full",pe=o.page.replace(/-/g," "),ae=ee?{}:{bottom:"108px"};return m.jsxs("div",{className:`fixed z-[45] flex flex-col border border-surface-border rounded-lg overflow-hidden transition-all duration-300 ${ee?Z0.full:`right-6 ${Z0[E]}`} ${j?"bg-surface-raised shadow-xl":"bg-surface-raised/[0.03] shadow-lg shadow-black/5"}`,style:ae,onMouseEnter:()=>z(!0),onMouseLeave:()=>z(!1),children:[m.jsxs("div",{className:`flex items-center justify-between px-4 py-2.5 border-b border-surface-border shrink-0 transition-all duration-300 ${j?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("p",{className:"text-xs font-medium text-text-primary truncate",children:"Help Assistant"}),m.jsx("p",{className:"text-[10px] text-text-tertiary truncate",children:pe})]}),m.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[m.jsx("div",{className:"flex items-center gap-0.5 border border-surface-border rounded p-0.5",role:"radiogroup","aria-label":"Panel size",children:AS.map(k=>m.jsx("button",{onClick:()=>w(k),className:`p-1 rounded transition-colors ${k===E?"bg-accent/15 text-accent":"text-text-muted hover:text-text-secondary hover:bg-surface-hover"}`,role:"radio","aria-checked":k===E,"aria-label":W0[k],title:W0[k],children:m.jsx(OS,{which:k})},k))}),s.length>0&&m.jsx("button",{onClick:h,className:"p-1 text-text-tertiary hover:text-text-secondary transition-colors","aria-label":"Clear conversation",title:"Clear conversation",children:m.jsx(Ix,{className:"w-3.5 h-3.5",strokeWidth:1.5})}),m.jsx("button",{onClick:()=>n(!1),className:"p-1 text-text-tertiary hover:text-text-primary transition-colors","aria-label":"Close",title:"Close",children:m.jsx(Po,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]})]}),m.jsxs("div",{ref:M,className:`flex-1 overflow-y-auto px-4 py-3 space-y-3 min-h-[120px] transition-all duration-300 ${j?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[s.length===0&&m.jsx("p",{className:"text-xs text-text-tertiary text-center py-6",children:"Ask anything about what you're viewing."}),s.map(k=>m.jsxs("div",{className:`text-xs leading-relaxed ${k.role==="user"?"text-right":"text-left"}`,children:[m.jsx("div",{className:`inline-block max-w-[85%] px-3 py-2 rounded-md whitespace-pre-wrap ${k.role==="user"?"bg-accent/10 text-text-primary":"bg-surface-sunken text-text-secondary"}`,children:k.pending?m.jsx(jS,{msg:k}):k.role==="assistant"?m.jsx(dh,{content:k.content}):k.content}),!k.pending&&m.jsx("div",{className:"mt-0.5",children:m.jsx(TS,{msg:k,compileMessage:d})})]},k.id))]}),m.jsxs("div",{className:`border-t border-surface-border px-3 py-2.5 flex gap-2 shrink-0 transition-all duration-300 ${j?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[m.jsx("textarea",{ref:B,value:g,onChange:k=>{y(k.target.value);const X=k.target;X.style.height="auto",X.style.height=`${Math.min(X.scrollHeight,120)}px`},onKeyDown:ne,placeholder:"Ask a question...",rows:2,className:"flex-1 resize-none bg-surface text-xs text-text-primary placeholder:text-text-tertiary rounded px-2.5 py-1.5 border border-surface-border focus:outline-none focus:border-accent",style:{minHeight:"2.5rem"},disabled:!!f}),m.jsx("button",{onClick:V,disabled:!g.trim()||!!f,className:"px-2.5 py-1.5 text-accent hover:text-accent-hover disabled:text-text-muted transition-colors self-end","aria-label":"Send",children:m.jsx(Xx,{className:"w-4 h-4",strokeWidth:1.5})})]})]})}function CS(){var B;const{isSuperAdmin:r,hasRoleType:n,hasRole:s}=Oi(),{data:a}=dw(),o=!!((B=a==null?void 0:a.ai)!=null&&B.enabled),{collapsed:f,toggle:h}=Qg(),[d,g]=T.useState(!1),[y,E]=T.useState(!1),[w,j]=T.useState(()=>window.location.hash.startsWith("#docs")),z=Ws(),M=T.useRef(null);return T.useEffect(()=>{const V=M.current;V&&(V.classList.remove("animate-page-in"),V.offsetWidth,V.classList.add("animate-page-in"))},[z.pathname]),T.useEffect(()=>{const V=()=>{window.location.hash.startsWith("#docs")&&j(!0)};return window.addEventListener("hashchange",V),()=>window.removeEventListener("hashchange",V)},[]),m.jsxs("div",{className:"h-screen bg-surface flex flex-col",children:[m.jsx(xw,{onToggleEventFeed:()=>g(V=>!V),onToggleDocs:()=>j(V=>!V)}),m.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[m.jsxs("aside",{className:`${f?"w-16":"w-60"} shrink-0 bg-surface-raised border-r border-surface-border flex flex-col transition-[width] duration-200 ease-out overflow-hidden relative z-20`,children:[m.jsxs("nav",{className:"flex-1 px-3 pt-[36px] pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:[m.jsx(Ew,{aiEnabled:o}),(r||n("admin")||s("engineer"))&&m.jsx(Aw,{aiEnabled:o}),(r||n("admin")||s("engineer"))&&m.jsx(jw,{}),(r||n("admin"))&&m.jsx(Nw,{})]}),m.jsx("button",{onClick:h,className:`shrink-0 py-3 text-text-tertiary hover:text-text-secondary transition-colors duration-150 ${f?"flex justify-center":"flex items-center px-7"}`,"aria-label":f?"Expand sidebar":"Collapse sidebar",children:f?m.jsx(Kx,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):m.jsx(Zx,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5})})]}),m.jsx("main",{className:"flex-1 overflow-y-auto",children:m.jsx("div",{ref:M,className:"max-w-dashboard mx-auto px-10 py-10 pb-16 animate-page-in",children:m.jsx(wo,{})})})]}),m.jsx(Qw,{open:d,onToggle:()=>g(V=>!V),configOpen:y,onToggleConfig:()=>E(V=>!V)}),m.jsx(i2,{open:w,onClose:()=>{j(!1),history.replaceState(null,"",window.location.pathname+window.location.search)}}),o&&m.jsx(c2,{}),o&&m.jsx(NS,{})]})}function kS(){const{isAuthenticated:r}=Oi(),n=Ws();return r?m.jsx(pw,{children:m.jsx(o2,{children:m.jsx(CS,{})})}):m.jsx(Fs,{to:"/login",state:{from:n.pathname},replace:!0})}function oy({provider:r,className:n="w-5 h-5"}){switch(r){case"google":return m.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:[m.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"}),m.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"}),m.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"}),m.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 m.jsx("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:m.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 m.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:[m.jsx("path",{d:"M3 3h8.5v8.5H3z",fill:"#F25022"}),m.jsx("path",{d:"M12.5 3H21v8.5h-8.5z",fill:"#7FBA00"}),m.jsx("path",{d:"M3 12.5h8.5V21H3z",fill:"#00A4EF"}),m.jsx("path",{d:"M12.5 12.5H21V21h-8.5z",fill:"#FFB900"})]});case"anthropic":return m.jsx("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:m.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 m.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[m.jsx("circle",{cx:"12",cy:"12",r:"10"}),m.jsx("path",{d:"M12 8v4l3 3"})]})}}async function MS(){return Xe("/auth/oauth/providers")}async function RS(r,n){const s=n?`?label=${encodeURIComponent(n)}`:"";return Xe(`/auth/oauth/connections/${r}${s}`,{method:"DELETE"})}function PE(){return Hn({queryKey:["oauth-connections"],queryFn:()=>Xe("/auth/oauth/connections")})}function $E(){const r=Nn();return Pn({mutationFn:({provider:n,label:s})=>RS(n,s),onSuccess:()=>{r.invalidateQueries({queryKey:["oauth-connections"]})}})}function DS(){var X;const{login:r,isAuthenticated:n}=Oi(),s=ag(),a=Ws(),o=new URLSearchParams(a.search),f=o.get("token"),h=o.get("error"),d=((X=a.state)==null?void 0:X.from)??o.get("returnTo")??"/",g=T.useRef(!1);f&&!g.current&&(g.current=!0,r(f,void 0,{displayName:o.get("displayName"),username:o.get("username")}));const[y,E]=T.useState(""),[w,j]=T.useState(""),[z,M]=T.useState(h||""),[B,V]=T.useState(!1),[ne,ee]=T.useState(!!f),[pe,ae]=T.useState([]);if(T.useEffect(()=>{f||MS().then(ae).catch(()=>{})},[]),T.useEffect(()=>{if(!ne)return;const se=setTimeout(()=>s(d,{replace:!0}),1500);return()=>clearTimeout(se)},[ne]),n&&!ne)return m.jsx(Fs,{to:d,replace:!0});const k=async se=>{var W,F;if(se.preventDefault(),M(""),!y.trim()||!w){M("Username and password are required");return}V(!0);try{const Z=await fetch(`${Bn}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:y.trim(),password:w})}),le=await Z.json();if(!Z.ok){M(le.error||"Login failed");return}ee(!0),r(le.token,{username:y.trim(),password:w},{displayName:(W=le.user)==null?void 0:W.display_name,username:(F=le.user)==null?void 0:F.external_id})}catch{M("Unable to connect to server")}finally{V(!1)}};return m.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center overflow-hidden",children:m.jsxs("div",{className:"w-full max-w-md p-10",children:[m.jsx("div",{className:`mb-10 transition-all duration-[1500ms] ease-in ${ne?"translate-x-[120vw] -translate-y-[60vh] scale-[3] opacity-0":""}`,children:m.jsx(fh,{size:"lg",hideLabel:ne})}),m.jsxs("form",{onSubmit:k,className:`space-y-5 transition-opacity duration-300 ${ne?"opacity-0":""}`,children:[m.jsxs("div",{children:[m.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-text-secondary mb-2",children:"Username"}),m.jsx("input",{id:"username",type:"text",value:y,onChange:se=>E(se.target.value),className:"input",placeholder:"Enter your username",autoFocus:!ne,autoComplete:"username"})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-text-secondary mb-2",children:"Password"}),m.jsx("input",{id:"password",type:"password",value:w,onChange:se=>j(se.target.value),className:"input",placeholder:"Enter your password",autoComplete:"current-password"})]}),z&&m.jsx("p",{className:"text-sm text-status-error",children:z}),m.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:B||ne,children:B?"Signing in...":"Sign In"}),pe.length>0&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"flex items-center gap-3 mt-6",children:[m.jsx("div",{className:"flex-1 h-px bg-border"}),m.jsx("span",{className:"text-xs text-text-tertiary",children:"or continue with"}),m.jsx("div",{className:"flex-1 h-px bg-border"})]}),m.jsx("div",{className:"space-y-2",children:pe.filter(se=>se.provider!=="anthropic").map(se=>m.jsxs("a",{href:`${Bn}/api/auth/oauth/${se.provider}?returnTo=${encodeURIComponent(d)}`,className:"btn-secondary w-full flex items-center justify-center gap-2",children:[m.jsx(oy,{provider:se.provider}),"Sign in with ",se.name]},se.provider))})]})]})]})})}function eg(){const{isAuthenticated:r}=Oi(),n=ag(),s=Ws(),a=new URLSearchParams(s.search),o=a.get("state")||"";T.useEffect(()=>{r||n(`/login?returnTo=${encodeURIComponent(s.pathname+s.search)}`)},[r]);const[f,h]=T.useState(""),[d,g]=T.useState(a.get("label")||"default"),[y,E]=T.useState(""),[w,j]=T.useState(!1),z=f.trim().startsWith("sk-ant-oat"),M=f.trim().startsWith("sk-ant-api"),B=V=>{V.preventDefault();const ne=f.trim();if(!ne){E("A token or API key is required");return}if(!ne.startsWith("sk-ant-")){E('Invalid format. Must start with "sk-ant-oat" (OAuth token) or "sk-ant-api" (API key)');return}j(!0),E("");const ee=`${Bn}/api/auth/oauth/anthropic/callback?code=${encodeURIComponent(ne)}&state=${encodeURIComponent(o)}`;window.location.href=ee};return m.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:m.jsxs("div",{className:"w-full max-w-md p-10",children:[m.jsx("div",{className:"mb-10",children:m.jsx(fh,{size:"lg"})}),m.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[m.jsx(oy,{provider:"anthropic",className:"w-6 h-6"}),m.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Connect Anthropic"})]}),m.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."}),m.jsxs("form",{onSubmit:B,className:"space-y-5",children:[m.jsxs("div",{children:[m.jsx("label",{htmlFor:"token",className:"block text-sm font-medium text-text-secondary mb-2",children:"OAuth Token or API Key"}),m.jsx("input",{id:"token",type:"password",value:f,onChange:V=>h(V.target.value),className:"input",placeholder:"sk-ant-oat01-... or sk-ant-api03-...",autoFocus:!0,autoComplete:"off"}),z&&m.jsx("p",{className:"text-xs text-status-success mt-1",children:"OAuth token detected — uses your Claude subscription (flat rate)"}),M&&m.jsx("p",{className:"text-xs text-status-warning mt-1",children:"API key detected — billed per-token from your Anthropic API account"})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"label",className:"block text-sm font-medium text-text-secondary mb-2",children:"Label"}),m.jsx("input",{id:"label",type:"text",value:d,onChange:V=>g(V.target.value.replace(/\s+/g,"-").toLowerCase()),className:"input",placeholder:"default",autoComplete:"off"}),m.jsx("p",{className:"text-xs text-text-tertiary mt-1",children:'A name for this credential. Use different labels to store multiple credentials (e.g., "subscription", "api-batch").'})]}),y&&m.jsx("p",{className:"text-sm text-status-error",children:y}),m.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:w,children:w?"Validating...":"Connect"}),m.jsx("a",{href:"/",className:"block text-center text-sm text-text-tertiary hover:text-text-secondary",children:"Cancel"})]}),m.jsxs("div",{className:"mt-6 space-y-3 text-xs text-text-tertiary",children:[m.jsxs("div",{children:[m.jsx("span",{className:"font-medium text-text-secondary",children:"Recommended:"})," ","Run"," ",m.jsx("code",{className:"px-1 py-0.5 bg-surface-sunken rounded text-[11px]",children:"claude setup-token"})," ","in your terminal to generate an OAuth token that uses your subscription."]}),m.jsxs("div",{children:[m.jsx("span",{className:"font-medium text-text-secondary",children:"Alternative:"})," ","Use an API key from"," ",m.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 Af({roleTypes:r,roleNames:n,redirectTo:s="/"}){const{isSuperAdmin:a,hasRole:o,hasRoleType:f}=Oi();return a?m.jsx(wo,{}):r&&r.some(h=>f(h))?m.jsx(wo,{}):n&&n.some(h=>o(h))?m.jsx(wo,{}):m.jsx(Fs,{to:s,replace:!0})}const zS=T.lazy(()=>Ae(()=>import("./ProcessesListPage-CiprI5Wj.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]),import.meta.url).then(r=>({default:r.ProcessesListPage}))),qS=T.lazy(()=>Ae(()=>import("./ProcessDetailPage-8cJEBC_E.js"),__vite__mapDeps([16,1,2,4,17,13,18,15,9,6,19,20,21]),import.meta.url).then(r=>({default:r.ProcessDetailPage}))),US=T.lazy(()=>Ae(()=>import("./McpOverview-C4man2br.js"),__vite__mapDeps([22,1,23,24,25,26,12,13,27,6]),import.meta.url).then(r=>({default:r.McpOverview}))),BS=T.lazy(()=>Ae(()=>import("./McpRunsPage-i2FGJ6yf.js"),__vite__mapDeps([28,1,24,25,26,5,6,7,8,15,13,9,29,12,11,10,14,30]),import.meta.url).then(r=>({default:r.McpRunsPage}))),LS=T.lazy(()=>Ae(()=>import("./McpRunDetailPage-bJl08JSG.js"),__vite__mapDeps([31,1,24,18,12,13,32,6,33,34,14,35,36,11]),import.meta.url).then(r=>({default:r.McpRunDetailPage}))),HS=T.lazy(()=>Ae(()=>import("./McpQueryPage-C-mzOcGH.js"),__vite__mapDeps([37,1,12,13,7,8,11,10,14,9,29,15,30,5,6,4,38]),import.meta.url).then(r=>({default:r.McpQueryPage}))),PS=T.lazy(()=>Ae(()=>import("./McpQueryDetailPage-UR0bySPJ.js"),__vite__mapDeps([39,1,12,13,18,38,40,6,25,4,41,33,24,3,2,42,43,44,45,32,46,35]),import.meta.url).then(r=>({default:r.McpQueryDetailPage}))),$S=T.lazy(()=>Ae(()=>import("./EscalationsOverview-DSM8Mnb-.js"),__vite__mapDeps([47,1,4,12,13,27,6]),import.meta.url).then(r=>({default:r.EscalationsOverview}))),YS=T.lazy(()=>Ae(()=>import("./AvailableEscalationsPage-CEkeo_N4.js"),__vite__mapDeps([48,1,4,49,5,6,7,8,10,12,13,50,51,52,21,53,11,54,19,15,9,55,30,14]),import.meta.url).then(r=>({default:r.AvailableEscalationsPage}))),GS=T.lazy(()=>Ae(()=>import("./OperatorDashboard-DLpqyLle.js"),__vite__mapDeps([56,1,4,49,5,6,7,8,12,13,10,30,53,11,54,19,15,9,55,14]),import.meta.url).then(r=>({default:r.OperatorDashboard}))),VS=T.lazy(()=>Ae(()=>import("./index-CkcPZdQm.js"),__vite__mapDeps([57,1,34,49,12,13,55,3,4,20,21,51,50,18,19,32,6,33]),import.meta.url).then(r=>({default:r.EscalationDetailPage}))),FS=T.lazy(()=>Ae(()=>import("./WorkflowsOverview-BdSHBzzd.js"),__vite__mapDeps([58,1,3,4,12,13,27,6]),import.meta.url).then(r=>({default:r.WorkflowsOverview}))),JS=T.lazy(()=>Ae(()=>import("./index-Bv0eLXZq.js"),__vite__mapDeps([59,1,3,12,13,15,44,45,6,7,8,60,46,18]),import.meta.url).then(r=>({default:r.StartWorkflowPage}))),QS=T.lazy(()=>Ae(()=>import("./index-Bv0eLXZq.js"),__vite__mapDeps([59,1,3,12,13,15,44,45,6,7,8,60,46,18]),import.meta.url).then(r=>({default:r.DurableInvokePage}))),IS=T.lazy(()=>Ae(()=>import("./WorkflowsDashboard-nXLTR0OO.js"),__vite__mapDeps([61,1,9,29,3,4,5,6,7,8,15,13,12,11,10,14,30]),import.meta.url).then(r=>({default:()=>r.WorkflowsDashboard({tier:"durable"})}))),XS=T.lazy(()=>Ae(()=>import("./WorkflowsDashboard-nXLTR0OO.js"),__vite__mapDeps([61,1,9,29,3,4,5,6,7,8,15,13,12,11,10,14,30]),import.meta.url).then(r=>({default:()=>r.WorkflowsDashboard({tier:"all"})}))),KS=T.lazy(()=>Ae(()=>import("./YamlWorkflowsPage-BsO4L_SW.js"),__vite__mapDeps([62,1,25,40,5,6,63,12,13,11,8,43,44,45,42,60,46,18,64]),import.meta.url).then(r=>({default:r.YamlWorkflowsPage}))),ZS=T.lazy(()=>Ae(()=>import("./TasksListPage-DtR4F0ho.js"),__vite__mapDeps([65,1,2,3,5,6,7,8,18,54,46,10,11,12,13,15]),import.meta.url).then(r=>({default:r.TasksListPage}))),WS=T.lazy(()=>Ae(()=>import("./TaskDetailPage-Ck_0-iO2.js"),__vite__mapDeps([66,1,2,18,54,12,13,6]),import.meta.url).then(r=>({default:r.TaskDetailPage}))),tg=T.lazy(()=>Ae(()=>import("./WorkflowExecutionPage-B6mBqWq6.js"),__vite__mapDeps([67,1,3,4,34,2,12,13,33,14,18,32,6,35,36,11]),import.meta.url).then(r=>({default:r.WorkflowExecutionPage}))),eE=T.lazy(()=>Ae(()=>import("./AdminDashboard-B7AFFt4L.js"),__vite__mapDeps([68,1,2,4,23,17,13,6]),import.meta.url).then(r=>({default:r.AdminDashboard}))),tE=T.lazy(()=>Ae(()=>import("./index-B3wGNZN2.js"),__vite__mapDeps([69,1,3,7,8,11,30,5,6,12,13,70,15]),import.meta.url).then(r=>({default:r.WorkersPage}))),nE=T.lazy(()=>Ae(()=>import("./index-ox042ec_.js"),__vite__mapDeps([71,1,3,7,8,72,52,6,11,30,5,12,13,19,70,15,73,49,44,45]),import.meta.url).then(r=>({default:r.WorkflowConfigsPage}))),ng=T.lazy(()=>Ae(()=>import("./index-ox042ec_.js"),__vite__mapDeps([71,1,3,7,8,72,52,6,11,30,5,12,13,19,70,15,73,49,44,45]),import.meta.url).then(r=>({default:r.WorkflowConfigDetailPage}))),sE=T.lazy(()=>Ae(()=>import("./index-BnVnJcXw.js"),__vite__mapDeps([74,1,23,8,72,52,6,12,13,11,10,5,63,75,43,44,45,42,64,30,18]),import.meta.url).then(r=>({default:r.McpServersPage}))),sg=T.lazy(()=>Ae(()=>import("./index-B80zLZVl.js"),__vite__mapDeps([76,1,23,73,12,13,41,6]),import.meta.url).then(r=>({default:r.McpServerDetailPage}))),iE=T.lazy(()=>Ae(()=>import("./index-EqKHsaVz.js"),__vite__mapDeps([77,1,21,5,6,7,8,10,11,9,72,52,30,12,13,19,45,49,46]),import.meta.url).then(r=>({default:r.UsersPage}))),rE=T.lazy(()=>Ae(()=>import("./RolesPage-xo6AgPym.js"),__vite__mapDeps([78,1,49,7,8,72,52,6,12,13,19,30]),import.meta.url).then(r=>({default:r.RolesPage}))),aE=T.lazy(()=>Ae(()=>import("./index-DQs-LMoa.js"),__vite__mapDeps([79,1,12,13,52,6,50]),import.meta.url).then(r=>({default:r.MaintenancePage}))),lE=T.lazy(()=>Ae(()=>import("./index-Do1x4kN0.js"),__vite__mapDeps([80,1,17,13,11,5,6,81,52,33,70,7,8,30]),import.meta.url).then(r=>({default:r.ControlPlanePage}))),oE=T.lazy(()=>Ae(()=>import("./index-CsagXf3M.js"),__vite__mapDeps([82,1,6,81,5,7,8,10,11,9,12,13,14]),import.meta.url).then(r=>({default:r.StreamMessagesPage}))),cE=T.lazy(()=>Ae(()=>import("./CredentialsPage-CdPKxRBj.js"),__vite__mapDeps([83,1,12,13,46,72,52,6]),import.meta.url).then(r=>({default:r.CredentialsPage}))),uE=T.lazy(()=>Ae(()=>import("./index-Bb1ycul8.js"),__vite__mapDeps([84,1,6,12,13,11,14,8,85,46]),import.meta.url).then(r=>({default:r.FilesPage}))),fE=T.lazy(()=>Ae(()=>import("./index-DzQBDt3K.js"),__vite__mapDeps([86,1,12,13,11,14,10,8,85,46,87,41,6]),import.meta.url).then(r=>({default:r.KnowledgePage}))),hE=T.lazy(()=>Ae(()=>import("./HomePage-BkMEYnRK.js"),__vite__mapDeps([88,1,3,24,81,2,4,19,13,15,14,89,6]),import.meta.url).then(r=>({default:r.HomePage}))),dE=T.lazy(()=>Ae(()=>import("./AgentsPage-BR2-PdTq.js"),__vite__mapDeps([90,1,91,4,5,6,7,8,10,11,12,13,14]),import.meta.url).then(r=>({default:r.AgentsPage}))),mE=T.lazy(()=>Ae(()=>import("./AgentDetailPage-DnHaUCS5.js"),__vite__mapDeps([92,1,91,93,13,4,89,15,6]),import.meta.url).then(r=>({default:r.AgentDetailPage}))),ig=T.lazy(()=>Ae(()=>import("./AgentConfigPage-CjuCbr5J.js"),__vite__mapDeps([94,1,91,93,13,12,87,43,44,45,3,25,95,96,89,15,6]),import.meta.url).then(r=>({default:r.AgentConfigPage}))),pE=T.lazy(()=>Ae(()=>import("./CapabilitiesPage-CSUKBvEN.js"),__vite__mapDeps([97,1,95,75,23,43,44,45,13,42,64,6,12]),import.meta.url).then(r=>({default:r.CapabilitiesPage}))),gE=T.lazy(()=>Ae(()=>import("./TopicsPage-BdnJ7E_S.js"),__vite__mapDeps([98,1,96,5,6,7,8,10,11,12,13,14]),import.meta.url).then(r=>({default:r.TopicsPage}))),yE=T.lazy(()=>Ae(()=>import("./TopicDetailPage-DQkoAlsj.js"),__vite__mapDeps([99,1,96,14,13,6]),import.meta.url).then(r=>({default:r.TopicDetailPage})));function bE(){return m.jsxs("div",{className:"animate-pulse space-y-4",children:[m.jsx("div",{className:"h-8 bg-surface-sunken rounded w-48"}),m.jsx("div",{className:"h-40 bg-surface-sunken rounded"})]})}function xe({children:r}){return m.jsx(T.Suspense,{fallback:m.jsx(bE,{}),children:m.jsx("div",{className:"animate-page-enter",children:r})})}const cy=new vx({defaultOptions:{queries:{staleTime:1e4,retry:(r,n)=>n instanceof Error&&n.message==="Session expired"?!1:r<1}}});window.addEventListener("auth:unauthorized",()=>{cy.clear(),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info");const n=`${window.__LT_BASE__||""}/login`;window.location.pathname!==n&&(window.location.href=`${n}?returnTo=${encodeURIComponent(window.location.pathname)}`)});const xE=Sx([{path:"/login",element:m.jsx(DS,{})},{path:"/connect/anthropic",element:m.jsx(eg,{})},{path:"/connect/:provider",element:m.jsx(eg,{})},{path:"/",element:m.jsx(kS,{}),children:[{index:!0,element:m.jsx(xe,{children:m.jsx(hE,{})})},{path:"processes/all",element:m.jsx(xe,{children:m.jsx(zS,{})})},{path:"processes/detail/:originId",element:m.jsx(xe,{children:m.jsx(qS,{})})},{path:"credentials",element:m.jsx(xe,{children:m.jsx(cE,{})})},{path:"connections",element:m.jsx(Fs,{to:"/credentials",replace:!0})},{path:"escalations",element:m.jsx(xe,{children:m.jsx($S,{})})},{path:"escalations/available",element:m.jsx(xe,{children:m.jsx(YS,{})})},{path:"escalations/queue",element:m.jsx(xe,{children:m.jsx(GS,{})})},{path:"escalations/detail/:id",element:m.jsx(xe,{children:m.jsx(VS,{})})},{path:"capabilities",element:m.jsx(xe,{children:m.jsx(pE,{})})},{path:"agents",element:m.jsx(xe,{children:m.jsx(dE,{})})},{path:"agents/new",element:m.jsx(xe,{children:m.jsx(ig,{})})},{path:"agents/:id",element:m.jsx(xe,{children:m.jsx(mE,{})})},{path:"agents/:id/edit",element:m.jsx(xe,{children:m.jsx(ig,{})})},{path:"topics",element:m.jsx(xe,{children:m.jsx(gE,{})})},{path:"topics/:topic",element:m.jsx(xe,{children:m.jsx(yE,{})})},{element:m.jsx(Af,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:m.jsx(xe,{children:m.jsx(FS,{})})},{path:"workflows/executions",element:m.jsx(xe,{children:m.jsx(XS,{})})},{path:"workflows/durable/executions",element:m.jsx(xe,{children:m.jsx(IS,{})})},{path:"workflows/durable/executions/:workflowId",element:m.jsx(xe,{children:m.jsx(tg,{})})},{path:"workflows/tasks",element:m.jsx(xe,{children:m.jsx(ZS,{})})},{path:"workflows/tasks/detail/:id",element:m.jsx(xe,{children:m.jsx(WS,{})})},{path:"workflows/executions/:workflowId",element:m.jsx(xe,{children:m.jsx(tg,{})})},{path:"workflows/start",element:m.jsx(xe,{children:m.jsx(JS,{})})},{path:"workflows/durable/invoke",element:m.jsx(xe,{children:m.jsx(QS,{})})},{path:"workflows/cron",element:m.jsx(Fs,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:m.jsx(xe,{children:m.jsx(tE,{})})},{path:"workflows/registry",element:m.jsx(xe,{children:m.jsx(nE,{})})},{path:"workflows/registry/new",element:m.jsx(xe,{children:m.jsx(ng,{})})},{path:"workflows/registry/:workflowType",element:m.jsx(xe,{children:m.jsx(ng,{})})}]},{element:m.jsx(Af,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"mcp",element:m.jsx(xe,{children:m.jsx(US,{})})},{path:"mcp/queries",element:m.jsx(xe,{children:m.jsx(HS,{})})},{path:"mcp/queries/:workflowId",element:m.jsx(xe,{children:m.jsx(PS,{})})},{path:"mcp/tools",element:m.jsx(Fs,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:m.jsx(xe,{children:m.jsx(sE,{})})},{path:"mcp/servers/new",element:m.jsx(xe,{children:m.jsx(sg,{})})},{path:"mcp/servers/:serverId",element:m.jsx(xe,{children:m.jsx(sg,{})})},{path:"mcp/workflows",element:m.jsx(xe,{children:m.jsx(KS,{})})},{path:"mcp/executions",element:m.jsx(xe,{children:m.jsx(BS,{})})},{path:"mcp/executions/:jobId",element:m.jsx(xe,{children:m.jsx(LS,{})})},{path:"files",element:m.jsx(xe,{children:m.jsx(uE,{})})},{path:"knowledge",element:m.jsx(xe,{children:m.jsx(fE,{})})}]},{element:m.jsx(Af,{roleTypes:["admin","superadmin"]}),children:[{path:"admin",element:m.jsx(xe,{children:m.jsx(eE,{})})},{path:"admin/users",element:m.jsx(xe,{children:m.jsx(iE,{})})},{path:"admin/bots",element:m.jsx(Fs,{to:"/admin/users?tab=service-accounts",replace:!0})},{path:"admin/escalation-chains",element:m.jsx(Fs,{to:"/admin/roles",replace:!0})},{path:"admin/roles",element:m.jsx(xe,{children:m.jsx(rE,{})})},{path:"admin/maintenance",element:m.jsx(xe,{children:m.jsx(aE,{})})},{path:"admin/controlplane",element:m.jsx(xe,{children:m.jsx(lE,{})})},{path:"admin/streams",element:m.jsx(xe,{children:m.jsx(oE,{})})}]}]}],{basename:window.__LT_BASE__||"/"});function vE(){return m.jsx(_x,{client:cy,children:m.jsx(lv,{children:m.jsx(fw,{children:m.jsx(Ex,{router:xE})})})})}sv.createRoot(document.getElementById("root")).render(m.jsx(T.StrictMode,{children:m.jsx(vE,{})}));export{PE as A,$E as B,hh as C,ES as D,mg as E,Xg as F,Vw as J,Bn as L,u_ as N,oy as O,Rw as S,HE as a,Xe as b,h_ as c,SS as d,TE as e,vS as f,CE as g,ME as h,OE as i,Oi as j,DE as k,zE as l,qE as m,UE as n,BE as o,jE as p,yw as q,gw as r,kE as s,NE as t,dw as u,RE as v,ay as w,ly as x,LE as y,mh as z};
|
|
63
|
-
//# sourceMappingURL=index-
|
|
61
|
+
`}function m2(r){const n=r.summary,s=r.title;if(n){const a=n.search(/\n\s*\{[\s\S]*"title"\s*:/);return a>0?n.slice(0,a).trim():n}return s||(typeof r=="string"?r:"Query completed.")}const Ig=T.createContext(null);function p2({children:r}){const n=Ws(),[s,a]=T.useState(!1),[o,f]=T.useState([]),[h,d]=T.useState(null),[g,y]=T.useState({}),E=T.useRef(null),w={page:n.pathname.split("/").filter(Boolean).join("-")||"home",route:n.pathname,params:{},...g,suggestedTags:g.suggestedTags??h2(n.pathname)};T.useEffect(()=>()=>{E.current&&clearInterval(E.current)},[]);const j=T.useCallback(()=>a(ne=>!ne),[]),z=T.useCallback(ne=>{y(ne)},[]),M=T.useCallback(()=>{f([]),d(null)},[]),B=T.useCallback(async ne=>{var W;const ee=new Date().toISOString(),pe={id:`user-${Date.now()}`,role:"user",content:ne,timestamp:ee},ae={id:`pending-${Date.now()}`,role:"assistant",content:"",timestamp:ee,pending:!0};f(F=>[...F,pe,ae]);const k={...w};(W=k.entities)!=null&&W.yamlContent&&k.entities.yamlContent.length>B0&&(k.entities={...k.entities,yamlContent:k.entities.yamlContent.slice(0,B0)+`
|
|
62
|
+
... (truncated)`});const se=`${d2(o.concat(pe))}${ne}`;try{const Z=(await Xe("/insight/mcp-query",{method:"POST",body:JSON.stringify({prompt:se,tags:k.suggestedTags,context:k,wait:!1,direct:!0})})).workflow_id;d(Z),f(le=>le.map(re=>re.id===ae.id?{...re,workflowId:Z}:re)),E.current&&clearInterval(E.current),E.current=setInterval(async()=>{var le;try{const re=await Xe(`/workflows/${Z}/result`),qe=(le=re==null?void 0:re.result)==null?void 0:le.data;if(qe){E.current&&clearInterval(E.current),E.current=null,d(null);const Ge=m2(qe);let Le;try{Le=(await Xe(`/workflow-states/${Z}/execution`)).duration_ms}catch{}f($=>$.map(te=>te.id===ae.id?{...te,content:Ge,timestamp:new Date().toISOString(),pending:!1,durationMs:Le}:te))}}catch{}},3e3)}catch{f(F=>F.map(Z=>Z.id===ae.id?{...Z,content:"Failed to submit query. Please try again.",pending:!1}:Z))}},[o,w]),V=T.useCallback(async ne=>{const ee=o.find(k=>k.id===ne);if(!(ee!=null&&ee.workflowId)||ee.compilationStatus==="compiling"||ee.compilationStatus==="done")return;const pe=o.indexOf(ee),ae=o.slice(0,pe).reverse().find(k=>k.role==="user");if(ae){f(k=>k.map(X=>X.id===ne?{...X,compilationStatus:"compiling"}:X));try{const k=await Xe("/insight/mcp-query/describe",{method:"POST",body:JSON.stringify({prompt:ae.content,summary:ee.content})}),X=await Xe("/yaml-workflows",{method:"POST",body:JSON.stringify({workflow_id:ee.workflowId,task_queue:"long-tail-system",workflow_name:"mcpQuery",name:k.tool_name,description:k.description,tags:k.tags,app_id:"longtail"})});await Xe(`/yaml-workflows/${X.id}/deploy`,{method:"POST"}),f(se=>se.map(W=>W.id===ne?{...W,compilationStatus:"done"}:W))}catch(k){const X=k instanceof Error?k.message:"Compilation failed";f(se=>se.map(W=>W.id===ne?{...W,compilationStatus:"error",compilationError:X}:W))}}},[o]);return m.jsx(Ig.Provider,{value:{helpOpen:s,setHelpOpen:a,toggleHelp:j,messages:o,sendMessage:B,pageContext:w,setPageContext:z,activeWorkflowId:h,clearMessages:M,compileMessage:V},children:r})}function Xg(){const r=T.useContext(Ig);if(!r)throw new Error("useHelpAssistant must be used within HelpAssistantProvider");return r}function g2(){const{helpOpen:r,toggleHelp:n}=Xg();return m.jsx("button",{onClick:n,className:"fixed right-3 z-[45] flex items-center justify-center w-10 h-10 rounded-full bg-surface-raised shadow-lg hover:scale-110 transition-transform duration-150 border border-accent/30",style:{bottom:"44px"},"aria-label":r?"Close help":"Ask for help",children:r?m.jsx(Po,{className:"w-5 h-5 text-text-tertiary",strokeWidth:1.5}):m.jsx("img",{src:`${Bn}/logo512.png`,alt:"Help",className:"w-8 h-8 -rotate-[120deg]"})})}const Kg=6048e5,y2=864e5,L0=6e4,H0=525600,P0=43200,$0=1440,Y0=Symbol.for("constructDateFrom");function hs(r,n){return typeof r=="function"?r(n):r&&typeof r=="object"&&Y0 in r?r[Y0](n):r instanceof Date?new r.constructor(n):new Date(n)}function nn(r,n){return hs(n||r,r)}let b2={};function Va(){return b2}function Ha(r,n){var d,g,y,E;const s=Va(),a=(n==null?void 0:n.weekStartsOn)??((g=(d=n==null?void 0:n.locale)==null?void 0:d.options)==null?void 0:g.weekStartsOn)??s.weekStartsOn??((E=(y=s.locale)==null?void 0:y.options)==null?void 0:E.weekStartsOn)??0,o=nn(r,n==null?void 0:n.in),f=o.getDay(),h=(f<a?7:0)+f-a;return o.setDate(o.getDate()-h),o.setHours(0,0,0,0),o}function Lo(r,n){return Ha(r,{...n,weekStartsOn:1})}function Zg(r,n){const s=nn(r,n==null?void 0:n.in),a=s.getFullYear(),o=hs(s,0);o.setFullYear(a+1,0,4),o.setHours(0,0,0,0);const f=Lo(o),h=hs(s,0);h.setFullYear(a,0,4),h.setHours(0,0,0,0);const d=Lo(h);return s.getTime()>=f.getTime()?a+1:s.getTime()>=d.getTime()?a:a-1}function Ho(r){const n=nn(r),s=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return s.setUTCFullYear(n.getFullYear()),+r-+s}function Wg(r,...n){const s=hs.bind(null,r||n.find(a=>typeof a=="object"));return n.map(s)}function G0(r,n){const s=nn(r,n==null?void 0:n.in);return s.setHours(0,0,0,0),s}function x2(r,n,s){const[a,o]=Wg(s==null?void 0:s.in,r,n),f=G0(a),h=G0(o),d=+f-Ho(f),g=+h-Ho(h);return Math.round((d-g)/y2)}function v2(r,n){const s=Zg(r,n),a=hs(r,0);return a.setFullYear(s,0,4),a.setHours(0,0,0,0),Lo(a)}function _2(r,n){const s=+nn(r)-+nn(n);return s<0?-1:s>0?1:s}function w2(r){return hs(r,Date.now())}function S2(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}function E2(r){return!(!S2(r)&&typeof r!="number"||isNaN(+nn(r)))}function A2(r){return n=>{const a=(r?Math[r]:Math.trunc)(n);return a===0?0:a}}function O2(r,n){const s=nn(r,n==null?void 0:n.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}const j2={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"}},T2=(r,n,s)=>{let a;const o=j2[r];return typeof o=="string"?a=o:n===1?a=o.one:a=o.other.replace("{{count}}",n.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+a:a+" ago":a};function _f(r){return(n={})=>{const s=n.width?String(n.width):r.defaultWidth;return r.formats[s]||r.formats[r.defaultWidth]}}const N2={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},C2={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},k2={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},M2={date:_f({formats:N2,defaultWidth:"full"}),time:_f({formats:C2,defaultWidth:"full"}),dateTime:_f({formats:k2,defaultWidth:"full"})},R2={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},D2=(r,n,s,a)=>R2[r];function Oa(r){return(n,s)=>{const a=s!=null&&s.context?String(s.context):"standalone";let o;if(a==="formatting"&&r.formattingValues){const h=r.defaultFormattingWidth||r.defaultWidth,d=s!=null&&s.width?String(s.width):h;o=r.formattingValues[d]||r.formattingValues[h]}else{const h=r.defaultWidth,d=s!=null&&s.width?String(s.width):r.defaultWidth;o=r.values[d]||r.values[h]}const f=r.argumentCallback?r.argumentCallback(n):n;return o[f]}}const z2={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},q2={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},U2={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"]},B2={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"]},L2={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"}},H2={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"}},P2=(r,n)=>{const s=Number(r),a=s%100;if(a>20||a<10)switch(a%10){case 1:return s+"st";case 2:return s+"nd";case 3:return s+"rd"}return s+"th"},$2={ordinalNumber:P2,era:Oa({values:z2,defaultWidth:"wide"}),quarter:Oa({values:q2,defaultWidth:"wide",argumentCallback:r=>r-1}),month:Oa({values:U2,defaultWidth:"wide"}),day:Oa({values:B2,defaultWidth:"wide"}),dayPeriod:Oa({values:L2,defaultWidth:"wide",formattingValues:H2,defaultFormattingWidth:"wide"})};function ja(r){return(n,s={})=>{const a=s.width,o=a&&r.matchPatterns[a]||r.matchPatterns[r.defaultMatchWidth],f=n.match(o);if(!f)return null;const h=f[0],d=a&&r.parsePatterns[a]||r.parsePatterns[r.defaultParseWidth],g=Array.isArray(d)?G2(d,w=>w.test(h)):Y2(d,w=>w.test(h));let y;y=r.valueCallback?r.valueCallback(g):g,y=s.valueCallback?s.valueCallback(y):y;const E=n.slice(h.length);return{value:y,rest:E}}}function Y2(r,n){for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)&&n(r[s]))return s}function G2(r,n){for(let s=0;s<r.length;s++)if(n(r[s]))return s}function V2(r){return(n,s={})=>{const a=n.match(r.matchPattern);if(!a)return null;const o=a[0],f=n.match(r.parsePattern);if(!f)return null;let h=r.valueCallback?r.valueCallback(f[0]):f[0];h=s.valueCallback?s.valueCallback(h):h;const d=n.slice(o.length);return{value:h,rest:d}}}const F2=/^(\d+)(th|st|nd|rd)?/i,J2=/\d+/i,Q2={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},I2={any:[/^b/i,/^(a|c)/i]},X2={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},K2={any:[/1/i,/2/i,/3/i,/4/i]},Z2={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},W2={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]},eS={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},tS={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]},nS={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},sS={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}},iS={ordinalNumber:V2({matchPattern:F2,parsePattern:J2,valueCallback:r=>parseInt(r,10)}),era:ja({matchPatterns:Q2,defaultMatchWidth:"wide",parsePatterns:I2,defaultParseWidth:"any"}),quarter:ja({matchPatterns:X2,defaultMatchWidth:"wide",parsePatterns:K2,defaultParseWidth:"any",valueCallback:r=>r+1}),month:ja({matchPatterns:Z2,defaultMatchWidth:"wide",parsePatterns:W2,defaultParseWidth:"any"}),day:ja({matchPatterns:eS,defaultMatchWidth:"wide",parsePatterns:tS,defaultParseWidth:"any"}),dayPeriod:ja({matchPatterns:nS,defaultMatchWidth:"any",parsePatterns:sS,defaultParseWidth:"any"})},ey={code:"en-US",formatDistance:T2,formatLong:M2,formatRelative:D2,localize:$2,match:iS,options:{weekStartsOn:0,firstWeekContainsDate:1}};function rS(r,n){const s=nn(r,n==null?void 0:n.in);return x2(s,O2(s))+1}function aS(r,n){const s=nn(r,n==null?void 0:n.in),a=+Lo(s)-+v2(s);return Math.round(a/Kg)+1}function ty(r,n){var E,w,j,z;const s=nn(r,n==null?void 0:n.in),a=s.getFullYear(),o=Va(),f=(n==null?void 0:n.firstWeekContainsDate)??((w=(E=n==null?void 0:n.locale)==null?void 0:E.options)==null?void 0:w.firstWeekContainsDate)??o.firstWeekContainsDate??((z=(j=o.locale)==null?void 0:j.options)==null?void 0:z.firstWeekContainsDate)??1,h=hs((n==null?void 0:n.in)||r,0);h.setFullYear(a+1,0,f),h.setHours(0,0,0,0);const d=Ha(h,n),g=hs((n==null?void 0:n.in)||r,0);g.setFullYear(a,0,f),g.setHours(0,0,0,0);const y=Ha(g,n);return+s>=+d?a+1:+s>=+y?a:a-1}function lS(r,n){var d,g,y,E;const s=Va(),a=(n==null?void 0:n.firstWeekContainsDate)??((g=(d=n==null?void 0:n.locale)==null?void 0:d.options)==null?void 0:g.firstWeekContainsDate)??s.firstWeekContainsDate??((E=(y=s.locale)==null?void 0:y.options)==null?void 0:E.firstWeekContainsDate)??1,o=ty(r,n),f=hs((n==null?void 0:n.in)||r,0);return f.setFullYear(o,0,a),f.setHours(0,0,0,0),Ha(f,n)}function oS(r,n){const s=nn(r,n==null?void 0:n.in),a=+Ha(s,n)-+lS(s,n);return Math.round(a/Kg)+1}function Ye(r,n){const s=r<0?"-":"",a=Math.abs(r).toString().padStart(n,"0");return s+a}const Gs={y(r,n){const s=r.getFullYear(),a=s>0?s:1-s;return Ye(n==="yy"?a%100:a,n.length)},M(r,n){const s=r.getMonth();return n==="M"?String(s+1):Ye(s+1,2)},d(r,n){return Ye(r.getDate(),n.length)},a(r,n){const s=r.getHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return s.toUpperCase();case"aaa":return s;case"aaaaa":return s[0];case"aaaa":default:return s==="am"?"a.m.":"p.m."}},h(r,n){return Ye(r.getHours()%12||12,n.length)},H(r,n){return Ye(r.getHours(),n.length)},m(r,n){return Ye(r.getMinutes(),n.length)},s(r,n){return Ye(r.getSeconds(),n.length)},S(r,n){const s=n.length,a=r.getMilliseconds(),o=Math.trunc(a*Math.pow(10,s-3));return Ye(o,n.length)}},pr={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},V0={G:function(r,n,s){const a=r.getFullYear()>0?1:0;switch(n){case"G":case"GG":case"GGG":return s.era(a,{width:"abbreviated"});case"GGGGG":return s.era(a,{width:"narrow"});case"GGGG":default:return s.era(a,{width:"wide"})}},y:function(r,n,s){if(n==="yo"){const a=r.getFullYear(),o=a>0?a:1-a;return s.ordinalNumber(o,{unit:"year"})}return Gs.y(r,n)},Y:function(r,n,s,a){const o=ty(r,a),f=o>0?o:1-o;if(n==="YY"){const h=f%100;return Ye(h,2)}return n==="Yo"?s.ordinalNumber(f,{unit:"year"}):Ye(f,n.length)},R:function(r,n){const s=Zg(r);return Ye(s,n.length)},u:function(r,n){const s=r.getFullYear();return Ye(s,n.length)},Q:function(r,n,s){const a=Math.ceil((r.getMonth()+1)/3);switch(n){case"Q":return String(a);case"QQ":return Ye(a,2);case"Qo":return s.ordinalNumber(a,{unit:"quarter"});case"QQQ":return s.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return s.quarter(a,{width:"narrow",context:"formatting"});case"QQQQ":default:return s.quarter(a,{width:"wide",context:"formatting"})}},q:function(r,n,s){const a=Math.ceil((r.getMonth()+1)/3);switch(n){case"q":return String(a);case"qq":return Ye(a,2);case"qo":return s.ordinalNumber(a,{unit:"quarter"});case"qqq":return s.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return s.quarter(a,{width:"narrow",context:"standalone"});case"qqqq":default:return s.quarter(a,{width:"wide",context:"standalone"})}},M:function(r,n,s){const a=r.getMonth();switch(n){case"M":case"MM":return Gs.M(r,n);case"Mo":return s.ordinalNumber(a+1,{unit:"month"});case"MMM":return s.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return s.month(a,{width:"narrow",context:"formatting"});case"MMMM":default:return s.month(a,{width:"wide",context:"formatting"})}},L:function(r,n,s){const a=r.getMonth();switch(n){case"L":return String(a+1);case"LL":return Ye(a+1,2);case"Lo":return s.ordinalNumber(a+1,{unit:"month"});case"LLL":return s.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return s.month(a,{width:"narrow",context:"standalone"});case"LLLL":default:return s.month(a,{width:"wide",context:"standalone"})}},w:function(r,n,s,a){const o=oS(r,a);return n==="wo"?s.ordinalNumber(o,{unit:"week"}):Ye(o,n.length)},I:function(r,n,s){const a=aS(r);return n==="Io"?s.ordinalNumber(a,{unit:"week"}):Ye(a,n.length)},d:function(r,n,s){return n==="do"?s.ordinalNumber(r.getDate(),{unit:"date"}):Gs.d(r,n)},D:function(r,n,s){const a=rS(r);return n==="Do"?s.ordinalNumber(a,{unit:"dayOfYear"}):Ye(a,n.length)},E:function(r,n,s){const a=r.getDay();switch(n){case"E":case"EE":case"EEE":return s.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return s.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(a,{width:"short",context:"formatting"});case"EEEE":default:return s.day(a,{width:"wide",context:"formatting"})}},e:function(r,n,s,a){const o=r.getDay(),f=(o-a.weekStartsOn+8)%7||7;switch(n){case"e":return String(f);case"ee":return Ye(f,2);case"eo":return s.ordinalNumber(f,{unit:"day"});case"eee":return s.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return s.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(o,{width:"short",context:"formatting"});case"eeee":default:return s.day(o,{width:"wide",context:"formatting"})}},c:function(r,n,s,a){const o=r.getDay(),f=(o-a.weekStartsOn+8)%7||7;switch(n){case"c":return String(f);case"cc":return Ye(f,n.length);case"co":return s.ordinalNumber(f,{unit:"day"});case"ccc":return s.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return s.day(o,{width:"narrow",context:"standalone"});case"cccccc":return s.day(o,{width:"short",context:"standalone"});case"cccc":default:return s.day(o,{width:"wide",context:"standalone"})}},i:function(r,n,s){const a=r.getDay(),o=a===0?7:a;switch(n){case"i":return String(o);case"ii":return Ye(o,n.length);case"io":return s.ordinalNumber(o,{unit:"day"});case"iii":return s.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return s.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return s.day(a,{width:"short",context:"formatting"});case"iiii":default:return s.day(a,{width:"wide",context:"formatting"})}},a:function(r,n,s){const o=r.getHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(r,n,s){const a=r.getHours();let o;switch(a===12?o=pr.noon:a===0?o=pr.midnight:o=a/12>=1?"pm":"am",n){case"b":case"bb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(r,n,s){const a=r.getHours();let o;switch(a>=17?o=pr.evening:a>=12?o=pr.afternoon:a>=4?o=pr.morning:o=pr.night,n){case"B":case"BB":case"BBB":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(r,n,s){if(n==="ho"){let a=r.getHours()%12;return a===0&&(a=12),s.ordinalNumber(a,{unit:"hour"})}return Gs.h(r,n)},H:function(r,n,s){return n==="Ho"?s.ordinalNumber(r.getHours(),{unit:"hour"}):Gs.H(r,n)},K:function(r,n,s){const a=r.getHours()%12;return n==="Ko"?s.ordinalNumber(a,{unit:"hour"}):Ye(a,n.length)},k:function(r,n,s){let a=r.getHours();return a===0&&(a=24),n==="ko"?s.ordinalNumber(a,{unit:"hour"}):Ye(a,n.length)},m:function(r,n,s){return n==="mo"?s.ordinalNumber(r.getMinutes(),{unit:"minute"}):Gs.m(r,n)},s:function(r,n,s){return n==="so"?s.ordinalNumber(r.getSeconds(),{unit:"second"}):Gs.s(r,n)},S:function(r,n){return Gs.S(r,n)},X:function(r,n,s){const a=r.getTimezoneOffset();if(a===0)return"Z";switch(n){case"X":return J0(a);case"XXXX":case"XX":return Ei(a);case"XXXXX":case"XXX":default:return Ei(a,":")}},x:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"x":return J0(a);case"xxxx":case"xx":return Ei(a);case"xxxxx":case"xxx":default:return Ei(a,":")}},O:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"O":case"OO":case"OOO":return"GMT"+F0(a,":");case"OOOO":default:return"GMT"+Ei(a,":")}},z:function(r,n,s){const a=r.getTimezoneOffset();switch(n){case"z":case"zz":case"zzz":return"GMT"+F0(a,":");case"zzzz":default:return"GMT"+Ei(a,":")}},t:function(r,n,s){const a=Math.trunc(+r/1e3);return Ye(a,n.length)},T:function(r,n,s){return Ye(+r,n.length)}};function F0(r,n=""){const s=r>0?"-":"+",a=Math.abs(r),o=Math.trunc(a/60),f=a%60;return f===0?s+String(o):s+String(o)+n+Ye(f,2)}function J0(r,n){return r%60===0?(r>0?"-":"+")+Ye(Math.abs(r)/60,2):Ei(r,n)}function Ei(r,n=""){const s=r>0?"-":"+",a=Math.abs(r),o=Ye(Math.trunc(a/60),2),f=Ye(a%60,2);return s+o+n+f}const Q0=(r,n)=>{switch(r){case"P":return n.date({width:"short"});case"PP":return n.date({width:"medium"});case"PPP":return n.date({width:"long"});case"PPPP":default:return n.date({width:"full"})}},ny=(r,n)=>{switch(r){case"p":return n.time({width:"short"});case"pp":return n.time({width:"medium"});case"ppp":return n.time({width:"long"});case"pppp":default:return n.time({width:"full"})}},cS=(r,n)=>{const s=r.match(/(P+)(p+)?/)||[],a=s[1],o=s[2];if(!o)return Q0(r,n);let f;switch(a){case"P":f=n.dateTime({width:"short"});break;case"PP":f=n.dateTime({width:"medium"});break;case"PPP":f=n.dateTime({width:"long"});break;case"PPPP":default:f=n.dateTime({width:"full"});break}return f.replace("{{date}}",Q0(a,n)).replace("{{time}}",ny(o,n))},uS={p:ny,P:cS},fS=/^D+$/,hS=/^Y+$/,dS=["D","DD","YY","YYYY"];function mS(r){return fS.test(r)}function pS(r){return hS.test(r)}function gS(r,n,s){const a=yS(r,n,s);if(console.warn(a),dS.includes(r))throw new RangeError(a)}function yS(r,n,s){const a=r[0]==="Y"?"years":"days of the month";return`Use \`${r.toLowerCase()}\` instead of \`${r}\` (in \`${n}\`) for formatting ${a} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const bS=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,xS=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,vS=/^'([^]*?)'?$/,_S=/''/g,wS=/[a-zA-Z]/;function sy(r,n,s){var E,w,j,z;const a=Va(),o=a.locale??ey,f=a.firstWeekContainsDate??((w=(E=a.locale)==null?void 0:E.options)==null?void 0:w.firstWeekContainsDate)??1,h=a.weekStartsOn??((z=(j=a.locale)==null?void 0:j.options)==null?void 0:z.weekStartsOn)??0,d=nn(r,s==null?void 0:s.in);if(!E2(d))throw new RangeError("Invalid time value");let g=n.match(xS).map(M=>{const B=M[0];if(B==="p"||B==="P"){const V=uS[B];return V(M,o.formatLong)}return M}).join("").match(bS).map(M=>{if(M==="''")return{isToken:!1,value:"'"};const B=M[0];if(B==="'")return{isToken:!1,value:SS(M)};if(V0[B])return{isToken:!0,value:M};if(B.match(wS))throw new RangeError("Format string contains an unescaped latin alphabet character `"+B+"`");return{isToken:!1,value:M}});o.localize.preprocessor&&(g=o.localize.preprocessor(d,g));const y={firstWeekContainsDate:f,weekStartsOn:h,locale:o};return g.map(M=>{if(!M.isToken)return M.value;const B=M.value;(pS(B)||mS(B))&&gS(B,n,String(r));const V=V0[B[0]];return V(d,B,o.localize,y)}).join("")}function SS(r){const n=r.match(vS);return n?n[1].replace(_S,"'"):r}function ES(r,n,s){const a=Va(),o=(s==null?void 0:s.locale)??a.locale??ey,f=_2(r,n);if(isNaN(f))throw new RangeError("Invalid time value");const h=Object.assign({},s,{addSuffix:s==null?void 0:s.addSuffix,comparison:f}),[d,g]=Wg(s==null?void 0:s.in,...f>0?[n,r]:[r,n]),y=A2((s==null?void 0:s.roundingMethod)??"round"),E=g.getTime()-d.getTime(),w=E/L0,j=Ho(g)-Ho(d),z=(E-j)/L0,M=s==null?void 0:s.unit;let B;if(M?B=M:w<1?B="second":w<60?B="minute":w<$0?B="hour":z<P0?B="day":z<H0?B="month":B="year",B==="second"){const V=y(E/1e3);return o.formatDistance("xSeconds",V,h)}else if(B==="minute"){const V=y(w);return o.formatDistance("xMinutes",V,h)}else if(B==="hour"){const V=y(w/60);return o.formatDistance("xHours",V,h)}else if(B==="day"){const V=y(z/$0);return o.formatDistance("xDays",V,h)}else if(B==="month"){const V=y(z/P0);return V===12&&M!=="month"?o.formatDistance("xYears",1,h):o.formatDistance("xMonths",V,h)}else{const V=y(z/H0);return o.formatDistance("xYears",V,h)}}function AS(r,n){return ES(r,w2(r),n)}function OS(r){const n=new Date(r);return n.getTime()>Date.now()?"just now":AS(n,{addSuffix:!0})}function FE(r){return r<=0?"Expired":fh(r)}function jS(r){return r==null?"--":fh(r)}function fh(r){if(r<1e3)return`${Math.round(r)}ms`;if(r<6e4){const h=r/1e3;return Number.isInteger(h)?`${h}s`:`${h.toFixed(1)}s`}const n=Math.floor(r/1e3),s=Math.floor(n/86400),a=Math.floor(n%86400/3600),o=Math.floor(n%3600/60),f=n%60;return s>0?a>0?`${s}d ${a}h`:`${s}d`:a>0?o>0?`${a}h ${o}m`:`${a}h`:f>0?`${o}m ${f}s`:`${o}m`}function JE(r,n){const s=new Date(r).getTime(),a=n?new Date(n).getTime():Date.now();return fh(a-s)}function iy({options:r,children:n,className:s=""}){const[a,o]=T.useState(!1),[f,h]=T.useState(null),[d,g]=T.useState(null),y=T.useRef(null),E=T.useRef(void 0),w=T.useRef(void 0),j=220,z=T.useCallback(()=>{if(!y.current)return;const ne=y.current.getBoundingClientRect(),ee=window.innerWidth-j-8,pe=Math.max(8,Math.min(ne.left,ee));g({top:ne.bottom+4,left:pe})},[]),M=T.useCallback(async(ne,ee)=>{try{await navigator.clipboard.writeText(ne),h(ee),clearTimeout(E.current),E.current=setTimeout(()=>h(null),1200)}catch{}},[]),B=T.useCallback(()=>{clearTimeout(w.current),z(),o(!0)},[z]),V=T.useCallback(()=>{w.current=setTimeout(()=>o(!1),150)},[]);return T.useEffect(()=>()=>{clearTimeout(E.current),clearTimeout(w.current)},[]),m.jsxs("span",{ref:y,className:`inline-flex items-center cursor-default ${s}`,onMouseEnter:B,onMouseLeave:V,children:[n,a&&d&&ng.createPortal(m.jsx("span",{className:"fixed z-[9999] bg-surface-raised border border-surface-border rounded shadow-lg py-1 min-w-[180px]",style:{top:d.top,left:d.left},onMouseEnter:B,onMouseLeave:V,children:r.map(ne=>m.jsxs("button",{onClick:ee=>{ee.stopPropagation(),M(ne.value,ne.label)},className:"flex items-center justify-between w-full px-2.5 py-1 text-left hover:bg-surface-hover transition-colors",children:[m.jsx("span",{className:"text-[9px] font-medium uppercase tracking-wider text-text-tertiary w-10 shrink-0",children:ne.label}),m.jsx("span",{className:"text-[10px] font-mono text-text-secondary truncate ml-2",children:f===ne.label?"✓":ne.value})]},ne.label))}),document.body)]})}function TS(r,n){const s=new Date(r);switch(n){case"relative":return OS(r);case"datetime":return sy(s,"MMM d, yyyy h:mm a");case"time":return s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}}function NS(r){const n=new Date(r);return[{label:"ms",value:String(n.getTime())},{label:"utc",value:n.toISOString()},{label:"local",value:sy(n,"MMM d, yyyy h:mm:ss a")}]}function CS({date:r,format:n="relative",className:s=""}){const[,a]=T.useState(0);T.useEffect(()=>{if(n!=="relative")return;const f=setInterval(()=>a(h=>h+1),3e4);return()=>clearInterval(f)},[n]);const o=T.useMemo(()=>NS(r),[r]);return m.jsx(iy,{options:o,children:m.jsx("time",{dateTime:r,className:`text-xs text-text-tertiary ${s}`,children:TS(r,n)})})}function kS({ms:r,className:n=""}){const s=jS(r),a=T.useMemo(()=>r==null?[]:[{label:"ms",value:String(r)},{label:"sec",value:`${(r/1e3).toFixed(3)}s`},{label:"text",value:s}],[r,s]);return r==null?m.jsx("span",{className:`text-xs text-text-tertiary ${n}`,children:"--"}):m.jsx(iy,{options:a,children:m.jsx("span",{className:`text-xs text-text-tertiary ${n}`,children:s})})}const MS=["sm","md","lg","full"],I0={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"},X0={sm:"Small",md:"Medium",lg:"Large",full:"Fullscreen"};function RS({which:r}){const n="stroke-current";switch(r){case"sm":return m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:m.jsx("rect",{x:"5",y:"5",width:"7",height:"7",rx:"1.5",className:n,strokeWidth:"1.5"})});case"md":return m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:m.jsx("rect",{x:"3",y:"3",width:"9",height:"9",rx:"1.5",className:n,strokeWidth:"1.5"})});case"lg":return m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:m.jsx("rect",{x:"1.5",y:"1.5",width:"11",height:"11",rx:"1.5",className:n,strokeWidth:"1.5"})});case"full":return m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:m.jsx("rect",{x:"0.75",y:"0.75",width:"12.5",height:"12.5",rx:"1.5",className:n,strokeWidth:"1.5"})})}}function DS({msg:r}){const[n,s]=T.useState(0);T.useEffect(()=>{const h=new Date(r.timestamp).getTime(),d=()=>s(Math.floor((Date.now()-h)/1e3));d();const g=setInterval(d,1e3);return()=>clearInterval(g)},[r.timestamp]);const a=Math.floor(n/60),o=n%60,f=a>0?`${a}m ${o}s`:`${o}s`;return m.jsxs("span",{className:"inline-flex flex-col gap-1.5",children:[m.jsxs("span",{className:"inline-flex items-center gap-1",children:[m.jsx("span",{className:"text-text-tertiary",children:"Thinking"}),m.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse"}),m.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:150ms]"}),m.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:300ms]"}),m.jsx("span",{className:"text-text-muted ml-1 tabular-nums",children:f})]}),r.workflowId&&m.jsxs(gr,{to:`/workflows/executions/${r.workflowId}`,className:"inline-flex items-center gap-1 text-[10px] text-accent/70 hover:text-accent transition-colors",children:[m.jsx(og,{className:"w-2.5 h-2.5",strokeWidth:1.5}),"watch execution"]})]})}function zS({msg:r,compileMessage:n}){const s=r.role==="assistant";return m.jsxs("div",{className:`flex items-center gap-1.5 ${s?"justify-start":"justify-end"}`,children:[m.jsx(CS,{date:r.timestamp,format:"time",className:"!text-[9px] text-text-muted/50"}),r.durationMs!=null&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"text-text-muted/30 text-[8px]",children:"·"}),m.jsx(kS,{ms:r.durationMs,className:"!text-[9px] text-text-muted/50"})]}),r.workflowId&&m.jsx(gr,{to:`/workflows/executions/${r.workflowId}`,className:"text-text-muted/40 hover:text-accent transition-colors",title:"View workflow execution",children:m.jsx(og,{className:"w-2.5 h-2.5",strokeWidth:1.5})}),s&&r.workflowId&&!r.pending&&m.jsx("button",{onClick:()=>n(r.id),disabled:r.compilationStatus==="compiling"||r.compilationStatus==="done",className:"transition-colors",title:r.compilationStatus==="done"?"Compiled — future queries will match this pipeline":r.compilationStatus==="error"?r.compilationError??"Compilation failed":r.compilationStatus==="compiling"?"Compiling...":"Compile to fast pipeline",children:m.jsx(Wx,{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 qS(){const{helpOpen:r,setHelpOpen:n,messages:s,sendMessage:a,pageContext:o,activeWorkflowId:f,clearMessages:h,compileMessage:d}=Xg(),[g,y]=T.useState(""),[E,w]=T.useState("md"),[j,z]=T.useState(!0),M=T.useRef(null),B=T.useRef(null);if(T.useEffect(()=>{M.current&&(M.current.scrollTop=M.current.scrollHeight)},[s]),T.useEffect(()=>{r&&B.current&&B.current.focus()},[r]),T.useEffect(()=>{if(!r)return;const k=X=>{X.key==="Escape"&&(E==="full"?w("lg"):E==="lg"?w("md"):E==="md"?w("sm"):n(!1))};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[r,E,n]),!r)return null;const V=()=>{const k=g.trim();!k||f||(a(k),y(""),B.current&&(B.current.style.height="auto"))},ne=k=>{k.key==="Enter"&&!k.shiftKey&&(k.preventDefault(),V())},ee=E==="full",pe=o.page.replace(/-/g," "),ae=ee?{}:{bottom:"108px"};return m.jsxs("div",{className:`fixed z-[45] flex flex-col border border-surface-border rounded-lg overflow-hidden transition-all duration-300 ${ee?I0.full:`right-6 ${I0[E]}`} ${j?"bg-surface-raised shadow-xl":"bg-surface-raised/[0.03] shadow-lg shadow-black/5"}`,style:ae,onMouseEnter:()=>z(!0),onMouseLeave:()=>z(!1),children:[m.jsxs("div",{className:`flex items-center justify-between px-4 py-2.5 border-b border-surface-border shrink-0 transition-all duration-300 ${j?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("p",{className:"text-xs font-medium text-text-primary truncate",children:"Help Assistant"}),m.jsx("p",{className:"text-[10px] text-text-tertiary truncate",children:pe})]}),m.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[m.jsx("div",{className:"flex items-center gap-0.5 border border-surface-border rounded p-0.5",role:"radiogroup","aria-label":"Panel size",children:MS.map(k=>m.jsx("button",{onClick:()=>w(k),className:`p-1 rounded transition-colors ${k===E?"bg-accent/15 text-accent":"text-text-muted hover:text-text-secondary hover:bg-surface-hover"}`,role:"radio","aria-checked":k===E,"aria-label":X0[k],title:X0[k],children:m.jsx(RS,{which:k})},k))}),s.length>0&&m.jsx("button",{onClick:h,className:"p-1 text-text-tertiary hover:text-text-secondary transition-colors","aria-label":"Clear conversation",title:"Clear conversation",children:m.jsx(ev,{className:"w-3.5 h-3.5",strokeWidth:1.5})}),m.jsx("button",{onClick:()=>n(!1),className:"p-1 text-text-tertiary hover:text-text-primary transition-colors","aria-label":"Close",title:"Close",children:m.jsx(Po,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]})]}),m.jsxs("div",{ref:M,className:`flex-1 overflow-y-auto px-4 py-3 space-y-3 min-h-[120px] transition-all duration-300 ${j?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[s.length===0&&m.jsx("p",{className:"text-xs text-text-tertiary text-center py-6",children:"Ask anything about what you're viewing."}),s.map(k=>m.jsxs("div",{className:`text-xs leading-relaxed ${k.role==="user"?"text-right":"text-left"}`,children:[m.jsx("div",{className:`inline-block max-w-[85%] px-3 py-2 rounded-md whitespace-pre-wrap ${k.role==="user"?"bg-accent/10 text-text-primary":"bg-surface-sunken text-text-secondary"}`,children:k.pending?m.jsx(DS,{msg:k}):k.role==="assistant"?m.jsx(uh,{content:k.content}):k.content}),!k.pending&&m.jsx("div",{className:"mt-0.5",children:m.jsx(zS,{msg:k,compileMessage:d})})]},k.id))]}),m.jsxs("div",{className:`border-t border-surface-border px-3 py-2.5 flex gap-2 shrink-0 transition-all duration-300 ${j?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[m.jsx("textarea",{ref:B,value:g,onChange:k=>{y(k.target.value);const X=k.target;X.style.height="auto",X.style.height=`${Math.min(X.scrollHeight,120)}px`},onKeyDown:ne,placeholder:"Ask a question...",rows:2,className:"flex-1 resize-none bg-surface text-xs text-text-primary placeholder:text-text-tertiary rounded px-2.5 py-1.5 border border-surface-border focus:outline-none focus:border-accent",style:{minHeight:"2.5rem"},disabled:!!f}),m.jsx("button",{onClick:V,disabled:!g.trim()||!!f,className:"px-2.5 py-1.5 text-accent hover:text-accent-hover disabled:text-text-muted transition-colors self-end","aria-label":"Send",children:m.jsx(tv,{className:"w-4 h-4",strokeWidth:1.5})})]})]})}function US(){var B;const{isSuperAdmin:r,hasRoleType:n,hasRole:s}=Oi(),{data:a}=bw(),o=!!((B=a==null?void 0:a.ai)!=null&&B.enabled),{collapsed:f,toggle:h}=Vg(),[d,g]=T.useState(!1),[y,E]=T.useState(!1),[w,j]=T.useState(()=>window.location.hash.startsWith("#docs")),z=Ws(),M=T.useRef(null);return T.useEffect(()=>{const V=M.current;V&&(V.classList.remove("animate-page-in"),V.offsetWidth,V.classList.add("animate-page-in"))},[z.pathname]),T.useEffect(()=>{const V=()=>{window.location.hash.startsWith("#docs")&&j(!0)};return window.addEventListener("hashchange",V),()=>window.removeEventListener("hashchange",V)},[]),m.jsxs("div",{className:"h-screen bg-surface flex flex-col",children:[m.jsx(Ew,{onToggleEventFeed:()=>g(V=>!V),onToggleDocs:()=>j(V=>!V)}),m.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[m.jsxs("aside",{className:`${f?"w-16":"w-60"} shrink-0 bg-surface-raised border-r border-surface-border flex flex-col transition-[width] duration-200 ease-out overflow-hidden relative z-20`,children:[m.jsxs("nav",{className:"flex-1 px-3 pt-[36px] pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:[m.jsx(Nw,{aiEnabled:o}),(r||n("admin")||s("engineer"))&&m.jsx(Cw,{}),o&&(r||n("admin")||s("engineer"))&&m.jsx(Mw,{}),(r||n("admin")||s("engineer"))&&m.jsx(Dw,{}),(r||n("admin"))&&m.jsx(qw,{})]}),m.jsx("button",{onClick:h,className:`shrink-0 py-3 text-text-tertiary hover:text-text-secondary transition-colors duration-150 ${f?"flex justify-center":"flex items-center px-7"}`,"aria-label":f?"Expand sidebar":"Collapse sidebar",children:f?m.jsx(nv,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):m.jsx(sv,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5})})]}),m.jsx("main",{className:"flex-1 overflow-y-auto",children:m.jsx("div",{ref:M,className:"max-w-dashboard mx-auto px-10 py-10 pb-16 animate-page-in",children:m.jsx(wo,{})})})]}),m.jsx(t2,{open:d,onToggle:()=>g(V=>!V),configOpen:y,onToggleConfig:()=>E(V=>!V)}),m.jsx(f2,{open:w,onClose:()=>{j(!1),history.replaceState(null,"",window.location.pathname+window.location.search)}}),o&&m.jsx(g2,{}),o&&m.jsx(qS,{})]})}function BS(){const{isAuthenticated:r}=Oi(),n=Ws();return r?m.jsx(vw,{children:m.jsx(p2,{children:m.jsx(US,{})})}):m.jsx(Fs,{to:"/login",state:{from:n.pathname},replace:!0})}function ry({provider:r,className:n="w-5 h-5"}){switch(r){case"google":return m.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:[m.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"}),m.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"}),m.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"}),m.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 m.jsx("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:m.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 m.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:[m.jsx("path",{d:"M3 3h8.5v8.5H3z",fill:"#F25022"}),m.jsx("path",{d:"M12.5 3H21v8.5h-8.5z",fill:"#7FBA00"}),m.jsx("path",{d:"M3 12.5h8.5V21H3z",fill:"#00A4EF"}),m.jsx("path",{d:"M12.5 12.5H21V21h-8.5z",fill:"#FFB900"})]});case"anthropic":return m.jsx("svg",{className:n,viewBox:"0 0 24 24",fill:"currentColor",children:m.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 m.jsxs("svg",{className:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[m.jsx("circle",{cx:"12",cy:"12",r:"10"}),m.jsx("path",{d:"M12 8v4l3 3"})]})}}async function LS(){return Xe("/auth/oauth/providers")}async function HS(r,n){const s=n?`?label=${encodeURIComponent(n)}`:"";return Xe(`/auth/oauth/connections/${r}${s}`,{method:"DELETE"})}function QE(){return Hn({queryKey:["oauth-connections"],queryFn:()=>Xe("/auth/oauth/connections")})}function IE(){const r=Nn();return Pn({mutationFn:({provider:n,label:s})=>HS(n,s),onSuccess:()=>{r.invalidateQueries({queryKey:["oauth-connections"]})}})}function PS(){var X;const{login:r,isAuthenticated:n}=Oi(),s=sg(),a=Ws(),o=new URLSearchParams(a.search),f=o.get("token"),h=o.get("error"),d=((X=a.state)==null?void 0:X.from)??o.get("returnTo")??"/",g=T.useRef(!1);f&&!g.current&&(g.current=!0,r(f,void 0,{displayName:o.get("displayName"),username:o.get("username")}));const[y,E]=T.useState(""),[w,j]=T.useState(""),[z,M]=T.useState(h||""),[B,V]=T.useState(!1),[ne,ee]=T.useState(!!f),[pe,ae]=T.useState([]);if(T.useEffect(()=>{f||LS().then(ae).catch(()=>{})},[]),T.useEffect(()=>{if(!ne)return;const se=setTimeout(()=>s(d,{replace:!0}),1500);return()=>clearTimeout(se)},[ne]),n&&!ne)return m.jsx(Fs,{to:d,replace:!0});const k=async se=>{var W,F;if(se.preventDefault(),M(""),!y.trim()||!w){M("Username and password are required");return}V(!0);try{const Z=await fetch(`${Bn}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:y.trim(),password:w})}),le=await Z.json();if(!Z.ok){M(le.error||"Login failed");return}ee(!0),r(le.token,{username:y.trim(),password:w},{displayName:(W=le.user)==null?void 0:W.display_name,username:(F=le.user)==null?void 0:F.external_id})}catch{M("Unable to connect to server")}finally{V(!1)}};return m.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center overflow-hidden",children:m.jsxs("div",{className:"w-full max-w-md p-10",children:[m.jsx("div",{className:`mb-10 transition-all duration-[1500ms] ease-in ${ne?"translate-x-[120vw] -translate-y-[60vh] scale-[3] opacity-0":""}`,children:m.jsx(oh,{size:"lg",hideLabel:ne})}),m.jsxs("form",{onSubmit:k,className:`space-y-5 transition-opacity duration-300 ${ne?"opacity-0":""}`,children:[m.jsxs("div",{children:[m.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-text-secondary mb-2",children:"Username"}),m.jsx("input",{id:"username",type:"text",value:y,onChange:se=>E(se.target.value),className:"input",placeholder:"Enter your username",autoFocus:!ne,autoComplete:"username"})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-text-secondary mb-2",children:"Password"}),m.jsx("input",{id:"password",type:"password",value:w,onChange:se=>j(se.target.value),className:"input",placeholder:"Enter your password",autoComplete:"current-password"})]}),z&&m.jsx("p",{className:"text-sm text-status-error",children:z}),m.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:B||ne,children:B?"Signing in...":"Sign In"}),pe.length>0&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"flex items-center gap-3 mt-6",children:[m.jsx("div",{className:"flex-1 h-px bg-border"}),m.jsx("span",{className:"text-xs text-text-tertiary",children:"or continue with"}),m.jsx("div",{className:"flex-1 h-px bg-border"})]}),m.jsx("div",{className:"space-y-2",children:pe.filter(se=>se.provider!=="anthropic").map(se=>m.jsxs("a",{href:`${Bn}/api/auth/oauth/${se.provider}?returnTo=${encodeURIComponent(d)}`,className:"btn-secondary w-full flex items-center justify-center gap-2",children:[m.jsx(ry,{provider:se.provider}),"Sign in with ",se.name]},se.provider))})]})]})]})})}function K0(){const{isAuthenticated:r}=Oi(),n=sg(),s=Ws(),a=new URLSearchParams(s.search),o=a.get("state")||"";T.useEffect(()=>{r||n(`/login?returnTo=${encodeURIComponent(s.pathname+s.search)}`)},[r]);const[f,h]=T.useState(""),[d,g]=T.useState(a.get("label")||"default"),[y,E]=T.useState(""),[w,j]=T.useState(!1),z=f.trim().startsWith("sk-ant-oat"),M=f.trim().startsWith("sk-ant-api"),B=V=>{V.preventDefault();const ne=f.trim();if(!ne){E("A token or API key is required");return}if(!ne.startsWith("sk-ant-")){E('Invalid format. Must start with "sk-ant-oat" (OAuth token) or "sk-ant-api" (API key)');return}j(!0),E("");const ee=`${Bn}/api/auth/oauth/anthropic/callback?code=${encodeURIComponent(ne)}&state=${encodeURIComponent(o)}`;window.location.href=ee};return m.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:m.jsxs("div",{className:"w-full max-w-md p-10",children:[m.jsx("div",{className:"mb-10",children:m.jsx(oh,{size:"lg"})}),m.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[m.jsx(ry,{provider:"anthropic",className:"w-6 h-6"}),m.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Connect Anthropic"})]}),m.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."}),m.jsxs("form",{onSubmit:B,className:"space-y-5",children:[m.jsxs("div",{children:[m.jsx("label",{htmlFor:"token",className:"block text-sm font-medium text-text-secondary mb-2",children:"OAuth Token or API Key"}),m.jsx("input",{id:"token",type:"password",value:f,onChange:V=>h(V.target.value),className:"input",placeholder:"sk-ant-oat01-... or sk-ant-api03-...",autoFocus:!0,autoComplete:"off"}),z&&m.jsx("p",{className:"text-xs text-status-success mt-1",children:"OAuth token detected — uses your Claude subscription (flat rate)"}),M&&m.jsx("p",{className:"text-xs text-status-warning mt-1",children:"API key detected — billed per-token from your Anthropic API account"})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"label",className:"block text-sm font-medium text-text-secondary mb-2",children:"Label"}),m.jsx("input",{id:"label",type:"text",value:d,onChange:V=>g(V.target.value.replace(/\s+/g,"-").toLowerCase()),className:"input",placeholder:"default",autoComplete:"off"}),m.jsx("p",{className:"text-xs text-text-tertiary mt-1",children:'A name for this credential. Use different labels to store multiple credentials (e.g., "subscription", "api-batch").'})]}),y&&m.jsx("p",{className:"text-sm text-status-error",children:y}),m.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:w,children:w?"Validating...":"Connect"}),m.jsx("a",{href:"/",className:"block text-center text-sm text-text-tertiary hover:text-text-secondary",children:"Cancel"})]}),m.jsxs("div",{className:"mt-6 space-y-3 text-xs text-text-tertiary",children:[m.jsxs("div",{children:[m.jsx("span",{className:"font-medium text-text-secondary",children:"Recommended:"})," ","Run"," ",m.jsx("code",{className:"px-1 py-0.5 bg-surface-sunken rounded text-[11px]",children:"claude setup-token"})," ","in your terminal to generate an OAuth token that uses your subscription."]}),m.jsxs("div",{children:[m.jsx("span",{className:"font-medium text-text-secondary",children:"Alternative:"})," ","Use an API key from"," ",m.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 wf({roleTypes:r,roleNames:n,redirectTo:s="/"}){const{isSuperAdmin:a,hasRole:o,hasRoleType:f}=Oi();return a?m.jsx(wo,{}):r&&r.some(h=>f(h))?m.jsx(wo,{}):n&&n.some(h=>o(h))?m.jsx(wo,{}):m.jsx(Fs,{to:s,replace:!0})}const $S=T.lazy(()=>Ae(()=>import("./ProcessesListPage-CPgiDbdS.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]),import.meta.url).then(r=>({default:r.ProcessesListPage}))),YS=T.lazy(()=>Ae(()=>import("./ProcessDetailPage-qibro3Dm.js"),__vite__mapDeps([16,1,2,4,17,13,18,15,9,6,19,20,21]),import.meta.url).then(r=>({default:r.ProcessDetailPage}))),GS=T.lazy(()=>Ae(()=>import("./McpOverview-BdLivZv8.js"),__vite__mapDeps([22,1,23,24,25,26,12,13,27,6]),import.meta.url).then(r=>({default:r.McpOverview}))),VS=T.lazy(()=>Ae(()=>import("./McpRunsPage-CzVS7zcc.js"),__vite__mapDeps([28,1,24,25,26,5,6,7,8,15,13,9,29,12,11,10,14,30]),import.meta.url).then(r=>({default:r.McpRunsPage}))),FS=T.lazy(()=>Ae(()=>import("./McpRunDetailPage-DQJ41oKW.js"),__vite__mapDeps([31,1,24,18,12,13,32,6,33,34,14,35,36,11]),import.meta.url).then(r=>({default:r.McpRunDetailPage}))),JS=T.lazy(()=>Ae(()=>import("./McpQueryPage-AFV_QPwm.js"),__vite__mapDeps([37,1,12,13,7,8,11,10,14,9,29,15,30,5,6,4,38]),import.meta.url).then(r=>({default:r.McpQueryPage}))),QS=T.lazy(()=>Ae(()=>import("./McpQueryDetailPage-DKFkH1qa.js"),__vite__mapDeps([39,1,12,13,18,38,40,6,25,4,41,33,24,3,2,42,43,44,45,32,46,35]),import.meta.url).then(r=>({default:r.McpQueryDetailPage}))),IS=T.lazy(()=>Ae(()=>import("./EscalationsOverview-BfSrQ7A5.js"),__vite__mapDeps([47,1,4,12,13,27,6]),import.meta.url).then(r=>({default:r.EscalationsOverview}))),XS=T.lazy(()=>Ae(()=>import("./AvailableEscalationsPage-D2cxvpAK.js"),__vite__mapDeps([48,1,4,49,5,6,7,8,10,12,13,50,51,52,21,53,11,54,19,15,9,55,30,14]),import.meta.url).then(r=>({default:r.AvailableEscalationsPage}))),KS=T.lazy(()=>Ae(()=>import("./OperatorDashboard-B_QmNzLw.js"),__vite__mapDeps([56,1,4,49,5,6,7,8,12,13,10,30,53,11,54,19,15,9,55,14]),import.meta.url).then(r=>({default:r.OperatorDashboard}))),ZS=T.lazy(()=>Ae(()=>import("./index-DUaF8VYe.js"),__vite__mapDeps([57,1,34,49,12,13,55,3,4,20,21,51,50,18,19,32,6,33]),import.meta.url).then(r=>({default:r.EscalationDetailPage}))),WS=T.lazy(()=>Ae(()=>import("./WorkflowsOverview-Reab_xHT.js"),__vite__mapDeps([58,1,3,4,12,13,27,6]),import.meta.url).then(r=>({default:r.WorkflowsOverview}))),eE=T.lazy(()=>Ae(()=>import("./index-DAQvhgrL.js"),__vite__mapDeps([59,1,3,12,13,15,44,45,6,7,8,60,46,18]),import.meta.url).then(r=>({default:r.StartWorkflowPage}))),tE=T.lazy(()=>Ae(()=>import("./index-DAQvhgrL.js"),__vite__mapDeps([59,1,3,12,13,15,44,45,6,7,8,60,46,18]),import.meta.url).then(r=>({default:r.DurableInvokePage}))),nE=T.lazy(()=>Ae(()=>import("./WorkflowsDashboard-DL6oRbka.js"),__vite__mapDeps([61,1,9,29,3,4,5,6,7,8,15,13,12,11,10,14,30]),import.meta.url).then(r=>({default:()=>r.WorkflowsDashboard({tier:"durable"})}))),sE=T.lazy(()=>Ae(()=>import("./WorkflowsDashboard-DL6oRbka.js"),__vite__mapDeps([61,1,9,29,3,4,5,6,7,8,15,13,12,11,10,14,30]),import.meta.url).then(r=>({default:()=>r.WorkflowsDashboard({tier:"all"})}))),iE=T.lazy(()=>Ae(()=>import("./YamlWorkflowsPage-BoFstOcp.js"),__vite__mapDeps([62,1,25,40,5,6,63,12,13,11,8,43,44,45,42,60,46,18,64]),import.meta.url).then(r=>({default:r.YamlWorkflowsPage}))),rE=T.lazy(()=>Ae(()=>import("./TasksListPage-BQjjNjRC.js"),__vite__mapDeps([65,1,2,3,5,6,7,8,18,54,46,10,11,12,13,15]),import.meta.url).then(r=>({default:r.TasksListPage}))),aE=T.lazy(()=>Ae(()=>import("./TaskDetailPage-buNgjwiz.js"),__vite__mapDeps([66,1,2,18,54,12,13,6]),import.meta.url).then(r=>({default:r.TaskDetailPage}))),Z0=T.lazy(()=>Ae(()=>import("./WorkflowExecutionPage-BQbIIdIA.js"),__vite__mapDeps([67,1,3,4,34,2,12,13,33,14,18,32,6,35,36,11]),import.meta.url).then(r=>({default:r.WorkflowExecutionPage}))),lE=T.lazy(()=>Ae(()=>import("./AdminDashboard-Jwr3Fsaz.js"),__vite__mapDeps([68,1,2,4,23,17,13,6]),import.meta.url).then(r=>({default:r.AdminDashboard}))),oE=T.lazy(()=>Ae(()=>import("./index-wlL3EZ14.js"),__vite__mapDeps([69,1,3,7,8,11,30,5,6,12,13,70,15]),import.meta.url).then(r=>({default:r.WorkersPage}))),cE=T.lazy(()=>Ae(()=>import("./index-CdUj8mKq.js"),__vite__mapDeps([71,1,3,7,8,72,52,6,11,30,5,12,13,19,70,15,73,49,44,45]),import.meta.url).then(r=>({default:r.WorkflowConfigsPage}))),W0=T.lazy(()=>Ae(()=>import("./index-CdUj8mKq.js"),__vite__mapDeps([71,1,3,7,8,72,52,6,11,30,5,12,13,19,70,15,73,49,44,45]),import.meta.url).then(r=>({default:r.WorkflowConfigDetailPage}))),uE=T.lazy(()=>Ae(()=>import("./index-C42ACUTi.js"),__vite__mapDeps([74,1,23,8,72,52,6,12,13,11,10,5,63,75,43,44,45,42,64,30,18]),import.meta.url).then(r=>({default:r.McpServersPage}))),eg=T.lazy(()=>Ae(()=>import("./index-BVXXvXlF.js"),__vite__mapDeps([76,1,23,73,12,13,41,6]),import.meta.url).then(r=>({default:r.McpServerDetailPage}))),fE=T.lazy(()=>Ae(()=>import("./index-MO0YnTPi.js"),__vite__mapDeps([77,1,21,5,6,7,8,10,11,9,72,52,30,12,13,19,45,49,46]),import.meta.url).then(r=>({default:r.UsersPage}))),hE=T.lazy(()=>Ae(()=>import("./RolesPage-BAj88I_Y.js"),__vite__mapDeps([78,1,49,7,8,72,52,6,12,13,19,30]),import.meta.url).then(r=>({default:r.RolesPage}))),dE=T.lazy(()=>Ae(()=>import("./index-CHBiEYmf.js"),__vite__mapDeps([79,1,12,13,52,6,50]),import.meta.url).then(r=>({default:r.MaintenancePage}))),mE=T.lazy(()=>Ae(()=>import("./index-Dp8iH4i2.js"),__vite__mapDeps([80,1,17,13,11,5,6,81,52,33,70,7,8,30]),import.meta.url).then(r=>({default:r.ControlPlanePage}))),pE=T.lazy(()=>Ae(()=>import("./index-BRYCB_g0.js"),__vite__mapDeps([82,1,6,81,5,7,8,10,11,9,12,13,14]),import.meta.url).then(r=>({default:r.StreamMessagesPage}))),gE=T.lazy(()=>Ae(()=>import("./CredentialsPage-BQNraRZu.js"),__vite__mapDeps([83,1,12,13,46,72,52,6]),import.meta.url).then(r=>({default:r.CredentialsPage}))),yE=T.lazy(()=>Ae(()=>import("./index-B77P0ssX.js"),__vite__mapDeps([84,1,6,12,13,11,14,8,85,46]),import.meta.url).then(r=>({default:r.FilesPage}))),bE=T.lazy(()=>Ae(()=>import("./index-0i5oHs_4.js"),__vite__mapDeps([86,1,12,13,11,14,10,8,85,46,87,41,6]),import.meta.url).then(r=>({default:r.KnowledgePage}))),xE=T.lazy(()=>Ae(()=>import("./HomePage-RO3qbF38.js"),__vite__mapDeps([88,1,3,24,81,2,4,19,13,15,14,89,6]),import.meta.url).then(r=>({default:r.HomePage}))),vE=T.lazy(()=>Ae(()=>import("./AgentsPage-DzpWsTFO.js"),__vite__mapDeps([90,1,91,4,5,6,7,8,10,11,12,13,14]),import.meta.url).then(r=>({default:r.AgentsPage}))),_E=T.lazy(()=>Ae(()=>import("./AgentDetailPage-Cw7foCHd.js"),__vite__mapDeps([92,1,91,93,13,4,89,15,6]),import.meta.url).then(r=>({default:r.AgentDetailPage}))),tg=T.lazy(()=>Ae(()=>import("./AgentConfigPage-DbqbFXEq.js"),__vite__mapDeps([94,1,91,93,13,12,87,43,44,45,3,25,95,96,89,15,6]),import.meta.url).then(r=>({default:r.AgentConfigPage}))),wE=T.lazy(()=>Ae(()=>import("./CapabilitiesPage-BTd-uYTM.js"),__vite__mapDeps([97,1,95,75,23,43,44,45,13,42,64,6,12]),import.meta.url).then(r=>({default:r.CapabilitiesPage}))),SE=T.lazy(()=>Ae(()=>import("./TopicsPage-DLyRlo0A.js"),__vite__mapDeps([98,1,96,5,6,7,8,10,11,12,13,14]),import.meta.url).then(r=>({default:r.TopicsPage}))),EE=T.lazy(()=>Ae(()=>import("./TopicDetailPage-CGim5yi0.js"),__vite__mapDeps([99,1,96,14,13,6]),import.meta.url).then(r=>({default:r.TopicDetailPage})));function AE(){return m.jsxs("div",{className:"animate-pulse space-y-4",children:[m.jsx("div",{className:"h-8 bg-surface-sunken rounded w-48"}),m.jsx("div",{className:"h-40 bg-surface-sunken rounded"})]})}function xe({children:r}){return m.jsx(T.Suspense,{fallback:m.jsx(AE,{}),children:m.jsx("div",{className:"animate-page-enter",children:r})})}const ay=new yx({defaultOptions:{queries:{staleTime:1e4,retry:(r,n)=>n instanceof Error&&n.message==="Session expired"?!1:r<1}}});window.addEventListener("auth:unauthorized",()=>{ay.clear(),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info");const n=`${window.__LT_BASE__||""}/login`;window.location.pathname!==n&&(window.location.href=`${n}?returnTo=${encodeURIComponent(window.location.pathname)}`)});const OE=vx([{path:"/login",element:m.jsx(PS,{})},{path:"/connect/anthropic",element:m.jsx(K0,{})},{path:"/connect/:provider",element:m.jsx(K0,{})},{path:"/",element:m.jsx(BS,{}),children:[{index:!0,element:m.jsx(xe,{children:m.jsx(xE,{})})},{path:"processes/all",element:m.jsx(xe,{children:m.jsx($S,{})})},{path:"processes/detail/:originId",element:m.jsx(xe,{children:m.jsx(YS,{})})},{path:"credentials",element:m.jsx(xe,{children:m.jsx(gE,{})})},{path:"connections",element:m.jsx(Fs,{to:"/credentials",replace:!0})},{path:"escalations",element:m.jsx(xe,{children:m.jsx(IS,{})})},{path:"escalations/available",element:m.jsx(xe,{children:m.jsx(XS,{})})},{path:"escalations/queue",element:m.jsx(xe,{children:m.jsx(KS,{})})},{path:"escalations/detail/:id",element:m.jsx(xe,{children:m.jsx(ZS,{})})},{path:"capabilities",element:m.jsx(xe,{children:m.jsx(wE,{})})},{path:"agents",element:m.jsx(xe,{children:m.jsx(vE,{})})},{path:"agents/new",element:m.jsx(xe,{children:m.jsx(tg,{})})},{path:"agents/:id",element:m.jsx(xe,{children:m.jsx(_E,{})})},{path:"agents/:id/edit",element:m.jsx(xe,{children:m.jsx(tg,{})})},{path:"topics",element:m.jsx(xe,{children:m.jsx(SE,{})})},{path:"topics/:topic",element:m.jsx(xe,{children:m.jsx(EE,{})})},{element:m.jsx(wf,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:m.jsx(xe,{children:m.jsx(WS,{})})},{path:"workflows/executions",element:m.jsx(xe,{children:m.jsx(sE,{})})},{path:"workflows/durable/executions",element:m.jsx(xe,{children:m.jsx(nE,{})})},{path:"workflows/durable/executions/:workflowId",element:m.jsx(xe,{children:m.jsx(Z0,{})})},{path:"workflows/tasks",element:m.jsx(xe,{children:m.jsx(rE,{})})},{path:"workflows/tasks/detail/:id",element:m.jsx(xe,{children:m.jsx(aE,{})})},{path:"workflows/executions/:workflowId",element:m.jsx(xe,{children:m.jsx(Z0,{})})},{path:"workflows/start",element:m.jsx(xe,{children:m.jsx(eE,{})})},{path:"workflows/durable/invoke",element:m.jsx(xe,{children:m.jsx(tE,{})})},{path:"workflows/cron",element:m.jsx(Fs,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:m.jsx(xe,{children:m.jsx(oE,{})})},{path:"workflows/registry",element:m.jsx(xe,{children:m.jsx(cE,{})})},{path:"workflows/registry/new",element:m.jsx(xe,{children:m.jsx(W0,{})})},{path:"workflows/registry/:workflowType",element:m.jsx(xe,{children:m.jsx(W0,{})})}]},{element:m.jsx(wf,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"mcp",element:m.jsx(xe,{children:m.jsx(GS,{})})},{path:"mcp/queries",element:m.jsx(xe,{children:m.jsx(JS,{})})},{path:"mcp/queries/:workflowId",element:m.jsx(xe,{children:m.jsx(QS,{})})},{path:"mcp/tools",element:m.jsx(Fs,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:m.jsx(xe,{children:m.jsx(uE,{})})},{path:"mcp/servers/new",element:m.jsx(xe,{children:m.jsx(eg,{})})},{path:"mcp/servers/:serverId",element:m.jsx(xe,{children:m.jsx(eg,{})})},{path:"mcp/workflows",element:m.jsx(xe,{children:m.jsx(iE,{})})},{path:"mcp/executions",element:m.jsx(xe,{children:m.jsx(VS,{})})},{path:"mcp/executions/:jobId",element:m.jsx(xe,{children:m.jsx(FS,{})})},{path:"files",element:m.jsx(xe,{children:m.jsx(yE,{})})},{path:"knowledge",element:m.jsx(xe,{children:m.jsx(bE,{})})}]},{element:m.jsx(wf,{roleTypes:["admin","superadmin"]}),children:[{path:"admin",element:m.jsx(xe,{children:m.jsx(lE,{})})},{path:"admin/users",element:m.jsx(xe,{children:m.jsx(fE,{})})},{path:"admin/bots",element:m.jsx(Fs,{to:"/admin/users?tab=service-accounts",replace:!0})},{path:"admin/escalation-chains",element:m.jsx(Fs,{to:"/admin/roles",replace:!0})},{path:"admin/roles",element:m.jsx(xe,{children:m.jsx(hE,{})})},{path:"admin/maintenance",element:m.jsx(xe,{children:m.jsx(dE,{})})},{path:"admin/controlplane",element:m.jsx(xe,{children:m.jsx(mE,{})})},{path:"admin/streams",element:m.jsx(xe,{children:m.jsx(pE,{})})}]}]}],{basename:window.__LT_BASE__||"/"});function jE(){return m.jsx(bx,{client:ay,children:m.jsx(hv,{children:m.jsx(gw,{children:m.jsx(_x,{router:OE})})})})}ov.createRoot(document.getElementById("root")).render(m.jsx(T.StrictMode,{children:m.jsx(jE,{})}));export{QE as A,IE as B,ch as C,kS as D,fg as E,Jg as F,Zw as J,Bn as L,p_ as N,ry as O,Hw as S,JE as a,Xe as b,y_ as c,CS as d,zE as e,jS as f,UE as g,LE as h,RE as i,Oi as j,PE as k,$E as l,YE as m,GE as n,VE as o,DE as p,ww as q,_w as r,BE as s,qE as t,bw as u,HE as v,sy as w,iy as x,FE as y,fh as z};
|
|
63
|
+
//# sourceMappingURL=index-BZu5zewH.js.map
|