var __rest=this&&this.__rest||function(e,t){var o={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(o[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(o[a[r]]=e[a[r]])}return o};import{jsx as _jsx}from"react/jsx-runtime";import{memo,useCallback}from"react";import{useAtomValue}from"jotai";import{SelectOrLabel}from"../SelectOrLabel";import{MediaTypesSwitch}from"../MediaTypeSwitch";import{MimeLabel,Select}from"../common";import{MediaTypeSamples}from"./MediaTypeSamples";import{SelectWrapper,StyledCodeBlock}from"./styled";import{activeMimeNameAtom}from"../../jotai/app";import{useActivateExample}from"../../hooks";function PayloadSamplesComponent(e){var{onlyDefaultMimeType:t,content:o}=e,a=__rest(e,["onlyDefaultMimeType","content"]);const r=useActivateExample(o),l=useAtomValue(activeMimeNameAtom),m=t&&l,i=useCallback((e=>m?null:_jsx(SelectWrapper,{children:_jsx(SelectOrLabel,Object.assign({Label:MimeLabel,Select:Select,variant:"dark",fullWidth:!0},e))})),[m]),p=e=>r(e);return o?_jsx(MediaTypesSwitch,{content:o,renderSelect:i,children:e=>_jsx(MediaTypeSamples,Object.assign({mediaType:e},a,{onChange:p}),"samples")}):_jsx(StyledCodeBlock,{lang:"text",source:"No request payload",header:{controls:!1}})}export const PayloadSamples=memo(PayloadSamplesComponent);
//# sourceMappingURL=PayloadSamples.js.map