@scalar/blocks 0.11.2 → 0.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/dist/code-example/components/AsyncApiCodeExample.vue.js +111 -6
- package/dist/code-example/components/AsyncApiCodeExample.vue.js.map +1 -1
- package/dist/code-example/components/AsyncApiCodeExample3.vue.js +8 -0
- package/dist/code-example/components/AsyncApiCodeExample3.vue.js.map +1 -0
- package/dist/code-example/components/CodeExample.vue.d.ts +10 -0
- package/dist/code-example/components/CodeExample.vue.d.ts.map +1 -1
- package/dist/code-example/components/CodeExample.vue.js +297 -6
- package/dist/code-example/components/CodeExample.vue.js.map +1 -1
- package/dist/code-example/components/CodeExample3.vue.js +8 -0
- package/dist/code-example/components/CodeExample3.vue.js.map +1 -0
- package/dist/code-example/components/ExamplePicker.vue.d.ts +2 -0
- package/dist/code-example/components/ExamplePicker.vue.d.ts.map +1 -1
- package/dist/code-example/components/ExamplePicker.vue.js +50 -4
- package/dist/code-example/components/ExamplePicker.vue.js.map +1 -1
- package/dist/code-example/components/ExamplePicker2.vue.js +6 -0
- package/dist/code-example/components/ExamplePicker2.vue.js.map +1 -0
- package/dist/code-example/components/HttpMethod.vue.js +32 -4
- package/dist/code-example/components/HttpMethod.vue.js.map +1 -1
- package/dist/code-example/components/HttpMethod2.vue.js +6 -0
- package/dist/code-example/components/HttpMethod2.vue.js.map +1 -0
- package/dist/code-example/helpers/filter-clients-by-query.js.map +1 -1
- package/dist/code-example/helpers/find-client.js.map +1 -1
- package/dist/code-example/helpers/format-language.js.map +1 -1
- package/dist/code-example/helpers/generate-client-options.js.map +1 -1
- package/dist/code-example/helpers/generate-code-snippet.d.ts +8 -2
- package/dist/code-example/helpers/generate-code-snippet.d.ts.map +1 -1
- package/dist/code-example/helpers/generate-code-snippet.js +57 -27
- package/dist/code-example/helpers/generate-code-snippet.js.map +1 -1
- package/dist/code-example/helpers/get-asyncapi-example-context.js.map +1 -1
- package/dist/code-example/helpers/get-clients.js.map +1 -1
- package/dist/code-example/helpers/get-custom-code-samples.js.map +1 -1
- package/dist/code-example/helpers/get-generated-payload-example.js.map +1 -1
- package/dist/code-example/helpers/get-message-example-content.js.map +1 -1
- package/dist/code-example/helpers/get-secrets.js.map +1 -1
- package/dist/code-example/helpers/get-snippet.d.ts +2 -2
- package/dist/code-example/helpers/get-snippet.d.ts.map +1 -1
- package/dist/code-example/helpers/get-snippet.js +7 -9
- package/dist/code-example/helpers/get-snippet.js.map +1 -1
- package/dist/code-example/helpers/operation-to-har/operation-to-har.d.ts +1 -1
- package/dist/code-example/helpers/operation-to-har/operation-to-har.d.ts.map +1 -1
- package/dist/code-example/helpers/operation-to-har/operation-to-har.js +1 -1
- package/dist/code-example/helpers/operation-to-har/operation-to-har.js.map +1 -1
- package/dist/code-example/helpers/operation-to-har/process-body.d.ts +2 -2
- package/dist/code-example/helpers/operation-to-har/process-body.d.ts.map +1 -1
- package/dist/code-example/helpers/operation-to-har/process-body.js +102 -81
- package/dist/code-example/helpers/operation-to-har/process-body.js.map +1 -1
- package/dist/code-example/helpers/operation-to-har/process-parameters.d.ts.map +1 -1
- package/dist/code-example/helpers/operation-to-har/process-parameters.js +49 -47
- package/dist/code-example/helpers/operation-to-har/process-parameters.js.map +1 -1
- package/dist/code-example/helpers/operation-to-har/process-security-schemes.js +6 -6
- package/dist/code-example/helpers/operation-to-har/process-security-schemes.js.map +1 -1
- package/dist/code-example/helpers/operation-to-har/process-server-url.js.map +1 -1
- package/dist/code-example/index.d.ts +1 -1
- package/dist/code-example/index.d.ts.map +1 -1
- package/dist/code-example/index.js +14 -14
- package/dist/code-example/mount-asyncapi.js +1 -1
- package/dist/code-example/mount-asyncapi.js.map +1 -1
- package/dist/code-example/mount.js +1 -1
- package/dist/code-example/mount.js.map +1 -1
- package/dist/constants.js +1 -1
- package/dist/schema/LinkButton.vue.js.map +1 -1
- package/dist/schema/RenderString.vue.js +11 -4
- package/dist/schema/RenderString.vue.js.map +1 -1
- package/dist/schema/RenderString2.vue.js +6 -0
- package/dist/schema/RenderString2.vue.js.map +1 -0
- package/dist/schema/Schema.vue.d.ts.map +1 -1
- package/dist/schema/Schema.vue.js +235 -6
- package/dist/schema/Schema.vue.js.map +1 -1
- package/dist/schema/Schema3.vue.js +8 -0
- package/dist/schema/Schema3.vue.js.map +1 -0
- package/dist/schema/SchemaCollapsedPreview.vue.js +25 -4
- package/dist/schema/SchemaCollapsedPreview.vue.js.map +1 -1
- package/dist/schema/SchemaCollapsedPreview2.vue.js +6 -0
- package/dist/schema/SchemaCollapsedPreview2.vue.js.map +1 -0
- package/dist/schema/SchemaComposition.vue.js +232 -6
- package/dist/schema/SchemaComposition.vue.js.map +1 -1
- package/dist/schema/SchemaComposition3.vue.js +8 -0
- package/dist/schema/SchemaComposition3.vue.js.map +1 -0
- package/dist/schema/SchemaEnumPropertyItem.vue.d.ts +1 -0
- package/dist/schema/SchemaEnumPropertyItem.vue.d.ts.map +1 -1
- package/dist/schema/SchemaEnumPropertyItem.vue.js +23 -4
- package/dist/schema/SchemaEnumPropertyItem.vue.js.map +1 -1
- package/dist/schema/SchemaEnumPropertyItem2.vue.js +6 -0
- package/dist/schema/SchemaEnumPropertyItem2.vue.js.map +1 -0
- package/dist/schema/SchemaEnums.vue.d.ts.map +1 -1
- package/dist/schema/SchemaEnums.vue.js +74 -6
- package/dist/schema/SchemaEnums.vue.js.map +1 -1
- package/dist/schema/SchemaEnums3.vue.js +8 -0
- package/dist/schema/SchemaEnums3.vue.js.map +1 -0
- package/dist/schema/SchemaGlyphPuck.vue.js +27 -4
- package/dist/schema/SchemaGlyphPuck.vue.js.map +1 -1
- package/dist/schema/SchemaGlyphPuck2.vue.js +6 -0
- package/dist/schema/SchemaGlyphPuck2.vue.js.map +1 -0
- package/dist/schema/SchemaGutterToggle.vue.js +40 -4
- package/dist/schema/SchemaGutterToggle.vue.js.map +1 -1
- package/dist/schema/SchemaGutterToggle2.vue.js +6 -0
- package/dist/schema/SchemaGutterToggle2.vue.js.map +1 -0
- package/dist/schema/SchemaHeading.vue.js +32 -6
- package/dist/schema/SchemaHeading.vue.js.map +1 -1
- package/dist/schema/SchemaHeading3.vue.js +8 -0
- package/dist/schema/SchemaHeading3.vue.js.map +1 -0
- package/dist/schema/SchemaObjectExampleCodeBlock.vue.js +42 -4
- package/dist/schema/SchemaObjectExampleCodeBlock.vue.js.map +1 -1
- package/dist/schema/SchemaObjectExampleCodeBlock2.vue.js +6 -0
- package/dist/schema/SchemaObjectExampleCodeBlock2.vue.js.map +1 -0
- package/dist/schema/SchemaObjectProperties.vue.js +213 -4
- package/dist/schema/SchemaObjectProperties.vue.js.map +1 -1
- package/dist/schema/SchemaObjectProperties2.vue.js +6 -0
- package/dist/schema/SchemaObjectProperties2.vue.js.map +1 -0
- package/dist/schema/SchemaProperty.vue.d.ts +7 -2
- package/dist/schema/SchemaProperty.vue.d.ts.map +1 -1
- package/dist/schema/SchemaProperty.vue.js +494 -6
- package/dist/schema/SchemaProperty.vue.js.map +1 -1
- package/dist/schema/SchemaProperty3.vue.js +8 -0
- package/dist/schema/SchemaProperty3.vue.js.map +1 -0
- package/dist/schema/SchemaPropertyDefault.vue.js +61 -6
- package/dist/schema/SchemaPropertyDefault.vue.js.map +1 -1
- package/dist/schema/SchemaPropertyDefault3.vue.js +8 -0
- package/dist/schema/SchemaPropertyDefault3.vue.js.map +1 -0
- package/dist/schema/SchemaPropertyDetail.vue.js +22 -6
- package/dist/schema/SchemaPropertyDetail.vue.js.map +1 -1
- package/dist/schema/SchemaPropertyDetail3.vue.js +8 -0
- package/dist/schema/SchemaPropertyDetail3.vue.js.map +1 -0
- package/dist/schema/SchemaPropertyExamples.vue.js +133 -6
- package/dist/schema/SchemaPropertyExamples.vue.js.map +1 -1
- package/dist/schema/SchemaPropertyExamples3.vue.js +8 -0
- package/dist/schema/SchemaPropertyExamples3.vue.js.map +1 -0
- package/dist/schema/SchemaPropertyHeading.vue.d.ts +4 -1
- package/dist/schema/SchemaPropertyHeading.vue.d.ts.map +1 -1
- package/dist/schema/SchemaPropertyHeading.vue.js +313 -6
- package/dist/schema/SchemaPropertyHeading.vue.js.map +1 -1
- package/dist/schema/SchemaPropertyHeading3.vue.js +8 -0
- package/dist/schema/SchemaPropertyHeading3.vue.js.map +1 -0
- package/dist/schema/SchemaPropertyPattern.vue.js +42 -6
- package/dist/schema/SchemaPropertyPattern.vue.js.map +1 -1
- package/dist/schema/SchemaPropertyPattern3.vue.js +8 -0
- package/dist/schema/SchemaPropertyPattern3.vue.js.map +1 -0
- package/dist/schema/SchemaRailPanel.vue.js +53 -4
- package/dist/schema/SchemaRailPanel.vue.js.map +1 -1
- package/dist/schema/SchemaRailPanel2.vue.js +6 -0
- package/dist/schema/SchemaRailPanel2.vue.js.map +1 -0
- package/dist/schema/components/CopyLinkButton.vue.js +24 -4
- package/dist/schema/components/CopyLinkButton.vue.js.map +1 -1
- package/dist/schema/components/CopyLinkButton2.vue.js +6 -0
- package/dist/schema/components/CopyLinkButton2.vue.js.map +1 -0
- package/dist/schema/components/WithBreadcrumb.vue.js +15 -4
- package/dist/schema/components/WithBreadcrumb.vue.js.map +1 -1
- package/dist/schema/components/WithBreadcrumb2.vue.js +6 -0
- package/dist/schema/components/WithBreadcrumb2.vue.js.map +1 -0
- package/dist/schema/helpers/dynamic-scope.js.map +1 -1
- package/dist/schema/helpers/format-example.js.map +1 -1
- package/dist/schema/helpers/format-structured-value.d.ts +3 -0
- package/dist/schema/helpers/format-structured-value.d.ts.map +1 -0
- package/dist/schema/helpers/format-structured-value.js +6 -0
- package/dist/schema/helpers/format-structured-value.js.map +1 -0
- package/dist/schema/helpers/format-value.js.map +1 -1
- package/dist/schema/helpers/get-compositions-to-render.d.ts.map +1 -1
- package/dist/schema/helpers/get-compositions-to-render.js +34 -31
- package/dist/schema/helpers/get-compositions-to-render.js.map +1 -1
- package/dist/schema/helpers/get-discriminator-values.js.map +1 -1
- package/dist/schema/helpers/get-enum-values.js.map +1 -1
- package/dist/schema/helpers/get-property-description.js.map +1 -1
- package/dist/schema/helpers/get-ref-name.d.ts +14 -5
- package/dist/schema/helpers/get-ref-name.d.ts.map +1 -1
- package/dist/schema/helpers/get-ref-name.js +8 -11
- package/dist/schema/helpers/get-ref-name.js.map +1 -1
- package/dist/schema/helpers/get-rendered-example.js.map +1 -1
- package/dist/schema/helpers/get-schema-type.js.map +1 -1
- package/dist/schema/helpers/get-type-signature-tokens.d.ts.map +1 -1
- package/dist/schema/helpers/get-type-signature-tokens.js +37 -36
- package/dist/schema/helpers/get-type-signature-tokens.js.map +1 -1
- package/dist/schema/helpers/has-complex-array-items.js.map +1 -1
- package/dist/schema/helpers/index.d.ts +1 -1
- package/dist/schema/helpers/index.d.ts.map +1 -1
- package/dist/schema/helpers/index.js +3 -3
- package/dist/schema/helpers/is-empty-schema-object.js.map +1 -1
- package/dist/schema/helpers/is-model-linkable.js.map +1 -1
- package/dist/schema/helpers/is-on-schema-target-path.js.map +1 -1
- package/dist/schema/helpers/is-type-object.js.map +1 -1
- package/dist/schema/helpers/merge-all-of-schemas.js.map +1 -1
- package/dist/schema/helpers/normalize-object-composition.js.map +1 -1
- package/dist/schema/helpers/optimize-value-for-display.js.map +1 -1
- package/dist/schema/helpers/partition-all-of-compositions.js.map +1 -1
- package/dist/schema/helpers/schema-cycle.js.map +1 -1
- package/dist/schema/helpers/schema-expansion.js.map +1 -1
- package/dist/schema/helpers/schema-keyboard-nav.js.map +1 -1
- package/dist/schema/helpers/schema-name.d.ts +7 -3
- package/dist/schema/helpers/schema-name.d.ts.map +1 -1
- package/dist/schema/helpers/schema-name.js +36 -26
- package/dist/schema/helpers/schema-name.js.map +1 -1
- package/dist/schema/helpers/should-display-description.js.map +1 -1
- package/dist/schema/helpers/should-display-heading.js.map +1 -1
- package/dist/schema/helpers/should-render-array-item-composition.js.map +1 -1
- package/dist/schema/helpers/sort-property-names.js.map +1 -1
- package/dist/schema/helpers/unwrap-for-read.js.map +1 -1
- package/dist/schema/index.js +8 -8
- package/dist/schema/localization/index.js.map +1 -1
- package/dist/schema/localization/translations.js.map +1 -1
- package/dist/shared/Badge.vue.js +13 -6
- package/dist/shared/Badge.vue.js.map +1 -1
- package/dist/shared/Badge3.vue.js +8 -0
- package/dist/shared/Badge3.vue.js.map +1 -0
- package/dist/shared/ExternalDocs.vue.d.ts +2 -0
- package/dist/shared/ExternalDocs.vue.d.ts.map +1 -1
- package/dist/shared/ExternalDocs.vue.js +50 -4
- package/dist/shared/ExternalDocs.vue.js.map +1 -1
- package/dist/shared/ExternalDocs2.vue.js +6 -0
- package/dist/shared/ExternalDocs2.vue.js.map +1 -0
- package/dist/shared/ExternalExampleStatus.vue.js +24 -4
- package/dist/shared/ExternalExampleStatus.vue.js.map +1 -1
- package/dist/shared/ExternalExampleStatus2.vue.js +6 -0
- package/dist/shared/ExternalExampleStatus2.vue.js.map +1 -0
- package/dist/shared/ScreenReader.vue.js +16 -4
- package/dist/shared/ScreenReader.vue.js.map +1 -1
- package/dist/shared/ScreenReader2.vue.js +6 -0
- package/dist/shared/ScreenReader2.vue.js.map +1 -0
- package/dist/shared/external-example-localization/index.js.map +1 -1
- package/dist/shared/external-example-localization/translations.js.map +1 -1
- package/dist/shared/index.js +4 -4
- package/dist/specification-extensions/ExtensionValue.vue.js +89 -4
- package/dist/specification-extensions/ExtensionValue.vue.js.map +1 -1
- package/dist/specification-extensions/ExtensionValue2.vue.js +6 -0
- package/dist/specification-extensions/ExtensionValue2.vue.js.map +1 -0
- package/dist/specification-extensions/SpecificationExtensions.vue.js +76 -4
- package/dist/specification-extensions/SpecificationExtensions.vue.js.map +1 -1
- package/dist/specification-extensions/SpecificationExtensions2.vue.js +6 -0
- package/dist/specification-extensions/SpecificationExtensions2.vue.js.map +1 -0
- package/dist/specification-extensions/index.js +1 -1
- package/dist/style.css +23 -19
- package/dist/vue-styles.css +1 -1
- package/package.json +19 -19
- package/dist/code-example/components/AsyncApiCodeExample.vue_vue_type_script_setup_true_lang.js +0 -113
- package/dist/code-example/components/AsyncApiCodeExample.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/code-example/components/CodeExample.vue_vue_type_script_setup_true_lang.js +0 -269
- package/dist/code-example/components/CodeExample.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/code-example/components/ExamplePicker.vue_vue_type_script_setup_true_lang.js +0 -48
- package/dist/code-example/components/ExamplePicker.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/code-example/components/HttpMethod.vue_vue_type_script_setup_true_lang.js +0 -34
- package/dist/code-example/components/HttpMethod.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/RenderString.vue_vue_type_script_setup_true_lang.js +0 -13
- package/dist/schema/RenderString.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/Schema.vue_vue_type_script_setup_true_lang.js +0 -237
- package/dist/schema/Schema.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaCollapsedPreview.vue_vue_type_script_setup_true_lang.js +0 -27
- package/dist/schema/SchemaCollapsedPreview.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaComposition.vue_vue_type_script_setup_true_lang.js +0 -234
- package/dist/schema/SchemaComposition.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaEnumPropertyItem.vue_vue_type_script_setup_true_lang.js +0 -23
- package/dist/schema/SchemaEnumPropertyItem.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaEnums.vue_vue_type_script_setup_true_lang.js +0 -77
- package/dist/schema/SchemaEnums.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaGlyphPuck.vue_vue_type_script_setup_true_lang.js +0 -29
- package/dist/schema/SchemaGlyphPuck.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaGutterToggle.vue_vue_type_script_setup_true_lang.js +0 -42
- package/dist/schema/SchemaGutterToggle.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaHeading.vue_vue_type_script_setup_true_lang.js +0 -34
- package/dist/schema/SchemaHeading.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaObjectExampleCodeBlock.vue_vue_type_script_setup_true_lang.js +0 -44
- package/dist/schema/SchemaObjectExampleCodeBlock.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaObjectProperties.vue_vue_type_script_setup_true_lang.js +0 -215
- package/dist/schema/SchemaObjectProperties.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaProperty.vue_vue_type_script_setup_true_lang.js +0 -474
- package/dist/schema/SchemaProperty.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaPropertyDefault.vue_vue_type_script_setup_true_lang.js +0 -63
- package/dist/schema/SchemaPropertyDefault.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaPropertyDetail.vue_vue_type_script_setup_true_lang.js +0 -24
- package/dist/schema/SchemaPropertyDetail.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaPropertyExamples.vue_vue_type_script_setup_true_lang.js +0 -135
- package/dist/schema/SchemaPropertyExamples.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaPropertyHeading.vue_vue_type_script_setup_true_lang.js +0 -314
- package/dist/schema/SchemaPropertyHeading.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaPropertyPattern.vue_vue_type_script_setup_true_lang.js +0 -44
- package/dist/schema/SchemaPropertyPattern.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaRailPanel.vue_vue_type_script_setup_true_lang.js +0 -55
- package/dist/schema/SchemaRailPanel.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/components/CopyLinkButton.vue_vue_type_script_setup_true_lang.js +0 -26
- package/dist/schema/components/CopyLinkButton.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/components/WithBreadcrumb.vue_vue_type_script_setup_true_lang.js +0 -17
- package/dist/schema/components/WithBreadcrumb.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/shared/Badge.vue_vue_type_script_setup_true_lang.js +0 -15
- package/dist/shared/Badge.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/shared/ExternalDocs.vue_vue_type_script_setup_true_lang.js +0 -45
- package/dist/shared/ExternalDocs.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/shared/ExternalExampleStatus.vue_vue_type_script_setup_true_lang.js +0 -26
- package/dist/shared/ExternalExampleStatus.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/shared/ScreenReader.vue_vue_type_script_setup_true_lang.js +0 -18
- package/dist/shared/ScreenReader.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/specification-extensions/ExtensionValue.vue_vue_type_script_setup_true_lang.js +0 -91
- package/dist/specification-extensions/ExtensionValue.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/specification-extensions/SpecificationExtensions.vue_vue_type_script_setup_true_lang.js +0 -78
- package/dist/specification-extensions/SpecificationExtensions.vue_vue_type_script_setup_true_lang.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeExample.vue.js","names":["CodeExample_vue_vue_type_script_setup_true_lang_default","_plugin_vue_export_helper_default","CodeExample_default"],"sources":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"CodeExample.vue.js","names":["$slots","_unref","_openBlock","_createBlock","_withCtx","_createVNode","_createSlots","_createElementVNode","HttpMethod","_createElementBlock","_renderSlot","_createTextVNode","_toDisplayString","_normalizeClass","ExternalExampleStatus","_Fragment","ExamplePicker","ExternalExampleStatus_default","filterClientsByQuery","findClient","generateCodeSnippetWithPreview","getClients","getCustomCodeSamples","getSecrets","operationToHar","ExamplePicker_default","HttpMethod_default","Fragment","computed","createBlock","createCommentVNode","createElementBlock","createElementVNode","createSlots","createTextVNode","createVNode","defineComponent","normalizeClass","openBlock","ref","renderSlot","toDisplayString","unref","useId","watch","watchEffect","withCtx","ScalarCard","ScalarCardFooter","ScalarCardHeader","ScalarCardSection","ScalarCodeBlock","ScalarCodeBlockCopy","resolveCredentialPlaceholders","ScalarButton","ScalarIconCaretDown","getResolvedRef","ScalarCombobox","ScalarVirtualText","freezeElement","getFirstMediaType","getOperationExamples","resolveOperationExamples","useExampleVisibility","useExternalExamples","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","CodeExample_vue_vue_type_script_setup_true_lang_default","__props","__emit","emit","requestExampleOptions","content","contentType","bodyExamples","examples","pickerKeys","reference","parameter","media","key","example","response","localExampleKey","requestPickerExamples","resolveExampleKey","preferred","fallback","defaultKey","selection","selectExample","customCodeSamples","clients","clientCount","total","group","localSelectedClient","newClient","clientPickerAriaLabel","codeSampleAriaLabel","elem","visible","externalExamples","resolvedOperation","showExamplePicker","webhookHar","error","generatedSnippet","generatedTemplate","resolvedCredentials","scheme","generatedCode","displayCode","copyCode","codeBlockLanguage","webhookLanguage","secretCredentials","selectClient","option","unfreeze","shouldVirtualize","id","_ctx","_cache","$event","open"],"sources":["../../../src/code-example/components/CodeExample.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { MultipartNaming } from '@scalar/types/api-reference'\n\nexport type CodeExampleProps = {\n /** Localized status text shown when the selected example has no linked code sample. */\n codeSampleUnavailable?: string\n /**\n * Localized purpose of the client picker. It opens the button's accessible name and the\n * selected client's title is appended, so the name still contains the visible label.\n */\n clientPickerLabel?: string\n /** Localized accessible name for the search field inside the client picker. */\n clientSearchLabel?: string\n /** Localized accessible purpose of the request example picker. */\n examplePickerLabel?: string\n /**\n * Localized accessible name for the focusable code sample. The selected client's title is\n * appended so the announcement also says which language the sample is in.\n */\n codeSampleLabel?: string\n /**\n * Integration type: determines if the code sample is displayed in a client environment\n * or in an API reference environment.\n */\n integration?: 'client' | 'reference'\n /**\n * List of all http clients formatted into option groups for the client selector\n */\n clientOptions: ClientOptionGroup[]\n /**\n * Pre-selected client, this will determine which client is initially selected in the dropdown.\n * Either a built-in client id (e.g. `js/fetch`) or a custom sample id (e.g. `custom/python`).\n *\n * Typed as a plain string: unioning the (large) client-id union with the `custom/...`\n * ids overflows TypeScript's union-complexity limit inside this component's `defineProps`.\n *\n * @defaults to a custom sample if one is available, otherwise shell/curl\n */\n selectedClient?: string\n /**\n * Which server from the spec to use for the code example\n */\n selectedServer?: ServerObject | null\n /**\n * The selected content type from the requestBody.content, this will determine which examples are available\n * as well as the content type of the code example\n *\n * @defaults to the first content type if not provided\n */\n selectedContentType?: string\n /**\n * Example name to use for resolving example values for parameters AND requestBody.\n *\n * This is the document-wide selection: it is honored only when this operation defines an example\n * with the same key, so picking an example on one operation syncs the rest without blanking out\n * operations that do not share that key.\n *\n * @example \"limited\"\n * ```ts\n * parameters: {\n * name: 'foobar',\n * in: 'query',\n * examples: {\n * limited: {\n * dataValue: 10,\n * }\n * }\n * },\n * body: {\n * content: {\n * 'application/json': {\n * examples: {\n * limited: {\n * dataValue: { foo: 'bar' },\n * }\n * }\n * }\n * }\n * }\n *\n * ```\n */\n selectedExample?: string\n /** Initial response example to use when the document-wide selection has no matching request. */\n defaultResponseExample?: string\n /** Named example selected by the response card for this operation. */\n responseExampleSelection?: { key: string }\n /**\n * Event bus\n */\n eventBus: WorkspaceEventBus\n /**\n * The security schemes which are applicable to this operation\n */\n securitySchemes: SecuritySchemeObjectSecret[]\n /**\n * HTTP method of the operation\n */\n method: string\n /**\n * Path of the operation\n */\n path: string\n /**\n * De-referenced OpenAPI Operation object\n */\n operation: OperationObject\n /**\n * If true and there's no example, we will display a small card with the method and path only\n */\n fallback?: boolean\n /**\n * A method to generate the label of the block, should return an html string\n */\n generateLabel?: () => string\n /**\n * If true, render this as a webhook request example\n */\n isWebhook?: boolean\n /**\n * Workspace + document cookies\n */\n globalCookies?: XScalarCookie[]\n /**\n * When the request body schema uses oneOf/anyOf, use these selected variants\n * for the example snippet (e.g. from the schema dropdowns in the API reference).\n */\n /** Originating OpenAPI version, used for XML mapping rules. */\n openapiVersion?: string\n /** Document-level JSON Schema dialect used when generating array `contains` examples. */\n jsonSchemaDialect?: string\n multipartNaming?: MultipartNaming\n requestBodyCompositionSelection?: Record<string, number>\n}\n\n/**\n * Request Example\n *\n * The core component for rendering a request example block,\n * this component does not have much of its own state but operates on props and custom events\n *\n * @event workspace:update:selected-client - Emitted when the selected client changes\n * @event workspace:update:selected-example - Emitted when the selected example changes, so other operations can sync\n */\nexport default {}\n</script>\n\n<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport {\n ScalarCard,\n ScalarCardFooter,\n ScalarCardHeader,\n ScalarCardSection,\n} from '@scalar/components/card'\nimport {\n ScalarCodeBlock,\n ScalarCodeBlockCopy,\n} from '@scalar/components/code-block'\nimport { ScalarCombobox } from '@scalar/components/combobox'\nimport { ScalarVirtualText } from '@scalar/components/virtual-text'\nimport { freezeElement } from '@scalar/helpers/dom/freeze-element'\nimport { getFirstMediaType } from '@scalar/helpers/http/get-first-media-type'\nimport { ScalarIconCaretDown } from '@scalar/icons'\nimport { type WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport {\n getOperationExamples,\n resolveOperationExamples,\n} from '@scalar/workspace-store/helpers/operation-examples'\nimport {\n useExampleVisibility,\n useExternalExamples,\n} from '@scalar/workspace-store/helpers/use-external-examples'\nimport {\n resolveCredentialPlaceholders,\n type SecuritySchemeObjectSecret,\n} from '@scalar/workspace-store/request-example'\nimport type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies'\nimport type {\n OperationObject,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport {\n computed,\n ref,\n useId,\n watch,\n watchEffect,\n type ComponentPublicInstance,\n} from 'vue'\n\nimport ExternalExampleStatus from '../../shared/ExternalExampleStatus.vue'\nimport { filterClientsByQuery } from '../helpers/filter-clients-by-query'\nimport { findClient } from '../helpers/find-client'\nimport { generateCodeSnippetWithPreview } from '../helpers/generate-code-snippet'\nimport { getClients } from '../helpers/get-clients'\nimport { getCustomCodeSamples } from '../helpers/get-custom-code-samples'\nimport { getSecrets } from '../helpers/get-secrets'\nimport { operationToHar } from '../helpers/operation-to-har/operation-to-har'\nimport type {\n ClientOption,\n ClientOptionGroup,\n CustomClientOption,\n} from '../types'\nimport ExamplePicker from './ExamplePicker.vue'\nimport HttpMethod from './HttpMethod.vue'\n\nconst {\n integration,\n codeSampleUnavailable = 'No code sample available for this example.',\n clientPickerLabel = 'Change code sample language',\n clientSearchLabel = 'Search clients',\n examplePickerLabel = 'Request example',\n codeSampleLabel = 'Code sample',\n clientOptions,\n selectedClient,\n selectedServer = null,\n selectedContentType,\n selectedExample,\n defaultResponseExample,\n responseExampleSelection,\n securitySchemes = [],\n method,\n eventBus,\n path,\n operation,\n isWebhook,\n generateLabel,\n globalCookies,\n openapiVersion,\n jsonSchemaDialect,\n multipartNaming,\n requestBodyCompositionSelection,\n} = defineProps<CodeExampleProps>()\n\nconst emit = defineEmits<{\n /**\n * Emitted whenever the example key actually shown for this operation changes.\n *\n * This is the resolved local key (not the raw document-wide selection), so layouts that render\n * the test-request button outside this component can open the client with the same example the\n * snippet displays.\n */\n (e: 'update:exampleKey', value: string): void\n /** Emitted when the user explicitly picks a request example. */\n (e: 'selectExample', value: string): void\n}>()\n\ndefineSlots<{\n 'header': () => unknown\n /** Rendered at the start of the footer, only while the example picker does not need that space */\n 'footer-start'?: () => unknown\n 'footer': ({ exampleName }: { exampleName: string }) => unknown\n}>()\n\n/** Prefer body labels for keys shared by the body and parameters. */\nconst requestExampleOptions = computed(() => {\n const content = getResolvedRef(operation.requestBody)?.content ?? {}\n const contentType = selectedContentType || Object.keys(content)[0]\n const bodyExamples = Object.entries(\n content[contentType ?? '']?.examples ?? {},\n )\n const examples = new Map(bodyExamples)\n const pickerKeys = new Set(examples.keys())\n for (const reference of operation.parameters ?? []) {\n const parameter = getResolvedRef(reference)\n if (!parameter) continue\n\n const media =\n 'content' in parameter\n ? getFirstMediaType(parameter.content)?.[1]\n : undefined\n for (const [key, example] of Object.entries({\n ...media?.examples,\n ...parameter.examples,\n })) {\n if (examples.has(key)) {\n pickerKeys.add(key)\n } else {\n examples.set(key, example)\n }\n }\n }\n // A parameter example represents a request scenario when another request part\n // or a response shares its key. Independent examples still supply parameter defaults.\n for (const reference of Object.values(operation.responses ?? {})) {\n const response = getResolvedRef(reference)\n for (const media of Object.values(response?.content ?? {})) {\n for (const key of Object.keys(media.examples ?? {})) {\n if (examples.has(key)) pickerKeys.add(key)\n }\n }\n }\n // An unnamed parameter-only sample uses each parameter's existing default.\n return { examples, pickerKeys, defaultKey: bodyExamples[0]?.[0] ?? '' }\n})\n\n/**\n * The example key actually shown for this operation.\n *\n * `selectedExample` is the document-wide selection that syncs across operations. We honor it only\n * when this operation actually defines that key, otherwise we keep the local example: a selection\n * on one operation should never blank out an operation that does not share the same example.\n */\nconst localExampleKey = ref('')\nconst requestPickerExamples = computed(() => {\n const { examples, pickerKeys } = requestExampleOptions.value\n return Object.fromEntries(\n Array.from(examples).filter(\n ([key]) => pickerKeys.has(key) || key === localExampleKey.value,\n ),\n )\n})\n\n/** Resolve the key to display, preferring the document-wide selection when this operation has it */\nconst resolveExampleKey = (\n preferred: string | undefined,\n fallback?: string,\n): string => {\n const { examples, defaultKey } = requestExampleOptions.value\n if (preferred && examples.has(preferred)) {\n return preferred\n }\n if (fallback && examples.has(fallback)) {\n return fallback\n }\n // Keep the current local example when it is still valid, otherwise fall back to the first one\n if (localExampleKey.value && examples.has(localExampleKey.value)) {\n return localExampleKey.value\n }\n return defaultKey\n}\n\n// Set the initial example from the document-wide selection, falling back to the first example.\n// This runs during setup so the server renders the same example as the browser.\nlocalExampleKey.value = resolveExampleKey(\n responseExampleSelection?.key ?? selectedExample,\n defaultResponseExample,\n)\n\n// Follow the document-wide selection when it changes and this operation has that example\nwatch(\n () => selectedExample,\n (preferred) => {\n localExampleKey.value = resolveExampleKey(preferred)\n },\n)\n\n// Status and media-type changes select a request example only on this operation.\nwatch(\n () => responseExampleSelection,\n (selection) => {\n if (selection) localExampleKey.value = resolveExampleKey(selection.key)\n },\n)\n\nwatch(requestExampleOptions, ({ examples }) => {\n if (!examples.has(localExampleKey.value)) {\n localExampleKey.value = resolveExampleKey(\n responseExampleSelection?.key ?? selectedExample,\n defaultResponseExample,\n )\n }\n})\n\n// Keep the parent informed of the resolved key so a test-request button rendered outside this\n// component (e.g. the classic layout header) opens the client with the example the snippet shows\nwatchEffect(() => {\n emit('update:exampleKey', localExampleKey.value)\n})\n\n/** Select an example locally and sync the choice across the document */\nconst selectExample = (key: string) => {\n localExampleKey.value = key\n emit('selectExample', key)\n eventBus.emit('workspace:update:selected-example', key)\n}\n\n/** Grab any custom code samples from the operation */\nconst customCodeSamples = computed(() => getCustomCodeSamples(operation))\n\n/** Merge custom code samples with the client options */\nconst clients = computed(() =>\n getClients(\n customCodeSamples.value.samples,\n clientOptions,\n customCodeSamples.value.label,\n ),\n)\n\n/** Total number of available clients across all option groups */\nconst clientCount = computed(() =>\n clients.value.reduce((total, group) => total + group.options.length, 0),\n)\n\n/** The locally selected client which would include code samples from this operation only */\nconst localSelectedClient = ref<ClientOption | CustomClientOption | undefined>(\n findClient(clients.value, selectedClient),\n)\n\n/**\n * Re-resolve the local client whenever the global selection or the available\n * clients change. Watching `clients` matters when navigating between operations:\n * the stored id stays the same, but the matching option (e.g. a custom sample)\n * differs per operation, so without this the snippet could go stale.\n */\nwatch([() => selectedClient, clients], ([newClient]) => {\n localSelectedClient.value = findClient(clients.value, newClient)\n})\n\n/**\n * Accessible name for the client picker.\n *\n * On its own the button reads as its current value (\"C Libcurl\"), which never\n * says what activating it does. The visible title stays part of the name so it\n * still matches what is on screen.\n */\nconst clientPickerAriaLabel = computed(() =>\n [clientPickerLabel, localSelectedClient.value?.title]\n .filter(Boolean)\n .join(': '),\n)\n\n/**\n * Accessible name for the focusable code sample, e.g. \"Code sample: Shell cURL\".\n *\n * Screen readers announce only the name and role when focus lands on the scroller, so the\n * name tells the user both what the region is and which client it is generated for.\n */\nconst codeSampleAriaLabel = computed(() =>\n [codeSampleLabel, localSelectedClient.value?.title]\n .filter(Boolean)\n .join(': '),\n)\n\nconst elem = ref<ComponentPublicInstance | null>(null)\nconst visible = useExampleVisibility(elem)\nconst externalExamples = useExternalExamples(\n () =>\n getOperationExamples(operation, localExampleKey.value, selectedContentType),\n () => visible.value,\n)\nconst resolvedOperation = computed(() =>\n resolveOperationExamples(\n operation,\n localExampleKey.value,\n selectedContentType,\n externalExamples.resolve,\n ),\n)\n\n/** Keep the picker available because it also selects the example opened by Test Request. */\nconst showExamplePicker = computed(\n () => requestExampleOptions.value.pickerKeys.size > 1,\n)\n\n/** Generate HAR data for webhook requests */\nconst webhookHar = computed(() => {\n if (!isWebhook) return null\n\n try {\n return operationToHar({\n operation: resolvedOperation.value,\n method,\n path,\n example: localExampleKey.value,\n openapiVersion,\n jsonSchemaDialect,\n multipartNaming,\n requestBodyCompositionSelection,\n // Only required parameters are shown in code examples; optional parameters\n // are omitted unless explicitly enabled via `x-disabled: false`.\n defaultDisabledParameters: true,\n })\n } catch (error) {\n console.error('[webhookHar]', error)\n return null\n }\n})\n\n/** Generate the code snippet for the selected example */\nconst generatedSnippet = computed(() => {\n if (isWebhook) {\n return { content: webhookHar.value?.postData?.text ?? '' }\n }\n\n return generateCodeSnippetWithPreview({\n // Only required parameters are shown in code examples; optional parameters\n // are omitted unless explicitly enabled via `x-disabled: false`.\n defaultDisabledParameters: true,\n includeDefaultHeaders: integration === 'client',\n clientId: localSelectedClient.value?.id,\n customCodeSamples: customCodeSamples.value.samples,\n operation: resolvedOperation.value,\n method,\n path,\n contentType: selectedContentType,\n server: selectedServer,\n securitySchemes,\n example: localExampleKey.value,\n globalCookies,\n openapiVersion,\n jsonSchemaDialect,\n multipartNaming,\n requestBodyCompositionSelection,\n })\n})\nconst generatedTemplate = computed(() => generatedSnippet.value.content)\n\n/** Resolve custom templates at render time so auth changes never mutate the document. */\nconst resolvedCredentials = computed(() =>\n !isWebhook &&\n localSelectedClient.value?.id.startsWith('custom/') &&\n generatedTemplate.value !== null &&\n securitySchemes.some((scheme) => 'x-scalar-credential-placeholders' in scheme)\n ? resolveCredentialPlaceholders(generatedTemplate.value, securitySchemes)\n : undefined,\n)\n\nconst generatedCode = computed(\n () => resolvedCredentials.value?.content ?? generatedTemplate.value,\n)\n\n/** Mask inserted secrets before escaping or syntax tokenization can split their values. */\nconst displayCode = computed(\n () =>\n resolvedCredentials.value?.displayContent ??\n generatedSnippet.value.displayContent ??\n generatedCode.value,\n)\nconst copyCode = computed(() =>\n resolvedCredentials.value ||\n generatedSnippet.value.displayContent !== undefined\n ? (generatedCode.value ?? '')\n : undefined,\n)\n\n/** The language for the code block, used for syntax highlighting */\nconst codeBlockLanguage = computed(() => {\n if (isWebhook) {\n return webhookLanguage.value\n }\n\n return localSelectedClient.value?.lang\n})\n\n/** Determine the language for webhook content based on MIME type */\nconst webhookLanguage = computed<string>(() => {\n if (!webhookHar.value?.postData) return 'json'\n\n const contentType = webhookHar.value.postData.mimeType\n if (contentType?.includes('json')) return 'json'\n if (contentType?.includes('xml')) return 'xml'\n if (contentType?.includes('yaml') || contentType?.includes('yml'))\n return 'yaml'\n if (contentType?.includes('text/plain')) return 'text'\n\n return 'json'\n})\n\n/** Block secrets from being shown in the code block */\nconst secretCredentials = computed(() =>\n resolvedCredentials.value ? [] : getSecrets(securitySchemes),\n)\n\n/** Set custom example, or update the selected HTTP client globally */\nconst selectClient = (option: ClientOption) => {\n // We need to freeze the ui to prevent scrolling as the clients change\n if (elem.value) {\n const unfreeze = freezeElement(elem.value.$el)\n setTimeout(() => {\n unfreeze()\n }, 300)\n }\n // Update to the local example\n localSelectedClient.value = option\n\n // Sync the selection globally so other operations follow along. Custom samples\n // sync too (keyed by language), so picking e.g. the Python SDK example here\n // shows the Python example on every operation that ships one.\n if (option) {\n eventBus.emit('workspace:update:selected-client', option.id)\n }\n}\n\n// Virtualize the code block if it's too large\n// This prevents the entire app from freezing up if there's a massive example\n// We set a lower threshold here as code examples can get quite large\nconst VIRTUALIZATION_THRESHOLD = 20_000\n\nconst shouldVirtualize = computed(\n () => (generatedCode.value?.length ?? 0) > VIRTUALIZATION_THRESHOLD,\n)\n\nconst id = useId()\n</script>\n<template>\n <ScalarCard\n v-if=\"\n generatedCode === null || generatedCode || externalExamples.pending.value\n \"\n ref=\"elem\"\n class=\"request-card dark-mode\">\n <!-- Header -->\n <ScalarCardHeader class=\"pr-2.5\">\n <span class=\"sr-only\">Request Example for</span>\n <HttpMethod\n as=\"span\"\n class=\"request-method\"\n :method=\"method\" />\n <span\n v-if=\"generateLabel\"\n v-html=\"generateLabel()\" />\n <slot name=\"header\" />\n <!-- Client picker -->\n <template\n v-if=\"!isWebhook && clientCount\"\n #actions>\n <!-- Multiple clients: render a dropdown to switch between them -->\n <ScalarCombobox\n v-if=\"clientCount > 1\"\n v-slot=\"{ open }\"\n class=\"max-h-80\"\n :filterFn=\"filterClientsByQuery\"\n :inputLabel=\"clientSearchLabel\"\n :modelValue=\"localSelectedClient\"\n :options=\"clients\"\n placement=\"bottom-end\"\n teleport\n @update:modelValue=\"selectClient($event as ClientOption)\">\n <ScalarButton\n :aria-label=\"clientPickerAriaLabel\"\n class=\"text-c-2 hover:text-c-1 flex h-full w-fit gap-1.5 px-0.5 py-0 text-base font-normal\"\n data-testid=\"client-picker\"\n variant=\"ghost\">\n {{ localSelectedClient?.title }}\n <!--\n Follow this picker's own state. The `ui-open:` variant also matches any open\n Headless UI ancestor, such as an expanded operation in the classic layout.\n -->\n <ScalarIconCaretDown\n class=\"mt-px size-3 transition-transform duration-100\"\n :class=\"{ 'rotate-180': open }\"\n weight=\"bold\" />\n </ScalarButton>\n </ScalarCombobox>\n <!-- Single client: just show its label, no need for a dropdown -->\n <span\n v-else\n class=\"text-c-2 flex h-full w-fit items-center px-0.5 py-0 text-base font-normal\"\n data-testid=\"client-picker\">\n {{ localSelectedClient?.title }}\n </span>\n </template>\n </ScalarCardHeader>\n\n <!-- Code snippet -->\n <ScalarCardSection class=\"request-editor-section custom-scroll p-0\">\n <ExternalExampleStatus\n v-if=\"externalExamples.pending.value\"\n :failed=\"externalExamples.failed.value\"\n @retry=\"externalExamples.retry\" />\n <div\n v-else-if=\"generatedCode === null\"\n class=\"text-c-2 p-4\"\n role=\"status\">\n {{ codeSampleUnavailable }}\n </div>\n <div\n v-else\n :id=\"`${id}-example`\"\n class=\"code-snippet group/code-block relative\">\n <ScalarCodeBlock\n v-if=\"!shouldVirtualize\"\n class=\"h-full bg-transparent\"\n :content=\"displayCode ?? ''\"\n :copyContent=\"copyCode\"\n :hideCredentials=\"secretCredentials\"\n :label=\"codeSampleAriaLabel\"\n :lang=\"codeBlockLanguage\"\n lineNumbers />\n <template v-else>\n <ScalarCodeBlockCopy\n :aria-controls=\"`${id}-virtual-code`\"\n class=\"scalar-code-copy absolute top-2.5 right-2.5 z-1\"\n :content=\"generatedCode\"\n :lang=\"codeBlockLanguage\" />\n <ScalarVirtualText\n :id=\"`${id}-virtual-code`\"\n aria-label=\"Request code sample\"\n containerClass=\"custom-scroll scalar-code-block flex flex-1 max-h-screen\"\n contentClass=\"language-plaintext whitespace-pre font-code text-base p-2\"\n :lineHeight=\"20\"\n role=\"region\"\n :text=\"displayCode ?? ''\" />\n </template>\n </div>\n </ScalarCardSection>\n\n <!-- Footer -->\n <ScalarCardFooter\n v-if=\"showExamplePicker || $slots.footer || $slots['footer-start']\"\n class=\"request-card-footer\"\n :class=\"{\n 'request-card-footer--wraps':\n showExamplePicker || $slots['footer-start'],\n }\">\n <!-- Example picker -->\n <div\n v-if=\"showExamplePicker\"\n class=\"request-card-footer-addon\">\n <ExamplePicker\n :examples=\"requestPickerExamples\"\n :label=\"examplePickerLabel\"\n :modelValue=\"localExampleKey\"\n @update:modelValue=\"selectExample\" />\n </div>\n <!-- Otherwise the start of the footer is free for the caller -->\n <div\n v-else-if=\"$slots['footer-start']\"\n class=\"request-card-footer-start\">\n <slot name=\"footer-start\" />\n </div>\n\n <!-- Footer -->\n <slot\n :exampleName=\"localExampleKey\"\n name=\"footer\" />\n </ScalarCardFooter>\n </ScalarCard>\n\n <!-- Fallback card with just method and path in the case of no examples -->\n <ScalarCard\n v-else-if=\"fallback\"\n class=\"request-card dark-mode\">\n <!-- A single row of method, path and actions reads as a header, so it stays on the card -->\n <ScalarCardSection class=\"request-card-simple bg-transparent shadow-none\">\n <div class=\"request-header\">\n <HttpMethod\n as=\"span\"\n class=\"request-method\"\n :method=\"method\" />\n <slot name=\"header\" />\n </div>\n <div\n v-if=\"$slots.footer\"\n class=\"request-card-actions relative max-w-full\">\n <slot\n :exampleName=\"localExampleKey\"\n name=\"footer\" />\n </div>\n </ScalarCardSection>\n </ScalarCard>\n</template>\n<style scoped>\n.request-card {\n color: var(--scalar-color-1);\n font-size: var(--scalar-font-size-3);\n}\n.request-method {\n font-family: var(--scalar-font-code);\n margin-right: 6px;\n}\n.request-card-footer {\n display: flex;\n justify-content: flex-end;\n padding: 6px;\n flex-shrink: 0;\n position: relative;\n}\n/*\n * The example picker or footer-start content keeps room for itself; when the footer is too narrow\n * for everything, the end controls wrap onto a second line instead of squeezing or covering it.\n */\n.request-card-footer--wraps {\n flex-wrap: wrap;\n row-gap: 4px;\n}\n.request-card-footer-start {\n display: flex;\n align-items: center;\n flex: 1 0 auto;\n}\n/*\n * The picker asks for its example name's width, capped at 7em (about eight characters), so on a\n * narrow card the end controls wrap rather than squeeze the name out of view. The cap keeps a long\n * name truncating beside them on wider cards, as before. The picker never grows past its name, and\n * the end margin holds it at the start of the line.\n */\n.request-card-footer-addon {\n display: flex;\n align-items: center;\n\n flex: 1 1 7em;\n min-width: 0;\n max-width: max-content;\n margin-inline-end: auto;\n}\n.request-editor-section {\n display: flex;\n flex: 1;\n}\n/*\n * A long sample is drawn as virtual text with its own copy button rather than a code block, so\n * that button gets the same raised fill a code block gives its button on a card's surface.\n */\n.code-snippet > .scalar-code-copy {\n background: var(--scalar-card-surface-raised, var(--scalar-background-2));\n}\n.request-card-simple {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n\n padding: 8px 8px 8px 12px;\n\n font-size: var(--scalar-small);\n}\n.request-header {\n /* Give spare inline space to the path, while actions fill their own row after wrapping. */\n flex: 999 1 auto;\n min-width: 0;\n overflow-wrap: anywhere;\n}\n.request-card-actions {\n flex: 1 0 auto;\n}\n.code-snippet {\n display: flex;\n flex-direction: column;\n width: 100%;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4OA,IAAM4E,IAAOD,GAqBPE,IAAwBjD,QAAe;GAC3C,IAAMkD,IAAUtB,EAAekB,EAAA,UAAU,WAAW,CAAC,EAAE,WAAW,CAAC,GAC7DK,IAAcL,EAAA,uBAAuB,OAAO,KAAKI,CAAO,CAAC,CAAC,IAC1DE,IAAe,OAAO,QAC1BF,EAAQC,KAAe,GAAG,EAAE,YAAY,CAAC,CAC3C,GACME,IAAW,IAAI,IAAID,CAAY,GAC/BE,IAAa,IAAI,IAAID,EAAS,KAAK,CAAC;GAC1C,KAAK,IAAME,KAAaT,EAAA,UAAU,cAAc,CAAC,GAAG;IAClD,IAAMU,IAAY5B,EAAe2B,CAAS;IAC1C,IAAI,CAACC,GAAW;IAEhB,IAAMC,IACJ,aAAaD,IACTxB,GAAkBwB,EAAU,OAAO,CAAC,GAAG,KACvC,KAAA;IACN,KAAK,IAAM,CAACE,GAAKC,MAAY,OAAO,QAAQ;KAC1C,GAAGF,GAAO;KACV,GAAGD,EAAU;IACf,CAAC,GACKH,EAAS,IAAIK,CAAG,IAClBJ,EAAW,IAAII,CAAG,IAElBL,EAAS,IAAIK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EAAA,C,iBAI9BtH,EAEkBsH,EAAA,QAAA,UAAA,EADf,aAAavC,EAAA,MAAe,GAAA,KAAA,GAAA,EAAA,C;;;;;E,WAOtBf,EAAA,YADbxE,EAAA,GAAAC,EAoBaF,EAAA8C,CAAA,GAAA;;GAlBX,OAAM;;GAEN,SAAA3C,QAeoB,CAfpBC,EAeoBJ,EAAAiD,CAAA,GAAA,EAfD,OAAM,iDAAgD,GAAA;IACvE,SAAA9C,QAMM,CANNG,EAMM,OANNgE,GAMM,CALJlE,EAGqBG,GAAA;KAFnB,IAAG;KACH,OAAM;KACL,QAAQkE,EAAA;I,yBACXhE,EAAsBsH,EAAA,QAAA,UAAA,CAAA,GAAA,KAAA,GAAA,EAAA,C,IAGhBhI,EAAAA,OAAO,UADfE,EAAA,GAAAO,EAMM,OANN+D,IAMM,CAHJ9D,EAEkBsH,EAAA,QAAA,UAAA,EADf,aAAavC,EAAA,MAAe,GAAA,KAAA,GAAA,EAAA,C"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import e from "./CodeExample.vue.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
// src/code-example/components/CodeExample.vue
|
|
5
|
+
var n = /*#__PURE__*/ t(e, [["__scopeId", "data-v-e335011e"]]);
|
|
6
|
+
export { n as default };
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=CodeExample3.vue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodeExample3.vue.js","names":["CodeExample_vue_vue_type_script_setup_true_lang_default","_plugin_vue_export_helper_default","CodeExample_default"],"sources":[],"mappings":""}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { MediaTypeObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document';
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
examples?: MediaTypeObject['examples'] | Record<string, string>;
|
|
4
|
+
/** Accessible purpose of the picker, combined with the visible selection. */
|
|
5
|
+
label?: string;
|
|
4
6
|
};
|
|
5
7
|
type __VLS_ModelProps = {
|
|
6
8
|
modelValue: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExamplePicker.vue.d.ts","sourceRoot":"","sources":["../../../src/code-example/components/ExamplePicker.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExamplePicker.vue.d.ts","sourceRoot":"","sources":["../../../src/code-example/components/ExamplePicker.vue"],"names":[],"mappings":"AAiFA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAKnG,KAAK,WAAW,GAAG;IACjB,QAAQ,CAAC,EAAE,eAAe,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/D,6EAA6E;IAC7E,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAC;AA8BF,KAAK,gBAAgB,GAAG;IACxB,UAAU,EAAE,MAAM,CAAC;CAClB,CAAC;AAKF,KAAK,iBAAiB,GAAG,WAAW,GAAG,gBAAgB,CAAC;AAmHxD,QAAA,MAAM,YAAY;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -1,6 +1,52 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { getExampleSummary as e } from "../../schema/helpers/get-rendered-example.js";
|
|
2
|
+
import { computed as t, createBlock as n, createElementVNode as r, createVNode as i, defineComponent as a, mergeModels as o, mergeProps as s, normalizeClass as c, openBlock as l, toDisplayString as u, unref as d, useModel as f, withCtx as p } from "vue";
|
|
3
|
+
import { ScalarButton as m } from "@scalar/components/button";
|
|
4
|
+
import { ScalarListbox as h } from "@scalar/components/listbox";
|
|
5
|
+
import { ScalarIconCaretDown as g } from "@scalar/icons";
|
|
6
|
+
// src/code-example/components/ExamplePicker.vue?vue&type=script&setup=true&lang.ts
|
|
7
|
+
var _ = { class: "min-w-0 flex-1 truncate" }, v = /*@__PURE__*/ a({
|
|
8
|
+
inheritAttrs: !1,
|
|
9
|
+
__name: "ExamplePicker",
|
|
10
|
+
props: /*@__PURE__*/ o({
|
|
11
|
+
examples: { default: () => ({}) },
|
|
12
|
+
label: {}
|
|
13
|
+
}, {
|
|
14
|
+
modelValue: { required: !0 },
|
|
15
|
+
modelModifiers: {}
|
|
16
|
+
}),
|
|
17
|
+
emits: ["update:modelValue"],
|
|
18
|
+
setup(a) {
|
|
19
|
+
let o = f(a, "modelValue"), v = t(() => Object.entries(a.examples).map(([t, n]) => ({
|
|
20
|
+
id: t,
|
|
21
|
+
label: e(n) || t
|
|
22
|
+
}))), y = t({
|
|
23
|
+
get: () => v.value.find(({ id: e }) => e === o.value),
|
|
24
|
+
set: (e) => o.value = e?.id ?? ""
|
|
25
|
+
}), b = t(() => y.value?.label ?? "Select an example"), x = t(() => a.label ? `${a.label}: ${b.value}` : void 0);
|
|
26
|
+
return (e, t) => (l(), n(d(h), {
|
|
27
|
+
modelValue: y.value,
|
|
28
|
+
"onUpdate:modelValue": t[0] ||= (e) => y.value = e,
|
|
29
|
+
class: "w-fit min-w-32",
|
|
30
|
+
options: v.value,
|
|
31
|
+
placement: "bottom-start",
|
|
32
|
+
teleport: ""
|
|
33
|
+
}, {
|
|
34
|
+
default: p(({ open: t }) => [i(d(m), s({
|
|
35
|
+
"aria-label": x.value,
|
|
36
|
+
class: "text-c-2 hover:text-c-1 flex h-full w-fit min-w-0 gap-1.5 px-1.5 py-0.75 text-base font-normal",
|
|
37
|
+
"data-testid": "example-picker",
|
|
38
|
+
variant: "ghost"
|
|
39
|
+
}, e.$attrs), {
|
|
40
|
+
default: p(() => [r("div", _, u(b.value), 1), i(d(g), {
|
|
41
|
+
class: c(["mt-0.25 size-3 transition-transform duration-100", { "rotate-180": t }]),
|
|
42
|
+
weight: "bold"
|
|
43
|
+
}, null, 8, ["class"])]),
|
|
44
|
+
_: 2
|
|
45
|
+
}, 1040, ["aria-label"])]),
|
|
46
|
+
_: 1
|
|
47
|
+
}, 8, ["modelValue", "options"]));
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
export { v as default };
|
|
5
51
|
|
|
6
52
|
//# sourceMappingURL=ExamplePicker.vue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExamplePicker.vue.js","names":["ExamplePicker_vue_vue_type_script_setup_true_lang_default","
|
|
1
|
+
{"version":3,"file":"ExamplePicker.vue.js","names":["$attrs","_useModel","_openBlock","_createBlock","_unref","_withCtx","_createVNode","_mergeProps","_createElementVNode","_toDisplayString","_normalizeClass","getExampleSummary","computed","createBlock","createElementVNode","createVNode","defineComponent","mergeModels","mergeProps","normalizeClass","openBlock","toDisplayString","unref","useModel","withCtx","ScalarButton","ScalarListbox","ScalarIconCaretDown","_hoisted_1","ExamplePicker_vue_vue_type_script_setup_true_lang_default","\"modelValue\"","\"modelModifiers\"","__props","selectedExampleKey","exampleOptions","key","example","selectedExample","id","v","visibleLabel","accessibleLabel","_ctx","_cache","$event","open"],"sources":["../../../src/code-example/components/ExamplePicker.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport {\n ScalarListbox,\n type ScalarListboxOption,\n} from '@scalar/components/listbox'\nimport { ScalarIconCaretDown } from '@scalar/icons'\nimport type { MediaTypeObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport { getExampleSummary } from '../../schema/helpers/get-rendered-example'\n\nconst { examples = {}, label } = defineProps<{\n examples?: MediaTypeObject['examples'] | Record<string, string>\n /** Accessible purpose of the picker, combined with the visible selection. */\n label?: string\n}>()\n\nconst selectedExampleKey = defineModel<string>({\n required: true,\n})\n\ndefineOptions({ inheritAttrs: false })\n\nconst exampleOptions = computed<ScalarListboxOption[]>(() =>\n Object.entries(examples).map(([key, example]) => ({\n id: key,\n label: getExampleSummary(example) || key,\n })),\n)\n\nconst selectedExample = computed<ScalarListboxOption | undefined>({\n get: () =>\n exampleOptions.value.find(({ id }) => id === selectedExampleKey.value),\n set: (v) => (selectedExampleKey.value = v?.id ?? ''),\n})\nconst visibleLabel = computed(\n () => selectedExample.value?.label ?? 'Select an example',\n)\nconst accessibleLabel = computed(() =>\n label ? `${label}: ${visibleLabel.value}` : undefined,\n)\n</script>\n\n<template>\n <ScalarListbox\n v-slot=\"{ open }\"\n v-model=\"selectedExample\"\n class=\"w-fit min-w-32\"\n :options=\"exampleOptions\"\n placement=\"bottom-start\"\n teleport>\n <ScalarButton\n :aria-label=\"accessibleLabel\"\n class=\"text-c-2 hover:text-c-1 flex h-full w-fit min-w-0 gap-1.5 px-1.5 py-0.75 text-base font-normal\"\n data-testid=\"example-picker\"\n variant=\"ghost\"\n v-bind=\"$attrs\">\n <div class=\"min-w-0 flex-1 truncate\">\n {{ visibleLabel }}\n </div>\n <!--\n Follow this listbox's own state. The `ui-open:` variant also matches any open\n Headless UI ancestor, such as an expanded operation in the classic layout.\n -->\n <ScalarIconCaretDown\n class=\"mt-0.25 size-3 transition-transform duration-100\"\n :class=\"{ 'rotate-180': open }\"\n weight=\"bold\" />\n </ScalarButton>\n </ScalarListbox>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;EAkBA,IAAMiC,IAAqBhC,EAAmB+B,GAAA,YAE7C,GAIKE,IAAiBtB,QACrB,OAAO,QAAQoB,EAAA,QAAQ,CAAC,CAAC,KAAK,CAACG,GAAKC,QAAc;GAChD,IAAID;GACJ,OAAOxB,EAAkByB,CAAO,KAAKD;EACvC,EAAE,CACJ,GAEME,IAAkBzB,EAA0C;GAChE,WACEsB,EAAe,MAAM,MAAM,EAAEI,YAASA,MAAOL,EAAmB,KAAK;GACvE,MAAMM,MAAON,EAAmB,QAAQM,GAAG,MAAM;EACnD,CAAC,GACKC,IAAe5B,QACbyB,EAAgB,OAAO,SAAS,mBACxC,GACMI,IAAkB7B,QACtBoB,EAAA,QAAQ,GAAGA,EAAA,MAAM,IAAIQ,EAAa,UAAU,KAAA,CAC9C;E,kBAIEtC,EAAA,GAAAC,EAyBgBC,EAAAsB,CAAA,GAAA;GAvBL,YAAAW,EAAA;GAAA,uBAAAM,EAAA,QAAAC,MAAAP,EAAe,QAAAO;GACxB,OAAM;GACL,SAASV,EAAA;GACV,WAAU;GACV,UAAA;;GACA,SAAA7B,GAiBe,EAvBLwC,cAAI,CAMdvC,EAiBeF,EAAAqB,CAAA,GAjBflB,EAiBe;IAhBZ,cAAYkC,EAAA;IACb,OAAM;IACN,eAAY;IACZ,SAAQ;GACAzC,GAAAA,EAAAA,MAAM,GAAA;IACd,SAAAK,QAEM,CAFNG,EAEM,OAFNoB,GAEMnB,EADD+B,EAAA,KAAY,GAAA,CAAA,GAMjBlC,EAGkBF,EAAAuB,CAAA,GAAA;KAFhB,OAAKjB,EAAA,CAAC,oDAAkD,EAAA,cAChCmC,EAAI,CAAA,CAAA;KAC5B,QAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExamplePicker2.vue.js","names":["ExamplePicker_vue_vue_type_script_setup_true_lang_default","ExamplePicker_default"],"sources":[],"mappings":""}
|
|
@@ -1,6 +1,34 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { computed as e, createBlock as t, createTextVNode as n, defineComponent as r, normalizeClass as i, normalizeStyle as a, openBlock as o, renderSlot as s, resolveDynamicComponent as c, toDisplayString as l, unref as u, withCtx as d } from "vue";
|
|
2
|
+
import { getHttpMethodInfo as f } from "@scalar/helpers/http/http-info";
|
|
3
|
+
import { isHttpMethod as p } from "@scalar/helpers/http/is-http-method";
|
|
4
|
+
// src/code-example/components/HttpMethod.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var m = /*@__PURE__*/ r({
|
|
6
|
+
__name: "HttpMethod",
|
|
7
|
+
props: {
|
|
8
|
+
as: { type: [
|
|
9
|
+
Object,
|
|
10
|
+
Function,
|
|
11
|
+
String
|
|
12
|
+
] },
|
|
13
|
+
property: {},
|
|
14
|
+
short: { type: Boolean },
|
|
15
|
+
method: {}
|
|
16
|
+
},
|
|
17
|
+
setup(r) {
|
|
18
|
+
let m = r, h = e(() => f(String(m.method || ""))), g = e(() => {
|
|
19
|
+
if (typeof m.method != "string" || !m.method.trim()) return "get";
|
|
20
|
+
let e = m.method.trim();
|
|
21
|
+
return p(e.toLowerCase()) ? e.toLowerCase() : e;
|
|
22
|
+
});
|
|
23
|
+
return (e, f) => (o(), t(c(r.as ?? "span"), {
|
|
24
|
+
class: i({ uppercase: u(p)(g.value) }),
|
|
25
|
+
style: a({ [r.property || "color"]: h.value.colorVar })
|
|
26
|
+
}, {
|
|
27
|
+
default: d(() => [s(e.$slots, "default"), n(" " + l(r.short ? h.value.short : g.value), 1)]),
|
|
28
|
+
_: 3
|
|
29
|
+
}, 8, ["class", "style"]));
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
export { m as default };
|
|
5
33
|
|
|
6
34
|
//# sourceMappingURL=HttpMethod.vue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpMethod.vue.js","names":["HttpMethod_vue_vue_type_script_setup_true_lang_default","
|
|
1
|
+
{"version":3,"file":"HttpMethod.vue.js","names":["_openBlock","_createBlock","_resolveDynamicComponent","_normalizeClass","_unref","_normalizeStyle","_withCtx","_renderSlot","_createTextVNode","_toDisplayString","computed","createBlock","createTextVNode","defineComponent","normalizeClass","normalizeStyle","openBlock","renderSlot","resolveDynamicComponent","toDisplayString","unref","withCtx","getHttpMethodInfo","isHttpMethod","HttpMethod_vue_vue_type_script_setup_true_lang_default","__props","props","httpMethodInfo","normalized","method","_ctx","_cache"],"sources":["../../../src/code-example/components/HttpMethod.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { getHttpMethodInfo } from '@scalar/helpers/http/http-info'\nimport { isHttpMethod } from '@scalar/helpers/http/is-http-method'\nimport { computed, type Component } from 'vue'\n\nconst props = defineProps<{\n /** The type of element to render as, defaults to `span` */\n as?: Component | string\n /** The css style property or variable that will be set to the request method color, defaults to `color` */\n property?: string\n /** Whether or not to abbreviated the slot content */\n short?: boolean\n /** The HTTP method to show */\n method: string\n}>()\n\n/** Grabs the method info object which contains abbreviation, color, and background color etc */\nconst httpMethodInfo = computed(() =>\n getHttpMethodInfo(String(props.method || '')),\n)\n\n/** Full method name */\nconst normalized = computed(() => {\n if (typeof props.method !== 'string' || !props.method.trim()) {\n return 'get'\n }\n const method = props.method.trim()\n return isHttpMethod(method.toLowerCase()) ? method.toLowerCase() : method\n})\n</script>\n\n<template>\n <component\n :is=\"as ?? 'span'\"\n :class=\"{ uppercase: isHttpMethod(normalized) }\"\n :style=\"{ [property || 'color']: httpMethodInfo.colorVar }\">\n <slot />\n {{ short ? httpMethodInfo.short : normalized }}\n </component>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;EAKA,IAAM0B,IAAQD,GAYRE,IAAiBjB,QACrBY,EAAkB,OAAOI,EAAM,UAAU,EAAE,CAAC,CAC9C,GAGME,IAAalB,QAAe;GAChC,IAAI,OAAOgB,EAAM,UAAW,YAAY,CAACA,EAAM,OAAO,KAAK,GACzD,OAAO;GAET,IAAMG,IAASH,EAAM,OAAO,KAAK;GACjC,OAAOH,EAAaM,EAAO,YAAY,CAAC,IAAIA,EAAO,YAAY,IAAIA;EACrE,CAAC;E,kBAIC7B,EAAA,GAAAC,EAMYC,EALLuB,EAAA,MAAE,MAAA,GAAA;GACN,OAAKtB,EAAA,EAAA,WAAeC,EAAAmB,CAAA,CAAY,CAACK,EAAA,KAAU,EAAA,CAAA;GAC3C,OAAKvB,EAAA,GAAKoB,EAAA,YAAQ,UAAcE,EAAA,MAAe,SAAQ,CAAA;;GACxD,SAAArB,QAAQ,CAARC,EAAQuB,EAAA,QAAA,SAAA,GAAAtB,EAAA,MACRC,EAAGgB,EAAA,QAAQE,EAAA,MAAe,QAAQC,EAAA,KAAU,GAAA,CAAA,C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpMethod2.vue.js","names":["HttpMethod_vue_vue_type_script_setup_true_lang_default","HttpMethod_default"],"sources":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter-clients-by-query.js","names":["matchesOption","
|
|
1
|
+
{"version":3,"file":"filter-clients-by-query.js","names":["matchesOption","option","query","q","matchesGroup","group","filterClientsByQuery","options","groups","visibleGroupCount","g","result","o"],"sources":["../../../src/code-example/helpers/filter-clients-by-query.ts"],"sourcesContent":["import type { ScalarComboboxFilterFunction } from '@scalar/components/combobox'\n\nimport type { CustomClientOptionGroup, CustomOrDefaultClientOption } from '../types'\n\n/**\n * Checks if a client label, client key, or language matches a query\n */\nconst matchesOption = (option: CustomOrDefaultClientOption, query: string) => {\n const q = query.toLowerCase()\n return (\n option.label.toLowerCase().includes(q) ||\n option.clientKey.toLowerCase().includes(q) ||\n option.lang.toLowerCase().includes(q)\n )\n}\n\n/**\n * Checks if a client label, client key, or language matches a query\n */\nconst matchesGroup = (group: CustomClientOptionGroup, query: string) => {\n const q = query.toLowerCase()\n return group.label.toLowerCase().includes(q) || group.key.toLowerCase().includes(q)\n}\n\n/**\n * Filters the clients based on a query\n *\n * When dealing with multiple groups, include all options from a group if the\n * group label itself matches — so searching \"JavaScript\" shows all JS clients.\n */\nexport const filterClientsByQuery = ((\n query: string,\n options: CustomOrDefaultClientOption[],\n groups: CustomClientOptionGroup[],\n): CustomOrDefaultClientOption[] => {\n if (query === '') {\n return options\n }\n\n const q = query.toLowerCase()\n\n // Only activate when more than one group is actually visible (has a label and options).\n const visibleGroupCount = groups ? groups.filter((g) => g.label && g.options.length > 0).length : 0\n\n if (groups && visibleGroupCount > 1) {\n const result: CustomOrDefaultClientOption[] = []\n for (const group of groups) {\n if (matchesGroup(group, q)) {\n result.push(...group.options)\n } else {\n result.push(...group.options.filter((o) => matchesOption(o, q)))\n }\n }\n return result\n }\n\n return options.filter((o) => matchesOption(o, q))\n}) satisfies ScalarComboboxFilterFunction<CustomOrDefaultClientOption, CustomClientOptionGroup>\n"],"mappings":";AAOA,IAAMA,KAAiBC,GAAqCC,MAAkB;CAC5E,IAAMC,IAAID,EAAM,YAAY;CAC5B,OACED,EAAO,MAAM,YAAY,CAAC,CAAC,SAASE,CAAC,KACrCF,EAAO,UAAU,YAAY,CAAC,CAAC,SAASE,CAAC,KACzCF,EAAO,KAAK,YAAY,CAAC,CAAC,SAASE,CAAC;AAExC,GAKMC,KAAgBC,GAAgCH,MAAkB;CACtE,IAAMC,IAAID,EAAM,YAAY;CAC5B,OAAOG,EAAM,MAAM,YAAY,CAAC,CAAC,SAASF,CAAC,KAAKE,EAAM,IAAI,YAAY,CAAC,CAAC,SAASF,CAAC;AACpF,GAQaG,MACXJ,GACAK,GACAC,MACkC;CAClC,IAAIN,MAAU,IACZ,OAAOK;CAGT,IAAMJ,IAAID,EAAM,YAAY,GAGtBO,IAAoBD,IAASA,EAAO,QAAQE,MAAMA,EAAE,SAASA,EAAE,QAAQ,SAAS,CAAC,CAAC,CAAC,SAAS;CAElG,IAAIF,KAAUC,IAAoB,GAAG;EACnC,IAAME,IAAwC,CAAC;EAC/C,KAAK,IAAMN,KAASG,GACdJ,EAAaC,GAAOF,CAAC,IACvBQ,EAAO,KAAK,GAAGN,EAAM,OAAO,IAE5BM,EAAO,KAAK,GAAGN,EAAM,QAAQ,QAAQO,MAAMZ,EAAcY,GAAGT,CAAC,CAAC,CAAC;EAGnE,OAAOQ;CACT;CAEA,OAAOJ,EAAQ,QAAQK,MAAMZ,EAAcY,GAAGT,CAAC,CAAC;AAClD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-client.js","names":["
|
|
1
|
+
{"version":3,"file":"find-client.js","names":["AVAILABLE_CLIENTS","DEFAULT_CLIENT","isClient","id","isSelectedClient","findClient","clientGroups","clientId","findById","group","option","firstCustom"],"sources":["../../../src/code-example/helpers/find-client.ts"],"sourcesContent":["import { AVAILABLE_CLIENTS, type AvailableClients } from '@scalar/snippetz'\n\nimport type { ClientOption, CustomClientOption, CustomClientOptionGroup } from '../types'\n\nexport const DEFAULT_CLIENT = 'shell/curl'\n\n/**\n * A selection the code sample picker understands: either a built-in client id\n * (e.g. `js/fetch`) or a custom sample id (e.g. `custom/python`).\n *\n * The custom part is typed as `string & {}` rather than the `custom/${string}`\n * template literal: unioning that template literal with the (very large) built-in\n * client-id union trips TypeScript's \"union too complex\" limit inside Vue's\n * `defineProps` macro. `string & {}` keeps editor hints for the known client ids\n * without expanding the union.\n */\nexport type SelectedClientId = AvailableClients[number] | (string & {})\n\n/** Type guard to check if a string is a valid built-in client id */\nexport const isClient = (id: any): id is AvailableClients[number] => AVAILABLE_CLIENTS.includes(id)\n\n/** Type guard for any selection the picker can restore (built-in client or custom sample id) */\nexport const isSelectedClient = (id: any): id is SelectedClientId =>\n isClient(id) || (typeof id === 'string' && id.startsWith('custom/'))\n\n/**\n * Finds and returns the appropriate client option to select for an operation.\n *\n * Selection rules, given the globally selected client/sample id:\n *\n * 1. A custom sample is selected (`custom/<lang>`): show the matching sample on\n * this operation. If this operation has no sample for that exact language, we\n * keep showing a custom sample (its first one) so the selection stays \"global\".\n * 2. An explicit built-in client is selected: it wins, even when the operation\n * also has custom samples. This includes the default client (`shell/curl`):\n * a built-in id only reaches us through a real selection (config, persistence,\n * or the picker), never as an implicit default, so a deliberate cURL pick must\n * stick instead of snapping back to an SDK example.\n * 3. Otherwise (nothing selected yet): prefer a custom sample when the operation\n * has one, so custom examples are the default.\n * 4. Fall back to the default built-in client, then the first option.\n *\n * @param clientGroups - Array of client option groups, each containing a label and array of client options\n * @param clientId - Optional selection to restore (e.g. 'js/fetch' or 'custom/python')\n * @returns The selected client option, or undefined when there is nothing to select\n */\nexport const findClient = (\n clientGroups: CustomClientOptionGroup[],\n clientId?: SelectedClientId | undefined,\n): ClientOption | CustomClientOption | undefined => {\n const findById = (id: string) => {\n for (const group of clientGroups) {\n const option = group.options.find((option) => option.id === id)\n if (option) {\n return option\n }\n }\n return undefined\n }\n\n const firstCustom = clientGroups.find((group) => group.key === 'custom')?.options[0]\n\n // 1. A custom sample is selected: match the language, otherwise stay on a custom sample\n if (clientId?.startsWith('custom')) {\n return findById(clientId) ?? firstCustom ?? findById(DEFAULT_CLIENT) ?? clientGroups[0]?.options[0]\n }\n\n // 2. An explicit built-in client wins, even when custom samples exist. A built-in\n // id (including the default `shell/curl`) only reaches us through a real\n // selection, so it must stick rather than snap back to a custom sample.\n if (clientId) {\n const option = findById(clientId)\n if (option) {\n return option\n }\n }\n\n // 3. Nothing selected yet: prefer a custom sample when the operation has one\n if (firstCustom) {\n return firstCustom\n }\n\n // 4. Otherwise fall back to the default built-in client, then the first option\n return findById(DEFAULT_CLIENT) ?? clientGroups[0]?.options[0]\n}\n"],"mappings":";;AAIA,IAAaC,IAAiB,cAejBC,KAAYC,MAA4CH,EAAkB,SAASG,CAAE,GAGrFC,KAAoBD,MAC/BD,EAASC,CAAE,KAAM,OAAOA,KAAO,YAAYA,EAAG,WAAW,SAAS,GAuBvDE,KACXC,GACAC,MACkD;CAClD,IAAMC,KAAYL,MAAe;EAC/B,KAAK,IAAMM,KAASH,GAAc;GAChC,IAAMI,IAASD,EAAM,QAAQ,MAAMC,MAAWA,EAAO,OAAOP,CAAE;GAC9D,IAAIO,GACF,OAAOA;EAEX;CAEF,GAEMC,IAAcL,EAAa,MAAMG,MAAUA,EAAM,QAAQ,QAAQ,CAAC,EAAE,QAAQ;CAGlF,IAAIF,GAAU,WAAW,QAAQ,GAC/B,OAAOC,EAASD,CAAQ,KAAKI,KAAeH,EAAA,YAAuB,KAAKF,EAAa,EAAE,EAAE,QAAQ;CAMnG,IAAIC,GAAU;EACZ,IAAMG,IAASF,EAASD,CAAQ;EAChC,IAAIG,GACF,OAAOA;CAEX;CAQA,OALIC,MAKGH,EAAA,YAAuB,KAAKF,EAAa,EAAE,EAAE,QAAQ;AAC9D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-language.js","names":["LANGUAGE_LABELS","formatLanguage","lang"
|
|
1
|
+
{"version":3,"file":"format-language.js","names":["capitalize","LANGUAGE_LABELS","formatLanguage","lang"],"sources":["../../../src/code-example/helpers/format-language.ts"],"sourcesContent":["import { capitalize } from '@scalar/helpers/string/capitalize'\n\n/**\n * Display names for the most common languages found in custom code samples.\n *\n * Custom samples (`x-scalar-examples`, `x-readme`, `x-stainless-*`, …) carry a\n * free-form `lang` string that we otherwise show verbatim in the picker. This\n * map gives the common ones a properly cased label (e.g. `typescript` →\n * `TypeScript`). Anything not listed falls back to a simple capitalization.\n */\nconst LANGUAGE_LABELS: Record<string, string> = {\n c: 'C',\n clojure: 'Clojure',\n cpp: 'C++',\n 'c++': 'C++',\n csharp: 'C#',\n 'c#': 'C#',\n css: 'CSS',\n curl: 'cURL',\n dart: 'Dart',\n fsharp: 'F#',\n 'f#': 'F#',\n go: 'Go',\n golang: 'Go',\n graphql: 'GraphQL',\n html: 'HTML',\n http: 'HTTP',\n java: 'Java',\n javascript: 'JavaScript',\n js: 'JavaScript',\n json: 'JSON',\n jl: 'Julia',\n julia: 'Julia',\n kotlin: 'Kotlin',\n node: 'Node.js',\n nodejs: 'Node.js',\n objc: 'Objective-C',\n 'objective-c': 'Objective-C',\n ocaml: 'OCaml',\n php: 'PHP',\n powershell: 'PowerShell',\n py: 'Python',\n python: 'Python',\n r: 'R',\n ruby: 'Ruby',\n rust: 'Rust',\n scala: 'Scala',\n sh: 'Shell',\n shell: 'Shell',\n bash: 'Shell',\n sql: 'SQL',\n swift: 'Swift',\n ts: 'TypeScript',\n typescript: 'TypeScript',\n xml: 'XML',\n yaml: 'YAML',\n yml: 'YAML',\n}\n\n/**\n * Turn a free-form language identifier into a display label for the code sample picker.\n *\n * @param lang - The language identifier from a custom code sample (e.g. `typescript`)\n * @returns A properly cased label (e.g. `TypeScript`), or `undefined` when no language is given\n */\nexport const formatLanguage = (lang?: string): string | undefined => {\n if (!lang) {\n return undefined\n }\n\n return LANGUAGE_LABELS[lang.toLowerCase()] ?? capitalize(lang)\n}\n"],"mappings":";;AAUA,IAAMC,IAA0C;CAC9C,GAAG;CACH,SAAS;CACT,KAAK;CACL,OAAO;CACP,QAAQ;CACR,MAAM;CACN,KAAK;CACL,MAAM;CACN,MAAM;CACN,QAAQ;CACR,MAAM;CACN,IAAI;CACJ,QAAQ;CACR,SAAS;CACT,MAAM;CACN,MAAM;CACN,MAAM;CACN,YAAY;CACZ,IAAI;CACJ,MAAM;CACN,IAAI;CACJ,OAAO;CACP,QAAQ;CACR,MAAM;CACN,QAAQ;CACR,MAAM;CACN,eAAe;CACf,OAAO;CACP,KAAK;CACL,YAAY;CACZ,IAAI;CACJ,QAAQ;CACR,GAAG;CACH,MAAM;CACN,MAAM;CACN,OAAO;CACP,IAAI;CACJ,OAAO;CACP,MAAM;CACN,KAAK;CACL,OAAO;CACP,IAAI;CACJ,YAAY;CACZ,KAAK;CACL,MAAM;CACN,KAAK;AACP,GAQaC,KAAkBC,MAAsC;CACnE,IAAKA,GAIL,OAAOF,EAAgBE,EAAK,YAAY,MAAMH,EAAWG,CAAI;AAC/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-client-options.js","names":["
|
|
1
|
+
{"version":3,"file":"generate-client-options.js","names":["capitalize","AVAILABLE_CLIENTS","snippetz","getCustomClientIds","samples","countByLang","linkedGroups","sample","lang","group","existing","seen","id","generateClientOptions","allowedClients","allowedClientsSet","options","plugin"],"sources":["../../../src/code-example/helpers/generate-client-options.ts"],"sourcesContent":["import { AVAILABLE_CLIENTS, type AvailableClients, snippetz } from '@scalar/snippetz'\nimport type { XCodeSample } from '@scalar/workspace-store/schemas/extensions/operation'\nimport { capitalize } from 'vue'\n\nimport type { ClientOptionGroup } from '../types'\n\n/** Type of custom code sample IDs */\nexport type CustomCodeSampleId = `custom/${string}`\n\n/**\n * Build stable, language-keyed ids for an operation's custom code samples.\n *\n * Custom samples are defined per operation, but a selection (e.g. the Python SDK\n * example) should sync across every operation that ships the same language. So we\n * key the id by language rather than by position: the first sample of a language\n * becomes `custom/<lang>`, and any further samples that repeat a language fall back\n * to `custom/<lang>/<n>` so they stay individually selectable within the operation.\n * Linked request examples with the same language, label, and group share an id.\n *\n * The language is lower-cased so a selection still matches when operations (or\n * extensions) spell the same language with different casing (e.g. `Python` vs\n * `python`).\n *\n * @param samples - The custom code samples for a single operation\n * @returns A list of ids aligned by index with the input samples\n */\nexport const getCustomClientIds = (samples: XCodeSample[]): CustomCodeSampleId[] => {\n const countByLang = new Map<string, number>()\n const linkedGroups = new Map<string, CustomCodeSampleId>()\n\n return samples.map((sample): CustomCodeSampleId => {\n const lang = (sample.lang || 'plaintext').toLowerCase()\n const group = JSON.stringify([\n lang,\n sample.label ?? '',\n typeof sample.group === 'string' ? sample.group.trim() : '',\n ])\n const existing = sample.example !== undefined ? linkedGroups.get(group) : undefined\n if (existing) {\n return existing\n }\n\n const seen = countByLang.get(lang) ?? 0\n countByLang.set(lang, seen + 1)\n\n const id: CustomCodeSampleId = seen === 0 ? `custom/${lang}` : `custom/${lang}/${seen}`\n // Named request examples share one language option; legacy samples remain separate.\n if (sample.example !== undefined) {\n linkedGroups.set(group, id)\n }\n return id\n })\n}\n\n/**\n * Generate client options for the request example block by filtering by allowed clients\n *\n * @param allowedClients - The list of allowed clients to include in the options\n * @returns A list of client option groups\n */\nexport const generateClientOptions = (allowedClients: AvailableClients = AVAILABLE_CLIENTS): ClientOptionGroup[] => {\n /** Create set of allowlist for quicker lookups */\n const allowedClientsSet = new Set(allowedClients)\n\n const options = snippetz()\n .clients()\n .flatMap((group) => {\n const options = group.clients.flatMap((plugin) => {\n const id: AvailableClients[number] = `${group.key}/${plugin.client}`\n\n // If the client is not allowed, skip it\n if (!allowedClientsSet.has(id)) {\n return []\n }\n\n return {\n id,\n lang: plugin.client === 'curl' ? ('curl' as const) : group.key,\n title: `${capitalize(group.title)} ${plugin.title}`,\n label: plugin.title,\n targetKey: group.key,\n targetTitle: group.title,\n clientKey: plugin.client,\n }\n })\n\n // If no clients are allowed, skip this group\n if (options.length === 0) {\n return []\n }\n\n return {\n label: group.title,\n key: group.key,\n options,\n }\n })\n\n return options\n}\n"],"mappings":";;;AA0BA,IAAaG,KAAsBC,MAAiD;CAClF,IAAMC,oBAAc,IAAI,IAAoB,GACtCC,oBAAe,IAAI,IAAgC;CAEzD,OAAOF,EAAQ,KAAKG,MAA+B;EACjD,IAAMC,KAAQD,EAAO,QAAQ,YAAA,CAAa,YAAY,GAChDE,IAAQ,KAAK,UAAU;GAC3BD;GACAD,EAAO,SAAS;GAChB,OAAOA,EAAO,SAAU,WAAWA,EAAO,MAAM,KAAK,IAAI;EAC3D,CAAC,GACKG,IAAWH,EAAO,YAAY,KAAA,IAAsC,KAAA,IAA1BD,EAAa,IAAIG,CAAK;EACtE,IAAIC,GACF,OAAOA;EAGT,IAAMC,IAAON,EAAY,IAAIG,CAAI,KAAK;EACtCH,EAAY,IAAIG,GAAMG,IAAO,CAAC;EAE9B,IAAMC,IAAyBD,MAAS,IAAI,UAAUH,MAAS,UAAUA,EAAK,GAAGG;EAKjF,OAHIJ,EAAO,YAAY,KAAA,KACrBD,EAAa,IAAIG,GAAOG,CAAE,GAErBA;CACT,CAAC;AACH,GAQaC,KAAyBC,IAAmCb,MAA2C;CAElH,IAAMc,IAAoB,IAAI,IAAID,CAAc;CAoChD,OAlCgBZ,EAAS,CAAC,CACvB,QAAQ,CAAC,CACT,SAASO,MAAU;EAClB,IAAMO,IAAUP,EAAM,QAAQ,SAASQ,MAAW;GAChD,IAAML,IAA+B,GAAGH,EAAM,IAAI,GAAGQ,EAAO;GAO5D,OAJKF,EAAkB,IAAIH,CAAE,IAItB;IACLA;IACA,MAAMK,EAAO,WAAW,SAAU,SAAmBR,EAAM;IAC3D,OAAO,GAAGT,EAAWS,EAAM,KAAK,EAAE,GAAGQ,EAAO;IAC5C,OAAOA,EAAO;IACd,WAAWR,EAAM;IACjB,aAAaA,EAAM;IACnB,WAAWQ,EAAO;GACpB,IAXS,CAAC;EAYZ,CAAC;EAOD,OAJID,EAAQ,WAAW,IACd,CAAC,IAGH;GACL,OAAOP,EAAM;GACb,KAAKA,EAAM;GACXO;EACF;CACF,CAEK;AACT"}
|
|
@@ -37,7 +37,13 @@ type GenerateCodeSnippetProps = {
|
|
|
37
37
|
/** Whether to disable parameters by default. */
|
|
38
38
|
defaultDisabledParameters?: boolean;
|
|
39
39
|
};
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
type GeneratedSnippet = {
|
|
41
|
+
content: string | null;
|
|
42
|
+
displayContent?: string;
|
|
43
|
+
};
|
|
44
|
+
/** Generate runnable source, or null when a linked sample is unavailable. */
|
|
45
|
+
export declare const generateCodeSnippet: (props: GenerateCodeSnippetProps) => string | null;
|
|
46
|
+
/** Provide a masked preview alongside the runnable source when Basic credentials are present. */
|
|
47
|
+
export declare const generateCodeSnippetWithPreview: (props: GenerateCodeSnippetProps) => GeneratedSnippet;
|
|
42
48
|
export {};
|
|
43
49
|
//# sourceMappingURL=generate-code-snippet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-code-snippet.d.ts","sourceRoot":"","sources":["../../../src/code-example/helpers/generate-code-snippet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"generate-code-snippet.d.ts","sourceRoot":"","sources":["../../../src/code-example/helpers/generate-code-snippet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAA2C,MAAM,kBAAkB,CAAA;AAChG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAElE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAA;AACzF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AACxG,OAAO,KAAK,EAAE,WAAW,EAAE,M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B,KAAG,MAAM,GAAG,IACxC,CAAA;AAEvC,iGAAiG;AACjG,eAAO,MAAM,8BAA8B,GAAI,OAAO,wBAAwB,KAAG,gBACnD,CAAA"}
|
|
@@ -3,40 +3,70 @@ import { getSnippet as t } from "./get-snippet.js";
|
|
|
3
3
|
import { operationToHar as n } from "./operation-to-har/operation-to-har.js";
|
|
4
4
|
import { CookieSerializationError as r } from "./operation-to-har/process-parameters.js";
|
|
5
5
|
import { getResolvedRef as i } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
6
|
+
import { encode as a } from "js-base64";
|
|
6
7
|
// src/code-example/helpers/generate-code-snippet.ts
|
|
7
|
-
var
|
|
8
|
+
var o = (e) => e.type === "http" && e.scheme === "basic", s = "••••••••", c = {
|
|
9
|
+
username: "username",
|
|
10
|
+
password: "password"
|
|
11
|
+
}, l = `${c.username}:${c.password}`, u = (e, t) => {
|
|
12
|
+
let n = /\P{ASCII}/u.test(t.username) ? "é" : "", r = "_SCALAR_BASIC_", i = 1;
|
|
13
|
+
for (;;) {
|
|
14
|
+
let o = t.username ? `${n}${r}USER_` : "", s = t.password ? `${r}PASSWORD_` : "", c = a(`${o}:${s}`);
|
|
15
|
+
if (!e.includes(r) && !e.includes(c)) return {
|
|
16
|
+
auth: {
|
|
17
|
+
username: o,
|
|
18
|
+
password: s
|
|
19
|
+
},
|
|
20
|
+
token: c
|
|
21
|
+
};
|
|
22
|
+
r = `_SCALAR_BASIC_${i++}_`;
|
|
23
|
+
}
|
|
24
|
+
}, d = ({ clientId: d, customCodeSamples: f, includeDefaultHeaders: p = !1, operation: m, method: h, path: g, example: _, contentType: v, server: y, securitySchemes: b, globalCookies: x, openapiVersion: S, jsonSchemaDialect: C, multipartNaming: w, requestBodyCompositionSelection: T, defaultDisabledParameters: E }, D) => {
|
|
8
25
|
try {
|
|
9
|
-
if (!
|
|
10
|
-
if (
|
|
11
|
-
let t = e(
|
|
26
|
+
if (!d) return { content: "" };
|
|
27
|
+
if (d.startsWith("custom")) {
|
|
28
|
+
let t = e(f), n = f.filter((e, n) => t[n] === d);
|
|
12
29
|
if (!n.some((e) => e.example !== void 0)) {
|
|
13
30
|
let e = n[0]?.source;
|
|
14
|
-
return typeof e == "object" ? null : e ?? "Custom example not found";
|
|
31
|
+
return { content: typeof e == "object" ? null : e ?? "Custom example not found" };
|
|
15
32
|
}
|
|
16
|
-
let r = i(
|
|
17
|
-
return typeof
|
|
33
|
+
let r = i(m.requestBody)?.content ?? {}, a = v ?? Object.keys(r)[0], o = _ ?? Object.keys(r[a ?? ""]?.examples ?? {})[0], s = n.find((e) => e.example === o && e.contentType === a) ?? n.find((e) => e.example === o && e.contentType === void 0);
|
|
34
|
+
return { content: typeof s?.source == "string" ? s.source : null };
|
|
35
|
+
}
|
|
36
|
+
let r = b.find(o), O = r?.["x-scalar-secret-username"] ?? "", k = r?.["x-scalar-secret-password"] ?? "", A = !!(O || k), j = A ? {
|
|
37
|
+
username: O,
|
|
38
|
+
password: k
|
|
39
|
+
} : c, M = r ? { auth: j } : void 0, N = n({
|
|
40
|
+
operation: m,
|
|
41
|
+
contentType: v,
|
|
42
|
+
method: h,
|
|
43
|
+
path: g,
|
|
44
|
+
server: y,
|
|
45
|
+
securitySchemes: r ? b.filter((e) => !o(e)) : b,
|
|
46
|
+
example: _,
|
|
47
|
+
globalCookies: x,
|
|
48
|
+
includeDefaultHeaders: p,
|
|
49
|
+
openapiVersion: S,
|
|
50
|
+
jsonSchemaDialect: C,
|
|
51
|
+
multipartNaming: w,
|
|
52
|
+
requestBodyCompositionSelection: T,
|
|
53
|
+
defaultDisabledParameters: E
|
|
54
|
+
}), [P, F] = d.split("/"), I = N.headers.some(({ name: e }) => e.toLowerCase() === "authorization"), [L, R] = t(P, F, N, M);
|
|
55
|
+
if (L) return console.error("[generateCodeSnippet]", L), { content: L.message };
|
|
56
|
+
if (!D || !r || I || !A && !R.includes(a(l))) return { content: R };
|
|
57
|
+
let { auth: z, token: B } = u(R, j), [, V] = t(P, F, N, { auth: z }), H = V?.replaceAll(B, A ? s : l) ?? "";
|
|
58
|
+
if (z.username) {
|
|
59
|
+
let e = A ? s : c.username;
|
|
60
|
+
H = H.replaceAll(encodeURIComponent(z.username), e).replaceAll(z.username, e);
|
|
18
61
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
path: u,
|
|
24
|
-
server: p,
|
|
25
|
-
securitySchemes: m,
|
|
26
|
-
example: d,
|
|
27
|
-
globalCookies: h,
|
|
28
|
-
includeDefaultHeaders: s,
|
|
29
|
-
openapiVersion: g,
|
|
30
|
-
jsonSchemaDialect: _,
|
|
31
|
-
multipartNaming: v,
|
|
32
|
-
requestBodyCompositionSelection: y,
|
|
33
|
-
defaultDisabledParameters: b
|
|
34
|
-
}), [x, S] = a.split("/"), [C, w] = t(x, S, r);
|
|
35
|
-
return C ? (console.error("[generateCodeSnippet]", C), C.message ?? "Error generating code snippet") : w;
|
|
62
|
+
return z.password && (H = H.replaceAll(z.password, A ? s : c.password)), H === R ? { content: R } : {
|
|
63
|
+
content: R,
|
|
64
|
+
displayContent: H
|
|
65
|
+
};
|
|
36
66
|
} catch (e) {
|
|
37
|
-
return console.error("[generateCodeSnippet]", e), e instanceof r ? e.message : "Error generating code snippet";
|
|
67
|
+
return console.error("[generateCodeSnippet]", e), { content: e instanceof r ? e.message : "Error generating code snippet" };
|
|
38
68
|
}
|
|
39
|
-
};
|
|
40
|
-
export {
|
|
69
|
+
}, f = (e) => d(e, !1).content, p = (e) => d(e, !0);
|
|
70
|
+
export { f as generateCodeSnippet, p as generateCodeSnippetWithPreview };
|
|
41
71
|
|
|
42
72
|
//# sourceMappingURL=generate-code-snippet.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-code-snippet.js","names":["generateCodeSnippet","clientId","ids","getCustomClientIds","customCodeSamples","samples","index","sample","source","content","getResolvedRef","operation","mediaType","contentType","exampleKey","example","harRequest","operationToHar","targetKey","clientKey","error","payload","getSnippet","CookieSerializationError"],"sources":["../../../src/code-example/helpers/generate-code-snippet.ts"],"sourcesContent":["import type { AvailableClient, ClientId, TargetId } from '@scalar/snippetz'\nimport type { MultipartNaming } from '@scalar/types/api-reference'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type { SecuritySchemeObjectSecret } from '@scalar/workspace-store/request-example'\nimport type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies'\nimport type { XCodeSample } from '@scalar/workspace-store/schemas/extensions/operation'\nimport type { OperationObject, ServerObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\n\nimport { type CustomCodeSampleId, getCustomClientIds } from './generate-client-options'\nimport { getSnippet } from './get-snippet'\nimport { operationToHar } from './operation-to-har/operation-to-har'\nimport { CookieSerializationError } from './operation-to-har/process-parameters'\n\ntype GenerateCodeSnippetProps = {\n /** The selected client/language for code generation (e.g., 'node/fetch') or a custom code sample ID. */\n clientId: AvailableClient | CustomCodeSampleId | undefined\n /** The Content-Type header value for the request body (e.g., 'application/json'). */\n contentType: string | undefined\n /** Array of custom code samples defined in the OpenAPI x-codeSamples extension. */\n customCodeSamples: XCodeSample[]\n /** The specific example value to use when generating the code snippet. */\n example: string | undefined\n /** The HTTP method for the operation (e.g., GET, POST, PUT). */\n method: string\n /** The OpenAPI operation object containing request/response details. */\n operation: OperationObject\n /** The API endpoint path (e.g., '/users/{id}'). */\n path: string\n /** Array of security schemes to apply to the request (e.g., API keys, OAuth). */\n securitySchemes: SecuritySchemeObjectSecret[]\n /** The server object defining the base URL for the API request. */\n server: ServerObject | null\n /** Workspace + document cookies */\n globalCookies?: XScalarCookie[]\n /** Whether to include default headers (e.g., Accept, Content-Type) automatically. */\n includeDefaultHeaders?: boolean\n /** Selected oneOf/anyOf variants for nested request body example generation. */\n /** Originating OpenAPI version, used for XML mapping rules. */\n openapiVersion?: string\n jsonSchemaDialect?: string\n multipartNaming?: MultipartNaming\n requestBodyCompositionSelection?: Record<string, number>\n /** Whether to disable parameters by default. */\n defaultDisabledParameters?: boolean\n}\n\n/** Generate the code snippet for the selected example OR operation, or null when a linked sample is unavailable. */\nexport const generateCodeSnippet = ({\n clientId,\n customCodeSamples,\n includeDefaultHeaders = false,\n operation,\n method,\n path,\n example,\n contentType,\n server,\n securitySchemes,\n globalCookies,\n openapiVersion,\n jsonSchemaDialect,\n multipartNaming,\n requestBodyCompositionSelection,\n defaultDisabledParameters,\n}: GenerateCodeSnippetProps): string | null => {\n try {\n if (!clientId) {\n return ''\n }\n\n // Use the selected custom example, matched by its language-keyed id\n if (clientId.startsWith('custom')) {\n const ids = getCustomClientIds(customCodeSamples)\n const samples = customCodeSamples.filter((_, index) => ids[index] === clientId)\n if (!samples.some((sample) => sample.example !== undefined)) {\n const source = samples[0]?.source\n return typeof source === 'object' ? null : (source ?? 'Custom example not found')\n }\n\n const content = getResolvedRef(operation.requestBody)?.content ?? {}\n const mediaType = contentType ?? Object.keys(content)[0]\n const exampleKey = example ?? Object.keys(content[mediaType ?? '']?.examples ?? {})[0]\n const sample =\n samples.find((sample) => sample.example === exampleKey && sample.contentType === mediaType) ??\n samples.find((sample) => sample.example === exampleKey && sample.contentType === undefined)\n return typeof sample?.source === 'string' ? sample.source : null\n }\n\n const harRequest = operationToHar({\n operation,\n contentType,\n method,\n path,\n server,\n securitySchemes,\n example,\n globalCookies,\n includeDefaultHeaders,\n openapiVersion,\n jsonSchemaDialect,\n multipartNaming,\n requestBodyCompositionSelection,\n defaultDisabledParameters,\n })\n\n const [targetKey, clientKey] = clientId.split('/') as [TargetId, ClientId<TargetId>]\n\n const [error, payload] = getSnippet(targetKey, clientKey, harRequest)\n if (error) {\n console.error('[generateCodeSnippet]', error)\n return error.message ?? 'Error generating code snippet'\n }\n\n return payload\n } catch (error) {\n console.error('[generateCodeSnippet]', error)\n return error instanceof CookieSerializationError ? error.message : 'Error generating code snippet'\n }\n}\n"],"mappings":";;;;;;AA+CA,IAAaA,KAAuB,EAClC,a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U;CACrE;AACF"}
|
|
1
|
+
{"version":3,"file":"generate-code-snippet.js","names":["getCustomClientIds","getSnippet","operationToHar","CookieSerializationError","getResolvedRef","encode","isBasicAuthScheme","scheme","credentialMask","basicAuthPlaceholders","placeholderPair","createPreviewAuth","content","auth","usernamePrefix","marker","suffix","username","password","token","generateSnippet","clientId","customCodeSamples","includeDefaultHeaders","operation","method","path","example","contentType","server","securitySchemes","globalCookies","openapiVersion","jsonSchemaDialect","multipartNaming","requestBodyCompositionSelection","defaultDisabledParameters","includePreview","ids","samples","_","index","sample","source","mediaType","exampleKey","basicScheme","hasCredentials","configuration","harRequest","targetKey","clientKey","hasAuthorizationHeader","name","error","previewAuth","preview","displayContent","usernameDisplay","generateCodeSnippet","props","generateCodeSnippetWithPreview"],"sources":["../../../src/code-example/helpers/generate-code-snippet.ts"],"sourcesContent":["import type { AvailableClient, ClientId, PluginConfiguration, TargetId } from '@scalar/snippetz'\nimport type { MultipartNaming } from '@scalar/types/api-reference'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type { SecuritySchemeObjectSecret } from '@scalar/workspace-store/request-example'\nimport type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies'\nimport type { XCodeSample } from '@scalar/workspace-store/schemas/extensions/operation'\nimport type { OperationObject, ServerObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { encode } from 'js-base64'\n\nimport { type CustomCodeSampleId, getCustomClientIds } from './generate-client-options'\nimport { getSnippet } from './get-snippet'\nimport { operationToHar } from './operation-to-har/operation-to-har'\nimport { CookieSerializationError } from './operation-to-har/process-parameters'\n\ntype GenerateCodeSnippetProps = {\n /** The selected client/language for code generation (e.g., 'node/fetch') or a custom code sample ID. */\n clientId: AvailableClient | CustomCodeSampleId | undefined\n /** The Content-Type header value for the request body (e.g., 'application/json'). */\n contentType: string | undefined\n /** Array of custom code samples defined in the OpenAPI x-codeSamples extension. */\n customCodeSamples: XCodeSample[]\n /** The specific example value to use when generating the code snippet. */\n example: string | undefined\n /** The HTTP method for the operation (e.g., GET, POST, PUT). */\n method: string\n /** The OpenAPI operation object containing request/response details. */\n operation: OperationObject\n /** The API endpoint path (e.g., '/users/{id}'). */\n path: string\n /** Array of security schemes to apply to the request (e.g., API keys, OAuth). */\n securitySchemes: SecuritySchemeObjectSecret[]\n /** The server object defining the base URL for the API request. */\n server: ServerObject | null\n /** Workspace + document cookies */\n globalCookies?: XScalarCookie[]\n /** Whether to include default headers (e.g., Accept, Content-Type) automatically. */\n includeDefaultHeaders?: boolean\n /** Selected oneOf/anyOf variants for nested request body example generation. */\n /** Originating OpenAPI version, used for XML mapping rules. */\n openapiVersion?: string\n jsonSchemaDialect?: string\n multipartNaming?: MultipartNaming\n requestBodyCompositionSelection?: Record<string, number>\n /** Whether to disable parameters by default. */\n defaultDisabledParameters?: boolean\n}\n\ntype GeneratedSnippet = { content: string | null; displayContent?: string }\ntype BasicAuth = NonNullable<PluginConfiguration['auth']>\n\nconst isBasicAuthScheme = (\n scheme: SecuritySchemeObjectSecret,\n): scheme is Extract<SecuritySchemeObjectSecret, { type: 'http' }> & { scheme: 'basic' } =>\n scheme.type === 'http' && scheme.scheme === 'basic'\n\nconst credentialMask = '••••••••'\nconst basicAuthPlaceholders = { username: 'username', password: 'password' }\nconst placeholderPair = `${basicAuthPlaceholders.username}:${basicAuthPlaceholders.password}`\n\n/** Find synthetic credentials whose literal and encoded forms cannot match authored snippet content. */\nconst createPreviewAuth = (content: string, auth: BasicAuth): { auth: BasicAuth; token: string } => {\n // Keep Unicode usernames on the same serialization path as the original.\n const usernamePrefix = /\\P{ASCII}/u.test(auth.username) ? 'é' : ''\n let marker = '_SCALAR_BASIC_'\n let suffix = 1\n while (true) {\n const username = auth.username ? `${usernamePrefix}${marker}USER_` : ''\n const password = auth.password ? `${marker}PASSWORD_` : ''\n const token = encode(`${username}:${password}`)\n if (!content.includes(marker) && !content.includes(token)) {\n return { auth: { username, password }, token }\n }\n marker = `_SCALAR_BASIC_${suffix++}_`\n }\n}\n\nconst generateSnippet = (\n {\n clientId,\n customCodeSamples,\n includeDefaultHeaders = false,\n operation,\n method,\n path,\n example,\n contentType,\n server,\n securitySchemes,\n globalCookies,\n openapiVersion,\n jsonSchemaDialect,\n multipartNaming,\n requestBodyCompositionSelection,\n defaultDisabledParameters,\n }: GenerateCodeSnippetProps,\n includePreview: boolean,\n): GeneratedSnippet => {\n try {\n if (!clientId) {\n return { content: '' }\n }\n\n // Use the selected custom example, matched by its language-keyed id\n if (clientId.startsWith('custom')) {\n const ids = getCustomClientIds(customCodeSamples)\n const samples = customCodeSamples.filter((_, index) => ids[index] === clientId)\n if (!samples.some((sample) => sample.example !== undefined)) {\n const source = samples[0]?.source\n return { content: typeof source === 'object' ? null : (source ?? 'Custom example not found') }\n }\n\n const content = getResolvedRef(operation.requestBody)?.content ?? {}\n const mediaType = contentType ?? Object.keys(content)[0]\n const exampleKey = example ?? Object.keys(content[mediaType ?? '']?.examples ?? {})[0]\n const sample =\n samples.find((sample) => sample.example === exampleKey && sample.contentType === mediaType) ??\n samples.find((sample) => sample.example === exampleKey && sample.contentType === undefined)\n return { content: typeof sample?.source === 'string' ? sample.source : null }\n }\n\n const basicScheme = securitySchemes.find(isBasicAuthScheme)\n const username = basicScheme?.['x-scalar-secret-username'] ?? ''\n const password = basicScheme?.['x-scalar-secret-password'] ?? ''\n const hasCredentials = Boolean(username || password)\n const auth = hasCredentials ? { username, password } : basicAuthPlaceholders\n const configuration = basicScheme ? { auth } : undefined\n\n const harRequest = operationToHar({\n operation,\n contentType,\n method,\n path,\n server,\n securitySchemes: basicScheme ? securitySchemes.filter((scheme) => !isBasicAuthScheme(scheme)) : securitySchemes,\n example,\n globalCookies,\n includeDefaultHeaders,\n openapiVersion,\n jsonSchemaDialect,\n multipartNaming,\n requestBodyCompositionSelection,\n defaultDisabledParameters,\n })\n\n const [targetKey, clientKey] = clientId.split('/') as [TargetId, ClientId<TargetId>]\n const hasAuthorizationHeader = harRequest.headers.some(({ name }) => name.toLowerCase() === 'authorization')\n const [error, content] = getSnippet(targetKey, clientKey, harRequest, configuration)\n if (error) {\n console.error('[generateCodeSnippet]', error)\n return { content: error.message }\n }\n\n if (\n !includePreview ||\n !basicScheme ||\n hasAuthorizationHeader ||\n (!hasCredentials && !content.includes(encode(placeholderPair)))\n ) {\n return { content }\n }\n\n // Generate the preview with synthetic credentials so language-specific escaping cannot reveal real values.\n const { auth: previewAuth, token } = createPreviewAuth(content, auth)\n const [, preview] = getSnippet(targetKey, clientKey, harRequest, { auth: previewAuth })\n let displayContent = preview?.replaceAll(token, hasCredentials ? credentialMask : placeholderPair) ?? ''\n if (previewAuth.username) {\n const usernameDisplay = hasCredentials ? credentialMask : basicAuthPlaceholders.username\n displayContent = displayContent\n .replaceAll(encodeURIComponent(previewAuth.username), usernameDisplay)\n .replaceAll(previewAuth.username, usernameDisplay)\n }\n if (previewAuth.password) {\n displayContent = displayContent.replaceAll(\n previewAuth.password,\n hasCredentials ? credentialMask : basicAuthPlaceholders.password,\n )\n }\n return displayContent === content ? { content } : { content, displayContent }\n } catch (error) {\n console.error('[generateCodeSnippet]', error)\n return { content: error instanceof CookieSerializationError ? error.message : 'Error generating code snippet' }\n }\n}\n\n/** Generate runnable source, or null when a linked sample is unavailable. */\nexport const generateCodeSnippet = (props: GenerateCodeSnippetProps): string | null =>\n generateSnippet(props, false).content\n\n/** Provide a masked preview alongside the runnable source when Basic credentials are present. */\nexport const generateCodeSnippetWithPreview = (props: GenerateCodeSnippetProps): GeneratedSnippet =>\n generateSnippet(props, true)\n"],"mappings":";;;;;;;AAkDA,IAAMM,KACJC,MAEAA,EAAO,SAAS,UAAUA,EAAO,WAAW,SAExCC,IAAiB,YACjBC,IAAwB;CAAE,UAAU;CAAY,UAAU;AAAW,GACrEC,IAAkB,GAAGD,EAAsB,SAAS,GAAGA,EAAsB,YAG7EE,KAAqBC,GAAiBC,MAAwD;CAElG,IAAMC,IAAiB,aAAa,KAAKD,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IAAiBC,EAAsB;GAChFgD,IAAiBA,EACd,WAAW,mBAAmBF,EAAY,QAAQ,GAAGG,CAAe,CAAC,CACrE,WAAWH,EAAY,UAAUG,CAAe;EACrD;EAOA,OANIH,EAAY,aACdE,IAAiBA,EAAe,WAC9BF,EAAY,UACZR,IAAiBvC,IAAiBC,EAAsB,QAC1D,IAEKgD,MAAmB7C,IAAU,EAAEA,WAAQ,IAAI;GAAEA;GAAS6C;EAAe;CAC9E,SAASH,GAAO;EAEd,OADA,QAAQ,MAAM,yBAAyBA,CAAK,GACrC,EAAE,SAASA,aAAiBnD,IAA2BmD,EAAM,UAAU,gCAAgC;CAChH;AACF,GAGaK,KAAuBC,MAClCxC,EAAgBwC,GAAO,EAAK,CAAC,CAAC,SAGnBC,KAAkCD,MAC7CxC,EAAgBwC,GAAO,EAAI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-asyncapi-example-context.js","names":["
|
|
1
|
+
{"version":3,"file":"get-asyncapi-example-context.js","names":["getResolvedAsyncApiRef","getAllChannelMessages","resolveOperationChannel","resolveOperationWithTraits","getNameFromRef","resolveTraits","getAsyncApiExampleContext","document","operationName","node","operation","resolved","channel","resolvedMessages","ref","index","message","name"],"sources":["../../../src/code-example/helpers/get-asyncapi-example-context.ts"],"sourcesContent":["import type {\n AsyncApiChannelObject,\n AsyncApiDocument,\n AsyncApiMessageObject,\n AsyncApiOperationObject,\n} from '@scalar/types/asyncapi/3.1'\nimport {\n type ChannelMessageEntry,\n getAllChannelMessages,\n resolveOperationChannel,\n resolveOperationWithTraits,\n} from '@scalar/workspace-store/channel-example'\nimport { getNameFromRef } from '@scalar/workspace-store/helpers/get-name-from-ref'\nimport { getResolvedAsyncApiRef } from '@scalar/workspace-store/helpers/get-resolved-async-api-ref'\nimport { resolveTraits } from '@scalar/workspace-store/helpers/resolve-traits'\n\ntype AsyncApiExampleContext = {\n operation: AsyncApiOperationObject\n channelName: string | undefined\n channel: AsyncApiChannelObject | undefined\n messages: ChannelMessageEntry[]\n}\n\n/** Resolve operation-level samples and only the messages that operation permits. */\nexport const getAsyncApiExampleContext = (\n document: AsyncApiDocument,\n operationName: string,\n): AsyncApiExampleContext | undefined => {\n const node = getResolvedAsyncApiRef(document.operations?.[operationName])\n if (!node) {\n return undefined\n }\n const operation = resolveOperationWithTraits(node)\n const resolved = resolveOperationChannel(document, operation)\n const channel = resolved?.channel\n const messages =\n operation.messages === undefined\n ? channel\n ? getAllChannelMessages(document, channel)\n : []\n : operation.messages.flatMap((ref, index) => {\n const message = getResolvedAsyncApiRef(ref)\n const name =\n ref.$ref && resolved?.channelName\n ? getNameFromRef(ref.$ref, ['channels', resolved.channelName, 'messages'])\n : undefined\n return message && !('$ref' in message) ? [{ name: name ?? ref.$ref ?? String(index), message }] : []\n })\n const resolvedMessages = messages.map(({ name, message }) => ({\n name,\n message: resolveTraits(message, message.traits ?? []) satisfies AsyncApiMessageObject,\n }))\n return { operation, channelName: resolved?.channelName, channel, messages: resolvedMessages }\n}\n"],"mappings":";;;;;AAwBA,IAAaM,KACXC,GACAC,MACuC;CACvC,IAAMC,IAAOT,EAAuBO,EAAS,aAAaC,EAAc;CACxE,IAAI,CAACC,GACH;CAEF,IAAMC,IAAYP,EAA2BM,CAAI,GAC3CE,IAAWT,EAAwBK,GAAUG,CAAS,GACtDE,IAAUD,GAAU,SAcpBE,KAZJH,EAAU,aAAa,KAAA,IACnBE,IACEX,EAAsBM,GAAUK,CAAO,IACvC,CAAC,IACHF,EAAU,SAAS,SAASI,GAAKC,MAAU;EACzC,IAAMC,IAAUhB,EAAuBc,CAAG,GACpCG,IACJH,EAAI,QAAQH,GAAU,cAClBP,EAAeU,EAAI,MAAM;GAAC;GAAYH,EAAS;GAAa;EAAU,CAAC,IACvE,KAAA;EACN,OAAOK,KAAW,EAAE,UAAUA,KAAW,CAAC;GAAE,MAAMC,KAAQH,EAAI,QAAQ,OAAOC,CAAK;GAAGC;EAAQ,CAAC,IAAI,CAAC;CACrG,CAAC,EAAA,CAC2B,KAAK,EAAEC,SAAMD,kBAAe;EAC5DC;EACA,SAASZ,EAAcW,GAASA,EAAQ,UAAU,CAAC,CAAC;CACtD,EAAE;CACF,OAAO;EAAEN;EAAW,aAAaC,GAAU;EAAaC;EAAS,UAAUC;CAAiB;AAC9F"}
|