import{q as y}from"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf23.js";import{c as V}from"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf7.js";const N=()=>{var h,p,b;const{activationDays:e,fusoHorario:i}=a.getState(),t=new Date,n=new Intl.DateTimeFormat("pt-BR",{timeZone:i,weekday:"long",hour:"2-digit",minute:"2-digit",hour12:!1}).formatToParts(t),f=(((h=n.find(s=>s.type==="weekday"))==null?void 0:h.value.toLowerCase())??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace("-feira",""),_=Number(((p=n.find(s=>s.type==="hour"))==null?void 0:p.value)??"0"),w=Number(((b=n.find(s=>s.type==="minute"))==null?void 0:b.value)??"0"),o=_*60+w,r=e[f];if(!(r!=null&&r.active))return!1;const{start_time:A,finish_time:g}=r,[u,l]=A.split(":").map(Number),[v,d]=g.split(":").map(Number);if(Number.isNaN(u)||Number.isNaN(l)||Number.isNaN(v)||Number.isNaN(d))throw new Error(`Horários inválidos para o dia: ${f}`);const m=u*60+l,c=v*60+d;return m<=c?o>=m&&o<=c:o>=m||o<=c},a=V()((e,i)=>({aoVivo:!1,fusoHorario:Intl.DateTimeFormat().resolvedOptions().timeZone,users:"ALL",activationDays:{domingo:{active:!1,start_time:"",finish_time:""},segunda:{active:!1,start_time:"",finish_time:""},terca:{active:!1,start_time:"",finish_time:""},quarta:{active:!1,start_time:"",finish_time:""},quinta:{active:!1,start_time:"",finish_time:""},sexta:{active:!1,start_time:"",finish_time:""},sabado:{active:!1,start_time:"",finish_time:""}},offline:{active:!1,title:"",description:"",suportRedirect:!1},online:{title:"",description:"",btnName:"",urlMeet:""},setAoVivo:t=>e({aoVivo:t}),estaAoVivo:!1,setEstarAoVivo:t=>e({estaAoVivo:t})}));y.subscribe(e=>{if(e.label.meetAovivo){const i=e.label.meetAovivo;a.setState(t=>({...t,...i}))}});a.subscribe(({estaAoVivo:e})=>{const i=N();e!==i&&a.getState().setEstarAoVivo(i)});chrome.runtime.onMessage.addListener(async e=>{switch(e.action){case"Update_MeetAoVivo":const{estaAoVivo:i}=a.getState(),t=N();i!==t&&a.getState().setEstarAoVivo(t);break}});export{a as u};
