"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[13],{70013:function(e,r,t){t.r(r),t.d(r,{MermaidDiagram:function(){return l}});var a=t(57437),i=t(2265),s=t(50656);let n={securityLevel:"strict",startOnLoad:!1,theme:"default"},d=!1;function l(e){let{code:r,id:t}=e,[l,c]=(0,i.useState)(""),[m,u]=(0,i.useState)(null),[o,f]=(0,i.useState)(!0),g=(0,i.useRef)(null),h=(0,i.useId)(),p=t||"mermaid-".concat(h.replace(/:/g,"-"));return((0,i.useEffect)(()=>{let e=!0;return(async()=>{f(!0),u(null),c("");let t=(null==r?void 0:r.trim())||"";if(!t){e&&(u("Diagram code is empty"),f(!1));return}try{!function(){if(!d){if("strict"!==n.securityLevel)throw Error("[SECURITY] mermaid securityLevel must be 'strict', but got '".concat(n.securityLevel,"'. ")+"This is a security requirement to prevent XSS attacks.");s.Z.initialize(n),d=!0}}();let{svg:r}=await s.Z.render(p,t);e&&(c(r),f(!1))}catch(r){e&&(u(r instanceof Error?r.message:"Failed to render diagram"),f(!1))}})(),()=>{e=!1}},[r,p]),o)?(0,a.jsx)("div",{"data-testid":"mermaid-loading",className:"flex items-center justify-center p-4 text-gray-500",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"inline-block animate-spin rounded-full h-4 w-4 border-2 border-gray-300 border-t-blue-600"}),(0,a.jsx)("span",{children:"Rendering diagram..."})]})}):m?(0,a.jsxs)("div",{"data-testid":"mermaid-error",className:"bg-red-50 border border-red-200 p-4 rounded",children:[(0,a.jsx)("p",{className:"text-red-600 font-medium",children:"Diagram Error"}),(0,a.jsx)("pre",{className:"text-sm text-red-500 mt-2 whitespace-pre-wrap break-words bg-red-50",children:m})]}):(0,a.jsx)("div",{ref:g,"data-testid":"mermaid-container",className:"mermaid-container max-w-full overflow-x-auto",dangerouslySetInnerHTML:{__html:l}})}}}]);