import{convertSampleToString as p}from"@redocly/openapi-docs/lib/services/code-samples/convertSampleToString.js";import{langFromMime as r}from"@redocly/openapi-docs/lib/utils/openapi.js";import{getExampleValueByMimeType as c}from"@redocly/openapi-docs/lib/services/code-samples/get-example-value-by-mime-type.js";function d(o,t,l){const a=[];if(!o?.hasSample)return a;for(const e of o.mediaTypes??[]){const n=e.examples||e.formExamples||{},m=Object.keys(n);if(!m.length)continue;const s=m.length===1?n[m[0]]:t&&n[t]||n[m[0]],i=p(s.value,e.name,e.schema);i!==void 0&&a.push({lang:r(e.name),title:`${l} ${e.name}`,source:c(i,e.name,s.encoding)})}return a}export{d as getMediaContentSamples};
