@scalar/api-client 3.14.0 → 3.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (349) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/assets/computer.ascii.virtual.js.map +1 -1
  3. package/dist/components/HelpfulLink.vue.script.js +1 -1
  4. package/dist/components/HelpfulLink.vue.script.js.map +1 -1
  5. package/dist/components/HttpMethod/HttpMethod.vue.js +1 -1
  6. package/dist/components/HttpMethod/HttpMethod.vue.script.js +1 -1
  7. package/dist/components/HttpMethod/HttpMethod.vue.script.js.map +1 -1
  8. package/dist/components/ScalarAsciiArt/ScalarAsciiArt.vue.js +1 -1
  9. package/dist/components/ScalarAsciiArt/ScalarAsciiArt.vue.script.js +1 -1
  10. package/dist/components/ScalarAsciiArt/ScalarAsciiArt.vue.script.js.map +1 -1
  11. package/dist/components/SectionFilter.vue.d.ts +1 -1
  12. package/dist/components/SectionFilter.vue.d.ts.map +1 -1
  13. package/dist/components/SectionFilter.vue.js +1 -1
  14. package/dist/components/SectionFilter.vue.script.js +2 -2
  15. package/dist/components/SectionFilter.vue.script.js.map +1 -1
  16. package/dist/components/SectionFilterButton.vue.script.js +1 -1
  17. package/dist/components/SectionFilterButton.vue.script.js.map +1 -1
  18. package/dist/components/Server/ServerVariablesForm.vue.d.ts.map +1 -1
  19. package/dist/components/Server/ServerVariablesForm.vue.script.js +1 -1
  20. package/dist/components/Server/ServerVariablesForm.vue.script.js.map +1 -1
  21. package/dist/components/Server/ServerVariablesSelect.vue.script.js +1 -1
  22. package/dist/components/Server/ServerVariablesSelect.vue.script.js.map +1 -1
  23. package/dist/components/Server/ServerVariablesTextbox.vue.script.js +1 -1
  24. package/dist/components/Server/ServerVariablesTextbox.vue.script.js.map +1 -1
  25. package/dist/components/Sidebar/Actions/DeleteSidebarListElement.vue.d.ts.map +1 -1
  26. package/dist/components/Sidebar/Actions/DeleteSidebarListElement.vue.script.js +1 -1
  27. package/dist/components/Sidebar/Actions/DeleteSidebarListElement.vue.script.js.map +1 -1
  28. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.d.ts.map +1 -1
  29. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.script.js +1 -1
  30. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.script.js.map +1 -1
  31. package/dist/components/ViewLayout/ViewLayout.vue.script.js +1 -1
  32. package/dist/components/ViewLayout/ViewLayout.vue.script.js.map +1 -1
  33. package/dist/components/ViewLayout/ViewLayoutContent.vue.js +1 -1
  34. package/dist/components/ViewLayout/ViewLayoutContent.vue.js.map +1 -1
  35. package/dist/components/ViewLayout/ViewLayoutSection.vue.script.js +1 -1
  36. package/dist/components/ViewLayout/ViewLayoutSection.vue.script.js.map +1 -1
  37. package/dist/hooks/use-file-dialog.js +2 -1
  38. package/dist/hooks/use-file-dialog.js.map +1 -1
  39. package/dist/plugins/posthog/index.js.map +1 -1
  40. package/dist/plugins/posthog/sanitize-event-payload.js +1 -1
  41. package/dist/plugins/posthog/sanitize-event-payload.js.map +1 -1
  42. package/dist/style.css +296 -273
  43. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
  44. package/dist/v2/blocks/operation-block/OperationBlock.vue.js.map +1 -1
  45. package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js +4 -2
  46. package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js.map +1 -1
  47. package/dist/v2/blocks/operation-block/components/Header.vue.d.ts.map +1 -1
  48. package/dist/v2/blocks/operation-block/components/Header.vue.js +1 -1
  49. package/dist/v2/blocks/operation-block/components/Header.vue.script.js +1 -1
  50. package/dist/v2/blocks/operation-block/components/Header.vue.script.js.map +1 -1
  51. package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.js +1 -1
  52. package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.script.js +1 -1
  53. package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.script.js.map +1 -1
  54. package/dist/v2/blocks/operation-block/helpers/decode-buffer.js.map +1 -1
  55. package/dist/v2/blocks/operation-block/helpers/get-cookie-header-keys.js.map +1 -1
  56. package/dist/v2/blocks/operation-block/helpers/har-to-fetch-request.js.map +1 -1
  57. package/dist/v2/blocks/operation-block/helpers/har-to-fetch-response.js.map +1 -1
  58. package/dist/v2/blocks/operation-block/helpers/persist-response-cookies.js.map +1 -1
  59. package/dist/v2/blocks/operation-block/helpers/response-cache.js.map +1 -1
  60. package/dist/v2/blocks/operation-block/helpers/send-request.js.map +1 -1
  61. package/dist/v2/blocks/operation-block/helpers/validate-path-parameters.js.map +1 -1
  62. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts.map +1 -1
  63. package/dist/v2/blocks/request-block/RequestBlock.vue.js +1 -1
  64. package/dist/v2/blocks/request-block/RequestBlock.vue.js.map +1 -1
  65. package/dist/v2/blocks/request-block/RequestBlock.vue.script.js +58 -29
  66. package/dist/v2/blocks/request-block/RequestBlock.vue.script.js.map +1 -1
  67. package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts.map +1 -1
  68. package/dist/v2/blocks/request-block/components/RequestBody.vue.js +1 -1
  69. package/dist/v2/blocks/request-block/components/RequestBody.vue.script.js +1 -1
  70. package/dist/v2/blocks/request-block/components/RequestBody.vue.script.js.map +1 -1
  71. package/dist/v2/blocks/request-block/components/RequestBodyForm.vue.d.ts.map +1 -1
  72. package/dist/v2/blocks/request-block/components/RequestBodyForm.vue.script.js +1 -1
  73. package/dist/v2/blocks/request-block/components/RequestBodyForm.vue.script.js.map +1 -1
  74. package/dist/v2/blocks/request-block/components/RequestBodyStructured.vue.d.ts.map +1 -1
  75. package/dist/v2/blocks/request-block/components/RequestBodyStructured.vue.script.js +1 -1
  76. package/dist/v2/blocks/request-block/components/RequestBodyStructured.vue.script.js.map +1 -1
  77. package/dist/v2/blocks/request-block/components/RequestBodyViewToggle.vue.script.js +1 -1
  78. package/dist/v2/blocks/request-block/components/RequestBodyViewToggle.vue.script.js.map +1 -1
  79. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.d.ts.map +1 -1
  80. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.script.js +1 -1
  81. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.script.js.map +1 -1
  82. package/dist/v2/blocks/request-block/components/RequestParams.vue.d.ts +2 -0
  83. package/dist/v2/blocks/request-block/components/RequestParams.vue.d.ts.map +1 -1
  84. package/dist/v2/blocks/request-block/components/RequestParams.vue.js.map +1 -1
  85. package/dist/v2/blocks/request-block/components/RequestParams.vue.script.js +5 -3
  86. package/dist/v2/blocks/request-block/components/RequestParams.vue.script.js.map +1 -1
  87. package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts +2 -0
  88. package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts.map +1 -1
  89. package/dist/v2/blocks/request-block/components/RequestTable.vue.js +1 -1
  90. package/dist/v2/blocks/request-block/components/RequestTable.vue.js.map +1 -1
  91. package/dist/v2/blocks/request-block/components/RequestTable.vue.script.js +6 -3
  92. package/dist/v2/blocks/request-block/components/RequestTable.vue.script.js.map +1 -1
  93. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts +8 -0
  94. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
  95. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.js.map +1 -1
  96. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.script.js +29 -16
  97. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.script.js.map +1 -1
  98. package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.script.js +1 -1
  99. package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.script.js.map +1 -1
  100. package/dist/v2/blocks/request-block/helpers/create-parameter-handlers.js.map +1 -1
  101. package/dist/v2/blocks/request-block/helpers/create-parameter-rows.js +1 -1
  102. package/dist/v2/blocks/request-block/helpers/create-parameter-rows.js.map +1 -1
  103. package/dist/v2/blocks/request-block/helpers/files.js.map +1 -1
  104. package/dist/v2/blocks/request-block/helpers/fold-structured-body-rows.js.map +1 -1
  105. package/dist/v2/blocks/request-block/helpers/get-form-body-rows.js +10 -5
  106. package/dist/v2/blocks/request-block/helpers/get-form-body-rows.js.map +1 -1
  107. package/dist/v2/blocks/request-block/helpers/get-parameter-content.js.map +1 -1
  108. package/dist/v2/blocks/request-block/helpers/get-parameter-schema.js.map +1 -1
  109. package/dist/v2/blocks/request-block/helpers/get-structured-body-rows.js.map +1 -1
  110. package/dist/v2/blocks/request-block/helpers/group-by.js.map +1 -1
  111. package/dist/v2/blocks/request-block/helpers/group-global-cookies.d.ts +54 -0
  112. package/dist/v2/blocks/request-block/helpers/group-global-cookies.d.ts.map +1 -0
  113. package/dist/v2/blocks/request-block/helpers/group-global-cookies.js +56 -0
  114. package/dist/v2/blocks/request-block/helpers/group-global-cookies.js.map +1 -0
  115. package/dist/v2/blocks/request-block/helpers/structured-body-codec.js +1 -1
  116. package/dist/v2/blocks/request-block/helpers/structured-body-codec.js.map +1 -1
  117. package/dist/v2/blocks/request-block/helpers/validate-parameter.js.map +1 -1
  118. package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts.map +1 -1
  119. package/dist/v2/blocks/response-block/ResponseBlock.vue.js +1 -1
  120. package/dist/v2/blocks/response-block/ResponseBlock.vue.script.js +1 -1
  121. package/dist/v2/blocks/response-block/ResponseBlock.vue.script.js.map +1 -1
  122. package/dist/v2/blocks/response-block/components/Headers.vue.script.js +1 -1
  123. package/dist/v2/blocks/response-block/components/Headers.vue.script.js.map +1 -1
  124. package/dist/v2/blocks/response-block/components/ResponseBody.vue.js +1 -1
  125. package/dist/v2/blocks/response-block/components/ResponseBody.vue.script.js +1 -1
  126. package/dist/v2/blocks/response-block/components/ResponseBody.vue.script.js.map +1 -1
  127. package/dist/v2/blocks/response-block/components/ResponseBodyDownload.vue.script.js +1 -1
  128. package/dist/v2/blocks/response-block/components/ResponseBodyDownload.vue.script.js.map +1 -1
  129. package/dist/v2/blocks/response-block/components/ResponseBodyInfo.vue.js +1 -1
  130. package/dist/v2/blocks/response-block/components/ResponseBodyInfo.vue.js.map +1 -1
  131. package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.js +1 -1
  132. package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.script.js +1 -1
  133. package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.script.js.map +1 -1
  134. package/dist/v2/blocks/response-block/components/ResponseBodyRaw.vue.js +1 -1
  135. package/dist/v2/blocks/response-block/components/ResponseBodyRaw.vue.script.js +1 -1
  136. package/dist/v2/blocks/response-block/components/ResponseBodyRaw.vue.script.js.map +1 -1
  137. package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.d.ts.map +1 -1
  138. package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.script.js +1 -1
  139. package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.script.js.map +1 -1
  140. package/dist/v2/blocks/response-block/components/ResponseBodyToggle.vue.script.js +1 -1
  141. package/dist/v2/blocks/response-block/components/ResponseBodyToggle.vue.script.js.map +1 -1
  142. package/dist/v2/blocks/response-block/components/ResponseBodyVirtual.vue.script.js +1 -1
  143. package/dist/v2/blocks/response-block/components/ResponseBodyVirtual.vue.script.js.map +1 -1
  144. package/dist/v2/blocks/response-block/components/ResponseCookies.vue.script.js +1 -1
  145. package/dist/v2/blocks/response-block/components/ResponseCookies.vue.script.js.map +1 -1
  146. package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.js +1 -1
  147. package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.script.js +1 -1
  148. package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.script.js.map +1 -1
  149. package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.d.ts.map +1 -1
  150. package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.js +1 -1
  151. package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.script.js +1 -1
  152. package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.script.js.map +1 -1
  153. package/dist/v2/blocks/response-block/components/ResponseMetaInformation.vue.script.js +1 -1
  154. package/dist/v2/blocks/response-block/components/ResponseMetaInformation.vue.script.js.map +1 -1
  155. package/dist/v2/blocks/response-block/helpers/extract-filename.js.map +1 -1
  156. package/dist/v2/blocks/response-block/helpers/get-content-length.js.map +1 -1
  157. package/dist/v2/blocks/response-block/helpers/media-types.js.map +1 -1
  158. package/dist/v2/blocks/response-block/helpers/parse-set-cookie.js.map +1 -1
  159. package/dist/v2/blocks/response-block/helpers/prettify-jsonc-string.js.map +1 -1
  160. package/dist/v2/blocks/response-block/helpers/process-response-body.js.map +1 -1
  161. package/dist/v2/blocks/response-block/helpers/resolve-response-body-handler.js.map +1 -1
  162. package/dist/v2/blocks/response-block/helpers/resolve-response-content-type.js +7 -1
  163. package/dist/v2/blocks/response-block/helpers/resolve-response-content-type.js.map +1 -1
  164. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
  165. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +1 -1
  166. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.script.js +1 -1
  167. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.script.js.map +1 -1
  168. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.d.ts.map +1 -1
  169. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.js +1 -1
  170. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.script.js +1 -1
  171. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.script.js.map +1 -1
  172. package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.d.ts.map +1 -1
  173. package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.script.js +1 -1
  174. package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.script.js.map +1 -1
  175. package/dist/v2/blocks/scalar-address-bar-block/components/httpStatusCodeColors.js +3 -1
  176. package/dist/v2/blocks/scalar-address-bar-block/components/httpStatusCodeColors.js.map +1 -1
  177. package/dist/v2/blocks/scalar-address-bar-block/helpers/is-placeholder-path.js.map +1 -1
  178. package/dist/v2/blocks/scalar-address-bar-block/helpers/refocus-blur-target.js.map +1 -1
  179. package/dist/v2/blocks/scalar-address-bar-block/hooks/use-loading-animation.js.map +1 -1
  180. package/dist/v2/blocks/scalar-address-bar-block/hooks/use-path-masking.js.map +1 -1
  181. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts.map +1 -1
  182. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.script.js +1 -1
  183. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.script.js.map +1 -1
  184. package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.d.ts.map +1 -1
  185. package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.script.js +1 -1
  186. package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.script.js.map +1 -1
  187. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -1
  188. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.script.js +1 -1
  189. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.script.js.map +1 -1
  190. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.d.ts.map +1 -1
  191. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.script.js +1 -1
  192. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.script.js.map +1 -1
  193. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.d.ts.map +1 -1
  194. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.script.js +1 -1
  195. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.script.js.map +1 -1
  196. package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.d.ts.map +1 -1
  197. package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.script.js +1 -1
  198. package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.script.js.map +1 -1
  199. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts.map +1 -1
  200. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.script.js +1 -1
  201. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.script.js.map +1 -1
  202. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.d.ts.map +1 -1
  203. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.script.js +3 -3
  204. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.script.js.map +1 -1
  205. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts.map +1 -1
  206. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.script.js +1 -1
  207. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.script.js.map +1 -1
  208. package/dist/v2/blocks/scalar-auth-selector-block/helpers/auth-options.js.map +1 -1
  209. package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.js +5 -0
  210. package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.js.map +1 -1
  211. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-callback.js +1 -1
  212. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-callback.js.map +1 -1
  213. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js +2 -2
  214. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js.map +1 -1
  215. package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.js.map +1 -1
  216. package/dist/v2/blocks/scalar-auth-selector-block/helpers/resolve-default-oauth2-redirect-url.js.map +1 -1
  217. package/dist/v2/blocks/scalar-auth-selector-block/helpers/run-oauth2-authorize.js.map +1 -1
  218. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.js.map +1 -1
  219. package/dist/v2/components/code-input/CodeInput.vue.d.ts.map +1 -1
  220. package/dist/v2/components/code-input/CodeInput.vue.js +1 -1
  221. package/dist/v2/components/code-input/CodeInput.vue.script.js +6 -1
  222. package/dist/v2/components/code-input/CodeInput.vue.script.js.map +1 -1
  223. package/dist/v2/components/code-input/CodeInputLite.vue.d.ts.map +1 -1
  224. package/dist/v2/components/code-input/CodeInputLite.vue.js +1 -1
  225. package/dist/v2/components/code-input/CodeInputLite.vue.script.js +5 -1
  226. package/dist/v2/components/code-input/CodeInputLite.vue.script.js.map +1 -1
  227. package/dist/v2/components/code-input/PillTooltipHost.vue.script.js +1 -1
  228. package/dist/v2/components/code-input/PillTooltipHost.vue.script.js.map +1 -1
  229. package/dist/v2/components/code-input/code-variable-widget.js +1 -0
  230. package/dist/v2/components/code-input/code-variable-widget.js.map +1 -1
  231. package/dist/v2/components/code-input/helpers/build-pill-context.js.map +1 -1
  232. package/dist/v2/components/code-input/helpers/lookup-variable-value.js.map +1 -1
  233. package/dist/v2/components/code-input/helpers/pill-signature.js.map +1 -1
  234. package/dist/v2/components/code-input/helpers/serialize-value.js.map +1 -1
  235. package/dist/v2/components/context-menu/ContextMenu.vue.script.js +1 -1
  236. package/dist/v2/components/context-menu/ContextMenu.vue.script.js.map +1 -1
  237. package/dist/v2/components/data-table/DataTable.vue.script.js +1 -1
  238. package/dist/v2/components/data-table/DataTable.vue.script.js.map +1 -1
  239. package/dist/v2/components/data-table/DataTableCell.vue.script.js +1 -1
  240. package/dist/v2/components/data-table/DataTableCell.vue.script.js.map +1 -1
  241. package/dist/v2/components/data-table/DataTableCheckbox.vue.script.js +1 -1
  242. package/dist/v2/components/data-table/DataTableCheckbox.vue.script.js.map +1 -1
  243. package/dist/v2/components/data-table/DataTableHeader.vue.script.js +1 -1
  244. package/dist/v2/components/data-table/DataTableHeader.vue.script.js.map +1 -1
  245. package/dist/v2/components/data-table/DataTableInput.vue.d.ts.map +1 -1
  246. package/dist/v2/components/data-table/DataTableInput.vue.js +1 -1
  247. package/dist/v2/components/data-table/DataTableInput.vue.script.js +1 -1
  248. package/dist/v2/components/data-table/DataTableInput.vue.script.js.map +1 -1
  249. package/dist/v2/components/data-table/DataTableInputSelect.vue.d.ts.map +1 -1
  250. package/dist/v2/components/data-table/DataTableInputSelect.vue.script.js +3 -2
  251. package/dist/v2/components/data-table/DataTableInputSelect.vue.script.js.map +1 -1
  252. package/dist/v2/components/data-table/DataTableRow.vue.js +1 -1
  253. package/dist/v2/components/data-table/DataTableRow.vue.js.map +1 -1
  254. package/dist/v2/components/data-table/DataTableText.vue.script.js +1 -1
  255. package/dist/v2/components/data-table/DataTableText.vue.script.js.map +1 -1
  256. package/dist/v2/components/forms/ConfirmationForm.vue.d.ts.map +1 -1
  257. package/dist/v2/components/forms/ConfirmationForm.vue.script.js +1 -1
  258. package/dist/v2/components/forms/ConfirmationForm.vue.script.js.map +1 -1
  259. package/dist/v2/components/layout/CollapsibleSection.vue.d.ts.map +1 -1
  260. package/dist/v2/components/layout/CollapsibleSection.vue.script.js +1 -1
  261. package/dist/v2/components/layout/CollapsibleSection.vue.script.js.map +1 -1
  262. package/dist/v2/components/layout/ValueEmitter.vue.d.ts +1 -1
  263. package/dist/v2/components/layout/ValueEmitter.vue.d.ts.map +1 -1
  264. package/dist/v2/components/layout/ValueEmitter.vue.script.js +1 -1
  265. package/dist/v2/components/layout/ValueEmitter.vue.script.js.map +1 -1
  266. package/dist/v2/components/modals/DeleteModal.vue.d.ts.map +1 -1
  267. package/dist/v2/components/modals/DeleteModal.vue.script.js +1 -1
  268. package/dist/v2/components/modals/DeleteModal.vue.script.js.map +1 -1
  269. package/dist/v2/components/modals/ModalClientContainer.vue.js +1 -1
  270. package/dist/v2/components/modals/ModalClientContainer.vue.script.js +1 -1
  271. package/dist/v2/components/modals/ModalClientContainer.vue.script.js.map +1 -1
  272. package/dist/v2/components/resize/Resize.vue.js +1 -1
  273. package/dist/v2/components/resize/Resize.vue.script.js +1 -1
  274. package/dist/v2/components/resize/Resize.vue.script.js.map +1 -1
  275. package/dist/v2/components/resize/use-split-resize.js +4 -2
  276. package/dist/v2/components/resize/use-split-resize.js.map +1 -1
  277. package/dist/v2/components/server/ServerDropdown.vue.d.ts.map +1 -1
  278. package/dist/v2/components/server/ServerDropdown.vue.script.js +1 -1
  279. package/dist/v2/components/server/ServerDropdown.vue.script.js.map +1 -1
  280. package/dist/v2/components/server/ServerDropdownItem.vue.d.ts.map +1 -1
  281. package/dist/v2/components/server/ServerDropdownItem.vue.js +1 -1
  282. package/dist/v2/components/server/ServerDropdownItem.vue.script.js +1 -1
  283. package/dist/v2/components/server/ServerDropdownItem.vue.script.js.map +1 -1
  284. package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
  285. package/dist/v2/components/sidebar/Sidebar.vue.script.js +3 -3
  286. package/dist/v2/components/sidebar/Sidebar.vue.script.js.map +1 -1
  287. package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts.map +1 -1
  288. package/dist/v2/components/sidebar/SidebarMenu.vue.script.js +1 -1
  289. package/dist/v2/components/sidebar/SidebarMenu.vue.script.js.map +1 -1
  290. package/dist/v2/components/sidebar/SidebarToggle.vue.script.js +1 -1
  291. package/dist/v2/components/sidebar/SidebarToggle.vue.script.js.map +1 -1
  292. package/dist/v2/constants.js +1 -1
  293. package/dist/v2/features/command-palette/components/CommandActionForm.vue.script.js +1 -1
  294. package/dist/v2/features/command-palette/components/CommandActionForm.vue.script.js.map +1 -1
  295. package/dist/v2/features/command-palette/components/CommandActionInput.vue.script.js +1 -1
  296. package/dist/v2/features/command-palette/components/CommandActionInput.vue.script.js.map +1 -1
  297. package/dist/v2/features/environments/EnvironmentsList.vue.d.ts.map +1 -1
  298. package/dist/v2/features/environments/EnvironmentsList.vue.script.js +1 -1
  299. package/dist/v2/features/environments/EnvironmentsList.vue.script.js.map +1 -1
  300. package/dist/v2/features/environments/components/Environment.vue.d.ts.map +1 -1
  301. package/dist/v2/features/environments/components/Environment.vue.script.js +1 -1
  302. package/dist/v2/features/environments/components/Environment.vue.script.js.map +1 -1
  303. package/dist/v2/features/environments/components/EnvironmentColors.vue.script.js +3 -2
  304. package/dist/v2/features/environments/components/EnvironmentColors.vue.script.js.map +1 -1
  305. package/dist/v2/features/environments/components/EnvironmentCreateModal.vue.d.ts.map +1 -1
  306. package/dist/v2/features/environments/components/EnvironmentCreateModal.vue.script.js +1 -1
  307. package/dist/v2/features/environments/components/EnvironmentCreateModal.vue.script.js.map +1 -1
  308. package/dist/v2/features/environments/components/EnvironmentDeleteModal.vue.d.ts.map +1 -1
  309. package/dist/v2/features/environments/components/EnvironmentDeleteModal.vue.script.js +1 -1
  310. package/dist/v2/features/environments/components/EnvironmentDeleteModal.vue.script.js.map +1 -1
  311. package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.d.ts.map +1 -1
  312. package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.script.js +1 -1
  313. package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.script.js.map +1 -1
  314. package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.d.ts.map +1 -1
  315. package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.js +1 -1
  316. package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.script.js +1 -1
  317. package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.script.js.map +1 -1
  318. package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
  319. package/dist/v2/features/modal/Modal.vue.script.js +1 -1
  320. package/dist/v2/features/modal/Modal.vue.script.js.map +1 -1
  321. package/dist/v2/features/modal/helpers/create-api-client-modal.js +11 -0
  322. package/dist/v2/features/modal/helpers/create-api-client-modal.js.map +1 -1
  323. package/dist/v2/features/modal/helpers/map-hidden-clients-config.js.map +1 -1
  324. package/dist/v2/features/modal/helpers/resolve-route-parameters.js +1 -1
  325. package/dist/v2/features/modal/helpers/resolve-route-parameters.js.map +1 -1
  326. package/dist/v2/features/modal/hooks/use-modal-sidebar.js.map +1 -1
  327. package/dist/v2/features/modal/modal-events.js.map +1 -1
  328. package/dist/v2/features/operation/Operation.vue.script.js +1 -1
  329. package/dist/v2/features/operation/Operation.vue.script.js.map +1 -1
  330. package/dist/v2/features/search/components/DocumentSearchModal.vue.d.ts.map +1 -1
  331. package/dist/v2/features/search/components/DocumentSearchModal.vue.js +1 -1
  332. package/dist/v2/features/search/components/DocumentSearchModal.vue.script.js +1 -1
  333. package/dist/v2/features/search/components/DocumentSearchModal.vue.script.js.map +1 -1
  334. package/dist/v2/features/search/components/SearchResult.vue.d.ts.map +1 -1
  335. package/dist/v2/features/search/components/SearchResult.vue.script.js +1 -1
  336. package/dist/v2/features/search/components/SearchResult.vue.script.js.map +1 -1
  337. package/dist/v2/features/search/helpers/create-fuse-instance.js.map +1 -1
  338. package/dist/v2/features/search/helpers/create-search-index.js.map +1 -1
  339. package/dist/v2/features/search/hooks/use-document-search.js.map +1 -1
  340. package/dist/v2/features/search/hooks/use-search-index.js.map +1 -1
  341. package/dist/v2/helpers/generate-location-id.js.map +1 -1
  342. package/dist/v2/helpers/handle-hotkeys.js +1 -1
  343. package/dist/v2/helpers/handle-hotkeys.js.map +1 -1
  344. package/dist/v2/helpers/test-utils.js.map +1 -1
  345. package/dist/v2/hooks/use-global-hot-keys.js.map +1 -1
  346. package/dist/v2/hooks/use-scroll-lock.js.map +1 -1
  347. package/dist/v2/workspace-events.js.map +1 -1
  348. package/dist/vue-styles.css +227 -234
  349. package/package.json +20 -20
@@ -1 +1 @@
1
- {"version":3,"file":"get-parameter-content.js","names":[],"sources":["../../../../../src/v2/blocks/request-block/helpers/get-parameter-content.ts"],"sourcesContent":["import type { MediaTypeObject, ParameterObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\n/**\n * Extract content value from parameter object\n *\n * Parameters MUST only have one specified content key\n */\nexport const getParameterContentValue = (parameter: ParameterObject): MediaTypeObject | undefined => {\n if ('content' in parameter && parameter.content) {\n const keys = Object.keys(parameter.content)\n\n if (keys.length !== 1) {\n return undefined\n }\n\n return parameter.content[keys[0]!]\n }\n\n return undefined\n}\n"],"mappings":";;;;;;AAOA,IAAa,4BAA4B,cAA4D;AACnG,KAAI,aAAa,aAAa,UAAU,SAAS;EAC/C,MAAM,OAAO,OAAO,KAAK,UAAU,QAAQ;AAE3C,MAAI,KAAK,WAAW,EAClB;AAGF,SAAO,UAAU,QAAQ,KAAK"}
1
+ {"version":3,"file":"get-parameter-content.js","names":[],"sources":["../../../../../src/v2/blocks/request-block/helpers/get-parameter-content.ts"],"sourcesContent":["import type { MediaTypeObject, ParameterObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\n/**\n * Extract content value from parameter object\n *\n * Parameters MUST only have one specified content key\n */\nexport const getParameterContentValue = (parameter: ParameterObject): MediaTypeObject | undefined => {\n if ('content' in parameter && parameter.content) {\n const keys = Object.keys(parameter.content)\n\n if (keys.length !== 1) {\n return undefined\n }\n\n return parameter.content[keys[0]!]\n }\n\n return undefined\n}\n"],"mappings":";;;;;;AAOA,IAAa,4BAA4B,cAA4D;CACnG,IAAI,aAAa,aAAa,UAAU,SAAS;EAC/C,MAAM,OAAO,OAAO,KAAK,UAAU,OAAO;EAE1C,IAAI,KAAK,WAAW,GAClB;EAGF,OAAO,UAAU,QAAQ,KAAK;CAChC;AAGF"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-parameter-schema.js","names":[],"sources":["../../../../../src/v2/blocks/request-block/helpers/get-parameter-schema.ts"],"sourcesContent":["import { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type { ParameterObject, SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\nimport { getParameterContentValue } from './get-parameter-content'\n\n/**\n * Extract the schema from the parameter object\n */\nexport const getParameterSchema = (parameter: ParameterObject): SchemaObject | undefined => {\n if ('schema' in parameter && parameter.schema) {\n return getResolvedRef(parameter.schema)\n }\n\n return getResolvedRef(getParameterContentValue(parameter)?.schema)\n}\n"],"mappings":";;;;;;AAQA,IAAa,sBAAsB,cAAyD;AAC1F,KAAI,YAAY,aAAa,UAAU,OACrC,QAAO,eAAe,UAAU,OAAO;AAGzC,QAAO,eAAe,yBAAyB,UAAU,EAAE,OAAO"}
1
+ {"version":3,"file":"get-parameter-schema.js","names":[],"sources":["../../../../../src/v2/blocks/request-block/helpers/get-parameter-schema.ts"],"sourcesContent":["import { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type { ParameterObject, SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\nimport { getParameterContentValue } from './get-parameter-content'\n\n/**\n * Extract the schema from the parameter object\n */\nexport const getParameterSchema = (parameter: ParameterObject): SchemaObject | undefined => {\n if ('schema' in parameter && parameter.schema) {\n return getResolvedRef(parameter.schema)\n }\n\n return getResolvedRef(getParameterContentValue(parameter)?.schema)\n}\n"],"mappings":";;;;;;AAQA,IAAa,sBAAsB,cAAyD;CAC1F,IAAI,YAAY,aAAa,UAAU,QACrC,OAAO,eAAe,UAAU,MAAM;CAGxC,OAAO,eAAe,yBAAyB,SAAS,CAAC,EAAE,MAAM;AACnE"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-structured-body-rows.js","names":[],"sources":["../../../../../src/v2/blocks/request-block/helpers/get-structured-body-rows.ts"],"sourcesContent":["import { isObject } from '@scalar/helpers/object/is-object'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { isObjectSchema } from '@scalar/workspace-store/schemas/v3.1/strict/type-guards'\n\nimport type { TableRow } from '@/v2/blocks/request-block/components/RequestTableRow.vue'\nimport {\n type LeafRow,\n collectExampleRows,\n collectLeafProperties,\n stringifyValue,\n} from '@/v2/blocks/request-block/helpers/get-form-body-rows'\n\n/**\n * Build form-table rows for a structured (JSON/YAML) request body.\n *\n * The parsed body value is walked alongside the schema exactly like the multipart form\n * editor does: schema-declared properties first in schema order (nested objects flatten\n * into dotted-path leaves like `props.name`), example-only keys after in example order.\n * Each row is enriched with its leaf schema so the table shows enum dropdowns, required\n * badges, defaults, and validation per field.\n */\nexport const getStructuredBodyRows = (parsedValue: unknown, schema?: SchemaObject): TableRow[] => {\n const objectSchema = schema && isObjectSchema(schema) ? schema : undefined\n\n // Nothing to build rows from: neither a body object nor an object schema.\n if (!isObject(parsedValue) && !objectSchema) {\n return []\n }\n\n // Leaf index by dotted name so nested leaves keep their schema and required flag.\n const leafByDottedName = new Map<string, LeafRow>()\n if (objectSchema) {\n for (const leaf of collectLeafProperties(objectSchema)) {\n leafByDottedName.set(leaf.path.join('.'), leaf)\n }\n }\n const requiredSet = new Set(objectSchema?.required ?? [])\n\n return collectExampleRows(isObject(parsedValue) ? parsedValue : {}, objectSchema).map(({ path, value }) => {\n const name = path.join('.')\n\n // Missing values and explicit `null` render as empty inputs so the user can type a\n // value rather than seeing the string \"null\". Empty rows are omitted on fold-back.\n const rendered = value === undefined || value === null ? '' : stringifyValue(value)\n\n const row: TableRow = { name, value: rendered, isDisabled: false }\n\n const leaf = leafByDottedName.get(name)\n const propSchema = leaf?.schema ?? (objectSchema ? resolve.schema(objectSchema.properties?.[name]) : undefined)\n row.schema = propSchema\n row.description = propSchema?.description\n row.isRequired = leaf?.isRequired ?? requiredSet.has(name)\n\n return row\n })\n}\n"],"mappings":";;;;;;;;;;;;;;AAsBA,IAAa,yBAAyB,aAAsB,WAAsC;CAChG,MAAM,eAAe,UAAU,eAAe,OAAO,GAAG,SAAS,KAAA;AAGjE,KAAI,CAAC,SAAS,YAAY,IAAI,CAAC,aAC7B,QAAO,EAAE;CAIX,MAAM,mCAAmB,IAAI,KAAsB;AACnD,KAAI,aACF,MAAK,MAAM,QAAQ,sBAAsB,aAAa,CACpD,kBAAiB,IAAI,KAAK,KAAK,KAAK,IAAI,EAAE,KAAK;CAGnD,MAAM,cAAc,IAAI,IAAI,cAAc,YAAY,EAAE,CAAC;AAEzD,QAAO,mBAAmB,SAAS,YAAY,GAAG,cAAc,EAAE,EAAE,aAAa,CAAC,KAAK,EAAE,MAAM,YAAY;EACzG,MAAM,OAAO,KAAK,KAAK,IAAI;EAM3B,MAAM,MAAgB;GAAE;GAAM,OAFb,UAAU,KAAA,KAAa,UAAU,OAAO,KAAK,eAAe,MAAM;GAEpC,YAAY;GAAO;EAElE,MAAM,OAAO,iBAAiB,IAAI,KAAK;EACvC,MAAM,aAAa,MAAM,WAAW,eAAe,QAAQ,OAAO,aAAa,aAAa,MAAM,GAAG,KAAA;AACrG,MAAI,SAAS;AACb,MAAI,cAAc,YAAY;AAC9B,MAAI,aAAa,MAAM,cAAc,YAAY,IAAI,KAAK;AAE1D,SAAO;GACP"}
1
+ {"version":3,"file":"get-structured-body-rows.js","names":[],"sources":["../../../../../src/v2/blocks/request-block/helpers/get-structured-body-rows.ts"],"sourcesContent":["import { isObject } from '@scalar/helpers/object/is-object'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { isObjectSchema } from '@scalar/workspace-store/schemas/v3.1/strict/type-guards'\n\nimport type { TableRow } from '@/v2/blocks/request-block/components/RequestTableRow.vue'\nimport {\n type LeafRow,\n collectExampleRows,\n collectLeafProperties,\n stringifyValue,\n} from '@/v2/blocks/request-block/helpers/get-form-body-rows'\n\n/**\n * Build form-table rows for a structured (JSON/YAML) request body.\n *\n * The parsed body value is walked alongside the schema exactly like the multipart form\n * editor does: schema-declared properties first in schema order (nested objects flatten\n * into dotted-path leaves like `props.name`), example-only keys after in example order.\n * Each row is enriched with its leaf schema so the table shows enum dropdowns, required\n * badges, defaults, and validation per field.\n */\nexport const getStructuredBodyRows = (parsedValue: unknown, schema?: SchemaObject): TableRow[] => {\n const objectSchema = schema && isObjectSchema(schema) ? schema : undefined\n\n // Nothing to build rows from: neither a body object nor an object schema.\n if (!isObject(parsedValue) && !objectSchema) {\n return []\n }\n\n // Leaf index by dotted name so nested leaves keep their schema and required flag.\n const leafByDottedName = new Map<string, LeafRow>()\n if (objectSchema) {\n for (const leaf of collectLeafProperties(objectSchema)) {\n leafByDottedName.set(leaf.path.join('.'), leaf)\n }\n }\n const requiredSet = new Set(objectSchema?.required ?? [])\n\n return collectExampleRows(isObject(parsedValue) ? parsedValue : {}, objectSchema).map(({ path, value }) => {\n const name = path.join('.')\n\n // Missing values and explicit `null` render as empty inputs so the user can type a\n // value rather than seeing the string \"null\". Empty rows are omitted on fold-back.\n const rendered = value === undefined || value === null ? '' : stringifyValue(value)\n\n const row: TableRow = { name, value: rendered, isDisabled: false }\n\n const leaf = leafByDottedName.get(name)\n const propSchema = leaf?.schema ?? (objectSchema ? resolve.schema(objectSchema.properties?.[name]) : undefined)\n row.schema = propSchema\n row.description = propSchema?.description\n row.isRequired = leaf?.isRequired ?? requiredSet.has(name)\n\n return row\n })\n}\n"],"mappings":";;;;;;;;;;;;;;AAsBA,IAAa,yBAAyB,aAAsB,WAAsC;CAChG,MAAM,eAAe,UAAU,eAAe,MAAM,IAAI,SAAS,KAAA;CAGjE,IAAI,CAAC,SAAS,WAAW,KAAK,CAAC,cAC7B,OAAO,CAAC;CAIV,MAAM,mCAAmB,IAAI,IAAqB;CAClD,IAAI,cACF,KAAK,MAAM,QAAQ,sBAAsB,YAAY,GACnD,iBAAiB,IAAI,KAAK,KAAK,KAAK,GAAG,GAAG,IAAI;CAGlD,MAAM,cAAc,IAAI,IAAI,cAAc,YAAY,CAAC,CAAC;CAExD,OAAO,mBAAmB,SAAS,WAAW,IAAI,cAAc,CAAC,GAAG,YAAY,CAAC,CAAC,KAAK,EAAE,MAAM,YAAY;EACzG,MAAM,OAAO,KAAK,KAAK,GAAG;EAM1B,MAAM,MAAgB;GAAE;GAAM,OAFb,UAAU,KAAA,KAAa,UAAU,OAAO,KAAK,eAAe,KAAK;GAEnC,YAAY;EAAM;EAEjE,MAAM,OAAO,iBAAiB,IAAI,IAAI;EACtC,MAAM,aAAa,MAAM,WAAW,eAAe,QAAQ,OAAO,aAAa,aAAa,KAAK,IAAI,KAAA;EACrG,IAAI,SAAS;EACb,IAAI,cAAc,YAAY;EAC9B,IAAI,aAAa,MAAM,cAAc,YAAY,IAAI,IAAI;EAEzD,OAAO;CACT,CAAC;AACH"}
@@ -1 +1 @@
1
- {"version":3,"file":"group-by.js","names":[],"sources":["../../../../../src/v2/blocks/request-block/helpers/group-by.ts"],"sourcesContent":["/**\n * Group together array objects by a specific key\n */\nexport const groupBy = <\n T extends Record<string, unknown>,\n K extends keyof T,\n V extends string | number | symbol = Extract<T[K], string | number | symbol>,\n R = T,\n>(\n arr: T[],\n key: K,\n transform?: (item: T) => R,\n): Record<V, R[]> => {\n return arr.reduce(\n (acc, obj) => {\n const transformedItem = transform ? transform(obj) : (obj as unknown as R)\n ;(acc[obj[key] as V] ??= []).push(transformedItem)\n return acc\n },\n {} as Record<V, R[]>,\n )\n}\n"],"mappings":";;;;AAGA,IAAa,WAMX,KACA,KACA,cACmB;AACnB,QAAO,IAAI,QACR,KAAK,QAAQ;EACZ,MAAM,kBAAkB,YAAY,UAAU,IAAI,GAAI;AACrD,GAAC,IAAI,IAAI,UAAe,EAAE,EAAE,KAAK,gBAAgB;AAClD,SAAO;IAET,EAAE,CACH"}
1
+ {"version":3,"file":"group-by.js","names":[],"sources":["../../../../../src/v2/blocks/request-block/helpers/group-by.ts"],"sourcesContent":["/**\n * Group together array objects by a specific key\n */\nexport const groupBy = <\n T extends Record<string, unknown>,\n K extends keyof T,\n V extends string | number | symbol = Extract<T[K], string | number | symbol>,\n R = T,\n>(\n arr: T[],\n key: K,\n transform?: (item: T) => R,\n): Record<V, R[]> => {\n return arr.reduce(\n (acc, obj) => {\n const transformedItem = transform ? transform(obj) : (obj as unknown as R)\n ;(acc[obj[key] as V] ??= []).push(transformedItem)\n return acc\n },\n {} as Record<V, R[]>,\n )\n}\n"],"mappings":";;;;AAGA,IAAa,WAMX,KACA,KACA,cACmB;CACnB,OAAO,IAAI,QACR,KAAK,QAAQ;EACZ,MAAM,kBAAkB,YAAY,UAAU,GAAG,IAAK;EACrD,CAAC,IAAI,IAAI,UAAe,CAAC,EAAA,CAAG,KAAK,eAAe;EACjD,OAAO;CACT,GACA,CAAC,CACH;AACF"}
@@ -0,0 +1,54 @@
1
+ import type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies';
2
+ /**
3
+ * A global cookie collection paired with where it lives, so a selection can be written back to the
4
+ * correct source: the workspace or the active document `x-scalar-cookies` list.
5
+ */
6
+ type GlobalCookieSource = {
7
+ location: 'document' | 'workspace';
8
+ cookies: XScalarCookie[];
9
+ };
10
+ /**
11
+ * A single cookie within a preset group, carrying just enough to mutate its source: which
12
+ * collection it belongs to and its index within that collection's `x-scalar-cookies` array.
13
+ */
14
+ type GlobalCookieSibling = {
15
+ location: 'document' | 'workspace';
16
+ index: number;
17
+ value: string;
18
+ };
19
+ /**
20
+ * Global cookies that share a name, grouped into a single logical cookie. When more than one value
21
+ * exists for the same name the group becomes a preset the user can switch between (for example a
22
+ * `Culture` cookie with `PL` and `EN` values).
23
+ */
24
+ type GlobalCookieGroup = {
25
+ /** The shared cookie name. */
26
+ name: string;
27
+ /** The value of the currently active (enabled) sibling — the one that is sent. */
28
+ selectedValue: string;
29
+ /** Distinct selectable values, in first-seen order. Only populated for presets. */
30
+ options: string[];
31
+ /** Whether this group offers more than one value to switch between. */
32
+ isPreset: boolean;
33
+ /** Location of the first sibling, used to navigate to the global cookie settings. */
34
+ location: 'document' | 'workspace';
35
+ /** Every sibling sharing this name, so a selection can enable one and disable the rest. */
36
+ siblings: GlobalCookieSibling[];
37
+ };
38
+ /**
39
+ * Groups global cookies by name so duplicate names collapse into a single row. Same-named cookies
40
+ * used to render as independent rows that all shared one disabled state, so toggling one toggled
41
+ * them all. Grouping them lets a name expose its values as a preset switcher instead.
42
+ *
43
+ * The `shouldInclude` predicate applies the caller's domain and path filtering while the original
44
+ * index is still known, so a selection can be written back to the right entry. That predicate
45
+ * deliberately ignores the disabled flag for preset values: a disabled value is only hidden from
46
+ * the request, not from the switcher, so the user can select it again.
47
+ */
48
+ export declare const groupGlobalCookies: ({ sources, shouldInclude, }: {
49
+ sources: GlobalCookieSource[];
50
+ /** Whether a cookie is applicable to the current request (domain/path), ignoring its disabled state. */
51
+ shouldInclude: (cookie: XScalarCookie) => boolean;
52
+ }) => GlobalCookieGroup[];
53
+ export {};
54
+ //# sourceMappingURL=group-global-cookies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"group-global-cookies.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/request-block/helpers/group-global-cookies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AAExG;;;GAGG;AACH,KAAK,kBAAkB,GAAG;IACxB,QAAQ,EAAE,UAAU,GAAG,WAAW,CAAA;IAClC,OAAO,EAAE,aAAa,EAAE,CAAA;CACzB,CAAA;AAED;;;GAGG;AACH,KAAK,mBAAmB,GAAG;IACzB,QAAQ,EAAE,UAAU,GAAG,WAAW,CAAA;IAClC,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED;;;;GAIG;AACH,KAAK,iBAAiB,GAAG;IACvB,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,kFAAkF;IAClF,aAAa,EAAE,MAAM,CAAA;IACrB,mFAAmF;IACnF,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,uEAAuE;IACvE,QAAQ,EAAE,OAAO,CAAA;IACjB,qFAAqF;IACrF,QAAQ,EAAE,UAAU,GAAG,WAAW,CAAA;IAClC,2FAA2F;IAC3F,QAAQ,EAAE,mBAAmB,EAAE,CAAA;CAChC,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,GAAI,6BAGhC;IACD,OAAO,EAAE,kBAAkB,EAAE,CAAA;IAC7B,wGAAwG;IACxG,aAAa,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,OAAO,CAAA;CAClD,KAAG,iBAAiB,EA4DpB,CAAA"}
@@ -0,0 +1,56 @@
1
+ //#region src/v2/blocks/request-block/helpers/group-global-cookies.ts
2
+ /**
3
+ * Groups global cookies by name so duplicate names collapse into a single row. Same-named cookies
4
+ * used to render as independent rows that all shared one disabled state, so toggling one toggled
5
+ * them all. Grouping them lets a name expose its values as a preset switcher instead.
6
+ *
7
+ * The `shouldInclude` predicate applies the caller's domain and path filtering while the original
8
+ * index is still known, so a selection can be written back to the right entry. That predicate
9
+ * deliberately ignores the disabled flag for preset values: a disabled value is only hidden from
10
+ * the request, not from the switcher, so the user can select it again.
11
+ */
12
+ var groupGlobalCookies = ({ sources, shouldInclude }) => {
13
+ /** Names in first-seen order so the rendered rows keep a stable, predictable order. */
14
+ const order = [];
15
+ const grouped = /* @__PURE__ */ new Map();
16
+ for (const { location, cookies } of sources) cookies.forEach((cookie, index) => {
17
+ if (!cookie.name || !shouldInclude(cookie)) return;
18
+ if (!grouped.has(cookie.name)) {
19
+ grouped.set(cookie.name, []);
20
+ order.push(cookie.name);
21
+ }
22
+ grouped.get(cookie.name)?.push({
23
+ location,
24
+ value: cookie.value,
25
+ isDisabled: cookie.isDisabled ?? false,
26
+ index
27
+ });
28
+ });
29
+ const groups = [];
30
+ for (const name of order) {
31
+ const entries = grouped.get(name) ?? [];
32
+ const first = entries[0];
33
+ if (!first) continue;
34
+ const enabled = entries.filter((entry) => !entry.isDisabled);
35
+ const options = [...new Set(entries.map((entry) => entry.value))];
36
+ const isPreset = options.length > 1;
37
+ if (!isPreset && enabled.length === 0) continue;
38
+ groups.push({
39
+ name,
40
+ selectedValue: (enabled[0] ?? first).value,
41
+ options: isPreset ? options : [],
42
+ isPreset,
43
+ location: first.location,
44
+ siblings: entries.map(({ location, index, value }) => ({
45
+ location,
46
+ index,
47
+ value
48
+ }))
49
+ });
50
+ }
51
+ return groups;
52
+ };
53
+ //#endregion
54
+ export { groupGlobalCookies };
55
+
56
+ //# sourceMappingURL=group-global-cookies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"group-global-cookies.js","names":[],"sources":["../../../../../src/v2/blocks/request-block/helpers/group-global-cookies.ts"],"sourcesContent":["import type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies'\n\n/**\n * A global cookie collection paired with where it lives, so a selection can be written back to the\n * correct source: the workspace or the active document `x-scalar-cookies` list.\n */\ntype GlobalCookieSource = {\n location: 'document' | 'workspace'\n cookies: XScalarCookie[]\n}\n\n/**\n * A single cookie within a preset group, carrying just enough to mutate its source: which\n * collection it belongs to and its index within that collection's `x-scalar-cookies` array.\n */\ntype GlobalCookieSibling = {\n location: 'document' | 'workspace'\n index: number\n value: string\n}\n\n/**\n * Global cookies that share a name, grouped into a single logical cookie. When more than one value\n * exists for the same name the group becomes a preset the user can switch between (for example a\n * `Culture` cookie with `PL` and `EN` values).\n */\ntype GlobalCookieGroup = {\n /** The shared cookie name. */\n name: string\n /** The value of the currently active (enabled) sibling — the one that is sent. */\n selectedValue: string\n /** Distinct selectable values, in first-seen order. Only populated for presets. */\n options: string[]\n /** Whether this group offers more than one value to switch between. */\n isPreset: boolean\n /** Location of the first sibling, used to navigate to the global cookie settings. */\n location: 'document' | 'workspace'\n /** Every sibling sharing this name, so a selection can enable one and disable the rest. */\n siblings: GlobalCookieSibling[]\n}\n\n/**\n * Groups global cookies by name so duplicate names collapse into a single row. Same-named cookies\n * used to render as independent rows that all shared one disabled state, so toggling one toggled\n * them all. Grouping them lets a name expose its values as a preset switcher instead.\n *\n * The `shouldInclude` predicate applies the caller's domain and path filtering while the original\n * index is still known, so a selection can be written back to the right entry. That predicate\n * deliberately ignores the disabled flag for preset values: a disabled value is only hidden from\n * the request, not from the switcher, so the user can select it again.\n */\nexport const groupGlobalCookies = ({\n sources,\n shouldInclude,\n}: {\n sources: GlobalCookieSource[]\n /** Whether a cookie is applicable to the current request (domain/path), ignoring its disabled state. */\n shouldInclude: (cookie: XScalarCookie) => boolean\n}): GlobalCookieGroup[] => {\n /** Names in first-seen order so the rendered rows keep a stable, predictable order. */\n const order: string[] = []\n const grouped = new Map<\n string,\n { location: 'document' | 'workspace'; value: string; isDisabled: boolean; index: number }[]\n >()\n\n for (const { location, cookies } of sources) {\n cookies.forEach((cookie, index) => {\n if (!cookie.name || !shouldInclude(cookie)) {\n return\n }\n\n if (!grouped.has(cookie.name)) {\n grouped.set(cookie.name, [])\n order.push(cookie.name)\n }\n\n grouped.get(cookie.name)?.push({\n location,\n value: cookie.value,\n isDisabled: cookie.isDisabled ?? false,\n index,\n })\n })\n }\n\n const groups: GlobalCookieGroup[] = []\n\n for (const name of order) {\n const entries = grouped.get(name) ?? []\n const first = entries[0]\n if (!first) {\n continue\n }\n\n const enabled = entries.filter((entry) => !entry.isDisabled)\n const options = [...new Set(entries.map((entry) => entry.value))]\n const isPreset = options.length > 1\n\n // Preserve the previous behavior for plain cookies: a fully disabled single cookie stays hidden\n // from the request view. A preset always renders so its value can be switched back on.\n if (!isPreset && enabled.length === 0) {\n continue\n }\n\n groups.push({\n name,\n // The enabled sibling is the one that is sent; fall back to the first value when the whole\n // group happens to be disabled so the switcher still has something to show.\n selectedValue: (enabled[0] ?? first).value,\n options: isPreset ? options : [],\n isPreset,\n location: first.location,\n siblings: entries.map(({ location, index, value }) => ({ location, index, value })),\n })\n }\n\n return groups\n}\n"],"mappings":";;;;;;;;;;;AAmDA,IAAa,sBAAsB,EACjC,SACA,oBAKyB;;CAEzB,MAAM,QAAkB,CAAC;CACzB,MAAM,0BAAU,IAAI,IAGlB;CAEF,KAAK,MAAM,EAAE,UAAU,aAAa,SAClC,QAAQ,SAAS,QAAQ,UAAU;EACjC,IAAI,CAAC,OAAO,QAAQ,CAAC,cAAc,MAAM,GACvC;EAGF,IAAI,CAAC,QAAQ,IAAI,OAAO,IAAI,GAAG;GAC7B,QAAQ,IAAI,OAAO,MAAM,CAAC,CAAC;GAC3B,MAAM,KAAK,OAAO,IAAI;EACxB;EAEA,QAAQ,IAAI,OAAO,IAAI,CAAC,EAAE,KAAK;GAC7B;GACA,OAAO,OAAO;GACd,YAAY,OAAO,cAAc;GACjC;EACF,CAAC;CACH,CAAC;CAGH,MAAM,SAA8B,CAAC;CAErC,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,UAAU,QAAQ,IAAI,IAAI,KAAK,CAAC;EACtC,MAAM,QAAQ,QAAQ;EACtB,IAAI,CAAC,OACH;EAGF,MAAM,UAAU,QAAQ,QAAQ,UAAU,CAAC,MAAM,UAAU;EAC3D,MAAM,UAAU,CAAC,GAAG,IAAI,IAAI,QAAQ,KAAK,UAAU,MAAM,KAAK,CAAC,CAAC;EAChE,MAAM,WAAW,QAAQ,SAAS;EAIlC,IAAI,CAAC,YAAY,QAAQ,WAAW,GAClC;EAGF,OAAO,KAAK;GACV;GAGA,gBAAgB,QAAQ,MAAM,MAAA,CAAO;GACrC,SAAS,WAAW,UAAU,CAAC;GAC/B;GACA,UAAU,MAAM;GAChB,UAAU,QAAQ,KAAK,EAAE,UAAU,OAAO,aAAa;IAAE;IAAU;IAAO;GAAM,EAAE;EACpF,CAAC;CACH;CAEA,OAAO;AACT"}
@@ -11,7 +11,7 @@ var yamlCodec = {
11
11
  parse: (text) => parse(text),
12
12
  stringify: (value) => stringify(value)
13
13
  };
14
- var YAML_ESSENCES = new Set([
14
+ var YAML_ESSENCES = /* @__PURE__ */ new Set([
15
15
  "application/yaml",
16
16
  "application/x-yaml",
17
17
  "text/yaml",
@@ -1 +1 @@
1
- {"version":3,"file":"structured-body-codec.js","names":[],"sources":["../../../../../src/v2/blocks/request-block/helpers/structured-body-codec.ts"],"sourcesContent":["import { parseMimeType } from '@scalar/helpers/http/mime-type'\nimport { parse as parseYaml, stringify as stringifyYaml } from 'yaml'\n\n/** Parse/serialize pair for a structured (form-editable) body content type. */\ntype StructuredBodyCodec = {\n /** Language for the raw code editor, doubles as the codec family id */\n language: 'json' | 'yaml'\n parse: (text: string) => unknown\n stringify: (value: unknown) => string\n}\n\nconst jsonCodec: StructuredBodyCodec = {\n language: 'json',\n parse: (text) => JSON.parse(text),\n stringify: (value) => JSON.stringify(value, null, 2),\n}\n\nconst yamlCodec: StructuredBodyCodec = {\n language: 'yaml',\n parse: (text) => parseYaml(text),\n stringify: (value) => stringifyYaml(value),\n}\n\nconst YAML_ESSENCES = new Set(['application/yaml', 'application/x-yaml', 'text/yaml', 'text/x-yaml'])\n\n/**\n * Return the codec for content types whose body is a structured document we can edit as\n * a form (JSON and YAML families, including `+json` / `+yaml` vendor suffixes), or\n * `undefined` for everything else (multipart and urlencoded keep their own form editor).\n */\nexport const getStructuredBodyCodec = (contentType: string): StructuredBodyCodec | undefined => {\n const essence = parseMimeType(contentType).essence\n\n if (essence === 'application/json' || essence.endsWith('+json')) {\n return jsonCodec\n }\n if (YAML_ESSENCES.has(essence) || essence.endsWith('+yaml')) {\n return yamlCodec\n }\n return undefined\n}\n"],"mappings":";;;AAWA,IAAM,YAAiC;CACrC,UAAU;CACV,QAAQ,SAAS,KAAK,MAAM,KAAK;CACjC,YAAY,UAAU,KAAK,UAAU,OAAO,MAAM,EAAE;CACrD;AAED,IAAM,YAAiC;CACrC,UAAU;CACV,QAAQ,SAAS,MAAU,KAAK;CAChC,YAAY,UAAU,UAAc,MAAM;CAC3C;AAED,IAAM,gBAAgB,IAAI,IAAI;CAAC;CAAoB;CAAsB;CAAa;CAAc,CAAC;;;;;;AAOrG,IAAa,0BAA0B,gBAAyD;CAC9F,MAAM,UAAU,cAAc,YAAY,CAAC;AAE3C,KAAI,YAAY,sBAAsB,QAAQ,SAAS,QAAQ,CAC7D,QAAO;AAET,KAAI,cAAc,IAAI,QAAQ,IAAI,QAAQ,SAAS,QAAQ,CACzD,QAAO"}
1
+ {"version":3,"file":"structured-body-codec.js","names":[],"sources":["../../../../../src/v2/blocks/request-block/helpers/structured-body-codec.ts"],"sourcesContent":["import { parseMimeType } from '@scalar/helpers/http/mime-type'\nimport { parse as parseYaml, stringify as stringifyYaml } from 'yaml'\n\n/** Parse/serialize pair for a structured (form-editable) body content type. */\ntype StructuredBodyCodec = {\n /** Language for the raw code editor, doubles as the codec family id */\n language: 'json' | 'yaml'\n parse: (text: string) => unknown\n stringify: (value: unknown) => string\n}\n\nconst jsonCodec: StructuredBodyCodec = {\n language: 'json',\n parse: (text) => JSON.parse(text),\n stringify: (value) => JSON.stringify(value, null, 2),\n}\n\nconst yamlCodec: StructuredBodyCodec = {\n language: 'yaml',\n parse: (text) => parseYaml(text),\n stringify: (value) => stringifyYaml(value),\n}\n\nconst YAML_ESSENCES = new Set(['application/yaml', 'application/x-yaml', 'text/yaml', 'text/x-yaml'])\n\n/**\n * Return the codec for content types whose body is a structured document we can edit as\n * a form (JSON and YAML families, including `+json` / `+yaml` vendor suffixes), or\n * `undefined` for everything else (multipart and urlencoded keep their own form editor).\n */\nexport const getStructuredBodyCodec = (contentType: string): StructuredBodyCodec | undefined => {\n const essence = parseMimeType(contentType).essence\n\n if (essence === 'application/json' || essence.endsWith('+json')) {\n return jsonCodec\n }\n if (YAML_ESSENCES.has(essence) || essence.endsWith('+yaml')) {\n return yamlCodec\n }\n return undefined\n}\n"],"mappings":";;;AAWA,IAAM,YAAiC;CACrC,UAAU;CACV,QAAQ,SAAS,KAAK,MAAM,IAAI;CAChC,YAAY,UAAU,KAAK,UAAU,OAAO,MAAM,CAAC;AACrD;AAEA,IAAM,YAAiC;CACrC,UAAU;CACV,QAAQ,SAAS,MAAU,IAAI;CAC/B,YAAY,UAAU,UAAc,KAAK;AAC3C;AAEA,IAAM,gCAAgB,IAAI,IAAI;CAAC;CAAoB;CAAsB;CAAa;AAAa,CAAC;;;;;;AAOpG,IAAa,0BAA0B,gBAAyD;CAC9F,MAAM,UAAU,cAAc,WAAW,CAAC,CAAC;CAE3C,IAAI,YAAY,sBAAsB,QAAQ,SAAS,OAAO,GAC5D,OAAO;CAET,IAAI,cAAc,IAAI,OAAO,KAAK,QAAQ,SAAS,OAAO,GACxD,OAAO;AAGX"}
@@ -1 +1 @@
1
- {"version":3,"file":"validate-parameter.js","names":[],"sources":["../../../../../src/v2/blocks/request-block/helpers/validate-parameter.ts"],"sourcesContent":["import type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\n/**\n * Checks if the value of a example parameter is the expected type or format\n */\nexport const validateParameter = (\n schema?: SchemaObject,\n value?: string | File | null,\n): { ok: true } | { ok: false; message: string } => {\n if (!schema || !('type' in schema) || typeof value !== 'string') {\n return { ok: true }\n }\n\n // Numbers and integers validation\n if (schema.type === 'integer' || schema.type === 'number') {\n const numberValue = Number(value)\n\n if (isNaN(numberValue)) {\n return { ok: false, message: 'Value must be a number (e.g., 42.5)' }\n }\n\n if (schema.type === 'integer' && !Number.isInteger(numberValue)) {\n return { ok: false, message: 'Value must be a whole number (e.g., 42)' }\n }\n\n if (schema.minimum !== undefined && numberValue < schema.minimum) {\n return { ok: false, message: `Value must be ${schema.minimum} or greater` }\n }\n if (schema.maximum !== undefined && numberValue > schema.maximum) {\n return { ok: false, message: `Value must be ${schema.maximum} or less` }\n }\n }\n\n // string validations\n if (schema.type === 'string' && schema.format) {\n if (schema.format === 'date' && !/^\\d{4}-\\d{2}-\\d{2}$/.test(value ?? '')) {\n return { ok: false, message: 'Please enter a valid date in YYYY-MM-DD format (e.g., 2024-03-20)' }\n }\n if (\n schema.format === 'date-time' &&\n !/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$/.test(value ?? '')\n ) {\n return {\n ok: false,\n message: 'Please enter a valid date and time in RFC 3339 format (e.g., 2024-03-20T13:45:30Z)',\n }\n }\n if (schema.format === 'email' && !/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(value ?? '')) {\n return { ok: false, message: 'Please enter a valid email address (e.g., user@example.com)' }\n }\n if (schema.format === 'uri' && !/^[a-zA-Z][a-zA-Z0-9+.-]*:.+$/.test(value ?? '')) {\n return { ok: false, message: 'Please enter a valid URI (e.g., https://example.com)' }\n }\n }\n\n return { ok: true }\n}\n"],"mappings":";;;;AAKA,IAAa,qBACX,QACA,UACkD;AAClD,KAAI,CAAC,UAAU,EAAE,UAAU,WAAW,OAAO,UAAU,SACrD,QAAO,EAAE,IAAI,MAAM;AAIrB,KAAI,OAAO,SAAS,aAAa,OAAO,SAAS,UAAU;EACzD,MAAM,cAAc,OAAO,MAAM;AAEjC,MAAI,MAAM,YAAY,CACpB,QAAO;GAAE,IAAI;GAAO,SAAS;GAAuC;AAGtE,MAAI,OAAO,SAAS,aAAa,CAAC,OAAO,UAAU,YAAY,CAC7D,QAAO;GAAE,IAAI;GAAO,SAAS;GAA2C;AAG1E,MAAI,OAAO,YAAY,KAAA,KAAa,cAAc,OAAO,QACvD,QAAO;GAAE,IAAI;GAAO,SAAS,iBAAiB,OAAO,QAAQ;GAAc;AAE7E,MAAI,OAAO,YAAY,KAAA,KAAa,cAAc,OAAO,QACvD,QAAO;GAAE,IAAI;GAAO,SAAS,iBAAiB,OAAO,QAAQ;GAAW;;AAK5E,KAAI,OAAO,SAAS,YAAY,OAAO,QAAQ;AAC7C,MAAI,OAAO,WAAW,UAAU,CAAC,sBAAsB,KAAK,SAAS,GAAG,CACtE,QAAO;GAAE,IAAI;GAAO,SAAS;GAAqE;AAEpG,MACE,OAAO,WAAW,eAClB,CAAC,mEAAmE,KAAK,SAAS,GAAG,CAErF,QAAO;GACL,IAAI;GACJ,SAAS;GACV;AAEH,MAAI,OAAO,WAAW,WAAW,CAAC,6BAA6B,KAAK,SAAS,GAAG,CAC9E,QAAO;GAAE,IAAI;GAAO,SAAS;GAA+D;AAE9F,MAAI,OAAO,WAAW,SAAS,CAAC,+BAA+B,KAAK,SAAS,GAAG,CAC9E,QAAO;GAAE,IAAI;GAAO,SAAS;GAAwD;;AAIzF,QAAO,EAAE,IAAI,MAAM"}
1
+ {"version":3,"file":"validate-parameter.js","names":[],"sources":["../../../../../src/v2/blocks/request-block/helpers/validate-parameter.ts"],"sourcesContent":["import type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\n/**\n * Checks if the value of a example parameter is the expected type or format\n */\nexport const validateParameter = (\n schema?: SchemaObject,\n value?: string | File | null,\n): { ok: true } | { ok: false; message: string } => {\n if (!schema || !('type' in schema) || typeof value !== 'string') {\n return { ok: true }\n }\n\n // Numbers and integers validation\n if (schema.type === 'integer' || schema.type === 'number') {\n const numberValue = Number(value)\n\n if (isNaN(numberValue)) {\n return { ok: false, message: 'Value must be a number (e.g., 42.5)' }\n }\n\n if (schema.type === 'integer' && !Number.isInteger(numberValue)) {\n return { ok: false, message: 'Value must be a whole number (e.g., 42)' }\n }\n\n if (schema.minimum !== undefined && numberValue < schema.minimum) {\n return { ok: false, message: `Value must be ${schema.minimum} or greater` }\n }\n if (schema.maximum !== undefined && numberValue > schema.maximum) {\n return { ok: false, message: `Value must be ${schema.maximum} or less` }\n }\n }\n\n // string validations\n if (schema.type === 'string' && schema.format) {\n if (schema.format === 'date' && !/^\\d{4}-\\d{2}-\\d{2}$/.test(value ?? '')) {\n return { ok: false, message: 'Please enter a valid date in YYYY-MM-DD format (e.g., 2024-03-20)' }\n }\n if (\n schema.format === 'date-time' &&\n !/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$/.test(value ?? '')\n ) {\n return {\n ok: false,\n message: 'Please enter a valid date and time in RFC 3339 format (e.g., 2024-03-20T13:45:30Z)',\n }\n }\n if (schema.format === 'email' && !/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(value ?? '')) {\n return { ok: false, message: 'Please enter a valid email address (e.g., user@example.com)' }\n }\n if (schema.format === 'uri' && !/^[a-zA-Z][a-zA-Z0-9+.-]*:.+$/.test(value ?? '')) {\n return { ok: false, message: 'Please enter a valid URI (e.g., https://example.com)' }\n }\n }\n\n return { ok: true }\n}\n"],"mappings":";;;;AAKA,IAAa,qBACX,QACA,UACkD;CAClD,IAAI,CAAC,UAAU,EAAE,UAAU,WAAW,OAAO,UAAU,UACrD,OAAO,EAAE,IAAI,KAAK;CAIpB,IAAI,OAAO,SAAS,aAAa,OAAO,SAAS,UAAU;EACzD,MAAM,cAAc,OAAO,KAAK;EAEhC,IAAI,MAAM,WAAW,GACnB,OAAO;GAAE,IAAI;GAAO,SAAS;EAAsC;EAGrE,IAAI,OAAO,SAAS,aAAa,CAAC,OAAO,UAAU,WAAW,GAC5D,OAAO;GAAE,IAAI;GAAO,SAAS;EAA0C;EAGzE,IAAI,OAAO,YAAY,KAAA,KAAa,cAAc,OAAO,SACvD,OAAO;GAAE,IAAI;GAAO,SAAS,iBAAiB,OAAO,QAAQ;EAAa;EAE5E,IAAI,OAAO,YAAY,KAAA,KAAa,cAAc,OAAO,SACvD,OAAO;GAAE,IAAI;GAAO,SAAS,iBAAiB,OAAO,QAAQ;EAAU;CAE3E;CAGA,IAAI,OAAO,SAAS,YAAY,OAAO,QAAQ;EAC7C,IAAI,OAAO,WAAW,UAAU,CAAC,sBAAsB,KAAK,SAAS,EAAE,GACrE,OAAO;GAAE,IAAI;GAAO,SAAS;EAAoE;EAEnG,IACE,OAAO,WAAW,eAClB,CAAC,mEAAmE,KAAK,SAAS,EAAE,GAEpF,OAAO;GACL,IAAI;GACJ,SAAS;EACX;EAEF,IAAI,OAAO,WAAW,WAAW,CAAC,6BAA6B,KAAK,SAAS,EAAE,GAC7E,OAAO;GAAE,IAAI;GAAO,SAAS;EAA8D;EAE7F,IAAI,OAAO,WAAW,SAAS,CAAC,+BAA+B,KAAK,SAAS,EAAE,GAC7E,OAAO;GAAE,IAAI;GAAO,SAAS;EAAuD;CAExF;CAEA,OAAO,EAAE,IAAI,KAAK;AACpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"ResponseBlock.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/blocks/response-block/ResponseBlock.vue"],"names":[],"mappings":"AA8RA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAA;AAK7E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAA;AAWxF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,KAAK,WAAW,GAAG;IACf,4BAA4B;IAC5B,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAAA;IACjC,qDAAqD;IACrD,cAAc,EAAE,cAAc,GAAG,IAAI,CAAA;IACrC,oBAAoB;IACpB,MAAM,EAAE,YAAY,CAAA;IACpB,yCAAyC;IACzC,sBAAsB,EAAE,MAAM,CAAA;IAC9B,0BAA0B;IAC1B,UAAU,EAAE,MAAM,CAAA;IAClB,6BAA6B;IAC7B,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,0BAA0B;IAC1B,QAAQ,EAAE,iBAAiB,CAAA;CAC5B,CAAC;AAyBJ,QAAA,MAAM,gBAAgB,yCAA0C,CAAA;AAChE,KAAK,MAAM,GAAG,KAAK,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAA;AAyZvD,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;oPAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"ResponseBlock.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/blocks/response-block/ResponseBlock.vue"],"names":[],"mappings":"AA8RA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAA;AAK7E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAA;AAWxF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,KAAK,WAAW,GAAG;IACf,4BAA4B;IAC5B,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAAA;IACjC,qDAAqD;IACrD,cAAc,EAAE,cAAc,GAAG,IAAI,CAAA;IACrC,oBAAoB;IACpB,MAAM,EAAE,YAAY,CAAA;IACpB,yCAAyC;IACzC,sBAAsB,EAAE,MAAM,CAAA;IAC9B,0BAA0B;IAC1B,UAAU,EAAE,MAAM,CAAA;IAClB,6BAA6B;IAC7B,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,0BAA0B;IAC1B,QAAQ,EAAE,iBAAiB,CAAA;CAC5B,CAAC;AAyBJ,QAAA,MAAM,gBAAgB,yCAA0C,CAAA;AAChE,KAAK,MAAM,GAAG,KAAK,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAA;AA4ZvD,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;oPAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -2,7 +2,7 @@ import _plugin_vue_export_helper_default from "../../../_virtual/_plugin-vue_exp
2
2
  import ResponseBlock_vue_vue_type_script_setup_true_lang_default from "./ResponseBlock.vue.script.js";
3
3
  /* empty css */
4
4
  //#region src/v2/blocks/response-block/ResponseBlock.vue
5
- var ResponseBlock_default = /* @__PURE__ */ _plugin_vue_export_helper_default(ResponseBlock_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-7a7c6611"]]);
5
+ var ResponseBlock_default = /*#__PURE__*/ _plugin_vue_export_helper_default(ResponseBlock_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-7a7c6611"]]);
6
6
  //#endregion
7
7
  export { ResponseBlock_default as default };
8
8
 
@@ -17,7 +17,7 @@ import { ScalarErrorBoundary } from "@scalar/components/error-boundary";
17
17
  var _hoisted_1 = { class: "flex h-8 flex-1 items-center" };
18
18
  var _hoisted_2 = ["id", "role"];
19
19
  var VIRTUALIZATION_THRESHOLD = 2e5;
20
- var ResponseBlock_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
20
+ var ResponseBlock_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
21
21
  __name: "ResponseBlock",
22
22
  props: {
23
23
  response: {},
@@ -1 +1 @@
1
- {"version":3,"file":"ResponseBlock.vue.script.js","names":[],"sources":["../../../../src/v2/blocks/response-block/ResponseBlock.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarErrorBoundary } from '@scalar/components/error-boundary'\nimport { isDefined } from '@scalar/helpers/array/is-defined'\nimport type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type { RequestPayload } from '@scalar/workspace-store/request-example'\nimport { computed, ref, useId } from 'vue'\n\nimport SectionFilter from '@/components/SectionFilter.vue'\nimport ViewLayoutSection from '@/components/ViewLayout/ViewLayoutSection.vue'\nimport type { ResponseInstance } from '@/v2/blocks/operation-block/helpers/send-request'\nimport HeadersComponent from '@/v2/blocks/response-block/components/Headers.vue'\nimport ResponseBody from '@/v2/blocks/response-block/components/ResponseBody.vue'\nimport ResponseBodyStreaming from '@/v2/blocks/response-block/components/ResponseBodyStreaming.vue'\nimport ResponseBodyVirtual from '@/v2/blocks/response-block/components/ResponseBodyVirtual.vue'\nimport ResponseCookies from '@/v2/blocks/response-block/components/ResponseCookies.vue'\nimport ResponseEmpty from '@/v2/blocks/response-block/components/ResponseEmpty.vue'\nimport ResponseLoadingOverlay from '@/v2/blocks/response-block/components/ResponseLoadingOverlay.vue'\nimport ResponseMetaInformation from '@/v2/blocks/response-block/components/ResponseMetaInformation.vue'\nimport { textMediaTypes } from '@/v2/blocks/response-block/helpers/media-types'\nimport { parseSetCookie } from '@/v2/blocks/response-block/helpers/parse-set-cookie'\nimport type { ClientLayout } from '@/v2/types/layout'\n\nconst { layout, totalPerformedRequests, response, requestPayload } =\n defineProps<{\n /** Preprocessed response */\n response: ResponseInstance | null\n /** Original request as a [url, RequestInit] tuple */\n requestPayload: RequestPayload | null\n /** Client layout */\n layout: ClientLayout\n /** Total number of performed requests */\n totalPerformedRequests: number\n /** Application version */\n appVersion: string\n /** Registered app plugins */\n plugins: ClientPlugin[]\n /** Workspace event bus */\n eventBus: WorkspaceEventBus\n }>()\n\n// Headers\nconst responseHeaders = computed(() => {\n const headers = response?.headers\n\n return headers\n ? Object.keys(headers).map((key) => ({\n name: key,\n value: headers[key] ?? '',\n }))\n : []\n})\n\n// Cookies\nconst responseCookies = computed(\n () =>\n response?.cookieHeaderKeys\n .map((setCookieValue) => parseSetCookie(setCookieValue))\n .filter(isDefined) ?? [],\n)\n\nconst responseSections = ['Cookies', 'Headers', 'Body'] as const\ntype Filter = 'All' | (typeof responseSections)[number]\nconst activeFilter = ref<Filter>('All')\n\nconst filters = computed<Filter[]>(() => ['All', ...responseSections])\n\nconst filterIds = computed(\n () =>\n Object.fromEntries(\n filters.value.map((section) => [section, useId()]),\n ) as Record<Filter, string>,\n)\n\n/** Threshold for virtualizing response bodies in bytes */\nconst VIRTUALIZATION_THRESHOLD = 200_000\nconst shouldVirtualize = computed(() => {\n if (!response || !('size' in response)) {\n return false\n }\n\n // Get content type from headers\n const contentType =\n response.headers?.['content-type'] || response.headers?.['Content-Type']\n\n // If no content type or response size is small, don't virtualize\n if (!contentType || (response.size ?? 0) <= VIRTUALIZATION_THRESHOLD) {\n return false\n }\n\n // Do not virtualize html\n if (contentType.includes('text/html')) {\n return false\n }\n\n // Check if content type matches any text-based type\n const isTextBased = textMediaTypes.some((type) => contentType.includes(type))\n\n return isTextBased && (response.size ?? 0) > VIRTUALIZATION_THRESHOLD\n})\n\nconst requestHeaders = computed(() => {\n const headers = requestPayload?.[1]?.headers\n if (!headers) {\n return []\n }\n\n // Normalise via the Headers constructor, and then spread\n return [...new Headers(headers)].map(([name, value]) => ({\n name,\n value,\n required: false,\n }))\n})\n\nconst isSectionVisible = (\n section: (typeof responseSections)[number] | 'All',\n) => {\n if (activeFilter.value === 'All' || activeFilter.value === section) {\n return true\n }\n return false\n}\n\ndefineExpose({\n responseHeaders,\n responseCookies,\n requestHeaders,\n shouldVirtualize,\n activeFilter,\n filters,\n})\n</script>\n<template>\n <ViewLayoutSection aria-label=\"Response\">\n <template #title>\n <div class=\"flex h-8 flex-1 items-center\">\n <div\n aria-live=\"polite\"\n class=\"flex items-center\"\n :class=\"{ 'animate-response-heading': response }\">\n <span class=\"response-heading pointer-events-none absolute\">\n Response\n </span>\n <ResponseMetaInformation\n v-if=\"response\"\n class=\"animate-response-children\"\n :eventBus=\"eventBus\"\n :response=\"response\" />\n </div>\n <SectionFilter\n v-model=\"activeFilter\"\n :filterIds=\"filterIds\"\n :filters=\"filters\" />\n </div>\n </template>\n <div\n :id=\"filterIds.All\"\n class=\"custom-scroll response-section-content relative grid h-full justify-stretch\"\n :class=\"{\n 'content-start': response,\n }\"\n :role=\"activeFilter === 'All' && response ? 'tabpanel' : 'none'\">\n <template v-if=\"!response\">\n <ResponseEmpty\n :appVersion=\"appVersion\"\n :layout=\"layout\"\n :totalPerformedRequests=\"totalPerformedRequests\"\n @addRequest=\"\n eventBus.emit('ui:open:command-palette', {\n action: 'create-request',\n payload: undefined,\n })\n \"\n @openCommandPalette=\"eventBus.emit('ui:open:command-palette')\"\n @sendRequest=\"eventBus.emit('operation:send:request:hotkey')\" />\n </template>\n <template v-else>\n <!-- Cookies section -->\n <ResponseCookies\n v-if=\"isSectionVisible('Cookies')\"\n :id=\"filterIds.Cookies\"\n class=\"response-section-content-cookies\"\n :cookies=\"responseCookies\"\n :role=\"activeFilter === 'All' ? 'none' : 'tabpanel'\" />\n <!-- Request headers section -->\n <HeadersComponent\n v-if=\"isSectionVisible('Headers')\"\n :id=\"filterIds.Headers\"\n class=\"response-section-content-headers\"\n :headers=\"requestHeaders\"\n :role=\"activeFilter === 'All' ? 'none' : 'tabpanel'\">\n <template #title>Request Headers</template>\n </HeadersComponent>\n <!-- Response headers section -->\n <HeadersComponent\n v-if=\"isSectionVisible('Headers')\"\n :id=\"filterIds.Headers\"\n class=\"response-section-content-headers\"\n :headers=\"responseHeaders\"\n :role=\"activeFilter === 'All' ? 'none' : 'tabpanel'\">\n <template #title>Response Headers</template>\n </HeadersComponent>\n\n <!-- Inject response section plugin components -->\n <ScalarErrorBoundary\n v-for=\"(plugin, index) in plugins\"\n :key=\"index\">\n <component\n :is=\"plugin.components.response.component\"\n v-if=\"plugin?.components?.response\"\n v-show=\"activeFilter === 'All'\"\n v-bind=\"plugin.components.response.additionalProps\" />\n </ScalarErrorBoundary>\n\n <template v-if=\"activeFilter === 'All' || activeFilter === 'Body'\">\n <!-- Streaming response body -->\n <ResponseBodyStreaming\n v-if=\"'reader' in response\"\n :id=\"filterIds.Body\"\n class=\"response-section-content-body\"\n :reader=\"response.reader\" />\n\n <!-- Virtualized Text for massive responses -->\n <ResponseBodyVirtual\n v-else-if=\"shouldVirtualize && typeof response?.data === 'string'\"\n :id=\"filterIds.Body\"\n :content=\"response!.data\"\n :data=\"response?.data\"\n :headers=\"responseHeaders\"\n :role=\"activeFilter === 'All' ? 'none' : 'tabpanel'\" />\n\n <!-- Regular response body -->\n <ResponseBody\n v-else\n :id=\"filterIds.Body\"\n :active=\"true\"\n class=\"response-section-content-body\"\n :data=\"response?.data\"\n :headers=\"responseHeaders\"\n layout=\"client\"\n :plugins=\"plugins\"\n :role=\"activeFilter === 'All' ? 'none' : 'tabpanel'\"\n title=\"Body\" />\n </template>\n </template>\n <ResponseLoadingOverlay :eventBus=\"eventBus\" />\n </div>\n </ViewLayoutSection>\n</template>\n<style scoped>\n.animate-response-heading .response-heading {\n animation: push-response 0.2s ease-in-out forwards;\n opacity: 1;\n}\n@keyframes push-response {\n from {\n opacity: 1;\n transform: translateY(0);\n }\n to {\n opacity: 0;\n transform: translateY(-4px);\n }\n}\n.animate-response-heading .animate-response-children {\n animation: response-spans 0.2s ease-in-out forwards 0.05s;\n opacity: 0;\n}\n\n@keyframes response-spans {\n from {\n opacity: 0;\n transform: translateY(4px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;AA2EA,IAAM,2BAA2B;;;;;;;;;;;;;EAjCjC,MAAM,kBAAkB,eAAe;GACrC,MAAM,UAAU,QAAA,UAAU;AAE1B,UAAO,UACH,OAAO,KAAK,QAAQ,CAAC,KAAK,SAAS;IACjC,MAAM;IACN,OAAO,QAAQ,QAAQ;IACxB,EAAC,GACF,EAAC;IACN;EAGD,MAAM,kBAAkB,eAEpB,QAAA,UAAU,iBACP,KAAK,mBAAmB,eAAe,eAAe,CAAA,CACtD,OAAO,UAAU,IAAI,EAAE,CAC9B;EAEA,MAAM,mBAAmB;GAAC;GAAW;GAAW;GAAO;EAEvD,MAAM,eAAe,IAAY,MAAK;EAEtC,MAAM,UAAU,eAAyB,CAAC,OAAO,GAAG,iBAAiB,CAAA;EAErE,MAAM,YAAY,eAEd,OAAO,YACL,QAAQ,MAAM,KAAK,YAAY,CAAC,SAAS,OAAO,CAAC,CAAC,CACnD,CACL;;EAIA,MAAM,mBAAmB,eAAe;AACtC,OAAI,CAAC,QAAA,YAAY,EAAE,UAAU,QAAA,UAC3B,QAAO;GAIT,MAAM,cACJ,QAAA,SAAS,UAAU,mBAAmB,QAAA,SAAS,UAAU;AAG3D,OAAI,CAAC,gBAAgB,QAAA,SAAS,QAAQ,MAAM,yBAC1C,QAAO;AAIT,OAAI,YAAY,SAAS,YAAY,CACnC,QAAO;AAMT,UAFoB,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R,aAAA,UAAY,SAAc,aAAA,UAAY,UAAA,WAAA,EAAtD,mBA6BW,UAAA,EAAA,KAAA,GAAA,EAAA,CAAA,YA1BW,QAAA,YAAA,WAAA,EADpB,YAI8B,+BAAA;;MAF3B,IAAI,UAAA,MAAU;MACf,OAAM;MACL,QAAQ,QAAA,SAAS;sCAIP,iBAAA,SAAgB,OAAW,QAAA,UAAU,SAAI,YAAA,WAAA,EADtD,YAMyD,6BAAA;;MAJtD,IAAI,UAAA,MAAU;MACd,SAAS,QAAA,SAAU;MACnB,MAAM,QAAA,UAAU;MAChB,SAAS,gBAAA;MACT,MAAM,aAAA,UAAY,QAAA,SAAA;;;;;;;yBAGrB,YAUiB,sBAAA;;MARd,IAAI,UAAA,MAAU;MACd,QAAQ;MACT,OAAM;MACL,MAAM,QAAA,UAAU;MAChB,SAAS,gBAAA;MACV,QAAO;MACN,SAAS,QAAA;MACT,MAAM,aAAA,UAAY,QAAA,SAAA;MACnB,OAAM;;;;;;;;aAGZ,YAA+C,gCAAA,EAAtB,UAAU,QAAA,UAAQ,EAAA,MAAA,GAAA,CAAA,WAAA,CAAA,CAAA,EAAA,IAAA,WAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"ResponseBlock.vue.script.js","names":[],"sources":["../../../../src/v2/blocks/response-block/ResponseBlock.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarErrorBoundary } from '@scalar/components/error-boundary'\nimport { isDefined } from '@scalar/helpers/array/is-defined'\nimport type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type { RequestPayload } from '@scalar/workspace-store/request-example'\nimport { computed, ref, useId } from 'vue'\n\nimport SectionFilter from '@/components/SectionFilter.vue'\nimport ViewLayoutSection from '@/components/ViewLayout/ViewLayoutSection.vue'\nimport type { ResponseInstance } from '@/v2/blocks/operation-block/helpers/send-request'\nimport HeadersComponent from '@/v2/blocks/response-block/components/Headers.vue'\nimport ResponseBody from '@/v2/blocks/response-block/components/ResponseBody.vue'\nimport ResponseBodyStreaming from '@/v2/blocks/response-block/components/ResponseBodyStreaming.vue'\nimport ResponseBodyVirtual from '@/v2/blocks/response-block/components/ResponseBodyVirtual.vue'\nimport ResponseCookies from '@/v2/blocks/response-block/components/ResponseCookies.vue'\nimport ResponseEmpty from '@/v2/blocks/response-block/components/ResponseEmpty.vue'\nimport ResponseLoadingOverlay from '@/v2/blocks/response-block/components/ResponseLoadingOverlay.vue'\nimport ResponseMetaInformation from '@/v2/blocks/response-block/components/ResponseMetaInformation.vue'\nimport { textMediaTypes } from '@/v2/blocks/response-block/helpers/media-types'\nimport { parseSetCookie } from '@/v2/blocks/response-block/helpers/parse-set-cookie'\nimport type { ClientLayout } from '@/v2/types/layout'\n\nconst { layout, totalPerformedRequests, response, requestPayload } =\n defineProps<{\n /** Preprocessed response */\n response: ResponseInstance | null\n /** Original request as a [url, RequestInit] tuple */\n requestPayload: RequestPayload | null\n /** Client layout */\n layout: ClientLayout\n /** Total number of performed requests */\n totalPerformedRequests: number\n /** Application version */\n appVersion: string\n /** Registered app plugins */\n plugins: ClientPlugin[]\n /** Workspace event bus */\n eventBus: WorkspaceEventBus\n }>()\n\n// Headers\nconst responseHeaders = computed(() => {\n const headers = response?.headers\n\n return headers\n ? Object.keys(headers).map((key) => ({\n name: key,\n value: headers[key] ?? '',\n }))\n : []\n})\n\n// Cookies\nconst responseCookies = computed(\n () =>\n response?.cookieHeaderKeys\n .map((setCookieValue) => parseSetCookie(setCookieValue))\n .filter(isDefined) ?? [],\n)\n\nconst responseSections = ['Cookies', 'Headers', 'Body'] as const\ntype Filter = 'All' | (typeof responseSections)[number]\nconst activeFilter = ref<Filter>('All')\n\nconst filters = computed<Filter[]>(() => ['All', ...responseSections])\n\nconst filterIds = computed(\n () =>\n Object.fromEntries(\n filters.value.map((section) => [section, useId()]),\n ) as Record<Filter, string>,\n)\n\n/** Threshold for virtualizing response bodies in bytes */\nconst VIRTUALIZATION_THRESHOLD = 200_000\nconst shouldVirtualize = computed(() => {\n if (!response || !('size' in response)) {\n return false\n }\n\n // Get content type from headers\n const contentType =\n response.headers?.['content-type'] || response.headers?.['Content-Type']\n\n // If no content type or response size is small, don't virtualize\n if (!contentType || (response.size ?? 0) <= VIRTUALIZATION_THRESHOLD) {\n return false\n }\n\n // Do not virtualize html\n if (contentType.includes('text/html')) {\n return false\n }\n\n // Check if content type matches any text-based type\n const isTextBased = textMediaTypes.some((type) => contentType.includes(type))\n\n return isTextBased && (response.size ?? 0) > VIRTUALIZATION_THRESHOLD\n})\n\nconst requestHeaders = computed(() => {\n const headers = requestPayload?.[1]?.headers\n if (!headers) {\n return []\n }\n\n // Normalise via the Headers constructor, and then spread\n return [...new Headers(headers)].map(([name, value]) => ({\n name,\n value,\n required: false,\n }))\n})\n\nconst isSectionVisible = (\n section: (typeof responseSections)[number] | 'All',\n) => {\n if (activeFilter.value === 'All' || activeFilter.value === section) {\n return true\n }\n return false\n}\n\ndefineExpose({\n responseHeaders,\n responseCookies,\n requestHeaders,\n shouldVirtualize,\n activeFilter,\n filters,\n})\n</script>\n<template>\n <ViewLayoutSection aria-label=\"Response\">\n <template #title>\n <div class=\"flex h-8 flex-1 items-center\">\n <div\n aria-live=\"polite\"\n class=\"flex items-center\"\n :class=\"{ 'animate-response-heading': response }\">\n <span class=\"response-heading pointer-events-none absolute\">\n Response\n </span>\n <ResponseMetaInformation\n v-if=\"response\"\n class=\"animate-response-children\"\n :eventBus=\"eventBus\"\n :response=\"response\" />\n </div>\n <SectionFilter\n v-model=\"activeFilter\"\n :filterIds=\"filterIds\"\n :filters=\"filters\" />\n </div>\n </template>\n <div\n :id=\"filterIds.All\"\n class=\"custom-scroll response-section-content relative grid h-full justify-stretch\"\n :class=\"{\n 'content-start': response,\n }\"\n :role=\"activeFilter === 'All' && response ? 'tabpanel' : 'none'\">\n <template v-if=\"!response\">\n <ResponseEmpty\n :appVersion=\"appVersion\"\n :layout=\"layout\"\n :totalPerformedRequests=\"totalPerformedRequests\"\n @addRequest=\"\n eventBus.emit('ui:open:command-palette', {\n action: 'create-request',\n payload: undefined,\n })\n \"\n @openCommandPalette=\"eventBus.emit('ui:open:command-palette')\"\n @sendRequest=\"eventBus.emit('operation:send:request:hotkey')\" />\n </template>\n <template v-else>\n <!-- Cookies section -->\n <ResponseCookies\n v-if=\"isSectionVisible('Cookies')\"\n :id=\"filterIds.Cookies\"\n class=\"response-section-content-cookies\"\n :cookies=\"responseCookies\"\n :role=\"activeFilter === 'All' ? 'none' : 'tabpanel'\" />\n <!-- Request headers section -->\n <HeadersComponent\n v-if=\"isSectionVisible('Headers')\"\n :id=\"filterIds.Headers\"\n class=\"response-section-content-headers\"\n :headers=\"requestHeaders\"\n :role=\"activeFilter === 'All' ? 'none' : 'tabpanel'\">\n <template #title>Request Headers</template>\n </HeadersComponent>\n <!-- Response headers section -->\n <HeadersComponent\n v-if=\"isSectionVisible('Headers')\"\n :id=\"filterIds.Headers\"\n class=\"response-section-content-headers\"\n :headers=\"responseHeaders\"\n :role=\"activeFilter === 'All' ? 'none' : 'tabpanel'\">\n <template #title>Response Headers</template>\n </HeadersComponent>\n\n <!-- Inject response section plugin components -->\n <ScalarErrorBoundary\n v-for=\"(plugin, index) in plugins\"\n :key=\"index\">\n <component\n :is=\"plugin.components.response.component\"\n v-if=\"plugin?.components?.response\"\n v-show=\"activeFilter === 'All'\"\n v-bind=\"plugin.components.response.additionalProps\" />\n </ScalarErrorBoundary>\n\n <template v-if=\"activeFilter === 'All' || activeFilter === 'Body'\">\n <!-- Streaming response body -->\n <ResponseBodyStreaming\n v-if=\"'reader' in response\"\n :id=\"filterIds.Body\"\n class=\"response-section-content-body\"\n :reader=\"response.reader\" />\n\n <!-- Virtualized Text for massive responses -->\n <ResponseBodyVirtual\n v-else-if=\"shouldVirtualize && typeof response?.data === 'string'\"\n :id=\"filterIds.Body\"\n :content=\"response!.data\"\n :data=\"response?.data\"\n :headers=\"responseHeaders\"\n :role=\"activeFilter === 'All' ? 'none' : 'tabpanel'\" />\n\n <!-- Regular response body -->\n <ResponseBody\n v-else\n :id=\"filterIds.Body\"\n :active=\"true\"\n class=\"response-section-content-body\"\n :data=\"response?.data\"\n :headers=\"responseHeaders\"\n layout=\"client\"\n :plugins=\"plugins\"\n :role=\"activeFilter === 'All' ? 'none' : 'tabpanel'\"\n title=\"Body\" />\n </template>\n </template>\n <ResponseLoadingOverlay :eventBus=\"eventBus\" />\n </div>\n </ViewLayoutSection>\n</template>\n<style scoped>\n.animate-response-heading .response-heading {\n animation: push-response 0.2s ease-in-out forwards;\n opacity: 1;\n}\n@keyframes push-response {\n from {\n opacity: 1;\n transform: translateY(0);\n }\n to {\n opacity: 0;\n transform: translateY(-4px);\n }\n}\n.animate-response-heading .animate-response-children {\n animation: response-spans 0.2s ease-in-out forwards 0.05s;\n opacity: 0;\n}\n\n@keyframes response-spans {\n from {\n opacity: 0;\n transform: translateY(4px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;AA2EA,IAAM,2BAA2B;;;;;;;;;;;;;EAjCjC,MAAM,kBAAkB,eAAe;GACrC,MAAM,UAAU,QAAA,UAAU;GAE1B,OAAO,UACH,OAAO,KAAK,OAAO,CAAC,CAAC,KAAK,SAAS;IACjC,MAAM;IACN,OAAO,QAAQ,QAAQ;GACzB,EAAE,IACF,CAAC;EACP,CAAC;EAGD,MAAM,kBAAkB,eAEpB,QAAA,UAAU,iBACP,KAAK,mBAAmB,eAAe,cAAc,CAAC,CAAA,CACtD,OAAO,SAAS,KAAK,CAAC,CAC7B;EAEA,MAAM,mBAAmB;GAAC;GAAW;GAAW;EAAM;EAEtD,MAAM,eAAe,IAAY,KAAK;EAEtC,MAAM,UAAU,eAAyB,CAAC,OAAO,GAAG,gBAAgB,CAAC;EAErE,MAAM,YAAY,eAEd,OAAO,YACL,QAAQ,MAAM,KAAK,YAAY,CAAC,SAAS,MAAM,CAAC,CAAC,CACnD,CACJ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,MAAA,mBAAA,GAAA,EANnB,KAAK,MAAK,GAAA;8BAK6C,CAFhD,QAAQ,YAAY,WAAA,gBAAA,UAAA,GAF5B,YAIwD,wBAHjD,OAAO,WAAW,SAAS,SAAS,GAD3C,WAIwD;;;UAA9C,OAAO,WAAW,SAAS,eAAe,GAAA,MAAA,EAAA,IAAA,CAAA,CAAA,OAD1C,aAAA,UAAY,KAAA,CAAA,CAAA,IAAA,mBAAA,IAAA,IAAA,CAAA,CAAA;;;;KAIR,aAAA,UAAY,SAAc,aAAA,UAAY,UAAA,UAAA,GAAtD,mBA6BW,UAAA,EAAA,KAAA,EAAA,GAAA,CAAA,YA1BW,QAAA,YAAA,UAAA,GADpB,YAI8B,+BAAA;;MAF3B,IAAI,UAAA,MAAU;MACf,OAAM;MACL,QAAQ,QAAA,SAAS;sCAIP,iBAAA,SAAgB,OAAW,QAAA,UAAU,SAAI,YAAA,UAAA,GADtD,YAMyD,6BAAA;;MAJtD,IAAI,UAAA,MAAU;MACd,SAAS,QAAA,SAAU;MACnB,MAAM,QAAA,UAAU;MAChB,SAAS,gBAAA;MACT,MAAM,aAAA,UAAY,QAAA,SAAA;;;;;;;yBAGrB,YAUiB,sBAAA;;MARd,IAAI,UAAA,MAAU;MACd,QAAQ;MACT,OAAM;MACL,MAAM,QAAA,UAAU;MAChB,SAAS,gBAAA;MACV,QAAO;MACN,SAAS,QAAA;MACT,MAAM,aAAA,UAAY,QAAA,SAAA;MACnB,OAAM;;;;;;;;aAGZ,YAA+C,gCAAA,EAAtB,UAAU,QAAA,SAAQ,GAAA,MAAA,GAAA,CAAA,UAAA,CAAA,CAAA,GAAA,IAAA,UAAA,CAAA,CAAA"}
@@ -15,7 +15,7 @@ var _hoisted_2 = {
15
15
  key: 1,
16
16
  class: "text-c-3 bg-b-1 flex min-h-[64px] items-center justify-center border-t px-4 text-sm"
17
17
  };
18
- var Headers_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
18
+ var Headers_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
19
19
  __name: "Headers",
20
20
  props: { headers: {} },
21
21
  setup(__props) {
@@ -1 +1 @@
1
- {"version":3,"file":"Headers.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/response-block/components/Headers.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { httpHeaders, type HttpHeader } from '@scalar/helpers/http/http-headers'\nimport {\n DataTable,\n DataTableHeader,\n DataTableRow,\n DataTableText,\n} from '@v2/components/data-table'\n\nimport HelpfulLink from '@/components/HelpfulLink.vue'\nimport { CollapsibleSection } from '@/v2/components/layout'\n\ntype Header = { name: string; value: string }\n\ndefineProps<{\n headers: Header[]\n}>()\n\nconst findHeaderInfo = (name: string): HttpHeader | undefined =>\n httpHeaders[name.toLowerCase() as keyof typeof httpHeaders]\n</script>\n<template>\n <CollapsibleSection\n class=\"overflow-auto\"\n :defaultOpen=\"false\"\n :itemCount=\"headers.length\">\n <template #title><slot name=\"title\" /></template>\n <div\n v-if=\"headers.length\"\n class=\"max-h-[calc(100%-32px)] overflow-y-auto\">\n <DataTable\n :columns=\"['minmax(auto, min-content)', 'minmax(50%, 1fr)']\"\n scroll>\n <DataTableRow class=\"sr-only !block\">\n <DataTableHeader>Header Key</DataTableHeader>\n <DataTableHeader>Header Value</DataTableHeader>\n </DataTableRow>\n <DataTableRow\n v-for=\"item in headers\"\n :key=\"item.name\"\n class=\"group/row text-c-1\">\n <DataTableText\n class=\"bg-b-1 sticky left-0 z-1 max-w-full group-first/row:border-t-0\">\n <template v-if=\"typeof findHeaderInfo(item.name)?.url === 'string'\">\n <HelpfulLink\n class=\"decoration-c-3\"\n :href=\"findHeaderInfo(item.name)!.url\">\n {{ item.name }}\n </HelpfulLink>\n </template>\n <template v-else>\n {{ item.name }}\n </template>\n </DataTableText>\n <DataTableText\n class=\"z-0 group-first/row:border-t-0\"\n :text=\"item.value\" />\n </DataTableRow>\n </DataTable>\n </div>\n <!-- Empty state -->\n <div\n v-else\n class=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A,CAAA,gBAAA,gBADN,KAAK,KAAI,EAAA,EAAA,CAAA,EAAA,GAAA,EAAA,CAAA;;iBAGhB,YAEuB,MAAA,sBAAA,EAAA;QADrB,OAAM;QACL,MAAM,KAAK;;;;;;0BAKpB,mBAIM,OAJN,YAE8F,eAE9F,EAAA,CAAA"}
1
+ {"version":3,"file":"Headers.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/response-block/components/Headers.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { httpHeaders, type HttpHeader } from '@scalar/helpers/http/http-headers'\nimport {\n DataTable,\n DataTableHeader,\n DataTableRow,\n DataTableText,\n} from '@v2/components/data-table'\n\nimport HelpfulLink from '@/components/HelpfulLink.vue'\nimport { CollapsibleSection } from '@/v2/components/layout'\n\ntype Header = { name: string; value: string }\n\ndefineProps<{\n headers: Header[]\n}>()\n\nconst findHeaderInfo = (name: string): HttpHeader | undefined =>\n httpHeaders[name.toLowerCase() as keyof typeof httpHeaders]\n</script>\n<template>\n <CollapsibleSection\n class=\"overflow-auto\"\n :defaultOpen=\"false\"\n :itemCount=\"headers.length\">\n <template #title><slot name=\"title\" /></template>\n <div\n v-if=\"headers.length\"\n class=\"max-h-[calc(100%-32px)] overflow-y-auto\">\n <DataTable\n :columns=\"['minmax(auto, min-content)', 'minmax(50%, 1fr)']\"\n scroll>\n <DataTableRow class=\"sr-only !block\">\n <DataTableHeader>Header Key</DataTableHeader>\n <DataTableHeader>Header Value</DataTableHeader>\n </DataTableRow>\n <DataTableRow\n v-for=\"item in headers\"\n :key=\"item.name\"\n class=\"group/row text-c-1\">\n <DataTableText\n class=\"bg-b-1 sticky left-0 z-1 max-w-full group-first/row:border-t-0\">\n <template v-if=\"typeof findHeaderInfo(item.name)?.url === 'string'\">\n <HelpfulLink\n class=\"decoration-c-3\"\n :href=\"findHeaderInfo(item.name)!.url\">\n {{ item.name }}\n </HelpfulLink>\n </template>\n <template v-else>\n {{ item.name }}\n </template>\n </DataTableText>\n <DataTableText\n class=\"z-0 group-first/row:border-t-0\"\n :text=\"item.value\" />\n </DataTableRow>\n </DataTable>\n </div>\n <!-- Empty state -->\n <div\n v-else\n class=\"text-c-3 bg-b-1 flex min-h-[64px] items-center justify-center border-t px-4 text-sm\">\n No headers\n </div>\n </CollapsibleSection>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;EAkBA,MAAM,kBAAkB,SACtB,YAAY,KAAK,YAAY;;uBAG7B,YA4CqB,MAAA,0BAAA,GAAA;IA3CnB,OAAM;IACL,aAAa;IACb,WAAW,QAAA,QAAQ;;IACT,OAAK,cAAsB,CAArB,WAAqB,KAAA,QAAA,OAAA,CAAA,CAAA;2BAiChC,CA/BE,QAAA,QAAQ,UAAA,UAAA,GADhB,mBAgCM,OAhCN,YAgCM,CA7BJ,YA4BY,MAAA,iBAAA,GAAA;KA3BT,SAAS,CAAA,6BAAA,kBAAA;KACV,QAAA;;4BAIe,CAHf,YAGe,MAAA,oBAAA,GAAA,EAHD,OAAM,iBAAgB,GAAA;6BACW,CAA7C,YAA6C,MAAA,uBAAA,GAAA,MAAA;8BAAlB,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CAAA,gBAAV,cAAU,EAAA,CAAA,EAAA,CAAA;;UAC3B,YAA+C,MAAA,uBAAA,GAAA,MAAA;8BAAlB,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CAAA,gBAAZ,gBAAY,EAAA,CAAA,EAAA,CAAA;;;;2BAE/B,mBAoBe,UAAA,MAAA,WAnBE,QAAA,UAAR,SAAI;0BADb,YAoBe,MAAA,oBAAA,GAAA;OAlBZ,KAAK,KAAK;OACX,OAAM;;8BAaU,CAZhB,YAYgB,MAAA,qBAAA,GAAA,EAXd,OAAM,iEAAgE,GAAA;+BAO3D,CAAA,OANY,eAAe,KAAK,IAAI,CAAA,EAAG,QAAG,YAAA,UAAA,GACnD,YAIc,qBAAA;;SAHZ,OAAM;SACL,MAAM,eAAe,KAAK,IAAI,CAAA,CAAG;;gCACnB,CAAA,gBAAA,gBAAZ,KAAK,IAAI,GAAA,CAAA,CAAA,CAAA;;4CAGhB,mBAEW,UAAA,EAAA,KAAA,EAAA,GAAA,CAAA,gBAAA,gBADN,KAAK,IAAI,GAAA,CAAA,CAAA,GAAA,EAAA,EAAA,CAAA;;iBAGhB,YAEuB,MAAA,qBAAA,GAAA;QADrB,OAAM;QACL,MAAM,KAAK;;;;;;0BAKpB,mBAIM,OAJN,YAE8F,cAE9F,EAAA,CAAA"}
@@ -2,7 +2,7 @@ import _plugin_vue_export_helper_default from "../../../../_virtual/_plugin-vue_
2
2
  import ResponseBody_vue_vue_type_script_setup_true_lang_default from "./ResponseBody.vue.script.js";
3
3
  /* empty css */
4
4
  //#region src/v2/blocks/response-block/components/ResponseBody.vue
5
- var ResponseBody_default = /* @__PURE__ */ _plugin_vue_export_helper_default(ResponseBody_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-bb31ac6f"]]);
5
+ var ResponseBody_default = /*#__PURE__*/ _plugin_vue_export_helper_default(ResponseBody_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-bb31ac6f"]]);
6
6
  //#endregion
7
7
  export { ResponseBody_default as default };
8
8
 
@@ -15,7 +15,7 @@ var _hoisted_1 = {
15
15
  };
16
16
  var _hoisted_2 = { class: "box-content flex min-h-8 items-center justify-between border-y px-3" };
17
17
  var _hoisted_3 = { class: "text-xxs font-code leading-5" };
18
- var ResponseBody_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
18
+ var ResponseBody_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
19
19
  __name: "ResponseBody",
20
20
  props: {
21
21
  title: {},
@@ -1 +1 @@
1
- {"version":3,"file":"ResponseBody.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/response-block/components/ResponseBody.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport type { CodeMirrorLanguage } from '@scalar/use-codemirror'\nimport { computed, ref } from 'vue'\n\nimport { getMediaTypeConfig } from '@/v2/blocks/response-block/helpers/media-types'\nimport { processResponseBody } from '@/v2/blocks/response-block/helpers/process-response-body'\nimport { resolveResponseBodyHandler } from '@/v2/blocks/response-block/helpers/resolve-response-body-handler'\nimport { CollapsibleSection } from '@/v2/components/layout'\n\nimport ResponseBodyDownload from './ResponseBodyDownload.vue'\nimport ResponseBodyInfo from './ResponseBodyInfo.vue'\nimport ResponseBodyPreview from './ResponseBodyPreview.vue'\nimport ResponseBodyRaw from './ResponseBodyRaw.vue'\nimport ResponseBodyToggle from './ResponseBodyToggle.vue'\n\nconst {\n data,\n headers,\n plugins = [],\n} = defineProps<{\n title: string\n layout: 'client' | 'reference'\n data: unknown\n headers: { name: string; value: string }[]\n plugins?: ClientPlugin[]\n}>()\n\n/** Preview / Raw toggle */\nconst toggle = ref(true)\n\nconst responseBody = computed(() =>\n processResponseBody({\n data,\n headers,\n }),\n)\n\nconst mimeEssence = computed(() => responseBody.value.mimeType.essence)\n\nconst mediaConfig = computed(() => getMediaTypeConfig(mimeEssence.value))\n\nconst pluginHandler = computed(() =>\n resolveResponseBodyHandler(mimeEssence.value, plugins),\n)\n\nconst hasRaw = computed(\n () =>\n !!pluginHandler.value?.rawComponent ||\n !!pluginHandler.value?.decode ||\n !!mediaConfig.value?.raw,\n)\n\nconst hasPreview = computed(\n () => !!pluginHandler.value?.previewComponent || !!mediaConfig.value?.preview,\n)\n\nconst showToggle = computed(() => hasRaw.value && hasPreview.value)\n\nconst showPreview = computed(() => toggle.value || !showToggle.value)\nconst showRaw = computed(() => !toggle.value || !showToggle.value)\n\nconst rawLanguage = computed(\n () => pluginHandler.value?.language ?? mediaConfig.value?.language,\n)\n</script>\n<template>\n <CollapsibleSection\n class=\"max-h-content overflow-y-hidden\"\n :isStatic=\"layout === 'reference'\">\n <template #title>{{ title }}</template>\n <template\n v-if=\"data && responseBody.dataUrl\"\n #actions>\n <ResponseBodyDownload\n :filename=\"responseBody.attachmentFilename\"\n :href=\"responseBody.dataUrl\"\n :type=\"responseBody.mimeType?.essence\" />\n </template>\n <div\n v-if=\"data\"\n class=\"bg-b-1 flex max-h-[calc(100%-32px)] flex-col overflow-hidden\">\n <div\n class=\"box-content flex min-h-8 items-center justify-between border-y px-3\">\n <span class=\"text-xxs font-code leading-5\">\n {{ mimeEssence }}\n </span>\n <ResponseBodyToggle\n v-if=\"showToggle\"\n v-model=\"toggle\" />\n </div>\n\n <!-- Plugin custom preview component -->\n <component\n :is=\"pluginHandler.previewComponent\"\n v-if=\"pluginHandler?.previewComponent && hasPreview && showPreview\"\n :key=\"`plugin-preview-${responseBody.dataUrl}`\"\n :content=\"data\"\n :contentType=\"mimeEssence\"\n :dataUrl=\"responseBody.dataUrl\" />\n <!-- Default preview renderer (JSON, image, video, HTML object, …) -->\n <ResponseBodyPreview\n v-else-if=\"mediaConfig?.preview && showPreview\"\n :key=\"`preview-${responseBody.dataUrl}`\"\n :alpha=\"mediaConfig.alpha\"\n :content=\"data\"\n :mode=\"mediaConfig.preview\"\n :src=\"responseBody.dataUrl\"\n :type=\"mimeEssence\" />\n\n <!-- Plugin custom raw component -->\n <component\n :is=\"pluginHandler.rawComponent\"\n v-if=\"pluginHandler?.rawComponent && hasRaw && showRaw\"\n :key=\"`plugin-raw-${responseBody.dataUrl}`\"\n :content=\"data\"\n :contentType=\"mimeEssence\" />\n <!-- Default raw: exact decoded body (no JSON pretty-print) -->\n <ResponseBodyRaw\n v-else-if=\"hasRaw && showRaw && !pluginHandler?.rawComponent\"\n :key=\"`raw-${responseBody.dataUrl}`\"\n :content=\"data\"\n :language=\"rawLanguage as CodeMirrorLanguage\" />\n\n <ResponseBodyInfo v-if=\"!hasRaw && !hasPreview\">\n Binary file\n </ResponseBodyInfo>\n </div>\n </CollapsibleSection>\n</template>\n<style scoped>\n.scalar-code-block :deep(.hljs *) {\n font-size: var(--scalar-small);\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;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QAAA;MACT,aAAa,YAAA;MACb,SAAS,aAAA,MAAa;;;;;WAGZ,YAAA,OAAa,WAAW,YAAA,SAAA,WAAA,EADrC,YAOwB,6BAAA;MALrB,KAAG,WAAa,aAAA,MAAa;MAC7B,OAAO,YAAA,MAAY;MACnB,SAAS,QAAA;MACT,MAAM,YAAA,MAAY;MAClB,KAAK,aAAA,MAAa;MAClB,MAAM,YAAA;;;;;;;;KAKD,cAAA,OAAe,gBAAgB,OAAA,SAAU,QAAA,SAAA,WAAA,EAFjD,YAK+B,wBAJxB,cAAA,MAAc,aAAY,EAAA;MAE9B,KAAG,cAAgB,aAAA,MAAa;MAChC,SAAS,QAAA;MACT,aAAa,YAAA;gDAGH,OAAA,SAAU,QAAA,SAAO,CAAK,cAAA,OAAe,gBAAA,WAAA,EADlD,YAIkD,yBAAA;MAF/C,KAAG,OAAS,aAAA,MAAa;MACzB,SAAS,QAAA;MACT,UAAU,YAAA;;MAEY,OAAA,SAAM,CAAK,WAAA,SAAA,WAAA,EAApC,YAEmB,0BAAA,EAAA,KAAA,GAAA,EAAA;6BAAnB,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CAAA,gBAFgD,iBAEhD,GAAA,CAAA,EAAA,CAAA;;;;;OAtDM,QAAA,QAAQ,aAAA,MAAa,UAAA;UAC1B;sBAI0C,CAH3C,YAG2C,8BAAA;KAFxC,UAAU,aAAA,MAAa;KACvB,MAAM,aAAA,MAAa;KACnB,MAAM,aAAA,MAAa,UAAU"}
1
+ {"version":3,"file":"ResponseBody.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/response-block/components/ResponseBody.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport type { CodeMirrorLanguage } from '@scalar/use-codemirror'\nimport { computed, ref } from 'vue'\n\nimport { getMediaTypeConfig } from '@/v2/blocks/response-block/helpers/media-types'\nimport { processResponseBody } from '@/v2/blocks/response-block/helpers/process-response-body'\nimport { resolveResponseBodyHandler } from '@/v2/blocks/response-block/helpers/resolve-response-body-handler'\nimport { CollapsibleSection } from '@/v2/components/layout'\n\nimport ResponseBodyDownload from './ResponseBodyDownload.vue'\nimport ResponseBodyInfo from './ResponseBodyInfo.vue'\nimport ResponseBodyPreview from './ResponseBodyPreview.vue'\nimport ResponseBodyRaw from './ResponseBodyRaw.vue'\nimport ResponseBodyToggle from './ResponseBodyToggle.vue'\n\nconst {\n data,\n headers,\n plugins = [],\n} = defineProps<{\n title: string\n layout: 'client' | 'reference'\n data: unknown\n headers: { name: string; value: string }[]\n plugins?: ClientPlugin[]\n}>()\n\n/** Preview / Raw toggle */\nconst toggle = ref(true)\n\nconst responseBody = computed(() =>\n processResponseBody({\n data,\n headers,\n }),\n)\n\nconst mimeEssence = computed(() => responseBody.value.mimeType.essence)\n\nconst mediaConfig = computed(() => getMediaTypeConfig(mimeEssence.value))\n\nconst pluginHandler = computed(() =>\n resolveResponseBodyHandler(mimeEssence.value, plugins),\n)\n\nconst hasRaw = computed(\n () =>\n !!pluginHandler.value?.rawComponent ||\n !!pluginHandler.value?.decode ||\n !!mediaConfig.value?.raw,\n)\n\nconst hasPreview = computed(\n () => !!pluginHandler.value?.previewComponent || !!mediaConfig.value?.preview,\n)\n\nconst showToggle = computed(() => hasRaw.value && hasPreview.value)\n\nconst showPreview = computed(() => toggle.value || !showToggle.value)\nconst showRaw = computed(() => !toggle.value || !showToggle.value)\n\nconst rawLanguage = computed(\n () => pluginHandler.value?.language ?? mediaConfig.value?.language,\n)\n</script>\n<template>\n <CollapsibleSection\n class=\"max-h-content overflow-y-hidden\"\n :isStatic=\"layout === 'reference'\">\n <template #title>{{ title }}</template>\n <template\n v-if=\"data && responseBody.dataUrl\"\n #actions>\n <ResponseBodyDownload\n :filename=\"responseBody.attachmentFilename\"\n :href=\"responseBody.dataUrl\"\n :type=\"responseBody.mimeType?.essence\" />\n </template>\n <div\n v-if=\"data\"\n class=\"bg-b-1 flex max-h-[calc(100%-32px)] flex-col overflow-hidden\">\n <div\n class=\"box-content flex min-h-8 items-center justify-between border-y px-3\">\n <span class=\"text-xxs font-code leading-5\">\n {{ mimeEssence }}\n </span>\n <ResponseBodyToggle\n v-if=\"showToggle\"\n v-model=\"toggle\" />\n </div>\n\n <!-- Plugin custom preview component -->\n <component\n :is=\"pluginHandler.previewComponent\"\n v-if=\"pluginHandler?.previewComponent && hasPreview && showPreview\"\n :key=\"`plugin-preview-${responseBody.dataUrl}`\"\n :content=\"data\"\n :contentType=\"mimeEssence\"\n :dataUrl=\"responseBody.dataUrl\" />\n <!-- Default preview renderer (JSON, image, video, HTML object, …) -->\n <ResponseBodyPreview\n v-else-if=\"mediaConfig?.preview && showPreview\"\n :key=\"`preview-${responseBody.dataUrl}`\"\n :alpha=\"mediaConfig.alpha\"\n :content=\"data\"\n :mode=\"mediaConfig.preview\"\n :src=\"responseBody.dataUrl\"\n :type=\"mimeEssence\" />\n\n <!-- Plugin custom raw component -->\n <component\n :is=\"pluginHandler.rawComponent\"\n v-if=\"pluginHandler?.rawComponent && hasRaw && showRaw\"\n :key=\"`plugin-raw-${responseBody.dataUrl}`\"\n :content=\"data\"\n :contentType=\"mimeEssence\" />\n <!-- Default raw: exact decoded body (no JSON pretty-print) -->\n <ResponseBodyRaw\n v-else-if=\"hasRaw && showRaw && !pluginHandler?.rawComponent\"\n :key=\"`raw-${responseBody.dataUrl}`\"\n :content=\"data\"\n :language=\"rawLanguage as CodeMirrorLanguage\" />\n\n <ResponseBodyInfo v-if=\"!hasRaw && !hasPreview\">\n Binary file\n </ResponseBodyInfo>\n </div>\n </CollapsibleSection>\n</template>\n<style scoped>\n.scalar-code-block :deep(.hljs *) {\n font-size: var(--scalar-small);\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BA,MAAM,SAAS,IAAI,IAAI;EAEvB,MAAM,eAAe,eACnB,oBAAoB;GAClB,MAAG,QAAA;GACH,SAAM,QAAA;EACR,CAAC,CACH;EAEA,MAA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A,MAAa;MAC7B,OAAO,YAAA,MAAY;MACnB,SAAS,QAAA;MACT,MAAM,YAAA,MAAY;MAClB,KAAK,aAAA,MAAa;MAClB,MAAM,YAAA;;;;;;;;KAKD,cAAA,OAAe,gBAAgB,OAAA,SAAU,QAAA,SAAA,UAAA,GAFjD,YAK+B,wBAJxB,cAAA,MAAc,YAAY,GAAA;MAE9B,KAAG,cAAgB,aAAA,MAAa;MAChC,SAAS,QAAA;MACT,aAAa,YAAA;gDAGH,OAAA,SAAU,QAAA,SAAO,CAAK,cAAA,OAAe,gBAAA,UAAA,GADlD,YAIkD,yBAAA;MAF/C,KAAG,OAAS,aAAA,MAAa;MACzB,SAAS,QAAA;MACT,UAAU,YAAA;;MAEY,OAAA,SAAM,CAAK,WAAA,SAAA,UAAA,GAApC,YAEmB,0BAAA,EAAA,KAAA,EAAA,GAAA;6BAAnB,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CAAA,gBAFgD,iBAEhD,EAAA,CAAA,EAAA,CAAA;;;;;OAtDM,QAAA,QAAQ,aAAA,MAAa,UAAA;UAC1B;sBAI0C,CAH3C,YAG2C,8BAAA;KAFxC,UAAU,aAAA,MAAa;KACvB,MAAM,aAAA,MAAa;KACnB,MAAM,aAAA,MAAa,UAAU"}
@@ -3,7 +3,7 @@ import { computed, createElementBlock, createElementVNode, createVNode, defineCo
3
3
  import { ScalarIcon } from "@scalar/components/icon";
4
4
  //#region src/v2/blocks/response-block/components/ResponseBodyDownload.vue?vue&type=script&setup=true&lang.ts
5
5
  var _hoisted_1 = ["download", "href"];
6
- var ResponseBodyDownload_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
6
+ var ResponseBodyDownload_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
7
7
  __name: "ResponseBodyDownload",
8
8
  props: {
9
9
  href: {},
@@ -1 +1 @@
1
- {"version":3,"file":"ResponseBodyDownload.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/response-block/components/ResponseBodyDownload.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { computed } from 'vue'\n\nimport { getMediaTypeConfig } from '@/v2/blocks/response-block/helpers/media-types'\n\nconst props = defineProps<{\n href: string\n type?: string\n filename?: string\n}>()\n\nconst filenameExtension = computed(() => {\n const extension =\n getMediaTypeConfig(props.type ?? '')?.extension ?? '.unknown'\n return props.filename ? props.filename : `response${extension}`\n})\n</script>\n<template>\n <a\n class=\"text-c-3 text-xxs hover:bg-b-3 flex items-center gap-1 rounded px-1.5 py-0.5 no-underline\"\n :download=\"`${filenameExtension}`\"\n :href=\"href\"\n @click.stop>\n <ScalarIcon\n icon=\"Download\"\n size=\"xs\" />\n <span>\n <span>Download</span>\n <span class=\"sr-only\">Response Body</span>\n </span>\n </a>\n</template>\n"],"mappings":";;;;;;;;;;;;;EAMA,MAAM,QAAQ;EAMd,MAAM,oBAAoB,eAAe;GACvC,MAAM,YACJ,mBAAmB,MAAM,QAAQ,GAAG,EAAE,aAAa;AACrD,UAAO,MAAM,WAAW,MAAM,WAAW,WAAW;IACrD;;uBAGC,mBAYI,KAAA;IAXF,OAAM;IACL,UAAQ,GAAK,kBAAA;IACb,MAAM,QAAA;IACN,SAAK,OAAA,OAAA,OAAA,KAAA,oBAAN,IAAW,CAAA,OAAA,CAAA;OACX,YAEc,MAAA,WAAA,EAAA;IADZ,MAAK;IACL,MAAK;iCACP,mBAGO,QAAA,MAAA,CAFL,mBAAqB,QAAA,MAAf,WAAQ,EACd,mBAA0C,QAAA,EAApC,OAAM,WAAS,EAAC,gBAAa,CAAA,EAAA,GAAA,EAAA,EAAA,GAAA,WAAA"}
1
+ {"version":3,"file":"ResponseBodyDownload.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/response-block/components/ResponseBodyDownload.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { computed } from 'vue'\n\nimport { getMediaTypeConfig } from '@/v2/blocks/response-block/helpers/media-types'\n\nconst props = defineProps<{\n href: string\n type?: string\n filename?: string\n}>()\n\nconst filenameExtension = computed(() => {\n const extension =\n getMediaTypeConfig(props.type ?? '')?.extension ?? '.unknown'\n return props.filename ? props.filename : `response${extension}`\n})\n</script>\n<template>\n <a\n class=\"text-c-3 text-xxs hover:bg-b-3 flex items-center gap-1 rounded px-1.5 py-0.5 no-underline\"\n :download=\"`${filenameExtension}`\"\n :href=\"href\"\n @click.stop>\n <ScalarIcon\n icon=\"Download\"\n size=\"xs\" />\n <span>\n <span>Download</span>\n <span class=\"sr-only\">Response Body</span>\n </span>\n </a>\n</template>\n"],"mappings":";;;;;;;;;;;;;EAMA,MAAM,QAAQ;EAMd,MAAM,oBAAoB,eAAe;GACvC,MAAM,YACJ,mBAAmB,MAAM,QAAQ,EAAE,CAAC,EAAE,aAAa;GACrD,OAAO,MAAM,WAAW,MAAM,WAAW,WAAW;EACtD,CAAC;;uBAGC,mBAYI,KAAA;IAXF,OAAM;IACL,UAAQ,GAAK,kBAAA;IACb,MAAM,QAAA;IACN,SAAK,OAAA,OAAA,OAAA,KAAA,oBAAN,CAAA,GAAW,CAAA,MAAA,CAAA;OACX,YAEc,MAAA,UAAA,GAAA;IADZ,MAAK;IACL,MAAK;iCACP,mBAGO,QAAA,MAAA,CAFL,mBAAqB,QAAA,MAAf,UAAQ,GACd,mBAA0C,QAAA,EAApC,OAAM,UAAS,GAAC,eAAa,CAAA,GAAA,EAAA,EAAA,GAAA,GAAA,UAAA"}
@@ -7,7 +7,7 @@ var _hoisted_2 = { class: "text-c-3 p-2 text-sm" };
7
7
  function _sfc_render(_ctx, _cache) {
8
8
  return openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [renderSlot(_ctx.$slots, "default")])]);
9
9
  }
10
- var ResponseBodyInfo_default = /* @__PURE__ */ _plugin_vue_export_helper_default(_sfc_main, [["render", _sfc_render]]);
10
+ var ResponseBodyInfo_default = /*#__PURE__*/ _plugin_vue_export_helper_default(_sfc_main, [["render", _sfc_render]]);
11
11
  //#endregion
12
12
  export { ResponseBodyInfo_default as default };
13
13
 
@@ -1 +1 @@
1
- {"version":3,"file":"ResponseBodyInfo.vue.js","names":[],"sources":["../../../../../src/v2/blocks/response-block/components/ResponseBodyInfo.vue"],"sourcesContent":["<template>\n <div class=\"flex justify-center px-2 py-3\">\n <div class=\"text-c-3 p-2 text-sm\"><slot /></div>\n </div>\n</template>\n"],"mappings":";;;;mBACO,OAAM,iCAA+B;mBACnC,OAAM,wBAAsB;;qBADnC,mBAEM,OAFN,YAEM,CADJ,mBAAgD,OAAhD,YAAgD,CAAd,WAAQ,KAAA,QAAA,UAAA,CAAA,CAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"ResponseBodyInfo.vue.js","names":[],"sources":["../../../../../src/v2/blocks/response-block/components/ResponseBodyInfo.vue"],"sourcesContent":["<template>\n <div class=\"flex justify-center px-2 py-3\">\n <div class=\"text-c-3 p-2 text-sm\"><slot /></div>\n </div>\n</template>\n"],"mappings":";;;;mBACO,OAAM,gCAA+B;mBACnC,OAAM,uBAAsB;;qBADnC,mBAEM,OAFN,YAEM,CADJ,mBAAgD,OAAhD,YAAgD,CAAd,WAAQ,KAAA,QAAA,SAAA,CAAA,CAAA,CAAA,CAAA"}
@@ -2,7 +2,7 @@ import _plugin_vue_export_helper_default from "../../../../_virtual/_plugin-vue_
2
2
  import ResponseBodyPreview_vue_vue_type_script_setup_true_lang_default from "./ResponseBodyPreview.vue.script.js";
3
3
  /* empty css */
4
4
  //#region src/v2/blocks/response-block/components/ResponseBodyPreview.vue
5
- var ResponseBodyPreview_default = /* @__PURE__ */ _plugin_vue_export_helper_default(ResponseBodyPreview_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-8bc927e4"]]);
5
+ var ResponseBodyPreview_default = /*#__PURE__*/ _plugin_vue_export_helper_default(ResponseBodyPreview_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-8bc927e4"]]);
6
6
  //#endregion
7
7
  export { ResponseBodyPreview_default as default };
8
8
 
@@ -6,7 +6,7 @@ var _hoisted_1 = ["src"];
6
6
  var _hoisted_2 = ["src", "type"];
7
7
  var _hoisted_3 = ["src", "type"];
8
8
  var _hoisted_4 = ["src", "sandbox"];
9
- var ResponseBodyPreview_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
9
+ var ResponseBodyPreview_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
10
10
  __name: "ResponseBodyPreview",
11
11
  props: {
12
12
  src: {},
@@ -1 +1 @@
1
- {"version":3,"file":"ResponseBodyPreview.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/response-block/components/ResponseBodyPreview.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { computed, ref, watch } from 'vue'\n\nimport { type MediaPreview } from '@/v2/blocks/response-block/helpers/media-types'\n\nimport ResponseBodyInfo from './ResponseBodyInfo.vue'\nimport ResponseBodyRaw from './ResponseBodyRaw.vue'\n\nconst {\n src,\n type,\n mode,\n alpha = false,\n content,\n} = defineProps<{\n src: string\n type: string\n mode: MediaPreview\n alpha?: boolean | undefined\n /** Decoded body; used when `mode` is `json` for pretty-printed preview (no JSON.parse round-trip). */\n content?: unknown\n}>()\n\nconst jsonPreviewContent = computed((): string => {\n const value = content\n if (typeof value === 'string') {\n return value\n }\n if (value == null) {\n return ''\n }\n return String(value)\n})\n\n/**\n * Validates the `src` against an allow-list of safe protocols before it is\n * passed to a rendering element. This blocks XSS vectors such as\n * `javascript:` and `vbscript:` URIs and also prevents accidentally embedding\n * a `data:text/html` payload that could execute script in the app origin.\n *\n * Allowed:\n * - `blob:` (the standard case — generated client-side by `URL.createObjectURL`)\n * - `http:` / `https:`\n * - `data:` URIs whose MIME type is a known safe media kind\n * (`image/*`, `video/*`, `audio/*`, `application/pdf`, `application/octet-stream`)\n *\n * Anything else (including malformed or relative URLs) collapses to an empty\n * string so the template falls back to the \"Preview unavailable\" message.\n */\nconst safeSrc = computed((): string => {\n if (!src) {\n return ''\n }\n\n if (/^data:/i.test(src)) {\n // The MIME type must be one of the known safe kinds AND be terminated by\n // `;` (parameters / `;base64`) or `,` (start of the payload). Anchoring\n // at the terminator prevents prefix-matching tricks like\n // `data:image/png-but-actually-html,…`.\n return /^data:(?:(?:image|video|audio)\\/[a-z0-9.+-]+|application\\/pdf|application\\/octet-stream)[;,]/i.test(\n src,\n )\n ? src\n : ''\n }\n\n try {\n const parsed = new URL(src)\n if (\n parsed.protocol === 'blob:' ||\n parsed.protocol === 'http:' ||\n parsed.protocol === 'https:'\n ) {\n return src\n }\n } catch {\n // Malformed or relative URL — refuse to render.\n }\n\n return ''\n})\n\nconst error = ref(false)\n\n/**\n * Whether the embedded document is a PDF.\n *\n * PDFs are rendered by the browser's own PDF engine (e.g. PDFium), which runs\n * in an isolated context that cannot reach this app's origin — its DOM,\n * cookies or storage. A PDF's embedded JavaScript therefore cannot be used to\n * attack us, and a strict `sandbox=\"\"` does not confine that engine; it only\n * prevents Chromium from loading the PDF viewer at all (it boots as a scripted\n * extension page), leaving the user with a blank frame. So PDFs are rendered\n * without the `sandbox` attribute, matching the original `<object>` behaviour.\n *\n * Everything else that reaches the iframe (notably `text/html`, the genuine\n * XSS vector) keeps the strict empty sandbox.\n */\nconst isPdf = computed(\n (): boolean => type.trim().toLowerCase() === 'application/pdf',\n)\n\nwatch(\n () => src,\n () => (error.value = false),\n)\n</script>\n<template>\n <ResponseBodyRaw\n v-if=\"mode === 'json'\"\n :content=\"jsonPreviewContent\"\n language=\"json\"\n prettyPrintJson />\n <div\n v-else-if=\"!error && safeSrc\"\n class=\"flex justify-center overflow-auto rounded-b\"\n :class=\"{ 'bg-preview p-2': alpha }\">\n <img\n v-if=\"mode === 'image'\"\n class=\"h-full max-w-full\"\n :class=\"{ rounded: alpha }\"\n :src=\"safeSrc\"\n referrerpolicy=\"no-referrer\"\n @error=\"error = true\" />\n <video\n v-else-if=\"mode === 'video'\"\n autoplay\n controls\n referrerpolicy=\"no-referrer\"\n width=\"100%\"\n @error=\"error = true\">\n <source\n :src=\"safeSrc\"\n :type=\"type\" />\n </video>\n <audio\n v-else-if=\"mode === 'audio'\"\n class=\"my-12\"\n controls\n referrerpolicy=\"no-referrer\"\n @error=\"error = true\">\n <source\n :src=\"safeSrc\"\n :type=\"type\" />\n </audio>\n <!--\n `<object>` would execute scripts inside the embedded document in the\n app's origin, so we render arbitrary previews inside an `<iframe>`\n instead. Non-PDF documents (notably `text/html`) get an empty `sandbox`\n attribute, which disables scripts, forms, popups and same-origin access.\n PDFs are exempted (see `isPdf` above): the empty sandbox does not confine\n the browser's PDF engine, it only stops the viewer from loading at all.\n\n Note: an `error` event on `<iframe>` is not reliably fired for failed\n navigations — browsers usually fire `load` even when the response is\n blank or an error page, and a cross-origin sandboxed frame cannot be\n introspected from JavaScript. There is therefore no useful runtime\n fallback for an unreachable URL; the URL allow-list above is what\n keeps unsafe content out in the first place.\n -->\n <iframe\n v-else\n class=\"aspect-[4/3] w-full border-0\"\n :src=\"safeSrc\"\n :sandbox=\"isPdf ? undefined : ''\"\n referrerpolicy=\"no-referrer\" />\n </div>\n <ResponseBodyInfo v-else>Preview unavailable</ResponseBodyInfo>\n</template>\n<style scoped>\n.light-mode .bg-preview {\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23000' fill-opacity='10%25'%3E%3Crect width='8' height='8' /%3E%3Crect x='8' y='8' width='8' height='8' /%3E%3C/svg%3E\");\n}\n.dark-mode .bg-preview {\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23FFF' fill-opacity='10%25'%3E%3Crect width='8' height='8' /%3E%3Crect x='8' y='8' width='8' height='8' /%3E%3C/svg%3E\");\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;EAuBA,MAAM,qBAAqB,eAAuB;GAChD,MAAM,QAAQ,QAAA;A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AA,WAAA,EADjB,mBASQ,SAAA;;IAPN,OAAM;IACN,UAAA;IACA,gBAAe;IACd,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,MAAA,QAAK;OACb,mBAEiB,UAAA;IADd,KAAK,QAAA;IACL,MAAM,QAAA;kDAiBX,mBAKiC,UAAA;;IAH/B,OAAM;IACL,KAAK,QAAA;IACL,SAAS,MAAA,QAAQ,KAAA,IAAS;IAC3B,gBAAe;kDAEnB,YAA+D,0BAAA,EAAA,KAAA,GAAA,EAAA;2BAAnB,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CAAA,gBAAnB,uBAAmB,GAAA,CAAA,EAAA,CAAA"}
1
+ {"version":3,"file":"ResponseBodyPreview.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/response-block/components/ResponseBodyPreview.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { computed, ref, watch } from 'vue'\n\nimport { type MediaPreview } from '@/v2/blocks/response-block/helpers/media-types'\n\nimport ResponseBodyInfo from './ResponseBodyInfo.vue'\nimport ResponseBodyRaw from './ResponseBodyRaw.vue'\n\nconst {\n src,\n type,\n mode,\n alpha = false,\n content,\n} = defineProps<{\n src: string\n type: string\n mode: MediaPreview\n alpha?: boolean | undefined\n /** Decoded body; used when `mode` is `json` for pretty-printed preview (no JSON.parse round-trip). */\n content?: unknown\n}>()\n\nconst jsonPreviewContent = computed((): string => {\n const value = content\n if (typeof value === 'string') {\n return value\n }\n if (value == null) {\n return ''\n }\n return String(value)\n})\n\n/**\n * Validates the `src` against an allow-list of safe protocols before it is\n * passed to a rendering element. This blocks XSS vectors such as\n * `javascript:` and `vbscript:` URIs and also prevents accidentally embedding\n * a `data:text/html` payload that could execute script in the app origin.\n *\n * Allowed:\n * - `blob:` (the standard case — generated client-side by `URL.createObjectURL`)\n * - `http:` / `https:`\n * - `data:` URIs whose MIME type is a known safe media kind\n * (`image/*`, `video/*`, `audio/*`, `application/pdf`, `application/octet-stream`)\n *\n * Anything else (including malformed or relative URLs) collapses to an empty\n * string so the template falls back to the \"Preview unavailable\" message.\n */\nconst safeSrc = computed((): string => {\n if (!src) {\n return ''\n }\n\n if (/^data:/i.test(src)) {\n // The MIME type must be one of the known safe kinds AND be terminated by\n // `;` (parameters / `;base64`) or `,` (start of the payload). Anchoring\n // at the terminator prevents prefix-matching tricks like\n // `data:image/png-but-actually-html,…`.\n return /^data:(?:(?:image|video|audio)\\/[a-z0-9.+-]+|application\\/pdf|application\\/octet-stream)[;,]/i.test(\n src,\n )\n ? src\n : ''\n }\n\n try {\n const parsed = new URL(src)\n if (\n parsed.protocol === 'blob:' ||\n parsed.protocol === 'http:' ||\n parsed.protocol === 'https:'\n ) {\n return src\n }\n } catch {\n // Malformed or relative URL — refuse to render.\n }\n\n return ''\n})\n\nconst error = ref(false)\n\n/**\n * Whether the embedded document is a PDF.\n *\n * PDFs are rendered by the browser's own PDF engine (e.g. PDFium), which runs\n * in an isolated context that cannot reach this app's origin — its DOM,\n * cookies or storage. A PDF's embedded JavaScript therefore cannot be used to\n * attack us, and a strict `sandbox=\"\"` does not confine that engine; it only\n * prevents Chromium from loading the PDF viewer at all (it boots as a scripted\n * extension page), leaving the user with a blank frame. So PDFs are rendered\n * without the `sandbox` attribute, matching the original `<object>` behaviour.\n *\n * Everything else that reaches the iframe (notably `text/html`, the genuine\n * XSS vector) keeps the strict empty sandbox.\n */\nconst isPdf = computed(\n (): boolean => type.trim().toLowerCase() === 'application/pdf',\n)\n\nwatch(\n () => src,\n () => (error.value = false),\n)\n</script>\n<template>\n <ResponseBodyRaw\n v-if=\"mode === 'json'\"\n :content=\"jsonPreviewContent\"\n language=\"json\"\n prettyPrintJson />\n <div\n v-else-if=\"!error && safeSrc\"\n class=\"flex justify-center overflow-auto rounded-b\"\n :class=\"{ 'bg-preview p-2': alpha }\">\n <img\n v-if=\"mode === 'image'\"\n class=\"h-full max-w-full\"\n :class=\"{ rounded: alpha }\"\n :src=\"safeSrc\"\n referrerpolicy=\"no-referrer\"\n @error=\"error = true\" />\n <video\n v-else-if=\"mode === 'video'\"\n autoplay\n controls\n referrerpolicy=\"no-referrer\"\n width=\"100%\"\n @error=\"error = true\">\n <source\n :src=\"safeSrc\"\n :type=\"type\" />\n </video>\n <audio\n v-else-if=\"mode === 'audio'\"\n class=\"my-12\"\n controls\n referrerpolicy=\"no-referrer\"\n @error=\"error = true\">\n <source\n :src=\"safeSrc\"\n :type=\"type\" />\n </audio>\n <!--\n `<object>` would execute scripts inside the embedded document in the\n app's origin, so we render arbitrary previews inside an `<iframe>`\n instead. Non-PDF documents (notably `text/html`) get an empty `sandbox`\n attribute, which disables scripts, forms, popups and same-origin access.\n PDFs are exempted (see `isPdf` above): the empty sandbox does not confine\n the browser's PDF engine, it only stops the viewer from loading at all.\n\n Note: an `error` event on `<iframe>` is not reliably fired for failed\n navigations — browsers usually fire `load` even when the response is\n blank or an error page, and a cross-origin sandboxed frame cannot be\n introspected from JavaScript. There is therefore no useful runtime\n fallback for an unreachable URL; the URL allow-list above is what\n keeps unsafe content out in the first place.\n -->\n <iframe\n v-else\n class=\"aspect-[4/3] w-full border-0\"\n :src=\"safeSrc\"\n :sandbox=\"isPdf ? undefined : ''\"\n referrerpolicy=\"no-referrer\" />\n </div>\n <ResponseBodyInfo v-else>Preview unavailable</ResponseBodyInfo>\n</template>\n<style scoped>\n.light-mode .bg-preview {\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23000' fill-opacity='10%25'%3E%3Crect width='8' height='8' /%3E%3Crect x='8' y='8' width='8' height='8' /%3E%3C/svg%3E\");\n}\n.dark-mode .bg-preview {\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23FFF' fill-opacity='10%25'%3E%3Crect width='8' height='8' /%3E%3Crect x='8' y='8' width='8' height='8' /%3E%3C/svg%3E\");\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;EAuBA,MAAM,q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,mBAEiB,UAAA;IADd,KAAK,QAAA;IACL,MAAM,QAAA;oCAGE,QAAA,SAAI,WAAA,UAAA,GADjB,mBASQ,SAAA;;IAPN,OAAM;IACN,UAAA;IACA,gBAAe;IACd,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,MAAA,QAAK;OACb,mBAEiB,UAAA;IADd,KAAK,QAAA;IACL,MAAM,QAAA;kDAiBX,mBAKiC,UAAA;;IAH/B,OAAM;IACL,KAAK,QAAA;IACL,SAAS,MAAA,QAAQ,KAAA,IAAS;IAC3B,gBAAe;kDAEnB,YAA+D,0BAAA,EAAA,KAAA,EAAA,GAAA;2BAAnB,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CAAA,gBAAnB,uBAAmB,EAAA,CAAA,EAAA,CAAA"}
@@ -2,7 +2,7 @@ import _plugin_vue_export_helper_default from "../../../../_virtual/_plugin-vue_
2
2
  import ResponseBodyRaw_vue_vue_type_script_setup_true_lang_default from "./ResponseBodyRaw.vue.script.js";
3
3
  /* empty css */
4
4
  //#region src/v2/blocks/response-block/components/ResponseBodyRaw.vue
5
- var ResponseBodyRaw_default = /* @__PURE__ */ _plugin_vue_export_helper_default(ResponseBodyRaw_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-8c1df828"]]);
5
+ var ResponseBodyRaw_default = /*#__PURE__*/ _plugin_vue_export_helper_default(ResponseBodyRaw_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-8c1df828"]]);
6
6
  //#endregion
7
7
  export { ResponseBodyRaw_default as default };
8
8
 
@@ -11,7 +11,7 @@ var _hoisted_2 = {
11
11
  class: "custom-scroll relative pr-1",
12
12
  tabindex: "0"
13
13
  };
14
- var ResponseBodyRaw_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
14
+ var ResponseBodyRaw_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
15
15
  __name: "ResponseBodyRaw",
16
16
  props: {
17
17
  content: {},
@@ -1 +1 @@
1
- {"version":3,"file":"ResponseBodyRaw.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/response-block/components/ResponseBodyRaw.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ScalarCodeBlockCopy } from '@scalar/components/code-block'\nimport { useCodeMirror, type CodeMirrorLanguage } from '@scalar/use-codemirror'\nimport { computed, ref, toRef, useId } from 'vue'\n\nimport { prettifyJsoncString } from '@/v2/blocks/response-block/helpers/prettify-jsonc-string'\n\nconst props = defineProps<{\n content: unknown\n language: CodeMirrorLanguage | undefined\n /** When true, JSON/JSONC strings are pretty-printed for the Preview tab (wire bytes stay unchanged in Raw). */\n prettyPrintJson?: boolean\n}>()\n\nconst codeMirrorRef = ref<HTMLDivElement | null>(null)\n/** Base id for the code block */\nconst id = useId()\n\nconst displayContent = computed((): string => {\n const { content, language, prettyPrintJson = false } = props\n if (typeof content !== 'string') {\n if (content == null) {\n return ''\n }\n return String(content)\n }\n if (prettyPrintJson && language === 'json') {\n return prettifyJsoncString(content)\n }\n return content\n})\n\nconst { codeMirror } = useCodeMirror({\n codeMirrorRef,\n readOnly: true,\n lineNumbers: true,\n content: toRef(displayContent),\n language: toRef(() => props.language),\n forceFoldGutter: true,\n})\n\n// Function to get current content\nconst getCurrentContent = () => {\n return codeMirror.value?.state.doc.toString() || ''\n}\n</script>\n<template>\n <div\n class=\"scalar-code-block group/code-block relative grid min-h-0 overflow-hidden p-px outline-none has-focus-visible:outline\"\n data-testid=\"response-body-raw\">\n <div\n class=\"custom-scroll relative pr-1\"\n tabindex=\"0\">\n <!-- CodeMirror container -->\n <div ref=\"codeMirrorRef\" />\n </div>\n <!-- Copy button -->\n <ScalarCodeBlockCopy\n v-if=\"getCurrentContent()\"\n :aria-controls=\"id\"\n class=\"absolute top-2 right-2\"\n :content=\"getCurrentContent()\" />\n </div>\n</template>\n<style scoped>\n:deep(.cm-editor) {\n background-color: transparent;\n font-size: var(--scalar-small);\n outline: none;\n}\n\n:deep(.cm-gutters) {\n background-color: var(--scalar-background-1);\n border-radius: var(--scalar-radius) 0 0 var(--scalar-radius);\n}\n\n:deep(.cm-scroller) {\n overflow: auto;\n min-width: 100%;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;EAOA,MAAM,QAAQ;EAOd,MAAM,gBAAgB,IAA2B,KAAI;;EAErD,MAAM,KAAK,OAAM;EAgBjB,MAAM,EAAE,eAAe,cAAc;GACnC;GACA,UAAU;GACV,aAAa;GACb,SAAS,MAlBY,eAAuB;IAC5C,MAAM,EAAE,SAAS,UAAU,kBAAkB,UAAU;AACvD,QAAI,OAAO,YAAY,UAAU;AAC/B,SAAI,WAAW,KACb,QAAO;AAET,YAAO,OAAO,QAAO;;AAEvB,QAAI,mBAAmB,aAAa,OAClC,QAAO,oBAAoB,QAAO;AAEpC,WAAO;KACR,CAM+B;GAC9B,UAAU,YAAY,MAAM,SAAS;GACrC,iBAAiB;GAClB,CAAA;EAGD,MAAM,0BAA0B;AAC9B,UAAO,WAAW,OAAO,MAAM,IAAI,UAAU,IAAI;;;uBAIjD,mBAeM,OAfN,YAeM,CAZJ,mBAKM,OALN,YAKM,CADJ,mBAA2B,OAAA;aAAlB;IAAJ,KAAI;oBAIH,mBAAiB,IAAA,WAAA,EADzB,YAImC,MAAA,oBAAA,EAAA;;IAFhC,iBAAe,MAAA,GAAE;IAClB,OAAM;IACL,SAAS,mBAAiB"}
1
+ {"version":3,"file":"ResponseBodyRaw.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/response-block/components/ResponseBodyRaw.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ScalarCodeBlockCopy } from '@scalar/components/code-block'\nimport { useCodeMirror, type CodeMirrorLanguage } from '@scalar/use-codemirror'\nimport { computed, ref, toRef, useId } from 'vue'\n\nimport { prettifyJsoncString } from '@/v2/blocks/response-block/helpers/prettify-jsonc-string'\n\nconst props = defineProps<{\n content: unknown\n language: CodeMirrorLanguage | undefined\n /** When true, JSON/JSONC strings are pretty-printed for the Preview tab (wire bytes stay unchanged in Raw). */\n prettyPrintJson?: boolean\n}>()\n\nconst codeMirrorRef = ref<HTMLDivElement | null>(null)\n/** Base id for the code block */\nconst id = useId()\n\nconst displayContent = computed((): string => {\n const { content, language, prettyPrintJson = false } = props\n if (typeof content !== 'string') {\n if (content == null) {\n return ''\n }\n return String(content)\n }\n if (prettyPrintJson && language === 'json') {\n return prettifyJsoncString(content)\n }\n return content\n})\n\nconst { codeMirror } = useCodeMirror({\n codeMirrorRef,\n readOnly: true,\n lineNumbers: true,\n content: toRef(displayContent),\n language: toRef(() => props.language),\n forceFoldGutter: true,\n})\n\n// Function to get current content\nconst getCurrentContent = () => {\n return codeMirror.value?.state.doc.toString() || ''\n}\n</script>\n<template>\n <div\n class=\"scalar-code-block group/code-block relative grid min-h-0 overflow-hidden p-px outline-none has-focus-visible:outline\"\n data-testid=\"response-body-raw\">\n <div\n class=\"custom-scroll relative pr-1\"\n tabindex=\"0\">\n <!-- CodeMirror container -->\n <div ref=\"codeMirrorRef\" />\n </div>\n <!-- Copy button -->\n <ScalarCodeBlockCopy\n v-if=\"getCurrentContent()\"\n :aria-controls=\"id\"\n class=\"absolute top-2 right-2\"\n :content=\"getCurrentContent()\" />\n </div>\n</template>\n<style scoped>\n:deep(.cm-editor) {\n background-color: transparent;\n font-size: var(--scalar-small);\n outline: none;\n}\n\n:deep(.cm-gutters) {\n background-color: var(--scalar-background-1);\n border-radius: var(--scalar-radius) 0 0 var(--scalar-radius);\n}\n\n:deep(.cm-scroller) {\n overflow: auto;\n min-width: 100%;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;EAOA,MAAM,QAAQ;EAOd,MAAM,gBAAgB,IAA2B,IAAI;;EAErD,MAAM,KAAK,MAAM;EAgBjB,MAAM,EAAE,eAAe,cAAc;GACnC;GACA,UAAU;GACV,aAAa;GACb,SAAS,MAlBY,eAAuB;IAC5C,MAAM,EAAE,SAAS,UAAU,kBAAkB,UAAU;IACvD,IAAI,OAAO,YAAY,UAAU;KAC/B,IAAI,WAAW,MACb,OAAO;KAET,OAAO,OAAO,OAAO;IACvB;IACA,IAAI,mBAAmB,aAAa,QAClC,OAAO,oBAAoB,OAAO;IAEpC,OAAO;GACT,CAMiB,CAAc;GAC7B,UAAU,YAAY,MAAM,QAAQ;GACpC,iBAAiB;EACnB,CAAC;EAGD,MAAM,0BAA0B;GAC9B,OAAO,WAAW,OAAO,MAAM,IAAI,SAAS,KAAK;EACnD;;uBAGE,mBAeM,OAfN,YAeM,CAZJ,mBAKM,OALN,YAKM,CADJ,mBAA2B,OAAA;aAAlB;IAAJ,KAAI;oBAIH,kBAAiB,KAAA,UAAA,GADzB,YAImC,MAAA,mBAAA,GAAA;;IAFhC,iBAAe,MAAA,EAAA;IAChB,OAAM;IACL,SAAS,kBAAiB"}
@@ -1 +1 @@
1
- {"version":3,"file":"ResponseBodyStreaming.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/response-block/components/ResponseBodyStreaming.vue"],"names":[],"mappings":"AAkKA,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,2BAA2B,CAAC,UAAU,CAAC,CAAA;CAChD,CAAC;AAuPF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"ResponseBodyStreaming.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/response-block/components/ResponseBodyStreaming.vue"],"names":[],"mappings":"AAkKA,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,2BAA2B,CAAC,UAAU,CAAC,CAAA;CAChD,CAAC;AAwPF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}