import{f as e}from"./logger-DBxM8LRL.js";import"./paths-DhSjTRMz.js";import"./proxy-env-CvaGpEr-.js";import{n as t}from"./fetch-timeout-6oZsqWxA.js";import{n}from"./proxy-fetch-D-VHASsi.js";import"./fetch-C3LEMysf.js";import{t as r}from"./fetch-muvEPeHY.js";async function i(i){let a=r(i.proxyUrl?n(i.proxyUrl):void 0,{network:i.network}),o=`https://api.telegram.org/bot${i.token}`,s=[];for(let n of i.groupIds)try{let r=await t(`${o}/getChatMember?chat_id=${encodeURIComponent(n)}&user_id=${encodeURIComponent(String(i.botId))}`,{},i.timeoutMs,a),c=await r.json();if(!r.ok||!e(c)||!c.ok){let t=e(c)&&!c.ok&&typeof c.description==`string`?c.description:`getChatMember failed (${r.status})`;s.push({chatId:n,ok:!1,status:null,error:t,matchKey:n,matchSource:`id`});continue}let l=e(c.result)?c.result.status??null:null,u=l===`creator`||l===`administrator`||l===`member`;s.push({chatId:n,ok:u,status:l,error:u?null:`bot not in group`,matchKey:n,matchSource:`id`})}catch(e){s.push({chatId:n,ok:!1,status:null,error:e instanceof Error?e.message:String(e),matchKey:n,matchSource:`id`})}return{ok:s.every(e=>e.ok),checkedGroups:s.length,unresolvedGroups:0,hasWildcardUnmentionedGroups:!1,groups:s}}export{i as auditTelegramGroupMembershipImpl};
