"use strict";var __rest=this&&this.__rest||function(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(r[a[o]]=e[a[o]])}return r};Object.defineProperty(exports,"__esModule",{value:!0}),exports.PayloadSamples=void 0;const jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),jotai_1=require("jotai"),SelectOrLabel_1=require("../SelectOrLabel"),MediaTypeSwitch_1=require("../MediaTypeSwitch"),common_1=require("../common"),MediaTypeSamples_1=require("./MediaTypeSamples"),styled_1=require("./styled"),app_1=require("../../jotai/app"),hooks_1=require("../../hooks");function PayloadSamplesComponent(e){var{onlyDefaultMimeType:t,content:r}=e,a=__rest(e,["onlyDefaultMimeType","content"]);const o=(0,hooks_1.useActivateExample)(r),l=(0,jotai_1.useAtomValue)(app_1.activeMimeNameAtom),i=t&&l,s=(0,react_1.useCallback)((e=>i?null:(0,jsx_runtime_1.jsx)(styled_1.SelectWrapper,{children:(0,jsx_runtime_1.jsx)(SelectOrLabel_1.SelectOrLabel,Object.assign({Label:common_1.MimeLabel,Select:common_1.Select,variant:"dark",fullWidth:!0},e))})),[i]),n=e=>o(e);return r?(0,jsx_runtime_1.jsx)(MediaTypeSwitch_1.MediaTypesSwitch,{content:r,renderSelect:s,children:e=>(0,jsx_runtime_1.jsx)(MediaTypeSamples_1.MediaTypeSamples,Object.assign({mediaType:e},a,{onChange:n}),"samples")}):(0,jsx_runtime_1.jsx)(styled_1.StyledCodeBlock,{lang:"text",source:"No request payload",header:{controls:!1}})}exports.PayloadSamples=(0,react_1.memo)(PayloadSamplesComponent);
//# sourceMappingURL=PayloadSamples.js.map