import{a as r,E as c}from"./index-CKxLfxpS.js";import{r as i}from"./lucide-UY9XeFdQ.js";const t=i(null),l=i(!1),u=i(!1);let a=null;async function s(n=!1){return u.value&&!n?t.value:(a&&!n||(l.value=!0,a=(async()=>{try{const e=await r.sendCommand("party_mode/config");return t.value=e,u.value=!0,e}catch{return t.value=null,u.value=!0,null}finally{l.value=!1,a=null}})()),a)}function o(){t.value=null,u.value=!1,a=null}let f=!1;function d(){f||(f=!0,r.subscribe(c.PROVIDERS_UPDATED,async()=>{Object.values(r.providers).some(e=>e.domain==="party_mode")?(o(),await s(!0)):(t.value=null,u.value=!0)}),r.subscribe(c.CORE_STATE_UPDATED,async()=>{Object.values(r.providers).some(e=>e.domain==="party_mode")&&(o(),await s(!0))}))}function m(){return d(),{config:t,loading:l,loaded:u,fetchConfig:s,invalidate:o}}export{m as u};
