import{aJ as e,r as x}from"./@ui-core-DKdciH1Z.js";import{B as C,l as F,a1 as b,a2 as w,a3 as O,a5 as S,ad as o,ae as J,bs as m,ac as p}from"./index-D7KLAbvI.js";import{S as _}from"./eye-off-T0xdenj_.js";import{S as z}from"./eye-0EFEzbgA.js";import{c as T}from"./CollapsibleCard-3zV5aMxC.js";import{C as H}from"./CodeSnippet-Dwuwo3ZI.js";function M(){return e.jsx("div",{className:"text-theme-text-tertiary",children:"Not available"})}const N="fill-neutral-500 shrink-0",P=10;function q({value:s}){const[a,i]=x.useState(!1);return e.jsxs("div",{className:"flex min-w-0 items-center gap-0.5 whitespace-normal",children:[e.jsx(C,{intent:"secondary",emphasis:"minimal",onClick:()=>i(l=>!l),className:"flex aspect-square size-6 items-center justify-center",children:a?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"sr-only",children:"Hide value"}),e.jsx(_,{width:24,height:24,className:N})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"sr-only",children:"Show value"}),e.jsx(z,{width:24,height:24,className:N})]})}),a?e.jsx(v,{value:s}):e.jsx("p",{className:"min-w-0",children:"•".repeat(Math.min(s.length,P))})]})}function v({value:s}){const{copied:a,copyToClipboard:i}=F(),l=x.useRef(null);return e.jsx(b,{children:e.jsxs(w,{delayDuration:200,children:[e.jsx(O,{onClick:t=>{t.preventDefault(),i(s)},asChild:!0,children:e.jsx(C,{intent:"secondary",className:"block min-w-0 max-w-full truncate text-text-md font-medium",emphasis:"minimal",ref:l,children:s})}),e.jsx(S,{onPointerDownOutside:t=>{t.currentTarget===l.current&&t.preventDefault()},className:"z-50 rounded-md bg-theme-text-primary px-3 py-2 text-text-xs text-theme-text-negative shadow-lg",sideOffset:5,children:a?"Copied!":"Copy to Clipboard"})]})})}const G=/^<class\s+'.*'>$/;function V({title:s,schema:a,data:i,intent:l="primary",contentClassName:t,className:c,children:E,isInitialOpen:R=!1,sortKeysAlphabetically:k=!0,headerChildren:A}){const h={},j={},f={};for(const[r,n]of Object.entries(i||{}))p(n)?h[r]=n:m(n)?f[r]=n:j[r]=n;const u=Object.entries(j);k&&u.sort((r,n)=>r[0].localeCompare(n[0]));const g=Object.keys(i||{}).length===0;return e.jsxs(T,{headerChildren:A,contentClassName:t,initialOpen:R,intent:l,title:s,className:c,copyText:JSON.stringify(i),displayCopyButton:!g,children:[g?e.jsx(M,{}):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:u.map(([r,n])=>{const d=a?.properties?.[r],y=d?.title||r,B=d?.sensitive||d?.format==="password"||!1;return e.jsxs(x.Fragment,{children:[e.jsx("dt",{className:"col-span-1 flex items-start text-theme-text-secondary",children:e.jsx(b,{children:e.jsxs(w,{children:[e.jsx(O,{className:"cursor-default truncate",children:y}),e.jsx(S,{className:"max-w-[480px]",children:y})]})})}),e.jsx("dd",{className:"col-span-2 w-full truncate text-neutral-700",children:B&&o(n)?e.jsx(q,{value:n}):e.jsx(D,{value:n})})]},r)})}),Object.entries(f).map(([r,n])=>e.jsx(L,{title:r,value:n},r)),Object.entries(h).map(([r,n])=>e.jsx(V,{intent:"secondary",title:r,data:n},r))]}),E]})}function D({value:s}){return o(s)&&G.test(s)?e.jsx(H,{highlightCode:!0,code:s}):s===null?e.jsx("div",{children:"null"}):o(s)&&J(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)})}function L({title:s,value:a}){const i=a.filter(t=>!m(t)&&!p(t)||t===null),l=a.filter(t=>m(t)||p(t));return e.jsx(e.Fragment,{children:e.jsxs(T,{copyText:JSON.stringify(a),intent:"secondary",title:s,children:[i.length>0&&e.jsx("ul",{className:"space-y-2 md:space-y-4",children:i.map((t,c)=>e.jsx("li",{children:e.jsx(D,{value:t})},c))}),l.length>0&&e.jsx("ul",{className:"space-y-4",children:l.map((t,c)=>e.jsx("li",{children:e.jsx(V,{intent:"secondary",title:c,data:t},c)},c))})]},s)})}export{V as N,M as a};
