1function n(t){return typeof t!="string"?void 0:t.replace(/\s+/g," ").trim()||void 0}function d(t,e){const r=n(e);if(r)try{return new URL(r,t).toString()}catch{return}}const f=120;function w(t){return t.replace(/([a-z0-9\u2019])([A-Z][a-z])/g,"$1 $2").replace(/([0-9])([A-Z][a-z])/g,"$1 $2")}function L(t){const e=Array.from(t.matchAll(/\b([A-Z][a-z]{3,})\s+\d+\b/g));if(e.length<2)return t;const r=e.reduce((a,c)=>{var u;const i=(u=c[1])==null?void 0:u.toLowerCase();return i&&a.set(i,(a.get(i)||0)+1),a},new Map),s=e.find(a=>{var i;const c=(i=a[1])==null?void 0:i.toLowerCase();return!!c&&(r.get(c)||0)>=2});if(!s||typeof s.index!="number"||s.index<12)return t;const o=n(t.slice(0,s.index));return!o||o.split(/\s+/).length<2?t:o}function F(t){if(t.length<=f)return t;const e=t.slice(0,f+1),r=Math.max(e.lastIndexOf(" | "),e.lastIndexOf(" - "),e.lastIndexOf(" â "),e.lastIndexOf(" â "),e.lastIndexOf(": "),e.lastIndexOf("; "),e.lastIndexOf(", "),e.lastIndexOf(" ")),s=r>=60?r:f;return`${e.slice(0,s).trimEnd()}...`}function N(t){const e=n(t);if(!e)return;const r=n(w(e));if(!(!r||j(r)))return F(L(r))}function y(t){const e=(typeof t=="string"?t:"").trim().toLowerCase();return e?!!(new Set(["client challenge","just a moment...","just a moment","attention required!","attention required","please wait...","please wait","access denied","one more step","are you human?","are you human"]).has(e)||e.length<=50&&(e.includes("client challenge")||e.includes("checking your browser")||e.includes("verify you are human")||e.includes("captcha"))):!1}function j(t){var r;const e=(r=n(t))==null?void 0:r.toLowerCase();return!e||y(e)?!0:e.includes("this website uses cookies")||e.includes("allow all cookies")||e.includes("allow selected cookies")||e.includes("use necessary cookies only")||e.includes("cookie declaration")||e.includes("enable javascript and cookies")||e.includes("attention required")||e.includes("access denied")||e.includes("just a moment")}function _(t,e){if(!e)return;const r=n(t||e.url);if(!r)return e;const s=d(r,e.imageSrc)||n(e.imageSrc)||(e.imageSrc===""?"":void 0);return{...e,url:d(r,e.url)||r,favicon:d(r,e.favicon)||n(e.favicon),faviconSrcPath:d(r,e.faviconSrcPath)||n(e.faviconSrcPath),imageSrc:s,bannerImageSrcPath:d(r,e.bannerImageSrcPath)||n(e.bannerImageSrcPath)}}function U(t){var r;const e=(r=n(t))==null?void 0:r.toLowerCase();return e?e.includes("rss+xml")?"rss":e.includes("atom+xml")?"atom":e.includes("feed+json")||e.includes("json")?"json":null:null}function D(t){var r;const e=(r=n(t))==null?void 0:r.toLowerCase();return e?e.includes("atom")?"atom":e.includes("json feed")||e.includes("jsonfeed")?"json":e.includes("rss")||e.includes("podcast")?"rss":null:null}function b(t){var r;const e=(r=n(t))==null?void 0:r.toLowerCase();return e?/(?:^|\/)(?:atom)(?:[/?._]|$)/.test(e)||/(?:^|[?&])(format|output|feed)=atom(?:[&#]|$)/.test(e)||/\.atom(?:$|[?#])/.test(e)?"atom":e.includes("jsonfeed")||e.includes("feed.json")||/(?:^|[?&])(format|output|feed)=json(?:[&#]|$)/.test(e)?"json":/\.rss(?:$|[?#])/.test(e)||/(?:^|\/)(?:rss|feed|feeds)(?:[/?._]|$)/.test(e)||/(?:^|[?&])(format|output|feed)=rss(?:[&#]|$)/.test(e)||/(?:^|\/)(?:podcast|podcasts)(?:[/?._-]|$)/.test(e)?"rss":null:null}function B(t){var r;const e=(r=n(t))==null?void 0:r.toLowerCase();return e?/(?:^|\/)(?:feed|feeds|rss|atom)(?:[/?._]|$)/.test(e)||/(?:^|[?&])(format|output|feed)=(rss|atom|json)(?:[&#]|$)/.test(e)||/\.(rss|atom|xml|json)(?:$|[?#])/.test(e)||/(?:^|\/)(?:podcast|podcasts)(?:[/?._-]|$)/.test(e):!1}const z=/\.(rss|atom)$/,$=/^(feed|feeds|rss|rss2|atom|index|podcast|episodes)\.(xml|rss|atom|json)$/,x=/\.(xml|json|rss|atom)$/,I=new Set(["feed","feeds","rss","atom"]),A=new Set(["feed","feeds","rss","podcasts"]),C=new Set(["feeds.megaphone.fm","feeds.simplecast.com","feeds.acast.com","rss.art19.com","feeds.feedburner.com","feeds.publicradio.org"]),M=["format","output","feed","alt","type"],P=/^(rss|rss2|atom|feed|json)$/i;function W(t){const e=n(t);if(!e)return!1;let r;try{r=new URL(e)}catch{return!1}if(r.protocol!=="http:"&&r.protocol!=="https:")return!1;
1const s=r.pathname.toLowerCase().split("/").filter(Boolean),o=s[s.length-1]||"";if(z.test(o)||$.test(o))return!0;const a=r.hostname.toLowerCase(),c=a.split(".")[0]||"";if(A.has(c)&&x.test(o)||s.length>0&&C.has(a)||s.some(i=>I.has(i))&&(I.has(o)||x.test(o)||o==="default"))return!0;for(const i of M){const u=r.searchParams.get(i);if(u&&P.test(u.trim()))return!0}return!1}const O=/(rss\+xml|atom\+xml|feed\+json|rdf\+xml)/;function Y(t){var r;const e=(r=n(t))==null?void 0:r.toLowerCase();return!!e&&O.test(e)}function H(t){if(!t)return!1;const e=t.slice(0,1500).toLowerCase().trimStart();return e.startsWith("<!doctype html")||e.startsWith("<html")?!1:/<rss[\s>]/.test(e)||/<feed[\s>]/.test(e)||e.startsWith("<?xml")&&e.includes("<channel")}function X(t){var e,r,s;return t?!!((e=t.title)!=null&&e.trim()||(r=t.description)!=null&&r.trim()||(s=t.imageSrc)!=null&&s.trim()):!1}const R={published_curated:100,published:95,live_dom:90,yt_api:85,oembed:80,html_parser:70,parser_1:60,parser_err:10};function T(t){var r;const e=(r=t==null?void 0:t.tsExtractedInfo)==null?void 0:r.sourceId;return e?R[e]??0:0}function k(t,e){if(!e)return t;const r=T(e)>=T(t);return v(r?e:t,r?t:e)}function v(t,e){var o,a,c,i,u,l,m,h,E,p,g,S;if(!e)return _(t.url,t)||t;const r=t.tsExtractedInfo||e.tsExtractedInfo?{pageType:((o=t.tsExtractedInfo)==null?void 0:o.pageType)??((a=e.tsExtractedInfo)==null?void 0:a.pageType)??null,...e.tsExtractedInfo||{},...t.tsExtractedInfo||{}}:void 0,s={...e,...t,title:((c=t.title)==null?void 0:c.trim())||e.title,description:((i=t.description)==null?void 0:i.trim())||e.description,keywords:((u=t.keywords)==null?void 0:u.trim())||e.keywords,siteName:((l=t.siteName)==null?void 0:l.trim())||e.siteName,type:((m=t.type)==null?void 0:m.trim())||e.type,locale:((h=t.locale)==null?void 0:h.trim())||e.locale,favicon:((E=t.favicon)==null?void 0:E.trim())||e.favicon,faviconSrcPath:((p=t.faviconSrcPath)==null?void 0:p.trim())||e.faviconSrcPath,imageSrc:((g=t.imageSrc)==null?void 0:g.trim())||e.imageSrc,bannerImageSrcPath:((S=t.bannerImageSrcPath)==null?void 0:S.trim())||e.bannerImageSrcPath,tsExtractedInfo:r};return _(t.url||e.url,s)||s}export{C as F,W as a,n as b,Y as c,j as d,D as e,b as f,U as g,B as h,y as i,v as j,X as k,H as l,k as m,_ as n,d as r,N as s};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.