import{E as e,G as t,L as n,N as r,Nt as i,O as a,Q as o,R as s,Rt as c,S as l,T as u,Vt as d,W as ee,Y as te,_t as f,b as p,d as m,dt as h,ft as g,gt as ne,kt as _,mt as v,n as re,ot as y,p as ie,q as b,v as x,x as S,y as C}from"./vue-i18n-Bp4YYb-2.js";import{Br as w,C as ae,E as oe,F as T,Fi as se,H as E,Hi as ce,Li as le,Lt as ue,Ri as de,Ui as fe,V as pe,_a as me,ar as D,cr as O,ga as he,ir as ge,k,oi as A,ri as _e,sr as ve,u as ye,w as be,zi as j}from"./index-BOiiIZox.js";import{t as M}from"./select-DzqiXWJ_.js";import{t as xe}from"./es-CCfg6HOm.js";import{t as Se}from"./multiselect-CmmgN80g.js";import{a as Ce,i as we,n as Te,r as Ee,t as De}from"./install-Gij5v5zz.js";import{b as Oe,i as ke,m as Ae,n as je,o as Me,p as Ne,r as Pe,t as Fe,vt as Ie}from"./dist-DJ3-AZ3K.js";import{t as Le}from"./EntityTitleRename-Bzt7LwIE.js";var Re=pe.extend({name:`knob`,style:`
    .p-knob-range {
        fill: none;
        transition: stroke 0.1s ease-in;
    }

    .p-knob-value {
        animation-name: p-knob-dash-frame;
        animation-fill-mode: forwards;
        fill: none;
    }

    .p-knob-text {
        font-size: 1.3rem;
        text-align: center;
    }

    .p-knob svg {
        border-radius: 50%;
        outline-color: transparent;
        transition:
            background dt('knob.transition.duration'),
            color dt('knob.transition.duration'),
            outline-color dt('knob.transition.duration'),
            box-shadow dt('knob.transition.duration');
    }

    .p-knob svg:focus-visible {
        box-shadow: dt('knob.focus.ring.shadow');
        outline: dt('knob.focus.ring.width') dt('knob.focus.ring.style') dt('knob.focus.ring.color');
        outline-offset: dt('knob.focus.ring.offset');
    }

    @keyframes p-knob-dash-frame {
        100% {
            stroke-dashoffset: 0;
        }
    }
`,classes:{root:function(e){var t=e.instance;return[`p-knob p-component`,{"p-disabled":e.props.disabled,"p-invalid":t.$invalid}]},range:`p-knob-range`,value:`p-knob-value`,text:`p-knob-text`}}),N={name:`BaseKnob`,extends:k,props:{size:{type:Number,default:100},readonly:{type:Boolean,default:!1},step:{type:Number,default:1},min:{type:Number,default:0},max:{type:Number,default:100},valueColor:{type:String,default:function(){return E(`knob.value.background`).variable}},rangeColor:{type:String,default:function(){return E(`knob.range.background`).variable}},textColor:{type:String,default:function(){return E(`knob.text.color`).variable}},strokeWidth:{type:Number,default:14},showValue:{type:Boolean,default:!0},valueTemplate:{type:[String,Function],default:`{value}`},tabindex:{type:Number,default:0},ariaLabelledby:{type:String,default:null},ariaLabel:{type:String,default:null}},style:Re,provide:function(){return{$pcKnob:this,$parentInstance:this}}},P=3.14159265358979,ze={name:`Knob`,extends:N,inheritAttrs:!1,emits:[`change`],data:function(){return{radius:40,midX:50,midY:50,minRadians:4*P/3,maxRadians:-P/3}},methods:{updateValueByOffset:function(e,t){var n=e-this.size/2,r=this.size/2-t,i=Math.atan2(r,n),a=-P/2-P/6;this.updateModel(i,a)},updateModel:function(e,t){var n;if(e>this.maxRadians)n=this.mapRange(e,this.minRadians,this.maxRadians,this.min,this.max);else if(e<t)n=this.mapRange(e+2*P,this.minRadians,this.maxRadians,this.min,this.max);else return;var r=Math.round((n-this.min)/this.step)*this.step+this.min;this.writeValue(r),this.$emit(`change`,r)},updateModelValue:function(e){e>this.max?this.writeValue(this.max):e<this.min?this.writeValue(this.min):this.writeValue(e)},mapRange:function(e,t,n,r,i){return(e-t)*(i-r)/(n-t)+r},onClick:function(e){!this.disabled&&!this.readonly&&this.updateValueByOffset(e.offsetX,e.offsetY)},onBlur:function(e){var t,n;(t=(n=this.formField).onBlur)==null||t.call(n,e)},onMouseDown:function(e){!this.disabled&&!this.readonly&&(window.addEventListener(`mousemove`,this.onMouseMove),window.addEventListener(`mouseup`,this.onMouseUp),e.preventDefault())},onMouseUp:function(e){!this.disabled&&!this.readonly&&(window.removeEventListener(`mousemove`,this.onMouseMove),window.removeEventListener(`mouseup`,this.onMouseUp),e.preventDefault())},onTouchStart:function(e){!this.disabled&&!this.readonly&&(window.addEventListener(`touchmove`,this.onTouchMove),window.addEventListener(`touchend`,this.onTouchEnd),e.preventDefault())},onTouchEnd:function(e){!this.disabled&&!this.readonly&&(window.removeEventListener(`touchmove`,this.onTouchMove),window.removeEventListener(`touchend`,this.onTouchEnd),e.preventDefault())},onMouseMove:function(e){!this.disabled&&!this.readonly&&(this.updateValueByOffset(e.offsetX,e.offsetY),e.preventDefault())},onTouchMove:function(e){if(!this.disabled&&!this.readonly&&e.touches.length==1){var t=this.$el.getBoundingClientRect(),n=e.targetTouches.item(0),r=n.clientX-t.left,i=n.clientY-t.top;this.updateValueByOffset(r,i)}},onKeyDown:function(e){if(!this.disabled&&!this.readonly)switch(e.code){case`ArrowRight`:case`ArrowUp`:e.preventDefault(),this.updateModelValue(this.d_value+this.step);break;case`ArrowLeft`:case`ArrowDown`:e.preventDefault(),this.updateModelValue(this.d_value-this.step);break;case`Home`:e.preventDefault(),this.writeValue(this.min);break;case`End`:e.preventDefault(),this.writeValue(this.max);break;case`PageUp`:e.preventDefault(),this.updateModelValue(this.d_value+10);break;case`PageDown`:e.preventDefault(),this.updateModelValue(this.d_value-10);break}}},computed:{rangePath:function(){return`M ${this.minX} ${this.minY} A ${this.radius} ${this.radius} 0 1 1 ${this.maxX} ${this.maxY}`},valuePath:function(){return`M ${this.zeroX} ${this.zeroY} A ${this.radius} ${this.radius} 0 ${this.largeArc} ${this.sweep} ${this.valueX} ${this.valueY}`},zeroRadians:function(){return this.min>0&&this.max>0?this.mapRange(this.min,this.min,this.max,this.minRadians,this.maxRadians):this.mapRange(0,this.min,this.max,this.minRadians,this.maxRadians)},valueRadians:function(){return this.mapRange(this.d_value,this.min,this.max,this.minRadians,this.maxRadians)},minX:function(){return this.midX+Math.cos(this.minRadians)*this.radius},minY:function(){return this.midY-Math.sin(this.minRadians)*this.radius},maxX:function(){return this.midX+Math.cos(this.maxRadians)*this.radius},maxY:function(){return this.midY-Math.sin(this.maxRadians)*this.radius},zeroX:function(){return this.midX+Math.cos(this.zeroRadians)*this.radius},zeroY:function(){return this.midY-Math.sin(this.zeroRadians)*this.radius},valueX:function(){return this.midX+Math.cos(this.valueRadians)*this.radius},valueY:function(){return this.midY-Math.sin(this.valueRadians)*this.radius},largeArc:function(){return Math.abs(this.zeroRadians-this.valueRadians)<P?0:1},sweep:function(){return this.valueRadians>this.zeroRadians?0:1},valueToDisplay:function(){return typeof this.valueTemplate==`string`?this.valueTemplate.replace(/{value}/g,this.d_value):this.valueTemplate(this.d_value)}}},F=[`width`,`height`,`tabindex`,`aria-valuemin`,`aria-valuemax`,`aria-valuenow`,`aria-labelledby`,`aria-label`],Be=[`d`,`stroke-width`,`stroke`],I=[`d`,`stroke-width`,`stroke`],L=[`fill`];function Ve(e,t,r,i,a,o){return b(),l(`div`,n({class:e.cx(`root`)},e.ptmi(`root`)),[(b(),l(`svg`,n({viewBox:`0 0 100 100`,role:`slider`,width:e.size,height:e.size,tabindex:e.readonly||e.disabled?-1:e.tabindex,"aria-valuemin":e.min,"aria-valuemax":e.max,"aria-valuenow":e.d_value,"aria-labelledby":e.ariaLabelledby,"aria-label":e.ariaLabel,onClick:t[0]||(t[0]=function(){return o.onClick&&o.onClick.apply(o,arguments)}),onBlur:t[1]||(t[1]=function(){return o.onBlur&&o.onBlur.apply(o,arguments)}),onKeydown:t[2]||(t[2]=function(){return o.onKeyDown&&o.onKeyDown.apply(o,arguments)}),onMousedown:t[3]||(t[3]=function(){return o.onMouseDown&&o.onMouseDown.apply(o,arguments)}),onMouseup:t[4]||(t[4]=function(){return o.onMouseUp&&o.onMouseUp.apply(o,arguments)}),onTouchstart:t[5]||(t[5]=function(){return o.onTouchStart&&o.onTouchStart.apply(o,arguments)}),onTouchend:t[6]||(t[6]=function(){return o.onTouchEnd&&o.onTouchEnd.apply(o,arguments)})},e.ptm(`svg`)),[C(`path`,n({d:o.rangePath,"stroke-width":e.strokeWidth,stroke:e.rangeColor,class:e.cx(`range`)},e.ptm(`range`)),null,16,Be),C(`path`,n({d:o.valuePath,"stroke-width":e.strokeWidth,stroke:e.valueColor,class:e.cx(`value`)},e.ptm(`value`)),null,16,I),e.showValue?(b(),l(`text`,n({key:0,x:50,y:57,"text-anchor":`middle`,fill:e.textColor,class:e.cx(`text`)},e.ptm(`text`)),f(o.valueToDisplay),17,L)):S(``,!0)],16,F))],16)}ze.render=Ve;var He=0,Ue=100,We=be(a({__name:`MixProfileEditorChart`,props:{profiles:{},mixFunctionType:{}},setup(e){Oe([Ae,ke,je,Pe,we,De,Me]);let t=e,n=ue(),r=i(n.$state),a=ge(),o=ye(),{t:s}=re(),l=t.profiles.flatMap(e=>e.p_type===j.Mix?a.profiles.filter(t=>e.member_profile_uids.includes(t.uid)):[e]),u=0,d=100,ee=50,te=50;for(let e of l){for(let t of n.allDevices())if(t.uid===e.temp_source?.device_uid){if(t.info==null)break;u=Math.min(u,t.info.temp_min),d=Math.max(d,t.info.temp_max)}e.temp_min!=null&&(ee=Math.min(ee,e.temp_min)),e.temp_max!=null&&(te=Math.max(te,e.temp_max))}te>50&&d>100?d=Math.min(d,te):te==50&&d>100&&(d=100);let f=u,m=d,h=[],g=[];for(let e=0;e<l.length;e++)h.push([{value:[]},{value:[]}]),g.push([]);let ne=[{value:[]},{value:[]}],v=e=>{let t=l[e];return t.temp_source==null?o.themeColors.yellow:a.allUIDeviceSettings.get(t.temp_source.device_uid)?.sensorsAndChannels.get(t.temp_source.temp_name).color??o.themeColors.accent},ie=e=>{let t=l[e],n=a.functions.find(e=>e.uid===t.function_uid);return n==null||n.f_type===se.Identity?0:.1},x=e=>{let t=l[e],n=a.functions.find(e=>e.uid===t.function_uid);return n==null||n.f_type===se.Identity?o.themeColors.bg_one:o.themeColors.accent},S=e=>{let t=l[e],n=a.functions.find(e=>e.uid===t.function_uid);return n==null||n.f_type===se.Identity?10:20},C={grid:{show:!1,top:n.getREMSize(.75),left:0,right:n.getREMSize(1.2),bottom:0,containLabel:!0},xAxis:{min:f,max:m,type:`value`,splitNumber:10,axisLabel:{fontSize:n.getREMSize(.95),color:o.themeColors.text_color_secondary,formatter:e=>`${e}${s(`common.tempUnit`)} `},axisLine:{lineStyle:{color:o.themeColors.text_color,width:1}},splitLine:{lineStyle:{color:o.themeColors.border,width:.5,type:`dotted`}}},yAxis:{min:He,max:Ue,type:`value`,splitNumber:10,axisLabel:{fontSize:n.getREMSize(.95),color:o.themeColors.text_color_secondary,formatter:e=>`${e}${s(`common.percentUnit`)}`},axisLine:{lineStyle:{color:o.themeColors.text_color,width:1}},splitLine:{lineStyle:{color:o.themeColors.border,width:.5,type:`dotted`}}},dataZoom:[{type:`inside`,xAxisIndex:0,filterMode:`none`,preventDefaultMouseMove:!1,throttle:25}],series:[],animation:!0,animationDuration:300,animationDurationUpdate:300},w=e=>{let t=l[e];if(t.temp_source==null)return 0;let r=n.currentDeviceStatus.get(t.temp_source.device_uid)?.get(t.temp_source.temp_name)?.temp;return r==null?0:Number(r)},ae=e=>{if(e.temp_source==null)return 0;let t=n.currentDeviceStatus.get(e.temp_source.device_uid)?.get(e.temp_source.temp_name)?.temp;return t==null?0:Number(t)},oe=(e,t)=>{if(e.length===0)return 0;switch(t){case le.Avg:return e.reduce((e,t)=>e+t,0)/e.length;case le.Max:return Math.max(...e);case le.Min:return Math.min(...e);case le.Diff:return Math.max(Math.min(e.reduce((e,t)=>e-t),100),0);case le.Sum:return Math.min(e.reduce((e,t)=>e+t,0),100)}},T=()=>{let e=[];for(let n of t.profiles)if(n.p_type===j.Mix&&n.mix_function_type!=null){let t=[];for(let e of n.member_profile_uids){let n=a.profiles.find(t=>t.uid===e);if(n!=null)if(n.p_type===j.Fixed)t.push(n.speed_fixed??0);else{let e=ae(n);t.push(E(n.speed_profile,e))}}t.length>0&&e.push(oe(t,n.mix_function_type))}else if(n.p_type===j.Fixed)e.push(n.speed_fixed??0);else{let t=ae(n);e.push(E(n.speed_profile,t))}return oe(e,t.mixFunctionType)},E=(e,t)=>{let n=e[0],r=e[e.length-1];for(let i of e)if(i[0]<=t&&(n=i),i[0]>=t){r=i;break}if(n[0]===r[0])return n[1];let i=n[0],a=n[1],o=r[0],s=r[1];return Math.round(a+(t-i)/(o-i)*(s-a))},ce=e=>e<91?`top`:`bottom`;for(let e=0;e<l.length;e++)C.series.push({id:`tempLine`+e,type:`line`,smooth:!1,symbol:`none`,lineStyle:{color:v(e),width:n.getREMSize(.1),type:`dashed`,shadowColor:o.themeColors.bg_one,shadowBlur:5,shadowOffsetX:0,shadowOffsetY:0},emphasis:{disabled:!0},data:h[e],markPoint:{symbolSize:0,label:{position:`top`,fontSize:n.getREMSize(1),color:v(e),rotate:90,offset:[0,-2],formatter:e=>e.value==null?``:Number(e.value).toFixed(1)+`°`,shadowColor:o.themeColors.bg_one,shadowBlur:10},data:l[e].p_type===j.Fixed?[]:[{coord:[w(e),95],value:w(e)}]},z:10,silent:!0},{id:`graphLine`+e,type:`line`,smooth:ie(e),symbol:`circle`,itemStyle:{color:v(e),borderColor:v(e),borderWidth:3},lineStyle:{color:v(e),width:2,type:`solid`,cap:`round`,shadowColor:x(e),shadowBlur:S(e)},areaStyle:{color:new Ie(0,0,0,1,[{offset:0,color:o.convertColorToRGBA(v(e),.2)},{offset:1,color:o.convertColorToRGBA(v(e),0)}]),opacity:1},emphasis:{disabled:!0},data:g[e],z:1,silent:!0});C.series.push({id:`calculatedDutyLine`,type:`line`,smooth:!1,symbol:`none`,lineStyle:{color:`${o.themeColors.accent}`,width:4,type:`solid`},emphasis:{disabled:!0},data:ne,markPoint:{symbolSize:0,label:{position:ce(T()),fontSize:n.getREMSize(1),color:o.themeColors.accent,formatter:e=>e.value==null?``:Number(e.value).toFixed(0)+`%`},data:[{coord:[5,T()],value:T()}]},areaStyle:{color:new Ie(0,0,0,1,[{offset:0,color:o.convertColorToRGBA(o.themeColors.accent,.3)},{offset:1,color:o.convertColorToRGBA(o.themeColors.accent,0)}]),opacity:1},z:100,silent:!0});let de=e=>{let t=l[e];if(t.p_type===j.Fixed){g[e].length=0;let n=t.speed_fixed??0;g[e].push({value:[f,n]}),g[e].push({value:[m,n]});return}let n=w(e);if(h[e][0].value=[n,He],h[e][1].value=[n,Ue],g[e].length=0,t.speed_profile.length>1){let n=t.speed_profile[0];n[0]>f&&g[e].push({value:[f,n[1]]});for(let n of t.speed_profile)g[e].push({value:n});let r=t.speed_profile[t.speed_profile.length-1];r[0]<m&&g[e].push({value:[m,r[1]]})}};for(let e=0;e<l.length;e++)de(e);let fe=()=>{let e=T();return ne[0].value=[f,e],ne[1].value=[m,e],e};fe();let pe=_(null);return y(r.currentDeviceStatus,()=>{let e=fe();pe.value?.setOption({series:[{id:`calculatedDutyLine`,data:ne,markPoint:{data:[{coord:[5,e],value:e}],label:{position:ce(e)}}}]});for(let e=0;e<l.length;e++){if(l[e].p_type===j.Fixed)continue;let t=w(e);h[e][0].value=[t,He],h[e][1].value=[t,Ue],pe.value?.setOption({series:[{id:`tempLine`+e,data:h[e],markPoint:{data:[{coord:[t,95],value:t}]}}]})}}),y(a.allUIDeviceSettings,()=>{for(let e=0;e<l.length;e++){let t=v(e);C.series[e*2].lineStyle.color=t,C.series[e*2].markPoint.label.color=t,C.series[e*2+1].lineStyle.color=t,pe.value?.setOption({series:[{id:`tempLine`+e,lineStyle:{color:t},markPoint:{label:{color:t}}},{id:`graphLine`+e,lineStyle:{color:t},itemStyle:{color:t,borderColor:t},areaStyle:{color:new Ie(0,0,0,1,[{offset:0,color:o.convertColorToRGBA(t,.2)},{offset:1,color:o.convertColorToRGBA(t,0)}])}}]})}}),(e,t)=>(b(),p(c(Fe),{id:`control-graph`,class:`pt-6 pr-11 pl-4 pb-6`,ref_key:`mixGraph`,ref:pe,option:C,autoresize:!0,"manual-update":!0},null,512))}}),[[`__scopeId`,`data-v-287f2bed`]]),Ge=d(D()),Ke={class:`flex flex-row justify-center mt-4 mx-4 w-full`},qe={class:`flex flex-row`},Je={class:`p-2 mx-4 leading-none items-center`},R={id:`profile-display`,class:`flex flex-col h-full relative`},z={class:`flex justify-between items-center px-2 py-1 border-b border-border-one sticky top-0 bg-bg-two/95`},Ye={class:`font-semibold text-text-color cursor-default`},Xe={class:`w-full`},Ze={class:`sticky top-7 bg-bg-two/95 cursor-default`},Qe={class:`text-text-color-secondary`},$e={class:`px-1 py-1 text-center`},et={class:`px-1 py-1 text-center`},tt=[`onClick`],nt={class:`px-2 py-0.5 text-text-color-secondary`},rt={class:`pr-2 py-1`},it=[`onWheel`],B={class:`pr-2 py-1`},at=[`onWheel`],ot={class:`px-1 py-0.5`},V={class:`flex gap-0.5 opacity-0 group-hover:opacity-100`},H=0,U=100,W=-100,G=100,st=2,ct=12,K=2,q=1,lt=400,ut=75,dt=be(a({__name:`OverlayProfileEditorChart`,props:{profileUID:{}},emits:[`changed`],setup(n,{emit:r}){Oe([Ae,ke,je,Pe,Ee,we,Te,Me,De,Ne]);let i=n,a=r,s=ue(),u=ge(),d=ye(),{t:h}=re(),ne=x(()=>u.profiles.find(e=>e.uid===i.profileUID)),w=_(),se=_(),E=_(),ce=_(0),le=s.getREMSize(1),de=d.themeColors.bg_two,fe=s.getREMSize(1.25),pe=d.themeColors.accent,me=(e,t,n,r)=>{let i=[],a=(t-e)/(n-1);for(let t=0;t<n;t++){let n=e+a*t;i.push(s.round(n,r))}return i},D=()=>{let e=[],t=me(H,U,K,0),n=me(0,0,K,0);for(let[r,i]of t.entries())e.push({value:[i,n[r]],symbolSize:le,itemStyle:{color:de}});return e},O=[];(()=>{if(O.length=0,ne.value.offset_profile!=null&&ne.value.offset_profile.length>1)for(let e of ne.value.offset_profile)O.push({value:[e[0],e[1]],symbolSize:le,itemStyle:{color:de}});else O.push(...D())})();let he=()=>{let e=[];for(let t of O)e.push(t.value);return e},k=[],A={title:{show:!1},tooltip:{position:`top`,appendTo:`body`,triggerOn:`none`,borderWidth:2,borderColor:d.themeColors.border,backgroundColor:d.themeColors.bg_two,textStyle:{color:d.themeColors.text_color,fontSize:s.getREMSize(1)},padding:[0,5,1,7],transitionDuration:0,formatter:function(e){let t=e.data.value[0].toFixed(0),n=Math.round(e.data.value[1]),r=n>=0?`+`:``;return t+h(`common.percentUnit`)+` `+r+n.toFixed(0)+h(`common.percentUnit`)}},grid:{show:!1,top:s.getREMSize(.7),left:s.getREMSize(1.5),right:s.getREMSize(1.2),bottom:s.getREMSize(1.7),containLabel:!0},xAxis:{name:h(`views.profiles.profileOutputDuty`),nameLocation:`middle`,nameGap:s.getREMSize(2),nameTextStyle:{color:d.themeColors.text_color,fontSize:s.getREMSize(1.25)},min:H,max:U,type:`value`,splitNumber:10,axisLabel:{fontSize:s.getREMSize(.95),color:d.themeColors.text_color_secondary,formatter:e=>`${e}${h(`common.percentUnit`)}`},axisLine:{onZero:!1,lineStyle:{color:d.themeColors.text_color,width:1}},splitLine:{lineStyle:{color:d.themeColors.border,width:.5,type:`dotted`}}},yAxis:{name:h(`views.profiles.offsetDuty`),nameLocation:`middle`,nameGap:s.getREMSize(3.25),nameTextStyle:{color:d.themeColors.text_color,fontSize:s.getREMSize(1.25)},min:W,max:G,type:`value`,splitNumber:10,cursor:`no-drop`,axisLabel:{fontSize:s.getREMSize(.95),color:d.themeColors.text_color_secondary,formatter:e=>`${e>0?`+`:``}${e}${h(`common.percentUnit`)}`},axisLine:{lineStyle:{color:d.themeColors.text_color,width:1}},splitLine:{lineStyle:{color:d.themeColors.border,width:.5,type:`dotted`}}},dataZoom:[{type:`inside`,yAxisIndex:0,filterMode:`none`,preventDefaultMouseMove:!1,minValueSpan:20,throttle:25}],series:[{id:`a`,type:`line`,smooth:0,symbol:`circle`,symbolSize:le,itemStyle:{color:d.themeColors.bg_two,borderColor:d.themeColors.accent,borderWidth:2},lineStyle:{color:d.themeColors.accent,width:6,type:`solid`,shadowColor:void 0,shadowBlur:20},emphasis:{disabled:!0},cursor:`no-drop`,data:O},{id:`hit-area`,type:`line`,smooth:0,symbol:`none`,lineStyle:{color:`transparent`,width:12},emphasis:{disabled:!0},silent:!1,z:5,data:O},{id:`line-area`,type:`line`,smooth:0,symbol:`none`,lineStyle:{color:`transparent`,width:0},emphasis:{disabled:!0},areaStyle:{color:new Ie(0,1,0,0,[{offset:0,color:d.convertColorToRGBA(d.themeColors.accent,.8)},{offset:.5,color:d.convertColorToRGBA(d.themeColors.accent,.2)},{offset:1,color:d.convertColorToRGBA(d.themeColors.accent,.8)}],!0),origin:0,opacity:1},silent:!0,z:0,data:O}],animation:!0,animationDuration:200,animationDurationUpdate:200},ve=(e,t)=>{let n=H+t,r=U-(O.length-(t+1));t===0?e=n:t===O.length-1&&(e=r),e<n?e=n:e>r&&(e=r),O[t].value[0]=e;for(let n=t+1;n<O.length;n++){let r=n-t,i=e+r;O[n].value[0]<=i&&(O[n].value[0]=i)}for(let n=0;n<t;n++){let r=t-n,i=e-r;O[n].value[0]>=i&&(O[n].value[0]=i)}a(`changed`,he())},be=(e,t)=>{e<W?e=W:e>G&&(e=G),O[t].value[1]=e,a(`changed`,he())},j=_(null),M=e=>{w.value=s.round(O[e].value[0]),se.value=s.round(O[e].value[1])},xe=(e,t)=>{O[e].value=t,j.value?.setOption({series:[{id:`a`,data:O},{id:`hit-area`,data:O},{id:`line-area`,data:O}]})},Se=(e,t)=>{ve(t[0],e),be(t[1],e),j.value?.setOption({series:[{id:`a`,data:O},{id:`hit-area`,data:O},{id:`line-area`,data:O}],graphic:O.map((e,t)=>({id:t,type:`circle`,position:j.value?.convertToPixel(`grid`,e.value)}))}),ce.value++},Ce=e=>{j.value?.dispatchAction({type:`showTip`,seriesIndex:0,dataIndex:e})},Le=()=>{j.value?.dispatchAction({type:`hideTip`})},Re=()=>y([w,se],e=>{E.value!=null&&(ve(e[0],E.value),be(e[1],E.value),O.forEach((e,t)=>k[t].position=j.value?.convertToPixel(`grid`,e.value)),j.value?.setOption({series:[{id:`a`,data:O},{id:`hit-area`,data:O},{id:`line-area`,data:O}],graphic:k}))},{flush:`post`}),N=Re(),P=()=>{let e=(e,t)=>({id:e,type:`circle`,position:j.value?.convertToPixel(`grid`,t),shape:{cx:0,cy:0,r:fe/2+3},cursor:`grab`,silent:!1,invisible:!0,draggable:!0,ondrag:function(t){t?.event?.buttons===1&&(xe(e,j.value?.convertFromPixel(`grid`,[this.x,this.y])??[0,0]),Ce(e),this.cursor=`grabbing`)},onmouseup:function(){Se(e,j.value?.convertFromPixel(`grid`,[this.x,this.y])??[0,0]),M(e),this.cursor=`grab`},ondragend:function(){let[t,n]=j.value?.convertFromPixel(`grid`,[this.x,this.y])??[0,0];(t<H||t>U||n<W||n>G)&&(Se(e,[t,n]),M(e),this.cursor=`grab`)},onmouseover:function(t){t?.event?.buttons===0&&(N(),M(e),E.value=e,Ce(e),this.cursor=`grab`)},onmouseout:function(e){e?.event?.buttons===0&&(N(),N=Re(),Le())},z:100});k.length=0,k.push(...O.map((t,n)=>e(n,t.value)))},ze=()=>{P(),j.value?.setOption({graphic:k})},F=e=>{if(e.target?.type!==`ec-polyline`||O.length>=ct)return;E.value=void 0;let t=j.value?.convertFromPixel(`grid`,[e.offsetX,e.offsetY])??[0,0];t[1]=Math.min(Math.max(t[1],W),G);let n=1;for(let[e,r]of O.entries())if(r.value[0]>t[0]){n=e;break}O.splice(n,0,{value:t,symbolSize:fe,itemStyle:{color:pe}}),P(),A.series[0].data=O,A.graphic=k,A.series[2].areaStyle.color=new Ie(0,0,0,j.value?.convertToPixel(`grid`,[0,-100])[1]??100,[{offset:0,color:d.convertColorToRGBA(d.themeColors.accent,.8)},{offset:.5,color:d.convertColorToRGBA(d.themeColors.accent,.3)},{offset:1,color:d.convertColorToRGBA(d.themeColors.accent,.8)}],!0),j.value?.setOption(A),N(),M(n),setTimeout(()=>E.value=n,50),setTimeout(()=>Ce(n),350),ce.value++,a(`changed`,he())},Be=e=>{if(e.componentType!==`graphic`||e.event?.target?.id==null){e.stop&&e.stop();return}if(e.event.stop(),O.length<=st)return;let t=Number(e.event.target.id);t===0||t===O.length-1||(O.splice(t,1),E.value=void 0,Le(),P(),A.series[0].data=O,A.graphic=k,A.series[2].areaStyle.color=new Ie(0,0,0,j.value?.convertToPixel(`grid`,[0,-100])[1]??100,[{offset:0,color:d.convertColorToRGBA(d.themeColors.accent,.8)},{offset:.5,color:d.convertColorToRGBA(d.themeColors.accent,.3)},{offset:1,color:d.convertColorToRGBA(d.themeColors.accent,.8)}],!0),j.value?.setOption(A,{replaceMerge:[`series`,`graphic`],silent:!0}),ce.value++,a(`changed`,he()))},I=_(`top-left`),L=x(()=>({"top-14 left-[7.5rem]":I.value===`top-left`,"bottom-36 right-[6.5rem]":I.value===`bottom-right`})),Ve=()=>{I.value=I.value===`top-left`?`bottom-right`:`top-left`},He=e=>{N(),E.value=e,M(e)},Ue=e=>H+e,We=e=>e===0?H:e===O.length-1?U:U-(O.length-1-e),dt=(e,t,n)=>{He(e),ve(t,e),be(n,e),ft()},ft=()=>{P(),j.value?.setOption({series:[{id:`a`,data:O},{id:`hit-area`,data:O},{id:`line-area`,data:O}],graphic:k}),ce.value++},pt=e=>{dt(e,Math.min(O[e].value[0]+1,We(e)),O[e].value[1])},mt=e=>{dt(e,Math.max(O[e].value[0]-1,Ue(e)),O[e].value[1])},ht=e=>{let t=Math.min(O[e].value[1]+1,G);dt(e,O[e].value[0],t)},gt=e=>{let t=Math.max(O[e].value[1]-1,W);dt(e,O[e].value[0],t)},_t=(e,t)=>{e.preventDefault(),e.deltaY<0?pt(t):mt(t)},vt=(e,t)=>{e.preventDefault(),e.deltaY<0?ht(t):gt(t)},yt=(e,t)=>{t==null||e===0||e===O.length-1||dt(e,Math.max(Ue(e),Math.min(t,We(e))),O[e].value[1])},bt=(e,t)=>{if(t==null)return;let n=Math.max(W,Math.min(t,G));dt(e,O[e].value[0],n)},xt=null,St=null,Ct=e=>{wt(),e(),xt=setTimeout(()=>{St=setInterval(e,ut)},lt)},wt=()=>{xt&&(clearTimeout(xt),xt=null),St&&(clearInterval(St),St=null)},Tt=e=>{if(O.length>=ct||e>=O.length-1)return;let t=O[e].value,n=O[e+1].value,r=n[0]-t[0],i=q*2;if(r<i){let a=i-r,o;o=e===0?H:O[e-1].value[0]+q;let s=Math.max(0,t[0]-o),c;if(c=e+1===O.length-1?U:O[e+2].value[0]-q,s+Math.max(0,c-n[0])<a)return;let l=Math.min(s,a),u=a-l;l>0&&(t[0]-=l),u>0&&(n[0]+=u)}let o=(t[0]+n[0])/2,s=(t[1]+n[1])/2;O.splice(e+1,0,{value:[o,s],symbolSize:fe,itemStyle:{color:pe}}),P(),A.series[0].data=O,A.graphic=k,A.series[2].areaStyle.color=new Ie(0,0,0,j.value?.convertToPixel(`grid`,[0,-100])[1]??100,[{offset:0,color:d.convertColorToRGBA(d.themeColors.accent,.8)},{offset:.5,color:d.convertColorToRGBA(d.themeColors.accent,.3)},{offset:1,color:d.convertColorToRGBA(d.themeColors.accent,.8)}],!0),j.value?.setOption(A),E.value=e+1,M(e+1),ce.value++,a(`changed`,he())},Et=e=>{O.length<=st||e===0||e===O.length-1||(O.splice(e,1),E.value=void 0,Le(),P(),A.series[0].data=O,A.graphic=k,j.value?.setOption(A,{replaceMerge:[`series`,`graphic`],silent:!0}),ce.value++,a(`changed`,he()))},Dt=e=>O.length>st&&e!==0&&e!==O.length-1,Ot=e=>{if(O.length>=ct||e>=O.length-1)return!1;let t=O[e].value,n=O[e+1].value,r=n[0]-t[0],i=q*2;if(r>=i)return!0;let a=i-r,o;o=e===0?H:O[e-1].value[0]+q;let s=Math.max(0,t[0]-o),c;return c=e+1===O.length-1?U:O[e+2].value[0]-q,s+Math.max(0,c-n[0])>=a},kt=e=>{w.value!=null&&(e.deltaY<0?w.value<U&&(w.value+=1):w.value>H&&--w.value)},At=e=>{se.value!=null&&(e.deltaY<0?se.value<G&&(se.value+=1):se.value>W&&--se.value)},jt=()=>{let e=document.getElementById(`control-graph`),t=document.getElementById(`control-panel`);if(e!=null&&t!=null){let n=t.getBoundingClientRect().height;n>56?e.style.height=`max(calc(100vh - (${n}px + 4.5rem)), 20rem)`:e.style.height=`max(calc(100vh - 8rem), 20rem)`,j.value?.setOption({series:[{id:`line-area`,areaStyle:{color:new Ie(0,0,0,j.value?.convertToPixel(`grid`,[0,-100])[1],[{offset:0,color:d.convertColorToRGBA(d.themeColors.accent,.8)},{offset:.5,color:d.convertColorToRGBA(d.themeColors.accent,.3)},{offset:1,color:d.convertColorToRGBA(d.themeColors.accent,.8)}],!0)}}]})}},Mt=()=>{j.value?.setOption({graphic:O.map((e,t)=>({id:t,position:j.value?.convertToPixel(`grid`,e.value)}))})},Nt=()=>{document?.querySelector(`.duty-input`)?.addEventListener(`wheel`,kt),document?.querySelector(`.offset-input`)?.addEventListener(`wheel`,At)};return ee(async()=>{y(E,e=>{for(let[t,n]of O.entries())t===e?(n.symbolSize=fe,n.itemStyle.color=pe):(n.symbolSize=le,n.itemStyle.color=de);j.value?.setOption({series:[{id:`a`,data:O}]})}),window.addEventListener(`resize`,jt),setTimeout(jt),j.value?.chart?.on(`dataZoom`,Mt),window.addEventListener(`resize`,Mt),Nt(),setTimeout(()=>{new ResizeObserver(Ge.default.debounce(()=>{j.value?.setOption({graphic:O.map(function(e,t){return{type:`circle`,position:j.value?.convertToPixel(`grid`,e.value)}})})},200,{leading:!1})).observe(j.value?.$el),ze()},500)}),t(()=>{window.removeEventListener(`resize`,jt),window.removeEventListener(`resize`,Mt)}),(t,n)=>{let r=o(`tooltip`);return b(),l(ie,null,[C(`div`,Ke,[C(`div`,qe,[g((b(),l(`div`,Je,[e(c(ae),{type:`mdi`,class:`h-7`,path:c(_e),size:c(s).getREMSize(1.25)},null,8,[`path`,`size`])])),[[r,c(h)(`views.profiles.graphProfileMouseActions`),void 0,{top:!0}]])])]),C(`div`,R,[e(c(Fe),{id:`control-graph`,class:`pt-6 pr-11 pl-4 pb-6`,ref_key:`controlGraph`,ref:j,option:A,autoresize:!0,"manual-update":!0,onContextmenu:Be,"onZr:click":F,"onZr:contextmenu":Be},null,512),C(`div`,{class:v([`absolute z-10 bg-bg-two/90 border border-border-one rounded-lg shadow-lg max-h-[calc(100vh-6rem)] overflow-y-auto`,L.value])},[C(`div`,z,[C(`span`,Ye,f(c(h)(`views.profiles.points`)),1),g(e(c(T),{onClick:Ve,icon:`pi pi-arrow-up-right-and-arrow-down-left-from-center rotate-90`,text:``,rounded:``,class:`!w-7 !h-7 !p-0`},null,512),[[r,c(h)(`views.profiles.moveTable`),void 0,{top:!0}]])]),C(`table`,Xe,[C(`thead`,Ze,[C(`tr`,Qe,[n[0]||(n[0]=C(`th`,{class:`px-2 py-1 text-left`},`#`,-1)),C(`th`,$e,f(c(h)(`common.duty`)),1),C(`th`,et,f(c(h)(`common.offset`)),1),n[1]||(n[1]=C(`th`,{class:`px-1 py-1 w-6`},null,-1))])]),(b(),l(`tbody`,{key:ce.value},[(b(),l(ie,null,te(O,(t,n)=>C(`tr`,{key:`${ce.value}-${n}`,class:v([`group cursor-pointer`,{"bg-accent/30":n===E.value,"hover:bg-bg-one/20":n!==E.value}]),onClick:e=>He(n)},[C(`td`,nt,f(n+1),1),C(`td`,rt,[C(`div`,{class:`flex items-center justify-center gap-0.5`,onWheel:m(e=>n!==0&&n!==O.length-1&&_t(e,n),[`prevent`])},[e(c(T),{icon:`pi pi-minus`,text:``,size:`small`,class:`!w-5 !h-5 !p-0 [&>span]:text-[0.6rem]`,disabled:n===0||n===O.length-1||O[n].value[0]<=Ue(n),onPointerdown:m(e=>Ct(()=>mt(n)),[`stop`]),onPointerup:m(wt,[`stop`]),onPointerleave:wt},null,8,[`disabled`,`onPointerdown`]),e(c(oe),{modelValue:t.value[0],"onUpdate:modelValue":e=>yt(n,e),onFocus:e=>He(n),mode:`decimal`,minFractionDigits:0,maxFractionDigits:0,min:Ue(n),max:We(n),suffix:c(h)(`common.percentUnit`),disabled:n===0||n===O.length-1,inputStyle:{width:`3rem`,textAlign:`center`,padding:`0.125rem`},class:`table-input`},null,8,[`modelValue`,`onUpdate:modelValue`,`onFocus`,`min`,`max`,`suffix`,`disabled`]),e(c(T),{icon:`pi pi-plus`,text:``,size:`small`,class:`!w-5 !h-5 !p-0 [&>span]:text-[0.6rem]`,disabled:n===0||n===O.length-1||O[n].value[0]>=We(n),onPointerdown:m(e=>Ct(()=>pt(n)),[`stop`]),onPointerup:m(wt,[`stop`]),onPointerleave:wt},null,8,[`disabled`,`onPointerdown`])],40,it)]),C(`td`,B,[C(`div`,{class:`flex items-center justify-center gap-0.5`,onWheel:m(e=>vt(e,n),[`prevent`])},[e(c(T),{icon:`pi pi-minus`,text:``,size:`small`,class:`!w-5 !h-5 !p-0 [&>span]:text-[0.6rem]`,disabled:O[n].value[1]<=W,onPointerdown:m(e=>Ct(()=>gt(n)),[`stop`]),onPointerup:m(wt,[`stop`]),onPointerleave:wt},null,8,[`disabled`,`onPointerdown`]),e(c(oe),{modelValue:Math.round(t.value[1])||0,"onUpdate:modelValue":e=>bt(n,e),onFocus:e=>He(n),mode:`decimal`,minFractionDigits:0,maxFractionDigits:0,min:W,max:G,suffix:c(h)(`common.percentUnit`),inputStyle:{width:`3.5rem`,textAlign:`center`,padding:`0.125rem`},class:`table-input`},null,8,[`modelValue`,`onUpdate:modelValue`,`onFocus`,`suffix`]),e(c(T),{icon:`pi pi-plus`,text:``,size:`small`,class:`!w-5 !h-5 !p-0 [&>span]:text-[0.6rem]`,disabled:O[n].value[1]>=G,onPointerdown:m(e=>Ct(()=>ht(n)),[`stop`]),onPointerup:m(wt,[`stop`]),onPointerleave:wt},null,8,[`disabled`,`onPointerdown`])],40,at)]),C(`td`,ot,[C(`div`,V,[Ot(n)?g((b(),p(c(T),{key:0,icon:`pi pi-plus-circle`,text:``,severity:`success`,size:`small`,class:`!w-6 !h-6 !p-0`,onClick:m(e=>Tt(n),[`stop`])},null,8,[`onClick`])),[[r,c(h)(`views.profiles.addPointAfter`),void 0,{top:!0}]]):S(``,!0),Dt(n)?g((b(),p(c(T),{key:1,icon:`pi pi-trash`,text:``,severity:`danger`,size:`small`,class:`!w-6 !h-6 !p-0`,onClick:m(e=>Et(n),[`stop`])},null,8,[`onClick`])),[[r,c(h)(`views.profiles.removePoint`),void 0,{top:!0}]]):S(``,!0)])])],10,tt)),64))]))])],2)])],64)}}}),[[`__scopeId`,`data-v-3547d2cc`]]),ft={id:`control-panel`,class:`flex border-b-4 border-border-one items-center justify-between`},pt={class:`flex flex-wrap gap-x-1 justify-end`},mt={key:0,class:`p-2 pr-0 flex flex-row`},ht={key:1,class:`p-2 pr-0 flex flex-row`},gt={key:2,class:`flex flex-wrap justify-end`},_t={class:`p-2 pr-1`},vt={class:`p-2 pr-0`},yt={class:`flex items-center`},bt={class:`flex w-full items-center justify-between`},xt={class:`flex items-center gap-3`},St={key:0,class:`text-xs opacity-70`},Ct={key:3,class:`p-2 pr-0`},wt={class:`p-2`},Tt={key:0,class:`flex flex-col w-full`},Et={class:`flex flex-row justify-between mt-4 w-full`},Dt={class:`flex flex-row items-center`},Ot={class:`p-2 mx-4 leading-none items-center`},kt={key:0,class:`text-sm opacity-70`},At={id:`profile-display`,class:`flex flex-col h-full`},jt={key:0,class:`text-center text-3xl m-8`},Mt={key:2,class:`relative`},Nt={class:`flex justify-between items-center px-2 py-1 border-b border-border-one sticky top-0 bg-bg-two/95`},Pt={class:`font-semibold text-text-color cursor-default`},Ft={class:`w-full`},It={class:`sticky top-7 bg-bg-two/95 cursor-default`},Lt={class:`text-text-color-secondary`},Rt={class:`px-1 py-1 text-center`},zt={class:`px-1 py-1 text-center`},Bt=[`onClick`],Vt={class:`px-2 py-0.5 text-text-color-secondary`},Ht={class:`pr-2 py-1`},Ut=[`onWheel`],Wt={class:`px-2 py-0.5`},Gt=[`onWheel`],Kt={class:`px-0.5 py-0.5`},qt={class:`flex gap-0.5 opacity-0 group-hover:opacity-100`},Jt=0,Yt=150,J=0,Y=100,Xt=-100,Zt=100,X=1,Qt=400,$t=75,en=be(a({__name:`ProfileView`,props:{profileUID:{}},setup(n){Oe([Ae,ke,je,Pe,Ee,we,Te,Me,De,Ne]);let a=n,d=r(`emitter`),E=ue(),pe=i(E.$state),D=ge(),k=ye(),be=ve(),Re=O(),{t:N}=re(),{getLimitInfo:P}=Ce(),F=_(!1),Be=_(0),I=x(()=>D.profiles.find(e=>e.uid===a.profileUID)),L=_(I.value.p_type),Ve=x(()=>[...xe(j).values()].map(e=>({value:e,label:fe(e)}))),He=x(()=>[...xe(le).values()].map(e=>({value:e,label:ce(e)}))),Ue=_(!1),Ke=_([]),qe=()=>{Ke.value.length=0;for(let e of E.allDevices()){if(e.status.temps.length===0||e.info==null)continue;let t=D.allUIDeviceSettings.get(e.uid),n={deviceUID:e.uid,deviceName:t.name,profileMinLength:e.info.profile_min_length,profileMaxLength:e.info.profile_max_length,amdGpuOverdrive:e.info.amd_gpu_overdrive,tempMin:e.info.temp_min,tempMax:e.info.temp_max,temps:[]};for(let r of e.status.temps)n.temps.push({deviceUID:e.uid,tempName:r.name,tempFrontendName:t.sensorsAndChannels.get(r.name).name,lineColor:t.sensorsAndChannels.get(r.name).color,temp:r.temp.toFixed(1),limitInfo:P({profileMaxLength:n.profileMaxLength,amdGpuOverdrive:n.amdGpuOverdrive,tempName:r.name})});n.temps.length!==0&&Ke.value.push(n)}};qe();let Je=(e,t)=>{if(e==null||t==null)return;let n=Ke.value.find(t=>t.deviceUID===e),r=n?.temps.find(e=>e.tempName===t);if(n!=null&&r!=null)return{deviceUID:n.deviceUID,deviceName:n.deviceName,profileMinLength:n.profileMinLength,profileMaxLength:n.profileMaxLength,amdGpuOverdrive:n.amdGpuOverdrive,tempMin:n.tempMin,tempMax:n.tempMax,tempName:r.tempName,tempFrontendName:r.tempFrontendName,color:r.lineColor}},R=Je(I.value.temp_source?.device_uid,I.value.temp_source?.temp_name),z=_(),Ye=x(()=>z.value?.limitInfo??null),Xe=_(D.functions.find(e=>e.uid===I.value.function_uid)),Ze=x(()=>D.profiles.filter(e=>e.uid===a.profileUID?!1:e.p_type===j.Graph||e.p_type===j.Fixed?!0:!(e.p_type!==j.Mix||e.member_profile_uids.some(e=>D.profiles.find(t=>t.uid===e)?.p_type===j.Mix)||e.member_profile_uids.includes(a.profileUID)||D.profiles.some(e=>e.p_type===j.Mix&&e.uid!==a.profileUID&&e.member_profile_uids.includes(a.profileUID))))),Qe=x(()=>D.profiles.filter(e=>e.uid!==a.profileUID&&(e.p_type===j.Graph||e.p_type===j.Mix))),$e=_(I.value.member_profile_uids.map(e=>D.profiles.find(t=>t.uid===e))),et=_(I.value.member_profile_uids.length==1?D.profiles.find(e=>e.uid===I.value.member_profile_uids[0]):void 0),tt=_(I.value.mix_function_type==null?le.Max:I.value.mix_function_type),nt=_(I.value.offset_profile==null||I.value.offset_profile.length<2?`static`:`graph`),rt=[{value:`static`,label:N(`views.profiles.offsetTypeStatic`)},{value:`graph`,label:N(`views.profiles.offsetTypeGraph`)}],it=_(),B=_(),at=_(),ot=_([]),V=_(),H=_(),U=_(100);I.value.offset_profile!=null&&I.value.offset_profile.length>1&&(ot.value=I.value.offset_profile);let W=E.getREMSize(1),G=k.themeColors.bg_two,st=E.getREMSize(1.25),ct=k.themeColors.accent,K=_(I.value.temp_min??0),q=_(I.value.temp_max??100),lt=!0,ut=x(()=>at.value!=null&&at.value>0?`+`:``),en=(e,t,n,r)=>{let i=[],a=(t-e)/(n-1);for(let t=0;t<n;t++){let n=e+a*t;i.push(E.round(n,r))}return i},tn=()=>{let e=[];if(R!=null){let t=R.profileMinLength<=5&&R.profileMaxLength>=5?5:R.profileMaxLength,n=en(Math.max(R.tempMin,K.value),Math.min(R.tempMax,q.value),t,1),r=en(J,Y,t,0);for(let[t,i]of n.entries())e.push({value:[i,r[t]],symbolSize:W,itemStyle:{color:G}})}else for(let t=0;t<100;t+=25){let n=25*t;e.push({value:[n,n],symbolSize:W,itemStyle:{color:G}})}return e},Z=[],nn=()=>{if(Z.length=0,I.value.speed_profile.length>1&&R!=null)for(let e of I.value.speed_profile)Z.push({value:[e[0],e[1]],symbolSize:W,itemStyle:{color:G}});else Z.push(...tn())};nn();let rn=[[{xAxis:K.value},{xAxis:K.value}],[{xAxis:q.value},{xAxis:q.value}]],an=[],on=[{value:[]},{value:[]}],sn=()=>{if(R==null)return;let e=E.currentDeviceStatus.get(R.deviceUID)?.get(R.tempName)?.temp;e!=null&&(H.value=Number(e))};sn();let Q={title:{show:!1},tooltip:{position:`top`,appendTo:`body`,triggerOn:`none`,borderWidth:2,borderColor:k.themeColors.border,backgroundColor:k.themeColors.bg_two,textStyle:{color:k.themeColors.text_color,fontSize:E.getREMSize(1)},padding:[0,5,1,7],transitionDuration:0,formatter:function(e){return e.data.value[0].toFixed(1)+N(`common.tempUnit`)+` `+e.data.value[1].toFixed(0)+N(`common.percentUnit`)}},grid:{show:!1,top:E.getREMSize(.7),left:0,right:E.getREMSize(1.2),bottom:0,containLabel:!0},xAxis:{min:K.value,max:q.value,type:`value`,splitNumber:10,axisLabel:{fontSize:E.getREMSize(.95),color:k.themeColors.text_color_secondary,formatter:e=>`${e}${N(`common.tempUnit`)} `},axisLine:{lineStyle:{color:k.themeColors.text_color,width:1}},splitLine:{lineStyle:{color:k.themeColors.border,width:.5,type:`dotted`}}},yAxis:{min:J,max:Y,type:`value`,splitNumber:10,cursor:`no-drop`,axisLabel:{fontSize:E.getREMSize(.95),color:k.themeColors.text_color_secondary,formatter:e=>`${e}${N(`common.percentUnit`)}`},axisLine:{lineStyle:{color:k.themeColors.text_color,width:1}},splitLine:{lineStyle:{color:k.themeColors.border,width:.5,type:`dotted`}}},dataZoom:[{type:`inside`,xAxisIndex:0,filterMode:`none`,preventDefaultMouseMove:!1,throttle:25}],series:[{id:`a`,type:`line`,smooth:0,symbol:`circle`,symbolSize:W,itemStyle:{color:k.themeColors.bg_two,borderColor:k.themeColors.accent,borderWidth:2},lineStyle:{color:k.themeColors.accent,width:6,type:`solid`,shadowColor:void 0,shadowBlur:20},emphasis:{disabled:!0},markArea:{silent:!0,itemStyle:{color:new Ie(0,0,0,1,[{offset:0,color:k.convertColorToRGBA(k.themeColors.red,.2)},{offset:1,color:k.convertColorToRGBA(k.themeColors.red,0)}])},emphasis:{disabled:!0},data:rn,animation:!0,animationDuration:300,animationDurationUpdate:100},cursor:`no-drop`,data:Z},{id:`hit-area`,type:`line`,smooth:0,symbol:`none`,lineStyle:{color:`transparent`,width:12},emphasis:{disabled:!0},silent:!1,z:5,data:Z},{id:`tempLine`,type:`line`,smooth:!1,symbol:`none`,lineStyle:{color:k.themeColors.accent,width:1,type:`dashed`},emphasis:{disabled:!0},data:on,markPoint:{symbolSize:0,label:{position:`top`,fontSize:E.getREMSize(1),color:R?.color,rotate:90,offset:[0,-2],formatter:e=>e.value==null?``:Number(e.value).toFixed(1)+`°`},data:[{coord:[H.value,95],value:H.value}]},z:1,silent:!0},{id:`line-area`,type:`line`,smooth:0,symbol:`none`,lineStyle:{color:`transparent`,width:0},emphasis:{disabled:!0},areaStyle:{color:new Ie(0,0,0,1,[{offset:0,color:k.convertColorToRGBA(k.themeColors.accent,.5)},{offset:1,color:k.convertColorToRGBA(k.themeColors.accent,0)}]),opacity:1},silent:!0,z:0,data:Z}],animation:!0,animationDuration:200,animationDurationUpdate:200},cn=()=>{if(R!=null){if(lt)nn(),lt=!1;else{Z[0].value[0]=Math.max(R.tempMin,K.value),Z[Z.length-1].value[0]=Math.min(R.tempMax,q.value);for(let e=1;e<Z.length-1;e++)dn(Z[e].value[0],e)}if(I.value.temp_min==null&&R.tempMin>K.value+5)K.value=R.tempMin-5,Q.xAxis.min=R.tempMin-5;else if(I.value.temp_min==null&&I.value.speed_profile.length>0)K.value=I.value.speed_profile[0][0],Q.xAxis.min=I.value.speed_profile[0][0];else if(I.value.temp_min!=null){let e=Math.max(I.value.temp_min,Jt);Q.xAxis.min=e,K.value=e}if(I.value.temp_max==null&&R.tempMax<q.value-5){let e=Math.min(R.tempMax+5,100);q.value=e,Q.xAxis.max=e}else if(I.value.temp_max==null&&I.value.speed_profile.length>0){let e=Math.min(I.value.speed_profile[I.value.speed_profile.length-1][0]+5,100);q.value=e,Q.xAxis.max=e}else if(I.value.temp_max!=null){let e=Math.min(I.value.temp_max,Yt);Q.xAxis.max=e,q.value=e}rn[0]=[{xAxis:K.value},{xAxis:R.tempMin}],rn[1]=[{xAxis:Math.min(R.tempMax,100)},{xAxis:q.value}],sn(),Q.series[2].lineStyle.color=R.color,Q.series[2].markPoint.label.color=R.color,Q.series[2].markPoint.data[0].coord[0]=H.value,Q.series[2].markPoint.data[0].value=H.value,on[0].value=[H.value,J],on[1].value=[H.value,Y]}},ln=()=>{Xe.value.f_type===se.Identity?(Q.series[0].smooth=0,Q.series[1].smooth=0,Q.series[3].smooth=0,Q.series[0].lineStyle.shadowColor=k.themeColors.bg_one,Q.series[0].lineStyle.shadowBlur=10):(Q.series[0].smooth=.1,Q.series[1].smooth=.1,Q.series[3].smooth=.1,Q.series[0].lineStyle.shadowColor=k.themeColors.accent,Q.series[0].lineStyle.shadowBlur=20)};if(R!=null){for(let e of Ke.value)if(e.deviceUID===R.deviceUID){for(let t of e.temps)if(t.deviceUID===R.deviceUID&&t.tempName===R.tempName){z.value=t;break}}cn(),ln()}let un=()=>{for(let e of Ke.value)for(let t of e.temps)t.temp=E.currentDeviceStatus.get(t.deviceUID).get(t.tempName).temp||`0.0`};y(z,()=>{R=Je(z.value?.deviceUID,z.value?.tempName),cn(),$.value?.setOption(Q)}),y(Xe,()=>{ln(),bn(),$.value?.setOption(Q)}),y(pe.currentDeviceStatus,()=>{un(),R!=null&&(sn(),on[0].value=[H.value,J],on[1].value=[H.value,Y],$.value?.setOption({series:{id:`tempLine`,data:on,markPoint:{data:[{coord:[H.value,95],value:H.value}]}}}))}),y(D.allUIDeviceSettings,()=>{qe(),R=Je(z.value?.deviceUID,z.value?.tempName),R!=null&&(Q.series[2].lineStyle.color=R.color,$.value?.setOption({series:{id:`tempLine`,lineStyle:{color:R?.color},markPoint:{label:{color:R?.color}}}}))});let dn=(e,t)=>{let n=Math.max(R.tempMin,K.value)+t,r=Math.min(R.tempMax,q.value)-(Z.length-(t+1));t===0?e=n:t===Z.length-1&&(e=r),e<n?e=n:e>r&&(e=r),Z[t].value[0]=e;for(let n=t+1;n<Z.length;n++){let r=n-t,i=e+r;Z[n].value[0]<=i&&(Z[n].value[0]=i)}for(let n=0;n<t;n++){let r=t-n,i=e-r;Z[n].value[0]>=i&&(Z[n].value[0]=i)}F.value=!0},fn=(e,t)=>{if(t!==Z.length-1){e<J?e=J:e>Y&&(e=Y),Z[t].value[1]=e;for(let n=t+1;n<Z.length;n++)Z[n].value[1]<e&&(Z[n].value[1]=e);for(let n=0;n<t;n++)Z[n].value[1]>e&&(Z[n].value[1]=e);F.value=!0}},$=_(null),pn=e=>{it.value=E.round(Z[e].value[0],1),B.value=E.round(Z[e].value[1])},mn=(e,t)=>{Z[e].value=t,$.value?.setOption({series:[{id:`a`,data:Z},{id:`hit-area`,data:Z},{id:`line-area`,data:Z}]})},hn=(e,t)=>{dn(t[0],e),fn(t[1],e),$.value?.setOption({series:[{id:`a`,data:Z,markArea:{data:rn}},{id:`hit-area`,data:Z},{id:`line-area`,data:Z}],graphic:Z.slice(0,Z.length-1).map((e,t)=>({id:t,type:`circle`,position:$.value?.convertToPixel(`grid`,e.value)})),xAxis:{min:K.value,max:q.value}}),Be.value++},gn=e=>{$.value?.dispatchAction({type:`showTip`,seriesIndex:0,dataIndex:e})},_n=()=>{$.value?.dispatchAction({type:`hideTip`})},vn=()=>y([it,B],e=>{V.value!=null&&(dn(e[0],V.value),fn(e[1],V.value),Z.slice(0,Z.length-1).forEach((e,t)=>an[t].position=$.value?.convertToPixel(`grid`,e.value)),$.value?.setOption({series:[{id:`a`,data:Z},{id:`hit-area`,data:Z},{id:`line-area`,data:Z}],graphic:an}))},{flush:`post`}),yn=vn(),bn=()=>{let e=(e,t)=>({id:e,type:`circle`,position:$.value?.convertToPixel(`grid`,t),shape:{cx:0,cy:0,r:st/2+3},cursor:`grab`,silent:!1,invisible:!0,draggable:!0,ondrag:function(t){t?.event?.buttons===1&&(mn(e,$.value?.convertFromPixel(`grid`,[this.x,this.y])??[0,0]),gn(e),this.cursor=`grabbing`)},onmouseup:function(){hn(e,$.value?.convertFromPixel(`grid`,[this.x,this.y])??[0,0]),pn(e),this.cursor=`grab`},ondragend:function(){let[t,n]=$.value?.convertFromPixel(`grid`,[this.x,this.y])??[0,0];(t<K.value||t>q.value||n<J||n>Y)&&(hn(e,[t,n]),pn(e),this.cursor=`grab`)},onmouseover:function(t){t?.event?.buttons===0&&(yn(),pn(e),V.value=e,gn(e),this.cursor=`grab`)},onmouseout:function(e){e?.event?.buttons===0&&(yn(),yn=vn(),_n())},z:100});an.length=0,an.push(...Z.slice(0,Z.length-1).map((t,n)=>e(n,t.value)))},xn=()=>{bn(),$.value?.setOption({graphic:an})},Sn=e=>{if(e.target?.type!==`ec-polyline`||Z.length>=R.profileMaxLength)return;V.value=void 0;let t=$.value?.convertFromPixel(`grid`,[e.offsetX,e.offsetY])??[0,0];t[1]=Math.min(Math.max(t[1],J),Y);let n=1;for(let[e,r]of Z.entries())if(r.value[0]>t[0]){n=e;break}let r=Z[n-1],i=Z[n];t[1]=Math.max(t[1],r.value[1]),t[1]=Math.min(t[1],i.value[1]);let a;a=n-1==0?Math.max(R.tempMin,K.value):Z[n-2].value[0]+X;let o=Math.max(0,r.value[0]-a),s;s=n===Z.length-1?Math.min(R.tempMax,q.value):Z[n+1].value[0]-X;let c=Math.max(0,s-i.value[0]),l=r.value[0]+X-o,u=i.value[0]-X+c;if(l>u)return;t[0]=Math.max(l,Math.min(u,t[0]));let d=t[0]-r.value[0],ee=i.value[0]-t[0];d<X&&(r.value[0]=t[0]-X),ee<X&&(i.value[0]=t[0]+X),Z.splice(n,0,{value:t,symbolSize:st,itemStyle:{color:ct}}),bn(),Q.series[0].data=Z,Q.graphic=an,$.value?.setOption(Q),yn(),pn(n),setTimeout(()=>V.value=n,50),setTimeout(()=>gn(n),350),Be.value++,F.value=!0},Cn=e=>{if(e.componentType!==`graphic`||e.event?.target?.id==null){e.stop&&e.stop();return}if(e.event.stop(),Z.length<=R.profileMinLength)return;let t=Number(e.event.target.id);t===0||t===Z.length-1||(Z.splice(t,1),V.value=void 0,_n(),bn(),Q.series[0].data=Z,Q.graphic=an,$.value?.setOption(Q,{replaceMerge:[`series`,`graphic`],silent:!0}),Be.value++,F.value=!0)},wn=_(`top-left`),Tn=x(()=>({"top-16 left-[5.5rem]":wn.value===`top-left`,"bottom-16 right-[7rem]":wn.value===`bottom-right`})),En=()=>{wn.value=wn.value===`top-left`?`bottom-right`:`top-left`},Dn=e=>{yn(),V.value=e,pn(e)},On=e=>R==null?K.value:Math.max(R.tempMin,K.value)+e,kn=e=>R==null?q.value:e===0?Math.max(R.tempMin,K.value):e===Z.length-1?Math.min(R.tempMax,q.value):Math.min(R.tempMax,q.value)-(Z.length-1-e),An=(e,t,n)=>{Dn(e),dn(t,e),fn(n,e),jn(e)},jn=e=>{bn(),$.value?.setOption({series:[{id:`a`,data:Z},{id:`hit-area`,data:Z},{id:`line-area`,data:Z}],graphic:an}),Be.value++},Mn=e=>{An(e,Math.min(Z[e].value[0]+.1,kn(e)),Z[e].value[1])},Nn=e=>{An(e,Math.max(Z[e].value[0]-.1,On(e)),Z[e].value[1])},Pn=e=>{if(e===Z.length-1)return;let t=Math.min(Z[e].value[1]+1,Y);An(e,Z[e].value[0],t)},Fn=e=>{if(e===Z.length-1)return;let t=Math.max(Z[e].value[1]-1,J);An(e,Z[e].value[0],t)},In=(e,t)=>{e.preventDefault(),e.deltaY<0?Mn(t):Nn(t)},Ln=(e,t)=>{e.preventDefault(),e.deltaY<0?Pn(t):Fn(t)},Rn=(e,t)=>{t==null||e===0||e===Z.length-1||An(e,Math.max(On(e),Math.min(t,kn(e))),Z[e].value[1])},zn=(e,t)=>{if(t==null||e===Z.length-1)return;let n=Math.max(J,Math.min(t,Y));An(e,Z[e].value[0],n)},Bn=null,Vn=null,Hn=e=>{Un(),e(),Bn=setTimeout(()=>{Vn=setInterval(e,$t)},Qt)},Un=()=>{Bn&&(clearTimeout(Bn),Bn=null),Vn&&(clearInterval(Vn),Vn=null)},Wn=e=>{if(Z.length>=R.profileMaxLength||e>=Z.length-1)return;let t=Z[e].value,n=Z[e+1].value,r=n[0]-t[0],i=X*2;if(r<i){let a=i-r,o;o=e===0?Math.max(R.tempMin,K.value):Z[e-1].value[0]+X;let s=Math.max(0,t[0]-o),c;if(c=e+1===Z.length-1?Math.min(R.tempMax,q.value):Z[e+2].value[0]-X,s+Math.max(0,c-n[0])<a)return;let l=Math.min(s,a),u=a-l;l>0&&(t[0]-=l),u>0&&(n[0]+=u)}let a=(t[0]+n[0])/2,o=Math.min(Math.max((t[1]+n[1])/2,t[1]),n[1]);Z.splice(e+1,0,{value:[a,o],symbolSize:st,itemStyle:{color:ct}}),bn(),Q.series[0].data=Z,Q.graphic=an,$.value?.setOption(Q),V.value=e+1,pn(e+1),Be.value++,F.value=!0},Gn=e=>{Z.length<=R.profileMinLength||e===0||e===Z.length-1||(Z.splice(e,1),V.value=void 0,_n(),bn(),Q.series[0].data=Z,Q.graphic=an,$.value?.setOption(Q,{replaceMerge:[`series`,`graphic`],silent:!0}),Be.value++,F.value=!0)},Kn=e=>Z.length>R.profileMinLength&&e!==0&&e!==Z.length-1,qn=e=>{if(Z.length>=R.profileMaxLength||e>=Z.length-1)return!1;let t=Z[e].value,n=Z[e+1].value,r=n[0]-t[0],i=X*2;if(r>=i)return!0;let a=i-r,o;o=e===0?Math.max(R.tempMin,K.value):Z[e-1].value[0]+X;let s=Math.max(0,t[0]-o),c;return c=e+1===Z.length-1?Math.min(R.tempMax,q.value):Z[e+2].value[0]-X,s+Math.max(0,c-n[0])>=a},Jn=x(()=>{let e=L.value!=null&&L.value===j.Graph&&z.value!=null;return e&&setTimeout(()=>{new ResizeObserver(Ge.default.debounce(()=>{$.value?.setOption({graphic:Z.map(function(e,t){return{type:`circle`,position:$.value?.convertToPixel(`grid`,e.value)}})})},200,{leading:!1})).observe($.value?.$el),xn()},500),e}),Yn=x(()=>{let e=L.value!=null&&L.value===j.Fixed;return e&&(B.value=I.value.speed_fixed??50,V.value=void 0),e}),Xn=x(()=>{let e=L.value!=null&&L.value===j.Overlay&&nt.value===`static`;return e&&(I.value.offset_profile!=null&&I.value.offset_profile.length===1?at.value=I.value.offset_profile[0][1]:at.value=0),e}),Zn=x(()=>L.value!=null&&L.value===j.Mix&&$e.value.length>1),Qn=x(()=>L.value!=null&&L.value===j.Overlay&&et.value!=null),$n=x(()=>$e.value.map(e=>e.uid).join(`:`)),er=x(()=>R==null?K.value:Math.max(R.tempMin,K.value)+(V.value??0)),tr=x(()=>R==null?q.value:V.value===0?Math.max(R.tempMin,K.value):V.value===Z.length-1?Math.min(R.tempMax,q.value):Math.min(R.tempMax,q.value)-(Z.length-1-(V.value??0))),nr=x(()=>Jt),rr=x(()=>Math.min(Yt,q.value-20)),ir=x(()=>Math.max(Jt,K.value+20)),ar=x(()=>Yt),or=async()=>{if(I.value.uid===`0`){console.error(`Changing of the default Profile is not allowed.`);return}if(I.value.p_type=L.value,I.value.p_type===j.Fixed)I.value.speed_fixed=B.value,I.value.speed_profile.length=0,I.value.temp_source=void 0,I.value.temp_min=void 0,I.value.temp_max=void 0,I.value.function_uid=`0`,I.value.member_profile_uids.length=0,I.value.mix_function_type=void 0,I.value.offset_profile=[];else if(I.value.p_type===j.Graph){if(R===void 0){Ue.value=!0,be.add({severity:`error`,summary:N(`common.error`),detail:N(`views.profiles.tempSourceRequired`),life:4e3});return}else Ue.value=!1;let e=[];for(let t of Z)e.push(t.value);I.value.speed_profile=e,I.value.temp_source=new de(R.tempName,R.deviceUID),I.value.temp_min=K.value,I.value.temp_max=q.value,I.value.function_uid=Xe.value.uid,I.value.speed_fixed=void 0,I.value.member_profile_uids.length=0,I.value.mix_function_type=void 0,I.value.offset_profile=[]}else if(I.value.p_type===j.Mix){if($e.value.length<2){be.add({severity:`error`,summary:N(`common.error`),detail:N(`views.profiles.memberProfilesRequired`),life:4e3});return}I.value.speed_fixed=void 0,I.value.speed_profile.length=0,I.value.temp_source=void 0,I.value.temp_min=void 0,I.value.temp_max=void 0,I.value.function_uid=`0`,I.value.member_profile_uids=$e.value.map(e=>e.uid),I.value.mix_function_type=tt.value,I.value.offset_profile=[]}else if(I.value.p_type===j.Overlay){if(et.value==null){console.error(`Overlay member profile can not be empty`),be.add({severity:`error`,summary:N(`common.error`),detail:N(`views.profiles.baseProfileRequired`),life:4e3});return}I.value.speed_fixed=void 0,I.value.speed_profile.length=0,I.value.temp_source=void 0,I.value.temp_min=void 0,I.value.temp_max=void 0,I.value.function_uid=`0`,I.value.member_profile_uids=[et.value.uid],I.value.mix_function_type=void 0;let e=[];if(nt.value===`static`)e.push([50,at.value??0]);else for(let t of ot.value)e.push(t);I.value.offset_profile=e}await D.updateProfile(I.value.uid)?(F.value=!1,be.add({severity:`success`,summary:N(`common.success`),detail:N(`views.profiles.profileUpdated`),life:3e3})):be.add({severity:`error`,summary:N(`common.error`),detail:N(`views.profiles.profileUpdateError`),life:3e3})},sr=async e=>{if(e.length>0){let t=I.value.name;return I.value.name=e,await D.updateProfile(I.value.uid)?(d.emit(`profile-name-update`,{profileUID:I.value.uid,name:e}),!0):(I.value.name=t,!1)}return!1},cr=e=>{it.value!=null&&(e.deltaY<0?it.value<tr.value&&(it.value+=1):it.value>er.value&&--it.value)},lr=e=>{B.value!=null&&(e.deltaY<0?B.value<Y&&(B.value+=1):B.value>J&&--B.value)},ur=()=>{document?.querySelector(`.temp-input`)?.addEventListener(`wheel`,cr),document?.querySelector(`.duty-input`)?.addEventListener(`wheel`,lr),document?.querySelector(`.duty-knob-input`)?.addEventListener(`wheel`,lr)},dr=()=>{if(I.value.p_type===j.Fixed)return I.value.speed_fixed===B.value;if(I.value.p_type===j.Graph){if(R===void 0)return!1;let e=[];for(let t of Z)e.push(t.value);return Ge.default.isEqual(I.value.speed_profile,e)&&I.value.temp_source?.temp_name===R.tempName&&I.value.temp_source?.device_uid===R.deviceUID&&I.value.function_uid===Xe.value.uid}else if(I.value.p_type===j.Mix)return Ge.default.isEqual(I.value.member_profile_uids,$e.value.map(e=>e.uid))&&I.value.mix_function_type===tt.value;return!0},fr=(e,t,n)=>{if(!F.value&&dr()){n();return}Re.require({message:N(`views.profiles.unsavedChanges`),header:N(`views.profiles.unsavedChangesHeader`),icon:`pi pi-exclamation-triangle`,defaultFocus:`accept`,rejectLabel:N(`common.stay`),acceptLabel:N(`common.discard`),accept:()=>{n(),F.value=!1},reject:()=>n(!1)})},pr=()=>{let e=document.getElementById(`control-graph`),t=document.getElementById(`control-panel`);if(e!=null&&t!=null){let n=t.getBoundingClientRect().height;n>56?e.style.height=`max(calc(100vh - (${n}px + 4.5rem)), 20rem)`:e.style.height=`max(calc(100vh - 8rem), 20rem)`}},mr=()=>{$.value?.setOption({graphic:Z.slice(0,Z.length-1).map((e,t)=>({id:t,position:$.value?.convertToPixel(`grid`,e.value)}))})},hr=()=>{let e=document.getElementById(`profile-display`);if(e==null)return;let t=e.getBoundingClientRect().width,n=e.getBoundingClientRect().height;U.value=Math.max(Math.min(t,n)-E.getREMSize(4),E.getREMSize(27))};ee(async()=>{y(V,e=>{for(let[t,n]of Z.entries())t===e?(n.symbolSize=st,n.itemStyle.color=ct):(n.symbolSize=W,n.itemStyle.color=G);$.value?.setOption({series:[{id:`a`,data:Z}]})}),window.addEventListener(`resize`,pr),setTimeout(pr),$.value?.chart?.on(`dataZoom`,mr),window.addEventListener(`resize`,mr),setTimeout(hr),window.addEventListener(`resize`,hr),ur(),y(L,()=>{s(ur)}),y([L,z],()=>{setTimeout(pr)}),y(K,e=>{Q.xAxis.min=e,rn[0]=[{xAxis:e},{xAxis:R.tempMin}],hn(0,[Math.max(R.tempMin,e),Z[0].value[1]]),V.value!=null&&pn(V.value),$.value?.setOption({graphic:Z.slice(0,Z.length-1).map((e,t)=>({id:t,type:`circle`,position:$.value?.convertToPixel(`grid`,e.value)}))})}),y(q,e=>{Q.xAxis.max=e,rn[1]=[{xAxis:Math.min(R.tempMax,100)},{xAxis:e}],hn(Z.length-1,[Math.min(R.tempMax,e),Z[Z.length-1].value[1]]),V.value!=null&&pn(V.value),$.value?.setOption({graphic:Z.slice(0,Z.length-1).map((e,t)=>({id:t,type:`circle`,position:$.value?.convertToPixel(`grid`,e.value)}))})}),y([$e,z,Xe,tt,L,K,q,nt,et,at,ot],()=>{F.value=!0}),me(fr),he(fr)}),t(()=>{window.removeEventListener(`resize`,pr),window.removeEventListener(`resize`,mr),window.removeEventListener(`resize`,hr),Un()});function gr(e){e.button!==0&&(e.stopImmediatePropagation(),e.preventDefault())}function _r(e){e.button!==3&&e.button!==4||(e.button===3?window.history.back():e.button===4&&window.history.forward())}return(t,n)=>{let r=o(`tooltip`);return b(),l(ie,null,[C(`div`,ft,[e(Le,{"current-name":I.value.name,"save-name-function":sr},null,8,[`current-name`]),C(`div`,pt,[L.value===c(j).Mix?(b(),l(`div`,mt,[g(e(c(M),{modelValue:tt.value,"onUpdate:modelValue":n[0]||(n[0]=e=>tt.value=e),options:He.value,"option-label":`label`,"option-value":`value`,placeholder:c(N)(`views.profiles.mixFunction`),class:`max-w-48 mr-3`,checkmark:``,"dropdown-icon":`pi pi-sliders-v`,"scroll-height":`40rem`},null,8,[`modelValue`,`options`,`placeholder`]),[[r,c(N)(`views.profiles.applyMixFunction`),void 0,{top:!0}]]),g(e(c(Se),{modelValue:$e.value,"onUpdate:modelValue":n[1]||(n[1]=e=>$e.value=e),options:Ze.value,"option-label":`name`,placeholder:c(N)(`views.profiles.memberProfiles`),class:`max-w-48`,"scroll-height":`40rem`,"dropdown-icon":`pi pi-chart-line`,invalid:$e.value.length<2},null,8,[`modelValue`,`options`,`placeholder`,`invalid`]),[[r,c(N)(`views.profiles.profilesToMix`),void 0,{top:!0}]])])):L.value===c(j).Overlay?(b(),l(`div`,ht,[nt.value===`static`?g((b(),p(c(oe),{key:0,placeholder:c(N)(`common.offset`),modelValue:at.value,"onUpdate:modelValue":n[2]||(n[2]=e=>at.value=e),mode:`decimal`,class:`w-full h-[2.375rem] mr-3`,suffix:` ${c(N)(`common.percentUnit`)}`,prefix:ut.value,showButtons:``,min:Xt,max:Zt,"use-grouping":!1,step:1,"button-layout":`horizontal`,"input-style":{width:`5rem`},disabled:et.value==null},{incrementicon:h(()=>[...n[14]||(n[14]=[C(`span`,{class:`pi pi-plus`},null,-1)])]),decrementicon:h(()=>[...n[15]||(n[15]=[C(`span`,{class:`pi pi-minus`},null,-1)])]),_:1},8,[`placeholder`,`modelValue`,`suffix`,`prefix`,`disabled`])),[[r,c(N)(`views.profiles.staticOffset`),void 0,{top:!0}]]):S(``,!0),g(e(c(M),{modelValue:nt.value,"onUpdate:modelValue":n[3]||(n[3]=e=>nt.value=e),options:rt,"option-label":`label`,"option-value":`value`,placeholder:c(N)(`views.profiles.offsetType`),class:`max-w-48 mr-3`,checkmark:``,"dropdown-icon":`pi pi-sliders-v`,"scroll-height":`40rem`},null,8,[`modelValue`,`placeholder`]),[[r,c(N)(`views.profiles.offsetType`),void 0,{top:!0}]]),g(e(c(M),{modelValue:et.value,"onUpdate:modelValue":n[4]||(n[4]=e=>et.value=e),options:Qe.value,"option-label":`name`,placeholder:c(N)(`views.profiles.baseProfile`),class:`max-w-48`,"scroll-height":`40rem`,"dropdown-icon":`pi pi-chart-line`,invalid:et.value==null},null,8,[`modelValue`,`options`,`placeholder`,`invalid`]),[[r,c(N)(`views.profiles.baseProfile`),void 0,{top:!0}]])])):L.value===c(j).Graph?(b(),l(`div`,gt,[C(`div`,_t,[g(e(c(M),{modelValue:Xe.value,"onUpdate:modelValue":n[5]||(n[5]=e=>Xe.value=e),options:c(D).functions,"option-label":`name`,placeholder:c(N)(`views.profiles.function`),class:`w-44 h-[2.375rem]`,checkmark:``,"dropdown-icon":`pi pi-directions`,"scroll-height":`40rem`},null,8,[`modelValue`,`options`,`placeholder`]),[[r,c(N)(`views.profiles.functionToApply`),void 0,{top:!0}]])]),C(`div`,vt,[g((b(),p(c(M),{modelValue:z.value,"onUpdate:modelValue":n[6]||(n[6]=e=>z.value=e),options:Ke.value,class:`w-44 h-[2.375rem]`,"option-label":`tempFrontendName`,"option-group-label":`deviceName`,"option-group-children":`temps`,placeholder:c(N)(`views.profiles.tempSource`),"filter-placeholder":c(N)(`common.search`),filter:``,checkmark:``,"scroll-height":`40rem`,invalid:z.value==null||Ue.value,"dropdown-icon":`pi pi-inbox`},{optiongroup:h(t=>[C(`div`,yt,[e(c(ae),{type:`mdi`,path:c(A),size:c(E).getREMSize(1.3),class:`mr-2`},null,8,[`path`,`size`]),C(`div`,null,f(t.option.deviceName),1)])]),option:h(e=>[C(`div`,bt,[C(`div`,null,[C(`span`,{class:`pi pi-minus mr-2 ml-1`,style:ne({color:e.option.lineColor})},null,4),u(f(e.option.tempFrontendName),1)]),C(`div`,xt,[e.option.limitInfo==null?S(``,!0):g((b(),l(`span`,St,[u(f(e.option.limitInfo.badge),1)])),[[r,e.option.limitInfo.message,void 0,{top:!0}]]),C(`span`,null,f(e.option.temp)+` `+f(c(N)(`common.tempUnit`)),1)])])]),_:1},8,[`modelValue`,`options`,`placeholder`,`filter-placeholder`,`invalid`])),[[r,{escape:!1,value:c(N)(`views.profiles.tempSource`)},void 0,{top:!0}]])])])):L.value===c(j).Fixed?(b(),l(`div`,Ct,[g((b(),p(c(oe),{placeholder:c(N)(`common.duty`),modelValue:B.value,"onUpdate:modelValue":n[7]||(n[7]=e=>B.value=e),inputId:`selected-duty`,mode:`decimal`,class:`duty-input w-full h-[2.375rem]`,suffix:` ${c(N)(`common.percentUnit`)}`,showButtons:``,min:J,max:Y,disabled:V.value==null&&!Yn.value,"use-grouping":!1,step:1,"button-layout":`horizontal`,"input-style":{width:`5rem`}},{incrementicon:h(()=>[...n[16]||(n[16]=[C(`span`,{class:`pi pi-plus`},null,-1)])]),decrementicon:h(()=>[...n[17]||(n[17]=[C(`span`,{class:`pi pi-minus`},null,-1)])]),_:1},8,[`placeholder`,`modelValue`,`suffix`,`disabled`])),[[r,c(N)(`views.profiles.fixedDuty`),void 0,{top:!0}]])])):S(``,!0),C(`div`,wt,[g(e(c(M),{modelValue:L.value,"onUpdate:modelValue":n[8]||(n[8]=e=>L.value=e),options:Ve.value,"option-label":`label`,"option-value":`value`,placeholder:c(N)(`views.profiles.profileType`),class:`w-[6.5rem] h-[2.375rem] mr-3`,"dropdown-icon":`pi pi-chart-line`,"scroll-height":`400px`,checkmark:``},null,8,[`modelValue`,`options`,`placeholder`]),[[r,{escape:!1,value:c(N)(`views.profiles.tooltip.profileType`)},void 0,{top:!0}]]),g((b(),p(c(T),{class:v([`bg-accent/80 hover:!bg-accent w-32 h-[2.375rem]`,{"animate-pulse-fast":F.value}]),label:c(N)(`common.save`),onClick:or},{default:h(()=>[e(c(ae),{class:`outline-0`,type:`mdi`,path:c(w),size:c(E).getREMSize(1.5)},null,8,[`path`,`size`])]),_:1},8,[`class`,`label`])),[[r,c(N)(`views.profiles.saveProfile`),void 0,{top:!0}]])])])]),Jn.value?(b(),l(`div`,Tt,[C(`div`,Et,[g((b(),p(c(oe),{placeholder:c(N)(`components.axisOptions.min`),modelValue:K.value,"onUpdate:modelValue":n[9]||(n[9]=e=>K.value=e),mode:`decimal`,class:`h-11 mx-4`,suffix:` ${c(N)(`common.tempUnit`)}`,showButtons:``,min:nr.value,max:rr.value,"use-grouping":!1,step:5,"button-layout":`horizontal`,"input-style":{width:`5rem`},disabled:c(R)==null},{incrementicon:h(()=>[...n[18]||(n[18]=[C(`span`,{class:`pi pi-plus`},null,-1)])]),decrementicon:h(()=>[...n[19]||(n[19]=[C(`span`,{class:`pi pi-minus`},null,-1)])]),_:1},8,[`placeholder`,`modelValue`,`suffix`,`min`,`max`,`disabled`])),[[r,c(N)(`views.profiles.minProfileTemp`),void 0,{top:!0}]]),C(`div`,Dt,[g((b(),l(`div`,Ot,[e(c(ae),{type:`mdi`,class:`h-7`,path:c(_e),size:c(E).getREMSize(1.25)},null,8,[`path`,`size`])])),[[r,c(N)(`views.profiles.graphProfileMouseActions`),void 0,{top:!0}]]),Ye.value==null?S(``,!0):(b(),l(`span`,kt,f(Ye.value.message),1))]),g((b(),p(c(oe),{placeholder:c(N)(`components.axisOptions.max`),modelValue:q.value,"onUpdate:modelValue":n[10]||(n[10]=e=>q.value=e),mode:`decimal`,class:`h-11 mx-4`,suffix:` ${c(N)(`common.tempUnit`)}`,showButtons:``,min:ir.value,max:ar.value,"use-grouping":!1,step:5,"button-layout":`horizontal`,"input-style":{width:`5rem`},disabled:c(R)==null},{incrementicon:h(()=>[...n[20]||(n[20]=[C(`span`,{class:`pi pi-plus`},null,-1)])]),decrementicon:h(()=>[...n[21]||(n[21]=[C(`span`,{class:`pi pi-minus`},null,-1)])]),_:1},8,[`placeholder`,`modelValue`,`suffix`,`min`,`max`,`disabled`])),[[r,c(N)(`views.profiles.maxProfileTemp`),void 0,{top:!0}]])])])):S(``,!0),C(`div`,At,[L.value===c(j).Default?(b(),l(`div`,jt,f(c(N)(`common.unmanaged`)),1)):Yn.value?(b(),l(`div`,{key:1,onMousedownCapture:gr,onMouseupCapture:_r},[e(c(ze),{modelValue:B.value,"onUpdate:modelValue":n[11]||(n[11]=e=>B.value=e),class:`duty-knob-input m-2 w-full h-full flex justify-center`,"value-template":e=>`${e}${c(N)(`common.percentUnit`)}`,min:J,max:Y,step:1,"stroke-width":c(E).getREMSize(.75),size:U.value},null,8,[`modelValue`,`value-template`,`stroke-width`,`size`])],32)):Jn.value?(b(),l(`div`,Mt,[e(c(Fe),{id:`control-graph`,class:`pt-6 pr-11 pl-4 pb-6`,ref_key:`controlGraph`,ref:$,option:Q,autoresize:!0,"manual-update":!0,onContextmenu:Cn,"onZr:click":Sn,"onZr:contextmenu":Cn},null,512),C(`div`,{class:v([`absolute z-10 bg-bg-two/90 border border-border-one rounded-lg shadow-lg max-h-[calc(100vh-6rem)] overflow-y-auto`,Tn.value])},[C(`div`,Nt,[C(`span`,Pt,f(c(N)(`views.profiles.points`)),1),g(e(c(T),{onClick:En,icon:`pi pi-arrow-up-right-and-arrow-down-left-from-center rotate-90`,text:``,rounded:``,class:`!w-7 !h-7 !p-0`},null,512),[[r,c(N)(`views.profiles.moveTable`),void 0,{top:!0}]])]),C(`table`,Ft,[C(`thead`,It,[C(`tr`,Lt,[n[22]||(n[22]=C(`th`,{class:`px-2 py-1 text-left`},`#`,-1)),C(`th`,Rt,f(c(N)(`common.temperature`)),1),C(`th`,zt,f(c(N)(`common.duty`)),1),n[23]||(n[23]=C(`th`,{class:`px-1 py-1 w-6`},null,-1))])]),(b(),l(`tbody`,{key:Be.value},[(b(),l(ie,null,te(Z,(t,n)=>C(`tr`,{key:`${Be.value}-${n}`,class:v([`group cursor-pointer`,{"bg-accent/30":n===V.value,"hover:bg-bg-one/20":n!==V.value&&n!==Z.length-1}]),onClick:e=>Dn(n)},[C(`td`,Vt,f(n+1),1),C(`td`,Ht,[C(`div`,{class:`flex items-center justify-center gap-0.5`,onWheel:m(e=>n!==0&&n!==Z.length-1&&In(e,n),[`prevent`])},[e(c(T),{icon:`pi pi-minus`,text:``,size:`small`,class:`!w-5 !h-5 !p-0 [&>span]:text-[0.6rem]`,disabled:n===0||n===Z.length-1||Z[n].value[0]<=On(n),onPointerdown:m(e=>Hn(()=>Nn(n)),[`stop`]),onPointerup:m(Un,[`stop`]),onPointerleave:Un},null,8,[`disabled`,`onPointerdown`]),e(c(oe),{modelValue:t.value[0],"onUpdate:modelValue":e=>Rn(n,e),onFocus:e=>Dn(n),mode:`decimal`,minFractionDigits:1,maxFractionDigits:1,min:On(n),max:kn(n),suffix:c(N)(`common.tempUnit`),disabled:n===0||n===Z.length-1,inputStyle:{width:`3.75rem`,textAlign:`center`,padding:`0.125rem`},class:`table-input`},null,8,[`modelValue`,`onUpdate:modelValue`,`onFocus`,`min`,`max`,`suffix`,`disabled`]),e(c(T),{icon:`pi pi-plus`,text:``,size:`small`,class:`!w-5 !h-5 !p-0 [&>span]:text-[0.6rem]`,disabled:n===0||n===Z.length-1||Z[n].value[0]>=kn(n),onPointerdown:m(e=>Hn(()=>Mn(n)),[`stop`]),onPointerup:m(Un,[`stop`]),onPointerleave:Un},null,8,[`disabled`,`onPointerdown`])],40,Ut)]),C(`td`,Wt,[C(`div`,{class:`flex items-center justify-center gap-0.5`,onWheel:m(e=>n!==Z.length-1&&Ln(e,n),[`prevent`])},[e(c(T),{icon:`pi pi-minus`,text:``,size:`small`,class:`!w-5 !h-5 !p-0 [&>span]:text-[0.6rem]`,disabled:n===Z.length-1||Z[n].value[1]<=J,onPointerdown:m(e=>Hn(()=>Fn(n)),[`stop`]),onPointerup:m(Un,[`stop`]),onPointerleave:Un},null,8,[`disabled`,`onPointerdown`]),e(c(oe),{modelValue:t.value[1],"onUpdate:modelValue":e=>zn(n,e),onFocus:e=>Dn(n),mode:`decimal`,minFractionDigits:0,maxFractionDigits:0,min:J,max:Y,suffix:c(N)(`common.percentUnit`),disabled:n===Z.length-1,inputStyle:{width:`3rem`,textAlign:`center`,padding:`0.125rem`},class:`table-input`},null,8,[`modelValue`,`onUpdate:modelValue`,`onFocus`,`suffix`,`disabled`]),e(c(T),{icon:`pi pi-plus`,text:``,size:`small`,class:`!w-5 !h-5 !p-0 [&>span]:text-[0.6rem]`,disabled:n===Z.length-1||Z[n].value[1]>=Y,onPointerdown:m(e=>Hn(()=>Pn(n)),[`stop`]),onPointerup:m(Un,[`stop`]),onPointerleave:Un},null,8,[`disabled`,`onPointerdown`])],40,Gt)]),C(`td`,Kt,[C(`div`,qt,[qn(n)?g((b(),p(c(T),{key:0,icon:`pi pi-plus-circle`,text:``,severity:`success`,size:`small`,class:`!w-6 !h-6 !p-0`,onClick:m(e=>Wn(n),[`stop`])},null,8,[`onClick`])),[[r,c(N)(`views.profiles.addPointAfter`),void 0,{top:!0}]]):S(``,!0),Kn(n)?g((b(),p(c(T),{key:1,icon:`pi pi-trash`,text:``,severity:`danger`,size:`small`,class:`!w-6 !h-6 !p-0`,onClick:m(e=>Gn(n),[`stop`])},null,8,[`onClick`])),[[r,c(N)(`views.profiles.removePoint`),void 0,{top:!0}]]):S(``,!0)])])],10,Bt)),64))]))])],2)])):Zn.value?(b(),p(We,{class:`p-6`,profiles:$e.value,mixFunctionType:tt.value,key:$n.value},null,8,[`profiles`,`mixFunctionType`])):Xn.value?(b(),l(`div`,{key:4,onMousedownCapture:gr,onMouseupCapture:_r},[e(c(ze),{modelValue:at.value,"onUpdate:modelValue":n[12]||(n[12]=e=>at.value=e),class:`m-2 w-full h-full flex justify-center outline-none !outline-0`,"value-template":e=>e>0?`+${e}${c(N)(`common.percentUnit`)}`:`${e}${c(N)(`common.percentUnit`)}`,min:Xt,max:Zt,step:1,"stroke-width":c(E).getREMSize(.75),size:U.value,disabled:et.value==null},null,8,[`modelValue`,`value-template`,`stroke-width`,`size`,`disabled`])],32)):Qn.value?(b(),p(dt,{key:5,"profile-u-i-d":I.value.uid,onChanged:n[13]||(n[13]=e=>ot.value=e)},null,8,[`profile-u-i-d`])):S(``,!0)])],64)}}}),[[`__scopeId`,`data-v-70743da6`]]);export{en as default};