import{d as v,P as V,O as y,bg as h,a$ as w,b3 as C,bT as _,o as B,n as I,w as s,a as l,z as k,Q as O,f as r,B as x,c3 as b,cC as G,l as S,V as c,cA as z,s as D,dj as L}from"./index-Jv7TaKWs.js";const $=v({__name:"ActivityChartGraph",props:{graph:{}},setup(f){const d=f,n=V(()=>d.graph),e=y({dialog:!1,imageFormats:["jpeg","png","svg","webp"],toImageButtonOptions:{filename:"nest-desktop",format:"png"}}),u=h(null),g=()=>{var a,o;e.dialog=!1;const t=new Date().toISOString();e.toImageButtonOptions.filename=`nest_desktop-${(a=n.value)==null?void 0:a.project.name}-${t}`,(o=n.value)==null||o.downloadImage(e.toImageButtonOptions)},m=()=>{var a,o;const t=u.value;t&&((a=n.value)==null||a.newPlot(t),t.on("plotly_relayout",()=>{var i;(i=n.value)==null||i.restyle()}),t.on("plotly_resize",()=>{var i;(i=n.value)==null||i.restyle()}),(o=n.value)!=null&&o.plotData&&n.value.react())},p=()=>{var t;return(t=n.value)==null?void 0:t.relayout()};return w(()=>{e.dialog=!1,window.removeEventListener("relayout",p)}),C(()=>{m(),window.addEventListener("relayout",p)}),_(()=>d.graph,()=>m()),(t,a)=>(B(),I(L,{class:"activityGraphLayout","full-height":""},{default:s(()=>[l(z,{"max-width":"300",modelValue:e.dialog,"onUpdate:modelValue":a[2]||(a[2]=o=>e.dialog=o)},{default:s(()=>[l(k,null,{default:s(()=>[l(O,null,{default:s(()=>[r("Download plot as image")]),_:1}),l(x,null,{default:s(()=>[l(b,{items:e.imageFormats,density:"compact","hide-details":"",label:"Select image format",modelValue:e.toImageButtonOptions.format,"onUpdate:modelValue":a[0]||(a[0]=o=>e.toImageButtonOptions.format=o),variant:"outlined"},null,8,["items","modelValue"])]),_:1}),l(G,null,{default:s(()=>[l(S),l(c,{onClick:a[1]||(a[1]=o=>e.dialog=!1),size:"small",variant:"outlined"},{default:s(()=>[r(" cancel ")]),_:1}),l(c,{onClick:g,size:"small",variant:"outlined"},{default:s(()=>[r(" download ")]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"]),D("div",{class:"activityChartGraph full-height",ref_key:"activityChartGraph",ref:u},null,512)]),_:1}))}});export{$ as _};
