import{u as h,r as t,j as e}from"./index-gnHkq9KV.js";import{c as x}from"./CopyButton-CwvIhVJc.js";function C({open:d,title:p,subtitle:o,id:n,data:i,onClose:a}){const{t:s}=h(),[c,l]=t.useState(!1),r=typeof i=="string"?i:JSON.stringify(i,null,2),j=t.useCallback(()=>{x(r).then(()=>{l(!0),setTimeout(()=>l(!1),2e3)}).catch(()=>{})},[r]);return d?e.jsx("div",{className:"json-viewer-overlay",onClick:a,children:e.jsxs("div",{className:"json-viewer-modal",onClick:m=>m.stopPropagation(),children:[e.jsxs("div",{className:"json-viewer-header",children:[e.jsx("h3",{children:s(p)}),e.jsx("button",{className:"json-viewer-close",onClick:a,title:s("Close"),"aria-label":s("Close"),children:"×"})]}),(o||n)&&e.jsxs("div",{className:"json-viewer-sub",children:[n&&e.jsx("span",{className:"mono",children:n}),o&&e.jsx("span",{className:"text-dim",children:s(o)})]}),e.jsxs("div",{className:"json-viewer-body",children:[e.jsx("button",{className:`json-viewer-copy btn btn-sm${c?" copied":""}`,onClick:j,children:s(c?"Copied!":"Copy")}),e.jsx("pre",{"data-i18n-skip":"true",children:r})]})]})}):null}export{C as J};
