"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.MediaTypeSamples=void 0;const jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),deepmerge_1=__importDefault(require("deepmerge")),styled_components_1=__importDefault(require("styled-components")),Markdown_1=require("../Markdown"),Example_1=require("./Example"),Samples_1=require("../Samples"),utils_1=require("../../services/utils"),styled_1=require("./styled");function MediaTypeSamplesComponent({mediaType:e,properties:r,onChange:t,onCopyClick:s}){const a=e.examples||e.formExamples||{},n=e.name,l=Object.keys(a),{exampleKey:i}=(0,Samples_1.useExampleKey)(e.operation,a),o=1===l.length?Object.values(a)[0]:a[i];if(!l.length)return(0,jsx_runtime_1.jsx)(styled_1.StyledCodeBlock,{lang:"clike",source:"No response example",header:{controls:!1}});const m=r?Object.assign(Object.assign({},o),{value:(0,deepmerge_1.default)(o.value,r,{arrayMerge:utils_1.arrayMergeStrategy})}):o,p=m.description;return(0,jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment,{children:[(0,jsx_runtime_1.jsx)(Samples_1.ExampleSwitch,{examples:a,exampleKey:i,onChange:t}),p&&(0,jsx_runtime_1.jsx)(StyledMarkdown,{source:p}),(0,jsx_runtime_1.jsx)(Example_1.Example,{example:m,mimeType:n,onCopyClick:s})]})}const StyledMarkdown=(0,styled_components_1.default)(Markdown_1.Markdown)`
  margin: 0 var(--spacing-md) var(--spacing-sm);
`;exports.MediaTypeSamples=(0,react_1.memo)(MediaTypeSamplesComponent);
//# sourceMappingURL=MediaTypeSamples.js.map