const a=["VISITOR_INFO1_LIVE","VISITOR_PRIVACY_METADATA","YSC","__Secure-YEC","GPS"];function m(){return u({domain:"youtube.com"},a)}async function s(){try{return await chrome.permissions.contains({permissions:["cookies"]})}catch{return!1}}async function u(o,r){if(!await s())return 0;const e=await chrome.cookies.getAll({...o,partitionKey:{}}),n=r?e.filter(t=>r.includes(t.name)):e;return await Promise.all(n.map(t=>{const i=`http${t.secure?"s":""}://${t.domain.replace(/^\./,"")}${t.path}`;return chrome.cookies.remove({url:i,name:t.name,storeId:t.storeId,...t.partitionKey?{partitionKey:t.partitionKey}:{}}).catch(()=>{})})),n.length}const c=10,l=3;function h(o,r){if(!Number.isFinite(r)||r<c)return null;let e;try{e=new URL(o)}catch{return null}if(!/(^|\.)youtube\.com$/.test(e.hostname)||e.pathname!=="/watch"||!e.searchParams.get("v"))return null;const n=Math.max(0,Math.floor(r)-l);if(n<1)return null;e.searchParams.set("t",String(n));const t=e.toString();return t===o?null:t}export{u as a,m as c,h as w};
