import{aR as i}from"./main-tangy-colts-beg.js";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,o){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,o),o)}};const c=async e=>i("pro_suremembers/get/groups",void 0,{machineSlug:e},"GET"),n=()=>i("pro_suremembers/get-access-groups",void 0,{},"GET");globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,o){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,o),o)}};const u=async e=>{e.setComponent("group-id",s=>{s.loading=!0});const o=e.thisNode.machineSlug,{data:a,status:t}=await c(o);if(t==="error"){e.setComponent("group-id",s=>{e.util.isSelectComponent(s)&&(s.status=t,s.loading=!1,s.invalidMessage=a)}),console.error("Failed to fetch group");return}e.setComponent("group-id",s=>{e.util.isSelectComponent(s)&&(s.options=a,s.loading=!1,s.status=void 0)})},l=async e=>{e.setComponent("access-groups",t=>{t.loading=!0});const{data:o,status:a}=await n();if(a==="error"){e.setComponent("access-groups",t=>{e.util.isSelectComponent(t)&&(t.status=a,t.loading=!1,t.invalidMessage=JSON.stringify(o))}),console.error("Failed to fetch access groups.");return}e.setComponent("access-groups",t=>{e.util.isSelectComponent(t)&&(t.options=o,t.loading=!1,t.status=void 0)})};export{l as a,u as f};
