import{s as j}from"./chunk-LvLJmgfZ.js";import{t as y}from"./react-Bj1aDYRI.js";import{t as N}from"./compiler-runtime-B3qBwwSJ.js";import{m as _}from"./useEventListener-CjXriKgk.js";import{t as C}from"./jsx-runtime-CP2fAiZX.js";import{n as S,t as O}from"./cn-d_A4rA-x.js";import{a as E,c as F,i as V,l as A,n as D,s as T,t as q}from"./alert-dialog-DsNfSYaw.js";import{r as z}from"./errors-Bfogio62.js";var g=N(),B=j(y(),1),r=j(C(),1);const G=b=>{let e=(0,g.c)(23),{error:l,className:t,action:a}=b,[n,c]=(0,B.useState)(!1);if(!l)return null;_.error(l);let s;e[0]===l?s=e[1]:(s=z(l),e[0]=l,e[1]=s);let o=s,f;e[2]===Symbol.for("react.memo_cache_sentinel")?(f=()=>c(!0),e[2]=f):f=e[2];let i;e[3]===o?i=e[4]:(i=(0,r.jsx)("span",{className:"line-clamp-4",children:o}),e[3]=o,e[4]=i);let d;e[5]===a?d=e[6]:(d=a&&(0,r.jsx)("div",{className:"flex justify-end",children:a}),e[5]=a,e[6]=d);let m;e[7]!==t||e[8]!==i||e[9]!==d?(m=(0,r.jsxs)(v,{kind:"danger",className:t,clickable:!0,onClick:f,children:[i,d]}),e[7]=t,e[8]=i,e[9]=d,e[10]=m):m=e[10];let k;e[11]===Symbol.for("react.memo_cache_sentinel")?(k=(0,r.jsx)(F,{children:(0,r.jsx)(A,{className:"text-error",children:"Error"})}),e[11]=k):k=e[11];let h;e[12]===o?h=e[13]:(h=(0,r.jsx)(E,{asChild:!0,className:"text-error text-sm p-2 font-mono overflow-auto whitespace-pre-wrap",children:(0,r.jsx)("pre",{children:o})}),e[12]=o,e[13]=h);let w;e[14]===Symbol.for("react.memo_cache_sentinel")?(w=(0,r.jsx)(T,{children:(0,r.jsx)(D,{autoFocus:!0,onClick:()=>c(!1),children:"Ok"})}),e[14]=w):w=e[14];let x;e[15]===h?x=e[16]:(x=(0,r.jsxs)(V,{className:"max-w-[80%] max-h-[80%] overflow-hidden flex flex-col",children:[k,h,w]}),e[15]=h,e[16]=x);let p;e[17]!==n||e[18]!==x?(p=(0,r.jsx)(q,{open:n,onOpenChange:c,children:x}),e[17]=n,e[18]=x,e[19]=p):p=e[19];let u;return e[20]!==p||e[21]!==m?(u=(0,r.jsxs)(r.Fragment,{children:[m,p]}),e[20]=p,e[21]=m,e[22]=u):u=e[22],u};var H=S("text-sm p-2 border whitespace-pre-wrap overflow-hidden",{variants:{kind:{danger:"text-error border-(--red-6) shadow-md-solid shadow-error bg-(--red-1)",info:"text-primary border-(--blue-6) shadow-md-solid shadow-accent bg-(--blue-1)",warn:"border-(--yellow-6) bg-(--yellow-2) dark:bg-(--yellow-4) text-(--yellow-11) dark:text-(--yellow-12)"},clickable:{true:"cursor-pointer"}},compoundVariants:[{clickable:!0,kind:"danger",className:"hover:bg-(--red-3)"},{clickable:!0,kind:"info",className:"hover:bg-(--blue-3)"},{clickable:!0,kind:"warn",className:"hover:bg-(--yellow-3)"}],defaultVariants:{kind:"info"}});const v=b=>{let e=(0,g.c)(14),l,t,a,n,c;e[0]===b?(l=e[1],t=e[2],a=e[3],n=e[4],c=e[5]):({kind:n,clickable:a,className:t,children:l,...c}=b,e[0]=b,e[1]=l,e[2]=t,e[3]=a,e[4]=n,e[5]=c);let s;e[6]!==t||e[7]!==a||e[8]!==n?(s=O(H({kind:n,clickable:a}),t),e[6]=t,e[7]=a,e[8]=n,e[9]=s):s=e[9];let o;return e[10]!==l||e[11]!==c||e[12]!==s?(o=(0,r.jsx)("div",{className:s,...c,children:l}),e[10]=l,e[11]=c,e[12]=s,e[13]=o):o=e[13],o};export{G as n,v as t};
