/*! phoscon-app 2025-10-13 */

export const getSettingsView=constants=>{return new(Backbone.View.extend({el:"#settings",template:_.template(document.getElementById("group-scenes-settings-template").innerHTML),initialize:function(){this.views=[],this.listenTo(app.scenes,"change",this.updateFadingTime),this.el.innerHTML=this.template(this.model),this.fadingTimeLabel=this.el.querySelector("#fadingCustomInput"),this.sliderFadingTime=document.querySelector("#sliderFadingTime"),this.sliderDiv=document.querySelector("#sliderDiv"),this.changedBox=document.querySelector("#changedBox"),this.sceneList=document.querySelector("#sceneList"),this.addSceneBtn=document.querySelector("#add-scene-btn"),this.dotMenu=document.querySelector("#dotMenuSettings .context-menu-icon"),this.dotIcon=this.dotMenu.parentNode;let injectOptions=SVGInject.setOptions({useCache:!1,copyAttributes:!0,makeIdsUnique:!1}),iconImg=this.el.querySelectorAll(".item-icon");SVGInject(iconImg,injectOptions),this.render()},render:function(){let icon,nav=Snap(".settings-nav");return(icon=Snap("#common-icons #bulb-icon").parent().clone()).addClass("sceneLamp"),icon.id="navLampIcon",nav.append(icon),nav.node.innerHTML+='<label class="symbol-nav-label" data-translateid="text_lights" style="left: 0">'+translate("text_lights")+"</label>",(icon=Snap("#common-icons #edit-scenes-icon").parent().clone()).addClass("sceneTime"),icon.addClass("active"),void 0===app.session.scid&&icon.addClass("inactive"),icon.id="navSettingsIcon",nav.append(icon),nav.node.innerHTML+='<label class="symbol-nav-label" data-translateid="text_settings" style="right: 0">'+translate("text_settings")+"</label>",this},setFadingTime:function(val){this.fadingTimeLabel.innerHTML=secondsToMinutesText(val),this.sliderFadingTime.value=app.timeSliderValues.indexOf(val)},events:{"input #sliderFadingTime":function(ev){this.service.send({type:constants.events.FADING_TIME_CHANGED,event:ev})},"click #deleteScene_btn, .context-menu li:nth-child(2)":function(event){let deleteSceneModalName=document.querySelector(".modal-body span b"),name=app.scenes.get(app.session.scid).attributes.name;deleteSceneModalName.innerText=name},"click .symbol-nav svg:nth-child(1)":function(event){app.router.navigate("/lights/"+app.session.gid+"/"+app.session.scid,{trigger:!0}),this.service.send({type:constants.states.OVERVIEW})},"click #dotMenuSettings":function(event){this.dotIcon.classList.contains("show-context")?this.dotIcon.classList.remove("show-context"):this.dotIcon.classList.add("show-context")}},setFadingTimeText:function(val){this.fadingTimeLabel.innerHTML=secondsToMinutesText(app.timeSliderValues[val])},show:function(){this.sliderDiv.classList.add("hide"),this.el.classList.remove("hide")},hide:function(){this.sliderDiv.classList.remove("hide"),this.el.classList.add("hide")}}))};