@hotmeshio/long-tail 0.30.1 → 0.30.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (271) hide show
  1. package/build/api/escalations/accumulate.d.ts +2 -1
  2. package/build/api/escalations/accumulate.js +2 -1
  3. package/build/api/escalations/metadata.d.ts +3 -2
  4. package/build/api/escalations/metadata.js +4 -3
  5. package/build/api/escalations/resolve-batch.d.ts +3 -1
  6. package/build/api/escalations/resolve-batch.js +14 -1
  7. package/build/api/scan-codes/choice.js +3 -2
  8. package/build/api/scan-codes/context.d.ts +6 -0
  9. package/build/api/scan-codes/context.js +10 -1
  10. package/build/api/scan-codes/locate.js +1 -0
  11. package/build/api/scan-codes/subject.js +32 -3
  12. package/build/api/scan-codes/verb-accumulate.js +1 -1
  13. package/build/api/scan-codes/verb-fill.js +3 -2
  14. package/build/api/scan-codes/verb-into-subject.js +2 -2
  15. package/build/api/scan-codes/verbs-subject.js +3 -3
  16. package/build/api/scan-codes/verbs.js +4 -4
  17. package/build/lib/db/schemas/043_scan_pattern_and_member_targets.sql +26 -0
  18. package/build/lib/facet-value.d.ts +3 -0
  19. package/build/lib/facet-value.js +9 -0
  20. package/build/routes/scan-codes.js +3 -0
  21. package/build/sdk/index.d.ts +3 -3
  22. package/build/services/escalation/batch.d.ts +4 -3
  23. package/build/services/escalation/batch.js +5 -3
  24. package/build/services/escalation/claim-asserted.d.ts +2 -1
  25. package/build/services/escalation/crud.d.ts +3 -2
  26. package/build/services/orchestrator/condition.d.ts +6 -0
  27. package/build/services/orchestrator/condition.js +6 -0
  28. package/build/services/scan-code/read.js +3 -0
  29. package/build/services/scan-code/sql.d.ts +3 -3
  30. package/build/services/scan-code/sql.js +19 -8
  31. package/build/services/scan-code/validate-scheme-pattern.d.ts +16 -0
  32. package/build/services/scan-code/validate-scheme-pattern.js +75 -0
  33. package/build/services/scan-code/validate.d.ts +3 -1
  34. package/build/services/scan-code/validate.js +6 -1
  35. package/build/services/scan-code/write.d.ts +3 -0
  36. package/build/services/scan-code/write.js +3 -0
  37. package/build/shared/scan-code/index.d.ts +2 -1
  38. package/build/shared/scan-code/index.js +8 -1
  39. package/build/shared/scan-code/parse.d.ts +22 -1
  40. package/build/shared/scan-code/parse.js +78 -0
  41. package/build/shared/scan-code/target.d.ts +4 -0
  42. package/build/shared/scan-code/target.js +14 -0
  43. package/build/system/mcp-servers/admin/schemas.d.ts +86 -77
  44. package/build/system/mcp-servers/admin/schemas.js +4 -1
  45. package/build/system/seed/tool-manifests-admin.js +1 -1
  46. package/build/tsconfig.tsbuildinfo +1 -1
  47. package/build/types/escalation.d.ts +15 -0
  48. package/build/types/escalation.js +16 -1
  49. package/build/types/facets.d.ts +5 -0
  50. package/build/types/index.d.ts +3 -3
  51. package/build/types/index.js +5 -1
  52. package/build/types/scan-code/constants.d.ts +20 -0
  53. package/build/types/scan-code/constants.js +20 -1
  54. package/build/types/scan-code/response.d.ts +2 -1
  55. package/build/types/scan-code/rule.d.ts +11 -1
  56. package/dashboard/dist/assets/{AdminDashboard-CZIeiLe0.js → AdminDashboard-VQ1fhhJP.js} +2 -2
  57. package/dashboard/dist/assets/{AdminDashboard-CZIeiLe0.js.map → AdminDashboard-VQ1fhhJP.js.map} +1 -1
  58. package/dashboard/dist/assets/{AgentConfigPage-DO3ATfCU.js → AgentConfigPage-BOe_W2Ij.js} +2 -2
  59. package/dashboard/dist/assets/{AgentConfigPage-DO3ATfCU.js.map → AgentConfigPage-BOe_W2Ij.js.map} +1 -1
  60. package/dashboard/dist/assets/{AgentDetailPage-BWAlHQfB.js → AgentDetailPage-5ov5D9V2.js} +3 -3
  61. package/dashboard/dist/assets/{AgentDetailPage-BWAlHQfB.js.map → AgentDetailPage-5ov5D9V2.js.map} +1 -1
  62. package/dashboard/dist/assets/{AgentsPage-Cs4IKeec.js → AgentsPage-DDFMKHhI.js} +2 -2
  63. package/dashboard/dist/assets/{AgentsPage-Cs4IKeec.js.map → AgentsPage-DDFMKHhI.js.map} +1 -1
  64. package/dashboard/dist/assets/{AvailableEscalationsPage-CiRxaing.js → AvailableEscalationsPage-GFn8Sgg1.js} +2 -2
  65. package/dashboard/dist/assets/{AvailableEscalationsPage-CiRxaing.js.map → AvailableEscalationsPage-GFn8Sgg1.js.map} +1 -1
  66. package/dashboard/dist/assets/{BotPicker-DGLkc9PQ.js → BotPicker-Dqpo36dM.js} +2 -2
  67. package/dashboard/dist/assets/{BotPicker-DGLkc9PQ.js.map → BotPicker-Dqpo36dM.js.map} +1 -1
  68. package/dashboard/dist/assets/{BulkAssignModal-C4LV8s0y.js → BulkAssignModal-CmLVxkz-.js} +2 -2
  69. package/dashboard/dist/assets/{BulkAssignModal-C4LV8s0y.js.map → BulkAssignModal-CmLVxkz-.js.map} +1 -1
  70. package/dashboard/dist/assets/{CapabilitiesPage-BLMMV3-W.js → CapabilitiesPage-Dfkip6_b.js} +2 -2
  71. package/dashboard/dist/assets/{CapabilitiesPage-BLMMV3-W.js.map → CapabilitiesPage-Dfkip6_b.js.map} +1 -1
  72. package/dashboard/dist/assets/{CollapsibleSection-BAizcNCt.js → CollapsibleSection-CYNYMYSa.js} +2 -2
  73. package/dashboard/dist/assets/{CollapsibleSection-BAizcNCt.js.map → CollapsibleSection-CYNYMYSa.js.map} +1 -1
  74. package/dashboard/dist/assets/{ConfirmDeleteModal-DlNWHVxi.js → ConfirmDeleteModal-CpJNP-8w.js} +2 -2
  75. package/dashboard/dist/assets/{ConfirmDeleteModal-DlNWHVxi.js.map → ConfirmDeleteModal-CpJNP-8w.js.map} +1 -1
  76. package/dashboard/dist/assets/{ConnectedAppsPage-D94kx0v3.js → ConnectedAppsPage-DXIp2Dpl.js} +2 -2
  77. package/dashboard/dist/assets/{ConnectedAppsPage-D94kx0v3.js.map → ConnectedAppsPage-DXIp2Dpl.js.map} +1 -1
  78. package/dashboard/dist/assets/{CountdownTimer-CSdAwgwZ.js → CountdownTimer-CuPY7zkb.js} +2 -2
  79. package/dashboard/dist/assets/{CountdownTimer-CSdAwgwZ.js.map → CountdownTimer-CuPY7zkb.js.map} +1 -1
  80. package/dashboard/dist/assets/{CredentialsPage-pOyC1GfC.js → CredentialsPage-CtrnkHcj.js} +2 -2
  81. package/dashboard/dist/assets/{CredentialsPage-pOyC1GfC.js.map → CredentialsPage-CtrnkHcj.js.map} +1 -1
  82. package/dashboard/dist/assets/{CronLabel-BVlOOcyo.js → CronLabel-DVjTw5Ri.js} +2 -2
  83. package/dashboard/dist/assets/{CronLabel-BVlOOcyo.js.map → CronLabel-DVjTw5Ri.js.map} +1 -1
  84. package/dashboard/dist/assets/{ElapsedCell-Bnjp3onG.js → ElapsedCell-gY_mGMTF.js} +2 -2
  85. package/dashboard/dist/assets/{ElapsedCell-Bnjp3onG.js.map → ElapsedCell-gY_mGMTF.js.map} +1 -1
  86. package/dashboard/dist/assets/{EntityTimelinePanel-D6Z7YXuY.js → EntityTimelinePanel-DJN_ZEQa.js} +2 -2
  87. package/dashboard/dist/assets/{EntityTimelinePanel-D6Z7YXuY.js.map → EntityTimelinePanel-DJN_ZEQa.js.map} +1 -1
  88. package/dashboard/dist/assets/{EscalationListSchemaPage-D2aa_arC.js → EscalationListSchemaPage-A4KpTdJA.js} +3 -3
  89. package/dashboard/dist/assets/{EscalationListSchemaPage-D2aa_arC.js.map → EscalationListSchemaPage-A4KpTdJA.js.map} +1 -1
  90. package/dashboard/dist/assets/{EscalationSchemaPage-DuOje0Ke.js → EscalationSchemaPage-nfCn42hT.js} +2 -2
  91. package/dashboard/dist/assets/{EscalationSchemaPage-DuOje0Ke.js.map → EscalationSchemaPage-nfCn42hT.js.map} +1 -1
  92. package/dashboard/dist/assets/{EscalationTimeline-DFkhU2Z2.js → EscalationTimeline-CLvSr1SD.js} +2 -2
  93. package/dashboard/dist/assets/{EscalationTimeline-DFkhU2Z2.js.map → EscalationTimeline-CLvSr1SD.js.map} +1 -1
  94. package/dashboard/dist/assets/{EscalationTitleSelect-CgYnMM_O.js → EscalationTitleSelect-CT7mYHkb.js} +2 -2
  95. package/dashboard/dist/assets/{EscalationTitleSelect-CgYnMM_O.js.map → EscalationTitleSelect-CT7mYHkb.js.map} +1 -1
  96. package/dashboard/dist/assets/{EscalationsOverview-BTkFoklS.js → EscalationsOverview-CKaGRh-E.js} +2 -2
  97. package/dashboard/dist/assets/{EscalationsOverview-BTkFoklS.js.map → EscalationsOverview-CKaGRh-E.js.map} +1 -1
  98. package/dashboard/dist/assets/{EventTable-MJmAbu6N.js → EventTable-2ywJsOLy.js} +2 -2
  99. package/dashboard/dist/assets/{EventTable-MJmAbu6N.js.map → EventTable-2ywJsOLy.js.map} +1 -1
  100. package/dashboard/dist/assets/{FilterBar-Blt7qcUc.js → FilterBar-Dy0b7wwf.js} +2 -2
  101. package/dashboard/dist/assets/{FilterBar-Blt7qcUc.js.map → FilterBar-Dy0b7wwf.js.map} +1 -1
  102. package/dashboard/dist/assets/{GraphInvokePage-B4K3mT_c.js → GraphInvokePage-yOVpraAy.js} +2 -2
  103. package/dashboard/dist/assets/{GraphInvokePage-B4K3mT_c.js.map → GraphInvokePage-yOVpraAy.js.map} +1 -1
  104. package/dashboard/dist/assets/{HomePage-BN5wXq6V.js → HomePage-67xXjKjN.js} +2 -2
  105. package/dashboard/dist/assets/{HomePage-BN5wXq6V.js.map → HomePage-67xXjKjN.js.map} +1 -1
  106. package/dashboard/dist/assets/{LinePage-CuHHHwBy.js → LinePage-CMsYtukW.js} +3 -3
  107. package/dashboard/dist/assets/{LinePage-CuHHHwBy.js.map → LinePage-CMsYtukW.js.map} +1 -1
  108. package/dashboard/dist/assets/{LinesPage-D9TRHWyt.js → LinesPage-pwL46mOS.js} +3 -3
  109. package/dashboard/dist/assets/{LinesPage-D9TRHWyt.js.map → LinesPage-pwL46mOS.js.map} +1 -1
  110. package/dashboard/dist/assets/{ListToolbar-GGj6X36p.js → ListToolbar-CJmvGy2B.js} +2 -2
  111. package/dashboard/dist/assets/{ListToolbar-GGj6X36p.js.map → ListToolbar-CJmvGy2B.js.map} +1 -1
  112. package/dashboard/dist/assets/{McpOverview-Do31A1jL.js → McpOverview-DA9LLvNG.js} +2 -2
  113. package/dashboard/dist/assets/{McpOverview-Do31A1jL.js.map → McpOverview-DA9LLvNG.js.map} +1 -1
  114. package/dashboard/dist/assets/{McpQueryDetailPage-D6FSB1bS.js → McpQueryDetailPage-N7qLmfE8.js} +2 -2
  115. package/dashboard/dist/assets/{McpQueryDetailPage-D6FSB1bS.js.map → McpQueryDetailPage-N7qLmfE8.js.map} +1 -1
  116. package/dashboard/dist/assets/{McpQueryPage-CyT2d0Y_.js → McpQueryPage-CpsP3w7x.js} +2 -2
  117. package/dashboard/dist/assets/{McpQueryPage-CyT2d0Y_.js.map → McpQueryPage-CpsP3w7x.js.map} +1 -1
  118. package/dashboard/dist/assets/{McpRunDetailPage-C3mmTl4Y.js → McpRunDetailPage-qHRQ1pEY.js} +2 -2
  119. package/dashboard/dist/assets/{McpRunDetailPage-C3mmTl4Y.js.map → McpRunDetailPage-qHRQ1pEY.js.map} +1 -1
  120. package/dashboard/dist/assets/{McpRunsPage-CTeFFUE2.js → McpRunsPage-BRDDYpTM.js} +2 -2
  121. package/dashboard/dist/assets/{McpRunsPage-CTeFFUE2.js.map → McpRunsPage-BRDDYpTM.js.map} +1 -1
  122. package/dashboard/dist/assets/{OperationsPage-BUtQP5dm.js → OperationsPage-zUaab-CL.js} +3 -3
  123. package/dashboard/dist/assets/{OperationsPage-BUtQP5dm.js.map → OperationsPage-zUaab-CL.js.map} +1 -1
  124. package/dashboard/dist/assets/{OperatorDashboard-BwYOXyUV.js → OperatorDashboard-el5BquXN.js} +2 -2
  125. package/dashboard/dist/assets/{OperatorDashboard-BwYOXyUV.js.map → OperatorDashboard-el5BquXN.js.map} +1 -1
  126. package/dashboard/dist/assets/{PersonaDetailPage-CkrKJLNv.js → PersonaDetailPage-B_tb8gfl.js} +2 -2
  127. package/dashboard/dist/assets/{PersonaDetailPage-CkrKJLNv.js.map → PersonaDetailPage-B_tb8gfl.js.map} +1 -1
  128. package/dashboard/dist/assets/{PersonasPage-BS8aBeOv.js → PersonasPage-BPI7mqM8.js} +2 -2
  129. package/dashboard/dist/assets/{PersonasPage-BS8aBeOv.js.map → PersonasPage-BPI7mqM8.js.map} +1 -1
  130. package/dashboard/dist/assets/{PortalPage-PEBk6VVu.js → PortalPage-e_rBb1do.js} +2 -2
  131. package/dashboard/dist/assets/{PortalPage-PEBk6VVu.js.map → PortalPage-e_rBb1do.js.map} +1 -1
  132. package/dashboard/dist/assets/{ProcessDetailPage-CJ71bxDs.js → ProcessDetailPage-D35RX1bB.js} +2 -2
  133. package/dashboard/dist/assets/{ProcessDetailPage-CJ71bxDs.js.map → ProcessDetailPage-D35RX1bB.js.map} +1 -1
  134. package/dashboard/dist/assets/{ProcessesListPage-ov_HLxz5.js → ProcessesListPage-CT81miI5.js} +2 -2
  135. package/dashboard/dist/assets/{ProcessesListPage-ov_HLxz5.js.map → ProcessesListPage-CT81miI5.js.map} +1 -1
  136. package/dashboard/dist/assets/{ResolverForm-BKiUY-lN.js → ResolverForm-BxJkoKAO.js} +2 -2
  137. package/dashboard/dist/assets/{ResolverForm-BKiUY-lN.js.map → ResolverForm-BxJkoKAO.js.map} +1 -1
  138. package/dashboard/dist/assets/{RoleDetailPage-CmfWwjtG.js → RoleDetailPage-DtU7vsJm.js} +2 -2
  139. package/dashboard/dist/assets/{RoleDetailPage-CmfWwjtG.js.map → RoleDetailPage-DtU7vsJm.js.map} +1 -1
  140. package/dashboard/dist/assets/{RolesPage-DvO5DJWY.js → RolesPage-BE7RWt9q.js} +2 -2
  141. package/dashboard/dist/assets/{RolesPage-DvO5DJWY.js.map → RolesPage-BE7RWt9q.js.map} +1 -1
  142. package/dashboard/dist/assets/{RosterWidget-Cs6OTbST.js → RosterWidget-BJMx0a8Z.js} +2 -2
  143. package/dashboard/dist/assets/{RosterWidget-Cs6OTbST.js.map → RosterWidget-BJMx0a8Z.js.map} +1 -1
  144. package/dashboard/dist/assets/{RunAsSelector-VNjUn9Zp.js → RunAsSelector-Co6s9bqA.js} +2 -2
  145. package/dashboard/dist/assets/{RunAsSelector-VNjUn9Zp.js.map → RunAsSelector-Co6s9bqA.js.map} +1 -1
  146. package/dashboard/dist/assets/ScanCodesPage-C2TETaj5.js +2 -0
  147. package/dashboard/dist/assets/ScanCodesPage-C2TETaj5.js.map +1 -0
  148. package/dashboard/dist/assets/ScanSchemeDetailPage-C2UgU8l-.js +5 -0
  149. package/dashboard/dist/assets/ScanSchemeDetailPage-C2UgU8l-.js.map +1 -0
  150. package/dashboard/dist/assets/ScanStationPage-nWYz-OD3.js +2 -0
  151. package/dashboard/dist/assets/ScanStationPage-nWYz-OD3.js.map +1 -0
  152. package/dashboard/dist/assets/SchemeMatchFields-9H7SmbED.js +4 -0
  153. package/dashboard/dist/assets/SchemeMatchFields-9H7SmbED.js.map +1 -0
  154. package/dashboard/dist/assets/{StickyPagination-CJ3jjlDX.js → StickyPagination-miUdVAKw.js} +2 -2
  155. package/dashboard/dist/assets/{StickyPagination-CJ3jjlDX.js.map → StickyPagination-miUdVAKw.js.map} +1 -1
  156. package/dashboard/dist/assets/{StreamMessageDetail-yOdyJGHR.js → StreamMessageDetail-D5Rk7pn7.js} +2 -2
  157. package/dashboard/dist/assets/{StreamMessageDetail-yOdyJGHR.js.map → StreamMessageDetail-D5Rk7pn7.js.map} +1 -1
  158. package/dashboard/dist/assets/{SwimlaneTimeline-DeFWNFrL.js → SwimlaneTimeline-B1QY1ZzH.js} +2 -2
  159. package/dashboard/dist/assets/{SwimlaneTimeline-DeFWNFrL.js.map → SwimlaneTimeline-B1QY1ZzH.js.map} +1 -1
  160. package/dashboard/dist/assets/{TaskDetailPage-BPL_Zx-L.js → TaskDetailPage-DKUM37o8.js} +2 -2
  161. package/dashboard/dist/assets/{TaskDetailPage-BPL_Zx-L.js.map → TaskDetailPage-DKUM37o8.js.map} +1 -1
  162. package/dashboard/dist/assets/{TasksListPage-Bc3S63_O.js → TasksListPage-CUulwvm-.js} +2 -2
  163. package/dashboard/dist/assets/{TasksListPage-Bc3S63_O.js.map → TasksListPage-CUulwvm-.js.map} +1 -1
  164. package/dashboard/dist/assets/{TimeAgo-DAtnJQwU.js → TimeAgo-CHTelacB.js} +2 -2
  165. package/dashboard/dist/assets/{TimeAgo-DAtnJQwU.js.map → TimeAgo-CHTelacB.js.map} +1 -1
  166. package/dashboard/dist/assets/{TimestampCell-CG0erHqq.js → TimestampCell-NanLWLKo.js} +2 -2
  167. package/dashboard/dist/assets/{TimestampCell-CG0erHqq.js.map → TimestampCell-NanLWLKo.js.map} +1 -1
  168. package/dashboard/dist/assets/{ToolTestPanel-c71yqZv7.js → ToolTestPanel-CF1CHzgz.js} +2 -2
  169. package/dashboard/dist/assets/{ToolTestPanel-c71yqZv7.js.map → ToolTestPanel-CF1CHzgz.js.map} +1 -1
  170. package/dashboard/dist/assets/{TopicDetailPage-BlUP0bb1.js → TopicDetailPage-CGO8XV_a.js} +2 -2
  171. package/dashboard/dist/assets/{TopicDetailPage-BlUP0bb1.js.map → TopicDetailPage-CGO8XV_a.js.map} +1 -1
  172. package/dashboard/dist/assets/{TopicsPage-lQ9HNzOq.js → TopicsPage-Bt8gOKYr.js} +2 -2
  173. package/dashboard/dist/assets/{TopicsPage-lQ9HNzOq.js.map → TopicsPage-Bt8gOKYr.js.map} +1 -1
  174. package/dashboard/dist/assets/{UserName-Vf97ofcW.js → UserName-DKXnK7DD.js} +2 -2
  175. package/dashboard/dist/assets/{UserName-Vf97ofcW.js.map → UserName-DKXnK7DD.js.map} +1 -1
  176. package/dashboard/dist/assets/{WorkflowExecutionPage-B195cnHb.js → WorkflowExecutionPage-Crf7AIFc.js} +2 -2
  177. package/dashboard/dist/assets/{WorkflowExecutionPage-B195cnHb.js.map → WorkflowExecutionPage-Crf7AIFc.js.map} +1 -1
  178. package/dashboard/dist/assets/{WorkflowsDashboard-gH-PGsKq.js → WorkflowsDashboard--isjt06C.js} +2 -2
  179. package/dashboard/dist/assets/{WorkflowsDashboard-gH-PGsKq.js.map → WorkflowsDashboard--isjt06C.js.map} +1 -1
  180. package/dashboard/dist/assets/{WorkflowsOverview-D_wYDqw3.js → WorkflowsOverview-D7Oqf4-V.js} +2 -2
  181. package/dashboard/dist/assets/{WorkflowsOverview-D_wYDqw3.js.map → WorkflowsOverview-D7Oqf4-V.js.map} +1 -1
  182. package/dashboard/dist/assets/{YamlWorkflowDetailPage-Imob5F8H.js → YamlWorkflowDetailPage-B0wxgrGP.js} +8 -8
  183. package/dashboard/dist/assets/{YamlWorkflowDetailPage-Imob5F8H.js.map → YamlWorkflowDetailPage-B0wxgrGP.js.map} +1 -1
  184. package/dashboard/dist/assets/{YamlWorkflowsPage-DVEVSKKJ.js → YamlWorkflowsPage-BVdLnm6K.js} +2 -2
  185. package/dashboard/dist/assets/{YamlWorkflowsPage-DVEVSKKJ.js.map → YamlWorkflowsPage-BVdLnm6K.js.map} +1 -1
  186. package/dashboard/dist/assets/{agents-B-8z_DV8.js → agents-CHjbjHXA.js} +2 -2
  187. package/dashboard/dist/assets/{agents-B-8z_DV8.js.map → agents-CHjbjHXA.js.map} +1 -1
  188. package/dashboard/dist/assets/{bots-Clm-wZeG.js → bots-WrUhEPWs.js} +2 -2
  189. package/dashboard/dist/assets/{bots-Clm-wZeG.js.map → bots-WrUhEPWs.js.map} +1 -1
  190. package/dashboard/dist/assets/{capabilities-CBwgv5tr.js → capabilities-CunMmkj8.js} +2 -2
  191. package/dashboard/dist/assets/{capabilities-CBwgv5tr.js.map → capabilities-CunMmkj8.js.map} +1 -1
  192. package/dashboard/dist/assets/{controlplane-B96o1-zT.js → controlplane-D6IZIZoh.js} +2 -2
  193. package/dashboard/dist/assets/{controlplane-B96o1-zT.js.map → controlplane-D6IZIZoh.js.map} +1 -1
  194. package/dashboard/dist/assets/{escalation-columns-CFoFILF1.js → escalation-columns-Bvo6JI4Z.js} +2 -2
  195. package/dashboard/dist/assets/{escalation-columns-CFoFILF1.js.map → escalation-columns-Bvo6JI4Z.js.map} +1 -1
  196. package/dashboard/dist/assets/{escalation-items-BCUiPsfS.js → escalation-items-DFGRwo49.js} +2 -2
  197. package/dashboard/dist/assets/{escalation-items-BCUiPsfS.js.map → escalation-items-DFGRwo49.js.map} +1 -1
  198. package/dashboard/dist/assets/{index-XS-6UjQd.js → index-B8qrHwp9.js} +2 -2
  199. package/dashboard/dist/assets/{index-XS-6UjQd.js.map → index-B8qrHwp9.js.map} +1 -1
  200. package/dashboard/dist/assets/{index-C1WJs6IZ.js → index-B95LbYhW.js} +2 -2
  201. package/dashboard/dist/assets/{index-C1WJs6IZ.js.map → index-B95LbYhW.js.map} +1 -1
  202. package/dashboard/dist/assets/{index-IedmSPp1.js → index-BZFSXEkr.js} +2 -2
  203. package/dashboard/dist/assets/{index-IedmSPp1.js.map → index-BZFSXEkr.js.map} +1 -1
  204. package/dashboard/dist/assets/index-BmzscsXK.css +1 -0
  205. package/dashboard/dist/assets/{index-DvgjLvvn.js → index-Bo8QU31k.js} +2 -2
  206. package/dashboard/dist/assets/{index-DvgjLvvn.js.map → index-Bo8QU31k.js.map} +1 -1
  207. package/dashboard/dist/assets/{index-B_z-OFwk.js → index-C7EIu1mG.js} +2 -2
  208. package/dashboard/dist/assets/{index-B_z-OFwk.js.map → index-C7EIu1mG.js.map} +1 -1
  209. package/dashboard/dist/assets/{index-Czb9O4Ns.js → index-CpCchhQv.js} +2 -2
  210. package/dashboard/dist/assets/{index-Czb9O4Ns.js.map → index-CpCchhQv.js.map} +1 -1
  211. package/dashboard/dist/assets/{index-BXKDpLk5.js → index-DCJ483vt.js} +2 -2
  212. package/dashboard/dist/assets/{index-BXKDpLk5.js.map → index-DCJ483vt.js.map} +1 -1
  213. package/dashboard/dist/assets/{index-CnhNCVPc.js → index-DRK7M1_9.js} +2 -2
  214. package/dashboard/dist/assets/{index-CnhNCVPc.js.map → index-DRK7M1_9.js.map} +1 -1
  215. package/dashboard/dist/assets/{index-BOuGMe78.js → index-DRw0FXdX.js} +2 -2
  216. package/dashboard/dist/assets/{index-BOuGMe78.js.map → index-DRw0FXdX.js.map} +1 -1
  217. package/dashboard/dist/assets/{index-P22vmuEu.js → index-OuKQ_0eB.js} +2 -2
  218. package/dashboard/dist/assets/{index-P22vmuEu.js.map → index-OuKQ_0eB.js.map} +1 -1
  219. package/dashboard/dist/assets/index-P-DlgAWj.js +3 -0
  220. package/dashboard/dist/assets/index-P-DlgAWj.js.map +1 -0
  221. package/dashboard/dist/assets/{index-MGquOb7J.js → index-boT612Jo.js} +2 -2
  222. package/dashboard/dist/assets/{index-MGquOb7J.js.map → index-boT612Jo.js.map} +1 -1
  223. package/dashboard/dist/assets/index-ygxyAKcc.js +67 -0
  224. package/dashboard/dist/assets/index-ygxyAKcc.js.map +1 -0
  225. package/dashboard/dist/assets/{knowledge-d92ncKgf.js → knowledge-BubJBTwg.js} +2 -2
  226. package/dashboard/dist/assets/{knowledge-d92ncKgf.js.map → knowledge-BubJBTwg.js.map} +1 -1
  227. package/dashboard/dist/assets/{machines-BG9laURp.js → machines-DSm5NFgs.js} +2 -2
  228. package/dashboard/dist/assets/{machines-BG9laURp.js.map → machines-DSm5NFgs.js.map} +1 -1
  229. package/dashboard/dist/assets/{mcp-CsZdpCEf.js → mcp-D6MckqOV.js} +2 -2
  230. package/dashboard/dist/assets/{mcp-CsZdpCEf.js.map → mcp-D6MckqOV.js.map} +1 -1
  231. package/dashboard/dist/assets/{mcp-query-o2xqrZJv.js → mcp-query-VyCdOag6.js} +2 -2
  232. package/dashboard/dist/assets/{mcp-query-o2xqrZJv.js.map → mcp-query-VyCdOag6.js.map} +1 -1
  233. package/dashboard/dist/assets/{personas-EYROtAxm.js → personas-CyJc10xe.js} +2 -2
  234. package/dashboard/dist/assets/{personas-EYROtAxm.js.map → personas-CyJc10xe.js.map} +1 -1
  235. package/dashboard/dist/assets/{pipelines-C17xZZsa.js → pipelines-B2inDtx3.js} +2 -2
  236. package/dashboard/dist/assets/{pipelines-C17xZZsa.js.map → pipelines-B2inDtx3.js.map} +1 -1
  237. package/dashboard/dist/assets/{tasks-CUppIhu6.js → tasks-DOP4d3M6.js} +2 -2
  238. package/dashboard/dist/assets/{tasks-CUppIhu6.js.map → tasks-DOP4d3M6.js.map} +1 -1
  239. package/dashboard/dist/assets/{topics-B-lCJzVc.js → topics-CNOjSWpX.js} +2 -2
  240. package/dashboard/dist/assets/{topics-B-lCJzVc.js.map → topics-CNOjSWpX.js.map} +1 -1
  241. package/dashboard/dist/assets/{useDebouncedValue-C5mMbYoU.js → useDebouncedValue-CgO0TGMd.js} +2 -2
  242. package/dashboard/dist/assets/{useDebouncedValue-C5mMbYoU.js.map → useDebouncedValue-CgO0TGMd.js.map} +1 -1
  243. package/dashboard/dist/assets/{useNamespace-Bu42ipvu.js → useNamespace-BWHvUKtK.js} +2 -2
  244. package/dashboard/dist/assets/{useNamespace-Bu42ipvu.js.map → useNamespace-BWHvUKtK.js.map} +1 -1
  245. package/dashboard/dist/assets/{useYamlActivityEvents-C29uM9Qp.js → useYamlActivityEvents-BZQ__ZGD.js} +2 -2
  246. package/dashboard/dist/assets/{useYamlActivityEvents-C29uM9Qp.js.map → useYamlActivityEvents-BZQ__ZGD.js.map} +1 -1
  247. package/dashboard/dist/assets/{validate-Bt5QGwSc.js → validate-CAin6WM_.js} +2 -2
  248. package/dashboard/dist/assets/{validate-Bt5QGwSc.js.map → validate-CAin6WM_.js.map} +1 -1
  249. package/dashboard/dist/assets/{yaml-workflows-DgrmL_Kt.js → yaml-workflows-Dyln3od-.js} +2 -2
  250. package/dashboard/dist/assets/{yaml-workflows-DgrmL_Kt.js.map → yaml-workflows-Dyln3od-.js.map} +1 -1
  251. package/dashboard/dist/index.html +2 -2
  252. package/docs/accumulator.md +1 -1
  253. package/docs/api/http/escalations.md +1 -1
  254. package/docs/api/sdk/escalations.md +1 -1
  255. package/docs/dashboard.md +4 -2
  256. package/docs/hitl/escalation.md +16 -0
  257. package/docs/scan-codes.md +45 -14
  258. package/package.json +2 -2
  259. package/dashboard/dist/assets/GrantScopeField-BzWGzBfA.js +0 -2
  260. package/dashboard/dist/assets/GrantScopeField-BzWGzBfA.js.map +0 -1
  261. package/dashboard/dist/assets/ScanCodesPage-Dbaud0fc.js +0 -2
  262. package/dashboard/dist/assets/ScanCodesPage-Dbaud0fc.js.map +0 -1
  263. package/dashboard/dist/assets/ScanSchemeDetailPage-BfDw_Eke.js +0 -2
  264. package/dashboard/dist/assets/ScanSchemeDetailPage-BfDw_Eke.js.map +0 -1
  265. package/dashboard/dist/assets/ScanStationPage-DE-zJTiD.js +0 -2
  266. package/dashboard/dist/assets/ScanStationPage-DE-zJTiD.js.map +0 -1
  267. package/dashboard/dist/assets/index-CXNh7LuG.js +0 -67
  268. package/dashboard/dist/assets/index-CXNh7LuG.js.map +0 -1
  269. package/dashboard/dist/assets/index-C_dp4WgY.css +0 -1
  270. package/dashboard/dist/assets/index-EZkdUZwM.js +0 -3
  271. package/dashboard/dist/assets/index-EZkdUZwM.js.map +0 -1
@@ -0,0 +1,67 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProcessesListPage-CT81miI5.js","./vendor-query-DvWWuNIB.js","./tasks-DOP4d3M6.js","./useFilterParams-DBRw1Hcv.js","./vendor-react-_9U4mKFr.js","./useDebouncedValue-CgO0TGMd.js","./api-path-u2Jf9QXS.js","./DataTable-FjFhx0SE.js","./EmptyState-DgC_6njU.js","./useContainerWidth-DSLp1gEm.js","./TimestampCell-NanLWLKo.js","./StickyPagination-miUdVAKw.js","./FilterBar-Dy0b7wwf.js","./vendor-icons-en0_uSRD.js","./PageHeader-DiGWAQlR.js","./ListToolbar-CJmvGy2B.js","./WorkflowPill-CKHip3hH.js","./ProcessDetailPage-D35RX1bB.js","./PageHeaderWithStats-DwnKQ06j.js","./StatusBadge-DHVwxre2.js","./RolePill-D3hkAdKf.js","./UserName-DKXnK7DD.js","./McpOverview-DA9LLvNG.js","./mcp-D6MckqOV.js","./pipelines-B2inDtx3.js","./yaml-workflows-Dyln3od-.js","./controlplane-D6IZIZoh.js","./StatCard-nWY4sndl.js","./McpRunsPage-BRDDYpTM.js","./useNamespace-BWHvUKtK.js","./ElapsedCell-gY_mGMTF.js","./RowActions-Bdd7z4eB.js","./McpRunDetailPage-qHRQ1pEY.js","./SegmentedTabs-BpJh4Hwn.js","./EventTable-2ywJsOLy.js","./SwimlaneTimeline-B1QY1ZzH.js","./StreamMessageDetail-D5Rk7pn7.js","./CopyableId-Bn02zYxt.js","./McpQueryPage-CpsP3w7x.js","./mcp-query-VyCdOag6.js","./McpQueryDetailPage-N7qLmfE8.js","./TagInput-DaIdhv3h.js","./CollapsibleSection-CYNYMYSa.js","./useYamlActivityEvents-BZQ__ZGD.js","./helpers-DzO-OGPe.js","./RunAsSelector-Co6s9bqA.js","./BotPicker-Dqpo36dM.js","./bots-WrUhEPWs.js","./ToolPill-CpBAFdEX.js","./TimeAgo-CHTelacB.js","./EscalationsOverview-CKaGRh-E.js","./AvailableEscalationsPage-GFn8Sgg1.js","./task-queues-7-sHKPsN.js","./BulkAssignModal-CmLVxkz-.js","./constants-CeBBTzf5.js","./EscalationTitleSelect-CT7mYHkb.js","./EscalationTimeline-CLvSr1SD.js","./escalation-items-DFGRwo49.js","./validate-CAin6WM_.js","./escalation-columns-Bvo6JI4Z.js","./EntityTimelinePanel-DJN_ZEQa.js","./PriorityBadge-r33mpDju.js","./CountdownTimer-CuPY7zkb.js","./OperatorDashboard-el5BquXN.js","./index-P-DlgAWj.js","./ResolverForm-BxJkoKAO.js","./RosterWidget-BJMx0a8Z.js","./metadata-display-B7X5hGxG.js","./WorkflowsOverview-D7Oqf4-V.js","./index-DRK7M1_9.js","./NamespacePill-CeSfHH-j.js","./WorkflowsDashboard--isjt06C.js","./YamlWorkflowsPage-BVdLnm6K.js","./GraphInvokePage-yOVpraAy.js","./YamlWorkflowDetailPage-B0wxgrGP.js","./TasksListPage-CUulwvm-.js","./TaskDetailPage-DKUM37o8.js","./WorkflowExecutionPage-Crf7AIFc.js","./AdminDashboard-VQ1fhhJP.js","./index-B8qrHwp9.js","./TaskQueuePill-sUA1nZe-.js","./index-boT612Jo.js","./ConfirmDeleteModal-CpJNP-8w.js","./index-Bo8QU31k.js","./ToolTestPanel-CF1CHzgz.js","./index-OuKQ_0eB.js","./index-B95LbYhW.js","./personas-CyJc10xe.js","./ScopeBadge-DGz79rmG.js","./RolesPage-BE7RWt9q.js","./RoleDetailPage-DtU7vsJm.js","./AutoGrowTextarea-7X3T9La8.js","./PersonasPage-BPI7mqM8.js","./PersonaDetailPage-B_tb8gfl.js","./EscalationSchemaPage-nfCn42hT.js","./PortalPage-e_rBb1do.js","./EscalationListSchemaPage-A4KpTdJA.js","./ScanCodesPage-C2TETaj5.js","./SchemeMatchFields-9H7SmbED.js","./ScanSchemeDetailPage-C2UgU8l-.js","./ScanStationPage-nWYz-OD3.js","./index-C7EIu1mG.js","./OperationsPage-zUaab-CL.js","./index-CpCchhQv.js","./index-DRw0FXdX.js","./CredentialsPage-CtrnkHcj.js","./ConnectedAppsPage-DXIp2Dpl.js","./index-BZFSXEkr.js","./DropZone-DefYTYQy.js","./index-DCJ483vt.js","./knowledge-BubJBTwg.js","./LinesPage-pwL46mOS.js","./machines-DSm5NFgs.js","./LinePage-CMsYtukW.js","./HomePage-67xXjKjN.js","./AgentsPage-DDFMKHhI.js","./agents-CHjbjHXA.js","./AgentDetailPage-5ov5D9V2.js","./CronLabel-DVjTw5Ri.js","./AgentConfigPage-BOe_W2Ij.js","./capabilities-CunMmkj8.js","./topics-CNOjSWpX.js","./CapabilitiesPage-Dfkip6_b.js","./TopicsPage-Bt8gOKYr.js","./TopicDetailPage-CGO8XV_a.js"])))=>i.map(i=>d[i]);
2
+ var mS=Object.defineProperty;var pS=(n,e,s)=>e in n?mS(n,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[e]=s;var j=(n,e,s)=>pS(n,typeof e!="symbol"?e+"":e,s);import{r as yS,u as qe,a as E,j as h,b as Pe,c as Ie,g as gS,d as bS,Q as xS,e as vS}from"./vendor-query-DvWWuNIB.js";import{r as _S,u as ri,a as tn,b as lm,L as ar,N as As,c as un,O as _s,d as wS,R as SS}from"./vendor-react-_9U4mKFr.js";import{X as en,E as ES,S as OS,M as AS,a as Ro,C as cm,b as jS,B as kS,c as NS,d as hx,e as xd,I as vd,U as TS,L as _d,f as CS,G as MS,T as RS,F as DS,R as dx,g as LS,Z as qS,P as qg,h as mx,i as PS,j as Pg,k as wd,l as Bg,m as BS,W as um,n as US,o as zS,p as $S,q as px,r as IS,D as HS,N as FS,s as GS,t as yx,u as gx,v as bx,w as VS,x as YS,y as KS,z as JS,A as QS,H as XS,J as WS,K as ZS,O as eE}from"./vendor-icons-en0_uSRD.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&i(d)}).observe(document,{childList:!0,subtree:!0});function s(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function i(o){if(o.ep)return;o.ep=!0;const c=s(o);fetch(o.href,c)}})();var Qh={exports:{}},io={},Xh={exports:{}},Wh={};/**
3
+ * @license React
4
+ * scheduler.production.js
5
+ *
6
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */var Ug;function tE(){return Ug||(Ug=1,(function(n){function e(H,J){var ce=H.length;H.push(J);e:for(;0<ce;){var pe=ce-1>>>1,ge=H[pe];if(0<o(ge,J))H[pe]=J,H[ce]=ge,ce=pe;else break e}}function s(H){return H.length===0?null:H[0]}function i(H){if(H.length===0)return null;var J=H[0],ce=H.pop();if(ce!==J){H[0]=ce;e:for(var pe=0,ge=H.length,Ce=ge>>>1;pe<Ce;){var Ne=2*(pe+1)-1,Me=H[Ne],Xe=Ne+1,pt=H[Xe];if(0>o(Me,ce))Xe<ge&&0>o(pt,Me)?(H[pe]=pt,H[Xe]=ce,pe=Xe):(H[pe]=Me,H[Ne]=ce,pe=Ne);else if(Xe<ge&&0>o(pt,ce))H[pe]=pt,H[Xe]=ce,pe=Xe;else break e}}return J}function o(H,J){var ce=H.sortIndex-J.sortIndex;return ce!==0?ce:H.id-J.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;n.unstable_now=function(){return c.now()}}else{var d=Date,p=d.now();n.unstable_now=function(){return d.now()-p}}var g=[],u=[],m=1,b=null,x=3,v=!1,_=!1,S=!1,C=!1,B=typeof setTimeout=="function"?setTimeout:null,q=typeof clearTimeout=="function"?clearTimeout:null,ne=typeof setImmediate<"u"?setImmediate:null;function te(H){for(var J=s(u);J!==null;){if(J.callback===null)i(u);else if(J.startTime<=H)i(u),J.sortIndex=J.expirationTime,e(g,J);else break;J=s(u)}}function M(H){if(S=!1,te(H),!_)if(s(g)!==null)_=!0,z||(z=!0,W());else{var J=s(u);J!==null&&Ae(M,J.startTime-H)}}var z=!1,ae=-1,F=5,U=-1;function D(){return C?!0:!(n.unstable_now()-U<F)}function Q(){if(C=!1,z){var H=n.unstable_now();U=H;var J=!0;try{e:{_=!1,S&&(S=!1,q(ae),ae=-1),v=!0;var ce=x;try{t:{for(te(H),b=s(g);b!==null&&!(b.expirationTime>H&&D());){var pe=b.callback;if(typeof pe=="function"){b.callback=null,x=b.priorityLevel;var ge=pe(b.expirationTime<=H);if(H=n.unstable_now(),typeof ge=="function"){b.callback=ge,te(H),J=!0;break t}b===s(g)&&i(g),te(H)}else i(g);b=s(g)}if(b!==null)J=!0;else{var Ce=s(u);Ce!==null&&Ae(M,Ce.startTime-H),J=!1}}break e}finally{b=null,x=ce,v=!1}J=void 0}}finally{J?W():z=!1}}}var W;if(typeof ne=="function")W=function(){ne(Q)};else if(typeof MessageChannel<"u"){var he=new MessageChannel,Ee=he.port2;he.port1.onmessage=Q,W=function(){Ee.postMessage(null)}}else W=function(){B(Q,0)};function Ae(H,J){ae=B(function(){H(n.unstable_now())},J)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(H){H.callback=null},n.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):F=0<H?Math.floor(1e3/H):5},n.unstable_getCurrentPriorityLevel=function(){return x},n.unstable_next=function(H){switch(x){case 1:case 2:case 3:var J=3;break;default:J=x}var ce=x;x=J;try{return H()}finally{x=ce}},n.unstable_requestPaint=function(){C=!0},n.unstable_runWithPriority=function(H,J){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var ce=x;x=H;try{return J()}finally{x=ce}},n.unstable_scheduleCallback=function(H,J,ce){var pe=n.unstable_now();switch(typeof ce=="object"&&ce!==null?(ce=ce.delay,ce=typeof ce=="number"&&0<ce?pe+ce:pe):ce=pe,H){case 1:var ge=-1;break;case 2:ge=250;break;case 5:ge=1073741823;break;case 4:ge=1e4;break;default:ge=5e3}return ge=ce+ge,H={id:m++,callback:J,priorityLevel:H,startTime:ce,expirationTime:ge,sortIndex:-1},ce>pe?(H.sortIndex=ce,e(u,H),s(g)===null&&H===s(u)&&(S?(q(ae),ae=-1):S=!0,Ae(M,ce-pe))):(H.sortIndex=ge,e(g,H),_||v||(_=!0,z||(z=!0,W()))),H},n.unstable_shouldYield=D,n.unstable_wrapCallback=function(H){var J=x;return function(){var ce=x;x=J;try{return H.apply(this,arguments)}finally{x=ce}}}})(Wh)),Wh}var zg;function nE(){return zg||(zg=1,Xh.exports=tE()),Xh.exports}/**
11
+ * @license React
12
+ * react-dom-client.production.js
13
+ *
14
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
15
+ *
16
+ * This source code is licensed under the MIT license found in the
17
+ * LICENSE file in the root directory of this source tree.
18
+ */var $g;function rE(){if($g)return io;$g=1;var n=nE(),e=yS(),s=_S();function i(t){var r="https://react.dev/errors/"+t;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)r+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+t+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function c(t){var r=t,a=t;if(t.alternate)for(;r.return;)r=r.return;else{t=r;do r=t,(r.flags&4098)!==0&&(a=r.return),t=r.return;while(t)}return r.tag===3?a:null}function d(t){if(t.tag===13){var r=t.memoizedState;if(r===null&&(t=t.alternate,t!==null&&(r=t.memoizedState)),r!==null)return r.dehydrated}return null}function p(t){if(t.tag===31){var r=t.memoizedState;if(r===null&&(t=t.alternate,t!==null&&(r=t.memoizedState)),r!==null)return r.dehydrated}return null}function g(t){if(c(t)!==t)throw Error(i(188))}function u(t){var r=t.alternate;if(!r){if(r=c(t),r===null)throw Error(i(188));return r!==t?null:t}for(var a=t,l=r;;){var f=a.return;if(f===null)break;var y=f.alternate;if(y===null){if(l=f.return,l!==null){a=l;continue}break}if(f.child===y.child){for(y=f.child;y;){if(y===a)return g(f),t;if(y===l)return g(f),r;y=y.sibling}throw Error(i(188))}if(a.return!==l.return)a=f,l=y;else{for(var w=!1,O=f.child;O;){if(O===a){w=!0,a=f,l=y;break}if(O===l){w=!0,l=f,a=y;break}O=O.sibling}if(!w){for(O=y.child;O;){if(O===a){w=!0,a=y,l=f;break}if(O===l){w=!0,l=y,a=f;break}O=O.sibling}if(!w)throw Error(i(189))}}if(a.alternate!==l)throw Error(i(190))}if(a.tag!==3)throw Error(i(188));return a.stateNode.current===a?t:r}function m(t){var r=t.tag;if(r===5||r===26||r===27||r===6)return t;for(t=t.child;t!==null;){if(r=m(t),r!==null)return r;t=t.sibling}return null}var b=Object.assign,x=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),B=Symbol.for("react.profiler"),q=Symbol.for("react.consumer"),ne=Symbol.for("react.context"),te=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),z=Symbol.for("react.suspense_list"),ae=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),D=Symbol.for("react.memo_cache_sentinel"),Q=Symbol.iterator;function W(t){return t===null||typeof t!="object"?null:(t=Q&&t[Q]||t["@@iterator"],typeof t=="function"?t:null)}var he=Symbol.for("react.client.reference");function Ee(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===he?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case S:return"Fragment";case B:return"Profiler";case C:return"StrictMode";case M:return"Suspense";case z:return"SuspenseList";case U:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case _:return"Portal";case ne:return t.displayName||"Context";case q:return(t._context.displayName||"Context")+".Consumer";case te:var r=t.render;return t=t.displayName,t||(t=r.displayName||r.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case ae:return r=t.displayName||null,r!==null?r:Ee(t.type)||"Memo";case F:r=t._payload,t=t._init;try{return Ee(t(r))}catch{}}return null}var Ae=Array.isArray,H=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ce={pending:!1,data:null,method:null,action:null},pe=[],ge=-1;function Ce(t){return{current:t}}function Ne(t){0>ge||(t.current=pe[ge],pe[ge]=null,ge--)}function Me(t,r){ge++,pe[ge]=t.current,t.current=r}var Xe=Ce(null),pt=Ce(null),Ot=Ce(null),mt=Ce(null);function _e(t,r){switch(Me(Ot,r),Me(pt,t),Me(Xe,null),r.nodeType){case 9:case 11:t=(t=r.documentElement)&&(t=t.namespaceURI)?ig(t):0;break;default:if(t=r.tagName,r=r.namespaceURI)r=ig(r),t=ag(r,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}Ne(Xe),Me(Xe,t)}function oe(){Ne(Xe),Ne(pt),Ne(Ot)}function Be(t){t.memoizedState!==null&&Me(mt,t);var r=Xe.current,a=ag(r,t.type);r!==a&&(Me(pt,t),Me(Xe,a))}function zt(t){pt.current===t&&(Ne(Xe),Ne(pt)),mt.current===t&&(Ne(mt),to._currentValue=ce)}var Mt,tt;function ye(t){if(Mt===void 0)try{throw Error()}catch(a){var r=a.stack.trim().match(/\n( *(at )?)/);Mt=r&&r[1]||"",tt=-1<a.stack.indexOf(`
19
+ at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
20
+ `+Mt+t+tt}var Le=!1;function yt(t,r){if(!t||Le)return"";Le=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(r){var ie=function(){throw Error()};if(Object.defineProperty(ie.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ie,[])}catch(X){var Y=X}Reflect.construct(t,[],ie)}else{try{ie.call()}catch(X){Y=X}t.call(ie.prototype)}}else{try{throw Error()}catch(X){Y=X}(ie=t())&&typeof ie.catch=="function"&&ie.catch(function(){})}}catch(X){if(X&&Y&&typeof X.stack=="string")return[X.stack,Y.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var y=l.DetermineComponentFrameRoot(),w=y[0],O=y[1];if(w&&O){var R=w.split(`
21
+ `),V=O.split(`
22
+ `);for(f=l=0;l<R.length&&!R[l].includes("DetermineComponentFrameRoot");)l++;for(;f<V.length&&!V[f].includes("DetermineComponentFrameRoot");)f++;if(l===R.length||f===V.length)for(l=R.length-1,f=V.length-1;1<=l&&0<=f&&R[l]!==V[f];)f--;for(;1<=l&&0<=f;l--,f--)if(R[l]!==V[f]){if(l!==1||f!==1)do if(l--,f--,0>f||R[l]!==V[f]){var Z=`
23
+ `+R[l].replace(" at new "," at ");return t.displayName&&Z.includes("<anonymous>")&&(Z=Z.replace("<anonymous>",t.displayName)),Z}while(1<=l&&0<=f);break}}}finally{Le=!1,Error.prepareStackTrace=a}return(a=t?t.displayName||t.name:"")?ye(a):""}function At(t,r){switch(t.tag){case 26:case 27:case 5:return ye(t.type);case 16:return ye("Lazy");case 13:return t.child!==r&&r!==null?ye("Suspense Fallback"):ye("Suspense");case 19:return ye("SuspenseList");case 0:case 15:return yt(t.type,!1);case 11:return yt(t.type.render,!1);case 1:return yt(t.type,!0);case 31:return ye("Activity");default:return""}}function Ur(t){try{var r="",a=null;do r+=At(t,a),a=t,t=t.return;while(t);return r}catch(l){return`
24
+ Error generating stack: `+l.message+`
25
+ `+l.stack}}var fa=Object.prototype.hasOwnProperty,ha=n.unstable_scheduleCallback,hr=n.unstable_cancelCallback,$o=n.unstable_shouldYield,ii=n.unstable_requestPaint,ut=n.unstable_now,Uu=n.unstable_getCurrentPriorityLevel,Io=n.unstable_ImmediatePriority,Ho=n.unstable_UserBlockingPriority,ai=n.unstable_NormalPriority,zu=n.unstable_LowPriority,Fo=n.unstable_IdlePriority,$u=n.log,Go=n.unstable_setDisableYieldValue,Ts=null,_t=null;function fn(t){if(typeof $u=="function"&&Go(t),_t&&typeof _t.setStrictMode=="function")try{_t.setStrictMode(Ts,t)}catch{}}var Gt=Math.clz32?Math.clz32:oi,da=Math.log,ma=Math.LN2;function oi(t){return t>>>=0,t===0?32:31-(da(t)/ma|0)|0}var zr=256,dr=262144,$r=4194304;function Fn(t){var r=t&42;if(r!==0)return r;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Cs(t,r,a){var l=t.pendingLanes;if(l===0)return 0;var f=0,y=t.suspendedLanes,w=t.pingedLanes;t=t.warmLanes;var O=l&134217727;return O!==0?(l=O&~y,l!==0?f=Fn(l):(w&=O,w!==0?f=Fn(w):a||(a=O&~t,a!==0&&(f=Fn(a))))):(O=l&~y,O!==0?f=Fn(O):w!==0?f=Fn(w):a||(a=l&~t,a!==0&&(f=Fn(a)))),f===0?0:r!==0&&r!==f&&(r&y)===0&&(y=f&-f,a=r&-r,y>=a||y===32&&(a&4194048)!==0)?r:f}function Ms(t,r){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&r)===0}function pa(t,r){switch(t){case 1:case 2:case 4:case 8:case 64:return r+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function li(){var t=$r;return $r<<=1,($r&62914560)===0&&($r=4194304),t}function Ir(t){for(var r=[],a=0;31>a;a++)r.push(t);return r}function Gn(t,r){t.pendingLanes|=r,r!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function Hr(t,r,a,l,f,y){var w=t.pendingLanes;t.pendingLanes=a,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=a,t.entangledLanes&=a,t.errorRecoveryDisabledLanes&=a,t.shellSuspendCounter=0;var O=t.entanglements,R=t.expirationTimes,V=t.hiddenUpdates;for(a=w&~a;0<a;){var Z=31-Gt(a),ie=1<<Z;O[Z]=0,R[Z]=-1;var Y=V[Z];if(Y!==null)for(V[Z]=null,Z=0;Z<Y.length;Z++){var X=Y[Z];X!==null&&(X.lane&=-536870913)}a&=~ie}l!==0&&Fr(t,l,0),y!==0&&f===0&&t.tag!==0&&(t.suspendedLanes|=y&~(w&~r))}function Fr(t,r,a){t.pendingLanes|=r,t.suspendedLanes&=~r;var l=31-Gt(r);t.entangledLanes|=r,t.entanglements[l]=t.entanglements[l]|1073741824|a&261930}function Rs(t,r){var a=t.entangledLanes|=r;for(t=t.entanglements;a;){var l=31-Gt(a),f=1<<l;f&r|t[l]&r&&(t[l]|=r),a&=~f}}function Gr(t,r){var a=r&-r;return a=(a&42)!==0?1:mr(a),(a&(t.suspendedLanes|r))!==0?0:a}function mr(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function Ds(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function ya(){var t=J.p;return t!==0?t:(t=window.event,t===void 0?32:Ng(t.type))}function Vo(t,r){var a=J.p;try{return J.p=t,r()}finally{J.p=a}}var tr=Math.random().toString(36).slice(2),it="__reactFiber$"+tr,gt="__reactProps$"+tr,hn="__reactContainer$"+tr,Ls="__reactEvents$"+tr,ga="__reactListeners$"+tr,Yo="__reactHandles$"+tr,Ko="__reactResources$"+tr,Rt="__reactMarker$"+tr;function ci(t){delete t[it],delete t[gt],delete t[Ls],delete t[ga],delete t[Yo]}function A(t){var r=t[it];if(r)return r;for(var a=t.parentNode;a;){if(r=a[hn]||a[it]){if(a=r.alternate,r.child!==null||a!==null&&a.child!==null)for(t=dg(t);t!==null;){if(a=t[it])return a;t=dg(t)}return r}t=a,a=t.parentNode}return null}function N(t){if(t=t[it]||t[hn]){var r=t.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return t}return null}function k(t){var r=t.tag;if(r===5||r===26||r===27||r===6)return t.stateNode;throw Error(i(33))}function T(t){var r=t[Ko];return r||(r=t[Ko]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function L(t){t[Rt]=!0}var I=new Set,se={};function le(t,r){K(t,r),K(t+"Capture",r)}function K(t,r){for(se[t]=r,t=0;t<r.length;t++)I.add(r[t])}var re=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),xe={},Ue={};function ot(t){return fa.call(Ue,t)?!0:fa.call(xe,t)?!1:re.test(t)?Ue[t]=!0:(xe[t]=!0,!1)}function Vt(t,r,a){if(ot(r))if(a===null)t.removeAttribute(r);else{switch(typeof a){case"undefined":case"function":case"symbol":t.removeAttribute(r);return;case"boolean":var l=r.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){t.removeAttribute(r);return}}t.setAttribute(r,""+a)}}function Vn(t,r,a){if(a===null)t.removeAttribute(r);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(r);return}t.setAttribute(r,""+a)}}function pr(t,r,a,l){if(l===null)t.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(a);return}t.setAttributeNS(r,a,""+l)}}function Tn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Xm(t){var r=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function o_(t,r,a){var l=Object.getOwnPropertyDescriptor(t.constructor.prototype,r);if(!t.hasOwnProperty(r)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var f=l.get,y=l.set;return Object.defineProperty(t,r,{configurable:!0,get:function(){return f.call(this)},set:function(w){a=""+w,y.call(this,w)}}),Object.defineProperty(t,r,{enumerable:l.enumerable}),{getValue:function(){return a},setValue:function(w){a=""+w},stopTracking:function(){t._valueTracker=null,delete t[r]}}}}function Iu(t){if(!t._valueTracker){var r=Xm(t)?"checked":"value";t._valueTracker=o_(t,r,""+t[r])}}function Wm(t){if(!t)return!1;var r=t._valueTracker;if(!r)return!0;var a=r.getValue(),l="";return t&&(l=Xm(t)?t.checked?"true":"false":t.value),t=l,t!==a?(r.setValue(t),!0):!1}function Jo(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var l_=/[\n"\\]/g;function Cn(t){return t.replace(l_,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Hu(t,r,a,l,f,y,w,O){t.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?t.type=w:t.removeAttribute("type"),r!=null?w==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+Tn(r)):t.value!==""+Tn(r)&&(t.value=""+Tn(r)):w!=="submit"&&w!=="reset"||t.removeAttribute("value"),r!=null?Fu(t,w,Tn(r)):a!=null?Fu(t,w,Tn(a)):l!=null&&t.removeAttribute("value"),f==null&&y!=null&&(t.defaultChecked=!!y),f!=null&&(t.checked=f&&typeof f!="function"&&typeof f!="symbol"),O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?t.name=""+Tn(O):t.removeAttribute("name")}function Zm(t,r,a,l,f,y,w,O){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(t.type=y),r!=null||a!=null){if(!(y!=="submit"&&y!=="reset"||r!=null)){Iu(t);return}a=a!=null?""+Tn(a):"",r=r!=null?""+Tn(r):a,O||r===t.value||(t.value=r),t.defaultValue=r}l=l??f,l=typeof l!="function"&&typeof l!="symbol"&&!!l,t.checked=O?t.checked:!!l,t.defaultChecked=!!l,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(t.name=w),Iu(t)}function Fu(t,r,a){r==="number"&&Jo(t.ownerDocument)===t||t.defaultValue===""+a||(t.defaultValue=""+a)}function ui(t,r,a,l){if(t=t.options,r){r={};for(var f=0;f<a.length;f++)r["$"+a[f]]=!0;for(a=0;a<t.length;a++)f=r.hasOwnProperty("$"+t[a].value),t[a].selected!==f&&(t[a].selected=f),f&&l&&(t[a].defaultSelected=!0)}else{for(a=""+Tn(a),r=null,f=0;f<t.length;f++){if(t[f].value===a){t[f].selected=!0,l&&(t[f].defaultSelected=!0);return}r!==null||t[f].disabled||(r=t[f])}r!==null&&(r.selected=!0)}}function e0(t,r,a){if(r!=null&&(r=""+Tn(r),r!==t.value&&(t.value=r),a==null)){t.defaultValue!==r&&(t.defaultValue=r);return}t.defaultValue=a!=null?""+Tn(a):""}function t0(t,r,a,l){if(r==null){if(l!=null){if(a!=null)throw Error(i(92));if(Ae(l)){if(1<l.length)throw Error(i(93));l=l[0]}a=l}a==null&&(a=""),r=a}a=Tn(r),t.defaultValue=a,l=t.textContent,l===a&&l!==""&&l!==null&&(t.value=l),Iu(t)}function fi(t,r){if(r){var a=t.firstChild;if(a&&a===t.lastChild&&a.nodeType===3){a.nodeValue=r;return}}t.textContent=r}var c_=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 n0(t,r,a){var l=r.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?l?t.setProperty(r,""):r==="float"?t.cssFloat="":t[r]="":l?t.setProperty(r,a):typeof a!="number"||a===0||c_.has(r)?r==="float"?t.cssFloat=a:t[r]=(""+a).trim():t[r]=a+"px"}function r0(t,r,a){if(r!=null&&typeof r!="object")throw Error(i(62));if(t=t.style,a!=null){for(var l in a)!a.hasOwnProperty(l)||r!=null&&r.hasOwnProperty(l)||(l.indexOf("--")===0?t.setProperty(l,""):l==="float"?t.cssFloat="":t[l]="");for(var f in r)l=r[f],r.hasOwnProperty(f)&&a[f]!==l&&n0(t,f,l)}else for(var y in r)r.hasOwnProperty(y)&&n0(t,y,r[y])}function Gu(t){if(t.indexOf("-")===-1)return!1;switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var u_=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"]]),f_=/^[\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 Qo(t){return f_.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function yr(){}var Vu=null;function Yu(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var hi=null,di=null;function s0(t){var r=N(t);if(r&&(t=r.stateNode)){var a=t[gt]||null;e:switch(t=r.stateNode,r.type){case"input":if(Hu(t,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),r=a.name,a.type==="radio"&&r!=null){for(a=t;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Cn(""+r)+'"][type="radio"]'),r=0;r<a.length;r++){var l=a[r];if(l!==t&&l.form===t.form){var f=l[gt]||null;if(!f)throw Error(i(90));Hu(l,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(r=0;r<a.length;r++)l=a[r],l.form===t.form&&Wm(l)}break e;case"textarea":e0(t,a.value,a.defaultValue);break e;case"select":r=a.value,r!=null&&ui(t,!!a.multiple,r,!1)}}}var Ku=!1;function i0(t,r,a){if(Ku)return t(r,a);Ku=!0;try{var l=t(r);return l}finally{if(Ku=!1,(hi!==null||di!==null)&&(Pl(),hi&&(r=hi,t=di,di=hi=null,s0(r),t)))for(r=0;r<t.length;r++)s0(t[r])}}function ba(t,r){var a=t.stateNode;if(a===null)return null;var l=a[gt]||null;if(l===null)return null;a=l[r];e:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(t=t.type,l=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!l;break e;default:t=!1}if(t)return null;if(a&&typeof a!="function")throw Error(i(231,r,typeof a));return a}var gr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ju=!1;if(gr)try{var xa={};Object.defineProperty(xa,"passive",{get:function(){Ju=!0}}),window.addEventListener("test",xa,xa),window.removeEventListener("test",xa,xa)}catch{Ju=!1}var Vr=null,Qu=null,Xo=null;function a0(){if(Xo)return Xo;var t,r=Qu,a=r.length,l,f="value"in Vr?Vr.value:Vr.textContent,y=f.length;for(t=0;t<a&&r[t]===f[t];t++);var w=a-t;for(l=1;l<=w&&r[a-l]===f[y-l];l++);return Xo=f.slice(t,1<l?1-l:void 0)}function Wo(t){var r=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&r===13&&(t=13)):t=r,t===10&&(t=13),32<=t||t===13?t:0}function Zo(){return!0}function o0(){return!1}function rn(t){function r(a,l,f,y,w){this._reactName=a,this._targetInst=f,this.type=l,this.nativeEvent=y,this.target=w,this.currentTarget=null;for(var O in t)t.hasOwnProperty(O)&&(a=t[O],this[O]=a?a(y):y[O]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?Zo:o0,this.isPropagationStopped=o0,this}return b(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Zo)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Zo)},persist:function(){},isPersistent:Zo}),r}var qs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},el=rn(qs),va=b({},qs,{view:0,detail:0}),h_=rn(va),Xu,Wu,_a,tl=b({},va,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ef,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==_a&&(_a&&t.type==="mousemove"?(Xu=t.screenX-_a.screenX,Wu=t.screenY-_a.screenY):Wu=Xu=0,_a=t),Xu)},movementY:function(t){return"movementY"in t?t.movementY:Wu}}),l0=rn(tl),d_=b({},tl,{dataTransfer:0}),m_=rn(d_),p_=b({},va,{relatedTarget:0}),Zu=rn(p_),y_=b({},qs,{animationName:0,elapsedTime:0,pseudoElement:0}),g_=rn(y_),b_=b({},qs,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),x_=rn(b_),v_=b({},qs,{data:0}),c0=rn(v_),__={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},w_={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"},S_={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function E_(t){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(t):(t=S_[t])?!!r[t]:!1}function ef(){return E_}var O_=b({},va,{key:function(t){if(t.key){var r=__[t.key]||t.key;if(r!=="Unidentified")return r}return t.type==="keypress"?(t=Wo(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?w_[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ef,charCode:function(t){return t.type==="keypress"?Wo(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Wo(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),A_=rn(O_),j_=b({},tl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),u0=rn(j_),k_=b({},va,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ef}),N_=rn(k_),T_=b({},qs,{propertyName:0,elapsedTime:0,pseudoElement:0}),C_=rn(T_),M_=b({},tl,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),R_=rn(M_),D_=b({},qs,{newState:0,oldState:0}),L_=rn(D_),q_=[9,13,27,32],tf=gr&&"CompositionEvent"in window,wa=null;gr&&"documentMode"in document&&(wa=document.documentMode);var P_=gr&&"TextEvent"in window&&!wa,f0=gr&&(!tf||wa&&8<wa&&11>=wa),h0=" ",d0=!1;function m0(t,r){switch(t){case"keyup":return q_.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function p0(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var mi=!1;function B_(t,r){switch(t){case"compositionend":return p0(r);case"keypress":return r.which!==32?null:(d0=!0,h0);case"textInput":return t=r.data,t===h0&&d0?null:t;default:return null}}function U_(t,r){if(mi)return t==="compositionend"||!tf&&m0(t,r)?(t=a0(),Xo=Qu=Vr=null,mi=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return f0&&r.locale!=="ko"?null:r.data;default:return null}}var z_={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 y0(t){var r=t&&t.nodeName&&t.nodeName.toLowerCase();return r==="input"?!!z_[t.type]:r==="textarea"}function g0(t,r,a,l){hi?di?di.push(l):di=[l]:hi=l,r=Fl(r,"onChange"),0<r.length&&(a=new el("onChange","change",null,a,l),t.push({event:a,listeners:r}))}var Sa=null,Ea=null;function $_(t){Zy(t,0)}function nl(t){var r=k(t);if(Wm(r))return t}function b0(t,r){if(t==="change")return r}var x0=!1;if(gr){var nf;if(gr){var rf="oninput"in document;if(!rf){var v0=document.createElement("div");v0.setAttribute("oninput","return;"),rf=typeof v0.oninput=="function"}nf=rf}else nf=!1;x0=nf&&(!document.documentMode||9<document.documentMode)}function _0(){Sa&&(Sa.detachEvent("onpropertychange",w0),Ea=Sa=null)}function w0(t){if(t.propertyName==="value"&&nl(Ea)){var r=[];g0(r,Ea,t,Yu(t)),i0($_,r)}}function I_(t,r,a){t==="focusin"?(_0(),Sa=r,Ea=a,Sa.attachEvent("onpropertychange",w0)):t==="focusout"&&_0()}function H_(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return nl(Ea)}function F_(t,r){if(t==="click")return nl(r)}function G_(t,r){if(t==="input"||t==="change")return nl(r)}function V_(t,r){return t===r&&(t!==0||1/t===1/r)||t!==t&&r!==r}var dn=typeof Object.is=="function"?Object.is:V_;function Oa(t,r){if(dn(t,r))return!0;if(typeof t!="object"||t===null||typeof r!="object"||r===null)return!1;var a=Object.keys(t),l=Object.keys(r);if(a.length!==l.length)return!1;for(l=0;l<a.length;l++){var f=a[l];if(!fa.call(r,f)||!dn(t[f],r[f]))return!1}return!0}function S0(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function E0(t,r){var a=S0(t);t=0;for(var l;a;){if(a.nodeType===3){if(l=t+a.textContent.length,t<=r&&l>=r)return{node:a,offset:r-t};t=l}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=S0(a)}}function O0(t,r){return t&&r?t===r?!0:t&&t.nodeType===3?!1:r&&r.nodeType===3?O0(t,r.parentNode):"contains"in t?t.contains(r):t.compareDocumentPosition?!!(t.compareDocumentPosition(r)&16):!1:!1}function A0(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var r=Jo(t.document);r instanceof t.HTMLIFrameElement;){try{var a=typeof r.contentWindow.location.href=="string"}catch{a=!1}if(a)t=r.contentWindow;else break;r=Jo(t.document)}return r}function sf(t){var r=t&&t.nodeName&&t.nodeName.toLowerCase();return r&&(r==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||r==="textarea"||t.contentEditable==="true")}var Y_=gr&&"documentMode"in document&&11>=document.documentMode,pi=null,af=null,Aa=null,of=!1;function j0(t,r,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;of||pi==null||pi!==Jo(l)||(l=pi,"selectionStart"in l&&sf(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}),Aa&&Oa(Aa,l)||(Aa=l,l=Fl(af,"onSelect"),0<l.length&&(r=new el("onSelect","select",null,r,a),t.push({event:r,listeners:l}),r.target=pi)))}function Ps(t,r){var a={};return a[t.toLowerCase()]=r.toLowerCase(),a["Webkit"+t]="webkit"+r,a["Moz"+t]="moz"+r,a}var yi={animationend:Ps("Animation","AnimationEnd"),animationiteration:Ps("Animation","AnimationIteration"),animationstart:Ps("Animation","AnimationStart"),transitionrun:Ps("Transition","TransitionRun"),transitionstart:Ps("Transition","TransitionStart"),transitioncancel:Ps("Transition","TransitionCancel"),transitionend:Ps("Transition","TransitionEnd")},lf={},k0={};gr&&(k0=document.createElement("div").style,"AnimationEvent"in window||(delete yi.animationend.animation,delete yi.animationiteration.animation,delete yi.animationstart.animation),"TransitionEvent"in window||delete yi.transitionend.transition);function Bs(t){if(lf[t])return lf[t];if(!yi[t])return t;var r=yi[t],a;for(a in r)if(r.hasOwnProperty(a)&&a in k0)return lf[t]=r[a];return t}var N0=Bs("animationend"),T0=Bs("animationiteration"),C0=Bs("animationstart"),K_=Bs("transitionrun"),J_=Bs("transitionstart"),Q_=Bs("transitioncancel"),M0=Bs("transitionend"),R0=new Map,cf="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(" ");cf.push("scrollEnd");function Yn(t,r){R0.set(t,r),le(r,[t])}var rl=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},Mn=[],gi=0,uf=0;function sl(){for(var t=gi,r=uf=gi=0;r<t;){var a=Mn[r];Mn[r++]=null;var l=Mn[r];Mn[r++]=null;var f=Mn[r];Mn[r++]=null;var y=Mn[r];if(Mn[r++]=null,l!==null&&f!==null){var w=l.pending;w===null?f.next=f:(f.next=w.next,w.next=f),l.pending=f}y!==0&&D0(a,f,y)}}function il(t,r,a,l){Mn[gi++]=t,Mn[gi++]=r,Mn[gi++]=a,Mn[gi++]=l,uf|=l,t.lanes|=l,t=t.alternate,t!==null&&(t.lanes|=l)}function ff(t,r,a,l){return il(t,r,a,l),al(t)}function Us(t,r){return il(t,null,null,r),al(t)}function D0(t,r,a){t.lanes|=a;var l=t.alternate;l!==null&&(l.lanes|=a);for(var f=!1,y=t.return;y!==null;)y.childLanes|=a,l=y.alternate,l!==null&&(l.childLanes|=a),y.tag===22&&(t=y.stateNode,t===null||t._visibility&1||(f=!0)),t=y,y=y.return;return t.tag===3?(y=t.stateNode,f&&r!==null&&(f=31-Gt(a),t=y.hiddenUpdates,l=t[f],l===null?t[f]=[r]:l.push(r),r.lane=a|536870912),y):null}function al(t){if(50<Ka)throw Ka=0,vh=null,Error(i(185));for(var r=t.return;r!==null;)t=r,r=t.return;return t.tag===3?t.stateNode:null}var bi={};function X_(t,r,a,l){this.tag=t,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function mn(t,r,a,l){return new X_(t,r,a,l)}function hf(t){return t=t.prototype,!(!t||!t.isReactComponent)}function br(t,r){var a=t.alternate;return a===null?(a=mn(t.tag,r,t.key,t.mode),a.elementType=t.elementType,a.type=t.type,a.stateNode=t.stateNode,a.alternate=t,t.alternate=a):(a.pendingProps=r,a.type=t.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=t.flags&65011712,a.childLanes=t.childLanes,a.lanes=t.lanes,a.child=t.child,a.memoizedProps=t.memoizedProps,a.memoizedState=t.memoizedState,a.updateQueue=t.updateQueue,r=t.dependencies,a.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},a.sibling=t.sibling,a.index=t.index,a.ref=t.ref,a.refCleanup=t.refCleanup,a}function L0(t,r){t.flags&=65011714;var a=t.alternate;return a===null?(t.childLanes=0,t.lanes=r,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=a.childLanes,t.lanes=a.lanes,t.child=a.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=a.memoizedProps,t.memoizedState=a.memoizedState,t.updateQueue=a.updateQueue,t.type=a.type,r=a.dependencies,t.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),t}function ol(t,r,a,l,f,y){var w=0;if(l=t,typeof t=="function")hf(t)&&(w=1);else if(typeof t=="string")w=nS(t,a,Xe.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case U:return t=mn(31,a,r,f),t.elementType=U,t.lanes=y,t;case S:return zs(a.children,f,y,r);case C:w=8,f|=24;break;case B:return t=mn(12,a,r,f|2),t.elementType=B,t.lanes=y,t;case M:return t=mn(13,a,r,f),t.elementType=M,t.lanes=y,t;case z:return t=mn(19,a,r,f),t.elementType=z,t.lanes=y,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case ne:w=10;break e;case q:w=9;break e;case te:w=11;break e;case ae:w=14;break e;case F:w=16,l=null;break e}w=29,a=Error(i(130,t===null?"null":typeof t,"")),l=null}return r=mn(w,a,r,f),r.elementType=t,r.type=l,r.lanes=y,r}function zs(t,r,a,l){return t=mn(7,t,l,r),t.lanes=a,t}function df(t,r,a){return t=mn(6,t,null,r),t.lanes=a,t}function q0(t){var r=mn(18,null,null,0);return r.stateNode=t,r}function mf(t,r,a){return r=mn(4,t.children!==null?t.children:[],t.key,r),r.lanes=a,r.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},r}var P0=new WeakMap;function Rn(t,r){if(typeof t=="object"&&t!==null){var a=P0.get(t);return a!==void 0?a:(r={value:t,source:r,stack:Ur(r)},P0.set(t,r),r)}return{value:t,source:r,stack:Ur(r)}}var xi=[],vi=0,ll=null,ja=0,Dn=[],Ln=0,Yr=null,nr=1,rr="";function xr(t,r){xi[vi++]=ja,xi[vi++]=ll,ll=t,ja=r}function B0(t,r,a){Dn[Ln++]=nr,Dn[Ln++]=rr,Dn[Ln++]=Yr,Yr=t;var l=nr;t=rr;var f=32-Gt(l)-1;l&=~(1<<f),a+=1;var y=32-Gt(r)+f;if(30<y){var w=f-f%5;y=(l&(1<<w)-1).toString(32),l>>=w,f-=w,nr=1<<32-Gt(r)+f|a<<f|l,rr=y+t}else nr=1<<y|a<<f|l,rr=t}function pf(t){t.return!==null&&(xr(t,1),B0(t,1,0))}function yf(t){for(;t===ll;)ll=xi[--vi],xi[vi]=null,ja=xi[--vi],xi[vi]=null;for(;t===Yr;)Yr=Dn[--Ln],Dn[Ln]=null,rr=Dn[--Ln],Dn[Ln]=null,nr=Dn[--Ln],Dn[Ln]=null}function U0(t,r){Dn[Ln++]=nr,Dn[Ln++]=rr,Dn[Ln++]=Yr,nr=r.id,rr=r.overflow,Yr=t}var $t=null,lt=null,Ge=!1,Kr=null,qn=!1,gf=Error(i(519));function Jr(t){var r=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ka(Rn(r,t)),gf}function z0(t){var r=t.stateNode,a=t.type,l=t.memoizedProps;switch(r[it]=t,r[gt]=l,a){case"dialog":$e("cancel",r),$e("close",r);break;case"iframe":case"object":case"embed":$e("load",r);break;case"video":case"audio":for(a=0;a<Qa.length;a++)$e(Qa[a],r);break;case"source":$e("error",r);break;case"img":case"image":case"link":$e("error",r),$e("load",r);break;case"details":$e("toggle",r);break;case"input":$e("invalid",r),Zm(r,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":$e("invalid",r);break;case"textarea":$e("invalid",r),t0(r,l.value,l.defaultValue,l.children)}a=l.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||r.textContent===""+a||l.suppressHydrationWarning===!0||rg(r.textContent,a)?(l.popover!=null&&($e("beforetoggle",r),$e("toggle",r)),l.onScroll!=null&&$e("scroll",r),l.onScrollEnd!=null&&$e("scrollend",r),l.onClick!=null&&(r.onclick=yr),r=!0):r=!1,r||Jr(t,!0)}function $0(t){for($t=t.return;$t;)switch($t.tag){case 5:case 31:case 13:qn=!1;return;case 27:case 3:qn=!0;return;default:$t=$t.return}}function _i(t){if(t!==$t)return!1;if(!Ge)return $0(t),Ge=!0,!1;var r=t.tag,a;if((a=r!==3&&r!==27)&&((a=r===5)&&(a=t.type,a=!(a!=="form"&&a!=="button")||Lh(t.type,t.memoizedProps)),a=!a),a&&lt&&Jr(t),$0(t),r===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(317));lt=hg(t)}else if(r===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(317));lt=hg(t)}else r===27?(r=lt,cs(t.type)?(t=zh,zh=null,lt=t):lt=r):lt=$t?Bn(t.stateNode.nextSibling):null;return!0}function $s(){lt=$t=null,Ge=!1}function bf(){var t=Kr;return t!==null&&(ln===null?ln=t:ln.push.apply(ln,t),Kr=null),t}function ka(t){Kr===null?Kr=[t]:Kr.push(t)}var xf=Ce(null),Is=null,vr=null;function Qr(t,r,a){Me(xf,r._currentValue),r._currentValue=a}function _r(t){t._currentValue=xf.current,Ne(xf)}function vf(t,r,a){for(;t!==null;){var l=t.alternate;if((t.childLanes&r)!==r?(t.childLanes|=r,l!==null&&(l.childLanes|=r)):l!==null&&(l.childLanes&r)!==r&&(l.childLanes|=r),t===a)break;t=t.return}}function _f(t,r,a,l){var f=t.child;for(f!==null&&(f.return=t);f!==null;){var y=f.dependencies;if(y!==null){var w=f.child;y=y.firstContext;e:for(;y!==null;){var O=y;y=f;for(var R=0;R<r.length;R++)if(O.context===r[R]){y.lanes|=a,O=y.alternate,O!==null&&(O.lanes|=a),vf(y.return,a,t),l||(w=null);break e}y=O.next}}else if(f.tag===18){if(w=f.return,w===null)throw Error(i(341));w.lanes|=a,y=w.alternate,y!==null&&(y.lanes|=a),vf(w,a,t),w=null}else w=f.child;if(w!==null)w.return=f;else for(w=f;w!==null;){if(w===t){w=null;break}if(f=w.sibling,f!==null){f.return=w.return,w=f;break}w=w.return}f=w}}function wi(t,r,a,l){t=null;for(var f=r,y=!1;f!==null;){if(!y){if((f.flags&524288)!==0)y=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var w=f.alternate;if(w===null)throw Error(i(387));if(w=w.memoizedProps,w!==null){var O=f.type;dn(f.pendingProps.value,w.value)||(t!==null?t.push(O):t=[O])}}else if(f===mt.current){if(w=f.alternate,w===null)throw Error(i(387));w.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(t!==null?t.push(to):t=[to])}f=f.return}t!==null&&_f(r,t,a,l),r.flags|=262144}function cl(t){for(t=t.firstContext;t!==null;){if(!dn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Hs(t){Is=t,vr=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function It(t){return I0(Is,t)}function ul(t,r){return Is===null&&Hs(t),I0(t,r)}function I0(t,r){var a=r._currentValue;if(r={context:r,memoizedValue:a,next:null},vr===null){if(t===null)throw Error(i(308));vr=r,t.dependencies={lanes:0,firstContext:r},t.flags|=524288}else vr=vr.next=r;return a}var W_=typeof AbortController<"u"?AbortController:function(){var t=[],r=this.signal={aborted:!1,addEventListener:function(a,l){t.push(l)}};this.abort=function(){r.aborted=!0,t.forEach(function(a){return a()})}},Z_=n.unstable_scheduleCallback,ew=n.unstable_NormalPriority,jt={$$typeof:ne,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function wf(){return{controller:new W_,data:new Map,refCount:0}}function Na(t){t.refCount--,t.refCount===0&&Z_(ew,function(){t.controller.abort()})}var Ta=null,Sf=0,Si=0,Ei=null;function tw(t,r){if(Ta===null){var a=Ta=[];Sf=0,Si=Ah(),Ei={status:"pending",value:void 0,then:function(l){a.push(l)}}}return Sf++,r.then(H0,H0),r}function H0(){if(--Sf===0&&Ta!==null){Ei!==null&&(Ei.status="fulfilled");var t=Ta;Ta=null,Si=0,Ei=null;for(var r=0;r<t.length;r++)(0,t[r])()}}function nw(t,r){var a=[],l={status:"pending",value:null,reason:null,then:function(f){a.push(f)}};return t.then(function(){l.status="fulfilled",l.value=r;for(var f=0;f<a.length;f++)(0,a[f])(r)},function(f){for(l.status="rejected",l.reason=f,f=0;f<a.length;f++)(0,a[f])(void 0)}),l}var F0=H.S;H.S=function(t,r){jy=ut(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&tw(t,r),F0!==null&&F0(t,r)};var Fs=Ce(null);function Ef(){var t=Fs.current;return t!==null?t:at.pooledCache}function fl(t,r){r===null?Me(Fs,Fs.current):Me(Fs,r.pool)}function G0(){var t=Ef();return t===null?null:{parent:jt._currentValue,pool:t}}var Oi=Error(i(460)),Of=Error(i(474)),hl=Error(i(542)),dl={then:function(){}};function V0(t){return t=t.status,t==="fulfilled"||t==="rejected"}function Y0(t,r,a){switch(a=t[a],a===void 0?t.push(r):a!==r&&(r.then(yr,yr),r=a),r.status){case"fulfilled":return r.value;case"rejected":throw t=r.reason,J0(t),t;default:if(typeof r.status=="string")r.then(yr,yr);else{if(t=at,t!==null&&100<t.shellSuspendCounter)throw Error(i(482));t=r,t.status="pending",t.then(function(l){if(r.status==="pending"){var f=r;f.status="fulfilled",f.value=l}},function(l){if(r.status==="pending"){var f=r;f.status="rejected",f.reason=l}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw t=r.reason,J0(t),t}throw Vs=r,Oi}}function Gs(t){try{var r=t._init;return r(t._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Vs=a,Oi):a}}var Vs=null;function K0(){if(Vs===null)throw Error(i(459));var t=Vs;return Vs=null,t}function J0(t){if(t===Oi||t===hl)throw Error(i(483))}var Ai=null,Ca=0;function ml(t){var r=Ca;return Ca+=1,Ai===null&&(Ai=[]),Y0(Ai,t,r)}function Ma(t,r){r=r.props.ref,t.ref=r!==void 0?r:null}function pl(t,r){throw r.$$typeof===x?Error(i(525)):(t=Object.prototype.toString.call(r),Error(i(31,t==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":t)))}function Q0(t){function r($,P){if(t){var G=$.deletions;G===null?($.deletions=[P],$.flags|=16):G.push(P)}}function a($,P){if(!t)return null;for(;P!==null;)r($,P),P=P.sibling;return null}function l($){for(var P=new Map;$!==null;)$.key!==null?P.set($.key,$):P.set($.index,$),$=$.sibling;return P}function f($,P){return $=br($,P),$.index=0,$.sibling=null,$}function y($,P,G){return $.index=G,t?(G=$.alternate,G!==null?(G=G.index,G<P?($.flags|=67108866,P):G):($.flags|=67108866,P)):($.flags|=1048576,P)}function w($){return t&&$.alternate===null&&($.flags|=67108866),$}function O($,P,G,ee){return P===null||P.tag!==6?(P=df(G,$.mode,ee),P.return=$,P):(P=f(P,G),P.return=$,P)}function R($,P,G,ee){var je=G.type;return je===S?Z($,P,G.props.children,ee,G.key):P!==null&&(P.elementType===je||typeof je=="object"&&je!==null&&je.$$typeof===F&&Gs(je)===P.type)?(P=f(P,G.props),Ma(P,G),P.return=$,P):(P=ol(G.type,G.key,G.props,null,$.mode,ee),Ma(P,G),P.return=$,P)}function V($,P,G,ee){return P===null||P.tag!==4||P.stateNode.containerInfo!==G.containerInfo||P.stateNode.implementation!==G.implementation?(P=mf(G,$.mode,ee),P.return=$,P):(P=f(P,G.children||[]),P.return=$,P)}function Z($,P,G,ee,je){return P===null||P.tag!==7?(P=zs(G,$.mode,ee,je),P.return=$,P):(P=f(P,G),P.return=$,P)}function ie($,P,G){if(typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint")return P=df(""+P,$.mode,G),P.return=$,P;if(typeof P=="object"&&P!==null){switch(P.$$typeof){case v:return G=ol(P.type,P.key,P.props,null,$.mode,G),Ma(G,P),G.return=$,G;case _:return P=mf(P,$.mode,G),P.return=$,P;case F:return P=Gs(P),ie($,P,G)}if(Ae(P)||W(P))return P=zs(P,$.mode,G,null),P.return=$,P;if(typeof P.then=="function")return ie($,ml(P),G);if(P.$$typeof===ne)return ie($,ul($,P),G);pl($,P)}return null}function Y($,P,G,ee){var je=P!==null?P.key:null;if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return je!==null?null:O($,P,""+G,ee);if(typeof G=="object"&&G!==null){switch(G.$$typeof){case v:return G.key===je?R($,P,G,ee):null;case _:return G.key===je?V($,P,G,ee):null;case F:return G=Gs(G),Y($,P,G,ee)}if(Ae(G)||W(G))return je!==null?null:Z($,P,G,ee,null);if(typeof G.then=="function")return Y($,P,ml(G),ee);if(G.$$typeof===ne)return Y($,P,ul($,G),ee);pl($,G)}return null}function X($,P,G,ee,je){if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return $=$.get(G)||null,O(P,$,""+ee,je);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case v:return $=$.get(ee.key===null?G:ee.key)||null,R(P,$,ee,je);case _:return $=$.get(ee.key===null?G:ee.key)||null,V(P,$,ee,je);case F:return ee=Gs(ee),X($,P,G,ee,je)}if(Ae(ee)||W(ee))return $=$.get(G)||null,Z(P,$,ee,je,null);if(typeof ee.then=="function")return X($,P,G,ml(ee),je);if(ee.$$typeof===ne)return X($,P,G,ul(P,ee),je);pl(P,ee)}return null}function ve($,P,G,ee){for(var je=null,Ke=null,we=P,De=P=0,Fe=null;we!==null&&De<G.length;De++){we.index>De?(Fe=we,we=null):Fe=we.sibling;var Je=Y($,we,G[De],ee);if(Je===null){we===null&&(we=Fe);break}t&&we&&Je.alternate===null&&r($,we),P=y(Je,P,De),Ke===null?je=Je:Ke.sibling=Je,Ke=Je,we=Fe}if(De===G.length)return a($,we),Ge&&xr($,De),je;if(we===null){for(;De<G.length;De++)we=ie($,G[De],ee),we!==null&&(P=y(we,P,De),Ke===null?je=we:Ke.sibling=we,Ke=we);return Ge&&xr($,De),je}for(we=l(we);De<G.length;De++)Fe=X(we,$,De,G[De],ee),Fe!==null&&(t&&Fe.alternate!==null&&we.delete(Fe.key===null?De:Fe.key),P=y(Fe,P,De),Ke===null?je=Fe:Ke.sibling=Fe,Ke=Fe);return t&&we.forEach(function(ms){return r($,ms)}),Ge&&xr($,De),je}function Te($,P,G,ee){if(G==null)throw Error(i(151));for(var je=null,Ke=null,we=P,De=P=0,Fe=null,Je=G.next();we!==null&&!Je.done;De++,Je=G.next()){we.index>De?(Fe=we,we=null):Fe=we.sibling;var ms=Y($,we,Je.value,ee);if(ms===null){we===null&&(we=Fe);break}t&&we&&ms.alternate===null&&r($,we),P=y(ms,P,De),Ke===null?je=ms:Ke.sibling=ms,Ke=ms,we=Fe}if(Je.done)return a($,we),Ge&&xr($,De),je;if(we===null){for(;!Je.done;De++,Je=G.next())Je=ie($,Je.value,ee),Je!==null&&(P=y(Je,P,De),Ke===null?je=Je:Ke.sibling=Je,Ke=Je);return Ge&&xr($,De),je}for(we=l(we);!Je.done;De++,Je=G.next())Je=X(we,$,De,Je.value,ee),Je!==null&&(t&&Je.alternate!==null&&we.delete(Je.key===null?De:Je.key),P=y(Je,P,De),Ke===null?je=Je:Ke.sibling=Je,Ke=Je);return t&&we.forEach(function(dS){return r($,dS)}),Ge&&xr($,De),je}function st($,P,G,ee){if(typeof G=="object"&&G!==null&&G.type===S&&G.key===null&&(G=G.props.children),typeof G=="object"&&G!==null){switch(G.$$typeof){case v:e:{for(var je=G.key;P!==null;){if(P.key===je){if(je=G.type,je===S){if(P.tag===7){a($,P.sibling),ee=f(P,G.props.children),ee.return=$,$=ee;break e}}else if(P.elementType===je||typeof je=="object"&&je!==null&&je.$$typeof===F&&Gs(je)===P.type){a($,P.sibling),ee=f(P,G.props),Ma(ee,G),ee.return=$,$=ee;break e}a($,P);break}else r($,P);P=P.sibling}G.type===S?(ee=zs(G.props.children,$.mode,ee,G.key),ee.return=$,$=ee):(ee=ol(G.type,G.key,G.props,null,$.mode,ee),Ma(ee,G),ee.return=$,$=ee)}return w($);case _:e:{for(je=G.key;P!==null;){if(P.key===je)if(P.tag===4&&P.stateNode.containerInfo===G.containerInfo&&P.stateNode.implementation===G.implementation){a($,P.sibling),ee=f(P,G.children||[]),ee.return=$,$=ee;break e}else{a($,P);break}else r($,P);P=P.sibling}ee=mf(G,$.mode,ee),ee.return=$,$=ee}return w($);case F:return G=Gs(G),st($,P,G,ee)}if(Ae(G))return ve($,P,G,ee);if(W(G)){if(je=W(G),typeof je!="function")throw Error(i(150));return G=je.call(G),Te($,P,G,ee)}if(typeof G.then=="function")return st($,P,ml(G),ee);if(G.$$typeof===ne)return st($,P,ul($,G),ee);pl($,G)}return typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint"?(G=""+G,P!==null&&P.tag===6?(a($,P.sibling),ee=f(P,G),ee.return=$,$=ee):(a($,P),ee=df(G,$.mode,ee),ee.return=$,$=ee),w($)):a($,P)}return function($,P,G,ee){try{Ca=0;var je=st($,P,G,ee);return Ai=null,je}catch(we){if(we===Oi||we===hl)throw we;var Ke=mn(29,we,null,$.mode);return Ke.lanes=ee,Ke.return=$,Ke}finally{}}}var Ys=Q0(!0),X0=Q0(!1),Xr=!1;function Af(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function jf(t,r){t=t.updateQueue,r.updateQueue===t&&(r.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Wr(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Zr(t,r,a){var l=t.updateQueue;if(l===null)return null;if(l=l.shared,(Qe&2)!==0){var f=l.pending;return f===null?r.next=r:(r.next=f.next,f.next=r),l.pending=r,r=al(t),D0(t,null,a),r}return il(t,l,r,a),al(t)}function Ra(t,r,a){if(r=r.updateQueue,r!==null&&(r=r.shared,(a&4194048)!==0)){var l=r.lanes;l&=t.pendingLanes,a|=l,r.lanes=a,Rs(t,a)}}function kf(t,r){var a=t.updateQueue,l=t.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var f=null,y=null;if(a=a.firstBaseUpdate,a!==null){do{var w={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};y===null?f=y=w:y=y.next=w,a=a.next}while(a!==null);y===null?f=y=r:y=y.next=r}else f=y=r;a={baseState:l.baseState,firstBaseUpdate:f,lastBaseUpdate:y,shared:l.shared,callbacks:l.callbacks},t.updateQueue=a;return}t=a.lastBaseUpdate,t===null?a.firstBaseUpdate=r:t.next=r,a.lastBaseUpdate=r}var Nf=!1;function Da(){if(Nf){var t=Ei;if(t!==null)throw t}}function La(t,r,a,l){Nf=!1;var f=t.updateQueue;Xr=!1;var y=f.firstBaseUpdate,w=f.lastBaseUpdate,O=f.shared.pending;if(O!==null){f.shared.pending=null;var R=O,V=R.next;R.next=null,w===null?y=V:w.next=V,w=R;var Z=t.alternate;Z!==null&&(Z=Z.updateQueue,O=Z.lastBaseUpdate,O!==w&&(O===null?Z.firstBaseUpdate=V:O.next=V,Z.lastBaseUpdate=R))}if(y!==null){var ie=f.baseState;w=0,Z=V=R=null,O=y;do{var Y=O.lane&-536870913,X=Y!==O.lane;if(X?(He&Y)===Y:(l&Y)===Y){Y!==0&&Y===Si&&(Nf=!0),Z!==null&&(Z=Z.next={lane:0,tag:O.tag,payload:O.payload,callback:null,next:null});e:{var ve=t,Te=O;Y=r;var st=a;switch(Te.tag){case 1:if(ve=Te.payload,typeof ve=="function"){ie=ve.call(st,ie,Y);break e}ie=ve;break e;case 3:ve.flags=ve.flags&-65537|128;case 0:if(ve=Te.payload,Y=typeof ve=="function"?ve.call(st,ie,Y):ve,Y==null)break e;ie=b({},ie,Y);break e;case 2:Xr=!0}}Y=O.callback,Y!==null&&(t.flags|=64,X&&(t.flags|=8192),X=f.callbacks,X===null?f.callbacks=[Y]:X.push(Y))}else X={lane:Y,tag:O.tag,payload:O.payload,callback:O.callback,next:null},Z===null?(V=Z=X,R=ie):Z=Z.next=X,w|=Y;if(O=O.next,O===null){if(O=f.shared.pending,O===null)break;X=O,O=X.next,X.next=null,f.lastBaseUpdate=X,f.shared.pending=null}}while(!0);Z===null&&(R=ie),f.baseState=R,f.firstBaseUpdate=V,f.lastBaseUpdate=Z,y===null&&(f.shared.lanes=0),ss|=w,t.lanes=w,t.memoizedState=ie}}function W0(t,r){if(typeof t!="function")throw Error(i(191,t));t.call(r)}function Z0(t,r){var a=t.callbacks;if(a!==null)for(t.callbacks=null,t=0;t<a.length;t++)W0(a[t],r)}var ji=Ce(null),yl=Ce(0);function ep(t,r){t=Tr,Me(yl,t),Me(ji,r),Tr=t|r.baseLanes}function Tf(){Me(yl,Tr),Me(ji,ji.current)}function Cf(){Tr=yl.current,Ne(ji),Ne(yl)}var pn=Ce(null),Pn=null;function es(t){var r=t.alternate;Me(wt,wt.current&1),Me(pn,t),Pn===null&&(r===null||ji.current!==null||r.memoizedState!==null)&&(Pn=t)}function Mf(t){Me(wt,wt.current),Me(pn,t),Pn===null&&(Pn=t)}function tp(t){t.tag===22?(Me(wt,wt.current),Me(pn,t),Pn===null&&(Pn=t)):ts()}function ts(){Me(wt,wt.current),Me(pn,pn.current)}function yn(t){Ne(pn),Pn===t&&(Pn=null),Ne(wt)}var wt=Ce(0);function gl(t){for(var r=t;r!==null;){if(r.tag===13){var a=r.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Bh(a)||Uh(a)))return r}else if(r.tag===19&&(r.memoizedProps.revealOrder==="forwards"||r.memoizedProps.revealOrder==="backwards"||r.memoizedProps.revealOrder==="unstable_legacy-backwards"||r.memoizedProps.revealOrder==="together")){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var wr=0,Re=null,nt=null,kt=null,bl=!1,ki=!1,Ks=!1,xl=0,qa=0,Ni=null,rw=0;function bt(){throw Error(i(321))}function Rf(t,r){if(r===null)return!1;for(var a=0;a<r.length&&a<t.length;a++)if(!dn(t[a],r[a]))return!1;return!0}function Df(t,r,a,l,f,y){return wr=y,Re=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,H.H=t===null||t.memoizedState===null?Bp:Jf,Ks=!1,y=a(l,f),Ks=!1,ki&&(y=rp(r,a,l,f)),np(t),y}function np(t){H.H=Ua;var r=nt!==null&&nt.next!==null;if(wr=0,kt=nt=Re=null,bl=!1,qa=0,Ni=null,r)throw Error(i(300));t===null||Nt||(t=t.dependencies,t!==null&&cl(t)&&(Nt=!0))}function rp(t,r,a,l){Re=t;var f=0;do{if(ki&&(Ni=null),qa=0,ki=!1,25<=f)throw Error(i(301));if(f+=1,kt=nt=null,t.updateQueue!=null){var y=t.updateQueue;y.lastEffect=null,y.events=null,y.stores=null,y.memoCache!=null&&(y.memoCache.index=0)}H.H=Up,y=r(a,l)}while(ki);return y}function sw(){var t=H.H,r=t.useState()[0];return r=typeof r.then=="function"?Pa(r):r,t=t.useState()[0],(nt!==null?nt.memoizedState:null)!==t&&(Re.flags|=1024),r}function Lf(){var t=xl!==0;return xl=0,t}function qf(t,r,a){r.updateQueue=t.updateQueue,r.flags&=-2053,t.lanes&=~a}function Pf(t){if(bl){for(t=t.memoizedState;t!==null;){var r=t.queue;r!==null&&(r.pending=null),t=t.next}bl=!1}wr=0,kt=nt=Re=null,ki=!1,qa=xl=0,Ni=null}function Kt(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return kt===null?Re.memoizedState=kt=t:kt=kt.next=t,kt}function St(){if(nt===null){var t=Re.alternate;t=t!==null?t.memoizedState:null}else t=nt.next;var r=kt===null?Re.memoizedState:kt.next;if(r!==null)kt=r,nt=t;else{if(t===null)throw Re.alternate===null?Error(i(467)):Error(i(310));nt=t,t={memoizedState:nt.memoizedState,baseState:nt.baseState,baseQueue:nt.baseQueue,queue:nt.queue,next:null},kt===null?Re.memoizedState=kt=t:kt=kt.next=t}return kt}function vl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Pa(t){var r=qa;return qa+=1,Ni===null&&(Ni=[]),t=Y0(Ni,t,r),r=Re,(kt===null?r.memoizedState:kt.next)===null&&(r=r.alternate,H.H=r===null||r.memoizedState===null?Bp:Jf),t}function _l(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Pa(t);if(t.$$typeof===ne)return It(t)}throw Error(i(438,String(t)))}function Bf(t){var r=null,a=Re.updateQueue;if(a!==null&&(r=a.memoCache),r==null){var l=Re.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(r={data:l.data.map(function(f){return f.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),a===null&&(a=vl(),Re.updateQueue=a),a.memoCache=r,a=r.data[r.index],a===void 0)for(a=r.data[r.index]=Array(t),l=0;l<t;l++)a[l]=D;return r.index++,a}function Sr(t,r){return typeof r=="function"?r(t):r}function wl(t){var r=St();return Uf(r,nt,t)}function Uf(t,r,a){var l=t.queue;if(l===null)throw Error(i(311));l.lastRenderedReducer=a;var f=t.baseQueue,y=l.pending;if(y!==null){if(f!==null){var w=f.next;f.next=y.next,y.next=w}r.baseQueue=f=y,l.pending=null}if(y=t.baseState,f===null)t.memoizedState=y;else{r=f.next;var O=w=null,R=null,V=r,Z=!1;do{var ie=V.lane&-536870913;if(ie!==V.lane?(He&ie)===ie:(wr&ie)===ie){var Y=V.revertLane;if(Y===0)R!==null&&(R=R.next={lane:0,revertLane:0,gesture:null,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null}),ie===Si&&(Z=!0);else if((wr&Y)===Y){V=V.next,Y===Si&&(Z=!0);continue}else ie={lane:0,revertLane:V.revertLane,gesture:null,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null},R===null?(O=R=ie,w=y):R=R.next=ie,Re.lanes|=Y,ss|=Y;ie=V.action,Ks&&a(y,ie),y=V.hasEagerState?V.eagerState:a(y,ie)}else Y={lane:ie,revertLane:V.revertLane,gesture:V.gesture,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null},R===null?(O=R=Y,w=y):R=R.next=Y,Re.lanes|=ie,ss|=ie;V=V.next}while(V!==null&&V!==r);if(R===null?w=y:R.next=O,!dn(y,t.memoizedState)&&(Nt=!0,Z&&(a=Ei,a!==null)))throw a;t.memoizedState=y,t.baseState=w,t.baseQueue=R,l.lastRenderedState=y}return f===null&&(l.lanes=0),[t.memoizedState,l.dispatch]}function zf(t){var r=St(),a=r.queue;if(a===null)throw Error(i(311));a.lastRenderedReducer=t;var l=a.dispatch,f=a.pending,y=r.memoizedState;if(f!==null){a.pending=null;var w=f=f.next;do y=t(y,w.action),w=w.next;while(w!==f);dn(y,r.memoizedState)||(Nt=!0),r.memoizedState=y,r.baseQueue===null&&(r.baseState=y),a.lastRenderedState=y}return[y,l]}function sp(t,r,a){var l=Re,f=St(),y=Ge;if(y){if(a===void 0)throw Error(i(407));a=a()}else a=r();var w=!dn((nt||f).memoizedState,a);if(w&&(f.memoizedState=a,Nt=!0),f=f.queue,Hf(op.bind(null,l,f,t),[t]),f.getSnapshot!==r||w||kt!==null&&kt.memoizedState.tag&1){if(l.flags|=2048,Ti(9,{destroy:void 0},ap.bind(null,l,f,a,r),null),at===null)throw Error(i(349));y||(wr&127)!==0||ip(l,r,a)}return a}function ip(t,r,a){t.flags|=16384,t={getSnapshot:r,value:a},r=Re.updateQueue,r===null?(r=vl(),Re.updateQueue=r,r.stores=[t]):(a=r.stores,a===null?r.stores=[t]:a.push(t))}function ap(t,r,a,l){r.value=a,r.getSnapshot=l,lp(r)&&cp(t)}function op(t,r,a){return a(function(){lp(r)&&cp(t)})}function lp(t){var r=t.getSnapshot;t=t.value;try{var a=r();return!dn(t,a)}catch{return!0}}function cp(t){var r=Us(t,2);r!==null&&cn(r,t,2)}function $f(t){var r=Kt();if(typeof t=="function"){var a=t;if(t=a(),Ks){fn(!0);try{a()}finally{fn(!1)}}}return r.memoizedState=r.baseState=t,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sr,lastRenderedState:t},r}function up(t,r,a,l){return t.baseState=a,Uf(t,nt,typeof l=="function"?l:Sr)}function iw(t,r,a,l,f){if(Ol(t))throw Error(i(485));if(t=r.action,t!==null){var y={payload:f,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){y.listeners.push(w)}};H.T!==null?a(!0):y.isTransition=!1,l(y),a=r.pending,a===null?(y.next=r.pending=y,fp(r,y)):(y.next=a.next,r.pending=a.next=y)}}function fp(t,r){var a=r.action,l=r.payload,f=t.state;if(r.isTransition){var y=H.T,w={};H.T=w;try{var O=a(f,l),R=H.S;R!==null&&R(w,O),hp(t,r,O)}catch(V){If(t,r,V)}finally{y!==null&&w.types!==null&&(y.types=w.types),H.T=y}}else try{y=a(f,l),hp(t,r,y)}catch(V){If(t,r,V)}}function hp(t,r,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){dp(t,r,l)},function(l){return If(t,r,l)}):dp(t,r,a)}function dp(t,r,a){r.status="fulfilled",r.value=a,mp(r),t.state=a,r=t.pending,r!==null&&(a=r.next,a===r?t.pending=null:(a=a.next,r.next=a,fp(t,a)))}function If(t,r,a){var l=t.pending;if(t.pending=null,l!==null){l=l.next;do r.status="rejected",r.reason=a,mp(r),r=r.next;while(r!==l)}t.action=null}function mp(t){t=t.listeners;for(var r=0;r<t.length;r++)(0,t[r])()}function pp(t,r){return r}function yp(t,r){if(Ge){var a=at.formState;if(a!==null){e:{var l=Re;if(Ge){if(lt){t:{for(var f=lt,y=qn;f.nodeType!==8;){if(!y){f=null;break t}if(f=Bn(f.nextSibling),f===null){f=null;break t}}y=f.data,f=y==="F!"||y==="F"?f:null}if(f){lt=Bn(f.nextSibling),l=f.data==="F!";break e}}Jr(l)}l=!1}l&&(r=a[0])}}return a=Kt(),a.memoizedState=a.baseState=r,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:pp,lastRenderedState:r},a.queue=l,a=Lp.bind(null,Re,l),l.dispatch=a,l=$f(!1),y=Kf.bind(null,Re,!1,l.queue),l=Kt(),f={state:r,dispatch:null,action:t,pending:null},l.queue=f,a=iw.bind(null,Re,f,y,a),f.dispatch=a,l.memoizedState=t,[r,a,!1]}function gp(t){var r=St();return bp(r,nt,t)}function bp(t,r,a){if(r=Uf(t,r,pp)[0],t=wl(Sr)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var l=Pa(r)}catch(w){throw w===Oi?hl:w}else l=r;r=St();var f=r.queue,y=f.dispatch;return a!==r.memoizedState&&(Re.flags|=2048,Ti(9,{destroy:void 0},aw.bind(null,f,a),null)),[l,y,t]}function aw(t,r){t.action=r}function xp(t){var r=St(),a=nt;if(a!==null)return bp(r,a,t);St(),r=r.memoizedState,a=St();var l=a.queue.dispatch;return a.memoizedState=t,[r,l,!1]}function Ti(t,r,a,l){return t={tag:t,create:a,deps:l,inst:r,next:null},r=Re.updateQueue,r===null&&(r=vl(),Re.updateQueue=r),a=r.lastEffect,a===null?r.lastEffect=t.next=t:(l=a.next,a.next=t,t.next=l,r.lastEffect=t),t}function vp(){return St().memoizedState}function Sl(t,r,a,l){var f=Kt();Re.flags|=t,f.memoizedState=Ti(1|r,{destroy:void 0},a,l===void 0?null:l)}function El(t,r,a,l){var f=St();l=l===void 0?null:l;var y=f.memoizedState.inst;nt!==null&&l!==null&&Rf(l,nt.memoizedState.deps)?f.memoizedState=Ti(r,y,a,l):(Re.flags|=t,f.memoizedState=Ti(1|r,y,a,l))}function _p(t,r){Sl(8390656,8,t,r)}function Hf(t,r){El(2048,8,t,r)}function ow(t){Re.flags|=4;var r=Re.updateQueue;if(r===null)r=vl(),Re.updateQueue=r,r.events=[t];else{var a=r.events;a===null?r.events=[t]:a.push(t)}}function wp(t){var r=St().memoizedState;return ow({ref:r,nextImpl:t}),function(){if((Qe&2)!==0)throw Error(i(440));return r.impl.apply(void 0,arguments)}}function Sp(t,r){return El(4,2,t,r)}function Ep(t,r){return El(4,4,t,r)}function Op(t,r){if(typeof r=="function"){t=t();var a=r(t);return function(){typeof a=="function"?a():r(null)}}if(r!=null)return t=t(),r.current=t,function(){r.current=null}}function Ap(t,r,a){a=a!=null?a.concat([t]):null,El(4,4,Op.bind(null,r,t),a)}function Ff(){}function jp(t,r){var a=St();r=r===void 0?null:r;var l=a.memoizedState;return r!==null&&Rf(r,l[1])?l[0]:(a.memoizedState=[t,r],t)}function kp(t,r){var a=St();r=r===void 0?null:r;var l=a.memoizedState;if(r!==null&&Rf(r,l[1]))return l[0];if(l=t(),Ks){fn(!0);try{t()}finally{fn(!1)}}return a.memoizedState=[l,r],l}function Gf(t,r,a){return a===void 0||(wr&1073741824)!==0&&(He&261930)===0?t.memoizedState=r:(t.memoizedState=a,t=Ny(),Re.lanes|=t,ss|=t,a)}function Np(t,r,a,l){return dn(a,r)?a:ji.current!==null?(t=Gf(t,a,l),dn(t,r)||(Nt=!0),t):(wr&42)===0||(wr&1073741824)!==0&&(He&261930)===0?(Nt=!0,t.memoizedState=a):(t=Ny(),Re.lanes|=t,ss|=t,r)}function Tp(t,r,a,l,f){var y=J.p;J.p=y!==0&&8>y?y:8;var w=H.T,O={};H.T=O,Kf(t,!1,r,a);try{var R=f(),V=H.S;if(V!==null&&V(O,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var Z=nw(R,l);Ba(t,r,Z,xn(t))}else Ba(t,r,l,xn(t))}catch(ie){Ba(t,r,{then:function(){},status:"rejected",reason:ie},xn())}finally{J.p=y,w!==null&&O.types!==null&&(w.types=O.types),H.T=w}}function lw(){}function Vf(t,r,a,l){if(t.tag!==5)throw Error(i(476));var f=Cp(t).queue;Tp(t,f,r,ce,a===null?lw:function(){return Mp(t),a(l)})}function Cp(t){var r=t.memoizedState;if(r!==null)return r;r={memoizedState:ce,baseState:ce,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sr,lastRenderedState:ce},next:null};var a={};return r.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sr,lastRenderedState:a},next:null},t.memoizedState=r,t=t.alternate,t!==null&&(t.memoizedState=r),r}function Mp(t){var r=Cp(t);r.next===null&&(r=t.alternate.memoizedState),Ba(t,r.next.queue,{},xn())}function Yf(){return It(to)}function Rp(){return St().memoizedState}function Dp(){return St().memoizedState}function cw(t){for(var r=t.return;r!==null;){switch(r.tag){case 24:case 3:var a=xn();t=Wr(a);var l=Zr(r,t,a);l!==null&&(cn(l,r,a),Ra(l,r,a)),r={cache:wf()},t.payload=r;return}r=r.return}}function uw(t,r,a){var l=xn();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Ol(t)?qp(r,a):(a=ff(t,r,a,l),a!==null&&(cn(a,t,l),Pp(a,r,l)))}function Lp(t,r,a){var l=xn();Ba(t,r,a,l)}function Ba(t,r,a,l){var f={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Ol(t))qp(r,f);else{var y=t.alternate;if(t.lanes===0&&(y===null||y.lanes===0)&&(y=r.lastRenderedReducer,y!==null))try{var w=r.lastRenderedState,O=y(w,a);if(f.hasEagerState=!0,f.eagerState=O,dn(O,w))return il(t,r,f,0),at===null&&sl(),!1}catch{}finally{}if(a=ff(t,r,f,l),a!==null)return cn(a,t,l),Pp(a,r,l),!0}return!1}function Kf(t,r,a,l){if(l={lane:2,revertLane:Ah(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Ol(t)){if(r)throw Error(i(479))}else r=ff(t,a,l,2),r!==null&&cn(r,t,2)}function Ol(t){var r=t.alternate;return t===Re||r!==null&&r===Re}function qp(t,r){ki=bl=!0;var a=t.pending;a===null?r.next=r:(r.next=a.next,a.next=r),t.pending=r}function Pp(t,r,a){if((a&4194048)!==0){var l=r.lanes;l&=t.pendingLanes,a|=l,r.lanes=a,Rs(t,a)}}var Ua={readContext:It,use:_l,useCallback:bt,useContext:bt,useEffect:bt,useImperativeHandle:bt,useLayoutEffect:bt,useInsertionEffect:bt,useMemo:bt,useReducer:bt,useRef:bt,useState:bt,useDebugValue:bt,useDeferredValue:bt,useTransition:bt,useSyncExternalStore:bt,useId:bt,useHostTransitionStatus:bt,useFormState:bt,useActionState:bt,useOptimistic:bt,useMemoCache:bt,useCacheRefresh:bt};Ua.useEffectEvent=bt;var Bp={readContext:It,use:_l,useCallback:function(t,r){return Kt().memoizedState=[t,r===void 0?null:r],t},useContext:It,useEffect:_p,useImperativeHandle:function(t,r,a){a=a!=null?a.concat([t]):null,Sl(4194308,4,Op.bind(null,r,t),a)},useLayoutEffect:function(t,r){return Sl(4194308,4,t,r)},useInsertionEffect:function(t,r){Sl(4,2,t,r)},useMemo:function(t,r){var a=Kt();r=r===void 0?null:r;var l=t();if(Ks){fn(!0);try{t()}finally{fn(!1)}}return a.memoizedState=[l,r],l},useReducer:function(t,r,a){var l=Kt();if(a!==void 0){var f=a(r);if(Ks){fn(!0);try{a(r)}finally{fn(!1)}}}else f=r;return l.memoizedState=l.baseState=f,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:f},l.queue=t,t=t.dispatch=uw.bind(null,Re,t),[l.memoizedState,t]},useRef:function(t){var r=Kt();return t={current:t},r.memoizedState=t},useState:function(t){t=$f(t);var r=t.queue,a=Lp.bind(null,Re,r);return r.dispatch=a,[t.memoizedState,a]},useDebugValue:Ff,useDeferredValue:function(t,r){var a=Kt();return Gf(a,t,r)},useTransition:function(){var t=$f(!1);return t=Tp.bind(null,Re,t.queue,!0,!1),Kt().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,r,a){var l=Re,f=Kt();if(Ge){if(a===void 0)throw Error(i(407));a=a()}else{if(a=r(),at===null)throw Error(i(349));(He&127)!==0||ip(l,r,a)}f.memoizedState=a;var y={value:a,getSnapshot:r};return f.queue=y,_p(op.bind(null,l,y,t),[t]),l.flags|=2048,Ti(9,{destroy:void 0},ap.bind(null,l,y,a,r),null),a},useId:function(){var t=Kt(),r=at.identifierPrefix;if(Ge){var a=rr,l=nr;a=(l&~(1<<32-Gt(l)-1)).toString(32)+a,r="_"+r+"R_"+a,a=xl++,0<a&&(r+="H"+a.toString(32)),r+="_"}else a=rw++,r="_"+r+"r_"+a.toString(32)+"_";return t.memoizedState=r},useHostTransitionStatus:Yf,useFormState:yp,useActionState:yp,useOptimistic:function(t){var r=Kt();r.memoizedState=r.baseState=t;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=a,r=Kf.bind(null,Re,!0,a),a.dispatch=r,[t,r]},useMemoCache:Bf,useCacheRefresh:function(){return Kt().memoizedState=cw.bind(null,Re)},useEffectEvent:function(t){var r=Kt(),a={impl:t};return r.memoizedState=a,function(){if((Qe&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}},Jf={readContext:It,use:_l,useCallback:jp,useContext:It,useEffect:Hf,useImperativeHandle:Ap,useInsertionEffect:Sp,useLayoutEffect:Ep,useMemo:kp,useReducer:wl,useRef:vp,useState:function(){return wl(Sr)},useDebugValue:Ff,useDeferredValue:function(t,r){var a=St();return Np(a,nt.memoizedState,t,r)},useTransition:function(){var t=wl(Sr)[0],r=St().memoizedState;return[typeof t=="boolean"?t:Pa(t),r]},useSyncExternalStore:sp,useId:Rp,useHostTransitionStatus:Yf,useFormState:gp,useActionState:gp,useOptimistic:function(t,r){var a=St();return up(a,nt,t,r)},useMemoCache:Bf,useCacheRefresh:Dp};Jf.useEffectEvent=wp;var Up={readContext:It,use:_l,useCallback:jp,useContext:It,useEffect:Hf,useImperativeHandle:Ap,useInsertionEffect:Sp,useLayoutEffect:Ep,useMemo:kp,useReducer:zf,useRef:vp,useState:function(){return zf(Sr)},useDebugValue:Ff,useDeferredValue:function(t,r){var a=St();return nt===null?Gf(a,t,r):Np(a,nt.memoizedState,t,r)},useTransition:function(){var t=zf(Sr)[0],r=St().memoizedState;return[typeof t=="boolean"?t:Pa(t),r]},useSyncExternalStore:sp,useId:Rp,useHostTransitionStatus:Yf,useFormState:xp,useActionState:xp,useOptimistic:function(t,r){var a=St();return nt!==null?up(a,nt,t,r):(a.baseState=t,[t,a.queue.dispatch])},useMemoCache:Bf,useCacheRefresh:Dp};Up.useEffectEvent=wp;function Qf(t,r,a,l){r=t.memoizedState,a=a(l,r),a=a==null?r:b({},r,a),t.memoizedState=a,t.lanes===0&&(t.updateQueue.baseState=a)}var Xf={enqueueSetState:function(t,r,a){t=t._reactInternals;var l=xn(),f=Wr(l);f.payload=r,a!=null&&(f.callback=a),r=Zr(t,f,l),r!==null&&(cn(r,t,l),Ra(r,t,l))},enqueueReplaceState:function(t,r,a){t=t._reactInternals;var l=xn(),f=Wr(l);f.tag=1,f.payload=r,a!=null&&(f.callback=a),r=Zr(t,f,l),r!==null&&(cn(r,t,l),Ra(r,t,l))},enqueueForceUpdate:function(t,r){t=t._reactInternals;var a=xn(),l=Wr(a);l.tag=2,r!=null&&(l.callback=r),r=Zr(t,l,a),r!==null&&(cn(r,t,a),Ra(r,t,a))}};function zp(t,r,a,l,f,y,w){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(l,y,w):r.prototype&&r.prototype.isPureReactComponent?!Oa(a,l)||!Oa(f,y):!0}function $p(t,r,a,l){t=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(a,l),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(a,l),r.state!==t&&Xf.enqueueReplaceState(r,r.state,null)}function Js(t,r){var a=r;if("ref"in r){a={};for(var l in r)l!=="ref"&&(a[l]=r[l])}if(t=t.defaultProps){a===r&&(a=b({},a));for(var f in t)a[f]===void 0&&(a[f]=t[f])}return a}function Ip(t){rl(t)}function Hp(t){console.error(t)}function Fp(t){rl(t)}function Al(t,r){try{var a=t.onUncaughtError;a(r.value,{componentStack:r.stack})}catch(l){setTimeout(function(){throw l})}}function Gp(t,r,a){try{var l=t.onCaughtError;l(a.value,{componentStack:a.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function Wf(t,r,a){return a=Wr(a),a.tag=3,a.payload={element:null},a.callback=function(){Al(t,r)},a}function Vp(t){return t=Wr(t),t.tag=3,t}function Yp(t,r,a,l){var f=a.type.getDerivedStateFromError;if(typeof f=="function"){var y=l.value;t.payload=function(){return f(y)},t.callback=function(){Gp(r,a,l)}}var w=a.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(t.callback=function(){Gp(r,a,l),typeof f!="function"&&(is===null?is=new Set([this]):is.add(this));var O=l.stack;this.componentDidCatch(l.value,{componentStack:O!==null?O:""})})}function fw(t,r,a,l,f){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(r=a.alternate,r!==null&&wi(r,a,f,!0),a=pn.current,a!==null){switch(a.tag){case 31:case 13:return Pn===null?Bl():a.alternate===null&&xt===0&&(xt=3),a.flags&=-257,a.flags|=65536,a.lanes=f,l===dl?a.flags|=16384:(r=a.updateQueue,r===null?a.updateQueue=new Set([l]):r.add(l),Sh(t,l,f)),!1;case 22:return a.flags|=65536,l===dl?a.flags|=16384:(r=a.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([l])},a.updateQueue=r):(a=r.retryQueue,a===null?r.retryQueue=new Set([l]):a.add(l)),Sh(t,l,f)),!1}throw Error(i(435,a.tag))}return Sh(t,l,f),Bl(),!1}if(Ge)return r=pn.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=f,l!==gf&&(t=Error(i(422),{cause:l}),ka(Rn(t,a)))):(l!==gf&&(r=Error(i(423),{cause:l}),ka(Rn(r,a))),t=t.current.alternate,t.flags|=65536,f&=-f,t.lanes|=f,l=Rn(l,a),f=Wf(t.stateNode,l,f),kf(t,f),xt!==4&&(xt=2)),!1;var y=Error(i(520),{cause:l});if(y=Rn(y,a),Ya===null?Ya=[y]:Ya.push(y),xt!==4&&(xt=2),r===null)return!0;l=Rn(l,a),a=r;do{switch(a.tag){case 3:return a.flags|=65536,t=f&-f,a.lanes|=t,t=Wf(a.stateNode,l,t),kf(a,t),!1;case 1:if(r=a.type,y=a.stateNode,(a.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(is===null||!is.has(y))))return a.flags|=65536,f&=-f,a.lanes|=f,f=Vp(f),Yp(f,t,a,l),kf(a,f),!1}a=a.return}while(a!==null);return!1}var Zf=Error(i(461)),Nt=!1;function Ht(t,r,a,l){r.child=t===null?X0(r,null,a,l):Ys(r,t.child,a,l)}function Kp(t,r,a,l,f){a=a.render;var y=r.ref;if("ref"in l){var w={};for(var O in l)O!=="ref"&&(w[O]=l[O])}else w=l;return Hs(r),l=Df(t,r,a,w,y,f),O=Lf(),t!==null&&!Nt?(qf(t,r,f),Er(t,r,f)):(Ge&&O&&pf(r),r.flags|=1,Ht(t,r,l,f),r.child)}function Jp(t,r,a,l,f){if(t===null){var y=a.type;return typeof y=="function"&&!hf(y)&&y.defaultProps===void 0&&a.compare===null?(r.tag=15,r.type=y,Qp(t,r,y,l,f)):(t=ol(a.type,null,l,r,r.mode,f),t.ref=r.ref,t.return=r,r.child=t)}if(y=t.child,!oh(t,f)){var w=y.memoizedProps;if(a=a.compare,a=a!==null?a:Oa,a(w,l)&&t.ref===r.ref)return Er(t,r,f)}return r.flags|=1,t=br(y,l),t.ref=r.ref,t.return=r,r.child=t}function Qp(t,r,a,l,f){if(t!==null){var y=t.memoizedProps;if(Oa(y,l)&&t.ref===r.ref)if(Nt=!1,r.pendingProps=l=y,oh(t,f))(t.flags&131072)!==0&&(Nt=!0);else return r.lanes=t.lanes,Er(t,r,f)}return eh(t,r,a,l,f)}function Xp(t,r,a,l){var f=l.children,y=t!==null?t.memoizedState:null;if(t===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((r.flags&128)!==0){if(y=y!==null?y.baseLanes|a:a,t!==null){for(l=r.child=t.child,f=0;l!==null;)f=f|l.lanes|l.childLanes,l=l.sibling;l=f&~y}else l=0,r.child=null;return Wp(t,r,y,a,l)}if((a&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},t!==null&&fl(r,y!==null?y.cachePool:null),y!==null?ep(r,y):Tf(),tp(r);else return l=r.lanes=536870912,Wp(t,r,y!==null?y.baseLanes|a:a,a,l)}else y!==null?(fl(r,y.cachePool),ep(r,y),ts(),r.memoizedState=null):(t!==null&&fl(r,null),Tf(),ts());return Ht(t,r,f,a),r.child}function za(t,r){return t!==null&&t.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function Wp(t,r,a,l,f){var y=Ef();return y=y===null?null:{parent:jt._currentValue,pool:y},r.memoizedState={baseLanes:a,cachePool:y},t!==null&&fl(r,null),Tf(),tp(r),t!==null&&wi(t,r,l,!0),r.childLanes=f,null}function jl(t,r){return r=Nl({mode:r.mode,children:r.children},t.mode),r.ref=t.ref,t.child=r,r.return=t,r}function Zp(t,r,a){return Ys(r,t.child,null,a),t=jl(r,r.pendingProps),t.flags|=2,yn(r),r.memoizedState=null,t}function hw(t,r,a){var l=r.pendingProps,f=(r.flags&128)!==0;if(r.flags&=-129,t===null){if(Ge){if(l.mode==="hidden")return t=jl(r,l),r.lanes=536870912,za(null,t);if(Mf(r),(t=lt)?(t=fg(t,qn),t=t!==null&&t.data==="&"?t:null,t!==null&&(r.memoizedState={dehydrated:t,treeContext:Yr!==null?{id:nr,overflow:rr}:null,retryLane:536870912,hydrationErrors:null},a=q0(t),a.return=r,r.child=a,$t=r,lt=null)):t=null,t===null)throw Jr(r);return r.lanes=536870912,null}return jl(r,l)}var y=t.memoizedState;if(y!==null){var w=y.dehydrated;if(Mf(r),f)if(r.flags&256)r.flags&=-257,r=Zp(t,r,a);else if(r.memoizedState!==null)r.child=t.child,r.flags|=128,r=null;else throw Error(i(558));else if(Nt||wi(t,r,a,!1),f=(a&t.childLanes)!==0,Nt||f){if(l=at,l!==null&&(w=Gr(l,a),w!==0&&w!==y.retryLane))throw y.retryLane=w,Us(t,w),cn(l,t,w),Zf;Bl(),r=Zp(t,r,a)}else t=y.treeContext,lt=Bn(w.nextSibling),$t=r,Ge=!0,Kr=null,qn=!1,t!==null&&U0(r,t),r=jl(r,l),r.flags|=4096;return r}return t=br(t.child,{mode:l.mode,children:l.children}),t.ref=r.ref,r.child=t,t.return=r,t}function kl(t,r){var a=r.ref;if(a===null)t!==null&&t.ref!==null&&(r.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(i(284));(t===null||t.ref!==a)&&(r.flags|=4194816)}}function eh(t,r,a,l,f){return Hs(r),a=Df(t,r,a,l,void 0,f),l=Lf(),t!==null&&!Nt?(qf(t,r,f),Er(t,r,f)):(Ge&&l&&pf(r),r.flags|=1,Ht(t,r,a,f),r.child)}function ey(t,r,a,l,f,y){return Hs(r),r.updateQueue=null,a=rp(r,l,a,f),np(t),l=Lf(),t!==null&&!Nt?(qf(t,r,y),Er(t,r,y)):(Ge&&l&&pf(r),r.flags|=1,Ht(t,r,a,y),r.child)}function ty(t,r,a,l,f){if(Hs(r),r.stateNode===null){var y=bi,w=a.contextType;typeof w=="object"&&w!==null&&(y=It(w)),y=new a(l,y),r.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=Xf,r.stateNode=y,y._reactInternals=r,y=r.stateNode,y.props=l,y.state=r.memoizedState,y.refs={},Af(r),w=a.contextType,y.context=typeof w=="object"&&w!==null?It(w):bi,y.state=r.memoizedState,w=a.getDerivedStateFromProps,typeof w=="function"&&(Qf(r,a,w,l),y.state=r.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(w=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),w!==y.state&&Xf.enqueueReplaceState(y,y.state,null),La(r,l,y,f),Da(),y.state=r.memoizedState),typeof y.componentDidMount=="function"&&(r.flags|=4194308),l=!0}else if(t===null){y=r.stateNode;var O=r.memoizedProps,R=Js(a,O);y.props=R;var V=y.context,Z=a.contextType;w=bi,typeof Z=="object"&&Z!==null&&(w=It(Z));var ie=a.getDerivedStateFromProps;Z=typeof ie=="function"||typeof y.getSnapshotBeforeUpdate=="function",O=r.pendingProps!==O,Z||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(O||V!==w)&&$p(r,y,l,w),Xr=!1;var Y=r.memoizedState;y.state=Y,La(r,l,y,f),Da(),V=r.memoizedState,O||Y!==V||Xr?(typeof ie=="function"&&(Qf(r,a,ie,l),V=r.memoizedState),(R=Xr||zp(r,a,R,l,Y,V,w))?(Z||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(r.flags|=4194308)):(typeof y.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=l,r.memoizedState=V),y.props=l,y.state=V,y.context=w,l=R):(typeof y.componentDidMount=="function"&&(r.flags|=4194308),l=!1)}else{y=r.stateNode,jf(t,r),w=r.memoizedProps,Z=Js(a,w),y.props=Z,ie=r.pendingProps,Y=y.context,V=a.contextType,R=bi,typeof V=="object"&&V!==null&&(R=It(V)),O=a.getDerivedStateFromProps,(V=typeof O=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(w!==ie||Y!==R)&&$p(r,y,l,R),Xr=!1,Y=r.memoizedState,y.state=Y,La(r,l,y,f),Da();var X=r.memoizedState;w!==ie||Y!==X||Xr||t!==null&&t.dependencies!==null&&cl(t.dependencies)?(typeof O=="function"&&(Qf(r,a,O,l),X=r.memoizedState),(Z=Xr||zp(r,a,Z,l,Y,X,R)||t!==null&&t.dependencies!==null&&cl(t.dependencies))?(V||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(l,X,R),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(l,X,R)),typeof y.componentDidUpdate=="function"&&(r.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof y.componentDidUpdate!="function"||w===t.memoizedProps&&Y===t.memoizedState||(r.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||w===t.memoizedProps&&Y===t.memoizedState||(r.flags|=1024),r.memoizedProps=l,r.memoizedState=X),y.props=l,y.state=X,y.context=R,l=Z):(typeof y.componentDidUpdate!="function"||w===t.memoizedProps&&Y===t.memoizedState||(r.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||w===t.memoizedProps&&Y===t.memoizedState||(r.flags|=1024),l=!1)}return y=l,kl(t,r),l=(r.flags&128)!==0,y||l?(y=r.stateNode,a=l&&typeof a.getDerivedStateFromError!="function"?null:y.render(),r.flags|=1,t!==null&&l?(r.child=Ys(r,t.child,null,f),r.child=Ys(r,null,a,f)):Ht(t,r,a,f),r.memoizedState=y.state,t=r.child):t=Er(t,r,f),t}function ny(t,r,a,l){return $s(),r.flags|=256,Ht(t,r,a,l),r.child}var th={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function nh(t){return{baseLanes:t,cachePool:G0()}}function rh(t,r,a){return t=t!==null?t.childLanes&~a:0,r&&(t|=bn),t}function ry(t,r,a){var l=r.pendingProps,f=!1,y=(r.flags&128)!==0,w;if((w=y)||(w=t!==null&&t.memoizedState===null?!1:(wt.current&2)!==0),w&&(f=!0,r.flags&=-129),w=(r.flags&32)!==0,r.flags&=-33,t===null){if(Ge){if(f?es(r):ts(),(t=lt)?(t=fg(t,qn),t=t!==null&&t.data!=="&"?t:null,t!==null&&(r.memoizedState={dehydrated:t,treeContext:Yr!==null?{id:nr,overflow:rr}:null,retryLane:536870912,hydrationErrors:null},a=q0(t),a.return=r,r.child=a,$t=r,lt=null)):t=null,t===null)throw Jr(r);return Uh(t)?r.lanes=32:r.lanes=536870912,null}var O=l.children;return l=l.fallback,f?(ts(),f=r.mode,O=Nl({mode:"hidden",children:O},f),l=zs(l,f,a,null),O.return=r,l.return=r,O.sibling=l,r.child=O,l=r.child,l.memoizedState=nh(a),l.childLanes=rh(t,w,a),r.memoizedState=th,za(null,l)):(es(r),sh(r,O))}var R=t.memoizedState;if(R!==null&&(O=R.dehydrated,O!==null)){if(y)r.flags&256?(es(r),r.flags&=-257,r=ih(t,r,a)):r.memoizedState!==null?(ts(),r.child=t.child,r.flags|=128,r=null):(ts(),O=l.fallback,f=r.mode,l=Nl({mode:"visible",children:l.children},f),O=zs(O,f,a,null),O.flags|=2,l.return=r,O.return=r,l.sibling=O,r.child=l,Ys(r,t.child,null,a),l=r.child,l.memoizedState=nh(a),l.childLanes=rh(t,w,a),r.memoizedState=th,r=za(null,l));else if(es(r),Uh(O)){if(w=O.nextSibling&&O.nextSibling.dataset,w)var V=w.dgst;w=V,l=Error(i(419)),l.stack="",l.digest=w,ka({value:l,source:null,stack:null}),r=ih(t,r,a)}else if(Nt||wi(t,r,a,!1),w=(a&t.childLanes)!==0,Nt||w){if(w=at,w!==null&&(l=Gr(w,a),l!==0&&l!==R.retryLane))throw R.retryLane=l,Us(t,l),cn(w,t,l),Zf;Bh(O)||Bl(),r=ih(t,r,a)}else Bh(O)?(r.flags|=192,r.child=t.child,r=null):(t=R.treeContext,lt=Bn(O.nextSibling),$t=r,Ge=!0,Kr=null,qn=!1,t!==null&&U0(r,t),r=sh(r,l.children),r.flags|=4096);return r}return f?(ts(),O=l.fallback,f=r.mode,R=t.child,V=R.sibling,l=br(R,{mode:"hidden",children:l.children}),l.subtreeFlags=R.subtreeFlags&65011712,V!==null?O=br(V,O):(O=zs(O,f,a,null),O.flags|=2),O.return=r,l.return=r,l.sibling=O,r.child=l,za(null,l),l=r.child,O=t.child.memoizedState,O===null?O=nh(a):(f=O.cachePool,f!==null?(R=jt._currentValue,f=f.parent!==R?{parent:R,pool:R}:f):f=G0(),O={baseLanes:O.baseLanes|a,cachePool:f}),l.memoizedState=O,l.childLanes=rh(t,w,a),r.memoizedState=th,za(t.child,l)):(es(r),a=t.child,t=a.sibling,a=br(a,{mode:"visible",children:l.children}),a.return=r,a.sibling=null,t!==null&&(w=r.deletions,w===null?(r.deletions=[t],r.flags|=16):w.push(t)),r.child=a,r.memoizedState=null,a)}function sh(t,r){return r=Nl({mode:"visible",children:r},t.mode),r.return=t,t.child=r}function Nl(t,r){return t=mn(22,t,null,r),t.lanes=0,t}function ih(t,r,a){return Ys(r,t.child,null,a),t=sh(r,r.pendingProps.children),t.flags|=2,r.memoizedState=null,t}function sy(t,r,a){t.lanes|=r;var l=t.alternate;l!==null&&(l.lanes|=r),vf(t.return,r,a)}function ah(t,r,a,l,f,y){var w=t.memoizedState;w===null?t.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:f,treeForkCount:y}:(w.isBackwards=r,w.rendering=null,w.renderingStartTime=0,w.last=l,w.tail=a,w.tailMode=f,w.treeForkCount=y)}function iy(t,r,a){var l=r.pendingProps,f=l.revealOrder,y=l.tail;l=l.children;var w=wt.current,O=(w&2)!==0;if(O?(w=w&1|2,r.flags|=128):w&=1,Me(wt,w),Ht(t,r,l,a),l=Ge?ja:0,!O&&t!==null&&(t.flags&128)!==0)e:for(t=r.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&sy(t,a,r);else if(t.tag===19)sy(t,a,r);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===r)break e;for(;t.sibling===null;){if(t.return===null||t.return===r)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(f){case"forwards":for(a=r.child,f=null;a!==null;)t=a.alternate,t!==null&&gl(t)===null&&(f=a),a=a.sibling;a=f,a===null?(f=r.child,r.child=null):(f=a.sibling,a.sibling=null),ah(r,!1,f,a,y,l);break;case"backwards":case"unstable_legacy-backwards":for(a=null,f=r.child,r.child=null;f!==null;){if(t=f.alternate,t!==null&&gl(t)===null){r.child=f;break}t=f.sibling,f.sibling=a,a=f,f=t}ah(r,!0,a,null,y,l);break;case"together":ah(r,!1,null,null,void 0,l);break;default:r.memoizedState=null}return r.child}function Er(t,r,a){if(t!==null&&(r.dependencies=t.dependencies),ss|=r.lanes,(a&r.childLanes)===0)if(t!==null){if(wi(t,r,a,!1),(a&r.childLanes)===0)return null}else return null;if(t!==null&&r.child!==t.child)throw Error(i(153));if(r.child!==null){for(t=r.child,a=br(t,t.pendingProps),r.child=a,a.return=r;t.sibling!==null;)t=t.sibling,a=a.sibling=br(t,t.pendingProps),a.return=r;a.sibling=null}return r.child}function oh(t,r){return(t.lanes&r)!==0?!0:(t=t.dependencies,!!(t!==null&&cl(t)))}function dw(t,r,a){switch(r.tag){case 3:_e(r,r.stateNode.containerInfo),Qr(r,jt,t.memoizedState.cache),$s();break;case 27:case 5:Be(r);break;case 4:_e(r,r.stateNode.containerInfo);break;case 10:Qr(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,Mf(r),null;break;case 13:var l=r.memoizedState;if(l!==null)return l.dehydrated!==null?(es(r),r.flags|=128,null):(a&r.child.childLanes)!==0?ry(t,r,a):(es(r),t=Er(t,r,a),t!==null?t.sibling:null);es(r);break;case 19:var f=(t.flags&128)!==0;if(l=(a&r.childLanes)!==0,l||(wi(t,r,a,!1),l=(a&r.childLanes)!==0),f){if(l)return iy(t,r,a);r.flags|=128}if(f=r.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),Me(wt,wt.current),l)break;return null;case 22:return r.lanes=0,Xp(t,r,a,r.pendingProps);case 24:Qr(r,jt,t.memoizedState.cache)}return Er(t,r,a)}function ay(t,r,a){if(t!==null)if(t.memoizedProps!==r.pendingProps)Nt=!0;else{if(!oh(t,a)&&(r.flags&128)===0)return Nt=!1,dw(t,r,a);Nt=(t.flags&131072)!==0}else Nt=!1,Ge&&(r.flags&1048576)!==0&&B0(r,ja,r.index);switch(r.lanes=0,r.tag){case 16:e:{var l=r.pendingProps;if(t=Gs(r.elementType),r.type=t,typeof t=="function")hf(t)?(l=Js(t,l),r.tag=1,r=ty(null,r,t,l,a)):(r.tag=0,r=eh(null,r,t,l,a));else{if(t!=null){var f=t.$$typeof;if(f===te){r.tag=11,r=Kp(null,r,t,l,a);break e}else if(f===ae){r.tag=14,r=Jp(null,r,t,l,a);break e}}throw r=Ee(t)||t,Error(i(306,r,""))}}return r;case 0:return eh(t,r,r.type,r.pendingProps,a);case 1:return l=r.type,f=Js(l,r.pendingProps),ty(t,r,l,f,a);case 3:e:{if(_e(r,r.stateNode.containerInfo),t===null)throw Error(i(387));l=r.pendingProps;var y=r.memoizedState;f=y.element,jf(t,r),La(r,l,null,a);var w=r.memoizedState;if(l=w.cache,Qr(r,jt,l),l!==y.cache&&_f(r,[jt],a,!0),Da(),l=w.element,y.isDehydrated)if(y={element:l,isDehydrated:!1,cache:w.cache},r.updateQueue.baseState=y,r.memoizedState=y,r.flags&256){r=ny(t,r,l,a);break e}else if(l!==f){f=Rn(Error(i(424)),r),ka(f),r=ny(t,r,l,a);break e}else{switch(t=r.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(lt=Bn(t.firstChild),$t=r,Ge=!0,Kr=null,qn=!0,a=X0(r,null,l,a),r.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if($s(),l===f){r=Er(t,r,a);break e}Ht(t,r,l,a)}r=r.child}return r;case 26:return kl(t,r),t===null?(a=gg(r.type,null,r.pendingProps,null))?r.memoizedState=a:Ge||(a=r.type,t=r.pendingProps,l=Gl(Ot.current).createElement(a),l[it]=r,l[gt]=t,Ft(l,a,t),L(l),r.stateNode=l):r.memoizedState=gg(r.type,t.memoizedProps,r.pendingProps,t.memoizedState),null;case 27:return Be(r),t===null&&Ge&&(l=r.stateNode=mg(r.type,r.pendingProps,Ot.current),$t=r,qn=!0,f=lt,cs(r.type)?(zh=f,lt=Bn(l.firstChild)):lt=f),Ht(t,r,r.pendingProps.children,a),kl(t,r),t===null&&(r.flags|=4194304),r.child;case 5:return t===null&&Ge&&((f=l=lt)&&(l=Hw(l,r.type,r.pendingProps,qn),l!==null?(r.stateNode=l,$t=r,lt=Bn(l.firstChild),qn=!1,f=!0):f=!1),f||Jr(r)),Be(r),f=r.type,y=r.pendingProps,w=t!==null?t.memoizedProps:null,l=y.children,Lh(f,y)?l=null:w!==null&&Lh(f,w)&&(r.flags|=32),r.memoizedState!==null&&(f=Df(t,r,sw,null,null,a),to._currentValue=f),kl(t,r),Ht(t,r,l,a),r.child;case 6:return t===null&&Ge&&((t=a=lt)&&(a=Fw(a,r.pendingProps,qn),a!==null?(r.stateNode=a,$t=r,lt=null,t=!0):t=!1),t||Jr(r)),null;case 13:return ry(t,r,a);case 4:return _e(r,r.stateNode.containerInfo),l=r.pendingProps,t===null?r.child=Ys(r,null,l,a):Ht(t,r,l,a),r.child;case 11:return Kp(t,r,r.type,r.pendingProps,a);case 7:return Ht(t,r,r.pendingProps,a),r.child;case 8:return Ht(t,r,r.pendingProps.children,a),r.child;case 12:return Ht(t,r,r.pendingProps.children,a),r.child;case 10:return l=r.pendingProps,Qr(r,r.type,l.value),Ht(t,r,l.children,a),r.child;case 9:return f=r.type._context,l=r.pendingProps.children,Hs(r),f=It(f),l=l(f),r.flags|=1,Ht(t,r,l,a),r.child;case 14:return Jp(t,r,r.type,r.pendingProps,a);case 15:return Qp(t,r,r.type,r.pendingProps,a);case 19:return iy(t,r,a);case 31:return hw(t,r,a);case 22:return Xp(t,r,a,r.pendingProps);case 24:return Hs(r),l=It(jt),t===null?(f=Ef(),f===null&&(f=at,y=wf(),f.pooledCache=y,y.refCount++,y!==null&&(f.pooledCacheLanes|=a),f=y),r.memoizedState={parent:l,cache:f},Af(r),Qr(r,jt,f)):((t.lanes&a)!==0&&(jf(t,r),La(r,null,null,a),Da()),f=t.memoizedState,y=r.memoizedState,f.parent!==l?(f={parent:l,cache:l},r.memoizedState=f,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=f),Qr(r,jt,l)):(l=y.cache,Qr(r,jt,l),l!==f.cache&&_f(r,[jt],a,!0))),Ht(t,r,r.pendingProps.children,a),r.child;case 29:throw r.pendingProps}throw Error(i(156,r.tag))}function Or(t){t.flags|=4}function lh(t,r,a,l,f){if((r=(t.mode&32)!==0)&&(r=!1),r){if(t.flags|=16777216,(f&335544128)===f)if(t.stateNode.complete)t.flags|=8192;else if(Ry())t.flags|=8192;else throw Vs=dl,Of}else t.flags&=-16777217}function oy(t,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!wg(r))if(Ry())t.flags|=8192;else throw Vs=dl,Of}function Tl(t,r){r!==null&&(t.flags|=4),t.flags&16384&&(r=t.tag!==22?li():536870912,t.lanes|=r,Di|=r)}function $a(t,r){if(!Ge)switch(t.tailMode){case"hidden":r=t.tail;for(var a=null;r!==null;)r.alternate!==null&&(a=r),r=r.sibling;a===null?t.tail=null:a.sibling=null;break;case"collapsed":a=t.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?r||t.tail===null?t.tail=null:t.tail.sibling=null:l.sibling=null}}function ct(t){var r=t.alternate!==null&&t.alternate.child===t.child,a=0,l=0;if(r)for(var f=t.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags&65011712,l|=f.flags&65011712,f.return=t,f=f.sibling;else for(f=t.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags,l|=f.flags,f.return=t,f=f.sibling;return t.subtreeFlags|=l,t.childLanes=a,r}function mw(t,r,a){var l=r.pendingProps;switch(yf(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ct(r),null;case 1:return ct(r),null;case 3:return a=r.stateNode,l=null,t!==null&&(l=t.memoizedState.cache),r.memoizedState.cache!==l&&(r.flags|=2048),_r(jt),oe(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(t===null||t.child===null)&&(_i(r)?Or(r):t===null||t.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,bf())),ct(r),null;case 26:var f=r.type,y=r.memoizedState;return t===null?(Or(r),y!==null?(ct(r),oy(r,y)):(ct(r),lh(r,f,null,l,a))):y?y!==t.memoizedState?(Or(r),ct(r),oy(r,y)):(ct(r),r.flags&=-16777217):(t=t.memoizedProps,t!==l&&Or(r),ct(r),lh(r,f,t,l,a)),null;case 27:if(zt(r),a=Ot.current,f=r.type,t!==null&&r.stateNode!=null)t.memoizedProps!==l&&Or(r);else{if(!l){if(r.stateNode===null)throw Error(i(166));return ct(r),null}t=Xe.current,_i(r)?z0(r):(t=mg(f,l,a),r.stateNode=t,Or(r))}return ct(r),null;case 5:if(zt(r),f=r.type,t!==null&&r.stateNode!=null)t.memoizedProps!==l&&Or(r);else{if(!l){if(r.stateNode===null)throw Error(i(166));return ct(r),null}if(y=Xe.current,_i(r))z0(r);else{var w=Gl(Ot.current);switch(y){case 1:y=w.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:y=w.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":y=w.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":y=w.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":y=w.createElement("div"),y.innerHTML="<script><\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof l.is=="string"?w.createElement("select",{is:l.is}):w.createElement("select"),l.multiple?y.multiple=!0:l.size&&(y.size=l.size);break;default:y=typeof l.is=="string"?w.createElement(f,{is:l.is}):w.createElement(f)}}y[it]=r,y[gt]=l;e:for(w=r.child;w!==null;){if(w.tag===5||w.tag===6)y.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===r)break e;for(;w.sibling===null;){if(w.return===null||w.return===r)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}r.stateNode=y;e:switch(Ft(y,f,l),f){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Or(r)}}return ct(r),lh(r,r.type,t===null?null:t.memoizedProps,r.pendingProps,a),null;case 6:if(t&&r.stateNode!=null)t.memoizedProps!==l&&Or(r);else{if(typeof l!="string"&&r.stateNode===null)throw Error(i(166));if(t=Ot.current,_i(r)){if(t=r.stateNode,a=r.memoizedProps,l=null,f=$t,f!==null)switch(f.tag){case 27:case 5:l=f.memoizedProps}t[it]=r,t=!!(t.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||rg(t.nodeValue,a)),t||Jr(r,!0)}else t=Gl(t).createTextNode(l),t[it]=r,r.stateNode=t}return ct(r),null;case 31:if(a=r.memoizedState,t===null||t.memoizedState!==null){if(l=_i(r),a!==null){if(t===null){if(!l)throw Error(i(318));if(t=r.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(557));t[it]=r}else $s(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;ct(r),t=!1}else a=bf(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),t=!0;if(!t)return r.flags&256?(yn(r),r):(yn(r),null);if((r.flags&128)!==0)throw Error(i(558))}return ct(r),null;case 13:if(l=r.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(f=_i(r),l!==null&&l.dehydrated!==null){if(t===null){if(!f)throw Error(i(318));if(f=r.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(i(317));f[it]=r}else $s(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;ct(r),f=!1}else f=bf(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=f),f=!0;if(!f)return r.flags&256?(yn(r),r):(yn(r),null)}return yn(r),(r.flags&128)!==0?(r.lanes=a,r):(a=l!==null,t=t!==null&&t.memoizedState!==null,a&&(l=r.child,f=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(f=l.alternate.memoizedState.cachePool.pool),y=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(y=l.memoizedState.cachePool.pool),y!==f&&(l.flags|=2048)),a!==t&&a&&(r.child.flags|=8192),Tl(r,r.updateQueue),ct(r),null);case 4:return oe(),t===null&&Th(r.stateNode.containerInfo),ct(r),null;case 10:return _r(r.type),ct(r),null;case 19:if(Ne(wt),l=r.memoizedState,l===null)return ct(r),null;if(f=(r.flags&128)!==0,y=l.rendering,y===null)if(f)$a(l,!1);else{if(xt!==0||t!==null&&(t.flags&128)!==0)for(t=r.child;t!==null;){if(y=gl(t),y!==null){for(r.flags|=128,$a(l,!1),t=y.updateQueue,r.updateQueue=t,Tl(r,t),r.subtreeFlags=0,t=a,a=r.child;a!==null;)L0(a,t),a=a.sibling;return Me(wt,wt.current&1|2),Ge&&xr(r,l.treeForkCount),r.child}t=t.sibling}l.tail!==null&&ut()>Ll&&(r.flags|=128,f=!0,$a(l,!1),r.lanes=4194304)}else{if(!f)if(t=gl(y),t!==null){if(r.flags|=128,f=!0,t=t.updateQueue,r.updateQueue=t,Tl(r,t),$a(l,!0),l.tail===null&&l.tailMode==="hidden"&&!y.alternate&&!Ge)return ct(r),null}else 2*ut()-l.renderingStartTime>Ll&&a!==536870912&&(r.flags|=128,f=!0,$a(l,!1),r.lanes=4194304);l.isBackwards?(y.sibling=r.child,r.child=y):(t=l.last,t!==null?t.sibling=y:r.child=y,l.last=y)}return l.tail!==null?(t=l.tail,l.rendering=t,l.tail=t.sibling,l.renderingStartTime=ut(),t.sibling=null,a=wt.current,Me(wt,f?a&1|2:a&1),Ge&&xr(r,l.treeForkCount),t):(ct(r),null);case 22:case 23:return yn(r),Cf(),l=r.memoizedState!==null,t!==null?t.memoizedState!==null!==l&&(r.flags|=8192):l&&(r.flags|=8192),l?(a&536870912)!==0&&(r.flags&128)===0&&(ct(r),r.subtreeFlags&6&&(r.flags|=8192)):ct(r),a=r.updateQueue,a!==null&&Tl(r,a.retryQueue),a=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),l=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(l=r.memoizedState.cachePool.pool),l!==a&&(r.flags|=2048),t!==null&&Ne(Fs),null;case 24:return a=null,t!==null&&(a=t.memoizedState.cache),r.memoizedState.cache!==a&&(r.flags|=2048),_r(jt),ct(r),null;case 25:return null;case 30:return null}throw Error(i(156,r.tag))}function pw(t,r){switch(yf(r),r.tag){case 1:return t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 3:return _r(jt),oe(),t=r.flags,(t&65536)!==0&&(t&128)===0?(r.flags=t&-65537|128,r):null;case 26:case 27:case 5:return zt(r),null;case 31:if(r.memoizedState!==null){if(yn(r),r.alternate===null)throw Error(i(340));$s()}return t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 13:if(yn(r),t=r.memoizedState,t!==null&&t.dehydrated!==null){if(r.alternate===null)throw Error(i(340));$s()}return t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 19:return Ne(wt),null;case 4:return oe(),null;case 10:return _r(r.type),null;case 22:case 23:return yn(r),Cf(),t!==null&&Ne(Fs),t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 24:return _r(jt),null;case 25:return null;default:return null}}function ly(t,r){switch(yf(r),r.tag){case 3:_r(jt),oe();break;case 26:case 27:case 5:zt(r);break;case 4:oe();break;case 31:r.memoizedState!==null&&yn(r);break;case 13:yn(r);break;case 19:Ne(wt);break;case 10:_r(r.type);break;case 22:case 23:yn(r),Cf(),t!==null&&Ne(Fs);break;case 24:_r(jt)}}function Ia(t,r){try{var a=r.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var f=l.next;a=f;do{if((a.tag&t)===t){l=void 0;var y=a.create,w=a.inst;l=y(),w.destroy=l}a=a.next}while(a!==f)}}catch(O){Ze(r,r.return,O)}}function ns(t,r,a){try{var l=r.updateQueue,f=l!==null?l.lastEffect:null;if(f!==null){var y=f.next;l=y;do{if((l.tag&t)===t){var w=l.inst,O=w.destroy;if(O!==void 0){w.destroy=void 0,f=r;var R=a,V=O;try{V()}catch(Z){Ze(f,R,Z)}}}l=l.next}while(l!==y)}}catch(Z){Ze(r,r.return,Z)}}function cy(t){var r=t.updateQueue;if(r!==null){var a=t.stateNode;try{Z0(r,a)}catch(l){Ze(t,t.return,l)}}}function uy(t,r,a){a.props=Js(t.type,t.memoizedProps),a.state=t.memoizedState;try{a.componentWillUnmount()}catch(l){Ze(t,r,l)}}function Ha(t,r){try{var a=t.ref;if(a!==null){switch(t.tag){case 26:case 27:case 5:var l=t.stateNode;break;case 30:l=t.stateNode;break;default:l=t.stateNode}typeof a=="function"?t.refCleanup=a(l):a.current=l}}catch(f){Ze(t,r,f)}}function sr(t,r){var a=t.ref,l=t.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(f){Ze(t,r,f)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(f){Ze(t,r,f)}else a.current=null}function fy(t){var r=t.type,a=t.memoizedProps,l=t.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":a.autoFocus&&l.focus();break e;case"img":a.src?l.src=a.src:a.srcSet&&(l.srcset=a.srcSet)}}catch(f){Ze(t,t.return,f)}}function ch(t,r,a){try{var l=t.stateNode;Pw(l,t.type,a,r),l[gt]=r}catch(f){Ze(t,t.return,f)}}function hy(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&cs(t.type)||t.tag===4}function uh(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||hy(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&cs(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function fh(t,r,a){var l=t.tag;if(l===5||l===6)t=t.stateNode,r?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(t,r):(r=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,r.appendChild(t),a=a._reactRootContainer,a!=null||r.onclick!==null||(r.onclick=yr));else if(l!==4&&(l===27&&cs(t.type)&&(a=t.stateNode,r=null),t=t.child,t!==null))for(fh(t,r,a),t=t.sibling;t!==null;)fh(t,r,a),t=t.sibling}function Cl(t,r,a){var l=t.tag;if(l===5||l===6)t=t.stateNode,r?a.insertBefore(t,r):a.appendChild(t);else if(l!==4&&(l===27&&cs(t.type)&&(a=t.stateNode),t=t.child,t!==null))for(Cl(t,r,a),t=t.sibling;t!==null;)Cl(t,r,a),t=t.sibling}function dy(t){var r=t.stateNode,a=t.memoizedProps;try{for(var l=t.type,f=r.attributes;f.length;)r.removeAttributeNode(f[0]);Ft(r,l,a),r[it]=t,r[gt]=a}catch(y){Ze(t,t.return,y)}}var Ar=!1,Tt=!1,hh=!1,my=typeof WeakSet=="function"?WeakSet:Set,Pt=null;function yw(t,r){if(t=t.containerInfo,Rh=Wl,t=A0(t),sf(t)){if("selectionStart"in t)var a={start:t.selectionStart,end:t.selectionEnd};else e:{a=(a=t.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var f=l.anchorOffset,y=l.focusNode;l=l.focusOffset;try{a.nodeType,y.nodeType}catch{a=null;break e}var w=0,O=-1,R=-1,V=0,Z=0,ie=t,Y=null;t:for(;;){for(var X;ie!==a||f!==0&&ie.nodeType!==3||(O=w+f),ie!==y||l!==0&&ie.nodeType!==3||(R=w+l),ie.nodeType===3&&(w+=ie.nodeValue.length),(X=ie.firstChild)!==null;)Y=ie,ie=X;for(;;){if(ie===t)break t;if(Y===a&&++V===f&&(O=w),Y===y&&++Z===l&&(R=w),(X=ie.nextSibling)!==null)break;ie=Y,Y=ie.parentNode}ie=X}a=O===-1||R===-1?null:{start:O,end:R}}else a=null}a=a||{start:0,end:0}}else a=null;for(Dh={focusedElem:t,selectionRange:a},Wl=!1,Pt=r;Pt!==null;)if(r=Pt,t=r.child,(r.subtreeFlags&1028)!==0&&t!==null)t.return=r,Pt=t;else for(;Pt!==null;){switch(r=Pt,y=r.alternate,t=r.flags,r.tag){case 0:if((t&4)!==0&&(t=r.updateQueue,t=t!==null?t.events:null,t!==null))for(a=0;a<t.length;a++)f=t[a],f.ref.impl=f.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&y!==null){t=void 0,a=r,f=y.memoizedProps,y=y.memoizedState,l=a.stateNode;try{var ve=Js(a.type,f);t=l.getSnapshotBeforeUpdate(ve,y),l.__reactInternalSnapshotBeforeUpdate=t}catch(Te){Ze(a,a.return,Te)}}break;case 3:if((t&1024)!==0){if(t=r.stateNode.containerInfo,a=t.nodeType,a===9)Ph(t);else if(a===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":Ph(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(i(163))}if(t=r.sibling,t!==null){t.return=r.return,Pt=t;break}Pt=r.return}}function py(t,r,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:kr(t,a),l&4&&Ia(5,a);break;case 1:if(kr(t,a),l&4)if(t=a.stateNode,r===null)try{t.componentDidMount()}catch(w){Ze(a,a.return,w)}else{var f=Js(a.type,r.memoizedProps);r=r.memoizedState;try{t.componentDidUpdate(f,r,t.__reactInternalSnapshotBeforeUpdate)}catch(w){Ze(a,a.return,w)}}l&64&&cy(a),l&512&&Ha(a,a.return);break;case 3:if(kr(t,a),l&64&&(t=a.updateQueue,t!==null)){if(r=null,a.child!==null)switch(a.child.tag){case 27:case 5:r=a.child.stateNode;break;case 1:r=a.child.stateNode}try{Z0(t,r)}catch(w){Ze(a,a.return,w)}}break;case 27:r===null&&l&4&&dy(a);case 26:case 5:kr(t,a),r===null&&l&4&&fy(a),l&512&&Ha(a,a.return);break;case 12:kr(t,a);break;case 31:kr(t,a),l&4&&by(t,a);break;case 13:kr(t,a),l&4&&xy(t,a),l&64&&(t=a.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(a=Ow.bind(null,a),Gw(t,a))));break;case 22:if(l=a.memoizedState!==null||Ar,!l){r=r!==null&&r.memoizedState!==null||Tt,f=Ar;var y=Tt;Ar=l,(Tt=r)&&!y?Nr(t,a,(a.subtreeFlags&8772)!==0):kr(t,a),Ar=f,Tt=y}break;case 30:break;default:kr(t,a)}}function yy(t){var r=t.alternate;r!==null&&(t.alternate=null,yy(r)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(r=t.stateNode,r!==null&&ci(r)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var ft=null,sn=!1;function jr(t,r,a){for(a=a.child;a!==null;)gy(t,r,a),a=a.sibling}function gy(t,r,a){if(_t&&typeof _t.onCommitFiberUnmount=="function")try{_t.onCommitFiberUnmount(Ts,a)}catch{}switch(a.tag){case 26:Tt||sr(a,r),jr(t,r,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Tt||sr(a,r);var l=ft,f=sn;cs(a.type)&&(ft=a.stateNode,sn=!1),jr(t,r,a),Wa(a.stateNode),ft=l,sn=f;break;case 5:Tt||sr(a,r);case 6:if(l=ft,f=sn,ft=null,jr(t,r,a),ft=l,sn=f,ft!==null)if(sn)try{(ft.nodeType===9?ft.body:ft.nodeName==="HTML"?ft.ownerDocument.body:ft).removeChild(a.stateNode)}catch(y){Ze(a,r,y)}else try{ft.removeChild(a.stateNode)}catch(y){Ze(a,r,y)}break;case 18:ft!==null&&(sn?(t=ft,cg(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,a.stateNode),Ii(t)):cg(ft,a.stateNode));break;case 4:l=ft,f=sn,ft=a.stateNode.containerInfo,sn=!0,jr(t,r,a),ft=l,sn=f;break;case 0:case 11:case 14:case 15:ns(2,a,r),Tt||ns(4,a,r),jr(t,r,a);break;case 1:Tt||(sr(a,r),l=a.stateNode,typeof l.componentWillUnmount=="function"&&uy(a,r,l)),jr(t,r,a);break;case 21:jr(t,r,a);break;case 22:Tt=(l=Tt)||a.memoizedState!==null,jr(t,r,a),Tt=l;break;default:jr(t,r,a)}}function by(t,r){if(r.memoizedState===null&&(t=r.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Ii(t)}catch(a){Ze(r,r.return,a)}}}function xy(t,r){if(r.memoizedState===null&&(t=r.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Ii(t)}catch(a){Ze(r,r.return,a)}}function gw(t){switch(t.tag){case 31:case 13:case 19:var r=t.stateNode;return r===null&&(r=t.stateNode=new my),r;case 22:return t=t.stateNode,r=t._retryCache,r===null&&(r=t._retryCache=new my),r;default:throw Error(i(435,t.tag))}}function Ml(t,r){var a=gw(t);r.forEach(function(l){if(!a.has(l)){a.add(l);var f=Aw.bind(null,t,l);l.then(f,f)}})}function an(t,r){var a=r.deletions;if(a!==null)for(var l=0;l<a.length;l++){var f=a[l],y=t,w=r,O=w;e:for(;O!==null;){switch(O.tag){case 27:if(cs(O.type)){ft=O.stateNode,sn=!1;break e}break;case 5:ft=O.stateNode,sn=!1;break e;case 3:case 4:ft=O.stateNode.containerInfo,sn=!0;break e}O=O.return}if(ft===null)throw Error(i(160));gy(y,w,f),ft=null,sn=!1,y=f.alternate,y!==null&&(y.return=null),f.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)vy(r,t),r=r.sibling}var Kn=null;function vy(t,r){var a=t.alternate,l=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:an(r,t),on(t),l&4&&(ns(3,t,t.return),Ia(3,t),ns(5,t,t.return));break;case 1:an(r,t),on(t),l&512&&(Tt||a===null||sr(a,a.return)),l&64&&Ar&&(t=t.updateQueue,t!==null&&(l=t.callbacks,l!==null&&(a=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=a===null?l:a.concat(l))));break;case 26:var f=Kn;if(an(r,t),on(t),l&512&&(Tt||a===null||sr(a,a.return)),l&4){var y=a!==null?a.memoizedState:null;if(l=t.memoizedState,a===null)if(l===null)if(t.stateNode===null){e:{l=t.type,a=t.memoizedProps,f=f.ownerDocument||f;t:switch(l){case"title":y=f.getElementsByTagName("title")[0],(!y||y[Rt]||y[it]||y.namespaceURI==="http://www.w3.org/2000/svg"||y.hasAttribute("itemprop"))&&(y=f.createElement(l),f.head.insertBefore(y,f.querySelector("head > title"))),Ft(y,l,a),y[it]=t,L(y),l=y;break e;case"link":var w=vg("link","href",f).get(l+(a.href||""));if(w){for(var O=0;O<w.length;O++)if(y=w[O],y.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&y.getAttribute("rel")===(a.rel==null?null:a.rel)&&y.getAttribute("title")===(a.title==null?null:a.title)&&y.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){w.splice(O,1);break t}}y=f.createElement(l),Ft(y,l,a),f.head.appendChild(y);break;case"meta":if(w=vg("meta","content",f).get(l+(a.content||""))){for(O=0;O<w.length;O++)if(y=w[O],y.getAttribute("content")===(a.content==null?null:""+a.content)&&y.getAttribute("name")===(a.name==null?null:a.name)&&y.getAttribute("property")===(a.property==null?null:a.property)&&y.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&y.getAttribute("charset")===(a.charSet==null?null:a.charSet)){w.splice(O,1);break t}}y=f.createElement(l),Ft(y,l,a),f.head.appendChild(y);break;default:throw Error(i(468,l))}y[it]=t,L(y),l=y}t.stateNode=l}else _g(f,t.type,t.stateNode);else t.stateNode=xg(f,l,t.memoizedProps);else y!==l?(y===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):y.count--,l===null?_g(f,t.type,t.stateNode):xg(f,l,t.memoizedProps)):l===null&&t.stateNode!==null&&ch(t,t.memoizedProps,a.memoizedProps)}break;case 27:an(r,t),on(t),l&512&&(Tt||a===null||sr(a,a.return)),a!==null&&l&4&&ch(t,t.memoizedProps,a.memoizedProps);break;case 5:if(an(r,t),on(t),l&512&&(Tt||a===null||sr(a,a.return)),t.flags&32){f=t.stateNode;try{fi(f,"")}catch(ve){Ze(t,t.return,ve)}}l&4&&t.stateNode!=null&&(f=t.memoizedProps,ch(t,f,a!==null?a.memoizedProps:f)),l&1024&&(hh=!0);break;case 6:if(an(r,t),on(t),l&4){if(t.stateNode===null)throw Error(i(162));l=t.memoizedProps,a=t.stateNode;try{a.nodeValue=l}catch(ve){Ze(t,t.return,ve)}}break;case 3:if(Kl=null,f=Kn,Kn=Vl(r.containerInfo),an(r,t),Kn=f,on(t),l&4&&a!==null&&a.memoizedState.isDehydrated)try{Ii(r.containerInfo)}catch(ve){Ze(t,t.return,ve)}hh&&(hh=!1,_y(t));break;case 4:l=Kn,Kn=Vl(t.stateNode.containerInfo),an(r,t),on(t),Kn=l;break;case 12:an(r,t),on(t);break;case 31:an(r,t),on(t),l&4&&(l=t.updateQueue,l!==null&&(t.updateQueue=null,Ml(t,l)));break;case 13:an(r,t),on(t),t.child.flags&8192&&t.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Dl=ut()),l&4&&(l=t.updateQueue,l!==null&&(t.updateQueue=null,Ml(t,l)));break;case 22:f=t.memoizedState!==null;var R=a!==null&&a.memoizedState!==null,V=Ar,Z=Tt;if(Ar=V||f,Tt=Z||R,an(r,t),Tt=Z,Ar=V,on(t),l&8192)e:for(r=t.stateNode,r._visibility=f?r._visibility&-2:r._visibility|1,f&&(a===null||R||Ar||Tt||Qs(t)),a=null,r=t;;){if(r.tag===5||r.tag===26){if(a===null){R=a=r;try{if(y=R.stateNode,f)w=y.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{O=R.stateNode;var ie=R.memoizedProps.style,Y=ie!=null&&ie.hasOwnProperty("display")?ie.display:null;O.style.display=Y==null||typeof Y=="boolean"?"":(""+Y).trim()}}catch(ve){Ze(R,R.return,ve)}}}else if(r.tag===6){if(a===null){R=r;try{R.stateNode.nodeValue=f?"":R.memoizedProps}catch(ve){Ze(R,R.return,ve)}}}else if(r.tag===18){if(a===null){R=r;try{var X=R.stateNode;f?ug(X,!0):ug(R.stateNode,!1)}catch(ve){Ze(R,R.return,ve)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===t)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break e;for(;r.sibling===null;){if(r.return===null||r.return===t)break e;a===r&&(a=null),r=r.return}a===r&&(a=null),r.sibling.return=r.return,r=r.sibling}l&4&&(l=t.updateQueue,l!==null&&(a=l.retryQueue,a!==null&&(l.retryQueue=null,Ml(t,a))));break;case 19:an(r,t),on(t),l&4&&(l=t.updateQueue,l!==null&&(t.updateQueue=null,Ml(t,l)));break;case 30:break;case 21:break;default:an(r,t),on(t)}}function on(t){var r=t.flags;if(r&2){try{for(var a,l=t.return;l!==null;){if(hy(l)){a=l;break}l=l.return}if(a==null)throw Error(i(160));switch(a.tag){case 27:var f=a.stateNode,y=uh(t);Cl(t,y,f);break;case 5:var w=a.stateNode;a.flags&32&&(fi(w,""),a.flags&=-33);var O=uh(t);Cl(t,O,w);break;case 3:case 4:var R=a.stateNode.containerInfo,V=uh(t);fh(t,V,R);break;default:throw Error(i(161))}}catch(Z){Ze(t,t.return,Z)}t.flags&=-3}r&4096&&(t.flags&=-4097)}function _y(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var r=t;_y(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),t=t.sibling}}function kr(t,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)py(t,r.alternate,r),r=r.sibling}function Qs(t){for(t=t.child;t!==null;){var r=t;switch(r.tag){case 0:case 11:case 14:case 15:ns(4,r,r.return),Qs(r);break;case 1:sr(r,r.return);var a=r.stateNode;typeof a.componentWillUnmount=="function"&&uy(r,r.return,a),Qs(r);break;case 27:Wa(r.stateNode);case 26:case 5:sr(r,r.return),Qs(r);break;case 22:r.memoizedState===null&&Qs(r);break;case 30:Qs(r);break;default:Qs(r)}t=t.sibling}}function Nr(t,r,a){for(a=a&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var l=r.alternate,f=t,y=r,w=y.flags;switch(y.tag){case 0:case 11:case 15:Nr(f,y,a),Ia(4,y);break;case 1:if(Nr(f,y,a),l=y,f=l.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(V){Ze(l,l.return,V)}if(l=y,f=l.updateQueue,f!==null){var O=l.stateNode;try{var R=f.shared.hiddenCallbacks;if(R!==null)for(f.shared.hiddenCallbacks=null,f=0;f<R.length;f++)W0(R[f],O)}catch(V){Ze(l,l.return,V)}}a&&w&64&&cy(y),Ha(y,y.return);break;case 27:dy(y);case 26:case 5:Nr(f,y,a),a&&l===null&&w&4&&fy(y),Ha(y,y.return);break;case 12:Nr(f,y,a);break;case 31:Nr(f,y,a),a&&w&4&&by(f,y);break;case 13:Nr(f,y,a),a&&w&4&&xy(f,y);break;case 22:y.memoizedState===null&&Nr(f,y,a),Ha(y,y.return);break;case 30:break;default:Nr(f,y,a)}r=r.sibling}}function dh(t,r){var a=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),t=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(t=r.memoizedState.cachePool.pool),t!==a&&(t!=null&&t.refCount++,a!=null&&Na(a))}function mh(t,r){t=null,r.alternate!==null&&(t=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==t&&(r.refCount++,t!=null&&Na(t))}function Jn(t,r,a,l){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)wy(t,r,a,l),r=r.sibling}function wy(t,r,a,l){var f=r.flags;switch(r.tag){case 0:case 11:case 15:Jn(t,r,a,l),f&2048&&Ia(9,r);break;case 1:Jn(t,r,a,l);break;case 3:Jn(t,r,a,l),f&2048&&(t=null,r.alternate!==null&&(t=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==t&&(r.refCount++,t!=null&&Na(t)));break;case 12:if(f&2048){Jn(t,r,a,l),t=r.stateNode;try{var y=r.memoizedProps,w=y.id,O=y.onPostCommit;typeof O=="function"&&O(w,r.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(R){Ze(r,r.return,R)}}else Jn(t,r,a,l);break;case 31:Jn(t,r,a,l);break;case 13:Jn(t,r,a,l);break;case 23:break;case 22:y=r.stateNode,w=r.alternate,r.memoizedState!==null?y._visibility&2?Jn(t,r,a,l):Fa(t,r):y._visibility&2?Jn(t,r,a,l):(y._visibility|=2,Ci(t,r,a,l,(r.subtreeFlags&10256)!==0||!1)),f&2048&&dh(w,r);break;case 24:Jn(t,r,a,l),f&2048&&mh(r.alternate,r);break;default:Jn(t,r,a,l)}}function Ci(t,r,a,l,f){for(f=f&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var y=t,w=r,O=a,R=l,V=w.flags;switch(w.tag){case 0:case 11:case 15:Ci(y,w,O,R,f),Ia(8,w);break;case 23:break;case 22:var Z=w.stateNode;w.memoizedState!==null?Z._visibility&2?Ci(y,w,O,R,f):Fa(y,w):(Z._visibility|=2,Ci(y,w,O,R,f)),f&&V&2048&&dh(w.alternate,w);break;case 24:Ci(y,w,O,R,f),f&&V&2048&&mh(w.alternate,w);break;default:Ci(y,w,O,R,f)}r=r.sibling}}function Fa(t,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var a=t,l=r,f=l.flags;switch(l.tag){case 22:Fa(a,l),f&2048&&dh(l.alternate,l);break;case 24:Fa(a,l),f&2048&&mh(l.alternate,l);break;default:Fa(a,l)}r=r.sibling}}var Ga=8192;function Mi(t,r,a){if(t.subtreeFlags&Ga)for(t=t.child;t!==null;)Sy(t,r,a),t=t.sibling}function Sy(t,r,a){switch(t.tag){case 26:Mi(t,r,a),t.flags&Ga&&t.memoizedState!==null&&rS(a,Kn,t.memoizedState,t.memoizedProps);break;case 5:Mi(t,r,a);break;case 3:case 4:var l=Kn;Kn=Vl(t.stateNode.containerInfo),Mi(t,r,a),Kn=l;break;case 22:t.memoizedState===null&&(l=t.alternate,l!==null&&l.memoizedState!==null?(l=Ga,Ga=16777216,Mi(t,r,a),Ga=l):Mi(t,r,a));break;default:Mi(t,r,a)}}function Ey(t){var r=t.alternate;if(r!==null&&(t=r.child,t!==null)){r.child=null;do r=t.sibling,t.sibling=null,t=r;while(t!==null)}}function Va(t){var r=t.deletions;if((t.flags&16)!==0){if(r!==null)for(var a=0;a<r.length;a++){var l=r[a];Pt=l,Ay(l,t)}Ey(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Oy(t),t=t.sibling}function Oy(t){switch(t.tag){case 0:case 11:case 15:Va(t),t.flags&2048&&ns(9,t,t.return);break;case 3:Va(t);break;case 12:Va(t);break;case 22:var r=t.stateNode;t.memoizedState!==null&&r._visibility&2&&(t.return===null||t.return.tag!==13)?(r._visibility&=-3,Rl(t)):Va(t);break;default:Va(t)}}function Rl(t){var r=t.deletions;if((t.flags&16)!==0){if(r!==null)for(var a=0;a<r.length;a++){var l=r[a];Pt=l,Ay(l,t)}Ey(t)}for(t=t.child;t!==null;){switch(r=t,r.tag){case 0:case 11:case 15:ns(8,r,r.return),Rl(r);break;case 22:a=r.stateNode,a._visibility&2&&(a._visibility&=-3,Rl(r));break;default:Rl(r)}t=t.sibling}}function Ay(t,r){for(;Pt!==null;){var a=Pt;switch(a.tag){case 0:case 11:case 15:ns(8,a,r);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var l=a.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Na(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,Pt=l;else e:for(a=t;Pt!==null;){l=Pt;var f=l.sibling,y=l.return;if(yy(l),l===a){Pt=null;break e}if(f!==null){f.return=y,Pt=f;break e}Pt=y}}}var bw={getCacheForType:function(t){var r=It(jt),a=r.data.get(t);return a===void 0&&(a=t(),r.data.set(t,a)),a},cacheSignal:function(){return It(jt).controller.signal}},xw=typeof WeakMap=="function"?WeakMap:Map,Qe=0,at=null,ze=null,He=0,We=0,gn=null,rs=!1,Ri=!1,ph=!1,Tr=0,xt=0,ss=0,Xs=0,yh=0,bn=0,Di=0,Ya=null,ln=null,gh=!1,Dl=0,jy=0,Ll=1/0,ql=null,is=null,Dt=0,as=null,Li=null,Cr=0,bh=0,xh=null,ky=null,Ka=0,vh=null;function xn(){return(Qe&2)!==0&&He!==0?He&-He:H.T!==null?Ah():ya()}function Ny(){if(bn===0)if((He&536870912)===0||Ge){var t=dr;dr<<=1,(dr&3932160)===0&&(dr=262144),bn=t}else bn=536870912;return t=pn.current,t!==null&&(t.flags|=32),bn}function cn(t,r,a){(t===at&&(We===2||We===9)||t.cancelPendingCommit!==null)&&(qi(t,0),os(t,He,bn,!1)),Gn(t,a),((Qe&2)===0||t!==at)&&(t===at&&((Qe&2)===0&&(Xs|=a),xt===4&&os(t,He,bn,!1)),ir(t))}function Ty(t,r,a){if((Qe&6)!==0)throw Error(i(327));var l=!a&&(r&127)===0&&(r&t.expiredLanes)===0||Ms(t,r),f=l?ww(t,r):wh(t,r,!0),y=l;do{if(f===0){Ri&&!l&&os(t,r,0,!1);break}else{if(a=t.current.alternate,y&&!vw(a)){f=wh(t,r,!1),y=!1;continue}if(f===2){if(y=r,t.errorRecoveryDisabledLanes&y)var w=0;else w=t.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){r=w;e:{var O=t;f=Ya;var R=O.current.memoizedState.isDehydrated;if(R&&(qi(O,w).flags|=256),w=wh(O,w,!1),w!==2){if(ph&&!R){O.errorRecoveryDisabledLanes|=y,Xs|=y,f=4;break e}y=ln,ln=f,y!==null&&(ln===null?ln=y:ln.push.apply(ln,y))}f=w}if(y=!1,f!==2)continue}}if(f===1){qi(t,0),os(t,r,0,!0);break}e:{switch(l=t,y=f,y){case 0:case 1:throw Error(i(345));case 4:if((r&4194048)!==r)break;case 6:os(l,r,bn,!rs);break e;case 2:ln=null;break;case 3:case 5:break;default:throw Error(i(329))}if((r&62914560)===r&&(f=Dl+300-ut(),10<f)){if(os(l,r,bn,!rs),Cs(l,0,!0)!==0)break e;Cr=r,l.timeoutHandle=og(Cy.bind(null,l,a,ln,ql,gh,r,bn,Xs,Di,rs,y,"Throttled",-0,0),f);break e}Cy(l,a,ln,ql,gh,r,bn,Xs,Di,rs,y,null,-0,0)}}break}while(!0);ir(t)}function Cy(t,r,a,l,f,y,w,O,R,V,Z,ie,Y,X){if(t.timeoutHandle=-1,ie=r.subtreeFlags,ie&8192||(ie&16785408)===16785408){ie={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:yr},Sy(r,y,ie);var ve=(y&62914560)===y?Dl-ut():(y&4194048)===y?jy-ut():0;if(ve=sS(ie,ve),ve!==null){Cr=y,t.cancelPendingCommit=ve(Uy.bind(null,t,r,y,a,l,f,w,O,R,Z,ie,null,Y,X)),os(t,y,w,!V);return}}Uy(t,r,y,a,l,f,w,O,R)}function vw(t){for(var r=t;;){var a=r.tag;if((a===0||a===11||a===15)&&r.flags&16384&&(a=r.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var l=0;l<a.length;l++){var f=a[l],y=f.getSnapshot;f=f.value;try{if(!dn(y(),f))return!1}catch{return!1}}if(a=r.child,r.subtreeFlags&16384&&a!==null)a.return=r,r=a;else{if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function os(t,r,a,l){r&=~yh,r&=~Xs,t.suspendedLanes|=r,t.pingedLanes&=~r,l&&(t.warmLanes|=r),l=t.expirationTimes;for(var f=r;0<f;){var y=31-Gt(f),w=1<<y;l[y]=-1,f&=~w}a!==0&&Fr(t,a,r)}function Pl(){return(Qe&6)===0?(Ja(0),!1):!0}function _h(){if(ze!==null){if(We===0)var t=ze.return;else t=ze,vr=Is=null,Pf(t),Ai=null,Ca=0,t=ze;for(;t!==null;)ly(t.alternate,t),t=t.return;ze=null}}function qi(t,r){var a=t.timeoutHandle;a!==-1&&(t.timeoutHandle=-1,zw(a)),a=t.cancelPendingCommit,a!==null&&(t.cancelPendingCommit=null,a()),Cr=0,_h(),at=t,ze=a=br(t.current,null),He=r,We=0,gn=null,rs=!1,Ri=Ms(t,r),ph=!1,Di=bn=yh=Xs=ss=xt=0,ln=Ya=null,gh=!1,(r&8)!==0&&(r|=r&32);var l=t.entangledLanes;if(l!==0)for(t=t.entanglements,l&=r;0<l;){var f=31-Gt(l),y=1<<f;r|=t[f],l&=~y}return Tr=r,sl(),a}function My(t,r){Re=null,H.H=Ua,r===Oi||r===hl?(r=K0(),We=3):r===Of?(r=K0(),We=4):We=r===Zf?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,gn=r,ze===null&&(xt=1,Al(t,Rn(r,t.current)))}function Ry(){var t=pn.current;return t===null?!0:(He&4194048)===He?Pn===null:(He&62914560)===He||(He&536870912)!==0?t===Pn:!1}function Dy(){var t=H.H;return H.H=Ua,t===null?Ua:t}function Ly(){var t=H.A;return H.A=bw,t}function Bl(){xt=4,rs||(He&4194048)!==He&&pn.current!==null||(Ri=!0),(ss&134217727)===0&&(Xs&134217727)===0||at===null||os(at,He,bn,!1)}function wh(t,r,a){var l=Qe;Qe|=2;var f=Dy(),y=Ly();(at!==t||He!==r)&&(ql=null,qi(t,r)),r=!1;var w=xt;e:do try{if(We!==0&&ze!==null){var O=ze,R=gn;switch(We){case 8:_h(),w=6;break e;case 3:case 2:case 9:case 6:pn.current===null&&(r=!0);var V=We;if(We=0,gn=null,Pi(t,O,R,V),a&&Ri){w=0;break e}break;default:V=We,We=0,gn=null,Pi(t,O,R,V)}}_w(),w=xt;break}catch(Z){My(t,Z)}while(!0);return r&&t.shellSuspendCounter++,vr=Is=null,Qe=l,H.H=f,H.A=y,ze===null&&(at=null,He=0,sl()),w}function _w(){for(;ze!==null;)qy(ze)}function ww(t,r){var a=Qe;Qe|=2;var l=Dy(),f=Ly();at!==t||He!==r?(ql=null,Ll=ut()+500,qi(t,r)):Ri=Ms(t,r);e:do try{if(We!==0&&ze!==null){r=ze;var y=gn;t:switch(We){case 1:We=0,gn=null,Pi(t,r,y,1);break;case 2:case 9:if(V0(y)){We=0,gn=null,Py(r);break}r=function(){We!==2&&We!==9||at!==t||(We=7),ir(t)},y.then(r,r);break e;case 3:We=7;break e;case 4:We=5;break e;case 7:V0(y)?(We=0,gn=null,Py(r)):(We=0,gn=null,Pi(t,r,y,7));break;case 5:var w=null;switch(ze.tag){case 26:w=ze.memoizedState;case 5:case 27:var O=ze;if(w?wg(w):O.stateNode.complete){We=0,gn=null;var R=O.sibling;if(R!==null)ze=R;else{var V=O.return;V!==null?(ze=V,Ul(V)):ze=null}break t}}We=0,gn=null,Pi(t,r,y,5);break;case 6:We=0,gn=null,Pi(t,r,y,6);break;case 8:_h(),xt=6;break e;default:throw Error(i(462))}}Sw();break}catch(Z){My(t,Z)}while(!0);return vr=Is=null,H.H=l,H.A=f,Qe=a,ze!==null?0:(at=null,He=0,sl(),xt)}function Sw(){for(;ze!==null&&!$o();)qy(ze)}function qy(t){var r=ay(t.alternate,t,Tr);t.memoizedProps=t.pendingProps,r===null?Ul(t):ze=r}function Py(t){var r=t,a=r.alternate;switch(r.tag){case 15:case 0:r=ey(a,r,r.pendingProps,r.type,void 0,He);break;case 11:r=ey(a,r,r.pendingProps,r.type.render,r.ref,He);break;case 5:Pf(r);default:ly(a,r),r=ze=L0(r,Tr),r=ay(a,r,Tr)}t.memoizedProps=t.pendingProps,r===null?Ul(t):ze=r}function Pi(t,r,a,l){vr=Is=null,Pf(r),Ai=null,Ca=0;var f=r.return;try{if(fw(t,f,r,a,He)){xt=1,Al(t,Rn(a,t.current)),ze=null;return}}catch(y){if(f!==null)throw ze=f,y;xt=1,Al(t,Rn(a,t.current)),ze=null;return}r.flags&32768?(Ge||l===1?t=!0:Ri||(He&536870912)!==0?t=!1:(rs=t=!0,(l===2||l===9||l===3||l===6)&&(l=pn.current,l!==null&&l.tag===13&&(l.flags|=16384))),By(r,t)):Ul(r)}function Ul(t){var r=t;do{if((r.flags&32768)!==0){By(r,rs);return}t=r.return;var a=mw(r.alternate,r,Tr);if(a!==null){ze=a;return}if(r=r.sibling,r!==null){ze=r;return}ze=r=t}while(r!==null);xt===0&&(xt=5)}function By(t,r){do{var a=pw(t.alternate,t);if(a!==null){a.flags&=32767,ze=a;return}if(a=t.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!r&&(t=t.sibling,t!==null)){ze=t;return}ze=t=a}while(t!==null);xt=6,ze=null}function Uy(t,r,a,l,f,y,w,O,R){t.cancelPendingCommit=null;do zl();while(Dt!==0);if((Qe&6)!==0)throw Error(i(327));if(r!==null){if(r===t.current)throw Error(i(177));if(y=r.lanes|r.childLanes,y|=uf,Hr(t,a,y,w,O,R),t===at&&(ze=at=null,He=0),Li=r,as=t,Cr=a,bh=y,xh=f,ky=l,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,jw(ai,function(){return Fy(),null})):(t.callbackNode=null,t.callbackPriority=0),l=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||l){l=H.T,H.T=null,f=J.p,J.p=2,w=Qe,Qe|=4;try{yw(t,r,a)}finally{Qe=w,J.p=f,H.T=l}}Dt=1,zy(),$y(),Iy()}}function zy(){if(Dt===1){Dt=0;var t=as,r=Li,a=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||a){a=H.T,H.T=null;var l=J.p;J.p=2;var f=Qe;Qe|=4;try{vy(r,t);var y=Dh,w=A0(t.containerInfo),O=y.focusedElem,R=y.selectionRange;if(w!==O&&O&&O.ownerDocument&&O0(O.ownerDocument.documentElement,O)){if(R!==null&&sf(O)){var V=R.start,Z=R.end;if(Z===void 0&&(Z=V),"selectionStart"in O)O.selectionStart=V,O.selectionEnd=Math.min(Z,O.value.length);else{var ie=O.ownerDocument||document,Y=ie&&ie.defaultView||window;if(Y.getSelection){var X=Y.getSelection(),ve=O.textContent.length,Te=Math.min(R.start,ve),st=R.end===void 0?Te:Math.min(R.end,ve);!X.extend&&Te>st&&(w=st,st=Te,Te=w);var $=E0(O,Te),P=E0(O,st);if($&&P&&(X.rangeCount!==1||X.anchorNode!==$.node||X.anchorOffset!==$.offset||X.focusNode!==P.node||X.focusOffset!==P.offset)){var G=ie.createRange();G.setStart($.node,$.offset),X.removeAllRanges(),Te>st?(X.addRange(G),X.extend(P.node,P.offset)):(G.setEnd(P.node,P.offset),X.addRange(G))}}}}for(ie=[],X=O;X=X.parentNode;)X.nodeType===1&&ie.push({element:X,left:X.scrollLeft,top:X.scrollTop});for(typeof O.focus=="function"&&O.focus(),O=0;O<ie.length;O++){var ee=ie[O];ee.element.scrollLeft=ee.left,ee.element.scrollTop=ee.top}}Wl=!!Rh,Dh=Rh=null}finally{Qe=f,J.p=l,H.T=a}}t.current=r,Dt=2}}function $y(){if(Dt===2){Dt=0;var t=as,r=Li,a=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||a){a=H.T,H.T=null;var l=J.p;J.p=2;var f=Qe;Qe|=4;try{py(t,r.alternate,r)}finally{Qe=f,J.p=l,H.T=a}}Dt=3}}function Iy(){if(Dt===4||Dt===3){Dt=0,ii();var t=as,r=Li,a=Cr,l=ky;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?Dt=5:(Dt=0,Li=as=null,Hy(t,t.pendingLanes));var f=t.pendingLanes;if(f===0&&(is=null),Ds(a),r=r.stateNode,_t&&typeof _t.onCommitFiberRoot=="function")try{_t.onCommitFiberRoot(Ts,r,void 0,(r.current.flags&128)===128)}catch{}if(l!==null){r=H.T,f=J.p,J.p=2,H.T=null;try{for(var y=t.onRecoverableError,w=0;w<l.length;w++){var O=l[w];y(O.value,{componentStack:O.stack})}}finally{H.T=r,J.p=f}}(Cr&3)!==0&&zl(),ir(t),f=t.pendingLanes,(a&261930)!==0&&(f&42)!==0?t===vh?Ka++:(Ka=0,vh=t):Ka=0,Ja(0)}}function Hy(t,r){(t.pooledCacheLanes&=r)===0&&(r=t.pooledCache,r!=null&&(t.pooledCache=null,Na(r)))}function zl(){return zy(),$y(),Iy(),Fy()}function Fy(){if(Dt!==5)return!1;var t=as,r=bh;bh=0;var a=Ds(Cr),l=H.T,f=J.p;try{J.p=32>a?32:a,H.T=null,a=xh,xh=null;var y=as,w=Cr;if(Dt=0,Li=as=null,Cr=0,(Qe&6)!==0)throw Error(i(331));var O=Qe;if(Qe|=4,Oy(y.current),wy(y,y.current,w,a),Qe=O,Ja(0,!1),_t&&typeof _t.onPostCommitFiberRoot=="function")try{_t.onPostCommitFiberRoot(Ts,y)}catch{}return!0}finally{J.p=f,H.T=l,Hy(t,r)}}function Gy(t,r,a){r=Rn(a,r),r=Wf(t.stateNode,r,2),t=Zr(t,r,2),t!==null&&(Gn(t,2),ir(t))}function Ze(t,r,a){if(t.tag===3)Gy(t,t,a);else for(;r!==null;){if(r.tag===3){Gy(r,t,a);break}else if(r.tag===1){var l=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(is===null||!is.has(l))){t=Rn(a,t),a=Vp(2),l=Zr(r,a,2),l!==null&&(Yp(a,l,r,t),Gn(l,2),ir(l));break}}r=r.return}}function Sh(t,r,a){var l=t.pingCache;if(l===null){l=t.pingCache=new xw;var f=new Set;l.set(r,f)}else f=l.get(r),f===void 0&&(f=new Set,l.set(r,f));f.has(a)||(ph=!0,f.add(a),t=Ew.bind(null,t,r,a),r.then(t,t))}function Ew(t,r,a){var l=t.pingCache;l!==null&&l.delete(r),t.pingedLanes|=t.suspendedLanes&a,t.warmLanes&=~a,at===t&&(He&a)===a&&(xt===4||xt===3&&(He&62914560)===He&&300>ut()-Dl?(Qe&2)===0&&qi(t,0):yh|=a,Di===He&&(Di=0)),ir(t)}function Vy(t,r){r===0&&(r=li()),t=Us(t,r),t!==null&&(Gn(t,r),ir(t))}function Ow(t){var r=t.memoizedState,a=0;r!==null&&(a=r.retryLane),Vy(t,a)}function Aw(t,r){var a=0;switch(t.tag){case 31:case 13:var l=t.stateNode,f=t.memoizedState;f!==null&&(a=f.retryLane);break;case 19:l=t.stateNode;break;case 22:l=t.stateNode._retryCache;break;default:throw Error(i(314))}l!==null&&l.delete(r),Vy(t,a)}function jw(t,r){return ha(t,r)}var $l=null,Bi=null,Eh=!1,Il=!1,Oh=!1,ls=0;function ir(t){t!==Bi&&t.next===null&&(Bi===null?$l=Bi=t:Bi=Bi.next=t),Il=!0,Eh||(Eh=!0,Nw())}function Ja(t,r){if(!Oh&&Il){Oh=!0;do for(var a=!1,l=$l;l!==null;){if(t!==0){var f=l.pendingLanes;if(f===0)var y=0;else{var w=l.suspendedLanes,O=l.pingedLanes;y=(1<<31-Gt(42|t)+1)-1,y&=f&~(w&~O),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(a=!0,Qy(l,y))}else y=He,y=Cs(l,l===at?y:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(y&3)===0||Ms(l,y)||(a=!0,Qy(l,y));l=l.next}while(a);Oh=!1}}function kw(){Yy()}function Yy(){Il=Eh=!1;var t=0;ls!==0&&Uw()&&(t=ls);for(var r=ut(),a=null,l=$l;l!==null;){var f=l.next,y=Ky(l,r);y===0?(l.next=null,a===null?$l=f:a.next=f,f===null&&(Bi=a)):(a=l,(t!==0||(y&3)!==0)&&(Il=!0)),l=f}Dt!==0&&Dt!==5||Ja(t),ls!==0&&(ls=0)}function Ky(t,r){for(var a=t.suspendedLanes,l=t.pingedLanes,f=t.expirationTimes,y=t.pendingLanes&-62914561;0<y;){var w=31-Gt(y),O=1<<w,R=f[w];R===-1?((O&a)===0||(O&l)!==0)&&(f[w]=pa(O,r)):R<=r&&(t.expiredLanes|=O),y&=~O}if(r=at,a=He,a=Cs(t,t===r?a:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),l=t.callbackNode,a===0||t===r&&(We===2||We===9)||t.cancelPendingCommit!==null)return l!==null&&l!==null&&hr(l),t.callbackNode=null,t.callbackPriority=0;if((a&3)===0||Ms(t,a)){if(r=a&-a,r===t.callbackPriority)return r;switch(l!==null&&hr(l),Ds(a)){case 2:case 8:a=Ho;break;case 32:a=ai;break;case 268435456:a=Fo;break;default:a=ai}return l=Jy.bind(null,t),a=ha(a,l),t.callbackPriority=r,t.callbackNode=a,r}return l!==null&&l!==null&&hr(l),t.callbackPriority=2,t.callbackNode=null,2}function Jy(t,r){if(Dt!==0&&Dt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var a=t.callbackNode;if(zl()&&t.callbackNode!==a)return null;var l=He;return l=Cs(t,t===at?l:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),l===0?null:(Ty(t,l,r),Ky(t,ut()),t.callbackNode!=null&&t.callbackNode===a?Jy.bind(null,t):null)}function Qy(t,r){if(zl())return null;Ty(t,r,!0)}function Nw(){$w(function(){(Qe&6)!==0?ha(Io,kw):Yy()})}function Ah(){if(ls===0){var t=Si;t===0&&(t=zr,zr<<=1,(zr&261888)===0&&(zr=256)),ls=t}return ls}function Xy(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Qo(""+t)}function Wy(t,r){var a=r.ownerDocument.createElement("input");return a.name=r.name,a.value=r.value,t.id&&a.setAttribute("form",t.id),r.parentNode.insertBefore(a,r),t=new FormData(t),a.parentNode.removeChild(a),t}function Tw(t,r,a,l,f){if(r==="submit"&&a&&a.stateNode===f){var y=Xy((f[gt]||null).action),w=l.submitter;w&&(r=(r=w[gt]||null)?Xy(r.formAction):w.getAttribute("formAction"),r!==null&&(y=r,w=null));var O=new el("action","action",null,l,f);t.push({event:O,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(ls!==0){var R=w?Wy(f,w):new FormData(f);Vf(a,{pending:!0,data:R,method:f.method,action:y},null,R)}}else typeof y=="function"&&(O.preventDefault(),R=w?Wy(f,w):new FormData(f),Vf(a,{pending:!0,data:R,method:f.method,action:y},y,R))},currentTarget:f}]})}}for(var jh=0;jh<cf.length;jh++){var kh=cf[jh],Cw=kh.toLowerCase(),Mw=kh[0].toUpperCase()+kh.slice(1);Yn(Cw,"on"+Mw)}Yn(N0,"onAnimationEnd"),Yn(T0,"onAnimationIteration"),Yn(C0,"onAnimationStart"),Yn("dblclick","onDoubleClick"),Yn("focusin","onFocus"),Yn("focusout","onBlur"),Yn(K_,"onTransitionRun"),Yn(J_,"onTransitionStart"),Yn(Q_,"onTransitionCancel"),Yn(M0,"onTransitionEnd"),K("onMouseEnter",["mouseout","mouseover"]),K("onMouseLeave",["mouseout","mouseover"]),K("onPointerEnter",["pointerout","pointerover"]),K("onPointerLeave",["pointerout","pointerover"]),le("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),le("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),le("onBeforeInput",["compositionend","keypress","textInput","paste"]),le("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),le("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),le("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Qa="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(" "),Rw=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Qa));function Zy(t,r){r=(r&4)!==0;for(var a=0;a<t.length;a++){var l=t[a],f=l.event;l=l.listeners;e:{var y=void 0;if(r)for(var w=l.length-1;0<=w;w--){var O=l[w],R=O.instance,V=O.currentTarget;if(O=O.listener,R!==y&&f.isPropagationStopped())break e;y=O,f.currentTarget=V;try{y(f)}catch(Z){rl(Z)}f.currentTarget=null,y=R}else for(w=0;w<l.length;w++){if(O=l[w],R=O.instance,V=O.currentTarget,O=O.listener,R!==y&&f.isPropagationStopped())break e;y=O,f.currentTarget=V;try{y(f)}catch(Z){rl(Z)}f.currentTarget=null,y=R}}}}function $e(t,r){var a=r[Ls];a===void 0&&(a=r[Ls]=new Set);var l=t+"__bubble";a.has(l)||(eg(r,t,2,!1),a.add(l))}function Nh(t,r,a){var l=0;r&&(l|=4),eg(a,t,l,r)}var Hl="_reactListening"+Math.random().toString(36).slice(2);function Th(t){if(!t[Hl]){t[Hl]=!0,I.forEach(function(a){a!=="selectionchange"&&(Rw.has(a)||Nh(a,!1,t),Nh(a,!0,t))});var r=t.nodeType===9?t:t.ownerDocument;r===null||r[Hl]||(r[Hl]=!0,Nh("selectionchange",!1,r))}}function eg(t,r,a,l){switch(Ng(r)){case 2:var f=oS;break;case 8:f=lS;break;default:f=Gh}a=f.bind(null,r,a,t),f=void 0,!Ju||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(f=!0),l?f!==void 0?t.addEventListener(r,a,{capture:!0,passive:f}):t.addEventListener(r,a,!0):f!==void 0?t.addEventListener(r,a,{passive:f}):t.addEventListener(r,a,!1)}function Ch(t,r,a,l,f){var y=l;if((r&1)===0&&(r&2)===0&&l!==null)e:for(;;){if(l===null)return;var w=l.tag;if(w===3||w===4){var O=l.stateNode.containerInfo;if(O===f)break;if(w===4)for(w=l.return;w!==null;){var R=w.tag;if((R===3||R===4)&&w.stateNode.containerInfo===f)return;w=w.return}for(;O!==null;){if(w=A(O),w===null)return;if(R=w.tag,R===5||R===6||R===26||R===27){l=y=w;continue e}O=O.parentNode}}l=l.return}i0(function(){var V=y,Z=Yu(a),ie=[];e:{var Y=R0.get(t);if(Y!==void 0){var X=el,ve=t;switch(t){case"keypress":if(Wo(a)===0)break e;case"keydown":case"keyup":X=A_;break;case"focusin":ve="focus",X=Zu;break;case"focusout":ve="blur",X=Zu;break;case"beforeblur":case"afterblur":X=Zu;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":X=l0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":X=m_;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":X=N_;break;case N0:case T0:case C0:X=g_;break;case M0:X=C_;break;case"scroll":case"scrollend":X=h_;break;case"wheel":X=R_;break;case"copy":case"cut":case"paste":X=x_;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":X=u0;break;case"toggle":case"beforetoggle":X=L_}var Te=(r&4)!==0,st=!Te&&(t==="scroll"||t==="scrollend"),$=Te?Y!==null?Y+"Capture":null:Y;Te=[];for(var P=V,G;P!==null;){var ee=P;if(G=ee.stateNode,ee=ee.tag,ee!==5&&ee!==26&&ee!==27||G===null||$===null||(ee=ba(P,$),ee!=null&&Te.push(Xa(P,ee,G))),st)break;P=P.return}0<Te.length&&(Y=new X(Y,ve,null,a,Z),ie.push({event:Y,listeners:Te}))}}if((r&7)===0){e:{if(Y=t==="mouseover"||t==="pointerover",X=t==="mouseout"||t==="pointerout",Y&&a!==Vu&&(ve=a.relatedTarget||a.fromElement)&&(A(ve)||ve[hn]))break e;if((X||Y)&&(Y=Z.window===Z?Z:(Y=Z.ownerDocument)?Y.defaultView||Y.parentWindow:window,X?(ve=a.relatedTarget||a.toElement,X=V,ve=ve?A(ve):null,ve!==null&&(st=c(ve),Te=ve.tag,ve!==st||Te!==5&&Te!==27&&Te!==6)&&(ve=null)):(X=null,ve=V),X!==ve)){if(Te=l0,ee="onMouseLeave",$="onMouseEnter",P="mouse",(t==="pointerout"||t==="pointerover")&&(Te=u0,ee="onPointerLeave",$="onPointerEnter",P="pointer"),st=X==null?Y:k(X),G=ve==null?Y:k(ve),Y=new Te(ee,P+"leave",X,a,Z),Y.target=st,Y.relatedTarget=G,ee=null,A(Z)===V&&(Te=new Te($,P+"enter",ve,a,Z),Te.target=G,Te.relatedTarget=st,ee=Te),st=ee,X&&ve)t:{for(Te=Dw,$=X,P=ve,G=0,ee=$;ee;ee=Te(ee))G++;ee=0;for(var je=P;je;je=Te(je))ee++;for(;0<G-ee;)$=Te($),G--;for(;0<ee-G;)P=Te(P),ee--;for(;G--;){if($===P||P!==null&&$===P.alternate){Te=$;break t}$=Te($),P=Te(P)}Te=null}else Te=null;X!==null&&tg(ie,Y,X,Te,!1),ve!==null&&st!==null&&tg(ie,st,ve,Te,!0)}}e:{if(Y=V?k(V):window,X=Y.nodeName&&Y.nodeName.toLowerCase(),X==="select"||X==="input"&&Y.type==="file")var Ke=b0;else if(y0(Y))if(x0)Ke=G_;else{Ke=H_;var we=I_}else X=Y.nodeName,!X||X.toLowerCase()!=="input"||Y.type!=="checkbox"&&Y.type!=="radio"?V&&Gu(V.elementType)&&(Ke=b0):Ke=F_;if(Ke&&(Ke=Ke(t,V))){g0(ie,Ke,a,Z);break e}we&&we(t,Y,V),t==="focusout"&&V&&Y.type==="number"&&V.memoizedProps.value!=null&&Fu(Y,"number",Y.value)}switch(we=V?k(V):window,t){case"focusin":(y0(we)||we.contentEditable==="true")&&(pi=we,af=V,Aa=null);break;case"focusout":Aa=af=pi=null;break;case"mousedown":of=!0;break;case"contextmenu":case"mouseup":case"dragend":of=!1,j0(ie,a,Z);break;case"selectionchange":if(Y_)break;case"keydown":case"keyup":j0(ie,a,Z)}var De;if(tf)e:{switch(t){case"compositionstart":var Fe="onCompositionStart";break e;case"compositionend":Fe="onCompositionEnd";break e;case"compositionupdate":Fe="onCompositionUpdate";break e}Fe=void 0}else mi?m0(t,a)&&(Fe="onCompositionEnd"):t==="keydown"&&a.keyCode===229&&(Fe="onCompositionStart");Fe&&(f0&&a.locale!=="ko"&&(mi||Fe!=="onCompositionStart"?Fe==="onCompositionEnd"&&mi&&(De=a0()):(Vr=Z,Qu="value"in Vr?Vr.value:Vr.textContent,mi=!0)),we=Fl(V,Fe),0<we.length&&(Fe=new c0(Fe,t,null,a,Z),ie.push({event:Fe,listeners:we}),De?Fe.data=De:(De=p0(a),De!==null&&(Fe.data=De)))),(De=P_?B_(t,a):U_(t,a))&&(Fe=Fl(V,"onBeforeInput"),0<Fe.length&&(we=new c0("onBeforeInput","beforeinput",null,a,Z),ie.push({event:we,listeners:Fe}),we.data=De)),Tw(ie,t,V,a,Z)}Zy(ie,r)})}function Xa(t,r,a){return{instance:t,listener:r,currentTarget:a}}function Fl(t,r){for(var a=r+"Capture",l=[];t!==null;){var f=t,y=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||y===null||(f=ba(t,a),f!=null&&l.unshift(Xa(t,f,y)),f=ba(t,r),f!=null&&l.push(Xa(t,f,y))),t.tag===3)return l;t=t.return}return[]}function Dw(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function tg(t,r,a,l,f){for(var y=r._reactName,w=[];a!==null&&a!==l;){var O=a,R=O.alternate,V=O.stateNode;if(O=O.tag,R!==null&&R===l)break;O!==5&&O!==26&&O!==27||V===null||(R=V,f?(V=ba(a,y),V!=null&&w.unshift(Xa(a,V,R))):f||(V=ba(a,y),V!=null&&w.push(Xa(a,V,R)))),a=a.return}w.length!==0&&t.push({event:r,listeners:w})}var Lw=/\r\n?/g,qw=/\u0000|\uFFFD/g;function ng(t){return(typeof t=="string"?t:""+t).replace(Lw,`
26
+ `).replace(qw,"")}function rg(t,r){return r=ng(r),ng(t)===r}function rt(t,r,a,l,f,y){switch(a){case"children":typeof l=="string"?r==="body"||r==="textarea"&&l===""||fi(t,l):(typeof l=="number"||typeof l=="bigint")&&r!=="body"&&fi(t,""+l);break;case"className":Vn(t,"class",l);break;case"tabIndex":Vn(t,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":Vn(t,a,l);break;case"style":r0(t,l,y);break;case"data":if(r!=="object"){Vn(t,"data",l);break}case"src":case"href":if(l===""&&(r!=="a"||a!=="href")){t.removeAttribute(a);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){t.removeAttribute(a);break}l=Qo(""+l),t.setAttribute(a,l);break;case"action":case"formAction":if(typeof l=="function"){t.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof y=="function"&&(a==="formAction"?(r!=="input"&&rt(t,r,"name",f.name,f,null),rt(t,r,"formEncType",f.formEncType,f,null),rt(t,r,"formMethod",f.formMethod,f,null),rt(t,r,"formTarget",f.formTarget,f,null)):(rt(t,r,"encType",f.encType,f,null),rt(t,r,"method",f.method,f,null),rt(t,r,"target",f.target,f,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){t.removeAttribute(a);break}l=Qo(""+l),t.setAttribute(a,l);break;case"onClick":l!=null&&(t.onclick=yr);break;case"onScroll":l!=null&&$e("scroll",t);break;case"onScrollEnd":l!=null&&$e("scrollend",t);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(i(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(i(60));t.innerHTML=a}}break;case"multiple":t.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":t.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){t.removeAttribute("xlink:href");break}a=Qo(""+l),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?t.setAttribute(a,""+l):t.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?t.setAttribute(a,""):t.removeAttribute(a);break;case"capture":case"download":l===!0?t.setAttribute(a,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?t.setAttribute(a,l):t.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?t.setAttribute(a,l):t.removeAttribute(a);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?t.removeAttribute(a):t.setAttribute(a,l);break;case"popover":$e("beforetoggle",t),$e("toggle",t),Vt(t,"popover",l);break;case"xlinkActuate":pr(t,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":pr(t,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":pr(t,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":pr(t,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":pr(t,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":pr(t,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":pr(t,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":pr(t,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":pr(t,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Vt(t,"is",l);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=u_.get(a)||a,Vt(t,a,l))}}function Mh(t,r,a,l,f,y){switch(a){case"style":r0(t,l,y);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(i(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(i(60));t.innerHTML=a}}break;case"children":typeof l=="string"?fi(t,l):(typeof l=="number"||typeof l=="bigint")&&fi(t,""+l);break;case"onScroll":l!=null&&$e("scroll",t);break;case"onScrollEnd":l!=null&&$e("scrollend",t);break;case"onClick":l!=null&&(t.onclick=yr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!se.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(f=a.endsWith("Capture"),r=a.slice(2,f?a.length-7:void 0),y=t[gt]||null,y=y!=null?y[a]:null,typeof y=="function"&&t.removeEventListener(r,y,f),typeof l=="function")){typeof y!="function"&&y!==null&&(a in t?t[a]=null:t.hasAttribute(a)&&t.removeAttribute(a)),t.addEventListener(r,l,f);break e}a in t?t[a]=l:l===!0?t.setAttribute(a,""):Vt(t,a,l)}}}function Ft(t,r,a){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":$e("error",t),$e("load",t);var l=!1,f=!1,y;for(y in a)if(a.hasOwnProperty(y)){var w=a[y];if(w!=null)switch(y){case"src":l=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:rt(t,r,y,w,a,null)}}f&&rt(t,r,"srcSet",a.srcSet,a,null),l&&rt(t,r,"src",a.src,a,null);return;case"input":$e("invalid",t);var O=y=w=f=null,R=null,V=null;for(l in a)if(a.hasOwnProperty(l)){var Z=a[l];if(Z!=null)switch(l){case"name":f=Z;break;case"type":w=Z;break;case"checked":R=Z;break;case"defaultChecked":V=Z;break;case"value":y=Z;break;case"defaultValue":O=Z;break;case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(i(137,r));break;default:rt(t,r,l,Z,a,null)}}Zm(t,y,O,R,V,w,f,!1);return;case"select":$e("invalid",t),l=w=y=null;for(f in a)if(a.hasOwnProperty(f)&&(O=a[f],O!=null))switch(f){case"value":y=O;break;case"defaultValue":w=O;break;case"multiple":l=O;default:rt(t,r,f,O,a,null)}r=y,a=w,t.multiple=!!l,r!=null?ui(t,!!l,r,!1):a!=null&&ui(t,!!l,a,!0);return;case"textarea":$e("invalid",t),y=f=l=null;for(w in a)if(a.hasOwnProperty(w)&&(O=a[w],O!=null))switch(w){case"value":l=O;break;case"defaultValue":f=O;break;case"children":y=O;break;case"dangerouslySetInnerHTML":if(O!=null)throw Error(i(91));break;default:rt(t,r,w,O,a,null)}t0(t,l,f,y);return;case"option":for(R in a)if(a.hasOwnProperty(R)&&(l=a[R],l!=null))switch(R){case"selected":t.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:rt(t,r,R,l,a,null)}return;case"dialog":$e("beforetoggle",t),$e("toggle",t),$e("cancel",t),$e("close",t);break;case"iframe":case"object":$e("load",t);break;case"video":case"audio":for(l=0;l<Qa.length;l++)$e(Qa[l],t);break;case"image":$e("error",t),$e("load",t);break;case"details":$e("toggle",t);break;case"embed":case"source":case"link":$e("error",t),$e("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(V in a)if(a.hasOwnProperty(V)&&(l=a[V],l!=null))switch(V){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:rt(t,r,V,l,a,null)}return;default:if(Gu(r)){for(Z in a)a.hasOwnProperty(Z)&&(l=a[Z],l!==void 0&&Mh(t,r,Z,l,a,void 0));return}}for(O in a)a.hasOwnProperty(O)&&(l=a[O],l!=null&&rt(t,r,O,l,a,null))}function Pw(t,r,a,l){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,y=null,w=null,O=null,R=null,V=null,Z=null;for(X in a){var ie=a[X];if(a.hasOwnProperty(X)&&ie!=null)switch(X){case"checked":break;case"value":break;case"defaultValue":R=ie;default:l.hasOwnProperty(X)||rt(t,r,X,null,l,ie)}}for(var Y in l){var X=l[Y];if(ie=a[Y],l.hasOwnProperty(Y)&&(X!=null||ie!=null))switch(Y){case"type":y=X;break;case"name":f=X;break;case"checked":V=X;break;case"defaultChecked":Z=X;break;case"value":w=X;break;case"defaultValue":O=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(i(137,r));break;default:X!==ie&&rt(t,r,Y,X,l,ie)}}Hu(t,w,O,R,V,Z,y,f);return;case"select":X=w=O=Y=null;for(y in a)if(R=a[y],a.hasOwnProperty(y)&&R!=null)switch(y){case"value":break;case"multiple":X=R;default:l.hasOwnProperty(y)||rt(t,r,y,null,l,R)}for(f in l)if(y=l[f],R=a[f],l.hasOwnProperty(f)&&(y!=null||R!=null))switch(f){case"value":Y=y;break;case"defaultValue":O=y;break;case"multiple":w=y;default:y!==R&&rt(t,r,f,y,l,R)}r=O,a=w,l=X,Y!=null?ui(t,!!a,Y,!1):!!l!=!!a&&(r!=null?ui(t,!!a,r,!0):ui(t,!!a,a?[]:"",!1));return;case"textarea":X=Y=null;for(O in a)if(f=a[O],a.hasOwnProperty(O)&&f!=null&&!l.hasOwnProperty(O))switch(O){case"value":break;case"children":break;default:rt(t,r,O,null,l,f)}for(w in l)if(f=l[w],y=a[w],l.hasOwnProperty(w)&&(f!=null||y!=null))switch(w){case"value":Y=f;break;case"defaultValue":X=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(i(91));break;default:f!==y&&rt(t,r,w,f,l,y)}e0(t,Y,X);return;case"option":for(var ve in a)if(Y=a[ve],a.hasOwnProperty(ve)&&Y!=null&&!l.hasOwnProperty(ve))switch(ve){case"selected":t.selected=!1;break;default:rt(t,r,ve,null,l,Y)}for(R in l)if(Y=l[R],X=a[R],l.hasOwnProperty(R)&&Y!==X&&(Y!=null||X!=null))switch(R){case"selected":t.selected=Y&&typeof Y!="function"&&typeof Y!="symbol";break;default:rt(t,r,R,Y,l,X)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Te in a)Y=a[Te],a.hasOwnProperty(Te)&&Y!=null&&!l.hasOwnProperty(Te)&&rt(t,r,Te,null,l,Y);for(V in l)if(Y=l[V],X=a[V],l.hasOwnProperty(V)&&Y!==X&&(Y!=null||X!=null))switch(V){case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(i(137,r));break;default:rt(t,r,V,Y,l,X)}return;default:if(Gu(r)){for(var st in a)Y=a[st],a.hasOwnProperty(st)&&Y!==void 0&&!l.hasOwnProperty(st)&&Mh(t,r,st,void 0,l,Y);for(Z in l)Y=l[Z],X=a[Z],!l.hasOwnProperty(Z)||Y===X||Y===void 0&&X===void 0||Mh(t,r,Z,Y,l,X);return}}for(var $ in a)Y=a[$],a.hasOwnProperty($)&&Y!=null&&!l.hasOwnProperty($)&&rt(t,r,$,null,l,Y);for(ie in l)Y=l[ie],X=a[ie],!l.hasOwnProperty(ie)||Y===X||Y==null&&X==null||rt(t,r,ie,Y,l,X)}function sg(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Bw(){if(typeof performance.getEntriesByType=="function"){for(var t=0,r=0,a=performance.getEntriesByType("resource"),l=0;l<a.length;l++){var f=a[l],y=f.transferSize,w=f.initiatorType,O=f.duration;if(y&&O&&sg(w)){for(w=0,O=f.responseEnd,l+=1;l<a.length;l++){var R=a[l],V=R.startTime;if(V>O)break;var Z=R.transferSize,ie=R.initiatorType;Z&&sg(ie)&&(R=R.responseEnd,w+=Z*(R<O?1:(O-V)/(R-V)))}if(--l,r+=8*(y+w)/(f.duration/1e3),t++,10<t)break}}if(0<t)return r/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var Rh=null,Dh=null;function Gl(t){return t.nodeType===9?t:t.ownerDocument}function ig(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function ag(t,r){if(t===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&r==="foreignObject"?0:t}function Lh(t,r){return t==="textarea"||t==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var qh=null;function Uw(){var t=window.event;return t&&t.type==="popstate"?t===qh?!1:(qh=t,!0):(qh=null,!1)}var og=typeof setTimeout=="function"?setTimeout:void 0,zw=typeof clearTimeout=="function"?clearTimeout:void 0,lg=typeof Promise=="function"?Promise:void 0,$w=typeof queueMicrotask=="function"?queueMicrotask:typeof lg<"u"?function(t){return lg.resolve(null).then(t).catch(Iw)}:og;function Iw(t){setTimeout(function(){throw t})}function cs(t){return t==="head"}function cg(t,r){var a=r,l=0;do{var f=a.nextSibling;if(t.removeChild(a),f&&f.nodeType===8)if(a=f.data,a==="/$"||a==="/&"){if(l===0){t.removeChild(f),Ii(r);return}l--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")l++;else if(a==="html")Wa(t.ownerDocument.documentElement);else if(a==="head"){a=t.ownerDocument.head,Wa(a);for(var y=a.firstChild;y;){var w=y.nextSibling,O=y.nodeName;y[Rt]||O==="SCRIPT"||O==="STYLE"||O==="LINK"&&y.rel.toLowerCase()==="stylesheet"||a.removeChild(y),y=w}}else a==="body"&&Wa(t.ownerDocument.body);a=f}while(a);Ii(r)}function ug(t,r){var a=t;t=0;do{var l=a.nextSibling;if(a.nodeType===1?r?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(r?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),l&&l.nodeType===8)if(a=l.data,a==="/$"){if(t===0)break;t--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||t++;a=l}while(a)}function Ph(t){var r=t.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var a=r;switch(r=r.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":Ph(a),ci(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}t.removeChild(a)}}function Hw(t,r,a,l){for(;t.nodeType===1;){var f=a;if(t.nodeName.toLowerCase()!==r.toLowerCase()){if(!l&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(l){if(!t[Rt])switch(r){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(y=t.getAttribute("rel"),y==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(y!==f.rel||t.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||t.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||t.getAttribute("title")!==(f.title==null?null:f.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(y=t.getAttribute("src"),(y!==(f.src==null?null:f.src)||t.getAttribute("type")!==(f.type==null?null:f.type)||t.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&y&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(r==="input"&&t.type==="hidden"){var y=f.name==null?null:""+f.name;if(f.type==="hidden"&&t.getAttribute("name")===y)return t}else return t;if(t=Bn(t.nextSibling),t===null)break}return null}function Fw(t,r,a){if(r==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=Bn(t.nextSibling),t===null))return null;return t}function fg(t,r){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!r||(t=Bn(t.nextSibling),t===null))return null;return t}function Bh(t){return t.data==="$?"||t.data==="$~"}function Uh(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function Gw(t,r){var a=t.ownerDocument;if(t.data==="$~")t._reactRetry=r;else if(t.data!=="$?"||a.readyState!=="loading")r();else{var l=function(){r(),a.removeEventListener("DOMContentLoaded",l)};a.addEventListener("DOMContentLoaded",l),t._reactRetry=l}}function Bn(t){for(;t!=null;t=t.nextSibling){var r=t.nodeType;if(r===1||r===3)break;if(r===8){if(r=t.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return t}var zh=null;function hg(t){t=t.nextSibling;for(var r=0;t;){if(t.nodeType===8){var a=t.data;if(a==="/$"||a==="/&"){if(r===0)return Bn(t.nextSibling);r--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||r++}t=t.nextSibling}return null}function dg(t){t=t.previousSibling;for(var r=0;t;){if(t.nodeType===8){var a=t.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(r===0)return t;r--}else a!=="/$"&&a!=="/&"||r++}t=t.previousSibling}return null}function mg(t,r,a){switch(r=Gl(a),t){case"html":if(t=r.documentElement,!t)throw Error(i(452));return t;case"head":if(t=r.head,!t)throw Error(i(453));return t;case"body":if(t=r.body,!t)throw Error(i(454));return t;default:throw Error(i(451))}}function Wa(t){for(var r=t.attributes;r.length;)t.removeAttributeNode(r[0]);ci(t)}var Un=new Map,pg=new Set;function Vl(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Mr=J.d;J.d={f:Vw,r:Yw,D:Kw,C:Jw,L:Qw,m:Xw,X:Zw,S:Ww,M:eS};function Vw(){var t=Mr.f(),r=Pl();return t||r}function Yw(t){var r=N(t);r!==null&&r.tag===5&&r.type==="form"?Mp(r):Mr.r(t)}var Ui=typeof document>"u"?null:document;function yg(t,r,a){var l=Ui;if(l&&typeof r=="string"&&r){var f=Cn(r);f='link[rel="'+t+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),pg.has(f)||(pg.add(f),t={rel:t,crossOrigin:a,href:r},l.querySelector(f)===null&&(r=l.createElement("link"),Ft(r,"link",t),L(r),l.head.appendChild(r)))}}function Kw(t){Mr.D(t),yg("dns-prefetch",t,null)}function Jw(t,r){Mr.C(t,r),yg("preconnect",t,r)}function Qw(t,r,a){Mr.L(t,r,a);var l=Ui;if(l&&t&&r){var f='link[rel="preload"][as="'+Cn(r)+'"]';r==="image"&&a&&a.imageSrcSet?(f+='[imagesrcset="'+Cn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(f+='[imagesizes="'+Cn(a.imageSizes)+'"]')):f+='[href="'+Cn(t)+'"]';var y=f;switch(r){case"style":y=zi(t);break;case"script":y=$i(t)}Un.has(y)||(t=b({rel:"preload",href:r==="image"&&a&&a.imageSrcSet?void 0:t,as:r},a),Un.set(y,t),l.querySelector(f)!==null||r==="style"&&l.querySelector(Za(y))||r==="script"&&l.querySelector(eo(y))||(r=l.createElement("link"),Ft(r,"link",t),L(r),l.head.appendChild(r)))}}function Xw(t,r){Mr.m(t,r);var a=Ui;if(a&&t){var l=r&&typeof r.as=="string"?r.as:"script",f='link[rel="modulepreload"][as="'+Cn(l)+'"][href="'+Cn(t)+'"]',y=f;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=$i(t)}if(!Un.has(y)&&(t=b({rel:"modulepreload",href:t},r),Un.set(y,t),a.querySelector(f)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(eo(y)))return}l=a.createElement("link"),Ft(l,"link",t),L(l),a.head.appendChild(l)}}}function Ww(t,r,a){Mr.S(t,r,a);var l=Ui;if(l&&t){var f=T(l).hoistableStyles,y=zi(t);r=r||"default";var w=f.get(y);if(!w){var O={loading:0,preload:null};if(w=l.querySelector(Za(y)))O.loading=5;else{t=b({rel:"stylesheet",href:t,"data-precedence":r},a),(a=Un.get(y))&&$h(t,a);var R=w=l.createElement("link");L(R),Ft(R,"link",t),R._p=new Promise(function(V,Z){R.onload=V,R.onerror=Z}),R.addEventListener("load",function(){O.loading|=1}),R.addEventListener("error",function(){O.loading|=2}),O.loading|=4,Yl(w,r,l)}w={type:"stylesheet",instance:w,count:1,state:O},f.set(y,w)}}}function Zw(t,r){Mr.X(t,r);var a=Ui;if(a&&t){var l=T(a).hoistableScripts,f=$i(t),y=l.get(f);y||(y=a.querySelector(eo(f)),y||(t=b({src:t,async:!0},r),(r=Un.get(f))&&Ih(t,r),y=a.createElement("script"),L(y),Ft(y,"link",t),a.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},l.set(f,y))}}function eS(t,r){Mr.M(t,r);var a=Ui;if(a&&t){var l=T(a).hoistableScripts,f=$i(t),y=l.get(f);y||(y=a.querySelector(eo(f)),y||(t=b({src:t,async:!0,type:"module"},r),(r=Un.get(f))&&Ih(t,r),y=a.createElement("script"),L(y),Ft(y,"link",t),a.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},l.set(f,y))}}function gg(t,r,a,l){var f=(f=Ot.current)?Vl(f):null;if(!f)throw Error(i(446));switch(t){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(r=zi(a.href),a=T(f).hoistableStyles,l=a.get(r),l||(l={type:"style",instance:null,count:0,state:null},a.set(r,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){t=zi(a.href);var y=T(f).hoistableStyles,w=y.get(t);if(w||(f=f.ownerDocument||f,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(t,w),(y=f.querySelector(Za(t)))&&!y._p&&(w.instance=y,w.state.loading=5),Un.has(t)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Un.set(t,a),y||tS(f,t,a,w.state))),r&&l===null)throw Error(i(528,""));return w}if(r&&l!==null)throw Error(i(529,""));return null;case"script":return r=a.async,a=a.src,typeof a=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=$i(a),a=T(f).hoistableScripts,l=a.get(r),l||(l={type:"script",instance:null,count:0,state:null},a.set(r,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,t))}}function zi(t){return'href="'+Cn(t)+'"'}function Za(t){return'link[rel="stylesheet"]['+t+"]"}function bg(t){return b({},t,{"data-precedence":t.precedence,precedence:null})}function tS(t,r,a,l){t.querySelector('link[rel="preload"][as="style"]['+r+"]")?l.loading=1:(r=t.createElement("link"),l.preload=r,r.addEventListener("load",function(){return l.loading|=1}),r.addEventListener("error",function(){return l.loading|=2}),Ft(r,"link",a),L(r),t.head.appendChild(r))}function $i(t){return'[src="'+Cn(t)+'"]'}function eo(t){return"script[async]"+t}function xg(t,r,a){if(r.count++,r.instance===null)switch(r.type){case"style":var l=t.querySelector('style[data-href~="'+Cn(a.href)+'"]');if(l)return r.instance=l,L(l),l;var f=b({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(t.ownerDocument||t).createElement("style"),L(l),Ft(l,"style",f),Yl(l,a.precedence,t),r.instance=l;case"stylesheet":f=zi(a.href);var y=t.querySelector(Za(f));if(y)return r.state.loading|=4,r.instance=y,L(y),y;l=bg(a),(f=Un.get(f))&&$h(l,f),y=(t.ownerDocument||t).createElement("link"),L(y);var w=y;return w._p=new Promise(function(O,R){w.onload=O,w.onerror=R}),Ft(y,"link",l),r.state.loading|=4,Yl(y,a.precedence,t),r.instance=y;case"script":return y=$i(a.src),(f=t.querySelector(eo(y)))?(r.instance=f,L(f),f):(l=a,(f=Un.get(y))&&(l=b({},a),Ih(l,f)),t=t.ownerDocument||t,f=t.createElement("script"),L(f),Ft(f,"link",l),t.head.appendChild(f),r.instance=f);case"void":return null;default:throw Error(i(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(l=r.instance,r.state.loading|=4,Yl(l,a.precedence,t));return r.instance}function Yl(t,r,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=l.length?l[l.length-1]:null,y=f,w=0;w<l.length;w++){var O=l[w];if(O.dataset.precedence===r)y=O;else if(y!==f)break}y?y.parentNode.insertBefore(t,y.nextSibling):(r=a.nodeType===9?a.head:a,r.insertBefore(t,r.firstChild))}function $h(t,r){t.crossOrigin==null&&(t.crossOrigin=r.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=r.referrerPolicy),t.title==null&&(t.title=r.title)}function Ih(t,r){t.crossOrigin==null&&(t.crossOrigin=r.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=r.referrerPolicy),t.integrity==null&&(t.integrity=r.integrity)}var Kl=null;function vg(t,r,a){if(Kl===null){var l=new Map,f=Kl=new Map;f.set(a,l)}else f=Kl,l=f.get(a),l||(l=new Map,f.set(a,l));if(l.has(t))return l;for(l.set(t,null),a=a.getElementsByTagName(t),f=0;f<a.length;f++){var y=a[f];if(!(y[Rt]||y[it]||t==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var w=y.getAttribute(r)||"";w=t+w;var O=l.get(w);O?O.push(y):l.set(w,[y])}}return l}function _g(t,r,a){t=t.ownerDocument||t,t.head.insertBefore(a,r==="title"?t.querySelector("head > title"):null)}function nS(t,r,a){if(a===1||r.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;switch(r.rel){case"stylesheet":return t=r.disabled,typeof r.precedence=="string"&&t==null;default:return!0}case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function wg(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function rS(t,r,a,l){if(a.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var f=zi(l.href),y=r.querySelector(Za(f));if(y){r=y._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(t.count++,t=Jl.bind(t),r.then(t,t)),a.state.loading|=4,a.instance=y,L(y);return}y=r.ownerDocument||r,l=bg(l),(f=Un.get(f))&&$h(l,f),y=y.createElement("link"),L(y);var w=y;w._p=new Promise(function(O,R){w.onload=O,w.onerror=R}),Ft(y,"link",l),a.instance=y}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(a,r),(r=a.state.preload)&&(a.state.loading&3)===0&&(t.count++,a=Jl.bind(t),r.addEventListener("load",a),r.addEventListener("error",a))}}var Hh=0;function sS(t,r){return t.stylesheets&&t.count===0&&Xl(t,t.stylesheets),0<t.count||0<t.imgCount?function(a){var l=setTimeout(function(){if(t.stylesheets&&Xl(t,t.stylesheets),t.unsuspend){var y=t.unsuspend;t.unsuspend=null,y()}},6e4+r);0<t.imgBytes&&Hh===0&&(Hh=62500*Bw());var f=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&Xl(t,t.stylesheets),t.unsuspend)){var y=t.unsuspend;t.unsuspend=null,y()}},(t.imgBytes>Hh?50:800)+r);return t.unsuspend=a,function(){t.unsuspend=null,clearTimeout(l),clearTimeout(f)}}:null}function Jl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xl(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Ql=null;function Xl(t,r){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Ql=new Map,r.forEach(iS,t),Ql=null,Jl.call(t))}function iS(t,r){if(!(r.state.loading&4)){var a=Ql.get(t);if(a)var l=a.get(null);else{a=new Map,Ql.set(t,a);for(var f=t.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y<f.length;y++){var w=f[y];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(a.set(w.dataset.precedence,w),l=w)}l&&a.set(null,l)}f=r.instance,w=f.getAttribute("data-precedence"),y=a.get(w)||l,y===l&&a.set(null,f),a.set(w,f),this.count++,l=Jl.bind(this),f.addEventListener("load",l),f.addEventListener("error",l),y?y.parentNode.insertBefore(f,y.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(f,t.firstChild)),r.state.loading|=4}}var to={$$typeof:ne,Provider:null,Consumer:null,_currentValue:ce,_currentValue2:ce,_threadCount:0};function aS(t,r,a,l,f,y,w,O,R){this.tag=1,this.containerInfo=t,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ir(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ir(0),this.hiddenUpdates=Ir(null),this.identifierPrefix=l,this.onUncaughtError=f,this.onCaughtError=y,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.incompleteTransitions=new Map}function Sg(t,r,a,l,f,y,w,O,R,V,Z,ie){return t=new aS(t,r,a,w,R,V,Z,ie,O),r=1,y===!0&&(r|=24),y=mn(3,null,null,r),t.current=y,y.stateNode=t,r=wf(),r.refCount++,t.pooledCache=r,r.refCount++,y.memoizedState={element:l,isDehydrated:a,cache:r},Af(y),t}function Eg(t){return t?(t=bi,t):bi}function Og(t,r,a,l,f,y){f=Eg(f),l.context===null?l.context=f:l.pendingContext=f,l=Wr(r),l.payload={element:a},y=y===void 0?null:y,y!==null&&(l.callback=y),a=Zr(t,l,r),a!==null&&(cn(a,t,r),Ra(a,t,r))}function Ag(t,r){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var a=t.retryLane;t.retryLane=a!==0&&a<r?a:r}}function Fh(t,r){Ag(t,r),(t=t.alternate)&&Ag(t,r)}function jg(t){if(t.tag===13||t.tag===31){var r=Us(t,67108864);r!==null&&cn(r,t,67108864),Fh(t,67108864)}}function kg(t){if(t.tag===13||t.tag===31){var r=xn();r=mr(r);var a=Us(t,r);a!==null&&cn(a,t,r),Fh(t,r)}}var Wl=!0;function oS(t,r,a,l){var f=H.T;H.T=null;var y=J.p;try{J.p=2,Gh(t,r,a,l)}finally{J.p=y,H.T=f}}function lS(t,r,a,l){var f=H.T;H.T=null;var y=J.p;try{J.p=8,Gh(t,r,a,l)}finally{J.p=y,H.T=f}}function Gh(t,r,a,l){if(Wl){var f=Vh(l);if(f===null)Ch(t,r,l,Zl,a),Tg(t,l);else if(uS(f,t,r,a,l))l.stopPropagation();else if(Tg(t,l),r&4&&-1<cS.indexOf(t)){for(;f!==null;){var y=N(f);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var w=Fn(y.pendingLanes);if(w!==0){var O=y;for(O.pendingLanes|=2,O.entangledLanes|=2;w;){var R=1<<31-Gt(w);O.entanglements[1]|=R,w&=~R}ir(y),(Qe&6)===0&&(Ll=ut()+500,Ja(0))}}break;case 31:case 13:O=Us(y,2),O!==null&&cn(O,y,2),Pl(),Fh(y,2)}if(y=Vh(l),y===null&&Ch(t,r,l,Zl,a),y===f)break;f=y}f!==null&&l.stopPropagation()}else Ch(t,r,l,null,a)}}function Vh(t){return t=Yu(t),Yh(t)}var Zl=null;function Yh(t){if(Zl=null,t=A(t),t!==null){var r=c(t);if(r===null)t=null;else{var a=r.tag;if(a===13){if(t=d(r),t!==null)return t;t=null}else if(a===31){if(t=p(r),t!==null)return t;t=null}else if(a===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;t=null}else r!==t&&(t=null)}}return Zl=t,null}function Ng(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Uu()){case Io:return 2;case Ho:return 8;case ai:case zu:return 32;case Fo:return 268435456;default:return 32}default:return 32}}var Kh=!1,us=null,fs=null,hs=null,no=new Map,ro=new Map,ds=[],cS="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 Tg(t,r){switch(t){case"focusin":case"focusout":us=null;break;case"dragenter":case"dragleave":fs=null;break;case"mouseover":case"mouseout":hs=null;break;case"pointerover":case"pointerout":no.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":ro.delete(r.pointerId)}}function so(t,r,a,l,f,y){return t===null||t.nativeEvent!==y?(t={blockedOn:r,domEventName:a,eventSystemFlags:l,nativeEvent:y,targetContainers:[f]},r!==null&&(r=N(r),r!==null&&jg(r)),t):(t.eventSystemFlags|=l,r=t.targetContainers,f!==null&&r.indexOf(f)===-1&&r.push(f),t)}function uS(t,r,a,l,f){switch(r){case"focusin":return us=so(us,t,r,a,l,f),!0;case"dragenter":return fs=so(fs,t,r,a,l,f),!0;case"mouseover":return hs=so(hs,t,r,a,l,f),!0;case"pointerover":var y=f.pointerId;return no.set(y,so(no.get(y)||null,t,r,a,l,f)),!0;case"gotpointercapture":return y=f.pointerId,ro.set(y,so(ro.get(y)||null,t,r,a,l,f)),!0}return!1}function Cg(t){var r=A(t.target);if(r!==null){var a=c(r);if(a!==null){if(r=a.tag,r===13){if(r=d(a),r!==null){t.blockedOn=r,Vo(t.priority,function(){kg(a)});return}}else if(r===31){if(r=p(a),r!==null){t.blockedOn=r,Vo(t.priority,function(){kg(a)});return}}else if(r===3&&a.stateNode.current.memoizedState.isDehydrated){t.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}t.blockedOn=null}function ec(t){if(t.blockedOn!==null)return!1;for(var r=t.targetContainers;0<r.length;){var a=Vh(t.nativeEvent);if(a===null){a=t.nativeEvent;var l=new a.constructor(a.type,a);Vu=l,a.target.dispatchEvent(l),Vu=null}else return r=N(a),r!==null&&jg(r),t.blockedOn=a,!1;r.shift()}return!0}function Mg(t,r,a){ec(t)&&a.delete(r)}function fS(){Kh=!1,us!==null&&ec(us)&&(us=null),fs!==null&&ec(fs)&&(fs=null),hs!==null&&ec(hs)&&(hs=null),no.forEach(Mg),ro.forEach(Mg)}function tc(t,r){t.blockedOn===r&&(t.blockedOn=null,Kh||(Kh=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,fS)))}var nc=null;function Rg(t){nc!==t&&(nc=t,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){nc===t&&(nc=null);for(var r=0;r<t.length;r+=3){var a=t[r],l=t[r+1],f=t[r+2];if(typeof l!="function"){if(Yh(l||a)===null)continue;break}var y=N(a);y!==null&&(t.splice(r,3),r-=3,Vf(y,{pending:!0,data:f,method:a.method,action:l},l,f))}}))}function Ii(t){function r(R){return tc(R,t)}us!==null&&tc(us,t),fs!==null&&tc(fs,t),hs!==null&&tc(hs,t),no.forEach(r),ro.forEach(r);for(var a=0;a<ds.length;a++){var l=ds[a];l.blockedOn===t&&(l.blockedOn=null)}for(;0<ds.length&&(a=ds[0],a.blockedOn===null);)Cg(a),a.blockedOn===null&&ds.shift();if(a=(t.ownerDocument||t).$$reactFormReplay,a!=null)for(l=0;l<a.length;l+=3){var f=a[l],y=a[l+1],w=f[gt]||null;if(typeof y=="function")w||Rg(a);else if(w){var O=null;if(y&&y.hasAttribute("formAction")){if(f=y,w=y[gt]||null)O=w.formAction;else if(Yh(f)!==null)continue}else O=w.action;typeof O=="function"?a[l+1]=O:(a.splice(l,3),l-=3),Rg(a)}}}function Dg(){function t(y){y.canIntercept&&y.info==="react-transition"&&y.intercept({handler:function(){return new Promise(function(w){return f=w})},focusReset:"manual",scroll:"manual"})}function r(){f!==null&&(f(),f=null),l||setTimeout(a,20)}function a(){if(!l&&!navigation.transition){var y=navigation.currentEntry;y&&y.url!=null&&navigation.navigate(y.url,{state:y.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,f=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(a,100),function(){l=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),f!==null&&(f(),f=null)}}}function Jh(t){this._internalRoot=t}rc.prototype.render=Jh.prototype.render=function(t){var r=this._internalRoot;if(r===null)throw Error(i(409));var a=r.current,l=xn();Og(a,l,t,r,null,null)},rc.prototype.unmount=Jh.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var r=t.containerInfo;Og(t.current,2,null,t,null,null),Pl(),r[hn]=null}};function rc(t){this._internalRoot=t}rc.prototype.unstable_scheduleHydration=function(t){if(t){var r=ya();t={blockedOn:null,target:t,priority:r};for(var a=0;a<ds.length&&r!==0&&r<ds[a].priority;a++);ds.splice(a,0,t),a===0&&Cg(t)}};var Lg=e.version;if(Lg!=="19.2.4")throw Error(i(527,Lg,"19.2.4"));J.findDOMNode=function(t){var r=t._reactInternals;if(r===void 0)throw typeof t.render=="function"?Error(i(188)):(t=Object.keys(t).join(","),Error(i(268,t)));return t=u(r),t=t!==null?m(t):null,t=t===null?null:t.stateNode,t};var hS={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:H,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var sc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!sc.isDisabled&&sc.supportsFiber)try{Ts=sc.inject(hS),_t=sc}catch{}}return io.createRoot=function(t,r){if(!o(t))throw Error(i(299));var a=!1,l="",f=Ip,y=Hp,w=Fp;return r!=null&&(r.unstable_strictMode===!0&&(a=!0),r.identifierPrefix!==void 0&&(l=r.identifierPrefix),r.onUncaughtError!==void 0&&(f=r.onUncaughtError),r.onCaughtError!==void 0&&(y=r.onCaughtError),r.onRecoverableError!==void 0&&(w=r.onRecoverableError)),r=Sg(t,1,!1,null,null,a,l,null,f,y,w,Dg),t[hn]=r.current,Th(t),new Jh(r)},io.hydrateRoot=function(t,r,a){if(!o(t))throw Error(i(299));var l=!1,f="",y=Ip,w=Hp,O=Fp,R=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(y=a.onUncaughtError),a.onCaughtError!==void 0&&(w=a.onCaughtError),a.onRecoverableError!==void 0&&(O=a.onRecoverableError),a.formState!==void 0&&(R=a.formState)),r=Sg(t,1,!0,r,a??null,l,f,R,y,w,O,Dg),r.context=Eg(null),a=r.current,l=xn(),l=mr(l),f=Wr(l),f.callback=null,Zr(a,f,l),a=l,r.current.lanes=a,Gn(r,a),ir(r),t[hn]=r.current,Th(t),new rc(r)},io.version="19.2.4",io}var Ig;function sE(){if(Ig)return Qh.exports;Ig=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),Qh.exports=rE(),Qh.exports}var iE=sE();const aE="modulepreload",oE=function(n,e){return new URL(n,e).href},Hg={},Oe=function(e,s,i){let o=Promise.resolve();if(s&&s.length>0){let d=function(m){return Promise.all(m.map(b=>Promise.resolve(b).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};const p=document.getElementsByTagName("link"),g=document.querySelector("meta[property=csp-nonce]"),u=(g==null?void 0:g.nonce)||(g==null?void 0:g.getAttribute("nonce"));o=d(s.map(m=>{if(m=oE(m,i),m in Hg)return;Hg[m]=!0;const b=m.endsWith(".css"),x=b?'[rel="stylesheet"]':"";if(!!i)for(let S=p.length-1;S>=0;S--){const C=p[S];if(C.href===m&&(!b||C.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${m}"]${x}`))return;const _=document.createElement("link");if(_.rel=b?"stylesheet":aE,b||(_.as="script"),_.crossOrigin="",_.href=m,u&&_.setAttribute("nonce",u),document.head.appendChild(_),b)return new Promise((S,C)=>{_.addEventListener("load",S),_.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${m}`)))})}))}function c(d){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=d,window.dispatchEvent(p),!p.defaultPrevented)throw d}return o.then(d=>{for(const p of d||[])p.status==="rejected"&&c(p.reason);return e().catch(c)})};function Ou(n){try{const e=n.split(".");if(e.length!==3)return null;const s=atob(e[1].replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(s)}catch{return null}}function xx(n){const e=Ou(n);return!e||typeof e.exp!="number"?null:e.exp}function fm(n,e=0){const s=xx(n);return s===null?!0:Date.now()/1e3>=s-e}const Yt=window.__LT_BASE__??"",Sd=`${Yt}/api`;class Fg extends Error{constructor(e,s,i){super(e),this.status=s,this.body=i,this.name="ApiError"}}let bs=null;function ic(n){bs=n}function Ed(){return bs}const lE="X-LT-Acting-Token",cE="X-LT-Acting-Remaining";let tu=null,nu=null;function Gg(n){tu=n}let ru=null;function Vg(n){ru=n}function Yg(n){nu=n}function uE(n){const e=n==null?void 0:n.error;return typeof e=="string"&&/acting[- ]identity/i.test(e)}async function Kg(){const n=sessionStorage.getItem("lt_credentials");if(!n)return null;try{const{username:e,password:s}=JSON.parse(n),i=await fetch(`${Sd}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:s})});if(!i.ok)return null;const o=await i.json();return o.token&&o.user&&sessionStorage.setItem("lt_user_info",JSON.stringify({displayName:o.user.display_name,username:o.user.external_id})),o.token??null}catch{return null}}let ps=null;async function ue(n,e={}){const s={"Content-Type":"application/json",...e.headers};if(bs){if(fm(bs)){ps||(ps=Kg().finally(()=>{ps=null}));const p=await ps;if(p)bs=p,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:p}}));else throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}s.Authorization=`Bearer ${bs}`}const o=(e.method??"GET").toUpperCase()==="GET"?null:(tu==null?void 0:tu())??null;o&&(s[lE]=o);let c=await fetch(`${Sd}${n}`,{...e,headers:s});const d=o?c.headers.get(cE):null;if(o&&d!==null&&(ru==null||ru(o,d==="unbounded"?null:Number(d))),c.status===401&&o){const p=await c.clone().json().catch(()=>null);if(uE(p))throw nu==null||nu(),new Fg(p.error,401,p)}if(c.status===401&&bs){ps||(ps=Kg().finally(()=>{ps=null}));const p=await ps;if(p&&(bs=p,window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:p}})),s.Authorization=`Bearer ${p}`,c=await fetch(`${Sd}${n}`,{...e,headers:s})),c.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired")}else if(c.status===401)throw window.dispatchEvent(new CustomEvent("auth:unauthorized")),new Error("Session expired");if(!c.ok){const p=await c.json().catch(()=>({error:c.statusText}));throw new Fg(p.message||p.error||c.statusText,c.status,p)}return c.json()}const fE="lt_ai_override";let ac=null;function hm(){return ac||(ac=fetch(`${Yt}/api/settings`).then(n=>{if(!n.ok)throw new Error(`settings ${n.status}`);return n.json()}).catch(n=>{throw ac=null,n})),ac}function hE(){try{if(localStorage.getItem(fE)==="off")return!1}catch{}return null}function Hn(){var s;const n=qe({queryKey:["settings"],queryFn:hm,staleTime:1/0}),e=hE();return n.data&&e===!1&&((s=n.data.ai)!=null&&s.enabled)?{...n,data:{...n.data,ai:{enabled:!1}}}:n}function dE(n){var u,m,b;const{data:e}=Hn(),s=((u=e==null?void 0:e.auth)==null?void 0:u.ssoKeepaliveSeconds)??0,i=((m=e==null?void 0:e.auth)==null?void 0:m.ssoKeepaliveIdleTimeoutSeconds)??0,o=E.useRef(Date.now()),c=E.useRef(Date.now()),d=E.useRef(!1),g=!!n&&((b=Ou(n))==null?void 0:b.sso)===!0&&s>0;E.useEffect(()=>{if(!g)return;const x=()=>{o.current=Date.now()};window.addEventListener("pointerdown",x,{passive:!0}),window.addEventListener("keydown",x,{passive:!0}),window.addEventListener("wheel",x,{passive:!0});const v=async()=>{if(!d.current&&document.visibilityState==="visible"&&!(i>0&&Date.now()-o.current>i*1e3)){d.current=!0;try{const C=await fetch(`${Yt}/api/auth/sso`,{method:"POST"});if(C.status===401||C.status===403){window.dispatchEvent(new CustomEvent("auth:unauthorized"));return}if(!C.ok)return;const B=await C.json().catch(()=>null);B!=null&&B.token&&(c.current=Date.now(),window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:B.token}})))}catch{}finally{d.current=!1}}},_=setInterval(v,s*1e3),S=()=>{document.visibilityState==="visible"&&Date.now()-c.current>s*1e3&&v()};return document.addEventListener("visibilitychange",S),()=>{clearInterval(_),document.removeEventListener("visibilitychange",S),window.removeEventListener("pointerdown",x),window.removeEventListener("keydown",x),window.removeEventListener("wheel",x)}},[g,s,i])}const vx=E.createContext(null),mE=300;function Zh(n,e){if(fm(n))return null;const s=Ou(n);if(!s)return null;const i=e??(()=>{try{const o=sessionStorage.getItem("lt_user_info");return o?JSON.parse(o):null}catch{return null}})();return{userId:s.userId,displayName:(i==null?void 0:i.displayName)??null,username:(i==null?void 0:i.username)??null,roles:s.roles??[]}}function pE({children:n}){const[e,s]=E.useState(()=>{const b=sessionStorage.getItem("lt_token");return b?fm(b)?(sessionStorage.removeItem("lt_token"),null):(ic(b),Zh(b)):null}),i=E.useRef(void 0),o=E.useCallback(b=>{clearTimeout(i.current);const x=xx(b);if(!x)return;const v=(x-mE)*1e3-Date.now();v<=0||(i.current=setTimeout(async()=>{try{const _=Ou(b);if(_!=null&&_.sso){const te=await fetch(`${Yt}/api/auth/sso`,{method:"POST"});if(!te.ok)return;const M=await te.json();M.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:M.token}}));return}const S=sessionStorage.getItem("lt_credentials");if(!S)return;const{username:C,password:B}=JSON.parse(S),q=await fetch(`${Yt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:C,password:B})});if(!q.ok)return;const ne=await q.json();ne.token&&window.dispatchEvent(new CustomEvent("auth:refreshed",{detail:{token:ne.token}}))}catch{}},v))},[]),c=E.useCallback((b,x,v)=>{const _={displayName:(v==null?void 0:v.displayName)??null,username:(v==null?void 0:v.username)??(x==null?void 0:x.username)??null},S=Zh(b,_);S&&(ic(b),sessionStorage.setItem("lt_token",b),sessionStorage.setItem("lt_user_info",JSON.stringify(_)),x&&sessionStorage.setItem("lt_credentials",JSON.stringify(x)),s(S),o(b))},[o]),d=E.useCallback(()=>{clearTimeout(i.current);const b=sessionStorage.getItem("lt_sso_logout_url");ic(null),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info"),sessionStorage.removeItem("lt_sso_logout_url"),s(null),b&&(window.location.href=b)},[]);E.useEffect(()=>{const b=()=>d(),x=v=>{var C;const _=(C=v.detail)==null?void 0:C.token;if(!_)return;const S=Zh(_);S&&(ic(_),sessionStorage.setItem("lt_token",_),s(S),o(_))};return window.addEventListener("auth:unauthorized",b),window.addEventListener("auth:refreshed",x),()=>{window.removeEventListener("auth:unauthorized",b),window.removeEventListener("auth:refreshed",x)}},[d,o]),E.useEffect(()=>{const b=sessionStorage.getItem("lt_token");return b&&e&&o(b),()=>clearTimeout(i.current)},[]);const p=(e==null?void 0:e.roles.some(b=>b.type==="superadmin"))??!1,g=E.useCallback(b=>(e==null?void 0:e.roles.some(x=>x.role===b))??!1,[e]),u=E.useCallback(b=>(e==null?void 0:e.roles.some(x=>x.type===b))??!1,[e]),m=(e==null?void 0:e.roles.map(b=>b.role))??[];return h.jsxs(vx.Provider,{value:{user:e,isAuthenticated:!!e,isSuperAdmin:p,login:c,logout:d,hasRole:g,hasRoleType:u,userRoleNames:m},children:[h.jsx(yE,{authenticated:e!==null}),n]})}function yE({authenticated:n}){return dE(n?sessionStorage.getItem("lt_token"):null),null}function qt(){const n=E.useContext(vx);if(!n)throw new Error("useAuth must be used within AuthProvider");return n}async function gE(n){if(!Ed())return{kind:"session-ended"};try{const e=await ue("/nats-credentials"),s=e.natsWsUrl??n;return s?{kind:"ok",url:s,token:e.natsToken??null}:{kind:"unavailable"}}catch{return Ed()?{kind:"unavailable"}:{kind:"session-ended"}}}const bo={initialDelayMs:1e3,maxDelayMs:6e4,noticeAfterMs:3e4,spreadMs:5e3};function bE(n,e,s=Math.random){const i=Math.min(e.maxDelayMs,e.initialDelayMs*2**Math.max(0,n));return Math.round(i/2+s()*(i/2))}function Jg(n,e=Math.random){return Math.round(e()*n.spreadMs)}function Qg(n){const e=(s,i)=>typeof s=="number"&&Number.isFinite(s)&&s>0?s:i;return{initialDelayMs:e(n==null?void 0:n.initialDelayMs,bo.initialDelayMs),maxDelayMs:e(n==null?void 0:n.maxDelayMs,bo.maxDelayMs),noticeAfterMs:e(n==null?void 0:n.noticeAfterMs,bo.noticeAfterMs),spreadMs:e(n==null?void 0:n.spreadMs,bo.spreadMs)}}const jn=new Uint8Array(0),si=new TextEncoder,En=new TextDecoder;function xE(...n){let e=0;for(let o=0;o<n.length;o++)e+=n[o].length;const s=new Uint8Array(e);let i=0;for(let o=0;o<n.length;o++)s.set(n[o],i),i+=n[o].length;return s}function wo(...n){const e=[];for(let s=0;s<n.length;s++)e.push(si.encode(n[s]));return e.length===0?jn:e.length===1?e[0]:xE(...e)}function Xg(n){return!n||n.length===0?"":En.decode(n)}const Wg="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",Zg=36,vE=0xcfd41b9100000,eb=33,_E=333,tb=22;function wE(n){for(let e=0;e<n.length;e++)n[e]=Math.floor(Math.random()*255)}function SE(n){var e;(e=globalThis==null?void 0:globalThis.crypto)!=null&&e.getRandomValues?globalThis.crypto.getRandomValues(n):wE(n)}class EE{constructor(){j(this,"buf");j(this,"seq");j(this,"inc");j(this,"inited");this.buf=new Uint8Array(tb),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*vE),this.inc=Math.floor(Math.random()*(_E-eb)+eb)}setPre(){const e=new Uint8Array(12);SE(e);for(let s=0;s<12;s++){const i=e[s]%36;this.buf[s]=Wg.charCodeAt(i)}}fillSeq(){let e=this.seq;for(let s=tb-1;s>=12;s--)this.buf[s]=Wg.charCodeAt(e%Zg),e=Math.floor(e/Zg)}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 js=new EE;var Dr;(function(n){n.Disconnect="disconnect",n.Reconnect="reconnect",n.Update="update",n.LDM="ldm",n.Error="error"})(Dr||(Dr={}));var Xi;(function(n){n.Reconnecting="reconnecting",n.PingTimer="pingTimer",n.StaleConnection="staleConnection",n.ClientInitiatedReconnect="client initiated reconnect"})(Xi||(Xi={}));var fe;(function(n){n.ApiError="BAD API",n.BadAuthentication="BAD_AUTHENTICATION",n.BadCreds="BAD_CREDS",n.BadHeader="BAD_HEADER",n.BadJson="BAD_JSON",n.BadPayload="BAD_PAYLOAD",n.BadSubject="BAD_SUBJECT",n.Cancelled="CANCELLED",n.ConnectionClosed="CONNECTION_CLOSED",n.ConnectionDraining="CONNECTION_DRAINING",n.ConnectionRefused="CONNECTION_REFUSED",n.ConnectionTimeout="CONNECTION_TIMEOUT",n.Disconnect="DISCONNECT",n.InvalidOption="INVALID_OPTION",n.InvalidPayload="INVALID_PAYLOAD",n.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",n.NoResponders="503",n.NotFunction="NOT_FUNC",n.RequestError="REQUEST_ERROR",n.ServerOptionNotAvailable="SERVER_OPT_NA",n.SubClosed="SUB_CLOSED",n.SubDraining="SUB_DRAINING",n.Timeout="TIMEOUT",n.Tls="TLS",n.Unknown="UNKNOWN_ERROR",n.WssRequired="WSS_REQUIRED",n.JetStreamInvalidAck="JESTREAM_INVALID_ACK",n.JetStream404NoMessages="404",n.JetStream408RequestTimeout="408",n.JetStream409MaxAckPendingExceeded="409",n.JetStream409="409",n.JetStreamNotEnabled="503",n.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",n.AuthorizationViolation="AUTHORIZATION_VIOLATION",n.AuthenticationExpired="AUTHENTICATION_EXPIRED",n.ProtocolError="NATS_PROTOCOL_ERR",n.PermissionsViolation="PERMISSIONS_VIOLATION",n.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",n.AccountExpired="ACCOUNT_EXPIRED"})(fe||(fe={}));function OE(n){return typeof n.code=="string"}class _x{constructor(){j(this,"messages");this.messages=new Map,this.messages.set(fe.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(fe.BadJson,"Bad JSON"),this.messages.set(fe.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(e){return AE.getMessage(e)}getMessage(e){return this.messages.get(e)||e}}const AE=new _x;class be extends Error{constructor(s,i,o){super(s);j(this,"name");j(this,"message");j(this,"code");j(this,"permissionContext");j(this,"chainedError");j(this,"api_error");this.name="NatsError",this.message=s,this.code=i,this.chainedError=o}static errorForCode(s,i){const o=_x.getMessage(s);return new be(o,s,i)}isAuthError(){return this.code===fe.AuthenticationExpired||this.code===fe.AuthorizationViolation||this.code===fe.AccountExpired}isAuthTimeout(){return this.code===fe.AuthenticationTimeout}isPermissionError(){return this.code===fe.PermissionsViolation}isProtocolError(){return this.code===fe.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var wn;(function(n){n[n.Exact=0]="Exact",n[n.CanonicalMIME=1]="CanonicalMIME",n[n.IgnoreCase=2]="IgnoreCase"})(wn||(wn={}));var Zn;(function(n){n.Timer="timer",n.Count="count",n.JitterTimer="jitterTimer",n.SentinelMsg="sentinelMsg"})(Zn||(Zn={}));var So;(function(n){n.STATS="io.nats.micro.v1.stats_response",n.INFO="io.nats.micro.v1.info_response",n.PING="io.nats.micro.v1.ping_response"})(So||(So={}));const fu="Nats-Service-Error",hu="Nats-Service-Error-Code";class du extends Error{constructor(s,i){super(i);j(this,"code");this.code=s}static isServiceError(s){return du.toServiceError(s)!==null}static toServiceError(s){var o,c;const i=((o=s==null?void 0:s.headers)==null?void 0:o.get(hu))||"";if(i!==""){const d=parseInt(i)||400,p=((c=s==null?void 0:s.headers)==null?void 0:c.get(fu))||"";return new du(d,p.length?p:i)}return null}}function Lr(n=""){if(n=n||"_INBOX",typeof n!="string")throw new Error("prefix must be a string");return n.split(".").forEach(e=>{if(e==="*"||e===">")throw new Error(`inbox prefixes cannot have wildcards '${n}'`)}),`${n}.${js.next()}`}const Od="127.0.0.1";var ws;(function(n){n.PING="PING",n.STATS="STATS",n.INFO="INFO"})(ws||(ws={}));function Au(n,...e){for(let s=0;s<e.length;s++){const i=e[s];Object.keys(i).forEach(function(o){n[o]=i[o]})}return n}function oc(n){return En.decode(n).replace(/\n/g,"␊").replace(/\r/g,"␍")}function ia(n,e=!0){const s=e?be.errorForCode(fe.Timeout):null;let i,o;const c=new Promise((d,p)=>{i={cancel:()=>{o&&clearTimeout(o)}},o=setTimeout(()=>{p(s===null?be.errorForCode(fe.Timeout):s)},n)});return Object.assign(c,i)}function la(n=0){let e;const s=new Promise(i=>{const o=setTimeout(()=>{i()},n);e={cancel:()=>{o&&clearTimeout(o)}}});return Object.assign(s,e)}function dt(){let n={};const e=new Promise((s,i)=>{n={resolve:s,reject:i}});return Object.assign(e,n)}function wx(n){for(let e=n.length-1;e>0;e--){const s=Math.floor(Math.random()*(e+1));[n[e],n[s]]=[n[s],n[e]]}return n}function jE(n){return n===0?0:Math.floor(n/2+Math.random()*n)}function dm(n=[0,250,250,500,500,3e3,5e3]){Array.isArray(n)||(n=[0,250,250,500,500,3e3,5e3]);const e=n.length-1;return{backoff(s){return jE(s>e?n[e]:n[s])}}}function ht(n){return n*1e6}function mm(n){return Math.floor(n/1e6)}function nb(n){let i=!0;const o=new Array(n.length);for(let c=0;c<n.length;c++){let d=n.charCodeAt(c);if(d===58||d<33||d>126)throw new be(`'${n[c]}' is not a valid character for a header key`,fe.BadHeader);i&&97<=d&&d<=122?d-=32:!i&&65<=d&&d<=90&&(d+=32),o[c]=d,i=d==45}return String.fromCharCode(...o)}function Pr(n=0,e=""){if(n===0&&e!==""||n>0&&e==="")throw new Error("setting status requires both code and description");return new Ss(n,e)}const ed="NATS/1.0";class Ss{constructor(e=0,s=""){j(this,"_code");j(this,"headers");j(this,"_description");this._code=e,this._description=s,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(e){if(e&&this.headers.size===e.headers.size&&this._code===e._code){for(const[s,i]of this.headers){const o=e.values(s);if(i.length!==o.length)return!1;const c=[...i].sort(),d=[...o].sort();for(let p=0;p<c.length;p++)if(c[p]!==d[p])return!1}return!0}return!1}static decode(e){const s=new Ss,o=En.decode(e).split(`\r
27
+ `),c=o[0];if(c!==ed){let d=c.replace(ed,"").trim();if(d.length>0){s._code=parseInt(d,10),isNaN(s._code)&&(s._code=0);const p=s._code.toString();d=d.replace(p,""),s._description=d.trim()}}return o.length>=1&&o.slice(1).map(d=>{if(d){const p=d.indexOf(":");if(p>-1){const g=d.slice(0,p),u=d.slice(p+1).trim();s.append(g,u)}}}),s}toString(){if(this.headers.size===0&&this._code===0)return"";let e=ed;this._code>0&&this._description!==""&&(e+=` ${this._code} ${this._description}`);for(const[s,i]of this.headers)for(let o=0;o<i.length;o++)e=`${e}\r
28
+ ${s}: ${i[o]}`;return`${e}\r
29
+ \r
30
+ `}encode(){return si.encode(this.toString())}static validHeaderValue(e){if(/[\r\n]/.test(e))throw new be("invalid header value - \\r and \\n are not allowed.",fe.BadHeader);return e.trim()}keys(){const e=[];for(const s of this.headers.keys())e.push(s);return e}findKeys(e,s=wn.Exact){const i=this.keys();switch(s){case wn.Exact:return i.filter(o=>o===e);case wn.CanonicalMIME:return e=nb(e),i.filter(o=>o===e);default:{const o=e.toLowerCase();return i.filter(c=>o===c.toLowerCase())}}}get(e,s=wn.Exact){const i=this.findKeys(e,s);if(i.length){const o=this.headers.get(i[0]);if(o)return Array.isArray(o)?o[0]:o}return""}last(e,s=wn.Exact){const i=this.findKeys(e,s);if(i.length){const o=this.headers.get(i[0]);if(o)return Array.isArray(o)?o[o.length-1]:o}return""}has(e,s=wn.Exact){return this.findKeys(e,s).length>0}set(e,s,i=wn.Exact){this.delete(e,i),this.append(e,s,i)}append(e,s,i=wn.Exact){const o=nb(e);i===wn.CanonicalMIME&&(e=o);const c=this.findKeys(e,i);e=c.length>0?c[0]:e;const d=Ss.validHeaderValue(s);let p=this.headers.get(e);p||(p=[],this.headers.set(e,p)),p.push(d)}values(e,s=wn.Exact){const i=[];return this.findKeys(e,s).forEach(c=>{const d=this.headers.get(c);d&&i.push(...d)}),i}delete(e,s=wn.Exact){this.findKeys(e,s).forEach(o=>{this.headers.delete(o)})}get hasError(){return this._code>=300}get status(){return`${this._code} ${this._description}`.trim()}toRecord(){const e={};return this.keys().forEach(s=>{e[s]=this.values(s)}),e}get code(){return this._code}get description(){return this._description}static fromRecord(e){const s=new Ss;for(const i in e)s.headers.set(i,e[i]);return s}}function Ad(){return{encode(n){return si.encode(n)},decode(n){return En.decode(n)}}}function er(n){return{encode(e){try{return e===void 0&&(e=null),si.encode(JSON.stringify(e))}catch(s){throw be.errorForCode(fe.BadJson,s)}},decode(e){try{return JSON.parse(En.decode(e),n)}catch(s){throw be.errorForCode(fe.BadJson,s)}}}}function Sx(n){var e;return n&&n.data.length===0&&((e=n.headers)==null?void 0:e.code)===503?be.errorForCode(fe.NoResponders):null}class pm{constructor(e,s,i){j(this,"_headers");j(this,"_msg");j(this,"_rdata");j(this,"_reply");j(this,"_subject");j(this,"publisher");this._msg=e,this._rdata=s,this.publisher=i}get subject(){return this._subject?this._subject:(this._subject=En.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=En.decode(this._msg.reply),this._reply)}get sid(){return this._msg.sid}get headers(){if(this._msg.hdr>-1&&!this._headers){const e=this._rdata.subarray(0,this._msg.hdr);this._headers=Ss.decode(e)}return this._headers}get data(){return this._rdata?this._msg.hdr>-1?this._rdata.subarray(this._msg.hdr):this._rdata:new Uint8Array(0)}respond(e=jn,s){return this.reply?(this.publisher.publish(this.reply,e,s),!0):!1}size(){var o;const e=this._msg.subject.length,s=((o=this._msg.reply)==null?void 0:o.length)||0,i=this._msg.size===-1?0:this._msg.size;return e+s+i}json(e){return er(e).decode(this.data)}string(){return En.decode(this.data)}requestInfo(){var s;const e=(s=this.headers)==null?void 0:s.get("Nats-Request-Info");return e?JSON.parse(e,function(i,o){return(i==="start"||i==="stop")&&o!==""?new Date(Date.parse(o)):o}):null}}j(pm,"jc");function Wi(n){return ju("durable",n)}function Qt(n){return ju("stream",n)}function ju(n,e=""){if(e==="")throw Error(`${n} name required`);return[".","*",">","/","\\"," "," ",`
31
+ `,"\r"].forEach(i=>{if(e.indexOf(i)!==-1){switch(i){case`
32
+ `:i="\\n";break;case"\r":i="\\r";break;case" ":i="\\t";break}throw Error(`invalid ${n} name - ${n} name cannot contain '${i}'`)}}),""}function xo(n,e=""){if(e==="")throw Error(`${n} name required`);const s=kE(e);if(s.length)throw new Error(`invalid ${n} name - ${n} name ${s}`)}function kE(n=""){if(n==="")throw Error("name required");const e=/^[-\w]+$/g;if(n.match(e)===null){for(const i of n.split(""))if(i.match(e)===null)return`cannot contain '${i}'`}return""}function jd(n){if(n.data.length>0)return!1;const e=n.headers;return e?e.code>=100&&e.code<200:!1}function kd(n){var e;return jd(n)&&((e=n.headers)==null?void 0:e.description)==="Idle Heartbeat"}function NE(n,e,s){const i=Pr(n,e),o={hdr:1,sid:0,size:0},c=new pm(o,jn,{});return c._headers=i,c._subject=s,c}function Zi(n){if(n.data.length!==0)return null;const e=n.headers;return e?Ex(e.code,e.description):null}var $n;(function(n){n.MaxBatchExceeded="exceeded maxrequestbatch of",n.MaxExpiresExceeded="exceeded maxrequestexpires of",n.MaxBytesExceeded="exceeded maxrequestmaxbytes of",n.MaxMessageSizeExceeded="message size exceeds maxbytes",n.PushConsumer="consumer is push based",n.MaxWaitingExceeded="exceeded maxwaiting",n.IdleHeartbeatMissed="idle heartbeats missed",n.ConsumerDeleted="consumer deleted"})($n||($n={}));function TE(n){return n.code!==fe.JetStream409?!1:[$n.MaxBatchExceeded,$n.MaxExpiresExceeded,$n.MaxBytesExceeded,$n.MaxMessageSizeExceeded,$n.PushConsumer,$n.IdleHeartbeatMissed,$n.ConsumerDeleted].find(s=>n.message.indexOf(s)!==-1)!==void 0}function Ex(n,e=""){if(n<300)return null;switch(e=e.toLowerCase(),n){case 404:return new be(e,fe.JetStream404NoMessages);case 408:return new be(e,fe.JetStream408RequestTimeout);case 409:{const s=e.startsWith($n.IdleHeartbeatMissed)?fe.JetStreamIdleHeartBeat:fe.JetStream409;return new be(e,s)}case 503:return be.errorForCode(fe.JetStreamNotEnabled,new Error(e));default:return e===""&&(e=fe.Unknown),new be(e,`${n}`)}}class Ut{constructor(){j(this,"inflight");j(this,"processed");j(this,"received");j(this,"noIterator");j(this,"iterClosed");j(this,"done");j(this,"signal");j(this,"yields");j(this,"filtered");j(this,"pendingFiltered");j(this,"ingestionFilterFn");j(this,"protocolFilterFn");j(this,"dispatchedFn");j(this,"ctx");j(this,"_data");j(this,"err");j(this,"time");j(this,"yielding");this.inflight=0,this.filtered=0,this.pendingFiltered=0,this.processed=0,this.received=0,this.noIterator=!1,this.done=!1,this.signal=dt(),this.yields=[],this.iterClosed=dt(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(e){if(this.done)return;if(typeof e=="function"){this.yields.push(e),this.signal.resolve();return}const{ingest:s,protocol:i}=this.ingestionFilterFn?this.ingestionFilterFn(e,this.ctx||this):{ingest:!0,protocol:!1};s&&(i&&(this.filtered++,this.pendingFiltered++),this.yields.push(e),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new be("unsupported iterator",fe.ApiError);if(this.yielding)throw new be("already yielding",fe.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const e=this.yields;this.inflight=e.length,this.yields=[];for(let s=0;s<e.length;s++){if(typeof e[s]=="function"){const o=e[s];try{o()}catch(c){throw c}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(e[s]):!0){this.processed++;const o=Date.now();yield e[s],this.time=Date.now()-o,this.dispatchedFn&&e[s]&&this.dispatchedFn(e[s])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(e.length=0,this.yields=e,this.signal=dt())}}finally{this.stop()}}stop(e){this.done||(this.err=e,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(e))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class ym{constructor(e,s,i={maxOut:2}){j(this,"interval");j(this,"maxOut");j(this,"cancelAfter");j(this,"timer");j(this,"autoCancelTimer");j(this,"last");j(this,"missed");j(this,"count");j(this,"callback");this.interval=e,this.maxOut=(i==null?void 0:i.maxOut)||2,this.cancelAfter=(i==null?void 0:i.cancelAfter)||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=s,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(e,s=0,i=2){this.interval=e,this.maxOut=i,this.cancelAfter=s,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(e){console.log(e)}},this.interval)}}var Nd;(function(n){n.Limits="limits",n.Interest="interest",n.Workqueue="workqueue"})(Nd||(Nd={}));var jo;(function(n){n.Old="old",n.New="new"})(jo||(jo={}));var Td;(function(n){n.File="file",n.Memory="memory"})(Td||(Td={}));var Et;(function(n){n.All="all",n.Last="last",n.New="new",n.StartSequence="by_start_sequence",n.StartTime="by_start_time",n.LastPerSubject="last_per_subject"})(Et||(Et={}));var Bt;(function(n){n.None="none",n.All="all",n.Explicit="explicit",n.NotSet=""})(Bt||(Bt={}));var aa;(function(n){n.Instant="instant",n.Original="original"})(aa||(aa={}));var ks;(function(n){n.None="none",n.S2="s2"})(ks||(ks={}));var mu;(function(n){n.CreateOrUpdate="",n.Update="update",n.Create="create"})(mu||(mu={}));function CE(n,e={}){return Object.assign({name:n,deliver_policy:Et.All,ack_policy:Bt.Explicit,ack_wait:ht(30*1e3),replay_policy:aa.Instant},e)}var rb;(function(n){n.API="api_audit",n.StreamAction="stream_action",n.ConsumerAction="consumer_action",n.SnapshotCreate="snapshot_create",n.SnapshotComplete="snapshot_complete",n.RestoreCreate="restore_create",n.RestoreComplete="restore_complete",n.MaxDeliver="max_deliver",n.Terminated="terminated",n.Ack="consumer_ack",n.StreamLeaderElected="stream_leader_elected",n.StreamQuorumLost="stream_quorum_lost",n.ConsumerLeaderElected="consumer_leader_elected",n.ConsumerQuorumLost="consumer_quorum_lost"})(rb||(rb={}));var Zt;(function(n){n.StreamSourceHdr="Nats-Stream-Source",n.LastConsumerSeqHdr="Nats-Last-Consumer",n.LastStreamSeqHdr="Nats-Last-Stream",n.ConsumerStalledHdr="Nats-Consumer-Stalled",n.MessageSizeHdr="Nats-Msg-Size",n.RollupHdr="Nats-Rollup",n.RollupValueSubject="sub",n.RollupValueAll="all",n.PendingMessagesHdr="Nats-Pending-Messages",n.PendingBytesHdr="Nats-Pending-Bytes"})(Zt||(Zt={}));var Xn;(function(n){n.LastValue="",n.AllHistory="history",n.UpdatesOnly="updates"})(Xn||(Xn={}));var Qi;(function(n){n.Stream="Nats-Stream",n.Sequence="Nats-Sequence",n.TimeStamp="Nats-Time-Stamp",n.Subject="Nats-Subject"})(Qi||(Qi={}));var sb;(function(n){n.Stream="Nats-Stream",n.Subject="Nats-Subject",n.Sequence="Nats-Sequence",n.LastSequence="Nats-Last-Sequence",n.Size="Nats-Msg-Size"})(sb||(sb={}));const Sn="KV_";class ME{constructor(e){j(this,"config");j(this,"ordered");j(this,"mack");j(this,"stream");j(this,"callbackFn");j(this,"max");j(this,"qname");j(this,"isBind");j(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=CE("",e||{})}getOpts(){var s;const e={};if(e.config=Object.assign({},this.config),e.config.filter_subject&&(this.filterSubject(e.config.filter_subject),e.config.filter_subject=void 0),e.config.filter_subjects&&((s=e.config.filter_subjects)==null||s.forEach(i=>{this.filterSubject(i)}),e.config.filter_subjects=void 0),e.mack=this.mack,e.stream=this.stream,e.callbackFn=this.callbackFn,e.max=this.max,e.queue=this.qname,e.ordered=this.ordered,e.config.ack_policy=e.ordered?Bt.None:e.config.ack_policy,e.isBind=e.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:e.config.filter_subject=this.filters[0];break;default:e.config.filter_subjects=this.filters}return e}description(e){return this.config.description=e,this}deliverTo(e){return this.config.deliver_subject=e,this}durable(e){return Wi(e),this.config.durable_name=e,this}startSequence(e){if(e<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=Et.StartSequence,this.config.opt_start_seq=e,this}startTime(e){return this.config.deliver_policy=Et.StartTime,this.config.opt_start_time=e.toISOString(),this}deliverAll(){return this.config.deliver_policy=Et.All,this}deliverLastPerSubject(){return this.config.deliver_policy=Et.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=Et.Last,this}deliverNew(){return this.config.deliver_policy=Et.New,this}startAtTimeDelta(e){return this.startTime(new Date(Date.now()-e)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=Bt.None,this}ackAll(){return this.config.ack_policy=Bt.All,this}ackExplicit(){return this.config.ack_policy=Bt.Explicit,this}ackWait(e){return this.config.ack_wait=ht(e),this}maxDeliver(e){return this.config.max_deliver=e,this}filterSubject(e){return this.filters=this.filters||[],this.filters.push(e),this}replayInstantly(){return this.config.replay_policy=aa.Instant,this}replayOriginal(){return this.config.replay_policy=aa.Original,this}sample(e){if(e=Math.trunc(e),e<0||e>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${e}%`,this}limit(e){return this.config.rate_limit_bps=e,this}maxWaiting(e){return this.config.max_waiting=e,this}maxAckPending(e){return this.config.max_ack_pending=e,this}idleHeartbeat(e){return this.config.idle_heartbeat=ht(e),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(e){return this.queue(e),this}manualAck(){return this.mack=!0,this}maxMessages(e){return this.max=e,this}callback(e){return this.callbackFn=e,this}queue(e){return this.qname=e,this.config.deliver_group=e,this}orderedConsumer(){return this.ordered=!0,this}bind(e,s){return this.stream=e,this.config.durable_name=s,this.isBind=!0,this}bindStream(e){return this.stream=e,this}inactiveEphemeralThreshold(e){return this.config.inactive_threshold=ht(e),this}maxPullBatch(e){return this.config.max_batch=e,this}maxPullRequestExpires(e){return this.config.max_expires=ht(e),this}memory(){return this.config.mem_storage=!0,this}numReplicas(e){return this.config.num_replicas=e,this}consumerName(e){return this.config.name=e,this}}function Es(n){return new ME(n)}function ib(n){return typeof n.getOpts=="function"}class RE{static encode(e){if(typeof e=="string")return btoa(e);const s=Array.from(e);return btoa(String.fromCharCode(...s))}static decode(e,s=!1){const i=atob(e);return s?Uint8Array.from(i,o=>o.charCodeAt(0)):i}}class ea{static encode(e){return ea.toB64URLEncoding(RE.encode(e))}static decode(e,s=!1){return ea.decode(ea.fromB64URLEncoding(e),s)}static toB64URLEncoding(e){return e.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(e){return e.replace(/_/g,"/").replace(/-/g,"+")}}class oa{constructor(){j(this,"buffers");j(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...e){let s=0;for(let c=0;c<e.length;c++)s+=e[c].length;const i=new Uint8Array(s);let o=0;for(let c=0;c<e.length;c++)i.set(e[c],o),o+=e[c].length;return i}static fromAscii(e){return e||(e=""),si.encode(e)}static toAscii(e){return En.decode(e)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const e=new Uint8Array(this.byteLength);let s=0;for(let i=0;i<this.buffers.length;i++)e.set(this.buffers[i],s),s+=this.buffers[i].length;this.buffers.length=0,this.buffers.push(e)}}shift(){if(this.buffers.length){const e=this.buffers.shift();if(e)return this.byteLength-=e.length,e}return new Uint8Array(0)}drain(e){if(this.buffers.length){this.pack();const s=this.buffers.pop();if(s){const i=this.byteLength;(e===void 0||e>i)&&(e=i);const o=s.subarray(0,e);return i>e&&this.buffers.push(s.subarray(e)),this.byteLength=i-e,o}}return new Uint8Array(0)}fill(e,...s){e&&(this.buffers.push(e),this.byteLength+=e.length);for(let i=0;i<s.length;i++)s[i]&&s[i].length&&(this.buffers.push(s[i]),this.byteLength+=s[i].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function DE(n,e){return e.forEach(function(s){s&&typeof s!="string"&&!Array.isArray(s)&&Object.keys(s).forEach(function(i){if(i!=="default"&&!(i in n)){var o=Object.getOwnPropertyDescriptor(s,i);Object.defineProperty(n,i,o.get?o:{enumerable:!0,get:function(){return s[i]}})}})}),Object.freeze(n)}var LE=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},ao=LE.performance||{};ao.now||ao.mozNow||ao.msNow||ao.oNow||ao.webkitNow;var ab={versions:{}},qE=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function PE(n){if(n.__esModule)return n;var e=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(n).forEach(function(s){var i=Object.getOwnPropertyDescriptor(n,s);Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:function(){return n[s]}})}),e}var td,ku={exports:{}},ob={},lb=PE(DE({__proto__:null,default:ob},[ob]));td=ku,(function(){var n="input is invalid type",e=typeof window=="object",s=e?window:{};s.JS_SHA256_NO_WINDOW&&(e=!1);var i=!e&&typeof self=="object",o=!s.JS_SHA256_NO_NODE_JS&&ab.versions&&ab.versions.node;o?s=qE:i&&(s=self);var c=!s.JS_SHA256_NO_COMMON_JS&&td.exports,d=!s.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",p="0123456789abcdef".split(""),g=[-2147483648,8388608,32768,128],u=[24,16,8,0],m=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],b=["hex","array","digest","arrayBuffer"],x=[];!s.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(M){return Object.prototype.toString.call(M)==="[object Array]"}),!d||!s.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(M){return typeof M=="object"&&M.buffer&&M.buffer.constructor===ArrayBuffer});var v=function(M,z){return function(ae){return new q(z,!0).update(ae)[M]()}},_=function(M){var z=v("hex",M);o&&(z=S(z,M)),z.create=function(){return new q(M)},z.update=function(U){return z.create().update(U)};for(var ae=0;ae<b.length;++ae){var F=b[ae];z[F]=v(F,M)}return z},S=function(M,z){var ae,F=lb,U=lb.Buffer,D=z?"sha224":"sha256";return ae=U.from&&!s.JS_SHA256_NO_BUFFER_FROM?U.from:function(Q){return new U(Q)},function(Q){if(typeof Q=="string")return F.createHash(D).update(Q,"utf8").digest("hex");if(Q==null)throw new Error(n);return Q.constructor===ArrayBuffer&&(Q=new Uint8Array(Q)),Array.isArray(Q)||ArrayBuffer.isView(Q)||Q.constructor===U?F.createHash(D).update(ae(Q)).digest("hex"):M(Q)}},C=function(M,z){return function(ae,F){return new ne(ae,z,!0).update(F)[M]()}},B=function(M){var z=C("hex",M);z.create=function(U){return new ne(U,M)},z.update=function(U,D){return z.create(U).update(D)};for(var ae=0;ae<b.length;++ae){var F=b[ae];z[F]=C(F,M)}return z};function q(M,z){z?(x[0]=x[16]=x[1]=x[2]=x[3]=x[4]=x[5]=x[6]=x[7]=x[8]=x[9]=x[10]=x[11]=x[12]=x[13]=x[14]=x[15]=0,this.blocks=x):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],M?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=M}function ne(M,z,ae){var F,U=typeof M;if(U==="string"){var D,Q=[],W=M.length,he=0;for(F=0;F<W;++F)(D=M.charCodeAt(F))<128?Q[he++]=D:D<2048?(Q[he++]=192|D>>>6,Q[he++]=128|63&D):D<55296||D>=57344?(Q[he++]=224|D>>>12,Q[he++]=128|D>>>6&63,Q[he++]=128|63&D):(D=65536+((1023&D)<<10|1023&M.charCodeAt(++F)),Q[he++]=240|D>>>18,Q[he++]=128|D>>>12&63,Q[he++]=128|D>>>6&63,Q[he++]=128|63&D);M=Q}else{if(U!=="object")throw new Error(n);if(M===null)throw new Error(n);if(d&&M.constructor===ArrayBuffer)M=new Uint8Array(M);else if(!(Array.isArray(M)||d&&ArrayBuffer.isView(M)))throw new Error(n)}M.length>64&&(M=new q(z,!0).update(M).array());var Ee=[],Ae=[];for(F=0;F<64;++F){var H=M[F]||0;Ee[F]=92^H,Ae[F]=54^H}q.call(this,z,ae),this.update(Ae),this.oKeyPad=Ee,this.inner=!0,this.sharedMemory=ae}q.prototype.update=function(M){if(!this.finalized){var z,ae=typeof M;if(ae!=="string"){if(ae!=="object")throw new Error(n);if(M===null)throw new Error(n);if(d&&M.constructor===ArrayBuffer)M=new Uint8Array(M);else if(!(Array.isArray(M)||d&&ArrayBuffer.isView(M)))throw new Error(n);z=!0}for(var F,U,D=0,Q=M.length,W=this.blocks;D<Q;){if(this.hashed&&(this.hashed=!1,W[0]=this.block,this.block=W[16]=W[1]=W[2]=W[3]=W[4]=W[5]=W[6]=W[7]=W[8]=W[9]=W[10]=W[11]=W[12]=W[13]=W[14]=W[15]=0),z)for(U=this.start;D<Q&&U<64;++D)W[U>>>2]|=M[D]<<u[3&U++];else for(U=this.start;D<Q&&U<64;++D)(F=M.charCodeAt(D))<128?W[U>>>2]|=F<<u[3&U++]:F<2048?(W[U>>>2]|=(192|F>>>6)<<u[3&U++],W[U>>>2]|=(128|63&F)<<u[3&U++]):F<55296||F>=57344?(W[U>>>2]|=(224|F>>>12)<<u[3&U++],W[U>>>2]|=(128|F>>>6&63)<<u[3&U++],W[U>>>2]|=(128|63&F)<<u[3&U++]):(F=65536+((1023&F)<<10|1023&M.charCodeAt(++D)),W[U>>>2]|=(240|F>>>18)<<u[3&U++],W[U>>>2]|=(128|F>>>12&63)<<u[3&U++],W[U>>>2]|=(128|F>>>6&63)<<u[3&U++],W[U>>>2]|=(128|63&F)<<u[3&U++]);this.lastByteIndex=U,this.bytes+=U-this.start,U>=64?(this.block=W[16],this.start=U-64,this.hash(),this.hashed=!0):this.start=U}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},q.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var M=this.blocks,z=this.lastByteIndex;M[16]=this.block,M[z>>>2]|=g[3&z],this.block=M[16],z>=56&&(this.hashed||this.hash(),M[0]=this.block,M[16]=M[1]=M[2]=M[3]=M[4]=M[5]=M[6]=M[7]=M[8]=M[9]=M[10]=M[11]=M[12]=M[13]=M[14]=M[15]=0),M[14]=this.hBytes<<3|this.bytes>>>29,M[15]=this.bytes<<3,this.hash()}},q.prototype.hash=function(){var M,z,ae,F,U,D,Q,W,he,Ee=this.h0,Ae=this.h1,H=this.h2,J=this.h3,ce=this.h4,pe=this.h5,ge=this.h6,Ce=this.h7,Ne=this.blocks;for(M=16;M<64;++M)z=((U=Ne[M-15])>>>7|U<<25)^(U>>>18|U<<14)^U>>>3,ae=((U=Ne[M-2])>>>17|U<<15)^(U>>>19|U<<13)^U>>>10,Ne[M]=Ne[M-16]+z+Ne[M-7]+ae|0;for(he=Ae&H,M=0;M<64;M+=4)this.first?(this.is224?(D=300032,Ce=(U=Ne[0]-1413257819)-150054599|0,J=U+24177077|0):(D=704751109,Ce=(U=Ne[0]-210244248)-1521486534|0,J=U+143694565|0),this.first=!1):(z=(Ee>>>2|Ee<<30)^(Ee>>>13|Ee<<19)^(Ee>>>22|Ee<<10),F=(D=Ee&Ae)^Ee&H^he,Ce=J+(U=Ce+(ae=(ce>>>6|ce<<26)^(ce>>>11|ce<<21)^(ce>>>25|ce<<7))+(ce&pe^~ce&ge)+m[M]+Ne[M])|0,J=U+(z+F)|0),z=(J>>>2|J<<30)^(J>>>13|J<<19)^(J>>>22|J<<10),F=(Q=J&Ee)^J&Ae^D,ge=H+(U=ge+(ae=(Ce>>>6|Ce<<26)^(Ce>>>11|Ce<<21)^(Ce>>>25|Ce<<7))+(Ce&ce^~Ce&pe)+m[M+1]+Ne[M+1])|0,z=((H=U+(z+F)|0)>>>2|H<<30)^(H>>>13|H<<19)^(H>>>22|H<<10),F=(W=H&J)^H&Ee^Q,pe=Ae+(U=pe+(ae=(ge>>>6|ge<<26)^(ge>>>11|ge<<21)^(ge>>>25|ge<<7))+(ge&Ce^~ge&ce)+m[M+2]+Ne[M+2])|0,z=((Ae=U+(z+F)|0)>>>2|Ae<<30)^(Ae>>>13|Ae<<19)^(Ae>>>22|Ae<<10),F=(he=Ae&H)^Ae&J^W,ce=Ee+(U=ce+(ae=(pe>>>6|pe<<26)^(pe>>>11|pe<<21)^(pe>>>25|pe<<7))+(pe&ge^~pe&Ce)+m[M+3]+Ne[M+3])|0,Ee=U+(z+F)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+Ee|0,this.h1=this.h1+Ae|0,this.h2=this.h2+H|0,this.h3=this.h3+J|0,this.h4=this.h4+ce|0,this.h5=this.h5+pe|0,this.h6=this.h6+ge|0,this.h7=this.h7+Ce|0},q.prototype.hex=function(){this.finalize();var M=this.h0,z=this.h1,ae=this.h2,F=this.h3,U=this.h4,D=this.h5,Q=this.h6,W=this.h7,he=p[M>>>28&15]+p[M>>>24&15]+p[M>>>20&15]+p[M>>>16&15]+p[M>>>12&15]+p[M>>>8&15]+p[M>>>4&15]+p[15&M]+p[z>>>28&15]+p[z>>>24&15]+p[z>>>20&15]+p[z>>>16&15]+p[z>>>12&15]+p[z>>>8&15]+p[z>>>4&15]+p[15&z]+p[ae>>>28&15]+p[ae>>>24&15]+p[ae>>>20&15]+p[ae>>>16&15]+p[ae>>>12&15]+p[ae>>>8&15]+p[ae>>>4&15]+p[15&ae]+p[F>>>28&15]+p[F>>>24&15]+p[F>>>20&15]+p[F>>>16&15]+p[F>>>12&15]+p[F>>>8&15]+p[F>>>4&15]+p[15&F]+p[U>>>28&15]+p[U>>>24&15]+p[U>>>20&15]+p[U>>>16&15]+p[U>>>12&15]+p[U>>>8&15]+p[U>>>4&15]+p[15&U]+p[D>>>28&15]+p[D>>>24&15]+p[D>>>20&15]+p[D>>>16&15]+p[D>>>12&15]+p[D>>>8&15]+p[D>>>4&15]+p[15&D]+p[Q>>>28&15]+p[Q>>>24&15]+p[Q>>>20&15]+p[Q>>>16&15]+p[Q>>>12&15]+p[Q>>>8&15]+p[Q>>>4&15]+p[15&Q];return this.is224||(he+=p[W>>>28&15]+p[W>>>24&15]+p[W>>>20&15]+p[W>>>16&15]+p[W>>>12&15]+p[W>>>8&15]+p[W>>>4&15]+p[15&W]),he},q.prototype.toString=q.prototype.hex,q.prototype.digest=function(){this.finalize();var M=this.h0,z=this.h1,ae=this.h2,F=this.h3,U=this.h4,D=this.h5,Q=this.h6,W=this.h7,he=[M>>>24&255,M>>>16&255,M>>>8&255,255&M,z>>>24&255,z>>>16&255,z>>>8&255,255&z,ae>>>24&255,ae>>>16&255,ae>>>8&255,255&ae,F>>>24&255,F>>>16&255,F>>>8&255,255&F,U>>>24&255,U>>>16&255,U>>>8&255,255&U,D>>>24&255,D>>>16&255,D>>>8&255,255&D,Q>>>24&255,Q>>>16&255,Q>>>8&255,255&Q];return this.is224||he.push(W>>>24&255,W>>>16&255,W>>>8&255,255&W),he},q.prototype.array=q.prototype.digest,q.prototype.arrayBuffer=function(){this.finalize();var M=new ArrayBuffer(this.is224?28:32),z=new DataView(M);return z.setUint32(0,this.h0),z.setUint32(4,this.h1),z.setUint32(8,this.h2),z.setUint32(12,this.h3),z.setUint32(16,this.h4),z.setUint32(20,this.h5),z.setUint32(24,this.h6),this.is224||z.setUint32(28,this.h7),M},ne.prototype=new q,ne.prototype.finalize=function(){if(q.prototype.finalize.call(this),this.inner){this.inner=!1;var M=this.array();q.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(M),q.prototype.finalize.call(this)}};var te=_();te.sha256=te,te.sha224=_(!0),te.sha256.hmac=B(),te.sha224.hmac=B(!0),c?td.exports=te:(s.sha256=te.sha256,s.sha224=te.sha224)})();ku.exports;ku.exports.sha224;var cb=ku.exports.sha256;function Cd(n){return HE(n)}function BE(n){if(!/^[0-9A-Fa-f]+$/.test(n))return!1;const s=/^[0-9A-F]+$/.test(n),i=/^[0-9a-f]+$/.test(n);return s||i?n.length%2===0:!1}function UE(n){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(n)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(n)}function zE(n){return BE(n)?"hex":UE(n)?"b64":""}function $E(n){if(n.length%2!==0)throw new Error("hex string must have an even length");const e=new Uint8Array(n.length/2);for(let s=0;s<n.length;s+=2)e[s/2]=parseInt(n.substring(s,s+2),16);return e}function IE(n){n=n.replace(/-/g,"+"),n=n.replace(/_/g,"/");const e=atob(n);return Uint8Array.from(e,s=>s.charCodeAt(0))}function HE(n){switch(zE(n)){case"hex":return $E(n);case"b64":return IE(n)}return null}function FE(n,e){const s=typeof n=="string"?Cd(n):n,i=typeof e=="string"?Cd(e):e;if(s===null||i===null||s.length!==i.length)return!1;for(let o=0;o<s.length;o++)if(s[o]!==i[o])return!1;return!0}class Ox{constructor(e,s,i=!0){j(this,"token");j(this,"received");j(this,"ctx");j(this,"requestSubject");j(this,"mux");this.mux=e,this.requestSubject=s,this.received=0,this.token=js.next(),i&&(this.ctx=new Error)}}class GE extends Ox{constructor(s,i,o={maxWait:1e3}){super(s,i);j(this,"callback");j(this,"done");j(this,"timer");j(this,"max");j(this,"opts");if(this.opts=o,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof o.maxMessages=="number"&&o.maxMessages>0?o.maxMessages:-1,this.done=dt(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},o.maxWait)}cancel(s){s&&this.callback(s,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(s,i){s?(this.ctx&&(s.stack+=`
33
+
34
+ ${this.ctx.stack}`),this.cancel(s)):(this.callback(null,i),this.opts.strategy===Zn.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===Zn.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===Zn.SentinelMsg&&i&&i.data.length===0&&this.cancel())}}class Ax extends Ox{constructor(s,i,o={timeout:1e3},c=!0){super(s,i,c);j(this,"deferred");j(this,"timer");this.deferred=dt(),this.timer=ia(o.timeout,c)}resolver(s,i){this.timer&&this.timer.cancel(),s?(this.ctx&&(s.stack+=`
35
+
36
+ ${this.ctx.stack}`),this.deferred.reject(s)):this.deferred.resolve(i),this.cancel()}cancel(s){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(s||be.errorForCode(fe.Cancelled))}}const VE="$JS.API";function YE(n){return n=n||{},n.domain&&(n.apiPrefix=`$JS.${n.domain}.API`,delete n.domain),Au({apiPrefix:VE,timeout:5e3},n)}class Do{constructor(e,s){j(this,"nc");j(this,"opts");j(this,"prefix");j(this,"timeout");j(this,"jc");this.nc=e,this.opts=YE(s),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=er()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let e=this.opts.apiPrefix;if(!e||e.length===0)throw new Error("invalid empty prefix");e[e.length-1]==="."&&(e=e.substr(0,e.length-1)),this.opts.apiPrefix=e}async _request(e,s=null,i){i=i||{},i.timeout=this.timeout;let o=jn;s&&(o=this.jc.encode(s));let{retries:c}=i;c=c||1,c=c===-1?Number.MAX_SAFE_INTEGER:c;const d=dm();for(let p=0;p<c;p++)try{const g=await this.nc.request(e,o,i);return this.parseJsResponse(g)}catch(g){const u=g;if((u.code==="503"||u.code===fe.Timeout)&&p+1<c)await la(d.backoff(p));else throw g}}async findStream(e){const s={subject:e},o=await this._request(`${this.prefix}.STREAM.NAMES`,s);if(!o.streams||o.streams.length!==1)throw new Error("no stream matches subject");return o.streams[0]}getConnection(){return this.nc}parseJsResponse(e){const s=this.jc.decode(e.data),i=s;if(i.error){const o=Ex(i.error.code,i.error.description);if(o!==null)throw o.api_error=i.error,o}return s}}class vo{constructor(e,s,i,o){j(this,"err");j(this,"offset");j(this,"pageInfo");j(this,"subject");j(this,"jsm");j(this,"filter");j(this,"payload");if(!e)throw new Error("subject is required");this.subject=e,this.jsm=i,this.offset=0,this.pageInfo={},this.filter=s,this.payload=o||{}}async next(){if(this.err)return[];if(this.pageInfo&&this.offset>=this.pageInfo.total)return[];const e={offset:this.offset};this.payload&&Object.assign(e,this.payload);try{const s=await this.jsm._request(this.subject,e,{timeout:this.jsm.timeout});this.pageInfo=s;const i=this.countResponse(s);return i===0?[]:(this.offset+=i,this.filter(s))}catch(s){throw this.err=s,s}}countResponse(e){var s,i,o;switch(e==null?void 0:e.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return((s=e.streams)==null?void 0:s.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((i=e.consumers)==null?void 0:i.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${e==null?void 0:e.type}`),((o=e.streams)==null?void 0:o.length)||0}return 0}async*[Symbol.asyncIterator](){let e=await this.next();for(;e.length>0;){for(const s of e)yield s;e=await this.next()}}}function ni(n=""){const e=n.match(/(\d+).(\d+).(\d+)/);if(e)return{major:parseInt(e[1]),minor:parseInt(e[2]),micro:parseInt(e[3])};throw new Error(`'${n}' is not a semver value`)}function Md(n,e){return n.major<e.major?-1:n.major>e.major?1:n.minor<e.minor?-1:n.minor>e.minor?1:n.micro<e.micro?-1:n.micro>e.micro?1:0}var Ye;(function(n){n.JS_KV="js_kv",n.JS_OBJECTSTORE="js_objectstore",n.JS_PULL_MAX_BYTES="js_pull_max_bytes",n.JS_NEW_CONSUMER_CREATE_API="js_new_consumer_create",n.JS_ALLOW_DIRECT="js_allow_direct",n.JS_MULTIPLE_CONSUMER_FILTER="js_multiple_consumer_filter",n.JS_SIMPLIFICATION="js_simplification",n.JS_STREAM_CONSUMER_METADATA="js_stream_consumer_metadata",n.JS_CONSUMER_FILTER_SUBJECTS="js_consumer_filter_subjects",n.JS_STREAM_FIRST_SEQ="js_stream_first_seq",n.JS_STREAM_SUBJECT_TRANSFORM="js_stream_subject_transform",n.JS_STREAM_SOURCE_SUBJECT_TRANSFORM="js_stream_source_subject_transform",n.JS_STREAM_COMPRESSION="js_stream_compression",n.JS_DEFAULT_CONSUMER_LIMITS="js_default_consumer_limits",n.JS_BATCH_DIRECT_GET="js_batch_direct_get"})(Ye||(Ye={}));class KE{constructor(e){j(this,"server");j(this,"features");j(this,"disabled");this.features=new Map,this.disabled=[],this.update(e)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(e){this.disabled.push(e),this.update(this.server)}isDisabled(e){return this.disabled.indexOf(e)!==-1}update(e){typeof e=="string"&&(e=ni(e)),this.server=e,this.set(Ye.JS_KV,"2.6.2"),this.set(Ye.JS_OBJECTSTORE,"2.6.3"),this.set(Ye.JS_PULL_MAX_BYTES,"2.8.3"),this.set(Ye.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(Ye.JS_ALLOW_DIRECT,"2.9.0"),this.set(Ye.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(Ye.JS_SIMPLIFICATION,"2.9.4"),this.set(Ye.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(Ye.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(Ye.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(Ye.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(Ye.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(Ye.JS_STREAM_COMPRESSION,"2.10.0"),this.set(Ye.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(Ye.JS_BATCH_DIRECT_GET,"2.11.0"),this.disabled.forEach(s=>{this.features.delete(s)})}set(e,s){this.features.set(e,{min:s,ok:Md(this.server,ni(s))>=0})}get(e){return this.features.get(e)||{min:"unknown",ok:!1}}supports(e){var s;return((s=this.get(e))==null?void 0:s.ok)||!1}require(e){return typeof e=="string"&&(e=ni(e)),Md(this.server,e)>=0}}class pu extends Do{constructor(e,s){super(e,s)}async add(e,s,i=mu.Create){if(Qt(e),s.deliver_group&&s.flow_control)throw new Error("jetstream flow control is not supported with queue groups");if(s.deliver_group&&s.idle_heartbeat)throw new Error("jetstream idle heartbeat is not supported with queue groups");const o={};o.config=s,o.stream_name=e,o.action=i,o.config.durable_name&&Wi(o.config.durable_name);const c=this.nc;let{min:d,ok:p}=c.features.get(Ye.JS_NEW_CONSUMER_CREATE_API);const g=s.name===""?void 0:s.name;if(g&&!p)throw new Error(`consumer 'name' requires server ${d}`);if(g)try{ju("name",g)}catch(x){const v=x.message,_=v.indexOf("cannot contain");throw _!==-1?new Error(`consumer 'name' ${v.substring(_)}`):x}let u,m="";if(Array.isArray(s.filter_subjects)){const{min:x,ok:v}=c.features.get(Ye.JS_MULTIPLE_CONSUMER_FILTER);if(!v)throw new Error(`consumer 'filter_subjects' requires server ${x}`);p=!1}if(s.metadata){const{min:x,ok:v}=c.features.get(Ye.JS_STREAM_CONSUMER_METADATA);if(!v)throw new Error(`consumer 'metadata' requires server ${x}`)}if(p&&(m=s.name??s.durable_name??""),m!==""){let x=s.filter_subject??void 0;x===">"&&(x=void 0),u=x!==void 0?`${this.prefix}.CONSUMER.CREATE.${e}.${m}.${x}`:`${this.prefix}.CONSUMER.CREATE.${e}.${m}`}else u=s.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${e}.${s.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${e}`;return await this._request(u,o)}async update(e,s,i){const o=await this.info(e,s),c=i;return this.add(e,Object.assign(o.config,c),mu.Update)}async info(e,s){return Qt(e),Wi(s),await this._request(`${this.prefix}.CONSUMER.INFO.${e}.${s}`)}async delete(e,s){return Qt(e),Wi(s),(await this._request(`${this.prefix}.CONSUMER.DELETE.${e}.${s}`)).success}list(e){Qt(e);const s=o=>o.consumers,i=`${this.prefix}.CONSUMER.LIST.${e}`;return new vo(i,s,this)}pause(e,s,i){const o=`${this.prefix}.CONSUMER.PAUSE.${e}.${s}`,c={pause_until:i.toISOString()};return this._request(o,c)}resume(e,s){return this.pause(e,s,new Date(0))}}function Hi(n,e,s=!1){if(s===!0&&!n)throw be.errorForCode(fe.ApiError,new Error(`${e} is not a function`));if(n&&typeof n!="function")throw be.errorForCode(fe.ApiError,new Error(`${e} is not a function`))}class JE extends Ut{constructor(s,i,o){super();j(this,"sub");j(this,"adapter");j(this,"subIterDone");Hi(o.adapter,"adapter",!0),this.adapter=o.adapter,o.callback&&Hi(o.callback,"callback"),this.noIterator=typeof o.callback=="function",o.ingestionFilterFn&&(Hi(o.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=o.ingestionFilterFn),o.protocolFilterFn&&(Hi(o.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=o.protocolFilterFn),o.dispatchedFn&&(Hi(o.dispatchedFn,"dispatchedFn"),this.dispatchedFn=o.dispatchedFn),o.cleanupFn&&Hi(o.cleanupFn,"cleanupFn");let c=(m,b)=>{this.callback(m,b)};if(o.callback){const m=o.callback;c=(b,x)=>{const[v,_]=this.adapter(b,x);if(v){m(v,null);return}const{ingest:S}=this.ingestionFilterFn?this.ingestionFilterFn(_,this):{ingest:!0};S&&(!this.protocolFilterFn||this.protocolFilterFn(_))&&(m(v,_),this.dispatchedFn&&_&&this.dispatchedFn(_))}}const{max:d,queue:p,timeout:g}=o,u={queue:p,timeout:g,callback:c};d&&d>0&&(u.max=d),this.sub=s.subscribe(i,u),o.cleanupFn&&(this.sub.cleanupFn=o.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=dt(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async m=>{await m.closed,this.stop()})(this.sub).then().catch()}unsubscribe(s){this.sub.unsubscribe(s)}drain(){return this.sub.drain()}isDraining(){return this.sub.isDraining()}isClosed(){return this.sub.isClosed()}callback(s,i){this.sub.cancelTimeout();const[o,c]=this.adapter(s,i);o&&this.stop(o),c&&this.push(c)}getSubject(){return this.sub.getSubject()}getReceived(){return this.sub.getReceived()}getProcessed(){return this.sub.getProcessed()}getPending(){return this.sub.getPending()}getID(){return this.sub.getID()}getMax(){return this.sub.getMax()}get closed(){return this.sub.closed}}let On;function QE(n){On=n}function jx(){return On!==void 0&&On.defaultPort!==void 0?On.defaultPort:4222}function nd(){return On!==void 0&&On.urlParseFn?On.urlParseFn:void 0}function XE(){if(!On||typeof On.factory!="function")throw new Error("transport fn is not set");return On.factory()}function Rd(){return On!==void 0&&On.dnsResolveFn?On.dnsResolveFn:void 0}const su=`\r
37
+ `,yu=oa.fromAscii(su),WE=new Uint8Array(yu)[0],ZE=new Uint8Array(yu)[1];function e2(n){for(let e=0;e<n.length;e++){const s=e+1;if(n.byteLength>s&&n[e]===WE&&n[s]===ZE)return s+1}return 0}function t2(n){const e=e2(n);if(e>0){const i=new Uint8Array(n).slice(0,e);return En.decode(i)}return""}const n2=4,kx=48,r2=65,s2=97;function i2(n,e,s,i){const o=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((d,p)=>{o[p]=d}),o[12]=n,o[13]=e,o[14]=s,o[15]=i,o}function Dd(n){return a2(n)!==void 0}function a2(n){for(let e=0;e<n.length;e++)switch(n[e]){case".":return Nx(n);case":":return o2(n)}}function Nx(n){const e=new Uint8Array(4);for(let s=0;s<4;s++){if(n.length===0)return;if(s>0){if(n[0]!==".")return;n=n.substring(1)}const{n:i,c:o,ok:c}=l2(n);if(!c||i>255)return;n=n.substring(o),e[s]=i}return i2(e[0],e[1],e[2],e[3])}function o2(n){const e=new Uint8Array(16);let s=-1;if(n.length>=2&&n[0]===":"&&n[1]===":"&&(s=0,n=n.substring(2),n.length===0))return e;let i=0;for(;i<16;){const{n:o,c,ok:d}=c2(n);if(!d||o>65535)return;if(c<n.length&&n[c]==="."){if(s<0&&i!=12||i+4>16)return;const p=Nx(n);if(p===void 0)return;e[i]=p[12],e[i+1]=p[13],e[i+2]=p[14],e[i+3]=p[15],n="",i+=n2;break}if(e[i]=o>>8,e[i+1]=o,i+=2,n=n.substring(c),n.length===0)break;if(n[0]!==":"||n.length==1)return;if(n=n.substring(1),n[0]===":"){if(s>=0)return;if(s=i,n=n.substring(1),n.length===0)break}}if(n.length===0){if(i<16){if(s<0)return;const o=16-i;for(let c=i-1;c>=s;c--)e[c+o]=e[c];for(let c=s+o-1;c>=s;c--)e[c]=0}else if(s>=0)return;return e}}function l2(n){let e=0,s=0;for(e=0;e<n.length&&48<=n.charCodeAt(e)&&n.charCodeAt(e)<=57;e++)if(s=s*10+(n.charCodeAt(e)-kx),s>=16777215)return{n:16777215,c:e,ok:!1};return e===0?{n:0,c:0,ok:!1}:{n:s,c:e,ok:!0}}function c2(n){let e=0,s=0;for(s=0;s<n.length;s++){if(48<=n.charCodeAt(s)&&n.charCodeAt(s)<=57)e*=16,e+=n.charCodeAt(s)-kx;else if(97<=n.charCodeAt(s)&&n.charCodeAt(s)<=102)e*=16,e+=n.charCodeAt(s)-s2+10;else if(65<=n.charCodeAt(s)&&n.charCodeAt(s)<=70)e*=16,e+=n.charCodeAt(s)-r2+10;else break;if(e>=16777215)return{n:0,c:s,ok:!1}}return s===0?{n:0,c:s,ok:!1}:{n:e,c:s,ok:!0}}function u2(n){return n.indexOf("[")!==-1||n.indexOf("::")!==-1?!1:n.indexOf(".")!==-1||n.split(":").length<=2}function Ld(n){return!u2(n)}function f2(n){const e="::FFFF:",s=n.toUpperCase().indexOf(e);if(s!==-1&&n.indexOf(".")!==-1){let i=n.substring(s+e.length);return i=i.replace("[",""),i.replace("]","")}return n}function h2(n){n=n.trim(),n.match(/^(.*:\/\/)(.*)/m)&&(n=n.replace(/^(.*:\/\/)(.*)/gm,"$2")),n=f2(n),Ld(n)&&n.indexOf("[")===-1&&(n=`[${n}]`);const e=Ld(n)?n.match(/(]:)(\d+)/):n.match(/(:)(\d+)/),s=e&&e.length===3&&e[1]&&e[2]?parseInt(e[2]):4222,i=s===80?"https":"http",o=new URL(`${i}://${n}`);o.port=`${s}`;let c=o.hostname;return c.charAt(0)==="["&&(c=c.substring(1,c.length-1)),{listen:o.host,hostname:c,port:s}}class Eo{constructor(e,s=!1){j(this,"src");j(this,"listen");j(this,"hostname");j(this,"port");j(this,"didConnect");j(this,"reconnects");j(this,"lastConnect");j(this,"gossiped");j(this,"tlsName");j(this,"resolves");this.src=e,this.tlsName="";const i=h2(e);this.listen=i.listen,this.hostname=i.hostname,this.port=i.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=s}toString(){return this.listen}async resolve(e){if(!e.fn||e.resolve===!1)return[this];const s=[];if(Dd(this.hostname))return[this];{const i=await e.fn(this.hostname);e.debug&&console.log(`resolve ${this.hostname} = ${i.join(",")}`);for(const o of i){const c=this.port===80?"https":"http",d=new URL(`${c}://${Ld(o)?"["+o+"]":o}`);d.port=`${this.port}`;const p=new Eo(d.host,!1);p.tlsName=this.hostname,s.push(p)}}return e.randomize&&wx(s),this.resolves=s,s}}class d2{constructor(e=[],s={}){j(this,"firstSelect");j(this,"servers");j(this,"currentServer");j(this,"tlsName");j(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=s.randomize||!1;const i=nd();e&&(e.forEach(o=>{o=i?i(o):o,this.servers.push(new Eo(o))}),this.randomize&&(this.servers=wx(this.servers))),this.servers.length===0&&this.addServer(`${Od}:${jx()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const e=this.getCurrentServer();Dd(e.hostname)||(this.tlsName=e.hostname,this.servers.forEach(s=>{s.gossiped&&(s.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(e,s=!1){const i=nd();e=i?i(e):e;const o=new Eo(e,s);Dd(o.hostname)&&(o.tlsName=this.tlsName),this.servers.push(o)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const e=this.servers.shift();return e&&(this.servers.push(e),this.currentServer=e),e}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(e){if(e){const s=this.servers.indexOf(e);this.servers.splice(s,1)}}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update(e,s){const i=[];let o=[];const c=nd(),d=new Map;e.connect_urls&&e.connect_urls.length>0&&e.connect_urls.forEach(g=>{g=c?c(g,s):g;const u=new Eo(g,!0);d.set(g,u)});const p=[];return this.servers.forEach((g,u)=>{const m=g.listen;g.gossiped&&this.currentServer.listen!==m&&d.get(m)===void 0&&p.push(u),d.delete(m)}),p.reverse(),p.forEach(g=>{const u=this.servers.splice(g,1);o=o.concat(u[0].listen)}),d.forEach((g,u)=>{this.servers.push(g),i.push(u)}),{added:i,deleted:o}}}class m2{constructor(){j(this,"baseInbox");j(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(e){return this.baseInbox=`${Lr(e)}.`,this.baseInbox}add(e){isNaN(e.received)||(e.received=0),this.reqs.set(e.token,e)}get(e){return this.reqs.get(e)}cancel(e){this.reqs.delete(e.token)}getToken(e){const s=e.subject||"";return s.indexOf(this.baseInbox)===0?s.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(e,s){if(s&&s.permissionContext){if(e)return this.all().forEach(o=>{o.resolver(s,{})}),!0;const i=s.permissionContext;if(i.operation==="publish"){const o=this.all().find(c=>c.requestSubject===i.subject);if(o)return o.resolver(s,{}),!0}}return!1}dispatcher(){return(e,s)=>{const i=this.getToken(s);if(i){const o=this.get(i);o&&(e===null&&s.headers&&(e=Sx(s)),o.resolver(e,s))}}}close(){const e=be.errorForCode(fe.Timeout);this.reqs.forEach(s=>{s.resolver(e,{})})}}class p2{constructor(e,s,i){j(this,"ph");j(this,"interval");j(this,"maxOut");j(this,"timer");j(this,"pendings");this.ph=e,this.interval=s,this.maxOut=i,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(e){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),e&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:Xi.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const e=dt();this.ph.flush(e).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(e),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(e=>(e.resolve(),!1))}}class y2 extends Error{constructor(e){super(e),this.name="AssertionError"}}function g2(n,e="Assertion failed."){if(!n)throw new y2(e)}const ub=32*1024,rd=2**32-2;function lc(n,e,s=0){const i=e.byteLength-s;return n.byteLength>i&&(n=n.subarray(0,i)),e.set(n,s),n.byteLength}class sd{constructor(e){j(this,"_buf");j(this,"_off");if(this._off=0,e==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(e)}bytes(e={copy:!0}){return e.copy===!1?this._buf.subarray(this._off):this._buf.slice(this._off)}empty(){return this._buf.byteLength<=this._off}get length(){return this._buf.byteLength-this._off}get capacity(){return this._buf.buffer.byteLength}truncate(e){if(e===0){this.reset();return}if(e<0||e>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+e)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(e){const s=this._buf.byteLength;return e<=this.capacity-s?(this._reslice(s+e),s):-1}_reslice(e){g2(e<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,e)}readByte(){const e=new Uint8Array(1);return this.read(e)?e[0]:null}read(e){if(this.empty())return this.reset(),e.byteLength===0?0:null;const s=lc(this._buf.subarray(this._off),e);return this._off+=s,s}writeByte(e){return this.write(Uint8Array.of(e))}writeString(e){return this.write(si.encode(e))}write(e){const s=this._grow(e.byteLength);return lc(e,this._buf,s)}_grow(e){const s=this.length;s===0&&this._off!==0&&this.reset();const i=this._tryGrowByReslice(e);if(i>=0)return i;const o=this.capacity;if(e<=Math.floor(o/2)-s)lc(this._buf.subarray(this._off),this._buf);else{if(o+e>rd)throw new Error("The buffer cannot be grown beyond the maximum size.");{const c=new Uint8Array(Math.min(2*o+e,rd));lc(this._buf.subarray(this._off),c),this._buf=c}}return this._off=0,this._reslice(Math.min(s+e,rd)),s}grow(e){if(e<0)throw Error("Buffer._grow: negative count");const s=this._grow(e);this._reslice(s)}readFrom(e){let s=0;const i=new Uint8Array(ub);for(;;){const o=this.capacity-this.length<ub,c=o?i:new Uint8Array(this._buf.buffer,this.length),d=e.read(c);if(d===null)return s;o?this.write(c.subarray(0,d)):this._reslice(this.length+d),s+=d}}}var Xt;(function(n){n[n.OK=0]="OK",n[n.ERR=1]="ERR",n[n.MSG=2]="MSG",n[n.INFO=3]="INFO",n[n.PING=4]="PING",n[n.PONG=5]="PONG"})(Xt||(Xt={}));function fb(){const n={};return n.sid=-1,n.hdr=-1,n.size=-1,n}const b2=48;class hb{constructor(e){j(this,"dispatcher");j(this,"state");j(this,"as");j(this,"drop");j(this,"hdr");j(this,"ma");j(this,"argBuf");j(this,"msgBuf");this.dispatcher=e,this.state=de.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(e){let s;for(s=0;s<e.length;s++){const i=e[s];switch(this.state){case de.OP_START:switch(i){case me.M:case me.m:this.state=de.OP_M,this.hdr=-1,this.ma=fb();break;case me.H:case me.h:this.state=de.OP_H,this.hdr=0,this.ma=fb();break;case me.P:case me.p:this.state=de.OP_P;break;case me.PLUS:this.state=de.OP_PLUS;break;case me.MINUS:this.state=de.OP_MINUS;break;case me.I:case me.i:this.state=de.OP_I;break;default:throw this.fail(e.subarray(s))}break;case de.OP_H:switch(i){case me.M:case me.m:this.state=de.OP_M;break;default:throw this.fail(e.subarray(s))}break;case de.OP_M:switch(i){case me.S:case me.s:this.state=de.OP_MS;break;default:throw this.fail(e.subarray(s))}break;case de.OP_MS:switch(i){case me.G:case me.g:this.state=de.OP_MSG;break;default:throw this.fail(e.subarray(s))}break;case de.OP_MSG:switch(i){case me.SPACE:case me.TAB:this.state=de.OP_MSG_SPC;break;default:throw this.fail(e.subarray(s))}break;case de.OP_MSG_SPC:switch(i){case me.SPACE:case me.TAB:continue;default:this.state=de.MSG_ARG,this.as=s}break;case de.MSG_ARG:switch(i){case me.CR:this.drop=1;break;case me.NL:{const o=this.argBuf?this.argBuf.bytes():e.subarray(this.as,s-this.drop);this.processMsgArgs(o),this.drop=0,this.as=s+1,this.state=de.MSG_PAYLOAD,s=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(i)}break;case de.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const o=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:Xt.MSG,msg:this.ma,data:o}),this.argBuf=void 0,this.msgBuf=void 0,this.state=de.MSG_END}else{let o=this.ma.size-this.msgBuf.length;const c=e.length-s;c<o&&(o=c),o>0?(this.msgBuf.write(e.subarray(s,s+o)),s=s+o-1):this.msgBuf.writeByte(i)}else s-this.as>=this.ma.size&&(this.dispatcher.push({kind:Xt.MSG,msg:this.ma,data:e.subarray(this.as,s)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=de.MSG_END);break;case de.MSG_END:switch(i){case me.NL:this.drop=0,this.as=s+1,this.state=de.OP_START;break;default:continue}break;case de.OP_PLUS:switch(i){case me.O:case me.o:this.state=de.OP_PLUS_O;break;default:throw this.fail(e.subarray(s))}break;case de.OP_PLUS_O:switch(i){case me.K:case me.k:this.state=de.OP_PLUS_OK;break;default:throw this.fail(e.subarray(s))}break;case de.OP_PLUS_OK:switch(i){case me.NL:this.dispatcher.push({kind:Xt.OK}),this.drop=0,this.state=de.OP_START;break}break;case de.OP_MINUS:switch(i){case me.E:case me.e:this.state=de.OP_MINUS_E;break;default:throw this.fail(e.subarray(s))}break;case de.OP_MINUS_E:switch(i){case me.R:case me.r:this.state=de.OP_MINUS_ER;break;default:throw this.fail(e.subarray(s))}break;case de.OP_MINUS_ER:switch(i){case me.R:case me.r:this.state=de.OP_MINUS_ERR;break;default:throw this.fail(e.subarray(s))}break;case de.OP_MINUS_ERR:switch(i){case me.SPACE:case me.TAB:this.state=de.OP_MINUS_ERR_SPC;break;default:throw this.fail(e.subarray(s))}break;case de.OP_MINUS_ERR_SPC:switch(i){case me.SPACE:case me.TAB:continue;default:this.state=de.MINUS_ERR_ARG,this.as=s}break;case de.MINUS_ERR_ARG:switch(i){case me.CR:this.drop=1;break;case me.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=e.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Xt.ERR,data:o}),this.drop=0,this.as=s+1,this.state=de.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(i))}break;case de.OP_P:switch(i){case me.I:case me.i:this.state=de.OP_PI;break;case me.O:case me.o:this.state=de.OP_PO;break;default:throw this.fail(e.subarray(s))}break;case de.OP_PO:switch(i){case me.N:case me.n:this.state=de.OP_PON;break;default:throw this.fail(e.subarray(s))}break;case de.OP_PON:switch(i){case me.G:case me.g:this.state=de.OP_PONG;break;default:throw this.fail(e.subarray(s))}break;case de.OP_PONG:switch(i){case me.NL:this.dispatcher.push({kind:Xt.PONG}),this.drop=0,this.state=de.OP_START;break}break;case de.OP_PI:switch(i){case me.N:case me.n:this.state=de.OP_PIN;break;default:throw this.fail(e.subarray(s))}break;case de.OP_PIN:switch(i){case me.G:case me.g:this.state=de.OP_PING;break;default:throw this.fail(e.subarray(s))}break;case de.OP_PING:switch(i){case me.NL:this.dispatcher.push({kind:Xt.PING}),this.drop=0,this.state=de.OP_START;break}break;case de.OP_I:switch(i){case me.N:case me.n:this.state=de.OP_IN;break;default:throw this.fail(e.subarray(s))}break;case de.OP_IN:switch(i){case me.F:case me.f:this.state=de.OP_INF;break;default:throw this.fail(e.subarray(s))}break;case de.OP_INF:switch(i){case me.O:case me.o:this.state=de.OP_INFO;break;default:throw this.fail(e.subarray(s))}break;case de.OP_INFO:switch(i){case me.SPACE:case me.TAB:this.state=de.OP_INFO_SPC;break;default:throw this.fail(e.subarray(s))}break;case de.OP_INFO_SPC:switch(i){case me.SPACE:case me.TAB:continue;default:this.state=de.INFO_ARG,this.as=s}break;case de.INFO_ARG:switch(i){case me.CR:this.drop=1;break;case me.NL:{let o;this.argBuf?(o=this.argBuf.bytes(),this.argBuf=void 0):o=e.subarray(this.as,s-this.drop),this.dispatcher.push({kind:Xt.INFO,data:o}),this.drop=0,this.as=s+1,this.state=de.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(i)}break;default:throw this.fail(e.subarray(s))}}(this.state===de.MSG_ARG||this.state===de.MINUS_ERR_ARG||this.state===de.INFO_ARG)&&!this.argBuf&&(this.argBuf=new sd(e.subarray(this.as,s-this.drop))),this.state===de.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new sd(e.subarray(this.as)))}cloneMsgArg(){const e=this.ma.subject.length,s=this.ma.reply?this.ma.reply.length:0,i=new Uint8Array(e+s);i.set(this.ma.subject),this.ma.reply&&i.set(this.ma.reply,e),this.argBuf=new sd(i),this.ma.subject=i.subarray(0,e),this.ma.reply&&(this.ma.reply=i.subarray(e))}processMsgArgs(e){if(this.hdr>=0)return this.processHeaderMsgArgs(e);const s=[];let i=-1;for(let o=0;o<e.length;o++)switch(e[o]){case me.SPACE:case me.TAB:case me.CR:case me.NL:i>=0&&(s.push(e.subarray(i,o)),i=-1);break;default:i<0&&(i=o)}switch(i>=0&&s.push(e.subarray(i)),s.length){case 3:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(s[2]);break;case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.size=this.protoParseInt(s[3]);break;default:throw this.fail(e,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(e,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(e,"processMsgArgs Bad or Missing Size Error")}fail(e,s=""){return s?s=`${s} [${this.state}]`:s=`parse error [${this.state}]`,new Error(`${s}: ${En.decode(e)}`)}processHeaderMsgArgs(e){const s=[];let i=-1;for(let o=0;o<e.length;o++)switch(e[o]){case me.SPACE:case me.TAB:case me.CR:case me.NL:i>=0&&(s.push(e.subarray(i,o)),i=-1);break;default:i<0&&(i=o)}switch(i>=0&&s.push(e.subarray(i)),s.length){case 4:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(s[2]),this.ma.size=this.protoParseInt(s[3]);break;case 5:this.ma.subject=s[0],this.ma.sid=this.protoParseInt(s[1]),this.ma.reply=s[2],this.ma.hdr=this.protoParseInt(s[3]),this.ma.size=this.protoParseInt(s[4]);break;default:throw this.fail(e,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(e,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(e,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(e,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(e){if(e.length===0)return-1;let s=0;for(let i=0;i<e.length;i++){if(e[i]<48||e[i]>57)return-1;s=s*10+(e[i]-b2)}return s}}var de;(function(n){n[n.OP_START=0]="OP_START",n[n.OP_PLUS=1]="OP_PLUS",n[n.OP_PLUS_O=2]="OP_PLUS_O",n[n.OP_PLUS_OK=3]="OP_PLUS_OK",n[n.OP_MINUS=4]="OP_MINUS",n[n.OP_MINUS_E=5]="OP_MINUS_E",n[n.OP_MINUS_ER=6]="OP_MINUS_ER",n[n.OP_MINUS_ERR=7]="OP_MINUS_ERR",n[n.OP_MINUS_ERR_SPC=8]="OP_MINUS_ERR_SPC",n[n.MINUS_ERR_ARG=9]="MINUS_ERR_ARG",n[n.OP_M=10]="OP_M",n[n.OP_MS=11]="OP_MS",n[n.OP_MSG=12]="OP_MSG",n[n.OP_MSG_SPC=13]="OP_MSG_SPC",n[n.MSG_ARG=14]="MSG_ARG",n[n.MSG_PAYLOAD=15]="MSG_PAYLOAD",n[n.MSG_END=16]="MSG_END",n[n.OP_H=17]="OP_H",n[n.OP_P=18]="OP_P",n[n.OP_PI=19]="OP_PI",n[n.OP_PIN=20]="OP_PIN",n[n.OP_PING=21]="OP_PING",n[n.OP_PO=22]="OP_PO",n[n.OP_PON=23]="OP_PON",n[n.OP_PONG=24]="OP_PONG",n[n.OP_I=25]="OP_I",n[n.OP_IN=26]="OP_IN",n[n.OP_INF=27]="OP_INF",n[n.OP_INFO=28]="OP_INFO",n[n.OP_INFO_SPC=29]="OP_INFO_SPC",n[n.INFO_ARG=30]="INFO_ARG"})(de||(de={}));var me;(function(n){n[n.CR=13]="CR",n[n.E=69]="E",n[n.e=101]="e",n[n.F=70]="F",n[n.f=102]="f",n[n.G=71]="G",n[n.g=103]="g",n[n.H=72]="H",n[n.h=104]="h",n[n.I=73]="I",n[n.i=105]="i",n[n.K=75]="K",n[n.k=107]="k",n[n.M=77]="M",n[n.m=109]="m",n[n.MINUS=45]="MINUS",n[n.N=78]="N",n[n.n=110]="n",n[n.NL=10]="NL",n[n.O=79]="O",n[n.o=111]="o",n[n.P=80]="P",n[n.p=112]="p",n[n.PLUS=43]="PLUS",n[n.R=82]="R",n[n.r=114]="r",n[n.S=83]="S",n[n.s=115]="s",n[n.SPACE=32]="SPACE",n[n.TAB=9]="TAB"})(me||(me={}));(function(n){var e=function(A,N){this.hi=A|0,this.lo=N|0},s=function(A){var N,k=new Float64Array(16);if(A)for(N=0;N<A.length;N++)k[N]=A[N];return k},i=function(){throw new Error("no PRNG")},o=new Uint8Array(16),c=new Uint8Array(32);c[0]=9;var d=s(),p=s([1]),g=s([56129,1]),u=s([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),m=s([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),b=s([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),x=s([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),v=s([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function _(A,N){return A<<N|A>>>32-N}function S(A,N){var k=A[N+3]&255;return k=k<<8|A[N+2]&255,k=k<<8|A[N+1]&255,k<<8|A[N+0]&255}function C(A,N){var k=A[N]<<24|A[N+1]<<16|A[N+2]<<8|A[N+3],T=A[N+4]<<24|A[N+5]<<16|A[N+6]<<8|A[N+7];return new e(k,T)}function B(A,N,k){var T;for(T=0;T<4;T++)A[N+T]=k&255,k>>>=8}function q(A,N,k){A[N]=k.hi>>24&255,A[N+1]=k.hi>>16&255,A[N+2]=k.hi>>8&255,A[N+3]=k.hi&255,A[N+4]=k.lo>>24&255,A[N+5]=k.lo>>16&255,A[N+6]=k.lo>>8&255,A[N+7]=k.lo&255}function ne(A,N,k,T,L){var I,se=0;for(I=0;I<L;I++)se|=A[N+I]^k[T+I];return(1&se-1>>>8)-1}function te(A,N,k,T){return ne(A,N,k,T,16)}function M(A,N,k,T){return ne(A,N,k,T,32)}function z(A,N,k,T,L){var I=new Uint32Array(16),se=new Uint32Array(16),le=new Uint32Array(16),K=new Uint32Array(4),re,xe,Ue;for(re=0;re<4;re++)se[5*re]=S(T,4*re),se[1+re]=S(k,4*re),se[6+re]=S(N,4*re),se[11+re]=S(k,16+4*re);for(re=0;re<16;re++)le[re]=se[re];for(re=0;re<20;re++){for(xe=0;xe<4;xe++){for(Ue=0;Ue<4;Ue++)K[Ue]=se[(5*xe+4*Ue)%16];for(K[1]^=_(K[0]+K[3]|0,7),K[2]^=_(K[1]+K[0]|0,9),K[3]^=_(K[2]+K[1]|0,13),K[0]^=_(K[3]+K[2]|0,18),Ue=0;Ue<4;Ue++)I[4*xe+(xe+Ue)%4]=K[Ue]}for(Ue=0;Ue<16;Ue++)se[Ue]=I[Ue]}if(L){for(re=0;re<16;re++)se[re]=se[re]+le[re]|0;for(re=0;re<4;re++)se[5*re]=se[5*re]-S(T,4*re)|0,se[6+re]=se[6+re]-S(N,4*re)|0;for(re=0;re<4;re++)B(A,4*re,se[5*re]),B(A,16+4*re,se[6+re])}else for(re=0;re<16;re++)B(A,4*re,se[re]+le[re]|0)}function ae(A,N,k,T){return z(A,N,k,T,!1),0}function F(A,N,k,T){return z(A,N,k,T,!0),0}var U=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function D(A,N,k,T,L,I,se){var le=new Uint8Array(16),K=new Uint8Array(64),re,xe;if(!L)return 0;for(xe=0;xe<16;xe++)le[xe]=0;for(xe=0;xe<8;xe++)le[xe]=I[xe];for(;L>=64;){for(ae(K,le,se,U),xe=0;xe<64;xe++)A[N+xe]=(k?k[T+xe]:0)^K[xe];for(re=1,xe=8;xe<16;xe++)re=re+(le[xe]&255)|0,le[xe]=re&255,re>>>=8;L-=64,N+=64,k&&(T+=64)}if(L>0)for(ae(K,le,se,U),xe=0;xe<L;xe++)A[N+xe]=(k?k[T+xe]:0)^K[xe];return 0}function Q(A,N,k,T,L){return D(A,N,null,0,k,T,L)}function W(A,N,k,T,L){var I=new Uint8Array(32);return F(I,T,L,U),Q(A,N,k,T.subarray(16),I)}function he(A,N,k,T,L,I,se){var le=new Uint8Array(32);return F(le,I,se,U),D(A,N,k,T,L,I.subarray(16),le)}function Ee(A,N){var k,T=0;for(k=0;k<17;k++)T=T+(A[k]+N[k]|0)|0,A[k]=T&255,T>>>=8}var Ae=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function H(A,N,k,T,L,I){var se,le,K,re,xe=new Uint32Array(17),Ue=new Uint32Array(17),ot=new Uint32Array(17),Vt=new Uint32Array(17),Vn=new Uint32Array(17);for(K=0;K<17;K++)Ue[K]=ot[K]=0;for(K=0;K<16;K++)Ue[K]=I[K];for(Ue[3]&=15,Ue[4]&=252,Ue[7]&=15,Ue[8]&=252,Ue[11]&=15,Ue[12]&=252,Ue[15]&=15;L>0;){for(K=0;K<17;K++)Vt[K]=0;for(K=0;K<16&&K<L;++K)Vt[K]=k[T+K];for(Vt[K]=1,T+=K,L-=K,Ee(ot,Vt),le=0;le<17;le++)for(xe[le]=0,K=0;K<17;K++)xe[le]=xe[le]+ot[K]*(K<=le?Ue[le-K]:320*Ue[le+17-K]|0)|0|0;for(le=0;le<17;le++)ot[le]=xe[le];for(re=0,K=0;K<16;K++)re=re+ot[K]|0,ot[K]=re&255,re>>>=8;for(re=re+ot[16]|0,ot[16]=re&3,re=5*(re>>>2)|0,K=0;K<16;K++)re=re+ot[K]|0,ot[K]=re&255,re>>>=8;re=re+ot[16]|0,ot[16]=re}for(K=0;K<17;K++)Vn[K]=ot[K];for(Ee(ot,Ae),se=-(ot[16]>>>7)|0,K=0;K<17;K++)ot[K]^=se&(Vn[K]^ot[K]);for(K=0;K<16;K++)Vt[K]=I[K+16];for(Vt[16]=0,Ee(ot,Vt),K=0;K<16;K++)A[N+K]=ot[K];return 0}function J(A,N,k,T,L,I){var se=new Uint8Array(16);return H(se,0,k,T,L,I),te(A,N,se,0)}function ce(A,N,k,T,L){var I;if(k<32)return-1;for(he(A,0,N,0,k,T,L),H(A,16,A,32,k-32,A),I=0;I<16;I++)A[I]=0;return 0}function pe(A,N,k,T,L){var I,se=new Uint8Array(32);if(k<32||(W(se,0,32,T,L),J(N,16,N,32,k-32,se)!==0))return-1;for(he(A,0,N,0,k,T,L),I=0;I<32;I++)A[I]=0;return 0}function ge(A,N){var k;for(k=0;k<16;k++)A[k]=N[k]|0}function Ce(A){var N,k;for(k=0;k<16;k++)A[k]+=65536,N=Math.floor(A[k]/65536),A[(k+1)*(k<15?1:0)]+=N-1+37*(N-1)*(k===15?1:0),A[k]-=N*65536}function Ne(A,N,k){for(var T,L=~(k-1),I=0;I<16;I++)T=L&(A[I]^N[I]),A[I]^=T,N[I]^=T}function Me(A,N){var k,T,L,I=s(),se=s();for(k=0;k<16;k++)se[k]=N[k];for(Ce(se),Ce(se),Ce(se),T=0;T<2;T++){for(I[0]=se[0]-65517,k=1;k<15;k++)I[k]=se[k]-65535-(I[k-1]>>16&1),I[k-1]&=65535;I[15]=se[15]-32767-(I[14]>>16&1),L=I[15]>>16&1,I[14]&=65535,Ne(se,I,1-L)}for(k=0;k<16;k++)A[2*k]=se[k]&255,A[2*k+1]=se[k]>>8}function Xe(A,N){var k=new Uint8Array(32),T=new Uint8Array(32);return Me(k,A),Me(T,N),M(k,0,T,0)}function pt(A){var N=new Uint8Array(32);return Me(N,A),N[0]&1}function Ot(A,N){var k;for(k=0;k<16;k++)A[k]=N[2*k]+(N[2*k+1]<<8);A[15]&=32767}function mt(A,N,k){var T;for(T=0;T<16;T++)A[T]=N[T]+k[T]|0}function _e(A,N,k){var T;for(T=0;T<16;T++)A[T]=N[T]-k[T]|0}function oe(A,N,k){var T,L,I=new Float64Array(31);for(T=0;T<31;T++)I[T]=0;for(T=0;T<16;T++)for(L=0;L<16;L++)I[T+L]+=N[T]*k[L];for(T=0;T<15;T++)I[T]+=38*I[T+16];for(T=0;T<16;T++)A[T]=I[T];Ce(A),Ce(A)}function Be(A,N){oe(A,N,N)}function zt(A,N){var k=s(),T;for(T=0;T<16;T++)k[T]=N[T];for(T=253;T>=0;T--)Be(k,k),T!==2&&T!==4&&oe(k,k,N);for(T=0;T<16;T++)A[T]=k[T]}function Mt(A,N){var k=s(),T;for(T=0;T<16;T++)k[T]=N[T];for(T=250;T>=0;T--)Be(k,k),T!==1&&oe(k,k,N);for(T=0;T<16;T++)A[T]=k[T]}function tt(A,N,k){var T=new Uint8Array(32),L=new Float64Array(80),I,se,le=s(),K=s(),re=s(),xe=s(),Ue=s(),ot=s();for(se=0;se<31;se++)T[se]=N[se];for(T[31]=N[31]&127|64,T[0]&=248,Ot(L,k),se=0;se<16;se++)K[se]=L[se],xe[se]=le[se]=re[se]=0;for(le[0]=xe[0]=1,se=254;se>=0;--se)I=T[se>>>3]>>>(se&7)&1,Ne(le,K,I),Ne(re,xe,I),mt(Ue,le,re),_e(le,le,re),mt(re,K,xe),_e(K,K,xe),Be(xe,Ue),Be(ot,le),oe(le,re,le),oe(re,K,Ue),mt(Ue,le,re),_e(le,le,re),Be(K,le),_e(re,xe,ot),oe(le,re,g),mt(le,le,xe),oe(re,re,le),oe(le,xe,ot),oe(xe,K,L),Be(K,Ue),Ne(le,K,I),Ne(re,xe,I);for(se=0;se<16;se++)L[se+16]=le[se],L[se+32]=re[se],L[se+48]=K[se],L[se+64]=xe[se];var Vt=L.subarray(32),Vn=L.subarray(16);return zt(Vt,Vt),oe(Vn,Vn,Vt),Me(A,Vn),0}function ye(A,N){return tt(A,N,c)}function Le(A,N){return i(N,32),ye(A,N)}function yt(A,N,k){var T=new Uint8Array(32);return tt(T,k,N),F(A,o,T,U)}var At=ce,Ur=pe;function fa(A,N,k,T,L,I){var se=new Uint8Array(32);return yt(se,L,I),At(A,N,k,T,se)}function ha(A,N,k,T,L,I){var se=new Uint8Array(32);return yt(se,L,I),Ur(A,N,k,T,se)}function hr(){var A=0,N=0,k=0,T=0,L=65535,I,se,le;for(le=0;le<arguments.length;le++)I=arguments[le].lo,se=arguments[le].hi,A+=I&L,N+=I>>>16,k+=se&L,T+=se>>>16;return N+=A>>>16,k+=N>>>16,T+=k>>>16,new e(k&L|T<<16,A&L|N<<16)}function $o(A,N){return new e(A.hi>>>N,A.lo>>>N|A.hi<<32-N)}function ii(){var A=0,N=0,k;for(k=0;k<arguments.length;k++)A^=arguments[k].lo,N^=arguments[k].hi;return new e(N,A)}function ut(A,N){var k,T,L=32-N;return N<32?(k=A.hi>>>N|A.lo<<L,T=A.lo>>>N|A.hi<<L):N<64&&(k=A.lo>>>N|A.hi<<L,T=A.hi>>>N|A.lo<<L),new e(k,T)}function Uu(A,N,k){var T=A.hi&N.hi^~A.hi&k.hi,L=A.lo&N.lo^~A.lo&k.lo;return new e(T,L)}function Io(A,N,k){var T=A.hi&N.hi^A.hi&k.hi^N.hi&k.hi,L=A.lo&N.lo^A.lo&k.lo^N.lo&k.lo;return new e(T,L)}function Ho(A){return ii(ut(A,28),ut(A,34),ut(A,39))}function ai(A){return ii(ut(A,14),ut(A,18),ut(A,41))}function zu(A){return ii(ut(A,1),ut(A,8),$o(A,7))}function Fo(A){return ii(ut(A,19),ut(A,61),$o(A,6))}var $u=[new e(1116352408,3609767458),new e(1899447441,602891725),new e(3049323471,3964484399),new e(3921009573,2173295548),new e(961987163,4081628472),new e(1508970993,3053834265),new e(2453635748,2937671579),new e(2870763221,3664609560),new e(3624381080,2734883394),new e(310598401,1164996542),new e(607225278,1323610764),new e(1426881987,3590304994),new e(1925078388,4068182383),new e(2162078206,991336113),new e(2614888103,633803317),new e(3248222580,3479774868),new e(3835390401,2666613458),new e(4022224774,944711139),new e(264347078,2341262773),new e(604807628,2007800933),new e(770255983,1495990901),new e(1249150122,1856431235),new e(1555081692,3175218132),new e(1996064986,2198950837),new e(2554220882,3999719339),new e(2821834349,766784016),new e(2952996808,2566594879),new e(3210313671,3203337956),new e(3336571891,1034457026),new e(3584528711,2466948901),new e(113926993,3758326383),new e(338241895,168717936),new e(666307205,1188179964),new e(773529912,1546045734),new e(1294757372,1522805485),new e(1396182291,2643833823),new e(1695183700,2343527390),new e(1986661051,1014477480),new e(2177026350,1206759142),new e(2456956037,344077627),new e(2730485921,1290863460),new e(2820302411,3158454273),new e(3259730800,3505952657),new e(3345764771,106217008),new e(3516065817,3606008344),new e(3600352804,1432725776),new e(4094571909,1467031594),new e(275423344,851169720),new e(430227734,3100823752),new e(506948616,1363258195),new e(659060556,3750685593),new e(883997877,3785050280),new e(958139571,3318307427),new e(1322822218,3812723403),new e(1537002063,2003034995),new e(1747873779,3602036899),new e(1955562222,1575990012),new e(2024104815,1125592928),new e(2227730452,2716904306),new e(2361852424,442776044),new e(2428436474,593698344),new e(2756734187,3733110249),new e(3204031479,2999351573),new e(3329325298,3815920427),new e(3391569614,3928383900),new e(3515267271,566280711),new e(3940187606,3454069534),new e(4118630271,4000239992),new e(116418474,1914138554),new e(174292421,2731055270),new e(289380356,3203993006),new e(460393269,320620315),new e(685471733,587496836),new e(852142971,1086792851),new e(1017036298,365543100),new e(1126000580,2618297676),new e(1288033470,3409855158),new e(1501505948,4234509866),new e(1607167915,987167468),new e(1816402316,1246189591)];function Go(A,N,k){var T=[],L=[],I=[],se=[],le,K,re;for(K=0;K<8;K++)T[K]=I[K]=C(A,8*K);for(var xe=0;k>=128;){for(K=0;K<16;K++)se[K]=C(N,8*K+xe);for(K=0;K<80;K++){for(re=0;re<8;re++)L[re]=I[re];for(le=hr(I[7],ai(I[4]),Uu(I[4],I[5],I[6]),$u[K],se[K%16]),L[7]=hr(le,Ho(I[0]),Io(I[0],I[1],I[2])),L[3]=hr(L[3],le),re=0;re<8;re++)I[(re+1)%8]=L[re];if(K%16===15)for(re=0;re<16;re++)se[re]=hr(se[re],se[(re+9)%16],zu(se[(re+1)%16]),Fo(se[(re+14)%16]))}for(K=0;K<8;K++)I[K]=hr(I[K],T[K]),T[K]=I[K];xe+=128,k-=128}for(K=0;K<8;K++)q(A,8*K,T[K]);return k}var Ts=new Uint8Array([106,9,230,103,243,188,201,8,187,103,174,133,132,202,167,59,60,110,243,114,254,148,248,43,165,79,245,58,95,29,54,241,81,14,82,127,173,230,130,209,155,5,104,140,43,62,108,31,31,131,217,171,251,65,189,107,91,224,205,25,19,126,33,121]);function _t(A,N,k){var T=new Uint8Array(64),L=new Uint8Array(256),I,se=k;for(I=0;I<64;I++)T[I]=Ts[I];for(Go(T,N,k),k%=128,I=0;I<256;I++)L[I]=0;for(I=0;I<k;I++)L[I]=N[se-k+I];for(L[k]=128,k=256-128*(k<112?1:0),L[k-9]=0,q(L,k-8,new e(se/536870912|0,se<<3)),Go(T,L,k),I=0;I<64;I++)A[I]=T[I];return 0}function fn(A,N){var k=s(),T=s(),L=s(),I=s(),se=s(),le=s(),K=s(),re=s(),xe=s();_e(k,A[1],A[0]),_e(xe,N[1],N[0]),oe(k,k,xe),mt(T,A[0],A[1]),mt(xe,N[0],N[1]),oe(T,T,xe),oe(L,A[3],N[3]),oe(L,L,m),oe(I,A[2],N[2]),mt(I,I,I),_e(se,T,k),_e(le,I,L),mt(K,I,L),mt(re,T,k),oe(A[0],se,le),oe(A[1],re,K),oe(A[2],K,le),oe(A[3],se,re)}function Gt(A,N,k){var T;for(T=0;T<4;T++)Ne(A[T],N[T],k)}function da(A,N){var k=s(),T=s(),L=s();zt(L,N[2]),oe(k,N[0],L),oe(T,N[1],L),Me(A,T),A[31]^=pt(k)<<7}function ma(A,N,k){var T,L;for(ge(A[0],d),ge(A[1],p),ge(A[2],p),ge(A[3],d),L=255;L>=0;--L)T=k[L/8|0]>>(L&7)&1,Gt(A,N,T),fn(N,A),fn(A,A),Gt(A,N,T)}function oi(A,N){var k=[s(),s(),s(),s()];ge(k[0],b),ge(k[1],x),ge(k[2],p),oe(k[3],b,x),ma(A,k,N)}function zr(A,N,k){var T=new Uint8Array(64),L=[s(),s(),s(),s()],I;for(k||i(N,32),_t(T,N,32),T[0]&=248,T[31]&=127,T[31]|=64,oi(L,T),da(A,L),I=0;I<32;I++)N[I+32]=A[I];return 0}var dr=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function $r(A,N){var k,T,L,I;for(T=63;T>=32;--T){for(k=0,L=T-32,I=T-12;L<I;++L)N[L]+=k-16*N[T]*dr[L-(T-32)],k=Math.floor((N[L]+128)/256),N[L]-=k*256;N[L]+=k,N[T]=0}for(k=0,L=0;L<32;L++)N[L]+=k-(N[31]>>4)*dr[L],k=N[L]>>8,N[L]&=255;for(L=0;L<32;L++)N[L]-=k*dr[L];for(T=0;T<32;T++)N[T+1]+=N[T]>>8,A[T]=N[T]&255}function Fn(A){var N=new Float64Array(64),k;for(k=0;k<64;k++)N[k]=A[k];for(k=0;k<64;k++)A[k]=0;$r(A,N)}function Cs(A,N,k,T){var L=new Uint8Array(64),I=new Uint8Array(64),se=new Uint8Array(64),le,K,re=new Float64Array(64),xe=[s(),s(),s(),s()];_t(L,T,32),L[0]&=248,L[31]&=127,L[31]|=64;var Ue=k+64;for(le=0;le<k;le++)A[64+le]=N[le];for(le=0;le<32;le++)A[32+le]=L[32+le];for(_t(se,A.subarray(32),k+32),Fn(se),oi(xe,se),da(A,xe),le=32;le<64;le++)A[le]=T[le];for(_t(I,A,k+64),Fn(I),le=0;le<64;le++)re[le]=0;for(le=0;le<32;le++)re[le]=se[le];for(le=0;le<32;le++)for(K=0;K<32;K++)re[le+K]+=I[le]*L[K];return $r(A.subarray(32),re),Ue}function Ms(A,N){var k=s(),T=s(),L=s(),I=s(),se=s(),le=s(),K=s();return ge(A[2],p),Ot(A[1],N),Be(L,A[1]),oe(I,L,u),_e(L,L,A[2]),mt(I,A[2],I),Be(se,I),Be(le,se),oe(K,le,se),oe(k,K,L),oe(k,k,I),Mt(k,k),oe(k,k,L),oe(k,k,I),oe(k,k,I),oe(A[0],k,I),Be(T,A[0]),oe(T,T,I),Xe(T,L)&&oe(A[0],A[0],v),Be(T,A[0]),oe(T,T,I),Xe(T,L)?-1:(pt(A[0])===N[31]>>7&&_e(A[0],d,A[0]),oe(A[3],A[0],A[1]),0)}function pa(A,N,k,T){var L,I=new Uint8Array(32),se=new Uint8Array(64),le=[s(),s(),s(),s()],K=[s(),s(),s(),s()];if(k<64||Ms(K,T))return-1;for(L=0;L<k;L++)A[L]=N[L];for(L=0;L<32;L++)A[L+32]=T[L];if(_t(se,A,k),Fn(se),ma(le,K,se),oi(K,N.subarray(32)),fn(le,K),da(I,le),k-=64,M(N,0,I,0)){for(L=0;L<k;L++)A[L]=0;return-1}for(L=0;L<k;L++)A[L]=N[L+64];return k}var li=32,Ir=24,Gn=32,Hr=16,Fr=32,Rs=32,Gr=32,mr=32,Ds=32,ya=Ir,Vo=Gn,tr=Hr,it=64,gt=32,hn=64,Ls=32,ga=64;n.lowlevel={crypto_core_hsalsa20:F,crypto_stream_xor:he,crypto_stream:W,crypto_stream_salsa20_xor:D,crypto_stream_salsa20:Q,crypto_onetimeauth:H,crypto_onetimeauth_verify:J,crypto_verify_16:te,crypto_verify_32:M,crypto_secretbox:ce,crypto_secretbox_open:pe,crypto_scalarmult:tt,crypto_scalarmult_base:ye,crypto_box_beforenm:yt,crypto_box_afternm:At,crypto_box:fa,crypto_box_open:ha,crypto_box_keypair:Le,crypto_hash:_t,crypto_sign:Cs,crypto_sign_keypair:zr,crypto_sign_open:pa,crypto_secretbox_KEYBYTES:li,crypto_secretbox_NONCEBYTES:Ir,crypto_secretbox_ZEROBYTES:Gn,crypto_secretbox_BOXZEROBYTES:Hr,crypto_scalarmult_BYTES:Fr,crypto_scalarmult_SCALARBYTES:Rs,crypto_box_PUBLICKEYBYTES:Gr,crypto_box_SECRETKEYBYTES:mr,crypto_box_BEFORENMBYTES:Ds,crypto_box_NONCEBYTES:ya,crypto_box_ZEROBYTES:Vo,crypto_box_BOXZEROBYTES:tr,crypto_sign_BYTES:it,crypto_sign_PUBLICKEYBYTES:gt,crypto_sign_SECRETKEYBYTES:hn,crypto_sign_SEEDBYTES:Ls,crypto_hash_BYTES:ga,gf:s,D:u,L:dr,pack25519:Me,unpack25519:Ot,M:oe,A:mt,S:Be,Z:_e,pow2523:Mt,add:fn,set25519:ge,modL:$r,scalarmult:ma,scalarbase:oi};function Yo(A,N){if(A.length!==li)throw new Error("bad key size");if(N.length!==Ir)throw new Error("bad nonce size")}function Ko(A,N){if(A.length!==Gr)throw new Error("bad public key size");if(N.length!==mr)throw new Error("bad secret key size")}function Rt(){for(var A=0;A<arguments.length;A++)if(!(arguments[A]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function ci(A){for(var N=0;N<A.length;N++)A[N]=0}n.randomBytes=function(A){var N=new Uint8Array(A);return i(N,A),N},n.secretbox=function(A,N,k){Rt(A,N,k),Yo(k,N);for(var T=new Uint8Array(Gn+A.length),L=new Uint8Array(T.length),I=0;I<A.length;I++)T[I+Gn]=A[I];return ce(L,T,T.length,N,k),L.subarray(Hr)},n.secretbox.open=function(A,N,k){Rt(A,N,k),Yo(k,N);for(var T=new Uint8Array(Hr+A.length),L=new Uint8Array(T.length),I=0;I<A.length;I++)T[I+Hr]=A[I];return T.length<32||pe(L,T,T.length,N,k)!==0?null:L.subarray(Gn)},n.secretbox.keyLength=li,n.secretbox.nonceLength=Ir,n.secretbox.overheadLength=Hr,n.scalarMult=function(A,N){if(Rt(A,N),A.length!==Rs)throw new Error("bad n size");if(N.length!==Fr)throw new Error("bad p size");var k=new Uint8Array(Fr);return tt(k,A,N),k},n.scalarMult.base=function(A){if(Rt(A),A.length!==Rs)throw new Error("bad n size");var N=new Uint8Array(Fr);return ye(N,A),N},n.scalarMult.scalarLength=Rs,n.scalarMult.groupElementLength=Fr,n.box=function(A,N,k,T){var L=n.box.before(k,T);return n.secretbox(A,N,L)},n.box.before=function(A,N){Rt(A,N),Ko(A,N);var k=new Uint8Array(Ds);return yt(k,A,N),k},n.box.after=n.secretbox,n.box.open=function(A,N,k,T){var L=n.box.before(k,T);return n.secretbox.open(A,N,L)},n.box.open.after=n.secretbox.open,n.box.keyPair=function(){var A=new Uint8Array(Gr),N=new Uint8Array(mr);return Le(A,N),{publicKey:A,secretKey:N}},n.box.keyPair.fromSecretKey=function(A){if(Rt(A),A.length!==mr)throw new Error("bad secret key size");var N=new Uint8Array(Gr);return ye(N,A),{publicKey:N,secretKey:new Uint8Array(A)}},n.box.publicKeyLength=Gr,n.box.secretKeyLength=mr,n.box.sharedKeyLength=Ds,n.box.nonceLength=ya,n.box.overheadLength=n.secretbox.overheadLength,n.sign=function(A,N){if(Rt(A,N),N.length!==hn)throw new Error("bad secret key size");var k=new Uint8Array(it+A.length);return Cs(k,A,A.length,N),k},n.sign.open=function(A,N){if(Rt(A,N),N.length!==gt)throw new Error("bad public key size");var k=new Uint8Array(A.length),T=pa(k,A,A.length,N);if(T<0)return null;for(var L=new Uint8Array(T),I=0;I<L.length;I++)L[I]=k[I];return L},n.sign.detached=function(A,N){for(var k=n.sign(A,N),T=new Uint8Array(it),L=0;L<T.length;L++)T[L]=k[L];return T},n.sign.detached.verify=function(A,N,k){if(Rt(A,N,k),N.length!==it)throw new Error("bad signature size");if(k.length!==gt)throw new Error("bad public key size");var T=new Uint8Array(it+A.length),L=new Uint8Array(it+A.length),I;for(I=0;I<it;I++)T[I]=N[I];for(I=0;I<A.length;I++)T[I+it]=A[I];return pa(L,T,T.length,k)>=0},n.sign.keyPair=function(){var A=new Uint8Array(gt),N=new Uint8Array(hn);return zr(A,N),{publicKey:A,secretKey:N}},n.sign.keyPair.fromSecretKey=function(A){if(Rt(A),A.length!==hn)throw new Error("bad secret key size");for(var N=new Uint8Array(gt),k=0;k<N.length;k++)N[k]=A[32+k];return{publicKey:N,secretKey:new Uint8Array(A)}},n.sign.keyPair.fromSeed=function(A){if(Rt(A),A.length!==Ls)throw new Error("bad seed size");for(var N=new Uint8Array(gt),k=new Uint8Array(hn),T=0;T<32;T++)k[T]=A[T];return zr(N,k,!0),{publicKey:N,secretKey:k}},n.sign.publicKeyLength=gt,n.sign.secretKeyLength=hn,n.sign.seedLength=Ls,n.sign.signatureLength=it,n.hash=function(A){Rt(A);var N=new Uint8Array(ga);return _t(N,A,A.length),N},n.hash.hashLength=ga,n.verify=function(A,N){return Rt(A,N),A.length===0||N.length===0||A.length!==N.length?!1:ne(A,0,N,0,A.length)===0},n.setPRNG=function(A){i=A},(function(){var A=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(A&&A.getRandomValues){var N=65536;n.setPRNG(function(k,T){var L,I=new Uint8Array(T);for(L=0;L<T;L+=N)A.getRandomValues(I.subarray(L,L+Math.min(T-L,N)));for(L=0;L<T;L++)k[L]=I[L];ci(I)})}else typeof require<"u"&&(A=require("crypto"),A&&A.randomBytes&&n.setPRNG(function(k,T){var L,I=A.randomBytes(T);for(L=0;L<T;L++)k[L]=I[L];ci(I)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const cc=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;cc.sign.keyPair.fromSeed,cc.sign.detached,cc.sign.detached.verify,cc.randomBytes;var db;(function(n){n.InvalidPrefixByte="nkeys: invalid prefix byte",n.InvalidKey="nkeys: invalid key",n.InvalidPublicKey="nkeys: invalid public key",n.InvalidSeedLen="nkeys: invalid seed length",n.InvalidSeed="nkeys: invalid seed",n.InvalidEncoding="nkeys: invalid encoded key",n.InvalidSignature="nkeys: signature verification failed",n.CannotSign="nkeys: cannot sign, no private key available",n.PublicKeyOnly="nkeys: no seed or private key available",n.InvalidChecksum="nkeys: invalid checksum",n.SerializationError="nkeys: serialization error",n.ApiError="nkeys: api error",n.ClearedPair="nkeys: pair is cleared"})(db||(db={}));var mb;(function(n){n[n.Seed=144]="Seed",n[n.Private=120]="Private",n[n.Operator=112]="Operator",n[n.Server=104]="Server",n[n.Cluster=16]="Cluster",n[n.Account=0]="Account",n[n.User=160]="User"})(mb||(mb={}));function x2(n){return e=>{let s={};return n.forEach(i=>{const o=i(e)||{};s=Object.assign(s,o)}),s}}function v2(){return()=>{}}function _2(n,e){return()=>{const s=typeof n=="function"?n():n,i=typeof e=="function"?e():e;return{user:s,pass:i}}}function w2(n){return()=>({auth_token:typeof n=="function"?n():n})}const Tx=120*1e3,S2=2,Cx=2*1e3;function E2(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:Tx,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:Cx,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function O2(n){const e=[];return typeof n.authenticator=="function"&&e.push(n.authenticator),Array.isArray(n.authenticator)&&e.push(...n.authenticator),n.token&&e.push(w2(n.token)),n.user&&e.push(_2(n.user,n.pass)),e.length===0?v2():x2(e)}function A2(n){const e=`${Od}:${jx()}`;if(n=n||{servers:[e]},n.servers=n.servers||[],typeof n.servers=="string"&&(n.servers=[n.servers]),n.servers.length>0&&n.port)throw new be("port and servers options are mutually exclusive",fe.InvalidOption);n.servers.length===0&&n.port&&(n.servers=[`${Od}:${n.port}`]),n.servers&&n.servers.length===0&&(n.servers=[e]);const s=Au(E2(),n);if(s.authenticator=O2(s),["reconnectDelayHandler","authenticator"].forEach(i=>{if(s[i]&&typeof s[i]!="function")throw new be(`${i} option should be a function`,fe.NotFunction)}),s.reconnectDelayHandler||(s.reconnectDelayHandler=()=>{let i=s.tls?s.reconnectJitterTLS:s.reconnectJitter;return i&&(i++,i=Math.floor(Math.random()*i)),s.reconnectTimeWait+i}),s.inboxPrefix)try{Lr(s.inboxPrefix)}catch(i){throw new be(i.message,fe.ApiError)}if(s.resolve===void 0&&(s.resolve=typeof Rd()=="function"),s.resolve&&typeof Rd()!="function")throw new be("'resolve' is not supported on this client",fe.InvalidOption);return s}function j2(n,e){const{proto:s,tls_required:i,tls_available:o}=n;if((s===void 0||s<1)&&e.noEcho)throw new be("noEcho",fe.ServerOptionNotAvailable);const c=i||o||!1;if(e.tls&&!c)throw new be("tls",fe.ServerOptionNotAvailable)}const k2=1024*32,N2=/^INFO\s+([^\r\n]+)\r\n/i,T2=wo(`PONG\r
38
+ `),pb=wo(`PING\r
39
+ `);class C2{constructor(e,s,i){j(this,"echo");j(this,"no_responders");j(this,"protocol");j(this,"verbose");j(this,"pedantic");j(this,"jwt");j(this,"nkey");j(this,"sig");j(this,"user");j(this,"pass");j(this,"auth_token");j(this,"tls_required");j(this,"name");j(this,"lang");j(this,"version");j(this,"headers");this.protocol=1,this.version=e.version,this.lang=e.lang,this.echo=s.noEcho?!1:void 0,this.verbose=s.verbose,this.pedantic=s.pedantic,this.tls_required=s.tls?!0:void 0,this.name=s.name;const o=(s&&typeof s.authenticator=="function"?s.authenticator(i):{})||{};Au(this,o)}}class Mx extends Ut{constructor(s,i,o={}){var d;super();j(this,"sid");j(this,"queue");j(this,"draining");j(this,"max");j(this,"subject");j(this,"drained");j(this,"protocol");j(this,"timer");j(this,"info");j(this,"cleanupFn");j(this,"closed");j(this,"requestSubject");Au(this,o),this.protocol=s,this.subject=i,this.draining=!1,this.noIterator=typeof o.callback=="function",this.closed=dt();const c=!((d=s.options)!=null&&d.noAsyncTraces);o.timeout&&(this.timer=ia(o.timeout,c),this.timer.then(()=>{this.timer=void 0}).catch(p=>{this.stop(p),this.noIterator&&this.callback(p,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(s){if(this.noIterator){const i=this.callback,o=s.ingestionFilterFn?s.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),c=s.protocolFilterFn?s.protocolFilterFn:()=>!0,d=s.dispatchedFn?s.dispatchedFn:()=>{};this.callback=(p,g)=>{const{ingest:u}=o(g);u&&c(g)&&(i(p,g),d(g))}}else this.protocolFilterFn=s.protocolFilterFn,this.dispatchedFn=s.dispatchedFn}callback(s,i){this.cancelTimeout(),s?this.stop(s):this.push(i)}close(){if(!this.isClosed()){this.cancelTimeout();const s=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?s():this.push(s)}}unsubscribe(s){this.protocol.unsubscribe(this,s)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(be.errorForCode(fe.ConnectionClosed)):this.isClosed()?Promise.reject(be.errorForCode(fe.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(dt()).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 M2{constructor(){j(this,"mux");j(this,"subs");j(this,"sidCounter");this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(e){return this.sidCounter++,e.sid=this.sidCounter,this.subs.set(e.sid,e),e}setMux(e){return this.mux=e,e}getMux(){return this.mux}get(e){return this.subs.get(e)}resub(e){return this.sidCounter++,this.subs.delete(e.sid),e.sid=this.sidCounter,this.subs.set(e.sid,e),e}all(){return Array.from(this.subs.values())}cancel(e){e&&(e.close(),this.subs.delete(e.sid))}handleError(e){if(e&&e.permissionContext){const s=e.permissionContext,i=this.all();let o;if(s.operation==="subscription"&&(o=i.find(c=>c.subject===s.subject&&c.queue===s.queue)),s.operation==="publish"&&(o=i.find(c=>c.requestSubject===s.subject)),o)return o.callback(e,{}),o.close(),this.subs.delete(o.sid),o!==this.mux}return!1}close(){this.subs.forEach(e=>{e.close()})}}class gu{constructor(e,s){j(this,"connected");j(this,"connectedOnce");j(this,"infoReceived");j(this,"info");j(this,"muxSubscriptions");j(this,"options");j(this,"outbound");j(this,"pongs");j(this,"subscriptions");j(this,"transport");j(this,"noMorePublishing");j(this,"connectError");j(this,"publisher");j(this,"_closed");j(this,"closed");j(this,"listeners");j(this,"heartbeats");j(this,"parser");j(this,"outMsgs");j(this,"inMsgs");j(this,"outBytes");j(this,"inBytes");j(this,"pendingLimit");j(this,"lastError");j(this,"abortReconnect");j(this,"whyClosed");j(this,"servers");j(this,"server");j(this,"features");j(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=k2,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=e,this.publisher=s,this.subscriptions=new M2,this.muxSubscriptions=new m2,this.outbound=new oa,this.pongs=[],this.whyClosed="",this.pendingLimit=e.pendingLimit||this.pendingLimit,this.features=new KE({major:0,minor:0,micro:0}),this.connectPromise=null;const i=typeof e.servers=="string"?[e.servers]:e.servers;this.servers=new d2(i,{randomize:!e.noRandomize}),this.closed=dt(),this.parser=new hb(this),this.heartbeats=new p2(this,this.options.pingInterval||Tx,this.options.maxPingOut||S2)}resetOutbound(){this.outbound.reset();const e=this.pongs;this.pongs=[];const s=be.errorForCode(fe.Disconnect);s.stack="",e.forEach(i=>{i.reject(s)}),this.parser=new hb(this),this.infoReceived=!1}dispatchStatus(e){this.listeners.forEach(s=>{s.push(e)})}status(){const e=new Ut;return this.listeners.push(e),e}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const e=dt();return e.catch(()=>{}),this.pongs.unshift(e),this.connectError=s=>{e.reject(s)},this.transport=XE(),this.transport.closed().then(async s=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),e}disconnect(){this.dispatchStatus({type:Xi.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:Xi.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(e){this.dispatchStatus({type:Dr.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var s;this.dispatchStatus({type:Dr.Reconnect,data:this.servers.getCurrentServer().toString()}),((s=this.lastError)==null?void 0:s.code)===fe.AuthenticationExpired&&(this.lastError=void 0)}).catch(s=>{this._close(s)}):await this._close(e)}async dial(e){const s=this.prepare();let i;try{i=ia(this.options.timeout||2e4);const o=this.transport.connect(e,this.options);await Promise.race([o,i]),(async()=>{try{for await(const c of this.transport)this.parser.parse(c)}catch(c){console.log("reader closed",c)}})().then()}catch(o){s.reject(o)}try{await Promise.race([i,s]),i&&i.cancel(),this.connected=!0,this.connectError=void 0,this.sendSubscriptions(),this.connectedOnce=!0,this.server.didConnect=!0,this.server.reconnects=0,this.flushPending(),this.heartbeats.start()}catch(o){throw i&&i.cancel(),await this.transport.close(o),o}}async _doDial(e){const{resolve:s}=this.options,i=await e.resolve({fn:Rd(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:s});let o=null;for(const c of i)try{o=null,this.dispatchStatus({type:Xi.Reconnecting,data:c.toString()}),await this.dial(c);return}catch(d){o=d}throw o}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let e;for(;;){this._closed&&this.servers.clear();const s=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():Cx;let i=s;const o=this.selectServer();if(!o||this.abortReconnect)throw e||(this.lastError?this.lastError:be.errorForCode(fe.ConnectionRefused));const c=Date.now();if(o.lastConnect===0||o.lastConnect+s<=c){o.lastConnect=Date.now();try{await this._doDial(o);break}catch(d){if(e=d,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}o.reconnects++;const p=this.options.maxReconnectAttempts||0;p!==-1&&o.reconnects>=p&&this.servers.removeCurrentServer()}}else i=Math.min(i,o.lastConnect+s-c),await la(i)}}static async connect(e,s){const i=new gu(e,s);return await i.dialLoop(),i}static toError(e){const s=e?e.toLowerCase():"";if(s.indexOf("permissions violation")!==-1){const i=new be(e,fe.PermissionsViolation),o=e.match(/(Publish|Subscription) to "(\S+)"/);if(o){i.permissionContext={operation:o[1].toLowerCase(),subject:o[2],queue:void 0};const c=e.match(/using queue "(\S+)"/);c&&(i.permissionContext.queue=c[1])}return i}else return s.indexOf("authorization violation")!==-1?new be(e,fe.AuthorizationViolation):s.indexOf("user authentication expired")!==-1?new be(e,fe.AuthenticationExpired):s.indexOf("account authentication expired")!=-1?new be(e,fe.AccountExpired):s.indexOf("authentication timeout")!==-1?new be(e,fe.AuthenticationTimeout):new be(e,fe.ProtocolError)}processMsg(e,s){if(this.inMsgs++,this.inBytes+=s.length,!this.subscriptions.sidCounter)return;const i=this.subscriptions.get(e.sid);i&&(i.received+=1,i.callback&&i.callback(null,new pm(e,s,this)),i.max!==void 0&&i.received>=i.max&&i.unsubscribe())}processError(e){const s=Xg(e),i=gu.toError(s),o={type:Dr.Error,data:i.code};if(i.isPermissionError()){let c=!1;if(i.permissionContext){o.permissionContext=i.permissionContext;const d=this.subscriptions.getMux();c=(d==null?void 0:d.subject)===i.permissionContext.subject}this.subscriptions.handleError(i),this.muxSubscriptions.handleError(c,i),c&&this.subscriptions.setMux(null)}this.dispatchStatus(o),this.handleError(i)}handleError(e){e.isAuthError()?this.handleAuthError(e):e.isProtocolError()?this.lastError=e:e.isAuthTimeout()&&(this.lastError=e),e.isPermissionError()||(this.lastError=e)}handleAuthError(e){this.lastError&&e.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(e):this.disconnect()}processPing(){this.transport.send(T2)}processPong(){const e=this.pongs.shift();e&&e.resolve()}processInfo(e){const s=JSON.parse(Xg(e));this.info=s;const i=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(s,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(ni(s.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:c,lang:d}=this.transport;try{const p=new C2({version:c,lang:d},this.options,s.nonce);s.headers&&(p.headers=!0,p.no_responders=!0);const g=JSON.stringify(p);this.transport.send(wo(`CONNECT ${g}${su}`)),this.transport.send(pb)}catch(p){this._close(p)}}i&&this.dispatchStatus({type:Dr.Update,data:i}),(s.ldm!==void 0?s.ldm:!1)&&this.dispatchStatus({type:Dr.LDM,data:this.servers.getCurrentServer().toString()})}push(e){switch(e.kind){case Xt.MSG:{const{msg:s,data:i}=e;this.processMsg(s,i);break}case Xt.OK:break;case Xt.ERR:this.processError(e.data);break;case Xt.PING:this.processPing();break;case Xt.PONG:this.processPong();break;case Xt.INFO:this.processInfo(e.data);break}}sendCommand(e,...s){const i=this.outbound.length();let o;typeof e=="string"?o=wo(e):o=e,this.outbound.fill(o,...s),i===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(e,s=jn,i){let o;if(s instanceof Uint8Array)o=s;else if(typeof s=="string")o=si.encode(s);else throw be.errorForCode(fe.BadPayload);let c=o.length;i=i||{},i.reply=i.reply||"";let d=jn,p=0;if(i.headers){if(this.info&&!this.info.headers)throw new be("headers",fe.ServerOptionNotAvailable);d=i.headers.encode(),p=d.length,c=o.length+p}if(this.info&&c>this.info.max_payload)throw be.errorForCode(fe.MaxPayloadExceeded);this.outBytes+=c,this.outMsgs++;let g;i.headers?(i.reply?g=`HPUB ${e} ${i.reply} ${p} ${c}\r
40
+ `:g=`HPUB ${e} ${p} ${c}\r
41
+ `,this.sendCommand(g,d,o,yu)):(i.reply?g=`PUB ${e} ${i.reply} ${c}\r
42
+ `:g=`PUB ${e} ${c}\r
43
+ `,this.sendCommand(g,o,yu))}request(e){return this.initMux(),this.muxSubscriptions.add(e),e}subscribe(e){return this.subscriptions.add(e),this._subunsub(e),e}_sub(e){e.queue?this.sendCommand(`SUB ${e.subject} ${e.queue} ${e.sid}\r
44
+ `):this.sendCommand(`SUB ${e.subject} ${e.sid}\r
45
+ `)}_subunsub(e){return this._sub(e),e.max&&this.unsubscribe(e,e.max),e}unsubscribe(e,s){this.unsub(e,s),(e.max===void 0||e.received>=e.max)&&this.subscriptions.cancel(e)}unsub(e,s){!e||this.isClosed()||(s?this.sendCommand(`UNSUB ${e.sid} ${s}\r
46
+ `):this.sendCommand(`UNSUB ${e.sid}\r
47
+ `),e.max=s)}resub(e,s){!e||this.isClosed()||(this.unsub(e),e.subject=s,this.subscriptions.resub(e),this._sub(e))}flush(e){return e||(e=dt()),this.pongs.push(e),this.outbound.fill(pb),this.flushPending(),e}sendSubscriptions(){const e=[];this.subscriptions.all().forEach(s=>{const i=s;i.queue?e.push(`SUB ${i.subject} ${i.queue} ${i.sid}${su}`):e.push(`SUB ${i.subject} ${i.sid}${su}`)}),e.length&&this.transport.send(wo(e.join("")))}async _close(e){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(e),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(s=>{s.stop()}),this._closed=!0,await this.transport.close(e),await this.closed.resolve(e))}close(){return this._close()}isClosed(){return this._closed}drain(){const e=this.subscriptions.all(),s=[];return e.forEach(i=>{s.push(i.drain())}),Promise.all(s).then(async()=>(this.noMorePublishing=!0,await this.flush(),this.close())).catch(()=>{})}flushPending(){if(!(!this.infoReceived||!this.connected)&&this.outbound.size()){const e=this.outbound.drain();this.transport.send(e)}}initMux(){if(!this.subscriptions.getMux()){const s=this.muxSubscriptions.init(this.options.inboxPrefix),i=new Mx(this,`${s}*`);i.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(i),this.subscribe(i)}}selectServer(){const e=this.servers.selectServer();if(e!==void 0)return this.server=e,this.server}getServer(){return this.server}}const R2="$SRV";class yb{constructor(e){j(this,"msg");this.msg=e}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(e,s){return this.msg.respond(e,s)}respondError(e,s,i,o){var c,d;return o=o||{},o.headers=o.headers||Pr(),(c=o.headers)==null||c.set(hu,`${e}`),(d=o.headers)==null||d.set(fu,s),this.msg.respond(i,o)}json(e){return this.msg.json(e)}string(){return this.msg.string()}}class ko{constructor(e,s="",i=""){j(this,"subject");j(this,"queue");j(this,"srv");s!==""&&L2("service group",s);let o="";if(e instanceof Lo)this.srv=e,o="";else if(e instanceof ko){const c=e;this.srv=c.srv,i===""&&c.queue!==""&&(i=c.queue),o=c.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(o,s),this.queue=i}calcSubject(e,s=""){return s===""?e:e!==""?`${e}.${s}`:s}addEndpoint(e="",s){s=s||{subject:e};const i=typeof s=="function"?{handler:s,subject:e}:s;xo("endpoint",e);let{subject:o,handler:c,metadata:d,queue:p}=i;o=o||e,p=p||this.queue,D2("endpoint subject",o),o=this.calcSubject(this.subject,o);const g={name:e,subject:o,queue:p,handler:c,metadata:d};return this.srv._addEndpoint(g)}addGroup(e="",s=""){return new ko(this,e,s)}}function D2(n,e){if(e==="")throw new Error(`${n} cannot be empty`);if(e.indexOf(" ")!==-1)throw new Error(`${n} cannot contain spaces: '${e}'`);const s=e.split(".");s.forEach((i,o)=>{if(i===">"&&o!==s.length-1)throw new Error(`${n} cannot have internal '>': '${e}'`)})}function L2(n,e){if(e.indexOf(" ")!==-1)throw new Error(`${n} cannot contain spaces: '${e}'`);e.split(".").forEach(i=>{if(i===">")throw new Error(`${n} name cannot contain internal '>': '${e}'`)})}class Lo{constructor(e,s={name:"",version:""}){j(this,"nc");j(this,"_id");j(this,"config");j(this,"handlers");j(this,"internal");j(this,"_stopped");j(this,"_done");j(this,"started");this.nc=e,this.config=Object.assign({},s),this.config.queue||(this.config.queue="q"),xo("name",this.config.name),xo("queue",this.config.queue),ni(this.config.version),this._id=js.next(),this.internal=[],this._done=dt(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(i=>{this.close(i).catch()})}static controlSubject(e,s="",i="",o){const c=o??R2;return s===""&&i===""?`${c}.${e}`:(xo("control subject name",s),i!==""?(xo("control subject id",i),`${c}.${e}.${s}.${i}`):`${c}.${e}.${s}`)}get subjects(){return this.handlers.filter(e=>e.internal===!1).map(e=>e.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(e){const s=Pr();if(e instanceof du){const i=e;s.set(fu,i.message),s.set(hu,`${i.code}`)}else s.set(fu,e.message),s.set(hu,"500");return s}setupHandler(e,s=!1){const i=s?"":e.queue?e.queue:this.config.queue,{name:o,subject:c,handler:d}=e,p=e;p.internal=s,s&&this.internal.push(p),p.stats=new q2(o,c,i),p.queue=i;const g=d?(u,m)=>{if(u){this.close(u);return}const b=Date.now();try{d(u,new yb(m))}catch(x){p.stats.countError(x),m==null||m.respond(jn,{headers:this.errorToHeader(x)})}finally{p.stats.countLatency(b)}}:void 0;return p.sub=this.nc.subscribe(c,{callback:g,queue:i}),p.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${e.subject} stopped`)).catch()}).catch(u=>{if(!this._stopped){const m=new Error(`required subscription ${e.subject} errored: ${u.message}`);m.stack=u.stack,this.close(m).catch()}}),p}info(){return{type:So.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(e=>{const{subject:s,metadata:i,name:o,queue:c}=e;return{subject:s,metadata:i,name:o,queue_group:c}})}async stats(){const e=[];for(const s of this.handlers){if(typeof this.config.statsHandler=="function")try{s.stats.data=await this.config.statsHandler(s)}catch(i){s.stats.countError(i)}e.push(s.stats.stats(s.qi))}return{type:So.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:e}}addInternalHandler(e,s){const i=`${e}`.toUpperCase();this._doAddInternalHandler(`${i}-all`,e,s),this._doAddInternalHandler(`${i}-kind`,e,s,this.name),this._doAddInternalHandler(`${i}`,e,s,this.name,this.id)}_doAddInternalHandler(e,s,i,o="",c=""){const d={};d.name=e,d.subject=Lo.controlSubject(s,o,c),d.handler=i,this.setupHandler(d,!0)}start(){const e=er(),s=(d,p)=>d?(this.close(d),Promise.reject(d)):this.stats().then(g=>(p==null||p.respond(e.encode(g)),Promise.resolve())),i=(d,p)=>d?(this.close(d),Promise.reject(d)):(p==null||p.respond(e.encode(this.info())),Promise.resolve()),o=e.encode(this.ping()),c=(d,p)=>d?(this.close(d).then().catch(),Promise.reject(d)):(p.respond(o),Promise.resolve());return this.addInternalHandler(ws.PING,c),this.addInternalHandler(ws.STATS,s),this.addInternalHandler(ws.INFO,i),this.handlers.forEach(d=>{const{subject:p}=d;typeof p=="string"&&d.handler!==null&&this.setupHandler(d)}),Promise.resolve(this)}close(e){if(this._stopped)return this._done;this._stopped=!0;let s=[];return this.nc.isClosed()||(s=this.handlers.concat(this.internal).map(i=>i.sub.drain())),Promise.allSettled(s).then(()=>{this._done.resolve(e||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(e){return this.close(e)}ping(){return{type:So.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const e of this.handlers)e.stats.reset(e.qi)}addGroup(e,s){return new ko(this,e,s)}addEndpoint(e,s){return new ko(this).addEndpoint(e,s)}_addEndpoint(e){const s=new Ut;s.noIterator=typeof e.handler=="function",s.noIterator||(e.handler=(o,c)=>{o?this.stop(o).catch():s.push(new yb(c))},s.iterClosed.then(()=>{this.close().catch()}));const i=this.setupHandler(e,!1);return i.qi=s,this.handlers.push(i),s}}class q2{constructor(e,s,i=""){j(this,"name");j(this,"subject");j(this,"average_processing_time");j(this,"num_requests");j(this,"processing_time");j(this,"num_errors");j(this,"last_error");j(this,"data");j(this,"metadata");j(this,"queue");this.name=e,this.subject=s,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=i}reset(e){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const s=e;s&&(s.time=0,s.processed=0)}countLatency(e){this.num_requests++,this.processing_time+=ht(Date.now()-e),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(e){this.num_errors++,this.last_error=e.message}_stats(){const{name:e,subject:s,average_processing_time:i,num_errors:o,num_requests:c,processing_time:d,last_error:p,data:g,queue:u}=this;return{name:e,subject:s,average_processing_time:i,num_errors:o,num_requests:c,processing_time:d,last_error:p,data:g,queue_group:u}}stats(e){const s=e;return(s==null?void 0:s.noIterator)===!1&&(this.processing_time=ht(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 P2{constructor(e,s={strategy:Zn.JitterTimer,maxWait:2e3},i){j(this,"nc");j(this,"prefix");j(this,"opts");this.nc=e,this.prefix=i,this.opts=s}ping(e="",s=""){return this.q(ws.PING,e,s)}stats(e="",s=""){return this.q(ws.STATS,e,s)}info(e="",s=""){return this.q(ws.INFO,e,s)}async q(e,s="",i=""){const o=new Ut,c=er(),d=Lo.controlSubject(e,s,i,this.prefix),p=await this.nc.requestMany(d,jn,this.opts);return(async()=>{for await(const g of p)try{const u=c.decode(g.data);o.push(u)}catch(u){o.push(()=>{o.stop(u)})}o.push(()=>{o.stop()})})().catch(g=>{o.stop(g)}),o}}function Rx(){return{key:{encode(n){return n},decode(n){return n}},value:{encode(n){return n},decode(n){return n}}}}function B2(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Rx(),storage:Td.File}}const bu="KV-Operation",gb="$KV",U2=/^[-/=.\w]+$/,z2=/^[-/=.>*\w]+$/,$2=/^[-\w]+$/;function I2(n){if(n.startsWith(".")||n.endsWith(".")||!U2.test(n))throw new Error(`invalid key: ${n}`)}function H2(n){if(n.startsWith(".")||n.endsWith(".")||!z2.test(n))throw new Error(`invalid key: ${n}`)}function F2(n){if(n.startsWith(".")||n.endsWith("."))throw new Error(`invalid key: ${n}`);const e=n.split(".");let s=!1;for(let i=0;i<e.length;i++)switch(e[i]){case"*":s=!0;break;case">":if(i!==e.length-1)throw new Error(`invalid key: ${n}`);s=!0;break}return s}function iu(n){if(!$2.test(n))throw new Error(`invalid bucket name: ${n}`)}var or;(function(n){n.MsgIdHdr="Nats-Msg-Id",n.ExpectedStreamHdr="Nats-Expected-Stream",n.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",n.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",n.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})(or||(or={}));class No{constructor(e,s,i){j(this,"js");j(this,"jsm");j(this,"stream");j(this,"bucket");j(this,"direct");j(this,"codec");j(this,"prefix");j(this,"editPrefix");j(this,"useJsPrefix");j(this,"_prefixLen");j(this,"validateKey",I2);j(this,"validateSearchKey",H2);j(this,"hasWildcards",F2);iu(e),this.js=s,this.jsm=i,this.bucket=e,this.prefix=gb,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(e,s,i={}){iu(s);const o=await e.jetstreamManager(),c=new No(s,e,o);return await c.init(i),c}static async bind(e,s,i={}){const o=await e.jetstreamManager(),c={config:{allow_direct:i.allow_direct}};iu(s);const d=new No(s,e,o);return c.config.name=i.streamName??d.bucketName(),Object.assign(d,c),d.stream=c.config.name,d.codec=i.codec||Rx(),d.direct=c.config.allow_direct??!1,d.initializePrefixes(c),d}async init(e={}){const s=Object.assign(B2(),e);this.codec=s.codec;const i={};this.stream=i.name=e.streamName??this.bucketName(),i.retention=Nd.Limits,i.max_msgs_per_subject=s.history,s.maxBucketSize&&(s.max_bytes=s.maxBucketSize),s.max_bytes&&(i.max_bytes=s.max_bytes),i.max_msg_size=s.maxValueSize,i.storage=s.storage;const o=e.placementCluster??"";if(o&&(e.placement={},e.placement.cluster=o,e.placement.tags=[]),e.placement&&(i.placement=e.placement),e.republish&&(i.republish=e.republish),e.description&&(i.description=e.description),e.mirror){const b=Object.assign({},e.mirror);b.name.startsWith(Sn)||(b.name=`${Sn}${b.name}`),i.mirror=b,i.mirror_direct=!0}else if(e.sources){const b=e.sources.map(x=>{const v=Object.assign({},x),_=v.name.startsWith(Sn)?v.name.substring(Sn.length):v.name;return v.name.startsWith(Sn)||(v.name=`${Sn}${v.name}`),!x.external&&_!==this.bucket&&(v.subject_transforms=[{src:`$KV.${_}.>`,dest:`$KV.${this.bucket}.>`}]),v});i.sources=b,i.subjects=[this.subjectForBucket()]}else i.subjects=[this.subjectForBucket()];e.metadata&&(i.metadata=e.metadata),typeof e.compression=="boolean"&&(i.compression=e.compression?ks.S2:ks.None);const c=this.js.nc,d=c.getServerVersion(),p=d?Md(d,ni("2.7.2"))>=0:!1;i.discard=p?jo.New:jo.Old;const{ok:g,min:u}=c.features.get(Ye.JS_ALLOW_DIRECT);if(!g&&e.allow_direct===!0){const b=d?`${d.major}.${d.minor}.${d.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${b} - requires ${u}`))}e.allow_direct=typeof e.allow_direct=="boolean"?e.allow_direct:g,i.allow_direct=e.allow_direct,this.direct=i.allow_direct,i.num_replicas=s.replicas,s.ttl&&(i.max_age=ht(s.ttl)),i.allow_rollup_hdrs=!0;let m;try{m=await this.jsm.streams.info(i.name),!m.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(b){if(b.message==="stream not found")m=await this.jsm.streams.add(i);else throw b}this.initializePrefixes(m)}initializePrefixes(e){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:s}=e.config;if(s){let i=s.name;if(i.startsWith(Sn)&&(i=i.substring(Sn.length)),s.external&&s.external.api!==""){const o=s.name.substring(Sn.length);this.useJsPrefix=!1,this.prefix=`$KV.${o}`,this.editPrefix=`${s.external.api}.$KV.${i}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${Sn}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(e,s=!1){const i=[];return s?(this.useJsPrefix&&i.push(this.js.apiPrefix),this.editPrefix!==""?i.push(this.editPrefix):i.push(this.prefix)):this.prefix&&i.push(this.prefix),i.push(e),i.join(".")}fullKeyName(e){return this.prefix!==""?`${this.prefix}.${e}`:`${gb}.${this.bucket}.${e}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(e){const s=[];for(const i of e.split("."))switch(i){case">":case"*":s.push(i);break;default:s.push(this.codec.key.encode(i));break}return s.join(".")}decodeKey(e){const s=[];for(const i of e.split("."))switch(i){case">":case"*":s.push(i);break;default:s.push(this.codec.key.decode(i));break}return s.join(".")}close(){return Promise.resolve()}dataLen(e,s){const i=s&&s.get(Zt.MessageSizeHdr)||"";return i!==""?parseInt(i,10):e.length}smToEntry(e){return new iO(this.bucket,this.prefixLen,e)}jmToEntry(e){const s=this.decodeKey(e.subject.substring(this.prefixLen));return new aO(this.bucket,s,e)}async create(e,s){var c;let i;try{const d=await this.put(e,s,{previousSeq:0});return Promise.resolve(d)}catch(d){if(i=d,((c=d==null?void 0:d.api_error)==null?void 0:c.err_code)!==10071)return Promise.reject(d)}let o=0;try{const d=await this.get(e);return(d==null?void 0:d.operation)==="DEL"||(d==null?void 0:d.operation)==="PURGE"?(o=d!==null?d.revision:0,this.update(e,s,o)):Promise.reject(i)}catch(d){return Promise.reject(d)}}update(e,s,i){if(i<=0)throw new Error("version must be greater than 0");return this.put(e,s,{previousSeq:i})}async put(e,s,i={}){var d,p;const o=this.encodeKey(e);this.validateKey(o);const c={};if(i.previousSeq!==void 0){const g=Pr();c.headers=g,g.set(or.ExpectedLastSubjectSequenceHdr,`${i.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(o,!0),s,c)).seq}catch(g){const u=g;return u.isJetStreamError()?(u.message=(d=u.api_error)==null?void 0:d.description,u.code=`${(p=u.api_error)==null?void 0:p.code}`,Promise.reject(u)):Promise.reject(g)}}async get(e,s){const i=this.encodeKey(e);this.validateKey(i);let o={last_by_subj:this.subjectForKey(i)};s&&s.revision>0&&(o={seq:s.revision});let c;try{this.direct?c=await this.jsm.direct.getMessage(this.bucketName(),o):c=await this.jsm.streams.getMessage(this.bucketName(),o);const d=this.smToEntry(c);return d.key!==i?null:d}catch(d){if(d.code===fe.JetStream404NoMessages)return null;throw d}}purge(e,s){return this._deleteOrPurge(e,"PURGE",s)}delete(e,s){return this._deleteOrPurge(e,"DEL",s)}async purgeDeletes(e=1800*1e3){const s=dt(),i=[],o=await this.watch({key:">",initializedFn:()=>{s.resolve()}});(async()=>{for await(const g of o)(g.operation==="DEL"||g.operation==="PURGE")&&i.push(g)})().then(),await s,o.stop();const c=Date.now()-e,d=i.map(g=>{const u=this.subjectForKey(g.key);return g.created.getTime()>=c?this.jsm.streams.purge(this.stream,{filter:u,keep:1}):this.jsm.streams.purge(this.stream,{filter:u,keep:0})}),p=await Promise.all(d);return p.unshift({success:!0,purged:0}),p.reduce((g,u)=>(g.purged+=u.purged,g))}async _deleteOrPurge(e,s,i){if(!this.hasWildcards(e))return this._doDeleteOrPurge(e,s,i);const o=await this.keys(e),c=[];for await(const d of o)c.push(this._doDeleteOrPurge(d,s)),c.length===100&&(await Promise.all(c),c.length=0);c.length>0&&await Promise.all(c)}async _doDeleteOrPurge(e,s,i){const o=this.encodeKey(e);this.validateKey(o);const c=Pr();c.set(bu,s),s==="PURGE"&&c.set(Zt.RollupHdr,Zt.RollupValueSubject),i!=null&&i.previousSeq&&c.set(or.ExpectedLastSubjectSequenceHdr,`${i.previousSeq}`),await this.js.publish(this.subjectForKey(o,!0),jn,{headers:c})}_buildCC(e,s,i={}){let c=(Array.isArray(e)?e:[e]).map(g=>{const u=this.encodeKey(g);return this.validateSearchKey(g),this.fullKeyName(u)}),d=Et.LastPerSubject;s===Xn.AllHistory&&(d=Et.All),s===Xn.UpdatesOnly&&(d=Et.New);let p;return c.length===1&&(p=c[0],c=void 0),Object.assign({deliver_policy:d,ack_policy:Bt.None,filter_subjects:c,filter_subject:p,flow_control:!0,idle_heartbeat:ht(5*1e3)},i)}remove(e){return this.purge(e)}async history(e={}){const s=e.key??">",i=new Ut,o={};o.headers_only=e.headers_only||!1;let c;c=()=>{i.stop()};let d=0;const p=this._buildCC(s,Xn.AllHistory,o),g=p.filter_subject,u=Es(p);u.bindStream(this.stream),u.orderedConsumer(),u.callback((b,x)=>{if(b){i.stop(b);return}if(x){const v=this.jmToEntry(x);i.push(v),i.received++,(c&&d>0&&i.received>=d||x.info.pending===0)&&(i.push(c),c=void 0)}});const m=await this.js.subscribe(g,u);if(c){const{info:{last:b}}=m,x=b.num_pending+b.delivered.consumer_seq;if(x===0||i.received>=x)try{c()}catch(v){i.stop(v)}finally{c=void 0}else d=x}return i._data=m,i.iterClosed.then(()=>{m.unsubscribe()}),m.closed.then(()=>{i.stop()}).catch(b=>{i.stop(b)}),i}canSetWatcherName(){const s=this.js.nc,{ok:i}=s.features.get(Ye.JS_NEW_CONSUMER_CREATE_API);return i}async watch(e={}){const s=e.key??">",i=new Ut,o={};o.headers_only=e.headers_only||!1;let c=Xn.LastValue;e.include===Xn.AllHistory?c=Xn.AllHistory:e.include===Xn.UpdatesOnly&&(c=Xn.UpdatesOnly);const d=e.ignoreDeletes===!0;let p=e.initializedFn,g=0;const u=this._buildCC(s,c,o),m=u.filter_subject,b=Es(u);this.canSetWatcherName()&&b.consumerName(js.next()),b.bindStream(this.stream),e.resumeFromRevision&&e.resumeFromRevision>0&&b.startSequence(e.resumeFromRevision),b.orderedConsumer(),b.callback((v,_)=>{if(v){i.stop(v);return}if(_){const S=this.jmToEntry(_);if(d&&S.operation==="DEL")return;i.push(S),i.received++,p&&(g>0&&i.received>=g||_.info.pending===0)&&(i.push(p),p=void 0)}});const x=await this.js.subscribe(m,b);if(p){const{info:{last:v}}=x,_=v.num_pending+v.delivered.consumer_seq;if(_===0||i.received>=_)try{p()}catch(S){i.stop(S)}finally{p=void 0}else g=_}return i._data=x,i.iterClosed.then(()=>{x.unsubscribe()}),x.closed.then(()=>{i.stop()}).catch(v=>{i.stop(v)}),i}async keys(e=">"){const s=new Ut,i=this._buildCC(e,Xn.LastValue,{headers_only:!0}),o=Array.isArray(e)?">":i.filter_subject,c=Es(i);c.bindStream(this.stream),c.orderedConsumer();const d=await this.js.subscribe(o,c);return(async()=>{var g;for await(const u of d){const m=(g=u.headers)==null?void 0:g.get(bu);if(m!=="DEL"&&m!=="PURGE"){const b=this.decodeKey(u.subject.substring(this.prefixLen));s.push(b)}u.info.pending===0&&d.unsubscribe()}})().then(()=>{s.stop()}).catch(g=>{s.stop(g)}),d.info.last.num_pending===0&&d.unsubscribe(),s}purgeBucket(e){return this.jsm.streams.purge(this.bucketName(),e)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var c;const s=((c=this.js.nc.info)==null?void 0:c.cluster)??"",i=this.bucketName(),o=await this.jsm.streams.info(i);return new Dx(o,s)}}class Dx{constructor(e,s=""){j(this,"si");j(this,"cluster");this.si=e,this.cluster=s}get bucket(){return this.si.config.name.startsWith(Sn)?this.si.config.name.substring(Sn.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 mm(this.si.config.max_age)}get bucket_location(){return this.cluster}get backingStore(){return this.si.config.storage}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get description(){return this.si.config.description??""}get maxBucketSize(){return this.si.config.max_bytes}get maxValueSize(){return this.si.config.max_msg_size}get max_bytes(){return this.si.config.max_bytes}get placement(){return this.si.config.placement||{cluster:"",tags:[]}}get placementCluster(){var e;return((e=this.si.config.placement)==null?void 0:e.cluster)??""}get republish(){return this.si.config.republish??{src:"",dest:""}}get streamInfo(){return this.si}get size(){return this.si.state.bytes}get metadata(){return this.si.config.metadata??{}}get compression(){return this.si.config.compression?this.si.config.compression!==ks.None:!1}}const gm="OBJ_",bb="SHA-256=";function G2(n){return iu(n),`${gm}${n}`}function V2(n){return n.startsWith(gm)?n.substring(4):n}class qd{constructor(e){j(this,"si");j(this,"backingStore");this.si=e,this.backingStore="JetStream"}get bucket(){return V2(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!==ks.None:!1}}function uc(n){if(n===void 0)return;const{domain:e}=n;if(e===void 0)return n;const s=Object.assign({},n);if(delete s.domain,e==="")return s;if(s.external)throw new Error("domain and external are both set");return s.external={api:`$JS.${e}.API`},s}var zn;(function(n){n[n.Unset=-1]="Unset",n[n.Consume=0]="Consume",n[n.Fetch=1]="Fetch"})(zn||(zn={}));var lr;(function(n){n.HeartbeatsMissed="heartbeats_missed",n.ConsumerNotFound="consumer_not_found",n.StreamNotFound="stream_not_found",n.ConsumerDeleted="consumer_deleted",n.OrderedConsumerRecreated="ordered_consumer_recreated",n.NoResponders="no_responders"})(lr||(lr={}));var ta;(function(n){n.DebugEvent="debug",n.Discard="discard",n.Reset="reset",n.Next="next"})(ta||(ta={}));const xb=Uint8Array.of(43,65,67,75),Y2=Uint8Array.of(45,78,65,75),oo=Uint8Array.of(43,87,80,73),K2=Uint8Array.of(43,78,88,84),J2=Uint8Array.of(43,84,69,82,77),Q2=Uint8Array.of(32);function To(n,e=5e3){return new dO(n,e)}class id extends Ut{constructor(s,i,o=!1){super();j(this,"consumer");j(this,"opts");j(this,"sub");j(this,"monitor");j(this,"pending");j(this,"inbox");j(this,"refilling");j(this,"pong");j(this,"callback");j(this,"timeout");j(this,"cleanupHandler");j(this,"listeners");j(this,"statusIterator");j(this,"forOrderedConsumer");j(this,"resetHandler");j(this,"abortOnMissingResource");j(this,"bind");j(this,"inBackOff");this.consumer=s;const c=i;this.opts=this.parseOptions(i,o),this.callback=c.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=o,this.timeout=null,this.inbox=Lr(s.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=c.abort_on_missing_resource===!0,this.bind=c.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:s,max_bytes:i,idle_heartbeat:o,threshold_bytes:c,threshold_messages:d}=this.opts;this.closed().then(g=>{if(this.cleanupHandler)try{this.cleanupHandler(g)}catch{}});const{sub:p}=this;p&&p.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(g,u)=>{var b,x,v,_;if(g){this.stop(g);return}if((b=this.monitor)==null||b.work(),u.subject===this.inbox){if(kd(u))return;const S=(x=u.headers)==null?void 0:x.code,C=((_=(v=u.headers)==null?void 0:v.description)==null?void 0:_.toLowerCase())||"unknown",{msgsLeft:B,bytesLeft:q}=this.parseDiscard(u.headers);if(B>0||q>0)this.pending.msgs-=B,this.pending.bytes-=q,this.pending.requests--,this.notify(ta.Discard,{msgsLeft:B,bytesLeft:q});else if(S===400){this.stop(new be(C,`${S}`));return}else if(S===409&&C==="consumer deleted"){if(this.notify(lr.ConsumerDeleted,`${S} ${C}`),!this.refilling||this.abortOnMissingResource){const ne=new be(C,`${S}`);this.stop(ne);return}}else if(S===503){if(this.notify(lr.NoResponders,`${S} No Responders`),!this.refilling||this.abortOnMissingResource){const ne=new be("no responders",`${S}`);this.stop(ne);return}}else this.notify(ta.DebugEvent,`${S} ${C}`)}else this._push(To(u,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=u.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(s&&this.pending.msgs<=d||i&&this.pending.bytes<=c){const S=this.pullOptions();this.pull(S)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),o&&(this.monitor=new ym(o,g=>(this.notify(lr.HeartbeatsMissed,g),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var u;const g=this.consumer.api.nc.status();this.statusIterator=g;for await(const m of g)switch(m.type){case Dr.Disconnect:(u=this.monitor)==null||u.cancel();break;case Dr.Reconnect:this.resetPending().then(b=>{var x;b&&((x=this.monitor)==null||x.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(s){if(!this.callback)super.push(s);else{const i=typeof s=="function"?s:null;try{i?i():this.callback(s)}catch(o){this.stop(o)}}}notify(s,i){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.push({type:s,data:i})})}resetPending(){return this.bind?this.resetPendingNoInfo():this.resetPendingWithInfo()}resetPendingNoInfo(){return this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),Promise.resolve(!0)}async resetPendingWithInfo(){if(this.inBackOff)return!1;let s=0,i=0;const o=dm([this.opts.expires]);let c=0;for(;;){if(this.done)return!1;if(this.consumer.api.nc.isClosed())return console.error("aborting resetPending - connection is closed"),!1;try{return await this.consumer.info(),this.inBackOff=!1,s=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(d){if(d.message==="stream not found"){if(i++,this.notify(lr.StreamNotFound,i),!this.refilling||this.abortOnMissingResource)return this.stop(d),!1}else if(d.message==="consumer not found"){if(s++,this.notify(lr.ConsumerNotFound,s),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(d),!1;if(this.forOrderedConsumer)return!1}else s=0,i=0;this.inBackOff=!0;const p=o.backoff(c),g=la(p);await Promise.race([g,this.consumer.api.nc.closed()]),g.cancel(),c++}}}pull(s){this.pending.bytes+=s.max_bytes??0,this.pending.msgs+=s.batch??0,this.pending.requests++;const i=this.consumer.api.nc;this._push(()=>{i.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`,this.consumer.api.jc.encode(s),{reply:this.inbox}),this.notify(ta.Next,s)})}pullOptions(){const s=this.opts.max_messages-this.pending.msgs,i=this.opts.max_bytes-this.pending.bytes,o=ht(this.opts.idle_heartbeat),c=ht(this.opts.expires);return{batch:s,max_bytes:i,idle_heartbeat:o,expires:c}}parseDiscard(s){const i={msgsLeft:0,bytesLeft:0},o=s==null?void 0:s.get(Zt.PendingMessagesHdr);o&&(i.msgsLeft=parseInt(o));const c=s==null?void 0:s.get(Zt.PendingBytesHdr);return c&&(i.bytesLeft=parseInt(c)),i}trackTimeout(s){this.timeout=s}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var s,i;(s=this.monitor)==null||s.cancel(),this.monitor=null,(i=this.timeout)==null||i.cancel(),this.timeout=null}setCleanupHandler(s){this.cleanupHandler=s}stop(s){var i,o;this.done||((i=this.sub)==null||i.unsubscribe(),this.clearTimers(),(o=this.statusIterator)==null||o.stop(),this._push(()=>{super.stop(s),this.listeners.forEach(c=>{c.stop()})}))}parseOptions(s,i=!1){const o=s||{};if(o.max_messages=o.max_messages||0,o.max_bytes=o.max_bytes||0,o.max_messages!==0&&o.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(o.max_messages===0&&(o.max_messages=100),o.expires=o.expires||3e4,o.expires<1e3)throw new Error("expires should be at least 1000ms");if(o.idle_heartbeat=o.idle_heartbeat||o.expires/2,o.idle_heartbeat=o.idle_heartbeat>3e4?3e4:o.idle_heartbeat,i){const c=Math.round(o.max_messages*.75)||1;o.threshold_messages=o.threshold_messages||c;const d=Math.round(o.max_bytes*.75)||1;o.threshold_bytes=o.threshold_bytes||d}return o}status(){const s=new Ut;return this.listeners.push(s),Promise.resolve(s)}}class X2 extends Ut{constructor(){super();j(this,"src");j(this,"listeners");this.listeners=[]}setSource(s){this.src&&(this.src.resetHandler=void 0,this.src.setCleanupHandler(),this.src.stop()),this.src=s,this.src.setCleanupHandler(i=>{this.stop(i||void 0)}),(async()=>{const i=await this.src.status();for await(const o of i)this.notify(o.type,o.data)})().catch(()=>{})}notify(s,i){this.listeners.length>0&&this.listeners.forEach(o=>{o.done||o.push({type:s,data:i})})}stop(s){var i;this.done||((i=this.src)==null||i.stop(s),super.stop(s),this.listeners.forEach(o=>{o.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const s=new Ut;return this.listeners.push(s),Promise.resolve(s)}}class Pd{constructor(e,s){j(this,"api");j(this,"_info");j(this,"stream");j(this,"name");this.api=e,this._info=s,this.stream=s.stream_name,this.name=s.name}consume(e={max_messages:100,expires:3e4}){return Promise.resolve(new id(this,e,!0))}fetch(e={max_messages:100,expires:3e4}){const s=new id(this,e,!1),i=Math.round(s.opts.expires*1.05),o=ia(i);return s.closed().catch(()=>{}).finally(()=>{o.cancel()}),o.catch(()=>{s.close().catch()}),s.trackTimeout(o),Promise.resolve(s)}next(e={expires:3e4}){const s=dt(),i=e;i.max_messages=1;const o=new id(this,i,!1),c=Math.round(o.opts.expires*1.05);c>=6e4&&(async()=>{for await(const p of await o.status())if(p.type===lr.HeartbeatsMissed&&p.data>=2){s.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const p of o){s.resolve(p);break}})().catch(()=>{});const d=ia(c);return o.closed().then(p=>{p?s.reject(p):s.resolve(null)}).catch(p=>{s.reject(p)}).finally(()=>{d.cancel()}),d.catch(p=>{s.resolve(null),o.close().catch()}),o.trackTimeout(d),s}delete(){const{stream_name:e,name:s}=this._info;return this.api.delete(e,s)}info(e=!1){if(e)return Promise.resolve(this._info);const{stream_name:s,name:i}=this._info;return this.api.info(s,i).then(o=>(this._info=o,this._info))}}class W2{constructor(e,s,i={}){j(this,"api");j(this,"consumerOpts");j(this,"consumer");j(this,"opts");j(this,"cursor");j(this,"stream");j(this,"namePrefix");j(this,"serial");j(this,"currentConsumer");j(this,"userCallback");j(this,"iter");j(this,"type");j(this,"startSeq");j(this,"maxInitialReset");this.api=e,this.stream=s,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=js.next(),typeof i.name_prefix=="string"&&(ju("name_prefix",i.name_prefix),this.namePrefix=i.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=zn.Unset,this.consumerOpts=i,this.maxInitialReset=30,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(e){this.serial++;const s=`${this.namePrefix}_${this.serial}`;e=e===0?1:e;const i={name:s,deliver_policy:Et.StartSequence,opt_start_seq:e,ack_policy:Bt.None,inactive_threshold:ht(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(i.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(i.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(i.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(i.replay_policy=this.consumerOpts.replay_policy),e===this.startSeq+1&&(i.deliver_policy=this.consumerOpts.deliver_policy||Et.StartSequence,(this.consumerOpts.deliver_policy===Et.LastPerSubject||this.consumerOpts.deliver_policy===Et.New||this.consumerOpts.deliver_policy===Et.Last)&&(delete i.opt_start_seq,i.deliver_policy=this.consumerOpts.deliver_policy),i.deliver_policy===Et.LastPerSubject&&typeof i.filter_subjects>"u"&&typeof i.filter_subject>"u"&&(i.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete i.opt_start_seq,i.deliver_policy=Et.StartTime,i.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(i.inactive_threshold=ht(this.consumerOpts.inactive_threshold))),i}async resetConsumer(e=0){var d,p,g,u,m;js.next();const s=this.serial===0;(d=this.consumer)==null||d.delete().catch(()=>{}),e=e===0?1:e,this.cursor.deliver_seq=0;const i=this.getConsumerOpts(e);i.max_deliver=1,i.mem_storage=!0;const o=dm([((p=this.opts)==null?void 0:p.expires)||3e4]);let c;for(let b=0;;b++)try{c=await this.api.add(this.stream,i),(g=this.iter)==null||g.notify(lr.OrderedConsumerRecreated,c.name);break}catch(x){if(x.message==="stream not found"&&((u=this.iter)==null||u.notify(lr.StreamNotFound,b),this.type===zn.Fetch||this.opts.abort_on_missing_resource===!0))return(m=this.iter)==null||m.stop(x),Promise.reject(x);if(s&&b>=this.maxInitialReset)throw x;await la(o.backoff(b+1))}return c}internalHandler(e){return s=>{var o;if(this.serial!==e)return;const i=s.info.deliverySequence;if(i!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=i,this.cursor.stream_seq=s.info.streamSequence,this.userCallback?this.userCallback(s):(o=this.iter)==null||o.push(s)}}async reset(e={max_messages:100,expires:3e4},s){var g,u;s=s||{};const i=s.fromFetch||!1,o=s.orderedReset||!1;if(this.type===zn.Fetch&&o){(g=this.iter)==null||g.src.stop(),await((u=this.iter)==null?void 0:u.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||o)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||i)&&(this.iter=new X2),this.consumer=new Pd(this.api,this.currentConsumer);const c=e;c.callback=this.internalHandler(this.serial);let d=null;this.type===zn.Fetch&&i?d=await this.consumer.fetch(e):this.type===zn.Consume&&(d=await this.consumer.consume(e));const p=d;p.forOrderedConsumer=!0,p.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(p)}notifyOrderedResetAndReset(){var e;(e=this.iter)==null||e.notify(ta.Reset,""),this.reset(this.opts,{orderedReset:!0})}async consume(e={max_messages:100,expires:3e4}){if(e.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===zn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===zn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:i}=e;return i&&(this.userCallback=i),this.type=zn.Consume,this.opts=e,await this.reset(e),this.iter}async fetch(e={max_messages:100,expires:3e4}){var o;if(e.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===zn.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(((o=this.iter)==null?void 0:o.done)===!1)return Promise.reject(new Error("ordered consumer doesn't support concurrent fetch"));const{callback:i}=e;return i&&(this.userCallback=i),this.type=zn.Fetch,this.opts=e,await this.reset(e,{fromFetch:!0}),this.iter}async next(e={expires:3e4}){const s=e;if(s.bind)return Promise.reject(new Error("bind is not supported"));s.max_messages=1;const i=dt();return s.callback=c=>{this.userCallback=null,i.resolve(c)},(await this.fetch(s)).iterClosed.then(c=>{c&&i.reject(c),i.resolve(null)}).catch(c=>{i.reject(c)}),i}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(e=>Promise.resolve(e)).catch(e=>Promise.reject(e)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(e){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):e&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class Bd{constructor(e){j(this,"api");j(this,"notified");this.api=e,this.notified=!1}checkVersion(){const e=this.api.nc.features.get(Ye.JS_SIMPLIFICATION);return e.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${e.min} or better`))}getPullConsumerFor(e){if(e.config.deliver_subject!==void 0)throw new Error("push consumer not supported");return new Pd(this.api,e)}async get(e,s={}){return typeof s=="object"?this.ordered(e,s):(await this.checkVersion(),this.api.info(e,s).then(i=>i.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new Pd(this.api,i)).catch(i=>Promise.reject(i)))}async ordered(e,s){await this.checkVersion();const i=this.api;return new bm(i.nc,i.opts).info(e).then(c=>Promise.resolve(new W2(this.api,e,s))).catch(c=>Promise.reject(c))}}class Nu{constructor(e,s){j(this,"api");j(this,"_info");this.api=e,this._info=s}get name(){return this._info.config.name}alternates(){return this.info().then(e=>e.alternates?e.alternates:[])}async best(){if(await this.info(),this._info.alternates){const e=await this.api.info(this._info.alternates[0].name);return new Nu(this.api,e)}else return this}info(e=!1,s){return e?Promise.resolve(this._info):this.api.info(this.name,s).then(i=>(this._info=i,this._info))}getConsumerFromInfo(e){return new Bd(new pu(this.api.nc,this.api.opts)).getPullConsumerFor(e)}getConsumer(e){return new Bd(new pu(this.api.nc,this.api.opts)).get(this.name,e)}getMessage(e){return this.api.getMessage(this.name,e)}deleteMessage(e,s){return this.api.deleteMessage(this.name,e,s)}}class bm extends Do{constructor(e,s){super(e,s)}checkStreamConfigVersions(e){const s=this.nc;if(e.metadata){const{min:o,ok:c}=s.features.get(Ye.JS_STREAM_CONSUMER_METADATA);if(!c)throw new Error(`stream 'metadata' requires server ${o}`)}if(e.first_seq){const{min:o,ok:c}=s.features.get(Ye.JS_STREAM_FIRST_SEQ);if(!c)throw new Error(`stream 'first_seq' requires server ${o}`)}if(e.subject_transform){const{min:o,ok:c}=s.features.get(Ye.JS_STREAM_SUBJECT_TRANSFORM);if(!c)throw new Error(`stream 'subject_transform' requires server ${o}`)}if(e.compression){const{min:o,ok:c}=s.features.get(Ye.JS_STREAM_COMPRESSION);if(!c)throw new Error(`stream 'compression' requires server ${o}`)}if(e.consumer_limits){const{min:o,ok:c}=s.features.get(Ye.JS_DEFAULT_CONSUMER_LIMITS);if(!c)throw new Error(`stream 'consumer_limits' requires server ${o}`)}function i(o,c){var p;if((((p=c==null?void 0:c.subject_transforms)==null?void 0:p.length)||0)>0){const{min:g,ok:u}=s.features.get(Ye.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!u)throw new Error(`${o} 'subject_transforms' requires server ${g}`)}}e.sources&&e.sources.forEach(o=>{i("stream sources",o)}),e.mirror&&i("stream mirror",e.mirror)}async add(e={}){var o;this.checkStreamConfigVersions(e),Qt(e.name),e.mirror=uc(e.mirror),e.sources=(o=e.sources)==null?void 0:o.map(uc);const i=await this._request(`${this.prefix}.STREAM.CREATE.${e.name}`,e);return this._fixInfo(i),i}async delete(e){return Qt(e),(await this._request(`${this.prefix}.STREAM.DELETE.${e}`)).success}async update(e,s={}){var p;if(typeof e=="object"){const g=e;e=g.name,s=g,console.trace("\x1B[33m >> streams.update(config: StreamConfig) api changed to streams.update(name: string, config: StreamUpdateConfig) - this shim will be removed - update your code. \x1B[0m")}this.checkStreamConfigVersions(s),Qt(e);const i=await this.info(e),o=Object.assign(i.config,s);o.mirror=uc(o.mirror),o.sources=(p=o.sources)==null?void 0:p.map(uc);const d=await this._request(`${this.prefix}.STREAM.UPDATE.${e}`,o);return this._fixInfo(d),d}async info(e,s){Qt(e);const i=`${this.prefix}.STREAM.INFO.${e}`;let c=await this._request(i,s),{total:d,limit:p}=c,g=c.state.subjects?Object.getOwnPropertyNames(c.state.subjects).length:1;if(d&&d>g){const u=[c],m=s||{};let b=0;for(;d>g;){b++,m.offset=p*b;const v=await this._request(i,m);d=v.total,u.push(v);const _=Object.getOwnPropertyNames(v.state.subjects).length;if(g+=_,_<p)break}let x={};for(let v=0;v<u.length;v++)c=u[v],c.state.subjects&&(x=Object.assign(x,c.state.subjects));c.offset=0,c.total=0,c.limit=0,c.state.subjects=x}return this._fixInfo(c),c}list(e=""){const s=e!=null&&e.length?{subject:e}:{},i=c=>{const d=c;return d.streams.forEach(p=>{this._fixInfo(p)}),d.streams},o=`${this.prefix}.STREAM.LIST`;return new vo(o,i,this,s)}_fixInfo(e){e.config.sealed=e.config.sealed||!1,e.config.deny_delete=e.config.deny_delete||!1,e.config.deny_purge=e.config.deny_purge||!1,e.config.allow_rollup_hdrs=e.config.allow_rollup_hdrs||!1}async purge(e,s){if(s){const{keep:o,seq:c}=s;if(typeof o=="number"&&typeof c=="number")throw new Error("can specify one of keep or seq")}return Qt(e),await this._request(`${this.prefix}.STREAM.PURGE.${e}`,s)}async deleteMessage(e,s,i=!0){Qt(e);const o={seq:s};return i||(o.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${e}`,o)).success}async getMessage(e,s){Qt(e);const o=await this._request(`${this.prefix}.STREAM.MSG.GET.${e}`,s);return new Lx(o)}find(e){return this.findStream(e)}listKvs(){const e=i=>{var g;const c=i.streams.filter(u=>u.config.name.startsWith(Sn));c.forEach(u=>{this._fixInfo(u)});let d="";return c.length&&(d=((g=this.nc.info)==null?void 0:g.cluster)??""),c.map(u=>new Dx(u,d))},s=`${this.prefix}.STREAM.LIST`;return new vo(s,e,this)}listObjectStores(){const e=i=>{const c=i.streams.filter(p=>p.config.name.startsWith(gm));return c.forEach(p=>{this._fixInfo(p)}),c.map(p=>new qd(p))},s=`${this.prefix}.STREAM.LIST`;return new vo(s,e,this)}names(e=""){const s=e!=null&&e.length?{subject:e}:{},i=c=>c.streams,o=`${this.prefix}.STREAM.NAMES`;return new vo(o,i,this,s)}async get(e){const s=await this.info(e);return Promise.resolve(new Nu(this,s))}}class Z2 extends Do{constructor(e,s){super(e,s)}async getMessage(e,s){Qt(e);let i=s;const{last_by_subj:o}=i;o&&(i=null);const c=i?this.jc.encode(i):jn,d=this.opts.apiPrefix||"$JS.API",p=o?`${d}.DIRECT.GET.${e}.${o}`:`${d}.DIRECT.GET.${e}`,g=await this.nc.request(p,c,{timeout:this.timeout}),u=Zi(g);if(u)return Promise.reject(u);const m=new Ud(g);return Promise.resolve(m)}async getBatch(e,s){Qt(e);const o=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${e}`;if(!Array.isArray(s.multi_last)||s.multi_last.length===0)return Promise.reject("multi_last is required");const c=JSON.stringify(s,(g,u)=>g==="up_to_time"&&u instanceof Date?u.toISOString():u),d=new Ut,p=await this.nc.requestMany(o,c,{strategy:Zn.SentinelMsg});return(async()=>{var b,x,v;let g=!1,u=!1,m;for await(const _ of p){if(!g){g=!0;const S=((b=_.headers)==null?void 0:b.code)||0;if(S!==0&&S<200||S>299){m=(x=_.headers)==null?void 0:x.description.toLowerCase();break}if(((v=_.headers)==null?void 0:v.get("Nats-Num-Pending"))===""){u=!0;break}}if(_.data.length===0)break;d.push(new Ud(_))}d.push(()=>{if(u)throw new Error("batch direct get not supported by the server");if(m)throw new Error(`bad request: ${m}`);d.stop()})})(),Promise.resolve(d)}}class Ud{constructor(e){j(this,"data");j(this,"header");if(!e.headers)throw new Error("headers expected");this.data=e.data,this.header=e.headers}get subject(){return this.header.last(Qi.Subject)}get seq(){const e=this.header.last(Qi.Sequence);return typeof e=="string"?parseInt(e):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(Qi.TimeStamp)}get stream(){return this.header.last(Qi.Stream)}json(e){return er(e).decode(this.data)}string(){return En.decode(this.data)}}j(Ud,"jc");class eO extends Do{constructor(s,i){super(s,i);j(this,"streams");j(this,"consumers");j(this,"direct");this.streams=new bm(s,i),this.consumers=new pu(s,i),this.direct=new Z2(s,i)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const s=new Ut;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(i,o)=>{if(i)throw i;try{const c=this.parseJsResponse(o),d=c.type.split("."),p=d[d.length-1];s.push({kind:p,data:c})}catch(c){s.stop(c)}}}),s}}class Lx{constructor(e){j(this,"_header");j(this,"smr");this.smr=e}get subject(){return this.smr.message.subject}get seq(){return this.smr.message.seq}get timestamp(){return this.smr.message.time}get time(){return new Date(Date.parse(this.timestamp))}get data(){return this.smr.message.data?this._parse(this.smr.message.data):jn}get header(){if(!this._header)if(this.smr.message.hdrs){const e=this._parse(this.smr.message.hdrs);this._header=Ss.decode(e)}else this._header=Pr();return this._header}_parse(e){const s=atob(e),i=s.length,o=new Uint8Array(i);for(let c=0;c<i;c++)o[c]=s.charCodeAt(c);return o}json(e){return er(e).decode(this.data)}string(){return En.decode(this.data)}}j(Lx,"jc");class tO{constructor(e){j(this,"api");this.api=e}get(e){return this.api.info(e).then(s=>new Nu(this.api,s))}}class ad{constructor(e){j(this,"info");j(this,"hdrs");this.info=e}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=Ss.fromRecord(this.info.headers||{})),this.hdrs}get options(){return this.info.options}get bucket(){return this.info.bucket}get chunks(){return this.info.chunks}get deleted(){return this.info.deleted??!1}get digest(){return this.info.digest}get mtime(){return this.info.mtime}get nuid(){return this.info.nuid}get size(){return this.info.size}get revision(){return this.info.revision}get metadata(){return this.info.metadata||{}}isLink(){var e,s;return((e=this.info.options)==null?void 0:e.link)!==void 0&&((s=this.info.options)==null?void 0:s.link)!==null}}function vb(n){const e={name:n.name,description:n.description??"",options:n.options,metadata:n.metadata};if(n.headers){const s=n.headers;e.headers=s.toRecord()}return e}function nO(){return new ReadableStream({pull(n){n.enqueue(new Uint8Array(0)),n.close()}})}class Oo{constructor(e,s,i){j(this,"jsm");j(this,"js");j(this,"stream");j(this,"name");this.name=e,this.jsm=s,this.js=i}_checkNotEmpty(e){return!e||e.length===0?{name:e,error:new Error("name cannot be empty")}:{name:e}}async info(e){const s=await this.rawInfo(e);return s?new ad(s):null}async list(){const e=[],s=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const i of s){if(i===null)break;e.push(i)}return Promise.resolve(e)}async rawInfo(e){const{name:s,error:i}=this._checkNotEmpty(e);if(i)return Promise.reject(i);const o=this._metaSubject(s);try{const c=await this.jsm.streams.getMessage(this.stream,{last_by_subj:o}),p=er().decode(c.data);return p.revision=c.seq,p}catch(c){return c.code==="404"?null:Promise.reject(c)}}async _si(e){try{return await this.jsm.streams.info(this.stream,e)}catch(s){return s.code==="404"?null:Promise.reject(s)}}async seal(){let e=await this._si();return e===null?Promise.reject(new Error("object store not found")):(e.config.sealed=!0,e=await this.jsm.streams.update(this.stream,e.config),Promise.resolve(new qd(e)))}async status(e){const s=await this._si(e);return s===null?Promise.reject(new Error("object store not found")):Promise.resolve(new qd(s))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(e,s,i){var te;const o=this.js.getOptions();i=i||{timeout:o.timeout},i.timeout=i.timeout||o.timeout,i.previousRevision=i.previousRevision??void 0;const{timeout:c,previousRevision:d}=i,p=this.js.nc.info,g=(p==null?void 0:p.max_payload)||1024;e=e||{},e.options=e.options||{};let u=((te=e.options)==null?void 0:te.max_chunk_size)||128*1024;u=u>g?g:u,e.options.max_chunk_size=u;const m=await this.info(e.name),{name:b,error:x}=this._checkNotEmpty(e.name);if(x)return Promise.reject(x);const v=js.next(),_=this._chunkSubject(v),S=this._metaSubject(b),C=Object.assign({bucket:this.name,nuid:v,size:0,chunks:0},vb(e)),B=dt(),q=[],ne=new oa;try{const M=s?s.getReader():null,z=cb.create();for(;;){const{done:ae,value:F}=M?await M.read():{done:!0,value:void 0};if(ae){if(ne.size()>0){const W=ne.drain();z.update(W),C.chunks++,C.size+=W.length,q.push(this.js.publish(_,W,{timeout:c}))}await Promise.all(q),q.length=0,C.mtime=new Date().toISOString();const U=ea.encode(z.digest());C.digest=`${bb}${U}`,C.deleted=!1;const D=Pr();typeof d=="number"&&D.set(or.ExpectedLastSubjectSequenceHdr,`${d}`),D.set(Zt.RollupHdr,Zt.RollupValueSubject);const Q=await this.js.publish(S,er().encode(C),{headers:D,timeout:c});if(C.revision=Q.seq,m)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${m.nuid}`})}catch{}B.resolve(new ad(C));break}if(F)for(ne.fill(F);ne.size()>u;){C.chunks++,C.size+=u;const U=ne.drain(e.options.max_chunk_size);z.update(U),q.push(this.js.publish(_,U,{timeout:c}))}}}catch(M){await this.jsm.streams.purge(this.stream,{filter:_}),B.reject(M)}return B}putBlob(e,s,i){function o(c){return new ReadableStream({pull(d){d.enqueue(c),d.close()}})}return s===null&&(s=new Uint8Array(0)),this.put(e,o(s),i)}put(e,s,i){var o;return(o=e==null?void 0:e.options)!=null&&o.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(e,s,i)}async getBlob(e){async function s(c){const d=new oa,p=c.getReader();for(;;){const{done:g,value:u}=await p.read();if(g)return d.drain();u&&u.length&&d.fill(u)}}const i=await this.get(e);if(i===null)return Promise.resolve(null);const o=await Promise.all([i.error,s(i.data)]);return o[0]?Promise.reject(o[0]):Promise.resolve(o[1])}async get(e){const s=await this.rawInfo(e);if(s===null||s.deleted)return Promise.resolve(null);if(s.options&&s.options.link){const b=s.options.link.name||"";if(b==="")throw new Error("link is a bucket");return(s.options.link.bucket!==this.name?await Oo.create(this.js,s.options.link.bucket):this).get(b)}if(!s.digest.startsWith(bb))return Promise.reject(new Error(`unknown digest type: ${s.digest}`));const i=Cd(s.digest.substring(8));if(i===null)return Promise.reject(new Error(`unable to parse digest: ${s.digest}`));const o=dt(),c={info:new ad(s),error:o};if(s.size===0)return c.data=nO(),o.resolve(null),Promise.resolve(c);let d;const p=Es();p.orderedConsumer();const g=cb.create(),u=`$O.${this.name}.C.${s.nuid}`,m=await this.js.subscribe(u,p);return(async()=>{for await(const b of m)b.data.length>0&&(g.update(b.data),d.enqueue(b.data)),b.info.pending===0&&(FE(i,g.digest())?d.close():d.error(new Error(`received a corrupt object, digests do not match received: ${s.digest} calculated ${i}`)),m.unsubscribe())})().then(()=>{o.resolve()}).catch(b=>{d.error(b),o.reject(b)}),c.data=new ReadableStream({start(b){d=b},cancel(){m.unsubscribe()}}),c}linkStore(e,s){if(!(s instanceof Oo))return Promise.reject("bucket required");const i=s,{name:o,error:c}=this._checkNotEmpty(e);if(c)return Promise.reject(c);const d={name:o,options:{link:{bucket:i.name}}};return this._put(d,null)}async link(e,s){const{name:i,error:o}=this._checkNotEmpty(e);if(o)return Promise.reject(o);if(s.deleted)return Promise.reject(new Error("src object is deleted"));if(s.isLink())return Promise.reject(new Error("src object is a link"));const c=await this.rawInfo(e);if(c!==null&&!c.deleted)return Promise.reject(new Error("an object already exists with that name"));const d={bucket:s.bucket,name:s.name},p={name:i,bucket:s.bucket,options:{link:d}};await this.js.publish(this._metaSubject(e),JSON.stringify(p));const g=await this.info(e);return Promise.resolve(g)}async delete(e){const s=await this.rawInfo(e);if(s===null)return Promise.resolve({purged:0,success:!1});s.deleted=!0,s.size=0,s.chunks=0,s.digest="";const i=er(),o=Pr();return o.set(Zt.RollupHdr,Zt.RollupValueSubject),await this.js.publish(this._metaSubject(s.name),i.encode(s),{headers:o}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(s.nuid)})}async update(e,s={}){const i=await this.rawInfo(e);if(i===null)return Promise.reject(new Error("object not found"));if(i.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));s.name=s.name??i.name;const{name:o,error:c}=this._checkNotEmpty(s.name);if(c)return Promise.reject(c);if(e!==s.name){const g=await this.info(s.name);if(g&&!g.deleted)return Promise.reject(new Error("an object already exists with that name"))}s.name=o;const d=Object.assign({},i,vb(s)),p=await this.js.publish(this._metaSubject(d.name),JSON.stringify(d));return e!==s.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(e)}),Promise.resolve(p)}async watch(e={}){e.includeHistory=e.includeHistory??!1,e.ignoreDeletes=e.ignoreDeletes??!1;let s=!1;const i=new Ut,o=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:o})}catch(g){g.code==="404"?(i.push(null),s=!0):i.stop(g)}const c=er(),d=Es();d.orderedConsumer(),e.includeHistory?d.deliverLastPerSubject():(s=!0,d.deliverNew()),d.callback((g,u)=>{var m;if(g){i.stop(g);return}if(u!==null){const b=c.decode(u.data);b.deleted&&e.ignoreDeletes===!0||i.push(b),((m=u.info)==null?void 0:m.pending)===0&&!s&&(s=!0,i.push(null))}});const p=await this.js.subscribe(o,d);return i._data=p,i.iterClosed.then(()=>{p.unsubscribe()}),p.closed.then(()=>{i.stop()}).catch(g=>{i.stop(g)}),i}_chunkSubject(e){return`$O.${this.name}.C.${e}`}_metaSubject(e){return`$O.${this.name}.M.${ea.encode(e)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(e={}){try{this.stream=G2(this.name)}catch(o){return Promise.reject(o)}const s=(e==null?void 0:e.ttl)||0;delete e.ttl;const i=Object.assign({max_age:s},e);i.name=this.stream,i.num_replicas=e.replicas??1,i.allow_direct=!0,i.allow_rollup_hdrs=!0,i.discard=jo.New,i.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],e.placement&&(i.placement=e.placement),e.metadata&&(i.metadata=e.metadata),typeof e.compression=="boolean"&&(i.compression=e.compression?ks.S2:ks.None);try{await this.jsm.streams.info(i.name)}catch(o){o.message==="stream not found"&&await this.jsm.streams.add(i)}}static async create(e,s,i={}){const o=await e.jetstreamManager(),c=new Oo(s,o,e);return await c.init(i),Promise.resolve(c)}}class rO{constructor(e){j(this,"js");this.js=e}kv(e,s={}){const i=this.js,{ok:o,min:c}=i.nc.features.get(Ye.JS_KV);return o?s.bindOnly?No.bind(this.js,e,s):No.create(this.js,e,s):Promise.reject(new Error(`kv is only supported on servers ${c} or better`))}os(e,s={}){var d;if(typeof((d=crypto==null?void 0:crypto.subtle)==null?void 0:d.digest)!="function")return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));const i=this.js,{ok:o,min:c}=i.nc.features.get(Ye.JS_OBJECTSTORE);return o?Oo.create(this.js,e,s):Promise.reject(new Error(`objectstore is only supported on servers ${c} or better`))}}class xm extends Do{constructor(s,i){super(s,i);j(this,"consumers");j(this,"streams");j(this,"consumerAPI");j(this,"streamAPI");this.consumerAPI=new pu(s,i),this.streamAPI=new bm(s,i),this.consumers=new Bd(this.consumerAPI),this.streams=new tO(this.streamAPI)}jetstreamManager(s){s===void 0&&(s=this.opts.checkAPI);const i=Object.assign({},this.opts,{checkAPI:s});return this.nc.jetstreamManager(i)}get apiPrefix(){return this.prefix}get views(){return new rO(this)}async publish(s,i=jn,o){o=o||{},o.expect=o.expect||{};const c=(o==null?void 0:o.headers)||Pr();o&&(o.msgID&&c.set(or.MsgIdHdr,o.msgID),o.expect.lastMsgID&&c.set(or.ExpectedLastMsgIdHdr,o.expect.lastMsgID),o.expect.streamName&&c.set(or.ExpectedStreamHdr,o.expect.streamName),typeof o.expect.lastSequence=="number"&&c.set(or.ExpectedLastSeqHdr,`${o.expect.lastSequence}`),typeof o.expect.lastSubjectSequence=="number"&&c.set(or.ExpectedLastSubjectSequenceHdr,`${o.expect.lastSubjectSequence}`));const d=o.timeout||this.timeout,p={};d&&(p.timeout=d),o&&(p.headers=c);let{retries:g,retry_delay:u}=o;g=g||1,u=u||250;let m;for(let x=0;x<g;x++)try{m=await this.nc.request(s,i,p);break}catch(v){if(v.code==="503"&&x+1<g)await la(u);else throw v}const b=this.parseJsResponse(m);if(b.stream==="")throw be.errorForCode(fe.JetStreamInvalidAck);return b.duplicate=b.duplicate?b.duplicate:!1,b}async pull(s,i,o=0){Qt(s),Wi(i);let c=this.timeout;o>c&&(c=o),o=o<0?0:ht(o);const d={batch:1,no_wait:o===0,expires:o},p=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${i}`,this.jc.encode(d),{noMux:!0,timeout:c}),g=Zi(p);if(g)throw g;return To(p,this.timeout)}fetch(s,i,o={}){Qt(s),Wi(i);let c=null;const d=(o.max_bytes??0)>0;let p=0;const g=d?o.max_bytes:0;let u=null;const m={};if(m.batch=o.batch||1,g){const q=this.nc.features.get(Ye.JS_PULL_MAX_BYTES);if(!q.ok)throw new Error(`max_bytes is only supported on servers ${q.min} or better`);m.max_bytes=g}m.no_wait=o.no_wait||!1,m.no_wait&&m.expires&&(m.expires=0);const b=o.expires||0;if(b&&(m.expires=ht(b)),b===0&&m.no_wait===!1)throw new Error("expires or no_wait is required");const x=o.idle_heartbeat||0;x&&(m.idle_heartbeat=ht(x),o.delay_heartbeat===!0&&(m.idle_heartbeat=ht(x*4)));const v=new Ut,_=m.batch;let S=0;v.protocolFilterFn=(q,ne=!1)=>kd(q.msg)?(u==null||u.work(),!1):!0,v.dispatchedFn=q=>{if(q){if(d&&(p+=q.data.length),S++,c&&q.info.pending===0)return;(v.getPending()===1&&q.info.pending===0||_===S||g>0&&p>=g)&&v.stop()}};const C=Lr(this.nc.options.inboxPrefix),B=this.nc.subscribe(C,{max:o.batch,callback:(q,ne)=>{q===null&&(q=Zi(ne)),q!==null?(c&&(c.cancel(),c=null),OE(q)?v.stop(Px(q)===null?void 0:q):v.stop(q)):(u==null||u.work(),v.received++,v.push(To(ne,this.timeout)))}});return b&&(c=ia(b),c.catch(()=>{B.isClosed()||(B.drain().catch(()=>{}),c=null),u&&u.cancel()})),(async()=>{try{x&&(u=new ym(x,q=>(v.push(()=>{v.err=new be(`${$n.IdleHeartbeatMissed}: ${q}`,fe.JetStreamIdleHeartBeat)}),!0)))}catch{}await B.closed,c!==null&&(c.cancel(),c=null),u&&u.cancel(),v.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${s}.${i}`,this.jc.encode(m),{reply:C}),v}async pullSubscribe(s,i=Es()){const o=await this._processOptions(s,i);if(o.ordered)throw new Error("pull subscribers cannot be be ordered");if(o.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const c=o.config.ack_policy;if(c===Bt.None||c===Bt.All)throw new Error("ack policy for pull consumers must be explicit");const d=this._buildTypedSubscriptionOpts(o),p=new oO(this,o.deliver,d);p.info=o;try{await this._maybeCreateConsumer(o)}catch(g){throw p.unsubscribe(),g}return p}async subscribe(s,i=Es()){const o=await this._processOptions(s,i);if(!o.isBind&&!o.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const c=this._buildTypedSubscriptionOpts(o),d=new qx(this,o.deliver,c);d.info=o;try{await this._maybeCreateConsumer(o)}catch(p){throw d.unsubscribe(),p}return d._maybeSetupHbMonitoring(),d}async _processOptions(s,i=Es()){const o=ib(i)?i.getOpts():i;if(o.isBind=ib(i)?i.isBind:!1,o.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},o.ordered){if(o.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},o.config.ack_policy!==Bt.NotSet&&o.config.ack_policy!==Bt.None)throw new be("ordered consumer: ack_policy can only be set to 'none'",fe.ApiError);if(o.config.durable_name&&o.config.durable_name.length>0)throw new be("ordered consumer: durable_name cannot be set",fe.ApiError);if(o.config.deliver_subject&&o.config.deliver_subject.length>0)throw new be("ordered consumer: deliver_subject cannot be set",fe.ApiError);if(o.config.max_deliver!==void 0&&o.config.max_deliver>1)throw new be("ordered consumer: max_deliver cannot be set",fe.ApiError);if(o.config.deliver_group&&o.config.deliver_group.length>0)throw new be("ordered consumer: deliver_group cannot be set",fe.ApiError);o.config.deliver_subject=Lr(this.nc.options.inboxPrefix),o.config.ack_policy=Bt.None,o.config.max_deliver=1,o.config.flow_control=!0,o.config.idle_heartbeat=o.config.idle_heartbeat||ht(5e3),o.config.ack_wait=ht(1320*60*1e3),o.config.mem_storage=!0,o.config.num_replicas=1}if(o.config.ack_policy===Bt.NotSet&&(o.config.ack_policy=Bt.All),o.api=this,o.config=o.config||{},o.stream=o.stream?o.stream:await this.findStream(s),o.attached=!1,o.config.durable_name)try{const c=await this.consumerAPI.info(o.stream,o.config.durable_name);if(c){if(c.config.filter_subject&&c.config.filter_subject!==s)throw new Error("subject does not match consumer");const d=o.config.deliver_group??"";if(d===""&&c.push_bound===!0)throw new Error("duplicate subscription");const p=c.config.deliver_group??"";if(d!==p)throw p===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${p}'`);o.last=c,o.config=c.config,o.attached=!0,o.config.durable_name||(o.name=c.name)}}catch(c){if(c.code!=="404")throw c}return!o.attached&&o.config.filter_subject===void 0&&o.config.filter_subjects===void 0&&(o.config.filter_subject=s),o.deliver=o.config.deliver_subject||Lr(this.nc.options.inboxPrefix),o}_buildTypedSubscriptionOpts(s){const i={};return i.adapter=lO(s.callbackFn===void 0,this.timeout),i.ingestionFilterFn=xm.ingestionFn(s.ordered),i.protocolFilterFn=(o,c=!1)=>{const d=o;return jd(d.msg)?(c||d.msg.respond(),!1):!0},!s.mack&&s.config.ack_policy!==Bt.None&&(i.dispatchedFn=fO),s.callbackFn&&(i.callback=s.callbackFn),i.max=s.max||0,i.queue=s.queue,i}async _maybeCreateConsumer(s){if(s.attached)return;if(s.isBind)throw new Error(`unable to bind - durable consumer ${s.config.durable_name} doesn't exist in ${s.stream}`);s.config=Object.assign({deliver_policy:Et.All,ack_policy:Bt.Explicit,ack_wait:ht(30*1e3),replay_policy:aa.Instant},s.config);const i=await this.consumerAPI.add(s.stream,s.config);if(Array.isArray(s.config.filter_subjects&&!Array.isArray(i.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");s.name=i.name,s.config=i.config,s.last=i}static ingestionFn(s){return(i,o)=>{var g;const c=o;if(!i)return{ingest:!1,protocol:!1};const d=i;if(Zi(d.msg)||(g=c.monitor)==null||g.work(),kd(d.msg)){const u=s?c._checkHbOrderConsumer(d.msg):!0;return s||c.info.flow_control.heartbeat_count++,{ingest:u,protocol:!0}}else if(jd(d.msg))return c.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:s?c._checkOrderedConsumer(i):!0,protocol:!1}}}}class vm{constructor(e){j(this,"options");j(this,"protocol");j(this,"draining");j(this,"listeners");j(this,"_services");this.draining=!1,this.options=A2(e),this.listeners=[]}static connect(e={}){return new Promise((s,i)=>{const o=new vm(e);gu.connect(o.options,o).then(c=>{o.protocol=c,(async function(){for await(const d of c.status())o.listeners.forEach(p=>{p.push(d)})})(),s(o)}).catch(c=>{i(c)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(e,s,i){if(this.isClosed())throw be.errorForCode(fe.ConnectionClosed);if(s&&this.isDraining()||i&&this.protocol.noMorePublishing)throw be.errorForCode(fe.ConnectionDraining);if(e=e||"",e.length===0)throw be.errorForCode(fe.BadSubject)}publish(e,s,i){this._check(e,!1,!0),this.protocol.publish(e,s,i)}publishMessage(e){return this.publish(e.subject,e.data,{reply:e.reply,headers:e.headers})}respondMessage(e){return e.reply?(this.publish(e.reply,e.data,{reply:e.reply,headers:e.headers}),!0):!1}subscribe(e,s={}){this._check(e,!0,!1);const i=new Mx(this.protocol,e,s);return this.protocol.subscribe(i),i}_resub(e,s,i){this._check(s,!0,!1);const o=e;o.max=i,i&&(o.max=i+o.received),this.protocol.resub(o,s)}requestMany(e,s=jn,i={maxWait:1e3,maxMessages:-1}){const o=!this.protocol.options.noAsyncTraces;try{this._check(e,!0,!0)}catch(g){return Promise.reject(g)}if(i.strategy=i.strategy||Zn.Timer,i.maxWait=i.maxWait||1e3,i.maxWait<1)return Promise.reject(new be("timeout",fe.InvalidOption));const c=new Ut;function d(g){c.push(()=>{c.stop(g)})}function p(g,u){g||u===null?d(g===null?void 0:g):c.push(u)}if(i.noMux){const g=o?new Error().stack:null;let u=typeof i.maxMessages=="number"&&i.maxMessages>0?i.maxMessages:-1;const m=this.subscribe(Lr(this.options.inboxPrefix),{callback:(_,S)=>{var C,B;if(((C=S==null?void 0:S.data)==null?void 0:C.length)===0&&((B=S==null?void 0:S.headers)==null?void 0:B.status)===fe.NoResponders&&(_=be.errorForCode(fe.NoResponders)),_){g&&(_.stack+=`
48
+
49
+ ${g}`),b(_);return}p(null,S),i.strategy===Zn.Count&&(u--,u===0&&b()),i.strategy===Zn.JitterTimer&&(v(),x=setTimeout(()=>{b()},300)),i.strategy===Zn.SentinelMsg&&S&&S.data.length===0&&b()}});m.requestSubject=e,m.closed.then(()=>{d()}).catch(_=>{c.stop(_)});const b=_=>{_&&c.push(()=>{throw _}),v(),m.drain().then(()=>{d()}).catch(S=>{d()})};c.iterClosed.then(()=>{v(),m==null||m.unsubscribe()}).catch(_=>{v(),m==null||m.unsubscribe()});try{this.publish(e,s,{reply:m.getSubject()})}catch(_){b(_)}let x=setTimeout(()=>{b()},i.maxWait);const v=()=>{x&&clearTimeout(x)}}else{const g=i;g.callback=p,c.iterClosed.then(()=>{u.cancel()}).catch(m=>{u.cancel(m)});const u=new GE(this.protocol.muxSubscriptions,e,g);this.protocol.request(u);try{this.publish(e,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${u.token}`,headers:i.headers})}catch(m){u.cancel(m)}}return Promise.resolve(c)}request(e,s,i={timeout:1e3,noMux:!1}){try{this._check(e,!0,!0)}catch(c){return Promise.reject(c)}const o=!this.protocol.options.noAsyncTraces;if(i.timeout=i.timeout||1e3,i.timeout<1)return Promise.reject(new be("timeout",fe.InvalidOption));if(!i.noMux&&i.reply)return Promise.reject(new be("reply can only be used with noMux",fe.InvalidOption));if(i.noMux){const c=i.reply?i.reply:Lr(this.options.inboxPrefix),d=dt(),p=o?new Error:null,g=this.subscribe(c,{max:1,timeout:i.timeout,callback:(u,m)=>{u?(p&&u.code!==fe.Timeout&&(u.stack+=`
50
+
51
+ ${p.stack}`),g.unsubscribe(),d.reject(u)):(u=Sx(m),u?(p&&(u.stack+=`
52
+
53
+ ${p.stack}`),d.reject(u)):d.resolve(m))}});return g.requestSubject=e,this.protocol.publish(e,s,{reply:c,headers:i.headers}),d}else{const c=new Ax(this.protocol.muxSubscriptions,e,i,o);this.protocol.request(c);try{this.publish(e,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${c.token}`,headers:i.headers})}catch(p){c.cancel(p)}const d=Promise.race([c.timer,c.deferred]);return d.catch(()=>{c.cancel()}),d}}flush(){return this.isClosed()?Promise.reject(be.errorForCode(fe.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(be.errorForCode(fe.ConnectionClosed)):this.isDraining()?Promise.reject(be.errorForCode(fe.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const e=this.protocol.getServer();return e?e.listen:""}status(){const e=new Ut;return e.iterClosed.then(()=>{const s=this.listeners.indexOf(e);this.listeners.splice(s,1)}),this.listeners.push(e),e}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((s,i)=>s==="time"?new Date(Date.parse(i)):i)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(e={}){const s=new eO(this,e);if(e.checkAPI!==!1)try{await s.getAccountInfo()}catch(i){const o=i;throw o.code===fe.NoResponders&&(o.code=fe.JetStreamNotEnabled),o}return s}jetstream(e={}){return new xm(this,e)}getServerVersion(){const e=this.info;return e?ni(e.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw be.errorForCode(fe.Disconnect);const e=Date.now();return await this.flush(),Date.now()-e}get features(){return this.protocol.features}get services(){return this._services||(this._services=new sO(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(be.errorForCode(fe.ConnectionClosed)):this.isDraining()?Promise.reject(be.errorForCode(fe.ConnectionDraining)):this.protocol.reconnect()}}class sO{constructor(e){j(this,"nc");this.nc=e}add(e){try{return new Lo(this.nc,e).start()}catch(s){return Promise.reject(s)}}client(e,s){return new P2(this.nc,e,s)}}class iO{constructor(e,s,i){j(this,"bucket");j(this,"sm");j(this,"prefixLen");this.bucket=e,this.prefixLen=s,this.sm=i}get key(){return this.sm.subject.substring(this.prefixLen)}get value(){return this.sm.data}get delta(){return 0}get created(){return this.sm.time}get revision(){return this.sm.seq}get operation(){return this.sm.header.get(bu)||"PUT"}get length(){const e=this.sm.header.get(Zt.MessageSizeHdr)||"";return e!==""?parseInt(e,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class aO{constructor(e,s,i){j(this,"bucket");j(this,"key");j(this,"sm");this.bucket=e,this.key=s,this.sm=i}get value(){return this.sm.data}get created(){return new Date(mm(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var e;return((e=this.sm.headers)==null?void 0:e.get(bu))||"PUT"}get delta(){return this.sm.info.pending}get length(){var s;const e=((s=this.sm.headers)==null?void 0:s.get(Zt.MessageSizeHdr))||"";return e!==""?parseInt(e,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class qx extends JE{constructor(s,i,o){super(s.nc,i,o);j(this,"js");j(this,"monitor");this.js=s,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(s){this.sub.info=s}get info(){return this.sub.info}_resetOrderedConsumer(s){if(this.info===null||this.sub.isClosed())return;const i=Lr(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,i);const c=this.info;c.config.name=js.next(),c.ordered_consumer_sequence.delivery_seq=0,c.flow_control.heartbeat_count=0,c.flow_control.fc_count=0,c.flow_control.consumer_restarts++,c.deliver=i,c.config.deliver_subject=i,c.config.deliver_policy=Et.StartSequence,c.config.opt_start_seq=s;const d={};d.stream_name=this.info.stream,d.config=c.config;const p=`${c.api.prefix}.CONSUMER.CREATE.${c.stream}`;this.js._request(p,d,{retries:-1}).then(g=>{const u=g,m=this.sub.info;m.last=u,this.info.config=u.config,this.info.name=u.name}).catch(g=>{const u=new be(`unable to recreate ordered consumer ${c.stream} at seq ${s}`,fe.RequestError,g);this.sub.callback(u,{})})}_maybeSetupHbMonitoring(){var i,o;const s=((o=(i=this.info)==null?void 0:i.config)==null?void 0:o.idle_heartbeat)||0;s&&this._setupHbMonitoring(mm(s))}_setupHbMonitoring(s,i=0){const o={cancelAfter:0,maxOut:2};i&&(o.cancelAfter=i);const c=this.sub,d=p=>{var m,b,x,v;const g=NE(409,`${$n.IdleHeartbeatMissed}: ${p}`,this.sub.subject);if(!((m=this.info)==null?void 0:m.ordered))this.sub.callback(null,g);else{if(!this.js.nc.protocol.connected)return!1;const _=((x=(b=this.info)==null?void 0:b.ordered_consumer_sequence)==null?void 0:x.stream_seq)||0;return this._resetOrderedConsumer(_+1),(v=this.monitor)==null||v.restart(),!1}return!c.noIterator};this.monitor=new ym(s,d,o)}_checkHbOrderConsumer(s){const i=s.headers.get(Zt.ConsumerStalledHdr);i!==""&&this.js.nc.publish(i);const o=parseInt(s.headers.get(Zt.LastConsumerSeqHdr),10),c=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,o!==c.delivery_seq&&this._resetOrderedConsumer(c.stream_seq+1),!1}_checkOrderedConsumer(s){const i=this.info.ordered_consumer_sequence,o=s.info.streamSequence,c=s.info.deliverySequence;return c!=i.delivery_seq+1?(this._resetOrderedConsumer(i.stream_seq+1),!1):(i.delivery_seq=c,i.stream_seq=o,!0)}async destroy(){this.isClosed()||await this.drain();const s=this.sub.info,i=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.DELETE.${s.stream}.${i}`;await s.api._request(o)}async consumerInfo(){const s=this.sub.info,i=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.INFO.${s.stream}.${i}`,c=await s.api._request(o);return s.last=c,c}}class oO extends qx{constructor(e,s,i){super(e,s,i)}pull(e={batch:1}){const{stream:s,config:i,name:o}=this.sub.info,c=i.durable_name??o,d={};if(d.batch=e.batch||1,d.no_wait=e.no_wait||!1,(e.max_bytes??0)>0){const u=this.js.nc.features.get(Ye.JS_PULL_MAX_BYTES);if(!u.ok)throw new Error(`max_bytes is only supported on servers ${u.min} or better`);d.max_bytes=e.max_bytes}let p=0;e.expires&&e.expires>0&&(p=e.expires,d.expires=ht(p));let g=0;if(e.idle_heartbeat&&e.idle_heartbeat>0&&(g=e.idle_heartbeat,d.idle_heartbeat=ht(g)),g&&p===0)throw new Error("idle_heartbeat requires expires");if(g>p)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),p&&g&&(this.monitor?this.monitor._change(g,p):this._setupHbMonitoring(g,p));const u=this.info.api,m=`${u.prefix}.CONSUMER.MSG.NEXT.${s}.${c}`,b=this.sub.subject;u.nc.publish(m,u.jc.encode(d),{reply:b})}}}function lO(n,e){return n?uO(e):cO(e)}function cO(n){return(e,s)=>e?[e,null]:(e=Zi(s),e?[e,null]:[null,To(s,n)])}function uO(n){return(e,s)=>{if(e)return[e,null];const i=Zi(s);return i!==null?[Px(i),null]:[null,To(s,n)]}}function Px(n){if(n!==null)switch(n.code){case fe.JetStream404NoMessages:case fe.JetStream408RequestTimeout:return null;case fe.JetStream409:return TE(n)?n:null;default:return n}return null}function fO(n){n&&n.ack()}function hO(n){const e=n.split(".");if(e.length===9&&e.splice(2,0,"_",""),e.length<11||e[0]!=="$JS"||e[1]!=="ACK")throw new Error("not js message");const s={};return s.domain=e[2]==="_"?"":e[2],s.account_hash=e[3],s.stream=e[4],s.consumer=e[5],s.deliveryCount=parseInt(e[6],10),s.redeliveryCount=s.deliveryCount,s.redelivered=s.deliveryCount>1,s.streamSequence=parseInt(e[7],10),s.deliverySequence=parseInt(e[8],10),s.timestampNanos=parseInt(e[9],10),s.pending=parseInt(e[10],10),s}class dO{constructor(e,s){j(this,"msg");j(this,"di");j(this,"didAck");j(this,"timeout");this.msg=e,this.didAck=!1,this.timeout=s}get subject(){return this.msg.subject}get sid(){return this.msg.sid}get data(){return this.msg.data}get headers(){return this.msg.headers}get info(){return this.di||(this.di=hO(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(e){this.didAck||(this.didAck=!this.isWIP(e),this.msg.respond(e))}isWIP(e){return e.length===4&&e[0]===oo[0]&&e[1]===oo[1]&&e[2]===oo[2]&&e[3]===oo[3]}async ackAck(e){var i;e=e||{},e.timeout=e.timeout||this.timeout;const s=dt();if(this.didAck)s.resolve(!1);else if(this.didAck=!0,this.msg.reply){const c=this.msg.publisher,d=!((i=c.options)!=null&&i.noAsyncTraces),p=new Ax(c.muxSubscriptions,this.msg.reply,{timeout:e.timeout},d);c.request(p);try{c.publish(this.msg.reply,xb,{reply:`${c.muxSubscriptions.baseInbox}${p.token}`})}catch(g){p.cancel(g)}try{await Promise.race([p.timer,p.deferred]),s.resolve(!0)}catch(g){p.cancel(g),s.reject(g)}}else s.resolve(!1);return s}ack(){this.doAck(xb)}nak(e){let s=Y2;e&&(s=Ad().encode(`-NAK ${JSON.stringify({delay:ht(e)})}`)),this.doAck(s)}working(){this.doAck(oo)}next(e,s={batch:1}){const i={};i.batch=s.batch||1,i.no_wait=s.no_wait||!1,s.expires&&s.expires>0&&(i.expires=ht(s.expires));const o=er().encode(i),c=oa.concat(K2,Q2,o),d=e?{reply:e}:void 0;this.msg.respond(c,d)}term(e=""){let s=J2;(e==null?void 0:e.length)>0&&(s=Ad().encode(`+TERM ${e}`)),this.doAck(s)}json(){return this.msg.json()}string(){return this.msg.string()}}const mO="1.30.3",pO="nats.ws";class yO{constructor(){j(this,"version");j(this,"lang");j(this,"closeError");j(this,"connected");j(this,"done");j(this,"socket");j(this,"options");j(this,"socketClosed");j(this,"encrypted");j(this,"peeked");j(this,"yields");j(this,"signal");j(this,"closedNotification");this.version=mO,this.lang=pO,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=dt(),this.closedNotification=dt()}async connect(e,s){const i=dt();if(s.tls)return i.reject(new be("tls",fe.InvalidOption)),i;this.options=s;const o=e.src;if(s.wsFactory){const{socket:c,encrypted:d}=await s.wsFactory(e.src,s);this.socket=c,this.encrypted=d}else this.encrypted=o.indexOf("wss://")===0,this.socket=new WebSocket(o);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=c=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(c.data)),this.peeked){this.signal.resolve();return}const d=oa.concat(...this.yields),p=t2(d);if(p!==""){const g=N2.exec(p);if(!g){s.debug&&console.error("!!!",oc(d)),i.reject(new Error("unexpected response from server"));return}try{const u=JSON.parse(g[1]);j2(u,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),i.resolve()}catch(u){i.reject(u);return}}},this.socket.onclose=c=>{if(this.isDiscarded())return;this.socketClosed=!0;let d;this.done||(c.wasClean||(d=new Error(c.reason)),this._closed(d))},this.socket.onerror=c=>{if(this.isDiscarded())return;const d=c,p=new be(d.message,fe.Unknown,new Error(d.error));i.reject(p)},i}disconnect(){this._closed(void 0,!0)}async _closed(e,s=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=e,!e)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await la(100);this.done=!0;try{this.socket.close(e?1002:1e3,e?e.message:void 0)}catch{}s&&this.closedNotification.resolve(e)}}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.isDiscarded())return;this.yields.length===0&&await this.signal;const e=this.yields;this.yields=[];for(let s=0;s<e.length;s++)this.options.debug&&console.info(`> ${oc(e[s])}`),yield e[s];if(this.done)break;this.yields.length===0&&(e.length=0,this.yields=e,this.signal=dt())}}isEncrypted(){return this.connected&&this.encrypted}send(e){if(!this.isDiscarded())try{this.socket.send(e.buffer),this.options.debug&&console.info(`< ${oc(e)}`);return}catch(s){this.options.debug&&console.error(`!!! ${oc(e)}: ${s}`)}}close(e){return this._closed(e,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var e;this.done=!0;try{(e=this.socket)==null||e.close()}catch{}}}function gO(n,e){/^(.*:\/\/)(.*)/.test(n)||(typeof e=="boolean"?n=`${e===!0?"https":"http"}://${n}`:n=`https://${n}`);let i=new URL(n);const o=i.protocol.toLowerCase();o==="ws:"&&(e=!1),o==="wss:"&&(e=!0),o!=="https:"&&o!=="http"&&(n=n.replace(/^(.*:\/\/)(.*)/gm,"$2"),i=new URL(`http://${n}`));let c,d;const p=i.hostname,g=i.pathname,u=i.search||"";switch(o){case"http:":case"ws:":case"nats:":d=i.port||"80",c="ws:";break;case"https:":case"wss:":case"tls:":d=i.port||"443",c="wss:";break;default:d=i.port||e===!0?"443":"80",c=e===!0?"wss:":"ws:";break}return`${c}//${p}:${d}${g}${u}`}function bO(n={}){return QE({defaultPort:443,urlParseFn:gO,factory:()=>new yO}),vm.connect(n)}const xO=null,vO=null,Wt="lt.events";function Bx(n,e){const s=n.split("."),i=e.split(".");for(let o=0;o<i.length;o++){const c=i[o];if(c===">")return!0;if(o>=s.length||c!=="*"&&c!==s[o])return!1}return s.length===i.length}const ca=E.createContext({connected:!1,subscribe:()=>()=>{}});function Ux(){const{connected:n}=E.useContext(ca);return{connected:n}}function An(n,e){const{subscribe:s}=E.useContext(ca),i=E.useRef(e);i.current=e,E.useEffect(()=>s(n,c=>i.current(c)),[s,n])}function Ns(n,e){const{subscribe:s}=E.useContext(ca),i=E.useRef(e);i.current=e;const o=n.join(","),c=E.useMemo(()=>o.split(",").filter(Boolean),[o]);E.useEffect(()=>{const d=g=>i.current(g),p=c.map(g=>s(g,d));return()=>p.forEach(g=>g())},[s,c])}const zx=E.createContext({connected:!1,unavailable:!1,subscribe:()=>()=>{}});function _O(){const{connected:n,unavailable:e}=E.useContext(zx);return{connected:n,unavailable:e}}const wO=Ad();function SO({children:n,url:e,token:s,resolveCredentials:i,policy:o=bo,onReconnect:c,sessionKey:d}){const p=E.useRef(null),[g,u]=E.useState(!1),[m,b]=E.useState(!1),[x,v]=E.useState(!1),_=E.useRef({url:e,token:s,resolveCredentials:i,policy:o,onReconnect:c});_.current={url:e,token:s,resolveCredentials:i,policy:o,onReconnect:c};const S=E.useRef(new Map),C=E.useRef(new Map),B=E.useCallback((te,M)=>{(async()=>{for await(const z of M)try{if(!Bx(z.subject,te))continue;const ae=JSON.parse(wO.decode(z.data)),F=S.current.get(te);if(!F)continue;for(const U of F)try{U(ae)}catch{}}catch{}})()},[]),q=E.useCallback(te=>{var z;const M=p.current;if(!(!M||(z=M.isClosed)!=null&&z.call(M)||C.current.has(te)))try{const ae=M.subscribe(te);C.current.set(te,ae),B(te,ae)}catch{}},[B]),ne=E.useCallback((te,M)=>{const z=S.current;return z.has(te)||z.set(te,new Set),z.get(te).add(M),q(te),()=>{const ae=z.get(te);if(ae&&(ae.delete(M),ae.size===0)){z.delete(te);const F=C.current.get(te);if(F){C.current.delete(te);try{F.unsubscribe()}catch{}}}}},[q]);return E.useEffect(()=>{let te=!1,M=!1,z=!1,ae=!1,F=0,U,D;v(!1);const Q=()=>typeof document<"u"&&document.visibilityState==="hidden",W=async()=>{const{url:J,token:ce,resolveCredentials:pe}=_.current;if(pe)return pe();const ge=J||xO;return ge?{kind:"ok",url:ge,token:ce||vO||null}:{kind:"unavailable"}},he=(J=bE(F++,_.current.policy))=>{te||M||(U=setTimeout(Ae,J))},Ee=J=>{J.closed().then(()=>{p.current===J&&(p.current=null,C.current.clear(),u(!1),he(Jg(_.current.policy)))})};async function Ae(){if(U=void 0,!(te||M||z||p.current)&&!Q()){z=!0;try{const J=await W();if(te)return;if(J.kind==="session-ended"){M=!0,v(!0);return}if(J.kind==="unavailable"){he();return}const ce=await bO({servers:J.url,token:J.token??void 0,reconnect:!1});if(te){ce.close().catch(()=>{});return}p.current=ce,F=0,u(!0),C.current.clear();for(const pe of S.current.keys())q(pe);ae&&(D=setTimeout(()=>{var pe,ge;return(ge=(pe=_.current).onReconnect)==null?void 0:ge.call(pe)},Jg(_.current.policy))),ae=!0,Ee(ce)}catch{te||he()}finally{z=!1}}}const H=()=>{te||M||z||p.current||Q()||(U&&clearTimeout(U),F=0,Ae())};return document.addEventListener("visibilitychange",H),window.addEventListener("online",H),Ae(),()=>{te=!0,U&&clearTimeout(U),D&&clearTimeout(D),document.removeEventListener("visibilitychange",H),window.removeEventListener("online",H);for(const J of C.current.values())try{J.unsubscribe()}catch{}C.current.clear(),p.current&&(p.current.close().catch(()=>{}),p.current=null),u(!1)}},[q,d]),E.useEffect(()=>{if(g||x){b(!1);return}const te=setTimeout(()=>b(!0),o.noticeAfterMs);return()=>clearTimeout(te)},[g,x,o.noticeAfterMs]),h.jsx(zx.Provider,{value:{connected:g,unavailable:m,subscribe:ne},children:h.jsx(ca.Provider,{value:{connected:g,subscribe:ne},children:n})})}const ur=Object.create(null);ur.open="0";ur.close="1";ur.ping="2";ur.pong="3";ur.message="4";ur.upgrade="5";ur.noop="6";const au=Object.create(null);Object.keys(ur).forEach(n=>{au[ur[n]]=n});const zd={type:"error",data:"parser error"},$x=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Ix=typeof ArrayBuffer=="function",Hx=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,_m=({type:n,data:e},s,i)=>$x&&e instanceof Blob?s?i(e):_b(e,i):Ix&&(e instanceof ArrayBuffer||Hx(e))?s?i(e):_b(new Blob([e]),i):i(ur[n]+(e||"")),_b=(n,e)=>{const s=new FileReader;return s.onload=function(){const i=s.result.split(",")[1];e("b"+(i||""))},s.readAsDataURL(n)};function wb(n){return n instanceof Uint8Array?n:n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}let od;function EO(n,e){if($x&&n.data instanceof Blob)return n.data.arrayBuffer().then(wb).then(e);if(Ix&&(n.data instanceof ArrayBuffer||Hx(n.data)))return e(wb(n.data));_m(n,!1,s=>{od||(od=new TextEncoder),e(od.encode(s))})}const Sb="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_o=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n<Sb.length;n++)_o[Sb.charCodeAt(n)]=n;const OO=n=>{let e=n.length*.75,s=n.length,i,o=0,c,d,p,g;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);const u=new ArrayBuffer(e),m=new Uint8Array(u);for(i=0;i<s;i+=4)c=_o[n.charCodeAt(i)],d=_o[n.charCodeAt(i+1)],p=_o[n.charCodeAt(i+2)],g=_o[n.charCodeAt(i+3)],m[o++]=c<<2|d>>4,m[o++]=(d&15)<<4|p>>2,m[o++]=(p&3)<<6|g&63;return u},AO=typeof ArrayBuffer=="function",wm=(n,e)=>{if(typeof n!="string")return{type:"message",data:Fx(n,e)};const s=n.charAt(0);return s==="b"?{type:"message",data:jO(n.substring(1),e)}:au[s]?n.length>1?{type:au[s],data:n.substring(1)}:{type:au[s]}:zd},jO=(n,e)=>{if(AO){const s=OO(n);return Fx(s,e)}else return{base64:!0,data:n}},Fx=(n,e)=>{switch(e){case"blob":return n instanceof Blob?n:new Blob([n]);case"arraybuffer":default:return n instanceof ArrayBuffer?n:n.buffer}},Gx="",kO=(n,e)=>{const s=n.length,i=new Array(s);let o=0;n.forEach((c,d)=>{_m(c,!1,p=>{i[d]=p,++o===s&&e(i.join(Gx))})})},NO=(n,e)=>{const s=n.split(Gx),i=[];for(let o=0;o<s.length;o++){const c=wm(s[o],e);if(i.push(c),c.type==="error")break}return i};function TO(){return new TransformStream({transform(n,e){EO(n,s=>{const i=s.length;let o;if(i<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,i);else if(i<65536){o=new Uint8Array(3);const c=new DataView(o.buffer);c.setUint8(0,126),c.setUint16(1,i)}else{o=new Uint8Array(9);const c=new DataView(o.buffer);c.setUint8(0,127),c.setBigUint64(1,BigInt(i))}n.data&&typeof n.data!="string"&&(o[0]|=128),e.enqueue(o),e.enqueue(s)})}})}let ld;function fc(n){return n.reduce((e,s)=>e+s.length,0)}function hc(n,e){if(n[0].length===e)return n.shift();const s=new Uint8Array(e);let i=0;for(let o=0;o<e;o++)s[o]=n[0][i++],i===n[0].length&&(n.shift(),i=0);return n.length&&i<n[0].length&&(n[0]=n[0].slice(i)),s}function CO(n,e){ld||(ld=new TextDecoder);const s=[];let i=0,o=-1,c=!1;return new TransformStream({transform(d,p){for(s.push(d);;){if(i===0){if(fc(s)<1)break;const g=hc(s,1);c=(g[0]&128)===128,o=g[0]&127,o<126?i=3:o===126?i=1:i=2}else if(i===1){if(fc(s)<2)break;const g=hc(s,2);o=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),i=3}else if(i===2){if(fc(s)<8)break;const g=hc(s,8),u=new DataView(g.buffer,g.byteOffset,g.length),m=u.getUint32(0);if(m>Math.pow(2,21)-1){p.enqueue(zd);break}o=m*Math.pow(2,32)+u.getUint32(4),i=3}else{if(fc(s)<o)break;const g=hc(s,o);p.enqueue(wm(c?g:ld.decode(g),e)),i=0}if(o===0||o>n){p.enqueue(zd);break}}}})}const Vx=4;function Ct(n){if(n)return MO(n)}function MO(n){for(var e in Ct.prototype)n[e]=Ct.prototype[e];return n}Ct.prototype.on=Ct.prototype.addEventListener=function(n,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(e),this};Ct.prototype.once=function(n,e){function s(){this.off(n,s),e.apply(this,arguments)}return s.fn=e,this.on(n,s),this};Ct.prototype.off=Ct.prototype.removeListener=Ct.prototype.removeAllListeners=Ct.prototype.removeEventListener=function(n,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var s=this._callbacks["$"+n];if(!s)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var i,o=0;o<s.length;o++)if(i=s[o],i===e||i.fn===e){s.splice(o,1);break}return s.length===0&&delete this._callbacks["$"+n],this};Ct.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),s=this._callbacks["$"+n],i=1;i<arguments.length;i++)e[i-1]=arguments[i];if(s){s=s.slice(0);for(var i=0,o=s.length;i<o;++i)s[i].apply(this,e)}return this};Ct.prototype.emitReserved=Ct.prototype.emit;Ct.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]};Ct.prototype.hasListeners=function(n){return!!this.listeners(n).length};const Tu=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,s)=>s(e,0),In=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),RO="arraybuffer";function Yx(n,...e){return e.reduce((s,i)=>(n.hasOwnProperty(i)&&(s[i]=n[i]),s),{})}const DO=In.setTimeout,LO=In.clearTimeout;function Cu(n,e){e.useNativeTimers?(n.setTimeoutFn=DO.bind(In),n.clearTimeoutFn=LO.bind(In)):(n.setTimeoutFn=In.setTimeout.bind(In),n.clearTimeoutFn=In.clearTimeout.bind(In))}const qO=1.33;function PO(n){return typeof n=="string"?BO(n):Math.ceil((n.byteLength||n.size)*qO)}function BO(n){let e=0,s=0;for(let i=0,o=n.length;i<o;i++)e=n.charCodeAt(i),e<128?s+=1:e<2048?s+=2:e<55296||e>=57344?s+=3:(i++,s+=4);return s}function Kx(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function UO(n){let e="";for(let s in n)n.hasOwnProperty(s)&&(e.length&&(e+="&"),e+=encodeURIComponent(s)+"="+encodeURIComponent(n[s]));return e}function zO(n){let e={},s=n.split("&");for(let i=0,o=s.length;i<o;i++){let c=s[i].split("=");e[decodeURIComponent(c[0])]=decodeURIComponent(c[1])}return e}class $O extends Error{constructor(e,s,i){super(e),this.description=s,this.context=i,this.type="TransportError"}}class Sm extends Ct{constructor(e){super(),this.writable=!1,Cu(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,s,i){return super.emitReserved("error",new $O(e,s,i)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const s=wm(e,this.socket.binaryType);this.onPacket(s)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,s={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(s)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const s=UO(e);return s.length?"?"+s:""}}class IO extends Sm{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const s=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let i=0;this._polling&&(i++,this.once("pollComplete",function(){--i||s()})),this.writable||(i++,this.once("drain",function(){--i||s()}))}else s()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const s=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};NO(e,this.socket.binaryType).forEach(s),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,kO(e,s=>{this.doWrite(s,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",s=this.query||{};return this.opts.timestampRequests!==!1&&(s[this.opts.timestampParam]=Kx()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(e,s)}}let Jx=!1;try{Jx=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const HO=Jx;function FO(){}class GO extends IO{constructor(e){if(super(e),typeof location<"u"){const s=location.protocol==="https:";let i=location.port;i||(i=s?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||i!==e.port}}doWrite(e,s){const i=this.request({method:"POST",data:e});i.on("success",s),i.on("error",(o,c)=>{this.onError("xhr post error",o,c)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(s,i)=>{this.onError("xhr poll error",s,i)}),this.pollXhr=e}}class cr extends Ct{constructor(e,s,i){super(),this.createRequest=e,Cu(this,i),this._opts=i,this._method=i.method||"GET",this._uri=s,this._data=i.data!==void 0?i.data:null,this._create()}_create(){var e;const s=Yx(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;const i=this._xhr=this.createRequest(s);try{i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&i.setRequestHeader(o,this._opts.extraHeaders[o])}}catch{}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{i.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var o;i.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.parseCookies(i.getResponseHeader("set-cookie"))),i.readyState===4&&(i.status===200||i.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof i.status=="number"?i.status:0)},0))},i.send(this._data)}catch(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=cr.requestsCount++,cr.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=FO,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete cr.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}cr.requestsCount=0;cr.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Eb);else if(typeof addEventListener=="function"){const n="onpagehide"in In?"pagehide":"unload";addEventListener(n,Eb,!1)}}function Eb(){for(let n in cr.requests)cr.requests.hasOwnProperty(n)&&cr.requests[n].abort()}const VO=(function(){const n=Qx({xdomain:!1});return n&&n.responseType!==null})();class YO extends GO{constructor(e){super(e);const s=e&&e.forceBase64;this.supportsBinary=VO&&!s}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new cr(Qx,this.uri(),e)}}function Qx(n){const e=n.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||HO))return new XMLHttpRequest}catch{}if(!e)try{return new In[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Xx=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class KO extends Sm{get name(){return"websocket"}doOpen(){const e=this.uri(),s=this.opts.protocols,i=Xx?{}:Yx(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,s,i)}catch(o){return this.emitReserved("error",o)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let s=0;s<e.length;s++){const i=e[s],o=s===e.length-1;_m(i,this.supportsBinary,c=>{try{this.doWrite(i,c)}catch{}o&&Tu(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=Kx()),this.supportsBinary||(s.b64=1),this.createUri(e,s)}}const cd=In.WebSocket||In.MozWebSocket;class JO extends KO{createSocket(e,s,i){return Xx?new cd(e,s,i):s?new cd(e,s):new cd(e)}doWrite(e,s){this.ws.send(s)}}class QO extends Sm{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const s=CO(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=e.readable.pipeThrough(s).getReader(),o=TO();o.readable.pipeTo(e.writable),this._writer=o.writable.getWriter();const c=()=>{i.read().then(({done:p,value:g})=>{p||(this.onPacket(g),c())}).catch(p=>{})};c();const d={type:"open"};this.query.sid&&(d.data=`{"sid":"${this.query.sid}"}`),this._writer.write(d).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let s=0;s<e.length;s++){const i=e[s],o=s===e.length-1;this._writer.write(i).then(()=>{o&&Tu(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const XO={websocket:JO,webtransport:QO,polling:YO},WO=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,ZO=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function $d(n){if(n.length>8e3)throw"URI too long";const e=n,s=n.indexOf("["),i=n.indexOf("]");s!=-1&&i!=-1&&(n=n.substring(0,s)+n.substring(s,i).replace(/:/g,";")+n.substring(i,n.length));let o=WO.exec(n||""),c={},d=14;for(;d--;)c[ZO[d]]=o[d]||"";return s!=-1&&i!=-1&&(c.source=e,c.host=c.host.substring(1,c.host.length-1).replace(/;/g,":"),c.authority=c.authority.replace("[","").replace("]","").replace(/;/g,":"),c.ipv6uri=!0),c.pathNames=eA(c,c.path),c.queryKey=tA(c,c.query),c}function eA(n,e){const s=/\/{2,9}/g,i=e.replace(s,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&i.splice(0,1),e.slice(-1)=="/"&&i.splice(i.length-1,1),i}function tA(n,e){const s={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,o,c){o&&(s[o]=c)}),s}const Id=typeof addEventListener=="function"&&typeof removeEventListener=="function",ou=[];Id&&addEventListener("offline",()=>{ou.forEach(n=>n())},!1);class Os extends Ct{constructor(e,s){if(super(),this.binaryType=RO,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(s=e,e=null),e){const i=$d(e);s.hostname=i.host,s.secure=i.protocol==="https"||i.protocol==="wss",s.port=i.port,i.query&&(s.query=i.query)}else s.host&&(s.hostname=$d(s.host).host);Cu(this,s),this.secure=s.secure!=null?s.secure:typeof location<"u"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=s.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(i=>{const o=i.prototype.name;this.transports.push(o),this._transportsByName[o]=i}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=zO(this.opts.query)),Id&&(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"})},ou.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const s=Object.assign({},this.opts.query);s.EIO=Vx,s.transport=e,this.id&&(s.sid=this.id);const i=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&Os.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const s=this.createTransport(e);s.open(),this.setTransport(s)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",Os.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const s=new Error("server error");s.code=e.data,this._onError(s);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let i=0;i<this.writeBuffer.length;i++){const o=this.writeBuffer[i].data;if(o&&(s+=PO(o)),i>0&&s>this._maxPayload)return this.writeBuffer.slice(0,i);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,Tu(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,s,i){return this._sendPacket("message",e,s,i),this}send(e,s,i){return this._sendPacket("message",e,s,i),this}_sendPacket(e,s,i,o){if(typeof s=="function"&&(o=s,s=void 0),typeof i=="function"&&(o=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;const c={type:e,data:s,options:i};this.emitReserved("packetCreate",c),this.writeBuffer.push(c),o&&this.once("flush",o),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),e()},i=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():e()}):this.upgrading?i():e()),this}_onError(e){if(Os.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Id&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const i=ou.indexOf(this._offlineEventListener);i!==-1&&ou.splice(i,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,s),this.writeBuffer=[],this._prevBufferLen=0}}}Os.protocol=Vx;class nA extends Os{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let s=this.createTransport(e),i=!1;Os.priorWebsocketSuccess=!1;const o=()=>{i||(s.send([{type:"ping",data:"probe"}]),s.once("packet",b=>{if(!i)if(b.type==="pong"&&b.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",s),!s)return;Os.priorWebsocketSuccess=s.name==="websocket",this.transport.pause(()=>{i||this.readyState!=="closed"&&(m(),this.setTransport(s),s.send([{type:"upgrade"}]),this.emitReserved("upgrade",s),s=null,this.upgrading=!1,this.flush())})}else{const x=new Error("probe error");x.transport=s.name,this.emitReserved("upgradeError",x)}}))};function c(){i||(i=!0,m(),s.close(),s=null)}const d=b=>{const x=new Error("probe error: "+b);x.transport=s.name,c(),this.emitReserved("upgradeError",x)};function p(){d("transport closed")}function g(){d("socket closed")}function u(b){s&&b.name!==s.name&&c()}const m=()=>{s.removeListener("open",o),s.removeListener("error",d),s.removeListener("close",p),this.off("close",g),this.off("upgrading",u)};s.once("open",o),s.once("error",d),s.once("close",p),this.once("close",g),this.once("upgrading",u),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{i||s.open()},200):s.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const s=[];for(let i=0;i<e.length;i++)~this.transports.indexOf(e[i])&&s.push(e[i]);return s}}let rA=class extends nA{constructor(e,s={}){const i=typeof e=="object"?e:s;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(o=>XO[o]).filter(o=>!!o)),super(e,i)}};function sA(n,e="",s){let i=n;s=s||typeof location<"u"&&location,n==null&&(n=s.protocol+"//"+s.host),typeof n=="string"&&(n.charAt(0)==="/"&&(n.charAt(1)==="/"?n=s.protocol+n:n=s.host+n),/^(https?|wss?):\/\//.test(n)||(typeof s<"u"?n=s.protocol+"//"+n:n="https://"+n),i=$d(n)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";const c=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+c+":"+i.port+e,i.href=i.protocol+"://"+c+(s&&s.port===i.port?"":":"+i.port),i}const iA=typeof ArrayBuffer=="function",aA=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,Wx=Object.prototype.toString,oA=typeof Blob=="function"||typeof Blob<"u"&&Wx.call(Blob)==="[object BlobConstructor]",lA=typeof File=="function"||typeof File<"u"&&Wx.call(File)==="[object FileConstructor]";function Em(n){return iA&&(n instanceof ArrayBuffer||aA(n))||oA&&n instanceof Blob||lA&&n instanceof File}function lu(n,e){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let s=0,i=n.length;s<i;s++)if(lu(n[s]))return!0;return!1}if(Em(n))return!0;if(n.toJSON&&typeof n.toJSON=="function"&&arguments.length===1)return lu(n.toJSON(),!0);for(const s in n)if(Object.prototype.hasOwnProperty.call(n,s)&&lu(n[s]))return!0;return!1}function cA(n){const e=[],s=n.data,i=n;return i.data=Hd(s,e),i.attachments=e.length,{packet:i,buffers:e}}function Hd(n,e){if(!n)return n;if(Em(n)){const s={_placeholder:!0,num:e.length};return e.push(n),s}else if(Array.isArray(n)){const s=new Array(n.length);for(let i=0;i<n.length;i++)s[i]=Hd(n[i],e);return s}else if(typeof n=="object"&&!(n instanceof Date)){const s={};for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&(s[i]=Hd(n[i],e));return s}return n}function uA(n,e){return n.data=Fd(n.data,e),delete n.attachments,n}function Fd(n,e){if(!n)return n;if(n&&n._placeholder===!0){if(typeof n.num=="number"&&n.num>=0&&n.num<e.length)return e[n.num];throw new Error("illegal attachments")}else if(Array.isArray(n))for(let s=0;s<n.length;s++)n[s]=Fd(n[s],e);else if(typeof n=="object")for(const s in n)Object.prototype.hasOwnProperty.call(n,s)&&(n[s]=Fd(n[s],e));return n}const fA=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Ve;(function(n){n[n.CONNECT=0]="CONNECT",n[n.DISCONNECT=1]="DISCONNECT",n[n.EVENT=2]="EVENT",n[n.ACK=3]="ACK",n[n.CONNECT_ERROR=4]="CONNECT_ERROR",n[n.BINARY_EVENT=5]="BINARY_EVENT",n[n.BINARY_ACK=6]="BINARY_ACK"})(Ve||(Ve={}));class hA{constructor(e){this.replacer=e}encode(e){return(e.type===Ve.EVENT||e.type===Ve.ACK)&&lu(e)?this.encodeAsBinary({type:e.type===Ve.EVENT?Ve.BINARY_EVENT:Ve.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let s=""+e.type;return(e.type===Ve.BINARY_EVENT||e.type===Ve.BINARY_ACK)&&(s+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(s+=e.nsp+","),e.id!=null&&(s+=e.id),e.data!=null&&(s+=JSON.stringify(e.data,this.replacer)),s}encodeAsBinary(e){const s=cA(e),i=this.encodeAsString(s.packet),o=s.buffers;return o.unshift(i),o}}class Om extends Ct{constructor(e){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof e=="function"?{reviver:e}:e)}add(e){let s;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");s=this.decodeString(e);const i=s.type===Ve.BINARY_EVENT;i||s.type===Ve.BINARY_ACK?(s.type=i?Ve.EVENT:Ve.ACK,this.reconstructor=new dA(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if(Em(e)||e.base64)if(this.reconstructor)s=this.reconstructor.takeBinaryData(e),s&&(this.reconstructor=null,super.emitReserved("decoded",s));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let s=0;const i={type:Number(e.charAt(0))};if(Ve[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===Ve.BINARY_EVENT||i.type===Ve.BINARY_ACK){const c=s+1;for(;e.charAt(++s)!=="-"&&s!=e.length;);const d=e.substring(c,s);if(d!=Number(d)||e.charAt(s)!=="-")throw new Error("Illegal attachments");const p=Number(d);if(!mA(p)||p<0)throw new Error("Illegal attachments");if(p>this.opts.maxAttachments)throw new Error("too many attachments");i.attachments=p}if(e.charAt(s+1)==="/"){const c=s+1;for(;++s&&!(e.charAt(s)===","||s===e.length););i.nsp=e.substring(c,s)}else i.nsp="/";const o=e.charAt(s+1);if(o!==""&&Number(o)==o){const c=s+1;for(;++s;){const d=e.charAt(s);if(d==null||Number(d)!=d){--s;break}if(s===e.length)break}i.id=Number(e.substring(c,s+1))}if(e.charAt(++s)){const c=this.tryParse(e.substr(s));if(Om.isPayloadValid(i.type,c))i.data=c;else throw new Error("invalid payload")}return i}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch{return!1}}static isPayloadValid(e,s){switch(e){case Ve.CONNECT:return Ob(s);case Ve.DISCONNECT:return s===void 0;case Ve.CONNECT_ERROR:return typeof s=="string"||Ob(s);case Ve.EVENT:case Ve.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&fA.indexOf(s[0])===-1);case Ve.ACK:case Ve.BINARY_ACK:return Array.isArray(s)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class dA{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const s=uA(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const mA=Number.isInteger||function(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n)===n};function Ob(n){return Object.prototype.toString.call(n)==="[object Object]"}const pA=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Om,Encoder:hA,get PacketType(){return Ve}},Symbol.toStringTag,{value:"Module"}));function Wn(n,e,s){return n.on(e,s),function(){n.off(e,s)}}const yA=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Zx extends Ct{constructor(e,s,i){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=s,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[Wn(e,"open",this.onopen.bind(this)),Wn(e,"packet",this.onpacket.bind(this)),Wn(e,"error",this.onerror.bind(this)),Wn(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...s){var i,o,c;if(yA.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(s.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(s),this;const d={type:Ve.EVENT,data:s};if(d.options={},d.options.compress=this.flags.compress!==!1,typeof s[s.length-1]=="function"){const m=this.ids++,b=s.pop();this._registerAckCallback(m,b),d.id=m}const p=(o=(i=this.io.engine)===null||i===void 0?void 0:i.transport)===null||o===void 0?void 0:o.writable,g=this.connected&&!(!((c=this.io.engine)===null||c===void 0)&&c._hasPingExpired());return this.flags.volatile&&!p||(g?(this.notifyOutgoingListeners(d),this.packet(d)):this.sendBuffer.push(d)),this.flags={},this}_registerAckCallback(e,s){var i;const o=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(o===void 0){this.acks[e]=s;return}const c=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let p=0;p<this.sendBuffer.length;p++)this.sendBuffer[p].id===e&&this.sendBuffer.splice(p,1);s.call(this,new Error("operation has timed out"))},o),d=(...p)=>{this.io.clearTimeoutFn(c),s.apply(this,p)};d.withError=!0,this.acks[e]=d}emitWithAck(e,...s){return new Promise((i,o)=>{const c=(d,p)=>d?o(d):i(p);c.withError=!0,s.push(c),this.emit(e,...s)})}_addToQueue(e){let s;typeof e[e.length-1]=="function"&&(s=e.pop());const i={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((o,...c)=>(this._queue[0],o!==null?i.tryCount>this._opts.retries&&(this._queue.shift(),s&&s(o)):(this._queue.shift(),s&&s(null,...c)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const s=this._queue[0];s.pending&&!e||(s.pending=!0,s.tryCount++,this.flags=s.flags,this.emit.apply(this,s.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Ve.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,s){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(i=>String(i.id)===e)){const i=this.acks[e];delete this.acks[e],i.withError&&i.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Ve.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Ve.EVENT:case Ve.BINARY_EVENT:this.onevent(e);break;case Ve.ACK:case Ve.BINARY_ACK:this.onack(e);break;case Ve.DISCONNECT:this.ondisconnect();break;case Ve.CONNECT_ERROR:this.destroy();const i=new Error(e.data.message);i.data=e.data.data,this.emitReserved("connect_error",i);break}}onevent(e){const s=e.data||[];e.id!=null&&s.push(this.ack(e.id)),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const s=this._anyListeners.slice();for(const i of s)i.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const s=this;let i=!1;return function(...o){i||(i=!0,s.packet({type:Ve.ACK,id:e,data:o}))}}onack(e){const s=this.acks[e.id];typeof s=="function"&&(delete this.acks[e.id],s.withError&&e.data.unshift(null),s.apply(this,e.data))}onconnect(e,s){this.id=e,this.recovered=s&&this._pid===s,this._pid=s,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ve.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const s=this._anyListeners;for(let i=0;i<s.length;i++)if(e===s[i])return s.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const s=this._anyOutgoingListeners;for(let i=0;i<s.length;i++)if(e===s[i])return s.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const s=this._anyOutgoingListeners.slice();for(const i of s)i.apply(this,e.data)}}}function ua(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}ua.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),s=Math.floor(e*this.jitter*n);n=(Math.floor(e*10)&1)==0?n-s:n+s}return Math.min(n,this.max)|0};ua.prototype.reset=function(){this.attempts=0};ua.prototype.setMin=function(n){this.ms=n};ua.prototype.setMax=function(n){this.max=n};ua.prototype.setJitter=function(n){this.jitter=n};class Gd extends Ct{constructor(e,s){var i;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(s=e,e=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,Cu(this,s),this.reconnection(s.reconnection!==!1),this.reconnectionAttempts(s.reconnectionAttempts||1/0),this.reconnectionDelay(s.reconnectionDelay||1e3),this.reconnectionDelayMax(s.reconnectionDelayMax||5e3),this.randomizationFactor((i=s.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new ua({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=e;const o=s.parser||pA;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=s.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var s;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(s=this.backoff)===null||s===void 0||s.setMin(e),this)}randomizationFactor(e){var s;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(s=this.backoff)===null||s===void 0||s.setJitter(e),this)}reconnectionDelayMax(e){var s;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(s=this.backoff)===null||s===void 0||s.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new rA(this.uri,this.opts);const s=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;const o=Wn(s,"open",function(){i.onopen(),e&&e()}),c=p=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",p),e?e(p):this.maybeReconnectOnOpen()},d=Wn(s,"error",c);if(this._timeout!==!1){const p=this._timeout,g=this.setTimeoutFn(()=>{o(),c(new Error("timeout")),s.close()},p);this.opts.autoUnref&&g.unref(),this.subs.push(()=>{this.clearTimeoutFn(g)})}return this.subs.push(o),this.subs.push(d),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Wn(e,"ping",this.onping.bind(this)),Wn(e,"data",this.ondata.bind(this)),Wn(e,"error",this.onerror.bind(this)),Wn(e,"close",this.onclose.bind(this)),Wn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(s){this.onclose("parse error",s)}}ondecoded(e){Tu(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,s){let i=this.nsps[e];return i?this._autoConnect&&!i.active&&i.connect():(i=new Zx(this,e,s),this.nsps[e]=i),i}_destroy(e){const s=Object.keys(this.nsps);for(const i of s)if(this.nsps[i].active)return;this._close()}_packet(e){const s=this.encoder.encode(e);for(let i=0;i<s.length;i++)this.engine.write(s[i],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,s){var i;this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,s),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const s=this.backoff.duration();this._reconnecting=!0;const i=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(o=>{o?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",o)):e.onreconnect()}))},s);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const lo={};function cu(n,e){typeof n=="object"&&(e=n,n=void 0),e=e||{};const s=sA(n,e.path||"/socket.io"),i=s.source,o=s.id,c=s.path,d=lo[o]&&c in lo[o].nsps,p=e.forceNew||e["force new connection"]||e.multiplex===!1||d;let g;return p?g=new Gd(i,e):(lo[o]||(lo[o]=new Gd(i,e)),g=lo[o]),s.query&&!e.query&&(e.query=s.queryKey),g.socket(s.path,e)}Object.assign(cu,{Manager:Gd,Socket:Zx,io:cu,connect:cu});const gA=E.createContext({connected:!1,subscribe:()=>()=>{}});function bA({children:n}){const{isAuthenticated:e}=qt(),s=E.useRef(null),[i,o]=E.useState(!1),c=E.useRef(new Map),d=E.useCallback((g,u)=>{var b;const m=c.current;return m.has(g)||(m.set(g,new Set),(b=s.current)==null||b.emit("lt.subscribe",g)),m.get(g).add(u),()=>{var v;const x=m.get(g);x&&(x.delete(u),x.size===0&&(m.delete(g),(v=s.current)==null||v.emit("lt.unsubscribe",g)))}},[]),p=E.useCallback((g,u)=>{for(const[m,b]of c.current)if(Bx(g,m))for(const x of b)try{x(u)}catch{}},[]);return E.useEffect(()=>{if(!e)return;const g=cu({path:`${Yt}/socket.io`,transports:["polling","websocket"],upgrade:!0,reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:2e3,auth:u=>{const m=Ed();u(m?{token:m}:{})}});return s.current=g,console.log("[lt-socketio] connecting..."),g.on("connect",()=>{console.log("[lt-socketio] connected, id:",g.id),o(!0);for(const u of c.current.keys())g.emit("lt.subscribe",u)}),g.on("disconnect",u=>{console.log("[lt-socketio] disconnected:",u),o(!1)}),g.on("connect_error",u=>{console.warn("[lt-socketio] connect error:",u.message),o(!1)}),g.onAny((u,m)=>{if(u.startsWith("lt."))try{const b=typeof m=="string"?JSON.parse(m):m;p(u,b)}catch{}}),()=>{g.removeAllListeners(),g.disconnect(),s.current=null,o(!1)}},[p,e]),h.jsx(gA.Provider,{value:{connected:i,subscribe:d},children:h.jsx(ca.Provider,{value:{connected:i,subscribe:d},children:n})})}function xA({children:n}){const{isAuthenticated:e}=qt(),s=Pe(),[i,o]=E.useState(null),[c,d]=E.useState({url:null,policy:Qg(null)});E.useEffect(()=>{let u=!1;async function m(){var b;try{console.log("[lt-transport] detecting event transport...");const x=await hm(),v=(b=x==null?void 0:x.events)==null?void 0:b.transport;console.log("[lt-transport] server reports:",v),u||(v==="nats"&&d({url:x.events.natsWsUrl??null,policy:Qg(x.events.reconnect)}),o(v==="nats"?"nats":"socketio"))}catch(x){console.warn("[lt-transport] settings fetch error, falling back to socketio",x),u||o("socketio")}}return m(),()=>{u=!0}},[e]);const p=E.useCallback(()=>gE(c.url),[c.url]),g=E.useCallback(()=>{s.invalidateQueries({refetchType:"active"})},[s]);return i==="nats"?h.jsx(SO,{resolveCredentials:p,policy:c.policy,onReconnect:g,sessionKey:e,children:n}):i==="socketio"?h.jsx(bA,{children:n}):h.jsx(h.Fragment,{children:n})}const Am="lt_view_as",jm="lt_ai_override",Vd="lt_graph_enabled",Yd="lt_infrastructure_enabled",km="lt_scan_override";function ev(){try{const n=localStorage.getItem(jm);if(n==="true")return!0;if(n==="false")return!1}catch{}return null}function vA(n){try{localStorage.setItem(jm,String(n))}catch{}}function _A(){try{localStorage.removeItem(jm)}catch{}}function Nm(){try{const n=localStorage.getItem(Am);if(n==="admin"||n==="engineer"||n==="operator")return n}catch{}return null}function wA(n){try{localStorage.setItem(Am,n)}catch{}window.location.reload()}function Kd(){try{localStorage.removeItem(Am)}catch{}window.location.reload()}function tv(){try{return localStorage.getItem(Vd)==="true"}catch{return!1}}function SA(n){try{n?localStorage.setItem(Vd,"true"):localStorage.removeItem(Vd)}catch{}}function nv(){try{return localStorage.getItem(Yd)==="true"}catch{return!1}}function EA(n){try{n?localStorage.setItem(Yd,"true"):localStorage.removeItem(Yd)}catch{}}function rv(){try{const n=localStorage.getItem(km);if(n==="true")return!0;if(n==="false")return!1}catch{}return null}function OA(n){try{localStorage.setItem(km,String(n))}catch{}}function AA(){try{localStorage.removeItem(km)}catch{}}function sv(){const{isSuperAdmin:n,hasRoleType:e,hasRole:s}=qt(),i=Nm(),o=n||s("engineer"),c=e("admin"),d=n||e("admin"),p=i?!1:o,g=i?i==="admin"||i==="engineer":c,u=i?i==="admin":d;return{isBuilder:p,isOps:g,canBulk:u,canAdminister:u,viewAs:i,realIsBuilder:o}}function iv(){var u;const{isSuperAdmin:n,hasRoleType:e,hasRole:s}=qt(),{data:i}=Hn(),o=((u=i==null?void 0:i.features)==null?void 0:u.publicPaceBoard)!==!1,c=n?"superadmin":e("admin")?"admin":s("engineer")?"engineer":"operator",d=Nm(),p=d==="admin"||d==="engineer"||d==="operator"?d:null,g=p??c;return{tier:g,realTier:c,viewAs:p,canSeePaceBoard:o||g==="superadmin"||g==="admin",canSeeWorkflows:g==="superadmin"||g==="engineer",showTaskQueueCards:g==="operator"&&!o}}const Tm=E.createContext(null);function Mu(){const n=E.useContext(Tm);if(!n)throw new Error("useActingIdentity must be used within ActingIdentityProvider");return n}function jA(){var n;return((n=E.useContext(Tm))==null?void 0:n.identity)??null}function kA({children:n}){const[e,s]=E.useState(null),i=E.useRef(e);i.current=e,E.useEffect(()=>{if(!(e!=null&&e.expiresAt))return;const m=new Date(e.expiresAt).getTime()-Date.now();if(m<=0){s(null);return}const b=setTimeout(()=>s(null),m);return()=>clearTimeout(b)},[e]);const o=E.useCallback(m=>{var x;if(!m.actingToken||!m.actor)return null;const b=((x=i.current)==null?void 0:x.actingToken)??null;return s({actingToken:m.actingToken,actorId:m.actor.id,displayName:m.actor.displayName,expiresAt:m.expiresAt??null,subjectScoped:m.grantScope==="subject"}),b},[]),c=E.useCallback(()=>s(null),[]),d=E.useCallback((m,b)=>{const x=i.current;b===0&&(x==null?void 0:x.actingToken)===m&&s(null)},[]),p=E.useCallback((m,b)=>{const x=i.current;if(!x||x.actingToken!==m||!b.acting)return;const{consumed:v,remaining:_,bound:S}=b.acting;(v&&_===0||S&&b.clearSubject)&&s(null)},[]);E.useEffect(()=>(Gg(()=>{var m;return((m=i.current)==null?void 0:m.actingToken)??null}),Yg(c),Vg(d),()=>{Gg(null),Yg(null),Vg(null)}),[c,d]);const g=E.useCallback(()=>{var b;const m=(b=i.current)==null?void 0:b.expiresAt;return m?Math.max(0,Math.floor((new Date(m).getTime()-Date.now())/1e3)):0},[]),u=E.useMemo(()=>({identity:e,prime:o,clear:c,settle:p,remainingSeconds:g}),[e,o,c,p,g]);return h.jsx(Tm.Provider,{value:u,children:n})}function NA(){const{user:n}=qt(),{identity:e}=Mu(),s=n==null?void 0:n.userId,i=e==null?void 0:e.actorId,o=E.useCallback(c=>!!c&&(c===i||c===s),[i,s]);return{viewerId:i??s,isViewer:o}}function av(n){return(n??"").replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")||"none"}function fr(n={}){const e=n.role?av(n.role):"*",s=n.id??"*",i=n.verb??">";return`${Wt}.system.escalation.${e}.${s}.${i}`}function Jd(n){return n.verbs.map(e=>fr({role:n.role,verb:e}))}function Cm(n){const{user:e,isSuperAdmin:s,hasRoleType:i}=qt(),o=s||i("admin"),c=((e==null?void 0:e.roles)??[]).map(p=>p.role).sort().join(","),d=(n??[]).join(",");return E.useMemo(()=>{const p=d?d.split(","):null;return o||!c?p?Jd({verbs:p}):[fr({})]:c.split(",").flatMap(g=>p?Jd({role:g,verbs:p}):[fr({role:g})])},[o,c,d])}const Qd="/escalations/detail/";function TA(n){return n.startsWith(Qd)&&n.slice(Qd.length).split("/")[0]||void 0}function CA(){const{isViewer:n}=NA(),e=ri(),s=tn(),i=E.useRef(s.pathname);i.current=s.pathname;const o=E.useRef(n);o.current=n;const c=E.useCallback(d=>{var b,x,v;if((d==null?void 0:d.assignedAtCreation)!==!0)return;const p=(d==null?void 0:d.escalationId)??((b=d==null?void 0:d.data)==null?void 0:b.id),g=(x=d==null?void 0:d.data)==null?void 0:x.assigned_to,u=(v=d==null?void 0:d.data)==null?void 0:v.parent_id;if(!p||!o.current(g)||!u||u!==TA(i.current))return;const m=`${Qd}${p}`;i.current!==m&&e(m)},[e]);Ns(Cm(["claimed"]),c)}const ov=6048e5,MA=864e5,Ab=6e4,jb=525600,kb=43200,Nb=1440,Tb=Symbol.for("constructDateFrom");function Br(n,e){return typeof n=="function"?n(e):n&&typeof n=="object"&&Tb in n?n[Tb](e):n instanceof Date?new n.constructor(e):new Date(e)}function kn(n,e){return Br(e||n,n)}let RA={};function qo(){return RA}function Co(n,e){var p,g,u,m;const s=qo(),i=(e==null?void 0:e.weekStartsOn)??((g=(p=e==null?void 0:e.locale)==null?void 0:p.options)==null?void 0:g.weekStartsOn)??s.weekStartsOn??((m=(u=s.locale)==null?void 0:u.options)==null?void 0:m.weekStartsOn)??0,o=kn(n,e==null?void 0:e.in),c=o.getDay(),d=(c<i?7:0)+c-i;return o.setDate(o.getDate()-d),o.setHours(0,0,0,0),o}function xu(n,e){return Co(n,{...e,weekStartsOn:1})}function lv(n,e){const s=kn(n,e==null?void 0:e.in),i=s.getFullYear(),o=Br(s,0);o.setFullYear(i+1,0,4),o.setHours(0,0,0,0);const c=xu(o),d=Br(s,0);d.setFullYear(i,0,4),d.setHours(0,0,0,0);const p=xu(d);return s.getTime()>=c.getTime()?i+1:s.getTime()>=p.getTime()?i:i-1}function vu(n){const e=kn(n),s=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return s.setUTCFullYear(e.getFullYear()),+n-+s}function cv(n,...e){const s=Br.bind(null,n||e.find(i=>typeof i=="object"));return e.map(s)}function Cb(n,e){const s=kn(n,e==null?void 0:e.in);return s.setHours(0,0,0,0),s}function DA(n,e,s){const[i,o]=cv(s==null?void 0:s.in,n,e),c=Cb(i),d=Cb(o),p=+c-vu(c),g=+d-vu(d);return Math.round((p-g)/MA)}function LA(n,e){const s=lv(n,e),i=Br(n,0);return i.setFullYear(s,0,4),i.setHours(0,0,0,0),xu(i)}function qA(n,e){const s=+kn(n)-+kn(e);return s<0?-1:s>0?1:s}function PA(n){return Br(n,Date.now())}function BA(n){return n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]"}function UA(n){return!(!BA(n)&&typeof n!="number"||isNaN(+kn(n)))}function zA(n){return e=>{const i=(n?Math[n]:Math.trunc)(e);return i===0?0:i}}function $A(n,e){const s=kn(n,e==null?void 0:e.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}const IA={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"}},HA=(n,e,s)=>{let i;const o=IA[n];return typeof o=="string"?i=o:e===1?i=o.one:i=o.other.replace("{{count}}",e.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+i:i+" ago":i};function ud(n){return(e={})=>{const s=e.width?String(e.width):n.defaultWidth;return n.formats[s]||n.formats[n.defaultWidth]}}const FA={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},GA={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},VA={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},YA={date:ud({formats:FA,defaultWidth:"full"}),time:ud({formats:GA,defaultWidth:"full"}),dateTime:ud({formats:VA,defaultWidth:"full"})},KA={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},JA=(n,e,s,i)=>KA[n];function co(n){return(e,s)=>{const i=s!=null&&s.context?String(s.context):"standalone";let o;if(i==="formatting"&&n.formattingValues){const d=n.defaultFormattingWidth||n.defaultWidth,p=s!=null&&s.width?String(s.width):d;o=n.formattingValues[p]||n.formattingValues[d]}else{const d=n.defaultWidth,p=s!=null&&s.width?String(s.width):n.defaultWidth;o=n.values[p]||n.values[d]}const c=n.argumentCallback?n.argumentCallback(e):e;return o[c]}}const QA={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},XA={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},WA={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"]},ZA={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"]},ej={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"}},tj={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"}},nj=(n,e)=>{const s=Number(n),i=s%100;if(i>20||i<10)switch(i%10){case 1:return s+"st";case 2:return s+"nd";case 3:return s+"rd"}return s+"th"},rj={ordinalNumber:nj,era:co({values:QA,defaultWidth:"wide"}),quarter:co({values:XA,defaultWidth:"wide",argumentCallback:n=>n-1}),month:co({values:WA,defaultWidth:"wide"}),day:co({values:ZA,defaultWidth:"wide"}),dayPeriod:co({values:ej,defaultWidth:"wide",formattingValues:tj,defaultFormattingWidth:"wide"})};function uo(n){return(e,s={})=>{const i=s.width,o=i&&n.matchPatterns[i]||n.matchPatterns[n.defaultMatchWidth],c=e.match(o);if(!c)return null;const d=c[0],p=i&&n.parsePatterns[i]||n.parsePatterns[n.defaultParseWidth],g=Array.isArray(p)?ij(p,b=>b.test(d)):sj(p,b=>b.test(d));let u;u=n.valueCallback?n.valueCallback(g):g,u=s.valueCallback?s.valueCallback(u):u;const m=e.slice(d.length);return{value:u,rest:m}}}function sj(n,e){for(const s in n)if(Object.prototype.hasOwnProperty.call(n,s)&&e(n[s]))return s}function ij(n,e){for(let s=0;s<n.length;s++)if(e(n[s]))return s}function aj(n){return(e,s={})=>{const i=e.match(n.matchPattern);if(!i)return null;const o=i[0],c=e.match(n.parsePattern);if(!c)return null;let d=n.valueCallback?n.valueCallback(c[0]):c[0];d=s.valueCallback?s.valueCallback(d):d;const p=e.slice(o.length);return{value:d,rest:p}}}const oj=/^(\d+)(th|st|nd|rd)?/i,lj=/\d+/i,cj={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},uj={any:[/^b/i,/^(a|c)/i]},fj={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},hj={any:[/1/i,/2/i,/3/i,/4/i]},dj={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},mj={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]},pj={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},yj={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]},gj={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},bj={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}},xj={ordinalNumber:aj({matchPattern:oj,parsePattern:lj,valueCallback:n=>parseInt(n,10)}),era:uo({matchPatterns:cj,defaultMatchWidth:"wide",parsePatterns:uj,defaultParseWidth:"any"}),quarter:uo({matchPatterns:fj,defaultMatchWidth:"wide",parsePatterns:hj,defaultParseWidth:"any",valueCallback:n=>n+1}),month:uo({matchPatterns:dj,defaultMatchWidth:"wide",parsePatterns:mj,defaultParseWidth:"any"}),day:uo({matchPatterns:pj,defaultMatchWidth:"wide",parsePatterns:yj,defaultParseWidth:"any"}),dayPeriod:uo({matchPatterns:gj,defaultMatchWidth:"any",parsePatterns:bj,defaultParseWidth:"any"})},uv={code:"en-US",formatDistance:HA,formatLong:YA,formatRelative:JA,localize:rj,match:xj,options:{weekStartsOn:0,firstWeekContainsDate:1}};function vj(n,e){const s=kn(n,e==null?void 0:e.in);return DA(s,$A(s))+1}function _j(n,e){const s=kn(n,e==null?void 0:e.in),i=+xu(s)-+LA(s);return Math.round(i/ov)+1}function fv(n,e){var m,b,x,v;const s=kn(n,e==null?void 0:e.in),i=s.getFullYear(),o=qo(),c=(e==null?void 0:e.firstWeekContainsDate)??((b=(m=e==null?void 0:e.locale)==null?void 0:m.options)==null?void 0:b.firstWeekContainsDate)??o.firstWeekContainsDate??((v=(x=o.locale)==null?void 0:x.options)==null?void 0:v.firstWeekContainsDate)??1,d=Br((e==null?void 0:e.in)||n,0);d.setFullYear(i+1,0,c),d.setHours(0,0,0,0);const p=Co(d,e),g=Br((e==null?void 0:e.in)||n,0);g.setFullYear(i,0,c),g.setHours(0,0,0,0);const u=Co(g,e);return+s>=+p?i+1:+s>=+u?i:i-1}function wj(n,e){var p,g,u,m;const s=qo(),i=(e==null?void 0:e.firstWeekContainsDate)??((g=(p=e==null?void 0:e.locale)==null?void 0:p.options)==null?void 0:g.firstWeekContainsDate)??s.firstWeekContainsDate??((m=(u=s.locale)==null?void 0:u.options)==null?void 0:m.firstWeekContainsDate)??1,o=fv(n,e),c=Br((e==null?void 0:e.in)||n,0);return c.setFullYear(o,0,i),c.setHours(0,0,0,0),Co(c,e)}function Sj(n,e){const s=kn(n,e==null?void 0:e.in),i=+Co(s,e)-+wj(s,e);return Math.round(i/ov)+1}function et(n,e){const s=n<0?"-":"",i=Math.abs(n).toString().padStart(e,"0");return s+i}const ys={y(n,e){const s=n.getFullYear(),i=s>0?s:1-s;return et(e==="yy"?i%100:i,e.length)},M(n,e){const s=n.getMonth();return e==="M"?String(s+1):et(s+1,2)},d(n,e){return et(n.getDate(),e.length)},a(n,e){const s=n.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return s.toUpperCase();case"aaa":return s;case"aaaaa":return s[0];case"aaaa":default:return s==="am"?"a.m.":"p.m."}},h(n,e){return et(n.getHours()%12||12,e.length)},H(n,e){return et(n.getHours(),e.length)},m(n,e){return et(n.getMinutes(),e.length)},s(n,e){return et(n.getSeconds(),e.length)},S(n,e){const s=e.length,i=n.getMilliseconds(),o=Math.trunc(i*Math.pow(10,s-3));return et(o,e.length)}},Fi={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Mb={G:function(n,e,s){const i=n.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return s.era(i,{width:"abbreviated"});case"GGGGG":return s.era(i,{width:"narrow"});case"GGGG":default:return s.era(i,{width:"wide"})}},y:function(n,e,s){if(e==="yo"){const i=n.getFullYear(),o=i>0?i:1-i;return s.ordinalNumber(o,{unit:"year"})}return ys.y(n,e)},Y:function(n,e,s,i){const o=fv(n,i),c=o>0?o:1-o;if(e==="YY"){const d=c%100;return et(d,2)}return e==="Yo"?s.ordinalNumber(c,{unit:"year"}):et(c,e.length)},R:function(n,e){const s=lv(n);return et(s,e.length)},u:function(n,e){const s=n.getFullYear();return et(s,e.length)},Q:function(n,e,s){const i=Math.ceil((n.getMonth()+1)/3);switch(e){case"Q":return String(i);case"QQ":return et(i,2);case"Qo":return s.ordinalNumber(i,{unit:"quarter"});case"QQQ":return s.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return s.quarter(i,{width:"narrow",context:"formatting"});case"QQQQ":default:return s.quarter(i,{width:"wide",context:"formatting"})}},q:function(n,e,s){const i=Math.ceil((n.getMonth()+1)/3);switch(e){case"q":return String(i);case"qq":return et(i,2);case"qo":return s.ordinalNumber(i,{unit:"quarter"});case"qqq":return s.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return s.quarter(i,{width:"narrow",context:"standalone"});case"qqqq":default:return s.quarter(i,{width:"wide",context:"standalone"})}},M:function(n,e,s){const i=n.getMonth();switch(e){case"M":case"MM":return ys.M(n,e);case"Mo":return s.ordinalNumber(i+1,{unit:"month"});case"MMM":return s.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return s.month(i,{width:"narrow",context:"formatting"});case"MMMM":default:return s.month(i,{width:"wide",context:"formatting"})}},L:function(n,e,s){const i=n.getMonth();switch(e){case"L":return String(i+1);case"LL":return et(i+1,2);case"Lo":return s.ordinalNumber(i+1,{unit:"month"});case"LLL":return s.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return s.month(i,{width:"narrow",context:"standalone"});case"LLLL":default:return s.month(i,{width:"wide",context:"standalone"})}},w:function(n,e,s,i){const o=Sj(n,i);return e==="wo"?s.ordinalNumber(o,{unit:"week"}):et(o,e.length)},I:function(n,e,s){const i=_j(n);return e==="Io"?s.ordinalNumber(i,{unit:"week"}):et(i,e.length)},d:function(n,e,s){return e==="do"?s.ordinalNumber(n.getDate(),{unit:"date"}):ys.d(n,e)},D:function(n,e,s){const i=vj(n);return e==="Do"?s.ordinalNumber(i,{unit:"dayOfYear"}):et(i,e.length)},E:function(n,e,s){const i=n.getDay();switch(e){case"E":case"EE":case"EEE":return s.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return s.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(i,{width:"short",context:"formatting"});case"EEEE":default:return s.day(i,{width:"wide",context:"formatting"})}},e:function(n,e,s,i){const o=n.getDay(),c=(o-i.weekStartsOn+8)%7||7;switch(e){case"e":return String(c);case"ee":return et(c,2);case"eo":return s.ordinalNumber(c,{unit:"day"});case"eee":return s.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return s.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(o,{width:"short",context:"formatting"});case"eeee":default:return s.day(o,{width:"wide",context:"formatting"})}},c:function(n,e,s,i){const o=n.getDay(),c=(o-i.weekStartsOn+8)%7||7;switch(e){case"c":return String(c);case"cc":return et(c,e.length);case"co":return s.ordinalNumber(c,{unit:"day"});case"ccc":return s.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return s.day(o,{width:"narrow",context:"standalone"});case"cccccc":return s.day(o,{width:"short",context:"standalone"});case"cccc":default:return s.day(o,{width:"wide",context:"standalone"})}},i:function(n,e,s){const i=n.getDay(),o=i===0?7:i;switch(e){case"i":return String(o);case"ii":return et(o,e.length);case"io":return s.ordinalNumber(o,{unit:"day"});case"iii":return s.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return s.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return s.day(i,{width:"short",context:"formatting"});case"iiii":default:return s.day(i,{width:"wide",context:"formatting"})}},a:function(n,e,s){const o=n.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(n,e,s){const i=n.getHours();let o;switch(i===12?o=Fi.noon:i===0?o=Fi.midnight:o=i/12>=1?"pm":"am",e){case"b":case"bb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(n,e,s){const i=n.getHours();let o;switch(i>=17?o=Fi.evening:i>=12?o=Fi.afternoon:i>=4?o=Fi.morning:o=Fi.night,e){case"B":case"BB":case"BBB":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(n,e,s){if(e==="ho"){let i=n.getHours()%12;return i===0&&(i=12),s.ordinalNumber(i,{unit:"hour"})}return ys.h(n,e)},H:function(n,e,s){return e==="Ho"?s.ordinalNumber(n.getHours(),{unit:"hour"}):ys.H(n,e)},K:function(n,e,s){const i=n.getHours()%12;return e==="Ko"?s.ordinalNumber(i,{unit:"hour"}):et(i,e.length)},k:function(n,e,s){let i=n.getHours();return i===0&&(i=24),e==="ko"?s.ordinalNumber(i,{unit:"hour"}):et(i,e.length)},m:function(n,e,s){return e==="mo"?s.ordinalNumber(n.getMinutes(),{unit:"minute"}):ys.m(n,e)},s:function(n,e,s){return e==="so"?s.ordinalNumber(n.getSeconds(),{unit:"second"}):ys.s(n,e)},S:function(n,e){return ys.S(n,e)},X:function(n,e,s){const i=n.getTimezoneOffset();if(i===0)return"Z";switch(e){case"X":return Db(i);case"XXXX":case"XX":return ei(i);case"XXXXX":case"XXX":default:return ei(i,":")}},x:function(n,e,s){const i=n.getTimezoneOffset();switch(e){case"x":return Db(i);case"xxxx":case"xx":return ei(i);case"xxxxx":case"xxx":default:return ei(i,":")}},O:function(n,e,s){const i=n.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+Rb(i,":");case"OOOO":default:return"GMT"+ei(i,":")}},z:function(n,e,s){const i=n.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+Rb(i,":");case"zzzz":default:return"GMT"+ei(i,":")}},t:function(n,e,s){const i=Math.trunc(+n/1e3);return et(i,e.length)},T:function(n,e,s){return et(+n,e.length)}};function Rb(n,e=""){const s=n>0?"-":"+",i=Math.abs(n),o=Math.trunc(i/60),c=i%60;return c===0?s+String(o):s+String(o)+e+et(c,2)}function Db(n,e){return n%60===0?(n>0?"-":"+")+et(Math.abs(n)/60,2):ei(n,e)}function ei(n,e=""){const s=n>0?"-":"+",i=Math.abs(n),o=et(Math.trunc(i/60),2),c=et(i%60,2);return s+o+e+c}const Lb=(n,e)=>{switch(n){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},hv=(n,e)=>{switch(n){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},Ej=(n,e)=>{const s=n.match(/(P+)(p+)?/)||[],i=s[1],o=s[2];if(!o)return Lb(n,e);let c;switch(i){case"P":c=e.dateTime({width:"short"});break;case"PP":c=e.dateTime({width:"medium"});break;case"PPP":c=e.dateTime({width:"long"});break;case"PPPP":default:c=e.dateTime({width:"full"});break}return c.replace("{{date}}",Lb(i,e)).replace("{{time}}",hv(o,e))},Oj={p:hv,P:Ej},Aj=/^D+$/,jj=/^Y+$/,kj=["D","DD","YY","YYYY"];function Nj(n){return Aj.test(n)}function Tj(n){return jj.test(n)}function Cj(n,e,s){const i=Mj(n,e,s);if(console.warn(i),kj.includes(n))throw new RangeError(i)}function Mj(n,e,s){const i=n[0]==="Y"?"years":"days of the month";return`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${e}\`) for formatting ${i} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Rj=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Dj=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Lj=/^'([^]*?)'?$/,qj=/''/g,Pj=/[a-zA-Z]/;function Bj(n,e,s){var m,b,x,v;const i=qo(),o=i.locale??uv,c=i.firstWeekContainsDate??((b=(m=i.locale)==null?void 0:m.options)==null?void 0:b.firstWeekContainsDate)??1,d=i.weekStartsOn??((v=(x=i.locale)==null?void 0:x.options)==null?void 0:v.weekStartsOn)??0,p=kn(n,s==null?void 0:s.in);if(!UA(p))throw new RangeError("Invalid time value");let g=e.match(Dj).map(_=>{const S=_[0];if(S==="p"||S==="P"){const C=Oj[S];return C(_,o.formatLong)}return _}).join("").match(Rj).map(_=>{if(_==="''")return{isToken:!1,value:"'"};const S=_[0];if(S==="'")return{isToken:!1,value:Uj(_)};if(Mb[S])return{isToken:!0,value:_};if(S.match(Pj))throw new RangeError("Format string contains an unescaped latin alphabet character `"+S+"`");return{isToken:!1,value:_}});o.localize.preprocessor&&(g=o.localize.preprocessor(p,g));const u={firstWeekContainsDate:c,weekStartsOn:d,locale:o};return g.map(_=>{if(!_.isToken)return _.value;const S=_.value;(Tj(S)||Nj(S))&&Cj(S,e,String(n));const C=Mb[S[0]];return C(p,S,o.localize,u)}).join("")}function Uj(n){const e=n.match(Lj);return e?e[1].replace(qj,"'"):n}function zj(n,e,s){const i=qo(),o=(s==null?void 0:s.locale)??i.locale??uv,c=qA(n,e);if(isNaN(c))throw new RangeError("Invalid time value");const d=Object.assign({},s,{addSuffix:s==null?void 0:s.addSuffix,comparison:c}),[p,g]=cv(s==null?void 0:s.in,...c>0?[e,n]:[n,e]),u=zA((s==null?void 0:s.roundingMethod)??"round"),m=g.getTime()-p.getTime(),b=m/Ab,x=vu(g)-vu(p),v=(m-x)/Ab,_=s==null?void 0:s.unit;let S;if(_?S=_:b<1?S="second":b<60?S="minute":b<Nb?S="hour":v<kb?S="day":v<jb?S="month":S="year",S==="second"){const C=u(m/1e3);return o.formatDistance("xSeconds",C,d)}else if(S==="minute"){const C=u(b);return o.formatDistance("xMinutes",C,d)}else if(S==="hour"){const C=u(b/60);return o.formatDistance("xHours",C,d)}else if(S==="day"){const C=u(v/Nb);return o.formatDistance("xDays",C,d)}else if(S==="month"){const C=u(v/kb);return C===12&&_!=="month"?o.formatDistance("xYears",1,d):o.formatDistance("xMonths",C,d)}else{const C=u(v/jb);return o.formatDistance("xYears",C,d)}}function $j(n,e){return zj(n,PA(n),e)}let _u=null;function Ij(n){_u=n||null}function Hj(){return _u}function Fj(n,e,s){const i=new Intl.DateTimeFormat("en-US",{timeZone:e,year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit",...s?{second:"2-digit"}:{},hour12:!0}).formatToParts(n);return Object.fromEntries(i.map(o=>[o.type,o.value]))}function Mm(n,e=!1){const s=typeof n=="string"?new Date(n):n;if(Number.isNaN(s.getTime()))return String(n);if(!_u)return Bj(s,e?"MMM d, yyyy h:mm:ss a":"MMM d, yyyy h:mm a");const i=Fj(s,_u,e),o=`${i.hour}:${i.minute}${e?`:${i.second}`:""}`;return`${i.month} ${i.day}, ${i.year} ${o} ${i.dayPeriod}`}function dv(n){const e=n??[];return e.length>0&&e.every(s=>s.type==="member"&&s.write_scope==="none")}function P5(n,e,s){return!e||!dv(n)?!0:!!s&&!s.subjectScoped}const Rm={staleTime:5*6e4,refetchOnWindowFocus:!1};function B5(n={},e={}){const s=new URLSearchParams;return n.role&&s.set("role",n.role),n.roleType&&s.set("roleType",n.roleType),n.status&&s.set("status",n.status),n.search&&s.set("search",n.search),n.limit&&s.set("limit",String(n.limit)),n.offset!==void 0&&s.set("offset",String(n.offset)),qe({queryKey:["users",n],queryFn:()=>ue(`/users?${s}`),enabled:e.enabled??!0,...Rm})}const qb=200;async function Gj(n){const e=[];for(let s=0;s<n.length;s+=qb){const i=await ue("/users/names",{method:"POST",body:JSON.stringify({ids:n.slice(s,s+qb)})});e.push(...i.users??[])}return e}let Xd=[],Wd=new Map,Zd=!1;function Vj(){const n=Xd,e=Wd;Xd=[],Wd=new Map,Zd=!1,Gj(n).then(s=>{const i=new Map(s.map(o=>[o.id,o]));for(const[o,c]of e)c.resolve(i.get(o)??null)}).catch(s=>{for(const i of e.values())i.reject(s)})}function Yj(n){return new Promise((e,s)=>{Xd.push(n),Wd.set(n,{resolve:e,reject:s}),Zd||(Zd=!0,setTimeout(Vj,0))})}function U5(n){return qe({queryKey:["user-name",n],queryFn:()=>Yj(n),enabled:!!n,...Rm})}function Kj(n){return qe({queryKey:["users",n,"roles"],queryFn:async()=>(await ue(`/users/${n}/roles`)).roles??[],enabled:!!n,...Rm})}function z5(){const n=Pe();return Ie({mutationFn:e=>ue("/users",{method:"POST",body:JSON.stringify(e)}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function $5(){const n=Pe();return Ie({mutationFn:({id:e,...s})=>ue(`/users/${e}`,{method:"PUT",body:JSON.stringify(s)}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function I5(){const n=Pe();return Ie({mutationFn:({id:e,ops:s})=>ue(`/users/${e}/properties`,{method:"PATCH",body:JSON.stringify(s)}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function H5(){return qe({queryKey:["users","system-property-keys"],queryFn:()=>ue("/users/system-property-keys")})}function F5(){const n=Pe();return Ie({mutationFn:e=>ue(`/users/${e}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function G5(){const n=Pe();return Ie({mutationFn:({userId:e,role:s,type:i,read_scope:o,write_scope:c})=>ue(`/users/${e}/roles`,{method:"POST",body:JSON.stringify({role:s,type:i,read_scope:o,write_scope:c})}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}function V5(){const n=Pe();return Ie({mutationFn:({userId:e,role:s})=>ue(`/users/${e}/roles/${encodeURIComponent(s)}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["users"]})}})}const Y5={MAX_PORTALS:12,MAX_ROWS:4,MAX_COLS:6,MAX_COUNTS:8};function Jj(){return qe({queryKey:["roles"],queryFn:()=>ue("/roles")})}function Ru(n){return qe({queryKey:["roles","details"],queryFn:()=>ue("/roles/details"),enabled:(n==null?void 0:n.enabled)??!0})}function K5(n,e,s=!0){return qe({queryKey:["roles",n,"schema",e??"latest"],queryFn:()=>ue(`/roles/${encodeURIComponent(n)}/schema${e!=null?`?version=${e}`:""}`),enabled:s&&!!n})}function J5(n){return qe({queryKey:["roles",n,"schema-versions"],queryFn:()=>ue(`/roles/${encodeURIComponent(n)}/schema/versions`),enabled:!!n})}function Q5(n,e,s=!0){return qe({queryKey:["roles",n,"list-schema",e??"latest"],queryFn:()=>ue(`/roles/${encodeURIComponent(n)}/list-schema${e!=null?`?version=${e}`:""}`),enabled:s&&!!n})}function X5(n){return qe({queryKey:["roles",n,"list-schema-versions"],queryFn:()=>ue(`/roles/${encodeURIComponent(n)}/list-schema/versions`),enabled:!!n})}function W5(){const n=Pe();return Ie({mutationFn:e=>ue("/roles",{method:"POST",body:JSON.stringify({role:e})}),onSuccess:()=>{n.invalidateQueries({queryKey:["roles"]})}})}function Z5(){const n=Pe();return Ie({mutationFn:({role:e,...s})=>ue(`/roles/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(s)}),onMutate:async({role:e,...s})=>{await n.cancelQueries({queryKey:["roles","details"]});const i=n.getQueryData(["roles","details"]);return i&&n.setQueryData(["roles","details"],{roles:i.roles.map(o=>o.role===e?{...o,...s}:o)}),{previous:i}},onError:(e,s,i)=>{i!=null&&i.previous&&n.setQueryData(["roles","details"],i.previous)},onSuccess:()=>{n.invalidateQueries({queryKey:["roles"]})}})}function eM(){const n=Pe();return Ie({mutationFn:e=>ue(`/roles/${encodeURIComponent(e)}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["roles"]})}})}const mv="lt:station:kiosk-role:";function em(n){return`${mv}${n}`}const tm=new Set;function Qj(){for(const n of tm)n()}function Xj(n){try{return localStorage.getItem(em(n))}catch{return null}}function Wj(n,e){try{e===null?localStorage.removeItem(em(n)):localStorage.setItem(em(n),e)}catch{}Qj()}function Zj(n){tm.add(n);const e=s=>{(s.key===null||s.key.startsWith(mv))&&n()};try{window.addEventListener("storage",e)}catch{}return()=>{tm.delete(n);try{window.removeEventListener("storage",e)}catch{}}}function ek(n){return E.useSyncExternalStore(Zj,()=>n?Xj(n):null)}const wu="/portal";function tk(n){return n===wu||n.startsWith(`${wu}/`)}function Dm(n,e){const s=`${wu}/${encodeURIComponent(n)}`;return e?`${s}/${encodeURIComponent(e)}`:s}function na(n){return Array.isArray(n==null?void 0:n.portals)?n.portals:[]}function nk(n){return na(n).length>0}function tM(n,e){const s=n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"portal",i=new Set(e);if(!i.has(s))return s;let o=2;for(;i.has(`${s}-${o}`);)o+=1;return`${s}-${o}`}function pv(n,e){return e.length>0?Dm(n,e[0].key):`/escalations/available?role=${encodeURIComponent(n)}&status=available`}function Lm(){const{user:n}=qt(),e=(n==null?void 0:n.userId)??null,{data:s}=Kj(e),{data:i}=Ru(),o=ek(e),c=E.useCallback(d=>{e&&Wj(e,d)},[e]);return E.useMemo(()=>{const d={kiosk:!1,role:null,homePath:null,targets:[],selectable:!1,selectRole:c},p=s??[];if(p.length===0||p.some(v=>v.type!=="member"))return d;const g=v=>{var _;return(_=i==null?void 0:i.roles)==null?void 0:_.find(S=>S.role===v)},u=v=>{var _,S;return((S=(_=g(v))==null?void 0:_.properties)==null?void 0:S.kiosk)===!0},m=p.map(v=>v.role).filter(u),b=v=>({kiosk:!0,role:v,homePath:pv(v,na(g(v))),targets:m,selectable:m.length>=2,selectRole:c});if(p.length===1)return m.length===1?b(m[0]):d;if(!dv(p)||m.length===0)return d;const x=o&&m.includes(o)?o:m.length===1?m[0]:null;return x?b(x):{...d,targets:m,selectable:!0}},[s,i,o,c])}const rk="/escalations/available",sk=["/escalations",wu,"/scan","/login"];function ik(n,e=""){if(n===rk){const s=new URLSearchParams(e);if(!s.get("role")&&!s.get("facets"))return!1}return sk.some(s=>n===s||n.startsWith(`${s}/`)||n.startsWith(`${s}?`))}const qm=E.createContext(null),fd="lt_sidebar_collapsed",yv="(max-width: 1023px)";function ak(){try{return window.matchMedia(yv).matches}catch{return!1}}function ok({children:n}){const[e,s]=E.useState(()=>{if(ak())return!0;try{return localStorage.getItem(fd)==="true"}catch{return!1}});E.useEffect(()=>{let o;try{o=window.matchMedia(yv)}catch{return}const c=d=>{if(d.matches)s(!0);else try{s(localStorage.getItem(fd)==="true")}catch{s(!1)}};return o.addEventListener("change",c),()=>o.removeEventListener("change",c)},[]);const i=E.useCallback(()=>{s(o=>{const c=!o;try{localStorage.setItem(fd,String(c))}catch{}return c})},[]);return h.jsx(qm.Provider,{value:{collapsed:e,toggle:i},children:n})}function lk({children:n}){return h.jsx(qm.Provider,{value:{collapsed:!1,toggle:()=>{}},children:n})}function Pm(){const n=E.useContext(qm);if(!n)throw new Error("useSidebar must be used within SidebarProvider");return n}const Pb=380,Bm=E.createContext(null);function ck({children:n}){const[e,s]=E.useState({node:null,width:Pb,open:!1,ownerKey:null}),i=tn(),o=E.useRef(i.pathname),c=E.useCallback((p,g)=>{s({node:p,width:(g==null?void 0:g.width)??Pb,open:!0,ownerKey:(g==null?void 0:g.key)??null})},[]),d=E.useCallback(p=>{s(g=>typeof p=="string"&&g.ownerKey!==p?g:{...g,open:!1})},[]);return E.useEffect(()=>{i.pathname!==o.current&&(o.current=i.pathname,s(p=>p.open||p.node?{...p,node:null,open:!1,ownerKey:null}:p))},[i.pathname]),h.jsx(Bm.Provider,{value:{...e,setPanel:c,closePanel:d},children:n})}function Um(){const n=E.useContext(Bm);if(!n)throw new Error("useShellPanel must be used within ShellPanelProvider");return n}function nM(){return E.useContext(Bm)}function uk({open:n,width:e=380,children:s,className:i=""}){const[o,c]=E.useState(n);return E.useEffect(()=>{n&&c(!0)},[n]),h.jsx("div",{className:`shrink-0 overflow-hidden transition-[width] duration-300 ease-out ${i}`,style:{width:n?e:0,maxWidth:"50%"},onTransitionEnd:d=>{!n&&d.propertyName==="width"&&c(!1)},children:h.jsx("div",{style:{width:e},className:"h-full",children:o?s:null})})}function rM({label:n,children:e}){return h.jsxs("div",{children:[h.jsx("dt",{className:"text-2xs font-medium text-text-secondary uppercase tracking-wide",children:n}),h.jsx("dd",{className:"text-xs text-text-primary mt-0.5",children:e})]})}function sM({views:n,activeId:e,onViewChange:s,onClose:i,headerActions:o,stickyClassName:c,labelInline:d}){const p=n.find(g=>g.id===e)??n[0];return p?h.jsx("div",{className:"h-full bg-surface-hover",children:h.jsxs("div",{className:`flex flex-col ${c??"sticky top-0 z-10 max-h-[calc(100vh-3.5rem)]"}`,children:[h.jsxs("div",{className:`flex items-center justify-between pl-4 pr-3 shrink-0 ${d?"pt-10 pb-2":"pt-3"}`,children:[h.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[h.jsx("div",{className:"flex items-center gap-1 shrink-0",role:"radiogroup","aria-label":"Panel view",children:n.map(g=>{const u=g.icon,m=g.id===p.id;return h.jsx("button",{role:"radio","aria-checked":m,onClick:()=>s(g.id),title:g.label,className:`p-1.5 rounded-md transition-colors ${m?"bg-accent/10 text-accent":"text-accent/60 hover:text-accent hover:bg-surface-hover"}`,children:h.jsx(u,{className:"w-3.5 h-3.5"})},g.id)})}),d&&h.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-text-secondary truncate",children:p.label})]}),h.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[o,i&&h.jsx("button",{onClick:i,title:"Close panel",className:"p-1 rounded text-accent/60 hover:text-accent hover:bg-surface-hover transition-colors",children:h.jsx(en,{className:"w-3.5 h-3.5"})})]})]}),!d&&h.jsx("p",{className:"px-5 pt-2 pb-1 text-2xs font-semibold uppercase tracking-widest text-text-secondary shrink-0",children:p.label}),h.jsx("div",{className:`flex-1 overflow-y-auto px-5 ${d?"pt-4 pb-8":"pb-5 pt-1"}`,children:p.content})]})}):null}function gv(n,e){var s,i,o,c,d;e.facets&&Object.keys(e.facets).length&&n.set("facets",JSON.stringify(e.facets)),(s=e.block)!=null&&s.length&&n.set("block",JSON.stringify(e.block)),(i=e.range)!=null&&i.length&&n.set("range",JSON.stringify(e.range)),(o=e.exists)!=null&&o.length&&n.set("exists",JSON.stringify(e.exists)),(c=e.roles)!=null&&c.length&&n.set("roles",JSON.stringify(e.roles)),(d=e.orderBy)!=null&&d.length&&n.set("orderBy",JSON.stringify(e.orderBy)),e.available!==void 0&&n.set("available",String(e.available)),e.jeopardy===!0&&n.set("jeopardy","1"),e.include&&n.set("include",e.include),e.groupBy&&n.set("groupBy",e.groupBy)}function iM(n,e,s){const i=n??"24h",o=e&&Object.keys(e).length?JSON.stringify(e):null;return qe({queryKey:["stationMetrics",i,o],queryFn:()=>ue(`/escalations/station-metrics?period=${i}${o?`&facets=${encodeURIComponent(o)}`:""}`),staleTime:5e3,enabled:(s==null?void 0:s.enabled)??!0})}function aM(n){const e=n?`?period=${n}`:"";return qe({queryKey:["escalationStats",n],queryFn:()=>ue(`/escalations/stats${e}`)})}function oM(){return qe({queryKey:["escalationTypes"],queryFn:()=>ue("/escalations/types")})}function lM(n=!0){return qe({queryKey:["escalationFacetKeys"],queryFn:()=>ue("/escalations/facet-keys"),enabled:n,staleTime:6e4})}function fk(n){return qe({queryKey:["escalationFacetValues",n],queryFn:()=>ue(`/escalations/facet-values?key=${encodeURIComponent(n)}`),enabled:!!n,staleTime:6e4})}function hk(n){const e=new URLSearchParams;return n.status&&e.set("status",n.status),n.role&&e.set("role",n.role),n.type&&e.set("type",n.type),n.subtype&&e.set("subtype",n.subtype),n.assigned_to&&e.set("assigned_to",n.assigned_to),n.parent_id&&e.set("parent_id",n.parent_id),n.claimed&&e.set("claimed","true"),n.priority&&e.set("priority",String(n.priority)),n.limit&&e.set("limit",String(n.limit)),n.offset!==void 0&&e.set("offset",String(n.offset)),n.sort_by&&e.set("sort_by",n.sort_by),n.order&&e.set("order",n.order),n.search&&e.set("search",n.search),gv(e,n),e}function dk(n){return{queryKey:["escalations",n],queryFn:()=>ue(`/escalations?${hk(n)}`)}}function bv(n){const{enabled:e=!0,staleTime:s,...i}=n;return qe({...dk(i),enabled:e,...s!==void 0?{staleTime:s}:{}})}function xv(n){const{enabled:e=!0,staleTime:s,...i}=n,o=new URLSearchParams;return i.role&&o.set("role",i.role),i.type&&o.set("type",i.type),i.subtype&&o.set("subtype",i.subtype),i.priority&&o.set("priority",String(i.priority)),i.limit&&o.set("limit",String(i.limit)),i.offset!==void 0&&o.set("offset",String(i.offset)),i.sort_by&&o.set("sort_by",i.sort_by),i.order&&o.set("order",i.order),i.search&&o.set("search",i.search),gv(o,i),qe({queryKey:["escalations","available",i],queryFn:()=>ue(`/escalations/available?${o}`),enabled:e,...s!==void 0?{staleTime:s}:{}})}function cM(n){return qe({queryKey:["escalations","by-workflow",n],queryFn:()=>ue(`/escalations/by-workflow/${n}`),enabled:!!n})}function uM(n){return qe({queryKey:["escalations",n],queryFn:()=>ue(`/escalations/${n}`),enabled:!!n})}function fM(n,e){return qe({queryKey:["escalations",n,"lookups"],queryFn:()=>ue(`/escalations/${n}/lookups`),enabled:!!n&&e,staleTime:0,refetchOnWindowFocus:!1})}function hM(){const n=Pe();return Ie({mutationFn:({id:e,durationMinutes:s})=>ue(`/escalations/${e}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:s})}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]})}})}function dM(){const n=Pe();return Ie({mutationFn:e=>ue(`/escalations/${e}/release`,{method:"POST"}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]})}})}function mM(){const n=Pe();return Ie({mutationFn:({id:e,resolverPayload:s})=>ue(`/escalations/${e}/resolve`,{method:"POST",body:JSON.stringify({resolverPayload:s})}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]}),n.resetQueries({queryKey:["tasks"]}),n.resetQueries({queryKey:["jobs"]})}})}const pM={NEEDS_BADGE:"needs_badge",ROLE_REFUSED:"role_refused"};function yM(){const n=Pe();return Ie({mutationFn:({id:e,...s})=>ue(`/escalations/${e}/roster-action`,{method:"POST",body:JSON.stringify(s)}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"]}),n.invalidateQueries({queryKey:["escalationStats"]})}})}function gM(){const n=Pe();return Ie({mutationFn:({id:e,itemKey:s,payload:i})=>ue(`/escalations/${e}/accumulate`,{method:"POST",body:JSON.stringify({itemKey:s,...i?{payload:i}:{}})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"]})}})}function bM(){const n=Pe();return Ie({mutationFn:({id:e,itemKey:s})=>ue(`/escalations/${e}/remove-item`,{method:"POST",body:JSON.stringify({itemKey:s})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"]})}})}function xM(){const n=Pe();return Ie({mutationFn:({id:e,targetRole:s})=>ue(`/escalations/${e}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:s})}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]})}})}function vM(){const n=Pe();return Ie({mutationFn:({ids:e,priority:s})=>ue("/escalations/priority",{method:"PATCH",body:JSON.stringify({ids:e,priority:s})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function _M(){const n=Pe();return Ie({mutationFn:({ids:e,durationMinutes:s})=>ue("/escalations/bulk-claim",{method:"POST",body:JSON.stringify({ids:e,durationMinutes:s})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function wM(){const n=Pe();return Ie({mutationFn:({ids:e,targetUserId:s,durationMinutes:i,reassign:o})=>ue("/escalations/bulk-assign",{method:"POST",body:JSON.stringify({ids:e,targetUserId:s,durationMinutes:i,...o?{reassign:!0}:{}})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function SM(){const n=Pe();return Ie({mutationFn:({ids:e})=>ue("/escalations/bulk-unassign",{method:"POST",body:JSON.stringify({ids:e})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function EM(){const n=Pe();return Ie({mutationFn:({ids:e,hint:s})=>ue("/escalations/bulk-triage",{method:"POST",body:JSON.stringify({ids:e,...s?{hint:s}:{}})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function OM(){const n=Pe();return Ie({mutationFn:e=>ue(`/escalations/${e}/cancel`,{method:"POST"}),onSuccess:()=>{n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]})}})}function AM(){const n=Pe();return Ie({mutationFn:({ids:e})=>ue("/escalations/bulk-cancel",{method:"POST",body:JSON.stringify({ids:e})}),onSuccess:()=>{n.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),n.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function zm(n){const e=[],s=n.type.split(".");switch(s[0]==="system"?s[1]:s[0]){case"task":e.push(["tasks"]),e.push(["jobs"]),e.push(["processes"]),n.workflowId&&(e.push(["workflowExecution",n.workflowId]),e.push(["workflowState",n.workflowId]),e.push(["mcpQueryExecution",n.workflowId])),n.originId&&e.push(["processes",n.originId]);break;case"escalation":e.push(["escalations"]),e.push(["escalationStats"]),e.push(["stationMetrics"]),n.workflowId&&e.push(["workflowExecution",n.workflowId]);break;case"workflow":e.push(["jobs"]),e.push(["tasks"]),e.push(["processes"]),n.workflowId&&(e.push(["workflowExecution",n.workflowId]),e.push(["workflowState",n.workflowId]),e.push(["mcpQueryExecution",n.workflowId]),e.push(["mcpQueryResult",n.workflowId]),e.push(["builderResult",n.workflowId]));break;case"activity":n.workflowId&&e.push(["mcpRunExecution",n.workflowId]),e.push(["mcpRuns"]);break;case"milestone":n.workflowId&&(e.push(["workflowExecution",n.workflowId]),e.push(["mcpQueryExecution",n.workflowId])),e.push(["tasks"]);break;case"knowledge":e.push(["knowledge"]);break;case"file":e.push(["files"]);break;case"agent":e.push(["agents"]);break;default:e.push(["jobs"]),e.push(["tasks"]);break}return e}const mk={DETAIL:{coalesceMs:300,minIntervalMs:2e3},LIST:{coalesceMs:500,minIntervalMs:3e3},SUMMARY:{coalesceMs:1e3,minIntervalMs:1e4}},jM=300,Bb={DETAIL:0,LIST:1,SUMMARY:2};function pk(n){const e=new Map,s={},i={};let o=!1;const c=()=>typeof document<"u"&&document.visibilityState==="hidden";function d(m){delete s[m],i[m]=Date.now();const b=[];for(const[v,_]of e)_===m&&b.push(v);for(const v of b)e.delete(v);if(b.length===0)return;const x=c();x&&(o=!0);for(const v of b)n.invalidateQueries({queryKey:JSON.parse(v),...x?{refetchType:"none"}:{}})}function p(m){if(s[m])return;const{coalesceMs:b,minIntervalMs:x}=mk[m],v=i[m],_=v===void 0?0:v+x-Date.now(),S=Math.max(b,_);s[m]=setTimeout(()=>d(m),S)}function g(m,b){for(const x of b){const v=JSON.stringify(x),_=e.get(v);(_===void 0||Bb[m]<Bb[_])&&e.set(v,m)}p(m)}const u=()=>{typeof document>"u"||document.visibilityState==="visible"&&o&&(o=!1,n.refetchQueries({type:"active",stale:!0}))};return typeof document<"u"&&document.addEventListener("visibilitychange",u),{request:g,dispose(){for(const m of Object.keys(s)){const b=s[m];b&&clearTimeout(b),delete s[m]}e.clear(),typeof document<"u"&&document.removeEventListener("visibilitychange",u)}}}const Ub=new WeakMap;function yk(n){let e=Ub.get(n);return e||(e=pk(n),Ub.set(n,e)),e}function nn(n){const e=Pe();return E.useCallback(s=>{yk(e).request(n,s)},[e,n])}function $m(n){return n?[`${Wt}.system.workflow.>`,`${Wt}.system.activity.>`,`${Wt}.system.milestone.>`,`${Wt}.system.task.>`,`${Wt}.system.escalation.>`]:[]}function kM(){const n=nn("LIST");An(`${Wt}.system.task.>`,()=>{n([["jobs"]])}),An(`${Wt}.system.workflow.>`,()=>{n([["jobs"]])})}function NM(n){const e=nn("DETAIL");Ns($m(n),s=>{var p;if(!n||!(s.workflowId===n||((p=s.workflowId)==null?void 0:p.includes(n))))return;const o=s.type.split("."),c=o[0]==="system"?o[1]:o[0],d=zm(s);c==="escalation"&&d.push(["escalations","by-workflow",n]),e(d)})}function TM(n){const e=nn("DETAIL");Ns($m(n),s=>{var p;if(!n||!(s.workflowId===n||((p=s.workflowId)==null?void 0:p.includes(n))))return;const o=s.type.split("."),c=o[0]==="system"?o[1]:o[0],d=zm(s);c==="escalation"&&d.push(["escalations","by-workflow",n]),e(d)})}function CM(n){const e=nn("DETAIL");Ns($m(n),s=>{var c;if(!n||!(s.workflowId===n||((c=s.workflowId)==null?void 0:c.includes(n))))return;const o=zm(s);o.push(["workflowSets"]),o.push(["yamlWorkflows"]),e(o)})}function MM(n){const e=nn("DETAIL"),s=E.useCallback(i=>{n&&(i.originId!==n&&i.workflowId!==n||e([["processes",n]]))},[n,e]);An(`${Wt}.system.task.>`,s),An(`${Wt}.system.workflow.>`,s),An(`${Wt}.system.escalation.>`,s)}function RM(){const n=nn("SUMMARY");An(fr({}),()=>{n([["escalationStats"]])})}function DM(){const n=nn("SUMMARY");An(fr({}),()=>{n([["stationMetrics"]])})}function LM(){const n=nn("SUMMARY");An(fr({}),()=>{n([["escAggregate"],["escTimeline"]])})}function qM(n){const e=nn("LIST"),s=(n==null?void 0:n.role)??null,i=((n==null?void 0:n.verbs)??[]).join(","),o=E.useMemo(()=>{const c=i?i.split(","):null;return c?Jd({role:s,verbs:c}):[fr({role:s})]},[s,i]);Ns(o,()=>{e([["escalations"]])})}const gk=[["escalations","related"],["escalations","related-rows"]];function PM(n){const e=nn("LIST"),s=[...new Set(n)].sort().join(","),i=E.useMemo(()=>s?s.split(",").map(o=>fr({role:o})):[],[s]);Ns(i,()=>{e(gk)})}function BM(n){const e=nn("DETAIL");An(fr(n?{id:n}:{id:"__none__"}),s=>{!n||s.escalationId!==n||e([["escalations",n]])})}function UM(){const n=nn("LIST");An(`${Wt}.system.agent.>`,()=>{n([["agents"]])})}function zM(){const n=nn("LIST");An(`${Wt}.system.task.>`,()=>{n([["processes"]])}),An(`${Wt}.system.workflow.>`,()=>{n([["processes"]])})}function bk(){const{user:n}=qt(),e=n==null?void 0:n.userId,s=nn("SUMMARY");Ns(Cm(),()=>{s([["escalations"]])});const{data:i}=xv({limit:1}),{data:o}=bv({assigned_to:e,status:"pending",limit:1});return{available:(i==null?void 0:i.total)??0,mine:(o==null?void 0:o.total)??0}}function Du({size:n="sm",hideLabel:e=!1,className:s="",appName:i="LongTail",variant:o="full"}){const c=n==="lg";if(o==="comet")return h.jsx("div",{className:`relative overflow-visible ${s}`,style:{width:"2.5rem",height:"2.5rem",flexShrink:0},children:h.jsx("span",{role:"img","aria-label":i,className:"logo-mark absolute pointer-events-none select-none",style:{"--logo-url":`url(${Yt}/logo512.png)`,width:"82px",height:"82px",top:"-12px",left:"-80px",transform:"rotate(232deg)",zIndex:-1,opacity:.55}})});if(o==="mark")return h.jsx("div",{className:`flex items-center ${s}`,children:h.jsx("span",{role:"img","aria-label":i,className:"logo-mark shrink-0 w-7 h-7",style:{"--logo-url":`url(${Yt}/logo512.png)`}})});const d=c?"w-[16rem] h-[16rem] -rotate-[120deg] opacity-55 -ml-10":"w-[12.5rem] h-[12.5rem] -rotate-[120deg] opacity-55 -ml-8",p=c?"text-[44px] font-normal text-text-primary tracking-[0.15em] -ml-[12.5rem]":"text-[36px] font-normal text-text-primary tracking-[0.15em] -ml-[9.75rem]";return h.jsxs("div",{className:`flex items-center ${s}`,style:{height:"50px"},children:[h.jsx("span",{role:"img","aria-label":i,className:`logo-mark shrink-0 z-0 ${d}`,style:{"--logo-url":`url(${Yt}/logo512.png)`}}),h.jsx("span",{className:`z-[1] transition-opacity duration-300 ${p} ${e?"opacity-0":""}`,children:i})]})}const xk="system.surfaces.dashboard",vk=`${Wt}.${xk}`;function vv(n=!0){return qe({queryKey:["announcements"],queryFn:()=>ue("/announcements"),enabled:n,staleTime:3e4})}function _k(){const n=Pe();return Ie({mutationFn:e=>ue("/announcements",{method:"POST",body:JSON.stringify(e)}),onSuccess:()=>{n.invalidateQueries({queryKey:["announcements"]})}})}function wk(){const n=Pe();return Ie({mutationFn:e=>ue(`/announcements/${encodeURIComponent(e)}`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["announcements"]})}})}function $M(n){return n.toLocaleString()}function IM(n){return n>=1e9?`${(n/1e9).toFixed(1).replace(/\.0$/,"")}B`:n>=1e6?`${(n/1e6).toFixed(1).replace(/\.0$/,"")}M`:n>=1e4?`${(n/1e3).toFixed(1).replace(/\.0$/,"")}K`:n.toLocaleString()}function Sk(n){const e=new Date(n);return e.getTime()>Date.now()?"just now":$j(e,{addSuffix:!0})}function HM(n){const e=Date.now()-new Date(n).getTime();if(e<0)return"now";const s=Math.floor(e/1e3);if(s<60)return`${s}s`;const i=Math.floor(s/60);if(i<60)return`${i}m`;const o=Math.floor(i/60);if(o<24)return`${o}h`;const c=Math.floor(o/24);return c<7?`${c}d`:c<30?`${Math.floor(c/7)}w`:c<365?`${Math.floor(c/30)}mo`:`${Math.floor(c/365)}y`}function FM(n){return n<=0?"Expired":Im(n)}function Ek(n){return n==null?"--":Im(n)}function GM(n){return n?Mm(n):"--"}function Im(n){if(n<1e3)return`${Math.round(n)}ms`;if(n<6e4){const d=n/1e3;return Number.isInteger(d)?`${d}s`:`${d.toFixed(1)}s`}const e=Math.floor(n/1e3),s=Math.floor(e/86400),i=Math.floor(e%86400/3600),o=Math.floor(e%3600/60),c=e%60;return s>0?i>0?`${s}d ${i}h`:`${s}d`:i>0?o>0?`${i}h ${o}m`:`${i}h`:c>0?`${o}m ${c}s`:`${o}m`}function VM(n,e){const s=new Date(n).getTime(),i=e?new Date(e).getTime():Date.now();return Im(i-s)}function _v({options:n,children:e,className:s=""}){const[i,o]=E.useState(!1),[c,d]=E.useState(null),[p,g]=E.useState(null),u=E.useRef(null),m=E.useRef(void 0),b=E.useRef(void 0),x=220,v=E.useCallback(()=>{if(!u.current)return;const B=u.current.getBoundingClientRect(),q=window.innerWidth-x-8,ne=Math.max(8,Math.min(B.left,q));g({top:B.bottom+4,left:ne})},[]),_=E.useCallback(async(B,q)=>{try{await navigator.clipboard.writeText(B),d(q),clearTimeout(m.current),m.current=setTimeout(()=>d(null),1200)}catch{}},[]),S=E.useCallback(()=>{clearTimeout(b.current),v(),o(!0)},[v]),C=E.useCallback(()=>{b.current=setTimeout(()=>o(!1),150)},[]);return E.useEffect(()=>()=>{clearTimeout(m.current),clearTimeout(b.current)},[]),h.jsxs("span",{ref:u,className:`inline-flex items-center cursor-default ${s}`,onMouseEnter:S,onMouseLeave:C,children:[e,i&&p&&lm.createPortal(h.jsx("span",{className:"fixed z-[9999] bg-surface-raised border border-surface-border rounded shadow-lg py-1 min-w-[180px]",style:{top:p.top,left:p.left},onMouseEnter:S,onMouseLeave:C,children:n.map(B=>h.jsxs("button",{onClick:q=>{q.stopPropagation(),_(B.value,B.label)},className:"flex items-center justify-between w-full px-2.5 py-1 text-left hover:bg-surface-hover transition-colors",children:[h.jsx("span",{className:"text-2xs font-medium uppercase tracking-wider text-text-tertiary w-10 shrink-0",children:B.label}),h.jsx("span",{className:"text-2xs font-mono text-text-secondary truncate ml-2",children:c===B.label?"✓":B.value})]},B.label))}),document.body)]})}function Ok(n,e){const s=new Date(n);switch(e){case"relative":return Sk(n);case"datetime":return Mm(s);case"time":return s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",timeZone:Hj()??void 0})}}function Ak(n){const e=new Date(n);return[{label:"ms",value:String(e.getTime())},{label:"utc",value:e.toISOString()},{label:"local",value:Mm(e,!0)}]}function wv({date:n,format:e="relative",className:s=""}){const[,i]=E.useState(0);E.useEffect(()=>{if(e!=="relative")return;const c=setInterval(()=>i(d=>d+1),3e4);return()=>clearInterval(c)},[e]);const o=E.useMemo(()=>Ak(n),[n]);return h.jsx(_v,{options:o,children:h.jsx("time",{dateTime:n,className:`text-xs text-text-tertiary ${s}`,children:Ok(n,e)})})}function jk({values:n,options:e,onChange:s,addLabel:i,emptyText:o,ariaLabel:c}){const d=e.filter(p=>!n.includes(p));return h.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n.map(p=>h.jsxs("button",{type:"button",onClick:()=>s(n.filter(g=>g!==p)),className:"inline-flex items-center gap-1 text-2xs font-mono text-text-primary border border-surface-border px-1.5 py-0.5 hover:text-status-error hover:border-status-error/50 transition-colors",title:`Remove ${p}`,children:[p,h.jsx(en,{className:"w-3 h-3",strokeWidth:1.5})]},p)),n.length===0&&o&&h.jsx("span",{className:"text-2xs text-text-tertiary italic",children:o}),d.length>0&&h.jsxs("select",{value:"",onChange:p=>p.target.value&&s([...n,p.target.value]),className:"select font-mono","aria-label":c??i,children:[h.jsx("option",{value:"",children:i}),d.map(p=>h.jsx("option",{value:p,children:p},p))]})]})}const kk=[{minutes:1,label:"1 minute"},{minutes:15,label:"15 minutes"},{minutes:30,label:"30 minutes"},{minutes:60,label:"1 hour"},{minutes:240,label:"4 hours"},{minutes:1440,label:"24 hours"},{minutes:4320,label:"3 days"},{minutes:10080,label:"7 days"}];function Nk(){const{data:n}=vv(),{data:e}=Jj(),s=_k(),i=wk(),[o,c]=E.useState(""),[d,p]=E.useState(""),[g,u]=E.useState(1440),[m,b]=E.useState([]),x=(n==null?void 0:n.announcements)??[],v=()=>{d.trim()&&s.mutate({body:d.trim(),...o.trim()?{title:o.trim()}:{},...m.length?{roles:m}:{},expiresAt:new Date(Date.now()+g*6e4).toISOString()},{onSuccess:()=>{c(""),p(""),b([])}})};return h.jsxs("div",{children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"Alerts"}),h.jsxs("div",{className:"space-y-3",children:[h.jsxs("label",{className:"block",children:[h.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Title"}),h.jsx("input",{type:"text",value:o,onChange:_=>c(_.target.value),placeholder:"Optional headline",className:"input text-xs w-full"})]}),h.jsxs("label",{className:"block",children:[h.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Summary"}),h.jsx("textarea",{value:d,onChange:_=>p(_.target.value),placeholder:"What everyone should know (markdown supported)",rows:3,className:"input text-xs w-full resize-y"})]}),h.jsxs("label",{className:"block",children:[h.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Visible for"}),h.jsx("select",{value:g,onChange:_=>u(Number(_.target.value)),className:"select text-xs w-full",children:kk.map(_=>h.jsx("option",{value:_.minutes,children:_.label},_.minutes))})]}),h.jsxs("div",{className:"block",children:[h.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Visible to"}),h.jsx(jk,{values:m,options:(e==null?void 0:e.roles)??[],onChange:b,addLabel:"Add a role…",emptyText:"Everyone",ariaLabel:"Add a role"})]}),s.error&&h.jsx("p",{className:"text-xs text-status-error",children:s.error.message}),h.jsx("button",{onClick:v,disabled:!d.trim()||s.isPending,className:"btn-primary text-xs w-full disabled:opacity-50",children:s.isPending?"Publishing…":"Publish alert"})]}),x.length>0&&h.jsxs("div",{className:"mt-6",children:[h.jsx("p",{className:"text-2xs text-text-tertiary mb-2",children:"Active now — stacked as banner rows, newest first"}),h.jsx("div",{className:"space-y-1",children:x.map(_=>h.jsxs("div",{className:"flex items-start gap-2 py-1.5 border-b border-surface-border/40 last:border-b-0",children:[h.jsxs("span",{className:"min-w-0 flex-1",children:[h.jsx("span",{className:"block text-xs text-text-primary truncate",children:_.title??_.body.split(`
54
+ `)[0]}),h.jsxs("span",{className:"block text-2xs text-text-tertiary",children:["expires ",h.jsx(wv,{date:_.expires_at,format:"relative"})]})]}),h.jsx("button",{onClick:()=>i.mutate(_.id),disabled:i.isPending,className:"icon-link shrink-0 mt-0.5",title:"Remove for everyone","aria-label":`Remove ${_.title??"announcement"}`,children:h.jsx(en,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]},_.id))})]})]})}const Tk=[{id:null,label:"Your view",description:"Full access based on your account role",minTier:"operator"},{id:"admin",label:"Admin",description:"Pace Board + identity management",minTier:"superadmin"},{id:"engineer",label:"Engineer",description:"Work queue + identity management",minTier:"admin"},{id:"operator",label:"Operator",description:"Escalation queue only",minTier:"engineer"}],Ck=["operator","engineer","admin","superadmin"];function zb(n){return Ck.indexOf(n)}function Mk(n,e){return zb(n)>=zb(e)}function Rk({onClose:n}){var Ne,Me,Xe,pt,Ot,mt,_e;const{isSuperAdmin:e,hasRoleType:s,hasRole:i}=qt(),{data:o}=Hn(),c=Nm(),d=!!((Ne=o==null?void 0:o.ai)!=null&&Ne.enabled),p=ev(),g=p!==null?p:d,[u,m]=E.useState(g),b=(Me=o==null?void 0:o.features)==null?void 0:Me.graphWorkflows,x=b==null,[v,_]=E.useState(b===!0||x&&tv()),S=e||i("engineer"),[C,B]=E.useState(nv()),q=!!((Xe=o==null?void 0:o.features)!=null&&Xe.scanCodes),ne=rv(),[te,M]=E.useState(ne!==null?ne:q),z=e?"superadmin":s("admin")?"admin":i("engineer")?"engineer":"operator",ae=((pt=o==null?void 0:o.branding)==null?void 0:pt.appName)??"LongTail",F=(Ot=o==null?void 0:o.environment)==null?void 0:Ot.longTailVersion,U=(mt=o==null?void 0:o.environment)==null?void 0:mt.hotmeshVersion,D=(_e=o==null?void 0:o.environment)==null?void 0:_e.nodeEnv;E.useEffect(()=>{const oe=Be=>{Be.key==="Escape"&&n()};return document.addEventListener("keydown",oe),()=>document.removeEventListener("keydown",oe)},[n]);const Q=Tk.filter(oe=>Mk(z,oe.minTier)),W=Q.length>1,he=z!=="operator",Ee=[...W?[{id:"viewas",label:"View As",icon:ES}]:[],{id:"features",label:"Features",icon:OS},...he?[{id:"alerts",label:"Alerts",icon:AS}]:[]],[Ae,H]=E.useState(Ee[0].id),J=oe=>{oe===null?Kd():wA(oe)},ce=()=>{const oe=!u;m(oe),oe===d?_A():vA(oe),window.location.reload()},pe=()=>{const oe=!v;_(oe),SA(oe),window.location.reload()},ge=()=>{const oe=!C;B(oe),EA(oe),window.location.reload()},Ce=()=>{const oe=!te;M(oe),oe===q?AA():OA(oe),window.location.reload()};return h.jsx("div",{className:"fixed inset-0 z-[100] bg-surface-sunken/75 backdrop-blur-sm flex items-center justify-center",onClick:n,children:h.jsxs("div",{className:"relative w-[440px] max-h-[85vh] overflow-y-auto bg-surface-raised px-12 py-10",onClick:oe=>oe.stopPropagation(),children:[h.jsx("button",{onClick:n,className:"absolute top-4 right-4 text-text-quaternary hover:text-text-secondary transition-colors p-1","aria-label":"Close",children:h.jsx(en,{className:"w-4 h-4",strokeWidth:1.5})}),h.jsxs("div",{className:"flex flex-col items-center gap-3 pb-8",children:[h.jsx("span",{className:"logo-mark block w-20 h-20 opacity-50",style:{"--logo-url":`url(${Yt}/logo512.png)`}}),h.jsxs("div",{className:"text-center",children:[h.jsx("p",{className:"text-2xl font-light text-text-primary tracking-[0.12em]",children:ae}),F&&h.jsxs("p",{className:"mt-1 text-2xs text-text-tertiary",children:["v",F,U&&h.jsxs(h.Fragment,{children:[" · HotMesh v",U]}),D&&D!=="production"&&h.jsx("span",{className:"ml-1 text-status-warning",children:D})]})]})]}),h.jsx("hr",{className:"border-surface-border/50 mb-6"}),Ee.length>1&&h.jsx("div",{className:"flex items-center justify-center gap-2 mb-8",role:"tablist",children:Ee.map(oe=>{const Be=Ae===oe.id;return h.jsxs("button",{role:"tab","aria-selected":Be,onClick:()=>H(oe.id),title:oe.label,className:`flex flex-col items-center gap-1.5 px-5 py-2.5 rounded-lg transition-colors ${Be?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-secondary hover:bg-surface-hover"}`,children:[h.jsx(oe.icon,{className:"w-5 h-5",strokeWidth:1.5,...Be?{fill:"currentColor",fillOpacity:.15}:{}}),h.jsx("span",{className:"text-2xs font-medium",children:oe.label})]},oe.id)})}),Ae==="viewas"&&W&&h.jsxs("div",{className:"space-y-1",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"View As"}),Q.map(oe=>{const Be=c===oe.id,zt=oe.id===null?`Your view · ${z}`:oe.label;return h.jsxs("button",{onClick:()=>J(oe.id),className:"w-full text-left flex items-start gap-3 py-2.5 px-1 group",children:[h.jsx("span",{className:`mt-0.5 w-4 h-4 rounded-full border shrink-0 flex items-center justify-center transition-colors ${Be?"border-accent bg-accent":"border-surface-border group-hover:border-accent/60"}`,children:Be&&h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-text-inverse"})}),h.jsxs("span",{children:[h.jsx("span",{className:`block text-sm font-medium transition-colors ${Be?"text-accent":"text-text-primary group-hover:text-accent"}`,children:zt}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:oe.description})]})]},String(oe.id))})]}),Ae==="features"&&h.jsxs("div",{children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"Features"}),h.jsxs("button",{onClick:ce,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[h.jsxs("span",{children:[h.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"AI features"}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:u?"Enabled — AI assist, agent labels, bulk AI actions":"Hidden — automation labels, no AI surfaces"})]}),h.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${u?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${u?"translate-x-4":"translate-x-0"}`})})]}),x&&h.jsxs("button",{onClick:pe,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[h.jsxs("span",{children:[h.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"Graph workflows"}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:v?"Visible — Graph section shown in Orchestrate sidebar":"Hidden — use Procedural workflows instead"})]}),h.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${v?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${v?"translate-x-4":"translate-x-0"}`})})]}),S&&h.jsxs("button",{onClick:ge,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group","data-testid":"feature-infrastructure",children:[h.jsxs("span",{children:[h.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"Infrastructure"}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:C?"Visible — Routers, Messages, and DB Maintenance in the sidebar":"Hidden — routers, message streams, and database maintenance"})]}),h.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${C?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${C?"translate-x-4":"translate-x-0"}`})})]}),h.jsxs("button",{onClick:Ce,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[h.jsxs("span",{children:[h.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"Scan input"}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:te?"Enabled — header scan affordance, panel, and keyboard-wedge capture":"Hidden — the deployment opts in with features.scanCodes"})]}),h.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${te?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${te?"translate-x-4":"translate-x-0"}`})})]})]}),Ae==="alerts"&&he&&h.jsx(Nk,{}),h.jsx("hr",{className:"border-surface-border/50 mt-8"}),h.jsx("p",{className:"mt-4 text-2xs text-text-quaternary text-center",children:"Esc or click outside to close"})]})})}const Sv=[{id:"violet",label:"Violet",swatch:"#7B3BE0"},{id:"red",label:"Brick",swatch:"#DC382D"},{id:"green",label:"Emerald",swatch:"#059669"},{id:"blue",label:"Electric",swatch:"#2563EB"},{id:"rose",label:"Raspberry",swatch:"#D6246E"},{id:"orange",label:"Harvest",swatch:"#E85D04"}],$b="blue",Ev="lt.theme";let Ov=[];function Dk(n){const e=new Set(Sv.map(i=>i.id)),s=new Set;Ov=n.filter(i=>!(i!=null&&i.id)||e.has(i.id)||s.has(i.id)?!1:(s.add(i.id),!0))}function Lk(){return[...Sv,...Ov]}function Av(){try{return localStorage.getItem(Ev)||$b}catch{return $b}}function jv(n){document.documentElement.dataset.theme=n}function qk(n){try{localStorage.setItem(Ev,n)}catch{}jv(n)}const Pk=[8,12,13,14];function kv(n){if(!/^[0-9]+$/.test(n)||!Pk.includes(n.length))return!1;const e=n.split("").map(Number),s=e.pop();let i=0;for(let o=e.length-1,c=3;o>=0;o--,c=c===3?1:3)i+=e[o]*c;return(10-i%10)%10===s}function Bk(n){return n.padStart(14,"0")}const Uk="0",zk="0",nm=64;function YM(n,e){const s=n.trim();if(!s)return{ok:!1,failure:{reason:"empty",detail:"empty scan code"}};const i=$k(s,e);return i.ok?i:Nv(s,e,!1)??i}function $k(n,e){if(/^[0-9]+$/.test(n)){const c=e.find(p=>p.encoding==="fixed"&&p.version===Number(n.slice(0,2)));if(!((c==null?void 0:c.enabled)&&Ik(n,c))){const p=Nv(n,e,!0);if(p)return p;const g=Hk(n,e);if(g)return g}}const s=n.slice(0,2),i=Number(s);if(!/^[0-9]{2}$/.test(s)||i<10||i>99)return{ok:!1,failure:{reason:"unknown_version",detail:`code must start with a two-digit scheme 10-99, got "${s}"`}};const o=e.find(c=>c.version===i);return o?o.enabled?o.encoding==="gtin"?vs(o,"reads manufacturer barcodes, which carry no scheme prefix"):o.encoding==="pattern"?vs(o,"reads codes by its declared patterns, which carry no scheme prefix"):o.encoding==="delimited"?Gk(n,i,o):Vk(n,i,o):{ok:!1,failure:{reason:"scheme_disabled",detail:`scan scheme ${i} ("${o.name}") is disabled`}}:{ok:!1,failure:{reason:"unknown_version",detail:`no scan scheme configured for version ${i}`}}}function Ik(n,e){const s=3+(e.target_length??0);return n.length===s||n.length===s+1}function Hk(n,e){if(!kv(n))return null;const s=e.find(i=>i.encoding==="gtin"&&i.enabled)??e.find(i=>i.encoding==="gtin");return s?s.enabled?{ok:!0,parsed:{version:s.version,category:Uk,target:Bk(n),raw:n},scheme:s}:{ok:!1,failure:{reason:"scheme_disabled",detail:`scan scheme ${s.version} ("${s.name}") is disabled`}}:null}function Nv(n,e,s){const i=e.filter(c=>c.encoding==="pattern"&&(!s||c.precedes_gtin)).filter(c=>Tv(c.patterns??[],n)).sort((c,d)=>c.version-d.version),o=i.find(c=>c.enabled)??i[0];return o?o.enabled?{ok:!0,parsed:{version:o.version,category:zk,target:n},scheme:o}:{ok:!1,failure:{reason:"scheme_disabled",detail:`scan scheme ${o.version} ("${o.name}") is disabled`}}:null}function Tv(n,e){return e.length>nm?!1:n.some(s=>{var i;return(i=Fk(s))==null?void 0:i.test(e)})}const hd=new Map;function Fk(n){if(hd.has(n))return hd.get(n);let e;try{e=new RegExp(`^(?:${Cv(n)})$`)}catch{e=null}return hd.set(n,e),e}function Cv(n){let e=n.startsWith("^")?n.slice(1):n;return e.endsWith("$")&&!e.endsWith("\\$")&&(e=e.slice(0,-1)),e}function Gk(n,e,s){const i=s.delimiter;if(n[2]!==i)return vs(s,`expected "${i}" after the two-digit scheme`);const o=n.slice(3,4);if(!/^[0-9]$/.test(o))return vs(s,"category must be a single digit");if(n[4]!==i)return vs(s,`expected "${i}" after the category`);const c=n.slice(5);return c?{ok:!0,parsed:{version:e,category:o,target:c},scheme:s}:vs(s,"target is empty")}function Vk(n,e,s){const i=s.target_length??0,o=3+i;if(!/^[0-9]+$/.test(n))return vs(s,"fixed encoding accepts digits only");if(n.length!==o&&n.length!==o+1)return vs(s,`expected ${o} digits (or ${o+1} with check digit), got ${n.length}`);const c=n.slice(2,3),d=n.slice(3,3+i);return{ok:!0,parsed:{version:e,category:c,target:d},scheme:s}}function vs(n,e){return{ok:!1,failure:{reason:"malformed",detail:`scheme ${n.version} ("${n.name}"): ${e}`}}}const uu={maxKeyGapMs:500,terminators:["Enter","Tab"],minLength:6,autoFireQuietMs:300,autoFireMaxAvgKeyMs:50},Mv="lt_scan_wedge_config";function Rv(){try{const n=localStorage.getItem(Mv);return n?{...uu,...JSON.parse(n)}:uu}catch{return uu}}function Yk(n){const e={...Rv(),...n};return localStorage.setItem(Mv,JSON.stringify(e)),e}const Hm=[{pattern:/(?:^|[^0-9])([1-9][0-9]:[0-9]:[a-zA-Z0-9._-]+)$/,scannerPaced:!1},{pattern:/(?:^|[^0-9])([1-9][0-9]{7,})$/,scannerPaced:!0}];function Kk(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Jk(n){try{return new RegExp(`(?:^|[^A-Za-z0-9])((?:${Cv(n)}))$`)}catch{return null}}function Qk(n){const e=[];for(const s of n.filter(i=>i.enabled))if(s.encoding==="delimited"){const i=Kk(s.delimiter);e.push({pattern:new RegExp(`(?:^|[^0-9])(${s.version}${i}[0-9]${i}[a-zA-Z0-9._-]+)$`),scannerPaced:!1})}else if(s.encoding==="fixed"){const i=1+(s.target_length??0);e.push({pattern:new RegExp(`(?:^|[^0-9])(${s.version}[0-9]{${i},${i+1}})$`),scannerPaced:!0})}else if(s.encoding==="gtin")e.push({pattern:/(?:^|[^0-9])([0-9]{8}|[0-9]{12,14})$/,scannerPaced:!0,accept:kv});else if(s.encoding==="pattern")for(const i of s.patterns??[]){const o=Jk(i);o&&e.push({pattern:o,scannerPaced:!0,maxTail:nm+1,accept:c=>c.length<=nm})}return e.length?e:Hm}function Xk(n,e=Hm){var i;let s=null;for(const o of e){const d=(i=(o.maxTail?n.slice(-o.maxTail):n).match(o.pattern))==null?void 0:i[1];!d||o.accept&&!o.accept(d)||(!s||d.length>s.code.length)&&(s={code:d,shape:o})}return s}const Wk=new Set(["Shift","CapsLock"]),dc={suppress:!1,emit:null};function Zk(n=uu,e=Hm){let s={buffer:"",times:[],lastKeyMs:0};function i(u){const m=s.times.slice(-u.length);return m.length<2?!1:(m[m.length-1]-m[0])/(m.length-1)<=n.autoFireMaxAvgKeyMs}function o(){const u=Xk(s.buffer,e);return!u||u.code.length<n.minLength||u.shape.scannerPaced&&!i(u.code)?null:u.code}function c(){s={buffer:"",times:[],lastKeyMs:0}}function d(u){const{key:m,timeMs:b,hasModifier:x,isRepeat:v}=u;if(Wk.has(m))return dc;if(n.terminators.includes(m)){const q=o();return c(),q?{suppress:!0,emit:q,consumedLength:q.length}:dc}if(x||v||m.length!==1)return c(),dc;const _=b-s.lastKeyMs,S=s.lastKeyMs>0&&_<=n.maxKeyGapMs,C=(S?s.buffer+m:m).slice(-128),B=(S?[...s.times,b]:[b]).slice(-128);return s={buffer:C,times:B,lastKeyMs:b},dc}function p(){return{buffer:s.buffer}}function g(){const u=o();return!u||!i(u)?null:{code:u,consumedLength:u.length}}return{step:d,reset:c,snapshot:p,pendingAutoFire:g}}function eN(){const n=document.activeElement;return n instanceof HTMLInputElement?["text","search","tel","url","email","password","number"].includes(n.type)?n:null:n instanceof HTMLTextAreaElement?n:null}function tN(n,e,s){var c;const i=n instanceof HTMLInputElement?HTMLInputElement.prototype:HTMLTextAreaElement.prototype,o=(c=Object.getOwnPropertyDescriptor(i,"value"))==null?void 0:c.set;o?o.call(n,e):n.value=e;try{n.setSelectionRange(s,s)}catch{}n.dispatchEvent(new Event("input",{bubbles:!0}))}function Ib(n){if(n<=0)return;const e=eN();if(!e)return;const s=e.selectionStart??e.value.length,i=Math.max(0,s-n);tN(e,e.value.slice(0,i)+e.value.slice(s),i)}const ra={KEYBOARD_WEDGE:"keyboard-wedge",MANUAL:"manual",TOOLBAR:"toolbar",FOLLOW:"follow"},nN="data-lt-scan-capture",rN="off";function sN(n){return n instanceof Element&&!!n.closest(`[${nN}="${rN}"]`)}function iN({active:n,wedgeConfig:e,tailShapes:s,diagnosticsOn:i,onScan:o,onDiag:c}){const d=E.useRef({diagnosticsOn:i,onScan:o,onDiag:c});d.current={diagnosticsOn:i,onScan:o,onDiag:c};const p=E.useRef(0),g=E.useRef(0);E.useEffect(()=>{if(!n)return;const u=Zk(e,s);let m=null;const b=()=>{m&&(clearTimeout(m),m=null)},x=(S,C,B)=>{C&&Ib(C),d.current.diagnosticsOn&&(console.debug("[scan]",B),d.current.onDiag({seq:++p.current,key:"(quiet)",code:"",deltaMs:0,buffer:"",note:B})),d.current.onScan(S)},v=()=>{b(),u.pendingAutoFire()&&(m=setTimeout(()=>{m=null;const S=u.pendingAutoFire();S&&(u.reset(),x(S.code,S.consumedLength,`capture → ${S.code} (quiet period — no suffix)`))},e.autoFireQuietMs))},_=S=>{if(sN(S.target)){u.reset(),b();return}const C=u.snapshot().buffer,{suppress:B,emit:q,consumedLength:ne}=u.step({key:S.key,timeMs:S.timeStamp,hasModifier:S.ctrlKey||S.metaKey||S.altKey,isRepeat:S.repeat});if(B&&(S.preventDefault(),S.stopPropagation()),d.current.diagnosticsOn){const te=u.snapshot().buffer,M=e.terminators.includes(S.key),z=q?`capture → ${q}`:M?`terminator — no code tail in "${C.slice(-24)}"`:te===C?C?"neutral (chord key)":"ignored":te===""?"reset (edit/chord/non-printable)":te.length<=1&&C.length>1?"gap — new episode":"accumulate",ae=g.current?Math.round(S.timeStamp-g.current):0,F={seq:++p.current,key:S.key,code:S.code!==S.key?S.code:"",deltaMs:ae,buffer:te.slice(-24),note:z};console.debug("[scan]",F.key,F.code,`${F.deltaMs}ms`,F.note),d.current.onDiag(F)}g.current=S.timeStamp,q?(b(),ne&&Ib(ne),d.current.onScan(q)):v()};return window.addEventListener("keydown",_,{capture:!0}),()=>{b(),window.removeEventListener("keydown",_,{capture:!0})}},[n,e,s])}const ke={EXECUTED:"executed",MATCHED_LIST:"matched_list",CONFIRM_REQUIRED:"confirm_required",NO_MATCH_FALLBACK:"no_match_fallback",UNCONFIGURED:"unconfigured",INVALID_CODE:"invalid_code",FORBIDDEN:"forbidden",CONFLICT:"conflict",IDENTITY_PRIMED:"identity_primed",IDENTITY_UNKNOWN:"identity_unknown",NOT_PRIMED:"not_primed",CHOICES:"choices",NO_OPEN_CONTAINER:"no_open_container",HELD:"held",REFUSED:"refused",SUBJECT_STALE:"subject_stale"},mc={SHOW_DETAIL:"show-detail",SHOW_LIST:"show-list",CLAIM:"claim",CLAIM_SHOW_DETAIL:"claim-show-detail",RELEASE:"release",RESOLVE:"resolve",ESCALATE:"escalate",CANCEL:"cancel",ACCUMULATE:"accumulate",PRESENT:"present",HOLD:"hold",FILL:"fill"},aN={ACTION:"action",IDENTITY:"identity"};function oN(n,e){return ue("/scan-codes/execute",{method:"POST",body:JSON.stringify({code:n,...e!=null&&e.actingToken?{actingToken:e.actingToken}:{},...e!=null&&e.previousActingToken?{previousActingToken:e.previousActingToken}:{},...e!=null&&e.subject?{subject:e.subject}:{},...e!=null&&e.stationRole?{stationRole:e.stationRole}:{}})})}function KM(n){return ue("/scan-codes/execute-choice",{method:"POST",body:JSON.stringify(n)})}function Dv(n){return qe({queryKey:["scan-schemes"],queryFn:()=>ue("/scan-codes/schemes"),...n})}function JM(n){return qe({queryKey:["scan-schemes",n],queryFn:()=>ue(`/scan-codes/schemes/${n}`),enabled:n!=null})}function QM(){const n=Pe();return Ie({mutationFn:e=>ue(`/scan-codes/schemes/${e.version}`,{method:"PUT",body:JSON.stringify(e)}),onSuccess:()=>n.invalidateQueries({queryKey:["scan-schemes"]})})}function XM(){const n=Pe();return Ie({mutationFn:e=>ue(`/scan-codes/schemes/${e}`,{method:"DELETE"}),onSuccess:()=>n.invalidateQueries({queryKey:["scan-schemes"]})})}function WM(){const n=Pe();return Ie({mutationFn:e=>ue(`/scan-codes/schemes/${e.scheme_version}/actions/${e.category}`,{method:"PUT",body:JSON.stringify(e)}),onSuccess:(e,s)=>n.invalidateQueries({queryKey:["scan-schemes",s.scheme_version]})})}function ZM(){const n=Pe();return Ie({mutationFn:e=>ue(`/scan-codes/schemes/${e.scheme_version}/actions/${e.category}`,{method:"DELETE"}),onSuccess:(e,s)=>n.invalidateQueries({queryKey:["scan-schemes",s.scheme_version]})})}const lN=3e4;function cN(n,e=Date.now()){if(!(!n||Date.parse(n.expiresAt)<=e))return{code:n.code,escalationId:n.escalationId}}function Hb(n,e,s=Date.now()){if(e.outcome===ke.HELD&&e.subject){const i=Math.max(0,Date.parse(e.subject.expiresAt)-s);return{...e.subject,ttlMs:i}}return e.clearSubject||!n?null:e.outcome===ke.EXECUTED&&e.progress&&e.progress.remaining>0?{...n,expiresAt:new Date(s+n.ttlMs).toISOString()}:n}function Fb(n){return n.outcome===ke.NOT_PRIMED&&n.replayable===!0}function uN(n,e=Date.now()){return n&&e-n.at<=lN?n:null}const fN=[ke.HELD,ke.REFUSED,ke.SUBJECT_STALE],Gi=n=>{if(n)try{return JSON.parse(n)}catch{return}},ti=n=>n==null||Array.isArray(n)&&n.length===0||typeof n=="object"&&!Array.isArray(n)&&Object.keys(n).length===0;function hN(n){const e={},s=Gi(n.get("facets"));ti(s)||(e.facets=s);const i=Gi(n.get("block"));ti(i)||(e.block=i);const o=Gi(n.get("range"));ti(o)||(e.range=o);const c=Gi(n.get("exists"));ti(c)||(e.exists=c);const d=Gi(n.get("roles"));ti(d)||(e.roles=d);const p=Gi(n.get("orderBy"));ti(p)||(e.orderBy=p),n.get("available")!=null&&(e.available=n.get("available")==="true");const g=n.get("jeopardy");return(g==="1"||g==="true")&&(e.jeopardy=!0),e}function eR(n,e){const s=(i,o)=>ti(o)?n.delete(i):n.set(i,JSON.stringify(o));s("facets",e.facets),s("block",e.block),s("range",e.range),s("exists",e.exists),s("roles",e.roles),s("orderBy",e.orderBy),e.available==null?n.delete("available"):n.set("available",String(e.available)),e.jeopardy===!0?n.set("jeopardy","1"):n.delete("jeopardy")}const rm=`&status=all&view=table&orderBy=${encodeURIComponent(JSON.stringify([{field:"created_at",direction:"desc"}]))}`;function Lv(n,e){const s={};for(const[o,c]of Object.entries(n))s[o]=typeof c=="object"&&c!==null?JSON.stringify(c):c;const i=encodeURIComponent(JSON.stringify(s));return e?`/escalations/available?role=${encodeURIComponent(e)}&facets=${i}${rm}`:`/escalations/available?facets=${i}${rm}`}function dN(n,e,s){const i=encodeURIComponent(JSON.stringify({[n]:[e]}));return`/escalations/available?${s?`role=${encodeURIComponent(s)}&`:""}facets=${i}${rm}`}function mN(n,e,s){return Lv({[n]:e},s)}function tR(n){var e,s,i;return Object.keys(n.facets??{}).length+(((e=n.block)==null?void 0:e.length)??0)+(((s=n.range)==null?void 0:s.length)??0)+(((i=n.exists)==null?void 0:i.length)??0)+(n.available!=null?1:0)+(n.jeopardy===!0?1:0)}function Fm(){var s;const{data:n}=Hn(),e=rv();return e!==null?e:!!((s=n==null?void 0:n.features)!=null&&s.scanCodes)}const Gm=E.createContext(null);function Vm(){const n=E.useContext(Gm);if(!n)throw new Error("useScanInput must be used within ScanInputProvider");return n}function nR(){return E.useContext(Gm)}const pN="scanPendingAction",yN="scanChoices",dd="/scan/station";function gN({children:n}){const{user:e}=qt(),s=Fm(),i=ri(),o=tn(),{identity:c,prime:d,clear:p,settle:g}=Mu(),[u,m]=E.useState(null),[b,x]=E.useState(null),[v,_]=E.useState(null),{data:S}=Dv({enabled:!!e&&s,staleTime:6e4}),C=E.useRef(null);C.current=Lm().role;const B=E.useMemo(()=>Qk((S==null?void 0:S.schemes)??[]),[S]),[q,ne]=E.useState(!1),[te,M]=E.useState(()=>Rv()),[z,ae]=E.useState([]),[F,U]=E.useState(!1),D=E.useCallback(_e=>{var zt;const{outcome:oe}=_e;if(oe===ke.CONFIRM_REQUIRED&&_e.pendingAction)return i(`/escalations/detail/${_e.pendingAction.escalationId}`,{state:{[pN]:_e.pendingAction}}),!0;const Be=oe===ke.EXECUTED&&!!H.current;if(fN.includes(oe)||Fb(_e)||Be)return ce.current!==dd&&i(dd),!0;if(oe===ke.EXECUTED&&_e.escalation){const Mt=[mc.SHOW_DETAIL,mc.CLAIM_SHOW_DETAIL,mc.CLAIM,mc.ESCALATE];return _e.verb&&Mt.includes(_e.verb)?(i(`/escalations/detail/${_e.escalation.id}`),!0):!1}if(oe===ke.MATCHED_LIST&&_e.listQuery){const{targetFacet:Mt,target:tt,targetMatch:ye,roles:Le}=_e.listQuery;return i(ye==="member"?dN(Mt,tt,(Le==null?void 0:Le[0])??null):Lv({[Mt]:tt},(Le==null?void 0:Le[0])??null)),!0}return oe===ke.CHOICES&&_e.choices?(i(dd,{state:{[yN]:_e}}),!0):oe===ke.NO_MATCH_FALLBACK&&((zt=_e.fallback)!=null&&zt.route)?(i(_e.fallback.route),!0):!1},[i]),Q=E.useRef(null);Q.current=(c==null?void 0:c.actingToken)??null;const W=E.useRef(null),he=E.useRef([]),Ee=E.useCallback(_e=>(he.current=[_e,...he.current],()=>{he.current=he.current.filter(oe=>oe!==_e)}),[]),Ae=E.useRef(null);Ae.current=b;const H=E.useRef(void 0),J=E.useRef(null);J.current=v;const ce=E.useRef(o.pathname);ce.current=o.pathname,E.useEffect(()=>{if(!b)return;const _e=Date.parse(b.expiresAt)-Date.now();if(_e<=0){x(null);return}const oe=setTimeout(()=>x(null),_e);return()=>clearTimeout(oe)},[b]);const pe=E.useCallback(async(_e,oe,Be,zt=!1)=>{ne(!0);const Mt=Date.now();try{H.current=cN(Ae.current);const tt=await oN(_e,{actingToken:Be??void 0,previousActingToken:W.current??void 0,subject:H.current,stationRole:C.current??void 0});if(Be&&g(Be,tt),x(Le=>Hb(Le,tt)),tt.outcome===ke.IDENTITY_PRIMED){W.current=d(tt);const Le=uN(J.current);if(_(null),Le&&tt.actingToken)return m({code:_e,source:oe,at:Mt,response:tt,error:null,navigated:!1}),pe(Le.code,oe,tt.actingToken)}else Fb(tt)?_({code:_e,at:Mt}):_(null);tt.outcome===ke.NOT_PRIMED&&Be&&p();const ye=zt||D(tt);return m({code:_e,source:oe,at:Mt,response:tt,error:null,navigated:ye}),tt}catch(tt){return m({code:_e,source:oe,at:Mt,response:null,error:tt.message,navigated:!1}),null}finally{ne(!1)}},[D,d,p,g]),ge=E.useCallback(async(_e,oe=ra.MANUAL)=>{for(const Be of he.current)if(Be(_e))return;await pe(_e,oe,Q.current)},[pe]),Ce=E.useCallback(async _e=>{const oe=await pe(_e,ra.FOLLOW,Q.current,!0);return(oe==null?void 0:oe.outcome)===ke.HELD},[pe]),Ne=E.useCallback(()=>x(null),[]),Me=E.useCallback(_e=>{x(oe=>Hb(oe,_e))},[]),Xe=E.useCallback(()=>_(null),[]),pt=E.useRef(ge);pt.current=ge,iN({active:!!e&&s,wedgeConfig:te,tailShapes:B,diagnosticsOn:F,onScan:_e=>void pt.current(_e,ra.KEYBOARD_WEDGE),onDiag:_e=>ae(oe=>[...oe.slice(-29),_e])});const Ot=E.useCallback(_e=>{M(Yk(_e))},[]),mt=E.useMemo(()=>({submitCode:ge,pushCodeInterceptor:Ee,lastResult:u,subject:b,dropSubject:Ne,adoptResponse:Me,followCode:Ce,pendingScan:v,dropPendingScan:Xe,busy:q,wedgeConfig:te,updateWedgeConfig:Ot,diagnostics:z,diagnosticsOn:F,setDiagnosticsOn:U}),[ge,Ee,u,b,Ne,Me,Ce,v,Xe,q,te,Ot,z,F]);return h.jsx(Gm.Provider,{value:mt,children:n})}var pc={},fo={},yc={},Gb;function Nn(){if(Gb)return yc;Gb=1,Object.defineProperty(yc,"__esModule",{value:!0});function n(s,i){if(!(s instanceof i))throw new TypeError("Cannot call a class as a function")}var e=function s(i,o){n(this,s),this.data=i,this.text=o.text||i,this.options=o};return yc.default=e,yc}var Vb;function bN(){if(Vb)return fo;Vb=1,Object.defineProperty(fo,"__esModule",{value:!0}),fo.CODE39=void 0;var n=(function(){function S(C,B){for(var q=0;q<B.length;q++){var ne=B[q];ne.enumerable=ne.enumerable||!1,ne.configurable=!0,"value"in ne&&(ne.writable=!0),Object.defineProperty(C,ne.key,ne)}}return function(C,B,q){return B&&S(C.prototype,B),q&&S(C,q),C}})(),e=Nn(),s=i(e);function i(S){return S&&S.__esModule?S:{default:S}}function o(S,C){if(!(S instanceof C))throw new TypeError("Cannot call a class as a function")}function c(S,C){if(!S)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return C&&(typeof C=="object"||typeof C=="function")?C:S}function d(S,C){if(typeof C!="function"&&C!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof C);S.prototype=Object.create(C&&C.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}}),C&&(Object.setPrototypeOf?Object.setPrototypeOf(S,C):S.__proto__=C)}var p=(function(S){d(C,S);function C(B,q){return o(this,C),B=B.toUpperCase(),q.mod43&&(B+=x(_(B))),c(this,(C.__proto__||Object.getPrototypeOf(C)).call(this,B,q))}return n(C,[{key:"encode",value:function(){for(var q=m("*"),ne=0;ne<this.data.length;ne++)q+=m(this.data[ne])+"0";return q+=m("*"),{data:q,text:this.text}}},{key:"valid",value:function(){return this.data.search(/^[0-9A-Z\-\.\ \$\/\+\%]+$/)!==-1}}]),C})(s.default),g=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","-","."," ","$","/","+","%","*"],u=[20957,29783,23639,30485,20951,29813,23669,20855,29789,23645,29975,23831,30533,22295,30149,24005,21623,29981,23837,22301,30023,23879,30545,22343,30161,24017,21959,30065,23921,22385,29015,18263,29141,17879,29045,18293,17783,29021,18269,17477,17489,17681,20753,35770];function m(S){return b(v(S))}function b(S){return u[S].toString(2)}function x(S){return g[S]}function v(S){return g.indexOf(S)}function _(S){for(var C=0,B=0;B<S.length;B++)C+=v(S[B]);return C=C%43,C}return fo.CODE39=p,fo}var Qn={},gc={},bc={},vt={},Yb;function Po(){if(Yb)return vt;Yb=1,Object.defineProperty(vt,"__esModule",{value:!0});var n;function e(g,u,m){return u in g?Object.defineProperty(g,u,{value:m,enumerable:!0,configurable:!0,writable:!0}):g[u]=m,g}var s=vt.SET_A=0,i=vt.SET_B=1,o=vt.SET_C=2;vt.SHIFT=98;var c=vt.START_A=103,d=vt.START_B=104,p=vt.START_C=105;return vt.MODULO=103,vt.STOP=106,vt.FNC1=207,vt.SET_BY_CODE=(n={},e(n,c,s),e(n,d,i),e(n,p,o),n),vt.SWAP={101:s,100:i,99:o},vt.A_START_CHAR="Ð",vt.B_START_CHAR="Ñ",vt.C_START_CHAR="Ò",vt.A_CHARS="[\0-_È-Ï]",vt.B_CHARS="[ -È-Ï]",vt.C_CHARS="(Ï*[0-9]{2}Ï*)",vt.BARS=[11011001100,11001101100,11001100110,10010011e3,10010001100,10001001100,10011001e3,10011000100,10001100100,11001001e3,11001000100,11000100100,10110011100,10011011100,10011001110,10111001100,10011101100,10011100110,11001110010,11001011100,11001001110,11011100100,11001110100,11101101110,11101001100,11100101100,11100100110,11101100100,11100110100,11100110010,11011011e3,11011000110,11000110110,10100011e3,10001011e3,10001000110,10110001e3,10001101e3,10001100010,11010001e3,11000101e3,11000100010,10110111e3,10110001110,10001101110,10111011e3,10111000110,10001110110,11101110110,11010001110,11000101110,11011101e3,11011100010,11011101110,11101011e3,11101000110,11100010110,11101101e3,11101100010,11100011010,11101111010,11001000010,11110001010,1010011e4,10100001100,1001011e4,10010000110,10000101100,10000100110,1011001e4,10110000100,1001101e4,10011000010,10000110100,10000110010,11000010010,1100101e4,11110111010,11000010100,10001111010,10100111100,10010111100,10010011110,10111100100,10011110100,10011110010,11110100100,11110010100,11110010010,11011011110,11011110110,11110110110,10101111e3,10100011110,10001011110,10111101e3,10111100010,11110101e3,11110100010,10111011110,10111101110,11101011110,11110101110,11010000100,1101001e4,11010011100,1100011101011],vt}var Kb;function Lu(){if(Kb)return bc;Kb=1,Object.defineProperty(bc,"__esModule",{value:!0});var n=(function(){function u(m,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(m,v.key,v)}}return function(m,b,x){return b&&u(m.prototype,b),x&&u(m,x),m}})(),e=Nn(),s=o(e),i=Po();function o(u){return u&&u.__esModule?u:{default:u}}function c(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}function d(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:u}function p(u,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);u.prototype=Object.create(m&&m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(u,m):u.__proto__=m)}var g=(function(u){p(m,u);function m(b,x){c(this,m);var v=d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,b.substring(1),x));return v.bytes=b.split("").map(function(_){return _.charCodeAt(0)}),v}return n(m,[{key:"valid",value:function(){return/^[\x00-\x7F\xC8-\xD3]+$/.test(this.data)}},{key:"encode",value:function(){var x=this.bytes,v=x.shift()-105,_=i.SET_BY_CODE[v];if(_===void 0)throw new RangeError("The encoding does not start with a start character.");this.shouldEncodeAsEan128()===!0&&x.unshift(i.FNC1);var S=m.next(x,1,_);return{text:this.text===this.data?this.text.replace(/[^\x20-\x7E]/g,""):this.text,data:m.getBar(v)+S.result+m.getBar((S.checksum+v)%i.MODULO)+m.getBar(i.STOP)}}},{key:"shouldEncodeAsEan128",value:function(){var x=this.options.ean128||!1;return typeof x=="string"&&(x=x.toLowerCase()==="true"),x}}],[{key:"getBar",value:function(x){return i.BARS[x]?i.BARS[x].toString():""}},{key:"correctIndex",value:function(x,v){if(v===i.SET_A){var _=x.shift();return _<32?_+64:_-32}else return v===i.SET_B?x.shift()-32:(x.shift()-48)*10+x.shift()-48}},{key:"next",value:function(x,v,_){if(!x.length)return{result:"",checksum:0};var S=void 0,C=void 0;if(x[0]>=200){C=x.shift()-105;var B=i.SWAP[C];B!==void 0?S=m.next(x,v+1,B):((_===i.SET_A||_===i.SET_B)&&C===i.SHIFT&&(x[0]=_===i.SET_A?x[0]>95?x[0]-96:x[0]:x[0]<32?x[0]+96:x[0]),S=m.next(x,v+1,_))}else C=m.correctIndex(x,_),S=m.next(x,v+1,_);var q=m.getBar(C),ne=C*v;return{result:q+S.result,checksum:ne+S.checksum}}}]),m})(s.default);return bc.default=g,bc}var xc={},Jb;function xN(){if(Jb)return xc;Jb=1,Object.defineProperty(xc,"__esModule",{value:!0});var n=Po(),e=function(p){return p.match(new RegExp("^"+n.A_CHARS+"*"))[0].length},s=function(p){return p.match(new RegExp("^"+n.B_CHARS+"*"))[0].length},i=function(p){return p.match(new RegExp("^"+n.C_CHARS+"*"))[0]};function o(d,p){var g=p?n.A_CHARS:n.B_CHARS,u=d.match(new RegExp("^("+g+"+?)(([0-9]{2}){2,})([^0-9]|$)"));if(u)return u[1]+"Ì"+c(d.substring(u[1].length));var m=d.match(new RegExp("^"+g+"+"))[0];return m.length===d.length?d:m+String.fromCharCode(p?205:206)+o(d.substring(m.length),!p)}function c(d){var p=i(d),g=p.length;if(g===d.length)return d;d=d.substring(g);var u=e(d)>=s(d);return p+String.fromCharCode(u?206:205)+o(d,u)}return xc.default=function(d){var p=void 0,g=i(d).length;if(g>=2)p=n.C_START_CHAR+c(d);else{var u=e(d)>s(d);p=(u?n.A_START_CHAR:n.B_START_CHAR)+o(d,u)}return p.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,function(m,b){return"Ë"+b})},xc}var Qb;function vN(){if(Qb)return gc;Qb=1,Object.defineProperty(gc,"__esModule",{value:!0});var n=Lu(),e=o(n),s=xN(),i=o(s);function o(u){return u&&u.__esModule?u:{default:u}}function c(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}function d(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:u}function p(u,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);u.prototype=Object.create(m&&m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(u,m):u.__proto__=m)}var g=(function(u){p(m,u);function m(b,x){if(c(this,m),/^[\x00-\x7F\xC8-\xD3]+$/.test(b))var v=d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,(0,i.default)(b),x));else var v=d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,b,x));return d(v)}return m})(e.default);return gc.default=g,gc}var vc={},Xb;function _N(){if(Xb)return vc;Xb=1,Object.defineProperty(vc,"__esModule",{value:!0});var n=(function(){function u(m,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(m,v.key,v)}}return function(m,b,x){return b&&u(m.prototype,b),x&&u(m,x),m}})(),e=Lu(),s=o(e),i=Po();function o(u){return u&&u.__esModule?u:{default:u}}function c(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}function d(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:u}function p(u,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);u.prototype=Object.create(m&&m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(u,m):u.__proto__=m)}var g=(function(u){p(m,u);function m(b,x){return c(this,m),d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,i.A_START_CHAR+b,x))}return n(m,[{key:"valid",value:function(){return new RegExp("^"+i.A_CHARS+"+$").test(this.data)}}]),m})(s.default);return vc.default=g,vc}var _c={},Wb;function wN(){if(Wb)return _c;Wb=1,Object.defineProperty(_c,"__esModule",{value:!0});var n=(function(){function u(m,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(m,v.key,v)}}return function(m,b,x){return b&&u(m.prototype,b),x&&u(m,x),m}})(),e=Lu(),s=o(e),i=Po();function o(u){return u&&u.__esModule?u:{default:u}}function c(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}function d(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:u}function p(u,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);u.prototype=Object.create(m&&m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(u,m):u.__proto__=m)}var g=(function(u){p(m,u);function m(b,x){return c(this,m),d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,i.B_START_CHAR+b,x))}return n(m,[{key:"valid",value:function(){return new RegExp("^"+i.B_CHARS+"+$").test(this.data)}}]),m})(s.default);return _c.default=g,_c}var wc={},Zb;function SN(){if(Zb)return wc;Zb=1,Object.defineProperty(wc,"__esModule",{value:!0});var n=(function(){function u(m,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(m,v.key,v)}}return function(m,b,x){return b&&u(m.prototype,b),x&&u(m,x),m}})(),e=Lu(),s=o(e),i=Po();function o(u){return u&&u.__esModule?u:{default:u}}function c(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}function d(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:u}function p(u,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);u.prototype=Object.create(m&&m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(u,m):u.__proto__=m)}var g=(function(u){p(m,u);function m(b,x){return c(this,m),d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,i.C_START_CHAR+b,x))}return n(m,[{key:"valid",value:function(){return new RegExp("^"+i.C_CHARS+"+$").test(this.data)}}]),m})(s.default);return wc.default=g,wc}var e1;function EN(){if(e1)return Qn;e1=1,Object.defineProperty(Qn,"__esModule",{value:!0}),Qn.CODE128C=Qn.CODE128B=Qn.CODE128A=Qn.CODE128=void 0;var n=vN(),e=g(n),s=_N(),i=g(s),o=wN(),c=g(o),d=SN(),p=g(d);function g(u){return u&&u.__esModule?u:{default:u}}return Qn.CODE128=e.default,Qn.CODE128A=i.default,Qn.CODE128B=c.default,Qn.CODE128C=p.default,Qn}var Jt={},Sc={},Rr={},t1;function Bo(){return t1||(t1=1,Object.defineProperty(Rr,"__esModule",{value:!0}),Rr.SIDE_BIN="101",Rr.MIDDLE_BIN="01010",Rr.BINARIES={L:["0001101","0011001","0010011","0111101","0100011","0110001","0101111","0111011","0110111","0001011"],G:["0100111","0110011","0011011","0100001","0011101","0111001","0000101","0010001","0001001","0010111"],R:["1110010","1100110","1101100","1000010","1011100","1001110","1010000","1000100","1001000","1110100"],O:["0001101","0011001","0010011","0111101","0100011","0110001","0101111","0111011","0110111","0001011"],E:["0100111","0110011","0011011","0100001","0011101","0111001","0000101","0010001","0001001","0010111"]},Rr.EAN2_STRUCTURE=["LL","LG","GL","GG"],Rr.EAN5_STRUCTURE=["GGLLL","GLGLL","GLLGL","GLLLG","LGGLL","LLGGL","LLLGG","LGLGL","LGLLG","LLGLG"],Rr.EAN13_STRUCTURE=["LLLLLL","LLGLGG","LLGGLG","LLGGGL","LGLLGG","LGGLLG","LGGGLL","LGLGLG","LGLGGL","LGGLGL"]),Rr}var Ec={},Oc={},n1;function Uo(){if(n1)return Oc;n1=1,Object.defineProperty(Oc,"__esModule",{value:!0});var n=Bo(),e=function(i,o,c){var d=i.split("").map(function(g,u){return n.BINARIES[o[u]]}).map(function(g,u){return g?g[i[u]]:""});if(c){var p=i.length-1;d=d.map(function(g,u){return u<p?g+c:g})}return d.join("")};return Oc.default=e,Oc}var r1;function qv(){if(r1)return Ec;r1=1,Object.defineProperty(Ec,"__esModule",{value:!0});var n=(function(){function b(x,v){for(var _=0;_<v.length;_++){var S=v[_];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(x,S.key,S)}}return function(x,v,_){return v&&b(x.prototype,v),_&&b(x,_),x}})(),e=Bo(),s=Uo(),i=d(s),o=Nn(),c=d(o);function d(b){return b&&b.__esModule?b:{default:b}}function p(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function g(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function u(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var m=(function(b){u(x,b);function x(v,_){p(this,x);var S=g(this,(x.__proto__||Object.getPrototypeOf(x)).call(this,v,_));return S.fontSize=!_.flat&&_.fontSize>_.width*10?_.width*10:_.fontSize,S.guardHeight=_.height+S.fontSize/2+_.textMargin,S}return n(x,[{key:"encode",value:function(){return this.options.flat?this.encodeFlat():this.encodeGuarded()}},{key:"leftText",value:function(_,S){return this.text.substr(_,S)}},{key:"leftEncode",value:function(_,S){return(0,i.default)(_,S)}},{key:"rightText",value:function(_,S){return this.text.substr(_,S)}},{key:"rightEncode",value:function(_,S){return(0,i.default)(_,S)}},{key:"encodeGuarded",value:function(){var _={fontSize:this.fontSize},S={height:this.guardHeight};return[{data:e.SIDE_BIN,options:S},{data:this.leftEncode(),text:this.leftText(),options:_},{data:e.MIDDLE_BIN,options:S},{data:this.rightEncode(),text:this.rightText(),options:_},{data:e.SIDE_BIN,options:S}]}},{key:"encodeFlat",value:function(){var _=[e.SIDE_BIN,this.leftEncode(),e.MIDDLE_BIN,this.rightEncode(),e.SIDE_BIN];return{data:_.join(""),text:this.text}}}]),x})(c.default);return Ec.default=m,Ec}var s1;function ON(){if(s1)return Sc;s1=1,Object.defineProperty(Sc,"__esModule",{value:!0});var n=(function(){function b(x,v){for(var _=0;_<v.length;_++){var S=v[_];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(x,S.key,S)}}return function(x,v,_){return v&&b(x.prototype,v),_&&b(x,_),x}})(),e=function b(x,v,_){x===null&&(x=Function.prototype);var S=Object.getOwnPropertyDescriptor(x,v);if(S===void 0){var C=Object.getPrototypeOf(x);return C===null?void 0:b(C,v,_)}else{if("value"in S)return S.value;var B=S.get;return B===void 0?void 0:B.call(_)}},s=Bo(),i=qv(),o=c(i);function c(b){return b&&b.__esModule?b:{default:b}}function d(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function p(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function g(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var u=function(x){var v=x.substr(0,12).split("").map(function(_){return+_}).reduce(function(_,S,C){return C%2?_+S*3:_+S},0);return(10-v%10)%10},m=(function(b){g(x,b);function x(v,_){d(this,x),v.search(/^[0-9]{12}$/)!==-1&&(v+=u(v));var S=p(this,(x.__proto__||Object.getPrototypeOf(x)).call(this,v,_));return S.lastChar=_.lastChar,S}return n(x,[{key:"valid",value:function(){return this.data.search(/^[0-9]{13}$/)!==-1&&+this.data[12]===u(this.data)}},{key:"leftText",value:function(){return e(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"leftText",this).call(this,1,6)}},{key:"leftEncode",value:function(){var _=this.data.substr(1,6),S=s.EAN13_STRUCTURE[this.data[0]];return e(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"leftEncode",this).call(this,_,S)}},{key:"rightText",value:function(){return e(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"rightText",this).call(this,7,6)}},{key:"rightEncode",value:function(){var _=this.data.substr(7,6);return e(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"rightEncode",this).call(this,_,"RRRRRR")}},{key:"encodeGuarded",value:function(){var _=e(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"encodeGuarded",this).call(this);return this.options.displayValue&&(_.unshift({data:"000000000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),this.options.lastChar&&(_.push({data:"00"}),_.push({data:"00000",text:this.options.lastChar,options:{fontSize:this.fontSize}}))),_}}]),x})(o.default);return Sc.default=m,Sc}var Ac={},i1;function AN(){if(i1)return Ac;i1=1,Object.defineProperty(Ac,"__esModule",{value:!0});var n=(function(){function m(b,x){for(var v=0;v<x.length;v++){var _=x[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(b,_.key,_)}}return function(b,x,v){return x&&m(b.prototype,x),v&&m(b,v),b}})(),e=function m(b,x,v){b===null&&(b=Function.prototype);var _=Object.getOwnPropertyDescriptor(b,x);if(_===void 0){var S=Object.getPrototypeOf(b);return S===null?void 0:m(S,x,v)}else{if("value"in _)return _.value;var C=_.get;return C===void 0?void 0:C.call(v)}},s=qv(),i=o(s);function o(m){return m&&m.__esModule?m:{default:m}}function c(m,b){if(!(m instanceof b))throw new TypeError("Cannot call a class as a function")}function d(m,b){if(!m)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return b&&(typeof b=="object"||typeof b=="function")?b:m}function p(m,b){if(typeof b!="function"&&b!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof b);m.prototype=Object.create(b&&b.prototype,{constructor:{value:m,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(m,b):m.__proto__=b)}var g=function(b){var x=b.substr(0,7).split("").map(function(v){return+v}).reduce(function(v,_,S){return S%2?v+_:v+_*3},0);return(10-x%10)%10},u=(function(m){p(b,m);function b(x,v){return c(this,b),x.search(/^[0-9]{7}$/)!==-1&&(x+=g(x)),d(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,x,v))}return n(b,[{key:"valid",value:function(){return this.data.search(/^[0-9]{8}$/)!==-1&&+this.data[7]===g(this.data)}},{key:"leftText",value:function(){return e(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"leftText",this).call(this,0,4)}},{key:"leftEncode",value:function(){var v=this.data.substr(0,4);return e(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"leftEncode",this).call(this,v,"LLLL")}},{key:"rightText",value:function(){return e(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"rightText",this).call(this,4,4)}},{key:"rightEncode",value:function(){var v=this.data.substr(4,4);return e(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"rightEncode",this).call(this,v,"RRRR")}}]),b})(i.default);return Ac.default=u,Ac}var jc={},a1;function jN(){if(a1)return jc;a1=1,Object.defineProperty(jc,"__esModule",{value:!0});var n=(function(){function x(v,_){for(var S=0;S<_.length;S++){var C=_[S];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(v,C.key,C)}}return function(v,_,S){return _&&x(v.prototype,_),S&&x(v,S),v}})(),e=Bo(),s=Uo(),i=d(s),o=Nn(),c=d(o);function d(x){return x&&x.__esModule?x:{default:x}}function p(x,v){if(!(x instanceof v))throw new TypeError("Cannot call a class as a function")}function g(x,v){if(!x)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:x}function u(x,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);x.prototype=Object.create(v&&v.prototype,{constructor:{value:x,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(x,v):x.__proto__=v)}var m=function(v){var _=v.split("").map(function(S){return+S}).reduce(function(S,C,B){return B%2?S+C*9:S+C*3},0);return _%10},b=(function(x){u(v,x);function v(_,S){return p(this,v),g(this,(v.__proto__||Object.getPrototypeOf(v)).call(this,_,S))}return n(v,[{key:"valid",value:function(){return this.data.search(/^[0-9]{5}$/)!==-1}},{key:"encode",value:function(){var S=e.EAN5_STRUCTURE[m(this.data)];return{data:"1011"+(0,i.default)(this.data,S,"01"),text:this.text}}}]),v})(c.default);return jc.default=b,jc}var kc={},o1;function kN(){if(o1)return kc;o1=1,Object.defineProperty(kc,"__esModule",{value:!0});var n=(function(){function b(x,v){for(var _=0;_<v.length;_++){var S=v[_];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(x,S.key,S)}}return function(x,v,_){return v&&b(x.prototype,v),_&&b(x,_),x}})(),e=Bo(),s=Uo(),i=d(s),o=Nn(),c=d(o);function d(b){return b&&b.__esModule?b:{default:b}}function p(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function g(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function u(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var m=(function(b){u(x,b);function x(v,_){return p(this,x),g(this,(x.__proto__||Object.getPrototypeOf(x)).call(this,v,_))}return n(x,[{key:"valid",value:function(){return this.data.search(/^[0-9]{2}$/)!==-1}},{key:"encode",value:function(){var _=e.EAN2_STRUCTURE[parseInt(this.data)%4];return{data:"1011"+(0,i.default)(this.data,_,"01"),text:this.text}}}]),x})(c.default);return kc.default=m,kc}var ho={},l1;function Pv(){if(l1)return ho;l1=1,Object.defineProperty(ho,"__esModule",{value:!0});var n=(function(){function b(x,v){for(var _=0;_<v.length;_++){var S=v[_];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(x,S.key,S)}}return function(x,v,_){return v&&b(x.prototype,v),_&&b(x,_),x}})();ho.checksum=m;var e=Uo(),s=c(e),i=Nn(),o=c(i);function c(b){return b&&b.__esModule?b:{default:b}}function d(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function p(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function g(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var u=(function(b){g(x,b);function x(v,_){d(this,x),v.search(/^[0-9]{11}$/)!==-1&&(v+=m(v));var S=p(this,(x.__proto__||Object.getPrototypeOf(x)).call(this,v,_));return S.displayValue=_.displayValue,_.fontSize>_.width*10?S.fontSize=_.width*10:S.fontSize=_.fontSize,S.guardHeight=_.height+S.fontSize/2+_.textMargin,S}return n(x,[{key:"valid",value:function(){return this.data.search(/^[0-9]{12}$/)!==-1&&this.data[11]==m(this.data)}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var _="";return _+="101",_+=(0,s.default)(this.data.substr(0,6),"LLLLLL"),_+="01010",_+=(0,s.default)(this.data.substr(6,6),"RRRRRR"),_+="101",{data:_,text:this.text}}},{key:"guardedEncoding",value:function(){var _=[];return this.displayValue&&_.push({data:"00000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),_.push({data:"101"+(0,s.default)(this.data[0],"L"),options:{height:this.guardHeight}}),_.push({data:(0,s.default)(this.data.substr(1,5),"LLLLL"),text:this.text.substr(1,5),options:{fontSize:this.fontSize}}),_.push({data:"01010",options:{height:this.guardHeight}}),_.push({data:(0,s.default)(this.data.substr(6,5),"RRRRR"),text:this.text.substr(6,5),options:{fontSize:this.fontSize}}),_.push({data:(0,s.default)(this.data[11],"R")+"101",options:{height:this.guardHeight}}),this.displayValue&&_.push({data:"00000000",text:this.text.substr(11,1),options:{textAlign:"right",fontSize:this.fontSize}}),_}}]),x})(o.default);function m(b){var x=0,v;for(v=1;v<11;v+=2)x+=parseInt(b[v]);for(v=0;v<11;v+=2)x+=parseInt(b[v])*3;return(10-x%10)%10}return ho.default=u,ho}var Nc={},c1;function NN(){if(c1)return Nc;c1=1,Object.defineProperty(Nc,"__esModule",{value:!0});var n=(function(){function _(S,C){for(var B=0;B<C.length;B++){var q=C[B];q.enumerable=q.enumerable||!1,q.configurable=!0,"value"in q&&(q.writable=!0),Object.defineProperty(S,q.key,q)}}return function(S,C,B){return C&&_(S.prototype,C),B&&_(S,B),S}})(),e=Uo(),s=d(e),i=Nn(),o=d(i),c=Pv();function d(_){return _&&_.__esModule?_:{default:_}}function p(_,S){if(!(_ instanceof S))throw new TypeError("Cannot call a class as a function")}function g(_,S){if(!_)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return S&&(typeof S=="object"||typeof S=="function")?S:_}function u(_,S){if(typeof S!="function"&&S!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof S);_.prototype=Object.create(S&&S.prototype,{constructor:{value:_,enumerable:!1,writable:!0,configurable:!0}}),S&&(Object.setPrototypeOf?Object.setPrototypeOf(_,S):_.__proto__=S)}var m=["XX00000XXX","XX10000XXX","XX20000XXX","XXX00000XX","XXXX00000X","XXXXX00005","XXXXX00006","XXXXX00007","XXXXX00008","XXXXX00009"],b=[["EEEOOO","OOOEEE"],["EEOEOO","OOEOEE"],["EEOOEO","OOEEOE"],["EEOOOE","OOEEEO"],["EOEEOO","OEOOEE"],["EOOEEO","OEEOOE"],["EOOOEE","OEEEOO"],["EOEOEO","OEOEOE"],["EOEOOE","OEOEEO"],["EOOEOE","OEEOEO"]],x=(function(_){u(S,_);function S(C,B){p(this,S);var q=g(this,(S.__proto__||Object.getPrototypeOf(S)).call(this,C,B));if(q.isValid=!1,C.search(/^[0-9]{6}$/)!==-1)q.middleDigits=C,q.upcA=v(C,"0"),q.text=B.text||""+q.upcA[0]+C+q.upcA[q.upcA.length-1],q.isValid=!0;else if(C.search(/^[01][0-9]{7}$/)!==-1)if(q.middleDigits=C.substring(1,C.length-1),q.upcA=v(q.middleDigits,C[0]),q.upcA[q.upcA.length-1]===C[C.length-1])q.isValid=!0;else return g(q);else return g(q);return q.displayValue=B.displayValue,B.fontSize>B.width*10?q.fontSize=B.width*10:q.fontSize=B.fontSize,q.guardHeight=B.height+q.fontSize/2+B.textMargin,q}return n(S,[{key:"valid",value:function(){return this.isValid}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var B="";return B+="101",B+=this.encodeMiddleDigits(),B+="010101",{data:B,text:this.text}}},{key:"guardedEncoding",value:function(){var B=[];return this.displayValue&&B.push({data:"00000000",text:this.text[0],options:{textAlign:"left",fontSize:this.fontSize}}),B.push({data:"101",options:{height:this.guardHeight}}),B.push({data:this.encodeMiddleDigits(),text:this.text.substring(1,7),options:{fontSize:this.fontSize}}),B.push({data:"010101",options:{height:this.guardHeight}}),this.displayValue&&B.push({data:"00000000",text:this.text[7],options:{textAlign:"right",fontSize:this.fontSize}}),B}},{key:"encodeMiddleDigits",value:function(){var B=this.upcA[0],q=this.upcA[this.upcA.length-1],ne=b[parseInt(q)][parseInt(B)];return(0,s.default)(this.middleDigits,ne)}}]),S})(o.default);function v(_,S){for(var C=parseInt(_[_.length-1]),B=m[C],q="",ne=0,te=0;te<B.length;te++){var M=B[te];M==="X"?q+=_[ne++]:q+=M}return q=""+S+q,""+q+(0,c.checksum)(q)}return Nc.default=x,Nc}var u1;function TN(){if(u1)return Jt;u1=1,Object.defineProperty(Jt,"__esModule",{value:!0}),Jt.UPCE=Jt.UPC=Jt.EAN2=Jt.EAN5=Jt.EAN8=Jt.EAN13=void 0;var n=ON(),e=x(n),s=AN(),i=x(s),o=jN(),c=x(o),d=kN(),p=x(d),g=Pv(),u=x(g),m=NN(),b=x(m);function x(v){return v&&v.__esModule?v:{default:v}}return Jt.EAN13=e.default,Jt.EAN8=i.default,Jt.EAN5=c.default,Jt.EAN2=p.default,Jt.UPC=u.default,Jt.UPCE=b.default,Jt}var Ws={},Tc={},Vi={},f1;function CN(){return f1||(f1=1,Object.defineProperty(Vi,"__esModule",{value:!0}),Vi.START_BIN="1010",Vi.END_BIN="11101",Vi.BINARIES=["00110","10001","01001","11000","00101","10100","01100","00011","10010","01010"]),Vi}var h1;function Bv(){if(h1)return Tc;h1=1,Object.defineProperty(Tc,"__esModule",{value:!0});var n=(function(){function u(m,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(m,v.key,v)}}return function(m,b,x){return b&&u(m.prototype,b),x&&u(m,x),m}})(),e=CN(),s=Nn(),i=o(s);function o(u){return u&&u.__esModule?u:{default:u}}function c(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}function d(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:u}function p(u,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);u.prototype=Object.create(m&&m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(u,m):u.__proto__=m)}var g=(function(u){p(m,u);function m(){return c(this,m),d(this,(m.__proto__||Object.getPrototypeOf(m)).apply(this,arguments))}return n(m,[{key:"valid",value:function(){return this.data.search(/^([0-9]{2})+$/)!==-1}},{key:"encode",value:function(){var x=this,v=this.data.match(/.{2}/g).map(function(_){return x.encodePair(_)}).join("");return{data:e.START_BIN+v+e.END_BIN,text:this.text}}},{key:"encodePair",value:function(x){var v=e.BINARIES[x[1]];return e.BINARIES[x[0]].split("").map(function(_,S){return(_==="1"?"111":"1")+(v[S]==="1"?"000":"0")}).join("")}}]),m})(i.default);return Tc.default=g,Tc}var Cc={},d1;function MN(){if(d1)return Cc;d1=1,Object.defineProperty(Cc,"__esModule",{value:!0});var n=(function(){function u(m,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(m,v.key,v)}}return function(m,b,x){return b&&u(m.prototype,b),x&&u(m,x),m}})(),e=Bv(),s=i(e);function i(u){return u&&u.__esModule?u:{default:u}}function o(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}function c(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:u}function d(u,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);u.prototype=Object.create(m&&m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(u,m):u.__proto__=m)}var p=function(m){var b=m.substr(0,13).split("").map(function(x){return parseInt(x,10)}).reduce(function(x,v,_){return x+v*(3-_%2*2)},0);return Math.ceil(b/10)*10-b},g=(function(u){d(m,u);function m(b,x){return o(this,m),b.search(/^[0-9]{13}$/)!==-1&&(b+=p(b)),c(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,b,x))}return n(m,[{key:"valid",value:function(){return this.data.search(/^[0-9]{14}$/)!==-1&&+this.data[13]===p(this.data)}}]),m})(s.default);return Cc.default=g,Cc}var m1;function RN(){if(m1)return Ws;m1=1,Object.defineProperty(Ws,"__esModule",{value:!0}),Ws.ITF14=Ws.ITF=void 0;var n=Bv(),e=o(n),s=MN(),i=o(s);function o(c){return c&&c.__esModule?c:{default:c}}return Ws.ITF=e.default,Ws.ITF14=i.default,Ws}var vn={},Mc={},p1;function zo(){if(p1)return Mc;p1=1,Object.defineProperty(Mc,"__esModule",{value:!0});var n=(function(){function u(m,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(m,v.key,v)}}return function(m,b,x){return b&&u(m.prototype,b),x&&u(m,x),m}})(),e=Nn(),s=i(e);function i(u){return u&&u.__esModule?u:{default:u}}function o(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}function c(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:u}function d(u,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);u.prototype=Object.create(m&&m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(u,m):u.__proto__=m)}var p=(function(u){d(m,u);function m(b,x){return o(this,m),c(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,b,x))}return n(m,[{key:"encode",value:function(){for(var x="110",v=0;v<this.data.length;v++){var _=parseInt(this.data[v]),S=_.toString(2);S=g(S,4-S.length);for(var C=0;C<S.length;C++)x+=S[C]=="0"?"100":"110"}return x+="1001",{data:x,text:this.text}}},{key:"valid",value:function(){return this.data.search(/^[0-9]+$/)!==-1}}]),m})(s.default);function g(u,m){for(var b=0;b<m;b++)u="0"+u;return u}return Mc.default=p,Mc}var Rc={},mo={},y1;function qu(){if(y1)return mo;y1=1,Object.defineProperty(mo,"__esModule",{value:!0}),mo.mod10=n,mo.mod11=e;function n(s){for(var i=0,o=0;o<s.length;o++){var c=parseInt(s[o]);(o+s.length)%2===0?i+=c:i+=c*2%10+Math.floor(c*2/10)}return(10-i%10)%10}function e(s){for(var i=0,o=[2,3,4,5,6,7],c=0;c<s.length;c++){var d=parseInt(s[s.length-1-c]);i+=o[c%o.length]*d}return(11-i%11)%11}return mo}var g1;function DN(){if(g1)return Rc;g1=1,Object.defineProperty(Rc,"__esModule",{value:!0});var n=zo(),e=i(n),s=qu();function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function d(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){d(u,g);function u(m,b){return o(this,u),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,m+(0,s.mod10)(m),b))}return u})(e.default);return Rc.default=p,Rc}var Dc={},b1;function LN(){if(b1)return Dc;b1=1,Object.defineProperty(Dc,"__esModule",{value:!0});var n=zo(),e=i(n),s=qu();function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function d(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){d(u,g);function u(m,b){return o(this,u),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,m+(0,s.mod11)(m),b))}return u})(e.default);return Dc.default=p,Dc}var Lc={},x1;function qN(){if(x1)return Lc;x1=1,Object.defineProperty(Lc,"__esModule",{value:!0});var n=zo(),e=i(n),s=qu();function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function d(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){d(u,g);function u(m,b){return o(this,u),m+=(0,s.mod10)(m),m+=(0,s.mod10)(m),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,m,b))}return u})(e.default);return Lc.default=p,Lc}var qc={},v1;function PN(){if(v1)return qc;v1=1,Object.defineProperty(qc,"__esModule",{value:!0});var n=zo(),e=i(n),s=qu();function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function d(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){d(u,g);function u(m,b){return o(this,u),m+=(0,s.mod11)(m),m+=(0,s.mod10)(m),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,m,b))}return u})(e.default);return qc.default=p,qc}var _1;function BN(){if(_1)return vn;_1=1,Object.defineProperty(vn,"__esModule",{value:!0}),vn.MSI1110=vn.MSI1010=vn.MSI11=vn.MSI10=vn.MSI=void 0;var n=zo(),e=m(n),s=DN(),i=m(s),o=LN(),c=m(o),d=qN(),p=m(d),g=PN(),u=m(g);function m(b){return b&&b.__esModule?b:{default:b}}return vn.MSI=e.default,vn.MSI10=i.default,vn.MSI11=c.default,vn.MSI1010=p.default,vn.MSI1110=u.default,vn}var po={},w1;function UN(){if(w1)return po;w1=1,Object.defineProperty(po,"__esModule",{value:!0}),po.pharmacode=void 0;var n=(function(){function g(u,m){for(var b=0;b<m.length;b++){var x=m[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(u,x.key,x)}}return function(u,m,b){return m&&g(u.prototype,m),b&&g(u,b),u}})(),e=Nn(),s=i(e);function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function d(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){d(u,g);function u(m,b){o(this,u);var x=c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,m,b));return x.number=parseInt(m,10),x}return n(u,[{key:"encode",value:function(){for(var b=this.number,x="";!isNaN(b)&&b!=0;)b%2===0?(x="11100"+x,b=(b-2)/2):(x="100"+x,b=(b-1)/2);return x=x.slice(0,-2),{data:x,text:this.text}}},{key:"valid",value:function(){return this.number>=3&&this.number<=131070}}]),u})(s.default);return po.pharmacode=p,po}var yo={},S1;function zN(){if(S1)return yo;S1=1,Object.defineProperty(yo,"__esModule",{value:!0}),yo.codabar=void 0;var n=(function(){function g(u,m){for(var b=0;b<m.length;b++){var x=m[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(u,x.key,x)}}return function(u,m,b){return m&&g(u.prototype,m),b&&g(u,b),u}})(),e=Nn(),s=i(e);function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function d(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){d(u,g);function u(m,b){o(this,u),m.search(/^[0-9\-\$\:\.\+\/]+$/)===0&&(m="A"+m+"A");var x=c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,m.toUpperCase(),b));return x.text=x.options.text||x.text.replace(/[A-D]/g,""),x}return n(u,[{key:"valid",value:function(){return this.data.search(/^[A-D][0-9\-\$\:\.\+\/]+[A-D]$/)!==-1}},{key:"encode",value:function(){for(var b=[],x=this.getEncodings(),v=0;v<this.data.length;v++)b.push(x[this.data.charAt(v)]),v!==this.data.length-1&&b.push("0");return{text:this.text,data:b.join("")}}},{key:"getEncodings",value:function(){return{0:"101010011",1:"101011001",2:"101001011",3:"110010101",4:"101101001",5:"110101001",6:"100101011",7:"100101101",8:"100110101",9:"110100101","-":"101001101",$:"101100101",":":"1101011011","/":"1101101011",".":"1101101101","+":"1011011011",A:"1011001001",B:"1001001011",C:"1010010011",D:"1010011001"}}}]),u})(s.default);return yo.codabar=p,yo}var Zs={},Pc={},Yi={},E1;function $N(){return E1||(E1=1,Object.defineProperty(Yi,"__esModule",{value:!0}),Yi.SYMBOLS=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","-","."," ","$","/","+","%","($)","(%)","(/)","(+)","ÿ"],Yi.BINARIES=["100010100","101001000","101000100","101000010","100101000","100100100","100100010","101010000","100010010","100001010","110101000","110100100","110100010","110010100","110010010","110001010","101101000","101100100","101100010","100110100","100011010","101011000","101001100","101000110","100101100","100010110","110110100","110110010","110101100","110100110","110010110","110011010","101101100","101100110","100110110","100111010","100101110","111010100","111010010","111001010","101101110","101110110","110101110","100100110","111011010","111010110","100110010","101011110"],Yi.MULTI_SYMBOLS={"\0":["(%)","U"],"":["($)","A"],"":["($)","B"],"":["($)","C"],"":["($)","D"],"":["($)","E"],"":["($)","F"],"\x07":["($)","G"],"\b":["($)","H"]," ":["($)","I"],"\n":["($)","J"],"\v":["($)","K"],"\f":["($)","L"],"\r":["($)","M"],"":["($)","N"],"":["($)","O"],"":["($)","P"],"":["($)","Q"],"":["($)","R"],"":["($)","S"],"":["($)","T"],"":["($)","U"],"":["($)","V"],"":["($)","W"],"":["($)","X"],"":["($)","Y"],"":["($)","Z"],"\x1B":["(%)","A"],"":["(%)","B"],"":["(%)","C"],"":["(%)","D"],"":["(%)","E"],"!":["(/)","A"],'"':["(/)","B"],"#":["(/)","C"],"&":["(/)","F"],"'":["(/)","G"],"(":["(/)","H"],")":["(/)","I"],"*":["(/)","J"],",":["(/)","L"],":":["(/)","Z"],";":["(%)","F"],"<":["(%)","G"],"=":["(%)","H"],">":["(%)","I"],"?":["(%)","J"],"@":["(%)","V"],"[":["(%)","K"],"\\":["(%)","L"],"]":["(%)","M"],"^":["(%)","N"],_:["(%)","O"],"`":["(%)","W"],a:["(+)","A"],b:["(+)","B"],c:["(+)","C"],d:["(+)","D"],e:["(+)","E"],f:["(+)","F"],g:["(+)","G"],h:["(+)","H"],i:["(+)","I"],j:["(+)","J"],k:["(+)","K"],l:["(+)","L"],m:["(+)","M"],n:["(+)","N"],o:["(+)","O"],p:["(+)","P"],q:["(+)","Q"],r:["(+)","R"],s:["(+)","S"],t:["(+)","T"],u:["(+)","U"],v:["(+)","V"],w:["(+)","W"],x:["(+)","X"],y:["(+)","Y"],z:["(+)","Z"],"{":["(%)","P"],"|":["(%)","Q"],"}":["(%)","R"],"~":["(%)","S"],"":["(%)","T"]}),Yi}var O1;function Uv(){if(O1)return Pc;O1=1,Object.defineProperty(Pc,"__esModule",{value:!0});var n=(function(){function u(m,b){for(var x=0;x<b.length;x++){var v=b[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(m,v.key,v)}}return function(m,b,x){return b&&u(m.prototype,b),x&&u(m,x),m}})(),e=$N(),s=Nn(),i=o(s);function o(u){return u&&u.__esModule?u:{default:u}}function c(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}function d(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:u}function p(u,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);u.prototype=Object.create(m&&m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(u,m):u.__proto__=m)}var g=(function(u){p(m,u);function m(b,x){return c(this,m),d(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,b,x))}return n(m,[{key:"valid",value:function(){return/^[0-9A-Z\-. $/+%]+$/.test(this.data)}},{key:"encode",value:function(){var x=this.data.split("").flatMap(function(C){return e.MULTI_SYMBOLS[C]||C}),v=x.map(function(C){return m.getEncoding(C)}).join(""),_=m.checksum(x,20),S=m.checksum(x.concat(_),15);return{text:this.text,data:m.getEncoding("ÿ")+v+m.getEncoding(_)+m.getEncoding(S)+m.getEncoding("ÿ")+"1"}}}],[{key:"getEncoding",value:function(x){return e.BINARIES[m.symbolValue(x)]}},{key:"getSymbol",value:function(x){return e.SYMBOLS[x]}},{key:"symbolValue",value:function(x){return e.SYMBOLS.indexOf(x)}},{key:"checksum",value:function(x,v){var _=x.slice().reverse().reduce(function(S,C,B){var q=B%v+1;return S+m.symbolValue(C)*q},0);return m.getSymbol(_%47)}}]),m})(i.default);return Pc.default=g,Pc}var Bc={},A1;function IN(){if(A1)return Bc;A1=1,Object.defineProperty(Bc,"__esModule",{value:!0});var n=(function(){function g(u,m){for(var b=0;b<m.length;b++){var x=m[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(u,x.key,x)}}return function(u,m,b){return m&&g(u.prototype,m),b&&g(u,b),u}})(),e=Uv(),s=i(e);function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function d(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){d(u,g);function u(m,b){return o(this,u),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,m,b))}return n(u,[{key:"valid",value:function(){return/^[\x00-\x7f]+$/.test(this.data)}}]),u})(s.default);return Bc.default=p,Bc}var j1;function HN(){if(j1)return Zs;j1=1,Object.defineProperty(Zs,"__esModule",{value:!0}),Zs.CODE93FullASCII=Zs.CODE93=void 0;var n=Uv(),e=o(n),s=IN(),i=o(s);function o(c){return c&&c.__esModule?c:{default:c}}return Zs.CODE93=e.default,Zs.CODE93FullASCII=i.default,Zs}var go={},k1;function FN(){if(k1)return go;k1=1,Object.defineProperty(go,"__esModule",{value:!0}),go.GenericBarcode=void 0;var n=(function(){function g(u,m){for(var b=0;b<m.length;b++){var x=m[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(u,x.key,x)}}return function(u,m,b){return m&&g(u.prototype,m),b&&g(u,b),u}})(),e=Nn(),s=i(e);function i(g){return g&&g.__esModule?g:{default:g}}function o(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}function c(g,u){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:g}function d(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);g.prototype=Object.create(u&&u.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(g,u):g.__proto__=u)}var p=(function(g){d(u,g);function u(m,b){return o(this,u),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,m,b))}return n(u,[{key:"encode",value:function(){return{data:"10101010101010101010101010101010101010101",text:this.text}}},{key:"valid",value:function(){return!0}}]),u})(s.default);return go.GenericBarcode=p,go}var N1;function GN(){if(N1)return pc;N1=1,Object.defineProperty(pc,"__esModule",{value:!0});var n=bN(),e=EN(),s=TN(),i=RN(),o=BN(),c=UN(),d=zN(),p=HN(),g=FN();return pc.default={CODE39:n.CODE39,CODE128:e.CODE128,CODE128A:e.CODE128A,CODE128B:e.CODE128B,CODE128C:e.CODE128C,EAN13:s.EAN13,EAN8:s.EAN8,EAN5:s.EAN5,EAN2:s.EAN2,UPC:s.UPC,UPCE:s.UPCE,ITF14:i.ITF14,ITF:i.ITF,MSI:o.MSI,MSI10:o.MSI10,MSI11:o.MSI11,MSI1010:o.MSI1010,MSI1110:o.MSI1110,pharmacode:c.pharmacode,codabar:d.codabar,CODE93:p.CODE93,CODE93FullASCII:p.CODE93FullASCII,GenericBarcode:g.GenericBarcode},pc}var Uc={},T1;function Pu(){if(T1)return Uc;T1=1,Object.defineProperty(Uc,"__esModule",{value:!0});var n=Object.assign||function(e){for(var s=1;s<arguments.length;s++){var i=arguments[s];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e};return Uc.default=function(e,s){return n({},e,s)},Uc}var zc={},C1;function VN(){if(C1)return zc;C1=1,Object.defineProperty(zc,"__esModule",{value:!0}),zc.default=n;function n(e){var s=[];function i(o){if(Array.isArray(o))for(var c=0;c<o.length;c++)i(o[c]);else o.text=o.text||"",o.data=o.data||"",s.push(o)}return i(e),s}return zc}var $c={},M1;function YN(){if(M1)return $c;M1=1,Object.defineProperty($c,"__esModule",{value:!0}),$c.default=n;function n(e){return e.marginTop=e.marginTop||e.margin,e.marginBottom=e.marginBottom||e.margin,e.marginRight=e.marginRight||e.margin,e.marginLeft=e.marginLeft||e.margin,e}return $c}var Ic={},Hc={},Fc={},R1;function zv(){if(R1)return Fc;R1=1,Object.defineProperty(Fc,"__esModule",{value:!0}),Fc.default=n;function n(e){var s=["width","height","textMargin","fontSize","margin","marginTop","marginBottom","marginLeft","marginRight"];for(var i in s)s.hasOwnProperty(i)&&(i=s[i],typeof e[i]=="string"&&(e[i]=parseInt(e[i],10)));return typeof e.displayValue=="string"&&(e.displayValue=e.displayValue!="false"),e}return Fc}var Gc={},D1;function $v(){if(D1)return Gc;D1=1,Object.defineProperty(Gc,"__esModule",{value:!0});var n={width:2,height:100,format:"auto",displayValue:!0,fontOptions:"",font:"monospace",text:void 0,textAlign:"center",textPosition:"bottom",textMargin:2,fontSize:20,background:"#ffffff",lineColor:"#000000",margin:10,marginTop:void 0,marginBottom:void 0,marginLeft:void 0,marginRight:void 0,valid:function(){}};return Gc.default=n,Gc}var L1;function KN(){if(L1)return Hc;L1=1,Object.defineProperty(Hc,"__esModule",{value:!0});var n=zv(),e=o(n),s=$v(),i=o(s);function o(d){return d&&d.__esModule?d:{default:d}}function c(d){var p={};for(var g in i.default)i.default.hasOwnProperty(g)&&(d.hasAttribute("jsbarcode-"+g.toLowerCase())&&(p[g]=d.getAttribute("jsbarcode-"+g.toLowerCase())),d.hasAttribute("data-"+g.toLowerCase())&&(p[g]=d.getAttribute("data-"+g.toLowerCase())));return p.value=d.getAttribute("jsbarcode-value")||d.getAttribute("data-value"),p=(0,e.default)(p),p}return Hc.default=c,Hc}var Vc={},Yc={},_n={},q1;function Iv(){if(q1)return _n;q1=1,Object.defineProperty(_n,"__esModule",{value:!0}),_n.getTotalWidthOfEncodings=_n.calculateEncodingAttributes=_n.getBarcodePadding=_n.getEncodingHeight=_n.getMaximumHeightOfEncodings=void 0;var n=Pu(),e=s(n);function s(u){return u&&u.__esModule?u:{default:u}}function i(u,m){return m.height+(m.displayValue&&u.text.length>0?m.fontSize+m.textMargin:0)+m.marginTop+m.marginBottom}function o(u,m,b){if(b.displayValue&&m<u){if(b.textAlign=="center")return Math.floor((u-m)/2);if(b.textAlign=="left")return 0;if(b.textAlign=="right")return Math.floor(u-m)}return 0}function c(u,m,b){for(var x=0;x<u.length;x++){var v=u[x],_=(0,e.default)(m,v.options),S;_.displayValue?S=g(v.text,_,b):S=0;var C=v.data.length*_.width;v.width=Math.ceil(Math.max(S,C)),v.height=i(v,_),v.barcodePadding=o(S,C,_)}}function d(u){for(var m=0,b=0;b<u.length;b++)m+=u[b].width;return m}function p(u){for(var m=0,b=0;b<u.length;b++)u[b].height>m&&(m=u[b].height);return m}function g(u,m,b){var x;if(b)x=b;else if(typeof document<"u")x=document.createElement("canvas").getContext("2d");else return 0;x.font=m.fontOptions+" "+m.fontSize+"px "+m.font;var v=x.measureText(u);if(!v)return 0;var _=v.width;return _}return _n.getMaximumHeightOfEncodings=p,_n.getEncodingHeight=i,_n.getBarcodePadding=o,_n.calculateEncodingAttributes=c,_n.getTotalWidthOfEncodings=d,_n}var P1;function JN(){if(P1)return Yc;P1=1,Object.defineProperty(Yc,"__esModule",{value:!0});var n=(function(){function p(g,u){for(var m=0;m<u.length;m++){var b=u[m];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(g,b.key,b)}}return function(g,u,m){return u&&p(g.prototype,u),m&&p(g,m),g}})(),e=Pu(),s=o(e),i=Iv();function o(p){return p&&p.__esModule?p:{default:p}}function c(p,g){if(!(p instanceof g))throw new TypeError("Cannot call a class as a function")}var d=(function(){function p(g,u,m){c(this,p),this.canvas=g,this.encodings=u,this.options=m}return n(p,[{key:"render",value:function(){if(!this.canvas.getContext)throw new Error("The browser does not support canvas.");this.prepareCanvas();for(var u=0;u<this.encodings.length;u++){var m=(0,s.default)(this.options,this.encodings[u].options);this.drawCanvasBarcode(m,this.encodings[u]),this.drawCanvasText(m,this.encodings[u]),this.moveCanvasDrawing(this.encodings[u])}this.restoreCanvas()}},{key:"prepareCanvas",value:function(){var u=this.canvas.getContext("2d");u.save(),(0,i.calculateEncodingAttributes)(this.encodings,this.options,u);var m=(0,i.getTotalWidthOfEncodings)(this.encodings),b=(0,i.getMaximumHeightOfEncodings)(this.encodings);this.canvas.width=m+this.options.marginLeft+this.options.marginRight,this.canvas.height=b,u.clearRect(0,0,this.canvas.width,this.canvas.height),this.options.background&&(u.fillStyle=this.options.background,u.fillRect(0,0,this.canvas.width,this.canvas.height)),u.translate(this.options.marginLeft,0)}},{key:"drawCanvasBarcode",value:function(u,m){var b=this.canvas.getContext("2d"),x=m.data,v;u.textPosition=="top"?v=u.marginTop+u.fontSize+u.textMargin:v=u.marginTop,b.fillStyle=u.lineColor;for(var _=0;_<x.length;_++){var S=_*u.width+m.barcodePadding;x[_]==="1"?b.fillRect(S,v,u.width,u.height):x[_]&&b.fillRect(S,v,u.width,u.height*x[_])}}},{key:"drawCanvasText",value:function(u,m){var b=this.canvas.getContext("2d"),x=u.fontOptions+" "+u.fontSize+"px "+u.font;if(u.displayValue){var v,_;u.textPosition=="top"?_=u.marginTop+u.fontSize-u.textMargin:_=u.height+u.textMargin+u.marginTop+u.fontSize,b.font=x,u.textAlign=="left"||m.barcodePadding>0?(v=0,b.textAlign="left"):u.textAlign=="right"?(v=m.width-1,b.textAlign="right"):(v=m.width/2,b.textAlign="center"),b.fillText(m.text,v,_)}}},{key:"moveCanvasDrawing",value:function(u){var m=this.canvas.getContext("2d");m.translate(u.width,0)}},{key:"restoreCanvas",value:function(){var u=this.canvas.getContext("2d");u.restore()}}]),p})();return Yc.default=d,Yc}var Kc={},B1;function QN(){if(B1)return Kc;B1=1,Object.defineProperty(Kc,"__esModule",{value:!0});var n=(function(){function g(u,m){for(var b=0;b<m.length;b++){var x=m[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(u,x.key,x)}}return function(u,m,b){return m&&g(u.prototype,m),b&&g(u,b),u}})(),e=Pu(),s=o(e),i=Iv();function o(g){return g&&g.__esModule?g:{default:g}}function c(g,u){if(!(g instanceof u))throw new TypeError("Cannot call a class as a function")}var d="http://www.w3.org/2000/svg",p=(function(){function g(u,m,b){c(this,g),this.svg=u,this.encodings=m,this.options=b,this.document=b.xmlDocument||document}return n(g,[{key:"render",value:function(){var m=this.options.marginLeft;this.prepareSVG();for(var b=0;b<this.encodings.length;b++){var x=this.encodings[b],v=(0,s.default)(this.options,x.options),_=this.createGroup(m,v.marginTop,this.svg);this.setGroupOptions(_,v),this.drawSvgBarcode(_,v,x),this.drawSVGText(_,v,x),m+=x.width}}},{key:"prepareSVG",value:function(){for(;this.svg.firstChild;)this.svg.removeChild(this.svg.firstChild);(0,i.calculateEncodingAttributes)(this.encodings,this.options);var m=(0,i.getTotalWidthOfEncodings)(this.encodings),b=(0,i.getMaximumHeightOfEncodings)(this.encodings),x=m+this.options.marginLeft+this.options.marginRight;this.setSvgAttributes(x,b),this.options.background&&this.drawRect(0,0,x,b,this.svg).setAttribute("fill",this.options.background)}},{key:"drawSvgBarcode",value:function(m,b,x){var v=x.data,_;b.textPosition=="top"?_=b.fontSize+b.textMargin:_=0;for(var S=0,C=0,B=0;B<v.length;B++)C=B*b.width+x.barcodePadding,v[B]==="1"?S++:S>0&&(this.drawRect(C-b.width*S,_,b.width*S,b.height,m),S=0);S>0&&this.drawRect(C-b.width*(S-1),_,b.width*S,b.height,m)}},{key:"drawSVGText",value:function(m,b,x){var v=this.document.createElementNS(d,"text");if(b.displayValue){var _,S;v.setAttribute("font-family",b.font),v.setAttribute("font-size",b.fontSize),b.fontOptions.includes("bold")&&v.setAttribute("font-weight","bold"),b.fontOptions.includes("italic")&&v.setAttribute("font-style","italic"),b.textPosition=="top"?S=b.fontSize-b.textMargin:S=b.height+b.textMargin+b.fontSize,b.textAlign=="left"||x.barcodePadding>0?(_=0,v.setAttribute("text-anchor","start")):b.textAlign=="right"?(_=x.width-1,v.setAttribute("text-anchor","end")):(_=x.width/2,v.setAttribute("text-anchor","middle")),v.setAttribute("x",_),v.setAttribute("y",S),v.appendChild(this.document.createTextNode(x.text)),m.appendChild(v)}}},{key:"setSvgAttributes",value:function(m,b){var x=this.svg;x.setAttribute("width",m+"px"),x.setAttribute("height",b+"px"),x.setAttribute("x","0px"),x.setAttribute("y","0px"),x.setAttribute("viewBox","0 0 "+m+" "+b),x.setAttribute("xmlns",d),x.setAttribute("version","1.1")}},{key:"createGroup",value:function(m,b,x){var v=this.document.createElementNS(d,"g");return v.setAttribute("transform","translate("+m+", "+b+")"),x.appendChild(v),v}},{key:"setGroupOptions",value:function(m,b){m.setAttribute("fill",b.lineColor)}},{key:"drawRect",value:function(m,b,x,v,_){var S=this.document.createElementNS(d,"rect");return S.setAttribute("x",m),S.setAttribute("y",b),S.setAttribute("width",x),S.setAttribute("height",v),_.appendChild(S),S}}]),g})();return Kc.default=p,Kc}var Jc={},U1;function XN(){if(U1)return Jc;U1=1,Object.defineProperty(Jc,"__esModule",{value:!0});var n=(function(){function i(o,c){for(var d=0;d<c.length;d++){var p=c[d];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(o,p.key,p)}}return function(o,c,d){return c&&i(o.prototype,c),d&&i(o,d),o}})();function e(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")}var s=(function(){function i(o,c,d){e(this,i),this.object=o,this.encodings=c,this.options=d}return n(i,[{key:"render",value:function(){this.object.encodings=this.encodings}}]),i})();return Jc.default=s,Jc}var z1;function WN(){if(z1)return Vc;z1=1,Object.defineProperty(Vc,"__esModule",{value:!0});var n=JN(),e=d(n),s=QN(),i=d(s),o=XN(),c=d(o);function d(p){return p&&p.__esModule?p:{default:p}}return Vc.default={CanvasRenderer:e.default,SVGRenderer:i.default,ObjectRenderer:c.default},Vc}var Ki={},$1;function Hv(){if($1)return Ki;$1=1,Object.defineProperty(Ki,"__esModule",{value:!0});function n(d,p){if(!(d instanceof p))throw new TypeError("Cannot call a class as a function")}function e(d,p){if(!d)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:d}function s(d,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);d.prototype=Object.create(p&&p.prototype,{constructor:{value:d,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(d,p):d.__proto__=p)}var i=(function(d){s(p,d);function p(g,u){n(this,p);var m=e(this,(p.__proto__||Object.getPrototypeOf(p)).call(this));return m.name="InvalidInputException",m.symbology=g,m.input=u,m.message='"'+m.input+'" is not a valid input for '+m.symbology,m}return p})(Error),o=(function(d){s(p,d);function p(){n(this,p);var g=e(this,(p.__proto__||Object.getPrototypeOf(p)).call(this));return g.name="InvalidElementException",g.message="Not supported type to render on",g}return p})(Error),c=(function(d){s(p,d);function p(){n(this,p);var g=e(this,(p.__proto__||Object.getPrototypeOf(p)).call(this));return g.name="NoElementException",g.message="No element to render on.",g}return p})(Error);return Ki.InvalidInputException=i,Ki.InvalidElementException=o,Ki.NoElementException=c,Ki}var I1;function ZN(){if(I1)return Ic;I1=1,Object.defineProperty(Ic,"__esModule",{value:!0});var n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(m){return typeof m}:function(m){return m&&typeof Symbol=="function"&&m.constructor===Symbol&&m!==Symbol.prototype?"symbol":typeof m},e=KN(),s=d(e),i=WN(),o=d(i),c=Hv();function d(m){return m&&m.__esModule?m:{default:m}}function p(m){if(typeof m=="string")return g(m);if(Array.isArray(m)){for(var b=[],x=0;x<m.length;x++)b.push(p(m[x]));return b}else{if(typeof HTMLCanvasElement<"u"&&m instanceof HTMLImageElement)return u(m);if(m&&m.nodeName&&m.nodeName.toLowerCase()==="svg"||typeof SVGElement<"u"&&m instanceof SVGElement)return{element:m,options:(0,s.default)(m),renderer:o.default.SVGRenderer};if(typeof HTMLCanvasElement<"u"&&m instanceof HTMLCanvasElement)return{element:m,options:(0,s.default)(m),renderer:o.default.CanvasRenderer};if(m&&m.getContext)return{element:m,renderer:o.default.CanvasRenderer};if(m&&(typeof m>"u"?"undefined":n(m))==="object"&&!m.nodeName)return{element:m,renderer:o.default.ObjectRenderer};throw new c.InvalidElementException}}function g(m){var b=document.querySelectorAll(m);if(b.length!==0){for(var x=[],v=0;v<b.length;v++)x.push(p(b[v]));return x}}function u(m){var b=document.createElement("canvas");return{element:b,options:(0,s.default)(m),renderer:o.default.CanvasRenderer,afterRender:function(){m.setAttribute("src",b.toDataURL())}}}return Ic.default=p,Ic}var Qc={},H1;function eT(){if(H1)return Qc;H1=1,Object.defineProperty(Qc,"__esModule",{value:!0});var n=(function(){function i(o,c){for(var d=0;d<c.length;d++){var p=c[d];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(o,p.key,p)}}return function(o,c,d){return c&&i(o.prototype,c),d&&i(o,d),o}})();function e(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")}var s=(function(){function i(o){e(this,i),this.api=o}return n(i,[{key:"handleCatch",value:function(c){if(c.name==="InvalidInputException")if(this.api._options.valid!==this.api._defaults.valid)this.api._options.valid(!1);else throw c.message;else throw c;this.api.render=function(){}}},{key:"wrapBarcodeCall",value:function(c){try{var d=c.apply(void 0,arguments);return this.api._options.valid(!0),d}catch(p){return this.handleCatch(p),this.api}}}]),i})();return Qc.default=s,Qc}var md,F1;function tT(){if(F1)return md;F1=1;var n=GN(),e=B(n),s=Pu(),i=B(s),o=VN(),c=B(o),d=YN(),p=B(d),g=ZN(),u=B(g),m=zv(),b=B(m),x=eT(),v=B(x),_=Hv(),S=$v(),C=B(S);function B(U){return U&&U.__esModule?U:{default:U}}var q=function(){},ne=function(D,Q,W){var he=new q;if(typeof D>"u")throw Error("No element to render on was provided.");return he._renderProperties=(0,u.default)(D),he._encodings=[],he._options=C.default,he._errorHandler=new v.default(he),typeof Q<"u"&&(W=W||{},W.format||(W.format=ae()),he.options(W)[W.format](Q,W).render()),he};ne.getModule=function(U){return e.default[U]};for(var te in e.default)e.default.hasOwnProperty(te)&&M(e.default,te);function M(U,D){q.prototype[D]=q.prototype[D.toUpperCase()]=q.prototype[D.toLowerCase()]=function(Q,W){var he=this;return he._errorHandler.wrapBarcodeCall(function(){W.text=typeof W.text>"u"?void 0:""+W.text;var Ee=(0,i.default)(he._options,W);Ee=(0,b.default)(Ee);var Ae=U[D],H=z(Q,Ae,Ee);return he._encodings.push(H),he})}}function z(U,D,Q){U=""+U;var W=new D(U,Q);if(!W.valid())throw new _.InvalidInputException(W.constructor.name,U);var he=W.encode();he=(0,c.default)(he);for(var Ee=0;Ee<he.length;Ee++)he[Ee].options=(0,i.default)(Q,he[Ee].options);return he}function ae(){return e.default.CODE128?"CODE128":Object.keys(e.default)[0]}q.prototype.options=function(U){return this._options=(0,i.default)(this._options,U),this},q.prototype.blank=function(U){var D=new Array(U+1).join("0");return this._encodings.push({data:D}),this},q.prototype.init=function(){if(this._renderProperties){Array.isArray(this._renderProperties)||(this._renderProperties=[this._renderProperties]);var U;for(var D in this._renderProperties){U=this._renderProperties[D];var Q=(0,i.default)(this._options,U.options);Q.format=="auto"&&(Q.format=ae()),this._errorHandler.wrapBarcodeCall(function(){var W=Q.value,he=e.default[Q.format.toUpperCase()],Ee=z(W,he,Q);F(U,Ee,Q)})}}},q.prototype.render=function(){if(!this._renderProperties)throw new _.NoElementException;if(Array.isArray(this._renderProperties))for(var U=0;U<this._renderProperties.length;U++)F(this._renderProperties[U],this._encodings,this._options);else F(this._renderProperties,this._encodings,this._options);return this},q.prototype._defaults=C.default;function F(U,D,Q){D=(0,c.default)(D);for(var W=0;W<D.length;W++)D[W].options=(0,i.default)(Q,D[W].options),(0,p.default)(D[W].options);(0,p.default)(Q);var he=U.renderer,Ee=new he(U.element,D,Q);Ee.render(),U.afterRender&&U.afterRender()}return typeof window<"u"&&(window.JsBarcode=ne),typeof jQuery<"u"&&(jQuery.fn.JsBarcode=function(U,D){var Q=[];return jQuery(this).each(function(){Q.push(this)}),ne(Q,U,D)}),md=ne,md}var nT=tT();const rT=gS(nT),sT={[ke.EXECUTED]:"Executed",[ke.MATCHED_LIST]:"Matched list",[ke.CONFIRM_REQUIRED]:"Awaiting confirmation",[ke.NO_MATCH_FALLBACK]:"No match",[ke.UNCONFIGURED]:"Not configured",[ke.INVALID_CODE]:"Invalid code",[ke.FORBIDDEN]:"Not permitted",[ke.CONFLICT]:"Conflict",[ke.IDENTITY_PRIMED]:"Identity primed",[ke.IDENTITY_UNKNOWN]:"Badge not recognized",[ke.NOT_PRIMED]:"Badge required",[ke.CHOICES]:"Choices presented",[ke.NO_OPEN_CONTAINER]:"Container closing, scan again",[ke.HELD]:"Holding",[ke.REFUSED]:"Not placed",[ke.SUBJECT_STALE]:"Scan it again"},iT={[ke.EXECUTED]:"text-status-success",[ke.MATCHED_LIST]:"text-status-success",[ke.CONFIRM_REQUIRED]:"text-status-warning",[ke.NO_MATCH_FALLBACK]:"text-text-secondary",[ke.UNCONFIGURED]:"text-status-warning",[ke.INVALID_CODE]:"text-status-error",[ke.FORBIDDEN]:"text-status-error",[ke.CONFLICT]:"text-status-warning",[ke.IDENTITY_PRIMED]:"text-status-success",[ke.IDENTITY_UNKNOWN]:"text-status-warning",[ke.NOT_PRIMED]:"text-status-warning",[ke.CHOICES]:"text-status-success",[ke.NO_OPEN_CONTAINER]:"text-status-warning",[ke.HELD]:"text-status-success",[ke.REFUSED]:"text-status-error",[ke.SUBJECT_STALE]:"text-status-warning"};function aT(n){return n.outcome===ke.IDENTITY_PRIMED&&n.actor?`Hi ${n.actor.displayName}`:`${sT[n.outcome]}${n.rule?` — ${n.rule.name}`:""}`}function oT(n){var e,s,i,o,c,d,p;return n.outcome===ke.NO_MATCH_FALLBACK?((e=n.fallback)==null?void 0:e.markdown)??null:n.outcome===ke.IDENTITY_UNKNOWN?((s=n.fallback)==null?void 0:s.markdown)??null:n.outcome===ke.NOT_PRIMED?((i=n.notPrimed)==null?void 0:i.markdown)??null:n.outcome===ke.NO_OPEN_CONTAINER?((o=n.fallback)==null?void 0:o.markdown)??null:n.outcome===ke.REFUSED?((c=n.refusal)==null?void 0:c.markdown)??n.error??null:n.outcome===ke.HELD?((p=(d=n.subject)==null?void 0:d.expect)==null?void 0:p.prompt)??null:n.outcome===ke.SUBJECT_STALE?n.error??null:null}function gs(n){return n.replace(/`([^`]+)`/g,'<code class="px-1 py-0.5 bg-surface-sunken rounded text-xs font-mono">$1</code>').replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>").replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent-primary hover:underline" target="_blank" rel="noopener noreferrer">$1</a>')}function lT({content:n,compact:e,inherit:s}){const i=[],o=/^```(\w*)\n([\s\S]*?)^```$/gm;let c=0,d;for(;(d=o.exec(n))!==null;)d.index>c&&i.push({type:"text",text:n.slice(c,d.index)}),i.push({type:"code",lang:d[1],code:d[2].replace(/\n$/,"")}),c=d.index+d[0].length;c<n.length&&i.push({type:"text",text:n.slice(c)});const p=s?{text:"",heading:"",list:"",code:"text-[0.85em]",tone:""}:e?{text:"text-xs",heading:"text-xs",list:"text-xs",code:"text-2xs",tone:"text-text-secondary"}:{text:"text-sm",heading:"text-sm",list:"text-sm",code:"text-xs",tone:"text-text-secondary"},g=[];for(const u of i){if(u.type==="code"){const m=u.code.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");g.push(`<pre class="my-2 p-2.5 bg-surface-sunken rounded-md overflow-x-auto"><code class="${p.code} font-mono text-text-secondary leading-relaxed">${m}</code></pre>`);continue}g.push(...cT(u.text,p))}return h.jsx("div",{className:s?void 0:"prose-sm",dangerouslySetInnerHTML:{__html:g.join(`
55
+ `)}})}function cT(n,e){const s=n.split(`
56
+ `),i=[];let o=!1,c=!1,d=[];for(const p of s){const g=p.trim();if(g.startsWith("|")&&g.endsWith("|")){const u=g.slice(1,-1).split("|").map(m=>m.trim());if(u.every(m=>/^[-:]+$/.test(m)))continue;c||(c=!0,d=[]),d.push(u);continue}if(c){c=!1;const[u,...m]=d;i.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const b of u)i.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${gs(b)}</th>`);i.push("</tr></thead><tbody>");for(const b of m){i.push("<tr>");for(const x of b)i.push(`<td class="py-1 px-2 border-b border-border/50">${gs(x)}</td>`);i.push("</tr>")}i.push("</tbody></table></div>"),d=[]}if(!g){o&&(i.push("</ul>"),o=!1);continue}if(g.startsWith("### ")){o&&(i.push("</ul>"),o=!1),i.push(`<h4 class="${e.heading} font-semibold text-text-primary mt-3 mb-1">${gs(g.slice(4))}</h4>`);continue}if(g.startsWith("## ")){o&&(i.push("</ul>"),o=!1),i.push(`<h3 class="${e.heading} font-semibold text-text-primary mt-3 mb-1">${gs(g.slice(3))}</h3>`);continue}if(/^[-*_]{3,}$/.test(g)){o&&(i.push("</ul>"),o=!1),i.push('<hr class="border-border my-3" />');continue}if(/^[-*] /.test(g)){o||(i.push('<ul class="space-y-1 my-1">'),o=!0),i.push(`<li class="${e.list} ${e.tone} flex gap-2"><span class="text-text-tertiary shrink-0">-</span><span>${gs(g.slice(2))}</span></li>`);continue}o&&(i.push("</ul>"),o=!1),i.push(`<p class="${e.text} ${e.tone} my-1">${gs(g)}</p>`)}if(c&&d.length){const[p,...g]=d;i.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const u of p)i.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${gs(u)}</th>`);i.push("</tr></thead><tbody>");for(const u of g){i.push("<tr>");for(const m of u)i.push(`<td class="py-1 px-2 border-b border-border/50">${gs(m)}</td>`);i.push("</tr>")}i.push("</tbody></table></div>")}return o&&i.push("</ul>"),i}function Ym({result:n,compact:e=!1}){const{response:s}=n,i=e?"text-xs":"text-sm",o=s?oT(s):null,c=s!=null&&s.error&&s.error!==o?s.error:null;return h.jsxs("div",{className:"min-w-0",children:[h.jsx("div",{className:`${i} font-mono text-text-secondary truncate`,children:n.code}),s?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:`${i} font-medium ${iT[s.outcome]}`,children:aT(s)}),c&&h.jsx("div",{className:"text-xs text-text-tertiary mt-0.5",children:c}),o&&h.jsx("div",{className:"text-xs text-text-secondary mt-1.5",children:h.jsx(lT,{content:o,compact:!0})})]}):h.jsx("div",{className:`${i} text-status-error`,children:n.error})]})}function Fv(n){return n.replace(/[\u2010-\u2015\u2212]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u00A0/g," ").replace(/[\u200B-\u200D\uFEFF]/g,"").replace(/[\x00-\x1F\x7F]/g,"").trim()}function uT(n){const e=new Set;for(const s of n){const i=s.codePointAt(0);(i>127||i<32)&&e.add(`"${i<32?"\\x"+i.toString(16).padStart(2,"0"):s}" U+${i.toString(16).toUpperCase().padStart(4,"0")}`)}return[...e]}function fT({value:n}){const e=E.useRef(null),[s,i]=E.useState(!1);return E.useEffect(()=>{if(!(!e.current||!n))try{rT(e.current,n,{format:"CODE128",width:2,height:88,margin:12,displayValue:!0,fontSize:13,background:"#ffffff",lineColor:"#000000"}),i(!1)}catch{i(!0)}},[n]),n?h.jsxs("div",{children:[h.jsx("span",{className:"block text-xs uppercase tracking-wide text-text-tertiary mb-1",children:"Barcode"}),s?h.jsxs("p",{className:"text-xs text-status-error",children:["This value has characters Code 128 cannot carry:"," ",h.jsx("span",{className:"font-mono",children:uT(n).join(", ")||"unknown"})]}):h.jsx("div",{className:"bg-white rounded p-1 inline-block max-w-full overflow-hidden",children:h.jsx("svg",{ref:e,className:"max-w-full"})})]}):null}function hT({onClose:n}){const{submitCode:e,lastResult:s,busy:i,wedgeConfig:o,updateWedgeConfig:c,diagnostics:d,diagnosticsOn:p,setDiagnosticsOn:g}=Vm(),[u,m]=E.useState(""),[b,x]=E.useState(!1),v=_=>{_.preventDefault();const S=u.trim();S&&(m(""),e(S))};return h.jsxs("div",{className:"flex flex-col h-full",children:[h.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border",children:[h.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-text-primary",children:[h.jsx(Ro,{className:"w-4 h-4"}),"Scan"]}),h.jsx("button",{type:"button",onClick:n,className:"text-text-tertiary hover:text-text-primary",title:"Close",children:h.jsx(en,{className:"w-4 h-4"})})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-6",children:[h.jsxs("form",{onSubmit:v,className:"space-y-2",children:[h.jsx("label",{className:"block text-xs uppercase tracking-wide text-text-tertiary",children:"Enter a code"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx("input",{value:u,onChange:_=>m(Fv(_.target.value)),placeholder:"10:1:SN-12345",className:"flex-1 px-2 py-1.5 text-sm bg-surface-raised border border-surface-border rounded text-text-primary","data-scan-manual-entry":!0}),h.jsx("button",{type:"submit",disabled:i||!u.trim(),className:"px-3 py-1.5 text-sm rounded bg-accent text-text-inverse disabled:opacity-50",children:"Go"})]}),h.jsx("p",{className:"text-xs text-text-tertiary",children:"Scanning with a connected scanner works from any page — this entry exists for testing and for codes you can read but not scan. Typing here also draws the code below; point the scanner at the screen to fire it for real."})]}),h.jsx(fT,{value:u.trim()}),s&&h.jsxs("div",{className:"space-y-2",children:[h.jsx("div",{className:"text-xs uppercase tracking-wide text-text-tertiary",children:"Last scan"}),h.jsx(Ym,{result:s})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("button",{type:"button",onClick:()=>x(_=>!_),className:"text-xs uppercase tracking-wide text-text-tertiary hover:text-text-primary",children:["Capture settings ",b?"▾":"▸"]}),b&&h.jsxs("div",{className:"space-y-3",children:[h.jsxs("label",{className:"block text-sm text-text-primary",children:[h.jsx("span",{className:"block text-xs text-text-tertiary mb-1",children:"Key gap limit (ms) — a longer pause between keys starts a new capture; raise it for scanners that pace slowly"}),h.jsx("input",{type:"number",min:100,max:2e3,step:50,value:o.maxKeyGapMs,onChange:_=>c({maxKeyGapMs:Number(_.target.value)}),className:"w-24 px-2 py-1 text-sm bg-surface-raised border border-surface-border rounded"})]}),h.jsxs("label",{className:"flex items-center gap-2 text-sm text-text-primary",children:[h.jsx("input",{type:"checkbox",checked:p,onChange:_=>g(_.target.checked)}),h.jsx("span",{children:"Diagnostics — trace every keydown the capture sees (also logged to the console)"})]}),p&&h.jsxs("div",{className:"border border-surface-border rounded",children:[h.jsx("div",{className:"px-2 py-1.5 text-2xs uppercase tracking-wide text-text-tertiary border-b border-surface-border",children:"Keydown trace — scan now, newest last"}),h.jsxs("div",{className:"max-h-64 overflow-y-auto font-mono text-2xs leading-5 px-2 py-1",children:[d.length===0&&h.jsx("div",{className:"text-text-tertiary",children:"Waiting for keys…"}),d.map(_=>h.jsxs("div",{className:"whitespace-nowrap overflow-hidden text-ellipsis",title:`buffer: ${_.buffer}`,children:[h.jsxs("span",{className:"text-text-tertiary",children:[String(_.deltaMs).padStart(4),"ms "]}),h.jsx("span",{className:"text",children:JSON.stringify(_.key)}),_.code&&h.jsxs("span",{className:"text-text-tertiary",children:[" (",_.code,")"]}),h.jsxs("span",{className:"text-text-tertiary",children:[" — ",_.note]})]},_.seq))]}),h.jsxs("div",{className:"px-2 py-1.5 text-2xs text-text-tertiary border-t border-surface-border",children:["Read it like this: a scan should end with an"," ",h.jsx("span",{className:"font-mono",children:'"Enter"'})," row saying"," ",h.jsx("span",{className:"font-mono",children:"capture → …"}),'. An Enter row saying "no code tail" means the buffer split (raise the gap limit, or a key arrived as something other than one character). No Enter row at all means the scanner sends no suffix — program its Enter/CR suffix. Keys named'," ",h.jsx("span",{className:"font-mono",children:'"Unidentified"'})," mean the decode arrives outside the keydown path."]})]})]})]})]})]})}const Gv=/^\{lt:([A-Za-z0-9_]+)\}$/,G1="me";function rR(n){return`{lt:${n}}`}const Vv="lt:station:link-vars:";function sm(n){return`${Vv}${n}`}const im=new Set;function dT(){for(const n of im)n()}let Su,Xc={};function Yv(n){let e=null;try{e=localStorage.getItem(sm(n))}catch{e=null}if(e===Su)return Xc;Su=e;try{const s=e?JSON.parse(e):{};Xc=s&&typeof s=="object"&&!Array.isArray(s)?Object.fromEntries(Object.entries(s).filter(([,i])=>typeof i=="string")):{}}catch{Xc={}}return Xc}function mT(n,e,s){const i={...Yv(n)};s===null||s===""?delete i[e]:i[e]=s;try{Object.keys(i).length===0?localStorage.removeItem(sm(n)):localStorage.setItem(sm(n),JSON.stringify(i))}catch{}Su=void 0,dT()}function pT(n){im.add(n);const e=s=>{(s.key===null||s.key.startsWith(Vv))&&(Su=void 0,n())};try{window.addEventListener("storage",e)}catch{}return()=>{im.delete(n);try{window.removeEventListener("storage",e)}catch{}}}const yT={};function gT(n){return E.useSyncExternalStore(pT,()=>n?Yv(n):yT)}function bT(n,e,s,i={}){let o;try{o=new URL(n,"http://local")}catch{return n}const c=o.searchParams.get("facets");if(!c)return n;let d;try{const g=JSON.parse(c);if(!g||typeof g!="object"||Array.isArray(g))return n;d=g}catch{return n}let p=!1;for(const[g,u]of Object.entries(d)){if(typeof u!="string")continue;const m=Gv.exec(u);if(!m)continue;const b=i[m[1]]??e[m[1]]??s[m[1]];typeof b=="string"&&b!==""?d[g]=b:delete d[g],p=!0}return p?(Object.keys(d).length===0?o.searchParams.delete("facets"):o.searchParams.set("facets",JSON.stringify(d)),o.pathname+o.search):n}function sR(n){let e;try{e=new URL(n,"http://local")}catch{return[]}const s=e.searchParams.get("facets");if(!s)return[];try{const i=JSON.parse(s);if(!i||typeof i!="object"||Array.isArray(i))return[];const o=[];for(const c of Object.values(i)){if(typeof c!="string")continue;const d=Gv.exec(c);d&&!o.includes(d[1])&&o.push(d[1])}return o}catch{return[]}}function Km(){var v;const{user:n,isSuperAdmin:e,hasRoleType:s}=qt(),i=(n==null?void 0:n.userId)??null,o=e||s("admin"),c=E.useMemo(()=>new Set(((n==null?void 0:n.roles)??[]).map(_=>_.role)),[n]),{data:d}=Ru({enabled:o||c.size>0}),p=gT(i),g=((v=jA())==null?void 0:v.actorId)??i,u=E.useMemo(()=>{var C;const _=[],S=new Set;for(const B of(d==null?void 0:d.roles)??[]){if(!o&&!c.has(B.role))continue;const q=(C=B.properties)==null?void 0:C.link_variables;if(Array.isArray(q))for(const ne of q){const te=ne==null?void 0:ne.name;if(typeof te!="string"||te===""||te===G1||S.has(te))continue;S.add(te);const M=ne.label,z=ne.default;_.push({name:te,...typeof M=="string"&&M!==""?{label:M}:{},...typeof z=="string"&&z!==""?{default:z}:{},fromRole:B.role})}}return _},[d,c,o]),m=E.useMemo(()=>{const _={};for(const S of u)S.default!==void 0&&(_[S.name]=S.default);return _},[u]),b=E.useCallback(_=>bT(_,p,m,g?{[G1]:g}:{}),[p,m,g]),x=E.useCallback((_,S)=>{i&&mT(i,_,S)},[i]);return{declarations:u,values:p,defaults:m,resolveUrl:b,setValue:x}}function xT({open:n,onClose:e,title:s,children:i,maxWidth:o,closeOnBackdrop:c=!0}){return E.useEffect(()=>{if(!n)return;const d=p=>{p.key==="Escape"&&e()};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[n,e]),n?lm.createPortal(h.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[h.jsx("div",{className:"absolute inset-0 bg-text-primary/30",onClick:c?e:void 0}),h.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"lt-modal-title",className:`relative bg-surface-raised border border-surface-border rounded-lg shadow-xl w-full ${o??"max-w-md"} mx-4 max-h-[85vh] flex flex-col`,children:[h.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b shrink-0",children:[h.jsx("h2",{id:"lt-modal-title",className:"text-sm font-medium text-text-primary",children:s}),h.jsx("button",{onClick:e,"aria-label":"Close dialog",className:"text-text-tertiary hover:text-text-primary text-lg leading-none",children:"×"})]}),h.jsx("div",{className:"px-6 py-5 overflow-y-auto",children:i})]})]}),document.body):null}function vT({open:n,onClose:e}){const{declarations:s,values:i,setValue:o}=Km();return h.jsxs(xT,{open:n,onClose:e,title:"Link Variables",maxWidth:"max-w-lg",children:[h.jsx("p",{className:"text-2xs text-text-tertiary leading-relaxed mb-4",children:"Values bound on this device. Pinned links and the Pace Board open scoped to the value applied; an unbound variable falls back to the role's default, or applies no filter at all."}),h.jsx("div",{className:"divide-y divide-surface-border",children:s.map((c,d)=>h.jsx(_T,{declaration:c,value:i[c.name]??"",autoFocus:d===0,onChange:p=>o(c.name,p),onClear:()=>o(c.name,null),onEnter:e},c.name))}),s.length===0&&h.jsx("p",{className:"text-xs text-text-tertiary",children:"Your roles declare no link variables."}),s.length>0&&h.jsx("div",{className:"flex justify-end pt-4",children:h.jsx("button",{onClick:e,className:"px-3 py-1.5 text-xs rounded bg-accent text-text-inverse hover:bg-accent-hover transition-colors",children:"OK"})})]})}function _T({declaration:n,value:e,autoFocus:s,onChange:i,onClear:o,onEnter:c}){const d=E.useId(),{data:p}=fk(n.name),g=(p==null?void 0:p.values)??[];return h.jsxs("div",{className:"py-3 flex items-center gap-3","data-testid":"link-var-row",children:[h.jsxs("div",{className:"w-40 shrink-0 min-w-0",children:[h.jsx("p",{className:"text-xs font-mono text-text-primary truncate",title:n.name,children:n.name}),h.jsx("p",{className:"text-2xs text-text-quaternary truncate",title:`declared by ${n.fromRole}`,children:n.label??n.fromRole})]}),h.jsx("input",{type:"text",list:d,autoFocus:s,value:e,onChange:u=>i(u.target.value),onKeyDown:u=>{u.key==="Enter"&&c()},placeholder:n.default?`${n.default} (default)`:"no filter","aria-label":`Value for ${n.name}`,className:"input text-xs font-mono flex-1 min-w-0"}),h.jsx("datalist",{id:d,children:g.map(u=>h.jsx("option",{value:u},u))}),h.jsx("button",{onClick:o,disabled:e==="",title:`Clear ${n.name}`,className:"p-1 text-text-quaternary hover:text-status-error transition-colors disabled:opacity-30 disabled:cursor-not-allowed shrink-0",children:"×"})]})}const V1=["escalationId","workflowId"],wT=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Kv="lt:search:mode",ST="lt:search:facet",Lt={FACET:"facet",COMMAND:"command"};function ET(n,e){return{version:n.version,category:e.category,name:e.name,schemeName:n.name,targetFacet:n.target_facet,encoding:n.encoding,delimiter:n.delimiter,targetLength:n.target_length,patterns:n.patterns??[]}}function Mo(n){return n.encoding==="gtin"||n.encoding==="pattern"?"":n.encoding==="delimited"?`${n.version}${n.delimiter}${n.category}${n.delimiter}`:`${n.version}${n.category}`}function OT(n,e){if(n.encoding==="delimited")return AT(n,e)?{code:e}:{code:`${Mo(n)}${e}`};if(n.encoding==="pattern")return Tv(n.patterns,e)?{code:e}:{error:`${n.name} takes a code matching its patterns`};if(!/^[0-9]+$/.test(e))return{error:`${n.name} takes digits only`};if(n.encoding==="gtin")return{code:e};const s=n.targetLength;return s&&e.length!==s&&e.length!==s+1?{error:`${n.name} takes ${s} digits`}:{code:`${Mo(n)}${e}`}}function AT(n,e){const s=n.delimiter.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`^[1-9][0-9]${s}[0-9]${s}.+$`).test(e)}function jT(n,e){return n==="escalationId"||n==="workflowId"?null:mN(n,e)}function kT(n){return n.kind===Lt.FACET?n.facet:n.command.name}function NT(n){return n.kind===Lt.COMMAND?n.command.targetFacet:n.facet==="escalationId"?"Escalation id":n.facet==="workflowId"?"Workflow id":n.facet}function TT(n){return n.kind===Lt.FACET?{kind:Lt.FACET,facet:n.facet}:{kind:Lt.COMMAND,version:n.command.version,category:n.command.category}}function CT(n,e,s){if((n==null?void 0:n.kind)===Lt.FACET&&e.includes(n.facet))return{kind:Lt.FACET,facet:n.facet};if((n==null?void 0:n.kind)===Lt.COMMAND){const i=s.find(o=>o.version===n.version&&o.category===n.category);if(i)return{kind:Lt.COMMAND,command:i}}return e.length>0?{kind:Lt.FACET,facet:e[0]}:s.length>0?{kind:Lt.COMMAND,command:s[0]}:null}function MT(){try{const n=localStorage.getItem(Kv);if(n){const s=JSON.parse(n);if(s.kind===Lt.FACET&&typeof s.facet=="string"||s.kind===Lt.COMMAND&&typeof s.version=="number"&&typeof s.category=="string")return s}const e=localStorage.getItem(ST);return e?{kind:Lt.FACET,facet:e}:null}catch{return null}}function RT(n){try{localStorage.setItem(Kv,JSON.stringify(n))}catch{}}const Y1=5*6e4,DT=n=>({rules:n.map(e=>{var s;return((s=e.data)==null?void 0:s.rules)??null}),loading:n.some(e=>e.isLoading)});function LT(n){const e=Dv({enabled:n,staleTime:Y1}),s=E.useMemo(()=>{var d;return(((d=e.data)==null?void 0:d.schemes)??[]).filter(p=>p.enabled&&p.kind===aN.ACTION).sort((p,g)=>p.version-g.version)},[e.data]),{rules:i,loading:o}=bS({queries:s.map(d=>({queryKey:["scan-schemes",d.version,"actions"],queryFn:()=>ue(`/scan-codes/schemes/${d.version}/actions`),enabled:n,staleTime:Y1})),combine:DT});return{commands:E.useMemo(()=>s.flatMap((d,p)=>(i[p]??[]).filter(g=>g.enabled).sort((g,u)=>g.category.localeCompare(u.category)).map(g=>ET(d,g))),[s,i]),loading:e.isLoading||o}}const qT={escalationId:"opens the item",workflowId:"opens the run"};function PT({mode:n,facets:e,commands:s,onSelect:i,onOpenScanPanel:o}){const[c,d]=E.useState(!1),p=E.useRef(null);E.useEffect(()=>{if(!c)return;const x=_=>{p.current&&!p.current.contains(_.target)&&d(!1)},v=_=>{_.key==="Escape"&&d(!1)};return document.addEventListener("mousedown",x),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",v)}},[c]);const g=n.kind===Lt.COMMAND,u=g?`${n.command.schemeName} · ${n.command.name} — ${Mo(n.command)}<${n.command.targetFacet}>`:`Search by ${n.facet}`,m=BT(s),b=x=>{i(x),d(!1)};return h.jsxs("div",{ref:p,className:"relative h-full shrink-0",children:[h.jsxs("button",{type:"button",onClick:()=>d(x=>!x),"aria-expanded":c,"aria-haspopup":"listbox","aria-label":"Search or run as",title:u,className:"group flex items-center gap-1 h-full pl-2.5 pr-2 border-l border-surface-field-border hover:bg-surface-hover transition-colors rounded-r-[var(--lt-radius-field)]","data-testid":"search-mode",children:[h.jsx("span",{className:`text-2xs whitespace-nowrap truncate max-w-[9rem] ${g?"font-medium text-accent":"font-mono text-text-tertiary"}`,children:kT(n)}),h.jsx(cm,{className:`w-3 h-3 shrink-0 text-text-quaternary group-hover:text-accent transition-transform ${c?"rotate-180":""}`,strokeWidth:1.5})]}),c&&h.jsxs("div",{role:"listbox","aria-label":"Search or run as",className:"absolute z-50 top-full right-0 mt-1.5 min-w-[17rem] max-w-[24rem] max-h-[70vh] overflow-y-auto bg-surface-raised border border-surface-border rounded-md shadow-lg py-1",children:[e.length>0&&h.jsxs(h.Fragment,{children:[h.jsx(K1,{children:"Find"}),e.map(x=>h.jsx(J1,{label:x,mono:!0,note:qT[x]??"filters the list",active:!g&&n.facet===x,onClick:()=>b({kind:Lt.FACET,facet:x})},x))]}),m.map(({schemeName:x,targetFacet:v,items:_})=>h.jsxs("div",{children:[h.jsxs(K1,{note:v,children:["Run · ",x]}),_.map(S=>h.jsx(J1,{label:S.name,note:Mo(S),noteMono:!0,active:g&&n.command.version===S.version&&n.command.category===S.category,onClick:()=>b({kind:Lt.COMMAND,command:S})},`${S.version}:${S.category}`))]},x)),o&&h.jsxs(h.Fragment,{children:[h.jsx("hr",{className:"border-surface-border/60 my-1"}),h.jsxs("button",{type:"button",onClick:()=>{d(!1),o()},className:"w-full text-left px-3 py-1.5 flex items-center gap-2 text-xs text-accent hover:bg-surface-hover","data-testid":"search-mode-scan-panel",children:[h.jsx(Ro,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:1.5}),"Scanner settings and barcode preview"]})]})]})]})}function BT(n){const e=[];for(const s of n){const i=e.find(o=>o.schemeName===s.schemeName);i?i.items.push(s):e.push({schemeName:s.schemeName,targetFacet:s.targetFacet,items:[s]})}return e}function K1({children:n,note:e}){return h.jsxs("p",{className:"px-3 pt-2 pb-1 flex items-baseline gap-2 text-2xs font-semibold uppercase tracking-widest text-text-quaternary first:pt-1",children:[h.jsx("span",{className:"truncate",children:n}),e&&h.jsx("span",{className:"ml-auto font-mono font-normal normal-case tracking-normal shrink-0",children:e})]})}function J1({label:n,note:e,active:s,mono:i,noteMono:o,onClick:c}){return h.jsxs("button",{type:"button",role:"option","aria-selected":s,onClick:c,className:`w-full text-left pl-3 pr-3 py-1.5 flex items-baseline gap-3 border-l-2 transition-colors ${s?"border-accent bg-accent/10 text-accent":"border-transparent text-text-primary hover:bg-surface-hover"}`,children:[h.jsx("span",{className:`text-xs font-medium truncate ${i?"font-mono":""}`,children:n}),h.jsx("span",{className:`ml-auto text-2xs shrink-0 ${o?"font-mono tabular-nums":""} ${s?"text-accent/70":"text-text-quaternary"}`,children:e})]})}const UT=6e3;function zT({onOpenScanPanel:n}){const e=ri(),{data:s}=Hn(),i=Fm(),{submitCode:o,busy:c,lastResult:d}=Vm(),{commands:p}=LT(i),[g,u]=E.useState(""),[m,b]=E.useState(!1),[x,v]=E.useState(null),[_,S]=E.useState(null),[C,B]=E.useState(""),[q,ne]=E.useState(null),[te,M]=E.useState(MT),z=E.useRef(null),ae=E.useMemo(()=>{var ce;if(!((ce=s==null?void 0:s.search)!=null&&ce.enabled))return[];const J=(s.search.facets??[]).filter(pe=>!V1.includes(pe));return[...V1,...J]},[s]),F=E.useMemo(()=>CT(te,ae,p),[te,ae,p]),U=(d==null?void 0:d.source)===ra.TOOLBAR&&!d.navigated&&q!==d.at?d:null;E.useEffect(()=>{if(!U)return;const J=setTimeout(()=>ne(U.at),UT);return()=>clearTimeout(J)},[U]);const D=()=>{v(null),S(null),d&&ne(d.at)},Q=J=>{var pe;const ce=TT(J);M(ce),RT(ce),D(),(pe=z.current)==null||pe.focus()},W=(J,ce)=>{const pe=OT(J.command,Fv(ce));if("error"in pe){v(pe.error);return}u(""),o(pe.code,ra.TOOLBAR)},he=async(J,ce)=>{const pe=jT(J,ce);if(pe){u(""),e(pe);return}if(J==="escalationId"&&!wT.test(ce)){v("That is not a valid escalation id");return}b(!0);try{if(J==="escalationId")await ue(`/escalations/${encodeURIComponent(ce)}`),u(""),e(`/escalations/detail/${encodeURIComponent(ce)}`);else{const ge=await ue(`/escalations/by-workflow/${encodeURIComponent(ce)}`),Ce=(ge==null?void 0:ge.escalations)??[];Ce.length===1?(u(""),e(`/escalations/detail/${Ce[0].id}`)):(B(ce),S(Ce))}}catch{v(`No ${J==="escalationId"?"escalation":"workflow"} found for "${ce}"`)}finally{b(!1)}},Ee=()=>{const J=g.trim();!J||m||c||!F||(D(),F.kind===Lt.COMMAND?W(F,J):he(F.facet,J))};if(!F)return null;const Ae=F.kind===Lt.COMMAND,H=m||c;return h.jsxs("div",{className:"relative w-full max-w-[28rem]","data-testid":"global-search",children:[h.jsxs("div",{className:"flex items-center h-8 bg-surface-field border border-surface-field-border rounded-[var(--lt-radius-field)] focus-within:border-accent focus-within:bg-surface-field-focus transition-colors",children:[h.jsxs("label",{htmlFor:"global-search-input",className:"flex items-center gap-1.5 pl-2.5 shrink-0 cursor-text",children:[Ae?h.jsx(Ro,{className:"w-3.5 h-3.5 text-accent/65",strokeWidth:1.5}):h.jsx(jS,{className:"w-3.5 h-3.5 text-text-quaternary",strokeWidth:1.5}),Ae&&h.jsx("span",{className:"font-mono text-xs tabular-nums text-text-tertiary select-none","data-testid":"search-command-prefix",children:Mo(F.command)})]}),h.jsx("input",{ref:z,id:"global-search-input",type:"text",value:g,onChange:J=>{u(J.target.value),D()},onKeyDown:J=>{J.key==="Enter"&&Ee(),J.key==="Escape"&&(u(""),D())},placeholder:NT(F),"aria-label":Ae?"Run target":"Global search",autoComplete:"off",spellCheck:!1,className:`flex-1 min-w-0 h-full bg-transparent text-xs text-text-primary placeholder:text-text-quaternary focus:outline-none ${Ae?"pl-0.5 pr-2 font-mono":"px-2"}`}),H&&h.jsx("span",{className:"w-1.5 h-1.5 mr-2 rounded-full bg-accent animate-pulse shrink-0","aria-label":"Working"}),h.jsx(PT,{mode:F,facets:ae,commands:p,onSelect:Q,onOpenScanPanel:n})]}),x&&h.jsx("p",{className:"absolute top-full left-0 mt-1 text-2xs text-status-error whitespace-nowrap",role:"alert",children:x}),U&&h.jsx("div",{role:"status",className:"absolute top-full left-0 mt-1.5 z-50 w-full max-w-96 bg-surface-raised border border-surface-border rounded-md shadow-lg px-3 py-2 animate-fade-in","data-testid":"search-run-outcome",children:h.jsx(Ym,{result:U,compact:!0})}),_!==null&&h.jsxs("div",{className:"absolute top-full left-0 mt-1.5 z-50 min-w-72 max-w-96 bg-surface-raised border border-surface-border rounded-md shadow-lg py-1","data-testid":"search-workflow-results",children:[_.map(J=>h.jsxs(ar,{to:`/escalations/detail/${J.id}`,onClick:()=>{S(null),u("")},className:"block px-3 py-1.5 text-xs text-text-secondary hover:bg-surface-hover truncate",children:[h.jsx("span",{className:"font-medium text-text-primary",children:J.role}),h.jsx("span",{className:"mx-1.5 text-text-quaternary",children:"·"}),J.status,h.jsx("span",{className:"mx-1.5 text-text-quaternary",children:"·"}),h.jsx("span",{className:"text-text-tertiary",children:J.type})]},J.id)),_.length===0&&h.jsx("p",{className:"px-3 py-1.5 text-2xs text-text-tertiary",children:"No escalations for this workflow."}),h.jsx("hr",{className:"border-surface-border/60 my-0.5"}),h.jsx(ar,{to:`/workflows/executions/${encodeURIComponent(C)}`,onClick:()=>{S(null),u("")},className:"block px-3 py-1.5 text-xs text-accent hover:bg-surface-hover",children:"Workflow execution →"})]})]})}function $T(){const{identity:n,remainingSeconds:e}=Mu(),[,s]=E.useState(0);return E.useEffect(()=>{if(!(n!=null&&n.expiresAt))return;const i=setInterval(()=>s(o=>o+1),1e3);return()=>clearInterval(i)},[n]),e()}function IT(n){return n>=60?`${Math.floor(n/60)} min`:`${n} s`}function HT(){const{identity:n}=Mu(),e=$T();return n?h.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-text-secondary whitespace-nowrap min-w-0",title:`Scans act as ${n.displayName}`,"data-testid":"badge-grant-indicator",children:[h.jsx(kS,{className:"w-4 h-4 text-status-success shrink-0",strokeWidth:1.5}),h.jsx("span",{className:"hidden sm:inline",children:"Badged:"}),h.jsx("span",{className:"font-medium text-text-primary truncate max-w-[10rem]",children:n.displayName}),n.expiresAt&&h.jsxs("span",{className:"tabular-nums text-text-tertiary","data-testid":"badge-grant-remaining",children:["· ",IT(e)]})]}):null}function FT(n){return n.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").split(/[-_\s]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function am(n){var e;return((e=n.title)==null?void 0:e.trim())||FT(n.role)}const Jv="lt:bookmarks",Wc="scan";function GT(){try{const n=localStorage.getItem(Jv);if(!n)return[];const e=JSON.parse(n);return Array.isArray(e)?e:[]}catch{return[]}}function Q1(n){try{localStorage.setItem(Jv,JSON.stringify(n))}catch{}}function VT({onToggleEventFeed:n,onToggleDocs:e,onToggleNav:s}){var Be,zt,Mt,tt;const i=ri(),{user:o,logout:c,isSuperAdmin:d,hasRoleType:p}=qt(),{viewAs:g,realIsBuilder:u}=sv(),{available:m,mine:b}=bk();iv();const{connected:x}=Ux(),{data:v}=Hn(),{role:_,targets:S,selectable:C,selectRole:B}=Lm(),{declarations:q,values:ne}=Km(),[te,M]=E.useState(!1),{data:z}=Ru(),ae=E.useMemo(()=>{const ye=(z==null?void 0:z.roles)??[],Le=new Set(((o==null?void 0:o.roles)??[]).map(At=>At.role)),yt=d||p("admin");return ye.filter(At=>na(At).length>0&&(yt||Le.has(At.role))).map(At=>({role:At.role,title:am(At),portals:na(At)}))},[z,o,d,p]),{setPanel:F,closePanel:U,open:D,ownerKey:Q}=Um(),W=Fm(),he=tn(),Ee=()=>{D&&Q===Wc?U(Wc):F(h.jsx(hT,{onClose:()=>U(Wc)}),{width:360,key:Wc})},[Ae,H]=E.useState(!1),[J,ce]=E.useState(!1),[pe,ge]=E.useState(Av),[Ce,Ne]=E.useState(GT),Me=E.useRef(null),Xe=(Be=v==null?void 0:v.branding)==null?void 0:Be.appName,pt=(zt=v==null?void 0:v.branding)==null?void 0:zt.themes,Ot=E.useMemo(()=>(Dk(pt??[]),Lk()),[pt]),mt=ye=>{qk(ye),ge(ye)},_e=()=>{const ye=window.prompt("Bookmark label:");if(!(ye!=null&&ye.trim()))return;const Le=he.pathname+he.search,yt=[...Ce,{label:ye.trim(),url:Le}].sort((At,Ur)=>At.label.localeCompare(Ur.label));Ne(yt),Q1(yt),H(!1)},oe=ye=>{const Le=Ce.filter(yt=>!(yt.label===ye.label&&yt.url===ye.url));Ne(Le),Q1(Le)};return E.useEffect(()=>{if(!Ae)return;const ye=Le=>{Me.current&&!Me.current.contains(Le.target)&&H(!1)};return document.addEventListener("mousedown",ye),()=>document.removeEventListener("mousedown",ye)},[Ae]),h.jsxs(h.Fragment,{children:[h.jsxs("header",{className:`h-14 shrink-0 border-b border-surface-border bg-surface-raised flex items-center justify-between pl-2 pr-5 relative ${Ae?"z-[100]":"z-30"}`,children:[h.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[s&&h.jsx("button",{onClick:s,className:"lg:hidden p-2 text-text-secondary hover:text-text-primary transition-colors","aria-label":"Open navigation",children:h.jsx(NS,{className:"w-5 h-5",strokeWidth:1.5})}),h.jsx(ar,{to:"/","aria-label":"Home",className:"shrink-0 hidden lg:block",onClick:ye=>{(ye.ctrlKey||ye.metaKey)&&(ye.preventDefault(),ce(!0))},children:h.jsx(Du,{appName:Xe,className:"flex"})}),h.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border mx-1"}),h.jsx("button",{onClick:()=>i(-1),className:"p-2 text-accent/60 hover:text-accent transition-colors","aria-label":"Go back",children:h.jsx(hx,{className:"w-5 h-5",strokeWidth:2})}),h.jsx("button",{onClick:()=>i(1),className:"p-2 text-accent/60 hover:text-accent transition-colors","aria-label":"Go forward",children:h.jsx(xd,{className:"w-5 h-5",strokeWidth:2})})]}),(((Mt=v==null?void 0:v.search)==null?void 0:Mt.enabled)||W)&&h.jsx("div",{className:"hidden md:flex flex-1 min-w-0 justify-center px-4 lg:px-8",children:h.jsx(zT,{onOpenScanPanel:W?Ee:void 0})}),h.jsxs("div",{className:"flex items-center gap-5 shrink-0",children:[h.jsx(HT,{}),h.jsxs(ar,{to:"/escalations/available",className:`flex items-center gap-1.5 text-xs transition-colors ${m>0?"text-status-queued":"text-text-quaternary hover:text-text-secondary"}`,title:"All escalations",children:[h.jsx(vd,{className:"w-4 h-4",strokeWidth:1.5}),h.jsx("span",{className:"hidden lg:inline",children:"all"}),m>0&&h.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:m})]}),h.jsxs(ar,{to:"/escalations/queue",className:`flex items-center gap-1.5 text-xs transition-colors ${b>0?"text-status-claimed":"text-text-quaternary hover:text-text-secondary"}`,title:"My escalation queue",children:[h.jsx(vd,{className:"w-4 h-4",strokeWidth:1.5}),h.jsx("span",{className:"hidden lg:inline",children:"mine"}),b>0&&h.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:b})]}),g&&h.jsx(h.Fragment,{children:h.jsxs("span",{className:"hidden lg:flex items-center gap-1 pl-2 pr-1 py-0.5 rounded-full bg-accent/10 border border-accent/25 text-2xs text-accent select-none",children:[h.jsxs("span",{className:"capitalize font-medium tracking-wide",children:[g," View"]}),h.jsx("button",{onClick:Kd,title:"Restore your real view",className:"ml-0.5 rounded-full p-0.5 hover:bg-accent/20 transition-colors",children:h.jsx(en,{className:"w-2.5 h-2.5"})})]})}),h.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border"}),o&&h.jsxs("div",{className:"relative",ref:Me,children:[h.jsxs("button",{onClick:()=>H(ye=>!ye),className:"btn-ghost flex items-center gap-1",children:[h.jsxs("span",{className:"relative",children:[h.jsx(TS,{className:"w-4 h-4 text-accent/75",strokeWidth:1.5}),g&&h.jsx("span",{className:"lg:hidden absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-accent"})]}),h.jsx("span",{className:"hidden lg:inline whitespace-nowrap",children:o.displayName||o.username||o.userId}),h.jsx("svg",{className:"hidden lg:block w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),Ae&&h.jsxs("div",{className:"absolute right-0 top-full mt-1 w-52 bg-surface-raised border border-surface-border rounded-md shadow-lg py-1 z-[100]",children:[h.jsx(ar,{to:"/credentials",onClick:()=>H(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Credentials"}),((tt=v==null?void 0:v.auth)==null?void 0:tt.oauthServer)&&h.jsx(ar,{to:"/connected-apps",onClick:()=>H(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Connected apps"}),W&&h.jsx("button",{onClick:()=>{H(!1),Ee()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover","data-testid":"menu-scan",children:"Scan a code"}),h.jsx("button",{onClick:()=>{H(!1),x?n==null||n():window.location.reload()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:x?"Events":"Reconnect events"}),u&&h.jsx("button",{onClick:()=>{H(!1),e==null||e()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover","data-testid":"menu-docs",children:"Docs"}),g&&h.jsxs("button",{onClick:()=>{H(!1),Kd()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-accent hover:bg-surface-hover capitalize",children:["Exit ",g," view"]}),h.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Theme"}),h.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:Ot.map(ye=>h.jsx("button",{type:"button",onClick:()=>mt(ye.id),title:ye.label,"aria-label":`${ye.label} theme`,className:`w-4 h-4 rounded-full transition-transform hover:scale-110 ${pe===ye.id?"ring-2 ring-offset-1 ring-surface-border":""}`,style:{backgroundColor:ye.swatch}},ye.id))})]}),C&&h.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Station queue"}),h.jsxs("div",{className:"flex flex-col",children:[h.jsxs("button",{type:"button",onClick:()=>{H(!1),B(null),i("/")},className:`flex items-center gap-2 -mx-1 px-1 py-1 text-xs text-left rounded hover:bg-surface-hover ${_?"text-text-secondary":"text-accent"}`,children:[h.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${_?"bg-surface-border":"bg-accent"}`}),h.jsx("span",{className:"truncate",children:"Full dashboard"})]}),S.map(ye=>{var At;const Le=(At=z==null?void 0:z.roles)==null?void 0:At.find(Ur=>Ur.role===ye),yt=ye===_;return h.jsxs("button",{type:"button",onClick:()=>{H(!1),B(ye),i(pv(ye,na(Le)))},className:`flex items-center gap-2 -mx-1 px-1 py-1 text-xs text-left rounded hover:bg-surface-hover ${yt?"text-accent":"text-text-secondary"}`,children:[h.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${yt?"bg-accent":"bg-surface-border"}`}),h.jsx("span",{className:"truncate",children:am({role:ye,title:Le==null?void 0:Le.title})})]},ye)})]})]}),ae.length>0&&h.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60","data-testid":"menu-portals",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Portals"}),h.jsx("div",{className:"flex flex-col gap-1.5",children:ae.map(ye=>h.jsxs("div",{children:[ae.length>1&&h.jsx("p",{className:"text-2xs text-text-quaternary truncate",title:ye.role,children:ye.title}),ye.portals.map(Le=>{const yt=Dm(ye.role,Le.key),At=he.pathname===yt;return h.jsxs("button",{type:"button",onClick:()=>{H(!1),i(yt)},className:`flex items-center gap-2 -mx-1 px-1 py-1 w-full text-xs text-left rounded hover:bg-surface-hover ${At?"text-accent":"text-text-secondary"}`,"data-testid":`menu-portal-${ye.role}-${Le.key}`,children:[h.jsx(_d,{className:"w-3.5 h-3.5 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{className:"truncate",children:Le.label})]},Le.key)})]},ye.role))})]}),q.length>0&&h.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Link variables"}),h.jsxs("button",{type:"button",onClick:()=>{H(!1),M(!0)},className:"flex items-center gap-2 -mx-1 px-1 py-1 w-full text-xs text-left rounded text-text-secondary hover:bg-surface-hover","data-testid":"link-vars-menu-entry",children:[h.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${Object.keys(ne).length>0?"bg-accent":"bg-surface-border"}`}),h.jsx("span",{className:"truncate",children:Object.keys(ne).length>0?Object.entries(ne).map(([ye,Le])=>`${ye} = ${Le}`).join(", "):"Set values for this device"})]})]}),h.jsx("button",{onClick:()=>{H(!1),c()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Sign Out"}),h.jsxs("div",{className:"border-t border-surface-border/60 pt-1",children:[Ce.map(ye=>h.jsxs("div",{className:"flex items-center group px-3 py-1.5 hover:bg-surface-hover",children:[h.jsx(ar,{to:ye.url,onClick:()=>H(!1),title:ye.url,className:"flex-1 min-w-0 text-xs text-text-secondary hover:text-text-primary truncate",children:ye.label}),h.jsx("button",{type:"button",onClick:()=>oe(ye),title:`Remove "${ye.label}"`,className:"opacity-0 group-hover:opacity-100 transition-opacity ml-1 p-0.5 shrink-0 text-text-quaternary hover:text-status-error",children:h.jsx(en,{className:"w-3 h-3"})})]},`${ye.label}::${ye.url}`)),h.jsx("hr",{className:"border-surface-border/60 mx-3 my-0.5"}),h.jsxs("button",{type:"button",onClick:_e,className:"flex items-center gap-1.5 w-full px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:[h.jsx(CS,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:1.5}),"Add Bookmark"]})]})]})]})]})]}),J&&h.jsx(Rk,{onClose:()=>ce(!1)}),h.jsx(vT,{open:te,onClose:()=>M(!1)})]})}function Jm({open:n,children:e}){const[s,i]=E.useState(n);return E.useEffect(()=>{n&&i(!0)},[n]),h.jsx("div",{className:`grid transition-[grid-template-rows] duration-300 ease-out ${n?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,onTransitionEnd:()=>{n||i(!1)},children:h.jsx("div",{className:"overflow-hidden",children:s?e:null})})}function om(n){return({isActive:e})=>{const s="flex items-center rounded-md transition-colors duration-150",i="bg-surface-hover text-text-primary font-medium",o="text-text-secondary hover:text-text-primary hover:bg-surface-hover";return n?`${s} justify-center w-10 h-10 mx-auto ${e?i:o}`:`${s} gap-3 px-4 py-2 text-sm ${e?i:o}`}}function YT(){return({isActive:n})=>`flex items-center gap-3 pl-11 pr-4 py-1.5 text-xs rounded-md transition-colors duration-150 ${n?"text-text-primary font-medium":"text-text-secondary hover:text-text-primary"}`}function KT({group:n,collapsed:e}){const{pathname:s}=tn(),i=n.matchPaths.some(p=>s.startsWith(p)),[o,c]=E.useState(i),d=o||i;return e?h.jsx(h.Fragment,{children:n.items.map(p=>h.jsx(As,{to:p.to,className:om(!0),title:p.label,children:p.icon&&h.jsx(p.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})},p.to))}):h.jsxs("div",{children:[h.jsxs("button",{onClick:()=>c(p=>!p),className:"w-full flex items-center justify-between px-4 py-2 text-sm rounded-md transition-colors duration-150 text-text-secondary hover:text-text-primary hover:bg-surface-hover",children:[h.jsxs("span",{className:"flex items-center gap-3",children:[n.icon&&h.jsx(n.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{children:n.label})]}),h.jsx("svg",{className:`w-3.5 h-3.5 text-text-tertiary transition-transform duration-150 ${d?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),h.jsx(Jm,{open:d,children:n.items.map(p=>h.jsxs(As,{to:p.to,end:p.end,className:YT(),children:[p.icon&&h.jsx(p.icon,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{children:p.label})]},p.to))})]})}function JT(n){return n.kind==="group"}function QT({entry:n,collapsed:e}){const{pathname:s,search:i}=tn(),o=n.to.includes("?"),c=n.icon&&h.jsx(n.icon,{className:`w-5 h-5 shrink-0 text-accent/75 ${n.iconClassName??""}`,strokeWidth:1.5,...n.solid?{fill:"currentColor"}:{}});if(o){const[d,p]=n.to.split("?"),g=s===d&&i===`?${p}`,u=om(e)({isActive:g});return h.jsxs(As,{to:n.to,className:u,title:e?n.label:void 0,children:[c,!e&&h.jsx("span",{children:n.label})]})}return h.jsxs(As,{to:n.to,end:n.end,className:om(e),title:e?n.label:void 0,children:[c,!e&&h.jsx("span",{children:n.label})]})}function qr({heading:n,entries:e}){const{collapsed:s}=Pm();return h.jsxs("div",{className:"space-y-1",children:[s?h.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:n}):h.jsx("p",{className:"px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-text-tertiary",children:n}),e.map(i=>JT(i)?h.jsx(KT,{group:i,collapsed:s},i.label):h.jsx(QT,{entry:i,collapsed:s},i.to))]})}function XT({aiEnabled:n=!1,isBuilder:e=!1,isOps:s=!1,viewAs:i=null,canSeePaceBoard:o=!1,showLines:c=!1}){const d=[{to:"/pace",label:"Pace Board",icon:MS},{to:"/trends",label:"Trend Board",icon:RS}],p=c?[{to:"/lines",label:"Lines",icon:DS}]:[];if(!e&&(!s||i==="engineer"||i==="operator"))return o?h.jsx(qr,{heading:"Monitor",entries:d}):null;if(!e)return h.jsx(qr,{heading:"Monitor",entries:[...o?d:[],...p]});const g=[...o?d:[],...p,{to:"/topics",label:"Event Topics",icon:dx},{to:"/agents",label:n?"Agents":"Automations",icon:LS},{to:"/capabilities",label:"Capabilities",icon:qS}];return h.jsx(qr,{heading:"Monitor",entries:g})}function WT(){return qe({queryKey:["me","preferences"],queryFn:()=>ue("/me/preferences"),staleTime:6e4})}function ZT(){const n=Pe();return Ie({mutationFn:e=>ue("/me/preferences",{method:"PATCH",body:JSON.stringify(e)}),onSuccess:e=>{n.setQueryData(["me","preferences"],e)}})}const xs={TABLE:"table",RICH:"rich",TIMELINE:"timeline"},X1={COMPACT:"compact",CARDS:"cards"},pd={AVAILABLE:"/escalations/available",ALL:"/escalations"},sa={AVAILABLE:"available",CLAIMED:"claimed",RESOLVED:"resolved",CANCELLED:"cancelled",EXPIRED:"expired"},eC={[sa.RESOLVED]:"resolved",[sa.CANCELLED]:"cancelled",[sa.EXPIRED]:"expired"};function tC(n){const e=n===sa.CLAIMED;return{available:n===sa.AVAILABLE,claimed:e,apiStatus:e?"pending":eC[n]}}function nC(n){return n===xs.TABLE||n===xs.RICH||n===xs.TIMELINE}function rC(n){return n===X1.COMPACT||n===X1.CARDS}function sC(n,e=""){const s=n.get("priority"),i=n.get("view"),o=n.get("layout");return{statusFilter:n.get("status")||e,role:n.get("role")||void 0,type:n.get("type")||void 0,subtype:n.get("subtype")||void 0,priority:s?parseInt(s,10):void 0,search:n.get("search")||void 0,facets:hN(n),view:nC(i)?i:null,layout:rC(o)?o:null}}function iC(n){let e;try{e=new URL(n,"http://local")}catch{return null}if(e.pathname!==pd.AVAILABLE&&e.pathname!==pd.ALL)return null;const s=e.pathname===pd.AVAILABLE?sa.AVAILABLE:"";return sC(e.searchParams,s)}function iR(n){var e;return n.role||(((e=n.facets.roles)==null?void 0:e.length)===1?n.facets.roles[0]:null)}function aR(n,e){return n===xs.TIMELINE?xs.TIMELINE:e&&(!n||n===xs.RICH)?xs.RICH:xs.TABLE}function aC(n,e){const s=(n==null?void 0:n.pinnedViews)??[],i=new Set((n==null?void 0:n.hiddenRolePins)??[]),o=new Set(s.map(p=>p.label)),c=[...s],d=new Set;for(const{role:p,pins:g}of e)for(const u of g)o.has(u.label)||i.has(u.label)||d.has(u.label)||(d.add(u.label),c.push({...u,id:`role:${p}:${u.label}`,fromRole:p}));return c}function oC(n){const e=iC(n);if(!e)return null;const{available:s,claimed:i,apiStatus:o}=tC(e.statusFilter);return{available:s,params:{...e.facets,role:e.role,type:e.type,subtype:e.subtype,priority:e.priority,status:o,...i?{claimed:!0}:{},search:e.search}}}function lC(){return`pin-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function cC(){var U;const{collapsed:n}=Pm(),{user:e}=qt(),s=WT(),i=ZT(),o=E.useMemo(()=>new Set(((e==null?void 0:e.roles)??[]).map(D=>D.role)),[e]),{data:c}=Ru({enabled:o.size>0}),d=nn("SUMMARY");Ns(Cm(),()=>{d([["escalations"]])});const p=(U=s.data)==null?void 0:U.preferences,g=E.useMemo(()=>((c==null?void 0:c.roles)??[]).filter(D=>o.has(D.role)&&Array.isArray(D.default_pins)&&D.default_pins.length>0).map(D=>({role:D.role,pins:D.default_pins})),[c,o]),{resolveUrl:u}=Km(),m=E.useMemo(()=>aC(p,g),[p,g]),b=E.useMemo(()=>new Map(m.map(D=>[D.id,D.url])),[m]),x=E.useMemo(()=>m.map(D=>({...D,url:u(D.url)})),[m,u]),v=E.useMemo(()=>new Map(((c==null?void 0:c.roles)??[]).map(D=>[D.role,am(D)])),[c]),_=E.useMemo(()=>x.filter(D=>!D.fromRole),[x]),S=E.useMemo(()=>new Set(((c==null?void 0:c.roles)??[]).filter(D=>o.has(D.role)&&nk(D)).map(D=>D.role)),[c,o]),C=E.useMemo(()=>((c==null?void 0:c.roles)??[]).filter(D=>S.has(D.role)||g.some(Q=>Q.role===D.role)).map(D=>({role:D.role,title:v.get(D.role)??D.role,portals:S.has(D.role)?na(D):[],pins:x.filter(Q=>Q.fromRole===D.role)})).filter(D=>D.portals.length>0||D.pins.length>0),[c,g,S,v,x]),B=(p==null?void 0:p.pinnedViews)??[],q=E.useRef(null),ne=D=>i.mutate({pinnedViews:D}),te=D=>ne(B.filter(Q=>Q.id!==D)),M=D=>ne([...B,{id:lC(),label:D.label,url:b.get(D.id)??D.url,badge:D.badge}]),z=D=>i.mutate({hiddenRolePins:[...(p==null?void 0:p.hiddenRolePins)??[],D]}),ae=(D,Q)=>{if(D===Q)return;const W=[...B],[he]=W.splice(D,1);W.splice(Q,0,he),ne(W)};if(x.length===0&&S.size===0)return null;const F="px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-text-tertiary truncate";return h.jsxs("div",{className:"space-y-1",children:[n&&h.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:"Pinned"}),!n&&_.length>0&&h.jsx("p",{className:F,children:"Pinned"}),_.map(D=>{const Q=B.findIndex(W=>W.id===D.id);return h.jsx(W1,{pin:D,collapsed:n,draggable:Q!==-1,onDragStart:()=>{q.current=Q},onDropOn:()=>{q.current!==null&&Q!==-1&&ae(q.current,Q),q.current=null},onRemove:()=>te(D.id)},D.id)}),C.map(D=>h.jsxs("div",{children:[!n&&h.jsx("p",{className:F,title:`${D.title} — pins from the ${D.role} role`,"data-testid":"pin-group-label",children:D.title}),D.portals.map(Q=>h.jsx(uC,{role:D.role,portal:Q,collapsed:n},Q.key)),D.pins.map(Q=>h.jsx(W1,{pin:Q,collapsed:n,draggable:!1,onDragStart:()=>{},onDropOn:()=>{},onPromote:()=>M(Q),onHide:()=>z(Q.label)},Q.id))]},D.role))]})}function uC({role:n,portal:e,collapsed:s}){const i=Dm(n,e.key),o="flex items-center rounded-md transition-colors duration-150 text-text-secondary hover:text-text-primary hover:bg-surface-hover",c=`portal-link-${n}-${e.key}`;return s?h.jsx(As,{to:i,className:`${o} justify-center w-10 h-10 mx-auto`,title:e.label,"data-testid":c,children:h.jsx(_d,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})}):h.jsxs(As,{to:i,title:e.label,className:({isActive:d})=>`${o} gap-2.5 pl-4 pr-3 py-1.5 text-[0.7875rem] ${d?"bg-surface-hover text-text-primary font-medium":""}`,"data-testid":c,children:[h.jsx(_d,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{className:"truncate flex-1 min-w-0",children:e.label})]})}function W1({pin:n,collapsed:e,draggable:s,onDragStart:i,onDropOn:o,onRemove:c,onPromote:d,onHide:p}){const{pathname:g,search:u}=tn(),[m,b=""]=n.url.split("?"),x=g===m&&u===(b?`?${b}`:""),v="group flex items-center rounded-md transition-colors duration-150",_=x?"bg-surface-hover text-text-primary font-medium":"text-text-secondary hover:text-text-primary hover:bg-surface-hover";return e?h.jsx(As,{to:n.url,className:`${v} ${_} justify-center w-10 h-10 mx-auto`,title:n.label,children:h.jsx(qg,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})}):h.jsxs("div",{className:`${v} ${_} relative`,draggable:s,onDragStart:i,onDragOver:S=>S.preventDefault(),onDrop:o,children:[h.jsxs(As,{to:n.url,title:n.label,className:"flex items-center gap-2.5 pl-4 pr-3 py-1.5 text-[0.7875rem] flex-1 min-w-0",children:[h.jsx(qg,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5,...n.fromRole?{}:{fill:"currentColor",fillOpacity:.15}}),h.jsx("span",{className:"truncate flex-1 min-w-0",children:n.label}),n.badge&&h.jsx(fC,{url:n.url})]}),h.jsxs("span",{className:"absolute right-1 top-1/2 -translate-y-1/2 flex items-center gap-0.5 rounded px-0.5 bg-surface-hover opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity",children:[d&&h.jsx("button",{onClick:d,title:"Make mine — copy into my pins",className:"p-1 text-text-quaternary hover:text-accent transition-colors",children:h.jsx(mx,{className:"w-3 h-3"})}),p&&h.jsx("button",{onClick:p,title:"Hide this role pin",className:"p-1 text-text-quaternary hover:text-status-error transition-colors",children:h.jsx(PS,{className:"w-3 h-3"})}),c&&h.jsx("button",{onClick:c,title:`Remove "${n.label}"`,className:"p-1 text-text-quaternary hover:text-status-error transition-colors",children:h.jsx(en,{className:"w-3 h-3"})})]})]})}function fC({url:n}){var d;const e=E.useMemo(()=>oC(n),[n]),s={limit:1,staleTime:15e3},i=xv({...(e==null?void 0:e.params)??{},...s,enabled:!!e&&e.available}),o=bv({...(e==null?void 0:e.params)??{},...s,enabled:!!e&&!e.available});if(!e)return null;const c=e.available?i:o;return c.isError||((d=c.data)==null?void 0:d.total)===void 0?null:h.jsx("span",{className:"shrink-0 text-right text-2xs leading-none tabular-nums text-accent/80 relative -top-[0.35em]",title:`${c.data.total} matching now`,children:c.data.total})}function hC(){var c;const{data:n}=Hn(),e=(c=n==null?void 0:n.features)==null?void 0:c.graphWorkflows,s=e===!0||e!==!1&&tv(),i=[{to:"/workflows/registry",label:"Registry",icon:Pg},{to:"/workflows/durable/invoke",label:"Invoke Tool",icon:wd},{to:"/workflows/executions",label:"Executions",icon:Bg}],o=s?[{kind:"group",label:"Procedural",icon:BS,matchPaths:["/workflows/registry","/workflows/durable/invoke","/workflows/executions","/workflows/durable/executions","/workflows/start","/workflows/workers","/workflows/tasks"],items:i},{kind:"group",label:"Graph",icon:um,matchPaths:["/mcp/workflows","/mcp/executions"],items:[{to:"/mcp/workflows",label:"Configure",icon:Pg,end:!0},{to:"/mcp/workflows/invoke",label:"Invoke",icon:wd},{to:"/mcp/executions",label:"Executions",icon:Bg}]}]:i;return h.jsx(qr,{heading:"Orchestrate",entries:o})}function oR(){return qe({queryKey:["activeWorkers"],queryFn:async()=>(await ue("/workflows/workers")).workers})}function lR(){return qe({queryKey:["discoveredWorkflows"],queryFn:async()=>(await ue("/workflows/discovered")).workflows})}function cR(){return qe({queryKey:["workflowConfigs"],queryFn:async()=>(await ue("/workflows/config")).workflows})}function Qv(){return qe({queryKey:["invocableWorkflows"],queryFn:async()=>(await ue("/workflows/invocable")).workflows})}function uR(n){return Object.fromEntries(n.filter(e=>!e.missing).map(e=>[e.as??e.key,e.data]))}function fR(n,e){return qe({queryKey:["workflows",n,"input-lookups"],queryFn:()=>ue(`/workflows/${encodeURIComponent(n)}/input-lookups`),enabled:!!n&&e,staleTime:0,refetchOnWindowFocus:!1})}function hR(){return qe({queryKey:["cronStatus"],queryFn:async()=>(await ue("/workflows/cron/status")).schedules})}function dR(n){return qe({queryKey:["workflowExecution",n],queryFn:()=>ue(`/workflow-states/${n}/execution`),enabled:!!n})}function mR(n,e){const s=new URLSearchParams;return n.limit&&s.set("limit",String(n.limit)),n.offset!==void 0&&s.set("offset",String(n.offset)),n.entity&&s.set("entity",n.entity),n.search&&s.set("search",n.search),n.status&&s.set("status",n.status),n.sort_by&&s.set("sort_by",n.sort_by),n.order&&s.set("order",n.order),n.registered&&s.set("registered",n.registered),n.namespace&&s.set("namespace",n.namespace),qe({queryKey:["jobs",n],queryFn:()=>ue(`/workflow-states/jobs?${s}`),enabled:(e==null?void 0:e.enabled)??!0})}function pR(){const n=Pe();return Ie({mutationFn:e=>ue(`/workflows/${e}/terminate`,{method:"POST"}),onSuccess:(e,s)=>{n.invalidateQueries({queryKey:["workflowExecution",s],refetchType:"all"}),n.invalidateQueries({queryKey:["jobs"],refetchType:"all"})}})}function yR(){const n=Pe();return Ie({mutationFn:({workflow_type:e,...s})=>ue(`/workflows/${encodeURIComponent(e)}/config`,{method:"PUT",body:JSON.stringify(s)}),onSuccess:()=>{n.invalidateQueries({queryKey:["workflowConfigs"],refetchType:"all"})}})}function gR(){const n=Pe();return Ie({mutationFn:e=>ue(`/workflows/${encodeURIComponent(e)}/config`,{method:"DELETE"}),onSuccess:()=>{n.invalidateQueries({queryKey:["workflowConfigs"],refetchType:"all"})}})}function bR(){const n=Pe();return Ie({mutationFn:({workflowType:e,data:s,metadata:i,execute_as:o})=>ue(`/workflows/${e}/invoke`,{method:"POST",body:JSON.stringify({data:s,metadata:i,...o?{execute_as:o}:{}})}),onSuccess:()=>{n.invalidateQueries({queryKey:["tasks"],refetchType:"all"}),n.invalidateQueries({queryKey:["jobs"],refetchType:"all"})}})}function dC(){const{data:n}=Qv();return n!=null&&n.length?h.jsx(qr,{heading:"Tools",entries:[{to:"/workflows/durable/invoke",label:"Invoke Tool",icon:wd}]}):null}const mC=[{to:"/mcp/queries",label:"Designer",icon:US},{to:"/mcp/servers",label:"Servers & Tools",icon:zS}];function pC(){return h.jsx(qr,{heading:"Design",entries:mC})}const yC=[{to:"/files",label:"Files",icon:$S},{to:"/knowledge",label:"Knowledge Base",icon:px}];function gC(){return h.jsx(qr,{heading:"Storage",entries:yC})}function bC({isBuilder:n=!1,isOps:e=!1}){var d;const{data:s}=Hn(),i=((d=s==null?void 0:s.features)==null?void 0:d.dbMaintenance)!==!1,o=[{to:"/admin/users",label:"Accounts",icon:IS},...n||e?[{to:"/admin/roles",label:"Roles",icon:vd},{to:"/admin/personas",label:"Personas",icon:HS},{to:"/admin/scan-codes",label:"Scan Codes",icon:Ro}]:[]],c=[{to:"/admin/controlplane",label:"Routers",icon:FS},{to:"/admin/streams",label:"Messages",icon:px},...i?[{to:"/admin/maintenance",label:"DB Maintenance",icon:GS}]:[]];return h.jsxs(h.Fragment,{children:[h.jsx(qr,{heading:"Identity & Access",entries:o}),n&&nv()&&h.jsx(qr,{heading:"Infrastructure",entries:c})]})}function Xv({aiEnabled:n,isBuilder:e,isOps:s,viewAs:i,canSeePaceBoard:o,showLines:c}){return h.jsxs(h.Fragment,{children:[h.jsx(XT,{aiEnabled:n,isBuilder:e,isOps:s,viewAs:i,canSeePaceBoard:o,showLines:c}),h.jsx(cC,{}),!e&&h.jsx(dC,{}),e&&h.jsx(hC,{}),e&&n&&h.jsx(pC,{}),e&&h.jsx(gC,{}),(e||s)&&h.jsx(bC,{isBuilder:e,isOps:s})]})}function xC({open:n,onClose:e,...s}){const i=tn();return E.useEffect(()=>{e()},[i.pathname]),h.jsxs("div",{className:`lg:hidden fixed inset-y-0 left-0 z-40 flex ${n?"":"pointer-events-none"}`,children:[h.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${n?"opacity-100":"opacity-0"}`,onClick:e,"aria-hidden":!0}),h.jsxs("div",{className:`relative w-72 max-w-[85vw] h-full bg-surface-raised border-r border-surface-border shadow-xl flex flex-col transition-transform duration-200 ease-out ${n?"translate-x-0":"-translate-x-full"}`,children:[h.jsx("div",{className:"flex items-center justify-end px-3 pt-3 shrink-0",children:h.jsx("button",{onClick:e,className:"p-1.5 rounded text-text-tertiary hover:text-text-primary hover:bg-surface-hover transition-colors","aria-label":"Close navigation",children:h.jsx(en,{className:"w-4 h-4"})})}),h.jsx("nav",{className:"flex-1 px-3 pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:h.jsx(lk,{children:h.jsx(Xv,{...s})})})]})]})}const Wv="lt_event_feed_patterns";function vC(n,e){if(n.startsWith("/topics/")){const d=decodeURIComponent(n.replace("/topics/",""));if(d&&!d.includes("/"))return`lt.events.${d}`}const s=n.match(/^\/escalations\/detail\/(.+)/);if(s)return`lt.events.system.escalation.*.${s[1]}.>`;if(n.startsWith("/escalations")){const d=new URLSearchParams(e).get("role");return d?`lt.events.system.escalation.${av(d)}.>`:"lt.events.system.escalation.>"}const i=n.match(/^\/workflows\/(?:durable\/)?executions\/(.+)/);if(i)return`lt.events.system.workflow.${i[1]}.>`;if(n.startsWith("/workflows"))return"lt.events.system.workflow.>";const o=n.match(/^\/agents\/([^/]+)$/);if(o&&o[1]!=="new")return`lt.events.system.agent.${o[1]}.>`;if(n.startsWith("/agents"))return"lt.events.system.agent.>";if(n.startsWith("/knowledge"))return"lt.events.system.knowledge.>";if(n.startsWith("/files"))return"lt.events.system.file.>";if(n==="/")return"lt.events.system.>";const c=n.match(/^\/mcp\/executions\/(.+)/);return c?`lt.events.system.*.${c[1]}.>`:(n.startsWith("/mcp"),"lt.events.system.>")}function _C(){try{const n=localStorage.getItem(Wv);return n?JSON.parse(n):[]}catch{return[]}}function yd(n){try{localStorage.setItem(Wv,JSON.stringify(n))}catch{}}function wC(){const{pathname:n,search:e}=tn(),[s,i]=E.useState(_C),o=E.useMemo(()=>vC(n,e),[n,e]),c=E.useMemo(()=>{const u=new Set([o,...s]);return Array.from(u)},[o,s]),d=E.useCallback(u=>{const m=u.startsWith("lt.events.")?u:`lt.events.${u}`;i(b=>{if(b.includes(m))return b;const x=[...b,m];return yd(x),x})},[]),p=E.useCallback(u=>{i(m=>{const b=m.filter(x=>x!==u);return yd(b),b})},[]),g=E.useCallback(()=>{i([]),yd([])},[]);return{patterns:c,pagePattern:o,userPatterns:s,addPattern:d,removePattern:p,clearUserPatterns:g}}function SC({children:n,className:e=""}){return h.jsx("p",{className:`text-2xs font-semibold uppercase tracking-widest text-text-tertiary ${e}`,children:n})}const gd=280,Z1="cubic-bezier(0.4, 0, 0.2, 1)",Zc=40;function EC(n){if(!n)return"scale(0.92)";const e=window.innerWidth,s=window.innerHeight,i=e-Zc*2,o=s-Zc*2,c=n.width/i,d=n.height/o,p=n.left+n.width/2-(Zc+i/2),g=n.top+n.height/2-(Zc+o/2);return`translate(${p}px, ${g}px) scale(${c}, ${d})`}function Zv({open:n,onClose:e,sourceRef:s,children:i}){const[o,c]=E.useState(null),d=E.useRef(null),p=E.useRef(!1);E.useEffect(()=>{var x,v;n&&!p.current?(d.current=((x=s==null?void 0:s.current)==null?void 0:x.getBoundingClientRect())??null,c("entering")):!n&&p.current&&o==="open"&&(d.current=((v=s==null?void 0:s.current)==null?void 0:v.getBoundingClientRect())??null,c("exiting")),p.current=n},[n,s,o]),E.useEffect(()=>{if(o!=="entering")return;const x=requestAnimationFrame(()=>{requestAnimationFrame(()=>c("open"))});return()=>cancelAnimationFrame(x)},[o]),E.useEffect(()=>{if(o)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[o]),E.useEffect(()=>{if(!o)return;const x=v=>{v.key==="Escape"&&e()};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[o,e]);const g=E.useCallback(x=>{x.propertyName==="transform"&&o==="exiting"&&c(null)},[o]);if(E.useEffect(()=>{if(o!=="exiting")return;const x=setTimeout(()=>c(null),gd+50);return()=>clearTimeout(x)},[o]),!o)return null;const u=o==="entering"||o==="exiting",m=u?EC(d.current):"none",b=u?0:1;return lm.createPortal(h.jsx("div",{className:"fixed inset-0 z-50 overflow-auto p-10",style:{transformOrigin:"center center",transition:`transform ${gd}ms ${Z1}, opacity ${gd}ms ${Z1}`,transform:m,opacity:b,backgroundColor:"rgb(var(--lt-surface))"},onTransitionEnd:g,children:i}),document.body)}function OC({className:n}){return h.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h8M4 18h12"})})}function AC({className:n}){return h.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 7l-5 5 5 5M16 7l5 5-5 5"})})}function jC({className:n}){return h.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3"})})}function kC({className:n}){return h.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}function NC({className:n}){return h.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 9V4.5M9 9H4.5M9 9L3.5 3.5M9 15v4.5M9 15H4.5M9 15l-5.5 5.5M15 9h4.5M15 9V4.5M15 9l5.5-5.5M15 15h4.5M15 15v4.5m0-4.5l5.5 5.5"})})}function TC({className:n}){return h.jsx("svg",{className:n,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}function CC(n){const e=n.trim().split(`
57
+ `);if(e.length<2)return n;const s=p=>p.split("|").map(g=>g.trim()).filter(Boolean),i=s(e[0]),o=e.slice(2),c=i.map(p=>`<th class="px-3 py-1.5 text-left text-2xs font-semibold uppercase tracking-wider text-text-tertiary">${p}</th>`).join(""),d=o.map(p=>`<tr class="border-t border-surface-border">${s(p).map(m=>`<td class="px-3 py-1.5 text-xs text-text-secondary">${m}</td>`).join("")}</tr>`).join("");return`<table class="w-full my-3 text-xs"><thead><tr class="border-b border-surface-border">${c}</tr></thead><tbody>${d}</tbody></table>`}function eu(n){return n.toLowerCase().replace(/<[^>]+>/g,"").replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").trim()}function MC(n){const e=[];let s=n.replace(/```(\w*)\n([\s\S]*?)```/g,(g,u,m)=>{const b=e.length;return e.push(`<pre class="bg-surface-sunken rounded p-3 my-2 overflow-x-auto text-2xs leading-relaxed"><code>${m}</code></pre>`),`\0CODE${b}\0`});const i=/^(\|.+\|)\n(\|[-| :]+\|)\n((?:\|.+\|\n?)+)/gm;s=s.replace(i,(g,u,m,b)=>CC(`${u}
58
+ ${m}
59
+ ${b.trimEnd()}`)),s=s.replace(/`([^`]+)`/g,'<code class="bg-surface-sunken px-1 py-0.5 rounded text-2xs">$1</code>'),s=s.replace(/^#### (.+)$/gm,(g,u)=>`<h4 id="${eu(u)}" class="text-xs font-semibold text-text-primary mt-4 mb-1">${u}</h4>`).replace(/^### (.+)$/gm,(g,u)=>`<h3 id="${eu(u)}" class="text-sm font-semibold text-text-primary mt-5 mb-1.5">${u}</h3>`).replace(/^## (.+)$/gm,(g,u)=>`<h2 id="${eu(u)}" class="text-base font-semibold text-text-primary mt-6 mb-2 pb-1 border-b border-surface-border">${u}</h2>`).replace(/^# (.+)$/gm,(g,u)=>`<h1 id="${eu(u)}" class="text-lg font-bold text-text-primary mb-3">${u}</h1>`),s=s.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(#([^)]+)\)/g,'<a data-anchor="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]*\.md(?:#[^)]*)?)\)/g,'<a data-doc-link="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent hover:underline">$1</a>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^- (.+)$/gm,'<li class="ml-4 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^\d+\. (.+)$/gm,'<li class="ml-4 list-decimal text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^---+$/gm,'<hr class="border-surface-border my-4" />').replace(/(?:^> (.+)$\n?)+/gm,g=>{const u=g.replace(/^> /gm,"").trim(),m=/⚠️|warning|caution/i.test(u),b=/note:|ℹ️|info/i.test(u);return`<div class="${m?"bg-status-warning/5":b?"bg-accent/5":"bg-surface-sunken/50"} ${m?"border-status-warning":b?"border-accent":"border-text-tertiary"} border-l-2 rounded-r-md px-3 py-2 my-3 text-xs text-text-secondary leading-relaxed">${u}</div>`}).replace(/\n\n/g,"\0PARA\0").replace(/\n/g,"<br/>");const o=g=>g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=g=>new RegExp(`(${o(g)}[\\s\\S]*?<\\/li>(?:<br\\/>)?)+`,"g");s=s.replace(c('<li class="ml-8 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(c('<li class="ml-4 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(c('<li class="ml-4 list-decimal'),g=>`<ol class="list-decimal mb-3">${g}</ol>`),s=s.replace(/\x00CODE(\d+)\x00/g,(g,u)=>e[parseInt(u,10)]);const d="text-xs leading-relaxed text-text-secondary mb-2",p=/<\/(h[1-4]|pre|table|ul|ol|hr|div)>/;return s=s.split("\0PARA\0").map(g=>{const u=g.trim();if(!u)return"";const m=[];let b=u,x;for(;(x=p.exec(b))!==null;){const v=x.index+x[0].length;m.push(b.slice(0,v)),b=b.slice(v).replace(/^<br\/>/,"").trim(),p.lastIndex=0}return b&&m.push(b),m.map(v=>{const _=v.trim();return _?/^\s*<(h[1-4]|pre|table|ul|ol|hr|div)/.test(_)?_:`<p class="${d}">${_}</p>`:""}).join("")}).join(""),s}const RC=/(\*\*|^#{1,4}\s|^- |^\d+\.\s|```|^\|.*\|$|\[.+\]\(.+\))/m;function DC(n){return RC.test(n)}function Bu({content:n,className:e,onClick:s}){const i=E.useMemo(()=>MC(n),[n]);return h.jsx("div",{className:e,onClick:s,dangerouslySetInnerHTML:{__html:i}})}function Eu({data:n,depth:e=0,generation:s}){const o=s!==void 0&&s>0&&s%2===1?!1:e>0,[c,d]=E.useState(o),[p,g]=E.useState(s);if(s!==void 0&&s!==p&&(g(s),d(s%2===0&&e>0)),n==null)return h.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof n=="string")return h.jsxs("span",{className:"text-text-primary",children:['"',n,'"']});if(typeof n=="number"||typeof n=="boolean")return h.jsx("span",{className:"text-text-primary font-medium",children:String(n)});if(Array.isArray(n))return n.length===0?h.jsx("span",{className:"text-text-tertiary",children:"[]"}):c?h.jsxs("button",{onClick:()=>d(!1),className:"text-text-secondary hover:text-text-primary",children:["[",n.length," items]"]}):h.jsxs("span",{children:[h.jsx("button",{onClick:()=>d(!0),className:"text-text-tertiary hover:text-text-primary",children:"["}),h.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:n.map((u,m)=>h.jsxs("div",{children:[h.jsx(Eu,{data:u,depth:e+1,generation:s}),m<n.length-1&&h.jsx("span",{className:"text-text-tertiary",children:","})]},m))}),h.jsx("span",{className:"text-text-tertiary",children:"]"})]});if(typeof n=="object"){const u=Object.entries(n);return u.length===0?h.jsx("span",{className:"text-text-tertiary",children:"{}"}):c?h.jsxs("button",{onClick:()=>d(!1),className:"text-text-secondary hover:text-text-primary",children:["{","...","}"]}):h.jsxs("span",{children:[h.jsx("button",{onClick:()=>d(!0),className:"text-text-tertiary hover:text-text-primary",children:"{"}),h.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:u.map(([m,b],x)=>h.jsxs("div",{children:[h.jsx("span",{className:"text-text-secondary",children:m}),h.jsx("span",{className:"text-text-tertiary",children:": "}),h.jsx(Eu,{data:b,depth:e+1,generation:s}),x<u.length-1&&h.jsx("span",{className:"text-text-tertiary",children:","})]},m))}),h.jsx("span",{className:"text-text-tertiary",children:"}"})]})}return h.jsx("span",{children:String(n)})}function Ao({data:n,depth:e=0}){if(n==null)return h.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof n=="string")return n.length>40&&DC(n)?h.jsx(Bu,{content:n}):h.jsx("span",{className:"text-text-primary",children:n});if(typeof n=="number"||typeof n=="boolean")return h.jsx("span",{className:"text-text-primary font-medium",children:String(n)});if(Array.isArray(n))return n.length===0?h.jsx("span",{className:"text-text-tertiary italic",children:"empty list"}):h.jsx("div",{className:"space-y-2",children:n.map((s,i)=>h.jsxs("div",{className:"flex items-baseline gap-2",children:[h.jsxs("span",{className:"text-text-tertiary text-2xs shrink-0",children:[i+1,"."]}),h.jsx("div",{className:"flex-1",children:h.jsx(Ao,{data:s,depth:e+1})})]},i))});if(typeof n=="object"){const s=Object.entries(n);return s.length===0?h.jsx("span",{className:"text-text-tertiary italic",children:"empty"}):h.jsx("div",{className:e>0?"pl-4 border-l border-surface-border space-y-3":"space-y-3",children:s.map(([i,o])=>{const c=o===null||typeof o!="object";return h.jsxs("div",{children:[h.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-0.5",children:i.replace(/[_-]/g," ")}),c?h.jsx("p",{className:"text-sm text-text-primary",children:h.jsx(Ao,{data:o,depth:e+1})}):h.jsx(Ao,{data:o,depth:e+1})]},i)})})}return h.jsx("span",{children:String(n)})}function ex({mode:n,setMode:e,isCollapsed:s,onToggleCollapse:i,onCopy:o,copied:c,onFullscreen:d,onClose:p,large:g}){const u=g?"w-5 h-5":"w-3.5 h-3.5",m=`${g?"p-2":"p-1.5"} rounded text-accent/60 hover:text-accent hover:bg-surface-raised transition-colors duration-150`;return h.jsxs("div",{className:"flex items-center gap-0.5 bg-surface-sunken/80 rounded-md backdrop-blur-sm",children:[n==="json"&&h.jsx("button",{onClick:i,className:m,title:s?"Expand all":"Collapse all",children:s?h.jsx(TC,{className:u}):h.jsx(NC,{className:u})}),h.jsx("button",{onClick:()=>e(n==="json"?"tree":"json"),className:m,title:n==="json"?"Outline view":"JSON view",children:n==="json"?h.jsx(OC,{className:u}):h.jsx(AC,{className:u})}),h.jsx("button",{onClick:o,className:m,title:"Copy to clipboard",children:c?h.jsx(kC,{className:`${u} text-status-success`}):h.jsx(jC,{className:u})}),d&&h.jsx("button",{onClick:d,className:m,title:"Fullscreen",children:h.jsx(yx,{className:u})}),p&&h.jsx("button",{onClick:p,className:m,title:"Close (Esc)",children:h.jsx(gx,{className:u})})]})}function LC({data:n,label:e,variant:s,defaultCollapsed:i=!1,defaultMode:o}){const c=E.useRef(null),[d,p]=E.useState(o??"json"),[g,u]=E.useState(!1),[m,b]=E.useState(!1),[x,v]=E.useState(i?0:1),[_,S]=E.useState(1),C=x%2===0,B=_%2===0,q=E.useCallback(()=>v(D=>D+1),[]),ne=E.useCallback(()=>S(D=>D+1),[]);let te=n;if(typeof n=="string")try{te=JSON.parse(n)}catch{}const M=async()=>{const D=typeof n=="string"?n:JSON.stringify(te,null,2);await navigator.clipboard.writeText(D),u(!0),setTimeout(()=>u(!1),2e3)},z=E.useCallback(()=>{S(1),b(!0)},[]),ae=s==="panel",F=ae?"border border-accent-muted/40 rounded-lg p-3 bg-surface-hover/30":"",U=ae?"font-mono text-xs leading-relaxed bg-surface-raised rounded-md p-4 overflow-x-auto break-all":"font-mono text-xs leading-relaxed bg-surface-sunken border border-surface-border rounded-md p-4 overflow-x-auto break-all";return h.jsxs("div",{className:F,children:[e&&h.jsx(SC,{children:e}),h.jsxs("div",{ref:c,className:"relative",children:[h.jsx("div",{className:"absolute top-2 right-2 z-[5]",children:h.jsx(ex,{mode:d,setMode:p,isCollapsed:C,onToggleCollapse:q,onCopy:M,copied:g,onFullscreen:z})}),h.jsx("div",{className:U,children:d==="json"?h.jsx(Eu,{data:te,generation:x}):h.jsx(Ao,{data:te})})]}),h.jsxs(Zv,{open:m,onClose:()=>b(!1),sourceRef:c,children:[h.jsx("div",{className:"sticky top-0 float-right z-10",children:h.jsx(ex,{mode:d,setMode:p,isCollapsed:B,onToggleCollapse:ne,onCopy:M,copied:g,onClose:()=>b(!1),large:!0})}),h.jsx("div",{className:"font-mono text-sm leading-relaxed",children:d==="json"?h.jsx(Eu,{data:te,generation:_}):h.jsx(Ao,{data:te})})]})]})}const qC=100,tx=500;let PC=0;const e_={"escalation.created":"text-status-active","escalation.claimed":"text-status-warning","escalation.released":"text-text-tertiary","escalation.resolved":"text-status-success","task.created":"text-accent","task.completed":"text-status-success","task.failed":"text-status-error","task.escalated":"text-status-warning","workflow.started":"text-accent","workflow.completed":"text-status-success","workflow.failed":"text-status-error","activity.started":"text-status-active","activity.completed":"text-status-success","activity.failed":"text-status-error","knowledge.stored":"text-accent","knowledge.deleted":"text-text-tertiary","agent.started":"text-accent","agent.completed":"text-status-success","agent.failed":"text-status-error","agent.status_changed":"text-status-active",milestone:"text-accent"};function t_(n){const e=n.split(".");return e[0]==="system"&&e.length>=3?`${e[1]}.${e[e.length-1]}`:n}function nx({event:n,forceExpanded:e=!1}){var x,v;const[s,i]=E.useState(e),o=e_[t_(n.type)]||"text-text-tertiary";E.useEffect(()=>{i(e)},[e]);const c=e,d=c?"text-xs":"text-2xs",p=c?"text-xs":"text-2xs",g=c?"text-xs":"text-2xs",u=c?"w-3.5 h-3.5":"w-2.5 h-2.5",m=c?"py-2 px-4":"py-1 px-3",b=c?"pb-4 px-4":"pb-2 px-3";return h.jsxs("div",{className:"border-b border-surface-border/30 last:border-b-0",children:[h.jsxs("button",{onClick:()=>i(!s),className:`flex items-center gap-2 ${m} w-full text-left hover:bg-surface-hover/50 transition-colors`,children:[h.jsx("span",{className:`${d} font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0`,children:new Date(n.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),h.jsx("span",{className:`${p} font-medium px-1 py-0.5 rounded ${o} bg-surface-sunken whitespace-nowrap shrink-0`,children:n.type}),h.jsxs("span",{className:`${g} text-text-tertiary font-mono flex-1 min-w-0 truncate`,children:[(x=n.data)!=null&&x.workflowId?String(n.data.workflowId):"",(v=n.data)!=null&&v.escalationId?` esc:${String(n.data.escalationId).slice(0,12)}`:""]}),h.jsx("svg",{className:`${u} text-text-tertiary shrink-0 transition-transform duration-150 ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),h.jsx(Jm,{open:s,children:h.jsx("div",{className:b,children:h.jsx(LC,{data:n.data})})})]})}function BC({open:n,onToggle:e,configOpen:s,onToggleConfig:i}){const[o,c]=E.useState([]),[d,p]=E.useState(!1),[g,u]=E.useState(""),m=E.useRef(null),b=E.useRef(new Map),{subscribe:x}=E.useContext(ca),{connected:v}=Ux(),{patterns:_,pagePattern:S,userPatterns:C,addPattern:B,removePattern:q}=wC(),ne=E.useCallback(z=>{const ae=String(z.type||"unknown");if(ae.startsWith("mesh."))return;const F=`${ae}:${z.timestamp||""}:${z.escalationId||z.workflowId||z.taskId||""}`,U=Date.now(),D=b.current.get(F);if(!(D&&U-D<tx)){if(b.current.set(F,U),b.current.size>200)for(const[Q,W]of b.current)U-W>tx*2&&b.current.delete(Q);c(Q=>[{id:++PC,type:ae,timestamp:z.timestamp||new Date().toISOString(),data:z},...Q].slice(0,qC))}},[]),te=E.useRef(ne);te.current=ne;const M=n||d||s;return E.useEffect(()=>{if(!M)return;const z=_.map(ae=>x(ae,F=>te.current(F)));return()=>z.forEach(ae=>ae())},[x,_.join(","),M]),E.useEffect(()=>{n&&m.current&&(m.current.scrollTop=0)},[o.length,n]),h.jsxs("div",{className:"shrink-0 border-t border-surface-border bg-surface-raised",children:[h.jsxs("button",{onClick:e,className:"flex items-center gap-2 w-full px-4 py-1.5 text-left hover:bg-surface-hover transition-colors",children:[n?h.jsx(cm,{className:"w-3 h-3 text-text-tertiary"}):h.jsx(bx,{className:"w-3 h-3 text-text-tertiary"}),h.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:"Event Stream"}),o.length>0&&h.jsxs("span",{className:"text-2xs text-text-tertiary",children:[o.length," events"]}),o.length>0&&!n&&h.jsx("span",{className:`text-2xs font-medium px-1 py-0.5 rounded ${e_[t_(o[0].type)]||"text-text-tertiary"} bg-surface-sunken`,children:o[0].type}),h.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[h.jsx("span",{className:`p-0.5 ${v?"text-status-success":"text-status-warning hover:text-text-primary cursor-pointer"}`,title:v?"Live events connected":"Events disconnected — click to reconnect",onClick:z=>{z.stopPropagation(),v||window.location.reload()},children:h.jsx(dx,{className:"w-3 h-3"})}),h.jsx("span",{className:`p-0.5 cursor-pointer ${s?"text-accent":"text-text-tertiary hover:text-text-primary"}`,title:"Subscription config",onClick:z=>{z.stopPropagation(),i()},children:h.jsx(VS,{className:"w-3 h-3"})}),o.length>0&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Fullscreen",onClick:z=>{z.stopPropagation(),p(!0)},children:h.jsx(yx,{className:"w-3 h-3"})}),h.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Clear events",onClick:z=>{z.stopPropagation(),c([])},children:h.jsx(YS,{className:"w-3 h-3"})})]})]})]}),s&&h.jsxs("div",{className:"px-4 py-2 border-t border-surface-border/50 bg-surface-sunken/30",children:[h.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mb-1.5",children:[h.jsx("span",{className:"text-2xs text-text-quaternary uppercase tracking-wider shrink-0",children:"Subscribed:"}),h.jsx("span",{className:"text-2xs font-mono text-accent px-1.5 py-0.5 bg-accent/10 rounded",children:S.replace("lt.events.","")}),C.map(z=>h.jsxs("span",{className:"inline-flex items-center gap-1 text-2xs font-mono text-text-secondary px-1.5 py-0.5 bg-surface-sunken rounded",children:[z.replace("lt.events.",""),h.jsx("button",{onClick:()=>q(z),className:"text-text-quaternary hover:text-status-error",children:h.jsx(en,{className:"w-2 h-2"})})]},z))]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("input",{type:"text",value:g,onChange:z=>u(z.target.value),onKeyDown:z=>{z.key==="Enter"&&g.trim()&&(B(g.trim()),u(""))},placeholder:"task.> or file.stored",className:"input text-2xs font-mono flex-1 py-1"}),h.jsxs("button",{onClick:()=>{g.trim()&&(B(g.trim()),u(""))},className:"text-2xs text-accent hover:text-accent-hover flex items-center gap-0.5",children:[h.jsx(mx,{className:"w-2.5 h-2.5"})," Add"]})]})]}),h.jsx(Jm,{open:n,children:h.jsx("div",{ref:m,className:"h-48 overflow-y-auto",children:o.length===0?h.jsx("p",{className:"text-2xs text-text-tertiary py-4 text-center",children:"Waiting for events..."}):o.map(z=>h.jsx(nx,{event:z},z.id))})}),h.jsxs(Zv,{open:d,onClose:()=>p(!1),sourceRef:m,children:[h.jsx("div",{className:"sticky top-0 float-right z-10",children:h.jsx("button",{onClick:()=>p(!1),className:"p-2 rounded text-text-tertiary hover:text-text-primary hover:bg-surface-raised transition-colors duration-150 bg-surface-sunken/80 backdrop-blur-sm",title:"Close (Esc)",children:h.jsx(gx,{className:"w-5 h-5"})})}),o.length===0?h.jsx("p",{className:"text-sm text-text-tertiary py-8",children:"No events captured"}):o.map(z=>h.jsx(nx,{event:z,forceExpanded:!0},z.id))]})]})}function UC(){return qe({queryKey:["docs"],queryFn:()=>ue("/docs"),staleTime:5*6e4})}function zC(n){return qe({queryKey:["docs",n],queryFn:()=>ue(`/docs/read?path=${encodeURIComponent(n)}`),enabled:!!n,staleTime:5*6e4})}function $C(){const[n,e]=E.useState([]),[s,i]=E.useState([]),[o,c]=E.useState(null),d=E.useRef(o),p=E.useRef(n),g=E.useRef(s);d.current=o,p.current=n,g.current=s;const u=E.useCallback((_,S)=>{var B;const C=d.current;if(C){const q=((B=S==null?void 0:S.current)==null?void 0:B.scrollTop)??0;e([...p.current,{...C,scrollTop:q}])}i([]),c({path:_,scrollTop:0})},[]),m=E.useCallback(_=>{var q;const S=p.current;if(S.length===0)return;const C=S[S.length-1],B=d.current;if(B){const ne=((q=_==null?void 0:_.current)==null?void 0:q.scrollTop)??0;i([...g.current,{...B,scrollTop:ne}])}e(S.slice(0,-1)),c(C),requestAnimationFrame(()=>{_!=null&&_.current&&(_.current.scrollTop=C.scrollTop)})},[]),b=E.useCallback(_=>{var q;const S=g.current;if(S.length===0)return;const C=S[S.length-1],B=d.current;if(B){const ne=((q=_==null?void 0:_.current)==null?void 0:q.scrollTop)??0;e([...p.current,{...B,scrollTop:ne}])}i(S.slice(0,-1)),c(C),requestAnimationFrame(()=>{_!=null&&_.current&&(_.current.scrollTop=C.scrollTop)})},[]),x=E.useCallback(_=>{var B,q;const S=d.current;if(!S)return;const C=((B=_==null?void 0:_.current)==null?void 0:B.scrollTop)??0;e([...p.current,{...S,scrollTop:C}]),i([]),c({...S,scrollTop:((q=_==null?void 0:_.current)==null?void 0:q.scrollTop)??0})},[]),v=E.useCallback(()=>{e([]),i([]),c(null)},[]);return{current:o,backStack:n,forwardStack:s,navigate:u,goBack:m,goForward:b,pushScrollPosition:x,reset:v}}function IC(n,e){const[s,i]=n.split("#");let o=s;if(o.startsWith("./")||o.startsWith("../")){const d=((e?e.replace(/[^/]+$/,""):"")+o).split("/"),p=[];for(const g of d)g===".."?p.pop():g&&g!=="."&&p.push(g);o=p.join("/")}return{path:o,anchor:i}}function HC(n){if(!n.startsWith("#docs"))return null;const e=n.slice(1).split(":"),s=e[1]||"README.md",i=e[2]||void 0;return{path:s,anchor:i}}function FC(n){return!n||n==="README.md"?"#docs":`#docs:${n}`}function GC({content:n,currentPath:e,onNavigate:s,onAnchorClick:i}){const o=c=>{var u;const d=c.target,p=d.closest("[data-anchor]");if(p){c.preventDefault(),i();const m=p.dataset.anchor,b=(u=p.closest(".docs-content"))==null?void 0:u.querySelector(`#${CSS.escape(m)}`);b==null||b.scrollIntoView({behavior:"smooth",block:"start"});return}const g=d.closest("[data-doc-link]");if(g){c.preventDefault();const{path:m,anchor:b}=IC(g.dataset.docLink,e);s(m,b);return}};return h.jsx(Bu,{content:n,className:"docs-content",onClick:o})}function VC(n){const e=[],s=new Map;for(const i of n){const o=i.path.split("/");if(o.length===1){e.push(i);continue}let c=s;for(let d=0;d<o.length-1;d++){const p=o[d];c.has(p)||c.set(p,{label:p,children:[],subdirs:new Map});const g=c.get(p);d===o.length-2?g.children.push(i):c=g.subdirs}}return{topLevel:e,dirs:s}}function YC({docs:n,selected:e,onSelect:s}){const{topLevel:i,dirs:o}=VC(n),c=p=>`block w-full text-left px-3 py-1 text-xs rounded truncate transition-colors ${e===p?"bg-accent/10 text-accent":"text-text-secondary hover:bg-surface-hover"}`;function d(p,g){return h.jsxs("details",{open:!0,children:[h.jsxs("summary",{className:"flex items-center gap-1.5 px-3 py-1 text-2xs font-semibold uppercase tracking-widest text-text-tertiary cursor-pointer",children:[h.jsx(KS,{className:"w-3 h-3",strokeWidth:1.5}),p.label]}),h.jsxs("div",{className:"pl-2 space-y-0.5",children:[[...p.subdirs.values()].map(u=>d(u)),p.children.map(u=>h.jsx("button",{className:c(u.path),onClick:()=>s(u.path),children:u.title},u.path))]})]},p.label)}return h.jsxs("div",{className:"space-y-0.5",children:[i.map(p=>h.jsx("button",{className:c(p.path),onClick:()=>s(p.path),children:p.title},p.path)),[...o.values()].map(p=>d(p))]})}function KC({open:n,onClose:e}){var ae,F,U;const[s,i]=E.useState(!1),{data:o}=UC(),c=$C(),{data:d,isLoading:p}=zC(((ae=c.current)==null?void 0:ae.path)??null),g=E.useRef(null),[u,m]=E.useState(null);E.useEffect(()=>{u&&(d!=null&&d.content)&&g.current&&requestAnimationFrame(()=>{var Q;const D=(Q=g.current)==null?void 0:Q.querySelector(`#${CSS.escape(u)}`);D==null||D.scrollIntoView({behavior:"smooth",block:"start"}),m(null)})},[u,d]);const b=E.useCallback(()=>{var W;const D=HC(window.location.hash),Q=(D==null?void 0:D.path)??"README.md";((W=c.current)==null?void 0:W.path)!==Q&&c.navigate(Q,g),D!=null&&D.anchor&&m(D.anchor)},[c]),x=E.useRef(!0);E.useEffect(()=>{if(!n||!c.current)return;if(x.current){x.current=!1;return}const D=FC(c.current.path);window.location.hash!==D&&window.history.replaceState(null,"",window.location.pathname+window.location.search+D)},[n,(F=c.current)==null?void 0:F.path]),E.useEffect(()=>{if(!n)return;const D=()=>{window.location.hash.startsWith("#docs")&&b()};return window.addEventListener("hashchange",D),()=>window.removeEventListener("hashchange",D)},[n,b]);const v=E.useCallback((D,Q)=>{Q&&m(Q),c.navigate(D,g)},[c]),_=E.useCallback(D=>{c.navigate(D,g)},[c]),S=E.useCallback(()=>{c.goBack(g)},[c]),C=E.useCallback(()=>{c.goForward(g)},[c]),B=E.useCallback(()=>{c.pushScrollPosition(g)},[c]);if(E.useEffect(()=>{if(n){x.current=!0,b();const D=requestAnimationFrame(()=>i(!0));return()=>cancelAnimationFrame(D)}},[n]),!(n||s))return null;const ne=()=>{i(!1),setTimeout(()=>{e(),c.reset()},200)},te=((U=c.current)==null?void 0:U.path)??null,M=c.backStack.length>0,z=c.forwardStack.length>0;return h.jsxs("div",{className:"fixed inset-y-0 right-0 z-50 flex",children:[h.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${s&&n?"opacity-100":"opacity-0"}`,onClick:ne}),h.jsxs("div",{className:`relative ml-auto w-[40vw] min-w-[800px] max-w-[90vw] h-full bg-surface-raised border-l border-surface-border flex flex-col shadow-xl transition-transform duration-200 ease-out ${s&&n?"translate-x-0":"translate-x-full"}`,children:[h.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border shrink-0",children:[h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("button",{onClick:S,disabled:!M,className:`p-0.5 transition-colors ${M?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Back",children:h.jsx(hx,{className:"w-4 h-4"})}),h.jsx("button",{onClick:C,disabled:!z,className:`p-0.5 transition-colors ${z?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Forward",children:h.jsx(xd,{className:"w-4 h-4"})}),h.jsx(JS,{className:"w-4 h-4 text-accent ml-1",strokeWidth:1.5}),h.jsx("span",{className:"text-sm font-medium text-text-primary",children:"Documentation"})]}),h.jsx("button",{onClick:ne,className:"p-1 text-text-tertiary hover:text-text-primary",children:h.jsx(en,{className:"w-4 h-4"})})]}),h.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[h.jsx("div",{className:"w-48 shrink-0 border-r border-surface-border overflow-y-auto py-2",children:o!=null&&o.docs?h.jsx(YC,{docs:o.docs,selected:te,onSelect:_}):h.jsx("div",{className:"px-3 py-2 text-xs text-text-tertiary",children:"Loading..."})}),h.jsx("div",{ref:g,className:"flex-1 overflow-y-auto px-6 py-4",children:te?p?h.jsxs("div",{className:"animate-pulse space-y-2",children:[h.jsx("div",{className:"h-6 bg-surface-sunken rounded w-48"}),h.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),h.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"})]}):d!=null&&d.content?h.jsx(GC,{content:d.content,currentPath:te,onNavigate:v,onAnchorClick:B}):h.jsx("p",{className:"text-xs text-text-tertiary",children:"Document not found."}):h.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-text-tertiary",children:[h.jsx(xd,{className:"w-5 h-5 mb-2"}),h.jsx("p",{className:"text-xs",children:"Select a document"})]})})]})]})]})}function JC(n){if(n.includes("/escalations"))return["escalation","human-queue"]}const rx=2e3;function QC(n){const s=n.filter(o=>!o.pending).slice(-8);return s.length===0?"":`[Prior conversation]
60
+ ${s.map(o=>`${o.role==="user"?"User":"Assistant"}: ${o.content}`).join(`
61
+ `)}
62
+ [End prior conversation]
63
+
64
+ `}function XC(n){const e=n.summary,s=n.title;if(e){const i=e.search(/\n\s*\{[\s\S]*"title"\s*:/);return i>0?e.slice(0,i).trim():e}return s||(typeof n=="string"?n:"Query completed.")}const n_=E.createContext(null);function WC({children:n}){const e=tn(),[s,i]=E.useState(!1),[o,c]=E.useState([]),[d,p]=E.useState(null),[g,u]=E.useState({}),m=E.useRef(null),b={page:e.pathname.split("/").filter(Boolean).join("-")||"home",route:e.pathname,params:{},...g,suggestedTags:g.suggestedTags??JC(e.pathname)};E.useEffect(()=>()=>{m.current&&clearInterval(m.current)},[]);const x=E.useCallback(()=>i(B=>!B),[]),v=E.useCallback(B=>{u(B)},[]),_=E.useCallback(()=>{c([]),p(null)},[]),S=E.useCallback(async B=>{var F;const q=new Date().toISOString(),ne={id:`user-${Date.now()}`,role:"user",content:B,timestamp:q},te={id:`pending-${Date.now()}`,role:"assistant",content:"",timestamp:q,pending:!0};c(U=>[...U,ne,te]);const M={...b};(F=M.entities)!=null&&F.yamlContent&&M.entities.yamlContent.length>rx&&(M.entities={...M.entities,yamlContent:M.entities.yamlContent.slice(0,rx)+`
65
+ ... (truncated)`});const ae=`${QC(o.concat(ne))}${B}`;try{const D=(await ue("/insight/mcp-query",{method:"POST",body:JSON.stringify({prompt:ae,tags:M.suggestedTags,context:M,wait:!1,direct:!0})})).workflow_id;p(D),c(Q=>Q.map(W=>W.id===te.id?{...W,workflowId:D}:W)),m.current&&clearInterval(m.current),m.current=setInterval(async()=>{var Q;try{const W=await ue(`/workflows/${D}/result`),he=(Q=W==null?void 0:W.result)==null?void 0:Q.data;if(he){m.current&&clearInterval(m.current),m.current=null,p(null);const Ee=XC(he);let Ae;try{Ae=(await ue(`/workflow-states/${D}/execution`)).duration_ms}catch{}c(H=>H.map(J=>J.id===te.id?{...J,content:Ee,timestamp:new Date().toISOString(),pending:!1,durationMs:Ae}:J))}}catch{}},3e3)}catch{c(U=>U.map(D=>D.id===te.id?{...D,content:"Failed to submit query. Please try again.",pending:!1}:D))}},[o,b]),C=E.useCallback(async B=>{const q=o.find(M=>M.id===B);if(!(q!=null&&q.workflowId)||q.compilationStatus==="compiling"||q.compilationStatus==="done")return;const ne=o.indexOf(q),te=o.slice(0,ne).reverse().find(M=>M.role==="user");if(te){c(M=>M.map(z=>z.id===B?{...z,compilationStatus:"compiling"}:z));try{const M=await ue("/insight/mcp-query/describe",{method:"POST",body:JSON.stringify({prompt:te.content,summary:q.content})}),z=await ue("/yaml-workflows",{method:"POST",body:JSON.stringify({workflow_id:q.workflowId,task_queue:"long-tail-system",workflow_name:"mcpQuery",name:M.tool_name,description:M.description,tags:M.tags,app_id:""})});await ue(`/yaml-workflows/${z.id}/deploy`,{method:"POST"}),c(ae=>ae.map(F=>F.id===B?{...F,compilationStatus:"done"}:F))}catch(M){const z=M instanceof Error?M.message:"Compilation failed";c(ae=>ae.map(F=>F.id===B?{...F,compilationStatus:"error",compilationError:z}:F))}}},[o]);return h.jsx(n_.Provider,{value:{helpOpen:s,setHelpOpen:i,toggleHelp:x,messages:o,sendMessage:S,pageContext:b,setPageContext:v,activeWorkflowId:d,clearMessages:_,compileMessage:C},children:n})}function r_(){const n=E.useContext(n_);if(!n)throw new Error("useHelpAssistant must be used within HelpAssistantProvider");return n}function ZC(){const{helpOpen:n,toggleHelp:e}=r_();return h.jsx("button",{onClick:e,className:"fixed right-3 z-[45] flex items-center justify-center w-10 h-10 rounded-full bg-surface-raised shadow-lg hover:scale-110 transition-transform duration-150 border border-accent/30",style:{bottom:"44px"},"aria-label":n?"Close help":"Ask for help",children:n?h.jsx(en,{className:"w-5 h-5 text-text-tertiary",strokeWidth:1.5}):h.jsx("span",{role:"img","aria-label":"Help",className:"logo-mark w-8 h-8 -rotate-[120deg]",style:{"--logo-url":`url(${Yt}/logo512.png)`}})})}function e3({ms:n,className:e=""}){const s=Ek(n),i=E.useMemo(()=>n==null?[]:[{label:"ms",value:String(n)},{label:"sec",value:`${(n/1e3).toFixed(3)}s`},{label:"text",value:s}],[n,s]);return n==null?h.jsx("span",{className:`text-xs text-text-tertiary ${e}`,children:"--"}):h.jsx(_v,{options:i,children:h.jsx("span",{className:`text-xs text-text-tertiary ${e}`,children:s})})}const t3=["sm","md","lg","full"],sx={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"},ix={sm:"Small",md:"Medium",lg:"Large",full:"Fullscreen"};function n3({which:n}){const e="stroke-current";switch(n){case"sm":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"5",y:"5",width:"7",height:"7",rx:"1.5",className:e,strokeWidth:"1.5"})});case"md":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"3",y:"3",width:"9",height:"9",rx:"1.5",className:e,strokeWidth:"1.5"})});case"lg":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"1.5",y:"1.5",width:"11",height:"11",rx:"1.5",className:e,strokeWidth:"1.5"})});case"full":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"0.75",y:"0.75",width:"12.5",height:"12.5",rx:"1.5",className:e,strokeWidth:"1.5"})})}}function r3({msg:n}){const[e,s]=E.useState(0);E.useEffect(()=>{const d=new Date(n.timestamp).getTime(),p=()=>s(Math.floor((Date.now()-d)/1e3));p();const g=setInterval(p,1e3);return()=>clearInterval(g)},[n.timestamp]);const i=Math.floor(e/60),o=e%60,c=i>0?`${i}m ${o}s`:`${o}s`;return h.jsxs("span",{className:"inline-flex flex-col gap-1.5",children:[h.jsxs("span",{className:"inline-flex items-center gap-1",children:[h.jsx("span",{className:"text-text-tertiary",children:"Thinking"}),h.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse"}),h.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:150ms]"}),h.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:300ms]"}),h.jsx("span",{className:"text-text-muted ml-1 tabular-nums",children:c})]}),n.workflowId&&h.jsxs(ar,{to:`/workflows/executions/${n.workflowId}`,className:"inline-flex items-center gap-1 text-2xs text-accent/70 hover:text-accent transition-colors",children:[h.jsx(um,{className:"w-2.5 h-2.5",strokeWidth:1.5}),"watch execution"]})]})}function s3({msg:n,compileMessage:e}){const s=n.role==="assistant";return h.jsxs("div",{className:`flex items-center gap-1.5 ${s?"justify-start":"justify-end"}`,children:[h.jsx(wv,{date:n.timestamp,format:"time",className:"!text-2xs text-text-muted/50"}),n.durationMs!=null&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-text-muted/30 text-2xs",children:"·"}),h.jsx(e3,{ms:n.durationMs,className:"!text-2xs text-text-muted/50"})]}),n.workflowId&&h.jsx(ar,{to:`/workflows/executions/${n.workflowId}`,className:"text-text-muted/40 hover:text-accent transition-colors",title:"View workflow execution",children:h.jsx(um,{className:"w-2.5 h-2.5",strokeWidth:1.5})}),s&&n.workflowId&&!n.pending&&h.jsx("button",{onClick:()=>e(n.id),disabled:n.compilationStatus==="compiling"||n.compilationStatus==="done",className:"transition-colors",title:n.compilationStatus==="done"?"Compiled — future queries will match this pipeline":n.compilationStatus==="error"?n.compilationError??"Compilation failed":n.compilationStatus==="compiling"?"Compiling...":"Compile to fast pipeline",children:h.jsx(QS,{className:`w-2.5 h-2.5 ${n.compilationStatus==="done"?"text-status-success":n.compilationStatus==="error"?"text-status-error":n.compilationStatus==="compiling"?"text-accent/40 animate-pulse":"text-text-muted/40 hover:text-accent"}`,strokeWidth:1.5})})]})}function i3(){const{helpOpen:n,setHelpOpen:e,messages:s,sendMessage:i,pageContext:o,activeWorkflowId:c,clearMessages:d,compileMessage:p}=r_(),[g,u]=E.useState(""),[m,b]=E.useState("md"),[x,v]=E.useState(!0),_=E.useRef(null),S=E.useRef(null);if(E.useEffect(()=>{_.current&&(_.current.scrollTop=_.current.scrollHeight)},[s]),E.useEffect(()=>{n&&S.current&&S.current.focus()},[n]),E.useEffect(()=>{if(!n)return;const M=z=>{z.key==="Escape"&&(m==="full"?b("lg"):m==="lg"?b("md"):m==="md"?b("sm"):e(!1))};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[n,m,e]),!n)return null;const C=()=>{const M=g.trim();!M||c||(i(M),u(""),S.current&&(S.current.style.height="auto"))},B=M=>{M.key==="Enter"&&!M.shiftKey&&(M.preventDefault(),C())},q=m==="full",ne=o.page.replace(/-/g," "),te=q?{}:{bottom:"108px"};return h.jsxs("div",{className:`fixed z-[45] flex flex-col border border-surface-border rounded-lg overflow-hidden transition-all duration-300 ${q?sx.full:`right-6 ${sx[m]}`} ${x?"bg-surface-raised shadow-xl":"bg-surface-raised/[0.03] shadow-lg shadow-black/5"}`,style:te,onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1),children:[h.jsxs("div",{className:`flex items-center justify-between px-4 py-2.5 border-b border-surface-border shrink-0 transition-all duration-300 ${x?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsx("p",{className:"text-xs font-medium text-text-primary truncate",children:"Help Assistant"}),h.jsx("p",{className:"text-2xs text-text-tertiary truncate",children:ne})]}),h.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[h.jsx("div",{className:"flex items-center gap-0.5 border border-surface-border rounded p-0.5",role:"radiogroup","aria-label":"Panel size",children:t3.map(M=>h.jsx("button",{onClick:()=>b(M),className:`p-1 rounded transition-colors ${M===m?"bg-accent/15 text-accent":"text-text-muted hover:text-text-secondary hover:bg-surface-hover"}`,role:"radio","aria-checked":M===m,"aria-label":ix[M],title:ix[M],children:h.jsx(n3,{which:M})},M))}),s.length>0&&h.jsx("button",{onClick:d,className:"p-1 text-text-tertiary hover:text-text-secondary transition-colors","aria-label":"Clear conversation",title:"Clear conversation",children:h.jsx(XS,{className:"w-3.5 h-3.5",strokeWidth:1.5})}),h.jsx("button",{onClick:()=>e(!1),className:"p-1 text-text-tertiary hover:text-text-primary transition-colors","aria-label":"Close",title:"Close",children:h.jsx(en,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]})]}),h.jsxs("div",{ref:_,className:`flex-1 overflow-y-auto px-4 py-3 space-y-3 min-h-[120px] transition-all duration-300 ${x?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[s.length===0&&h.jsx("p",{className:"text-xs text-text-tertiary text-center py-6",children:"Ask anything about what you're viewing."}),s.map(M=>h.jsxs("div",{className:`text-xs leading-relaxed ${M.role==="user"?"text-right":"text-left"}`,children:[h.jsx("div",{className:`inline-block max-w-[85%] px-3 py-2 rounded-md whitespace-pre-wrap ${M.role==="user"?"bg-accent/10 text-text-primary":"bg-surface-sunken text-text-secondary"}`,children:M.pending?h.jsx(r3,{msg:M}):M.role==="assistant"?h.jsx(Bu,{content:M.content}):M.content}),!M.pending&&h.jsx("div",{className:"mt-0.5",children:h.jsx(s3,{msg:M,compileMessage:p})})]},M.id))]}),h.jsxs("div",{className:`border-t border-surface-border px-3 py-2.5 flex gap-2 shrink-0 transition-all duration-300 ${x?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[h.jsx("textarea",{ref:S,value:g,onChange:M=>{u(M.target.value);const z=M.target;z.style.height="auto",z.style.height=`${Math.min(z.scrollHeight,120)}px`},onKeyDown:B,placeholder:"Ask a question...",rows:2,className:"flex-1 resize-none bg-surface text-xs text-text-primary placeholder:text-text-tertiary rounded px-2.5 py-1.5 border border-surface-border focus:outline-none focus:border-accent",style:{minHeight:"2.5rem"},disabled:!!c}),h.jsx("button",{onClick:C,disabled:!g.trim()||!!c,className:"px-2.5 py-1.5 text-accent hover:text-accent-hover disabled:text-text-muted transition-colors self-end","aria-label":"Send",children:h.jsx(WS,{className:"w-4 h-4",strokeWidth:1.5})})]})]})}const a3=6e3,o3="scan";function l3(){const{lastResult:n}=Vm(),{open:e,ownerKey:s}=Um(),[i,o]=E.useState(null);return E.useEffect(()=>{if(!n)return;const c=setTimeout(()=>o(n.at),a3);return()=>clearTimeout(c)},[n]),!n||n.navigated||i===n.at||e&&s===o3||n.source===ra.TOOLBAR?null:h.jsx("div",{role:"status",className:"fixed bottom-14 right-4 z-[60] w-80 max-w-[calc(100vw-2rem)] bg-surface-raised border border-surface-border shadow-lg rounded-md animate-page-in",children:h.jsxs("div",{className:"flex items-start gap-2.5 px-3.5 py-3",children:[h.jsx(Ro,{className:"w-4 h-4 mt-0.5 text-accent-muted shrink-0",strokeWidth:1.5}),h.jsx("div",{className:"flex-1 min-w-0",children:h.jsx(Ym,{result:n})}),h.jsx("button",{type:"button",onClick:()=>o(n.at),className:"text-text-tertiary hover:text-text-primary shrink-0",title:"Dismiss",children:h.jsx(en,{className:"w-3.5 h-3.5"})})]})})}const s_="lt-announcement-dismissed:",c3="Live updates unavailable. Reconnecting… Refresh if this persists.";function u3(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function f3(n){try{return localStorage.getItem(`${s_}${n}`)==="1"}catch{return!1}}function h3(){const{isAuthenticated:n,userRoleNames:e}=qt(),{data:s}=vv(n),i=Pe(),[o,c]=E.useState(null),[d,p]=E.useState(0),{unavailable:g}=_O();An(vk,()=>{i.invalidateQueries({queryKey:["announcements"]})});const u=Date.now(),m=((s==null?void 0:s.announcements)??[]).filter(x=>!f3(x.id)&&new Date(x.expires_at).getTime()>u&&(x.roles.length===0||x.roles.some(v=>e.includes(v))));if(E.useEffect(()=>{const x=((s==null?void 0:s.announcements)??[]).map(_=>new Date(_.expires_at).getTime()-Date.now()).filter(_=>_>0);if(x.length===0)return;const v=setTimeout(()=>p(_=>_+1),Math.min(...x)+250);return()=>clearTimeout(v)},[s,d]),m.length===0&&!g)return null;const b=x=>{try{localStorage.setItem(`${s_}${x}`,"1")}catch{}p(v=>v+1)};return h.jsxs("div",{"data-testid":"announcement-banner",className:"relative z-40",children:[g&&h.jsx("div",{"data-testid":"live-updates-notice",role:"status",className:"border-b border-status-warning/25 bg-status-warning/10",children:h.jsxs("div",{className:"flex items-center gap-2 px-4 py-1.5",children:[h.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-status-warning",children:"Notice"}),h.jsx("span",{className:"truncate text-xs text-text-primary",children:c3})]})}),m.map(x=>{const v=o===x.id,_=x.title??x.body.split(`
66
+ `)[0];return h.jsxs("div",{className:"border-b border-accent/25 bg-accent/10",children:[h.jsxs("div",{className:"flex items-center gap-2 px-4 py-1.5",children:[h.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-accent",children:"Notice"}),h.jsxs("button",{type:"button",onClick:()=>c(v?null:x.id),className:"flex items-center gap-1.5 text-xs text-text-primary hover:text-accent transition-colors min-w-0",children:[h.jsx("span",{className:"truncate",children:_}),v?h.jsx(bx,{className:"w-3 h-3 shrink-0",strokeWidth:1.5}):h.jsx(cm,{className:"w-3 h-3 shrink-0",strokeWidth:1.5})]}),h.jsx("div",{className:"flex-1"}),h.jsx("button",{type:"button",onClick:()=>b(x.id),className:"icon-link",title:"Dismiss","aria-label":`Dismiss ${_}`,children:h.jsx(en,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]}),v&&h.jsx("div",{className:"px-4 pb-3 text-sm text-text-secondary max-w-measure",children:h.jsx(Bu,{content:u3(x.body)})})]},x.id)})]})}function d3(){var ae,F;const{isBuilder:n,isOps:e,viewAs:s}=sv(),{canSeePaceBoard:i}=iv();CA();const{data:o}=Hn();Ij((ae=o==null?void 0:o.display)==null?void 0:ae.timeZone);const c=ev(),d=c!==null?c:!!((F=o==null?void 0:o.ai)!=null&&F.enabled),p=!!(o!=null&&o.machines),{collapsed:g,toggle:u}=Pm(),[m,b]=E.useState(!1),[x,v]=E.useState(!1),[_,S]=E.useState(!1),[C,B]=E.useState(()=>window.location.hash.startsWith("#docs")),q=tn(),ne=E.useRef(null),{kiosk:te,homePath:M}=Lm(),z=te||tk(q.pathname);return E.useEffect(()=>{const U=ne.current;U&&(U.classList.remove("animate-page-in"),U.offsetWidth,U.classList.add("animate-page-in"))},[q.pathname]),E.useEffect(()=>{const U=()=>{window.location.hash.startsWith("#docs")&&B(!0)};return window.addEventListener("hashchange",U),()=>window.removeEventListener("hashchange",U)},[]),te&&M&&!ik(q.pathname,q.search)?h.jsx(un,{to:M,replace:!0}):h.jsxs("div",{className:"h-screen bg-surface flex flex-col",children:[h.jsx(VT,{onToggleEventFeed:()=>b(U=>!U),onToggleDocs:()=>B(U=>!U),onToggleNav:z?void 0:()=>v(U=>!U)}),h.jsx(h3,{}),h.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[!z&&h.jsxs("aside",{className:`${g?"w-16":"w-60"} shrink-0 bg-surface-raised border-r border-surface-border hidden lg:flex flex-col transition-[width] duration-200 ease-out overflow-hidden relative z-20`,children:[h.jsx("nav",{className:"flex-1 px-3 pt-[36px] pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:h.jsx(Xv,{aiEnabled:d,isBuilder:n,isOps:e,viewAs:s,canSeePaceBoard:i,showLines:p})}),h.jsx("button",{onClick:u,className:`shrink-0 py-3 text-text-tertiary hover:text-text-secondary transition-colors duration-150 ${g?"flex justify-center":"flex items-center px-7"}`,"aria-label":g?"Expand sidebar":"Collapse sidebar",children:g?h.jsx(ZS,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):h.jsx(eE,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5})}),!g&&(o==null?void 0:o.environment)&&h.jsxs("div",{className:"shrink-0 px-5 pb-3 text-2xs leading-tight text-text-tertiary whitespace-nowrap overflow-hidden text-ellipsis",title:`long-tail v${o.environment.longTailVersion} · HotMesh v${o.environment.hotmeshVersion} · Node ${o.environment.nodeVersion} · ${o.environment.nodeEnv}`,children:["long-tail v",o.environment.longTailVersion,h.jsx("span",{className:"mx-1 text-surface-border",children:"·"}),"HotMesh v",o.environment.hotmeshVersion]})]}),h.jsx("main",{className:"flex-1 min-w-0 overflow-y-auto",children:h.jsx("div",{ref:ne,className:"w-full px-page-x py-8 pb-16 animate-page-in h-full flex flex-col @container",children:h.jsx(_s,{})})}),h.jsx(m3,{})]}),!z&&h.jsx(xC,{open:x,onClose:()=>v(!1),aiEnabled:d,isBuilder:n,isOps:e,viewAs:s,canSeePaceBoard:i,showLines:p}),h.jsx(BC,{open:m,onToggle:()=>b(U=>!U),configOpen:_,onToggleConfig:()=>S(U=>!U)}),h.jsx(KC,{open:C,onClose:()=>{B(!1),history.replaceState(null,"",window.location.pathname+window.location.search)}}),d&&h.jsx(ZC,{}),d&&h.jsx(i3,{}),h.jsx(l3,{})]})}function m3(){const{node:n,width:e,open:s}=Um();return h.jsx(uk,{open:s,width:e,className:"border-l border-surface-border bg-surface-raised",children:n})}function p3(){const{isAuthenticated:n}=qt(),e=tn();return n?h.jsx(ok,{children:h.jsx(ck,{children:h.jsx(WC,{children:h.jsx(kA,{children:h.jsx(gN,{children:h.jsx(d3,{})})})})})}):h.jsx(un,{to:"/login",state:{from:e.pathname},replace:!0})}function i_({provider:n,className:e="w-5 h-5"}){switch(n){case"google":return h.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"currentColor",children:[h.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z",fill:"#4285F4"}),h.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),h.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),h.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]});case"github":return h.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"currentColor",children:h.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12.017C22 6.484 17.522 2 12 2z"})});case"microsoft":return h.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"currentColor",children:[h.jsx("path",{d:"M3 3h8.5v8.5H3z",fill:"#F25022"}),h.jsx("path",{d:"M12.5 3H21v8.5h-8.5z",fill:"#7FBA00"}),h.jsx("path",{d:"M3 12.5h8.5V21H3z",fill:"#00A4EF"}),h.jsx("path",{d:"M12.5 12.5H21V21h-8.5z",fill:"#FFB900"})]});case"anthropic":return h.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"currentColor",children:h.jsx("path",{d:"M13.827 3.52h3.603L24 20.48h-3.603l-6.57-16.96zm-7.258 0h3.767L16.906 20.48h-3.674l-1.343-3.461H6.396l-1.34 3.461H1.5l5.07-16.96zm2.327 5.14l-2.065 5.326h4.108l-2.043-5.326z"})});default:return h.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[h.jsx("circle",{cx:"12",cy:"12",r:"10"}),h.jsx("path",{d:"M12 8v4l3 3"})]})}}async function y3(){return ue("/auth/oauth/providers")}async function g3(n,e){const s=e?`?label=${encodeURIComponent(e)}`:"";return ue(`/auth/oauth/connections/${n}${s}`,{method:"DELETE"})}function xR(){return qe({queryKey:["oauth-connections"],queryFn:()=>ue("/auth/oauth/connections")})}function vR(){const n=Pe();return Ie({mutationFn:({provider:e,label:s})=>g3(e,s),onSuccess:()=>{n.invalidateQueries({queryKey:["oauth-connections"]})}})}function b3(){var ae;const{login:n,isAuthenticated:e}=qt(),s=ri(),i=tn(),o=new URLSearchParams(i.search),c=o.get("token"),d=o.get("error"),p=((ae=i.state)==null?void 0:ae.from)??o.get("returnTo")??"/",g=E.useRef(!1);c&&!g.current&&(g.current=!0,n(c,void 0,{displayName:o.get("displayName"),username:o.get("username")}));const[u,m]=E.useState(""),[b,x]=E.useState(""),[v,_]=E.useState(d||""),[S,C]=E.useState(!1),[B,q]=E.useState(!!c),[ne,te]=E.useState([]),M=E.useRef(!1);if(E.useEffect(()=>{c||M.current||(M.current=!0,(async()=>{var F,U,D,Q;try{const W=await hm().catch(()=>null);if(!((F=W==null?void 0:W.auth)!=null&&F.sso))return;const he=await fetch(`${Yt}/api/auth/sso`,{method:"POST"});if(!he.ok){_("Host authentication required — please log in to your organization first");return}const Ee=await he.json();Ee.token&&((U=W.auth)!=null&&U.ssoLogoutUrl&&sessionStorage.setItem("lt_sso_logout_url",W.auth.ssoLogoutUrl),q(!0),n(Ee.token,void 0,{displayName:(D=Ee.user)==null?void 0:D.display_name,username:(Q=Ee.user)==null?void 0:Q.external_id}))}catch{}})())},[]),E.useEffect(()=>{c||y3().then(te).catch(()=>{})},[]),E.useEffect(()=>{if(!B)return;const F=setTimeout(()=>s(p,{replace:!0}),1500);return()=>clearTimeout(F)},[B]),e&&!B)return h.jsx(un,{to:p,replace:!0});const z=async F=>{var U,D;if(F.preventDefault(),_(""),!u.trim()||!b){_("Username and password are required");return}C(!0);try{const Q=await fetch(`${Yt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:u.trim(),password:b})}),W=await Q.json();if(!Q.ok){_(W.error||"Login failed");return}q(!0),n(W.token,{username:u.trim(),password:b},{displayName:(U=W.user)==null?void 0:U.display_name,username:(D=W.user)==null?void 0:D.external_id})}catch{_("Unable to connect to server")}finally{C(!1)}};return h.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center overflow-hidden",children:h.jsxs("div",{className:"w-full max-w-md p-10",children:[h.jsx("div",{className:`mb-10 transition-all duration-[1500ms] ease-in ${B?"translate-x-[120vw] -translate-y-[60vh] scale-[3] opacity-0":""}`,children:h.jsx(Du,{size:"lg",hideLabel:B})}),h.jsxs("form",{onSubmit:z,className:`space-y-5 transition-opacity duration-300 ${B?"opacity-0":""}`,children:[h.jsxs("div",{children:[h.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-text-secondary mb-2",children:"Username"}),h.jsx("input",{id:"username",type:"text",value:u,onChange:F=>m(F.target.value),className:"input",placeholder:"Enter your username",autoFocus:!B,autoComplete:"username"})]}),h.jsxs("div",{children:[h.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-text-secondary mb-2",children:"Password"}),h.jsx("input",{id:"password",type:"password",value:b,onChange:F=>x(F.target.value),className:"input",placeholder:"Enter your password",autoComplete:"current-password"})]}),v&&h.jsx("p",{className:"text-sm text-status-error",children:v}),h.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:S||B,children:S?"Signing in...":"Sign In"}),ne.length>0&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex items-center gap-3 mt-6",children:[h.jsx("div",{className:"flex-1 h-px bg-border"}),h.jsx("span",{className:"text-xs text-text-tertiary",children:"or continue with"}),h.jsx("div",{className:"flex-1 h-px bg-border"})]}),h.jsx("div",{className:"space-y-2",children:ne.filter(F=>F.provider!=="anthropic").map(F=>h.jsxs("a",{href:`${Yt}/api/auth/oauth/${F.provider}?returnTo=${encodeURIComponent(p)}`,className:"btn-secondary w-full flex items-center justify-center gap-2",children:[h.jsx(i_,{provider:F.provider}),"Sign in with ",F.name]},F.provider))})]})]})]})})}function ax(){const{isAuthenticated:n}=qt(),e=ri(),s=tn(),i=new URLSearchParams(s.search),o=i.get("state")||"";E.useEffect(()=>{n||e(`/login?returnTo=${encodeURIComponent(s.pathname+s.search)}`)},[n]);const[c,d]=E.useState(""),[p,g]=E.useState(i.get("label")||"default"),[u,m]=E.useState(""),[b,x]=E.useState(!1),v=c.trim().startsWith("sk-ant-oat"),_=c.trim().startsWith("sk-ant-api"),S=C=>{C.preventDefault();const B=c.trim();if(!B){m("A token or API key is required");return}if(!B.startsWith("sk-ant-")){m('Invalid format. Must start with "sk-ant-oat" (OAuth token) or "sk-ant-api" (API key)');return}x(!0),m("");const q=`${Yt}/api/auth/oauth/anthropic/callback?code=${encodeURIComponent(B)}&state=${encodeURIComponent(o)}`;window.location.href=q};return h.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:h.jsxs("div",{className:"w-full max-w-md p-10",children:[h.jsx("div",{className:"mb-10",children:h.jsx(Du,{size:"lg"})}),h.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[h.jsx(i_,{provider:"anthropic",className:"w-6 h-6"}),h.jsx("h2",{className:"heading-3",children:"Connect Anthropic"})]}),h.jsx("p",{className:"text-sm text-text-secondary mb-4",children:"Connect your Anthropic account so Claude Code tasks run under your credentials. Your token is encrypted at rest."}),h.jsxs("form",{onSubmit:S,className:"space-y-5",children:[h.jsxs("div",{children:[h.jsx("label",{htmlFor:"token",className:"block text-sm font-medium text-text-secondary mb-2",children:"OAuth Token or API Key"}),h.jsx("input",{id:"token",type:"password",value:c,onChange:C=>d(C.target.value),className:"input",placeholder:"sk-ant-oat01-... or sk-ant-api03-...",autoFocus:!0,autoComplete:"off"}),v&&h.jsx("p",{className:"text-xs text-status-success mt-1",children:"OAuth token detected — uses your Claude subscription (flat rate)"}),_&&h.jsx("p",{className:"text-xs text-status-warning mt-1",children:"API key detected — billed per-token from your Anthropic API account"})]}),h.jsxs("div",{children:[h.jsx("label",{htmlFor:"label",className:"block text-sm font-medium text-text-secondary mb-2",children:"Label"}),h.jsx("input",{id:"label",type:"text",value:p,onChange:C=>g(C.target.value.replace(/\s+/g,"-").toLowerCase()),className:"input",placeholder:"default",autoComplete:"off"}),h.jsx("p",{className:"text-xs text-text-tertiary mt-1",children:'A name for this credential. Use different labels to store multiple credentials (e.g., "subscription", "api-batch").'})]}),u&&h.jsx("p",{className:"text-sm text-status-error",children:u}),h.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:b,children:b?"Validating...":"Connect"}),h.jsx("a",{href:"/",className:"block text-center text-sm text-text-tertiary hover:text-text-secondary",children:"Cancel"})]}),h.jsxs("div",{className:"mt-6 space-y-3 text-xs text-text-tertiary",children:[h.jsxs("div",{children:[h.jsx("span",{className:"font-medium text-text-secondary",children:"Recommended:"})," ","Run"," ",h.jsx("code",{className:"px-1 py-0.5 bg-surface-sunken rounded text-2xs",children:"claude setup-token"})," ","in your terminal to generate an OAuth token that uses your subscription."]}),h.jsxs("div",{children:[h.jsx("span",{className:"font-medium text-text-secondary",children:"Alternative:"})," ","Use an API key from"," ",h.jsx("a",{href:"https://console.anthropic.com/settings/keys",target:"_blank",rel:"noopener noreferrer",className:"text-accent-secondary hover:underline",children:"console.anthropic.com"})," ","(billed per-token)."]})]})]})})}function x3({items:n,columns:e=1}){if(n.length===0)return null;const s=e>=2&&n.length>1?"grid-cols-1 @dict-inline:grid-cols-[max-content_1fr] @dict-pairs:grid-cols-[max-content_1fr_max-content_1fr]":"grid-cols-1 @dict-inline:grid-cols-[max-content_1fr]";return h.jsx("div",{className:"@container",children:h.jsx("dl",{className:`grid ${s} items-baseline gap-x-6 @dict-pairs:gap-x-8 gap-y-1.5`,children:n.map(({key:i,label:o,value:c})=>h.jsxs(E.Fragment,{children:[h.jsx("dt",{className:"text-2xs font-semibold uppercase tracking-wide text-text-secondary mt-2 first:mt-0 @dict-inline:mt-0",children:o}),h.jsx("dd",{className:"text-sm text-text-primary break-words whitespace-pre-wrap min-w-0","data-field-key":i,children:v3(c)})]},i))})})}function v3(n){return n==null||n===""?"—":typeof n=="boolean"?n?"Yes":"No":typeof n=="object"?JSON.stringify(n):String(n)}function _3(n){return qe({queryKey:["oauth-client",n],queryFn:()=>ue(`/oauth/clients/${encodeURIComponent(n)}`),enabled:!!n,retry:!1})}function w3(n){return qe({queryKey:["oauth-presets"],queryFn:()=>ue("/oauth/presets"),enabled:n})}function S3(){return Ie({mutationFn:n=>ue(n.preset?"/oauth/authorize":"/oauth/deny",{method:"POST",body:JSON.stringify(n.preset?{...n.request,preset:n.preset}:n.request)})})}function _R(){return qe({queryKey:["oauth-grants"],queryFn:()=>ue("/oauth/grants")})}function wR(){const n=Pe();return Ie({mutationFn:e=>ue(`/oauth/grants/${encodeURIComponent(e)}`,{method:"DELETE"}),onSuccess:()=>n.invalidateQueries({queryKey:["oauth-grants"]})})}const E3=["client_id","redirect_uri","code_challenge","code_challenge_method","response_type","state","scope","resource"],bd={read_only:{action:"Allow read-only",effect:"Reads what you can read and runs workflows marked read-safe."},just_me:{action:"Allow as me",effect:"Acts with your full rights: claims, resolves, invokes, and administers wherever you may."}};function O3(n){const e=new URLSearchParams(n),s=E3.map(o=>[o,e.get(o)??void 0]),i=Object.fromEntries(s);return!i.client_id||!i.redirect_uri||!i.code_challenge?null:i}function A3(n){try{return new URL(n).host}catch{return n}}function j3(){var b,x,v;const{isAuthenticated:n,user:e}=qt(),s=ri(),i=tn(),o=E.useMemo(()=>O3(i.search),[i.search]);E.useEffect(()=>{n||s(`/login?returnTo=${encodeURIComponent(i.pathname+i.search)}`,{replace:!0})},[n]);const c=_3(n&&o?o.client_id:null),d=w3(n&&!!o),p=S3(),g=_=>{o&&p.mutate({request:o,preset:_},{onSuccess:({redirect:S})=>window.location.assign(S)})};if(!n)return null;const u=!o||c.isError,m=((b=c.data)==null?void 0:b.client_name)||"An app";return h.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:h.jsxs("div",{className:"w-full max-w-lg p-10",children:[h.jsx("div",{className:"mb-10",children:h.jsx(Du,{size:"lg"})}),u?h.jsxs("div",{role:"alert",children:[h.jsx("h2",{className:"heading-3 mb-3",children:"Sign-in link not valid"}),h.jsx("p",{className:"text-sm text-text-secondary",children:"Start the connection again from the app."})]}):h.jsxs(h.Fragment,{children:[h.jsxs("h2",{className:"heading-2 mb-2",children:["Connect ",m]}),h.jsxs("p",{className:"text-sm text-text-secondary mb-6",children:["Pick how much ",m," may do as you. Disconnect it any time under Connected apps."]}),h.jsx("div",{className:"mb-8",children:h.jsx(x3,{items:[{key:"app",label:"App",value:m},{key:"account",label:"Account",value:(e==null?void 0:e.displayName)||(e==null?void 0:e.username)||(e==null?void 0:e.userId)||null},{key:"returns-to",label:"Returns to",value:A3(o.redirect_uri)},{key:"deployment",label:"Deployment",value:window.location.host}]})}),h.jsx("dl",{className:"space-y-3 mb-8",children:(((x=d.data)==null?void 0:x.presets)??[]).map(_=>h.jsxs("div",{children:[h.jsx("dt",{className:"text-sm font-medium text-text-primary",children:bd[_].action}),h.jsx("dd",{className:"text-sm text-text-secondary",children:bd[_].effect})]},_))}),p.isError&&h.jsx("p",{className:"text-sm text-status-error mb-4",role:"alert",children:p.error.message}),h.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[(((v=d.data)==null?void 0:v.presets)??[]).map(_=>h.jsx("button",{type:"button",className:_==="read_only"?"btn-primary":"btn-secondary",disabled:p.isPending||c.isLoading,onClick:()=>g(_),children:bd[_].action},_)),h.jsx("button",{type:"button",className:"btn-ghost",disabled:p.isPending,onClick:()=>g(null),children:"Deny"})]})]})]})})}function Ji({roleTypes:n,roleNames:e,redirectTo:s="/"}){const{isSuperAdmin:i,hasRole:o,hasRoleType:c}=qt();return i?h.jsx(_s,{}):n&&n.some(d=>c(d))?h.jsx(_s,{}):e&&e.some(d=>o(d))?h.jsx(_s,{}):h.jsx(un,{to:s,replace:!0})}function k3(){const{data:n,isSuccess:e}=Qv();return e&&n.length===0?h.jsx(un,{to:"/",replace:!0}):h.jsx(_s,{})}function N3({redirectTo:n="/"}){var i;const{data:e,isLoading:s}=Hn();return s||!e?null:(i=e.ai)!=null&&i.enabled?h.jsx(_s,{}):h.jsx(un,{to:n,replace:!0})}function T3({flag:n,redirectTo:e="/"}){var o;const{data:s,isLoading:i}=Hn();return i||!s?null:((o=s.features)==null?void 0:o[n])===!1?h.jsx(un,{to:e,replace:!0}):h.jsx(_s,{})}function C3({redirectTo:n="/"}){const{data:e,isLoading:s}=Hn();return s||!e?null:e.machines?h.jsx(_s,{}):h.jsx(un,{to:n,replace:!0})}const M3=E.lazy(()=>Oe(()=>import("./ProcessesListPage-CT81miI5.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]),import.meta.url).then(n=>({default:n.ProcessesListPage}))),R3=E.lazy(()=>Oe(()=>import("./ProcessDetailPage-D35RX1bB.js"),__vite__mapDeps([17,1,2,18,13,19,16,10,4,20,21]),import.meta.url).then(n=>({default:n.ProcessDetailPage}))),D3=E.lazy(()=>Oe(()=>import("./McpOverview-DA9LLvNG.js"),__vite__mapDeps([22,1,23,24,25,26,14,13,27,4]),import.meta.url).then(n=>({default:n.McpOverview}))),L3=E.lazy(()=>Oe(()=>import("./McpRunsPage-BRDDYpTM.js"),__vite__mapDeps([28,1,24,25,3,4,29,26,6,7,8,9,16,13,30,14,12,11,15,31]),import.meta.url).then(n=>({default:n.McpRunsPage}))),q3=E.lazy(()=>Oe(()=>import("./McpRunDetailPage-qHRQ1pEY.js"),__vite__mapDeps([32,1,24,14,13,33,34,12,35,19,4,36,15,37]),import.meta.url).then(n=>({default:n.McpRunDetailPage}))),P3=E.lazy(()=>Oe(()=>import("./McpQueryPage-CpsP3w7x.js"),__vite__mapDeps([38,1,14,13,7,8,9,12,11,15,6,10,30,16,31,3,4,39]),import.meta.url).then(n=>({default:n.McpQueryPage}))),B3=E.lazy(()=>Oe(()=>import("./McpQueryDetailPage-N7qLmfE8.js"),__vite__mapDeps([40,1,14,13,19,39,4,25,41,42,24,2,43,44,45,46,47,48,37,49,35,36]),import.meta.url).then(n=>({default:n.McpQueryDetailPage}))),U3=E.lazy(()=>Oe(()=>import("./EscalationsOverview-CKaGRh-E.js"),__vite__mapDeps([50,1,14,13,27,4]),import.meta.url).then(n=>({default:n.EscalationsOverview}))),z3=E.lazy(()=>Oe(()=>import("./AvailableEscalationsPage-GFn8Sgg1.js"),__vite__mapDeps([51,1,4,52,13,53,54,5,55,56,57,21,58,19,7,8,9,59,11,60,12,61,20,16,62,3,31]),import.meta.url).then(n=>({default:n.AvailableEscalationsPage}))),$3=E.lazy(()=>Oe(()=>import("./OperatorDashboard-el5BquXN.js"),__vite__mapDeps([63,1,3,4,5,6,52,7,8,9,11,31,59,57,21,13,58,19,60,12,61,20,16,62,55,15]),import.meta.url).then(n=>({default:n.OperatorDashboard}))),I3=E.lazy(()=>Oe(()=>import("./index-P-DlgAWj.js"),__vite__mapDeps([64,1,65,13,66,4,57,21,58,19,54,16,53,5,14,15,20,62,37,67]),import.meta.url).then(n=>({default:n.EscalationDetailPage}))),H3=E.lazy(()=>Oe(()=>import("./WorkflowsOverview-D7Oqf4-V.js"),__vite__mapDeps([68,1,14,13,27,4]),import.meta.url).then(n=>({default:n.WorkflowsOverview}))),F3=E.lazy(()=>Oe(()=>import("./index-DRK7M1_9.js"),__vite__mapDeps([69,1,14,13,12,16,65,66,4,57,21,58,19,54,70,46,47]),import.meta.url).then(n=>({default:n.StartWorkflowPage}))),G3=E.lazy(()=>Oe(()=>import("./index-DRK7M1_9.js"),__vite__mapDeps([69,1,14,13,12,16,65,66,4,57,21,58,19,54,70,46,47]),import.meta.url).then(n=>({default:n.DurableInvokePage}))),V3=E.lazy(()=>Oe(()=>import("./WorkflowsDashboard--isjt06C.js"),__vite__mapDeps([71,1,30,29,26,4,3,6,7,8,9,16,13,14,12,11,15,31]),import.meta.url).then(n=>({default:()=>n.WorkflowsDashboard({tier:"durable"})}))),Y3=E.lazy(()=>Oe(()=>import("./WorkflowsDashboard--isjt06C.js"),__vite__mapDeps([71,1,30,29,26,4,3,6,7,8,9,16,13,14,12,11,15,31]),import.meta.url).then(n=>({default:()=>n.WorkflowsDashboard({tier:"all"})}))),K3=E.lazy(()=>Oe(()=>import("./YamlWorkflowsPage-BVdLnm6K.js"),__vite__mapDeps([72,1,25,3,4,14,13,12,8,48,70,19]),import.meta.url).then(n=>({default:n.YamlWorkflowsPage}))),J3=E.lazy(()=>Oe(()=>import("./GraphInvokePage-yOVpraAy.js"),__vite__mapDeps([73,1,25,14,13,43,45,46,47,44,4,48,70]),import.meta.url).then(n=>({default:n.GraphInvokePage}))),Q3=E.lazy(()=>Oe(()=>import("./YamlWorkflowDetailPage-B0wxgrGP.js"),__vite__mapDeps([74,1,25,19,70,13,4]),import.meta.url).then(n=>({default:n.YamlWorkflowDetailPage}))),X3=E.lazy(()=>Oe(()=>import("./TasksListPage-CUulwvm-.js"),__vite__mapDeps([75,1,2,3,4,7,8,9,19,61,49,11,12,13,14,16]),import.meta.url).then(n=>({default:n.TasksListPage}))),W3=E.lazy(()=>Oe(()=>import("./TaskDetailPage-DKUM37o8.js"),__vite__mapDeps([76,1,2,19,61,14,13,4]),import.meta.url).then(n=>({default:n.TaskDetailPage}))),ox=E.lazy(()=>Oe(()=>import("./WorkflowExecutionPage-Crf7AIFc.js"),__vite__mapDeps([77,1,34,12,13,35,19,4,36,2,14,33,15,37]),import.meta.url).then(n=>({default:n.WorkflowExecutionPage}))),Z3=E.lazy(()=>Oe(()=>import("./AdminDashboard-VQ1fhhJP.js"),__vite__mapDeps([78,1,2,23,18,13,4]),import.meta.url).then(n=>({default:n.AdminDashboard}))),e5=E.lazy(()=>Oe(()=>import("./index-B8qrHwp9.js"),__vite__mapDeps([79,1,7,8,9,12,13,31,3,4,14,80,16]),import.meta.url).then(n=>({default:n.WorkersPage}))),t5=E.lazy(()=>Oe(()=>import("./index-boT612Jo.js"),__vite__mapDeps([81,1,12,13,82,20,16,14,4,46,47,70,65,66,57,21,58,19,54]),import.meta.url).then(n=>({default:n.WorkflowConfigsPage}))),lx=E.lazy(()=>Oe(()=>import("./index-boT612Jo.js"),__vite__mapDeps([81,1,12,13,82,20,16,14,4,46,47,70,65,66,57,21,58,19,54]),import.meta.url).then(n=>({default:n.WorkflowConfigDetailPage}))),n5=E.lazy(()=>Oe(()=>import("./index-Bo8QU31k.js"),__vite__mapDeps([83,1,23,8,82,14,13,12,11,3,4,84,45,46,47,48,44,31,19]),import.meta.url).then(n=>({default:n.McpServersPage}))),cx=E.lazy(()=>Oe(()=>import("./index-OuKQ_0eB.js"),__vite__mapDeps([85,1,23,14,13,41,4]),import.meta.url).then(n=>({default:n.McpServerDetailPage}))),r5=E.lazy(()=>Oe(()=>import("./index-B95LbYhW.js"),__vite__mapDeps([86,1,3,4,7,8,9,11,12,13,82,31,14,20,47,49,87,88,33]),import.meta.url).then(n=>({default:n.UsersPage}))),s5=E.lazy(()=>Oe(()=>import("./RolesPage-BE7RWt9q.js"),__vite__mapDeps([89,1,12,13,14,20,4]),import.meta.url).then(n=>({default:n.RolesPage}))),i5=E.lazy(()=>Oe(()=>import("./RoleDetailPage-DtU7vsJm.js"),__vite__mapDeps([90,1,91,82,13,4]),import.meta.url).then(n=>({default:n.RoleDetailPage}))),a5=E.lazy(()=>Oe(()=>import("./PersonasPage-BPI7mqM8.js"),__vite__mapDeps([92,1,87,12,13,14,20,4,5]),import.meta.url).then(n=>({default:n.PersonasPage}))),o5=E.lazy(()=>Oe(()=>import("./PersonaDetailPage-B_tb8gfl.js"),__vite__mapDeps([93,1,87,20,13,88,91,82,4]),import.meta.url).then(n=>({default:n.PersonaDetailPage}))),l5=E.lazy(()=>Oe(()=>import("./EscalationSchemaPage-nfCn42hT.js"),__vite__mapDeps([94,1,65,13,66,4,57,21,58,19,54,16]),import.meta.url).then(n=>({default:n.EscalationSchemaPage}))),c5=E.lazy(()=>Oe(()=>import("./PortalPage-e_rBb1do.js"),__vite__mapDeps([95,1,9,56,13,57,21,58,19,4,7,8,59,11,60,12,61,20,16,62]),import.meta.url).then(n=>({default:n.PortalPage}))),u5=E.lazy(()=>Oe(()=>import("./EscalationListSchemaPage-A4KpTdJA.js"),__vite__mapDeps([96,1,13,4]),import.meta.url).then(n=>({default:n.EscalationListSchemaPage}))),f5=E.lazy(()=>Oe(()=>import("./ScanCodesPage-C2TETaj5.js"),__vite__mapDeps([97,1,98,14,13,4]),import.meta.url).then(n=>({default:n.ScanCodesPage}))),h5=E.lazy(()=>Oe(()=>import("./ScanSchemeDetailPage-C2UgU8l-.js"),__vite__mapDeps([99,1,14,13,82,98,4]),import.meta.url).then(n=>({default:n.ScanSchemeDetailPage}))),d5=E.lazy(()=>Oe(()=>import("./ScanStationPage-nWYz-OD3.js"),__vite__mapDeps([100,1,13,67,57,21,66,4]),import.meta.url).then(n=>({default:n.ScanStationPage}))),m5=E.lazy(()=>Oe(()=>import("./index-C7EIu1mG.js"),__vite__mapDeps([101,1,14,13,54,4]),import.meta.url).then(n=>({default:n.MaintenancePage}))),ux=E.lazy(()=>Oe(()=>import("./OperationsPage-zUaab-CL.js").then(n=>n.O),__vite__mapDeps([102,1,60,13,4,14,9]),import.meta.url).then(n=>({default:n.OperationsPage}))),p5=E.lazy(()=>Oe(()=>import("./index-CpCchhQv.js"),__vite__mapDeps([103,1,18,13,12,3,4,29,26,42,80,7,8,9,31]),import.meta.url).then(n=>({default:n.ControlPlanePage}))),y5=E.lazy(()=>Oe(()=>import("./index-DRw0FXdX.js"),__vite__mapDeps([104,1,36,13,3,4,29,26,6,7,8,9,11,12,14,15]),import.meta.url).then(n=>({default:n.StreamMessagesPage}))),g5=E.lazy(()=>Oe(()=>import("./CredentialsPage-CtrnkHcj.js"),__vite__mapDeps([105,1,14,13,49,82,4]),import.meta.url).then(n=>({default:n.CredentialsPage}))),b5=E.lazy(()=>Oe(()=>import("./ConnectedAppsPage-DXIp2Dpl.js"),__vite__mapDeps([106,1,14,13,49,82,4]),import.meta.url).then(n=>({default:n.ConnectedAppsPage}))),x5=E.lazy(()=>Oe(()=>import("./index-BZFSXEkr.js"),__vite__mapDeps([107,1,4,14,13,12,15,6,8,108,49]),import.meta.url).then(n=>({default:n.FilesPage}))),v5=E.lazy(()=>Oe(()=>import("./index-DCJ483vt.js"),__vite__mapDeps([109,1,14,13,12,15,11,8,108,49,110,41,4]),import.meta.url).then(n=>({default:n.KnowledgePage}))),_5=E.lazy(()=>Oe(()=>import("./LinesPage-pwL46mOS.js"),__vite__mapDeps([111,1,112,7,8,9,12,13,11,14,5,3,4]),import.meta.url).then(n=>({default:n.LinesPage}))),w5=E.lazy(()=>Oe(()=>import("./LinePage-CMsYtukW.js"),__vite__mapDeps([113,1,112,14,13,60,4,12]),import.meta.url).then(n=>({default:n.LinePage}))),S5=E.lazy(()=>Oe(()=>import("./HomePage-67xXjKjN.js"),__vite__mapDeps([114,1,24,26,20,13,16,15,102,60,4,14,9,52]),import.meta.url).then(n=>({default:n.HomePage}))),E5=E.lazy(()=>Oe(()=>import("./AgentsPage-DDFMKHhI.js"),__vite__mapDeps([115,1,116,3,4,6,7,8,9,11,12,13,14,15]),import.meta.url).then(n=>({default:n.AgentsPage}))),O5=E.lazy(()=>Oe(()=>import("./AgentDetailPage-5ov5D9V2.js"),__vite__mapDeps([117,1,116,118,13,16,4]),import.meta.url).then(n=>({default:n.AgentDetailPage}))),fx=E.lazy(()=>Oe(()=>import("./AgentConfigPage-BOe_W2Ij.js"),__vite__mapDeps([119,1,116,118,13,14,110,45,46,47,25,120,121,16,4]),import.meta.url).then(n=>({default:n.AgentConfigPage}))),A5=E.lazy(()=>Oe(()=>import("./CapabilitiesPage-Dfkip6_b.js"),__vite__mapDeps([122,1,120,84,23,45,46,47,13,48,4,44,14,12]),import.meta.url).then(n=>({default:n.CapabilitiesPage}))),j5=E.lazy(()=>Oe(()=>import("./TopicsPage-Bt8gOKYr.js"),__vite__mapDeps([123,1,121,14,13,12,4]),import.meta.url).then(n=>({default:n.TopicsPage}))),k5=E.lazy(()=>Oe(()=>import("./TopicDetailPage-CGO8XV_a.js"),__vite__mapDeps([124,1,121,15,13,4]),import.meta.url).then(n=>({default:n.TopicDetailPage})));function N5(){return h.jsxs("div",{className:"animate-pulse space-y-4",children:[h.jsx("div",{className:"h-8 bg-surface-sunken rounded w-48"}),h.jsx("div",{className:"h-40 bg-surface-sunken rounded"})]})}function Se({children:n}){return h.jsx(E.Suspense,{fallback:h.jsx(N5,{}),children:h.jsx("div",{className:"animate-page-enter flex flex-col flex-1 min-h-0",children:n})})}const a_=new xS({defaultOptions:{queries:{staleTime:1e4,retry:(n,e)=>e instanceof Error&&e.message==="Session expired"?!1:n<1}}});window.addEventListener("auth:unauthorized",()=>{a_.clear(),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info");const n=window.__LT_BASE__||"",e=`${n}/login`;if(window.location.pathname!==e){const s=window.location.pathname+window.location.search,i=n&&s.startsWith(n)?s.slice(n.length)||"/":s;window.location.href=`${e}?returnTo=${encodeURIComponent(i)}`}});const T5=wS([{path:"/login",element:h.jsx(b3,{})},{path:"/connect/anthropic",element:h.jsx(ax,{})},{path:"/connect/:provider",element:h.jsx(ax,{})},{path:"/oauth/consent",element:h.jsx(j3,{})},{path:"/",element:h.jsx(p3,{}),children:[{index:!0,element:h.jsx(Se,{children:h.jsx(S5,{})})},{path:"processes/all",element:h.jsx(Se,{children:h.jsx(M3,{})})},{path:"processes/detail/:originId",element:h.jsx(Se,{children:h.jsx(R3,{})})},{path:"credentials",element:h.jsx(Se,{children:h.jsx(g5,{})})},{path:"connected-apps",element:h.jsx(Se,{children:h.jsx(b5,{})})},{path:"connections",element:h.jsx(un,{to:"/credentials",replace:!0})},{path:"escalations",element:h.jsx(Se,{children:h.jsx(U3,{})})},{path:"escalations/available",element:h.jsx(Se,{children:h.jsx(z3,{})})},{path:"escalations/queue",element:h.jsx(Se,{children:h.jsx($3,{})})},{path:"escalations/detail/:id",element:h.jsx(Se,{children:h.jsx(I3,{})})},{path:"portal/:role/:portal?",element:h.jsx(Se,{children:h.jsx(c5,{})})},{path:"scan/station",element:h.jsx(Se,{children:h.jsx(d5,{})})},{path:"capabilities",element:h.jsx(Se,{children:h.jsx(A5,{})})},{element:h.jsx(Ji,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"agents",element:h.jsx(Se,{children:h.jsx(E5,{})})},{path:"agents/new",element:h.jsx(Se,{children:h.jsx(fx,{})})},{path:"agents/:id",element:h.jsx(Se,{children:h.jsx(O5,{})})},{path:"agents/:id/edit",element:h.jsx(Se,{children:h.jsx(fx,{})})},{path:"topics",element:h.jsx(Se,{children:h.jsx(j5,{})})},{path:"topics/:topic",element:h.jsx(Se,{children:h.jsx(k5,{})})}]},{element:h.jsx(k3,{}),children:[{path:"workflows/start",element:h.jsx(Se,{children:h.jsx(F3,{})})},{path:"workflows/durable/invoke",element:h.jsx(Se,{children:h.jsx(G3,{})})}]},{element:h.jsx(Ji,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:h.jsx(Se,{children:h.jsx(H3,{})})},{path:"workflows/executions",element:h.jsx(Se,{children:h.jsx(Y3,{})})},{path:"workflows/durable/executions",element:h.jsx(Se,{children:h.jsx(V3,{})})},{path:"workflows/durable/executions/:workflowId",element:h.jsx(Se,{children:h.jsx(ox,{})})},{path:"workflows/tasks",element:h.jsx(Se,{children:h.jsx(X3,{})})},{path:"workflows/tasks/detail/:id",element:h.jsx(Se,{children:h.jsx(W3,{})})},{path:"workflows/executions/:workflowId",element:h.jsx(Se,{children:h.jsx(ox,{})})},{path:"workflows/cron",element:h.jsx(un,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:h.jsx(Se,{children:h.jsx(e5,{})})},{path:"workflows/registry",element:h.jsx(Se,{children:h.jsx(t5,{})})},{path:"workflows/registry/new",element:h.jsx(Se,{children:h.jsx(lx,{})})},{path:"workflows/registry/:workflowType",element:h.jsx(Se,{children:h.jsx(lx,{})})}]},{element:h.jsx(Ji,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"mcp/workflows",element:h.jsx(Se,{children:h.jsx(K3,{})})},{path:"mcp/workflows/invoke",element:h.jsx(Se,{children:h.jsx(J3,{})})},{path:"mcp/workflows/:id",element:h.jsx(Se,{children:h.jsx(Q3,{})})},{path:"mcp/executions",element:h.jsx(Se,{children:h.jsx(L3,{})})},{path:"mcp/executions/:jobId",element:h.jsx(Se,{children:h.jsx(q3,{})})},{path:"files",element:h.jsx(Se,{children:h.jsx(x5,{})})},{path:"knowledge",element:h.jsx(Se,{children:h.jsx(v5,{})})},{element:h.jsx(N3,{}),children:[{path:"mcp",element:h.jsx(Se,{children:h.jsx(D3,{})})},{path:"mcp/queries",element:h.jsx(Se,{children:h.jsx(P3,{})})},{path:"mcp/queries/:workflowId",element:h.jsx(Se,{children:h.jsx(B3,{})})},{path:"mcp/tools",element:h.jsx(un,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:h.jsx(Se,{children:h.jsx(n5,{})})},{path:"mcp/servers/new",element:h.jsx(Se,{children:h.jsx(cx,{})})},{path:"mcp/servers/:serverId",element:h.jsx(Se,{children:h.jsx(cx,{})})}]}]},{path:"pace",element:h.jsx(Se,{children:h.jsx(ux,{})})},{path:"trends",element:h.jsx(Se,{children:h.jsx(ux,{})})},{path:"operations",element:h.jsx(un,{to:"/pace",replace:!0})},{element:h.jsx(Ji,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{element:h.jsx(C3,{}),children:[{path:"lines",element:h.jsx(Se,{children:h.jsx(_5,{})})},{path:"lines/:siteId/:lineId",element:h.jsx(Se,{children:h.jsx(w5,{})})}]}]},{element:h.jsx(Ji,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"admin",element:h.jsx(Se,{children:h.jsx(Z3,{})})},{path:"admin/users",element:h.jsx(Se,{children:h.jsx(r5,{})})},{path:"admin/escalation-chains",element:h.jsx(un,{to:"/admin/roles",replace:!0})},{path:"admin/roles",element:h.jsx(Se,{children:h.jsx(s5,{})})},{path:"admin/roles/:role",element:h.jsx(Se,{children:h.jsx(i5,{})})},{path:"admin/roles/:role/schema",element:h.jsx(Se,{children:h.jsx(l5,{})})},{path:"admin/roles/:role/list-schema",element:h.jsx(Se,{children:h.jsx(u5,{})})},{path:"admin/scan-codes",element:h.jsx(Se,{children:h.jsx(f5,{})})},{path:"admin/scan-codes/:version",element:h.jsx(Se,{children:h.jsx(h5,{})})},{path:"admin/personas",element:h.jsx(Se,{children:h.jsx(a5,{})})},{path:"admin/personas/:key",element:h.jsx(Se,{children:h.jsx(o5,{})})}]},{element:h.jsx(Ji,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"admin/bots",element:h.jsx(un,{to:"/admin/users?tab=service-accounts",replace:!0})},{element:h.jsx(T3,{flag:"dbMaintenance"}),children:[{path:"admin/maintenance",element:h.jsx(Se,{children:h.jsx(m5,{})})}]},{path:"admin/controlplane",element:h.jsx(Se,{children:h.jsx(p5,{})})},{path:"admin/streams",element:h.jsx(Se,{children:h.jsx(y5,{})})}]}]}],{basename:window.__LT_BASE__||"/"});function C5(){return h.jsx(vS,{client:a_,children:h.jsx(pE,{children:h.jsx(xA,{children:h.jsx(SS,{router:T5})})})})}jv(Av());const Qm=document.createElement("link");Qm.rel="stylesheet";Qm.href=`${Yt}/api/settings/custom.css`;document.head.appendChild(Qm);iE.createRoot(document.getElementById("root")).render(h.jsx(E.StrictMode,{children:h.jsx(C5,{})}));export{qt as $,hN as A,eR as B,Jm as C,e3 as D,lM as E,Zv as F,tR as G,Um as H,WT as I,LC as J,ZT as K,lC as L,xT as M,Wt as N,sv as O,rM as P,Lm as Q,vM as R,SC as S,_M as T,wM as U,SM as V,EM as W,AM as X,Jj as Y,Ru as Z,oM as _,cR as a,HM as a$,am as a0,sC as a1,K5 as a2,aR as a3,Im as a4,sa as a5,xs as a6,dM as a7,Q5 as a8,bv as a9,uR as aA,Qv as aB,hR as aC,lR as aD,_v as aE,NM as aF,pR as aG,oR as aH,gR as aI,yR as aJ,z5 as aK,$5 as aL,G5 as aM,V5 as aN,I5 as aO,H5 as aP,F5 as aQ,W5 as aR,eM as aS,Z5 as aT,rR as aU,Y5 as aV,Dm as aW,tM as aX,iC as aY,nM as aZ,J5 as a_,FT as aa,pN as ab,mc as ac,gM as ad,bM as ae,Bu as af,mN as ag,lT as ah,nR as ai,Dv as aj,YM as ak,Mu as al,Fm as am,Kj as an,NA as ao,uM as ap,BM as aq,fM as ar,xM as as,OM as at,dv as au,P5 as av,Fg as aw,B5 as ax,mR as ay,fR as az,MM as b,Ns as b0,Ao as b1,bR as b2,Ux as b3,x3 as b4,$M as b5,Yt as b6,Ed as b7,U5 as b8,tC as b9,XM as bA,JM as bB,$T as bC,Vm as bD,Sk as bE,yN as bF,ke as bG,Jd as bH,KM as bI,pv as bJ,iM as bK,DM as bL,vT as bM,xR as bN,vR as bO,i_ as bP,_R as bQ,wR as bR,Hj as bS,wC as bT,Cm as bU,iv as bV,UM as bW,iR as ba,xv as bb,X1 as bc,Lv as bd,PM as be,Mm as bf,LM as bg,GM as bh,Bj as bi,FM as bj,rN as bk,nN as bl,dk as bm,yM as bn,pM as bo,fr as bp,av as bq,IM as br,na as bs,X5 as bt,aN as bu,QM as bv,Fk as bw,jk as bx,WM as by,ZM as bz,Hn as c,VM as d,jM as e,Ek as f,wv as g,uk as h,sM as i,nn as j,An as k,kM as l,ue as m,dR as n,TM as o,CM as p,cM as q,hM as r,mM as s,RM as t,zM as u,aM as v,Km as w,sR as x,ev as y,qM as z};
67
+ //# sourceMappingURL=index-ygxyAKcc.js.map