import{jsx as r,Fragment as f,jsxs as y}from"react/jsx-runtime";import{memo as d}from"react";import u from"deepmerge";import{Markdown as h}from"../Markdown/index.js";import{Example as j}from"./Example.js";import{ExampleSwitch as k,useExampleKey as E}from"../Samples/index.js";import{arrayMergeStrategy as M}from"../../services/utils.js";import{StyledCodeBlock as S}from"./styled.js";import{useTranslate as v}from"../../hooks/index.js";import{styled as C}from"../../styled-components.js";function K({mediaType:o,properties:a,onChange:l,onCopyClick:c,onPanelToggle:i}){const e=o.examples||o.formExamples||{},x=o.name,s=Object.keys(e),g=v(),{exampleKey:n}=E(o.operation,e),m=s.length===1?Object.values(e)[0]:e[n];if(!s.length)return r(S,{lang:"clike",source:g("openapi.noResponseExample","No response example"),header:{controls:!1}});const t=a?{...m,value:u(m.value,a,{arrayMerge:M})}:m,p=t.description;return y(f,{children:[r(k,{examples:e,exampleKey:n,onChange:l}),p&&r(w,{source:p}),r(j,{example:t,mimeType:x,onCopyClick:c,onPanelToggle:i})]})}const w=C(h)`
  margin: 0 var(--spacing-md) var(--spacing-sm);
`,z=d(K);export{z as MediaTypeSamples};
