@scalar/api-client 2.38.2 → 2.38.4

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 (263) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/{AddressBar-B4xnl66I.js → AddressBar-BOZGKSoz.js} +4 -4
  3. package/dist/{AddressBar-B4xnl66I.js.map → AddressBar-BOZGKSoz.js.map} +1 -1
  4. package/dist/{App-CvClwSlM.js → App-Ckirvnv1.js} +2 -2
  5. package/dist/{App-CvClwSlM.js.map → App-Ckirvnv1.js.map} +1 -1
  6. package/dist/{App-BVH4lIe8.js → App-DHBmpWJI.js} +4 -4
  7. package/dist/{App-BVH4lIe8.js.map → App-DHBmpWJI.js.map} +1 -1
  8. package/dist/{CodeInput-C-igR77V.js → CodeInput-BTN8cC5h.js} +2 -2
  9. package/dist/{CodeInput-C-igR77V.js.map → CodeInput-BTN8cC5h.js.map} +1 -1
  10. package/dist/{Collection-4MT9WmDD.js → Collection-BsAG7ms5.js} +2 -2
  11. package/dist/{Collection-4MT9WmDD.js.map → Collection-BsAG7ms5.js.map} +1 -1
  12. package/dist/{CollectionAuthentication-MHWQpw74.js → CollectionAuthentication-BMGhRnpo.js} +5 -5
  13. package/dist/{CollectionAuthentication-MHWQpw74.js.map → CollectionAuthentication-BMGhRnpo.js.map} +1 -1
  14. package/dist/{CollectionEnvironment-Dw35vIqo.js → CollectionEnvironment-BY9Gcnln.js} +4 -4
  15. package/dist/{CollectionEnvironment-Dw35vIqo.js.map → CollectionEnvironment-BY9Gcnln.js.map} +1 -1
  16. package/dist/{CollectionOverview-TUdDIu5f.js → CollectionOverview-C3GvN8GY.js} +3 -3
  17. package/dist/{CollectionOverview-TUdDIu5f.js.map → CollectionOverview-C3GvN8GY.js.map} +1 -1
  18. package/dist/{CollectionServers-BrjTCfDe.js → CollectionServers-DuOLysNB.js} +5 -5
  19. package/dist/{CollectionServers-BrjTCfDe.js.map → CollectionServers-DuOLysNB.js.map} +1 -1
  20. package/dist/{CollectionSettings-HVSlp2Gv.js → CollectionSettings-FtXNetOh.js} +2 -2
  21. package/dist/{CollectionSettings-HVSlp2Gv.js.map → CollectionSettings-FtXNetOh.js.map} +1 -1
  22. package/dist/{CommandPalette-CL8k4CoN.js → CommandPalette-BxoEK8TY.js} +2 -2
  23. package/dist/{CommandPalette-CL8k4CoN.js.map → CommandPalette-BxoEK8TY.js.map} +1 -1
  24. package/dist/{Cookies-DbOKTi1f.js → Cookies-BYTv1YIA.js} +8 -8
  25. package/dist/{Cookies-DbOKTi1f.js.map → Cookies-BYTv1YIA.js.map} +1 -1
  26. package/dist/{DataTableInput-yaU5g-kP.js → DataTableInput-RydMDjn2.js} +2 -2
  27. package/dist/{DataTableInput-yaU5g-kP.js.map → DataTableInput-RydMDjn2.js.map} +1 -1
  28. package/dist/{Environment-DJatRQIg.js → Environment-BIxG7DaO.js} +5 -5
  29. package/dist/{Environment-DJatRQIg.js.map → Environment-BIxG7DaO.js.map} +1 -1
  30. package/dist/{EnvironmentModal-DBEJ4Kzj.js → EnvironmentModal-C0lYytkh.js} +2 -2
  31. package/dist/{EnvironmentModal-DBEJ4Kzj.js.map → EnvironmentModal-C0lYytkh.js.map} +1 -1
  32. package/dist/{Form-CSKzyHGO.js → Form-KFcdRQp1.js} +3 -3
  33. package/dist/{Form-CSKzyHGO.js.map → Form-KFcdRQp1.js.map} +1 -1
  34. package/dist/{ImportCollection-DfX1UQ5u.js → ImportCollection-CGjySEzP.js} +2 -2
  35. package/dist/{ImportCollection-DfX1UQ5u.js.map → ImportCollection-CGjySEzP.js.map} +1 -1
  36. package/dist/{MainLayout-BEFMl1ud.js → MainLayout-BnLwst16.js} +3 -3
  37. package/dist/{MainLayout-BEFMl1ud.js.map → MainLayout-BnLwst16.js.map} +1 -1
  38. package/dist/{Modal-sQ9vH6MN.js → Modal-CTZ8UNds.js} +2 -2
  39. package/dist/{Modal-sQ9vH6MN.js.map → Modal-CTZ8UNds.js.map} +1 -1
  40. package/dist/{Request-gscRsGQ8.js → Request-d0RY0ZhC.js} +10 -10
  41. package/dist/{Request-gscRsGQ8.js.map → Request-d0RY0ZhC.js.map} +1 -1
  42. package/dist/{RequestAuth-BzBfIysT.js → RequestAuth-1cRH3DDn.js} +3 -3
  43. package/dist/{RequestAuth-BzBfIysT.js.map → RequestAuth-1cRH3DDn.js.map} +1 -1
  44. package/dist/{RequestRoot-3Bj8JZD-.js → RequestRoot-pW0yXesG.js} +7 -7
  45. package/dist/{RequestRoot-3Bj8JZD-.js.map → RequestRoot-pW0yXesG.js.map} +1 -1
  46. package/dist/{RequestSection-HhdJj9hW.js → RequestSection-D2BLvDTr.js} +4 -4
  47. package/dist/{RequestSection-HhdJj9hW.js.map → RequestSection-D2BLvDTr.js.map} +1 -1
  48. package/dist/{ResponseSection-DMJ0tw8E.js → ResponseSection-B_YF7l_E.js} +3 -3
  49. package/dist/{ResponseSection-DMJ0tw8E.js.map → ResponseSection-B_YF7l_E.js.map} +1 -1
  50. package/dist/{Server-DnA_BzPS.js → Server-CEKGIEfE.js} +2 -2
  51. package/dist/{Server-DnA_BzPS.js.map → Server-CEKGIEfE.js.map} +1 -1
  52. package/dist/{Settings-CYZzdJPO.js → Settings-BaPvhJ8Y.js} +2 -2
  53. package/dist/{Settings-CYZzdJPO.js.map → Settings-BaPvhJ8Y.js.map} +1 -1
  54. package/dist/{Sidebar-C6AdX6-N.js → Sidebar-CRxdl38Y.js} +2 -2
  55. package/dist/{Sidebar-C6AdX6-N.js.map → Sidebar-CRxdl38Y.js.map} +1 -1
  56. package/dist/components/AddressBar/AddressBar.vue.d.ts +1 -1
  57. package/dist/components/AddressBar/index.js +3 -3
  58. package/dist/components/CodeInput/CodeInput.vue.d.ts +1 -1
  59. package/dist/components/CodeInput/codeVariableWidget.d.ts +1 -1
  60. package/dist/components/CodeInput/index.js +1 -1
  61. package/dist/components/CommandPalette/index.js +1 -1
  62. package/dist/components/DataTable/DataTableInput.vue.d.ts +2 -2
  63. package/dist/components/DataTable/index.js +2 -2
  64. package/dist/components/Form/LabelInput.vue.d.ts +1 -1
  65. package/dist/components/ImportCollection/index.js +1 -1
  66. package/dist/components/ImportCollection/utils/import-collection.d.ts +1 -1
  67. package/dist/components/ImportCollection/utils/workspace-store-is-empty.d.ts +1 -1
  68. package/dist/components/Server/ServerVariablesForm.vue.d.ts +1 -1
  69. package/dist/components/Server/index.js +1 -1
  70. package/dist/components/Sidebar/index.js +1 -1
  71. package/dist/components/index.d.ts +2 -2
  72. package/dist/components/index.js +4 -4
  73. package/dist/{components-CSxJTn6F.js → components-B0BwUDFw.js} +2 -2
  74. package/dist/{components-CSxJTn6F.js.map → components-B0BwUDFw.js.map} +1 -1
  75. package/dist/get-resolved-url-SybDPV0U.js +85 -0
  76. package/dist/get-resolved-url-SybDPV0U.js.map +1 -0
  77. package/dist/{get-server-url-o3On8CEr.js → get-server-url-UVN-dx79.js} +1 -1
  78. package/dist/{get-server-url-o3On8CEr.js.map → get-server-url-UVN-dx79.js.map} +1 -1
  79. package/dist/hooks/useSidebar.d.ts +1 -1
  80. package/dist/index.d.ts +2 -2
  81. package/dist/index.js +5 -5
  82. package/dist/layouts/App/create-api-client-app.d.ts +9 -9
  83. package/dist/layouts/App/index.js +3 -3
  84. package/dist/layouts/Modal/create-api-client-modal.d.ts +1 -1
  85. package/dist/layouts/Modal/index.d.ts +1 -1
  86. package/dist/layouts/Modal/index.js +1 -1
  87. package/dist/layouts/Web/create-api-client-web.d.ts +9 -9
  88. package/dist/layouts/Web/index.js +4 -4
  89. package/dist/libs/create-client.d.ts +3 -3
  90. package/dist/libs/environment-parser.d.ts +1 -1
  91. package/dist/libs/get-request-uid-by-path-method.d.ts +1 -1
  92. package/dist/libs/hot-keys.d.ts +1 -1
  93. package/dist/libs/index.d.ts +1 -1
  94. package/dist/libs/index.js +1 -1
  95. package/dist/libs/local-storage.d.ts +1 -1
  96. package/dist/libs/send-request/create-request-operation.d.ts +3 -3
  97. package/dist/{operation-block-BnMIKAOh.js → operation-block-B1B3lJPx.js} +67 -17
  98. package/dist/operation-block-B1B3lJPx.js.map +1 -0
  99. package/dist/{operation-code-sample-ZUTueV3v.js → operation-code-sample-DOzAPxLQ.js} +22 -10
  100. package/dist/operation-code-sample-DOzAPxLQ.js.map +1 -0
  101. package/dist/plugins/hooks/usePluginManager.d.ts +1 -1
  102. package/dist/{request-block-DwsGy64Q.js → request-block-C1kLLMEd.js} +4 -4
  103. package/dist/{request-block-DwsGy64Q.js.map → request-block-C1kLLMEd.js.map} +1 -1
  104. package/dist/{scalar-address-bar-block--Vs6IBU1.js → scalar-address-bar-block-BbysOhkE.js} +2 -2
  105. package/dist/{scalar-address-bar-block--Vs6IBU1.js.map → scalar-address-bar-block-BbysOhkE.js.map} +1 -1
  106. package/dist/{scalar-auth-selector-block-DI3DLag9.js → scalar-auth-selector-block-Bs79QOMA.js} +12 -9
  107. package/dist/scalar-auth-selector-block-Bs79QOMA.js.map +1 -0
  108. package/dist/store/collections.d.ts +1 -1
  109. package/dist/store/environment.d.ts +1 -1
  110. package/dist/store/events.d.ts +8 -8
  111. package/dist/store/import-spec.d.ts +2 -2
  112. package/dist/store/index.js +1 -1
  113. package/dist/store/request-example.d.ts +1 -1
  114. package/dist/store/requests.d.ts +1 -1
  115. package/dist/store/security-schemes.d.ts +1 -1
  116. package/dist/store/servers.d.ts +1 -1
  117. package/dist/store/store.d.ts +7 -7
  118. package/dist/store/tags.d.ts +1 -1
  119. package/dist/store/workspace.d.ts +1 -1
  120. package/dist/{store-DpSUVhjp.js → store-DnlAQK5d.js} +15 -15
  121. package/dist/{store-DpSUVhjp.js.map → store-DnlAQK5d.js.map} +1 -1
  122. package/dist/style.css +1 -1
  123. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +3 -3
  124. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
  125. package/dist/v2/blocks/operation-block/components/Header.vue.d.ts +2 -2
  126. package/dist/v2/blocks/operation-block/helpers/apply-allow-reserved-to-url.d.ts +6 -0
  127. package/dist/v2/blocks/operation-block/helpers/apply-allow-reserved-to-url.d.ts.map +1 -0
  128. package/dist/v2/blocks/operation-block/helpers/build-request-body.d.ts.map +1 -1
  129. package/dist/v2/blocks/operation-block/helpers/build-request-parameters.d.ts +1 -0
  130. package/dist/v2/blocks/operation-block/helpers/build-request-parameters.d.ts.map +1 -1
  131. package/dist/v2/blocks/operation-block/helpers/build-request-security.d.ts +2 -2
  132. package/dist/v2/blocks/operation-block/helpers/build-request.d.ts +2 -2
  133. package/dist/v2/blocks/operation-block/helpers/build-request.d.ts.map +1 -1
  134. package/dist/v2/blocks/operation-block/helpers/get-resolved-url.d.ts +2 -1
  135. package/dist/v2/blocks/operation-block/helpers/get-resolved-url.d.ts.map +1 -1
  136. package/dist/v2/blocks/operation-block/helpers/har-to-fetch-response.d.ts +1 -1
  137. package/dist/v2/blocks/operation-block/helpers/send-request.d.ts +1 -1
  138. package/dist/v2/blocks/operation-block/index.js +11 -11
  139. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts +2 -2
  140. package/dist/v2/blocks/operation-code-sample/helpers/find-client.d.ts +1 -1
  141. package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.d.ts +1 -1
  142. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts +1 -1
  143. package/dist/v2/blocks/operation-code-sample/helpers/get-clients.d.ts +2 -2
  144. package/dist/v2/blocks/operation-code-sample/helpers/get-secrets.d.ts +1 -1
  145. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts +1 -1
  146. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.d.ts.map +1 -1
  147. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.d.ts +1 -1
  148. package/dist/v2/blocks/operation-code-sample/index.js +1 -1
  149. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts +4 -4
  150. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.d.ts +1 -1
  151. package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts +1 -1
  152. package/dist/v2/blocks/request-block/helpers/create-parameter-handlers.d.ts +1 -1
  153. package/dist/v2/blocks/request-block/helpers/get-default-headers.d.ts.map +1 -1
  154. package/dist/v2/blocks/request-block/helpers/get-form-body-rows.d.ts +1 -1
  155. package/dist/v2/blocks/request-block/index.js +5 -5
  156. package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts +1 -1
  157. package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.d.ts +1 -1
  158. package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.d.ts +1 -1
  159. package/dist/v2/blocks/response-block/index.js +2 -2
  160. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts +1 -1
  161. package/dist/v2/blocks/scalar-address-bar-block/index.js +1 -1
  162. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts +3 -3
  163. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts +1 -1
  164. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts +2 -2
  165. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.d.ts +1 -1
  166. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts +1 -1
  167. package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts.map +1 -1
  168. package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.d.ts +1 -1
  169. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts +2 -2
  170. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts.map +1 -1
  171. package/dist/v2/blocks/scalar-auth-selector-block/index.js +3 -3
  172. package/dist/v2/components/code-input/CodeInput.vue.d.ts +1 -1
  173. package/dist/v2/components/data-table/DataTableInput.vue.d.ts +1 -1
  174. package/dist/v2/components/data-table/DataTableInputSelect.vue.d.ts +1 -1
  175. package/dist/v2/components/server/ServerDropdown.vue.d.ts +1 -1
  176. package/dist/v2/components/sidebar/Sidebar.vue.d.ts +1 -1
  177. package/dist/v2/constants.d.ts +3 -0
  178. package/dist/v2/constants.d.ts.map +1 -0
  179. package/dist/v2/features/app/App.vue.d.ts +3 -3
  180. package/dist/v2/features/app/components/AppSidebar.vue.d.ts +1 -1
  181. package/dist/v2/features/app/components/index.js +4 -4
  182. package/dist/v2/features/app/helpers/create-api-client-app.d.ts +3 -3
  183. package/dist/v2/features/app/helpers/get-route-param.d.ts +1 -1
  184. package/dist/v2/features/app/helpers/routes.d.ts +3 -3
  185. package/dist/v2/features/app/index.d.ts +5 -5
  186. package/dist/v2/features/app/index.js +14 -14
  187. package/dist/v2/features/app/index.js.map +1 -1
  188. package/dist/v2/features/collection/DocumentCollection.vue.d.ts +1 -1
  189. package/dist/v2/features/collection/OperationCollection.vue.d.ts +1 -1
  190. package/dist/v2/features/collection/WorkspaceCollection.vue.d.ts +1 -1
  191. package/dist/v2/features/collection/components/Authentication.vue.d.ts +4 -4
  192. package/dist/v2/features/collection/components/Authentication.vue.d.ts.map +1 -1
  193. package/dist/v2/features/collection/components/Cookies.vue.d.ts +4 -4
  194. package/dist/v2/features/collection/components/Editor/Editor.vue.d.ts +4 -4
  195. package/dist/v2/features/collection/components/Environment.vue.d.ts +4 -4
  196. package/dist/v2/features/collection/components/Overview.vue.d.ts +4 -4
  197. package/dist/v2/features/collection/components/Servers.vue.d.ts +4 -4
  198. package/dist/v2/features/collection/components/Settings.vue.d.ts +4 -4
  199. package/dist/v2/features/collection/components/Tabs.vue.d.ts +1 -1
  200. package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts +45 -10
  201. package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts.map +1 -1
  202. package/dist/v2/features/editor/helpers/json/create-json-model.d.ts +1 -1
  203. package/dist/v2/features/editor/helpers/yaml/create-yaml-model.d.ts +1 -1
  204. package/dist/v2/features/editor/helpers/yaml/get-yaml-node-range-from-path.d.ts +1 -1
  205. package/dist/v2/features/editor/hooks/use-editor.d.ts +1 -1
  206. package/dist/v2/features/editor/hooks/use-json-pointer-link-support.d.ts +1 -1
  207. package/dist/v2/features/modal/Modal.vue.d.ts +1 -1
  208. package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts +2 -2
  209. package/dist/v2/features/modal/hooks/use-modal-sidebar.d.ts +1 -1
  210. package/dist/v2/features/modal/index.js +10 -10
  211. package/dist/v2/features/modal/modal-events.d.ts +1 -1
  212. package/dist/v2/features/operation/Operation.vue.d.ts +2 -2
  213. package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
  214. package/dist/v2/features/operation/helpers/get-selected-security.d.ts +6 -1
  215. package/dist/v2/features/operation/helpers/get-selected-security.d.ts.map +1 -1
  216. package/dist/v2/features/operation/index.js +10 -10
  217. package/dist/v2/features/search/helpers/create-fuse-instance.d.ts +1 -1
  218. package/dist/v2/features/search/helpers/create-search-index.d.ts +1 -1
  219. package/dist/v2/helpers/get-active-proxy-url.d.ts +1 -1
  220. package/dist/v2/helpers/get-tab-details.d.ts +1 -1
  221. package/dist/v2/helpers/handle-hotkeys.d.ts +1 -1
  222. package/dist/v2/hooks/use-global-hot-keys.d.ts +1 -1
  223. package/dist/views/Collection/components/EnvironmentForm.vue.d.ts +1 -1
  224. package/dist/views/Collection/components/MarkdownInput.vue.d.ts +1 -1
  225. package/dist/views/Components/CodeSnippet/CodeSnippet.vue.d.ts +1 -1
  226. package/dist/views/Components/CodeSnippet/helpers/get-har-request.d.ts +1 -1
  227. package/dist/views/Components/CodeSnippet/helpers/get-snippet.d.ts +1 -1
  228. package/dist/views/Environment/EnvironmentVariableDropdown.vue.d.ts +1 -1
  229. package/dist/views/Environment/handle-drag.d.ts +1 -1
  230. package/dist/views/Request/Request.vue.d.ts +1 -1
  231. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.d.ts +1 -1
  232. package/dist/views/Request/RequestSection/RequestAuth/OAuthScopesInput.vue.d.ts +1 -1
  233. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.d.ts +1 -1
  234. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue.d.ts +1 -1
  235. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTableInput.vue.d.ts +2 -2
  236. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthTab.vue.d.ts +1 -1
  237. package/dist/views/Request/RequestSection/RequestAuth/helpers/restore-auth-from-local-storage.d.ts +1 -1
  238. package/dist/views/Request/RequestSection/RequestAuth/index.js +3 -3
  239. package/dist/views/Request/RequestSection/RequestBody.vue.d.ts +1 -1
  240. package/dist/views/Request/RequestSection/RequestCodeExample.vue.d.ts +1 -1
  241. package/dist/views/Request/RequestSection/RequestParams.vue.d.ts +1 -1
  242. package/dist/views/Request/RequestSection/RequestPathParams.vue.d.ts +1 -1
  243. package/dist/views/Request/RequestSection/RequestSection.vue.d.ts +1 -1
  244. package/dist/views/Request/RequestSection/RequestTable.vue.d.ts +1 -1
  245. package/dist/views/Request/RequestSection/helpers/update-scheme.d.ts +1 -1
  246. package/dist/views/Request/RequestSection/index.js +4 -4
  247. package/dist/views/Request/RequestSidebarItem.vue.d.ts +1 -1
  248. package/dist/views/Request/RequestSidebarItemMenu.vue.d.ts +3 -3
  249. package/dist/views/Request/RequestSubpageHeader.vue.d.ts +1 -1
  250. package/dist/views/Request/ResponseSection/ResponseBodyPreview.vue.d.ts +1 -1
  251. package/dist/views/Request/ResponseSection/ResponseSection.vue.d.ts +1 -1
  252. package/dist/views/Request/ResponseSection/index.js +3 -3
  253. package/dist/views/Request/components/index.js +1 -1
  254. package/dist/views/Request/handle-drag.d.ts +2 -2
  255. package/dist/views/Request/libs/auth.d.ts +1 -1
  256. package/dist/views/Request/libs/oauth2.d.ts +1 -1
  257. package/dist/views/Request/libs/watch-mode.d.ts +2 -2
  258. package/package.json +12 -12
  259. package/dist/get-resolved-url-BUCwrBzc.js +0 -30
  260. package/dist/get-resolved-url-BUCwrBzc.js.map +0 -1
  261. package/dist/operation-block-BnMIKAOh.js.map +0 -1
  262. package/dist/operation-code-sample-ZUTueV3v.js.map +0 -1
  263. package/dist/scalar-auth-selector-block-DI3DLag9.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scalar-auth-selector-block-Bs79QOMA.js","names":["$attrs"],"sources":["../src/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue","../src/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue","../src/v2/blocks/scalar-auth-selector-block/helpers/is-auth-optional.ts","../src/v2/blocks/scalar-auth-selector-block/helpers/auth-options.ts","../src/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.ts","../src/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue","../src/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue","../src/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue","../src/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue","../src/v2/blocks/scalar-auth-selector-block/helpers/oauth.ts","../src/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue","../src/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue","../src/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue","../src/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue","../src/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.ts","../src/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.ts","../src/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue","../src/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue","../src/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue","../src/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue","../src/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue","../src/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue","../src/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue","../src/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue","../src/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.ts","../src/v2/blocks/scalar-auth-selector-block/helpers/merge-security.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarButton, ScalarModal } from '@scalar/components'\n\ndefineProps<{\n state: { open: boolean; show: () => void; hide: () => void }\n label: string\n}>()\n\nconst emit = defineEmits<{\n (e: 'close'): void\n (e: 'delete'): void\n}>()\n\nconst deleteScheme = () => {\n emit('delete')\n}\n</script>\n<template>\n <ScalarModal\n size=\"xxs\"\n :state=\"state\"\n title=\"Delete Security Scheme\">\n <p class=\"text-c-2 mb-4 text-sm leading-normal\">\n This cannot be undone. You're about to delete the\n {{ label }} security scheme from the collection.\n </p>\n <div class=\"flex justify-between gap-2\">\n <ScalarButton\n class=\"flex h-8 cursor-pointer items-center gap-1.5 px-3 shadow-none focus:outline-none\"\n type=\"button\"\n variant=\"outlined\"\n @click=\"emit('close')\">\n Cancel\n </ScalarButton>\n <ScalarButton\n class=\"flex h-8 cursor-pointer items-center gap-1.5 px-3 shadow-none focus:outline-none\"\n type=\"submit\"\n @click=\"deleteScheme\">\n Delete {{ label }}\n </ScalarButton>\n </div>\n </ScalarModal>\n</template>\n","<script setup lang=\"ts\">\nimport { ScalarButton, ScalarModal } from '@scalar/components'\n\ndefineProps<{\n state: { open: boolean; show: () => void; hide: () => void }\n label: string\n}>()\n\nconst emit = defineEmits<{\n (e: 'close'): void\n (e: 'delete'): void\n}>()\n\nconst deleteScheme = () => {\n emit('delete')\n}\n</script>\n<template>\n <ScalarModal\n size=\"xxs\"\n :state=\"state\"\n title=\"Delete Security Scheme\">\n <p class=\"text-c-2 mb-4 text-sm leading-normal\">\n This cannot be undone. You're about to delete the\n {{ label }} security scheme from the collection.\n </p>\n <div class=\"flex justify-between gap-2\">\n <ScalarButton\n class=\"flex h-8 cursor-pointer items-center gap-1.5 px-3 shadow-none focus:outline-none\"\n type=\"button\"\n variant=\"outlined\"\n @click=\"emit('close')\">\n Cancel\n </ScalarButton>\n <ScalarButton\n class=\"flex h-8 cursor-pointer items-center gap-1.5 px-3 shadow-none focus:outline-none\"\n type=\"submit\"\n @click=\"deleteScheme\">\n Delete {{ label }}\n </ScalarButton>\n </div>\n </ScalarModal>\n</template>\n","import type { OpenApiDocument } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\n/** Determines if the authentication is optional */\nexport const isAuthOptional = (securityRequirements: NonNullable<OpenApiDocument['security']>): boolean => {\n const hasComplexRequirement = securityRequirements.some((requirement) => Object.keys(requirement).length > 1)\n const hasEmptyRequirement = securityRequirements.some((requirement) => Object.keys(requirement).length === 0)\n\n return hasEmptyRequirement && !hasComplexRequirement\n}\n","import type { SecuritySchemeObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\ntype AuthOption = { label: string; payload: SecuritySchemeObject }\n\n/** Predefined authentication options */\nexport const authOptions: Record<string, AuthOption> = {\n apiKeyCookie: {\n label: 'API Key in Cookies',\n payload: {\n type: 'apiKey',\n in: 'cookie',\n name: 'apiKeyCookie',\n },\n },\n apiKeyHeader: {\n label: 'API Key in Headers',\n payload: {\n type: 'apiKey',\n in: 'header',\n name: 'apiKeyHeader',\n },\n },\n apiKeyQuery: {\n label: 'API Key in Query Params',\n payload: {\n type: 'apiKey',\n in: 'query',\n name: 'apiKeyQuery',\n },\n },\n httpBasic: {\n label: 'HTTP Basic',\n payload: {\n type: 'http',\n scheme: 'basic',\n },\n },\n httpBearer: {\n label: 'HTTP Bearer',\n payload: {\n type: 'http',\n scheme: 'bearer',\n },\n },\n oauth2Implicit: {\n label: 'Oauth2 Implicit Flow',\n payload: {\n type: 'oauth2',\n flows: {\n implicit: {\n authorizationUrl: '',\n refreshUrl: '',\n scopes: {},\n },\n },\n },\n },\n oauth2Password: {\n label: 'Oauth2 Password Flow',\n payload: {\n type: 'oauth2',\n flows: {\n password: {\n tokenUrl: '',\n refreshUrl: '',\n scopes: {},\n },\n },\n },\n },\n oauth2ClientCredentials: {\n label: 'Oauth2 Client Credentials',\n payload: {\n type: 'oauth2',\n flows: {\n clientCredentials: {\n tokenUrl: '',\n refreshUrl: '',\n scopes: {},\n },\n },\n },\n },\n oauth2AuthorizationFlow: {\n label: 'Oauth2 Authorization Code',\n payload: {\n type: 'oauth2',\n flows: {\n authorizationCode: {\n authorizationUrl: '',\n tokenUrl: '',\n refreshUrl: '',\n 'x-usePkce': 'no',\n scopes: {},\n },\n },\n },\n },\n}\n","import { generateHash } from '@scalar/helpers/string/generate-hash'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type {\n ComponentsObject,\n OpenApiDocument,\n SecurityRequirementObject,\n SecuritySchemeObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\nimport { authOptions } from '@/v2/blocks/scalar-auth-selector-block/helpers/auth-options'\n\n/** A single security scheme option used in the auth dropdown */\nexport type SecuritySchemeOption = {\n id: string\n label: string\n value: SecurityRequirementObject\n isDeletable?: boolean\n payload?: SecuritySchemeObject\n}\n\n/** A group of security scheme options used in the auth dropdown */\nexport type SecuritySchemeGroup = {\n label: string\n options: SecuritySchemeOption[]\n}\n\nconst requirementSignature = (requirement: SecurityRequirementObject): string =>\n JSON.stringify(Object.keys(requirement))\n\n/**\n * Format a scheme object into a display object\n *\n * We also add a hash to the id to ensure it is unique across\n * multiple requirements of the same scheme with different scopes\n */\nexport const formatScheme = ({ name, value }: { name: string; value: SecurityRequirementObject }) => ({\n id: generateHash(JSON.stringify(value)),\n label: name,\n value,\n isDeletable: true,\n})\n\n/** Formats complex security schemes */\nexport const formatComplexScheme = (scheme: NonNullable<OpenApiDocument['security']>[number]) =>\n formatScheme({\n name: Object.keys(scheme).join(' & '),\n value: scheme,\n })\n\n/**\n * Formats a security requirement into a SecuritySchemeOption.\n * Handles both simple (single key) and complex (multiple keys) auth schemes.\n */\nconst formatSecurityRequirement = (\n requirement: SecurityRequirementObject,\n securitySchemes: NonNullable<ComponentsObject['securitySchemes']>,\n): SecuritySchemeOption | undefined => {\n const keys = Object.keys(requirement)\n\n // Complex auth (multiple keys)\n if (keys.length > 1) {\n return formatComplexScheme(requirement)\n }\n\n // Simple auth (single key)\n if (keys[0]) {\n const scheme = getResolvedRef(securitySchemes[keys[0]])\n if (!scheme) {\n return undefined\n }\n return formatScheme({ name: keys[0], value: requirement })\n }\n\n return undefined\n}\n\n/**\n * Generates the options for the security scheme combobox\n *\n * Contains either a flat list, or different groups of required, available, and add new\n */\nexport const getSecuritySchemeOptions = (\n security: NonNullable<OpenApiDocument['security']>,\n securitySchemes: NonNullable<ComponentsObject['securitySchemes']>,\n /** We need to add the selected schemes if they do not already exist in the calculated options */\n selectedSchemes: SecurityRequirementObject[],\n /** Allows adding authentication which is not in the document */\n canAddNewAuth = false,\n): SecuritySchemeOption[] | SecuritySchemeGroup[] => {\n const selectedByRequirement = new Map(\n selectedSchemes.map((selectedScheme) => [requirementSignature(selectedScheme), selectedScheme]),\n )\n\n /**\n * Build required schemes formatted as options and track scheme names in a single pass.\n * We use names (not full IDs) because we want to exclude any scheme that is already\n * required, regardless of its specific scopes or hash.\n */\n const { requiredFormatted, requiredSchemeNames, existingIds } = security.reduce(\n (acc, requirement) => {\n // If a required requirement is selected with scopes, use that selected value to\n // keep a single option entry and avoid a phantom duplicate.\n const requirementValue = selectedByRequirement.get(requirementSignature(requirement)) ?? requirement\n const formatted = formatSecurityRequirement(requirementValue, securitySchemes)\n if (formatted) {\n acc.requiredFormatted.push(formatted)\n acc.existingIds.add(formatted.id)\n }\n for (const name of Object.keys(requirement)) {\n acc.requiredSchemeNames.add(name)\n }\n return acc\n },\n {\n requiredFormatted: [] as SecuritySchemeOption[],\n requiredSchemeNames: new Set<string>(),\n existingIds: new Set<string>(),\n },\n )\n\n // Build available schemes (excluding schemes that are in the required list)\n const availableFormatted: SecuritySchemeOption[] = []\n for (const [name, schemeRef] of Object.entries(securitySchemes)) {\n if (requiredSchemeNames.has(name)) {\n continue\n }\n\n const scheme = getResolvedRef(schemeRef)\n if (scheme) {\n const formatted = formatScheme({ name, value: { [name]: [] } })\n availableFormatted.push(formatted)\n existingIds.add(formatted.id)\n }\n }\n\n /**\n * Add selected schemes to available if they do not already exist\n * This ensures that selected schemes with specific scopes are always available as options\n */\n for (const selectedScheme of selectedSchemes) {\n const formatted = formatSecurityRequirement(selectedScheme, securitySchemes)\n if (formatted && !existingIds.has(formatted.id)) {\n availableFormatted.push(formatted)\n existingIds.add(formatted.id)\n }\n }\n\n const options = [\n { label: 'Required authentication', options: requiredFormatted },\n { label: 'Available authentication', options: availableFormatted },\n ]\n\n // We don't return the groups if we don't have any required schemes\n if (!canAddNewAuth) {\n return requiredFormatted.length ? options : availableFormatted\n }\n\n // Add new authentication options (unless explicitly hidden)\n options.push({\n label: 'Add new authentication',\n options: Object.entries(authOptions).map(([key, value]) => ({\n id: key,\n label: value.label,\n value: { [key]: [] },\n payload: value.payload,\n isDeletable: false,\n })),\n })\n\n return options\n}\n","<script setup lang=\"ts\">\nimport { ScalarModal, type ModalState } from '@scalar/components'\nimport { useToasts } from '@scalar/use-toasts'\nimport { ref, watch } from 'vue'\n\nimport CommandActionForm from '@/components/CommandPalette/CommandActionForm.vue'\nimport CommandActionInput from '@/components/CommandPalette/CommandActionInput.vue'\n\nconst { state, scopes } = defineProps<{\n state: ModalState\n scopes: string[]\n}>()\n\nconst emit = defineEmits<{\n (event: 'cancel'): void\n (\n event: 'submit',\n scopeData: {\n name: string\n description: string\n },\n ): void\n}>()\n\nconst scopeData = ref({\n name: '',\n description: '',\n})\n\nconst { toast } = useToasts()\n\nconst handleSubmit = () => {\n if (!scopeData.value.name) {\n toast('Please fill in the name before adding a scope.', 'error')\n return\n }\n\n emit('submit', scopeData.value)\n state.hide()\n}\n\n// Reset scope data\nwatch(\n () => state.open,\n (isOpen) => {\n if (isOpen) {\n scopeData.value = {\n name: '',\n description: '',\n }\n }\n },\n)\n</script>\n\n<template>\n <ScalarModal\n size=\"xs\"\n :state=\"state\"\n title=\"Add Scope\">\n <CommandActionForm\n :disabled=\"!scopeData.name || scopes.includes(scopeData.name)\"\n @cancel=\"emit('cancel')\"\n @submit=\"handleSubmit\">\n <!-- Name -->\n <div class=\"flex h-8 items-start gap-2 text-sm\">\n Name:\n <CommandActionInput\n v-model=\"scopeData.name\"\n autofocus\n class=\"!p-0\"\n placeholder=\"read:user\" />\n </div>\n\n <!-- Description -->\n <div class=\"flex h-8 items-start gap-2 text-sm\">\n Description:\n <CommandActionInput\n v-model=\"scopeData.description\"\n class=\"!p-0\"\n placeholder=\"Read user data\" />\n </div>\n\n <template #submit>Add Scope</template>\n </CommandActionForm>\n </ScalarModal>\n</template>\n\n<style scoped>\n.form-group {\n margin-bottom: 1rem;\n}\n.modal-actions {\n display: flex;\n justify-content: flex-end;\n gap: 1rem;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { ScalarModal, type ModalState } from '@scalar/components'\nimport { useToasts } from '@scalar/use-toasts'\nimport { ref, watch } from 'vue'\n\nimport CommandActionForm from '@/components/CommandPalette/CommandActionForm.vue'\nimport CommandActionInput from '@/components/CommandPalette/CommandActionInput.vue'\n\nconst { state, scopes } = defineProps<{\n state: ModalState\n scopes: string[]\n}>()\n\nconst emit = defineEmits<{\n (event: 'cancel'): void\n (\n event: 'submit',\n scopeData: {\n name: string\n description: string\n },\n ): void\n}>()\n\nconst scopeData = ref({\n name: '',\n description: '',\n})\n\nconst { toast } = useToasts()\n\nconst handleSubmit = () => {\n if (!scopeData.value.name) {\n toast('Please fill in the name before adding a scope.', 'error')\n return\n }\n\n emit('submit', scopeData.value)\n state.hide()\n}\n\n// Reset scope data\nwatch(\n () => state.open,\n (isOpen) => {\n if (isOpen) {\n scopeData.value = {\n name: '',\n description: '',\n }\n }\n },\n)\n</script>\n\n<template>\n <ScalarModal\n size=\"xs\"\n :state=\"state\"\n title=\"Add Scope\">\n <CommandActionForm\n :disabled=\"!scopeData.name || scopes.includes(scopeData.name)\"\n @cancel=\"emit('cancel')\"\n @submit=\"handleSubmit\">\n <!-- Name -->\n <div class=\"flex h-8 items-start gap-2 text-sm\">\n Name:\n <CommandActionInput\n v-model=\"scopeData.name\"\n autofocus\n class=\"!p-0\"\n placeholder=\"read:user\" />\n </div>\n\n <!-- Description -->\n <div class=\"flex h-8 items-start gap-2 text-sm\">\n Description:\n <CommandActionInput\n v-model=\"scopeData.description\"\n class=\"!p-0\"\n placeholder=\"Read user data\" />\n </div>\n\n <template #submit>Add Scope</template>\n </CommandActionForm>\n </ScalarModal>\n</template>\n\n<style scoped>\n.form-group {\n margin-bottom: 1rem;\n}\n.modal-actions {\n display: flex;\n justify-content: flex-end;\n gap: 1rem;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/vue'\nimport {\n ScalarButton,\n ScalarIcon,\n ScalarSearchInput,\n useModal,\n} from '@scalar/components'\nimport type { ApiReferenceEvents } from '@scalar/workspace-store/events'\nimport type {\n OAuthFlow,\n OAuthFlowsObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed, ref } from 'vue'\n\nimport {\n DataTableCell,\n DataTableCheckbox,\n DataTableRow,\n} from '@/components/DataTable'\n\nimport OAuthScopesAddModal from './OAuthScopesAddModal.vue'\n\nconst { selectedScopes, flow, flowType } = defineProps<{\n flowType: keyof OAuthFlowsObject\n flow: OAuthFlow\n selectedScopes: string[]\n}>()\n\nconst emits = defineEmits<{\n (\n e: 'update:selectedScopes',\n payload: Pick<\n ApiReferenceEvents['auth:update:selected-scopes'],\n 'scopes' | 'newScopePayload'\n >,\n ): void\n}>()\n\nconst searchQuery = ref('')\n\n/** List of all available scopes */\nconst scopes = computed(() =>\n Object.entries(flow?.scopes ?? {}).map(([key, val]) => ({\n id: key,\n label: key,\n description: val,\n })),\n)\n\nconst filteredScopes = computed(() => {\n if (!searchQuery.value) {\n return scopes.value\n }\n\n const regex = new RegExp(\n searchQuery.value\n .split('')\n .map((c) => c.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'))\n .join('.*'),\n 'i',\n )\n\n return scopes.value.filter(({ label, description }) =>\n regex.test(`${label} ${description}`),\n )\n})\n\nconst allScopesSelected = computed(\n () => selectedScopes.length === Object.keys(flow?.scopes ?? {}).length,\n)\n\nfunction setScope(scopeKey: string, checked: boolean) {\n if (checked) {\n // Select the scope\n return emits('update:selectedScopes', {\n scopes: Array.from(new Set([...selectedScopes, scopeKey])),\n })\n }\n\n // Deselect the scope\n emits('update:selectedScopes', {\n scopes: selectedScopes.filter((scope) => scope !== scopeKey),\n })\n}\n\n/** Select all scopes */\nconst selectAllScopes = () =>\n emits('update:selectedScopes', { scopes: Object.keys(flow?.scopes ?? {}) })\n\n/** Deselect all scopes */\nconst deselectAllScopes = () => emits('update:selectedScopes', { scopes: [] })\n\nconst addNewScopeModal = useModal()\n</script>\n\n<template>\n <DataTableCell class=\"h-auto !max-h-[initial] min-h-8 items-center\">\n <div class=\"flex h-fit w-full\">\n <div class=\"text-c-1 h-full items-center\"></div>\n <Disclosure\n as=\"div\"\n class=\"bl flex w-full flex-col\">\n <DisclosureButton\n v-slot=\"{ open }\"\n :class=\"[\n 'group/scopes-accordion hover:text-c-1 flex h-auto min-h-8 cursor-pointer items-center gap-1.5 pr-2.25 pl-3 text-left',\n (selectedScopes.length || 0) > 0 ? 'text-c-1' : 'text-c-3',\n ]\">\n <div class=\"flex-1\">\n Scopes Selected\n {{ selectedScopes.length || 0 }} /\n {{ Object.keys(flow?.scopes ?? {}).length || 0 }}\n </div>\n <div class=\"flex items-center gap-1.75\">\n <!-- Add new scope -->\n <ScalarButton\n class=\"pr-0.75 pl-1 transition-none\"\n size=\"sm\"\n variant=\"ghost\"\n @click.stop=\"addNewScopeModal.show()\">\n Add Scope\n </ScalarButton>\n\n <!-- Deselect All -->\n <ScalarButton\n v-if=\"allScopesSelected\"\n class=\"pr-0.75 pl-1 transition-none\"\n size=\"sm\"\n variant=\"ghost\"\n @click.stop=\"deselectAllScopes\">\n Deselect All\n </ScalarButton>\n\n <!-- Select All -->\n <ScalarButton\n v-if=\"!allScopesSelected\"\n class=\"pr-0.75 pl-1 transition-none\"\n size=\"sm\"\n variant=\"ghost\"\n @click.stop=\"selectAllScopes\">\n Select All\n </ScalarButton>\n\n <ScalarIcon\n class=\"text-c-3 group-hover/scopes-accordion:text-c-2\"\n :icon=\"open ? 'ChevronDown' : 'ChevronRight'\"\n size=\"md\" />\n </div>\n </DisclosureButton>\n <!-- Scopes List -->\n <DisclosurePanel as=\"template\">\n <div>\n <ScalarSearchInput\n v-model=\"searchQuery\"\n class=\"flex items-center text-xs\" />\n <table\n class=\"grid max-h-40 auto-rows-auto overflow-x-hidden overflow-y-scroll\"\n :style=\"{ gridTemplateColumns: '1fr auto' }\">\n <DataTableRow\n v-for=\"{ id, label, description } in filteredScopes\"\n :key=\"id\"\n class=\"text-c-2\"\n @click=\"setScope(id, !selectedScopes.includes(id))\">\n <DataTableCell\n class=\"no-scrollbar hover:text-c-1 box-border flex !max-h-[initial] w-full cursor-pointer items-center gap-1 overflow-x-scroll px-3 py-1.5 text-nowrap\">\n <span class=\"font-code text-xs\">{{ label }}</span>\n <span>&ndash;</span>\n <span v-if=\"description\">\n {{ description }}\n </span>\n </DataTableCell>\n <DataTableCheckbox\n :modelValue=\"selectedScopes.includes(id)\"\n @update:modelValue=\"setScope(id, $event)\" />\n </DataTableRow>\n </table>\n </div>\n </DisclosurePanel>\n </Disclosure>\n </div>\n\n <!-- Add new scope modal -->\n <OAuthScopesAddModal\n :scopes=\"Object.keys(flow.scopes ?? {})\"\n :state=\"addNewScopeModal\"\n @submit=\"\n (payload) =>\n emits('update:selectedScopes', {\n scopes: selectedScopes,\n newScopePayload: { ...payload, flowType },\n })\n \" />\n </DataTableCell>\n</template>\n\n<style>\n.no-scrollbar::-webkit-scrollbar {\n display: none;\n}\n\n.no-scrollbar {\n -ms-overflow-style: none;\n scrollbar-width: none;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/vue'\nimport {\n ScalarButton,\n ScalarIcon,\n ScalarSearchInput,\n useModal,\n} from '@scalar/components'\nimport type { ApiReferenceEvents } from '@scalar/workspace-store/events'\nimport type {\n OAuthFlow,\n OAuthFlowsObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed, ref } from 'vue'\n\nimport {\n DataTableCell,\n DataTableCheckbox,\n DataTableRow,\n} from '@/components/DataTable'\n\nimport OAuthScopesAddModal from './OAuthScopesAddModal.vue'\n\nconst { selectedScopes, flow, flowType } = defineProps<{\n flowType: keyof OAuthFlowsObject\n flow: OAuthFlow\n selectedScopes: string[]\n}>()\n\nconst emits = defineEmits<{\n (\n e: 'update:selectedScopes',\n payload: Pick<\n ApiReferenceEvents['auth:update:selected-scopes'],\n 'scopes' | 'newScopePayload'\n >,\n ): void\n}>()\n\nconst searchQuery = ref('')\n\n/** List of all available scopes */\nconst scopes = computed(() =>\n Object.entries(flow?.scopes ?? {}).map(([key, val]) => ({\n id: key,\n label: key,\n description: val,\n })),\n)\n\nconst filteredScopes = computed(() => {\n if (!searchQuery.value) {\n return scopes.value\n }\n\n const regex = new RegExp(\n searchQuery.value\n .split('')\n .map((c) => c.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'))\n .join('.*'),\n 'i',\n )\n\n return scopes.value.filter(({ label, description }) =>\n regex.test(`${label} ${description}`),\n )\n})\n\nconst allScopesSelected = computed(\n () => selectedScopes.length === Object.keys(flow?.scopes ?? {}).length,\n)\n\nfunction setScope(scopeKey: string, checked: boolean) {\n if (checked) {\n // Select the scope\n return emits('update:selectedScopes', {\n scopes: Array.from(new Set([...selectedScopes, scopeKey])),\n })\n }\n\n // Deselect the scope\n emits('update:selectedScopes', {\n scopes: selectedScopes.filter((scope) => scope !== scopeKey),\n })\n}\n\n/** Select all scopes */\nconst selectAllScopes = () =>\n emits('update:selectedScopes', { scopes: Object.keys(flow?.scopes ?? {}) })\n\n/** Deselect all scopes */\nconst deselectAllScopes = () => emits('update:selectedScopes', { scopes: [] })\n\nconst addNewScopeModal = useModal()\n</script>\n\n<template>\n <DataTableCell class=\"h-auto !max-h-[initial] min-h-8 items-center\">\n <div class=\"flex h-fit w-full\">\n <div class=\"text-c-1 h-full items-center\"></div>\n <Disclosure\n as=\"div\"\n class=\"bl flex w-full flex-col\">\n <DisclosureButton\n v-slot=\"{ open }\"\n :class=\"[\n 'group/scopes-accordion hover:text-c-1 flex h-auto min-h-8 cursor-pointer items-center gap-1.5 pr-2.25 pl-3 text-left',\n (selectedScopes.length || 0) > 0 ? 'text-c-1' : 'text-c-3',\n ]\">\n <div class=\"flex-1\">\n Scopes Selected\n {{ selectedScopes.length || 0 }} /\n {{ Object.keys(flow?.scopes ?? {}).length || 0 }}\n </div>\n <div class=\"flex items-center gap-1.75\">\n <!-- Add new scope -->\n <ScalarButton\n class=\"pr-0.75 pl-1 transition-none\"\n size=\"sm\"\n variant=\"ghost\"\n @click.stop=\"addNewScopeModal.show()\">\n Add Scope\n </ScalarButton>\n\n <!-- Deselect All -->\n <ScalarButton\n v-if=\"allScopesSelected\"\n class=\"pr-0.75 pl-1 transition-none\"\n size=\"sm\"\n variant=\"ghost\"\n @click.stop=\"deselectAllScopes\">\n Deselect All\n </ScalarButton>\n\n <!-- Select All -->\n <ScalarButton\n v-if=\"!allScopesSelected\"\n class=\"pr-0.75 pl-1 transition-none\"\n size=\"sm\"\n variant=\"ghost\"\n @click.stop=\"selectAllScopes\">\n Select All\n </ScalarButton>\n\n <ScalarIcon\n class=\"text-c-3 group-hover/scopes-accordion:text-c-2\"\n :icon=\"open ? 'ChevronDown' : 'ChevronRight'\"\n size=\"md\" />\n </div>\n </DisclosureButton>\n <!-- Scopes List -->\n <DisclosurePanel as=\"template\">\n <div>\n <ScalarSearchInput\n v-model=\"searchQuery\"\n class=\"flex items-center text-xs\" />\n <table\n class=\"grid max-h-40 auto-rows-auto overflow-x-hidden overflow-y-scroll\"\n :style=\"{ gridTemplateColumns: '1fr auto' }\">\n <DataTableRow\n v-for=\"{ id, label, description } in filteredScopes\"\n :key=\"id\"\n class=\"text-c-2\"\n @click=\"setScope(id, !selectedScopes.includes(id))\">\n <DataTableCell\n class=\"no-scrollbar hover:text-c-1 box-border flex !max-h-[initial] w-full cursor-pointer items-center gap-1 overflow-x-scroll px-3 py-1.5 text-nowrap\">\n <span class=\"font-code text-xs\">{{ label }}</span>\n <span>&ndash;</span>\n <span v-if=\"description\">\n {{ description }}\n </span>\n </DataTableCell>\n <DataTableCheckbox\n :modelValue=\"selectedScopes.includes(id)\"\n @update:modelValue=\"setScope(id, $event)\" />\n </DataTableRow>\n </table>\n </div>\n </DisclosurePanel>\n </Disclosure>\n </div>\n\n <!-- Add new scope modal -->\n <OAuthScopesAddModal\n :scopes=\"Object.keys(flow.scopes ?? {})\"\n :state=\"addNewScopeModal\"\n @submit=\"\n (payload) =>\n emits('update:selectedScopes', {\n scopes: selectedScopes,\n newScopePayload: { ...payload, flowType },\n })\n \" />\n </DataTableCell>\n</template>\n\n<style>\n.no-scrollbar::-webkit-scrollbar {\n display: none;\n}\n\n.no-scrollbar {\n -ms-overflow-style: none;\n scrollbar-width: none;\n}\n</style>\n","import { isRelativePath } from '@scalar/helpers/url/is-relative-path'\nimport { makeUrlAbsolute } from '@scalar/helpers/url/make-url-absolute'\nimport { shouldUseProxy } from '@scalar/helpers/url/redirect-to-proxy'\nimport type { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { encode, fromUint8Array } from 'js-base64'\n\nimport type { ErrorResponse } from '@/libs/errors'\nimport { getServerUrl } from '@/v2/blocks/operation-block/helpers/get-server-url'\nimport type { OAuthFlowsObjectSecret } from '@/v2/blocks/scalar-auth-selector-block/helpers/secret-types'\n\n/** Oauth2 security schemes which are not implicit */\ntype NonImplicitFlows = Omit<OAuthFlowsObjectSecret, 'implicit'>\n\ntype PKCEState = {\n codeVerifier: string\n codeChallenge: string\n codeChallengeMethod: string\n}\n\nexport type OAuth2Tokens = {\n accessToken: string\n refreshToken?: string\n}\n\nconst getActiveServerBase = (activeServer: ServerObject | null, environmentVariables: Record<string, string> = {}) => {\n const serverUrl = getServerUrl(activeServer, environmentVariables)\n\n if (!serverUrl) {\n return {}\n }\n\n if (isRelativePath(serverUrl)) {\n return typeof window === 'undefined' ? {} : { basePath: serverUrl }\n }\n\n return { baseUrl: serverUrl }\n}\n\n/**\n * Generates a random string for PKCE code verifier\n *\n * @see https://www.rfc-editor.org/rfc/rfc7636#page-8\n */\nconst generateCodeVerifier = (): string => {\n // Generate 32 random bytes\n const buffer = new Uint8Array(32)\n crypto.getRandomValues(buffer)\n\n // Base64URL encode the bytes\n return fromUint8Array(buffer, true)\n}\n\n/**\n * Creates a code challenge from the code verifier\n */\nconst generateCodeChallenge = async (verifier: string, encoding: 'SHA-256' | 'plain'): Promise<string> => {\n if (encoding === 'plain') {\n return verifier\n }\n\n // If crypto.subtle.digest is not a function, we cannot use SHA-256\n if (typeof crypto?.subtle?.digest !== 'function') {\n console.warn('SHA-256 is only supported when using https, using a plain text code challenge instead.')\n return verifier\n }\n\n // ASCII encoding is just taking the lower 8 bits of each character\n const encoder = new TextEncoder()\n const data = encoder.encode(verifier)\n const digest = await crypto.subtle.digest('SHA-256', data)\n\n // Base64URL encode the bytes\n return fromUint8Array(new Uint8Array(digest), true)\n}\n\n/**\n * Authorize oauth2 flow\n *\n * @returns the resolved oauth2 tokens\n */\nexport const authorizeOauth2 = async (\n flows: OAuthFlowsObjectSecret,\n type: keyof OAuthFlowsObjectSecret,\n selectedScopes: string[],\n /** We use the active server to set a base for relative redirect uris */\n activeServer: ServerObject | null,\n /** If we want to use the proxy */\n proxyUrl: string,\n /** Flattened environment variables used to resolve server URL templates like `{protocol}` */\n environmentVariables: Record<string, string> = {},\n): Promise<ErrorResponse<OAuth2Tokens>> => {\n const flow = flows[type]\n\n try {\n if (!flow) {\n return [new Error('Flow not found'), null]\n }\n\n const scopes = selectedScopes.join(' ')\n\n // Client Credentials or Password Flow\n if (type === 'clientCredentials' || type === 'password') {\n return authorizeServers(\n flows,\n type,\n scopes,\n {\n proxyUrl,\n },\n activeServer,\n environmentVariables,\n )\n }\n\n // Generate a random state string with the length of 8 characters\n const state = (Math.random() + 1).toString(36).substring(2, 10)\n\n const authorizationUrl = makeUrlAbsolute(\n flows[type]!['x-scalar-secret-auth-url'] ?? flows[type]!.authorizationUrl,\n getActiveServerBase(activeServer, environmentVariables),\n )\n\n const url = new URL(authorizationUrl)\n\n /** Special PKCE state */\n let pkce: PKCEState | null = null\n\n // Params unique to the flows\n if (type === 'implicit') {\n url.searchParams.set('response_type', 'token')\n } else if (type === 'authorizationCode') {\n const typedFlow = flows[type]! // Safe to assert due to earlier check\n\n url.searchParams.set('response_type', 'code')\n\n // PKCE\n if (typedFlow['x-usePkce'] !== 'no') {\n const codeVerifier = generateCodeVerifier()\n const codeChallenge = await generateCodeChallenge(codeVerifier, typedFlow['x-usePkce'])\n\n // Set state for later verification\n pkce = {\n codeVerifier,\n codeChallenge,\n codeChallengeMethod: typedFlow['x-usePkce'] === 'SHA-256' ? 'S256' : 'plain',\n }\n\n // Set the code challenge and method on the url\n url.searchParams.set('code_challenge', codeChallenge)\n url.searchParams.set('code_challenge_method', pkce.codeChallengeMethod)\n }\n }\n\n const typedFlow = flows[type]! // Safe to assert due to earlier check\n\n // Handle relative redirect uris\n if (typedFlow['x-scalar-secret-redirect-uri'].startsWith('/')) {\n const baseUrl =\n getServerUrl(activeServer, environmentVariables) || window.location.origin + window.location.pathname\n const redirectUri = new URL(typedFlow['x-scalar-secret-redirect-uri'], baseUrl).toString()\n\n url.searchParams.set('redirect_uri', redirectUri)\n } else {\n url.searchParams.set('redirect_uri', typedFlow['x-scalar-secret-redirect-uri'])\n }\n\n if (flow['x-scalar-security-query']) {\n Object.keys(flow['x-scalar-security-query']).forEach((key: string): void => {\n const value = flow['x-scalar-security-query']?.[key]\n if (!value) {\n return\n }\n url.searchParams.set(key, value)\n })\n }\n\n // Common to all flows\n url.searchParams.set('client_id', flow['x-scalar-secret-client-id'])\n url.searchParams.set('state', state)\n if (scopes) {\n url.searchParams.set('scope', scopes)\n }\n\n const windowFeatures = 'left=100,top=100,width=800,height=600'\n const authWindow = window.open(url, 'openAuth2Window', windowFeatures)\n\n // Open up a window and poll until closed or we have the data we want\n if (authWindow) {\n // We need to return a promise here due to the setInterval\n return new Promise<ErrorResponse<OAuth2Tokens>>((resolve) => {\n const checkWindowClosed = setInterval(() => {\n let accessToken: string | null = null\n let refreshToken: string | null = null\n let code: string | null = null\n let error: string | null = null\n let errorDescription: string | null = null\n\n try {\n const urlParams = new URL(authWindow.location.href).searchParams\n const tokenName = flow['x-tokenName'] || 'access_token'\n accessToken = urlParams.get(tokenName)\n refreshToken = urlParams.get('refresh_token')\n code = urlParams.get('code')\n\n error = urlParams.get('error')\n errorDescription = urlParams.get('error_description')\n\n // We may get the properties in a hash\n const hashParams = new URLSearchParams(authWindow.location.href.split('#')[1])\n accessToken ||= hashParams.get(tokenName)\n refreshToken ||= hashParams.get('refresh_token')\n code ||= hashParams.get('code')\n error ||= hashParams.get('error')\n errorDescription ||= hashParams.get('error_description')\n } catch (_e) {\n // Ignore CORS error from popup\n }\n\n // The window has closed OR we have what we are looking for so we stop polling\n if (authWindow.closed || accessToken || code || error) {\n clearInterval(checkWindowClosed)\n authWindow.close()\n\n if (error) {\n resolve([new Error(`OAuth error: ${error}${errorDescription ? ` (${errorDescription})` : ''}`), null])\n }\n\n // Implicit Flow\n else if (accessToken) {\n // State is a hash fragment and cannot be found through search params\n const _state = authWindow.location.href.match(/state=([^&]*)/)?.[1]\n\n if (_state === state) {\n resolve([null, { accessToken, ...(refreshToken ? { refreshToken } : {}) }])\n } else {\n resolve([new Error('State mismatch'), null])\n }\n }\n\n // Authorization Code Server Flow\n else if (code && type === 'authorizationCode') {\n const _state = new URL(authWindow.location.href).searchParams.get('state')\n\n if (_state === state) {\n // biome-ignore lint/nursery/noFloatingPromises: output of authorizeServers must be returned\n authorizeServers(\n flows,\n type,\n scopes,\n {\n code,\n pkce,\n proxyUrl,\n },\n activeServer,\n environmentVariables,\n ).then(resolve)\n } else {\n resolve([new Error('State mismatch'), null])\n }\n }\n // User closed window without authorizing\n else {\n clearInterval(checkWindowClosed)\n resolve([new Error('Window was closed without granting authorization'), null])\n }\n }\n }, 200)\n })\n }\n return [new Error('Failed to open auth window'), null]\n } catch (_) {\n return [new Error('Failed to authorize oauth2 flow'), null]\n }\n}\n\n/**\n * Makes the BE authorization call to grab the token server to server\n * Used for clientCredentials and authorizationCode\n */\nconst authorizeServers = async (\n flows: NonImplicitFlows,\n type: keyof NonImplicitFlows,\n scopes: string,\n {\n code,\n pkce,\n proxyUrl,\n }: {\n code?: string\n pkce?: PKCEState | null\n proxyUrl?: string\n } = {},\n activeServer: ServerObject | null,\n environmentVariables: Record<string, string> = {},\n): Promise<ErrorResponse<OAuth2Tokens>> => {\n const flow = flows[type]\n\n if (!flow) {\n return [new Error('OAuth2 flow was not defined'), null]\n }\n\n const formData = new URLSearchParams()\n\n // Only client credentials and password flows support scopes in the token request\n if (scopes && (type === 'clientCredentials' || type === 'password')) {\n formData.set('scope', scopes)\n }\n\n /** Where to add the credentials */\n const addCredentialsToBody = flow['x-scalar-credentials-location'] === 'body'\n const hasClientSecret = Boolean(flow['x-scalar-secret-client-secret'])\n /**\n * Public authorization-code clients still need client_id in the token body.\n * We only send it implicitly for that case to avoid conflicting with Basic auth.\n */\n const shouldSendClientIdInBody = addCredentialsToBody || (type === 'authorizationCode' && !hasClientSecret)\n\n if (shouldSendClientIdInBody) {\n formData.set('client_id', flow['x-scalar-secret-client-id'])\n }\n if (addCredentialsToBody && hasClientSecret) {\n formData.set('client_secret', flow['x-scalar-secret-client-secret'])\n }\n if ('x-scalar-secret-redirect-uri' in flow && flow['x-scalar-secret-redirect-uri']) {\n formData.set('redirect_uri', flow['x-scalar-secret-redirect-uri'])\n }\n\n // Authorization Code\n if (code) {\n formData.set('code', code)\n formData.set('grant_type', 'authorization_code')\n\n // PKCE\n if (pkce) {\n formData.set('code_verifier', pkce.codeVerifier)\n }\n }\n // Password\n else if (type === 'password') {\n const typedFlow = flows[type]! // Safe to assert due to earlier check\n formData.set('grant_type', 'password')\n formData.set('username', typedFlow['x-scalar-secret-username'])\n formData.set('password', typedFlow['x-scalar-secret-password'])\n }\n // Client Credentials\n else {\n formData.set('grant_type', 'client_credentials')\n }\n\n // Additional request body parameters\n if (flow['x-scalar-security-body']) {\n Object.entries(flow['x-scalar-security-body']).forEach(([key, value]) => {\n if (value) {\n formData.set(key, String(value))\n }\n })\n }\n\n try {\n const headers: Record<string, string> = {\n 'Content-Type': 'application/x-www-form-urlencoded',\n }\n\n // Add client id + secret to headers for confidential clients.\n if (!addCredentialsToBody && hasClientSecret) {\n headers.Authorization = `Basic ${encode(`${flow['x-scalar-secret-client-id']}:${flow['x-scalar-secret-client-secret']}`)}`\n }\n\n // Check if we should use the proxy\n const tokenUrl = makeUrlAbsolute(\n flow['x-scalar-secret-token-url'] ?? flow.tokenUrl,\n getActiveServerBase(activeServer, environmentVariables),\n )\n const url = shouldUseProxy(proxyUrl, tokenUrl)\n ? `${proxyUrl}?${new URLSearchParams([['scalar_url', tokenUrl]]).toString()}`\n : tokenUrl\n\n // Make the call\n const resp = await fetch(url, {\n method: 'POST',\n headers,\n body: formData,\n })\n const responseData = await resp.json()\n\n // Use custom token name if specified, otherwise default to access_token\n const tokenName = flow['x-tokenName'] || 'access_token'\n const accessToken = responseData[tokenName]\n const refreshToken = responseData.refresh_token\n\n return [null, { accessToken, ...(typeof refreshToken === 'string' ? { refreshToken } : {}) }]\n } catch {\n return [new Error('Failed to get an access token. Please check your credentials.'), null]\n }\n}\n","<script setup lang=\"ts\">\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport { useId } from 'vue'\n\nimport type { VueClassProp } from '@/types/vue'\nimport { DataTableInput } from '@/v2/components/data-table'\n\nconst {\n containerClass,\n environment,\n readOnly = false,\n required = false,\n type,\n} = defineProps<{\n containerClass?: VueClassProp\n environment: XScalarEnvironment\n readOnly?: boolean\n required?: boolean\n type?: string\n}>()\n\nconst emit = defineEmits<{\n (e: 'inputFocus'): void\n (e: 'inputBlur'): void\n (e: 'selectVariable', value: string): void\n}>()\n\nconst modelValue = defineModel<string>({ default: '', required: true })\nconst id = useId()\n</script>\n<template>\n <DataTableInput\n :id=\"id\"\n v-bind=\"$attrs\"\n v-model=\"modelValue\"\n :canAddCustomEnumValue=\"!readOnly\"\n :containerClass=\"containerClass\"\n :environment=\"environment\"\n lineWrapping\n :readOnly=\"readOnly\"\n :required=\"required\"\n :type=\"type\"\n @inputBlur=\"emit('inputBlur')\"\n @inputFocus=\"emit('inputFocus')\"\n @selectVariable=\"emit('selectVariable', $event)\">\n <template #default>\n <label :for=\"id\">\n <slot />\n </label>\n </template>\n <template #icon>\n <slot name=\"icon\" />\n </template>\n </DataTableInput>\n</template>\n","<script setup lang=\"ts\">\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport { useId } from 'vue'\n\nimport type { VueClassProp } from '@/types/vue'\nimport { DataTableInput } from '@/v2/components/data-table'\n\nconst {\n containerClass,\n environment,\n readOnly = false,\n required = false,\n type,\n} = defineProps<{\n containerClass?: VueClassProp\n environment: XScalarEnvironment\n readOnly?: boolean\n required?: boolean\n type?: string\n}>()\n\nconst emit = defineEmits<{\n (e: 'inputFocus'): void\n (e: 'inputBlur'): void\n (e: 'selectVariable', value: string): void\n}>()\n\nconst modelValue = defineModel<string>({ default: '', required: true })\nconst id = useId()\n</script>\n<template>\n <DataTableInput\n :id=\"id\"\n v-bind=\"$attrs\"\n v-model=\"modelValue\"\n :canAddCustomEnumValue=\"!readOnly\"\n :containerClass=\"containerClass\"\n :environment=\"environment\"\n lineWrapping\n :readOnly=\"readOnly\"\n :required=\"required\"\n :type=\"type\"\n @inputBlur=\"emit('inputBlur')\"\n @inputFocus=\"emit('inputFocus')\"\n @selectVariable=\"emit('selectVariable', $event)\">\n <template #default>\n <label :for=\"id\">\n <slot />\n </label>\n </template>\n <template #icon>\n <slot name=\"icon\" />\n </template>\n </DataTableInput>\n</template>\n","<script setup lang=\"ts\">\nimport { ScalarButton, useLoadingState } from '@scalar/components'\nimport { pkceOptions } from '@scalar/oas-utils/entities/spec'\nimport { useToasts } from '@scalar/use-toasts'\nimport type { SecretsOAuthFlows } from '@scalar/workspace-store/entities/auth'\nimport type {\n ApiReferenceEvents,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { XScalarCredentialsLocation } from '@scalar/workspace-store/schemas/extensions/security/x-scalar-credentials-location'\nimport type { XusePkce } from '@scalar/workspace-store/schemas/extensions/security/x-use-pkce'\nimport type {\n OAuthFlow,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed, ref, watch } from 'vue'\n\nimport { DataTableRow } from '@/components/DataTable'\nimport { getEnvironmentVariables } from '@/v2/blocks/operation-block/helpers/get-environment-variables'\nimport OAuthScopesInput from '@/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue'\nimport { authorizeOauth2 } from '@/v2/blocks/scalar-auth-selector-block/helpers/oauth'\nimport type {\n OAuthFlowAuthorizationCodeSecret,\n OAuthFlowClientCredentialsSecret,\n OAuthFlowPasswordSecret,\n OAuthFlowsObjectSecret,\n SecuritySchemeObjectSecret,\n} from '@/v2/blocks/scalar-auth-selector-block/helpers/secret-types'\n\nimport RequestAuthDataTableInput from './RequestAuthDataTableInput.vue'\n\nconst {\n environment,\n flows,\n type,\n scheme,\n selectedScopes: selectedScopesProp,\n server,\n proxyUrl,\n eventBus,\n name,\n} = defineProps<{\n /** Current environment configuration */\n environment: XScalarEnvironment\n /** OAuth flows */\n flows: OAuthFlowsObjectSecret\n /** Type of the OAuth flow */\n type: keyof OAuthFlowsObjectSecret\n /** Selected scopes */\n selectedScopes: string[]\n /** Security scheme */\n scheme: SecuritySchemeObjectSecret\n /** Current server configuration */\n server: ServerObject | null\n /** Proxy URL */\n proxyUrl: string\n /** Name of the security scheme */\n name: string\n /** Event bus for authentication updates */\n eventBus: WorkspaceEventBus\n}>()\n\nconst emits = defineEmits<{\n (\n e: 'update:selectedScopes',\n payload: Pick<\n ApiReferenceEvents['auth:update:selected-scopes'],\n 'scopes' | 'newScopePayload'\n >,\n ): void\n}>()\n\nconst loader = useLoadingState()\nconst { toast } = useToasts()\n\n/** The current OAuth flow based on the selected type */\nconst flow = computed(() => flows[type]!)\ntype NonImplicitFlow =\n | OAuthFlowPasswordSecret\n | OAuthFlowClientCredentialsSecret\n | OAuthFlowAuthorizationCodeSecret\n\n/** We filter selected scopes to only include scopes that are in this flow*/\nconst selectedScopes = computed(() =>\n selectedScopesProp.filter((scope) => scope in (flow.value.scopes ?? {})),\n)\n\n/** Updates the security scheme base */\nconst handleOauth2Update = (\n payload: Partial<OAuthFlow & XScalarCredentialsLocation>,\n): void => {\n // OpenIdConnect uses the secrets update for all\n if (scheme.type === 'openIdConnect') {\n return handleOauth2SecretsUpdate(payload)\n }\n\n eventBus.emit('auth:update:security-scheme', {\n payload: {\n type: scheme.type,\n flows: {\n [type]: payload,\n },\n },\n name,\n })\n}\n\n/** Updates the flow secrets */\nconst handleOauth2SecretsUpdate = (\n payload: Omit<Partial<SecretsOAuthFlows[keyof SecretsOAuthFlows]>, 'type'>,\n): void =>\n eventBus.emit('auth:update:security-scheme-secrets', {\n payload: {\n type: scheme.type,\n [type]: payload,\n },\n name,\n })\n\n/** Clears the flow secrets */\nconst clearOauth2Secrets = (): void =>\n eventBus.emit('auth:clear:security-scheme-secrets', {\n name,\n })\n\n/** Track if we have set the redirect uri */\nconst hasPrefilledRedirectUri = ref(false)\n\n/** Default the redirect-uri to the current origin if we have access to window */\nwatch(\n () =>\n (flow.value as OAuthFlowAuthorizationCodeSecret)[\n 'x-scalar-secret-redirect-uri'\n ],\n (newRedirectUri) => {\n if (\n hasPrefilledRedirectUri.value ||\n newRedirectUri ||\n typeof window === 'undefined' ||\n !('x-scalar-secret-redirect-uri' in flow.value)\n ) {\n return\n }\n hasPrefilledRedirectUri.value = true\n handleOauth2SecretsUpdate({\n 'x-scalar-secret-redirect-uri':\n window.location.origin + window.location.pathname,\n })\n },\n { immediate: true },\n)\n\n/**\n * Authorizes the user using the specified OAuth flow.\n * Opens the appropriate OAuth dialog and/or performs the token exchange.\n */\nconst handleAuthorize = async (): Promise<void> => {\n if (loader.isLoading) {\n return\n }\n\n loader.start()\n\n const [error, tokens] = await authorizeOauth2(\n flows,\n type,\n selectedScopes.value,\n server,\n proxyUrl,\n getEnvironmentVariables(environment),\n )\n\n await loader.clear()\n\n if (tokens?.accessToken) {\n handleOauth2SecretsUpdate({\n 'x-scalar-secret-token': tokens.accessToken,\n ...(tokens.refreshToken\n ? { 'x-scalar-secret-refresh-token': tokens.refreshToken }\n : {}),\n })\n } else {\n console.error(error)\n toast(error?.message ?? 'Failed to authorize', 'error')\n }\n}\n\n/** Updates the secret location */\nconst handleSecretLocationUpdate = (value: string): void => {\n const credentialsLocation = value === 'body' ? 'body' : 'header'\n\n if (scheme.type !== 'openIdConnect') {\n handleOauth2Update({\n 'x-scalar-credentials-location': credentialsLocation,\n })\n }\n\n handleOauth2SecretsUpdate({\n 'x-scalar-credentials-location': credentialsLocation,\n })\n}\n</script>\n\n<template>\n <!-- Access Token Display: Shows when user is already authorized -->\n <template v-if=\"Boolean(flow['x-scalar-secret-token'])\">\n <DataTableRow>\n <RequestAuthDataTableInput\n class=\"border-r-transparent\"\n :environment\n :modelValue=\"flow['x-scalar-secret-token']\"\n placeholder=\"QUxMIFlPVVIgQkFTRSBBUkUgQkVMT05HIFRPIFVT\"\n type=\"password\"\n @update:modelValue=\"\n (v) => handleOauth2SecretsUpdate({ 'x-scalar-secret-token': v })\n \">\n Access Token\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <DataTableRow class=\"min-w-full\">\n <div class=\"flex h-8 items-center justify-end gap-2 border-t\">\n <ScalarButton\n class=\"mr-1 p-0 px-2 py-0.5\"\n :loader\n size=\"sm\"\n variant=\"outlined\"\n @click=\"\n () =>\n handleOauth2SecretsUpdate({\n 'x-scalar-secret-token': '',\n 'x-scalar-secret-refresh-token': '',\n })\n \">\n Clear\n </ScalarButton>\n </div>\n </DataTableRow>\n </template>\n\n <!-- Authorization Form: Shows when user needs to authorize -->\n <template v-else>\n <DataTableRow>\n <RequestAuthDataTableInput\n v-if=\"'authorizationUrl' in flow\"\n containerClass=\"border-r-0\"\n :environment\n :modelValue=\"flow['x-scalar-secret-auth-url'] ?? ''\"\n placeholder=\"https://galaxy.scalar.com/authorize\"\n @update:modelValue=\"\n (v) => {\n handleOauth2SecretsUpdate({ 'x-scalar-secret-auth-url': v })\n handleOauth2Update({ authorizationUrl: v })\n }\n \">\n Auth URL\n </RequestAuthDataTableInput>\n\n <RequestAuthDataTableInput\n v-if=\"'tokenUrl' in flow\"\n :environment\n :modelValue=\"flow['x-scalar-secret-token-url'] ?? ''\"\n placeholder=\"https://galaxy.scalar.com/token\"\n @update:modelValue=\"\n (v) => {\n handleOauth2SecretsUpdate({ 'x-scalar-secret-token-url': v })\n handleOauth2Update({ tokenUrl: v })\n }\n \">\n Token URL\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <DataTableRow v-if=\"'x-scalar-secret-redirect-uri' in flow\">\n <RequestAuthDataTableInput\n :environment\n :modelValue=\"flow['x-scalar-secret-redirect-uri']\"\n placeholder=\"https://galaxy.scalar.com/callback\"\n @update:modelValue=\"\n (v) => {\n handleOauth2SecretsUpdate({ 'x-scalar-secret-redirect-uri': v })\n }\n \">\n Redirect URL\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <template\n v-if=\"\n 'x-scalar-secret-username' in flow && 'x-scalar-secret-password' in flow\n \">\n <DataTableRow>\n <RequestAuthDataTableInput\n class=\"text-c-2\"\n :environment\n :modelValue=\"flow['x-scalar-secret-username']\"\n placeholder=\"janedoe\"\n @update:modelValue=\"\n (v) => handleOauth2SecretsUpdate({ 'x-scalar-secret-username': v })\n \">\n Username\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <DataTableRow>\n <RequestAuthDataTableInput\n :environment\n :modelValue=\"flow['x-scalar-secret-password']\"\n placeholder=\"********\"\n type=\"password\"\n @update:modelValue=\"\n (v) => handleOauth2SecretsUpdate({ 'x-scalar-secret-password': v })\n \">\n Password\n </RequestAuthDataTableInput>\n </DataTableRow>\n </template>\n\n <DataTableRow>\n <RequestAuthDataTableInput\n :environment\n :modelValue=\"flow['x-scalar-secret-client-id']\"\n placeholder=\"12345\"\n @update:modelValue=\"\n (v) => handleOauth2SecretsUpdate({ 'x-scalar-secret-client-id': v })\n \">\n Client ID\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <DataTableRow v-if=\"'x-scalar-secret-client-secret' in flow\">\n <RequestAuthDataTableInput\n :environment\n :modelValue=\"flow['x-scalar-secret-client-secret']\"\n placeholder=\"XYZ123\"\n type=\"password\"\n @update:modelValue=\"\n (v) =>\n handleOauth2SecretsUpdate({ 'x-scalar-secret-client-secret': v })\n \">\n Client Secret\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <DataTableRow v-if=\"'x-usePkce' in flow\">\n <RequestAuthDataTableInput\n :enum=\"pkceOptions\"\n :environment\n :modelValue=\"flow['x-usePkce']\"\n readOnly\n @update:modelValue=\"\n (v) =>\n handleOauth2Update({\n 'x-usePkce': v as XusePkce['x-usePkce'],\n })\n \">\n Use PKCE\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <!-- Credentials Location -->\n <DataTableRow v-if=\"type !== 'implicit'\">\n <RequestAuthDataTableInput\n :enum=\"['header', 'body']\"\n :environment\n :modelValue=\"\n (flow as NonImplicitFlow)['x-scalar-credentials-location'] || 'header'\n \"\n placeholder=\"header\"\n readOnly\n @update:modelValue=\"(v) => handleSecretLocationUpdate(v)\">\n Credentials Location\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <!-- Scopes -->\n <DataTableRow>\n <OAuthScopesInput\n :flow\n :flowType=\"type\"\n :selectedScopes\n @update:selectedScopes=\"(v) => emits('update:selectedScopes', v)\" />\n </DataTableRow>\n\n <DataTableRow class=\"min-w-full\">\n <div class=\"flex h-8 w-full items-center justify-end border-t\">\n <!-- Allow clearing the oauth section and going back to discovery -->\n <ScalarButton\n v-if=\"scheme.type === 'openIdConnect'\"\n class=\"mr-1 p-0 px-2 py-0.5\"\n :loader\n size=\"sm\"\n variant=\"outlined\"\n @click=\"clearOauth2Secrets\">\n Clear\n </ScalarButton>\n\n <ScalarButton\n class=\"mr-0.75 p-0 px-2 py-0.5\"\n :loader\n size=\"sm\"\n variant=\"outlined\"\n @click=\"handleAuthorize\">\n Authorize\n </ScalarButton>\n </div>\n </DataTableRow>\n </template>\n</template>\n","<script setup lang=\"ts\">\nimport { ScalarButton, useLoadingState } from '@scalar/components'\nimport { pkceOptions } from '@scalar/oas-utils/entities/spec'\nimport { useToasts } from '@scalar/use-toasts'\nimport type { SecretsOAuthFlows } from '@scalar/workspace-store/entities/auth'\nimport type {\n ApiReferenceEvents,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { XScalarCredentialsLocation } from '@scalar/workspace-store/schemas/extensions/security/x-scalar-credentials-location'\nimport type { XusePkce } from '@scalar/workspace-store/schemas/extensions/security/x-use-pkce'\nimport type {\n OAuthFlow,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed, ref, watch } from 'vue'\n\nimport { DataTableRow } from '@/components/DataTable'\nimport { getEnvironmentVariables } from '@/v2/blocks/operation-block/helpers/get-environment-variables'\nimport OAuthScopesInput from '@/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue'\nimport { authorizeOauth2 } from '@/v2/blocks/scalar-auth-selector-block/helpers/oauth'\nimport type {\n OAuthFlowAuthorizationCodeSecret,\n OAuthFlowClientCredentialsSecret,\n OAuthFlowPasswordSecret,\n OAuthFlowsObjectSecret,\n SecuritySchemeObjectSecret,\n} from '@/v2/blocks/scalar-auth-selector-block/helpers/secret-types'\n\nimport RequestAuthDataTableInput from './RequestAuthDataTableInput.vue'\n\nconst {\n environment,\n flows,\n type,\n scheme,\n selectedScopes: selectedScopesProp,\n server,\n proxyUrl,\n eventBus,\n name,\n} = defineProps<{\n /** Current environment configuration */\n environment: XScalarEnvironment\n /** OAuth flows */\n flows: OAuthFlowsObjectSecret\n /** Type of the OAuth flow */\n type: keyof OAuthFlowsObjectSecret\n /** Selected scopes */\n selectedScopes: string[]\n /** Security scheme */\n scheme: SecuritySchemeObjectSecret\n /** Current server configuration */\n server: ServerObject | null\n /** Proxy URL */\n proxyUrl: string\n /** Name of the security scheme */\n name: string\n /** Event bus for authentication updates */\n eventBus: WorkspaceEventBus\n}>()\n\nconst emits = defineEmits<{\n (\n e: 'update:selectedScopes',\n payload: Pick<\n ApiReferenceEvents['auth:update:selected-scopes'],\n 'scopes' | 'newScopePayload'\n >,\n ): void\n}>()\n\nconst loader = useLoadingState()\nconst { toast } = useToasts()\n\n/** The current OAuth flow based on the selected type */\nconst flow = computed(() => flows[type]!)\ntype NonImplicitFlow =\n | OAuthFlowPasswordSecret\n | OAuthFlowClientCredentialsSecret\n | OAuthFlowAuthorizationCodeSecret\n\n/** We filter selected scopes to only include scopes that are in this flow*/\nconst selectedScopes = computed(() =>\n selectedScopesProp.filter((scope) => scope in (flow.value.scopes ?? {})),\n)\n\n/** Updates the security scheme base */\nconst handleOauth2Update = (\n payload: Partial<OAuthFlow & XScalarCredentialsLocation>,\n): void => {\n // OpenIdConnect uses the secrets update for all\n if (scheme.type === 'openIdConnect') {\n return handleOauth2SecretsUpdate(payload)\n }\n\n eventBus.emit('auth:update:security-scheme', {\n payload: {\n type: scheme.type,\n flows: {\n [type]: payload,\n },\n },\n name,\n })\n}\n\n/** Updates the flow secrets */\nconst handleOauth2SecretsUpdate = (\n payload: Omit<Partial<SecretsOAuthFlows[keyof SecretsOAuthFlows]>, 'type'>,\n): void =>\n eventBus.emit('auth:update:security-scheme-secrets', {\n payload: {\n type: scheme.type,\n [type]: payload,\n },\n name,\n })\n\n/** Clears the flow secrets */\nconst clearOauth2Secrets = (): void =>\n eventBus.emit('auth:clear:security-scheme-secrets', {\n name,\n })\n\n/** Track if we have set the redirect uri */\nconst hasPrefilledRedirectUri = ref(false)\n\n/** Default the redirect-uri to the current origin if we have access to window */\nwatch(\n () =>\n (flow.value as OAuthFlowAuthorizationCodeSecret)[\n 'x-scalar-secret-redirect-uri'\n ],\n (newRedirectUri) => {\n if (\n hasPrefilledRedirectUri.value ||\n newRedirectUri ||\n typeof window === 'undefined' ||\n !('x-scalar-secret-redirect-uri' in flow.value)\n ) {\n return\n }\n hasPrefilledRedirectUri.value = true\n handleOauth2SecretsUpdate({\n 'x-scalar-secret-redirect-uri':\n window.location.origin + window.location.pathname,\n })\n },\n { immediate: true },\n)\n\n/**\n * Authorizes the user using the specified OAuth flow.\n * Opens the appropriate OAuth dialog and/or performs the token exchange.\n */\nconst handleAuthorize = async (): Promise<void> => {\n if (loader.isLoading) {\n return\n }\n\n loader.start()\n\n const [error, tokens] = await authorizeOauth2(\n flows,\n type,\n selectedScopes.value,\n server,\n proxyUrl,\n getEnvironmentVariables(environment),\n )\n\n await loader.clear()\n\n if (tokens?.accessToken) {\n handleOauth2SecretsUpdate({\n 'x-scalar-secret-token': tokens.accessToken,\n ...(tokens.refreshToken\n ? { 'x-scalar-secret-refresh-token': tokens.refreshToken }\n : {}),\n })\n } else {\n console.error(error)\n toast(error?.message ?? 'Failed to authorize', 'error')\n }\n}\n\n/** Updates the secret location */\nconst handleSecretLocationUpdate = (value: string): void => {\n const credentialsLocation = value === 'body' ? 'body' : 'header'\n\n if (scheme.type !== 'openIdConnect') {\n handleOauth2Update({\n 'x-scalar-credentials-location': credentialsLocation,\n })\n }\n\n handleOauth2SecretsUpdate({\n 'x-scalar-credentials-location': credentialsLocation,\n })\n}\n</script>\n\n<template>\n <!-- Access Token Display: Shows when user is already authorized -->\n <template v-if=\"Boolean(flow['x-scalar-secret-token'])\">\n <DataTableRow>\n <RequestAuthDataTableInput\n class=\"border-r-transparent\"\n :environment\n :modelValue=\"flow['x-scalar-secret-token']\"\n placeholder=\"QUxMIFlPVVIgQkFTRSBBUkUgQkVMT05HIFRPIFVT\"\n type=\"password\"\n @update:modelValue=\"\n (v) => handleOauth2SecretsUpdate({ 'x-scalar-secret-token': v })\n \">\n Access Token\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <DataTableRow class=\"min-w-full\">\n <div class=\"flex h-8 items-center justify-end gap-2 border-t\">\n <ScalarButton\n class=\"mr-1 p-0 px-2 py-0.5\"\n :loader\n size=\"sm\"\n variant=\"outlined\"\n @click=\"\n () =>\n handleOauth2SecretsUpdate({\n 'x-scalar-secret-token': '',\n 'x-scalar-secret-refresh-token': '',\n })\n \">\n Clear\n </ScalarButton>\n </div>\n </DataTableRow>\n </template>\n\n <!-- Authorization Form: Shows when user needs to authorize -->\n <template v-else>\n <DataTableRow>\n <RequestAuthDataTableInput\n v-if=\"'authorizationUrl' in flow\"\n containerClass=\"border-r-0\"\n :environment\n :modelValue=\"flow['x-scalar-secret-auth-url'] ?? ''\"\n placeholder=\"https://galaxy.scalar.com/authorize\"\n @update:modelValue=\"\n (v) => {\n handleOauth2SecretsUpdate({ 'x-scalar-secret-auth-url': v })\n handleOauth2Update({ authorizationUrl: v })\n }\n \">\n Auth URL\n </RequestAuthDataTableInput>\n\n <RequestAuthDataTableInput\n v-if=\"'tokenUrl' in flow\"\n :environment\n :modelValue=\"flow['x-scalar-secret-token-url'] ?? ''\"\n placeholder=\"https://galaxy.scalar.com/token\"\n @update:modelValue=\"\n (v) => {\n handleOauth2SecretsUpdate({ 'x-scalar-secret-token-url': v })\n handleOauth2Update({ tokenUrl: v })\n }\n \">\n Token URL\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <DataTableRow v-if=\"'x-scalar-secret-redirect-uri' in flow\">\n <RequestAuthDataTableInput\n :environment\n :modelValue=\"flow['x-scalar-secret-redirect-uri']\"\n placeholder=\"https://galaxy.scalar.com/callback\"\n @update:modelValue=\"\n (v) => {\n handleOauth2SecretsUpdate({ 'x-scalar-secret-redirect-uri': v })\n }\n \">\n Redirect URL\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <template\n v-if=\"\n 'x-scalar-secret-username' in flow && 'x-scalar-secret-password' in flow\n \">\n <DataTableRow>\n <RequestAuthDataTableInput\n class=\"text-c-2\"\n :environment\n :modelValue=\"flow['x-scalar-secret-username']\"\n placeholder=\"janedoe\"\n @update:modelValue=\"\n (v) => handleOauth2SecretsUpdate({ 'x-scalar-secret-username': v })\n \">\n Username\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <DataTableRow>\n <RequestAuthDataTableInput\n :environment\n :modelValue=\"flow['x-scalar-secret-password']\"\n placeholder=\"********\"\n type=\"password\"\n @update:modelValue=\"\n (v) => handleOauth2SecretsUpdate({ 'x-scalar-secret-password': v })\n \">\n Password\n </RequestAuthDataTableInput>\n </DataTableRow>\n </template>\n\n <DataTableRow>\n <RequestAuthDataTableInput\n :environment\n :modelValue=\"flow['x-scalar-secret-client-id']\"\n placeholder=\"12345\"\n @update:modelValue=\"\n (v) => handleOauth2SecretsUpdate({ 'x-scalar-secret-client-id': v })\n \">\n Client ID\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <DataTableRow v-if=\"'x-scalar-secret-client-secret' in flow\">\n <RequestAuthDataTableInput\n :environment\n :modelValue=\"flow['x-scalar-secret-client-secret']\"\n placeholder=\"XYZ123\"\n type=\"password\"\n @update:modelValue=\"\n (v) =>\n handleOauth2SecretsUpdate({ 'x-scalar-secret-client-secret': v })\n \">\n Client Secret\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <DataTableRow v-if=\"'x-usePkce' in flow\">\n <RequestAuthDataTableInput\n :enum=\"pkceOptions\"\n :environment\n :modelValue=\"flow['x-usePkce']\"\n readOnly\n @update:modelValue=\"\n (v) =>\n handleOauth2Update({\n 'x-usePkce': v as XusePkce['x-usePkce'],\n })\n \">\n Use PKCE\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <!-- Credentials Location -->\n <DataTableRow v-if=\"type !== 'implicit'\">\n <RequestAuthDataTableInput\n :enum=\"['header', 'body']\"\n :environment\n :modelValue=\"\n (flow as NonImplicitFlow)['x-scalar-credentials-location'] || 'header'\n \"\n placeholder=\"header\"\n readOnly\n @update:modelValue=\"(v) => handleSecretLocationUpdate(v)\">\n Credentials Location\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <!-- Scopes -->\n <DataTableRow>\n <OAuthScopesInput\n :flow\n :flowType=\"type\"\n :selectedScopes\n @update:selectedScopes=\"(v) => emits('update:selectedScopes', v)\" />\n </DataTableRow>\n\n <DataTableRow class=\"min-w-full\">\n <div class=\"flex h-8 w-full items-center justify-end border-t\">\n <!-- Allow clearing the oauth section and going back to discovery -->\n <ScalarButton\n v-if=\"scheme.type === 'openIdConnect'\"\n class=\"mr-1 p-0 px-2 py-0.5\"\n :loader\n size=\"sm\"\n variant=\"outlined\"\n @click=\"clearOauth2Secrets\">\n Clear\n </ScalarButton>\n\n <ScalarButton\n class=\"mr-0.75 p-0 px-2 py-0.5\"\n :loader\n size=\"sm\"\n variant=\"outlined\"\n @click=\"handleAuthorize\">\n Authorize\n </ScalarButton>\n </div>\n </DataTableRow>\n </template>\n</template>\n","import { redirectToProxy } from '@scalar/helpers/url/redirect-to-proxy'\nimport { type Static, Type } from '@scalar/typebox'\nimport { coerceValue } from '@scalar/workspace-store/schemas/typebox-coerce'\n\nimport type { ErrorResponse } from '@/libs/errors'\n\n/**\n * OpenID Connect Discovery Document (subset)\n * Represents the metadata fields consumed by the auth selector flow conversion.\n *\n * @see https://openid.net/specs/openid-connect-discovery-1_0.html\n */\nconst OpenIDConnectDiscoverySchema = Type.Object({\n /** URL of the OAuth 2.0 Authorization Endpoint */\n authorization_endpoint: Type.Optional(Type.String()),\n /** URL of the OAuth 2.0 Token Endpoint */\n token_endpoint: Type.Optional(Type.String()),\n /** List of OAuth 2.0 scope values that this server supports */\n scopes_supported: Type.Optional(Type.Array(Type.String())),\n /** List of OAuth 2.0 grant type values that this server supports */\n grant_types_supported: Type.Optional(Type.Array(Type.String())),\n /** Supported PKCE code challenge methods (RFC 7636) */\n code_challenge_methods_supported: Type.Optional(Type.Array(Type.String())),\n})\n\nexport type OpenIDConnectDiscovery = Static<typeof OpenIDConnectDiscoverySchema>\n\n/**\n * The required scope for OpenID Connect requests.\n * If this scope is present, the request is an OIDC request; otherwise, it is a standard OAuth 2.0 request.\n */\nexport const OPENID_SCOPE = 'openid'\n\n/**\n * Fetches the OpenID Connect discovery document from the specified URL.\n * Supports both full discovery URLs and issuer URLs.\n *\n * @param url - The OpenID Connect discovery URL or issuer URL\n * @returns The discovery document or an error\n */\nexport const fetchOpenIDConnectDiscovery = async (\n url: string,\n proxyUrl: string,\n): Promise<ErrorResponse<OpenIDConnectDiscovery>> => {\n try {\n // If the URL does not end with the well-known path, append it\n let discoveryUrl = url.trim()\n\n if (!discoveryUrl) {\n return [new Error('URL cannot be empty'), null]\n }\n\n // Remove trailing slash if present\n if (discoveryUrl.endsWith('/')) {\n discoveryUrl = discoveryUrl.slice(0, -1)\n }\n\n // If the URL does not already include the well-known path, append it\n if (!discoveryUrl.includes('/.well-known/openid-configuration')) {\n discoveryUrl = `${discoveryUrl}/.well-known/openid-configuration`\n }\n\n const proxiedUrl = redirectToProxy(proxyUrl, discoveryUrl)\n const response = await fetch(proxiedUrl)\n\n if (!response.ok) {\n return [\n new Error(`Failed to fetch OpenID Connect discovery document: ${response.status} ${response.statusText}`),\n null,\n ]\n }\n\n const data = coerceValue(OpenIDConnectDiscoverySchema, await response.json())\n\n // Validate that we have the essential fields\n if (!data.authorization_endpoint && !data.token_endpoint) {\n return [new Error('Invalid OpenID Connect discovery document: missing required endpoints'), null]\n }\n\n return [null, data]\n } catch (error) {\n if (error instanceof Error) {\n return [error, null]\n }\n return [new Error('Failed to fetch OpenID Connect discovery document'), null]\n }\n}\n","import { OpenIDConnectSchema, type SecretsOpenIdConnect } from '@scalar/workspace-store/entities/auth'\nimport { coerceValue } from '@scalar/workspace-store/schemas/typebox-coerce'\nimport type { OAuthFlowsObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\nimport type { OpenIDConnectDiscovery } from './fetch-openid-connect-discovery'\n\n/** Takes in an open ID Connect discovery response and converts it into an oauth flow to be used for authorization */\nexport const openIDDiscoveryToFlows = (discovery: OpenIDConnectDiscovery): SecretsOpenIdConnect => {\n const scopes = Object.fromEntries((discovery.scopes_supported ?? []).map((scope) => [scope, '']))\n const grantTypes = new Set(discovery.grant_types_supported ?? ['authorization_code', 'implicit'])\n const authorizationUrl = discovery.authorization_endpoint\n const tokenUrl = discovery.token_endpoint\n\n const usePkce = discovery.code_challenge_methods_supported?.includes('S256')\n ? 'SHA-256'\n : discovery.code_challenge_methods_supported?.includes('plain')\n ? 'plain'\n : 'no'\n\n const flows: OAuthFlowsObject = {}\n\n // Implicit\n if (grantTypes.has('implicit') && authorizationUrl) {\n flows.implicit = {\n authorizationUrl,\n refreshUrl: authorizationUrl,\n scopes,\n }\n }\n\n // Password\n if (grantTypes.has('password') && tokenUrl) {\n flows.password = {\n tokenUrl,\n refreshUrl: tokenUrl,\n scopes,\n }\n }\n\n // Client Credentials\n if (grantTypes.has('client_credentials') && tokenUrl) {\n flows.clientCredentials = {\n tokenUrl,\n refreshUrl: tokenUrl,\n scopes,\n }\n }\n\n // Authorization Code\n if (grantTypes.has('authorization_code') && authorizationUrl && tokenUrl) {\n flows.authorizationCode = {\n authorizationUrl,\n tokenUrl,\n refreshUrl: tokenUrl,\n 'x-usePkce': usePkce,\n scopes,\n }\n }\n\n return coerceValue(OpenIDConnectSchema, flows)\n}\n","<script setup lang=\"ts\">\nimport { ScalarButton, useLoadingState } from '@scalar/components'\nimport { useToasts } from '@scalar/use-toasts'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport { type OpenIdConnectObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\nimport { DataTableRow } from '@/components/DataTable'\nimport { fetchOpenIDConnectDiscovery } from '@/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery'\nimport { openIDDiscoveryToFlows } from '@/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows'\n\nimport RequestAuthDataTableInput from './RequestAuthDataTableInput.vue'\n\nconst { environment, eventBus, getStaticBorderClass, name, scheme, proxyUrl } =\n defineProps<{\n /** Current environment configuration */\n environment: XScalarEnvironment\n /** Event bus for authentication updates */\n eventBus: WorkspaceEventBus\n /** Get the static border class */\n getStaticBorderClass: () => string | false\n /** Name of the security scheme */\n name: string\n /** Proxy URL */\n proxyUrl: string\n /** OpenID Connect scheme */\n scheme: OpenIdConnectObject\n }>()\n\nconst loader = useLoadingState()\nconst { toast } = useToasts()\n\n/**\n * Fetches the OpenID Connect discovery document and triggers authorization\n */\nconst handleOpenIdConnect = async (): Promise<void> => {\n if (loader.isLoading || !scheme.openIdConnectUrl) {\n return\n }\n\n loader.start()\n const [error, _discovery] = await fetchOpenIDConnectDiscovery(\n scheme.openIdConnectUrl,\n proxyUrl,\n )\n await loader.clear()\n\n // Toast for error\n if (error) {\n console.error(error)\n toast(\n error?.message ?? 'Failed to fetch OpenID Connect configuration',\n 'error',\n )\n return\n }\n\n /** Set the newly discovered params in the secret store */\n const openIdConnect = openIDDiscoveryToFlows(_discovery)\n eventBus.emit('auth:update:security-scheme-secrets', {\n payload: openIdConnect,\n name,\n overwrite: true,\n })\n}\n\nconst handleUpdateOpenIdConnectUrl = (value: string): void =>\n eventBus.emit('auth:update:security-scheme', {\n payload: {\n type: 'openIdConnect',\n openIdConnectUrl: value,\n },\n name,\n })\n</script>\n\n<template>\n <DataTableRow>\n <RequestAuthDataTableInput\n :containerClass=\"getStaticBorderClass()\"\n :environment\n :modelValue=\"scheme.openIdConnectUrl\"\n placeholder=\"https://example.com/.well-known/openid-configuration\"\n required\n @update:modelValue=\"handleUpdateOpenIdConnectUrl\">\n Discovery URL\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <DataTableRow class=\"min-w-full\">\n <div class=\"flex h-8 w-full items-center justify-end border-t\">\n <ScalarButton\n class=\"mr-0.75 p-0 px-2 py-0.5\"\n :disabled=\"!scheme.openIdConnectUrl\"\n :loader\n size=\"sm\"\n variant=\"outlined\"\n @click=\"handleOpenIdConnect\">\n Fetch Configuration\n </ScalarButton>\n </div>\n </DataTableRow>\n</template>\n","<script setup lang=\"ts\">\nimport { ScalarButton, useLoadingState } from '@scalar/components'\nimport { useToasts } from '@scalar/use-toasts'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport { type OpenIdConnectObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\nimport { DataTableRow } from '@/components/DataTable'\nimport { fetchOpenIDConnectDiscovery } from '@/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery'\nimport { openIDDiscoveryToFlows } from '@/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows'\n\nimport RequestAuthDataTableInput from './RequestAuthDataTableInput.vue'\n\nconst { environment, eventBus, getStaticBorderClass, name, scheme, proxyUrl } =\n defineProps<{\n /** Current environment configuration */\n environment: XScalarEnvironment\n /** Event bus for authentication updates */\n eventBus: WorkspaceEventBus\n /** Get the static border class */\n getStaticBorderClass: () => string | false\n /** Name of the security scheme */\n name: string\n /** Proxy URL */\n proxyUrl: string\n /** OpenID Connect scheme */\n scheme: OpenIdConnectObject\n }>()\n\nconst loader = useLoadingState()\nconst { toast } = useToasts()\n\n/**\n * Fetches the OpenID Connect discovery document and triggers authorization\n */\nconst handleOpenIdConnect = async (): Promise<void> => {\n if (loader.isLoading || !scheme.openIdConnectUrl) {\n return\n }\n\n loader.start()\n const [error, _discovery] = await fetchOpenIDConnectDiscovery(\n scheme.openIdConnectUrl,\n proxyUrl,\n )\n await loader.clear()\n\n // Toast for error\n if (error) {\n console.error(error)\n toast(\n error?.message ?? 'Failed to fetch OpenID Connect configuration',\n 'error',\n )\n return\n }\n\n /** Set the newly discovered params in the secret store */\n const openIdConnect = openIDDiscoveryToFlows(_discovery)\n eventBus.emit('auth:update:security-scheme-secrets', {\n payload: openIdConnect,\n name,\n overwrite: true,\n })\n}\n\nconst handleUpdateOpenIdConnectUrl = (value: string): void =>\n eventBus.emit('auth:update:security-scheme', {\n payload: {\n type: 'openIdConnect',\n openIdConnectUrl: value,\n },\n name,\n })\n</script>\n\n<template>\n <DataTableRow>\n <RequestAuthDataTableInput\n :containerClass=\"getStaticBorderClass()\"\n :environment\n :modelValue=\"scheme.openIdConnectUrl\"\n placeholder=\"https://example.com/.well-known/openid-configuration\"\n required\n @update:modelValue=\"handleUpdateOpenIdConnectUrl\">\n Discovery URL\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <DataTableRow class=\"min-w-full\">\n <div class=\"flex h-8 w-full items-center justify-end border-t\">\n <ScalarButton\n class=\"mr-0.75 p-0 px-2 py-0.5\"\n :disabled=\"!scheme.openIdConnectUrl\"\n :loader\n size=\"sm\"\n variant=\"outlined\"\n @click=\"handleOpenIdConnect\">\n Fetch Configuration\n </ScalarButton>\n </div>\n </DataTableRow>\n</template>\n","<script setup lang=\"ts\">\nimport { ScalarMarkdownSummary } from '@scalar/components'\nimport type {\n SecretsApiKey,\n SecretsHttp,\n} from '@scalar/workspace-store/entities/auth'\nimport type {\n ApiReferenceEvents,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type {\n ApiKeyObject,\n SecurityRequirementObject,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { capitalize, computed, ref } from 'vue'\n\nimport type { MergedSecuritySchemes } from '@/v2/blocks/scalar-auth-selector-block'\nimport type { SecuritySchemeObjectSecret } from '@/v2/blocks/scalar-auth-selector-block/helpers/secret-types'\nimport { DataTableCell, DataTableRow } from '@/v2/components/data-table'\n\nimport OAuth2 from './OAuth2.vue'\nimport OpenIDConnect from './OpenIDConnect.vue'\nimport RequestAuthDataTableInput from './RequestAuthDataTableInput.vue'\n\ntype SecurityItem = {\n scheme: SecuritySchemeObjectSecret | undefined\n name: string\n scopes: string[]\n}\n\nconst {\n environment,\n isStatic,\n proxyUrl,\n selectedSecuritySchemas,\n securitySchemes,\n server,\n eventBus,\n} = defineProps<{\n /** Current environment configuration */\n environment: XScalarEnvironment\n /** Controls the display of certain borders which are used when we are non-collapsible */\n isStatic: boolean\n /** Proxy URL */\n proxyUrl: string\n /** Selected security schemes*/\n selectedSecuritySchemas: SecurityRequirementObject\n /** Merged security schemes from the document and the config together with the auth store secrets */\n securitySchemes: MergedSecuritySchemes\n /** Current server configuration */\n server: ServerObject | null\n /** Event bus for authentication updates */\n eventBus: WorkspaceEventBus\n}>()\n\nconst emits = defineEmits<{\n (\n e: 'update:selectedScopes',\n payload: Omit<ApiReferenceEvents['auth:update:selected-scopes'], 'meta'>,\n ): void\n}>()\n\n/**\n * Resolves security schemes from the OpenAPI document and combines them with their selected scopes.\n * Each item includes the scheme definition, name, and associated scopes.\n */\nconst security = computed<SecurityItem[]>(() =>\n Object.entries(selectedSecuritySchemas).map(([name, scopes = []]) => ({\n scheme: getResolvedRef(securitySchemes[name]),\n name,\n scopes,\n })),\n)\n\n/** Tracks which OAuth2 flow is currently active when multiple flows are available. */\nconst activeFlow = ref<string>('')\n\n/** Keeps the selected flow in sync with currently available flow keys. */\nconst selectedFlow = computed<string>(() => {\n const authFlowKeys = security.value.flatMap(({ scheme }) => {\n if (scheme?.type !== 'oauth2' && scheme?.type !== 'openIdConnect') {\n return []\n }\n\n return Object.keys(scheme.flows ?? {})\n })\n\n return authFlowKeys.includes(activeFlow.value) ? activeFlow.value : ''\n})\n\nconst setActiveFlow = (flow: string): void => {\n activeFlow.value = flow\n}\n\n/** Determines if multiple auth schemes are configured, which affects the UI layout. */\nconst hasMultipleSchemes = computed<boolean>(() => security.value.length > 1)\n\n/**\n * Generates a human-readable label for the security scheme.\n * Intentionally omits the description here — it is rendered separately as\n * rich text via ScalarMarkdownSummary so markdown formatting is preserved.\n */\nconst generateLabel = (\n name: string,\n scheme: SecuritySchemeObjectSecret,\n): string => {\n const capitalizedName = capitalize(name)\n\n switch (scheme.type) {\n case 'apiKey':\n return `${capitalizedName}: ${scheme.in}`\n\n case 'openIdConnect':\n case 'oauth2': {\n const firstFlow = Object.keys(scheme.flows ?? {})[0]\n const currentFlow = selectedFlow.value || firstFlow\n if (!currentFlow) {\n return capitalizedName\n }\n return `${capitalizedName}: ${currentFlow}`\n }\n\n case 'http':\n return `${capitalizedName}: ${scheme.scheme}`\n\n default:\n return capitalizedName\n }\n}\n\n/**\n * Determines if an OAuth2 flow tab should be active.\n * The first flow is active by default if no flow is explicitly selected.\n */\nconst isFlowActive = (flowKey: string, index: number): boolean =>\n selectedFlow.value === flowKey || (index === 0 && !selectedFlow.value)\n\n/** Computes the container class for static display mode. */\nconst getStaticBorderClass = (): string | false => isStatic && 'border-t'\n\nconst handleHttpSecretsUpdate = (\n payload: Omit<Partial<SecretsHttp>, 'type'>,\n name: string,\n): void =>\n eventBus.emit('auth:update:security-scheme-secrets', {\n payload: { type: 'http', ...payload },\n name,\n })\n\nconst handleApiKeySecretsUpdate = (\n payload: Omit<Partial<SecretsApiKey>, 'type'>,\n name: string,\n): void =>\n eventBus.emit('auth:update:security-scheme-secrets', {\n payload: { type: 'apiKey', ...payload },\n name,\n })\n\nconst handleApiKeySecuritySchemeUpdate = (\n payload: Omit<Partial<ApiKeyObject>, 'type'>,\n name: string,\n): void =>\n eventBus.emit('auth:update:security-scheme', {\n payload: { type: 'apiKey', ...payload },\n name,\n })\n\n/** Handles scope selection updates for OAuth2 */\nconst handleScopesUpdate = (\n name: string,\n event: { scopes: string[] },\n): void => {\n emits('update:selectedScopes', {\n id: Object.keys(selectedSecuritySchemas),\n name,\n ...event,\n })\n}\n\n/**\n * Computes dynamic classes for OAuth2 flow tabs based on active state.\n */\nconst getFlowTabClasses = (flowKey: string, index: number): string => {\n const baseClasses =\n 'floating-bg text-c-3 relative cursor-pointer border-b border-transparent py-1 text-base font-medium'\n const activeClasses = '!text-c-1 !rounded-none border-b !border-current'\n\n return isFlowActive(flowKey, index)\n ? `${baseClasses} ${activeClasses} ${isStatic ? 'opacity-100' : ''}`\n : baseClasses\n}\n</script>\n<template>\n <template\n v-for=\"{ scheme, name, scopes } in security\"\n :key=\"name\">\n <!--\n Header row for AND'ed schemes: label (bold) and description (rich text) are\n combined.\n -->\n <DataTableRow v-if=\"hasMultipleSchemes && scheme\">\n <DataTableCell\n :aria-label=\"generateLabel(name, scheme)\"\n class=\"max-h-[auto]\">\n <div class=\"bg-b-1 min-w-0 flex-1 px-3 py-1.25\">\n <p class=\"text-c-1 leading-5.5 font-medium\">\n {{ generateLabel(name, scheme) }}\n </p>\n <ScalarMarkdownSummary\n v-if=\"scheme.description\"\n class=\"auth-description text-c-2 w-full\"\n :value=\"scheme.description\" />\n </div>\n </DataTableCell>\n </DataTableRow>\n\n <!-- Description: shown for single auth schemes with descriptions -->\n <DataTableRow v-if=\"scheme?.description && !hasMultipleSchemes\">\n <DataTableCell\n :aria-label=\"scheme.description\"\n class=\"max-h-[auto]\">\n <ScalarMarkdownSummary\n class=\"auth-description bg-b-1 text-c-2 min-w-0 flex-1 px-3 py-1.25\"\n :value=\"scheme.description\" />\n </DataTableCell>\n </DataTableRow>\n\n <!-- HTTP Authentication -->\n <template v-if=\"scheme?.type === 'http'\">\n <!-- Bearer Token -->\n <DataTableRow v-if=\"scheme.scheme === 'bearer'\">\n <RequestAuthDataTableInput\n :containerClass=\"getStaticBorderClass()\"\n :environment\n :modelValue=\"scheme['x-scalar-secret-token']\"\n placeholder=\"Token\"\n type=\"password\"\n @update:modelValue=\"\n (v) => handleHttpSecretsUpdate({ 'x-scalar-secret-token': v }, name)\n \">\n Bearer Token\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <!-- HTTP Basic Authentication -->\n <template v-else-if=\"scheme?.scheme === 'basic'\">\n <DataTableRow>\n <RequestAuthDataTableInput\n class=\"text-c-2\"\n :environment\n :modelValue=\"scheme['x-scalar-secret-username']\"\n placeholder=\"janedoe\"\n required\n @update:modelValue=\"\n (v) =>\n handleHttpSecretsUpdate({ 'x-scalar-secret-username': v }, name)\n \">\n Username\n </RequestAuthDataTableInput>\n </DataTableRow>\n <DataTableRow>\n <RequestAuthDataTableInput\n :environment\n :modelValue=\"scheme['x-scalar-secret-password']\"\n placeholder=\"********\"\n type=\"password\"\n @update:modelValue=\"\n (v) =>\n handleHttpSecretsUpdate({ 'x-scalar-secret-password': v }, name)\n \">\n Password\n </RequestAuthDataTableInput>\n </DataTableRow>\n </template>\n </template>\n\n <!-- API Key Authentication -->\n <template v-else-if=\"scheme?.type === 'apiKey'\">\n <DataTableRow>\n <RequestAuthDataTableInput\n :containerClass=\"getStaticBorderClass()\"\n :environment\n :modelValue=\"scheme.name\"\n placeholder=\"api-key\"\n @update:modelValue=\"\n (v) => handleApiKeySecuritySchemeUpdate({ name: v }, name)\n \">\n Name\n </RequestAuthDataTableInput>\n </DataTableRow>\n <DataTableRow>\n <RequestAuthDataTableInput\n :environment\n :modelValue=\"scheme['x-scalar-secret-token']\"\n placeholder=\"QUxMIFlPVVIgQkFTRSBBUkUgQkVMT05HIFRPIFVT\"\n type=\"password\"\n @update:modelValue=\"\n (v) =>\n handleApiKeySecretsUpdate({ 'x-scalar-secret-token': v }, name)\n \">\n Value\n </RequestAuthDataTableInput>\n </DataTableRow>\n </template>\n\n <!-- OAuth 2.0 / OpenID Connect Authentication -->\n <template\n v-else-if=\"scheme?.type === 'oauth2' || scheme?.type === 'openIdConnect'\">\n <!-- OpenID Connect -->\n <OpenIDConnect\n v-if=\"\n scheme?.type === 'openIdConnect' &&\n !Object.keys(scheme.flows ?? {}).length\n \"\n :environment\n :eventBus\n :getStaticBorderClass\n :name\n :proxyUrl\n :scheme />\n\n <!-- Flow selector tabs: shown when multiple flows are available -->\n <DataTableRow v-if=\"Object.keys(scheme.flows ?? {}).length > 1\">\n <div class=\"flex min-h-8 border-t text-base\">\n <div class=\"flex h-8 max-w-full gap-2.5 overflow-x-auto px-3\">\n <button\n v-for=\"(_, key, ind) in scheme.flows\"\n :key=\"key\"\n :class=\"getFlowTabClasses(key, ind)\"\n type=\"button\"\n @click=\"setActiveFlow(key)\">\n <span class=\"relative z-10\">{{ key }}</span>\n </button>\n </div>\n </div>\n </DataTableRow>\n\n <!-- OAuth2 flow configuration -->\n <template\n v-for=\"(_flow, key, ind) in scheme.flows\"\n :key=\"key\">\n <OAuth2\n v-if=\"scheme.flows && isFlowActive(key, ind)\"\n :environment\n :eventBus\n :flows=\"scheme.flows\"\n :name=\"name\"\n :proxyUrl\n :scheme\n :selectedScopes=\"scopes\"\n :server=\"server\"\n :type=\"key\"\n @update:selectedScopes=\"(event) => handleScopesUpdate(name, event)\" />\n </template>\n </template>\n\n <!-- Scheme is missing type -->\n <div\n v-else\n class=\"text-c-3 flex items-center justify-center border-t p-4 px-4 text-center text-xs text-balance\">\n The security scheme is missing a type, please double check your OpenAPI\n document or Authentication Configuration\n </div>\n </template>\n</template>\n","<script setup lang=\"ts\">\nimport { ScalarMarkdownSummary } from '@scalar/components'\nimport type {\n SecretsApiKey,\n SecretsHttp,\n} from '@scalar/workspace-store/entities/auth'\nimport type {\n ApiReferenceEvents,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type {\n ApiKeyObject,\n SecurityRequirementObject,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { capitalize, computed, ref } from 'vue'\n\nimport type { MergedSecuritySchemes } from '@/v2/blocks/scalar-auth-selector-block'\nimport type { SecuritySchemeObjectSecret } from '@/v2/blocks/scalar-auth-selector-block/helpers/secret-types'\nimport { DataTableCell, DataTableRow } from '@/v2/components/data-table'\n\nimport OAuth2 from './OAuth2.vue'\nimport OpenIDConnect from './OpenIDConnect.vue'\nimport RequestAuthDataTableInput from './RequestAuthDataTableInput.vue'\n\ntype SecurityItem = {\n scheme: SecuritySchemeObjectSecret | undefined\n name: string\n scopes: string[]\n}\n\nconst {\n environment,\n isStatic,\n proxyUrl,\n selectedSecuritySchemas,\n securitySchemes,\n server,\n eventBus,\n} = defineProps<{\n /** Current environment configuration */\n environment: XScalarEnvironment\n /** Controls the display of certain borders which are used when we are non-collapsible */\n isStatic: boolean\n /** Proxy URL */\n proxyUrl: string\n /** Selected security schemes*/\n selectedSecuritySchemas: SecurityRequirementObject\n /** Merged security schemes from the document and the config together with the auth store secrets */\n securitySchemes: MergedSecuritySchemes\n /** Current server configuration */\n server: ServerObject | null\n /** Event bus for authentication updates */\n eventBus: WorkspaceEventBus\n}>()\n\nconst emits = defineEmits<{\n (\n e: 'update:selectedScopes',\n payload: Omit<ApiReferenceEvents['auth:update:selected-scopes'], 'meta'>,\n ): void\n}>()\n\n/**\n * Resolves security schemes from the OpenAPI document and combines them with their selected scopes.\n * Each item includes the scheme definition, name, and associated scopes.\n */\nconst security = computed<SecurityItem[]>(() =>\n Object.entries(selectedSecuritySchemas).map(([name, scopes = []]) => ({\n scheme: getResolvedRef(securitySchemes[name]),\n name,\n scopes,\n })),\n)\n\n/** Tracks which OAuth2 flow is currently active when multiple flows are available. */\nconst activeFlow = ref<string>('')\n\n/** Keeps the selected flow in sync with currently available flow keys. */\nconst selectedFlow = computed<string>(() => {\n const authFlowKeys = security.value.flatMap(({ scheme }) => {\n if (scheme?.type !== 'oauth2' && scheme?.type !== 'openIdConnect') {\n return []\n }\n\n return Object.keys(scheme.flows ?? {})\n })\n\n return authFlowKeys.includes(activeFlow.value) ? activeFlow.value : ''\n})\n\nconst setActiveFlow = (flow: string): void => {\n activeFlow.value = flow\n}\n\n/** Determines if multiple auth schemes are configured, which affects the UI layout. */\nconst hasMultipleSchemes = computed<boolean>(() => security.value.length > 1)\n\n/**\n * Generates a human-readable label for the security scheme.\n * Intentionally omits the description here — it is rendered separately as\n * rich text via ScalarMarkdownSummary so markdown formatting is preserved.\n */\nconst generateLabel = (\n name: string,\n scheme: SecuritySchemeObjectSecret,\n): string => {\n const capitalizedName = capitalize(name)\n\n switch (scheme.type) {\n case 'apiKey':\n return `${capitalizedName}: ${scheme.in}`\n\n case 'openIdConnect':\n case 'oauth2': {\n const firstFlow = Object.keys(scheme.flows ?? {})[0]\n const currentFlow = selectedFlow.value || firstFlow\n if (!currentFlow) {\n return capitalizedName\n }\n return `${capitalizedName}: ${currentFlow}`\n }\n\n case 'http':\n return `${capitalizedName}: ${scheme.scheme}`\n\n default:\n return capitalizedName\n }\n}\n\n/**\n * Determines if an OAuth2 flow tab should be active.\n * The first flow is active by default if no flow is explicitly selected.\n */\nconst isFlowActive = (flowKey: string, index: number): boolean =>\n selectedFlow.value === flowKey || (index === 0 && !selectedFlow.value)\n\n/** Computes the container class for static display mode. */\nconst getStaticBorderClass = (): string | false => isStatic && 'border-t'\n\nconst handleHttpSecretsUpdate = (\n payload: Omit<Partial<SecretsHttp>, 'type'>,\n name: string,\n): void =>\n eventBus.emit('auth:update:security-scheme-secrets', {\n payload: { type: 'http', ...payload },\n name,\n })\n\nconst handleApiKeySecretsUpdate = (\n payload: Omit<Partial<SecretsApiKey>, 'type'>,\n name: string,\n): void =>\n eventBus.emit('auth:update:security-scheme-secrets', {\n payload: { type: 'apiKey', ...payload },\n name,\n })\n\nconst handleApiKeySecuritySchemeUpdate = (\n payload: Omit<Partial<ApiKeyObject>, 'type'>,\n name: string,\n): void =>\n eventBus.emit('auth:update:security-scheme', {\n payload: { type: 'apiKey', ...payload },\n name,\n })\n\n/** Handles scope selection updates for OAuth2 */\nconst handleScopesUpdate = (\n name: string,\n event: { scopes: string[] },\n): void => {\n emits('update:selectedScopes', {\n id: Object.keys(selectedSecuritySchemas),\n name,\n ...event,\n })\n}\n\n/**\n * Computes dynamic classes for OAuth2 flow tabs based on active state.\n */\nconst getFlowTabClasses = (flowKey: string, index: number): string => {\n const baseClasses =\n 'floating-bg text-c-3 relative cursor-pointer border-b border-transparent py-1 text-base font-medium'\n const activeClasses = '!text-c-1 !rounded-none border-b !border-current'\n\n return isFlowActive(flowKey, index)\n ? `${baseClasses} ${activeClasses} ${isStatic ? 'opacity-100' : ''}`\n : baseClasses\n}\n</script>\n<template>\n <template\n v-for=\"{ scheme, name, scopes } in security\"\n :key=\"name\">\n <!--\n Header row for AND'ed schemes: label (bold) and description (rich text) are\n combined.\n -->\n <DataTableRow v-if=\"hasMultipleSchemes && scheme\">\n <DataTableCell\n :aria-label=\"generateLabel(name, scheme)\"\n class=\"max-h-[auto]\">\n <div class=\"bg-b-1 min-w-0 flex-1 px-3 py-1.25\">\n <p class=\"text-c-1 leading-5.5 font-medium\">\n {{ generateLabel(name, scheme) }}\n </p>\n <ScalarMarkdownSummary\n v-if=\"scheme.description\"\n class=\"auth-description text-c-2 w-full\"\n :value=\"scheme.description\" />\n </div>\n </DataTableCell>\n </DataTableRow>\n\n <!-- Description: shown for single auth schemes with descriptions -->\n <DataTableRow v-if=\"scheme?.description && !hasMultipleSchemes\">\n <DataTableCell\n :aria-label=\"scheme.description\"\n class=\"max-h-[auto]\">\n <ScalarMarkdownSummary\n class=\"auth-description bg-b-1 text-c-2 min-w-0 flex-1 px-3 py-1.25\"\n :value=\"scheme.description\" />\n </DataTableCell>\n </DataTableRow>\n\n <!-- HTTP Authentication -->\n <template v-if=\"scheme?.type === 'http'\">\n <!-- Bearer Token -->\n <DataTableRow v-if=\"scheme.scheme === 'bearer'\">\n <RequestAuthDataTableInput\n :containerClass=\"getStaticBorderClass()\"\n :environment\n :modelValue=\"scheme['x-scalar-secret-token']\"\n placeholder=\"Token\"\n type=\"password\"\n @update:modelValue=\"\n (v) => handleHttpSecretsUpdate({ 'x-scalar-secret-token': v }, name)\n \">\n Bearer Token\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <!-- HTTP Basic Authentication -->\n <template v-else-if=\"scheme?.scheme === 'basic'\">\n <DataTableRow>\n <RequestAuthDataTableInput\n class=\"text-c-2\"\n :environment\n :modelValue=\"scheme['x-scalar-secret-username']\"\n placeholder=\"janedoe\"\n required\n @update:modelValue=\"\n (v) =>\n handleHttpSecretsUpdate({ 'x-scalar-secret-username': v }, name)\n \">\n Username\n </RequestAuthDataTableInput>\n </DataTableRow>\n <DataTableRow>\n <RequestAuthDataTableInput\n :environment\n :modelValue=\"scheme['x-scalar-secret-password']\"\n placeholder=\"********\"\n type=\"password\"\n @update:modelValue=\"\n (v) =>\n handleHttpSecretsUpdate({ 'x-scalar-secret-password': v }, name)\n \">\n Password\n </RequestAuthDataTableInput>\n </DataTableRow>\n </template>\n </template>\n\n <!-- API Key Authentication -->\n <template v-else-if=\"scheme?.type === 'apiKey'\">\n <DataTableRow>\n <RequestAuthDataTableInput\n :containerClass=\"getStaticBorderClass()\"\n :environment\n :modelValue=\"scheme.name\"\n placeholder=\"api-key\"\n @update:modelValue=\"\n (v) => handleApiKeySecuritySchemeUpdate({ name: v }, name)\n \">\n Name\n </RequestAuthDataTableInput>\n </DataTableRow>\n <DataTableRow>\n <RequestAuthDataTableInput\n :environment\n :modelValue=\"scheme['x-scalar-secret-token']\"\n placeholder=\"QUxMIFlPVVIgQkFTRSBBUkUgQkVMT05HIFRPIFVT\"\n type=\"password\"\n @update:modelValue=\"\n (v) =>\n handleApiKeySecretsUpdate({ 'x-scalar-secret-token': v }, name)\n \">\n Value\n </RequestAuthDataTableInput>\n </DataTableRow>\n </template>\n\n <!-- OAuth 2.0 / OpenID Connect Authentication -->\n <template\n v-else-if=\"scheme?.type === 'oauth2' || scheme?.type === 'openIdConnect'\">\n <!-- OpenID Connect -->\n <OpenIDConnect\n v-if=\"\n scheme?.type === 'openIdConnect' &&\n !Object.keys(scheme.flows ?? {}).length\n \"\n :environment\n :eventBus\n :getStaticBorderClass\n :name\n :proxyUrl\n :scheme />\n\n <!-- Flow selector tabs: shown when multiple flows are available -->\n <DataTableRow v-if=\"Object.keys(scheme.flows ?? {}).length > 1\">\n <div class=\"flex min-h-8 border-t text-base\">\n <div class=\"flex h-8 max-w-full gap-2.5 overflow-x-auto px-3\">\n <button\n v-for=\"(_, key, ind) in scheme.flows\"\n :key=\"key\"\n :class=\"getFlowTabClasses(key, ind)\"\n type=\"button\"\n @click=\"setActiveFlow(key)\">\n <span class=\"relative z-10\">{{ key }}</span>\n </button>\n </div>\n </div>\n </DataTableRow>\n\n <!-- OAuth2 flow configuration -->\n <template\n v-for=\"(_flow, key, ind) in scheme.flows\"\n :key=\"key\">\n <OAuth2\n v-if=\"scheme.flows && isFlowActive(key, ind)\"\n :environment\n :eventBus\n :flows=\"scheme.flows\"\n :name=\"name\"\n :proxyUrl\n :scheme\n :selectedScopes=\"scopes\"\n :server=\"server\"\n :type=\"key\"\n @update:selectedScopes=\"(event) => handleScopesUpdate(name, event)\" />\n </template>\n </template>\n\n <!-- Scheme is missing type -->\n <div\n v-else\n class=\"text-c-3 flex items-center justify-center border-t p-4 px-4 text-center text-xs text-balance\">\n The security scheme is missing a type, please double check your OpenAPI\n document or Authentication Configuration\n </div>\n </template>\n</template>\n","<script setup lang=\"ts\">\nimport type {\n ApiReferenceEvents,\n AuthMeta,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport type { MergedSecuritySchemes } from '@/v2/blocks/scalar-auth-selector-block'\nimport type { SecuritySchemeOption } from '@/v2/blocks/scalar-auth-selector-block/helpers/security-scheme'\nimport { DataTable } from '@/v2/components/data-table'\n\nimport RequestAuthTab from './RequestAuthTab.vue'\n\nconst {\n environment,\n isStatic,\n selectedSchemeOptions,\n activeAuthIndex,\n securitySchemes = {},\n server,\n eventBus,\n meta,\n} = defineProps<{\n /** The current environment configuration */\n environment: XScalarEnvironment\n /** Controls border display for static (non-collapsible) layouts */\n isStatic: boolean\n /** Available authentication scheme options */\n selectedSchemeOptions: SecuritySchemeOption[]\n /** Index of the currently active authentication tab */\n activeAuthIndex: number\n /** Proxy URL */\n proxyUrl: string\n /** OpenAPI security scheme definitions */\n securitySchemes: MergedSecuritySchemes\n /** Current server configuration */\n server: ServerObject | null\n /** Event bus for authentication updates */\n eventBus: WorkspaceEventBus\n /** Metadata for authentication context */\n meta: AuthMeta\n}>()\n\n/** Currently selected authentication scheme based on the active tab index */\nconst activeScheme = computed<SecuritySchemeOption | undefined>(\n () => selectedSchemeOptions[activeAuthIndex],\n)\n\n/**\n * Whether to display multiple authentication tabs.\n * Only shows tabs when there are 2 or more schemes available.\n */\nconst shouldShowTabs = computed<boolean>(() => selectedSchemeOptions.length > 1)\n\n/** Handles authentication tab selection */\nconst handleTabChange = (index: number) =>\n eventBus.emit('auth:update:active-index', {\n index,\n meta,\n })\n\n/** Handles updates to OAuth scope selection */\nconst handleScopesUpdate = (\n params: Omit<ApiReferenceEvents['auth:update:selected-scopes'], 'meta'>,\n): void =>\n eventBus.emit('auth:update:selected-scopes', {\n ...params,\n meta,\n })\n\n/** Determines if a tab is currently active */\nconst isTabActive = (index: number): boolean => activeAuthIndex === index\n\n/** Expose the active scheme for parent component access */\ndefineExpose({\n activeScheme,\n})\n</script>\n\n<template>\n <form @submit.prevent>\n <!-- Authentication Tabs -->\n <div\n v-if=\"shouldShowTabs\"\n class=\"box-content flex flex-wrap gap-x-2.5 overflow-hidden border border-b-0 px-3\"\n :class=\"{ 'border-x-0': !isStatic }\"\n data-testid=\"auth-tabs\">\n <div\n v-for=\"(option, index) in selectedSchemeOptions\"\n :key=\"option.id\"\n class=\"relative z-1 -mb-[var(--scalar-border-width)] flex h-8\">\n <button\n class=\"floating-bg relative cursor-pointer border-b border-transparent py-1 text-sm font-medium transition-colors\"\n :class=\"isTabActive(index) ? 'text-c-1' : 'text-c-3'\"\n type=\"button\"\n @click=\"handleTabChange(index)\">\n <span class=\"relative z-10 font-medium whitespace-nowrap\">\n {{ option.label }}\n </span>\n </button>\n\n <!-- Active Tab Indicator -->\n <div\n v-if=\"isTabActive(index)\"\n class=\"absolute inset-x-1 bottom-[var(--scalar-border-width)] left-1/2 z-1 h-px w-full -translate-x-1/2 bg-current\" />\n </div>\n </div>\n\n <!-- Active Authentication Scheme Content -->\n <DataTable\n v-if=\"activeScheme\"\n class=\"flex-1\"\n :class=\"{ 'bg-b-1 rounded-b-lg border border-t-0': isStatic }\"\n :columns=\"['']\"\n presentational>\n <RequestAuthTab\n :environment\n :eventBus\n :isStatic\n :proxyUrl\n :securitySchemes\n :selectedSecuritySchemas=\"activeScheme.value\"\n :server\n @update:selectedScopes=\"handleScopesUpdate\" />\n </DataTable>\n\n <!-- Empty State -->\n <div\n v-else\n class=\"bg-b-1 text-c-3 flex min-h-16 items-center justify-center border-t px-4 text-sm\"\n :class=\"{ 'min-h-[calc(4rem+0.5px)] rounded-b-lg border': isStatic }\">\n No authentication selected\n </div>\n </form>\n</template>\n","<script setup lang=\"ts\">\nimport type {\n ApiReferenceEvents,\n AuthMeta,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport type { MergedSecuritySchemes } from '@/v2/blocks/scalar-auth-selector-block'\nimport type { SecuritySchemeOption } from '@/v2/blocks/scalar-auth-selector-block/helpers/security-scheme'\nimport { DataTable } from '@/v2/components/data-table'\n\nimport RequestAuthTab from './RequestAuthTab.vue'\n\nconst {\n environment,\n isStatic,\n selectedSchemeOptions,\n activeAuthIndex,\n securitySchemes = {},\n server,\n eventBus,\n meta,\n} = defineProps<{\n /** The current environment configuration */\n environment: XScalarEnvironment\n /** Controls border display for static (non-collapsible) layouts */\n isStatic: boolean\n /** Available authentication scheme options */\n selectedSchemeOptions: SecuritySchemeOption[]\n /** Index of the currently active authentication tab */\n activeAuthIndex: number\n /** Proxy URL */\n proxyUrl: string\n /** OpenAPI security scheme definitions */\n securitySchemes: MergedSecuritySchemes\n /** Current server configuration */\n server: ServerObject | null\n /** Event bus for authentication updates */\n eventBus: WorkspaceEventBus\n /** Metadata for authentication context */\n meta: AuthMeta\n}>()\n\n/** Currently selected authentication scheme based on the active tab index */\nconst activeScheme = computed<SecuritySchemeOption | undefined>(\n () => selectedSchemeOptions[activeAuthIndex],\n)\n\n/**\n * Whether to display multiple authentication tabs.\n * Only shows tabs when there are 2 or more schemes available.\n */\nconst shouldShowTabs = computed<boolean>(() => selectedSchemeOptions.length > 1)\n\n/** Handles authentication tab selection */\nconst handleTabChange = (index: number) =>\n eventBus.emit('auth:update:active-index', {\n index,\n meta,\n })\n\n/** Handles updates to OAuth scope selection */\nconst handleScopesUpdate = (\n params: Omit<ApiReferenceEvents['auth:update:selected-scopes'], 'meta'>,\n): void =>\n eventBus.emit('auth:update:selected-scopes', {\n ...params,\n meta,\n })\n\n/** Determines if a tab is currently active */\nconst isTabActive = (index: number): boolean => activeAuthIndex === index\n\n/** Expose the active scheme for parent component access */\ndefineExpose({\n activeScheme,\n})\n</script>\n\n<template>\n <form @submit.prevent>\n <!-- Authentication Tabs -->\n <div\n v-if=\"shouldShowTabs\"\n class=\"box-content flex flex-wrap gap-x-2.5 overflow-hidden border border-b-0 px-3\"\n :class=\"{ 'border-x-0': !isStatic }\"\n data-testid=\"auth-tabs\">\n <div\n v-for=\"(option, index) in selectedSchemeOptions\"\n :key=\"option.id\"\n class=\"relative z-1 -mb-[var(--scalar-border-width)] flex h-8\">\n <button\n class=\"floating-bg relative cursor-pointer border-b border-transparent py-1 text-sm font-medium transition-colors\"\n :class=\"isTabActive(index) ? 'text-c-1' : 'text-c-3'\"\n type=\"button\"\n @click=\"handleTabChange(index)\">\n <span class=\"relative z-10 font-medium whitespace-nowrap\">\n {{ option.label }}\n </span>\n </button>\n\n <!-- Active Tab Indicator -->\n <div\n v-if=\"isTabActive(index)\"\n class=\"absolute inset-x-1 bottom-[var(--scalar-border-width)] left-1/2 z-1 h-px w-full -translate-x-1/2 bg-current\" />\n </div>\n </div>\n\n <!-- Active Authentication Scheme Content -->\n <DataTable\n v-if=\"activeScheme\"\n class=\"flex-1\"\n :class=\"{ 'bg-b-1 rounded-b-lg border border-t-0': isStatic }\"\n :columns=\"['']\"\n presentational>\n <RequestAuthTab\n :environment\n :eventBus\n :isStatic\n :proxyUrl\n :securitySchemes\n :selectedSecuritySchemas=\"activeScheme.value\"\n :server\n @update:selectedScopes=\"handleScopesUpdate\" />\n </DataTable>\n\n <!-- Empty State -->\n <div\n v-else\n class=\"bg-b-1 text-c-3 flex min-h-16 items-center justify-center border-t px-4 text-sm\"\n :class=\"{ 'min-h-[calc(4rem+0.5px)] rounded-b-lg border': isStatic }\">\n No authentication selected\n </div>\n </form>\n</template>\n","<script setup lang=\"ts\">\nimport {\n ScalarButton,\n ScalarComboboxMultiselect,\n ScalarIconButton,\n ScalarListboxCheckbox,\n useModal,\n type Icon,\n type ScalarButton as ScalarButtonType,\n} from '@scalar/components'\nimport { ScalarIconCaretDown, ScalarIconTrash } from '@scalar/icons'\nimport type { SelectedSecurity } from '@scalar/workspace-store/entities/auth'\nimport type {\n AuthMeta,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { unpackProxyObject } from '@scalar/workspace-store/helpers/unpack-proxy'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type {\n OpenApiDocument,\n SecurityRequirementObject,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed, ref, useId } from 'vue'\n\nimport DeleteRequestAuthModal from '@/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue'\nimport { isAuthOptional } from '@/v2/blocks/scalar-auth-selector-block/helpers/is-auth-optional'\nimport type { MergedSecuritySchemes } from '@/v2/blocks/scalar-auth-selector-block/helpers/merge-security'\nimport {\n formatComplexScheme,\n formatScheme,\n getSecuritySchemeOptions,\n type SecuritySchemeOption,\n} from '@/v2/blocks/scalar-auth-selector-block/helpers/security-scheme'\nimport { CollapsibleSection } from '@/v2/components/layout'\n\nimport RequestAuthDataTable from './RequestAuthDataTable.vue'\n\nconst {\n environment,\n eventBus,\n createAnySecurityScheme = false,\n defaultOpen = true,\n isStatic = false,\n meta,\n proxyUrl,\n securityRequirements,\n securitySchemes,\n selectedSecurity,\n server,\n title,\n} = defineProps<{\n environment: XScalarEnvironment\n eventBus: WorkspaceEventBus\n /** Allows adding authentication which is not in the document */\n createAnySecurityScheme?: boolean\n /** Whether the authentication disclosure should start expanded */\n defaultOpen?: boolean\n /** Creates a static disclosure that cannot be collapsed */\n isStatic?: boolean\n meta: AuthMeta\n proxyUrl: string\n securityRequirements: OpenApiDocument['security']\n securitySchemes: MergedSecuritySchemes\n selectedSecurity: SelectedSecurity | undefined\n server: ServerObject | null\n title: string\n}>()\n\nconst titleId = useId()\nconst comboboxButtonRef = ref<typeof ScalarButtonType | null>(null)\nconst isDisclosureOpen = ref(false)\n\nconst deleteModal = useModal()\nconst schemeToDelete = ref<{\n label: string\n payload: SecurityRequirementObject\n} | null>(null)\n\n/**\n * Determines if authentication is required or optional\n *\n * Auth is optional when there is an empty security requirement and no complex requirements.\n * Complex requirements have multiple auth schemes combined (e.g., API key + OAuth).\n */\nconst authIndicator = computed<{ icon: Icon; text: string } | null>(() => {\n if (!securityRequirements?.length) {\n return null\n }\n\n const isOptional = isAuthOptional(securityRequirements)\n\n return {\n icon: isOptional ? 'Unlock' : 'Lock',\n text: isOptional ? 'Optional' : 'Required',\n }\n})\n\n/** All available auth scheme options for the dropdown */\nconst availableSchemeOptions = computed(() =>\n getSecuritySchemeOptions(\n securityRequirements ?? [],\n securitySchemes ?? {},\n selectedSecurity?.selectedSchemes ?? [],\n createAnySecurityScheme,\n ),\n)\n\n/** Currently active auth schemes selected for this operation or collection */\nconst activeSchemeOptions = computed<SecuritySchemeOption[]>(() => {\n const schemes = selectedSecurity?.selectedSchemes\n if (!schemes?.length) {\n return []\n }\n\n return schemes.flatMap((requirement) => {\n const schemeNames = Object.keys(requirement)\n\n if (schemeNames.length === 0) {\n return []\n }\n\n // Complex auth requirement with multiple schemes\n if (schemeNames.length > 1) {\n return formatComplexScheme(requirement)\n }\n\n // Simple auth requirement with single scheme\n const schemeName = schemeNames[0]\n if (!schemeName) {\n return []\n }\n\n const scheme = getResolvedRef(securitySchemes?.[schemeName])\n if (!scheme) {\n return []\n }\n\n return formatScheme({\n name: schemeName,\n value: requirement,\n })\n })\n})\n\n/**\n * Opens the combobox dropdown when clicking the auth indicator badge.\n * Prevents the disclosure from toggling if it is already open.\n */\nconst handleAuthIndicatorClick = (event: Event): void => {\n if (isDisclosureOpen.value) {\n event.stopPropagation()\n }\n comboboxButtonRef.value?.$el.click()\n}\n\n/**\n * Updates the selected auth schemes.\n * Separates existing schemes from newly created ones for the event payload.\n */\nconst handleSchemeSelection = (selected: SecuritySchemeOption[]): void => {\n const existingSchemes = selected\n .filter((option) => option.payload === undefined)\n .map((option) => unpackProxyObject(option.value, { depth: 2 }))\n\n const newSchemes = selected\n .filter((option) => option.payload !== undefined)\n .map((option) => ({\n name: option.label,\n scheme: option.payload!,\n }))\n\n eventBus.emit('auth:update:selected-security-schemes', {\n selectedRequirements: existingSchemes,\n newSchemes,\n meta,\n })\n}\n\n/** Shows the delete confirmation modal for the selected scheme */\nconst handleDeleteRequest = (option: {\n label: string\n value: SecurityRequirementObject\n}): void => {\n schemeToDelete.value = { label: option.label, payload: option.value }\n deleteModal.show()\n}\n\n/** Deletes the selected auth scheme after confirmation */\nconst handleDeleteConfirm = (): void => {\n if (!schemeToDelete.value) {\n return\n }\n\n eventBus.emit('auth:delete:security-scheme', {\n names: Object.keys(schemeToDelete.value.payload),\n })\n\n schemeToDelete.value = null\n deleteModal.hide()\n}\n\ndefineExpose({\n authIndicator,\n selectedSchemeOptions: activeSchemeOptions,\n schemeOptions: availableSchemeOptions,\n})\n</script>\n<template>\n <CollapsibleSection\n class=\"group/params relative\"\n :defaultOpen\n :isStatic=\"isStatic\"\n :itemCount=\"activeSchemeOptions.length\"\n @update:modelValue=\"(open) => (isDisclosureOpen = open)\">\n <template #title>\n <div\n :id=\"titleId\"\n class=\"inline-flex items-center gap-0.5 leading-[20px]\">\n <span>{{ title }}</span>\n\n <span\n v-if=\"authIndicator\"\n class=\"text-c-3 hover:bg-b-3 hover:text-c-1 -my-0.5 -mr-1 cursor-pointer rounded px-1 py-0.5 leading-[normal] font-normal\"\n :class=\"{ 'text-c-1': authIndicator.text === 'Required' }\"\n data-testid=\"auth-indicator\"\n @click=\"handleAuthIndicatorClick\">\n {{ authIndicator.text }}\n </span>\n </div>\n </template>\n\n <!-- Auth Dropdown (hidden when only one scheme is available) -->\n <template #actions>\n <ScalarComboboxMultiselect\n class=\"w-72 text-xs\"\n :modelValue=\"activeSchemeOptions\"\n multiple\n :options=\"availableSchemeOptions\"\n placement=\"bottom-end\"\n teleport\n @delete=\"handleDeleteRequest\"\n @update:modelValue=\"handleSchemeSelection\">\n <ScalarButton\n ref=\"comboboxButtonRef\"\n :aria-describedby=\"titleId\"\n class=\"group/combobox-button hover:text-c-1 text-c-2 flex h-fit w-full items-center gap-1 px-0.75 py-0.25 text-base font-normal\"\n variant=\"ghost\">\n <!-- Single auth scheme selected -->\n <template v-if=\"activeSchemeOptions.length === 1\">\n <span class=\"sr-only\">Selected Auth Type:</span>\n {{ activeSchemeOptions[0]?.label }}\n </template>\n\n <!-- Multiple auth schemes selected -->\n <template v-else-if=\"activeSchemeOptions.length > 1\">\n Multiple\n <span class=\"sr-only\">Auth Types Selected</span>\n </template>\n\n <!-- No auth schemes selected -->\n <template v-else>\n <span class=\"sr-only\">Select</span>\n Auth Type\n </template>\n\n <ScalarIconCaretDown\n class=\"size-3 shrink-0 transition-transform duration-100 group-aria-expanded/combobox-button:rotate-180\"\n weight=\"bold\" />\n </ScalarButton>\n\n <template #option=\"{ option, selected }\">\n <ScalarListboxCheckbox\n multiselect\n :selected=\"selected\" />\n <div class=\"min-w-0 flex-1 truncate\">\n {{ option.label }}\n </div>\n <ScalarIconButton\n v-if=\"option.isDeletable\"\n class=\"-m-0.5 shrink-0 p-0.5 opacity-0 group-hover/item:opacity-100\"\n :icon=\"ScalarIconTrash\"\n :label=\"`Delete ${option.label}`\"\n size=\"xs\"\n @click.stop=\"handleDeleteRequest(option)\" />\n </template>\n </ScalarComboboxMultiselect>\n </template>\n\n <!-- Auth Table -->\n <RequestAuthDataTable\n :activeAuthIndex=\"selectedSecurity?.selectedIndex ?? 0\"\n :environment\n :eventBus\n :isStatic\n :meta\n :proxyUrl\n :securitySchemes\n :selectedSchemeOptions=\"activeSchemeOptions\"\n :server />\n\n <!-- Delete Auth Modal -->\n <DeleteRequestAuthModal\n v-if=\"schemeToDelete\"\n :label=\"schemeToDelete.label\"\n :scheme=\"schemeToDelete\"\n :state=\"deleteModal\"\n @close=\"deleteModal.hide()\"\n @delete=\"handleDeleteConfirm\" />\n </CollapsibleSection>\n</template>\n","<script setup lang=\"ts\">\nimport {\n ScalarButton,\n ScalarComboboxMultiselect,\n ScalarIconButton,\n ScalarListboxCheckbox,\n useModal,\n type Icon,\n type ScalarButton as ScalarButtonType,\n} from '@scalar/components'\nimport { ScalarIconCaretDown, ScalarIconTrash } from '@scalar/icons'\nimport type { SelectedSecurity } from '@scalar/workspace-store/entities/auth'\nimport type {\n AuthMeta,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { unpackProxyObject } from '@scalar/workspace-store/helpers/unpack-proxy'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type {\n OpenApiDocument,\n SecurityRequirementObject,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed, ref, useId } from 'vue'\n\nimport DeleteRequestAuthModal from '@/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue'\nimport { isAuthOptional } from '@/v2/blocks/scalar-auth-selector-block/helpers/is-auth-optional'\nimport type { MergedSecuritySchemes } from '@/v2/blocks/scalar-auth-selector-block/helpers/merge-security'\nimport {\n formatComplexScheme,\n formatScheme,\n getSecuritySchemeOptions,\n type SecuritySchemeOption,\n} from '@/v2/blocks/scalar-auth-selector-block/helpers/security-scheme'\nimport { CollapsibleSection } from '@/v2/components/layout'\n\nimport RequestAuthDataTable from './RequestAuthDataTable.vue'\n\nconst {\n environment,\n eventBus,\n createAnySecurityScheme = false,\n defaultOpen = true,\n isStatic = false,\n meta,\n proxyUrl,\n securityRequirements,\n securitySchemes,\n selectedSecurity,\n server,\n title,\n} = defineProps<{\n environment: XScalarEnvironment\n eventBus: WorkspaceEventBus\n /** Allows adding authentication which is not in the document */\n createAnySecurityScheme?: boolean\n /** Whether the authentication disclosure should start expanded */\n defaultOpen?: boolean\n /** Creates a static disclosure that cannot be collapsed */\n isStatic?: boolean\n meta: AuthMeta\n proxyUrl: string\n securityRequirements: OpenApiDocument['security']\n securitySchemes: MergedSecuritySchemes\n selectedSecurity: SelectedSecurity | undefined\n server: ServerObject | null\n title: string\n}>()\n\nconst titleId = useId()\nconst comboboxButtonRef = ref<typeof ScalarButtonType | null>(null)\nconst isDisclosureOpen = ref(false)\n\nconst deleteModal = useModal()\nconst schemeToDelete = ref<{\n label: string\n payload: SecurityRequirementObject\n} | null>(null)\n\n/**\n * Determines if authentication is required or optional\n *\n * Auth is optional when there is an empty security requirement and no complex requirements.\n * Complex requirements have multiple auth schemes combined (e.g., API key + OAuth).\n */\nconst authIndicator = computed<{ icon: Icon; text: string } | null>(() => {\n if (!securityRequirements?.length) {\n return null\n }\n\n const isOptional = isAuthOptional(securityRequirements)\n\n return {\n icon: isOptional ? 'Unlock' : 'Lock',\n text: isOptional ? 'Optional' : 'Required',\n }\n})\n\n/** All available auth scheme options for the dropdown */\nconst availableSchemeOptions = computed(() =>\n getSecuritySchemeOptions(\n securityRequirements ?? [],\n securitySchemes ?? {},\n selectedSecurity?.selectedSchemes ?? [],\n createAnySecurityScheme,\n ),\n)\n\n/** Currently active auth schemes selected for this operation or collection */\nconst activeSchemeOptions = computed<SecuritySchemeOption[]>(() => {\n const schemes = selectedSecurity?.selectedSchemes\n if (!schemes?.length) {\n return []\n }\n\n return schemes.flatMap((requirement) => {\n const schemeNames = Object.keys(requirement)\n\n if (schemeNames.length === 0) {\n return []\n }\n\n // Complex auth requirement with multiple schemes\n if (schemeNames.length > 1) {\n return formatComplexScheme(requirement)\n }\n\n // Simple auth requirement with single scheme\n const schemeName = schemeNames[0]\n if (!schemeName) {\n return []\n }\n\n const scheme = getResolvedRef(securitySchemes?.[schemeName])\n if (!scheme) {\n return []\n }\n\n return formatScheme({\n name: schemeName,\n value: requirement,\n })\n })\n})\n\n/**\n * Opens the combobox dropdown when clicking the auth indicator badge.\n * Prevents the disclosure from toggling if it is already open.\n */\nconst handleAuthIndicatorClick = (event: Event): void => {\n if (isDisclosureOpen.value) {\n event.stopPropagation()\n }\n comboboxButtonRef.value?.$el.click()\n}\n\n/**\n * Updates the selected auth schemes.\n * Separates existing schemes from newly created ones for the event payload.\n */\nconst handleSchemeSelection = (selected: SecuritySchemeOption[]): void => {\n const existingSchemes = selected\n .filter((option) => option.payload === undefined)\n .map((option) => unpackProxyObject(option.value, { depth: 2 }))\n\n const newSchemes = selected\n .filter((option) => option.payload !== undefined)\n .map((option) => ({\n name: option.label,\n scheme: option.payload!,\n }))\n\n eventBus.emit('auth:update:selected-security-schemes', {\n selectedRequirements: existingSchemes,\n newSchemes,\n meta,\n })\n}\n\n/** Shows the delete confirmation modal for the selected scheme */\nconst handleDeleteRequest = (option: {\n label: string\n value: SecurityRequirementObject\n}): void => {\n schemeToDelete.value = { label: option.label, payload: option.value }\n deleteModal.show()\n}\n\n/** Deletes the selected auth scheme after confirmation */\nconst handleDeleteConfirm = (): void => {\n if (!schemeToDelete.value) {\n return\n }\n\n eventBus.emit('auth:delete:security-scheme', {\n names: Object.keys(schemeToDelete.value.payload),\n })\n\n schemeToDelete.value = null\n deleteModal.hide()\n}\n\ndefineExpose({\n authIndicator,\n selectedSchemeOptions: activeSchemeOptions,\n schemeOptions: availableSchemeOptions,\n})\n</script>\n<template>\n <CollapsibleSection\n class=\"group/params relative\"\n :defaultOpen\n :isStatic=\"isStatic\"\n :itemCount=\"activeSchemeOptions.length\"\n @update:modelValue=\"(open) => (isDisclosureOpen = open)\">\n <template #title>\n <div\n :id=\"titleId\"\n class=\"inline-flex items-center gap-0.5 leading-[20px]\">\n <span>{{ title }}</span>\n\n <span\n v-if=\"authIndicator\"\n class=\"text-c-3 hover:bg-b-3 hover:text-c-1 -my-0.5 -mr-1 cursor-pointer rounded px-1 py-0.5 leading-[normal] font-normal\"\n :class=\"{ 'text-c-1': authIndicator.text === 'Required' }\"\n data-testid=\"auth-indicator\"\n @click=\"handleAuthIndicatorClick\">\n {{ authIndicator.text }}\n </span>\n </div>\n </template>\n\n <!-- Auth Dropdown (hidden when only one scheme is available) -->\n <template #actions>\n <ScalarComboboxMultiselect\n class=\"w-72 text-xs\"\n :modelValue=\"activeSchemeOptions\"\n multiple\n :options=\"availableSchemeOptions\"\n placement=\"bottom-end\"\n teleport\n @delete=\"handleDeleteRequest\"\n @update:modelValue=\"handleSchemeSelection\">\n <ScalarButton\n ref=\"comboboxButtonRef\"\n :aria-describedby=\"titleId\"\n class=\"group/combobox-button hover:text-c-1 text-c-2 flex h-fit w-full items-center gap-1 px-0.75 py-0.25 text-base font-normal\"\n variant=\"ghost\">\n <!-- Single auth scheme selected -->\n <template v-if=\"activeSchemeOptions.length === 1\">\n <span class=\"sr-only\">Selected Auth Type:</span>\n {{ activeSchemeOptions[0]?.label }}\n </template>\n\n <!-- Multiple auth schemes selected -->\n <template v-else-if=\"activeSchemeOptions.length > 1\">\n Multiple\n <span class=\"sr-only\">Auth Types Selected</span>\n </template>\n\n <!-- No auth schemes selected -->\n <template v-else>\n <span class=\"sr-only\">Select</span>\n Auth Type\n </template>\n\n <ScalarIconCaretDown\n class=\"size-3 shrink-0 transition-transform duration-100 group-aria-expanded/combobox-button:rotate-180\"\n weight=\"bold\" />\n </ScalarButton>\n\n <template #option=\"{ option, selected }\">\n <ScalarListboxCheckbox\n multiselect\n :selected=\"selected\" />\n <div class=\"min-w-0 flex-1 truncate\">\n {{ option.label }}\n </div>\n <ScalarIconButton\n v-if=\"option.isDeletable\"\n class=\"-m-0.5 shrink-0 p-0.5 opacity-0 group-hover/item:opacity-100\"\n :icon=\"ScalarIconTrash\"\n :label=\"`Delete ${option.label}`\"\n size=\"xs\"\n @click.stop=\"handleDeleteRequest(option)\" />\n </template>\n </ScalarComboboxMultiselect>\n </template>\n\n <!-- Auth Table -->\n <RequestAuthDataTable\n :activeAuthIndex=\"selectedSecurity?.selectedIndex ?? 0\"\n :environment\n :eventBus\n :isStatic\n :meta\n :proxyUrl\n :securitySchemes\n :selectedSchemeOptions=\"activeSchemeOptions\"\n :server />\n\n <!-- Delete Auth Modal -->\n <DeleteRequestAuthModal\n v-if=\"schemeToDelete\"\n :label=\"schemeToDelete.label\"\n :scheme=\"schemeToDelete\"\n :state=\"deleteModal\"\n @close=\"deleteModal.hide()\"\n @delete=\"handleDeleteConfirm\" />\n </CollapsibleSection>\n</template>\n","import { isObject } from '@scalar/helpers/object/is-object'\nimport { objectEntries } from '@scalar/helpers/object/object-entries'\nimport type { SecurityScheme } from '@scalar/types/entities'\nimport type { AuthStore, SecretsOAuthFlows, SecretsOpenIdConnect } from '@scalar/workspace-store/entities/auth'\nimport type { DeepPartial } from '@scalar/workspace-store/helpers/overrides-proxy'\nimport type { XScalarCredentialsLocation } from '@scalar/workspace-store/schemas/extensions/security/x-scalar-credentials-location'\nimport type {\n OAuthFlowAuthorizationCode,\n OAuthFlowClientCredentials,\n OAuthFlowImplicit,\n OAuthFlowPassword,\n} from '@scalar/workspace-store/schemas/v3.1/strict/oauth-flow'\nimport type { SecuritySchemeObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\nimport type {\n ApiKeyObjectSecret,\n HttpObjectSecret,\n OAuth2ObjectSecret,\n OAuthFlowAuthorizationCodeSecret,\n OAuthFlowClientCredentialsSecret,\n OAuthFlowImplicitSecret,\n OAuthFlowPasswordSecret,\n OAuthFlowsObjectSecret,\n OpenIdConnectObjectSecret,\n SecuritySchemeObjectSecret,\n} from './secret-types'\n\n/** A combined scheme that includes both the auth store secrets and a deep partial of the config auth */\nexport type ConfigAuthScheme = SecuritySchemeObject & DeepPartial<SecurityScheme>\n\n/**\n * Maps x-scalar-secret fields to their corresponding input field names.\n * This allows us to fall back to config values when auth store secrets are not available.\n */\nconst SECRET_TO_INPUT_FIELD_MAP = {\n 'x-scalar-secret-client-id': 'x-scalar-client-id',\n 'x-scalar-secret-client-secret': 'clientSecret',\n 'x-scalar-secret-password': 'password',\n 'x-scalar-secret-redirect-uri': 'x-scalar-redirect-uri',\n 'x-scalar-secret-token': 'token',\n 'x-scalar-secret-username': 'username',\n 'x-scalar-secret-auth-url': 'authorizationUrl',\n 'x-scalar-secret-token-url': 'tokenUrl',\n} as const\n\nconst mergeFlowSecrets = <const T extends readonly (keyof typeof SECRET_TO_INPUT_FIELD_MAP)[]>(\n properties: T,\n configSecrets: Record<string, unknown>,\n authStoreSecrets: Record<string, unknown> = {},\n): Record<T[number], string> =>\n Object.fromEntries(\n properties.map((property) => {\n // Super merge in order of priority: auth store > config > config input field > empty string\n const value =\n authStoreSecrets[property] ||\n configSecrets[property] ||\n configSecrets[SECRET_TO_INPUT_FIELD_MAP[property]] ||\n ''\n\n return [property, value]\n }),\n ) as Record<T[number], string>\n\nconst extractRefreshTokenSecret = (\n authStoreSecrets: { 'x-scalar-secret-refresh-token'?: string } = {},\n): { 'x-scalar-secret-refresh-token'?: string } => {\n const refreshToken = authStoreSecrets['x-scalar-secret-refresh-token']\n\n if (typeof refreshToken === 'string') {\n return { 'x-scalar-secret-refresh-token': refreshToken }\n }\n\n return {}\n}\n\nconst extractCredentialsLocation = (\n configSecrets: Record<string, unknown>,\n authStoreSecrets: {\n 'x-scalar-credentials-location'?: XScalarCredentialsLocation['x-scalar-credentials-location']\n } = {},\n): XScalarCredentialsLocation => {\n const credentialsLocation =\n authStoreSecrets['x-scalar-credentials-location'] ??\n (configSecrets['x-scalar-credentials-location'] as XScalarCredentialsLocation['x-scalar-credentials-location'])\n\n return credentialsLocation ? { 'x-scalar-credentials-location': credentialsLocation } : {}\n}\n\n/**\n * Extract flow secrets and selected scopes for OAuth-like flows.\n * Reused by both oauth2 and openIdConnect security schemes.\n */\nconst extractOAuthFlowSecrets = (\n flows: Record<string, unknown> | undefined,\n storeSecrets?: Partial<SecretsOAuthFlows> | Partial<SecretsOpenIdConnect>,\n): {\n flows: OAuthFlowsObjectSecret\n selectedScopes: string[]\n} => {\n const selectedScopes = new Set<string>()\n\n const extractedFlows = objectEntries(flows ?? {}).reduce((acc, [key, flow]) => {\n if (!isObject(flow)) {\n return acc\n }\n\n // Store any selected scopes from the config\n const flowSelectedScopes = flow['selectedScopes']\n if (Array.isArray(flowSelectedScopes)) {\n flowSelectedScopes.forEach((scope) => typeof scope === 'string' && selectedScopes.add(scope))\n }\n\n // Implicit flow\n if (key === 'implicit') {\n acc.implicit = {\n ...(flow as OAuthFlowImplicit),\n ...mergeFlowSecrets(\n [\n 'x-scalar-secret-client-id',\n 'x-scalar-secret-redirect-uri',\n 'x-scalar-secret-token',\n 'x-scalar-secret-auth-url',\n ],\n flow,\n storeSecrets?.implicit,\n ),\n ...extractRefreshTokenSecret(storeSecrets?.implicit),\n } satisfies OAuthFlowImplicitSecret\n }\n\n // Password flow\n if (key === 'password') {\n acc[key] = {\n ...(flow as OAuthFlowPassword),\n ...mergeFlowSecrets(\n [\n 'x-scalar-secret-client-id',\n 'x-scalar-secret-client-secret',\n 'x-scalar-secret-username',\n 'x-scalar-secret-password',\n 'x-scalar-secret-token',\n 'x-scalar-secret-token-url',\n ],\n flow,\n storeSecrets?.password,\n ),\n ...extractCredentialsLocation(flow, storeSecrets?.password),\n ...extractRefreshTokenSecret(storeSecrets?.password),\n } satisfies OAuthFlowPasswordSecret\n }\n\n // Client credentials flow\n if (key === 'clientCredentials') {\n acc[key] = {\n ...(flow as OAuthFlowClientCredentials),\n ...mergeFlowSecrets(\n [\n 'x-scalar-secret-client-id',\n 'x-scalar-secret-client-secret',\n 'x-scalar-secret-token',\n 'x-scalar-secret-token-url',\n ],\n flow,\n storeSecrets?.clientCredentials,\n ),\n ...extractCredentialsLocation(flow, storeSecrets?.clientCredentials),\n ...extractRefreshTokenSecret(storeSecrets?.clientCredentials),\n } satisfies OAuthFlowClientCredentialsSecret\n }\n\n // Authorization code flow\n if (key === 'authorizationCode') {\n acc[key] = {\n ...(flow as OAuthFlowAuthorizationCode),\n ...mergeFlowSecrets(\n [\n 'x-scalar-secret-client-id',\n 'x-scalar-secret-client-secret',\n 'x-scalar-secret-redirect-uri',\n 'x-scalar-secret-token',\n 'x-scalar-secret-auth-url',\n 'x-scalar-secret-token-url',\n ],\n flow,\n storeSecrets?.authorizationCode,\n ),\n ...extractCredentialsLocation(flow, storeSecrets?.authorizationCode),\n ...extractRefreshTokenSecret(storeSecrets?.authorizationCode),\n } satisfies OAuthFlowAuthorizationCodeSecret\n }\n\n return acc\n }, {} as OAuthFlowsObjectSecret)\n\n return { flows: extractedFlows, selectedScopes: Array.from(selectedScopes) }\n}\n\n/** Extract the secrets from the config and the auth store */\nexport const extractSecuritySchemeSecrets = (\n // Include the config fields\n scheme: SecuritySchemeObject & DeepPartial<SecurityScheme>,\n authStore: AuthStore,\n name: string,\n documentSlug: string,\n): SecuritySchemeObjectSecret => {\n const secrets = authStore.getAuthSecrets(documentSlug, name)\n\n // Handle API Key security schemes\n if (scheme.type === 'apiKey') {\n const storeSecrets = secrets?.type === 'apiKey' ? secrets : undefined\n return {\n ...scheme,\n 'x-scalar-secret-token': storeSecrets?.['x-scalar-secret-token'] || scheme.value || '',\n } satisfies ApiKeyObjectSecret\n }\n\n // Handle HTTP Auth security schemes (e.g., Basic, Bearer)\n if (scheme.type === 'http') {\n const storeSecrets = secrets?.type === 'http' ? secrets : undefined\n return {\n ...scheme,\n 'x-scalar-secret-token': storeSecrets?.['x-scalar-secret-token'] || scheme.token || '',\n 'x-scalar-secret-username': storeSecrets?.['x-scalar-secret-username'] || scheme.username || '',\n 'x-scalar-secret-password': storeSecrets?.['x-scalar-secret-password'] || scheme.password || '',\n } satisfies HttpObjectSecret\n }\n\n // Handle OAuth2 security schemes and all supported flows\n if (scheme.type === 'oauth2') {\n const storeSecrets = secrets?.type === 'oauth2' ? secrets : undefined\n const extracted = extractOAuthFlowSecrets(scheme.flows, storeSecrets)\n const configuredDefaultScopes = Array.isArray(scheme['x-default-scopes'])\n ? scheme['x-default-scopes'].filter((scope): scope is string => typeof scope === 'string')\n : []\n const mergedDefaultScopes = Array.from(new Set([...configuredDefaultScopes, ...extracted.selectedScopes]))\n\n return {\n ...scheme,\n flows: extracted.flows,\n 'x-default-scopes': mergedDefaultScopes,\n } satisfies OAuth2ObjectSecret\n }\n\n // OpenID Connect uses auth-store-only discovered flows, but we expose them in OAuth-like flow format.\n if (scheme.type === 'openIdConnect') {\n const storeSecrets = secrets?.type === 'openIdConnect' ? secrets : undefined\n const extracted = extractOAuthFlowSecrets(\n {\n implicit: storeSecrets?.implicit,\n password: storeSecrets?.password,\n clientCredentials: storeSecrets?.clientCredentials,\n authorizationCode: storeSecrets?.authorizationCode,\n },\n storeSecrets,\n )\n\n return {\n ...scheme,\n ...(objectEntries(extracted.flows).length ? { flows: extracted.flows } : {}),\n } as OpenIdConnectObjectSecret\n }\n\n return scheme as SecuritySchemeObjectSecret\n}\n","import { objectEntries } from '@scalar/helpers/object/object-entries'\nimport type { AuthenticationConfiguration } from '@scalar/types/api-reference'\nimport type { AuthStore } from '@scalar/workspace-store/entities/auth'\nimport { deepClone } from '@scalar/workspace-store/helpers/deep-clone'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { mergeObjects } from '@scalar/workspace-store/helpers/merge-object'\nimport { coerceValue } from '@scalar/workspace-store/schemas/typebox-coerce'\nimport {\n type ComponentsObject,\n type SecuritySchemeObject,\n SecuritySchemeObjectSchema,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\nimport { extractSecuritySchemeSecrets } from './extract-security-scheme-secrets'\nimport type { SecuritySchemeObjectSecret } from './secret-types'\n\n/** Document security merged with the config security schemes */\nexport type MergedSecuritySchemes = Record<string, SecuritySchemeObjectSecret>\n\n/** Merge the authentication config with the document security schemes + the auth store secrets */\nexport const mergeSecurity = (\n documentSecuritySchemes: ComponentsObject['securitySchemes'] = {},\n configSecuritySchemes: AuthenticationConfiguration['securitySchemes'] = {},\n authStore: AuthStore,\n documentSlug: string,\n): MergedSecuritySchemes => {\n /** Resolve any refs in the document security schemes */\n const resolvedDocumentSecuritySchemes = objectEntries(documentSecuritySchemes).reduce(\n (acc, [key, value]) => {\n const resolved = deepClone(getResolvedRef(value))\n if (resolved) {\n acc[key] = resolved\n }\n return acc\n },\n {} as Record<string, SecuritySchemeObject>,\n )\n\n /** Merge the config security schemes into the document security schemes */\n const mergedSchemes =\n mergeObjects<Record<string, SecuritySchemeObject>>(resolvedDocumentSecuritySchemes, configSecuritySchemes) ?? {}\n\n /** Convert the config secrets to the new secret extensions */\n return objectEntries(mergedSchemes).reduce((acc, [name, value]) => {\n // We coerce in case the scheme is missing any key fields like type\n const coerced = coerceValue(SecuritySchemeObjectSchema, value)\n // We then overwrite it back with the original value to keep any other fields like description, etc.\n const merged = { ...coerced, ...value }\n\n acc[name] = extractSecuritySchemeSecrets(merged, authStore, name, documentSlug)\n return acc\n }, {} as MergedSecuritySchemes)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ECQA,MAAM,OAAO;EAKb,MAAM,qBAAqB;AACzB,QAAK,SAAQ;;;uBAIb,YAuBc,MAAA,YAAA,EAAA;IAtBZ,MAAK;IACJ,OAAO,QAAA;IACR,OAAM;;2BAIF,CAHJ,mBAGI,KAHJ,cAAgD,wDAE9C,gBAAG,QAAA,MAAK,GAAG,0CACb,EAAA,EACA,mBAcM,OAdN,cAcM,CAbJ,YAMe,MAAA,aAAA,EAAA;KALb,OAAM;KACN,MAAK;KACL,SAAQ;KACP,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,KAAI,QAAA;;4BAEd,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CAAA,gBAFyB,YAEzB,GAAA,CAAA,EAAA,CAAA;;QACA,YAKe,MAAA,aAAA,EAAA;KAJb,OAAM;KACN,MAAK;KACJ,SAAO;;4BACD,CAAA,gBADe,aACf,gBAAG,QAAA,MAAK,EAAA,EAAA,CAAA,CAAA;;;;;;;;;;;ACnCvB,IAAa,kBAAkB,yBAA4E;CACzG,MAAM,wBAAwB,qBAAqB,MAAM,gBAAgB,OAAO,KAAK,YAAY,CAAC,SAAS,EAAE;AAG7G,QAF4B,qBAAqB,MAAM,gBAAgB,OAAO,KAAK,YAAY,C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AAU,cAAc;GACxB,UAAU,cAAc;GACxB,mBAAmB,cAAc;GACjC,mBAAmB,cAAc;GAClC,EACD,aACD;AAED,SAAO;GACL,GAAG;GACH,GAAI,cAAc,UAAU,MAAM,CAAC,SAAS,EAAE,OAAO,UAAU,OAAO,GAAG,EAAE;GAC5E;;AAGH,QAAO;;;;;AClPT,IAAa,iBACX,0BAA+D,EAAE,EACjE,wBAAwE,EAAE,EAC1E,WACA,iBAC0B;;AAkB1B,QAAO,cAHL,aAbsC,cAAc,wBAAwB,CAAC,QAC5E,KAAK,CAAC,KAAK,WAAW;EACrB,MAAM,WAAW,UAAU,eAAe,MAAM,CAAC;AACjD,MAAI,SACF,KAAI,OAAO;AAEb,SAAO;IAET,EAAE,CACH,EAIqF,sBAAsB,IAAI,EAAE,CAG/E,CAAC,QAAQ,KAAK,CAAC,MAAM,WAAW;AAMjE,MAAI,QAAQ,6BAFG;GAAE,GAFD,YAAY,4BAA4B,MAAM;GAEjC,GAAG;GAAO,EAEU,WAAW,MAAM,aAAa;AAC/E,SAAO;IACN,EAAE,CAA0B"}
@@ -1,6 +1,6 @@
1
1
  import { type Collection, type CollectionPayload, type XScalarEnvironment } from '@scalar/oas-utils/entities/spec';
2
2
  import type { Workspace } from '@scalar/oas-utils/entities/workspace';
3
- import type { StoreContext } from '@/store/store-context';
3
+ import type { StoreContext } from '../store/store-context';
4
4
  /** Initiate the workspace collections */
5
5
  export declare function createStoreCollections(useLocalStorage: boolean): {
6
6
  collections: Record<string, {
@@ -1,5 +1,5 @@
1
1
  import { type Environment } from '@scalar/oas-utils/entities/environment';
2
- import type { StoreContext } from '@/store/store-context';
2
+ import type { StoreContext } from '../store/store-context';
3
3
  /** Generate reactive environments for the workspace */
4
4
  export declare function createStoreEnvironments(useLocalStorage: boolean): {
5
5
  environments: Record<string, {
@@ -1,35 +1,35 @@
1
- import type { CommandPaletteEvent } from '@/components/CommandPalette/TheCommandPalette.vue';
2
- import type { RequestStatus } from '@/libs/send-request';
1
+ import type { CommandPaletteEvent } from '../components/CommandPalette/TheCommandPalette.vue';
2
+ import type { RequestStatus } from '../libs/send-request/index.js';
3
3
  /** Create the store for the api client events */
4
4
  export declare function createStoreEvents(): {
5
5
  /**
6
6
  * Event bus to execute requests, usually triggered by the send button in the address bar
7
7
  * OR the keyboard shortcut
8
8
  */
9
- executeRequest: import("@/libs/event-bus").EventBus<{
9
+ executeRequest: import("../libs/event-bus").EventBus<{
10
10
  requestUid?: string;
11
11
  }>;
12
12
  /**
13
13
  * Event bus to focus the address bar or send button
14
14
  */
15
- focusAddressBar: import("@/libs/event-bus").EventBus<any>;
15
+ focusAddressBar: import("../libs/event-bus").EventBus<any>;
16
16
  /**
17
17
  * Event bus to cancel requests, usually triggered by response loading overlay
18
18
  */
19
- cancelRequest: import("@/libs/event-bus").EventBus<any>;
19
+ cancelRequest: import("../libs/event-bus").EventBus<any>;
20
20
  /**
21
21
  * Event bus to keep track of when a request is started, stopped, or aborted
22
22
  */
23
- requestStatus: import("@/libs/event-bus").EventBus<RequestStatus>;
23
+ requestStatus: import("../libs/event-bus").EventBus<RequestStatus>;
24
24
  /**
25
25
  * Event bus for controlling the Command Palette
26
26
  *
27
27
  * @param commandName - the command name you wish to execute, leave empty for the full palette
28
28
  */
29
- commandPalette: import("@/libs/event-bus").EventBus<CommandPaletteEvent>;
29
+ commandPalette: import("../libs/event-bus").EventBus<CommandPaletteEvent>;
30
30
  /**
31
31
  * Event bus for handling hot keys
32
32
  */
33
- hotKeys: import("@/libs/event-bus").EventBus<Partial<Record<"addTopNav" | "closeModal" | "closeTopNav" | "createNew" | "executeRequest" | "focusAddressBar" | "focusRequestSearch" | "jumpToLastTab" | "jumpToTab" | "navigateSearchResultsDown" | "navigateSearchResultsUp" | "navigateTopNavLeft" | "navigateTopNavRight" | "openCommandPalette" | "selectSearchResult" | "toggleSidebar", KeyboardEvent>>>;
33
+ hotKeys: import("../libs/event-bus").EventBus<Partial<Record<"addTopNav" | "closeModal" | "closeTopNav" | "createNew" | "executeRequest" | "focusAddressBar" | "focusRequestSearch" | "jumpToLastTab" | "jumpToTab" | "navigateSearchResultsDown" | "navigateSearchResultsUp" | "navigateTopNavLeft" | "navigateTopNavRight" | "openCommandPalette" | "selectSearchResult" | "toggleSidebar", KeyboardEvent>>>;
34
34
  };
35
35
  //# sourceMappingURL=events.d.ts.map
@@ -1,8 +1,8 @@
1
1
  import { type ImportSpecToWorkspaceArgs } from '@scalar/oas-utils/transforms';
2
2
  import type { OpenAPIV3, OpenAPIV3_1 } from '@scalar/openapi-types';
3
3
  import type { ApiReferenceConfiguration } from '@scalar/types/api-reference';
4
- import { type ErrorResponse } from '@/libs';
5
- import type { StoreContext } from '@/store/store-context';
4
+ import { type ErrorResponse } from '../libs/index.js';
5
+ import type { StoreContext } from '../store/store-context';
6
6
  /** Maps the specs by URL */
7
7
  export declare const specDictionary: Record<string, {
8
8
  hash: number;
@@ -1,2 +1,2 @@
1
- import { C as createActiveEntitiesStore, S as ACTIVE_ENTITIES_SYMBOL, n as createWorkspaceStore, r as useWorkspace, t as WORKSPACE_SYMBOL, w as useActiveEntities } from "../store-DpSUVhjp.js";
1
+ import { C as createActiveEntitiesStore, S as ACTIVE_ENTITIES_SYMBOL, n as createWorkspaceStore, r as useWorkspace, t as WORKSPACE_SYMBOL, w as useActiveEntities } from "../store-DnlAQK5d.js";
2
2
  export { ACTIVE_ENTITIES_SYMBOL, WORKSPACE_SYMBOL, createActiveEntitiesStore, createWorkspaceStore, useActiveEntities, useWorkspace };
@@ -1,5 +1,5 @@
1
1
  import { type Request, type RequestExample } from '@scalar/oas-utils/entities/spec';
2
- import type { StoreContext } from '@/store/store-context';
2
+ import type { StoreContext } from '../store/store-context';
3
3
  /** Create top level examples storage for the workspace */
4
4
  export declare function createStoreRequestExamples(useLocalStorage: boolean): {
5
5
  requestExamples: Record<string, {
@@ -1,5 +1,5 @@
1
1
  import { type Collection, type Request, type RequestPayload, type Tag } from '@scalar/oas-utils/entities/spec';
2
- import type { extendedTagDataFactory } from '@/store/tags';
2
+ import type { extendedTagDataFactory } from '../store/tags';
3
3
  import type { StoreContext } from './store-context';
4
4
  /** Create top level request handlers for a workspace */
5
5
  export declare function createStoreRequests(useLocalStorage: boolean): {
@@ -1,5 +1,5 @@
1
1
  import { type Collection, type SecurityScheme, type SecuritySchemePayload } from '@scalar/oas-utils/entities/spec';
2
- import type { StoreContext } from '@/store/store-context';
2
+ import type { StoreContext } from '../store/store-context';
3
3
  /** Create storage entities for security schemes */
4
4
  export declare function createStoreSecuritySchemes(useLocalStorage: boolean): {
5
5
  securitySchemes: Record<string, {
@@ -1,5 +1,5 @@
1
1
  import { type Collection, type Server, type ServerPayload } from '@scalar/oas-utils/entities/spec';
2
- import type { StoreContext } from '@/store/store-context';
2
+ import type { StoreContext } from '../store/store-context';
3
3
  /** Create storage objects for servers */
4
4
  export declare function createStoreServers(useLocalStorage: boolean): {
5
5
  servers: Record<string, {