import{a as e,i as t,l as n,n as r,r as i,s as a,t as o,u as s}from"./_plugin-vue2_normalizer-Vm4EDAeQ.js";import{Fn as c,Jt as l,Qt as u,Tt as d,Y as f,a as p,en as m,fn as h,kt as g,mn as _,nn as v,pt as y,q as b,t as x,un as S,vn as C,w,wn as T}from"./lib-DqsS17DW.js";import{A as E,E as D,M as O,P as k,Q as A,Z as j,et as M,g as N,j as P,k as F,x as I}from"./index-DzPaEMae.js";var L=1,R=4;function z(e,t){return t=typeof t==`function`?t:void 0,A(e,L|R,t)}var B=M(function(e,t,n){j(e,t,n)});x();var V=class extends s(O){data;graphics;options;height;chart;updateOptions=Object.freeze({notMerge:!1});initOptions=Object.freeze({renderer:`canvas`});get flatSurface(){return this.$typedState.mesh.flatSurface}get bedSize(){return this.$typedGetters[`printer/getBedSize`]}onFlatSurfaceChange(e){if(!this.chart)return;let t=e?`legendSelect`:`legendUnSelect`;this.chart.dispatchAction({type:t,name:`mesh_matrix_flat`}),this.chart.dispatchAction({type:t,name:`probed_matrix_flat`})}beforeDestroy(){typeof window>`u`||this.chart?.dispose()}get opts(){let e=this.$typedState.config.uiSettings.theme.isDark,t=e?`rgba(255,255,255,0.65)`:`rgba(0,0,0,0.45)`,n=this.isMobileViewport?14:16,r=e?`rgba(10,10,10,0.90)`:`rgba(255,255,255,0.90)`,i=.1,a=e?`#ffffff`:`#000000`,o={itemWidth:this.isMobileViewport?15:25,itemHeight:this.isMobileViewport?140:280},s={nameTextStyle:{color:t},axisPointer:{lineStyle:{color:a,opacity:.65},label:{margin:16,color:t,fontSize:n}},axisTick:{lineStyle:{color:a,opacity:i}},axisLine:{lineStyle:{color:a,opacity:i,width:2}},axisLabel:{textStyle:{color:t,fontSize:n}},splitLine:{lineStyle:{color:a,opacity:i}}},c=z(this.graphics,e=>{switch(e.type){case`text`:return{...e,style:{...e.style,fill:t,fontSize:n}};default:return}}),l={legend:{show:!1},textStyle:{fontFamily:`Roboto`},darkMode:e,tooltip:{backgroundColor:r,borderColor:r,textStyle:{color:t,fontSize:18},formatter:e=>{let n=``;return e.value&&Array.isArray(e.value)&&(n+=`
              <div>
                <span style="display:inline-block;margin-right:4px;border-radius:10px;width:10px;height:10px;background-color:${e.color};"></span>
                <span style="font-size:16px;color:${t};font-weight:400;margin-left:2px">
                  ${this.$filters.prettyCase(e.seriesName)}
                </span>
                <div style="clear: both"></div>
                <span style="font-size:16px;color:${t};font-weight:400;margin-left:2px">
                  x: ${e.value[0].toFixed(4)}
                </span>
                <div style="clear: both"></div>
                <span style="font-size:16px;color:${t};font-weight:400;margin-left:2px">
                  y: ${e.value[1].toFixed(4)}
                </span>
                <div style="clear: both"></div>
                <span style="font-size:16px;color:${t};font-weight:400;margin-left:2px">
                  z: ${e.value[2].toFixed(4)}
                </span>
                <div style="clear: both"></div>
              </div>
              `),n}},visualMap:{type:`continuous`,textStyle:{color:t,fontSize:n},realtime:!0,calculable:!0,show:!0,top:0,right:`auto`,bottom:`auto`,left:0,dimension:2,precision:4,inRange:{color:[`#313695`,`#4575b4`,`#74add1`,`#abd9e9`,`#e0f3f8`,`#ffffbf`,`#fee090`,`#fdae61`,`#f46d43`,`#d73027`,`#a50026`]},...o},xAxis3D:{type:`value`,min:this.bedSize.minX,max:this.bedSize.maxX,...s},yAxis3D:{type:`value`,min:this.bedSize.minY,max:this.bedSize.maxY,...s},zAxis3D:{type:`value`,min:-.5,max:.5,...s},grid3D:{viewControl:{rotateSensitivity:1.8,zoomSensitivity:2,rotateMouseButton:`left`,panMouseButton:`right`}},graphic:c,series:[...this.data]};return B(l,this.options),l}async downloadImage(){if(!this.chart)return;let e=this.chart.getDataURL({type:`png`,backgroundColor:`#262629`});D([`bedmesh`,this.$typedState.printer.printer.bed_mesh?.profile_name].filter(e=>e).join(`-`),e)}};r([a({type:Array,required:!0})],V.prototype,`data`,void 0),r([a({type:Array,default:()=>[]})],V.prototype,`graphics`,void 0),r([a({type:Object,default:()=>{}})],V.prototype,`options`,void 0),r([a({type:[String,Number],default:`100%`})],V.prototype,`height`,void 0),r([e(`chart`)],V.prototype,`chart`,void 0),r([i(`flatSurface`)],V.prototype,`onFlatSurfaceChange`,null),V=r([n({})],V);var H=o(V,function(){var e=this,t=e._self._c;return e._self._setupProxy,t(`div`,{staticClass:`chart`,style:{height:e.$filters.getPixelsString(e.height)}},[t(`e-chart`,{ref:`chart`,attrs:{option:e.opts,"update-options":e.updateOptions,"init-options":e.initOptions,autoresize:``}})],1)},[],!1,null,`3c0f5a58`,null,null).exports,U=class extends s(E,F,O){fullscreen;bedMeshChart;get hasMeshLoaded(){let e=this.mesh,t=this.matrix;return e&&e[t]&&e[t].coordinates&&e[t].coordinates.length>0}get options(){let e=this.scale/2,t=this.boxScale/2,n=-Math.abs(e-this.mesh[this.matrix].min),r=e+this.mesh[this.matrix].max;this.scale===0&&(n=this.mesh[this.matrix].min,r=this.mesh[this.matrix].max);let i=-Math.abs(this.mesh[this.matrix].mid-t),a=this.mesh[this.matrix].mid+t;return{legend:{show:!1,selected:this.series.reduce((e,t)=>Object.assign(e,{[t.name]:!t.name.endsWith(`_flat`)||this.flatSurface&&t.name.startsWith(this.matrix)}),Object.assign({}))},visualMap:{min:n,max:r,dimension:2,seriesIndex:0},zAxis3D:{min:i,max:a}}}get series(){let e=this.matrix;return[{type:`surface`,name:e,shading:`color`,wireframe:{show:this.wireframe},data:this.mesh[e].coordinates,dataShape:this.mesh[e].dimensions},this.createFlatSeries(`probed_matrix_flat`),this.createFlatSeries(`mesh_matrix_flat`)]}get graphics(){let{range:e}=this.mesh[this.matrix];return[{type:`text`,right:10,top:0,z:100,silent:!0,style:{text:`${this.$t(`app.general.label.range`)}: ${e.toFixed(4)}`}}]}createFlatSeries(e){return{type:`surface`,name:e,itemStyle:{color:[.5,.5,.5,.25]},wireframe:{show:this.wireframe,lineStyle:{opacity:.25,width:1,color:`#ffffff`}},data:this.mesh[e].coordinates,dataShape:this.mesh[e].dimensions}}calibrate(){this.sendGcode(`BED_MESH_CALIBRATE`,this.$waits.onMeshCalibrate)}get matrix(){return this.$typedState.mesh.matrix}get scale(){return this.$typedState.mesh.scale}get boxScale(){return this.$typedState.mesh.boxScale}get wireframe(){return this.$typedState.mesh.wireframe}get flatSurface(){return this.$typedState.mesh.flatSurface}get mesh(){return this.$typedGetters[`mesh/getCurrentMeshData`]}downloadImage(){this.bedMeshChart.downloadImage()}};r([a({type:Boolean})],U.prototype,`fullscreen`,void 0),r([e(`chart`)],U.prototype,`bedMeshChart`,void 0),U=r([n({components:{BedMeshChart:H}})],U);var W=o(U,function(){var e=this,t=e._self._c;return e._self._setupProxy,t(I,{attrs:{title:e.$t(`app.general.title.bedmesh`),lazy:!1,icon:`$bedMesh`,draggable:!e.fullscreen,collapsable:!e.fullscreen,"layout-path":`dashboard.bed-mesh-card`},scopedSlots:e._u([{key:`menu`,fn:function(){return[e.fullscreen?e._e():t(k,{staticClass:`me-1 my-1`,attrs:{small:``,loading:e.hasWait(e.$waits.onMeshCalibrate),disabled:e.printerBusy||!e.allHomed},on:{click:function(t){return e.calibrate()}}},[e._v(` `+e._s(e.$t(`app.general.btn.calibrate`))+` `)]),t(p,{attrs:{bottom:``},scopedSlots:e._u([{key:`activator`,fn:function({on:n,attrs:r}){return[t(k,e._g(e._b({attrs:{icon:``,disabled:!e.hasMeshLoaded},on:{click:function(t){return e.downloadImage()}}},`app-btn`,r,!1),n),[t(c,{attrs:{dense:``}},[e._v(` $screenshot `)])],1)]}}])},[t(`span`,[e._v(e._s(e.$t(`app.bedmesh.tooltip.download_image`)))])]),e.fullscreen?e._e():t(k,{attrs:{icon:``},on:{click:function(t){return e.$filters.routeTo({name:`tune`})}}},[t(c,{attrs:{dense:``}},[e._v(` $fullScreen `)])],1)]},proxy:!0}])},[t(g,[e.hasMeshLoaded?t(`bed-mesh-chart`,{ref:`chart`,attrs:{options:e.options,data:e.series,graphics:e.graphics,height:e.isMobileViewport?225:525}}):t(`span`,[e._v(e._s(e.$t(`app.bedmesh.msg.not_loaded`)))])],1)],1)},[],!1,null,null,null,null).exports,G=class extends s(E){fullscreen;get sensors(){return this.$typedGetters[`printer/getRunoutSensors`]}changeSensor(e,t){this.sendGcode(`SET_FILAMENT_SENSOR SENSOR=${N(e.name)} ENABLE=${+t}`)}};r([a({type:Boolean})],G.prototype,`fullscreen`,void 0),G=r([n({})],G);var K=G;x();var q=o(K,function(){var e=this,t=e._self._c;return e._self._setupProxy,t(I,{attrs:{title:e.$t(`app.general.title.runout_sensors`),icon:`$printer3dNozzleAlert`,draggable:!e.fullscreen,collapsable:!e.fullscreen,"layout-path":`dashboard.runout-sensors-card`},scopedSlots:e._u([{key:`menu`,fn:function(){return[e.fullscreen?e._e():t(k,{attrs:{icon:``},on:{click:function(t){return e.$filters.routeTo({name:`tune`})}}},[t(c,{attrs:{dense:``}},[e._v(` $fullScreen `)])],1)]},proxy:!0}])},[t(_,e._l(e.sensors,function(n){return t(h,{key:n.name},[t(u,[t(m,[e._v(e._s(n.prettyName))])],1),t(S,[n.filament_detected?t(c,{attrs:{color:`success`}},[e._v(` $checkedCircle `)]):t(c,{attrs:{color:`warning`}},[e._v(` $alertCircle `)])],1),t(v,[t(w,{attrs:{"input-value":n.enabled},on:{change:function(t){return e.changeSensor(n,t)}}})],1)],1)}),1)],1)},[],!1,null,null,null,null).exports,J=class extends s(E,F){open;existingName;mounted(){this.name=`default`,this.removeDefault=!1}name=`default`;removeDefault=!1;handleSubmit(){this.$emit(`save`,{name:this.name,removeDefault:this.removeDefault}),this.open=!1}};r([t({type:Boolean})],J.prototype,`open`,void 0),r([a({type:String})],J.prototype,`existingName`,void 0),J=r([n({})],J);var Y=J;x();var X=o(Y,function(){var e=this,t=e._self._c;return e._self._setupProxy,t(P,{attrs:{title:e.$t(`app.general.label.save_as`),"max-width":`450`},on:{save:function(t){return e.handleSubmit()}},model:{value:e.open,callback:function(t){e.open=t},expression:`open`}},[t(g,[t(l,{staticClass:`mb-4`,attrs:{autofocus:``,filled:``,required:``,rules:[e.$rules.required],"hide-details":`auto`,label:e.$t(`app.beacon.label.model_name`)},model:{value:e.name,callback:function(t){e.name=t},expression:`name`}}),t(d,{staticClass:`mb-4`,attrs:{label:e.$t(`app.beacon.label.remove_model`,{name:e.existingName}),"hide-details":`auto`,disabled:e.name===e.existingName},model:{value:e.removeDefault,callback:function(t){e.removeDefault=t},expression:`removeDefault`}}),t(`span`,[e._v(` `+e._s(e.$t(`app.beacon.msg.hint`,{name:e.existingName}))+` `)])],1)],1)},[],!1,null,null,null,null).exports,Z=class extends s(E,F){saveDialogState={open:!1,existingName:`default`};fullscreen;get beaconModels(){return this.$typedGetters[`printer/getBeaconModels`]}async loadModel(e){(!this.printerPrinting||await this.$confirm(this.$tc(`app.general.simple_form.msg.confirm_change_beacon_model`),{title:this.$tc(`app.general.label.confirm`),color:`card-heading`,icon:`$error`}))&&this.sendGcode(`BEACON_MODEL_SELECT NAME=${N(e)}`)}removeModel(e){this.sendGcode(`BEACON_MODEL_REMOVE NAME=${N(e)}`)}calibrate(){this.sendGcode(`BEACON_CALIBRATE`,this.$waits.onBeaconCalibrate)}handleOpenSaveDialog(){let e=this.$typedState.printer.printer.beacon?.model??``;this.saveDialogState={open:!0,existingName:e}}handleModelSave(e){let t=this.$typedState.printer.printer.beacon?.model;e.name!==t&&this.sendGcode(`BEACON_MODEL_SAVE NAME=${N(e.name)}`),e.removeDefault&&t&&this.sendGcode(`BEACON_MODEL_REMOVE NAME=${N(t)}`)}};r([a({type:Boolean})],Z.prototype,`fullscreen`,void 0),Z=r([n({components:{SaveModelDialog:X}})],Z);var Q=Z;x();var $=o(Q,function(){var e=this,t=e._self._c;return e._self._setupProxy,t(I,{attrs:{title:e.$t(`app.general.title.beacon`),icon:`$beacon`,draggable:!e.fullscreen,collapsable:!e.fullscreen,"layout-path":`dashboard.beacon-card`},scopedSlots:e._u([{key:`menu`,fn:function(){return[e.fullscreen?e._e():t(k,{attrs:{icon:``},on:{click:function(t){return e.$filters.routeTo({name:`tune`})}}},[t(c,{attrs:{dense:``}},[e._v(` $fullScreen `)])],1)]},proxy:!0}])},[e.beaconModels.length>0?[t(y,[t(`thead`,[t(`tr`,[t(`th`,[e._v(e._s(e.$t(`app.general.label.name`)))]),t(`th`,[e._v(`\xA0`)]),t(`th`,[e._v(`\xA0`)])])]),t(`tbody`,e._l(e.beaconModels,function(n){return t(`tr`,{key:n.name},[t(`td`,{},[e._v(` `+e._s(n.name)+` `)]),t(`td`,[n.active?t(T,{attrs:{small:``,block:``}},[e._v(` `+e._s(e.$t(`app.beacon.label.active`))+` `)]):e._e()],1),t(`td`,{staticClass:`text-right`,attrs:{nowrap:``}},[n.active?e._e():t(p,{attrs:{bottom:``},scopedSlots:e._u([{key:`activator`,fn:function({on:r,attrs:i}){return[t(k,e._g(e._b({attrs:{icon:``},on:{click:function(t){return e.loadModel(n.name)}}},`app-btn`,i,!1),r),[t(c,{attrs:{dense:``}},[e._v(` $open `)])],1)]}}],null,!0)},[t(`span`,[e._v(e._s(e.$t(`app.beacon.tooltip.load`)))])]),t(p,{attrs:{bottom:``},scopedSlots:e._u([{key:`activator`,fn:function({on:r,attrs:i}){return[t(k,e._g(e._b({attrs:{icon:``},on:{click:function(t){return e.removeModel(n.name)}}},`app-btn`,i,!1),r),[t(c,{attrs:{dense:``}},[e._v(` $close `)])],1)]}}],null,!0)},[t(`span`,[e._v(e._s(e.$t(`app.beacon.tooltip.delete`)))])])],1)])}),0)])]:e._e(),t(C),t(g,[e.beaconModels.length===0?t(`div`,{staticClass:`mb-4`},[e._v(` No existing beacon models found `)]):e._e(),t(b,[t(f,{attrs:{cols:`6`}},[t(k,{attrs:{block:``,small:``,color:`primary`},on:{click:e.handleOpenSaveDialog}},[e._v(` `+e._s(e.$t(`app.general.btn.save_as`))+` `)])],1),t(f,{attrs:{cols:`6`}},[t(k,{staticClass:`mb-2`,attrs:{small:``,block:``,loading:e.hasWait(e.$waits.onBeaconCalibrate),disabled:e.printerBusy||!e.xyHomed},on:{click:e.calibrate}},[e._v(` `+e._s(e.$t(`app.general.btn.calibrate`))+` `)])],1)],1)],1),e.saveDialogState.open?t(`save-model-dialog`,{attrs:{"existing-name":e.saveDialogState.existingName},on:{save:e.handleModelSave},model:{value:e.saveDialogState.open,callback:function(t){e.$set(e.saveDialogState,`open`,t)},expression:`saveDialogState.open`}}):e._e()],2)},[],!1,null,null,null,null).exports;export{q as n,W as r,$ as t};