function e(e){try{let t=e.trim(),n=/^(?<user>[^@]+)@(?<host>[^:]+):(?<path>.+)$/.exec(t),r=null;if(n?.groups?.path&&n.groups.host&&(r=n.groups.host,t=`${r}/${n.groups.path}`),r==null){let e=/^(?<proto>[a-z]+):\/\/(?<rest>.+)$/i.exec(t);e?.groups?.rest&&(t=e.groups.rest)}else t=t.replace(/^[a-z]+:\/\//i,``);t=t.replace(/^[^@]+@/,``),t=t.replace(/[?#].*$/,``).replace(/\.git$/i,``);let i=t.split(`/`).filter(Boolean);!r&&i.length>0&&(r=i[0]??null);let a=r?i.slice(1):i;if(a.length<2)return null;let o=a[a.length-1],s=a[a.length-2];return!s||!o?null:{owner:s,repoName:o}}catch{return null}}function t(t){try{let n=t.trim();if(!n)return null;let r=n.replace(/[?#].*$/,``),i=/^(?:[^@]+)@github\.com:(?<path>.+)$/i.exec(r)?.groups?.path,a;if(i)a=i.split(`/`).filter(Boolean);else{let e=/^[a-z][a-z0-9+.-]*:\/\//i.test(r);if(!e&&!/^github\.com\//i.test(r))return null;let t=new URL(e?r:`https://${r}`);if(t.hostname.toLowerCase()!==`github.com`)return null;a=t.pathname.split(`/`).filter(Boolean)}return a.length===2?e(r.replace(/\/+$/,``)):null}catch{return null}}export{e as n,t};
//# sourceMappingURL=parse-owner-repo-BIB9Pu_g.js.map