import{jsx as t}from"react/jsx-runtime";import{memo as c,useCallback as d}from"react";import{useAtomValue as u}from"jotai";import{SelectOrLabel as f}from"../SelectOrLabel/index.js";import{MediaTypesSwitch as y}from"../MediaTypeSwitch/index.js";import{MimeLabel as S,Select as h}from"../common/index.js";import{MediaTypeSamples as M}from"./MediaTypeSamples.js";import{SelectWrapper as T,StyledCodeBlock as x}from"./styled.js";import{activeMimeNameAtom as b}from"../../jotai/app.js";import{useActivateExample as v,useTranslate as A}from"../../hooks/index.js";function g({onlyDefaultMimeType:r,content:o,...l}){const m=v(o),n=u(b),a=r&&n,p=A(),s=d(e=>a?null:t(T,{children:t(f,{Label:S,Select:h,variant:"dark",fullWidth:!0,...e})}),[a]),i=e=>m(e);return o?t(y,{content:o,renderSelect:s,children:e=>t(M,{mediaType:e,...l,onChange:i},"samples")}):t(x,{lang:"text",source:p("openapi.noRequestPayload","No request payload"),header:{controls:!1}})}const B=c(g);export{B as PayloadSamples};
