seo-crawl-audit 0.14.0 → 0.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bundle/cli.js CHANGED
@@ -1,22 +1,22 @@
1
- import{createHash as Qa}from"node:crypto";var Ya="https://github.com/MelnixDev/seo-crawl-audit/blob/main/docs/rules.md",Ga=[{id:"page-unreachable",severity:"error",owner:"developer",scope:"page",remediation:"Restore the page or remove references to it."},{id:"http-error",severity:"error",owner:"developer",scope:"page",remediation:"Return a successful response or a deliberate redirect."},{id:"noindex",severity:"info",owner:"seo",scope:"page",remediation:"Remove noindex when the page should appear in search."},{id:"x-robots-noindex",severity:"error",owner:"developer",scope:"page",remediation:"Remove the noindex X-Robots-Tag when indexing is intended."},{id:"robots-blocked",severity:"error",owner:"developer",scope:"page",remediation:"Allow the URL in robots.txt when it should be crawled."},{id:"missing-canonical",severity:"warning",owner:"seo",scope:"page",remediation:"Declare the preferred canonical URL when duplicate URL variants are possible."},{id:"invalid-canonical",severity:"error",owner:"developer",scope:"page",remediation:"Use an absolute or valid relative HTTP(S) canonical URL."},{id:"cross-domain-canonical",severity:"error",owner:"seo",scope:"page",remediation:"Confirm the external canonical or point it to the intended same-site URL."},{id:"canonical-target-error",severity:"error",owner:"developer",scope:"page",remediation:"Point the canonical to an accessible, indexable URL."},{id:"redirect-loop",severity:"error",owner:"developer",scope:"page",remediation:"Remove the circular redirect path."},{id:"long-redirect-chain",severity:"warning",owner:"developer",scope:"page",remediation:"Redirect directly to the final destination."},{id:"sitemap-unavailable",severity:"error",owner:"developer",scope:"site",remediation:"Restore a valid, reachable XML sitemap."},{id:"noindex-in-sitemap",severity:"error",owner:"seo",scope:"page",remediation:"Remove the URL from the sitemap or make it indexable."},{id:"redirect-in-sitemap",severity:"error",owner:"seo",scope:"page",remediation:"Replace the sitemap URL with its final canonical destination."},{id:"missing-title",severity:"error",owner:"content",scope:"page",remediation:"Add a unique, descriptive HTML title."},{id:"duplicate-title",severity:"warning",owner:"content",scope:"page",remediation:"Write a title that uniquely describes this page."},{id:"title-length",severity:"warning",owner:"content",scope:"page",remediation:"Keep the title concise and descriptive, usually 10\u201360 characters."},{id:"missing-description",severity:"warning",owner:"content",scope:"page",remediation:"Add a useful meta description."},{id:"duplicate-description",severity:"warning",owner:"content",scope:"page",remediation:"Write a unique meta description for this page."},{id:"description-length",severity:"warning",owner:"content",scope:"page",remediation:"Keep the description useful and usually between 50 and 160 characters."},{id:"missing-h1",severity:"warning",owner:"content",scope:"page",remediation:"Add one clear primary heading."},{id:"broken-internal-link",severity:"error",owner:"developer",scope:"page",remediation:"Update or remove the internal link, or restore its target."},{id:"orphan-sitemap-page",severity:"warning",owner:"seo",scope:"page",remediation:"Add meaningful internal links to the sitemap page."},{id:"crawlable-not-in-sitemap",severity:"warning",owner:"seo",scope:"page",remediation:"Add the indexable page to the sitemap or intentionally exclude it."},{id:"invalid-hreflang",severity:"warning",owner:"seo",scope:"page",remediation:"Use valid language tags and resolvable HTTP(S) alternate URLs."},{id:"malformed-json-ld",severity:"warning",owner:"developer",scope:"page",remediation:"Fix JSON syntax in the structured-data block."},{id:"http-on-https-site",severity:"warning",owner:"developer",scope:"page",remediation:"Use HTTPS for internal URLs and metadata references."},{id:"invalid-language",severity:"warning",owner:"developer",scope:"page",remediation:"Set a valid BCP 47 language tag on the html element."},{id:"duplicate-content",severity:"warning",owner:"content",scope:"page",remediation:"Consolidate duplicate pages or differentiate their main content."},{id:"multiple-h1",severity:"info",owner:"content",scope:"page",remediation:"Review whether one primary H1 would make the hierarchy clearer."},{id:"missing-open-graph",severity:"info",owner:"content",scope:"page",remediation:"Add Open Graph title, description, and image for social sharing."},{id:"missing-twitter-metadata",severity:"info",owner:"content",scope:"page",remediation:"Add Twitter card metadata when social previews matter."},{id:"image-missing-alt",severity:"info",owner:"content",scope:"page",remediation:"Add meaningful alt text, or an empty alt for decorative images."},{id:"low-word-count",severity:"info",owner:"content",scope:"page",remediation:"Review whether the page provides enough useful primary content."},{id:"robots-changed",severity:"warning",owner:"developer",scope:"site",remediation:"Review the robots.txt change and confirm that crawl access is intentional."},{id:"page-missing",severity:"error",owner:"developer",scope:"page",remediation:"Include the page in the scan or confirm that its removal is intentional."},{id:"status-regression",severity:"error",owner:"developer",scope:"page",remediation:"Restore the previous successful HTTP response."},{id:"new-noindex",severity:"error",owner:"seo",scope:"page",remediation:"Remove the newly introduced noindex unless it is intentional."},{id:"title-removed",severity:"error",owner:"content",scope:"page",remediation:"Restore a descriptive title."},{id:"title-changed",severity:"warning",owner:"content",scope:"page",remediation:"Review and approve the changed title."},{id:"description-removed",severity:"warning",owner:"content",scope:"page",remediation:"Restore a useful meta description."},{id:"canonical-removed",severity:"error",owner:"seo",scope:"page",remediation:"Restore the canonical declaration."},{id:"canonical-changed",severity:"warning",owner:"seo",scope:"page",remediation:"Confirm the new canonical target is deliberate and valid."},{id:"h1-removed",severity:"warning",owner:"content",scope:"page",remediation:"Restore a clear primary heading."},{id:"redirect-changed",severity:"warning",owner:"developer",scope:"page",remediation:"Confirm the new redirect destination is intentional."},{id:"sitemap-url-count-drop",severity:"error",owner:"seo",scope:"site",remediation:"Investigate the sitemap URL loss and restore omitted indexable pages."}],zn=Object.freeze(Ga.map(e=>Object.freeze({...e}))),Wa=new Map(zn.map(e=>[e.id,e]));function Hr(e){return Array.isArray(e)?`[${e.map(Hr).join(",")}]`:e&&typeof e=="object"?`{${Object.entries(e).sort(([t],[r])=>t.localeCompare(r)).map(([t,r])=>`${t}:${Hr(r)}`).join(",")}}`:JSON.stringify(e)}function qn(e,t,r,n){return Qa("sha256").update(`${e}
1
+ import{createHash as Ya}from"node:crypto";var Ga="https://github.com/MelnixDev/seo-crawl-audit/blob/main/docs/rules.md",Wa=[{id:"page-unreachable",severity:"error",owner:"developer",scope:"page",remediation:"Restore the page or remove references to it."},{id:"http-error",severity:"error",owner:"developer",scope:"page",remediation:"Return a successful response or a deliberate redirect."},{id:"noindex",severity:"info",owner:"seo",scope:"page",remediation:"Remove noindex when the page should appear in search."},{id:"x-robots-noindex",severity:"error",owner:"developer",scope:"page",remediation:"Remove the noindex X-Robots-Tag when indexing is intended."},{id:"robots-blocked",severity:"error",owner:"developer",scope:"page",remediation:"Allow the URL in robots.txt when it should be crawled."},{id:"missing-canonical",severity:"warning",owner:"seo",scope:"page",remediation:"Declare the preferred canonical URL when duplicate URL variants are possible."},{id:"invalid-canonical",severity:"error",owner:"developer",scope:"page",remediation:"Use an absolute or valid relative HTTP(S) canonical URL."},{id:"cross-domain-canonical",severity:"error",owner:"seo",scope:"page",remediation:"Confirm the external canonical or point it to the intended same-site URL."},{id:"canonical-target-error",severity:"error",owner:"developer",scope:"page",remediation:"Point the canonical to an accessible, indexable URL."},{id:"redirect-loop",severity:"error",owner:"developer",scope:"page",remediation:"Remove the circular redirect path."},{id:"long-redirect-chain",severity:"warning",owner:"developer",scope:"page",remediation:"Redirect directly to the final destination."},{id:"sitemap-unavailable",severity:"error",owner:"developer",scope:"site",remediation:"Restore a valid, reachable XML sitemap."},{id:"noindex-in-sitemap",severity:"error",owner:"seo",scope:"page",remediation:"Remove the URL from the sitemap or make it indexable."},{id:"redirect-in-sitemap",severity:"error",owner:"seo",scope:"page",remediation:"Replace the sitemap URL with its final canonical destination."},{id:"missing-title",severity:"error",owner:"content",scope:"page",remediation:"Add a unique, descriptive HTML title."},{id:"duplicate-title",severity:"warning",owner:"content",scope:"page",remediation:"Write a title that uniquely describes this page."},{id:"title-length",severity:"warning",owner:"content",scope:"page",remediation:"Keep the title concise and descriptive, usually 10\u201360 characters."},{id:"missing-description",severity:"warning",owner:"content",scope:"page",remediation:"Add a useful meta description."},{id:"duplicate-description",severity:"warning",owner:"content",scope:"page",remediation:"Write a unique meta description for this page."},{id:"description-length",severity:"warning",owner:"content",scope:"page",remediation:"Keep the description useful and usually between 50 and 160 characters."},{id:"missing-h1",severity:"warning",owner:"content",scope:"page",remediation:"Add one clear primary heading."},{id:"broken-internal-link",severity:"error",owner:"developer",scope:"page",remediation:"Update or remove the internal link, or restore its target."},{id:"orphan-sitemap-page",severity:"warning",owner:"seo",scope:"page",remediation:"Add meaningful internal links to the sitemap page."},{id:"crawlable-not-in-sitemap",severity:"warning",owner:"seo",scope:"page",remediation:"Add the indexable page to the sitemap or intentionally exclude it."},{id:"invalid-hreflang",severity:"warning",owner:"seo",scope:"page",remediation:"Use valid language tags and resolvable HTTP(S) alternate URLs."},{id:"malformed-json-ld",severity:"warning",owner:"developer",scope:"page",remediation:"Fix JSON syntax in the structured-data block."},{id:"http-on-https-site",severity:"warning",owner:"developer",scope:"page",remediation:"Use HTTPS for internal URLs and metadata references."},{id:"invalid-language",severity:"warning",owner:"developer",scope:"page",remediation:"Set a valid BCP 47 language tag on the html element."},{id:"duplicate-content",severity:"warning",owner:"content",scope:"page",remediation:"Consolidate duplicate pages or differentiate their main content."},{id:"multiple-h1",severity:"info",owner:"content",scope:"page",remediation:"Review whether one primary H1 would make the hierarchy clearer."},{id:"missing-open-graph",severity:"info",owner:"content",scope:"page",remediation:"Add Open Graph title, description, and image for social sharing."},{id:"missing-twitter-metadata",severity:"info",owner:"content",scope:"page",remediation:"Add Twitter card metadata when social previews matter."},{id:"image-missing-alt",severity:"info",owner:"content",scope:"page",remediation:"Add meaningful alt text, or an empty alt for decorative images."},{id:"low-word-count",severity:"info",owner:"content",scope:"page",remediation:"Review whether the page provides enough useful primary content."},{id:"robots-changed",severity:"warning",owner:"developer",scope:"site",remediation:"Review the robots.txt change and confirm that crawl access is intentional."},{id:"page-missing",severity:"error",owner:"developer",scope:"page",remediation:"Include the page in the scan or confirm that its removal is intentional."},{id:"status-regression",severity:"error",owner:"developer",scope:"page",remediation:"Restore the previous successful HTTP response."},{id:"new-noindex",severity:"error",owner:"seo",scope:"page",remediation:"Remove the newly introduced noindex unless it is intentional."},{id:"title-removed",severity:"error",owner:"content",scope:"page",remediation:"Restore a descriptive title."},{id:"title-changed",severity:"warning",owner:"content",scope:"page",remediation:"Review and approve the changed title."},{id:"description-removed",severity:"warning",owner:"content",scope:"page",remediation:"Restore a useful meta description."},{id:"canonical-removed",severity:"error",owner:"seo",scope:"page",remediation:"Restore the canonical declaration."},{id:"canonical-changed",severity:"warning",owner:"seo",scope:"page",remediation:"Confirm the new canonical target is deliberate and valid."},{id:"h1-removed",severity:"warning",owner:"content",scope:"page",remediation:"Restore a clear primary heading."},{id:"redirect-changed",severity:"warning",owner:"developer",scope:"page",remediation:"Confirm the new redirect destination is intentional."},{id:"sitemap-url-count-drop",severity:"error",owner:"seo",scope:"site",remediation:"Investigate the sitemap URL loss and restore omitted indexable pages."}],qn=Object.freeze(Wa.map(e=>Object.freeze({...e}))),Ka=new Map(qn.map(e=>[e.id,e]));function Hr(e){return Array.isArray(e)?`[${e.map(Hr).join(",")}]`:e&&typeof e=="object"?`{${Object.entries(e).sort(([t],[r])=>t.localeCompare(r)).map(([t,r])=>`${t}:${Hr(r)}`).join(",")}}`:JSON.stringify(e)}function es(e,t,r,n){return Ya("sha256").update(`${e}
2
2
  ${t}
3
3
  ${r}
4
- ${Hr(n??null)}`).digest("hex").slice(0,24)}function O(e,t,r,n={},s){let a=Wa.get(e);if(!a)throw new Error(`unknown rule: ${e}`);return{fingerprint:qn(e,a.scope,t,s),ruleId:e,rule:e,severity:a.severity,scope:a.scope,url:t,message:r,evidence:n,owner:a.owner,remediation:a.remediation,documentationUrl:`${Ya}#${e}`,after:n.actual}}function it(e,t){return new RegExp(`(^|[\\s,])${t}($|[\\s,])`,"i").test(e??"")}function es(e){if(e.toLowerCase()==="x-default")return!0;try{return new Intl.Locale(e),!0}catch{return!1}}function Qr(e,t){let r=new Map;for(let n of e){let s=t(n)?.trim().toLowerCase();if(!s)continue;let a=r.get(s)??[];a.push(n.url),r.set(s,a)}return new Map([...r].filter(([,n])=>n.length>1))}function ts(e){let t=[],r=o=>{t.push(o)},n=new Map(e.pages.map(o=>[o.url,o])),s=new Set(e.sitemap?.urls??[]),a=Qr(e.pages,o=>o.title),c=Qr(e.pages,o=>o.description),l=Qr(e.pages,o=>o.contentHash);e.sitemap?.error&&r(O("sitemap-unavailable",e.sitemap.url,"The configured sitemap could not be loaded",{actual:e.sitemap.error}));for(let o of e.pages){if(o.blockedByRobots){r(O("robots-blocked",o.url,"Page is blocked by robots.txt",{actual:!0}));continue}if(o.error){r(O(o.error.includes("redirect loop")?"redirect-loop":"page-unreachable",o.url,`Page request failed: ${o.error}`,{actual:o.error,redirectChain:o.redirectChain}));continue}if((o.status===null||o.status>=400)&&r(O("http-error",o.url,`Page returned HTTP ${o.status??"unknown"}`,{actual:o.status})),it(o.robots,"noindex")&&r(O("noindex",o.url,"Page contains a noindex meta directive",{actual:o.robots})),it(o.xRobotsTag,"noindex")&&r(O("x-robots-noindex",o.url,"Page contains a noindex X-Robots-Tag",{actual:o.xRobotsTag})),!o.canonicalRaw&&!o.canonical&&r(O("missing-canonical",o.url,"Page does not declare a canonical URL",{actual:null})),o.canonicalRaw&&!o.canonical&&r(O("invalid-canonical",o.url,"Canonical URL is invalid",{actual:o.canonicalRaw})),o.canonical&&new URL(o.canonical).origin!==new URL(e.siteUrl).origin&&r(O("cross-domain-canonical",o.url,"Canonical points to another origin",{actual:o.canonical})),o.canonical){let p=n.get(o.canonical);p&&(p.error||(p.status??500)>=400)&&r(O("canonical-target-error",o.url,"Canonical target is unavailable",{target:o.canonical,actual:p.status??p.error},o.canonical))}o.redirectChain.length>3&&r(O("long-redirect-chain",o.url,`Page uses ${o.redirectChain.length} redirects`,{actual:o.redirectChain.length,redirectChain:o.redirectChain})),s.has(o.url)&&(it(o.robots,"noindex")||it(o.xRobotsTag,"noindex"))&&r(O("noindex-in-sitemap",o.url,"Sitemap URL is marked noindex",{actual:o.robots??o.xRobotsTag})),s.has(o.url)&&o.redirectChain.length>0&&r(O("redirect-in-sitemap",o.url,"Sitemap URL redirects",{actual:o.finalUrl,redirectChain:o.redirectChain})),o.title?(a.get(o.title.trim().toLowerCase())&&r(O("duplicate-title",o.url,"Title is shared by multiple pages",{actual:o.title,urls:a.get(o.title.trim().toLowerCase())},o.title.trim().toLowerCase())),(o.title.length<10||o.title.length>60)&&r(O("title-length",o.url,`Title length is ${o.title.length} characters`,{actual:o.title.length,value:o.title}))):r(O("missing-title",o.url,"Page does not have a title",{actual:null})),o.description?(c.get(o.description.trim().toLowerCase())&&r(O("duplicate-description",o.url,"Meta description is shared by multiple pages",{actual:o.description,urls:c.get(o.description.trim().toLowerCase())},o.description.trim().toLowerCase())),(o.description.length<50||o.description.length>160)&&r(O("description-length",o.url,`Description length is ${o.description.length} characters`,{actual:o.description.length,value:o.description}))):r(O("missing-description",o.url,"Page does not have a meta description",{actual:null})),o.h1Count===0?r(O("missing-h1",o.url,"Page does not contain an H1 heading",{actual:0})):o.h1Count>1&&r(O("multiple-h1",o.url,`Page contains ${o.h1Count} H1 headings`,{actual:o.h1Count}));for(let p of o.internalLinks){let h=n.get(p);h&&(h.error||(h.status??500)>=400)&&r(O("broken-internal-link",o.url,"Internal link points to an unavailable page",{target:p,actual:h.status??h.error},p))}s.has(o.url)&&o.url!==e.siteUrl&&e.linkGraph.orphanUrls.includes(o.url)&&r(O("orphan-sitemap-page",o.url,"Sitemap page has no discovered internal links",{actual:!0})),e.sitemap&&!s.has(o.url)&&!it(o.robots,"noindex")&&(o.status??500)<400&&r(O("crawlable-not-in-sitemap",o.url,"Crawlable page is absent from the sitemap",{actual:!1}));for(let p of o.hreflang)(!es(p.lang)||!p.url)&&r(O("invalid-hreflang",o.url,"Hreflang declaration is invalid",{actual:p},p));for(let[p,h]of o.jsonLd.entries())h.valid||r(O("malformed-json-ld",o.url,"JSON-LD block contains invalid JSON",{actual:h.error,index:p},p));e.siteUrl.startsWith("https:")&&[o.url,o.canonical,...o.internalLinks].some(p=>p?.startsWith("http:"))&&r(O("http-on-https-site",o.url,"HTTPS site references an internal HTTP URL",{actual:[o.url,o.canonical,...o.internalLinks].filter(p=>p?.startsWith("http:"))})),o.lang&&!es(o.lang)&&r(O("invalid-language",o.url,"HTML language declaration is invalid",{actual:o.lang})),o.contentHash&&l.get(o.contentHash)&&r(O("duplicate-content",o.url,"Main text is an exact duplicate of another page",{urls:l.get(o.contentHash)},o.contentHash)),(!o.openGraph.title||!o.openGraph.description||!o.openGraph.image)&&r(O("missing-open-graph",o.url,"Open Graph metadata is incomplete",{actual:o.openGraph})),(!o.twitter.card||!o.twitter.title||!o.twitter.description||!o.twitter.image)&&r(O("missing-twitter-metadata",o.url,"Twitter card metadata is incomplete",{actual:o.twitter}));let d=o.images.filter(p=>p.alt===null).map(p=>p.src);d.length>0&&r(O("image-missing-alt",o.url,`${d.length} image(s) do not have an alt attribute`,{actual:d})),o.wordCount<200&&r(O("low-word-count",o.url,`Page contains approximately ${o.wordCount} visible words`,{actual:o.wordCount}))}return t}var rs={error:0,warning:1,info:2};function Ka(e,t){let r=(()=>{try{return new URL(e).pathname}catch{return e}})(),n=t.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replaceAll("**","\0").replaceAll("*","[^/]*").replaceAll("\0",".*"),s=new RegExp(`^${n}$`);return s.test(r)||s.test(e)}function Ja(e,t,r){return t.find(n=>n.rule!==e.ruleId||!Ka(e.url,n.urlPattern)?!1:n.expiresAt?new Date(`${n.expiresAt}T23:59:59.999Z`).getTime()>=r.getTime():!0)??null}function Qe(e){return e.sort((t,r)=>rs[t.severity]-rs[r.severity]||t.url.localeCompare(r.url)||t.ruleId.localeCompare(r.ruleId)||t.fingerprint.localeCompare(r.fingerprint))}function at(e,t,r={}){let n=r.enabledRules??t.config.enabledRules,s=n?new Set(n):null,a={...t.config.severityOverrides,...r.severityOverrides??{}},c=r.suppressions??t.config.suppressions,l=new Date(r.now??Date.now());return Qe(e.filter(o=>!s||s.has(o.ruleId)).map(o=>({...o,severity:a[o.ruleId]??o.severity})).filter(o=>!Ja(o,c,l)))}import{createHash as Va}from"node:crypto";var X="0.14.0",ot="1.1.0",ja="seo-crawl-audit",_e=`${ja}/${X}`;var $a={title:null,description:null,image:null},Xa={card:null,title:null,description:null,image:null};function ns(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("snapshot must be an object");return e}function Za(e){if(!e||typeof e!="object"||typeof e.url!="string")throw new Error("snapshot page URL must be a string");return e}function Yr(e){return Array.isArray(e)?`[${e.map(Yr).join(",")}]`:e&&typeof e=="object"?`{${Object.entries(e).sort(([t],[r])=>t.localeCompare(r)).map(([t,r])=>`${JSON.stringify(t)}:${Yr(r)}`).join(",")}}`:JSON.stringify(e)}function za(e){return Va("sha256").update(Yr(e)).digest("hex")}function qa(e){return{url:e.url,finalUrl:e.finalUrl??null,status:e.status??null,contentType:e.contentType??null,blockedByRobots:e.blockedByRobots??!1,error:e.error??null,title:e.title??null,description:e.description??null,canonical:e.canonical??null,canonicalRaw:e.canonicalRaw??e.canonical??null,robots:e.robots??null,xRobotsTag:e.xRobotsTag??null,lang:e.lang??null,h1Count:e.h1Count??0,openGraph:e.openGraph??$a,twitter:e.twitter??Xa,hreflang:e.hreflang??[],jsonLd:e.jsonLd??[],images:e.images??[],links:[...e.links??[]].sort(),internalLinks:[...e.internalLinks??[]].sort(),externalLinks:[...e.externalLinks??[]].sort(),wordCount:e.wordCount??0,contentHash:e.contentHash??null,depth:e.depth??0,redirectChain:e.redirectChain??[],responseBytes:e.responseBytes??0}}function eo(e){let t=e.source??{},r=e.options??{},n=e.pages?.[0],s=n&&typeof n=="object"?n.url:void 0,a=e.siteUrl??e.startUrl??t.startUrl??(typeof s=="string"?s:void 0);if(!a)throw new Error("snapshot site URL must be a string");return{schemaVersion:1,url:a,sitemap:r.sitemap??t.sitemap??"auto",maxPages:r.maxPages??t.maxPages??100,concurrency:r.concurrency??5,delay:r.requestDelay??t.requestDelay??100,timeout:r.timeout??1e4,respectRobots:r.respectRobots??t.respectRobots??!0,includeQuery:r.includeQuery??t.includeQuery??!1,maxRedirects:r.maxRedirects??10,maxResponseBytes:r.maxResponseBytes??5*1024*1024,enabledRules:r.enabledRules??null,severityOverrides:r.severityOverrides??{},suppressions:r.suppressions??[],regressionBudgets:r.regressionBudgets??{},report:r.report??{}}}function to(e,t){let r=new Set(e.map(a=>a.url)),n=new Set(e.flatMap(a=>a.internalLinks)),s=new Set;for(let a of e)(a.error||a.blockedByRobots||(a.status??500)>=400)&&s.add(a.url);return{internalEdges:e.reduce((a,c)=>a+c.internalLinks.length,0),externalEdges:e.reduce((a,c)=>a+c.externalLinks.length,0),orphanUrls:t.filter(a=>r.has(a)&&!n.has(a)),brokenInternalUrls:[...s].sort()}}function ro(e,t){let r=t.filter(s=>s.blockedByRobots).length,n=t.filter(s=>s.error||(s.status??500)>=400).length;return{requested:e.requested??t.length,completed:t.length,succeeded:t.length-n-r,failed:n,blockedByRobots:r,redirected:t.filter(s=>s.redirectChain.length>0||s.url!==s.finalUrl).length,durationMs:e.durationMs??0,truncated:e.truncated??!1,partial:e.partial??!1}}function Ie(e){let t=ns(e),r=eo(t),n=(t.pages??[]).map(o=>qa(Za(o))).sort((o,d)=>o.url.localeCompare(d.url)),s=t.sitemap?.urls??[];if(t.sitemap&&!t.sitemap.url)throw new Error("snapshot sitemap URL must be a string");let a=t.sitemap?{url:t.sitemap.url,urls:[...s].sort(),sitemapCount:t.sitemap.sitemapCount??0,truncated:t.sitemap.truncated??!1,error:t.sitemap.error??null}:null,c=t.startUrl??r.url,l=t.truncated??!1;return{schemaVersion:2,engineVersion:X,ruleSetVersion:ot,generatedAt:t.generatedAt??new Date().toISOString(),siteUrl:c,configurationHash:za(r),config:r,robots:{url:t.robots?.url??new URL("/robots.txt",c).href,status:t.robots?.status??null,sha256:t.robots?.sha256??null,error:t.robots?.error??null,denyAll:t.robots?.denyAll??!1},sitemap:a,pages:n,linkGraph:t.linkGraph??to(n,s),statistics:t.statistics??ro(t,n),partial:t.partial??!1,source:{startUrl:c,maxPages:r.maxPages,requestDelay:r.delay,includeQuery:r.includeQuery,respectRobots:r.respectRobots,sitemap:typeof r.sitemap=="string"&&!["auto","none"].includes(r.sitemap)?r.sitemap:null},truncated:l}}function ye(e){let t=ns(e);if(!Array.isArray(t.pages))throw new Error("snapshot pages must be an array");if(t.schemaVersion===2)return Ie({...t,startUrl:t.siteUrl,options:t.config,pages:t.pages,generatedAt:t.generatedAt,partial:t.partial,statistics:t.statistics,linkGraph:t.linkGraph});if(t.schemaVersion===1)return Ie(t);throw new Error(`unsupported snapshot schema version: ${String(t.schemaVersion)}`)}function Re(e){if(e.schemaVersion===2)return e;let t=e,r=t.pages?.[0],n=r&&typeof r=="object"?r.url:void 0,s=typeof n=="string"?n:t.source?.startUrl??"https://invalid.local/";return Ie({...t,startUrl:t.siteUrl??t.source?.startUrl??s,robots:t.robots??{url:new URL("/robots.txt",s).href,status:null,sha256:null,error:null},options:t.config??t.options??{}})}function me(e,t={}){let r=Re(e);return at(ts(r),r,t)}function ss(e,t){return new RegExp(`(^|[\\s,])${t}($|[\\s,])`,"i").test(e??"")}function ee(e,t,r,n,s){let a=O(e,t,r,{before:n,after:s,actual:s});return a.before=n,a.after=s,a}function is(e,t){let r=!t.partial&&!t.truncated,n=[],s=new Map(t.pages.map(o=>[o.url,o]));e.robots.sha256&&t.robots.sha256&&e.robots.sha256!==t.robots.sha256&&n.push(ee("robots-changed",t.robots.url,"robots.txt content changed",e.robots.sha256,t.robots.sha256));let a=e.sitemap?.urls.length??0,c=t.sitemap?.urls.length??0,l=a-c;r&&a>0&&l>=Math.max(5,Math.ceil(a*.2))&&n.push(ee("sitemap-url-count-drop",t.sitemap?.url??e.sitemap?.url??t.siteUrl,`Sitemap URL count dropped by ${l}`,a,c));for(let o of e.pages){let d=s.get(o.url);if(!d){r&&n.push(ee("page-missing",o.url,"Page was not checked",o.status,null));continue}if(d.blockedByRobots&&!o.blockedByRobots){n.push(ee("robots-blocked",o.url,"Page is now blocked by robots.txt",!1,!0));continue}if(d.error&&!o.error){n.push(ee(d.error.includes("redirect loop")?"redirect-loop":"page-unreachable",o.url,`Page request failed: ${d.error}`,o.error,d.error));continue}o.status!==null&&o.status<400&&(d.status===null||d.status>=400)&&n.push(ee("status-regression",o.url,`HTTP status regressed from ${o.status} to ${d.status??"none"}`,o.status,d.status));let p=`${o.robots??""},${o.xRobotsTag??""}`,h=`${d.robots??""},${d.xRobotsTag??""}`;if(!ss(p,"noindex")&&ss(h,"noindex")&&n.push(ee("new-noindex",o.url,"Page now contains a noindex directive",p,h)),o.title&&!d.title?n.push(ee("title-removed",o.url,"Page title was removed",o.title,d.title)):o.title&&d.title&&o.title!==d.title&&n.push(ee("title-changed",o.url,"Page title changed",o.title,d.title)),o.description&&!d.description&&n.push(ee("description-removed",o.url,"Meta description was removed",o.description,d.description)),o.canonical&&!d.canonical)n.push(ee("canonical-removed",o.url,"Canonical URL was removed",o.canonical,d.canonical));else if(o.canonical&&d.canonical&&o.canonical!==d.canonical){let f=ee("canonical-changed",o.url,"Canonical URL changed",o.canonical,d.canonical);new URL(d.canonical).origin!==new URL(o.url).origin&&(f.severity="error"),n.push(f)}if(o.h1Count>0&&d.h1Count===0&&n.push(ee("h1-removed",o.url,"All H1 headings were removed",o.h1Count,d.h1Count)),o.finalUrl&&d.finalUrl&&o.finalUrl!==d.finalUrl){let f=ee("redirect-changed",o.url,"Final redirect URL changed",o.finalUrl,d.finalUrl);new URL(d.finalUrl).origin!==new URL(o.url).origin&&(f.severity="error"),n.push(f)}}return n}function so(e,t,r={}){let n=Re(e),s=Re(t);return at(is(n,s),s,r)}function ct(e,t){return{...e,lifecycle:t}}function Ye(e,t,r={}){let n=Re(e),s=Re(t),a=!s.partial&&!s.truncated,c=new Set(s.pages.map(I=>I.url)),l=new Map(me(n,r).map(I=>[I.fingerprint,I])),o=new Map(me(s,r).map(I=>[I.fingerprint,I])),d=[],p=[],h=[],f=[];for(let[I,_]of o){let N=l.get(I);N?JSON.stringify(N.evidence)===JSON.stringify(_.evidence)?h.push(ct(_,"unchanged")):p.push(ct({..._,before:N.evidence,after:_.evidence},"ongoing")):d.push(ct(_,"new"))}for(let[I,_]of l)(_.scope==="page"?c.has(_.url):a)&&!o.has(I)&&f.push(ct(_,"resolved"));let m=new Set(d.map(I=>I.fingerprint));for(let I of so(n,s,r))m.has(I.fingerprint)||d.push(ct(I,"new"));let y={...n.config.regressionBudgets,...s.config.regressionBudgets},w=Object.entries(y).flatMap(([I,_])=>{let N=d.filter(L=>L.severity===I||L.ruleId===I).length;return N>_?[{budget:I,allowed:_,actual:N}]:[]});return Qe(d),Qe(p),Qe(h),Qe(f),{complete:a,newIssues:d,ongoingIssues:p,resolvedIssues:f,unchangedIssues:h,issues:[...d,...p],budgetExceeded:w}}var Gr="seo-audit.config.json",as=Object.freeze({schemaVersion:1,url:"",sitemap:"auto",maxPages:100,concurrency:5,delay:100,timeout:1e4,respectRobots:!0,includeQuery:!1,maxRedirects:10,maxResponseBytes:5242880,enabledRules:null,severityOverrides:{},suppressions:[],regressionBudgets:{},report:{}});function lt(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} must be an object`);return e}function Le(e,t,r,n=Number.MAX_SAFE_INTEGER){if(!Number.isInteger(e)||e<r||e>n)throw new Error(`${t} must be an integer between ${r} and ${n}`);return e}function dt(e,t){if(e!==void 0){if(typeof e!="string")throw new Error(`${t} must be a string`);return e}}function Wr(e){let t=lt(e,"config"),r=new Set(["$schema","schemaVersion","url","sitemap","maxPages","concurrency","delay","timeout","respectRobots","includeQuery","maxRedirects","maxResponseBytes","enabledRules","severityOverrides","suppressions","regressionBudgets","report"]);for(let s of Object.keys(t))if(!r.has(s))throw new Error(`unknown config property: ${s}`);let n={};if(t.schemaVersion!==void 0&&t.schemaVersion!==1)throw new Error("schemaVersion must be 1");if(t.url!==void 0){let s=dt(t.url,"url");if(!/^https?:\/\//i.test(s))throw new Error("url must be an HTTP(S) URL");n.url=s}if(t.sitemap!==void 0){let s=dt(t.sitemap,"sitemap");if(!["auto","none"].includes(s)&&!/^https?:\/\//i.test(s))throw new Error("sitemap must be auto, none, or an HTTP(S) URL");n.sitemap=s}t.maxPages!==void 0&&(n.maxPages=Le(t.maxPages,"maxPages",1)),t.concurrency!==void 0&&(n.concurrency=Le(t.concurrency,"concurrency",1,50)),t.delay!==void 0&&(n.delay=Le(t.delay,"delay",0)),t.timeout!==void 0&&(n.timeout=Le(t.timeout,"timeout",1)),t.maxRedirects!==void 0&&(n.maxRedirects=Le(t.maxRedirects,"maxRedirects",0,50)),t.maxResponseBytes!==void 0&&(n.maxResponseBytes=Le(t.maxResponseBytes,"maxResponseBytes",1024));for(let s of["respectRobots","includeQuery"])if(t[s]!==void 0){if(typeof t[s]!="boolean")throw new Error(`${s} must be a boolean`);n[s]=t[s]}if(t.enabledRules!==void 0){if(t.enabledRules!==null&&(!Array.isArray(t.enabledRules)||t.enabledRules.some(s=>typeof s!="string")))throw new Error("enabledRules must be null or an array of rule IDs");n.enabledRules=t.enabledRules}if(t.severityOverrides!==void 0){let s=lt(t.severityOverrides,"severityOverrides");for(let[a,c]of Object.entries(s))if(!["error","warning","info"].includes(c))throw new Error(`severityOverrides.${a} must be error, warning, or info`);n.severityOverrides=s}if(t.suppressions!==void 0){if(!Array.isArray(t.suppressions))throw new Error("suppressions must be an array");n.suppressions=t.suppressions.map((s,a)=>{let c=lt(s,`suppressions[${a}]`);for(let l of["rule","urlPattern","reason"])if(typeof c[l]!="string"||c[l]==="")throw new Error(`suppressions[${a}].${l} must be a non-empty string`);if(c.expiresAt!==void 0&&!/^\d{4}-\d{2}-\d{2}$/.test(String(c.expiresAt)))throw new Error(`suppressions[${a}].expiresAt must use YYYY-MM-DD`);return c})}if(t.regressionBudgets!==void 0){let s=lt(t.regressionBudgets,"regressionBudgets");n.regressionBudgets=Object.fromEntries(Object.entries(s).map(([a,c])=>[a,Le(c,`regressionBudgets.${a}`,0)]))}if(t.report!==void 0){let s=lt(t.report,"report"),a={},c=dt(s.agencyName,"report.agencyName"),l=dt(s.logo,"report.logo"),o=dt(s.primaryColor,"report.primaryColor");if(c!==void 0&&(a.agencyName=c),l!==void 0&&(a.logo=l),o!==void 0&&(a.primaryColor=o),a.primaryColor&&!/^#[0-9a-f]{6}$/i.test(a.primaryColor))throw new Error("report.primaryColor must be a six-digit hex color");n.report=Object.fromEntries(Object.entries(a).filter(([,d])=>d!==void 0))}return n}function Te(e,t={},r={}){return{...{...as,...r,...t,...e},schemaVersion:1,severityOverrides:{...r.severityOverrides??{},...t.severityOverrides??{},...e.severityOverrides??{}},regressionBudgets:{...r.regressionBudgets??{},...t.regressionBudgets??{},...e.regressionBudgets??{}},report:{...r.report??{},...t.report??{},...e.report??{}},suppressions:e.suppressions??t.suppressions??r.suppressions??[]}}function Gt(){}var Wt=Object.freeze({debug:Gt,info:Gt,warn:Gt,error:Gt});import{setTimeout as io}from"node:timers/promises";function ao(e=0,{now:t=Date.now,wait:r=io}={}){let n=Math.max(0,e),s=0,a=Promise.resolve();return function(){if(n===0)return Promise.resolve();let l=a.then(async()=>{let o=Math.max(0,s-t());o>0&&await r(o),s=t()+n});return a=l.catch(()=>{}),l}}function Ge(e=0,t=ao){let r=new Map;return n=>{let s=new URL(n).origin,a=r.get(s);return a||(a=t(e),r.set(s,a)),a()}}import{createHash as ho}from"node:crypto";import{setTimeout as os}from"node:timers/promises";var fe=class extends Error{redirectChain;constructor(t,r=[],n){super(t,n),this.name="RequestFailure",this.redirectChain=r}};function oo(e){return e===429||e===500||e===502||e===503||e===504}function co(e,t=Date.now()){if(!e)return null;let r=Number(e);if(Number.isFinite(r)&&r>=0)return Math.min(r*1e3,3e4);let n=Date.parse(e);return Number.isNaN(n)?null:Math.min(Math.max(0,n-t),3e4)}function lo(e,t){let r=AbortSignal.timeout(e);return t?AbortSignal.any([t,r]):r}async function uo(e,t,r){let n=[],s=new Set([e]),a=e;for(;;){r.signal?.throwIfAborted(),await r.gate?.(a);let c=await r.fetch(a,{...t,redirect:"manual",signal:lo(r.timeout,r.signal)}),l=c.headers.get("location");if(c.status<300||c.status>=400||!l)return{response:c,redirectChain:n};let o=new URL(l,a).href;if(n.push({url:a,status:c.status,location:o}),await c.body?.cancel(),s.has(o))throw new fe(`redirect loop detected at ${o}`,n);if(n.length>r.maxRedirects)throw new fe(`redirect limit of ${r.maxRedirects} exceeded`,n);s.add(o),a=o}}async function Oe(e,t,r){let n;for(let s=0;s<=r.retries;s+=1)try{let a=await uo(e,t,r);if(!oo(a.response.status)||s===r.retries)return a;let c=co(a.response.headers.get("retry-after"));await a.response.body?.cancel();let l=Math.floor((r.random??Math.random)()*100),o=c??Math.min(250*2**s+l,3e4);await r.onEvent?.({type:"retry",url:e,attempt:s+1,delayMs:o}),await os(o,void 0,{signal:r.signal})}catch(a){if(r.signal?.aborted)throw r.signal.reason??a;if(n=a,a instanceof fe||s===r.retries)break;let c=Math.floor((r.random??Math.random)()*100),l=Math.min(250*2**s+c,3e4);await r.onEvent?.({type:"retry",url:e,attempt:s+1,delayMs:l}),await os(l,void 0,{signal:r.signal})}throw n instanceof fe?n:new fe(n instanceof Error?n.message:String(n),[],{cause:n})}async function ve(e,t){if(!e.body)return{text:"",bytes:0,buffer:Buffer.alloc(0)};let r=e.body.getReader(),n=[],s=0;for(;;){let{done:c,value:l}=await r.read();if(c)break;if(s+=l.byteLength,s>t)throw await r.cancel(),new fe(`response exceeds ${t} bytes`);n.push(Buffer.from(l))}let a=Buffer.concat(n);return{text:a.toString("utf8"),bytes:s,buffer:a}}function Ao(e,t){if(!t)return!1;let r=t.endsWith("$"),s=(r?t.slice(0,-1):t).replace(/[.+?^${}()|[\]\\]/g,"\\$&").replaceAll("*",".*");return new RegExp(`^${s}${r?"$":""}`).test(e)}function po(e,t){let r=[],n=null;for(let l of e.replace(/^\uFEFF/,"").split(/\r?\n/)){let o=l.replace(/#.*$/,"").trim(),d=o.indexOf(":");if(!o||d<0)continue;let p=o.slice(0,d).trim().toLowerCase(),h=o.slice(d+1).trim();if(p==="user-agent"){(!n||n.hasRules)&&(n={agents:[],rules:[],hasRules:!1},r.push(n)),h&&n.agents.push(h.toLowerCase());continue}n&&(p==="allow"||p==="disallow")&&h&&(n.rules.push({type:p,path:h}),n.hasRules=!0)}let s=t.toLowerCase(),a=r.filter(l=>l.agents.some(o=>o!=="*"&&s.includes(o)));return(a.length>0?a:r.filter(l=>l.agents.includes("*"))).flatMap(l=>l.rules)}function cs(e,t){if(t.denyAll)return!1;let r=new URL(e),n=`${r.pathname}${r.search}`,s=(t.rules??[]).filter(a=>Ao(n,a.path)).sort((a,c)=>c.path.length-a.path.length||(a.type==="allow"?-1:1));return s.length===0||s[0]?.type==="allow"}async function Kt(e,t){let r=new URL("/robots.txt",e).href;try{let{response:n}=await Oe(r,{headers:{accept:"text/plain,*/*;q=0.1","user-agent":t.userAgent}},{fetch:t.fetch,timeout:t.timeout,maxRedirects:t.maxRedirects,retries:t.retries,signal:t.signal,gate:t.requestGate,onEvent:t.onEvent}),{text:s}=await ve(n,go);return{url:r,status:n.status,body:s,sha256:ho("sha256").update(s).digest("hex"),rules:n.ok?po(s,t.userAgent):[],denyAll:n.status===401||n.status===403,error:null}}catch(n){if(t.signal?.aborted)throw n;return{url:r,status:null,body:"",sha256:null,rules:[],denyAll:!1,error:n instanceof Error?n.message:String(n)}}}var go=512*1024;import{gunzipSync as vc}from"node:zlib";var ls=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",mo=ls+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",fo="["+ls+"]["+mo+"]*",Eo=new RegExp("^"+fo+"$");function Jt(e,t){let r=[],n=t.exec(e);for(;n;){let s=[];s.startIndex=t.lastIndex-n[0].length;let a=n.length;for(let c=0;c<a;c++)s.push(n[c]);r.push(s),n=t.exec(e)}return r}var Kr=function(e){let t=Eo.exec(e);return!(t===null||typeof t>"u")};function ds(e){return typeof e<"u"}var ut=["hasOwnProperty","toString","valueOf","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"],jt=["__proto__","constructor","prototype"];var To={allowBooleanAttributes:!1,unpairedTags:[]};function Vt(e,t){t=Object.assign({},To,t);let r=[],n=!1,s=!1;e[0]==="\uFEFF"&&(e=e.substr(1));for(let a=0;a<e.length;a++)if(e[a]==="<"&&e[a+1]==="?"){if(a+=2,a=As(e,a),a.err)return a}else if(e[a]==="<"){let c=a;if(a++,e[a]==="!"){a=ps(e,a);continue}else{let l=!1;e[a]==="/"&&(l=!0,a++);let o="";for(;a<e.length&&e[a]!==">"&&e[a]!==" "&&e[a]!==" "&&e[a]!==`
5
- `&&e[a]!=="\r";a++)o+=e[a];if(o=o.trim(),o[o.length-1]==="/"&&(o=o.substring(0,o.length-1),a--),!No(o)){let h;return o.trim().length===0?h="Invalid space after '<'.":h="Tag '"+o+"' is an invalid name.",Q("InvalidTag",h,Z(e,a))}let d=Io(e,a);if(d===!1)return Q("InvalidAttr","Attributes for '"+o+"' have open quote.",Z(e,a));let p=d.value;if(a=d.index,p[p.length-1]==="/"){let h=a-p.length;p=p.substring(0,p.length-1);let f=hs(p,t);if(f===!0)n=!0;else return Q(f.err.code,f.err.msg,Z(e,h+f.err.line))}else if(l)if(d.tagClosed){if(p.trim().length>0)return Q("InvalidTag","Closing tag '"+o+"' can't have attributes or invalid starting.",Z(e,c));if(r.length===0)return Q("InvalidTag","Closing tag '"+o+"' has not been opened.",Z(e,c));{let h=r.pop();if(o!==h.tagName){let f=Z(e,h.tagStartPos);return Q("InvalidTag","Expected closing tag '"+h.tagName+"' (opened in line "+f.line+", col "+f.col+") instead of closing tag '"+o+"'.",Z(e,c))}r.length==0&&(s=!0)}}else return Q("InvalidTag","Closing tag '"+o+"' doesn't have proper closing.",Z(e,a));else{let h=hs(p,t);if(h!==!0)return Q(h.err.code,h.err.msg,Z(e,a-p.length+h.err.line));if(s===!0)return Q("InvalidXml","Multiple possible root nodes found.",Z(e,a));t.unpairedTags.indexOf(o)!==-1||r.push({tagName:o,tagStartPos:c}),n=!0}for(a++;a<e.length;a++)if(e[a]==="<")if(e[a+1]==="!"){a++,a=ps(e,a);continue}else if(e[a+1]==="?"){if(a=As(e,++a),a.err)return a}else break;else if(e[a]==="&"){let h=xo(e,a);if(h==-1)return Q("InvalidChar","char '&' is not expected.",Z(e,a));a=h}else if(s===!0&&!us(e[a]))return Q("InvalidXml","Extra text at the end",Z(e,a));e[a]==="<"&&a--}}else{if(us(e[a]))continue;return Q("InvalidChar","char '"+e[a]+"' is not expected.",Z(e,a))}if(n){if(r.length==1)return Q("InvalidTag","Unclosed tag '"+r[0].tagName+"'.",Z(e,r[0].tagStartPos));if(r.length>0)return Q("InvalidXml","Invalid '"+JSON.stringify(r.map(a=>a.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return Q("InvalidXml","Start tag expected.",1);return!0}function us(e){return e===" "||e===" "||e===`
6
- `||e==="\r"}function As(e,t){let r=t;for(;t<e.length;t++)if(e[t]=="?"||e[t]==" "){let n=e.substr(r,t-r);if(t>5&&n==="xml")return Q("InvalidXml","XML declaration allowed only at the start of the document.",Z(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function ps(e,t){if(e.length>t+5&&e[t+1]==="-"&&e[t+2]==="-"){for(t+=3;t<e.length;t++)if(e[t]==="-"&&e[t+1]==="-"&&e[t+2]===">"){t+=2;break}}else if(e.length>t+8&&e[t+1]==="D"&&e[t+2]==="O"&&e[t+3]==="C"&&e[t+4]==="T"&&e[t+5]==="Y"&&e[t+6]==="P"&&e[t+7]==="E"){let r=1;for(t+=8;t<e.length;t++)if(e[t]==="<")r++;else if(e[t]===">"&&(r--,r===0))break}else if(e.length>t+9&&e[t+1]==="["&&e[t+2]==="C"&&e[t+3]==="D"&&e[t+4]==="A"&&e[t+5]==="T"&&e[t+6]==="A"&&e[t+7]==="["){for(t+=8;t<e.length;t++)if(e[t]==="]"&&e[t+1]==="]"&&e[t+2]===">"){t+=2;break}}return t}var bo='"',Co="'";function Io(e,t){let r="",n="",s=!1;for(;t<e.length;t++){if(e[t]===bo||e[t]===Co)n===""?n=e[t]:n!==e[t]||(n="");else if(e[t]===">"&&n===""){s=!0;break}r+=e[t]}return n!==""?!1:{value:r,index:t,tagClosed:s}}var yo=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function hs(e,t){let r=Jt(e,yo),n={};for(let s=0;s<r.length;s++){if(r[s][1].length===0)return Q("InvalidAttr","Attribute '"+r[s][2]+"' has no space in starting.",At(r[s]));if(r[s][3]!==void 0&&r[s][4]===void 0)return Q("InvalidAttr","Attribute '"+r[s][2]+"' is without value.",At(r[s]));if(r[s][3]===void 0&&!t.allowBooleanAttributes)return Q("InvalidAttr","boolean attribute '"+r[s][2]+"' is not allowed.",At(r[s]));let a=r[s][2];if(!So(a))return Q("InvalidAttr","Attribute '"+a+"' is an invalid name.",At(r[s]));if(!Object.prototype.hasOwnProperty.call(n,a))n[a]=1;else return Q("InvalidAttr","Attribute '"+a+"' is repeated.",At(r[s]))}return!0}function wo(e,t){let r=/\d/;for(e[t]==="x"&&(t++,r=/[\da-fA-F]/);t<e.length;t++){if(e[t]===";")return t;if(!e[t].match(r))break}return-1}function xo(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,wo(e,t);let r=0;for(;t<e.length;t++,r++)if(!(e[t].match(/\w/)&&r<20)){if(e[t]===";")break;return-1}return t}function Q(e,t,r){return{err:{code:e,msg:t,line:r.line||r,col:r.col}}}function So(e){return Kr(e)}function No(e){return Kr(e)}function Z(e,t){let r=e.substring(0,t).split(/\r?\n/);return{line:r.length,col:r[r.length-1].length+1}}function At(e){return e.startIndex+e[1].length}var Jr={cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",euro:"\u20AC",dollar:"$",fnof:"\u0192",inr:"\u20B9",af:"\u060B",birr:"\u1265\u122D",peso:"\u20B1",rub:"\u20BD",won:"\u20A9",yuan:"\xA5",cedil:"\xB8"};var pt={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'},jr={nbsp:"\xA0",copy:"\xA9",reg:"\xAE",trade:"\u2122",mdash:"\u2014",ndash:"\u2013",hellip:"\u2026",laquo:"\xAB",raquo:"\xBB",lsquo:"\u2018",rsquo:"\u2019",ldquo:"\u201C",rdquo:"\u201D",bull:"\u2022",para:"\xB6",sect:"\xA7",deg:"\xB0",frac12:"\xBD",frac14:"\xBC",frac34:"\xBE"};var We=Object.freeze({ALLOW:"allow",BLOCK:"block",THROW:"throw"}),_o=new Set("!?\\\\/[]$%{}^&*()<>|+");function gs(e){if(e[0]==="#")throw new Error(`[EntityReplacer] Invalid character '#' in entity name: "${e}"`);for(let t of e)if(_o.has(t))throw new Error(`[EntityReplacer] Invalid character '${t}' in entity name: "${e}"`);return e}function ht(...e){let t=Object.create(null);for(let r of e)if(r)for(let n of Object.keys(r)){let s=r[n];if(typeof s=="string")t[n]=s;else if(s&&typeof s=="object"&&s.val!==void 0){let a=s.val;typeof a=="string"&&(t[n]=a)}}return t}var De="external",$t="base",Vr="all";function Ro(e){return!e||e===De?new Set([De]):e===Vr?new Set([Vr]):e===$t?new Set([$t]):Array.isArray(e)?new Set(e):new Set([De])}var te=Object.freeze({allow:0,leave:1,remove:2,throw:3}),Lo=new Set([9,10,13]);function Oo(e){if(!e)return{xmlVersion:1,onLevel:te.allow,nullLevel:te.remove};let t=e.xmlVersion===1.1?1.1:1,r=te[e.onNCR]??te.allow,n=te[e.nullNCR]??te.remove,s=Math.max(n,te.remove);return{xmlVersion:t,onLevel:r,nullLevel:s}}var Ke=class{constructor(t={}){this._limit=t.limit||{},this._maxTotalExpansions=this._limit.maxTotalExpansions||0,this._maxExpandedLength=this._limit.maxExpandedLength||0,this._postCheck=typeof t.postCheck=="function"?t.postCheck:n=>n,this._limitTiers=Ro(this._limit.applyLimitsTo??De),this._numericAllowed=t.numericAllowed??!0,this._baseMap=ht(pt,t.namedEntities||null),this._externalMap=Object.create(null),this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this._removeSet=new Set(t.remove&&Array.isArray(t.remove)?t.remove:[]),this._leaveSet=new Set(t.leave&&Array.isArray(t.leave)?t.leave:[]);let r=Oo(t.ncr);this._ncrXmlVersion=r.xmlVersion,this._ncrOnLevel=r.onLevel,this._ncrNullLevel=r.nullLevel,this._onExternalEntity=typeof t.onExternalEntity=="function"?t.onExternalEntity:null,this._onInputEntity=typeof t.onInputEntity=="function"?t.onInputEntity:null}_applyRegistrationHook(t,r,n,s){if(!t)return!0;let a=t(r,n);if(a===We.BLOCK)return!1;if(a===We.THROW)throw new Error(`[EntityDecoder] Registration of ${s} entity "&${r};" was rejected by hook`);return!0}setExternalEntities(t){if(t)for(let s of Object.keys(t))gs(s);if(!this._onExternalEntity){this._externalMap=ht(t);return}let r=ht(t),n=Object.create(null);for(let[s,a]of Object.entries(r))this._applyRegistrationHook(this._onExternalEntity,s,a,"external")&&(n[s]=a);this._externalMap=n}addExternalEntity(t,r){gs(t),typeof r=="string"&&r.indexOf("&")===-1&&this._applyRegistrationHook(this._onExternalEntity,t,r,"external")&&(this._externalMap[t]=r)}addInputEntities(t){if(this._totalExpansions=0,this._expandedLength=0,!this._onInputEntity){this._inputMap=ht(t);return}let r=ht(t),n=Object.create(null);for(let[s,a]of Object.entries(r))this._applyRegistrationHook(this._onInputEntity,s,a,"input")&&(n[s]=a);this._inputMap=n}reset(){return this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this}setXmlVersion(t){this._ncrXmlVersion=t===1.1?1.1:1}decode(t){if(typeof t!="string"||t.length===0||t.indexOf("&")===-1)return t;let r=t,n=[],s=t.length,a=0,c=0,l=this._maxTotalExpansions>0,o=this._maxExpandedLength>0,d=l||o;for(;c<s;){if(t.charCodeAt(c)!==38){c++;continue}let h=c+1;for(;h<s&&t.charCodeAt(h)!==59&&h-c<=32;)h++;if(h>=s||t.charCodeAt(h)!==59){c++;continue}let f=t.slice(c+1,h);if(f.length===0){c++;continue}let m,y;if(this._removeSet.has(f))m="",y===void 0&&(y=De);else if(this._leaveSet.has(f)){c++;continue}else if(f.charCodeAt(0)===35){let w=this._resolveNCR(f);if(w===void 0){c++;continue}m=w,y=$t}else{let w=this._resolveName(f);m=w?.value,y=w?.tier}if(m===void 0){c++;continue}if(c>a&&n.push(t.slice(a,c)),n.push(m),a=h+1,c=a,d&&this._tierCounts(y)){if(l&&(this._totalExpansions++,this._totalExpansions>this._maxTotalExpansions))throw new Error(`[EntityReplacer] Entity expansion count limit exceeded: ${this._totalExpansions} > ${this._maxTotalExpansions}`);if(o){let w=m.length-(f.length+2);if(w>0&&(this._expandedLength+=w,this._expandedLength>this._maxExpandedLength))throw new Error(`[EntityReplacer] Expanded content length limit exceeded: ${this._expandedLength} > ${this._maxExpandedLength}`)}}}a<s&&n.push(t.slice(a));let p=n.length===0?t:n.join("");return this._postCheck(p,r)}_tierCounts(t){return this._limitTiers.has(Vr)?!0:this._limitTiers.has(t)}_resolveName(t){if(t in this._inputMap)return{value:this._inputMap[t],tier:De};if(t in this._externalMap)return{value:this._externalMap[t],tier:De};if(t in this._baseMap)return{value:this._baseMap[t],tier:$t}}_classifyNCR(t){return t===0?this._ncrNullLevel:t>=55296&&t<=57343||this._ncrXmlVersion===1&&t>=1&&t<=31&&!Lo.has(t)?te.remove:-1}_applyNCRAction(t,r,n){switch(t){case te.allow:return String.fromCodePoint(n);case te.remove:return"";case te.leave:return;case te.throw:throw new Error(`[EntityDecoder] Prohibited numeric character reference &${r}; (U+${n.toString(16).toUpperCase().padStart(4,"0")})`);default:return String.fromCodePoint(n)}}_resolveNCR(t){let r=t.charCodeAt(1),n;if(r===120||r===88?n=parseInt(t.slice(2),16):n=parseInt(t.slice(1),10),Number.isNaN(n)||n<0||n>1114111)return;let s=this._classifyNCR(n);if(!this._numericAllowed&&s<te.remove)return;let a=s===-1?this._ncrOnLevel:Math.max(this._ncrOnLevel,s);return this._applyNCRAction(a,t,n)}};var ms=e=>ut.includes(e)?"__"+e:e,vo={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0,unicode:!1},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,entityDecoder:null,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,r){return e},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0,jPath:!0,onDangerousProperty:ms};function Do(e,t){if(typeof e!="string")return;let r=e.toLowerCase();if(ut.some(n=>r===n.toLowerCase()))throw new Error(`[SECURITY] Invalid ${t}: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`);if(jt.some(n=>r===n.toLowerCase()))throw new Error(`[SECURITY] Invalid ${t}: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`)}function fs(e,t){return typeof e=="boolean"?{enabled:e,maxEntitySize:1e4,maxExpansionDepth:1e4,maxTotalExpansions:1/0,maxExpandedLength:1e5,maxEntityCount:1e3,allowedTags:null,tagFilter:null,appliesTo:"all"}:typeof e=="object"&&e!==null?{enabled:e.enabled!==!1,maxEntitySize:Math.max(1,e.maxEntitySize??1e4),maxExpansionDepth:Math.max(1,e.maxExpansionDepth??1e4),maxTotalExpansions:Math.max(1,e.maxTotalExpansions??1/0),maxExpandedLength:Math.max(1,e.maxExpandedLength??1e5),maxEntityCount:Math.max(1,e.maxEntityCount??1e3),allowedTags:e.allowedTags??null,tagFilter:e.tagFilter??null,appliesTo:e.appliesTo??"all"}:fs(!0)}var Es=function(e){let t=Object.assign({},vo,e),r=[{value:t.attributeNamePrefix,name:"attributeNamePrefix"},{value:t.attributesGroupName,name:"attributesGroupName"},{value:t.textNodeName,name:"textNodeName"},{value:t.cdataPropName,name:"cdataPropName"},{value:t.commentPropName,name:"commentPropName"}];for(let{value:n,name:s}of r)n&&Do(n,s);return t.onDangerousProperty===null&&(t.onDangerousProperty=ms),t.processEntities=fs(t.processEntities,t.htmlEntities),t.unpairedTagsSet=new Set(t.unpairedTags),t.stopNodes&&Array.isArray(t.stopNodes)&&(t.stopNodes=t.stopNodes.map(n=>typeof n=="string"&&n.startsWith("*.")?".."+n.substring(2):n)),t};var Xt;typeof Symbol!="function"?Xt="@@xmlMetadata":Xt=Symbol("XML Node Metadata");var re=class{constructor(t){this.tagname=t,this.child=[],this[":@"]=Object.create(null)}add(t,r){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:r})}addChild(t,r){t.tagname==="__proto__"&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child}),r!==void 0&&(this.child[this.child.length-1][Xt]={startIndex:r})}static getMetaDataSymbol(){return Xt}};var Ts=":A-Za-z_\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u0486\u0488-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD",ko=Ts+"\\-\\.\\d\xB7\u0300-\u036F\u203F-\u2040",bs=":A-Za-z_\xC0-\u02FF\u0370-\u037D\u037F-\u0486\u0488-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}",Bo=bs+"\\-\\.\\d\xB7\u0300-\u036F\u0487\u203F-\u2040",$r=(e,t,r="")=>{let n=e.replace(":",""),s=t.replace(":",""),a=`[${n}][${s}]*`;return{name:new RegExp(`^[${e}][${t}]*$`,r),ncName:new RegExp(`^${a}$`,r),qName:new RegExp(`^${a}(?::${a})?$`,r),nmToken:new RegExp(`^[${t}]+$`,r),nmTokens:new RegExp(`^[${t}]+(?:\\s+[${t}]+)*$`,r)}},Po=$r(Ts,ko),Mo=$r(bs,Bo,"u"),Cs=":A-Za-z_",Uo=Cs+"\\-\\.\\d",Fo=$r(Cs,Uo),Ho=(e="1.0",t=!1)=>t?Fo:e==="1.1"?Mo:Po;var Xr=(e,{xmlVersion:t="1.0",asciiOnly:r=!1}={})=>Ho(t,r).qName.test(e);var mt=class{constructor(t,r){this.suppressValidationErr=!t,this.options=t,this.xmlVersion=r||1}setXmlVersion(t=1){this.xmlVersion=t}readDocType(t,r){let n=Object.create(null),s=0;if(t[r+3]==="O"&&t[r+4]==="C"&&t[r+5]==="T"&&t[r+6]==="Y"&&t[r+7]==="P"&&t[r+8]==="E"){r=r+9;let a=1,c=!1,l=!1,o="";for(;r<t.length;r++)if(t[r]==="<"&&!l){if(c&&ke(t,"!ENTITY",r)){r+=7;let d,p;if([d,p,r]=this.readEntityExp(t,r+1,this.suppressValidationErr),p.indexOf("&")===-1){if(this.options.enabled!==!1&&this.options.maxEntityCount!=null&&s>=this.options.maxEntityCount)throw new Error(`Entity count (${s+1}) exceeds maximum allowed (${this.options.maxEntityCount})`);n[d]=p,s++}}else if(c&&ke(t,"!ELEMENT",r)){r+=8;let{index:d}=this.readElementExp(t,r+1);r=d}else if(c&&ke(t,"!ATTLIST",r))r+=8;else if(c&&ke(t,"!NOTATION",r)){r+=9;let{index:d}=this.readNotationExp(t,r+1,this.suppressValidationErr);r=d}else if(ke(t,"!--",r))l=!0;else throw new Error("Invalid DOCTYPE");a++,o=""}else if(t[r]===">"){if(l?t[r-1]==="-"&&t[r-2]==="-"&&(l=!1,a--):a--,a===0)break}else t[r]==="["?c=!0:o+=t[r];if(a!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:n,i:r}}readEntityExp(t,r){r=ne(t,r);let n=r;for(;r<t.length&&!/\s/.test(t[r])&&t[r]!=='"'&&t[r]!=="'";)r++;let s=t.substring(n,r);if(gt(s,{xmlVersion:this.xmlVersion}),r=ne(t,r),!this.suppressValidationErr){if(t.substring(r,r+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(t[r]==="%")throw new Error("Parameter entities are not supported")}let a="";if([r,a]=this.readIdentifierVal(t,r,"entity"),this.options.enabled!==!1&&this.options.maxEntitySize!=null&&a.length>this.options.maxEntitySize)throw new Error(`Entity "${s}" size (${a.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return r--,[s,a,r]}readNotationExp(t,r){r=ne(t,r);let n=r;for(;r<t.length&&!/\s/.test(t[r]);)r++;let s=t.substring(n,r);!this.suppressValidationErr&&gt(s,{xmlVersion:this.xmlVersion}),r=ne(t,r);let a=t.substring(r,r+6).toUpperCase();if(!this.suppressValidationErr&&a!=="SYSTEM"&&a!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${a}"`);r+=a.length,r=ne(t,r);let c=null,l=null;if(a==="PUBLIC")[r,c]=this.readIdentifierVal(t,r,"publicIdentifier"),r=ne(t,r),(t[r]==='"'||t[r]==="'")&&([r,l]=this.readIdentifierVal(t,r,"systemIdentifier"));else if(a==="SYSTEM"&&([r,l]=this.readIdentifierVal(t,r,"systemIdentifier"),!this.suppressValidationErr&&!l))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:s,publicIdentifier:c,systemIdentifier:l,index:--r}}readIdentifierVal(t,r,n){let s="",a=t[r];if(a!=='"'&&a!=="'")throw new Error(`Expected quoted string, found "${a}"`);r++;let c=r;for(;r<t.length&&t[r]!==a;)r++;if(s=t.substring(c,r),t[r]!==a)throw new Error(`Unterminated ${n} value`);return r++,[r,s]}readElementExp(t,r){r=ne(t,r);let n=r;for(;r<t.length&&!/\s/.test(t[r]);)r++;let s=t.substring(n,r);if(!this.suppressValidationErr&&!Xr(s,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid element name: "${s}"`);r=ne(t,r);let a="";if(t[r]==="E"&&ke(t,"MPTY",r))r+=4;else if(t[r]==="A"&&ke(t,"NY",r))r+=2;else if(t[r]==="("){r++;let c=r;for(;r<t.length&&t[r]!==")";)r++;if(a=t.substring(c,r),t[r]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${t[r]}"`);return{elementName:s,contentModel:a.trim(),index:r}}readAttlistExp(t,r){r=ne(t,r);let n=r;for(;r<t.length&&!/\s/.test(t[r]);)r++;let s=t.substring(n,r);for(gt(s,{xmlVersion:this.xmlVersion}),r=ne(t,r),n=r;r<t.length&&!/\s/.test(t[r]);)r++;let a=t.substring(n,r);if(!gt(a,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid attribute name: "${a}"`);r=ne(t,r);let c="";if(t.substring(r,r+8).toUpperCase()==="NOTATION"){if(c="NOTATION",r+=8,r=ne(t,r),t[r]!=="(")throw new Error(`Expected '(', found "${t[r]}"`);r++;let o=[];for(;r<t.length&&t[r]!==")";){let d=r;for(;r<t.length&&t[r]!=="|"&&t[r]!==")";)r++;let p=t.substring(d,r);if(p=p.trim(),!gt(p,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid notation name: "${p}"`);o.push(p),t[r]==="|"&&(r++,r=ne(t,r))}if(t[r]!==")")throw new Error("Unterminated list of notations");r++,c+=" ("+o.join("|")+")"}else{let o=r;for(;r<t.length&&!/\s/.test(t[r]);)r++;c+=t.substring(o,r);let d=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!d.includes(c.toUpperCase()))throw new Error(`Invalid attribute type: "${c}"`)}r=ne(t,r);let l="";return t.substring(r,r+8).toUpperCase()==="#REQUIRED"?(l="#REQUIRED",r+=8):t.substring(r,r+7).toUpperCase()==="#IMPLIED"?(l="#IMPLIED",r+=7):[r,l]=this.readIdentifierVal(t,r,"ATTLIST"),{elementName:s,attributeName:a,attributeType:c,defaultValue:l,index:r}}},ne=(e,t)=>{for(;t<e.length&&/\s/.test(e[t]);)t++;return t};function ke(e,t,r){for(let n=0;n<t.length;n++)if(t[n]!==e[r+n+1])return!1;return!0}function gt(e,t){if(Xr(e,{xmlVersion:t}))return e;throw new Error(`Invalid entity name ${e}`)}var Qo=[48,1632,1776,2406,2534,2662,2790,2918,3046,3174,3302,3430,3558,3664,3792,3872,4160,4240,6112,6160,6470,6608,6784,6800,6992,7088,7232,7248,65296,120782,120792,120802,120812,120822,66720,68912,69734,69872,69942,70096,70384,70736,70864,71248,71360,71472,71904,72016,72688,72784,73040,73120,73552,92768,92864,93008,123200,123632,124144,125264,130032],Zt=255,zt=new Map,Is=65535,ys=1632,Je=ys,Yo=Is-ys+1,qt=new Uint8Array(Yo).fill(Zt);for(let e of Qo)for(let t=0;t<10;t++){let r=e+t;r<=Is?qt[r-Je]=t:zt.set(r,t)}var ws=48,xs=57,Ss=45,er=new Set([8722,65293,65123]);function Go(e){if(typeof e!="string")return e;let t=e.length;if(t===0)return e;let r=-1;for(let s=0;s<t;s++){let a=e.charCodeAt(s);if(!(a>=ws&&a<=xs||a===Ss)){if(a<Je){if(er.has(a)){r=s;break}continue}if(a>=55296&&a<=56319){if(s+1<t){let c=e.charCodeAt(s+1);if(c>=56320&&c<=57343){let l=65536+(a-55296<<10)+(c-56320);if(zt.has(l)){r=s;break}}}continue}if(qt[a-Je]!==Zt||er.has(a)){r=s;break}}}if(r===-1)return e;let n=[];r>0&&n.push(e.slice(0,r));for(let s=r;s<t;s++){let a=e.charCodeAt(s);if(a>=ws&&a<=xs||a===Ss){n.push(e[s]);continue}if(a<Je){n.push(er.has(a)?"-":e[s]);continue}if(a>=55296&&a<=56319){if(s+1<t){let l=e.charCodeAt(s+1);if(l>=56320&&l<=57343){let o=65536+(a-55296<<10)+(l-56320),d=zt.get(o);if(d!==void 0){n.push(String.fromCharCode(d+48)),s++;continue}}}n.push(e[s]);continue}if(er.has(a)){n.push("-");continue}let c=qt[a-Je];n.push(c!==Zt?String.fromCharCode(c+48):e[s])}return n.join("")}var Ns=Go;var Wo=/^[-+]?0x[a-fA-F0-9]+$/,Ko=/^0b[01]+$/,Jo=/^0o[0-7]+$/,jo=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,Vo={hex:!0,binary:!1,octal:!1,leadingZeros:!0,decimalPoint:".",eNotation:!0,infinity:"original",unicode:!1};function zr(e,t={}){if(t=Object.assign({},Vo,t),!e||typeof e!="string")return e;let r=e.trim();if(r.length===0)return e;if(t.skipLike!==void 0&&t.skipLike.test(r))return e;if(r==="0"||t.unicode&&(r=Ns(r),r==="0"))return 0;if(t.hex&&Wo.test(r))return Zr(r,16);if(t.binary&&Ko.test(r))return Zr(r,2);if(t.octal&&Jo.test(r))return Zr(r,8);if(isFinite(r)){if(r.includes("e")||r.includes("E"))return Xo(e,r,t);{let n=jo.exec(r);if(n){let s=n[1]||"",a=n[2],c=Zo(n[3]),l=s?e[a.length+1]===".":e[a.length]===".";if(!t.leadingZeros&&(a.length>1||a.length===1&&!l))return e;{let o=Number(r),d=String(o);if(o===0)return o;if(d.search(/[eE]/)!==-1)return t.eNotation?o:e;if(r.indexOf(".")!==-1)return d==="0"||d===c||d===`${s}${c}`?o:e;let p=a?c:r;return a?p===d||s+p===d?o:e:p===d||p===s+d?o:e}}else return e}}else return zo(e,Number(r),t)}var $o=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function Xo(e,t,r){if(!r.eNotation)return e;let n=t.match($o);if(n){let s=n[1]||"",a=n[3].indexOf("e")===-1?"E":"e",c=n[2],l=s?e[c.length+1]===a:e[c.length]===a;return c.length>1&&l?e:c.length===1&&(n[3].startsWith(`.${a}`)||n[3][0]===a)?Number(t):c.length>0?r.leadingZeros&&!l?(t=(n[1]||"")+n[3],Number(t)):e:Number(t)}else return e}function Zo(e){return e&&e.indexOf(".")!==-1&&(e=e.replace(/0+$/,""),e==="."?e="0":e[0]==="."?e="0"+e:e[e.length-1]==="."&&(e=e.substring(0,e.length-1))),e}function Zr(e,t){let r=e.trim();if((t===2||t===8)&&(e=r.substring(2)),parseInt)return parseInt(e,t);if(Number.parseInt)return Number.parseInt(e,t);if(window&&window.parseInt)return window.parseInt(e,t);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function zo(e,t,r){let n=t===1/0;switch(r.infinity.toLowerCase()){case"null":return null;case"infinity":return t;case"string":return n?"Infinity":"-Infinity";case"original":default:return e}}function qr(e){return typeof e=="function"?e:Array.isArray(e)?t=>{for(let r of e)if(typeof r=="string"&&t===r||r instanceof RegExp&&r.test(t))return!0}:()=>!1}var Be=class{constructor(t,r={},n){this.pattern=t,this.separator=r.separator||".",this.segments=this._parse(t),this.data=n,this._hasDeepWildcard=this.segments.some(s=>s.type==="deep-wildcard"),this._hasAttributeCondition=this.segments.some(s=>s.attrName!==void 0),this._hasPositionSelector=this.segments.some(s=>s.position!==void 0)}_parse(t){let r=[],n=0,s="";for(;n<t.length;)t[n]===this.separator?n+1<t.length&&t[n+1]===this.separator?(s.trim()&&(r.push(this._parseSegment(s.trim())),s=""),r.push({type:"deep-wildcard"}),n+=2):(s.trim()&&r.push(this._parseSegment(s.trim())),s="",n++):(s+=t[n],n++);return s.trim()&&r.push(this._parseSegment(s.trim())),r}_parseSegment(t){let r={type:"tag"},n=null,s=t,a=t.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(a&&(s=a[1]+a[3],a[2])){let p=a[2].slice(1,-1);p&&(n=p)}let c,l=s;if(s.includes("::")){let p=s.indexOf("::");if(c=s.substring(0,p).trim(),l=s.substring(p+2).trim(),!c)throw new Error(`Invalid namespace in pattern: ${t}`)}let o,d=null;if(l.includes(":")){let p=l.lastIndexOf(":"),h=l.substring(0,p).trim(),f=l.substring(p+1).trim();["first","last","odd","even"].includes(f)||/^nth\(\d+\)$/.test(f)?(o=h,d=f):o=l}else o=l;if(!o)throw new Error(`Invalid segment pattern: ${t}`);if(r.tag=o,c&&(r.namespace=c),n)if(n.includes("=")){let p=n.indexOf("=");r.attrName=n.substring(0,p).trim(),r.attrValue=n.substring(p+1).trim()}else r.attrName=n.trim();if(d){let p=d.match(/^nth\((\d+)\)$/);p?(r.position="nth",r.positionValue=parseInt(p[1],10)):r.position=d}return r}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}};var je=class{constructor(){this._byDepthAndTag=new Map,this._wildcardByDepth=new Map,this._deepWildcards=[],this._deepByTerminalTag=new Map,this._patterns=new Set,this._sealed=!1}add(t){if(this._sealed)throw new TypeError("ExpressionSet is sealed. Create a new ExpressionSet to add more expressions.");if(this._patterns.has(t.pattern))return this;if(this._patterns.add(t.pattern),t.hasDeepWildcard()){let a=t.segments[t.segments.length-1];if(a&&a.type!=="deep-wildcard"&&a.tag!=="*"){let c=a.tag;this._deepByTerminalTag.has(c)||this._deepByTerminalTag.set(c,[]),this._deepByTerminalTag.get(c).push(t)}else this._deepWildcards.push(t);return this}let r=t.length,s=t.segments[t.segments.length-1]?.tag;if(!s||s==="*")this._wildcardByDepth.has(r)||this._wildcardByDepth.set(r,[]),this._wildcardByDepth.get(r).push(t);else{let a=`${r}:${s}`;this._byDepthAndTag.has(a)||this._byDepthAndTag.set(a,[]),this._byDepthAndTag.get(a).push(t)}return this}addAll(t){for(let r of t)this.add(r);return this}has(t){return this._patterns.has(t.pattern)}get size(){return this._patterns.size}seal(){return this._sealed=!0,this}get isSealed(){return this._sealed}matchesAny(t){return this.findMatch(t)!==null}findMatch(t){let r=t.getDepth(),n=t.getCurrentTag(),s=`${r}:${n}`,a=this._byDepthAndTag.get(s);if(a){for(let o=0;o<a.length;o++)if(t.matches(a[o]))return a[o]}let c=this._wildcardByDepth.get(r);if(c){for(let o=0;o<c.length;o++)if(t.matches(c[o]))return c[o]}let l=this._deepByTerminalTag.get(n);if(l){for(let o=0;o<l.length;o++)if(t.matches(l[o]))return l[o]}for(let o=0;o<this._deepWildcards.length;o++)if(t.matches(this._deepWildcards[o]))return this._deepWildcards[o];return null}};var en=class{constructor(t){this._matcher=t}get separator(){return this._matcher.separator}getCurrentTag(){let t=this._matcher.path;return t.length>0?t[t.length-1].tag:void 0}getCurrentNamespace(){let t=this._matcher.path;return t.length>0?t[t.length-1].namespace:void 0}getAttrValue(t){let r=this._matcher.path;if(r.length!==0)return r[r.length-1].values?.[t]}hasAttr(t){let r=this._matcher.path;if(r.length===0)return!1;let n=r[r.length-1];return n.values!==void 0&&t in n.values}getAnyParentAttr(t){return this._matcher.getAnyParentAttr(t)}hasAnyParentAttr(t){return this._matcher.hasAnyParentAttr(t)}getPosition(){let t=this._matcher.path;return t.length===0?-1:t[t.length-1].position??0}getCounter(){let t=this._matcher.path;return t.length===0?-1:t[t.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this._matcher.path.length}toString(t,r=!0){return this._matcher.toString(t,r)}toArray(){return this._matcher.path.map(t=>t.tag)}matches(t){return this._matcher.matches(t)}matchesAny(t){return t.matchesAny(this._matcher)}},Ve=class{constructor(t={}){this.separator=t.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new en(this),this._keptAttrs=[]}push(t,r=null,n=null,s=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);let a=this.path.length,c=this.siblingStacks[a];c||(c={counts:new Map,total:0},this.siblingStacks[a]=c);let l=n?`${n}:${t}`:t,o=c.counts.get(l)||0,d=c.total;c.counts.set(l,o+1),c.total++;let p={tag:t,position:d,counter:o};n!=null&&(p.namespace=n),r!=null&&(p.values=r),this.path.push(p);let h=this.path.length,f=s!==null?s.keep:null;if(f!=null&&f.length>0&&r)for(let m=0;m<f.length;m++){let y=f[m];r[y]!==void 0&&this._keptAttrs.push({depth:h,name:y,value:r[y]})}}pop(){if(this.path.length===0)return;this._pathStringCache=null;let t=this.path.pop();this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1);let r=this.path.length+1;for(;this._keptAttrs.length>0&&this._keptAttrs[this._keptAttrs.length-1].depth>=r;)this._keptAttrs.pop();return t}updateCurrent(t){if(this.path.length>0){let r=this.path[this.path.length-1];t!=null&&(r.values=t)}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(t){if(this.path.length!==0)return this.path[this.path.length-1].values?.[t]}hasAttr(t){if(this.path.length===0)return!1;let r=this.path[this.path.length-1];return r.values!==void 0&&t in r.values}getAnyParentAttr(t){let r=this._keptAttrs;for(let n=r.length-1;n>=0;n--)if(r[n].name===t)return r[n].value}hasAnyParentAttr(t){let r=this._keptAttrs;for(let n=r.length-1;n>=0;n--)if(r[n].name===t)return!0;return!1}getPosition(){return this.path.length===0?-1:this.path[this.path.length-1].position??0}getCounter(){return this.path.length===0?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(t,r=!0){let n=t||this.separator;if(n===this.separator&&r===!0){if(this._pathStringCache!==null)return this._pathStringCache;let a=this.path.map(c=>c.namespace?`${c.namespace}:${c.tag}`:c.tag).join(n);return this._pathStringCache=a,a}return this.path.map(a=>r&&a.namespace?`${a.namespace}:${a.tag}`:a.tag).join(n)}toArray(){return this.path.map(t=>t.tag)}reset(){this._pathStringCache=null,this.path=[],this.siblingStacks=[],this._keptAttrs=[]}matches(t){let r=t.segments;return r.length===0?!1:t.hasDeepWildcard()?this._matchWithDeepWildcard(r):this._matchSimple(r)}_matchSimple(t){if(this.path.length!==t.length)return!1;for(let r=0;r<t.length;r++)if(!this._matchSegment(t[r],this.path[r],r===this.path.length-1))return!1;return!0}_matchWithDeepWildcard(t){let r=this.path.length-1,n=t.length-1;for(;n>=0&&r>=0;){let s=t[n];if(s.type==="deep-wildcard"){if(n--,n<0)return!0;let a=t[n],c=!1;for(let l=r;l>=0;l--)if(this._matchSegment(a,this.path[l],l===this.path.length-1)){r=l-1,n--,c=!0;break}if(!c)return!1}else{if(!this._matchSegment(s,this.path[r],r===this.path.length-1))return!1;r--,n--}}return n<0}_matchSegment(t,r,n){if(t.tag!=="*"&&t.tag!==r.tag||t.namespace!==void 0&&t.namespace!=="*"&&t.namespace!==r.namespace||t.attrName!==void 0&&(!n||!r.values||!(t.attrName in r.values)||t.attrValue!==void 0&&String(r.values[t.attrName])!==String(t.attrValue)))return!1;if(t.position!==void 0){if(!n)return!1;let s=r.counter??0;if(t.position==="first"&&s!==0)return!1;if(t.position==="odd"&&s%2!==1)return!1;if(t.position==="even"&&s%2!==0)return!1;if(t.position==="nth"&&s!==t.positionValue)return!1}return!0}matchesAny(t){return t.matchesAny(this)}snapshot(){return{path:this.path.map(t=>({...t})),siblingStacks:this.siblingStacks.map(t=>t&&{counts:new Map(t.counts),total:t.total}),keptAttrs:this._keptAttrs.map(t=>({...t}))}}restore(t){this._pathStringCache=null,this.path=t.path.map(r=>({...r})),this.siblingStacks=t.siblingStacks.map(r=>r&&{counts:new Map(r.counts),total:r.total}),this._keptAttrs=(t.keptAttrs||[]).map(r=>({...r}))}readOnly(){return this._view}};var qo=[{id:"html-script-open",description:"<script opening tag",pattern:/<script[\s>/]/i},{id:"html-script-close",description:"</script closing tag",pattern:/<\/script[\s>]/i},{id:"html-javascript-protocol",description:"javascript: URI scheme (with optional whitespace/encoding)",pattern:/j[\t\n\r ]*a[\t\n\r ]*v[\t\n\r ]*a[\t\n\r ]*s[\t\n\r ]*c[\t\n\r ]*r[\t\n\r ]*i[\t\n\r ]*p[\t\n\r ]*t[\t\n\r ]*:/i},{id:"html-vbscript-protocol",description:"vbscript: URI scheme",pattern:/vbscript[\t\n\r ]*:/i},{id:"html-data-html",description:"data:text/html URI \u2014 can execute scripts in browsers",pattern:/data[\t\n\r ]*:[\t\n\r ]*text\/html/i},{id:"html-data-xhtml",description:"data:application/xhtml+xml URI",pattern:/data[\t\n\r ]*:[\t\n\r ]*application\/xhtml/i},{id:"html-data-svg",description:"data:image/svg+xml URI \u2014 can execute scripts",pattern:/data[\t\n\r ]*:[\t\n\r ]*image\/svg\+xml/i},{id:"html-inline-event-handler",description:"Inline event handler attributes: onclick=, onerror=, onload=, etc.",pattern:/\bon\w{1,30}\s*=/i},{id:"html-entity-obfuscated-script",description:"HTML-entity-encoded <script (e.g. &#x3C;script or &lt;script)",pattern:/(?:&#x0*3[Cc];?|&#0*60;?|&lt;)\s*script/i},{id:"html-entity-obfuscated-javascript",description:'HTML-entity-encoded javascript: (partial \u2014 catches common &#106; or &#x6a; for "j")',pattern:/(?:&#x0*6[Aa];?|&#0*106;?)\s*(?:&#x0*61;?|a)[\s\S]{0,80}script\s*:/i},{id:"html-style-expression",description:"CSS expression() \u2014 IE-era code execution in style attributes",pattern:/style[\s\S]{0,20}expression\s*\(/i},{id:"html-object-embed",description:"<object or <embed tags that can load active content",pattern:/<(?:object|embed)[\s>/]/i},{id:"html-base-tag",description:"<base href= \u2014 can hijack all relative URLs on a page",pattern:/<base[\s>]/i},{id:"html-meta-refresh",description:'<meta http-equiv="refresh" \u2014 can redirect users',pattern:/<meta[\s\S]{0,40}http-equiv[\s\S]{0,20}refresh/i},{id:"html-srcdoc",description:"srcdoc= attribute on iframes \u2014 embeds HTML that can run scripts",pattern:/srcdoc\s*=/i},{id:"html-iframe",description:"<iframe tag",pattern:/<iframe[\s>/]/i},{id:"html-form",description:"<form tag \u2014 can be used for phishing / credential harvesting injection",pattern:/<form[\s>/]/i}],$e=qo;var ec=[{id:"xml-cdata-injection",description:"CDATA section injection: <![CDATA[ breaks out of text node context",pattern:/<!\[CDATA\[/i},{id:"xml-cdata-close",description:"CDATA close sequence: ]]> can terminate an enclosing CDATA section",pattern:/\]\]>/},{id:"xml-processing-instruction",description:"XML processing instruction: <?xml-stylesheet or <?php etc.",pattern:/<\?(?:xml[\- ]|php|asp)/i},{id:"xml-doctype-injection",description:"DOCTYPE declaration embedded in content \u2014 can define entities",pattern:/<!DOCTYPE(?:[\s[]|$)/i},{id:"xml-entity-system",description:"SYSTEM keyword \u2014 used in external entity declarations (XXE)",pattern:/\bSYSTEM\s+["']/i},{id:"xml-entity-public",description:"PUBLIC keyword \u2014 used in external entity declarations (XXE)",pattern:/\bPUBLIC\s+["']/i},{id:"xml-entity-declaration",description:"<!ENTITY declaration \u2014 defines entities, potential XXE or entity expansion",pattern:/<!ENTITY[\s%]/i},{id:"xml-billion-laughs",description:"Entity reference chaining / billion laughs: repeated &eX; style references",pattern:/(?:&\w{1,20};){3,}/},{id:"xml-namespace-confusion",description:"xmlns: attribute injection \u2014 can redefine namespaces to confuse parsers",pattern:/\bxmlns\s*(?::\w{1,40})?\s*=/i},{id:"xml-comment-injection",description:"<!-- comment injection \u2014 can hide content from some parsers",pattern:/<!--/},{id:"xml-comment-close",description:"--> closes an enclosing XML comment",pattern:/-->/},{id:"xml-pi-close",description:"?> closes an enclosing processing instruction",pattern:/\?>/}],Xe=ec;var tc=[{id:"svg-script-element",description:"<script element inside SVG executes JavaScript",pattern:/<script[\s>/]/i},{id:"svg-xlink-href-javascript",description:"xlink:href with javascript: \u2014 classic SVG XSS via <a> or <use>",pattern:/xlink\s*:\s*href\s*=\s*["']?\s*javascript\s*:/i},{id:"svg-href-javascript",description:"href= with javascript: in SVG context (<a>, <animate>, etc.)",pattern:/href\s*=\s*["']?\s*javascript\s*:/i},{id:"svg-foreignobject",description:"<foreignObject embeds HTML inside SVG \u2014 can execute scripts",pattern:/<foreignObject[\s>/]/i},{id:"svg-use-external",description:"<use xlink:href or href pointing to external resource (non-fragment URL)",pattern:/<use[\s\S]{0,60}(?:xlink\s*:\s*)?href\s*=\s*(?:["'][^#]|[^"'#\s>])/i},{id:"svg-animate-href",description:'<animate attributeName="href" \u2014 can dynamically change href to javascript:',pattern:/<animate[\s\S]{0,80}attributeName\s*=\s*["'][\s]*href["']/i},{id:"svg-animate-xlinkhref",description:'<animate attributeName="xlink:href"',pattern:/<animate[\s\S]{0,80}attributeName\s*=\s*["'][\s]*xlink\s*:\s*href["']/i},{id:"svg-set-javascript",description:'<set to="javascript:..." \u2014 sets an attribute to a javascript: URI',pattern:/<set[\s\S]{0,80}to\s*=\s*["']?\s*javascript\s*:/i},{id:"svg-event-handler",description:"SVG-specific event handler attributes: onload=, onerror=, onactivate=, etc.",pattern:/\bon(?:load|error|activate|begin|end|repeat|focus|blur|click|mouse\w{1,20}|key\w{1,20})\s*=/i},{id:"svg-handler-generic",description:"Generic on* handler catch-all for SVG attributes",pattern:/\bon\w{1,30}\s*=/i},{id:"svg-filter-feimage",description:"<feImage href= \u2014 filter primitive that can load external resources",pattern:/<feImage[\s\S]{0,80}(?:xlink\s*:\s*)?href\s*=/i},{id:"svg-image-external",description:"<image xlink:href with http/https or javascript protocol",pattern:/<image[\s\S]{0,80}(?:xlink\s*:\s*)?href\s*=\s*["']?\s*(?:https?|javascript)\s*:/i},{id:"svg-style-javascript",description:"style= attribute containing javascript: (e.g. background:url(javascript:...))",pattern:/style\s*=[\s\S]{0,60}javascript\s*:/i}],tn=tc;var rc=[{id:"sql-block-comment-open",description:"SQL block comment open: /* ... */ \u2014 unusual in legitimate user text",pattern:/\/\*/},{id:"sql-union-select",description:"UNION SELECT \u2014 most common SQL injection aggregation attack",pattern:/\bUNION\s{1,20}(?:ALL\s{1,20})?SELECT\b/i},{id:"sql-drop-table",description:"DROP TABLE \u2014 destructive DDL injection",pattern:/\bDROP\s{1,20}TABLE\b/i},{id:"sql-drop-database",description:"DROP DATABASE \u2014 destructive DDL injection",pattern:/\bDROP\s{1,20}DATABASE\b/i},{id:"sql-insert-into",description:"INSERT INTO \u2014 data injection",pattern:/\bINSERT\s{1,20}INTO\b/i},{id:"sql-delete-from",description:"DELETE FROM \u2014 data deletion injection",pattern:/\bDELETE\s{1,20}FROM\b/i},{id:"sql-update-set",description:"UPDATE ... SET \u2014 data modification injection",pattern:/\bUPDATE\b[\s\S]{1,60}\bSET\b/i},{id:"sql-exec-xp",description:"EXEC xp_ \u2014 MSSQL extended stored procedure execution",pattern:/\bEXEC(?:UTE)?\s{1,20}xp_/i},{id:"sql-tautology-string",description:`Classic string tautology: ' OR '1'='1 or " OR "1"="1"`,pattern:/'\s{0,10}OR\s{0,10}'[^']{0,20}'\s*=\s*'[^']{0,20}/i},{id:"sql-tautology-numeric",description:"Numeric tautology: OR 1=1",pattern:/\bOR\s{1,10}1\s*=\s*1\b/i},{id:"sql-always-true-zero",description:"Numeric tautology: OR 0=0",pattern:/\bOR\s{1,10}0\s*=\s*0\b/i},{id:"sql-sleep-benchmark",description:"Time-based blind injection: SLEEP() or BENCHMARK()",pattern:/\b(?:SLEEP|BENCHMARK)\s*\(/i},{id:"sql-waitfor-delay",description:"MSSQL time-based blind injection: WAITFOR DELAY",pattern:/\bWAITFOR\s{1,20}DELAY\b/i},{id:"sql-char-function",description:"CHAR() function \u2014 used to obfuscate injected strings",pattern:/\bCHAR\s*\(\s*\d{1,3}/i},{id:"sql-information-schema",description:"INFORMATION_SCHEMA \u2014 reconnaissance query for table/column enumeration",pattern:/\bINFORMATION_SCHEMA\b/i}],ft=rc;var nc=[{id:"shell-path-traversal-unix",description:"Unix path traversal: ../ \u2014 climbing the directory tree",pattern:/\.\.\//},{id:"shell-path-traversal-windows",description:"Windows path traversal: ..\\ \u2014 climbing the directory tree",pattern:/\.\.\\/},{id:"shell-path-traversal-encoded",description:"URL-encoded path traversal: %2e%2e or %2f variants",pattern:/%2e%2e|%2f\.\.|\.\.%2f/i},{id:"shell-null-byte",description:"Null byte injection: \\x00 or %00 \u2014 truncates strings in C-backed functions",pattern:/\x00|%00/},{id:"shell-semicolon",description:"Semicolon command separator: cmd1; cmd2",pattern:/;/},{id:"shell-pipe",description:"Pipe operator: cmd1 | cmd2",pattern:/\|/},{id:"shell-and-operator",description:"AND operator: cmd1 && cmd2",pattern:/&&/},{id:"shell-or-operator",description:"OR operator: cmd1 || cmd2",pattern:/\|\|/},{id:"shell-backtick",description:"Backtick command substitution: `cmd`",pattern:/`/},{id:"shell-dollar-paren",description:"Dollar-paren command substitution: $(cmd)",pattern:/\$\(/},{id:"shell-dollar-brace",description:"Dollar-brace variable expansion: ${var} \u2014 can be abused for injection",pattern:/\$\{/},{id:"shell-redirect-out",description:"Output redirection: cmd > file or cmd >> file",pattern:/>{1,2}/},{id:"shell-redirect-in",description:"Input redirection: cmd < file",pattern:/</},{id:"shell-newline-injection",description:"Newline injection: \\n or \\r \u2014 can inject new shell commands",pattern:/[\n\r]/},{id:"shell-glob-star",description:"Glob expansion: * or ? \u2014 can expand to unintended files",pattern:/[/\\][*?]/},{id:"shell-absolute-root",description:"Absolute root path injection: string starting with / or \\ (Windows UNC)",pattern:/^(?:\/|\\\\)/},{id:"shell-windows-drive",description:"Windows drive letter path injection: C:\\ or D:/",pattern:/^[a-zA-Z]:[/\\]/},{id:"shell-curl-wget",description:"curl/wget with URL or flags \u2014 can exfiltrate data or download payloads",pattern:/\b(?:curl|wget)\s+(?:https?:\/\/|ftp:\/\/|-)/i}],rn=nc;var sc=[{id:"redos-nested-quantifier-plus",description:"Nested + quantifier inside a group with outer quantifier: (a+)+, (.+b)*, etc.",pattern:/\([^)]*\+[^)]*\)[+*]/},{id:"redos-nested-quantifier-star",description:"Nested * quantifier: (a*)* or (a*)+ \u2014 catastrophic backtracking",pattern:/\([^)]*\*[^)]*\)[*+]/},{id:"redos-nested-groups",description:"Doubly nested quantified groups: ((a+)+) \u2014 guaranteed catastrophic",pattern:/\(\([^)]{0,40}\)[+*]\)[+*]/},{id:"redos-alternation-overlap",description:"Overlapping alternation under quantifier: (a|a)+ \u2014 ambiguous NFA paths",pattern:/\(([^|()]{1,20})\|(?:\1)(?:\|[^|()]{1,20}){0,5}\)[+*?]{1,2}/},{id:"redos-star-plus-concat",description:"(x*x)+ pattern \u2014 triggers super-linear backtracking",pattern:/\([^)]{0,10}\*[^)]{0,10}\)[+*]/},{id:"redos-dot-star-greedy",description:"(.*){n,} or (.+){n,} \u2014 repeated greedy dot quantifiers",pattern:/\(\.[*+]\)\{?\d/},{id:"redos-large-repetition",description:"Very large fixed or range repetition count {1000,} or {1000,n} \u2014 denial of service via backtracking",pattern:/\{\d{4,}(?:,\d*)?\}/},{id:"redos-catastrophic-alternation",description:"Long alternation with many similar branches \u2014 polynomial backtracking risk",pattern:/\([^)]{0,200}(?:\|[^|)]{0,50}){9,}\)/}],nn=sc;var ae=`["'\\s]*:`,ic=[{id:"nosql-where-operator",description:"$where \u2014 executes arbitrary JavaScript server-side in MongoDB",pattern:new RegExp(`\\$where${ae}`,"i")},{id:"nosql-ne-operator",description:'$ne \u2014 "not equal" operator used to bypass equality checks',pattern:new RegExp(`\\$ne${ae}`,"i")},{id:"nosql-gt-operator",description:'$gt \u2014 "greater than" used to bypass password/value checks',pattern:new RegExp(`\\$gte?${ae}`,"i")},{id:"nosql-lt-operator",description:'$lt / $lte \u2014 "less than" bypass variants',pattern:new RegExp(`\\$lte?${ae}`,"i")},{id:"nosql-regex-operator",description:"$regex \u2014 can be used to extract data character by character (blind injection)",pattern:new RegExp(`\\$regex${ae}`,"i")},{id:"nosql-or-operator",description:"$or \u2014 logical OR; used to create always-true conditions",pattern:new RegExp(`\\$or${ae}\\s*\\[`,"i")},{id:"nosql-and-operator",description:"$and \u2014 logical AND operator injection",pattern:new RegExp(`\\$and${ae}\\s*\\[`,"i")},{id:"nosql-nor-operator",description:"$nor \u2014 logical NOR operator injection",pattern:new RegExp(`\\$nor${ae}\\s*\\[`,"i")},{id:"nosql-exists-operator",description:"$exists \u2014 can enumerate fields to determine schema",pattern:new RegExp(`\\$exists${ae}`,"i")},{id:"nosql-in-operator",description:"$in \u2014 matches any value in a list; can enumerate values",pattern:new RegExp(`\\$in${ae}\\s*\\[`,"i")},{id:"nosql-expr-operator",description:"$expr \u2014 allows aggregation expressions in queries (MongoDB 3.6+)",pattern:new RegExp(`\\$expr${ae}`,"i")},{id:"nosql-function-operator",description:"$function \u2014 executes arbitrary JavaScript in MongoDB 4.4+",pattern:new RegExp(`\\$function${ae}`,"i")},{id:"nosql-accumulator-operator",description:"$accumulator \u2014 custom aggregation with arbitrary JS execution",pattern:new RegExp(`\\$accumulator${ae}`,"i")},{id:"nosql-proto-pollution",description:"__proto__ \u2014 prototype pollution via object key injection",pattern:/__proto__/},{id:"nosql-constructor-prototype",description:"constructor.prototype \u2014 alternative prototype pollution vector (dot notation or JSON key)",pattern:/constructor[\s"':.,{\[]*prototype/i},{id:"nosql-proto-bracket",description:'["__proto__"] \u2014 bracket-notation prototype pollution',pattern:/\[["']__proto__["']\]/}],sn=ic;var ac=[{id:"log-crlf-injection",description:"CRLF injection: literal \\r or \\n embeds fake log lines",pattern:/[\r\n]/},{id:"log-url-encoded-crlf",description:"URL-encoded CRLF: %0d, %0a, %0D, %0A \u2014 decoded by some log parsers",pattern:/%0[dDaA]/},{id:"log-unicode-newline",description:"Unicode newline variants: U+2028 (line separator), U+2029 (paragraph separator)",pattern:/[\u2028\u2029]/},{id:"log-log4shell-jndi",description:"Log4Shell: ${jndi:...} triggers remote code execution in Apache Log4j",pattern:/\$\{jndi\s*:/i},{id:"log-log4shell-obfuscated",description:"Obfuscated Log4Shell: ${::-j}... lookup-bypass prefix used to evade WAF detection",pattern:/\$\{::-/},{id:"log-log4j-lookup",description:"Log4j lookup syntax: ${env:...}, ${sys:...}, ${ctx:...} \u2014 data exfiltration",pattern:/\$\{(?:env|sys|ctx|main|map|sd|web|docker|k8s|spring)\s*:/i},{id:"log-ssti-double-brace",description:"SSTI double-brace: {{expression}} \u2014 Jinja2, Twig, Handlebars, etc.",pattern:/\{\{[\s\S]{0,80}\}\}/},{id:"log-ssti-hash-brace",description:"SSTI hash-brace: #{expression} \u2014 Thymeleaf, Velocity, Ruby ERB",pattern:/#\{[\s\S]{0,80}\}/},{id:"log-ssti-dollar-brace",description:"SSTI/EL injection: ${expression with operators or method calls} \u2014 JSP EL, Freemarker, SpEL",pattern:/\$\{[^}]*(?:\.|\(|\*|\+|\bclass\b|\bruntime\b|\bprocess\b|\bexec\b)[^}]{0,80}\}/i},{id:"log-ssti-percent-tag",description:"SSTI ERB/ASP tag: <%= expression %> \u2014 Ruby ERB, ASP",pattern:/<%=[\s\S]{0,80}%>/},{id:"log-null-byte",description:"Null byte: \\x00 or %00 \u2014 can truncate log entries in C-backed loggers",pattern:/\x00|%00/},{id:"log-ansi-escape",description:"ANSI escape sequence: ESC[ \u2014 can manipulate terminal output when logs are tailed",pattern:/\x1b\[/}],an=ac;var oc=[{id:"sql-line-comment",description:"SQL line comment: -- followed by whitespace or end of string",pattern:/--(?:\s|$)/},{id:"sql-stacked-query",description:"Stacked queries: semicolon immediately followed by a SQL keyword",pattern:/;\s{0,10}(?:SELECT|INSERT|UPDATE|DELETE|DROP|CREATE|ALTER|EXEC)\b/i},{id:"sql-hex-encoding",description:"Hex-encoded string injection: 0x41414141 style (MySQL)",pattern:/\b0x[0-9a-f]{4,}/i}],cc=[...ft,...oc],on=cc;$e.label="HTML";Xe.label="XML";tn.label="SVG";ft.label="SQL";on.label="SQL-STRICT";rn.label="SHELL";nn.label="REDOS";sn.label="NOSQL";an.label="LOG";var Ch=Object.freeze({HTML:$e,XML:Xe,SVG:tn,SQL:ft,"SQL-STRICT":on,SHELL:rn,REDOS:nn,NOSQL:sn,LOG:an});function lc(e){if(typeof e!="string")throw new TypeError(`is-unsafe: first argument must be a string, got ${typeof e}`)}function dc(e){if(!(e instanceof RegExp)){if(Array.isArray(e)){if(e.length===0)throw new TypeError("is-unsafe: context must not be an empty array");if(Array.isArray(e[0])){for(let t of e)if(!Array.isArray(t)||t.length===0)throw new TypeError("is-unsafe: each context in the array must be a non-empty pattern array (PatternList)")}return}throw new TypeError(`is-unsafe: second argument must be a PatternList (e.g. HTML), an array of PatternLists (e.g. [HTML, XML]), or a RegExp. Got: ${typeof e}`)}}function uc(e){return e instanceof RegExp?{lists:null,regex:e}:Array.isArray(e[0])?{lists:e,regex:null}:{lists:[e],regex:null}}function Ac(e,t){let r=t.label??"CUSTOM";for(let n of t)if(n.pattern.test(e))return{context:r,id:n.id,description:n.description,pattern:n.pattern};return null}function _s(e,t){lc(e),dc(t);let{lists:r,regex:n}=uc(t);if(n)return n.test(e);for(let s of r)if(Ac(e,s)!==null)return!0;return!1}function pc(e,t){if(!e)return{};let r=t.attributesGroupName?e[t.attributesGroupName]:e;if(!r)return{};let n={};for(let s in r)if(s.startsWith(t.attributeNamePrefix)){let a=s.substring(t.attributeNamePrefix.length);n[a]=r[s]}else n[s]=r[s];return n}function hc(e){if(!e||typeof e!="string")return;let t=e.indexOf(":");if(t!==-1&&t>0){let r=e.substring(0,t);if(r!=="xmlns")return r}}var Et=class{constructor(t,r){this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.parseXml=Tc,this.parseTextData=gc,this.resolveNameSpace=mc,this.buildAttributesMap=Ec,this.isItStopNode=yc,this.replaceEntitiesValue=Cc,this.readStopNodeData=Sc,this.saveTextToParentTag=Ic,this.addChild=bc,this.ignoreAttributesFn=qr(this.options.ignoreAttributes),this.entityExpansionCount=0,this.currentExpandedLength=0,this.doctypefound=!1;let n={...pt};this.options.entityDecoder?this.entityDecoder=this.options.entityDecoder:(typeof this.options.htmlEntities=="object"?n=this.options.htmlEntities:this.options.htmlEntities===!0&&(n={...jr,...Jr}),this.entityDecoder=new Ke({namedEntities:{...n,...r},numericAllowed:this.options.htmlEntities,limit:{maxTotalExpansions:this.options.processEntities.maxTotalExpansions,maxExpandedLength:this.options.processEntities.maxExpandedLength,applyLimitsTo:this.options.processEntities.appliesTo},onInputEntity:(a,c)=>_s(c,[$e,Xe])?We.BLOCK:We.ALLOW})),this.matcher=new Ve,this.readonlyMatcher=this.matcher.readOnly(),this.isCurrentNodeStopNode=!1,this.stopNodeExpressionsSet=new je;let s=this.options.stopNodes;if(s&&s.length>0){for(let a=0;a<s.length;a++){let c=s[a];typeof c=="string"?this.stopNodeExpressionsSet.add(new Be(c)):c instanceof Be&&this.stopNodeExpressionsSet.add(c)}this.stopNodeExpressionsSet.seal()}}};function gc(e,t,r,n,s,a,c){let l=this.options;if(e!==void 0&&(l.trimValues&&!n&&(e=e.trim()),e.length>0)){c||(e=this.replaceEntitiesValue(e,t,r));let o=l.jPath?r.toString():r,d=l.tagValueProcessor(t,e,o,s,a);return d==null?e:typeof d!=typeof e||d!==e?d:l.trimValues||e.trim()===e?dn(e,l.parseTagValue,l.numberParseOptions):e}}function mc(e){if(this.options.removeNSPrefix){let t=e.split(":"),r=e.charAt(0)==="/"?"/":"";if(t[0]==="xmlns")return"";t.length===2&&(e=r+t[1])}return e}var fc=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Ec(e,t,r,n=!1){let s=this.options;if(n===!0||s.ignoreAttributes!==!0&&typeof e=="string"){let a=Jt(e,fc),c=a.length,l={},o=new Array(c),d=!1,p={};for(let m=0;m<c;m++){let y=this.resolveNameSpace(a[m][1]),w=a[m][4];if(y.length&&w!==void 0){let I=w;s.trimValues&&(I=I.trim()),I=this.replaceEntitiesValue(I,r,this.readonlyMatcher),o[m]=I,p[y]=I,d=!0}}d&&typeof t=="object"&&t.updateCurrent&&t.updateCurrent(p);let h=s.jPath?t.toString():this.readonlyMatcher,f=!1;for(let m=0;m<c;m++){let y=this.resolveNameSpace(a[m][1]);if(this.ignoreAttributesFn(y,h))continue;let w=s.attributeNamePrefix+y;if(y.length)if(s.transformAttributeName&&(w=s.transformAttributeName(w)),w=Rs(w,s),a[m][4]!==void 0){let I=o[m],_=s.attributeValueProcessor(y,I,h);_==null?l[w]=I:typeof _!=typeof I||_!==I?l[w]=_:l[w]=dn(I,s.parseAttributeValue,s.numberParseOptions),f=!0}else s.allowBooleanAttributes&&(l[w]=!0,f=!0)}if(!f)return;if(s.attributesGroupName&&!s.preserveOrder){let m={};return m[s.attributesGroupName]=l,m}return l}}var Tc=function(e){e=e.replace(/\r\n?/g,`
7
- `);let t=new re("!xml"),r=t,n="";this.matcher.reset(),this.entityDecoder.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0,this.doctypefound=!1;let s=this.options,a=new mt(s.processEntities),c=e.length;for(let l=0;l<c;l++)if(e[l]==="<"){let d=e.charCodeAt(l+1);if(d===47){let p=Ze(e,">",l,"Closing Tag is not closed."),h=e.substring(l+2,p).trim();if(s.removeNSPrefix){let m=h.indexOf(":");m!==-1&&(h=h.substr(m+1))}h=cn(s.transformTagName,h,"",s).tagName,r&&(n=this.saveTextToParentTag(n,r,this.readonlyMatcher));let f=this.matcher.getCurrentTag();if(h&&s.unpairedTagsSet.has(h))throw new Error(`Unpaired tag can not be used as closing tag: </${h}>`);f&&s.unpairedTagsSet.has(f)&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=!1,r=this.tagsNodeStack.pop(),n="",l=p}else if(d===63){let p=ln(e,l,!1,"?>");if(!p)throw new Error("Pi Tag is not closed.");n=this.saveTextToParentTag(n,r,this.readonlyMatcher);let h=this.buildAttributesMap(p.tagExp,this.matcher,p.tagName,!0);if(h){let f=h[this.options.attributeNamePrefix+"version"];this.entityDecoder.setXmlVersion(Number(f)||1),a.setXmlVersion(Number(f)||1)}if(!(s.ignoreDeclaration&&p.tagName==="?xml"||s.ignorePiTags)){let f=new re(p.tagName);f.add(s.textNodeName,""),p.tagName!==p.tagExp&&p.attrExpPresent&&s.ignoreAttributes!==!0&&(f[":@"]=h),this.addChild(r,f,this.readonlyMatcher,l)}l=p.closeIndex+1}else if(d===33&&e.charCodeAt(l+2)===45&&e.charCodeAt(l+3)===45){let p=Ze(e,"-->",l+4,"Comment is not closed.");if(s.commentPropName){let h=e.substring(l+4,p-2);n=this.saveTextToParentTag(n,r,this.readonlyMatcher),r.add(s.commentPropName,[{[s.textNodeName]:h}])}l=p}else if(d===33&&e.charCodeAt(l+2)===68){if(this.doctypefound)throw new Error("Multiple DOCTYPE declarations found.");this.doctypefound=!0;let p=a.readDocType(e,l);this.entityDecoder.addInputEntities(p.entities),l=p.i}else if(d===33&&e.charCodeAt(l+2)===91){let p=Ze(e,"]]>",l,"CDATA is not closed.")-2,h=e.substring(l+9,p);n=this.saveTextToParentTag(n,r,this.readonlyMatcher);let f=this.parseTextData(h,r.tagname,this.readonlyMatcher,!0,!1,!0,!0);f==null&&(f=""),s.cdataPropName?r.add(s.cdataPropName,[{[s.textNodeName]:h}]):r.add(s.textNodeName,f),l=p+2}else{let p=ln(e,l,s.removeNSPrefix);if(!p){let P=e.substring(Math.max(0,l-50),Math.min(c,l+50));throw new Error(`readTagExp returned undefined at position ${l}. Context: "${P}"`)}let h=p.tagName,f=p.rawTagName,m=p.tagExp,y=p.attrExpPresent,w=p.closeIndex;if({tagName:h,tagExp:m}=cn(s.transformTagName,h,m,s),s.strictReservedNames&&(h===s.commentPropName||h===s.cdataPropName||h===s.textNodeName||h===s.attributesGroupName))throw new Error(`Invalid tag name: ${h}`);r&&n&&r.tagname!=="!xml"&&(n=this.saveTextToParentTag(n,r,this.readonlyMatcher,!1));let I=r;I&&s.unpairedTagsSet.has(I.tagname)&&(r=this.tagsNodeStack.pop(),this.matcher.pop());let _=!1;m.length>0&&m.lastIndexOf("/")===m.length-1&&(_=!0,h[h.length-1]==="/"?(h=h.substr(0,h.length-1),m=h):m=m.substr(0,m.length-1),y=h!==m);let N=null,L={},B;B=hc(f),h!==t.tagname&&this.matcher.push(h,{},B),h!==m&&y&&(N=this.buildAttributesMap(m,this.matcher,h),N&&(L=pc(N,s))),h!==t.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode());let R=l;if(this.isCurrentNodeStopNode){let P="";if(_)l=p.closeIndex;else if(s.unpairedTagsSet.has(h))l=p.closeIndex;else{let x=this.readStopNodeData(e,f,w+1);if(!x)throw new Error(`Unexpected end of ${f}`);l=x.i,P=x.tagContent}let G=new re(h);N&&(G[":@"]=N),G.add(s.textNodeName,P),this.matcher.pop(),this.isCurrentNodeStopNode=!1,this.addChild(r,G,this.readonlyMatcher,R)}else{if(_){({tagName:h,tagExp:m}=cn(s.transformTagName,h,m,s));let P=new re(h);N&&(P[":@"]=N),this.addChild(r,P,this.readonlyMatcher,R),this.matcher.pop(),this.isCurrentNodeStopNode=!1}else if(s.unpairedTagsSet.has(h)){let P=new re(h);N&&(P[":@"]=N),this.addChild(r,P,this.readonlyMatcher,R),this.matcher.pop(),this.isCurrentNodeStopNode=!1,l=p.closeIndex;continue}else{let P=new re(h);if(this.tagsNodeStack.length>s.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(r),N&&(P[":@"]=N),this.addChild(r,P,this.readonlyMatcher,R),r=P}n="",l=w}}}else n+=e[l];return t.child};function bc(e,t,r,n){this.options.captureMetaData||(n=void 0);let s=this.options.jPath?r.toString():r,a=this.options.updateTag(t.tagname,s,t[":@"]);a===!1||(typeof a=="string"&&(t.tagname=a),e.addChild(t,n))}function Cc(e,t,r){let n=this.options.processEntities;if(!n||!n.enabled)return e;if(n.allowedTags){let s=this.options.jPath?r.toString():r;if(!(Array.isArray(n.allowedTags)?n.allowedTags.includes(t):n.allowedTags(t,s)))return e}if(n.tagFilter){let s=this.options.jPath?r.toString():r;if(!n.tagFilter(t,s))return e}return this.entityDecoder.decode(e)}function Ic(e,t,r,n){return e&&(n===void 0&&(n=t.child.length===0),e=this.parseTextData(e,t.tagname,r,!1,t[":@"]?Object.keys(t[":@"]).length!==0:!1,n),e!==void 0&&e!==""&&t.add(this.options.textNodeName,e),e=""),e}function yc(){return this.stopNodeExpressionsSet.size===0?!1:this.matcher.matchesAny(this.stopNodeExpressionsSet)}function wc(e,t,r=">"){let n=0,s=e.length,a=r.charCodeAt(0),c=r.length>1?r.charCodeAt(1):-1,l="",o=t;for(let d=t;d<s;d++){let p=e.charCodeAt(d);if(n)p===n&&(n=0);else if(p===34||p===39)n=p;else if(p===a)if(c!==-1){if(e.charCodeAt(d+1)===c)return l+=e.substring(o,d),{data:l,index:d}}else return l+=e.substring(o,d),{data:l,index:d};else p===9&&!n&&(l+=e.substring(o,d)+" ",o=d+1)}}function Ze(e,t,r,n){let s=e.indexOf(t,r);if(s===-1)throw new Error(n);return s+t.length-1}function xc(e,t,r,n){let s=e.indexOf(t,r);if(s===-1)throw new Error(n);return s}function ln(e,t,r,n=">"){let s=wc(e,t+1,n);if(!s)return;let a=s.data,c=s.index,l=a.search(/\s/),o=a,d=!0;l!==-1&&(o=a.substring(0,l),a=a.substring(l+1).trimStart());let p=o;if(r){let h=o.indexOf(":");h!==-1&&(o=o.substr(h+1),d=o!==s.data.substr(h+1))}return{tagName:o,tagExp:a,closeIndex:c,attrExpPresent:d,rawTagName:p}}function Sc(e,t,r){let n=r,s=1,a=e.length;for(;r<a;r++)if(e[r]==="<"){let c=e.charCodeAt(r+1);if(c===47){let l=xc(e,">",r,`${t} is not closed`);if(e.substring(r+2,l).trim()===t&&(s--,s===0))return{tagContent:e.substring(n,r),i:l};r=l}else if(c===63)r=Ze(e,"?>",r+1,"StopNode is not closed.");else if(c===33&&e.charCodeAt(r+2)===45&&e.charCodeAt(r+3)===45)r=Ze(e,"-->",r+3,"StopNode is not closed.");else if(c===33&&e.charCodeAt(r+2)===91)r=Ze(e,"]]>",r,"StopNode is not closed.")-2;else{let l=ln(e,r,!1);l&&((l&&l.tagName)===t&&l.tagExp[l.tagExp.length-1]!=="/"&&s++,r=l.closeIndex)}}}function dn(e,t,r){if(t&&typeof e=="string"){let n=e.trim();return n==="true"?!0:n==="false"?!1:zr(e,r)}else return ds(e)?e:""}function cn(e,t,r,n){if(e){let s=e(t);r===t&&(r=s),t=s}return t=Rs(t,n),{tagName:t,tagExp:r}}function Rs(e,t){if(jt.includes(e))throw new Error(`[SECURITY] Invalid name: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`);return ut.includes(e)?t.onDangerousProperty(e):e}var un=re.getMetaDataSymbol();function Nc(e,t){if(!e||typeof e!="object")return{};if(!t)return e;let r={};for(let n in e)if(n.startsWith(t)){let s=n.substring(t.length);r[s]=e[n]}else r[n]=e[n];return r}function An(e,t,r,n){return Ls(e,t,r,n)}function Ls(e,t,r,n){let s,a={};for(let c=0;c<e.length;c++){let l=e[c],o=_c(l);if(o!==void 0&&o!==t.textNodeName){let d=Nc(l[":@"]||{},t.attributeNamePrefix);r.push(o,d)}if(o===t.textNodeName)s===void 0?s=l[o]:s+=""+l[o];else{if(o===void 0)continue;if(l[o]){let d=Ls(l[o],t,r,n),p=Lc(d,t);if(Object.keys(d).length===0&&t.alwaysCreateTextNode&&(d[t.textNodeName]=""),l[":@"]?Rc(d,l[":@"],n,t):Object.keys(d).length===1&&d[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?d=d[t.textNodeName]:Object.keys(d).length===0&&(t.alwaysCreateTextNode?d[t.textNodeName]="":d=""),l[un]!==void 0&&typeof d=="object"&&d!==null&&(d[un]=l[un]),a[o]!==void 0&&Object.prototype.hasOwnProperty.call(a,o))Array.isArray(a[o])||(a[o]=[a[o]]),a[o].push(d);else{let h=t.jPath?n.toString():n;t.isArray(o,h,p)?a[o]=[d]:a[o]=d}o!==void 0&&o!==t.textNodeName&&r.pop()}}}return typeof s=="string"?s.length>0&&(a[t.textNodeName]=s):s!==void 0&&(a[t.textNodeName]=s),a}function _c(e){let t=Object.keys(e);for(let r=0;r<t.length;r++){let n=t[r];if(n!==":@")return n}}function Rc(e,t,r,n){if(t){let s=Object.keys(t),a=s.length;for(let c=0;c<a;c++){let l=s[c],o=l.startsWith(n.attributeNamePrefix)?l.substring(n.attributeNamePrefix.length):l,d=n.jPath?r.toString()+"."+o:r;n.isArray(l,d,!0,!0)?e[l]=[t[l]]:e[l]=t[l]}}}function Lc(e,t){let{textNodeName:r}=t,n=Object.keys(e).length;return!!(n===0||n===1&&(e[r]||typeof e[r]=="boolean"||e[r]===0))}var ze=class{constructor(t){this.externalEntities={},this.options=Es(t)}parse(t,r){if(typeof t!="string"&&t.toString)t=t.toString();else if(typeof t!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(r){r===!0&&(r={});let a=Vt(t,r);if(a!==!0)throw Error(`${a.err.msg}:${a.err.line}:${a.err.col}`)}let n=new Et(this.options,this.externalEntities),s=n.parseXml(t);return this.options.preserveOrder||s===void 0?s:An(s,this.options,n.matcher,n.readonlyMatcher)}addEntity(t,r){if(r.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(t.indexOf("&")!==-1||t.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(r==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=r}static getMetaDataSymbol(){return re.getMetaDataSymbol()}};var Os={validate:Vt};var Oc=/\.(?:avif|bmp|css|csv|docx?|eot|gif|gz|ico|jpe?g|js|json|map|mp3|mp4|mov|ogg|otf|pdf|png|pptx?|rar|rss|svg|tar|tiff?|ttf|txt|wav|webm|webp|woff2?|xlsx?|xml|zip)$/i;function Y(e,t,{includeQuery:r=!1}={}){let n;try{n=t?new URL(e,t):new URL(e)}catch{return null}return n.protocol!=="http:"&&n.protocol!=="https:"?null:(n.hash="",r||(n.search=""),n.pathname.length>1&&n.pathname.endsWith("/")&&(n.pathname=n.pathname.replace(/\/+$/,"")),n.href)}function de(e,t){try{return new URL(e).origin===t}catch{return!1}}function tr(e){try{let t=new URL(e);return!Oc.test(t.pathname)}catch{return!1}}var pn=10*1024*1024,vs=100,Dc=5e4,kc=new ze({ignoreAttributes:!1,removeNSPrefix:!0,trimValues:!0});function rr(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}function Ds(e){return(e===void 0?[]:Array.isArray(e)?e:[e]).flatMap(r=>{let n=rr(r)?.loc;return typeof n=="string"?[n]:[]})}function Bc(e,t,r){let s=t.toLowerCase().endsWith(".gz")||r.includes("gzip")||e[0]===31&&e[1]===139?vc(e):e;if(s.byteLength>pn)throw new Error(`sitemap exceeds ${pn} bytes after decompression: ${t}`);return s.toString("utf8").replace(/^\uFEFF/,"")}function ks(e,t){let r=Os.validate(e);if(r!==!0)throw new Error(`invalid sitemap XML at ${t}: ${r.err.msg}`);let n=rr(kc.parse(e)),s=rr(n?.sitemapindex);if(s)return{kind:"index",locations:Ds(s.sitemap)};let a=rr(n?.urlset);if(a)return{kind:"urlset",locations:Ds(a.url)};throw new Error(`XML is not a sitemap urlset or sitemapindex: ${t}`)}function Bs(e){return{fetch:e.fetch??globalThis.fetch,timeout:e.timeout,maxRedirects:e.maxRedirects??10,retries:e.retries??2,signal:e.signal,gate:e.requestGate?async t=>e.requestGate?.(t):void 0,onEvent:e.onEvent}}async function Ps(e,t){let{response:r}=await Oe(e,{headers:{accept:"application/xml,text/xml,application/gzip,text/plain;q=0.9,*/*;q=0.1","user-agent":t.userAgent}},Bs(t));if(!r.ok)throw await r.body?.cancel(),new Error(`sitemap returned HTTP ${r.status}: ${e}`);let{buffer:n}=await ve(r,pn);return Bc(n,e,r.headers.get("content-type")?.toLowerCase()??"")}async function Pc(e,t){try{let r=await Ps(e,t);return ks(r,e),!0}catch{return!1}}async function Ms(e,t){let r=Y(e,void 0);if(!r)throw new Error(`invalid start URL: ${e}`);let n=new URL(r).origin,s=new URL("/robots.txt",n).href;try{if(t.robotsBody!==void 0)for(let a of t.robotsBody.matchAll(/^sitemap:\s*(\S+)\s*$/gim)){let c=a[1];if(!c)continue;let l=Y(c,s,{includeQuery:!0});if(l&&de(l,n))return l}else{let{response:a}=await Oe(s,{headers:{accept:"text/plain,*/*;q=0.1","user-agent":t.userAgent}},Bs({...t,siteOrigin:n}));if(a.ok){let{text:c}=await ve(a,524288);for(let l of c.matchAll(/^sitemap:\s*(\S+)\s*$/gim)){let o=l[1];if(!o)continue;let d=Y(o,s,{includeQuery:!0});if(d&&de(d,n))return d}}else await a.body?.cancel()}}catch{}for(let a of["/sitemap.xml","/sitemap.xml.gz","/sitemap_index.xml"]){let c=new URL(a,n).href;if(await Pc(c,{...t,siteOrigin:n}))return c}return null}async function nr(e,t){let r=Y(e,void 0,{includeQuery:!0});if(!r)throw new Error(`invalid sitemap URL: ${e}`);let n=new URL(r).origin,s=[r],a=new Set,c=[],l=new Set,o=t.maxUrls??Dc,d=!1;for(;s.length>0&&a.size<vs&&c.length<o;){let p=s.shift();if(a.has(p))continue;a.add(p);let h=ks(await Ps(p,t),p);if(h.kind==="index"){for(let f of h.locations){let m=Y(f,p,{includeQuery:!0});m&&de(m,n)&&!a.has(m)&&!s.includes(m)&&s.push(m)}s.sort();continue}for(let f of h.locations){let m=Y(f,p,{includeQuery:t.includeQuery??!1});if(!(!m||l.has(m)||!de(m,t.siteOrigin)||!tr(m))&&(l.add(m),c.push(m),c.length>=o)){d=!0;break}}}return(s.length>0||a.size>=vs)&&(d=!0),{url:r,urls:c.sort(),sitemapCount:a.size,truncated:d,error:null}}async function hn(e,t){await e.onEvent?.(t)}async function ue(e,t={}){let r=Te(e),n=Y(r.url,void 0,{includeQuery:r.includeQuery});if(!n)throw new Error(`invalid start URL: ${r.url}`);let s=new URL(n).origin,a=t.fetch??globalThis.fetch,c=Ge(r.delay),l=t.logger??Wt;await hn(t,{type:"plan-start",url:n});let o=await Kt(n,{userAgent:_e,timeout:r.timeout,maxRedirects:r.maxRedirects,retries:2,fetch:a,signal:t.signal,requestGate:c,onEvent:t.onEvent,logger:l});await hn(t,{type:"robots",robots:o});let d=null;r.sitemap==="auto"?d=await Ms(n,{timeout:r.timeout,maxRedirects:r.maxRedirects,userAgent:_e,fetch:a,signal:t.signal,requestGate:c,onEvent:t.onEvent,robotsBody:o.body}):r.sitemap!=="none"&&(d=r.sitemap);let p=null;if(d)try{p=await nr(d,{siteOrigin:s,includeQuery:r.includeQuery,maxUrls:5e4,timeout:r.timeout,maxRedirects:r.maxRedirects,retries:2,userAgent:_e,fetch:a,signal:t.signal,requestGate:c,onEvent:t.onEvent})}catch(m){p={url:d,urls:[],sitemapCount:0,truncated:!1,error:m instanceof Error?m.message:String(m)},l.warn(`Could not load sitemap ${d}: ${p.error}`)}let h=p?[...new Set([n,...p.urls])].sort((m,y)=>m===n?-1:y===n?1:m.localeCompare(y)):[n],f=p?h.length:null;return await hn(t,{type:"sitemap",sitemap:p,candidateCount:f}),{planVersion:1,config:r,startUrl:n,origin:s,userAgent:_e,robots:o,sitemap:p,candidateUrls:h,candidateCount:f,mode:p?"sitemap":"links"}}import{createHash as Ri}from"node:crypto";var Mc=new Set([65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111]),M="\uFFFD",u;(function(e){e[e.EOF=-1]="EOF",e[e.NULL=0]="NULL",e[e.TABULATION=9]="TABULATION",e[e.CARRIAGE_RETURN=13]="CARRIAGE_RETURN",e[e.LINE_FEED=10]="LINE_FEED",e[e.FORM_FEED=12]="FORM_FEED",e[e.SPACE=32]="SPACE",e[e.EXCLAMATION_MARK=33]="EXCLAMATION_MARK",e[e.QUOTATION_MARK=34]="QUOTATION_MARK",e[e.AMPERSAND=38]="AMPERSAND",e[e.APOSTROPHE=39]="APOSTROPHE",e[e.HYPHEN_MINUS=45]="HYPHEN_MINUS",e[e.SOLIDUS=47]="SOLIDUS",e[e.DIGIT_0=48]="DIGIT_0",e[e.DIGIT_9=57]="DIGIT_9",e[e.SEMICOLON=59]="SEMICOLON",e[e.LESS_THAN_SIGN=60]="LESS_THAN_SIGN",e[e.EQUALS_SIGN=61]="EQUALS_SIGN",e[e.GREATER_THAN_SIGN=62]="GREATER_THAN_SIGN",e[e.QUESTION_MARK=63]="QUESTION_MARK",e[e.LATIN_CAPITAL_A=65]="LATIN_CAPITAL_A",e[e.LATIN_CAPITAL_Z=90]="LATIN_CAPITAL_Z",e[e.RIGHT_SQUARE_BRACKET=93]="RIGHT_SQUARE_BRACKET",e[e.GRAVE_ACCENT=96]="GRAVE_ACCENT",e[e.LATIN_SMALL_A=97]="LATIN_SMALL_A",e[e.LATIN_SMALL_Z=122]="LATIN_SMALL_Z"})(u||(u={}));var z={DASH_DASH:"--",CDATA_START:"[CDATA[",DOCTYPE:"doctype",SCRIPT:"script",PUBLIC:"public",SYSTEM:"system"};function sr(e){return e>=55296&&e<=57343}function Us(e){return e>=56320&&e<=57343}function Fs(e,t){return(e-55296)*1024+9216+t}function ir(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function ar(e){return e>=64976&&e<=65007||Mc.has(e)}var T;(function(e){e.controlCharacterInInputStream="control-character-in-input-stream",e.noncharacterInInputStream="noncharacter-in-input-stream",e.surrogateInInputStream="surrogate-in-input-stream",e.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",e.endTagWithAttributes="end-tag-with-attributes",e.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",e.unexpectedSolidusInTag="unexpected-solidus-in-tag",e.unexpectedNullCharacter="unexpected-null-character",e.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",e.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",e.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",e.missingEndTagName="missing-end-tag-name",e.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",e.unknownNamedCharacterReference="unknown-named-character-reference",e.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",e.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",e.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",e.eofBeforeTagName="eof-before-tag-name",e.eofInTag="eof-in-tag",e.missingAttributeValue="missing-attribute-value",e.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",e.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",e.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",e.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",e.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",e.missingDoctypePublicIdentifier="missing-doctype-public-identifier",e.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",e.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",e.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",e.cdataInHtmlContent="cdata-in-html-content",e.incorrectlyOpenedComment="incorrectly-opened-comment",e.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",e.eofInDoctype="eof-in-doctype",e.nestedComment="nested-comment",e.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",e.eofInComment="eof-in-comment",e.incorrectlyClosedComment="incorrectly-closed-comment",e.eofInCdata="eof-in-cdata",e.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",e.nullCharacterReference="null-character-reference",e.surrogateCharacterReference="surrogate-character-reference",e.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",e.controlCharacterReference="control-character-reference",e.noncharacterCharacterReference="noncharacter-character-reference",e.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",e.missingDoctypeName="missing-doctype-name",e.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",e.duplicateAttribute="duplicate-attribute",e.nonConformingDoctype="non-conforming-doctype",e.missingDoctype="missing-doctype",e.misplacedDoctype="misplaced-doctype",e.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",e.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",e.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",e.openElementsLeftAfterEof="open-elements-left-after-eof",e.abandonedHeadElementChild="abandoned-head-element-child",e.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",e.nestedNoscriptInHead="nested-noscript-in-head",e.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text"})(T||(T={}));var Fc=65536,or=class{constructor(t){this.handler=t,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=Fc,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+ +(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(t,r){let{line:n,col:s,offset:a}=this,c=s+r,l=a+r;return{code:t,startLine:n,endLine:n,startCol:c,endCol:c,startOffset:l,endOffset:l}}_err(t){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(t,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(t){if(this.pos!==this.html.length-1){let r=this.html.charCodeAt(this.pos+1);if(Us(r))return this.pos++,this._addGap(),Fs(t,r)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,u.EOF;return this._err(T.surrogateInInputStream),t}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(t,r){this.html.length>0?this.html+=t:this.html=t,this.endOfChunkHit=!1,this.lastChunkWritten=r}insertHtmlAtCurrentPos(t){this.html=this.html.substring(0,this.pos+1)+t+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(t,r){if(this.pos+t.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(r)return this.html.startsWith(t,this.pos);for(let n=0;n<t.length;n++)if((this.html.charCodeAt(this.pos+n)|32)!==t.charCodeAt(n))return!1;return!0}peek(t){let r=this.pos+t;if(r>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,u.EOF;let n=this.html.charCodeAt(r);return n===u.CARRIAGE_RETURN?u.LINE_FEED:n}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,u.EOF;let t=this.html.charCodeAt(this.pos);return t===u.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,u.LINE_FEED):t===u.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,sr(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===u.LINE_FEED||t===u.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){ir(t)?this._err(T.controlCharacterInInputStream):ar(t)&&this._err(T.noncharacterInInputStream)}retreat(t){for(this.pos-=t;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}};var v;(function(e){e[e.CHARACTER=0]="CHARACTER",e[e.NULL_CHARACTER=1]="NULL_CHARACTER",e[e.WHITESPACE_CHARACTER=2]="WHITESPACE_CHARACTER",e[e.START_TAG=3]="START_TAG",e[e.END_TAG=4]="END_TAG",e[e.COMMENT=5]="COMMENT",e[e.DOCTYPE=6]="DOCTYPE",e[e.EOF=7]="EOF",e[e.HIBERNATION=8]="HIBERNATION"})(v||(v={}));function cr(e,t){for(let r=e.attrs.length-1;r>=0;r--)if(e.attrs[r].name===t)return e.attrs[r].value;return null}var Qc=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function Hs(e){return e>=55296&&e<=57343||e>1114111?65533:Qc.get(e)??e}function Qs(e){let t=atob(e),r=t.length&-2,n=new Uint16Array(r/2);for(let s=0,a=0;s<r;s+=2){let c=t.charCodeAt(s),l=t.charCodeAt(s+1);n[a++]=c|l<<8}return n}var gn=Qs("QR08ALkAAgH6AYsDNQR2BO0EPgXZBQEGLAbdBxMISQrvCmQLfQurDKQNLw4fD4YPpA+6D/IPAAAAAAAAAAAAAAAAKhBMEY8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WSLlIXJwAKAYIXIAAOA12DTdcABmAADgNdho3WWgQCJhAHQA6ABqD2MAcgAA4DXYzNzjCuQRUC4AAFQuAABYLmIuAAAAAGMubS5wLnQuAAAAAIguki4AAJouJxIqEnQAcgDpAB0ScgAA4DXYNd0AAUFhWy5eLnIA8gDnAnIA8gCTB75jAAFBYWYuaS5yAPIA4AJyAPIAjAdhAPAAeh5pAHMAAKD7IoABZHB0APgReS6DLgABZmx9LoAuAOA12GnddQDzAP8RaQBtAOUABBIAAUFhiy6OLnIA8gDuAnIA8gCaBwABY3GVLgoScgAA4DXYzdwAAXB0nS6hLmwAdQDzACUScgDpACASAARhY2VmaW9zdbEuvC7ELsguzC7PLtQu2S5jAAABdXm2LrsudABlADuA/QD9QE9kAAFpecAuwy5yAGMAd2FLZG4AO4ClAKVAcgAA4DXYNt1jAHkAV2RwAGYAAOA12GrdYwByAADgNdjO3AABY23dLt8ueQBOZGwAO4D/AP9AAAVhY2RlZmhpb3N38y73Lv8uAi8MLxAvEy8YLx0vIi9jInV0ZQB6YQABYXn7Lv4u8iFvbn5hN2RvAHQAfGEAAWV0Bi8KL3QAcgDmAB8QYQC2Y3IAAOA12DfdYwB5ADZk5yJyYXJyAKDdIXAAZgAA4DXYa91jAHIAAOA12M/cAAFqbiYvKC8AoA0gagAAoAwg");var J;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.FLAG13=8192]="FLAG13",e[e.BRANCH_LENGTH=8064]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(J||(J={}));var H;(function(e){e[e.NUM=35]="NUM",e[e.SEMI=59]="SEMI",e[e.EQUALS=61]="EQUALS",e[e.ZERO=48]="ZERO",e[e.NINE=57]="NINE",e[e.LOWER_A=97]="LOWER_A",e[e.LOWER_F=102]="LOWER_F",e[e.LOWER_X=120]="LOWER_X",e[e.LOWER_Z=122]="LOWER_Z",e[e.UPPER_A=65]="UPPER_A",e[e.UPPER_F=70]="UPPER_F",e[e.UPPER_Z=90]="UPPER_Z"})(H||(H={}));var Ys=32;function mn(e){return e>=H.ZERO&&e<=H.NINE}function Yc(e){return e>=H.UPPER_A&&e<=H.UPPER_F||e>=H.LOWER_A&&e<=H.LOWER_F}function Gc(e){return e>=H.UPPER_A&&e<=H.UPPER_Z||e>=H.LOWER_A&&e<=H.LOWER_Z||mn(e)}function Wc(e){return e===H.EQUALS||Gc(e)}var W;(function(e){e[e.EntityStart=0]="EntityStart",e[e.NumericStart=1]="NumericStart",e[e.NumericDecimal=2]="NumericDecimal",e[e.NumericHex=3]="NumericHex",e[e.NamedEntity=4]="NamedEntity"})(W||(W={}));var Ee;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(Ee||(Ee={}));var lr=class{decodeTree;emitCodePoint;errors;constructor(t,r,n){this.decodeTree=t,this.emitCodePoint=r,this.errors=n}state=W.EntityStart;consumed=1;result=0;treeIndex=0;excess=1;decodeMode=Ee.Strict;runConsumed=0;startEntity(t){this.decodeMode=t,this.state=W.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1,this.runConsumed=0}write(t,r){switch(this.state){case W.EntityStart:return t.charCodeAt(r)===H.NUM?(this.state=W.NumericStart,this.consumed+=1,this.stateNumericStart(t,r+1)):(this.state=W.NamedEntity,this.stateNamedEntity(t,r));case W.NumericStart:return this.stateNumericStart(t,r);case W.NumericDecimal:return this.stateNumericDecimal(t,r);case W.NumericHex:return this.stateNumericHex(t,r);case W.NamedEntity:return this.stateNamedEntity(t,r)}}stateNumericStart(t,r){return r>=t.length?-1:(t.charCodeAt(r)|Ys)===H.LOWER_X?(this.state=W.NumericHex,this.consumed+=1,this.stateNumericHex(t,r+1)):(this.state=W.NumericDecimal,this.stateNumericDecimal(t,r))}stateNumericHex(t,r){for(;r<t.length;){let n=t.charCodeAt(r);if(mn(n)||Yc(n)){let s=n<=H.NINE?n-H.ZERO:(n|Ys)-H.LOWER_A+10;this.result=this.result*16+s,this.consumed++,r++}else return this.emitNumericEntity(n,3)}return-1}stateNumericDecimal(t,r){for(;r<t.length;){let n=t.charCodeAt(r);if(mn(n))this.result=this.result*10+(n-H.ZERO),this.consumed++,r++;else return this.emitNumericEntity(n,2)}return-1}emitNumericEntity(t,r){if(this.consumed<=r)return this.errors?.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(t===H.SEMI)this.consumed+=1;else if(this.decodeMode===Ee.Strict)return 0;return this.emitCodePoint(Hs(this.result),this.consumed),this.errors&&(t!==H.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(t,r){let{decodeTree:n}=this,s=n[this.treeIndex],a=(s&J.VALUE_LENGTH)>>14;for(;r<t.length;){if(a===0&&(s&J.FLAG13)!==0){let l=(s&J.BRANCH_LENGTH)>>7;if(this.runConsumed===0){let o=s&J.JUMP_TABLE;if(t.charCodeAt(r)!==o)return this.result===0?0:this.emitNotTerminatedNamedEntity();r++,this.excess++,this.runConsumed++}for(;this.runConsumed<l;){if(r>=t.length)return-1;let o=this.runConsumed-1,d=n[this.treeIndex+1+(o>>1)],p=o%2===0?d&255:d>>8&255;if(t.charCodeAt(r)!==p)return this.runConsumed=0,this.result===0?0:this.emitNotTerminatedNamedEntity();r++,this.excess++,this.runConsumed++}this.runConsumed=0,this.treeIndex+=1+(l>>1),s=n[this.treeIndex],a=(s&J.VALUE_LENGTH)>>14}if(r>=t.length)break;let c=t.charCodeAt(r);if(c===H.SEMI&&a!==0&&(s&J.FLAG13)!==0)return this.emitNamedEntityData(this.treeIndex,a,this.consumed+this.excess);if(this.treeIndex=Kc(n,s,this.treeIndex+Math.max(1,a),c),this.treeIndex<0)return this.result===0||this.decodeMode===Ee.Attribute&&(a===0||Wc(c))?0:this.emitNotTerminatedNamedEntity();if(s=n[this.treeIndex],a=(s&J.VALUE_LENGTH)>>14,a!==0){if(c===H.SEMI)return this.emitNamedEntityData(this.treeIndex,a,this.consumed+this.excess);this.decodeMode!==Ee.Strict&&(s&J.FLAG13)===0&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}r++,this.excess++}return-1}emitNotTerminatedNamedEntity(){let{result:t,decodeTree:r}=this,n=(r[t]&J.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,n,this.consumed),this.errors?.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,r,n){let{decodeTree:s}=this;return this.emitCodePoint(r===1?s[t]&~(J.VALUE_LENGTH|J.FLAG13):s[t+1],n),r===3&&this.emitCodePoint(s[t+2],n),n}end(){switch(this.state){case W.NamedEntity:return this.result!==0&&(this.decodeMode!==Ee.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case W.NumericDecimal:return this.emitNumericEntity(0,2);case W.NumericHex:return this.emitNumericEntity(0,3);case W.NumericStart:return this.errors?.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case W.EntityStart:return 0}}};function Kc(e,t,r,n){let s=(t&J.BRANCH_LENGTH)>>7,a=t&J.JUMP_TABLE;if(s===0)return a!==0&&n===a?r:-1;if(a){let d=n-a;return d<0||d>=s?-1:e[r+d]-1}let c=s+1>>1,l=0,o=s-1;for(;l<=o;){let d=l+o>>>1,p=d>>1,f=e[r+p]>>(d&1)*8&255;if(f<n)l=d+1;else if(f>n)o=d-1;else return e[r+c+d]}return-1}var b;(function(e){e.HTML="http://www.w3.org/1999/xhtml",e.MATHML="http://www.w3.org/1998/Math/MathML",e.SVG="http://www.w3.org/2000/svg",e.XLINK="http://www.w3.org/1999/xlink",e.XML="http://www.w3.org/XML/1998/namespace",e.XMLNS="http://www.w3.org/2000/xmlns/"})(b||(b={}));var be;(function(e){e.TYPE="type",e.ACTION="action",e.ENCODING="encoding",e.PROMPT="prompt",e.NAME="name",e.COLOR="color",e.FACE="face",e.SIZE="size"})(be||(be={}));var q;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(q||(q={}));var E;(function(e){e.A="a",e.ADDRESS="address",e.ANNOTATION_XML="annotation-xml",e.APPLET="applet",e.AREA="area",e.ARTICLE="article",e.ASIDE="aside",e.B="b",e.BASE="base",e.BASEFONT="basefont",e.BGSOUND="bgsound",e.BIG="big",e.BLOCKQUOTE="blockquote",e.BODY="body",e.BR="br",e.BUTTON="button",e.CAPTION="caption",e.CENTER="center",e.CODE="code",e.COL="col",e.COLGROUP="colgroup",e.DD="dd",e.DESC="desc",e.DETAILS="details",e.DIALOG="dialog",e.DIR="dir",e.DIV="div",e.DL="dl",e.DT="dt",e.EM="em",e.EMBED="embed",e.FIELDSET="fieldset",e.FIGCAPTION="figcaption",e.FIGURE="figure",e.FONT="font",e.FOOTER="footer",e.FOREIGN_OBJECT="foreignObject",e.FORM="form",e.FRAME="frame",e.FRAMESET="frameset",e.H1="h1",e.H2="h2",e.H3="h3",e.H4="h4",e.H5="h5",e.H6="h6",e.HEAD="head",e.HEADER="header",e.HGROUP="hgroup",e.HR="hr",e.HTML="html",e.I="i",e.IMG="img",e.IMAGE="image",e.INPUT="input",e.IFRAME="iframe",e.KEYGEN="keygen",e.LABEL="label",e.LI="li",e.LINK="link",e.LISTING="listing",e.MAIN="main",e.MALIGNMARK="malignmark",e.MARQUEE="marquee",e.MATH="math",e.MENU="menu",e.META="meta",e.MGLYPH="mglyph",e.MI="mi",e.MO="mo",e.MN="mn",e.MS="ms",e.MTEXT="mtext",e.NAV="nav",e.NOBR="nobr",e.NOFRAMES="noframes",e.NOEMBED="noembed",e.NOSCRIPT="noscript",e.OBJECT="object",e.OL="ol",e.OPTGROUP="optgroup",e.OPTION="option",e.P="p",e.PARAM="param",e.PLAINTEXT="plaintext",e.PRE="pre",e.RB="rb",e.RP="rp",e.RT="rt",e.RTC="rtc",e.RUBY="ruby",e.S="s",e.SCRIPT="script",e.SEARCH="search",e.SECTION="section",e.SELECT="select",e.SOURCE="source",e.SMALL="small",e.SPAN="span",e.STRIKE="strike",e.STRONG="strong",e.STYLE="style",e.SUB="sub",e.SUMMARY="summary",e.SUP="sup",e.TABLE="table",e.TBODY="tbody",e.TEMPLATE="template",e.TEXTAREA="textarea",e.TFOOT="tfoot",e.TD="td",e.TH="th",e.THEAD="thead",e.TITLE="title",e.TR="tr",e.TRACK="track",e.TT="tt",e.U="u",e.UL="ul",e.SVG="svg",e.VAR="var",e.WBR="wbr",e.XMP="xmp"})(E||(E={}));var i;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.A=1]="A",e[e.ADDRESS=2]="ADDRESS",e[e.ANNOTATION_XML=3]="ANNOTATION_XML",e[e.APPLET=4]="APPLET",e[e.AREA=5]="AREA",e[e.ARTICLE=6]="ARTICLE",e[e.ASIDE=7]="ASIDE",e[e.B=8]="B",e[e.BASE=9]="BASE",e[e.BASEFONT=10]="BASEFONT",e[e.BGSOUND=11]="BGSOUND",e[e.BIG=12]="BIG",e[e.BLOCKQUOTE=13]="BLOCKQUOTE",e[e.BODY=14]="BODY",e[e.BR=15]="BR",e[e.BUTTON=16]="BUTTON",e[e.CAPTION=17]="CAPTION",e[e.CENTER=18]="CENTER",e[e.CODE=19]="CODE",e[e.COL=20]="COL",e[e.COLGROUP=21]="COLGROUP",e[e.DD=22]="DD",e[e.DESC=23]="DESC",e[e.DETAILS=24]="DETAILS",e[e.DIALOG=25]="DIALOG",e[e.DIR=26]="DIR",e[e.DIV=27]="DIV",e[e.DL=28]="DL",e[e.DT=29]="DT",e[e.EM=30]="EM",e[e.EMBED=31]="EMBED",e[e.FIELDSET=32]="FIELDSET",e[e.FIGCAPTION=33]="FIGCAPTION",e[e.FIGURE=34]="FIGURE",e[e.FONT=35]="FONT",e[e.FOOTER=36]="FOOTER",e[e.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",e[e.FORM=38]="FORM",e[e.FRAME=39]="FRAME",e[e.FRAMESET=40]="FRAMESET",e[e.H1=41]="H1",e[e.H2=42]="H2",e[e.H3=43]="H3",e[e.H4=44]="H4",e[e.H5=45]="H5",e[e.H6=46]="H6",e[e.HEAD=47]="HEAD",e[e.HEADER=48]="HEADER",e[e.HGROUP=49]="HGROUP",e[e.HR=50]="HR",e[e.HTML=51]="HTML",e[e.I=52]="I",e[e.IMG=53]="IMG",e[e.IMAGE=54]="IMAGE",e[e.INPUT=55]="INPUT",e[e.IFRAME=56]="IFRAME",e[e.KEYGEN=57]="KEYGEN",e[e.LABEL=58]="LABEL",e[e.LI=59]="LI",e[e.LINK=60]="LINK",e[e.LISTING=61]="LISTING",e[e.MAIN=62]="MAIN",e[e.MALIGNMARK=63]="MALIGNMARK",e[e.MARQUEE=64]="MARQUEE",e[e.MATH=65]="MATH",e[e.MENU=66]="MENU",e[e.META=67]="META",e[e.MGLYPH=68]="MGLYPH",e[e.MI=69]="MI",e[e.MO=70]="MO",e[e.MN=71]="MN",e[e.MS=72]="MS",e[e.MTEXT=73]="MTEXT",e[e.NAV=74]="NAV",e[e.NOBR=75]="NOBR",e[e.NOFRAMES=76]="NOFRAMES",e[e.NOEMBED=77]="NOEMBED",e[e.NOSCRIPT=78]="NOSCRIPT",e[e.OBJECT=79]="OBJECT",e[e.OL=80]="OL",e[e.OPTGROUP=81]="OPTGROUP",e[e.OPTION=82]="OPTION",e[e.P=83]="P",e[e.PARAM=84]="PARAM",e[e.PLAINTEXT=85]="PLAINTEXT",e[e.PRE=86]="PRE",e[e.RB=87]="RB",e[e.RP=88]="RP",e[e.RT=89]="RT",e[e.RTC=90]="RTC",e[e.RUBY=91]="RUBY",e[e.S=92]="S",e[e.SCRIPT=93]="SCRIPT",e[e.SEARCH=94]="SEARCH",e[e.SECTION=95]="SECTION",e[e.SELECT=96]="SELECT",e[e.SOURCE=97]="SOURCE",e[e.SMALL=98]="SMALL",e[e.SPAN=99]="SPAN",e[e.STRIKE=100]="STRIKE",e[e.STRONG=101]="STRONG",e[e.STYLE=102]="STYLE",e[e.SUB=103]="SUB",e[e.SUMMARY=104]="SUMMARY",e[e.SUP=105]="SUP",e[e.TABLE=106]="TABLE",e[e.TBODY=107]="TBODY",e[e.TEMPLATE=108]="TEMPLATE",e[e.TEXTAREA=109]="TEXTAREA",e[e.TFOOT=110]="TFOOT",e[e.TD=111]="TD",e[e.TH=112]="TH",e[e.THEAD=113]="THEAD",e[e.TITLE=114]="TITLE",e[e.TR=115]="TR",e[e.TRACK=116]="TRACK",e[e.TT=117]="TT",e[e.U=118]="U",e[e.UL=119]="UL",e[e.SVG=120]="SVG",e[e.VAR=121]="VAR",e[e.WBR=122]="WBR",e[e.XMP=123]="XMP"})(i||(i={}));var Jc=new Map([[E.A,i.A],[E.ADDRESS,i.ADDRESS],[E.ANNOTATION_XML,i.ANNOTATION_XML],[E.APPLET,i.APPLET],[E.AREA,i.AREA],[E.ARTICLE,i.ARTICLE],[E.ASIDE,i.ASIDE],[E.B,i.B],[E.BASE,i.BASE],[E.BASEFONT,i.BASEFONT],[E.BGSOUND,i.BGSOUND],[E.BIG,i.BIG],[E.BLOCKQUOTE,i.BLOCKQUOTE],[E.BODY,i.BODY],[E.BR,i.BR],[E.BUTTON,i.BUTTON],[E.CAPTION,i.CAPTION],[E.CENTER,i.CENTER],[E.CODE,i.CODE],[E.COL,i.COL],[E.COLGROUP,i.COLGROUP],[E.DD,i.DD],[E.DESC,i.DESC],[E.DETAILS,i.DETAILS],[E.DIALOG,i.DIALOG],[E.DIR,i.DIR],[E.DIV,i.DIV],[E.DL,i.DL],[E.DT,i.DT],[E.EM,i.EM],[E.EMBED,i.EMBED],[E.FIELDSET,i.FIELDSET],[E.FIGCAPTION,i.FIGCAPTION],[E.FIGURE,i.FIGURE],[E.FONT,i.FONT],[E.FOOTER,i.FOOTER],[E.FOREIGN_OBJECT,i.FOREIGN_OBJECT],[E.FORM,i.FORM],[E.FRAME,i.FRAME],[E.FRAMESET,i.FRAMESET],[E.H1,i.H1],[E.H2,i.H2],[E.H3,i.H3],[E.H4,i.H4],[E.H5,i.H5],[E.H6,i.H6],[E.HEAD,i.HEAD],[E.HEADER,i.HEADER],[E.HGROUP,i.HGROUP],[E.HR,i.HR],[E.HTML,i.HTML],[E.I,i.I],[E.IMG,i.IMG],[E.IMAGE,i.IMAGE],[E.INPUT,i.INPUT],[E.IFRAME,i.IFRAME],[E.KEYGEN,i.KEYGEN],[E.LABEL,i.LABEL],[E.LI,i.LI],[E.LINK,i.LINK],[E.LISTING,i.LISTING],[E.MAIN,i.MAIN],[E.MALIGNMARK,i.MALIGNMARK],[E.MARQUEE,i.MARQUEE],[E.MATH,i.MATH],[E.MENU,i.MENU],[E.META,i.META],[E.MGLYPH,i.MGLYPH],[E.MI,i.MI],[E.MO,i.MO],[E.MN,i.MN],[E.MS,i.MS],[E.MTEXT,i.MTEXT],[E.NAV,i.NAV],[E.NOBR,i.NOBR],[E.NOFRAMES,i.NOFRAMES],[E.NOEMBED,i.NOEMBED],[E.NOSCRIPT,i.NOSCRIPT],[E.OBJECT,i.OBJECT],[E.OL,i.OL],[E.OPTGROUP,i.OPTGROUP],[E.OPTION,i.OPTION],[E.P,i.P],[E.PARAM,i.PARAM],[E.PLAINTEXT,i.PLAINTEXT],[E.PRE,i.PRE],[E.RB,i.RB],[E.RP,i.RP],[E.RT,i.RT],[E.RTC,i.RTC],[E.RUBY,i.RUBY],[E.S,i.S],[E.SCRIPT,i.SCRIPT],[E.SEARCH,i.SEARCH],[E.SECTION,i.SECTION],[E.SELECT,i.SELECT],[E.SOURCE,i.SOURCE],[E.SMALL,i.SMALL],[E.SPAN,i.SPAN],[E.STRIKE,i.STRIKE],[E.STRONG,i.STRONG],[E.STYLE,i.STYLE],[E.SUB,i.SUB],[E.SUMMARY,i.SUMMARY],[E.SUP,i.SUP],[E.TABLE,i.TABLE],[E.TBODY,i.TBODY],[E.TEMPLATE,i.TEMPLATE],[E.TEXTAREA,i.TEXTAREA],[E.TFOOT,i.TFOOT],[E.TD,i.TD],[E.TH,i.TH],[E.THEAD,i.THEAD],[E.TITLE,i.TITLE],[E.TR,i.TR],[E.TRACK,i.TRACK],[E.TT,i.TT],[E.U,i.U],[E.UL,i.UL],[E.SVG,i.SVG],[E.VAR,i.VAR],[E.WBR,i.WBR],[E.XMP,i.XMP]]);function Pe(e){var t;return(t=Jc.get(e))!==null&&t!==void 0?t:i.UNKNOWN}var C=i,Gs={[b.HTML]:new Set([C.ADDRESS,C.APPLET,C.AREA,C.ARTICLE,C.ASIDE,C.BASE,C.BASEFONT,C.BGSOUND,C.BLOCKQUOTE,C.BODY,C.BR,C.BUTTON,C.CAPTION,C.CENTER,C.COL,C.COLGROUP,C.DD,C.DETAILS,C.DIR,C.DIV,C.DL,C.DT,C.EMBED,C.FIELDSET,C.FIGCAPTION,C.FIGURE,C.FOOTER,C.FORM,C.FRAME,C.FRAMESET,C.H1,C.H2,C.H3,C.H4,C.H5,C.H6,C.HEAD,C.HEADER,C.HGROUP,C.HR,C.HTML,C.IFRAME,C.IMG,C.INPUT,C.LI,C.LINK,C.LISTING,C.MAIN,C.MARQUEE,C.MENU,C.META,C.NAV,C.NOEMBED,C.NOFRAMES,C.NOSCRIPT,C.OBJECT,C.OL,C.P,C.PARAM,C.PLAINTEXT,C.PRE,C.SCRIPT,C.SECTION,C.SELECT,C.SOURCE,C.STYLE,C.SUMMARY,C.TABLE,C.TBODY,C.TD,C.TEMPLATE,C.TEXTAREA,C.TFOOT,C.TH,C.THEAD,C.TITLE,C.TR,C.TRACK,C.UL,C.WBR,C.XMP]),[b.MATHML]:new Set([C.MI,C.MO,C.MN,C.MS,C.MTEXT,C.ANNOTATION_XML]),[b.SVG]:new Set([C.TITLE,C.FOREIGN_OBJECT,C.DESC]),[b.XLINK]:new Set,[b.XML]:new Set,[b.XMLNS]:new Set},Tt=new Set([C.H1,C.H2,C.H3,C.H4,C.H5,C.H6]),Tg=new Set([E.STYLE,E.SCRIPT,E.XMP,E.IFRAME,E.NOEMBED,E.NOFRAMES,E.PLAINTEXT]);var A;(function(e){e[e.DATA=0]="DATA",e[e.RCDATA=1]="RCDATA",e[e.RAWTEXT=2]="RAWTEXT",e[e.SCRIPT_DATA=3]="SCRIPT_DATA",e[e.PLAINTEXT=4]="PLAINTEXT",e[e.TAG_OPEN=5]="TAG_OPEN",e[e.END_TAG_OPEN=6]="END_TAG_OPEN",e[e.TAG_NAME=7]="TAG_NAME",e[e.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",e[e.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",e[e.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",e[e.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",e[e.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",e[e.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",e[e.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",e[e.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",e[e.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",e[e.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",e[e.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",e[e.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",e[e.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",e[e.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",e[e.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",e[e.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",e[e.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",e[e.BOGUS_COMMENT=40]="BOGUS_COMMENT",e[e.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",e[e.COMMENT_START=42]="COMMENT_START",e[e.COMMENT_START_DASH=43]="COMMENT_START_DASH",e[e.COMMENT=44]="COMMENT",e[e.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",e[e.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",e[e.COMMENT_END_DASH=49]="COMMENT_END_DASH",e[e.COMMENT_END=50]="COMMENT_END",e[e.COMMENT_END_BANG=51]="COMMENT_END_BANG",e[e.DOCTYPE=52]="DOCTYPE",e[e.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",e[e.DOCTYPE_NAME=54]="DOCTYPE_NAME",e[e.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",e[e.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",e[e.CDATA_SECTION=68]="CDATA_SECTION",e[e.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",e[e.CDATA_SECTION_END=70]="CDATA_SECTION_END",e[e.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",e[e.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND"})(A||(A={}));var j={DATA:A.DATA,RCDATA:A.RCDATA,RAWTEXT:A.RAWTEXT,SCRIPT_DATA:A.SCRIPT_DATA,PLAINTEXT:A.PLAINTEXT,CDATA_SECTION:A.CDATA_SECTION};function Vc(e){return e>=u.DIGIT_0&&e<=u.DIGIT_9}function bt(e){return e>=u.LATIN_CAPITAL_A&&e<=u.LATIN_CAPITAL_Z}function $c(e){return e>=u.LATIN_SMALL_A&&e<=u.LATIN_SMALL_Z}function we(e){return $c(e)||bt(e)}function Ws(e){return we(e)||Vc(e)}function dr(e){return e+32}function Js(e){return e===u.SPACE||e===u.LINE_FEED||e===u.TABULATION||e===u.FORM_FEED}function Ks(e){return Js(e)||e===u.SOLIDUS||e===u.GREATER_THAN_SIGN}function Xc(e){return e===u.NULL?T.nullCharacterReference:e>1114111?T.characterReferenceOutsideUnicodeRange:sr(e)?T.surrogateCharacterReference:ar(e)?T.noncharacterCharacterReference:ir(e)||e===u.CARRIAGE_RETURN?T.controlCharacterReference:null}var Ct=class{constructor(t,r){this.options=t,this.handler=r,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=A.DATA,this.returnState=A.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new or(r),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new lr(gn,(n,s)=>{this.preprocessor.pos=this.entityStartPos+s-1,this._flushCodePointConsumedAsCharacterReference(n)},r.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(T.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:n=>{this._err(T.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+n)},validateNumericCharacterReference:n=>{let s=Xc(n);s&&this._err(s,1)}}:void 0)}_err(t,r=0){var n,s;(s=(n=this.handler).onParseError)===null||s===void 0||s.call(n,this.preprocessor.getError(t,r))}getCurrentLocation(t){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-t,startOffset:this.preprocessor.offset-t,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;let t=this._consume();this._ensureHibernation()||this._callState(t)}this.inLoop=!1}}pause(){this.paused=!0}resume(t){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||t?.())}write(t,r,n){this.active=!0,this.preprocessor.write(t,r),this._runParsingLoop(),this.paused||n?.()}insertHtmlAtCurrentPos(t){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(t),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(t){this.consumedAfterSnapshot+=t;for(let r=0;r<t;r++)this.preprocessor.advance()}_consumeSequenceIfMatch(t,r){return this.preprocessor.startsWith(t,r)?(this._advanceBy(t.length-1),!0):!1}_createStartTagToken(){this.currentToken={type:v.START_TAG,tagName:"",tagID:i.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:v.END_TAG,tagName:"",tagID:i.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(t){this.currentToken={type:v.COMMENT,data:"",location:this.getCurrentLocation(t)}}_createDoctypeToken(t){this.currentToken={type:v.DOCTYPE,name:t,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(t,r){this.currentCharacterToken={type:t,chars:r,location:this.currentLocation}}_createAttr(t){this.currentAttr={name:t,value:""},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var t,r;let n=this.currentToken;if(cr(n,this.currentAttr.name)===null){if(n.attrs.push(this.currentAttr),n.location&&this.currentLocation){let s=(t=(r=n.location).attrs)!==null&&t!==void 0?t:r.attrs=Object.create(null);s[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err(T.duplicateAttribute)}_leaveAttrValue(){this.currentLocation&&(this.currentLocation.endLine=this.preprocessor.line,this.currentLocation.endCol=this.preprocessor.col,this.currentLocation.endOffset=this.preprocessor.offset)}prepareToken(t){this._emitCurrentCharacterToken(t.location),this.currentToken=null,t.location&&(t.location.endLine=this.preprocessor.line,t.location.endCol=this.preprocessor.col+1,t.location.endOffset=this.preprocessor.offset+1),this.currentLocation=this.getCurrentLocation(-1)}emitCurrentTagToken(){let t=this.currentToken;this.prepareToken(t),t.tagID=Pe(t.tagName),t.type===v.START_TAG?(this.lastStartTagName=t.tagName,this.handler.onStartTag(t)):(t.attrs.length>0&&this._err(T.endTagWithAttributes),t.selfClosing&&this._err(T.endTagWithTrailingSolidus),this.handler.onEndTag(t)),this.preprocessor.dropParsedChunk()}emitCurrentComment(t){this.prepareToken(t),this.handler.onComment(t),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(t){this.prepareToken(t),this.handler.onDoctype(t),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(t){if(this.currentCharacterToken){switch(t&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=t.startLine,this.currentCharacterToken.location.endCol=t.startCol,this.currentCharacterToken.location.endOffset=t.startOffset),this.currentCharacterToken.type){case v.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case v.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case v.WHITESPACE_CHARACTER:{this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}}this.currentCharacterToken=null}}_emitEOFToken(){let t=this.getCurrentLocation(0);t&&(t.endLine=t.startLine,t.endCol=t.startCol,t.endOffset=t.startOffset),this._emitCurrentCharacterToken(t),this.handler.onEof({type:v.EOF,location:t}),this.active=!1}_appendCharToCurrentCharacterToken(t,r){if(this.currentCharacterToken)if(this.currentCharacterToken.type===t){this.currentCharacterToken.chars+=r;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(t,r)}_emitCodePoint(t){let r=Js(t)?v.WHITESPACE_CHARACTER:t===u.NULL?v.NULL_CHARACTER:v.CHARACTER;this._appendCharToCurrentCharacterToken(r,t<65536?String.fromCharCode(t):String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(v.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=A.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?Ee.Attribute:Ee.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===A.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===A.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===A.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case A.DATA:{this._stateData(t);break}case A.RCDATA:{this._stateRcdata(t);break}case A.RAWTEXT:{this._stateRawtext(t);break}case A.SCRIPT_DATA:{this._stateScriptData(t);break}case A.PLAINTEXT:{this._statePlaintext(t);break}case A.TAG_OPEN:{this._stateTagOpen(t);break}case A.END_TAG_OPEN:{this._stateEndTagOpen(t);break}case A.TAG_NAME:{this._stateTagName(t);break}case A.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(t);break}case A.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(t);break}case A.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(t);break}case A.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(t);break}case A.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(t);break}case A.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(t);break}case A.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(t);break}case A.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(t);break}case A.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(t);break}case A.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(t);break}case A.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(t);break}case A.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(t);break}case A.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(t);break}case A.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(t);break}case A.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(t);break}case A.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(t);break}case A.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(t);break}case A.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(t);break}case A.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(t);break}case A.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(t);break}case A.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(t);break}case A.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(t);break}case A.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(t);break}case A.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(t);break}case A.ATTRIBUTE_NAME:{this._stateAttributeName(t);break}case A.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(t);break}case A.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(t);break}case A.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(t);break}case A.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(t);break}case A.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(t);break}case A.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(t);break}case A.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(t);break}case A.BOGUS_COMMENT:{this._stateBogusComment(t);break}case A.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(t);break}case A.COMMENT_START:{this._stateCommentStart(t);break}case A.COMMENT_START_DASH:{this._stateCommentStartDash(t);break}case A.COMMENT:{this._stateComment(t);break}case A.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(t);break}case A.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(t);break}case A.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(t);break}case A.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(t);break}case A.COMMENT_END_DASH:{this._stateCommentEndDash(t);break}case A.COMMENT_END:{this._stateCommentEnd(t);break}case A.COMMENT_END_BANG:{this._stateCommentEndBang(t);break}case A.DOCTYPE:{this._stateDoctype(t);break}case A.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(t);break}case A.DOCTYPE_NAME:{this._stateDoctypeName(t);break}case A.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(t);break}case A.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(t);break}case A.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(t);break}case A.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(t);break}case A.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(t);break}case A.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(t);break}case A.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break}case A.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(t);break}case A.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(t);break}case A.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(t);break}case A.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(t);break}case A.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(t);break}case A.BOGUS_DOCTYPE:{this._stateBogusDoctype(t);break}case A.CDATA_SECTION:{this._stateCdataSection(t);break}case A.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(t);break}case A.CDATA_SECTION_END:{this._stateCdataSectionEnd(t);break}case A.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case A.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(t);break}default:throw new Error("Unknown state")}}_stateData(t){switch(t){case u.LESS_THAN_SIGN:{this.state=A.TAG_OPEN;break}case u.AMPERSAND:{this._startCharacterReference();break}case u.NULL:{this._err(T.unexpectedNullCharacter),this._emitCodePoint(t);break}case u.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case u.AMPERSAND:{this._startCharacterReference();break}case u.LESS_THAN_SIGN:{this.state=A.RCDATA_LESS_THAN_SIGN;break}case u.NULL:{this._err(T.unexpectedNullCharacter),this._emitChars(M);break}case u.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case u.LESS_THAN_SIGN:{this.state=A.RAWTEXT_LESS_THAN_SIGN;break}case u.NULL:{this._err(T.unexpectedNullCharacter),this._emitChars(M);break}case u.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case u.LESS_THAN_SIGN:{this.state=A.SCRIPT_DATA_LESS_THAN_SIGN;break}case u.NULL:{this._err(T.unexpectedNullCharacter),this._emitChars(M);break}case u.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case u.NULL:{this._err(T.unexpectedNullCharacter),this._emitChars(M);break}case u.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(we(t))this._createStartTagToken(),this.state=A.TAG_NAME,this._stateTagName(t);else switch(t){case u.EXCLAMATION_MARK:{this.state=A.MARKUP_DECLARATION_OPEN;break}case u.SOLIDUS:{this.state=A.END_TAG_OPEN;break}case u.QUESTION_MARK:{this._err(T.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=A.BOGUS_COMMENT,this._stateBogusComment(t);break}case u.EOF:{this._err(T.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(T.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=A.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(we(t))this._createEndTagToken(),this.state=A.TAG_NAME,this._stateTagName(t);else switch(t){case u.GREATER_THAN_SIGN:{this._err(T.missingEndTagName),this.state=A.DATA;break}case u.EOF:{this._err(T.eofBeforeTagName),this._emitChars("</"),this._emitEOFToken();break}default:this._err(T.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=A.BOGUS_COMMENT,this._stateBogusComment(t)}}_stateTagName(t){let r=this.currentToken;switch(t){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:{this.state=A.BEFORE_ATTRIBUTE_NAME;break}case u.SOLIDUS:{this.state=A.SELF_CLOSING_START_TAG;break}case u.GREATER_THAN_SIGN:{this.state=A.DATA,this.emitCurrentTagToken();break}case u.NULL:{this._err(T.unexpectedNullCharacter),r.tagName+=M;break}case u.EOF:{this._err(T.eofInTag),this._emitEOFToken();break}default:r.tagName+=String.fromCodePoint(bt(t)?dr(t):t)}}_stateRcdataLessThanSign(t){t===u.SOLIDUS?this.state=A.RCDATA_END_TAG_OPEN:(this._emitChars("<"),this.state=A.RCDATA,this._stateRcdata(t))}_stateRcdataEndTagOpen(t){we(t)?(this.state=A.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(t)):(this._emitChars("</"),this.state=A.RCDATA,this._stateRcdata(t))}handleSpecialEndTag(t){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();this._createEndTagToken();let r=this.currentToken;switch(r.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=A.BEFORE_ATTRIBUTE_NAME,!1;case u.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=A.SELF_CLOSING_START_TAG,!1;case u.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=A.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=A.RCDATA,this._stateRcdata(t))}_stateRawtextLessThanSign(t){t===u.SOLIDUS?this.state=A.RAWTEXT_END_TAG_OPEN:(this._emitChars("<"),this.state=A.RAWTEXT,this._stateRawtext(t))}_stateRawtextEndTagOpen(t){we(t)?(this.state=A.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(t)):(this._emitChars("</"),this.state=A.RAWTEXT,this._stateRawtext(t))}_stateRawtextEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=A.RAWTEXT,this._stateRawtext(t))}_stateScriptDataLessThanSign(t){switch(t){case u.SOLIDUS:{this.state=A.SCRIPT_DATA_END_TAG_OPEN;break}case u.EXCLAMATION_MARK:{this.state=A.SCRIPT_DATA_ESCAPE_START,this._emitChars("<!");break}default:this._emitChars("<"),this.state=A.SCRIPT_DATA,this._stateScriptData(t)}}_stateScriptDataEndTagOpen(t){we(t)?(this.state=A.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(t)):(this._emitChars("</"),this.state=A.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=A.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscapeStart(t){t===u.HYPHEN_MINUS?(this.state=A.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars("-")):(this.state=A.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscapeStartDash(t){t===u.HYPHEN_MINUS?(this.state=A.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-")):(this.state=A.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscaped(t){switch(t){case u.HYPHEN_MINUS:{this.state=A.SCRIPT_DATA_ESCAPED_DASH,this._emitChars("-");break}case u.LESS_THAN_SIGN:{this.state=A.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case u.NULL:{this._err(T.unexpectedNullCharacter),this._emitChars(M);break}case u.EOF:{this._err(T.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptDataEscapedDash(t){switch(t){case u.HYPHEN_MINUS:{this.state=A.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-");break}case u.LESS_THAN_SIGN:{this.state=A.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case u.NULL:{this._err(T.unexpectedNullCharacter),this.state=A.SCRIPT_DATA_ESCAPED,this._emitChars(M);break}case u.EOF:{this._err(T.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=A.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedDashDash(t){switch(t){case u.HYPHEN_MINUS:{this._emitChars("-");break}case u.LESS_THAN_SIGN:{this.state=A.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case u.GREATER_THAN_SIGN:{this.state=A.SCRIPT_DATA,this._emitChars(">");break}case u.NULL:{this._err(T.unexpectedNullCharacter),this.state=A.SCRIPT_DATA_ESCAPED,this._emitChars(M);break}case u.EOF:{this._err(T.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=A.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===u.SOLIDUS?this.state=A.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:we(t)?(this._emitChars("<"),this.state=A.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=A.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){we(t)?(this.state=A.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("</"),this.state=A.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=A.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataDoubleEscapeStart(t){if(this.preprocessor.startsWith(z.SCRIPT,!1)&&Ks(this.preprocessor.peek(z.SCRIPT.length))){this._emitCodePoint(t);for(let r=0;r<z.SCRIPT.length;r++)this._emitCodePoint(this._consume());this.state=A.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=A.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataDoubleEscaped(t){switch(t){case u.HYPHEN_MINUS:{this.state=A.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars("-");break}case u.LESS_THAN_SIGN:{this.state=A.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case u.NULL:{this._err(T.unexpectedNullCharacter),this._emitChars(M);break}case u.EOF:{this._err(T.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedDash(t){switch(t){case u.HYPHEN_MINUS:{this.state=A.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars("-");break}case u.LESS_THAN_SIGN:{this.state=A.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case u.NULL:{this._err(T.unexpectedNullCharacter),this.state=A.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(M);break}case u.EOF:{this._err(T.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=A.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedDashDash(t){switch(t){case u.HYPHEN_MINUS:{this._emitChars("-");break}case u.LESS_THAN_SIGN:{this.state=A.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case u.GREATER_THAN_SIGN:{this.state=A.SCRIPT_DATA,this._emitChars(">");break}case u.NULL:{this._err(T.unexpectedNullCharacter),this.state=A.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(M);break}case u.EOF:{this._err(T.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=A.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===u.SOLIDUS?(this.state=A.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=A.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(z.SCRIPT,!1)&&Ks(this.preprocessor.peek(z.SCRIPT.length))){this._emitCodePoint(t);for(let r=0;r<z.SCRIPT.length;r++)this._emitCodePoint(this._consume());this.state=A.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=A.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateBeforeAttributeName(t){switch(t){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:break;case u.SOLIDUS:case u.GREATER_THAN_SIGN:case u.EOF:{this.state=A.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(t);break}case u.EQUALS_SIGN:{this._err(T.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state=A.ATTRIBUTE_NAME;break}default:this._createAttr(""),this.state=A.ATTRIBUTE_NAME,this._stateAttributeName(t)}}_stateAttributeName(t){switch(t){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:case u.SOLIDUS:case u.GREATER_THAN_SIGN:case u.EOF:{this._leaveAttrName(),this.state=A.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(t);break}case u.EQUALS_SIGN:{this._leaveAttrName(),this.state=A.BEFORE_ATTRIBUTE_VALUE;break}case u.QUOTATION_MARK:case u.APOSTROPHE:case u.LESS_THAN_SIGN:{this._err(T.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(t);break}case u.NULL:{this._err(T.unexpectedNullCharacter),this.currentAttr.name+=M;break}default:this.currentAttr.name+=String.fromCodePoint(bt(t)?dr(t):t)}}_stateAfterAttributeName(t){switch(t){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:break;case u.SOLIDUS:{this.state=A.SELF_CLOSING_START_TAG;break}case u.EQUALS_SIGN:{this.state=A.BEFORE_ATTRIBUTE_VALUE;break}case u.GREATER_THAN_SIGN:{this.state=A.DATA,this.emitCurrentTagToken();break}case u.EOF:{this._err(T.eofInTag),this._emitEOFToken();break}default:this._createAttr(""),this.state=A.ATTRIBUTE_NAME,this._stateAttributeName(t)}}_stateBeforeAttributeValue(t){switch(t){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:break;case u.QUOTATION_MARK:{this.state=A.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break}case u.APOSTROPHE:{this.state=A.ATTRIBUTE_VALUE_SINGLE_QUOTED;break}case u.GREATER_THAN_SIGN:{this._err(T.missingAttributeValue),this.state=A.DATA,this.emitCurrentTagToken();break}default:this.state=A.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(t)}}_stateAttributeValueDoubleQuoted(t){switch(t){case u.QUOTATION_MARK:{this.state=A.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case u.AMPERSAND:{this._startCharacterReference();break}case u.NULL:{this._err(T.unexpectedNullCharacter),this.currentAttr.value+=M;break}case u.EOF:{this._err(T.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAttributeValueSingleQuoted(t){switch(t){case u.APOSTROPHE:{this.state=A.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case u.AMPERSAND:{this._startCharacterReference();break}case u.NULL:{this._err(T.unexpectedNullCharacter),this.currentAttr.value+=M;break}case u.EOF:{this._err(T.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAttributeValueUnquoted(t){switch(t){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:{this._leaveAttrValue(),this.state=A.BEFORE_ATTRIBUTE_NAME;break}case u.AMPERSAND:{this._startCharacterReference();break}case u.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=A.DATA,this.emitCurrentTagToken();break}case u.NULL:{this._err(T.unexpectedNullCharacter),this.currentAttr.value+=M;break}case u.QUOTATION_MARK:case u.APOSTROPHE:case u.LESS_THAN_SIGN:case u.EQUALS_SIGN:case u.GRAVE_ACCENT:{this._err(T.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(t);break}case u.EOF:{this._err(T.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAfterAttributeValueQuoted(t){switch(t){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:{this._leaveAttrValue(),this.state=A.BEFORE_ATTRIBUTE_NAME;break}case u.SOLIDUS:{this._leaveAttrValue(),this.state=A.SELF_CLOSING_START_TAG;break}case u.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=A.DATA,this.emitCurrentTagToken();break}case u.EOF:{this._err(T.eofInTag),this._emitEOFToken();break}default:this._err(T.missingWhitespaceBetweenAttributes),this.state=A.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(t)}}_stateSelfClosingStartTag(t){switch(t){case u.GREATER_THAN_SIGN:{let r=this.currentToken;r.selfClosing=!0,this.state=A.DATA,this.emitCurrentTagToken();break}case u.EOF:{this._err(T.eofInTag),this._emitEOFToken();break}default:this._err(T.unexpectedSolidusInTag),this.state=A.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(t)}}_stateBogusComment(t){let r=this.currentToken;switch(t){case u.GREATER_THAN_SIGN:{this.state=A.DATA,this.emitCurrentComment(r);break}case u.EOF:{this.emitCurrentComment(r),this._emitEOFToken();break}case u.NULL:{this._err(T.unexpectedNullCharacter),r.data+=M;break}default:r.data+=String.fromCodePoint(t)}}_stateMarkupDeclarationOpen(t){this._consumeSequenceIfMatch(z.DASH_DASH,!0)?(this._createCommentToken(z.DASH_DASH.length+1),this.state=A.COMMENT_START):this._consumeSequenceIfMatch(z.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(z.DOCTYPE.length+1),this.state=A.DOCTYPE):this._consumeSequenceIfMatch(z.CDATA_START,!0)?this.inForeignNode?this.state=A.CDATA_SECTION:(this._err(T.cdataInHtmlContent),this._createCommentToken(z.CDATA_START.length+1),this.currentToken.data="[CDATA[",this.state=A.BOGUS_COMMENT):this._ensureHibernation()||(this._err(T.incorrectlyOpenedComment),this._createCommentToken(2),this.state=A.BOGUS_COMMENT,this._stateBogusComment(t))}_stateCommentStart(t){switch(t){case u.HYPHEN_MINUS:{this.state=A.COMMENT_START_DASH;break}case u.GREATER_THAN_SIGN:{this._err(T.abruptClosingOfEmptyComment),this.state=A.DATA;let r=this.currentToken;this.emitCurrentComment(r);break}default:this.state=A.COMMENT,this._stateComment(t)}}_stateCommentStartDash(t){let r=this.currentToken;switch(t){case u.HYPHEN_MINUS:{this.state=A.COMMENT_END;break}case u.GREATER_THAN_SIGN:{this._err(T.abruptClosingOfEmptyComment),this.state=A.DATA,this.emitCurrentComment(r);break}case u.EOF:{this._err(T.eofInComment),this.emitCurrentComment(r),this._emitEOFToken();break}default:r.data+="-",this.state=A.COMMENT,this._stateComment(t)}}_stateComment(t){let r=this.currentToken;switch(t){case u.HYPHEN_MINUS:{this.state=A.COMMENT_END_DASH;break}case u.LESS_THAN_SIGN:{r.data+="<",this.state=A.COMMENT_LESS_THAN_SIGN;break}case u.NULL:{this._err(T.unexpectedNullCharacter),r.data+=M;break}case u.EOF:{this._err(T.eofInComment),this.emitCurrentComment(r),this._emitEOFToken();break}default:r.data+=String.fromCodePoint(t)}}_stateCommentLessThanSign(t){let r=this.currentToken;switch(t){case u.EXCLAMATION_MARK:{r.data+="!",this.state=A.COMMENT_LESS_THAN_SIGN_BANG;break}case u.LESS_THAN_SIGN:{r.data+="<";break}default:this.state=A.COMMENT,this._stateComment(t)}}_stateCommentLessThanSignBang(t){t===u.HYPHEN_MINUS?this.state=A.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=A.COMMENT,this._stateComment(t))}_stateCommentLessThanSignBangDash(t){t===u.HYPHEN_MINUS?this.state=A.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=A.COMMENT_END_DASH,this._stateCommentEndDash(t))}_stateCommentLessThanSignBangDashDash(t){t!==u.GREATER_THAN_SIGN&&t!==u.EOF&&this._err(T.nestedComment),this.state=A.COMMENT_END,this._stateCommentEnd(t)}_stateCommentEndDash(t){let r=this.currentToken;switch(t){case u.HYPHEN_MINUS:{this.state=A.COMMENT_END;break}case u.EOF:{this._err(T.eofInComment),this.emitCurrentComment(r),this._emitEOFToken();break}default:r.data+="-",this.state=A.COMMENT,this._stateComment(t)}}_stateCommentEnd(t){let r=this.currentToken;switch(t){case u.GREATER_THAN_SIGN:{this.state=A.DATA,this.emitCurrentComment(r);break}case u.EXCLAMATION_MARK:{this.state=A.COMMENT_END_BANG;break}case u.HYPHEN_MINUS:{r.data+="-";break}case u.EOF:{this._err(T.eofInComment),this.emitCurrentComment(r),this._emitEOFToken();break}default:r.data+="--",this.state=A.COMMENT,this._stateComment(t)}}_stateCommentEndBang(t){let r=this.currentToken;switch(t){case u.HYPHEN_MINUS:{r.data+="--!",this.state=A.COMMENT_END_DASH;break}case u.GREATER_THAN_SIGN:{this._err(T.incorrectlyClosedComment),this.state=A.DATA,this.emitCurrentComment(r);break}case u.EOF:{this._err(T.eofInComment),this.emitCurrentComment(r),this._emitEOFToken();break}default:r.data+="--!",this.state=A.COMMENT,this._stateComment(t)}}_stateDoctype(t){switch(t){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:{this.state=A.BEFORE_DOCTYPE_NAME;break}case u.GREATER_THAN_SIGN:{this.state=A.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(t);break}case u.EOF:{this._err(T.eofInDoctype),this._createDoctypeToken(null);let r=this.currentToken;r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break}default:this._err(T.missingWhitespaceBeforeDoctypeName),this.state=A.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(t)}}_stateBeforeDoctypeName(t){if(bt(t))this._createDoctypeToken(String.fromCharCode(dr(t))),this.state=A.DOCTYPE_NAME;else switch(t){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:break;case u.NULL:{this._err(T.unexpectedNullCharacter),this._createDoctypeToken(M),this.state=A.DOCTYPE_NAME;break}case u.GREATER_THAN_SIGN:{this._err(T.missingDoctypeName),this._createDoctypeToken(null);let r=this.currentToken;r.forceQuirks=!0,this.emitCurrentDoctype(r),this.state=A.DATA;break}case u.EOF:{this._err(T.eofInDoctype),this._createDoctypeToken(null);let r=this.currentToken;r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(t)),this.state=A.DOCTYPE_NAME}}_stateDoctypeName(t){let r=this.currentToken;switch(t){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:{this.state=A.AFTER_DOCTYPE_NAME;break}case u.GREATER_THAN_SIGN:{this.state=A.DATA,this.emitCurrentDoctype(r);break}case u.NULL:{this._err(T.unexpectedNullCharacter),r.name+=M;break}case u.EOF:{this._err(T.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break}default:r.name+=String.fromCodePoint(bt(t)?dr(t):t)}}_stateAfterDoctypeName(t){let r=this.currentToken;switch(t){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:break;case u.GREATER_THAN_SIGN:{this.state=A.DATA,this.emitCurrentDoctype(r);break}case u.EOF:{this._err(T.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break}default:this._consumeSequenceIfMatch(z.PUBLIC,!1)?this.state=A.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(z.SYSTEM,!1)?this.state=A.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(T.invalidCharacterSequenceAfterDoctypeName),r.forceQuirks=!0,this.state=A.BOGUS_DOCTYPE,this._stateBogusDoctype(t))}}_stateAfterDoctypePublicKeyword(t){let r=this.currentToken;switch(t){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:{this.state=A.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break}case u.QUOTATION_MARK:{this._err(T.missingWhitespaceAfterDoctypePublicKeyword),r.publicId="",this.state=A.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case u.APOSTROPHE:{this._err(T.missingWhitespaceAfterDoctypePublicKeyword),r.publicId="",this.state=A.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case u.GREATER_THAN_SIGN:{this._err(T.missingDoctypePublicIdentifier),r.forceQuirks=!0,this.state=A.DATA,this.emitCurrentDoctype(r);break}case u.EOF:{this._err(T.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break}default:this._err(T.missingQuoteBeforeDoctypePublicIdentifier),r.forceQuirks=!0,this.state=A.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBeforeDoctypePublicIdentifier(t){let r=this.currentToken;switch(t){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:break;case u.QUOTATION_MARK:{r.publicId="",this.state=A.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case u.APOSTROPHE:{r.publicId="",this.state=A.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case u.GREATER_THAN_SIGN:{this._err(T.missingDoctypePublicIdentifier),r.forceQuirks=!0,this.state=A.DATA,this.emitCurrentDoctype(r);break}case u.EOF:{this._err(T.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break}default:this._err(T.missingQuoteBeforeDoctypePublicIdentifier),r.forceQuirks=!0,this.state=A.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateDoctypePublicIdentifierDoubleQuoted(t){let r=this.currentToken;switch(t){case u.QUOTATION_MARK:{this.state=A.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case u.NULL:{this._err(T.unexpectedNullCharacter),r.publicId+=M;break}case u.GREATER_THAN_SIGN:{this._err(T.abruptDoctypePublicIdentifier),r.forceQuirks=!0,this.emitCurrentDoctype(r),this.state=A.DATA;break}case u.EOF:{this._err(T.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break}default:r.publicId+=String.fromCodePoint(t)}}_stateDoctypePublicIdentifierSingleQuoted(t){let r=this.currentToken;switch(t){case u.APOSTROPHE:{this.state=A.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case u.NULL:{this._err(T.unexpectedNullCharacter),r.publicId+=M;break}case u.GREATER_THAN_SIGN:{this._err(T.abruptDoctypePublicIdentifier),r.forceQuirks=!0,this.emitCurrentDoctype(r),this.state=A.DATA;break}case u.EOF:{this._err(T.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break}default:r.publicId+=String.fromCodePoint(t)}}_stateAfterDoctypePublicIdentifier(t){let r=this.currentToken;switch(t){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:{this.state=A.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break}case u.GREATER_THAN_SIGN:{this.state=A.DATA,this.emitCurrentDoctype(r);break}case u.QUOTATION_MARK:{this._err(T.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),r.systemId="",this.state=A.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case u.APOSTROPHE:{this._err(T.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),r.systemId="",this.state=A.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case u.EOF:{this._err(T.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break}default:this._err(T.missingQuoteBeforeDoctypeSystemIdentifier),r.forceQuirks=!0,this.state=A.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBetweenDoctypePublicAndSystemIdentifiers(t){let r=this.currentToken;switch(t){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:break;case u.GREATER_THAN_SIGN:{this.emitCurrentDoctype(r),this.state=A.DATA;break}case u.QUOTATION_MARK:{r.systemId="",this.state=A.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case u.APOSTROPHE:{r.systemId="",this.state=A.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case u.EOF:{this._err(T.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break}default:this._err(T.missingQuoteBeforeDoctypeSystemIdentifier),r.forceQuirks=!0,this.state=A.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateAfterDoctypeSystemKeyword(t){let r=this.currentToken;switch(t){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:{this.state=A.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break}case u.QUOTATION_MARK:{this._err(T.missingWhitespaceAfterDoctypeSystemKeyword),r.systemId="",this.state=A.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case u.APOSTROPHE:{this._err(T.missingWhitespaceAfterDoctypeSystemKeyword),r.systemId="",this.state=A.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case u.GREATER_THAN_SIGN:{this._err(T.missingDoctypeSystemIdentifier),r.forceQuirks=!0,this.state=A.DATA,this.emitCurrentDoctype(r);break}case u.EOF:{this._err(T.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break}default:this._err(T.missingQuoteBeforeDoctypeSystemIdentifier),r.forceQuirks=!0,this.state=A.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBeforeDoctypeSystemIdentifier(t){let r=this.currentToken;switch(t){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:break;case u.QUOTATION_MARK:{r.systemId="",this.state=A.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case u.APOSTROPHE:{r.systemId="",this.state=A.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case u.GREATER_THAN_SIGN:{this._err(T.missingDoctypeSystemIdentifier),r.forceQuirks=!0,this.state=A.DATA,this.emitCurrentDoctype(r);break}case u.EOF:{this._err(T.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break}default:this._err(T.missingQuoteBeforeDoctypeSystemIdentifier),r.forceQuirks=!0,this.state=A.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateDoctypeSystemIdentifierDoubleQuoted(t){let r=this.currentToken;switch(t){case u.QUOTATION_MARK:{this.state=A.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case u.NULL:{this._err(T.unexpectedNullCharacter),r.systemId+=M;break}case u.GREATER_THAN_SIGN:{this._err(T.abruptDoctypeSystemIdentifier),r.forceQuirks=!0,this.emitCurrentDoctype(r),this.state=A.DATA;break}case u.EOF:{this._err(T.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break}default:r.systemId+=String.fromCodePoint(t)}}_stateDoctypeSystemIdentifierSingleQuoted(t){let r=this.currentToken;switch(t){case u.APOSTROPHE:{this.state=A.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case u.NULL:{this._err(T.unexpectedNullCharacter),r.systemId+=M;break}case u.GREATER_THAN_SIGN:{this._err(T.abruptDoctypeSystemIdentifier),r.forceQuirks=!0,this.emitCurrentDoctype(r),this.state=A.DATA;break}case u.EOF:{this._err(T.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break}default:r.systemId+=String.fromCodePoint(t)}}_stateAfterDoctypeSystemIdentifier(t){let r=this.currentToken;switch(t){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:break;case u.GREATER_THAN_SIGN:{this.emitCurrentDoctype(r),this.state=A.DATA;break}case u.EOF:{this._err(T.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break}default:this._err(T.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=A.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBogusDoctype(t){let r=this.currentToken;switch(t){case u.GREATER_THAN_SIGN:{this.emitCurrentDoctype(r),this.state=A.DATA;break}case u.NULL:{this._err(T.unexpectedNullCharacter);break}case u.EOF:{this.emitCurrentDoctype(r),this._emitEOFToken();break}default:}}_stateCdataSection(t){switch(t){case u.RIGHT_SQUARE_BRACKET:{this.state=A.CDATA_SECTION_BRACKET;break}case u.EOF:{this._err(T.eofInCdata),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateCdataSectionBracket(t){t===u.RIGHT_SQUARE_BRACKET?this.state=A.CDATA_SECTION_END:(this._emitChars("]"),this.state=A.CDATA_SECTION,this._stateCdataSection(t))}_stateCdataSectionEnd(t){switch(t){case u.GREATER_THAN_SIGN:{this.state=A.DATA;break}case u.RIGHT_SQUARE_BRACKET:{this._emitChars("]");break}default:this._emitChars("]]"),this.state=A.CDATA_SECTION,this._stateCdataSection(t)}}_stateCharacterReference(){let t=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(t<0)if(this.preprocessor.lastChunkWritten)t=this.entityDecoder.end();else{this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,this.preprocessor.endOfChunkHit=!0;return}t===0?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(u.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&Ws(this.preprocessor.peek(1))?A.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(t){Ws(t)?this._flushCodePointConsumedAsCharacterReference(t):(t===u.SEMICOLON&&this._err(T.unknownNamedCharacterReference),this.state=this.returnState,this._callState(t))}};var Xs=new Set([i.DD,i.DT,i.LI,i.OPTGROUP,i.OPTION,i.P,i.RB,i.RP,i.RT,i.RTC]),js=new Set([...Xs,i.CAPTION,i.COLGROUP,i.TBODY,i.TD,i.TFOOT,i.TH,i.THEAD,i.TR]),ur=new Set([i.APPLET,i.CAPTION,i.HTML,i.MARQUEE,i.OBJECT,i.TABLE,i.TD,i.TEMPLATE,i.TH]),Zc=new Set([...ur,i.OL,i.UL]),zc=new Set([...ur,i.BUTTON]),Vs=new Set([i.ANNOTATION_XML,i.MI,i.MN,i.MO,i.MS,i.MTEXT]),$s=new Set([i.DESC,i.FOREIGN_OBJECT,i.TITLE]),qc=new Set([i.TR,i.TEMPLATE,i.HTML]),el=new Set([i.TBODY,i.TFOOT,i.THEAD,i.TEMPLATE,i.HTML]),tl=new Set([i.TABLE,i.TEMPLATE,i.HTML]),rl=new Set([i.TD,i.TH]),Ar=class{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(t,r,n){this.treeAdapter=r,this.handler=n,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=i.UNKNOWN,this.current=t}_indexOf(t){return this.items.lastIndexOf(t,this.stackTop)}_isInTemplate(){return this.currentTagId===i.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===b.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(t,r){this.stackTop++,this.items[this.stackTop]=t,this.current=t,this.tagIDs[this.stackTop]=r,this.currentTagId=r,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(t,r,!0)}pop(){let t=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!0)}replace(t,r){let n=this._indexOf(t);this.items[n]=r,n===this.stackTop&&(this.current=r)}insertAfter(t,r,n){let s=this._indexOf(t)+1;this.items.splice(s,0,r),this.tagIDs.splice(s,0,n),this.stackTop++,s===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,s===this.stackTop)}popUntilTagNamePopped(t){let r=this.stackTop+1;do r=this.tagIDs.lastIndexOf(t,r-1);while(r>0&&this.treeAdapter.getNamespaceURI(this.items[r])!==b.HTML);this.shortenToLength(Math.max(r,0))}shortenToLength(t){for(;this.stackTop>=t;){let r=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(r,this.stackTop<t)}}popUntilElementPopped(t){let r=this._indexOf(t);this.shortenToLength(Math.max(r,0))}popUntilPopped(t,r){let n=this._indexOfTagNames(t,r);this.shortenToLength(Math.max(n,0))}popUntilNumberedHeaderPopped(){this.popUntilPopped(Tt,b.HTML)}popUntilTableCellPopped(){this.popUntilPopped(rl,b.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(t,r){for(let n=this.stackTop;n>=0;n--)if(t.has(this.tagIDs[n])&&this.treeAdapter.getNamespaceURI(this.items[n])===r)return n;return-1}clearBackTo(t,r){let n=this._indexOfTagNames(t,r);this.shortenToLength(n+1)}clearBackToTableContext(){this.clearBackTo(tl,b.HTML)}clearBackToTableBodyContext(){this.clearBackTo(el,b.HTML)}clearBackToTableRowContext(){this.clearBackTo(qc,b.HTML)}remove(t){let r=this._indexOf(t);r>=0&&(r===this.stackTop?this.pop():(this.items.splice(r,1),this.tagIDs.splice(r,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===i.BODY?this.items[1]:null}contains(t){return this._indexOf(t)>-1}getCommonAncestor(t){let r=this._indexOf(t)-1;return r>=0?this.items[r]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===i.HTML}hasInDynamicScope(t,r){for(let n=this.stackTop;n>=0;n--){let s=this.tagIDs[n];switch(this.treeAdapter.getNamespaceURI(this.items[n])){case b.HTML:{if(s===t)return!0;if(r.has(s))return!1;break}case b.SVG:{if($s.has(s))return!1;break}case b.MATHML:{if(Vs.has(s))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,ur)}hasInListItemScope(t){return this.hasInDynamicScope(t,Zc)}hasInButtonScope(t){return this.hasInDynamicScope(t,zc)}hasNumberedHeaderInScope(){for(let t=this.stackTop;t>=0;t--){let r=this.tagIDs[t];switch(this.treeAdapter.getNamespaceURI(this.items[t])){case b.HTML:{if(Tt.has(r))return!0;if(ur.has(r))return!1;break}case b.SVG:{if($s.has(r))return!1;break}case b.MATHML:{if(Vs.has(r))return!1;break}}}return!0}hasInTableScope(t){for(let r=this.stackTop;r>=0;r--)if(this.treeAdapter.getNamespaceURI(this.items[r])===b.HTML)switch(this.tagIDs[r]){case t:return!0;case i.TABLE:case i.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===b.HTML)switch(this.tagIDs[t]){case i.TBODY:case i.THEAD:case i.TFOOT:return!0;case i.TABLE:case i.HTML:return!1}return!0}hasInSelectScope(t){for(let r=this.stackTop;r>=0;r--)if(this.treeAdapter.getNamespaceURI(this.items[r])===b.HTML)switch(this.tagIDs[r]){case t:return!0;case i.OPTION:case i.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&Xs.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&js.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==void 0&&this.currentTagId!==t&&js.has(this.currentTagId);)this.pop()}};var Ae;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})(Ae||(Ae={}));var Zs={type:Ae.Marker},pr=class{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,r){let n=[],s=r.length,a=this.treeAdapter.getTagName(t),c=this.treeAdapter.getNamespaceURI(t);for(let l=0;l<this.entries.length;l++){let o=this.entries[l];if(o.type===Ae.Marker)break;let{element:d}=o;if(this.treeAdapter.getTagName(d)===a&&this.treeAdapter.getNamespaceURI(d)===c){let p=this.treeAdapter.getAttrList(d);p.length===s&&n.push({idx:l,attrs:p})}}return n}_ensureNoahArkCondition(t){if(this.entries.length<3)return;let r=this.treeAdapter.getAttrList(t),n=this._getNoahArkConditionCandidates(t,r);if(n.length<3)return;let s=new Map(r.map(c=>[c.name,c.value])),a=0;for(let c=0;c<n.length;c++){let l=n[c];l.attrs.every(o=>s.get(o.name)===o.value)&&(a+=1,a>=3&&this.entries.splice(l.idx,1))}}insertMarker(){this.entries.unshift(Zs)}pushElement(t,r){this._ensureNoahArkCondition(t),this.entries.unshift({type:Ae.Element,element:t,token:r})}insertElementAfterBookmark(t,r){let n=this.entries.indexOf(this.bookmark);this.entries.splice(n,0,{type:Ae.Element,element:t,token:r})}removeEntry(t){let r=this.entries.indexOf(t);r!==-1&&this.entries.splice(r,1)}clearToLastMarker(){let t=this.entries.indexOf(Zs);t===-1?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){let r=this.entries.find(n=>n.type===Ae.Marker||this.treeAdapter.getTagName(n.element)===t);return r&&r.type===Ae.Element?r:null}getElementEntry(t){return this.entries.find(r=>r.type===Ae.Element&&r.element===t)}};var pe={createDocument(){return{nodeName:"#document",mode:q.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:"#document-fragment",childNodes:[]}},createElement(e,t,r){return{nodeName:e,tagName:e,attrs:r,namespaceURI:t,childNodes:[],parentNode:null}},createCommentNode(e){return{nodeName:"#comment",data:e,parentNode:null}},createTextNode(e){return{nodeName:"#text",value:e,parentNode:null}},appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,r){let n=e.childNodes.indexOf(r);e.childNodes.splice(n,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,r,n){let s=e.childNodes.find(a=>a.nodeName==="#documentType");if(s)s.name=t,s.publicId=r,s.systemId=n;else{let a={nodeName:"#documentType",name:t,publicId:r,systemId:n,parentNode:null};pe.appendChild(e,a)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){let t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){let r=e.childNodes[e.childNodes.length-1];if(pe.isTextNode(r)){r.value+=t;return}}pe.appendChild(e,pe.createTextNode(t))},insertTextBefore(e,t,r){let n=e.childNodes[e.childNodes.indexOf(r)-1];n&&pe.isTextNode(n)?n.value+=t:pe.insertBefore(e,pe.createTextNode(t),r)},adoptAttributes(e,t){let r=new Set(e.attrs.map(n=>n.name));for(let n=0;n<t.length;n++)r.has(t[n].name)||e.attrs.push(t[n])},getFirstChild(e){return e.childNodes[0]},getChildNodes(e){return e.childNodes},getParentNode(e){return e.parentNode},getAttrList(e){return e.attrs},getTagName(e){return e.tagName},getNamespaceURI(e){return e.namespaceURI},getTextNodeContent(e){return e.value},getCommentNodeContent(e){return e.data},getDocumentTypeNodeName(e){return e.name},getDocumentTypeNodePublicId(e){return e.publicId},getDocumentTypeNodeSystemId(e){return e.systemId},isTextNode(e){return e.nodeName==="#text"},isCommentNode(e){return e.nodeName==="#comment"},isDocumentTypeNode(e){return e.nodeName==="#documentType"},isElementNode(e){return Object.prototype.hasOwnProperty.call(e,"tagName")},setNodeSourceCodeLocation(e,t){e.sourceCodeLocation=t},getNodeSourceCodeLocation(e){return e.sourceCodeLocation},updateNodeSourceCodeLocation(e,t){e.sourceCodeLocation={...e.sourceCodeLocation,...t}}};var qs="html",nl="about:legacy-compat",sl="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd",ei=["+//silmaril//dtd html pro v0r11 19970101//","-//as//dtd html 3.0 aswedit + extensions//","-//advasoft ltd//dtd html 3.0 aswedit + extensions//","-//ietf//dtd html 2.0 level 1//","-//ietf//dtd html 2.0 level 2//","-//ietf//dtd html 2.0 strict level 1//","-//ietf//dtd html 2.0 strict level 2//","-//ietf//dtd html 2.0 strict//","-//ietf//dtd html 2.0//","-//ietf//dtd html 2.1e//","-//ietf//dtd html 3.0//","-//ietf//dtd html 3.2 final//","-//ietf//dtd html 3.2//","-//ietf//dtd html 3//","-//ietf//dtd html level 0//","-//ietf//dtd html level 1//","-//ietf//dtd html level 2//","-//ietf//dtd html level 3//","-//ietf//dtd html strict level 0//","-//ietf//dtd html strict level 1//","-//ietf//dtd html strict level 2//","-//ietf//dtd html strict level 3//","-//ietf//dtd html strict//","-//ietf//dtd html//","-//metrius//dtd metrius presentational//","-//microsoft//dtd internet explorer 2.0 html strict//","-//microsoft//dtd internet explorer 2.0 html//","-//microsoft//dtd internet explorer 2.0 tables//","-//microsoft//dtd internet explorer 3.0 html strict//","-//microsoft//dtd internet explorer 3.0 html//","-//microsoft//dtd internet explorer 3.0 tables//","-//netscape comm. corp.//dtd html//","-//netscape comm. corp.//dtd strict html//","-//o'reilly and associates//dtd html 2.0//","-//o'reilly and associates//dtd html extended 1.0//","-//o'reilly and associates//dtd html extended relaxed 1.0//","-//sq//dtd html 2.0 hotmetal + extensions//","-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//","-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//","-//spyglass//dtd html 2.0 extended//","-//sun microsystems corp.//dtd hotjava html//","-//sun microsystems corp.//dtd hotjava strict html//","-//w3c//dtd html 3 1995-03-24//","-//w3c//dtd html 3.2 draft//","-//w3c//dtd html 3.2 final//","-//w3c//dtd html 3.2//","-//w3c//dtd html 3.2s draft//","-//w3c//dtd html 4.0 frameset//","-//w3c//dtd html 4.0 transitional//","-//w3c//dtd html experimental 19960712//","-//w3c//dtd html experimental 970421//","-//w3c//dtd w3 html//","-//w3o//dtd w3 html 3.0//","-//webtechs//dtd mozilla html 2.0//","-//webtechs//dtd mozilla html//"],il=[...ei,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"],al=new Set(["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"]),ti=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],ol=[...ti,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"];function zs(e,t){return t.some(r=>e.startsWith(r))}function ri(e){return e.name===qs&&e.publicId===null&&(e.systemId===null||e.systemId===nl)}function ni(e){if(e.name!==qs)return q.QUIRKS;let{systemId:t}=e;if(t&&t.toLowerCase()===sl)return q.QUIRKS;let{publicId:r}=e;if(r!==null){if(r=r.toLowerCase(),al.has(r))return q.QUIRKS;let n=t===null?il:ei;if(zs(r,n))return q.QUIRKS;if(n=t===null?ti:ol,zs(r,n))return q.LIMITED_QUIRKS}return q.NO_QUIRKS}var si={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},ll="definitionurl",dl="definitionURL",ul=new Map(["attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(e=>[e.toLowerCase(),e])),Al=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:b.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:b.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:b.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:b.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:b.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:b.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:b.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:b.XML}],["xml:space",{prefix:"xml",name:"space",namespace:b.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:b.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:b.XMLNS}]]),pl=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(e=>[e.toLowerCase(),e])),hl=new Set([i.B,i.BIG,i.BLOCKQUOTE,i.BODY,i.BR,i.CENTER,i.CODE,i.DD,i.DIV,i.DL,i.DT,i.EM,i.EMBED,i.H1,i.H2,i.H3,i.H4,i.H5,i.H6,i.HEAD,i.HR,i.I,i.IMG,i.LI,i.LISTING,i.MENU,i.META,i.NOBR,i.OL,i.P,i.PRE,i.RUBY,i.S,i.SMALL,i.SPAN,i.STRONG,i.STRIKE,i.SUB,i.SUP,i.TABLE,i.TT,i.U,i.UL,i.VAR]);function ii(e){let t=e.tagID;return t===i.FONT&&e.attrs.some(({name:n})=>n===be.COLOR||n===be.SIZE||n===be.FACE)||hl.has(t)}function fn(e){for(let t=0;t<e.attrs.length;t++)if(e.attrs[t].name===ll){e.attrs[t].name=dl;break}}function En(e){for(let t=0;t<e.attrs.length;t++){let r=ul.get(e.attrs[t].name);r!=null&&(e.attrs[t].name=r)}}function hr(e){for(let t=0;t<e.attrs.length;t++){let r=Al.get(e.attrs[t].name);r&&(e.attrs[t].prefix=r.prefix,e.attrs[t].name=r.name,e.attrs[t].namespace=r.namespace)}}function ai(e){let t=pl.get(e.tagName);t!=null&&(e.tagName=t,e.tagID=Pe(e.tagName))}function gl(e,t){return t===b.MATHML&&(e===i.MI||e===i.MO||e===i.MN||e===i.MS||e===i.MTEXT)}function ml(e,t,r){if(t===b.MATHML&&e===i.ANNOTATION_XML){for(let n=0;n<r.length;n++)if(r[n].name===be.ENCODING){let s=r[n].value.toLowerCase();return s===si.TEXT_HTML||s===si.APPLICATION_XML}}return t===b.SVG&&(e===i.FOREIGN_OBJECT||e===i.DESC||e===i.TITLE)}function oi(e,t,r,n){return(!n||n===b.HTML)&&ml(e,t,r)||(!n||n===b.MATHML)&&gl(e,t)}var fl="hidden",El=8,Tl=3,g;(function(e){e[e.INITIAL=0]="INITIAL",e[e.BEFORE_HTML=1]="BEFORE_HTML",e[e.BEFORE_HEAD=2]="BEFORE_HEAD",e[e.IN_HEAD=3]="IN_HEAD",e[e.IN_HEAD_NO_SCRIPT=4]="IN_HEAD_NO_SCRIPT",e[e.AFTER_HEAD=5]="AFTER_HEAD",e[e.IN_BODY=6]="IN_BODY",e[e.TEXT=7]="TEXT",e[e.IN_TABLE=8]="IN_TABLE",e[e.IN_TABLE_TEXT=9]="IN_TABLE_TEXT",e[e.IN_CAPTION=10]="IN_CAPTION",e[e.IN_COLUMN_GROUP=11]="IN_COLUMN_GROUP",e[e.IN_TABLE_BODY=12]="IN_TABLE_BODY",e[e.IN_ROW=13]="IN_ROW",e[e.IN_CELL=14]="IN_CELL",e[e.IN_SELECT=15]="IN_SELECT",e[e.IN_SELECT_IN_TABLE=16]="IN_SELECT_IN_TABLE",e[e.IN_TEMPLATE=17]="IN_TEMPLATE",e[e.AFTER_BODY=18]="AFTER_BODY",e[e.IN_FRAMESET=19]="IN_FRAMESET",e[e.AFTER_FRAMESET=20]="AFTER_FRAMESET",e[e.AFTER_AFTER_BODY=21]="AFTER_AFTER_BODY",e[e.AFTER_AFTER_FRAMESET=22]="AFTER_AFTER_FRAMESET"})(g||(g={}));var bl={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},Ai=new Set([i.TABLE,i.TBODY,i.TFOOT,i.THEAD,i.TR]),li={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:pe,onParseError:null},Rt=class{constructor(t,r,n=null,s=null){this.fragmentContext=n,this.scriptHandler=s,this.currentToken=null,this.stopped=!1,this.insertionMode=g.INITIAL,this.originalInsertionMode=g.INITIAL,this.headElement=null,this.formElement=null,this.currentNotInHTML=!1,this.tmplInsertionModeStack=[],this.pendingCharacterTokens=[],this.hasNonWhitespacePendingCharacterToken=!1,this.framesetOk=!0,this.skipNextNewLine=!1,this.fosterParentingEnabled=!1,this.options={...li,...t},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=r??this.treeAdapter.createDocument(),this.tokenizer=new Ct(this.options,this),this.activeFormattingElements=new pr(this.treeAdapter),this.fragmentContextID=n?Pe(this.treeAdapter.getTagName(n)):i.UNKNOWN,this._setContextModes(n??this.document,this.fragmentContextID),this.openElements=new Ar(this.document,this.treeAdapter,this)}static parse(t,r){let n=new this(r);return n.tokenizer.write(t,!0),n.document}static getFragmentParser(t,r){let n={...li,...r};t??(t=n.treeAdapter.createElement(E.TEMPLATE,b.HTML,[]));let s=n.treeAdapter.createElement("documentmock",b.HTML,[]),a=new this(n,s,t);return a.fragmentContextID===i.TEMPLATE&&a.tmplInsertionModeStack.unshift(g.IN_TEMPLATE),a._initTokenizerForFragmentParsing(),a._insertFakeRootElement(),a._resetInsertionMode(),a._findFormInFragmentContext(),a}getFragment(){let t=this.treeAdapter.getFirstChild(this.document),r=this.treeAdapter.createDocumentFragment();return this._adoptNodes(t,r),r}_err(t,r,n){var s;if(!this.onParseError)return;let a=(s=t.location)!==null&&s!==void 0?s:bl,c={code:r,startLine:a.startLine,startCol:a.startCol,startOffset:a.startOffset,endLine:n?a.startLine:a.endLine,endCol:n?a.startCol:a.endCol,endOffset:n?a.startOffset:a.endOffset};this.onParseError(c)}onItemPush(t,r,n){var s,a;(a=(s=this.treeAdapter).onItemPush)===null||a===void 0||a.call(s,t),n&&this.openElements.stackTop>0&&this._setContextModes(t,r)}onItemPop(t,r){var n,s;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(t,this.currentToken),(s=(n=this.treeAdapter).onItemPop)===null||s===void 0||s.call(n,t,this.openElements.current),r){let a,c;this.openElements.stackTop===0&&this.fragmentContext?(a=this.fragmentContext,c=this.fragmentContextID):{current:a,currentTagId:c}=this.openElements,this._setContextModes(a,c)}}_setContextModes(t,r){let n=t===this.document||t&&this.treeAdapter.getNamespaceURI(t)===b.HTML;this.currentNotInHTML=!n,this.tokenizer.inForeignNode=!n&&t!==void 0&&r!==void 0&&!this._isIntegrationPoint(r,t)}_switchToTextParsing(t,r){this._insertElement(t,b.HTML),this.tokenizer.state=r,this.originalInsertionMode=this.insertionMode,this.insertionMode=g.TEXT}switchToPlaintextParsing(){this.insertionMode=g.TEXT,this.originalInsertionMode=g.IN_BODY,this.tokenizer.state=j.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let t=this.fragmentContext;for(;t;){if(this.treeAdapter.getTagName(t)===E.FORM){this.formElement=t;break}t=this.treeAdapter.getParentNode(t)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==b.HTML))switch(this.fragmentContextID){case i.TITLE:case i.TEXTAREA:{this.tokenizer.state=j.RCDATA;break}case i.STYLE:case i.XMP:case i.IFRAME:case i.NOEMBED:case i.NOFRAMES:case i.NOSCRIPT:{this.tokenizer.state=j.RAWTEXT;break}case i.SCRIPT:{this.tokenizer.state=j.SCRIPT_DATA;break}case i.PLAINTEXT:{this.tokenizer.state=j.PLAINTEXT;break}default:}}_setDocumentType(t){let r=t.name||"",n=t.publicId||"",s=t.systemId||"";if(this.treeAdapter.setDocumentType(this.document,r,n,s),t.location){let c=this.treeAdapter.getChildNodes(this.document).find(l=>this.treeAdapter.isDocumentTypeNode(l));c&&this.treeAdapter.setNodeSourceCodeLocation(c,t.location)}}_attachElementToTree(t,r){if(this.options.sourceCodeLocationInfo){let n=r&&{...r,startTag:r};this.treeAdapter.setNodeSourceCodeLocation(t,n)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(t);else{let n=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(n??this.document,t)}}_appendElement(t,r){let n=this.treeAdapter.createElement(t.tagName,r,t.attrs);this._attachElementToTree(n,t.location)}_insertElement(t,r){let n=this.treeAdapter.createElement(t.tagName,r,t.attrs);this._attachElementToTree(n,t.location),this.openElements.push(n,t.tagID)}_insertFakeElement(t,r){let n=this.treeAdapter.createElement(t,b.HTML,[]);this._attachElementToTree(n,null),this.openElements.push(n,r)}_insertTemplate(t){let r=this.treeAdapter.createElement(t.tagName,b.HTML,t.attrs),n=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(r,n),this._attachElementToTree(r,t.location),this.openElements.push(r,t.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,null)}_insertFakeRootElement(){let t=this.treeAdapter.createElement(E.HTML,b.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,i.HTML)}_appendCommentNode(t,r){let n=this.treeAdapter.createCommentNode(t.data);this.treeAdapter.appendChild(r,n),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,t.location)}_insertCharacters(t){let r,n;if(this._shouldFosterParentOnInsertion()?({parent:r,beforeElement:n}=this._findFosterParentingLocation(),n?this.treeAdapter.insertTextBefore(r,t.chars,n):this.treeAdapter.insertText(r,t.chars)):(r=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(r,t.chars)),!t.location)return;let s=this.treeAdapter.getChildNodes(r),a=n?s.lastIndexOf(n):s.length,c=s[a-1];if(this.treeAdapter.getNodeSourceCodeLocation(c)){let{endLine:o,endCol:d,endOffset:p}=t.location;this.treeAdapter.updateNodeSourceCodeLocation(c,{endLine:o,endCol:d,endOffset:p})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(c,t.location)}_adoptNodes(t,r){for(let n=this.treeAdapter.getFirstChild(t);n;n=this.treeAdapter.getFirstChild(t))this.treeAdapter.detachNode(n),this.treeAdapter.appendChild(r,n)}_setEndLocation(t,r){if(this.treeAdapter.getNodeSourceCodeLocation(t)&&r.location){let n=r.location,s=this.treeAdapter.getTagName(t),a=r.type===v.END_TAG&&s===r.tagName?{endTag:{...n},endLine:n.endLine,endCol:n.endCol,endOffset:n.endOffset}:{endLine:n.startLine,endCol:n.startCol,endOffset:n.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(t,a)}}shouldProcessStartTagTokenInForeignContent(t){if(!this.currentNotInHTML)return!1;let r,n;return this.openElements.stackTop===0&&this.fragmentContext?(r=this.fragmentContext,n=this.fragmentContextID):{current:r,currentTagId:n}=this.openElements,t.tagID===i.SVG&&this.treeAdapter.getTagName(r)===E.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(r)===b.MATHML?!1:this.tokenizer.inForeignNode||(t.tagID===i.MGLYPH||t.tagID===i.MALIGNMARK)&&n!==void 0&&!this._isIntegrationPoint(n,r,b.HTML)}_processToken(t){switch(t.type){case v.CHARACTER:{this.onCharacter(t);break}case v.NULL_CHARACTER:{this.onNullCharacter(t);break}case v.COMMENT:{this.onComment(t);break}case v.DOCTYPE:{this.onDoctype(t);break}case v.START_TAG:{this._processStartTag(t);break}case v.END_TAG:{this.onEndTag(t);break}case v.EOF:{this.onEof(t);break}case v.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(t);break}}}_isIntegrationPoint(t,r,n){let s=this.treeAdapter.getNamespaceURI(r),a=this.treeAdapter.getAttrList(r);return oi(t,s,a,n)}_reconstructActiveFormattingElements(){let t=this.activeFormattingElements.entries.length;if(t){let r=this.activeFormattingElements.entries.findIndex(s=>s.type===Ae.Marker||this.openElements.contains(s.element)),n=r===-1?t-1:r-1;for(let s=n;s>=0;s--){let a=this.activeFormattingElements.entries[s];this._insertElement(a.token,this.treeAdapter.getNamespaceURI(a.element)),a.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=g.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(i.P),this.openElements.popUntilTagNamePopped(i.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(t===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case i.TR:{this.insertionMode=g.IN_ROW;return}case i.TBODY:case i.THEAD:case i.TFOOT:{this.insertionMode=g.IN_TABLE_BODY;return}case i.CAPTION:{this.insertionMode=g.IN_CAPTION;return}case i.COLGROUP:{this.insertionMode=g.IN_COLUMN_GROUP;return}case i.TABLE:{this.insertionMode=g.IN_TABLE;return}case i.BODY:{this.insertionMode=g.IN_BODY;return}case i.FRAMESET:{this.insertionMode=g.IN_FRAMESET;return}case i.SELECT:{this._resetInsertionModeForSelect(t);return}case i.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case i.HTML:{this.insertionMode=this.headElement?g.AFTER_HEAD:g.BEFORE_HEAD;return}case i.TD:case i.TH:{if(t>0){this.insertionMode=g.IN_CELL;return}break}case i.HEAD:{if(t>0){this.insertionMode=g.IN_HEAD;return}break}}this.insertionMode=g.IN_BODY}_resetInsertionModeForSelect(t){if(t>0)for(let r=t-1;r>0;r--){let n=this.openElements.tagIDs[r];if(n===i.TEMPLATE)break;if(n===i.TABLE){this.insertionMode=g.IN_SELECT_IN_TABLE;return}}this.insertionMode=g.IN_SELECT}_isElementCausesFosterParenting(t){return Ai.has(t)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let t=this.openElements.stackTop;t>=0;t--){let r=this.openElements.items[t];switch(this.openElements.tagIDs[t]){case i.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(r)===b.HTML)return{parent:this.treeAdapter.getTemplateContent(r),beforeElement:null};break}case i.TABLE:{let n=this.treeAdapter.getParentNode(r);return n?{parent:n,beforeElement:r}:{parent:this.openElements.items[t-1],beforeElement:null}}default:}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(t){let r=this._findFosterParentingLocation();r.beforeElement?this.treeAdapter.insertBefore(r.parent,t,r.beforeElement):this.treeAdapter.appendChild(r.parent,t)}_isSpecialElement(t,r){let n=this.treeAdapter.getNamespaceURI(t);return Gs[n].has(r)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){Xd(this,t);return}switch(this.insertionMode){case g.INITIAL:{It(this,t);break}case g.BEFORE_HTML:{wt(this,t);break}case g.BEFORE_HEAD:{xt(this,t);break}case g.IN_HEAD:{St(this,t);break}case g.IN_HEAD_NO_SCRIPT:{Nt(this,t);break}case g.AFTER_HEAD:{_t(this,t);break}case g.IN_BODY:case g.IN_CAPTION:case g.IN_CELL:case g.IN_TEMPLATE:{hi(this,t);break}case g.TEXT:case g.IN_SELECT:case g.IN_SELECT_IN_TABLE:{this._insertCharacters(t);break}case g.IN_TABLE:case g.IN_TABLE_BODY:case g.IN_ROW:{Tn(this,t);break}case g.IN_TABLE_TEXT:{bi(this,t);break}case g.IN_COLUMN_GROUP:{mr(this,t);break}case g.AFTER_BODY:{fr(this,t);break}case g.AFTER_AFTER_BODY:{gr(this,t);break}default:}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){$d(this,t);return}switch(this.insertionMode){case g.INITIAL:{It(this,t);break}case g.BEFORE_HTML:{wt(this,t);break}case g.BEFORE_HEAD:{xt(this,t);break}case g.IN_HEAD:{St(this,t);break}case g.IN_HEAD_NO_SCRIPT:{Nt(this,t);break}case g.AFTER_HEAD:{_t(this,t);break}case g.TEXT:{this._insertCharacters(t);break}case g.IN_TABLE:case g.IN_TABLE_BODY:case g.IN_ROW:{Tn(this,t);break}case g.IN_COLUMN_GROUP:{mr(this,t);break}case g.AFTER_BODY:{fr(this,t);break}case g.AFTER_AFTER_BODY:{gr(this,t);break}default:}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){bn(this,t);return}switch(this.insertionMode){case g.INITIAL:case g.BEFORE_HTML:case g.BEFORE_HEAD:case g.IN_HEAD:case g.IN_HEAD_NO_SCRIPT:case g.AFTER_HEAD:case g.IN_BODY:case g.IN_TABLE:case g.IN_CAPTION:case g.IN_COLUMN_GROUP:case g.IN_TABLE_BODY:case g.IN_ROW:case g.IN_CELL:case g.IN_SELECT:case g.IN_SELECT_IN_TABLE:case g.IN_TEMPLATE:case g.IN_FRAMESET:case g.AFTER_FRAMESET:{bn(this,t);break}case g.IN_TABLE_TEXT:{yt(this,t);break}case g.AFTER_BODY:{Nl(this,t);break}case g.AFTER_AFTER_BODY:case g.AFTER_AFTER_FRAMESET:{_l(this,t);break}default:}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case g.INITIAL:{Rl(this,t);break}case g.BEFORE_HEAD:case g.IN_HEAD:case g.IN_HEAD_NO_SCRIPT:case g.AFTER_HEAD:{this._err(t,T.misplacedDoctype);break}case g.IN_TABLE_TEXT:{yt(this,t);break}default:}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,T.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?Zd(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case g.INITIAL:{It(this,t);break}case g.BEFORE_HTML:{Ll(this,t);break}case g.BEFORE_HEAD:{vl(this,t);break}case g.IN_HEAD:{he(this,t);break}case g.IN_HEAD_NO_SCRIPT:{Bl(this,t);break}case g.AFTER_HEAD:{Ml(this,t);break}case g.IN_BODY:{V(this,t);break}case g.IN_TABLE:{qe(this,t);break}case g.IN_TABLE_TEXT:{yt(this,t);break}case g.IN_CAPTION:{Dd(this,t);break}case g.IN_COLUMN_GROUP:{wn(this,t);break}case g.IN_TABLE_BODY:{br(this,t);break}case g.IN_ROW:{Cr(this,t);break}case g.IN_CELL:{Pd(this,t);break}case g.IN_SELECT:{yi(this,t);break}case g.IN_SELECT_IN_TABLE:{Ud(this,t);break}case g.IN_TEMPLATE:{Hd(this,t);break}case g.AFTER_BODY:{Yd(this,t);break}case g.IN_FRAMESET:{Gd(this,t);break}case g.AFTER_FRAMESET:{Kd(this,t);break}case g.AFTER_AFTER_BODY:{jd(this,t);break}case g.AFTER_AFTER_FRAMESET:{Vd(this,t);break}default:}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?zd(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case g.INITIAL:{It(this,t);break}case g.BEFORE_HTML:{Ol(this,t);break}case g.BEFORE_HEAD:{Dl(this,t);break}case g.IN_HEAD:{kl(this,t);break}case g.IN_HEAD_NO_SCRIPT:{Pl(this,t);break}case g.AFTER_HEAD:{Ul(this,t);break}case g.IN_BODY:{Tr(this,t);break}case g.TEXT:{yd(this,t);break}case g.IN_TABLE:{Lt(this,t);break}case g.IN_TABLE_TEXT:{yt(this,t);break}case g.IN_CAPTION:{kd(this,t);break}case g.IN_COLUMN_GROUP:{Bd(this,t);break}case g.IN_TABLE_BODY:{Cn(this,t);break}case g.IN_ROW:{Ii(this,t);break}case g.IN_CELL:{Md(this,t);break}case g.IN_SELECT:{wi(this,t);break}case g.IN_SELECT_IN_TABLE:{Fd(this,t);break}case g.IN_TEMPLATE:{Qd(this,t);break}case g.AFTER_BODY:{Si(this,t);break}case g.IN_FRAMESET:{Wd(this,t);break}case g.AFTER_FRAMESET:{Jd(this,t);break}case g.AFTER_AFTER_BODY:{gr(this,t);break}default:}}onEof(t){switch(this.insertionMode){case g.INITIAL:{It(this,t);break}case g.BEFORE_HTML:{wt(this,t);break}case g.BEFORE_HEAD:{xt(this,t);break}case g.IN_HEAD:{St(this,t);break}case g.IN_HEAD_NO_SCRIPT:{Nt(this,t);break}case g.AFTER_HEAD:{_t(this,t);break}case g.IN_BODY:case g.IN_TABLE:case g.IN_CAPTION:case g.IN_COLUMN_GROUP:case g.IN_TABLE_BODY:case g.IN_ROW:case g.IN_CELL:case g.IN_SELECT:case g.IN_SELECT_IN_TABLE:{Ei(this,t);break}case g.TEXT:{wd(this,t);break}case g.IN_TABLE_TEXT:{yt(this,t);break}case g.IN_TEMPLATE:{xi(this,t);break}case g.AFTER_BODY:case g.IN_FRAMESET:case g.AFTER_FRAMESET:case g.AFTER_AFTER_BODY:case g.AFTER_AFTER_FRAMESET:{yn(this,t);break}default:}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===u.LINE_FEED)){if(t.chars.length===1)return;t.chars=t.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(t);return}switch(this.insertionMode){case g.IN_HEAD:case g.IN_HEAD_NO_SCRIPT:case g.AFTER_HEAD:case g.TEXT:case g.IN_COLUMN_GROUP:case g.IN_SELECT:case g.IN_SELECT_IN_TABLE:case g.IN_FRAMESET:case g.AFTER_FRAMESET:{this._insertCharacters(t);break}case g.IN_BODY:case g.IN_CAPTION:case g.IN_CELL:case g.IN_TEMPLATE:case g.AFTER_BODY:case g.AFTER_AFTER_BODY:case g.AFTER_AFTER_FRAMESET:{pi(this,t);break}case g.IN_TABLE:case g.IN_TABLE_BODY:case g.IN_ROW:{Tn(this,t);break}case g.IN_TABLE_TEXT:{Ti(this,t);break}default:}}};function Cl(e,t){let r=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return r?e.openElements.contains(r.element)?e.openElements.hasInScope(t.tagID)||(r=null):(e.activeFormattingElements.removeEntry(r),r=null):fi(e,t),r}function Il(e,t){let r=null,n=e.openElements.stackTop;for(;n>=0;n--){let s=e.openElements.items[n];if(s===t.element)break;e._isSpecialElement(s,e.openElements.tagIDs[n])&&(r=s)}return r||(e.openElements.shortenToLength(Math.max(n,0)),e.activeFormattingElements.removeEntry(t)),r}function yl(e,t,r){let n=t,s=e.openElements.getCommonAncestor(t);for(let a=0,c=s;c!==r;a++,c=s){s=e.openElements.getCommonAncestor(c);let l=e.activeFormattingElements.getElementEntry(c),o=l&&a>=Tl;!l||o?(o&&e.activeFormattingElements.removeEntry(l),e.openElements.remove(c)):(c=wl(e,l),n===t&&(e.activeFormattingElements.bookmark=l),e.treeAdapter.detachNode(n),e.treeAdapter.appendChild(c,n),n=c)}return n}function wl(e,t){let r=e.treeAdapter.getNamespaceURI(t.element),n=e.treeAdapter.createElement(t.token.tagName,r,t.token.attrs);return e.openElements.replace(t.element,n),t.element=n,n}function xl(e,t,r){let n=e.treeAdapter.getTagName(t),s=Pe(n);if(e._isElementCausesFosterParenting(s))e._fosterParentElement(r);else{let a=e.treeAdapter.getNamespaceURI(t);s===i.TEMPLATE&&a===b.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,r)}}function Sl(e,t,r){let n=e.treeAdapter.getNamespaceURI(r.element),{token:s}=r,a=e.treeAdapter.createElement(s.tagName,n,s.attrs);e._adoptNodes(t,a),e.treeAdapter.appendChild(t,a),e.activeFormattingElements.insertElementAfterBookmark(a,s),e.activeFormattingElements.removeEntry(r),e.openElements.remove(r.element),e.openElements.insertAfter(t,a,s.tagID)}function In(e,t){for(let r=0;r<El;r++){let n=Cl(e,t);if(!n)break;let s=Il(e,n);if(!s)break;e.activeFormattingElements.bookmark=n;let a=yl(e,s,n.element),c=e.openElements.getCommonAncestor(n.element);e.treeAdapter.detachNode(a),c&&xl(e,c,a),Sl(e,s,n)}}function bn(e,t){e._appendCommentNode(t,e.openElements.currentTmplContentOrNode)}function Nl(e,t){e._appendCommentNode(t,e.openElements.items[0])}function _l(e,t){e._appendCommentNode(t,e.document)}function yn(e,t){if(e.stopped=!0,t.location){let r=e.fragmentContext?0:2;for(let n=e.openElements.stackTop;n>=r;n--)e._setEndLocation(e.openElements.items[n],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){let n=e.openElements.items[0],s=e.treeAdapter.getNodeSourceCodeLocation(n);if(s&&!s.endTag&&(e._setEndLocation(n,t),e.openElements.stackTop>=1)){let a=e.openElements.items[1],c=e.treeAdapter.getNodeSourceCodeLocation(a);c&&!c.endTag&&e._setEndLocation(a,t)}}}}function Rl(e,t){e._setDocumentType(t);let r=t.forceQuirks?q.QUIRKS:ni(t);ri(t)||e._err(t,T.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,r),e.insertionMode=g.BEFORE_HTML}function It(e,t){e._err(t,T.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,q.QUIRKS),e.insertionMode=g.BEFORE_HTML,e._processToken(t)}function Ll(e,t){t.tagID===i.HTML?(e._insertElement(t,b.HTML),e.insertionMode=g.BEFORE_HEAD):wt(e,t)}function Ol(e,t){let r=t.tagID;(r===i.HTML||r===i.HEAD||r===i.BODY||r===i.BR)&&wt(e,t)}function wt(e,t){e._insertFakeRootElement(),e.insertionMode=g.BEFORE_HEAD,e._processToken(t)}function vl(e,t){switch(t.tagID){case i.HTML:{V(e,t);break}case i.HEAD:{e._insertElement(t,b.HTML),e.headElement=e.openElements.current,e.insertionMode=g.IN_HEAD;break}default:xt(e,t)}}function Dl(e,t){let r=t.tagID;r===i.HEAD||r===i.BODY||r===i.HTML||r===i.BR?xt(e,t):e._err(t,T.endTagWithoutMatchingOpenElement)}function xt(e,t){e._insertFakeElement(E.HEAD,i.HEAD),e.headElement=e.openElements.current,e.insertionMode=g.IN_HEAD,e._processToken(t)}function he(e,t){switch(t.tagID){case i.HTML:{V(e,t);break}case i.BASE:case i.BASEFONT:case i.BGSOUND:case i.LINK:case i.META:{e._appendElement(t,b.HTML),t.ackSelfClosing=!0;break}case i.TITLE:{e._switchToTextParsing(t,j.RCDATA);break}case i.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,j.RAWTEXT):(e._insertElement(t,b.HTML),e.insertionMode=g.IN_HEAD_NO_SCRIPT);break}case i.NOFRAMES:case i.STYLE:{e._switchToTextParsing(t,j.RAWTEXT);break}case i.SCRIPT:{e._switchToTextParsing(t,j.SCRIPT_DATA);break}case i.TEMPLATE:{e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=g.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(g.IN_TEMPLATE);break}case i.HEAD:{e._err(t,T.misplacedStartTagForHeadElement);break}default:St(e,t)}}function kl(e,t){switch(t.tagID){case i.HEAD:{e.openElements.pop(),e.insertionMode=g.AFTER_HEAD;break}case i.BODY:case i.BR:case i.HTML:{St(e,t);break}case i.TEMPLATE:{Me(e,t);break}default:e._err(t,T.endTagWithoutMatchingOpenElement)}}function Me(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==i.TEMPLATE&&e._err(t,T.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(i.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,T.endTagWithoutMatchingOpenElement)}function St(e,t){e.openElements.pop(),e.insertionMode=g.AFTER_HEAD,e._processToken(t)}function Bl(e,t){switch(t.tagID){case i.HTML:{V(e,t);break}case i.BASEFONT:case i.BGSOUND:case i.HEAD:case i.LINK:case i.META:case i.NOFRAMES:case i.STYLE:{he(e,t);break}case i.NOSCRIPT:{e._err(t,T.nestedNoscriptInHead);break}default:Nt(e,t)}}function Pl(e,t){switch(t.tagID){case i.NOSCRIPT:{e.openElements.pop(),e.insertionMode=g.IN_HEAD;break}case i.BR:{Nt(e,t);break}default:e._err(t,T.endTagWithoutMatchingOpenElement)}}function Nt(e,t){let r=t.type===v.EOF?T.openElementsLeftAfterEof:T.disallowedContentInNoscriptInHead;e._err(t,r),e.openElements.pop(),e.insertionMode=g.IN_HEAD,e._processToken(t)}function Ml(e,t){switch(t.tagID){case i.HTML:{V(e,t);break}case i.BODY:{e._insertElement(t,b.HTML),e.framesetOk=!1,e.insertionMode=g.IN_BODY;break}case i.FRAMESET:{e._insertElement(t,b.HTML),e.insertionMode=g.IN_FRAMESET;break}case i.BASE:case i.BASEFONT:case i.BGSOUND:case i.LINK:case i.META:case i.NOFRAMES:case i.SCRIPT:case i.STYLE:case i.TEMPLATE:case i.TITLE:{e._err(t,T.abandonedHeadElementChild),e.openElements.push(e.headElement,i.HEAD),he(e,t),e.openElements.remove(e.headElement);break}case i.HEAD:{e._err(t,T.misplacedStartTagForHeadElement);break}default:_t(e,t)}}function Ul(e,t){switch(t.tagID){case i.BODY:case i.HTML:case i.BR:{_t(e,t);break}case i.TEMPLATE:{Me(e,t);break}default:e._err(t,T.endTagWithoutMatchingOpenElement)}}function _t(e,t){e._insertFakeElement(E.BODY,i.BODY),e.insertionMode=g.IN_BODY,Er(e,t)}function Er(e,t){switch(t.type){case v.CHARACTER:{hi(e,t);break}case v.WHITESPACE_CHARACTER:{pi(e,t);break}case v.COMMENT:{bn(e,t);break}case v.START_TAG:{V(e,t);break}case v.END_TAG:{Tr(e,t);break}case v.EOF:{Ei(e,t);break}default:}}function pi(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function hi(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function Fl(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function Hl(e,t){let r=e.openElements.tryPeekProperlyNestedBodyElement();r&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(r,t.attrs))}function Ql(e,t){let r=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&r&&(e.treeAdapter.detachNode(r),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,b.HTML),e.insertionMode=g.IN_FRAMESET)}function Yl(e,t){e.openElements.hasInButtonScope(i.P)&&e._closePElement(),e._insertElement(t,b.HTML)}function Gl(e,t){e.openElements.hasInButtonScope(i.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&Tt.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,b.HTML)}function Wl(e,t){e.openElements.hasInButtonScope(i.P)&&e._closePElement(),e._insertElement(t,b.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function Kl(e,t){let r=e.openElements.tmplCount>0;(!e.formElement||r)&&(e.openElements.hasInButtonScope(i.P)&&e._closePElement(),e._insertElement(t,b.HTML),r||(e.formElement=e.openElements.current))}function Jl(e,t){e.framesetOk=!1;let r=t.tagID;for(let n=e.openElements.stackTop;n>=0;n--){let s=e.openElements.tagIDs[n];if(r===i.LI&&s===i.LI||(r===i.DD||r===i.DT)&&(s===i.DD||s===i.DT)){e.openElements.generateImpliedEndTagsWithExclusion(s),e.openElements.popUntilTagNamePopped(s);break}if(s!==i.ADDRESS&&s!==i.DIV&&s!==i.P&&e._isSpecialElement(e.openElements.items[n],s))break}e.openElements.hasInButtonScope(i.P)&&e._closePElement(),e._insertElement(t,b.HTML)}function jl(e,t){e.openElements.hasInButtonScope(i.P)&&e._closePElement(),e._insertElement(t,b.HTML),e.tokenizer.state=j.PLAINTEXT}function Vl(e,t){e.openElements.hasInScope(i.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(i.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,b.HTML),e.framesetOk=!1}function $l(e,t){let r=e.activeFormattingElements.getElementEntryInScopeWithTagName(E.A);r&&(In(e,t),e.openElements.remove(r.element),e.activeFormattingElements.removeEntry(r)),e._reconstructActiveFormattingElements(),e._insertElement(t,b.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function Xl(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,b.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function Zl(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(i.NOBR)&&(In(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,b.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function zl(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,b.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function ql(e,t){e.treeAdapter.getDocumentMode(e.document)!==q.QUIRKS&&e.openElements.hasInButtonScope(i.P)&&e._closePElement(),e._insertElement(t,b.HTML),e.framesetOk=!1,e.insertionMode=g.IN_TABLE}function gi(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,b.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function mi(e){let t=cr(e,be.TYPE);return t!=null&&t.toLowerCase()===fl}function ed(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,b.HTML),mi(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function td(e,t){e._appendElement(t,b.HTML),t.ackSelfClosing=!0}function rd(e,t){e.openElements.hasInButtonScope(i.P)&&e._closePElement(),e._appendElement(t,b.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function nd(e,t){t.tagName=E.IMG,t.tagID=i.IMG,gi(e,t)}function sd(e,t){e._insertElement(t,b.HTML),e.skipNextNewLine=!0,e.tokenizer.state=j.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=g.TEXT}function id(e,t){e.openElements.hasInButtonScope(i.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,j.RAWTEXT)}function ad(e,t){e.framesetOk=!1,e._switchToTextParsing(t,j.RAWTEXT)}function di(e,t){e._switchToTextParsing(t,j.RAWTEXT)}function od(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,b.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===g.IN_TABLE||e.insertionMode===g.IN_CAPTION||e.insertionMode===g.IN_TABLE_BODY||e.insertionMode===g.IN_ROW||e.insertionMode===g.IN_CELL?g.IN_SELECT_IN_TABLE:g.IN_SELECT}function cd(e,t){e.openElements.currentTagId===i.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,b.HTML)}function ld(e,t){e.openElements.hasInScope(i.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,b.HTML)}function dd(e,t){e.openElements.hasInScope(i.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(i.RTC),e._insertElement(t,b.HTML)}function ud(e,t){e._reconstructActiveFormattingElements(),fn(t),hr(t),t.selfClosing?e._appendElement(t,b.MATHML):e._insertElement(t,b.MATHML),t.ackSelfClosing=!0}function Ad(e,t){e._reconstructActiveFormattingElements(),En(t),hr(t),t.selfClosing?e._appendElement(t,b.SVG):e._insertElement(t,b.SVG),t.ackSelfClosing=!0}function ui(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,b.HTML)}function V(e,t){switch(t.tagID){case i.I:case i.S:case i.B:case i.U:case i.EM:case i.TT:case i.BIG:case i.CODE:case i.FONT:case i.SMALL:case i.STRIKE:case i.STRONG:{Xl(e,t);break}case i.A:{$l(e,t);break}case i.H1:case i.H2:case i.H3:case i.H4:case i.H5:case i.H6:{Gl(e,t);break}case i.P:case i.DL:case i.OL:case i.UL:case i.DIV:case i.DIR:case i.NAV:case i.MAIN:case i.MENU:case i.ASIDE:case i.CENTER:case i.FIGURE:case i.FOOTER:case i.HEADER:case i.HGROUP:case i.DIALOG:case i.DETAILS:case i.ADDRESS:case i.ARTICLE:case i.SEARCH:case i.SECTION:case i.SUMMARY:case i.FIELDSET:case i.BLOCKQUOTE:case i.FIGCAPTION:{Yl(e,t);break}case i.LI:case i.DD:case i.DT:{Jl(e,t);break}case i.BR:case i.IMG:case i.WBR:case i.AREA:case i.EMBED:case i.KEYGEN:{gi(e,t);break}case i.HR:{rd(e,t);break}case i.RB:case i.RTC:{ld(e,t);break}case i.RT:case i.RP:{dd(e,t);break}case i.PRE:case i.LISTING:{Wl(e,t);break}case i.XMP:{id(e,t);break}case i.SVG:{Ad(e,t);break}case i.HTML:{Fl(e,t);break}case i.BASE:case i.LINK:case i.META:case i.STYLE:case i.TITLE:case i.SCRIPT:case i.BGSOUND:case i.BASEFONT:case i.TEMPLATE:{he(e,t);break}case i.BODY:{Hl(e,t);break}case i.FORM:{Kl(e,t);break}case i.NOBR:{Zl(e,t);break}case i.MATH:{ud(e,t);break}case i.TABLE:{ql(e,t);break}case i.INPUT:{ed(e,t);break}case i.PARAM:case i.TRACK:case i.SOURCE:{td(e,t);break}case i.IMAGE:{nd(e,t);break}case i.BUTTON:{Vl(e,t);break}case i.APPLET:case i.OBJECT:case i.MARQUEE:{zl(e,t);break}case i.IFRAME:{ad(e,t);break}case i.SELECT:{od(e,t);break}case i.OPTION:case i.OPTGROUP:{cd(e,t);break}case i.NOEMBED:case i.NOFRAMES:{di(e,t);break}case i.FRAMESET:{Ql(e,t);break}case i.TEXTAREA:{sd(e,t);break}case i.NOSCRIPT:{e.options.scriptingEnabled?di(e,t):ui(e,t);break}case i.PLAINTEXT:{jl(e,t);break}case i.COL:case i.TH:case i.TD:case i.TR:case i.HEAD:case i.FRAME:case i.TBODY:case i.TFOOT:case i.THEAD:case i.CAPTION:case i.COLGROUP:break;default:ui(e,t)}}function pd(e,t){if(e.openElements.hasInScope(i.BODY)&&(e.insertionMode=g.AFTER_BODY,e.options.sourceCodeLocationInfo)){let r=e.openElements.tryPeekProperlyNestedBodyElement();r&&e._setEndLocation(r,t)}}function hd(e,t){e.openElements.hasInScope(i.BODY)&&(e.insertionMode=g.AFTER_BODY,Si(e,t))}function gd(e,t){let r=t.tagID;e.openElements.hasInScope(r)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(r))}function md(e){let t=e.openElements.tmplCount>0,{formElement:r}=e;t||(e.formElement=null),(r||t)&&e.openElements.hasInScope(i.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(i.FORM):r&&e.openElements.remove(r))}function fd(e){e.openElements.hasInButtonScope(i.P)||e._insertFakeElement(E.P,i.P),e._closePElement()}function Ed(e){e.openElements.hasInListItemScope(i.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(i.LI),e.openElements.popUntilTagNamePopped(i.LI))}function Td(e,t){let r=t.tagID;e.openElements.hasInScope(r)&&(e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.popUntilTagNamePopped(r))}function bd(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function Cd(e,t){let r=t.tagID;e.openElements.hasInScope(r)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(r),e.activeFormattingElements.clearToLastMarker())}function Id(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(E.BR,i.BR),e.openElements.pop(),e.framesetOk=!1}function fi(e,t){let r=t.tagName,n=t.tagID;for(let s=e.openElements.stackTop;s>0;s--){let a=e.openElements.items[s],c=e.openElements.tagIDs[s];if(n===c&&(n!==i.UNKNOWN||e.treeAdapter.getTagName(a)===r)){e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.stackTop>=s&&e.openElements.shortenToLength(s);break}if(e._isSpecialElement(a,c))break}}function Tr(e,t){switch(t.tagID){case i.A:case i.B:case i.I:case i.S:case i.U:case i.EM:case i.TT:case i.BIG:case i.CODE:case i.FONT:case i.NOBR:case i.SMALL:case i.STRIKE:case i.STRONG:{In(e,t);break}case i.P:{fd(e);break}case i.DL:case i.UL:case i.OL:case i.DIR:case i.DIV:case i.NAV:case i.PRE:case i.MAIN:case i.MENU:case i.ASIDE:case i.BUTTON:case i.CENTER:case i.FIGURE:case i.FOOTER:case i.HEADER:case i.HGROUP:case i.DIALOG:case i.ADDRESS:case i.ARTICLE:case i.DETAILS:case i.SEARCH:case i.SECTION:case i.SUMMARY:case i.LISTING:case i.FIELDSET:case i.BLOCKQUOTE:case i.FIGCAPTION:{gd(e,t);break}case i.LI:{Ed(e);break}case i.DD:case i.DT:{Td(e,t);break}case i.H1:case i.H2:case i.H3:case i.H4:case i.H5:case i.H6:{bd(e);break}case i.BR:{Id(e);break}case i.BODY:{pd(e,t);break}case i.HTML:{hd(e,t);break}case i.FORM:{md(e);break}case i.APPLET:case i.OBJECT:case i.MARQUEE:{Cd(e,t);break}case i.TEMPLATE:{Me(e,t);break}default:fi(e,t)}}function Ei(e,t){e.tmplInsertionModeStack.length>0?xi(e,t):yn(e,t)}function yd(e,t){var r;t.tagID===i.SCRIPT&&((r=e.scriptHandler)===null||r===void 0||r.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function wd(e,t){e._err(t,T.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function Tn(e,t){if(e.openElements.currentTagId!==void 0&&Ai.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=g.IN_TABLE_TEXT,t.type){case v.CHARACTER:{bi(e,t);break}case v.WHITESPACE_CHARACTER:{Ti(e,t);break}}else Ot(e,t)}function xd(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,b.HTML),e.insertionMode=g.IN_CAPTION}function Sd(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,b.HTML),e.insertionMode=g.IN_COLUMN_GROUP}function Nd(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(E.COLGROUP,i.COLGROUP),e.insertionMode=g.IN_COLUMN_GROUP,wn(e,t)}function _d(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,b.HTML),e.insertionMode=g.IN_TABLE_BODY}function Rd(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(E.TBODY,i.TBODY),e.insertionMode=g.IN_TABLE_BODY,br(e,t)}function Ld(e,t){e.openElements.hasInTableScope(i.TABLE)&&(e.openElements.popUntilTagNamePopped(i.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function Od(e,t){mi(t)?e._appendElement(t,b.HTML):Ot(e,t),t.ackSelfClosing=!0}function vd(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,b.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function qe(e,t){switch(t.tagID){case i.TD:case i.TH:case i.TR:{Rd(e,t);break}case i.STYLE:case i.SCRIPT:case i.TEMPLATE:{he(e,t);break}case i.COL:{Nd(e,t);break}case i.FORM:{vd(e,t);break}case i.TABLE:{Ld(e,t);break}case i.TBODY:case i.TFOOT:case i.THEAD:{_d(e,t);break}case i.INPUT:{Od(e,t);break}case i.CAPTION:{xd(e,t);break}case i.COLGROUP:{Sd(e,t);break}default:Ot(e,t)}}function Lt(e,t){switch(t.tagID){case i.TABLE:{e.openElements.hasInTableScope(i.TABLE)&&(e.openElements.popUntilTagNamePopped(i.TABLE),e._resetInsertionMode());break}case i.TEMPLATE:{Me(e,t);break}case i.BODY:case i.CAPTION:case i.COL:case i.COLGROUP:case i.HTML:case i.TBODY:case i.TD:case i.TFOOT:case i.TH:case i.THEAD:case i.TR:break;default:Ot(e,t)}}function Ot(e,t){let r=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,Er(e,t),e.fosterParentingEnabled=r}function Ti(e,t){e.pendingCharacterTokens.push(t)}function bi(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function yt(e,t){let r=0;if(e.hasNonWhitespacePendingCharacterToken)for(;r<e.pendingCharacterTokens.length;r++)Ot(e,e.pendingCharacterTokens[r]);else for(;r<e.pendingCharacterTokens.length;r++)e._insertCharacters(e.pendingCharacterTokens[r]);e.insertionMode=e.originalInsertionMode,e._processToken(t)}var Ci=new Set([i.CAPTION,i.COL,i.COLGROUP,i.TBODY,i.TD,i.TFOOT,i.TH,i.THEAD,i.TR]);function Dd(e,t){let r=t.tagID;Ci.has(r)?e.openElements.hasInTableScope(i.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(i.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=g.IN_TABLE,qe(e,t)):V(e,t)}function kd(e,t){let r=t.tagID;switch(r){case i.CAPTION:case i.TABLE:{e.openElements.hasInTableScope(i.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(i.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=g.IN_TABLE,r===i.TABLE&&Lt(e,t));break}case i.BODY:case i.COL:case i.COLGROUP:case i.HTML:case i.TBODY:case i.TD:case i.TFOOT:case i.TH:case i.THEAD:case i.TR:break;default:Tr(e,t)}}function wn(e,t){switch(t.tagID){case i.HTML:{V(e,t);break}case i.COL:{e._appendElement(t,b.HTML),t.ackSelfClosing=!0;break}case i.TEMPLATE:{he(e,t);break}default:mr(e,t)}}function Bd(e,t){switch(t.tagID){case i.COLGROUP:{e.openElements.currentTagId===i.COLGROUP&&(e.openElements.pop(),e.insertionMode=g.IN_TABLE);break}case i.TEMPLATE:{Me(e,t);break}case i.COL:break;default:mr(e,t)}}function mr(e,t){e.openElements.currentTagId===i.COLGROUP&&(e.openElements.pop(),e.insertionMode=g.IN_TABLE,e._processToken(t))}function br(e,t){switch(t.tagID){case i.TR:{e.openElements.clearBackToTableBodyContext(),e._insertElement(t,b.HTML),e.insertionMode=g.IN_ROW;break}case i.TH:case i.TD:{e.openElements.clearBackToTableBodyContext(),e._insertFakeElement(E.TR,i.TR),e.insertionMode=g.IN_ROW,Cr(e,t);break}case i.CAPTION:case i.COL:case i.COLGROUP:case i.TBODY:case i.TFOOT:case i.THEAD:{e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=g.IN_TABLE,qe(e,t));break}default:qe(e,t)}}function Cn(e,t){let r=t.tagID;switch(t.tagID){case i.TBODY:case i.TFOOT:case i.THEAD:{e.openElements.hasInTableScope(r)&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=g.IN_TABLE);break}case i.TABLE:{e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=g.IN_TABLE,Lt(e,t));break}case i.BODY:case i.CAPTION:case i.COL:case i.COLGROUP:case i.HTML:case i.TD:case i.TH:case i.TR:break;default:Lt(e,t)}}function Cr(e,t){switch(t.tagID){case i.TH:case i.TD:{e.openElements.clearBackToTableRowContext(),e._insertElement(t,b.HTML),e.insertionMode=g.IN_CELL,e.activeFormattingElements.insertMarker();break}case i.CAPTION:case i.COL:case i.COLGROUP:case i.TBODY:case i.TFOOT:case i.THEAD:case i.TR:{e.openElements.hasInTableScope(i.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=g.IN_TABLE_BODY,br(e,t));break}default:qe(e,t)}}function Ii(e,t){switch(t.tagID){case i.TR:{e.openElements.hasInTableScope(i.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=g.IN_TABLE_BODY);break}case i.TABLE:{e.openElements.hasInTableScope(i.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=g.IN_TABLE_BODY,Cn(e,t));break}case i.TBODY:case i.TFOOT:case i.THEAD:{(e.openElements.hasInTableScope(t.tagID)||e.openElements.hasInTableScope(i.TR))&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=g.IN_TABLE_BODY,Cn(e,t));break}case i.BODY:case i.CAPTION:case i.COL:case i.COLGROUP:case i.HTML:case i.TD:case i.TH:break;default:Lt(e,t)}}function Pd(e,t){let r=t.tagID;Ci.has(r)?(e.openElements.hasInTableScope(i.TD)||e.openElements.hasInTableScope(i.TH))&&(e._closeTableCell(),Cr(e,t)):V(e,t)}function Md(e,t){let r=t.tagID;switch(r){case i.TD:case i.TH:{e.openElements.hasInTableScope(r)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(r),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=g.IN_ROW);break}case i.TABLE:case i.TBODY:case i.TFOOT:case i.THEAD:case i.TR:{e.openElements.hasInTableScope(r)&&(e._closeTableCell(),Ii(e,t));break}case i.BODY:case i.CAPTION:case i.COL:case i.COLGROUP:case i.HTML:break;default:Tr(e,t)}}function yi(e,t){switch(t.tagID){case i.HTML:{V(e,t);break}case i.OPTION:{e.openElements.currentTagId===i.OPTION&&e.openElements.pop(),e._insertElement(t,b.HTML);break}case i.OPTGROUP:{e.openElements.currentTagId===i.OPTION&&e.openElements.pop(),e.openElements.currentTagId===i.OPTGROUP&&e.openElements.pop(),e._insertElement(t,b.HTML);break}case i.HR:{e.openElements.currentTagId===i.OPTION&&e.openElements.pop(),e.openElements.currentTagId===i.OPTGROUP&&e.openElements.pop(),e._appendElement(t,b.HTML),t.ackSelfClosing=!0;break}case i.INPUT:case i.KEYGEN:case i.TEXTAREA:case i.SELECT:{e.openElements.hasInSelectScope(i.SELECT)&&(e.openElements.popUntilTagNamePopped(i.SELECT),e._resetInsertionMode(),t.tagID!==i.SELECT&&e._processStartTag(t));break}case i.SCRIPT:case i.TEMPLATE:{he(e,t);break}default:}}function wi(e,t){switch(t.tagID){case i.OPTGROUP:{e.openElements.stackTop>0&&e.openElements.currentTagId===i.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===i.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===i.OPTGROUP&&e.openElements.pop();break}case i.OPTION:{e.openElements.currentTagId===i.OPTION&&e.openElements.pop();break}case i.SELECT:{e.openElements.hasInSelectScope(i.SELECT)&&(e.openElements.popUntilTagNamePopped(i.SELECT),e._resetInsertionMode());break}case i.TEMPLATE:{Me(e,t);break}default:}}function Ud(e,t){let r=t.tagID;r===i.CAPTION||r===i.TABLE||r===i.TBODY||r===i.TFOOT||r===i.THEAD||r===i.TR||r===i.TD||r===i.TH?(e.openElements.popUntilTagNamePopped(i.SELECT),e._resetInsertionMode(),e._processStartTag(t)):yi(e,t)}function Fd(e,t){let r=t.tagID;r===i.CAPTION||r===i.TABLE||r===i.TBODY||r===i.TFOOT||r===i.THEAD||r===i.TR||r===i.TD||r===i.TH?e.openElements.hasInTableScope(r)&&(e.openElements.popUntilTagNamePopped(i.SELECT),e._resetInsertionMode(),e.onEndTag(t)):wi(e,t)}function Hd(e,t){switch(t.tagID){case i.BASE:case i.BASEFONT:case i.BGSOUND:case i.LINK:case i.META:case i.NOFRAMES:case i.SCRIPT:case i.STYLE:case i.TEMPLATE:case i.TITLE:{he(e,t);break}case i.CAPTION:case i.COLGROUP:case i.TBODY:case i.TFOOT:case i.THEAD:{e.tmplInsertionModeStack[0]=g.IN_TABLE,e.insertionMode=g.IN_TABLE,qe(e,t);break}case i.COL:{e.tmplInsertionModeStack[0]=g.IN_COLUMN_GROUP,e.insertionMode=g.IN_COLUMN_GROUP,wn(e,t);break}case i.TR:{e.tmplInsertionModeStack[0]=g.IN_TABLE_BODY,e.insertionMode=g.IN_TABLE_BODY,br(e,t);break}case i.TD:case i.TH:{e.tmplInsertionModeStack[0]=g.IN_ROW,e.insertionMode=g.IN_ROW,Cr(e,t);break}default:e.tmplInsertionModeStack[0]=g.IN_BODY,e.insertionMode=g.IN_BODY,V(e,t)}}function Qd(e,t){t.tagID===i.TEMPLATE&&Me(e,t)}function xi(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(i.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):yn(e,t)}function Yd(e,t){t.tagID===i.HTML?V(e,t):fr(e,t)}function Si(e,t){var r;if(t.tagID===i.HTML){if(e.fragmentContext||(e.insertionMode=g.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===i.HTML){e._setEndLocation(e.openElements.items[0],t);let n=e.openElements.items[1];n&&!(!((r=e.treeAdapter.getNodeSourceCodeLocation(n))===null||r===void 0)&&r.endTag)&&e._setEndLocation(n,t)}}else fr(e,t)}function fr(e,t){e.insertionMode=g.IN_BODY,Er(e,t)}function Gd(e,t){switch(t.tagID){case i.HTML:{V(e,t);break}case i.FRAMESET:{e._insertElement(t,b.HTML);break}case i.FRAME:{e._appendElement(t,b.HTML),t.ackSelfClosing=!0;break}case i.NOFRAMES:{he(e,t);break}default:}}function Wd(e,t){t.tagID===i.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==i.FRAMESET&&(e.insertionMode=g.AFTER_FRAMESET))}function Kd(e,t){switch(t.tagID){case i.HTML:{V(e,t);break}case i.NOFRAMES:{he(e,t);break}default:}}function Jd(e,t){t.tagID===i.HTML&&(e.insertionMode=g.AFTER_AFTER_FRAMESET)}function jd(e,t){t.tagID===i.HTML?V(e,t):gr(e,t)}function gr(e,t){e.insertionMode=g.IN_BODY,Er(e,t)}function Vd(e,t){switch(t.tagID){case i.HTML:{V(e,t);break}case i.NOFRAMES:{he(e,t);break}default:}}function $d(e,t){t.chars=M,e._insertCharacters(t)}function Xd(e,t){e._insertCharacters(t),e.framesetOk=!1}function Ni(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==b.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function Zd(e,t){if(ii(t))Ni(e),e._startTagOutsideForeignContent(t);else{let r=e._getAdjustedCurrentElement(),n=e.treeAdapter.getNamespaceURI(r);n===b.MATHML?fn(t):n===b.SVG&&(ai(t),En(t)),hr(t),t.selfClosing?e._appendElement(t,n):e._insertElement(t,n),t.ackSelfClosing=!0}}function zd(e,t){if(t.tagID===i.P||t.tagID===i.BR){Ni(e),e._endTagOutsideForeignContent(t);return}for(let r=e.openElements.stackTop;r>0;r--){let n=e.openElements.items[r];if(e.treeAdapter.getNamespaceURI(n)===b.HTML){e._endTagOutsideForeignContent(t);break}let s=e.treeAdapter.getTagName(n);if(s.toLowerCase()===t.tagName){t.tagName=s,e.openElements.shortenToLength(r);break}}}var Kg=new Set([E.AREA,E.BASE,E.BASEFONT,E.BGSOUND,E.BR,E.COL,E.EMBED,E.FRAME,E.HR,E.IMG,E.INPUT,E.KEYGEN,E.LINK,E.META,E.PARAM,E.SOURCE,E.TRACK,E.WBR]);function _i(e,t){return Rt.parse(e,t)}function ce(e,t){return e.attrs?.find(r=>r.name.toLowerCase()===t.toLowerCase())?.value??null}function xn(e){return e.nodeName==="#text"?e.value??"":(e.childNodes??[]).map(xn).join("")}function xe(e){return e?.replace(/\s+/g," ").trim()||null}function Sn(e){let t=_i(e),r={title:null,description:null,canonical:null,robots:null,lang:null,h1Count:0,openGraph:{title:null,description:null,image:null},twitter:{card:null,title:null,description:null,image:null},hreflang:[],jsonLd:[],images:[],links:[],wordCount:0,visibleText:""},n=[];function s(a,c=!1){let l=a.tagName?.toLowerCase(),o=c||l==="script"||l==="style"||l==="noscript"||l==="template";if(a.nodeName==="#text"&&!o){let d=xe(a.value);d&&n.push(d)}if(l==="html"&&r.lang===null&&(r.lang=xe(ce(a,"lang"))),l==="title"&&r.title===null&&(r.title=xe(xn(a))),l==="h1"&&(r.h1Count+=1),l==="meta"){let d=ce(a,"name")?.toLowerCase(),p=ce(a,"property")?.toLowerCase(),h=xe(ce(a,"content"));d==="description"&&r.description===null?r.description=h:d==="robots"&&r.robots===null?r.robots=h:p==="og:title"&&r.openGraph.title===null?r.openGraph.title=h:p==="og:description"&&r.openGraph.description===null?r.openGraph.description=h:p==="og:image"&&r.openGraph.image===null?r.openGraph.image=h:d==="twitter:card"&&r.twitter.card===null?r.twitter.card=h:d==="twitter:title"&&r.twitter.title===null?r.twitter.title=h:d==="twitter:description"&&r.twitter.description===null?r.twitter.description=h:d==="twitter:image"&&r.twitter.image===null&&(r.twitter.image=h)}if(l==="link"){let d=ce(a,"rel")?.toLowerCase().split(/\s+/).filter(Boolean)??[];if(d.includes("canonical")&&r.canonical===null&&(r.canonical=xe(ce(a,"href"))),d.includes("alternate")){let p=xe(ce(a,"hreflang")),h=xe(ce(a,"href"));p&&h&&r.hreflang.push({lang:p,url:h})}}if(l==="a"){let d=ce(a,"href");d&&r.links.push(d)}if(l==="img"&&r.images.push({src:xe(ce(a,"src")),alt:ce(a,"alt")}),l==="script"&&ce(a,"type")?.toLowerCase()==="application/ld+json"){let d=xn(a).trim();if(d)try{r.jsonLd.push({valid:!0,value:JSON.parse(d)})}catch(p){r.jsonLd.push({valid:!1,error:p instanceof Error?p.message:String(p)})}}for(let d of a.childNodes??[])s(d,o)}return s(t),r.visibleText=n.join(" "),r.wordCount=r.visibleText?r.visibleText.split(/\s+/u).length:0,r}function qd(e,t){return{url:e,finalUrl:null,status:null,contentType:null,blockedByRobots:!1,error:null,title:null,description:null,canonical:null,canonicalRaw:null,robots:null,xRobotsTag:null,lang:null,h1Count:0,openGraph:{title:null,description:null,image:null},twitter:{card:null,title:null,description:null,image:null},hreflang:[],jsonLd:[],images:[],links:[],internalLinks:[],externalLinks:[],wordCount:0,contentHash:null,depth:t,redirectChain:[],responseBytes:0}}async function et(e,t){await e.onEvent?.(t)}async function eu(e,t,r,n,s){let a=qd(e,t);if(n.respectRobots&&!cs(e,s))return a.blockedByRobots=!0,a;try{if(n.renderer){n.signal?.throwIfAborted(),await n.requestGate(e);let N=await n.renderer.render({url:e,timeout:n.timeout,maxResponseBytes:n.maxResponseBytes,userAgent:n.userAgent,...n.signal?{signal:n.signal}:{}});return tu(a,N,e,r,n.includeQuery)}let{response:c,redirectChain:l}=await Oe(e,{headers:{accept:"text/html,application/xhtml+xml;q=0.9,*/*;q=0.1","user-agent":n.userAgent}},{...n,gate:n.requestGate,onEvent:n.onEvent}),o=c.headers.get("content-type")??"",d=o.includes("text/html")||o.includes("application/xhtml+xml"),p=Y(c.url,void 0,{includeQuery:n.includeQuery});if(a.finalUrl=p,a.status=c.status,a.contentType=o||null,a.xRobotsTag=c.headers.get("x-robots-tag"),a.redirectChain=l,!d)return await c.body?.cancel(),a;let{text:h,bytes:f}=await ve(c,n.maxResponseBytes),m=Sn(h),y=p??e,w=m.canonical?Y(m.canonical,y,{includeQuery:!0}):null,I=[...new Set(m.links.map(N=>Y(N,y,{includeQuery:n.includeQuery})).filter(N=>!!N))].sort(),_=m.hreflang.map(N=>({lang:N.lang,url:Y(N.url,y,{includeQuery:!0})}));return Object.assign(a,{...m,visibleText:void 0,canonical:w,canonicalRaw:m.canonical,links:I,internalLinks:I.filter(N=>de(N,r)),externalLinks:I.filter(N=>!de(N,r)),hreflang:_,contentHash:m.visibleText?Ri("sha256").update(m.visibleText.toLowerCase()).digest("hex"):null,responseBytes:f}),a}catch(c){if(n.signal?.aborted)throw c;return a.error=c instanceof Error?c.message:String(c),c instanceof fe&&(a.redirectChain=c.redirectChain),a}}function tu(e,t,r,n,s){let a=t.headers["content-type"]??"text/html",c=Y(t.finalUrl,void 0,{includeQuery:s});if(e.finalUrl=c,e.status=t.status,e.contentType=a,e.xRobotsTag=t.headers["x-robots-tag"]??null,e.redirectChain=t.redirectChain,!a.includes("text/html")&&!a.includes("application/xhtml+xml"))return e;let l=Sn(t.html),o=c??r,d=l.canonical?Y(l.canonical,o,{includeQuery:!0}):null,p=[...new Set(l.links.map(h=>Y(h,o,{includeQuery:s})).filter(h=>!!h))].sort();return Object.assign(e,{...l,visibleText:void 0,canonical:d,canonicalRaw:l.canonical,links:p,internalLinks:p.filter(h=>de(h,n)),externalLinks:p.filter(h=>!de(h,n)),hreflang:l.hreflang.map(h=>({lang:h.lang,url:Y(h.url,o,{includeQuery:!0})})),contentHash:l.visibleText?Ri("sha256").update(l.visibleText.toLowerCase()).digest("hex"):null,responseBytes:t.responseBytes}),e}function ru(e={}){let t=e.requestDelay??e.delay??100,r=e.requestGate;return{...e,maxPages:e.maxPages??100,concurrency:Math.max(1,e.concurrency??5),timeout:e.timeout??1e4,includeQuery:e.includeQuery??!1,respectRobots:e.respectRobots??!0,sitemap:e.sitemap??null,sitemapData:e.sitemapData??null,userAgent:e.userAgent??_e,requestDelay:t,requestGate:r?async n=>r(n):Ge(t),maxRedirects:e.maxRedirects??10,maxResponseBytes:e.maxResponseBytes??5*1024*1024,retries:e.retries??2,fetch:e.fetch??globalThis.fetch,logger:e.logger??Wt}}async function nu(e,t){let r=[],n=Array.from({length:e},async()=>{for(;;){let s=await t();if(s===null)return;r.push(s)}});return await Promise.all(n),r}async function Li(e,t={}){let r=Date.now(),n=ru(t),s=Y(e,void 0,{includeQuery:n.includeQuery});if(!s)throw new Error(`invalid start URL: ${e}`);let a=new URL(s).origin;await et(n,{type:"scan-start",url:s,total:n.maxPages});let c=t.robots??await Kt(s,n),l=n.sitemapData;if(!l&&n.sitemap)try{l=await nr(n.sitemap,{...n,maxUrls:t.sitemapMaxUrls??5e4,siteOrigin:a})}catch(L){l={url:n.sitemap,urls:[],sitemapCount:0,truncated:!1,error:L instanceof Error?L.message:String(L)},n.logger.warn(`Could not load sitemap ${n.sitemap}: ${l.error}`)}let d=[...new Set([s,...l?.urls??[]])].slice(0,n.maxPages).map(L=>({url:L,depth:0})),p=new Set(d.map(L=>L.url)),h=new Map((t.cachedPages??[]).map(L=>[L.url,L])),f=new Map,m=Math.max(n.maxPages*10,n.maxPages),y=!1;for(;d.length>0&&f.size<n.maxPages&&!n.signal?.aborted;){d.sort((x,D)=>x.url.localeCompare(D.url));let L=n.maxPages-f.size,B=d.slice(0,L);d.length>B.length&&(y=!0);let R=0,P=await nu(n.concurrency,async()=>{if(n.signal?.aborted||R>=B.length)return null;let x=B[R++];if(!x)return null;let D=h.get(x.url);if(!D)try{D=await eu(x.url,x.depth,a,n,c)}catch(F){if(n.signal?.aborted)return null;throw F}return f.set(x.url,D),h.has(x.url)||(await t.onBatch?.([D]),await n.storage?.saveCheckpoint?.(s,D),await et(n,{type:"checkpoint",page:D,completed:f.size,total:n.maxPages})),t.onProgress?.(f.size,n.maxPages),await et(n,{type:"page",completed:f.size,total:n.maxPages,page:D}),await et(n,{type:"progress",completed:f.size,total:n.maxPages,page:D}),{item:x,page:D}}),G=new Map;for(let{item:x,page:D}of P.sort((F,$)=>F.item.url.localeCompare($.item.url))){let F=D.internalLinks?.length?D.internalLinks:(D.links??[]).filter($=>de($,a));for(let $ of[...F].sort())p.size>=m||p.has($)||!tr($)||(p.add($),G.set($,{url:$,depth:x.depth+1}))}d=[...G.values()]}let w=[...f.values()].sort((L,B)=>L.url.localeCompare(B.url)),I=!!n.signal?.aborted,_=I||y||d.length>0||(l?l.urls.length>w.length:!1)||(l?.truncated??!1),N={startUrl:s,pages:w,robots:c,sitemap:l,truncated:_,partial:I,durationMs:Date.now()-r,options:n};return N.snapshot=Ie(N),I||await n.storage?.removeCheckpoint?.(s),I?await et(n,{type:"cancelled",completed:w.length,total:n.maxPages,partial:!0}):await et(n,{type:"complete",completed:w.length,total:n.maxPages}),N}function Oi(e){return"planVersion"in e}function su(e,t){return{schemaVersion:2,pageSchemaVersion:1,siteUrl:e.startUrl,sitemapUrl:e.sitemap?.url??null,includeQuery:e.config.includeQuery,respectRobots:e.config.respectRobots,timeout:e.config.timeout,maxRedirects:e.config.maxRedirects,maxResponseBytes:e.config.maxResponseBytes,userAgent:e.userAgent,...t?{rendererId:t}:{}}}function iu(e){return!e.error&&(e.status===null||e.status<500)}async function tt(e,t={}){let r=null,n=null,s;try{s=Oi(e)?e:await ue(e,{...t,async onEvent(m){m.type==="robots"&&(r=m.robots),m.type==="sitemap"&&(n=m.sitemap),await t.onEvent?.(m)}})}catch(m){if(Oi(e)||!t.signal?.aborted)throw m;let y=Te(e),w=Y(y.url,void 0,{includeQuery:y.includeQuery});if(!w)throw new Error(`invalid start URL: ${y.url}`,{cause:m});let I=r??{url:new URL("/robots.txt",w).href,status:null,sha256:null,error:"Scan cancelled before robots.txt planning completed",denyAll:!1},_=Ie({startUrl:w,pages:[],robots:I,sitemap:n,options:y,partial:!0,truncated:!0});return await t.checkpointStore?.flush?.(),await t.onEvent?.({type:"cancelled",completed:0,total:y.maxPages,partial:!0}),{snapshot:_,startUrl:w,pages:[],robots:I,sitemap:n,truncated:!0,partial:!0,durationMs:0,options:y}}if(s.planVersion!==1)throw new Error(`unsupported scan plan version: ${String(s.planVersion)}`);let a=t.limit??s.config.maxPages;if(!Number.isInteger(a)||a<=0)throw new Error("scan limit must be a positive integer");let c={...s.config,maxPages:a},l=Ge(c.delay),o=su(s,t.renderer?.id),d=t.checkpointStore&&t.resume!==!1?await t.checkpointStore.load(o):null,p=[...t.cachedPages??[],...d?.pages.filter(iu)??[]],h=[...new Map(p.map(m=>[m.url,m])).values()];h.length>0&&await t.onEvent?.({type:"resume",completed:h.length,total:a});let f=await Li(s.startUrl,{...t,maxPages:a,concurrency:c.concurrency,requestDelay:c.delay,timeout:c.timeout,respectRobots:c.respectRobots,includeQuery:c.includeQuery,maxRedirects:c.maxRedirects,maxResponseBytes:c.maxResponseBytes,enabledRules:c.enabledRules,severityOverrides:c.severityOverrides,suppressions:c.suppressions,regressionBudgets:c.regressionBudgets,report:c.report,requestGate:l,robots:s.robots,sitemap:s.sitemap?.url??null,sitemapData:s.sitemap,userAgent:s.userAgent,cachedPages:h,async onBatch(m){for(let y of m)await t.checkpointStore?.append(o,y);await t.onBatch?.(m)}});return await t.checkpointStore?.flush?.(),!f.partial&&!t.retainCheckpoint&&await t.checkpointStore?.clear(o),f}function vi(e){return/^\d+$/.test(e)?":id":/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)?":uuid":/^\d{4}-\d{2}-\d{2}$/.test(e)?":date":/^[0-9a-f]{16,}$/i.test(e)?":hash":null}function au(e){return e.flatMap(t=>{try{let r=new URL(t.url);return[{issue:t,url:r,segments:r.pathname.split("/").filter(Boolean)}]}catch{return[]}})}function ou(e){let t=new Map;for(let r of e)for(let n=1;n<r.segments.length;n+=1){if(vi(r.segments[n]))continue;let s=r.segments.slice(0,n).join("/"),a=`${r.url.origin}|${r.segments.length}|${n}|${s}`,c=t.get(a)??new Set;c.add(r.segments[n]),t.set(a,c)}return new Set([...t].filter(([,r])=>r.size>=2).map(([r])=>r))}function cu(e,t){let r=e.segments.map((n,s)=>{let a=vi(n);if(a)return a;let c=e.segments.slice(0,s).join("/"),l=`${e.url.origin}|${e.segments.length}|${s}|${c}`;return s>0&&t.has(l)?":slug":n});return`/${r.join("/")}${e.url.pathname.endsWith("/")&&r.length>0?"/":""}`}function vt(e){return Ir(e.map(t=>({url:t,ruleId:"",severity:"info",owner:"seo"}))).map(({origin:t,template:r,urls:n})=>({origin:t,template:r,urls:n}))}function Ir(e){let t=au(e),r=ou(t),n=new Map;for(let s of t){let a=cu(s,r),c=`${s.url.origin}${a}`,l=n.get(c)??{origin:s.url.origin,template:a,issues:[],urls:new Set};l.issues.push(s.issue),l.urls.add(s.issue.url),n.set(c,l)}return[...n.values()].map(s=>{let a={error:0,warning:0,info:0},c={},l={};for(let d of s.issues)a[d.severity]+=1,c[d.ruleId]=(c[d.ruleId]??0)+1,l[d.owner]=(l[d.owner]??0)+1;let o=[...s.urls].sort();return{origin:s.origin,template:s.template,issueCount:s.issues.length,affectedPages:o.length,severities:a,rules:c,owners:l,urls:o,representativeUrls:o.slice(0,3)}}).sort((s,a)=>a.issueCount-s.issueCount||s.template.localeCompare(a.template)||s.origin.localeCompare(a.origin))}function Di(e){let t=e.replaceAll("-"," ");return t.charAt(0).toUpperCase()+t.slice(1)}var lu={"page-unreachable":"\u041D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0430 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0430","http-error":"HTTP-\u043F\u043E\u043C\u0438\u043B\u043A\u0430",noindex:"Noindex","x-robots-noindex":"Noindex \u0443 X-Robots-Tag","robots-blocked":"\u0417\u0430\u0431\u043B\u043E\u043A\u043E\u0432\u0430\u043D\u043E robots.txt","missing-canonical":"\u0412\u0456\u0434\u0441\u0443\u0442\u043D\u0456\u0439 canonical","invalid-canonical":"\u041D\u0435\u043A\u043E\u0440\u0435\u043A\u0442\u043D\u0438\u0439 canonical","cross-domain-canonical":"Canonical \u043D\u0430 \u0456\u043D\u0448\u043E\u043C\u0443 \u0434\u043E\u043C\u0435\u043D\u0456","canonical-target-error":"\u041F\u043E\u043C\u0438\u043B\u043A\u0430 \u0446\u0456\u043B\u0456 canonical","redirect-loop":"\u0426\u0438\u043A\u043B \u043F\u0435\u0440\u0435\u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u044C","long-redirect-chain":"\u0414\u043E\u0432\u0433\u0438\u0439 \u043B\u0430\u043D\u0446\u044E\u0436\u043E\u043A \u043F\u0435\u0440\u0435\u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u044C","sitemap-unavailable":"Sitemap \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0438\u0439","noindex-in-sitemap":"Noindex \u0443 sitemap","redirect-in-sitemap":"\u041F\u0435\u0440\u0435\u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u043D\u044F \u0443 sitemap","missing-title":"\u0412\u0456\u0434\u0441\u0443\u0442\u043D\u0456\u0439 title","duplicate-title":"\u0414\u0443\u0431\u043B\u044C\u043E\u0432\u0430\u043D\u0438\u0439 title","title-length":"\u0414\u043E\u0432\u0436\u0438\u043D\u0430 title","missing-description":"\u0412\u0456\u0434\u0441\u0443\u0442\u043D\u0456\u0439 description","duplicate-description":"\u0414\u0443\u0431\u043B\u044C\u043E\u0432\u0430\u043D\u0438\u0439 description","description-length":"\u0414\u043E\u0432\u0436\u0438\u043D\u0430 description","missing-h1":"\u0412\u0456\u0434\u0441\u0443\u0442\u043D\u0456\u0439 H1","broken-internal-link":"\u041D\u0435\u0440\u043E\u0431\u043E\u0447\u0435 \u0432\u043D\u0443\u0442\u0440\u0456\u0448\u043D\u0454 \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F","orphan-sitemap-page":"\u0406\u0437\u043E\u043B\u044C\u043E\u0432\u0430\u043D\u0430 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0430 sitemap","crawlable-not-in-sitemap":"\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u0432\u0456\u0434\u0441\u0443\u0442\u043D\u044F \u0443 sitemap","invalid-hreflang":"\u041D\u0435\u043A\u043E\u0440\u0435\u043A\u0442\u043D\u0438\u0439 hreflang","malformed-json-ld":"\u041D\u0435\u043A\u043E\u0440\u0435\u043A\u0442\u043D\u0438\u0439 JSON-LD","http-on-https-site":"HTTP URL \u043D\u0430 HTTPS-\u0441\u0430\u0439\u0442\u0456","invalid-language":"\u041D\u0435\u043A\u043E\u0440\u0435\u043A\u0442\u043D\u0435 \u043E\u0433\u043E\u043B\u043E\u0448\u0435\u043D\u043D\u044F \u043C\u043E\u0432\u0438","duplicate-content":"\u0414\u0443\u0431\u043B\u044C\u043E\u0432\u0430\u043D\u0438\u0439 \u043A\u043E\u043D\u0442\u0435\u043D\u0442","multiple-h1":"\u041A\u0456\u043B\u044C\u043A\u0430 H1","missing-open-graph":"\u041D\u0435\u043F\u043E\u0432\u043D\u0456 Open Graph metadata","missing-twitter-metadata":"\u041D\u0435\u043F\u043E\u0432\u043D\u0456 Twitter metadata","image-missing-alt":"\u0417\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u043D\u044F \u0431\u0435\u0437 alt","low-word-count":"\u041C\u0430\u043B\u043E \u0442\u0435\u043A\u0441\u0442\u0443","robots-changed":"robots.txt \u0437\u043C\u0456\u043D\u0435\u043D\u043E","page-missing":"\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0443 \u043D\u0435 \u043F\u0435\u0440\u0435\u0432\u0456\u0440\u0435\u043D\u043E","status-regression":"\u0420\u0435\u0433\u0440\u0435\u0441\u0456\u044F HTTP-\u0441\u0442\u0430\u0442\u0443\u0441\u0443","new-noindex":"\u041D\u043E\u0432\u0438\u0439 noindex","title-removed":"Title \u0432\u0438\u0434\u0430\u043B\u0435\u043D\u043E","title-changed":"Title \u0437\u043C\u0456\u043D\u0435\u043D\u043E","description-removed":"Description \u0432\u0438\u0434\u0430\u043B\u0435\u043D\u043E","canonical-removed":"Canonical \u0432\u0438\u0434\u0430\u043B\u0435\u043D\u043E","canonical-changed":"Canonical \u0437\u043C\u0456\u043D\u0435\u043D\u043E","h1-removed":"H1 \u0432\u0438\u0434\u0430\u043B\u0435\u043D\u043E","redirect-changed":"\u041F\u0435\u0440\u0435\u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u043D\u044F \u0437\u043C\u0456\u043D\u0435\u043D\u043E","sitemap-url-count-drop":"\u0417\u043C\u0435\u043D\u0448\u0435\u043D\u043D\u044F URL \u0443 sitemap"},du={"page-unreachable":"\u0412\u0456\u0434\u043D\u043E\u0432\u0456\u0442\u044C \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0443 \u0430\u0431\u043E \u043F\u0440\u0438\u0431\u0435\u0440\u0456\u0442\u044C \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F \u043D\u0430 \u043D\u0435\u0457.","http-error":"\u041F\u043E\u0432\u0435\u0440\u043D\u0456\u0442\u044C \u0443\u0441\u043F\u0456\u0448\u043D\u0443 \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u044C \u0430\u0431\u043E \u0441\u0432\u0456\u0434\u043E\u043C\u0435 \u043F\u0435\u0440\u0435\u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u043D\u044F.",noindex:"\u041F\u0440\u0438\u0431\u0435\u0440\u0456\u0442\u044C noindex, \u044F\u043A\u0449\u043E \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u043C\u0430\u0454 \u0437\u2019\u044F\u0432\u043B\u044F\u0442\u0438\u0441\u044F \u0432 \u043F\u043E\u0448\u0443\u043A\u0443.","x-robots-noindex":"\u041F\u0440\u0438\u0431\u0435\u0440\u0456\u0442\u044C noindex \u0456\u0437 X-Robots-Tag, \u044F\u043A\u0449\u043E \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u043C\u0430\u0454 \u0456\u043D\u0434\u0435\u043A\u0441\u0443\u0432\u0430\u0442\u0438\u0441\u044F.","robots-blocked":"\u0414\u043E\u0437\u0432\u043E\u043B\u044C\u0442\u0435 URL \u0443 robots.txt, \u044F\u043A\u0449\u043E \u0439\u043E\u0433\u043E \u043F\u043E\u0442\u0440\u0456\u0431\u043D\u043E \u0441\u043A\u0430\u043D\u0443\u0432\u0430\u0442\u0438.","missing-canonical":"\u0412\u043A\u0430\u0436\u0456\u0442\u044C \u0431\u0430\u0436\u0430\u043D\u0438\u0439 canonical URL, \u044F\u043A\u0449\u043E \u043C\u043E\u0436\u043B\u0438\u0432\u0456 \u0434\u0443\u0431\u043B\u0456\u043A\u0430\u0442\u0438 \u0430\u0434\u0440\u0435\u0441\u0438.","invalid-canonical":"\u0412\u0438\u043A\u043E\u0440\u0438\u0441\u0442\u0430\u0439\u0442\u0435 \u0430\u0431\u0441\u043E\u043B\u044E\u0442\u043D\u0438\u0439 \u0430\u0431\u043E \u043A\u043E\u0440\u0435\u043A\u0442\u043D\u0438\u0439 \u0432\u0456\u0434\u043D\u043E\u0441\u043D\u0438\u0439 HTTP(S) canonical URL.","cross-domain-canonical":"\u041F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u044C\u0442\u0435 \u0437\u043E\u0432\u043D\u0456\u0448\u043D\u0456\u0439 canonical \u0430\u0431\u043E \u0432\u043A\u0430\u0436\u0456\u0442\u044C \u043F\u043E\u0442\u0440\u0456\u0431\u043D\u0438\u0439 URL \u0446\u044C\u043E\u0433\u043E \u0441\u0430\u0439\u0442\u0443.","canonical-target-error":"\u0421\u043F\u0440\u044F\u043C\u0443\u0439\u0442\u0435 canonical \u043D\u0430 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0438\u0439 URL, \u0434\u043E\u0437\u0432\u043E\u043B\u0435\u043D\u0438\u0439 \u0434\u043B\u044F \u0456\u043D\u0434\u0435\u043A\u0441\u0430\u0446\u0456\u0457.","redirect-loop":"\u041F\u0440\u0438\u0431\u0435\u0440\u0456\u0442\u044C \u0446\u0438\u043A\u043B\u0456\u0447\u043D\u0438\u0439 \u043C\u0430\u0440\u0448\u0440\u0443\u0442 \u043F\u0435\u0440\u0435\u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u044C.","long-redirect-chain":"\u041F\u0435\u0440\u0435\u043D\u0430\u043F\u0440\u0430\u0432\u043B\u044F\u0439\u0442\u0435 \u043E\u0434\u0440\u0430\u0437\u0443 \u043D\u0430 \u043A\u0456\u043D\u0446\u0435\u0432\u0443 \u0430\u0434\u0440\u0435\u0441\u0443.","sitemap-unavailable":"\u0412\u0456\u0434\u043D\u043E\u0432\u0456\u0442\u044C \u043A\u043E\u0440\u0435\u043A\u0442\u043D\u0438\u0439 \u0456 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0438\u0439 XML sitemap.","noindex-in-sitemap":"\u041F\u0440\u0438\u0431\u0435\u0440\u0456\u0442\u044C URL \u0456\u0437 sitemap \u0430\u0431\u043E \u0434\u043E\u0437\u0432\u043E\u043B\u044C\u0442\u0435 \u0439\u043E\u0433\u043E \u0456\u043D\u0434\u0435\u043A\u0441\u0430\u0446\u0456\u044E.","redirect-in-sitemap":"\u0417\u0430\u043C\u0456\u043D\u0456\u0442\u044C URL \u0443 sitemap \u043D\u0430 \u0439\u043E\u0433\u043E \u043A\u0456\u043D\u0446\u0435\u0432\u0443 canonical-\u0430\u0434\u0440\u0435\u0441\u0443.","missing-title":"\u0414\u043E\u0434\u0430\u0439\u0442\u0435 \u0443\u043D\u0456\u043A\u0430\u043B\u044C\u043D\u0438\u0439 \u043E\u043F\u0438\u0441\u043E\u0432\u0438\u0439 HTML title.","duplicate-title":"\u041D\u0430\u043F\u0438\u0448\u0456\u0442\u044C title, \u044F\u043A\u0438\u0439 \u0443\u043D\u0456\u043A\u0430\u043B\u044C\u043D\u043E \u043E\u043F\u0438\u0441\u0443\u0454 \u0446\u044E \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0443.","title-length":"\u0417\u0440\u043E\u0431\u0456\u0442\u044C title \u0441\u0442\u0438\u0441\u043B\u0438\u043C \u0456 \u0437\u043C\u0456\u0441\u0442\u043E\u0432\u043D\u0438\u043C, \u0437\u0430\u0437\u0432\u0438\u0447\u0430\u0439 10\u201360 \u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432.","missing-description":"\u0414\u043E\u0434\u0430\u0439\u0442\u0435 \u043A\u043E\u0440\u0438\u0441\u043D\u0438\u0439 meta description.","duplicate-description":"\u041D\u0430\u043F\u0438\u0448\u0456\u0442\u044C \u0443\u043D\u0456\u043A\u0430\u043B\u044C\u043D\u0438\u0439 meta description \u0434\u043B\u044F \u0446\u0456\u0454\u0457 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0438.","description-length":"\u0417\u0440\u043E\u0431\u0456\u0442\u044C description \u043A\u043E\u0440\u0438\u0441\u043D\u0438\u043C \u0456 \u0437\u0430\u0437\u0432\u0438\u0447\u0430\u0439 \u0434\u043E\u0432\u0436\u0438\u043D\u043E\u044E 50\u2013160 \u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432.","missing-h1":"\u0414\u043E\u0434\u0430\u0439\u0442\u0435 \u043E\u0434\u0438\u043D \u0437\u0440\u043E\u0437\u0443\u043C\u0456\u043B\u0438\u0439 \u043E\u0441\u043D\u043E\u0432\u043D\u0438\u0439 \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A.","broken-internal-link":"\u041E\u043D\u043E\u0432\u0456\u0442\u044C \u0430\u0431\u043E \u043F\u0440\u0438\u0431\u0435\u0440\u0456\u0442\u044C \u0432\u043D\u0443\u0442\u0440\u0456\u0448\u043D\u0454 \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F \u0447\u0438 \u0432\u0456\u0434\u043D\u043E\u0432\u0456\u0442\u044C \u0439\u043E\u0433\u043E \u0446\u0456\u043B\u044C.","orphan-sitemap-page":"\u0414\u043E\u0434\u0430\u0439\u0442\u0435 \u0437\u043C\u0456\u0441\u0442\u043E\u0432\u043D\u0456 \u0432\u043D\u0443\u0442\u0440\u0456\u0448\u043D\u0456 \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F \u043D\u0430 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0443 \u0456\u0437 sitemap.","crawlable-not-in-sitemap":"\u0414\u043E\u0434\u0430\u0439\u0442\u0435 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0443 \u0434\u043E sitemap \u0430\u0431\u043E \u0441\u0432\u0456\u0434\u043E\u043C\u043E \u0432\u0438\u043A\u043B\u044E\u0447\u0456\u0442\u044C \u0457\u0457.","invalid-hreflang":"\u0412\u0438\u043A\u043E\u0440\u0438\u0441\u0442\u0430\u0439\u0442\u0435 \u043A\u043E\u0440\u0435\u043A\u0442\u043D\u0456 \u043C\u043E\u0432\u043D\u0456 \u0442\u0435\u0433\u0438 \u0442\u0430 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0456 HTTP(S) alternate URL.","malformed-json-ld":"\u0412\u0438\u043F\u0440\u0430\u0432\u0442\u0435 JSON-\u0441\u0438\u043D\u0442\u0430\u043A\u0441\u0438\u0441 \u0443 \u0431\u043B\u043E\u0446\u0456 \u0441\u0442\u0440\u0443\u043A\u0442\u0443\u0440\u043E\u0432\u0430\u043D\u0438\u0445 \u0434\u0430\u043D\u0438\u0445.","http-on-https-site":"\u0412\u0438\u043A\u043E\u0440\u0438\u0441\u0442\u043E\u0432\u0443\u0439\u0442\u0435 HTTPS \u0434\u043B\u044F \u0432\u043D\u0443\u0442\u0440\u0456\u0448\u043D\u0456\u0445 URL \u0456 metadata.","invalid-language":"\u0412\u043A\u0430\u0436\u0456\u0442\u044C \u043A\u043E\u0440\u0435\u043A\u0442\u043D\u0438\u0439 \u043C\u043E\u0432\u043D\u0438\u0439 \u0442\u0435\u0433 BCP 47 \u0432 \u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456 html.","duplicate-content":"\u041E\u0431\u2019\u0454\u0434\u043D\u0430\u0439\u0442\u0435 \u0434\u0443\u0431\u043B\u044C\u043E\u0432\u0430\u043D\u0456 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0438 \u0430\u0431\u043E \u0437\u0440\u043E\u0431\u0456\u0442\u044C \u0457\u0445\u043D\u0456\u0439 \u043E\u0441\u043D\u043E\u0432\u043D\u0438\u0439 \u043A\u043E\u043D\u0442\u0435\u043D\u0442 \u0432\u0456\u0434\u043C\u0456\u043D\u043D\u0438\u043C.","multiple-h1":"\u041F\u0435\u0440\u0435\u0432\u0456\u0440\u0442\u0435, \u0447\u0438 \u043E\u0434\u0438\u043D \u043E\u0441\u043D\u043E\u0432\u043D\u0438\u0439 H1 \u043D\u0435 \u0437\u0440\u043E\u0431\u0438\u0442\u044C \u0456\u0454\u0440\u0430\u0440\u0445\u0456\u044E \u0437\u0440\u043E\u0437\u0443\u043C\u0456\u043B\u0456\u0448\u043E\u044E.","missing-open-graph":"\u0414\u043E\u0434\u0430\u0439\u0442\u0435 Open Graph title, description \u0442\u0430 image \u0434\u043B\u044F \u043F\u043E\u0448\u0438\u0440\u0435\u043D\u043D\u044F \u0432 \u0441\u043E\u0446\u043C\u0435\u0440\u0435\u0436\u0430\u0445.","missing-twitter-metadata":"\u0414\u043E\u0434\u0430\u0439\u0442\u0435 Twitter card metadata, \u044F\u043A\u0449\u043E \u0432\u0430\u0436\u043B\u0438\u0432\u0456 \u0441\u043E\u0446\u0456\u0430\u043B\u044C\u043D\u0456 \u043F\u0440\u0435\u0432\u2019\u044E.","image-missing-alt":"\u0414\u043E\u0434\u0430\u0439\u0442\u0435 \u0437\u043C\u0456\u0441\u0442\u043E\u0432\u043D\u0438\u0439 alt \u0430\u0431\u043E \u043F\u043E\u0440\u043E\u0436\u043D\u0456\u0439 alt \u0434\u043B\u044F \u0434\u0435\u043A\u043E\u0440\u0430\u0442\u0438\u0432\u043D\u0438\u0445 \u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u044C.","low-word-count":"\u041F\u0435\u0440\u0435\u0432\u0456\u0440\u0442\u0435, \u0447\u0438 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u043C\u0456\u0441\u0442\u0438\u0442\u044C \u0434\u043E\u0441\u0442\u0430\u0442\u043D\u044C\u043E \u043A\u043E\u0440\u0438\u0441\u043D\u043E\u0433\u043E \u043E\u0441\u043D\u043E\u0432\u043D\u043E\u0433\u043E \u043A\u043E\u043D\u0442\u0435\u043D\u0442\u0443.","robots-changed":"\u041F\u0435\u0440\u0435\u0432\u0456\u0440\u0442\u0435 \u0437\u043C\u0456\u043D\u0443 robots.txt \u0456 \u043F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u044C\u0442\u0435, \u0449\u043E \u0434\u043E\u0441\u0442\u0443\u043F \u0434\u043B\u044F \u0441\u043A\u0430\u043D\u0443\u0432\u0430\u043D\u043D\u044F \u0437\u043C\u0456\u043D\u0435\u043D\u043E \u0441\u0432\u0456\u0434\u043E\u043C\u043E.","page-missing":"\u0414\u043E\u0434\u0430\u0439\u0442\u0435 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0443 \u0434\u043E \u043F\u0435\u0440\u0435\u0432\u0456\u0440\u043A\u0438 \u0430\u0431\u043E \u043F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u044C\u0442\u0435, \u0449\u043E \u0457\u0457 \u0432\u0438\u0434\u0430\u043B\u0435\u043D\u043E \u0441\u0432\u0456\u0434\u043E\u043C\u043E.","status-regression":"\u0412\u0456\u0434\u043D\u043E\u0432\u0456\u0442\u044C \u043F\u043E\u043F\u0435\u0440\u0435\u0434\u043D\u044E \u0443\u0441\u043F\u0456\u0448\u043D\u0443 HTTP-\u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u044C.","new-noindex":"\u041F\u0440\u0438\u0431\u0435\u0440\u0456\u0442\u044C \u043D\u043E\u0432\u0438\u0439 noindex, \u044F\u043A\u0449\u043E \u0439\u043E\u0433\u043E \u043D\u0435 \u0434\u043E\u0434\u0430\u043D\u043E \u043D\u0430\u0432\u043C\u0438\u0441\u043D\u043E.","title-removed":"\u0412\u0456\u0434\u043D\u043E\u0432\u0456\u0442\u044C \u0437\u043C\u0456\u0441\u0442\u043E\u0432\u043D\u0438\u0439 title.","title-changed":"\u041F\u0435\u0440\u0435\u0432\u0456\u0440\u0442\u0435 \u0442\u0430 \u043F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u044C\u0442\u0435 \u0437\u043C\u0456\u043D\u0435\u043D\u0438\u0439 title.","description-removed":"\u0412\u0456\u0434\u043D\u043E\u0432\u0456\u0442\u044C \u043A\u043E\u0440\u0438\u0441\u043D\u0438\u0439 meta description.","canonical-removed":"\u0412\u0456\u0434\u043D\u043E\u0432\u0456\u0442\u044C canonical.","canonical-changed":"\u041F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u044C\u0442\u0435, \u0449\u043E \u043D\u043E\u0432\u0430 \u0446\u0456\u043B\u044C canonical \u0441\u0432\u0456\u0434\u043E\u043C\u0430 \u0439 \u043A\u043E\u0440\u0435\u043A\u0442\u043D\u0430.","h1-removed":"\u0412\u0456\u0434\u043D\u043E\u0432\u0456\u0442\u044C \u0437\u0440\u043E\u0437\u0443\u043C\u0456\u043B\u0438\u0439 \u043E\u0441\u043D\u043E\u0432\u043D\u0438\u0439 \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A.","redirect-changed":"\u041F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u044C\u0442\u0435, \u0449\u043E \u043D\u043E\u0432\u0430 \u0446\u0456\u043B\u044C \u043F\u0435\u0440\u0435\u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u043D\u044F \u0441\u0432\u0456\u0434\u043E\u043C\u0430.","sitemap-url-count-drop":"\u0414\u043E\u0441\u043B\u0456\u0434\u0456\u0442\u044C \u0432\u0442\u0440\u0430\u0442\u0443 URL \u0443 sitemap \u0456 \u043F\u043E\u0432\u0435\u0440\u043D\u0456\u0442\u044C \u043F\u0440\u043E\u043F\u0443\u0449\u0435\u043D\u0456 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0438 \u0434\u043B\u044F \u0456\u043D\u0434\u0435\u043A\u0441\u0430\u0446\u0456\u0457."};function uu(e){return e.evidence?.actual??e.after}function Au(e,t){let r=uu(e);switch(t){case"page-unreachable":case"redirect-loop":return`\u0417\u0430\u043F\u0438\u0442 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0432\u0441\u044F \u043F\u043E\u043C\u0438\u043B\u043A\u043E\u044E: ${String(r??"\u043D\u0435\u0432\u0456\u0434\u043E\u043C\u0430 \u043F\u043E\u043C\u0438\u043B\u043A\u0430")}`;case"http-error":return`\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u043F\u043E\u0432\u0435\u0440\u043D\u0443\u043B\u0430 HTTP ${String(r??"\u043D\u0435\u0432\u0456\u0434\u043E\u043C\u043E")}`;case"noindex":return"\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u043C\u0456\u0441\u0442\u0438\u0442\u044C \u0434\u0438\u0440\u0435\u043A\u0442\u0438\u0432\u0443 noindex \u0443 meta";case"x-robots-noindex":return"\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u043C\u0456\u0441\u0442\u0438\u0442\u044C noindex \u0443 X-Robots-Tag";case"robots-blocked":return e.before===!1?"\u0422\u0435\u043F\u0435\u0440 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0443 \u0437\u0430\u0431\u043B\u043E\u043A\u043E\u0432\u0430\u043D\u043E \u0447\u0435\u0440\u0435\u0437 robots.txt":"\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0443 \u0437\u0430\u0431\u043B\u043E\u043A\u043E\u0432\u0430\u043D\u043E \u0447\u0435\u0440\u0435\u0437 robots.txt";case"missing-canonical":return"\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u043D\u0435 \u043C\u0456\u0441\u0442\u0438\u0442\u044C canonical URL";case"invalid-canonical":return"Canonical URL \u043D\u0435\u043A\u043E\u0440\u0435\u043A\u0442\u043D\u0438\u0439";case"cross-domain-canonical":return"Canonical \u0432\u043A\u0430\u0437\u0443\u0454 \u043D\u0430 \u0456\u043D\u0448\u0438\u0439 \u0434\u043E\u043C\u0435\u043D";case"canonical-target-error":return"\u0426\u0456\u043B\u044C canonical \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0430";case"long-redirect-chain":return`\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u0432\u0438\u043A\u043E\u0440\u0438\u0441\u0442\u043E\u0432\u0443\u0454 ${String(r??0)} \u043F\u0435\u0440\u0435\u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u044C`;case"sitemap-unavailable":return"\u041D\u0435 \u0432\u0434\u0430\u043B\u043E\u0441\u044F \u0437\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0438\u0442\u0438 \u043D\u0430\u043B\u0430\u0448\u0442\u043E\u0432\u0430\u043D\u0438\u0439 sitemap";case"noindex-in-sitemap":return"URL \u0456\u0437 sitemap \u043F\u043E\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0439 noindex";case"redirect-in-sitemap":return"URL \u0456\u0437 sitemap \u043F\u0435\u0440\u0435\u043D\u0430\u043F\u0440\u0430\u0432\u043B\u044F\u0454\u0442\u044C\u0441\u044F";case"missing-title":return"\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u043D\u0435 \u043C\u0430\u0454 title";case"duplicate-title":return"\u041A\u0456\u043B\u044C\u043A\u0430 \u0441\u0442\u043E\u0440\u0456\u043D\u043E\u043A \u043C\u0430\u044E\u0442\u044C \u043E\u0434\u043D\u0430\u043A\u043E\u0432\u0438\u0439 title";case"title-length":return`\u0414\u043E\u0432\u0436\u0438\u043D\u0430 title \u2014 ${String(r??0)} \u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432`;case"missing-description":return"\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u043D\u0435 \u043C\u0430\u0454 meta description";case"duplicate-description":return"\u041A\u0456\u043B\u044C\u043A\u0430 \u0441\u0442\u043E\u0440\u0456\u043D\u043E\u043A \u043C\u0430\u044E\u0442\u044C \u043E\u0434\u043D\u0430\u043A\u043E\u0432\u0438\u0439 meta description";case"description-length":return`\u0414\u043E\u0432\u0436\u0438\u043D\u0430 description \u2014 ${String(r??0)} \u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432`;case"missing-h1":return"\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u043D\u0435 \u043C\u0456\u0441\u0442\u0438\u0442\u044C \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043A\u0430 H1";case"multiple-h1":return`\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u043C\u0456\u0441\u0442\u0438\u0442\u044C H1 \u0443 \u043A\u0456\u043B\u044C\u043A\u043E\u0441\u0442\u0456: ${String(r??0)}`;case"broken-internal-link":return"\u0412\u043D\u0443\u0442\u0440\u0456\u0448\u043D\u0454 \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F \u0432\u0435\u0434\u0435 \u043D\u0430 \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0443 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0443";case"orphan-sitemap-page":return"\u041D\u0430 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0443 \u0456\u0437 sitemap \u043D\u0435 \u0437\u043D\u0430\u0439\u0434\u0435\u043D\u043E \u0432\u043D\u0443\u0442\u0440\u0456\u0448\u043D\u0456\u0445 \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u044C";case"crawlable-not-in-sitemap":return"\u0414\u043E\u0441\u0442\u0443\u043F\u043D\u0430 \u0434\u043B\u044F \u0441\u043A\u0430\u043D\u0443\u0432\u0430\u043D\u043D\u044F \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u0432\u0456\u0434\u0441\u0443\u0442\u043D\u044F \u0443 sitemap";case"invalid-hreflang":return"\u041E\u0433\u043E\u043B\u043E\u0448\u0435\u043D\u043D\u044F hreflang \u043D\u0435\u043A\u043E\u0440\u0435\u043A\u0442\u043D\u0435";case"malformed-json-ld":return"\u0411\u043B\u043E\u043A JSON-LD \u043C\u0456\u0441\u0442\u0438\u0442\u044C \u043D\u0435\u043A\u043E\u0440\u0435\u043A\u0442\u043D\u0438\u0439 JSON";case"http-on-https-site":return"HTTPS-\u0441\u0430\u0439\u0442 \u043F\u043E\u0441\u0438\u043B\u0430\u0454\u0442\u044C\u0441\u044F \u043D\u0430 \u0432\u043D\u0443\u0442\u0440\u0456\u0448\u043D\u0456\u0439 HTTP URL";case"invalid-language":return"\u041E\u0433\u043E\u043B\u043E\u0448\u0435\u043D\u043D\u044F \u043C\u043E\u0432\u0438 HTML \u043D\u0435\u043A\u043E\u0440\u0435\u043A\u0442\u043D\u0435";case"duplicate-content":return"\u041E\u0441\u043D\u043E\u0432\u043D\u0438\u0439 \u0442\u0435\u043A\u0441\u0442 \u0454 \u0442\u043E\u0447\u043D\u0438\u043C \u0434\u0443\u0431\u043B\u0435\u043C \u0456\u043D\u0448\u043E\u0457 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0438";case"missing-open-graph":return"Open Graph metadata \u043D\u0435\u043F\u043E\u0432\u043D\u0456";case"missing-twitter-metadata":return"Twitter card metadata \u043D\u0435\u043F\u043E\u0432\u043D\u0456";case"image-missing-alt":return`${Array.isArray(r)?r.length:String(r??0)} \u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u044C \u043D\u0435 \u043C\u0430\u044E\u0442\u044C \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 alt`;case"low-word-count":return`\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u043C\u0456\u0441\u0442\u0438\u0442\u044C \u043F\u0440\u0438\u0431\u043B\u0438\u0437\u043D\u043E ${String(r??0)} \u0432\u0438\u0434\u0438\u043C\u0438\u0445 \u0441\u043B\u0456\u0432`;case"robots-changed":return"\u0412\u043C\u0456\u0441\u0442 robots.txt \u0437\u043C\u0456\u043D\u0438\u0432\u0441\u044F";case"page-missing":return"\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0443 \u043D\u0435 \u0431\u0443\u043B\u043E \u043F\u0435\u0440\u0435\u0432\u0456\u0440\u0435\u043D\u043E";case"status-regression":return`HTTP-\u0441\u0442\u0430\u0442\u0443\u0441 \u043F\u043E\u0433\u0456\u0440\u0448\u0438\u0432\u0441\u044F \u0437 ${String(e.before??"\u043D\u0435\u0432\u0456\u0434\u043E\u043C\u043E")} \u0434\u043E ${String(e.after??"\u0432\u0456\u0434\u0441\u0443\u0442\u043D\u0456\u0439")}`;case"new-noindex":return"\u0422\u0435\u043F\u0435\u0440 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u043C\u0456\u0441\u0442\u0438\u0442\u044C \u0434\u0438\u0440\u0435\u043A\u0442\u0438\u0432\u0443 noindex";case"title-removed":return"Title \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0438 \u0432\u0438\u0434\u0430\u043B\u0435\u043D\u043E";case"title-changed":return"Title \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0438 \u0437\u043C\u0456\u043D\u0435\u043D\u043E";case"description-removed":return"Meta description \u0432\u0438\u0434\u0430\u043B\u0435\u043D\u043E";case"canonical-removed":return"Canonical URL \u0432\u0438\u0434\u0430\u043B\u0435\u043D\u043E";case"canonical-changed":return"Canonical URL \u0437\u043C\u0456\u043D\u0435\u043D\u043E";case"h1-removed":return"\u0423\u0441\u0456 \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043A\u0438 H1 \u0432\u0438\u0434\u0430\u043B\u0435\u043D\u043E";case"redirect-changed":return"\u041A\u0456\u043D\u0446\u0435\u0432\u0438\u0439 URL \u043F\u0435\u0440\u0435\u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u043D\u044F \u0437\u043C\u0456\u043D\u0435\u043D\u043E";case"sitemap-url-count-drop":return`\u041A\u0456\u043B\u044C\u043A\u0456\u0441\u0442\u044C URL \u0443 sitemap \u0437\u043C\u0435\u043D\u0448\u0438\u043B\u0430\u0441\u044F \u043D\u0430 ${String((Number(e.before)||0)-(Number(e.after)||0))}`;default:return e.message??"\u041F\u0435\u0440\u0435\u0432\u0456\u0440\u0442\u0435 \u043F\u0440\u043E\u0431\u043B\u0435\u043C\u0443 \u0442\u0430 \u043F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u044C\u0442\u0435 \u043E\u0447\u0456\u043A\u0443\u0432\u0430\u043D\u0443 \u043F\u043E\u0432\u0435\u0434\u0456\u043D\u043A\u0443."}}function ki(e,t){let r=e.remediation??"Review the finding and confirm the intended behavior.";return{en:{rule:Di(t),message:e.message??"",remediation:r},uk:{rule:lu[t]??Di(t),message:Au(e,t),remediation:du[t]??"\u041F\u0435\u0440\u0435\u0432\u0456\u0440\u0442\u0435 \u043F\u0440\u043E\u0431\u043B\u0435\u043C\u0443 \u0442\u0430 \u043F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u044C\u0442\u0435 \u043E\u0447\u0456\u043A\u0443\u0432\u0430\u043D\u0443 \u043F\u043E\u0432\u0435\u0434\u0456\u043D\u043A\u0443."}}}var Bi={en:{language:"Language",titles:{partial:"Partial SEO scan report",check:"SEO regression report",scan:"SEO baseline audit"},generated:"Generated",engine:"Engine",rules:"Rules",issueLifecycle:"Issue lifecycle",partialTitle:"Partial results.",partialMessage:"This report contains the pages saved so far. Run the same scan command again to resume without requesting them twice.",incompleteTitle:"Incomplete comparison.",incompleteMessage:"Regressions found on checked pages are shown, but unchecked pages are not marked missing or resolved.",previewTitle:"Preview deployment comparison.",production:"Production",preview:"Preview",cards:{pages:"Pages checked",error:"Errors",warning:"Warnings",info:"Info",affected:"Affected pages"},analytics:{title:"Issue statistics",hint:"Select a chart item to filter the issue table.",severity:"By severity",topRules:"Most frequent checks",owners:"By owner",lifecycle:"By lifecycle",templates:"Affected page templates",total:"Total issues",noData:"No issues to chart.",filterBy:"Filter by"},history:{title:"Local scan history",hint:"Issue trends from snapshots stored on this device.",chartLabel:"Issue trend across runs.",runs:"Runs",pages:"Latest pages",newIssues:"New issues",resolvedIssues:"Resolved issues",sitemapUrls:"Sitemap URLs",maxDepth:"Maximum crawl depth"},tabs:{current:"Current / all",new:"New",ongoing:"Ongoing",resolved:"Resolved",unchanged:"Unchanged"},filters:{search:"URL or text",searchPlaceholder:"URL, check, or message",severity:"Severity",rule:"Check",template:"Page template",owner:"Owner",rows:"Rows"},all:{severity:"All severities",rule:"All checks",template:"All templates",owner:"All owners"},severities:{error:"Error",warning:"Warning",info:"Info"},owners:{seo:"SEO",content:"Content",developer:"Developer"},rows:{100:"100 per page",250:"250 per page",500:"500 per page"},guide:{error:"Errors",errorText:"need attention first.",warning:"Warnings",warningText:"are important improvements.",info:"Info",infoText:"is useful context.",score:"No opaque SEO score is used."},exportCsv:"Export CSV",previous:"Previous",next:"Next",table:{severity:"Severity",lifecycle:"Lifecycle",ruleOwner:"Check / owner",page:"Page",finding:"What was found",change:"Change",before:"Before",evidence:"Evidence / after",remediation:"Remediation",fingerprint:"Fingerprint"},empty:{cleanTitle:"No SEO issues found",cleanMessage:"The scanned pages passed all current checks.",filteredTitle:"No matching issues",filteredMessage:"Try a different lifecycle tab or clear the selected filters.",clear:"Clear filters"},lifecycle:{current:"Current",new:"New",ongoing:"Ongoing",resolved:"Resolved",unchanged:"Unchanged"},notPresent:"Not present",page:"Page",of:"of",issue:"issue",issues:"issues",docs:"docs",footer:"Generated locally. No report data was uploaded."},uk:{language:"\u041C\u043E\u0432\u0430",titles:{partial:"\u0417\u0432\u0456\u0442 \u0447\u0430\u0441\u0442\u043A\u043E\u0432\u043E\u0433\u043E SEO-\u0441\u043A\u0430\u043D\u0443\u0432\u0430\u043D\u043D\u044F",check:"\u0417\u0432\u0456\u0442 \u043F\u0440\u043E SEO-\u0440\u0435\u0433\u0440\u0435\u0441\u0456\u0457",scan:"\u0411\u0430\u0437\u043E\u0432\u0438\u0439 SEO-\u0430\u0443\u0434\u0438\u0442"},generated:"\u0421\u0442\u0432\u043E\u0440\u0435\u043D\u043E",engine:"\u0420\u0443\u0448\u0456\u0439",rules:"\u041F\u0440\u0430\u0432\u0438\u043B\u0430",issueLifecycle:"\u0421\u0442\u0430\u043D\u0438 \u043F\u0440\u043E\u0431\u043B\u0435\u043C",partialTitle:"\u0427\u0430\u0441\u0442\u043A\u043E\u0432\u0456 \u0440\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442\u0438.",partialMessage:"\u0417\u0432\u0456\u0442 \u043C\u0456\u0441\u0442\u0438\u0442\u044C \u0443\u0436\u0435 \u0437\u0431\u0435\u0440\u0435\u0436\u0435\u043D\u0456 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0438. \u0417\u0430\u043F\u0443\u0441\u0442\u0456\u0442\u044C \u0442\u0443 \u0441\u0430\u043C\u0443 \u043A\u043E\u043C\u0430\u043D\u0434\u0443 \u0449\u0435 \u0440\u0430\u0437, \u0449\u043E\u0431 \u043F\u0440\u043E\u0434\u043E\u0432\u0436\u0438\u0442\u0438 \u0431\u0435\u0437 \u043F\u043E\u0432\u0442\u043E\u0440\u043D\u0438\u0445 \u0437\u0430\u043F\u0438\u0442\u0456\u0432.",incompleteTitle:"\u041D\u0435\u043F\u043E\u0432\u043D\u0435 \u043F\u043E\u0440\u0456\u0432\u043D\u044F\u043D\u043D\u044F.",incompleteMessage:"\u041F\u043E\u043A\u0430\u0437\u0430\u043D\u043E \u0440\u0435\u0433\u0440\u0435\u0441\u0456\u0457 \u043D\u0430 \u043F\u0435\u0440\u0435\u0432\u0456\u0440\u0435\u043D\u0438\u0445 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0430\u0445, \u0430\u043B\u0435 \u043D\u0435\u043F\u0435\u0440\u0435\u0432\u0456\u0440\u0435\u043D\u0456 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0438 \u043D\u0435 \u043F\u043E\u0437\u043D\u0430\u0447\u0435\u043D\u043E \u044F\u043A \u0432\u0456\u0434\u0441\u0443\u0442\u043D\u0456 \u0447\u0438 \u0432\u0438\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0456.",previewTitle:"\u041F\u043E\u0440\u0456\u0432\u043D\u044F\u043D\u043D\u044F production \u0456 preview.",production:"Production",preview:"Preview",cards:{pages:"\u041F\u0435\u0440\u0435\u0432\u0456\u0440\u0435\u043D\u043E \u0441\u0442\u043E\u0440\u0456\u043D\u043E\u043A",error:"\u041F\u043E\u043C\u0438\u043B\u043A\u0438",warning:"\u041F\u043E\u043F\u0435\u0440\u0435\u0434\u0436\u0435\u043D\u043D\u044F",info:"\u0406\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0456\u044F",affected:"\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0438 \u0437 \u043F\u0440\u043E\u0431\u043B\u0435\u043C\u0430\u043C\u0438"},analytics:{title:"\u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043A\u0430 \u043F\u0440\u043E\u0431\u043B\u0435\u043C",hint:"\u041E\u0431\u0435\u0440\u0456\u0442\u044C \u0435\u043B\u0435\u043C\u0435\u043D\u0442 \u0433\u0440\u0430\u0444\u0456\u043A\u0430, \u0449\u043E\u0431 \u0432\u0456\u0434\u0444\u0456\u043B\u044C\u0442\u0440\u0443\u0432\u0430\u0442\u0438 \u0442\u0430\u0431\u043B\u0438\u0446\u044E \u043F\u0440\u043E\u0431\u043B\u0435\u043C.",severity:"\u0417\u0430 \u0432\u0430\u0436\u043B\u0438\u0432\u0456\u0441\u0442\u044E",topRules:"\u041D\u0430\u0439\u0447\u0430\u0441\u0442\u0456\u0448\u0456 \u043F\u0435\u0440\u0435\u0432\u0456\u0440\u043A\u0438",owners:"\u0417\u0430 \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u043B\u044C\u043D\u0438\u043C\u0438",lifecycle:"\u0417\u0430 \u0441\u0442\u0430\u043D\u043E\u043C",templates:"\u0428\u0430\u0431\u043B\u043E\u043D\u0438 \u0441\u0442\u043E\u0440\u0456\u043D\u043E\u043A \u0456\u0437 \u043F\u0440\u043E\u0431\u043B\u0435\u043C\u0430\u043C\u0438",total:"\u0423\u0441\u044C\u043E\u0433\u043E \u043F\u0440\u043E\u0431\u043B\u0435\u043C",noData:"\u041D\u0435\u043C\u0430\u0454 \u043F\u0440\u043E\u0431\u043B\u0435\u043C \u0434\u043B\u044F \u0432\u0456\u0434\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u043D\u044F.",filterBy:"\u0424\u0456\u043B\u044C\u0442\u0440\u0443\u0432\u0430\u0442\u0438 \u0437\u0430"},history:{title:"\u041B\u043E\u043A\u0430\u043B\u044C\u043D\u0430 \u0456\u0441\u0442\u043E\u0440\u0456\u044F \u0441\u043A\u0430\u043D\u0443\u0432\u0430\u043D\u044C",hint:"\u0414\u0438\u043D\u0430\u043C\u0456\u043A\u0430 \u043F\u0440\u043E\u0431\u043B\u0435\u043C \u0437\u0456 snapshot-\u0444\u0430\u0439\u043B\u0456\u0432, \u0437\u0431\u0435\u0440\u0435\u0436\u0435\u043D\u0438\u0445 \u043D\u0430 \u0446\u044C\u043E\u043C\u0443 \u043F\u0440\u0438\u0441\u0442\u0440\u043E\u0457.",chartLabel:"\u0414\u0438\u043D\u0430\u043C\u0456\u043A\u0430 \u043F\u0440\u043E\u0431\u043B\u0435\u043C \u0437\u0430 \u0437\u0430\u043F\u0443\u0441\u043A\u0430\u043C\u0438.",runs:"\u0417\u0430\u043F\u0443\u0441\u043A\u0438",pages:"\u0421\u0442\u043E\u0440\u0456\u043D\u043E\u043A \u0432\u043E\u0441\u0442\u0430\u043D\u043D\u0454",newIssues:"\u041D\u043E\u0432\u0456 \u043F\u0440\u043E\u0431\u043B\u0435\u043C\u0438",resolvedIssues:"\u0412\u0438\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0456 \u043F\u0440\u043E\u0431\u043B\u0435\u043C\u0438",sitemapUrls:"URL \u0443 sitemap",maxDepth:"\u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u0430 \u0433\u043B\u0438\u0431\u0438\u043D\u0430"},tabs:{current:"\u041F\u043E\u0442\u043E\u0447\u043D\u0456 / \u0443\u0441\u0456",new:"\u041D\u043E\u0432\u0456",ongoing:"\u0422\u0440\u0438\u0432\u0430\u044E\u0442\u044C",resolved:"\u0412\u0438\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0456",unchanged:"\u0411\u0435\u0437 \u0437\u043C\u0456\u043D"},filters:{search:"URL \u0430\u0431\u043E \u0442\u0435\u043A\u0441\u0442",searchPlaceholder:"URL, \u043F\u0435\u0440\u0435\u0432\u0456\u0440\u043A\u0430 \u0430\u0431\u043E \u043F\u043E\u0432\u0456\u0434\u043E\u043C\u043B\u0435\u043D\u043D\u044F",severity:"\u0412\u0430\u0436\u043B\u0438\u0432\u0456\u0441\u0442\u044C",rule:"\u041F\u0435\u0440\u0435\u0432\u0456\u0440\u043A\u0430",template:"\u0428\u0430\u0431\u043B\u043E\u043D \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0438",owner:"\u0412\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u043B\u044C\u043D\u0438\u0439",rows:"\u0420\u044F\u0434\u043A\u0438"},all:{severity:"\u0423\u0441\u0456 \u0440\u0456\u0432\u043D\u0456",rule:"\u0423\u0441\u0456 \u043F\u0435\u0440\u0435\u0432\u0456\u0440\u043A\u0438",template:"\u0423\u0441\u0456 \u0448\u0430\u0431\u043B\u043E\u043D\u0438",owner:"\u0423\u0441\u0456 \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u043B\u044C\u043D\u0456"},severities:{error:"\u041F\u043E\u043C\u0438\u043B\u043A\u0430",warning:"\u041F\u043E\u043F\u0435\u0440\u0435\u0434\u0436\u0435\u043D\u043D\u044F",info:"\u0406\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0456\u044F"},owners:{seo:"SEO",content:"\u041A\u043E\u043D\u0442\u0435\u043D\u0442",developer:"\u0420\u043E\u0437\u0440\u043E\u0431\u043D\u0438\u043A"},rows:{100:"100 \u043D\u0430 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0443",250:"250 \u043D\u0430 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0443",500:"500 \u043D\u0430 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0443"},guide:{error:"\u041F\u043E\u043C\u0438\u043B\u043A\u0438",errorText:"\u043F\u043E\u0442\u0440\u0435\u0431\u0443\u044E\u0442\u044C \u043F\u0435\u0440\u0448\u043E\u0447\u0435\u0440\u0433\u043E\u0432\u043E\u0457 \u0443\u0432\u0430\u0433\u0438.",warning:"\u041F\u043E\u043F\u0435\u0440\u0435\u0434\u0436\u0435\u043D\u043D\u044F",warningText:"\u043F\u043E\u0437\u043D\u0430\u0447\u0430\u044E\u0442\u044C \u0432\u0430\u0436\u043B\u0438\u0432\u0456 \u043F\u043E\u043A\u0440\u0430\u0449\u0435\u043D\u043D\u044F.",info:"\u0406\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0456\u044F",infoText:"\u0434\u0430\u0454 \u043A\u043E\u0440\u0438\u0441\u043D\u0438\u0439 \u043A\u043E\u043D\u0442\u0435\u043A\u0441\u0442.",score:"\u041D\u0435\u043F\u0440\u043E\u0437\u043E\u0440\u0430 SEO-\u043E\u0446\u0456\u043D\u043A\u0430 \u043D\u0435 \u0432\u0438\u043A\u043E\u0440\u0438\u0441\u0442\u043E\u0432\u0443\u0454\u0442\u044C\u0441\u044F."},exportCsv:"\u0415\u043A\u0441\u043F\u043E\u0440\u0442 CSV",previous:"\u041D\u0430\u0437\u0430\u0434",next:"\u0414\u0430\u043B\u0456",table:{severity:"\u0412\u0430\u0436\u043B\u0438\u0432\u0456\u0441\u0442\u044C",lifecycle:"\u0421\u0442\u0430\u043D",ruleOwner:"\u041F\u0435\u0440\u0435\u0432\u0456\u0440\u043A\u0430 / \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u043B\u044C\u043D\u0438\u0439",page:"\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0430",finding:"\u0429\u043E \u0437\u043D\u0430\u0439\u0434\u0435\u043D\u043E",change:"\u0417\u043C\u0456\u043D\u0430",before:"\u0411\u0443\u043B\u043E",evidence:"\u0414\u043E\u043A\u0430\u0437 / \u0441\u0442\u0430\u043B\u043E",remediation:"\u042F\u043A \u0432\u0438\u043F\u0440\u0430\u0432\u0438\u0442\u0438",fingerprint:"\u0412\u0456\u0434\u0431\u0438\u0442\u043E\u043A"},empty:{cleanTitle:"SEO-\u043F\u0440\u043E\u0431\u043B\u0435\u043C \u043D\u0435 \u0437\u043D\u0430\u0439\u0434\u0435\u043D\u043E",cleanMessage:"\u041F\u0435\u0440\u0435\u0432\u0456\u0440\u0435\u043D\u0456 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0438 \u043F\u0440\u043E\u0439\u0448\u043B\u0438 \u0432\u0441\u0456 \u0430\u043A\u0442\u0438\u0432\u043D\u0456 \u043F\u0435\u0440\u0435\u0432\u0456\u0440\u043A\u0438.",filteredTitle:"\u0417\u0431\u0456\u0433\u0456\u0432 \u043D\u0435 \u0437\u043D\u0430\u0439\u0434\u0435\u043D\u043E",filteredMessage:"\u041E\u0431\u0435\u0440\u0456\u0442\u044C \u0456\u043D\u0448\u0438\u0439 \u0441\u0442\u0430\u043D \u0430\u0431\u043E \u043E\u0447\u0438\u0441\u0442\u044C\u0442\u0435 \u0444\u0456\u043B\u044C\u0442\u0440\u0438.",clear:"\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u0438 \u0444\u0456\u043B\u044C\u0442\u0440\u0438"},lifecycle:{current:"\u041F\u043E\u0442\u043E\u0447\u043D\u0430",new:"\u041D\u043E\u0432\u0430",ongoing:"\u0422\u0440\u0438\u0432\u0430\u0454",resolved:"\u0412\u0438\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0430",unchanged:"\u0411\u0435\u0437 \u0437\u043C\u0456\u043D"},notPresent:"\u0412\u0456\u0434\u0441\u0443\u0442\u043D\u0454",page:"\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0430",of:"\u0437",issue:"\u043F\u0440\u043E\u0431\u043B\u0435\u043C\u0430",issues:"\u043F\u0440\u043E\u0431\u043B\u0435\u043C",docs:"\u0434\u043E\u0432\u0456\u0434\u043A\u0430",footer:"\u0421\u0442\u0432\u043E\u0440\u0435\u043D\u043E \u043B\u043E\u043A\u0430\u043B\u044C\u043D\u043E. \u0414\u0430\u043D\u0456 \u0437\u0432\u0456\u0442\u0443 \u043D\u0456\u043A\u0443\u0434\u0438 \u043D\u0435 \u0437\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0443\u0432\u0430\u043B\u0438\u0441\u044F."}};function yr(e,t){try{let r=new URL(e,t);return r.protocol!=="http:"&&r.protocol!=="https:"?null:(r.hash="",r.href)}catch{return null}}function Pi(e){let t=new Map,r=new Map,n=new Map;for(let s of e){let a=yr(s.url);a&&t.set(a,s),r.set(s.url,{incoming:[],broken:[],redirects:[]})}for(let s of e){let a=r.get(s.url),c=new Set(s.internalLinks.map(l=>yr(l,s.finalUrl??s.url)));for(let l of c){if(!l||l===yr(s.url)||l===yr(s.finalUrl??s.url))continue;let o=t.get(l);if(!o)continue;let d=n.get(o.url)??new Set;d.add(s.url),n.set(o.url,d),!o.blockedByRobots&&(o.error||o.status!==null&&o.status>=400)&&a.broken.push(o.url),(o.redirectChain.length||o.finalUrl&&o.finalUrl!==o.url||o.status!==null&&o.status>=300&&o.status<400)&&a.redirects.push(o.url)}}for(let[s,a]of r)a.incoming=[...n.get(s)??[]].sort(),a.broken.sort(),a.redirects.sort();return r}var Ue=e=>String(e??"").replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#039;"),U=(e,t)=>`<span class="locale-en">${Ue(e)}</span><span class="locale-uk">${Ue(t)}</span>`;function Mi(e,t){let r=[...e].sort((n,s)=>s.counts.new+s.counts.resolved+s.counts.ongoing-(n.counts.new+n.counts.resolved+n.counts.ongoing)||n.id.localeCompare(s.id));return r.slice(0,20).map(n=>`<tr><td><button type="button" data-comparison-${t}="${Ue(n.id)}">${Ue(n.id)}</button></td><td>${n.counts.new}</td><td>${n.counts.ongoing}</td><td>${n.counts.resolved}</td><td>${n.affectedPages}</td></tr>`).join("")+(r.length>20?`<tr><td colspan="5">${U(`${r.length-20} more groups in the JSON summary`,`\u0429\u0435 ${r.length-20} \u0433\u0440\u0443\u043F \u0443 JSON-\u0437\u0432\u0435\u0434\u0435\u043D\u043D\u0456`)}</td></tr>`:"")}function Ui(e){let t=e.coverage,r=e.warnings.length>0?`<p class="comparison-warning">${U("Comparison warnings","\u0417\u0430\u0441\u0442\u0435\u0440\u0435\u0436\u0435\u043D\u043D\u044F \u043F\u043E\u0440\u0456\u0432\u043D\u044F\u043D\u043D\u044F")}: ${Ue(e.warnings.join(", "))}</p>`:"",n=e.unverified.length>0?`<p class="comparison-warning">${e.unverified.length} ${U("apparent resolutions lack sufficient evidence and are not counted as resolved","\u043F\u043E\u0442\u0435\u043D\u0446\u0456\u0439\u043D\u0438\u0445 \u0432\u0438\u0440\u0456\u0448\u0435\u043D\u044C \u043D\u0435 \u043C\u0430\u044E\u0442\u044C \u0434\u043E\u0441\u0442\u0430\u0442\u043D\u0456\u0445 \u0434\u043E\u043A\u0430\u0437\u0456\u0432 \u0456 \u043D\u0435 \u0432\u0440\u0430\u0445\u043E\u0432\u0430\u043D\u0456 \u044F\u043A \u0432\u0438\u0440\u0456\u0448\u0435\u043D\u0456")}</p>`:"",s=`<thead><tr><th>${U("Group","\u0413\u0440\u0443\u043F\u0430")}</th><th>${U("New","\u041D\u043E\u0432\u0456")}</th><th>${U("Ongoing","\u0422\u0440\u0438\u0432\u0430\u044E\u0442\u044C")}</th><th>${U("Resolved","\u0412\u0438\u0440\u0456\u0448\u0435\u043D\u0456")}</th><th>${U("Pages","\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0438")}</th></tr></thead>`;return`<section id="local-comparison" class="analytics" aria-labelledby="local-comparison-title"><h2 id="local-comparison-title">${U("Local run comparison","\u041F\u043E\u0440\u0456\u0432\u043D\u044F\u043D\u043D\u044F \u043B\u043E\u043A\u0430\u043B\u044C\u043D\u0438\u0445 \u0437\u0430\u043F\u0443\u0441\u043A\u0456\u0432")}</h2>
4
+ ${Hr(n??null)}`).digest("hex").slice(0,24)}function O(e,t,r,n={},s){let a=Ka.get(e);if(!a)throw new Error(`unknown rule: ${e}`);return{fingerprint:es(e,a.scope,t,s),ruleId:e,rule:e,severity:a.severity,scope:a.scope,url:t,message:r,evidence:n,owner:a.owner,remediation:a.remediation,documentationUrl:`${Ga}#${e}`,after:n.actual}}function it(e,t){return new RegExp(`(^|[\\s,])${t}($|[\\s,])`,"i").test(e??"")}function ts(e){if(e.toLowerCase()==="x-default")return!0;try{return new Intl.Locale(e),!0}catch{return!1}}function Qr(e,t){let r=new Map;for(let n of e){let s=t(n)?.trim().toLowerCase();if(!s)continue;let a=r.get(s)??[];a.push(n.url),r.set(s,a)}return new Map([...r].filter(([,n])=>n.length>1))}function rs(e){let t=[],r=o=>{t.push(o)},n=new Map(e.pages.map(o=>[o.url,o])),s=new Set(e.sitemap?.urls??[]),a=Qr(e.pages,o=>o.title),c=Qr(e.pages,o=>o.description),l=Qr(e.pages,o=>o.contentHash);e.sitemap?.error&&r(O("sitemap-unavailable",e.sitemap.url,"The configured sitemap could not be loaded",{actual:e.sitemap.error}));for(let o of e.pages){if(o.blockedByRobots){r(O("robots-blocked",o.url,"Page is blocked by robots.txt",{actual:!0}));continue}if(o.error){r(O(o.error.includes("redirect loop")?"redirect-loop":"page-unreachable",o.url,`Page request failed: ${o.error}`,{actual:o.error,redirectChain:o.redirectChain}));continue}if((o.status===null||o.status>=400)&&r(O("http-error",o.url,`Page returned HTTP ${o.status??"unknown"}`,{actual:o.status})),it(o.robots,"noindex")&&r(O("noindex",o.url,"Page contains a noindex meta directive",{actual:o.robots})),it(o.xRobotsTag,"noindex")&&r(O("x-robots-noindex",o.url,"Page contains a noindex X-Robots-Tag",{actual:o.xRobotsTag})),!o.canonicalRaw&&!o.canonical&&r(O("missing-canonical",o.url,"Page does not declare a canonical URL",{actual:null})),o.canonicalRaw&&!o.canonical&&r(O("invalid-canonical",o.url,"Canonical URL is invalid",{actual:o.canonicalRaw})),o.canonical&&new URL(o.canonical).origin!==new URL(e.siteUrl).origin&&r(O("cross-domain-canonical",o.url,"Canonical points to another origin",{actual:o.canonical})),o.canonical){let p=n.get(o.canonical);p&&(p.error||(p.status??500)>=400)&&r(O("canonical-target-error",o.url,"Canonical target is unavailable",{target:o.canonical,actual:p.status??p.error},o.canonical))}o.redirectChain.length>3&&r(O("long-redirect-chain",o.url,`Page uses ${o.redirectChain.length} redirects`,{actual:o.redirectChain.length,redirectChain:o.redirectChain})),s.has(o.url)&&(it(o.robots,"noindex")||it(o.xRobotsTag,"noindex"))&&r(O("noindex-in-sitemap",o.url,"Sitemap URL is marked noindex",{actual:o.robots??o.xRobotsTag})),s.has(o.url)&&o.redirectChain.length>0&&r(O("redirect-in-sitemap",o.url,"Sitemap URL redirects",{actual:o.finalUrl,redirectChain:o.redirectChain})),o.title?(a.get(o.title.trim().toLowerCase())&&r(O("duplicate-title",o.url,"Title is shared by multiple pages",{actual:o.title,urls:a.get(o.title.trim().toLowerCase())},o.title.trim().toLowerCase())),(o.title.length<10||o.title.length>60)&&r(O("title-length",o.url,`Title length is ${o.title.length} characters`,{actual:o.title.length,value:o.title}))):r(O("missing-title",o.url,"Page does not have a title",{actual:null})),o.description?(c.get(o.description.trim().toLowerCase())&&r(O("duplicate-description",o.url,"Meta description is shared by multiple pages",{actual:o.description,urls:c.get(o.description.trim().toLowerCase())},o.description.trim().toLowerCase())),(o.description.length<50||o.description.length>160)&&r(O("description-length",o.url,`Description length is ${o.description.length} characters`,{actual:o.description.length,value:o.description}))):r(O("missing-description",o.url,"Page does not have a meta description",{actual:null})),o.h1Count===0?r(O("missing-h1",o.url,"Page does not contain an H1 heading",{actual:0})):o.h1Count>1&&r(O("multiple-h1",o.url,`Page contains ${o.h1Count} H1 headings`,{actual:o.h1Count}));for(let p of o.internalLinks){let h=n.get(p);h&&(h.error||(h.status??500)>=400)&&r(O("broken-internal-link",o.url,"Internal link points to an unavailable page",{target:p,actual:h.status??h.error},p))}s.has(o.url)&&o.url!==e.siteUrl&&e.linkGraph.orphanUrls.includes(o.url)&&r(O("orphan-sitemap-page",o.url,"Sitemap page has no discovered internal links",{actual:!0})),e.sitemap&&!s.has(o.url)&&!it(o.robots,"noindex")&&(o.status??500)<400&&r(O("crawlable-not-in-sitemap",o.url,"Crawlable page is absent from the sitemap",{actual:!1}));for(let p of o.hreflang)(!ts(p.lang)||!p.url)&&r(O("invalid-hreflang",o.url,"Hreflang declaration is invalid",{actual:p},p));for(let[p,h]of o.jsonLd.entries())h.valid||r(O("malformed-json-ld",o.url,"JSON-LD block contains invalid JSON",{actual:h.error,index:p},p));e.siteUrl.startsWith("https:")&&[o.url,o.canonical,...o.internalLinks].some(p=>p?.startsWith("http:"))&&r(O("http-on-https-site",o.url,"HTTPS site references an internal HTTP URL",{actual:[o.url,o.canonical,...o.internalLinks].filter(p=>p?.startsWith("http:"))})),o.lang&&!ts(o.lang)&&r(O("invalid-language",o.url,"HTML language declaration is invalid",{actual:o.lang})),o.contentHash&&l.get(o.contentHash)&&r(O("duplicate-content",o.url,"Main text is an exact duplicate of another page",{urls:l.get(o.contentHash)},o.contentHash)),(!o.openGraph.title||!o.openGraph.description||!o.openGraph.image)&&r(O("missing-open-graph",o.url,"Open Graph metadata is incomplete",{actual:o.openGraph})),(!o.twitter.card||!o.twitter.title||!o.twitter.description||!o.twitter.image)&&r(O("missing-twitter-metadata",o.url,"Twitter card metadata is incomplete",{actual:o.twitter}));let d=o.images.filter(p=>p.alt===null).map(p=>p.src);d.length>0&&r(O("image-missing-alt",o.url,`${d.length} image(s) do not have an alt attribute`,{actual:d})),o.wordCount<200&&r(O("low-word-count",o.url,`Page contains approximately ${o.wordCount} visible words`,{actual:o.wordCount}))}return t}var ns={error:0,warning:1,info:2};function Ja(e,t){let r=(()=>{try{return new URL(e).pathname}catch{return e}})(),n=t.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replaceAll("**","\0").replaceAll("*","[^/]*").replaceAll("\0",".*"),s=new RegExp(`^${n}$`);return s.test(r)||s.test(e)}function ja(e,t,r){return t.find(n=>n.rule!==e.ruleId||!Ja(e.url,n.urlPattern)?!1:n.expiresAt?new Date(`${n.expiresAt}T23:59:59.999Z`).getTime()>=r.getTime():!0)??null}function Qe(e){return e.sort((t,r)=>ns[t.severity]-ns[r.severity]||t.url.localeCompare(r.url)||t.ruleId.localeCompare(r.ruleId)||t.fingerprint.localeCompare(r.fingerprint))}function at(e,t,r={}){let n=r.enabledRules??t.config.enabledRules,s=n?new Set(n):null,a={...t.config.severityOverrides,...r.severityOverrides??{}},c=r.suppressions??t.config.suppressions,l=new Date(r.now??Date.now());return Qe(e.filter(o=>!s||s.has(o.ruleId)).map(o=>({...o,severity:a[o.ruleId]??o.severity})).filter(o=>!ja(o,c,l)))}import{createHash as $a}from"node:crypto";var X="0.14.1",ot="1.1.0",Va="seo-crawl-audit",_e=`${Va}/${X}`;var Xa={title:null,description:null,image:null},Za={card:null,title:null,description:null,image:null};function ss(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("snapshot must be an object");return e}function za(e){if(!e||typeof e!="object"||typeof e.url!="string")throw new Error("snapshot page URL must be a string");return e}function Yr(e){return Array.isArray(e)?`[${e.map(Yr).join(",")}]`:e&&typeof e=="object"?`{${Object.entries(e).sort(([t],[r])=>t.localeCompare(r)).map(([t,r])=>`${JSON.stringify(t)}:${Yr(r)}`).join(",")}}`:JSON.stringify(e)}function qa(e){return $a("sha256").update(Yr(e)).digest("hex")}function eo(e){return{url:e.url,finalUrl:e.finalUrl??null,status:e.status??null,contentType:e.contentType??null,blockedByRobots:e.blockedByRobots??!1,error:e.error??null,title:e.title??null,description:e.description??null,canonical:e.canonical??null,canonicalRaw:e.canonicalRaw??e.canonical??null,robots:e.robots??null,xRobotsTag:e.xRobotsTag??null,lang:e.lang??null,h1Count:e.h1Count??0,openGraph:e.openGraph??Xa,twitter:e.twitter??Za,hreflang:e.hreflang??[],jsonLd:e.jsonLd??[],images:e.images??[],links:[...e.links??[]].sort(),internalLinks:[...e.internalLinks??[]].sort(),externalLinks:[...e.externalLinks??[]].sort(),wordCount:e.wordCount??0,contentHash:e.contentHash??null,depth:e.depth??0,redirectChain:e.redirectChain??[],responseBytes:e.responseBytes??0}}function to(e){let t=e.source??{},r=e.options??{},n=e.pages?.[0],s=n&&typeof n=="object"?n.url:void 0,a=e.siteUrl??e.startUrl??t.startUrl??(typeof s=="string"?s:void 0);if(!a)throw new Error("snapshot site URL must be a string");return{schemaVersion:1,url:a,sitemap:r.sitemap??t.sitemap??"auto",maxPages:r.maxPages??t.maxPages??100,concurrency:r.concurrency??5,delay:r.requestDelay??t.requestDelay??100,timeout:r.timeout??1e4,respectRobots:r.respectRobots??t.respectRobots??!0,includeQuery:r.includeQuery??t.includeQuery??!1,maxRedirects:r.maxRedirects??10,maxResponseBytes:r.maxResponseBytes??5*1024*1024,enabledRules:r.enabledRules??null,severityOverrides:r.severityOverrides??{},suppressions:r.suppressions??[],regressionBudgets:r.regressionBudgets??{},report:r.report??{}}}function ro(e,t){let r=new Set(e.map(a=>a.url)),n=new Set(e.flatMap(a=>a.internalLinks)),s=new Set;for(let a of e)(a.error||a.blockedByRobots||(a.status??500)>=400)&&s.add(a.url);return{internalEdges:e.reduce((a,c)=>a+c.internalLinks.length,0),externalEdges:e.reduce((a,c)=>a+c.externalLinks.length,0),orphanUrls:t.filter(a=>r.has(a)&&!n.has(a)),brokenInternalUrls:[...s].sort()}}function no(e,t){let r=t.filter(s=>s.blockedByRobots).length,n=t.filter(s=>s.error||(s.status??500)>=400).length;return{requested:e.requested??t.length,completed:t.length,succeeded:t.length-n-r,failed:n,blockedByRobots:r,redirected:t.filter(s=>s.redirectChain.length>0||s.url!==s.finalUrl).length,durationMs:e.durationMs??0,truncated:e.truncated??!1,partial:e.partial??!1}}function Ie(e){let t=ss(e),r=to(t),n=(t.pages??[]).map(o=>eo(za(o))).sort((o,d)=>o.url.localeCompare(d.url)),s=t.sitemap?.urls??[];if(t.sitemap&&!t.sitemap.url)throw new Error("snapshot sitemap URL must be a string");let a=t.sitemap?{url:t.sitemap.url,urls:[...s].sort(),sitemapCount:t.sitemap.sitemapCount??0,truncated:t.sitemap.truncated??!1,error:t.sitemap.error??null}:null,c=t.startUrl??r.url,l=t.truncated??!1;return{schemaVersion:2,engineVersion:X,ruleSetVersion:ot,generatedAt:t.generatedAt??new Date().toISOString(),siteUrl:c,configurationHash:qa(r),config:r,robots:{url:t.robots?.url??new URL("/robots.txt",c).href,status:t.robots?.status??null,sha256:t.robots?.sha256??null,error:t.robots?.error??null,denyAll:t.robots?.denyAll??!1},sitemap:a,pages:n,linkGraph:t.linkGraph??ro(n,s),statistics:t.statistics??no(t,n),partial:t.partial??!1,source:{startUrl:c,maxPages:r.maxPages,requestDelay:r.delay,includeQuery:r.includeQuery,respectRobots:r.respectRobots,sitemap:typeof r.sitemap=="string"&&!["auto","none"].includes(r.sitemap)?r.sitemap:null},truncated:l}}function ye(e){let t=ss(e);if(!Array.isArray(t.pages))throw new Error("snapshot pages must be an array");if(t.schemaVersion===2)return Ie({...t,startUrl:t.siteUrl,options:t.config,pages:t.pages,generatedAt:t.generatedAt,partial:t.partial,statistics:t.statistics,linkGraph:t.linkGraph});if(t.schemaVersion===1)return Ie(t);throw new Error(`unsupported snapshot schema version: ${String(t.schemaVersion)}`)}function Re(e){if(e.schemaVersion===2)return e;let t=e,r=t.pages?.[0],n=r&&typeof r=="object"?r.url:void 0,s=typeof n=="string"?n:t.source?.startUrl??"https://invalid.local/";return Ie({...t,startUrl:t.siteUrl??t.source?.startUrl??s,robots:t.robots??{url:new URL("/robots.txt",s).href,status:null,sha256:null,error:null},options:t.config??t.options??{}})}function me(e,t={}){let r=Re(e);return at(rs(r),r,t)}function is(e,t){return new RegExp(`(^|[\\s,])${t}($|[\\s,])`,"i").test(e??"")}function ee(e,t,r,n,s){let a=O(e,t,r,{before:n,after:s,actual:s});return a.before=n,a.after=s,a}function as(e,t){let r=!t.partial&&!t.truncated,n=[],s=new Map(t.pages.map(o=>[o.url,o]));e.robots.sha256&&t.robots.sha256&&e.robots.sha256!==t.robots.sha256&&n.push(ee("robots-changed",t.robots.url,"robots.txt content changed",e.robots.sha256,t.robots.sha256));let a=e.sitemap?.urls.length??0,c=t.sitemap?.urls.length??0,l=a-c;r&&a>0&&l>=Math.max(5,Math.ceil(a*.2))&&n.push(ee("sitemap-url-count-drop",t.sitemap?.url??e.sitemap?.url??t.siteUrl,`Sitemap URL count dropped by ${l}`,a,c));for(let o of e.pages){let d=s.get(o.url);if(!d){r&&n.push(ee("page-missing",o.url,"Page was not checked",o.status,null));continue}if(d.blockedByRobots&&!o.blockedByRobots){n.push(ee("robots-blocked",o.url,"Page is now blocked by robots.txt",!1,!0));continue}if(d.error&&!o.error){n.push(ee(d.error.includes("redirect loop")?"redirect-loop":"page-unreachable",o.url,`Page request failed: ${d.error}`,o.error,d.error));continue}o.status!==null&&o.status<400&&(d.status===null||d.status>=400)&&n.push(ee("status-regression",o.url,`HTTP status regressed from ${o.status} to ${d.status??"none"}`,o.status,d.status));let p=`${o.robots??""},${o.xRobotsTag??""}`,h=`${d.robots??""},${d.xRobotsTag??""}`;if(!is(p,"noindex")&&is(h,"noindex")&&n.push(ee("new-noindex",o.url,"Page now contains a noindex directive",p,h)),o.title&&!d.title?n.push(ee("title-removed",o.url,"Page title was removed",o.title,d.title)):o.title&&d.title&&o.title!==d.title&&n.push(ee("title-changed",o.url,"Page title changed",o.title,d.title)),o.description&&!d.description&&n.push(ee("description-removed",o.url,"Meta description was removed",o.description,d.description)),o.canonical&&!d.canonical)n.push(ee("canonical-removed",o.url,"Canonical URL was removed",o.canonical,d.canonical));else if(o.canonical&&d.canonical&&o.canonical!==d.canonical){let f=ee("canonical-changed",o.url,"Canonical URL changed",o.canonical,d.canonical);new URL(d.canonical).origin!==new URL(o.url).origin&&(f.severity="error"),n.push(f)}if(o.h1Count>0&&d.h1Count===0&&n.push(ee("h1-removed",o.url,"All H1 headings were removed",o.h1Count,d.h1Count)),o.finalUrl&&d.finalUrl&&o.finalUrl!==d.finalUrl){let f=ee("redirect-changed",o.url,"Final redirect URL changed",o.finalUrl,d.finalUrl);new URL(d.finalUrl).origin!==new URL(o.url).origin&&(f.severity="error"),n.push(f)}}return n}function io(e,t,r={}){let n=Re(e),s=Re(t);return at(as(n,s),s,r)}function ct(e,t){return{...e,lifecycle:t}}function Ye(e,t,r={}){let n=Re(e),s=Re(t),a=!s.partial&&!s.truncated,c=new Set(s.pages.map(I=>I.url)),l=new Map(me(n,r).map(I=>[I.fingerprint,I])),o=new Map(me(s,r).map(I=>[I.fingerprint,I])),d=[],p=[],h=[],f=[];for(let[I,_]of o){let N=l.get(I);N?JSON.stringify(N.evidence)===JSON.stringify(_.evidence)?h.push(ct(_,"unchanged")):p.push(ct({..._,before:N.evidence,after:_.evidence},"ongoing")):d.push(ct(_,"new"))}for(let[I,_]of l)(_.scope==="page"?c.has(_.url):a)&&!o.has(I)&&f.push(ct(_,"resolved"));let m=new Set(d.map(I=>I.fingerprint));for(let I of io(n,s,r))m.has(I.fingerprint)||d.push(ct(I,"new"));let y={...n.config.regressionBudgets,...s.config.regressionBudgets},w=Object.entries(y).flatMap(([I,_])=>{let N=d.filter(L=>L.severity===I||L.ruleId===I).length;return N>_?[{budget:I,allowed:_,actual:N}]:[]});return Qe(d),Qe(p),Qe(h),Qe(f),{complete:a,newIssues:d,ongoingIssues:p,resolvedIssues:f,unchangedIssues:h,issues:[...d,...p],budgetExceeded:w}}var Gr="seo-audit.config.json",os=Object.freeze({schemaVersion:1,url:"",sitemap:"auto",maxPages:100,concurrency:5,delay:100,timeout:1e4,respectRobots:!0,includeQuery:!1,maxRedirects:10,maxResponseBytes:5242880,enabledRules:null,severityOverrides:{},suppressions:[],regressionBudgets:{},report:{}});function lt(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} must be an object`);return e}function Le(e,t,r,n=Number.MAX_SAFE_INTEGER){if(!Number.isInteger(e)||e<r||e>n)throw new Error(`${t} must be an integer between ${r} and ${n}`);return e}function dt(e,t){if(e!==void 0){if(typeof e!="string")throw new Error(`${t} must be a string`);return e}}function Wr(e){let t=lt(e,"config"),r=new Set(["$schema","schemaVersion","url","sitemap","maxPages","concurrency","delay","timeout","respectRobots","includeQuery","maxRedirects","maxResponseBytes","enabledRules","severityOverrides","suppressions","regressionBudgets","report"]);for(let s of Object.keys(t))if(!r.has(s))throw new Error(`unknown config property: ${s}`);let n={};if(t.schemaVersion!==void 0&&t.schemaVersion!==1)throw new Error("schemaVersion must be 1");if(t.url!==void 0){let s=dt(t.url,"url");if(!/^https?:\/\//i.test(s))throw new Error("url must be an HTTP(S) URL");n.url=s}if(t.sitemap!==void 0){let s=dt(t.sitemap,"sitemap");if(!["auto","none"].includes(s)&&!/^https?:\/\//i.test(s))throw new Error("sitemap must be auto, none, or an HTTP(S) URL");n.sitemap=s}t.maxPages!==void 0&&(n.maxPages=Le(t.maxPages,"maxPages",1)),t.concurrency!==void 0&&(n.concurrency=Le(t.concurrency,"concurrency",1,50)),t.delay!==void 0&&(n.delay=Le(t.delay,"delay",0)),t.timeout!==void 0&&(n.timeout=Le(t.timeout,"timeout",1)),t.maxRedirects!==void 0&&(n.maxRedirects=Le(t.maxRedirects,"maxRedirects",0,50)),t.maxResponseBytes!==void 0&&(n.maxResponseBytes=Le(t.maxResponseBytes,"maxResponseBytes",1024));for(let s of["respectRobots","includeQuery"])if(t[s]!==void 0){if(typeof t[s]!="boolean")throw new Error(`${s} must be a boolean`);n[s]=t[s]}if(t.enabledRules!==void 0){if(t.enabledRules!==null&&(!Array.isArray(t.enabledRules)||t.enabledRules.some(s=>typeof s!="string")))throw new Error("enabledRules must be null or an array of rule IDs");n.enabledRules=t.enabledRules}if(t.severityOverrides!==void 0){let s=lt(t.severityOverrides,"severityOverrides");for(let[a,c]of Object.entries(s))if(!["error","warning","info"].includes(c))throw new Error(`severityOverrides.${a} must be error, warning, or info`);n.severityOverrides=s}if(t.suppressions!==void 0){if(!Array.isArray(t.suppressions))throw new Error("suppressions must be an array");n.suppressions=t.suppressions.map((s,a)=>{let c=lt(s,`suppressions[${a}]`);for(let l of["rule","urlPattern","reason"])if(typeof c[l]!="string"||c[l]==="")throw new Error(`suppressions[${a}].${l} must be a non-empty string`);if(c.expiresAt!==void 0&&!/^\d{4}-\d{2}-\d{2}$/.test(String(c.expiresAt)))throw new Error(`suppressions[${a}].expiresAt must use YYYY-MM-DD`);return c})}if(t.regressionBudgets!==void 0){let s=lt(t.regressionBudgets,"regressionBudgets");n.regressionBudgets=Object.fromEntries(Object.entries(s).map(([a,c])=>[a,Le(c,`regressionBudgets.${a}`,0)]))}if(t.report!==void 0){let s=lt(t.report,"report"),a={},c=dt(s.agencyName,"report.agencyName"),l=dt(s.logo,"report.logo"),o=dt(s.primaryColor,"report.primaryColor");if(c!==void 0&&(a.agencyName=c),l!==void 0&&(a.logo=l),o!==void 0&&(a.primaryColor=o),a.primaryColor&&!/^#[0-9a-f]{6}$/i.test(a.primaryColor))throw new Error("report.primaryColor must be a six-digit hex color");n.report=Object.fromEntries(Object.entries(a).filter(([,d])=>d!==void 0))}return n}function Te(e,t={},r={}){return{...{...os,...r,...t,...e},schemaVersion:1,severityOverrides:{...r.severityOverrides??{},...t.severityOverrides??{},...e.severityOverrides??{}},regressionBudgets:{...r.regressionBudgets??{},...t.regressionBudgets??{},...e.regressionBudgets??{}},report:{...r.report??{},...t.report??{},...e.report??{}},suppressions:e.suppressions??t.suppressions??r.suppressions??[]}}function Gt(){}var Wt=Object.freeze({debug:Gt,info:Gt,warn:Gt,error:Gt});import{setTimeout as ao}from"node:timers/promises";function oo(e=0,{now:t=Date.now,wait:r=ao}={}){let n=Math.max(0,e),s=0,a=Promise.resolve();return function(){if(n===0)return Promise.resolve();let l=a.then(async()=>{let o=Math.max(0,s-t());o>0&&await r(o),s=t()+n});return a=l.catch(()=>{}),l}}function Ge(e=0,t=oo){let r=new Map;return n=>{let s=new URL(n).origin,a=r.get(s);return a||(a=t(e),r.set(s,a)),a()}}import{createHash as go}from"node:crypto";import{setTimeout as cs}from"node:timers/promises";var fe=class extends Error{redirectChain;constructor(t,r=[],n){super(t,n),this.name="RequestFailure",this.redirectChain=r}};function co(e){return e===429||e===500||e===502||e===503||e===504}function lo(e,t=Date.now()){if(!e)return null;let r=Number(e);if(Number.isFinite(r)&&r>=0)return Math.min(r*1e3,3e4);let n=Date.parse(e);return Number.isNaN(n)?null:Math.min(Math.max(0,n-t),3e4)}function uo(e,t){let r=AbortSignal.timeout(e);return t?AbortSignal.any([t,r]):r}async function Ao(e,t,r){let n=[],s=new Set([e]),a=e;for(;;){r.signal?.throwIfAborted(),await r.gate?.(a);let c=await r.fetch(a,{...t,redirect:"manual",signal:uo(r.timeout,r.signal)}),l=c.headers.get("location");if(c.status<300||c.status>=400||!l)return{response:c,redirectChain:n};let o=new URL(l,a).href;if(n.push({url:a,status:c.status,location:o}),await c.body?.cancel(),s.has(o))throw new fe(`redirect loop detected at ${o}`,n);if(n.length>r.maxRedirects)throw new fe(`redirect limit of ${r.maxRedirects} exceeded`,n);s.add(o),a=o}}async function Oe(e,t,r){let n;for(let s=0;s<=r.retries;s+=1)try{let a=await Ao(e,t,r);if(!co(a.response.status)||s===r.retries)return a;let c=lo(a.response.headers.get("retry-after"));await a.response.body?.cancel();let l=Math.floor((r.random??Math.random)()*100),o=c??Math.min(250*2**s+l,3e4);await r.onEvent?.({type:"retry",url:e,attempt:s+1,delayMs:o}),await cs(o,void 0,{signal:r.signal})}catch(a){if(r.signal?.aborted)throw r.signal.reason??a;if(n=a,a instanceof fe||s===r.retries)break;let c=Math.floor((r.random??Math.random)()*100),l=Math.min(250*2**s+c,3e4);await r.onEvent?.({type:"retry",url:e,attempt:s+1,delayMs:l}),await cs(l,void 0,{signal:r.signal})}throw n instanceof fe?n:new fe(n instanceof Error?n.message:String(n),[],{cause:n})}async function ve(e,t){if(!e.body)return{text:"",bytes:0,buffer:Buffer.alloc(0)};let r=e.body.getReader(),n=[],s=0;for(;;){let{done:c,value:l}=await r.read();if(c)break;if(s+=l.byteLength,s>t)throw await r.cancel(),new fe(`response exceeds ${t} bytes`);n.push(Buffer.from(l))}let a=Buffer.concat(n);return{text:a.toString("utf8"),bytes:s,buffer:a}}function po(e,t){if(!t)return!1;let r=t.endsWith("$"),s=(r?t.slice(0,-1):t).replace(/[.+?^${}()|[\]\\]/g,"\\$&").replaceAll("*",".*");return new RegExp(`^${s}${r?"$":""}`).test(e)}function ho(e,t){let r=[],n=null;for(let l of e.replace(/^\uFEFF/,"").split(/\r?\n/)){let o=l.replace(/#.*$/,"").trim(),d=o.indexOf(":");if(!o||d<0)continue;let p=o.slice(0,d).trim().toLowerCase(),h=o.slice(d+1).trim();if(p==="user-agent"){(!n||n.hasRules)&&(n={agents:[],rules:[],hasRules:!1},r.push(n)),h&&n.agents.push(h.toLowerCase());continue}n&&(p==="allow"||p==="disallow")&&h&&(n.rules.push({type:p,path:h}),n.hasRules=!0)}let s=t.toLowerCase(),a=r.filter(l=>l.agents.some(o=>o!=="*"&&s.includes(o)));return(a.length>0?a:r.filter(l=>l.agents.includes("*"))).flatMap(l=>l.rules)}function ls(e,t){if(t.denyAll)return!1;let r=new URL(e),n=`${r.pathname}${r.search}`,s=(t.rules??[]).filter(a=>po(n,a.path)).sort((a,c)=>c.path.length-a.path.length||(a.type==="allow"?-1:1));return s.length===0||s[0]?.type==="allow"}async function Kt(e,t){let r=new URL("/robots.txt",e).href;try{let{response:n}=await Oe(r,{headers:{accept:"text/plain,*/*;q=0.1","user-agent":t.userAgent}},{fetch:t.fetch,timeout:t.timeout,maxRedirects:t.maxRedirects,retries:t.retries,signal:t.signal,gate:t.requestGate,onEvent:t.onEvent}),{text:s}=await ve(n,mo);return{url:r,status:n.status,body:s,sha256:go("sha256").update(s).digest("hex"),rules:n.ok?ho(s,t.userAgent):[],denyAll:n.status===401||n.status===403,error:null}}catch(n){if(t.signal?.aborted)throw n;return{url:r,status:null,body:"",sha256:null,rules:[],denyAll:!1,error:n instanceof Error?n.message:String(n)}}}var mo=512*1024;import{gunzipSync as Dc}from"node:zlib";var ds=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",fo=ds+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Eo="["+ds+"]["+fo+"]*",To=new RegExp("^"+Eo+"$");function Jt(e,t){let r=[],n=t.exec(e);for(;n;){let s=[];s.startIndex=t.lastIndex-n[0].length;let a=n.length;for(let c=0;c<a;c++)s.push(n[c]);r.push(s),n=t.exec(e)}return r}var Kr=function(e){let t=To.exec(e);return!(t===null||typeof t>"u")};function us(e){return typeof e<"u"}var ut=["hasOwnProperty","toString","valueOf","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"],jt=["__proto__","constructor","prototype"];var bo={allowBooleanAttributes:!1,unpairedTags:[]};function Vt(e,t){t=Object.assign({},bo,t);let r=[],n=!1,s=!1;e[0]==="\uFEFF"&&(e=e.substr(1));for(let a=0;a<e.length;a++)if(e[a]==="<"&&e[a+1]==="?"){if(a+=2,a=ps(e,a),a.err)return a}else if(e[a]==="<"){let c=a;if(a++,e[a]==="!"){a=hs(e,a);continue}else{let l=!1;e[a]==="/"&&(l=!0,a++);let o="";for(;a<e.length&&e[a]!==">"&&e[a]!==" "&&e[a]!==" "&&e[a]!==`
5
+ `&&e[a]!=="\r";a++)o+=e[a];if(o=o.trim(),o[o.length-1]==="/"&&(o=o.substring(0,o.length-1),a--),!_o(o)){let h;return o.trim().length===0?h="Invalid space after '<'.":h="Tag '"+o+"' is an invalid name.",Q("InvalidTag",h,Z(e,a))}let d=yo(e,a);if(d===!1)return Q("InvalidAttr","Attributes for '"+o+"' have open quote.",Z(e,a));let p=d.value;if(a=d.index,p[p.length-1]==="/"){let h=a-p.length;p=p.substring(0,p.length-1);let f=gs(p,t);if(f===!0)n=!0;else return Q(f.err.code,f.err.msg,Z(e,h+f.err.line))}else if(l)if(d.tagClosed){if(p.trim().length>0)return Q("InvalidTag","Closing tag '"+o+"' can't have attributes or invalid starting.",Z(e,c));if(r.length===0)return Q("InvalidTag","Closing tag '"+o+"' has not been opened.",Z(e,c));{let h=r.pop();if(o!==h.tagName){let f=Z(e,h.tagStartPos);return Q("InvalidTag","Expected closing tag '"+h.tagName+"' (opened in line "+f.line+", col "+f.col+") instead of closing tag '"+o+"'.",Z(e,c))}r.length==0&&(s=!0)}}else return Q("InvalidTag","Closing tag '"+o+"' doesn't have proper closing.",Z(e,a));else{let h=gs(p,t);if(h!==!0)return Q(h.err.code,h.err.msg,Z(e,a-p.length+h.err.line));if(s===!0)return Q("InvalidXml","Multiple possible root nodes found.",Z(e,a));t.unpairedTags.indexOf(o)!==-1||r.push({tagName:o,tagStartPos:c}),n=!0}for(a++;a<e.length;a++)if(e[a]==="<")if(e[a+1]==="!"){a++,a=hs(e,a);continue}else if(e[a+1]==="?"){if(a=ps(e,++a),a.err)return a}else break;else if(e[a]==="&"){let h=So(e,a);if(h==-1)return Q("InvalidChar","char '&' is not expected.",Z(e,a));a=h}else if(s===!0&&!As(e[a]))return Q("InvalidXml","Extra text at the end",Z(e,a));e[a]==="<"&&a--}}else{if(As(e[a]))continue;return Q("InvalidChar","char '"+e[a]+"' is not expected.",Z(e,a))}if(n){if(r.length==1)return Q("InvalidTag","Unclosed tag '"+r[0].tagName+"'.",Z(e,r[0].tagStartPos));if(r.length>0)return Q("InvalidXml","Invalid '"+JSON.stringify(r.map(a=>a.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return Q("InvalidXml","Start tag expected.",1);return!0}function As(e){return e===" "||e===" "||e===`
6
+ `||e==="\r"}function ps(e,t){let r=t;for(;t<e.length;t++)if(e[t]=="?"||e[t]==" "){let n=e.substr(r,t-r);if(t>5&&n==="xml")return Q("InvalidXml","XML declaration allowed only at the start of the document.",Z(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function hs(e,t){if(e.length>t+5&&e[t+1]==="-"&&e[t+2]==="-"){for(t+=3;t<e.length;t++)if(e[t]==="-"&&e[t+1]==="-"&&e[t+2]===">"){t+=2;break}}else if(e.length>t+8&&e[t+1]==="D"&&e[t+2]==="O"&&e[t+3]==="C"&&e[t+4]==="T"&&e[t+5]==="Y"&&e[t+6]==="P"&&e[t+7]==="E"){let r=1;for(t+=8;t<e.length;t++)if(e[t]==="<")r++;else if(e[t]===">"&&(r--,r===0))break}else if(e.length>t+9&&e[t+1]==="["&&e[t+2]==="C"&&e[t+3]==="D"&&e[t+4]==="A"&&e[t+5]==="T"&&e[t+6]==="A"&&e[t+7]==="["){for(t+=8;t<e.length;t++)if(e[t]==="]"&&e[t+1]==="]"&&e[t+2]===">"){t+=2;break}}return t}var Co='"',Io="'";function yo(e,t){let r="",n="",s=!1;for(;t<e.length;t++){if(e[t]===Co||e[t]===Io)n===""?n=e[t]:n!==e[t]||(n="");else if(e[t]===">"&&n===""){s=!0;break}r+=e[t]}return n!==""?!1:{value:r,index:t,tagClosed:s}}var wo=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function gs(e,t){let r=Jt(e,wo),n={};for(let s=0;s<r.length;s++){if(r[s][1].length===0)return Q("InvalidAttr","Attribute '"+r[s][2]+"' has no space in starting.",At(r[s]));if(r[s][3]!==void 0&&r[s][4]===void 0)return Q("InvalidAttr","Attribute '"+r[s][2]+"' is without value.",At(r[s]));if(r[s][3]===void 0&&!t.allowBooleanAttributes)return Q("InvalidAttr","boolean attribute '"+r[s][2]+"' is not allowed.",At(r[s]));let a=r[s][2];if(!No(a))return Q("InvalidAttr","Attribute '"+a+"' is an invalid name.",At(r[s]));if(!Object.prototype.hasOwnProperty.call(n,a))n[a]=1;else return Q("InvalidAttr","Attribute '"+a+"' is repeated.",At(r[s]))}return!0}function xo(e,t){let r=/\d/;for(e[t]==="x"&&(t++,r=/[\da-fA-F]/);t<e.length;t++){if(e[t]===";")return t;if(!e[t].match(r))break}return-1}function So(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,xo(e,t);let r=0;for(;t<e.length;t++,r++)if(!(e[t].match(/\w/)&&r<20)){if(e[t]===";")break;return-1}return t}function Q(e,t,r){return{err:{code:e,msg:t,line:r.line||r,col:r.col}}}function No(e){return Kr(e)}function _o(e){return Kr(e)}function Z(e,t){let r=e.substring(0,t).split(/\r?\n/);return{line:r.length,col:r[r.length-1].length+1}}function At(e){return e.startIndex+e[1].length}var Jr={cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",euro:"\u20AC",dollar:"$",fnof:"\u0192",inr:"\u20B9",af:"\u060B",birr:"\u1265\u122D",peso:"\u20B1",rub:"\u20BD",won:"\u20A9",yuan:"\xA5",cedil:"\xB8"};var pt={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'},jr={nbsp:"\xA0",copy:"\xA9",reg:"\xAE",trade:"\u2122",mdash:"\u2014",ndash:"\u2013",hellip:"\u2026",laquo:"\xAB",raquo:"\xBB",lsquo:"\u2018",rsquo:"\u2019",ldquo:"\u201C",rdquo:"\u201D",bull:"\u2022",para:"\xB6",sect:"\xA7",deg:"\xB0",frac12:"\xBD",frac14:"\xBC",frac34:"\xBE"};var We=Object.freeze({ALLOW:"allow",BLOCK:"block",THROW:"throw"}),Ro=new Set("!?\\\\/[]$%{}^&*()<>|+");function ms(e){if(e[0]==="#")throw new Error(`[EntityReplacer] Invalid character '#' in entity name: "${e}"`);for(let t of e)if(Ro.has(t))throw new Error(`[EntityReplacer] Invalid character '${t}' in entity name: "${e}"`);return e}function ht(...e){let t=Object.create(null);for(let r of e)if(r)for(let n of Object.keys(r)){let s=r[n];if(typeof s=="string")t[n]=s;else if(s&&typeof s=="object"&&s.val!==void 0){let a=s.val;typeof a=="string"&&(t[n]=a)}}return t}var De="external",$t="base",Vr="all";function Lo(e){return!e||e===De?new Set([De]):e===Vr?new Set([Vr]):e===$t?new Set([$t]):Array.isArray(e)?new Set(e):new Set([De])}var te=Object.freeze({allow:0,leave:1,remove:2,throw:3}),Oo=new Set([9,10,13]);function vo(e){if(!e)return{xmlVersion:1,onLevel:te.allow,nullLevel:te.remove};let t=e.xmlVersion===1.1?1.1:1,r=te[e.onNCR]??te.allow,n=te[e.nullNCR]??te.remove,s=Math.max(n,te.remove);return{xmlVersion:t,onLevel:r,nullLevel:s}}var Ke=class{constructor(t={}){this._limit=t.limit||{},this._maxTotalExpansions=this._limit.maxTotalExpansions||0,this._maxExpandedLength=this._limit.maxExpandedLength||0,this._postCheck=typeof t.postCheck=="function"?t.postCheck:n=>n,this._limitTiers=Lo(this._limit.applyLimitsTo??De),this._numericAllowed=t.numericAllowed??!0,this._baseMap=ht(pt,t.namedEntities||null),this._externalMap=Object.create(null),this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this._removeSet=new Set(t.remove&&Array.isArray(t.remove)?t.remove:[]),this._leaveSet=new Set(t.leave&&Array.isArray(t.leave)?t.leave:[]);let r=vo(t.ncr);this._ncrXmlVersion=r.xmlVersion,this._ncrOnLevel=r.onLevel,this._ncrNullLevel=r.nullLevel,this._onExternalEntity=typeof t.onExternalEntity=="function"?t.onExternalEntity:null,this._onInputEntity=typeof t.onInputEntity=="function"?t.onInputEntity:null}_applyRegistrationHook(t,r,n,s){if(!t)return!0;let a=t(r,n);if(a===We.BLOCK)return!1;if(a===We.THROW)throw new Error(`[EntityDecoder] Registration of ${s} entity "&${r};" was rejected by hook`);return!0}setExternalEntities(t){if(t)for(let s of Object.keys(t))ms(s);if(!this._onExternalEntity){this._externalMap=ht(t);return}let r=ht(t),n=Object.create(null);for(let[s,a]of Object.entries(r))this._applyRegistrationHook(this._onExternalEntity,s,a,"external")&&(n[s]=a);this._externalMap=n}addExternalEntity(t,r){ms(t),typeof r=="string"&&r.indexOf("&")===-1&&this._applyRegistrationHook(this._onExternalEntity,t,r,"external")&&(this._externalMap[t]=r)}addInputEntities(t){if(this._totalExpansions=0,this._expandedLength=0,!this._onInputEntity){this._inputMap=ht(t);return}let r=ht(t),n=Object.create(null);for(let[s,a]of Object.entries(r))this._applyRegistrationHook(this._onInputEntity,s,a,"input")&&(n[s]=a);this._inputMap=n}reset(){return this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this}setXmlVersion(t){this._ncrXmlVersion=t===1.1?1.1:1}decode(t){if(typeof t!="string"||t.length===0||t.indexOf("&")===-1)return t;let r=t,n=[],s=t.length,a=0,c=0,l=this._maxTotalExpansions>0,o=this._maxExpandedLength>0,d=l||o;for(;c<s;){if(t.charCodeAt(c)!==38){c++;continue}let h=c+1;for(;h<s&&t.charCodeAt(h)!==59&&h-c<=32;)h++;if(h>=s||t.charCodeAt(h)!==59){c++;continue}let f=t.slice(c+1,h);if(f.length===0){c++;continue}let m,y;if(this._removeSet.has(f))m="",y===void 0&&(y=De);else if(this._leaveSet.has(f)){c++;continue}else if(f.charCodeAt(0)===35){let w=this._resolveNCR(f);if(w===void 0){c++;continue}m=w,y=$t}else{let w=this._resolveName(f);m=w?.value,y=w?.tier}if(m===void 0){c++;continue}if(c>a&&n.push(t.slice(a,c)),n.push(m),a=h+1,c=a,d&&this._tierCounts(y)){if(l&&(this._totalExpansions++,this._totalExpansions>this._maxTotalExpansions))throw new Error(`[EntityReplacer] Entity expansion count limit exceeded: ${this._totalExpansions} > ${this._maxTotalExpansions}`);if(o){let w=m.length-(f.length+2);if(w>0&&(this._expandedLength+=w,this._expandedLength>this._maxExpandedLength))throw new Error(`[EntityReplacer] Expanded content length limit exceeded: ${this._expandedLength} > ${this._maxExpandedLength}`)}}}a<s&&n.push(t.slice(a));let p=n.length===0?t:n.join("");return this._postCheck(p,r)}_tierCounts(t){return this._limitTiers.has(Vr)?!0:this._limitTiers.has(t)}_resolveName(t){if(t in this._inputMap)return{value:this._inputMap[t],tier:De};if(t in this._externalMap)return{value:this._externalMap[t],tier:De};if(t in this._baseMap)return{value:this._baseMap[t],tier:$t}}_classifyNCR(t){return t===0?this._ncrNullLevel:t>=55296&&t<=57343||this._ncrXmlVersion===1&&t>=1&&t<=31&&!Oo.has(t)?te.remove:-1}_applyNCRAction(t,r,n){switch(t){case te.allow:return String.fromCodePoint(n);case te.remove:return"";case te.leave:return;case te.throw:throw new Error(`[EntityDecoder] Prohibited numeric character reference &${r}; (U+${n.toString(16).toUpperCase().padStart(4,"0")})`);default:return String.fromCodePoint(n)}}_resolveNCR(t){let r=t.charCodeAt(1),n;if(r===120||r===88?n=parseInt(t.slice(2),16):n=parseInt(t.slice(1),10),Number.isNaN(n)||n<0||n>1114111)return;let s=this._classifyNCR(n);if(!this._numericAllowed&&s<te.remove)return;let a=s===-1?this._ncrOnLevel:Math.max(this._ncrOnLevel,s);return this._applyNCRAction(a,t,n)}};var fs=e=>ut.includes(e)?"__"+e:e,Do={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0,unicode:!1},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,entityDecoder:null,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,r){return e},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0,jPath:!0,onDangerousProperty:fs};function ko(e,t){if(typeof e!="string")return;let r=e.toLowerCase();if(ut.some(n=>r===n.toLowerCase()))throw new Error(`[SECURITY] Invalid ${t}: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`);if(jt.some(n=>r===n.toLowerCase()))throw new Error(`[SECURITY] Invalid ${t}: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`)}function Es(e,t){return typeof e=="boolean"?{enabled:e,maxEntitySize:1e4,maxExpansionDepth:1e4,maxTotalExpansions:1/0,maxExpandedLength:1e5,maxEntityCount:1e3,allowedTags:null,tagFilter:null,appliesTo:"all"}:typeof e=="object"&&e!==null?{enabled:e.enabled!==!1,maxEntitySize:Math.max(1,e.maxEntitySize??1e4),maxExpansionDepth:Math.max(1,e.maxExpansionDepth??1e4),maxTotalExpansions:Math.max(1,e.maxTotalExpansions??1/0),maxExpandedLength:Math.max(1,e.maxExpandedLength??1e5),maxEntityCount:Math.max(1,e.maxEntityCount??1e3),allowedTags:e.allowedTags??null,tagFilter:e.tagFilter??null,appliesTo:e.appliesTo??"all"}:Es(!0)}var Ts=function(e){let t=Object.assign({},Do,e),r=[{value:t.attributeNamePrefix,name:"attributeNamePrefix"},{value:t.attributesGroupName,name:"attributesGroupName"},{value:t.textNodeName,name:"textNodeName"},{value:t.cdataPropName,name:"cdataPropName"},{value:t.commentPropName,name:"commentPropName"}];for(let{value:n,name:s}of r)n&&ko(n,s);return t.onDangerousProperty===null&&(t.onDangerousProperty=fs),t.processEntities=Es(t.processEntities,t.htmlEntities),t.unpairedTagsSet=new Set(t.unpairedTags),t.stopNodes&&Array.isArray(t.stopNodes)&&(t.stopNodes=t.stopNodes.map(n=>typeof n=="string"&&n.startsWith("*.")?".."+n.substring(2):n)),t};var Xt;typeof Symbol!="function"?Xt="@@xmlMetadata":Xt=Symbol("XML Node Metadata");var re=class{constructor(t){this.tagname=t,this.child=[],this[":@"]=Object.create(null)}add(t,r){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:r})}addChild(t,r){t.tagname==="__proto__"&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child}),r!==void 0&&(this.child[this.child.length-1][Xt]={startIndex:r})}static getMetaDataSymbol(){return Xt}};var bs=":A-Za-z_\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u0486\u0488-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD",Bo=bs+"\\-\\.\\d\xB7\u0300-\u036F\u203F-\u2040",Cs=":A-Za-z_\xC0-\u02FF\u0370-\u037D\u037F-\u0486\u0488-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}",Po=Cs+"\\-\\.\\d\xB7\u0300-\u036F\u0487\u203F-\u2040",$r=(e,t,r="")=>{let n=e.replace(":",""),s=t.replace(":",""),a=`[${n}][${s}]*`;return{name:new RegExp(`^[${e}][${t}]*$`,r),ncName:new RegExp(`^${a}$`,r),qName:new RegExp(`^${a}(?::${a})?$`,r),nmToken:new RegExp(`^[${t}]+$`,r),nmTokens:new RegExp(`^[${t}]+(?:\\s+[${t}]+)*$`,r)}},Mo=$r(bs,Bo),Uo=$r(Cs,Po,"u"),Is=":A-Za-z_",Fo=Is+"\\-\\.\\d",Ho=$r(Is,Fo),Qo=(e="1.0",t=!1)=>t?Ho:e==="1.1"?Uo:Mo;var Xr=(e,{xmlVersion:t="1.0",asciiOnly:r=!1}={})=>Qo(t,r).qName.test(e);var mt=class{constructor(t,r){this.suppressValidationErr=!t,this.options=t,this.xmlVersion=r||1}setXmlVersion(t=1){this.xmlVersion=t}readDocType(t,r){let n=Object.create(null),s=0;if(t[r+3]==="O"&&t[r+4]==="C"&&t[r+5]==="T"&&t[r+6]==="Y"&&t[r+7]==="P"&&t[r+8]==="E"){r=r+9;let a=1,c=!1,l=!1,o="";for(;r<t.length;r++)if(t[r]==="<"&&!l){if(c&&ke(t,"!ENTITY",r)){r+=7;let d,p;if([d,p,r]=this.readEntityExp(t,r+1,this.suppressValidationErr),p.indexOf("&")===-1){if(this.options.enabled!==!1&&this.options.maxEntityCount!=null&&s>=this.options.maxEntityCount)throw new Error(`Entity count (${s+1}) exceeds maximum allowed (${this.options.maxEntityCount})`);n[d]=p,s++}}else if(c&&ke(t,"!ELEMENT",r)){r+=8;let{index:d}=this.readElementExp(t,r+1);r=d}else if(c&&ke(t,"!ATTLIST",r))r+=8;else if(c&&ke(t,"!NOTATION",r)){r+=9;let{index:d}=this.readNotationExp(t,r+1,this.suppressValidationErr);r=d}else if(ke(t,"!--",r))l=!0;else throw new Error("Invalid DOCTYPE");a++,o=""}else if(t[r]===">"){if(l?t[r-1]==="-"&&t[r-2]==="-"&&(l=!1,a--):a--,a===0)break}else t[r]==="["?c=!0:o+=t[r];if(a!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:n,i:r}}readEntityExp(t,r){r=ne(t,r);let n=r;for(;r<t.length&&!/\s/.test(t[r])&&t[r]!=='"'&&t[r]!=="'";)r++;let s=t.substring(n,r);if(gt(s,{xmlVersion:this.xmlVersion}),r=ne(t,r),!this.suppressValidationErr){if(t.substring(r,r+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(t[r]==="%")throw new Error("Parameter entities are not supported")}let a="";if([r,a]=this.readIdentifierVal(t,r,"entity"),this.options.enabled!==!1&&this.options.maxEntitySize!=null&&a.length>this.options.maxEntitySize)throw new Error(`Entity "${s}" size (${a.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return r--,[s,a,r]}readNotationExp(t,r){r=ne(t,r);let n=r;for(;r<t.length&&!/\s/.test(t[r]);)r++;let s=t.substring(n,r);!this.suppressValidationErr&&gt(s,{xmlVersion:this.xmlVersion}),r=ne(t,r);let a=t.substring(r,r+6).toUpperCase();if(!this.suppressValidationErr&&a!=="SYSTEM"&&a!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${a}"`);r+=a.length,r=ne(t,r);let c=null,l=null;if(a==="PUBLIC")[r,c]=this.readIdentifierVal(t,r,"publicIdentifier"),r=ne(t,r),(t[r]==='"'||t[r]==="'")&&([r,l]=this.readIdentifierVal(t,r,"systemIdentifier"));else if(a==="SYSTEM"&&([r,l]=this.readIdentifierVal(t,r,"systemIdentifier"),!this.suppressValidationErr&&!l))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:s,publicIdentifier:c,systemIdentifier:l,index:--r}}readIdentifierVal(t,r,n){let s="",a=t[r];if(a!=='"'&&a!=="'")throw new Error(`Expected quoted string, found "${a}"`);r++;let c=r;for(;r<t.length&&t[r]!==a;)r++;if(s=t.substring(c,r),t[r]!==a)throw new Error(`Unterminated ${n} value`);return r++,[r,s]}readElementExp(t,r){r=ne(t,r);let n=r;for(;r<t.length&&!/\s/.test(t[r]);)r++;let s=t.substring(n,r);if(!this.suppressValidationErr&&!Xr(s,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid element name: "${s}"`);r=ne(t,r);let a="";if(t[r]==="E"&&ke(t,"MPTY",r))r+=4;else if(t[r]==="A"&&ke(t,"NY",r))r+=2;else if(t[r]==="("){r++;let c=r;for(;r<t.length&&t[r]!==")";)r++;if(a=t.substring(c,r),t[r]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${t[r]}"`);return{elementName:s,contentModel:a.trim(),index:r}}readAttlistExp(t,r){r=ne(t,r);let n=r;for(;r<t.length&&!/\s/.test(t[r]);)r++;let s=t.substring(n,r);for(gt(s,{xmlVersion:this.xmlVersion}),r=ne(t,r),n=r;r<t.length&&!/\s/.test(t[r]);)r++;let a=t.substring(n,r);if(!gt(a,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid attribute name: "${a}"`);r=ne(t,r);let c="";if(t.substring(r,r+8).toUpperCase()==="NOTATION"){if(c="NOTATION",r+=8,r=ne(t,r),t[r]!=="(")throw new Error(`Expected '(', found "${t[r]}"`);r++;let o=[];for(;r<t.length&&t[r]!==")";){let d=r;for(;r<t.length&&t[r]!=="|"&&t[r]!==")";)r++;let p=t.substring(d,r);if(p=p.trim(),!gt(p,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid notation name: "${p}"`);o.push(p),t[r]==="|"&&(r++,r=ne(t,r))}if(t[r]!==")")throw new Error("Unterminated list of notations");r++,c+=" ("+o.join("|")+")"}else{let o=r;for(;r<t.length&&!/\s/.test(t[r]);)r++;c+=t.substring(o,r);let d=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!d.includes(c.toUpperCase()))throw new Error(`Invalid attribute type: "${c}"`)}r=ne(t,r);let l="";return t.substring(r,r+8).toUpperCase()==="#REQUIRED"?(l="#REQUIRED",r+=8):t.substring(r,r+7).toUpperCase()==="#IMPLIED"?(l="#IMPLIED",r+=7):[r,l]=this.readIdentifierVal(t,r,"ATTLIST"),{elementName:s,attributeName:a,attributeType:c,defaultValue:l,index:r}}},ne=(e,t)=>{for(;t<e.length&&/\s/.test(e[t]);)t++;return t};function ke(e,t,r){for(let n=0;n<t.length;n++)if(t[n]!==e[r+n+1])return!1;return!0}function gt(e,t){if(Xr(e,{xmlVersion:t}))return e;throw new Error(`Invalid entity name ${e}`)}var Yo=[48,1632,1776,2406,2534,2662,2790,2918,3046,3174,3302,3430,3558,3664,3792,3872,4160,4240,6112,6160,6470,6608,6784,6800,6992,7088,7232,7248,65296,120782,120792,120802,120812,120822,66720,68912,69734,69872,69942,70096,70384,70736,70864,71248,71360,71472,71904,72016,72688,72784,73040,73120,73552,92768,92864,93008,123200,123632,124144,125264,130032],Zt=255,zt=new Map,ys=65535,ws=1632,Je=ws,Go=ys-ws+1,qt=new Uint8Array(Go).fill(Zt);for(let e of Yo)for(let t=0;t<10;t++){let r=e+t;r<=ys?qt[r-Je]=t:zt.set(r,t)}var xs=48,Ss=57,Ns=45,er=new Set([8722,65293,65123]);function Wo(e){if(typeof e!="string")return e;let t=e.length;if(t===0)return e;let r=-1;for(let s=0;s<t;s++){let a=e.charCodeAt(s);if(!(a>=xs&&a<=Ss||a===Ns)){if(a<Je){if(er.has(a)){r=s;break}continue}if(a>=55296&&a<=56319){if(s+1<t){let c=e.charCodeAt(s+1);if(c>=56320&&c<=57343){let l=65536+(a-55296<<10)+(c-56320);if(zt.has(l)){r=s;break}}}continue}if(qt[a-Je]!==Zt||er.has(a)){r=s;break}}}if(r===-1)return e;let n=[];r>0&&n.push(e.slice(0,r));for(let s=r;s<t;s++){let a=e.charCodeAt(s);if(a>=xs&&a<=Ss||a===Ns){n.push(e[s]);continue}if(a<Je){n.push(er.has(a)?"-":e[s]);continue}if(a>=55296&&a<=56319){if(s+1<t){let l=e.charCodeAt(s+1);if(l>=56320&&l<=57343){let o=65536+(a-55296<<10)+(l-56320),d=zt.get(o);if(d!==void 0){n.push(String.fromCharCode(d+48)),s++;continue}}}n.push(e[s]);continue}if(er.has(a)){n.push("-");continue}let c=qt[a-Je];n.push(c!==Zt?String.fromCharCode(c+48):e[s])}return n.join("")}var _s=Wo;var Ko=/^[-+]?0x[a-fA-F0-9]+$/,Jo=/^0b[01]+$/,jo=/^0o[0-7]+$/,Vo=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,$o={hex:!0,binary:!1,octal:!1,leadingZeros:!0,decimalPoint:".",eNotation:!0,infinity:"original",unicode:!1};function zr(e,t={}){if(t=Object.assign({},$o,t),!e||typeof e!="string")return e;let r=e.trim();if(r.length===0)return e;if(t.skipLike!==void 0&&t.skipLike.test(r))return e;if(r==="0"||t.unicode&&(r=_s(r),r==="0"))return 0;if(t.hex&&Ko.test(r))return Zr(r,16);if(t.binary&&Jo.test(r))return Zr(r,2);if(t.octal&&jo.test(r))return Zr(r,8);if(isFinite(r)){if(r.includes("e")||r.includes("E"))return Zo(e,r,t);{let n=Vo.exec(r);if(n){let s=n[1]||"",a=n[2],c=zo(n[3]),l=s?e[a.length+1]===".":e[a.length]===".";if(!t.leadingZeros&&(a.length>1||a.length===1&&!l))return e;{let o=Number(r),d=String(o);if(o===0)return o;if(d.search(/[eE]/)!==-1)return t.eNotation?o:e;if(r.indexOf(".")!==-1)return d==="0"||d===c||d===`${s}${c}`?o:e;let p=a?c:r;return a?p===d||s+p===d?o:e:p===d||p===s+d?o:e}}else return e}}else return qo(e,Number(r),t)}var Xo=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function Zo(e,t,r){if(!r.eNotation)return e;let n=t.match(Xo);if(n){let s=n[1]||"",a=n[3].indexOf("e")===-1?"E":"e",c=n[2],l=s?e[c.length+1]===a:e[c.length]===a;return c.length>1&&l?e:c.length===1&&(n[3].startsWith(`.${a}`)||n[3][0]===a)?Number(t):c.length>0?r.leadingZeros&&!l?(t=(n[1]||"")+n[3],Number(t)):e:Number(t)}else return e}function zo(e){return e&&e.indexOf(".")!==-1&&(e=e.replace(/0+$/,""),e==="."?e="0":e[0]==="."?e="0"+e:e[e.length-1]==="."&&(e=e.substring(0,e.length-1))),e}function Zr(e,t){let r=e.trim();if((t===2||t===8)&&(e=r.substring(2)),parseInt)return parseInt(e,t);if(Number.parseInt)return Number.parseInt(e,t);if(window&&window.parseInt)return window.parseInt(e,t);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function qo(e,t,r){let n=t===1/0;switch(r.infinity.toLowerCase()){case"null":return null;case"infinity":return t;case"string":return n?"Infinity":"-Infinity";case"original":default:return e}}function qr(e){return typeof e=="function"?e:Array.isArray(e)?t=>{for(let r of e)if(typeof r=="string"&&t===r||r instanceof RegExp&&r.test(t))return!0}:()=>!1}var Be=class{constructor(t,r={},n){this.pattern=t,this.separator=r.separator||".",this.segments=this._parse(t),this.data=n,this._hasDeepWildcard=this.segments.some(s=>s.type==="deep-wildcard"),this._hasAttributeCondition=this.segments.some(s=>s.attrName!==void 0),this._hasPositionSelector=this.segments.some(s=>s.position!==void 0)}_parse(t){let r=[],n=0,s="";for(;n<t.length;)t[n]===this.separator?n+1<t.length&&t[n+1]===this.separator?(s.trim()&&(r.push(this._parseSegment(s.trim())),s=""),r.push({type:"deep-wildcard"}),n+=2):(s.trim()&&r.push(this._parseSegment(s.trim())),s="",n++):(s+=t[n],n++);return s.trim()&&r.push(this._parseSegment(s.trim())),r}_parseSegment(t){let r={type:"tag"},n=null,s=t,a=t.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(a&&(s=a[1]+a[3],a[2])){let p=a[2].slice(1,-1);p&&(n=p)}let c,l=s;if(s.includes("::")){let p=s.indexOf("::");if(c=s.substring(0,p).trim(),l=s.substring(p+2).trim(),!c)throw new Error(`Invalid namespace in pattern: ${t}`)}let o,d=null;if(l.includes(":")){let p=l.lastIndexOf(":"),h=l.substring(0,p).trim(),f=l.substring(p+1).trim();["first","last","odd","even"].includes(f)||/^nth\(\d+\)$/.test(f)?(o=h,d=f):o=l}else o=l;if(!o)throw new Error(`Invalid segment pattern: ${t}`);if(r.tag=o,c&&(r.namespace=c),n)if(n.includes("=")){let p=n.indexOf("=");r.attrName=n.substring(0,p).trim(),r.attrValue=n.substring(p+1).trim()}else r.attrName=n.trim();if(d){let p=d.match(/^nth\((\d+)\)$/);p?(r.position="nth",r.positionValue=parseInt(p[1],10)):r.position=d}return r}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}};var je=class{constructor(){this._byDepthAndTag=new Map,this._wildcardByDepth=new Map,this._deepWildcards=[],this._deepByTerminalTag=new Map,this._patterns=new Set,this._sealed=!1}add(t){if(this._sealed)throw new TypeError("ExpressionSet is sealed. Create a new ExpressionSet to add more expressions.");if(this._patterns.has(t.pattern))return this;if(this._patterns.add(t.pattern),t.hasDeepWildcard()){let a=t.segments[t.segments.length-1];if(a&&a.type!=="deep-wildcard"&&a.tag!=="*"){let c=a.tag;this._deepByTerminalTag.has(c)||this._deepByTerminalTag.set(c,[]),this._deepByTerminalTag.get(c).push(t)}else this._deepWildcards.push(t);return this}let r=t.length,s=t.segments[t.segments.length-1]?.tag;if(!s||s==="*")this._wildcardByDepth.has(r)||this._wildcardByDepth.set(r,[]),this._wildcardByDepth.get(r).push(t);else{let a=`${r}:${s}`;this._byDepthAndTag.has(a)||this._byDepthAndTag.set(a,[]),this._byDepthAndTag.get(a).push(t)}return this}addAll(t){for(let r of t)this.add(r);return this}has(t){return this._patterns.has(t.pattern)}get size(){return this._patterns.size}seal(){return this._sealed=!0,this}get isSealed(){return this._sealed}matchesAny(t){return this.findMatch(t)!==null}findMatch(t){let r=t.getDepth(),n=t.getCurrentTag(),s=`${r}:${n}`,a=this._byDepthAndTag.get(s);if(a){for(let o=0;o<a.length;o++)if(t.matches(a[o]))return a[o]}let c=this._wildcardByDepth.get(r);if(c){for(let o=0;o<c.length;o++)if(t.matches(c[o]))return c[o]}let l=this._deepByTerminalTag.get(n);if(l){for(let o=0;o<l.length;o++)if(t.matches(l[o]))return l[o]}for(let o=0;o<this._deepWildcards.length;o++)if(t.matches(this._deepWildcards[o]))return this._deepWildcards[o];return null}};var en=class{constructor(t){this._matcher=t}get separator(){return this._matcher.separator}getCurrentTag(){let t=this._matcher.path;return t.length>0?t[t.length-1].tag:void 0}getCurrentNamespace(){let t=this._matcher.path;return t.length>0?t[t.length-1].namespace:void 0}getAttrValue(t){let r=this._matcher.path;if(r.length!==0)return r[r.length-1].values?.[t]}hasAttr(t){let r=this._matcher.path;if(r.length===0)return!1;let n=r[r.length-1];return n.values!==void 0&&t in n.values}getAnyParentAttr(t){return this._matcher.getAnyParentAttr(t)}hasAnyParentAttr(t){return this._matcher.hasAnyParentAttr(t)}getPosition(){let t=this._matcher.path;return t.length===0?-1:t[t.length-1].position??0}getCounter(){let t=this._matcher.path;return t.length===0?-1:t[t.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this._matcher.path.length}toString(t,r=!0){return this._matcher.toString(t,r)}toArray(){return this._matcher.path.map(t=>t.tag)}matches(t){return this._matcher.matches(t)}matchesAny(t){return t.matchesAny(this._matcher)}},Ve=class{constructor(t={}){this.separator=t.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new en(this),this._keptAttrs=[]}push(t,r=null,n=null,s=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);let a=this.path.length,c=this.siblingStacks[a];c||(c={counts:new Map,total:0},this.siblingStacks[a]=c);let l=n?`${n}:${t}`:t,o=c.counts.get(l)||0,d=c.total;c.counts.set(l,o+1),c.total++;let p={tag:t,position:d,counter:o};n!=null&&(p.namespace=n),r!=null&&(p.values=r),this.path.push(p);let h=this.path.length,f=s!==null?s.keep:null;if(f!=null&&f.length>0&&r)for(let m=0;m<f.length;m++){let y=f[m];r[y]!==void 0&&this._keptAttrs.push({depth:h,name:y,value:r[y]})}}pop(){if(this.path.length===0)return;this._pathStringCache=null;let t=this.path.pop();this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1);let r=this.path.length+1;for(;this._keptAttrs.length>0&&this._keptAttrs[this._keptAttrs.length-1].depth>=r;)this._keptAttrs.pop();return t}updateCurrent(t){if(this.path.length>0){let r=this.path[this.path.length-1];t!=null&&(r.values=t)}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(t){if(this.path.length!==0)return this.path[this.path.length-1].values?.[t]}hasAttr(t){if(this.path.length===0)return!1;let r=this.path[this.path.length-1];return r.values!==void 0&&t in r.values}getAnyParentAttr(t){let r=this._keptAttrs;for(let n=r.length-1;n>=0;n--)if(r[n].name===t)return r[n].value}hasAnyParentAttr(t){let r=this._keptAttrs;for(let n=r.length-1;n>=0;n--)if(r[n].name===t)return!0;return!1}getPosition(){return this.path.length===0?-1:this.path[this.path.length-1].position??0}getCounter(){return this.path.length===0?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(t,r=!0){let n=t||this.separator;if(n===this.separator&&r===!0){if(this._pathStringCache!==null)return this._pathStringCache;let a=this.path.map(c=>c.namespace?`${c.namespace}:${c.tag}`:c.tag).join(n);return this._pathStringCache=a,a}return this.path.map(a=>r&&a.namespace?`${a.namespace}:${a.tag}`:a.tag).join(n)}toArray(){return this.path.map(t=>t.tag)}reset(){this._pathStringCache=null,this.path=[],this.siblingStacks=[],this._keptAttrs=[]}matches(t){let r=t.segments;return r.length===0?!1:t.hasDeepWildcard()?this._matchWithDeepWildcard(r):this._matchSimple(r)}_matchSimple(t){if(this.path.length!==t.length)return!1;for(let r=0;r<t.length;r++)if(!this._matchSegment(t[r],this.path[r],r===this.path.length-1))return!1;return!0}_matchWithDeepWildcard(t){let r=this.path.length-1,n=t.length-1;for(;n>=0&&r>=0;){let s=t[n];if(s.type==="deep-wildcard"){if(n--,n<0)return!0;let a=t[n],c=!1;for(let l=r;l>=0;l--)if(this._matchSegment(a,this.path[l],l===this.path.length-1)){r=l-1,n--,c=!0;break}if(!c)return!1}else{if(!this._matchSegment(s,this.path[r],r===this.path.length-1))return!1;r--,n--}}return n<0}_matchSegment(t,r,n){if(t.tag!=="*"&&t.tag!==r.tag||t.namespace!==void 0&&t.namespace!=="*"&&t.namespace!==r.namespace||t.attrName!==void 0&&(!n||!r.values||!(t.attrName in r.values)||t.attrValue!==void 0&&String(r.values[t.attrName])!==String(t.attrValue)))return!1;if(t.position!==void 0){if(!n)return!1;let s=r.counter??0;if(t.position==="first"&&s!==0)return!1;if(t.position==="odd"&&s%2!==1)return!1;if(t.position==="even"&&s%2!==0)return!1;if(t.position==="nth"&&s!==t.positionValue)return!1}return!0}matchesAny(t){return t.matchesAny(this)}snapshot(){return{path:this.path.map(t=>({...t})),siblingStacks:this.siblingStacks.map(t=>t&&{counts:new Map(t.counts),total:t.total}),keptAttrs:this._keptAttrs.map(t=>({...t}))}}restore(t){this._pathStringCache=null,this.path=t.path.map(r=>({...r})),this.siblingStacks=t.siblingStacks.map(r=>r&&{counts:new Map(r.counts),total:r.total}),this._keptAttrs=(t.keptAttrs||[]).map(r=>({...r}))}readOnly(){return this._view}};var ec=[{id:"html-script-open",description:"<script opening tag",pattern:/<script[\s>/]/i},{id:"html-script-close",description:"</script closing tag",pattern:/<\/script[\s>]/i},{id:"html-javascript-protocol",description:"javascript: URI scheme (with optional whitespace/encoding)",pattern:/j[\t\n\r ]*a[\t\n\r ]*v[\t\n\r ]*a[\t\n\r ]*s[\t\n\r ]*c[\t\n\r ]*r[\t\n\r ]*i[\t\n\r ]*p[\t\n\r ]*t[\t\n\r ]*:/i},{id:"html-vbscript-protocol",description:"vbscript: URI scheme",pattern:/vbscript[\t\n\r ]*:/i},{id:"html-data-html",description:"data:text/html URI \u2014 can execute scripts in browsers",pattern:/data[\t\n\r ]*:[\t\n\r ]*text\/html/i},{id:"html-data-xhtml",description:"data:application/xhtml+xml URI",pattern:/data[\t\n\r ]*:[\t\n\r ]*application\/xhtml/i},{id:"html-data-svg",description:"data:image/svg+xml URI \u2014 can execute scripts",pattern:/data[\t\n\r ]*:[\t\n\r ]*image\/svg\+xml/i},{id:"html-inline-event-handler",description:"Inline event handler attributes: onclick=, onerror=, onload=, etc.",pattern:/\bon\w{1,30}\s*=/i},{id:"html-entity-obfuscated-script",description:"HTML-entity-encoded <script (e.g. &#x3C;script or &lt;script)",pattern:/(?:&#x0*3[Cc];?|&#0*60;?|&lt;)\s*script/i},{id:"html-entity-obfuscated-javascript",description:'HTML-entity-encoded javascript: (partial \u2014 catches common &#106; or &#x6a; for "j")',pattern:/(?:&#x0*6[Aa];?|&#0*106;?)\s*(?:&#x0*61;?|a)[\s\S]{0,80}script\s*:/i},{id:"html-style-expression",description:"CSS expression() \u2014 IE-era code execution in style attributes",pattern:/style[\s\S]{0,20}expression\s*\(/i},{id:"html-object-embed",description:"<object or <embed tags that can load active content",pattern:/<(?:object|embed)[\s>/]/i},{id:"html-base-tag",description:"<base href= \u2014 can hijack all relative URLs on a page",pattern:/<base[\s>]/i},{id:"html-meta-refresh",description:'<meta http-equiv="refresh" \u2014 can redirect users',pattern:/<meta[\s\S]{0,40}http-equiv[\s\S]{0,20}refresh/i},{id:"html-srcdoc",description:"srcdoc= attribute on iframes \u2014 embeds HTML that can run scripts",pattern:/srcdoc\s*=/i},{id:"html-iframe",description:"<iframe tag",pattern:/<iframe[\s>/]/i},{id:"html-form",description:"<form tag \u2014 can be used for phishing / credential harvesting injection",pattern:/<form[\s>/]/i}],$e=ec;var tc=[{id:"xml-cdata-injection",description:"CDATA section injection: <![CDATA[ breaks out of text node context",pattern:/<!\[CDATA\[/i},{id:"xml-cdata-close",description:"CDATA close sequence: ]]> can terminate an enclosing CDATA section",pattern:/\]\]>/},{id:"xml-processing-instruction",description:"XML processing instruction: <?xml-stylesheet or <?php etc.",pattern:/<\?(?:xml[\- ]|php|asp)/i},{id:"xml-doctype-injection",description:"DOCTYPE declaration embedded in content \u2014 can define entities",pattern:/<!DOCTYPE(?:[\s[]|$)/i},{id:"xml-entity-system",description:"SYSTEM keyword \u2014 used in external entity declarations (XXE)",pattern:/\bSYSTEM\s+["']/i},{id:"xml-entity-public",description:"PUBLIC keyword \u2014 used in external entity declarations (XXE)",pattern:/\bPUBLIC\s+["']/i},{id:"xml-entity-declaration",description:"<!ENTITY declaration \u2014 defines entities, potential XXE or entity expansion",pattern:/<!ENTITY[\s%]/i},{id:"xml-billion-laughs",description:"Entity reference chaining / billion laughs: repeated &eX; style references",pattern:/(?:&\w{1,20};){3,}/},{id:"xml-namespace-confusion",description:"xmlns: attribute injection \u2014 can redefine namespaces to confuse parsers",pattern:/\bxmlns\s*(?::\w{1,40})?\s*=/i},{id:"xml-comment-injection",description:"<!-- comment injection \u2014 can hide content from some parsers",pattern:/<!--/},{id:"xml-comment-close",description:"--> closes an enclosing XML comment",pattern:/-->/},{id:"xml-pi-close",description:"?> closes an enclosing processing instruction",pattern:/\?>/}],Xe=tc;var rc=[{id:"svg-script-element",description:"<script element inside SVG executes JavaScript",pattern:/<script[\s>/]/i},{id:"svg-xlink-href-javascript",description:"xlink:href with javascript: \u2014 classic SVG XSS via <a> or <use>",pattern:/xlink\s*:\s*href\s*=\s*["']?\s*javascript\s*:/i},{id:"svg-href-javascript",description:"href= with javascript: in SVG context (<a>, <animate>, etc.)",pattern:/href\s*=\s*["']?\s*javascript\s*:/i},{id:"svg-foreignobject",description:"<foreignObject embeds HTML inside SVG \u2014 can execute scripts",pattern:/<foreignObject[\s>/]/i},{id:"svg-use-external",description:"<use xlink:href or href pointing to external resource (non-fragment URL)",pattern:/<use[\s\S]{0,60}(?:xlink\s*:\s*)?href\s*=\s*(?:["'][^#]|[^"'#\s>])/i},{id:"svg-animate-href",description:'<animate attributeName="href" \u2014 can dynamically change href to javascript:',pattern:/<animate[\s\S]{0,80}attributeName\s*=\s*["'][\s]*href["']/i},{id:"svg-animate-xlinkhref",description:'<animate attributeName="xlink:href"',pattern:/<animate[\s\S]{0,80}attributeName\s*=\s*["'][\s]*xlink\s*:\s*href["']/i},{id:"svg-set-javascript",description:'<set to="javascript:..." \u2014 sets an attribute to a javascript: URI',pattern:/<set[\s\S]{0,80}to\s*=\s*["']?\s*javascript\s*:/i},{id:"svg-event-handler",description:"SVG-specific event handler attributes: onload=, onerror=, onactivate=, etc.",pattern:/\bon(?:load|error|activate|begin|end|repeat|focus|blur|click|mouse\w{1,20}|key\w{1,20})\s*=/i},{id:"svg-handler-generic",description:"Generic on* handler catch-all for SVG attributes",pattern:/\bon\w{1,30}\s*=/i},{id:"svg-filter-feimage",description:"<feImage href= \u2014 filter primitive that can load external resources",pattern:/<feImage[\s\S]{0,80}(?:xlink\s*:\s*)?href\s*=/i},{id:"svg-image-external",description:"<image xlink:href with http/https or javascript protocol",pattern:/<image[\s\S]{0,80}(?:xlink\s*:\s*)?href\s*=\s*["']?\s*(?:https?|javascript)\s*:/i},{id:"svg-style-javascript",description:"style= attribute containing javascript: (e.g. background:url(javascript:...))",pattern:/style\s*=[\s\S]{0,60}javascript\s*:/i}],tn=rc;var nc=[{id:"sql-block-comment-open",description:"SQL block comment open: /* ... */ \u2014 unusual in legitimate user text",pattern:/\/\*/},{id:"sql-union-select",description:"UNION SELECT \u2014 most common SQL injection aggregation attack",pattern:/\bUNION\s{1,20}(?:ALL\s{1,20})?SELECT\b/i},{id:"sql-drop-table",description:"DROP TABLE \u2014 destructive DDL injection",pattern:/\bDROP\s{1,20}TABLE\b/i},{id:"sql-drop-database",description:"DROP DATABASE \u2014 destructive DDL injection",pattern:/\bDROP\s{1,20}DATABASE\b/i},{id:"sql-insert-into",description:"INSERT INTO \u2014 data injection",pattern:/\bINSERT\s{1,20}INTO\b/i},{id:"sql-delete-from",description:"DELETE FROM \u2014 data deletion injection",pattern:/\bDELETE\s{1,20}FROM\b/i},{id:"sql-update-set",description:"UPDATE ... SET \u2014 data modification injection",pattern:/\bUPDATE\b[\s\S]{1,60}\bSET\b/i},{id:"sql-exec-xp",description:"EXEC xp_ \u2014 MSSQL extended stored procedure execution",pattern:/\bEXEC(?:UTE)?\s{1,20}xp_/i},{id:"sql-tautology-string",description:`Classic string tautology: ' OR '1'='1 or " OR "1"="1"`,pattern:/'\s{0,10}OR\s{0,10}'[^']{0,20}'\s*=\s*'[^']{0,20}/i},{id:"sql-tautology-numeric",description:"Numeric tautology: OR 1=1",pattern:/\bOR\s{1,10}1\s*=\s*1\b/i},{id:"sql-always-true-zero",description:"Numeric tautology: OR 0=0",pattern:/\bOR\s{1,10}0\s*=\s*0\b/i},{id:"sql-sleep-benchmark",description:"Time-based blind injection: SLEEP() or BENCHMARK()",pattern:/\b(?:SLEEP|BENCHMARK)\s*\(/i},{id:"sql-waitfor-delay",description:"MSSQL time-based blind injection: WAITFOR DELAY",pattern:/\bWAITFOR\s{1,20}DELAY\b/i},{id:"sql-char-function",description:"CHAR() function \u2014 used to obfuscate injected strings",pattern:/\bCHAR\s*\(\s*\d{1,3}/i},{id:"sql-information-schema",description:"INFORMATION_SCHEMA \u2014 reconnaissance query for table/column enumeration",pattern:/\bINFORMATION_SCHEMA\b/i}],ft=nc;var sc=[{id:"shell-path-traversal-unix",description:"Unix path traversal: ../ \u2014 climbing the directory tree",pattern:/\.\.\//},{id:"shell-path-traversal-windows",description:"Windows path traversal: ..\\ \u2014 climbing the directory tree",pattern:/\.\.\\/},{id:"shell-path-traversal-encoded",description:"URL-encoded path traversal: %2e%2e or %2f variants",pattern:/%2e%2e|%2f\.\.|\.\.%2f/i},{id:"shell-null-byte",description:"Null byte injection: \\x00 or %00 \u2014 truncates strings in C-backed functions",pattern:/\x00|%00/},{id:"shell-semicolon",description:"Semicolon command separator: cmd1; cmd2",pattern:/;/},{id:"shell-pipe",description:"Pipe operator: cmd1 | cmd2",pattern:/\|/},{id:"shell-and-operator",description:"AND operator: cmd1 && cmd2",pattern:/&&/},{id:"shell-or-operator",description:"OR operator: cmd1 || cmd2",pattern:/\|\|/},{id:"shell-backtick",description:"Backtick command substitution: `cmd`",pattern:/`/},{id:"shell-dollar-paren",description:"Dollar-paren command substitution: $(cmd)",pattern:/\$\(/},{id:"shell-dollar-brace",description:"Dollar-brace variable expansion: ${var} \u2014 can be abused for injection",pattern:/\$\{/},{id:"shell-redirect-out",description:"Output redirection: cmd > file or cmd >> file",pattern:/>{1,2}/},{id:"shell-redirect-in",description:"Input redirection: cmd < file",pattern:/</},{id:"shell-newline-injection",description:"Newline injection: \\n or \\r \u2014 can inject new shell commands",pattern:/[\n\r]/},{id:"shell-glob-star",description:"Glob expansion: * or ? \u2014 can expand to unintended files",pattern:/[/\\][*?]/},{id:"shell-absolute-root",description:"Absolute root path injection: string starting with / or \\ (Windows UNC)",pattern:/^(?:\/|\\\\)/},{id:"shell-windows-drive",description:"Windows drive letter path injection: C:\\ or D:/",pattern:/^[a-zA-Z]:[/\\]/},{id:"shell-curl-wget",description:"curl/wget with URL or flags \u2014 can exfiltrate data or download payloads",pattern:/\b(?:curl|wget)\s+(?:https?:\/\/|ftp:\/\/|-)/i}],rn=sc;var ic=[{id:"redos-nested-quantifier-plus",description:"Nested + quantifier inside a group with outer quantifier: (a+)+, (.+b)*, etc.",pattern:/\([^)]*\+[^)]*\)[+*]/},{id:"redos-nested-quantifier-star",description:"Nested * quantifier: (a*)* or (a*)+ \u2014 catastrophic backtracking",pattern:/\([^)]*\*[^)]*\)[*+]/},{id:"redos-nested-groups",description:"Doubly nested quantified groups: ((a+)+) \u2014 guaranteed catastrophic",pattern:/\(\([^)]{0,40}\)[+*]\)[+*]/},{id:"redos-alternation-overlap",description:"Overlapping alternation under quantifier: (a|a)+ \u2014 ambiguous NFA paths",pattern:/\(([^|()]{1,20})\|(?:\1)(?:\|[^|()]{1,20}){0,5}\)[+*?]{1,2}/},{id:"redos-star-plus-concat",description:"(x*x)+ pattern \u2014 triggers super-linear backtracking",pattern:/\([^)]{0,10}\*[^)]{0,10}\)[+*]/},{id:"redos-dot-star-greedy",description:"(.*){n,} or (.+){n,} \u2014 repeated greedy dot quantifiers",pattern:/\(\.[*+]\)\{?\d/},{id:"redos-large-repetition",description:"Very large fixed or range repetition count {1000,} or {1000,n} \u2014 denial of service via backtracking",pattern:/\{\d{4,}(?:,\d*)?\}/},{id:"redos-catastrophic-alternation",description:"Long alternation with many similar branches \u2014 polynomial backtracking risk",pattern:/\([^)]{0,200}(?:\|[^|)]{0,50}){9,}\)/}],nn=ic;var ae=`["'\\s]*:`,ac=[{id:"nosql-where-operator",description:"$where \u2014 executes arbitrary JavaScript server-side in MongoDB",pattern:new RegExp(`\\$where${ae}`,"i")},{id:"nosql-ne-operator",description:'$ne \u2014 "not equal" operator used to bypass equality checks',pattern:new RegExp(`\\$ne${ae}`,"i")},{id:"nosql-gt-operator",description:'$gt \u2014 "greater than" used to bypass password/value checks',pattern:new RegExp(`\\$gte?${ae}`,"i")},{id:"nosql-lt-operator",description:'$lt / $lte \u2014 "less than" bypass variants',pattern:new RegExp(`\\$lte?${ae}`,"i")},{id:"nosql-regex-operator",description:"$regex \u2014 can be used to extract data character by character (blind injection)",pattern:new RegExp(`\\$regex${ae}`,"i")},{id:"nosql-or-operator",description:"$or \u2014 logical OR; used to create always-true conditions",pattern:new RegExp(`\\$or${ae}\\s*\\[`,"i")},{id:"nosql-and-operator",description:"$and \u2014 logical AND operator injection",pattern:new RegExp(`\\$and${ae}\\s*\\[`,"i")},{id:"nosql-nor-operator",description:"$nor \u2014 logical NOR operator injection",pattern:new RegExp(`\\$nor${ae}\\s*\\[`,"i")},{id:"nosql-exists-operator",description:"$exists \u2014 can enumerate fields to determine schema",pattern:new RegExp(`\\$exists${ae}`,"i")},{id:"nosql-in-operator",description:"$in \u2014 matches any value in a list; can enumerate values",pattern:new RegExp(`\\$in${ae}\\s*\\[`,"i")},{id:"nosql-expr-operator",description:"$expr \u2014 allows aggregation expressions in queries (MongoDB 3.6+)",pattern:new RegExp(`\\$expr${ae}`,"i")},{id:"nosql-function-operator",description:"$function \u2014 executes arbitrary JavaScript in MongoDB 4.4+",pattern:new RegExp(`\\$function${ae}`,"i")},{id:"nosql-accumulator-operator",description:"$accumulator \u2014 custom aggregation with arbitrary JS execution",pattern:new RegExp(`\\$accumulator${ae}`,"i")},{id:"nosql-proto-pollution",description:"__proto__ \u2014 prototype pollution via object key injection",pattern:/__proto__/},{id:"nosql-constructor-prototype",description:"constructor.prototype \u2014 alternative prototype pollution vector (dot notation or JSON key)",pattern:/constructor[\s"':.,{\[]*prototype/i},{id:"nosql-proto-bracket",description:'["__proto__"] \u2014 bracket-notation prototype pollution',pattern:/\[["']__proto__["']\]/}],sn=ac;var oc=[{id:"log-crlf-injection",description:"CRLF injection: literal \\r or \\n embeds fake log lines",pattern:/[\r\n]/},{id:"log-url-encoded-crlf",description:"URL-encoded CRLF: %0d, %0a, %0D, %0A \u2014 decoded by some log parsers",pattern:/%0[dDaA]/},{id:"log-unicode-newline",description:"Unicode newline variants: U+2028 (line separator), U+2029 (paragraph separator)",pattern:/[\u2028\u2029]/},{id:"log-log4shell-jndi",description:"Log4Shell: ${jndi:...} triggers remote code execution in Apache Log4j",pattern:/\$\{jndi\s*:/i},{id:"log-log4shell-obfuscated",description:"Obfuscated Log4Shell: ${::-j}... lookup-bypass prefix used to evade WAF detection",pattern:/\$\{::-/},{id:"log-log4j-lookup",description:"Log4j lookup syntax: ${env:...}, ${sys:...}, ${ctx:...} \u2014 data exfiltration",pattern:/\$\{(?:env|sys|ctx|main|map|sd|web|docker|k8s|spring)\s*:/i},{id:"log-ssti-double-brace",description:"SSTI double-brace: {{expression}} \u2014 Jinja2, Twig, Handlebars, etc.",pattern:/\{\{[\s\S]{0,80}\}\}/},{id:"log-ssti-hash-brace",description:"SSTI hash-brace: #{expression} \u2014 Thymeleaf, Velocity, Ruby ERB",pattern:/#\{[\s\S]{0,80}\}/},{id:"log-ssti-dollar-brace",description:"SSTI/EL injection: ${expression with operators or method calls} \u2014 JSP EL, Freemarker, SpEL",pattern:/\$\{[^}]*(?:\.|\(|\*|\+|\bclass\b|\bruntime\b|\bprocess\b|\bexec\b)[^}]{0,80}\}/i},{id:"log-ssti-percent-tag",description:"SSTI ERB/ASP tag: <%= expression %> \u2014 Ruby ERB, ASP",pattern:/<%=[\s\S]{0,80}%>/},{id:"log-null-byte",description:"Null byte: \\x00 or %00 \u2014 can truncate log entries in C-backed loggers",pattern:/\x00|%00/},{id:"log-ansi-escape",description:"ANSI escape sequence: ESC[ \u2014 can manipulate terminal output when logs are tailed",pattern:/\x1b\[/}],an=oc;var cc=[{id:"sql-line-comment",description:"SQL line comment: -- followed by whitespace or end of string",pattern:/--(?:\s|$)/},{id:"sql-stacked-query",description:"Stacked queries: semicolon immediately followed by a SQL keyword",pattern:/;\s{0,10}(?:SELECT|INSERT|UPDATE|DELETE|DROP|CREATE|ALTER|EXEC)\b/i},{id:"sql-hex-encoding",description:"Hex-encoded string injection: 0x41414141 style (MySQL)",pattern:/\b0x[0-9a-f]{4,}/i}],lc=[...ft,...cc],on=lc;$e.label="HTML";Xe.label="XML";tn.label="SVG";ft.label="SQL";on.label="SQL-STRICT";rn.label="SHELL";nn.label="REDOS";sn.label="NOSQL";an.label="LOG";var yh=Object.freeze({HTML:$e,XML:Xe,SVG:tn,SQL:ft,"SQL-STRICT":on,SHELL:rn,REDOS:nn,NOSQL:sn,LOG:an});function dc(e){if(typeof e!="string")throw new TypeError(`is-unsafe: first argument must be a string, got ${typeof e}`)}function uc(e){if(!(e instanceof RegExp)){if(Array.isArray(e)){if(e.length===0)throw new TypeError("is-unsafe: context must not be an empty array");if(Array.isArray(e[0])){for(let t of e)if(!Array.isArray(t)||t.length===0)throw new TypeError("is-unsafe: each context in the array must be a non-empty pattern array (PatternList)")}return}throw new TypeError(`is-unsafe: second argument must be a PatternList (e.g. HTML), an array of PatternLists (e.g. [HTML, XML]), or a RegExp. Got: ${typeof e}`)}}function Ac(e){return e instanceof RegExp?{lists:null,regex:e}:Array.isArray(e[0])?{lists:e,regex:null}:{lists:[e],regex:null}}function pc(e,t){let r=t.label??"CUSTOM";for(let n of t)if(n.pattern.test(e))return{context:r,id:n.id,description:n.description,pattern:n.pattern};return null}function Rs(e,t){dc(e),uc(t);let{lists:r,regex:n}=Ac(t);if(n)return n.test(e);for(let s of r)if(pc(e,s)!==null)return!0;return!1}function hc(e,t){if(!e)return{};let r=t.attributesGroupName?e[t.attributesGroupName]:e;if(!r)return{};let n={};for(let s in r)if(s.startsWith(t.attributeNamePrefix)){let a=s.substring(t.attributeNamePrefix.length);n[a]=r[s]}else n[s]=r[s];return n}function gc(e){if(!e||typeof e!="string")return;let t=e.indexOf(":");if(t!==-1&&t>0){let r=e.substring(0,t);if(r!=="xmlns")return r}}var Et=class{constructor(t,r){this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.parseXml=bc,this.parseTextData=mc,this.resolveNameSpace=fc,this.buildAttributesMap=Tc,this.isItStopNode=wc,this.replaceEntitiesValue=Ic,this.readStopNodeData=Nc,this.saveTextToParentTag=yc,this.addChild=Cc,this.ignoreAttributesFn=qr(this.options.ignoreAttributes),this.entityExpansionCount=0,this.currentExpandedLength=0,this.doctypefound=!1;let n={...pt};this.options.entityDecoder?this.entityDecoder=this.options.entityDecoder:(typeof this.options.htmlEntities=="object"?n=this.options.htmlEntities:this.options.htmlEntities===!0&&(n={...jr,...Jr}),this.entityDecoder=new Ke({namedEntities:{...n,...r},numericAllowed:this.options.htmlEntities,limit:{maxTotalExpansions:this.options.processEntities.maxTotalExpansions,maxExpandedLength:this.options.processEntities.maxExpandedLength,applyLimitsTo:this.options.processEntities.appliesTo},onInputEntity:(a,c)=>Rs(c,[$e,Xe])?We.BLOCK:We.ALLOW})),this.matcher=new Ve,this.readonlyMatcher=this.matcher.readOnly(),this.isCurrentNodeStopNode=!1,this.stopNodeExpressionsSet=new je;let s=this.options.stopNodes;if(s&&s.length>0){for(let a=0;a<s.length;a++){let c=s[a];typeof c=="string"?this.stopNodeExpressionsSet.add(new Be(c)):c instanceof Be&&this.stopNodeExpressionsSet.add(c)}this.stopNodeExpressionsSet.seal()}}};function mc(e,t,r,n,s,a,c){let l=this.options;if(e!==void 0&&(l.trimValues&&!n&&(e=e.trim()),e.length>0)){c||(e=this.replaceEntitiesValue(e,t,r));let o=l.jPath?r.toString():r,d=l.tagValueProcessor(t,e,o,s,a);return d==null?e:typeof d!=typeof e||d!==e?d:l.trimValues||e.trim()===e?dn(e,l.parseTagValue,l.numberParseOptions):e}}function fc(e){if(this.options.removeNSPrefix){let t=e.split(":"),r=e.charAt(0)==="/"?"/":"";if(t[0]==="xmlns")return"";t.length===2&&(e=r+t[1])}return e}var Ec=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Tc(e,t,r,n=!1){let s=this.options;if(n===!0||s.ignoreAttributes!==!0&&typeof e=="string"){let a=Jt(e,Ec),c=a.length,l={},o=new Array(c),d=!1,p={};for(let m=0;m<c;m++){let y=this.resolveNameSpace(a[m][1]),w=a[m][4];if(y.length&&w!==void 0){let I=w;s.trimValues&&(I=I.trim()),I=this.replaceEntitiesValue(I,r,this.readonlyMatcher),o[m]=I,p[y]=I,d=!0}}d&&typeof t=="object"&&t.updateCurrent&&t.updateCurrent(p);let h=s.jPath?t.toString():this.readonlyMatcher,f=!1;for(let m=0;m<c;m++){let y=this.resolveNameSpace(a[m][1]);if(this.ignoreAttributesFn(y,h))continue;let w=s.attributeNamePrefix+y;if(y.length)if(s.transformAttributeName&&(w=s.transformAttributeName(w)),w=Ls(w,s),a[m][4]!==void 0){let I=o[m],_=s.attributeValueProcessor(y,I,h);_==null?l[w]=I:typeof _!=typeof I||_!==I?l[w]=_:l[w]=dn(I,s.parseAttributeValue,s.numberParseOptions),f=!0}else s.allowBooleanAttributes&&(l[w]=!0,f=!0)}if(!f)return;if(s.attributesGroupName&&!s.preserveOrder){let m={};return m[s.attributesGroupName]=l,m}return l}}var bc=function(e){e=e.replace(/\r\n?/g,`
7
+ `);let t=new re("!xml"),r=t,n="";this.matcher.reset(),this.entityDecoder.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0,this.doctypefound=!1;let s=this.options,a=new mt(s.processEntities),c=e.length;for(let l=0;l<c;l++)if(e[l]==="<"){let d=e.charCodeAt(l+1);if(d===47){let p=Ze(e,">",l,"Closing Tag is not closed."),h=e.substring(l+2,p).trim();if(s.removeNSPrefix){let m=h.indexOf(":");m!==-1&&(h=h.substr(m+1))}h=cn(s.transformTagName,h,"",s).tagName,r&&(n=this.saveTextToParentTag(n,r,this.readonlyMatcher));let f=this.matcher.getCurrentTag();if(h&&s.unpairedTagsSet.has(h))throw new Error(`Unpaired tag can not be used as closing tag: </${h}>`);f&&s.unpairedTagsSet.has(f)&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=!1,r=this.tagsNodeStack.pop(),n="",l=p}else if(d===63){let p=ln(e,l,!1,"?>");if(!p)throw new Error("Pi Tag is not closed.");n=this.saveTextToParentTag(n,r,this.readonlyMatcher);let h=this.buildAttributesMap(p.tagExp,this.matcher,p.tagName,!0);if(h){let f=h[this.options.attributeNamePrefix+"version"];this.entityDecoder.setXmlVersion(Number(f)||1),a.setXmlVersion(Number(f)||1)}if(!(s.ignoreDeclaration&&p.tagName==="?xml"||s.ignorePiTags)){let f=new re(p.tagName);f.add(s.textNodeName,""),p.tagName!==p.tagExp&&p.attrExpPresent&&s.ignoreAttributes!==!0&&(f[":@"]=h),this.addChild(r,f,this.readonlyMatcher,l)}l=p.closeIndex+1}else if(d===33&&e.charCodeAt(l+2)===45&&e.charCodeAt(l+3)===45){let p=Ze(e,"-->",l+4,"Comment is not closed.");if(s.commentPropName){let h=e.substring(l+4,p-2);n=this.saveTextToParentTag(n,r,this.readonlyMatcher),r.add(s.commentPropName,[{[s.textNodeName]:h}])}l=p}else if(d===33&&e.charCodeAt(l+2)===68){if(this.doctypefound)throw new Error("Multiple DOCTYPE declarations found.");this.doctypefound=!0;let p=a.readDocType(e,l);this.entityDecoder.addInputEntities(p.entities),l=p.i}else if(d===33&&e.charCodeAt(l+2)===91){let p=Ze(e,"]]>",l,"CDATA is not closed.")-2,h=e.substring(l+9,p);n=this.saveTextToParentTag(n,r,this.readonlyMatcher);let f=this.parseTextData(h,r.tagname,this.readonlyMatcher,!0,!1,!0,!0);f==null&&(f=""),s.cdataPropName?r.add(s.cdataPropName,[{[s.textNodeName]:h}]):r.add(s.textNodeName,f),l=p+2}else{let p=ln(e,l,s.removeNSPrefix);if(!p){let P=e.substring(Math.max(0,l-50),Math.min(c,l+50));throw new Error(`readTagExp returned undefined at position ${l}. Context: "${P}"`)}let h=p.tagName,f=p.rawTagName,m=p.tagExp,y=p.attrExpPresent,w=p.closeIndex;if({tagName:h,tagExp:m}=cn(s.transformTagName,h,m,s),s.strictReservedNames&&(h===s.commentPropName||h===s.cdataPropName||h===s.textNodeName||h===s.attributesGroupName))throw new Error(`Invalid tag name: ${h}`);r&&n&&r.tagname!=="!xml"&&(n=this.saveTextToParentTag(n,r,this.readonlyMatcher,!1));let I=r;I&&s.unpairedTagsSet.has(I.tagname)&&(r=this.tagsNodeStack.pop(),this.matcher.pop());let _=!1;m.length>0&&m.lastIndexOf("/")===m.length-1&&(_=!0,h[h.length-1]==="/"?(h=h.substr(0,h.length-1),m=h):m=m.substr(0,m.length-1),y=h!==m);let N=null,L={},B;B=gc(f),h!==t.tagname&&this.matcher.push(h,{},B),h!==m&&y&&(N=this.buildAttributesMap(m,this.matcher,h),N&&(L=hc(N,s))),h!==t.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode());let R=l;if(this.isCurrentNodeStopNode){let P="";if(_)l=p.closeIndex;else if(s.unpairedTagsSet.has(h))l=p.closeIndex;else{let x=this.readStopNodeData(e,f,w+1);if(!x)throw new Error(`Unexpected end of ${f}`);l=x.i,P=x.tagContent}let G=new re(h);N&&(G[":@"]=N),G.add(s.textNodeName,P),this.matcher.pop(),this.isCurrentNodeStopNode=!1,this.addChild(r,G,this.readonlyMatcher,R)}else{if(_){({tagName:h,tagExp:m}=cn(s.transformTagName,h,m,s));let P=new re(h);N&&(P[":@"]=N),this.addChild(r,P,this.readonlyMatcher,R),this.matcher.pop(),this.isCurrentNodeStopNode=!1}else if(s.unpairedTagsSet.has(h)){let P=new re(h);N&&(P[":@"]=N),this.addChild(r,P,this.readonlyMatcher,R),this.matcher.pop(),this.isCurrentNodeStopNode=!1,l=p.closeIndex;continue}else{let P=new re(h);if(this.tagsNodeStack.length>s.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(r),N&&(P[":@"]=N),this.addChild(r,P,this.readonlyMatcher,R),r=P}n="",l=w}}}else n+=e[l];return t.child};function Cc(e,t,r,n){this.options.captureMetaData||(n=void 0);let s=this.options.jPath?r.toString():r,a=this.options.updateTag(t.tagname,s,t[":@"]);a===!1||(typeof a=="string"&&(t.tagname=a),e.addChild(t,n))}function Ic(e,t,r){let n=this.options.processEntities;if(!n||!n.enabled)return e;if(n.allowedTags){let s=this.options.jPath?r.toString():r;if(!(Array.isArray(n.allowedTags)?n.allowedTags.includes(t):n.allowedTags(t,s)))return e}if(n.tagFilter){let s=this.options.jPath?r.toString():r;if(!n.tagFilter(t,s))return e}return this.entityDecoder.decode(e)}function yc(e,t,r,n){return e&&(n===void 0&&(n=t.child.length===0),e=this.parseTextData(e,t.tagname,r,!1,t[":@"]?Object.keys(t[":@"]).length!==0:!1,n),e!==void 0&&e!==""&&t.add(this.options.textNodeName,e),e=""),e}function wc(){return this.stopNodeExpressionsSet.size===0?!1:this.matcher.matchesAny(this.stopNodeExpressionsSet)}function xc(e,t,r=">"){let n=0,s=e.length,a=r.charCodeAt(0),c=r.length>1?r.charCodeAt(1):-1,l="",o=t;for(let d=t;d<s;d++){let p=e.charCodeAt(d);if(n)p===n&&(n=0);else if(p===34||p===39)n=p;else if(p===a)if(c!==-1){if(e.charCodeAt(d+1)===c)return l+=e.substring(o,d),{data:l,index:d}}else return l+=e.substring(o,d),{data:l,index:d};else p===9&&!n&&(l+=e.substring(o,d)+" ",o=d+1)}}function Ze(e,t,r,n){let s=e.indexOf(t,r);if(s===-1)throw new Error(n);return s+t.length-1}function Sc(e,t,r,n){let s=e.indexOf(t,r);if(s===-1)throw new Error(n);return s}function ln(e,t,r,n=">"){let s=xc(e,t+1,n);if(!s)return;let a=s.data,c=s.index,l=a.search(/\s/),o=a,d=!0;l!==-1&&(o=a.substring(0,l),a=a.substring(l+1).trimStart());let p=o;if(r){let h=o.indexOf(":");h!==-1&&(o=o.substr(h+1),d=o!==s.data.substr(h+1))}return{tagName:o,tagExp:a,closeIndex:c,attrExpPresent:d,rawTagName:p}}function Nc(e,t,r){let n=r,s=1,a=e.length;for(;r<a;r++)if(e[r]==="<"){let c=e.charCodeAt(r+1);if(c===47){let l=Sc(e,">",r,`${t} is not closed`);if(e.substring(r+2,l).trim()===t&&(s--,s===0))return{tagContent:e.substring(n,r),i:l};r=l}else if(c===63)r=Ze(e,"?>",r+1,"StopNode is not closed.");else if(c===33&&e.charCodeAt(r+2)===45&&e.charCodeAt(r+3)===45)r=Ze(e,"-->",r+3,"StopNode is not closed.");else if(c===33&&e.charCodeAt(r+2)===91)r=Ze(e,"]]>",r,"StopNode is not closed.")-2;else{let l=ln(e,r,!1);l&&((l&&l.tagName)===t&&l.tagExp[l.tagExp.length-1]!=="/"&&s++,r=l.closeIndex)}}}function dn(e,t,r){if(t&&typeof e=="string"){let n=e.trim();return n==="true"?!0:n==="false"?!1:zr(e,r)}else return us(e)?e:""}function cn(e,t,r,n){if(e){let s=e(t);r===t&&(r=s),t=s}return t=Ls(t,n),{tagName:t,tagExp:r}}function Ls(e,t){if(jt.includes(e))throw new Error(`[SECURITY] Invalid name: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`);return ut.includes(e)?t.onDangerousProperty(e):e}var un=re.getMetaDataSymbol();function _c(e,t){if(!e||typeof e!="object")return{};if(!t)return e;let r={};for(let n in e)if(n.startsWith(t)){let s=n.substring(t.length);r[s]=e[n]}else r[n]=e[n];return r}function An(e,t,r,n){return Os(e,t,r,n)}function Os(e,t,r,n){let s,a={};for(let c=0;c<e.length;c++){let l=e[c],o=Rc(l);if(o!==void 0&&o!==t.textNodeName){let d=_c(l[":@"]||{},t.attributeNamePrefix);r.push(o,d)}if(o===t.textNodeName)s===void 0?s=l[o]:s+=""+l[o];else{if(o===void 0)continue;if(l[o]){let d=Os(l[o],t,r,n),p=Oc(d,t);if(Object.keys(d).length===0&&t.alwaysCreateTextNode&&(d[t.textNodeName]=""),l[":@"]?Lc(d,l[":@"],n,t):Object.keys(d).length===1&&d[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?d=d[t.textNodeName]:Object.keys(d).length===0&&(t.alwaysCreateTextNode?d[t.textNodeName]="":d=""),l[un]!==void 0&&typeof d=="object"&&d!==null&&(d[un]=l[un]),a[o]!==void 0&&Object.prototype.hasOwnProperty.call(a,o))Array.isArray(a[o])||(a[o]=[a[o]]),a[o].push(d);else{let h=t.jPath?n.toString():n;t.isArray(o,h,p)?a[o]=[d]:a[o]=d}o!==void 0&&o!==t.textNodeName&&r.pop()}}}return typeof s=="string"?s.length>0&&(a[t.textNodeName]=s):s!==void 0&&(a[t.textNodeName]=s),a}function Rc(e){let t=Object.keys(e);for(let r=0;r<t.length;r++){let n=t[r];if(n!==":@")return n}}function Lc(e,t,r,n){if(t){let s=Object.keys(t),a=s.length;for(let c=0;c<a;c++){let l=s[c],o=l.startsWith(n.attributeNamePrefix)?l.substring(n.attributeNamePrefix.length):l,d=n.jPath?r.toString()+"."+o:r;n.isArray(l,d,!0,!0)?e[l]=[t[l]]:e[l]=t[l]}}}function Oc(e,t){let{textNodeName:r}=t,n=Object.keys(e).length;return!!(n===0||n===1&&(e[r]||typeof e[r]=="boolean"||e[r]===0))}var ze=class{constructor(t){this.externalEntities={},this.options=Ts(t)}parse(t,r){if(typeof t!="string"&&t.toString)t=t.toString();else if(typeof t!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(r){r===!0&&(r={});let a=Vt(t,r);if(a!==!0)throw Error(`${a.err.msg}:${a.err.line}:${a.err.col}`)}let n=new Et(this.options,this.externalEntities),s=n.parseXml(t);return this.options.preserveOrder||s===void 0?s:An(s,this.options,n.matcher,n.readonlyMatcher)}addEntity(t,r){if(r.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(t.indexOf("&")!==-1||t.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(r==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=r}static getMetaDataSymbol(){return re.getMetaDataSymbol()}};var vs={validate:Vt};var vc=/\.(?:avif|bmp|css|csv|docx?|eot|gif|gz|ico|jpe?g|js|json|map|mp3|mp4|mov|ogg|otf|pdf|png|pptx?|rar|rss|svg|tar|tiff?|ttf|txt|wav|webm|webp|woff2?|xlsx?|xml|zip)$/i;function Y(e,t,{includeQuery:r=!1}={}){let n;try{n=t?new URL(e,t):new URL(e)}catch{return null}return n.protocol!=="http:"&&n.protocol!=="https:"?null:(n.hash="",r||(n.search=""),n.pathname.length>1&&n.pathname.endsWith("/")&&(n.pathname=n.pathname.replace(/\/+$/,"")),n.href)}function de(e,t){try{return new URL(e).origin===t}catch{return!1}}function tr(e){try{let t=new URL(e);return!vc.test(t.pathname)}catch{return!1}}var pn=10*1024*1024,Ds=100,kc=5e4,Bc=new ze({ignoreAttributes:!1,removeNSPrefix:!0,trimValues:!0});function rr(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}function ks(e){return(e===void 0?[]:Array.isArray(e)?e:[e]).flatMap(r=>{let n=rr(r)?.loc;return typeof n=="string"?[n]:[]})}function Pc(e,t,r){let s=t.toLowerCase().endsWith(".gz")||r.includes("gzip")||e[0]===31&&e[1]===139?Dc(e):e;if(s.byteLength>pn)throw new Error(`sitemap exceeds ${pn} bytes after decompression: ${t}`);return s.toString("utf8").replace(/^\uFEFF/,"")}function Bs(e,t){let r=vs.validate(e);if(r!==!0)throw new Error(`invalid sitemap XML at ${t}: ${r.err.msg}`);let n=rr(Bc.parse(e)),s=rr(n?.sitemapindex);if(s)return{kind:"index",locations:ks(s.sitemap)};let a=rr(n?.urlset);if(a)return{kind:"urlset",locations:ks(a.url)};throw new Error(`XML is not a sitemap urlset or sitemapindex: ${t}`)}function Ps(e){return{fetch:e.fetch??globalThis.fetch,timeout:e.timeout,maxRedirects:e.maxRedirects??10,retries:e.retries??2,signal:e.signal,gate:e.requestGate?async t=>e.requestGate?.(t):void 0,onEvent:e.onEvent}}async function Ms(e,t){let{response:r}=await Oe(e,{headers:{accept:"application/xml,text/xml,application/gzip,text/plain;q=0.9,*/*;q=0.1","user-agent":t.userAgent}},Ps(t));if(!r.ok)throw await r.body?.cancel(),new Error(`sitemap returned HTTP ${r.status}: ${e}`);let{buffer:n}=await ve(r,pn);return Pc(n,e,r.headers.get("content-type")?.toLowerCase()??"")}async function Mc(e,t){try{let r=await Ms(e,t);return Bs(r,e),!0}catch{return!1}}async function Us(e,t){let r=Y(e,void 0);if(!r)throw new Error(`invalid start URL: ${e}`);let n=new URL(r).origin,s=new URL("/robots.txt",n).href;try{if(t.robotsBody!==void 0)for(let a of t.robotsBody.matchAll(/^sitemap:\s*(\S+)\s*$/gim)){let c=a[1];if(!c)continue;let l=Y(c,s,{includeQuery:!0});if(l&&de(l,n))return l}else{let{response:a}=await Oe(s,{headers:{accept:"text/plain,*/*;q=0.1","user-agent":t.userAgent}},Ps({...t,siteOrigin:n}));if(a.ok){let{text:c}=await ve(a,524288);for(let l of c.matchAll(/^sitemap:\s*(\S+)\s*$/gim)){let o=l[1];if(!o)continue;let d=Y(o,s,{includeQuery:!0});if(d&&de(d,n))return d}}else await a.body?.cancel()}}catch{}for(let a of["/sitemap.xml","/sitemap.xml.gz","/sitemap_index.xml"]){let c=new URL(a,n).href;if(await Mc(c,{...t,siteOrigin:n}))return c}return null}async function nr(e,t){let r=Y(e,void 0,{includeQuery:!0});if(!r)throw new Error(`invalid sitemap URL: ${e}`);let n=new URL(r).origin,s=[r],a=new Set,c=[],l=new Set,o=t.maxUrls??kc,d=!1;for(;s.length>0&&a.size<Ds&&c.length<o;){let p=s.shift();if(a.has(p))continue;a.add(p);let h=Bs(await Ms(p,t),p);if(h.kind==="index"){for(let f of h.locations){let m=Y(f,p,{includeQuery:!0});m&&de(m,n)&&!a.has(m)&&!s.includes(m)&&s.push(m)}s.sort();continue}for(let f of h.locations){let m=Y(f,p,{includeQuery:t.includeQuery??!1});if(!(!m||l.has(m)||!de(m,t.siteOrigin)||!tr(m))&&(l.add(m),c.push(m),c.length>=o)){d=!0;break}}}return(s.length>0||a.size>=Ds)&&(d=!0),{url:r,urls:c.sort(),sitemapCount:a.size,truncated:d,error:null}}async function hn(e,t){await e.onEvent?.(t)}async function ue(e,t={}){let r=Te(e),n=Y(r.url,void 0,{includeQuery:r.includeQuery});if(!n)throw new Error(`invalid start URL: ${r.url}`);let s=new URL(n).origin,a=t.fetch??globalThis.fetch,c=Ge(r.delay),l=t.logger??Wt;await hn(t,{type:"plan-start",url:n});let o=await Kt(n,{userAgent:_e,timeout:r.timeout,maxRedirects:r.maxRedirects,retries:2,fetch:a,signal:t.signal,requestGate:c,onEvent:t.onEvent,logger:l});await hn(t,{type:"robots",robots:o});let d=null;r.sitemap==="auto"?d=await Us(n,{timeout:r.timeout,maxRedirects:r.maxRedirects,userAgent:_e,fetch:a,signal:t.signal,requestGate:c,onEvent:t.onEvent,robotsBody:o.body}):r.sitemap!=="none"&&(d=r.sitemap);let p=null;if(d)try{p=await nr(d,{siteOrigin:s,includeQuery:r.includeQuery,maxUrls:5e4,timeout:r.timeout,maxRedirects:r.maxRedirects,retries:2,userAgent:_e,fetch:a,signal:t.signal,requestGate:c,onEvent:t.onEvent})}catch(m){p={url:d,urls:[],sitemapCount:0,truncated:!1,error:m instanceof Error?m.message:String(m)},l.warn(`Could not load sitemap ${d}: ${p.error}`)}let h=p?[...new Set([n,...p.urls])].sort((m,y)=>m===n?-1:y===n?1:m.localeCompare(y)):[n],f=p?h.length:null;return await hn(t,{type:"sitemap",sitemap:p,candidateCount:f}),{planVersion:1,config:r,startUrl:n,origin:s,userAgent:_e,robots:o,sitemap:p,candidateUrls:h,candidateCount:f,mode:p?"sitemap":"links"}}import{createHash as Li}from"node:crypto";var Uc=new Set([65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111]),M="\uFFFD",u;(function(e){e[e.EOF=-1]="EOF",e[e.NULL=0]="NULL",e[e.TABULATION=9]="TABULATION",e[e.CARRIAGE_RETURN=13]="CARRIAGE_RETURN",e[e.LINE_FEED=10]="LINE_FEED",e[e.FORM_FEED=12]="FORM_FEED",e[e.SPACE=32]="SPACE",e[e.EXCLAMATION_MARK=33]="EXCLAMATION_MARK",e[e.QUOTATION_MARK=34]="QUOTATION_MARK",e[e.AMPERSAND=38]="AMPERSAND",e[e.APOSTROPHE=39]="APOSTROPHE",e[e.HYPHEN_MINUS=45]="HYPHEN_MINUS",e[e.SOLIDUS=47]="SOLIDUS",e[e.DIGIT_0=48]="DIGIT_0",e[e.DIGIT_9=57]="DIGIT_9",e[e.SEMICOLON=59]="SEMICOLON",e[e.LESS_THAN_SIGN=60]="LESS_THAN_SIGN",e[e.EQUALS_SIGN=61]="EQUALS_SIGN",e[e.GREATER_THAN_SIGN=62]="GREATER_THAN_SIGN",e[e.QUESTION_MARK=63]="QUESTION_MARK",e[e.LATIN_CAPITAL_A=65]="LATIN_CAPITAL_A",e[e.LATIN_CAPITAL_Z=90]="LATIN_CAPITAL_Z",e[e.RIGHT_SQUARE_BRACKET=93]="RIGHT_SQUARE_BRACKET",e[e.GRAVE_ACCENT=96]="GRAVE_ACCENT",e[e.LATIN_SMALL_A=97]="LATIN_SMALL_A",e[e.LATIN_SMALL_Z=122]="LATIN_SMALL_Z"})(u||(u={}));var z={DASH_DASH:"--",CDATA_START:"[CDATA[",DOCTYPE:"doctype",SCRIPT:"script",PUBLIC:"public",SYSTEM:"system"};function sr(e){return e>=55296&&e<=57343}function Fs(e){return e>=56320&&e<=57343}function Hs(e,t){return(e-55296)*1024+9216+t}function ir(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function ar(e){return e>=64976&&e<=65007||Uc.has(e)}var T;(function(e){e.controlCharacterInInputStream="control-character-in-input-stream",e.noncharacterInInputStream="noncharacter-in-input-stream",e.surrogateInInputStream="surrogate-in-input-stream",e.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",e.endTagWithAttributes="end-tag-with-attributes",e.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",e.unexpectedSolidusInTag="unexpected-solidus-in-tag",e.unexpectedNullCharacter="unexpected-null-character",e.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",e.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",e.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",e.missingEndTagName="missing-end-tag-name",e.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",e.unknownNamedCharacterReference="unknown-named-character-reference",e.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",e.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",e.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",e.eofBeforeTagName="eof-before-tag-name",e.eofInTag="eof-in-tag",e.missingAttributeValue="missing-attribute-value",e.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",e.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",e.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",e.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",e.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",e.missingDoctypePublicIdentifier="missing-doctype-public-identifier",e.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",e.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",e.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",e.cdataInHtmlContent="cdata-in-html-content",e.incorrectlyOpenedComment="incorrectly-opened-comment",e.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",e.eofInDoctype="eof-in-doctype",e.nestedComment="nested-comment",e.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",e.eofInComment="eof-in-comment",e.incorrectlyClosedComment="incorrectly-closed-comment",e.eofInCdata="eof-in-cdata",e.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",e.nullCharacterReference="null-character-reference",e.surrogateCharacterReference="surrogate-character-reference",e.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",e.controlCharacterReference="control-character-reference",e.noncharacterCharacterReference="noncharacter-character-reference",e.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",e.missingDoctypeName="missing-doctype-name",e.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",e.duplicateAttribute="duplicate-attribute",e.nonConformingDoctype="non-conforming-doctype",e.missingDoctype="missing-doctype",e.misplacedDoctype="misplaced-doctype",e.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",e.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",e.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",e.openElementsLeftAfterEof="open-elements-left-after-eof",e.abandonedHeadElementChild="abandoned-head-element-child",e.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",e.nestedNoscriptInHead="nested-noscript-in-head",e.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text"})(T||(T={}));var Hc=65536,or=class{constructor(t){this.handler=t,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=Hc,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+ +(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(t,r){let{line:n,col:s,offset:a}=this,c=s+r,l=a+r;return{code:t,startLine:n,endLine:n,startCol:c,endCol:c,startOffset:l,endOffset:l}}_err(t){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(t,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(t){if(this.pos!==this.html.length-1){let r=this.html.charCodeAt(this.pos+1);if(Fs(r))return this.pos++,this._addGap(),Hs(t,r)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,u.EOF;return this._err(T.surrogateInInputStream),t}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(t,r){this.html.length>0?this.html+=t:this.html=t,this.endOfChunkHit=!1,this.lastChunkWritten=r}insertHtmlAtCurrentPos(t){this.html=this.html.substring(0,this.pos+1)+t+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(t,r){if(this.pos+t.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(r)return this.html.startsWith(t,this.pos);for(let n=0;n<t.length;n++)if((this.html.charCodeAt(this.pos+n)|32)!==t.charCodeAt(n))return!1;return!0}peek(t){let r=this.pos+t;if(r>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,u.EOF;let n=this.html.charCodeAt(r);return n===u.CARRIAGE_RETURN?u.LINE_FEED:n}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,u.EOF;let t=this.html.charCodeAt(this.pos);return t===u.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,u.LINE_FEED):t===u.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,sr(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===u.LINE_FEED||t===u.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){ir(t)?this._err(T.controlCharacterInInputStream):ar(t)&&this._err(T.noncharacterInInputStream)}retreat(t){for(this.pos-=t;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}};var v;(function(e){e[e.CHARACTER=0]="CHARACTER",e[e.NULL_CHARACTER=1]="NULL_CHARACTER",e[e.WHITESPACE_CHARACTER=2]="WHITESPACE_CHARACTER",e[e.START_TAG=3]="START_TAG",e[e.END_TAG=4]="END_TAG",e[e.COMMENT=5]="COMMENT",e[e.DOCTYPE=6]="DOCTYPE",e[e.EOF=7]="EOF",e[e.HIBERNATION=8]="HIBERNATION"})(v||(v={}));function cr(e,t){for(let r=e.attrs.length-1;r>=0;r--)if(e.attrs[r].name===t)return e.attrs[r].value;return null}var Yc=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function Qs(e){return e>=55296&&e<=57343||e>1114111?65533:Yc.get(e)??e}function Ys(e){let t=atob(e),r=t.length&-2,n=new Uint16Array(r/2);for(let s=0,a=0;s<r;s+=2){let c=t.charCodeAt(s),l=t.charCodeAt(s+1);n[a++]=c|l<<8}return n}var gn=Ys("QR08ALkAAgH6AYsDNQR2BO0EPgXZBQEGLAbdBxMISQrvCmQLfQurDKQNLw4fD4YPpA+6D/IPAAAAAAAAAAAAAAAAKhBMEY8TmxUWF2EYLBkxGuAa3RsJHDscWR8YIC8jSCSIJcMl6ie3Ku8rEC0CLjoupS7kLgAIRU1hYmNmZ2xtbm9wcnN0dVQAWgBeAGUAaQBzAHcAfgCBAIQAhwCSAJoAoACsALMAbABpAGcAO4DGAMZAUAA7gCYAJkBjAHUAdABlADuAwQDBQHIiZXZlAAJhAAFpeW0AcgByAGMAO4DCAMJAEGRyAADgNdgE3XIAYQB2AGUAO4DAAMBA8CFoYZFj4SFjcgBhZAAAoFMqAAFncIsAjgBvAG4ABGFmAADgNdg43fAlbHlGdW5jdGlvbgCgYSBpAG4AZwA7gMUAxUAAAWNzpACoAHIAAOA12Jzc6SFnbgCgVCJpAGwAZABlADuAwwDDQG0AbAA7gMQAxEAABGFjZWZvcnN1xQDYANoA7QDxAPYA+QD8AAABY3LJAM8AayNzbGFzaAAAoBYidgHTANUAAKDnKmUAZAAAoAYjeQARZIABY3J0AOAA5QDrAGEidXNlAACgNSLuI291bGxpcwCgLCFhAJJjcgAA4DXYBd1wAGYAAOA12Dnd5SF2ZdhiYwDyAOoAbSJwZXEAAKBOIgAHSE9hY2RlZmhpbG9yc3UXARoBHwE6AVIBVQFiAWQBZgGCAakB6QHtAfIB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DdIXAAZgAA4DXYa91jAHIAAOA12M/cAAFqbiYvKC8AoA0gagAAoAwg");var J;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.FLAG13=8192]="FLAG13",e[e.BRANCH_LENGTH=8064]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(J||(J={}));var H;(function(e){e[e.NUM=35]="NUM",e[e.SEMI=59]="SEMI",e[e.EQUALS=61]="EQUALS",e[e.ZERO=48]="ZERO",e[e.NINE=57]="NINE",e[e.LOWER_A=97]="LOWER_A",e[e.LOWER_F=102]="LOWER_F",e[e.LOWER_X=120]="LOWER_X",e[e.LOWER_Z=122]="LOWER_Z",e[e.UPPER_A=65]="UPPER_A",e[e.UPPER_F=70]="UPPER_F",e[e.UPPER_Z=90]="UPPER_Z"})(H||(H={}));var Gs=32;function mn(e){return e>=H.ZERO&&e<=H.NINE}function Gc(e){return e>=H.UPPER_A&&e<=H.UPPER_F||e>=H.LOWER_A&&e<=H.LOWER_F}function Wc(e){return e>=H.UPPER_A&&e<=H.UPPER_Z||e>=H.LOWER_A&&e<=H.LOWER_Z||mn(e)}function Kc(e){return e===H.EQUALS||Wc(e)}var W;(function(e){e[e.EntityStart=0]="EntityStart",e[e.NumericStart=1]="NumericStart",e[e.NumericDecimal=2]="NumericDecimal",e[e.NumericHex=3]="NumericHex",e[e.NamedEntity=4]="NamedEntity"})(W||(W={}));var Ee;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(Ee||(Ee={}));var lr=class{decodeTree;emitCodePoint;errors;constructor(t,r,n){this.decodeTree=t,this.emitCodePoint=r,this.errors=n}state=W.EntityStart;consumed=1;result=0;treeIndex=0;excess=1;decodeMode=Ee.Strict;runConsumed=0;startEntity(t){this.decodeMode=t,this.state=W.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1,this.runConsumed=0}write(t,r){switch(this.state){case W.EntityStart:return t.charCodeAt(r)===H.NUM?(this.state=W.NumericStart,this.consumed+=1,this.stateNumericStart(t,r+1)):(this.state=W.NamedEntity,this.stateNamedEntity(t,r));case W.NumericStart:return this.stateNumericStart(t,r);case W.NumericDecimal:return this.stateNumericDecimal(t,r);case W.NumericHex:return this.stateNumericHex(t,r);case W.NamedEntity:return this.stateNamedEntity(t,r)}}stateNumericStart(t,r){return r>=t.length?-1:(t.charCodeAt(r)|Gs)===H.LOWER_X?(this.state=W.NumericHex,this.consumed+=1,this.stateNumericHex(t,r+1)):(this.state=W.NumericDecimal,this.stateNumericDecimal(t,r))}stateNumericHex(t,r){for(;r<t.length;){let n=t.charCodeAt(r);if(mn(n)||Gc(n)){let s=n<=H.NINE?n-H.ZERO:(n|Gs)-H.LOWER_A+10;this.result=this.result*16+s,this.consumed++,r++}else return this.emitNumericEntity(n,3)}return-1}stateNumericDecimal(t,r){for(;r<t.length;){let n=t.charCodeAt(r);if(mn(n))this.result=this.result*10+(n-H.ZERO),this.consumed++,r++;else return this.emitNumericEntity(n,2)}return-1}emitNumericEntity(t,r){if(this.consumed<=r)return this.errors?.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(t===H.SEMI)this.consumed+=1;else if(this.decodeMode===Ee.Strict)return 0;return this.emitCodePoint(Qs(this.result),this.consumed),this.errors&&(t!==H.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(t,r){let{decodeTree:n}=this,s=n[this.treeIndex],a=(s&J.VALUE_LENGTH)>>14;for(;r<t.length;){if(a===0&&(s&J.FLAG13)!==0){let l=(s&J.BRANCH_LENGTH)>>7;if(this.runConsumed===0){let o=s&J.JUMP_TABLE;if(t.charCodeAt(r)!==o)return this.result===0?0:this.emitNotTerminatedNamedEntity();r++,this.excess++,this.runConsumed++}for(;this.runConsumed<l;){if(r>=t.length)return-1;let o=this.runConsumed-1,d=n[this.treeIndex+1+(o>>1)],p=o%2===0?d&255:d>>8&255;if(t.charCodeAt(r)!==p)return this.runConsumed=0,this.result===0?0:this.emitNotTerminatedNamedEntity();r++,this.excess++,this.runConsumed++}this.runConsumed=0,this.treeIndex+=1+(l>>1),s=n[this.treeIndex],a=(s&J.VALUE_LENGTH)>>14}if(r>=t.length)break;let c=t.charCodeAt(r);if(c===H.SEMI&&a!==0&&(s&J.FLAG13)!==0)return this.emitNamedEntityData(this.treeIndex,a,this.consumed+this.excess);if(this.treeIndex=Jc(n,s,this.treeIndex+Math.max(1,a),c),this.treeIndex<0)return this.result===0||this.decodeMode===Ee.Attribute&&(a===0||Kc(c))?0:this.emitNotTerminatedNamedEntity();if(s=n[this.treeIndex],a=(s&J.VALUE_LENGTH)>>14,a!==0){if(c===H.SEMI)return this.emitNamedEntityData(this.treeIndex,a,this.consumed+this.excess);this.decodeMode!==Ee.Strict&&(s&J.FLAG13)===0&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}r++,this.excess++}return-1}emitNotTerminatedNamedEntity(){let{result:t,decodeTree:r}=this,n=(r[t]&J.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,n,this.consumed),this.errors?.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,r,n){let{decodeTree:s}=this;return this.emitCodePoint(r===1?s[t]&~(J.VALUE_LENGTH|J.FLAG13):s[t+1],n),r===3&&this.emitCodePoint(s[t+2],n),n}end(){switch(this.state){case W.NamedEntity:return this.result!==0&&(this.decodeMode!==Ee.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case W.NumericDecimal:return this.emitNumericEntity(0,2);case W.NumericHex:return this.emitNumericEntity(0,3);case W.NumericStart:return this.errors?.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case W.EntityStart:return 0}}};function Jc(e,t,r,n){let s=(t&J.BRANCH_LENGTH)>>7,a=t&J.JUMP_TABLE;if(s===0)return a!==0&&n===a?r:-1;if(a){let d=n-a;return d<0||d>=s?-1:e[r+d]-1}let c=s+1>>1,l=0,o=s-1;for(;l<=o;){let d=l+o>>>1,p=d>>1,f=e[r+p]>>(d&1)*8&255;if(f<n)l=d+1;else if(f>n)o=d-1;else return e[r+c+d]}return-1}var b;(function(e){e.HTML="http://www.w3.org/1999/xhtml",e.MATHML="http://www.w3.org/1998/Math/MathML",e.SVG="http://www.w3.org/2000/svg",e.XLINK="http://www.w3.org/1999/xlink",e.XML="http://www.w3.org/XML/1998/namespace",e.XMLNS="http://www.w3.org/2000/xmlns/"})(b||(b={}));var be;(function(e){e.TYPE="type",e.ACTION="action",e.ENCODING="encoding",e.PROMPT="prompt",e.NAME="name",e.COLOR="color",e.FACE="face",e.SIZE="size"})(be||(be={}));var q;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(q||(q={}));var E;(function(e){e.A="a",e.ADDRESS="address",e.ANNOTATION_XML="annotation-xml",e.APPLET="applet",e.AREA="area",e.ARTICLE="article",e.ASIDE="aside",e.B="b",e.BASE="base",e.BASEFONT="basefont",e.BGSOUND="bgsound",e.BIG="big",e.BLOCKQUOTE="blockquote",e.BODY="body",e.BR="br",e.BUTTON="button",e.CAPTION="caption",e.CENTER="center",e.CODE="code",e.COL="col",e.COLGROUP="colgroup",e.DD="dd",e.DESC="desc",e.DETAILS="details",e.DIALOG="dialog",e.DIR="dir",e.DIV="div",e.DL="dl",e.DT="dt",e.EM="em",e.EMBED="embed",e.FIELDSET="fieldset",e.FIGCAPTION="figcaption",e.FIGURE="figure",e.FONT="font",e.FOOTER="footer",e.FOREIGN_OBJECT="foreignObject",e.FORM="form",e.FRAME="frame",e.FRAMESET="frameset",e.H1="h1",e.H2="h2",e.H3="h3",e.H4="h4",e.H5="h5",e.H6="h6",e.HEAD="head",e.HEADER="header",e.HGROUP="hgroup",e.HR="hr",e.HTML="html",e.I="i",e.IMG="img",e.IMAGE="image",e.INPUT="input",e.IFRAME="iframe",e.KEYGEN="keygen",e.LABEL="label",e.LI="li",e.LINK="link",e.LISTING="listing",e.MAIN="main",e.MALIGNMARK="malignmark",e.MARQUEE="marquee",e.MATH="math",e.MENU="menu",e.META="meta",e.MGLYPH="mglyph",e.MI="mi",e.MO="mo",e.MN="mn",e.MS="ms",e.MTEXT="mtext",e.NAV="nav",e.NOBR="nobr",e.NOFRAMES="noframes",e.NOEMBED="noembed",e.NOSCRIPT="noscript",e.OBJECT="object",e.OL="ol",e.OPTGROUP="optgroup",e.OPTION="option",e.P="p",e.PARAM="param",e.PLAINTEXT="plaintext",e.PRE="pre",e.RB="rb",e.RP="rp",e.RT="rt",e.RTC="rtc",e.RUBY="ruby",e.S="s",e.SCRIPT="script",e.SEARCH="search",e.SECTION="section",e.SELECT="select",e.SOURCE="source",e.SMALL="small",e.SPAN="span",e.STRIKE="strike",e.STRONG="strong",e.STYLE="style",e.SUB="sub",e.SUMMARY="summary",e.SUP="sup",e.TABLE="table",e.TBODY="tbody",e.TEMPLATE="template",e.TEXTAREA="textarea",e.TFOOT="tfoot",e.TD="td",e.TH="th",e.THEAD="thead",e.TITLE="title",e.TR="tr",e.TRACK="track",e.TT="tt",e.U="u",e.UL="ul",e.SVG="svg",e.VAR="var",e.WBR="wbr",e.XMP="xmp"})(E||(E={}));var i;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.A=1]="A",e[e.ADDRESS=2]="ADDRESS",e[e.ANNOTATION_XML=3]="ANNOTATION_XML",e[e.APPLET=4]="APPLET",e[e.AREA=5]="AREA",e[e.ARTICLE=6]="ARTICLE",e[e.ASIDE=7]="ASIDE",e[e.B=8]="B",e[e.BASE=9]="BASE",e[e.BASEFONT=10]="BASEFONT",e[e.BGSOUND=11]="BGSOUND",e[e.BIG=12]="BIG",e[e.BLOCKQUOTE=13]="BLOCKQUOTE",e[e.BODY=14]="BODY",e[e.BR=15]="BR",e[e.BUTTON=16]="BUTTON",e[e.CAPTION=17]="CAPTION",e[e.CENTER=18]="CENTER",e[e.CODE=19]="CODE",e[e.COL=20]="COL",e[e.COLGROUP=21]="COLGROUP",e[e.DD=22]="DD",e[e.DESC=23]="DESC",e[e.DETAILS=24]="DETAILS",e[e.DIALOG=25]="DIALOG",e[e.DIR=26]="DIR",e[e.DIV=27]="DIV",e[e.DL=28]="DL",e[e.DT=29]="DT",e[e.EM=30]="EM",e[e.EMBED=31]="EMBED",e[e.FIELDSET=32]="FIELDSET",e[e.FIGCAPTION=33]="FIGCAPTION",e[e.FIGURE=34]="FIGURE",e[e.FONT=35]="FONT",e[e.FOOTER=36]="FOOTER",e[e.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",e[e.FORM=38]="FORM",e[e.FRAME=39]="FRAME",e[e.FRAMESET=40]="FRAMESET",e[e.H1=41]="H1",e[e.H2=42]="H2",e[e.H3=43]="H3",e[e.H4=44]="H4",e[e.H5=45]="H5",e[e.H6=46]="H6",e[e.HEAD=47]="HEAD",e[e.HEADER=48]="HEADER",e[e.HGROUP=49]="HGROUP",e[e.HR=50]="HR",e[e.HTML=51]="HTML",e[e.I=52]="I",e[e.IMG=53]="IMG",e[e.IMAGE=54]="IMAGE",e[e.INPUT=55]="INPUT",e[e.IFRAME=56]="IFRAME",e[e.KEYGEN=57]="KEYGEN",e[e.LABEL=58]="LABEL",e[e.LI=59]="LI",e[e.LINK=60]="LINK",e[e.LISTING=61]="LISTING",e[e.MAIN=62]="MAIN",e[e.MALIGNMARK=63]="MALIGNMARK",e[e.MARQUEE=64]="MARQUEE",e[e.MATH=65]="MATH",e[e.MENU=66]="MENU",e[e.META=67]="META",e[e.MGLYPH=68]="MGLYPH",e[e.MI=69]="MI",e[e.MO=70]="MO",e[e.MN=71]="MN",e[e.MS=72]="MS",e[e.MTEXT=73]="MTEXT",e[e.NAV=74]="NAV",e[e.NOBR=75]="NOBR",e[e.NOFRAMES=76]="NOFRAMES",e[e.NOEMBED=77]="NOEMBED",e[e.NOSCRIPT=78]="NOSCRIPT",e[e.OBJECT=79]="OBJECT",e[e.OL=80]="OL",e[e.OPTGROUP=81]="OPTGROUP",e[e.OPTION=82]="OPTION",e[e.P=83]="P",e[e.PARAM=84]="PARAM",e[e.PLAINTEXT=85]="PLAINTEXT",e[e.PRE=86]="PRE",e[e.RB=87]="RB",e[e.RP=88]="RP",e[e.RT=89]="RT",e[e.RTC=90]="RTC",e[e.RUBY=91]="RUBY",e[e.S=92]="S",e[e.SCRIPT=93]="SCRIPT",e[e.SEARCH=94]="SEARCH",e[e.SECTION=95]="SECTION",e[e.SELECT=96]="SELECT",e[e.SOURCE=97]="SOURCE",e[e.SMALL=98]="SMALL",e[e.SPAN=99]="SPAN",e[e.STRIKE=100]="STRIKE",e[e.STRONG=101]="STRONG",e[e.STYLE=102]="STYLE",e[e.SUB=103]="SUB",e[e.SUMMARY=104]="SUMMARY",e[e.SUP=105]="SUP",e[e.TABLE=106]="TABLE",e[e.TBODY=107]="TBODY",e[e.TEMPLATE=108]="TEMPLATE",e[e.TEXTAREA=109]="TEXTAREA",e[e.TFOOT=110]="TFOOT",e[e.TD=111]="TD",e[e.TH=112]="TH",e[e.THEAD=113]="THEAD",e[e.TITLE=114]="TITLE",e[e.TR=115]="TR",e[e.TRACK=116]="TRACK",e[e.TT=117]="TT",e[e.U=118]="U",e[e.UL=119]="UL",e[e.SVG=120]="SVG",e[e.VAR=121]="VAR",e[e.WBR=122]="WBR",e[e.XMP=123]="XMP"})(i||(i={}));var jc=new Map([[E.A,i.A],[E.ADDRESS,i.ADDRESS],[E.ANNOTATION_XML,i.ANNOTATION_XML],[E.APPLET,i.APPLET],[E.AREA,i.AREA],[E.ARTICLE,i.ARTICLE],[E.ASIDE,i.ASIDE],[E.B,i.B],[E.BASE,i.BASE],[E.BASEFONT,i.BASEFONT],[E.BGSOUND,i.BGSOUND],[E.BIG,i.BIG],[E.BLOCKQUOTE,i.BLOCKQUOTE],[E.BODY,i.BODY],[E.BR,i.BR],[E.BUTTON,i.BUTTON],[E.CAPTION,i.CAPTION],[E.CENTER,i.CENTER],[E.CODE,i.CODE],[E.COL,i.COL],[E.COLGROUP,i.COLGROUP],[E.DD,i.DD],[E.DESC,i.DESC],[E.DETAILS,i.DETAILS],[E.DIALOG,i.DIALOG],[E.DIR,i.DIR],[E.DIV,i.DIV],[E.DL,i.DL],[E.DT,i.DT],[E.EM,i.EM],[E.EMBED,i.EMBED],[E.FIELDSET,i.FIELDSET],[E.FIGCAPTION,i.FIGCAPTION],[E.FIGURE,i.FIGURE],[E.FONT,i.FONT],[E.FOOTER,i.FOOTER],[E.FOREIGN_OBJECT,i.FOREIGN_OBJECT],[E.FORM,i.FORM],[E.FRAME,i.FRAME],[E.FRAMESET,i.FRAMESET],[E.H1,i.H1],[E.H2,i.H2],[E.H3,i.H3],[E.H4,i.H4],[E.H5,i.H5],[E.H6,i.H6],[E.HEAD,i.HEAD],[E.HEADER,i.HEADER],[E.HGROUP,i.HGROUP],[E.HR,i.HR],[E.HTML,i.HTML],[E.I,i.I],[E.IMG,i.IMG],[E.IMAGE,i.IMAGE],[E.INPUT,i.INPUT],[E.IFRAME,i.IFRAME],[E.KEYGEN,i.KEYGEN],[E.LABEL,i.LABEL],[E.LI,i.LI],[E.LINK,i.LINK],[E.LISTING,i.LISTING],[E.MAIN,i.MAIN],[E.MALIGNMARK,i.MALIGNMARK],[E.MARQUEE,i.MARQUEE],[E.MATH,i.MATH],[E.MENU,i.MENU],[E.META,i.META],[E.MGLYPH,i.MGLYPH],[E.MI,i.MI],[E.MO,i.MO],[E.MN,i.MN],[E.MS,i.MS],[E.MTEXT,i.MTEXT],[E.NAV,i.NAV],[E.NOBR,i.NOBR],[E.NOFRAMES,i.NOFRAMES],[E.NOEMBED,i.NOEMBED],[E.NOSCRIPT,i.NOSCRIPT],[E.OBJECT,i.OBJECT],[E.OL,i.OL],[E.OPTGROUP,i.OPTGROUP],[E.OPTION,i.OPTION],[E.P,i.P],[E.PARAM,i.PARAM],[E.PLAINTEXT,i.PLAINTEXT],[E.PRE,i.PRE],[E.RB,i.RB],[E.RP,i.RP],[E.RT,i.RT],[E.RTC,i.RTC],[E.RUBY,i.RUBY],[E.S,i.S],[E.SCRIPT,i.SCRIPT],[E.SEARCH,i.SEARCH],[E.SECTION,i.SECTION],[E.SELECT,i.SELECT],[E.SOURCE,i.SOURCE],[E.SMALL,i.SMALL],[E.SPAN,i.SPAN],[E.STRIKE,i.STRIKE],[E.STRONG,i.STRONG],[E.STYLE,i.STYLE],[E.SUB,i.SUB],[E.SUMMARY,i.SUMMARY],[E.SUP,i.SUP],[E.TABLE,i.TABLE],[E.TBODY,i.TBODY],[E.TEMPLATE,i.TEMPLATE],[E.TEXTAREA,i.TEXTAREA],[E.TFOOT,i.TFOOT],[E.TD,i.TD],[E.TH,i.TH],[E.THEAD,i.THEAD],[E.TITLE,i.TITLE],[E.TR,i.TR],[E.TRACK,i.TRACK],[E.TT,i.TT],[E.U,i.U],[E.UL,i.UL],[E.SVG,i.SVG],[E.VAR,i.VAR],[E.WBR,i.WBR],[E.XMP,i.XMP]]);function Pe(e){var t;return(t=jc.get(e))!==null&&t!==void 0?t:i.UNKNOWN}var C=i,Ws={[b.HTML]:new Set([C.ADDRESS,C.APPLET,C.AREA,C.ARTICLE,C.ASIDE,C.BASE,C.BASEFONT,C.BGSOUND,C.BLOCKQUOTE,C.BODY,C.BR,C.BUTTON,C.CAPTION,C.CENTER,C.COL,C.COLGROUP,C.DD,C.DETAILS,C.DIR,C.DIV,C.DL,C.DT,C.EMBED,C.FIELDSET,C.FIGCAPTION,C.FIGURE,C.FOOTER,C.FORM,C.FRAME,C.FRAMESET,C.H1,C.H2,C.H3,C.H4,C.H5,C.H6,C.HEAD,C.HEADER,C.HGROUP,C.HR,C.HTML,C.IFRAME,C.IMG,C.INPUT,C.LI,C.LINK,C.LISTING,C.MAIN,C.MARQUEE,C.MENU,C.META,C.NAV,C.NOEMBED,C.NOFRAMES,C.NOSCRIPT,C.OBJECT,C.OL,C.P,C.PARAM,C.PLAINTEXT,C.PRE,C.SCRIPT,C.SECTION,C.SELECT,C.SOURCE,C.STYLE,C.SUMMARY,C.TABLE,C.TBODY,C.TD,C.TEMPLATE,C.TEXTAREA,C.TFOOT,C.TH,C.THEAD,C.TITLE,C.TR,C.TRACK,C.UL,C.WBR,C.XMP]),[b.MATHML]:new Set([C.MI,C.MO,C.MN,C.MS,C.MTEXT,C.ANNOTATION_XML]),[b.SVG]:new Set([C.TITLE,C.FOREIGN_OBJECT,C.DESC]),[b.XLINK]:new Set,[b.XML]:new Set,[b.XMLNS]:new Set},Tt=new Set([C.H1,C.H2,C.H3,C.H4,C.H5,C.H6]),Cg=new Set([E.STYLE,E.SCRIPT,E.XMP,E.IFRAME,E.NOEMBED,E.NOFRAMES,E.PLAINTEXT]);var A;(function(e){e[e.DATA=0]="DATA",e[e.RCDATA=1]="RCDATA",e[e.RAWTEXT=2]="RAWTEXT",e[e.SCRIPT_DATA=3]="SCRIPT_DATA",e[e.PLAINTEXT=4]="PLAINTEXT",e[e.TAG_OPEN=5]="TAG_OPEN",e[e.END_TAG_OPEN=6]="END_TAG_OPEN",e[e.TAG_NAME=7]="TAG_NAME",e[e.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",e[e.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",e[e.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",e[e.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",e[e.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",e[e.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",e[e.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",e[e.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",e[e.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",e[e.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",e[e.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",e[e.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",e[e.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",e[e.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",e[e.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",e[e.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",e[e.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",e[e.BOGUS_COMMENT=40]="BOGUS_COMMENT",e[e.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",e[e.COMMENT_START=42]="COMMENT_START",e[e.COMMENT_START_DASH=43]="COMMENT_START_DASH",e[e.COMMENT=44]="COMMENT",e[e.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",e[e.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",e[e.COMMENT_END_DASH=49]="COMMENT_END_DASH",e[e.COMMENT_END=50]="COMMENT_END",e[e.COMMENT_END_BANG=51]="COMMENT_END_BANG",e[e.DOCTYPE=52]="DOCTYPE",e[e.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",e[e.DOCTYPE_NAME=54]="DOCTYPE_NAME",e[e.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",e[e.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",e[e.CDATA_SECTION=68]="CDATA_SECTION",e[e.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",e[e.CDATA_SECTION_END=70]="CDATA_SECTION_END",e[e.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",e[e.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND"})(A||(A={}));var j={DATA:A.DATA,RCDATA:A.RCDATA,RAWTEXT:A.RAWTEXT,SCRIPT_DATA:A.SCRIPT_DATA,PLAINTEXT:A.PLAINTEXT,CDATA_SECTION:A.CDATA_SECTION};function $c(e){return e>=u.DIGIT_0&&e<=u.DIGIT_9}function bt(e){return e>=u.LATIN_CAPITAL_A&&e<=u.LATIN_CAPITAL_Z}function Xc(e){return e>=u.LATIN_SMALL_A&&e<=u.LATIN_SMALL_Z}function we(e){return Xc(e)||bt(e)}function Ks(e){return we(e)||$c(e)}function dr(e){return e+32}function js(e){return e===u.SPACE||e===u.LINE_FEED||e===u.TABULATION||e===u.FORM_FEED}function Js(e){return js(e)||e===u.SOLIDUS||e===u.GREATER_THAN_SIGN}function Zc(e){return e===u.NULL?T.nullCharacterReference:e>1114111?T.characterReferenceOutsideUnicodeRange:sr(e)?T.surrogateCharacterReference:ar(e)?T.noncharacterCharacterReference:ir(e)||e===u.CARRIAGE_RETURN?T.controlCharacterReference:null}var Ct=class{constructor(t,r){this.options=t,this.handler=r,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=A.DATA,this.returnState=A.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new or(r),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new lr(gn,(n,s)=>{this.preprocessor.pos=this.entityStartPos+s-1,this._flushCodePointConsumedAsCharacterReference(n)},r.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(T.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:n=>{this._err(T.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+n)},validateNumericCharacterReference:n=>{let s=Zc(n);s&&this._err(s,1)}}:void 0)}_err(t,r=0){var n,s;(s=(n=this.handler).onParseError)===null||s===void 0||s.call(n,this.preprocessor.getError(t,r))}getCurrentLocation(t){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-t,startOffset:this.preprocessor.offset-t,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;let t=this._consume();this._ensureHibernation()||this._callState(t)}this.inLoop=!1}}pause(){this.paused=!0}resume(t){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||t?.())}write(t,r,n){this.active=!0,this.preprocessor.write(t,r),this._runParsingLoop(),this.paused||n?.()}insertHtmlAtCurrentPos(t){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(t),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(t){this.consumedAfterSnapshot+=t;for(let r=0;r<t;r++)this.preprocessor.advance()}_consumeSequenceIfMatch(t,r){return this.preprocessor.startsWith(t,r)?(this._advanceBy(t.length-1),!0):!1}_createStartTagToken(){this.currentToken={type:v.START_TAG,tagName:"",tagID:i.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:v.END_TAG,tagName:"",tagID:i.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(t){this.currentToken={type:v.COMMENT,data:"",location:this.getCurrentLocation(t)}}_createDoctypeToken(t){this.currentToken={type:v.DOCTYPE,name:t,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(t,r){this.currentCharacterToken={type:t,chars:r,location:this.currentLocation}}_createAttr(t){this.currentAttr={name:t,value:""},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var t,r;let n=this.currentToken;if(cr(n,this.currentAttr.name)===null){if(n.attrs.push(this.currentAttr),n.location&&this.currentLocation){let s=(t=(r=n.location).attrs)!==null&&t!==void 0?t:r.attrs=Object.create(null);s[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err(T.duplicateAttribute)}_leaveAttrValue(){this.currentLocation&&(this.currentLocation.endLine=this.preprocessor.line,this.currentLocation.endCol=this.preprocessor.col,this.currentLocation.endOffset=this.preprocessor.offset)}prepareToken(t){this._emitCurrentCharacterToken(t.location),this.currentToken=null,t.location&&(t.location.endLine=this.preprocessor.line,t.location.endCol=this.preprocessor.col+1,t.location.endOffset=this.preprocessor.offset+1),this.currentLocation=this.getCurrentLocation(-1)}emitCurrentTagToken(){let t=this.currentToken;this.prepareToken(t),t.tagID=Pe(t.tagName),t.type===v.START_TAG?(this.lastStartTagName=t.tagName,this.handler.onStartTag(t)):(t.attrs.length>0&&this._err(T.endTagWithAttributes),t.selfClosing&&this._err(T.endTagWithTrailingSolidus),this.handler.onEndTag(t)),this.preprocessor.dropParsedChunk()}emitCurrentComment(t){this.prepareToken(t),this.handler.onComment(t),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(t){this.prepareToken(t),this.handler.onDoctype(t),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(t){if(this.currentCharacterToken){switch(t&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=t.startLine,this.currentCharacterToken.location.endCol=t.startCol,this.currentCharacterToken.location.endOffset=t.startOffset),this.currentCharacterToken.type){case v.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case v.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case v.WHITESPACE_CHARACTER:{this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}}this.currentCharacterToken=null}}_emitEOFToken(){let t=this.getCurrentLocation(0);t&&(t.endLine=t.startLine,t.endCol=t.startCol,t.endOffset=t.startOffset),this._emitCurrentCharacterToken(t),this.handler.onEof({type:v.EOF,location:t}),this.active=!1}_appendCharToCurrentCharacterToken(t,r){if(this.currentCharacterToken)if(this.currentCharacterToken.type===t){this.currentCharacterToken.chars+=r;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(t,r)}_emitCodePoint(t){let r=js(t)?v.WHITESPACE_CHARACTER:t===u.NULL?v.NULL_CHARACTER:v.CHARACTER;this._appendCharToCurrentCharacterToken(r,t<65536?String.fromCharCode(t):String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(v.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=A.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?Ee.Attribute:Ee.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===A.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===A.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===A.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case A.DATA:{this._stateData(t);break}case A.RCDATA:{this._stateRcdata(t);break}case A.RAWTEXT:{this._stateRawtext(t);break}case A.SCRIPT_DATA:{this._stateScriptData(t);break}case A.PLAINTEXT:{this._statePlaintext(t);break}case A.TAG_OPEN:{this._stateTagOpen(t);break}case A.END_TAG_OPEN:{this._stateEndTagOpen(t);break}case A.TAG_NAME:{this._stateTagName(t);break}case A.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(t);break}case A.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(t);break}case A.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(t);break}case A.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(t);break}case A.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(t);break}case A.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(t);break}case A.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(t);break}case A.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(t);break}case A.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(t);break}case A.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(t);break}case A.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(t);break}case A.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(t);break}case A.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(t);break}case A.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(t);break}case A.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(t);break}case A.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(t);break}case A.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(t);break}case A.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(t);break}case A.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(t);break}case A.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(t);break}case A.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(t);break}case A.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(t);break}case A.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(t);break}case A.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(t);break}case A.ATTRIBUTE_NAME:{this._stateAttributeName(t);break}case A.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(t);break}case A.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(t);break}case A.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(t);break}case A.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(t);break}case A.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(t);break}case A.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(t);break}case A.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(t);break}case A.BOGUS_COMMENT:{this._stateBogusComment(t);break}case A.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(t);break}case A.COMMENT_START:{this._stateCommentStart(t);break}case A.COMMENT_START_DASH:{this._stateCommentStartDash(t);break}case A.COMMENT:{this._stateComment(t);break}case A.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(t);break}case A.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(t);break}case A.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(t);break}case A.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(t);break}case A.COMMENT_END_DASH:{this._stateCommentEndDash(t);break}case A.COMMENT_END:{this._stateCommentEnd(t);break}case A.COMMENT_END_BANG:{this._stateCommentEndBang(t);break}case A.DOCTYPE:{this._stateDoctype(t);break}case A.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(t);break}case A.DOCTYPE_NAME:{this._stateDoctypeName(t);break}case A.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(t);break}case A.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(t);break}case A.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(t);break}case A.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(t);break}case A.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(t);break}case A.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(t);break}case A.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break}case A.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(t);break}case A.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(t);break}case A.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(t);break}case A.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(t);break}case A.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(t);break}case A.BOGUS_DOCTYPE:{this._stateBogusDoctype(t);break}case A.CDATA_SECTION:{this._stateCdataSection(t);break}case A.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(t);break}case A.CDATA_SECTION_END:{this._stateCdataSectionEnd(t);break}case A.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case A.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(t);break}default:throw new Error("Unknown state")}}_stateData(t){switch(t){case u.LESS_THAN_SIGN:{this.state=A.TAG_OPEN;break}case u.AMPERSAND:{this._startCharacterReference();break}case u.NULL:{this._err(T.unexpectedNullCharacter),this._emitCodePoint(t);break}case u.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case u.AMPERSAND:{this._startCharacterReference();break}case u.LESS_THAN_SIGN:{this.state=A.RCDATA_LESS_THAN_SIGN;break}case u.NULL:{this._err(T.unexpectedNullCharacter),this._emitChars(M);break}case u.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case u.LESS_THAN_SIGN:{this.state=A.RAWTEXT_LESS_THAN_SIGN;break}case u.NULL:{this._err(T.unexpectedNullCharacter),this._emitChars(M);break}case u.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case u.LESS_THAN_SIGN:{this.state=A.SCRIPT_DATA_LESS_THAN_SIGN;break}case u.NULL:{this._err(T.unexpectedNullCharacter),this._emitChars(M);break}case u.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case u.NULL:{this._err(T.unexpectedNullCharacter),this._emitChars(M);break}case u.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(we(t))this._createStartTagToken(),this.state=A.TAG_NAME,this._stateTagName(t);else switch(t){case u.EXCLAMATION_MARK:{this.state=A.MARKUP_DECLARATION_OPEN;break}case u.SOLIDUS:{this.state=A.END_TAG_OPEN;break}case u.QUESTION_MARK:{this._err(T.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=A.BOGUS_COMMENT,this._stateBogusComment(t);break}case u.EOF:{this._err(T.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(T.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=A.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(we(t))this._createEndTagToken(),this.state=A.TAG_NAME,this._stateTagName(t);else switch(t){case u.GREATER_THAN_SIGN:{this._err(T.missingEndTagName),this.state=A.DATA;break}case u.EOF:{this._err(T.eofBeforeTagName),this._emitChars("</"),this._emitEOFToken();break}default:this._err(T.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=A.BOGUS_COMMENT,this._stateBogusComment(t)}}_stateTagName(t){let r=this.currentToken;switch(t){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:{this.state=A.BEFORE_ATTRIBUTE_NAME;break}case u.SOLIDUS:{this.state=A.SELF_CLOSING_START_TAG;break}case u.GREATER_THAN_SIGN:{this.state=A.DATA,this.emitCurrentTagToken();break}case u.NULL:{this._err(T.unexpectedNullCharacter),r.tagName+=M;break}case u.EOF:{this._err(T.eofInTag),this._emitEOFToken();break}default:r.tagName+=String.fromCodePoint(bt(t)?dr(t):t)}}_stateRcdataLessThanSign(t){t===u.SOLIDUS?this.state=A.RCDATA_END_TAG_OPEN:(this._emitChars("<"),this.state=A.RCDATA,this._stateRcdata(t))}_stateRcdataEndTagOpen(t){we(t)?(this.state=A.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(t)):(this._emitChars("</"),this.state=A.RCDATA,this._stateRcdata(t))}handleSpecialEndTag(t){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();this._createEndTagToken();let r=this.currentToken;switch(r.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=A.BEFORE_ATTRIBUTE_NAME,!1;case u.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=A.SELF_CLOSING_START_TAG,!1;case u.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=A.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=A.RCDATA,this._stateRcdata(t))}_stateRawtextLessThanSign(t){t===u.SOLIDUS?this.state=A.RAWTEXT_END_TAG_OPEN:(this._emitChars("<"),this.state=A.RAWTEXT,this._stateRawtext(t))}_stateRawtextEndTagOpen(t){we(t)?(this.state=A.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(t)):(this._emitChars("</"),this.state=A.RAWTEXT,this._stateRawtext(t))}_stateRawtextEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=A.RAWTEXT,this._stateRawtext(t))}_stateScriptDataLessThanSign(t){switch(t){case u.SOLIDUS:{this.state=A.SCRIPT_DATA_END_TAG_OPEN;break}case u.EXCLAMATION_MARK:{this.state=A.SCRIPT_DATA_ESCAPE_START,this._emitChars("<!");break}default:this._emitChars("<"),this.state=A.SCRIPT_DATA,this._stateScriptData(t)}}_stateScriptDataEndTagOpen(t){we(t)?(this.state=A.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(t)):(this._emitChars("</"),this.state=A.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=A.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscapeStart(t){t===u.HYPHEN_MINUS?(this.state=A.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars("-")):(this.state=A.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscapeStartDash(t){t===u.HYPHEN_MINUS?(this.state=A.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-")):(this.state=A.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscaped(t){switch(t){case u.HYPHEN_MINUS:{this.state=A.SCRIPT_DATA_ESCAPED_DASH,this._emitChars("-");break}case u.LESS_THAN_SIGN:{this.state=A.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case u.NULL:{this._err(T.unexpectedNullCharacter),this._emitChars(M);break}case u.EOF:{this._err(T.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptDataEscapedDash(t){switch(t){case u.HYPHEN_MINUS:{this.state=A.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-");break}case u.LESS_THAN_SIGN:{this.state=A.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case u.NULL:{this._err(T.unexpectedNullCharacter),this.state=A.SCRIPT_DATA_ESCAPED,this._emitChars(M);break}case u.EOF:{this._err(T.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=A.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedDashDash(t){switch(t){case u.HYPHEN_MINUS:{this._emitChars("-");break}case u.LESS_THAN_SIGN:{this.state=A.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case u.GREATER_THAN_SIGN:{this.state=A.SCRIPT_DATA,this._emitChars(">");break}case u.NULL:{this._err(T.unexpectedNullCharacter),this.state=A.SCRIPT_DATA_ESCAPED,this._emitChars(M);break}case u.EOF:{this._err(T.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=A.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===u.SOLIDUS?this.state=A.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:we(t)?(this._emitChars("<"),this.state=A.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=A.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){we(t)?(this.state=A.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("</"),this.state=A.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=A.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataDoubleEscapeStart(t){if(this.preprocessor.startsWith(z.SCRIPT,!1)&&Js(this.preprocessor.peek(z.SCRIPT.length))){this._emitCodePoint(t);for(let r=0;r<z.SCRIPT.length;r++)this._emitCodePoint(this._consume());this.state=A.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=A.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataDoubleEscaped(t){switch(t){case u.HYPHEN_MINUS:{this.state=A.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars("-");break}case u.LESS_THAN_SIGN:{this.state=A.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case u.NULL:{this._err(T.unexpectedNullCharacter),this._emitChars(M);break}case u.EOF:{this._err(T.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedDash(t){switch(t){case u.HYPHEN_MINUS:{this.state=A.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars("-");break}case u.LESS_THAN_SIGN:{this.state=A.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case u.NULL:{this._err(T.unexpectedNullCharacter),this.state=A.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(M);break}case u.EOF:{this._err(T.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=A.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedDashDash(t){switch(t){case u.HYPHEN_MINUS:{this._emitChars("-");break}case u.LESS_THAN_SIGN:{this.state=A.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case u.GREATER_THAN_SIGN:{this.state=A.SCRIPT_DATA,this._emitChars(">");break}case u.NULL:{this._err(T.unexpectedNullCharacter),this.state=A.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(M);break}case u.EOF:{this._err(T.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=A.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===u.SOLIDUS?(this.state=A.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=A.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(z.SCRIPT,!1)&&Js(this.preprocessor.peek(z.SCRIPT.length))){this._emitCodePoint(t);for(let r=0;r<z.SCRIPT.length;r++)this._emitCodePoint(this._consume());this.state=A.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=A.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateBeforeAttributeName(t){switch(t){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:break;case u.SOLIDUS:case u.GREATER_THAN_SIGN:case u.EOF:{this.state=A.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(t);break}case u.EQUALS_SIGN:{this._err(T.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state=A.ATTRIBUTE_NAME;break}default:this._createAttr(""),this.state=A.ATTRIBUTE_NAME,this._stateAttributeName(t)}}_stateAttributeName(t){switch(t){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:case u.SOLIDUS:case u.GREATER_THAN_SIGN:case u.EOF:{this._leaveAttrName(),this.state=A.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(t);break}case u.EQUALS_SIGN:{this._leaveAttrName(),this.state=A.BEFORE_ATTRIBUTE_VALUE;break}case u.QUOTATION_MARK:case u.APOSTROPHE:case u.LESS_THAN_SIGN:{this._err(T.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(t);break}case u.NULL:{this._err(T.unexpectedNullCharacter),this.currentAttr.name+=M;break}default:this.currentAttr.name+=String.fromCodePoint(bt(t)?dr(t):t)}}_stateAfterAttributeName(t){switch(t){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:break;case u.SOLIDUS:{this.state=A.SELF_CLOSING_START_TAG;break}case u.EQUALS_SIGN:{this.state=A.BEFORE_ATTRIBUTE_VALUE;break}case u.GREATER_THAN_SIGN:{this.state=A.DATA,this.emitCurrentTagToken();break}case u.EOF:{this._err(T.eofInTag),this._emitEOFToken();break}default:this._createAttr(""),this.state=A.ATTRIBUTE_NAME,this._stateAttributeName(t)}}_stateBeforeAttributeValue(t){switch(t){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:break;case u.QUOTATION_MARK:{this.state=A.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break}case u.APOSTROPHE:{this.state=A.ATTRIBUTE_VALUE_SINGLE_QUOTED;break}case u.GREATER_THAN_SIGN:{this._err(T.missingAttributeValue),this.state=A.DATA,this.emitCurrentTagToken();break}default:this.state=A.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(t)}}_stateAttributeValueDoubleQuoted(t){switch(t){case u.QUOTATION_MARK:{this.state=A.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case u.AMPERSAND:{this._startCharacterReference();break}case u.NULL:{this._err(T.unexpectedNullCharacter),this.currentAttr.value+=M;break}case u.EOF:{this._err(T.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAttributeValueSingleQuoted(t){switch(t){case u.APOSTROPHE:{this.state=A.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case u.AMPERSAND:{this._startCharacterReference();break}case u.NULL:{this._err(T.unexpectedNullCharacter),this.currentAttr.value+=M;break}case u.EOF:{this._err(T.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAttributeValueUnquoted(t){switch(t){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:{this._leaveAttrValue(),this.state=A.BEFORE_ATTRIBUTE_NAME;break}case u.AMPERSAND:{this._startCharacterReference();break}case u.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=A.DATA,this.emitCurrentTagToken();break}case u.NULL:{this._err(T.unexpectedNullCharacter),this.currentAttr.value+=M;break}case u.QUOTATION_MARK:case u.APOSTROPHE:case u.LESS_THAN_SIGN:case u.EQUALS_SIGN:case u.GRAVE_ACCENT:{this._err(T.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(t);break}case u.EOF:{this._err(T.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAfterAttributeValueQuoted(t){switch(t){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:{this._leaveAttrValue(),this.state=A.BEFORE_ATTRIBUTE_NAME;break}case u.SOLIDUS:{this._leaveAttrValue(),this.state=A.SELF_CLOSING_START_TAG;break}case u.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=A.DATA,this.emitCurrentTagToken();break}case u.EOF:{this._err(T.eofInTag),this._emitEOFToken();break}default:this._err(T.missingWhitespaceBetweenAttributes),this.state=A.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(t)}}_stateSelfClosingStartTag(t){switch(t){case u.GREATER_THAN_SIGN:{let r=this.currentToken;r.selfClosing=!0,this.state=A.DATA,this.emitCurrentTagToken();break}case u.EOF:{this._err(T.eofInTag),this._emitEOFToken();break}default:this._err(T.unexpectedSolidusInTag),this.state=A.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(t)}}_stateBogusComment(t){let r=this.currentToken;switch(t){case u.GREATER_THAN_SIGN:{this.state=A.DATA,this.emitCurrentComment(r);break}case u.EOF:{this.emitCurrentComment(r),this._emitEOFToken();break}case u.NULL:{this._err(T.unexpectedNullCharacter),r.data+=M;break}default:r.data+=String.fromCodePoint(t)}}_stateMarkupDeclarationOpen(t){this._consumeSequenceIfMatch(z.DASH_DASH,!0)?(this._createCommentToken(z.DASH_DASH.length+1),this.state=A.COMMENT_START):this._consumeSequenceIfMatch(z.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(z.DOCTYPE.length+1),this.state=A.DOCTYPE):this._consumeSequenceIfMatch(z.CDATA_START,!0)?this.inForeignNode?this.state=A.CDATA_SECTION:(this._err(T.cdataInHtmlContent),this._createCommentToken(z.CDATA_START.length+1),this.currentToken.data="[CDATA[",this.state=A.BOGUS_COMMENT):this._ensureHibernation()||(this._err(T.incorrectlyOpenedComment),this._createCommentToken(2),this.state=A.BOGUS_COMMENT,this._stateBogusComment(t))}_stateCommentStart(t){switch(t){case u.HYPHEN_MINUS:{this.state=A.COMMENT_START_DASH;break}case u.GREATER_THAN_SIGN:{this._err(T.abruptClosingOfEmptyComment),this.state=A.DATA;let r=this.currentToken;this.emitCurrentComment(r);break}default:this.state=A.COMMENT,this._stateComment(t)}}_stateCommentStartDash(t){let r=this.currentToken;switch(t){case u.HYPHEN_MINUS:{this.state=A.COMMENT_END;break}case u.GREATER_THAN_SIGN:{this._err(T.abruptClosingOfEmptyComment),this.state=A.DATA,this.emitCurrentComment(r);break}case u.EOF:{this._err(T.eofInComment),this.emitCurrentComment(r),this._emitEOFToken();break}default:r.data+="-",this.state=A.COMMENT,this._stateComment(t)}}_stateComment(t){let r=this.currentToken;switch(t){case u.HYPHEN_MINUS:{this.state=A.COMMENT_END_DASH;break}case u.LESS_THAN_SIGN:{r.data+="<",this.state=A.COMMENT_LESS_THAN_SIGN;break}case u.NULL:{this._err(T.unexpectedNullCharacter),r.data+=M;break}case u.EOF:{this._err(T.eofInComment),this.emitCurrentComment(r),this._emitEOFToken();break}default:r.data+=String.fromCodePoint(t)}}_stateCommentLessThanSign(t){let r=this.currentToken;switch(t){case u.EXCLAMATION_MARK:{r.data+="!",this.state=A.COMMENT_LESS_THAN_SIGN_BANG;break}case u.LESS_THAN_SIGN:{r.data+="<";break}default:this.state=A.COMMENT,this._stateComment(t)}}_stateCommentLessThanSignBang(t){t===u.HYPHEN_MINUS?this.state=A.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=A.COMMENT,this._stateComment(t))}_stateCommentLessThanSignBangDash(t){t===u.HYPHEN_MINUS?this.state=A.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=A.COMMENT_END_DASH,this._stateCommentEndDash(t))}_stateCommentLessThanSignBangDashDash(t){t!==u.GREATER_THAN_SIGN&&t!==u.EOF&&this._err(T.nestedComment),this.state=A.COMMENT_END,this._stateCommentEnd(t)}_stateCommentEndDash(t){let r=this.currentToken;switch(t){case u.HYPHEN_MINUS:{this.state=A.COMMENT_END;break}case u.EOF:{this._err(T.eofInComment),this.emitCurrentComment(r),this._emitEOFToken();break}default:r.data+="-",this.state=A.COMMENT,this._stateComment(t)}}_stateCommentEnd(t){let r=this.currentToken;switch(t){case u.GREATER_THAN_SIGN:{this.state=A.DATA,this.emitCurrentComment(r);break}case u.EXCLAMATION_MARK:{this.state=A.COMMENT_END_BANG;break}case u.HYPHEN_MINUS:{r.data+="-";break}case u.EOF:{this._err(T.eofInComment),this.emitCurrentComment(r),this._emitEOFToken();break}default:r.data+="--",this.state=A.COMMENT,this._stateComment(t)}}_stateCommentEndBang(t){let r=this.currentToken;switch(t){case u.HYPHEN_MINUS:{r.data+="--!",this.state=A.COMMENT_END_DASH;break}case u.GREATER_THAN_SIGN:{this._err(T.incorrectlyClosedComment),this.state=A.DATA,this.emitCurrentComment(r);break}case u.EOF:{this._err(T.eofInComment),this.emitCurrentComment(r),this._emitEOFToken();break}default:r.data+="--!",this.state=A.COMMENT,this._stateComment(t)}}_stateDoctype(t){switch(t){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:{this.state=A.BEFORE_DOCTYPE_NAME;break}case u.GREATER_THAN_SIGN:{this.state=A.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(t);break}case u.EOF:{this._err(T.eofInDoctype),this._createDoctypeToken(null);let r=this.currentToken;r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break}default:this._err(T.missingWhitespaceBeforeDoctypeName),this.state=A.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(t)}}_stateBeforeDoctypeName(t){if(bt(t))this._createDoctypeToken(String.fromCharCode(dr(t))),this.state=A.DOCTYPE_NAME;else switch(t){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:break;case u.NULL:{this._err(T.unexpectedNullCharacter),this._createDoctypeToken(M),this.state=A.DOCTYPE_NAME;break}case u.GREATER_THAN_SIGN:{this._err(T.missingDoctypeName),this._createDoctypeToken(null);let r=this.currentToken;r.forceQuirks=!0,this.emitCurrentDoctype(r),this.state=A.DATA;break}case u.EOF:{this._err(T.eofInDoctype),this._createDoctypeToken(null);let r=this.currentToken;r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(t)),this.state=A.DOCTYPE_NAME}}_stateDoctypeName(t){let r=this.currentToken;switch(t){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:{this.state=A.AFTER_DOCTYPE_NAME;break}case u.GREATER_THAN_SIGN:{this.state=A.DATA,this.emitCurrentDoctype(r);break}case u.NULL:{this._err(T.unexpectedNullCharacter),r.name+=M;break}case u.EOF:{this._err(T.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break}default:r.name+=String.fromCodePoint(bt(t)?dr(t):t)}}_stateAfterDoctypeName(t){let r=this.currentToken;switch(t){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:break;case u.GREATER_THAN_SIGN:{this.state=A.DATA,this.emitCurrentDoctype(r);break}case u.EOF:{this._err(T.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break}default:this._consumeSequenceIfMatch(z.PUBLIC,!1)?this.state=A.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(z.SYSTEM,!1)?this.state=A.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(T.invalidCharacterSequenceAfterDoctypeName),r.forceQuirks=!0,this.state=A.BOGUS_DOCTYPE,this._stateBogusDoctype(t))}}_stateAfterDoctypePublicKeyword(t){let r=this.currentToken;switch(t){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:{this.state=A.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break}case u.QUOTATION_MARK:{this._err(T.missingWhitespaceAfterDoctypePublicKeyword),r.publicId="",this.state=A.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case u.APOSTROPHE:{this._err(T.missingWhitespaceAfterDoctypePublicKeyword),r.publicId="",this.state=A.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case u.GREATER_THAN_SIGN:{this._err(T.missingDoctypePublicIdentifier),r.forceQuirks=!0,this.state=A.DATA,this.emitCurrentDoctype(r);break}case u.EOF:{this._err(T.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break}default:this._err(T.missingQuoteBeforeDoctypePublicIdentifier),r.forceQuirks=!0,this.state=A.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBeforeDoctypePublicIdentifier(t){let r=this.currentToken;switch(t){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:break;case u.QUOTATION_MARK:{r.publicId="",this.state=A.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case u.APOSTROPHE:{r.publicId="",this.state=A.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case u.GREATER_THAN_SIGN:{this._err(T.missingDoctypePublicIdentifier),r.forceQuirks=!0,this.state=A.DATA,this.emitCurrentDoctype(r);break}case u.EOF:{this._err(T.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break}default:this._err(T.missingQuoteBeforeDoctypePublicIdentifier),r.forceQuirks=!0,this.state=A.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateDoctypePublicIdentifierDoubleQuoted(t){let r=this.currentToken;switch(t){case u.QUOTATION_MARK:{this.state=A.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case u.NULL:{this._err(T.unexpectedNullCharacter),r.publicId+=M;break}case u.GREATER_THAN_SIGN:{this._err(T.abruptDoctypePublicIdentifier),r.forceQuirks=!0,this.emitCurrentDoctype(r),this.state=A.DATA;break}case u.EOF:{this._err(T.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break}default:r.publicId+=String.fromCodePoint(t)}}_stateDoctypePublicIdentifierSingleQuoted(t){let r=this.currentToken;switch(t){case u.APOSTROPHE:{this.state=A.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case u.NULL:{this._err(T.unexpectedNullCharacter),r.publicId+=M;break}case u.GREATER_THAN_SIGN:{this._err(T.abruptDoctypePublicIdentifier),r.forceQuirks=!0,this.emitCurrentDoctype(r),this.state=A.DATA;break}case u.EOF:{this._err(T.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break}default:r.publicId+=String.fromCodePoint(t)}}_stateAfterDoctypePublicIdentifier(t){let r=this.currentToken;switch(t){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:{this.state=A.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break}case u.GREATER_THAN_SIGN:{this.state=A.DATA,this.emitCurrentDoctype(r);break}case u.QUOTATION_MARK:{this._err(T.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),r.systemId="",this.state=A.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case u.APOSTROPHE:{this._err(T.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),r.systemId="",this.state=A.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case u.EOF:{this._err(T.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break}default:this._err(T.missingQuoteBeforeDoctypeSystemIdentifier),r.forceQuirks=!0,this.state=A.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBetweenDoctypePublicAndSystemIdentifiers(t){let r=this.currentToken;switch(t){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:break;case u.GREATER_THAN_SIGN:{this.emitCurrentDoctype(r),this.state=A.DATA;break}case u.QUOTATION_MARK:{r.systemId="",this.state=A.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case u.APOSTROPHE:{r.systemId="",this.state=A.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case u.EOF:{this._err(T.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break}default:this._err(T.missingQuoteBeforeDoctypeSystemIdentifier),r.forceQuirks=!0,this.state=A.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateAfterDoctypeSystemKeyword(t){let r=this.currentToken;switch(t){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:{this.state=A.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break}case u.QUOTATION_MARK:{this._err(T.missingWhitespaceAfterDoctypeSystemKeyword),r.systemId="",this.state=A.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case u.APOSTROPHE:{this._err(T.missingWhitespaceAfterDoctypeSystemKeyword),r.systemId="",this.state=A.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case u.GREATER_THAN_SIGN:{this._err(T.missingDoctypeSystemIdentifier),r.forceQuirks=!0,this.state=A.DATA,this.emitCurrentDoctype(r);break}case u.EOF:{this._err(T.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break}default:this._err(T.missingQuoteBeforeDoctypeSystemIdentifier),r.forceQuirks=!0,this.state=A.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBeforeDoctypeSystemIdentifier(t){let r=this.currentToken;switch(t){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:break;case u.QUOTATION_MARK:{r.systemId="",this.state=A.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case u.APOSTROPHE:{r.systemId="",this.state=A.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case u.GREATER_THAN_SIGN:{this._err(T.missingDoctypeSystemIdentifier),r.forceQuirks=!0,this.state=A.DATA,this.emitCurrentDoctype(r);break}case u.EOF:{this._err(T.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break}default:this._err(T.missingQuoteBeforeDoctypeSystemIdentifier),r.forceQuirks=!0,this.state=A.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateDoctypeSystemIdentifierDoubleQuoted(t){let r=this.currentToken;switch(t){case u.QUOTATION_MARK:{this.state=A.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case u.NULL:{this._err(T.unexpectedNullCharacter),r.systemId+=M;break}case u.GREATER_THAN_SIGN:{this._err(T.abruptDoctypeSystemIdentifier),r.forceQuirks=!0,this.emitCurrentDoctype(r),this.state=A.DATA;break}case u.EOF:{this._err(T.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break}default:r.systemId+=String.fromCodePoint(t)}}_stateDoctypeSystemIdentifierSingleQuoted(t){let r=this.currentToken;switch(t){case u.APOSTROPHE:{this.state=A.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case u.NULL:{this._err(T.unexpectedNullCharacter),r.systemId+=M;break}case u.GREATER_THAN_SIGN:{this._err(T.abruptDoctypeSystemIdentifier),r.forceQuirks=!0,this.emitCurrentDoctype(r),this.state=A.DATA;break}case u.EOF:{this._err(T.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break}default:r.systemId+=String.fromCodePoint(t)}}_stateAfterDoctypeSystemIdentifier(t){let r=this.currentToken;switch(t){case u.SPACE:case u.LINE_FEED:case u.TABULATION:case u.FORM_FEED:break;case u.GREATER_THAN_SIGN:{this.emitCurrentDoctype(r),this.state=A.DATA;break}case u.EOF:{this._err(T.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break}default:this._err(T.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=A.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBogusDoctype(t){let r=this.currentToken;switch(t){case u.GREATER_THAN_SIGN:{this.emitCurrentDoctype(r),this.state=A.DATA;break}case u.NULL:{this._err(T.unexpectedNullCharacter);break}case u.EOF:{this.emitCurrentDoctype(r),this._emitEOFToken();break}default:}}_stateCdataSection(t){switch(t){case u.RIGHT_SQUARE_BRACKET:{this.state=A.CDATA_SECTION_BRACKET;break}case u.EOF:{this._err(T.eofInCdata),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateCdataSectionBracket(t){t===u.RIGHT_SQUARE_BRACKET?this.state=A.CDATA_SECTION_END:(this._emitChars("]"),this.state=A.CDATA_SECTION,this._stateCdataSection(t))}_stateCdataSectionEnd(t){switch(t){case u.GREATER_THAN_SIGN:{this.state=A.DATA;break}case u.RIGHT_SQUARE_BRACKET:{this._emitChars("]");break}default:this._emitChars("]]"),this.state=A.CDATA_SECTION,this._stateCdataSection(t)}}_stateCharacterReference(){let t=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(t<0)if(this.preprocessor.lastChunkWritten)t=this.entityDecoder.end();else{this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,this.preprocessor.endOfChunkHit=!0;return}t===0?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(u.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&Ks(this.preprocessor.peek(1))?A.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(t){Ks(t)?this._flushCodePointConsumedAsCharacterReference(t):(t===u.SEMICOLON&&this._err(T.unknownNamedCharacterReference),this.state=this.returnState,this._callState(t))}};var Zs=new Set([i.DD,i.DT,i.LI,i.OPTGROUP,i.OPTION,i.P,i.RB,i.RP,i.RT,i.RTC]),Vs=new Set([...Zs,i.CAPTION,i.COLGROUP,i.TBODY,i.TD,i.TFOOT,i.TH,i.THEAD,i.TR]),ur=new Set([i.APPLET,i.CAPTION,i.HTML,i.MARQUEE,i.OBJECT,i.TABLE,i.TD,i.TEMPLATE,i.TH]),zc=new Set([...ur,i.OL,i.UL]),qc=new Set([...ur,i.BUTTON]),$s=new Set([i.ANNOTATION_XML,i.MI,i.MN,i.MO,i.MS,i.MTEXT]),Xs=new Set([i.DESC,i.FOREIGN_OBJECT,i.TITLE]),el=new Set([i.TR,i.TEMPLATE,i.HTML]),tl=new Set([i.TBODY,i.TFOOT,i.THEAD,i.TEMPLATE,i.HTML]),rl=new Set([i.TABLE,i.TEMPLATE,i.HTML]),nl=new Set([i.TD,i.TH]),Ar=class{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(t,r,n){this.treeAdapter=r,this.handler=n,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=i.UNKNOWN,this.current=t}_indexOf(t){return this.items.lastIndexOf(t,this.stackTop)}_isInTemplate(){return this.currentTagId===i.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===b.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(t,r){this.stackTop++,this.items[this.stackTop]=t,this.current=t,this.tagIDs[this.stackTop]=r,this.currentTagId=r,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(t,r,!0)}pop(){let t=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!0)}replace(t,r){let n=this._indexOf(t);this.items[n]=r,n===this.stackTop&&(this.current=r)}insertAfter(t,r,n){let s=this._indexOf(t)+1;this.items.splice(s,0,r),this.tagIDs.splice(s,0,n),this.stackTop++,s===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,s===this.stackTop)}popUntilTagNamePopped(t){let r=this.stackTop+1;do r=this.tagIDs.lastIndexOf(t,r-1);while(r>0&&this.treeAdapter.getNamespaceURI(this.items[r])!==b.HTML);this.shortenToLength(Math.max(r,0))}shortenToLength(t){for(;this.stackTop>=t;){let r=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(r,this.stackTop<t)}}popUntilElementPopped(t){let r=this._indexOf(t);this.shortenToLength(Math.max(r,0))}popUntilPopped(t,r){let n=this._indexOfTagNames(t,r);this.shortenToLength(Math.max(n,0))}popUntilNumberedHeaderPopped(){this.popUntilPopped(Tt,b.HTML)}popUntilTableCellPopped(){this.popUntilPopped(nl,b.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(t,r){for(let n=this.stackTop;n>=0;n--)if(t.has(this.tagIDs[n])&&this.treeAdapter.getNamespaceURI(this.items[n])===r)return n;return-1}clearBackTo(t,r){let n=this._indexOfTagNames(t,r);this.shortenToLength(n+1)}clearBackToTableContext(){this.clearBackTo(rl,b.HTML)}clearBackToTableBodyContext(){this.clearBackTo(tl,b.HTML)}clearBackToTableRowContext(){this.clearBackTo(el,b.HTML)}remove(t){let r=this._indexOf(t);r>=0&&(r===this.stackTop?this.pop():(this.items.splice(r,1),this.tagIDs.splice(r,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===i.BODY?this.items[1]:null}contains(t){return this._indexOf(t)>-1}getCommonAncestor(t){let r=this._indexOf(t)-1;return r>=0?this.items[r]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===i.HTML}hasInDynamicScope(t,r){for(let n=this.stackTop;n>=0;n--){let s=this.tagIDs[n];switch(this.treeAdapter.getNamespaceURI(this.items[n])){case b.HTML:{if(s===t)return!0;if(r.has(s))return!1;break}case b.SVG:{if(Xs.has(s))return!1;break}case b.MATHML:{if($s.has(s))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,ur)}hasInListItemScope(t){return this.hasInDynamicScope(t,zc)}hasInButtonScope(t){return this.hasInDynamicScope(t,qc)}hasNumberedHeaderInScope(){for(let t=this.stackTop;t>=0;t--){let r=this.tagIDs[t];switch(this.treeAdapter.getNamespaceURI(this.items[t])){case b.HTML:{if(Tt.has(r))return!0;if(ur.has(r))return!1;break}case b.SVG:{if(Xs.has(r))return!1;break}case b.MATHML:{if($s.has(r))return!1;break}}}return!0}hasInTableScope(t){for(let r=this.stackTop;r>=0;r--)if(this.treeAdapter.getNamespaceURI(this.items[r])===b.HTML)switch(this.tagIDs[r]){case t:return!0;case i.TABLE:case i.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===b.HTML)switch(this.tagIDs[t]){case i.TBODY:case i.THEAD:case i.TFOOT:return!0;case i.TABLE:case i.HTML:return!1}return!0}hasInSelectScope(t){for(let r=this.stackTop;r>=0;r--)if(this.treeAdapter.getNamespaceURI(this.items[r])===b.HTML)switch(this.tagIDs[r]){case t:return!0;case i.OPTION:case i.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&Zs.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&Vs.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==void 0&&this.currentTagId!==t&&Vs.has(this.currentTagId);)this.pop()}};var Ae;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})(Ae||(Ae={}));var zs={type:Ae.Marker},pr=class{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,r){let n=[],s=r.length,a=this.treeAdapter.getTagName(t),c=this.treeAdapter.getNamespaceURI(t);for(let l=0;l<this.entries.length;l++){let o=this.entries[l];if(o.type===Ae.Marker)break;let{element:d}=o;if(this.treeAdapter.getTagName(d)===a&&this.treeAdapter.getNamespaceURI(d)===c){let p=this.treeAdapter.getAttrList(d);p.length===s&&n.push({idx:l,attrs:p})}}return n}_ensureNoahArkCondition(t){if(this.entries.length<3)return;let r=this.treeAdapter.getAttrList(t),n=this._getNoahArkConditionCandidates(t,r);if(n.length<3)return;let s=new Map(r.map(c=>[c.name,c.value])),a=0;for(let c=0;c<n.length;c++){let l=n[c];l.attrs.every(o=>s.get(o.name)===o.value)&&(a+=1,a>=3&&this.entries.splice(l.idx,1))}}insertMarker(){this.entries.unshift(zs)}pushElement(t,r){this._ensureNoahArkCondition(t),this.entries.unshift({type:Ae.Element,element:t,token:r})}insertElementAfterBookmark(t,r){let n=this.entries.indexOf(this.bookmark);this.entries.splice(n,0,{type:Ae.Element,element:t,token:r})}removeEntry(t){let r=this.entries.indexOf(t);r!==-1&&this.entries.splice(r,1)}clearToLastMarker(){let t=this.entries.indexOf(zs);t===-1?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){let r=this.entries.find(n=>n.type===Ae.Marker||this.treeAdapter.getTagName(n.element)===t);return r&&r.type===Ae.Element?r:null}getElementEntry(t){return this.entries.find(r=>r.type===Ae.Element&&r.element===t)}};var pe={createDocument(){return{nodeName:"#document",mode:q.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:"#document-fragment",childNodes:[]}},createElement(e,t,r){return{nodeName:e,tagName:e,attrs:r,namespaceURI:t,childNodes:[],parentNode:null}},createCommentNode(e){return{nodeName:"#comment",data:e,parentNode:null}},createTextNode(e){return{nodeName:"#text",value:e,parentNode:null}},appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,r){let n=e.childNodes.indexOf(r);e.childNodes.splice(n,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,r,n){let s=e.childNodes.find(a=>a.nodeName==="#documentType");if(s)s.name=t,s.publicId=r,s.systemId=n;else{let a={nodeName:"#documentType",name:t,publicId:r,systemId:n,parentNode:null};pe.appendChild(e,a)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){let t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){let r=e.childNodes[e.childNodes.length-1];if(pe.isTextNode(r)){r.value+=t;return}}pe.appendChild(e,pe.createTextNode(t))},insertTextBefore(e,t,r){let n=e.childNodes[e.childNodes.indexOf(r)-1];n&&pe.isTextNode(n)?n.value+=t:pe.insertBefore(e,pe.createTextNode(t),r)},adoptAttributes(e,t){let r=new Set(e.attrs.map(n=>n.name));for(let n=0;n<t.length;n++)r.has(t[n].name)||e.attrs.push(t[n])},getFirstChild(e){return e.childNodes[0]},getChildNodes(e){return e.childNodes},getParentNode(e){return e.parentNode},getAttrList(e){return e.attrs},getTagName(e){return e.tagName},getNamespaceURI(e){return e.namespaceURI},getTextNodeContent(e){return e.value},getCommentNodeContent(e){return e.data},getDocumentTypeNodeName(e){return e.name},getDocumentTypeNodePublicId(e){return e.publicId},getDocumentTypeNodeSystemId(e){return e.systemId},isTextNode(e){return e.nodeName==="#text"},isCommentNode(e){return e.nodeName==="#comment"},isDocumentTypeNode(e){return e.nodeName==="#documentType"},isElementNode(e){return Object.prototype.hasOwnProperty.call(e,"tagName")},setNodeSourceCodeLocation(e,t){e.sourceCodeLocation=t},getNodeSourceCodeLocation(e){return e.sourceCodeLocation},updateNodeSourceCodeLocation(e,t){e.sourceCodeLocation={...e.sourceCodeLocation,...t}}};var ei="html",sl="about:legacy-compat",il="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd",ti=["+//silmaril//dtd html pro v0r11 19970101//","-//as//dtd html 3.0 aswedit + extensions//","-//advasoft ltd//dtd html 3.0 aswedit + extensions//","-//ietf//dtd html 2.0 level 1//","-//ietf//dtd html 2.0 level 2//","-//ietf//dtd html 2.0 strict level 1//","-//ietf//dtd html 2.0 strict level 2//","-//ietf//dtd html 2.0 strict//","-//ietf//dtd html 2.0//","-//ietf//dtd html 2.1e//","-//ietf//dtd html 3.0//","-//ietf//dtd html 3.2 final//","-//ietf//dtd html 3.2//","-//ietf//dtd html 3//","-//ietf//dtd html level 0//","-//ietf//dtd html level 1//","-//ietf//dtd html level 2//","-//ietf//dtd html level 3//","-//ietf//dtd html strict level 0//","-//ietf//dtd html strict level 1//","-//ietf//dtd html strict level 2//","-//ietf//dtd html strict level 3//","-//ietf//dtd html strict//","-//ietf//dtd html//","-//metrius//dtd metrius presentational//","-//microsoft//dtd internet explorer 2.0 html strict//","-//microsoft//dtd internet explorer 2.0 html//","-//microsoft//dtd internet explorer 2.0 tables//","-//microsoft//dtd internet explorer 3.0 html strict//","-//microsoft//dtd internet explorer 3.0 html//","-//microsoft//dtd internet explorer 3.0 tables//","-//netscape comm. corp.//dtd html//","-//netscape comm. corp.//dtd strict html//","-//o'reilly and associates//dtd html 2.0//","-//o'reilly and associates//dtd html extended 1.0//","-//o'reilly and associates//dtd html extended relaxed 1.0//","-//sq//dtd html 2.0 hotmetal + extensions//","-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//","-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//","-//spyglass//dtd html 2.0 extended//","-//sun microsystems corp.//dtd hotjava html//","-//sun microsystems corp.//dtd hotjava strict html//","-//w3c//dtd html 3 1995-03-24//","-//w3c//dtd html 3.2 draft//","-//w3c//dtd html 3.2 final//","-//w3c//dtd html 3.2//","-//w3c//dtd html 3.2s draft//","-//w3c//dtd html 4.0 frameset//","-//w3c//dtd html 4.0 transitional//","-//w3c//dtd html experimental 19960712//","-//w3c//dtd html experimental 970421//","-//w3c//dtd w3 html//","-//w3o//dtd w3 html 3.0//","-//webtechs//dtd mozilla html 2.0//","-//webtechs//dtd mozilla html//"],al=[...ti,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"],ol=new Set(["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"]),ri=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],cl=[...ri,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"];function qs(e,t){return t.some(r=>e.startsWith(r))}function ni(e){return e.name===ei&&e.publicId===null&&(e.systemId===null||e.systemId===sl)}function si(e){if(e.name!==ei)return q.QUIRKS;let{systemId:t}=e;if(t&&t.toLowerCase()===il)return q.QUIRKS;let{publicId:r}=e;if(r!==null){if(r=r.toLowerCase(),ol.has(r))return q.QUIRKS;let n=t===null?al:ti;if(qs(r,n))return q.QUIRKS;if(n=t===null?ri:cl,qs(r,n))return q.LIMITED_QUIRKS}return q.NO_QUIRKS}var ii={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},dl="definitionurl",ul="definitionURL",Al=new Map(["attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(e=>[e.toLowerCase(),e])),pl=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:b.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:b.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:b.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:b.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:b.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:b.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:b.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:b.XML}],["xml:space",{prefix:"xml",name:"space",namespace:b.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:b.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:b.XMLNS}]]),hl=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(e=>[e.toLowerCase(),e])),gl=new Set([i.B,i.BIG,i.BLOCKQUOTE,i.BODY,i.BR,i.CENTER,i.CODE,i.DD,i.DIV,i.DL,i.DT,i.EM,i.EMBED,i.H1,i.H2,i.H3,i.H4,i.H5,i.H6,i.HEAD,i.HR,i.I,i.IMG,i.LI,i.LISTING,i.MENU,i.META,i.NOBR,i.OL,i.P,i.PRE,i.RUBY,i.S,i.SMALL,i.SPAN,i.STRONG,i.STRIKE,i.SUB,i.SUP,i.TABLE,i.TT,i.U,i.UL,i.VAR]);function ai(e){let t=e.tagID;return t===i.FONT&&e.attrs.some(({name:n})=>n===be.COLOR||n===be.SIZE||n===be.FACE)||gl.has(t)}function fn(e){for(let t=0;t<e.attrs.length;t++)if(e.attrs[t].name===dl){e.attrs[t].name=ul;break}}function En(e){for(let t=0;t<e.attrs.length;t++){let r=Al.get(e.attrs[t].name);r!=null&&(e.attrs[t].name=r)}}function hr(e){for(let t=0;t<e.attrs.length;t++){let r=pl.get(e.attrs[t].name);r&&(e.attrs[t].prefix=r.prefix,e.attrs[t].name=r.name,e.attrs[t].namespace=r.namespace)}}function oi(e){let t=hl.get(e.tagName);t!=null&&(e.tagName=t,e.tagID=Pe(e.tagName))}function ml(e,t){return t===b.MATHML&&(e===i.MI||e===i.MO||e===i.MN||e===i.MS||e===i.MTEXT)}function fl(e,t,r){if(t===b.MATHML&&e===i.ANNOTATION_XML){for(let n=0;n<r.length;n++)if(r[n].name===be.ENCODING){let s=r[n].value.toLowerCase();return s===ii.TEXT_HTML||s===ii.APPLICATION_XML}}return t===b.SVG&&(e===i.FOREIGN_OBJECT||e===i.DESC||e===i.TITLE)}function ci(e,t,r,n){return(!n||n===b.HTML)&&fl(e,t,r)||(!n||n===b.MATHML)&&ml(e,t)}var El="hidden",Tl=8,bl=3,g;(function(e){e[e.INITIAL=0]="INITIAL",e[e.BEFORE_HTML=1]="BEFORE_HTML",e[e.BEFORE_HEAD=2]="BEFORE_HEAD",e[e.IN_HEAD=3]="IN_HEAD",e[e.IN_HEAD_NO_SCRIPT=4]="IN_HEAD_NO_SCRIPT",e[e.AFTER_HEAD=5]="AFTER_HEAD",e[e.IN_BODY=6]="IN_BODY",e[e.TEXT=7]="TEXT",e[e.IN_TABLE=8]="IN_TABLE",e[e.IN_TABLE_TEXT=9]="IN_TABLE_TEXT",e[e.IN_CAPTION=10]="IN_CAPTION",e[e.IN_COLUMN_GROUP=11]="IN_COLUMN_GROUP",e[e.IN_TABLE_BODY=12]="IN_TABLE_BODY",e[e.IN_ROW=13]="IN_ROW",e[e.IN_CELL=14]="IN_CELL",e[e.IN_SELECT=15]="IN_SELECT",e[e.IN_SELECT_IN_TABLE=16]="IN_SELECT_IN_TABLE",e[e.IN_TEMPLATE=17]="IN_TEMPLATE",e[e.AFTER_BODY=18]="AFTER_BODY",e[e.IN_FRAMESET=19]="IN_FRAMESET",e[e.AFTER_FRAMESET=20]="AFTER_FRAMESET",e[e.AFTER_AFTER_BODY=21]="AFTER_AFTER_BODY",e[e.AFTER_AFTER_FRAMESET=22]="AFTER_AFTER_FRAMESET"})(g||(g={}));var Cl={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},pi=new Set([i.TABLE,i.TBODY,i.TFOOT,i.THEAD,i.TR]),di={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:pe,onParseError:null},Rt=class{constructor(t,r,n=null,s=null){this.fragmentContext=n,this.scriptHandler=s,this.currentToken=null,this.stopped=!1,this.insertionMode=g.INITIAL,this.originalInsertionMode=g.INITIAL,this.headElement=null,this.formElement=null,this.currentNotInHTML=!1,this.tmplInsertionModeStack=[],this.pendingCharacterTokens=[],this.hasNonWhitespacePendingCharacterToken=!1,this.framesetOk=!0,this.skipNextNewLine=!1,this.fosterParentingEnabled=!1,this.options={...di,...t},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=r??this.treeAdapter.createDocument(),this.tokenizer=new Ct(this.options,this),this.activeFormattingElements=new pr(this.treeAdapter),this.fragmentContextID=n?Pe(this.treeAdapter.getTagName(n)):i.UNKNOWN,this._setContextModes(n??this.document,this.fragmentContextID),this.openElements=new Ar(this.document,this.treeAdapter,this)}static parse(t,r){let n=new this(r);return n.tokenizer.write(t,!0),n.document}static getFragmentParser(t,r){let n={...di,...r};t??(t=n.treeAdapter.createElement(E.TEMPLATE,b.HTML,[]));let s=n.treeAdapter.createElement("documentmock",b.HTML,[]),a=new this(n,s,t);return a.fragmentContextID===i.TEMPLATE&&a.tmplInsertionModeStack.unshift(g.IN_TEMPLATE),a._initTokenizerForFragmentParsing(),a._insertFakeRootElement(),a._resetInsertionMode(),a._findFormInFragmentContext(),a}getFragment(){let t=this.treeAdapter.getFirstChild(this.document),r=this.treeAdapter.createDocumentFragment();return this._adoptNodes(t,r),r}_err(t,r,n){var s;if(!this.onParseError)return;let a=(s=t.location)!==null&&s!==void 0?s:Cl,c={code:r,startLine:a.startLine,startCol:a.startCol,startOffset:a.startOffset,endLine:n?a.startLine:a.endLine,endCol:n?a.startCol:a.endCol,endOffset:n?a.startOffset:a.endOffset};this.onParseError(c)}onItemPush(t,r,n){var s,a;(a=(s=this.treeAdapter).onItemPush)===null||a===void 0||a.call(s,t),n&&this.openElements.stackTop>0&&this._setContextModes(t,r)}onItemPop(t,r){var n,s;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(t,this.currentToken),(s=(n=this.treeAdapter).onItemPop)===null||s===void 0||s.call(n,t,this.openElements.current),r){let a,c;this.openElements.stackTop===0&&this.fragmentContext?(a=this.fragmentContext,c=this.fragmentContextID):{current:a,currentTagId:c}=this.openElements,this._setContextModes(a,c)}}_setContextModes(t,r){let n=t===this.document||t&&this.treeAdapter.getNamespaceURI(t)===b.HTML;this.currentNotInHTML=!n,this.tokenizer.inForeignNode=!n&&t!==void 0&&r!==void 0&&!this._isIntegrationPoint(r,t)}_switchToTextParsing(t,r){this._insertElement(t,b.HTML),this.tokenizer.state=r,this.originalInsertionMode=this.insertionMode,this.insertionMode=g.TEXT}switchToPlaintextParsing(){this.insertionMode=g.TEXT,this.originalInsertionMode=g.IN_BODY,this.tokenizer.state=j.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let t=this.fragmentContext;for(;t;){if(this.treeAdapter.getTagName(t)===E.FORM){this.formElement=t;break}t=this.treeAdapter.getParentNode(t)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==b.HTML))switch(this.fragmentContextID){case i.TITLE:case i.TEXTAREA:{this.tokenizer.state=j.RCDATA;break}case i.STYLE:case i.XMP:case i.IFRAME:case i.NOEMBED:case i.NOFRAMES:case i.NOSCRIPT:{this.tokenizer.state=j.RAWTEXT;break}case i.SCRIPT:{this.tokenizer.state=j.SCRIPT_DATA;break}case i.PLAINTEXT:{this.tokenizer.state=j.PLAINTEXT;break}default:}}_setDocumentType(t){let r=t.name||"",n=t.publicId||"",s=t.systemId||"";if(this.treeAdapter.setDocumentType(this.document,r,n,s),t.location){let c=this.treeAdapter.getChildNodes(this.document).find(l=>this.treeAdapter.isDocumentTypeNode(l));c&&this.treeAdapter.setNodeSourceCodeLocation(c,t.location)}}_attachElementToTree(t,r){if(this.options.sourceCodeLocationInfo){let n=r&&{...r,startTag:r};this.treeAdapter.setNodeSourceCodeLocation(t,n)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(t);else{let n=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(n??this.document,t)}}_appendElement(t,r){let n=this.treeAdapter.createElement(t.tagName,r,t.attrs);this._attachElementToTree(n,t.location)}_insertElement(t,r){let n=this.treeAdapter.createElement(t.tagName,r,t.attrs);this._attachElementToTree(n,t.location),this.openElements.push(n,t.tagID)}_insertFakeElement(t,r){let n=this.treeAdapter.createElement(t,b.HTML,[]);this._attachElementToTree(n,null),this.openElements.push(n,r)}_insertTemplate(t){let r=this.treeAdapter.createElement(t.tagName,b.HTML,t.attrs),n=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(r,n),this._attachElementToTree(r,t.location),this.openElements.push(r,t.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,null)}_insertFakeRootElement(){let t=this.treeAdapter.createElement(E.HTML,b.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,i.HTML)}_appendCommentNode(t,r){let n=this.treeAdapter.createCommentNode(t.data);this.treeAdapter.appendChild(r,n),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,t.location)}_insertCharacters(t){let r,n;if(this._shouldFosterParentOnInsertion()?({parent:r,beforeElement:n}=this._findFosterParentingLocation(),n?this.treeAdapter.insertTextBefore(r,t.chars,n):this.treeAdapter.insertText(r,t.chars)):(r=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(r,t.chars)),!t.location)return;let s=this.treeAdapter.getChildNodes(r),a=n?s.lastIndexOf(n):s.length,c=s[a-1];if(this.treeAdapter.getNodeSourceCodeLocation(c)){let{endLine:o,endCol:d,endOffset:p}=t.location;this.treeAdapter.updateNodeSourceCodeLocation(c,{endLine:o,endCol:d,endOffset:p})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(c,t.location)}_adoptNodes(t,r){for(let n=this.treeAdapter.getFirstChild(t);n;n=this.treeAdapter.getFirstChild(t))this.treeAdapter.detachNode(n),this.treeAdapter.appendChild(r,n)}_setEndLocation(t,r){if(this.treeAdapter.getNodeSourceCodeLocation(t)&&r.location){let n=r.location,s=this.treeAdapter.getTagName(t),a=r.type===v.END_TAG&&s===r.tagName?{endTag:{...n},endLine:n.endLine,endCol:n.endCol,endOffset:n.endOffset}:{endLine:n.startLine,endCol:n.startCol,endOffset:n.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(t,a)}}shouldProcessStartTagTokenInForeignContent(t){if(!this.currentNotInHTML)return!1;let r,n;return this.openElements.stackTop===0&&this.fragmentContext?(r=this.fragmentContext,n=this.fragmentContextID):{current:r,currentTagId:n}=this.openElements,t.tagID===i.SVG&&this.treeAdapter.getTagName(r)===E.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(r)===b.MATHML?!1:this.tokenizer.inForeignNode||(t.tagID===i.MGLYPH||t.tagID===i.MALIGNMARK)&&n!==void 0&&!this._isIntegrationPoint(n,r,b.HTML)}_processToken(t){switch(t.type){case v.CHARACTER:{this.onCharacter(t);break}case v.NULL_CHARACTER:{this.onNullCharacter(t);break}case v.COMMENT:{this.onComment(t);break}case v.DOCTYPE:{this.onDoctype(t);break}case v.START_TAG:{this._processStartTag(t);break}case v.END_TAG:{this.onEndTag(t);break}case v.EOF:{this.onEof(t);break}case v.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(t);break}}}_isIntegrationPoint(t,r,n){let s=this.treeAdapter.getNamespaceURI(r),a=this.treeAdapter.getAttrList(r);return ci(t,s,a,n)}_reconstructActiveFormattingElements(){let t=this.activeFormattingElements.entries.length;if(t){let r=this.activeFormattingElements.entries.findIndex(s=>s.type===Ae.Marker||this.openElements.contains(s.element)),n=r===-1?t-1:r-1;for(let s=n;s>=0;s--){let a=this.activeFormattingElements.entries[s];this._insertElement(a.token,this.treeAdapter.getNamespaceURI(a.element)),a.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=g.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(i.P),this.openElements.popUntilTagNamePopped(i.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(t===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case i.TR:{this.insertionMode=g.IN_ROW;return}case i.TBODY:case i.THEAD:case i.TFOOT:{this.insertionMode=g.IN_TABLE_BODY;return}case i.CAPTION:{this.insertionMode=g.IN_CAPTION;return}case i.COLGROUP:{this.insertionMode=g.IN_COLUMN_GROUP;return}case i.TABLE:{this.insertionMode=g.IN_TABLE;return}case i.BODY:{this.insertionMode=g.IN_BODY;return}case i.FRAMESET:{this.insertionMode=g.IN_FRAMESET;return}case i.SELECT:{this._resetInsertionModeForSelect(t);return}case i.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case i.HTML:{this.insertionMode=this.headElement?g.AFTER_HEAD:g.BEFORE_HEAD;return}case i.TD:case i.TH:{if(t>0){this.insertionMode=g.IN_CELL;return}break}case i.HEAD:{if(t>0){this.insertionMode=g.IN_HEAD;return}break}}this.insertionMode=g.IN_BODY}_resetInsertionModeForSelect(t){if(t>0)for(let r=t-1;r>0;r--){let n=this.openElements.tagIDs[r];if(n===i.TEMPLATE)break;if(n===i.TABLE){this.insertionMode=g.IN_SELECT_IN_TABLE;return}}this.insertionMode=g.IN_SELECT}_isElementCausesFosterParenting(t){return pi.has(t)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let t=this.openElements.stackTop;t>=0;t--){let r=this.openElements.items[t];switch(this.openElements.tagIDs[t]){case i.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(r)===b.HTML)return{parent:this.treeAdapter.getTemplateContent(r),beforeElement:null};break}case i.TABLE:{let n=this.treeAdapter.getParentNode(r);return n?{parent:n,beforeElement:r}:{parent:this.openElements.items[t-1],beforeElement:null}}default:}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(t){let r=this._findFosterParentingLocation();r.beforeElement?this.treeAdapter.insertBefore(r.parent,t,r.beforeElement):this.treeAdapter.appendChild(r.parent,t)}_isSpecialElement(t,r){let n=this.treeAdapter.getNamespaceURI(t);return Ws[n].has(r)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){Zd(this,t);return}switch(this.insertionMode){case g.INITIAL:{It(this,t);break}case g.BEFORE_HTML:{wt(this,t);break}case g.BEFORE_HEAD:{xt(this,t);break}case g.IN_HEAD:{St(this,t);break}case g.IN_HEAD_NO_SCRIPT:{Nt(this,t);break}case g.AFTER_HEAD:{_t(this,t);break}case g.IN_BODY:case g.IN_CAPTION:case g.IN_CELL:case g.IN_TEMPLATE:{gi(this,t);break}case g.TEXT:case g.IN_SELECT:case g.IN_SELECT_IN_TABLE:{this._insertCharacters(t);break}case g.IN_TABLE:case g.IN_TABLE_BODY:case g.IN_ROW:{Tn(this,t);break}case g.IN_TABLE_TEXT:{Ci(this,t);break}case g.IN_COLUMN_GROUP:{mr(this,t);break}case g.AFTER_BODY:{fr(this,t);break}case g.AFTER_AFTER_BODY:{gr(this,t);break}default:}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){Xd(this,t);return}switch(this.insertionMode){case g.INITIAL:{It(this,t);break}case g.BEFORE_HTML:{wt(this,t);break}case g.BEFORE_HEAD:{xt(this,t);break}case g.IN_HEAD:{St(this,t);break}case g.IN_HEAD_NO_SCRIPT:{Nt(this,t);break}case g.AFTER_HEAD:{_t(this,t);break}case g.TEXT:{this._insertCharacters(t);break}case g.IN_TABLE:case g.IN_TABLE_BODY:case g.IN_ROW:{Tn(this,t);break}case g.IN_COLUMN_GROUP:{mr(this,t);break}case g.AFTER_BODY:{fr(this,t);break}case g.AFTER_AFTER_BODY:{gr(this,t);break}default:}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){bn(this,t);return}switch(this.insertionMode){case g.INITIAL:case g.BEFORE_HTML:case g.BEFORE_HEAD:case g.IN_HEAD:case g.IN_HEAD_NO_SCRIPT:case g.AFTER_HEAD:case g.IN_BODY:case g.IN_TABLE:case g.IN_CAPTION:case g.IN_COLUMN_GROUP:case g.IN_TABLE_BODY:case g.IN_ROW:case g.IN_CELL:case g.IN_SELECT:case g.IN_SELECT_IN_TABLE:case g.IN_TEMPLATE:case g.IN_FRAMESET:case g.AFTER_FRAMESET:{bn(this,t);break}case g.IN_TABLE_TEXT:{yt(this,t);break}case g.AFTER_BODY:{_l(this,t);break}case g.AFTER_AFTER_BODY:case g.AFTER_AFTER_FRAMESET:{Rl(this,t);break}default:}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case g.INITIAL:{Ll(this,t);break}case g.BEFORE_HEAD:case g.IN_HEAD:case g.IN_HEAD_NO_SCRIPT:case g.AFTER_HEAD:{this._err(t,T.misplacedDoctype);break}case g.IN_TABLE_TEXT:{yt(this,t);break}default:}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,T.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?zd(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case g.INITIAL:{It(this,t);break}case g.BEFORE_HTML:{Ol(this,t);break}case g.BEFORE_HEAD:{Dl(this,t);break}case g.IN_HEAD:{he(this,t);break}case g.IN_HEAD_NO_SCRIPT:{Pl(this,t);break}case g.AFTER_HEAD:{Ul(this,t);break}case g.IN_BODY:{V(this,t);break}case g.IN_TABLE:{qe(this,t);break}case g.IN_TABLE_TEXT:{yt(this,t);break}case g.IN_CAPTION:{kd(this,t);break}case g.IN_COLUMN_GROUP:{wn(this,t);break}case g.IN_TABLE_BODY:{br(this,t);break}case g.IN_ROW:{Cr(this,t);break}case g.IN_CELL:{Md(this,t);break}case g.IN_SELECT:{wi(this,t);break}case g.IN_SELECT_IN_TABLE:{Fd(this,t);break}case g.IN_TEMPLATE:{Qd(this,t);break}case g.AFTER_BODY:{Gd(this,t);break}case g.IN_FRAMESET:{Wd(this,t);break}case g.AFTER_FRAMESET:{Jd(this,t);break}case g.AFTER_AFTER_BODY:{Vd(this,t);break}case g.AFTER_AFTER_FRAMESET:{$d(this,t);break}default:}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?qd(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case g.INITIAL:{It(this,t);break}case g.BEFORE_HTML:{vl(this,t);break}case g.BEFORE_HEAD:{kl(this,t);break}case g.IN_HEAD:{Bl(this,t);break}case g.IN_HEAD_NO_SCRIPT:{Ml(this,t);break}case g.AFTER_HEAD:{Fl(this,t);break}case g.IN_BODY:{Tr(this,t);break}case g.TEXT:{wd(this,t);break}case g.IN_TABLE:{Lt(this,t);break}case g.IN_TABLE_TEXT:{yt(this,t);break}case g.IN_CAPTION:{Bd(this,t);break}case g.IN_COLUMN_GROUP:{Pd(this,t);break}case g.IN_TABLE_BODY:{Cn(this,t);break}case g.IN_ROW:{yi(this,t);break}case g.IN_CELL:{Ud(this,t);break}case g.IN_SELECT:{xi(this,t);break}case g.IN_SELECT_IN_TABLE:{Hd(this,t);break}case g.IN_TEMPLATE:{Yd(this,t);break}case g.AFTER_BODY:{Ni(this,t);break}case g.IN_FRAMESET:{Kd(this,t);break}case g.AFTER_FRAMESET:{jd(this,t);break}case g.AFTER_AFTER_BODY:{gr(this,t);break}default:}}onEof(t){switch(this.insertionMode){case g.INITIAL:{It(this,t);break}case g.BEFORE_HTML:{wt(this,t);break}case g.BEFORE_HEAD:{xt(this,t);break}case g.IN_HEAD:{St(this,t);break}case g.IN_HEAD_NO_SCRIPT:{Nt(this,t);break}case g.AFTER_HEAD:{_t(this,t);break}case g.IN_BODY:case g.IN_TABLE:case g.IN_CAPTION:case g.IN_COLUMN_GROUP:case g.IN_TABLE_BODY:case g.IN_ROW:case g.IN_CELL:case g.IN_SELECT:case g.IN_SELECT_IN_TABLE:{Ti(this,t);break}case g.TEXT:{xd(this,t);break}case g.IN_TABLE_TEXT:{yt(this,t);break}case g.IN_TEMPLATE:{Si(this,t);break}case g.AFTER_BODY:case g.IN_FRAMESET:case g.AFTER_FRAMESET:case g.AFTER_AFTER_BODY:case g.AFTER_AFTER_FRAMESET:{yn(this,t);break}default:}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===u.LINE_FEED)){if(t.chars.length===1)return;t.chars=t.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(t);return}switch(this.insertionMode){case g.IN_HEAD:case g.IN_HEAD_NO_SCRIPT:case g.AFTER_HEAD:case g.TEXT:case g.IN_COLUMN_GROUP:case g.IN_SELECT:case g.IN_SELECT_IN_TABLE:case g.IN_FRAMESET:case g.AFTER_FRAMESET:{this._insertCharacters(t);break}case g.IN_BODY:case g.IN_CAPTION:case g.IN_CELL:case g.IN_TEMPLATE:case g.AFTER_BODY:case g.AFTER_AFTER_BODY:case g.AFTER_AFTER_FRAMESET:{hi(this,t);break}case g.IN_TABLE:case g.IN_TABLE_BODY:case g.IN_ROW:{Tn(this,t);break}case g.IN_TABLE_TEXT:{bi(this,t);break}default:}}};function Il(e,t){let r=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return r?e.openElements.contains(r.element)?e.openElements.hasInScope(t.tagID)||(r=null):(e.activeFormattingElements.removeEntry(r),r=null):Ei(e,t),r}function yl(e,t){let r=null,n=e.openElements.stackTop;for(;n>=0;n--){let s=e.openElements.items[n];if(s===t.element)break;e._isSpecialElement(s,e.openElements.tagIDs[n])&&(r=s)}return r||(e.openElements.shortenToLength(Math.max(n,0)),e.activeFormattingElements.removeEntry(t)),r}function wl(e,t,r){let n=t,s=e.openElements.getCommonAncestor(t);for(let a=0,c=s;c!==r;a++,c=s){s=e.openElements.getCommonAncestor(c);let l=e.activeFormattingElements.getElementEntry(c),o=l&&a>=bl;!l||o?(o&&e.activeFormattingElements.removeEntry(l),e.openElements.remove(c)):(c=xl(e,l),n===t&&(e.activeFormattingElements.bookmark=l),e.treeAdapter.detachNode(n),e.treeAdapter.appendChild(c,n),n=c)}return n}function xl(e,t){let r=e.treeAdapter.getNamespaceURI(t.element),n=e.treeAdapter.createElement(t.token.tagName,r,t.token.attrs);return e.openElements.replace(t.element,n),t.element=n,n}function Sl(e,t,r){let n=e.treeAdapter.getTagName(t),s=Pe(n);if(e._isElementCausesFosterParenting(s))e._fosterParentElement(r);else{let a=e.treeAdapter.getNamespaceURI(t);s===i.TEMPLATE&&a===b.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,r)}}function Nl(e,t,r){let n=e.treeAdapter.getNamespaceURI(r.element),{token:s}=r,a=e.treeAdapter.createElement(s.tagName,n,s.attrs);e._adoptNodes(t,a),e.treeAdapter.appendChild(t,a),e.activeFormattingElements.insertElementAfterBookmark(a,s),e.activeFormattingElements.removeEntry(r),e.openElements.remove(r.element),e.openElements.insertAfter(t,a,s.tagID)}function In(e,t){for(let r=0;r<Tl;r++){let n=Il(e,t);if(!n)break;let s=yl(e,n);if(!s)break;e.activeFormattingElements.bookmark=n;let a=wl(e,s,n.element),c=e.openElements.getCommonAncestor(n.element);e.treeAdapter.detachNode(a),c&&Sl(e,c,a),Nl(e,s,n)}}function bn(e,t){e._appendCommentNode(t,e.openElements.currentTmplContentOrNode)}function _l(e,t){e._appendCommentNode(t,e.openElements.items[0])}function Rl(e,t){e._appendCommentNode(t,e.document)}function yn(e,t){if(e.stopped=!0,t.location){let r=e.fragmentContext?0:2;for(let n=e.openElements.stackTop;n>=r;n--)e._setEndLocation(e.openElements.items[n],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){let n=e.openElements.items[0],s=e.treeAdapter.getNodeSourceCodeLocation(n);if(s&&!s.endTag&&(e._setEndLocation(n,t),e.openElements.stackTop>=1)){let a=e.openElements.items[1],c=e.treeAdapter.getNodeSourceCodeLocation(a);c&&!c.endTag&&e._setEndLocation(a,t)}}}}function Ll(e,t){e._setDocumentType(t);let r=t.forceQuirks?q.QUIRKS:si(t);ni(t)||e._err(t,T.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,r),e.insertionMode=g.BEFORE_HTML}function It(e,t){e._err(t,T.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,q.QUIRKS),e.insertionMode=g.BEFORE_HTML,e._processToken(t)}function Ol(e,t){t.tagID===i.HTML?(e._insertElement(t,b.HTML),e.insertionMode=g.BEFORE_HEAD):wt(e,t)}function vl(e,t){let r=t.tagID;(r===i.HTML||r===i.HEAD||r===i.BODY||r===i.BR)&&wt(e,t)}function wt(e,t){e._insertFakeRootElement(),e.insertionMode=g.BEFORE_HEAD,e._processToken(t)}function Dl(e,t){switch(t.tagID){case i.HTML:{V(e,t);break}case i.HEAD:{e._insertElement(t,b.HTML),e.headElement=e.openElements.current,e.insertionMode=g.IN_HEAD;break}default:xt(e,t)}}function kl(e,t){let r=t.tagID;r===i.HEAD||r===i.BODY||r===i.HTML||r===i.BR?xt(e,t):e._err(t,T.endTagWithoutMatchingOpenElement)}function xt(e,t){e._insertFakeElement(E.HEAD,i.HEAD),e.headElement=e.openElements.current,e.insertionMode=g.IN_HEAD,e._processToken(t)}function he(e,t){switch(t.tagID){case i.HTML:{V(e,t);break}case i.BASE:case i.BASEFONT:case i.BGSOUND:case i.LINK:case i.META:{e._appendElement(t,b.HTML),t.ackSelfClosing=!0;break}case i.TITLE:{e._switchToTextParsing(t,j.RCDATA);break}case i.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,j.RAWTEXT):(e._insertElement(t,b.HTML),e.insertionMode=g.IN_HEAD_NO_SCRIPT);break}case i.NOFRAMES:case i.STYLE:{e._switchToTextParsing(t,j.RAWTEXT);break}case i.SCRIPT:{e._switchToTextParsing(t,j.SCRIPT_DATA);break}case i.TEMPLATE:{e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=g.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(g.IN_TEMPLATE);break}case i.HEAD:{e._err(t,T.misplacedStartTagForHeadElement);break}default:St(e,t)}}function Bl(e,t){switch(t.tagID){case i.HEAD:{e.openElements.pop(),e.insertionMode=g.AFTER_HEAD;break}case i.BODY:case i.BR:case i.HTML:{St(e,t);break}case i.TEMPLATE:{Me(e,t);break}default:e._err(t,T.endTagWithoutMatchingOpenElement)}}function Me(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==i.TEMPLATE&&e._err(t,T.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(i.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,T.endTagWithoutMatchingOpenElement)}function St(e,t){e.openElements.pop(),e.insertionMode=g.AFTER_HEAD,e._processToken(t)}function Pl(e,t){switch(t.tagID){case i.HTML:{V(e,t);break}case i.BASEFONT:case i.BGSOUND:case i.HEAD:case i.LINK:case i.META:case i.NOFRAMES:case i.STYLE:{he(e,t);break}case i.NOSCRIPT:{e._err(t,T.nestedNoscriptInHead);break}default:Nt(e,t)}}function Ml(e,t){switch(t.tagID){case i.NOSCRIPT:{e.openElements.pop(),e.insertionMode=g.IN_HEAD;break}case i.BR:{Nt(e,t);break}default:e._err(t,T.endTagWithoutMatchingOpenElement)}}function Nt(e,t){let r=t.type===v.EOF?T.openElementsLeftAfterEof:T.disallowedContentInNoscriptInHead;e._err(t,r),e.openElements.pop(),e.insertionMode=g.IN_HEAD,e._processToken(t)}function Ul(e,t){switch(t.tagID){case i.HTML:{V(e,t);break}case i.BODY:{e._insertElement(t,b.HTML),e.framesetOk=!1,e.insertionMode=g.IN_BODY;break}case i.FRAMESET:{e._insertElement(t,b.HTML),e.insertionMode=g.IN_FRAMESET;break}case i.BASE:case i.BASEFONT:case i.BGSOUND:case i.LINK:case i.META:case i.NOFRAMES:case i.SCRIPT:case i.STYLE:case i.TEMPLATE:case i.TITLE:{e._err(t,T.abandonedHeadElementChild),e.openElements.push(e.headElement,i.HEAD),he(e,t),e.openElements.remove(e.headElement);break}case i.HEAD:{e._err(t,T.misplacedStartTagForHeadElement);break}default:_t(e,t)}}function Fl(e,t){switch(t.tagID){case i.BODY:case i.HTML:case i.BR:{_t(e,t);break}case i.TEMPLATE:{Me(e,t);break}default:e._err(t,T.endTagWithoutMatchingOpenElement)}}function _t(e,t){e._insertFakeElement(E.BODY,i.BODY),e.insertionMode=g.IN_BODY,Er(e,t)}function Er(e,t){switch(t.type){case v.CHARACTER:{gi(e,t);break}case v.WHITESPACE_CHARACTER:{hi(e,t);break}case v.COMMENT:{bn(e,t);break}case v.START_TAG:{V(e,t);break}case v.END_TAG:{Tr(e,t);break}case v.EOF:{Ti(e,t);break}default:}}function hi(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function gi(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function Hl(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function Ql(e,t){let r=e.openElements.tryPeekProperlyNestedBodyElement();r&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(r,t.attrs))}function Yl(e,t){let r=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&r&&(e.treeAdapter.detachNode(r),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,b.HTML),e.insertionMode=g.IN_FRAMESET)}function Gl(e,t){e.openElements.hasInButtonScope(i.P)&&e._closePElement(),e._insertElement(t,b.HTML)}function Wl(e,t){e.openElements.hasInButtonScope(i.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&Tt.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,b.HTML)}function Kl(e,t){e.openElements.hasInButtonScope(i.P)&&e._closePElement(),e._insertElement(t,b.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function Jl(e,t){let r=e.openElements.tmplCount>0;(!e.formElement||r)&&(e.openElements.hasInButtonScope(i.P)&&e._closePElement(),e._insertElement(t,b.HTML),r||(e.formElement=e.openElements.current))}function jl(e,t){e.framesetOk=!1;let r=t.tagID;for(let n=e.openElements.stackTop;n>=0;n--){let s=e.openElements.tagIDs[n];if(r===i.LI&&s===i.LI||(r===i.DD||r===i.DT)&&(s===i.DD||s===i.DT)){e.openElements.generateImpliedEndTagsWithExclusion(s),e.openElements.popUntilTagNamePopped(s);break}if(s!==i.ADDRESS&&s!==i.DIV&&s!==i.P&&e._isSpecialElement(e.openElements.items[n],s))break}e.openElements.hasInButtonScope(i.P)&&e._closePElement(),e._insertElement(t,b.HTML)}function Vl(e,t){e.openElements.hasInButtonScope(i.P)&&e._closePElement(),e._insertElement(t,b.HTML),e.tokenizer.state=j.PLAINTEXT}function $l(e,t){e.openElements.hasInScope(i.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(i.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,b.HTML),e.framesetOk=!1}function Xl(e,t){let r=e.activeFormattingElements.getElementEntryInScopeWithTagName(E.A);r&&(In(e,t),e.openElements.remove(r.element),e.activeFormattingElements.removeEntry(r)),e._reconstructActiveFormattingElements(),e._insertElement(t,b.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function Zl(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,b.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function zl(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(i.NOBR)&&(In(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,b.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function ql(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,b.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function ed(e,t){e.treeAdapter.getDocumentMode(e.document)!==q.QUIRKS&&e.openElements.hasInButtonScope(i.P)&&e._closePElement(),e._insertElement(t,b.HTML),e.framesetOk=!1,e.insertionMode=g.IN_TABLE}function mi(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,b.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function fi(e){let t=cr(e,be.TYPE);return t!=null&&t.toLowerCase()===El}function td(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,b.HTML),fi(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function rd(e,t){e._appendElement(t,b.HTML),t.ackSelfClosing=!0}function nd(e,t){e.openElements.hasInButtonScope(i.P)&&e._closePElement(),e._appendElement(t,b.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function sd(e,t){t.tagName=E.IMG,t.tagID=i.IMG,mi(e,t)}function id(e,t){e._insertElement(t,b.HTML),e.skipNextNewLine=!0,e.tokenizer.state=j.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=g.TEXT}function ad(e,t){e.openElements.hasInButtonScope(i.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,j.RAWTEXT)}function od(e,t){e.framesetOk=!1,e._switchToTextParsing(t,j.RAWTEXT)}function ui(e,t){e._switchToTextParsing(t,j.RAWTEXT)}function cd(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,b.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===g.IN_TABLE||e.insertionMode===g.IN_CAPTION||e.insertionMode===g.IN_TABLE_BODY||e.insertionMode===g.IN_ROW||e.insertionMode===g.IN_CELL?g.IN_SELECT_IN_TABLE:g.IN_SELECT}function ld(e,t){e.openElements.currentTagId===i.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,b.HTML)}function dd(e,t){e.openElements.hasInScope(i.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,b.HTML)}function ud(e,t){e.openElements.hasInScope(i.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(i.RTC),e._insertElement(t,b.HTML)}function Ad(e,t){e._reconstructActiveFormattingElements(),fn(t),hr(t),t.selfClosing?e._appendElement(t,b.MATHML):e._insertElement(t,b.MATHML),t.ackSelfClosing=!0}function pd(e,t){e._reconstructActiveFormattingElements(),En(t),hr(t),t.selfClosing?e._appendElement(t,b.SVG):e._insertElement(t,b.SVG),t.ackSelfClosing=!0}function Ai(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,b.HTML)}function V(e,t){switch(t.tagID){case i.I:case i.S:case i.B:case i.U:case i.EM:case i.TT:case i.BIG:case i.CODE:case i.FONT:case i.SMALL:case i.STRIKE:case i.STRONG:{Zl(e,t);break}case i.A:{Xl(e,t);break}case i.H1:case i.H2:case i.H3:case i.H4:case i.H5:case i.H6:{Wl(e,t);break}case i.P:case i.DL:case i.OL:case i.UL:case i.DIV:case i.DIR:case i.NAV:case i.MAIN:case i.MENU:case i.ASIDE:case i.CENTER:case i.FIGURE:case i.FOOTER:case i.HEADER:case i.HGROUP:case i.DIALOG:case i.DETAILS:case i.ADDRESS:case i.ARTICLE:case i.SEARCH:case i.SECTION:case i.SUMMARY:case i.FIELDSET:case i.BLOCKQUOTE:case i.FIGCAPTION:{Gl(e,t);break}case i.LI:case i.DD:case i.DT:{jl(e,t);break}case i.BR:case i.IMG:case i.WBR:case i.AREA:case i.EMBED:case i.KEYGEN:{mi(e,t);break}case i.HR:{nd(e,t);break}case i.RB:case i.RTC:{dd(e,t);break}case i.RT:case i.RP:{ud(e,t);break}case i.PRE:case i.LISTING:{Kl(e,t);break}case i.XMP:{ad(e,t);break}case i.SVG:{pd(e,t);break}case i.HTML:{Hl(e,t);break}case i.BASE:case i.LINK:case i.META:case i.STYLE:case i.TITLE:case i.SCRIPT:case i.BGSOUND:case i.BASEFONT:case i.TEMPLATE:{he(e,t);break}case i.BODY:{Ql(e,t);break}case i.FORM:{Jl(e,t);break}case i.NOBR:{zl(e,t);break}case i.MATH:{Ad(e,t);break}case i.TABLE:{ed(e,t);break}case i.INPUT:{td(e,t);break}case i.PARAM:case i.TRACK:case i.SOURCE:{rd(e,t);break}case i.IMAGE:{sd(e,t);break}case i.BUTTON:{$l(e,t);break}case i.APPLET:case i.OBJECT:case i.MARQUEE:{ql(e,t);break}case i.IFRAME:{od(e,t);break}case i.SELECT:{cd(e,t);break}case i.OPTION:case i.OPTGROUP:{ld(e,t);break}case i.NOEMBED:case i.NOFRAMES:{ui(e,t);break}case i.FRAMESET:{Yl(e,t);break}case i.TEXTAREA:{id(e,t);break}case i.NOSCRIPT:{e.options.scriptingEnabled?ui(e,t):Ai(e,t);break}case i.PLAINTEXT:{Vl(e,t);break}case i.COL:case i.TH:case i.TD:case i.TR:case i.HEAD:case i.FRAME:case i.TBODY:case i.TFOOT:case i.THEAD:case i.CAPTION:case i.COLGROUP:break;default:Ai(e,t)}}function hd(e,t){if(e.openElements.hasInScope(i.BODY)&&(e.insertionMode=g.AFTER_BODY,e.options.sourceCodeLocationInfo)){let r=e.openElements.tryPeekProperlyNestedBodyElement();r&&e._setEndLocation(r,t)}}function gd(e,t){e.openElements.hasInScope(i.BODY)&&(e.insertionMode=g.AFTER_BODY,Ni(e,t))}function md(e,t){let r=t.tagID;e.openElements.hasInScope(r)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(r))}function fd(e){let t=e.openElements.tmplCount>0,{formElement:r}=e;t||(e.formElement=null),(r||t)&&e.openElements.hasInScope(i.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(i.FORM):r&&e.openElements.remove(r))}function Ed(e){e.openElements.hasInButtonScope(i.P)||e._insertFakeElement(E.P,i.P),e._closePElement()}function Td(e){e.openElements.hasInListItemScope(i.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(i.LI),e.openElements.popUntilTagNamePopped(i.LI))}function bd(e,t){let r=t.tagID;e.openElements.hasInScope(r)&&(e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.popUntilTagNamePopped(r))}function Cd(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function Id(e,t){let r=t.tagID;e.openElements.hasInScope(r)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(r),e.activeFormattingElements.clearToLastMarker())}function yd(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(E.BR,i.BR),e.openElements.pop(),e.framesetOk=!1}function Ei(e,t){let r=t.tagName,n=t.tagID;for(let s=e.openElements.stackTop;s>0;s--){let a=e.openElements.items[s],c=e.openElements.tagIDs[s];if(n===c&&(n!==i.UNKNOWN||e.treeAdapter.getTagName(a)===r)){e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.stackTop>=s&&e.openElements.shortenToLength(s);break}if(e._isSpecialElement(a,c))break}}function Tr(e,t){switch(t.tagID){case i.A:case i.B:case i.I:case i.S:case i.U:case i.EM:case i.TT:case i.BIG:case i.CODE:case i.FONT:case i.NOBR:case i.SMALL:case i.STRIKE:case i.STRONG:{In(e,t);break}case i.P:{Ed(e);break}case i.DL:case i.UL:case i.OL:case i.DIR:case i.DIV:case i.NAV:case i.PRE:case i.MAIN:case i.MENU:case i.ASIDE:case i.BUTTON:case i.CENTER:case i.FIGURE:case i.FOOTER:case i.HEADER:case i.HGROUP:case i.DIALOG:case i.ADDRESS:case i.ARTICLE:case i.DETAILS:case i.SEARCH:case i.SECTION:case i.SUMMARY:case i.LISTING:case i.FIELDSET:case i.BLOCKQUOTE:case i.FIGCAPTION:{md(e,t);break}case i.LI:{Td(e);break}case i.DD:case i.DT:{bd(e,t);break}case i.H1:case i.H2:case i.H3:case i.H4:case i.H5:case i.H6:{Cd(e);break}case i.BR:{yd(e);break}case i.BODY:{hd(e,t);break}case i.HTML:{gd(e,t);break}case i.FORM:{fd(e);break}case i.APPLET:case i.OBJECT:case i.MARQUEE:{Id(e,t);break}case i.TEMPLATE:{Me(e,t);break}default:Ei(e,t)}}function Ti(e,t){e.tmplInsertionModeStack.length>0?Si(e,t):yn(e,t)}function wd(e,t){var r;t.tagID===i.SCRIPT&&((r=e.scriptHandler)===null||r===void 0||r.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function xd(e,t){e._err(t,T.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function Tn(e,t){if(e.openElements.currentTagId!==void 0&&pi.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=g.IN_TABLE_TEXT,t.type){case v.CHARACTER:{Ci(e,t);break}case v.WHITESPACE_CHARACTER:{bi(e,t);break}}else Ot(e,t)}function Sd(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,b.HTML),e.insertionMode=g.IN_CAPTION}function Nd(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,b.HTML),e.insertionMode=g.IN_COLUMN_GROUP}function _d(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(E.COLGROUP,i.COLGROUP),e.insertionMode=g.IN_COLUMN_GROUP,wn(e,t)}function Rd(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,b.HTML),e.insertionMode=g.IN_TABLE_BODY}function Ld(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(E.TBODY,i.TBODY),e.insertionMode=g.IN_TABLE_BODY,br(e,t)}function Od(e,t){e.openElements.hasInTableScope(i.TABLE)&&(e.openElements.popUntilTagNamePopped(i.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function vd(e,t){fi(t)?e._appendElement(t,b.HTML):Ot(e,t),t.ackSelfClosing=!0}function Dd(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,b.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function qe(e,t){switch(t.tagID){case i.TD:case i.TH:case i.TR:{Ld(e,t);break}case i.STYLE:case i.SCRIPT:case i.TEMPLATE:{he(e,t);break}case i.COL:{_d(e,t);break}case i.FORM:{Dd(e,t);break}case i.TABLE:{Od(e,t);break}case i.TBODY:case i.TFOOT:case i.THEAD:{Rd(e,t);break}case i.INPUT:{vd(e,t);break}case i.CAPTION:{Sd(e,t);break}case i.COLGROUP:{Nd(e,t);break}default:Ot(e,t)}}function Lt(e,t){switch(t.tagID){case i.TABLE:{e.openElements.hasInTableScope(i.TABLE)&&(e.openElements.popUntilTagNamePopped(i.TABLE),e._resetInsertionMode());break}case i.TEMPLATE:{Me(e,t);break}case i.BODY:case i.CAPTION:case i.COL:case i.COLGROUP:case i.HTML:case i.TBODY:case i.TD:case i.TFOOT:case i.TH:case i.THEAD:case i.TR:break;default:Ot(e,t)}}function Ot(e,t){let r=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,Er(e,t),e.fosterParentingEnabled=r}function bi(e,t){e.pendingCharacterTokens.push(t)}function Ci(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function yt(e,t){let r=0;if(e.hasNonWhitespacePendingCharacterToken)for(;r<e.pendingCharacterTokens.length;r++)Ot(e,e.pendingCharacterTokens[r]);else for(;r<e.pendingCharacterTokens.length;r++)e._insertCharacters(e.pendingCharacterTokens[r]);e.insertionMode=e.originalInsertionMode,e._processToken(t)}var Ii=new Set([i.CAPTION,i.COL,i.COLGROUP,i.TBODY,i.TD,i.TFOOT,i.TH,i.THEAD,i.TR]);function kd(e,t){let r=t.tagID;Ii.has(r)?e.openElements.hasInTableScope(i.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(i.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=g.IN_TABLE,qe(e,t)):V(e,t)}function Bd(e,t){let r=t.tagID;switch(r){case i.CAPTION:case i.TABLE:{e.openElements.hasInTableScope(i.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(i.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=g.IN_TABLE,r===i.TABLE&&Lt(e,t));break}case i.BODY:case i.COL:case i.COLGROUP:case i.HTML:case i.TBODY:case i.TD:case i.TFOOT:case i.TH:case i.THEAD:case i.TR:break;default:Tr(e,t)}}function wn(e,t){switch(t.tagID){case i.HTML:{V(e,t);break}case i.COL:{e._appendElement(t,b.HTML),t.ackSelfClosing=!0;break}case i.TEMPLATE:{he(e,t);break}default:mr(e,t)}}function Pd(e,t){switch(t.tagID){case i.COLGROUP:{e.openElements.currentTagId===i.COLGROUP&&(e.openElements.pop(),e.insertionMode=g.IN_TABLE);break}case i.TEMPLATE:{Me(e,t);break}case i.COL:break;default:mr(e,t)}}function mr(e,t){e.openElements.currentTagId===i.COLGROUP&&(e.openElements.pop(),e.insertionMode=g.IN_TABLE,e._processToken(t))}function br(e,t){switch(t.tagID){case i.TR:{e.openElements.clearBackToTableBodyContext(),e._insertElement(t,b.HTML),e.insertionMode=g.IN_ROW;break}case i.TH:case i.TD:{e.openElements.clearBackToTableBodyContext(),e._insertFakeElement(E.TR,i.TR),e.insertionMode=g.IN_ROW,Cr(e,t);break}case i.CAPTION:case i.COL:case i.COLGROUP:case i.TBODY:case i.TFOOT:case i.THEAD:{e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=g.IN_TABLE,qe(e,t));break}default:qe(e,t)}}function Cn(e,t){let r=t.tagID;switch(t.tagID){case i.TBODY:case i.TFOOT:case i.THEAD:{e.openElements.hasInTableScope(r)&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=g.IN_TABLE);break}case i.TABLE:{e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=g.IN_TABLE,Lt(e,t));break}case i.BODY:case i.CAPTION:case i.COL:case i.COLGROUP:case i.HTML:case i.TD:case i.TH:case i.TR:break;default:Lt(e,t)}}function Cr(e,t){switch(t.tagID){case i.TH:case i.TD:{e.openElements.clearBackToTableRowContext(),e._insertElement(t,b.HTML),e.insertionMode=g.IN_CELL,e.activeFormattingElements.insertMarker();break}case i.CAPTION:case i.COL:case i.COLGROUP:case i.TBODY:case i.TFOOT:case i.THEAD:case i.TR:{e.openElements.hasInTableScope(i.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=g.IN_TABLE_BODY,br(e,t));break}default:qe(e,t)}}function yi(e,t){switch(t.tagID){case i.TR:{e.openElements.hasInTableScope(i.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=g.IN_TABLE_BODY);break}case i.TABLE:{e.openElements.hasInTableScope(i.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=g.IN_TABLE_BODY,Cn(e,t));break}case i.TBODY:case i.TFOOT:case i.THEAD:{(e.openElements.hasInTableScope(t.tagID)||e.openElements.hasInTableScope(i.TR))&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=g.IN_TABLE_BODY,Cn(e,t));break}case i.BODY:case i.CAPTION:case i.COL:case i.COLGROUP:case i.HTML:case i.TD:case i.TH:break;default:Lt(e,t)}}function Md(e,t){let r=t.tagID;Ii.has(r)?(e.openElements.hasInTableScope(i.TD)||e.openElements.hasInTableScope(i.TH))&&(e._closeTableCell(),Cr(e,t)):V(e,t)}function Ud(e,t){let r=t.tagID;switch(r){case i.TD:case i.TH:{e.openElements.hasInTableScope(r)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(r),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=g.IN_ROW);break}case i.TABLE:case i.TBODY:case i.TFOOT:case i.THEAD:case i.TR:{e.openElements.hasInTableScope(r)&&(e._closeTableCell(),yi(e,t));break}case i.BODY:case i.CAPTION:case i.COL:case i.COLGROUP:case i.HTML:break;default:Tr(e,t)}}function wi(e,t){switch(t.tagID){case i.HTML:{V(e,t);break}case i.OPTION:{e.openElements.currentTagId===i.OPTION&&e.openElements.pop(),e._insertElement(t,b.HTML);break}case i.OPTGROUP:{e.openElements.currentTagId===i.OPTION&&e.openElements.pop(),e.openElements.currentTagId===i.OPTGROUP&&e.openElements.pop(),e._insertElement(t,b.HTML);break}case i.HR:{e.openElements.currentTagId===i.OPTION&&e.openElements.pop(),e.openElements.currentTagId===i.OPTGROUP&&e.openElements.pop(),e._appendElement(t,b.HTML),t.ackSelfClosing=!0;break}case i.INPUT:case i.KEYGEN:case i.TEXTAREA:case i.SELECT:{e.openElements.hasInSelectScope(i.SELECT)&&(e.openElements.popUntilTagNamePopped(i.SELECT),e._resetInsertionMode(),t.tagID!==i.SELECT&&e._processStartTag(t));break}case i.SCRIPT:case i.TEMPLATE:{he(e,t);break}default:}}function xi(e,t){switch(t.tagID){case i.OPTGROUP:{e.openElements.stackTop>0&&e.openElements.currentTagId===i.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===i.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===i.OPTGROUP&&e.openElements.pop();break}case i.OPTION:{e.openElements.currentTagId===i.OPTION&&e.openElements.pop();break}case i.SELECT:{e.openElements.hasInSelectScope(i.SELECT)&&(e.openElements.popUntilTagNamePopped(i.SELECT),e._resetInsertionMode());break}case i.TEMPLATE:{Me(e,t);break}default:}}function Fd(e,t){let r=t.tagID;r===i.CAPTION||r===i.TABLE||r===i.TBODY||r===i.TFOOT||r===i.THEAD||r===i.TR||r===i.TD||r===i.TH?(e.openElements.popUntilTagNamePopped(i.SELECT),e._resetInsertionMode(),e._processStartTag(t)):wi(e,t)}function Hd(e,t){let r=t.tagID;r===i.CAPTION||r===i.TABLE||r===i.TBODY||r===i.TFOOT||r===i.THEAD||r===i.TR||r===i.TD||r===i.TH?e.openElements.hasInTableScope(r)&&(e.openElements.popUntilTagNamePopped(i.SELECT),e._resetInsertionMode(),e.onEndTag(t)):xi(e,t)}function Qd(e,t){switch(t.tagID){case i.BASE:case i.BASEFONT:case i.BGSOUND:case i.LINK:case i.META:case i.NOFRAMES:case i.SCRIPT:case i.STYLE:case i.TEMPLATE:case i.TITLE:{he(e,t);break}case i.CAPTION:case i.COLGROUP:case i.TBODY:case i.TFOOT:case i.THEAD:{e.tmplInsertionModeStack[0]=g.IN_TABLE,e.insertionMode=g.IN_TABLE,qe(e,t);break}case i.COL:{e.tmplInsertionModeStack[0]=g.IN_COLUMN_GROUP,e.insertionMode=g.IN_COLUMN_GROUP,wn(e,t);break}case i.TR:{e.tmplInsertionModeStack[0]=g.IN_TABLE_BODY,e.insertionMode=g.IN_TABLE_BODY,br(e,t);break}case i.TD:case i.TH:{e.tmplInsertionModeStack[0]=g.IN_ROW,e.insertionMode=g.IN_ROW,Cr(e,t);break}default:e.tmplInsertionModeStack[0]=g.IN_BODY,e.insertionMode=g.IN_BODY,V(e,t)}}function Yd(e,t){t.tagID===i.TEMPLATE&&Me(e,t)}function Si(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(i.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):yn(e,t)}function Gd(e,t){t.tagID===i.HTML?V(e,t):fr(e,t)}function Ni(e,t){var r;if(t.tagID===i.HTML){if(e.fragmentContext||(e.insertionMode=g.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===i.HTML){e._setEndLocation(e.openElements.items[0],t);let n=e.openElements.items[1];n&&!(!((r=e.treeAdapter.getNodeSourceCodeLocation(n))===null||r===void 0)&&r.endTag)&&e._setEndLocation(n,t)}}else fr(e,t)}function fr(e,t){e.insertionMode=g.IN_BODY,Er(e,t)}function Wd(e,t){switch(t.tagID){case i.HTML:{V(e,t);break}case i.FRAMESET:{e._insertElement(t,b.HTML);break}case i.FRAME:{e._appendElement(t,b.HTML),t.ackSelfClosing=!0;break}case i.NOFRAMES:{he(e,t);break}default:}}function Kd(e,t){t.tagID===i.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==i.FRAMESET&&(e.insertionMode=g.AFTER_FRAMESET))}function Jd(e,t){switch(t.tagID){case i.HTML:{V(e,t);break}case i.NOFRAMES:{he(e,t);break}default:}}function jd(e,t){t.tagID===i.HTML&&(e.insertionMode=g.AFTER_AFTER_FRAMESET)}function Vd(e,t){t.tagID===i.HTML?V(e,t):gr(e,t)}function gr(e,t){e.insertionMode=g.IN_BODY,Er(e,t)}function $d(e,t){switch(t.tagID){case i.HTML:{V(e,t);break}case i.NOFRAMES:{he(e,t);break}default:}}function Xd(e,t){t.chars=M,e._insertCharacters(t)}function Zd(e,t){e._insertCharacters(t),e.framesetOk=!1}function _i(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==b.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function zd(e,t){if(ai(t))_i(e),e._startTagOutsideForeignContent(t);else{let r=e._getAdjustedCurrentElement(),n=e.treeAdapter.getNamespaceURI(r);n===b.MATHML?fn(t):n===b.SVG&&(oi(t),En(t)),hr(t),t.selfClosing?e._appendElement(t,n):e._insertElement(t,n),t.ackSelfClosing=!0}}function qd(e,t){if(t.tagID===i.P||t.tagID===i.BR){_i(e),e._endTagOutsideForeignContent(t);return}for(let r=e.openElements.stackTop;r>0;r--){let n=e.openElements.items[r];if(e.treeAdapter.getNamespaceURI(n)===b.HTML){e._endTagOutsideForeignContent(t);break}let s=e.treeAdapter.getTagName(n);if(s.toLowerCase()===t.tagName){t.tagName=s,e.openElements.shortenToLength(r);break}}}var jg=new Set([E.AREA,E.BASE,E.BASEFONT,E.BGSOUND,E.BR,E.COL,E.EMBED,E.FRAME,E.HR,E.IMG,E.INPUT,E.KEYGEN,E.LINK,E.META,E.PARAM,E.SOURCE,E.TRACK,E.WBR]);function Ri(e,t){return Rt.parse(e,t)}function ce(e,t){return e.attrs?.find(r=>r.name.toLowerCase()===t.toLowerCase())?.value??null}function xn(e){return e.nodeName==="#text"?e.value??"":(e.childNodes??[]).map(xn).join("")}function xe(e){return e?.replace(/\s+/g," ").trim()||null}function Sn(e){let t=Ri(e),r={title:null,description:null,canonical:null,robots:null,lang:null,h1Count:0,openGraph:{title:null,description:null,image:null},twitter:{card:null,title:null,description:null,image:null},hreflang:[],jsonLd:[],images:[],links:[],wordCount:0,visibleText:""},n=[];function s(a,c=!1){let l=a.tagName?.toLowerCase(),o=c||l==="script"||l==="style"||l==="noscript"||l==="template";if(a.nodeName==="#text"&&!o){let d=xe(a.value);d&&n.push(d)}if(l==="html"&&r.lang===null&&(r.lang=xe(ce(a,"lang"))),l==="title"&&r.title===null&&(r.title=xe(xn(a))),l==="h1"&&(r.h1Count+=1),l==="meta"){let d=ce(a,"name")?.toLowerCase(),p=ce(a,"property")?.toLowerCase(),h=xe(ce(a,"content"));d==="description"&&r.description===null?r.description=h:d==="robots"&&r.robots===null?r.robots=h:p==="og:title"&&r.openGraph.title===null?r.openGraph.title=h:p==="og:description"&&r.openGraph.description===null?r.openGraph.description=h:p==="og:image"&&r.openGraph.image===null?r.openGraph.image=h:d==="twitter:card"&&r.twitter.card===null?r.twitter.card=h:d==="twitter:title"&&r.twitter.title===null?r.twitter.title=h:d==="twitter:description"&&r.twitter.description===null?r.twitter.description=h:d==="twitter:image"&&r.twitter.image===null&&(r.twitter.image=h)}if(l==="link"){let d=ce(a,"rel")?.toLowerCase().split(/\s+/).filter(Boolean)??[];if(d.includes("canonical")&&r.canonical===null&&(r.canonical=xe(ce(a,"href"))),d.includes("alternate")){let p=xe(ce(a,"hreflang")),h=xe(ce(a,"href"));p&&h&&r.hreflang.push({lang:p,url:h})}}if(l==="a"){let d=ce(a,"href");d&&r.links.push(d)}if(l==="img"&&r.images.push({src:xe(ce(a,"src")),alt:ce(a,"alt")}),l==="script"&&ce(a,"type")?.toLowerCase()==="application/ld+json"){let d=xn(a).trim();if(d)try{r.jsonLd.push({valid:!0,value:JSON.parse(d)})}catch(p){r.jsonLd.push({valid:!1,error:p instanceof Error?p.message:String(p)})}}for(let d of a.childNodes??[])s(d,o)}return s(t),r.visibleText=n.join(" "),r.wordCount=r.visibleText?r.visibleText.split(/\s+/u).length:0,r}function eu(e,t){return{url:e,finalUrl:null,status:null,contentType:null,blockedByRobots:!1,error:null,title:null,description:null,canonical:null,canonicalRaw:null,robots:null,xRobotsTag:null,lang:null,h1Count:0,openGraph:{title:null,description:null,image:null},twitter:{card:null,title:null,description:null,image:null},hreflang:[],jsonLd:[],images:[],links:[],internalLinks:[],externalLinks:[],wordCount:0,contentHash:null,depth:t,redirectChain:[],responseBytes:0}}async function et(e,t){await e.onEvent?.(t)}async function tu(e,t,r,n,s){let a=eu(e,t);if(n.respectRobots&&!ls(e,s))return a.blockedByRobots=!0,a;try{if(n.renderer){n.signal?.throwIfAborted(),await n.requestGate(e);let N=await n.renderer.render({url:e,timeout:n.timeout,maxResponseBytes:n.maxResponseBytes,userAgent:n.userAgent,...n.signal?{signal:n.signal}:{}});return ru(a,N,e,r,n.includeQuery)}let{response:c,redirectChain:l}=await Oe(e,{headers:{accept:"text/html,application/xhtml+xml;q=0.9,*/*;q=0.1","user-agent":n.userAgent}},{...n,gate:n.requestGate,onEvent:n.onEvent}),o=c.headers.get("content-type")??"",d=o.includes("text/html")||o.includes("application/xhtml+xml"),p=Y(c.url,void 0,{includeQuery:n.includeQuery});if(a.finalUrl=p,a.status=c.status,a.contentType=o||null,a.xRobotsTag=c.headers.get("x-robots-tag"),a.redirectChain=l,!d)return await c.body?.cancel(),a;let{text:h,bytes:f}=await ve(c,n.maxResponseBytes),m=Sn(h),y=p??e,w=m.canonical?Y(m.canonical,y,{includeQuery:!0}):null,I=[...new Set(m.links.map(N=>Y(N,y,{includeQuery:n.includeQuery})).filter(N=>!!N))].sort(),_=m.hreflang.map(N=>({lang:N.lang,url:Y(N.url,y,{includeQuery:!0})}));return Object.assign(a,{...m,visibleText:void 0,canonical:w,canonicalRaw:m.canonical,links:I,internalLinks:I.filter(N=>de(N,r)),externalLinks:I.filter(N=>!de(N,r)),hreflang:_,contentHash:m.visibleText?Li("sha256").update(m.visibleText.toLowerCase()).digest("hex"):null,responseBytes:f}),a}catch(c){if(n.signal?.aborted)throw c;return a.error=c instanceof Error?c.message:String(c),c instanceof fe&&(a.redirectChain=c.redirectChain),a}}function ru(e,t,r,n,s){let a=t.headers["content-type"]??"text/html",c=Y(t.finalUrl,void 0,{includeQuery:s});if(e.finalUrl=c,e.status=t.status,e.contentType=a,e.xRobotsTag=t.headers["x-robots-tag"]??null,e.redirectChain=t.redirectChain,!a.includes("text/html")&&!a.includes("application/xhtml+xml"))return e;let l=Sn(t.html),o=c??r,d=l.canonical?Y(l.canonical,o,{includeQuery:!0}):null,p=[...new Set(l.links.map(h=>Y(h,o,{includeQuery:s})).filter(h=>!!h))].sort();return Object.assign(e,{...l,visibleText:void 0,canonical:d,canonicalRaw:l.canonical,links:p,internalLinks:p.filter(h=>de(h,n)),externalLinks:p.filter(h=>!de(h,n)),hreflang:l.hreflang.map(h=>({lang:h.lang,url:Y(h.url,o,{includeQuery:!0})})),contentHash:l.visibleText?Li("sha256").update(l.visibleText.toLowerCase()).digest("hex"):null,responseBytes:t.responseBytes}),e}function nu(e={}){let t=e.requestDelay??e.delay??100,r=e.requestGate;return{...e,maxPages:e.maxPages??100,concurrency:Math.max(1,e.concurrency??5),timeout:e.timeout??1e4,includeQuery:e.includeQuery??!1,respectRobots:e.respectRobots??!0,sitemap:e.sitemap??null,sitemapData:e.sitemapData??null,userAgent:e.userAgent??_e,requestDelay:t,requestGate:r?async n=>r(n):Ge(t),maxRedirects:e.maxRedirects??10,maxResponseBytes:e.maxResponseBytes??5*1024*1024,retries:e.retries??2,fetch:e.fetch??globalThis.fetch,logger:e.logger??Wt}}async function su(e,t){let r=[],n=Array.from({length:e},async()=>{for(;;){let s=await t();if(s===null)return;r.push(s)}});return await Promise.all(n),r}async function Oi(e,t={}){let r=Date.now(),n=nu(t),s=Y(e,void 0,{includeQuery:n.includeQuery});if(!s)throw new Error(`invalid start URL: ${e}`);let a=new URL(s).origin;await et(n,{type:"scan-start",url:s,total:n.maxPages});let c=t.robots??await Kt(s,n),l=n.sitemapData;if(!l&&n.sitemap)try{l=await nr(n.sitemap,{...n,maxUrls:t.sitemapMaxUrls??5e4,siteOrigin:a})}catch(L){l={url:n.sitemap,urls:[],sitemapCount:0,truncated:!1,error:L instanceof Error?L.message:String(L)},n.logger.warn(`Could not load sitemap ${n.sitemap}: ${l.error}`)}let d=[...new Set([s,...l?.urls??[]])].slice(0,n.maxPages).map(L=>({url:L,depth:0})),p=new Set(d.map(L=>L.url)),h=new Map((t.cachedPages??[]).map(L=>[L.url,L])),f=new Map,m=Math.max(n.maxPages*10,n.maxPages),y=!1;for(;d.length>0&&f.size<n.maxPages&&!n.signal?.aborted;){d.sort((x,D)=>x.url.localeCompare(D.url));let L=n.maxPages-f.size,B=d.slice(0,L);d.length>B.length&&(y=!0);let R=0,P=await su(n.concurrency,async()=>{if(n.signal?.aborted||R>=B.length)return null;let x=B[R++];if(!x)return null;let D=h.get(x.url);if(!D)try{D=await tu(x.url,x.depth,a,n,c)}catch(F){if(n.signal?.aborted)return null;throw F}return f.set(x.url,D),h.has(x.url)||(await t.onBatch?.([D]),await n.storage?.saveCheckpoint?.(s,D),await et(n,{type:"checkpoint",page:D,completed:f.size,total:n.maxPages})),t.onProgress?.(f.size,n.maxPages),await et(n,{type:"page",completed:f.size,total:n.maxPages,page:D}),await et(n,{type:"progress",completed:f.size,total:n.maxPages,page:D}),{item:x,page:D}}),G=new Map;for(let{item:x,page:D}of P.sort((F,$)=>F.item.url.localeCompare($.item.url))){let F=D.internalLinks?.length?D.internalLinks:(D.links??[]).filter($=>de($,a));for(let $ of[...F].sort())p.size>=m||p.has($)||!tr($)||(p.add($),G.set($,{url:$,depth:x.depth+1}))}d=[...G.values()]}let w=[...f.values()].sort((L,B)=>L.url.localeCompare(B.url)),I=!!n.signal?.aborted,_=I||y||d.length>0||(l?l.urls.length>w.length:!1)||(l?.truncated??!1),N={startUrl:s,pages:w,robots:c,sitemap:l,truncated:_,partial:I,durationMs:Date.now()-r,options:n};return N.snapshot=Ie(N),I||await n.storage?.removeCheckpoint?.(s),I?await et(n,{type:"cancelled",completed:w.length,total:n.maxPages,partial:!0}):await et(n,{type:"complete",completed:w.length,total:n.maxPages}),N}function vi(e){return"planVersion"in e}function iu(e,t){return{schemaVersion:2,pageSchemaVersion:1,siteUrl:e.startUrl,sitemapUrl:e.sitemap?.url??null,includeQuery:e.config.includeQuery,respectRobots:e.config.respectRobots,timeout:e.config.timeout,maxRedirects:e.config.maxRedirects,maxResponseBytes:e.config.maxResponseBytes,userAgent:e.userAgent,...t?{rendererId:t}:{}}}function au(e){return!e.error&&(e.status===null||e.status<500)}async function tt(e,t={}){let r=null,n=null,s;try{s=vi(e)?e:await ue(e,{...t,async onEvent(m){m.type==="robots"&&(r=m.robots),m.type==="sitemap"&&(n=m.sitemap),await t.onEvent?.(m)}})}catch(m){if(vi(e)||!t.signal?.aborted)throw m;let y=Te(e),w=Y(y.url,void 0,{includeQuery:y.includeQuery});if(!w)throw new Error(`invalid start URL: ${y.url}`,{cause:m});let I=r??{url:new URL("/robots.txt",w).href,status:null,sha256:null,error:"Scan cancelled before robots.txt planning completed",denyAll:!1},_=Ie({startUrl:w,pages:[],robots:I,sitemap:n,options:y,partial:!0,truncated:!0});return await t.checkpointStore?.flush?.(),await t.onEvent?.({type:"cancelled",completed:0,total:y.maxPages,partial:!0}),{snapshot:_,startUrl:w,pages:[],robots:I,sitemap:n,truncated:!0,partial:!0,durationMs:0,options:y}}if(s.planVersion!==1)throw new Error(`unsupported scan plan version: ${String(s.planVersion)}`);let a=t.limit??s.config.maxPages;if(!Number.isInteger(a)||a<=0)throw new Error("scan limit must be a positive integer");let c={...s.config,maxPages:a},l=Ge(c.delay),o=iu(s,t.renderer?.id),d=t.checkpointStore&&t.resume!==!1?await t.checkpointStore.load(o):null,p=[...t.cachedPages??[],...d?.pages.filter(au)??[]],h=[...new Map(p.map(m=>[m.url,m])).values()];h.length>0&&await t.onEvent?.({type:"resume",completed:h.length,total:a});let f=await Oi(s.startUrl,{...t,maxPages:a,concurrency:c.concurrency,requestDelay:c.delay,timeout:c.timeout,respectRobots:c.respectRobots,includeQuery:c.includeQuery,maxRedirects:c.maxRedirects,maxResponseBytes:c.maxResponseBytes,enabledRules:c.enabledRules,severityOverrides:c.severityOverrides,suppressions:c.suppressions,regressionBudgets:c.regressionBudgets,report:c.report,requestGate:l,robots:s.robots,sitemap:s.sitemap?.url??null,sitemapData:s.sitemap,userAgent:s.userAgent,cachedPages:h,async onBatch(m){for(let y of m)await t.checkpointStore?.append(o,y);await t.onBatch?.(m)}});return await t.checkpointStore?.flush?.(),!f.partial&&!t.retainCheckpoint&&await t.checkpointStore?.clear(o),f}function Di(e){return/^\d+$/.test(e)?":id":/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)?":uuid":/^\d{4}-\d{2}-\d{2}$/.test(e)?":date":/^[0-9a-f]{16,}$/i.test(e)?":hash":null}function ou(e){return e.flatMap(t=>{try{let r=new URL(t.url);return[{issue:t,url:r,segments:r.pathname.split("/").filter(Boolean)}]}catch{return[]}})}function cu(e){let t=new Map;for(let r of e)for(let n=1;n<r.segments.length;n+=1){if(Di(r.segments[n]))continue;let s=r.segments.slice(0,n).join("/"),a=`${r.url.origin}|${r.segments.length}|${n}|${s}`,c=t.get(a)??new Set;c.add(r.segments[n]),t.set(a,c)}return new Set([...t].filter(([,r])=>r.size>=2).map(([r])=>r))}function lu(e,t){let r=e.segments.map((n,s)=>{let a=Di(n);if(a)return a;let c=e.segments.slice(0,s).join("/"),l=`${e.url.origin}|${e.segments.length}|${s}|${c}`;return s>0&&t.has(l)?":slug":n});return`/${r.join("/")}${e.url.pathname.endsWith("/")&&r.length>0?"/":""}`}function vt(e){return Ir(e.map(t=>({url:t,ruleId:"",severity:"info",owner:"seo"}))).map(({origin:t,template:r,urls:n})=>({origin:t,template:r,urls:n}))}function Ir(e){let t=ou(e),r=cu(t),n=new Map;for(let s of t){let a=lu(s,r),c=`${s.url.origin}${a}`,l=n.get(c)??{origin:s.url.origin,template:a,issues:[],urls:new Set};l.issues.push(s.issue),l.urls.add(s.issue.url),n.set(c,l)}return[...n.values()].map(s=>{let a={error:0,warning:0,info:0},c={},l={};for(let d of s.issues)a[d.severity]+=1,c[d.ruleId]=(c[d.ruleId]??0)+1,l[d.owner]=(l[d.owner]??0)+1;let o=[...s.urls].sort();return{origin:s.origin,template:s.template,issueCount:s.issues.length,affectedPages:o.length,severities:a,rules:c,owners:l,urls:o,representativeUrls:o.slice(0,3)}}).sort((s,a)=>a.issueCount-s.issueCount||s.template.localeCompare(a.template)||s.origin.localeCompare(a.origin))}function ki(e){let t=e.replaceAll("-"," ");return t.charAt(0).toUpperCase()+t.slice(1)}var du={"page-unreachable":"\u041D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0430 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0430","http-error":"HTTP-\u043F\u043E\u043C\u0438\u043B\u043A\u0430",noindex:"Noindex","x-robots-noindex":"Noindex \u0443 X-Robots-Tag","robots-blocked":"\u0417\u0430\u0431\u043B\u043E\u043A\u043E\u0432\u0430\u043D\u043E robots.txt","missing-canonical":"\u0412\u0456\u0434\u0441\u0443\u0442\u043D\u0456\u0439 canonical","invalid-canonical":"\u041D\u0435\u043A\u043E\u0440\u0435\u043A\u0442\u043D\u0438\u0439 canonical","cross-domain-canonical":"Canonical \u043D\u0430 \u0456\u043D\u0448\u043E\u043C\u0443 \u0434\u043E\u043C\u0435\u043D\u0456","canonical-target-error":"\u041F\u043E\u043C\u0438\u043B\u043A\u0430 \u0446\u0456\u043B\u0456 canonical","redirect-loop":"\u0426\u0438\u043A\u043B \u043F\u0435\u0440\u0435\u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u044C","long-redirect-chain":"\u0414\u043E\u0432\u0433\u0438\u0439 \u043B\u0430\u043D\u0446\u044E\u0436\u043E\u043A \u043F\u0435\u0440\u0435\u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u044C","sitemap-unavailable":"Sitemap \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0438\u0439","noindex-in-sitemap":"Noindex \u0443 sitemap","redirect-in-sitemap":"\u041F\u0435\u0440\u0435\u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u043D\u044F \u0443 sitemap","missing-title":"\u0412\u0456\u0434\u0441\u0443\u0442\u043D\u0456\u0439 title","duplicate-title":"\u0414\u0443\u0431\u043B\u044C\u043E\u0432\u0430\u043D\u0438\u0439 title","title-length":"\u0414\u043E\u0432\u0436\u0438\u043D\u0430 title","missing-description":"\u0412\u0456\u0434\u0441\u0443\u0442\u043D\u0456\u0439 description","duplicate-description":"\u0414\u0443\u0431\u043B\u044C\u043E\u0432\u0430\u043D\u0438\u0439 description","description-length":"\u0414\u043E\u0432\u0436\u0438\u043D\u0430 description","missing-h1":"\u0412\u0456\u0434\u0441\u0443\u0442\u043D\u0456\u0439 H1","broken-internal-link":"\u041D\u0435\u0440\u043E\u0431\u043E\u0447\u0435 \u0432\u043D\u0443\u0442\u0440\u0456\u0448\u043D\u0454 \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F","orphan-sitemap-page":"\u0406\u0437\u043E\u043B\u044C\u043E\u0432\u0430\u043D\u0430 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0430 sitemap","crawlable-not-in-sitemap":"\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u0432\u0456\u0434\u0441\u0443\u0442\u043D\u044F \u0443 sitemap","invalid-hreflang":"\u041D\u0435\u043A\u043E\u0440\u0435\u043A\u0442\u043D\u0438\u0439 hreflang","malformed-json-ld":"\u041D\u0435\u043A\u043E\u0440\u0435\u043A\u0442\u043D\u0438\u0439 JSON-LD","http-on-https-site":"HTTP URL \u043D\u0430 HTTPS-\u0441\u0430\u0439\u0442\u0456","invalid-language":"\u041D\u0435\u043A\u043E\u0440\u0435\u043A\u0442\u043D\u0435 \u043E\u0433\u043E\u043B\u043E\u0448\u0435\u043D\u043D\u044F \u043C\u043E\u0432\u0438","duplicate-content":"\u0414\u0443\u0431\u043B\u044C\u043E\u0432\u0430\u043D\u0438\u0439 \u043A\u043E\u043D\u0442\u0435\u043D\u0442","multiple-h1":"\u041A\u0456\u043B\u044C\u043A\u0430 H1","missing-open-graph":"\u041D\u0435\u043F\u043E\u0432\u043D\u0456 Open Graph metadata","missing-twitter-metadata":"\u041D\u0435\u043F\u043E\u0432\u043D\u0456 Twitter metadata","image-missing-alt":"\u0417\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u043D\u044F \u0431\u0435\u0437 alt","low-word-count":"\u041C\u0430\u043B\u043E \u0442\u0435\u043A\u0441\u0442\u0443","robots-changed":"robots.txt \u0437\u043C\u0456\u043D\u0435\u043D\u043E","page-missing":"\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0443 \u043D\u0435 \u043F\u0435\u0440\u0435\u0432\u0456\u0440\u0435\u043D\u043E","status-regression":"\u0420\u0435\u0433\u0440\u0435\u0441\u0456\u044F HTTP-\u0441\u0442\u0430\u0442\u0443\u0441\u0443","new-noindex":"\u041D\u043E\u0432\u0438\u0439 noindex","title-removed":"Title \u0432\u0438\u0434\u0430\u043B\u0435\u043D\u043E","title-changed":"Title \u0437\u043C\u0456\u043D\u0435\u043D\u043E","description-removed":"Description \u0432\u0438\u0434\u0430\u043B\u0435\u043D\u043E","canonical-removed":"Canonical \u0432\u0438\u0434\u0430\u043B\u0435\u043D\u043E","canonical-changed":"Canonical \u0437\u043C\u0456\u043D\u0435\u043D\u043E","h1-removed":"H1 \u0432\u0438\u0434\u0430\u043B\u0435\u043D\u043E","redirect-changed":"\u041F\u0435\u0440\u0435\u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u043D\u044F \u0437\u043C\u0456\u043D\u0435\u043D\u043E","sitemap-url-count-drop":"\u0417\u043C\u0435\u043D\u0448\u0435\u043D\u043D\u044F URL \u0443 sitemap"},uu={"page-unreachable":"\u0412\u0456\u0434\u043D\u043E\u0432\u0456\u0442\u044C \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0443 \u0430\u0431\u043E \u043F\u0440\u0438\u0431\u0435\u0440\u0456\u0442\u044C \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F \u043D\u0430 \u043D\u0435\u0457.","http-error":"\u041F\u043E\u0432\u0435\u0440\u043D\u0456\u0442\u044C \u0443\u0441\u043F\u0456\u0448\u043D\u0443 \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u044C \u0430\u0431\u043E \u0441\u0432\u0456\u0434\u043E\u043C\u0435 \u043F\u0435\u0440\u0435\u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u043D\u044F.",noindex:"\u041F\u0440\u0438\u0431\u0435\u0440\u0456\u0442\u044C noindex, \u044F\u043A\u0449\u043E \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u043C\u0430\u0454 \u0437\u2019\u044F\u0432\u043B\u044F\u0442\u0438\u0441\u044F \u0432 \u043F\u043E\u0448\u0443\u043A\u0443.","x-robots-noindex":"\u041F\u0440\u0438\u0431\u0435\u0440\u0456\u0442\u044C noindex \u0456\u0437 X-Robots-Tag, \u044F\u043A\u0449\u043E \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u043C\u0430\u0454 \u0456\u043D\u0434\u0435\u043A\u0441\u0443\u0432\u0430\u0442\u0438\u0441\u044F.","robots-blocked":"\u0414\u043E\u0437\u0432\u043E\u043B\u044C\u0442\u0435 URL \u0443 robots.txt, \u044F\u043A\u0449\u043E \u0439\u043E\u0433\u043E \u043F\u043E\u0442\u0440\u0456\u0431\u043D\u043E \u0441\u043A\u0430\u043D\u0443\u0432\u0430\u0442\u0438.","missing-canonical":"\u0412\u043A\u0430\u0436\u0456\u0442\u044C \u0431\u0430\u0436\u0430\u043D\u0438\u0439 canonical URL, \u044F\u043A\u0449\u043E \u043C\u043E\u0436\u043B\u0438\u0432\u0456 \u0434\u0443\u0431\u043B\u0456\u043A\u0430\u0442\u0438 \u0430\u0434\u0440\u0435\u0441\u0438.","invalid-canonical":"\u0412\u0438\u043A\u043E\u0440\u0438\u0441\u0442\u0430\u0439\u0442\u0435 \u0430\u0431\u0441\u043E\u043B\u044E\u0442\u043D\u0438\u0439 \u0430\u0431\u043E \u043A\u043E\u0440\u0435\u043A\u0442\u043D\u0438\u0439 \u0432\u0456\u0434\u043D\u043E\u0441\u043D\u0438\u0439 HTTP(S) canonical URL.","cross-domain-canonical":"\u041F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u044C\u0442\u0435 \u0437\u043E\u0432\u043D\u0456\u0448\u043D\u0456\u0439 canonical \u0430\u0431\u043E \u0432\u043A\u0430\u0436\u0456\u0442\u044C \u043F\u043E\u0442\u0440\u0456\u0431\u043D\u0438\u0439 URL \u0446\u044C\u043E\u0433\u043E \u0441\u0430\u0439\u0442\u0443.","canonical-target-error":"\u0421\u043F\u0440\u044F\u043C\u0443\u0439\u0442\u0435 canonical \u043D\u0430 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0438\u0439 URL, \u0434\u043E\u0437\u0432\u043E\u043B\u0435\u043D\u0438\u0439 \u0434\u043B\u044F \u0456\u043D\u0434\u0435\u043A\u0441\u0430\u0446\u0456\u0457.","redirect-loop":"\u041F\u0440\u0438\u0431\u0435\u0440\u0456\u0442\u044C \u0446\u0438\u043A\u043B\u0456\u0447\u043D\u0438\u0439 \u043C\u0430\u0440\u0448\u0440\u0443\u0442 \u043F\u0435\u0440\u0435\u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u044C.","long-redirect-chain":"\u041F\u0435\u0440\u0435\u043D\u0430\u043F\u0440\u0430\u0432\u043B\u044F\u0439\u0442\u0435 \u043E\u0434\u0440\u0430\u0437\u0443 \u043D\u0430 \u043A\u0456\u043D\u0446\u0435\u0432\u0443 \u0430\u0434\u0440\u0435\u0441\u0443.","sitemap-unavailable":"\u0412\u0456\u0434\u043D\u043E\u0432\u0456\u0442\u044C \u043A\u043E\u0440\u0435\u043A\u0442\u043D\u0438\u0439 \u0456 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0438\u0439 XML sitemap.","noindex-in-sitemap":"\u041F\u0440\u0438\u0431\u0435\u0440\u0456\u0442\u044C URL \u0456\u0437 sitemap \u0430\u0431\u043E \u0434\u043E\u0437\u0432\u043E\u043B\u044C\u0442\u0435 \u0439\u043E\u0433\u043E \u0456\u043D\u0434\u0435\u043A\u0441\u0430\u0446\u0456\u044E.","redirect-in-sitemap":"\u0417\u0430\u043C\u0456\u043D\u0456\u0442\u044C URL \u0443 sitemap \u043D\u0430 \u0439\u043E\u0433\u043E \u043A\u0456\u043D\u0446\u0435\u0432\u0443 canonical-\u0430\u0434\u0440\u0435\u0441\u0443.","missing-title":"\u0414\u043E\u0434\u0430\u0439\u0442\u0435 \u0443\u043D\u0456\u043A\u0430\u043B\u044C\u043D\u0438\u0439 \u043E\u043F\u0438\u0441\u043E\u0432\u0438\u0439 HTML title.","duplicate-title":"\u041D\u0430\u043F\u0438\u0448\u0456\u0442\u044C title, \u044F\u043A\u0438\u0439 \u0443\u043D\u0456\u043A\u0430\u043B\u044C\u043D\u043E \u043E\u043F\u0438\u0441\u0443\u0454 \u0446\u044E \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0443.","title-length":"\u0417\u0440\u043E\u0431\u0456\u0442\u044C title \u0441\u0442\u0438\u0441\u043B\u0438\u043C \u0456 \u0437\u043C\u0456\u0441\u0442\u043E\u0432\u043D\u0438\u043C, \u0437\u0430\u0437\u0432\u0438\u0447\u0430\u0439 10\u201360 \u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432.","missing-description":"\u0414\u043E\u0434\u0430\u0439\u0442\u0435 \u043A\u043E\u0440\u0438\u0441\u043D\u0438\u0439 meta description.","duplicate-description":"\u041D\u0430\u043F\u0438\u0448\u0456\u0442\u044C \u0443\u043D\u0456\u043A\u0430\u043B\u044C\u043D\u0438\u0439 meta description \u0434\u043B\u044F \u0446\u0456\u0454\u0457 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0438.","description-length":"\u0417\u0440\u043E\u0431\u0456\u0442\u044C description \u043A\u043E\u0440\u0438\u0441\u043D\u0438\u043C \u0456 \u0437\u0430\u0437\u0432\u0438\u0447\u0430\u0439 \u0434\u043E\u0432\u0436\u0438\u043D\u043E\u044E 50\u2013160 \u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432.","missing-h1":"\u0414\u043E\u0434\u0430\u0439\u0442\u0435 \u043E\u0434\u0438\u043D \u0437\u0440\u043E\u0437\u0443\u043C\u0456\u043B\u0438\u0439 \u043E\u0441\u043D\u043E\u0432\u043D\u0438\u0439 \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A.","broken-internal-link":"\u041E\u043D\u043E\u0432\u0456\u0442\u044C \u0430\u0431\u043E \u043F\u0440\u0438\u0431\u0435\u0440\u0456\u0442\u044C \u0432\u043D\u0443\u0442\u0440\u0456\u0448\u043D\u0454 \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F \u0447\u0438 \u0432\u0456\u0434\u043D\u043E\u0432\u0456\u0442\u044C \u0439\u043E\u0433\u043E \u0446\u0456\u043B\u044C.","orphan-sitemap-page":"\u0414\u043E\u0434\u0430\u0439\u0442\u0435 \u0437\u043C\u0456\u0441\u0442\u043E\u0432\u043D\u0456 \u0432\u043D\u0443\u0442\u0440\u0456\u0448\u043D\u0456 \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F \u043D\u0430 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0443 \u0456\u0437 sitemap.","crawlable-not-in-sitemap":"\u0414\u043E\u0434\u0430\u0439\u0442\u0435 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0443 \u0434\u043E sitemap \u0430\u0431\u043E \u0441\u0432\u0456\u0434\u043E\u043C\u043E \u0432\u0438\u043A\u043B\u044E\u0447\u0456\u0442\u044C \u0457\u0457.","invalid-hreflang":"\u0412\u0438\u043A\u043E\u0440\u0438\u0441\u0442\u0430\u0439\u0442\u0435 \u043A\u043E\u0440\u0435\u043A\u0442\u043D\u0456 \u043C\u043E\u0432\u043D\u0456 \u0442\u0435\u0433\u0438 \u0442\u0430 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0456 HTTP(S) alternate URL.","malformed-json-ld":"\u0412\u0438\u043F\u0440\u0430\u0432\u0442\u0435 JSON-\u0441\u0438\u043D\u0442\u0430\u043A\u0441\u0438\u0441 \u0443 \u0431\u043B\u043E\u0446\u0456 \u0441\u0442\u0440\u0443\u043A\u0442\u0443\u0440\u043E\u0432\u0430\u043D\u0438\u0445 \u0434\u0430\u043D\u0438\u0445.","http-on-https-site":"\u0412\u0438\u043A\u043E\u0440\u0438\u0441\u0442\u043E\u0432\u0443\u0439\u0442\u0435 HTTPS \u0434\u043B\u044F \u0432\u043D\u0443\u0442\u0440\u0456\u0448\u043D\u0456\u0445 URL \u0456 metadata.","invalid-language":"\u0412\u043A\u0430\u0436\u0456\u0442\u044C \u043A\u043E\u0440\u0435\u043A\u0442\u043D\u0438\u0439 \u043C\u043E\u0432\u043D\u0438\u0439 \u0442\u0435\u0433 BCP 47 \u0432 \u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456 html.","duplicate-content":"\u041E\u0431\u2019\u0454\u0434\u043D\u0430\u0439\u0442\u0435 \u0434\u0443\u0431\u043B\u044C\u043E\u0432\u0430\u043D\u0456 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0438 \u0430\u0431\u043E \u0437\u0440\u043E\u0431\u0456\u0442\u044C \u0457\u0445\u043D\u0456\u0439 \u043E\u0441\u043D\u043E\u0432\u043D\u0438\u0439 \u043A\u043E\u043D\u0442\u0435\u043D\u0442 \u0432\u0456\u0434\u043C\u0456\u043D\u043D\u0438\u043C.","multiple-h1":"\u041F\u0435\u0440\u0435\u0432\u0456\u0440\u0442\u0435, \u0447\u0438 \u043E\u0434\u0438\u043D \u043E\u0441\u043D\u043E\u0432\u043D\u0438\u0439 H1 \u043D\u0435 \u0437\u0440\u043E\u0431\u0438\u0442\u044C \u0456\u0454\u0440\u0430\u0440\u0445\u0456\u044E \u0437\u0440\u043E\u0437\u0443\u043C\u0456\u043B\u0456\u0448\u043E\u044E.","missing-open-graph":"\u0414\u043E\u0434\u0430\u0439\u0442\u0435 Open Graph title, description \u0442\u0430 image \u0434\u043B\u044F \u043F\u043E\u0448\u0438\u0440\u0435\u043D\u043D\u044F \u0432 \u0441\u043E\u0446\u043C\u0435\u0440\u0435\u0436\u0430\u0445.","missing-twitter-metadata":"\u0414\u043E\u0434\u0430\u0439\u0442\u0435 Twitter card metadata, \u044F\u043A\u0449\u043E \u0432\u0430\u0436\u043B\u0438\u0432\u0456 \u0441\u043E\u0446\u0456\u0430\u043B\u044C\u043D\u0456 \u043F\u0440\u0435\u0432\u2019\u044E.","image-missing-alt":"\u0414\u043E\u0434\u0430\u0439\u0442\u0435 \u0437\u043C\u0456\u0441\u0442\u043E\u0432\u043D\u0438\u0439 alt \u0430\u0431\u043E \u043F\u043E\u0440\u043E\u0436\u043D\u0456\u0439 alt \u0434\u043B\u044F \u0434\u0435\u043A\u043E\u0440\u0430\u0442\u0438\u0432\u043D\u0438\u0445 \u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u044C.","low-word-count":"\u041F\u0435\u0440\u0435\u0432\u0456\u0440\u0442\u0435, \u0447\u0438 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u043C\u0456\u0441\u0442\u0438\u0442\u044C \u0434\u043E\u0441\u0442\u0430\u0442\u043D\u044C\u043E \u043A\u043E\u0440\u0438\u0441\u043D\u043E\u0433\u043E \u043E\u0441\u043D\u043E\u0432\u043D\u043E\u0433\u043E \u043A\u043E\u043D\u0442\u0435\u043D\u0442\u0443.","robots-changed":"\u041F\u0435\u0440\u0435\u0432\u0456\u0440\u0442\u0435 \u0437\u043C\u0456\u043D\u0443 robots.txt \u0456 \u043F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u044C\u0442\u0435, \u0449\u043E \u0434\u043E\u0441\u0442\u0443\u043F \u0434\u043B\u044F \u0441\u043A\u0430\u043D\u0443\u0432\u0430\u043D\u043D\u044F \u0437\u043C\u0456\u043D\u0435\u043D\u043E \u0441\u0432\u0456\u0434\u043E\u043C\u043E.","page-missing":"\u0414\u043E\u0434\u0430\u0439\u0442\u0435 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0443 \u0434\u043E \u043F\u0435\u0440\u0435\u0432\u0456\u0440\u043A\u0438 \u0430\u0431\u043E \u043F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u044C\u0442\u0435, \u0449\u043E \u0457\u0457 \u0432\u0438\u0434\u0430\u043B\u0435\u043D\u043E \u0441\u0432\u0456\u0434\u043E\u043C\u043E.","status-regression":"\u0412\u0456\u0434\u043D\u043E\u0432\u0456\u0442\u044C \u043F\u043E\u043F\u0435\u0440\u0435\u0434\u043D\u044E \u0443\u0441\u043F\u0456\u0448\u043D\u0443 HTTP-\u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u044C.","new-noindex":"\u041F\u0440\u0438\u0431\u0435\u0440\u0456\u0442\u044C \u043D\u043E\u0432\u0438\u0439 noindex, \u044F\u043A\u0449\u043E \u0439\u043E\u0433\u043E \u043D\u0435 \u0434\u043E\u0434\u0430\u043D\u043E \u043D\u0430\u0432\u043C\u0438\u0441\u043D\u043E.","title-removed":"\u0412\u0456\u0434\u043D\u043E\u0432\u0456\u0442\u044C \u0437\u043C\u0456\u0441\u0442\u043E\u0432\u043D\u0438\u0439 title.","title-changed":"\u041F\u0435\u0440\u0435\u0432\u0456\u0440\u0442\u0435 \u0442\u0430 \u043F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u044C\u0442\u0435 \u0437\u043C\u0456\u043D\u0435\u043D\u0438\u0439 title.","description-removed":"\u0412\u0456\u0434\u043D\u043E\u0432\u0456\u0442\u044C \u043A\u043E\u0440\u0438\u0441\u043D\u0438\u0439 meta description.","canonical-removed":"\u0412\u0456\u0434\u043D\u043E\u0432\u0456\u0442\u044C canonical.","canonical-changed":"\u041F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u044C\u0442\u0435, \u0449\u043E \u043D\u043E\u0432\u0430 \u0446\u0456\u043B\u044C canonical \u0441\u0432\u0456\u0434\u043E\u043C\u0430 \u0439 \u043A\u043E\u0440\u0435\u043A\u0442\u043D\u0430.","h1-removed":"\u0412\u0456\u0434\u043D\u043E\u0432\u0456\u0442\u044C \u0437\u0440\u043E\u0437\u0443\u043C\u0456\u043B\u0438\u0439 \u043E\u0441\u043D\u043E\u0432\u043D\u0438\u0439 \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A.","redirect-changed":"\u041F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u044C\u0442\u0435, \u0449\u043E \u043D\u043E\u0432\u0430 \u0446\u0456\u043B\u044C \u043F\u0435\u0440\u0435\u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u043D\u044F \u0441\u0432\u0456\u0434\u043E\u043C\u0430.","sitemap-url-count-drop":"\u0414\u043E\u0441\u043B\u0456\u0434\u0456\u0442\u044C \u0432\u0442\u0440\u0430\u0442\u0443 URL \u0443 sitemap \u0456 \u043F\u043E\u0432\u0435\u0440\u043D\u0456\u0442\u044C \u043F\u0440\u043E\u043F\u0443\u0449\u0435\u043D\u0456 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0438 \u0434\u043B\u044F \u0456\u043D\u0434\u0435\u043A\u0441\u0430\u0446\u0456\u0457."};function Au(e){return e.evidence?.actual??e.after}function pu(e,t){let r=Au(e);switch(t){case"page-unreachable":case"redirect-loop":return`\u0417\u0430\u043F\u0438\u0442 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0432\u0441\u044F \u043F\u043E\u043C\u0438\u043B\u043A\u043E\u044E: ${String(r??"\u043D\u0435\u0432\u0456\u0434\u043E\u043C\u0430 \u043F\u043E\u043C\u0438\u043B\u043A\u0430")}`;case"http-error":return`\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u043F\u043E\u0432\u0435\u0440\u043D\u0443\u043B\u0430 HTTP ${String(r??"\u043D\u0435\u0432\u0456\u0434\u043E\u043C\u043E")}`;case"noindex":return"\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u043C\u0456\u0441\u0442\u0438\u0442\u044C \u0434\u0438\u0440\u0435\u043A\u0442\u0438\u0432\u0443 noindex \u0443 meta";case"x-robots-noindex":return"\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u043C\u0456\u0441\u0442\u0438\u0442\u044C noindex \u0443 X-Robots-Tag";case"robots-blocked":return e.before===!1?"\u0422\u0435\u043F\u0435\u0440 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0443 \u0437\u0430\u0431\u043B\u043E\u043A\u043E\u0432\u0430\u043D\u043E \u0447\u0435\u0440\u0435\u0437 robots.txt":"\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0443 \u0437\u0430\u0431\u043B\u043E\u043A\u043E\u0432\u0430\u043D\u043E \u0447\u0435\u0440\u0435\u0437 robots.txt";case"missing-canonical":return"\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u043D\u0435 \u043C\u0456\u0441\u0442\u0438\u0442\u044C canonical URL";case"invalid-canonical":return"Canonical URL \u043D\u0435\u043A\u043E\u0440\u0435\u043A\u0442\u043D\u0438\u0439";case"cross-domain-canonical":return"Canonical \u0432\u043A\u0430\u0437\u0443\u0454 \u043D\u0430 \u0456\u043D\u0448\u0438\u0439 \u0434\u043E\u043C\u0435\u043D";case"canonical-target-error":return"\u0426\u0456\u043B\u044C canonical \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0430";case"long-redirect-chain":return`\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u0432\u0438\u043A\u043E\u0440\u0438\u0441\u0442\u043E\u0432\u0443\u0454 ${String(r??0)} \u043F\u0435\u0440\u0435\u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u044C`;case"sitemap-unavailable":return"\u041D\u0435 \u0432\u0434\u0430\u043B\u043E\u0441\u044F \u0437\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0438\u0442\u0438 \u043D\u0430\u043B\u0430\u0448\u0442\u043E\u0432\u0430\u043D\u0438\u0439 sitemap";case"noindex-in-sitemap":return"URL \u0456\u0437 sitemap \u043F\u043E\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0439 noindex";case"redirect-in-sitemap":return"URL \u0456\u0437 sitemap \u043F\u0435\u0440\u0435\u043D\u0430\u043F\u0440\u0430\u0432\u043B\u044F\u0454\u0442\u044C\u0441\u044F";case"missing-title":return"\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u043D\u0435 \u043C\u0430\u0454 title";case"duplicate-title":return"\u041A\u0456\u043B\u044C\u043A\u0430 \u0441\u0442\u043E\u0440\u0456\u043D\u043E\u043A \u043C\u0430\u044E\u0442\u044C \u043E\u0434\u043D\u0430\u043A\u043E\u0432\u0438\u0439 title";case"title-length":return`\u0414\u043E\u0432\u0436\u0438\u043D\u0430 title \u2014 ${String(r??0)} \u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432`;case"missing-description":return"\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u043D\u0435 \u043C\u0430\u0454 meta description";case"duplicate-description":return"\u041A\u0456\u043B\u044C\u043A\u0430 \u0441\u0442\u043E\u0440\u0456\u043D\u043E\u043A \u043C\u0430\u044E\u0442\u044C \u043E\u0434\u043D\u0430\u043A\u043E\u0432\u0438\u0439 meta description";case"description-length":return`\u0414\u043E\u0432\u0436\u0438\u043D\u0430 description \u2014 ${String(r??0)} \u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432`;case"missing-h1":return"\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u043D\u0435 \u043C\u0456\u0441\u0442\u0438\u0442\u044C \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043A\u0430 H1";case"multiple-h1":return`\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u043C\u0456\u0441\u0442\u0438\u0442\u044C H1 \u0443 \u043A\u0456\u043B\u044C\u043A\u043E\u0441\u0442\u0456: ${String(r??0)}`;case"broken-internal-link":return"\u0412\u043D\u0443\u0442\u0440\u0456\u0448\u043D\u0454 \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F \u0432\u0435\u0434\u0435 \u043D\u0430 \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0443 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0443";case"orphan-sitemap-page":return"\u041D\u0430 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0443 \u0456\u0437 sitemap \u043D\u0435 \u0437\u043D\u0430\u0439\u0434\u0435\u043D\u043E \u0432\u043D\u0443\u0442\u0440\u0456\u0448\u043D\u0456\u0445 \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u044C";case"crawlable-not-in-sitemap":return"\u0414\u043E\u0441\u0442\u0443\u043F\u043D\u0430 \u0434\u043B\u044F \u0441\u043A\u0430\u043D\u0443\u0432\u0430\u043D\u043D\u044F \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u0432\u0456\u0434\u0441\u0443\u0442\u043D\u044F \u0443 sitemap";case"invalid-hreflang":return"\u041E\u0433\u043E\u043B\u043E\u0448\u0435\u043D\u043D\u044F hreflang \u043D\u0435\u043A\u043E\u0440\u0435\u043A\u0442\u043D\u0435";case"malformed-json-ld":return"\u0411\u043B\u043E\u043A JSON-LD \u043C\u0456\u0441\u0442\u0438\u0442\u044C \u043D\u0435\u043A\u043E\u0440\u0435\u043A\u0442\u043D\u0438\u0439 JSON";case"http-on-https-site":return"HTTPS-\u0441\u0430\u0439\u0442 \u043F\u043E\u0441\u0438\u043B\u0430\u0454\u0442\u044C\u0441\u044F \u043D\u0430 \u0432\u043D\u0443\u0442\u0440\u0456\u0448\u043D\u0456\u0439 HTTP URL";case"invalid-language":return"\u041E\u0433\u043E\u043B\u043E\u0448\u0435\u043D\u043D\u044F \u043C\u043E\u0432\u0438 HTML \u043D\u0435\u043A\u043E\u0440\u0435\u043A\u0442\u043D\u0435";case"duplicate-content":return"\u041E\u0441\u043D\u043E\u0432\u043D\u0438\u0439 \u0442\u0435\u043A\u0441\u0442 \u0454 \u0442\u043E\u0447\u043D\u0438\u043C \u0434\u0443\u0431\u043B\u0435\u043C \u0456\u043D\u0448\u043E\u0457 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0438";case"missing-open-graph":return"Open Graph metadata \u043D\u0435\u043F\u043E\u0432\u043D\u0456";case"missing-twitter-metadata":return"Twitter card metadata \u043D\u0435\u043F\u043E\u0432\u043D\u0456";case"image-missing-alt":return`${Array.isArray(r)?r.length:String(r??0)} \u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u044C \u043D\u0435 \u043C\u0430\u044E\u0442\u044C \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 alt`;case"low-word-count":return`\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u043C\u0456\u0441\u0442\u0438\u0442\u044C \u043F\u0440\u0438\u0431\u043B\u0438\u0437\u043D\u043E ${String(r??0)} \u0432\u0438\u0434\u0438\u043C\u0438\u0445 \u0441\u043B\u0456\u0432`;case"robots-changed":return"\u0412\u043C\u0456\u0441\u0442 robots.txt \u0437\u043C\u0456\u043D\u0438\u0432\u0441\u044F";case"page-missing":return"\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0443 \u043D\u0435 \u0431\u0443\u043B\u043E \u043F\u0435\u0440\u0435\u0432\u0456\u0440\u0435\u043D\u043E";case"status-regression":return`HTTP-\u0441\u0442\u0430\u0442\u0443\u0441 \u043F\u043E\u0433\u0456\u0440\u0448\u0438\u0432\u0441\u044F \u0437 ${String(e.before??"\u043D\u0435\u0432\u0456\u0434\u043E\u043C\u043E")} \u0434\u043E ${String(e.after??"\u0432\u0456\u0434\u0441\u0443\u0442\u043D\u0456\u0439")}`;case"new-noindex":return"\u0422\u0435\u043F\u0435\u0440 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u043C\u0456\u0441\u0442\u0438\u0442\u044C \u0434\u0438\u0440\u0435\u043A\u0442\u0438\u0432\u0443 noindex";case"title-removed":return"Title \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0438 \u0432\u0438\u0434\u0430\u043B\u0435\u043D\u043E";case"title-changed":return"Title \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0438 \u0437\u043C\u0456\u043D\u0435\u043D\u043E";case"description-removed":return"Meta description \u0432\u0438\u0434\u0430\u043B\u0435\u043D\u043E";case"canonical-removed":return"Canonical URL \u0432\u0438\u0434\u0430\u043B\u0435\u043D\u043E";case"canonical-changed":return"Canonical URL \u0437\u043C\u0456\u043D\u0435\u043D\u043E";case"h1-removed":return"\u0423\u0441\u0456 \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043A\u0438 H1 \u0432\u0438\u0434\u0430\u043B\u0435\u043D\u043E";case"redirect-changed":return"\u041A\u0456\u043D\u0446\u0435\u0432\u0438\u0439 URL \u043F\u0435\u0440\u0435\u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u043D\u044F \u0437\u043C\u0456\u043D\u0435\u043D\u043E";case"sitemap-url-count-drop":return`\u041A\u0456\u043B\u044C\u043A\u0456\u0441\u0442\u044C URL \u0443 sitemap \u0437\u043C\u0435\u043D\u0448\u0438\u043B\u0430\u0441\u044F \u043D\u0430 ${String((Number(e.before)||0)-(Number(e.after)||0))}`;default:return e.message??"\u041F\u0435\u0440\u0435\u0432\u0456\u0440\u0442\u0435 \u043F\u0440\u043E\u0431\u043B\u0435\u043C\u0443 \u0442\u0430 \u043F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u044C\u0442\u0435 \u043E\u0447\u0456\u043A\u0443\u0432\u0430\u043D\u0443 \u043F\u043E\u0432\u0435\u0434\u0456\u043D\u043A\u0443."}}function Bi(e,t){let r=e.remediation??"Review the finding and confirm the intended behavior.";return{en:{rule:ki(t),message:e.message??"",remediation:r},uk:{rule:du[t]??ki(t),message:pu(e,t),remediation:uu[t]??"\u041F\u0435\u0440\u0435\u0432\u0456\u0440\u0442\u0435 \u043F\u0440\u043E\u0431\u043B\u0435\u043C\u0443 \u0442\u0430 \u043F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u044C\u0442\u0435 \u043E\u0447\u0456\u043A\u0443\u0432\u0430\u043D\u0443 \u043F\u043E\u0432\u0435\u0434\u0456\u043D\u043A\u0443."}}}var Pi={en:{language:"Language",titles:{partial:"Partial SEO scan report",check:"SEO regression report",scan:"SEO baseline audit"},generated:"Generated",engine:"Engine",rules:"Rules",issueLifecycle:"Issue lifecycle",partialTitle:"Partial results.",partialMessage:"This report contains the pages saved so far. Run the same scan command again to resume without requesting them twice.",incompleteTitle:"Incomplete comparison.",incompleteMessage:"Regressions found on checked pages are shown, but unchecked pages are not marked missing or resolved.",previewTitle:"Preview deployment comparison.",production:"Production",preview:"Preview",cards:{pages:"Pages checked",error:"Errors",warning:"Warnings",info:"Info",affected:"Affected pages"},analytics:{title:"Issue statistics",hint:"Select a chart item to filter the issue table.",severity:"By severity",topRules:"Most frequent checks",owners:"By owner",lifecycle:"By lifecycle",templates:"Affected page templates",total:"Total issues",noData:"No issues to chart.",filterBy:"Filter by"},history:{title:"Local scan history",hint:"Issue trends from snapshots stored on this device.",chartLabel:"Issue trend across runs.",runs:"Runs",pages:"Latest pages",newIssues:"New issues",resolvedIssues:"Resolved issues",sitemapUrls:"Sitemap URLs",maxDepth:"Maximum crawl depth"},tabs:{current:"Current / all",new:"New",ongoing:"Ongoing",resolved:"Resolved",unchanged:"Unchanged"},filters:{search:"URL or text",searchPlaceholder:"URL, check, or message",severity:"Severity",rule:"Check",template:"Page template",owner:"Owner",rows:"Rows"},all:{severity:"All severities",rule:"All checks",template:"All templates",owner:"All owners"},severities:{error:"Error",warning:"Warning",info:"Info"},owners:{seo:"SEO",content:"Content",developer:"Developer"},rows:{100:"100 per page",250:"250 per page",500:"500 per page"},guide:{error:"Errors",errorText:"need attention first.",warning:"Warnings",warningText:"are important improvements.",info:"Info",infoText:"is useful context.",score:"No opaque SEO score is used."},exportCsv:"Export CSV",previous:"Previous",next:"Next",table:{severity:"Severity",lifecycle:"Lifecycle",ruleOwner:"Check / owner",page:"Page",finding:"What was found",change:"Change",before:"Before",evidence:"Evidence / after",remediation:"Remediation",fingerprint:"Fingerprint"},empty:{cleanTitle:"No SEO issues found",cleanMessage:"The scanned pages passed all current checks.",filteredTitle:"No matching issues",filteredMessage:"Try a different lifecycle tab or clear the selected filters.",clear:"Clear filters"},lifecycle:{current:"Current",new:"New",ongoing:"Ongoing",resolved:"Resolved",unchanged:"Unchanged"},notPresent:"Not present",page:"Page",of:"of",issue:"issue",issues:"issues",docs:"docs",footer:"Generated locally. No report data was uploaded."},uk:{language:"\u041C\u043E\u0432\u0430",titles:{partial:"\u0417\u0432\u0456\u0442 \u0447\u0430\u0441\u0442\u043A\u043E\u0432\u043E\u0433\u043E SEO-\u0441\u043A\u0430\u043D\u0443\u0432\u0430\u043D\u043D\u044F",check:"\u0417\u0432\u0456\u0442 \u043F\u0440\u043E SEO-\u0440\u0435\u0433\u0440\u0435\u0441\u0456\u0457",scan:"\u0411\u0430\u0437\u043E\u0432\u0438\u0439 SEO-\u0430\u0443\u0434\u0438\u0442"},generated:"\u0421\u0442\u0432\u043E\u0440\u0435\u043D\u043E",engine:"\u0420\u0443\u0448\u0456\u0439",rules:"\u041F\u0440\u0430\u0432\u0438\u043B\u0430",issueLifecycle:"\u0421\u0442\u0430\u043D\u0438 \u043F\u0440\u043E\u0431\u043B\u0435\u043C",partialTitle:"\u0427\u0430\u0441\u0442\u043A\u043E\u0432\u0456 \u0440\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442\u0438.",partialMessage:"\u0417\u0432\u0456\u0442 \u043C\u0456\u0441\u0442\u0438\u0442\u044C \u0443\u0436\u0435 \u0437\u0431\u0435\u0440\u0435\u0436\u0435\u043D\u0456 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0438. \u0417\u0430\u043F\u0443\u0441\u0442\u0456\u0442\u044C \u0442\u0443 \u0441\u0430\u043C\u0443 \u043A\u043E\u043C\u0430\u043D\u0434\u0443 \u0449\u0435 \u0440\u0430\u0437, \u0449\u043E\u0431 \u043F\u0440\u043E\u0434\u043E\u0432\u0436\u0438\u0442\u0438 \u0431\u0435\u0437 \u043F\u043E\u0432\u0442\u043E\u0440\u043D\u0438\u0445 \u0437\u0430\u043F\u0438\u0442\u0456\u0432.",incompleteTitle:"\u041D\u0435\u043F\u043E\u0432\u043D\u0435 \u043F\u043E\u0440\u0456\u0432\u043D\u044F\u043D\u043D\u044F.",incompleteMessage:"\u041F\u043E\u043A\u0430\u0437\u0430\u043D\u043E \u0440\u0435\u0433\u0440\u0435\u0441\u0456\u0457 \u043D\u0430 \u043F\u0435\u0440\u0435\u0432\u0456\u0440\u0435\u043D\u0438\u0445 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0430\u0445, \u0430\u043B\u0435 \u043D\u0435\u043F\u0435\u0440\u0435\u0432\u0456\u0440\u0435\u043D\u0456 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0438 \u043D\u0435 \u043F\u043E\u0437\u043D\u0430\u0447\u0435\u043D\u043E \u044F\u043A \u0432\u0456\u0434\u0441\u0443\u0442\u043D\u0456 \u0447\u0438 \u0432\u0438\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0456.",previewTitle:"\u041F\u043E\u0440\u0456\u0432\u043D\u044F\u043D\u043D\u044F production \u0456 preview.",production:"Production",preview:"Preview",cards:{pages:"\u041F\u0435\u0440\u0435\u0432\u0456\u0440\u0435\u043D\u043E \u0441\u0442\u043E\u0440\u0456\u043D\u043E\u043A",error:"\u041F\u043E\u043C\u0438\u043B\u043A\u0438",warning:"\u041F\u043E\u043F\u0435\u0440\u0435\u0434\u0436\u0435\u043D\u043D\u044F",info:"\u0406\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0456\u044F",affected:"\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0438 \u0437 \u043F\u0440\u043E\u0431\u043B\u0435\u043C\u0430\u043C\u0438"},analytics:{title:"\u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043A\u0430 \u043F\u0440\u043E\u0431\u043B\u0435\u043C",hint:"\u041E\u0431\u0435\u0440\u0456\u0442\u044C \u0435\u043B\u0435\u043C\u0435\u043D\u0442 \u0433\u0440\u0430\u0444\u0456\u043A\u0430, \u0449\u043E\u0431 \u0432\u0456\u0434\u0444\u0456\u043B\u044C\u0442\u0440\u0443\u0432\u0430\u0442\u0438 \u0442\u0430\u0431\u043B\u0438\u0446\u044E \u043F\u0440\u043E\u0431\u043B\u0435\u043C.",severity:"\u0417\u0430 \u0432\u0430\u0436\u043B\u0438\u0432\u0456\u0441\u0442\u044E",topRules:"\u041D\u0430\u0439\u0447\u0430\u0441\u0442\u0456\u0448\u0456 \u043F\u0435\u0440\u0435\u0432\u0456\u0440\u043A\u0438",owners:"\u0417\u0430 \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u043B\u044C\u043D\u0438\u043C\u0438",lifecycle:"\u0417\u0430 \u0441\u0442\u0430\u043D\u043E\u043C",templates:"\u0428\u0430\u0431\u043B\u043E\u043D\u0438 \u0441\u0442\u043E\u0440\u0456\u043D\u043E\u043A \u0456\u0437 \u043F\u0440\u043E\u0431\u043B\u0435\u043C\u0430\u043C\u0438",total:"\u0423\u0441\u044C\u043E\u0433\u043E \u043F\u0440\u043E\u0431\u043B\u0435\u043C",noData:"\u041D\u0435\u043C\u0430\u0454 \u043F\u0440\u043E\u0431\u043B\u0435\u043C \u0434\u043B\u044F \u0432\u0456\u0434\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u043D\u044F.",filterBy:"\u0424\u0456\u043B\u044C\u0442\u0440\u0443\u0432\u0430\u0442\u0438 \u0437\u0430"},history:{title:"\u041B\u043E\u043A\u0430\u043B\u044C\u043D\u0430 \u0456\u0441\u0442\u043E\u0440\u0456\u044F \u0441\u043A\u0430\u043D\u0443\u0432\u0430\u043D\u044C",hint:"\u0414\u0438\u043D\u0430\u043C\u0456\u043A\u0430 \u043F\u0440\u043E\u0431\u043B\u0435\u043C \u0437\u0456 snapshot-\u0444\u0430\u0439\u043B\u0456\u0432, \u0437\u0431\u0435\u0440\u0435\u0436\u0435\u043D\u0438\u0445 \u043D\u0430 \u0446\u044C\u043E\u043C\u0443 \u043F\u0440\u0438\u0441\u0442\u0440\u043E\u0457.",chartLabel:"\u0414\u0438\u043D\u0430\u043C\u0456\u043A\u0430 \u043F\u0440\u043E\u0431\u043B\u0435\u043C \u0437\u0430 \u0437\u0430\u043F\u0443\u0441\u043A\u0430\u043C\u0438.",runs:"\u0417\u0430\u043F\u0443\u0441\u043A\u0438",pages:"\u0421\u0442\u043E\u0440\u0456\u043D\u043E\u043A \u0432\u043E\u0441\u0442\u0430\u043D\u043D\u0454",newIssues:"\u041D\u043E\u0432\u0456 \u043F\u0440\u043E\u0431\u043B\u0435\u043C\u0438",resolvedIssues:"\u0412\u0438\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0456 \u043F\u0440\u043E\u0431\u043B\u0435\u043C\u0438",sitemapUrls:"URL \u0443 sitemap",maxDepth:"\u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u0430 \u0433\u043B\u0438\u0431\u0438\u043D\u0430"},tabs:{current:"\u041F\u043E\u0442\u043E\u0447\u043D\u0456 / \u0443\u0441\u0456",new:"\u041D\u043E\u0432\u0456",ongoing:"\u0422\u0440\u0438\u0432\u0430\u044E\u0442\u044C",resolved:"\u0412\u0438\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0456",unchanged:"\u0411\u0435\u0437 \u0437\u043C\u0456\u043D"},filters:{search:"URL \u0430\u0431\u043E \u0442\u0435\u043A\u0441\u0442",searchPlaceholder:"URL, \u043F\u0435\u0440\u0435\u0432\u0456\u0440\u043A\u0430 \u0430\u0431\u043E \u043F\u043E\u0432\u0456\u0434\u043E\u043C\u043B\u0435\u043D\u043D\u044F",severity:"\u0412\u0430\u0436\u043B\u0438\u0432\u0456\u0441\u0442\u044C",rule:"\u041F\u0435\u0440\u0435\u0432\u0456\u0440\u043A\u0430",template:"\u0428\u0430\u0431\u043B\u043E\u043D \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0438",owner:"\u0412\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u043B\u044C\u043D\u0438\u0439",rows:"\u0420\u044F\u0434\u043A\u0438"},all:{severity:"\u0423\u0441\u0456 \u0440\u0456\u0432\u043D\u0456",rule:"\u0423\u0441\u0456 \u043F\u0435\u0440\u0435\u0432\u0456\u0440\u043A\u0438",template:"\u0423\u0441\u0456 \u0448\u0430\u0431\u043B\u043E\u043D\u0438",owner:"\u0423\u0441\u0456 \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u043B\u044C\u043D\u0456"},severities:{error:"\u041F\u043E\u043C\u0438\u043B\u043A\u0430",warning:"\u041F\u043E\u043F\u0435\u0440\u0435\u0434\u0436\u0435\u043D\u043D\u044F",info:"\u0406\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0456\u044F"},owners:{seo:"SEO",content:"\u041A\u043E\u043D\u0442\u0435\u043D\u0442",developer:"\u0420\u043E\u0437\u0440\u043E\u0431\u043D\u0438\u043A"},rows:{100:"100 \u043D\u0430 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0443",250:"250 \u043D\u0430 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0443",500:"500 \u043D\u0430 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0443"},guide:{error:"\u041F\u043E\u043C\u0438\u043B\u043A\u0438",errorText:"\u043F\u043E\u0442\u0440\u0435\u0431\u0443\u044E\u0442\u044C \u043F\u0435\u0440\u0448\u043E\u0447\u0435\u0440\u0433\u043E\u0432\u043E\u0457 \u0443\u0432\u0430\u0433\u0438.",warning:"\u041F\u043E\u043F\u0435\u0440\u0435\u0434\u0436\u0435\u043D\u043D\u044F",warningText:"\u043F\u043E\u0437\u043D\u0430\u0447\u0430\u044E\u0442\u044C \u0432\u0430\u0436\u043B\u0438\u0432\u0456 \u043F\u043E\u043A\u0440\u0430\u0449\u0435\u043D\u043D\u044F.",info:"\u0406\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0456\u044F",infoText:"\u0434\u0430\u0454 \u043A\u043E\u0440\u0438\u0441\u043D\u0438\u0439 \u043A\u043E\u043D\u0442\u0435\u043A\u0441\u0442.",score:"\u041D\u0435\u043F\u0440\u043E\u0437\u043E\u0440\u0430 SEO-\u043E\u0446\u0456\u043D\u043A\u0430 \u043D\u0435 \u0432\u0438\u043A\u043E\u0440\u0438\u0441\u0442\u043E\u0432\u0443\u0454\u0442\u044C\u0441\u044F."},exportCsv:"\u0415\u043A\u0441\u043F\u043E\u0440\u0442 CSV",previous:"\u041D\u0430\u0437\u0430\u0434",next:"\u0414\u0430\u043B\u0456",table:{severity:"\u0412\u0430\u0436\u043B\u0438\u0432\u0456\u0441\u0442\u044C",lifecycle:"\u0421\u0442\u0430\u043D",ruleOwner:"\u041F\u0435\u0440\u0435\u0432\u0456\u0440\u043A\u0430 / \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u043B\u044C\u043D\u0438\u0439",page:"\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0430",finding:"\u0429\u043E \u0437\u043D\u0430\u0439\u0434\u0435\u043D\u043E",change:"\u0417\u043C\u0456\u043D\u0430",before:"\u0411\u0443\u043B\u043E",evidence:"\u0414\u043E\u043A\u0430\u0437 / \u0441\u0442\u0430\u043B\u043E",remediation:"\u042F\u043A \u0432\u0438\u043F\u0440\u0430\u0432\u0438\u0442\u0438",fingerprint:"\u0412\u0456\u0434\u0431\u0438\u0442\u043E\u043A"},empty:{cleanTitle:"SEO-\u043F\u0440\u043E\u0431\u043B\u0435\u043C \u043D\u0435 \u0437\u043D\u0430\u0439\u0434\u0435\u043D\u043E",cleanMessage:"\u041F\u0435\u0440\u0435\u0432\u0456\u0440\u0435\u043D\u0456 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0438 \u043F\u0440\u043E\u0439\u0448\u043B\u0438 \u0432\u0441\u0456 \u0430\u043A\u0442\u0438\u0432\u043D\u0456 \u043F\u0435\u0440\u0435\u0432\u0456\u0440\u043A\u0438.",filteredTitle:"\u0417\u0431\u0456\u0433\u0456\u0432 \u043D\u0435 \u0437\u043D\u0430\u0439\u0434\u0435\u043D\u043E",filteredMessage:"\u041E\u0431\u0435\u0440\u0456\u0442\u044C \u0456\u043D\u0448\u0438\u0439 \u0441\u0442\u0430\u043D \u0430\u0431\u043E \u043E\u0447\u0438\u0441\u0442\u044C\u0442\u0435 \u0444\u0456\u043B\u044C\u0442\u0440\u0438.",clear:"\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u0438 \u0444\u0456\u043B\u044C\u0442\u0440\u0438"},lifecycle:{current:"\u041F\u043E\u0442\u043E\u0447\u043D\u0430",new:"\u041D\u043E\u0432\u0430",ongoing:"\u0422\u0440\u0438\u0432\u0430\u0454",resolved:"\u0412\u0438\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0430",unchanged:"\u0411\u0435\u0437 \u0437\u043C\u0456\u043D"},notPresent:"\u0412\u0456\u0434\u0441\u0443\u0442\u043D\u0454",page:"\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0430",of:"\u0437",issue:"\u043F\u0440\u043E\u0431\u043B\u0435\u043C\u0430",issues:"\u043F\u0440\u043E\u0431\u043B\u0435\u043C",docs:"\u0434\u043E\u0432\u0456\u0434\u043A\u0430",footer:"\u0421\u0442\u0432\u043E\u0440\u0435\u043D\u043E \u043B\u043E\u043A\u0430\u043B\u044C\u043D\u043E. \u0414\u0430\u043D\u0456 \u0437\u0432\u0456\u0442\u0443 \u043D\u0456\u043A\u0443\u0434\u0438 \u043D\u0435 \u0437\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0443\u0432\u0430\u043B\u0438\u0441\u044F."}};function yr(e,t){try{let r=new URL(e,t);return r.protocol!=="http:"&&r.protocol!=="https:"?null:(r.hash="",r.href)}catch{return null}}function Mi(e){let t=new Map,r=new Map,n=new Map;for(let s of e){let a=yr(s.url);a&&t.set(a,s),r.set(s.url,{incoming:[],broken:[],redirects:[]})}for(let s of e){let a=r.get(s.url),c=new Set(s.internalLinks.map(l=>yr(l,s.finalUrl??s.url)));for(let l of c){if(!l||l===yr(s.url)||l===yr(s.finalUrl??s.url))continue;let o=t.get(l);if(!o)continue;let d=n.get(o.url)??new Set;d.add(s.url),n.set(o.url,d),!o.blockedByRobots&&(o.error||o.status!==null&&o.status>=400)&&a.broken.push(o.url),(o.redirectChain.length||o.finalUrl&&o.finalUrl!==o.url||o.status!==null&&o.status>=300&&o.status<400)&&a.redirects.push(o.url)}}for(let[s,a]of r)a.incoming=[...n.get(s)??[]].sort(),a.broken.sort(),a.redirects.sort();return r}var Ue=e=>String(e??"").replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#039;"),U=(e,t)=>`<span class="locale-en">${Ue(e)}</span><span class="locale-uk">${Ue(t)}</span>`;function Ui(e,t){let r=[...e].sort((n,s)=>s.counts.new+s.counts.resolved+s.counts.ongoing-(n.counts.new+n.counts.resolved+n.counts.ongoing)||n.id.localeCompare(s.id));return r.slice(0,20).map(n=>`<tr><td><button type="button" data-comparison-${t}="${Ue(n.id)}">${Ue(n.id)}</button></td><td>${n.counts.new}</td><td>${n.counts.ongoing}</td><td>${n.counts.resolved}</td><td>${n.affectedPages}</td></tr>`).join("")+(r.length>20?`<tr><td colspan="5">${U(`${r.length-20} more groups in the JSON summary`,`\u0429\u0435 ${r.length-20} \u0433\u0440\u0443\u043F \u0443 JSON-\u0437\u0432\u0435\u0434\u0435\u043D\u043D\u0456`)}</td></tr>`:"")}function Fi(e){let t=e.coverage,r=e.warnings.length>0?`<p class="comparison-warning">${U("Comparison warnings","\u0417\u0430\u0441\u0442\u0435\u0440\u0435\u0436\u0435\u043D\u043D\u044F \u043F\u043E\u0440\u0456\u0432\u043D\u044F\u043D\u043D\u044F")}: ${Ue(e.warnings.join(", "))}</p>`:"",n=e.unverified.length>0?`<p class="comparison-warning">${e.unverified.length} ${U("apparent resolutions lack sufficient evidence and are not counted as resolved","\u043F\u043E\u0442\u0435\u043D\u0446\u0456\u0439\u043D\u0438\u0445 \u0432\u0438\u0440\u0456\u0448\u0435\u043D\u044C \u043D\u0435 \u043C\u0430\u044E\u0442\u044C \u0434\u043E\u0441\u0442\u0430\u0442\u043D\u0456\u0445 \u0434\u043E\u043A\u0430\u0437\u0456\u0432 \u0456 \u043D\u0435 \u0432\u0440\u0430\u0445\u043E\u0432\u0430\u043D\u0456 \u044F\u043A \u0432\u0438\u0440\u0456\u0448\u0435\u043D\u0456")}</p>`:"",s=`<thead><tr><th>${U("Group","\u0413\u0440\u0443\u043F\u0430")}</th><th>${U("New","\u041D\u043E\u0432\u0456")}</th><th>${U("Ongoing","\u0422\u0440\u0438\u0432\u0430\u044E\u0442\u044C")}</th><th>${U("Resolved","\u0412\u0438\u0440\u0456\u0448\u0435\u043D\u0456")}</th><th>${U("Pages","\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0438")}</th></tr></thead>`;return`<section id="local-comparison" class="analytics" aria-labelledby="local-comparison-title"><h2 id="local-comparison-title">${U("Local run comparison","\u041F\u043E\u0440\u0456\u0432\u043D\u044F\u043D\u043D\u044F \u043B\u043E\u043A\u0430\u043B\u044C\u043D\u0438\u0445 \u0437\u0430\u043F\u0443\u0441\u043A\u0456\u0432")}</h2>
8
8
  <div class="comparison-runs"><div><strong>${U("Before","\u0414\u043E")}</strong><time>${Ue(e.from.generatedAt)}</time><span>${e.from.pages} ${U("checked pages","\u043F\u0435\u0440\u0435\u0432\u0456\u0440\u0435\u043D\u0438\u0445 \u0441\u0442\u043E\u0440\u0456\u043D\u043E\u043A")}</span></div><div><strong>${U("After","\u041F\u0456\u0441\u043B\u044F")}</strong><time>${Ue(e.to.generatedAt)}</time><span>${e.to.pages} ${U("checked pages","\u043F\u0435\u0440\u0435\u0432\u0456\u0440\u0435\u043D\u0438\u0445 \u0441\u0442\u043E\u0440\u0456\u043D\u043E\u043A")}</span></div></div>
9
9
  <p>${U("Coverage","\u041E\u0445\u043E\u043F\u043B\u0435\u043D\u043D\u044F")}: ${t.common} ${U("common","\u0441\u043F\u0456\u043B\u044C\u043D\u0438\u0445")}, ${t.onlyBefore} ${U("only before","\u043B\u0438\u0448\u0435 \u0434\u043E")}, ${t.onlyAfter} ${U("only after","\u043B\u0438\u0448\u0435 \u043F\u0456\u0441\u043B\u044F")} \xB7 ${t.complete?U("complete","\u043F\u043E\u0432\u043D\u0435"):U("incomplete","\u043D\u0435\u043F\u043E\u0432\u043D\u0435")}</p>
10
10
  <div class="comparison-counts"><div><strong>${e.lifecycle.new}</strong>${U("New","\u041D\u043E\u0432\u0456")}</div><div><strong>${e.lifecycle.ongoing}</strong>${U("Ongoing","\u0422\u0440\u0438\u0432\u0430\u044E\u0442\u044C")}</div><div><strong>${e.lifecycle.resolved}</strong>${U("Resolved on checked pages","\u0412\u0438\u0440\u0456\u0448\u0435\u043D\u0456 \u043D\u0430 \u043F\u0435\u0440\u0435\u0432\u0456\u0440\u0435\u043D\u0438\u0445 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0430\u0445")}</div><div><strong>${e.unverified.length}</strong>${U("Unverified","\u041D\u0435 \u043F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u0436\u0435\u043D\u043E")}</div></div>
11
11
  ${r}${n}
12
- <div class="comparison-groups"><div><h3>${U("By rule","\u0417\u0430 \u043F\u0440\u0430\u0432\u0438\u043B\u043E\u043C")}</h3><div class="table-wrap"><table>${s}<tbody>${Mi(e.byRule,"rule")}</tbody></table></div></div><div><h3>${U("By page template","\u0417\u0430 \u0448\u0430\u0431\u043B\u043E\u043D\u043E\u043C \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0438")}</h3><div class="table-wrap"><table>${s}<tbody>${Mi(e.byTemplate,"template")}</tbody></table></div></div></div>
12
+ <div class="comparison-groups"><div><h3>${U("By rule","\u0417\u0430 \u043F\u0440\u0430\u0432\u0438\u043B\u043E\u043C")}</h3><div class="table-wrap"><table>${s}<tbody>${Ui(e.byRule,"rule")}</tbody></table></div></div><div><h3>${U("By page template","\u0417\u0430 \u0448\u0430\u0431\u043B\u043E\u043D\u043E\u043C \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0438")}</h3><div class="table-wrap"><table>${s}<tbody>${Ui(e.byTemplate,"template")}</tbody></table></div></div></div>
13
13
  <p class="meta">${U("Findings are re-evaluated with the selected current policy. A lower count is not proof of improvement when coverage differs.","\u041F\u0440\u043E\u0431\u043B\u0435\u043C\u0438 \u043F\u043E\u0432\u0442\u043E\u0440\u043D\u043E \u043E\u0446\u0456\u043D\u0435\u043D\u043E \u0437\u0430 \u043F\u043E\u043B\u0456\u0442\u0438\u043A\u043E\u044E \u0432\u0438\u0431\u0440\u0430\u043D\u043E\u0433\u043E \u043F\u043E\u0442\u043E\u0447\u043D\u043E\u0433\u043E \u0437\u0430\u043F\u0443\u0441\u043A\u0443. \u041C\u0435\u043D\u0448\u0430 \u043A\u0456\u043B\u044C\u043A\u0456\u0441\u0442\u044C \u043D\u0435 \u0434\u043E\u0432\u043E\u0434\u0438\u0442\u044C \u043F\u043E\u043A\u0440\u0430\u0449\u0435\u043D\u043D\u044F, \u044F\u043A\u0449\u043E \u043E\u0445\u043E\u043F\u043B\u0435\u043D\u043D\u044F \u0440\u0456\u0437\u043D\u0438\u0442\u044C\u0441\u044F.")}</p>
14
- </section>`}var pu="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect width='64' height='64' rx='16' fill='%233157d5'/%3E%3Ccircle cx='27' cy='27' r='13' fill='none' stroke='white' stroke-width='6'/%3E%3Cpath d='m37 37 12 12' fill='none' stroke='white' stroke-linecap='round' stroke-width='6'/%3E%3Cpath d='m21 27 5 5 9-11' fill='none' stroke='white' stroke-linecap='round' stroke-linejoin='round' stroke-width='4'/%3E%3C/svg%3E";function se(e){return String(e??"").replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#039;")}function hu(e){return JSON.stringify(e).replaceAll("<","\\u003c").replaceAll(">","\\u003e").replaceAll("&","\\u0026")}function gu(){return'<svg class="logo product-mark" viewBox="0 0 64 64" role="img" aria-label="SEO Crawl Audit logo"><rect width="64" height="64" rx="16" fill="var(--accent)"/><circle cx="27" cy="27" r="13" fill="none" stroke="#fff" stroke-width="6"/><path d="m37 37 12 12" fill="none" stroke="#fff" stroke-linecap="round" stroke-width="6"/><path d="m21 27 5 5 9-11" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="4"/></svg>'}function Dt(e,t="current"){let r=e.ruleId??e.rule??"unknown";return{fingerprint:e.fingerprint??"legacy",ruleId:r,rule:e.rule??e.ruleId??"unknown",severity:e.severity??"info",scope:e.scope??"page",url:e.url??"",message:e.message??"",evidence:e.evidence??{actual:e.after},owner:e.owner??"seo",remediation:e.remediation??"Review the finding and confirm the intended behavior.",documentationUrl:e.documentationUrl??"https://github.com/MelnixDev/seo-crawl-audit/blob/main/docs/rules.md",before:e.before,after:e.after,lifecycle:e.lifecycle??t,template:"",localized:ki(e,r)}}function Nn(e,t){return e.reduce((r,n)=>{let s=String(n[t]);return r[s]=(r[s]??0)+1,r},{})}function mu(e){if(e.blockedByRobots)return"blocked";if(e.error||e.status!==null&&e.status>=400)return"error";if(e.status===null)return"unknown";if(e.redirectChain.length>0||e.finalUrl!==null&&e.finalUrl!==e.url||e.status>=300)return"redirect";if(!e.contentType)return"unknown";if(!/(?:text\/html|application\/xhtml\+xml)/i.test(e.contentType))return"non-html";let t=`${e.robots??""},${e.xRobotsTag??""}`.toLowerCase();return/(^|[:,\s])(?:noindex|none)($|[:,\s])/.test(t)?"noindex":"allowed"}function fu(e,t,r){let n=[],s=new Map,a=h=>{if(h===null||h==="")return null;let f=s.get(h);if(f!==void 0)return f;let m=n.length;return n.push(h),s.set(h,m),m},c=new Map;r.forEach((h,f)=>{if(h.scope!=="page"||h.lifecycle==="resolved")return;let m=c.get(h.url)??{indexes:[],error:0,warning:0,info:0};m.indexes.push(f),m[h.severity]+=1,c.set(h.url,m)});let l=t?.map(h=>({url:h.url}))??e??[],o=t?Pi(t):null,d=vt(l.map(h=>h.url)),p=new Map(d.flatMap((h,f)=>h.urls.map(m=>[m,f])));return{detailed:!!t,templates:d.map(({origin:h,template:f,urls:m})=>({label:h+f,count:m.length})),urls:n,pages:l.map((h,f)=>{let m=t?.[f]??null,y=c.get(h.url)??{indexes:[],error:0,warning:0,info:0};return{u:a(h.url),template:p.get(h.url)??null,f:a(m?.finalUrl??null),s:m?.status??null,ct:m?.contentType??null,b:m?.blockedByRobots??!1,e:m?.error??null,t:m?.title??null,d:m?.description??null,c:a(m?.canonical??null),cr:a(m?.canonicalRaw??null),r:m?.robots??null,xr:m?.xRobotsTag??null,l:m?.lang??null,h:m?.h1Count??null,w:m?.wordCount??null,z:m?.responseBytes??null,depth:m?.depth??null,incoming:o?.get(h.url)?.incoming.map(a)??null,broken:o?.get(h.url)?.broken.map(a)??null,redirects:o?.get(h.url)?.redirects.map(a)??null,ix:m?mu(m):"unknown",il:m?.internalLinks.map(a)??[],el:m?.externalLinks.map(a)??[],rc:m?.redirectChain.map(w=>({u:a(w.url),s:w.status,l:a(w.location)}))??[],issues:y.indexes,counts:{error:y.error,warning:y.warning,info:y.info}}})}}function Fi(e,t={}){let r=e.mode??"scan",n=e.pages??[],s=(e.issues??[]).map(S=>Dt(S)),a=[...(e.newIssues??[]).map(S=>Dt(S,"new")),...(e.ongoingIssues??[]).map(S=>Dt(S,"ongoing")),...(e.resolvedIssues??[]).map(S=>Dt(S,"resolved")),...(e.unchangedIssues??[]).map(S=>Dt(S,"unchanged"))],c=a.length>0?a:s,l=e.comparison?.kind==="local",o=l?vt([...(e.previousPages??[]).map(S=>S.url),...n.map(S=>S.url)]):null,d=Ir(c),p=new Map((o??d).flatMap(S=>S.urls.map(k=>[k,l?S.origin+S.template:S.template])));for(let S of c)S.template=p.get(S.url)??"";let h=new Map;if(l)for(let S of c){if(!S.template)continue;let k=h.get(S.template)??{count:0,urls:new Set};k.count+=1,k.urls.add(S.url),h.set(S.template,k)}let f=l?[...h].map(([S,k])=>({template:S,issueCount:k.count,affectedPages:k.urls.size})):d,m=c.reduce((S,k)=>(S[k.severity]+=1,S),{error:0,warning:0,info:0}),y=new Set(c.map(S=>S.url)).size,w=Nn(c,"rule"),I={error:0,warning:1,info:2},_=new Map;for(let S of c.filter(k=>k.lifecycle!=="resolved")){let k=_.get(S.rule);k?(k.count+=1,k.urls.add(S.url),I[S.severity]<I[k.severity]&&(k.severity=S.severity)):_.set(S.rule,{rule:S.rule,severity:S.severity,owner:S.owner,count:1,urls:new Set([S.url])})}let N=[..._.values()].map(S=>({rule:S.rule,severity:S.severity,owner:S.owner,count:S.count,affectedPages:S.urls.size})).sort((S,k)=>I[S.severity]-I[k.severity]||k.affectedPages-S.affectedPages||k.count-S.count||S.rule.localeCompare(k.rule)).slice(0,5),L={total:c.length,pagesChecked:n.length,targetPages:e.targetPages??null,affectedPages:y,severity:m,rules:Object.entries(w).map(([S,k])=>({id:S,count:k})).sort((S,k)=>k.count-S.count||S.id.localeCompare(k.id)),owners:Nn(c,"owner"),lifecycle:Nn(c,"lifecycle"),templates:f.map(({template:S,issueCount:k,affectedPages:Ha})=>({template:S,issueCount:k,affectedPages:Ha})),priorities:N},B=e.partial??!1,R=B||e.complete===!1,P=r==="check"&&e.complete===!1,G=B?"Partial SEO scan report":r==="check"?"SEO regression report":"SEO baseline audit",x={...e.branding??{},...t.branding??{}},D=/^#[0-9a-f]{6}$/i.test(x.primaryColor??"")?x.primaryColor:"#3157d5",F=x.logo&&(/^data:image\//.test(x.logo)||/^https:\/\//.test(x.logo))?`<img class="logo" src="${se(x.logo)}" alt="${se(x.agencyName??"Report logo")}">`:gu(),$=e.generatedAt??new Date().toISOString(),Pa=e.startUrl??"",Zn=e.targetPages??null,Fr=r==="check",Ma=c.length>25e3,Ua=fu(n,e.pageDetails,c),Fa=hu({mode:r,issues:c,statistics:L,pageExplorer:Ua,copy:Bi,partial:B,incompleteComparison:P,comparison:e.comparison??null,history:e.history??null,siteMetrics:e.siteMetrics??null});return`<!doctype html>
14
+ </section>`}var hu="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect width='64' height='64' rx='16' fill='%233157d5'/%3E%3Ccircle cx='27' cy='27' r='13' fill='none' stroke='white' stroke-width='6'/%3E%3Cpath d='m37 37 12 12' fill='none' stroke='white' stroke-linecap='round' stroke-width='6'/%3E%3Cpath d='m21 27 5 5 9-11' fill='none' stroke='white' stroke-linecap='round' stroke-linejoin='round' stroke-width='4'/%3E%3C/svg%3E";function se(e){return String(e??"").replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#039;")}function gu(e){return JSON.stringify(e).replaceAll("<","\\u003c").replaceAll(">","\\u003e").replaceAll("&","\\u0026")}function mu(e){let t=[],r=new Map,n=s=>{let a=r.get(s);if(a!==void 0)return a;let c=t.length;return t.push(s),r.set(s,c),c};return{strings:t,rows:e.map(s=>[s.fingerprint,n(s.ruleId),n(s.rule),n(s.severity),n(s.scope),s.url,s.message,s.evidence,n(s.owner),n(s.remediation),n(s.documentationUrl),s.before??null,s.after??null,n(s.lifecycle),n(s.template),n(s.localized.en.rule),s.localized.en.message,n(s.localized.en.remediation),n(s.localized.uk.rule),s.localized.uk.message,n(s.localized.uk.remediation),(s.before!==void 0?1:0)|(s.after!==void 0?2:0)])}}function fu(){return'<svg class="logo product-mark" viewBox="0 0 64 64" role="img" aria-label="SEO Crawl Audit logo"><rect width="64" height="64" rx="16" fill="var(--accent)"/><circle cx="27" cy="27" r="13" fill="none" stroke="#fff" stroke-width="6"/><path d="m37 37 12 12" fill="none" stroke="#fff" stroke-linecap="round" stroke-width="6"/><path d="m21 27 5 5 9-11" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="4"/></svg>'}function Dt(e,t="current"){let r=e.ruleId??e.rule??"unknown";return{fingerprint:e.fingerprint??"legacy",ruleId:r,rule:e.rule??e.ruleId??"unknown",severity:e.severity??"info",scope:e.scope??"page",url:e.url??"",message:e.message??"",evidence:e.evidence??{actual:e.after},owner:e.owner??"seo",remediation:e.remediation??"Review the finding and confirm the intended behavior.",documentationUrl:e.documentationUrl??"https://github.com/MelnixDev/seo-crawl-audit/blob/main/docs/rules.md",before:e.before,after:e.after,lifecycle:e.lifecycle??t,template:"",localized:Bi(e,r)}}function Nn(e,t){return e.reduce((r,n)=>{let s=String(n[t]);return r[s]=(r[s]??0)+1,r},{})}function Eu(e){if(e.blockedByRobots)return"blocked";if(e.error||e.status!==null&&e.status>=400)return"error";if(e.status===null)return"unknown";if(e.redirectChain.length>0||e.finalUrl!==null&&e.finalUrl!==e.url||e.status>=300)return"redirect";if(!e.contentType)return"unknown";if(!/(?:text\/html|application\/xhtml\+xml)/i.test(e.contentType))return"non-html";let t=`${e.robots??""},${e.xRobotsTag??""}`.toLowerCase();return/(^|[:,\s])(?:noindex|none)($|[:,\s])/.test(t)?"noindex":"allowed"}function Tu(e,t,r){let n=[],s=new Map,a=h=>{if(h===null||h==="")return null;let f=s.get(h);if(f!==void 0)return f;let m=n.length;return n.push(h),s.set(h,m),m},c=new Map;r.forEach((h,f)=>{if(h.scope!=="page"||h.lifecycle==="resolved")return;let m=c.get(h.url)??{indexes:[],error:0,warning:0,info:0};m.indexes.push(f),m[h.severity]+=1,c.set(h.url,m)});let l=t?.map(h=>({url:h.url}))??e??[],o=t?Mi(t):null,d=vt(l.map(h=>h.url)),p=new Map(d.flatMap((h,f)=>h.urls.map(m=>[m,f])));return{detailed:!!t,templates:d.map(({origin:h,template:f,urls:m})=>({label:h+f,count:m.length})),urls:n,pages:l.map((h,f)=>{let m=t?.[f]??null,y=c.get(h.url)??{indexes:[],error:0,warning:0,info:0};return{u:a(h.url),template:p.get(h.url)??null,f:a(m?.finalUrl??null),s:m?.status??null,ct:m?.contentType??null,b:m?.blockedByRobots??!1,e:m?.error??null,t:m?.title??null,d:m?.description??null,c:a(m?.canonical??null),cr:a(m?.canonicalRaw??null),r:m?.robots??null,xr:m?.xRobotsTag??null,l:m?.lang??null,h:m?.h1Count??null,w:m?.wordCount??null,z:m?.responseBytes??null,depth:m?.depth??null,incoming:o?.get(h.url)?.incoming.map(a)??null,broken:o?.get(h.url)?.broken.map(a)??null,redirects:o?.get(h.url)?.redirects.map(a)??null,ix:m?Eu(m):"unknown",il:m?.internalLinks.map(a)??[],el:m?.externalLinks.map(a)??[],rc:m?.redirectChain.map(w=>({u:a(w.url),s:w.status,l:a(w.location)}))??[],issues:y.indexes,counts:{error:y.error,warning:y.warning,info:y.info}}})}}function Hi(e,t={}){let r=e.mode??"scan",n=e.pages??[],s=(e.issues??[]).map(S=>Dt(S)),a=[...(e.newIssues??[]).map(S=>Dt(S,"new")),...(e.ongoingIssues??[]).map(S=>Dt(S,"ongoing")),...(e.resolvedIssues??[]).map(S=>Dt(S,"resolved")),...(e.unchangedIssues??[]).map(S=>Dt(S,"unchanged"))],c=a.length>0?a:s,l=e.comparison?.kind==="local",o=l?vt([...(e.previousPages??[]).map(S=>S.url),...n.map(S=>S.url)]):null,d=Ir(c),p=new Map((o??d).flatMap(S=>S.urls.map(k=>[k,l?S.origin+S.template:S.template])));for(let S of c)S.template=p.get(S.url)??"";let h=new Map;if(l)for(let S of c){if(!S.template)continue;let k=h.get(S.template)??{count:0,urls:new Set};k.count+=1,k.urls.add(S.url),h.set(S.template,k)}let f=l?[...h].map(([S,k])=>({template:S,issueCount:k.count,affectedPages:k.urls.size})):d,m=c.reduce((S,k)=>(S[k.severity]+=1,S),{error:0,warning:0,info:0}),y=new Set(c.map(S=>S.url)).size,w=Nn(c,"rule"),I={error:0,warning:1,info:2},_=new Map;for(let S of c.filter(k=>k.lifecycle!=="resolved")){let k=_.get(S.rule);k?(k.count+=1,k.urls.add(S.url),I[S.severity]<I[k.severity]&&(k.severity=S.severity)):_.set(S.rule,{rule:S.rule,severity:S.severity,owner:S.owner,count:1,urls:new Set([S.url])})}let N=[..._.values()].map(S=>({rule:S.rule,severity:S.severity,owner:S.owner,count:S.count,affectedPages:S.urls.size})).sort((S,k)=>I[S.severity]-I[k.severity]||k.affectedPages-S.affectedPages||k.count-S.count||S.rule.localeCompare(k.rule)).slice(0,5),L={total:c.length,pagesChecked:n.length,targetPages:e.targetPages??null,affectedPages:y,severity:m,rules:Object.entries(w).map(([S,k])=>({id:S,count:k})).sort((S,k)=>k.count-S.count||S.id.localeCompare(k.id)),owners:Nn(c,"owner"),lifecycle:Nn(c,"lifecycle"),templates:f.map(({template:S,issueCount:k,affectedPages:Qa})=>({template:S,issueCount:k,affectedPages:Qa})),priorities:N},B=e.partial??!1,R=B||e.complete===!1,P=r==="check"&&e.complete===!1,G=B?"Partial SEO scan report":r==="check"?"SEO regression report":"SEO baseline audit",x={...e.branding??{},...t.branding??{}},D=/^#[0-9a-f]{6}$/i.test(x.primaryColor??"")?x.primaryColor:"#3157d5",F=x.logo&&(/^data:image\//.test(x.logo)||/^https:\/\//.test(x.logo))?`<img class="logo" src="${se(x.logo)}" alt="${se(x.agencyName??"Report logo")}">`:fu(),$=e.generatedAt??new Date().toISOString(),Ma=e.startUrl??"",Zn=e.targetPages??null,Fr=r==="check",Ua=c.length>25e3,Fa=Tu(n,e.pageDetails,c),zn=mu(c),Ha=gu({mode:r,issueRows:zn.rows,issueStrings:zn.strings,statistics:L,pageExplorer:Fa,copy:Pi,partial:B,incompleteComparison:P,comparison:e.comparison??null,history:e.history??null,siteMetrics:e.siteMetrics??null});return`<!doctype html>
15
15
  <html lang="en">
16
16
  <head>
17
17
  <meta charset="utf-8">
18
18
  <meta name="viewport" content="width=device-width, initial-scale=1">
19
- <link rel="icon" href="${pu}" type="image/svg+xml">
19
+ <link rel="icon" href="${hu}" type="image/svg+xml">
20
20
  <title>${se(G)} \xB7 SEO Crawl Audit</title>
21
21
  <style>
22
22
  :root { color-scheme: light; --bg:#f5f7fb; --surface:#fff; --muted:#64748b; --text:#172033; --line:#dbe2ea; --accent:${D}; --error:#b42318; --warning:#9a6700; --info:#175cd3; --chart-error:#d92d20; --chart-warning:#f79009; --chart-info:#2e90fa; --chart-resolved:#12b76a; }
@@ -35,12 +35,12 @@ ${Hr(n??null)}`).digest("hex").slice(0,24)}function O(e,t,r,n={},s){let a=Wa.get
35
35
  </style>
36
36
  </head>
37
37
  <body><main>
38
- <header><div class="brand">${F}<div><div class="eyebrow">${se(x.agencyName??"SEO Crawl Audit")}</div><h1 id="report-title">${se(G)}</h1><div class="meta">${se(Pa)}</div></div></div><div class="meta header-meta"><span id="generated-label">Generated</span> <time id="generated-at" datetime="${se($)}">${se($)}</time><br><span id="engine-label">Engine</span> ${se(e.engineVersion??X)} \xB7 <span id="rules-label">Rules</span> ${se(e.ruleSetVersion??ot)}<label class="language-control"><span id="language-label">Language</span><select id="language" aria-label="Language"><option value="en">English</option><option value="uk">\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430</option></select></label></div></header>
38
+ <header><div class="brand">${F}<div><div class="eyebrow">${se(x.agencyName??"SEO Crawl Audit")}</div><h1 id="report-title">${se(G)}</h1><div class="meta">${se(Ma)}</div></div></div><div class="meta header-meta"><span id="generated-label">Generated</span> <time id="generated-at" datetime="${se($)}">${se($)}</time><br><span id="engine-label">Engine</span> ${se(e.engineVersion??X)} \xB7 <span id="rules-label">Rules</span> ${se(e.ruleSetVersion??ot)}<label class="language-control"><span id="language-label">Language</span><select id="language" aria-label="Language"><option value="en">English</option><option value="uk">\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430</option></select></label></div></header>
39
39
  ${B?' <div class="notice"><strong id="partial-title">Partial results.</strong> <span id="partial-message">This report contains the pages saved so far. Run the same scan command again to resume without requesting them twice.</span></div>':""}
40
40
  ${P?' <div class="notice"><strong id="incomplete-title">Incomplete comparison.</strong> <span id="incomplete-message">Regressions found on checked pages are shown, but unchecked pages are not marked missing or resolved.</span></div>':""}
41
41
  ${e.comparison?.kind==="preview"?` <div class="notice"><strong id="preview-title">Preview deployment comparison.</strong> <span id="production-label">Production</span>: <a href="${se(e.comparison.productionUrl)}">${se(e.comparison.productionUrl)}</a> \xB7 <span id="preview-label">Preview</span>: <a href="${se(e.comparison.previewUrl)}">${se(e.comparison.previewUrl)}</a></div>`:""}
42
- ${e.comparison?.kind==="local"?Ui(e.comparison.summary):""}
43
- ${Ma?' <div id="large-report-notice" class="notice">This report contains more than 25,000 issues. Filters and pagination render only the visible rows to keep the report responsive.</div>':""}
42
+ ${e.comparison?.kind==="local"?Fi(e.comparison.summary):""}
43
+ ${Ua?' <div id="large-report-notice" class="notice">This report contains more than 25,000 issues. Filters and pagination render only the visible rows to keep the report responsive.</div>':""}
44
44
  <nav class="report-nav" aria-label="Report sections"><button type="button" data-view="overview" aria-selected="true">Overview</button><button type="button" data-view="metrics" aria-selected="false">Site Metrics</button><button type="button" data-view="pages" aria-selected="false">Pages</button><button type="button" data-view="issues" aria-selected="false">Issues</button></nav>
45
45
  <div id="overview-view" data-report-view="overview">
46
46
  <section class="cards"><div class="card"><strong id="pages-count">${n.length.toLocaleString("en-US")}${Zn?` / ${Zn.toLocaleString("en-US")}`:""}</strong><span id="pages-label">Pages checked</span></div><div class="card error"><strong id="errors-count">${m.error}</strong><span id="errors-label">Errors</span></div><div class="card warning"><strong id="warnings-count">${m.warning}</strong><span id="warnings-label">Warnings</span></div><div class="card info"><strong id="info-count">${m.info}</strong><span id="info-label">Info</span></div><div class="card"><strong id="affected-count">${y.toLocaleString("en-US")}</strong><span id="affected-label">Affected pages</span></div></section>
@@ -75,7 +75,9 @@ ${e.history&&e.history.points.length>0?' <section id="history-panel" class="ana
75
75
  </section><div id="page-dialog-backdrop" class="page-dialog-backdrop" hidden></div><aside id="page-dialog" class="page-dialog" role="dialog" aria-modal="true" aria-labelledby="page-dialog-title" hidden><div class="page-dialog-head"><h2 id="page-dialog-title">Page details</h2><button id="page-dialog-close" type="button" aria-label="Close">\xD7</button></div><div id="page-dialog-content"></div></aside><footer id="report-footer">Generated locally. No report data was uploaded.</footer>
76
76
  </main>
77
77
  <script>
78
- const report=${Fa};
78
+ const report=${Ha};
79
+ const issueString=(id)=>report.issueStrings[id];
80
+ report.issues=report.issueRows.map((row)=>{const issue={fingerprint:row[0],ruleId:issueString(row[1]),rule:issueString(row[2]),severity:issueString(row[3]),scope:issueString(row[4]),url:row[5],message:row[6],evidence:row[7],owner:issueString(row[8]),remediation:issueString(row[9]),documentationUrl:issueString(row[10]),lifecycle:issueString(row[13]),template:issueString(row[14]),localized:{en:{rule:issueString(row[15]),message:row[16],remediation:issueString(row[17])},uk:{rule:issueString(row[18]),message:row[19],remediation:issueString(row[20])}}};if(row[21]&1)issue.before=row[11];if(row[21]&2)issue.after=row[12];return issue});delete report.issueRows;delete report.issueStrings;
79
81
  const byId=(id)=>document.querySelector("#"+id); const generatedAt=byId("generated-at"); const language=byId("language"); const search=byId("search"); const severity=byId("severity"); const rule=byId("rule"); const template=byId("template"); const owner=byId("owner"); const pageSize=byId("page-size"); const tbody=byId("issues"); const empty=byId("empty"); const emptyTitle=byId("empty-title"); const emptyMessage=byId("empty-message"); const clearFilters=byId("clear-filters"); const tableWrap=byId("table-wrap"); const resultCount=byId("result-count"); const pagination=byId("pagination"); const previous=byId("previous"); const next=byId("next"); const pageInfo=byId("page-info"); const severityChart=byId("severity-chart"); const rulesChart=byId("rules-chart"); const distributionChart=byId("distribution-chart"); const templatesChart=byId("templates-chart"); const historyChart=byId("history-chart"); const historySummary=byId("history-summary"); const metricsHero=byId("metrics-hero"); const metricsInsights=byId("metrics-insights"); const metricsGroups=byId("metrics-groups"); const priorityList=byId("priority-list"); const pageSearch=byId("page-search");const pageStatus=byId("page-status");const pageIndexability=byId("page-indexability");const pageIssues=byId("page-issues");const pagePageSize=byId("page-page-size");const pagesBody=byId("pages-body");const pagesEmpty=byId("pages-empty");const pagesTableWrap=byId("pages-table-wrap");const pageResultCount=byId("page-result-count");const pagePagination=byId("page-pagination");const pagePrevious=byId("page-previous");const pageNext=byId("page-next");const pagePageInfo=byId("page-page-info");const pageDialog=byId("page-dialog");const pageDialogBackdrop=byId("page-dialog-backdrop");const pageDialogContent=byId("page-dialog-content");const pageDialogClose=byId("page-dialog-close"); let locale="en"; let currentPage=1; let activeTab=""; let exactIssueUrl=null;let lastFiltered=[];let pagesCurrentPage=1;let pagesFiltered=[];let pageSort={key:"url",direction:1};let pageReturnFocus=null;
80
82
  const generatedDate=new Date(generatedAt.dateTime); const copy=()=>report.copy[locale]; const issueText=(issue)=>issue.localized[locale]||issue.localized.en; const number=(value)=>Number(value).toLocaleString(locale==="uk"?"uk-UA":"en-US");
81
83
  const safeHttpUrl=(value)=>{try{const url=new URL(value);return url.protocol==="http:"||url.protocol==="https:"?url.href:null}catch{return null}};
@@ -178,15 +180,15 @@ ${e.history&&e.history.points.length>0?' <section id="history-panel" class="ana
178
180
  for(const button of document.querySelectorAll("[data-comparison-rule]")){button.addEventListener("click",()=>{const sample=report.issues.find((issue)=>issue.ruleId===button.dataset.comparisonRule);if(!sample)return;rule.value=sample.rule;currentPage=1;document.querySelector('[data-view="issues"]').click();render()})}
179
181
  for(const button of document.querySelectorAll("[data-comparison-template]")){button.addEventListener("click",()=>{template.value=button.dataset.comparisonTemplate;currentPage=1;document.querySelector('[data-view="issues"]').click();render()})}
180
182
  applyLocale();
181
- </script></body></html>`}function Eu(e){return e.reduce((t,r)=>(t[r.severity]+=1,t),{error:0,warning:0,info:0})}function kt(e){if(e.length===0)return null;let r=[...new Map(e.map(c=>[`${c.generatedAt}|${c.configurationHash}|${c.pages.length}`,c])).values()].sort((c,l)=>c.generatedAt.localeCompare(l.generatedAt)),n=r.at(-1).siteUrl,s=r.filter(c=>c.siteUrl===n),a=s.map((c,l)=>{let o=me(c),d=Eu(o),p=l>0?s[l-1]:void 0,h=p?Ye(p,c):null;return{generatedAt:c.generatedAt,siteUrl:c.siteUrl,pages:c.pages.length,affectedPages:new Set(o.map(f=>f.url)).size,errors:d.error,warnings:d.warning,info:d.info,newIssues:h?.newIssues.length??0,resolvedIssues:h?.resolvedIssues.length??0,sitemapUrls:c.sitemap?.urls.length??0,maxDepth:c.pages.reduce((f,m)=>Math.max(f,m.depth),0),partial:c.partial||c.truncated}});return{siteUrl:n,points:a}}function Hi(e){return{generatedAt:e.generatedAt,siteUrl:e.siteUrl,pages:e.pages.length,partial:e.partial,truncated:e.truncated,configurationHash:e.configurationHash,engineVersion:e.engineVersion,ruleSetVersion:e.ruleSetVersion}}function Qi(e){let t={error:0,warning:0,info:0};for(let r of e)t[r.severity]+=1;return t}function Bt(){return{new:0,ongoing:0,resolved:0,unchanged:0}}var Tu=new Set(["page-unreachable","http-error","robots-blocked","redirect-loop","long-redirect-chain","status-regression","page-missing","redirect-changed"]),bu=new Set(["noindex","x-robots-noindex","missing-canonical","invalid-canonical","cross-domain-canonical","canonical-target-error","noindex-in-sitemap","redirect-in-sitemap","missing-title","duplicate-title","title-length","missing-description","duplicate-description","description-length","missing-h1","broken-internal-link","orphan-sitemap-page","crawlable-not-in-sitemap","invalid-hreflang","malformed-json-ld","http-on-https-site","invalid-language","duplicate-content","multiple-h1","missing-open-graph","missing-twitter-metadata","image-missing-alt","low-word-count","new-noindex","title-removed","title-changed","description-removed","canonical-removed","canonical-changed","h1-removed"]);function Cu(e,t,r,n){if(e.scope==="site")return t.partial||t.truncated||r.partial||r.truncated?"incomplete-site":null;let s=n.get(e.url);return s?s.blockedByRobots?"robots-blocked":s.error||s.status===null||s.status>=400?"request-failed":Tu.has(e.ruleId)?null:s.status>=300||!s.contentType||!/(?:text\/html|application\/xhtml\+xml)/i.test(s.contentType)?"html-unavailable":bu.has(e.ruleId)?null:"unknown-evidence":"not-checked"}function Yi(e,t){let r=new Map;for(let{lifecycle:n,issue:s}of e){let a=t(s),c=r.get(a)??{counts:Bt(),pages:new Set};c.counts[n]+=1,s.scope==="page"&&c.pages.add(s.url),r.set(a,c)}return[...r].map(([n,s])=>({id:n,counts:s.counts,affectedPages:s.pages.size})).sort((n,s)=>n.id.localeCompare(s.id))}function _n(e,t,r){if(e.siteUrl!==t.siteUrl)throw new Error("local history snapshots must have the same site URL");let n=t.config,s=x=>({...x,config:{...x.config,enabledRules:n.enabledRules,severityOverrides:n.severityOverrides,suppressions:n.suppressions,regressionBudgets:n.regressionBudgets}}),a=s(e),c=s(t),l={now:r.evaluatedAt},o=me(a,l),d=me(c,l),p=Ye(a,c,l),h=[],f=new Map(t.pages.map(x=>[x.url,x])),m=p.resolvedIssues.filter(x=>{let D=Cu(x,e,t,f);return D&&h.push({fingerprint:x.fingerprint,ruleId:x.ruleId,url:x.url,reason:D}),!D}),y={...p,resolvedIssues:m},w=new Set(e.pages.map(x=>x.url)),I=new Set(t.pages.map(x=>x.url)),_=[...w].filter(x=>I.has(x)).length,N=[];(e.partial||e.truncated)&&N.push("incomplete-before"),(t.partial||t.truncated)&&N.push("incomplete-after"),e.configurationHash!==t.configurationHash&&N.push("configuration-changed"),e.config.includeQuery!==t.config.includeQuery&&N.push("url-policy-changed"),e.ruleSetVersion!==t.ruleSetVersion&&N.push("rule-set-changed"),e.generatedAt===t.generatedAt&&N.push("same-timestamp"),(JSON.stringify(e.config.enabledRules)!==JSON.stringify(n.enabledRules)||JSON.stringify(e.config.severityOverrides)!==JSON.stringify(n.severityOverrides)||JSON.stringify(e.config.suppressions)!==JSON.stringify(n.suppressions))&&N.push("evaluation-policy-changed");let L=[...y.newIssues.map(x=>({lifecycle:"new",issue:x})),...y.ongoingIssues.map(x=>({lifecycle:"ongoing",issue:x})),...y.resolvedIssues.map(x=>({lifecycle:"resolved",issue:x})),...y.unchangedIssues.map(x=>({lifecycle:"unchanged",issue:x}))],B=Bt(),R={error:Bt(),warning:Bt(),info:Bt()};for(let x of L)B[x.lifecycle]+=1,R[x.issue.severity][x.lifecycle]+=1;let P=vt([...new Set([...w,...I])]),G=new Map(P.flatMap(x=>x.urls.map(D=>[D,x.origin+x.template])));return{diff:y,summary:{schemaVersion:1,evaluatedAt:r.evaluatedAt,from:Hi(e),to:Hi(t),coverage:{common:_,onlyBefore:w.size-_,onlyAfter:I.size-_,complete:!(e.partial||e.truncated||t.partial||t.truncated)},evaluationPolicy:{source:"after",enabledRules:n.enabledRules?[...n.enabledRules]:null,severityOverrides:{...n.severityOverrides},suppressions:n.suppressions.map(x=>({...x})),regressionBudgets:{...n.regressionBudgets}},warnings:N,beforeFindings:Qi(o),afterFindings:Qi(d),lifecycle:B,lifecycleBySeverity:R,budgetExceeded:y.budgetExceeded,byRule:Yi(L,x=>x.ruleId),byTemplate:Yi(L,x=>x.scope==="site"?"@site":G.get(x.url)??"@unknown"),unverified:h.sort((x,D)=>x.url.localeCompare(D.url)||x.ruleId.localeCompare(D.ruleId))}}}function K(e,t,r,n,s="count",a){return{id:e,label:t,value:r,unit:s,source:{id:"crawl",label:"SEO Crawl Audit"},observedAt:n,confidence:"high",status:"available",...a?{detail:a}:{}}}function Gi(e,t,r,n,s){return{id:e,label:t,value:null,unit:"count",source:r,observedAt:n,confidence:"high",status:"not-connected",...s?{detail:s}:{}}}function Iu(e,t,r,n,s){return{id:e,label:t,value:r,unit:"count",source:{id:"crawl-estimate",label:"SEO Crawl Audit"},observedAt:n,confidence:"low",status:"estimate",...s?{detail:s}:{}}}function Wi(e){return[e.robots,e.xRobotsTag].some(t=>/(^|[\s,])noindex($|[\s,])/i.test(t??""))}function Rn(e,t){if(Array.isArray(e))return e.reduce((a,c)=>a+Rn(c,t),0);if(!e||typeof e!="object")return 0;let r=e,n=r["@type"];return(Array.isArray(n)?n.filter(a=>a===t).length:n===t?1:0)+Object.entries(r).filter(([a])=>a!=="@type").reduce((a,[,c])=>a+Rn(c,t),0)}function wr(e,t,r){return e.filter(n=>n.status!==null&&n.status>=t&&n.status<=r).length}function rt(e){let t=e.pages,r=e.generatedAt,n=t.filter(f=>/(?:text\/html|application\/xhtml\+xml)/i.test(f.contentType??"")),s=t.filter(Wi),a=n.filter(f=>!f.error&&!f.blockedByRobots&&f.status!==null&&f.status>=200&&f.status<300&&!Wi(f)),c=e.sitemap?.urls.length??0,l=c>t.length&&t.length>0?Math.min(c,Math.round(a.length/t.length*c)):a.length,o=new Set(t.flatMap(f=>f.images.map(m=>m.src).filter(m=>!!m))),d=t.reduce((f,m)=>f+m.jsonLd.reduce((y,w)=>y+(w.valid?Rn(w.value,"Product"):0),0),0),p=t.reduce((f,m)=>f+m.responseBytes,0),h=t.length>0?Math.round(e.statistics.durationMs/t.length):0;return{schemaVersion:1,siteUrl:e.siteUrl,observedAt:r,metrics:[K("pages.sitemap",{en:"Sitemap URLs",uk:"URL \u0443 sitemap"},c,r),K("pages.checked",{en:"Pages checked",uk:"\u041F\u0435\u0440\u0435\u0432\u0456\u0440\u0435\u043D\u043E \u0441\u0442\u043E\u0440\u0456\u043D\u043E\u043A"},t.length,r),K("pages.html",{en:"HTML pages",uk:"HTML-\u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0438"},n.length,r),K("pages.indexable",{en:"Crawlable HTML pages",uk:"\u0414\u043E\u0441\u0442\u0443\u043F\u043D\u0456 HTML-\u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0438"},a.length,r,"count",{en:"Successful HTML pages without a detected noindex directive. This is not the Google index count.",uk:"\u0423\u0441\u043F\u0456\u0448\u043D\u0456 HTML-\u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0438 \u0431\u0435\u0437 \u0432\u0438\u044F\u0432\u043B\u0435\u043D\u043E\u0457 \u0434\u0438\u0440\u0435\u043A\u0442\u0438\u0432\u0438 noindex. \u0426\u0435 \u043D\u0435 \u043A\u0456\u043B\u044C\u043A\u0456\u0441\u0442\u044C \u0441\u0442\u043E\u0440\u0456\u043D\u043E\u043A \u0432 \u0456\u043D\u0434\u0435\u043A\u0441\u0456 Google."}),Iu("search.indexable-estimate",{en:"Estimated indexable pages",uk:"\u041E\u0440\u0456\u0454\u043D\u0442\u043E\u0432\u043D\u0430 \u043A\u0456\u043B\u044C\u043A\u0456\u0441\u0442\u044C \u0456\u043D\u0434\u0435\u043A\u0441\u043E\u0432\u0430\u043D\u0438\u0445 \u0441\u0442\u043E\u0440\u0456\u043D\u043E\u043A"},l,r,{en:"Estimated from the crawlable-page ratio and sitemap size. This is not the number indexed by Google.",uk:"\u041E\u0446\u0456\u043D\u043A\u0430 \u0437\u0430 \u0447\u0430\u0441\u0442\u043A\u043E\u044E \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0438\u0445 \u0434\u043B\u044F \u0456\u043D\u0434\u0435\u043A\u0441\u0430\u0446\u0456\u0457 \u0441\u0442\u043E\u0440\u0456\u043D\u043E\u043A \u0456 \u0440\u043E\u0437\u043C\u0456\u0440\u043E\u043C sitemap. \u0426\u0435 \u043D\u0435 \u043A\u0456\u043B\u044C\u043A\u0456\u0441\u0442\u044C \u0441\u0442\u043E\u0440\u0456\u043D\u043E\u043A \u0432 \u0456\u043D\u0434\u0435\u043A\u0441\u0456 Google."}),Gi("search.google-indexed",{en:"Indexed by Google",uk:"\u041F\u0440\u043E\u0456\u043D\u0434\u0435\u043A\u0441\u043E\u0432\u0430\u043D\u043E Google"},{id:"google-search-console",label:"Google Search Console"},r,{en:"Connect an authoritative provider to confirm this value; crawlability is not proof of indexing.",uk:"\u041F\u0456\u0434\u043A\u043B\u044E\u0447\u0456\u0442\u044C \u0430\u0432\u0442\u043E\u0440\u0438\u0442\u0435\u0442\u043D\u0435 \u0434\u0436\u0435\u0440\u0435\u043B\u043E \u0434\u043B\u044F \u043F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u0436\u0435\u043D\u043D\u044F; \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0456\u0441\u0442\u044C \u0434\u043B\u044F crawl \u043D\u0435 \u0434\u043E\u0432\u043E\u0434\u0438\u0442\u044C \u0456\u043D\u0434\u0435\u043A\u0441\u0430\u0446\u0456\u044E."}),Gi("search.bing-indexed",{en:"Indexed by Bing",uk:"\u041F\u0440\u043E\u0456\u043D\u0434\u0435\u043A\u0441\u043E\u0432\u0430\u043D\u043E Bing"},{id:"bing-webmaster",label:"Bing Webmaster Tools"},r,{en:"Connect an authoritative provider to confirm this value.",uk:"\u041F\u0456\u0434\u043A\u043B\u044E\u0447\u0456\u0442\u044C \u0430\u0432\u0442\u043E\u0440\u0438\u0442\u0435\u0442\u043D\u0435 \u0434\u0436\u0435\u0440\u0435\u043B\u043E \u0434\u043B\u044F \u043F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u0436\u0435\u043D\u043D\u044F \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F."}),K("pages.noindex",{en:"Noindex pages",uk:"\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0438 noindex"},s.length,r),K("pages.robots-blocked",{en:"Blocked by robots.txt",uk:"\u0417\u0430\u0431\u043B\u043E\u043A\u043E\u0432\u0430\u043D\u043E robots.txt"},t.filter(f=>f.blockedByRobots).length,r),K("assets.images",{en:"Unique images",uk:"\u0423\u043D\u0456\u043A\u0430\u043B\u044C\u043D\u0456 \u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u043D\u044F"},o.size,r),K("commerce.products",{en:"Product entities",uk:"\u0422\u043E\u0432\u0430\u0440\u0438 Product"},d,r),K("links.internal",{en:"Internal links",uk:"\u0412\u043D\u0443\u0442\u0440\u0456\u0448\u043D\u0456 \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F"},e.linkGraph.internalEdges,r),K("links.external",{en:"External links",uk:"\u0417\u043E\u0432\u043D\u0456\u0448\u043D\u0456 \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F"},e.linkGraph.externalEdges,r),K("crawl.max-depth",{en:"Maximum crawl depth",uk:"\u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u0430 \u0433\u043B\u0438\u0431\u0438\u043D\u0430"},Math.max(0,...t.map(f=>f.depth)),r),K("crawl.transfer",{en:"HTML transferred",uk:"\u041F\u0435\u0440\u0435\u0434\u0430\u043D\u043E HTML"},p,r,"bytes"),K("crawl.average-time",{en:"Average crawl time per page",uk:"\u0421\u0435\u0440\u0435\u0434\u043D\u0456\u0439 \u0447\u0430\u0441 \u043D\u0430 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0443"},h,r,"milliseconds"),K("status.2xx",{en:"HTTP 2xx",uk:"HTTP 2xx"},wr(t,200,299),r),K("status.3xx",{en:"HTTP 3xx",uk:"HTTP 3xx"},wr(t,300,399),r),K("status.4xx",{en:"HTTP 4xx",uk:"HTTP 4xx"},wr(t,400,499),r),K("status.5xx",{en:"HTTP 5xx",uk:"HTTP 5xx"},wr(t,500,599),r)]}}function nt(e,t={}){return me(e,t)}function Ln(e,t,r={}){return Ye(e,t,r)}import{access as Nu,mkdir as _u,readFile as kn,readdir as Ru,rename as Ji,writeFile as ji}from"node:fs/promises";import{randomUUID as Bn}from"node:crypto";import{join as Vi,resolve as Sr}from"node:path";var yu=Object.freeze({"search.google-site-estimate":["google-site-search","google-site-search-manual"],"domain.registration-date":["rdap"],"domain.expiration-date":["rdap"],"domain.registrar":["rdap"]});function wu(e){return yu[e.id]?.includes(e.source.id)===!0}function xr(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} must be an object`);return e}function Ce(e,t){if(typeof e!="string"||e==="")throw new Error(`${t} must be a non-empty string`);return e}function Ki(e,t){let r=xr(e,t);return{en:Ce(r.en,`${t}.en`),uk:Ce(r.uk,`${t}.uk`)}}function xu(e,t){let r=xr(e,`metrics[${t}]`),n=["count","bytes","milliseconds","date","text"],s=["high","medium","low"],a=["available","estimate","unavailable","not-connected","error"],c=xr(r.source,`metrics[${t}].source`);if(!n.includes(String(r.unit)))throw new Error(`metrics[${t}].unit is invalid`);if(!s.includes(String(r.confidence)))throw new Error(`metrics[${t}].confidence is invalid`);if(!a.includes(String(r.status)))throw new Error(`metrics[${t}].status is invalid`);if(r.value!==null&&typeof r.value!="string"&&typeof r.value!="number")throw new Error(`metrics[${t}].value must be a number, string, or null`);let l=Ce(r.observedAt,`metrics[${t}].observedAt`);if(Number.isNaN(Date.parse(l)))throw new Error(`metrics[${t}].observedAt must be an ISO date`);let o=c.url===void 0?void 0:Ce(c.url,`metrics[${t}].source.url`);return{id:Ce(r.id,`metrics[${t}].id`),label:Ki(r.label,`metrics[${t}].label`),value:r.value,unit:r.unit,source:{id:Ce(c.id,`metrics[${t}].source.id`),label:Ce(c.label,`metrics[${t}].source.label`),...o?{url:o}:{}},observedAt:l,confidence:r.confidence,status:r.status,...r.stale===!0?{stale:!0}:{},...r.detail===void 0?{}:{detail:Ki(r.detail,`metrics[${t}].detail`)}}}function On(e){let t=xr(e,"site metrics state");if(t.schemaVersion!==1)throw new Error("site metrics state schemaVersion must be 1");let r=Ce(t.siteUrl,"site metrics state.siteUrl"),n=new URL(r);if(!["http:","https:"].includes(n.protocol))throw new Error("site metrics state.siteUrl must use HTTP(S)");let s=Ce(t.updatedAt,"site metrics state.updatedAt");if(Number.isNaN(Date.parse(s)))throw new Error("site metrics state.updatedAt must be an ISO date");if(!Array.isArray(t.metrics))throw new Error("site metrics state.metrics must be an array");return{schemaVersion:1,siteUrl:n.href,updatedAt:s,metrics:t.metrics.map(xu)}}function Su(e){return e.source.id==="rdap"?6048e5:e.id==="search.google-site-estimate"?2592e6:null}function vn(e,t=new Date){let r=t.getTime();return{...e,metrics:e.metrics.map(n=>{let s=Su(n);return s!==null&&r-Date.parse(n.observedAt)>s?{...n,stale:!0}:{...n,stale:!1}})}}function Dn(e,t){if(!t||new URL(e.siteUrl).origin!==new URL(t.siteUrl).origin)return e;let r=t.metrics.filter(wu),n=new Map(r.map(a=>[a.id,a])),s=new Set(e.metrics.map(a=>a.id));return{...e,observedAt:t.updatedAt>e.observedAt?t.updatedAt:e.observedAt,metrics:[...e.metrics.map(a=>a.source.id==="crawl"?a:n.get(a.id)??a),...r.filter(a=>!s.has(a.id))]}}async function Nr(e=process.cwd()){let t=Sr(e,Gr);try{return await Nu(t),t}catch{return null}}async function Pt(e){let t=e?Sr(e):await Nr();if(!t)return{};try{return Wr(JSON.parse(await kn(t,"utf8")))}catch(r){throw new Error(`invalid config ${t}: ${r instanceof Error?r.message:String(r)}`,{cause:r})}}async function _r(e,t){let r=`${e}.${process.pid}.${Bn()}.tmp`;await ji(r,`${JSON.stringify(t,null,2)}
182
- `,"utf8"),await Ji(r,e)}async function Se(e){try{return ye(JSON.parse(await kn(e,"utf8")))}catch(t){throw t instanceof SyntaxError?new Error(`invalid snapshot JSON: ${e}`,{cause:t}):t instanceof Error&&t.message.startsWith("unsupported")?new Error(`unsupported or invalid baseline: ${e}`,{cause:t}):t}}async function $i(e,t,r=new Date){let n;try{n=JSON.parse(await kn(e,"utf8"))}catch(a){if(a&&typeof a=="object"&&"code"in a&&a.code==="ENOENT")return null;throw a instanceof SyntaxError?new Error(`invalid site metrics JSON: ${e}`,{cause:a}):a}let s=vn(On(n),r);return t&&new URL(s.siteUrl).origin!==new URL(t).origin?null:s}async function Pn(e,t,r={}){let n=rt(e);try{return Dn(n,await $i(t,e.siteUrl,r.now))}catch(s){return r.onWarning?.(`Could not load site metrics from ${t}: ${s instanceof Error?s.message:String(s)}`),n}}async function Rr(e,t,r={}){let n=`${e}.${process.pid}.${Bn()}.tmp`;await ji(n,Fi(t,r),"utf8"),await Ji(n,e)}function Lu(e){return`${e.generatedAt.replaceAll(":","-").replaceAll(".","-")}-${e.configurationHash.slice(0,8)}-${Bn()}.snapshot.json`}async function Mn(e,t){let r=Sr(e);await _u(r,{recursive:!0});let n=Vi(r,Lu(t));return await _r(n,t),n}async function Mt(e,t){let r=Sr(e),n;try{n=await Ru(r)}catch(a){if(a&&typeof a=="object"&&"code"in a&&a.code==="ENOENT")return[];throw a}let s=[];for(let a of n.filter(c=>c.endsWith(".snapshot.json")).sort()){let c=Vi(r,a),l=await Se(c);(!t||l.siteUrl===t)&&s.push({path:c,snapshot:l})}return s.sort((a,c)=>a.snapshot.generatedAt.localeCompare(c.snapshot.generatedAt)||a.path.localeCompare(c.path))}import{appendFile as Ou,rename as vu,stat as Zi,unlink as Du,writeFile as ku}from"node:fs/promises";import{createReadStream as zi}from"node:fs";import{createInterface as qi}from"node:readline";function Bu(e){return{type:"seo-audit-checkpoint",schemaVersion:2,identity:e}}function Xi(e,t){if(!e||typeof e!="object")return!1;let r=e;if(r.type!=="seo-audit-checkpoint")return!1;if(r.schemaVersion===2)return JSON.stringify(r.identity)===JSON.stringify(t);if(r.schemaVersion!==1)return!1;let n=r.source;return n?.startUrl===t.siteUrl&&(n.sitemap??null)===t.sitemapUrl&&(n.includeQuery??!1)===t.includeQuery&&(n.respectRobots??!0)===t.respectRobots}var Lr=class{path;#e=null;#t=Promise.resolve();constructor(t){this.path=t}async#r(t){let r=`${this.path}.${process.pid}.${Date.now()}.tmp`;await ku(r,`${JSON.stringify(Bu(t))}
183
- `,"utf8"),await vu(r,this.path),this.#e=t}async load(t){await this.flush();try{await Zi(this.path)}catch(d){if(d.code!=="ENOENT")throw d;return await this.#r(t),null}let r=zi(this.path,{encoding:"utf8"}),n=qi({input:r,crlfDelay:1/0}),s=new Map,a,c=0,l=null,o=(d,p)=>{try{let h=JSON.parse(d);h.type==="page"&&typeof h.page?.url=="string"&&s.set(h.page.url,h.page)}catch(h){throw new Error(`corrupt checkpoint record ${p} in ${this.path}`,{cause:h})}};for await(let d of n){if(c+=1,c===1){try{a=JSON.parse(d)}catch{a=null}if(!Xi(a,t))return n.close(),r.destroy(),await this.#r(t),null;this.#e=t;continue}d.trim()&&(l&&o(l.line,l.lineNumber),l={line:d,lineNumber:c})}if(c===0||!Xi(a,t))return await this.#r(t),null;if(l)try{o(l.line,l.lineNumber)}catch{}return{identity:t,pages:[...s.values()]}}append(t,r){return this.#t=this.#t.then(async()=>{(!this.#e||JSON.stringify(this.#e)!==JSON.stringify(t))&&await this.#r(t),await Ou(this.path,`${JSON.stringify({type:"page",page:r})}
184
- `,"utf8")}),this.#t}async clear(t){if(await this.flush(),!(this.#e&&JSON.stringify(this.#e)!==JSON.stringify(t))){try{await Du(this.path)}catch(r){if(r.code!=="ENOENT")throw r}this.#e=null}}async clearCurrent(){this.#e&&await this.clear(this.#e)}async flush(){await this.#t}};function Un(e){return new Lr(e)}async function Fn(e){let t;try{t=(await Zi(e)).mtime.toISOString()}catch(f){if(f.code==="ENOENT")return{path:e,status:"missing",schemaVersion:null,siteUrl:null,completedPages:0,updatedAt:null,resumable:!1,message:null};throw f}let r=zi(e,{encoding:"utf8"}),n=qi({input:r,crlfDelay:1/0}),s,a=new Set,c=0,l=null,o=(f,m)=>{try{let y=JSON.parse(f);y.type==="page"&&typeof y.page?.url=="string"&&a.add(y.page.url)}catch{return{path:e,status:"corrupt",schemaVersion:null,siteUrl:null,completedPages:a.size,updatedAt:t,resumable:!1,message:`checkpoint record ${m} is corrupt`}}return null};for await(let f of n){if(c+=1,c===1){try{s=JSON.parse(f)}catch{s=null}continue}if(f.trim()){if(l){let m=o(l.line,l.lineNumber);if(m)return m}l={line:f,lineNumber:c}}}if(!s)return{path:e,status:"corrupt",schemaVersion:null,siteUrl:null,completedPages:0,updatedAt:t,resumable:!1,message:"checkpoint header is not valid JSON"};if(typeof s!="object"||s.type!=="seo-audit-checkpoint")return{path:e,status:"incompatible",schemaVersion:null,siteUrl:null,completedPages:0,updatedAt:t,resumable:!1,message:"file is not an SEO Crawl Audit checkpoint"};let d=s,p=d.schemaVersion===1||d.schemaVersion===2?d.schemaVersion:null;if(p===null)return{path:e,status:"incompatible",schemaVersion:null,siteUrl:null,completedPages:0,updatedAt:t,resumable:!1,message:"checkpoint schema is not supported"};let h=p===2?d.identity?.siteUrl??null:d.source?.startUrl??null;if(l)try{let f=JSON.parse(l.line);f.type==="page"&&typeof f.page?.url=="string"&&a.add(f.page.url)}catch{}return{path:e,status:"ready",schemaVersion:p,siteUrl:h,completedPages:a.size,updatedAt:t,resumable:a.size>0,message:null}}import{extname as Pu}from"node:path";function Or(e){let t=Pu(e);return t?`${e.slice(0,-t.length)}.checkpoint.ndjson`:`${e}.checkpoint.ndjson`}import{parseArgs as Mu}from"node:util";function ea(e){return Mu({args:e,allowPositionals:!0,strict:!0,options:{baseline:{type:"string"},config:{type:"string"},output:{type:"string"},report:{type:"string"},"no-report":{type:"boolean"},"no-cache":{type:"boolean"},pages:{type:"string"},all:{type:"boolean"},"max-pages":{type:"string"},concurrency:{type:"string"},delay:{type:"string"},timeout:{type:"string"},sitemap:{type:"string"},"no-sitemap":{type:"boolean"},"include-query":{type:"boolean"},"ignore-robots":{type:"boolean"},strict:{type:"boolean"},json:{type:"boolean"},help:{type:"boolean"},version:{type:"boolean"},production:{type:"string"},preview:{type:"string"},"headers-env":{type:"string"},"production-headers-env":{type:"string"},"preview-headers-env":{type:"string"},"history-dir":{type:"string"},"no-history":{type:"boolean"},from:{type:"string"},to:{type:"string"},directory:{type:"string"},workflow:{type:"string"},yes:{type:"boolean"},force:{type:"boolean"},offline:{type:"boolean"},platform:{type:"string"},port:{type:"string"},"no-open":{type:"boolean"},render:{type:"string"}}})}function ta(e,t){return{...e,__config:t}}function vr(e,t,r,n=!1){if(e===void 0)return r;let s=Number.parseInt(e,10);if(!Number.isInteger(s)||s<(n?0:1))throw new Error(`${t} must be a ${n?"non-negative":"positive"} integer`);return s}function Ut(e,t,r){if(t.sitemap&&t["no-sitemap"])throw new Error("--sitemap and --no-sitemap cannot be used together");let n=r?.config??{},s=t.__config??{},a={url:e,schemaVersion:1,maxPages:vr(t.pages??t["max-pages"],t.pages!==void 0?"--pages":"--max-pages",s.maxPages??n.maxPages??100),concurrency:vr(t.concurrency,"--concurrency",s.concurrency??n.concurrency??5),delay:vr(t.delay,"--delay",s.delay??n.delay??100,!0),timeout:vr(t.timeout,"--timeout",s.timeout??n.timeout??1e4)};return t["no-sitemap"]?a.sitemap="none":t.sitemap&&(a.sitemap=t.sitemap),t["include-query"]!==void 0&&(a.includeQuery=t["include-query"]),t["ignore-robots"]!==void 0&&(a.respectRobots=!t["ignore-robots"]),Te(a,s,n)}import{dirname as la,join as da,resolve as ie}from"node:path";import{Buffer as Uu}from"node:buffer";async function Fu(e){if(e)return e;try{return await import("playwright")}catch(t){throw new Error("Playwright is not installed. Run: npm install --save-dev playwright && npx playwright install chromium",{cause:t})}}function Hu(e){let t=0,r=[];return async function(){return t>=e&&await new Promise(s=>r.push(s)),t+=1,()=>{t-=1,r.shift()?.()}}}async function Qu(e){let t=[],r=e.request().redirectedFrom();for(;r;){let n=await r.response(),s=await n?.headers();t.unshift({url:r.url(),status:n?.status()??0,location:s?.location??null}),r=r.redirectedFrom()}return t}async function ra(e={}){let t=e.concurrency??2;if(!Number.isInteger(t)||t<1)throw new Error("Playwright renderer concurrency must be a positive integer");let r=await Fu(e.playwright),n;try{n=await r.chromium.launch({headless:e.headless??!0})}catch(o){throw new Error("Chromium could not start. Run: npx playwright install chromium",{cause:o})}let s=null,a=null,c=Hu(t),l=!1;return{id:"playwright-chromium-v1",async render(o){if(l)throw new Error("Playwright renderer is closed");let d=await c(),p=null;try{if(o.signal?.throwIfAborted(),!s)s=await n.newContext({userAgent:o.userAgent,acceptDownloads:!1}),a=o.userAgent;else if(a!==o.userAgent)throw new Error("A Playwright renderer cannot mix user agents in one browser context");p=await s.newPage(),await p.route("**/*",async f=>{f.request().resourceType()==="media"?await f.abort():await f.continue()}),p.on("download",f=>{f.cancel()});let h=()=>{p?.close()};o.signal?.addEventListener("abort",h,{once:!0});try{let f=await p.goto(o.url,{waitUntil:"domcontentloaded",timeout:o.timeout});if(!f)throw new Error(`Playwright did not receive a document response for ${o.url}`);if((e.networkIdleTimeout??2e3)>0)try{await p.waitForLoadState("networkidle",{timeout:Math.min(o.timeout,e.networkIdleTimeout??2e3)})}catch(I){if(o.signal?.aborted)throw I}o.signal?.throwIfAborted();let m=await p.content(),y=Uu.byteLength(m);if(y>o.maxResponseBytes)throw new Error(`rendered HTML exceeds ${o.maxResponseBytes} bytes`);let w=await f.headers();return{finalUrl:p.url(),status:f.status(),headers:w,html:m,responseBytes:y,redirectChain:await Qu(f)}}finally{o.signal?.removeEventListener("abort",h)}}finally{await p?.close().catch(()=>{}),d()}},async close(){l||(l=!0,await s?.close(),await n.close())}}}var Yu=process.stdout.isTTY&&!process.env.NO_COLOR;function Dr(e,t){return Yu?`\x1B[${e}m${t}\x1B[0m`:t}function Ft(e){return e.reduce((t,r)=>(t[r.severity]+=1,t),{error:0,warning:0,info:0})}function kr(e){if(e.length===0){console.log(Dr("32","\u2713 No SEO regressions detected."));return}for(let r of e){let n=r.severity==="error"?Dr("31","\u2716 error"):r.severity==="warning"?Dr("33","\u26A0 warning"):Dr("34","\u2139 info");console.log(`${n} ${r.rule} ${r.url}`),console.log(` ${r.message}`),(r.before!==void 0||r.after!==void 0)&&(console.log(` before: ${JSON.stringify(r.before)}`),console.log(` after: ${JSON.stringify(r.after)}`))}let t=Ft(e);console.log(`
185
- ${t.error} error(s), ${t.warning} warning(s) detected.`)}import{createHash as Gu}from"node:crypto";function Br(e){if(!e)return{};let t=process.env[e];if(!t)throw new Error(`environment variable ${e} is empty or missing`);let r;try{r=JSON.parse(t)}catch(s){throw new Error(`environment variable ${e} must contain a JSON object`,{cause:s})}if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`environment variable ${e} must contain a JSON object`);let n={};for(let[s,a]of Object.entries(r)){if(typeof a!="string")throw new Error(`header ${s} in ${e} must be a string`);try{new Headers({[s]:a})}catch(c){throw new Error(`header ${s} in ${e} is invalid`,{cause:c})}n[s]=a}return n}function Hn(e,t,r=globalThis.fetch){if(Object.keys(e).length===0)return r;let n=new URL(t).origin;return(s,a)=>{let c=s instanceof Request?s.url:String(s);if(new URL(c).origin!==n)return r(s,a);let l=new Headers(s instanceof Request?s.headers:void 0);new Headers(a?.headers).forEach((o,d)=>l.set(d,o));for(let[o,d]of Object.entries(e))l.set(o,d);return r(s,{...a,headers:l})}}function Ht(e,t,r=globalThis.fetch){return Hn(Br(e),t,r)}function Qn(e,t){if(!t)return e;let r=Gu("sha256").update(t).digest("hex").slice(0,12);return e.endsWith(".ndjson")?`${e.slice(0,-7)}.auth-${r}.ndjson`:`${e}.auth-${r}`}import{createInterface as Wu}from"node:readline/promises";function sa(e,t){let r=e.trim().toLowerCase();if(r===""||r==="1")return{mode:"fixed",target:Math.min(100,t)};if(r==="2"||r==="all")return{mode:"all",target:t};if(r==="3"||r==="step")return{mode:"step",target:t};let n=Number.parseInt(r,10);return/^\d+$/.test(r)&&n>0?{mode:"fixed",target:Math.min(n,t)}:null}async function Fe(e){let t=Wu({input:process.stdin,output:process.stdout});try{return(await t.question(e)).trim()}finally{t.close()}}async function ia(e){for(;;){console.log(`
186
- Sitemap contains ${e.toLocaleString("en-US")} page(s).`),console.log("How many pages should be scanned?"),console.log(" 1) First 100"),console.log(` 2) All ${e.toLocaleString("en-US")}`),console.log(" 3) 100 at a time with confirmation"),console.log(" Or enter an exact number, for example 500.");let t=sa(await Fe("Choose [1]: "),e);if(!t){console.log("Enter 1, 2, 3, all, step, or a positive number.");continue}if(t.mode==="all"){let r=await Fe(`This will request ${e.toLocaleString("en-US")} pages. Continue? [y/N] `);if(!["y","yes"].includes(r.toLowerCase()))continue}return t}}function na(e){let t=Math.max(0,Math.round(e/1e3));if(t<60)return`${t}s`;let r=Math.floor(t/60),n=t%60;return`${r}m ${n}s`}function Ku(e,t,r){let n=t===0?1:Math.min(e/t,1),s=(n*100).toFixed(n<.1?1:0),a=Math.round(n*20),c=`[${"\u2588".repeat(a)}${"\u2591".repeat(20-a)}] ${s}% \xB7 ${e.toLocaleString("en-US")} / ${t.toLocaleString("en-US")} pages`;if(!r)return c;let l=r.elapsedMs/6e4,o=l>0?e/l:0,d=Math.max(0,t-e),p=o>0?d/o*6e4:null,h=[`elapsed ${na(r.elapsedMs)}`,`${o.toFixed(o<10?1:0)} pages/min`,`ETA ${p===null?"\u2014":na(p)}`,`retries ${r.retries}`,`errors ${r.errors}`];if(r.currentUrl){let f=r.currentUrl.length>60?`${r.currentUrl.slice(0,57)}\u2026`:r.currentUrl;h.push(f)}return`${c} \xB7 ${h.join(" \xB7 ")}`}function Qt(e,t,r=!1,n=process.stdout,s){let a=Ku(e,t,s),c=n===process.stderr?console.error:console.log;n.isTTY&&!r?(n.write(`\r${a}`),e>=t&&n.write(`
187
- `)):(n.isTTY||e>=t||e%1e3===0)&&c(a)}function aa(e,t,r,n=process.stdout){let s=e.sitemap?`found, ${(e.candidateCount??e.sitemap.urls.length).toLocaleString("en-US")} URL(s)`:"not found; internal links",a=["Scan plan",` Target: ${e.startUrl}`,` Sitemap: ${s}`,` Robots: ${e.config.respectRobots?"respected":"ignored"}`,` Limit: ${t.target.toLocaleString("en-US")} page(s)`,` Concurrency: ${e.config.concurrency}`,` Delay: ${e.config.delay} ms`,` Checkpoint: ${r?"enabled":"disabled"}`];t.target>1e3&&a.push(" Notice: this is a large scan and may take a long time."),le(a.join(`
188
- `),n)}function oa(e,t,r=process.stdout,n=Date.now){let s=n(),a=0,c=0,l=new Set;return{retry(){a+=1},progress(o,d){(o.error||o.status!==null&&o.status>=400)&&!l.has(o.url)&&(l.add(o.url),c+=1);let p=(()=>{try{return new URL(o.url).pathname||"/"}catch{return o.url}})();Qt(d,e,t,r,{elapsedMs:n()-s,retries:a,errors:c,currentUrl:p})}}}function le(e,t=process.stdout){t.isTTY&&t.write("\r\x1B[2K"),t===process.stderr?console.error(e):console.log(e)}function Yn(e){return e.reduce((t,r)=>((r.error||r.blockedByRobots||(r.status??500)>=400)&&(t.unavailable+=1),r.title||(t.missingTitle+=1),r.description||(t.missingDescription+=1),r.canonical||(t.missingCanonical+=1),r.h1Count===0&&(t.missingH1+=1),/(^|[\s,])noindex($|[\s,])/i.test(r.robots??"")&&(t.noindex+=1),t),{unavailable:0,missingTitle:0,missingDescription:0,missingCanonical:0,missingH1:0,noindex:0})}function Gn(e){console.log(`Current health: ${e.unavailable} unavailable, ${e.missingTitle} missing title, ${e.missingDescription} missing description, ${e.missingCanonical} missing canonical, ${e.missingH1} missing H1, ${e.noindex} noindex.`)}var Yt=".seo-audit.json",ua="seo-audit-report.html",ca=".seo-audit/history";function Mr(e){if(e.render!==void 0&&e.render!=="http"&&e.render!=="playwright")throw new Error("--render must be http or playwright")}async function Pr(e){if(Mr(e),(e.render??"http")!=="http")return ra()}async function Aa(e,t){let r=ie(e??t.output??Yt),n=Qn(Or(r),t["headers-env"]),s=await Fn(n),a=null;try{a=await Se(r)}catch(l){if(l.code!=="ENOENT")throw l}let c={command:"status",snapshot:a?{path:r,siteUrl:a.siteUrl,pages:a.pages.length,generatedAt:a.generatedAt,partial:a.partial,truncated:a.truncated}:null,checkpoint:s};return t.json?(console.log(JSON.stringify(c,null,2)),0):(console.log("SEO Crawl Audit status"),a?(console.log(` Snapshot: ${r}`),console.log(` Site: ${a.siteUrl}`),console.log(` Last completed result: ${a.pages.length.toLocaleString("en-US")} page(s) at ${a.generatedAt}`)):console.log(` Snapshot: not found (${r})`),s.status==="missing"?console.log(` Checkpoint: not found (${n})`):(console.log(` Checkpoint: ${s.status} (${n})`),s.siteUrl&&console.log(` Checkpoint site: ${s.siteUrl}`),console.log(` Saved pages: ${s.completedPages.toLocaleString("en-US")}`),s.updatedAt&&console.log(` Updated: ${s.updatedAt}`),s.message&&console.log(` Detail: ${s.message}`),s.resumable&&console.log(" Resume: run the same scan command again to reuse saved pages.")),0)}function pa(e,t=!1){return t||!e["no-report"]&&(e.report!==void 0||process.stdin.isTTY&&process.stdout.isTTY&&!e.json)}async function st(e,t,r=!1){if(!pa(e,r))return null;let n=ie(e.report??ua);return await Rr(n,t),n}function oe(e,t,r){if(!e)return e;try{let n=new URL(t),s=new URL(r),a=new URL(e);if(a.origin!==n.origin)return e;a.protocol=s.protocol,a.host=s.host;let c=n.pathname.replace(/\/$/,""),l=s.pathname.replace(/\/$/,"");return c&&a.pathname.startsWith(c)&&(a.pathname=`${l}${a.pathname.slice(c.length)}`||"/"),a.href}catch{return e}}function Ju(e,t,r){let n=s=>s.map(a=>oe(a,t,r)??a).sort();return{...e,url:oe(e.url,t,r)??e.url,finalUrl:oe(e.finalUrl,t,r),canonical:oe(e.canonical,t,r),canonicalRaw:oe(e.canonicalRaw,t,r),links:n(e.links),internalLinks:n(e.internalLinks),externalLinks:n(e.externalLinks),images:e.images.map(s=>({...s,src:oe(s.src,t,r)})),hreflang:e.hreflang.map(s=>({...s,url:oe(s.url,t,r)})),redirectChain:e.redirectChain.map(s=>({...s,url:oe(s.url,t,r)??s.url,location:oe(s.location,t,r)}))}}function ju(e,t,r=nt(e),n={}){return{mode:t,startUrl:e.siteUrl,generatedAt:e.generatedAt,pages:e.pages,pageDetails:e.pages,issues:r,partial:e.partial,complete:!e.partial&&!e.truncated,engineVersion:e.engineVersion,ruleSetVersion:e.ruleSetVersion,branding:e.config.report,siteMetrics:rt(e),...n}}async function He(e,t,r,n,s={}){let a=da(la(n),".seo-audit.metrics.json"),c=await Pn(e,a,{onWarning:l=>console.error(`Warning: ${l}`)});return ju(e,t,r,{...s,siteMetrics:c})}function ha(e,t){return e["history-dir"]?ie(e["history-dir"]):t?da(la(t),ca):ie(ca)}async function Wn(e,t,r,n){if(e["no-history"])return;let s=ha(e,r);n&&!t.partial&&await Mn(s,t);let a=await Mt(s,t.siteUrl);return kt(a.map(c=>c.snapshot))??void 0}async function Vu(e,t,r,n,s){let a=Ut(e,t,r),c=t.json?process.stderr:process.stdout,l=d=>{d.type==="plan-start"&&le(`Preparing crawl plan for ${d.url}`,c),d.type==="robots"&&le(d.robots.error?`robots.txt check failed: ${d.robots.error}`:`robots.txt checked (${d.robots.status??"unknown status"})`,c),d.type==="sitemap"&&le(d.sitemap?`Sitemap loaded: ${d.candidateCount??d.sitemap.urls.length} candidate URL(s)`:"No sitemap found; internal-link discovery will be used",c)},o=await ue(a,{signal:s,fetch:n,onEvent:l});if(o.mode==="links"&&a.sitemap==="auto"&&process.stdin.isTTY&&process.stdout.isTTY&&!t.json){let d=await Fe("Sitemap was not found. Enter its full URL, or press Enter to crawl internal links: ");d&&(a={...a,sitemap:d},o=await ue(a,{signal:s,fetch:n,onEvent:l}))}return o}function ga(e,t){if(e.candidateCount===null){if(t.all)throw new Error("--all requires a sitemap");return{mode:"fixed",target:e.config.maxPages}}return t.all?{mode:"all",target:e.candidateCount}:t.pages!==void 0||t["max-pages"]!==void 0?{mode:"fixed",target:Math.min(e.config.maxPages,e.candidateCount)}:process.stdin.isTTY&&process.stdout.isTTY&&!t.json?ia(e.candidateCount):{mode:"fixed",target:Math.min(100,e.candidateCount)}}async function ma(e,t,r){if(!e)throw new Error("scan requires a URL");Mr(t);let n=ie(t.output??Yt),s=Ht(t["headers-env"],e),a=await Vu(e,t,void 0,s,r),c=await ga(a,t),l=Qn(Or(n),t["headers-env"]),o=t["no-cache"]?void 0:Un(l),d=t.json?process.stderr:process.stdout;aa(a,c,!!o,d);let p=new Map,h=pa(t)?ie(t.report??ua):null,f=0,m=-1,y=async(G=!1)=>{if(!h||p.size===0)return;let x=Date.now();if(!G&&p.size-m<100&&x-f<5e3)return;let D=ye({schemaVersion:1,startUrl:a.startUrl,robots:a.robots,sitemap:a.sitemap,options:{...a.config,maxPages:c.target},pages:[...p.values()],partial:!0,truncated:!0});await Rr(h,await He(D,"scan",nt(D),n,{partial:!0,targetPages:c.target})),f=x,m=p.size},w=c.mode==="step"?Math.min(100,c.target):c.target,I=null,_=!1,N=await Pr(t);try{for(;w>0;){let G=oa(w,c.mode==="step",d);I=await tt(a,{signal:r,fetch:s,renderer:N,limit:w,checkpointStore:o,retainCheckpoint:!!o,async onBatch(F){for(let $ of F)p.set($.url,$);await y()},onEvent(F){F.type==="scan-start"&&le(`Starting crawl: up to ${F.total.toLocaleString("en-US")} page(s)`,t.json?process.stderr:process.stdout),F.type==="resume"&&le(`Resuming from checkpoint: ${F.completed.toLocaleString("en-US")} page(s) already available`,t.json?process.stderr:process.stdout),F.type==="retry"&&(G.retry(),le(`Retrying request (attempt ${F.attempt}) after ${F.delayMs} ms`,d)),F.type==="progress"&&G.progress(F.page,F.completed),F.type==="cancelled"&&le(`Scan interrupted after ${F.completed.toLocaleString("en-US")} page(s)`,t.json?process.stderr:process.stdout)}});for(let F of I.pages)p.set(F.url,F);if(await y(!0),I.partial||c.mode!=="step"||w>=c.target)break;Gn(Yn(I.pages));let x=Math.min(100,c.target-w),D=await Fe(`Check the next ${x} page(s)? [y/N] `);if(!["y","yes"].includes(D.toLowerCase())){_=!0;break}w=Math.min(c.target,w+100)}}finally{await N?.close?.()}if(!I)throw new Error("scan did not produce a result");await _r(n,I.snapshot);let L=I.partial||_,B=await Wn(t,I.snapshot,n,!L),R=L?h:await st(t,await He(I.snapshot,"scan",nt(I.snapshot),n,B?{history:B}:{}));L||await o?.clearCurrent();let P=Yn(I.snapshot.pages);return t.json?console.log(JSON.stringify({command:"scan",pages:I.snapshot.pages.length,truncated:I.snapshot.truncated,health:P,output:n,report:R,checkpoint:L&&o?l:null},null,2)):(console.log(`Crawled ${I.snapshot.pages.length} page(s)${I.snapshot.truncated?" (limit reached)":""}.`),I.snapshot.sitemap&&console.log(`Loaded ${I.snapshot.sitemap.sitemapCount} sitemap file(s) from ${I.snapshot.sitemap.url}.`),Gn(P),console.log(`Baseline saved to ${n}`),R&&console.log(`HTML report saved to ${R}`),L&&o&&console.log(`Resume checkpoint saved to ${l}`)),I.partial?130:0}async function fa(e,t,r){Mr(t);let n=ie(t.baseline??Yt),s=await Se(n),a=e??s.siteUrl,c=Ht(t["headers-env"],a),l=await ue({...Ut(a,t,s),sitemap:"none"},{signal:r,fetch:c}),o=s.pages.map(R=>({baselineUrl:R.url,targetUrl:oe(R.url,s.siteUrl,l.startUrl)??R.url})),d=[...new Set(o.map(({targetUrl:R})=>R))],p={...l,mode:"sitemap",candidateUrls:d,candidateCount:d.length,sitemap:{url:`${l.origin}/.seo-audit-targets`,urls:d,sitemapCount:0,truncated:!1,error:null}},h=await Pr(t),f;try{f=await tt(p,{signal:r,fetch:c,renderer:h,limit:d.length,onEvent(R){R.type==="scan-start"&&le(`Starting regression check: ${R.total.toLocaleString("en-US")} page(s)`,t.json?process.stderr:process.stdout),R.type==="progress"&&Qt(R.completed,d.length,!1,t.json?process.stderr:process.stdout)}})}finally{await h?.close?.()}let m=new Map(f.pages.map(R=>[R.url,R])),y=o.flatMap(({baselineUrl:R,targetUrl:P})=>{let G=m.get(P);return G?[{...G,url:R,finalUrl:oe(G.finalUrl,l.startUrl,s.siteUrl)}]:[]}),w=ye({...f.snapshot,siteUrl:s.siteUrl,config:{...f.snapshot.config,url:s.siteUrl},sitemap:s.sitemap,pages:y}),I=Ln(s,w,{enabledRules:w.config.enabledRules,severityOverrides:w.config.severityOverrides,suppressions:w.config.suppressions}),_=I.newIssues,N=Ft(_),L=await Wn(t,w,n,!f.partial),B=await st(t,await He(w,"check",_,n,{...I,...L?{history:L}:{}}));return t.json?console.log(JSON.stringify({command:"check",baseline:n,pages:w.pages.length,summary:N,issues:_,lifecycle:I,report:B},null,2)):(console.log(`Checked ${w.pages.length} page(s).
189
- `),kr(_),B&&console.log(`HTML report saved to ${B}`)),f.partial?130:N.error>0||I.budgetExceeded.length>0||t.strict&&N.warning>0?1:0}async function Ea(e,t){Mr(e);let r=e.production,n=e.preview;if(!r||!n)throw new Error("compare requires --production and --preview URLs");let s=Ht(e["production-headers-env"],r),a=Ht(e["preview-headers-env"],n),c=await ue(Ut(r,e),{signal:t,fetch:s}),l=await ga(c,e),o=await Pr(e),d;try{d=await tt(c,{signal:t,fetch:s,renderer:o,limit:l.target,onEvent(R){R.type==="scan-start"&&le(`Starting production crawl: up to ${R.total.toLocaleString("en-US")} page(s)`,e.json?process.stderr:process.stdout),R.type==="progress"&&Qt(R.completed,l.target,!1,e.json?process.stderr:process.stdout)}})}finally{await o?.close?.()}if(d.partial)return 130;let p=await ue({...Ut(n,e),sitemap:"none"},{signal:t,fetch:a}),h=d.snapshot.pages.map(R=>oe(R.url,r,n)??R.url),f={...p,mode:"sitemap",candidateUrls:[...new Set(h)].sort(),candidateCount:h.length,sitemap:{url:`${p.origin}/.seo-audit-preview-targets`,urls:[...new Set(h)].sort(),sitemapCount:0,truncated:!1,error:null}},m=await Pr(e),y;try{y=await tt(f,{signal:t,fetch:a,renderer:m,limit:h.length,onEvent(R){R.type==="scan-start"&&le(`Starting preview crawl: ${R.total.toLocaleString("en-US")} page(s)`,e.json?process.stderr:process.stdout),R.type==="progress"&&Qt(R.completed,h.length,!1,e.json?process.stderr:process.stdout)}})}finally{await m?.close?.()}let w=y.snapshot.pages.map(R=>Ju(R,n,r)),I=ye({...y.snapshot,siteUrl:d.snapshot.siteUrl,startUrl:d.snapshot.siteUrl,config:{...y.snapshot.config,url:d.snapshot.siteUrl},robots:{...y.snapshot.robots,url:oe(y.snapshot.robots.url,n,r)??y.snapshot.robots.url},sitemap:d.snapshot.sitemap,pages:w,partial:y.snapshot.partial}),_=Ln(d.snapshot,I,{enabledRules:I.config.enabledRules,severityOverrides:I.config.severityOverrides,suppressions:I.config.suppressions}),N=_.newIssues,L=Ft(N),B=await st(e,await He(I,"check",N,ie(Yt),{..._,comparison:{kind:"preview",productionUrl:r,previewUrl:n}}),!0);return e.json?console.log(JSON.stringify({command:"compare",production:r,preview:n,pages:I.pages.length,summary:L,issues:N,lifecycle:_,report:B},null,2)):(console.log(`Compared ${I.pages.length} production page(s) with preview.`),kr(N),B&&console.log(`HTML report saved to ${B}`)),y.partial?130:L.error>0||_.budgetExceeded.length>0||e.strict&&L.warning>0?1:0}async function Ta(e,t){let r=ie(e??t.baseline??Yt),n=await Se(r),s=await Wn(t,n,r,!1),a=await st(t,await He(n,"scan",nt(n),r,s?{history:s}:{}),!0);return t.json?console.log(JSON.stringify({command:"report",baseline:r,pages:n.pages.length,report:a},null,2)):console.log(`HTML report saved to ${a}`),0}async function ba(e,t){if(!!t.from!=!!t.to)throw new Error("history comparison requires both --from and --to");let r=ha(t);if(t.from&&t.to){let d=await Se(ie(t.from)),p=await Se(ie(t.to));if(d.siteUrl!==p.siteUrl)throw new Error("history snapshots must belong to the same site URL");let h=await Mt(r,p.siteUrl),f=kt([...h.map(_=>_.snapshot),d,p]),{diff:m,summary:y}=_n(d,p,{evaluatedAt:new Date().toISOString()}),w=await st(t,await He(p,"check",m.newIssues,ie(t.to),{...m,...f?{history:f}:{}}),!0),I=Ft(m.newIssues);return t.json?console.log(JSON.stringify({command:"history",from:ie(t.from),to:ie(t.to),summary:I,lifecycle:m,comparisonSummary:y,report:w},null,2)):(console.log(`Compared local snapshots from ${d.generatedAt} to ${p.generatedAt}.`),console.log(`Coverage: ${y.coverage.common} common pages; ${y.coverage.onlyBefore} only before; ${y.coverage.onlyAfter} only after.`),y.warnings.length>0&&console.log(`Comparison warnings: ${y.warnings.join(", ")}`),y.unverified.length>0&&console.log(`${y.unverified.length} apparent resolution(s) could not be verified.`),kr(m.newIssues),w&&console.log(`HTML report saved to ${w}`)),0}let n;if(e)try{n=new URL(e).href}catch{throw new Error("history URL must be an HTTP(S) URL")}let s=await Mt(r,n);if(s.length===0)throw new Error(`no local history snapshots found in ${r}`);if(!n){let d=s.at(-1).snapshot.siteUrl;s=s.filter(p=>p.snapshot.siteUrl===d)}let a=s.at(-1),c=kt(s.map(d=>d.snapshot)),l=await st(t,await He(a.snapshot,"scan",nt(a.snapshot),a.path,c?{history:c}:{}),!0),o=c?.points??[];if(t.json)console.log(JSON.stringify({command:"history",directory:r,snapshots:s.map((d,p)=>({path:d.path,...o[p]})),report:l},null,2));else{console.log(`Local history for ${a.snapshot.siteUrl}:`);for(let[d,p]of s.entries()){let h=o[d];console.log(` ${p.snapshot.generatedAt} ${h?.pages??p.snapshot.pages.length} pages ${h?.errors??0} errors ${h?.warnings??0} warnings ${p.path}`)}l&&console.log(`HTML report saved to ${l}`)}return 0}import{mkdir as ya,readFile as $u,writeFile as wa}from"node:fs/promises";import{dirname as xa,isAbsolute as Xu,join as Kn,resolve as Ca}from"node:path";var Zu="https://raw.githubusercontent.com/MelnixDev/seo-crawl-audit/v0/packages/core/config.schema.json",zu="seo-audit.config.json",qu=".github/workflows/seo-audit.yml",eA=[".seo-audit.checkpoint.ndjson",".seo-audit.metrics.json",".seo-audit/history/","seo-audit-report.html","seo-audit-report.html.json"];function tA(e){let t;try{t=new URL(e)}catch(r){throw new Error("init URL must be a full HTTP(S) URL",{cause:r})}if(!["http:","https:"].includes(t.protocol))throw new Error("init URL must be a full HTTP(S) URL");return t.hash="",t.href}function rA(e){let t=(e??"none").trim().toLowerCase(),n={"":"none",none:"none",manual:"manual",scheduled:"scheduled",schedule:"scheduled","pull-request":"pull-request",pull_request:"pull-request",pr:"pull-request"}[t];if(!n)throw new Error("--workflow must be none, manual, scheduled, or pull-request");return n}function nA(e){return`${JSON.stringify({$schema:Zu,url:e,sitemap:"auto",maxPages:100,concurrency:5,delay:100,timeout:1e4,respectRobots:!0,includeQuery:!1,maxRedirects:10,maxResponseBytes:5*1024*1024,enabledRules:null,severityOverrides:{},suppressions:[],regressionBudgets:{error:0},report:{}},null,2)}
183
+ </script></body></html>`}function bu(e){return e.reduce((t,r)=>(t[r.severity]+=1,t),{error:0,warning:0,info:0})}function kt(e){if(e.length===0)return null;let r=[...new Map(e.map(c=>[`${c.generatedAt}|${c.configurationHash}|${c.pages.length}`,c])).values()].sort((c,l)=>c.generatedAt.localeCompare(l.generatedAt)),n=r.at(-1).siteUrl,s=r.filter(c=>c.siteUrl===n),a=s.map((c,l)=>{let o=me(c),d=bu(o),p=l>0?s[l-1]:void 0,h=p?Ye(p,c):null;return{generatedAt:c.generatedAt,siteUrl:c.siteUrl,pages:c.pages.length,affectedPages:new Set(o.map(f=>f.url)).size,errors:d.error,warnings:d.warning,info:d.info,newIssues:h?.newIssues.length??0,resolvedIssues:h?.resolvedIssues.length??0,sitemapUrls:c.sitemap?.urls.length??0,maxDepth:c.pages.reduce((f,m)=>Math.max(f,m.depth),0),partial:c.partial||c.truncated}});return{siteUrl:n,points:a}}function Qi(e){return{generatedAt:e.generatedAt,siteUrl:e.siteUrl,pages:e.pages.length,partial:e.partial,truncated:e.truncated,configurationHash:e.configurationHash,engineVersion:e.engineVersion,ruleSetVersion:e.ruleSetVersion}}function Yi(e){let t={error:0,warning:0,info:0};for(let r of e)t[r.severity]+=1;return t}function Bt(){return{new:0,ongoing:0,resolved:0,unchanged:0}}var Cu=new Set(["page-unreachable","http-error","robots-blocked","redirect-loop","long-redirect-chain","status-regression","page-missing","redirect-changed"]),Iu=new Set(["noindex","x-robots-noindex","missing-canonical","invalid-canonical","cross-domain-canonical","canonical-target-error","noindex-in-sitemap","redirect-in-sitemap","missing-title","duplicate-title","title-length","missing-description","duplicate-description","description-length","missing-h1","broken-internal-link","orphan-sitemap-page","crawlable-not-in-sitemap","invalid-hreflang","malformed-json-ld","http-on-https-site","invalid-language","duplicate-content","multiple-h1","missing-open-graph","missing-twitter-metadata","image-missing-alt","low-word-count","new-noindex","title-removed","title-changed","description-removed","canonical-removed","canonical-changed","h1-removed"]);function yu(e,t,r,n){if(e.scope==="site")return t.partial||t.truncated||r.partial||r.truncated?"incomplete-site":null;let s=n.get(e.url);return s?s.blockedByRobots?"robots-blocked":s.error||s.status===null||s.status>=400?"request-failed":Cu.has(e.ruleId)?null:s.status>=300||!s.contentType||!/(?:text\/html|application\/xhtml\+xml)/i.test(s.contentType)?"html-unavailable":Iu.has(e.ruleId)?null:"unknown-evidence":"not-checked"}function Gi(e,t){let r=new Map;for(let{lifecycle:n,issue:s}of e){let a=t(s),c=r.get(a)??{counts:Bt(),pages:new Set};c.counts[n]+=1,s.scope==="page"&&c.pages.add(s.url),r.set(a,c)}return[...r].map(([n,s])=>({id:n,counts:s.counts,affectedPages:s.pages.size})).sort((n,s)=>n.id.localeCompare(s.id))}function _n(e,t,r){if(e.siteUrl!==t.siteUrl)throw new Error("local history snapshots must have the same site URL");let n=t.config,s=x=>({...x,config:{...x.config,enabledRules:n.enabledRules,severityOverrides:n.severityOverrides,suppressions:n.suppressions,regressionBudgets:n.regressionBudgets}}),a=s(e),c=s(t),l={now:r.evaluatedAt},o=me(a,l),d=me(c,l),p=Ye(a,c,l),h=[],f=new Map(t.pages.map(x=>[x.url,x])),m=p.resolvedIssues.filter(x=>{let D=yu(x,e,t,f);return D&&h.push({fingerprint:x.fingerprint,ruleId:x.ruleId,url:x.url,reason:D}),!D}),y={...p,resolvedIssues:m},w=new Set(e.pages.map(x=>x.url)),I=new Set(t.pages.map(x=>x.url)),_=[...w].filter(x=>I.has(x)).length,N=[];(e.partial||e.truncated)&&N.push("incomplete-before"),(t.partial||t.truncated)&&N.push("incomplete-after"),e.configurationHash!==t.configurationHash&&N.push("configuration-changed"),e.config.includeQuery!==t.config.includeQuery&&N.push("url-policy-changed"),e.ruleSetVersion!==t.ruleSetVersion&&N.push("rule-set-changed"),e.generatedAt===t.generatedAt&&N.push("same-timestamp"),(JSON.stringify(e.config.enabledRules)!==JSON.stringify(n.enabledRules)||JSON.stringify(e.config.severityOverrides)!==JSON.stringify(n.severityOverrides)||JSON.stringify(e.config.suppressions)!==JSON.stringify(n.suppressions))&&N.push("evaluation-policy-changed");let L=[...y.newIssues.map(x=>({lifecycle:"new",issue:x})),...y.ongoingIssues.map(x=>({lifecycle:"ongoing",issue:x})),...y.resolvedIssues.map(x=>({lifecycle:"resolved",issue:x})),...y.unchangedIssues.map(x=>({lifecycle:"unchanged",issue:x}))],B=Bt(),R={error:Bt(),warning:Bt(),info:Bt()};for(let x of L)B[x.lifecycle]+=1,R[x.issue.severity][x.lifecycle]+=1;let P=vt([...new Set([...w,...I])]),G=new Map(P.flatMap(x=>x.urls.map(D=>[D,x.origin+x.template])));return{diff:y,summary:{schemaVersion:1,evaluatedAt:r.evaluatedAt,from:Qi(e),to:Qi(t),coverage:{common:_,onlyBefore:w.size-_,onlyAfter:I.size-_,complete:!(e.partial||e.truncated||t.partial||t.truncated)},evaluationPolicy:{source:"after",enabledRules:n.enabledRules?[...n.enabledRules]:null,severityOverrides:{...n.severityOverrides},suppressions:n.suppressions.map(x=>({...x})),regressionBudgets:{...n.regressionBudgets}},warnings:N,beforeFindings:Yi(o),afterFindings:Yi(d),lifecycle:B,lifecycleBySeverity:R,budgetExceeded:y.budgetExceeded,byRule:Gi(L,x=>x.ruleId),byTemplate:Gi(L,x=>x.scope==="site"?"@site":G.get(x.url)??"@unknown"),unverified:h.sort((x,D)=>x.url.localeCompare(D.url)||x.ruleId.localeCompare(D.ruleId))}}}function K(e,t,r,n,s="count",a){return{id:e,label:t,value:r,unit:s,source:{id:"crawl",label:"SEO Crawl Audit"},observedAt:n,confidence:"high",status:"available",...a?{detail:a}:{}}}function Wi(e,t,r,n,s){return{id:e,label:t,value:null,unit:"count",source:r,observedAt:n,confidence:"high",status:"not-connected",...s?{detail:s}:{}}}function wu(e,t,r,n,s){return{id:e,label:t,value:r,unit:"count",source:{id:"crawl-estimate",label:"SEO Crawl Audit"},observedAt:n,confidence:"low",status:"estimate",...s?{detail:s}:{}}}function Ki(e){return[e.robots,e.xRobotsTag].some(t=>/(^|[\s,])noindex($|[\s,])/i.test(t??""))}function Rn(e,t){if(Array.isArray(e))return e.reduce((a,c)=>a+Rn(c,t),0);if(!e||typeof e!="object")return 0;let r=e,n=r["@type"];return(Array.isArray(n)?n.filter(a=>a===t).length:n===t?1:0)+Object.entries(r).filter(([a])=>a!=="@type").reduce((a,[,c])=>a+Rn(c,t),0)}function wr(e,t,r){return e.filter(n=>n.status!==null&&n.status>=t&&n.status<=r).length}function rt(e){let t=e.pages,r=e.generatedAt,n=t.filter(f=>/(?:text\/html|application\/xhtml\+xml)/i.test(f.contentType??"")),s=t.filter(Ki),a=n.filter(f=>!f.error&&!f.blockedByRobots&&f.status!==null&&f.status>=200&&f.status<300&&!Ki(f)),c=e.sitemap?.urls.length??0,l=c>t.length&&t.length>0?Math.min(c,Math.round(a.length/t.length*c)):a.length,o=new Set(t.flatMap(f=>f.images.map(m=>m.src).filter(m=>!!m))),d=t.reduce((f,m)=>f+m.jsonLd.reduce((y,w)=>y+(w.valid?Rn(w.value,"Product"):0),0),0),p=t.reduce((f,m)=>f+m.responseBytes,0),h=t.length>0?Math.round(e.statistics.durationMs/t.length):0;return{schemaVersion:1,siteUrl:e.siteUrl,observedAt:r,metrics:[K("pages.sitemap",{en:"Sitemap URLs",uk:"URL \u0443 sitemap"},c,r),K("pages.checked",{en:"Pages checked",uk:"\u041F\u0435\u0440\u0435\u0432\u0456\u0440\u0435\u043D\u043E \u0441\u0442\u043E\u0440\u0456\u043D\u043E\u043A"},t.length,r),K("pages.html",{en:"HTML pages",uk:"HTML-\u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0438"},n.length,r),K("pages.indexable",{en:"Crawlable HTML pages",uk:"\u0414\u043E\u0441\u0442\u0443\u043F\u043D\u0456 HTML-\u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0438"},a.length,r,"count",{en:"Successful HTML pages without a detected noindex directive. This is not the Google index count.",uk:"\u0423\u0441\u043F\u0456\u0448\u043D\u0456 HTML-\u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0438 \u0431\u0435\u0437 \u0432\u0438\u044F\u0432\u043B\u0435\u043D\u043E\u0457 \u0434\u0438\u0440\u0435\u043A\u0442\u0438\u0432\u0438 noindex. \u0426\u0435 \u043D\u0435 \u043A\u0456\u043B\u044C\u043A\u0456\u0441\u0442\u044C \u0441\u0442\u043E\u0440\u0456\u043D\u043E\u043A \u0432 \u0456\u043D\u0434\u0435\u043A\u0441\u0456 Google."}),wu("search.indexable-estimate",{en:"Estimated indexable pages",uk:"\u041E\u0440\u0456\u0454\u043D\u0442\u043E\u0432\u043D\u0430 \u043A\u0456\u043B\u044C\u043A\u0456\u0441\u0442\u044C \u0456\u043D\u0434\u0435\u043A\u0441\u043E\u0432\u0430\u043D\u0438\u0445 \u0441\u0442\u043E\u0440\u0456\u043D\u043E\u043A"},l,r,{en:"Estimated from the crawlable-page ratio and sitemap size. This is not the number indexed by Google.",uk:"\u041E\u0446\u0456\u043D\u043A\u0430 \u0437\u0430 \u0447\u0430\u0441\u0442\u043A\u043E\u044E \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0438\u0445 \u0434\u043B\u044F \u0456\u043D\u0434\u0435\u043A\u0441\u0430\u0446\u0456\u0457 \u0441\u0442\u043E\u0440\u0456\u043D\u043E\u043A \u0456 \u0440\u043E\u0437\u043C\u0456\u0440\u043E\u043C sitemap. \u0426\u0435 \u043D\u0435 \u043A\u0456\u043B\u044C\u043A\u0456\u0441\u0442\u044C \u0441\u0442\u043E\u0440\u0456\u043D\u043E\u043A \u0432 \u0456\u043D\u0434\u0435\u043A\u0441\u0456 Google."}),Wi("search.google-indexed",{en:"Indexed by Google",uk:"\u041F\u0440\u043E\u0456\u043D\u0434\u0435\u043A\u0441\u043E\u0432\u0430\u043D\u043E Google"},{id:"google-search-console",label:"Google Search Console"},r,{en:"Connect an authoritative provider to confirm this value; crawlability is not proof of indexing.",uk:"\u041F\u0456\u0434\u043A\u043B\u044E\u0447\u0456\u0442\u044C \u0430\u0432\u0442\u043E\u0440\u0438\u0442\u0435\u0442\u043D\u0435 \u0434\u0436\u0435\u0440\u0435\u043B\u043E \u0434\u043B\u044F \u043F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u0436\u0435\u043D\u043D\u044F; \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0456\u0441\u0442\u044C \u0434\u043B\u044F crawl \u043D\u0435 \u0434\u043E\u0432\u043E\u0434\u0438\u0442\u044C \u0456\u043D\u0434\u0435\u043A\u0441\u0430\u0446\u0456\u044E."}),Wi("search.bing-indexed",{en:"Indexed by Bing",uk:"\u041F\u0440\u043E\u0456\u043D\u0434\u0435\u043A\u0441\u043E\u0432\u0430\u043D\u043E Bing"},{id:"bing-webmaster",label:"Bing Webmaster Tools"},r,{en:"Connect an authoritative provider to confirm this value.",uk:"\u041F\u0456\u0434\u043A\u043B\u044E\u0447\u0456\u0442\u044C \u0430\u0432\u0442\u043E\u0440\u0438\u0442\u0435\u0442\u043D\u0435 \u0434\u0436\u0435\u0440\u0435\u043B\u043E \u0434\u043B\u044F \u043F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u0436\u0435\u043D\u043D\u044F \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F."}),K("pages.noindex",{en:"Noindex pages",uk:"\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0438 noindex"},s.length,r),K("pages.robots-blocked",{en:"Blocked by robots.txt",uk:"\u0417\u0430\u0431\u043B\u043E\u043A\u043E\u0432\u0430\u043D\u043E robots.txt"},t.filter(f=>f.blockedByRobots).length,r),K("assets.images",{en:"Unique images",uk:"\u0423\u043D\u0456\u043A\u0430\u043B\u044C\u043D\u0456 \u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u043D\u044F"},o.size,r),K("commerce.products",{en:"Product entities",uk:"\u0422\u043E\u0432\u0430\u0440\u0438 Product"},d,r),K("links.internal",{en:"Internal links",uk:"\u0412\u043D\u0443\u0442\u0440\u0456\u0448\u043D\u0456 \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F"},e.linkGraph.internalEdges,r),K("links.external",{en:"External links",uk:"\u0417\u043E\u0432\u043D\u0456\u0448\u043D\u0456 \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F"},e.linkGraph.externalEdges,r),K("crawl.max-depth",{en:"Maximum crawl depth",uk:"\u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u0430 \u0433\u043B\u0438\u0431\u0438\u043D\u0430"},Math.max(0,...t.map(f=>f.depth)),r),K("crawl.transfer",{en:"HTML transferred",uk:"\u041F\u0435\u0440\u0435\u0434\u0430\u043D\u043E HTML"},p,r,"bytes"),K("crawl.average-time",{en:"Average crawl time per page",uk:"\u0421\u0435\u0440\u0435\u0434\u043D\u0456\u0439 \u0447\u0430\u0441 \u043D\u0430 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0443"},h,r,"milliseconds"),K("status.2xx",{en:"HTTP 2xx",uk:"HTTP 2xx"},wr(t,200,299),r),K("status.3xx",{en:"HTTP 3xx",uk:"HTTP 3xx"},wr(t,300,399),r),K("status.4xx",{en:"HTTP 4xx",uk:"HTTP 4xx"},wr(t,400,499),r),K("status.5xx",{en:"HTTP 5xx",uk:"HTTP 5xx"},wr(t,500,599),r)]}}function nt(e,t={}){return me(e,t)}function Ln(e,t,r={}){return Ye(e,t,r)}import{access as Ru,mkdir as Lu,readFile as kn,readdir as Ou,rename as ji,writeFile as Vi}from"node:fs/promises";import{randomUUID as Bn}from"node:crypto";import{join as $i,resolve as Sr}from"node:path";var xu=Object.freeze({"search.google-site-estimate":["google-site-search","google-site-search-manual"],"domain.registration-date":["rdap"],"domain.expiration-date":["rdap"],"domain.registrar":["rdap"]});function Su(e){return xu[e.id]?.includes(e.source.id)===!0}function xr(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} must be an object`);return e}function Ce(e,t){if(typeof e!="string"||e==="")throw new Error(`${t} must be a non-empty string`);return e}function Ji(e,t){let r=xr(e,t);return{en:Ce(r.en,`${t}.en`),uk:Ce(r.uk,`${t}.uk`)}}function Nu(e,t){let r=xr(e,`metrics[${t}]`),n=["count","bytes","milliseconds","date","text"],s=["high","medium","low"],a=["available","estimate","unavailable","not-connected","error"],c=xr(r.source,`metrics[${t}].source`);if(!n.includes(String(r.unit)))throw new Error(`metrics[${t}].unit is invalid`);if(!s.includes(String(r.confidence)))throw new Error(`metrics[${t}].confidence is invalid`);if(!a.includes(String(r.status)))throw new Error(`metrics[${t}].status is invalid`);if(r.value!==null&&typeof r.value!="string"&&typeof r.value!="number")throw new Error(`metrics[${t}].value must be a number, string, or null`);let l=Ce(r.observedAt,`metrics[${t}].observedAt`);if(Number.isNaN(Date.parse(l)))throw new Error(`metrics[${t}].observedAt must be an ISO date`);let o=c.url===void 0?void 0:Ce(c.url,`metrics[${t}].source.url`);return{id:Ce(r.id,`metrics[${t}].id`),label:Ji(r.label,`metrics[${t}].label`),value:r.value,unit:r.unit,source:{id:Ce(c.id,`metrics[${t}].source.id`),label:Ce(c.label,`metrics[${t}].source.label`),...o?{url:o}:{}},observedAt:l,confidence:r.confidence,status:r.status,...r.stale===!0?{stale:!0}:{},...r.detail===void 0?{}:{detail:Ji(r.detail,`metrics[${t}].detail`)}}}function On(e){let t=xr(e,"site metrics state");if(t.schemaVersion!==1)throw new Error("site metrics state schemaVersion must be 1");let r=Ce(t.siteUrl,"site metrics state.siteUrl"),n=new URL(r);if(!["http:","https:"].includes(n.protocol))throw new Error("site metrics state.siteUrl must use HTTP(S)");let s=Ce(t.updatedAt,"site metrics state.updatedAt");if(Number.isNaN(Date.parse(s)))throw new Error("site metrics state.updatedAt must be an ISO date");if(!Array.isArray(t.metrics))throw new Error("site metrics state.metrics must be an array");return{schemaVersion:1,siteUrl:n.href,updatedAt:s,metrics:t.metrics.map(Nu)}}function _u(e){return e.source.id==="rdap"?6048e5:e.id==="search.google-site-estimate"?2592e6:null}function vn(e,t=new Date){let r=t.getTime();return{...e,metrics:e.metrics.map(n=>{let s=_u(n);return s!==null&&r-Date.parse(n.observedAt)>s?{...n,stale:!0}:{...n,stale:!1}})}}function Dn(e,t){if(!t||new URL(e.siteUrl).origin!==new URL(t.siteUrl).origin)return e;let r=t.metrics.filter(Su),n=new Map(r.map(a=>[a.id,a])),s=new Set(e.metrics.map(a=>a.id));return{...e,observedAt:t.updatedAt>e.observedAt?t.updatedAt:e.observedAt,metrics:[...e.metrics.map(a=>a.source.id==="crawl"?a:n.get(a.id)??a),...r.filter(a=>!s.has(a.id))]}}async function Nr(e=process.cwd()){let t=Sr(e,Gr);try{return await Ru(t),t}catch{return null}}async function Pt(e){let t=e?Sr(e):await Nr();if(!t)return{};try{return Wr(JSON.parse(await kn(t,"utf8")))}catch(r){throw new Error(`invalid config ${t}: ${r instanceof Error?r.message:String(r)}`,{cause:r})}}async function _r(e,t){let r=`${e}.${process.pid}.${Bn()}.tmp`;await Vi(r,`${JSON.stringify(t,null,2)}
184
+ `,"utf8"),await ji(r,e)}async function Se(e){try{return ye(JSON.parse(await kn(e,"utf8")))}catch(t){throw t instanceof SyntaxError?new Error(`invalid snapshot JSON: ${e}`,{cause:t}):t instanceof Error&&t.message.startsWith("unsupported")?new Error(`unsupported or invalid baseline: ${e}`,{cause:t}):t}}async function Xi(e,t,r=new Date){let n;try{n=JSON.parse(await kn(e,"utf8"))}catch(a){if(a&&typeof a=="object"&&"code"in a&&a.code==="ENOENT")return null;throw a instanceof SyntaxError?new Error(`invalid site metrics JSON: ${e}`,{cause:a}):a}let s=vn(On(n),r);return t&&new URL(s.siteUrl).origin!==new URL(t).origin?null:s}async function Pn(e,t,r={}){let n=rt(e);try{return Dn(n,await Xi(t,e.siteUrl,r.now))}catch(s){return r.onWarning?.(`Could not load site metrics from ${t}: ${s instanceof Error?s.message:String(s)}`),n}}async function Rr(e,t,r={}){let n=`${e}.${process.pid}.${Bn()}.tmp`;await Vi(n,Hi(t,r),"utf8"),await ji(n,e)}function vu(e){return`${e.generatedAt.replaceAll(":","-").replaceAll(".","-")}-${e.configurationHash.slice(0,8)}-${Bn()}.snapshot.json`}async function Mn(e,t){let r=Sr(e);await Lu(r,{recursive:!0});let n=$i(r,vu(t));return await _r(n,t),n}async function Mt(e,t){let r=Sr(e),n;try{n=await Ou(r)}catch(a){if(a&&typeof a=="object"&&"code"in a&&a.code==="ENOENT")return[];throw a}let s=[];for(let a of n.filter(c=>c.endsWith(".snapshot.json")).sort()){let c=$i(r,a),l=await Se(c);(!t||l.siteUrl===t)&&s.push({path:c,snapshot:l})}return s.sort((a,c)=>a.snapshot.generatedAt.localeCompare(c.snapshot.generatedAt)||a.path.localeCompare(c.path))}import{appendFile as Du,rename as ku,stat as zi,unlink as Bu,writeFile as Pu}from"node:fs/promises";import{createReadStream as qi}from"node:fs";import{createInterface as ea}from"node:readline";function Mu(e){return{type:"seo-audit-checkpoint",schemaVersion:2,identity:e}}function Zi(e,t){if(!e||typeof e!="object")return!1;let r=e;if(r.type!=="seo-audit-checkpoint")return!1;if(r.schemaVersion===2)return JSON.stringify(r.identity)===JSON.stringify(t);if(r.schemaVersion!==1)return!1;let n=r.source;return n?.startUrl===t.siteUrl&&(n.sitemap??null)===t.sitemapUrl&&(n.includeQuery??!1)===t.includeQuery&&(n.respectRobots??!0)===t.respectRobots}var Lr=class{path;#e=null;#t=Promise.resolve();constructor(t){this.path=t}async#r(t){let r=`${this.path}.${process.pid}.${Date.now()}.tmp`;await Pu(r,`${JSON.stringify(Mu(t))}
185
+ `,"utf8"),await ku(r,this.path),this.#e=t}async load(t){await this.flush();try{await zi(this.path)}catch(d){if(d.code!=="ENOENT")throw d;return await this.#r(t),null}let r=qi(this.path,{encoding:"utf8"}),n=ea({input:r,crlfDelay:1/0}),s=new Map,a,c=0,l=null,o=(d,p)=>{try{let h=JSON.parse(d);h.type==="page"&&typeof h.page?.url=="string"&&s.set(h.page.url,h.page)}catch(h){throw new Error(`corrupt checkpoint record ${p} in ${this.path}`,{cause:h})}};for await(let d of n){if(c+=1,c===1){try{a=JSON.parse(d)}catch{a=null}if(!Zi(a,t))return n.close(),r.destroy(),await this.#r(t),null;this.#e=t;continue}d.trim()&&(l&&o(l.line,l.lineNumber),l={line:d,lineNumber:c})}if(c===0||!Zi(a,t))return await this.#r(t),null;if(l)try{o(l.line,l.lineNumber)}catch{}return{identity:t,pages:[...s.values()]}}append(t,r){return this.#t=this.#t.then(async()=>{(!this.#e||JSON.stringify(this.#e)!==JSON.stringify(t))&&await this.#r(t),await Du(this.path,`${JSON.stringify({type:"page",page:r})}
186
+ `,"utf8")}),this.#t}async clear(t){if(await this.flush(),!(this.#e&&JSON.stringify(this.#e)!==JSON.stringify(t))){try{await Bu(this.path)}catch(r){if(r.code!=="ENOENT")throw r}this.#e=null}}async clearCurrent(){this.#e&&await this.clear(this.#e)}async flush(){await this.#t}};function Un(e){return new Lr(e)}async function Fn(e){let t;try{t=(await zi(e)).mtime.toISOString()}catch(f){if(f.code==="ENOENT")return{path:e,status:"missing",schemaVersion:null,siteUrl:null,completedPages:0,updatedAt:null,resumable:!1,message:null};throw f}let r=qi(e,{encoding:"utf8"}),n=ea({input:r,crlfDelay:1/0}),s,a=new Set,c=0,l=null,o=(f,m)=>{try{let y=JSON.parse(f);y.type==="page"&&typeof y.page?.url=="string"&&a.add(y.page.url)}catch{return{path:e,status:"corrupt",schemaVersion:null,siteUrl:null,completedPages:a.size,updatedAt:t,resumable:!1,message:`checkpoint record ${m} is corrupt`}}return null};for await(let f of n){if(c+=1,c===1){try{s=JSON.parse(f)}catch{s=null}continue}if(f.trim()){if(l){let m=o(l.line,l.lineNumber);if(m)return m}l={line:f,lineNumber:c}}}if(!s)return{path:e,status:"corrupt",schemaVersion:null,siteUrl:null,completedPages:0,updatedAt:t,resumable:!1,message:"checkpoint header is not valid JSON"};if(typeof s!="object"||s.type!=="seo-audit-checkpoint")return{path:e,status:"incompatible",schemaVersion:null,siteUrl:null,completedPages:0,updatedAt:t,resumable:!1,message:"file is not an SEO Crawl Audit checkpoint"};let d=s,p=d.schemaVersion===1||d.schemaVersion===2?d.schemaVersion:null;if(p===null)return{path:e,status:"incompatible",schemaVersion:null,siteUrl:null,completedPages:0,updatedAt:t,resumable:!1,message:"checkpoint schema is not supported"};let h=p===2?d.identity?.siteUrl??null:d.source?.startUrl??null;if(l)try{let f=JSON.parse(l.line);f.type==="page"&&typeof f.page?.url=="string"&&a.add(f.page.url)}catch{}return{path:e,status:"ready",schemaVersion:p,siteUrl:h,completedPages:a.size,updatedAt:t,resumable:a.size>0,message:null}}import{extname as Uu}from"node:path";function Or(e){let t=Uu(e);return t?`${e.slice(0,-t.length)}.checkpoint.ndjson`:`${e}.checkpoint.ndjson`}import{parseArgs as Fu}from"node:util";function ta(e){return Fu({args:e,allowPositionals:!0,strict:!0,options:{baseline:{type:"string"},config:{type:"string"},output:{type:"string"},report:{type:"string"},"no-report":{type:"boolean"},"no-cache":{type:"boolean"},pages:{type:"string"},all:{type:"boolean"},"max-pages":{type:"string"},concurrency:{type:"string"},delay:{type:"string"},timeout:{type:"string"},sitemap:{type:"string"},"no-sitemap":{type:"boolean"},"include-query":{type:"boolean"},"ignore-robots":{type:"boolean"},strict:{type:"boolean"},json:{type:"boolean"},help:{type:"boolean"},version:{type:"boolean"},production:{type:"string"},preview:{type:"string"},"headers-env":{type:"string"},"production-headers-env":{type:"string"},"preview-headers-env":{type:"string"},"history-dir":{type:"string"},"no-history":{type:"boolean"},from:{type:"string"},to:{type:"string"},directory:{type:"string"},workflow:{type:"string"},yes:{type:"boolean"},force:{type:"boolean"},offline:{type:"boolean"},platform:{type:"string"},port:{type:"string"},"no-open":{type:"boolean"},render:{type:"string"}}})}function ra(e,t){return{...e,__config:t}}function vr(e,t,r,n=!1){if(e===void 0)return r;let s=Number.parseInt(e,10);if(!Number.isInteger(s)||s<(n?0:1))throw new Error(`${t} must be a ${n?"non-negative":"positive"} integer`);return s}function Ut(e,t,r){if(t.sitemap&&t["no-sitemap"])throw new Error("--sitemap and --no-sitemap cannot be used together");let n=r?.config??{},s=t.__config??{},a={url:e,schemaVersion:1,maxPages:vr(t.pages??t["max-pages"],t.pages!==void 0?"--pages":"--max-pages",s.maxPages??n.maxPages??100),concurrency:vr(t.concurrency,"--concurrency",s.concurrency??n.concurrency??5),delay:vr(t.delay,"--delay",s.delay??n.delay??100,!0),timeout:vr(t.timeout,"--timeout",s.timeout??n.timeout??1e4)};return t["no-sitemap"]?a.sitemap="none":t.sitemap&&(a.sitemap=t.sitemap),t["include-query"]!==void 0&&(a.includeQuery=t["include-query"]),t["ignore-robots"]!==void 0&&(a.respectRobots=!t["ignore-robots"]),Te(a,s,n)}import{dirname as da,join as ua,resolve as ie}from"node:path";import{Buffer as Hu}from"node:buffer";async function Qu(e){if(e)return e;try{return await import("playwright")}catch(t){throw new Error("Playwright is not installed. Run: npm install --save-dev playwright && npx playwright install chromium",{cause:t})}}function Yu(e){let t=0,r=[];return async function(){return t>=e&&await new Promise(s=>r.push(s)),t+=1,()=>{t-=1,r.shift()?.()}}}async function Gu(e){let t=[],r=e.request().redirectedFrom();for(;r;){let n=await r.response(),s=await n?.headers();t.unshift({url:r.url(),status:n?.status()??0,location:s?.location??null}),r=r.redirectedFrom()}return t}async function na(e={}){let t=e.concurrency??2;if(!Number.isInteger(t)||t<1)throw new Error("Playwright renderer concurrency must be a positive integer");let r=await Qu(e.playwright),n;try{n=await r.chromium.launch({headless:e.headless??!0})}catch(o){throw new Error("Chromium could not start. Run: npx playwright install chromium",{cause:o})}let s=null,a=null,c=Yu(t),l=!1;return{id:"playwright-chromium-v1",async render(o){if(l)throw new Error("Playwright renderer is closed");let d=await c(),p=null;try{if(o.signal?.throwIfAborted(),!s)s=await n.newContext({userAgent:o.userAgent,acceptDownloads:!1}),a=o.userAgent;else if(a!==o.userAgent)throw new Error("A Playwright renderer cannot mix user agents in one browser context");p=await s.newPage(),await p.route("**/*",async f=>{f.request().resourceType()==="media"?await f.abort():await f.continue()}),p.on("download",f=>{f.cancel()});let h=()=>{p?.close()};o.signal?.addEventListener("abort",h,{once:!0});try{let f=await p.goto(o.url,{waitUntil:"domcontentloaded",timeout:o.timeout});if(!f)throw new Error(`Playwright did not receive a document response for ${o.url}`);if((e.networkIdleTimeout??2e3)>0)try{await p.waitForLoadState("networkidle",{timeout:Math.min(o.timeout,e.networkIdleTimeout??2e3)})}catch(I){if(o.signal?.aborted)throw I}o.signal?.throwIfAborted();let m=await p.content(),y=Hu.byteLength(m);if(y>o.maxResponseBytes)throw new Error(`rendered HTML exceeds ${o.maxResponseBytes} bytes`);let w=await f.headers();return{finalUrl:p.url(),status:f.status(),headers:w,html:m,responseBytes:y,redirectChain:await Gu(f)}}finally{o.signal?.removeEventListener("abort",h)}}finally{await p?.close().catch(()=>{}),d()}},async close(){l||(l=!0,await s?.close(),await n.close())}}}var Wu=process.stdout.isTTY&&!process.env.NO_COLOR;function Dr(e,t){return Wu?`\x1B[${e}m${t}\x1B[0m`:t}function Ft(e){return e.reduce((t,r)=>(t[r.severity]+=1,t),{error:0,warning:0,info:0})}function kr(e){if(e.length===0){console.log(Dr("32","\u2713 No SEO regressions detected."));return}for(let r of e){let n=r.severity==="error"?Dr("31","\u2716 error"):r.severity==="warning"?Dr("33","\u26A0 warning"):Dr("34","\u2139 info");console.log(`${n} ${r.rule} ${r.url}`),console.log(` ${r.message}`),(r.before!==void 0||r.after!==void 0)&&(console.log(` before: ${JSON.stringify(r.before)}`),console.log(` after: ${JSON.stringify(r.after)}`))}let t=Ft(e);console.log(`
187
+ ${t.error} error(s), ${t.warning} warning(s) detected.`)}import{createHash as Ku}from"node:crypto";function Br(e){if(!e)return{};let t=process.env[e];if(!t)throw new Error(`environment variable ${e} is empty or missing`);let r;try{r=JSON.parse(t)}catch(s){throw new Error(`environment variable ${e} must contain a JSON object`,{cause:s})}if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`environment variable ${e} must contain a JSON object`);let n={};for(let[s,a]of Object.entries(r)){if(typeof a!="string")throw new Error(`header ${s} in ${e} must be a string`);try{new Headers({[s]:a})}catch(c){throw new Error(`header ${s} in ${e} is invalid`,{cause:c})}n[s]=a}return n}function Hn(e,t,r=globalThis.fetch){if(Object.keys(e).length===0)return r;let n=new URL(t).origin;return(s,a)=>{let c=s instanceof Request?s.url:String(s);if(new URL(c).origin!==n)return r(s,a);let l=new Headers(s instanceof Request?s.headers:void 0);new Headers(a?.headers).forEach((o,d)=>l.set(d,o));for(let[o,d]of Object.entries(e))l.set(o,d);return r(s,{...a,headers:l})}}function Ht(e,t,r=globalThis.fetch){return Hn(Br(e),t,r)}function Qn(e,t){if(!t)return e;let r=Ku("sha256").update(t).digest("hex").slice(0,12);return e.endsWith(".ndjson")?`${e.slice(0,-7)}.auth-${r}.ndjson`:`${e}.auth-${r}`}import{createInterface as Ju}from"node:readline/promises";function ia(e,t){let r=e.trim().toLowerCase();if(r===""||r==="1")return{mode:"fixed",target:Math.min(100,t)};if(r==="2"||r==="all")return{mode:"all",target:t};if(r==="3"||r==="step")return{mode:"step",target:t};let n=Number.parseInt(r,10);return/^\d+$/.test(r)&&n>0?{mode:"fixed",target:Math.min(n,t)}:null}async function Fe(e){let t=Ju({input:process.stdin,output:process.stdout});try{return(await t.question(e)).trim()}finally{t.close()}}async function aa(e){for(;;){console.log(`
188
+ Sitemap contains ${e.toLocaleString("en-US")} page(s).`),console.log("How many pages should be scanned?"),console.log(" 1) First 100"),console.log(` 2) All ${e.toLocaleString("en-US")}`),console.log(" 3) 100 at a time with confirmation"),console.log(" Or enter an exact number, for example 500.");let t=ia(await Fe("Choose [1]: "),e);if(!t){console.log("Enter 1, 2, 3, all, step, or a positive number.");continue}if(t.mode==="all"){let r=await Fe(`This will request ${e.toLocaleString("en-US")} pages. Continue? [y/N] `);if(!["y","yes"].includes(r.toLowerCase()))continue}return t}}function sa(e){let t=Math.max(0,Math.round(e/1e3));if(t<60)return`${t}s`;let r=Math.floor(t/60),n=t%60;return`${r}m ${n}s`}function ju(e,t,r){let n=t===0?1:Math.min(e/t,1),s=(n*100).toFixed(n<.1?1:0),a=Math.round(n*20),c=`[${"\u2588".repeat(a)}${"\u2591".repeat(20-a)}] ${s}% \xB7 ${e.toLocaleString("en-US")} / ${t.toLocaleString("en-US")} pages`;if(!r)return c;let l=r.elapsedMs/6e4,o=l>0?e/l:0,d=Math.max(0,t-e),p=o>0?d/o*6e4:null,h=[`elapsed ${sa(r.elapsedMs)}`,`${o.toFixed(o<10?1:0)} pages/min`,`ETA ${p===null?"\u2014":sa(p)}`,`retries ${r.retries}`,`errors ${r.errors}`];if(r.currentUrl){let f=r.currentUrl.length>60?`${r.currentUrl.slice(0,57)}\u2026`:r.currentUrl;h.push(f)}return`${c} \xB7 ${h.join(" \xB7 ")}`}function Qt(e,t,r=!1,n=process.stdout,s){let a=ju(e,t,s),c=n===process.stderr?console.error:console.log;n.isTTY&&!r?(n.write(`\r${a}`),e>=t&&n.write(`
189
+ `)):(n.isTTY||e>=t||e%1e3===0)&&c(a)}function oa(e,t,r,n=process.stdout){let s=e.sitemap?`found, ${(e.candidateCount??e.sitemap.urls.length).toLocaleString("en-US")} URL(s)`:"not found; internal links",a=["Scan plan",` Target: ${e.startUrl}`,` Sitemap: ${s}`,` Robots: ${e.config.respectRobots?"respected":"ignored"}`,` Limit: ${t.target.toLocaleString("en-US")} page(s)`,` Concurrency: ${e.config.concurrency}`,` Delay: ${e.config.delay} ms`,` Checkpoint: ${r?"enabled":"disabled"}`];t.target>1e3&&a.push(" Notice: this is a large scan and may take a long time."),le(a.join(`
190
+ `),n)}function ca(e,t,r=process.stdout,n=Date.now){let s=n(),a=0,c=0,l=new Set;return{retry(){a+=1},progress(o,d){(o.error||o.status!==null&&o.status>=400)&&!l.has(o.url)&&(l.add(o.url),c+=1);let p=(()=>{try{return new URL(o.url).pathname||"/"}catch{return o.url}})();Qt(d,e,t,r,{elapsedMs:n()-s,retries:a,errors:c,currentUrl:p})}}}function le(e,t=process.stdout){t.isTTY&&t.write("\r\x1B[2K"),t===process.stderr?console.error(e):console.log(e)}function Yn(e){return e.reduce((t,r)=>((r.error||r.blockedByRobots||(r.status??500)>=400)&&(t.unavailable+=1),r.title||(t.missingTitle+=1),r.description||(t.missingDescription+=1),r.canonical||(t.missingCanonical+=1),r.h1Count===0&&(t.missingH1+=1),/(^|[\s,])noindex($|[\s,])/i.test(r.robots??"")&&(t.noindex+=1),t),{unavailable:0,missingTitle:0,missingDescription:0,missingCanonical:0,missingH1:0,noindex:0})}function Gn(e){console.log(`Current health: ${e.unavailable} unavailable, ${e.missingTitle} missing title, ${e.missingDescription} missing description, ${e.missingCanonical} missing canonical, ${e.missingH1} missing H1, ${e.noindex} noindex.`)}var Yt=".seo-audit.json",Aa="seo-audit-report.html",la=".seo-audit/history";function Mr(e){if(e.render!==void 0&&e.render!=="http"&&e.render!=="playwright")throw new Error("--render must be http or playwright")}async function Pr(e){if(Mr(e),(e.render??"http")!=="http")return na()}async function pa(e,t){let r=ie(e??t.output??Yt),n=Qn(Or(r),t["headers-env"]),s=await Fn(n),a=null;try{a=await Se(r)}catch(l){if(l.code!=="ENOENT")throw l}let c={command:"status",snapshot:a?{path:r,siteUrl:a.siteUrl,pages:a.pages.length,generatedAt:a.generatedAt,partial:a.partial,truncated:a.truncated}:null,checkpoint:s};return t.json?(console.log(JSON.stringify(c,null,2)),0):(console.log("SEO Crawl Audit status"),a?(console.log(` Snapshot: ${r}`),console.log(` Site: ${a.siteUrl}`),console.log(` Last completed result: ${a.pages.length.toLocaleString("en-US")} page(s) at ${a.generatedAt}`)):console.log(` Snapshot: not found (${r})`),s.status==="missing"?console.log(` Checkpoint: not found (${n})`):(console.log(` Checkpoint: ${s.status} (${n})`),s.siteUrl&&console.log(` Checkpoint site: ${s.siteUrl}`),console.log(` Saved pages: ${s.completedPages.toLocaleString("en-US")}`),s.updatedAt&&console.log(` Updated: ${s.updatedAt}`),s.message&&console.log(` Detail: ${s.message}`),s.resumable&&console.log(" Resume: run the same scan command again to reuse saved pages.")),0)}function ha(e,t=!1){return t||!e["no-report"]&&(e.report!==void 0||process.stdin.isTTY&&process.stdout.isTTY&&!e.json)}async function st(e,t,r=!1){if(!ha(e,r))return null;let n=ie(e.report??Aa);return await Rr(n,t),n}function oe(e,t,r){if(!e)return e;try{let n=new URL(t),s=new URL(r),a=new URL(e);if(a.origin!==n.origin)return e;a.protocol=s.protocol,a.host=s.host;let c=n.pathname.replace(/\/$/,""),l=s.pathname.replace(/\/$/,"");return c&&a.pathname.startsWith(c)&&(a.pathname=`${l}${a.pathname.slice(c.length)}`||"/"),a.href}catch{return e}}function Vu(e,t,r){let n=s=>s.map(a=>oe(a,t,r)??a).sort();return{...e,url:oe(e.url,t,r)??e.url,finalUrl:oe(e.finalUrl,t,r),canonical:oe(e.canonical,t,r),canonicalRaw:oe(e.canonicalRaw,t,r),links:n(e.links),internalLinks:n(e.internalLinks),externalLinks:n(e.externalLinks),images:e.images.map(s=>({...s,src:oe(s.src,t,r)})),hreflang:e.hreflang.map(s=>({...s,url:oe(s.url,t,r)})),redirectChain:e.redirectChain.map(s=>({...s,url:oe(s.url,t,r)??s.url,location:oe(s.location,t,r)}))}}function $u(e,t,r=nt(e),n={}){return{mode:t,startUrl:e.siteUrl,generatedAt:e.generatedAt,pages:e.pages,pageDetails:e.pages,issues:r,partial:e.partial,complete:!e.partial&&!e.truncated,engineVersion:e.engineVersion,ruleSetVersion:e.ruleSetVersion,branding:e.config.report,siteMetrics:rt(e),...n}}async function He(e,t,r,n,s={}){let a=ua(da(n),".seo-audit.metrics.json"),c=await Pn(e,a,{onWarning:l=>console.error(`Warning: ${l}`)});return $u(e,t,r,{...s,siteMetrics:c})}function ga(e,t){return e["history-dir"]?ie(e["history-dir"]):t?ua(da(t),la):ie(la)}async function Wn(e,t,r,n){if(e["no-history"])return;let s=ga(e,r);n&&!t.partial&&await Mn(s,t);let a=await Mt(s,t.siteUrl);return kt(a.map(c=>c.snapshot))??void 0}async function Xu(e,t,r,n,s){let a=Ut(e,t,r),c=t.json?process.stderr:process.stdout,l=d=>{d.type==="plan-start"&&le(`Preparing crawl plan for ${d.url}`,c),d.type==="robots"&&le(d.robots.error?`robots.txt check failed: ${d.robots.error}`:`robots.txt checked (${d.robots.status??"unknown status"})`,c),d.type==="sitemap"&&le(d.sitemap?`Sitemap loaded: ${d.candidateCount??d.sitemap.urls.length} candidate URL(s)`:"No sitemap found; internal-link discovery will be used",c)},o=await ue(a,{signal:s,fetch:n,onEvent:l});if(o.mode==="links"&&a.sitemap==="auto"&&process.stdin.isTTY&&process.stdout.isTTY&&!t.json){let d=await Fe("Sitemap was not found. Enter its full URL, or press Enter to crawl internal links: ");d&&(a={...a,sitemap:d},o=await ue(a,{signal:s,fetch:n,onEvent:l}))}return o}function ma(e,t){if(e.candidateCount===null){if(t.all)throw new Error("--all requires a sitemap");return{mode:"fixed",target:e.config.maxPages}}return t.all?{mode:"all",target:e.candidateCount}:t.pages!==void 0||t["max-pages"]!==void 0?{mode:"fixed",target:Math.min(e.config.maxPages,e.candidateCount)}:process.stdin.isTTY&&process.stdout.isTTY&&!t.json?aa(e.candidateCount):{mode:"fixed",target:Math.min(100,e.candidateCount)}}async function fa(e,t,r){if(!e)throw new Error("scan requires a URL");Mr(t);let n=ie(t.output??Yt),s=Ht(t["headers-env"],e),a=await Xu(e,t,void 0,s,r),c=await ma(a,t),l=Qn(Or(n),t["headers-env"]),o=t["no-cache"]?void 0:Un(l),d=t.json?process.stderr:process.stdout;oa(a,c,!!o,d);let p=new Map,h=ha(t)?ie(t.report??Aa):null,f=0,m=-1,y=async(G=!1)=>{if(!h||p.size===0)return;let x=Date.now();if(!G&&p.size-m<100&&x-f<5e3)return;let D=ye({schemaVersion:1,startUrl:a.startUrl,robots:a.robots,sitemap:a.sitemap,options:{...a.config,maxPages:c.target},pages:[...p.values()],partial:!0,truncated:!0});await Rr(h,await He(D,"scan",nt(D),n,{partial:!0,targetPages:c.target})),f=x,m=p.size},w=c.mode==="step"?Math.min(100,c.target):c.target,I=null,_=!1,N=await Pr(t);try{for(;w>0;){let G=ca(w,c.mode==="step",d);I=await tt(a,{signal:r,fetch:s,renderer:N,limit:w,checkpointStore:o,retainCheckpoint:!!o,async onBatch(F){for(let $ of F)p.set($.url,$);await y()},onEvent(F){F.type==="scan-start"&&le(`Starting crawl: up to ${F.total.toLocaleString("en-US")} page(s)`,t.json?process.stderr:process.stdout),F.type==="resume"&&le(`Resuming from checkpoint: ${F.completed.toLocaleString("en-US")} page(s) already available`,t.json?process.stderr:process.stdout),F.type==="retry"&&(G.retry(),le(`Retrying request (attempt ${F.attempt}) after ${F.delayMs} ms`,d)),F.type==="progress"&&G.progress(F.page,F.completed),F.type==="cancelled"&&le(`Scan interrupted after ${F.completed.toLocaleString("en-US")} page(s)`,t.json?process.stderr:process.stdout)}});for(let F of I.pages)p.set(F.url,F);if(await y(!0),I.partial||c.mode!=="step"||w>=c.target)break;Gn(Yn(I.pages));let x=Math.min(100,c.target-w),D=await Fe(`Check the next ${x} page(s)? [y/N] `);if(!["y","yes"].includes(D.toLowerCase())){_=!0;break}w=Math.min(c.target,w+100)}}finally{await N?.close?.()}if(!I)throw new Error("scan did not produce a result");await _r(n,I.snapshot);let L=I.partial||_,B=await Wn(t,I.snapshot,n,!L),R=L?h:await st(t,await He(I.snapshot,"scan",nt(I.snapshot),n,B?{history:B}:{}));L||await o?.clearCurrent();let P=Yn(I.snapshot.pages);return t.json?console.log(JSON.stringify({command:"scan",pages:I.snapshot.pages.length,truncated:I.snapshot.truncated,health:P,output:n,report:R,checkpoint:L&&o?l:null},null,2)):(console.log(`Crawled ${I.snapshot.pages.length} page(s)${I.snapshot.truncated?" (limit reached)":""}.`),I.snapshot.sitemap&&console.log(`Loaded ${I.snapshot.sitemap.sitemapCount} sitemap file(s) from ${I.snapshot.sitemap.url}.`),Gn(P),console.log(`Baseline saved to ${n}`),R&&console.log(`HTML report saved to ${R}`),L&&o&&console.log(`Resume checkpoint saved to ${l}`)),I.partial?130:0}async function Ea(e,t,r){Mr(t);let n=ie(t.baseline??Yt),s=await Se(n),a=e??s.siteUrl,c=Ht(t["headers-env"],a),l=await ue({...Ut(a,t,s),sitemap:"none"},{signal:r,fetch:c}),o=s.pages.map(R=>({baselineUrl:R.url,targetUrl:oe(R.url,s.siteUrl,l.startUrl)??R.url})),d=[...new Set(o.map(({targetUrl:R})=>R))],p={...l,mode:"sitemap",candidateUrls:d,candidateCount:d.length,sitemap:{url:`${l.origin}/.seo-audit-targets`,urls:d,sitemapCount:0,truncated:!1,error:null}},h=await Pr(t),f;try{f=await tt(p,{signal:r,fetch:c,renderer:h,limit:d.length,onEvent(R){R.type==="scan-start"&&le(`Starting regression check: ${R.total.toLocaleString("en-US")} page(s)`,t.json?process.stderr:process.stdout),R.type==="progress"&&Qt(R.completed,d.length,!1,t.json?process.stderr:process.stdout)}})}finally{await h?.close?.()}let m=new Map(f.pages.map(R=>[R.url,R])),y=o.flatMap(({baselineUrl:R,targetUrl:P})=>{let G=m.get(P);return G?[{...G,url:R,finalUrl:oe(G.finalUrl,l.startUrl,s.siteUrl)}]:[]}),w=ye({...f.snapshot,siteUrl:s.siteUrl,config:{...f.snapshot.config,url:s.siteUrl},sitemap:s.sitemap,pages:y}),I=Ln(s,w,{enabledRules:w.config.enabledRules,severityOverrides:w.config.severityOverrides,suppressions:w.config.suppressions}),_=I.newIssues,N=Ft(_),L=await Wn(t,w,n,!f.partial),B=await st(t,await He(w,"check",_,n,{...I,...L?{history:L}:{}}));return t.json?console.log(JSON.stringify({command:"check",baseline:n,pages:w.pages.length,summary:N,issues:_,lifecycle:I,report:B},null,2)):(console.log(`Checked ${w.pages.length} page(s).
191
+ `),kr(_),B&&console.log(`HTML report saved to ${B}`)),f.partial?130:N.error>0||I.budgetExceeded.length>0||t.strict&&N.warning>0?1:0}async function Ta(e,t){Mr(e);let r=e.production,n=e.preview;if(!r||!n)throw new Error("compare requires --production and --preview URLs");let s=Ht(e["production-headers-env"],r),a=Ht(e["preview-headers-env"],n),c=await ue(Ut(r,e),{signal:t,fetch:s}),l=await ma(c,e),o=await Pr(e),d;try{d=await tt(c,{signal:t,fetch:s,renderer:o,limit:l.target,onEvent(R){R.type==="scan-start"&&le(`Starting production crawl: up to ${R.total.toLocaleString("en-US")} page(s)`,e.json?process.stderr:process.stdout),R.type==="progress"&&Qt(R.completed,l.target,!1,e.json?process.stderr:process.stdout)}})}finally{await o?.close?.()}if(d.partial)return 130;let p=await ue({...Ut(n,e),sitemap:"none"},{signal:t,fetch:a}),h=d.snapshot.pages.map(R=>oe(R.url,r,n)??R.url),f={...p,mode:"sitemap",candidateUrls:[...new Set(h)].sort(),candidateCount:h.length,sitemap:{url:`${p.origin}/.seo-audit-preview-targets`,urls:[...new Set(h)].sort(),sitemapCount:0,truncated:!1,error:null}},m=await Pr(e),y;try{y=await tt(f,{signal:t,fetch:a,renderer:m,limit:h.length,onEvent(R){R.type==="scan-start"&&le(`Starting preview crawl: ${R.total.toLocaleString("en-US")} page(s)`,e.json?process.stderr:process.stdout),R.type==="progress"&&Qt(R.completed,h.length,!1,e.json?process.stderr:process.stdout)}})}finally{await m?.close?.()}let w=y.snapshot.pages.map(R=>Vu(R,n,r)),I=ye({...y.snapshot,siteUrl:d.snapshot.siteUrl,startUrl:d.snapshot.siteUrl,config:{...y.snapshot.config,url:d.snapshot.siteUrl},robots:{...y.snapshot.robots,url:oe(y.snapshot.robots.url,n,r)??y.snapshot.robots.url},sitemap:d.snapshot.sitemap,pages:w,partial:y.snapshot.partial}),_=Ln(d.snapshot,I,{enabledRules:I.config.enabledRules,severityOverrides:I.config.severityOverrides,suppressions:I.config.suppressions}),N=_.newIssues,L=Ft(N),B=await st(e,await He(I,"check",N,ie(Yt),{..._,comparison:{kind:"preview",productionUrl:r,previewUrl:n}}),!0);return e.json?console.log(JSON.stringify({command:"compare",production:r,preview:n,pages:I.pages.length,summary:L,issues:N,lifecycle:_,report:B},null,2)):(console.log(`Compared ${I.pages.length} production page(s) with preview.`),kr(N),B&&console.log(`HTML report saved to ${B}`)),y.partial?130:L.error>0||_.budgetExceeded.length>0||e.strict&&L.warning>0?1:0}async function ba(e,t){let r=ie(e??t.baseline??Yt),n=await Se(r),s=await Wn(t,n,r,!1),a=await st(t,await He(n,"scan",nt(n),r,s?{history:s}:{}),!0);return t.json?console.log(JSON.stringify({command:"report",baseline:r,pages:n.pages.length,report:a},null,2)):console.log(`HTML report saved to ${a}`),0}async function Ca(e,t){if(!!t.from!=!!t.to)throw new Error("history comparison requires both --from and --to");let r=ga(t);if(t.from&&t.to){let d=await Se(ie(t.from)),p=await Se(ie(t.to));if(d.siteUrl!==p.siteUrl)throw new Error("history snapshots must belong to the same site URL");let h=await Mt(r,p.siteUrl),f=kt([...h.map(_=>_.snapshot),d,p]),{diff:m,summary:y}=_n(d,p,{evaluatedAt:new Date().toISOString()}),w=await st(t,await He(p,"check",m.newIssues,ie(t.to),{...m,...f?{history:f}:{}}),!0),I=Ft(m.newIssues);return t.json?console.log(JSON.stringify({command:"history",from:ie(t.from),to:ie(t.to),summary:I,lifecycle:m,comparisonSummary:y,report:w},null,2)):(console.log(`Compared local snapshots from ${d.generatedAt} to ${p.generatedAt}.`),console.log(`Coverage: ${y.coverage.common} common pages; ${y.coverage.onlyBefore} only before; ${y.coverage.onlyAfter} only after.`),y.warnings.length>0&&console.log(`Comparison warnings: ${y.warnings.join(", ")}`),y.unverified.length>0&&console.log(`${y.unverified.length} apparent resolution(s) could not be verified.`),kr(m.newIssues),w&&console.log(`HTML report saved to ${w}`)),0}let n;if(e)try{n=new URL(e).href}catch{throw new Error("history URL must be an HTTP(S) URL")}let s=await Mt(r,n);if(s.length===0)throw new Error(`no local history snapshots found in ${r}`);if(!n){let d=s.at(-1).snapshot.siteUrl;s=s.filter(p=>p.snapshot.siteUrl===d)}let a=s.at(-1),c=kt(s.map(d=>d.snapshot)),l=await st(t,await He(a.snapshot,"scan",nt(a.snapshot),a.path,c?{history:c}:{}),!0),o=c?.points??[];if(t.json)console.log(JSON.stringify({command:"history",directory:r,snapshots:s.map((d,p)=>({path:d.path,...o[p]})),report:l},null,2));else{console.log(`Local history for ${a.snapshot.siteUrl}:`);for(let[d,p]of s.entries()){let h=o[d];console.log(` ${p.snapshot.generatedAt} ${h?.pages??p.snapshot.pages.length} pages ${h?.errors??0} errors ${h?.warnings??0} warnings ${p.path}`)}l&&console.log(`HTML report saved to ${l}`)}return 0}import{mkdir as wa,readFile as Zu,writeFile as xa}from"node:fs/promises";import{dirname as Sa,isAbsolute as zu,join as Kn,resolve as Ia}from"node:path";var qu="https://raw.githubusercontent.com/MelnixDev/seo-crawl-audit/v0/packages/core/config.schema.json",eA="seo-audit.config.json",tA=".github/workflows/seo-audit.yml",rA=[".seo-audit.checkpoint.ndjson",".seo-audit.metrics.json",".seo-audit/history/","seo-audit-report.html","seo-audit-report.html.json"];function nA(e){let t;try{t=new URL(e)}catch(r){throw new Error("init URL must be a full HTTP(S) URL",{cause:r})}if(!["http:","https:"].includes(t.protocol))throw new Error("init URL must be a full HTTP(S) URL");return t.hash="",t.href}function sA(e){let t=(e??"none").trim().toLowerCase(),n={"":"none",none:"none",manual:"manual",scheduled:"scheduled",schedule:"scheduled","pull-request":"pull-request",pull_request:"pull-request",pr:"pull-request"}[t];if(!n)throw new Error("--workflow must be none, manual, scheduled, or pull-request");return n}function iA(e){return`${JSON.stringify({$schema:qu,url:e,sitemap:"auto",maxPages:100,concurrency:5,delay:100,timeout:1e4,respectRobots:!0,includeQuery:!1,maxRedirects:10,maxResponseBytes:5*1024*1024,enabledRules:null,severityOverrides:{},suppressions:[],regressionBudgets:{error:0},report:{}},null,2)}
190
192
  `}function Jn(e="",t=""){return` - uses: actions/checkout@v6${t}
191
193
  - name: Run SEO Crawl Audit
192
194
  id: seo
@@ -204,7 +206,7 @@ Sitemap contains ${e.toLocaleString("en-US")} page(s).`),console.log("How many p
204
206
  \${{ steps.seo.outputs.report }}
205
207
  \${{ steps.seo.outputs.summary }}
206
208
  if-no-files-found: warn
207
- `}function sA(e){return e==="manual"?`name: SEO audit
209
+ `}function aA(e){return e==="manual"?`name: SEO audit
208
210
 
209
211
  on:
210
212
  workflow_dispatch:
@@ -256,19 +258,19 @@ ${Jn(`
256
258
  if [ ! -f .seo-audit.json ]; then
257
259
  echo "Commit .seo-audit.json as the production baseline." >&2
258
260
  exit 1
259
- fi`)}`}function Sa(e){return e&&typeof e=="object"&&"code"in e&&typeof e.code=="string"?e.code:void 0}async function Na(e){try{return await $u(e,"utf8")}catch(t){if(Sa(t)==="ENOENT")return null;throw t}}async function iA(e,t){if(t.force)return!0;if(!t.interactive||!t.ask)return!1;let r=await t.ask(`${e} already exists. Replace it? [y/N] `);return["y","yes"].includes(r.trim().toLowerCase())}async function Ia(e,t,r){let n=await Na(e);if(n===t)return{path:e,status:"unchanged"};if(n!==null&&!await iA(e,r))return{path:e,status:"skipped"};await ya(xa(e),{recursive:!0});try{await wa(e,t,n===null?{encoding:"utf8",flag:"wx"}:{encoding:"utf8"})}catch(s){if(n===null&&Sa(s)==="EEXIST")return{path:e,status:"skipped"};throw s}return{path:e,status:n===null?"created":"updated"}}async function aA(e,t){let r=await Na(e),n=new Set((r??"").split(/\r?\n/u)),s=eA.filter(o=>!n.has(o));if(s.length===0)return{path:e,status:"unchanged"};if(r!==null&&!t.force&&!t.yes){if(!t.interactive||!t.ask)return{path:e,status:"skipped"};let o=await t.ask(`Add SEO Crawl Audit recommendations to ${e}? [Y/n] `);if(["n","no"].includes(o.trim().toLowerCase()))return{path:e,status:"skipped"}}let a=r&&!r.endsWith(`
261
+ fi`)}`}function Na(e){return e&&typeof e=="object"&&"code"in e&&typeof e.code=="string"?e.code:void 0}async function _a(e){try{return await Zu(e,"utf8")}catch(t){if(Na(t)==="ENOENT")return null;throw t}}async function oA(e,t){if(t.force)return!0;if(!t.interactive||!t.ask)return!1;let r=await t.ask(`${e} already exists. Replace it? [y/N] `);return["y","yes"].includes(r.trim().toLowerCase())}async function ya(e,t,r){let n=await _a(e);if(n===t)return{path:e,status:"unchanged"};if(n!==null&&!await oA(e,r))return{path:e,status:"skipped"};await wa(Sa(e),{recursive:!0});try{await xa(e,t,n===null?{encoding:"utf8",flag:"wx"}:{encoding:"utf8"})}catch(s){if(n===null&&Na(s)==="EEXIST")return{path:e,status:"skipped"};throw s}return{path:e,status:n===null?"created":"updated"}}async function cA(e,t){let r=await _a(e),n=new Set((r??"").split(/\r?\n/u)),s=rA.filter(o=>!n.has(o));if(s.length===0)return{path:e,status:"unchanged"};if(r!==null&&!t.force&&!t.yes){if(!t.interactive||!t.ask)return{path:e,status:"skipped"};let o=await t.ask(`Add SEO Crawl Audit recommendations to ${e}? [Y/n] `);if(["n","no"].includes(o.trim().toLowerCase()))return{path:e,status:"skipped"}}let a=r&&!r.endsWith(`
260
262
  `)?`
261
263
  `:"",c=r===null||!r.includes("# SEO Crawl Audit")?`# SEO Crawl Audit
262
264
  `:"",l=`${a}${c}${s.join(`
263
265
  `)}
264
- `;return await ya(xa(e),{recursive:!0}),await wa(e,`${r??""}${l}`,"utf8"),{path:e,status:r===null?"created":"updated"}}async function oA(e={}){let t=Ca(e.directory??process.cwd()),r=e.interactive??!!(process.stdin.isTTY&&process.stdout.isTTY),n=e.ask??Fe,s=e.url?.trim()??"";if(!s&&r&&!e.yes&&(s=await n("Full site URL: ")),!s)throw new Error("init requires a full site URL");let a=tA(s),c=e.workflow;c===void 0&&r&&!e.yes&&(c=await n("GitHub workflow [none/manual/scheduled/pull-request] (none): "));let l=rA(c),o=e.configPath?Xu(e.configPath)?e.configPath:Ca(t,e.configPath):Kn(t,zu),d={force:e.force??!1,yes:e.yes??!1,interactive:r,ask:n},p=[await Ia(o,nA(a),d),await aA(Kn(t,".gitignore"),d)];return l!=="none"&&p.push(await Ia(Kn(t,qu),sA(l),d)),{directory:t,url:a,workflow:l,files:p}}async function _a(e,t){let r=await oA({...t.directory!==void 0?{directory:t.directory}:{},...e!==void 0?{url:e}:{},...t.config!==void 0?{configPath:t.config}:{},...t.workflow!==void 0?{workflow:t.workflow}:{},...t.yes!==void 0?{yes:t.yes}:{},...t.force!==void 0?{force:t.force}:{}});if(t.json)return console.log(JSON.stringify({command:"init",...r},null,2)),0;console.log(`Initialized SEO Crawl Audit for ${r.url}`);for(let n of r.files)console.log(` ${n.status.padEnd(9)} ${n.path}`);return r.workflow==="pull-request"&&console.log("Set the SEO_AUDIT_PREVIEW_URL repository variable and commit .seo-audit.json before enabling the PR check."),console.log("Review seo-audit.config.json, then run: seo-audit scan"),0}import{access as cA,stat as lA}from"node:fs/promises";import{constants as dA}from"node:fs";import{dirname as jn,isAbsolute as uA,resolve as Vn}from"node:path";var Ra=[20,19,0],AA=".seo-audit.json",pA="seo-audit-report.html",hA=".seo-audit/history";function gA(e){let t=/^(\d+)\.(\d+)\.(\d+)/u.exec(e);return t?[Number(t[1]),Number(t[2]),Number(t[3])]:[0,0,0]}function mA(e){let t=gA(e);for(let r=0;r<Ra.length;r+=1){let n=t[r]??0,s=Ra[r]??0;if(n>s)return!0;if(n<s)return!1}return!0}function fA(e){try{let t=new URL(e);return["http:","https:"].includes(t.protocol)?(t.hash="",t.href):null}catch{return null}}function Ur(e,t){return uA(t)?t:Vn(e,t)}async function EA(e){let t=Vn(e);for(;;){try{if((await lA(t)).isDirectory())return t}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ENOENT")throw n}let r=jn(t);if(r===t)throw new Error(`no existing parent directory for ${e}`);t=r}}async function TA(e,t){let r=[jn(Ur(e,t.outputPath??AA)),...t.reportEnabled===!1?[]:[jn(Ur(e,t.reportPath??pA))],...t.historyEnabled===!1?[]:[Ur(e,t.historyPath??hA)]];try{let n=[...new Set(await Promise.all(r.map(EA)))];return await Promise.all(n.map(s=>cA(s,dA.W_OK))),{id:"storage",status:"pass",message:`Output locations are writable through ${n.join(", ")}`,evidence:{directories:n}}}catch(n){return{id:"storage",status:"fail",message:n instanceof Error?n.message:String(n),remediation:"Create the output directory or grant the current user write access."}}}function bA(e,t){let r=AbortSignal.timeout(e);return t?AbortSignal.any([t,r]):r}async function CA(e,t,r,n){try{let s=await r(e,{headers:{accept:"text/html,application/xhtml+xml;q=0.9,*/*;q=0.1","user-agent":`SEO-Crawl-Audit-Doctor/${X}`},redirect:"follow",signal:bA(t.timeout,n)}),a=s.headers.get("content-type")??"";return await s.body?.cancel(),s.status>=400?{id:"homepage",status:"fail",message:`Start URL returned HTTP ${s.status}`,remediation:s.status===401||s.status===403?"Configure authenticated request headers before auditing this site.":"Confirm that the URL is correct and publicly reachable.",evidence:{status:s.status,contentType:a}}:a.toLowerCase().includes("html")?{id:"homepage",status:"pass",message:`Start URL returned HTTP ${s.status} HTML`,evidence:{status:s.status,contentType:a}}:{id:"homepage",status:"warning",message:`Start URL returned ${a||"an unknown content type"}`,remediation:"Use a URL that returns server-rendered HTML.",evidence:{status:s.status,contentType:a}}}catch(s){return n?.throwIfAborted(),{id:"homepage",status:"fail",message:`Could not request the start URL: ${s instanceof Error?s.message:String(s)}`,remediation:"Check DNS, TLS, firewall access, and the configured timeout."}}}function IA(e){return e.reduce((t,r)=>(t[r.status]+=1,t),{pass:0,warning:0,fail:0,skipped:0})}async function yA(e={}){let t=Vn(e.directory??process.cwd()),r=[],n=e.runtimeVersion??process.versions.node;r.push(mA(n)?{id:"runtime",status:"pass",message:`Node.js ${n} satisfies >=20.19`}:{id:"runtime",status:"fail",message:`Node.js ${n} is older than 20.19`,remediation:"Install Node.js 20.19 or newer on the machine running SEO Crawl Audit."});let a=(e.configPath?Ur(t,e.configPath):null)??await Nr(t),c={};if(!a)r.push({id:"config",status:"warning",message:"seo-audit.config.json was not found",remediation:"Run seo-audit init <url> to create a safe project configuration."});else try{c=await Pt(a),r.push({id:"config",status:"pass",message:`Configuration is valid: ${a}`,evidence:{path:a}})}catch(h){r.push({id:"config",status:"fail",message:h instanceof Error?h.message:String(h),remediation:"Fix the reported property or regenerate the file with seo-audit init --force."})}let l=e.url??c.url??"",o=fA(l);o?r.push({id:"target",status:"pass",message:`Target URL is ${o}`,evidence:{url:o}}):r.push({id:"target",status:"fail",message:l?"Target is not a full HTTP(S) URL":"No target URL was provided",remediation:"Pass seo-audit doctor https://example.com/ or set url in seo-audit.config.json."}),r.push(await TA(t,e));let d=e.offline??!1;if(d||!o){let h=d?"Skipped by --offline":"Skipped because the target URL is invalid";for(let f of["homepage","robots","sitemap"])r.push({id:f,status:"skipped",message:h})}else{let h=Te({url:o},c),f=Hn(e.requestHeaders??{},o,e.fetch??globalThis.fetch);r.push(await CA(o,h,f,e.signal));try{let m=await ue(h,{fetch:f,signal:e.signal});m.robots.denyAll&&h.respectRobots?r.push({id:"robots",status:"fail",message:`robots.txt returned HTTP ${m.robots.status??"unknown"} and blocks crawling`,remediation:"Allow the audit user agent or explicitly choose --ignore-robots when authorized.",evidence:{url:m.robots.url,status:m.robots.status,denyAll:!0}}):m.robots.error||m.robots.status===null||(m.robots.status??500)>=400?r.push({id:"robots",status:"warning",message:m.robots.error??`robots.txt returned HTTP ${m.robots.status??"unknown"}`,remediation:"Publish a readable robots.txt when crawler policy needs to be explicit.",evidence:{url:m.robots.url,status:m.robots.status}}):r.push({id:"robots",status:"pass",message:`robots.txt returned HTTP ${m.robots.status}`,evidence:{url:m.robots.url,status:m.robots.status,denyAll:m.robots.denyAll??!1}}),h.sitemap==="none"?r.push({id:"sitemap",status:"skipped",message:"Sitemap discovery is disabled by configuration"}):m.sitemap?m.sitemap.error?r.push({id:"sitemap",status:h.sitemap==="auto"?"warning":"fail",message:m.sitemap.error,remediation:"Check the sitemap URL, XML syntax, response size, and HTTP status.",evidence:{url:m.sitemap.url}}):m.sitemap.urls.length===0?r.push({id:"sitemap",status:"warning",message:`Sitemap contains no crawlable same-origin URLs: ${m.sitemap.url}`,remediation:"Add canonical site URLs to the sitemap or verify the configured site origin."}):r.push({id:"sitemap",status:"pass",message:`Loaded ${m.sitemap.urls.length} URL(s) from ${m.sitemap.sitemapCount} sitemap file(s)`,evidence:{url:m.sitemap.url,urls:m.sitemap.urls.length,sitemapCount:m.sitemap.sitemapCount,truncated:m.sitemap.truncated}}):r.push({id:"sitemap",status:"warning",message:"No sitemap was discovered",remediation:"Publish a sitemap or set sitemap to none when link-only crawling is intentional."})}catch(m){e.signal?.throwIfAborted(),r.push({id:"robots",status:"fail",message:`Planning failed: ${m instanceof Error?m.message:String(m)}`,remediation:"Check network access, robots.txt redirects, sitemap responses, and timeout settings."}),r.push({id:"sitemap",status:"skipped",message:"Skipped because scan planning failed"})}}let p=IA(r);return{healthy:p.fail===0,offline:d,url:o,checks:r,summary:p}}function wA(e){console.log("SEO Crawl Audit doctor");let t={pass:"PASS",warning:"WARN",fail:"FAIL",skipped:"SKIP"};for(let r of e.checks)console.log(`[${t[r.status]}] ${r.id}: ${r.message}`),r.remediation&&console.log(` Fix: ${r.remediation}`);console.log(e.healthy?`Ready with ${e.summary.warning} warning(s) and ${e.summary.skipped} skipped check(s).`:`Not ready: ${e.summary.fail} check(s) failed.`)}async function La(e,t,r){let n=await yA({...t.directory!==void 0?{directory:t.directory}:{},...e!==void 0?{url:e}:{},...t.config!==void 0?{configPath:t.config}:{},...t.output!==void 0?{outputPath:t.output}:{},...t.report!==void 0?{reportPath:t.report}:{},...t["history-dir"]!==void 0?{historyPath:t["history-dir"]}:{},reportEnabled:t["no-report"]!==!0,historyEnabled:t["no-history"]!==!0,offline:t.offline===!0,requestHeaders:Br(t["headers-env"]),...r!==void 0?{signal:r}:{}});return t.json?console.log(JSON.stringify({command:"doctor",...n},null,2)):wA(n),n.healthy?0:1}import{lstat as xA,mkdir as va,readFile as $n,realpath as Oa,writeFile as Da}from"node:fs/promises";import{dirname as Xn,join as ge,relative as SA,resolve as ka}from"node:path";import{fileURLToPath as NA}from"node:url";var _A=ka(NA(new URL("../agent-skill/seo-crawl-audit",import.meta.url)));async function RA(e,t){let r=await Oa(e),n=t;for(;;)try{let s=await Oa(n),a=SA(r,s);if(a===".."||a.startsWith(`..${process.platform==="win32"?"\\":"/"}`))throw new Error(`generated agent path escapes the project through a symlink: ${t}`);return}catch(s){if(s.code!=="ENOENT")throw s;try{if((await xA(n)).isSymbolicLink())throw new Error(`generated agent path escapes the project through an unresolved symlink: ${t}`)}catch(c){if(c.code!=="ENOENT")throw c}let a=Xn(n);if(a===n)throw s;n=a}}function LA(e){let t=(e??"all").toLowerCase();if(t==="all")return["codex","claude","opencode"];if(["codex","claude","opencode"].includes(t))return[t];throw new Error("--platform must be codex, claude, opencode, or all")}async function OA(e,t,r){let n=null;try{n=await $n(t,"utf8")}catch(a){if(a.code!=="ENOENT")throw a}let s=await $n(e,"utf8");return n===s?{path:t,status:"unchanged"}:n!==null&&!r?{path:t,status:"skipped"}:(await va(Xn(t),{recursive:!0}),await Da(t,s,"utf8"),{path:t,status:n===null?"created":"updated"})}async function vA(e,t,r){let n=null;try{n=await $n(e,"utf8")}catch(s){if(s.code!=="ENOENT")throw s}return n===t?{path:e,status:"unchanged"}:n!==null&&!r?{path:e,status:"skipped"}:(await va(Xn(e),{recursive:!0}),await Da(e,t,"utf8"),{path:e,status:n===null?"created":"updated"})}function DA(){return`[mcp_servers.seo-crawl-audit]
266
+ `;return await wa(Sa(e),{recursive:!0}),await xa(e,`${r??""}${l}`,"utf8"),{path:e,status:r===null?"created":"updated"}}async function lA(e={}){let t=Ia(e.directory??process.cwd()),r=e.interactive??!!(process.stdin.isTTY&&process.stdout.isTTY),n=e.ask??Fe,s=e.url?.trim()??"";if(!s&&r&&!e.yes&&(s=await n("Full site URL: ")),!s)throw new Error("init requires a full site URL");let a=nA(s),c=e.workflow;c===void 0&&r&&!e.yes&&(c=await n("GitHub workflow [none/manual/scheduled/pull-request] (none): "));let l=sA(c),o=e.configPath?zu(e.configPath)?e.configPath:Ia(t,e.configPath):Kn(t,eA),d={force:e.force??!1,yes:e.yes??!1,interactive:r,ask:n},p=[await ya(o,iA(a),d),await cA(Kn(t,".gitignore"),d)];return l!=="none"&&p.push(await ya(Kn(t,tA),aA(l),d)),{directory:t,url:a,workflow:l,files:p}}async function Ra(e,t){let r=await lA({...t.directory!==void 0?{directory:t.directory}:{},...e!==void 0?{url:e}:{},...t.config!==void 0?{configPath:t.config}:{},...t.workflow!==void 0?{workflow:t.workflow}:{},...t.yes!==void 0?{yes:t.yes}:{},...t.force!==void 0?{force:t.force}:{}});if(t.json)return console.log(JSON.stringify({command:"init",...r},null,2)),0;console.log(`Initialized SEO Crawl Audit for ${r.url}`);for(let n of r.files)console.log(` ${n.status.padEnd(9)} ${n.path}`);return r.workflow==="pull-request"&&console.log("Set the SEO_AUDIT_PREVIEW_URL repository variable and commit .seo-audit.json before enabling the PR check."),console.log("Review seo-audit.config.json, then run: seo-audit scan"),0}import{access as dA,stat as uA}from"node:fs/promises";import{constants as AA}from"node:fs";import{dirname as jn,isAbsolute as pA,resolve as Vn}from"node:path";var La=[20,19,0],hA=".seo-audit.json",gA="seo-audit-report.html",mA=".seo-audit/history";function fA(e){let t=/^(\d+)\.(\d+)\.(\d+)/u.exec(e);return t?[Number(t[1]),Number(t[2]),Number(t[3])]:[0,0,0]}function EA(e){let t=fA(e);for(let r=0;r<La.length;r+=1){let n=t[r]??0,s=La[r]??0;if(n>s)return!0;if(n<s)return!1}return!0}function TA(e){try{let t=new URL(e);return["http:","https:"].includes(t.protocol)?(t.hash="",t.href):null}catch{return null}}function Ur(e,t){return pA(t)?t:Vn(e,t)}async function bA(e){let t=Vn(e);for(;;){try{if((await uA(t)).isDirectory())return t}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ENOENT")throw n}let r=jn(t);if(r===t)throw new Error(`no existing parent directory for ${e}`);t=r}}async function CA(e,t){let r=[jn(Ur(e,t.outputPath??hA)),...t.reportEnabled===!1?[]:[jn(Ur(e,t.reportPath??gA))],...t.historyEnabled===!1?[]:[Ur(e,t.historyPath??mA)]];try{let n=[...new Set(await Promise.all(r.map(bA)))];return await Promise.all(n.map(s=>dA(s,AA.W_OK))),{id:"storage",status:"pass",message:`Output locations are writable through ${n.join(", ")}`,evidence:{directories:n}}}catch(n){return{id:"storage",status:"fail",message:n instanceof Error?n.message:String(n),remediation:"Create the output directory or grant the current user write access."}}}function IA(e,t){let r=AbortSignal.timeout(e);return t?AbortSignal.any([t,r]):r}async function yA(e,t,r,n){try{let s=await r(e,{headers:{accept:"text/html,application/xhtml+xml;q=0.9,*/*;q=0.1","user-agent":`SEO-Crawl-Audit-Doctor/${X}`},redirect:"follow",signal:IA(t.timeout,n)}),a=s.headers.get("content-type")??"";return await s.body?.cancel(),s.status>=400?{id:"homepage",status:"fail",message:`Start URL returned HTTP ${s.status}`,remediation:s.status===401||s.status===403?"Configure authenticated request headers before auditing this site.":"Confirm that the URL is correct and publicly reachable.",evidence:{status:s.status,contentType:a}}:a.toLowerCase().includes("html")?{id:"homepage",status:"pass",message:`Start URL returned HTTP ${s.status} HTML`,evidence:{status:s.status,contentType:a}}:{id:"homepage",status:"warning",message:`Start URL returned ${a||"an unknown content type"}`,remediation:"Use a URL that returns server-rendered HTML.",evidence:{status:s.status,contentType:a}}}catch(s){return n?.throwIfAborted(),{id:"homepage",status:"fail",message:`Could not request the start URL: ${s instanceof Error?s.message:String(s)}`,remediation:"Check DNS, TLS, firewall access, and the configured timeout."}}}function wA(e){return e.reduce((t,r)=>(t[r.status]+=1,t),{pass:0,warning:0,fail:0,skipped:0})}async function xA(e={}){let t=Vn(e.directory??process.cwd()),r=[],n=e.runtimeVersion??process.versions.node;r.push(EA(n)?{id:"runtime",status:"pass",message:`Node.js ${n} satisfies >=20.19`}:{id:"runtime",status:"fail",message:`Node.js ${n} is older than 20.19`,remediation:"Install Node.js 20.19 or newer on the machine running SEO Crawl Audit."});let a=(e.configPath?Ur(t,e.configPath):null)??await Nr(t),c={};if(!a)r.push({id:"config",status:"warning",message:"seo-audit.config.json was not found",remediation:"Run seo-audit init <url> to create a safe project configuration."});else try{c=await Pt(a),r.push({id:"config",status:"pass",message:`Configuration is valid: ${a}`,evidence:{path:a}})}catch(h){r.push({id:"config",status:"fail",message:h instanceof Error?h.message:String(h),remediation:"Fix the reported property or regenerate the file with seo-audit init --force."})}let l=e.url??c.url??"",o=TA(l);o?r.push({id:"target",status:"pass",message:`Target URL is ${o}`,evidence:{url:o}}):r.push({id:"target",status:"fail",message:l?"Target is not a full HTTP(S) URL":"No target URL was provided",remediation:"Pass seo-audit doctor https://example.com/ or set url in seo-audit.config.json."}),r.push(await CA(t,e));let d=e.offline??!1;if(d||!o){let h=d?"Skipped by --offline":"Skipped because the target URL is invalid";for(let f of["homepage","robots","sitemap"])r.push({id:f,status:"skipped",message:h})}else{let h=Te({url:o},c),f=Hn(e.requestHeaders??{},o,e.fetch??globalThis.fetch);r.push(await yA(o,h,f,e.signal));try{let m=await ue(h,{fetch:f,signal:e.signal});m.robots.denyAll&&h.respectRobots?r.push({id:"robots",status:"fail",message:`robots.txt returned HTTP ${m.robots.status??"unknown"} and blocks crawling`,remediation:"Allow the audit user agent or explicitly choose --ignore-robots when authorized.",evidence:{url:m.robots.url,status:m.robots.status,denyAll:!0}}):m.robots.error||m.robots.status===null||(m.robots.status??500)>=400?r.push({id:"robots",status:"warning",message:m.robots.error??`robots.txt returned HTTP ${m.robots.status??"unknown"}`,remediation:"Publish a readable robots.txt when crawler policy needs to be explicit.",evidence:{url:m.robots.url,status:m.robots.status}}):r.push({id:"robots",status:"pass",message:`robots.txt returned HTTP ${m.robots.status}`,evidence:{url:m.robots.url,status:m.robots.status,denyAll:m.robots.denyAll??!1}}),h.sitemap==="none"?r.push({id:"sitemap",status:"skipped",message:"Sitemap discovery is disabled by configuration"}):m.sitemap?m.sitemap.error?r.push({id:"sitemap",status:h.sitemap==="auto"?"warning":"fail",message:m.sitemap.error,remediation:"Check the sitemap URL, XML syntax, response size, and HTTP status.",evidence:{url:m.sitemap.url}}):m.sitemap.urls.length===0?r.push({id:"sitemap",status:"warning",message:`Sitemap contains no crawlable same-origin URLs: ${m.sitemap.url}`,remediation:"Add canonical site URLs to the sitemap or verify the configured site origin."}):r.push({id:"sitemap",status:"pass",message:`Loaded ${m.sitemap.urls.length} URL(s) from ${m.sitemap.sitemapCount} sitemap file(s)`,evidence:{url:m.sitemap.url,urls:m.sitemap.urls.length,sitemapCount:m.sitemap.sitemapCount,truncated:m.sitemap.truncated}}):r.push({id:"sitemap",status:"warning",message:"No sitemap was discovered",remediation:"Publish a sitemap or set sitemap to none when link-only crawling is intentional."})}catch(m){e.signal?.throwIfAborted(),r.push({id:"robots",status:"fail",message:`Planning failed: ${m instanceof Error?m.message:String(m)}`,remediation:"Check network access, robots.txt redirects, sitemap responses, and timeout settings."}),r.push({id:"sitemap",status:"skipped",message:"Skipped because scan planning failed"})}}let p=wA(r);return{healthy:p.fail===0,offline:d,url:o,checks:r,summary:p}}function SA(e){console.log("SEO Crawl Audit doctor");let t={pass:"PASS",warning:"WARN",fail:"FAIL",skipped:"SKIP"};for(let r of e.checks)console.log(`[${t[r.status]}] ${r.id}: ${r.message}`),r.remediation&&console.log(` Fix: ${r.remediation}`);console.log(e.healthy?`Ready with ${e.summary.warning} warning(s) and ${e.summary.skipped} skipped check(s).`:`Not ready: ${e.summary.fail} check(s) failed.`)}async function Oa(e,t,r){let n=await xA({...t.directory!==void 0?{directory:t.directory}:{},...e!==void 0?{url:e}:{},...t.config!==void 0?{configPath:t.config}:{},...t.output!==void 0?{outputPath:t.output}:{},...t.report!==void 0?{reportPath:t.report}:{},...t["history-dir"]!==void 0?{historyPath:t["history-dir"]}:{},reportEnabled:t["no-report"]!==!0,historyEnabled:t["no-history"]!==!0,offline:t.offline===!0,requestHeaders:Br(t["headers-env"]),...r!==void 0?{signal:r}:{}});return t.json?console.log(JSON.stringify({command:"doctor",...n},null,2)):SA(n),n.healthy?0:1}import{lstat as NA,mkdir as Da,readFile as $n,realpath as va,writeFile as ka}from"node:fs/promises";import{dirname as Xn,join as ge,relative as _A,resolve as Ba}from"node:path";import{fileURLToPath as RA}from"node:url";var LA=Ba(RA(new URL("../agent-skill/seo-crawl-audit",import.meta.url)));async function OA(e,t){let r=await va(e),n=t;for(;;)try{let s=await va(n),a=_A(r,s);if(a===".."||a.startsWith(`..${process.platform==="win32"?"\\":"/"}`))throw new Error(`generated agent path escapes the project through a symlink: ${t}`);return}catch(s){if(s.code!=="ENOENT")throw s;try{if((await NA(n)).isSymbolicLink())throw new Error(`generated agent path escapes the project through an unresolved symlink: ${t}`)}catch(c){if(c.code!=="ENOENT")throw c}let a=Xn(n);if(a===n)throw s;n=a}}function vA(e){let t=(e??"all").toLowerCase();if(t==="all")return["codex","claude","opencode"];if(["codex","claude","opencode"].includes(t))return[t];throw new Error("--platform must be codex, claude, opencode, or all")}async function DA(e,t,r){let n=null;try{n=await $n(t,"utf8")}catch(a){if(a.code!=="ENOENT")throw a}let s=await $n(e,"utf8");return n===s?{path:t,status:"unchanged"}:n!==null&&!r?{path:t,status:"skipped"}:(await Da(Xn(t),{recursive:!0}),await ka(t,s,"utf8"),{path:t,status:n===null?"created":"updated"})}async function kA(e,t,r){let n=null;try{n=await $n(e,"utf8")}catch(s){if(s.code!=="ENOENT")throw s}return n===t?{path:e,status:"unchanged"}:n!==null&&!r?{path:e,status:"skipped"}:(await Da(Xn(e),{recursive:!0}),await ka(e,t,"utf8"),{path:e,status:n===null?"created":"updated"})}function BA(){return`[mcp_servers.seo-crawl-audit]
265
267
  command = "npx"
266
268
  args = ["-y", "seo-crawl-audit@0.9", "mcp"]
267
269
  tool_timeout_sec = 600
268
- `}function kA(){return`${JSON.stringify({mcpServers:{"seo-crawl-audit":{command:"npx",args:["-y","seo-crawl-audit@0.9","mcp"]}}},null,2)}
269
- `}function BA(){return`${JSON.stringify({$schema:"https://opencode.ai/config.json",mcp:{"seo-crawl-audit":{type:"local",command:["npx","-y","seo-crawl-audit@0.9","mcp"],enabled:!0,timeout:6e5}}},null,2)}
270
- `}async function PA(e={}){let t=ka(e.directory??process.cwd()),r=LA(e.platform),n=[],s=[],a=new Set,c=new Set;for(let l of r)c.add(l==="claude"?ge(t,".claude/skills/seo-crawl-audit/SKILL.md"):ge(t,".agents/skills/seo-crawl-audit/SKILL.md")),c.add(l==="codex"?ge(t,".codex/config.toml"):l==="claude"?ge(t,".mcp.json"):ge(t,"opencode.json"));await Promise.all([...c].map(l=>RA(t,l)));for(let l of r){let o=l==="claude"?ge(t,".claude/skills/seo-crawl-audit/SKILL.md"):ge(t,".agents/skills/seo-crawl-audit/SKILL.md");a.has(o)||(n.push(await OA(ge(_A,"SKILL.md"),o,e.force??!1)),a.add(o));let d=l==="codex"?ge(t,".codex/config.toml"):l==="claude"?ge(t,".mcp.json"):ge(t,"opencode.json"),p=l==="codex"?DA():l==="claude"?kA():BA(),h=await vA(d,p,e.force??!1);n.push(h),h.status==="skipped"&&s.push(`${l} config snippet:
271
- ${p}`)}return{directory:t,platform:e.platform==="all"||!e.platform?"all":r[0],files:n,snippets:s}}async function Ba(e){let t=await PA({directory:e.directory,platform:e.platform,force:e.force});if(e.json)return console.log(JSON.stringify({command:"agent-init",...t},null,2)),0;console.log(`Prepared SEO Crawl Audit agent integration in ${t.directory}`);for(let r of t.files)console.log(` ${r.status.padEnd(7)} ${r.path}`);for(let r of t.snippets)console.log(`
270
+ `}function PA(){return`${JSON.stringify({mcpServers:{"seo-crawl-audit":{command:"npx",args:["-y","seo-crawl-audit@0.9","mcp"]}}},null,2)}
271
+ `}function MA(){return`${JSON.stringify({$schema:"https://opencode.ai/config.json",mcp:{"seo-crawl-audit":{type:"local",command:["npx","-y","seo-crawl-audit@0.9","mcp"],enabled:!0,timeout:6e5}}},null,2)}
272
+ `}async function UA(e={}){let t=Ba(e.directory??process.cwd()),r=vA(e.platform),n=[],s=[],a=new Set,c=new Set;for(let l of r)c.add(l==="claude"?ge(t,".claude/skills/seo-crawl-audit/SKILL.md"):ge(t,".agents/skills/seo-crawl-audit/SKILL.md")),c.add(l==="codex"?ge(t,".codex/config.toml"):l==="claude"?ge(t,".mcp.json"):ge(t,"opencode.json"));await Promise.all([...c].map(l=>OA(t,l)));for(let l of r){let o=l==="claude"?ge(t,".claude/skills/seo-crawl-audit/SKILL.md"):ge(t,".agents/skills/seo-crawl-audit/SKILL.md");a.has(o)||(n.push(await DA(ge(LA,"SKILL.md"),o,e.force??!1)),a.add(o));let d=l==="codex"?ge(t,".codex/config.toml"):l==="claude"?ge(t,".mcp.json"):ge(t,"opencode.json"),p=l==="codex"?BA():l==="claude"?PA():MA(),h=await kA(d,p,e.force??!1);n.push(h),h.status==="skipped"&&s.push(`${l} config snippet:
273
+ ${p}`)}return{directory:t,platform:e.platform==="all"||!e.platform?"all":r[0],files:n,snippets:s}}async function Pa(e){let t=await UA({directory:e.directory,platform:e.platform,force:e.force});if(e.json)return console.log(JSON.stringify({command:"agent-init",...t},null,2)),0;console.log(`Prepared SEO Crawl Audit agent integration in ${t.directory}`);for(let r of t.files)console.log(` ${r.status.padEnd(7)} ${r.path}`);for(let r of t.snippets)console.log(`
272
274
  ${r}`);return console.log("Restart the agent client after enabling its project MCP configuration."),0}var Ne=`seo-audit ${X}
273
275
 
274
276
  Local-first SEO crawler, audit, and regression checker.
@@ -348,8 +350,8 @@ Exit codes:
348
350
  1 SEO regressions detected
349
351
  2 Invalid input or crawler failure
350
352
  130 Scan interrupted after saving partial results
351
- `;async function NE(e=process.argv.slice(2),t={}){let r;try{r=ea(e)}catch(o){return console.error(`${o instanceof Error?o.message:String(o)}
353
+ `;async function RE(e=process.argv.slice(2),t={}){let r;try{r=ta(e)}catch(o){return console.error(`${o instanceof Error?o.message:String(o)}
352
354
 
353
- ${Ne}`),2}let{values:n}=r,{positionals:s}=r;if(s[0]==="init"){if(n.help)return console.log(Ne),0;if(n.version)return console.log(X),0;if(s.length>2)return console.error(`Unexpected argument: ${s[2]}`),2;try{return await _a(s[1],n)}catch(o){return console.error(`seo-audit: ${o instanceof Error?o.message:String(o)}`),2}}if(s[0]==="doctor"){if(s.length>2)return console.error(`Unexpected argument: ${s[2]}`),2;if(n.help)return console.log(Ne),0;if(n.version)return console.log(X),0;try{return await La(s[1],n,t.signal)}catch(o){return console.error(`seo-audit: ${o instanceof Error?o.message:String(o)}`),t.signal?.aborted?130:2}}if(s[0]==="agent-init"){if(s.length>1)return console.error(`Unexpected argument: ${s[1]}`),2;if(n.help)return console.log(Ne),0;if(n.version)return console.log(X),0;try{return await Ba(n)}catch(o){return console.error(`seo-audit: ${o instanceof Error?o.message:String(o)}`),2}}if(s[0]==="status"){if(s.length>2)return console.error(`Unexpected argument: ${s[2]}`),2;if(n.help)return console.log(Ne),0;if(n.version)return console.log(X),0;try{return await Aa(s[1],n)}catch(o){return console.error(`seo-audit: ${o instanceof Error?o.message:String(o)}`),2}}if(s[0]==="serve"){if(s.length>2)return console.error(`Unexpected argument: ${s[2]}`),2;if(n.help)return console.log(Ne),0;let o=n.port===void 0?4179:Number.parseInt(n.port,10);if(!Number.isInteger(o)||o<0||o>65535)return console.error("seo-audit: --port must be an integer between 0 and 65535"),2;let d=s[1];if(d)try{let p=new URL(d);if(p.protocol!=="http:"&&p.protocol!=="https:")throw new Error("unsupported protocol")}catch{return console.error("seo-audit: serve URL must be a complete http:// or https:// URL"),2}try{let{serveCommand:p}=await import("./server.js");return await p(o,t.signal,{openBrowser:!n["no-open"],...d?{initialUrl:d}:{}})}catch(p){return console.error(`seo-audit: ${p instanceof Error?p.message:String(p)}`),2}}try{n=ta(n,await Pt(n.config))}catch(o){return console.error(`seo-audit: ${o instanceof Error?o.message:String(o)}`),2}if(n.version)return console.log(X),0;if(n.help||s.length===0)return console.log(Ne),0;let[a,c,...l]=s;if(a&&/^https?:\/\//i.test(a)&&(l=s.slice(1),c=a,a="scan"),(a==="scan"||a==="check")&&!c&&n.__config?.url&&(c=n.__config.url),l.length>0)return console.error(`Unexpected argument: ${l[0]}`),2;try{return a==="scan"?await ma(c,n,t.signal):a==="check"?await fa(c,n,t.signal):a==="compare"?await Ea(n,t.signal):a==="history"?await ba(c,n):a==="report"?await Ta(c,n):(console.error(`Unknown command: ${String(a)}
355
+ ${Ne}`),2}let{values:n}=r,{positionals:s}=r;if(s[0]==="init"){if(n.help)return console.log(Ne),0;if(n.version)return console.log(X),0;if(s.length>2)return console.error(`Unexpected argument: ${s[2]}`),2;try{return await Ra(s[1],n)}catch(o){return console.error(`seo-audit: ${o instanceof Error?o.message:String(o)}`),2}}if(s[0]==="doctor"){if(s.length>2)return console.error(`Unexpected argument: ${s[2]}`),2;if(n.help)return console.log(Ne),0;if(n.version)return console.log(X),0;try{return await Oa(s[1],n,t.signal)}catch(o){return console.error(`seo-audit: ${o instanceof Error?o.message:String(o)}`),t.signal?.aborted?130:2}}if(s[0]==="agent-init"){if(s.length>1)return console.error(`Unexpected argument: ${s[1]}`),2;if(n.help)return console.log(Ne),0;if(n.version)return console.log(X),0;try{return await Pa(n)}catch(o){return console.error(`seo-audit: ${o instanceof Error?o.message:String(o)}`),2}}if(s[0]==="status"){if(s.length>2)return console.error(`Unexpected argument: ${s[2]}`),2;if(n.help)return console.log(Ne),0;if(n.version)return console.log(X),0;try{return await pa(s[1],n)}catch(o){return console.error(`seo-audit: ${o instanceof Error?o.message:String(o)}`),2}}if(s[0]==="serve"){if(s.length>2)return console.error(`Unexpected argument: ${s[2]}`),2;if(n.help)return console.log(Ne),0;let o=n.port===void 0?4179:Number.parseInt(n.port,10);if(!Number.isInteger(o)||o<0||o>65535)return console.error("seo-audit: --port must be an integer between 0 and 65535"),2;let d=s[1];if(d)try{let p=new URL(d);if(p.protocol!=="http:"&&p.protocol!=="https:")throw new Error("unsupported protocol")}catch{return console.error("seo-audit: serve URL must be a complete http:// or https:// URL"),2}try{let{serveCommand:p}=await import("./server.js");return await p(o,t.signal,{openBrowser:!n["no-open"],...d?{initialUrl:d}:{}})}catch(p){return console.error(`seo-audit: ${p instanceof Error?p.message:String(p)}`),2}}try{n=ra(n,await Pt(n.config))}catch(o){return console.error(`seo-audit: ${o instanceof Error?o.message:String(o)}`),2}if(n.version)return console.log(X),0;if(n.help||s.length===0)return console.log(Ne),0;let[a,c,...l]=s;if(a&&/^https?:\/\//i.test(a)&&(l=s.slice(1),c=a,a="scan"),(a==="scan"||a==="check")&&!c&&n.__config?.url&&(c=n.__config.url),l.length>0)return console.error(`Unexpected argument: ${l[0]}`),2;try{return a==="scan"?await fa(c,n,t.signal):a==="check"?await Ea(c,n,t.signal):a==="compare"?await Ta(n,t.signal):a==="history"?await Ca(c,n):a==="report"?await ba(c,n):(console.error(`Unknown command: ${String(a)}
354
356
 
355
- ${Ne}`),2)}catch(o){return console.error(`seo-audit: ${o instanceof Error?o.message:String(o)}`),t.signal?.aborted?130:2}}export{NE as main,sa as parseScanMenuSelection};
357
+ ${Ne}`),2)}catch(o){return console.error(`seo-audit: ${o instanceof Error?o.message:String(o)}`),t.signal?.aborted?130:2}}export{RE as main,ia as parseScanMenuSelection};