/*! phoscon-app 2024-10-07 */

function secondsToMinutesArray(seconds){var min=0,sec=0;return sec=seconds%60,min=Math.floor(seconds/60),sec<10&&sec>=0&&(sec="0"+sec),min<10&&min>=0&&(min="0"+min),[min,sec]}function secondsToMinutesText(seconds){var min,sec=0;sec=seconds%60;var txt="";return 0===(min=Math.floor(seconds/60))&&0===sec?txt+='<span data-translateid="fade_no">'+translate("fade_no")+"</span>":0!==min&&0===sec?(min<=1&&(txt+=min+' <span data-translateid="text_minute">'+translate("text_minute")+"</span>"),min>1&&(txt+=min+' <span data-translateid="text_minutes">'+translate("text_minutes")+"</span>")):0!==sec&&0===min?(sec<=1&&(txt+=sec+' <span data-translateid="text_second">'+translate("text_second")+"</span>"),sec>1&&(txt+=sec+' <span data-translateid="text_seconds">'+translate("text_seconds")+"</span>")):0!==min&&0!==sec&&(sec<10&&(sec="0"+sec),txt+=min+":"+sec+' <span data-translateid="text_minutes">'+translate("text_minutes")+"</span>"),txt}function timeStringToSeconds(time){return 5!==time.length&&2!==time.indexOf(":")?0:60*parseInt(time.substr(0,2))+parseInt(time.substr(3,2))}const TO_UTC=!0,TO_LOCAL=!1,ADD_DATE=!0,NO_DATE=!1,ADD_DAY=!0,DONT_ADD_DAY=!1;function createTimeString(toUTC,addDate,addDay,hour,minute,fadingTime){var y,m,h,min,s,year=parseInt(app.config.attributes.localtime.substr(0,4)),month=parseInt(app.config.attributes.localtime.substr(5,2))-1,day=parseInt(app.config.attributes.localtime.substr(8,2)),date=new Date(year,month,day,hour,minute,0,0);if(void 0!==fadingTime){var d=date.getTime()-1e3*parseInt(fadingTime);date=new Date(d)}return!0===addDay&&date.setDate(date.getDate()+1),!1===toUTC?(y=date.getFullYear(),m=date.getMonth()+1,d=date.getDate(),h=date.getHours()<10?"0"+date.getHours():date.getHours(),min=date.getMinutes()<10?"0"+date.getMinutes():date.getMinutes(),s=date.getSeconds()<10?"0"+date.getSeconds():date.getSeconds()):(y=date.getUTCFullYear(),m=date.getUTCMonth()+1,d=date.getUTCDate(),h=date.getUTCHours()<10?"0"+date.getUTCHours():date.getUTCHours(),min=date.getUTCMinutes()<10?"0"+date.getUTCMinutes():date.getUTCMinutes(),s=date.getUTCSeconds()<10?"0"+date.getUTCSeconds():date.getUTCSeconds()),m=m<10?"0"+m:m,d=d<10?"0"+d:d,!0===addDate?y+"-"+m+"-"+d+"T"+h+":"+min+":"+s:h+":"+min+":"+s}const FROM_UTC=!0,FROM_LOCAL_TIME=!1;function readScheduleTime(fromUTC,hour,min,fadingTime){var hoursMinutes=60*parseInt(hour)+parseInt(min);void 0!==fadingTime&&(hoursMinutes=Math.ceil(hoursMinutes+parseInt(fadingTime)/60)),!0===fromUTC&&(hoursMinutes-=app.time.offset),hoursMinutes<0?hoursMinutes=1440+hoursMinutes:hoursMinutes>1440&&(hoursMinutes-=1440);var hourLocal=0;0!=hoursMinutes&&(hourLocal=Math.floor(hoursMinutes/60)),24==hourLocal&&(hourLocal=0);var minLocal=hoursMinutes%60;return hourLocal.toString().length<2&&(hourLocal="0"+hourLocal),minLocal.toString().length<2&&(minLocal="0"+minLocal),[hourLocal,minLocal]}function parseDateString(datestring){var h="00",min="00",s="00";return-1!==datestring.indexOf("T")&&(h=datestring.substr(datestring.indexOf("T")+1,2),min=datestring.substr(datestring.indexOf("T")+4,2),s=datestring.substr(datestring.indexOf("T")+7,2)),[h,min,s]}function timeFormat(date){const timeString=date.toLocaleTimeString(navigator.language).toUpperCase();return-1!==timeString.indexOf("AM")||-1!==timeString.indexOf("PM")?"12h":"24h"}