ryco-cli 0.1.17 → 0.1.18

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 (200) hide show
  1. package/dist/{AcpNativeLogging-OhEq3XNp.cjs → AcpNativeLogging-CUpW8y6E.cjs} +1 -1
  2. package/dist/{AcpNativeLogging-qZgtIa5K.mjs → AcpNativeLogging-hu4rXzHU.mjs} +1 -1
  3. package/dist/{AzureDevOpsSourceControlProvider-B0YsaJyI.mjs → AzureDevOpsSourceControlProvider-C7Ff-COJ.mjs} +2 -2
  4. package/dist/{AzureDevOpsSourceControlProvider-Dyu8KQ_S.cjs → AzureDevOpsSourceControlProvider-DAdboLpu.cjs} +2 -2
  5. package/dist/{BitbucketSourceControlProvider-3VHGKSl1.cjs → BitbucketSourceControlProvider-Bg6lSYm8.cjs} +2 -2
  6. package/dist/{BitbucketSourceControlProvider-B8IPx2Ad.mjs → BitbucketSourceControlProvider-CMPQXie7.mjs} +2 -2
  7. package/dist/{ClaudeDriver-CBCy0_WX.cjs → ClaudeDriver-CILJj4bi.cjs} +2 -2
  8. package/dist/{ClaudeDriver-DsW8yDj9.mjs → ClaudeDriver-Nc7gDoUZ.mjs} +2 -2
  9. package/dist/{CodexDriver-3TZPgrGk.cjs → CodexDriver-CdE1fyKF.cjs} +3 -3
  10. package/dist/{CodexDriver-DLwPz5sk.mjs → CodexDriver-OeWoP24r.mjs} +3 -3
  11. package/dist/{CodexTextGeneration-DLHSW4Mz.cjs → CodexTextGeneration-BJvCqVzm.cjs} +1 -1
  12. package/dist/{CodexTextGeneration-D1vV8grr.mjs → CodexTextGeneration-CKacDpkR.mjs} +1 -1
  13. package/dist/{CopilotDriver-C7a8IhyK.cjs → CopilotDriver-5toln6vu.cjs} +3 -3
  14. package/dist/{CopilotDriver-DXvGBv-s.mjs → CopilotDriver-C6IkwOg5.mjs} +3 -3
  15. package/dist/{CursorDriver-CeB_vMKJ.mjs → CursorDriver-BPyhSbOl.mjs} +3 -3
  16. package/dist/{CursorDriver-uNsDetA3.cjs → CursorDriver-otlL4axb.cjs} +3 -3
  17. package/dist/{ForgejoSourceControlProvider-Ds0rU_PN.mjs → ForgejoSourceControlProvider-Df0EwCPV.mjs} +2 -2
  18. package/dist/{ForgejoSourceControlProvider-CJLksvL_.cjs → ForgejoSourceControlProvider-SZj0DxRM.cjs} +2 -2
  19. package/dist/{GitHubSourceControlProvider-CrYNFu8S.cjs → GitHubSourceControlProvider-D9v0HrDd.cjs} +2 -2
  20. package/dist/{GitHubSourceControlProvider-C7CJAslU.mjs → GitHubSourceControlProvider-G07yjZJS.mjs} +2 -2
  21. package/dist/{GitLabSourceControlProvider-jbX5M34A.cjs → GitLabSourceControlProvider-BTXml3Wh.cjs} +2 -2
  22. package/dist/{GitLabSourceControlProvider-u-Y-e8PV.mjs → GitLabSourceControlProvider-D7NhCVP9.mjs} +2 -2
  23. package/dist/{GrokDriver-BJ00ZiYg.cjs → GrokDriver-BkU6D5ZE.cjs} +3 -3
  24. package/dist/{GrokDriver-CFgjwnvE.mjs → GrokDriver-VxcAlypB.mjs} +3 -3
  25. package/dist/{OpenCodeDriver-BTxd2Q3Q.cjs → OpenCodeDriver-CXvTVYvY.cjs} +2 -2
  26. package/dist/{OpenCodeDriver-DNApoGdu.mjs → OpenCodeDriver-fQlgTeuI.mjs} +2 -2
  27. package/dist/{SourceControlProviderDiscoveryCatalog-CPO3a9_U.cjs → SourceControlProviderDiscoveryCatalog-CR-cmnC-.cjs} +1 -1
  28. package/dist/{SourceControlProviderDiscoveryCatalog-hXWNwRMn.mjs → SourceControlProviderDiscoveryCatalog-dqetZQiC.mjs} +1 -1
  29. package/dist/bin.cjs +16 -14
  30. package/dist/bin.mjs +16 -14
  31. package/dist/client/assets/{AccountSettings-F4ZOTHid.js → AccountSettings-C3YGn5s7.js} +1 -1
  32. package/dist/client/assets/AiFocusSettings-CNucfJ5Y.js +1 -0
  33. package/dist/client/assets/{AnimatedHeight-BC-qaTJY.js → AnimatedHeight-B8ZeY3LL.js} +1 -1
  34. package/dist/client/assets/{AppearanceSettings-B6UaU-_a.js → AppearanceSettings-D1MyfaES.js} +1 -1
  35. package/dist/client/assets/{BranchToolbar.logic-B2jdtYEs.js → BranchToolbar.logic-CN2-yLTE.js} +1 -1
  36. package/dist/client/assets/{ChatRightPanel-CxA4EQ1O.js → ChatRightPanel-DhZiZCcx.js} +6 -6
  37. package/dist/client/assets/{ChatThreadRouteView-BJ6OSbWZ.js → ChatThreadRouteView-CR8HQgm3.js} +1 -1
  38. package/dist/client/assets/CommandPaletteDialog-ChB99Jee.js +1 -0
  39. package/dist/client/assets/{CompositeItem-97y1QiiT.js → CompositeItem-CxRCTsWt.js} +1 -1
  40. package/dist/client/assets/{CompositeRoot-C7Mz4Y_2.js → CompositeRoot-CDscEk_b.js} +1 -1
  41. package/dist/client/assets/{ConnectionsSettings-B8t9Z17K.js → ConnectionsSettings-Dsewo1mI.js} +2 -2
  42. package/dist/client/assets/{DiagnosticsSettings-Bt7j-SXg.js → DiagnosticsSettings-ClUk2Ycp.js} +1 -1
  43. package/dist/client/assets/{DialogHandle-Cl9dQBJp.js → DialogHandle-BGW2rJq8.js} +1 -1
  44. package/dist/client/assets/{DialogPopup-a1M74u16.js → DialogPopup-9zEMlOyz.js} +1 -1
  45. package/dist/client/assets/DialogRoot-Z8JWsDCS.js +1 -0
  46. package/dist/client/assets/{DialogTitle-Bk-w3xLJ.js → DialogTitle-7dK2BQ85.js} +1 -1
  47. package/dist/client/assets/{DialogTrigger-D9nkMFu2.js → DialogTrigger-B7jdDPNa.js} +1 -1
  48. package/dist/client/assets/{DialogViewport-tgJz2Lwn.js → DialogViewport-BrRcGV_l.js} +1 -1
  49. package/dist/client/assets/{DraftChatThreadRouteView-BzcBT-YW.js → DraftChatThreadRouteView-C7HNQzJO.js} +1 -1
  50. package/dist/client/assets/{ExternalIdentityWeb.logic-Bn1HigS9.js → ExternalIdentityWeb.logic-DS77EplU.js} +1 -1
  51. package/dist/client/assets/{GlassSurface-CDok2tTN.js → GlassSurface--5lIEJCy.js} +1 -1
  52. package/dist/client/assets/{HostedConnectionControls-DLrwfgKF.js → HostedConnectionControls-5f2EOB5t.js} +1 -1
  53. package/dist/client/assets/{HostedHubRoot-eqwMpBq5.js → HostedHubRoot-tRaAruhb.js} +1 -1
  54. package/dist/client/assets/{HostedNativeAuthorizationRoute-C11yMgF7.js → HostedNativeAuthorizationRoute-B4SBCUZq.js} +1 -1
  55. package/dist/client/assets/{HostedRelayTrustNotice-CMrrvMuJ.js → HostedRelayTrustNotice-D7TIN2KZ.js} +1 -1
  56. package/dist/client/assets/{Icons-BEtED8P8.js → Icons-CqMTQkuR.js} +1 -1
  57. package/dist/client/assets/{IntegrationsSettingsPanel-rkW9RyYH.js → IntegrationsSettingsPanel-Be0RMI3X.js} +1 -1
  58. package/dist/client/assets/{KeybindingsSettings-CjU5J7hU.js → KeybindingsSettings-BxoOXbJf.js} +1 -1
  59. package/dist/client/assets/{McpServersSettings-D-Gq3vgy.js → McpServersSettings-D6wFULhe.js} +1 -1
  60. package/dist/client/assets/{MobileSheet-BDvnUC5W.js → MobileSheet-fqwVmSQY.js} +1 -1
  61. package/dist/client/assets/{NewWorktreeDialog-C4D-dD0C.js → NewWorktreeDialog-DljDMikm.js} +1 -1
  62. package/dist/client/assets/{NoActiveThreadState-z_FeP4Al.js → NoActiveThreadState-DvLgUR0A.js} +1 -1
  63. package/dist/client/assets/{NodeSecuritySettings-CMjnKY0w.js → NodeSecuritySettings-BYX0uV1b.js} +1 -1
  64. package/dist/client/assets/{OpinionatedPluginsSettings-D9INVQf7.js → OpinionatedPluginsSettings-ZOQ0n5GP.js} +1 -1
  65. package/dist/client/assets/{PhoneGetAppInterstitial-B8iVzT22.js → PhoneGetAppInterstitial-DzlPIIW0.js} +1 -1
  66. package/dist/client/assets/{PhoneGetAppInterstitialBackdrop-BA4R225F.js → PhoneGetAppInterstitialBackdrop-C_j-OVwR.js} +1 -1
  67. package/dist/client/assets/{PhoneHome-BonZTgK7.js → PhoneHome-BIYOn5P7.js} +1 -1
  68. package/dist/client/assets/PhoneSettingsSurface-CL26SDJP.js +1 -0
  69. package/dist/client/assets/{ProjectFavicon-CxXx07Sa.js → ProjectFavicon-BLFEmLYd.js} +1 -1
  70. package/dist/client/assets/{ProviderModelPicker-M_Ezjlmq.js → ProviderModelPicker-CWALhPw5.js} +1 -1
  71. package/dist/client/assets/{ProviderUpdateLaunchNotification.logic-CywRitn3.js → ProviderUpdateLaunchNotification.logic-DcLWligu.js} +1 -1
  72. package/dist/client/assets/{ProvidersSettingsPanel-CtTyCMP0.js → ProvidersSettingsPanel-tIQSB1Ni.js} +1 -1
  73. package/dist/client/assets/{RedactedSensitiveText-BuWSWty8.js → RedactedSensitiveText-DnYWrxD2.js} +1 -1
  74. package/dist/client/assets/RootAppShell-BVqIVDWT.js +6 -0
  75. package/dist/client/assets/{RycoLetterMark-CZYntY8t.js → RycoLetterMark-C1QHVbKN.js} +1 -1
  76. package/dist/client/assets/SettingsDialog-TY6l7DuD.js +1 -0
  77. package/dist/client/assets/SettingsPanels-_-BazuGl.js +3 -0
  78. package/dist/client/assets/{SettingsPanels.editor-lbLEbllb.js → SettingsPanels.editor-Bl_mOgB-.js} +1 -1
  79. package/dist/client/assets/{SourceControlSettings-C_GMp7qk.js → SourceControlSettings-CwRuv7T6.js} +1 -1
  80. package/dist/client/assets/{StatisticsPage-CDukahZF.js → StatisticsPage-DAvOIX_d.js} +1 -1
  81. package/dist/client/assets/{StatisticsPanel-BTdaxoVf.js → StatisticsPanel-BfmqkZgK.js} +1 -1
  82. package/dist/client/assets/{StatisticsSettingsLink-B7SZerf3.js → StatisticsSettingsLink-J-iBGP5I.js} +1 -1
  83. package/dist/client/assets/{ThreadStatusIndicators-D_6jI6us.js → ThreadStatusIndicators-BzpZG_IZ.js} +0 -0
  84. package/dist/client/assets/{ThreadTerminalDrawer-C2B3Ry66.js → ThreadTerminalDrawer-DZy0S10m.js} +1 -1
  85. package/dist/client/assets/{ThreadWorkspacePanel-D8gR7mQC.js → ThreadWorkspacePanel-PRfBFuHE.js} +1 -1
  86. package/dist/client/assets/{ToolbarRootContext-B1g8IP6k.js → ToolbarRootContext-C48gkU4j.js} +1 -1
  87. package/dist/client/assets/{WorkItemsTab-QQXGM1BH.js → WorkItemsTab-EO7aDVI8.js} +4 -4
  88. package/dist/client/assets/{alert-DomE7dAt.js → alert-C24pxxYz.js} +1 -1
  89. package/dist/client/assets/{alert-dialog-9Jyh0e8u.js → alert-dialog-iYnjheVe.js} +1 -1
  90. package/dist/client/assets/archive-BL1hojl3.js +1 -0
  91. package/dist/client/assets/authorization-BNZY2k8w.js +1 -0
  92. package/dist/client/assets/{badge-w43sx8eF.js → badge-tHmsB3yQ.js} +1 -1
  93. package/dist/client/assets/{branding-BS9Iv2ln.js → branding-hWmEaQ8d.js} +1 -1
  94. package/dist/client/assets/{button-DG8WqjNn.js → button-WR80VgkK.js} +1 -1
  95. package/dist/client/assets/{capabilities-tpmeGBtr.js → capabilities-CXhsftU9.js} +1 -1
  96. package/dist/client/assets/{chatThreadActions-BZvyhfKr.js → chatThreadActions-C6tNI5Qi.js} +1 -1
  97. package/dist/client/assets/{collapsible-EhAEe5S9.js → collapsible-BUn1kona.js} +1 -1
  98. package/dist/client/assets/{command-Cyn6yIEa.js → command-CfaBUmS3.js} +1 -1
  99. package/dist/client/assets/composerDraftStore-DXTD6mKH.js +11 -0
  100. package/dist/client/assets/{data-list-DTdqWMGN.js → data-list-jNXWZwx3.js} +1 -1
  101. package/dist/client/assets/desktopUpdateAtoms-C6z0AhGE.js +1 -0
  102. package/dist/client/assets/{desktopWorkspace-CIvAIvMt.js → desktopWorkspace-BFTBEpzF.js} +1 -1
  103. package/dist/client/assets/{device-B3lHunk1.js → device-DB8v-PV8.js} +1 -1
  104. package/dist/client/assets/{dialog-BNmFD6Nh.js → dialog-CwRtKu2U.js} +1 -1
  105. package/dist/client/assets/{draft-input-dP7F8odz.js → draft-input-BHjWDHqU.js} +1 -1
  106. package/dist/client/assets/editorPreferences-BqfWlBPx.js +1 -0
  107. package/dist/client/assets/{empty-Ccxhyvdf.js → empty-CITbdlFs.js} +1 -1
  108. package/dist/client/assets/{env-Bcq9YR3B.js → env-Bcy-9P3V.js} +1 -1
  109. package/dist/client/assets/{getPseudoElementBounds-CO5HJT7x.js → getPseudoElementBounds-BPmVta2g.js} +1 -1
  110. package/dist/client/assets/{group-CzdKmc45.js → group-BpXcg5Ba.js} +1 -1
  111. package/dist/client/assets/{index-C536LXZ6.js → index-CnRziuz2.js} +2 -2
  112. package/dist/client/assets/{input-BZz4eLRl.js → input-Ba4jS4Ks.js} +1 -1
  113. package/dist/client/assets/{kbd-DbvN3zTb.js → kbd-BvgpGZEI.js} +1 -1
  114. package/dist/client/assets/{keybindings-BPE3eEAM.js → keybindings-QVMzXI5S.js} +1 -1
  115. package/dist/client/assets/{label-DZf4lbNF.js → label-2jpS7gCY.js} +1 -1
  116. package/dist/client/assets/{lib-DgOYoged.js → lib-CuR3OHWo.js} +1 -1
  117. package/dist/client/assets/{logging-81iP6Hps.js → logging-CTOc5ONT.js} +1 -1
  118. package/dist/client/assets/{main-BjfqengQ.js → main-C5za36qj.js} +2 -2
  119. package/dist/client/assets/main-CgLLEwXi.css +2 -0
  120. package/dist/client/assets/{menu-B6UEFcn0.js → menu-CsEBcjDz.js} +1 -1
  121. package/dist/client/assets/{popover-BuYzXGwl.js → popover-BpnQc7ji.js} +1 -1
  122. package/dist/client/assets/primary-DiL6nRV-.js +2 -0
  123. package/dist/client/assets/{projectPaths-3WDk4ziK.js → projectPaths-DDcwkag5.js} +1 -1
  124. package/dist/client/assets/{providerDriverMeta-sBwZhQoN.js → providerDriverMeta-DrgHrvO3.js} +1 -1
  125. package/dist/client/assets/{providerIconUtils-DLRASbiu.js → providerIconUtils-VIm6bh4U.js} +1 -1
  126. package/dist/client/assets/providerInstances-pNPE7SuA.js +1 -0
  127. package/dist/client/assets/providerModels-pNPE7SuA.js +1 -0
  128. package/dist/client/assets/{qr-code-Ie92aZvE.js → qr-code-CXu67ChC.js} +1 -1
  129. package/dist/client/assets/{radio-group-BuuTEtdC.js → radio-group-B7kMeg_h.js} +1 -1
  130. package/dist/client/assets/{resolveAriaLabelledBy-0FA0k4xp.js → resolveAriaLabelledBy-DoGkVnyF.js} +1 -1
  131. package/dist/client/assets/{rightPanelRouteSearch-BS8CkNS6.js → rightPanelRouteSearch-YV6CEBkv.js} +1 -1
  132. package/dist/client/assets/runtime-Cy36EhFa.js +1 -0
  133. package/dist/client/assets/{scroll-area-C0yF015F.js → scroll-area-BZayohht.js} +1 -1
  134. package/dist/client/assets/{scrollEdges-DI5Y3mtR.js → scrollEdges-BObY5qgX.js} +1 -1
  135. package/dist/client/assets/{select-CZukJlTn.js → select-DQIoKiCF.js} +1 -1
  136. package/dist/client/assets/{separator-D4ckGtPe.js → separator-DgV5UvWO.js} +1 -1
  137. package/dist/client/assets/{session-logic-DfaSS3p9.js → session-logic-yjrYZ67x.js} +2 -2
  138. package/dist/client/assets/{settingsDialogStore-LxRFC5hh.js → settingsDialogStore-CzH3-ZEg.js} +1 -1
  139. package/dist/client/assets/{settingsLayout-CHJT5wtl.js → settingsLayout-BPKHc7wz.js} +1 -1
  140. package/dist/client/assets/{sheet-BNfImQ-7.js → sheet-BxlpAnIJ.js} +1 -1
  141. package/dist/client/assets/{sidebar-CFGg5Tkr.js → sidebar-CuxI1O8j.js} +1 -1
  142. package/dist/client/assets/{sidebarProjectFolders-DKxZsoOv.js → sidebarProjectFolders-Bi8I6mH5.js} +1 -1
  143. package/dist/client/assets/{sidebarStatusText-C8QBhZhZ.js → sidebarStatusText-DTXq8x3L.js} +1 -1
  144. package/dist/client/assets/{skeleton-DOgQaVXv.js → skeleton-C8KnJ1KQ.js} +1 -1
  145. package/dist/client/assets/{spinner-ClQu8SdC.js → spinner-D9HJGQ01.js} +1 -1
  146. package/dist/client/assets/{src-DmPIm3ie.js → src-CtanPQei.js} +1 -1
  147. package/dist/client/assets/storeSelectors-DMs36CMz.js +1 -0
  148. package/dist/client/assets/{switch-BZjA7VT9.js → switch-B50w01tf.js} +1 -1
  149. package/dist/client/assets/{terminal-links-CzJomeox.js → terminal-links-C5NsgIQU.js} +1 -1
  150. package/dist/client/assets/{textarea-DHdmRD1r.js → textarea-CJ8Vux-T.js} +1 -1
  151. package/dist/client/assets/{threadPinning-UKIVw0OX.js → threadPinning-B5WtT-P_.js} +1 -1
  152. package/dist/client/assets/{threadPriorityRefreshRuntime-BbiIUPfh.js → threadPriorityRefreshRuntime-BnDDqCxq.js} +1 -1
  153. package/dist/client/assets/{toast-C-0Ft2jD.js → toast-CV5dwFOH.js} +1 -1
  154. package/dist/client/assets/{toggle-DsnOFDbJ.js → toggle-DRqyFTHJ.js} +1 -1
  155. package/dist/client/assets/{toggle-group-Chxh9G6t.js → toggle-group-mhVkQLP2.js} +1 -1
  156. package/dist/client/assets/{tooltip-C_-9XEfA.js → tooltip-DZhBSkif.js} +1 -1
  157. package/dist/client/assets/types-DMs36CMz.js +1 -0
  158. package/dist/client/assets/{uiStateStore-DzUrk2GS.js → uiStateStore-OqZLiCwV.js} +1 -1
  159. package/dist/client/assets/{useAtlassian-BTWMzLgJ.js → useAtlassian-zbqx4xW1.js} +0 -0
  160. package/dist/client/assets/{useButton-BmvYhoMC.js → useButton-DXIv8wCn.js} +1 -1
  161. package/dist/client/assets/{useCompositeListItem-D0PvH4nv.js → useCompositeListItem-rrdFaxXB.js} +1 -1
  162. package/dist/client/assets/{useDebouncedValue-s0BC8Yyp.js → useDebouncedValue-Dz3pyT5q.js} +1 -1
  163. package/dist/client/assets/{useFloatingRootContext-CLCaQEJk.js → useFloatingRootContext-CIRRjmkd.js} +1 -1
  164. package/dist/client/assets/{useHandleNewThread-9FAjhuhK.js → useHandleNewThread-DRoY_cL7.js} +1 -1
  165. package/dist/client/assets/{useLabelableId-CB_9OReR.js → useLabelableId-nlk2LM0q.js} +1 -1
  166. package/dist/client/assets/{useLocation-DGJMt6gP.js → useLocation-TExTri5H.js} +1 -1
  167. package/dist/client/assets/{useOpenInteractionType-BSSI2GzS.js → useOpenInteractionType-Co4_pLo_.js} +1 -1
  168. package/dist/client/assets/{usePhoneThreadActions-B7yDFO2l.js → usePhoneThreadActions-CTmdPjGg.js} +1 -1
  169. package/dist/client/assets/{usePopupViewport-8F-J1h5f.js → usePopupViewport-SxCh7dCg.js} +1 -1
  170. package/dist/client/assets/{useScrollLock-CBz-5_MX.js → useScrollLock-cFFkQSYy.js} +1 -1
  171. package/dist/client/assets/{useStatistics-C9g3i7bQ.js → useStatistics-D8hzpDv4.js} +2 -2
  172. package/dist/client/assets/{useSwipeDismiss-D22_vuiH.js → useSwipeDismiss-ALyKckxx.js} +1 -1
  173. package/dist/client/assets/{useThreadActions-CouKkjbt.js → useThreadActions-5hLAJAJB.js} +1 -1
  174. package/dist/client/assets/{useTriggerFocusGuards-f7afwACm.js → useTriggerFocusGuards-lOK7sLv0.js} +1 -1
  175. package/dist/client/assets/{useValueChanged-EkWF0C3k.js → useValueChanged-BQLjL43O.js} +1 -1
  176. package/dist/client/assets/{utils-CV2fJJxC.js → utils-Ct58OPtz.js} +1 -1
  177. package/dist/client/index.html +1 -1
  178. package/dist/{collectUint8StreamText-oFvWyN3_.mjs → collectUint8StreamText-Bwltp7kn.mjs} +10 -0
  179. package/dist/{collectUint8StreamText-Dsbmrw73.cjs → collectUint8StreamText-D0THfPrP.cjs} +10 -0
  180. package/dist/{makeManagedServerProvider-CANTNAsz.cjs → makeManagedServerProvider-B7rRjRgd.cjs} +1 -1
  181. package/dist/{makeManagedServerProvider-PLtJj7EV.mjs → makeManagedServerProvider-BMSV4Aim.mjs} +1 -1
  182. package/package.json +1 -1
  183. package/dist/client/assets/AiFocusSettings-DwIYKKIc.js +0 -1
  184. package/dist/client/assets/CommandPaletteDialog-DywhkOKa.js +0 -1
  185. package/dist/client/assets/DialogRoot-C_DO1gtO.js +0 -1
  186. package/dist/client/assets/PhoneSettingsSurface-B-6LoBMV.js +0 -1
  187. package/dist/client/assets/RootAppShell-DJfVW8Xa.js +0 -6
  188. package/dist/client/assets/SettingsDialog-ClIbtJ2y.js +0 -1
  189. package/dist/client/assets/SettingsPanels-DshjYQGk.js +0 -3
  190. package/dist/client/assets/authorization-D8lJzXTE.js +0 -1
  191. package/dist/client/assets/composerDraftStore-TYv9j3vY.js +0 -11
  192. package/dist/client/assets/desktopUpdateAtoms-BpN7gP0v.js +0 -1
  193. package/dist/client/assets/editorPreferences-DiUypD3L.js +0 -1
  194. package/dist/client/assets/main-DlGNPwsH.css +0 -2
  195. package/dist/client/assets/primary-CiDY2oUi.js +0 -2
  196. package/dist/client/assets/providerInstances-vd2eZtHx.js +0 -1
  197. package/dist/client/assets/providerModels-vd2eZtHx.js +0 -1
  198. package/dist/client/assets/runtime-CYtynKGT.js +0 -1
  199. package/dist/client/assets/storeSelectors-BeLJe5C1.js +0 -1
  200. package/dist/client/assets/types-BeLJe5C1.js +0 -1
@@ -1 +0,0 @@
1
- import{i as e,t}from"./react-SIfiwpqq.js";import{t as n}from"./index-C536LXZ6.js";import{t as r}from"./compiler-runtime-qmuS0Svy.js";import{n as i,t as a}from"./env-Bcq9YR3B.js";import{Hn as o,P as s,Xn as c,Yn as l,Yt as u,bn as d,xn as f}from"./runtime-CYtynKGT.js";import{i as p}from"./primary-CiDY2oUi.js";import{It as m}from"./composerDraftStore-TYv9j3vY.js";import{d as h,l as g}from"./useSwipeDismiss-D22_vuiH.js";import{t as _}from"./useNavigate-2tVq4iZ2.js";import{t as v}from"./settingsDialogStore-LxRFC5hh.js";import{o as y}from"./desktopWorkspace-CIvAIvMt.js";import{t as ee}from"./activity-1CkdQG5u.js";import{a as te,i as b,n as x,o as ne,r as S,t as C}from"./SettingsPanels-DshjYQGk.js";import{m as w,p as re}from"./desktopUpdateAtoms-BpN7gP0v.js";import{t as T}from"./chart-column-Dw6ACmXM.js";import{t as E}from"./git-branch-BKr-Ij4u.js";import{t as D}from"./keyboard-BqeRMHfL.js";import{t as O}from"./palette-BSD_aJZg.js";import{t as ie}from"./search-BGQsenCM.js";import{t as ae}from"./settings-2-CZQg_KUQ.js";import{t as k}from"./server-JApJpgLa.js";import{t as oe}from"./shield-IZEIJ8r7.js";import{t as A}from"./sparkles-CAf3oJ5S.js";import{t as j}from"./user-round-Cpzx8pSw.js";import{t as se}from"./utils-CV2fJJxC.js";import{t as ce}from"./scroll-area-C0yF015F.js";import{t as M}from"./button-DG8WqjNn.js";import{c as le,s as ue,t as de}from"./dialog-BNmFD6Nh.js";import{i as fe,n as pe,o as me,s as he,t as ge}from"./settingsSections.logic-F8RXVmAq.js";var N=e(t(),1),P=r(),_e=[{section:`inbox`,title:`AI Focus`,description:`Prioritize the Inbox with bounded, environment-local model ranking.`,keywords:`priority sort active threads model ranking focus refresh`},{section:`inbox`,title:`AI Focus models`,description:`Choose or inherit the ranking model for each connected environment.`,keywords:`provider node disclosure privacy data`},{section:`general`,title:`Time format`,description:`System default, 12-hour or 24-hour clock.`,keywords:`clock hours`},{section:`general`,title:`Default editor`,description:`Pin which editor opens directories and files.`,keywords:`vscode cursor open in`},{section:`general`,title:`Diff line wrapping`,description:`Default wrap state when the diff panel opens.`,keywords:`word wrap`},{section:`general`,title:`Hide whitespace changes`,description:`Whether the diff panel ignores whitespace-only edits.`,keywords:`diff`},{section:`general`,title:`Remote Git status`,description:`Refresh remote branch and pull request metadata.`,keywords:`git polling refresh remote`},{section:`general`,title:`PR & workflow updates`,description:`Choose automatic, reduced, or manual pull request and workflow refreshes.`,keywords:`github actions checks ci polling refresh`},{section:`general`,title:`Stream token by token (legacy)`,description:`Compatibility mode for token-by-token assistant output.`,keywords:`token streaming assistant output streaming tokens buffered`,targetId:`legacy-token-streaming`},{section:`general`,title:`Provider update checks`,description:`Check installed provider CLIs for newer versions.`,keywords:`upgrade cli`},{section:`general`,title:`Auto-open overview`,description:`Open the overview when plans or progress appear.`,keywords:`panel plan`},{section:`general`,title:`New threads`,description:`Default workspace mode for newly created drafts.`,keywords:`local worktree draft`},{section:`general`,title:`Add project starts in`,description:`Starting directory for the Add Project browser.`,keywords:`folder path`},{section:`general`,title:`Archive confirmation`,description:`Ask before archiving a thread.`,keywords:`confirm`},{section:`general`,title:`Delete confirmation`,description:`Ask before deleting a thread.`,keywords:`confirm remove`},{section:`general`,title:`Unpin confirmation`,description:`Ask before removing a thread from pinned threads.`,keywords:`confirm pin unpin favorite`},{section:`general`,title:`Update track`,description:`Which release channel the app follows.`,keywords:`beta stable release channel`},{section:`appearance`,title:`Interface font`,description:`Normal app text, navigation, dialogs, and controls.`,keywords:`typeface dm sans inter geist`},{section:`appearance`,title:`Code font`,description:`Code blocks, diffs, file paths, and terminal surfaces.`,keywords:`monospace jetbrains fira`},{section:`appearance`,title:`Text size`,description:`Scale the interface independently from the theme.`,keywords:`zoom font size compact`},{section:`appearance`,title:`Corner radius`,description:`Rounding for panels, buttons, inputs, and menus.`,keywords:`round square`},{section:`appearance`,title:`Primary color`,description:`Accent color for links, focus rings, and actions.`,keywords:`accent custom violet amber`},{section:`appearance`,title:`Transparency`,description:`Glass and floating surfaces like dialogs, menus, popups.`,keywords:`glass blur liquid material solid`},{section:`appearance`,title:`Theme palette`,description:`Built-in and custom color themes; import and export.`,keywords:`dark midnight graphite nord dracula catppuccin`},{section:`appearance`,title:`Auto-collapse wide composer labels`,description:`Show long composer mode labels only on hover or focus.`,keywords:`chips`},{section:`appearance`,title:`Always use Build mode`,description:`Hide the mode selector and send every turn in Build mode.`,keywords:`composer`},{section:`appearance`,title:`Theme variant`,description:`Light, dark, or follow the system preference.`,keywords:`color mode dark light`},{section:`providers`,title:`Provider instances`,description:`Configure Codex, Claude, Copilot, OpenCode, and Cursor.`,keywords:`api model driver accent`},{section:`mcp-servers`,title:`External integrations`,description:`Pair local Codex or Claude MCP clients with scoped, revocable access.`,keywords:`model context protocol tools pairing codex claude approval agent control`},{section:`mcp-servers`,title:`MCP Servers`,description:`Manage Codex, Claude, and other provider-native MCP servers.`,keywords:`model context protocol tools add server oauth profiles providers`},{section:`keybindings`,title:`Keybindings file`,description:`Customize shortcuts via the keybindings configuration file.`,keywords:`shortcuts hotkeys keyboard`},{section:`source-control`,title:`Version Control`,description:`Git behavior and defaults.`,keywords:`git commit`},{section:`source-control`,title:`Source Control Providers`,description:`GitHub and other source control provider connections.`,keywords:`github pr pull request`},{section:`connections`,title:`Network access`,description:`Expose the local backend on your network.`,keywords:`lan host remote`},{section:`connections`,title:`Pairing link`,description:`Scan to open this backend on another device.`,keywords:`qr code phone mobile`},{section:`connections`,title:`Tailscale HTTPS`,description:`Serve over your tailnet with HTTPS.`,keywords:`vpn remote`},{section:`connections`,title:`Authorized clients`,description:`Devices and sessions allowed to connect.`,keywords:`revoke tokens`},{section:`security`,title:`Session code`,description:`Compare this browser's channel against the one your node's CLI shows.`,keywords:`security verification websas e2ee compare short authentication string`},{section:`security`,title:`Enrollment fingerprint`,description:`This node's identity, and the prekey and continuity behind it.`,keywords:`security e2ee key fingerprint rotate lineage`},{section:`security`,title:`Authorized client keys`,description:`Approve, reduce, revoke, or delete a client key, and open a pairing window.`,keywords:`security e2ee pairing fingerprint refused attempts`},{section:`security`,title:`Admission policy`,description:`Require E2EE, require approved clients, and advance the policy generation.`,keywords:`security e2ee strict fallback plaintext`},{section:`diagnostics`,title:`Diagnostics`,description:`Logs, tracing, resource history, and live activity.`,keywords:`debug performance slow`},{section:`diagnostics`,title:`Test notification`,description:`Fire sample notifications to preview the toast design and stacking.`,keywords:`toast notifications preview trigger sample`},{section:`statistics`,title:`Statistics`,description:`Usage activity and history.`,keywords:`heatmap usage tokens`},{section:`archived`,title:`Archive`,description:`Archived threads; restore or delete permanently.`,keywords:`trash restore`}],F=m(),ve=[{id:`account`,label:`Account`,icon:j},{id:`general`,label:`General`,icon:ae},{id:`inbox`,label:`Inbox`,icon:A},{id:`providers`,label:`Providers`,icon:ne},{id:`opinionated-plugins`,label:`Plugins`,icon:b},{id:`mcp-servers`,label:`Integrations`,icon:k},{id:`appearance`,label:`Appearance`,icon:O},{id:`keybindings`,label:`Keybindings`,icon:D},{id:`source-control`,label:`Source Control`,icon:E},{id:`connections`,label:`Connections`,icon:te},{id:`security`,label:`Security`,icon:oe},{id:`diagnostics`,label:`Diagnostics`,icon:ee},{id:`statistics`,label:`Statistics`,icon:T},{id:`archived`,label:`Archive`,icon:w}];ve.map(e=>e.id),new Map(ve.map(e=>[e.id,e.label]));var ye=new Set([`general`,`providers`,`appearance`]),I=(0,N.lazy)(()=>n(()=>import(`./AccountSettings-F4ZOTHid.js`).then(e=>({default:e.AccountSettingsPanel})),[])),be=(0,N.lazy)(()=>n(()=>import(`./ProvidersSettingsPanel-CtTyCMP0.js`).then(e=>({default:e.ProvidersSettingsPanel})),[])),L=(0,N.lazy)(()=>n(()=>import(`./AiFocusSettings-DwIYKKIc.js`).then(e=>({default:e.AiFocusSettings})),[])),R=(0,N.lazy)(()=>n(()=>import(`./OpinionatedPluginsSettings-D9INVQf7.js`).then(e=>({default:e.OpinionatedPluginsSettingsPanel})),[])),xe=(0,N.lazy)(()=>n(()=>import(`./IntegrationsSettingsPanel-rkW9RyYH.js`).then(e=>({default:e.IntegrationsSettingsPanel})),[])),Se=(0,N.lazy)(()=>n(()=>import(`./AppearanceSettings-B6UaU-_a.js`).then(e=>({default:e.AppearanceSettingsPanel})),[])),z=(0,N.lazy)(()=>n(()=>import(`./KeybindingsSettings-CjU5J7hU.js`).then(e=>({default:e.KeybindingsSettingsPanel})),[])),B=(0,N.lazy)(()=>n(()=>import(`./SourceControlSettings-C_GMp7qk.js`).then(e=>({default:e.SourceControlSettingsPanel})),[])),Ce=(0,N.lazy)(()=>n(()=>import(`./ConnectionsSettings-B8t9Z17K.js`).then(e=>({default:e.ConnectionsSettings})),[])),V=(0,N.lazy)(()=>n(()=>import(`./NodeSecuritySettings-CMjnKY0w.js`).then(e=>({default:e.NodeSecuritySettings})),[])),H=(0,N.lazy)(()=>n(()=>import(`./DiagnosticsSettings-Bt7j-SXg.js`).then(e=>({default:e.DiagnosticsSettings})),[])),U=(0,N.lazy)(()=>n(()=>import(`./StatisticsSettingsLink-B7SZerf3.js`).then(e=>({default:e.StatisticsSettingsLink})),[]));function we(e){let t=(0,P.c)(6),{onRestored:n}=e,{changedSettingLabels:r,restoreDefaults:i}=S(n),a=r.length===0,o;t[0]===i?o=t[1]:(o=()=>void i(),t[0]=i,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,F.jsx)(re,{className:`size-3.5`}),t[2]=s):s=t[2];let c;return t[3]!==a||t[4]!==o?(c=(0,F.jsxs)(M,{size:`xs`,variant:`outline`,disabled:a,onClick:o,children:[s,`Restore defaults`]}),t[3]=a,t[4]=o,t[5]=c):c=t[5],c}function Te(e){let t=(0,P.c)(45),{section:n,searchTargetId:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,F.jsx)(`div`,{className:`flex min-h-80 items-center justify-center text-muted-foreground text-sm`,children:`Loading settings...`}),t[0]=i):i=t[0];let a;t[1]===n?a=t[2]:(a=n===`account`?(0,F.jsx)(I,{}):null,t[1]=n,t[2]=a);let o;t[3]!==r||t[4]!==n?(o=n===`general`?(0,F.jsx)(x,{searchTargetId:r}):null,t[3]=r,t[4]=n,t[5]=o):o=t[5];let s;t[6]===n?s=t[7]:(s=n===`inbox`?(0,F.jsx)(L,{}):null,t[6]=n,t[7]=s);let c;t[8]===n?c=t[9]:(c=n===`providers`?(0,F.jsx)(be,{}):null,t[8]=n,t[9]=c);let l;t[10]===n?l=t[11]:(l=n===`opinionated-plugins`?(0,F.jsx)(R,{}):null,t[10]=n,t[11]=l);let u;t[12]===n?u=t[13]:(u=n===`mcp-servers`?(0,F.jsx)(xe,{}):null,t[12]=n,t[13]=u);let d;t[14]===n?d=t[15]:(d=n===`appearance`?(0,F.jsx)(Se,{}):null,t[14]=n,t[15]=d);let f;t[16]===n?f=t[17]:(f=n===`keybindings`?(0,F.jsx)(z,{}):null,t[16]=n,t[17]=f);let p;t[18]===n?p=t[19]:(p=n===`source-control`?(0,F.jsx)(B,{}):null,t[18]=n,t[19]=p);let m;t[20]===n?m=t[21]:(m=n===`connections`?(0,F.jsx)(Ce,{}):null,t[20]=n,t[21]=m);let h;t[22]===n?h=t[23]:(h=n===`security`?(0,F.jsx)(V,{}):null,t[22]=n,t[23]=h);let g;t[24]===n?g=t[25]:(g=n===`diagnostics`?(0,F.jsx)(H,{}):null,t[24]=n,t[25]=g);let _;t[26]===n?_=t[27]:(_=n===`statistics`?(0,F.jsx)(U,{}):null,t[26]=n,t[27]=_);let v;t[28]===n?v=t[29]:(v=n===`archived`?(0,F.jsx)(C,{}):null,t[28]=n,t[29]=v);let y;return t[30]!==p||t[31]!==m||t[32]!==h||t[33]!==g||t[34]!==_||t[35]!==v||t[36]!==a||t[37]!==o||t[38]!==s||t[39]!==c||t[40]!==l||t[41]!==u||t[42]!==d||t[43]!==f?(y=(0,F.jsxs)(N.Suspense,{fallback:i,children:[a,o,s,c,l,u,d,f,p,m,h,g,_,v]}),t[30]=p,t[31]=m,t[32]=h,t[33]=g,t[34]=_,t[35]=v,t[36]=a,t[37]=o,t[38]=s,t[39]=c,t[40]=l,t[41]=u,t[42]=d,t[43]=f,t[44]=y):y=t[44],y}function Ee(){let e=(0,P.c)(19),t=_(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={strict:!1,select:Re},e[0]=n):n=e[0];let r=h(n),m=p(),g=o(),ee=u(Le),te=y(),b=v(Ie),x=v(Fe),ne=v(Pe),S=v(Ne),C=v(Me),w=c({requestedEnvironmentId:ne,routedEnvironmentId:r,activeEnvironmentId:ee,primaryEnvironmentId:m?.environmentId??null}),re=d(e=>w?e.byId[w]??null:null),T=f(e=>w?e.byId[w]??null:null),E=w!==null&&w===m?.environmentId,D=w?te.machines.find(e=>e.environmentId===w)??null:null,O=E?g:T?.serverConfig??null,ae=E?m?.label??O?.environment.label??`Current node`:T?.descriptor?.label??O?.environment.label??re?.label??D?.label??`Selected node`,k=w?{environmentId:w,nodeLabel:ae,serverConfig:O,primary:E,connected:E?O!==null:T?.connectionState===`connected`||D?.connectionState===`connected`}:null,oe=s(je),A=s(Ae),j=s(ke),M=i(),I=ge(A,j),be=pe(oe,A,j),L=ve.filter(e=>me(e.id,{hosted:M,role:be})),R=L.some(e=>e.id===x)?x:L[0]?.id??`appearance`,xe=he(R),Se=fe(xe,{nativeClient:a,nodeLabel:k?.nodeLabel??null});(0,N.useEffect)(()=>{M&&!I||b&&x!==R&&C(R)},[R,M,b,I,x,C]);let[z,B]=(0,N.useState)(``),[Ce,V]=(0,N.useState)(null),H,U;e[1]===b?(H=e[2],U=e[3]):(H=()=>{b||(B(``),V(null))},U=[b],e[1]=b,e[2]=H,e[3]=U),(0,N.useEffect)(H,U);let Ee=new Set(L.map(Oe)),W=z.trim().toLowerCase(),ze=W.length===0?[]:_e.filter(e=>Ee.has(e.section)&&`${e.title} ${e.description} ${e.keywords??``}`.toLowerCase().includes(W)),[Be,Ve]=(0,N.useState)(0),G;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(G=()=>{Ve(De)},e[4]=G):G=e[4];let He=G,Ue=ye.has(R),We=Math.max(0,L.findIndex(e=>e.id===R)),K;e[5]===S?K=e[6]:(K=e=>{e||S()},e[5]=S,e[6]=K);let q;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,F.jsx)(le,{className:`text-base font-semibold`,children:`Settings`}),e[7]=q):q=e[7];let J;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,F.jsx)(ie,{"aria-hidden":!0,className:`pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-muted-foreground/60`}),e[8]=J):J=e[8];let Y;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(Y=e=>{V(null),B(e.target.value)},e[9]=Y):Y=e[9];let X;e[10]===z?X=e[11]:(X=(0,F.jsxs)(`div`,{className:`relative w-72 max-w-[40vw]`,children:[J,(0,F.jsx)(`input`,{type:`search`,value:z,onChange:Y,placeholder:`Search settings…`,"aria-label":`Search settings`,className:`h-8 w-full rounded-md border border-input bg-muted/40 pr-3 pl-8 text-[13px] outline-none transition-colors placeholder:text-muted-foreground/60 focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/40`})]}),e[10]=z,e[11]=X);let Ge=Ue?(0,F.jsx)(we,{onRestored:He}):null,Z;e[12]===Ge?Z=e[13]:(Z=(0,F.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 pr-9`,children:Ge}),e[12]=Ge,e[13]=Z);let Ke=`translateY(${We*2.5}rem)`,Q;e[14]===Ke?Q=e[15]:(Q=(0,F.jsx)(`span`,{className:`pointer-events-none absolute top-2 right-2 left-2 z-0 h-9 rounded-md bg-accent transition-transform duration-[240ms] ease-out`,style:{transform:Ke},"aria-hidden":!0}),e[14]=Ke,e[15]=Q);let qe=ce,Je=W.length>0?(0,F.jsx)(`div`,{className:`p-4`,children:(0,F.jsx)(`div`,{className:`flex flex-col gap-0.5 rounded-xl border border-border bg-card p-1.5 shadow-sm/4`,children:ze.length===0?(0,F.jsxs)(`p`,{className:`px-2 py-8 text-center text-sm text-muted-foreground`,children:[`No settings match “`,z.trim(),`”.`]}):ze.map(e=>{let n=L.find(t=>t.id===e.section)?.label;return(0,F.jsxs)(`button`,{type:`button`,onClick:()=>{if(e.section===`statistics`){S(),t({to:`/statistics`});return}V(e.targetId??null),C(e.section),B(``)},className:`flex flex-col gap-0.5 rounded-md px-3 py-2.5 text-left outline-hidden ring-ring transition-colors hover:bg-accent focus-visible:ring-2`,children:[(0,F.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,F.jsx)(`span`,{className:`text-sm font-medium`,children:e.title}),n?(0,F.jsx)(`span`,{className:`text-[11px] text-muted-foreground/70`,children:n}):null]}),(0,F.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.description})]},`${e.section}:${e.title}`)})})}):(0,F.jsx)(`div`,{className:`flex flex-col`,children:(0,F.jsx)(Te,{section:R,searchTargetId:Ce})},Be),$;return e[16]!==qe||e[17]!==Je?($=(0,F.jsx)(qe,{className:`min-h-0 min-w-0 flex-1`,children:Je}),e[16]=qe,e[17]=Je,e[18]=$):$=e[18],(0,F.jsx)(de,{open:b,onOpenChange:K,children:(0,F.jsx)(l,{value:k,children:(0,F.jsxs)(ue,{className:`project-glass-surface h-[min(88dvh,880px)] max-w-[1180px] overflow-hidden p-0`,bottomStickOnMobile:!1,showCloseButton:!0,surface:`glass`,children:[(0,F.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center justify-between border-b border-border px-5`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-4`,children:[(0,F.jsxs)(`div`,{className:`flex shrink-0 items-baseline gap-2`,children:[q,(0,F.jsx)(`span`,{"data-testid":`settings-scope-label`,className:`max-w-48 truncate text-xs text-muted-foreground`,children:Se})]}),X]}),Z]}),(0,F.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-row`,children:[(0,F.jsxs)(`nav`,{className:`relative isolate flex w-12 shrink-0 flex-col gap-1 border-r border-border p-2 sm:w-48`,children:[Q,L.map(e=>{let t=e.icon,n=R===e.id;return(0,F.jsxs)(`button`,{type:`button`,onClick:()=>{V(null),C(e.id)},className:se(`relative z-10 flex h-9 items-center gap-2.5 rounded-md px-2 text-left text-[13px] outline-hidden ring-ring transition-colors duration-150 focus-visible:ring-2`,n?`font-medium text-foreground`:`text-muted-foreground/70 hover:text-foreground/80`),"aria-label":e.label,"aria-current":n?`page`:void 0,children:[(0,F.jsx)(t,{className:se(`size-4 shrink-0`,n?`text-foreground`:`text-muted-foreground/60`)}),(0,F.jsx)(`span`,{className:`hidden truncate sm:inline`,children:e.label})]},e.id)})]}),$]})]})})})}function De(e){return e+1}function Oe(e){return e.id}function ke(e){return e.transportStatus}function Ae(e){return e.directoryStatus}function je(e){return e.effectiveRole}function Me(e){return e.setSection}function Ne(e){return e.closeSettings}function Pe(e){return e.targetEnvironmentId}function Fe(e){return e.section}function Ie(e){return e.open}function Le(e){return e.activeEnvironmentId}function Re(e){return g(e)?.environmentId??null}export{Ee as SettingsDialog};
@@ -1,3 +0,0 @@
1
- import{i as e,t}from"./react-SIfiwpqq.js";import{t as n}from"./compiler-runtime-qmuS0Svy.js";import{_ as r,t as i}from"./env-Bcq9YR3B.js";import{T as a,V as o,bl as s,ut as c}from"./src-DmPIm3ie.js";import{Bn as l,Cn as u,It as d,Kn as f,Kt as p,Sn as m,Vn as h,Yt as g,Zn as _,zn as v}from"./runtime-CYtynKGT.js";import{It as y}from"./composerDraftStore-TYv9j3vY.js";import{i as b,t as x}from"./branding-BS9Iv2ln.js";import{f as S}from"./useRenderElement-DchFnsR8.js";import{c as C,l as w,m as T,n as E,o as D,r as O,s as k,t as A}from"./desktopUpdateAtoms-BpN7gP0v.js";import{t as j}from"./chevron-right-BWYGybX9.js";import{i as M}from"./toast-C-0Ft2jD.js";import{t as N}from"./shallow-DWZCFNun.js";import{i as P}from"./timestampFormat-8uPXS812.js";import{i as ee,n as te,t as ne}from"./tooltip-C_-9XEfA.js";import{t as F}from"./switch-BZjA7VT9.js";import{t as I}from"./ProjectFavicon-CxXx07Sa.js";import{t as re}from"./button-DG8WqjNn.js";import{t as L}from"./toastHelpers-CSQRKo4F.js";import{t as ie}from"./capabilities-tpmeGBtr.js";import{t as R}from"./useThreadActions-CouKkjbt.js";import{t as z}from"./usePresentationTier-B_SCFvN7.js";import{a as ae,i as B,o as oe,s as se,t as ce}from"./select-CZukJlTn.js";import{r as le,t as V}from"./editorPreferences-DiUypD3L.js";import{t as H}from"./RycoLetterMark-CZYntY8t.js";import{t as U}from"./useLongPress-OGlhYKlH.js";import{t as W}from"./useTheme-By1kfyiU.js";import{a as ue,i as G,o as K,r as de,t as q}from"./empty-Ccxhyvdf.js";import{i as fe,n as pe,r as J,t as Y}from"./settingsLayout-CHJT5wtl.js";import{i as me}from"./settingsSections.logic-F8RXVmAq.js";import{n as he,t as ge}from"./SettingsPanels.editor-lbLEbllb.js";import{n as _e,r as ve,t as ye}from"./collapsible-EhAEe5S9.js";import{t as be}from"./draft-input-dP7F8odz.js";var xe=S(`archive-x`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`m9.5 17 5-5`,key:`nakeu6`}],[`path`,{d:`m9.5 12 5 5`,key:`1hccrj`}]]),Se=S(`blocks`,[[`path`,{d:`M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2`,key:`1ah6g2`}],[`rect`,{x:`14`,y:`2`,width:`8`,height:`8`,rx:`1`,key:`88lufb`}]]),Ce=S(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),we=S(`plug-zap`,[[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m18 3-4 4h6l-4 4`,key:`16psg9`}]]),X=n(),Te=e(t(),1),Z=y(),Ee={locale:`System default`,"12-hour":`12-hour`,"24-hour":`24-hour`},De={0:`Off`,1e4:`10 seconds`,3e4:`30 seconds`,6e4:`1 minute`,3e5:`5 minutes`},Oe=[0,1e4,3e4,6e4,3e5],ke={automatic:`Automatic`,reduced:`Reduced`,manual:`Manual`},Ae=[`automatic`,`reduced`,`manual`];function je(e){if(e===null)return null;let t=Number.parseInt(e,10);return Oe.includes(t)?t:null}function Me(e){return Ae.find(t=>t===e)??null}function Ne(e){let t=(0,X.c)(2),{editor:n}=e,r=ge[n];if(!r)return null;let i;return t[0]===r?i=t[1]:(i=(0,Z.jsx)(r,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}),t[0]=r,t[1]=i),i}function Pe(){let e=(0,X.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{children:`Version`}),(0,Z.jsx)(`code`,{className:`text-[11px] font-medium text-muted-foreground`,children:b})]}),e[0]=t):t=e[0],t}var Fe=`https://github.com/sak0a/ryco`;function Q(e){m().shell.openExternal(e).catch(e=>{M.add(L({type:`error`,title:`Could not open link`,description:e instanceof Error?e.message:`Failed to open external link.`}))})}function Ie(){let e=(0,X.c)(3),t,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(H,{className:`h-14 text-foreground`}),n=(0,Z.jsx)(`h3`,{className:`text-base font-semibold tracking-tight text-foreground`,children:x}),e[0]=t,e[1]=n):(t=e[0],n=e[1]);let r;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-4 pt-6 pb-5 text-center sm:px-5`,children:[t,n,(0,Z.jsx)(`div`,{className:`space-y-0.5 text-[11px] text-muted-foreground`,children:(0,Z.jsx)(`p`,{children:(0,Z.jsx)(`button`,{type:`button`,onClick:Le,className:`underline-offset-2 hover:text-foreground hover:underline`,children:`github.com/sak0a/ryco`})})})]}),e[2]=r):r=e[2],r}function Le(){return Q(Fe)}function Re(e){let t=(0,X.c)(46),{scopeLabel:n}=e,r=E(),[i,a]=(0,Te.useState)(!1),o=typeof window<`u`&&!!window.desktopBridge,s=r?.channel??`latest`,c;t[0]===s?c=t[1]:(c=e=>{let t=window.desktopBridge;!t||typeof t.setUpdateChannel!=`function`||e===s||(a(!0),t.setUpdateChannel(e).then(Ke).catch(Ge).finally(()=>{a(!1)}))},t[0]=s,t[1]=c);let l=c,u;t[2]===r?u=t[3]:(u=()=>{let e=window.desktopBridge;if(!e)return;let t=r?w(r):`none`;if(t===`download`){e.downloadUpdate().then(We).catch(Ue);return}if(t===`install`){if(!window.confirm(k(r??{availableVersion:null,downloadedVersion:null})))return;e.installUpdate().then(He).catch(Ve);return}typeof e.checkForUpdate==`function`&&e.checkForUpdate().then(Be).catch(ze)},t[2]=r,t[3]=u);let d=u,f;t[4]===r?f=t[5]:(f=r?w(r):`none`,t[4]=r,t[5]=f);let p=f,m;t[6]===r?m=t[7]:(m=r?D(r):null,t[6]=r,t[7]=m);let h=m,g;t[8]!==p||t[9]!==r?(g=p===`none`?!O(r):C(r),t[8]=p,t[9]=r,t[10]=g):g=t[10];let _=g,v;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(v={download:`Download`,install:`Install`},t[11]=v):v=t[11];let y=v,b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b={checking:`Checking…`,downloading:`Downloading…`,"up-to-date":`Up to Date`},t[12]=b):b=t[12];let x=b,S=y[p]??x[r?.status??``]??`Check for Updates`,T=p===`download`||p===`install`?`Update available.`:`Current version of the application.`,A;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(Pe,{}),t[13]=A):A=t[13];let j=p===`install`?`default`:`outline`,M;t[14]!==_||t[15]!==S||t[16]!==d||t[17]!==j?(M=(0,Z.jsx)(ee,{render:(0,Z.jsx)(re,{size:`xs`,variant:j,disabled:_,onClick:d,children:S})}),t[14]=_,t[15]=S,t[16]=d,t[17]=j,t[18]=M):M=t[18];let N;t[19]===h?N=t[20]:(N=h?(0,Z.jsx)(te,{children:h}):null,t[19]=h,t[20]=N);let P;t[21]!==M||t[22]!==N?(P=(0,Z.jsxs)(ne,{children:[M,N]}),t[21]=M,t[22]=N,t[23]=P):P=t[23];let F;t[24]!==T||t[25]!==n||t[26]!==P?(F=(0,Z.jsx)(J,{title:A,description:T,scope:n,control:P}),t[24]=T,t[25]=n,t[26]=P,t[27]=F):F=t[27];let I;t[28]===l?I=t[29]:(I=e=>{l(e)},t[28]=l,t[29]=I);let L=!o||i,ie=s===`nightly`?`Nightly`:`Stable`,R;t[30]===ie?R=t[31]:(R=(0,Z.jsx)(se,{children:ie}),t[30]=ie,t[31]=R);let z;t[32]!==L||t[33]!==R?(z=(0,Z.jsx)(oe,{className:`w-full sm:w-40`,"aria-label":`Update track`,disabled:L,children:R}),t[32]=L,t[33]=R,t[34]=z):z=t[34];let le;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsxs)(ae,{align:`end`,alignItemWithTrigger:!1,children:[(0,Z.jsx)(B,{hideIndicator:!0,value:`latest`,children:`Stable`}),(0,Z.jsx)(B,{hideIndicator:!0,value:`nightly`,children:`Nightly`})]}),t[35]=le):le=t[35];let V;t[36]!==s||t[37]!==I||t[38]!==z?(V=(0,Z.jsxs)(ce,{value:s,onValueChange:I,children:[z,le]}),t[36]=s,t[37]=I,t[38]=z,t[39]=V):V=t[39];let H;t[40]!==n||t[41]!==V?(H=(0,Z.jsx)(J,{title:`Update track`,description:`Stable follows full releases. Nightly follows the nightly desktop channel and can switch back to stable immediately.`,scope:n,control:V}),t[40]=n,t[41]=V,t[42]=H):H=t[42];let U;return t[43]!==F||t[44]!==H?(U=(0,Z.jsxs)(Z.Fragment,{children:[F,H]}),t[43]=F,t[44]=H,t[45]=U):U=t[45],U}function ze(e){M.add(L({type:`error`,title:`Could not check for updates`,description:e instanceof Error?e.message:`Update check failed.`}))}function Be(e){A(e.state),e.checked||M.add(L({type:`error`,title:`Could not check for updates`,description:e.state.message??`Automatic updates are not available in this build.`}))}function Ve(e){M.add(L({type:`error`,title:`Could not install update`,description:e instanceof Error?e.message:`Install failed.`}))}function He(e){A(e.state)}function Ue(e){M.add(L({type:`error`,title:`Could not download update`,description:e instanceof Error?e.message:`Download failed.`}))}function We(e){A(e.state)}function Ge(e){M.add(L({type:`error`,title:`Could not change update track`,description:e instanceof Error?e.message:`Update track change failed.`}))}function Ke(e){A(e)}function qe(e){let t=(0,X.c)(56),{theme:n,setTheme:r}=W(),i=v(),{updateSettings:o}=l(),c;t[0]===i.textGenerationModelSelection?c=t[1]:(c=s(i.textGenerationModelSelection??null,a.textGenerationModelSelection??null),t[0]=i.textGenerationModelSelection,t[1]=c);let d=!c,f;t[2]===n?f=t[3]:(f=n===`system`?[]:[`Theme`],t[2]=n,t[3]=f);let p;t[4]===i.timestampFormat?p=t[5]:(p=i.timestampFormat===a.timestampFormat?[]:[`Time format`],t[4]=i.timestampFormat,t[5]=p);let h;t[6]===i.diffWordWrap?h=t[7]:(h=i.diffWordWrap===a.diffWordWrap?[]:[`Diff line wrapping`],t[6]=i.diffWordWrap,t[7]=h);let g;t[8]===i.diffIgnoreWhitespace?g=t[9]:(g=i.diffIgnoreWhitespace===a.diffIgnoreWhitespace?[]:[`Diff whitespace changes`],t[8]=i.diffIgnoreWhitespace,t[9]=g);let _;t[10]===i.gitStatusPollIntervalMs?_=t[11]:(_=i.gitStatusPollIntervalMs===a.gitStatusPollIntervalMs?[]:[`Remote Git status`],t[10]=i.gitStatusPollIntervalMs,t[11]=_);let y;t[12]===i.sourceControlRefreshMode?y=t[13]:(y=i.sourceControlRefreshMode===a.sourceControlRefreshMode?[]:[`PR & workflow updates`],t[12]=i.sourceControlRefreshMode,t[13]=y);let b;t[14]===i.autoOpenPlanSidebar?b=t[15]:(b=i.autoOpenPlanSidebar===a.autoOpenPlanSidebar?[]:[`Auto-open overview`],t[14]=i.autoOpenPlanSidebar,t[15]=b);let x;t[16]===i.enableLegacyTokenStreaming?x=t[17]:(x=i.enableLegacyTokenStreaming===a.enableLegacyTokenStreaming?[]:[`Stream token by token`],t[16]=i.enableLegacyTokenStreaming,t[17]=x);let S;t[18]===i.enableProviderUpdateChecks?S=t[19]:(S=i.enableProviderUpdateChecks===a.enableProviderUpdateChecks?[]:[`Provider update checks`],t[18]=i.enableProviderUpdateChecks,t[19]=S);let C;t[20]===i.defaultThreadEnvMode?C=t[21]:(C=i.defaultThreadEnvMode===a.defaultThreadEnvMode?[]:[`New thread mode`],t[20]=i.defaultThreadEnvMode,t[21]=C);let w;t[22]===i.addProjectBaseDirectory?w=t[23]:(w=i.addProjectBaseDirectory===a.addProjectBaseDirectory?[]:[`Add project base directory`],t[22]=i.addProjectBaseDirectory,t[23]=w);let T;t[24]===i.confirmThreadArchive?T=t[25]:(T=i.confirmThreadArchive===a.confirmThreadArchive?[]:[`Archive confirmation`],t[24]=i.confirmThreadArchive,t[25]=T);let E;t[26]===i.confirmThreadDelete?E=t[27]:(E=i.confirmThreadDelete===a.confirmThreadDelete?[]:[`Delete confirmation`],t[26]=i.confirmThreadDelete,t[27]=E);let D;t[28]===i.confirmThreadUnpin?D=t[29]:(D=i.confirmThreadUnpin===a.confirmThreadUnpin?[]:[`Unpin confirmation`],t[28]=i.confirmThreadUnpin,t[29]=D);let O;t[30]===d?O=t[31]:(O=d?[`Git writing model`]:[],t[30]=d,t[31]=O);let k;t[32]!==f||t[33]!==C||t[34]!==w||t[35]!==T||t[36]!==E||t[37]!==D||t[38]!==O||t[39]!==p||t[40]!==h||t[41]!==g||t[42]!==_||t[43]!==y||t[44]!==b||t[45]!==x||t[46]!==S?(k=[...f,...p,...h,...g,..._,...y,...b,...x,...S,...C,...w,...T,...E,...D,...O],t[32]=f,t[33]=C,t[34]=w,t[35]=T,t[36]=E,t[37]=D,t[38]=O,t[39]=p,t[40]=h,t[41]=g,t[42]=_,t[43]=y,t[44]=b,t[45]=x,t[46]=S,t[47]=k):k=t[47];let A=k,j;t[48]!==A||t[49]!==e||t[50]!==r||t[51]!==o?(j=async()=>{A.length!==0&&await(u()??m()).dialogs.confirm([`Restore default settings?`,`This will reset: ${A.join(`, `)}.`].join(`
2
- `))&&(r(`system`),o({timestampFormat:a.timestampFormat,diffWordWrap:a.diffWordWrap,diffIgnoreWhitespace:a.diffIgnoreWhitespace,gitStatusPollIntervalMs:a.gitStatusPollIntervalMs,sourceControlRefreshMode:a.sourceControlRefreshMode,autoOpenPlanSidebar:a.autoOpenPlanSidebar,enableLegacyTokenStreaming:a.enableLegacyTokenStreaming,enableProviderUpdateChecks:a.enableProviderUpdateChecks,defaultThreadEnvMode:a.defaultThreadEnvMode,addProjectBaseDirectory:a.addProjectBaseDirectory,confirmThreadArchive:a.confirmThreadArchive,confirmThreadDelete:a.confirmThreadDelete,confirmThreadUnpin:a.confirmThreadUnpin,textGenerationModelSelection:a.textGenerationModelSelection}),e?.())},t[48]=A,t[49]=e,t[50]=r,t[51]=o,t[52]=j):j=t[52];let M=j,N;return t[53]!==A||t[54]!==M?(N={changedSettingLabels:A,restoreDefaults:M},t[53]=A,t[54]=M,t[55]=N):N=t[55],N}function Je(e){let t=(0,X.c)(19),{searchTargetId:n,nodeScopeLabel:r}=e,i=v(),{updateSettings:o}=l(),s=n===`legacy-token-streaming`,[c,d]=(0,Te.useState)(s),f=(0,Te.useRef)(null),p,h;t[0]===s?(p=t[1],h=t[2]):(p=()=>{if(!s)return;d(!0);let e=requestAnimationFrame(()=>{f.current?.scrollIntoView({block:`center`}),f.current?.querySelector(`[role=switch]`)?.focus()});return()=>cancelAnimationFrame(e)},h=[s],t[0]=s,t[1]=p,t[2]=h),(0,Te.useEffect)(p,h);let g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsxs)(ve,{className:`group flex w-full items-center justify-between rounded-lg px-1 py-1 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`inline-block h-px w-3 bg-border`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-[0.08em] text-foreground/50 transition-colors group-hover:text-foreground/70`,children:`Legacy features`}),(0,Z.jsx)(`span`,{className:`hidden text-[11px] text-muted-foreground/55 sm:inline`,children:`Compatibility controls`})]}),(0,Z.jsx)(j,{"aria-hidden":!0,className:`size-3.5 text-muted-foreground/60 transition-transform duration-200 group-data-panel-open:rotate-90`})]}),t[3]=g):g=t[3];let _;t[4]!==i.enableLegacyTokenStreaming||t[5]!==o?(_=i.enableLegacyTokenStreaming===a.enableLegacyTokenStreaming?null:(0,Z.jsx)(Y,{label:`legacy token streaming`,onClick:()=>o({enableLegacyTokenStreaming:a.enableLegacyTokenStreaming})}),t[4]=i.enableLegacyTokenStreaming,t[5]=o,t[6]=_):_=t[6];let y;t[7]===o?y=t[8]:(y=e=>{if(!e){o({enableLegacyTokenStreaming:!1});return}(async()=>{await(u()??m()).dialogs.confirm([`Turn on token-by-token output?`,`It is significantly slower than buffered output and makes long responses harder to follow. This switch exists only for backwards compatibility.`].join(`
3
- `))&&o({enableLegacyTokenStreaming:!0})})()},t[7]=o,t[8]=y);let b;t[9]!==i.enableLegacyTokenStreaming||t[10]!==y?(b=(0,Z.jsx)(F,{checked:i.enableLegacyTokenStreaming,onCheckedChange:y,"aria-label":`Stream token by token (legacy)`}),t[9]=i.enableLegacyTokenStreaming,t[10]=y,t[11]=b):b=t[11];let x;t[12]!==r||t[13]!==_||t[14]!==b?(x=(0,Z.jsx)(_e,{children:(0,Z.jsx)(`div`,{className:`pt-2`,children:(0,Z.jsx)(`div`,{className:`relative overflow-hidden rounded-2xl border border-border/80 bg-card text-card-foreground shadow-sm/4 dark:shadow-none`,children:(0,Z.jsx)(`div`,{ref:f,id:`legacy-token-streaming`,children:(0,Z.jsx)(J,{title:`Stream token by token (legacy)`,description:`Paint assistant output token by token instead of in complete chunks. This legacy mode is significantly slower and makes long responses harder to follow.`,scope:r,resetAction:_,control:b})})})})}),t[12]=r,t[13]=_,t[14]=b,t[15]=x):x=t[15];let S;return t[16]!==c||t[17]!==x?(S=(0,Z.jsx)(`section`,{className:`space-y-2.5`,children:(0,Z.jsxs)(ye,{open:c,onOpenChange:d,children:[g,x]})}),t[16]=c,t[17]=x,t[18]=S):S=t[18],S}function Ye(e){let t=(0,X.c)(254),{searchTargetId:n}=e,r=n===void 0?null:n,o=v(),{updateSettings:s}=l(),u=z()===`phone`,d=_(),p=d?.nodeLabel??null,g,y,b;if(t[0]!==p){let e={nativeClient:i,nodeLabel:p};y=me(`browser`,e),g=me(`device`,e),b=me(`node`,e),t[0]=p,t[1]=g,t[2]=y,t[3]=b}else g=t[1],y=t[2],b=t[3];let x=b,S;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(S={logsDirectory:!1},t[4]=S):S=t[4];let[C,w]=(0,Te.useState)(S),T;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(T={},t[5]=T):T=t[5];let[E,D]=(0,Te.useState)(T),O=h(),k=f(),A=k?.logsDirectoryPath??null,j=!d||d.primary,M;t[6]===k?M=t[7]:(M=[],k?.otlpTracesEnabled&&k.otlpTracesUrl&&M.push(`traces to ${k.otlpTracesUrl}`),k?.otlpMetricsEnabled&&k.otlpMetricsUrl&&M.push(`metrics to ${k.otlpMetricsUrl}`),t[6]=k,t[7]=M);let N=k?.localTracingEnabled?`Local trace file`:`Terminal logs only`,P=M.length>0?`${N}. OTLP exporting ${M.join(` and `)}.`:`${N}.`,ee;t[8]===O?ee=t[9]:(ee=(e,t,n)=>{if(!t)return;D(t=>({...t,[e]:null})),w(t=>({...t,[e]:!0}));let r=le(O??[]);if(!r){D(t=>({...t,[e]:`No available editors found.`})),w(t=>({...t,[e]:!1}));return}m().shell.openInEditor(t,r).catch(t=>{D(r=>({...r,[e]:t instanceof Error?t.message:n}))}).finally(()=>{w(t=>({...t,[e]:!1}))})},t[8]=O,t[9]=ee);let te=ee,ne;t[10]!==A||t[11]!==te?(ne=()=>{te(`logsDirectory`,A,`Unable to open logs folder.`)},t[10]=A,t[11]=te,t[12]=ne):ne=t[12];let I=ne,L=E.logsDirectory??null,ie=C.logsDirectory,R;t[13]!==o.timestampFormat||t[14]!==s?(R=o.timestampFormat===a.timestampFormat?null:(0,Z.jsx)(Y,{label:`time format`,onClick:()=>s({timestampFormat:a.timestampFormat})}),t[13]=o.timestampFormat,t[14]=s,t[15]=R):R=t[15];let H;t[16]===s?H=t[17]:(H=e=>{(e===`locale`||e===`12-hour`||e===`24-hour`)&&s({timestampFormat:e})},t[16]=s,t[17]=H);let U=Ee[o.timestampFormat],W;t[18]===U?W=t[19]:(W=(0,Z.jsx)(oe,{className:`w-full sm:w-40`,"aria-label":`Timestamp format`,children:(0,Z.jsx)(se,{children:U})}),t[18]=U,t[19]=W);let ue;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,Z.jsxs)(ae,{align:`end`,alignItemWithTrigger:!1,children:[(0,Z.jsx)(B,{hideIndicator:!0,value:`locale`,children:Ee.locale}),(0,Z.jsx)(B,{hideIndicator:!0,value:`12-hour`,children:Ee[`12-hour`]}),(0,Z.jsx)(B,{hideIndicator:!0,value:`24-hour`,children:Ee[`24-hour`]})]}),t[20]=ue):ue=t[20];let G;t[21]!==o.timestampFormat||t[22]!==W||t[23]!==H?(G=(0,Z.jsxs)(ce,{value:o.timestampFormat,onValueChange:H,children:[W,ue]}),t[21]=o.timestampFormat,t[22]=W,t[23]=H,t[24]=G):G=t[24];let K;t[25]!==y||t[26]!==G||t[27]!==R?(K=(0,Z.jsx)(J,{title:`Time format`,description:`System default follows your browser or OS clock preference.`,scope:y,resetAction:R,control:G}),t[25]=y,t[26]=G,t[27]=R,t[28]=K):K=t[28];let de=(O??[]).length>0?`Pin which editor opens directories and files. Auto uses your last selection from the Open menu.`:`No installed editors detected. Install a supported IDE to pick a default.`,q;t[29]!==o.preferredEditor||t[30]!==s?(q=o.preferredEditor===a.preferredEditor?null:(0,Z.jsx)(Y,{label:`default editor`,onClick:()=>s({preferredEditor:a.preferredEditor})}),t[29]=o.preferredEditor,t[30]=s,t[31]=q):q=t[31];let ge=o.preferredEditor??`__auto__`,_e;t[32]===s?_e=t[33]:(_e=e=>{if(e===`__auto__`){s({preferredEditor:null});return}let t=c.find(t=>t.id===e);t&&s({preferredEditor:t.id})},t[32]=s,t[33]=_e);let ve;t[34]===o.preferredEditor?ve=t[35]:(ve=o.preferredEditor?(0,Z.jsx)(Ne,{editor:o.preferredEditor}):null,t[34]=o.preferredEditor,t[35]=ve);let ye;t[36]===o.preferredEditor?ye=t[37]:(ye=o.preferredEditor?he(o.preferredEditor,navigator.platform):`Auto (last used)`,t[36]=o.preferredEditor,t[37]=ye);let xe;t[38]===ye?xe=t[39]:(xe=(0,Z.jsx)(se,{children:ye}),t[38]=ye,t[39]=xe);let Se;t[40]!==ve||t[41]!==xe?(Se=(0,Z.jsxs)(oe,{className:`w-full sm:w-56`,"aria-label":`Default editor`,children:[ve,xe]}),t[40]=ve,t[41]=xe,t[42]=Se):Se=t[42];let Ce;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(B,{hideIndicator:!0,value:`__auto__`,children:(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`size-4`}),`Auto (last used)`]})}),t[43]=Ce):Ce=t[43];let we;t[44]===O?we=t[45]:(we=c.filter(e=>(O??[]).includes(e.id)&&V(e.id)).map(Qe),t[44]=O,t[45]=we);let Fe;t[46]===we?Fe=t[47]:(Fe=(0,Z.jsxs)(ae,{align:`end`,alignItemWithTrigger:!1,children:[Ce,we]}),t[46]=we,t[47]=Fe);let Q;t[48]!==ge||t[49]!==_e||t[50]!==Se||t[51]!==Fe?(Q=(0,Z.jsxs)(ce,{value:ge,onValueChange:_e,children:[Se,Fe]}),t[48]=ge,t[49]=_e,t[50]=Se,t[51]=Fe,t[52]=Q):Q=t[52];let Le;t[53]!==y||t[54]!==de||t[55]!==q||t[56]!==Q?(Le=(0,Z.jsx)(J,{title:`Default editor`,description:de,scope:y,resetAction:q,control:Q}),t[53]=y,t[54]=de,t[55]=q,t[56]=Q,t[57]=Le):Le=t[57];let ze;t[58]!==o.diffWordWrap||t[59]!==s?(ze=o.diffWordWrap===a.diffWordWrap?null:(0,Z.jsx)(Y,{label:`diff line wrapping`,onClick:()=>s({diffWordWrap:a.diffWordWrap})}),t[58]=o.diffWordWrap,t[59]=s,t[60]=ze):ze=t[60];let Be;t[61]===s?Be=t[62]:(Be=e=>s({diffWordWrap:!!e}),t[61]=s,t[62]=Be);let Ve;t[63]!==o.diffWordWrap||t[64]!==Be?(Ve=(0,Z.jsx)(F,{checked:o.diffWordWrap,onCheckedChange:Be,"aria-label":`Wrap diff lines by default`}),t[63]=o.diffWordWrap,t[64]=Be,t[65]=Ve):Ve=t[65];let He;t[66]!==y||t[67]!==ze||t[68]!==Ve?(He=(0,Z.jsx)(J,{title:`Diff line wrapping`,description:`Set the default wrap state when the diff panel opens.`,scope:y,resetAction:ze,control:Ve}),t[66]=y,t[67]=ze,t[68]=Ve,t[69]=He):He=t[69];let Ue;t[70]!==o.diffIgnoreWhitespace||t[71]!==s?(Ue=o.diffIgnoreWhitespace===a.diffIgnoreWhitespace?null:(0,Z.jsx)(Y,{label:`diff whitespace changes`,onClick:()=>s({diffIgnoreWhitespace:a.diffIgnoreWhitespace})}),t[70]=o.diffIgnoreWhitespace,t[71]=s,t[72]=Ue):Ue=t[72];let We;t[73]===s?We=t[74]:(We=e=>s({diffIgnoreWhitespace:!!e}),t[73]=s,t[74]=We);let Ge;t[75]!==o.diffIgnoreWhitespace||t[76]!==We?(Ge=(0,Z.jsx)(F,{checked:o.diffIgnoreWhitespace,onCheckedChange:We,"aria-label":`Hide whitespace changes by default`}),t[75]=o.diffIgnoreWhitespace,t[76]=We,t[77]=Ge):Ge=t[77];let Ke;t[78]!==y||t[79]!==Ue||t[80]!==Ge?(Ke=(0,Z.jsx)(J,{title:`Hide whitespace changes`,description:`Set whether the diff panel ignores whitespace-only edits by default.`,scope:y,resetAction:Ue,control:Ge}),t[78]=y,t[79]=Ue,t[80]=Ge,t[81]=Ke):Ke=t[81];let qe;t[82]!==o.gitStatusPollIntervalMs||t[83]!==s?(qe=o.gitStatusPollIntervalMs===a.gitStatusPollIntervalMs?null:(0,Z.jsx)(Y,{label:`git status polling`,onClick:()=>s({gitStatusPollIntervalMs:a.gitStatusPollIntervalMs})}),t[82]=o.gitStatusPollIntervalMs,t[83]=s,t[84]=qe):qe=t[84];let Ye=String(o.gitStatusPollIntervalMs),$e;t[85]===s?$e=t[86]:($e=e=>{let t=je(e);t!==null&&s({gitStatusPollIntervalMs:t})},t[85]=s,t[86]=$e);let et=De[o.gitStatusPollIntervalMs],tt;t[87]===et?tt=t[88]:(tt=(0,Z.jsx)(oe,{className:`w-full sm:w-40`,"aria-label":`Git status polling interval`,children:(0,Z.jsx)(se,{children:et})}),t[87]=et,t[88]=tt);let nt;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(nt=(0,Z.jsx)(ae,{align:`end`,alignItemWithTrigger:!1,children:Oe.map(Ze)}),t[89]=nt):nt=t[89];let $;t[90]!==Ye||t[91]!==$e||t[92]!==tt?($=(0,Z.jsxs)(ce,{value:Ye,onValueChange:$e,children:[tt,nt]}),t[90]=Ye,t[91]=$e,t[92]=tt,t[93]=$):$=t[93];let rt;t[94]!==y||t[95]!==qe||t[96]!==$?(rt=(0,Z.jsx)(J,{title:`Remote Git status`,description:`Refresh remote branch and pull request metadata while a repository is open.`,scope:y,resetAction:qe,control:$}),t[94]=y,t[95]=qe,t[96]=$,t[97]=rt):rt=t[97];let it;t[98]!==o.sourceControlRefreshMode||t[99]!==s?(it=o.sourceControlRefreshMode===a.sourceControlRefreshMode?null:(0,Z.jsx)(Y,{label:`PR and workflow updates`,onClick:()=>s({sourceControlRefreshMode:a.sourceControlRefreshMode})}),t[98]=o.sourceControlRefreshMode,t[99]=s,t[100]=it):it=t[100];let at;t[101]===s?at=t[102]:(at=e=>{let t=Me(e);t!==null&&s({sourceControlRefreshMode:t})},t[101]=s,t[102]=at);let ot=ke[o.sourceControlRefreshMode],st;t[103]===ot?st=t[104]:(st=(0,Z.jsx)(oe,{className:`w-full sm:w-40`,"aria-label":`PR and workflow update mode`,children:(0,Z.jsx)(se,{children:ot})}),t[103]=ot,t[104]=st);let ct;t[105]===Symbol.for(`react.memo_cache_sentinel`)?(ct=(0,Z.jsx)(ae,{align:`end`,alignItemWithTrigger:!1,children:Ae.map(Xe)}),t[105]=ct):ct=t[105];let lt;t[106]!==o.sourceControlRefreshMode||t[107]!==at||t[108]!==st?(lt=(0,Z.jsxs)(ce,{value:o.sourceControlRefreshMode,onValueChange:at,children:[st,ct]}),t[106]=o.sourceControlRefreshMode,t[107]=at,t[108]=st,t[109]=lt):lt=t[109];let ut;t[110]!==y||t[111]!==it||t[112]!==lt?(ut=(0,Z.jsx)(J,{title:`PR & workflow updates`,description:`Control automatic pull request and workflow refreshes. Automatic is fast after pushes and stops when checks settle.`,scope:y,resetAction:it,control:lt}),t[110]=y,t[111]=it,t[112]=lt,t[113]=ut):ut=t[113];let dt;t[114]!==o.enableProviderUpdateChecks||t[115]!==s?(dt=o.enableProviderUpdateChecks===a.enableProviderUpdateChecks?null:(0,Z.jsx)(Y,{label:`provider update checks`,onClick:()=>s({enableProviderUpdateChecks:a.enableProviderUpdateChecks})}),t[114]=o.enableProviderUpdateChecks,t[115]=s,t[116]=dt):dt=t[116];let ft;t[117]===s?ft=t[118]:(ft=e=>s({enableProviderUpdateChecks:!!e}),t[117]=s,t[118]=ft);let pt;t[119]!==o.enableProviderUpdateChecks||t[120]!==ft?(pt=(0,Z.jsx)(F,{checked:o.enableProviderUpdateChecks,onCheckedChange:ft,"aria-label":`Check providers for updates`}),t[119]=o.enableProviderUpdateChecks,t[120]=ft,t[121]=pt):pt=t[121];let mt;t[122]!==x||t[123]!==dt||t[124]!==pt?(mt=(0,Z.jsx)(J,{title:`Provider update checks`,description:`Check installed provider CLIs for newer versions. Disable if you install providers with Nix or another package manager.`,scope:x,resetAction:dt,control:pt}),t[122]=x,t[123]=dt,t[124]=pt,t[125]=mt):mt=t[125];let ht;t[126]!==o.autoOpenPlanSidebar||t[127]!==s?(ht=o.autoOpenPlanSidebar===a.autoOpenPlanSidebar?null:(0,Z.jsx)(Y,{label:`auto-open overview`,onClick:()=>s({autoOpenPlanSidebar:a.autoOpenPlanSidebar})}),t[126]=o.autoOpenPlanSidebar,t[127]=s,t[128]=ht):ht=t[128];let gt;t[129]===s?gt=t[130]:(gt=e=>s({autoOpenPlanSidebar:!!e}),t[129]=s,t[130]=gt);let _t;t[131]!==o.autoOpenPlanSidebar||t[132]!==gt?(_t=(0,Z.jsx)(F,{checked:o.autoOpenPlanSidebar,onCheckedChange:gt,"aria-label":`Open the overview automatically`}),t[131]=o.autoOpenPlanSidebar,t[132]=gt,t[133]=_t):_t=t[133];let vt;t[134]!==y||t[135]!==ht||t[136]!==_t?(vt=(0,Z.jsx)(J,{title:`Auto-open overview`,description:`Open the overview automatically when plans, progress, or implementation steps appear.`,scope:y,resetAction:ht,control:_t}),t[134]=y,t[135]=ht,t[136]=_t,t[137]=vt):vt=t[137];let yt;t[138]!==o.defaultThreadEnvMode||t[139]!==s?(yt=o.defaultThreadEnvMode===a.defaultThreadEnvMode?null:(0,Z.jsx)(Y,{label:`new threads`,onClick:()=>s({defaultThreadEnvMode:a.defaultThreadEnvMode})}),t[138]=o.defaultThreadEnvMode,t[139]=s,t[140]=yt):yt=t[140];let bt;t[141]===s?bt=t[142]:(bt=e=>{(e===`local`||e===`worktree`)&&s({defaultThreadEnvMode:e})},t[141]=s,t[142]=bt);let xt=o.defaultThreadEnvMode===`worktree`?`New worktree`:`Local`,St;t[143]===xt?St=t[144]:(St=(0,Z.jsx)(oe,{className:`w-full sm:w-44`,"aria-label":`Default thread mode`,children:(0,Z.jsx)(se,{children:xt})}),t[143]=xt,t[144]=St);let Ct;t[145]===Symbol.for(`react.memo_cache_sentinel`)?(Ct=(0,Z.jsxs)(ae,{align:`end`,alignItemWithTrigger:!1,children:[(0,Z.jsx)(B,{hideIndicator:!0,value:`local`,children:`Local`}),(0,Z.jsx)(B,{hideIndicator:!0,value:`worktree`,children:`New worktree`})]}),t[145]=Ct):Ct=t[145];let wt;t[146]!==o.defaultThreadEnvMode||t[147]!==bt||t[148]!==St?(wt=(0,Z.jsxs)(ce,{value:o.defaultThreadEnvMode,onValueChange:bt,children:[St,Ct]}),t[146]=o.defaultThreadEnvMode,t[147]=bt,t[148]=St,t[149]=wt):wt=t[149];let Tt;t[150]!==x||t[151]!==yt||t[152]!==wt?(Tt=(0,Z.jsx)(J,{title:`New threads`,description:`Pick the default workspace mode for newly created draft threads.`,scope:x,resetAction:yt,control:wt}),t[150]=x,t[151]=yt,t[152]=wt,t[153]=Tt):Tt=t[153];let Et;t[154]!==o.addProjectBaseDirectory||t[155]!==s?(Et=o.addProjectBaseDirectory===a.addProjectBaseDirectory?null:(0,Z.jsx)(Y,{label:`add project base directory`,onClick:()=>s({addProjectBaseDirectory:a.addProjectBaseDirectory})}),t[154]=o.addProjectBaseDirectory,t[155]=s,t[156]=Et):Et=t[156];let Dt;t[157]===s?Dt=t[158]:(Dt=e=>s({addProjectBaseDirectory:e}),t[157]=s,t[158]=Dt);let Ot;t[159]!==o.addProjectBaseDirectory||t[160]!==Dt?(Ot=(0,Z.jsx)(be,{className:`w-full sm:w-72`,value:o.addProjectBaseDirectory,onCommit:Dt,placeholder:`~/`,spellCheck:!1,"aria-label":`Add project base directory`}),t[159]=o.addProjectBaseDirectory,t[160]=Dt,t[161]=Ot):Ot=t[161];let kt;t[162]!==x||t[163]!==Et||t[164]!==Ot?(kt=(0,Z.jsx)(J,{title:`Add project starts in`,description:`Leave empty to use "~/" when the Add Project browser opens.`,scope:x,resetAction:Et,control:Ot}),t[162]=x,t[163]=Et,t[164]=Ot,t[165]=kt):kt=t[165];let At;t[166]!==o.confirmThreadArchive||t[167]!==s?(At=o.confirmThreadArchive===a.confirmThreadArchive?null:(0,Z.jsx)(Y,{label:`archive confirmation`,onClick:()=>s({confirmThreadArchive:a.confirmThreadArchive})}),t[166]=o.confirmThreadArchive,t[167]=s,t[168]=At):At=t[168];let jt;t[169]===s?jt=t[170]:(jt=e=>s({confirmThreadArchive:!!e}),t[169]=s,t[170]=jt);let Mt;t[171]!==o.confirmThreadArchive||t[172]!==jt?(Mt=(0,Z.jsx)(F,{checked:o.confirmThreadArchive,onCheckedChange:jt,"aria-label":`Confirm thread archiving`}),t[171]=o.confirmThreadArchive,t[172]=jt,t[173]=Mt):Mt=t[173];let Nt;t[174]!==y||t[175]!==At||t[176]!==Mt?(Nt=(0,Z.jsx)(J,{title:`Archive confirmation`,description:`Require a second click on the inline archive action before a thread is archived.`,scope:y,resetAction:At,control:Mt}),t[174]=y,t[175]=At,t[176]=Mt,t[177]=Nt):Nt=t[177];let Pt;t[178]!==o.confirmThreadDelete||t[179]!==s?(Pt=o.confirmThreadDelete===a.confirmThreadDelete?null:(0,Z.jsx)(Y,{label:`delete confirmation`,onClick:()=>s({confirmThreadDelete:a.confirmThreadDelete})}),t[178]=o.confirmThreadDelete,t[179]=s,t[180]=Pt):Pt=t[180];let Ft;t[181]===s?Ft=t[182]:(Ft=e=>s({confirmThreadDelete:!!e}),t[181]=s,t[182]=Ft);let It;t[183]!==o.confirmThreadDelete||t[184]!==Ft?(It=(0,Z.jsx)(F,{checked:o.confirmThreadDelete,onCheckedChange:Ft,"aria-label":`Confirm thread deletion`}),t[183]=o.confirmThreadDelete,t[184]=Ft,t[185]=It):It=t[185];let Lt;t[186]!==y||t[187]!==Pt||t[188]!==It?(Lt=(0,Z.jsx)(J,{title:`Delete confirmation`,description:`Ask before deleting a thread and its chat history.`,scope:y,resetAction:Pt,control:It}),t[186]=y,t[187]=Pt,t[188]=It,t[189]=Lt):Lt=t[189];let Rt;t[190]!==o.confirmThreadUnpin||t[191]!==s?(Rt=o.confirmThreadUnpin===a.confirmThreadUnpin?null:(0,Z.jsx)(Y,{label:`unpin confirmation`,onClick:()=>s({confirmThreadUnpin:a.confirmThreadUnpin})}),t[190]=o.confirmThreadUnpin,t[191]=s,t[192]=Rt):Rt=t[192];let zt;t[193]===s?zt=t[194]:(zt=e=>s({confirmThreadUnpin:!!e}),t[193]=s,t[194]=zt);let Bt;t[195]!==o.confirmThreadUnpin||t[196]!==zt?(Bt=(0,Z.jsx)(F,{checked:o.confirmThreadUnpin,onCheckedChange:zt,"aria-label":`Confirm thread unpinning`}),t[195]=o.confirmThreadUnpin,t[196]=zt,t[197]=Bt):Bt=t[197];let Vt;t[198]!==y||t[199]!==Rt||t[200]!==Bt?(Vt=(0,Z.jsx)(J,{title:`Unpin confirmation`,description:`Ask before removing a thread from the pinned section.`,scope:y,resetAction:Rt,control:Bt}),t[198]=y,t[199]=Rt,t[200]=Bt,t[201]=Vt):Vt=t[201];let Ht;t[202]!==g||t[203]!==o.notifyOnTurnCompleteWhenUnfocused||t[204]!==s?(Ht=i?(0,Z.jsx)(J,{title:`Turn-complete notifications`,description:`Show a desktop notification when an agent finishes a turn while the Ryco window is unfocused.`,scope:g,resetAction:o.notifyOnTurnCompleteWhenUnfocused===a.notifyOnTurnCompleteWhenUnfocused?null:(0,Z.jsx)(Y,{label:`turn-complete notifications`,onClick:()=>s({notifyOnTurnCompleteWhenUnfocused:a.notifyOnTurnCompleteWhenUnfocused})}),control:(0,Z.jsx)(F,{checked:o.notifyOnTurnCompleteWhenUnfocused,onCheckedChange:e=>s({notifyOnTurnCompleteWhenUnfocused:!!e}),"aria-label":`Notify when a turn completes while unfocused`})}):null,t[202]=g,t[203]=o.notifyOnTurnCompleteWhenUnfocused,t[204]=s,t[205]=Ht):Ht=t[205];let Ut;t[206]!==K||t[207]!==Le||t[208]!==He||t[209]!==Ke||t[210]!==rt||t[211]!==ut||t[212]!==mt||t[213]!==vt||t[214]!==Tt||t[215]!==kt||t[216]!==Nt||t[217]!==Lt||t[218]!==Vt||t[219]!==Ht?(Ut=(0,Z.jsxs)(fe,{title:`General`,children:[K,Le,He,Ke,rt,ut,mt,vt,Tt,kt,Nt,Lt,Vt,Ht]}),t[206]=K,t[207]=Le,t[208]=He,t[209]=Ke,t[210]=rt,t[211]=ut,t[212]=mt,t[213]=vt,t[214]=Tt,t[215]=kt,t[216]=Nt,t[217]=Lt,t[218]=Vt,t[219]=Ht,t[220]=Ut):Ut=t[220];let Wt;t[221]!==u||t[222]!==x||t[223]!==r?(Wt=u?null:(0,Z.jsx)(Je,{searchTargetId:r,nodeScopeLabel:x}),t[221]=u,t[222]=x,t[223]=r,t[224]=Wt):Wt=t[224];let Gt;t[225]===Symbol.for(`react.memo_cache_sentinel`)?(Gt=(0,Z.jsx)(Ie,{}),t[225]=Gt):Gt=t[225];let Kt;t[226]!==g||t[227]!==y?(Kt=i?(0,Z.jsx)(Re,{scopeLabel:g}):(0,Z.jsx)(J,{title:(0,Z.jsx)(Pe,{}),description:`Current version of the application.`,scope:y}),t[226]=g,t[227]=y,t[228]=Kt):Kt=t[228];let qt=A??`Resolving logs directory...`,Jt;t[229]===qt?Jt=t[230]:(Jt=(0,Z.jsx)(`span`,{className:`block break-all font-mono text-[11px] text-foreground`,children:qt}),t[229]=qt,t[230]=Jt);let Yt;t[231]!==j||t[232]!==L||t[233]!==d?.nodeLabel?(Yt=L?(0,Z.jsx)(`span`,{className:`mt-1 block text-destructive`,children:L}):j?null:(0,Z.jsxs)(`span`,{className:`mt-1 block`,children:[`This path is on `,d?.nodeLabel,`; open it from that machine.`]}),t[231]=j,t[232]=L,t[233]=d?.nodeLabel,t[234]=Yt):Yt=t[234];let Xt;t[235]!==Jt||t[236]!==Yt?(Xt=(0,Z.jsxs)(Z.Fragment,{children:[Jt,Yt]}),t[235]=Jt,t[236]=Yt,t[237]=Xt):Xt=t[237];let Zt=!j||!A||ie,Qt=ie?`Opening...`:`Open logs folder`,$t;t[238]!==I||t[239]!==Zt||t[240]!==Qt?($t=(0,Z.jsx)(re,{size:`xs`,variant:`outline`,disabled:Zt,onClick:I,children:Qt}),t[238]=I,t[239]=Zt,t[240]=Qt,t[241]=$t):$t=t[241];let en;t[242]!==P||t[243]!==x||t[244]!==Xt||t[245]!==$t?(en=(0,Z.jsx)(J,{title:`Diagnostics`,description:P,scope:x,status:Xt,control:$t}),t[242]=P,t[243]=x,t[244]=Xt,t[245]=$t,t[246]=en):en=t[246];let tn;t[247]!==Kt||t[248]!==en?(tn=(0,Z.jsxs)(fe,{title:`About`,children:[Gt,Kt,en]}),t[247]=Kt,t[248]=en,t[249]=tn):tn=t[249];let nn;return t[250]!==Ut||t[251]!==Wt||t[252]!==tn?(nn=(0,Z.jsxs)(pe,{children:[Ut,Wt,tn]}),t[250]=Ut,t[251]=Wt,t[252]=tn,t[253]=nn):nn=t[253],nn}function Xe(e){return(0,Z.jsx)(B,{hideIndicator:!0,value:e,children:ke[e]},e)}function Ze(e){return(0,Z.jsx)(B,{hideIndicator:!0,value:String(e),children:De[e]},e)}function Qe(e){return(0,Z.jsx)(B,{hideIndicator:!0,value:e.id,children:(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Z.jsx)(Ne,{editor:e.id}),he(e.id,navigator.platform)]})},e.id)}function $e(){let e=(0,X.c)(18),t=ie(o.dispatchCommand),n=g(N(d)),r=g(N(p)),{unarchiveThread:i,confirmAndDeleteThread:a}=R(),s;if(e[0]!==n||e[1]!==r){let t;e[3]===r?t=e[4]:(t=e=>({project:e,threads:r.filter(t=>t.projectId===e.id&&t.archivedAt!==null).toSorted(tt)}),e[3]=r,e[4]=t),s=n.map(t).filter(et),e[0]=n,e[1]=r,e[2]=s}else s=e[2];let c=s,l;e[5]!==a||e[6]!==t.allowed||e[7]!==t.reason||e[8]!==i?(l=async(e,n)=>{if(!t.allowed){M.add(L({type:`warning`,title:`Archived thread is read-only`,description:t.reason??`This action is unavailable.`}));return}let r=u();if(!r)return;let o=await r.contextMenu.show([{id:`unarchive`,label:`Unarchive`},{id:`delete`,label:`Delete`,destructive:!0}],n);if(o===`unarchive`){try{await i(e)}catch(e){let t=e;M.add(L({type:`error`,title:`Failed to unarchive thread`,description:t instanceof Error?t.message:`An error occurred.`}))}return}o===`delete`&&await a(e)},e[5]=a,e[6]=t.allowed,e[7]=t.reason,e[8]=i,e[9]=l):l=e[9];let f=l,m;e[10]!==c||e[11]!==f||e[12]!==t.allowed||e[13]!==t.reason||e[14]!==i?(m=c.length===0?(0,Z.jsx)(fe,{title:`Archived threads`,children:(0,Z.jsxs)(q,{className:`min-h-88`,children:[(0,Z.jsx)(ue,{variant:`icon`,children:(0,Z.jsx)(T,{})}),(0,Z.jsxs)(G,{children:[(0,Z.jsx)(K,{children:`No archived threads`}),(0,Z.jsx)(de,{children:`Archived threads will appear here.`})]})]})}):c.map(e=>{let{project:n,threads:r}=e;return(0,Z.jsx)(fe,{title:n.name,icon:(0,Z.jsx)(I,{environmentId:n.environmentId,cwd:n.cwd,projectId:n.id,customAvatarContentHash:n.customAvatarContentHash??null}),children:r.map(e=>(0,Z.jsx)(nt,{thread:e,mutationAllowed:t.allowed,mutationReason:t.reason??null,onOpenMenu:f,onUnarchive:i},e.id))},n.id)}),e[10]=c,e[11]=f,e[12]=t.allowed,e[13]=t.reason,e[14]=i,e[15]=m):m=e[15];let h;return e[16]===m?h=e[17]:(h=(0,Z.jsx)(pe,{children:m}),e[16]=m,e[17]=h),h}function et(e){return e.threads.length>0}function tt(e,t){let n=e.archivedAt??e.createdAt;return(t.archivedAt??t.createdAt).localeCompare(n)||t.id.localeCompare(e.id)}function nt(e){let t=(0,X.c)(38),{thread:n,mutationAllowed:i,mutationReason:a,onOpenMenu:o,onUnarchive:s}=e,c=z()===`phone`,l;t[0]!==o||t[1]!==n.environmentId||t[2]!==n.id?(l=e=>{o(r(n.environmentId,n.id),e)},t[0]=o,t[1]=n.environmentId,t[2]=n.id,t[3]=l):l=t[3];let u=!c,d;t[4]===u?d=t[5]:(d={disabled:u},t[4]=u,t[5]=d);let f=U(l,d),p;t[6]!==f||t[7]!==o||t[8]!==n.environmentId||t[9]!==n.id?(p=e=>{f.onContextMenu(e),!e.defaultPrevented&&(e.preventDefault(),o(r(n.environmentId,n.id),{x:e.clientX,y:e.clientY}))},t[6]=f,t[7]=o,t[8]=n.environmentId,t[9]=n.id,t[10]=p):p=t[10];let m;t[11]===n.title?m=t[12]:(m=(0,Z.jsx)(`h3`,{className:`truncate text-sm font-medium text-foreground`,children:n.title}),t[11]=n.title,t[12]=m);let h=n.archivedAt??n.createdAt,g;t[13]===h?g=t[14]:(g=P(h),t[13]=h,t[14]=g);let _;t[15]===n.createdAt?_=t[16]:(_=P(n.createdAt),t[15]=n.createdAt,t[16]=_);let v;t[17]!==g||t[18]!==_?(v=(0,Z.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Archived `,g,` · Created `,_]}),t[17]=g,t[18]=_,t[19]=v):v=t[19];let y;t[20]!==m||t[21]!==v?(y=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[m,v]}),t[20]=m,t[21]=v,t[22]=y):y=t[22];let b=!i,x=a??void 0,S;t[23]!==s||t[24]!==n.environmentId||t[25]!==n.id?(S=()=>void s(r(n.environmentId,n.id)).catch($),t[23]=s,t[24]=n.environmentId,t[25]=n.id,t[26]=S):S=t[26];let C,w;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(xe,{className:`size-3.5`}),w=(0,Z.jsx)(`span`,{children:`Unarchive`}),t[27]=C,t[28]=w):(C=t[27],w=t[28]);let T;t[29]!==b||t[30]!==x||t[31]!==S?(T=(0,Z.jsxs)(re,{type:`button`,variant:`outline`,size:`sm`,className:`h-7 shrink-0 cursor-pointer gap-1.5 px-2.5`,disabled:b,title:x,onClick:S,children:[C,w]}),t[29]=b,t[30]=x,t[31]=S,t[32]=T):T=t[32];let E;return t[33]!==f||t[34]!==T||t[35]!==p||t[36]!==y?(E=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-t border-border px-4 py-3 first:border-t-0 sm:px-5`,...f,onContextMenu:p,children:[y,T]}),t[33]=f,t[34]=T,t[35]=p,t[36]=y,t[37]=E):E=t[37],E}function $(e){M.add(L({type:`error`,title:`Failed to unarchive thread`,description:e instanceof Error?e.message:`An error occurred.`}))}export{Ce as a,we as i,Ye as n,Se as o,qe as r,$e as t};
@@ -1 +0,0 @@
1
- import{$n as e,$t as t,An as n,At as r,Bn as i,Bt as a,Cn as o,Ct as s,Dn as c,Dr as l,Dt as u,Ei as d,En as f,Et as p,Fn as m,Fr as h,Ft as g,Gn as _,Gt as v,Hn as y,Ht as b,I as x,In as S,It as C,Jn as w,Jt as T,Kn as E,Kt as ee,Ln as D,Lt as te,Mn as ne,Mt as re,Nn as ie,Nt as ae,Oi as oe,On as se,Or as ce,Ot as le,Pn as ue,Pt as de,Qn as fe,Qt as pe,Rn as me,Rt as he,Sn as ge,St as _e,Tn as ve,Tr as ye,Tt as be,Un as xe,Ut as Se,V as O,Vn as Ce,Vt as we,Wn as Te,Ws as Ee,Wt as De,Xn as Oe,Xt as ke,Yn as Ae,Yt as je,Zn as Me,Zt as Ne,_n as Pe,_r as Fe,_t as Ie,an as Le,ar as Re,bn as ze,bt as Be,cn as Ve,cr as He,dn as Ue,dr as We,en as Ge,er as Ke,fn as qe,fr as Je,ft as Ye,gn as Xe,gr as Ze,gt as Qe,h as $e,hn as et,hr as tt,ht as nt,in as rt,ir as it,jn as at,jr as ot,jt as st,kn as ct,kr as lt,kt as ut,ln as dt,lr as ft,mn as pt,mr as mt,mt as ht,nn as gt,nr as _t,on as vt,or as yt,p as k,pn as bt,pr as xt,pt as St,qn as Ct,qt as wt,rn as Tt,rr as Et,sn as Dt,sr as Ot,t as A,tn as kt,tr as At,un as jt,ur as Mt,vn as Nt,wn as Pt,wt as Ft,xn as It,xt as Lt,yn as Rt,yt as zt,zn as Bt,zt as Vt}from"./src-DmPIm3ie.js";function Ht(e){if(!/^[A-Za-z0-9_-]+$/u.test(e))throw Error(`Invalid encoded material.`);let t=e.replace(/-/gu,`+`).replace(/_/gu,`/`).padEnd(Math.ceil(e.length/4)*4,`=`),n;try{n=atob(t)}catch{throw Error(`Invalid encoded material.`)}let r=new Uint8Array(n.length);for(let e=0;e<n.length;e+=1)r[e]=n.charCodeAt(e);return r}function Ut(e){let t=e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength),n=``;for(let e of t)n+=String.fromCharCode(e);return btoa(n).replace(/\+/gu,`-`).replace(/\//gu,`_`).replace(/=+$/gu,``)}var Wt=Uint8Array.from([32,9,13,10,32,9,13,10]);function Gt(e){return e.byteLength>=8&&e[0]===0}function Kt(e){if(e.byteLength<Wt.byteLength)return!1;for(let t=0;t<Wt.byteLength;t+=1)if(e[t]!==Wt[t])return!1;return!0}function qt(e){return Kt(e)?{advertised:!0,message:e.subarray(Wt.byteLength)}:{advertised:!1,message:e}}function Jt(e,t,n){e[0]=0,e[1]=1,e[2]=+!!n,e[3]=0,e[4]=t>>>24&255,e[5]=t>>>16&255,e[6]=t>>>8&255,e[7]=t&255}function Yt(e){return(e[4]<<24>>>0)+(e[5]<<16>>>0)+(e[6]<<8>>>0)+e[7]}function Xt(e,t){if(e.byteLength<=t)return[e];let n=t-8;if(n<=0)throw Error(`Relay chunk limit is too small to carry a chunk header.`);let r=[];for(let t=0;t<e.byteLength;t+=n){let i=e.subarray(t,Math.min(t+n,e.byteLength)),a=new Uint8Array(8+i.byteLength);Jt(a,e.byteLength,t+i.byteLength>=e.byteLength),a.set(i,8),r.push(a)}return r}function Zt(e,t){if(!Number.isSafeInteger(t.maxChunkBytes)||t.maxChunkBytes<=0||!Number.isSafeInteger(t.maxMessageBytes)||t.maxMessageBytes<0||!Number.isSafeInteger(e)||e<0)throw TypeError(`Relay chunk limits must be positive and message limits non-negative safe integers.`);if(e>t.maxMessageBytes)return{kind:`error`,reason:`message_too_large`};if(e<=t.maxChunkBytes){let n=e+Wt.byteLength<=t.maxChunkBytes;return{kind:`ready`,advertised:n,chunked:!1,payloadBytes:[n?Wt.byteLength+e:e]}}if(!t.peerSupportsChunking)return{kind:`error`,reason:`peer_unsupported`};let n=t.maxChunkBytes-8;if(n<=0)throw Error(`Relay chunk limit is too small to carry a chunk header.`);let r=[];for(let t=0;t<e;t+=n)r.push(8+Math.min(n,e-t));return{kind:`ready`,advertised:!1,chunked:!0,payloadBytes:r}}function Qt(e,t){let n=Zt(e.byteLength,t);if(n.kind===`error`)return n;if(n.chunked)return{kind:`ready`,payloads:Xt(e,t.maxChunkBytes)};if(!n.advertised)return{kind:`ready`,payloads:[e]};let r=new Uint8Array(Wt.byteLength+e.byteLength);return r.set(Wt),r.set(e,Wt.byteLength),{kind:`ready`,payloads:[r]}}var $t=class{#e=[];#t=0;#n=0;#r=!1;get heldBytes(){return this.#t}get incompleteMessage(){return this.#n!==0}get peerSupportsChunking(){return this.#r}push(e){if(!Gt(e)){if(this.#n!==0)return this.reset(),{kind:`error`,reason:`interleaved_legacy`};let t=qt(e);return t.advertised&&(this.#r=!0),{kind:`done`,message:t.message}}if(e[1]!==1||e[2]&-2||e[3]!==0)return this.reset(),{kind:`error`,reason:`bad_header`};let t=Yt(e),n=e.subarray(8),r=!!(e[2]&1);if(n.byteLength===0)return this.reset(),{kind:`error`,reason:`bad_header`};if(this.#n===0){if(t>4194304||t===0)return{kind:`error`,reason:`message_too_large`};this.#n=t,this.#t=0}else if(t!==this.#n)return this.reset(),{kind:`error`,reason:`total_mismatch`};if(this.#t+n.byteLength>this.#n)return this.reset(),{kind:`error`,reason:`overflow`};this.#r=!0;let i=Uint8Array.from(n);if(n.fill(0),this.#e.push(i),this.#t+=n.byteLength,!r)return{kind:`pending`};if(this.#t!==this.#n)return this.reset(),{kind:`error`,reason:`truncated`};let a=new Uint8Array(this.#n),o=0;for(let e of this.#e)a.set(e,o),o+=e.byteLength,e.fill(0);return this.#e=[],this.#t=0,this.#n=0,{kind:`done`,message:a}}reset(){for(let e of this.#e)e.fill(0);this.#e=[],this.#t=0,this.#n=0,this.#r=!1}},en=4096,tn=8192;function nn(e){return e.maxQueuedBytes-e.maxControlFrameBytes}function rn(e){let t=Math.min(ye,e.maxQueuedBytes-e.maxControlFrameBytes),n=t-32;return{effectiveMessageCeiling:t,plaintextCeiling:n,establishable:n>0}}var an=1500,on=3e3,sn=3e3,cn=1500,ln=1e3,un=6e5,dn=3e5,fn=2592e6,pn=65536,mn=268435456,hn=4294967295n,gn=18446744073709551615n,_n={digits:60,groups:12,digitsPerGroup:5,separator:` `},vn={chars:8,groups:2,charsPerGroup:4,separator:`-`},yn=`0123456789ABCDEFGHJKMNPQRSTVWXYZ`;Wt.byteLength;var bn=8e3,xn=BigInt(2**32-1),Sn=BigInt(32);function Cn(e,t=!1){return t?{h:Number(e&xn),l:Number(e>>Sn&xn)}:{h:Number(e>>Sn&xn)|0,l:Number(e&xn)|0}}function wn(e,t=!1){let n=e.length,r=new Uint32Array(n),i=new Uint32Array(n);for(let a=0;a<n;a++){let{h:n,l:o}=Cn(e[a],t);[r[a],i[a]]=[n,o]}return[r,i]}var Tn=e=>e/2**32|0,En=e=>e>>>0;function Dn(e,t,n,r){let i=Tn(n),a=En(n);e.setUint32(t,r?a:i,r),e.setUint32(t+4,r?i:a,r)}var On=(e,t,n)=>e>>>n,kn=(e,t,n)=>e<<32-n|t>>>n,An=(e,t,n)=>e>>>n|t<<32-n,jn=(e,t,n)=>e<<32-n|t>>>n,Mn=(e,t,n)=>e<<64-n|t>>>n-32,Nn=(e,t,n)=>e>>>n-32|t<<64-n;function Pn(e,t,n,r){let i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:i|0}}var Fn=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),In=(e,t,n,r)=>t+n+r+(e/2**32|0)|0,Ln=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),Rn=(e,t,n,r,i)=>t+n+r+i+(e/2**32|0)|0,zn=(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0),Bn=(e,t,n,r,i,a)=>t+n+r+i+a+(e/2**32|0)|0;function Vn(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`&&`BYTES_PER_ELEMENT`in e&&e.BYTES_PER_ELEMENT===1}var Hn=e=>e?`"${e}" `:``;function Un(e,t=``){if(typeof e!=`number`)throw TypeError(Hn(t)+`expected number, got `+typeof e);if(!Number.isSafeInteger(e)||e<0)throw RangeError(Hn(t)+`expected integer >= 0, got `+e);return e}function Wn(e,t,n=``){if(Vn(e)&&(t===void 0||e.length===t))return e;t!==void 0&&Un(t,`length`);let r=Vn(e),i=t===void 0?``:` of length ${t}`,a=r?`length=${e.length}`:`type=${typeof e}`,o=Hn(n)+`expected Uint8Array`+i+`, got `+a;throw r?RangeError(o):TypeError(o)}function Gn(e){if(typeof e!=`function`||typeof e.create!=`function`)throw TypeError(`expected hash wrapped by utils.createHasher`);if(Un(e.outputLen),Un(e.blockLen),e.outputLen<1||e.blockLen<1)throw Error(`hash blockLen / outputLen must be >= 1`)}var Kn=(e,t)=>{if(typeof e!=`object`||!e||Array.isArray(e))throw TypeError((t===`object`?``:`"${t}" `)+`expected object, got type=`+typeof e)};function qn(e,t=!0){if(e.destroyed)throw Error(`hash was destroyed`);if(t&&e.finished)throw Error(`digest() was already called`)}function Jn(e,t){Wn(e,void 0,`output`);let n=t.outputLen;if(!(e.length>=n))throw RangeError(`"output" expected length >= `+n)}function Yn(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Xn(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Zn(e,t){return e<<32-t|e>>>t}var Qn=typeof Uint8Array.from([]).toHex==`function`&&typeof Uint8Array.fromHex==`function`,$n=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function er(e){if(Wn(e),Qn)return e.toHex();let t=``;for(let n=0;n<e.length;n++)t+=$n[e[n]];return t}function tr(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:void 0}function nr(e){if(typeof e!=`string`)throw TypeError(`hex string expected, got `+typeof e);if(Qn)try{return Uint8Array.fromHex(e)}catch(e){throw e instanceof SyntaxError?RangeError(e.message):e}let t=e.length,n=t/2;if(t%2)throw RangeError(`hex string expected, got unpadded hex of length `+t);let r=new Uint8Array(n);for(let t=0,i=0;t<n;t++,i+=2){let n=tr(e.charCodeAt(i)),a=tr(e.charCodeAt(i+1));if(n===void 0||a===void 0){let t=e[i]+e[i+1];throw RangeError(`hex string expected, got non-hex character "`+t+`" at index `+i)}r[t]=n*16+a}return r}function rr(e){if(typeof e!=`string`)throw TypeError(`string expected`);return new Uint8Array(new TextEncoder().encode(e))}function ir(...e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];Wn(r),t+=r.length}let n=new Uint8Array(t);for(let t=0,r=0;t<e.length;t++){let i=e[t];n.set(i,r),r+=i.length}return n}function ar(e,t,n=`opts`){return Kn(e,`defaults`),t!==void 0&&Kn(t,n),Object.assign(e,t)}function or(e,t={}){if(typeof e!=`function`)throw TypeError(`"hashCons" expected function, got type=`+typeof e);t=ar({},t,`info`);let n=(t,n)=>e(n).update(t).digest(),r=e(void 0);return n.outputLen=r.outputLen,n.blockLen=r.blockLen,n.canXOF=r.canXOF,n.create=t=>e(t),Object.assign(n,t),Object.freeze(n)}function sr(e=32){Un(e,`bytesLength`);let t=typeof globalThis==`object`?globalThis.crypto:null;if(typeof t?.getRandomValues!=`function`)throw Error(`crypto.getRandomValues must be defined`);if(e>65536)throw RangeError(`"bytesLength" expected <= 65536, got ${e}`);return t.getRandomValues(new Uint8Array(e))}var cr=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function lr(e,t,n){return e&t^~e&n}function ur(e,t,n){return e&t^e&n^t&n}var dr=class{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,n,r){this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(e),this.view=Xn(this.buffer)}update(e){qn(this),Wn(e);let{view:t,buffer:n,blockLen:r}=this,i=e.length,a=!1;for(let o=0;o<i;){let s=Math.min(r-this.pos,i-o);if(s===r){let t=Xn(e);for(;r<=i-o;o+=r)this.process(t,o);a=!0;continue}n.set(o===0&&s===i?e:e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===r&&(this.process(t,0),this.pos=0,a=!0)}return this.length+=e.length,a&&this.roundClean(),this}digestInto(e){qn(this),Jn(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:r,isLE:i}=this,{pos:a}=this;t[a++]=128,t.fill(0,a),this.padOffset>r-a&&(this.process(n,0),t.fill(0)),Dn(n,r-8,this.length*8,i),this.process(n,0),this.roundClean();let o=e===t?n:Xn(e),s=this.outputLen,c=s/4,l=this.get();if(s%4||c>l.length)throw Error(`invalid outputLen`);for(let e=0;e<c;e++)o.setUint32(4*e,l[e],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneIntoMeta(e){let{buffer:t,length:n,finished:r,destroyed:i,pos:a}=this;return e.destroyed=i,e.finished=r,e.length=n,e.pos=a,a&&e.buffer.set(t),e}clone(){return this._cloneInto()}},fr=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),pr=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),mr=Uint32Array.from([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]),hr=new Uint32Array(64),gr=class extends dr{A=0;B=0;C=0;D=0;E=0;F=0;G=0;H=0;constructor(e,t){super(64,e,8,!1),this.A=t[0]|0,this.B=t[1]|0,this.C=t[2]|0,this.D=t[3]|0,this.E=t[4]|0,this.F=t[5]|0,this.G=t[6]|0,this.H=t[7]|0}get(){let{A:e,B:t,C:n,D:r,E:i,F:a,G:o,H:s}=this;return[e,t,n,r,i,a,o,s]}set(e,t,n,r,i,a,o,s){this.A=e|0,this.B=t|0,this.C=n|0,this.D=r|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=s|0}_cloneInto(e){return(e||=new this.constructor).set(...this.get()),this._cloneIntoMeta(e)}process(e,t){for(let n=0;n<16;n++,t+=4)hr[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=hr[e-15],n=hr[e-2],r=Zn(t,7)^Zn(t,18)^t>>>3,i=Zn(n,17)^Zn(n,19)^n>>>10;hr[e]=i+hr[e-7]+r+hr[e-16]|0}let{A:n,B:r,C:i,D:a,E:o,F:s,G:c,H:l}=this;for(let e=0;e<64;e++){let t=Zn(o,6)^Zn(o,11)^Zn(o,25),u=l+t+lr(o,s,c)+mr[e]+hr[e]|0,d=(Zn(n,2)^Zn(n,13)^Zn(n,22))+ur(n,r,i)|0;l=c,c=s,s=o,o=a+u|0,a=i,i=r,r=n,n=u+d|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,s=s+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(n,r,i,a,o,s,c,l)}roundClean(){Yn(hr)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),Yn(this.buffer)}},_r=class extends gr{constructor(){super(32,fr)}},vr=wn(`0x428a2f98d728ae22.0x7137449123ef65cd.0xb5c0fbcfec4d3b2f.0xe9b5dba58189dbbc.0x3956c25bf348b538.0x59f111f1b605d019.0x923f82a4af194f9b.0xab1c5ed5da6d8118.0xd807aa98a3030242.0x12835b0145706fbe.0x243185be4ee4b28c.0x550c7dc3d5ffb4e2.0x72be5d74f27b896f.0x80deb1fe3b1696b1.0x9bdc06a725c71235.0xc19bf174cf692694.0xe49b69c19ef14ad2.0xefbe4786384f25e3.0x0fc19dc68b8cd5b5.0x240ca1cc77ac9c65.0x2de92c6f592b0275.0x4a7484aa6ea6e483.0x5cb0a9dcbd41fbd4.0x76f988da831153b5.0x983e5152ee66dfab.0xa831c66d2db43210.0xb00327c898fb213f.0xbf597fc7beef0ee4.0xc6e00bf33da88fc2.0xd5a79147930aa725.0x06ca6351e003826f.0x142929670a0e6e70.0x27b70a8546d22ffc.0x2e1b21385c26c926.0x4d2c6dfc5ac42aed.0x53380d139d95b3df.0x650a73548baf63de.0x766a0abb3c77b2a8.0x81c2c92e47edaee6.0x92722c851482353b.0xa2bfe8a14cf10364.0xa81a664bbc423001.0xc24b8b70d0f89791.0xc76c51a30654be30.0xd192e819d6ef5218.0xd69906245565a910.0xf40e35855771202a.0x106aa07032bbd1b8.0x19a4c116b8d2d0c8.0x1e376c085141ab53.0x2748774cdf8eeb99.0x34b0bcb5e19b48a8.0x391c0cb3c5c95a63.0x4ed8aa4ae3418acb.0x5b9cca4f7763e373.0x682e6ff3d6b2b8a3.0x748f82ee5defb2fc.0x78a5636f43172f60.0x84c87814a1f0ab72.0x8cc702081a6439ec.0x90befffa23631e28.0xa4506cebde82bde9.0xbef9a3f7b2c67915.0xc67178f2e372532b.0xca273eceea26619c.0xd186b8c721c0c207.0xeada7dd6cde0eb1e.0xf57d4f7fee6ed178.0x06f067aa72176fba.0x0a637dc5a2c898a6.0x113f9804bef90dae.0x1b710b35131c471b.0x28db77f523047d84.0x32caab7b40c72493.0x3c9ebe0a15c9bebc.0x431d67c49c100d4c.0x4cc5d4becb3e42b6.0x597f299cfc657e2a.0x5fcb6fab3ad6faec.0x6c44198c4a475817`.split(`.`).map(e=>BigInt(e))),yr=vr[0],br=vr[1],xr=new Uint32Array(80),Sr=new Uint32Array(80),Cr=class extends dr{Ah=0;Al=0;Bh=0;Bl=0;Ch=0;Cl=0;Dh=0;Dl=0;Eh=0;El=0;Fh=0;Fl=0;Gh=0;Gl=0;Hh=0;Hl=0;constructor(e,t){super(128,e,16,!1),this.Ah=t[0]|0,this.Al=t[1]|0,this.Bh=t[2]|0,this.Bl=t[3]|0,this.Ch=t[4]|0,this.Cl=t[5]|0,this.Dh=t[6]|0,this.Dl=t[7]|0,this.Eh=t[8]|0,this.El=t[9]|0,this.Fh=t[10]|0,this.Fl=t[11]|0,this.Gh=t[12]|0,this.Gl=t[13]|0,this.Hh=t[14]|0,this.Hl=t[15]|0}get(){let{Ah:e,Al:t,Bh:n,Bl:r,Ch:i,Cl:a,Dh:o,Dl:s,Eh:c,El:l,Fh:u,Fl:d,Gh:f,Gl:p,Hh:m,Hl:h}=this;return[e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h]}set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){this.Ah=e|0,this.Al=t|0,this.Bh=n|0,this.Bl=r|0,this.Ch=i|0,this.Cl=a|0,this.Dh=o|0,this.Dl=s|0,this.Eh=c|0,this.El=l|0,this.Fh=u|0,this.Fl=d|0,this.Gh=f|0,this.Gl=p|0,this.Hh=m|0,this.Hl=h|0}_cloneInto(e){return(e||=new this.constructor).set(...this.get()),this._cloneIntoMeta(e)}process(e,t){for(let n=0;n<16;n++,t+=4)xr[n]=e.getUint32(t),Sr[n]=e.getUint32(t+=4);for(let e=16;e<80;e++){let t=xr[e-15]|0,n=Sr[e-15]|0,r=An(t,n,1)^An(t,n,8)^On(t,n,7),i=jn(t,n,1)^jn(t,n,8)^kn(t,n,7),a=xr[e-2]|0,o=Sr[e-2]|0,s=An(a,o,19)^Mn(a,o,61)^On(a,o,6),c=Ln(i,jn(a,o,19)^Nn(a,o,61)^kn(a,o,6),Sr[e-7],Sr[e-16]),l=Rn(c,r,s,xr[e-7],xr[e-16]);xr[e]=l|0,Sr[e]=c|0}let{Ah:n,Al:r,Bh:i,Bl:a,Ch:o,Cl:s,Dh:c,Dl:l,Eh:u,El:d,Fh:f,Fl:p,Gh:m,Gl:h,Hh:g,Hl:_}=this;for(let e=0;e<80;e++){let t=An(u,d,14)^An(u,d,18)^Mn(u,d,41),v=jn(u,d,14)^jn(u,d,18)^Nn(u,d,41),y=u&f^~u&m,b=d&p^~d&h,x=zn(_,v,b,br[e],Sr[e]),S=Bn(x,g,t,y,yr[e],xr[e]),C=x|0,w=An(n,r,28)^Mn(n,r,34)^Mn(n,r,39),T=jn(n,r,28)^Nn(n,r,34)^Nn(n,r,39),E=n&i^n&o^i&o,ee=r&a^r&s^a&s;g=m|0,_=h|0,m=f|0,h=p|0,f=u|0,p=d|0,{h:u,l:d}=Pn(c|0,l|0,S|0,C|0),c=o|0,l=s|0,o=i|0,s=a|0,i=n|0,a=r|0;let D=Fn(C,T,ee);n=In(D,S,w,E),r=D|0}({h:n,l:r}=Pn(this.Ah|0,this.Al|0,n|0,r|0)),{h:i,l:a}=Pn(this.Bh|0,this.Bl|0,i|0,a|0),{h:o,l:s}=Pn(this.Ch|0,this.Cl|0,o|0,s|0),{h:c,l}=Pn(this.Dh|0,this.Dl|0,c|0,l|0),{h:u,l:d}=Pn(this.Eh|0,this.El|0,u|0,d|0),{h:f,l:p}=Pn(this.Fh|0,this.Fl|0,f|0,p|0),{h:m,l:h}=Pn(this.Gh|0,this.Gl|0,m|0,h|0),{h:g,l:_}=Pn(this.Hh|0,this.Hl|0,g|0,_|0),this.set(n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_)}roundClean(){Yn(xr,Sr)}destroy(){this.destroyed=!0,Yn(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},wr=class extends Cr{constructor(){super(64,pr)}},Tr=or(()=>new _r,cr(1)),Er=or(()=>new wr,cr(3)),Dr=[`Object`,`RegExp`,`Date`,`Error`,`Map`,`Set`,`WeakMap`,`WeakSet`,`ArrayBuffer`,`SharedArrayBuffer`,`DataView`,`Promise`,`URL`,`HTMLElement`,`Int8Array`,`Uint8ClampedArray`,`Int16Array`,`Uint16Array`,`Int32Array`,`Uint32Array`,`Float32Array`,`Float64Array`,`BigInt64Array`,`BigUint64Array`,`Tagged`];function Or(e){if(e===null)return`null`;if(e===void 0)return`undefined`;if(e===!0||e===!1)return`boolean`;let t=typeof e;return t===`string`||t===`number`||t===`bigint`||t===`symbol`?t:t===`function`?`Function`:Array.isArray(e)?`Array`:e instanceof Uint8Array?`Uint8Array`:e.constructor===Object?`Object`:kr(e)||`Object`}function kr(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(Dr.includes(t))return t}var j=class{constructor(e,t,n){this.major=e,this.majorEncoded=e<<5,this.name=t,this.terminal=n}toString(){return`Type[${this.major}].${this.name}`}compare(e){return this.major<e.major?-1:+(this.major>e.major)}static equals(e,t){return e===t||e.major===t.major&&e.name===t.name}};j.uint=new j(0,`uint`,!0),j.negint=new j(1,`negint`,!0),j.bytes=new j(2,`bytes`,!0),j.string=new j(3,`string`,!0),j.array=new j(4,`array`,!1),j.map=new j(5,`map`,!1),j.tag=new j(6,`tag`,!1),j.float=new j(7,`float`,!0),j.false=new j(7,`false`,!0),j.true=new j(7,`true`,!0),j.null=new j(7,`null`,!0),j.undefined=new j(7,`undefined`,!0),j.break=new j(7,`break`,!0);var M=class{constructor(e,t,n){this.type=e,this.value=t,this.encodedLength=n,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}},Ar=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer==`function`,jr=new TextEncoder;function Mr(e){return Ar&&globalThis.Buffer.isBuffer(e)}function Nr(e){return e instanceof Uint8Array?Mr(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var Pr=24,Fr=200,Ir=Ar?e=>e.length>=Pr?globalThis.Buffer.from(e):Hr(e):e=>e.length>=Fr?jr.encode(e):Hr(e),Lr=e=>Uint8Array.from(e),Rr=Ar?(e,t,n)=>Mr(e)?new Uint8Array(e.subarray(t,n)):e.slice(t,n):(e,t,n)=>e.slice(t,n),zr=Ar?(e,t)=>(e=e.map(e=>e instanceof Uint8Array?e:globalThis.Buffer.from(e)),Nr(globalThis.Buffer.concat(e,t))):(e,t)=>{let n=new Uint8Array(t),r=0;for(let t of e)r+t.length>n.length&&(t=t.subarray(0,n.length-r)),n.set(t,r),r+=t.length;return n},Br=Ar?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function Vr(e,t){if(Mr(e)&&Mr(t))return e.compare(t);for(let n=0;n<e.length;n++)if(e[n]!==t[n])return e[n]<t[n]?-1:1;return 0}function Hr(e){let t=[],n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);i<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=i&63|128):(i&64512)==55296&&r+1<e.length&&(e.charCodeAt(r+1)&64512)==56320?(i=65536+((i&1023)<<10)+(e.charCodeAt(++r)&1023),t[n++]=i>>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=i&63|128):(i>=55296&&i<=57343&&(i=65533),t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=i&63|128)}return t}var Ur=256,Wr=class{constructor(e=Ur){this.chunkSize=e,this.cursor=0,this.maxCursor=-1,this.chunks=[],this._initReuseChunk=null}reset(){this.cursor=0,this.maxCursor=-1,this.chunks.length&&(this.chunks=[]),this._initReuseChunk!==null&&(this.chunks.push(this._initReuseChunk),this.maxCursor=this._initReuseChunk.length-1)}pushByte(e){let t=this.chunks[this.chunks.length-1];this.cursor>this.maxCursor&&(t=Br(this.chunkSize),this.chunks.push(t),this.maxCursor+=t.length,this._initReuseChunk===null&&(this._initReuseChunk=t));let n=t.length-(this.maxCursor-this.cursor)-1;t[n]=e,this.cursor++}push(e){let t=this.chunks[this.chunks.length-1];if(this.cursor+e.length<=this.maxCursor+1){let n=t.length-(this.maxCursor-this.cursor)-1;t.set(e,n)}else{if(t){let e=t.length-(this.maxCursor-this.cursor)-1;e<t.length&&(this.chunks[this.chunks.length-1]=t.subarray(0,e),this.maxCursor=this.cursor-1)}e.length<64&&e.length<this.chunkSize?(t=Br(this.chunkSize),this.chunks.push(t),this.maxCursor+=t.length,this._initReuseChunk===null&&(this._initReuseChunk=t),t.set(e,0)):(this.chunks.push(e),this.maxCursor+=e.length)}this.cursor+=e.length}toBytes(e=!1){let t;if(this.chunks.length===1){let n=this.chunks[0];e&&this.cursor>n.length/2?(t=this.cursor===n.length?n:n.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):t=Rr(n,0,this.cursor)}else t=zr(this.chunks,this.cursor);return e&&this.reset(),t}},Gr=class{constructor(e){this.dest=e,this.cursor=0,this.chunks=[e]}reset(){this.cursor=0}pushByte(e){if(this.cursor>=this.dest.length)throw Error(`write out of bounds, destination buffer is too small`);this.dest[this.cursor++]=e}push(e){if(this.cursor+e.length>this.dest.length)throw Error(`write out of bounds, destination buffer is too small`);this.dest.set(e,this.cursor),this.cursor+=e.length}toBytes(e=!1){let t=this.dest.subarray(0,this.cursor);return e&&this.reset(),t}},N=`CBOR decode error:`,Kr=`CBOR encode error:`;function qr(e,t,n){if(e.length-t<n)throw Error(`${N} not enough data for type`)}var P=[24,256,65536,4294967296,BigInt(`18446744073709551616`)];function Jr(e,t,n){qr(e,t,1);let r=e[t];if(n.strict===!0&&r<P[0])throw Error(`${N} integer encoded in more bytes than necessary (strict decode)`);return r}function Yr(e,t,n){qr(e,t,2);let r=e[t]<<8|e[t+1];if(n.strict===!0&&r<P[1])throw Error(`${N} integer encoded in more bytes than necessary (strict decode)`);return r}function Xr(e,t,n){qr(e,t,4);let r=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(n.strict===!0&&r<P[2])throw Error(`${N} integer encoded in more bytes than necessary (strict decode)`);return r}function Zr(e,t,n){qr(e,t,8);let r=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],i=e[t+4]*16777216+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],a=(BigInt(r)<<BigInt(32))+BigInt(i);if(n.strict===!0&&a<P[3])throw Error(`${N} integer encoded in more bytes than necessary (strict decode)`);if(a<=2**53-1)return Number(a);if(n.allowBigInt===!0)return a;throw Error(`${N} integers outside of the safe integer range are not supported`)}function Qr(e,t,n,r){return new M(j.uint,Jr(e,t+1,r),2)}function $r(e,t,n,r){return new M(j.uint,Yr(e,t+1,r),3)}function ei(e,t,n,r){return new M(j.uint,Xr(e,t+1,r),5)}function ti(e,t,n,r){return new M(j.uint,Zr(e,t+1,r),9)}function ni(e,t){return F(e,0,t.value)}function F(e,t,n){if(n<P[0]){let r=Number(n);e.pushByte(t|r)}else if(n<P[1]){let r=Number(n);e.push([t|24,r])}else if(n<P[2]){let r=Number(n);e.push([t|25,r>>>8,r&255])}else if(n<P[3]){let r=Number(n);e.push([t|26,r>>>24&255,r>>>16&255,r>>>8&255,r&255])}else{let r=BigInt(n);if(r<P[4]){let n=[t|27,0,0,0,0,0,0,0],i=Number(r&BigInt(4294967295)),a=Number(r>>BigInt(32)&BigInt(4294967295));n[8]=i&255,i>>=8,n[7]=i&255,i>>=8,n[6]=i&255,i>>=8,n[5]=i&255,n[4]=a&255,a>>=8,n[3]=a&255,a>>=8,n[2]=a&255,a>>=8,n[1]=a&255,e.push(n)}else throw Error(`${N} encountered BigInt larger than allowable range`)}}ni.encodedSize=function(e){return F.encodedSize(e.value)},F.encodedSize=function(e){return e<P[0]?1:e<P[1]?2:e<P[2]?3:e<P[3]?5:9},ni.compareTokens=function(e,t){return e.value<t.value?-1:+(e.value>t.value)};function ri(e,t,n,r){return new M(j.negint,-1-Jr(e,t+1,r),2)}function ii(e,t,n,r){return new M(j.negint,-1-Yr(e,t+1,r),3)}function ai(e,t,n,r){return new M(j.negint,-1-Xr(e,t+1,r),5)}var oi=BigInt(-1),si=BigInt(1);function ci(e,t,n,r){let i=Zr(e,t+1,r);if(typeof i!=`bigint`){let e=-1-i;if(e>=-(2**53-1))return new M(j.negint,e,9)}if(r.allowBigInt!==!0)throw Error(`${N} integers outside of the safe integer range are not supported`);return new M(j.negint,oi-BigInt(i),9)}function li(e,t){let n=t.value,r=typeof n==`bigint`?n*oi-si:n*-1-1;F(e,t.type.majorEncoded,r)}li.encodedSize=function(e){let t=e.value,n=typeof t==`bigint`?t*oi-si:t*-1-1;return n<P[0]?1:n<P[1]?2:n<P[2]?3:n<P[3]?5:9},li.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function ui(e,t,n,r){qr(e,t,n+r);let i=e.slice(t+n,t+n+r);return new M(j.bytes,i,n+r)}function di(e,t,n,r){return ui(e,t,1,n)}function fi(e,t,n,r){return ui(e,t,2,Jr(e,t+1,r))}function pi(e,t,n,r){return ui(e,t,3,Yr(e,t+1,r))}function mi(e,t,n,r){return ui(e,t,5,Xr(e,t+1,r))}function hi(e,t,n,r){let i=Zr(e,t+1,r);if(typeof i==`bigint`)throw Error(`${N} 64-bit integer bytes lengths not supported`);return ui(e,t,9,i)}function gi(e){return e.encodedBytes===void 0&&(e.encodedBytes=j.equals(e.type,j.string)?Ir(e.value):e.value),e.encodedBytes}function _i(e,t){let n=gi(t);F(e,t.type.majorEncoded,n.length),e.push(n)}_i.encodedSize=function(e){let t=gi(e);return F.encodedSize(t.length)+t.length},_i.compareTokens=function(e,t){return vi(gi(e),gi(t))};function vi(e,t){return e.length<t.length?-1:e.length>t.length?1:Vr(e,t)}var yi=new TextDecoder,bi=32;function xi(e,t,n){if(n-t<bi){let r=``;for(let i=t;i<n;i++){let a=e[i];if(a&128)return yi.decode(e.subarray(t,n));r+=String.fromCharCode(a)}return r}return yi.decode(e.subarray(t,n))}function Si(e,t,n,r,i){let a=n+r;qr(e,t,a);let o=new M(j.string,xi(e,t+n,t+a),a);return i.retainStringBytes===!0&&(o.byteValue=e.slice(t+n,t+a)),o}function Ci(e,t,n,r){return Si(e,t,1,n,r)}function wi(e,t,n,r){return Si(e,t,2,Jr(e,t+1,r),r)}function Ti(e,t,n,r){return Si(e,t,3,Yr(e,t+1,r),r)}function Ei(e,t,n,r){return Si(e,t,5,Xr(e,t+1,r),r)}function Di(e,t,n,r){let i=Zr(e,t+1,r);if(typeof i==`bigint`)throw Error(`${N} 64-bit integer string lengths not supported`);return Si(e,t,9,i,r)}var Oi=_i;function ki(e,t,n,r){return new M(j.array,r,n)}function Ai(e,t,n,r){return ki(e,t,1,n)}function ji(e,t,n,r){return ki(e,t,2,Jr(e,t+1,r))}function Mi(e,t,n,r){return ki(e,t,3,Yr(e,t+1,r))}function Ni(e,t,n,r){return ki(e,t,5,Xr(e,t+1,r))}function Pi(e,t,n,r){let i=Zr(e,t+1,r);if(typeof i==`bigint`)throw Error(`${N} 64-bit integer array lengths not supported`);return ki(e,t,9,i)}function Fi(e,t,n,r){if(r.allowIndefinite===!1)throw Error(`${N} indefinite length items not allowed`);return ki(e,t,1,1/0)}function Ii(e,t){F(e,j.array.majorEncoded,t.value)}Ii.compareTokens=ni.compareTokens,Ii.encodedSize=function(e){return F.encodedSize(e.value)};function Li(e,t,n,r){return new M(j.map,r,n)}function Ri(e,t,n,r){return Li(e,t,1,n)}function zi(e,t,n,r){return Li(e,t,2,Jr(e,t+1,r))}function Bi(e,t,n,r){return Li(e,t,3,Yr(e,t+1,r))}function Vi(e,t,n,r){return Li(e,t,5,Xr(e,t+1,r))}function Hi(e,t,n,r){let i=Zr(e,t+1,r);if(typeof i==`bigint`)throw Error(`${N} 64-bit integer map lengths not supported`);return Li(e,t,9,i)}function Ui(e,t,n,r){if(r.allowIndefinite===!1)throw Error(`${N} indefinite length items not allowed`);return Li(e,t,1,1/0)}function Wi(e,t){F(e,j.map.majorEncoded,t.value)}Wi.compareTokens=ni.compareTokens,Wi.encodedSize=function(e){return F.encodedSize(e.value)};function Gi(e,t,n,r){return new M(j.tag,n,1)}function Ki(e,t,n,r){return new M(j.tag,Jr(e,t+1,r),2)}function qi(e,t,n,r){return new M(j.tag,Yr(e,t+1,r),3)}function Ji(e,t,n,r){return new M(j.tag,Xr(e,t+1,r),5)}function Yi(e,t,n,r){return new M(j.tag,Zr(e,t+1,r),9)}function Xi(e,t){F(e,j.tag.majorEncoded,t.value)}Xi.compareTokens=ni.compareTokens,Xi.encodedSize=function(e){return F.encodedSize(e.value)};function Zi(e,t,n,r){if(r.allowUndefined===!1)throw Error(`${N} undefined values are not supported`);return r.coerceUndefinedToNull===!0?new M(j.null,null,1):new M(j.undefined,void 0,1)}function Qi(e,t,n,r){if(r.allowIndefinite===!1)throw Error(`${N} indefinite length items not allowed`);return new M(j.break,void 0,1)}function $i(e,t,n){if(n){if(n.allowNaN===!1&&Number.isNaN(e))throw Error(`${N} NaN values are not supported`);if(n.allowInfinity===!1&&(e===1/0||e===-1/0))throw Error(`${N} Infinity values are not supported`)}return new M(j.float,e,t)}function ea(e,t,n,r){return $i(sa(e,t+1),3,r)}function ta(e,t,n,r){return $i(la(e,t+1),5,r)}function na(e,t,n,r){return $i(da(e,t+1),9,r)}function ra(e,t,n){let r=t.value;if(r===!1)e.pushByte(j.float.majorEncoded|20);else if(r===!0)e.pushByte(j.float.majorEncoded|21);else if(r===null)e.pushByte(j.float.majorEncoded|22);else if(r===void 0)e.pushByte(j.float.majorEncoded|23);else{let t,i=!1;(!n||n.float64!==!0)&&(oa(r),t=sa(I,1),r===t||Number.isNaN(r)?(I[0]=249,e.push(I.slice(0,3)),i=!0):(ca(r),t=la(I,1),r===t&&(I[0]=250,e.push(I.slice(0,5)),i=!0))),i||(ua(r),t=da(I,1),I[0]=251,e.push(I.slice(0,9)))}}ra.encodedSize=function(e,t){let n=e.value;if(n===!1||n===!0||n==null)return 1;if(!t||t.float64!==!0){oa(n);let e=sa(I,1);if(n===e||Number.isNaN(n))return 3;if(ca(n),e=la(I,1),n===e)return 5}return 9};var ia=new ArrayBuffer(9),aa=new DataView(ia,1),I=new Uint8Array(ia,0);function oa(e){if(e===1/0)aa.setUint16(0,31744,!1);else if(e===-1/0)aa.setUint16(0,64512,!1);else if(Number.isNaN(e))aa.setUint16(0,32256,!1);else{aa.setFloat32(0,e);let t=aa.getUint32(0),n=(t&2139095040)>>23,r=t&8388607;if(n===255)aa.setUint16(0,31744,!1);else if(n===0)aa.setUint16(0,(t&2147483648)>>16|r>>13,!1);else{let e=n-127;e<-24?aa.setUint16(0,0):e<-14?aa.setUint16(0,(t&2147483648)>>16|1<<24+e,!1):aa.setUint16(0,(t&2147483648)>>16|e+15<<10|r>>13,!1)}}}function sa(e,t){if(e.length-t<2)throw Error(`${N} not enough data for float16`);let n=(e[t]<<8)+e[t+1];if(n===31744)return 1/0;if(n===64512)return-1/0;if(n===32256)return NaN;let r=n>>10&31,i=n&1023,a;return a=r===0?i*2**-24:r===31?i===0?1/0:NaN:(i+1024)*2**(r-25),n&32768?-a:a}function ca(e){aa.setFloat32(0,e,!1)}function la(e,t){if(e.length-t<4)throw Error(`${N} not enough data for float32`);let n=(e.byteOffset||0)+t;return new DataView(e.buffer,n,4).getFloat32(0,!1)}function ua(e){aa.setFloat64(0,e,!1)}function da(e,t){if(e.length-t<8)throw Error(`${N} not enough data for float64`);let n=(e.byteOffset||0)+t;return new DataView(e.buffer,n,8).getFloat64(0,!1)}function fa(e,t){let n=e.value;if(n===!1)return Uint8Array.of(j.float.majorEncoded|20);if(n===!0)return Uint8Array.of(j.float.majorEncoded|21);if(n===null)return Uint8Array.of(j.float.majorEncoded|22);if(n===void 0)return Uint8Array.of(j.float.majorEncoded|23);if(!t){if(oa(n),n===sa(I,1)||Number.isNaN(n))return I[0]=249,I.slice(0,3);if(ca(n),n===la(I,1))return I[0]=250,I.slice(0,5)}return ua(n),I[0]=251,I.slice(0,9)}function pa(e,t){let n=e,r=t?.float64===!0,i=r?n._keyBytesFloat64:n._keyBytes;if(i!==void 0)return i;let a=fa(e,r);return r?n._keyBytesFloat64=a:n._keyBytes=a,a}ra.compareTokens=function(e,t,n){let r=pa(e,n),i=pa(t,n);return r.length===i.length?Vr(r,i):r.length<i.length?-1:1};function L(e,t,n){throw Error(`${N} encountered invalid minor (${n}) for major ${e[t]>>>5}`)}function ma(e){return()=>{throw Error(`${N} ${e}`)}}var R=[];for(let e=0;e<=23;e++)R[e]=L;R[24]=Qr,R[25]=$r,R[26]=ei,R[27]=ti,R[28]=L,R[29]=L,R[30]=L,R[31]=L;for(let e=32;e<=55;e++)R[e]=L;R[56]=ri,R[57]=ii,R[58]=ai,R[59]=ci,R[60]=L,R[61]=L,R[62]=L,R[63]=L;for(let e=64;e<=87;e++)R[e]=di;R[88]=fi,R[89]=pi,R[90]=mi,R[91]=hi,R[92]=L,R[93]=L,R[94]=L,R[95]=ma(`indefinite length bytes/strings are not supported`);for(let e=96;e<=119;e++)R[e]=Ci;R[120]=wi,R[121]=Ti,R[122]=Ei,R[123]=Di,R[124]=L,R[125]=L,R[126]=L,R[127]=ma(`indefinite length bytes/strings are not supported`);for(let e=128;e<=151;e++)R[e]=Ai;R[152]=ji,R[153]=Mi,R[154]=Ni,R[155]=Pi,R[156]=L,R[157]=L,R[158]=L,R[159]=Fi;for(let e=160;e<=183;e++)R[e]=Ri;R[184]=zi,R[185]=Bi,R[186]=Vi,R[187]=Hi,R[188]=L,R[189]=L,R[190]=L,R[191]=Ui;for(let e=192;e<=215;e++)R[e]=Gi;R[216]=Ki,R[217]=qi,R[218]=Ji,R[219]=Yi,R[220]=L,R[221]=L,R[222]=L,R[223]=L;for(let e=224;e<=243;e++)R[e]=ma(`simple values are not supported`);R[244]=L,R[245]=L,R[246]=L,R[247]=Zi,R[248]=ma(`simple values are not supported`),R[249]=ea,R[250]=ta,R[251]=na,R[252]=L,R[253]=L,R[254]=L,R[255]=Qi;var ha=[];for(let e=0;e<24;e++)ha[e]=new M(j.uint,e,1);for(let e=-1;e>=-24;e--)ha[31-e]=new M(j.negint,e,1);ha[64]=new M(j.bytes,new Uint8Array,1),ha[96]=new M(j.string,``,1),ha[128]=new M(j.array,0,1),ha[160]=new M(j.map,0,1),ha[244]=new M(j.false,!1,1),ha[245]=new M(j.true,!0,1),ha[246]=new M(j.null,null,1);function ga(e){switch(e.type){case j.false:return Lr([244]);case j.true:return Lr([245]);case j.null:return Lr([246]);case j.bytes:return e.value.length?void 0:Lr([64]);case j.string:return e.value===``?Lr([96]):void 0;case j.array:return e.value===0?Lr([128]):void 0;case j.map:return e.value===0?Lr([160]):void 0;case j.uint:return e.value<24?Lr([Number(e.value)]):void 0;case j.negint:if(e.value>=-24)return Lr([31-Number(e.value)])}}var _a={float64:!1,mapSorter:Da,quickEncodeToken:ga},va=Object.freeze({mapSorter:Oa,quickEncodeToken:ga});function ya(){let e=[];return e[j.uint.major]=ni,e[j.negint.major]=li,e[j.bytes.major]=_i,e[j.string.major]=Oi,e[j.array.major]=Ii,e[j.map.major]=Wi,e[j.tag.major]=Xi,e[j.float.major]=ra,e}var ba=ya(),xa=new Wr,Sa=class e{constructor(e,t){this.obj=e,this.parent=t}includes(e){let t=this;do if(t.obj===e)return!0;while(t=t.parent);return!1}static createCheck(t,n){if(t&&t.includes(n))throw Error(`${Kr} object contains circular references`);return new e(n,t)}},Ca={null:new M(j.null,null),undefined:new M(j.undefined,void 0),true:new M(j.true,!0),false:new M(j.false,!1),emptyArray:new M(j.array,0),emptyMap:new M(j.map,0)},wa={number(e,t,n,r){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new M(j.float,e):e>=0?new M(j.uint,e):new M(j.negint,e)},bigint(e,t,n,r){return e>=BigInt(0)?new M(j.uint,e):new M(j.negint,e)},Uint8Array(e,t,n,r){return new M(j.bytes,e)},string(e,t,n,r){return new M(j.string,e)},boolean(e,t,n,r){return e?Ca.true:Ca.false},null(e,t,n,r){return Ca.null},undefined(e,t,n,r){return Ca.undefined},ArrayBuffer(e,t,n,r){return new M(j.bytes,new Uint8Array(e))},DataView(e,t,n,r){return new M(j.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,n,r){if(!e.length)return n.addBreakTokens===!0?[Ca.emptyArray,new M(j.break)]:Ca.emptyArray;r=Sa.createCheck(r,e);let i=[],a=0;for(let t of e)i[a++]=Ta(t,n,r);return n.addBreakTokens?[new M(j.array,e.length),i,new M(j.break)]:[new M(j.array,e.length),i]},Object(e,t,n,r){let i=t!==`Object`,a=i?e.keys():Object.keys(e),o=i?e.size:a.length,s;if(o){s=Array(o),r=Sa.createCheck(r,e);let t=!i&&n.ignoreUndefinedProperties,c=0;for(let o of a){let a=i?e.get(o):e[o];t&&a===void 0||(s[c++]=[Ta(o,n,r),Ta(a,n,r)])}c<o&&(s.length=c)}return s?.length?(Ea(s,n),n.addBreakTokens?[new M(j.map,s.length),s,new M(j.break)]:[new M(j.map,s.length),s]):n.addBreakTokens===!0?[Ca.emptyMap,new M(j.break)]:Ca.emptyMap},Tagged(e,t,n,r){return[new M(j.tag,e.tag),Ta(e.value,n,r)]}};wa.Map=wa.Object,wa.Buffer=wa.Uint8Array;for(let e of`Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64`.split(` `))wa[`${e}Array`]=wa.DataView;function Ta(e,t={},n){let r=Or(e),i=t&&t.typeEncoders&&t.typeEncoders[r]||wa[r];if(typeof i==`function`){let a=i(e,r,t,n);if(a!=null)return a}let a=wa[r];if(!a)throw Error(`${Kr} unsupported type: ${r}`);return a(e,r,t,n)}function Ea(e,t){let n=t.mapSorter;n&&e.sort((e,r)=>n(e,r,t))}function Da(e,t,n){let r=Array.isArray(e[0])?e[0][0]:e[0],i=Array.isArray(t[0])?t[0][0]:t[0];if(r.type.major!==i.type.major)return r.type.compare(i.type);let a=ba[r.type.major].compareTokens(r,i,n);return a===0&&console.warn(`WARNING: complex key types used, CBOR key sorting guarantees are gone`),a}function Oa(e,t){if(e[0]instanceof M&&t[0]instanceof M){let n=e[0],r=t[0];return n._keyBytes||=ka(n.value),r._keyBytes||=ka(r.value),Vr(n._keyBytes,r._keyBytes)}throw Error(`rfc8949MapSorter: complex key types are not supported yet`)}function ka(e){return qa(e,ba,va)}function Aa(e,t,n,r){if(Array.isArray(t))for(let i of t)Aa(e,i,n,r);else n[t.type.major](e,t,r)}var ja=j.uint.majorEncoded,Ma=j.negint.majorEncoded,Na=j.bytes.majorEncoded,Pa=j.string.majorEncoded,Fa=j.array.majorEncoded,Ia=j.map.majorEncoded,La=j.float.majorEncoded|20,Ra=j.float.majorEncoded|21,za=j.float.majorEncoded|22,Ba=j.float.majorEncoded|23,Va=BigInt(-1),Ha=BigInt(1);function Ua(e,t,n){n<24?e.pushByte(t|Number(n)):F(e,t,n)}function Wa(e){return e.addBreakTokens!==!0}function Ga(e,t,n,r,i){let a=n===`Map`,o=a?t.keys():Object.keys(t),s=a?t.size:o.length;if(!s){e.pushByte(Ia);return}i=Sa.createCheck(i,t);let c=!a&&r.ignoreUndefinedProperties,l=Array(s),u=0;for(let e of o){let n=a?t.get(e):t[e];c&&n===void 0||(l[u++]=[Ta(e,r,i),n])}if(u===0){e.pushByte(Ia);return}u<s&&(l.length=u),l.sort((e,t)=>Da(e,t,r)),Ua(e,Ia,u);for(let[t,n]of l)Aa(e,t,ba,r),Ka(e,n,r,i)}function Ka(e,t,n,r){let i=Or(t),a=n.typeEncoders&&n.typeEncoders[i];if(a){let o=a(t,i,n,r);if(o!=null){Aa(e,o,ba,n);return}}switch(i){case`null`:e.pushByte(za);return;case`undefined`:e.pushByte(Ba);return;case`boolean`:e.pushByte(t?Ra:La);return;case`number`:!Number.isInteger(t)||!Number.isSafeInteger(t)?ra(e,new M(j.float,t),n):t>=0?Ua(e,ja,t):Ua(e,Ma,t*-1-1);return;case`bigint`:t>=BigInt(0)?Ua(e,ja,t):Ua(e,Ma,t*Va-Ha);return;case`string`:{let n=Ir(t);Ua(e,Pa,n.length),e.push(n);return}case`Uint8Array`:Ua(e,Na,t.length),e.push(t);return;case`Array`:if(!t.length){e.pushByte(Fa);return}r=Sa.createCheck(r,t),Ua(e,Fa,t.length);for(let i of t)Ka(e,i,n,r);return;case`Object`:case`Map`:n.mapSorter===Da?Ga(e,t,i,n,r):Aa(e,wa.Object(t,i,n,r),ba,n);return;default:{let a=wa[i];if(!a)throw Error(`${Kr} unsupported type: ${i}`);Aa(e,a(t,i,n,r),ba,n)}}}function qa(e,t,n,r){let i=r instanceof Uint8Array,a=i?new Gr(r):xa,o=Ta(e,n);if(!Array.isArray(o)&&n.quickEncodeToken){let e=n.quickEncodeToken(o);if(e)return i?(a.push(e),a.toBytes()):e;let r=t[o.type.major];if(r.encodedSize){let e=r.encodedSize(o,n);if(i||(a=new Wr(e)),r(a,o,n),a.chunks.length!==1)throw Error(`Unexpected error: pre-calculated length for ${o} was wrong`);return i?a.toBytes():Nr(a.chunks[0])}}return a.reset(),Aa(a,o,t,n),a.toBytes(!0)}function Ja(e,t){return t=Object.assign({},_a,t),Wa(t)?(xa.reset(),Ka(xa,e,t,void 0),xa.toBytes(!0)):qa(e,ba,t)}var Ya={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},Xa=class{constructor(e,t={}){this._pos=0,this.data=e,this.options=t}pos(){return this._pos}done(){return this._pos>=this.data.length}next(){let e=this.data[this._pos],t=ha[e];if(t===void 0){let n=R[e];if(!n)throw Error(`${N} no decoder for major type ${e>>>5} (byte 0x${e.toString(16).padStart(2,`0`)})`);let r=e&31;t=n(this.data,this._pos,r,this.options)}return this._pos+=t.encodedLength,t}},Za=Symbol.for(`DONE`),Qa=Symbol.for(`BREAK`);function $a(e,t,n){let r=[];for(let i=0;i<e.value;i++){let a=ro(t,n);if(a===Qa){if(e.value===1/0)break;throw Error(`${N} got unexpected break to lengthed array`)}if(a===Za)throw Error(`${N} found array but not enough entries (got ${i}, expected ${e.value})`);r[i]=a}return r}function eo(e,t,n){let r=n.useMaps===!0,i=n.rejectDuplicateMapKeys===!0,a=r?void 0:{},o=r?new Map:void 0;for(let s=0;s<e.value;s++){let c=ro(t,n);if(c===Qa){if(e.value===1/0)break;throw Error(`${N} got unexpected break to lengthed map`)}if(c===Za)throw Error(`${N} found map but not enough entries (got ${s} [no key], expected ${e.value})`);if(!r&&typeof c!=`string`)throw Error(`${N} non-string keys not supported (got ${typeof c})`);if(i&&(r&&o.has(c)||!r&&Object.hasOwn(a,c)))throw Error(`${N} found repeat map key "${c}"`);let l=ro(t,n);if(l===Za)throw Error(`${N} found map but not enough entries (got ${s} [no value], expected ${e.value})`);r?o.set(c,l):a[c]=l}return r?o:a}function*to(e,t,n){for(let r=0;r<e.value;r++){let i=ro(t,n);if(i===Qa){if(e.value===1/0)break;throw Error(`${N} got unexpected break to lengthed map`)}if(i===Za)throw Error(`${N} found map but not enough entries (got ${r} [no key], expected ${e.value})`);let a=ro(t,n);if(a===Za)throw Error(`${N} found map but not enough entries (got ${r} [no value], expected ${e.value})`);yield[i,a]}}function no(e,t){let n=function(){if(n._called)throw Error(`${N} tag decode() may only be called once`);n._called=!0;let r=ro(e,t);if(r===Za)throw Error(`${N} tag content missing`);if(r===Qa)throw Error(`${N} got unexpected break in tag content`);return r};return n.entries=function(){if(n._called)throw Error(`${N} tag decode() may only be called once`);n._called=!0;let r=e.next();if(!j.equals(r.type,j.map))throw Error(`${N} entries() requires map content, got ${r.type.name}`);let i=[];for(let n of to(r,e,t))i.push(n);return i},n._called=!1,n}function ro(e,t){if(e.done())return Za;let n=e.next();if(j.equals(n.type,j.break))return Qa;if(n.type.terminal)return n.value;if(j.equals(n.type,j.array))return $a(n,e,t);if(j.equals(n.type,j.map))return eo(n,e,t);if(j.equals(n.type,j.tag)){if(t.tags&&typeof t.tags[n.value]==`function`){let r=no(e,t),i=t.tags[n.value](r);if(!r._called)throw Error(`${N} tag decoder must call decode() or entries()`);return i}throw Error(`${N} tag not supported (${n.value})`)}throw Error(`unsupported`)}function io(e,t){if(!(e instanceof Uint8Array))throw Error(`${N} data to decode must be a Uint8Array`);t=Object.assign({},Ya,t);let n=Nr(e),r=t.tokenizer||new Xa(n,t),i=ro(r,t);if(i===Za)throw Error(`${N} did not find any content to decode`);if(i===Qa)throw Error(`${N} got unexpected break`);return[i,e.subarray(r.pos())]}function ao(e,t){let[n,r]=io(e,t);if(r.length>0)throw Error(`${N} too many terminals, data makes no sense`);return n}Object.defineProperty(class e{constructor(e,t){if(typeof e!=`number`||!Number.isInteger(e)||e<0)throw TypeError(`Tagged: tag must be a non-negative integer`);this.tag=e,this.value=t}static decoder(t){return n=>new e(t,n())}static preserve(...t){let n={};for(let r of t)n[r]=e.decoder(r);return n}}.prototype,Symbol.toStringTag,{value:`Tagged`});function oo(e,t,n=()=>{}){if(!Array.isArray(e))throw TypeError(`"${t}" expected array, got type=${typeof e}`);for(let r=0;r<e.length;r++)n(e[r],`${t}[${r}]`);return e}var z=(e,t,n)=>Wn(e,t,n),so=Un;function co(e,t=``){if(typeof e!=`string`){let n=t&&`"${t}" `;throw TypeError(n+`expected string, got type=`+typeof e)}return e}function lo(e,t=`object`){if(typeof e!=`object`||!e||Array.isArray(e))throw TypeError(t===`object`?`expected valid options object`:`"${t}" expected object, got type=${typeof e}`);return e}function uo(e,t){if(typeof e!=`function`)throw TypeError(`"${t}" is invalid: expected function, got ${typeof e}`);return e}var fo=er,po=(...e)=>ir(...e),mo=e=>nr(e),ho=Vn,go=e=>sr(e),_o=BigInt(0),vo=BigInt(1),yo=e=>e?`"${e}" `:``;function bo(e,t=``){if(typeof e!=`boolean`)throw TypeError(yo(t)+`expected boolean, got type=`+typeof e);return e}function xo(e){if(typeof e==`bigint`){if(!Ao(e))throw RangeError(`positive bigint expected, got `+e)}else so(e);return e}function So(e,t=``){if(typeof e!=`number`){let n=t&&`"${t}" `;throw TypeError(n+`expected number, got type=`+typeof e)}if(!Number.isSafeInteger(e)){let n=t&&`"${t}" `;throw RangeError(n+`expected safe integer, got `+e)}}function Co(e){let t=xo(e).toString(16);return t.length&1?`0`+t:t}function wo(e){if(typeof e!=`string`)throw TypeError(`hex string expected, got `+typeof e);return e===``?_o:BigInt(`0x`+e)}function To(e){return wo(er(e))}function Eo(e){return wo(er(ko(Wn(e)).reverse()))}function Do(e,t){if(Un(t),t===0)throw Error(`zero output length is invalid`);e=xo(e);let n=t*2,r=e.toString(16);if(r.length>n)throw RangeError(`number is too large`);return nr(r.padStart(n,`0`))}function Oo(e,t){return Do(e,t).reverse()}function ko(e){return Uint8Array.from(z(e))}function Ao(e){return typeof e==`bigint`&&_o<=e}function jo(e,t,n){return Ao(e)&&Ao(t)&&Ao(n)&&t<=e&&e<n}function Mo(e,t,n,r){if(!jo(t,n,r))throw RangeError(`expected valid `+e+`: `+n+` <= n < `+r+`, got `+t)}function No(e){if(e<_o)throw Error(`expected non-negative bigint, got `+e);return e===_o?0:e.toString(2).length}var Po=e=>(So(e,`n`),(vo<<BigInt(e))-vo);function Fo(e,t,n){if(Un(e,`hashLen`),Un(t,`qByteLen`),typeof n!=`function`)throw TypeError(`hmacFn must be a function`);let r=e=>new Uint8Array(e),i=Uint8Array.of(),a=Uint8Array.of(0),o=Uint8Array.of(1),s=r(e),c=r(e),l=0,u=()=>{s.fill(1),c.fill(0),l=0},d=(...e)=>n(c,po(s,...e)),f=(e=i)=>{c=d(a,e),s=d(),e.length!==0&&(c=d(o,e),s=d())},p=()=>{if(l++>=1e3)throw Error(`drbg: tried max amount of iterations`);let e=0,n=[];for(;e<t;){s=d();let t=s.slice();n.push(t),e+=s.length}return po(...n)};return(e,t)=>{u(),f(e);let n;for(;(n=t(p()))===void 0;)f();return u(),n}}function Io(e,t={},n={},r=`object`){lo(e,r),lo(t,`fields`),lo(n,`optFields`);function i(t,n,i){let a=r===`object`?`param "${String(t)}"`:`"${r}.${String(t)}"`,o=e[t];if(!Object.hasOwn(e,t)&&(i?o!==void 0:n!==`function`))throw TypeError(`${a} is invalid: expected own property`);if(i&&o===void 0)return;let s=typeof o;if(s!==n||o===null)throw TypeError(`${a} is invalid: expected ${n}, got ${s}`)}let a=(e,t)=>Object.entries(e).forEach(([e,n])=>i(e,n,t));a(t,!1),a(n,!0)}var B=BigInt(0),V=BigInt(1),Lo=BigInt(2),Ro=BigInt(3),zo=BigInt(4),Bo=BigInt(5),Vo=BigInt(7),Ho=BigInt(8),Uo=BigInt(9),Wo=BigInt(15),Go=BigInt(16),Ko=BigInt(`0x10000000000000000`);function H(e,t){if(t<=B)throw Error(`mod: expected positive modulus, got `+t);let n=e%t;return n>=B?n:t+n}function qo(e,t,n){if(n<=V)throw Error(`pow: expected modulus > 1, got `+n);if(typeof t!=`bigint`)throw TypeError(`invalid exponent: expected bigint, got `+typeof t);if(t<B)throw Error(`invalid exponent, negatives unsupported`);if(t===B)return V;if(t===V)return e;let r=e%n;if(r<B&&(r+=n),t<Ko){let e=V;for(;t>B;)t&V&&(e=e*r%n),r=r*r%n,t>>=V;return e}let i=[];for(;t>B;)i.push(Number(t&Wo)),t>>=zo;let a=Array(16);a[0]=V,a[1]=r;for(let e=2;e<16;e++)a[e]=a[e-1]*r%n;let o=a[i[i.length-1]];for(let e=i.length-2;e>=0;e--){o=o*o%n,o=o*o%n,o=o*o%n,o=o*o%n;let t=i[e];t!==0&&(o=o*a[t]%n)}return o}function Jo(e,t,n){if(n<=V)throw Error(`pow2: expected modulus > 1, got `+n);if(t<B)throw Error(`pow2: expected non-negative exponent, got `+t);let r=e;for(;t-->B;)r*=r,r%=n;return r}function Yo(e,t){if(e===B)throw Error(`invert: expected non-zero number`);if(t<=V)throw Error(`invert: expected modulus > 1, got `+t);let n=H(e,t),r=t,i=B,a=V;for(;n!==B;){let e=r/n,t=r-n*e,o=i-a*e;r=n,n=t,i=a,a=o}if(r!==V)throw Error(`invert: does not exist`);return H(i,t)}function Xo(e,t){if(t<=V)throw Error(`invertCt: expected prime modulus > 1, got `+t);let n=H(e,t);if(n===B)throw Error(`invertCt: expected non-zero number`);let r=qo(n,t-Lo,t);if(H(n*r,t)!==V)throw Error(`invertCt: does not exist`);return r}function Zo(e,t,n){let r=e;if(!r.eql(r.sqr(t),n))throw Error(`Cannot find square root`)}function Qo(e,t){if((e&V)===B)throw Error(t+`: expected odd modulus, got `+e)}function $o(e,t){let n=e,r=(n.ORDER+V)/zo,i=n.pow(t,r);return Zo(n,i,t),i}function es(e,t){let n=e,r=(n.ORDER-Bo)/Ho,i=n.mul(t,Lo),a=n.pow(i,r),o=n.mul(t,a),s=n.mul(n.mul(o,Lo),a),c=n.mul(o,n.sub(s,n.ONE));return Zo(n,c,t),c}function ts(e){let t=fs(e),n=ns(e),r=n(t,t.neg(t.ONE)),i=n(t,r),a=n(t,t.neg(r)),o=(e+Vo)/Go;return((e,t)=>{let n=e,s=n.pow(t,o),c=n.mul(s,r),l=n.mul(s,i),u=n.mul(s,a),d=n.eql(n.sqr(c),t),f=n.eql(n.sqr(l),t);s=n.cmov(s,c,d),c=n.cmov(u,l,f);let p=n.eql(n.sqr(c),t),m=n.cmov(s,c,p);return Zo(n,m,t),m})}function ns(e){if(e<Ro)throw Error(`sqrt is not defined for small field`);Qo(e,`tonelliShanks`);let t=e-V,n=0;for(;t%Lo===B;)t/=Lo,n++;let r=Lo,i=fs(e);for(;cs(i,r)===1;)if(r++>1e3)throw Error(`Cannot find square root: probably non-prime P`);if(n===1)return $o;let a=i.pow(r,t),o=(t+V)/Lo;return function(e,r){let i=e;if(i.is0(r))return r;if(cs(i,r)!==1)throw Error(`Cannot find square root`);let s=n,c=i.mul(i.ONE,a),l=i.pow(r,t),u=i.pow(r,o);for(;!i.eql(l,i.ONE);){if(i.is0(l))throw Error(`Cannot find square root: probably non-prime P`);let e=1,t=i.sqr(l);for(;!i.eql(t,i.ONE);)if(e++,t=i.sqr(t),e===s)throw Error(`Cannot find square root`);let n=V<<BigInt(s-e-1),r=i.pow(c,n);s=e,c=i.sqr(r),l=i.mul(l,c),u=i.mul(u,r)}return u}}function rs(e){return Qo(e,`Fp.sqrt`),e%zo===Ro?$o:e%Ho===Bo?es:e%Go===Uo?ts(e):ns(e)}var is=(e,t)=>(H(e,t)&V)===V,as=[`create`,`isValid`,`is0`,`neg`,`inv`,`sqrt`,`sqr`,`eql`,`add`,`sub`,`mul`,`pow`,`div`,`addN`,`subN`,`mulN`,`sqrN`];function os(e){if(lo(e,`field`),typeof e.ORDER!=`bigint`)throw TypeError(`param "ORDER" is invalid: expected bigint, got `+typeof e.ORDER);So(e.BYTES,`BYTES`),So(e.BITS,`BITS`);for(let t of as)uo(e[t],`field.`+t);if(e.BYTES<1||e.BITS<1)throw Error(`invalid field: expected BYTES/BITS > 0`);if(e.ORDER<=V)throw Error(`invalid field: expected ORDER > 1, got `+e.ORDER);return e}function ss(e,t,n=!1){os(e),oo(t,`nums`),bo(n,`passZero`);let r=e,i=Array(t.length).fill(n?r.ZERO:void 0),a=t.reduce((e,t,n)=>r.is0(t)?e:(i[n]=e,r.mul(e,t)),r.ONE),o=r.inv(a);return t.reduceRight((e,t,n)=>r.is0(t)?e:(i[n]=r.mul(e,i[n]),r.mul(e,t)),o),i}function cs(e,t){os(e);let n=e;Qo(n.ORDER,`FpLegendre`);let r=(n.ORDER-V)/Lo,i=n.pow(t,r),a=n.eql(i,n.ONE),o=n.eql(i,n.ZERO),s=n.eql(i,n.neg(n.ONE));if(!a&&!o&&!s)throw Error(`invalid Legendre symbol result`);return a?1:o?0:-1}function ls(e,t){if(t!==void 0&&so(t),e<=B)throw Error(`invalid n length: expected positive n, got `+e);if(t!==void 0&&t<1)throw Error(`invalid n length: expected positive bit length, got `+t);let n=No(e);if(t!==void 0&&t<n)throw Error(`invalid n length: expected nBitLength (${t}) >= bitLen(n) (${n})`);let r=t===void 0?n:t;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}var us=new WeakMap,ds=class{ORDER;BITS;BYTES;isLE;ZERO=B;ONE=V;_lengths;_mod;constructor(e,t={}){if(e<=V)throw Error(`invalid field: expected ORDER > 1, got `+e);let n;this.isLE=!1,typeof t==`object`&&t&&(typeof t.BITS==`number`&&(n=t.BITS),typeof t.sqrt==`function`&&Object.defineProperty(this,"sqrt",{value:t.sqrt,enumerable:!0}),typeof t.isLE==`boolean`&&(this.isLE=t.isLE),t.allowedLengths&&(this._lengths=Object.freeze(t.allowedLengths.slice())),typeof t.modFromBytes==`boolean`&&(this._mod=t.modFromBytes));let{nBitLength:r,nByteLength:i}=ls(e,n);if(i>2048)throw Error(`invalid field: expected ORDER of <= 2048 bytes`);this.ORDER=e,this.BITS=r,this.BYTES=i,Object.freeze(this)}create(e){return H(e,this.ORDER)}isValid(e){if(typeof e!=`bigint`)throw TypeError(`invalid field element: expected bigint, got `+typeof e);return B<=e&&e<this.ORDER}is0(e){return e===B}isValidNot0(e){return!this.is0(e)&&this.isValid(e)}isOdd(e){return(e&V)===V}neg(e){return H(-e,this.ORDER)}eql(e,t){return e===t}sqr(e){return H(e*e,this.ORDER)}add(e,t){return H(e+t,this.ORDER)}sub(e,t){return H(e-t,this.ORDER)}mul(e,t){return H(e*t,this.ORDER)}pow(e,t){return qo(e,t,this.ORDER)}div(e,t){return H(e*Yo(t,this.ORDER),this.ORDER)}sqrN(e){return e*e}addN(e,t){return e+t}subN(e,t){return e-t}mulN(e,t){return e*t}inv(e){return Yo(e,this.ORDER)}sqrt(e){let t=us.get(this);return t||us.set(this,t=rs(this.ORDER)),t(this,e)}toBytes(e){return this.isLE?Oo(e,this.BYTES):Do(e,this.BYTES)}fromBytes(e,t=!1){z(e);let{_lengths:n,BYTES:r,isLE:i,ORDER:a,_mod:o}=this;if(n){if(e.length<1||!n.includes(e.length)||e.length>r)throw Error(`Field.fromBytes: expected `+n+` bytes, got `+e.length);let t=new Uint8Array(r);t.set(e,i?0:t.length-e.length),e=t}if(e.length!==r)throw Error(`Field.fromBytes: expected `+r+` bytes, got `+e.length);let s=i?Eo(e):To(e);if(o&&(s=H(s,a)),!t&&!this.isValid(s))throw Error(`invalid field element: outside of range 0..ORDER`);return s}invertBatch(e){return ss(this,e,!0)}cmov(e,t,n){return bo(n,`condition`),n?t:e}};function fs(e,t={}){return Object.freeze(ds.prototype),new ds(e,t)}function ps(e){if(typeof e!=`bigint`)throw Error(`field order must be bigint`);if(e<=V)throw Error(`field order must be greater than 1`);let t=No(e-V);return Math.ceil(t/8)}function ms(e){let t=ps(e);return t+Math.ceil(t/2)}function hs(e,t,n=!1){z(e);let r=e.length,i=ps(t),a=Math.max(ms(t),16);if(r<a||r>1024)throw Error(`expected `+a+`-1024 bytes of input, got `+r);let o=H(n?Eo(e):To(e),t-V)+V;return n?Oo(o,i):Do(o,i)}var gs=BigInt(0),_s=BigInt(1),vs=BigInt(4),ys=16,bs=128,xs=5,Ss=2**31;function Cs(e){let t=e;if(typeof t!=`function`)throw TypeError(`"Point" expected constructor, got type=`+typeof e);uo(t.fromAffine,`Point.fromAffine`),uo(t.fromBytes,`Point.fromBytes`),uo(t.fromHex,`Point.fromHex`),lo(t.BASE,`Point.BASE`),lo(t.ZERO,`Point.ZERO`),os(t.Fp),os(t.Fn)}function ws(e,t){Cs(e),Os(t,e);let n=ss(e.Fp,t.map(e=>e.Z));return t.map((t,r)=>e.fromAffine(t.toAffine(n[r])))}function Ts(e,t,n=1){if(!Number.isSafeInteger(e)||e<n||e>t)throw Error(`invalid window size, expected [`+n+`..`+t+`], got W=`+e)}function Es(e,t){let n=e*(4*t+128);if(n>Ss)throw Error(`invalid window size: table would need ~`+Math.ceil(n/2**20)+` MiB, max `+Ss/2**20+` MiB`)}function Ds(e,t){if(e!==void 0){uo(e,`randomBytes`);try{let n=e(t);if(!ho(n)||n.length!==t)return}catch{return}return e}}function Os(e,t){oo(e,`points`),e.forEach((e,n)=>{if(!(e instanceof t))throw Error(`invalid point at index `+n)})}function ks(e,t,n){if(!Array.isArray(e))throw Error(`array of scalars expected`);e.forEach((e,r)=>{if(!(n===void 0?t.isValid(e):Ao(e)&&e<n))throw Error(`invalid scalar at index `+r)})}var As=new WeakMap;function js(e){return As.get(e)||1}function Ms(e,t){let n=e.double(),r=[e];for(let e=1;e<t;e++)r.push(r[e-1].add(n));return r}function Ns(e,t){let n=2**t,r=n/2,i=BigInt(n-1),a=[];for(;e>gs;){let t=0;e&_s&&(t=Number(e&i),t>=r&&(t-=n),e-=BigInt(t)),a.push(t),e>>=_s}return a}function Ps(e,t,n){let r=2**t,i=r/2,a=BigInt(r-1),o=BigInt(t),s=[];for(let t=0;t<n;t++){let t=Number(e&a);e>>=o,t>i&&(t-=r,e+=_s),s.push(t)}if(e!==gs)throw Error(`invalid wnaf`);return s}function Fs(e,t,n){let r=0;for(let e of n)r=Math.max(r,e.length);let i=e;for(let e=r-1;e>=0;e--){e!==r-1&&(i=i.double());for(let r=0;r<n.length;r++){let a=n[r][e];if(a){let e=t[r][Math.abs(a)-1>>1];i=i.add(a<0?e.negate():e)}}}return i}var Is=class{Point;BASE;ZERO;randomBytes;wnafPrecomputes=new WeakMap;baseCanBeBlinded;bits;constructor(e,t){Cs(e),this.randomBytes=Ds(t,ys),this.Point=e,this.BASE=e.BASE,this.ZERO=e.ZERO,this.bits=e.Fn.BITS}buildWnafTable(e,t,n){let r=Math.ceil(n/t)+1,i=2**(t-1),a=[],o=e;for(let e=0;e<r;e++){let e=o;for(let t=0;t<i;t++)a.push(e),e=e.add(o);o=a[a.length-1].double()}return{W:t,bits:n,windows:r,comp:a}}wnafCachedCT(e,t){let{W:n,windows:r,comp:i}=e,a=2**(n-1),o=Ps(t,n,r),s=this.ZERO,c=this.BASE;for(let e=0;e<r;e++){let t=o[e],n=e*a,r=Math.abs(t)-1,l=i[n];for(let e=1;e<a;e++)l=e===r?i[n+e]:l;let u=l.negate();t===0?c=c.add(i[n]):s=s.add(t<0?u:l)}return{p:s,f:c}}getWnafPrecomputes(e,t,n,r){let i=this.wnafPrecomputes.get(t),a=i?.find(t=>t.W===e&&t.bits===n);return a||(a=this.buildWnafTable(t,e,n),typeof r==`function`&&(a={...a,comp:r(a.comp)}),i||(i=[],this.wnafPrecomputes.set(t,i)),i.push(a)),a}assertPoint(e){if(!(e instanceof this.Point))throw TypeError(`"point" expected Point instance, got type=`+typeof e)}validateMulInput(e,t){if(this.assertPoint(e),!jo(t,_s,this.Point.Fn.ORDER))throw Error(`invalid scalar`)}runCT(e,t,n,r){let i=js(e);return i===1?this.fixedWindowCT(e,t,n):this.wnafCachedCT(this.getWnafPrecomputes(i,e,n,r),t)}mulCT(e,t,n){return this.validateMulInput(e,t),this.runCT(e,t,this.bits,n)}mulCTBlinded(e,t,n){if(this.validateMulInput(e,t),this.randomBytes===void 0)throw Error(`randomBytes is required for scalar blinding`);let r=this.Point.Fn.BITS+bs,i=this.randomBytes(ys);if(!ho(i)||i.length!==ys)throw Error(`randomBytes returned invalid byte array`);i[0]=i[0]&63|128;let a=t+To(i)*this.Point.Fn.ORDER;return this.runCT(e,a,r,n)}fixedWindowCT(e,t,n){let r=xs,i=Po(r),a=Array(32);a[0]=this.ZERO;for(let t=1;t<32;t++)a[t]=a[t-1].add(e);let o=Math.ceil(n/r),s=this.ZERO;for(let e=o-1;e>=0;e--){if(e!==o-1)for(let e=0;e<r;e++)s=s.double();let n=Number(t>>BigInt(e*r)&i),c=a[0];for(let e=1;e<32;e++)c=e===n?a[e]:c;s=s.add(c)}return{p:s,f:s}}shouldBlind(e,t){return this.randomBytes===void 0?!1:t===_s||e===this.BASE&&(this.baseCanBeBlinded===void 0&&(this.baseCanBeBlinded=this.mulUnsafe(this.BASE,this.Point.Fn.ORDER).is0()),this.baseCanBeBlinded)}mulSecret(e,t,n,r){return this.shouldBlind(e,n)?this.mulCTBlinded(e,t,r):this.mulCT(e,t,r)}mulUnsafe(e,t,n){if(this.assertPoint(e),!Ao(t))throw Error(`invalid scalar`);let r=js(e);if(r===1||t>=this.Point.Fn.ORDER)return Ls(this.Point,[e],[t],!0);let i=this.getWnafPrecomputes(r,e,this.bits,n);return this.wnafCachedCT(i,t).p}setWindowSize(e,t){this.assertPoint(e),Ts(t,this.bits),Es((Math.ceil((this.bits+bs)/t)+1)*2**(t-1),this.Point.Fp.BYTES),As.set(e,t),this.wnafPrecomputes.delete(e)}hasWindowSize(e){return js(e)!==1}};function Ls(e,t,n,r=!1){if(Cs(e),Os(t,e),bo(r,`allowOversized`),ks(n,e.Fn,r?e.Fn.ORDER**vs:void 0),t.length!==n.length)throw Error(`arrays of points and scalars must have equal length`);let i=t.map(e=>Ms(e,4)),a=n.map(e=>Ns(e,4));return Fs(e.ZERO,i,a)}function Rs(e,t,n){if(t){if(t.ORDER!==e)throw Error(`Field.ORDER must match order: Fp == p, Fn == n`);return os(t),t}return fs(e,{isLE:n})}function zs(e,t,n={},r){if(e!==`weierstrass`&&e!==`edwards`)throw Error(`expected curve type "weierstrass" or "edwards"`);if(r===void 0&&(r=e===`edwards`),!t||typeof t!=`object`)throw Error(`expected valid ${e} CURVE object`);Io(n);for(let e of[`p`,`n`,`h`]){let n=t[e];if(!(Ao(n)&&n!==gs))throw Error(`CURVE.${e} must be positive bigint`)}let i=Rs(t.p,n.Fp,r),a=Rs(t.n,n.Fn,r),o=[`Gx`,`Gy`,`a`,e===`weierstrass`?`b`:`d`];for(let e of o)if(!i.isValid(t[e]))throw Error(`CURVE.${e} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:i,Fn:a}}function Bs(e,t){return function(n){let r=e(n);return{secretKey:r,publicKey:t(r)}}}var Vs=BigInt(0),Hs=BigInt(1),Us=BigInt(2),Ws=BigInt(4),Gs=BigInt(8);function Ks(e,t,n,r){let i=e.sqr(n),a=e.sqr(r),o=e.add(e.mul(t.a,i),a),s=e.add(e.ONE,e.mul(t.d,e.mul(i,a)));return e.eql(o,s)}function qs(e,t={}){Io(t,{},{},`extraOpts`);let n=t,r=zs(`edwards`,e,n,n.FpFnLE),{Fp:i,Fn:a}=r,o=r.CURVE,{h:s}=o;if(cs(i,o.a)!==1)throw Error(`edwards: CURVE.a must be a square in Fp for complete addition formulas`);if(cs(i,o.d)!==-1)throw Error(`edwards: CURVE.d must be a non-square in Fp for complete addition formulas`);Io(n,{},{uvRatio:`function`,randomBytes:`function`});let c=n.randomBytes===void 0?go:n.randomBytes,l=Us<<BigInt(i.BYTES*8)-Hs;function u(e){if(!i.isOdd)throw Error(`Field does not have .isOdd()`);return i.isOdd(e)}let d=n.uvRatio===void 0?(e,t)=>{try{return{isValid:!0,value:i.sqrt(i.div(e,t))}}catch{return{isValid:!1,value:Vs}}}:n.uvRatio;if(!Ks(i,o,o.Gx,o.Gy))throw Error(`bad curve params: generator point`);let f=i.eql(o.a,i.neg(i.ONE))?e=>i.neg(e):i.eql(o.a,i.ONE)?e=>e:e=>i.mul(o.a,e);function p(e,t,n=!1){let r=n?Hs:Vs;return Mo(`coordinate `+e,t,r,l),t}function m(e){if(!(e instanceof h))throw Error(`EdwardsPoint expected`)}class h{static BASE=new h(o.Gx,o.Gy,i.ONE,i.mul(o.Gx,o.Gy));static ZERO=new h(i.ZERO,i.ONE,i.ONE,i.ZERO);static Fp=i;static Fn=a;X;Y;Z;T;constructor(e,t,n,r){this.X=p(`x`,e),this.Y=p(`y`,t),this.Z=p(`z`,n,!0),this.T=p(`t`,r),Object.freeze(this)}static CURVE(){return o}static fromAffine(e){if(e instanceof h)throw Error(`extended point not allowed`);let{x:t,y:n}=e||{};return p(`x`,t),p(`y`,n),new h(t,n,i.ONE,i.mul(t,n))}static fromBytes(e,t=!1){let n=i.BYTES,{a:r,d:a}=o;e=ko(z(e,n,`point`)),bo(t,`zip215`);let s=ko(e),c=e[n-1];s[n-1]=c&-129;let f=Eo(s);Mo(`point.y`,f,Vs,t?l:i.ORDER);let p=i.sqr(f),m=i.sub(p,i.ONE),g=i.sub(i.mulN(a,p),r),{isValid:_,value:v}=d(m,g);if(!_)throw Error(`bad point: invalid y coordinate`);let y=u(v),b=!!(c&128);if(!t&&i.is0(v)&&b)throw Error(`bad point: x=0 and x_0=1`);return b!==y&&(v=i.neg(v)),h.fromAffine({x:v,y:f})}static fromHex(e,t=!1){return h.fromBytes(mo(e),t)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(e=6,t=!0){return _.setWindowSize(this,e),t||this.multiply(Us),this}assertValidity(){let e=this,{a:t,d:n}=o;if(e.is0())throw Error(`bad point: ZERO`);let{X:r,Y:a,Z:s,T:c}=e,l=i.sqr(r),u=i.sqr(a),d=i.sqr(s),f=i.sqr(d),p=i.mul(l,t),m=i.mul(i.add(p,u),d),h=i.add(f,i.mul(n,i.mul(l,u)));if(!i.eql(m,h))throw Error(`bad point: equation left != right (1)`);let g=i.mul(r,a),_=i.mul(s,c);if(!i.eql(g,_))throw Error(`bad point: equation left != right (2)`)}equals(e){m(e);let{X:t,Y:n,Z:r}=this,{X:a,Y:o,Z:s}=e,c=i.mul(t,s),l=i.mul(a,r),u=i.mul(n,s),d=i.mul(o,r);return i.eql(c,l)&&i.eql(u,d)}is0(){return this.equals(h.ZERO)}negate(){return new h(i.neg(this.X),this.Y,this.Z,i.neg(this.T))}double(){let{X:e,Y:t,Z:n}=this,r=i.sqr(e),a=i.sqr(t),o=i.mul(i.sqr(n),Us),s=f(r),c=i.addN(e,t),l=i.sub(i.subN(i.sqr(c),r),a),u=i.addN(s,a),d=i.subN(u,o),p=i.subN(s,a),m=i.mul(l,d),g=i.mul(u,p),_=i.mul(l,p),v=i.mul(d,u);return new h(m,g,v,_)}add(e){m(e);let{d:t}=o,{X:n,Y:r,Z:a,T:s}=this,{X:c,Y:l,Z:u,T:d}=e,p=i.mul(n,c),g=i.mul(r,l),_=i.mul(i.mulN(s,t),d),v=i.mul(a,u),y=i.sub(i.subN(i.mulN(i.addN(n,r),i.addN(c,l)),p),g),b=i.subN(v,_),x=i.addN(v,_),S=i.sub(g,f(p)),C=i.mul(y,b),w=i.mul(x,S),T=i.mul(y,S),E=i.mul(b,x);return new h(C,w,E,T)}subtract(e){return m(e),this.add(e.negate())}multiply(e){if(!a.isValidNot0(e))throw RangeError(`invalid scalar: expected 1 <= sc < curve.n`);let{p:t,f:n}=_.mulSecret(this,e,s,g);return g([t,n])[0]}multiplyUnsafe(e){if(!a.isValid(e))throw RangeError(`invalid scalar: expected 0 <= sc < curve.n`);return e===Vs?h.ZERO:this.is0()||e===Hs?this:_.mulUnsafe(this,e,g)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){return _.mulUnsafe(this,o.n).is0()}toAffine(e){let t=this,n=e;if(n!=null&&typeof n!=`bigint`)throw TypeError(`"invertedZ" expected bigint, got type=`+typeof n);let{X:r,Y:a,Z:o}=t,s=t.is0();n??=s?i.create(Gs):i.inv(o);let c=i.mul(r,n),l=i.mul(a,n),u=i.mul(o,n);if(s)return{x:i.ZERO,y:i.ONE};if(!i.eql(u,i.ONE))throw Error(`invZ was invalid`);return{x:c,y:l}}clearCofactor(){return s===Hs?this:s===Us?this.double():s===Ws?this.double().double():s===Gs?this.double().double().double():this.multiplyUnsafe(s)}toBytes(){let{x:e,y:t}=this.toAffine(),n=i.toBytes(t);return n[n.length-1]|=u(e)?128:0,n}toHex(){return fo(this.toBytes())}toString(){return`<Point ${this.is0()?`ZERO`:this.toHex()}>`}}let g=e=>ws(h,e),_=new Is(h,c);return _.bits>=6&&h.BASE.precompute(6),Object.freeze(h.prototype),Object.freeze(h),h}function Js(e,t,n={}){if(Cs(e),typeof t!=`function`)throw Error(`"hash" function param is required`);let r=t,i=n;Io(i,{},{adjustScalarBytes:`function`,randomBytes:`function`,domain:`function`,prehash:`function`,zip215:`boolean`,mapToCurve:`function`,toMontgomery:`function`,toMontgomerySecret:`function`});let{prehash:a}=i,{BASE:o,Fp:s,Fn:c}=e,l=r.outputLen,u=2*s.BYTES;if(l!==void 0&&(So(l,`hash.outputLen`),l!==u))throw Error(`hash.outputLen must be ${u}, got ${l}`);let d=i.randomBytes===void 0?go:i.randomBytes,f=i.toMontgomery,p=i.toMontgomerySecret,m=i.adjustScalarBytes===void 0?e=>e:i.adjustScalarBytes,h=i.domain===void 0?(e,t,n)=>{if(bo(n,`phflag`),t.length||n)throw Error(`Contexts/pre-hash are not supported`);return e}:i.domain;function g(e){return c.create(Eo(e))}function _(e){let t=T.secretKey;z(e,T.secretKey,`secretKey`);let n=z(r(e),2*t,`hashedSecretKey`),i=m(n.slice(0,t));return{head:i,prefix:n.slice(t,2*t),scalar:g(i)}}function v(e){let{head:t,prefix:n,scalar:r}=_(e),i=o.multiply(r);return{head:t,prefix:n,scalar:r,point:i,pointBytes:i.toBytes()}}function y(e){return v(e).pointBytes}function b(e=Uint8Array.of(),...t){let n=po(...t);return g(r(h(n,z(e,void 0,`context`),!!a)))}function x(e,t,n={}){Io(n,{},{},`options`),e=z(e,void 0,`message`),a&&(e=a(e));let{prefix:r,scalar:i,pointBytes:s}=v(t),l=b(n.context,r,e),u=o.multiply(l).toBytes(),d=b(n.context,u,s,e),f=c.create(l+d*i);if(!c.isValid(f))throw Error(`sign failed: invalid s`);return z(po(u,c.toBytes(f)),T.signature,`result`)}let S={zip215:i.zip215};function C(t,n,r,i=S){Io(i);let{context:s}=i,c=i.zip215===void 0?!!S.zip215:i.zip215,l=T.signature;t=z(t,l,`signature`),n=z(n,void 0,`message`),r=z(r,T.publicKey,`publicKey`),c!==void 0&&bo(c,`zip215`),a&&(n=a(n));let u=l/2,d=t.subarray(0,u),f=Eo(t.subarray(u,l)),p,m,h;try{p=e.fromBytes(r,c),m=e.fromBytes(d,c),h=o.multiplyUnsafe(f)}catch{return!1}if(!c&&p.isSmallOrder())return!1;let g=b(s,d,r,n);return m.add(p.multiplyUnsafe(g)).subtract(h).clearCofactor().is0()}let w=s.BYTES,T={secretKey:w,publicKey:w,signature:2*w,seed:w};function E(e){return e=e===void 0?d(T.seed):e,z(e,T.seed,`seed`)}function ee(e){return ho(e)&&e.length===T.secretKey}function D(t,n){try{return!!e.fromBytes(t,n===void 0?S.zip215:n)}catch{return!1}}let te={getExtendedPublicKey:v,randomSecretKey:E,isValidSecretKey:ee,isValidPublicKey:D,toMontgomery(t){if(f===void 0)throw Error(`Montgomery conversion is not supported for this curve`);return f(e.fromBytes(t))},toMontgomerySecret(e){if(p===void 0)throw Error(`Montgomery conversion is not supported for this curve`);return p(e)}};return Object.freeze(T),Object.freeze(te),Object.freeze({keygen:Bs(E,y),getPublicKey:y,sign:x,verify:C,utils:te,Point:e,lengths:T})}var Ys=BigInt(0),Xs=BigInt(1),Zs=BigInt(2);function Qs(e,t){return e+t-(t>>Xs<<Xs)}function $s(e){let t=BigInt(6)*e;return(n,r,i)=>{let a=r+i,o=((t+i-r)*n+r)%e;return{x_2:o,x_3:a-o}}}function ec(e){return Io(e,{P:`bigint`,type:`string`,adjustScalarBytes:`function`,powPminus2:`function`},{randomBytes:`function`,scalarMultBase:`function`}),Object.freeze({...e})}function tc(e){let t=ec(e),{P:n,type:r,adjustScalarBytes:i,powPminus2:a,randomBytes:o}=t,s=t.scalarMultBase,c=r===`x25519`;if(!c&&r!==`x448`)throw Error(`invalid type`);let l=o===void 0?go:o,u=c?255:448,d=$s(n),f=c?32:56,p=BigInt(c?9:5),m=BigInt(c?121665:39081),h=c?Zs**BigInt(254):Zs**BigInt(447),g=h+(c?BigInt(8)*(Zs**BigInt(251)-Xs):BigInt(4)*(Zs**BigInt(445)-Xs))+Xs,_=e=>H(e,n),v=y(p);function y(e){return Oo(_(e),f)}function b(e){let t=ko(z(e,f,`uCoordinate`));return c&&(t[31]&=127),_(Eo(t))}function x(e){return Eo(i(ko(z(e,f,`scalar`))))}let S=new Set(c?[Ys,Xs,n-Xs,BigInt(`325606250916557431795983626356110631294008115727848805560023387167927233504`),BigInt(`39382357235489614581723060781553021112529911719440698176882885853963445705823`)]:[Ys,Xs,n-Xs]);function C(e,t){let n=b(t);if(S.has(n))throw Error(`invalid private or public key received`);let r=ee(n,x(e));if(r===Ys)throw Error(`invalid private or public key received`);return y(r)}function w(e){if(s===void 0)return C(e,v);let t=x(e);Mo(`scalar`,t,h,g);let n=_(s(t));if(n===Ys)throw Error(`invalid private or public key received`);return y(n)}let T=w,E=C;function ee(e,t){Mo(`u`,e,Ys,n),Mo(`scalar`,t,h,g);let r=t,i=e,o=Xs,s=Ys,c=e,l=Xs,f=r^r>>Xs;for(let e=BigInt(u-1);e>=Ys;e--){let t=Qs(n,f>>e);({x_2:o,x_3:c}=d(t,o,c)),{x_2:s,x_3:l}=d(t,s,l);let r=o+s,a=_(r*r),u=o-s,p=_(u*u),h=a-p,g=c+l,v=c-l,y=_(v*r),b=_(g*u),x=y+b,S=y-b;c=_(x*x),l=_(i*_(S*S)),o=_(a*p),s=_(h*(a+_(m*h)))}let p=Qs(n,r);({x_2:o,x_3:c}=d(p,o,c)),{x_2:s,x_3:l}=d(p,s,l);let v=a(s);return _(o*v)}let D={secretKey:f,publicKey:f,seed:f},te=e=>(e=e===void 0?l(f):e,z(e,D.seed,`seed`),e),ne={randomSecretKey:te};return Object.freeze(D),Object.freeze(ne),Object.freeze({keygen:Bs(te,T),getSharedSecret:E,getPublicKey:T,scalarMult:C,scalarMultBase:w,utils:ne,GuBytes:v.slice(),lengths:D})}var nc=BigInt(0),rc=BigInt(1),ic=BigInt(2),ac=BigInt(3),oc=BigInt(5),sc=BigInt(8),cc=BigInt(`0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed`),lc={p:cc,n:BigInt(`0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed`),h:sc,a:BigInt(`0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec`),d:BigInt(`0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3`),Gx:BigInt(`0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a`),Gy:BigInt(`0x6666666666666666666666666666666666666666666666666666666666666658`)};function uc(e){let t=BigInt(10),n=BigInt(20),r=BigInt(40),i=BigInt(80),a=cc,o=e*e%a*e%a,s=Jo(Jo(o,ic,a)*o%a,rc,a)*e%a,c=Jo(s,oc,a)*s%a,l=Jo(c,t,a)*c%a,u=Jo(l,n,a)*l%a,d=Jo(u,r,a)*u%a;return{pow_p_5_8:Jo(Jo(Jo(Jo(d,i,a)*d%a,i,a)*d%a,t,a)*c%a,ic,a)*e%a,b2:o}}function dc(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}var fc=BigInt(`19681161376707505956807079304988542015446066515923890162744021073123829784752`);function pc(e,t){let n=cc,r=H(t*t*t,n),i=uc(e*H(r*r*t,n)).pow_p_5_8,a=H(e*r*i,n),o=H(t*a*a,n),s=a,c=H(a*fc,n),l=o===e,u=o===H(-e,n),d=o===H(-e*fc,n);return l&&(a=s),(u||d)&&(a=c),is(a,n)&&(a=H(-a,n)),{isValid:l||u,value:a}}var mc=qs(lc,{uvRatio:pc}),hc=mc.Fp;function gc(e){let{y:t}=e;return hc.toBytes(hc.div(rc+t,rc-t))}function _c(e){let t=mc.Fp.BYTES;return Wn(e,t),dc(Er(e.subarray(0,t))).subarray(0,t)}function vc(e){return Js(mc,Er,Object.assign({adjustScalarBytes:dc,toMontgomery:gc,toMontgomerySecret:_c,zip215:!0},e))}var yc=vc({}),bc=(()=>{let e=cc,t=t=>{let{pow_p_5_8:n,b2:r}=uc(t);return H(Jo(n,ac,e)*r,e)};return tc({P:e,type:`x25519`,powPminus2:t,adjustScalarBytes:dc,scalarMultBase:n=>{let r=H(n,mc.Fn.ORDER);if(r===nc)return nc;let i=mc.BASE.multiply(r);return H((i.Z+i.Y)*t(H(i.Z-i.Y,e)),e)}})})(),xc=class{oHash;iHash;blockLen;outputLen;canXOF=!1;finished=!1;destroyed=!1;constructor(e,t){if(Gn(e),Wn(t,void 0,`key`),this.iHash=e.create(),typeof this.iHash.update!=`function`)throw Error(`expected Hash instance`);this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let n=this.blockLen,r=new Uint8Array(n);r.set(t.length>n?e.create().update(t).digest():t);for(let e=0;e<r.length;e++)r[e]^=54;this.iHash.update(r),this.oHash=e.create();for(let e=0;e<r.length;e++)r[e]^=106;this.oHash.update(r),Yn(r)}update(e){return qn(this),this.iHash.update(e),this}digestInto(e){qn(this),Jn(e,this),this.finished=!0;let t=e.subarray(0,this.outputLen);this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||=Object.create(Object.getPrototypeOf(this),{});let{oHash:t,iHash:n,finished:r,destroyed:i,blockLen:a,outputLen:o,canXOF:s}=this;return e=e,e.finished=r,e.destroyed=i,e.blockLen=a,e.outputLen=o,e.canXOF=s,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},Sc=(()=>{let e=((e,t,n)=>new xc(e,t).update(n).digest());return e.create=(e,t)=>new xc(e,t),e})(),Cc=BigInt(0),wc={Err:class extends Error{constructor(e=``){super(e)}},_tlv:{encode:(e,t)=>{let{Err:n}=wc;if(So(e,`tag`),e<0||e>255)throw new n(`tlv.encode: wrong tag`);if(co(t,`data`),t.length&1)throw new n(`tlv.encode: unpadded data`);let r=t.length/2,i=Co(r);if(i.length/2&128)throw new n(`tlv.encode: long form length too big`);let a=r>127?Co(i.length/2|128):``;return Co(e)+a+i+t},decode(e,t){let{Err:n}=wc;t=z(t,void 0,`DER data`);let r=0;if(e<0||e>255)throw new n(`tlv.decode: wrong tag`);if(t.length<2||t[r++]!==e)throw new n(`tlv.decode: wrong tlv`);let i=t[r++],a=!!(i&128),o=0;if(!a)o=i;else{let e=i&127;if(!e)throw new n(`tlv.decode(long): indefinite length not supported`);if(e>4)throw new n(`tlv.decode(long): byte length is too big`);let a=t.subarray(r,r+e);if(a.length!==e)throw new n(`tlv.decode: length bytes not complete`);if(a[0]===0)throw new n(`tlv.decode(long): zero leftmost byte`);for(let e of a)o=o<<8|e;if(r+=e,o<128)throw new n(`tlv.decode(long): not minimal encoding`)}let s=t.subarray(r,r+o);if(s.length!==o)throw new n(`tlv.decode: wrong value length`);return{v:s,l:t.subarray(r+o)}}},_int:{encode(e){let{Err:t}=wc;if(xo(e),e<Cc)throw new t(`integer: negative integers are not allowed`);let n=Co(e);if(Number.parseInt(n[0],16)&8&&(n=`00`+n),n.length&1)throw new t(`unexpected DER parsing assertion: unpadded hex`);return n},decode(e){let{Err:t}=wc;if(e.length<1)throw new t(`invalid signature integer: empty`);if(e[0]&128)throw new t(`invalid signature integer: negative`);if(e.length>1&&e[0]===0&&!(e[1]&128))throw new t(`invalid signature integer: unnecessary leading zero`);return To(e)}},toSig(e){let{Err:t,_int:n,_tlv:r}=wc,i=z(e,void 0,`signature`),{v:a,l:o}=r.decode(48,i);if(o.length)throw new t(`invalid signature: left bytes after parsing`);let{v:s,l:c}=r.decode(2,a),{v:l,l:u}=r.decode(2,c);if(u.length)throw new t(`invalid signature: left bytes after parsing`);return{r:n.decode(s),s:n.decode(l)}},hexFromSig(e){let{_tlv:t,_int:n}=wc;Io(e,{r:`bigint`,s:`bigint`},{},`sig`);let r=t.encode(2,n.encode(e.r))+t.encode(2,n.encode(e.s));return t.encode(48,r)}},Tc=(Object.freeze(wc._tlv),Object.freeze(wc._int),Object.freeze(wc)),Ec=(e,t)=>(e+(e>=0?t:-t)/Mc)/t;function Dc(e,t,n){Mo(`scalar`,e,Ac,n);let[[r,i],[a,o]]=t,s=Ec(o*e,n),c=Ec(-i*e,n),l=e-s*r-c*a,u=-s*i-c*o,d=l<Ac,f=u<Ac;d&&(l=-l),f&&(u=-u);let p=Po(Math.ceil(No(n)/2))+jc;if(l<Ac||l>=p||u<Ac||u>=p)throw Error(`splitScalar (endomorphism): failed for k`);return{k1neg:d,k1:l,k2neg:f,k2:u}}function Oc(e){if(![`compact`,`recovered`,`der`].includes(e))throw Error(`Signature format must be "compact", "recovered", or "der"`);return e}function kc(e,t){Io(e);let n={};for(let r of Object.keys(t))n[r]=e[r]===void 0?t[r]:e[r];return bo(n.lowS,`lowS`),bo(n.prehash,`prehash`),n.format!==void 0&&Oc(n.format),n}var Ac=BigInt(0),jc=BigInt(1),Mc=BigInt(2),Nc=BigInt(3),Pc=BigInt(4);function Fc(e,t={}){let n=zs(`weierstrass`,e,t),r=n.Fp,i=n.Fn,a=n.CURVE,{h:o,n:s}=a;Io(t,{},{allowInfinityPoint:`boolean`,clearCofactor:`function`,isTorsionFree:`function`,fromBytes:`function`,toBytes:`function`,endo:`object`,randomBytes:`function`});let{endo:c,allowInfinityPoint:l}=t,u=t.randomBytes===void 0?go:t.randomBytes;if(c&&(!r.is0(a.a)||typeof c.beta!=`bigint`||!Array.isArray(c.basises)))throw Error(`invalid endo: expected "beta": bigint and "basises": array`);let d=Lc(r,i);function f(){if(!r.isOdd)throw Error(`compression is not supported: Field does not have .isOdd()`)}function p(e,t,n){if(l&&t.is0())return Uint8Array.of(0);let{x:i,y:a}=t.toAffine(),o=r.toBytes(i);return bo(n,`isCompressed`),n?(f(),po(Ic(!r.isOdd(a)),o)):po(Uint8Array.of(4),o,r.toBytes(a))}function m(e){z(e,void 0,`Point`);let{publicKey:t,publicKeyUncompressed:n}=d,i=e.length,a=e[0],o=e.subarray(1);if(l&&i===1&&a===0)return{x:r.ZERO,y:r.ZERO};if(i===t&&(a===2||a===3)){let e=r.fromBytes(o);if(!r.isValid(e))throw Error(`bad point: is not on curve, wrong x`);let t=y(e),n;try{n=r.sqrt(t)}catch(e){let t=e instanceof Error?`: `+e.message:``;throw Error(`bad point: is not on curve, sqrt error`+t)}f();let i=r.isOdd(n);return(a&1)==1!==i&&(n=r.neg(n)),{x:e,y:n}}if(i===n&&a===4){let e=r.BYTES,t=r.fromBytes(o.subarray(0,e)),n=r.fromBytes(o.subarray(e,e*2));if(!b(t,n))throw Error(`bad point: is not on curve`);return{x:t,y:n}}throw Error(`bad point: got length ${i}, expected compressed=${t} or uncompressed=${n}`)}let h=t.toBytes===void 0?p:t.toBytes,g=t.fromBytes===void 0?m:t.fromBytes,_=r.mul(a.b,Nc),v=r.is0(a.a)?e=>r.ZERO:e=>r.mul(a.a,e);function y(e){let t=r.sqr(e),n=r.mul(t,e);return r.add(r.add(n,r.mul(e,a.a)),a.b)}function b(e,t){let n=r.sqr(t),i=y(e);return r.eql(n,i)}if(!b(a.Gx,a.Gy))throw Error(`bad curve params: generator point`);let x=r.mul(r.pow(a.a,Nc),Pc),S=r.mul(r.sqr(a.b),BigInt(27));if(r.is0(r.add(x,S)))throw Error(`bad curve params: a or b`);function C(e,t,n=!1){if(!r.isValid(t)||n&&r.is0(t))throw Error(`bad point coordinate ${e}`);return t}function w(e){if(!(e instanceof D))throw Error(`Weierstrass Point expected`)}function T(e){if(!c||!c.basises)throw Error(`no endo`);return Dc(e,c.basises,i.ORDER)}function E(e,t,n,a){if(!i.isValid(a))throw RangeError(`invalid scalar: out of range`);if(c){let{k1neg:i,k1:o,k2neg:s,k2:l}=T(a),u=new D(r.mul(n.X,c.beta),n.Y,n.Z);e.push(i?n.negate():n,s?u.negate():u),t.push(o,l)}else e.push(n),t.push(a)}let ee=new WeakSet;class D{static BASE=new D(a.Gx,a.Gy,r.ONE);static ZERO=new D(r.ZERO,r.ONE,r.ZERO);static Fp=r;static Fn=i;X;Y;Z;constructor(e,t,n){this.X=C(`x`,e),this.Y=C(`y`,t,!0),this.Z=C(`z`,n),Object.freeze(this)}static CURVE(){return a}static fromAffine(e){let{x:t,y:n}=e||{};if(!e||!r.isValid(t)||!r.isValid(n))throw Error(`invalid affine point`);if(e instanceof D)throw Error(`projective point not allowed`);return r.is0(t)&&r.is0(n)?D.ZERO:new D(t,n,r.ONE)}static fromBytes(e){let t=D.fromAffine(g(z(e,void 0,`point`)));return t.assertValidity(),t}static fromHex(e){return D.fromBytes(mo(e))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(e=6,t=!0){return ne.setWindowSize(this,e),t||this.multiply(Nc),this}assertValidity(){let e=this;if(e.is0()){if(t.allowInfinityPoint&&r.is0(e.X)&&r.eql(e.Y,r.ONE)&&r.is0(e.Z))return;throw Error(`bad point: ZERO`)}if(ee.has(e))return;let{x:n,y:i}=e.toAffine();if(!r.isValid(n)||!r.isValid(i))throw Error(`bad point: x or y not field elements`);if(!b(n,i))throw Error(`bad point: equation left != right`);if(!e.isTorsionFree())throw Error(`bad point: not in prime-order subgroup`);ee.add(e)}hasEvenY(){let{y:e}=this.toAffine();if(!r.isOdd)throw Error(`Field doesn't support isOdd`);return!r.isOdd(e)}equals(e){w(e);let{X:t,Y:n,Z:i}=this,{X:a,Y:o,Z:s}=e,c=r.eql(r.mul(t,s),r.mul(a,i)),l=r.eql(r.mul(n,s),r.mul(o,i));return c&&l}negate(){return new D(this.X,r.neg(this.Y),this.Z)}double(){let{X:e,Y:t,Z:n}=this,i=r.ZERO,a=r.ZERO,o=r.ZERO,s=r.mul(e,e),c=r.mul(t,t),l=r.mul(n,n),u=r.mul(e,t);return u=r.add(u,u),o=r.mul(e,n),o=r.add(o,o),i=v(o),a=r.mul(_,l),a=r.add(i,a),i=r.sub(c,a),a=r.add(c,a),a=r.mul(i,a),i=r.mul(u,i),o=r.mul(_,o),l=v(l),u=r.sub(s,l),u=v(u),u=r.add(u,o),o=r.add(s,s),s=r.add(o,s),s=r.add(s,l),s=r.mul(s,u),a=r.add(a,s),l=r.mul(t,n),l=r.add(l,l),s=r.mul(l,u),i=r.sub(i,s),o=r.mul(l,c),o=r.add(o,o),o=r.add(o,o),new D(i,a,o)}add(e){w(e);let{X:t,Y:n,Z:i}=this,{X:a,Y:o,Z:s}=e,c=r.ZERO,l=r.ZERO,u=r.ZERO,d=r.mul(t,a),f=r.mul(n,o),p=r.mul(i,s),m=r.add(t,n),h=r.add(a,o);m=r.mul(m,h),h=r.add(d,f),m=r.sub(m,h),h=r.add(t,i);let g=r.add(a,s);return h=r.mul(h,g),g=r.add(d,p),h=r.sub(h,g),g=r.add(n,i),c=r.add(o,s),g=r.mul(g,c),c=r.add(f,p),g=r.sub(g,c),u=v(h),c=r.mul(_,p),u=r.add(c,u),c=r.sub(f,u),u=r.add(f,u),l=r.mul(c,u),f=r.add(d,d),f=r.add(f,d),p=v(p),h=r.mul(_,h),f=r.add(f,p),p=r.sub(d,p),p=v(p),h=r.add(h,p),d=r.mul(f,h),l=r.add(l,d),d=r.mul(g,h),c=r.mul(m,c),c=r.sub(c,d),d=r.mul(m,f),u=r.mul(g,u),u=r.add(u,d),new D(c,l,u)}subtract(e){return w(e),this.add(e.negate())}is0(){return this.equals(D.ZERO)}multiply(e){if(!i.isValidNot0(e))throw RangeError(`invalid scalar: out of range`);let{p:t,f:n}=ne.mulSecret(this,e,o,te);return te([t,n])[0]}multiplyUnsafe(e){let t=this,n=e;if(!i.isValid(n))throw RangeError(`invalid scalar: out of range`);if(n===Ac||t.is0())return D.ZERO;if(n===jc)return t;if(ne.hasWindowSize(this))return ne.mulUnsafe(t,n,te);let r=[],a=[];return E(r,a,t,n),Ls(D,r,a)}mulAddUnsafe(e,t,n){w(t);let r=[],i=[];return E(r,i,this,e),E(r,i,t,n),Ls(D,r,i)}toAffine(e){let t=this,n=e;if(n!=null&&!r.isValid(n))throw RangeError(`"invertedZ" expected valid field element`);let{X:i,Y:a,Z:o}=t;if(r.eql(o,r.ONE))return{x:i,y:a};let s=t.is0();n??=s?r.ONE:r.inv(o);let c=r.mul(i,n),l=r.mul(a,n),u=r.mul(o,n);if(s)return{x:r.ZERO,y:r.ZERO};if(!r.eql(u,r.ONE))throw Error(`invZ was invalid`);return{x:c,y:l}}isTorsionFree(){let{isTorsionFree:e}=t;return o===jc?!0:e?e(D,this):ne.mulUnsafe(this,s).is0()}clearCofactor(){let{clearCofactor:e}=t;return o===jc?this:e?e(D,this):this.multiplyUnsafe(o)}isSmallOrder(){return o===jc?this.is0():this.clearCofactor().is0()}toBytes(e=!0){return bo(e,`isCompressed`),this.assertValidity(),h(D,this,e)}toHex(e=!0){return fo(this.toBytes(e))}toString(){return`<Point ${this.is0()?`ZERO`:this.toHex()}>`}}let te=e=>ws(D,e),ne=new Is(D,u);return ne.bits>=6&&D.BASE.precompute(6),Object.freeze(D.prototype),Object.freeze(D),D}function Ic(e){return Uint8Array.of(e?2:3)}function Lc(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function Rc(e,t={}){Cs(e);let{Fn:n}=e,r=t.randomBytes===void 0?go:t.randomBytes,i=Object.assign(Lc(e.Fp,n),{seed:Math.max(ms(n.ORDER),16)});function a(e){try{let t=n.fromBytes(e);return n.isValidNot0(t)}catch{return!1}}function o(t,n){let{publicKey:r,publicKeyUncompressed:a}=i;try{let i=t.length;return n===!0&&i!==r||n===!1&&i!==a?!1:!!e.fromBytes(t)}catch{return!1}}function s(e){return e=e===void 0?r(i.seed):e,hs(z(e,i.seed,`seed`),n.ORDER)}function c(t,r=!0){return e.BASE.multiply(n.fromBytes(t)).toBytes(r)}function l(e){let{secretKey:t,publicKey:r,publicKeyUncompressed:a}=i,o=n._lengths;if(!ho(e))return;let s=z(e,void 0,`key`).length,c=s===r||s===a,l=s===t||!!o?.includes(s);if(!(c&&l))return c}function u(t,r,i=!0){if(l(t)===!0)throw Error(`first arg must be private key`);if(l(r)===!1)throw Error(`second arg must be public key`);let a=n.fromBytes(t);return e.fromBytes(r).multiply(a).toBytes(i)}let d={isValidSecretKey:a,isValidPublicKey:o,randomSecretKey:s},f=Bs(s,c);return Object.freeze(d),Object.freeze(i),Object.freeze({getPublicKey:c,getSharedSecret:u,keygen:f,Point:e,utils:d,lengths:i})}function zc(e,t,n={}){Cs(e);let r=t;Gn(r),Io(n,{},{hmac:`function`,lowS:`boolean`,randomBytes:`function`,bits2int:`function`,bits2int_modN:`function`});let i=Object.assign({},n),a=i.randomBytes===void 0?go:i.randomBytes,o=i.hmac===void 0?(e,t)=>Sc(r,e,t):i.hmac,{Fp:s,Fn:c}=e,{ORDER:l,BITS:u}=c,d=ms(l),f=Ds(a,d),{keygen:p,getPublicKey:m,getSharedSecret:h,utils:g,lengths:_}=Rc(e,i),v={prehash:!0,lowS:typeof i.lowS!=`boolean`||i.lowS,format:`compact`,extraEntropy:!1},y=l*Mc+jc<s.ORDER;function b(e){return e>l>>jc}function x(e,t){if(!c.isValidNot0(t))throw Error(`invalid signature ${e}: out of range 1..Point.Fn.ORDER`);return t}function S(){if(!s.isOdd)throw Error(`Field doesn't support isOdd`)}function C(e,t,n){return S(),(e===n?0:2)|Number(s.isOdd(t))}function w(){if(y)throw Error(`"recovered" sig type is not supported for cofactor >2 curves`)}function T(e,t){Oc(t);let n=_.signature;return z(e,t===`compact`?n:t===`recovered`?n+1:void 0)}class E{r;s;recovery;constructor(e,t,n){if(this.r=x(`r`,e),this.s=x(`s`,t),n!=null){if(w(),![0,1,2,3].includes(n))throw Error(`invalid recovery id`);this.recovery=n}Object.freeze(this)}static fromBytes(e,t=v.format){T(e,t);let n;if(t===`der`){let{r:t,s:n}=Tc.toSig(z(e));return new E(t,n)}t===`recovered`&&(n=e[0],t=`compact`,e=e.subarray(1));let r=_.signature/2,i=e.subarray(0,r),a=e.subarray(r,r*2);return new E(c.fromBytes(i),c.fromBytes(a),n)}static fromHex(e,t){return this.fromBytes(mo(e),t)}assertRecovery(){let{recovery:e}=this;if(e==null)throw Error(`invalid recovery id: must be present`);return e}addRecoveryBit(e){return new E(this.r,this.s,e)}recoverPublicKey(t){let{r:n,s:r}=this,i=this.assertRecovery(),a=i===2||i===3?n+l:n;if(!s.isValid(a))throw Error(`invalid recovery id: sig.r+curve.n != R.x`);let o=s.toBytes(a),u=e.fromBytes(po(Ic(!(i&1)),o)),d=c.inv(a),f=D(z(t,void 0,`msgHash`)),p=c.create(-f*d),m=c.create(r*d),h=e.BASE.mulAddUnsafe(p,u,m);if(h.is0())throw Error(`invalid recovery: point at infinify`);return h.assertValidity(),h}hasHighS(){return b(this.s)}toBytes(e=v.format){if(Oc(e),e===`der`)return mo(Tc.hexFromSig(this));let{r:t,s:n}=this,r=c.toBytes(t),i=c.toBytes(n);return e===`recovered`?(w(),po(Uint8Array.of(this.assertRecovery()),r,i)):po(r,i)}toHex(e){return fo(this.toBytes(e))}}Object.freeze(E.prototype),Object.freeze(E);let ee=i.bits2int===void 0?function(e){if(e.length>8192)throw Error(`input is too large`);let t=To(e),n=e.length*8-u;return n>0?t>>BigInt(n):t}:i.bits2int,D=i.bits2int_modN===void 0?function(e){return c.create(ee(e))}:i.bits2int_modN,te=Po(u);function ne(e){return Mo(`num < 2^`+u,e,Ac,te),c.toBytes(e)}function re(e,t){return z(e,void 0,`message`),t?z(r(e),void 0,`prehashed message`):e}function ie(t,n,r){let{lowS:i,prehash:o,extraEntropy:s}=kc(r,v);t=re(t,o);let u=D(t),p=c.fromBytes(n);if(!c.isValidNot0(p))throw Error(`invalid private key`);let m=[ne(p),ne(u)];if(s!=null&&s!==!1){let e=s===!0?a(_.secretKey):s;m.push(z(e,void 0,`extraEntropy`))}let h=po(...m),g=u;function x(t){let n=ee(t);if(!c.isValidNot0(n))return;let r=e.BASE.multiply(n).toAffine(),a=c.create(r.x);if(a===Ac)return;let o;if(f!==void 0){let e=To(hs(f(d),l)),t=c.inv(c.mul(e,n)),r=c.mul(e,g),i=c.mul(e,p);o=c.create(t*c.create(r+i*a))}else{let e=Xo(n,l);o=c.create(e*c.create(g+a*p))}if(o===Ac)return;let s=C(r.x,r.y,a),u=o;return i&&b(o)&&(u=c.neg(o),s^=1),new E(a,u,y?void 0:s)}return{seed:h,k2sig:x}}function ae(e,t,n={}){let{seed:i,k2sig:a}=ie(e,t,n);return Fo(r.outputLen,c.BYTES,o)(i,a).toBytes(n.format)}function oe(t,n,r,i={}){let{lowS:a,prehash:o,format:s}=kc(i,v);if(r=z(r,void 0,`publicKey`),n=re(n,o),!ho(t)){let e=t instanceof E?`, use sig.toBytes()`:``;throw Error(`verify expects Uint8Array signature`+e)}T(t,s);try{let i=E.fromBytes(t,s),o=e.fromBytes(r);if(a&&i.hasHighS())return!1;let{r:l,s:u}=i,d=D(n),f=c.inv(u),p=c.create(d*f),m=c.create(l*f),h=e.BASE.mulAddUnsafe(p,o,m);if(h.is0())return!1;let g=h.toAffine();return!(c.create(g.x)!==l||s===`recovered`&&i.recovery!==C(g.x,g.y,l))}catch{return!1}}function se(e,t,n={}){let{prehash:r}=kc(n,v);return t=re(t,r),E.fromBytes(e,`recovered`).recoverPublicKey(t).toBytes()}return Object.freeze({keygen:p,getPublicKey:m,getSharedSecret:h,utils:g,lengths:_,Point:e,sign:ae,verify:oe,recoverPublicKey:se,Signature:E,hash:r})}var Bc=zc(Fc({p:BigInt(`0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff`),n:BigInt(`0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551`),h:BigInt(1),a:BigInt(`0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc`),b:BigInt(`0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b`),Gx:BigInt(`0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296`),Gy:BigInt(`0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5`)}),Tr),Vc=class extends Error{code=`invalid_relay_e2ee_input`;constructor(){super(`Relay E2EE input is invalid.`),this.name=`RelayE2eeValidationError`}};function U(){throw new Vc}var Hc=`ryco.node-key.v1`,Uc=`ryco.client-key.v1`,Wc=`ryco.e2ee-agreement-key.v1`,Gc=`ed25519`,Kc=`p256`,qc=`x25519`,Jc={"node-identity":Hc,"client-identity":Uc,agreement:Wc},Yc={"node-identity":Gc,"client-identity":Kc,agreement:qc};function Xc(e,t){return(!(e instanceof Uint8Array)||e.byteLength!==t)&&U(),Uint8Array.from(e)}function Zc(e){let t=0n;for(let n=0;n<e.byteLength;n+=1)t=t<<8n|BigInt(e[n]);return t}function Qc(e){let t=Xc(e,32);return yc.utils.isValidPublicKey(t,!1)||U(),t}function $c(e){let t=Xc(e,65);t[0]!==4&&U();let n=Bc.Point.Fp.ORDER,r=Zc(t.subarray(1,33)),i=Zc(t.subarray(33));(r>=n||i>=n)&&U();try{Bc.Point.fromBytes(t).is0()&&U()}catch{return U()}return t}function el(e){return Xc(e,32)}function tl(e,t){switch(e){case`node-identity`:return Qc(t);case`client-identity`:return $c(t);case`agreement`:return el(t);default:return U()}}function nl(e){return Xc(e,64)}function rl(e){let t=Xc(e,64),n=Bc.Point.Fn.ORDER,r=Zc(t.subarray(0,32)),i=Zc(t.subarray(32));return(r<1n||r>=n||i<1n||i>=n)&&U(),t}function il(e,t){let n=tl(e,t);return Tr(Ja([Jc[e],Yc[e],n],va))}function al(e,t){if(!(e instanceof Uint8Array)||!(t instanceof Uint8Array)||e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.byteLength;n+=1)if(e[n]!==t[n])return!1;return!0}function ol(e){try{if(e.algorithm===`ed25519`){let t=Qc(e.publicKey),n=nl(e.signature);return yc.verify(n,e.message,t,{zip215:!1})}if(e.algorithm===`p256`){let t=$c(e.publicKey),n=rl(e.signature);return Bc.verify(n,Tr(e.message),t,{prehash:!1,lowS:!1,format:`compact`})}return!1}catch{return!1}}function sl(e){return e===1}function cl(e){return e===`c2n`||e===`n2c`}function ll(e){return e===1||e===2||e===3||e===4}function ul(e){return e===1||e===2||e===3}function dl(e){switch(e){case 1:return{maxBytes:en,exact:!1};case 2:return{maxBytes:tn,exact:!1};case 3:return{maxBytes:64,exact:!0}}}var fl=123,pl=91,ml=Object.freeze({kind:`envelope`}),hl=Object.freeze({kind:`negotiation`}),gl=Object.freeze({kind:`legacy-json`}),_l=Object.freeze({kind:`other`,reason:`empty`}),vl=Object.freeze({kind:`other`,reason:`unknown_discriminator`});function yl(e){if(e.byteLength===0)return _l;let t=e[0];return t===1?ml:t===2?hl:t===fl||t===pl?gl:vl}var bl=1,xl=2,Sl=3,Cl=7,wl=17;function Tl(e,t){if(typeof e!=`bigint`||e<0n||e>4294967295n)throw TypeError(`E2EE envelope epoch must be a bigint within the uint32 field range.`);if(typeof t!=`bigint`||t<0n||t>18446744073709551615n)throw TypeError(`E2EE envelope counter must be a bigint within the uint64 field range.`)}function El(e,t,n,r){let i=r;for(let r=n-1;r>=0;--r)e[t+r]=Number(i&255n),i>>=8n}function Dl(e,t,n){let r=0n;for(let i=0;i<n;i+=1)r=r<<8n|BigInt(e[t+i]);return r}function Ol(e,t){if(!sl(t.suite))throw TypeError(`E2EE envelope suite must be a registered suite id.`);Tl(t.epoch,t.counter),e[0]=1,e[bl]=1,e[xl]=t.suite,El(e,Sl,4,t.epoch),El(e,Cl,8,t.counter)}function kl(e){let t=new Uint8Array(15);return Ol(t,e),t}function Al(e){if(e.ciphertext.byteLength<wl)throw TypeError(`E2EE envelope ciphertext must cover the inner type byte and the tag.`);let t=new Uint8Array(15+e.ciphertext.byteLength);return Ol(t,e),t.set(e.ciphertext,15),t}function jl(e){if(e.byteLength===0||e[0]!==1)return{kind:`error`,reason:`bad_discriminator`};if(e.byteLength<32)return{kind:`error`,reason:`truncated`};if(e[bl]!==1)return{kind:`error`,reason:`unsupported_version`};let t=e[xl];return sl(t)?{kind:`ok`,value:{version:1,suite:t,epoch:Dl(e,Sl,4),counter:Dl(e,Cl,8),header:e.subarray(0,15),ciphertext:e.subarray(15)}}:{kind:`error`,reason:`unsupported_suite`}}function Ml(e,t){Tl(e,t);let n=new Uint8Array(12);return El(n,0,4,e),El(n,4,8,t),n}function Nl(e){if(e.byteLength!==15)throw TypeError(`E2EE AEAD nonce requires the exact envelope header.`);return e.subarray(Sl,15)}function Pl(e){if(e.header.byteLength!==15)throw TypeError(`E2EE AAD requires the exact envelope header.`);if(e.sessionBindingHash.byteLength!==32)throw TypeError(`E2EE AAD requires a full-length session binding hash.`);let t=new Uint8Array(50);return t.set(e.header),t.set(e.sessionBindingHash,15),t.set(Fl(e.direction),47),t}function Fl(e){if(!cl(e))throw TypeError(`E2EE direction must be a registered direction label.`);let t=new Uint8Array(3);for(let n=0;n<3;n+=1)t[n]=e.charCodeAt(n);return t}function Il(e,t){if(!ll(e))throw TypeError(`E2EE inner record type must be a registered type.`);let n=new Uint8Array(1+t.byteLength);return n[0]=e,n.set(t,1),n}function Ll(e){if(e.byteLength<1)return{kind:`error`,reason:`truncated`};let t=e[0];return ll(t)?{kind:`ok`,value:{innerType:t,body:e.subarray(1)}}:{kind:`error`,reason:`reserved_inner_type`}}var Rl=2,zl=Ja(new Uint8Array(60),va);function Bl(e,t){if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.byteLength;n+=1)if(e[n]!==t[n])return!1;return!0}function Vl(e,t){if(!ul(e))throw TypeError(`E2EE negotiation record type must be a registered type.`);let n=Rl+t.byteLength,r=dl(e);if(r.exact?n!==r.maxBytes:n>r.maxBytes)throw RangeError(`E2EE negotiation record exceeds the bound its type fixes.`);if(e===3&&!Bl(t,zl))throw TypeError(`E2EE handshake reject records are byte-identical; this body is not.`);let i=new Uint8Array(n);return i[0]=2,i[1]=e,i.set(t,Rl),i}function Hl(e){if(e.byteLength===0||e[0]!==2)return{kind:`error`,reason:`bad_discriminator`};if(e.byteLength<Rl)return{kind:`error`,reason:`truncated`};let t=e[1];if(!ul(t))return{kind:`error`,reason:`reserved_record_type`};let n=dl(t);if(e.byteLength>n.maxBytes)return{kind:`error`,reason:`too_large`};if(n.exact&&e.byteLength!==n.maxBytes)return{kind:`error`,reason:`length_mismatch`};let r=e.subarray(Rl);return t===3&&!Bl(r,zl)?{kind:`error`,reason:`non_canonical_reject`}:{kind:`ok`,value:{recordType:t,body:r}}}var Ul=[`_tag`,`statement`],Wl=new TextDecoder,Gl=new TextEncoder;function Kl(e){if(e.byteLength===0||e[0]!==fl)return{kind:`error`,reason:`not_carrier`};let t;try{t=JSON.parse(Wl.decode(e))}catch{return{kind:`error`,reason:`not_carrier`}}if(typeof t!=`object`||!t||Array.isArray(t))return{kind:`error`,reason:`not_carrier`};let n=t;if(n._tag!==`ryco.e2ee.capability.v1`)return{kind:`error`,reason:`not_carrier`};if(e.byteLength>6969)return{kind:`error`,reason:`malformed`};let r=Object.keys(n);if(r.length!==Ul.length||Ul.some((e,t)=>r[t]!==e))return{kind:`error`,reason:`malformed`};let i=n.statement;if(typeof i!=`string`||i.length===0||!Bl(Gl.encode(JSON.stringify({_tag:`ryco.e2ee.capability.v1`,statement:i})),e))return{kind:`error`,reason:`malformed`};let a=Jl(i);return a===void 0?{kind:`error`,reason:`malformed`}:{kind:`ok`,value:a}}var ql=new Map([...`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`].map((e,t)=>[e,t]));function Jl(e){if(e.length%4==1)return;let t=new Uint8Array(Math.floor(e.length*3/4)),n=0,r=0,i=0;for(let a of e){let e=ql.get(a);if(e===void 0)return;n=n<<6|e,r+=6,r>=8&&(r-=8,t[i]=n>>r&255,n&=(1<<r)-1,i+=1)}if(!(r>0&&n&(1<<r)-1))return t}var Yl=`ryco.node-e2ee-prekey.v1`,Xl=`ryco.node-e2ee-capability-digest.v1`,Zl=`ryco.relay-e2ee.context.v1`,Ql=`ryco.relay-e2ee.prologue.v1`,$l=`25519`,eu=`SHA256`;function tu(e){return e===`native`?`IK`:`NX`}function nu(e){return e?[`IK`]:[`IK`,`NX`]}var ru={allowIndefinite:!1,allowUndefined:!1,allowInfinity:!1,allowNaN:!1,allowBigInt:!1,strict:!0,useMaps:!0,rejectDuplicateMapKeys:!0,tags:{}};function iu(e){let t=new Xa(e,ru);for(;!t.done();)if(j.equals(t.next().type,j.float))return!0;return!1}function au(e){if(!(e instanceof Uint8Array)||e.byteLength===0)return{kind:`error`,reason:`malformed`};let t;try{t=ao(e,ru)}catch{return{kind:`error`,reason:`malformed`}}if(iu(e))return{kind:`error`,reason:`float_forbidden`};let n;try{n=Ja(t,va)}catch{return{kind:`error`,reason:`non_canonical`}}return al(n,e)?{kind:`ok`,value:t}:{kind:`error`,reason:`non_canonical`}}function ou(e){return Uint8Array.from(Ja(e,va))}var su=`[A-Za-z0-9_-]{22}`,cu=RegExp(`^node_${su}$`),lu=RegExp(`^nkey_${su}$`),uu=RegExp(`^epk_${su}$`),du=RegExp(`^nct_${su}$`),fu=new Set([`localhost`,`127.0.0.1`,`[::1]`]),pu=new TextEncoder,mu=d(l),hu=d(lt),gu=d(ce);function _u(e,t){return(typeof e!=`string`||!t.test(e))&&U(),e}function vu(e){return(!Number.isSafeInteger(e)||e<0)&&U(),e}function yu(e){return(!Number.isSafeInteger(e)||e<0||e>65535)&&U(),e}function bu(e){(typeof e!=`string`||e.length===0||e.length>512)&&U();let t;try{t=new URL(e)}catch{return U()}let n=t.protocol===`http:`&&fu.has(t.hostname);return(t.protocol!==`https:`&&!n||t.username!==``||t.password!==``||t.pathname!==`/`||t.search!==``||t.hash!==``||e!==t.origin)&&U(),pu.encode(t.origin).byteLength>128&&U(),t.origin}function xu(e){(typeof e!=`string`||e.length===0)&&U();let t=pu.encode(e).byteLength;return(t===0||t>256)&&U(),e}function Su(e){return Ee(mu(e))&&U(),e}function Cu(e){return Ee(hu(e))&&U(),e}function wu(e){return Ee(gu(e))&&U(),e}function Tu(e){return sl(e)||U(),e}function Eu(e){return(!(e instanceof Uint8Array)||e.byteLength!==32)&&U(),Uint8Array.from(e)}function Du(e){return e.byteLength>1024&&U(),e}function Ou(e,t){let n=bu(e.hubOrigin),r=_u(e.nodeId,cu),i=_u(e.identityKeyId,lu),a=_u(e.prekeyId,uu),o=Qc(e.identityPublicKey);return Du(ou([Yl,n,r,Gc,i,a,o,t===void 0?il(`node-identity`,o):Eu(t),el(e.agreementPublicKey),$l,eu,vu(e.createdAt),vu(e.expiresAt)]))}var ku=13;function Au(e){return typeof e==`string`}function ju(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function Mu(e,t){return e instanceof Uint8Array&&e.byteLength===t}function Nu(e){let t=au(e);if(t.kind===`error`)return t;let n=t.value;if(!Array.isArray(n)||n.length!==ku)return{kind:`error`,reason:`malformed`};let[r,i,a,o,s,c,l,u,d,f,p,m,h]=n;if(r!==`ryco.node-identity-continuity.v1`||s!==`ed25519`||d!==`ed25519`||!Au(i)||!Au(a)||!ju(o)||!Au(c)||!Au(f)||!Mu(l,32)||!Mu(u,32)||!Mu(p,32)||!Mu(m,32)||!ju(h)||!lu.test(c)||!lu.test(f)||!du.test(a)||o<1)return{kind:`error`,reason:`malformed`};let g,_;try{g=il(`node-identity`,l),_=il(`node-identity`,p)}catch{return{kind:`error`,reason:`malformed`}}return!al(g,u)||!al(_,m)?{kind:`error`,reason:`malformed`}:{kind:`ok`,value:{hubOrigin:i,continuityId:a,generation:o,oldKeyId:c,oldPublicKey:l,oldFingerprint:u,newKeyId:f,newPublicKey:p,newFingerprint:m,createdAt:h}}}function Pu(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.transcript instanceof Uint8Array&&t.signature instanceof Uint8Array&&t.signature.byteLength===64}function Fu(e){if(!Array.isArray(e.chain))return{kind:`error`,failure:`malformed_entry`};if(e.chain.length>8)return{kind:`error`,failure:`chain_too_long`};let t,n;try{t=Qc(e.identityPublicKey),n=il(`node-identity`,t)}catch{return{kind:`error`,failure:`invalid_identity_key`}}let r=[],i;for(let t of e.chain){if(!Pu(t))return{kind:`error`,failure:`malformed_entry`};let n=Nu(t.transcript);if(n.kind===`error`)return{kind:`error`,failure:`malformed_entry`};let a=n.value;if(a.hubOrigin!==e.hubOrigin)return{kind:`error`,failure:`hub_origin_mismatch`};if(a.continuityId!==e.continuityId)return{kind:`error`,failure:`continuity_id_mismatch`};if(i!==void 0){if(a.generation!==i.generation+1)return{kind:`error`,failure:`generation_not_consecutive`};if(!al(a.oldPublicKey,i.newPublicKey)||!al(a.oldFingerprint,i.newFingerprint))return{kind:`error`,failure:`link_mismatch`}}if(!ol({algorithm:`ed25519`,publicKey:a.oldPublicKey,message:t.transcript,signature:t.signature}))return{kind:`error`,failure:`invalid_signature`};r.push(a),i=a}if(i!==void 0&&!al(i.newPublicKey,t))return{kind:`error`,failure:`identity_key_mismatch`};let a=e.pinnedIdentityFingerprint;return a===void 0?{kind:`ok`,certificates:r}:al(a,n)?{kind:`ok`,certificates:r,pinnedFingerprintUnchanged:!0}:r.some(e=>al(e.oldFingerprint,a))?{kind:`ok`,certificates:r,pinnedFingerprintUnchanged:!1}:{kind:`error`,failure:`pin_not_reached`}}var Iu=2,Lu=19,Ru=6,zu=2,Bu=255;function Vu(e){return e===`non_canonical`?`statement_non_canonical`:e===`float_forbidden`?`statement_float_forbidden`:`statement_malformed`}function Hu(e){return e===`non_canonical`?`transcript_non_canonical`:e===`float_forbidden`?`transcript_float_forbidden`:`transcript_malformed`}function W(e){return{kind:`error`,failure:e}}function Uu(e){return ju(e)&&e<=65535}function Wu(e){if(!Array.isArray(e)||e.length!==Ru)return;let[t,n,r,i,a,o]=e;if(!(!Au(t)||!uu.test(t)||!Mu(n,32)||!Mu(r,64)||!Mu(i,32)||!ju(a)||!ju(o)))return{prekeyId:t,agreementPublicKey:n,crossSignature:r,agreementFingerprint:i,createdAt:a,expiresAt:o}}function Gu(e){if(!Array.isArray(e)||e.length!==zu)return;let[t,n]=e;if(!(!(t instanceof Uint8Array)||t.byteLength===0||t.byteLength>1024||!Mu(n,64)))return{transcript:t,signature:n}}function Ku(e){if(!(e instanceof Uint8Array))return W(`statement_malformed`);if(e.byteLength>5190)return W(`statement_too_large`);let t=au(e);if(t.kind===`error`)return W(Vu(t.reason));if(!Array.isArray(t.value)||t.value.length!==Iu)return W(`statement_malformed`);let[n,r]=t.value;if(!(n instanceof Uint8Array)||n.byteLength===0)return W(`statement_malformed`);if(n.byteLength>5120)return W(`transcript_too_large`);if(!Mu(r,64))return W(`statement_malformed`);let i=au(n);if(i.kind===`error`)return W(Hu(i.reason));if(!Array.isArray(i.value)||i.value.length!==Lu)return W(`transcript_malformed`);let[a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C]=i.value;if(a!==`ryco.node-e2ee-capability.v1`||c!==`ed25519`||!Au(o)||!Au(s)||!cu.test(s)||!Au(l)||!lu.test(l)||!Mu(u,32)||!Mu(d,32)||!Uu(f)||!Uu(p)||typeof _!=`boolean`||typeof v!=`boolean`||!ju(b)||!ju(x)||!ju(S)||!Au(C)||!du.test(C))return W(`transcript_malformed`);if(pu.encode(o).byteLength>128)return W(`hub_origin_too_long`);try{bu(o)}catch{return W(`transcript_malformed`)}if(!Array.isArray(m)||m.length===0)return W(`transcript_malformed`);if(m.length>8)return W(`suite_registry_too_large`);if(!m.every(e=>ju(e)&&e<=Bu)||!Array.isArray(g))return W(`transcript_malformed`);if(g.length>8)return W(`continuity_chain_too_long`);let w=[];for(let e of g){let t=Gu(e);if(t===void 0)return W(`transcript_malformed`);w.push(t)}let T=Wu(h);if(T===void 0)return W(`transcript_malformed`);let E=nu(v);return!Array.isArray(y)||y.length!==E.length||!E.every((e,t)=>y[t]===e)?W(`transcript_malformed`):{kind:`ok`,value:{transcript:n,signature:r,hubOrigin:o,nodeId:s,identityKeyId:l,identityPublicKey:u,identityFingerprint:d,e2eeVersionMin:f,e2eeVersionMax:p,suiteRegistry:m,prekeyCertificate:T,continuityChain:w,requireE2EE:_,requireApprovedClientE2EE:v,admittedPatterns:E,policyGeneration:b,issuedAt:x,expiresAt:S,continuityId:C}}}function qu(e){(!(e instanceof Uint8Array)||e.byteLength===0||e.byteLength>5120)&&U();let t=Tr(e);t.byteLength!==32&&U();let n=ou([Xl,t]);return n.byteLength!==72&&U(),n}function Ju(e){let t=bu(e.hubOrigin),n=wu(e.channelId),r=yu(e.relayProtocolMajor),i=yu(e.relayProtocolMinor);e.e2eeVersion!==1&&U();let a=Tu(e.suiteId),o=_u(e.nodeId,cu),s=Eu(e.nodeIdentityFingerprint),c=Su(e.clientIntendedCapability),l=Cu(e.clientIntendedRole),u=Su(e.channelOpenCapability),d=Cu(e.channelOpenEffectiveRole),f=_u(e.nodeContinuityId,du);(!Array.isArray(e.nodeContinuityChainTranscripts)||e.nodeContinuityChainTranscripts.length>8)&&U();let p=[Eu(e.nodeAgreementFingerprint)];for(let t of e.nodeContinuityChainTranscripts)(!(t instanceof Uint8Array)||t.byteLength===0)&&U(),p.push(Tr(t));return ou([Zl,t,n,r,i,1,a,o,Gc,s,e.client.tier===`native`?xu(e.client.accountId):``,c,l,u,d,p,e.client.tier===`native`?[Eu(e.client.identityFingerprint),Eu(e.client.agreementFingerprint)]:[],f])}function Yu(e){(!(e instanceof Uint8Array)||e.byteLength===0)&&U();let t=Tr(e);return t.byteLength!==32&&U(),t}function Xu(e){let t=bu(e.hubOrigin),n=wu(e.channelId),r=yu(e.relayProtocolMajor),i=yu(e.relayProtocolMinor);e.e2eeVersion!==1&&U();let a=Tu(e.suiteId),o=_u(e.nodeId,cu);return(!(e.contextCommitment instanceof Uint8Array)||e.contextCommitment.byteLength!==32)&&U(),ou([Ql,t,n,r,i,1,a,o,Uint8Array.from(e.contextCommitment)])}function Zu(e){let t;try{if(t=Ou({hubOrigin:e.hubOrigin,nodeId:e.nodeId,identityKeyId:e.identityKeyId,prekeyId:e.prekeyCertificate.prekeyId,identityPublicKey:e.identityPublicKey,agreementPublicKey:e.prekeyCertificate.agreementPublicKey,createdAt:e.prekeyCertificate.createdAt,expiresAt:e.prekeyCertificate.expiresAt},e.identityFingerprint),!al(il(`node-identity`,e.identityPublicKey),e.identityFingerprint)||!al(il(`agreement`,e.prekeyCertificate.agreementPublicKey),e.prekeyCertificate.agreementFingerprint))return!1}catch{return!1}return ol({algorithm:Gc,publicKey:e.identityPublicKey,message:t,signature:e.prekeyCertificate.crossSignature})}var Qu={[$e.read]:`viewer`,[$e.subscribeEvents]:`viewer`,[$e.lifecycle]:`owner`,[$e.input]:`owner`,[$e.app]:`owner`,[$e.recording]:`owner`,[k.acceptProposal]:`owner`,[k.getProposal]:`owner`,[k.listProposals]:`owner`,[k.rejectProposal]:`owner`,[k.subscribeProposals]:`owner`,[k.listIntegrations]:`owner`,[k.createIntegration]:`owner`,[k.updateIntegration]:`owner`,[k.resumeIntegrationPairing]:`owner`,[k.revokeIntegration]:`owner`,[k.deleteIntegration]:`owner`,[k.listMcpInstallations]:`owner`,[k.connectMcpInstallation]:`owner`,[k.repairMcpInstallation]:`owner`,[k.disconnectMcpInstallation]:`owner`,[A.atlassianDisconnect]:`owner`,[A.atlassianGetProjectLink]:`owner`,[A.atlassianListConnections]:`owner`,[A.atlassianListResources]:`owner`,[A.atlassianRefresh]:`owner`,[A.atlassianSaveManualBitbucketToken]:`owner`,[A.atlassianSaveManualJiraToken]:`owner`,[A.atlassianSaveProjectLink]:`owner`,[A.atlassianStartOAuth]:`owner`,[A.filesystemBrowse]:`operator`,[A.gitArchiveWorktree]:`operator`,[A.gitCreateWorktreeForProject]:`operator`,[A.gitDeleteWorktree]:`operator`,[A.gitFindWorktreeForOrigin]:`operator`,[A.gitPreparePullRequestThread]:`operator`,[A.gitResolvePullRequest]:`operator`,[A.gitRestoreWorktree]:`operator`,[A.gitRunStackedAction]:`operator`,[A.keybindingsReplaceCustom]:`owner`,[A.mcpListServers]:`owner`,[A.mcpListWorkspaces]:`owner`,[A.mcpReloadServers]:`owner`,[A.mcpRemoveServer]:`owner`,[A.mcpSetServerEnabled]:`owner`,[A.mcpStartOauthLogin]:`owner`,[A.mcpUpsertServer]:`owner`,[O.dispatchCommand]:`operator`,[O.getFullThreadDiff]:`viewer`,[O.getTurnDiff]:`viewer`,[O.getTaskOutput]:`operator`,[O.getThreadHistoryPage]:`viewer`,[O.getThreadWindow]:`viewer`,[O.getWorkflowScript]:`operator`,[O.stopBackgroundTask]:`operator`,[O.replayEvents]:`viewer`,[O.replayEventsPage]:`viewer`,[O.searchThreadMessages]:`viewer`,[O.subscribeShell]:`viewer`,[O.subscribeThread]:`viewer`,[O.subscribeThreadWindow]:`viewer`,[x.getInspectionSummary]:`viewer`,[x.listInspectionEntries]:`viewer`,[x.readRawPayloadChunk]:`viewer`,[x.readExportChunk]:`viewer`,[A.projectsAdd]:`operator`,[A.projectsInitializeGit]:`operator`,[A.projectsList]:`viewer`,[A.projectsListEntries]:`operator`,[A.projectsReadFile]:`operator`,[A.projectsReadFileBinary]:`operator`,[A.projectsRemove]:`operator`,[A.projectsSearchEntries]:`operator`,[A.projectsStageFileReference]:`operator`,[A.projectsWriteFile]:`operator`,[A.serverCheckOpinionatedPlugins]:`owner`,[A.serverDiscoverSourceControl]:`owner`,[A.serverGetAdvertisedEndpoints]:`viewer`,[A.serverGetConfig]:`viewer`,[A.serverGetDiagnosticsMetrics]:`owner`,[A.serverGetDiagnosticsSnapshot]:`owner`,[A.serverGetSettings]:`viewer`,[A.serverGetStatistics]:`owner`,[A.serverGetUsageSummary]:`owner`,[A.serverInstallOpinionatedPlugin]:`owner`,[A.serverListOpinionatedPlugins]:`owner`,[A.serverRefreshProviders]:`owner`,[A.serverUpdateProvider]:`owner`,[A.serverUpdateSettings]:`owner`,[A.serverUpsertKeybinding]:`owner`,[A.shellOpenInEditor]:`operator`,[A.sourceControlAddChangeRequestComment]:`operator`,[A.sourceControlAddChangeRequestCommentReaction]:`operator`,[A.sourceControlAddIssueComment]:`operator`,[A.sourceControlAddIssueCommentReaction]:`operator`,[A.sourceControlCloneRepository]:`operator`,[A.sourceControlCreateIssue]:`operator`,[A.sourceControlGetChangeRequestDetail]:`operator`,[A.sourceControlGetChangeRequestDiff]:`operator`,[A.sourceControlGetIssue]:`operator`,[A.sourceControlGetWorkflowJobLog]:`operator`,[A.sourceControlGetWorkflowRunJobs]:`operator`,[A.sourceControlListChangeRequests]:`operator`,[A.sourceControlListIssueAssignees]:`operator`,[A.sourceControlListIssueLabels]:`operator`,[A.sourceControlListIssues]:`operator`,[A.sourceControlListWorkflowRuns]:`operator`,[A.sourceControlLookupRepository]:`operator`,[A.sourceControlMergeChangeRequest]:`operator`,[A.sourceControlPublishRepository]:`operator`,[A.sourceControlRerunWorkflow]:`operator`,[A.sourceControlSearchChangeRequests]:`operator`,[A.sourceControlSearchIssues]:`operator`,[A.sourceControlSearchRepositories]:`operator`,[A.subscribeAuthAccess]:`direct_owner`,[A.subscribeServerConfig]:`viewer`,[A.subscribeServerLifecycle]:`viewer`,[A.subscribeTerminalEvents]:`operator`,[A.subscribeVcsStatus]:`operator`,[A.terminalClear]:`operator`,[A.terminalClose]:`operator`,[A.terminalOpen]:`operator`,[A.terminalResize]:`operator`,[A.terminalRestart]:`operator`,[A.terminalWrite]:`operator`,[A.textGenerationGenerateBranchName]:`operator`,[A.textGenerationGenerateIssueContent]:`operator`,[A.threadPriorityEnsureCurrent]:`operator`,[A.searchThreadMessages]:`owner`,[A.threadsSetManualBucket]:`operator`,[A.threadsSetManualPosition]:`operator`,[A.vcsCreateRef]:`operator`,[A.vcsCreateWorktree]:`operator`,[A.vcsInit]:`operator`,[A.vcsListRefs]:`operator`,[A.vcsPull]:`operator`,[A.vcsRefreshStatus]:`operator`,[A.vcsRemoveWorktree]:`operator`,[A.vcsSwitchRef]:`operator`,[A.workItemsAddComment]:`operator`,[A.workItemsEditComment]:`operator`,[A.workItemsGet]:`viewer`,[A.workItemsList]:`viewer`,[A.workItemsListProjects]:`viewer`,[A.workItemsListTransitions]:`viewer`,[A.workItemsSearch]:`viewer`,[A.workItemsTransition]:`operator`,[A.workItemsUpdate]:`operator`,[A.worktreesSetManualPosition]:`operator`};function $u(e){if(!Object.hasOwn(Qu,e))throw Error(`RPC method has no explicit access classification.`);return Qu[e]}var ed={viewer:1,operator:2,owner:3};function td(e,t,n=!0){if(!e||!n)return!1;let r=$u(t);return r===`authenticated`||r===`direct_owner`?!1:ed[e]>=ed[r]}var nd=new Set([`ble`,`cable`,`hybrid`,`internal`,`nfc`,`smart-card`,`usb`]);function G(){throw Error(`Invalid passkey options.`)}function rd(e){return(typeof e!=`object`||!e||Array.isArray(e))&&G(),e}function id(e){return(typeof e!=`string`||e.length===0)&&G(),e}function ad(e){if(e!==void 0)return(typeof e!=`number`||!Number.isSafeInteger(e)||e<0)&&G(),e}function od(e){try{return Ht(id(e))}catch{return G()}}function sd(e){if(e!==void 0)return Array.isArray(e)||G(),e.map(e=>{let t=rd(e);t.type!==`public-key`&&G();let n=t.transports;return n!==void 0&&!Array.isArray(n)&&G(),Array.isArray(n)&&n.some(e=>typeof e!=`string`||!nd.has(e))&&G(),{id:od(t.id),type:`public-key`,...Array.isArray(n)?{transports:n}:{}}})}function cd(e){if(e!==void 0)return e===`discouraged`||e===`preferred`||e===`required`?e:G()}function ld(e){if(e!==void 0)return rd(e)}function ud(e){let t=rd(e),n={challenge:od(t.challenge)},r=ad(t.timeout),i=t.rpId===void 0?void 0:id(t.rpId),a=sd(t.allowCredentials),o=cd(t.userVerification),s=ld(t.extensions);return r!==void 0&&(n.timeout=r),i!==void 0&&(n.rpId=i),a!==void 0&&(n.allowCredentials=a),o!==void 0&&(n.userVerification=o),s!==void 0&&(n.extensions=s),n}function dd(e){let t=rd(e),n=rd(t.rp),r=rd(t.user);(!Array.isArray(t.pubKeyCredParams)||t.pubKeyCredParams.length===0)&&G();let i=t.pubKeyCredParams.map(e=>{let t=rd(e);return(t.type!==`public-key`||typeof t.alg!=`number`||!Number.isSafeInteger(t.alg))&&G(),{type:`public-key`,alg:t.alg}}),a={challenge:od(t.challenge),rp:{name:id(n.name),...n.id===void 0?{}:{id:id(n.id)}},user:{id:od(r.id),name:id(r.name),displayName:id(r.displayName)},pubKeyCredParams:i},o=ad(t.timeout),s=sd(t.excludeCredentials),c=md(t.authenticatorSelection),l=hd(t.attestation),u=ld(t.extensions);return o!==void 0&&(a.timeout=o),s!==void 0&&(a.excludeCredentials=s),c!==void 0&&(a.authenticatorSelection=c),l!==void 0&&(a.attestation=l),u!==void 0&&(a.extensions=u),a}function fd(e){return ud(e)}function pd(e){return dd(e)}function md(e){if(e===void 0)return;let t=rd(e),n=t.authenticatorAttachment,r=t.residentKey,i=t.requireResidentKey,a=cd(t.userVerification);return n!==void 0&&n!==`platform`&&n!==`cross-platform`&&G(),r!==void 0&&r!==`discouraged`&&r!==`preferred`&&r!==`required`&&G(),i!==void 0&&typeof i!=`boolean`&&G(),{...n===void 0?{}:{authenticatorAttachment:n},...r===void 0?{}:{residentKey:r},...i===void 0?{}:{requireResidentKey:i},...a===void 0?{}:{userVerification:a}}}function hd(e){if(e!==void 0)return e===`none`||e===`indirect`||e===`direct`||e===`enterprise`?e:G()}var gd={authorization_rejected:`The Hub authorization request could not be verified.`,callback_rejected:`The browser response could not be verified.`,cancelled:`Authorization was cancelled.`,expired:`The authorization request expired. Try again.`,platform_invalid:`Secure browser authorization is unavailable on this device.`,superseded:`A newer authorization request replaced this one.`},_d=6e4,K=class extends Error{code;constructor(e){super(gd[e]),this.name=e===`cancelled`||e===`superseded`?`AbortError`:`NativeHandoffError`,this.code=e}},vd=new Map;function yd(e,t){return oe(e)(t,{onExcessProperty:`error`})}function bd(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n+=1)t[n]=e.charCodeAt(n);return t}async function xd(e){let t=await e.randomBytes(32);if(!(t instanceof Uint8Array)||t.byteLength!==32)throw new K(`platform_invalid`);return Uint8Array.from(t)}function Sd(e,t){let n=Math.max(e.length,t.length),r=e.length^t.length;for(let i=0;i<n;i+=1)r|=(e.charCodeAt(i)||0)^(t.charCodeAt(i)||0);return r===0}function Cd(e,t){let n=vd.get(e);n&&(n.superseded=!0),n?.controller.abort();let r={generation:(n?.generation??0)+1,controller:new AbortController,superseded:!1};vd.set(e,r);let i=()=>r.controller.abort();return t?.aborted?i():t?.addEventListener(`abort`,i,{once:!0}),{active:r,isCurrent:()=>vd.get(e)===r&&!r.controller.signal.aborted,cleanup:()=>{t?.removeEventListener(`abort`,i),vd.get(e)===r&&vd.delete(e)}}}function wd(e,t){if(!t())throw new K(e.superseded?`superseded`:`cancelled`)}function Td(e,t){let n=e-t;if(n<-6e4)throw new K(`expired`);if(n>3e5+_d)throw new K(`authorization_rejected`)}function Ed(e,t){if(t-e>_d)throw new K(`expired`)}function Dd(e,t){let n;try{n=new URL(e)}catch{throw new K(`callback_rejected`)}if(n.searchParams.has(`error`)){try{yd(Lt,{redirectUri:e})}catch{throw new K(`callback_rejected`)}let r=n.searchParams.get(`state`)??``,i=n.searchParams.get(`handoff_id`)??``;throw!Sd(r,t.state)||!Sd(i,t.handoffId)?new K(`callback_rejected`):new K(`cancelled`)}try{yd(zt,{redirectUri:e})}catch{throw new K(`callback_rejected`)}let r=`${n.protocol}//${n.host}${n.pathname}`,i=n.searchParams.get(`state`)??``,a=n.searchParams.get(`handoff_id`)??``;if(r!==t.callbackUri||!Sd(i,t.state)||!Sd(a,t.handoffId))throw new K(`callback_rejected`);return{code:n.searchParams.get(`code`)}}async function Od(e){let t;try{t=yd(Be,e.callbackUri())}catch{throw new K(`callback_rejected`)}let n=e.deviceLabel().trim();if(n.length===0||Array.from(n).length>64)throw new K(`platform_invalid`);let r=Ut(await xd(e)),i=Ut(await xd(e)),a=await e.sha256(bd(i));if(!(a instanceof Uint8Array)||a.byteLength!==32)throw new K(`platform_invalid`);let o={callbackUri:t,codeChallenge:Ut(a),codeVerifier:i,deviceLabel:n,state:r};try{yd(le,{redirectUri:o.callbackUri,codeChallenge:o.codeChallenge,codeChallengeMethod:`S256`,state:o.state,deviceLabel:o.deviceLabel})}catch{throw new K(`platform_invalid`)}return o}async function kd(e){let{active:t,isCurrent:n,cleanup:r}=Cd(e.coordinatorKey??e.origin,e.signal),i=e.now??Date.now;try{wd(t,n);let r=await Od(e.platform);wd(t,n);let a=yd(le,{redirectUri:r.callbackUri,codeChallenge:r.codeChallenge,codeChallengeMethod:`S256`,state:r.state,deviceLabel:r.deviceLabel,...e.purpose?{purpose:e.purpose}:{}}),o;try{o=yd(ut,await e.start(a,t.controller.signal))}catch(e){throw n()||wd(t,n),e instanceof K?e:new K(`authorization_rejected`)}let s=i(),c;try{c=new URL(o.authorizationUrl)}catch{throw new K(`authorization_rejected`)}if(c.origin!==new URL(e.origin).origin)throw new K(`authorization_rejected`);Td(o.expiresAt,s);let l=await e.platform.openSystemBrowser(o.authorizationUrl,r.callbackUri,t.controller.signal);if(wd(t,n),l.type!==`success`)throw new K(l.type===`locked`?`authorization_rejected`:`cancelled`);Ed(o.expiresAt,i());let{code:u}=Dd(l.url,{callbackUri:r.callbackUri,state:r.state,handoffId:o.handoffId});wd(t,n);let d;try{d=yd(e.redeemResponseSchema,await e.redeem(yd(e.redeemRequestSchema,e.buildRedeemRequest(yd(p,{handoffId:o.handoffId,code:u,codeVerifier:r.codeVerifier}))),t.controller.signal))}catch(e){throw n()||wd(t,n),e}return wd(t,n),d}finally{r()}}async function Ad(e){return kd({...e,redeemRequestSchema:p,redeemResponseSchema:u,buildRedeemRequest:e=>e})}var jd={accept:`application/json`,"content-type":`application/json`},Md=4096,Nd=256,Pd=256,Fd=100,Id=/^node_[A-Za-z0-9_-]{22,43}$/,Ld=/^[a-z0-9._-]{1,64}$/,Rd=256,zd=512,Bd=/^[A-Za-z0-9_-]{1,512}$/,Vd=/^pkey_[A-Za-z0-9_-]{22}$/,Hd=256,Ud=256,Wd=2048,Gd=254,Kd=256,qd=16,Jd=128,Yd=/^[A-Za-z0-9_-]{43}$/,Xd=`otpauth://`,Zd=3e4,Qd=[`/api/auth/native/bootstrap/registration/`,`/api/auth/native/invitations/registration/`];function $d(e){let t=e.toLowerCase();return Qd.some(e=>t.startsWith(e))}var ef=new Set([`set-password`,`remove-password`,`revoke-totp`,`request-email-verification`,`add-passkey`,`regenerate-recovery-codes`,`connect-external-identity`,`disconnect-external-identity`]),tf=new Set([`begin-totp-enrollment`,`confirm-totp-enrollment`]),nf=`step_up_required`,rf=`passkey_session_required`;function af(e,t,n){let r={code:e,wire:e,inferred:!1};return!n||e!==`forbidden`||t===void 0?r:ef.has(t)?{code:nf,wire:e,inferred:!0}:tf.has(t)?{code:rf,wire:e,inferred:!0}:r}var q=class extends Error{code;status;retryAfterMs;intent;wireCode;inferred;reason;constructor(e,t,n,r,i,a){super(a?sf(a).message:lf(e,r)),this.name=`HostedHubApiError`,this.code=e,this.status=t,this.retryAfterMs=n,this.intent=r,this.wireCode=i??e,this.inferred=i!==void 0&&i!==e,this.reason=a??null}},of={"missing-signer":{reason:`missing-signer`,title:`Secure session unavailable`,message:`Secure session signing is unavailable on this device. Restart the app, then try again.`,recovery:`restart-app`},"missing-token":{reason:`missing-token`,title:`Sign in again`,message:`This device no longer has its secure Hub session. Sign in again to continue.`,recovery:`sign-in`},"proof-signing-failed":{reason:`proof-signing-failed`,title:`Secure session could not be verified`,message:`This device could not verify its secure Hub session. Unlock the device and try again; if it continues, sign in again.`,recovery:`retry`},"token-invalidated":{reason:`token-invalidated`,title:`Session no longer valid`,message:`Your secure Hub session is no longer valid. Sign in again to continue.`,recovery:`sign-in`},"request-timeout":{reason:`request-timeout`,title:`Hub did not respond`,message:`The Hub did not respond in time. Check your connection and try again.`,recovery:`retry`},"transport-unavailable":{reason:`transport-unavailable`,title:`Hub could not be reached`,message:`Ryco could not reach the Hub. Check your connection and try again.`,recovery:`retry`}};function sf(e){return of[e]}function cf(e,t){if(e===`conflict`)switch(t){case`set-password`:return`That password has appeared in a known breach. Choose a different one.`;case`revoke-passkey`:return`That is the only passkey left on this account. Add another before removing it.`;case`begin-totp-enrollment`:return`Two-factor authentication is already set up on this account.`;case`confirm-totp-enrollment`:return`This setup is no longer in progress. Start again.`;case`request-email-verification`:return`That email address is already in use.`;case`disconnect-external-identity`:return`GitHub is the only sign-in method on this account. Add another before disconnecting it.`;default:return null}return e===`authentication_failed`&&t===`confirm-totp-enrollment`||e===`authentication_failed`&&(t===`connect-external-identity`||t===`disconnect-external-identity`)?`That code is not correct. Check your authenticator app and try again.`:e===`not_found`&&t===`revoke-passkey`?`That passkey is no longer on this account.`:null}function lf(e,t){let n=t===void 0?null:cf(e,t);if(n!==null)return n;switch(e){case nf:return`Enter a current code from your authenticator app to confirm this change.`;case rf:return`Sign in with a passkey on this device to change two-factor settings.`;case`invalid_credential_id`:return`That passkey could not be identified.`;case`external_provider_unavailable`:return`GitHub sign-in is temporarily unavailable.`;case`external_authorization_cancelled`:return`GitHub authorization was cancelled.`;case`external_authorization_expired`:return`GitHub authorization expired. Try again.`;case`external_authorization_rejected`:return`GitHub could not authorize this request.`;case`external_identity_already_linked`:return`That GitHub account is already connected.`;case`external_identity_email_conflict`:return`Sign in another way, then connect GitHub from account settings.`;case`external_identity_verified_email_required`:return`GitHub must have a verified primary email to create an account.`;case`signup_disabled`:return`New account signup is currently closed.`;case`username_unavailable`:return`That username is unavailable.`;case`last_primary_credential`:return`Add another sign-in method before disconnecting GitHub.`;case`native_authorization_unavailable`:return`Secure browser authorization is unavailable on this device.`;case`timeout`:return`The request took too long. Check your connection and try again.`;case`authentication_failed`:return`The passkey could not be verified.`;case`registration_unavailable`:return`The invitation or registration challenge is unavailable or expired.`;case`session_invalid`:case`unauthorized`:return`Your Hub session has expired.`;case`csrf_rejected`:return`The request could not be verified. Refresh and try again.`;case`forbidden`:case`authorization_failed`:return`You are not authorized to perform this action.`;case`not_found`:return`The requested item is no longer available.`;case`conflict`:case`ticket_consumed`:return`The request has already been used.`;case`rate_limited`:case`node_rate_limited`:return`Too many attempts. Wait briefly and try again.`;case`enrollment_unavailable`:return`The node enrollment is unavailable or expired.`;case`node_offline`:return`The selected node is offline.`;case`server_draining`:return`Hub is temporarily draining relay connections.`;case`unsupported_version`:return`The selected node or Hub uses an incompatible relay version.`;case`invalid_request`:return`The response was malformed or expired.`;case`browser_only_transport`:return`This action is only available in a browser.`;case`native_only_transport`:return`This action is only available in the native app.`;default:return`Hub is temporarily unavailable.`}}function uf(e){if(typeof e!=`object`||!e||Array.isArray(e))throw new q(`invalid_response`,502);return e}function J(e,t,n){try{return oe(e)(t,{onExcessProperty:`error`})}catch{throw new q(n,n===`invalid_request`?400:502)}}function df(e){if(typeof e!=`string`)throw new q(`invalid_response`,502);try{return xu(e)}catch{throw new q(`invalid_response`,502)}}function ff(e){return e===null||typeof e==`number`&&Number.isSafeInteger(e)}function pf(e){return e===`viewer`||e===`operator`||e===`owner`}function mf(e){return e===`darwin`||e===`linux`||e===`windows`||e===`unknown`}function hf(e){return e===`arm64`||e===`x64`||e===`other`}function gf(e){return typeof e==`string`&&e.length>0&&e.length<=Md?e:null}function _f(e){return!Array.isArray(e)||e.some(e=>typeof e!=`string`)?null:e}function vf(e){let t=_f(e);return!t||t.length===0||t.length>Rd||t.some(e=>e.length===0||e.length>zd)?null:t}function yf(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t=e;return typeof t.id!=`string`||!Bd.test(t.id)?null:{id:t.id,label:typeof t.label==`string`&&t.label.length<=Nd?t.label:null,createdAt:ff(t.createdAt)?t.createdAt:null,lastUsedAt:ff(t.lastUsedAt)?t.lastUsedAt:null,backupEligible:typeof t.backupEligible==`boolean`?t.backupEligible:null,backupState:typeof t.backupState==`boolean`?t.backupState:null,revokedAt:ff(t.revokedAt)?t.revokedAt:null,revocationReasonCode:typeof t.revocationReasonCode==`string`&&t.revocationReasonCode.length>0&&t.revocationReasonCode.length<=Hd?t.revocationReasonCode:null}}function bf(e){try{return oe(ke)(e,{onExcessProperty:`error`})}catch{return null}}function xf(e){let t=e?.totpCode;return typeof t==`string`&&t.trim().length>0?{totpCode:t}:{}}function Sf(e,t){if(typeof e!=`string`||e.length===0||e.length>t)throw new q(`invalid_request`,400);return e}function Cf(e){return e==null||e===``?{}:{totpCode:Sf(e,qd)}}function wf(e){let t=Sf(e,64);if(!Yd.test(t))throw new q(`invalid_request`,400);return t}function Tf(e){return typeof e==`string`&&e.length>0&&e.length<=Ud?e:null}function Ef(e){return typeof e==`string`&&e.length<=Wd&&e.toLowerCase().startsWith(Xd)?e:null}var Df=/^[a-z][a-z0-9_]{0,63}$/;function Of(e){return typeof e==`string`&&Df.test(e)?e:`unavailable`}async function kf(e,t,n){let r;try{r=await e.json()}catch{throw new q(`invalid_response`,e.status,void 0,t)}let i=uf(r);if(!e.ok){let r=typeof i.retryAfterMs==`number`&&Number.isSafeInteger(i.retryAfterMs)&&i.retryAfterMs>=0&&i.retryAfterMs<=3e5?i.retryAfterMs:void 0,a=af(Of(i.error),t,n);throw new q(a.code,e.status,r,t,a.wire)}return i}var Af=class{#e;#t;#n;#r;#i;#a;#o=null;constructor(e){if(this.#e=e.endpoint,this.#t=e.httpClient,this.#n=e.passkeyCeremony,this.#r=e.sessionCredentials,this.#i=e.dpopSigner,this.#a=e.nativeAuthorization,this.#r.mode===`bearer`){if(!this.#i)throw new q(`native_session_unavailable`,0,void 0,void 0,void 0,`missing-signer`);if(!this.#r.readBearerToken||!this.#r.writeBearerToken)throw new q(`native_session_unavailable`,0,void 0,void 0,void 0,`missing-token`)}}get#s(){return this.#r.mode===`bearer`}#c(){return this.#r.readBearerToken?.()??null}#l(e){this.#r.writeBearerToken?.(e)}get hasSessionMaterial(){return this.#s?this.#c()!==null:this.#r.readCsrfToken()!==null}clearSessionMaterial(){this.#o=null,this.#s?this.#l(null):this.#r.writeCsrfToken(null)}async getBootstrapAvailability(e){let t=await this.#E(`/api/auth/bootstrap-status`,{dpop:`mint`,...e?{signal:e}:{}});if(Object.keys(t).length!==1||typeof t.available!=`boolean`)throw new q(`invalid_response`,502);return t.available}async getPublicSignupConfiguration(e){return this.#m(),J(He,await this.#E(Ct,e?{signal:e}:{}),`invalid_response`)}async getExternalIdentityConfiguration(e){return J(we,await this.#E(g,{...this.#s?{dpop:`mint`}:{},...e?{signal:e}:{}}),`invalid_response`)}async startExternalIdentityAuthorization(e,t){this.#m();let n=J(Vt,e,`invalid_request`);return J(a,await this.#E(he,{method:`POST`,body:n,...n.intent===`link`?{csrf:!0,intent:`connect-external-identity`}:{},...t?{signal:t}:{}}),`invalid_response`)}async getPendingExternalIdentity(e){return this.#m(),J(De,await this.#E(C,e?{signal:e}:{}),`invalid_response`)}async finishExternalIdentitySignup(e,t){this.#m();let n=J(ee,e,`invalid_request`),r=J(wt,await this.#E(te,{method:`POST`,body:n,...t?{signal:t}:{}}),`invalid_response`);return this.#r.writeCsrfToken(r.identity.csrfToken),r}async restoreSession(e){let t=await this.#E(`/api/auth/session`,e?{signal:e}:{});if(this.#s)return this.#b(t);let n=this.#w(t);return this.#r.writeCsrfToken(n.csrfToken),n}async signIn(e){if(this.#s&&this.#a){let t=await Ad({origin:this.#e.origin(),platform:this.#a,...e?{signal:e}:{},start:(e,t)=>this.#u(e,t),redeem:(e,t)=>this.#d(e,t)}),n=this.#C(t);return this.#l(t.token),n}let t=this.#s?`/api/auth/native/passkey`:`/api/auth/passkey`,n=await this.#E(`${t}/options`,{method:`POST`,body:{},dpop:`mint`,...e?{signal:e}:{}}),r=await this.#n.authenticate(fd(n.options),e);return this.#y(await this.#E(`${t}/verify`,{method:`POST`,body:{response:r},dpop:`mint`,...e?{signal:e}:{}}))}async signInWithExternalProvider(e,t){this.#h();let n=J(v,e,`invalid_request`),r=this.#a;if(!r)throw new q(`native_authorization_unavailable`,400);let i=await kd({origin:this.#e.origin(),platform:r,purpose:{kind:`sign_in`,providerHint:n},redeemRequestSchema:p,redeemResponseSchema:u,buildRedeemRequest:e=>e,...t?{signal:t}:{},start:(e,t)=>this.#u(e,t),redeem:(e,t)=>this.#d(e,t)}),a=this.#C(i);return this.#l(i.token),a}async connectExternalIdentity(e,t,n){this.#h();let r=J(v,e,`invalid_request`),i=this.#a;if(!i)throw new q(`native_authorization_unavailable`,400);let a=this.#o;if(a&&a.expiresAt<Date.now())this.#o=null;else if(a?.provider===r){let e=J(_e,{...a.request,...xf(t)},`invalid_request`);try{let t=await this.#f(e,n);return this.#o=null,t.externalIdentity}catch(e){throw this.#p(e)||(this.#o=null),e}}let o=null;try{return(await kd({origin:this.#e.origin(),coordinatorKey:`${this.#e.origin()}:connect:${r}`,platform:i,purpose:{kind:`connect_external_identity`,provider:r},redeemRequestSchema:_e,redeemResponseSchema:s,buildRedeemRequest:e=>({...e,purpose:{kind:`connect_external_identity`,provider:r},...xf(t)}),...n?{signal:n}:{},start:(e,t)=>this.#u(e,t),redeem:(e,t)=>(o=e,this.#f(e,t))})).externalIdentity}catch(e){throw o&&this.#p(e)&&(this.#o={provider:r,request:o,expiresAt:Date.now()+ht}),e}}cancelExternalIdentityConnection(e){let t=J(v,e,`invalid_request`);this.#o?.provider===t&&(this.#o=null)}async signInWithNativePasskey(e){this.#h();let t=`/api/auth/native/passkey`,n=await this.#E(`${t}/options`,{method:`POST`,body:{},dpop:`mint`,...e?{signal:e}:{}}),r=await this.#n.authenticate(fd(n.options),e),i=await this.#E(`${t}/verify`,{method:`POST`,body:{response:r},dpop:`mint`,...e?{signal:e}:{}}),a=this.#T(i);return{session:a.response,token:a.token}}async startPublicSignup(e,t){this.#m();let n=J(mt,e,`invalid_request`);return J(tt,await this.#E(Me,{method:`POST`,body:n,...t?{signal:t}:{}}),`invalid_response`)}async verifyPublicSignup(e,t){this.#m();let n=J(Ze,e,`invalid_request`);return J(Fe,await this.#E(fe,{method:`POST`,body:n,...t?{signal:t}:{}}),`invalid_response`)}async finishPublicSignupWithPasskey(e,t){this.#m();let n=J(Mt,{...e,response:{}},`invalid_request`),r=J(We,{attemptId:n.attemptId,activationSecret:n.activationSecret},`invalid_request`),i=J(Je,await this.#E(Ae,{method:`POST`,body:r,...t?{signal:t}:{}}),`invalid_response`),a=await this.#n.register(pd(i.options),t),o=J(Mt,{...n,response:a},`invalid_request`),s=J(ft,await this.#E(w,{method:`POST`,body:o,...t?{signal:t}:{}}),`invalid_response`);return this.#r.writeCsrfToken(s.identity.csrfToken),s}async finishPublicSignupWithPassword(e,t){this.#m();let n=J(xt,e,`invalid_request`),r=J(ft,await this.#E(Oe,{method:`POST`,body:n,...t?{signal:t}:{}}),`invalid_response`);return this.#r.writeCsrfToken(r.identity.csrfToken),r}async startPasswordLogin(e,t){this.#m();let n=J(Ke,e,`invalid_request`);return J(At,await this.#E(xe,{method:`POST`,body:n,...t?{signal:t}:{}}),`invalid_response`)}async finishPasswordLogin(t,n){this.#m();let r=J(e,t,`invalid_request`),i=J(Ne,await this.#E(y,{method:`POST`,body:r,...n?{signal:n}:{}}),`invalid_response`);return this.#r.writeCsrfToken(i.csrfToken),i}async requestPasswordReset(e,t){this.#m();let n=J(it,e,`invalid_request`);return J(Re,await this.#E(_,{method:`POST`,body:n,...t?{signal:t}:{}}),`invalid_response`)}async verifyPasswordReset(e,t){this.#m();let n=J(yt,e,`invalid_request`);return J(Ot,await this.#E(E,{method:`POST`,body:n,...t?{signal:t}:{}}),`invalid_response`)}async finishPasswordReset(e,t){this.#m();let n=J(_t,e,`invalid_request`),r=J(Et,await this.#E(Te,{method:`POST`,body:n,...t?{signal:t}:{}}),`invalid_response`);return this.clearSessionMaterial(),r}async startNativeIdentityEmail(e,n){return this.#g(t,et,Xe,e,n)}async verifyNativeIdentityEmail(e,t){return this.#g(Ge,Pe,Nt,e,t)}async claimNativeIdentityUsername(e,t){return this.#g(jt,S,D,e,t)}async finishNativeIdentitySignupWithPasskey(e,t){this.#h();let n=J(ne,{...e,response:{}},`invalid_request`),r=J(ie,{attemptId:n.attemptId,activationSecret:n.activationSecret},`invalid_request`),i=await this.#g(Ve,ie,ue,r,t),a=await this.#n.register(pd(i.options),t);return this.#g(Dt,ne,at,{...n,response:a},t)}async finishNativeIdentitySignupWithPassword(e,t){return this.#g(dt,m,at,e,t)}async startNativeIdentityPasswordLogin(e,t){return this.#g(Le,f,c,e,t)}async finishNativeIdentityPasswordLogin(e,t){return this.#g(kt,Rt,n,e,t)}async signInNativeIdentityWithRecoveryCode(e,t){return this.#g(vt,se,ct,e,t)}async requestNativeIdentityPasswordReset(e,t){return this.#g(Tt,ge,o,e,t)}async verifyNativeIdentityPasswordReset(e,t){return this.#g(rt,Pt,ve,e,t)}async finishNativeIdentityPasswordReset(e,t){return this.#g(gt,ze,It,e,t)}async cancelNativeIdentityAttempt(e,t){return this.#g(pe,bt,pt,e,t)}async switchActiveSpace(e,t){let n=J(st,e,`invalid_request`);return J(re,await this.#E(r,{method:`POST`,body:n,csrf:!0,dpop:`session`,...t?{signal:t}:{}}),`invalid_response`)}async startNativeNodeClaim(e,t){this.#h();let n=J(i,e,`invalid_request`);return J(Ce,await this.#E(qe,{method:`POST`,body:n,dpop:`session`,...t?{signal:t}:{}}),`invalid_response`)}async finishNativeNodeClaim(e,t){this.#h();let n=J(me,e,`invalid_request`);return J(Bt,await this.#E(Ue,{method:`POST`,body:n,dpop:`session`,...t?{signal:t}:{}}),`invalid_response`)}async signInWithPassword(e,t){return this.#m(),this.#y(await this.#E(`/api/auth/password`,{method:`POST`,body:{email:Sf(e.email,Gd),password:Sf(e.password,Kd),...Cf(e.totpCode)},...t?{signal:t}:{}}))}async signInWithRecoveryCode(e,t){return this.#m(),this.#y(await this.#E(`/api/auth/recovery`,{method:`POST`,body:{code:Sf(e,Jd)},...t?{signal:t}:{}}))}async requestEmailRecovery(e,t){this.#m();let n=await this.#E(`/api/auth/recovery/email/request`,{method:`POST`,body:{email:Sf(e,Gd)},...t?{signal:t}:{}});if(Object.keys(n).length!==1||n.ok!==!0)throw new q(`invalid_response`,502)}async confirmEmailRecovery(e,t){return this.#m(),this.#y(await this.#E(`/api/auth/recovery/email/confirm`,{method:`POST`,body:{token:wf(e.token),...Cf(e.totpCode)},...t?{signal:t}:{}}))}async confirmEmailVerification(e,t){this.#m();let n=await this.#E(`/api/auth/email/verify`,{method:`POST`,body:{token:wf(e)},...t?{signal:t}:{}});if(Object.keys(n).length!==1||n.ok!==!0)throw new q(`invalid_response`,502)}async startNativeHandoff(e,t){return this.#u(e,t)}async#u(e,t){if(!this.#s)throw new q(`browser_only_transport`,400);let n=J(le,e,`invalid_request`),r=n.purpose?.kind===`connect_external_identity`;return J(ut,await this.#E(Ie,{method:`POST`,body:n,dpop:r?`session`:`mint`,...r?{intent:`connect-external-identity`}:{},...t?{signal:t}:{}}),`invalid_response`)}async redeemNativeHandoff(e,t){let n=await this.#d(e,t),r=this.#C(n);return this.#l(n.token),r}async#d(e,t){if(!this.#s)throw new q(`browser_only_transport`,400);let n=J(p,e,`invalid_request`);return J(u,await this.#E(Qe,{method:`POST`,body:n,dpop:`mint`,...t?{signal:t}:{}}),`invalid_response`)}async#f(e,t){this.#h();let n=J(_e,e,`invalid_request`);return J(s,await this.#E(Qe,{method:`POST`,body:n,dpop:`session`,intent:`connect-external-identity`,...t?{signal:t}:{}}),`invalid_response`)}#p(e){return e instanceof q&&(e.code===`step_up_required`||e.code===`authentication_failed`||e.code===`forbidden`)}async getNativeHandoffPresentation(e,t){this.#m();let n=J(Ft,e,`invalid_request`);return J(be,await this.#E(`${nt}${n}`,t?{signal:t}:{}),`invalid_response`)}async approveNativeHandoff(e,t){this.#m();let n=J(Ft,e,`invalid_request`);return J(zt,await this.#E(`${nt}${n}${Ye}`,{method:`POST`,body:{},csrf:!0,...t?{signal:t}:{}}),`invalid_response`)}async cancelNativeHandoff(e,t){this.#m();let n=J(Ft,e,`invalid_request`);return J(Lt,await this.#E(`${nt}${n}${St}`,{method:`POST`,body:{},csrf:!0,...t?{signal:t}:{}}),`invalid_response`)}#m(){if(this.#s)throw new q(`browser_only_transport`,400)}#h(){if(!this.#s)throw new q(`native_only_transport`,400)}async#g(e,t,n,r,i){this.#h();let a=J(t,r,`invalid_request`);return J(n,await this.#E(e,{method:`POST`,body:a,dpop:`mint`,...i?{signal:i}:{}}),`invalid_response`)}async redeemInvitation(e,t){let n=this.#s?`/api/auth/native/invitations/registration`:`/api/auth/invitations/registration`;return this.#v(`${n}/options`,`${n}/verify`,e,{authenticated:!1,...t?{signal:t}:{},finish:e=>this.#y(e)})}async bootstrapOwner(e,t){let n=this.#s?`/api/auth/native/bootstrap/registration`:`/api/auth/bootstrap/registration`;return this.#v(`${n}/options`,`${n}/verify`,e,{authenticated:!1,...t?{signal:t}:{},finish:e=>this.#y(e)})}async listPasskeys(e){let t=await this.#E(`/api/account/passkeys`,e?{signal:e}:{});if(!Array.isArray(t.passkeys)||t.passkeys.length>Pd)throw new q(`invalid_response`,502);return t.passkeys.map(e=>{let t=yf(e);if(!t)throw new q(`invalid_response`,502);return t})}async getAccountSecurity(e){let t=bf(await this.#E(`/api/account/security`,e?{signal:e}:{}));if(!t)throw new q(`invalid_response`,502);return t}async finishBrowserExternalIdentityConnection(e,t,n){this.#m(),J(v,e,`invalid_request`);let r=J(ae,xf(t),`invalid_request`);return J(de,await this.#E(T,{method:`POST`,body:r,csrf:!0,intent:`connect-external-identity`,...n?{signal:n}:{}}),`invalid_response`)}async disconnectExternalIdentity(e,t,n){J(v,e,`invalid_request`);let r=J(b,xf(t),`invalid_request`),i=J(Se,await this.#E(je,{method:`POST`,body:r,csrf:!0,intent:`disconnect-external-identity`,...n?{signal:n}:{}}),`invalid_response`);return i.signedOut&&this.clearSessionMaterial(),i}async addPasskey(e,t){let n=typeof e.passkeyLabel==`string`?e.passkeyLabel.trim():null;return this.#v(`/api/account/passkeys/registration/options`,`/api/account/passkeys/registration/verify`,{label:n===null||n.length===0?null:n},{authenticated:!0,intent:`add-passkey`,verifyExtra:xf(e),...t?{signal:t}:{},finish:e=>this.#S(e)})}async regenerateRecoveryCodes(e,t){let n=await this.#E(`/api/account/recovery-codes`,{method:`POST`,body:xf(e),csrf:!0,intent:`regenerate-recovery-codes`,...t?{signal:t}:{}}),r=vf(n.recoveryCodes);if(!r)throw new q(`invalid_response`,502);return this.#x(n),r}async setPassword(e,t){await this.#_(`/api/account/password`,{password:e.password,...xf(e)},t,`set-password`)}async removePassword(e,t){await this.#_(`/api/account/password/remove`,xf(e),t,`remove-password`)}async beginTotpEnrollment(e){let t=await this.#E(`/api/account/totp/enrollment/options`,{method:`POST`,body:{},csrf:!0,intent:`begin-totp-enrollment`,...e?{signal:e}:{}}),n=Tf(t.secretBase32),r=Ef(t.provisioningUri);if(!n||!r)throw new q(`invalid_response`,502);return{secretBase32:n,provisioningUri:r}}async confirmTotpEnrollment(e,t){await this.#_(`/api/account/totp/enrollment/verify`,{code:e.code},t,`confirm-totp-enrollment`)}async revokeTotp(e,t){await this.#_(`/api/account/totp/revoke`,xf(e),t,`revoke-totp`)}async requestEmailVerification(e,t){await this.#_(`/api/account/email/verification`,{email:e.email,...xf(e)},t,`request-email-verification`)}async revokePasskey(e,t){if(!Vd.test(e))throw new q(`invalid_credential_id`,400);await this.#_(`/api/account/passkeys/${e}/revoke`,{},t,`revoke-passkey`)}async#_(e,t,n,r){let i=await this.#E(e,{method:`POST`,body:t,csrf:!0,intent:r,...n?{signal:n}:{}});if(Object.keys(i).length!==1||i.ok!==!0)throw new q(`invalid_response`,502,void 0,r)}async#v(e,t,n,r){let i={csrf:r.authenticated,...r.authenticated?{}:{dpop:`mint`},...r.intent?{intent:r.intent}:{},...r.signal?{signal:r.signal}:{}},a=await this.#E(e,{method:`POST`,body:n,...i,narrowForbidden:!1}),o=await this.#n.register(pd(a.options),r.signal);return r.finish(await this.#E(t,{method:`POST`,body:{response:o,...r.verifyExtra},...i}))}#y(e){if(this.#s){let{response:t,token:n}=this.#T(e);return this.#l(n),t}let t=this.#w(e);return this.#r.writeCsrfToken(t.csrfToken),t}#b(e){let t=this.#C(e),n=gf(e.token);return n&&this.#l(n),t}#x(e){if(this.#s){let{token:t}=this.#T(e);this.#l(t);return}this.#r.writeCsrfToken(this.#w(e).csrfToken)}#S(e){this.#x(e);let t=yf(e.passkey);return{passkey:t,confirmed:t!==null}}async signOut(e){await this.#E(`/api/auth/logout`,{method:`POST`,body:{},csrf:!0,...e?{signal:e}:{}}),this.clearSessionMaterial()}async listNodes(e){let t=await this.#E(`/api/nodes`,e?{signal:e}:{});if(!Array.isArray(t.nodes))throw new q(`invalid_response`,502);return t.nodes.map(e=>{let t=uf(e),n=uf(t.grant),r=uf(t.presence),i=t.capabilities===void 0?null:uf(t.capabilities),a=J(ot,t.id,`invalid_response`);if(typeof t.environmentId!=`string`||typeof t.label!=`string`||!mf(t.platformOs)||!hf(t.platformArch)||typeof t.clientVersion!=`string`||!ff(t.createdAt)||t.createdAt===null||!ff(t.updatedAt)||t.updatedAt===null||!ff(t.lastAuthenticatedAt)||!ff(t.revokedAt)||t.revocationReasonCode!==null&&typeof t.revocationReasonCode!=`string`||typeof n.id!=`string`||!pf(n.role)||!pf(t.effectiveRole)||typeof r.online!=`boolean`||!ff(r.lastHeartbeatAt)||i!==null&&(typeof i.repositoryIdentity!=`boolean`||typeof i.nativeClientRequired!=`boolean`||i.threadSettlement!==void 0&&typeof i.threadSettlement!=`boolean`))throw new q(`invalid_response`,502);let o={id:a,environmentId:h.make(t.environmentId),label:t.label,platformOs:t.platformOs,platformArch:t.platformArch,clientVersion:t.clientVersion,createdAt:t.createdAt,updatedAt:t.updatedAt,lastAuthenticatedAt:t.lastAuthenticatedAt,revokedAt:t.revokedAt,revocationReasonCode:t.revocationReasonCode,grant:{id:n.id,role:n.role},effectiveRole:t.effectiveRole,presence:{online:r.online,lastHeartbeatAt:r.lastHeartbeatAt}};return i?Object.assign(o,{capabilities:{repositoryIdentity:i.repositoryIdentity,nativeClientRequired:i.nativeClientRequired,...typeof i.threadSettlement==`boolean`?{threadSettlement:i.threadSettlement}:{}}}):o})}async renameNode(e,t,n){let r=t.trim();if(!Id.test(e)||r.length===0||r.length>Fd)throw new q(`invalid_request`,400);let i=await this.#E(`/api/admin/nodes/${encodeURIComponent(e)}/rename`,{method:`POST`,body:{label:r},csrf:!0,...n?{signal:n}:{}});if(Object.keys(i).length!==1||i.ok!==!0)throw new q(`invalid_response`,502)}async revokeNode(e,t,n){if(!Id.test(e)||!Ld.test(t))throw new q(`invalid_request`,400);let r=await this.#E(`/api/admin/nodes/${encodeURIComponent(e)}/revoke`,{method:`POST`,body:{reasonCode:t},csrf:!0,...n?{signal:n}:{}});if(Object.keys(r).length!==1||r.ok!==!0)throw new q(`invalid_response`,502)}async lookupNodeEnrollment(e,t){let n=uf((await this.#E(`/api/admin/node-enrollments/lookup`,{method:`POST`,body:{deviceCode:e},csrf:!0,...t?{signal:t}:{}})).enrollment);if(typeof n.id!=`string`||!/^enr_[A-Za-z0-9_-]{22}$/.test(n.id)||typeof n.label!=`string`||n.label.length<1||n.label.length>100||!mf(n.platformOs)||!hf(n.platformArch)||typeof n.clientVersion!=`string`||n.clientVersion.length<1||n.clientVersion.length>64||n.algorithm!==`ed25519`||typeof n.fingerprint!=`string`||!/^SHA256:[A-Za-z0-9_-]{43}$/.test(n.fingerprint)||!Number.isSafeInteger(n.createdAt)||!Number.isSafeInteger(n.expiresAt)||Number(n.expiresAt)<=Number(n.createdAt))throw new q(`invalid_response`,502);return{id:n.id,label:n.label,platformOs:n.platformOs,platformArch:n.platformArch,clientVersion:n.clientVersion,algorithm:n.algorithm,fingerprint:n.fingerprint,createdAt:n.createdAt,expiresAt:n.expiresAt}}async approveNodeEnrollment(e,t){let n=await this.#E(`/api/admin/node-enrollments/approve`,{method:`POST`,body:{deviceCode:e},csrf:!0,...t?{signal:t}:{}}),r=uf(n.node),i=uf(n.grant);if(typeof r.id!=`string`||!Id.test(r.id)||typeof r.environmentId!=`string`||!/^env_[A-Za-z0-9_-]{22}$/.test(r.environmentId)||typeof i.id!=`string`||!/^grant_[A-Za-z0-9_-]{22}$/.test(i.id)||i.role!==`owner`)throw new q(`invalid_response`,502)}async denyNodeEnrollment(e,t){let n=await this.#E(`/api/admin/node-enrollments/deny`,{method:`POST`,body:{deviceCode:e},csrf:!0,...t?{signal:t}:{}});if(Object.keys(n).length!==1||n.ok!==!0)throw new q(`invalid_response`,502)}async issueRelayTicket(e,t){let n=J(ot,e,`invalid_request`),r=await this.#E(`/api/relay/tickets`,{method:`POST`,body:{nodeId:n,capability:`ryco.rpc`,protocolMajor:1,protocolMinor:2},csrf:!0,...t?{signal:t}:{}});if(typeof r.ticket!=`string`||!Number.isSafeInteger(r.expiresAt)||r.protocolMajor!==1||r.protocolMinor!==2)throw new q(`invalid_response`,502);return{ticket:r.ticket,expiresAt:r.expiresAt,protocolMajor:1,protocolMinor:2}}#C(e){let t=uf(e.account),n=uf(e.session),r=df(t.id),i=df(n.accountId),a=e.recoveryCodes===void 0?void 0:_f(e.recoveryCodes);if(typeof t.displayName!=`string`||!pf(t.role)||!Number.isSafeInteger(t.createdAt)||!ff(t.disabledAt)||typeof n.id!=`string`||!Number.isSafeInteger(n.createdAt)||!Number.isSafeInteger(n.expiresAt)||!Number.isSafeInteger(n.lastSeenAt)||!ff(n.revokedAt)||n.revocationReasonCode!==null&&typeof n.revocationReasonCode!=`string`||a===null)throw new q(`invalid_response`,502);if(t.disabledAt!==null||n.revokedAt!==null||i!==r)throw new q(`session_invalid`,401);return{account:{id:r,displayName:t.displayName,role:t.role,createdAt:t.createdAt,disabledAt:t.disabledAt},session:{id:n.id,accountId:i,createdAt:n.createdAt,expiresAt:n.expiresAt,lastSeenAt:n.lastSeenAt,revokedAt:n.revokedAt,revocationReasonCode:n.revocationReasonCode},...a===void 0?{}:{recoveryCodes:a}}}#w(e){if(typeof e.csrfToken!=`string`||e.csrfToken.length===0)throw new q(`invalid_response`,502);return{...this.#C(e),csrfToken:e.csrfToken}}#T(e){let t=gf(e.token);if(!t)throw new q(`invalid_response`,502);return{response:this.#C(e),token:t}}async#E(e,t){let n=new URL(e,this.#e.origin());if(n.origin!==this.#e.origin()||n.search||n.hash||n.pathname.includes(`%`))throw new q(`invalid_request`,400,void 0,t.intent);if(this.#s&&$d(n.pathname))throw new q(`browser_only_transport`,400,void 0,t.intent);let r=t.method??`GET`,i={...jd},a,o;if(this.#s){let e=this.#i;if(!e)throw new q(`native_session_unavailable`,0,void 0,t.intent,void 0,`missing-signer`);let s=n.toString(),c;if(t.dpop!==`mint`&&(c=this.#c()??void 0,!c))throw new q(`session_invalid`,401,void 0,t.intent,void 0,`missing-token`);try{i.DPoP=await e.sign({method:r,url:s,...c?{token:c}:{}})}catch{throw new q(`native_session_unavailable`,0,void 0,t.intent,void 0,`proof-signing-failed`)}c&&(i.Authorization=`DPoP ${c}`),a=s,o=`omit`}else{if(t.csrf){let e=this.#r.readCsrfToken();if(!e)throw new q(`session_invalid`,401,void 0,t.intent);i[`X-Ryco-CSRF`]=e}a=n.pathname,o=`same-origin`}let s=new AbortController,c=!1,l=setTimeout(()=>{c=!0,s.abort()},Zd),u=t.signal,d=()=>s.abort();u?.aborted?s.abort():u?.addEventListener(`abort`,d);let f;try{f=await this.#t.fetch(a,{method:r,credentials:o,cache:`no-store`,headers:i,...t.body===void 0?{}:{body:JSON.stringify(t.body)},signal:s.signal})}catch(e){throw c?new q(`timeout`,0,void 0,t.intent,void 0,`request-timeout`):typeof e==`object`&&e&&`name`in e&&e.name===`AbortError`?e:new q(`unavailable`,0,void 0,t.intent,void 0,`transport-unavailable`)}finally{clearTimeout(l),u?.removeEventListener(`abort`,d)}try{return await kf(f,t.intent,t.narrowForbidden!==!1)}catch(e){throw this.#s&&t.dpop!==`mint`&&e instanceof q&&e.code===`session_invalid`?new q(e.code,e.status,e.retryAfterMs,e.intent,e.wireCode,`token-invalidated`):e}}},jf=null,Mf=null,Nf=null;function Pf(e){Nf=e}function Ff(){if(jf||!Nf)return;let e=Nf;Nf=null,e()}function If(e,t){Nf=null,jf=e,Mf=t??new Af(e)}function Y(){if(Ff(),!jf)throw Error(`Hosted runtime has not been configured.`);return jf}function X(){if(Ff(),!Mf)throw Error(`Hosted runtime has not been configured.`);return Mf}function Lf(e){return{environmentId:e.environmentId,label:e.label,platform:{os:e.platformOs,arch:e.platformArch},serverVersion:e.clientVersion,capabilities:{repositoryIdentity:!1,threadSettlement:!1,threadPriorityRanking:!1}}}function Rf(e){Y().nodeLifecycle.clearNodeScopedState(e)}var zf=null,Bf=!1,Vf=Promise.resolve();function Hf(e){let t=Vf.catch(()=>void 0).then(e);return Vf=t.catch(()=>void 0),t}async function Uf(e){let t=Y().nodeLifecycle;Y().resetRelayAttemptFactory(),await t.disconnectPrimaryEnvironment(),Rf(e),t.writePrimaryEnvironmentDescriptor(null),zf===e&&(zf=null),Bf=!1}async function Wf(e){await Hf(async()=>{await Uf(zf??e)})}async function Gf(e){await Hf(async()=>{(zf??e)!==e||Bf||(Bf=!0,Y().resetRelayAttemptFactory(),await Y().nodeLifecycle.disconnectPrimaryEnvironment())})}async function Kf(e,t,n){await Hf(async()=>{if(n?.aborted)return;let r=zf??t;if(r===e.environmentId){if(Bf||(Y().resetRelayAttemptFactory(),await Y().nodeLifecycle.disconnectPrimaryEnvironment()),n?.aborted)return}else if(r&&(await Uf(r),n?.aborted))return;let i=Y().nodeLifecycle;i.writePrimaryEnvironmentDescriptor(Lf(e)),i.setActiveEnvironmentId(e.environmentId),zf=e.environmentId,Bf=!1,i.connectPrimaryEnvironment()})}var qf={bootstrapAvailable:!1,accountStatus:`signed-out`,account:null,session:null,directoryStatus:`idle`,nodes:[],selectedNode:null,selectionStatus:`none`,effectiveRole:null,transportStatus:`idle`,sessionStatus:`closed`,sessionEstablished:!1,sessionRecoveredAfterUnknown:!1,browserStatus:`current`,recoveryCodes:[],totpEnrollment:null,errorMessage:null,errorReason:null,generation:0},Jf={externalIdentityConfiguration:null,externalIdentityConfigurationStatus:`idle`,passkeys:[],passkeysStatus:`idle`,security:null,securityStatus:`idle`,actionStatus:`idle`,errorMessage:null,errorCode:null,errorCodeInferred:!1};function Yf(e){let t=e,n=new Set,r=()=>n.forEach(e=>e());return{getState:()=>t,getInitialState:()=>e,setState:(e,n=!1)=>{t=n?e:{...t,...e},r()},subscribe:e=>(n.add(e),()=>n.delete(e))}}var Z=Yf(qf),Xf=Yf(Jf),Zf=Yf({leased:!1});function Q(e){let t=Object.prototype.hasOwnProperty.call(e,`errorMessage`)&&!Object.prototype.hasOwnProperty.call(e,`errorReason`);Z.setState(t?{...e,errorReason:null}:e)}function $(e){Xf.setState(e)}function Qf(e){return e instanceof q?e.message:e instanceof K?e.code===`cancelled`||e.code===`superseded`?``:e.message:typeof e==`object`&&e&&`name`in e&&e.name===`NotAllowedError`?`The passkey request was cancelled or denied.`:typeof e==`object`&&e&&`name`in e&&e.name===`AbortError`?``:`Hub is temporarily unavailable.`}function $f(e){return{errorMessage:Qf(e)||null,errorReason:e instanceof q?e.reason:null}}function ep(e){let t=Qf(e)||null;return e instanceof q?{errorMessage:t,errorCode:e.code,errorCodeInferred:e.inferred}:{errorMessage:t,errorCode:null,errorCodeInferred:!1}}function tp(e){return{errorMessage:e,errorCode:null,errorCodeInferred:!1}}var np={errorMessage:null,errorCode:null,errorCodeInferred:!1};function rp(e,t){return t instanceof q?{status:`refused`,reason:e,errorCode:t.code,wireErrorCode:t.wireCode,inferredErrorCode:t.inferred,errorMessage:t.message||null}:{status:`refused`,reason:e,errorCode:null,wireErrorCode:null,inferredErrorCode:!1,errorMessage:t===void 0?null:Qf(t)||null}}function ip(e,t){return{status:`refused`,reason:e,errorCode:null,wireErrorCode:null,inferredErrorCode:!1,errorMessage:t}}function ap(e){return e instanceof q&&(e.status===401||e.code===`session_invalid`)}function op(){let e=0;return{bump:()=>{e+=1},issue:()=>{let t=e;return()=>t===e}}}var sp=2e4,cp=6e4,lp=3e4,up=`Ryco state could not be synchronized.`,dp=`Another account change is still in progress.`,fp=`Sign in to change your account settings.`,pp=`The passkey could not be confirmed. Check your passkeys before relying on it.`,mp=`Your recovery codes were replaced but could not be shown. Your previous codes no longer work — generate a new set and save them.`,hp=`Two-factor setup started but its key could not be shown. Remove two-factor authentication and set it up again.`,gp=class{#e=null;#t=null;#n=0;#r=null;#i=null;#a=null;#o=null;#s=null;#c=null;#l=null;#u=null;#d=null;#f=0;#p=op();#m=op();#h=new Set;#g=!1;#_=null;#v=null;#y=null;#b=null;#x=null;#S=null;#C=0;#w=null;bootstrap(){if(this.#a)return this.#a;let e=this.#V(),t=X().restoreSession(e.signal).then(async e=>{Q({accountStatus:`authenticated`,account:e.account,session:e.session,errorMessage:null}),await this.refreshDirectory()}).catch(t=>{if(!e.signal.aborted){if(X().clearSessionMaterial(),ap(t))return X().getBootstrapAvailability(e.signal).catch(()=>!1).then(t=>{e.signal.aborted||Q({...qf,bootstrapAvailable:t})});Q({...qf,accountStatus:`unavailable`,...$f(t)})}}).finally(()=>{this.#e===e&&(this.#e=null),this.#a===t&&(this.#a=null)});return this.#a=t,t}async signIn(){let e=this.#V();Q({accountStatus:`authenticating`,errorMessage:null,recoveryCodes:[],totpEnrollment:null});try{let t=await X().signIn(e.signal);Q({accountStatus:`authenticated`,account:t.account,session:t.session}),await this.refreshDirectory()}catch(t){if(e.signal.aborted)return;Q({accountStatus:`signed-out`,...$f(t)})}finally{this.#e===e&&(this.#e=null)}}async signInWithExternalProvider(e){let t=this.#V();Q({accountStatus:`authenticating`,errorMessage:null,recoveryCodes:[],totpEnrollment:null});try{let n=await X().signInWithExternalProvider(e,t.signal);Q({accountStatus:`authenticated`,account:n.account,session:n.session}),await this.refreshDirectory()}catch(e){if(t.signal.aborted)return;Q({accountStatus:`signed-out`,...$f(e)})}finally{this.#e===t&&(this.#e=null)}}async redeemInvitation(e){return this.#T(t=>X().redeemInvitation(e,t))}async bootstrapOwner(e){return this.#T(t=>X().bootstrapOwner(e,t))}async adoptPublicBrowserIdentity(e,t=[]){this.#e?.abort(),this.#e=null,this.#p.bump(),this.#m.bump(),Q({accountStatus:`authenticated`,account:{id:e.account.id,displayName:e.account.displayName,role:e.activeSpace.role,createdAt:e.account.createdAt,disabledAt:e.account.disabledAt},session:{id:e.session.id,accountId:e.session.accountId,createdAt:e.session.createdAt,expiresAt:e.session.expiresAt,lastSeenAt:e.session.lastSeenAt,revokedAt:e.session.revokedAt,revocationReasonCode:e.session.revocationReasonCode},recoveryCodes:[...t],totpEnrollment:null,bootstrapAvailable:!1,errorMessage:null}),await this.refreshDirectory()}async#T(e){let t=this.#V();Q({accountStatus:`authenticating`,errorMessage:null,recoveryCodes:[],totpEnrollment:null});try{let n=await e(t.signal);Q({accountStatus:`authenticated`,account:n.account,session:n.session,recoveryCodes:n.recoveryCodes??[],bootstrapAvailable:!1}),await this.refreshDirectory()}catch(e){if(t.signal.aborted)return;Q({accountStatus:`signed-out`,...$f(e)})}finally{this.#e===t&&(this.#e=null)}}cancelAuthentication(){this.#e?.abort(),this.#e=null,this.#p.bump(),this.#m.bump(),Q({accountStatus:`signed-out`,errorMessage:null,recoveryCodes:[],totpEnrollment:null})}leaseRecoveryCodeDisplay(){let e=Symbol(`hosted-recovery-code-display-lease`);return this.#h.add(e),this.#E(),()=>{this.#h.delete(e)&&this.#D()}}#E(){let e=this.#h.size>0;Zf.getState().leased!==e&&Zf.setState({leased:e})}#D(){this.#g||(this.#g=!0,Promise.resolve().then(()=>{this.#g=!1,this.#E()}))}dismissRecoveryCodes(){Q({recoveryCodes:[]})}dismissTotpEnrollment(){this.#p.bump(),Q({totpEnrollment:null})}refreshPasskeys(e){let t=e?.force===!0;if(this.#v&&!t)return this.#v;let n=Z.getState();if(n.accountStatus!==`authenticated`)return Promise.resolve();t&&(this.#_?.abort(),this.#v=null);let r=new AbortController;this.#_=r;let i=this.#O(r,n.session?.id??null).finally(()=>{this.#_===r&&(this.#_=null),this.#v===i&&(this.#v=null)});return this.#v=i,Xf.getState().passkeys.length===0&&$({passkeysStatus:`loading`}),i}async#O(e,t){try{let n=await X().listPasskeys(e.signal);if(e.signal.aborted)return;if(!this.#F(e.signal,t)){this.#A();return}$({passkeys:n,passkeysStatus:`ready`,...np})}catch(n){if(e.signal.aborted)return;if(ap(n)){await this.#k(n);return}if(!this.#F(e.signal,t)){this.#A();return}$({passkeysStatus:`stale`,...ep(n)})}}async#k(e){await this.expireSession(e).catch(()=>void 0)}#A(){$({passkeys:[],passkeysStatus:`idle`})}refreshExternalIdentityConfiguration(e){let t=e?.force===!0;if(this.#S&&!t)return this.#S;t&&(this.#x?.abort(),this.#S=null);let n=this.#C,r=new AbortController;this.#x=r,Xf.getState().externalIdentityConfiguration===null&&$({externalIdentityConfigurationStatus:`loading`});let i=X().getExternalIdentityConfiguration(r.signal).then(e=>{r.signal.aborted||n!==this.#C||$({externalIdentityConfiguration:e,externalIdentityConfigurationStatus:`ready`})}).catch(()=>{r.signal.aborted||n!==this.#C||$({externalIdentityConfigurationStatus:`stale`})}).finally(()=>{this.#x===r&&(this.#x=null),this.#S===i&&(this.#S=null)});return this.#S=i,i}refreshAccountSecurity(e){let t=e?.force===!0;if(this.#b&&!t)return this.#b;let n=Z.getState();if(n.accountStatus!==`authenticated`)return Promise.resolve();t&&(this.#y?.abort(),this.#b=null);let r=new AbortController;this.#y=r;let i=this.#j(r,n.session?.id??null).finally(()=>{this.#y===r&&(this.#y=null),this.#b===i&&(this.#b=null)});return this.#b=i,Xf.getState().security===null&&$({securityStatus:`loading`}),i}async#j(e,t){try{let n=await X().getAccountSecurity(e.signal);if(e.signal.aborted)return;if(!this.#F(e.signal,t)){this.#M();return}$({security:n,securityStatus:`ready`})}catch(n){if(e.signal.aborted)return;if(ap(n)){await this.#k(n);return}if(!this.#F(e.signal,t)){this.#M();return}$({securityStatus:`stale`})}}#M(){$({security:null,securityStatus:`idle`})}async addPasskey(e){let t={result:null},n=Xf.getState().passkeys.length,r=await this.#P(`adding-passkey`,async n=>{let r=await X().addPasskey(e,n);return()=>{t.result=r}});if(r.status!==`committed`)return r;let i=t.result?.passkey??null;await this.refreshPasskeys({force:!0});let a=Xf.getState();return a.passkeysStatus===`ready`?(i?a.passkeys.some(e=>e.id===i.id):a.passkeys.length>n)?{status:`committed`,confirmation:`confirmed`,passkey:i}:($(tp(pp)),{status:`committed`,confirmation:`missing`,passkey:i}):{status:`committed`,confirmation:`unverified`,passkey:i}}async regenerateRecoveryCodes(e){let t=this.#m.issue(),n=this.#h.size>0,r=!1,i=!1,a=await this.#P(`regenerating-recovery-codes`,async a=>{let o=await X().regenerateRecoveryCodes(e,a);return r=!0,()=>{!n||!t()||(i=!0,Q({recoveryCodes:o}))}},`account`);return r&&!i&&this.#N(mp),a.status===`committed`?{status:`committed`,displayed:i}:a}#N(e){Z.getState().accountStatus===`authenticated`&&$(tp(e))}async revokePasskey(e){let t=await this.#P(`revoking-passkey`,async t=>(await X().revokePasskey(e,t),()=>void 0));return t.status===`committed`&&await this.refreshPasskeys({force:!0}),t}async setPassword(e){let t=await this.#P(`setting-password`,async t=>(await X().setPassword(e,t),()=>void 0));return t.status===`committed`&&await this.refreshAccountSecurity({force:!0}),t}async removePassword(e){let t=await this.#P(`removing-password`,async t=>(await X().removePassword(e,t),()=>void 0));return t.status===`committed`&&await this.refreshAccountSecurity({force:!0}),t}async beginTotpEnrollment(){let e=this.#p.issue(),t=!1,n=!1,r=await this.#P(`enrolling-totp`,async r=>{let i=await X().beginTotpEnrollment(r);return t=!0,()=>{e()&&(n=!0,Q({totpEnrollment:i}))}},`account`);return t&&!n&&this.#N(hp),r.status===`committed`?{status:`committed`,displayed:n}:r}async confirmTotpEnrollment(e){let t=await this.#P(`confirming-totp`,async t=>(await X().confirmTotpEnrollment(e,t),()=>{this.#p.bump(),Q({totpEnrollment:null})}));return t.status===`committed`&&await this.refreshAccountSecurity({force:!0}),t}async revokeTotp(e){let t=await this.#P(`revoking-totp`,async t=>(await X().revokeTotp(e,t),()=>{this.#p.bump(),Q({totpEnrollment:null})}));return t.status===`committed`&&await this.refreshAccountSecurity({force:!0}),t}async requestEmailVerification(e){let t=await this.#P(`requesting-email-verification`,async t=>(await X().requestEmailVerification(e,t),()=>void 0));return t.status===`committed`&&await this.refreshAccountSecurity({force:!0}),t}async connectExternalIdentity(e,t){let n=await this.#P(`connecting-external-identity`,async n=>(await X().connectExternalIdentity(e,t,n),()=>void 0));return n.status===`committed`&&await this.refreshAccountSecurity({force:!0}),n}cancelExternalIdentityConnection(e){this.cancelAccountAction(),X().cancelExternalIdentityConnection(e)}async finishBrowserExternalIdentityConnection(e,t){let n=await this.#P(`connecting-external-identity`,async n=>(await X().finishBrowserExternalIdentityConnection(e,t,n),()=>void 0));return n.status===`committed`&&await this.refreshAccountSecurity({force:!0}),n}async disconnectExternalIdentity(e,t){let n=!1,r=await this.#P(`disconnecting-external-identity`,async r=>{let i=await X().disconnectExternalIdentity(e,t,r);return()=>{n=i.signedOut}});return r.status===`committed`&&(n?await this.clearAccount(`signed-out`):await this.refreshAccountSecurity({force:!0})),r}cancelAccountAction(){this.#w&&(this.#w.abort(),this.#w=null,$({actionStatus:`idle`,...np}))}async#P(e,t,n=`session`){if(Xf.getState().actionStatus!==`idle`)return $(tp(dp)),ip(`busy`,dp);let r=Z.getState();if(r.accountStatus!==`authenticated`)return $(tp(fp)),ip(`signed-out`,fp);let i=r.session?.id??null,a=r.account?.id??null,o=new AbortController;this.#w=o,$({actionStatus:e,...np});try{let e=await t(o.signal);return(n===`account`?this.#I(o.signal,a):this.#F(o.signal,i))?(e(),$(np),{status:`committed`}):ip(o.signal.aborted?`cancelled`:`superseded`,null)}catch(e){return o.signal.aborted?ip(`cancelled`,null):ap(e)?(await this.#k(e),rp(`session-expired`,e)):this.#F(o.signal,i)?($(ep(e)),rp(`request-failed`,e)):rp(`superseded`,e)}finally{this.#w===o&&(this.#w=null,Xf.getState().actionStatus===e&&$({actionStatus:`idle`}))}}#F(e,t){let n=Z.getState();return!e.aborted&&n.accountStatus===`authenticated`&&(n.session?.id??null)===t}#I(e,t){let n=Z.getState();return!e.aborted&&n.accountStatus===`authenticated`&&(n.account?.id??null)===t}#L(){this.#C+=1,this.#x?.abort(),this.#x=null,this.#S=null,this.#p.bump(),this.#m.bump(),this.#_?.abort(),this.#_=null,this.#v=null,this.#y?.abort(),this.#y=null,this.#b=null,this.#w?.abort(),this.#w=null,Xf.setState(Jf,!0)}resetForTests(){this.#e?.abort(),this.#e=null,this.#U(),this.#n=0,this.#r?.abort(),this.#r=null,this.#i=null,this.#a=null,this.#G(),this.#s?.abort(),this.#s=null,this.#c=null,this.#l?.abort(),this.#l=null,this.#u=null,this.#d=null,this.#f+=1,this.#L(),this.#h.clear(),this.#E(),X().clearSessionMaterial(),Z.setState(qf,!0)}async signOut(){let e=this.#V();Q({accountStatus:`signing-out`,errorMessage:null});try{await X().signOut(e.signal)}catch{if(e.signal.aborted)return;X().clearSessionMaterial()}finally{this.#e===e&&(this.#e=null)}await this.clearAccount(`signed-out`)}async expireSession(e){X().clearSessionMaterial(),await this.clearAccount(`session-expired`),e instanceof q&&e.reason!==null&&Q($f(e))}suspendBrowser(e){let t=Z.getState();if(t.accountStatus===`authenticated`&&(this.#f+=1,this.#l?.abort(),this.#l=null,this.#u=null,this.#s?.abort(),this.#G(),this.#U(),this.#r?.abort(),this.#r=null,this.#i=null,Q({browserStatus:e===`offline`?`offline`:`suspended`,sessionStatus:t.sessionStatus===`delivery-unknown`?`delivery-unknown`:`stale`,sessionRecoveredAfterUnknown:!1,generation:t.generation+1}),t.selectedNode&&!this.#d)){let e=t.selectedNode.environmentId,n=Gf(e).catch(()=>void 0).finally(()=>{this.#d===n&&(this.#d=null)});this.#d=n}}resumeBrowser(){if(this.#u)return this.#u;let e=new AbortController;this.#l=e;let t=this.#R(e).finally(()=>{this.#u===t&&(this.#u=null),this.#l===e&&(this.#l=null)});return this.#u=t,t}async#R(e){let t=Z.getState();if(t.accountStatus!==`authenticated`)return;let n=this.#f+1;this.#f=n;let r=t.account?.id??null;Q({browserStatus:`checking-access`,errorMessage:null});try{let t=await X().restoreSession(e.signal);if(e.signal.aborted||this.#f!==n)return;if(Z.getState().accountStatus!==`authenticated`||t.account.id!==r){await this.expireSession();return}if(Q({account:t.account,session:t.session}),await this.refreshDirectory(),this.#f!==n)return;let i=Z.getState();if(i.accountStatus!==`authenticated`)return;if(i.directoryStatus!==`ready`){Q({browserStatus:`stale`});return}if(!i.selectedNode){Q({browserStatus:`current`});return}Q({browserStatus:`synchronizing`}),await this.#B(e.signal)}catch(t){if(e.signal.aborted||this.#f!==n)return;if(ap(t)){await this.expireSession(t);return}Q({browserStatus:`stale`,...$f(t)})}}async clearAccount(e){this.#f+=1,this.#l?.abort(),this.#l=null,this.#u=null,this.#s?.abort(),this.#s=null,this.#c=null,this.#U(),this.#G(),this.#r?.abort(),this.#r=null,this.#i=null,this.#e?.abort(),this.#e=null,this.#L();let t=Z.getState().selectedNode?.environmentId??null;Q({...qf,accountStatus:e,generation:Z.getState().generation+1}),t&&await Wf(t)}refreshDirectory(){if(this.#i)return this.#i;let e=new AbortController;this.#r=e;let t=this.#z(e).finally(()=>{this.#r===e&&(this.#r=null),this.#i===t&&(this.#i=null)});return this.#i=t,t}async#z(e){let t=Z.getState();if(t.accountStatus!==`authenticated`)return;let n=t.session?.id??null;this.#U(),Q({directoryStatus:t.nodes.length===0?`loading`:t.directoryStatus});try{let t=await X().listNodes(e.signal),r=Z.getState();if(e.signal.aborted||r.accountStatus!==`authenticated`||r.session?.id!==n)return;this.#n=0;let i=Z.getState(),a=i.browserStatus===`stale`,o=i.selectedNode,s=o?t.find(e=>e.id===o.id&&e.environmentId===o.environmentId)??null:null;if(o&&(!s||s.revokedAt!==null)){let e=i.generation+1;Q({nodes:t,directoryStatus:`ready`,selectionStatus:s&&s.revokedAt!==null?`revoked`:`authorization-removed`,effectiveRole:null,generation:e}),await this.#q(o.environmentId,e)}else Q({nodes:t,directoryStatus:`ready`,...s?{selectedNode:s,selectionStatus:s.presence.online?`online`:`offline`,effectiveRole:s.effectiveRole}:{}});this.#H(sp),a&&Y().timers.queueMicrotask(()=>{let e=Z.getState();e.accountStatus===`authenticated`&&e.directoryStatus===`ready`&&e.browserStatus===`stale`&&this.resumeBrowser()})}catch(t){if(e.signal.aborted)return;if(ap(t)){await this.expireSession(t);return}this.#n+=1,Q({directoryStatus:`stale`,effectiveRole:null,...$f(t)});let n=Math.min(cp,1e3*2**Math.min(this.#n,6));this.#H(n)}}async selectNode(e){let t=Z.getState();if(t.directoryStatus!==`ready`||t.browserStatus!==`current`)return;let n=t.nodes.find(t=>t.id===e);if(!n||n.revokedAt||t.selectedNode?.id===n.id&&t.selectedNode.environmentId===n.environmentId)return;let r=t.generation+1;Q({selectedNode:n,selectionStatus:n.presence.online?`online`:`offline`,effectiveRole:n.effectiveRole,transportStatus:`idle`,sessionStatus:`synchronizing`,sessionEstablished:!1,sessionRecoveredAfterUnknown:!1,errorMessage:null,generation:r}),this.#W(r);try{await Kf(n,t.selectedNode?.environmentId??null)}catch{this.#K(r)}}async returnToDirectory(e){let t=Z.getState(),n=t.selectedNode;if(!n)return;let r=e?.preserveTerminalSelection===!0;this.#f+=1,this.#l?.abort(),this.#l=null,this.#u=null,this.#s?.abort(),this.#s=null,this.#c=null,this.#G(),Q({selectedNode:null,selectionStatus:r?t.selectionStatus:`none`,effectiveRole:null,transportStatus:`idle`,sessionStatus:`closed`,sessionEstablished:!1,sessionRecoveredAfterUnknown:!1,browserStatus:t.browserStatus===`synchronizing`||t.browserStatus===`checking-access`?`current`:t.browserStatus,errorMessage:r?t.errorMessage:null,errorReason:r?t.errorReason??null:null,generation:t.generation+1}),await Wf(n.environmentId)}retrySelectedNode(){if(this.#c)return this.#c;let e=new AbortController;this.#s=e;let t=this.#B(e.signal).finally(()=>{this.#s===e&&(this.#s=null),this.#c===t&&(this.#c=null)});return this.#c=t,t}async#B(e){if(e.aborted||(await this.#d,e.aborted))return;let t=Z.getState(),n=t.selectedNode;if(!n||n.revokedAt!==null||t.accountStatus!==`authenticated`||t.directoryStatus!==`ready`||(t=Z.getState(),e.aborted||t.selectedNode?.id!==n.id||t.selectedNode.environmentId!==n.environmentId||t.selectedNode.revokedAt!==null||t.accountStatus!==`authenticated`||t.directoryStatus!==`ready`))return;let r=t.sessionStatus===`delivery-unknown`||Y().hasPendingRelayRequests(),i=t.generation+1;this.#G(),Q({selectionStatus:n.presence.online?`online`:`offline`,effectiveRole:n.effectiveRole,transportStatus:`idle`,sessionStatus:r?`delivery-unknown`:`synchronizing`,sessionEstablished:!1,sessionRecoveredAfterUnknown:!1,errorMessage:null,generation:i}),this.#W(i);try{await Kf(n,n.environmentId,e)}catch{if(e.aborted)return;this.#K(i)}}transportStatus(e,t){Z.getState().generation===e&&Q({transportStatus:t})}sessionStatus(e,t){let n=Z.getState();if(n.generation===e){if(n.sessionStatus===`delivery-unknown`&&t!==`closed`){Q({sessionRecoveredAfterUnknown:!1});return}Q({sessionStatus:t,sessionRecoveredAfterUnknown:!1})}}role(e,t){let n=Z.getState();n.generation===e&&Q({effectiveRole:n.directoryStatus===`ready`?t:null})}failure(e,t){let n=Z.getState();if(n.generation!==e)return;let r=t.kind===`revoked`?`revoked`:t.kind===`authorization-removed`?`authorization-removed`:t.kind===`incompatible`?`incompatible`:n.selectedNode?.presence.online?n.selectionStatus:`offline`;t.retryable||this.#G(),Q({selectionStatus:r,effectiveRole:t.retryable?n.effectiveRole:null,transportStatus:t.retryable?`reconnecting`:`terminal-failure`,sessionStatus:n.sessionStatus===`delivery-unknown`?`delivery-unknown`:`stale`,browserStatus:!t.retryable&&n.browserStatus===`synchronizing`?`current`:n.browserStatus,errorMessage:_p(t)})}markDeliveryUnknown(e){Z.getState().generation===e&&Q({sessionStatus:`delivery-unknown`,sessionRecoveredAfterUnknown:!1})}connectionClosed(e){let t=Z.getState();t.generation===e&&t.transportStatus!==`terminal-failure`&&Q({transportStatus:`reconnecting`,sessionStatus:t.sessionStatus===`delivery-unknown`?`delivery-unknown`:`stale`,sessionRecoveredAfterUnknown:!1})}markSessionReady(e){let t=Z.getState();if(t.selectedNode?.environmentId===e){if(this.#G(),t.sessionStatus===`delivery-unknown`){Q({sessionEstablished:!0,sessionRecoveredAfterUnknown:!0,browserStatus:t.browserStatus===`synchronizing`?`current`:t.browserStatus});return}Q({sessionStatus:`ready`,sessionEstablished:!0,sessionRecoveredAfterUnknown:!1,browserStatus:t.browserStatus===`synchronizing`?`current`:t.browserStatus})}}markSessionReplaying(e){let t=Z.getState();if(t.selectedNode?.environmentId===e){if(t.sessionStatus===`delivery-unknown`){Q({sessionRecoveredAfterUnknown:!1});return}Q({sessionStatus:`replaying`,browserStatus:t.browserStatus===`current`||t.browserStatus===`synchronizing`?`synchronizing`:t.browserStatus})}}reportShellSnapshotFailure(e){let t=Z.getState();if(t.selectedNode?.environmentId===e){if(t.sessionEstablished){console.warn(`hosted_snapshot_reconciliation_failed`);return}this.#K(t.generation)}}acknowledgeDeliveryUnknown(){let e=Z.getState();e.sessionStatus!==`delivery-unknown`||!e.sessionRecoveredAfterUnknown||Q({sessionStatus:`ready`,sessionRecoveredAfterUnknown:!1})}#V(){this.#e?.abort();let e=new AbortController;return this.#e=e,e}#H(e){this.#U();let t=Y();if(!t.isForeground()){t.subscribeForeground(()=>{t.isForeground()&&(this.#U(),this.refreshDirectory())});return}this.#t=t.timers.setTimeout(()=>void this.refreshDirectory(),e)}#U(){this.#t&&Y().timers.clearTimeout(this.#t),this.#t=null}#W(e){this.#G();let t=Z.getState();t.generation!==e||t.sessionEstablished||(this.#o=Y().timers.setTimeout(()=>this.#K(e),lp))}#G(){this.#o&&Y().timers.clearTimeout(this.#o),this.#o=null}#K(e){let t=Z.getState();t.generation!==e||t.sessionEstablished||(this.#G(),Q({transportStatus:`terminal-failure`,sessionStatus:t.sessionStatus===`delivery-unknown`?`delivery-unknown`:`stale`,sessionEstablished:!1,sessionRecoveredAfterUnknown:!1,browserStatus:t.browserStatus===`synchronizing`?`current`:t.browserStatus,errorMessage:up}))}async#q(e,t){this.#G(),await Wf(e),Z.getState().generation===t&&Q({selectedNode:null,transportStatus:`idle`,sessionStatus:`closed`,sessionEstablished:!1,sessionRecoveredAfterUnknown:!1})}};function _p(e){switch(e.kind){case`offline`:return`The selected node is offline. Ryco will reconnect when it becomes available.`;case`revoked`:return`Access to the selected node was revoked.`;case`authorization-removed`:return`Your authorization for the selected node was removed.`;case`incompatible`:return`The selected node uses an incompatible relay protocol version.`;case`draining`:return`Hub is draining connections. Ryco will retry shortly.`;case`slow-consumer`:return`The relay closed a slow connection. Ryco will reconnect.`;case`authentication`:return`The relay authentication attempt expired or was rejected.`;case`rate-limited`:return`Relay attempts are temporarily rate limited.`;default:return e.retryable?`The relay connection was interrupted. Ryco is reconnecting.`:`The relay connection could not be established.`}}var vp=new gp;function yp(e,t){Z.getState().generation===t&&vp.markSessionReady(e)}function bp(e,t){Z.getState().generation===t&&vp.markSessionReplaying(e)}function xp(e,t){Z.getState().generation===t&&vp.reportShellSnapshotFailure(e)}var Sp={idle:`idle`,"requesting-ticket":`requesting ticket`,connecting:`connecting`,authenticating:`authenticating`,"opening-channel":`opening channel`,online:`online`,reconnecting:`Reconnecting`,draining:`draining`,"terminal-failure":`terminal failure`},Cp={unavailable:`Online`,negotiating:`Securing`,verified:`Encrypted`,unverified:`Not verified`,"web-unsigned":`Browser encrypted`,legacy:`Legacy`};function wp(e){let{browserStatus:t,sessionStatus:n,selectionStatus:r,transportStatus:i}=e,a=e.e2eeStatus??`unavailable`;return t===`offline`?`Offline`:t===`checking-access`?`Checking access`:t===`synchronizing`?`Synchronizing`:t===`suspended`||t===`stale`?`Stale`:n===`delivery-unknown`?`Delivery unknown`:r===`authorization-removed`?`Authorization removed`:r===`revoked`?`Revoked`:r===`incompatible`?`Incompatible`:i===`online`&&n===`ready`?Cp[a]:i===`reconnecting`?`Reconnecting`:r===`offline`?`Offline`:Sp[i]}var Tp={Offline:{shortLabel:`Offline`,connected:!1,guarantee:`none`},"Checking access":{shortLabel:`Checking`,connected:!1,guarantee:`none`},Synchronizing:{shortLabel:`Syncing`,connected:!1,guarantee:`none`},Stale:{shortLabel:`Stale`,connected:!1,guarantee:`none`},"Delivery unknown":{shortLabel:`Unconfirmed`,connected:!1,guarantee:`none`},"Authorization removed":{shortLabel:`No access`,connected:!1,guarantee:`none`},Revoked:{shortLabel:`Revoked`,connected:!1,guarantee:`none`},Incompatible:{shortLabel:`Incompatible`,connected:!1,guarantee:`none`},Online:{shortLabel:`Online`,connected:!0,guarantee:`none`},Encrypted:{shortLabel:`Encrypted`,connected:!0,guarantee:`e2ee`},"Browser encrypted":{shortLabel:`Unsigned web`,connected:!0,guarantee:`web`},Legacy:{shortLabel:`Legacy`,connected:!0,guarantee:`legacy`},"Not verified":{shortLabel:`Not verified`,connected:!1,guarantee:`none`},Securing:{shortLabel:`Securing`,connected:!1,guarantee:`none`},Reconnecting:{shortLabel:`Reconnecting`,connected:!1,guarantee:`none`},idle:{shortLabel:`Idle`,connected:!1,guarantee:`none`},"requesting ticket":{shortLabel:`Preparing`,connected:!1,guarantee:`none`},connecting:{shortLabel:`Connecting`,connected:!1,guarantee:`none`},authenticating:{shortLabel:`Verifying`,connected:!1,guarantee:`none`},"opening channel":{shortLabel:`Opening`,connected:!1,guarantee:`none`},online:{shortLabel:`Not ready`,connected:!1,guarantee:`none`},draining:{shortLabel:`Closing`,connected:!1,guarantee:`none`},"terminal failure":{shortLabel:`Failed`,connected:!1,guarantee:`none`}};Object.keys(Tp);function Ep(e){return Tp[wp(e)]}function Dp(e){return e.hosted?!e.fresh||e.browserCurrent===!1||e.sessionReady===!1?{hosted:!0,allowed:!1,reason:`This action is unavailable while Hub authorization or the relay is stale.`}:td(e.role,e.method,!0)?{hosted:!0,allowed:!0,reason:null}:{hosted:!0,allowed:!1,reason:`This action is unavailable for your role on the selected node.`}:{hosted:!1,allowed:!0,reason:null}}export{sl as $,Ku as A,pn as At,jl as B,nn as Bt,pd as C,en as Ct,Cu as D,dn as Dt,Su as E,hn as Et,qu as F,cn as Ft,Pl as G,Ht as Gt,Hl as H,$t as Ht,Fu as I,ln as It,kl as J,Fl as K,Ut as Kt,Zu as L,sn as Lt,tu as M,vn as Mt,Ju as N,bn as Nt,bu as O,fn as Ot,Xu as P,an as Pt,ll as Q,yl as R,on as Rt,fd as S,un as St,xu as T,yn as Tt,Ml as U,Zt as Ut,Ll as V,Wt as Vt,Nl as W,Qt as Wt,Vl as X,Il as Y,cl as Z,q as _,Un as _t,Xf as a,el as at,sf as b,sr as bt,Zf as c,ol as ct,xp as d,ao as dt,qc as et,If as f,Ja as ft,Af as g,Gn as gt,Pf as h,Wn as ht,up as i,U as it,Yu as j,_n as jt,au as k,mn as kt,yp as l,Sc as lt,Y as m,Tr as mt,Ep as n,al as nt,vp as o,rl as ot,X as p,va as pt,Al as q,wp as r,il as rt,Z as s,Qc as st,Dp as t,Gc as tt,bp as u,bc as ut,rf as v,Yn as vt,td as w,gn as wt,nd as x,rr as xt,nf as y,ir as yt,Kl as z,rn as zt};