(()=>{function e(e,t){const n=document.getElementById(e);if(!n)return;const i="string"==typeof t.code?t.code:null;if(!i)return void(n.innerHTML='<p style="color:#c00;padding:12px">No chart code found.</p>');const o=window.vizD3Renderer&&window.vizD3Renderer.iframeJsUrl?window.vizD3Renderer.iframeJsUrl:null;function r(){const r=n.offsetWidth||800,d=n.offsetHeight||400,s='<!DOCTYPE html><html><head><meta charset="utf-8"><style>*{margin:0;padding:0;box-sizing:border-box}body{overflow:hidden}#chart{width:100%;height:100vh}</style></head><body><div id="chart"></div><script src="'+o+'"><\/script></body></html>',c=document.createElement("iframe");c.setAttribute("sandbox","allow-scripts"),c.setAttribute("srcdoc",s),c.setAttribute("data-viz-id",e),c.style.cssText="border:0;width:"+r+"px;height:"+d+"px;display:block;",window.addEventListener("message",(function e(n){if(n.source!==c.contentWindow)return;const o=n.data;o&&"iframe-ready"===o.type&&(window.removeEventListener("message",e),c.contentWindow.postMessage({type:"render",code:i,series:t.series,data:t.data},"*"))})),n.innerHTML="",n.appendChild(c)}o?requestAnimationFrame((()=>requestAnimationFrame(r))):n.innerHTML='<p style="color:#c00;padding:12px">D3 renderer iframe URL not configured.</p>'}var t;(t=jQuery)("body").on("visualizer:render:chart:start",(function(t,n){if(n.charts)if(n.id){const t=n.charts[n.id];t&&"d3"===t.library&&e(n.id,t)}else Object.keys(n.charts).forEach((t=>{const i=n.charts[t];i&&"d3"===i.library&&e(t,i)}))})),t("body").on("visualizer:action:specificchart",(function(e,t){"image"!==t.action&&"print"!==t.action||function(e,t,n){const i=document.getElementById(e);if(!i)return;const o=i.querySelector("iframe[data-viz-id]");o&&o.contentWindow&&(window.addEventListener("message",(function e(i){if(i.source!==o.contentWindow)return;const r=i.data;if(!r||"export-image-result"!==r.type)return;window.removeEventListener("message",e);const d=r.dataUrl;if(d)if("print"===n){const e=window.open();e.document.write("<br><img src='"+d+"'/>"),e.document.close(),e.onload=function(){e.print(),setTimeout(e.close,500)}}else!function(e,t){const n=document.createElement("a");n.href=e,n.download=function(e){return e?e.toLowerCase().endsWith(".png")?e:`${e}.png`:"chart.png"}(t),document.body.appendChild(n),n.click(),n.remove()}(d,t)})),o.contentWindow.postMessage({type:"export-image"},"*"))}(t.id,t?.dataObj?.name,t.action)}))})();