@scalar/api-client 2.38.2 → 2.38.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/{AddressBar-B4xnl66I.js → AddressBar-CX8xiYoe.js} +4 -4
  3. package/dist/{AddressBar-B4xnl66I.js.map → AddressBar-CX8xiYoe.js.map} +1 -1
  4. package/dist/{App-BVH4lIe8.js → App-BpNPKHmM.js} +4 -4
  5. package/dist/{App-BVH4lIe8.js.map → App-BpNPKHmM.js.map} +1 -1
  6. package/dist/{App-CvClwSlM.js → App-Ckirvnv1.js} +2 -2
  7. package/dist/{App-CvClwSlM.js.map → App-Ckirvnv1.js.map} +1 -1
  8. package/dist/{CodeInput-C-igR77V.js → CodeInput-BN7uw3Bh.js} +2 -2
  9. package/dist/{CodeInput-C-igR77V.js.map → CodeInput-BN7uw3Bh.js.map} +1 -1
  10. package/dist/{Collection-4MT9WmDD.js → Collection-ChAxs3rz.js} +2 -2
  11. package/dist/{Collection-4MT9WmDD.js.map → Collection-ChAxs3rz.js.map} +1 -1
  12. package/dist/{CollectionAuthentication-MHWQpw74.js → CollectionAuthentication-BDpvv8cA.js} +5 -5
  13. package/dist/{CollectionAuthentication-MHWQpw74.js.map → CollectionAuthentication-BDpvv8cA.js.map} +1 -1
  14. package/dist/{CollectionEnvironment-Dw35vIqo.js → CollectionEnvironment-dwisJ-h5.js} +4 -4
  15. package/dist/{CollectionEnvironment-Dw35vIqo.js.map → CollectionEnvironment-dwisJ-h5.js.map} +1 -1
  16. package/dist/{CollectionOverview-TUdDIu5f.js → CollectionOverview-CJ9-Vmei.js} +3 -3
  17. package/dist/{CollectionOverview-TUdDIu5f.js.map → CollectionOverview-CJ9-Vmei.js.map} +1 -1
  18. package/dist/{CollectionServers-BrjTCfDe.js → CollectionServers-BWkIGwz4.js} +5 -5
  19. package/dist/{CollectionServers-BrjTCfDe.js.map → CollectionServers-BWkIGwz4.js.map} +1 -1
  20. package/dist/{CollectionSettings-HVSlp2Gv.js → CollectionSettings-CqUUYOym.js} +2 -2
  21. package/dist/{CollectionSettings-HVSlp2Gv.js.map → CollectionSettings-CqUUYOym.js.map} +1 -1
  22. package/dist/{CommandPalette-CL8k4CoN.js → CommandPalette-BiA0IgO8.js} +2 -2
  23. package/dist/{CommandPalette-CL8k4CoN.js.map → CommandPalette-BiA0IgO8.js.map} +1 -1
  24. package/dist/{Cookies-DbOKTi1f.js → Cookies-CNRSxP8J.js} +8 -8
  25. package/dist/{Cookies-DbOKTi1f.js.map → Cookies-CNRSxP8J.js.map} +1 -1
  26. package/dist/{DataTableInput-yaU5g-kP.js → DataTableInput-SkIUPlrB.js} +2 -2
  27. package/dist/{DataTableInput-yaU5g-kP.js.map → DataTableInput-SkIUPlrB.js.map} +1 -1
  28. package/dist/{Environment-DJatRQIg.js → Environment-D_CbZk0A.js} +5 -5
  29. package/dist/{Environment-DJatRQIg.js.map → Environment-D_CbZk0A.js.map} +1 -1
  30. package/dist/{EnvironmentModal-DBEJ4Kzj.js → EnvironmentModal-CcyqnPc2.js} +2 -2
  31. package/dist/{EnvironmentModal-DBEJ4Kzj.js.map → EnvironmentModal-CcyqnPc2.js.map} +1 -1
  32. package/dist/{Form-CSKzyHGO.js → Form-bA4bV_oA.js} +3 -3
  33. package/dist/{Form-CSKzyHGO.js.map → Form-bA4bV_oA.js.map} +1 -1
  34. package/dist/{ImportCollection-DfX1UQ5u.js → ImportCollection-BIYMxB9Q.js} +2 -2
  35. package/dist/{ImportCollection-DfX1UQ5u.js.map → ImportCollection-BIYMxB9Q.js.map} +1 -1
  36. package/dist/{MainLayout-BEFMl1ud.js → MainLayout-oMIJ5QXF.js} +3 -3
  37. package/dist/{MainLayout-BEFMl1ud.js.map → MainLayout-oMIJ5QXF.js.map} +1 -1
  38. package/dist/{Modal-sQ9vH6MN.js → Modal-DkOa_KK0.js} +2 -2
  39. package/dist/{Modal-sQ9vH6MN.js.map → Modal-DkOa_KK0.js.map} +1 -1
  40. package/dist/{Request-gscRsGQ8.js → Request-BWfYWyBa.js} +10 -10
  41. package/dist/{Request-gscRsGQ8.js.map → Request-BWfYWyBa.js.map} +1 -1
  42. package/dist/{RequestAuth-BzBfIysT.js → RequestAuth-BU6ubH-c.js} +3 -3
  43. package/dist/{RequestAuth-BzBfIysT.js.map → RequestAuth-BU6ubH-c.js.map} +1 -1
  44. package/dist/{RequestRoot-3Bj8JZD-.js → RequestRoot-7xhK5_qr.js} +7 -7
  45. package/dist/{RequestRoot-3Bj8JZD-.js.map → RequestRoot-7xhK5_qr.js.map} +1 -1
  46. package/dist/{RequestSection-HhdJj9hW.js → RequestSection-Bx8UHW-k.js} +4 -4
  47. package/dist/{RequestSection-HhdJj9hW.js.map → RequestSection-Bx8UHW-k.js.map} +1 -1
  48. package/dist/{ResponseSection-DMJ0tw8E.js → ResponseSection-CLrgLMN_.js} +3 -3
  49. package/dist/{ResponseSection-DMJ0tw8E.js.map → ResponseSection-CLrgLMN_.js.map} +1 -1
  50. package/dist/{Server-DnA_BzPS.js → Server-BS4zjUdO.js} +2 -2
  51. package/dist/{Server-DnA_BzPS.js.map → Server-BS4zjUdO.js.map} +1 -1
  52. package/dist/{Settings-CYZzdJPO.js → Settings-BuLKHzRY.js} +2 -2
  53. package/dist/{Settings-CYZzdJPO.js.map → Settings-BuLKHzRY.js.map} +1 -1
  54. package/dist/{Sidebar-C6AdX6-N.js → Sidebar-Xl9_nFXX.js} +2 -2
  55. package/dist/{Sidebar-C6AdX6-N.js.map → Sidebar-Xl9_nFXX.js.map} +1 -1
  56. package/dist/components/AddressBar/index.js +3 -3
  57. package/dist/components/CodeInput/index.js +1 -1
  58. package/dist/components/CommandPalette/index.js +1 -1
  59. package/dist/components/DataTable/index.js +2 -2
  60. package/dist/components/ImportCollection/index.js +1 -1
  61. package/dist/components/Server/index.js +1 -1
  62. package/dist/components/Sidebar/index.js +1 -1
  63. package/dist/components/index.js +4 -4
  64. package/dist/{components-CSxJTn6F.js → components-DfJHvSLM.js} +2 -2
  65. package/dist/{components-CSxJTn6F.js.map → components-DfJHvSLM.js.map} +1 -1
  66. package/dist/get-resolved-url-SybDPV0U.js +85 -0
  67. package/dist/get-resolved-url-SybDPV0U.js.map +1 -0
  68. package/dist/{get-server-url-o3On8CEr.js → get-server-url-UVN-dx79.js} +1 -1
  69. package/dist/{get-server-url-o3On8CEr.js.map → get-server-url-UVN-dx79.js.map} +1 -1
  70. package/dist/index.js +5 -5
  71. package/dist/layouts/App/index.js +3 -3
  72. package/dist/layouts/Modal/index.js +1 -1
  73. package/dist/layouts/Web/index.js +4 -4
  74. package/dist/libs/index.js +1 -1
  75. package/dist/{operation-block-BnMIKAOh.js → operation-block-DE-hoO03.js} +67 -17
  76. package/dist/operation-block-DE-hoO03.js.map +1 -0
  77. package/dist/{operation-code-sample-ZUTueV3v.js → operation-code-sample-xgx4qi2H.js} +22 -10
  78. package/dist/operation-code-sample-xgx4qi2H.js.map +1 -0
  79. package/dist/{request-block-DwsGy64Q.js → request-block-N7dPFyrG.js} +4 -4
  80. package/dist/{request-block-DwsGy64Q.js.map → request-block-N7dPFyrG.js.map} +1 -1
  81. package/dist/{scalar-address-bar-block--Vs6IBU1.js → scalar-address-bar-block-BbysOhkE.js} +2 -2
  82. package/dist/{scalar-address-bar-block--Vs6IBU1.js.map → scalar-address-bar-block-BbysOhkE.js.map} +1 -1
  83. package/dist/{scalar-auth-selector-block-DI3DLag9.js → scalar-auth-selector-block-Bs79QOMA.js} +12 -9
  84. package/dist/scalar-auth-selector-block-Bs79QOMA.js.map +1 -0
  85. package/dist/store/index.js +1 -1
  86. package/dist/{store-DpSUVhjp.js → store-DaPoVtIS.js} +15 -15
  87. package/dist/{store-DpSUVhjp.js.map → store-DaPoVtIS.js.map} +1 -1
  88. package/dist/style.css +1 -1
  89. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
  90. package/dist/v2/blocks/operation-block/helpers/apply-allow-reserved-to-url.d.ts +6 -0
  91. package/dist/v2/blocks/operation-block/helpers/apply-allow-reserved-to-url.d.ts.map +1 -0
  92. package/dist/v2/blocks/operation-block/helpers/build-request-body.d.ts.map +1 -1
  93. package/dist/v2/blocks/operation-block/helpers/build-request-parameters.d.ts +1 -0
  94. package/dist/v2/blocks/operation-block/helpers/build-request-parameters.d.ts.map +1 -1
  95. package/dist/v2/blocks/operation-block/helpers/build-request.d.ts.map +1 -1
  96. package/dist/v2/blocks/operation-block/helpers/get-resolved-url.d.ts +2 -1
  97. package/dist/v2/blocks/operation-block/helpers/get-resolved-url.d.ts.map +1 -1
  98. package/dist/v2/blocks/operation-block/index.js +11 -11
  99. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.d.ts.map +1 -1
  100. package/dist/v2/blocks/operation-code-sample/index.js +1 -1
  101. package/dist/v2/blocks/request-block/helpers/get-default-headers.d.ts.map +1 -1
  102. package/dist/v2/blocks/request-block/index.js +5 -5
  103. package/dist/v2/blocks/response-block/index.js +2 -2
  104. package/dist/v2/blocks/scalar-address-bar-block/index.js +1 -1
  105. package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts.map +1 -1
  106. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts.map +1 -1
  107. package/dist/v2/blocks/scalar-auth-selector-block/index.js +3 -3
  108. package/dist/v2/constants.d.ts +3 -0
  109. package/dist/v2/constants.d.ts.map +1 -0
  110. package/dist/v2/features/app/components/index.js +4 -4
  111. package/dist/v2/features/app/index.js +14 -14
  112. package/dist/v2/features/app/index.js.map +1 -1
  113. package/dist/v2/features/collection/components/Authentication.vue.d.ts.map +1 -1
  114. package/dist/v2/features/modal/index.js +10 -10
  115. package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
  116. package/dist/v2/features/operation/helpers/get-selected-security.d.ts +6 -1
  117. package/dist/v2/features/operation/helpers/get-selected-security.d.ts.map +1 -1
  118. package/dist/v2/features/operation/index.js +10 -10
  119. package/dist/views/Request/RequestSection/RequestAuth/index.js +3 -3
  120. package/dist/views/Request/RequestSection/index.js +4 -4
  121. package/dist/views/Request/ResponseSection/index.js +3 -3
  122. package/dist/views/Request/components/index.js +1 -1
  123. package/package.json +13 -13
  124. package/dist/get-resolved-url-BUCwrBzc.js +0 -30
  125. package/dist/get-resolved-url-BUCwrBzc.js.map +0 -1
  126. package/dist/operation-block-BnMIKAOh.js.map +0 -1
  127. package/dist/operation-code-sample-ZUTueV3v.js.map +0 -1
  128. package/dist/scalar-auth-selector-block-DI3DLag9.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"RequestSection-HhdJj9hW.js","names":[],"sources":["../src/views/Request/libs/request.ts","../src/views/Request/RequestSection/RequestTableTooltip.vue","../src/views/Request/RequestSection/RequestTableTooltip.vue","../src/views/Request/RequestSection/RequestTable.vue","../src/views/Request/RequestSection/RequestTable.vue","../src/views/Request/RequestSection/RequestBody.vue","../src/views/Request/RequestSection/RequestBody.vue","../src/views/Request/RequestSection/RequestParams.vue","../src/views/Request/RequestSection/RequestParams.vue","../src/views/Request/RequestSection/RequestPathParams.vue","../src/views/Request/RequestSection/RequestPathParams.vue","../src/views/Request/RequestSection/RequestCodeExample.vue","../src/views/Request/RequestSection/RequestCodeExample.vue","../src/views/Request/RequestSection/RequestSection.vue","../src/views/Request/RequestSection/RequestSection.vue"],"sourcesContent":["import type { RequestExampleParameter } from '@scalar/oas-utils/entities/spec'\nimport { computed } from 'vue'\n\n/**\n * Check if a RequestExampleParameter has any of the following properties:\n * - description\n * - type\n * - default\n * - format\n * - minimum\n * - maximum\n */\nexport const hasItemProperties = (item: RequestExampleParameter) =>\n Boolean(item.description || item.type || item.default || item.format || item.minimum || item.maximum)\n\n/**\n * Checks if the value of a RequestExampleParameter is the expected type or format\n * Returns an alert message if the value is not in the correct type or format, otherwise false\n */\nexport const parameterIsInvalid = (item: RequestExampleParameter) => {\n return computed(() => {\n if (item.value === undefined || item.value === '') {\n return false\n }\n\n // Type validation\n if (item.type) {\n if (item.type === 'integer') {\n const value = Number(item.value)\n if (isNaN(value) || !Number.isInteger(value)) {\n return 'Value must be a whole number (e.g., 42)'\n }\n if (item.minimum !== undefined && value < item.minimum) {\n return `Value must be ${item.minimum} or greater`\n }\n if (item.maximum !== undefined && value > item.maximum) {\n return `Value must be ${item.maximum} or less`\n }\n }\n\n if (item.type === 'number') {\n const value = Number(item.value)\n if (isNaN(value)) {\n return 'Value must be a number (e.g., 42.5)'\n }\n if (item.minimum !== undefined && value < item.minimum) {\n return `Value must be ${item.minimum} or greater`\n }\n if (item.maximum !== undefined && value > item.maximum) {\n return `Value must be ${item.maximum} or less`\n }\n }\n\n if (item.type === 'string' && item.format) {\n if (item.format === 'date' && !/^\\d{4}-\\d{2}-\\d{2}$/.test(item.value)) {\n return 'Please enter a valid date in YYYY-MM-DD format (e.g., 2024-03-20)'\n }\n if (\n item.format === 'date-time' &&\n !/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$/.test(item.value)\n ) {\n return 'Please enter a valid date and time in RFC 3339 format (e.g., 2024-03-20T13:45:30Z)'\n }\n if (item.format === 'email' && !/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(item.value)) {\n return 'Please enter a valid email address (e.g., user@example.com)'\n }\n if (item.format === 'uri' && !/^[a-zA-Z][a-zA-Z0-9+.-]*:.+$/.test(item.value)) {\n return 'Please enter a valid URI (e.g., https://example.com)'\n }\n }\n }\n\n return false\n })\n}\n\n/**\n * Checks if a RequestExampleParameter is required and has an empty value\n */\nexport const hasEmptyRequiredParameter = (item: RequestExampleParameter) => Boolean(item.required && item.value === '')\n","<script setup lang=\"ts\">\nimport { ScalarPopover } from '@scalar/components'\nimport { ScalarIconInfo, ScalarIconWarning } from '@scalar/icons'\nimport type { RequestExampleParameter } from '@scalar/oas-utils/entities/spec'\nimport { computed } from 'vue'\n\nimport { parameterIsInvalid } from '../libs/request'\n\nconst { item } = defineProps<{ item: RequestExampleParameter }>()\n\nconst isInvalid = computed(() => !!parameterIsInvalid(item).value)\n</script>\n<template>\n <ScalarPopover\n teleport\n :offset=\"4\"\n placement=\"left\">\n <button\n type=\"button\"\n :aria-label=\"isInvalid ? 'Input is invalid' : 'More Information'\"\n class=\"text-c-2 hover:text-c-1 hover:bg-b-2 rounded p-1\"\n :role=\"isInvalid ? 'alert' : 'none'\">\n <ScalarIconWarning\n v-if=\"isInvalid\"\n class=\"text-orange size-3.5 brightness-90 hover:brightness-75\" />\n <ScalarIconInfo\n v-else\n class=\"text-c-2 hover:text-c-1 size-3.5\" />\n </button>\n <template #popover>\n <div\n class=\"w-content text-xxs text-c-1 grid min-w-48 gap-1.5 rounded px-1.5 pt-2 pb-1.5 leading-none\">\n <div\n v-if=\"isInvalid\"\n class=\"text-error-1\">\n {{ parameterIsInvalid(item).value }}\n </div>\n <div\n v-else-if=\"\n item.type ||\n item.format ||\n item.minimum ||\n item.maximum ||\n item.default\n \"\n class=\"schema text-c-2 flex items-center\">\n <span v-if=\"item.type\">{{ item.type }}</span>\n <span v-if=\"item.format\">{{ item.format }}</span>\n <span v-if=\"item.minimum\">min: {{ item.minimum }}</span>\n <span v-if=\"item.maximum\">max: {{ item.maximum }}</span>\n <span v-if=\"item.default\">default: {{ item.default }}</span>\n </div>\n <span\n v-if=\"item.description && !isInvalid\"\n class=\"text-sm leading-snug text-pretty\"\n :style=\"{ maxWidth: '16rem' }\">\n {{ item.description }}\n </span>\n </div>\n </template>\n </ScalarPopover>\n</template>\n<style scoped>\n.schema > span:not(:first-child)::before {\n content: '·';\n display: block;\n margin: 0 0.5ch;\n}\n\n.schema > span {\n display: flex;\n white-space: nowrap;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { ScalarPopover } from '@scalar/components'\nimport { ScalarIconInfo, ScalarIconWarning } from '@scalar/icons'\nimport type { RequestExampleParameter } from '@scalar/oas-utils/entities/spec'\nimport { computed } from 'vue'\n\nimport { parameterIsInvalid } from '../libs/request'\n\nconst { item } = defineProps<{ item: RequestExampleParameter }>()\n\nconst isInvalid = computed(() => !!parameterIsInvalid(item).value)\n</script>\n<template>\n <ScalarPopover\n teleport\n :offset=\"4\"\n placement=\"left\">\n <button\n type=\"button\"\n :aria-label=\"isInvalid ? 'Input is invalid' : 'More Information'\"\n class=\"text-c-2 hover:text-c-1 hover:bg-b-2 rounded p-1\"\n :role=\"isInvalid ? 'alert' : 'none'\">\n <ScalarIconWarning\n v-if=\"isInvalid\"\n class=\"text-orange size-3.5 brightness-90 hover:brightness-75\" />\n <ScalarIconInfo\n v-else\n class=\"text-c-2 hover:text-c-1 size-3.5\" />\n </button>\n <template #popover>\n <div\n class=\"w-content text-xxs text-c-1 grid min-w-48 gap-1.5 rounded px-1.5 pt-2 pb-1.5 leading-none\">\n <div\n v-if=\"isInvalid\"\n class=\"text-error-1\">\n {{ parameterIsInvalid(item).value }}\n </div>\n <div\n v-else-if=\"\n item.type ||\n item.format ||\n item.minimum ||\n item.maximum ||\n item.default\n \"\n class=\"schema text-c-2 flex items-center\">\n <span v-if=\"item.type\">{{ item.type }}</span>\n <span v-if=\"item.format\">{{ item.format }}</span>\n <span v-if=\"item.minimum\">min: {{ item.minimum }}</span>\n <span v-if=\"item.maximum\">max: {{ item.maximum }}</span>\n <span v-if=\"item.default\">default: {{ item.default }}</span>\n </div>\n <span\n v-if=\"item.description && !isInvalid\"\n class=\"text-sm leading-snug text-pretty\"\n :style=\"{ maxWidth: '16rem' }\">\n {{ item.description }}\n </span>\n </div>\n </template>\n </ScalarPopover>\n</template>\n<style scoped>\n.schema > span:not(:first-child)::before {\n content: '·';\n display: block;\n margin: 0 0.5ch;\n}\n\n.schema > span {\n display: flex;\n white-space: nowrap;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { ScalarButton, ScalarIcon, ScalarTooltip } from '@scalar/components'\nimport { ScalarIconTrash } from '@scalar/icons'\nimport type { Environment } from '@scalar/oas-utils/entities/environment'\nimport type { RequestExampleParameter } from '@scalar/oas-utils/entities/spec'\nimport type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport { RouterLink, type RouteLocationRaw } from 'vue-router'\n\nimport CodeInput from '@/components/CodeInput/CodeInput.vue'\nimport DataTable from '@/components/DataTable/DataTable.vue'\nimport DataTableCell from '@/components/DataTable/DataTableCell.vue'\nimport DataTableCheckbox from '@/components/DataTable/DataTableCheckbox.vue'\nimport DataTableHeader from '@/components/DataTable/DataTableHeader.vue'\nimport DataTableRow from '@/components/DataTable/DataTableRow.vue'\nimport type { EnvVariable } from '@/store/active-entities'\n\nimport { hasItemProperties, parameterIsInvalid } from '../libs/request'\nimport RequestTableTooltip from './RequestTableTooltip.vue'\n\nconst props = withDefaults(\n defineProps<{\n items?: (RequestExampleParameter & { route?: RouteLocationRaw })[]\n /** Hide the enabled column */\n hasCheckboxDisabled?: boolean\n showUploadButton?: boolean\n isGlobal?: boolean\n isReadOnly?: boolean\n environment: Environment\n envVariables: EnvVariable[]\n workspace: Workspace\n invalidParams?: Set<string>\n label?: string\n }>(),\n {\n hasCheckboxDisabled: false,\n showUploadButton: false,\n isGlobal: false,\n isReadOnly: false,\n },\n)\n\nconst emit = defineEmits<{\n (e: 'updateRow', idx: number, field: 'key' | 'value', value: string): void\n (e: 'toggleRow', idx: number, enabled: boolean): void\n (e: 'addRow'): void\n (e: 'deleteRow', idx: number): void\n (e: 'inputFocus'): void\n (e: 'inputBlur'): void\n (e: 'uploadFile', idx: number): void\n (e: 'removeFile', idx: number): void\n}>()\n\nconst columns = ['', '', '36px']\n\nconst handleSelectVariable = (\n idx: number,\n field: 'key' | 'value',\n value: string,\n) => {\n emit('updateRow', idx, field, value)\n}\n\nconst handleFileUpload = (idx: number) => {\n emit('uploadFile', idx)\n}\n\nconst flattenValue = (item: RequestExampleParameter) => {\n return Array.isArray(item.default) && item.default.length === 1\n ? item.default[0]\n : item.default\n}\n\n// Shows delete button if the item has key or value filled\nconst showDeleteButton = (item: RequestExampleParameter) => {\n return Boolean(item.key || item.value)\n}\n</script>\n<template>\n <DataTable\n class=\"group/table flex-1\"\n :columns=\"columns\">\n <DataTableRow class=\"sr-only !block\">\n <DataTableHeader>{{ label }} Enabled</DataTableHeader>\n <DataTableHeader>{{ label }} Key</DataTableHeader>\n <DataTableHeader>{{ label }} Value</DataTableHeader>\n </DataTableRow>\n <DataTableRow\n v-for=\"(item, idx) in items\"\n :id=\"item.key\"\n :key=\"idx\"\n :class=\"{\n alert: parameterIsInvalid(item).value,\n error: invalidParams && invalidParams.has(item.key),\n }\">\n <template v-if=\"isGlobal\">\n <RouterLink\n class=\"text-c-2 flex items-center justify-center border-t !border-r\"\n :to=\"item.route ?? {}\">\n <span class=\"sr-only\">Global</span>\n <ScalarTooltip\n content=\"Global cookies are shared across the whole workspace.\"\n placement=\"top\">\n <ScalarIcon\n tabindex=\"0\"\n class=\"text-c-1\"\n icon=\"Globe\"\n size=\"xs\" />\n </ScalarTooltip>\n </RouterLink>\n </template>\n <template v-else>\n <DataTableCheckbox\n class=\"!border-r\"\n :disabled=\"props.hasCheckboxDisabled\"\n :modelValue=\"item.enabled\"\n @update:modelValue=\"(v) => emit('toggleRow', idx, v)\" />\n </template>\n <DataTableCell>\n <CodeInput\n :aria-label=\"`${label} Key`\"\n disableCloseBrackets\n :disabled=\"props.isReadOnly\"\n disableEnter\n disableTabIndent\n lineWrapping\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :modelValue=\"item.key\"\n placeholder=\"Key\"\n :required=\"Boolean(item.required)\"\n :workspace=\"workspace\"\n @blur=\"emit('inputBlur')\"\n @focus=\"emit('inputFocus')\"\n @selectVariable=\"(v: string) => handleSelectVariable(idx, 'key', v)\"\n @update:modelValue=\"\n (v: string) => emit('updateRow', idx, 'key', v)\n \" />\n </DataTableCell>\n <DataTableCell>\n <CodeInput\n :aria-label=\"`${label} Value`\"\n :class=\"\n hasItemProperties(item)\n ? 'pr-6 group-hover:pr-10 group-has-[.cm-focused]:pr-10'\n : 'group-hover:pr-6 group-has-[.cm-focused]:pr-6'\n \"\n :default=\"item.default\"\n disableCloseBrackets\n :disabled=\"props.isReadOnly\"\n disableEnter\n disableTabIndent\n lineWrapping\n :enum=\"item.enum ?? []\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :examples=\"item.examples ?? []\"\n :max=\"item.maximum\"\n :min=\"item.minimum\"\n :modelValue=\"item.value\"\n :nullable=\"Boolean(item.nullable)\"\n placeholder=\"Value\"\n :type=\"item.type\"\n :workspace=\"workspace\"\n @blur=\"emit('inputBlur')\"\n @focus=\"emit('inputFocus')\"\n @selectVariable=\"(v: string) => handleSelectVariable(idx, 'value', v)\"\n @update:modelValue=\"\n (v: string) => emit('updateRow', idx, 'value', v)\n \">\n <template #icon>\n <ScalarButton\n v-if=\"showDeleteButton(item) && !item.required\"\n :class=\"{\n '-mr-0.5': hasItemProperties(item),\n }\"\n class=\"text-c-2 hover:text-c-1 hover:bg-b-2 z-context hidden h-fit rounded p-1 group-hover:flex group-has-[.cm-focused]:flex\"\n size=\"sm\"\n variant=\"ghost\"\n @click=\"emit('deleteRow', idx)\">\n <ScalarIconTrash class=\"size-3.5\" />\n </ScalarButton>\n <RequestTableTooltip\n v-if=\"hasItemProperties(item)\"\n :item=\"{ ...item, default: flattenValue(item) }\" />\n </template>\n </CodeInput>\n </DataTableCell>\n <DataTableCell\n v-if=\"showUploadButton\"\n class=\"group/upload flex items-center justify-center whitespace-nowrap\">\n <template v-if=\"item.file\">\n <div\n class=\"text-c-2 filemask flex w-full max-w-[100%] items-end justify-end overflow-hidden p-1\">\n <span>{{ item.file?.name }}</span>\n </div>\n <button\n class=\"bg-b-2 centered-x centered-y absolute hidden w-[calc(100%_-_8px)] rounded p-0.5 text-center text-xs font-medium group-hover/upload:block\"\n type=\"button\"\n @click=\"emit('removeFile', idx)\">\n Delete\n </button>\n </template>\n <template v-else>\n <div class=\"p-0.5\">\n <ScalarButton\n class=\"bg-b-2 hover:bg-b-3 text-c-2 h-fit border-0 py-px shadow-none\"\n size=\"sm\"\n variant=\"outlined\"\n @click=\"handleFileUpload(idx)\">\n <span>Upload File</span>\n <ScalarIcon\n class=\"ml-1\"\n icon=\"Upload\"\n size=\"xs\"\n thickness=\"2.5\" />\n </ScalarButton>\n </div>\n </template>\n </DataTableCell>\n </DataTableRow>\n </DataTable>\n</template>\n<style scoped>\n:deep(.cm-editor) {\n padding: 0;\n}\n:deep(.cm-content) {\n align-items: center;\n background-color: transparent;\n display: flex;\n font-family: var(--scalar-font);\n font-size: var(--scalar-small);\n padding: 5px 8px;\n width: 100%;\n}\n:deep(.cm-content):has(.cm-pill) {\n padding: 5px 8px;\n}\n:deep(.cm-content .cm-pill:not(:last-of-type)) {\n margin-right: 0.5px;\n}\n:deep(.cm-content .cm-pill:not(:first-of-type)) {\n margin-left: 0.5px;\n}\n:deep(.cm-line) {\n overflow: hidden;\n padding: 0;\n text-overflow: ellipsis;\n}\n.filemask {\n mask-image: linear-gradient(\n to right,\n transparent 0,\n var(--scalar-background-2) 20px\n );\n}\n</style>\n","<script setup lang=\"ts\">\nimport { ScalarButton, ScalarIcon, ScalarTooltip } from '@scalar/components'\nimport { ScalarIconTrash } from '@scalar/icons'\nimport type { Environment } from '@scalar/oas-utils/entities/environment'\nimport type { RequestExampleParameter } from '@scalar/oas-utils/entities/spec'\nimport type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport { RouterLink, type RouteLocationRaw } from 'vue-router'\n\nimport CodeInput from '@/components/CodeInput/CodeInput.vue'\nimport DataTable from '@/components/DataTable/DataTable.vue'\nimport DataTableCell from '@/components/DataTable/DataTableCell.vue'\nimport DataTableCheckbox from '@/components/DataTable/DataTableCheckbox.vue'\nimport DataTableHeader from '@/components/DataTable/DataTableHeader.vue'\nimport DataTableRow from '@/components/DataTable/DataTableRow.vue'\nimport type { EnvVariable } from '@/store/active-entities'\n\nimport { hasItemProperties, parameterIsInvalid } from '../libs/request'\nimport RequestTableTooltip from './RequestTableTooltip.vue'\n\nconst props = withDefaults(\n defineProps<{\n items?: (RequestExampleParameter & { route?: RouteLocationRaw })[]\n /** Hide the enabled column */\n hasCheckboxDisabled?: boolean\n showUploadButton?: boolean\n isGlobal?: boolean\n isReadOnly?: boolean\n environment: Environment\n envVariables: EnvVariable[]\n workspace: Workspace\n invalidParams?: Set<string>\n label?: string\n }>(),\n {\n hasCheckboxDisabled: false,\n showUploadButton: false,\n isGlobal: false,\n isReadOnly: false,\n },\n)\n\nconst emit = defineEmits<{\n (e: 'updateRow', idx: number, field: 'key' | 'value', value: string): void\n (e: 'toggleRow', idx: number, enabled: boolean): void\n (e: 'addRow'): void\n (e: 'deleteRow', idx: number): void\n (e: 'inputFocus'): void\n (e: 'inputBlur'): void\n (e: 'uploadFile', idx: number): void\n (e: 'removeFile', idx: number): void\n}>()\n\nconst columns = ['', '', '36px']\n\nconst handleSelectVariable = (\n idx: number,\n field: 'key' | 'value',\n value: string,\n) => {\n emit('updateRow', idx, field, value)\n}\n\nconst handleFileUpload = (idx: number) => {\n emit('uploadFile', idx)\n}\n\nconst flattenValue = (item: RequestExampleParameter) => {\n return Array.isArray(item.default) && item.default.length === 1\n ? item.default[0]\n : item.default\n}\n\n// Shows delete button if the item has key or value filled\nconst showDeleteButton = (item: RequestExampleParameter) => {\n return Boolean(item.key || item.value)\n}\n</script>\n<template>\n <DataTable\n class=\"group/table flex-1\"\n :columns=\"columns\">\n <DataTableRow class=\"sr-only !block\">\n <DataTableHeader>{{ label }} Enabled</DataTableHeader>\n <DataTableHeader>{{ label }} Key</DataTableHeader>\n <DataTableHeader>{{ label }} Value</DataTableHeader>\n </DataTableRow>\n <DataTableRow\n v-for=\"(item, idx) in items\"\n :id=\"item.key\"\n :key=\"idx\"\n :class=\"{\n alert: parameterIsInvalid(item).value,\n error: invalidParams && invalidParams.has(item.key),\n }\">\n <template v-if=\"isGlobal\">\n <RouterLink\n class=\"text-c-2 flex items-center justify-center border-t !border-r\"\n :to=\"item.route ?? {}\">\n <span class=\"sr-only\">Global</span>\n <ScalarTooltip\n content=\"Global cookies are shared across the whole workspace.\"\n placement=\"top\">\n <ScalarIcon\n tabindex=\"0\"\n class=\"text-c-1\"\n icon=\"Globe\"\n size=\"xs\" />\n </ScalarTooltip>\n </RouterLink>\n </template>\n <template v-else>\n <DataTableCheckbox\n class=\"!border-r\"\n :disabled=\"props.hasCheckboxDisabled\"\n :modelValue=\"item.enabled\"\n @update:modelValue=\"(v) => emit('toggleRow', idx, v)\" />\n </template>\n <DataTableCell>\n <CodeInput\n :aria-label=\"`${label} Key`\"\n disableCloseBrackets\n :disabled=\"props.isReadOnly\"\n disableEnter\n disableTabIndent\n lineWrapping\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :modelValue=\"item.key\"\n placeholder=\"Key\"\n :required=\"Boolean(item.required)\"\n :workspace=\"workspace\"\n @blur=\"emit('inputBlur')\"\n @focus=\"emit('inputFocus')\"\n @selectVariable=\"(v: string) => handleSelectVariable(idx, 'key', v)\"\n @update:modelValue=\"\n (v: string) => emit('updateRow', idx, 'key', v)\n \" />\n </DataTableCell>\n <DataTableCell>\n <CodeInput\n :aria-label=\"`${label} Value`\"\n :class=\"\n hasItemProperties(item)\n ? 'pr-6 group-hover:pr-10 group-has-[.cm-focused]:pr-10'\n : 'group-hover:pr-6 group-has-[.cm-focused]:pr-6'\n \"\n :default=\"item.default\"\n disableCloseBrackets\n :disabled=\"props.isReadOnly\"\n disableEnter\n disableTabIndent\n lineWrapping\n :enum=\"item.enum ?? []\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :examples=\"item.examples ?? []\"\n :max=\"item.maximum\"\n :min=\"item.minimum\"\n :modelValue=\"item.value\"\n :nullable=\"Boolean(item.nullable)\"\n placeholder=\"Value\"\n :type=\"item.type\"\n :workspace=\"workspace\"\n @blur=\"emit('inputBlur')\"\n @focus=\"emit('inputFocus')\"\n @selectVariable=\"(v: string) => handleSelectVariable(idx, 'value', v)\"\n @update:modelValue=\"\n (v: string) => emit('updateRow', idx, 'value', v)\n \">\n <template #icon>\n <ScalarButton\n v-if=\"showDeleteButton(item) && !item.required\"\n :class=\"{\n '-mr-0.5': hasItemProperties(item),\n }\"\n class=\"text-c-2 hover:text-c-1 hover:bg-b-2 z-context hidden h-fit rounded p-1 group-hover:flex group-has-[.cm-focused]:flex\"\n size=\"sm\"\n variant=\"ghost\"\n @click=\"emit('deleteRow', idx)\">\n <ScalarIconTrash class=\"size-3.5\" />\n </ScalarButton>\n <RequestTableTooltip\n v-if=\"hasItemProperties(item)\"\n :item=\"{ ...item, default: flattenValue(item) }\" />\n </template>\n </CodeInput>\n </DataTableCell>\n <DataTableCell\n v-if=\"showUploadButton\"\n class=\"group/upload flex items-center justify-center whitespace-nowrap\">\n <template v-if=\"item.file\">\n <div\n class=\"text-c-2 filemask flex w-full max-w-[100%] items-end justify-end overflow-hidden p-1\">\n <span>{{ item.file?.name }}</span>\n </div>\n <button\n class=\"bg-b-2 centered-x centered-y absolute hidden w-[calc(100%_-_8px)] rounded p-0.5 text-center text-xs font-medium group-hover/upload:block\"\n type=\"button\"\n @click=\"emit('removeFile', idx)\">\n Delete\n </button>\n </template>\n <template v-else>\n <div class=\"p-0.5\">\n <ScalarButton\n class=\"bg-b-2 hover:bg-b-3 text-c-2 h-fit border-0 py-px shadow-none\"\n size=\"sm\"\n variant=\"outlined\"\n @click=\"handleFileUpload(idx)\">\n <span>Upload File</span>\n <ScalarIcon\n class=\"ml-1\"\n icon=\"Upload\"\n size=\"xs\"\n thickness=\"2.5\" />\n </ScalarButton>\n </div>\n </template>\n </DataTableCell>\n </DataTableRow>\n </DataTable>\n</template>\n<style scoped>\n:deep(.cm-editor) {\n padding: 0;\n}\n:deep(.cm-content) {\n align-items: center;\n background-color: transparent;\n display: flex;\n font-family: var(--scalar-font);\n font-size: var(--scalar-small);\n padding: 5px 8px;\n width: 100%;\n}\n:deep(.cm-content):has(.cm-pill) {\n padding: 5px 8px;\n}\n:deep(.cm-content .cm-pill:not(:last-of-type)) {\n margin-right: 0.5px;\n}\n:deep(.cm-content .cm-pill:not(:first-of-type)) {\n margin-left: 0.5px;\n}\n:deep(.cm-line) {\n overflow: hidden;\n padding: 0;\n text-overflow: ellipsis;\n}\n.filemask {\n mask-image: linear-gradient(\n to right,\n transparent 0,\n var(--scalar-background-2) 20px\n );\n}\n</style>\n","<script setup lang=\"ts\">\nimport { ScalarButton, ScalarIcon, ScalarListbox } from '@scalar/components'\nimport type { Environment } from '@scalar/oas-utils/entities/environment'\nimport {\n requestExampleParametersSchema,\n type Operation,\n type RequestExample,\n} from '@scalar/oas-utils/entities/spec'\nimport type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport { canMethodHaveBody } from '@scalar/oas-utils/helpers'\nimport type { CodeMirrorLanguage } from '@scalar/use-codemirror'\nimport type { Entries } from 'type-fest'\nimport { computed, nextTick, ref, watch } from 'vue'\n\nimport CodeInput from '@/components/CodeInput/CodeInput.vue'\nimport DataTable from '@/components/DataTable/DataTable.vue'\nimport DataTableHeader from '@/components/DataTable/DataTableHeader.vue'\nimport DataTableRow from '@/components/DataTable/DataTableRow.vue'\nimport ViewLayoutCollapse from '@/components/ViewLayout/ViewLayoutCollapse.vue'\nimport { useFileDialog } from '@/hooks'\nimport { useWorkspace } from '@/store'\nimport type { EnvVariable } from '@/store/active-entities'\n\nimport RequestTable from './RequestTable.vue'\n\nconst { example, operation, environment, envVariables, workspace, title } =\n defineProps<{\n example: RequestExample\n operation: Operation\n environment: Environment\n envVariables: EnvVariable[]\n workspace: Workspace\n title: string\n }>()\n\nconst { requestExampleMutators } = useWorkspace()\n\n/** use-codemirror package to be updated accordingly */\nconst contentTypeToLanguageMap = {\n json: 'json',\n xml: 'xml',\n yaml: 'yaml',\n edn: 'edn',\n other: 'html',\n} as const\n\nconst contentTypes = {\n multipartForm: 'Multipart Form',\n formUrlEncoded: 'Form URL Encoded',\n binaryFile: 'Binary File',\n json: 'JSON',\n xml: 'XML',\n yaml: 'YAML',\n edn: 'EDN',\n other: 'Other',\n none: 'None',\n} as const\ntype ContentType = keyof typeof contentTypes\n\n/** Convert content types to options for the dropdown */\nconst contentTypeOptions = (\n Object.entries(contentTypes) as Entries<typeof contentTypes>\n).map(([id, label]) => ({\n id,\n label,\n}))\n\n/** Match the activeBody to the contentTypeOptions */\nconst activeExampleContentType = computed(() => {\n const { activeBody, formData, raw } = example.body\n\n // Form\n if (activeBody === 'formData') {\n return formData?.encoding === 'urlencoded'\n ? 'formUrlEncoded'\n : 'multipartForm'\n }\n // Binary\n if (activeBody === 'binary') {\n return 'binaryFile'\n }\n // Raw\n if (activeBody === 'raw' && raw?.encoding) {\n if (raw.encoding === 'html' || raw.encoding === 'text') {\n return 'other'\n }\n return raw.encoding\n }\n\n // Set content type from request if present\n const contentType = Object.keys(operation.requestBody?.content || {})[0]\n\n return contentType || 'none'\n})\n/** Selected ref from options above */\nconst selectedContentType = computed({\n get: () =>\n contentTypeOptions.find(\n (opt) => opt.id === activeExampleContentType.value,\n ) ??\n contentTypeOptions[contentTypeOptions.length - 1] ??\n contentTypeOptions[0],\n set: (opt) => {\n if (opt?.id) {\n updateActiveBody(opt.id)\n }\n },\n})\nconst tableWrapperRef = ref<HTMLInputElement | null>(null)\n\nconst codeInputLanguage = computed(() => {\n const type = selectedContentType.value\n ?.id as keyof typeof contentTypeToLanguageMap\n return contentTypeToLanguageMap[type] ?? 'plaintext'\n})\n\nconst deleteRow = (rowIdx: number) => {\n const currentParams = formParams.value\n if (currentParams.length > rowIdx) {\n const updatedParams = [...currentParams]\n updatedParams.splice(rowIdx, 1)\n\n requestExampleMutators.edit(\n example.uid,\n 'body.formData.value',\n updatedParams,\n )\n }\n}\n\n/** Update a field in a parameter row */\nconst updateRow = (rowIdx: number, field: 'key' | 'value', value: string) => {\n const currentParams = formParams.value\n\n if (currentParams.length > rowIdx) {\n const updatedParams = [...currentParams]\n updatedParams[rowIdx] = {\n ...updatedParams[rowIdx],\n value: updatedParams[rowIdx]?.value || '',\n key: updatedParams[rowIdx]?.key || '',\n enabled: updatedParams[rowIdx]?.enabled ?? false,\n [field]: value || '',\n }\n\n /** enable row key or value is filled */\n if (\n updatedParams[rowIdx]?.key !== '' ||\n updatedParams[rowIdx]?.value !== ''\n ) {\n updatedParams[rowIdx].enabled = true\n }\n\n /** check key and value input state */\n if (\n updatedParams[rowIdx]?.key === '' &&\n updatedParams[rowIdx]?.value === ''\n ) {\n /** remove if empty */\n updatedParams.splice(rowIdx, 1)\n }\n\n requestExampleMutators.edit(\n example.uid,\n 'body.formData.value',\n updatedParams,\n )\n } else {\n /** if there is no row at the index, add a new one */\n const payload = [requestExampleParametersSchema.parse({ [field]: value })]\n\n requestExampleMutators.edit(example.uid, 'body.formData.value', payload)\n\n /** focus the new row */\n nextTick(() => {\n if (!tableWrapperRef.value) {\n return\n }\n const inputs = tableWrapperRef.value.querySelectorAll('input')\n const inputsIndex = field === 'key' ? 0 : 1\n inputs[inputsIndex]?.focus()\n })\n }\n\n // Add a new row if the updated row is the last one\n if (rowIdx === currentParams.length - 1) {\n addRow()\n }\n}\n\nconst formParams = computed(() => example.body.formData?.value ?? [])\n\n/** ensure one empty row by default */\nconst defaultRow = () => {\n const lastParam = formParams.value[formParams.value.length - 1]\n if (!lastParam || lastParam.key !== '' || lastParam.value !== '') {\n addRow()\n }\n}\n\n/** Add a new row to a given parameter list */\nconst addRow = () => {\n /** Create a new parameter instance with 'enabled' set to false */\n const newParam = requestExampleParametersSchema.parse({\n enabled: false,\n })\n const newParams = [...formParams.value, newParam]\n\n // Ensure we have formData\n if (example.body.formData) {\n requestExampleMutators.edit(example.uid, 'body.formData.value', newParams)\n } else {\n requestExampleMutators.edit(example.uid, 'body.formData', {\n value: newParams,\n encoding: 'form-data',\n })\n }\n}\n\n/** Enable and disables the row */\nconst toggleRow = (rowIdx: number, enabled: boolean) => {\n const currentParams = formParams.value\n if (currentParams.length > rowIdx) {\n const updatedParams = [...currentParams]\n if (updatedParams[rowIdx]) {\n updatedParams[rowIdx].enabled = enabled\n }\n\n requestExampleMutators.edit(\n example.uid,\n 'body.formData.value',\n updatedParams,\n )\n }\n}\n\nconst updateRequestBody = (value: string) =>\n requestExampleMutators.edit(example.uid, 'body.raw.value', value)\n\n/** Take the select option and return bodyType with encoding and header */\nconst getBodyType = (type: ContentType) => {\n if (type === 'multipartForm') {\n return {\n activeBody: 'formData',\n encoding: 'form-data',\n header: 'multipart/form-data',\n } as const\n }\n if (type === 'formUrlEncoded') {\n return {\n activeBody: 'formData',\n encoding: 'urlencoded',\n header: 'application/x-www-form-urlencoded',\n } as const\n }\n if (type === 'binaryFile') {\n return {\n activeBody: 'binary',\n encoding: undefined,\n header: 'application/octet-stream',\n } as const\n }\n if (type === 'json') {\n const contentTypes = Object.keys(operation.requestBody?.content ?? {})\n\n // Gets json content types including vendor specific ones\n const jsonContentType =\n contentTypes.find((t) => t.includes('json') || t.endsWith('+json')) ||\n 'application/json'\n\n return {\n activeBody: 'raw',\n encoding: 'json',\n header: jsonContentType,\n } as const\n }\n if (type === 'xml') {\n return {\n activeBody: 'raw',\n encoding: 'xml',\n header: 'application/xml',\n } as const\n }\n if (type === 'yaml') {\n return {\n activeBody: 'raw',\n encoding: 'yaml',\n header: 'application/yaml',\n } as const\n }\n if (type === 'edn') {\n return {\n activeBody: 'raw',\n encoding: 'edn',\n header: 'application/edn',\n } as const\n }\n if (type === 'other') {\n const opContentTypes = Object.keys(operation.requestBody?.content ?? {})\n const textContentType = opContentTypes.find((t) => t.startsWith('text/'))\n\n return {\n activeBody: 'raw',\n encoding: textContentType ? 'text' : 'html',\n header: textContentType ?? 'application/html',\n } as const\n }\n\n return { activeBody: 'raw', encoding: undefined, header: undefined } as const\n}\n\n/** Set active body AND encoding */\nconst updateActiveBody = (type: ContentType) => {\n const { activeBody, encoding, header } = getBodyType(type)\n requestExampleMutators.edit(example.uid, 'body.activeBody', activeBody)\n\n // Set encoding safely\n if (encoding && activeBody === 'raw') {\n requestExampleMutators.edit(example.uid, 'body.raw', {\n encoding,\n value: example.body.raw?.value ?? '',\n })\n } else if (encoding && activeBody === 'formData') {\n requestExampleMutators.edit(example.uid, 'body.formData', {\n encoding,\n value: example.body.formData?.value ?? [],\n })\n }\n // Remove raw if no encoding and not binary\n else if (!encoding && activeBody !== 'binary') {\n const { raw: deleteMe, ...body } = example.body\n requestExampleMutators.edit(example.uid, 'body', body)\n }\n\n // Handle headers\n const headers = [...example.parameters.headers]\n const contentTypeIdx = headers.findIndex(\n (h) => h.key.toLowerCase() === 'content-type',\n )\n\n if (contentTypeIdx >= 0) {\n // Update header if exists\n if (header && headers[contentTypeIdx]) {\n headers[contentTypeIdx].value = header\n }\n // Remove header if we don't want one\n else if (\n headers[contentTypeIdx] &&\n (activeBody !== 'raw' || type === 'none')\n ) {\n headers.splice(contentTypeIdx, 1)\n }\n }\n // Add header if doesn't have one\n else if (header) {\n const lastHeader = headers[headers.length - 1]\n // Add header before last if empty to prevent empty row duplication\n if (lastHeader && lastHeader.key === '' && lastHeader.value === '') {\n headers.splice(headers.length - 1, 0, {\n key: 'Content-Type',\n value: header,\n enabled: true,\n })\n } else {\n headers.push({\n key: 'Content-Type',\n value: header,\n enabled: true,\n })\n }\n }\n\n requestExampleMutators.edit(example.uid, 'parameters.headers', headers)\n}\n\nconst handleFileUploadFormData = (rowIdx: number) => {\n const { open } = useFileDialog({\n onChange: (files) => {\n const file = files?.[0]\n if (file) {\n const currentParams = formParams.value\n const updatedParams = [...currentParams]\n updatedParams[rowIdx] = {\n ...updatedParams[rowIdx],\n file,\n value: updatedParams[rowIdx]?.value || file.name,\n key: updatedParams[rowIdx]?.key || file.name,\n enabled: true,\n }\n requestExampleMutators.edit(\n example.uid,\n 'body.formData.value',\n updatedParams,\n )\n\n defaultRow()\n }\n },\n multiple: false,\n accept: '*/*',\n })\n open()\n}\n\nconst removeBinaryFile = () =>\n requestExampleMutators.edit(example.uid, 'body.binary', undefined)\n\nfunction handleRemoveFileFormData(rowIdx: number) {\n const currentParams = formParams.value\n const updatedParams = [...currentParams]\n const param = currentParams[rowIdx]\n const file = param?.file as File | undefined\n\n // Empty key value or non updated file name then remove the row\n if (\n currentParams.length > 1 &&\n ((!param?.key && !param?.value) ||\n (file && param?.key === file.name && param?.value === file.name))\n ) {\n updatedParams.splice(rowIdx, 1)\n } else {\n // File name updated then remove file only\n if (updatedParams[rowIdx]) {\n updatedParams[rowIdx].file = undefined\n }\n }\n requestExampleMutators.edit(example.uid, 'body.formData.value', updatedParams)\n}\n\nfunction handleFileUpload() {\n const { open } = useFileDialog({\n onChange: (files) => {\n const file = files?.[0]\n if (file) {\n requestExampleMutators.edit(example.uid, 'body.binary', file)\n }\n },\n multiple: false,\n accept: '*/*',\n })\n open()\n}\n\n// we always add an empty row if its empty :)\nwatch(\n selectedContentType,\n (val) => {\n if (['multipartForm', 'formUrlEncoded'].includes(val?.id || '')) {\n defaultRow()\n }\n },\n { immediate: true },\n)\n\nwatch(\n () => example.uid,\n () => {\n operation.method &&\n canMethodHaveBody(operation.method) &&\n updateActiveBody(activeExampleContentType.value as ContentType)\n\n // Add extra row on page route change as well\n if (\n ['multipartForm', 'formUrlEncoded'].includes(\n activeExampleContentType.value as ContentType,\n )\n ) {\n defaultRow()\n }\n },\n { immediate: true },\n)\n\nconst exampleOptions = computed(() => {\n const contentType = selectedContentType.value?.id\n const { header } = getBodyType(contentType as ContentType)\n const content = operation.requestBody?.content || {}\n const examples = header ? content[header]?.examples || {} : {}\n return Object.entries(examples).map(([key, value]) => ({\n id: key,\n label: key,\n value,\n }))\n})\n\nconst selectedExample = computed({\n get: () => {\n const rawValue = example.body.raw?.value ?? '{}'\n try {\n const parsedValue = JSON.parse(rawValue)\n const getExample = exampleOptions.value.find((e) => {\n const exampleValue = e.value as {\n value: Record<string, string>\n }\n return (\n JSON.stringify(exampleValue.value) === JSON.stringify(parsedValue)\n )\n })\n return getExample ?? exampleOptions.value[0]\n } catch {\n return exampleOptions.value[0]\n }\n },\n set: (opt) => {\n if (opt?.id) {\n const exampleOption = exampleOptions.value.find((e) => e.id === opt.id)\n if (exampleOption) {\n const exampleValue = exampleOption.value as {\n value: Record<string, string>\n }\n updateRequestBody(JSON.stringify(exampleValue.value, null, 2))\n }\n }\n },\n})\n</script>\n<template>\n <ViewLayoutCollapse>\n <template #title>{{ title }}</template>\n <DataTable\n :columns=\"['']\"\n presentational>\n <DataTableRow>\n <DataTableHeader\n class=\"relative col-span-full flex h-8 cursor-pointer items-center justify-between !p-0\">\n <ScalarListbox\n v-model=\"selectedContentType\"\n :options=\"contentTypeOptions\"\n teleport>\n <ScalarButton\n class=\"text-c-2 hover:text-c-1 flex h-full w-fit gap-1.5 px-3 font-normal\"\n variant=\"ghost\">\n <span>{{ selectedContentType?.label }}</span>\n <ScalarIcon\n icon=\"ChevronDown\"\n size=\"md\" />\n </ScalarButton>\n </ScalarListbox>\n <ScalarListbox\n v-if=\"exampleOptions.length > 0\"\n v-model=\"selectedExample\"\n :options=\"exampleOptions\"\n side=\"left\"\n teleport>\n <ScalarButton\n class=\"text-c-2 hover:text-c-1 flex h-full w-fit gap-1.5 px-2 font-normal\"\n fullWidth\n variant=\"ghost\">\n <span>{{ selectedExample?.label }}</span>\n <ScalarIcon\n icon=\"ChevronDown\"\n size=\"md\" />\n </ScalarButton>\n </ScalarListbox>\n </DataTableHeader>\n </DataTableRow>\n <DataTableRow>\n <template v-if=\"selectedContentType?.id === 'none'\">\n <div\n class=\"text-c-3 flex min-h-10 w-full items-center justify-center border-t p-2 text-sm\">\n <span>No Body</span>\n </div>\n </template>\n <template v-else-if=\"selectedContentType?.id === 'binaryFile'\">\n <div\n class=\"flex items-center justify-center overflow-hidden border-t p-1.5\">\n <template v-if=\"example.body.binary\">\n <span\n class=\"text-c-2 w-full max-w-full overflow-hidden rounded border px-1.5 py-1 text-xs whitespace-nowrap\">\n {{ (example.body.binary as File).name }}\n </span>\n <ScalarButton\n class=\"bg-b-2 hover:bg-b-3 text-c-2 ml-1 border-0 shadow-none\"\n size=\"sm\"\n variant=\"outlined\"\n @click=\"removeBinaryFile\">\n Delete\n </ScalarButton>\n </template>\n <template v-else>\n <ScalarButton\n class=\"bg-b-2 hover:bg-b-3 text-c-2 border-0 shadow-none\"\n size=\"sm\"\n variant=\"outlined\"\n @click=\"handleFileUpload\">\n <span>Upload File</span>\n <ScalarIcon\n class=\"ml-1\"\n icon=\"Upload\"\n size=\"xs\"\n thickness=\"2.5\" />\n </ScalarButton>\n </template>\n </div>\n </template>\n <template v-else-if=\"selectedContentType?.id == 'multipartForm'\">\n <RequestTable\n ref=\"tableWrapperRef\"\n class=\"!m-0 rounded-t-none border-t-0 border-r-0 border-b-0 border-l-0 shadow-none\"\n :columns=\"['32px', '', '', '104px']\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :items=\"formParams\"\n showUploadButton\n :workspace=\"workspace\"\n @deleteRow=\"deleteRow\"\n @removeFile=\"handleRemoveFileFormData\"\n @toggleRow=\"toggleRow\"\n @updateRow=\"updateRow\"\n @uploadFile=\"handleFileUploadFormData\" />\n </template>\n <template v-else-if=\"selectedContentType?.id == 'formUrlEncoded'\">\n <RequestTable\n ref=\"tableWrapperRef\"\n class=\"!m-0 rounded-t-none border-t-0 border-r-0 border-b-0 border-l-0 shadow-none\"\n :columns=\"['32px', '', '', '104px']\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :items=\"formParams\"\n showUploadButton\n :workspace=\"workspace\"\n @deleteRow=\"deleteRow\"\n @removeFile=\"handleRemoveFileFormData\"\n @toggleRow=\"toggleRow\"\n @updateRow=\"updateRow\"\n @uploadFile=\"handleFileUploadFormData\" />\n </template>\n <template v-else>\n <!-- TODO: remove this as type hack when we add syntax highlighting -->\n <CodeInput\n class=\"border-t px-3\"\n content=\"\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :language=\"codeInputLanguage as CodeMirrorLanguage\"\n lineNumbers\n lint\n :modelValue=\"example.body?.raw?.value ?? ''\"\n :workspace=\"workspace\"\n @update:modelValue=\"updateRequestBody\" />\n </template>\n </DataTableRow>\n <!-- Hacky... but effective, extra table row to trick the last group -->\n <DataTableRow />\n </DataTable>\n </ViewLayoutCollapse>\n</template>\n<style scoped>\n:deep(.cm-content) {\n font-size: var(--scalar-small);\n}\n</style>\n","<script setup lang=\"ts\">\nimport { ScalarButton, ScalarIcon, ScalarListbox } from '@scalar/components'\nimport type { Environment } from '@scalar/oas-utils/entities/environment'\nimport {\n requestExampleParametersSchema,\n type Operation,\n type RequestExample,\n} from '@scalar/oas-utils/entities/spec'\nimport type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport { canMethodHaveBody } from '@scalar/oas-utils/helpers'\nimport type { CodeMirrorLanguage } from '@scalar/use-codemirror'\nimport type { Entries } from 'type-fest'\nimport { computed, nextTick, ref, watch } from 'vue'\n\nimport CodeInput from '@/components/CodeInput/CodeInput.vue'\nimport DataTable from '@/components/DataTable/DataTable.vue'\nimport DataTableHeader from '@/components/DataTable/DataTableHeader.vue'\nimport DataTableRow from '@/components/DataTable/DataTableRow.vue'\nimport ViewLayoutCollapse from '@/components/ViewLayout/ViewLayoutCollapse.vue'\nimport { useFileDialog } from '@/hooks'\nimport { useWorkspace } from '@/store'\nimport type { EnvVariable } from '@/store/active-entities'\n\nimport RequestTable from './RequestTable.vue'\n\nconst { example, operation, environment, envVariables, workspace, title } =\n defineProps<{\n example: RequestExample\n operation: Operation\n environment: Environment\n envVariables: EnvVariable[]\n workspace: Workspace\n title: string\n }>()\n\nconst { requestExampleMutators } = useWorkspace()\n\n/** use-codemirror package to be updated accordingly */\nconst contentTypeToLanguageMap = {\n json: 'json',\n xml: 'xml',\n yaml: 'yaml',\n edn: 'edn',\n other: 'html',\n} as const\n\nconst contentTypes = {\n multipartForm: 'Multipart Form',\n formUrlEncoded: 'Form URL Encoded',\n binaryFile: 'Binary File',\n json: 'JSON',\n xml: 'XML',\n yaml: 'YAML',\n edn: 'EDN',\n other: 'Other',\n none: 'None',\n} as const\ntype ContentType = keyof typeof contentTypes\n\n/** Convert content types to options for the dropdown */\nconst contentTypeOptions = (\n Object.entries(contentTypes) as Entries<typeof contentTypes>\n).map(([id, label]) => ({\n id,\n label,\n}))\n\n/** Match the activeBody to the contentTypeOptions */\nconst activeExampleContentType = computed(() => {\n const { activeBody, formData, raw } = example.body\n\n // Form\n if (activeBody === 'formData') {\n return formData?.encoding === 'urlencoded'\n ? 'formUrlEncoded'\n : 'multipartForm'\n }\n // Binary\n if (activeBody === 'binary') {\n return 'binaryFile'\n }\n // Raw\n if (activeBody === 'raw' && raw?.encoding) {\n if (raw.encoding === 'html' || raw.encoding === 'text') {\n return 'other'\n }\n return raw.encoding\n }\n\n // Set content type from request if present\n const contentType = Object.keys(operation.requestBody?.content || {})[0]\n\n return contentType || 'none'\n})\n/** Selected ref from options above */\nconst selectedContentType = computed({\n get: () =>\n contentTypeOptions.find(\n (opt) => opt.id === activeExampleContentType.value,\n ) ??\n contentTypeOptions[contentTypeOptions.length - 1] ??\n contentTypeOptions[0],\n set: (opt) => {\n if (opt?.id) {\n updateActiveBody(opt.id)\n }\n },\n})\nconst tableWrapperRef = ref<HTMLInputElement | null>(null)\n\nconst codeInputLanguage = computed(() => {\n const type = selectedContentType.value\n ?.id as keyof typeof contentTypeToLanguageMap\n return contentTypeToLanguageMap[type] ?? 'plaintext'\n})\n\nconst deleteRow = (rowIdx: number) => {\n const currentParams = formParams.value\n if (currentParams.length > rowIdx) {\n const updatedParams = [...currentParams]\n updatedParams.splice(rowIdx, 1)\n\n requestExampleMutators.edit(\n example.uid,\n 'body.formData.value',\n updatedParams,\n )\n }\n}\n\n/** Update a field in a parameter row */\nconst updateRow = (rowIdx: number, field: 'key' | 'value', value: string) => {\n const currentParams = formParams.value\n\n if (currentParams.length > rowIdx) {\n const updatedParams = [...currentParams]\n updatedParams[rowIdx] = {\n ...updatedParams[rowIdx],\n value: updatedParams[rowIdx]?.value || '',\n key: updatedParams[rowIdx]?.key || '',\n enabled: updatedParams[rowIdx]?.enabled ?? false,\n [field]: value || '',\n }\n\n /** enable row key or value is filled */\n if (\n updatedParams[rowIdx]?.key !== '' ||\n updatedParams[rowIdx]?.value !== ''\n ) {\n updatedParams[rowIdx].enabled = true\n }\n\n /** check key and value input state */\n if (\n updatedParams[rowIdx]?.key === '' &&\n updatedParams[rowIdx]?.value === ''\n ) {\n /** remove if empty */\n updatedParams.splice(rowIdx, 1)\n }\n\n requestExampleMutators.edit(\n example.uid,\n 'body.formData.value',\n updatedParams,\n )\n } else {\n /** if there is no row at the index, add a new one */\n const payload = [requestExampleParametersSchema.parse({ [field]: value })]\n\n requestExampleMutators.edit(example.uid, 'body.formData.value', payload)\n\n /** focus the new row */\n nextTick(() => {\n if (!tableWrapperRef.value) {\n return\n }\n const inputs = tableWrapperRef.value.querySelectorAll('input')\n const inputsIndex = field === 'key' ? 0 : 1\n inputs[inputsIndex]?.focus()\n })\n }\n\n // Add a new row if the updated row is the last one\n if (rowIdx === currentParams.length - 1) {\n addRow()\n }\n}\n\nconst formParams = computed(() => example.body.formData?.value ?? [])\n\n/** ensure one empty row by default */\nconst defaultRow = () => {\n const lastParam = formParams.value[formParams.value.length - 1]\n if (!lastParam || lastParam.key !== '' || lastParam.value !== '') {\n addRow()\n }\n}\n\n/** Add a new row to a given parameter list */\nconst addRow = () => {\n /** Create a new parameter instance with 'enabled' set to false */\n const newParam = requestExampleParametersSchema.parse({\n enabled: false,\n })\n const newParams = [...formParams.value, newParam]\n\n // Ensure we have formData\n if (example.body.formData) {\n requestExampleMutators.edit(example.uid, 'body.formData.value', newParams)\n } else {\n requestExampleMutators.edit(example.uid, 'body.formData', {\n value: newParams,\n encoding: 'form-data',\n })\n }\n}\n\n/** Enable and disables the row */\nconst toggleRow = (rowIdx: number, enabled: boolean) => {\n const currentParams = formParams.value\n if (currentParams.length > rowIdx) {\n const updatedParams = [...currentParams]\n if (updatedParams[rowIdx]) {\n updatedParams[rowIdx].enabled = enabled\n }\n\n requestExampleMutators.edit(\n example.uid,\n 'body.formData.value',\n updatedParams,\n )\n }\n}\n\nconst updateRequestBody = (value: string) =>\n requestExampleMutators.edit(example.uid, 'body.raw.value', value)\n\n/** Take the select option and return bodyType with encoding and header */\nconst getBodyType = (type: ContentType) => {\n if (type === 'multipartForm') {\n return {\n activeBody: 'formData',\n encoding: 'form-data',\n header: 'multipart/form-data',\n } as const\n }\n if (type === 'formUrlEncoded') {\n return {\n activeBody: 'formData',\n encoding: 'urlencoded',\n header: 'application/x-www-form-urlencoded',\n } as const\n }\n if (type === 'binaryFile') {\n return {\n activeBody: 'binary',\n encoding: undefined,\n header: 'application/octet-stream',\n } as const\n }\n if (type === 'json') {\n const contentTypes = Object.keys(operation.requestBody?.content ?? {})\n\n // Gets json content types including vendor specific ones\n const jsonContentType =\n contentTypes.find((t) => t.includes('json') || t.endsWith('+json')) ||\n 'application/json'\n\n return {\n activeBody: 'raw',\n encoding: 'json',\n header: jsonContentType,\n } as const\n }\n if (type === 'xml') {\n return {\n activeBody: 'raw',\n encoding: 'xml',\n header: 'application/xml',\n } as const\n }\n if (type === 'yaml') {\n return {\n activeBody: 'raw',\n encoding: 'yaml',\n header: 'application/yaml',\n } as const\n }\n if (type === 'edn') {\n return {\n activeBody: 'raw',\n encoding: 'edn',\n header: 'application/edn',\n } as const\n }\n if (type === 'other') {\n const opContentTypes = Object.keys(operation.requestBody?.content ?? {})\n const textContentType = opContentTypes.find((t) => t.startsWith('text/'))\n\n return {\n activeBody: 'raw',\n encoding: textContentType ? 'text' : 'html',\n header: textContentType ?? 'application/html',\n } as const\n }\n\n return { activeBody: 'raw', encoding: undefined, header: undefined } as const\n}\n\n/** Set active body AND encoding */\nconst updateActiveBody = (type: ContentType) => {\n const { activeBody, encoding, header } = getBodyType(type)\n requestExampleMutators.edit(example.uid, 'body.activeBody', activeBody)\n\n // Set encoding safely\n if (encoding && activeBody === 'raw') {\n requestExampleMutators.edit(example.uid, 'body.raw', {\n encoding,\n value: example.body.raw?.value ?? '',\n })\n } else if (encoding && activeBody === 'formData') {\n requestExampleMutators.edit(example.uid, 'body.formData', {\n encoding,\n value: example.body.formData?.value ?? [],\n })\n }\n // Remove raw if no encoding and not binary\n else if (!encoding && activeBody !== 'binary') {\n const { raw: deleteMe, ...body } = example.body\n requestExampleMutators.edit(example.uid, 'body', body)\n }\n\n // Handle headers\n const headers = [...example.parameters.headers]\n const contentTypeIdx = headers.findIndex(\n (h) => h.key.toLowerCase() === 'content-type',\n )\n\n if (contentTypeIdx >= 0) {\n // Update header if exists\n if (header && headers[contentTypeIdx]) {\n headers[contentTypeIdx].value = header\n }\n // Remove header if we don't want one\n else if (\n headers[contentTypeIdx] &&\n (activeBody !== 'raw' || type === 'none')\n ) {\n headers.splice(contentTypeIdx, 1)\n }\n }\n // Add header if doesn't have one\n else if (header) {\n const lastHeader = headers[headers.length - 1]\n // Add header before last if empty to prevent empty row duplication\n if (lastHeader && lastHeader.key === '' && lastHeader.value === '') {\n headers.splice(headers.length - 1, 0, {\n key: 'Content-Type',\n value: header,\n enabled: true,\n })\n } else {\n headers.push({\n key: 'Content-Type',\n value: header,\n enabled: true,\n })\n }\n }\n\n requestExampleMutators.edit(example.uid, 'parameters.headers', headers)\n}\n\nconst handleFileUploadFormData = (rowIdx: number) => {\n const { open } = useFileDialog({\n onChange: (files) => {\n const file = files?.[0]\n if (file) {\n const currentParams = formParams.value\n const updatedParams = [...currentParams]\n updatedParams[rowIdx] = {\n ...updatedParams[rowIdx],\n file,\n value: updatedParams[rowIdx]?.value || file.name,\n key: updatedParams[rowIdx]?.key || file.name,\n enabled: true,\n }\n requestExampleMutators.edit(\n example.uid,\n 'body.formData.value',\n updatedParams,\n )\n\n defaultRow()\n }\n },\n multiple: false,\n accept: '*/*',\n })\n open()\n}\n\nconst removeBinaryFile = () =>\n requestExampleMutators.edit(example.uid, 'body.binary', undefined)\n\nfunction handleRemoveFileFormData(rowIdx: number) {\n const currentParams = formParams.value\n const updatedParams = [...currentParams]\n const param = currentParams[rowIdx]\n const file = param?.file as File | undefined\n\n // Empty key value or non updated file name then remove the row\n if (\n currentParams.length > 1 &&\n ((!param?.key && !param?.value) ||\n (file && param?.key === file.name && param?.value === file.name))\n ) {\n updatedParams.splice(rowIdx, 1)\n } else {\n // File name updated then remove file only\n if (updatedParams[rowIdx]) {\n updatedParams[rowIdx].file = undefined\n }\n }\n requestExampleMutators.edit(example.uid, 'body.formData.value', updatedParams)\n}\n\nfunction handleFileUpload() {\n const { open } = useFileDialog({\n onChange: (files) => {\n const file = files?.[0]\n if (file) {\n requestExampleMutators.edit(example.uid, 'body.binary', file)\n }\n },\n multiple: false,\n accept: '*/*',\n })\n open()\n}\n\n// we always add an empty row if its empty :)\nwatch(\n selectedContentType,\n (val) => {\n if (['multipartForm', 'formUrlEncoded'].includes(val?.id || '')) {\n defaultRow()\n }\n },\n { immediate: true },\n)\n\nwatch(\n () => example.uid,\n () => {\n operation.method &&\n canMethodHaveBody(operation.method) &&\n updateActiveBody(activeExampleContentType.value as ContentType)\n\n // Add extra row on page route change as well\n if (\n ['multipartForm', 'formUrlEncoded'].includes(\n activeExampleContentType.value as ContentType,\n )\n ) {\n defaultRow()\n }\n },\n { immediate: true },\n)\n\nconst exampleOptions = computed(() => {\n const contentType = selectedContentType.value?.id\n const { header } = getBodyType(contentType as ContentType)\n const content = operation.requestBody?.content || {}\n const examples = header ? content[header]?.examples || {} : {}\n return Object.entries(examples).map(([key, value]) => ({\n id: key,\n label: key,\n value,\n }))\n})\n\nconst selectedExample = computed({\n get: () => {\n const rawValue = example.body.raw?.value ?? '{}'\n try {\n const parsedValue = JSON.parse(rawValue)\n const getExample = exampleOptions.value.find((e) => {\n const exampleValue = e.value as {\n value: Record<string, string>\n }\n return (\n JSON.stringify(exampleValue.value) === JSON.stringify(parsedValue)\n )\n })\n return getExample ?? exampleOptions.value[0]\n } catch {\n return exampleOptions.value[0]\n }\n },\n set: (opt) => {\n if (opt?.id) {\n const exampleOption = exampleOptions.value.find((e) => e.id === opt.id)\n if (exampleOption) {\n const exampleValue = exampleOption.value as {\n value: Record<string, string>\n }\n updateRequestBody(JSON.stringify(exampleValue.value, null, 2))\n }\n }\n },\n})\n</script>\n<template>\n <ViewLayoutCollapse>\n <template #title>{{ title }}</template>\n <DataTable\n :columns=\"['']\"\n presentational>\n <DataTableRow>\n <DataTableHeader\n class=\"relative col-span-full flex h-8 cursor-pointer items-center justify-between !p-0\">\n <ScalarListbox\n v-model=\"selectedContentType\"\n :options=\"contentTypeOptions\"\n teleport>\n <ScalarButton\n class=\"text-c-2 hover:text-c-1 flex h-full w-fit gap-1.5 px-3 font-normal\"\n variant=\"ghost\">\n <span>{{ selectedContentType?.label }}</span>\n <ScalarIcon\n icon=\"ChevronDown\"\n size=\"md\" />\n </ScalarButton>\n </ScalarListbox>\n <ScalarListbox\n v-if=\"exampleOptions.length > 0\"\n v-model=\"selectedExample\"\n :options=\"exampleOptions\"\n side=\"left\"\n teleport>\n <ScalarButton\n class=\"text-c-2 hover:text-c-1 flex h-full w-fit gap-1.5 px-2 font-normal\"\n fullWidth\n variant=\"ghost\">\n <span>{{ selectedExample?.label }}</span>\n <ScalarIcon\n icon=\"ChevronDown\"\n size=\"md\" />\n </ScalarButton>\n </ScalarListbox>\n </DataTableHeader>\n </DataTableRow>\n <DataTableRow>\n <template v-if=\"selectedContentType?.id === 'none'\">\n <div\n class=\"text-c-3 flex min-h-10 w-full items-center justify-center border-t p-2 text-sm\">\n <span>No Body</span>\n </div>\n </template>\n <template v-else-if=\"selectedContentType?.id === 'binaryFile'\">\n <div\n class=\"flex items-center justify-center overflow-hidden border-t p-1.5\">\n <template v-if=\"example.body.binary\">\n <span\n class=\"text-c-2 w-full max-w-full overflow-hidden rounded border px-1.5 py-1 text-xs whitespace-nowrap\">\n {{ (example.body.binary as File).name }}\n </span>\n <ScalarButton\n class=\"bg-b-2 hover:bg-b-3 text-c-2 ml-1 border-0 shadow-none\"\n size=\"sm\"\n variant=\"outlined\"\n @click=\"removeBinaryFile\">\n Delete\n </ScalarButton>\n </template>\n <template v-else>\n <ScalarButton\n class=\"bg-b-2 hover:bg-b-3 text-c-2 border-0 shadow-none\"\n size=\"sm\"\n variant=\"outlined\"\n @click=\"handleFileUpload\">\n <span>Upload File</span>\n <ScalarIcon\n class=\"ml-1\"\n icon=\"Upload\"\n size=\"xs\"\n thickness=\"2.5\" />\n </ScalarButton>\n </template>\n </div>\n </template>\n <template v-else-if=\"selectedContentType?.id == 'multipartForm'\">\n <RequestTable\n ref=\"tableWrapperRef\"\n class=\"!m-0 rounded-t-none border-t-0 border-r-0 border-b-0 border-l-0 shadow-none\"\n :columns=\"['32px', '', '', '104px']\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :items=\"formParams\"\n showUploadButton\n :workspace=\"workspace\"\n @deleteRow=\"deleteRow\"\n @removeFile=\"handleRemoveFileFormData\"\n @toggleRow=\"toggleRow\"\n @updateRow=\"updateRow\"\n @uploadFile=\"handleFileUploadFormData\" />\n </template>\n <template v-else-if=\"selectedContentType?.id == 'formUrlEncoded'\">\n <RequestTable\n ref=\"tableWrapperRef\"\n class=\"!m-0 rounded-t-none border-t-0 border-r-0 border-b-0 border-l-0 shadow-none\"\n :columns=\"['32px', '', '', '104px']\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :items=\"formParams\"\n showUploadButton\n :workspace=\"workspace\"\n @deleteRow=\"deleteRow\"\n @removeFile=\"handleRemoveFileFormData\"\n @toggleRow=\"toggleRow\"\n @updateRow=\"updateRow\"\n @uploadFile=\"handleFileUploadFormData\" />\n </template>\n <template v-else>\n <!-- TODO: remove this as type hack when we add syntax highlighting -->\n <CodeInput\n class=\"border-t px-3\"\n content=\"\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :language=\"codeInputLanguage as CodeMirrorLanguage\"\n lineNumbers\n lint\n :modelValue=\"example.body?.raw?.value ?? ''\"\n :workspace=\"workspace\"\n @update:modelValue=\"updateRequestBody\" />\n </template>\n </DataTableRow>\n <!-- Hacky... but effective, extra table row to trick the last group -->\n <DataTableRow />\n </DataTable>\n </ViewLayoutCollapse>\n</template>\n<style scoped>\n:deep(.cm-content) {\n font-size: var(--scalar-small);\n}\n</style>\n","<script setup lang=\"ts\">\nimport { ScalarButton, ScalarTooltip } from '@scalar/components'\nimport type { Environment } from '@scalar/oas-utils/entities/environment'\nimport {\n requestExampleParametersSchema,\n type RequestExample,\n} from '@scalar/oas-utils/entities/spec'\nimport type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport { computed, nextTick, onMounted, ref, watch } from 'vue'\nimport type { RouteLocationRaw } from 'vue-router'\n\nimport ViewLayoutCollapse from '@/components/ViewLayout/ViewLayoutCollapse.vue'\nimport { useWorkspace } from '@/store'\nimport type { EnvVariable } from '@/store/active-entities'\nimport RequestTable from '@/views/Request/RequestSection/RequestTable.vue'\n\nconst {\n example,\n environment,\n envVariables,\n workspace,\n title,\n paramKey,\n readOnlyEntries = [],\n} = defineProps<{\n example: RequestExample\n environment: Environment\n envVariables: EnvVariable[]\n workspace: Workspace\n title: string\n label: string\n paramKey: keyof RequestExample['parameters']\n readOnlyEntries?: {\n key: string\n value: string\n enabled: boolean\n route: RouteLocationRaw\n }[]\n invalidParams: Set<string>\n}>()\n\nconst { requestExampleMutators } = useWorkspace()\n\nconst params = computed(() => example.parameters[paramKey] ?? [])\n\nonMounted(() => {\n nextTick(() => {\n defaultRow()\n })\n})\n\n/** Add a new row to a given parameter list */\nconst addRow = () => {\n /** Create a new parameter instance with 'enabled' set to false */\n const newParam = requestExampleParametersSchema.parse({ enabled: false })\n const newParams = [...params.value, newParam]\n\n requestExampleMutators.edit(example.uid, `parameters.${paramKey}`, newParams)\n}\n\nconst tableWrapperRef = ref<HTMLInputElement | null>(null)\n\n/** Update a field in a parameter row */\nconst updateRow = (rowIdx: number, field: 'key' | 'value', value: string) => {\n const currentParams = params.value\n if (currentParams.length > rowIdx) {\n const updatedParams = [...currentParams]\n if (!updatedParams[rowIdx]) {\n return\n }\n\n updatedParams[rowIdx] = { ...updatedParams[rowIdx], [field]: value }\n\n /** enable row key or value is filled */\n if (\n updatedParams[rowIdx].key !== '' ||\n updatedParams[rowIdx].value !== ''\n ) {\n updatedParams[rowIdx].enabled = true\n }\n\n /** check key and value input state */\n if (\n updatedParams[rowIdx].key === '' &&\n updatedParams[rowIdx].value === ''\n ) {\n /** remove if empty */\n updatedParams.splice(rowIdx, 1)\n }\n\n requestExampleMutators.edit(\n example.uid,\n `parameters.${paramKey}`,\n updatedParams,\n )\n } else {\n /** if there is no row at the index, add a new one */\n const payload = [requestExampleParametersSchema.parse({ [field]: value })]\n requestExampleMutators.edit(example.uid, `parameters.${paramKey}`, payload)\n\n /** focus the new row */\n nextTick(() => {\n if (!tableWrapperRef.value) {\n return\n }\n const inputs = tableWrapperRef.value.querySelectorAll('input')\n const inputsIndex = field === 'key' ? 0 : 1\n inputs[inputsIndex]?.focus()\n })\n }\n\n // Add a new row if the updated row is the last one\n if (rowIdx === currentParams.length - 1) {\n addRow()\n }\n}\n\n/** Toggle a parameter row on or off */\nconst toggleRow = (rowIdx: number, enabled: boolean) =>\n requestExampleMutators.edit(\n example.uid,\n `parameters.${paramKey}.${rowIdx}.enabled`,\n enabled,\n )\n\nconst deleteAllRows = () => {\n // filter out params that are enabled or required\n const exampleParams = params.value.filter((param) => param.required)\n\n requestExampleMutators.edit(\n example.uid,\n `parameters.${paramKey}`,\n exampleParams,\n )\n\n /** ensure one empty row after deleting all rows */\n nextTick(() => addRow())\n}\n\nconst deleteRow = (rowIdx: number) => {\n const currentParams = params.value\n if (currentParams.length > rowIdx) {\n const updatedParams = [...currentParams]\n updatedParams.splice(rowIdx, 1)\n\n requestExampleMutators.edit(\n example.uid,\n `parameters.${paramKey}`,\n updatedParams,\n )\n }\n}\n\nfunction defaultRow() {\n /** ensure one empty row by default */\n if (params.value.length === 0) {\n addRow()\n } else if (params.value.length >= 1) {\n /** ensure we always have a trailing empty row */\n const lastParam = params.value[params.value.length - 1]\n if (lastParam && lastParam.key !== '' && lastParam.value !== '') {\n addRow()\n }\n }\n}\n\nconst itemCount = computed(\n () => params.value.filter((param) => param.key || param.value).length,\n)\n\nconst showTooltip = computed(() => params.value.length > 1)\n\nwatch(\n () => example,\n (newVal, oldVal) => {\n if (newVal !== oldVal) {\n defaultRow()\n }\n },\n { immediate: true },\n)\n\nconst hasReadOnlyEntries = computed(() => (readOnlyEntries ?? []).length > 0)\n</script>\n<template>\n <ViewLayoutCollapse\n class=\"group/params\"\n :itemCount=\"itemCount\">\n <template #title>{{ title }}</template>\n <template #actions>\n <div\n class=\"text-c-2 request-meta-buttons flex whitespace-nowrap opacity-0 group-hover/params:opacity-100 has-[:focus-visible]:opacity-100\">\n <ScalarTooltip\n v-if=\"showTooltip\"\n content=\"Clear optional parameters\"\n placement=\"left\">\n <ScalarButton\n class=\"pr-0.75 pl-1 transition-none\"\n size=\"sm\"\n variant=\"ghost\"\n @click.stop=\"deleteAllRows\">\n Clear\n <span class=\"sr-only\">All {{ title }}</span>\n </ScalarButton>\n </ScalarTooltip>\n </div>\n </template>\n <div ref=\"tableWrapperRef\">\n <!-- Read-only entries pinned to the top -->\n <RequestTable\n v-if=\"hasReadOnlyEntries\"\n class=\"flex-1\"\n :class=\"{ 'bg-c-3/5': hasReadOnlyEntries }\"\n :columns=\"['32px', '', '']\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :invalidParams=\"invalidParams\"\n isGlobal\n isReadOnly\n :items=\"readOnlyEntries\"\n :label\n :workspace=\"workspace\" />\n <!-- Dynamic entries -->\n <RequestTable\n class=\"flex-1\"\n :columns=\"['32px', '', '']\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :invalidParams=\"invalidParams\"\n :items=\"params\"\n :label\n :workspace=\"workspace\"\n @toggleRow=\"toggleRow\"\n @updateRow=\"updateRow\"\n @deleteRow=\"deleteRow\" />\n </div>\n </ViewLayoutCollapse>\n</template>\n","<script setup lang=\"ts\">\nimport { ScalarButton, ScalarTooltip } from '@scalar/components'\nimport type { Environment } from '@scalar/oas-utils/entities/environment'\nimport {\n requestExampleParametersSchema,\n type RequestExample,\n} from '@scalar/oas-utils/entities/spec'\nimport type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport { computed, nextTick, onMounted, ref, watch } from 'vue'\nimport type { RouteLocationRaw } from 'vue-router'\n\nimport ViewLayoutCollapse from '@/components/ViewLayout/ViewLayoutCollapse.vue'\nimport { useWorkspace } from '@/store'\nimport type { EnvVariable } from '@/store/active-entities'\nimport RequestTable from '@/views/Request/RequestSection/RequestTable.vue'\n\nconst {\n example,\n environment,\n envVariables,\n workspace,\n title,\n paramKey,\n readOnlyEntries = [],\n} = defineProps<{\n example: RequestExample\n environment: Environment\n envVariables: EnvVariable[]\n workspace: Workspace\n title: string\n label: string\n paramKey: keyof RequestExample['parameters']\n readOnlyEntries?: {\n key: string\n value: string\n enabled: boolean\n route: RouteLocationRaw\n }[]\n invalidParams: Set<string>\n}>()\n\nconst { requestExampleMutators } = useWorkspace()\n\nconst params = computed(() => example.parameters[paramKey] ?? [])\n\nonMounted(() => {\n nextTick(() => {\n defaultRow()\n })\n})\n\n/** Add a new row to a given parameter list */\nconst addRow = () => {\n /** Create a new parameter instance with 'enabled' set to false */\n const newParam = requestExampleParametersSchema.parse({ enabled: false })\n const newParams = [...params.value, newParam]\n\n requestExampleMutators.edit(example.uid, `parameters.${paramKey}`, newParams)\n}\n\nconst tableWrapperRef = ref<HTMLInputElement | null>(null)\n\n/** Update a field in a parameter row */\nconst updateRow = (rowIdx: number, field: 'key' | 'value', value: string) => {\n const currentParams = params.value\n if (currentParams.length > rowIdx) {\n const updatedParams = [...currentParams]\n if (!updatedParams[rowIdx]) {\n return\n }\n\n updatedParams[rowIdx] = { ...updatedParams[rowIdx], [field]: value }\n\n /** enable row key or value is filled */\n if (\n updatedParams[rowIdx].key !== '' ||\n updatedParams[rowIdx].value !== ''\n ) {\n updatedParams[rowIdx].enabled = true\n }\n\n /** check key and value input state */\n if (\n updatedParams[rowIdx].key === '' &&\n updatedParams[rowIdx].value === ''\n ) {\n /** remove if empty */\n updatedParams.splice(rowIdx, 1)\n }\n\n requestExampleMutators.edit(\n example.uid,\n `parameters.${paramKey}`,\n updatedParams,\n )\n } else {\n /** if there is no row at the index, add a new one */\n const payload = [requestExampleParametersSchema.parse({ [field]: value })]\n requestExampleMutators.edit(example.uid, `parameters.${paramKey}`, payload)\n\n /** focus the new row */\n nextTick(() => {\n if (!tableWrapperRef.value) {\n return\n }\n const inputs = tableWrapperRef.value.querySelectorAll('input')\n const inputsIndex = field === 'key' ? 0 : 1\n inputs[inputsIndex]?.focus()\n })\n }\n\n // Add a new row if the updated row is the last one\n if (rowIdx === currentParams.length - 1) {\n addRow()\n }\n}\n\n/** Toggle a parameter row on or off */\nconst toggleRow = (rowIdx: number, enabled: boolean) =>\n requestExampleMutators.edit(\n example.uid,\n `parameters.${paramKey}.${rowIdx}.enabled`,\n enabled,\n )\n\nconst deleteAllRows = () => {\n // filter out params that are enabled or required\n const exampleParams = params.value.filter((param) => param.required)\n\n requestExampleMutators.edit(\n example.uid,\n `parameters.${paramKey}`,\n exampleParams,\n )\n\n /** ensure one empty row after deleting all rows */\n nextTick(() => addRow())\n}\n\nconst deleteRow = (rowIdx: number) => {\n const currentParams = params.value\n if (currentParams.length > rowIdx) {\n const updatedParams = [...currentParams]\n updatedParams.splice(rowIdx, 1)\n\n requestExampleMutators.edit(\n example.uid,\n `parameters.${paramKey}`,\n updatedParams,\n )\n }\n}\n\nfunction defaultRow() {\n /** ensure one empty row by default */\n if (params.value.length === 0) {\n addRow()\n } else if (params.value.length >= 1) {\n /** ensure we always have a trailing empty row */\n const lastParam = params.value[params.value.length - 1]\n if (lastParam && lastParam.key !== '' && lastParam.value !== '') {\n addRow()\n }\n }\n}\n\nconst itemCount = computed(\n () => params.value.filter((param) => param.key || param.value).length,\n)\n\nconst showTooltip = computed(() => params.value.length > 1)\n\nwatch(\n () => example,\n (newVal, oldVal) => {\n if (newVal !== oldVal) {\n defaultRow()\n }\n },\n { immediate: true },\n)\n\nconst hasReadOnlyEntries = computed(() => (readOnlyEntries ?? []).length > 0)\n</script>\n<template>\n <ViewLayoutCollapse\n class=\"group/params\"\n :itemCount=\"itemCount\">\n <template #title>{{ title }}</template>\n <template #actions>\n <div\n class=\"text-c-2 request-meta-buttons flex whitespace-nowrap opacity-0 group-hover/params:opacity-100 has-[:focus-visible]:opacity-100\">\n <ScalarTooltip\n v-if=\"showTooltip\"\n content=\"Clear optional parameters\"\n placement=\"left\">\n <ScalarButton\n class=\"pr-0.75 pl-1 transition-none\"\n size=\"sm\"\n variant=\"ghost\"\n @click.stop=\"deleteAllRows\">\n Clear\n <span class=\"sr-only\">All {{ title }}</span>\n </ScalarButton>\n </ScalarTooltip>\n </div>\n </template>\n <div ref=\"tableWrapperRef\">\n <!-- Read-only entries pinned to the top -->\n <RequestTable\n v-if=\"hasReadOnlyEntries\"\n class=\"flex-1\"\n :class=\"{ 'bg-c-3/5': hasReadOnlyEntries }\"\n :columns=\"['32px', '', '']\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :invalidParams=\"invalidParams\"\n isGlobal\n isReadOnly\n :items=\"readOnlyEntries\"\n :label\n :workspace=\"workspace\" />\n <!-- Dynamic entries -->\n <RequestTable\n class=\"flex-1\"\n :columns=\"['32px', '', '']\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :invalidParams=\"invalidParams\"\n :items=\"params\"\n :label\n :workspace=\"workspace\"\n @toggleRow=\"toggleRow\"\n @updateRow=\"updateRow\"\n @deleteRow=\"deleteRow\" />\n </div>\n </ViewLayoutCollapse>\n</template>\n","<script setup lang=\"ts\">\nimport type { Environment } from '@scalar/oas-utils/entities/environment'\nimport type { Operation, RequestExample } from '@scalar/oas-utils/entities/spec'\nimport type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport { REGEX } from '@scalar/oas-utils/helpers'\nimport { computed, watch } from 'vue'\n\nimport ViewLayoutCollapse from '@/components/ViewLayout/ViewLayoutCollapse.vue'\nimport { useWorkspace } from '@/store'\nimport type { EnvVariable } from '@/store/active-entities'\nimport RequestTable from '@/views/Request/RequestSection/RequestTable.vue'\n\nconst {\n example,\n operation,\n paramKey,\n title,\n environment,\n envVariables,\n workspace,\n} = defineProps<{\n example: RequestExample\n operation: Operation\n paramKey: keyof RequestExample['parameters']\n title: string\n environment: Environment\n envVariables: EnvVariable[]\n workspace: Workspace\n invalidParams: Set<string>\n}>()\n\nconst { requestMutators, requestExampleMutators } = useWorkspace()\n\nconst params = computed(() =>\n example.parameters[paramKey].map((param) => ({\n ...param,\n enum: param.enum,\n })),\n)\n\n/** Update a field in a parameter row */\nconst updateRow = (rowIdx: number, field: 'key' | 'value', value: string) => {\n const parameters = example.parameters[paramKey]\n const oldKey = parameters[rowIdx]?.key\n if (!oldKey) {\n return\n }\n\n /** Change variable in path as well */\n if (field === 'key') {\n if (parameters[rowIdx]?.required) {\n /** Prevent updating the key of a required item */\n return\n }\n if (!value) {\n /** Remove parameter if path params table key is empty */\n parameters.splice(rowIdx, 1)\n const regx = new RegExp(`/:${encodeURIComponent(oldKey)}(?=[/?#]|$)`, 'g')\n const newPath = operation.path.replace(regx, '')\n\n requestMutators.edit(operation.uid, 'path', newPath)\n } else {\n /** Update URL with path params table key */\n const encodedOldKey = encodeURIComponent(oldKey)\n const encodedNewKey = encodeURIComponent(value)\n const regx = new RegExp(`(?<=/):${encodedOldKey}(?=[/?#]|$)`, 'g')\n const newPath = operation.path.replace(regx, `:${encodedNewKey}`)\n requestMutators.edit(operation.uid, 'path', newPath)\n }\n }\n\n requestExampleMutators.edit(\n example.uid,\n `parameters.${paramKey}.${rowIdx}.${field}`,\n value,\n )\n}\n\nconst deleteRow = (rowIdx: number) => {\n const currentParams = params.value\n if (currentParams.length > rowIdx) {\n const updatedParams = [...currentParams]\n updatedParams.splice(rowIdx, 1)\n\n requestExampleMutators.edit(\n example.uid,\n `parameters.${paramKey}`,\n updatedParams,\n )\n }\n}\n\nconst setPathVariable = (url: string) => {\n const pathVariables = url.match(REGEX.PATH)?.map((v) => v.slice(1, -1)) || []\n const parameters = example.parameters[paramKey]\n\n const paramMap = new Map(parameters.map((param) => [param.key, param]))\n const updatedParameters = pathVariables.map(\n (key) => paramMap.get(key) || { key, value: '', enabled: true },\n )\n\n parameters.forEach((param) => {\n /** prevent removing required parameters or with a value */\n if (!pathVariables.includes(param.key) && (param.value || param.required)) {\n updatedParameters.push(param)\n }\n })\n parameters.splice(0, parameters.length, ...updatedParameters)\n\n requestExampleMutators.edit(example.uid, `parameters.${paramKey}`, parameters)\n}\n\nconst handlePathVariableUpdate = (url: string) => {\n if (url) {\n setPathVariable(url)\n }\n}\n\nwatch(\n () => operation.path,\n (newURL) => {\n if (newURL) {\n handlePathVariableUpdate(newURL)\n }\n },\n)\n</script>\n<template>\n <ViewLayoutCollapse :itemCount=\"params.length\">\n <template #title>\n {{ title }}\n </template>\n\n <RequestTable\n v-if=\"params.length\"\n class=\"flex-1\"\n :columns=\"['32px', '', '']\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :invalidParams=\"invalidParams\"\n :items=\"params\"\n :workspace=\"workspace\"\n @updateRow=\"updateRow\"\n @deleteRow=\"deleteRow\" />\n </ViewLayoutCollapse>\n</template>\n","<script setup lang=\"ts\">\nimport type { Environment } from '@scalar/oas-utils/entities/environment'\nimport type { Operation, RequestExample } from '@scalar/oas-utils/entities/spec'\nimport type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport { REGEX } from '@scalar/oas-utils/helpers'\nimport { computed, watch } from 'vue'\n\nimport ViewLayoutCollapse from '@/components/ViewLayout/ViewLayoutCollapse.vue'\nimport { useWorkspace } from '@/store'\nimport type { EnvVariable } from '@/store/active-entities'\nimport RequestTable from '@/views/Request/RequestSection/RequestTable.vue'\n\nconst {\n example,\n operation,\n paramKey,\n title,\n environment,\n envVariables,\n workspace,\n} = defineProps<{\n example: RequestExample\n operation: Operation\n paramKey: keyof RequestExample['parameters']\n title: string\n environment: Environment\n envVariables: EnvVariable[]\n workspace: Workspace\n invalidParams: Set<string>\n}>()\n\nconst { requestMutators, requestExampleMutators } = useWorkspace()\n\nconst params = computed(() =>\n example.parameters[paramKey].map((param) => ({\n ...param,\n enum: param.enum,\n })),\n)\n\n/** Update a field in a parameter row */\nconst updateRow = (rowIdx: number, field: 'key' | 'value', value: string) => {\n const parameters = example.parameters[paramKey]\n const oldKey = parameters[rowIdx]?.key\n if (!oldKey) {\n return\n }\n\n /** Change variable in path as well */\n if (field === 'key') {\n if (parameters[rowIdx]?.required) {\n /** Prevent updating the key of a required item */\n return\n }\n if (!value) {\n /** Remove parameter if path params table key is empty */\n parameters.splice(rowIdx, 1)\n const regx = new RegExp(`/:${encodeURIComponent(oldKey)}(?=[/?#]|$)`, 'g')\n const newPath = operation.path.replace(regx, '')\n\n requestMutators.edit(operation.uid, 'path', newPath)\n } else {\n /** Update URL with path params table key */\n const encodedOldKey = encodeURIComponent(oldKey)\n const encodedNewKey = encodeURIComponent(value)\n const regx = new RegExp(`(?<=/):${encodedOldKey}(?=[/?#]|$)`, 'g')\n const newPath = operation.path.replace(regx, `:${encodedNewKey}`)\n requestMutators.edit(operation.uid, 'path', newPath)\n }\n }\n\n requestExampleMutators.edit(\n example.uid,\n `parameters.${paramKey}.${rowIdx}.${field}`,\n value,\n )\n}\n\nconst deleteRow = (rowIdx: number) => {\n const currentParams = params.value\n if (currentParams.length > rowIdx) {\n const updatedParams = [...currentParams]\n updatedParams.splice(rowIdx, 1)\n\n requestExampleMutators.edit(\n example.uid,\n `parameters.${paramKey}`,\n updatedParams,\n )\n }\n}\n\nconst setPathVariable = (url: string) => {\n const pathVariables = url.match(REGEX.PATH)?.map((v) => v.slice(1, -1)) || []\n const parameters = example.parameters[paramKey]\n\n const paramMap = new Map(parameters.map((param) => [param.key, param]))\n const updatedParameters = pathVariables.map(\n (key) => paramMap.get(key) || { key, value: '', enabled: true },\n )\n\n parameters.forEach((param) => {\n /** prevent removing required parameters or with a value */\n if (!pathVariables.includes(param.key) && (param.value || param.required)) {\n updatedParameters.push(param)\n }\n })\n parameters.splice(0, parameters.length, ...updatedParameters)\n\n requestExampleMutators.edit(example.uid, `parameters.${paramKey}`, parameters)\n}\n\nconst handlePathVariableUpdate = (url: string) => {\n if (url) {\n setPathVariable(url)\n }\n}\n\nwatch(\n () => operation.path,\n (newURL) => {\n if (newURL) {\n handlePathVariableUpdate(newURL)\n }\n },\n)\n</script>\n<template>\n <ViewLayoutCollapse :itemCount=\"params.length\">\n <template #title>\n {{ title }}\n </template>\n\n <RequestTable\n v-if=\"params.length\"\n class=\"flex-1\"\n :columns=\"['32px', '', '']\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :invalidParams=\"invalidParams\"\n :items=\"params\"\n :workspace=\"workspace\"\n @updateRow=\"updateRow\"\n @deleteRow=\"deleteRow\" />\n </ViewLayoutCollapse>\n</template>\n","<script setup lang=\"ts\">\nimport {\n ScalarButton,\n ScalarCodeBlock,\n ScalarCombobox,\n ScalarIcon,\n type ScalarComboboxOption,\n} from '@scalar/components'\nimport type {\n Collection,\n Operation,\n RequestExample,\n SecurityScheme,\n Server,\n} from '@scalar/oas-utils/entities/spec'\nimport type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport { snippetz, type ClientId, type TargetId } from '@scalar/snippetz'\nimport { computed, ref } from 'vue'\n\nimport DataTable from '@/components/DataTable/DataTable.vue'\nimport DataTableRow from '@/components/DataTable/DataTableRow.vue'\nimport ViewLayoutCollapse from '@/components/ViewLayout/ViewLayoutCollapse.vue'\nimport type { EnvVariables } from '@/libs/env-helpers'\nimport { useWorkspace } from '@/store'\nimport { CodeSnippet } from '@/views/Components/CodeSnippet'\n\nconst { collection, example, operation, server, workspace } = defineProps<{\n collection: Collection\n example: RequestExample\n operation: Operation\n server: Server | undefined\n workspace: Workspace\n environment: EnvVariables\n}>()\n\nconst { securitySchemes, workspaceMutators } = useWorkspace()\n\nconst localSelectedClient = computed(() => {\n // If the current selection is a custom example\n if (localSelectedClientState.value.targetKey === 'custom') {\n // Check if this custom example still exists in the new operation\n const customExampleExists = codeSamples.value?.some(\n (sample) => sample.lang === localSelectedClientState.value.clientKey,\n )\n\n // If it exists, keep using it\n if (customExampleExists) {\n return localSelectedClientState.value\n }\n }\n\n // Otherwise fall back to workspace selection\n return {\n targetKey: workspace.selectedHttpClient?.targetKey ?? 'js',\n clientKey: workspace.selectedHttpClient?.clientKey ?? 'fetch',\n }\n})\n\nconst codeSamples = computed(\n () =>\n operation['x-codeSamples'] ||\n operation['x-code-samples'] ||\n operation['x-custom-examples'],\n)\n\n// Store the actual selected state\nconst localSelectedClientState = ref(\n codeSamples.value?.length\n ? {\n targetKey: 'custom',\n clientKey: codeSamples.value[0]?.lang,\n }\n : {\n targetKey: workspace.selectedHttpClient?.targetKey ?? 'js',\n clientKey: workspace.selectedHttpClient?.clientKey ?? 'fetch',\n },\n)\n\n/**\n * Returns selected security schemes for the request\n */\nconst selectedSecuritySchemes = computed(() => {\n const uids =\n operation.selectedSecuritySchemeUids ||\n collection.selectedSecuritySchemeUids ||\n []\n return uids\n .flat()\n .map((uid) => securitySchemes[uid])\n .filter((scheme): scheme is SecurityScheme => Boolean(scheme))\n})\n\n/**\n * Group plugins by target/language to show in a dropdown, also build a dictionary in the same loop\n **/\nconst snippets = computed(() => {\n const dict: Record<string, string> = {}\n\n // Get the built-in snippets\n const builtInOptions = snippetz()\n .clients()\n .map((group) => ({\n label: group.title,\n options: group.clients.map((plugin) => {\n dict[`${group.key},${plugin.client}`] = plugin.title\n return {\n id: `${group.key},${plugin.client}`,\n label: plugin.title,\n }\n }),\n }))\n\n // Get any custom code samples from x-codeSamples\n const customExamples = (\n operation['x-codeSamples'] ||\n operation['x-code-samples'] ||\n operation['x-custom-examples'] ||\n []\n ).map((sample) => ({\n id: `custom,${sample.lang}`,\n label: sample.label || sample.lang,\n }))\n\n // If we have custom samples, add them as a new group\n const options =\n customExamples.length > 0\n ? [\n {\n id: 'customExamples',\n label: 'Code Examples',\n options: customExamples.map((customExample) => ({\n id: customExample.id,\n label: customExample.label ?? customExample.id,\n })),\n },\n ...builtInOptions,\n ]\n : builtInOptions\n\n // Add custom samples to the dictionary\n customExamples.forEach((sample) => {\n dict[sample.id] = sample.label ?? sample.id\n })\n\n return {\n options,\n dict,\n }\n})\n\n/** The currently selected plugin */\nconst selectedPlugin = computed(() => {\n const client = localSelectedClient.value\n\n // Handle custom examples\n if (client.targetKey === 'custom') {\n const id = `custom,${client.clientKey}`\n return {\n id,\n label: snippets.value.dict[id] ?? 'Unknown',\n }\n }\n\n // Handle regular snippetz plugins\n const id = `${client.targetKey},${client.clientKey}`\n return {\n id,\n label: snippets.value.dict[id] ?? 'Unknown',\n }\n})\n\n/** The currently selected target */\nconst selectedTarget = computed(\n () => localSelectedClient.value.targetKey as TargetId,\n)\n\n/** The currently selected client */\nconst selectedClient = computed(\n () => localSelectedClient.value.clientKey as ClientId<TargetId>,\n)\n\n/** Update the selection when a new client is picked */\nconst selectClient = (value: ScalarComboboxOption | undefined) => {\n if (!value) {\n return\n }\n const { id } = value\n const [target, client] = id.split(',')\n\n if (!target || !client) {\n return\n }\n\n // Update the state ref\n localSelectedClientState.value = {\n targetKey: target,\n clientKey: client,\n }\n\n // Only update workspace for non-custom selections\n if (target !== 'custom') {\n workspaceMutators.edit(workspace.uid, 'selectedHttpClient', {\n targetKey: target,\n clientKey: client,\n })\n }\n}\n\n/** Get the code sample content for a custom example */\nconst customCodeContent = computed(() => {\n if (!selectedPlugin.value.id.startsWith('custom,')) {\n return undefined\n }\n\n const lang = selectedPlugin.value.id.split(',')[1]\n const sample = codeSamples.value?.find((s) => s.lang === lang)\n return sample?.source\n})\n</script>\n\n<template>\n <div class=\"w-full\">\n <ViewLayoutCollapse\n class=\"group/preview w-full border-b-0\"\n :defaultOpen=\"false\">\n <template #title>Code Snippet</template>\n <template #actions>\n <div class=\"flex flex-1\">\n <ScalarCombobox\n :modelValue=\"selectedPlugin\"\n :options=\"snippets.options\"\n placement=\"bottom-end\"\n @update:modelValue=\"selectClient\">\n <ScalarButton\n class=\"text-c-2 hover:text-c-1 flex h-full w-fit gap-1.5 px-1.25 py-0.75 font-normal\"\n variant=\"ghost\">\n <span>{{ selectedPlugin?.label }}</span>\n <ScalarIcon\n icon=\"ChevronDown\"\n size=\"md\" />\n </ScalarButton>\n </ScalarCombobox>\n </div>\n </template>\n <DataTable\n :columns=\"['']\"\n presentational>\n <DataTableRow>\n <div\n class=\"bg-b-1 flex items-center justify-center overflow-hidden border-t\">\n <!-- Use the given code example -->\n <template v-if=\"customCodeContent\">\n <ScalarCodeBlock\n :content=\"customCodeContent\"\n :lang=\"selectedPlugin.id.split(',')[1] ?? 'plaintext'\" />\n </template>\n <!-- Generate a code snippet -->\n <template v-else>\n <CodeSnippet\n :client=\"selectedClient\"\n :example=\"example\"\n :operation=\"operation\"\n :securitySchemes=\"selectedSecuritySchemes\"\n :server=\"server\"\n :target=\"selectedTarget\"\n :environment=\"environment\" />\n </template>\n </div>\n </DataTableRow>\n </DataTable>\n </ViewLayoutCollapse>\n </div>\n</template>\n<style scoped>\n:deep(code.hljs *) {\n font-size: var(--scalar-small);\n}\n</style>\n","<script setup lang=\"ts\">\nimport {\n ScalarButton,\n ScalarCodeBlock,\n ScalarCombobox,\n ScalarIcon,\n type ScalarComboboxOption,\n} from '@scalar/components'\nimport type {\n Collection,\n Operation,\n RequestExample,\n SecurityScheme,\n Server,\n} from '@scalar/oas-utils/entities/spec'\nimport type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport { snippetz, type ClientId, type TargetId } from '@scalar/snippetz'\nimport { computed, ref } from 'vue'\n\nimport DataTable from '@/components/DataTable/DataTable.vue'\nimport DataTableRow from '@/components/DataTable/DataTableRow.vue'\nimport ViewLayoutCollapse from '@/components/ViewLayout/ViewLayoutCollapse.vue'\nimport type { EnvVariables } from '@/libs/env-helpers'\nimport { useWorkspace } from '@/store'\nimport { CodeSnippet } from '@/views/Components/CodeSnippet'\n\nconst { collection, example, operation, server, workspace } = defineProps<{\n collection: Collection\n example: RequestExample\n operation: Operation\n server: Server | undefined\n workspace: Workspace\n environment: EnvVariables\n}>()\n\nconst { securitySchemes, workspaceMutators } = useWorkspace()\n\nconst localSelectedClient = computed(() => {\n // If the current selection is a custom example\n if (localSelectedClientState.value.targetKey === 'custom') {\n // Check if this custom example still exists in the new operation\n const customExampleExists = codeSamples.value?.some(\n (sample) => sample.lang === localSelectedClientState.value.clientKey,\n )\n\n // If it exists, keep using it\n if (customExampleExists) {\n return localSelectedClientState.value\n }\n }\n\n // Otherwise fall back to workspace selection\n return {\n targetKey: workspace.selectedHttpClient?.targetKey ?? 'js',\n clientKey: workspace.selectedHttpClient?.clientKey ?? 'fetch',\n }\n})\n\nconst codeSamples = computed(\n () =>\n operation['x-codeSamples'] ||\n operation['x-code-samples'] ||\n operation['x-custom-examples'],\n)\n\n// Store the actual selected state\nconst localSelectedClientState = ref(\n codeSamples.value?.length\n ? {\n targetKey: 'custom',\n clientKey: codeSamples.value[0]?.lang,\n }\n : {\n targetKey: workspace.selectedHttpClient?.targetKey ?? 'js',\n clientKey: workspace.selectedHttpClient?.clientKey ?? 'fetch',\n },\n)\n\n/**\n * Returns selected security schemes for the request\n */\nconst selectedSecuritySchemes = computed(() => {\n const uids =\n operation.selectedSecuritySchemeUids ||\n collection.selectedSecuritySchemeUids ||\n []\n return uids\n .flat()\n .map((uid) => securitySchemes[uid])\n .filter((scheme): scheme is SecurityScheme => Boolean(scheme))\n})\n\n/**\n * Group plugins by target/language to show in a dropdown, also build a dictionary in the same loop\n **/\nconst snippets = computed(() => {\n const dict: Record<string, string> = {}\n\n // Get the built-in snippets\n const builtInOptions = snippetz()\n .clients()\n .map((group) => ({\n label: group.title,\n options: group.clients.map((plugin) => {\n dict[`${group.key},${plugin.client}`] = plugin.title\n return {\n id: `${group.key},${plugin.client}`,\n label: plugin.title,\n }\n }),\n }))\n\n // Get any custom code samples from x-codeSamples\n const customExamples = (\n operation['x-codeSamples'] ||\n operation['x-code-samples'] ||\n operation['x-custom-examples'] ||\n []\n ).map((sample) => ({\n id: `custom,${sample.lang}`,\n label: sample.label || sample.lang,\n }))\n\n // If we have custom samples, add them as a new group\n const options =\n customExamples.length > 0\n ? [\n {\n id: 'customExamples',\n label: 'Code Examples',\n options: customExamples.map((customExample) => ({\n id: customExample.id,\n label: customExample.label ?? customExample.id,\n })),\n },\n ...builtInOptions,\n ]\n : builtInOptions\n\n // Add custom samples to the dictionary\n customExamples.forEach((sample) => {\n dict[sample.id] = sample.label ?? sample.id\n })\n\n return {\n options,\n dict,\n }\n})\n\n/** The currently selected plugin */\nconst selectedPlugin = computed(() => {\n const client = localSelectedClient.value\n\n // Handle custom examples\n if (client.targetKey === 'custom') {\n const id = `custom,${client.clientKey}`\n return {\n id,\n label: snippets.value.dict[id] ?? 'Unknown',\n }\n }\n\n // Handle regular snippetz plugins\n const id = `${client.targetKey},${client.clientKey}`\n return {\n id,\n label: snippets.value.dict[id] ?? 'Unknown',\n }\n})\n\n/** The currently selected target */\nconst selectedTarget = computed(\n () => localSelectedClient.value.targetKey as TargetId,\n)\n\n/** The currently selected client */\nconst selectedClient = computed(\n () => localSelectedClient.value.clientKey as ClientId<TargetId>,\n)\n\n/** Update the selection when a new client is picked */\nconst selectClient = (value: ScalarComboboxOption | undefined) => {\n if (!value) {\n return\n }\n const { id } = value\n const [target, client] = id.split(',')\n\n if (!target || !client) {\n return\n }\n\n // Update the state ref\n localSelectedClientState.value = {\n targetKey: target,\n clientKey: client,\n }\n\n // Only update workspace for non-custom selections\n if (target !== 'custom') {\n workspaceMutators.edit(workspace.uid, 'selectedHttpClient', {\n targetKey: target,\n clientKey: client,\n })\n }\n}\n\n/** Get the code sample content for a custom example */\nconst customCodeContent = computed(() => {\n if (!selectedPlugin.value.id.startsWith('custom,')) {\n return undefined\n }\n\n const lang = selectedPlugin.value.id.split(',')[1]\n const sample = codeSamples.value?.find((s) => s.lang === lang)\n return sample?.source\n})\n</script>\n\n<template>\n <div class=\"w-full\">\n <ViewLayoutCollapse\n class=\"group/preview w-full border-b-0\"\n :defaultOpen=\"false\">\n <template #title>Code Snippet</template>\n <template #actions>\n <div class=\"flex flex-1\">\n <ScalarCombobox\n :modelValue=\"selectedPlugin\"\n :options=\"snippets.options\"\n placement=\"bottom-end\"\n @update:modelValue=\"selectClient\">\n <ScalarButton\n class=\"text-c-2 hover:text-c-1 flex h-full w-fit gap-1.5 px-1.25 py-0.75 font-normal\"\n variant=\"ghost\">\n <span>{{ selectedPlugin?.label }}</span>\n <ScalarIcon\n icon=\"ChevronDown\"\n size=\"md\" />\n </ScalarButton>\n </ScalarCombobox>\n </div>\n </template>\n <DataTable\n :columns=\"['']\"\n presentational>\n <DataTableRow>\n <div\n class=\"bg-b-1 flex items-center justify-center overflow-hidden border-t\">\n <!-- Use the given code example -->\n <template v-if=\"customCodeContent\">\n <ScalarCodeBlock\n :content=\"customCodeContent\"\n :lang=\"selectedPlugin.id.split(',')[1] ?? 'plaintext'\" />\n </template>\n <!-- Generate a code snippet -->\n <template v-else>\n <CodeSnippet\n :client=\"selectedClient\"\n :example=\"example\"\n :operation=\"operation\"\n :securitySchemes=\"selectedSecuritySchemes\"\n :server=\"server\"\n :target=\"selectedTarget\"\n :environment=\"environment\" />\n </template>\n </div>\n </DataTableRow>\n </DataTable>\n </ViewLayoutCollapse>\n </div>\n</template>\n<style scoped>\n:deep(code.hljs *) {\n font-size: var(--scalar-small);\n}\n</style>\n","<script setup lang=\"ts\">\nimport { ScalarErrorBoundary } from '@scalar/components'\nimport type { Environment } from '@scalar/oas-utils/entities/environment'\nimport type { SelectedSecuritySchemeUids } from '@scalar/oas-utils/entities/shared'\nimport type {\n Collection,\n Operation,\n RequestExample,\n Server,\n} from '@scalar/oas-utils/entities/spec'\nimport type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport { canMethodHaveBody, isDefined, REGEX } from '@scalar/oas-utils/helpers'\nimport { computed, ref, useId, watch } from 'vue'\n\nimport SectionFilter from '@/components/SectionFilter.vue'\nimport ViewLayoutSection from '@/components/ViewLayout/ViewLayoutSection.vue'\nimport { useLayout } from '@/hooks'\nimport { matchesDomain } from '@/libs/send-request/set-request-cookies'\nimport { usePluginManager } from '@/plugins'\nimport { useWorkspace } from '@/store'\nimport type { EnvVariable } from '@/store/active-entities'\nimport RequestBody from '@/views/Request/RequestSection/RequestBody.vue'\nimport RequestParams from '@/views/Request/RequestSection/RequestParams.vue'\nimport RequestPathParams from '@/views/Request/RequestSection/RequestPathParams.vue'\n\nimport RequestAuth from './RequestAuth/RequestAuth.vue'\nimport RequestCodeExample from './RequestCodeExample.vue'\n\nconst {\n collection,\n environment,\n envVariables,\n example,\n operation,\n selectedSecuritySchemeUids,\n server,\n workspace,\n} = defineProps<{\n collection: Collection\n environment: Environment\n envVariables: EnvVariable[]\n example: RequestExample\n invalidParams: Set<string>\n operation: Operation\n selectedSecuritySchemeUids: SelectedSecuritySchemeUids\n server: Server | undefined\n workspace: Workspace\n}>()\n\nconst requestSections = [\n 'Auth',\n 'Path Parameters',\n 'Cookies',\n 'Headers',\n 'Query',\n 'Body',\n // 'Scripts',\n] as const\n\ntype Filter = 'All' | (typeof requestSections)[number]\n\nconst { requestMutators, cookies, securitySchemes } = useWorkspace()\nconst { layout } = useLayout()\n\nconst filters = computed<Filter[]>(() => {\n const allSections = new Set<Filter>(['All', ...requestSections])\n\n if (!example.parameters.path.length) {\n allSections.delete('Path Parameters')\n }\n if (!canMethodHaveBody(operation.method ?? 'get')) {\n allSections.delete('Body')\n }\n if (isAuthHidden.value) {\n allSections.delete('Auth')\n }\n\n return [...allSections]\n})\n\n/** A list of section ids */\nconst filterIds = computed(\n () =>\n Object.fromEntries(\n filters.value.map((section) => [section, useId()]),\n ) as Record<Filter, string>,\n)\n\n// If security = [] or [{}] just hide it on readOnly mode\nconst isAuthHidden = computed(\n () =>\n layout === 'modal' &&\n !operation.security &&\n !Object.keys(securitySchemes ?? {}).length,\n)\n\nconst selectedFilter = ref<Filter>('All')\n\nwatch(\n () => operation,\n (newOperation) => {\n if (\n selectedFilter.value === 'Body' &&\n newOperation &&\n !canMethodHaveBody(newOperation.method)\n ) {\n selectedFilter.value = 'All'\n }\n },\n)\n\nconst updateRequestNameHandler = (event: Event) => {\n const target = event.target as HTMLInputElement\n requestMutators.edit(operation.uid, 'summary', target.value)\n}\n\n/**\n * Add the global cookies as static entries to the cookies section\n */\nconst activeWorkspaceCookies = computed(() =>\n (workspace.cookies ?? [])\n .map((uid) => cookies[uid])\n .filter(isDefined)\n .filter((cookie) => cookie.name)\n .filter((cookie) =>\n matchesDomain(server?.url || operation.path, cookie.domain),\n )\n .map((cookie) => ({\n key: cookie.name,\n value: cookie.value,\n route: {\n name: 'cookies',\n params: {\n cookies: cookie.uid,\n },\n },\n enabled: true,\n })),\n)\n\n// If the request has no summary, use the path or fallback\nconst handleRequestNamePlaceholder = () => {\n return operation.summary\n ? operation.summary\n : operation.path.replace(REGEX.PROTOCOL, '')\n ? operation.path.replace(REGEX.PROTOCOL, '')\n : 'Request Name'\n}\n\nconst labelRequestNameId = useId()\n\n// Plugins\nconst pluginManager = usePluginManager()\n\nconst requestSectionViews = pluginManager.getViewComponents('request.section')\n\nconst updateOperationHandler = (key: keyof Operation, value: string) =>\n requestMutators.edit(operation.uid, key, value)\n\n// Sets to all when auth filter is hidden but was previously selected to prevent empty section\nwatch(\n () => isAuthHidden.value,\n (authHidden) => {\n if (authHidden && selectedFilter.value === 'Auth') {\n selectedFilter.value = 'All'\n }\n },\n)\n</script>\n<template>\n <ViewLayoutSection :aria-label=\"`Request: ${operation.summary}`\">\n <template #title>\n <div\n class=\"group pointer-events-none flex flex-1 items-center gap-1 lg:pr-24\">\n <label\n v-if=\"layout !== 'modal'\"\n class=\"pointer-events-auto absolute top-0 left-0 h-full w-full cursor-text opacity-0\"\n :for=\"labelRequestNameId\" />\n <input\n v-if=\"layout !== 'modal'\"\n :id=\"labelRequestNameId\"\n class=\"text-c-1 group-hover-input pointer-events-auto relative z-10 -ml-0.5 h-8 w-full rounded pl-1.25 has-[:focus-visible]:outline md:-ml-1.25\"\n :placeholder=\"handleRequestNamePlaceholder()\"\n :value=\"operation.summary\"\n @input=\"updateRequestNameHandler\" />\n <span\n v-else\n class=\"text-c-1 flex h-8 items-center\">\n {{ operation.summary }}\n </span>\n </div>\n <SectionFilter\n v-model=\"selectedFilter\"\n :filterIds=\"filterIds\"\n :filters=\"filters\" />\n </template>\n <div\n :id=\"filterIds.All\"\n class=\"request-section-content custom-scroll relative flex flex-1 flex-col\"\n :role=\"selectedFilter === 'All' ? 'tabpanel' : 'none'\">\n <RequestAuth\n v-if=\"\n collection &&\n workspace &&\n (layout !== 'modal' || Object.keys(securitySchemes ?? {}).length)\n \"\n v-show=\"\n !isAuthHidden &&\n (selectedFilter === 'All' || selectedFilter === 'Auth')\n \"\n :id=\"filterIds.Auth\"\n class=\"request-section-content-auth\"\n :collection=\"collection\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :isReadOnly=\"layout === 'modal'\"\n layout=\"client\"\n :operation=\"operation\"\n :role=\"selectedFilter === 'All' ? 'none' : 'tabpanel'\"\n :selectedSecuritySchemeUids=\"selectedSecuritySchemeUids\"\n :server=\"server\"\n title=\"Authentication\"\n :workspace=\"workspace\" />\n <RequestPathParams\n v-show=\"\n (selectedFilter === 'All' || selectedFilter === 'Path Parameters') &&\n example.parameters.path.length\n \"\n :id=\"filterIds['Path Parameters']\"\n class=\"request-section-content-path-params\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :example=\"example\"\n :invalidParams=\"invalidParams\"\n :operation=\"operation\"\n paramKey=\"path\"\n :role=\"selectedFilter === 'All' ? 'none' : 'tabpanel'\"\n title=\"Path Parameters\"\n :workspace=\"workspace\" />\n <RequestParams\n v-show=\"selectedFilter === 'All' || selectedFilter === 'Cookies'\"\n :id=\"filterIds.Cookies\"\n class=\"request-section-content-cookies\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :example=\"example\"\n :invalidParams=\"invalidParams\"\n label=\"Cookie\"\n :operation=\"operation\"\n paramKey=\"cookies\"\n :readOnlyEntries=\"activeWorkspaceCookies\"\n :role=\"selectedFilter === 'All' ? 'none' : 'tabpanel'\"\n title=\"Cookies\"\n :workspace=\"workspace\" />\n <RequestParams\n v-show=\"selectedFilter === 'All' || selectedFilter === 'Headers'\"\n :id=\"filterIds.Headers\"\n class=\"request-section-content-headers\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :example=\"example\"\n :invalidParams=\"invalidParams\"\n label=\"Header\"\n :operation=\"operation\"\n paramKey=\"headers\"\n :role=\"selectedFilter === 'All' ? 'none' : 'tabpanel'\"\n title=\"Headers\"\n :workspace=\"workspace\" />\n <RequestParams\n v-show=\"selectedFilter === 'All' || selectedFilter === 'Query'\"\n :id=\"filterIds.Query\"\n class=\"request-section-content-query\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :example=\"example\"\n :invalidParams=\"invalidParams\"\n label=\"Parameter\"\n :operation=\"operation\"\n paramKey=\"query\"\n :role=\"selectedFilter === 'All' ? 'none' : 'tabpanel'\"\n title=\"Query Parameters\"\n :workspace=\"workspace\" />\n <RequestBody\n v-if=\"\n operation.method &&\n (selectedFilter === 'All' || selectedFilter === 'Body') &&\n canMethodHaveBody(operation.method)\n \"\n :id=\"filterIds.Body\"\n class=\"request-section-content-body\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :example=\"example\"\n :operation=\"operation\"\n :role=\"selectedFilter === 'All' ? 'none' : 'tabpanel'\"\n title=\"Body\"\n :workspace=\"workspace\" />\n\n <template\n v-for=\"(view, index) in requestSectionViews\"\n :key=\"view.title ?? index\">\n <ScalarErrorBoundary>\n <component\n :is=\"view.component\"\n v-show=\"selectedFilter === 'All' || selectedFilter === view.title\"\n :operation=\"operation\"\n @update:operation=\"updateOperationHandler\" />\n </ScalarErrorBoundary>\n </template>\n\n <!-- Spacer -->\n <div class=\"flex flex-grow\" />\n\n <!-- Code Snippet -->\n <ScalarErrorBoundary>\n <RequestCodeExample\n class=\"request-section-content-code-example -mt-1/2 border-t\"\n :collection=\"collection\"\n :environment=\"envVariables\"\n :example=\"example\"\n :operation=\"operation\"\n :server=\"server\"\n :workspace=\"workspace\" />\n </ScalarErrorBoundary>\n </div>\n </ViewLayoutSection>\n</template>\n<style scoped>\n.request-section-content {\n --scalar-border-width: 0.5px;\n}\n.request-section-content-filter {\n box-shadow: 0 -10px 0 10px var(--scalar-background-1);\n}\n.request-item:focus-within .request-meta-buttons {\n opacity: 1;\n}\n.group-hover-input {\n border-width: var(--scalar-border-width);\n border-color: transparent;\n}\n.group:hover .group-hover-input {\n background: color-mix(\n in srgb,\n var(--scalar-background-1),\n var(--scalar-background-2)\n );\n border-color: var(--scalar-border-color);\n}\n.group-hover-input:focus {\n background: transparent !important;\n border-color: var(--scalar-border-color) !important;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { ScalarErrorBoundary } from '@scalar/components'\nimport type { Environment } from '@scalar/oas-utils/entities/environment'\nimport type { SelectedSecuritySchemeUids } from '@scalar/oas-utils/entities/shared'\nimport type {\n Collection,\n Operation,\n RequestExample,\n Server,\n} from '@scalar/oas-utils/entities/spec'\nimport type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport { canMethodHaveBody, isDefined, REGEX } from '@scalar/oas-utils/helpers'\nimport { computed, ref, useId, watch } from 'vue'\n\nimport SectionFilter from '@/components/SectionFilter.vue'\nimport ViewLayoutSection from '@/components/ViewLayout/ViewLayoutSection.vue'\nimport { useLayout } from '@/hooks'\nimport { matchesDomain } from '@/libs/send-request/set-request-cookies'\nimport { usePluginManager } from '@/plugins'\nimport { useWorkspace } from '@/store'\nimport type { EnvVariable } from '@/store/active-entities'\nimport RequestBody from '@/views/Request/RequestSection/RequestBody.vue'\nimport RequestParams from '@/views/Request/RequestSection/RequestParams.vue'\nimport RequestPathParams from '@/views/Request/RequestSection/RequestPathParams.vue'\n\nimport RequestAuth from './RequestAuth/RequestAuth.vue'\nimport RequestCodeExample from './RequestCodeExample.vue'\n\nconst {\n collection,\n environment,\n envVariables,\n example,\n operation,\n selectedSecuritySchemeUids,\n server,\n workspace,\n} = defineProps<{\n collection: Collection\n environment: Environment\n envVariables: EnvVariable[]\n example: RequestExample\n invalidParams: Set<string>\n operation: Operation\n selectedSecuritySchemeUids: SelectedSecuritySchemeUids\n server: Server | undefined\n workspace: Workspace\n}>()\n\nconst requestSections = [\n 'Auth',\n 'Path Parameters',\n 'Cookies',\n 'Headers',\n 'Query',\n 'Body',\n // 'Scripts',\n] as const\n\ntype Filter = 'All' | (typeof requestSections)[number]\n\nconst { requestMutators, cookies, securitySchemes } = useWorkspace()\nconst { layout } = useLayout()\n\nconst filters = computed<Filter[]>(() => {\n const allSections = new Set<Filter>(['All', ...requestSections])\n\n if (!example.parameters.path.length) {\n allSections.delete('Path Parameters')\n }\n if (!canMethodHaveBody(operation.method ?? 'get')) {\n allSections.delete('Body')\n }\n if (isAuthHidden.value) {\n allSections.delete('Auth')\n }\n\n return [...allSections]\n})\n\n/** A list of section ids */\nconst filterIds = computed(\n () =>\n Object.fromEntries(\n filters.value.map((section) => [section, useId()]),\n ) as Record<Filter, string>,\n)\n\n// If security = [] or [{}] just hide it on readOnly mode\nconst isAuthHidden = computed(\n () =>\n layout === 'modal' &&\n !operation.security &&\n !Object.keys(securitySchemes ?? {}).length,\n)\n\nconst selectedFilter = ref<Filter>('All')\n\nwatch(\n () => operation,\n (newOperation) => {\n if (\n selectedFilter.value === 'Body' &&\n newOperation &&\n !canMethodHaveBody(newOperation.method)\n ) {\n selectedFilter.value = 'All'\n }\n },\n)\n\nconst updateRequestNameHandler = (event: Event) => {\n const target = event.target as HTMLInputElement\n requestMutators.edit(operation.uid, 'summary', target.value)\n}\n\n/**\n * Add the global cookies as static entries to the cookies section\n */\nconst activeWorkspaceCookies = computed(() =>\n (workspace.cookies ?? [])\n .map((uid) => cookies[uid])\n .filter(isDefined)\n .filter((cookie) => cookie.name)\n .filter((cookie) =>\n matchesDomain(server?.url || operation.path, cookie.domain),\n )\n .map((cookie) => ({\n key: cookie.name,\n value: cookie.value,\n route: {\n name: 'cookies',\n params: {\n cookies: cookie.uid,\n },\n },\n enabled: true,\n })),\n)\n\n// If the request has no summary, use the path or fallback\nconst handleRequestNamePlaceholder = () => {\n return operation.summary\n ? operation.summary\n : operation.path.replace(REGEX.PROTOCOL, '')\n ? operation.path.replace(REGEX.PROTOCOL, '')\n : 'Request Name'\n}\n\nconst labelRequestNameId = useId()\n\n// Plugins\nconst pluginManager = usePluginManager()\n\nconst requestSectionViews = pluginManager.getViewComponents('request.section')\n\nconst updateOperationHandler = (key: keyof Operation, value: string) =>\n requestMutators.edit(operation.uid, key, value)\n\n// Sets to all when auth filter is hidden but was previously selected to prevent empty section\nwatch(\n () => isAuthHidden.value,\n (authHidden) => {\n if (authHidden && selectedFilter.value === 'Auth') {\n selectedFilter.value = 'All'\n }\n },\n)\n</script>\n<template>\n <ViewLayoutSection :aria-label=\"`Request: ${operation.summary}`\">\n <template #title>\n <div\n class=\"group pointer-events-none flex flex-1 items-center gap-1 lg:pr-24\">\n <label\n v-if=\"layout !== 'modal'\"\n class=\"pointer-events-auto absolute top-0 left-0 h-full w-full cursor-text opacity-0\"\n :for=\"labelRequestNameId\" />\n <input\n v-if=\"layout !== 'modal'\"\n :id=\"labelRequestNameId\"\n class=\"text-c-1 group-hover-input pointer-events-auto relative z-10 -ml-0.5 h-8 w-full rounded pl-1.25 has-[:focus-visible]:outline md:-ml-1.25\"\n :placeholder=\"handleRequestNamePlaceholder()\"\n :value=\"operation.summary\"\n @input=\"updateRequestNameHandler\" />\n <span\n v-else\n class=\"text-c-1 flex h-8 items-center\">\n {{ operation.summary }}\n </span>\n </div>\n <SectionFilter\n v-model=\"selectedFilter\"\n :filterIds=\"filterIds\"\n :filters=\"filters\" />\n </template>\n <div\n :id=\"filterIds.All\"\n class=\"request-section-content custom-scroll relative flex flex-1 flex-col\"\n :role=\"selectedFilter === 'All' ? 'tabpanel' : 'none'\">\n <RequestAuth\n v-if=\"\n collection &&\n workspace &&\n (layout !== 'modal' || Object.keys(securitySchemes ?? {}).length)\n \"\n v-show=\"\n !isAuthHidden &&\n (selectedFilter === 'All' || selectedFilter === 'Auth')\n \"\n :id=\"filterIds.Auth\"\n class=\"request-section-content-auth\"\n :collection=\"collection\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :isReadOnly=\"layout === 'modal'\"\n layout=\"client\"\n :operation=\"operation\"\n :role=\"selectedFilter === 'All' ? 'none' : 'tabpanel'\"\n :selectedSecuritySchemeUids=\"selectedSecuritySchemeUids\"\n :server=\"server\"\n title=\"Authentication\"\n :workspace=\"workspace\" />\n <RequestPathParams\n v-show=\"\n (selectedFilter === 'All' || selectedFilter === 'Path Parameters') &&\n example.parameters.path.length\n \"\n :id=\"filterIds['Path Parameters']\"\n class=\"request-section-content-path-params\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :example=\"example\"\n :invalidParams=\"invalidParams\"\n :operation=\"operation\"\n paramKey=\"path\"\n :role=\"selectedFilter === 'All' ? 'none' : 'tabpanel'\"\n title=\"Path Parameters\"\n :workspace=\"workspace\" />\n <RequestParams\n v-show=\"selectedFilter === 'All' || selectedFilter === 'Cookies'\"\n :id=\"filterIds.Cookies\"\n class=\"request-section-content-cookies\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :example=\"example\"\n :invalidParams=\"invalidParams\"\n label=\"Cookie\"\n :operation=\"operation\"\n paramKey=\"cookies\"\n :readOnlyEntries=\"activeWorkspaceCookies\"\n :role=\"selectedFilter === 'All' ? 'none' : 'tabpanel'\"\n title=\"Cookies\"\n :workspace=\"workspace\" />\n <RequestParams\n v-show=\"selectedFilter === 'All' || selectedFilter === 'Headers'\"\n :id=\"filterIds.Headers\"\n class=\"request-section-content-headers\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :example=\"example\"\n :invalidParams=\"invalidParams\"\n label=\"Header\"\n :operation=\"operation\"\n paramKey=\"headers\"\n :role=\"selectedFilter === 'All' ? 'none' : 'tabpanel'\"\n title=\"Headers\"\n :workspace=\"workspace\" />\n <RequestParams\n v-show=\"selectedFilter === 'All' || selectedFilter === 'Query'\"\n :id=\"filterIds.Query\"\n class=\"request-section-content-query\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :example=\"example\"\n :invalidParams=\"invalidParams\"\n label=\"Parameter\"\n :operation=\"operation\"\n paramKey=\"query\"\n :role=\"selectedFilter === 'All' ? 'none' : 'tabpanel'\"\n title=\"Query Parameters\"\n :workspace=\"workspace\" />\n <RequestBody\n v-if=\"\n operation.method &&\n (selectedFilter === 'All' || selectedFilter === 'Body') &&\n canMethodHaveBody(operation.method)\n \"\n :id=\"filterIds.Body\"\n class=\"request-section-content-body\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :example=\"example\"\n :operation=\"operation\"\n :role=\"selectedFilter === 'All' ? 'none' : 'tabpanel'\"\n title=\"Body\"\n :workspace=\"workspace\" />\n\n <template\n v-for=\"(view, index) in requestSectionViews\"\n :key=\"view.title ?? index\">\n <ScalarErrorBoundary>\n <component\n :is=\"view.component\"\n v-show=\"selectedFilter === 'All' || selectedFilter === view.title\"\n :operation=\"operation\"\n @update:operation=\"updateOperationHandler\" />\n </ScalarErrorBoundary>\n </template>\n\n <!-- Spacer -->\n <div class=\"flex flex-grow\" />\n\n <!-- Code Snippet -->\n <ScalarErrorBoundary>\n <RequestCodeExample\n class=\"request-section-content-code-example -mt-1/2 border-t\"\n :collection=\"collection\"\n :environment=\"envVariables\"\n :example=\"example\"\n :operation=\"operation\"\n :server=\"server\"\n :workspace=\"workspace\" />\n </ScalarErrorBoundary>\n </div>\n </ViewLayoutSection>\n</template>\n<style scoped>\n.request-section-content {\n --scalar-border-width: 0.5px;\n}\n.request-section-content-filter {\n box-shadow: 0 -10px 0 10px var(--scalar-background-1);\n}\n.request-item:focus-within .request-meta-buttons {\n opacity: 1;\n}\n.group-hover-input {\n border-width: var(--scalar-border-width);\n border-color: transparent;\n}\n.group:hover .group-hover-input {\n background: color-mix(\n in srgb,\n var(--scalar-background-1),\n var(--scalar-background-2)\n );\n border-color: var(--scalar-border-color);\n}\n.group-hover-input:focus {\n background: transparent !important;\n border-color: var(--scalar-border-color) !important;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,IAAa,qBAAqB,SAChC,QAAQ,KAAK,eAAe,KAAK,QAAQ,KAAK,WAAW,KAAK,UAAU,KAAK,WAAW,KAAK,QAAQ;;;;;AAMvG,IAAa,sBAAsB,SAAkC;AACnE,QAAO,eAAe;AACpB,MAAI,KAAK,UAAU,KAAA,KAAa,KAAK,UAAU,GAC7C,QAAO;AAIT,MAAI,KAAK,MAAM;AACb,OAAI,KAAK,SAAS,WAAW;IAC3B,MAAM,QAAQ,OAAO,KAAK,MAAM;AAChC,QAAI,MAAM,MAAM,IAAI,CAAC,OAAO,UAAU,MAAM,CAC1C,QAAO;AAET,QAAI,KAAK,YAAY,KAAA,KAAa,QAAQ,KAAK,QAC7C,QAAO,iBAAiB,KAAK,QAAQ;AAEvC,QAAI,KAAK,YAAY,KAAA,KAAa,QAAQ,KAAK,QAC7C,QAAO,iBAAiB,KAAK,QAAQ;;AAIzC,OAAI,KAAK,SAAS,UAAU;IAC1B,MAAM,QAAQ,OAAO,KAAK,MAAM;AAChC,QAAI,MAAM,MAAM,CACd,QAAO;AAET,QAAI,KAAK,YAAY,KAAA,KAAa,QAAQ,KAAK,QAC7C,QAAO,iBAAiB,KAAK,QAAQ;AAEvC,QAAI,KAAK,YAAY,KAAA,KAAa,QAAQ,KAAK,QAC7C,QAAO,iBAAiB,KAAK,QAAQ;;AAIzC,OAAI,KAAK,SAAS,YAAY,KAAK,QAAQ;AACzC,QAAI,KAAK,WAAW,UAAU,CAAC,sBAAsB,KAAK,KAAK,MAAM,CACnE,QAAO;AAET,QACE,KAAK,WAAW,eAChB,CAAC,mEAAmE,KAAK,KAAK,MAAM,CAEpF,QAAO;AAET,QAAI,KAAK,WAAW,WAAW,CAAC,6BAA6B,KAAK,KAAK,MAAM,CAC3E,QAAO;A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2B,qBAAA;;MARxB,IAAI,UAAA,MAAU;MACf,OAAM;MACL,cAAc,QAAA;MACd,aAAa,QAAA;MACb,SAAS,QAAA;MACT,WAAW,QAAA;MACX,MAAM,eAAA,UAAc,QAAA,SAAA;MACrB,OAAM;MACL,WAAW,QAAA;;;;;;;;;;uBAEd,mBAUW,UAAA,MAAA,WATe,MAAA,oBAAmB,GAAnC,MAAM,UAAK;0BAEnB,YAMsB,MAAA,oBAAA,EAAA,EAAA,KAPhB,KAAK,SAAS,OAAA,EAAA;8BAM6B,CAAA,gBAAA,WAAA,EAJ/C,YAI+C,wBAHxC,KAAK,UAAS,EAAA;QAElB,WAAW,QAAA;QACX,sBAAkB;8CAFX,eAAA,UAAc,SAAc,eAAA,UAAmB,KAAK,MAAK,CAAA,CAAA,CAAA,CAAA;;;;+BAOvE,mBAA8B,OAAA,EAAzB,OAAM,kBAAgB,EAAA,MAAA,GAAA;KAG3B,YASsB,MAAA,oBAAA,EAAA,MAAA;6BADO,CAP3B,YAO2B,4BAAA;OANzB,OAAM;OACL,YAAY,QAAA;OACZ,aAAa,QAAA;OACb,SAAS,QAAA;OACT,WAAW,QAAA;OACX,QAAQ,QAAA;OACR,WAAW,QAAA"}
1
+ {"version":3,"file":"RequestSection-Bx8UHW-k.js","names":[],"sources":["../src/views/Request/libs/request.ts","../src/views/Request/RequestSection/RequestTableTooltip.vue","../src/views/Request/RequestSection/RequestTableTooltip.vue","../src/views/Request/RequestSection/RequestTable.vue","../src/views/Request/RequestSection/RequestTable.vue","../src/views/Request/RequestSection/RequestBody.vue","../src/views/Request/RequestSection/RequestBody.vue","../src/views/Request/RequestSection/RequestParams.vue","../src/views/Request/RequestSection/RequestParams.vue","../src/views/Request/RequestSection/RequestPathParams.vue","../src/views/Request/RequestSection/RequestPathParams.vue","../src/views/Request/RequestSection/RequestCodeExample.vue","../src/views/Request/RequestSection/RequestCodeExample.vue","../src/views/Request/RequestSection/RequestSection.vue","../src/views/Request/RequestSection/RequestSection.vue"],"sourcesContent":["import type { RequestExampleParameter } from '@scalar/oas-utils/entities/spec'\nimport { computed } from 'vue'\n\n/**\n * Check if a RequestExampleParameter has any of the following properties:\n * - description\n * - type\n * - default\n * - format\n * - minimum\n * - maximum\n */\nexport const hasItemProperties = (item: RequestExampleParameter) =>\n Boolean(item.description || item.type || item.default || item.format || item.minimum || item.maximum)\n\n/**\n * Checks if the value of a RequestExampleParameter is the expected type or format\n * Returns an alert message if the value is not in the correct type or format, otherwise false\n */\nexport const parameterIsInvalid = (item: RequestExampleParameter) => {\n return computed(() => {\n if (item.value === undefined || item.value === '') {\n return false\n }\n\n // Type validation\n if (item.type) {\n if (item.type === 'integer') {\n const value = Number(item.value)\n if (isNaN(value) || !Number.isInteger(value)) {\n return 'Value must be a whole number (e.g., 42)'\n }\n if (item.minimum !== undefined && value < item.minimum) {\n return `Value must be ${item.minimum} or greater`\n }\n if (item.maximum !== undefined && value > item.maximum) {\n return `Value must be ${item.maximum} or less`\n }\n }\n\n if (item.type === 'number') {\n const value = Number(item.value)\n if (isNaN(value)) {\n return 'Value must be a number (e.g., 42.5)'\n }\n if (item.minimum !== undefined && value < item.minimum) {\n return `Value must be ${item.minimum} or greater`\n }\n if (item.maximum !== undefined && value > item.maximum) {\n return `Value must be ${item.maximum} or less`\n }\n }\n\n if (item.type === 'string' && item.format) {\n if (item.format === 'date' && !/^\\d{4}-\\d{2}-\\d{2}$/.test(item.value)) {\n return 'Please enter a valid date in YYYY-MM-DD format (e.g., 2024-03-20)'\n }\n if (\n item.format === 'date-time' &&\n !/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$/.test(item.value)\n ) {\n return 'Please enter a valid date and time in RFC 3339 format (e.g., 2024-03-20T13:45:30Z)'\n }\n if (item.format === 'email' && !/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(item.value)) {\n return 'Please enter a valid email address (e.g., user@example.com)'\n }\n if (item.format === 'uri' && !/^[a-zA-Z][a-zA-Z0-9+.-]*:.+$/.test(item.value)) {\n return 'Please enter a valid URI (e.g., https://example.com)'\n }\n }\n }\n\n return false\n })\n}\n\n/**\n * Checks if a RequestExampleParameter is required and has an empty value\n */\nexport const hasEmptyRequiredParameter = (item: RequestExampleParameter) => Boolean(item.required && item.value === '')\n","<script setup lang=\"ts\">\nimport { ScalarPopover } from '@scalar/components'\nimport { ScalarIconInfo, ScalarIconWarning } from '@scalar/icons'\nimport type { RequestExampleParameter } from '@scalar/oas-utils/entities/spec'\nimport { computed } from 'vue'\n\nimport { parameterIsInvalid } from '../libs/request'\n\nconst { item } = defineProps<{ item: RequestExampleParameter }>()\n\nconst isInvalid = computed(() => !!parameterIsInvalid(item).value)\n</script>\n<template>\n <ScalarPopover\n teleport\n :offset=\"4\"\n placement=\"left\">\n <button\n type=\"button\"\n :aria-label=\"isInvalid ? 'Input is invalid' : 'More Information'\"\n class=\"text-c-2 hover:text-c-1 hover:bg-b-2 rounded p-1\"\n :role=\"isInvalid ? 'alert' : 'none'\">\n <ScalarIconWarning\n v-if=\"isInvalid\"\n class=\"text-orange size-3.5 brightness-90 hover:brightness-75\" />\n <ScalarIconInfo\n v-else\n class=\"text-c-2 hover:text-c-1 size-3.5\" />\n </button>\n <template #popover>\n <div\n class=\"w-content text-xxs text-c-1 grid min-w-48 gap-1.5 rounded px-1.5 pt-2 pb-1.5 leading-none\">\n <div\n v-if=\"isInvalid\"\n class=\"text-error-1\">\n {{ parameterIsInvalid(item).value }}\n </div>\n <div\n v-else-if=\"\n item.type ||\n item.format ||\n item.minimum ||\n item.maximum ||\n item.default\n \"\n class=\"schema text-c-2 flex items-center\">\n <span v-if=\"item.type\">{{ item.type }}</span>\n <span v-if=\"item.format\">{{ item.format }}</span>\n <span v-if=\"item.minimum\">min: {{ item.minimum }}</span>\n <span v-if=\"item.maximum\">max: {{ item.maximum }}</span>\n <span v-if=\"item.default\">default: {{ item.default }}</span>\n </div>\n <span\n v-if=\"item.description && !isInvalid\"\n class=\"text-sm leading-snug text-pretty\"\n :style=\"{ maxWidth: '16rem' }\">\n {{ item.description }}\n </span>\n </div>\n </template>\n </ScalarPopover>\n</template>\n<style scoped>\n.schema > span:not(:first-child)::before {\n content: '·';\n display: block;\n margin: 0 0.5ch;\n}\n\n.schema > span {\n display: flex;\n white-space: nowrap;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { ScalarPopover } from '@scalar/components'\nimport { ScalarIconInfo, ScalarIconWarning } from '@scalar/icons'\nimport type { RequestExampleParameter } from '@scalar/oas-utils/entities/spec'\nimport { computed } from 'vue'\n\nimport { parameterIsInvalid } from '../libs/request'\n\nconst { item } = defineProps<{ item: RequestExampleParameter }>()\n\nconst isInvalid = computed(() => !!parameterIsInvalid(item).value)\n</script>\n<template>\n <ScalarPopover\n teleport\n :offset=\"4\"\n placement=\"left\">\n <button\n type=\"button\"\n :aria-label=\"isInvalid ? 'Input is invalid' : 'More Information'\"\n class=\"text-c-2 hover:text-c-1 hover:bg-b-2 rounded p-1\"\n :role=\"isInvalid ? 'alert' : 'none'\">\n <ScalarIconWarning\n v-if=\"isInvalid\"\n class=\"text-orange size-3.5 brightness-90 hover:brightness-75\" />\n <ScalarIconInfo\n v-else\n class=\"text-c-2 hover:text-c-1 size-3.5\" />\n </button>\n <template #popover>\n <div\n class=\"w-content text-xxs text-c-1 grid min-w-48 gap-1.5 rounded px-1.5 pt-2 pb-1.5 leading-none\">\n <div\n v-if=\"isInvalid\"\n class=\"text-error-1\">\n {{ parameterIsInvalid(item).value }}\n </div>\n <div\n v-else-if=\"\n item.type ||\n item.format ||\n item.minimum ||\n item.maximum ||\n item.default\n \"\n class=\"schema text-c-2 flex items-center\">\n <span v-if=\"item.type\">{{ item.type }}</span>\n <span v-if=\"item.format\">{{ item.format }}</span>\n <span v-if=\"item.minimum\">min: {{ item.minimum }}</span>\n <span v-if=\"item.maximum\">max: {{ item.maximum }}</span>\n <span v-if=\"item.default\">default: {{ item.default }}</span>\n </div>\n <span\n v-if=\"item.description && !isInvalid\"\n class=\"text-sm leading-snug text-pretty\"\n :style=\"{ maxWidth: '16rem' }\">\n {{ item.description }}\n </span>\n </div>\n </template>\n </ScalarPopover>\n</template>\n<style scoped>\n.schema > span:not(:first-child)::before {\n content: '·';\n display: block;\n margin: 0 0.5ch;\n}\n\n.schema > span {\n display: flex;\n white-space: nowrap;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { ScalarButton, ScalarIcon, ScalarTooltip } from '@scalar/components'\nimport { ScalarIconTrash } from '@scalar/icons'\nimport type { Environment } from '@scalar/oas-utils/entities/environment'\nimport type { RequestExampleParameter } from '@scalar/oas-utils/entities/spec'\nimport type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport { RouterLink, type RouteLocationRaw } from 'vue-router'\n\nimport CodeInput from '@/components/CodeInput/CodeInput.vue'\nimport DataTable from '@/components/DataTable/DataTable.vue'\nimport DataTableCell from '@/components/DataTable/DataTableCell.vue'\nimport DataTableCheckbox from '@/components/DataTable/DataTableCheckbox.vue'\nimport DataTableHeader from '@/components/DataTable/DataTableHeader.vue'\nimport DataTableRow from '@/components/DataTable/DataTableRow.vue'\nimport type { EnvVariable } from '@/store/active-entities'\n\nimport { hasItemProperties, parameterIsInvalid } from '../libs/request'\nimport RequestTableTooltip from './RequestTableTooltip.vue'\n\nconst props = withDefaults(\n defineProps<{\n items?: (RequestExampleParameter & { route?: RouteLocationRaw })[]\n /** Hide the enabled column */\n hasCheckboxDisabled?: boolean\n showUploadButton?: boolean\n isGlobal?: boolean\n isReadOnly?: boolean\n environment: Environment\n envVariables: EnvVariable[]\n workspace: Workspace\n invalidParams?: Set<string>\n label?: string\n }>(),\n {\n hasCheckboxDisabled: false,\n showUploadButton: false,\n isGlobal: false,\n isReadOnly: false,\n },\n)\n\nconst emit = defineEmits<{\n (e: 'updateRow', idx: number, field: 'key' | 'value', value: string): void\n (e: 'toggleRow', idx: number, enabled: boolean): void\n (e: 'addRow'): void\n (e: 'deleteRow', idx: number): void\n (e: 'inputFocus'): void\n (e: 'inputBlur'): void\n (e: 'uploadFile', idx: number): void\n (e: 'removeFile', idx: number): void\n}>()\n\nconst columns = ['', '', '36px']\n\nconst handleSelectVariable = (\n idx: number,\n field: 'key' | 'value',\n value: string,\n) => {\n emit('updateRow', idx, field, value)\n}\n\nconst handleFileUpload = (idx: number) => {\n emit('uploadFile', idx)\n}\n\nconst flattenValue = (item: RequestExampleParameter) => {\n return Array.isArray(item.default) && item.default.length === 1\n ? item.default[0]\n : item.default\n}\n\n// Shows delete button if the item has key or value filled\nconst showDeleteButton = (item: RequestExampleParameter) => {\n return Boolean(item.key || item.value)\n}\n</script>\n<template>\n <DataTable\n class=\"group/table flex-1\"\n :columns=\"columns\">\n <DataTableRow class=\"sr-only !block\">\n <DataTableHeader>{{ label }} Enabled</DataTableHeader>\n <DataTableHeader>{{ label }} Key</DataTableHeader>\n <DataTableHeader>{{ label }} Value</DataTableHeader>\n </DataTableRow>\n <DataTableRow\n v-for=\"(item, idx) in items\"\n :id=\"item.key\"\n :key=\"idx\"\n :class=\"{\n alert: parameterIsInvalid(item).value,\n error: invalidParams && invalidParams.has(item.key),\n }\">\n <template v-if=\"isGlobal\">\n <RouterLink\n class=\"text-c-2 flex items-center justify-center border-t !border-r\"\n :to=\"item.route ?? {}\">\n <span class=\"sr-only\">Global</span>\n <ScalarTooltip\n content=\"Global cookies are shared across the whole workspace.\"\n placement=\"top\">\n <ScalarIcon\n tabindex=\"0\"\n class=\"text-c-1\"\n icon=\"Globe\"\n size=\"xs\" />\n </ScalarTooltip>\n </RouterLink>\n </template>\n <template v-else>\n <DataTableCheckbox\n class=\"!border-r\"\n :disabled=\"props.hasCheckboxDisabled\"\n :modelValue=\"item.enabled\"\n @update:modelValue=\"(v) => emit('toggleRow', idx, v)\" />\n </template>\n <DataTableCell>\n <CodeInput\n :aria-label=\"`${label} Key`\"\n disableCloseBrackets\n :disabled=\"props.isReadOnly\"\n disableEnter\n disableTabIndent\n lineWrapping\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :modelValue=\"item.key\"\n placeholder=\"Key\"\n :required=\"Boolean(item.required)\"\n :workspace=\"workspace\"\n @blur=\"emit('inputBlur')\"\n @focus=\"emit('inputFocus')\"\n @selectVariable=\"(v: string) => handleSelectVariable(idx, 'key', v)\"\n @update:modelValue=\"\n (v: string) => emit('updateRow', idx, 'key', v)\n \" />\n </DataTableCell>\n <DataTableCell>\n <CodeInput\n :aria-label=\"`${label} Value`\"\n :class=\"\n hasItemProperties(item)\n ? 'pr-6 group-hover:pr-10 group-has-[.cm-focused]:pr-10'\n : 'group-hover:pr-6 group-has-[.cm-focused]:pr-6'\n \"\n :default=\"item.default\"\n disableCloseBrackets\n :disabled=\"props.isReadOnly\"\n disableEnter\n disableTabIndent\n lineWrapping\n :enum=\"item.enum ?? []\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :examples=\"item.examples ?? []\"\n :max=\"item.maximum\"\n :min=\"item.minimum\"\n :modelValue=\"item.value\"\n :nullable=\"Boolean(item.nullable)\"\n placeholder=\"Value\"\n :type=\"item.type\"\n :workspace=\"workspace\"\n @blur=\"emit('inputBlur')\"\n @focus=\"emit('inputFocus')\"\n @selectVariable=\"(v: string) => handleSelectVariable(idx, 'value', v)\"\n @update:modelValue=\"\n (v: string) => emit('updateRow', idx, 'value', v)\n \">\n <template #icon>\n <ScalarButton\n v-if=\"showDeleteButton(item) && !item.required\"\n :class=\"{\n '-mr-0.5': hasItemProperties(item),\n }\"\n class=\"text-c-2 hover:text-c-1 hover:bg-b-2 z-context hidden h-fit rounded p-1 group-hover:flex group-has-[.cm-focused]:flex\"\n size=\"sm\"\n variant=\"ghost\"\n @click=\"emit('deleteRow', idx)\">\n <ScalarIconTrash class=\"size-3.5\" />\n </ScalarButton>\n <RequestTableTooltip\n v-if=\"hasItemProperties(item)\"\n :item=\"{ ...item, default: flattenValue(item) }\" />\n </template>\n </CodeInput>\n </DataTableCell>\n <DataTableCell\n v-if=\"showUploadButton\"\n class=\"group/upload flex items-center justify-center whitespace-nowrap\">\n <template v-if=\"item.file\">\n <div\n class=\"text-c-2 filemask flex w-full max-w-[100%] items-end justify-end overflow-hidden p-1\">\n <span>{{ item.file?.name }}</span>\n </div>\n <button\n class=\"bg-b-2 centered-x centered-y absolute hidden w-[calc(100%_-_8px)] rounded p-0.5 text-center text-xs font-medium group-hover/upload:block\"\n type=\"button\"\n @click=\"emit('removeFile', idx)\">\n Delete\n </button>\n </template>\n <template v-else>\n <div class=\"p-0.5\">\n <ScalarButton\n class=\"bg-b-2 hover:bg-b-3 text-c-2 h-fit border-0 py-px shadow-none\"\n size=\"sm\"\n variant=\"outlined\"\n @click=\"handleFileUpload(idx)\">\n <span>Upload File</span>\n <ScalarIcon\n class=\"ml-1\"\n icon=\"Upload\"\n size=\"xs\"\n thickness=\"2.5\" />\n </ScalarButton>\n </div>\n </template>\n </DataTableCell>\n </DataTableRow>\n </DataTable>\n</template>\n<style scoped>\n:deep(.cm-editor) {\n padding: 0;\n}\n:deep(.cm-content) {\n align-items: center;\n background-color: transparent;\n display: flex;\n font-family: var(--scalar-font);\n font-size: var(--scalar-small);\n padding: 5px 8px;\n width: 100%;\n}\n:deep(.cm-content):has(.cm-pill) {\n padding: 5px 8px;\n}\n:deep(.cm-content .cm-pill:not(:last-of-type)) {\n margin-right: 0.5px;\n}\n:deep(.cm-content .cm-pill:not(:first-of-type)) {\n margin-left: 0.5px;\n}\n:deep(.cm-line) {\n overflow: hidden;\n padding: 0;\n text-overflow: ellipsis;\n}\n.filemask {\n mask-image: linear-gradient(\n to right,\n transparent 0,\n var(--scalar-background-2) 20px\n );\n}\n</style>\n","<script setup lang=\"ts\">\nimport { ScalarButton, ScalarIcon, ScalarTooltip } from '@scalar/components'\nimport { ScalarIconTrash } from '@scalar/icons'\nimport type { Environment } from '@scalar/oas-utils/entities/environment'\nimport type { RequestExampleParameter } from '@scalar/oas-utils/entities/spec'\nimport type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport { RouterLink, type RouteLocationRaw } from 'vue-router'\n\nimport CodeInput from '@/components/CodeInput/CodeInput.vue'\nimport DataTable from '@/components/DataTable/DataTable.vue'\nimport DataTableCell from '@/components/DataTable/DataTableCell.vue'\nimport DataTableCheckbox from '@/components/DataTable/DataTableCheckbox.vue'\nimport DataTableHeader from '@/components/DataTable/DataTableHeader.vue'\nimport DataTableRow from '@/components/DataTable/DataTableRow.vue'\nimport type { EnvVariable } from '@/store/active-entities'\n\nimport { hasItemProperties, parameterIsInvalid } from '../libs/request'\nimport RequestTableTooltip from './RequestTableTooltip.vue'\n\nconst props = withDefaults(\n defineProps<{\n items?: (RequestExampleParameter & { route?: RouteLocationRaw })[]\n /** Hide the enabled column */\n hasCheckboxDisabled?: boolean\n showUploadButton?: boolean\n isGlobal?: boolean\n isReadOnly?: boolean\n environment: Environment\n envVariables: EnvVariable[]\n workspace: Workspace\n invalidParams?: Set<string>\n label?: string\n }>(),\n {\n hasCheckboxDisabled: false,\n showUploadButton: false,\n isGlobal: false,\n isReadOnly: false,\n },\n)\n\nconst emit = defineEmits<{\n (e: 'updateRow', idx: number, field: 'key' | 'value', value: string): void\n (e: 'toggleRow', idx: number, enabled: boolean): void\n (e: 'addRow'): void\n (e: 'deleteRow', idx: number): void\n (e: 'inputFocus'): void\n (e: 'inputBlur'): void\n (e: 'uploadFile', idx: number): void\n (e: 'removeFile', idx: number): void\n}>()\n\nconst columns = ['', '', '36px']\n\nconst handleSelectVariable = (\n idx: number,\n field: 'key' | 'value',\n value: string,\n) => {\n emit('updateRow', idx, field, value)\n}\n\nconst handleFileUpload = (idx: number) => {\n emit('uploadFile', idx)\n}\n\nconst flattenValue = (item: RequestExampleParameter) => {\n return Array.isArray(item.default) && item.default.length === 1\n ? item.default[0]\n : item.default\n}\n\n// Shows delete button if the item has key or value filled\nconst showDeleteButton = (item: RequestExampleParameter) => {\n return Boolean(item.key || item.value)\n}\n</script>\n<template>\n <DataTable\n class=\"group/table flex-1\"\n :columns=\"columns\">\n <DataTableRow class=\"sr-only !block\">\n <DataTableHeader>{{ label }} Enabled</DataTableHeader>\n <DataTableHeader>{{ label }} Key</DataTableHeader>\n <DataTableHeader>{{ label }} Value</DataTableHeader>\n </DataTableRow>\n <DataTableRow\n v-for=\"(item, idx) in items\"\n :id=\"item.key\"\n :key=\"idx\"\n :class=\"{\n alert: parameterIsInvalid(item).value,\n error: invalidParams && invalidParams.has(item.key),\n }\">\n <template v-if=\"isGlobal\">\n <RouterLink\n class=\"text-c-2 flex items-center justify-center border-t !border-r\"\n :to=\"item.route ?? {}\">\n <span class=\"sr-only\">Global</span>\n <ScalarTooltip\n content=\"Global cookies are shared across the whole workspace.\"\n placement=\"top\">\n <ScalarIcon\n tabindex=\"0\"\n class=\"text-c-1\"\n icon=\"Globe\"\n size=\"xs\" />\n </ScalarTooltip>\n </RouterLink>\n </template>\n <template v-else>\n <DataTableCheckbox\n class=\"!border-r\"\n :disabled=\"props.hasCheckboxDisabled\"\n :modelValue=\"item.enabled\"\n @update:modelValue=\"(v) => emit('toggleRow', idx, v)\" />\n </template>\n <DataTableCell>\n <CodeInput\n :aria-label=\"`${label} Key`\"\n disableCloseBrackets\n :disabled=\"props.isReadOnly\"\n disableEnter\n disableTabIndent\n lineWrapping\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :modelValue=\"item.key\"\n placeholder=\"Key\"\n :required=\"Boolean(item.required)\"\n :workspace=\"workspace\"\n @blur=\"emit('inputBlur')\"\n @focus=\"emit('inputFocus')\"\n @selectVariable=\"(v: string) => handleSelectVariable(idx, 'key', v)\"\n @update:modelValue=\"\n (v: string) => emit('updateRow', idx, 'key', v)\n \" />\n </DataTableCell>\n <DataTableCell>\n <CodeInput\n :aria-label=\"`${label} Value`\"\n :class=\"\n hasItemProperties(item)\n ? 'pr-6 group-hover:pr-10 group-has-[.cm-focused]:pr-10'\n : 'group-hover:pr-6 group-has-[.cm-focused]:pr-6'\n \"\n :default=\"item.default\"\n disableCloseBrackets\n :disabled=\"props.isReadOnly\"\n disableEnter\n disableTabIndent\n lineWrapping\n :enum=\"item.enum ?? []\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :examples=\"item.examples ?? []\"\n :max=\"item.maximum\"\n :min=\"item.minimum\"\n :modelValue=\"item.value\"\n :nullable=\"Boolean(item.nullable)\"\n placeholder=\"Value\"\n :type=\"item.type\"\n :workspace=\"workspace\"\n @blur=\"emit('inputBlur')\"\n @focus=\"emit('inputFocus')\"\n @selectVariable=\"(v: string) => handleSelectVariable(idx, 'value', v)\"\n @update:modelValue=\"\n (v: string) => emit('updateRow', idx, 'value', v)\n \">\n <template #icon>\n <ScalarButton\n v-if=\"showDeleteButton(item) && !item.required\"\n :class=\"{\n '-mr-0.5': hasItemProperties(item),\n }\"\n class=\"text-c-2 hover:text-c-1 hover:bg-b-2 z-context hidden h-fit rounded p-1 group-hover:flex group-has-[.cm-focused]:flex\"\n size=\"sm\"\n variant=\"ghost\"\n @click=\"emit('deleteRow', idx)\">\n <ScalarIconTrash class=\"size-3.5\" />\n </ScalarButton>\n <RequestTableTooltip\n v-if=\"hasItemProperties(item)\"\n :item=\"{ ...item, default: flattenValue(item) }\" />\n </template>\n </CodeInput>\n </DataTableCell>\n <DataTableCell\n v-if=\"showUploadButton\"\n class=\"group/upload flex items-center justify-center whitespace-nowrap\">\n <template v-if=\"item.file\">\n <div\n class=\"text-c-2 filemask flex w-full max-w-[100%] items-end justify-end overflow-hidden p-1\">\n <span>{{ item.file?.name }}</span>\n </div>\n <button\n class=\"bg-b-2 centered-x centered-y absolute hidden w-[calc(100%_-_8px)] rounded p-0.5 text-center text-xs font-medium group-hover/upload:block\"\n type=\"button\"\n @click=\"emit('removeFile', idx)\">\n Delete\n </button>\n </template>\n <template v-else>\n <div class=\"p-0.5\">\n <ScalarButton\n class=\"bg-b-2 hover:bg-b-3 text-c-2 h-fit border-0 py-px shadow-none\"\n size=\"sm\"\n variant=\"outlined\"\n @click=\"handleFileUpload(idx)\">\n <span>Upload File</span>\n <ScalarIcon\n class=\"ml-1\"\n icon=\"Upload\"\n size=\"xs\"\n thickness=\"2.5\" />\n </ScalarButton>\n </div>\n </template>\n </DataTableCell>\n </DataTableRow>\n </DataTable>\n</template>\n<style scoped>\n:deep(.cm-editor) {\n padding: 0;\n}\n:deep(.cm-content) {\n align-items: center;\n background-color: transparent;\n display: flex;\n font-family: var(--scalar-font);\n font-size: var(--scalar-small);\n padding: 5px 8px;\n width: 100%;\n}\n:deep(.cm-content):has(.cm-pill) {\n padding: 5px 8px;\n}\n:deep(.cm-content .cm-pill:not(:last-of-type)) {\n margin-right: 0.5px;\n}\n:deep(.cm-content .cm-pill:not(:first-of-type)) {\n margin-left: 0.5px;\n}\n:deep(.cm-line) {\n overflow: hidden;\n padding: 0;\n text-overflow: ellipsis;\n}\n.filemask {\n mask-image: linear-gradient(\n to right,\n transparent 0,\n var(--scalar-background-2) 20px\n );\n}\n</style>\n","<script setup lang=\"ts\">\nimport { ScalarButton, ScalarIcon, ScalarListbox } from '@scalar/components'\nimport type { Environment } from '@scalar/oas-utils/entities/environment'\nimport {\n requestExampleParametersSchema,\n type Operation,\n type RequestExample,\n} from '@scalar/oas-utils/entities/spec'\nimport type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport { canMethodHaveBody } from '@scalar/oas-utils/helpers'\nimport type { CodeMirrorLanguage } from '@scalar/use-codemirror'\nimport type { Entries } from 'type-fest'\nimport { computed, nextTick, ref, watch } from 'vue'\n\nimport CodeInput from '@/components/CodeInput/CodeInput.vue'\nimport DataTable from '@/components/DataTable/DataTable.vue'\nimport DataTableHeader from '@/components/DataTable/DataTableHeader.vue'\nimport DataTableRow from '@/components/DataTable/DataTableRow.vue'\nimport ViewLayoutCollapse from '@/components/ViewLayout/ViewLayoutCollapse.vue'\nimport { useFileDialog } from '@/hooks'\nimport { useWorkspace } from '@/store'\nimport type { EnvVariable } from '@/store/active-entities'\n\nimport RequestTable from './RequestTable.vue'\n\nconst { example, operation, environment, envVariables, workspace, title } =\n defineProps<{\n example: RequestExample\n operation: Operation\n environment: Environment\n envVariables: EnvVariable[]\n workspace: Workspace\n title: string\n }>()\n\nconst { requestExampleMutators } = useWorkspace()\n\n/** use-codemirror package to be updated accordingly */\nconst contentTypeToLanguageMap = {\n json: 'json',\n xml: 'xml',\n yaml: 'yaml',\n edn: 'edn',\n other: 'html',\n} as const\n\nconst contentTypes = {\n multipartForm: 'Multipart Form',\n formUrlEncoded: 'Form URL Encoded',\n binaryFile: 'Binary File',\n json: 'JSON',\n xml: 'XML',\n yaml: 'YAML',\n edn: 'EDN',\n other: 'Other',\n none: 'None',\n} as const\ntype ContentType = keyof typeof contentTypes\n\n/** Convert content types to options for the dropdown */\nconst contentTypeOptions = (\n Object.entries(contentTypes) as Entries<typeof contentTypes>\n).map(([id, label]) => ({\n id,\n label,\n}))\n\n/** Match the activeBody to the contentTypeOptions */\nconst activeExampleContentType = computed(() => {\n const { activeBody, formData, raw } = example.body\n\n // Form\n if (activeBody === 'formData') {\n return formData?.encoding === 'urlencoded'\n ? 'formUrlEncoded'\n : 'multipartForm'\n }\n // Binary\n if (activeBody === 'binary') {\n return 'binaryFile'\n }\n // Raw\n if (activeBody === 'raw' && raw?.encoding) {\n if (raw.encoding === 'html' || raw.encoding === 'text') {\n return 'other'\n }\n return raw.encoding\n }\n\n // Set content type from request if present\n const contentType = Object.keys(operation.requestBody?.content || {})[0]\n\n return contentType || 'none'\n})\n/** Selected ref from options above */\nconst selectedContentType = computed({\n get: () =>\n contentTypeOptions.find(\n (opt) => opt.id === activeExampleContentType.value,\n ) ??\n contentTypeOptions[contentTypeOptions.length - 1] ??\n contentTypeOptions[0],\n set: (opt) => {\n if (opt?.id) {\n updateActiveBody(opt.id)\n }\n },\n})\nconst tableWrapperRef = ref<HTMLInputElement | null>(null)\n\nconst codeInputLanguage = computed(() => {\n const type = selectedContentType.value\n ?.id as keyof typeof contentTypeToLanguageMap\n return contentTypeToLanguageMap[type] ?? 'plaintext'\n})\n\nconst deleteRow = (rowIdx: number) => {\n const currentParams = formParams.value\n if (currentParams.length > rowIdx) {\n const updatedParams = [...currentParams]\n updatedParams.splice(rowIdx, 1)\n\n requestExampleMutators.edit(\n example.uid,\n 'body.formData.value',\n updatedParams,\n )\n }\n}\n\n/** Update a field in a parameter row */\nconst updateRow = (rowIdx: number, field: 'key' | 'value', value: string) => {\n const currentParams = formParams.value\n\n if (currentParams.length > rowIdx) {\n const updatedParams = [...currentParams]\n updatedParams[rowIdx] = {\n ...updatedParams[rowIdx],\n value: updatedParams[rowIdx]?.value || '',\n key: updatedParams[rowIdx]?.key || '',\n enabled: updatedParams[rowIdx]?.enabled ?? false,\n [field]: value || '',\n }\n\n /** enable row key or value is filled */\n if (\n updatedParams[rowIdx]?.key !== '' ||\n updatedParams[rowIdx]?.value !== ''\n ) {\n updatedParams[rowIdx].enabled = true\n }\n\n /** check key and value input state */\n if (\n updatedParams[rowIdx]?.key === '' &&\n updatedParams[rowIdx]?.value === ''\n ) {\n /** remove if empty */\n updatedParams.splice(rowIdx, 1)\n }\n\n requestExampleMutators.edit(\n example.uid,\n 'body.formData.value',\n updatedParams,\n )\n } else {\n /** if there is no row at the index, add a new one */\n const payload = [requestExampleParametersSchema.parse({ [field]: value })]\n\n requestExampleMutators.edit(example.uid, 'body.formData.value', payload)\n\n /** focus the new row */\n nextTick(() => {\n if (!tableWrapperRef.value) {\n return\n }\n const inputs = tableWrapperRef.value.querySelectorAll('input')\n const inputsIndex = field === 'key' ? 0 : 1\n inputs[inputsIndex]?.focus()\n })\n }\n\n // Add a new row if the updated row is the last one\n if (rowIdx === currentParams.length - 1) {\n addRow()\n }\n}\n\nconst formParams = computed(() => example.body.formData?.value ?? [])\n\n/** ensure one empty row by default */\nconst defaultRow = () => {\n const lastParam = formParams.value[formParams.value.length - 1]\n if (!lastParam || lastParam.key !== '' || lastParam.value !== '') {\n addRow()\n }\n}\n\n/** Add a new row to a given parameter list */\nconst addRow = () => {\n /** Create a new parameter instance with 'enabled' set to false */\n const newParam = requestExampleParametersSchema.parse({\n enabled: false,\n })\n const newParams = [...formParams.value, newParam]\n\n // Ensure we have formData\n if (example.body.formData) {\n requestExampleMutators.edit(example.uid, 'body.formData.value', newParams)\n } else {\n requestExampleMutators.edit(example.uid, 'body.formData', {\n value: newParams,\n encoding: 'form-data',\n })\n }\n}\n\n/** Enable and disables the row */\nconst toggleRow = (rowIdx: number, enabled: boolean) => {\n const currentParams = formParams.value\n if (currentParams.length > rowIdx) {\n const updatedParams = [...currentParams]\n if (updatedParams[rowIdx]) {\n updatedParams[rowIdx].enabled = enabled\n }\n\n requestExampleMutators.edit(\n example.uid,\n 'body.formData.value',\n updatedParams,\n )\n }\n}\n\nconst updateRequestBody = (value: string) =>\n requestExampleMutators.edit(example.uid, 'body.raw.value', value)\n\n/** Take the select option and return bodyType with encoding and header */\nconst getBodyType = (type: ContentType) => {\n if (type === 'multipartForm') {\n return {\n activeBody: 'formData',\n encoding: 'form-data',\n header: 'multipart/form-data',\n } as const\n }\n if (type === 'formUrlEncoded') {\n return {\n activeBody: 'formData',\n encoding: 'urlencoded',\n header: 'application/x-www-form-urlencoded',\n } as const\n }\n if (type === 'binaryFile') {\n return {\n activeBody: 'binary',\n encoding: undefined,\n header: 'application/octet-stream',\n } as const\n }\n if (type === 'json') {\n const contentTypes = Object.keys(operation.requestBody?.content ?? {})\n\n // Gets json content types including vendor specific ones\n const jsonContentType =\n contentTypes.find((t) => t.includes('json') || t.endsWith('+json')) ||\n 'application/json'\n\n return {\n activeBody: 'raw',\n encoding: 'json',\n header: jsonContentType,\n } as const\n }\n if (type === 'xml') {\n return {\n activeBody: 'raw',\n encoding: 'xml',\n header: 'application/xml',\n } as const\n }\n if (type === 'yaml') {\n return {\n activeBody: 'raw',\n encoding: 'yaml',\n header: 'application/yaml',\n } as const\n }\n if (type === 'edn') {\n return {\n activeBody: 'raw',\n encoding: 'edn',\n header: 'application/edn',\n } as const\n }\n if (type === 'other') {\n const opContentTypes = Object.keys(operation.requestBody?.content ?? {})\n const textContentType = opContentTypes.find((t) => t.startsWith('text/'))\n\n return {\n activeBody: 'raw',\n encoding: textContentType ? 'text' : 'html',\n header: textContentType ?? 'application/html',\n } as const\n }\n\n return { activeBody: 'raw', encoding: undefined, header: undefined } as const\n}\n\n/** Set active body AND encoding */\nconst updateActiveBody = (type: ContentType) => {\n const { activeBody, encoding, header } = getBodyType(type)\n requestExampleMutators.edit(example.uid, 'body.activeBody', activeBody)\n\n // Set encoding safely\n if (encoding && activeBody === 'raw') {\n requestExampleMutators.edit(example.uid, 'body.raw', {\n encoding,\n value: example.body.raw?.value ?? '',\n })\n } else if (encoding && activeBody === 'formData') {\n requestExampleMutators.edit(example.uid, 'body.formData', {\n encoding,\n value: example.body.formData?.value ?? [],\n })\n }\n // Remove raw if no encoding and not binary\n else if (!encoding && activeBody !== 'binary') {\n const { raw: deleteMe, ...body } = example.body\n requestExampleMutators.edit(example.uid, 'body', body)\n }\n\n // Handle headers\n const headers = [...example.parameters.headers]\n const contentTypeIdx = headers.findIndex(\n (h) => h.key.toLowerCase() === 'content-type',\n )\n\n if (contentTypeIdx >= 0) {\n // Update header if exists\n if (header && headers[contentTypeIdx]) {\n headers[contentTypeIdx].value = header\n }\n // Remove header if we don't want one\n else if (\n headers[contentTypeIdx] &&\n (activeBody !== 'raw' || type === 'none')\n ) {\n headers.splice(contentTypeIdx, 1)\n }\n }\n // Add header if doesn't have one\n else if (header) {\n const lastHeader = headers[headers.length - 1]\n // Add header before last if empty to prevent empty row duplication\n if (lastHeader && lastHeader.key === '' && lastHeader.value === '') {\n headers.splice(headers.length - 1, 0, {\n key: 'Content-Type',\n value: header,\n enabled: true,\n })\n } else {\n headers.push({\n key: 'Content-Type',\n value: header,\n enabled: true,\n })\n }\n }\n\n requestExampleMutators.edit(example.uid, 'parameters.headers', headers)\n}\n\nconst handleFileUploadFormData = (rowIdx: number) => {\n const { open } = useFileDialog({\n onChange: (files) => {\n const file = files?.[0]\n if (file) {\n const currentParams = formParams.value\n const updatedParams = [...currentParams]\n updatedParams[rowIdx] = {\n ...updatedParams[rowIdx],\n file,\n value: updatedParams[rowIdx]?.value || file.name,\n key: updatedParams[rowIdx]?.key || file.name,\n enabled: true,\n }\n requestExampleMutators.edit(\n example.uid,\n 'body.formData.value',\n updatedParams,\n )\n\n defaultRow()\n }\n },\n multiple: false,\n accept: '*/*',\n })\n open()\n}\n\nconst removeBinaryFile = () =>\n requestExampleMutators.edit(example.uid, 'body.binary', undefined)\n\nfunction handleRemoveFileFormData(rowIdx: number) {\n const currentParams = formParams.value\n const updatedParams = [...currentParams]\n const param = currentParams[rowIdx]\n const file = param?.file as File | undefined\n\n // Empty key value or non updated file name then remove the row\n if (\n currentParams.length > 1 &&\n ((!param?.key && !param?.value) ||\n (file && param?.key === file.name && param?.value === file.name))\n ) {\n updatedParams.splice(rowIdx, 1)\n } else {\n // File name updated then remove file only\n if (updatedParams[rowIdx]) {\n updatedParams[rowIdx].file = undefined\n }\n }\n requestExampleMutators.edit(example.uid, 'body.formData.value', updatedParams)\n}\n\nfunction handleFileUpload() {\n const { open } = useFileDialog({\n onChange: (files) => {\n const file = files?.[0]\n if (file) {\n requestExampleMutators.edit(example.uid, 'body.binary', file)\n }\n },\n multiple: false,\n accept: '*/*',\n })\n open()\n}\n\n// we always add an empty row if its empty :)\nwatch(\n selectedContentType,\n (val) => {\n if (['multipartForm', 'formUrlEncoded'].includes(val?.id || '')) {\n defaultRow()\n }\n },\n { immediate: true },\n)\n\nwatch(\n () => example.uid,\n () => {\n operation.method &&\n canMethodHaveBody(operation.method) &&\n updateActiveBody(activeExampleContentType.value as ContentType)\n\n // Add extra row on page route change as well\n if (\n ['multipartForm', 'formUrlEncoded'].includes(\n activeExampleContentType.value as ContentType,\n )\n ) {\n defaultRow()\n }\n },\n { immediate: true },\n)\n\nconst exampleOptions = computed(() => {\n const contentType = selectedContentType.value?.id\n const { header } = getBodyType(contentType as ContentType)\n const content = operation.requestBody?.content || {}\n const examples = header ? content[header]?.examples || {} : {}\n return Object.entries(examples).map(([key, value]) => ({\n id: key,\n label: key,\n value,\n }))\n})\n\nconst selectedExample = computed({\n get: () => {\n const rawValue = example.body.raw?.value ?? '{}'\n try {\n const parsedValue = JSON.parse(rawValue)\n const getExample = exampleOptions.value.find((e) => {\n const exampleValue = e.value as {\n value: Record<string, string>\n }\n return (\n JSON.stringify(exampleValue.value) === JSON.stringify(parsedValue)\n )\n })\n return getExample ?? exampleOptions.value[0]\n } catch {\n return exampleOptions.value[0]\n }\n },\n set: (opt) => {\n if (opt?.id) {\n const exampleOption = exampleOptions.value.find((e) => e.id === opt.id)\n if (exampleOption) {\n const exampleValue = exampleOption.value as {\n value: Record<string, string>\n }\n updateRequestBody(JSON.stringify(exampleValue.value, null, 2))\n }\n }\n },\n})\n</script>\n<template>\n <ViewLayoutCollapse>\n <template #title>{{ title }}</template>\n <DataTable\n :columns=\"['']\"\n presentational>\n <DataTableRow>\n <DataTableHeader\n class=\"relative col-span-full flex h-8 cursor-pointer items-center justify-between !p-0\">\n <ScalarListbox\n v-model=\"selectedContentType\"\n :options=\"contentTypeOptions\"\n teleport>\n <ScalarButton\n class=\"text-c-2 hover:text-c-1 flex h-full w-fit gap-1.5 px-3 font-normal\"\n variant=\"ghost\">\n <span>{{ selectedContentType?.label }}</span>\n <ScalarIcon\n icon=\"ChevronDown\"\n size=\"md\" />\n </ScalarButton>\n </ScalarListbox>\n <ScalarListbox\n v-if=\"exampleOptions.length > 0\"\n v-model=\"selectedExample\"\n :options=\"exampleOptions\"\n side=\"left\"\n teleport>\n <ScalarButton\n class=\"text-c-2 hover:text-c-1 flex h-full w-fit gap-1.5 px-2 font-normal\"\n fullWidth\n variant=\"ghost\">\n <span>{{ selectedExample?.label }}</span>\n <ScalarIcon\n icon=\"ChevronDown\"\n size=\"md\" />\n </ScalarButton>\n </ScalarListbox>\n </DataTableHeader>\n </DataTableRow>\n <DataTableRow>\n <template v-if=\"selectedContentType?.id === 'none'\">\n <div\n class=\"text-c-3 flex min-h-10 w-full items-center justify-center border-t p-2 text-sm\">\n <span>No Body</span>\n </div>\n </template>\n <template v-else-if=\"selectedContentType?.id === 'binaryFile'\">\n <div\n class=\"flex items-center justify-center overflow-hidden border-t p-1.5\">\n <template v-if=\"example.body.binary\">\n <span\n class=\"text-c-2 w-full max-w-full overflow-hidden rounded border px-1.5 py-1 text-xs whitespace-nowrap\">\n {{ (example.body.binary as File).name }}\n </span>\n <ScalarButton\n class=\"bg-b-2 hover:bg-b-3 text-c-2 ml-1 border-0 shadow-none\"\n size=\"sm\"\n variant=\"outlined\"\n @click=\"removeBinaryFile\">\n Delete\n </ScalarButton>\n </template>\n <template v-else>\n <ScalarButton\n class=\"bg-b-2 hover:bg-b-3 text-c-2 border-0 shadow-none\"\n size=\"sm\"\n variant=\"outlined\"\n @click=\"handleFileUpload\">\n <span>Upload File</span>\n <ScalarIcon\n class=\"ml-1\"\n icon=\"Upload\"\n size=\"xs\"\n thickness=\"2.5\" />\n </ScalarButton>\n </template>\n </div>\n </template>\n <template v-else-if=\"selectedContentType?.id == 'multipartForm'\">\n <RequestTable\n ref=\"tableWrapperRef\"\n class=\"!m-0 rounded-t-none border-t-0 border-r-0 border-b-0 border-l-0 shadow-none\"\n :columns=\"['32px', '', '', '104px']\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :items=\"formParams\"\n showUploadButton\n :workspace=\"workspace\"\n @deleteRow=\"deleteRow\"\n @removeFile=\"handleRemoveFileFormData\"\n @toggleRow=\"toggleRow\"\n @updateRow=\"updateRow\"\n @uploadFile=\"handleFileUploadFormData\" />\n </template>\n <template v-else-if=\"selectedContentType?.id == 'formUrlEncoded'\">\n <RequestTable\n ref=\"tableWrapperRef\"\n class=\"!m-0 rounded-t-none border-t-0 border-r-0 border-b-0 border-l-0 shadow-none\"\n :columns=\"['32px', '', '', '104px']\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :items=\"formParams\"\n showUploadButton\n :workspace=\"workspace\"\n @deleteRow=\"deleteRow\"\n @removeFile=\"handleRemoveFileFormData\"\n @toggleRow=\"toggleRow\"\n @updateRow=\"updateRow\"\n @uploadFile=\"handleFileUploadFormData\" />\n </template>\n <template v-else>\n <!-- TODO: remove this as type hack when we add syntax highlighting -->\n <CodeInput\n class=\"border-t px-3\"\n content=\"\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :language=\"codeInputLanguage as CodeMirrorLanguage\"\n lineNumbers\n lint\n :modelValue=\"example.body?.raw?.value ?? ''\"\n :workspace=\"workspace\"\n @update:modelValue=\"updateRequestBody\" />\n </template>\n </DataTableRow>\n <!-- Hacky... but effective, extra table row to trick the last group -->\n <DataTableRow />\n </DataTable>\n </ViewLayoutCollapse>\n</template>\n<style scoped>\n:deep(.cm-content) {\n font-size: var(--scalar-small);\n}\n</style>\n","<script setup lang=\"ts\">\nimport { ScalarButton, ScalarIcon, ScalarListbox } from '@scalar/components'\nimport type { Environment } from '@scalar/oas-utils/entities/environment'\nimport {\n requestExampleParametersSchema,\n type Operation,\n type RequestExample,\n} from '@scalar/oas-utils/entities/spec'\nimport type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport { canMethodHaveBody } from '@scalar/oas-utils/helpers'\nimport type { CodeMirrorLanguage } from '@scalar/use-codemirror'\nimport type { Entries } from 'type-fest'\nimport { computed, nextTick, ref, watch } from 'vue'\n\nimport CodeInput from '@/components/CodeInput/CodeInput.vue'\nimport DataTable from '@/components/DataTable/DataTable.vue'\nimport DataTableHeader from '@/components/DataTable/DataTableHeader.vue'\nimport DataTableRow from '@/components/DataTable/DataTableRow.vue'\nimport ViewLayoutCollapse from '@/components/ViewLayout/ViewLayoutCollapse.vue'\nimport { useFileDialog } from '@/hooks'\nimport { useWorkspace } from '@/store'\nimport type { EnvVariable } from '@/store/active-entities'\n\nimport RequestTable from './RequestTable.vue'\n\nconst { example, operation, environment, envVariables, workspace, title } =\n defineProps<{\n example: RequestExample\n operation: Operation\n environment: Environment\n envVariables: EnvVariable[]\n workspace: Workspace\n title: string\n }>()\n\nconst { requestExampleMutators } = useWorkspace()\n\n/** use-codemirror package to be updated accordingly */\nconst contentTypeToLanguageMap = {\n json: 'json',\n xml: 'xml',\n yaml: 'yaml',\n edn: 'edn',\n other: 'html',\n} as const\n\nconst contentTypes = {\n multipartForm: 'Multipart Form',\n formUrlEncoded: 'Form URL Encoded',\n binaryFile: 'Binary File',\n json: 'JSON',\n xml: 'XML',\n yaml: 'YAML',\n edn: 'EDN',\n other: 'Other',\n none: 'None',\n} as const\ntype ContentType = keyof typeof contentTypes\n\n/** Convert content types to options for the dropdown */\nconst contentTypeOptions = (\n Object.entries(contentTypes) as Entries<typeof contentTypes>\n).map(([id, label]) => ({\n id,\n label,\n}))\n\n/** Match the activeBody to the contentTypeOptions */\nconst activeExampleContentType = computed(() => {\n const { activeBody, formData, raw } = example.body\n\n // Form\n if (activeBody === 'formData') {\n return formData?.encoding === 'urlencoded'\n ? 'formUrlEncoded'\n : 'multipartForm'\n }\n // Binary\n if (activeBody === 'binary') {\n return 'binaryFile'\n }\n // Raw\n if (activeBody === 'raw' && raw?.encoding) {\n if (raw.encoding === 'html' || raw.encoding === 'text') {\n return 'other'\n }\n return raw.encoding\n }\n\n // Set content type from request if present\n const contentType = Object.keys(operation.requestBody?.content || {})[0]\n\n return contentType || 'none'\n})\n/** Selected ref from options above */\nconst selectedContentType = computed({\n get: () =>\n contentTypeOptions.find(\n (opt) => opt.id === activeExampleContentType.value,\n ) ??\n contentTypeOptions[contentTypeOptions.length - 1] ??\n contentTypeOptions[0],\n set: (opt) => {\n if (opt?.id) {\n updateActiveBody(opt.id)\n }\n },\n})\nconst tableWrapperRef = ref<HTMLInputElement | null>(null)\n\nconst codeInputLanguage = computed(() => {\n const type = selectedContentType.value\n ?.id as keyof typeof contentTypeToLanguageMap\n return contentTypeToLanguageMap[type] ?? 'plaintext'\n})\n\nconst deleteRow = (rowIdx: number) => {\n const currentParams = formParams.value\n if (currentParams.length > rowIdx) {\n const updatedParams = [...currentParams]\n updatedParams.splice(rowIdx, 1)\n\n requestExampleMutators.edit(\n example.uid,\n 'body.formData.value',\n updatedParams,\n )\n }\n}\n\n/** Update a field in a parameter row */\nconst updateRow = (rowIdx: number, field: 'key' | 'value', value: string) => {\n const currentParams = formParams.value\n\n if (currentParams.length > rowIdx) {\n const updatedParams = [...currentParams]\n updatedParams[rowIdx] = {\n ...updatedParams[rowIdx],\n value: updatedParams[rowIdx]?.value || '',\n key: updatedParams[rowIdx]?.key || '',\n enabled: updatedParams[rowIdx]?.enabled ?? false,\n [field]: value || '',\n }\n\n /** enable row key or value is filled */\n if (\n updatedParams[rowIdx]?.key !== '' ||\n updatedParams[rowIdx]?.value !== ''\n ) {\n updatedParams[rowIdx].enabled = true\n }\n\n /** check key and value input state */\n if (\n updatedParams[rowIdx]?.key === '' &&\n updatedParams[rowIdx]?.value === ''\n ) {\n /** remove if empty */\n updatedParams.splice(rowIdx, 1)\n }\n\n requestExampleMutators.edit(\n example.uid,\n 'body.formData.value',\n updatedParams,\n )\n } else {\n /** if there is no row at the index, add a new one */\n const payload = [requestExampleParametersSchema.parse({ [field]: value })]\n\n requestExampleMutators.edit(example.uid, 'body.formData.value', payload)\n\n /** focus the new row */\n nextTick(() => {\n if (!tableWrapperRef.value) {\n return\n }\n const inputs = tableWrapperRef.value.querySelectorAll('input')\n const inputsIndex = field === 'key' ? 0 : 1\n inputs[inputsIndex]?.focus()\n })\n }\n\n // Add a new row if the updated row is the last one\n if (rowIdx === currentParams.length - 1) {\n addRow()\n }\n}\n\nconst formParams = computed(() => example.body.formData?.value ?? [])\n\n/** ensure one empty row by default */\nconst defaultRow = () => {\n const lastParam = formParams.value[formParams.value.length - 1]\n if (!lastParam || lastParam.key !== '' || lastParam.value !== '') {\n addRow()\n }\n}\n\n/** Add a new row to a given parameter list */\nconst addRow = () => {\n /** Create a new parameter instance with 'enabled' set to false */\n const newParam = requestExampleParametersSchema.parse({\n enabled: false,\n })\n const newParams = [...formParams.value, newParam]\n\n // Ensure we have formData\n if (example.body.formData) {\n requestExampleMutators.edit(example.uid, 'body.formData.value', newParams)\n } else {\n requestExampleMutators.edit(example.uid, 'body.formData', {\n value: newParams,\n encoding: 'form-data',\n })\n }\n}\n\n/** Enable and disables the row */\nconst toggleRow = (rowIdx: number, enabled: boolean) => {\n const currentParams = formParams.value\n if (currentParams.length > rowIdx) {\n const updatedParams = [...currentParams]\n if (updatedParams[rowIdx]) {\n updatedParams[rowIdx].enabled = enabled\n }\n\n requestExampleMutators.edit(\n example.uid,\n 'body.formData.value',\n updatedParams,\n )\n }\n}\n\nconst updateRequestBody = (value: string) =>\n requestExampleMutators.edit(example.uid, 'body.raw.value', value)\n\n/** Take the select option and return bodyType with encoding and header */\nconst getBodyType = (type: ContentType) => {\n if (type === 'multipartForm') {\n return {\n activeBody: 'formData',\n encoding: 'form-data',\n header: 'multipart/form-data',\n } as const\n }\n if (type === 'formUrlEncoded') {\n return {\n activeBody: 'formData',\n encoding: 'urlencoded',\n header: 'application/x-www-form-urlencoded',\n } as const\n }\n if (type === 'binaryFile') {\n return {\n activeBody: 'binary',\n encoding: undefined,\n header: 'application/octet-stream',\n } as const\n }\n if (type === 'json') {\n const contentTypes = Object.keys(operation.requestBody?.content ?? {})\n\n // Gets json content types including vendor specific ones\n const jsonContentType =\n contentTypes.find((t) => t.includes('json') || t.endsWith('+json')) ||\n 'application/json'\n\n return {\n activeBody: 'raw',\n encoding: 'json',\n header: jsonContentType,\n } as const\n }\n if (type === 'xml') {\n return {\n activeBody: 'raw',\n encoding: 'xml',\n header: 'application/xml',\n } as const\n }\n if (type === 'yaml') {\n return {\n activeBody: 'raw',\n encoding: 'yaml',\n header: 'application/yaml',\n } as const\n }\n if (type === 'edn') {\n return {\n activeBody: 'raw',\n encoding: 'edn',\n header: 'application/edn',\n } as const\n }\n if (type === 'other') {\n const opContentTypes = Object.keys(operation.requestBody?.content ?? {})\n const textContentType = opContentTypes.find((t) => t.startsWith('text/'))\n\n return {\n activeBody: 'raw',\n encoding: textContentType ? 'text' : 'html',\n header: textContentType ?? 'application/html',\n } as const\n }\n\n return { activeBody: 'raw', encoding: undefined, header: undefined } as const\n}\n\n/** Set active body AND encoding */\nconst updateActiveBody = (type: ContentType) => {\n const { activeBody, encoding, header } = getBodyType(type)\n requestExampleMutators.edit(example.uid, 'body.activeBody', activeBody)\n\n // Set encoding safely\n if (encoding && activeBody === 'raw') {\n requestExampleMutators.edit(example.uid, 'body.raw', {\n encoding,\n value: example.body.raw?.value ?? '',\n })\n } else if (encoding && activeBody === 'formData') {\n requestExampleMutators.edit(example.uid, 'body.formData', {\n encoding,\n value: example.body.formData?.value ?? [],\n })\n }\n // Remove raw if no encoding and not binary\n else if (!encoding && activeBody !== 'binary') {\n const { raw: deleteMe, ...body } = example.body\n requestExampleMutators.edit(example.uid, 'body', body)\n }\n\n // Handle headers\n const headers = [...example.parameters.headers]\n const contentTypeIdx = headers.findIndex(\n (h) => h.key.toLowerCase() === 'content-type',\n )\n\n if (contentTypeIdx >= 0) {\n // Update header if exists\n if (header && headers[contentTypeIdx]) {\n headers[contentTypeIdx].value = header\n }\n // Remove header if we don't want one\n else if (\n headers[contentTypeIdx] &&\n (activeBody !== 'raw' || type === 'none')\n ) {\n headers.splice(contentTypeIdx, 1)\n }\n }\n // Add header if doesn't have one\n else if (header) {\n const lastHeader = headers[headers.length - 1]\n // Add header before last if empty to prevent empty row duplication\n if (lastHeader && lastHeader.key === '' && lastHeader.value === '') {\n headers.splice(headers.length - 1, 0, {\n key: 'Content-Type',\n value: header,\n enabled: true,\n })\n } else {\n headers.push({\n key: 'Content-Type',\n value: header,\n enabled: true,\n })\n }\n }\n\n requestExampleMutators.edit(example.uid, 'parameters.headers', headers)\n}\n\nconst handleFileUploadFormData = (rowIdx: number) => {\n const { open } = useFileDialog({\n onChange: (files) => {\n const file = files?.[0]\n if (file) {\n const currentParams = formParams.value\n const updatedParams = [...currentParams]\n updatedParams[rowIdx] = {\n ...updatedParams[rowIdx],\n file,\n value: updatedParams[rowIdx]?.value || file.name,\n key: updatedParams[rowIdx]?.key || file.name,\n enabled: true,\n }\n requestExampleMutators.edit(\n example.uid,\n 'body.formData.value',\n updatedParams,\n )\n\n defaultRow()\n }\n },\n multiple: false,\n accept: '*/*',\n })\n open()\n}\n\nconst removeBinaryFile = () =>\n requestExampleMutators.edit(example.uid, 'body.binary', undefined)\n\nfunction handleRemoveFileFormData(rowIdx: number) {\n const currentParams = formParams.value\n const updatedParams = [...currentParams]\n const param = currentParams[rowIdx]\n const file = param?.file as File | undefined\n\n // Empty key value or non updated file name then remove the row\n if (\n currentParams.length > 1 &&\n ((!param?.key && !param?.value) ||\n (file && param?.key === file.name && param?.value === file.name))\n ) {\n updatedParams.splice(rowIdx, 1)\n } else {\n // File name updated then remove file only\n if (updatedParams[rowIdx]) {\n updatedParams[rowIdx].file = undefined\n }\n }\n requestExampleMutators.edit(example.uid, 'body.formData.value', updatedParams)\n}\n\nfunction handleFileUpload() {\n const { open } = useFileDialog({\n onChange: (files) => {\n const file = files?.[0]\n if (file) {\n requestExampleMutators.edit(example.uid, 'body.binary', file)\n }\n },\n multiple: false,\n accept: '*/*',\n })\n open()\n}\n\n// we always add an empty row if its empty :)\nwatch(\n selectedContentType,\n (val) => {\n if (['multipartForm', 'formUrlEncoded'].includes(val?.id || '')) {\n defaultRow()\n }\n },\n { immediate: true },\n)\n\nwatch(\n () => example.uid,\n () => {\n operation.method &&\n canMethodHaveBody(operation.method) &&\n updateActiveBody(activeExampleContentType.value as ContentType)\n\n // Add extra row on page route change as well\n if (\n ['multipartForm', 'formUrlEncoded'].includes(\n activeExampleContentType.value as ContentType,\n )\n ) {\n defaultRow()\n }\n },\n { immediate: true },\n)\n\nconst exampleOptions = computed(() => {\n const contentType = selectedContentType.value?.id\n const { header } = getBodyType(contentType as ContentType)\n const content = operation.requestBody?.content || {}\n const examples = header ? content[header]?.examples || {} : {}\n return Object.entries(examples).map(([key, value]) => ({\n id: key,\n label: key,\n value,\n }))\n})\n\nconst selectedExample = computed({\n get: () => {\n const rawValue = example.body.raw?.value ?? '{}'\n try {\n const parsedValue = JSON.parse(rawValue)\n const getExample = exampleOptions.value.find((e) => {\n const exampleValue = e.value as {\n value: Record<string, string>\n }\n return (\n JSON.stringify(exampleValue.value) === JSON.stringify(parsedValue)\n )\n })\n return getExample ?? exampleOptions.value[0]\n } catch {\n return exampleOptions.value[0]\n }\n },\n set: (opt) => {\n if (opt?.id) {\n const exampleOption = exampleOptions.value.find((e) => e.id === opt.id)\n if (exampleOption) {\n const exampleValue = exampleOption.value as {\n value: Record<string, string>\n }\n updateRequestBody(JSON.stringify(exampleValue.value, null, 2))\n }\n }\n },\n})\n</script>\n<template>\n <ViewLayoutCollapse>\n <template #title>{{ title }}</template>\n <DataTable\n :columns=\"['']\"\n presentational>\n <DataTableRow>\n <DataTableHeader\n class=\"relative col-span-full flex h-8 cursor-pointer items-center justify-between !p-0\">\n <ScalarListbox\n v-model=\"selectedContentType\"\n :options=\"contentTypeOptions\"\n teleport>\n <ScalarButton\n class=\"text-c-2 hover:text-c-1 flex h-full w-fit gap-1.5 px-3 font-normal\"\n variant=\"ghost\">\n <span>{{ selectedContentType?.label }}</span>\n <ScalarIcon\n icon=\"ChevronDown\"\n size=\"md\" />\n </ScalarButton>\n </ScalarListbox>\n <ScalarListbox\n v-if=\"exampleOptions.length > 0\"\n v-model=\"selectedExample\"\n :options=\"exampleOptions\"\n side=\"left\"\n teleport>\n <ScalarButton\n class=\"text-c-2 hover:text-c-1 flex h-full w-fit gap-1.5 px-2 font-normal\"\n fullWidth\n variant=\"ghost\">\n <span>{{ selectedExample?.label }}</span>\n <ScalarIcon\n icon=\"ChevronDown\"\n size=\"md\" />\n </ScalarButton>\n </ScalarListbox>\n </DataTableHeader>\n </DataTableRow>\n <DataTableRow>\n <template v-if=\"selectedContentType?.id === 'none'\">\n <div\n class=\"text-c-3 flex min-h-10 w-full items-center justify-center border-t p-2 text-sm\">\n <span>No Body</span>\n </div>\n </template>\n <template v-else-if=\"selectedContentType?.id === 'binaryFile'\">\n <div\n class=\"flex items-center justify-center overflow-hidden border-t p-1.5\">\n <template v-if=\"example.body.binary\">\n <span\n class=\"text-c-2 w-full max-w-full overflow-hidden rounded border px-1.5 py-1 text-xs whitespace-nowrap\">\n {{ (example.body.binary as File).name }}\n </span>\n <ScalarButton\n class=\"bg-b-2 hover:bg-b-3 text-c-2 ml-1 border-0 shadow-none\"\n size=\"sm\"\n variant=\"outlined\"\n @click=\"removeBinaryFile\">\n Delete\n </ScalarButton>\n </template>\n <template v-else>\n <ScalarButton\n class=\"bg-b-2 hover:bg-b-3 text-c-2 border-0 shadow-none\"\n size=\"sm\"\n variant=\"outlined\"\n @click=\"handleFileUpload\">\n <span>Upload File</span>\n <ScalarIcon\n class=\"ml-1\"\n icon=\"Upload\"\n size=\"xs\"\n thickness=\"2.5\" />\n </ScalarButton>\n </template>\n </div>\n </template>\n <template v-else-if=\"selectedContentType?.id == 'multipartForm'\">\n <RequestTable\n ref=\"tableWrapperRef\"\n class=\"!m-0 rounded-t-none border-t-0 border-r-0 border-b-0 border-l-0 shadow-none\"\n :columns=\"['32px', '', '', '104px']\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :items=\"formParams\"\n showUploadButton\n :workspace=\"workspace\"\n @deleteRow=\"deleteRow\"\n @removeFile=\"handleRemoveFileFormData\"\n @toggleRow=\"toggleRow\"\n @updateRow=\"updateRow\"\n @uploadFile=\"handleFileUploadFormData\" />\n </template>\n <template v-else-if=\"selectedContentType?.id == 'formUrlEncoded'\">\n <RequestTable\n ref=\"tableWrapperRef\"\n class=\"!m-0 rounded-t-none border-t-0 border-r-0 border-b-0 border-l-0 shadow-none\"\n :columns=\"['32px', '', '', '104px']\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :items=\"formParams\"\n showUploadButton\n :workspace=\"workspace\"\n @deleteRow=\"deleteRow\"\n @removeFile=\"handleRemoveFileFormData\"\n @toggleRow=\"toggleRow\"\n @updateRow=\"updateRow\"\n @uploadFile=\"handleFileUploadFormData\" />\n </template>\n <template v-else>\n <!-- TODO: remove this as type hack when we add syntax highlighting -->\n <CodeInput\n class=\"border-t px-3\"\n content=\"\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :language=\"codeInputLanguage as CodeMirrorLanguage\"\n lineNumbers\n lint\n :modelValue=\"example.body?.raw?.value ?? ''\"\n :workspace=\"workspace\"\n @update:modelValue=\"updateRequestBody\" />\n </template>\n </DataTableRow>\n <!-- Hacky... but effective, extra table row to trick the last group -->\n <DataTableRow />\n </DataTable>\n </ViewLayoutCollapse>\n</template>\n<style scoped>\n:deep(.cm-content) {\n font-size: var(--scalar-small);\n}\n</style>\n","<script setup lang=\"ts\">\nimport { ScalarButton, ScalarTooltip } from '@scalar/components'\nimport type { Environment } from '@scalar/oas-utils/entities/environment'\nimport {\n requestExampleParametersSchema,\n type RequestExample,\n} from '@scalar/oas-utils/entities/spec'\nimport type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport { computed, nextTick, onMounted, ref, watch } from 'vue'\nimport type { RouteLocationRaw } from 'vue-router'\n\nimport ViewLayoutCollapse from '@/components/ViewLayout/ViewLayoutCollapse.vue'\nimport { useWorkspace } from '@/store'\nimport type { EnvVariable } from '@/store/active-entities'\nimport RequestTable from '@/views/Request/RequestSection/RequestTable.vue'\n\nconst {\n example,\n environment,\n envVariables,\n workspace,\n title,\n paramKey,\n readOnlyEntries = [],\n} = defineProps<{\n example: RequestExample\n environment: Environment\n envVariables: EnvVariable[]\n workspace: Workspace\n title: string\n label: string\n paramKey: keyof RequestExample['parameters']\n readOnlyEntries?: {\n key: string\n value: string\n enabled: boolean\n route: RouteLocationRaw\n }[]\n invalidParams: Set<string>\n}>()\n\nconst { requestExampleMutators } = useWorkspace()\n\nconst params = computed(() => example.parameters[paramKey] ?? [])\n\nonMounted(() => {\n nextTick(() => {\n defaultRow()\n })\n})\n\n/** Add a new row to a given parameter list */\nconst addRow = () => {\n /** Create a new parameter instance with 'enabled' set to false */\n const newParam = requestExampleParametersSchema.parse({ enabled: false })\n const newParams = [...params.value, newParam]\n\n requestExampleMutators.edit(example.uid, `parameters.${paramKey}`, newParams)\n}\n\nconst tableWrapperRef = ref<HTMLInputElement | null>(null)\n\n/** Update a field in a parameter row */\nconst updateRow = (rowIdx: number, field: 'key' | 'value', value: string) => {\n const currentParams = params.value\n if (currentParams.length > rowIdx) {\n const updatedParams = [...currentParams]\n if (!updatedParams[rowIdx]) {\n return\n }\n\n updatedParams[rowIdx] = { ...updatedParams[rowIdx], [field]: value }\n\n /** enable row key or value is filled */\n if (\n updatedParams[rowIdx].key !== '' ||\n updatedParams[rowIdx].value !== ''\n ) {\n updatedParams[rowIdx].enabled = true\n }\n\n /** check key and value input state */\n if (\n updatedParams[rowIdx].key === '' &&\n updatedParams[rowIdx].value === ''\n ) {\n /** remove if empty */\n updatedParams.splice(rowIdx, 1)\n }\n\n requestExampleMutators.edit(\n example.uid,\n `parameters.${paramKey}`,\n updatedParams,\n )\n } else {\n /** if there is no row at the index, add a new one */\n const payload = [requestExampleParametersSchema.parse({ [field]: value })]\n requestExampleMutators.edit(example.uid, `parameters.${paramKey}`, payload)\n\n /** focus the new row */\n nextTick(() => {\n if (!tableWrapperRef.value) {\n return\n }\n const inputs = tableWrapperRef.value.querySelectorAll('input')\n const inputsIndex = field === 'key' ? 0 : 1\n inputs[inputsIndex]?.focus()\n })\n }\n\n // Add a new row if the updated row is the last one\n if (rowIdx === currentParams.length - 1) {\n addRow()\n }\n}\n\n/** Toggle a parameter row on or off */\nconst toggleRow = (rowIdx: number, enabled: boolean) =>\n requestExampleMutators.edit(\n example.uid,\n `parameters.${paramKey}.${rowIdx}.enabled`,\n enabled,\n )\n\nconst deleteAllRows = () => {\n // filter out params that are enabled or required\n const exampleParams = params.value.filter((param) => param.required)\n\n requestExampleMutators.edit(\n example.uid,\n `parameters.${paramKey}`,\n exampleParams,\n )\n\n /** ensure one empty row after deleting all rows */\n nextTick(() => addRow())\n}\n\nconst deleteRow = (rowIdx: number) => {\n const currentParams = params.value\n if (currentParams.length > rowIdx) {\n const updatedParams = [...currentParams]\n updatedParams.splice(rowIdx, 1)\n\n requestExampleMutators.edit(\n example.uid,\n `parameters.${paramKey}`,\n updatedParams,\n )\n }\n}\n\nfunction defaultRow() {\n /** ensure one empty row by default */\n if (params.value.length === 0) {\n addRow()\n } else if (params.value.length >= 1) {\n /** ensure we always have a trailing empty row */\n const lastParam = params.value[params.value.length - 1]\n if (lastParam && lastParam.key !== '' && lastParam.value !== '') {\n addRow()\n }\n }\n}\n\nconst itemCount = computed(\n () => params.value.filter((param) => param.key || param.value).length,\n)\n\nconst showTooltip = computed(() => params.value.length > 1)\n\nwatch(\n () => example,\n (newVal, oldVal) => {\n if (newVal !== oldVal) {\n defaultRow()\n }\n },\n { immediate: true },\n)\n\nconst hasReadOnlyEntries = computed(() => (readOnlyEntries ?? []).length > 0)\n</script>\n<template>\n <ViewLayoutCollapse\n class=\"group/params\"\n :itemCount=\"itemCount\">\n <template #title>{{ title }}</template>\n <template #actions>\n <div\n class=\"text-c-2 request-meta-buttons flex whitespace-nowrap opacity-0 group-hover/params:opacity-100 has-[:focus-visible]:opacity-100\">\n <ScalarTooltip\n v-if=\"showTooltip\"\n content=\"Clear optional parameters\"\n placement=\"left\">\n <ScalarButton\n class=\"pr-0.75 pl-1 transition-none\"\n size=\"sm\"\n variant=\"ghost\"\n @click.stop=\"deleteAllRows\">\n Clear\n <span class=\"sr-only\">All {{ title }}</span>\n </ScalarButton>\n </ScalarTooltip>\n </div>\n </template>\n <div ref=\"tableWrapperRef\">\n <!-- Read-only entries pinned to the top -->\n <RequestTable\n v-if=\"hasReadOnlyEntries\"\n class=\"flex-1\"\n :class=\"{ 'bg-c-3/5': hasReadOnlyEntries }\"\n :columns=\"['32px', '', '']\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :invalidParams=\"invalidParams\"\n isGlobal\n isReadOnly\n :items=\"readOnlyEntries\"\n :label\n :workspace=\"workspace\" />\n <!-- Dynamic entries -->\n <RequestTable\n class=\"flex-1\"\n :columns=\"['32px', '', '']\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :invalidParams=\"invalidParams\"\n :items=\"params\"\n :label\n :workspace=\"workspace\"\n @toggleRow=\"toggleRow\"\n @updateRow=\"updateRow\"\n @deleteRow=\"deleteRow\" />\n </div>\n </ViewLayoutCollapse>\n</template>\n","<script setup lang=\"ts\">\nimport { ScalarButton, ScalarTooltip } from '@scalar/components'\nimport type { Environment } from '@scalar/oas-utils/entities/environment'\nimport {\n requestExampleParametersSchema,\n type RequestExample,\n} from '@scalar/oas-utils/entities/spec'\nimport type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport { computed, nextTick, onMounted, ref, watch } from 'vue'\nimport type { RouteLocationRaw } from 'vue-router'\n\nimport ViewLayoutCollapse from '@/components/ViewLayout/ViewLayoutCollapse.vue'\nimport { useWorkspace } from '@/store'\nimport type { EnvVariable } from '@/store/active-entities'\nimport RequestTable from '@/views/Request/RequestSection/RequestTable.vue'\n\nconst {\n example,\n environment,\n envVariables,\n workspace,\n title,\n paramKey,\n readOnlyEntries = [],\n} = defineProps<{\n example: RequestExample\n environment: Environment\n envVariables: EnvVariable[]\n workspace: Workspace\n title: string\n label: string\n paramKey: keyof RequestExample['parameters']\n readOnlyEntries?: {\n key: string\n value: string\n enabled: boolean\n route: RouteLocationRaw\n }[]\n invalidParams: Set<string>\n}>()\n\nconst { requestExampleMutators } = useWorkspace()\n\nconst params = computed(() => example.parameters[paramKey] ?? [])\n\nonMounted(() => {\n nextTick(() => {\n defaultRow()\n })\n})\n\n/** Add a new row to a given parameter list */\nconst addRow = () => {\n /** Create a new parameter instance with 'enabled' set to false */\n const newParam = requestExampleParametersSchema.parse({ enabled: false })\n const newParams = [...params.value, newParam]\n\n requestExampleMutators.edit(example.uid, `parameters.${paramKey}`, newParams)\n}\n\nconst tableWrapperRef = ref<HTMLInputElement | null>(null)\n\n/** Update a field in a parameter row */\nconst updateRow = (rowIdx: number, field: 'key' | 'value', value: string) => {\n const currentParams = params.value\n if (currentParams.length > rowIdx) {\n const updatedParams = [...currentParams]\n if (!updatedParams[rowIdx]) {\n return\n }\n\n updatedParams[rowIdx] = { ...updatedParams[rowIdx], [field]: value }\n\n /** enable row key or value is filled */\n if (\n updatedParams[rowIdx].key !== '' ||\n updatedParams[rowIdx].value !== ''\n ) {\n updatedParams[rowIdx].enabled = true\n }\n\n /** check key and value input state */\n if (\n updatedParams[rowIdx].key === '' &&\n updatedParams[rowIdx].value === ''\n ) {\n /** remove if empty */\n updatedParams.splice(rowIdx, 1)\n }\n\n requestExampleMutators.edit(\n example.uid,\n `parameters.${paramKey}`,\n updatedParams,\n )\n } else {\n /** if there is no row at the index, add a new one */\n const payload = [requestExampleParametersSchema.parse({ [field]: value })]\n requestExampleMutators.edit(example.uid, `parameters.${paramKey}`, payload)\n\n /** focus the new row */\n nextTick(() => {\n if (!tableWrapperRef.value) {\n return\n }\n const inputs = tableWrapperRef.value.querySelectorAll('input')\n const inputsIndex = field === 'key' ? 0 : 1\n inputs[inputsIndex]?.focus()\n })\n }\n\n // Add a new row if the updated row is the last one\n if (rowIdx === currentParams.length - 1) {\n addRow()\n }\n}\n\n/** Toggle a parameter row on or off */\nconst toggleRow = (rowIdx: number, enabled: boolean) =>\n requestExampleMutators.edit(\n example.uid,\n `parameters.${paramKey}.${rowIdx}.enabled`,\n enabled,\n )\n\nconst deleteAllRows = () => {\n // filter out params that are enabled or required\n const exampleParams = params.value.filter((param) => param.required)\n\n requestExampleMutators.edit(\n example.uid,\n `parameters.${paramKey}`,\n exampleParams,\n )\n\n /** ensure one empty row after deleting all rows */\n nextTick(() => addRow())\n}\n\nconst deleteRow = (rowIdx: number) => {\n const currentParams = params.value\n if (currentParams.length > rowIdx) {\n const updatedParams = [...currentParams]\n updatedParams.splice(rowIdx, 1)\n\n requestExampleMutators.edit(\n example.uid,\n `parameters.${paramKey}`,\n updatedParams,\n )\n }\n}\n\nfunction defaultRow() {\n /** ensure one empty row by default */\n if (params.value.length === 0) {\n addRow()\n } else if (params.value.length >= 1) {\n /** ensure we always have a trailing empty row */\n const lastParam = params.value[params.value.length - 1]\n if (lastParam && lastParam.key !== '' && lastParam.value !== '') {\n addRow()\n }\n }\n}\n\nconst itemCount = computed(\n () => params.value.filter((param) => param.key || param.value).length,\n)\n\nconst showTooltip = computed(() => params.value.length > 1)\n\nwatch(\n () => example,\n (newVal, oldVal) => {\n if (newVal !== oldVal) {\n defaultRow()\n }\n },\n { immediate: true },\n)\n\nconst hasReadOnlyEntries = computed(() => (readOnlyEntries ?? []).length > 0)\n</script>\n<template>\n <ViewLayoutCollapse\n class=\"group/params\"\n :itemCount=\"itemCount\">\n <template #title>{{ title }}</template>\n <template #actions>\n <div\n class=\"text-c-2 request-meta-buttons flex whitespace-nowrap opacity-0 group-hover/params:opacity-100 has-[:focus-visible]:opacity-100\">\n <ScalarTooltip\n v-if=\"showTooltip\"\n content=\"Clear optional parameters\"\n placement=\"left\">\n <ScalarButton\n class=\"pr-0.75 pl-1 transition-none\"\n size=\"sm\"\n variant=\"ghost\"\n @click.stop=\"deleteAllRows\">\n Clear\n <span class=\"sr-only\">All {{ title }}</span>\n </ScalarButton>\n </ScalarTooltip>\n </div>\n </template>\n <div ref=\"tableWrapperRef\">\n <!-- Read-only entries pinned to the top -->\n <RequestTable\n v-if=\"hasReadOnlyEntries\"\n class=\"flex-1\"\n :class=\"{ 'bg-c-3/5': hasReadOnlyEntries }\"\n :columns=\"['32px', '', '']\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :invalidParams=\"invalidParams\"\n isGlobal\n isReadOnly\n :items=\"readOnlyEntries\"\n :label\n :workspace=\"workspace\" />\n <!-- Dynamic entries -->\n <RequestTable\n class=\"flex-1\"\n :columns=\"['32px', '', '']\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :invalidParams=\"invalidParams\"\n :items=\"params\"\n :label\n :workspace=\"workspace\"\n @toggleRow=\"toggleRow\"\n @updateRow=\"updateRow\"\n @deleteRow=\"deleteRow\" />\n </div>\n </ViewLayoutCollapse>\n</template>\n","<script setup lang=\"ts\">\nimport type { Environment } from '@scalar/oas-utils/entities/environment'\nimport type { Operation, RequestExample } from '@scalar/oas-utils/entities/spec'\nimport type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport { REGEX } from '@scalar/oas-utils/helpers'\nimport { computed, watch } from 'vue'\n\nimport ViewLayoutCollapse from '@/components/ViewLayout/ViewLayoutCollapse.vue'\nimport { useWorkspace } from '@/store'\nimport type { EnvVariable } from '@/store/active-entities'\nimport RequestTable from '@/views/Request/RequestSection/RequestTable.vue'\n\nconst {\n example,\n operation,\n paramKey,\n title,\n environment,\n envVariables,\n workspace,\n} = defineProps<{\n example: RequestExample\n operation: Operation\n paramKey: keyof RequestExample['parameters']\n title: string\n environment: Environment\n envVariables: EnvVariable[]\n workspace: Workspace\n invalidParams: Set<string>\n}>()\n\nconst { requestMutators, requestExampleMutators } = useWorkspace()\n\nconst params = computed(() =>\n example.parameters[paramKey].map((param) => ({\n ...param,\n enum: param.enum,\n })),\n)\n\n/** Update a field in a parameter row */\nconst updateRow = (rowIdx: number, field: 'key' | 'value', value: string) => {\n const parameters = example.parameters[paramKey]\n const oldKey = parameters[rowIdx]?.key\n if (!oldKey) {\n return\n }\n\n /** Change variable in path as well */\n if (field === 'key') {\n if (parameters[rowIdx]?.required) {\n /** Prevent updating the key of a required item */\n return\n }\n if (!value) {\n /** Remove parameter if path params table key is empty */\n parameters.splice(rowIdx, 1)\n const regx = new RegExp(`/:${encodeURIComponent(oldKey)}(?=[/?#]|$)`, 'g')\n const newPath = operation.path.replace(regx, '')\n\n requestMutators.edit(operation.uid, 'path', newPath)\n } else {\n /** Update URL with path params table key */\n const encodedOldKey = encodeURIComponent(oldKey)\n const encodedNewKey = encodeURIComponent(value)\n const regx = new RegExp(`(?<=/):${encodedOldKey}(?=[/?#]|$)`, 'g')\n const newPath = operation.path.replace(regx, `:${encodedNewKey}`)\n requestMutators.edit(operation.uid, 'path', newPath)\n }\n }\n\n requestExampleMutators.edit(\n example.uid,\n `parameters.${paramKey}.${rowIdx}.${field}`,\n value,\n )\n}\n\nconst deleteRow = (rowIdx: number) => {\n const currentParams = params.value\n if (currentParams.length > rowIdx) {\n const updatedParams = [...currentParams]\n updatedParams.splice(rowIdx, 1)\n\n requestExampleMutators.edit(\n example.uid,\n `parameters.${paramKey}`,\n updatedParams,\n )\n }\n}\n\nconst setPathVariable = (url: string) => {\n const pathVariables = url.match(REGEX.PATH)?.map((v) => v.slice(1, -1)) || []\n const parameters = example.parameters[paramKey]\n\n const paramMap = new Map(parameters.map((param) => [param.key, param]))\n const updatedParameters = pathVariables.map(\n (key) => paramMap.get(key) || { key, value: '', enabled: true },\n )\n\n parameters.forEach((param) => {\n /** prevent removing required parameters or with a value */\n if (!pathVariables.includes(param.key) && (param.value || param.required)) {\n updatedParameters.push(param)\n }\n })\n parameters.splice(0, parameters.length, ...updatedParameters)\n\n requestExampleMutators.edit(example.uid, `parameters.${paramKey}`, parameters)\n}\n\nconst handlePathVariableUpdate = (url: string) => {\n if (url) {\n setPathVariable(url)\n }\n}\n\nwatch(\n () => operation.path,\n (newURL) => {\n if (newURL) {\n handlePathVariableUpdate(newURL)\n }\n },\n)\n</script>\n<template>\n <ViewLayoutCollapse :itemCount=\"params.length\">\n <template #title>\n {{ title }}\n </template>\n\n <RequestTable\n v-if=\"params.length\"\n class=\"flex-1\"\n :columns=\"['32px', '', '']\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :invalidParams=\"invalidParams\"\n :items=\"params\"\n :workspace=\"workspace\"\n @updateRow=\"updateRow\"\n @deleteRow=\"deleteRow\" />\n </ViewLayoutCollapse>\n</template>\n","<script setup lang=\"ts\">\nimport type { Environment } from '@scalar/oas-utils/entities/environment'\nimport type { Operation, RequestExample } from '@scalar/oas-utils/entities/spec'\nimport type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport { REGEX } from '@scalar/oas-utils/helpers'\nimport { computed, watch } from 'vue'\n\nimport ViewLayoutCollapse from '@/components/ViewLayout/ViewLayoutCollapse.vue'\nimport { useWorkspace } from '@/store'\nimport type { EnvVariable } from '@/store/active-entities'\nimport RequestTable from '@/views/Request/RequestSection/RequestTable.vue'\n\nconst {\n example,\n operation,\n paramKey,\n title,\n environment,\n envVariables,\n workspace,\n} = defineProps<{\n example: RequestExample\n operation: Operation\n paramKey: keyof RequestExample['parameters']\n title: string\n environment: Environment\n envVariables: EnvVariable[]\n workspace: Workspace\n invalidParams: Set<string>\n}>()\n\nconst { requestMutators, requestExampleMutators } = useWorkspace()\n\nconst params = computed(() =>\n example.parameters[paramKey].map((param) => ({\n ...param,\n enum: param.enum,\n })),\n)\n\n/** Update a field in a parameter row */\nconst updateRow = (rowIdx: number, field: 'key' | 'value', value: string) => {\n const parameters = example.parameters[paramKey]\n const oldKey = parameters[rowIdx]?.key\n if (!oldKey) {\n return\n }\n\n /** Change variable in path as well */\n if (field === 'key') {\n if (parameters[rowIdx]?.required) {\n /** Prevent updating the key of a required item */\n return\n }\n if (!value) {\n /** Remove parameter if path params table key is empty */\n parameters.splice(rowIdx, 1)\n const regx = new RegExp(`/:${encodeURIComponent(oldKey)}(?=[/?#]|$)`, 'g')\n const newPath = operation.path.replace(regx, '')\n\n requestMutators.edit(operation.uid, 'path', newPath)\n } else {\n /** Update URL with path params table key */\n const encodedOldKey = encodeURIComponent(oldKey)\n const encodedNewKey = encodeURIComponent(value)\n const regx = new RegExp(`(?<=/):${encodedOldKey}(?=[/?#]|$)`, 'g')\n const newPath = operation.path.replace(regx, `:${encodedNewKey}`)\n requestMutators.edit(operation.uid, 'path', newPath)\n }\n }\n\n requestExampleMutators.edit(\n example.uid,\n `parameters.${paramKey}.${rowIdx}.${field}`,\n value,\n )\n}\n\nconst deleteRow = (rowIdx: number) => {\n const currentParams = params.value\n if (currentParams.length > rowIdx) {\n const updatedParams = [...currentParams]\n updatedParams.splice(rowIdx, 1)\n\n requestExampleMutators.edit(\n example.uid,\n `parameters.${paramKey}`,\n updatedParams,\n )\n }\n}\n\nconst setPathVariable = (url: string) => {\n const pathVariables = url.match(REGEX.PATH)?.map((v) => v.slice(1, -1)) || []\n const parameters = example.parameters[paramKey]\n\n const paramMap = new Map(parameters.map((param) => [param.key, param]))\n const updatedParameters = pathVariables.map(\n (key) => paramMap.get(key) || { key, value: '', enabled: true },\n )\n\n parameters.forEach((param) => {\n /** prevent removing required parameters or with a value */\n if (!pathVariables.includes(param.key) && (param.value || param.required)) {\n updatedParameters.push(param)\n }\n })\n parameters.splice(0, parameters.length, ...updatedParameters)\n\n requestExampleMutators.edit(example.uid, `parameters.${paramKey}`, parameters)\n}\n\nconst handlePathVariableUpdate = (url: string) => {\n if (url) {\n setPathVariable(url)\n }\n}\n\nwatch(\n () => operation.path,\n (newURL) => {\n if (newURL) {\n handlePathVariableUpdate(newURL)\n }\n },\n)\n</script>\n<template>\n <ViewLayoutCollapse :itemCount=\"params.length\">\n <template #title>\n {{ title }}\n </template>\n\n <RequestTable\n v-if=\"params.length\"\n class=\"flex-1\"\n :columns=\"['32px', '', '']\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :invalidParams=\"invalidParams\"\n :items=\"params\"\n :workspace=\"workspace\"\n @updateRow=\"updateRow\"\n @deleteRow=\"deleteRow\" />\n </ViewLayoutCollapse>\n</template>\n","<script setup lang=\"ts\">\nimport {\n ScalarButton,\n ScalarCodeBlock,\n ScalarCombobox,\n ScalarIcon,\n type ScalarComboboxOption,\n} from '@scalar/components'\nimport type {\n Collection,\n Operation,\n RequestExample,\n SecurityScheme,\n Server,\n} from '@scalar/oas-utils/entities/spec'\nimport type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport { snippetz, type ClientId, type TargetId } from '@scalar/snippetz'\nimport { computed, ref } from 'vue'\n\nimport DataTable from '@/components/DataTable/DataTable.vue'\nimport DataTableRow from '@/components/DataTable/DataTableRow.vue'\nimport ViewLayoutCollapse from '@/components/ViewLayout/ViewLayoutCollapse.vue'\nimport type { EnvVariables } from '@/libs/env-helpers'\nimport { useWorkspace } from '@/store'\nimport { CodeSnippet } from '@/views/Components/CodeSnippet'\n\nconst { collection, example, operation, server, workspace } = defineProps<{\n collection: Collection\n example: RequestExample\n operation: Operation\n server: Server | undefined\n workspace: Workspace\n environment: EnvVariables\n}>()\n\nconst { securitySchemes, workspaceMutators } = useWorkspace()\n\nconst localSelectedClient = computed(() => {\n // If the current selection is a custom example\n if (localSelectedClientState.value.targetKey === 'custom') {\n // Check if this custom example still exists in the new operation\n const customExampleExists = codeSamples.value?.some(\n (sample) => sample.lang === localSelectedClientState.value.clientKey,\n )\n\n // If it exists, keep using it\n if (customExampleExists) {\n return localSelectedClientState.value\n }\n }\n\n // Otherwise fall back to workspace selection\n return {\n targetKey: workspace.selectedHttpClient?.targetKey ?? 'js',\n clientKey: workspace.selectedHttpClient?.clientKey ?? 'fetch',\n }\n})\n\nconst codeSamples = computed(\n () =>\n operation['x-codeSamples'] ||\n operation['x-code-samples'] ||\n operation['x-custom-examples'],\n)\n\n// Store the actual selected state\nconst localSelectedClientState = ref(\n codeSamples.value?.length\n ? {\n targetKey: 'custom',\n clientKey: codeSamples.value[0]?.lang,\n }\n : {\n targetKey: workspace.selectedHttpClient?.targetKey ?? 'js',\n clientKey: workspace.selectedHttpClient?.clientKey ?? 'fetch',\n },\n)\n\n/**\n * Returns selected security schemes for the request\n */\nconst selectedSecuritySchemes = computed(() => {\n const uids =\n operation.selectedSecuritySchemeUids ||\n collection.selectedSecuritySchemeUids ||\n []\n return uids\n .flat()\n .map((uid) => securitySchemes[uid])\n .filter((scheme): scheme is SecurityScheme => Boolean(scheme))\n})\n\n/**\n * Group plugins by target/language to show in a dropdown, also build a dictionary in the same loop\n **/\nconst snippets = computed(() => {\n const dict: Record<string, string> = {}\n\n // Get the built-in snippets\n const builtInOptions = snippetz()\n .clients()\n .map((group) => ({\n label: group.title,\n options: group.clients.map((plugin) => {\n dict[`${group.key},${plugin.client}`] = plugin.title\n return {\n id: `${group.key},${plugin.client}`,\n label: plugin.title,\n }\n }),\n }))\n\n // Get any custom code samples from x-codeSamples\n const customExamples = (\n operation['x-codeSamples'] ||\n operation['x-code-samples'] ||\n operation['x-custom-examples'] ||\n []\n ).map((sample) => ({\n id: `custom,${sample.lang}`,\n label: sample.label || sample.lang,\n }))\n\n // If we have custom samples, add them as a new group\n const options =\n customExamples.length > 0\n ? [\n {\n id: 'customExamples',\n label: 'Code Examples',\n options: customExamples.map((customExample) => ({\n id: customExample.id,\n label: customExample.label ?? customExample.id,\n })),\n },\n ...builtInOptions,\n ]\n : builtInOptions\n\n // Add custom samples to the dictionary\n customExamples.forEach((sample) => {\n dict[sample.id] = sample.label ?? sample.id\n })\n\n return {\n options,\n dict,\n }\n})\n\n/** The currently selected plugin */\nconst selectedPlugin = computed(() => {\n const client = localSelectedClient.value\n\n // Handle custom examples\n if (client.targetKey === 'custom') {\n const id = `custom,${client.clientKey}`\n return {\n id,\n label: snippets.value.dict[id] ?? 'Unknown',\n }\n }\n\n // Handle regular snippetz plugins\n const id = `${client.targetKey},${client.clientKey}`\n return {\n id,\n label: snippets.value.dict[id] ?? 'Unknown',\n }\n})\n\n/** The currently selected target */\nconst selectedTarget = computed(\n () => localSelectedClient.value.targetKey as TargetId,\n)\n\n/** The currently selected client */\nconst selectedClient = computed(\n () => localSelectedClient.value.clientKey as ClientId<TargetId>,\n)\n\n/** Update the selection when a new client is picked */\nconst selectClient = (value: ScalarComboboxOption | undefined) => {\n if (!value) {\n return\n }\n const { id } = value\n const [target, client] = id.split(',')\n\n if (!target || !client) {\n return\n }\n\n // Update the state ref\n localSelectedClientState.value = {\n targetKey: target,\n clientKey: client,\n }\n\n // Only update workspace for non-custom selections\n if (target !== 'custom') {\n workspaceMutators.edit(workspace.uid, 'selectedHttpClient', {\n targetKey: target,\n clientKey: client,\n })\n }\n}\n\n/** Get the code sample content for a custom example */\nconst customCodeContent = computed(() => {\n if (!selectedPlugin.value.id.startsWith('custom,')) {\n return undefined\n }\n\n const lang = selectedPlugin.value.id.split(',')[1]\n const sample = codeSamples.value?.find((s) => s.lang === lang)\n return sample?.source\n})\n</script>\n\n<template>\n <div class=\"w-full\">\n <ViewLayoutCollapse\n class=\"group/preview w-full border-b-0\"\n :defaultOpen=\"false\">\n <template #title>Code Snippet</template>\n <template #actions>\n <div class=\"flex flex-1\">\n <ScalarCombobox\n :modelValue=\"selectedPlugin\"\n :options=\"snippets.options\"\n placement=\"bottom-end\"\n @update:modelValue=\"selectClient\">\n <ScalarButton\n class=\"text-c-2 hover:text-c-1 flex h-full w-fit gap-1.5 px-1.25 py-0.75 font-normal\"\n variant=\"ghost\">\n <span>{{ selectedPlugin?.label }}</span>\n <ScalarIcon\n icon=\"ChevronDown\"\n size=\"md\" />\n </ScalarButton>\n </ScalarCombobox>\n </div>\n </template>\n <DataTable\n :columns=\"['']\"\n presentational>\n <DataTableRow>\n <div\n class=\"bg-b-1 flex items-center justify-center overflow-hidden border-t\">\n <!-- Use the given code example -->\n <template v-if=\"customCodeContent\">\n <ScalarCodeBlock\n :content=\"customCodeContent\"\n :lang=\"selectedPlugin.id.split(',')[1] ?? 'plaintext'\" />\n </template>\n <!-- Generate a code snippet -->\n <template v-else>\n <CodeSnippet\n :client=\"selectedClient\"\n :example=\"example\"\n :operation=\"operation\"\n :securitySchemes=\"selectedSecuritySchemes\"\n :server=\"server\"\n :target=\"selectedTarget\"\n :environment=\"environment\" />\n </template>\n </div>\n </DataTableRow>\n </DataTable>\n </ViewLayoutCollapse>\n </div>\n</template>\n<style scoped>\n:deep(code.hljs *) {\n font-size: var(--scalar-small);\n}\n</style>\n","<script setup lang=\"ts\">\nimport {\n ScalarButton,\n ScalarCodeBlock,\n ScalarCombobox,\n ScalarIcon,\n type ScalarComboboxOption,\n} from '@scalar/components'\nimport type {\n Collection,\n Operation,\n RequestExample,\n SecurityScheme,\n Server,\n} from '@scalar/oas-utils/entities/spec'\nimport type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport { snippetz, type ClientId, type TargetId } from '@scalar/snippetz'\nimport { computed, ref } from 'vue'\n\nimport DataTable from '@/components/DataTable/DataTable.vue'\nimport DataTableRow from '@/components/DataTable/DataTableRow.vue'\nimport ViewLayoutCollapse from '@/components/ViewLayout/ViewLayoutCollapse.vue'\nimport type { EnvVariables } from '@/libs/env-helpers'\nimport { useWorkspace } from '@/store'\nimport { CodeSnippet } from '@/views/Components/CodeSnippet'\n\nconst { collection, example, operation, server, workspace } = defineProps<{\n collection: Collection\n example: RequestExample\n operation: Operation\n server: Server | undefined\n workspace: Workspace\n environment: EnvVariables\n}>()\n\nconst { securitySchemes, workspaceMutators } = useWorkspace()\n\nconst localSelectedClient = computed(() => {\n // If the current selection is a custom example\n if (localSelectedClientState.value.targetKey === 'custom') {\n // Check if this custom example still exists in the new operation\n const customExampleExists = codeSamples.value?.some(\n (sample) => sample.lang === localSelectedClientState.value.clientKey,\n )\n\n // If it exists, keep using it\n if (customExampleExists) {\n return localSelectedClientState.value\n }\n }\n\n // Otherwise fall back to workspace selection\n return {\n targetKey: workspace.selectedHttpClient?.targetKey ?? 'js',\n clientKey: workspace.selectedHttpClient?.clientKey ?? 'fetch',\n }\n})\n\nconst codeSamples = computed(\n () =>\n operation['x-codeSamples'] ||\n operation['x-code-samples'] ||\n operation['x-custom-examples'],\n)\n\n// Store the actual selected state\nconst localSelectedClientState = ref(\n codeSamples.value?.length\n ? {\n targetKey: 'custom',\n clientKey: codeSamples.value[0]?.lang,\n }\n : {\n targetKey: workspace.selectedHttpClient?.targetKey ?? 'js',\n clientKey: workspace.selectedHttpClient?.clientKey ?? 'fetch',\n },\n)\n\n/**\n * Returns selected security schemes for the request\n */\nconst selectedSecuritySchemes = computed(() => {\n const uids =\n operation.selectedSecuritySchemeUids ||\n collection.selectedSecuritySchemeUids ||\n []\n return uids\n .flat()\n .map((uid) => securitySchemes[uid])\n .filter((scheme): scheme is SecurityScheme => Boolean(scheme))\n})\n\n/**\n * Group plugins by target/language to show in a dropdown, also build a dictionary in the same loop\n **/\nconst snippets = computed(() => {\n const dict: Record<string, string> = {}\n\n // Get the built-in snippets\n const builtInOptions = snippetz()\n .clients()\n .map((group) => ({\n label: group.title,\n options: group.clients.map((plugin) => {\n dict[`${group.key},${plugin.client}`] = plugin.title\n return {\n id: `${group.key},${plugin.client}`,\n label: plugin.title,\n }\n }),\n }))\n\n // Get any custom code samples from x-codeSamples\n const customExamples = (\n operation['x-codeSamples'] ||\n operation['x-code-samples'] ||\n operation['x-custom-examples'] ||\n []\n ).map((sample) => ({\n id: `custom,${sample.lang}`,\n label: sample.label || sample.lang,\n }))\n\n // If we have custom samples, add them as a new group\n const options =\n customExamples.length > 0\n ? [\n {\n id: 'customExamples',\n label: 'Code Examples',\n options: customExamples.map((customExample) => ({\n id: customExample.id,\n label: customExample.label ?? customExample.id,\n })),\n },\n ...builtInOptions,\n ]\n : builtInOptions\n\n // Add custom samples to the dictionary\n customExamples.forEach((sample) => {\n dict[sample.id] = sample.label ?? sample.id\n })\n\n return {\n options,\n dict,\n }\n})\n\n/** The currently selected plugin */\nconst selectedPlugin = computed(() => {\n const client = localSelectedClient.value\n\n // Handle custom examples\n if (client.targetKey === 'custom') {\n const id = `custom,${client.clientKey}`\n return {\n id,\n label: snippets.value.dict[id] ?? 'Unknown',\n }\n }\n\n // Handle regular snippetz plugins\n const id = `${client.targetKey},${client.clientKey}`\n return {\n id,\n label: snippets.value.dict[id] ?? 'Unknown',\n }\n})\n\n/** The currently selected target */\nconst selectedTarget = computed(\n () => localSelectedClient.value.targetKey as TargetId,\n)\n\n/** The currently selected client */\nconst selectedClient = computed(\n () => localSelectedClient.value.clientKey as ClientId<TargetId>,\n)\n\n/** Update the selection when a new client is picked */\nconst selectClient = (value: ScalarComboboxOption | undefined) => {\n if (!value) {\n return\n }\n const { id } = value\n const [target, client] = id.split(',')\n\n if (!target || !client) {\n return\n }\n\n // Update the state ref\n localSelectedClientState.value = {\n targetKey: target,\n clientKey: client,\n }\n\n // Only update workspace for non-custom selections\n if (target !== 'custom') {\n workspaceMutators.edit(workspace.uid, 'selectedHttpClient', {\n targetKey: target,\n clientKey: client,\n })\n }\n}\n\n/** Get the code sample content for a custom example */\nconst customCodeContent = computed(() => {\n if (!selectedPlugin.value.id.startsWith('custom,')) {\n return undefined\n }\n\n const lang = selectedPlugin.value.id.split(',')[1]\n const sample = codeSamples.value?.find((s) => s.lang === lang)\n return sample?.source\n})\n</script>\n\n<template>\n <div class=\"w-full\">\n <ViewLayoutCollapse\n class=\"group/preview w-full border-b-0\"\n :defaultOpen=\"false\">\n <template #title>Code Snippet</template>\n <template #actions>\n <div class=\"flex flex-1\">\n <ScalarCombobox\n :modelValue=\"selectedPlugin\"\n :options=\"snippets.options\"\n placement=\"bottom-end\"\n @update:modelValue=\"selectClient\">\n <ScalarButton\n class=\"text-c-2 hover:text-c-1 flex h-full w-fit gap-1.5 px-1.25 py-0.75 font-normal\"\n variant=\"ghost\">\n <span>{{ selectedPlugin?.label }}</span>\n <ScalarIcon\n icon=\"ChevronDown\"\n size=\"md\" />\n </ScalarButton>\n </ScalarCombobox>\n </div>\n </template>\n <DataTable\n :columns=\"['']\"\n presentational>\n <DataTableRow>\n <div\n class=\"bg-b-1 flex items-center justify-center overflow-hidden border-t\">\n <!-- Use the given code example -->\n <template v-if=\"customCodeContent\">\n <ScalarCodeBlock\n :content=\"customCodeContent\"\n :lang=\"selectedPlugin.id.split(',')[1] ?? 'plaintext'\" />\n </template>\n <!-- Generate a code snippet -->\n <template v-else>\n <CodeSnippet\n :client=\"selectedClient\"\n :example=\"example\"\n :operation=\"operation\"\n :securitySchemes=\"selectedSecuritySchemes\"\n :server=\"server\"\n :target=\"selectedTarget\"\n :environment=\"environment\" />\n </template>\n </div>\n </DataTableRow>\n </DataTable>\n </ViewLayoutCollapse>\n </div>\n</template>\n<style scoped>\n:deep(code.hljs *) {\n font-size: var(--scalar-small);\n}\n</style>\n","<script setup lang=\"ts\">\nimport { ScalarErrorBoundary } from '@scalar/components'\nimport type { Environment } from '@scalar/oas-utils/entities/environment'\nimport type { SelectedSecuritySchemeUids } from '@scalar/oas-utils/entities/shared'\nimport type {\n Collection,\n Operation,\n RequestExample,\n Server,\n} from '@scalar/oas-utils/entities/spec'\nimport type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport { canMethodHaveBody, isDefined, REGEX } from '@scalar/oas-utils/helpers'\nimport { computed, ref, useId, watch } from 'vue'\n\nimport SectionFilter from '@/components/SectionFilter.vue'\nimport ViewLayoutSection from '@/components/ViewLayout/ViewLayoutSection.vue'\nimport { useLayout } from '@/hooks'\nimport { matchesDomain } from '@/libs/send-request/set-request-cookies'\nimport { usePluginManager } from '@/plugins'\nimport { useWorkspace } from '@/store'\nimport type { EnvVariable } from '@/store/active-entities'\nimport RequestBody from '@/views/Request/RequestSection/RequestBody.vue'\nimport RequestParams from '@/views/Request/RequestSection/RequestParams.vue'\nimport RequestPathParams from '@/views/Request/RequestSection/RequestPathParams.vue'\n\nimport RequestAuth from './RequestAuth/RequestAuth.vue'\nimport RequestCodeExample from './RequestCodeExample.vue'\n\nconst {\n collection,\n environment,\n envVariables,\n example,\n operation,\n selectedSecuritySchemeUids,\n server,\n workspace,\n} = defineProps<{\n collection: Collection\n environment: Environment\n envVariables: EnvVariable[]\n example: RequestExample\n invalidParams: Set<string>\n operation: Operation\n selectedSecuritySchemeUids: SelectedSecuritySchemeUids\n server: Server | undefined\n workspace: Workspace\n}>()\n\nconst requestSections = [\n 'Auth',\n 'Path Parameters',\n 'Cookies',\n 'Headers',\n 'Query',\n 'Body',\n // 'Scripts',\n] as const\n\ntype Filter = 'All' | (typeof requestSections)[number]\n\nconst { requestMutators, cookies, securitySchemes } = useWorkspace()\nconst { layout } = useLayout()\n\nconst filters = computed<Filter[]>(() => {\n const allSections = new Set<Filter>(['All', ...requestSections])\n\n if (!example.parameters.path.length) {\n allSections.delete('Path Parameters')\n }\n if (!canMethodHaveBody(operation.method ?? 'get')) {\n allSections.delete('Body')\n }\n if (isAuthHidden.value) {\n allSections.delete('Auth')\n }\n\n return [...allSections]\n})\n\n/** A list of section ids */\nconst filterIds = computed(\n () =>\n Object.fromEntries(\n filters.value.map((section) => [section, useId()]),\n ) as Record<Filter, string>,\n)\n\n// If security = [] or [{}] just hide it on readOnly mode\nconst isAuthHidden = computed(\n () =>\n layout === 'modal' &&\n !operation.security &&\n !Object.keys(securitySchemes ?? {}).length,\n)\n\nconst selectedFilter = ref<Filter>('All')\n\nwatch(\n () => operation,\n (newOperation) => {\n if (\n selectedFilter.value === 'Body' &&\n newOperation &&\n !canMethodHaveBody(newOperation.method)\n ) {\n selectedFilter.value = 'All'\n }\n },\n)\n\nconst updateRequestNameHandler = (event: Event) => {\n const target = event.target as HTMLInputElement\n requestMutators.edit(operation.uid, 'summary', target.value)\n}\n\n/**\n * Add the global cookies as static entries to the cookies section\n */\nconst activeWorkspaceCookies = computed(() =>\n (workspace.cookies ?? [])\n .map((uid) => cookies[uid])\n .filter(isDefined)\n .filter((cookie) => cookie.name)\n .filter((cookie) =>\n matchesDomain(server?.url || operation.path, cookie.domain),\n )\n .map((cookie) => ({\n key: cookie.name,\n value: cookie.value,\n route: {\n name: 'cookies',\n params: {\n cookies: cookie.uid,\n },\n },\n enabled: true,\n })),\n)\n\n// If the request has no summary, use the path or fallback\nconst handleRequestNamePlaceholder = () => {\n return operation.summary\n ? operation.summary\n : operation.path.replace(REGEX.PROTOCOL, '')\n ? operation.path.replace(REGEX.PROTOCOL, '')\n : 'Request Name'\n}\n\nconst labelRequestNameId = useId()\n\n// Plugins\nconst pluginManager = usePluginManager()\n\nconst requestSectionViews = pluginManager.getViewComponents('request.section')\n\nconst updateOperationHandler = (key: keyof Operation, value: string) =>\n requestMutators.edit(operation.uid, key, value)\n\n// Sets to all when auth filter is hidden but was previously selected to prevent empty section\nwatch(\n () => isAuthHidden.value,\n (authHidden) => {\n if (authHidden && selectedFilter.value === 'Auth') {\n selectedFilter.value = 'All'\n }\n },\n)\n</script>\n<template>\n <ViewLayoutSection :aria-label=\"`Request: ${operation.summary}`\">\n <template #title>\n <div\n class=\"group pointer-events-none flex flex-1 items-center gap-1 lg:pr-24\">\n <label\n v-if=\"layout !== 'modal'\"\n class=\"pointer-events-auto absolute top-0 left-0 h-full w-full cursor-text opacity-0\"\n :for=\"labelRequestNameId\" />\n <input\n v-if=\"layout !== 'modal'\"\n :id=\"labelRequestNameId\"\n class=\"text-c-1 group-hover-input pointer-events-auto relative z-10 -ml-0.5 h-8 w-full rounded pl-1.25 has-[:focus-visible]:outline md:-ml-1.25\"\n :placeholder=\"handleRequestNamePlaceholder()\"\n :value=\"operation.summary\"\n @input=\"updateRequestNameHandler\" />\n <span\n v-else\n class=\"text-c-1 flex h-8 items-center\">\n {{ operation.summary }}\n </span>\n </div>\n <SectionFilter\n v-model=\"selectedFilter\"\n :filterIds=\"filterIds\"\n :filters=\"filters\" />\n </template>\n <div\n :id=\"filterIds.All\"\n class=\"request-section-content custom-scroll relative flex flex-1 flex-col\"\n :role=\"selectedFilter === 'All' ? 'tabpanel' : 'none'\">\n <RequestAuth\n v-if=\"\n collection &&\n workspace &&\n (layout !== 'modal' || Object.keys(securitySchemes ?? {}).length)\n \"\n v-show=\"\n !isAuthHidden &&\n (selectedFilter === 'All' || selectedFilter === 'Auth')\n \"\n :id=\"filterIds.Auth\"\n class=\"request-section-content-auth\"\n :collection=\"collection\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :isReadOnly=\"layout === 'modal'\"\n layout=\"client\"\n :operation=\"operation\"\n :role=\"selectedFilter === 'All' ? 'none' : 'tabpanel'\"\n :selectedSecuritySchemeUids=\"selectedSecuritySchemeUids\"\n :server=\"server\"\n title=\"Authentication\"\n :workspace=\"workspace\" />\n <RequestPathParams\n v-show=\"\n (selectedFilter === 'All' || selectedFilter === 'Path Parameters') &&\n example.parameters.path.length\n \"\n :id=\"filterIds['Path Parameters']\"\n class=\"request-section-content-path-params\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :example=\"example\"\n :invalidParams=\"invalidParams\"\n :operation=\"operation\"\n paramKey=\"path\"\n :role=\"selectedFilter === 'All' ? 'none' : 'tabpanel'\"\n title=\"Path Parameters\"\n :workspace=\"workspace\" />\n <RequestParams\n v-show=\"selectedFilter === 'All' || selectedFilter === 'Cookies'\"\n :id=\"filterIds.Cookies\"\n class=\"request-section-content-cookies\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :example=\"example\"\n :invalidParams=\"invalidParams\"\n label=\"Cookie\"\n :operation=\"operation\"\n paramKey=\"cookies\"\n :readOnlyEntries=\"activeWorkspaceCookies\"\n :role=\"selectedFilter === 'All' ? 'none' : 'tabpanel'\"\n title=\"Cookies\"\n :workspace=\"workspace\" />\n <RequestParams\n v-show=\"selectedFilter === 'All' || selectedFilter === 'Headers'\"\n :id=\"filterIds.Headers\"\n class=\"request-section-content-headers\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :example=\"example\"\n :invalidParams=\"invalidParams\"\n label=\"Header\"\n :operation=\"operation\"\n paramKey=\"headers\"\n :role=\"selectedFilter === 'All' ? 'none' : 'tabpanel'\"\n title=\"Headers\"\n :workspace=\"workspace\" />\n <RequestParams\n v-show=\"selectedFilter === 'All' || selectedFilter === 'Query'\"\n :id=\"filterIds.Query\"\n class=\"request-section-content-query\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :example=\"example\"\n :invalidParams=\"invalidParams\"\n label=\"Parameter\"\n :operation=\"operation\"\n paramKey=\"query\"\n :role=\"selectedFilter === 'All' ? 'none' : 'tabpanel'\"\n title=\"Query Parameters\"\n :workspace=\"workspace\" />\n <RequestBody\n v-if=\"\n operation.method &&\n (selectedFilter === 'All' || selectedFilter === 'Body') &&\n canMethodHaveBody(operation.method)\n \"\n :id=\"filterIds.Body\"\n class=\"request-section-content-body\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :example=\"example\"\n :operation=\"operation\"\n :role=\"selectedFilter === 'All' ? 'none' : 'tabpanel'\"\n title=\"Body\"\n :workspace=\"workspace\" />\n\n <template\n v-for=\"(view, index) in requestSectionViews\"\n :key=\"view.title ?? index\">\n <ScalarErrorBoundary>\n <component\n :is=\"view.component\"\n v-show=\"selectedFilter === 'All' || selectedFilter === view.title\"\n :operation=\"operation\"\n @update:operation=\"updateOperationHandler\" />\n </ScalarErrorBoundary>\n </template>\n\n <!-- Spacer -->\n <div class=\"flex flex-grow\" />\n\n <!-- Code Snippet -->\n <ScalarErrorBoundary>\n <RequestCodeExample\n class=\"request-section-content-code-example -mt-1/2 border-t\"\n :collection=\"collection\"\n :environment=\"envVariables\"\n :example=\"example\"\n :operation=\"operation\"\n :server=\"server\"\n :workspace=\"workspace\" />\n </ScalarErrorBoundary>\n </div>\n </ViewLayoutSection>\n</template>\n<style scoped>\n.request-section-content {\n --scalar-border-width: 0.5px;\n}\n.request-section-content-filter {\n box-shadow: 0 -10px 0 10px var(--scalar-background-1);\n}\n.request-item:focus-within .request-meta-buttons {\n opacity: 1;\n}\n.group-hover-input {\n border-width: var(--scalar-border-width);\n border-color: transparent;\n}\n.group:hover .group-hover-input {\n background: color-mix(\n in srgb,\n var(--scalar-background-1),\n var(--scalar-background-2)\n );\n border-color: var(--scalar-border-color);\n}\n.group-hover-input:focus {\n background: transparent !important;\n border-color: var(--scalar-border-color) !important;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { ScalarErrorBoundary } from '@scalar/components'\nimport type { Environment } from '@scalar/oas-utils/entities/environment'\nimport type { SelectedSecuritySchemeUids } from '@scalar/oas-utils/entities/shared'\nimport type {\n Collection,\n Operation,\n RequestExample,\n Server,\n} from '@scalar/oas-utils/entities/spec'\nimport type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport { canMethodHaveBody, isDefined, REGEX } from '@scalar/oas-utils/helpers'\nimport { computed, ref, useId, watch } from 'vue'\n\nimport SectionFilter from '@/components/SectionFilter.vue'\nimport ViewLayoutSection from '@/components/ViewLayout/ViewLayoutSection.vue'\nimport { useLayout } from '@/hooks'\nimport { matchesDomain } from '@/libs/send-request/set-request-cookies'\nimport { usePluginManager } from '@/plugins'\nimport { useWorkspace } from '@/store'\nimport type { EnvVariable } from '@/store/active-entities'\nimport RequestBody from '@/views/Request/RequestSection/RequestBody.vue'\nimport RequestParams from '@/views/Request/RequestSection/RequestParams.vue'\nimport RequestPathParams from '@/views/Request/RequestSection/RequestPathParams.vue'\n\nimport RequestAuth from './RequestAuth/RequestAuth.vue'\nimport RequestCodeExample from './RequestCodeExample.vue'\n\nconst {\n collection,\n environment,\n envVariables,\n example,\n operation,\n selectedSecuritySchemeUids,\n server,\n workspace,\n} = defineProps<{\n collection: Collection\n environment: Environment\n envVariables: EnvVariable[]\n example: RequestExample\n invalidParams: Set<string>\n operation: Operation\n selectedSecuritySchemeUids: SelectedSecuritySchemeUids\n server: Server | undefined\n workspace: Workspace\n}>()\n\nconst requestSections = [\n 'Auth',\n 'Path Parameters',\n 'Cookies',\n 'Headers',\n 'Query',\n 'Body',\n // 'Scripts',\n] as const\n\ntype Filter = 'All' | (typeof requestSections)[number]\n\nconst { requestMutators, cookies, securitySchemes } = useWorkspace()\nconst { layout } = useLayout()\n\nconst filters = computed<Filter[]>(() => {\n const allSections = new Set<Filter>(['All', ...requestSections])\n\n if (!example.parameters.path.length) {\n allSections.delete('Path Parameters')\n }\n if (!canMethodHaveBody(operation.method ?? 'get')) {\n allSections.delete('Body')\n }\n if (isAuthHidden.value) {\n allSections.delete('Auth')\n }\n\n return [...allSections]\n})\n\n/** A list of section ids */\nconst filterIds = computed(\n () =>\n Object.fromEntries(\n filters.value.map((section) => [section, useId()]),\n ) as Record<Filter, string>,\n)\n\n// If security = [] or [{}] just hide it on readOnly mode\nconst isAuthHidden = computed(\n () =>\n layout === 'modal' &&\n !operation.security &&\n !Object.keys(securitySchemes ?? {}).length,\n)\n\nconst selectedFilter = ref<Filter>('All')\n\nwatch(\n () => operation,\n (newOperation) => {\n if (\n selectedFilter.value === 'Body' &&\n newOperation &&\n !canMethodHaveBody(newOperation.method)\n ) {\n selectedFilter.value = 'All'\n }\n },\n)\n\nconst updateRequestNameHandler = (event: Event) => {\n const target = event.target as HTMLInputElement\n requestMutators.edit(operation.uid, 'summary', target.value)\n}\n\n/**\n * Add the global cookies as static entries to the cookies section\n */\nconst activeWorkspaceCookies = computed(() =>\n (workspace.cookies ?? [])\n .map((uid) => cookies[uid])\n .filter(isDefined)\n .filter((cookie) => cookie.name)\n .filter((cookie) =>\n matchesDomain(server?.url || operation.path, cookie.domain),\n )\n .map((cookie) => ({\n key: cookie.name,\n value: cookie.value,\n route: {\n name: 'cookies',\n params: {\n cookies: cookie.uid,\n },\n },\n enabled: true,\n })),\n)\n\n// If the request has no summary, use the path or fallback\nconst handleRequestNamePlaceholder = () => {\n return operation.summary\n ? operation.summary\n : operation.path.replace(REGEX.PROTOCOL, '')\n ? operation.path.replace(REGEX.PROTOCOL, '')\n : 'Request Name'\n}\n\nconst labelRequestNameId = useId()\n\n// Plugins\nconst pluginManager = usePluginManager()\n\nconst requestSectionViews = pluginManager.getViewComponents('request.section')\n\nconst updateOperationHandler = (key: keyof Operation, value: string) =>\n requestMutators.edit(operation.uid, key, value)\n\n// Sets to all when auth filter is hidden but was previously selected to prevent empty section\nwatch(\n () => isAuthHidden.value,\n (authHidden) => {\n if (authHidden && selectedFilter.value === 'Auth') {\n selectedFilter.value = 'All'\n }\n },\n)\n</script>\n<template>\n <ViewLayoutSection :aria-label=\"`Request: ${operation.summary}`\">\n <template #title>\n <div\n class=\"group pointer-events-none flex flex-1 items-center gap-1 lg:pr-24\">\n <label\n v-if=\"layout !== 'modal'\"\n class=\"pointer-events-auto absolute top-0 left-0 h-full w-full cursor-text opacity-0\"\n :for=\"labelRequestNameId\" />\n <input\n v-if=\"layout !== 'modal'\"\n :id=\"labelRequestNameId\"\n class=\"text-c-1 group-hover-input pointer-events-auto relative z-10 -ml-0.5 h-8 w-full rounded pl-1.25 has-[:focus-visible]:outline md:-ml-1.25\"\n :placeholder=\"handleRequestNamePlaceholder()\"\n :value=\"operation.summary\"\n @input=\"updateRequestNameHandler\" />\n <span\n v-else\n class=\"text-c-1 flex h-8 items-center\">\n {{ operation.summary }}\n </span>\n </div>\n <SectionFilter\n v-model=\"selectedFilter\"\n :filterIds=\"filterIds\"\n :filters=\"filters\" />\n </template>\n <div\n :id=\"filterIds.All\"\n class=\"request-section-content custom-scroll relative flex flex-1 flex-col\"\n :role=\"selectedFilter === 'All' ? 'tabpanel' : 'none'\">\n <RequestAuth\n v-if=\"\n collection &&\n workspace &&\n (layout !== 'modal' || Object.keys(securitySchemes ?? {}).length)\n \"\n v-show=\"\n !isAuthHidden &&\n (selectedFilter === 'All' || selectedFilter === 'Auth')\n \"\n :id=\"filterIds.Auth\"\n class=\"request-section-content-auth\"\n :collection=\"collection\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :isReadOnly=\"layout === 'modal'\"\n layout=\"client\"\n :operation=\"operation\"\n :role=\"selectedFilter === 'All' ? 'none' : 'tabpanel'\"\n :selectedSecuritySchemeUids=\"selectedSecuritySchemeUids\"\n :server=\"server\"\n title=\"Authentication\"\n :workspace=\"workspace\" />\n <RequestPathParams\n v-show=\"\n (selectedFilter === 'All' || selectedFilter === 'Path Parameters') &&\n example.parameters.path.length\n \"\n :id=\"filterIds['Path Parameters']\"\n class=\"request-section-content-path-params\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :example=\"example\"\n :invalidParams=\"invalidParams\"\n :operation=\"operation\"\n paramKey=\"path\"\n :role=\"selectedFilter === 'All' ? 'none' : 'tabpanel'\"\n title=\"Path Parameters\"\n :workspace=\"workspace\" />\n <RequestParams\n v-show=\"selectedFilter === 'All' || selectedFilter === 'Cookies'\"\n :id=\"filterIds.Cookies\"\n class=\"request-section-content-cookies\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :example=\"example\"\n :invalidParams=\"invalidParams\"\n label=\"Cookie\"\n :operation=\"operation\"\n paramKey=\"cookies\"\n :readOnlyEntries=\"activeWorkspaceCookies\"\n :role=\"selectedFilter === 'All' ? 'none' : 'tabpanel'\"\n title=\"Cookies\"\n :workspace=\"workspace\" />\n <RequestParams\n v-show=\"selectedFilter === 'All' || selectedFilter === 'Headers'\"\n :id=\"filterIds.Headers\"\n class=\"request-section-content-headers\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :example=\"example\"\n :invalidParams=\"invalidParams\"\n label=\"Header\"\n :operation=\"operation\"\n paramKey=\"headers\"\n :role=\"selectedFilter === 'All' ? 'none' : 'tabpanel'\"\n title=\"Headers\"\n :workspace=\"workspace\" />\n <RequestParams\n v-show=\"selectedFilter === 'All' || selectedFilter === 'Query'\"\n :id=\"filterIds.Query\"\n class=\"request-section-content-query\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :example=\"example\"\n :invalidParams=\"invalidParams\"\n label=\"Parameter\"\n :operation=\"operation\"\n paramKey=\"query\"\n :role=\"selectedFilter === 'All' ? 'none' : 'tabpanel'\"\n title=\"Query Parameters\"\n :workspace=\"workspace\" />\n <RequestBody\n v-if=\"\n operation.method &&\n (selectedFilter === 'All' || selectedFilter === 'Body') &&\n canMethodHaveBody(operation.method)\n \"\n :id=\"filterIds.Body\"\n class=\"request-section-content-body\"\n :envVariables=\"envVariables\"\n :environment=\"environment\"\n :example=\"example\"\n :operation=\"operation\"\n :role=\"selectedFilter === 'All' ? 'none' : 'tabpanel'\"\n title=\"Body\"\n :workspace=\"workspace\" />\n\n <template\n v-for=\"(view, index) in requestSectionViews\"\n :key=\"view.title ?? index\">\n <ScalarErrorBoundary>\n <component\n :is=\"view.component\"\n v-show=\"selectedFilter === 'All' || selectedFilter === view.title\"\n :operation=\"operation\"\n @update:operation=\"updateOperationHandler\" />\n </ScalarErrorBoundary>\n </template>\n\n <!-- Spacer -->\n <div class=\"flex flex-grow\" />\n\n <!-- Code Snippet -->\n <ScalarErrorBoundary>\n <RequestCodeExample\n class=\"request-section-content-code-example -mt-1/2 border-t\"\n :collection=\"collection\"\n :environment=\"envVariables\"\n :example=\"example\"\n :operation=\"operation\"\n :server=\"server\"\n :workspace=\"workspace\" />\n </ScalarErrorBoundary>\n </div>\n </ViewLayoutSection>\n</template>\n<style scoped>\n.request-section-content {\n --scalar-border-width: 0.5px;\n}\n.request-section-content-filter {\n box-shadow: 0 -10px 0 10px var(--scalar-background-1);\n}\n.request-item:focus-within .request-meta-buttons {\n opacity: 1;\n}\n.group-hover-input {\n border-width: var(--scalar-border-width);\n border-color: transparent;\n}\n.group:hover .group-hover-input {\n background: color-mix(\n in srgb,\n var(--scalar-background-1),\n var(--scalar-background-2)\n );\n border-color: var(--scalar-border-color);\n}\n.group-hover-input:focus {\n background: transparent !important;\n border-color: var(--scalar-border-color) !important;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,IAAa,qBAAqB,SAChC,QAAQ,KAAK,eAAe,KAAK,QAAQ,KAAK,WAAW,KAAK,UAAU,KAAK,WAAW,KAAK,QAAQ;;;;;AAMvG,IAAa,sBAAsB,SAAkC;AACnE,QAAO,eAAe;AACpB,MAAI,KAAK,UAAU,KAAA,KAAa,KAAK,UAAU,GAC7C,QAAO;AAIT,MAAI,KAAK,MAAM;AACb,OAAI,KAAK,SAAS,WAAW;IAC3B,MAAM,QAAQ,OAAO,KAAK,MAAM;AAChC,QAAI,MAAM,MAAM,IAAI,CAAC,OAAO,UAAU,MAAM,CAC1C,QAAO;AAET,QAAI,KAAK,YAAY,KAAA,KAAa,QAAQ,KAAK,QAC7C,QAAO,iBAAiB,KAAK,QAAQ;AAEvC,QAAI,KAAK,YAAY,KAAA,KAAa,QAAQ,KAAK,QAC7C,QAAO,iBAAiB,KAAK,QAAQ;;AAIzC,OAAI,KAAK,SAAS,UAAU;IAC1B,MAAM,QAAQ,OAAO,KAAK,MAAM;AAChC,QAAI,MAAM,MAAM,CACd,QAAO;AAET,QAAI,KAAK,YAAY,KAAA,KAAa,QAAQ,KAAK,QAC7C,QA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