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-agX0mVFg.js";import{t as c}from"./_baseClone-uoiQPoOm.js";import{t as l}from"./merge-BTvhZMGP.js";import{D as u,E as d,I as f,K as p,St as m,U as h,at as g,dt as _,et as v,gt as y,i as b,it as x,lt as S,m as C,nt as w,pt as T,t as E,ut as D}from"./lib-DPUqMlxa.js";import{t as O}from"./AppBtn-Cax1vPEQ.js";import{t as k}from"./browser-CVJ1AcOT.js";import{t as A}from"./state-BLEGlaTc.js";import{t as j}from"./download-url-p6fXMLHt.js";import{D as M,E as N,S as P,_ as F}from"./index-CcijY9_7.js";var I=1,L=4;function R(e,t){return t=typeof t==`function`?t:void 0,c(e,I|L,t)}E();var z=class extends s(k){data;graphics;options;height;chart;get flatSurface(){return this.$typedState.mesh.flatSurface}get bedSize(){return this.$typedGetters[`printer/getBedSize`]}onFlatSurfaceChange(e){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=R(this.graphics,e=>{switch(e.type){case`text`:return{...e,style:{...e.style,fill:t,fontSize:n}};default:return}}),u={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 l(u,this.options),u}async downloadImage(){let e=this.chart.getDataURL({type:`png`,backgroundColor:`#262629`});j([`bedmesh`,this.$typedState.printer.printer.bed_mesh?.profile_name].filter(e=>e).join(`-`),e)}};r([a({type:Array,required:!0})],z.prototype,`data`,void 0),r([a({type:Array,default:()=>[]})],z.prototype,`graphics`,void 0),r([a({type:Object,default:()=>{}})],z.prototype,`options`,void 0),r([a({type:[String,Number],default:`100%`})],z.prototype,`height`,void 0),r([e(`chart`)],z.prototype,`chart`,void 0),r([i(`flatSurface`)],z.prototype,`onFlatSurfaceChange`,null),z=r([n({})],z);var B=o(z,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":{notMerge:!1},"init-options":{renderer:`canvas`},autoresize:``}})],1)},[],!1,null,`fa73b48c`,null,null).exports,V=class extends s(A,N,k){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})],V.prototype,`fullscreen`,void 0),r([e(`chart`)],V.prototype,`bedMeshChart`,void 0),V=r([n({components:{BedMeshChart:B}})],V);var H=o(V,function(){var e=this,t=e._self._c;return e._self._setupProxy,t(P,{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(O,{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(b,{attrs:{bottom:``},scopedSlots:e._u([{key:`activator`,fn:function({on:n,attrs:r}){return[t(O,e._g(e._b({attrs:{icon:``,disabled:!e.hasMeshLoaded},on:{click:function(t){return e.downloadImage()}}},`app-btn`,r,!1),n),[t(m,{attrs:{dense:``}},[e._v(` $screenshot `)])],1)]}}])},[t(`span`,[e._v(e._s(e.$t(`app.bedmesh.tooltip.download_image`)))])]),e.fullscreen?e._e():t(O,{attrs:{icon:``},on:{click:function(t){return e.$filters.routeTo({name:`tune`})}}},[t(m,{attrs:{dense:``}},[e._v(` $fullScreen `)])],1)]},proxy:!0}])},[t(p,[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,U=class extends s(A){fullscreen;get sensors(){return this.$typedGetters[`printer/getRunoutSensors`]}changeSensor(e,t){this.sendGcode(`SET_FILAMENT_SENSOR SENSOR=${F(e.name)} ENABLE=${+t}`)}};r([a({type:Boolean})],U.prototype,`fullscreen`,void 0),U=r([n({})],U);var W=U;E();var G=o(W,function(){var e=this,t=e._self._c;return e._self._setupProxy,t(P,{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(O,{attrs:{icon:``},on:{click:function(t){return e.$filters.routeTo({name:`tune`})}}},[t(m,{attrs:{dense:``}},[e._v(` $fullScreen `)])],1)]},proxy:!0}])},[t(_,e._l(e.sensors,function(n){return t(D,{key:n.name},[t(w,[t(x,[e._v(e._s(n.prettyName))])],1),t(S,[n.filament_detected?t(m,{attrs:{color:`success`}},[e._v(` $checkedCircle `)]):t(m,{attrs:{color:`warning`}},[e._v(` $alertCircle `)])],1),t(g,[t(C,{attrs:{"input-value":n.enabled},on:{change:function(t){return e.changeSensor(n,t)}}})],1)],1)}),1)],1)},[],!1,null,null,null,null).exports,K=class extends s(A,N){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})],K.prototype,`open`,void 0),r([a({type:String})],K.prototype,`existingName`,void 0),K=r([n({})],K);var q=K;E();var J=o(q,function(){var e=this,t=e._self._c;return e._self._setupProxy,t(M,{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(p,[t(v,{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(h,{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,Y=class extends s(A,N){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=${F(e)}`)}removeModel(e){this.sendGcode(`BEACON_MODEL_REMOVE NAME=${F(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=${F(e.name)}`),e.removeDefault&&t&&this.sendGcode(`BEACON_MODEL_REMOVE NAME=${F(t)}`)}};r([a({type:Boolean})],Y.prototype,`fullscreen`,void 0),Y=r([n({components:{SaveModelDialog:J}})],Y);var X=Y;E();var Z=o(X,function(){var e=this,t=e._self._c;return e._self._setupProxy,t(P,{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(O,{attrs:{icon:``},on:{click:function(t){return e.$filters.routeTo({name:`tune`})}}},[t(m,{attrs:{dense:``}},[e._v(` $fullScreen `)])],1)]},proxy:!0}])},[e.beaconModels.length>0?[t(f,[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(y,{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(b,{attrs:{bottom:``},scopedSlots:e._u([{key:`activator`,fn:function({on:r,attrs:i}){return[t(O,e._g(e._b({attrs:{icon:``},on:{click:function(t){return e.loadModel(n.name)}}},`app-btn`,i,!1),r),[t(m,{attrs:{dense:``}},[e._v(` $open `)])],1)]}}],null,!0)},[t(`span`,[e._v(e._s(e.$t(`app.beacon.tooltip.load`)))])]),t(b,{attrs:{bottom:``},scopedSlots:e._u([{key:`activator`,fn:function({on:r,attrs:i}){return[t(O,e._g(e._b({attrs:{icon:``},on:{click:function(t){return e.removeModel(n.name)}}},`app-btn`,i,!1),r),[t(m,{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(T),t(p,[e.beaconModels.length===0?t(`div`,{staticClass:`mb-4`},[e._v(` No existing beacon models found `)]):e._e(),t(d,[t(u,{attrs:{cols:`6`}},[t(O,{attrs:{block:``,small:``,color:`primary`},on:{click:e.handleOpenSaveDialog}},[e._v(` `+e._s(e.$t(`app.general.btn.save_as`))+` `)])],1),t(u,{attrs:{cols:`6`}},[t(O,{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{G as n,H as r,Z as t};