import{jsx as e,jsxs as o,Fragment as T}from"react/jsx-runtime";import{memo as j,useMemo as k}from"react";import{useAtomValue as A}from"jotai";import{Title as P}from"../common/OperationItemTitle.js";import{LinkToField as y}from"../common/LinkToField.js";import{makeDeepLink as D}from"../../services/index.js";import{Description as E}from"../OperationItem/Description.js";import{Security as F}from"../Security/index.js";import{hasNestedFields as M}from"../../utils/index.js";import{ExpandAllButton as N}from"../ExpandAllButton/index.js";import{RequestParameters as b}from"../RequestParameters/index.js";import{activeMimeNameAtom as C}from"../../jotai/app.js";import{getActiveMediaType as _}from"../../models/mediaContent.js";import{styled as n}from"../../styled-components.js";import{Extensions as w}from"../common/Extensions.js";function I({operation:{id:i,description:s,externalDocs:m,parameters:r,requestBody:t,pointer:u,security:f,extensions:a,callbackId:d},title:x,translate:h,onPanelToggle:g}){const p=A(C),v=k(()=>{const c=r.some(({schema:l})=>!l.isPrimitive&&!l.isCircular);if(!t?.content||c)return c;const{schema:R}=_(t.content,p)||{};return M(R)},[p,r,t?.content]),q=Object.keys(a||{}).length>0;return o(T,{children:[o(L,{children:[o(H,{children:[o(O,{children:[i&&e(y,{to:D(i,"request")}),x||h?.("openapi.request","Request"),v&&e(N,{operationPointer:u,type:"request",onPanelToggle:g})]}),e(E,{description:s||m?s:void 0,externalDocs:m})]}),q&&e(w,{extensions:a}),e(F,{securities:f})]}),e(b,{parameters:r,body:t,operationId:i,callbackId:d})]})}const L=n.div`
  width: 100%;
`,H=n.div`
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
`,O=n(P)`
  margin: 0;
`,te=j(I);export{te as RequestDetails};
