import{j as e,r as O}from"./@radix-C7hRs6Kx.js";import{a as o,c as d,i as p}from"./type-guards-CaeD8wHO.js";import{m,h as T,a5 as S,T as w,E as V,G as k,H as A,Y as E}from"./index-D2iSHVZq.js";import{C as J}from"./CodeSnippet-CvI6D0wx.js";import{C as u}from"./CollapsibleCard-D20FtrzC.js";import{S as K}from"./check-circle-mvyzYvIW.js";function R({children:s,className:t,...i}){return e.jsx("dt",{...i,className:m("col-span-1 flex min-w-0 items-center truncate text-theme-text-secondary",t),children:s})}function B({children:s,className:t,...i}){return e.jsx("dd",{...i,className:m("col-span-2 flex h-6 w-full min-w-0 items-center truncate text-neutral-700",t),children:s})}function F({label:s,value:t}){return e.jsxs(e.Fragment,{children:[e.jsx(R,{children:s}),e.jsx(B,{children:t})]})}function v(){return e.jsx("div",{className:"text-theme-text-tertiary",children:"Not available"})}function z(){const[s,t]=O.useState(!1);function i(l){navigator.clipboard&&(navigator.clipboard.writeText(l),t(!0),setTimeout(()=>{t(!1)},2e3))}return{copied:s,copyToClipboard:i}}function g({copyText:s,className:t,...i}){const{copyToClipboard:l,copied:r}=z();return e.jsxs(T,{size:"sm",className:m("flex items-center gap-1 bg-theme-surface-primary",t),intent:"secondary",emphasis:"subtle",onClick:()=>l(s),...i,children:[r?e.jsx(K,{width:16,height:16,className:"shrink-0 fill-neutral-500"}):e.jsx(S,{width:16,height:16,className:"shrink-0 fill-neutral-500"}),r?"Copied":e.jsx("span",{children:"Copy"})]})}const D=/^<class\s+'.*'>$/;function y({title:s,data:t,intent:i="primary",isInitialOpen:l=!1,contentClassName:r,children:c,className:N}){const x={},h={},j={};for(const[n,a]of Object.entries(t||{}))p(a)?x[n]=a:d(a)?j[n]=a:h[n]=a;const f=Object.entries(h);f.sort((n,a)=>n[0].localeCompare(a[0]));const b=Object.keys(t||{}).length===0;return e.jsxs(u,{contentClassName:r,className:N,initialOpen:l,intent:i,title:s,headerClassName:"flex items-center gap-2",headerChildren:b?null:e.jsx(g,{copyText:JSON.stringify(t)}),children:[Object.keys(t||{}).length===0?e.jsx(v,{}):e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("dl",{className:"grid grid-cols-1 gap-x-[10px] gap-y-2 md:grid-cols-3 md:gap-y-4",children:f.map(([n,a])=>e.jsx(F,{label:e.jsx(w,{children:e.jsxs(V,{children:[e.jsx(k,{className:"cursor-default truncate",children:n}),e.jsx(A,{className:"max-w-[480px]",children:n})]})}),value:e.jsx(C,{value:a})},n))}),Object.entries(j).map(([n,a])=>e.jsx(G,{title:n,value:a},n)),Object.entries(x).map(([n,a])=>e.jsx(y,{intent:"secondary",title:n,data:a},n))]}),c]})}function G({title:s,value:t}){const i=t.filter(r=>!d(r)&&!p(r)||r===null),l=t.filter(r=>d(r)||p(r));return e.jsx(e.Fragment,{children:e.jsxs(u,{headerClassName:"flex items-center gap-2",headerChildren:e.jsx(g,{copyText:JSON.stringify(t)}),intent:"secondary",title:s,children:[i.length>0&&e.jsx("ul",{className:"space-y-2 md:space-y-4",children:i.map((r,c)=>e.jsx("li",{children:e.jsx(C,{value:r})},c))}),l.length>0&&e.jsx("ul",{className:"space-y-4",children:l.map((r,c)=>e.jsx("li",{children:e.jsx(y,{intent:"secondary",title:c,data:r},c)},c))})]},s)})}function C({value:s}){return o(s)&&D.test(s)?e.jsx(J,{className:"py-1",highlightCode:!0,code:s}):s===null?e.jsx("div",{children:"null"}):o(s)&&E(s)?e.jsx("a",{className:"underline transition-all duration-200 hover:decoration-transparent",href:s,target:"_blank",rel:"noopener noreferrer",children:s}):e.jsx("div",{className:"whitespace-normal",children:o(s)?s:JSON.stringify(s)})}export{g as C,F as K,y as N,B as V,R as a,v as b};
