PageSourceSearch

https://www.gokwik.co/_next/static/chunks/d5fd7a10.2a9e81d6afff00a9.js

js gokwik.co collected 2026-10-02 05:06:36 UTC 175,253 bytes, 30 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4583],{7621:(e,t,r)=>{r.d(t,{B:()=>iO,K:()=>j,L:()=>iH,O:()=>iz,P:()=>i_,Q:()=>iX,U:()=>p,X:()=>iY,Y:()=>iJ,Z:()=>ep,_:()=>is,b:()=>i$,f:()=>iS,v:()=>iN});var n,i,a=r(96457),s=r(97971),o=r(80667),l=r(15144);r(73502),r(1889),r(78879),r(38263);var u={$schema:"http://json-schema.org/draft-06/schema#",$id:"http://json-schema.org/draft-06/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},title:{type:"string"},description:{type:"string"},default:{},examples:{type:"array",items:{}},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:{}},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:{},enum:{type:"array",minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:{}},c=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}(function(){if(i)return n;i=1;var e=function(e){var r,n,i;return!!(r=e)&&"object"==typeof r&&(n=e,"[object RegExp]"!==(i=Object.prototype.toString.call(n))&&"[object Date]"!==i&&n.$$typeof!==t)},t="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function r(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l(Array.isArray(e)?[]:{},e,t):e}function a(e,t,n){return e.concat(t).map(function(e){return r(e,n)})}function s(e){return Object.keys(e).concat(Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[])}function o(e,t){try{return t in e}catch(e){return!1}}function l(t,n,i){(i=i||{}).arrayMerge=i.arrayMerge||a,i.isMergeableObject=i.isMergeableObject||e,i.cloneUnlessOtherwiseSpecified=r;var u,c,d=Array.isArray(n);return d!==Array.isArray(t)?r(n,i):d?i.arrayMerge(t,n,i):(c={},(u=i).isMergeableObject(t)&&s(t).forEach(function(e){c[e]=r(t[e],u)}),s(n).forEach(function(e){o(t,e)&&!(Object.hasOwnProperty.call(t,e)&&Object.propertyIsEnumerable.call(t,e))||(o(t,e)&&u.isMergeableObject(n[e])?c[e]=(function(e,t){if(!t.customMerge)return l;var r=t.customMerge(e);return"function"==typeof r?r:l})(e,u)(t[e],n[e],u):c[e]=r(n[e],u))}),c)}return l.all=function(e,t){if(!Array.isArray(e))throw Error("first argument should be an array");return e.reduce(function(e,r){return l(e,r,t)},{})},n=l}());class d extends Error{constructor(e){super(function(e){return"string"==typeof e?String(e):JSON.stringify(e)}(e))}}function h(e){return e instanceof Error?e:new d(e)}
1class m extends Error{constructor(e,t){super(e),Error.captureStackTrace(this,m),this.name=m.name,t?.stack&&(this.stack??="",this.stack+=`
2Caused by: ${t.stack}`)}}class p extends m{constructor(e,t){super(e,t),Error.captureStackTrace(this,p),this.name=p.name,Object.defineProperty(this,"isUserError",{value:!0,enumerable:!1,writable:!1})}prettyFormat(){}}class f extends p{tagName;inherit;filename;constructor({tagName:e,inherit:t}){super(`Element <${e}> cannot inherit from <${t}>: no such element`),Error.captureStackTrace(this,f),this.name=f.name,this.tagName=e,this.inherit=t,this.filename=null}prettyFormat(){let{message:e,tagName:t,inherit:r}=this;return[e,...this.filename?["","This error occurred when loading element metadata from:",`"${this.filename}"`,""]:[""],"This usually occurs when the elements are defined in the wrong order, try one of the following:","",`  - Ensure the spelling of "${r}" is correct.`,`  - Ensure the file containing "${r}" is loaded before the file containing "${t}".`,`  - Move the definition of "${r}" above the definition for "${t}".`].join("\n")}}class g extends p{filename;obj;schema;errors;constructor(e,t,r,n,i){super(`${t}: ${function(e,t,r){let n=(0,o.A)(e,t,r,{format:"js"});return n.length>0?n[0].error:"unknown validation error"}(n,r,i)}`),this.filename=e,this.obj=r,this.schema=n,this.errors=i}}let y=function(e){let t=-0x21524111,r=0x41c6ce57;for(let n=0,i;n<e.length;n++)t=Math.imul(t^(i=e.charCodeAt(n)),0x9e3779b1),r=Math.imul(r^i,0x5f356495);return t=Math.imul(t^t>>>16,0x85ebca6b)^Math.imul(r^r>>>13,0xc2b2ae35),0x100000000*(2097151&(r=Math.imul(r^r>>>16,0x85ebca6b)^Math.imul(t^t>>>13,0xc2b2ae35)))+(t>>>0)};var b={$schema:"http://json-schema.org/draft-06/schema#",$id:"https://html-validate.org/schemas/elements.json",type:"object",properties:{$schema:{type:"string"}},patternProperties:{"^[^$].*$":{type:"object",properties:{inherit:{title:"Inherit from another element",description:"Most properties from the parent element will be copied onto this one",type:"string"},embedded:{title:"Mark this element as belonging in the embedded content category",$ref:"#/definitions/contentCategory"},flow:{title:"Mark this element as belonging in the flow content category",$ref:"#/definitions/contentCategory"},heading:{title:"Mark this element as belonging in the heading content category",$ref:"#/definitions/contentCategory"},interactive:{title:"Mark this element as belonging in the interactive content category",$ref:"#/definitions/contentCategory"},metadata:{title:"Mark this element as belonging in the metadata content category",$ref:"#/definitions/contentCategory"},phrasing:{title:"Mark this element as belonging in the phrasing content category",$ref:"#/definitions/contentCategory"},sectioning:{title:"Mark this element as belonging in the sectioning content category",$ref:"#/definitions/contentCategory"},deprecated:{title:"Mark element as deprecated",description:"Deprecated elements should not be used. If a message is provided it will be included in the error",anyOf:[{type:"boolean"},{type:"string"},{$ref:"#/definitions/deprecatedElement"}]},foreign:{title:"Mark element as foreign",description:"Foreign elements are elements which have a start and end tag but is otherwize not parsed",type:"boolean"},void:{title:"Mark element as void",description:"Void elements are elements which cannot have content and thus must not use an end tag",type:"boolean"},transparent:{title:"Mark element as transparent",description:"Transparent elements follows the same content model as its parent, i.e. the content must be allowed in the parent.",anyOf:[{type:"boolean"},{type:"array",items:{type:"string"}}]},implicitClosed:{title:"List of elements which implicitly closes this element",description:"Some elements are automatically closed when another start tag occurs",type:"array",items:{type:"string"}},implicitRole:{title:"Implicit ARIA role for this element",description:"Some elements have implicit ARIA roles.",deprecated:!0,function:!0},aria:{title:"WAI-ARIA properties for this element",$ref:"#/definitions/Aria"},scriptSupporting:{title:"Mark element as script-supporting",description:"Script-supporting elements are elements which can be inserted where othersise not permitted to assist in templating",type:"boolean"},focusable:{title:"Mark this element as focusable",description:"This element may contain an associated label element.",anyOf:[{type:"boolean"},{function:!0}]}
2,form:{title:"Mark element as a submittable form element",type:"boolean"},formAssociated:{title:"Mark element as a form-associated element",$ref:"#/definitions/FormAssociated"},labelable:{title:"Mark this element as labelable",description:"This element may contain an associated label element.",anyOf:[{type:"boolean"},{function:!0}]},templateRoot:{title:"Mark element as an element ignoring DOM ancestry, i.e. <template>.",description:"The <template> element can contain any elements.",type:"boolean"},deprecatedAttributes:{title:"List of deprecated attributes",type:"array",items:{type:"string"}},requiredAttributes:{title:"List of required attributes",type:"array",items:{type:"string"}},attributes:{title:"List of known attributes and allowed values",$ref:"#/definitions/PermittedAttribute"},permittedContent:{title:"List of elements or categories allowed as content in this element",$ref:"#/definitions/Permitted"},permittedDescendants:{title:"List of elements or categories allowed as descendants in this element",$ref:"#/definitions/Permitted"},permittedOrder:{title:"Required order of child elements",$ref:"#/definitions/PermittedOrder"},permittedParent:{title:"List of elements or categories allowed as parent to this element",$ref:"#/definitions/Permitted"},requiredAncestors:{title:"List of required ancestor elements",$ref:"#/definitions/RequiredAncestors"},requiredContent:{title:"List of required content elements",$ref:"#/definitions/RequiredContent"},textContent:{title:"Allow, disallow or require textual content",description:"This property controls whenever an element allows, disallows or requires text. Text from any descendant counts, not only direct children",default:"default",type:"string",enum:["none","default","required","accessible"]}},additionalProperties:!1}},definitions:{Aria:{type:"object",additionalProperties:!1,properties:{implicitRole:{title:"Implicit ARIA role for this element",description:"Some elements have implicit ARIA roles.",anyOf:[{type:"string"},{function:!0}]},naming:{title:"Prohibit or allow this element to be named by aria-label or aria-labelledby",anyOf:[{type:"string",enum:["prohibited","allowed"]},{function:!0}]}}},contentCategory:{anyOf:[{type:"boolean"},{function:!0}]},deprecatedElement:{type:"object",additionalProperties:!1,properties:{message:{type:"string",title:"A short text message shown next to the regular error message."},documentation:{type:"string",title:"An extended markdown formatted message shown with the contextual rule documentation."},source:{type:"string",title:"Element source, e.g. what standard or library deprecated this element.",default:"html5"}}},FormAssociated:{type:"object",additionalProperties:!1,properties:{disablable:{type:"boolean",title:"Disablable elements can be disabled using the disabled attribute."},listed:{type:"boolean",title:"Listed elements have a name attribute and is listed in the form and fieldset elements property."}}},Permitted:{type:"array",items:{anyOf:[{type:"string"},{type:"array",items:{anyOf:[{type:"string"},{$ref:"#/definitions/PermittedGroup"}]}},{$ref:"#/definitions/PermittedGroup"}]}},PermittedAttribute:{type:"object",patternProperties:{"^.*$":{anyOf:[{type:"object",additionalProperties:!1,properties:{allowed:{function:!0,title:"Set to a function to evaluate if this attribute is allowed in this context"},boolean:{type:"boolean",title:"Set to true if this is a boolean attribute"},deprecated:{title:"Set to true or string if this attribute is deprecated",oneOf:[{type:"boolean"},{type:"string"}]},list:{type:"boolean",title:"Set to true if this attribute is a list of space-separated tokens, each which must be valid by itself"},enum:{type:"array",title:"Exhaustive list of values (string or regex) this attribute accepts",uniqueItems:!0,items:{anyOf:[{type:"string"},{regexp:!0}]}},omit:{type:"boolean",title:"Set to true if this attribute can optionally omit its value"},required:{type:"boolean",title:"Set to true if this attribute is required"}}},{type:"array",uniqueItems:!0,items:{type:"string"}},{type:"null"}]}}},PermittedGroup:{type:"object",additionalProperties:!1,properties:{exclude:{anyOf:[{items:{type:"string"},type:"array"},{type:"string"}]}}},PermittedOrder:{type:"array",items:{type:"string"}}
2,RequiredAncestors:{type:"array",items:{type:"string"}},RequiredContent:{type:"array",items:{type:"string"}}}};let v=function(e,t){let r=e instanceof RegExp;return r||(v.errors=[{instancePath:t?.instancePath,schemaPath:void 0,keyword:"type",message:"should be a regular expression",params:{keyword:"type"}}]),r},w={keyword:"regexp",schema:!1,errors:!0,validate:v},x=function(e,t){let r="function"==typeof e;return r||(x.errors=[{instancePath:t?.instancePath,schemaPath:void 0,keyword:"type",message:"should be a function",params:{keyword:"type"}}]),r},A={keyword:"function",schema:!1,errors:!0,validate:x};var E=(e=>(e.NONE="none",e.DEFAULT="default",e.REQUIRED="required",e.ACCESSIBLE="accessible",e))(E||{});let T=["metadata","flow","sectioning","heading","phrasing","embedded","interactive","transparent","focusable","form","formAssociated","labelable","attributes","aria","permittedContent","permittedDescendants","permittedOrder","permittedParent","requiredAncestors","requiredContent"];function $(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>void 0!==e))}let k=["metadata","flow","sectioning","heading","phrasing","embedded","interactive","labelable"],S=new Map;function C(e,t){return t}class N{elements;schema;constructor(){this.elements={},this.schema=JSON.parse(JSON.stringify(b))}init(){this.resolveGlobal()}extendValidationSchema(e){e.properties&&(this.schema=c(this.schema,{patternProperties:{"^[^$].*$":{properties:e.properties}}})),e.definitions&&(this.schema=c(this.schema,{definitions:e.definitions}))}loadFromObject(e,t=null){try{let r=this.getSchemaValidator();if(!r(e))throw new g(t,"Element metadata is not valid",e,this.schema,r.errors??[]);for(let[t,r]of Object.entries(e))"$schema"!==t&&this.addEntry(t,function(e){var t,r;let n=(t=e.implicitRole??e.aria?.implicitRole)?"string"==typeof t?()=>t:t:()=>null,i={...e,...{formAssociated:void 0},attributes:Object.fromEntries([...Object.keys(e.attributes??{}),...e.requiredAttributes??[],...e.deprecatedAttributes??[]].sort().map(t=>[t,function(e,t){let r={};r.deprecated=!!e.deprecatedAttributes?.includes(t)||void 0,r.required=!!e.requiredAttributes?.includes(t)||void 0,r.omit=void 0;let n=e.attributes?e.attributes[t]:void 0;return void 0===n?$(r):null===n?(r.delete=!0,$(r)):Array.isArray(n)?(0===n.length?r.boolean=!0:(r.enum=n.filter(e=>""!==e),n.includes("")&&(r.omit=!0)),$(r)):$({...r,...n})}
2(e,t)])),textContent:e.textContent,focusable:e.focusable??!1,implicitRole:n,templateRoot:!0===e.templateRoot,aria:{implicitRole:n,naming:(r=e.aria?.naming)?"string"==typeof r?()=>r:r:()=>"allowed"}};return delete i.deprecatedAttributes,delete i.requiredAttributes,i.textContent||delete i.textContent,e.formAssociated?i.formAssociated={disablable:!!e.formAssociated.disablable,listed:!!e.formAssociated.listed}:delete i.formAssociated,i}(r))}catch(e){if(e instanceof f)throw e.filename=t,e;if(e instanceof g||!t)throw e;throw new p(`Failed to load element metadata from "${t}"`,h(e))}}getMetaFor(e){let t=this.elements[e.toLowerCase()]??this.elements["*"];return t?{...t}:null}getTagsWithProperty(e){return this.entries.filter(([,t])=>t[e]).map(([e])=>e)}getTagsDerivedFrom(e){return this.entries.filter(([t,r])=>t===e||r.inherit===e).map(([e])=>e)}addEntry(e,t){let r=this.elements[e];if(t.inherit){let n=t.inherit;if(!(r=this.elements[n]))throw new f({tagName:e,inherit:n})}let n=this.mergeElement(r??{},{...t,tagName:e});(function(e){for(let[t,r]of Object.entries(e.attributes))r.enum&&(e.attributes[t].enum=r.enum.map(I))})(n),this.elements[e]=n}getSchemaValidator(){let e=y(JSON.stringify(this.schema)),t=S.get(e);if(t)return t;{let t=new a({strict:!0,strictTuples:!0,strictTypes:!0});t.addMetaSchema(u),t.addKeyword(A),t.addKeyword(w),t.addKeyword({keyword:"copyable"});let r=t.compile(this.schema);return S.set(e,r),r}}getJSONSchema(){return this.schema}get entries(){return Object.entries(this.elements)}resolveGlobal(){if(!this.elements["*"])return;let e=this.elements["*"];for(let[t,r]of(delete this.elements["*"],delete e.tagName,delete e.void,this.entries))this.elements[t]=this.mergeElement(e,r)}mergeElement(e,t){let r=c(e,t,{arrayMerge:C}),n=Object.entries(r.attributes).filter(([,e])=>{let t=!e.delete;return delete e.delete,t});return r.attributes=Object.fromEntries(n),r}resolve(e){e.meta&&function(e,t){var r,n;for(let n of k){let i=t[n];"function"==typeof i&&(r=i(e._adapter),t[n]=r)}"function"==typeof t.focusable&&(n=t.focusable(e._adapter),t.focusable=n)}(e,e.meta)}}function I(e){if(e instanceof RegExp)return e;let t=/^\/(.*(?=\/))\/(i?)$/.exec(e);if(!t)return e;{let[,e,r]=t;return e.startsWith("^")||e.endsWith("$")?new RegExp(e,r):RegExp(`^${e}$`,r)}}class O{expr;constructor(e){this.expr=e}toString(){return this.expr}}class L{key;value;keyLocation;valueLocation;originalAttribute;constructor(e,t,r,n,i){this.key=e,this.value=t,this.keyLocation=r,this.valueLocation=n,this.originalAttribute=i,void 0===this.value&&(this.value=null)}get isStatic(){return!this.isDynamic}get isDynamic(){return this.value instanceof O}valueMatches(e,t=!0){return null!==this.value&&(this.value instanceof O?t:Array.isArray(e)?e.includes(this.value):e instanceof RegExp?null!==this.value.match(e):this.value===e)}}function R(e){return!e||e instanceof O?{}:Object.fromEntries(e.trim().split(";").filter(Boolean).map(e=>{let[t,r]=e.split(":",2);return[t.trim(),r?r.trim():""]}))}function P(e,t,r,n){var i,a;if(!e)return null;let s=(i=e.size,a=r,"number"!=typeof i?i:"number"!=typeof a?i-t:(a<0&&(a=i+a),Math.min(i,a-t))),o={filename:e.filename,offset:e.offset+t,line:e.line,column:e.column+t,size:s};if(n){let e=-1,r=o.column;for(;;)if((e=n.indexOf("\n",e+1))>=0&&e<t)o.column=r-(e+1),o.line++;else break}return o}var q=(e=>(e[e.INITIAL=1]="INITIAL",e[e.DOCTYPE=2]="DOCTYPE",e[e.TEXT=3]="TEXT",e[e.TAG=4]="TAG",e[e.ATTR=5]="ATTR",e[e.CDATA=6]="CDATA",e[e.SCRIPT=7]="SCRIPT",e[e.STYLE=8]="STYLE",e))(q||{}),D=(e=>(e[e.TEXT=1]="TEXT",e[e.SCRIPT=2]="SCRIPT",e[e.STYLE=3]="STYLE",e))(D||{});class M{contentModel;state;string;filename;offset;line;column;constructor(e){this.state=q.INITIAL,this.string=e.data,this.filename=e.filename,this.offset=e.offset,this.line=e.line,this.column=e.column,this.contentModel=1}getTruncatedLine(e=13){return JSON.stringify(this.string.length>e?`${this.string.slice(0,10)}...`:this.string)}consume(e,t){let r;"number"!=typeof e&&(e=e[0].length);let n=this.string.slice(0,e);for(;(r=n.indexOf("\n"))>=0;)this.line++,this.column=1,n=n.substr(r+1);this.column+=n.length,this.offset+=e,this.string=this.string.substr(e),this.state=t}getLocation(e){return{filename:this.filename,offset:this.offset,line:this.line,column:this.column,size:e}}}function j(e){return{filename:"",offset:0,line:1,column:1,...e}}var _=(e=>(e[e.ELEMENT_NODE=1]="ELEMENT_NODE",e[e.TEXT_NODE=3]="TEXT_NODE",e[e.DOCUMENT_NODE=9]="DOCUMENT_NODE",e))(_||{});let F=Symbol("textContent"),z=0;class U{nodeName;nodeType;childNodes;location;unique;cache;disabledRules;blockedRules;constructor(e,t,r){this.nodeType=e,this.nodeName=t??"#document",this.location=r,this.disabledRules=new Set,this.blockedRules=new Map,this.childNodes=[],this.unique=z++,this.cache=null}cacheEnable(){this.cache=new Map}cacheGet(e){return this.cache?this.cache.get(e):void 0}cacheSet(e,t){return this.cache&&this.cache.set(e,t),t}cacheRemove(e){return!!this.cache&&this.cache.delete(e)}cacheExists(e){return!!this.cache?.has(e)}get textContent(){let e=this.cacheGet(F);if(e)return e;let t=this.childNodes.map(e=>e.textContent).join("");return this.cacheSet(F,t),t}append(e){let t=e._setParent(this);!(t&&this.isSameNode(t))&&(this.childNodes.push(e),t&&t._removeChild(e))}insertBefore(e,t){let r=t?this.childNodes.findIndex(e=>e.isSameNode(t)):-1;r>=0?this.childNodes.splice(r,0,e):this.childNodes.push(e);let n=e._setParent(this);n&&n._removeChild(e)}isRootElement(){return this.nodeType===_.DOCUMENT_NODE}isSameNode(e){return this.unique===e.unique}get firstChild(){return this.childNodes[0]||null}get lastChild(){return this.childNodes[this.childNodes.length-1]||null}removeChild(e){return this._removeChild(e),e._setParent(null),e}blockRule(e,t){let r=this.blockedRules.get(e);r?r.push(t):this.blockedRules.set(e,[t])}blockRules(e,t){for(let r of e)this.blockRule(r,t)}disableRule(e){this.disabledRules.add(e)}disableRules(e){for(let t of e)this.disableRule(t)}enableRule(e){this.disabledRules.delete(e)}enableRules(e){for(let t of e)this.enableRule(t)}ruleEnabled(e){return!this.disabledRules.has(e)}ruleBlockers(e){return this.blockedRules.get(e)??[]}generateSelector(){return null}_setParent(e){return null}_removeChild(e){let t=this.childNodes.findIndex(t=>t.isSameNode(e));if(t>=0)this.childNodes.splice(t,1);else throw Error("DOMException: _removeChild(..) could not find child to remove")}}class G extends Array{value;locations;constructor(e,t){if(e&&"string"==typeof e){let{tokens:r,locations:n}=function(e,t){let r=[],n=t?[]:null;for(let i=0;i<e.length;){let a=e.indexOf(" ",i);-1===a&&(a=e.length);let s=a-i;
2if(0===s){i++;continue}let o=e.substring(i,a);if(r.push(o),n&&t){let e=P(t,i,a);n.push(e)}i+=s+1}return{tokens:r,locations:n}}(e.replace(/[\t\r\n]/g," "),t);super(...r),this.locations=n}else super(0),this.locations=null;e instanceof O?this.value=e.expr:this.value=e??""}item(e){return this[e]}location(e){if(this.locations)return this.locations[e];throw Error("Trying to access DOMTokenList location when base location isn't set")}contains(e){return this.includes(e)}*iterator(){for(let e=0;e<this.length;e++){let t=this.item(e),r=this.location(e);yield{index:e,item:t,location:r}}}}var B=(e=>(e[e.DESCENDANT=1]="DESCENDANT",e[e.CHILD=2]="CHILD",e[e.ADJACENT_SIBLING=3]="ADJACENT_SIBLING",e[e.GENERAL_SIBLING=4]="GENERAL_SIBLING",e[e.SCOPE=5]="SCOPE",e))(B||{});let V={},W={"first-child":function(e){return null===e.previousSibling},"last-child":function(e){return null===e.nextSibling},"nth-child":function(e,t){if(!t)throw Error("Missing argument to nth-child");let r=parseInt(t.trim(),10);return function(e){if(!e.parent)return -1;if(!V[e.unique]){let t=e.parent.childElements.findIndex(t=>t.unique===e.unique);V[e.unique]=t+1}return V[e.unique]}(e)===r},scope:function(e){return!!(this.scope&&e.isSameNode(this.scope))}};function H(e){return e.replace(/\\(.)/g,"$1")}class X{}class Y extends X{classname;constructor(e){super(),this.classname=e}match(e){return e.classList.contains(this.classname)}}class J extends X{id;constructor(e){super(),this.id=H(e)}match(e){return e.id===this.id}}class K extends X{key;op;value;constructor(e){super();let[,t,r,n]=/^(.+?)(?:([~^$*|]?=)"([^"]+?)")?$/.exec(e);this.key=t,this.op=r,this.value="string"==typeof n?H(n):n}match(e){return e.getAttribute(this.key,!0).some(e=>{switch(this.op){case void 0:return!0;case"=":return e.value===this.value;default:throw Error(`Attribute selector operator ${this.op} is not implemented yet`)}})}}class Z extends X{name;args;constructor(e,t){super();let r=/^([^(]+)(?:\((.*)\))?$/.exec(e);if(!r)throw Error(`Missing pseudo-class after colon in selector pattern "${t}"`);let[,n,i]=r;this.name=n,this.args=i}match(e,t){return(function(e,t){let r=W[e];if(r)return r.bind(t);throw Error(`Pseudo-class "${e}" is not implemented`)})(this.name,t)(e,this.args)}}class Q{combinator;tagName;selector;conditions;constructor(e){let t=/^([~+\->]?)((?:[*]|[^.#[:]+)?)([^]*)$/.exec(e);if(!t)throw Error(`Failed to create selector pattern from "${e}"`);t.shift(),this.selector=e,this.combinator=function(e,t){if(":scope"===t)return 5;switch(e){case void 0:case null:case"":return 1;case">":return 2;case"+":return 3;case"~":return 4;default:throw Error(`Unknown combinator "${e}"`)}}(t.shift(),e),this.tagName=t.shift()||"*",this.conditions=Array.from(function*(e){if(""===e)return;let t=e.length,r=0,n=1,i=!1;for(;n<t;){let t=e[n],a=e.slice(r,n);if("\\"===t){n+=2;continue}if(i){t===i&&(i=!1),n+=1;continue}if(/['"]/.test(t)){i=t,n+=1;continue}if(":"===t&&":"===a){n+=1;continue}/[.#[:]/.test(t)&&(r=n,yield a),n+=1}let a=e.slice(r,n);yield a}(t[0]),e=>this.createCondition(e))}match(e,t){return e.is(this.tagName)&&this.conditions.every(r=>r.match(e,t))}createCondition(e){switch(e[0]){case".":return new Y(e.slice(1));case"#":return new J(e.slice(1));case"[":return new K(e.slice(1,-1));case":":return new Z(e.slice(1),this.selector);default:throw Error(`Failed to create selector condition for "${e}"`)}}}let ee=["9","a","d"];function et(e){let t=function(e){let t={"	":"\\9 ","\n":"\\a ","\r":"\\d "};return e.toString().replace(/([\t\n\r]|[^a-z0-9_-])/gi,(e,r)=>t[r]?t[r]:`\\${r}`)}(e);return/^\d/.exec(t)?`[id="${t}"]`:`#${t}`}class er{pattern;constructor(e){this.pattern=er.parse(e)}*match(e){yield*this.matchInternal(e,0,{scope:e})}matchElement(e){return function e(t,r,n){let i=r[r.length-1];if(!i.match(t,n))return!1;let a=r.slice(0,-1);if(0===a.length)return!0;for(let r of function(e,t){switch(t){case B.DESCENDANT:return function*(e){let t=e.parent;for(;t&&!t.isRootElement();)yield t,t=t.parent}(e);case B.CHILD:return function*(e){let t=e.parent;t&&!t.isRootElement()&&(yield t)}(e);case B.ADJACENT_SIBLING:return function*(e){let t=e.previousSibling;t&&(yield t)}(e);case B.GENERAL_SIBLING:return function*(e){let t=e.siblings,r=t.findIndex(t=>t.isSameNode(e));for(let e=0;e<r;e++)yield t[e]}(e);case B.SCOPE:return function*(e){yield e}(e)}}(t,i.combinator))if(e(r,a,n))return!0;return!1}(e,this.pattern,{scope:null})}*matchInternal(e,t,r){if(t>=this.pattern.length)return void(yield e);let n=this.pattern[t];
2for(let i of er.findCandidates(e,n))n.match(i,r)&&(yield*this.matchInternal(i,t+1,r))}static parse(e){return Array.from(function*(e){let t=0,r=0,n=0;for(let a=0;a<e.length;a++){var i;let s=e[a];switch(n){case 0:i=a,n="\\"===s?1:" "===s?(r=i,2):0;break;case 1:n=+!!ee.includes(s);break;case 2:n=yield*function*(n,i){return" "===n?2:(yield e.slice(t,r),t=i,r=i,0)}(s,a)}}t!==e.length&&(yield e.slice(t))}(e=e.replace(/([+~>]) /g,"$1")),e=>new Q(function(e){let t={"\\9 ":"	","\\a ":"\n","\\d ":"\r"};return e.replace(/(\\[\u0039\u0061\u0064] )/g,(e,r)=>t[r])}(e)))}static findCandidates(e,t){switch(t.combinator){case B.DESCENDANT:return e.getElementsByTagName(t.tagName);case B.CHILD:return e.childElements.filter(e=>e.is(t.tagName));case B.ADJACENT_SIBLING:return er.findAdjacentSibling(e);case B.GENERAL_SIBLING:return er.findGeneralSibling(e);case B.SCOPE:return[e]}}static findAdjacentSibling(e){let t=!1;return e.siblings.filter(r=>t?(t=!1,!0):(r===e&&(t=!0),!1))}static findGeneralSibling(e){let t=!1;return e.siblings.filter(r=>!!t||(r===e&&(t=!0),!1))}}function en(e){return!!(e&&e.nodeType===_.TEXT_NODE)}class ei extends U{text;constructor(e,t){super(_.TEXT_NODE,"#text",t),this.text=e}get textContent(){return this.text.toString()}get isStatic(){return!this.isDynamic}get isDynamic(){return this.text instanceof O}}let ea=Symbol("role"),es=Symbol("tabindex");var eo=(e=>(e[e.Open=0]="Open",e[e.EndTag=1]="EndTag",e[e.VoidOmitted=2]="VoidOmitted",e[e.VoidSelfClosed=3]="VoidSelfClosed",e[e.ImplicitClosed=4]="ImplicitClosed",e))(eo||{});function el(e){return!!(e&&e.nodeType===_.ELEMENT_NODE)}class eu extends U{tagName;voidElement;depth;closed;attr;metaElement;annotation;_parent;_adapter;constructor(e){let{nodeType:t,tagName:r,parent:n=null,closed:i=1,meta:a=null,location:s}=e;if(super(t,r,s),function(e){return""===e||"*"===e}(r))throw Error(`The tag name provided ("${r}") is not a valid name`);if(this.tagName=r??"#document",this._parent=null,this.attr={},this.metaElement=a??null,this.closed=i,this.voidElement=!!a&&!!a.void,this.depth=0,this.annotation=null,this._adapter=function(e){return{closest:t=>e.closest(t)?._adapter,getAttribute:t=>e.getAttribute(t)?.value,hasAttribute:t=>e.hasAttribute(t)}}(this),n){n.append(this);let e=n;for(;e.parent;)this.depth++,e=e.parent}}static createElement(e,t,r={}){let{closed:n=1,meta:i=null,parent:a=null}=r;return new eu({nodeType:_.ELEMENT_NODE,tagName:e,parent:a,closed:n,meta:i,location:t})}static rootNode(e){let t=new eu({nodeType:_.DOCUMENT_NODE,location:e});return t.setAnnotation("#document"),t}static fromTokens(e,t,r,n,i=""){var a,s;let o,l=e.data[2],u=i?`${i}:${l}`:l;if(!l)throw Error("tagName cannot be empty");let c=n?n.getMetaFor(u):null,d="/"!==e.data[1],h=(a=t,s=c,o=0,s?.void&&(o=2),"/>"===a.data[0]&&(o=3),o),m=P(e.location,1);return new eu({nodeType:_.ELEMENT_NODE,tagName:u,parent:d?r:null,closed:h,meta:c,location:m})}get annotatedName(){return this.annotation?this.annotation:`<${this.tagName}>`}get ariaLabelledby(){let e=this.getAttribute("aria-labelledby");if(!e?.value)return null;if(e.value instanceof O)return e.value;let t=new G(e.value,e.valueLocation);return t.length?Array.from(t):null}get childElements(){return this.childNodes.filter(el)}closest(e){let t=this;for(;t;){if(t.matches(e))return t;t=t.parent}return null}generateSelector(){let e;if(this.isRootElement())return null;let t=[];for(e=this;e.parent;e=e.parent);for(let r=this;r.parent;r=r.parent){if(r.id){let n=et(r.id);if(1===e.querySelectorAll(n).length){t.push(n);break}}let n=r.parent.childElements,i=n.findIndex(e=>e.unique===r.unique);if(1===n.filter(e=>e.is(r.tagName)).length){t.push(r.tagName.toLowerCase());continue}t.push(`${r.tagName.toLowerCase()}:nth-child(${String(i+1)})`)}return t.reverse().join(" > ")}is(e){return"*"===e||this.tagName.toLowerCase()===e.toLowerCase()}loadMeta(e){for(let r of(this.metaElement??={},T)){let n=e[r];if(void 0!==n){var t;t=this.metaElement,t[r]=n}else delete this.metaElement[r]}}matches(e){return e.split(",").some(e=>new er(e.trim()).matchElement(this))}get meta(){return this.metaElement}get parent(){return this._parent}get role(){let e=this.cacheGet(ea);if(void 0!==e)return e;let t=this.getAttribute("role");
2if(t)return this.cacheSet(ea,t.value);if(this.metaElement){let{aria:e}=this.metaElement,t=e.implicitRole(this._adapter);return this.cacheSet(ea,t)}return this.cacheSet(ea,null)}setAnnotation(e){this.annotation=e}setAttribute(e,t,r,n,i){let a=new L(e=e.toLowerCase(),t,r,n,i),s=this.attr[e];s?s.push(a):this.attr[e]=[a]}get tabIndex(){let e=this.cacheGet(es);if(void 0!==e)return e;let t=this.getAttribute("tabindex");if(!t||null===t.value)return this.cacheSet(es,null);if(t.value instanceof O)return this.cacheSet(es,0);let r=parseInt(t.value,10);return isNaN(r)?this.cacheSet(es,null):this.cacheSet(es,r)}get attributes(){return Object.values(this.attr).reduce((e,t)=>e.concat(t),[])}hasAttribute(e){return(e=e.toLowerCase())in this.attr}getAttribute(e,t=!1){if(!((e=e.toLowerCase())in this.attr))return t?[]:null;{let r=this.attr[e];return t?r:r[0]}}getAttributeValue(e){let t=this.getAttribute(e);return t&&null!==t.value?t.value.toString():null}appendText(e,t){this.childNodes.push(new ei(e,t))}get classList(){return this.hasAttribute("class")?new G(this.getAttribute("class",!0).filter(e=>e.isStatic).map(e=>e.value).join(" "),null):new G(null,null)}get id(){return this.getAttributeValue("id")}get style(){let e=this.getAttribute("style");return R(e?.value)}get firstElementChild(){let e=this.childElements;return e.length>0?e[0]:null}get lastElementChild(){let e=this.childElements;return e.length>0?e[e.length-1]:null}get siblings(){return this.parent?this.parent.childElements:[this]}get previousSibling(){let e=this.siblings.findIndex(e=>e.unique===this.unique);return e>=1?this.siblings[e-1]:null}get nextSibling(){let e=this.siblings.findIndex(e=>e.unique===this.unique);return e<=this.siblings.length-2?this.siblings[e+1]:null}getElementsByTagName(e){return this.childElements.reduce((t,r)=>t.concat(r.is(e)?[r]:[],r.getElementsByTagName(e)),[])}querySelector(e){let t=this.querySelectorImpl(e).next();return t.done?null:t.value}querySelectorAll(e){return Array.from(new Set(this.querySelectorImpl(e)).values())}*querySelectorImpl(e){if(e)for(let t of e.split(/(?<!\\),\s*/)){let e=new er(t);yield*e.match(this)}}someChildren(e){return this.childElements.some(function t(r){return!!e(r)||r.childElements.some(t)})}everyChildren(e){return this.childElements.every(function t(r){return!!e(r)&&r.childElements.every(t)})}find(e){if(e(this))return this;for(let t of this.childElements){let r=t.find(e);if(r)return r}return null}_setParent(e){let t=this._parent;return this._parent=e instanceof eu?e:null,t}}let ec={depthFirst:function(e,t){var r;if("root"in(r=e)&&"readyState"in r){if("complete"!==e.readyState)throw Error("Cannot call walk.depthFirst(..) before document is ready");e=e.root}!function e(r){r.childElements.forEach(e),r.isRootElement()||t(r)}(e)}};class ed{root;active;_readyState;doctype;constructor(e){this.root=eu.rootNode(e),this.active=this.root,this.doctype=null,this._readyState="loading"}pushActive(e){this.active=e}popActive(){this.active.isRootElement()||(this.active=this.active.parent??this.root)}getActive(){return this.active}get readyState(){return this._readyState}resolveMeta(e){this._readyState="complete",ec.depthFirst(this,t=>{e.resolve(t)})}getElementsByTagName(e){return this.root.getElementsByTagName(e)}visitDepthFirst(e){ec.depthFirst(this,e)}find(e){return this.root.find(e)}querySelector(e){return this.root.querySelector(e)}querySelectorAll(e){return this.root.querySelectorAll(e)}}let eh=["exclude"];class em{static validatePermitted(e,t){return!t||t.some(t=>em.validatePermittedRule(e,t))}static validateOccurrences(e,t,r){if(!t)return!0;let n=!0;for(let i of t){if("string"!=typeof i)return!1;let[,t,a]=/^(@?.*?)([?*]?)$/.exec(i),s=t&&a&&function(e){switch(e){case"?":return 1;case"*":return null;default:throw Error(`Invalid quantifier "${e}" used`)}}(a);if(s){let a=e.filter(e=>em.validatePermittedCategory(e,i,!0));if(a.length>s){for(let e of a.slice(s))r(e,t);n=!1}}}return n}static validateOrder(e,t,r){if(!t)return!0;let n=0,i=null;for(let a of e){let e=n;for(;t[n]&&!em.validatePermittedCategory(a,t[n],!0);)n++;if(n>=t.length){if(t.find(e=>em.validatePermittedCategory(a,e,!0)))return r(a,i),!1;n=e}i=a}return!0}static validateAncestors(e,t){return!t||0===t.length||t.some(t=>e.closest(t))}static validateRequiredContent(e,t){return t&&0!==t.length?t.filter(t=>!e.childElements.some(e=>em.validatePermittedCategory(e,t,!1))):[]}static validateAttribute(e,t){let r=t[e.key];if(!r)return!0;let n=e.value;if(n instanceof O)return!0;let i=null===n||""===n;return r.boolean?i||n===e.key:!!r.omit&&!!i||(r.list?new G(n,e.valueLocation).every(e=>this.validateAttributeValue(e,r)):this.validateAttributeValue(n,r))}static validateAttributeValue(e,t){if(!t.enum)return!0;
2if(null===e)return!1;let r=e.toLowerCase();return t.enum.some(t=>t instanceof RegExp?!!e.match(t):r===t)}static validatePermittedRule(e,t,r=!1){return"string"==typeof t?em.validatePermittedCategory(e,t,!r):Array.isArray(t)?t.every(t=>em.validatePermittedRule(e,t,r)):(function(e){for(let t of Object.keys(e))if(!eh.includes(t)){let r=JSON.stringify(e);throw Error(`Permitted rule "${r}" contains unknown property "${t}"`)}}(t),!t.exclude||(Array.isArray(t.exclude)?!t.exclude.some(t=>em.validatePermittedRule(e,t,!0)):!em.validatePermittedRule(e,t.exclude,!0)))}static validatePermittedCategory(e,t,r){let[,n]=/^(@?.*?)([?*]?)$/.exec(t);if(!n.startsWith("@"))return e.tagName===n;if(!e.meta)return r;switch(n){case"@meta":return e.meta.metadata;case"@flow":return e.meta.flow;case"@sectioning":return e.meta.sectioning;case"@heading":return e.meta.heading;case"@phrasing":return e.meta.phrasing;case"@embedded":return e.meta.embedded;case"@interactive":return e.meta.interactive;case"@script":return!!e.meta.scriptSupporting;case"@form":return!!e.meta.form;default:throw Error(`Invalid content category "${t}"`)}}}var ep={$schema:"http://json-schema.org/draft-06/schema#",$id:"https://html-validate.org/schemas/config.json",type:"object",additionalProperties:!1,properties:{$schema:{type:"string"},root:{type:"boolean",title:"Mark as root configuration",description:"If this is set to true no further configurations will be searched.",default:!1},extends:{type:"array",items:{type:"string"},title:"Configurations to extend",description:"Array of shareable or builtin configurations to extend."},elements:{type:"array",items:{anyOf:[{type:"string"},{type:"object"}]},title:"Element metadata to load",description:"Array of modules, plugins or files to load element metadata from. Use <rootDir> to refer to the folder with the package.json file.",examples:[["html-validate:recommended","plugin:recommended","module","./local-file.json"]]},plugins:{type:"array",items:{anyOf:[{type:"string"},{type:"object"}]},title:"Plugins to load",description:"Array of plugins load. Use <rootDir> to refer to the folder with the package.json file.",examples:[["my-plugin","./local-plugin"]]},transform:{type:"object",additionalProperties:{anyOf:[{type:"string"},{function:!0}]},title:"File transformations to use.",description:"Object where key is regular expression to match filename and value is name of transformer or a function.",examples:[{"^.*\\.foo$":"my-transformer","^.*\\.bar$":"my-plugin","^.*\\.baz$":"my-plugin:named"}]},rules:{type:"object",patternProperties:{".*":{anyOf:[{enum:[0,1,2,"off","warn","error"]},{type:"array",minItems:1,maxItems:1,items:[{enum:[0,1,2,"off","warn","error"]}]},{type:"array",minItems:2,maxItems:2,items:[{enum:[0,1,2,"off","warn","error"]},{}]}]}},title:"Rule configuration.",description:"Enable/disable rules, set severity. Some rules have additional configuration like style or patterns to use.",examples:[{foo:"error",bar:"off",baz:["error",{style:"camelcase"}]}]}}},ef=(e=>(e[e.DISABLED=0]="DISABLED",e[e.WARN=1]="WARN",e[e.ERROR=2]="ERROR",e))(ef||{});function eg(e,t){return e.replace(/{{\s*([^\s{}]+)\s*}}/g,(e,r)=>void 0!==t[r]?function e(t,r=!1){if(null==t)return"null";if("number"==typeof t)return t.toString();if("string"==typeof t)return r?JSON.stringify(t):t;if(Array.isArray(t)){let r=t.map(t=>e(t,!0)).join(", ");return`[ ${r} ]`}if("object"==typeof t){let r=Object.entries(t).map(([t,r])=>`${t}: ${e(r,!0)}`).join(", ");return`{ ${r} }`}return String(t)}(t[r]):e)}let ey=Symbol("aria-naming"),eb="allowed",ev=["caption","code","deletion","emphasis","generic","insertion","paragraph","presentation","strong","subscript","superscript"],ew=new Map;function ex(e,t){for(let r of e)if((function(e){var t;let r=ew.get(e);if(r)return r;let n=/^\/(.*)\/$/.exec(e),i=n?(t=n[1],RegExp(`^${t}$`)):function(e){let t=e.replace(/[*]+/g,".+");return RegExp(`^${t}$`)}(e);return ew.set(e,i),i})(r).test(t))return!0;return!1}let eA=Symbol(eC.name),eE=Symbol(eN.name),eT=Symbol(eI.name),e$=Symbol(eL.name),ek=Symbol(eO.name);function eS(e){return!(eC(e)||eL(e)||eN(e)||eI(e)||eO(e))}
2function eC(e,t){let r=e.cacheGet(eA);if(r)return t?r:r.byParent||r.bySelf;let n=e.cacheSet(eA,{byParent:!!e.parent&&eC(e.parent),bySelf:(e=>{let t=e.getAttribute("aria-hidden");return!!(t&&"true"===t.value)})(e)});return t?n:n.byParent||n.bySelf}function eN(e,t){let r=e.cacheGet(eE);if(r)return t?r:r.byParent||r.bySelf;let n=e.cacheSet(eE,{byParent:!!e.parent&&eN(e.parent),bySelf:(e=>{let t=e.getAttribute("hidden");return!!t?.isStatic})(e)});return t?n:n.byParent||n.bySelf}function eI(e,t){let r=e.cacheGet(eT);if(r)return t?r:r.byParent||r.bySelf;let n=e.cacheSet(eT,{byParent:!!e.parent&&eI(e.parent),bySelf:(e=>{let t=e.getAttribute("inert");return!!t?.isStatic})(e)});return t?n:n.byParent||n.bySelf}function eO(e){let t=e.cacheGet(ek);return t||e.cacheSet(ek,function(e){let t=!!e.parent&&eO(e.parent),r=(e=>{let t=e.getAttribute("style"),{display:r,visibility:n}=R(t?.value);return"none"===r||"hidden"===n})(e);return t||r}(e))}function eL(e){if(e.cacheExists(e$))return!!e.cacheGet(e$);let t=e.meta;if(t?.interactive||e.getAttribute("tabindex"))return e.cacheSet(e$,!1);let r=e.getAttribute("role");return r&&("presentation"===r.value||"none"===r.value)?e.cacheSet(e$,!0):e.cacheSet(e$,!1)}
2let eR=e_.name,eP=Symbol(`${eR}|html`),eq=Symbol(`${eR}|a11y`),eD=Symbol(`${eR}|html|ignore-hidden-root`),eM=Symbol(`${eR}|a11y|ignore-hidden-root`);var ej=(e=>(e[e.EMPTY_TEXT=0]="EMPTY_TEXT",e[e.DYNAMIC_TEXT=1]="DYNAMIC_TEXT",e[e.STATIC_TEXT=2]="STATIC_TEXT",e))(ej||{});function e_(e,t={}){let{accessible:r=!1,ignoreHiddenRoot:n=!1}=t,i=function(e){let{accessible:t=!1,ignoreHiddenRoot:r=!1}=e;return t&&r?eM:r?eD:t?eq:eP}(t);if(e.cacheExists(i))return e.cacheGet(i);if(!n&&eN(e)||!n&&r&&eC(e)||e.is("select")||e.is("textarea"))return e.cacheSet(i,0);let a=function e(t,r){let{accessible:n=!1}=r,i=[];for(let a of t.childNodes)if(en(a))i.push(a);else if(el(a)){if(eN(a,!0).bySelf||n&&eC(a,!0).bySelf)continue;i=i.concat(e(a,r))}return i}(e,{...t});return a.some(e=>e.isDynamic)?e.cacheSet(i,1):a.some(e=>null!==/\S/.exec(e.textContent))?e.cacheSet(i,2):e.cacheSet(i,0)}function eF(e){let t=e.getAttribute("alt");return!!t&&null!==t.value&&(t.isDynamic||""!==t.value.toString())}function ez(e){let t=e.getAttribute("aria-label");return!!t&&null!==t.value&&(t.isDynamic||""!==t.value.toString())}let eU=new a({strict:!0,strictTuples:!0,strictTypes:!0});eU.addMetaSchema(u);class eG{reporter;parser;meta;enabled;blockers;severity;event;name;options;constructor(e){this.reporter=null,this.parser=null,this.meta=null,this.event=null,this.options=e,this.enabled=!0,this.blockers=[],this.severity=ef.DISABLED,this.name=""}getSeverity(){return this.severity}setServerity(e){this.severity=e}block(e){this.blockers.push(e)}unblock(e){this.blockers=this.blockers.filter(t=>t!==e)}setEnabled(e){this.enabled=e}get deprecated(){return!1}isEnabled(e){return this.enabled&&this.severity>=ef.WARN&&(!e||e.ruleEnabled(this.name))}isBlocked(e){return!!(this.blockers.length>0)||!!e&&!!(e.ruleBlockers(this.name).length>0)}getBlockers(e){return[...this.blockers,...e?e.ruleBlockers(this.name):[]]}isKeywordIgnored(e,t=(e,t)=>e.includes(t)){return function(e,t,r=(e,t)=>e.includes(t)){let{include:n,exclude:i}=e;return!!(n&&!r(n,t)||i&&r(i,t))}(this.options,e,t)}getMetaFor(e){return this.meta.getMetaFor(e)}getTagsWithProperty(e){return this.meta.getTagsWithProperty(e)}getTagsDerivedFrom(e){return this.meta.getTagsDerivedFrom(e)}static schema(){return null}report(...e){let{node:t,message:r,location:n,context:i}=function(e){if(e[0]&&e[0].message)return e[0];{let[t,r,n,i]=e;return{node:t,message:r,location:n,context:i}}}(e),a=this.isEnabled(t),s=this.isBlocked(t),o=this.findLocation({node:t,location:n,event:this.event});if(this.parser.trigger("rule:error",{location:o,ruleId:this.name,enabled:a,blockers:this.getBlockers(t)}),a&&!s){let e=eg(r,i??{});this.reporter.add(this,e,this.severity,t,o,i)}}findLocation(e){return e.location?e.location:e.event?.location?e.event.location:e.node?.location?e.node.location:{}}on(e,...t){let r=t.pop(),n=t.pop()??(()=>!0);return this.parser.on(e,(e,t)=>{this.isEnabled()&&n(t)&&(this.event=t,r(t))})}init(e,t,r,n){this.parser=e,this.reporter=t,this.severity=r,this.meta=n}static validateOptions(e,t,r,n,i,a){if(!e)return;let s=e.schema();if(!s)return;let o=function(e,t){let r=`rule/${e}`,n=eU.getSchema(r);return n||eU.compile({$id:r,type:"object",additionalProperties:!1,properties:t})}(t,s);if(!o(n))throw new g(i,"Rule configuration error",a,s,(o.errors??[]).map(e=>(e.instancePath=`${r}${e.instancePath}`,e)))}documentation(e){return null}}let eB={allowExternal:!0,allowRelative:!0,allowAbsolute:!0,allowBase:!0},eV={a:"href",img:"src",link:"href",script:"src"},eW={external:"External links are not allowed by current configuration.","relative-base":"Links relative to <base> are not allowed by current configuration.","relative-path":"Relative links are not allowed by current configuration.",absolute:"Absolute links are not allowed by current configuration.",anchor:null};function eH(e){return"boolean"==typeof e?e:{include:e.include?e.include.map(e=>new RegExp(e)):null,exclude:e.exclude?e.exclude.map(e=>new RegExp(e)):null}}function eX(e,t){return!(t.include&&!t.include.some(t=>t.test(e))||t.exclude?.some(t=>t.test(e)))}class eY extends eG{allowExternal;allowRelative;allowAbsolute;constructor(e){super({...eB,...e}),this.allowExternal=eH(this.options.allowExternal),this.allowRelative=eH(this.options.allowRelative),this.allowAbsolute=eH(this.options.allowAbsolute)}static schema(){let e={anyOf:[{type:"boolean"},{type:"object",properties:{include:{type:"array",items:{type:"string"}},exclude:{type:"array",items:{type:"string"}}}}]};return{allowExternal:{...e},allowRelative:{...e},allowAbsolute:{...e},allowBase:{type:"boolean"}}}documentation(e){return{description:eW[e]??"This link type is not allowed by current configuration",url:"https://html-validate.org/rules/allowed-links.html"}}setup(){this.on("attr",e=>{if(!e.value||!this.isRelevant(e))return;let t=e.value.toString(),r=this.getStyle(t);switch(r){case"anchor":break;case"absolute":this.handleAbsolute(t,e,r);break;case"external":this.handleExternal(t,e,r);break;case"relative-base":this.handleRelativeBase(t,e,r);break;case"relative-path":this.handleRelativePath(t,e,r)}})}isRelevant(e){let{target:t,key:r,value:n}=e;if(n instanceof O)return!1;let i=eV[t.tagName];return!!(i&&i===r)}getStyle(e){if(e.match(/^([a-z]+:)?\/\//g))return"external";switch(e[0]){case"/":return"absolute";case".":return"relative-path";case"#":return"anchor";default:return"relative-base"}}handleAbsolute(e,t,r){let{allowAbsolute:n}=this;!0!==n&&(!1===n?this.report(t.target,"Link destination must not be absolute url",t.valueLocation,r):eX(e,n
2)||this.report(t.target,"Absolute link to this destination is not allowed by current configuration",t.valueLocation,r))}handleExternal(e,t,r){let{allowExternal:n}=this;!0!==n&&(!1===n?this.report(t.target,"Link destination must not be external url",t.valueLocation,r):eX(e,n)||this.report(t.target,"External link to this destination is not allowed by current configuration",t.valueLocation,r))}handleRelativePath(e,t,r){let{allowRelative:n}=this;if(!0===n);else if(!1===n)return this.report(t.target,"Link destination must not be relative url",t.valueLocation,r),!0;else if(!eX(e,n))return this.report(t.target,"Relative link to this destination is not allowed by current configuration",t.valueLocation,r),!0;return!1}handleRelativeBase(e,t,r){let{allowBase:n}=this.options;!this.handleRelativePath(e,t,r)&&(n||this.report(t.target,"Relative links must be relative to current folder",t.valueLocation,r))}}let eJ={accessible:!0};function eK(e){return e.getAttributeValue("alt")}class eZ extends eG{constructor(e){super({...eJ,...e})}static schema(){return{accessible:{type:"boolean"}}}documentation(e){return{description:(function(e){switch(e){case"missing-alt":return["The `alt` attribute must be set (and not empty) when the `href` attribute is present on an `<area>` element.","","The attribute is used to provide an alternative text description for the area of the image map.","The text should describe the purpose of area and the resource referenced by the `href` attribute.","","Either add the `alt` attribute or remove the `href` attribute."];case"missing-href":return["The `alt` attribute must not be set when the `href` attribute is missing on an `<area>` element.","","Either add the `href` attribute or remove the `alt` attribute."]}})(e).join("\n"),url:"https://html-validate.org/rules/area-alt.html"}}setup(){this.on("element:ready",this.isRelevant,e=>{let{target:t}=e,r=t.querySelectorAll("area");for(let e of r)this.validateArea(e,r)})}validateArea(e,t){let{accessible:r}=this.options,n=e.getAttribute("href"),i=e.getAttribute("alt");if(n){if(i?.isDynamic)return;let a=e.getAttributeValue("href");(r?[eK(e)]:t.filter(e=>e.getAttributeValue("href")===a).map(eK)).some(Boolean)||this.report({node:e,message:'"alt" attribute must be set and non-empty when the "href" attribute is present',location:i?i.keyLocation:n.keyLocation,context:"missing-alt"})}else i&&this.report({node:e,message:'"alt" attribute cannot be used unless the "href" attribute is present',location:i.keyLocation,context:"missing-href"})}isRelevant(e){let{target:t}=e;return t.is("map")}}class eQ extends eG{documentation(){return{description:"`aria-hidden` must not be used on the `<body>` element as it makes the page inaccessible to assistive technology such as screenreaders",url:"https://html-validate.org/rules/aria-hidden-body.html"}}setup(){this.on("tag:ready",this.isRelevant,e=>{let{target:t}=e,r=t.getAttribute("aria-hidden");r?.valueMatches("true",!0)&&this.report(t,"aria-hidden must not be used on <body>",r.keyLocation)})}isRelevant(e){return e.target.is("body")}}let e0={allowAnyNamable:!1},e1=["main","nav","table","td","th","aside","header","footer","section","article","dialog","form","img","area","fieldset","summary","figure"];class e2 extends eG{constructor(e){super({...e0,...e})}documentation(){let e=["Interactive elements","Labelable elements","Landmark elements","Elements with roles inheriting from widget","`<area>`","`<dialog>`","`<form>` and `<fieldset>`","`<iframe>`","`<img>` and `<figure>`","`<summary>`","`<table>`, `<td>` and `<th>`"].map(e=>`- ${e}
3`).join("");return{description:`\`aria-label\` can only be used on:
4
5${e}`,url:"https://html-validate.org/rules/aria-label-misuse.html"}}setup(){this.on("dom:ready",e=>{let{document:t}=e;for(let e of t.querySelectorAll("[aria-label]"))this.validateElement(e)})}validateElement(e){let t=e.getAttribute("aria-label");if(!t.value||t.valueMatches("",!1))return;let r=e.meta;if(r)r.attributes["aria-label"]||e1.includes(e.tagName)||e.hasAttribute("role")||e.hasAttribute("tabindex")||r.interactive||r.labelable||this.options.allowAnyNamable&&"allowed"===function(e){let t=e.cacheGet(ey);if(t)return t;let r=e.getAttribute("role")?.value;if(r)if(r instanceof O)return e.cacheSet(ey,eb);else return e.cacheSet(ey,ev.includes(r)?"prohibited":"allowed");let n=e.meta;return n?e.cacheSet(ey,n.aria.naming(e._adapter)):e.cacheSet(ey,eb)}(e)||this.report(e,'"aria-label" cannot be used on this element',t.keyLocation)}}class e3 extends p{constructor(e,t){super(e,t),Error.captureStackTrace(this,e3),this.name=e3.name}}class e9{styles;constructor(e,t){if(Array.isArray(e)||(e=[e]),0===e.length)throw new e3(`Missing style for ${t} rule`);this.styles=this.parseStyle(e,t)}match(e){return this.styles.some(t=>e.match(t.pattern))}get name(){let e=this.styles.map(e=>e.name);switch(this.styles.length){case 1:return e[0];case 2:return e.join(" or ");default:{let t=e.slice(-1),r=e.slice(0,-1);return`${r.join(", ")} or ${t[0]}`}}}parseStyle(e,t){return e.map(e=>{switch(e.toLowerCase()){case"lowercase":return{pattern:/^[a-z]*$/,name:"lowercase"};case"uppercase":return{pattern:/^[A-Z]*$/,name:"uppercase"};case"pascalcase":return{pattern:/^[A-Z][A-Za-z]*$/,name:"PascalCase"};case"camelcase":return{pattern:/^[a-z][A-Za-z]*$/,name:"camelCase"};default:throw new e3(`Invalid style "${e}" for ${t} rule`)}})}}let e6={style:"lowercase",ignoreForeign:!0};class e5 extends eG{style;constructor(e){super({...e6,...e}),this.style=new e9(this.options.style,"attr-case")}static schema(){let e=["lowercase","uppercase","pascalcase","camelcase"];return{ignoreForeign:{type:"boolean"},style:{anyOf:[{enum:e,type:"string"},{items:{enum:e,type:"string"},type:"array"}]}}}documentation(){let{style:e}=this.options;return{description:Array.isArray(e)?["Attribute name must be in one of:","",...e.map(e=>`- ${e}`)].join("\n"):`Attribute name must be in ${e}.`,url:"https://html-validate.org/rules/attr-case.html"}}setup(){this.on("attr",e=>{if(this.isIgnored(e.target)||e.originalAttribute)return;let t=e.key.replace(/[^a-z]+/gi,"");this.style.match(t)||this.report({node:e.target,message:`Attribute "${e.key}" should be ${this.style.name}`,location:e.keyLocation})})}
5isIgnored(e){return!!this.options.ignoreForeign&&!!e.meta?.foreign}}var e7=(e=>(e[e.UNICODE_BOM=1]="UNICODE_BOM",e[e.WHITESPACE=2]="WHITESPACE",e[e.DOCTYPE_OPEN=3]="DOCTYPE_OPEN",e[e.DOCTYPE_VALUE=4]="DOCTYPE_VALUE",e[e.DOCTYPE_CLOSE=5]="DOCTYPE_CLOSE",e[e.TAG_OPEN=6]="TAG_OPEN",e[e.TAG_CLOSE=7]="TAG_CLOSE",e[e.ATTR_NAME=8]="ATTR_NAME",e[e.ATTR_VALUE=9]="ATTR_VALUE",e[e.TEXT=10]="TEXT",e[e.TEMPLATING=11]="TEMPLATING",e[e.SCRIPT=12]="SCRIPT",e[e.STYLE=13]="STYLE",e[e.COMMENT=14]="COMMENT",e[e.CONDITIONAL=15]="CONDITIONAL",e[e.DIRECTIVE=16]="DIRECTIVE",e[e.EOF=17]="EOF",e))(e7||{});let e4=/^\uFEFF/,e8=/^(?:\r\n|\r|\n|[ \t]+(?:\r\n|\r|\n)?)/,te=/^<!(DOCTYPE)\s/i,tt=/^[^>]+/,tr=/^>/,tn=/^<\?xml.*?\?>\s+/,ti=/^<(\/?)([a-zA-Z0-9\-_:]+)/,ta=/^\/?>/,ts=/^[^]*?(?=(?:[ \t]*(?:\r\n|\r|\n)|<[^ ]|$))/,to=/^(?:<%.*?%>|<\?.*?\?>|<\$.*?\$>)/s,tl=/^[^]*?(?=<|$)/,tu=/^([^\t\r\n\f \/><"'=]+)/,tc=/^(\s*=\s*)'([^']*?)(')/,td=/^(\s*=\s*)"([^"]*?)(")/,th=/^(\s*=\s*)([^\t\r\n\f "'<>][^\t\r\n\f <>]*)/,tm=/^<!\[CDATA\[/,tp=/^[^]*?]]>/,tf=/^[^]*?(?=<\/script)/,tg=/^<(\/)(script)/,ty=/^[^]*?(?=<\/style)/,tb=/^<(\/)(style)/,tv=/^(<!--\s*\[html-validate-)([a-z0-9-]+)(\s*)(.*?)(]?\s*-->)/,tw=/^<!--([^]*?)-->/,tx=/^<!\[([^\]]*?)\]>/;class tA extends Error{location;constructor(e,t){super(t),this.location=e}}class tE{*tokenize(e){let t=new M(e),r=t.state,n=t.string.length;for(;t.string.length>0;){switch(t.state){case q.INITIAL:yield*this.tokenizeInitial(t);break;case q.DOCTYPE:yield*this.tokenizeDoctype(t);break;case q.TAG:yield*this.tokenizeTag(t);break;case q.ATTR:yield*this.tokenizeAttr(t);break;case q.TEXT:yield*this.tokenizeText(t);break;case q.CDATA:yield*this.tokenizeCDATA(t);break;case q.SCRIPT:yield*this.tokenizeScript(t);break;case q.STYLE:yield*this.tokenizeStyle(t);break;default:this.unhandled(t)}t.state===r&&t.string.length===n&&this.errorStuck(t),r=t.state,n=t.string.length}yield this.token(t,e7.EOF,[])}token(e,t,r){let n=r.length>0?r[0].length:0;return{type:t,location:e.getLocation(n),data:Array.from(r)}}unhandled(e){let t=JSON.stringify(e.string.length>13?`${e.string.slice(0,15)}...`:e.string),r=q[e.state],n=`failed to tokenize ${t}, unhandled state ${r}.`;throw new tA(e.getLocation(1),n)}errorStuck(e){let t=q[e.state],r=`failed to tokenize ${e.getTruncatedLine()}, state ${t} failed to consume data or change state.`;throw new tA(e.getLocation(1),r)}evalNextState(e,t){return"function"==typeof e?e(t):e}*match(e,t,r){let n=t.length;for(let r=0;r<n;r++){let[n,i,a]=t[r],s=n?e.string.match(n):[""];if(s){let t=null;!1!==a&&(t=this.token(e,a,s),yield t);let r=this.evalNextState(i,t);e.consume(s,r),this.enter(e,r,s);return}}let i=`failed to tokenize ${e.getTruncatedLine()}, ${r}.`;throw new tA(e.getLocation(1),i)}enter(e,t,r){t===q.TAG&&r?.[0].startsWith("<")&&("<script"===r[0]?e.contentModel=D.SCRIPT:"<style"===r[0]?e.contentModel=D.STYLE:e.contentModel=D.TEXT)}*tokenizeInitial(e){yield*this.match(e,[[e4,q.INITIAL,e7.UNICODE_BOM],[tn,q.INITIAL,!1],[te,q.DOCTYPE,e7.DOCTYPE_OPEN],[e8,q.INITIAL,e7.WHITESPACE],[tv,q.INITIAL,e7.DIRECTIVE],[tx,q.INITIAL,e7.CONDITIONAL],[tw,q.INITIAL,e7.COMMENT],[!1,q.TEXT,!1]],"expected doctype")}*tokenizeDoctype(e){yield*this.match(e,[[e8,q.DOCTYPE,e7.WHITESPACE],[tt,q.DOCTYPE,e7.DOCTYPE_VALUE],[tr,q.TEXT,e7.DOCTYPE_CLOSE]],"expected doctype name")}*tokenizeTag(e){yield*this.match(e,[[ta,function(t){switch(e.contentModel){case D.TEXT:return q.TEXT;case D.SCRIPT:if(t&&!t.data[0].startsWith("/"))return q.SCRIPT;return q.TEXT;case D.STYLE:if(t&&!t.data[0].startsWith("/"))return q.STYLE;return q.TEXT}},e7.TAG_CLOSE],[tu,q.ATTR,e7.ATTR_NAME],[e8,q.TAG,e7.WHITESPACE]],'expected attribute, ">" or "/>"')}*tokenizeAttr(e){yield*this.match(e,[[tc,q.TAG,e7.ATTR_VALUE],[td,q.TAG,e7.ATTR_VALUE],[th,q.TAG,e7.ATTR_VALUE],[!1,q.TAG,!1]],'expected attribute, ">" or "/>"')}*tokenizeText(e){yield*this.match(e,[[e8,q.TEXT,e7.WHITESPACE],[tm,q.CDATA,!1],[tv,q.TEXT,e7.DIRECTIVE],[tx,q.TEXT,e7.CONDITIONAL],[tw,q.TEXT,e7.COMMENT],[to,q.TEXT,e7.TEMPLATING],[ti,q.TAG,e7.TAG_OPEN],[ts,q.TEXT,e7.TEXT],[tl,q.TEXT,e7.TEXT]],'expected text or "<"')}*tokenizeCDATA(e){yield*this.match(e,[[tp,q.TEXT,!1]],"expected ]]>")}*tokenizeScript(e){yield*this.match(e,[[tg,q.TAG,e7.TAG_OPEN],[tf,q.SCRIPT,e7.SCRIPT]],"expected <\/script>")}*tokenizeStyle(e){yield*this.match(e,[[tb,q.TAG,e7.TAG_OPEN],[ty,q.STYLE,e7.STYLE]],"expected </style>")}}let tT=/(\s+)/;class t$ extends eG{documentation(){return{description:"Attribute value must not be separated by whitespace.",url:"https://html-validate.org/rules/attr-delimiter.html"}}setup(){this.on("token",e=>{let{token:t}=e;if(t.type!==e7.ATTR_VALUE)return;let r=t.data[1];if(tT.exec(r)){let t=P(e.location,0,r.length);this.report(null,"Attribute value must not be delimited by whitespace",t)}})}}let tk={pattern:"[a-z0-9-:]+",ignoreForeign:!0};class tS extends eG{pattern;constructor(e){super({...tk,...e}),this.pattern=function(e){return Array.isArray(e)?RegExp(`^(${e.join("|")})$`,"i"):RegExp(`^${e}$`,"i")}(this.options.pattern)}static schema(){return{pattern:{oneOf:[{type:"array",items:{type:"string"},minItems:1},{type:"string"}]},ignoreForeign:{type:"boolean"}}}documentation(e){var t,r;return{description:(t=e.attr,Array.isArray(r=e.pattern)?[`Attribute "${t}" should match one of the configured regular expressions:`,"",...r.map(e=>`- \`/${e}/\``)].join("\n"):`Attribute "${t}" should match the regular expression \`/${r}/\``),url:"https://html-validate.org/rules/attr-pattern.html"}}setup(){this.on("attr",e=>{if(this.isIgnored(e.target)||e.originalAttribute||this.pattern.test(e.key))return;let t=function(e,t){if(!Array.isArray(t))return`Attribute "${e}" should match /${t}/`;{let r=t.map(e=>`/${e}/`).join(", ");return`Attribute "${e}" should match one of [${r}]`}}
5(e.key,this.options.pattern),r={attr:e.key,pattern:this.options.pattern};this.report(e.target,t,e.keyLocation,r)})}isIgnored(e){return!!this.options.ignoreForeign&&!!e.meta?.foreign}}let tC={style:"auto",unquoted:!1};class tN extends eG{style;static schema(){return{style:{enum:["auto","double","single","any"],type:"string"},unquoted:{type:"boolean"}}}documentation(e){let{style:t}=this,{unquoted:r}=this.options;return{description:[function(e){switch(e.error){case"style":return`Attribute \`${e.attr}\` must use \`${e.expected}\` instead of \`${e.actual}\`.`;case"unquoted":return`Attribute \`${e.attr}\` must not be unquoted.`}}(e),"\nUnder the current configuration attributes must be:\n",function(e,t){let r=[];switch(e){case"auto":r.push("- quoted with double quotes `\"` unless the value contains double quotes in which case single quotes `'` should be used instead");break;case"any":r.push("- quoted with single quotes `'`"),r.push('- quoted with double quotes `"`');break;case"'":case'"':r.push(`- quoted with ${"'"===e?"single":"double"} quotes \`${e}\``)}return t&&r.push("- unquoted (if applicable)"),`${r.join(" or\n")}
6`}(t,r)].join("\n"),url:"https://html-validate.org/rules/attr-quotes.html"}}constructor(e){super({...tC,...e}),this.style=function(e){switch(e.toLowerCase()){case"auto":return"auto";case"double":return'"';case"single":return"'";case"any":return"any";default:throw new e3(`Invalid style "${e}" for "attr-quotes" rule`)}}(this.options.style)}setup(){this.on("attr",e=>{if(e.originalAttribute||null===e.value)return;if(!e.quote){if(!this.options.unquoted){let t=`Attribute "${e.key}" using unquoted value`,r={error:"unquoted",attr:e.key};this.report(e.target,t,null,r)}return}if("any"===this.style)return;let t=this.resolveQuotemark(e.value.toString(),this.style);if(e.quote!==t){let r=`Attribute "${e.key}" used ${e.quote} instead of expected ${t}`,n={error:"style",attr:e.key,actual:e.quote,expected:t};this.report(e.target,r,null,n)}})}resolveQuotemark(e,t){return"auto"===t?e.includes('"')?"'":'"':t}}class tI extends eG{documentation(){return{description:"No space between attributes. At least one whitespace character (commonly space) must be used to separate attributes.",url:"https://html-validate.org/rules/attr-spacing.html"}}setup(){let e;this.on("token",t=>{t.type===e7.ATTR_NAME&&e!==e7.WHITESPACE&&this.report(null,"No space between attributes",t.location),e=t.type})}}class tO extends eG{documentation(e){let t={description:"Attribute has invalid value.",url:"https://html-validate.org/rules/attribute-allowed-values.html"};if(!e)return t;let{allowed:r,attribute:n,element:i,value:a}=e;return r.enum?t.description=[`The \`<${i}>\` element does not allow the attribute \`${n}\` to have the value \`"${a}"\`.`,"","It must match one of the following:","",...r.enum.map(e=>"string"==typeof e?`- \`"${e}"\``:`- \`${e.toString()}\``)].join("\n"):r.boolean&&(t.description=`The \`<${e.element}>\` attribute \`${e.attribute}\` must be a boolean attribute, e.g. \`<${e.element} ${e.attribute}>\``),t}setup(){this.on("dom:ready",e=>{let t=e.document;ec.depthFirst(t,e=>{let t=e.meta;if(t?.attributes)for(let r of e.attributes){if(em.validateAttribute(r,t.attributes))continue;let n=r.value?r.value.toString():"",i={element:e.tagName,attribute:r.key,value:n,allowed:function(e){let t={};return void 0!==e.enum&&(t.enum=e.enum),void 0!==e.boolean&&(t.boolean=e.boolean),t}(t.attributes[r.key])},a=this.getMessage(r),s=this.getLocation(r);this.report(e,a,s,i)}})})}getMessage(e){let{key:t,value:r}=e;return null!==r?`Attribute "${t}" has invalid value "${r.toString()}"`:`Attribute "${t}" is missing value`}getLocation(e){return e.valueLocation??e.keyLocation}}let tL={style:"omit"};class tR extends eG{hasInvalidStyle;constructor(e){super({...tL,...e}),this.hasInvalidStyle=function(e){switch(e.toLowerCase()){case"omit":return e=>null!==e.value;case"empty":return e=>""!==e.value;case"name":return e=>e.value!==e.key;default:throw Error(`Invalid style "${e}" for "attribute-boolean-style" rule`)}}(this.options.style)}static schema(){return{style:{enum:["empty","name","omit"],type:"string"}}}documentation(){return{description:"Require a specific style when writing boolean attributes.",url:"https://html-validate.org/rules/attribute-boolean-style.html"}}setup(){this.on("dom:ready",e=>{let t=e.document;ec.depthFirst(t,e=>{let t=e.meta;if(t?.attributes)for(let r of e.attributes)this.isBoolean(r,t.attributes)&&!r.originalAttribute&&this.hasInvalidStyle(r)&&this.report(e,function(e,t){let r=e.key;switch(t.toLowerCase()){case"omit":return`Attribute "${r}" should omit value`;case"empty":return`Attribute "${r}" value should be empty string`;case"name":return`Attribute "${r}" should be set to ${r}="${r}"`}return""}(r,this.options.style),r.keyLocation)})})}
6isBoolean(e,t){let r=t[e.key];return!!r?.boolean}}let tP={style:"omit"};class tq extends eG{hasInvalidStyle;constructor(e){super({...tP,...e}),this.hasInvalidStyle=function(e){switch(e.toLowerCase()){case"omit":return e=>null!==e.value;case"empty":return e=>""!==e.value;default:throw Error(`Invalid style "${e}" for "attribute-empty-style" rule`)}}(this.options.style)}static schema(){return{style:{enum:["empty","omit"],type:"string"}}}documentation(){return{description:"Require a specific style for attributes with empty values.",url:"https://html-validate.org/rules/attribute-empty-style.html"}}setup(){this.on("dom:ready",e=>{let t=e.document;ec.depthFirst(t,e=>{let t=e.meta;if(t?.attributes)for(let n of e.attributes){var r;(function(e,t){let r=t[e.key];return!!r?.omit})(n,t.attributes)&&!(r=n).isDynamic&&(null===r.value||""===r.value)&&this.hasInvalidStyle(n)&&this.report(e,function(e,t){let r=e.key;switch(t.toLowerCase()){case"omit":return`Attribute "${r}" should omit value`;case"empty":return`Attribute "${r}" value should be empty string`}return""}(n,this.options.style),n.keyLocation)}})})}}class tD extends eG{documentation(e){return{description:function(e){let{tagName:t,attr:r,details:n}=e;return`The \`${r}\` attribute cannot be used on \`${t}\` in this context: ${n}`}(e),url:"https://html-validate.org/rules/attribute-misuse.html"}}setup(){this.on("element:ready",e=>{let{target:t}=e,{meta:r}=t;if(r)for(let e of t.attributes){let n=e.key.toLowerCase();this.validateAttr(t,e,r.attributes[n])}})}validateAttr(e,t,r){if(!r?.allowed)return;let n=r.allowed(e._adapter,t.value);n&&this.report({node:e,message:'"{{ attr }}" attribute cannot be used on {{ tagName }} in this context: {{ details }}',location:t.keyLocation,context:{tagName:e.annotatedName,attr:t.key,details:n}})}}class tM extends eG{attr;patterns;constructor(e,t){super(t);let{pattern:r}=this.options;this.attr=e,this.patterns=(function(e){return Array.isArray(e)?e:[e]})(r).map(e=>(function(e){switch(e){case"kebabcase":return{regexp:/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,description:e};case"camelcase":return{regexp:/^[a-z][a-zA-Z0-9]*$/,description:e};case"snakecase":case"underscore":return{regexp:/^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$/,description:e};case"bem":return{regexp:RegExp("^[a-z][a-z0-9]*(?:-[a-z0-9]+)*(?:__[a-z0-9]+(?:-[a-z0-9]+)*)?(?:--[a-z0-9]+(?:-[a-z0-9]+)*){0,2}$"),description:e};default:{let t=new RegExp(e);return{regexp:t,description:t.toString()}}}})(e))}static schema(){return{pattern:{oneOf:[{type:"array",items:{type:"string"},minItems:1},{type:"string"}]}}}description(e){let{attr:t,patterns:r}=this,{value:n}=e;return[1===r.length?`The \`${t}\` attribute value \`"${n}"\` does not match the configured pattern.`:`The \`${t}\` attribute value \`"${n}"\` does not match either of the configured patterns.`,"For consistency within the codebase the `${attr}` is required to match one or more of the following patterns:","",...r.map(e=>`- \`${e.description}\``)].join("\n")}validateValue(e,t,r){let{attr:n,patterns:i}=this;if(i.some(e=>e.regexp.test(t)))return;let a=(0,l.n)(i.map(e=>`"${e.description}"`)),s=1===i.length?`${n} "${t}" does not match the configured pattern ${a}`:`${n} "${t}" does not match either of the configured patterns: ${a}`;this.report({node:e,message:s,location:r,context:{value:t}})}}let tj={pattern:"kebabcase"};class t_ extends tM{constructor(e){super("class",{...tj,...e})}static schema(){return tM.schema()}documentation(e){return{description:this.description(e),url:"https://html-validate.org/rules/class-pattern.html"}}setup(){this.on("attr",e=>{let{target:t,key:r,value:n,valueLocation:i}=e;if("class"===r.toLowerCase())for(let{item:e,location:r}of new G(n,i).iterator())this.validateValue(t,e,r)})}}class tF extends eG{documentation(){return{description:"HTML disallows end tags to have attributes.",url:"https://html-validate.org/rules/close-attr.html"}}setup(){this.on("tag:end",e=>{if(!e.target||e.previous===e.target)return;let t=e.target;if(Object.keys(t.attributes).length>0){let e=t.attributes[0];this.report(null,"Close tags cannot have attributes",e.keyLocation)}})}}function*tz(e){if(!e)return;let t=e;for(;t&&!t.isRootElement();)yield t,t=t.parent;t&&(yield t)}class tU extends eG{documentation(){return{description:"HTML requires elements to be closed in the same order as they were opened.",url:"https://html-validate.org/rules/close-order.html"}}setup(){let e;this.on("parse:begin",()=>{e=new Set}),this.on("tag:end",t=>{let r=t.target,n=t.previous;if(!r)for(let t of tz(n))t.isRootElement()||e.has(t.unique)||(this.report(t,`Unclosed element '<${t.tagName}>'`,t.location),e.add(t.unique))}),this.on("tag:end",t=>{let r=t.target,n=t.previous;if(!r||r.voidElement||n.closed===eo.ImplicitClosed)return;if(n.isRootElement()){let e={filename:r.location.filename,line:r.location.line,column:r.location.column,offset:r.location.offset,size:r.tagName.length+1};this.report(null,`Stray end tag '</${r.tagName}>'`,e);return}if(r.tagName===n.tagName)return;let i=function(e,t){for(let r of tz(e))if(t(r))return r;return null}(n.parent,e=>e.is(r.tagName));if(i&&!i.isRootElement()){for(let t of tz(n)){if(i.isSameNode(t))break;e.has(t.unique)||(this.report(t,`Unclosed element '<${t.tagName}>'`,t.location),e.add(t.unique))}this.report(null,`End tag '</${r.tagName}>' seen but there were open elements`,r.location),e.add(i.unique)}else this.report(null,`Stray end tag '</${r.tagName}>'`,r.location)})}}
6let tG={include:null,exclude:null};class tB extends eG{constructor(e){super({...tG,...e})}static schema(){return{exclude:{anyOf:[{items:{type:"string"},type:"array"},{type:"null"}]},include:{anyOf:[{items:{type:"string"},type:"array"},{type:"null"}]}}}documentation(e){let t=[];if(e.source){let r=function(e){let t=/html(\d)(\d)?/.exec(e);if(t){let[,...e]=t,r=e.filter(Boolean).join(".");return`in HTML ${r}`}switch(e){case"whatwg":return"in HTML Living Standard";case"non-standard":return"and non-standard";default:return`by ${e}`}}(e.source),n=`The \`<$tagname>\` element is deprecated ${r} and should not be used in new code.`;t.push(n)}else t.push("The `<$tagname>` element is deprecated and should not be used in new code.");return e.documentation&&t.push(e.documentation),{description:t.map(t=>t.replace(/\$tagname/g,e.tagName)).join("\n\n"),url:"https://html-validate.org/rules/deprecated.html"}}setup(){this.on("tag:start",e=>{let t=e.target;if(null===t.meta)return;let r=t.meta.deprecated;if(!r||this.isKeywordIgnored(t.tagName))return;let n=P(e.location,1);"string"==typeof r?this.reportString(r,t,n):"boolean"==typeof r?this.reportBoolean(t,n):this.reportObject(r,t,n)})}reportString(e,t,r){let n={tagName:t.tagName},i=`<${t.tagName}> is deprecated: ${e}`;this.report(t,i,r,n)}reportBoolean(e,t){let r={tagName:e.tagName},n=`<${e.tagName}> is deprecated`;this.report(e,n,t,r)}reportObject(e,t,r){let n={...e,tagName:t.tagName},i=e.message?`: ${e.message}`:"",a=`<${t.tagName}> is deprecated${i}`;this.report(t,a,r,n)}}class tV extends eG{documentation(e){let t=e?`The rule "${e}"`:"This rule";return{description:`${t} is deprecated and should not be used any longer, consult documentation for further information.`,url:"https://html-validate.org/rules/deprecated-rule.html"}}setup(){this.on("config:ready",e=>{for(let t of this.getDeprecatedRules(e))t.getSeverity()>ef.DISABLED&&this.report(null,`Usage of deprecated rule "${t.name}"`,null,t.name)})}getDeprecatedRules(e){return Object.values(e.rules).filter(e=>e.deprecated)}}let tW=class extends eG{documentation(){return{description:'HTML5 documents should use the "html" doctype (short `form`, not legacy string):\n\n```html\n<!DOCTYPE html>\n```',url:"https://html-validate.org/rules/doctype-html.html"}}setup(){this.on("doctype",e=>{"html"!==e.value.toLowerCase()&&this.report(null,'doctype should be "html"',e.valueLocation)})}},tH={style:"uppercase"};class tX extends eG{constructor(e){super({...tH,...e})}static schema(){return{style:{enum:["lowercase","uppercase"],type:"string"}}}documentation(e){return{description:`While DOCTYPE is case-insensitive in the standard the current configuration requires it to be ${e.style}`,url:"https://html-validate.org/rules/doctype-style.html"}}setup(){this.on("doctype",e=>{"uppercase"===this.options.style&&"DOCTYPE"!==e.tag&&this.report(null,"DOCTYPE should be uppercase",e.location,this.options),"lowercase"===this.options.style&&"doctype"!==e.tag&&this.report(null,"DOCTYPE should be lowercase",e.location,this.options)})}}let tY={style:"lowercase"};class tJ extends eG{style;constructor(e){super({...tY,...e}),this.style=new e9(this.options.style,"element-case")}static schema(){let e=["lowercase","uppercase","pascalcase","camelcase"];return{style:{anyOf:[{enum:e,type:"string"},{items:{enum:e,type:"string"},type:"array"}]}}}documentation(){let{style:e}=this.options;return{description:Array.isArray(e)?["Element tagname must be in one of:","",...e.map(e=>`- ${e}`)].join("\n"):`Element tagname must be in ${e}.`,url:"https://html-validate.org/rules/element-case.html"}}setup(){this.on("tag:start",e=>{let{target:t,location:r}=e;this.validateCase(t,r)}),this.on("tag:end",e=>{let{target:t,previous:r}=e;this.validateMatchingCase(r,t)})}validateCase(e,t){let r=e.tagName.replace(/[^a-z]+/gi,"");if(!this.style.match(r)){let r=P(t,1);this.report(e,`Element "${e.tagName}" should be ${this.style.name}`,r)}}validateMatchingCase(e,t){e&&t&&e.tagName&&t.tagName&&e.tagName.toLowerCase()===t.tagName.toLowerCase()&&e.tagName!==t.tagName&&this.report(e,"Start and end tag must not differ in casing",t.location)}}let tK={pattern:"^[a-z][a-z0-9\\-._]*-[a-z0-9\\-._]*$",whitelist:[],blackl
6ist:[]};class tZ extends eG{pattern;constructor(e){super({...tK,...e}),this.pattern=new RegExp(this.options.pattern)}static schema(){return{blacklist:{items:{type:"string"},type:"array"},pattern:{type:"string"},whitelist:{items:{type:"string"},type:"array"}}}documentation(e){return{description:this.documentationMessages(e).join("\n"),url:"https://html-validate.org/rules/element-name.html"}}documentationMessages(e){return e.blacklist.includes(e.tagName)?[`<${e.tagName}> is blacklisted by the project configuration.`,"","The following names are blacklisted:",...e.blacklist.map(e=>`- ${e}`)]:e.pattern!==tK.pattern?[`<${e.tagName}> is not a valid element name. This project is configured to only allow names matching the following regular expression:`,"",`- \`${e.pattern}\``]:[`<${e.tagName}> is not a valid element name. If this is a custom element HTML requires the name to follow these rules:`,"","- The name must begin with `a-z`","- The name must include a hyphen `-`","- It may include alphanumerical characters `a-z0-9` or hyphens `-`, dots `.` or underscores `_`."]}setup(){let e=/^(.+):.+$/;this.on("tag:start",t=>{let r=t.target,n=r.tagName,i=P(t.location,1),a={tagName:n,pattern:this.options.pattern,blacklist:this.options.blacklist};this.options.blacklist.includes(n)&&this.report(r,`<${n}> element is blacklisted`,i,a),r.meta||e.exec(n)||!this.options.whitelist.includes(n)&&(n.match(this.pattern)||this.report(r,`<${n}> is not a valid element name`,i,a))})}}class tQ extends eG{documentation(e){return{description:(function(e){switch(e.kind){case"content":return[`The \`${e.child}\` element is not permitted as content under the parent \`${e.parent}\` element.`];case"descendant":return[`The \`${e.child}\` element is not permitted as a descendant of the \`${e.ancestor}\` element.`]}})(e).join("\n"),url:"https://html-validate.org/rules/element-permitted-content.html"}}setup(){this.on("dom:ready",e=>{let t=e.document;ec.depthFirst(t,e=>{let t=e.parent;t&&[()=>this.validatePermittedContent(e,t),()=>this.validatePermittedDescendant(e,t)].some(e=>e())})})}validatePermittedContent(e,t){if(!t.meta)return!1;let r=t.meta.permittedContent??null;return this.validatePermittedContentImpl(e,t,r)}validatePermittedContentImpl(e,t,r){if(!em.validatePermitted(e,r)){let r=`<${e.tagName}>`,n=`${r} element is not permitted as content under ${t.annotatedName}`,i={kind:"content",parent:t.annotatedName,child:r};return this.report(e,n,null,i),!0}if(e.meta?.transparent){var n;return("boolean"==typeof(n=e.meta.transparent)?e.childElements:e.childElements.filter(e=>n.some(t=>em.validatePermittedCategory(e,t,!1)))).map(e=>this.validatePermittedContentImpl(e,t,r)).some(Boolean)}return!1}validatePermittedDescendant(e,t){for(let r=t;r&&!r.isRootElement()&&!function(e){let{tagName:t,meta:r}=e;return!!("template"===t&&r?.templateRoot&&r?.scriptSupporting)}(r);r=r.parent??null){let t=r.meta;if(!t)continue;let n=t.permittedDescendants;if(!n||em.validatePermitted(e,n))continue;let i=`<${e.tagName}>`,a=r.annotatedName,s=`${i} element is not permitted as a descendant of ${a}`,o={kind:"descendant",ancestor:a,child:i};return this.report(e,s,null,o),!0}return!1}}class t0 extends eG{documentation(){return{description:"Some elements may only be used a fixed amount of times in given context.",url:"https://html-validate.org/rules/element-permitted-occurrences.html"}}setup(){this.on("dom:ready",e=>{let t=e.document;ec.depthFirst(t,e=>{if(!e.meta)return;let t=e.meta.permittedContent;t&&em.validateOccurrences(e.childElements,t,(t,r)=>{this.report(t,`Element <${r}> can only appear once under ${e.annotatedName}`)})})})}}class t1 extends eG{documentation(){return{description:"Some elements has a specific order the children must use.",url:"https://html-validate.org/rules/element-permitted-order.html"}}setup(){this.on("dom:ready",e=>{let t=e.document;ec.depthFirst(t,e=>{if(!e.meta)return;let t=e.meta.permittedOrder;t&&em.validateOrder(e.childElements,t,(e,t)=>{this.report(e,`Element <${e.tagName}> must be used before <${t.tagName}> in this context`)})})})}}function t2(e){return"string"==typeof e}function t3(e){return e.startsWith("@")}function t9(e){return t3(e)?e.slice(1):`<${e}>`}function t6(e){return e.length>0&&e.every(t2)}class t5 extends eG{documentation(e){return{description:(function(e){let{child:t,parent:r,rules:n}=e,i=`The \`${t}\` element cannot have a \`${r}\` element as parent.`;return t6(n)?[i,"","Allowed parents one of:","",...n.filter(t2).map(e=>t3(e)?`- any ${e.slice(1)} element`:`- \`<${e}>\``)]:[i]})(e).join("\n"),url:"https://html-validate.org/rules/element-permitted-parent.html"}}setup(){this.on("dom:ready",e=>{let t=e.document;ec.depthFirst(t,e=>{let t=e.parent;if(!t||t.isRootElement()||t.tagName===e.tagName)return;let r=e.meta?.permittedParent;if(!r)return!1;if(em.validatePermitted(t,r))return;let n=function(e,t,r){let n=e.annotatedName,i=t.annotatedName;if(!t6(r))return`${n} element cannot have ${i} element as parent`;let a=(0,l.n)(r.filter(t2).map(t9));return`${n} element requires a ${a} element as parent`}(e,t,r),i={parent:t.annotatedName,child:e.annotatedName,rules:r};this.report(e,n,null,i)})})}}class t7 extends eG{documentation(e){return{description:(function(e){let t=e.ancestor.map(e=>`\`${e}\``);return[`The \`${e.child}\` element requires a ${(0,l.n)(t)} ancestor.`]})(e).join("\n"),url:"https://html-validate.org/rules/element-required-ancestor.html"}}setup(){this.on("dom:ready",e=>{let t=e.document;ec.depthFirst(t,e=>
6{e.parent&&this.validateRequiredAncestors(e)})})}validateRequiredAncestors(e){if(!e.meta)return;let t=e.meta.requiredAncestors;if(!t||em.validateAncestors(e,t))return;let r=t.map(e=>/^[a-zA-Z0-9-]+$/.exec(e)?`<${e}>`:`"${e}"`),n=`<${e.tagName}>`,i=`<${e.tagName}> element requires a ${(0,l.n)(r)} ancestor`;this.report(e,i,null,{ancestor:r,child:n})}}class t4 extends eG{documentation(e){let t={description:"Element is missing a required attribute",url:"https://html-validate.org/rules/element-required-attributes.html"};return e&&(t.description=`The <${e.element}> element is required to have a "${e.attribute}" attribute.`),t}setup(){this.on("tag:end",e=>{let t=e.previous,r=t.meta;if(r?.attributes)for(let[e,n]of Object.entries(r.attributes)){if(!n.required||t.hasAttribute(e))continue;let r={element:t.tagName,attribute:e};this.report(t,`${t.annotatedName} is missing required "${e}" attribute`,t.location,r)}})}}class t8 extends eG{documentation(e){let{element:t,missing:r}=e;return{description:`The \`${t}\` element requires a \`${r}\` to be present as content.`,url:"https://html-validate.org/rules/element-required-content.html"}}setup(){this.on("dom:ready",e=>{let t=e.document;ec.depthFirst(t,e=>{if(!e.meta)return;let t=e.meta.requiredContent;if(t)for(let r of em.validateRequiredContent(e,t)){let t={element:e.annotatedName,missing:`<${r}>`},n=r.startsWith("@")?`${r.slice(1)} element`:`<${r}>`,i=`${e.annotatedName} element must have ${n} as content`;this.report(e,i,null,t)}})})}}class re extends eG{documentation(){return{description:"Assistive technology such as screen readers require textual content in headings. Whitespace only is considered empty.",url:"https://html-validate.org/rules/empty-heading.html"}}setup(){this.on("dom:ready",({document:e})=>{for(let t of e.querySelectorAll("h1,h2,h3,h4,h5,h6"))this.validateHeading(t)})}validateHeading(e){for(let t of e.querySelectorAll("img, svg"))if(t.is("img")?eF(t):!!t.is("svg")&&""!==t.textContent.trim())return;switch(e_(e,{ignoreHiddenRoot:!0})){case ej.DYNAMIC_TEXT:case ej.STATIC_TEXT:break;case ej.EMPTY_TEXT:this.report(e,`<${e.tagName}> cannot be empty, must have text content`)}}}class rt extends eG{documentation(){return{description:"The `<title>` element cannot be empty, it must have textual content.\n\nIt is used to describe the document and is shown in the browser tab and titlebar.\nWCAG and SEO requires a descriptive title and preferably unique within the site.\n\nWhitespace is ignored.",url:"https://html-validate.org/rules/empty-title.html"}}setup(){this.on("tag:end",e=>{let t=e.previous;if("title"===t.tagName)switch(e_(t)){case ej.DYNAMIC_TEXT:case ej.STATIC_TEXT:break;case ej.EMPTY_TEXT:{let e=`<${t.tagName}> cannot be empty, must have text content`;this.report(t,e,t.location)}}})}}let rr={allowArrayBrackets:!0,allowCheckboxDefault:!0,shared:["radio","button","reset","submit"]},rn=Symbol("form-elements-unique"),ri=Symbol("form-elements-shared");function ra(e){return"string"==typeof e&&""!==e}class rs extends eG{constructor(e){super({...rr,...e})}static schema(){return{allowArrayBrackets:{type:"boolean"},allowCheckboxDefault:{type:"boolean"},shared:{type:"array",items:{enum:["radio","checkbox","submit","button","reset"]}}}}documentation(e){return{description:function(e){let t="Each form control must have a unique name.",{name:r}=e;switch(e.kind){case"duplicate":return[`Duplicate form control name "${r}"`,t].join("\n");case"mix":return['Form control name cannot mix regular name "{{ name }}" with array brackets "{{ name }}[]"',t].join("\n")}}(e),url:"https://html-validate.org/rules/form-dup-name.html"}}setup(){let e=this.getSelector(),{shared:t}=this.options;this.on("dom:ready",r=>{var n,i;let{document:a}=r,[s,o]=(n=a.querySelectorAll(e),i=e=>(function(e,t){let r=e.getAttribute("type");return!!r?.valueMatches(t,!1)})(e,t),n.reduce((e,t,r)=>(e[+!i(t,r,n)].push(t),e),[[],[]]));for(let e of o){let t=e.getAttribute("name"),r=t?.value;if(!t||!ra(r))continue;let n=e.closest("form, template")??a.root;this.validateUniqueName(e,n,t,r)}for(let e of s){let t=e.getAttribute("name"),r=t?.value;if(!t||!ra(r))continue;let n=e.closest("form, template")??a.root;this.validateSharedName(e,n,t,r)}})}validateUniqueName(e,t,r,n){let i=this.getUniqueElements(t),{allowArrayBrackets:a}=this.options;if(a){let t=n.endsWith("[]"),a=t?n.slice(0,-2):n,s=i.get(a);if(s&&s.array!==t)return void this.report({node:e,location:r.valueLocation,message:'Cannot mix "{{ name }}[]" and "{{ name }}"',context:{name:a,kind:"mix"}});if(!s&&t&&i.set(a,{array:!0,potentialHiddenDefault:!1}),t)return}let s=i.get(n);if(s){if(function(e,t,r){let{allowCheckboxDefault:n}=r;return!!n&&!!t.potentialHiddenDefault&&!!(e.is("input")&&"checkbox"===e.getAttributeValue("type"))}(e,s,this.options)){s.potentialHiddenDefault=!1;return}this.report({node:e,location:r.valueLocation,message:'Duplicate form control name "{{ name }}"',context:{name:n,kind:"duplicate"}})}else i.set(n,{array:!1,potentialHiddenDefault:e.is("input")&&"hidden"===e.getAttributeValue("type")})}validateSharedName(e,t,r,n){let i=this.getUniqueElements(t),a=this.getSharedElements(t),s=e.getAttributeValue("type")??"";(i.has(n)||a.has(n)&&a.get(n)!==s)&&this.report({node:e,location:r.valueLocation,message:'Duplicate form control name "{{ name }}"',context:{name:n,kind:"duplicate"}}),a.set(n,s)}getSelector(){return this.getTagsWithProperty("formAssociated").filter(e=>this.isListedElement(e)).join(", ")}isListedElement(e){let t=this.getMetaFor(e);return!!t?.formAssociated&&t.formAssociated.listed}getUniqueElements(e){let t=e.cacheGet(rn);if(t)return t;{let t=new Map;return e.cacheSet(rn,t),t}}getSharedElements(e){let t=e.cacheGet(ri);if(t)return t;{let t=new Map;return e.cacheSet(ri,t),t}}}let ro={allowMultipleH1:!1,minInitialRank:"h1",sectioningRoots:["dialog",'[role="dialog"]','[role="alertdialog"]']};function rl(e){let t=e.target;return!!t.meta?.heading}class ru extends eG{minInitialRank;sectionRoots;stack=[];constructor(e){super({...ro,...e}),this.minInitialRank=function(e){if(!1===e||"any"===e)return 6;let t=/^h(\d)$/.exec(e);return t?parseInt(t[1],10):1}(this.options.minInitialRank),this.sectionRoots=this.options.sectioningRoots.map(e=>new Q(e)),this.stack.push({node:null,current:0,h1Count:0})}static schema(){return{allowMultipleH1:{type:"boolean"},minInitialRank:{enum:["h1","h2","h3","h4","h5","h6","any",!1]},sectioningRoots:{items:{type:"string"},type:"array"}}}documentation(){let e=[],t=this.minInitialRank>
61?"should":"must";return e.push(`Headings ${t} start at <h1> and can only increase one level at a time.`),e.push("The headings should form a table of contents and make sense on its own."),this.options.allowMultipleH1||(e.push(""),e.push("Under the current configuration only a single <h1> can be present at a time in the document.")),{description:e.join("\n"),url:"https://html-validate.org/rules/heading-level.html"}}setup(){this.on("tag:start",rl,e=>{this.onTagStart(e)}),this.on("tag:ready",e=>{this.onTagReady(e)}),this.on("tag:end",e=>{this.onTagClose(e)})}onTagStart(e){let t=function(e){let t=/^[hH](\d)$/.exec(e.tagName);return t?parseInt(t[1],10):null}(e.target);if(!t)return;let r=this.getCurrentRoot();if(!this.options.allowMultipleH1&&1===t){if(r.h1Count>=1){let t=P(e.location,1);this.report(e.target,"Multiple <h1> are not allowed",t);return}r.h1Count++}if(t<=r.current){r.current=t;return}this.checkLevelIncrementation(r,e,t),r.current=t}checkLevelIncrementation(e,t,r){let n=e.current+1;if(r===n||1===this.stack.length&&1===n&&r<=this.minInitialRank)return;let i=P(t.location,1);if(e.current>0){let e=`<h${String(n)}>`,a=`<h${String(r)}>`,s=`Heading level can only increase by one, expected ${e} but got ${a}`;this.report(t.target,s,i)}else this.checkInitialLevel(t,i,r,n)}checkInitialLevel(e,t,r,n){let i=`<h${String(n)}>`,a=`<h${String(r)}>`;if(1===this.stack.length){let r=this.minInitialRank>1?`Initial heading level must be <h${String(this.minInitialRank)}> or higher rank but got ${a}`:`Initial heading level must be ${i} but got ${a}`;this.report(e.target,r,t)}else{let s=this.getPrevRoot().current+1;if(r>s)if(n===s){let r=`Initial heading level for sectioning root must be ${i} but got ${a}`;this.report(e.target,r,t)}else{let r=`Initial heading level for sectioning root must be between ${i} and <h${String(s)}> but got ${a}`;this.report(e.target,r,t)}}}onTagReady(e){let{target:t}=e;this.isSectioningRoot(t)&&this.stack.push({node:t.unique,current:0,h1Count:0})}onTagClose(e){let{previous:t}=e,r=this.getCurrentRoot();t.unique===r.node&&this.stack.pop()}getPrevRoot(){return this.stack[this.stack.length-2]}getCurrentRoot(){return this.stack[this.stack.length-1]}isSectioningRoot(e){let t={scope:e};return this.sectionRoots.some(r=>r.match(e,t))}}let rc=Symbol(rd.name);function rd(e){let t=e.cacheGet(rc);return t||e.cacheSet(rc,function(e){if(eN(e)||eI(e)||eO(e))return!1;let{tabIndex:t,meta:r}=e;return null!==t?t>=0:!!r&&!(r.formAssociated?.disablable&&(e.matches("[disabled]")||e.closest("fieldset[disabled]")))&&!!r.focusable}(e))}class rh extends eG{documentation(e){return{description:`\`aria-hidden\` cannot be used on focusable elements.${"parent"===e?" In this case it is being hidden by an ancestor with `aria-hidden.`":""}
7
8When focusable elements are hidden with \`aria-hidden\` they are still reachable using conventional means such as a mouse or keyboard but won't be exposed to assistive technology (AT).
9This is often confusing for users of AT such as screenreaders.
10
11To fix this either:
12  - Remove \`aria-hidden\`.
13  - Remove the element from the DOM instead.
14  - Use \`tabindex="-1"\` to remove the element from tab order.
15  - Use \`hidden\`, \`inert\` or similar means to hide or disable the element.`,url:"https://html-validate.org/rules/hidden-focusable.html"}}setup(){let e=["[tabindex]",...this.getTagsWithProperty("focusable")].join(",");this.on("dom:ready",t=>{let{document:r}=t;for(let t of r.querySelectorAll(e))rd(t)&&eC(t)&&this.reportElement(t)})}reportElement(e){let t=e.getAttribute("aria-hidden"),r=t?"aria-hidden cannot be used on focusable elements":"aria-hidden cannot be used on focusable elements (hidden by ancestor element)",n=t?t.keyLocation:e.location,i=t?"self":"parent";this.report({node:e,message:r,location:n,context:i})}}let rm={pattern:"kebabcase"};class rp extends tM{constructor(e){super("id",{...rm,...e})}static schema(){return tM.schema()}documentation(e){return{description:this.description(e),url:"https://html-validate.org/rules/id-pattern.html"}}setup(){this.on("attr",e=>{let{target:t,key:r,value:n,valueLocation:i}=e;"id"!==r.toLowerCase()||n instanceof O||null!==n&&this.validateValue(t,n,i)})}}let rf=new Map([["accept",["file"]],["alt",["image"]],["capture",["file"]],["checked",["checkbox","radio"]],["dirname",["text","search"]],["height",["image"]],["list",["text","search","url","tel","email","date","month","week","time","datetime-local","number","range","color"]],["max",["date","month","week","time","datetime-local","number","range"]],["maxlength",["text","search","url","tel","email","password"]],["min",["date","month","week","time","datetime-local","number","range"]],["minlength",["text","search","url","tel","email","password"]],["multiple",["email","file"]],["pattern",["text","search","url","tel","email","password"]],["placeholder",["text","search","url","tel","email","password","number"]],["readonly",["text","search","url","tel","email","password","date","month","week","time","datetime-local","number"]],["required",["text","search","url","tel","email","password","date","month","week","time","datetime-local","number","checkbox","radio","file"]],["size",["text","search","url","tel","email","password"]],["src",["image"]],["step",["date","month","week","time","datetime-local","number","range"]],["width",["image"]]]);function rg(e){let{target:t}=e;return t.is("input")}class ry extends eG{documentation(e){let{attribute:t,type:r}=e;return{description:[`Attribute \`${t}\` is not allowed on \`<input type="${r}">\`
16`,`\`${t}\` can only be used when \`type\` is:`,...rf.get(t)?.map(e=>`- \`${e}\``)??[]].join("\n"),url:"https://html-validate.org/rules/input-attributes.html"}}setup(){this.on("tag:ready",rg,e=>{let{target:t}=e,r=t.getAttribute("type");if(!r||r.isDynamic||!r.value)return;let n=r.value.toString();for(let e of t.attributes){let r=rf.get(e.key);if(!r||r.includes(n))continue;let i={attribute:e.key,type:n},a=`Attribute "${e.key}" is not allowed on <input type="${n}">`;this.report(t,a,e.keyLocation,i)}})}}let rb=Symbol(rv.name);function rv(e,t){if(t.cacheExists(rb))return!!t.cacheGet(rb);let r=function e(t,r){let{reference:n}=r;if(function(e,t){let{reference:r}=t;return!r?.isSameNode(e)&&!eS(e)}(t,r))return!1;let i=!!n?.isSameNode(t);return!!(e_(t,{accessible:!0,ignoreHiddenRoot:i})!==ej.EMPTY_TEXT||function(t,r){if(t.is("img"))return eF(t);if(t.is("svg"))return""!==t.textContent.trim();for(let n of t.querySelectorAll("img, svg"))if(e(n,r))return!0;return!1}
16(t,r))||!!((t.getAttributeValue("aria-label")??"").trim()||function(t,r){let{document:n,reference:i}=r;if(i)return!1;let a=t.ariaLabelledby;return a instanceof O||null!==a&&a.some(t=>{let r=et(t);return n.querySelectorAll(r).some(t=>e(t,{document:n,reference:t}))})}(t,r))}(t,{document:e,reference:null});return t.cacheSet(rb,r)}class rw extends eG{documentation(){return{description:'Each form element must have an a label or accessible name.\nTypically this is implemented using a `<label for="..">` element describing the purpose of the form element.\n\nThis can be resolved in one of the following ways:\n\n  - Use an associated `<label for="..">` element.\n  - Use a nested `<label>` as parent element.\n  - Use `aria-label` or `aria-labelledby` attributes.',url:"https://html-validate.org/rules/input-missing-label.html"}}setup(){this.on("dom:ready",e=>{let t=e.document;for(let e of t.querySelectorAll("input, textarea, select"))this.validateInput(t,e)})}validateInput(e,t){var r,n;if(!eS(t)||function(e){if(e.is("input")){let t=e.getAttributeValue("type")?.toLowerCase();return!!(t&&["hidden","submit","reset","button"].includes(t))}return!1}(t)||rv(e,t))return;let i=[];if((r=e,i=(n=t.id)?r.querySelectorAll(`label[for="${n}"]`):[]).length>0||(i=function(e){let t=e.parent;for(;t;){if(t.is("label"))return[t];t=t.parent}return[]}(t)).length>0)return void this.validateLabel(e,t,i);t.hasAttribute("aria-label")?this.report(t,`<${t.tagName}> element has aria-label but label has no text`):t.hasAttribute("aria-labelledby")?this.report(t,`<${t.tagName}> element has aria-labelledby but referenced element has no text`):this.report(t,`<${t.tagName}> element does not have a <label>`)}validateLabel(e,t,r){if(0===r.filter(eS).length)return void this.report(t,`<${t.tagName}> element has <label> but <label> element is hidden`);r.some(t=>rv(e,t))||this.report(t,`<${t.tagName}> element has <label> but <label> has no text`)}}let rx={maxlength:70};class rA extends eG{maxlength;constructor(e){super({...rx,...e}),this.maxlength=this.options.maxlength}static schema(){return{maxlength:{type:"number"}}}documentation(){return{description:"Search engines truncates titles with long text, possibly down-ranking the page in the process.",url:"https://html-validate.org/rules/long-title.html"}}setup(){this.on("tag:end",e=>{let t=e.previous;"title"===t.tagName&&t.textContent.length>this.maxlength&&this.report(t,`title text cannot be longer than ${String(this.maxlength)} characters`)})}}let rE={allowLongDelay:!1};class rT extends eG{constructor(e){super({...rE,...e})}documentation(){return{description:"Meta refresh directive must use the `0;url=...` format. Non-zero values for time interval is disallowed as people with assistive technology might be unable to read and understand the page content before automatically reloading. For the same reason skipping the url is disallowed as it would put the browser in an infinite loop reloading the same page over and over again.",url:"https://html-validate.org/rules/meta-refresh.html"}}setup(){this.on("element:ready",({target:e})=>{if(!e.is("meta")||"refresh"!==e.getAttributeValue("http-equiv"))return;let t=e.getAttribute("content");if(!t?.value||t.isDynamic)return;let r=t.valueLocation,n=function(e){let t=/^(\d+)(?:\s*;\s*url=(.*))?/i.exec(e);return t?{delay:parseInt(t[1],10),url:t[2]}:null}(t.value.toString());if(!n)return void this.report(e,"Malformed meta refresh directive",r);let{delay:i,url:a}=n;this.validateDelay(e,r,i,a)})}validateDelay(e,t,r,n){let{allowLongDelay:i}=this.options;if(!i||!(r>72e3)){if(!n&&0===r)return void this.report(e,"Don't use instant meta refresh to reload the page",t);0!==r&&this.report(e,i?"Meta refresh must be instant (0 second delay) or greater than 20 hours (72000 second delay)":"Meta refresh must be instant (0 second delay)",t)}}}class r$ extends eG{documentation(){return{description:"`<map>` must have a unique name, it cannot be the same name as another `<map>` element",url:"https://html-validate.org/rules/map-dup-name.html"}}setup(){this.on("dom:ready",e=>{let{document:t}=e,r=t.querySelectorAll("map[name]"),n=new Set;for(let e of r){let t=e.getAttribute("name");if(!t)continue;let r=function(e){let t=e.value;return!t||t instanceof O?null:t}(t);r&&(n.has(r)&&this.report({node:e,message:"<map> name must be unique",location:t.keyLocation}),n.add(r))}})}}function rk(e){return e.target.is("map")}function rS(e){return!!(e&&!(e.value instanceof O))}class rC extends eG{documentation(){return{description:"When the `id` attribute is present on a `<map>` element it must be equal to the `name` attribute.",url:"https://html-validate.org/rules/map-id-name.html"}}setup(){this.on("tag:ready",rk,e=>{let{target:t}=e,r=t.getAttribute("id"),n=t.getAttribute("name");rS(r)&&rS(n)&&r.value!==n.value&&this.report({node:e.target,message:'"id" and "name" attribute must be the same on <map> elements',location:r.valueLocation??n.valueLocation})})}}class rN extends eG{documentation(){return{description:"Requires that the document contains a doctype.",url:"https://html-validate.org/rules/missing-doctype.html"}}setup(){this.on("dom:ready",e=>{let t=e.document;t.doctype||this.report(t.root,"Document is missing doctype")})}}class rI extends eG{labelable="";documentation(){return{description:"A `<label>` element can only be associated with one control at a time.",url:"https://html-validate.org/rules/multiple-labeled-controls.html"}}setup(){this.labelable=this.getTagsWithProperty("labelable").join(","),this.on("dom:ready",e=>{let{document:t}=e;for(let e of t.querySelectorAll("label"))1>=this.getNumLabledControls(e)||this.report(e,"<label> is associated with multiple controls",e.location)})}getNumLabledControls(e){let t=e.querySelectorAll(this.labelable).filter(e=>e.meta?.labelable).map(e=>e.id),r=e.getAttribute("for");return!r||r.isDynamic||!r.value||t.includes(r.value.toString())?t.length:t.length+1}}let rO={pattern:"camelcase"};class rL extends tM{constructor(e){super("name",{...rO,...e})}static schema(){return tM.schema()}documentation(e){return{description:this.description(e),url:"https://html-validate.org/rules/name-pattern.html"}}setup(){this.on("attr",e=>{let{target:t,key:r,value:n,valueLocation:i}=e,{meta:a}=t;if(!a?.formAssociated?.listed||"name"!==r.toLowerCase()||n instanceof O||null===n)return;let s=n.endsWith("[]")?n.slice(0,-2):n;this.validateValue(t,s,i)})}}let rR=["command","composite","input","landmark","range","roletype","section","sectionhead","select","structure","widget","window"];function rP(e){return"role"===e.key}class rq extends eG{documentation(e){return{description:[`Role \`"${e.role}"\` is abstract and must not be used.`,"","WAI-ARIA defines a list of [abstract roles](https://www.w3.org/TR/wai-aria-1.2/#abstract_roles) which cannot be used by authors:","",...rR.map(e=>`- \`"${e}"\``),"",`Use one of the defined subclass roles for \`"${e.role}"\` instead.`].join("\n"),url:"https://html-validate.org/rules/no-abstract-role.html"}}setup(){this.on("attr",rP,e=>{let t=e.value;if(t&&!(t instanceof O))for(let{item:r,location:n}of new G(t,e.valueLocation).iterator())rR.includes(r)&&this.report({node:e.target,message:'Role "{{ role }}" is abstract and must not be used',location:n,context:{role:r}})})}}let rD={include:null,exclude:null};class rM extends eG{constructor(e){super({...rD,...e})}documentation(e){return{description:`The autoplay attribute is not allowed on <${e.tagName}>.
17Autoplaying content can be disruptive for users and has accessibilty concerns.
18Prefer to let the user control playback.`,url:"https://html-validate.org/rules/no-autoplay.html"}}static schema(){return{exclude:{anyOf:[{items:{type:"string"},type:"array"},{type:"null"}]},include:{anyOf:[{items:{type:"string"},type:"array"},{type:"null"}]}}}setup(){this.on("attr",e=>{if("autoplay"!==e.key.toLowerCase()||e.value&&e.value instanceof O)return;let t=e.target.tagName;if(this.isKeywordIgnored(t))return;let r=e.location;this.report(e.target,`The autoplay attribute is not allowed on <${t}>`,r,{tagName:t})})}}class rj extends eG{documentation(){return{description:"Microsoft Internet Explorer previously supported using special HTML comments (conditional comments) for targeting specific versions of IE but since IE 10 it is deprecated and not supported in standards mode.",url:"https://html-validate.org/rules/no-conditional-comment.html"}}setup(){this.on("conditional",e=>{this.report(e.parent,"Use of conditional comments are deprecated",e.location)})}}class r_ extends eG{documentation(){return{description:"HTML5 deprecated many old attributes.",url:"https://html-validate.org/rules/no-deprecated-attr.html"}}setup(){this.on("attr",e=>{let t=e.target,r=t.meta,n=e.key.toLowerCase();if(null===r)return;let i=r.attributes[n];i&&i.deprecated&&this.report(t,`Attribute "${e.key}" is deprecated on <${t.tagName}> element`,e.keyLocation)})}}class rF extends eG{documentation(){return{description:"HTML disallows two or more attributes with the same (case-insensitive) name.",url:"https://html-validate.org/rules/no-dup-attr.html"}}setup(){let e={};this.on("tag:start",()=>{e={}}),this.on("attr",t=>{if(t.originalAttribute)return;let r=t.key.toLowerCase();r in e&&this.report(t.target,`Attribute "${r}" duplicated`,t.keyLocation),e[t.key]=!0})}}class rz extends eG{documentation(){return{description:"Prevents unnecessary duplication of class names.",url:"https://html-validate.org/rules/no-dup-class.html"}}setup(){this.on("attr",e=>{if("class"!==e.key.toLowerCase())return;let t=new G(e.value,e.valueLocation),r=new Set;t.forEach((n,i)=>{if(r.has(n)){let r=t.location(i);this.report(e.target,`Class "${n}" duplicated`,r)}r.add(n)})})}}let rU=Symbol("no-dup-id");class rG extends eG{documentation(){return{description:"The ID of an element must be unique.",url:"https://html-validate.org/rules/no-dup-id.html"}}setup(){this.on("dom:ready",e=>{let{document:t}=e,r=rB(t.root,t.root),n=!t.querySelector("template");for(let e of t.querySelectorAll("[id]")){let i=e.getAttribute("id");if(!i||!i.value||i.isDynamic)continue;let a=i.value.toString(),s=n?r:rB(e,t.root);if(s.has(a)){this.report(e,`Duplicate ID "${a}"`,i.valueLocation);continue}s.add(a)}})}}function rB(e,t){let r=e.closest("template")??t,n=r.cacheGet(rU);if(n)return n;{let e=new Set;return r.cacheSet(rU,e)}}function rV(e){return e.target.is("button")}class rW extends eG{documentation(){return{description:"`<button>` is missing recommended `type` attribute\n\nWhen the `type` attribute is omitted it defaults to `submit`.\nSubmit buttons are triggered when a keyboard user presses <kbd>Enter</kbd>.\n\nAs this may or may not be inteded this rule enforces that the `type` attribute be explicitly set to one of the valid types:\n\n- `button` - a generic button.\n- `submit` - a submit button.\n- `reset`- a button to reset form fields.",url:"https://html-validate.org/rules/no-implicit-button-type.html"}}setup(){this.on("element:ready",rV,e=>{let{target:t}=e;t.getAttribute("type")||this.report({node:e.target,message:'<button> is missing recommended "type" attribute'})})}}function rH(e){return e.target.is("input")}class rX extends eG{documentation(){return{description:"`<input>` is missing recommended `type` attribute",url:"https://html-validate.org/rules/no-implicit-input-type.html"}}setup(){this.on("element:ready",rH,e=>{let{target:t}=e;t.getAttribute("type")||this.report({node:e.target,message:'<input> is missing recommended "type" attribute'})})}}class rY extends eG{documentation(){return{description:`Some elements in HTML has optional end tags. When an optional tag is omitted a browser must handle it as if the end tag was present.
19
20Omitted end tags can be ambigious for humans to read and many editors have trouble formatting the markup.`,url:"https://html-validate.org/rules/no-implicit-close.html"}}setup(){this.on("tag:end",e=>{let t=e.previous,r=e.target;if(!r||t.closed!==eo.ImplicitClosed)return;let n=t.parent,i=n&&n.tagName===r.tagName,a=i&&n.isRootElement(),s=t.tagName===r.tagName;a?this.report(t,`Element <${t.tagName}> is implicitly closed by document ending`,t.location):i?this.report(t,`Element <${t.tagName}> is implicitly closed by parent </${r.tagName}>`,t.location):s?this.report(t,`Element <${t.tagName}> is implicitly closed by sibling`,t.location):this.report(t,`Element <${t.tagName}> is implicitly closed by adjacent <${r.tagName}>`,t.location)})}}let rJ={include:null,exclude:null,allowedProperties:["display"]};class rK extends eG{constructor(e){super({...rJ,...e})}static schema(){return{exclude:{anyOf:[{items:{type:"string"},type:"array"},{type:"null"}]},include:{anyOf:[{items:{type:"string"},type:"array"},{type:"null"}]},allowedProperties:{items:{type:"string"},type:"array"}}}documentation(){let e=["Inline style is not allowed.\n","Inline style is a sign of unstructured CSS. Use class or ID with a separate stylesheet.\n"];return this.options.allowedProperties.length>0&&(e.push("Under the current configuration the following CSS properties are allowed:\n"),e.push(this.options.allowedProperties.map(e=>`- \`${e}\``).join("\n"))),{description:e.join("\n"),url:"https://html-validate.org/rules/no-inline-style.html"}}setup(){this.on("attr",e=>this.isRelevant(e),e=>{let{value:t}=e;this.allPropertiesAllowed(t)||this.report(e.target,"Inline style is not allowed")})}isRelevant(e){if("style"!==e.key)return!1;let{include:t,exclude:r}=this.options,n=e.originalAttribute??e.key;return!(t&&!t.includes(n)||r?.includes(n))}allPropertiesAllowed(e){let t=this.options.allowedProperties;if(0===t.length)return!1;let r=Object.keys(R(e));return r.length>0&&r.every(e=>t.includes(e))}}let rZ=[{property:"aria-activedescendant",isList:!1},{property:"aria-controls",isList:!0},{property:"aria-describedby",isList:!0},{property:"aria-details",isList:!1},{property:"aria-errormessage",isList:!1},{property:"aria-flowto",isList:!0},{property:"aria-labelledby",isList:!0},{property:"aria-owns",isList:!0}];function rQ(e,t){return 0===e.querySelectorAll(et(t)).length}class r0 extends eG{documentation(e){return{description:`The element ID "${e.value}" referenced by the ${e.key} attribute must point to an existing element.`,url:"https://html-validate.org/rules/no-missing-references.html"}}setup(){this.on("dom:ready",e=>{let t=e.document;for(let e of t.querySelectorAll("label[for]")){let r=e.getAttribute("for");this.validateReference(t,e,r,!1)}for(let e of t.querySelectorAll("input[list]")){let r=e.getAttribute("list");this.validateReference(t,e,r,!1)}for(let{property:e,isList:r}of rZ)for(let n of t.querySelectorAll(`[${e}]`)){let i=n.getAttribute(e);this.validateReference(t,n,i,r)}})}validateReference(e,t,r,n){if(!r)return;let i=r.value;
20i instanceof O||null===i||""===i||(n?this.validateList(e,t,r,i):this.validateSingle(e,t,r,i))}validateSingle(e,t,r,n){if(rQ(e,n)){let e={key:r.key,value:n};this.report(t,`Element references missing id "${n}"`,r.valueLocation,e)}}validateList(e,t,r,n){for(let i of new G(n,r.valueLocation).iterator()){let n=i.item;if(rQ(e,n)){let e={key:r.key,value:n};this.report(t,`Element references missing id "${n}"`,i.location,e)}}}}class r1 extends eG{documentation(){return{description:"Only a single visible `<main>` element can be present at in a document at a time.\n\nMultiple `<main>` can be present in the DOM as long the others are hidden using the HTML5 `hidden` attribute.",url:"https://html-validate.org/rules/no-multiple-main.html"}}setup(){this.on("dom:ready",e=>{let{document:t}=e,r=t.querySelectorAll("main").filter(e=>!e.hasAttribute("hidden"));for(let e of(r.shift(),r))this.report(e,"Multiple <main> elements present in document")})}}let r2={relaxed:!1},r3=/([<>]|&(?![a-zA-Z0-9#]+;))/g,r9=/([<>"'=`]|&(?![a-zA-Z0-9#]+;))/g,r6=/^(<%.*?%>|<\?.*?\?>|<\$.*?\$>)$/s,r5={'"':"&quot;","&":"&amp;","'":"&apos;","<":"&lt;","=":"&equals;",">":"&gt;","`":"&grave;"};class r7 extends eG{relaxed;constructor(e){super({...r2,...e}),this.relaxed=this.options.relaxed}static schema(){return{relaxed:{type:"boolean"}}}documentation(){return{description:"Some characters such as `<`, `>` and `&` hold special meaning in HTML and must be escaped using a character reference (html entity).",url:"https://html-validate.org/rules/no-raw-characters.html"}}setup(){this.on("element:ready",e=>{let t=e.target;for(let e of t.childNodes)e.nodeType===_.TEXT_NODE&&(r6.exec(e.textContent)||this.findRawChars(t,e.textContent,e.location,r3))}),this.on("attr",e=>{let{meta:t}=e;e.value&&!e.quote&&(t?.boolean||this.findRawChars(e.target,e.value.toString(),e.valueLocation,r9))})}findRawChars(e,t,r,n){let i;do if(i=n.exec(t)){let t=i[0];if(this.relaxed&&"&"===t)continue;let n=r5[t],a=P(r,i.index,i.index+1);this.report(e,`Raw "${t}" must be encoded as "${n}"`,a)}while(i)}}let r4=["input[aria-label]","textarea[aria-label]","select[aria-label]"];class r8 extends eG{documentation(){return{description:"`aria-label` is redundant when an associated `<label>` element containing the same text exists.",url:"https://html-validate.org/rules/no-redundant-aria-label.html"}}setup(){this.on("dom:ready",e=>{let{document:t}=e;for(let e of t.querySelectorAll(r4.join(","))){let r=e.getAttribute("aria-label"),n=e.id;if(!n)continue;let i=t.querySelector(`label[for="${n}"]`);r&&i&&i.textContent.trim()===r.value&&this.report({message:"aria-label is redundant when label containing same text exists",node:e,location:r.keyLocation})}})}}class ne extends eG{documentation(){return{description:"When the `<label>` element wraps the labelable control the `for` attribute is redundant and better left out.",url:"https://html-validate.org/rules/no-redundant-for.html"}}setup(){this.on("element:ready",e=>{let{target:t}=e;if("label"!==t.tagName)return;let r=t.getAttribute("for");if(!r||!r?.isStatic)return;let n=r.value;n&&t.querySelector(et(n))&&this.report(t,'Redundant "for" attribute',r.keyLocation)})}}class nt extends eG{documentation(e){let{role:t,tagName:r}=e;return{description:`Using the \`${t}\` role is redundant as it is already implied by the \`<${r}>\` element.`,url:"https://html-validate.org/rules/no-redundant-role.html"}}setup(){this.on("tag:ready",e=>{let{target:t}=e,r=t.getAttribute("role");if(!r?.value||r.value instanceof O)return;let{meta:n}=t;if(!n)return;let i=n.aria.implicitRole(t._adapter);if(!i||r.value!==i)return;let a={tagName:t.tagName,role:r.value};this.report(e.target,`Redundant role "${r.value}" on <${t.tagName}>`,r.valueLocation,a)})}}let nr=/^(.+):.+$/,nn={ignoreForeign:!0,ignoreXML:!0};class ni extends eG{constructor(e){super({...nn,...e})}static schema(){return{ignoreForeign:{type:"boolean"},ignoreXML:{type:"boolean"}}}documentation(e){return e=e||"element",{description:`Self-closing elements are disallowed. Use regular end tag <${e}></${e}> instead of self-closing <${e}/>.`,url:"https://html-validate.org/rules/no-self-closing.html"}}setup(){this.on("tag:end",e=>{var t,r;let n=e.previous;
20t=n,r=this.options,(nr.exec(t.tagName)?r.ignoreXML:t.meta&&(t.meta.void||t.meta.foreign&&r.ignoreForeign))||this.validateElement(n)})}validateElement(e){e.closed===eo.VoidSelfClosed&&this.report(e,`<${e.tagName}> must not be self-closed`,null,e.tagName)}}class na extends eG{documentation(){return{description:"Prefer to use external stylesheets with the `<link>` tag instead of inlining the styling.",url:"https://html-validate.org/rules/no-style-tag.html"}}setup(){this.on("tag:start",e=>{let t=e.target;"style"===t.tagName&&this.report(t,"Use external stylesheet with <link> instead of <style> tag")})}}class ns extends eG{documentation(){return{description:"Lines with trailing whitespace cause unnessecary diff when using version control and usually serve no special purpose in HTML.",url:"https://html-validate.org/rules/no-trailing-whitespace.html"}}setup(){this.on("whitespace",e=>{/^[ \t]+\r?\n$/.exec(e.text)&&this.report(null,"Trailing whitespace",e.location)})}}let no={include:null,exclude:null};class nl extends eG{constructor(e){super({...no,...e})}static schema(){return{exclude:{anyOf:[{items:{type:"string"},type:"array"},{type:"null"}]},include:{anyOf:[{items:{type:"string"},type:"array"},{type:"null"}]}}}documentation(e){let t=e?` <${e}>`:"";return{description:`An unknown element${t} was used. If this is a Custom Element you need to supply element metadata for it.`,url:"https://html-validate.org/rules/no-unknown-elements.html"}}setup(){this.on("tag:start",e=>{let t=e.target;!t.meta&&(this.isKeywordIgnored(t.tagName,ex)||this.report(t,`Unknown element <${t.tagName}>`,null,t.tagName))})}}class nu extends eG{documentation(e){return{description:`\`${e.ruleId}\` rule is disabled but no error was reported.`,url:"https://html-validate.org/rules/no-unused-disable.html"}}setup(){}reportUnused(e,t,r){let n=new G(t.replace(/,/g," "),r);for(let t of e){let e=n.indexOf(t),i=e>=0?n.location(e):r;this.report({node:null,message:'"{{ ruleId }}" rule is disabled but no error was reported',location:i,context:{ruleId:t}})}}}class nc extends eG{documentation(){return{description:`This file is saved with the UTF-8 byte order mark (BOM) present. It is neither required or recommended to use.
21
22Instead the document should be served with the \`Content-Type: application/javascript; charset=utf-8\` header.`,url:"https://html-validate.org/rules/no-utf8-bom.html"}}setup(){let e=this.on("token",t=>{t.type===e7.UNICODE_BOM&&this.report(null,"File should be saved without UTF-8 BOM",t.location),this.setEnabled(!1),e()})}}let nd=["button","submit","reset","image"],nh={button:'<button type="button">',submit:'<button type="submit">',reset:'<button type="reset">',image:'<button type="button">'},nm={include:null,exclude:null};class np extends eG{constructor(e){super({...nm,...e})}static schema(){return{exclude:{anyOf:[{items:{type:"string"},type:"array"},{type:"null"}]},include:{anyOf:[{items:{type:"string"},type:"array"},{type:"null"}]}}}documentation(e){let t=`<input type="${e.type}">`,r=nh[e.type]||"<button>";return{description:`Prefer to use \`${r}\` instead of \`"${t}\`.`,url:"https://html-validate.org/rules/prefer-button.html"}}setup(){this.on("attr",e=>{let t=e.target;if("input"!==t.tagName.toLowerCase()||"type"!==e.key.toLowerCase()||!e.value||e.value instanceof O)return;let r=e.value.toLowerCase();if(this.isKeywordIgnored(r)||!nd.includes(r))return;let n=`Prefer to use <button> instead of <input type="${r}"> when adding buttons`;this.report(t,n,e.valueLocation,{type:r})})}}let nf={mapping:{article:"article",banner:"header",button:"button",cell:"td",checkbox:"input",complementary:"aside",contentinfo:"footer",figure:"figure",form:"form",heading:"hN",input:"input",link:"a",list:"ul",listbox:"select",listitem:"li",main:"main",navigation:"nav",progressbar:"progress",radio:"input",region:"section",table:"table",textbox:"textarea"},include:null,exclude:null};class ng extends eG{constructor(e){super({...nf,...e})}static schema(){return{exclude:{anyOf:[{items:{type:"string"},type:"array"},{type:"null"}]},include:{anyOf:[{items:{type:"string"},type:"array"},{type:"null"}]},mapping:{type:"object"}}}documentation(e){return{description:`Instead of using the WAI-ARIA role "${e.role}" prefer to use the native <${e.replacement}> element.`,url:"https://html-validate.org/rules/prefer-native-element.html"}}setup(){let{mapping:e}=this.options;this.on("attr",t=>{if("role"!==t.key.toLowerCase()||!t.value||t.value instanceof O)return;let r=t.value.toLowerCase();if(this.isIgnored(r))return;let n=e[r];if(t.target.is(n))return;let i=this.getLocation(t);this.report(t.target,`Prefer to use the native <${n}> element`,i,{role:r,replacement:n})})}isIgnored(e){let{mapping:t}=this.options;return!t[e]||this.isKeywordIgnored(e)}getLocation(e){let t=e.location,r=e.valueLocation,n=+!!e.quote,i=r.offset+r.size-t.offset+n;return{filename:t.filename,line:t.line,column:t.column,offset:t.offset,size:i}}}class ny extends eG{documentation(){return{description:"While `<tbody>` is optional is relays semantic information about its contents. Where applicable it should also be c
22ombined with `<thead>` and `<tfoot>`.",url:"https://html-validate.org/rules/prefer-tbody.html"}}setup(){this.on("dom:ready",e=>{for(let t of e.document.querySelectorAll("table")){if(t.querySelector("> tbody"))continue;let e=t.querySelectorAll("> tr");e.length>=1&&this.report(e[0],"Prefer to wrap <tr> elements in <tbody>")}})}}let nb={tags:["script","style"]};class nv extends eG{constructor(e){super({...nb,...e})}static schema(){return{tags:{type:"array",items:{enum:["script","style"],type:"string"}}}}documentation(){return{description:"Required Content-Security-Policy (CSP) nonce is missing or empty.\n\nThis is set by the `nonce` attribute and must match the `Content-Security-Policy` header.\nFor instance, if the header contains `script-src 'nonce-r4nd0m'` the `nonce` attribute must be set to `nonce=\"r4nd0m\">`\n\nThe nonce should be unique per each request and set to a cryptography secure random token.\nIt is used to prevent cross site scripting (XSS) by preventing malicious actors from injecting scripts onto the page.",url:"https://html-validate.org/rules/require-csp-nonce.html"}}setup(){this.on("tag:end",e=>{let{tags:t}=this.options,r=e.previous;if(!t.includes(r.tagName))return;let n=r.getAttribute("nonce")?.value;n&&""!==n||r.is("script")&&r.hasAttribute("src")||this.report(r,"required CSP nonce is missing",r.location)})}}let nw={target:"all",include:null,exclude:null},nx=RegExp("^(\\w+://|//)"),nA={link:"href",script:"src"},nE=["stylesheet","preload","modulepreload"],nT=["style","script"];class n$ extends eG{target;constructor(e){super({...nw,...e}),this.target=this.options.target}static schema(){return{target:{enum:["all","crossorigin"],type:"string"},include:{anyOf:[{items:{type:"string"},type:"array"},{type:"null"}]},exclude:{anyOf:[{items:{type:"string"},type:"array"},{type:"null"}]}}}documentation(){return{description:"Subresource Integrity (SRI) `integrity` attribute is required to prevent tampering or manipulation from Content Delivery Networks (CDN), rouge proxies,  malicious entities, etc.",url:"https://html-validate.org/rules/require-sri.html"}}setup(){this.on("tag:end",e=>{let t=e.previous;this.supportSri(t)&&this.needSri(t)&&(t.hasAttribute("integrity")||this.report(t,`SRI "integrity" attribute is required on <${t.tagName}> element`,t.location))})}supportSri(e){return Object.keys(nA).includes(e.tagName)}needSri(e){if(e.is("link")&&!function(e){let t=e.getAttribute("rel");if("string"!=typeof t?.value||!nE.includes(t.value))return!1;if("preload"===t.value){let t=e.getAttribute("as");return"string"==typeof t?.value&&nT.includes(t.value)}return!0}(e))return!1;let t=this.elementSourceAttr(e);if(!t||null===t.value||""===t.value||t.isDynamic)return!1;let r=t.value.toString();return!!("all"===this.target||nx.test(r))&&!this.isIgnored(r)}elementSourceAttr(e){let t=nA[e.tagName];return e.getAttribute(t)}isIgnored(e){return this.isKeywordIgnored(e,(e,t)=>e.some(e=>t.includes(e)))}}class nk extends eG{documentation(){return{description:"The end tag for `<script>` is a hard requirement and must never be omitted even when using the `src` attribute.",url:"https://html-validate.org/rules/script-element.html"}}setup(){this.on("tag:end",e=>{let t=e.target;t&&"script"===t.tagName&&t.closed!==eo.EndTag&&this.report(t,`End tag for <${t.tagName}> must not be omitted`)})}}let nS=["","application/ecmascript","application/javascript","text/ecmascript","text/javascript"];class nC extends eG{documentation(){return{description:"While valid the HTML5 standard encourages authors to omit the type element for JavaScript resources.",url:"https://html-validate.org/rules/script-type.html"}}setup(){this.on("tag:end",e=>{let t=e.previous;if("script"!==t.tagName)return;let r=t.getAttribute("type");if(!r||r.isDynamic)return;let n=r.value?r.value.toString():"";this.isJavascript(n)&&this.report(t,'"type" attribute is unnecessary for javascript resources',r.keyLocation)})}isJavascript(e){let t=e.replace(/;.*/,"");return nS.includes(t)}}class nN extends eG{documentation(){return{description:"Inline SVG elements in IE are focusable by default which may cause issues with tab-ordering. The `focusable` attribute should explicitly be set to avoid unintended behaviour.",url:"https://html-validate.org/rules/svg-focusable.html"}}setup(){this.on("element:ready",e=>{e.target.is("svg")&&this.validate(e.target)})}validate(e){e.hasAttribute("focusable")||this.report(e,`<${e.tagName}> is missing required "focusable" attribute`)}}let nI={characters:[{pattern:" ",replacement:"&nbsp;",description:"non-breaking space"},{pattern:"-",replacement:"&#8209;",description:"non-breaking hyphen"}],ignoreClasses:[],ignoreStyle:!0};
22class nO extends eG{regex;constructor(e){super({...nI,...e}),this.regex=function(e){let t=e.map(e=>e.pattern).join("|");return RegExp(`(${t})`,"g")}(this.options.characters)}static schema(){return{characters:{type:"array",items:{type:"object",additionalProperties:!1,properties:{pattern:{type:"string"},replacement:{type:"string"},description:{type:"string"}}}},ignoreClasses:{type:"array",items:{type:"string"}},ignoreStyle:{type:"boolean"}}}documentation(e){let{characters:t}=this.options,r=t.map(e=>`  - \`${e.pattern}\` - replace with \`${e.replacement}\` (${e.description}).`);return{description:[`The \`${e.pattern}\` character should be replaced with \`${e.replacement}\` character (${e.description}) when used in a telephone number.`,"","Unless non-breaking characters is used there could be a line break inserted at that character.","Line breaks make is harder to read and understand the telephone number.","","The following characters should be avoided:","",...r].join("\n"),url:"https://html-validate.org/rules/tel-non-breaking.html"}}setup(){this.on("element:ready",this.isRelevant,e=>{let{target:t}=e;this.isIgnored(t)||this.walk(t,t)})}isRelevant(e){let{target:t}=e;if(!t.is("a"))return!1;let r=t.getAttribute("href");return!!r?.valueMatches(/^tel:/,!1)}isIgnoredClass(e){let{ignoreClasses:t}=this.options,{classList:r}=e;return t.some(e=>r.contains(e))}isIgnoredStyle(e){let{ignoreStyle:t}=this.options,{style:r}=e;return!!t&&("nowrap"===r["white-space"]||"pre"===r["white-space"])}isIgnored(e){return this.isIgnoredClass(e)||this.isIgnoredStyle(e)}walk(e,t){for(let r of t.childNodes)en(r)?this.detectDisallowed(e,r):el(r)&&this.walk(e,r)}detectDisallowed(e,t){let[r,n]=function(e){let[,t,r]=/^(\s*)(.*)$/.exec(e.textContent);return[t.length,r.trimEnd()]}(t);for(let i of function(e,t){let r,n=new RegExp(t),i=[];for(;r=n.exec(e);)i.push(r);return i}(n,this.regex)){let a=i[0],s=this.options.characters.find(e=>e.pattern===a);if(!s)throw Error(`Failed to find entry for "${a}" when searching text "${n}"`);let o=`"${a}" should be replaced with "${s.replacement}" (${s.description}) in telephone number`,l=r+i.index,u=l+a.length,c=P(t.location,l,u);this.report(e,o,c,s)}}}function nL(e,t){let r=e.getAttribute(t);return!!r?.valueMatches(/.+/,!0)}class nR extends eG{documentation(e){let t={description:"The textual content for this element is not valid.",url:"https://html-validate.org/rules/text-content.html"};switch(e.textContent){case E.NONE:t.description=`The \`<${e.tagName}>\` element must not have textual content.`;break;case E.REQUIRED:t.description=`The \`<${e.tagName}>\` element must have textual content.`;break;case E.ACCESSIBLE:t.description=`The \`<${e.tagName}>\` element must have accessible text.`}return t}static filter(e){let{target:t}=e;if(!t.meta)return!1;let{textContent:r}=t.meta;return!!r&&r!==E.DEFAULT}setup(){this.on("element:ready",nR.filter,e=>{let t=e.target,{textContent:r}=t.meta;switch(r){case E.NONE:this.validateNone(t);break;case E.REQUIRED:this.validateRequired(t);break;case E.ACCESSIBLE:this.validateAccessible(t)}})}validateNone(e){e_(e)!==ej.EMPTY_TEXT&&this.reportError(e,e.meta,`${e.annotatedName} must not have text content`)}validateRequired(e){e_(e)===ej.EMPTY_TEXT&&this.reportError(e,e.meta,`${e.annotatedName} must have text content`)}validateAccessible(e){eS(e)&&!function e(t){return!!eS(t)&&(!!(t.childNodes.some(e=>!!en(e)&&(e.isDynamic||""!==e.textContent.trim()))||nL(t,"aria-label")||nL(t,"aria-labelledby")||t.is("img")&&nL(t,"alt")||function(e){if(!e.is("input")||e.hasAttribute("value"))return!1;let t=e.getAttribute("type");return!!t?.valueMatches(/submit|reset/,!1)}(t))||t.childElements.some(t=>e(t)))}(e)&&this.reportError(e,e.meta,`${e.annotatedName} must have accessible text`)}reportError(e,t,r){this.report(e,r,null,{tagName:e.tagName,textContent:t.textContent})}}let nP=["complementary","contentinfo","form","banner","main","navigation","region"],nq=["aside","footer","form","header","main","nav","section",...nP.map(e=>`[role="${e}"]`)];function nD(e){let{node:t,text:r}=e;return null!==r||!(t.is("form")||t.is("section"))}class nM extends eG{documentation(){return{description:'When the same type of landmark is present more than once in the same document each must be uniquely identifiable with a non-empty and unique name.\nFor instance, if the document has two `<nav>` elements each of them need an accessible name to be distinguished from each other.\n\nThe following elements / roles are considered landmarks:\n\n  - `aside` or `[role="complementary"]`\n  - `footer` or `[role="contentinfo"]`\n  - `form` or `[role="form"]`\n  - `header` or `[role="banner"]`\n  - `main` or `[role="main"]`\n  - `nav` or `[role="navigation"]`\n  - `section` or `[role="region"]`\n\nTo fix this either:\n\n  - Add `aria-label`.\n  - Add `aria-labelledby`.\n  - Remove one of the landmarks.',url:"https://html-validate.org/rules/unique-landmark.html"}}setup(){this.on("dom:ready",e=>{let{document:t}=e;for(let e of Object.values(function(e,t){let r={};for(let n of e){let e=t(n);e in r?r[e].push(n):r[e]=[n]}return r}(t.querySelectorAll(nq.join(",")).filter(e=>"string"==typeof e.role&&nP.includes(e.role)),e=>
22e.role))){if(e.length<=1)continue;let r=e.map(e=>(function(e,t){let r=t.getAttribute("aria-label");if(r)return{node:t,text:r.value,location:r.keyLocation};let n=t.getAttribute("aria-labelledby");return n?{node:t,text:function(e,t){if(!t||t instanceof O)return t;let r=`#${t}`,n=e.querySelector(r);return n?n.textContent:r}(e,n.value),location:n.keyLocation}:{node:t,text:null,location:t.location}})(t,e));for(let e of r.filter(nD)){if(e.text instanceof O)continue;let t=r.filter(t=>t.text===e.text).length>1;if(!e.text||t){let t=e.location;this.report({node:e.node,message:"Landmarks must have a non-empty and unique accessible name (aria-label or aria-labelledby)",location:t})}}}})}}let nj={ignoreCase:!1,requireSemicolon:!0},n_=/&(?:[a-z0-9]+|#x?[0-9a-f]+)(;|[^a-z0-9]|$)/gi,nF=s.e.map(e=>e.toLowerCase());function nz(e,t,r){let n=r.index??0;return P(e,n,n+t.length)}class nU extends eG{constructor(e){super({...nj,...e})}static schema(){return{ignoreCase:{type:"boolean"},requireSemicolon:{type:"boolean"}}}documentation(e){var t;return{description:(t=this.options,[e.terminated?`Unrecognized character reference \`${e.entity}\`.`:`Character reference \`${e.entity}\` must be terminated by a semicolon.`,"HTML5 defines a set of [valid character references](https://html.spec.whatwg.org/multipage/named-characters.html) but this is not a valid one.","","Ensure that:","","1. The character is one of the listed names.",...t.ignoreCase?[]:["1. The case is correct (names are case sensitive)."],...t.requireSemicolon?["1. The name is terminated with a `;`."]:[]].join("\n")),url:"https://html-validate.org/rules/unrecognized-char-ref.html"}}setup(){this.on("element:ready",e=>{let t=e.target;for(let e of t.childNodes)e.nodeType===_.TEXT_NODE&&this.findCharacterReferences(t,e.textContent,e.location,{isAttribute:!1})}),this.on("attr",e=>{e.value&&this.findCharacterReferences(e.target,e.value.toString(),e.valueLocation,{isAttribute:!0})})}get entities(){return this.options.ignoreCase?nF:s.e}findCharacterReferences(e,t,r,{isAttribute:n}){let i=n&&t.includes("?");for(let n of this.getMatches(t))this.validateCharacterReference(e,r,n,{isQuerystring:i})}validateCharacterReference(e,t,r,{isQuerystring:n}){let{requireSemicolon:i}=this.options,{match:a,entity:s,raw:o,terminated:l}=r;if(s.startsWith("&#")||n&&!l)return;let u=this.entities.includes(s);if(u&&(l||!i))return;if(u&&!l){let r=nz(t,s,a);this.report(e,'Character reference "{{ entity }}" must be terminated by a semicolon',r,{entity:o,terminated:!1});return}let c=nz(t,s,a);this.report(e,'Unrecognized character reference "{{ entity }}"',c,{entity:o,terminated:!0})}*getMatches(e){let t;do if(t=n_.exec(e)){let e=t[1],r=";"===e,n=";"!==e&&e.length>0?t[0].slice(0,-1):t[0];this.options.ignoreCase?yield{match:t,entity:n.toLowerCase(),raw:n,terminated:r}:yield{match:t,entity:n,raw:n,terminated:r}}while(t)}}let nG=["section","hint","contact","field1","field2","webauthn"],nB=["name","honorific-prefix","given-name","additional-name","family-name","honorific-suffix","nickname","username","new-password","current-password","one-time-code","organization-title","organization","street-address","address-line1","address-line2","address-line3","address-level4","address-level3","address-level2","address-level1","country","country-name","postal-code","cc-name","cc-given-name","cc-additional-name","cc-family-name","cc-number","cc-exp","cc-exp-month","cc-exp-year","cc-csc","cc-type","transaction-currency","transaction-amount","language","bday","bday-day","bday-month","bday-year","sex","url","photo"],nV=["tel","tel-country-code","tel-national","tel-area-code","tel-local","tel-local-prefix","tel-local-suffix","tel-extension","email","impp"],nW={name:"text","honorific-prefix":"text","given-name":"text","additional-name":"text","family-name":"text","honorific-suffix":"text",nickname:"text",username:"username","new-password":"password","current-password":"password","one-time-code":"password","organization-title":"text",organization:"text","street-address":"multiline","address-line1":"text","address-line2":"text","address-line3":"text","address-level4":"text","address-level3":"text","address-level2":"text","address-level1":"text",country:"text","country-name":"text","postal-code":"text","cc-name":"text","cc-given-name":"text","cc-additional-name":"text","cc-family-name":"text","cc-number":"text","cc-exp":"month","cc-exp-month":"numeric","cc-exp-year":"numeric","cc-csc":"text","cc-type":"text","transaction-currency":"text","transaction-amount":"numeric",language:"text",bday:"date","bday-day":"numeric","bday-month":"numeric","bday-year":"numeric",sex:"text",url:"url",ph
22oto:"url",tel:"tel","tel-country-code":"text","tel-national":"text","tel-area-code":"text","tel-local":"text","tel-local-prefix":"text","tel-local-suffix":"text","tel-extension":"text",email:"username",impp:"url"},nH=["checkbox","radio","file","submit","image","reset","button"];function nX(e){let t=["text","multiline","password","url","username","tel","numeric","month","date"];return({hidden:t,text:t.filter(e=>"multiline"!==e),search:t.filter(e=>"multiline"!==e),password:["password"],url:["url"],email:["username"],tel:["tel"],number:["numeric"],month:["month"],date:["date"]})[e]??[]}function nY(e){switch(e.msg){case 0:return"autocomplete attribute cannot be used on {{ what }}";case 1:return'"{{ value }}" cannot be used on {{ what }}';case 2:return'"{{ second }}" must appear before "{{ first }}"';case 3:return'"{{ token }}" is not a valid autocomplete token or field name';case 4:return'"{{ second }}" cannot be combined with "{{ first }}"';case 5:return"autocomplete attribute is missing field name"}}class nJ extends eG{documentation(e){return{description:function(e){switch(e.msg){case 0:return[`\`autocomplete\` attribute cannot be used on \`${e.what}\``,"","The following input types cannot use the `autocomplete` attribute:","",...nH.map(e=>`- \`${e}\``)].join("\n");case 1:{let t=`\`"${e.value}"\` cannot be used on \`${e.what}\``;if("form"===e.type)return[t,'\nThe `<form>` element can only use the values `"on"` and `"off"`.'].join("\n");if("hidden"===e.type)return[t,'\n`<input type="hidden">` cannot use the values `"on"` and `"off"`.'].join("\n");let r=nX(e.type),n=nW[e.value];return[t,"",`\`${e.what}\` allows autocomplete fields from the following group${r.length>1?"s":""}:`,"",...r.map(e=>`- ${e}`),"",`The field \`"${e.value}"\` belongs to the group /${n}/ which cannot be used with this input type.`].join("\n")}case 2:return`\`"${e.second}"\` must appear before \`"${e.first}"\`
23
24The autocomplete tokens must appear in the following order:
25
26- Optional section name (\`section-\` prefix).
27- Optional \`shipping\` or \`billing\` token.
28- Optional \`home\`, \`work\`, \`mobile\`, \`fax\` or \`pager\` token (for fields supporting it).
29- Field name
30- Optional \`webauthn\` token.`;case 3:return`\`"${e.token}"\` is not a valid autocomplete token or field name`;case 4:return`\`"${e.second}"\` cannot be combined with \`"${e.first}"\``;case 5:return"Autocomplete attribute is missing field name"}}(e),url:"https://html-validate.org/rules/valid-autocomplete.html"}}setup(){this.on("dom:ready",e=>{let{document:t}=e;for(let e of t.querySelectorAll("[autocomplete]")){let t=e.getAttribute("autocomplete");if(null===t.value||t.value instanceof O)continue;let r=t.valueLocation,n=t.value.toLowerCase(),i=new G(n,r);0!==i.length&&this.validate(e,n,i,t.keyLocation,r)}})}validate(e,t,r,n,i){switch(e.tagName){case"form":this.validateFormAutocomplete(e,t,i);break;case"input":case"textarea":case"select":this.validateControlAutocomplete(e,r,n)}}validateControlAutocomplete(e,t,r){let n=e.getAttributeValue("type")??"text",i="hidden"!==n?"expectation":"anchor";if(e.is("input")&&nH.includes(n)){let t={msg:0,what:`<input type="${n}">`};this.report({node:e,message:nY(t),location:r,context:t});return}if(t.includes("on")||t.includes("off"))return void this.validateOnOff(e,i,t);this.validateTokens(e,t,r)}validateFormAutocomplete(e,t,r){let n=t.trim();if(["on","off"].includes(n))return;let i={msg:1,type:"form",value:n,what:"<form>"};this.report({node:e,message:nY(i),location:r,context:i})}validateOnOff(e,t,r){let n=r.findIndex(e=>"on"===e||"off"===e),i=r.item(n),a=r.location(n);if(r.length>1){let t={msg:4,first:r.item(n>0?0:1),second:i};this.report({node:e,message:nY(t),location:a,context:t})}switch(t){case"expectation":return;case"anchor":{let t={msg:1,type:"hidden",value:i,what:'<input type="hidden">'};this.report({node:e,message:nY(t),location:r.location(0),context:t})}}}validateTokens(e,t,r){let n=[];for(let{item:r,location:i}of t.iterator()){let t=function(e){return e.startsWith("section-")?"section":"shipping"===e||"billing"===e?"hint":nB.includes(e)?"field1":nV.includes(e)?"field2":["home","work","mobile","fax","pager"].includes(e)?"contact":"webauthn"===e?"webauthn":null}(r);if(t)n.push(t);else{let t={msg:3,token:r};this.report({node:e,message:nY(t),location:i,context:t});return}}let i=n.map(e=>"field1"===e||"field2"===e);this.validateFieldPresence(e,t,i,r),this.validateContact(e,t,n),this.validateOrder(e,t,n),this.validateControlGroup(e,t,i)}validateFieldPresence(e,t,r,n){let i=r.filter(Boolean).length;if(0===i){let t={msg:5};this.report({node:e,message:nY(t),location:n,context:t})}else if(i>1){let n=r.indexOf(!0),i=r.lastIndexOf(!0),a={msg:4,first:t.item(n),second:t.item(i)};this.report({node:e,message:nY(a),location:t.location(i),context:a})}}validateContact(e,t,r){if(r.includes("contact")&&r.includes("field1")){let n=r.indexOf("field1"),i=r.indexOf("contact"),a={msg:4,first:t.item(n),second:t.item(i)};this.report({node:e,message:nY(a),location:t.location(i),context:a})}}validateOrder(e,t,r){let n=r.map(e=>nG.indexOf(e));for(let r=0;r<n.length-1;r++)if(n[0]>
30n[r+1]){let n={msg:2,first:t.item(r),second:t.item(r+1)};this.report({node:e,message:nY(n),location:t.location(r+1),context:n})}}validateControlGroup(e,t,r){if(0===r.filter(Boolean).length||!e.is("input"))return;let n=e.getAttribute("type"),i=n?.value??"text";if(i instanceof O)return;let a=nX(i),s=r.indexOf(!0),o=t.item(s),l=nW[o];if(!a.includes(l)){let r={msg:1,type:i,value:o,what:`<input type="${i}">`};this.report({node:e,message:nY(r),location:t.location(s),context:r})}}}let nK={relaxed:!1};class nZ extends eG{constructor(e){super({...nK,...e})}static schema(){return{relaxed:{type:"boolean"}}}documentation(e){let{relaxed:t}=this.options,{kind:r,id:n}=e,i=this.messages[r].replace('"{{ id }}"',"`{{ id }}`").replace("id","ID").replace(/^(.)/,e=>e.toUpperCase());return{description:[`${eg(i,{id:n})}.`,"","Under the current configuration the following rules are applied:","","  - ID must not be empty","  - ID must not contain any whitespace characters",...t?[]:["  - ID must begin with a letter","  - ID must only contain letters, digits, `-` and `_`"]].join("\n"),url:"https://html-validate.org/rules/valid-id.html"}}setup(){this.on("attr",this.isRelevant,e=>{let{value:t}=e;if(null===t||t instanceof O)return;if(""===t){let r={kind:1,id:t};this.report(e.target,this.messages[r.kind],e.location,r);return}if(/\s/.exec(t)){let r={kind:2,id:t};this.report(e.target,this.messages[r.kind],e.valueLocation,r);return}let{relaxed:r}=this.options;if(!r){if(/^[^\p{L}]/u.exec(t)){let r={kind:3,id:t};this.report(e.target,this.messages[r.kind],e.valueLocation,r);return}if(/[^\p{L}\p{N}_-]/u.exec(t)){let r={kind:4,id:t};this.report(e.target,this.messages[r.kind],e.valueLocation,r)}}})}get messages(){return{1:'element id "{{ id }}" must not be empty',2:'element id "{{ id }}" must not contain whitespace',3:'element id "{{ id }}" must begin with a letter',4:'element id "{{ id }}" must only contain letters, digits, dash and underscore characters'}}isRelevant(e){return"id"===e.key}}class nQ extends eG{documentation(e){let t={description:"HTML void elements cannot have any content and must not have content or end tag.",url:"https://html-validate.org/rules/void-content.html"};
30return e&&(t.description=`<${e}> is a void element and must not have content or end tag.`),t}setup(){this.on("tag:end",e=>{let t=e.target;t&&t.voidElement&&t.closed===eo.EndTag&&this.report(null,`End tag for <${t.tagName}> must be omitted`,t.location,t.tagName)})}}let n0={style:"omit"};class n1 extends eG{style;constructor(e){super({...n0,...e}),this.style=function(e){switch(e){case"omit":return 1;case"selfclose":case"selfclosing":return 2;default:throw Error(`Invalid style "${e}" for "void-style" rule`)}}(this.options.style)}static schema(){return{style:{enum:["omit","selfclose","selfclosing"],type:"string"}}}documentation(e){let[t,r]=function(e){switch(e){case 1:return["omit end tag",""];case 2:return["be self-closed","/"];default:throw Error("Unknown style")}}(e.style);return{description:`The current configuration requires void elements to ${t}, use <${e.tagName}${r}> instead.`,url:"https://html-validate.org/rules/void-style.html"}}setup(){let{style:e}=this,t={1:this.validateOmitted.bind(this),2:this.validateSelfClosed.bind(this)}[e];this.on("tag:end",e=>{let r=e.previous;r.meta&&t(r)})}validateOmitted(e){e.voidElement&&e.closed===eo.VoidSelfClosed&&this.reportError(e,`Expected omitted end tag <${e.tagName}> instead of self-closing element <${e.tagName}/>`)}validateSelfClosed(e){e.voidElement&&e.closed===eo.VoidOmitted&&this.reportError(e,`Expected self-closing element <${e.tagName}/> instead of omitted end-tag <${e.tagName}>`)}reportError(e,t){let r={style:this.style,tagName:e.tagName};super.report(e,t,null,r)}}class n2 extends eG{documentation(){return{description:"WCAG 2.1 requires each `<a href>` anchor link to have a text describing the purpose of the link using either plain text or an `<img>` with the `alt` attribute set.",url:"https://html-validate.org/rules/wcag/h30.html"}}setup(){this.on("dom:ready",e=>{for(let t of e.document.getElementsByTagName("a")){if(!t.hasAttribute("href")||!eS(t)||e_(t,{ignoreHiddenRoot:!0})!==ej.EMPTY_TEXT||t.querySelectorAll("img").some(e=>eF(e)))continue;let e=t.querySelectorAll("[aria-label]");ez(t)||e.some(e=>ez(e))||this.report(t,"Anchor link must have a text describing its purpose")}})}}class n3 extends eG{documentation(){return{description:"WCAG 2.1 requires each `<form>` element to have at least one submit button.",url:"https://html-validate.org/rules/wcag/h32.html"}}setup(){let e=this.getTagsWithProperty("form").join(",");this.on("dom:ready",t=>{let{document:r}=t;for(let t of r.querySelectorAll(e))!(t.querySelectorAll("button,input").filter(n9).filter(e=>!e.hasAttribute("form")).length>0)&&!function(e,t){let{id:r}=t;return!!r&&e.querySelectorAll("button[form],input[form]").filter(n9).filter(e=>(function(e,t){let r=t.getAttribute("form");return!!r?.valueMatches(e,!0)})(r,e)).length>0}(r,t)&&this.report(t,`<${t.tagName}> element must have a submit button`)})}}function n9(e){let t=e.getAttribute("type");return!!(!t||t.valueMatches(/submit|image/))}class n6 extends eG{documentation(){return{description:'WCAG 2.1 requires all images used as submit buttons to have a non-empty textual description using the `alt` attribute.\nThe alt text cannot be empty (`alt=""`).',url:"https://html-validate.org/rules/wcag/h36.html"}}setup(){this.on("tag:end",e=>{let t=e.previous;if("input"===t.tagName&&"image"===t.getAttributeValue("type")&&eS(t)&&!eF(t)){let e=t.getAttribute("alt");this.report({node:t,message:"image used as submit button must have non-empty alt text",location:e?e.keyLocation:t.location})}})}}let n5={allowEmpty:!0,alias:[]};class n7 extends eG{constructor(e){super({...n5,...e}),Array.isArray(this.options.alias)||(this.options.alias=[this.options.alias])}static schema(){return{alias:{anyOf:[{items:{type:"string"},type:"array"},{type:"string"}]},allowEmpty:{type:"boolean"}}}documentation(){return{description:"Both HTML5 and WCAG 2.0 requires images to have a alternative text for each image.",url:"https://html-validate.org/rules/wcag/h37.html"}}setup(){this.on("dom:ready",e=>{let{document:t}=e;for(let e of t.querySelectorAll("img"))this.validateNode(e)})}validateNode(e){if(!eS(e)||e.getAttributeValue("alt")||e.hasAttribute("alt")&&this.options.allowEmpty)return;for(let t of this.options.alias)if(e.getAttribute(t))return;let t=e.annotatedName;if(e.hasAttribute("alt")){let r=e.getAttribute("alt");this.report(e,`${t} cannot have empty "alt" attribute`,r.keyLocation)}else this.report(e,`${t} is missing required "alt" attribute`,e.location)}}let n4={strict:!1},{enum:n8}=s.h.th.attributes?.scope,ie=(0,l.n)(n8);class it extends eG{constructor(e){super({...n4,...e})}static schema(){return{strict:{type:"boolean"}}}documentation(){return{description:"H63: Using the scope attribute to associate header cells and data cells in data tables",url:"https://html-validate.org/rules/wcag/h63.html"}}setup(){let{strict:e}=this.options;this.on("element:ready",t=>{let r=t.target;r.is("table")&&(e||!function(e){var t;if(e.querySelector("> tr > [headers], > tbody > tr > [headers]"))return!1;let r=e.querySelectorAll("> tr, > thead > tr, > tbody > tr");if(0===r.length)return!1;let n=r.map(e=>e.querySelectorAll("> *").map(e=>+!!e.is("th")));if(0===n[0].length)return!1;let i=n[0].length;if(!n.every(e=>e.length===i))return!1;let a={rows:(t=n).length,cols:t[0].length},s=n.map(e=>e.reduce((e,t)=>
30e+t,0)),o=Array(a.cols).fill(0).map((e,t)=>n.reduce((e,r)=>e+r[t],0)),[l,...u]=s;if(l===a.cols&&u.every(e=>0===e))return!0;let[c,...d]=o,h=!!e.querySelector("> thead");return!!(c===a.rows&&d.every(e=>0===e))&&!h}(r))&&this.validateTable(r)})}validateTable(e){for(let t of e.querySelectorAll("th")){let e=t.getAttribute("scope"),r=e?.value;if(r instanceof O||r&&n8.includes(r))continue;let n=`<th> element must have a valid scope attribute: ${ie}`,i=e?.valueLocation??e?.keyLocation??t.location;this.report(t,n,i)}}}class ir extends eG{documentation(){return{description:"A decorative image cannot have a title attribute. Either remove `title` or add a descriptive `alt` text.",url:"https://html-validate.org/rules/wcag/h67.html"}}setup(){this.on("tag:end",e=>{let t=e.target;if(!t||"img"!==t.tagName)return;let r=t.getAttribute("title");if(!r||""===r.value)return;let n=t.getAttributeValue("alt");n&&""!==n||this.report(t,"<img> with empty alt text cannot have title attribute",r.keyLocation)})}}class ii extends eG{documentation(){return{description:"H71: Providing a description for groups of form controls using fieldset and legend elements",url:"https://html-validate.org/rules/wcag/h71.html"}}setup(){this.on("dom:ready",e=>{let{document:t}=e;for(let e of t.querySelectorAll(this.selector))this.validate(e)})}validate(e){0===e.querySelectorAll("> legend").length&&this.reportNode(e)}reportNode(e){super.report(e,`${e.annotatedName} must have a <legend> as the first child`)}get selector(){return this.getTagsDerivedFrom("fieldset").join(",")}}let ia={"allowed-links":eY,"area-alt":eZ,"aria-hidden-body":eQ,"aria-label-misuse":e2,"attr-case":e5,"attr-delimiter":t$,"attr-pattern":tS,"attr-quotes":tN,"attr-spacing":tI,"attribute-allowed-values":tO,"attribute-boolean-style":tR,"attribute-empty-style":tq,"attribute-misuse":tD,"class-pattern":t_,"close-attr":tF,"close-order":tU,deprecated:tB,"deprecated-rule":tV,"doctype-html":tW,"doctype-style":tX,"element-case":tJ,"element-name":tZ,"element-permitted-content":tQ,"element-permitted-occurrences":t0,"element-permitted-order":t1,"element-permitted-parent":t5,"element-required-ancestor":t7,"element-required-attributes":t4,"element-required-content":t8,"empty-heading":re,"empty-title":rt,"form-dup-name":rs,"heading-level":ru,"hidden-focusable":rh,"id-pattern":rp,"input-attributes":ry,"input-missing-label":rw,"long-title":rA,"map-dup-name":r$,"map-id-name":rC,"meta-refresh":rT,"missing-doctype":rN,"multiple-labeled-controls":rI,"name-pattern":rL,"no-abstract-role":rq,"no-autoplay":rM,"no-conditional-comment":rj,"no-deprecated-attr":r_,"no-dup-attr":rF,"no-dup-class":rz,"no-dup-id":rG,"no-implicit-button-type":rW,"no-implicit-input-type":rX,"no-implicit-close":rY,"no-inline-style":rK,"no-missing-references":r0,"no-multiple-main":r1,"no-raw-characters":r7,"no-redundant-aria-label":r8,"no-redundant-for":ne,"no-redundant-role":nt,"no-self-closing":ni,"no-style-tag":na,"no-trailing-whitespace":ns,"no-unknown-elements":nl,"no-unused-disable":nu,"no-utf8-bom":nc,"prefer-button":np,"prefer-native-element":ng,"prefer-tbody":ny,"require-csp-nonce":nv,"require-sri":n$,"script-element":nk,"script-type":nC,"svg-focusable":nN,"tel-non-breaking":nO,"text-content":nR,"unique-landmark":nM,"unrecognized-char-ref":nU,"valid-autocomplete":nJ,"valid-id":nZ,"void-content":nQ,"void-style":n1,"wcag/h30":n2,"wcag/h32":n3,"wcag/h36":n6,"wcag/h37":n7,"wcag/h63":it,"wcag/h67":ir,"wcag/h71":ii};function is(e){return e&&"object"==typeof e&&"then"in e&&"function"==typeof e.then}Object.keys(ia);var io={};let il={"html-validate:a11y":{rules:{"area-alt":["error",{accessible:!0}],"aria-hidden-body":"error","aria-label-misuse":["error",{allowAnyNamable:!1}],"deprecated-rule":"warn","empty-heading":"error","empty-title":"error","hidden-focusable":"error","meta-refresh":"error","multiple-labeled-controls":"error","no-abstract-role":"error","no-autoplay":["error",{include:["audio","video"]}],"no-dup-id":"error","no-implicit-button-type":"error","no-redundant-aria-label":"error","no-redundant-for":"error","no-redundant-role":"error","prefer-native-element":"error","svg-focusable":"off","text-content":"error","unique-landmark":"error","valid-autocomplete":"error","wcag/h30":"error","wcag/h32":"error","wcag/h36":"error","wcag/h37":"error","wcag/h63":"error","wcag/h67":"error","wcag/h71":"error"}},"html-validate:browser":{rules:{"missing-doctype":"off","no-inline-style":"off","no-trailing-whitespace":"off","attribute-boolean-style":"off","attribute-empty-style":"off","void-style":"off","no-self-closing":"off"}},"html-validate:document":{rules:{"input-missing-label":"error","heading-level":"error","missing-doctype":"error","no-missing-references":"error","require-sri":"error"}},"html-validate:prettier":{rules:{"attr-quotes":"off","doctype-style":"off","void-style":"off"}},"html-validate:recommended":{rules:{"area-alt":["error",{accessible:!0}],"aria-hidden-body":"error","aria-label-misuse":["error",{allowAnyNamable:!1}],"attr-case":"error","attr-delimiter":"error","attr-quotes":"error","attr-spacing":"error","attribute-allowed-values":"error","attribute-boolean-style":"error","attribute-empty-style":"error","attribute-misuse":"error","close-attr":"error","close-order":"error",deprecated:"error","deprecated-rule":"warn","doctype-html":"error","doctype-style":"error","element-case":"error","element-name":"error","element-permitted-content":"error","element-permitted-occurrences":"error","element-permitted-order":"error","element-permitted-parent":"error","element-required-ancestor":"error","element-required-attributes":"error","element-required-content":"error","empty-heading":"error","empty-title":"error","form-dup-name":"error","hidden-focusable":"error","input-attributes":"error","long-title":"error","map-dup-name":"error","map-id-name":"error","meta-refresh":"error","multiple-labeled-controls":"error","no-abstract-role":"error","no-autoplay":["error",{include:["audio","video"]}],"no-conditional-comment":"error","no-deprecated-attr":"error","no-dup-attr":"error","no-dup-class":"error","no-dup-id":"error","no-implicit-button-type":"error","no-implicit-input-type":"error","no-implicit-close":"error","no-inline-style":"error","no-multiple-main":"error","no-raw-characters":"error","no-redundant-aria-label":"error","no-redundant-for":"error","no-redundant-role":"error","no-self-closing":"error","no-trailing-whitespace":"error","no-utf8-bom":"error","no-unused-disable":"error","prefer-button":"error","prefer-native-element":"error","prefer-tbody":"error","script-element":"error","script-type":"error","svg-focusable":"off","tel-non-breaking":"error","text-content":"error","unique-landmark":"error","unrecognized-char-ref":"error","valid-autocomplete":"error","valid-id":["error",{relaxed:!1}],void:"off","void-content":"error","void-style":"error","wcag/h30":"error","wcag/h32":"error","wcag/h36":"error","wcag/h37":"error","wcag/h63":"error","wcag/h67":"error","wcag/h71":"error"}},"html-validate:standard":{rules:{"area-alt":["error",{accessible:!1}],"aria-label-misuse":["error",{allowAnyNamable:!0}],"attr-spacing":"error","attribute-allowed-values":"error","attribute-misuse":"error","close-attr":"error","close-order":"error",deprecated:"error","deprecated-rule":"warn","doctype-html":"error","element-name":"error","element-permitted-content":"error","element-permitted-occurrences":"error","element-permitted-order":"error","element-permitted-parent":"error","element-required-ancestor":"error","element-required-attributes":"error","element-required-content":"error","map-dup-name":"error","map-id-name":"error","multiple-labeled-controls":"error","no-abstract-role":"error","no-deprecated-attr":"error","no-dup-attr":"error","no-dup-id":"error","no-multiple-main":"error","no-raw-characters":["error",{relaxed:!0}],"no-unused-disable":"error","script-element":"error","unrecognized-char-ref":"error","valid-autocomplete":"error","valid-id":["error",{relaxed:!0}],"void-content":"error"}}};class iu{metaTable;plugins;rules;transformers;original;cache;constructor({metaTable:e,plugins:t,rules:r,transformers:n},i){this.metaTable=e,this.plugins=t,this.rules=r,this.transformers=n,this.cache=new Map,this.original=i}getConfigData(){return this.original}getMetaTable(){return this.metaTable}getPlugins(){return this.plugins}getRules(){return this.rules}canTransform(e){return!!this.findTransformer(e)}findTransformer(e){return this.transformers.find(t=>t.pattern.test(e))??null}}function ic(e){return"resolveConfig"in e}function id(e){return"resolveElements"in e}function ih(e){return"resolvePlugin"in e}function im(e){return"resolveTransformer"in e}async function ip(e,t,r){for(let n of e.filter(ic)){let e=await n.resolveConfig(t,r);
30if(e)return e}throw new p(`Failed to load configuration from "${t}"`)}async function ig(e,t,r){for(let n of e.filter(id)){let e=await n.resolveElements(t,r);if(e)return e}throw new p(`Failed to load elements from "${t}"`)}async function iy(e,t,r){for(let n of e.filter(ih)){let e=await n.resolvePlugin(t,r);if(e)return e}throw new p(`Failed to load plugin from "${t}"`)}async function ib(e,t,r){for(let n of e.filter(im)){let e=await n.resolveTransformer(t,r);if(e)return e}throw new p(`Failed to load transformer from "${t}"`)}let iv=new a({strict:!0,strictTuples:!0,strictTypes:!0});iv.addMetaSchema(u),iv.addKeyword(A);let iw=iv.compile(ep);function ix(e,t){return t}function iA(e,t){let r=c(e,{...t,rules:{}});t.rules&&(r.rules=c(r.rules,t.rules,{arrayMerge:ix}));let n=!!e.root||!!t.root;return n&&(r.root=n),r}function iE(e){return Array.isArray(e)?e:[e]}class iT{config;configurations;resolvers;metaTable;plugins;transformers=[];static empty(){return new iT([],{extends:[],rules:{},plugins:[],transform:{}})}static fromObject(e,t,r=null){return iT.validate(t,r),iT.create(e,t)}static fromFile(e,t){let r=function(e,t,r){for(let n of e.filter(ic)){let i=n.resolveConfig(t,r);if(is(i))return ip(e,t,r);if(i)return i}throw new p(`Failed to load configuration from "${t}"`)}(iE(e),t,{cache:!1});return is(r)?r.then(r=>iT.fromObject(e,r,t)):iT.fromObject(e,r,t)}static validate(e,t=null){if(!iw(e))throw new g(t,"Invalid configuration",e,ep,iw.errors??[]);if(e.rules)for(let[r,[,n]]of iT.getRulesObject(e.rules).entries()){let i=ia[r],a=`/rules/${r}/1`;eG.validateOptions(i,r,a,n,t,e)}}static defaultConfig(){return new iT([],io)}static create(e,t){let r=new iT(e,t),n=r.loadPlugins(r.config.plugins??[]);return is(n)?n.then(e=>r.init(t,e)):r.init(t,n)}init(e,t){this.plugins=t,this.configurations=this.loadConfigurations(this.plugins),this.extendMeta(this.plugins);let r=t=>(this.config=t,this.config.extends=[],e.rules&&(this.config=iA(this.config,{rules:e.rules})),this),n=this.extendConfig(this.config.extends??[]);return is(n)?n.then(e=>r(e)):r(n)}constructor(e,t){this.config=iA({extends:[],plugins:[],rules:{},transform:{}},t),this.configurations=new Map,this.resolvers=iE(e),this.metaTable=null,this.plugins=[],this.transformers=Object.entries(this.config.transform??{}).map(([e,t])=>{let r=new RegExp(e);return"string"==typeof t?{kind:"import",pattern:r,name:t}:{kind:"function",pattern:r,function:t}})}isRootFound(){return!!this.config.root}merge(e,t){let r=new iT(e,iA(this.config,t.config)),n=r.loadPlugins(r.config.plugins??[]);return is(n)?n.then(e=>(r.plugins=e,r.configurations=r.loadConfigurations(r.plugins),r.extendMeta(r.plugins),r)):(r.plugins=n,r.configurations=r.loadConfigurations(r.plugins),r.extendMeta(r.plugins),r)}extendConfig(e){if(0===e.length)return this.config;let t={};for(let r of e){let n;if(this.configurations.has(r))n=this.configurations.get(r);else{let t=iT.fromFile(this.resolvers,r);if(is(t))return this.extendConfigAsync(e);n=t.config}t=iA(t,n)}return iA(t,this.config)}async extendConfigAsync(e){let t={};for(let r of e)t=iA(t,this.configurations.has(r)?this.configurations.get(r):(await iT.fromFile(this.resolvers,r)).config);return iA(t,this.config)}getMetaTable(){if(this.metaTable)return this.metaTable;let e=new N;for(let t of this.getPlugins())t.elementSchema&&e.extendValidationSchema(t.elementSchema);let t=Array.from(this.config.elements??["html5"]),r=n=>{let i=this.getElementsFromEntry(n);if(is(i))return i.then(n=>{let[i,a]=n;e.loadFromObject(i,a);let s=t.shift();if(s)return r(s)});{let[n,a]=i;e.loadFromObject(n,a);let s=t.shift();if(s)return r(s)}},n=t.shift();if(n){let t=r(n);if(is(t))return t.then(()=>(e.init(),this.metaTable=e))}return e.init(),this.metaTable=e}getElementsFromEntry(e){if("string"!=typeof e)return[e,null];let t=s.b[e];if(t)return[t,null];try{let t=function(e,t,r){for(let n of e.filter(id)){let i=n.resolveElements(t,r);if(is(i))return ig(e,t,r);if(i)return i}throw new p(`Failed to load elements from "${t}"`)}(this.resolvers,e,{cache:!1});if(is(t))return t.then(t=>[t,e]);return[t,e]}catch(r){let t=r instanceof Error?r.message:String(r);throw new e3(`Failed to load elements from "${e}": ${t}`,h(r))}}get(){return{...this.config}}getRules(){return iT.getRulesObject(this.config.rules??{})}static getRulesObject(e){let t=new Map;for(let[r,n]of Object.entries(e)){let e=n;Array.isArray(e)?1===e.length&&(e=[e[0],{}]):e=[e,{}];let i=function(e){switch(e){case 0:case"off":return 0;case 1:case"warn":return 1;case 2:case"error":return 2;default:throw Error(`Invalid severity "${String(e)}"`)}}(e[0]);t.set(r,[i,e[1]])}return t}getPlugins(){return this.plugins}getTransformers(){return this.transformers}loadPlugins(e){let t=[],r=Array.from(e),n=(e,i)=>{if("string"!=typeof e){e.name=e.name||`:unnamedPlugin@${String(i+1)}`,e.originalName=`:unnamedPlugin@${String(i+1)}`,t.push(e);let a=r.shift();if(a)return n(a,i+1)}else try{let a=function(e,t,r){for(let n of e.filter(ih)){let i=n.resolvePlugin(t,r);if(is(i))return iy(e,t,r);if(i)return i}throw new p(`Failed to load plugin from "${t}"`)}(this.resolvers,e,{cache:!0});if(is(a))return a.then(a=>{a.name=a.name||e,a.originalName=e,t.push(a);let s=r.shift();if(s)return n(s,i+1)});{a.name=a.name||e,a.originalName=e,t.push(a);let s=r.shift();if(s)return n(s,i+1)}}catch(r){let t=r instanceof Error?r.message:String(r);throw new e3(`Failed to load plugin "${e}": ${t}`,h(r))}},i=r.shift();if(i){let e=n(i,0);if(is(e))return e.then(()=>t)}return t}loadConfigurations(e){let t=new Map;for(let[e,r]of Object.entries(il))iT.validate(r,e),t.set(e,r);for(let r of e)for(let[e,n]of Object.entries(r.configs??{}))n&&(iT.validate(n,e),t.set(`${r.name}:${e}`,n),r.name!==r.originalName&&t.set(`${r.originalName}:${e}`,n));return t}extendMeta(e){for(let t of e){if(!t.elementSchema)continue;let{properties:e}=t.elementSchema;if(e)for(let[t,r]of Object.entries(e))r.copyable&&!T.includes(t)&&T.push(t)}}resolve(){let e=this.resolveData();return is(e)?e.then(e=>new iu(e,this.get())):new iu(e,this.get())}resolveData(){let e=this.getMetaTable();return is(e)?e.then(e=>({metaTable:e,plugins:this.getPlugins(),rules:this.getRules(),transformers:this.transformers})):{metaTable:e,plugins:this.getPlugins(),rules:this.getRules(),transformers:this.transformers}}}class i${_globalConfig;_configData;resolvers;constructor(e,t){this.resolvers=e,this._configData=t,this._globalConfig=null}setConfigData(e){this._configData=e,this._globalConfig=null}getGlobalConfig(){if(this._globalConfig)return this._globalConfig;let e=this._configData?this.loadFromObject(this._configData):this.defaultConfig();return is(e)?e.then(e=>(this._globalConfig=e,this._globalConfig)):(this._globalConfig=e,this._globalConfig)}getGlobalConfigSync(){if(this._globalConfig)return this._globalConfig;let e=this._configData?this.loadFromObject(this._configData):this.defaultConfig();if(is(e))throw new p("Cannot load async config from sync function");return this._globalConfig=e,this._globalConfig}getResolvers(){return this.resolvers}async _getGlobalConfig(){return(await this.getGlobalConfig()).get()}empty(){return iT.empty()}loadFromObject(e,t){return iT.fromObject(this.resolvers,e,t)}loadFromFile(e){return iT.fromFile(this.resolvers,e)}}let ik=[];class iS extends i${constructor(...e){if(Array.isArray(e[0])){let[t,r]=e;super(t,r)}else{let[t]=e;super(ik,t)}}setConfig(e){this.setConfigData(e)}getConfigFor(e,t){let r=this.loadFromObject(t??{});return is(r)?r.then(e=>this._resolveConfig(e)):this._resolveConfig(r)}flushCache(){}defaultConfig(){return this.loadFromObject({extends:["html-validate:recommended"],elements:["html5"]})}
30_resolveConfig(e){if(e.isRootFound())return e.resolve();let t=this.getGlobalConfig();if(is(t))return t.then(t=>{let r=t.merge(this.resolvers,e);return is(r)?r.then(e=>e.resolve()):r.resolve()});{let r=t.merge(this.resolvers,e);return is(r)?r.then(e=>e.resolve()):r.resolve()}}}class iC{listeners;constructor(){this.listeners={}}on(e,t){let{listeners:r}=this,n=e.split(",").map(e=>e.trim());for(let e of n){let n=r[e]??[];r[e]=n,n.push(t)}return()=>{for(let e of n){let n=r[e];this.listeners[e]=n.filter(e=>e!==t)}}}once(e,t){let r=this.on(e,(e,n)=>{t(e,n),r()});return r}trigger(e,t){for(let r of this.getCallbacks(e))r.call(null,e,t)}getCallbacks(e){let{listeners:t}=this;return[...t[e]??[],...t["*"]??[]]}}let iN="9.7.1";function iI(e){return{...e,selector:e.selector()}}class iO{result;constructor(){this.result={}}static merge(e){if(is(e))return e.then(e=>this.merge(e));if(0!==e.length&&is(e[0]))return Promise.all(e).then(e=>this.merge(e));let t=e.every(e=>e.valid),r={};e.forEach(e=>{e.results.forEach(e=>{let t=e.filePath;t in r?r[t].messages=[...r[t].messages,...e.messages]:r[t]={...e}})});let n=Object.values(r).map(e=>(e.errorCount=iL(e.messages),e.warningCount=iR(e.messages),e));return{valid:t,results:n,errorCount:iP(n),warningCount:iq(n)}}add(e,t,r,n,i,a){i.filename in this.result||(this.result[i.filename]=[]);let s=e.documentation(a)?.url,o={ruleId:e.name,severity:r,message:t,offset:i.offset,line:i.line,column:i.column,size:i.size||0,selector:()=>n?n.generateSelector():null};s&&(o.ruleUrl=s),a&&(o.context=a),this.result[i.filename].push(o)}addManual(e,t){e in this.result||(this.result[e]=[]),this.result[e].push(t)}save(e){let t={valid:this.isValid(),results:Object.keys(this.result).map(t=>{let r=Array.from(this.result[t],iI).sort(iD),n=(e??[]).find(e=>t===e.filename);return{filePath:t,messages:r,errorCount:iL(r),warningCount:iR(r),source:n?n.originalData??n.data:null}}),errorCount:0,warningCount:0};return t.errorCount=iP(t.results),t.warningCount=iq(t.results),t}isValid(){return 0===Object.values(this.result).reduce((e,t)=>e+iL(t),0)}}function iL(e){return e.filter(e=>e.severity===Number(ef.ERROR)).length}function iR(e){return e.filter(e=>e.severity===Number(ef.WARN)).length}function iP(e){return e.reduce((e,t)=>e+t.errorCount,0)}function iq(e){return e.reduce((e,t)=>e+t.warningCount,0)}function iD(e,t){return e.line<t.line?-1:e.line>t.line?1:e.column<t.column?-1:+(e.column>t.column)}let iM=/<!(?:--)?\[(.*?)\](?:--)?>/g;
30class ij extends Error{location;constructor(e,t){super(t),this.location=e}}class i_{event;metaTable;currentNamespace="";dom;constructor(e){this.event=new iC,this.dom=null,this.metaTable=e.getMetaTable()}parseHtml(e){"string"==typeof e&&(e={data:e,filename:"inline",line:1,column:1,offset:0}),this.trigger("parse:begin",{location:null}),this.dom=new ed({filename:e.filename,offset:e.offset,line:e.line,column:e.column,size:0}),this.trigger("dom:load",{source:e,location:null});let t=new tE().tokenize(e),r=this.next(t);for(;!r.done;){let n=r.value;this.consume(e,n,t),r=this.next(t)}return this.dom.resolveMeta(this.metaTable),this.dom.root.cacheEnable(),this.trigger("dom:ready",{document:this.dom,source:e,location:null}),this.trigger("parse:end",{location:null}),this.dom.root}closeOptional(e){let t=this.dom.getActive();if(!t.meta?.implicitClosed)return!1;let r=e.data[2],n=!e.data[1],i=t.meta.implicitClosed;return n?i.includes(r):!t.is(r)&&!!(t.parent&&t.parent.is(r)&&i.includes(t.tagName))}consume(e,t,r){switch(t.type){case e7.UNICODE_BOM:break;case e7.TAG_OPEN:this.consumeTag(e,t,r);break;case e7.WHITESPACE:this.trigger("whitespace",{text:t.data[0],location:t.location}),this.appendText(t.data[0],t.location);break;case e7.DIRECTIVE:this.consumeDirective(t);break;case e7.CONDITIONAL:this.consumeConditional(t);break;case e7.COMMENT:this.consumeComment(t);break;case e7.DOCTYPE_OPEN:this.consumeDoctype(t,r);break;case e7.TEXT:case e7.TEMPLATING:this.appendText(t.data[0],t.location);break;case e7.EOF:this.closeTree(e,t.location)}}consumeTag(e,t,r){let n=Array.from(this.consumeUntil(r,e7.TAG_CLOSE,t.location)),i=n.slice(-1)[0],a=this.closeOptional(t),s=a?this.dom.getActive().parent:this.dom.getActive(),o=eu.fromTokens(t,i,s,this.metaTable,this.currentNamespace),l=!t.data[1],u=!l||o.closed!==eo.Open,c=o.meta?.foreign;if(a){let r=this.dom.getActive();r.closed=eo.ImplicitClosed,this.closeElement(e,o,r,t.location),this.dom.popActive()}l&&(this.dom.pushActive(o),this.trigger("tag:start",{target:o,location:t.location}));for(let t=0;t<n.length;t++){let r=n[t];switch(r.type){case e7.WHITESPACE:break;case e7.ATTR_NAME:this.consumeAttribute(e,o,r,n[t+1])}}if(l&&this.trigger("tag:ready",{target:o,location:i.location}),u){let t=this.dom.getActive();l||(o.closed=eo.EndTag),this.closeElement(e,o,t,i.location);let r=o.tagName!==t.tagName;!l&&o.voidElement||r||this.dom.popActive()}else c&&this.discardForeignBody(e,o.tagName,r,t.location)}closeElement(e,t,r,n){this.processElement(r,e),this.trigger("tag:end",{target:t,previous:r,location:n}),(!t||t.tagName===r.tagName||r.closed===eo.ImplicitClosed)&&(r.isRootElement()||this.trigger("element:ready",{target:r,location:r.location}))}processElement(e,t){if(e.cacheEnable(),t.hooks?.processElement){let r=t.hooks.processElement,n=this.metaTable;r.call({getMetaFor:e=>n.getMetaFor(e)},e)}}discardForeignBody(e,t,r,n){let i,a,s=1;do{let[o]=Array.from(this.consumeUntil(r,e7.TAG_OPEN,n)).slice(-1),[,l,u]=o.data;if(!l&&"svg"===t&&["title","desc"].includes(u)){let t=this.currentNamespace;this.currentNamespace="svg",this.consumeTag(e,o,r),this.consumeUntilMatchingTag(e,r,u),this.currentNamespace=t;continue}if(u!==t)continue;let c="/>"===(a=Array.from(this.consumeUntil(r,e7.TAG_CLOSE,o.location)).slice(-1)[0]).data[0];l?(i=o,s--):!c&&s++}while(s>0);if(!i||!a)return;let o=this.dom.getActive(),l=eu.fromTokens(i,a,o,this.metaTable);this.closeElement(e,l,o,a.location),this.dom.popActive()}consumeAttribute(e,t,r,n){let{meta:i}=t,a=this.getAttributeKeyLocation(r),s=this.getAttributeValueLocation(n),o=this.getAttributeLocation(r,n),l=!!(n&&n.type===e7.ATTR_VALUE),u={key:r.data[1],value:null,quote:null};if(l){let[,,e,t]=n.data;u.value=e,u.quote=t??null}let c=e=>[e];e.hooks?.processAttribute&&(c=e.hooks.processAttribute);let d=c.call({},u);for(let e of"function"!=typeof d[Symbol.iterator]?[u]:d){let r={target:t,key:e.key,value:e.value,quote:e.quote,originalAttribute:e.originalAttribute,location:o,keyLocation:a,valueLocation:s,meta:i?.attributes[e.key]??null};this.trigger("attr",r),t.setAttribute(e.key,e.value,a,s,e.originalAttribute)}}getAttributeKeyLocation(e){return e.location}getAttributeValueLocation(e){return e&&e.type===e7.ATTR_VALUE&&""!==e.data[2]?e.data[3]?P(e.location,2,-1):P(e.location,1):null}getAttributeLocation(e,t){let r=e.location,n=t&&t.type===e7.ATTR_VALUE?t.location:void 0;return{filename:r.filename,line:r.line,column:r.column,size:r.size+(n?.size??0),offset:r.offset}}consumeDirective(e){let[t,r,n,i,a,s]=e.data;if(!s.startsWith("]"))throw new ij(e.location,`Missing end bracket "]" on directive "${t}"`);let o=/^(.*?)(?:(\s*(?:--|:)\s*)(.*))?$/.exec(a);if(!o)throw Error(`Failed to parse directive "${t}"`);if(!["enable","disable","disable-block","disable-next"].includes(n))throw new ij(e.location,`Unknown directive "${n}"`);let[,l,u,c]=o,d=r.length,h=d+n.length+i.length,m=h+l.length+(u||"").length,p=P(e.location,r.length-14-1,-s.length+1),f=P(e.location,d,d+n.length),g=l?P(e.location,h,h+l.length):void 0,y=c?P(e.location,m,m+c.length):void 0;this.trigger("directive",{action:n,data:l,comment:c||"",location:p,actionLocation:f,optionsLocation:g,commentLocation:y})}
30consumeConditional(e){let t=this.dom.getActive();this.trigger("conditional",{condition:e.data[1],location:e.location,parent:t})}consumeComment(e){let t=e.data[0],r=this.dom.getActive();for(let n of function*(e,t){let r;for(;null!==(r=iM.exec(e));){let n=r[1],i=r.index,a=i+r[0].length,s=P(t,i,a,e);yield{expression:n,location:s}}}(t,e.location))this.trigger("conditional",{condition:n.expression,location:n.location,parent:r})}consumeDoctype(e,t){let r=Array.from(this.consumeUntil(t,e7.DOCTYPE_CLOSE,e.location)),n=r[0].data[0];this.dom.doctype=n,this.trigger("doctype",{tag:e.data[1],value:n,valueLocation:r[0].location,location:e.location})}*consumeUntil(e,t,r){let n=this.next(e);for(;!n.done;){let r=n.value;if(yield r,r.type===t)return;n=this.next(e)}throw new ij(r,`stream ended before ${e7[t]} token was found`)}consumeUntilMatchingTag(e,t,r){let n=1,i=this.next(t);for(;!i.done;){let a=i.value;if(this.consume(e,a,t),a.type===e7.TAG_OPEN){let[,e,t]=a.data;if(t===r&&(e?n--:n++,0===n))return}i=this.next(t)}}next(e){let t=e.next();if(!t.done){let e=t.value;this.trigger("token",{location:e.location,type:e.type,data:Array.from(e.data),token:e})}return t}on(e,t){return this.event.on(e,t)}once(e,t){return this.event.once(e,t)}defer(e){this.event.once("*",e)}trigger(e,t){if(void 0===t.location)throw Error("Triggered event must contain location");this.event.trigger(e,t)}getEventHandler(){return this.event}appendText(e,t){this.dom.getActive().appendText(e,t)}closeTree(e,t){let r,n=this.dom.root;for(;(r=this.dom.getActive())&&!r.isRootElement();)r.meta?.implicitClosed?(r.closed=eo.ImplicitClosed,this.closeElement(e,n,r,t)):this.closeElement(e,null,r,t),this.dom.popActive()}}let iF=1;class iz{report;config;ParserClass;availableRules;constructor(e,t){this.report=new iO,this.config=e,this.ParserClass=t;let r=this.initPlugins(this.config);this.availableRules={...ia,...r.availableRules}}lint(e){for(let t of e){let e=this.instantiateParser(),{rules:r}=this.setupPlugins(t,this.config,e),n=r["no-unused-disable"],i={rules:r,reportUnused(e,t,r,i){e.has(n.name)||n.reportUnused(t,r,i)}},a={filename:t.filename,line:1,column:1,offset:0,size:1},s={location:a,config:this.config,rules:r};e.trigger("config:ready",s);let{hooks:o,...l}=t,u={location:a,source:l};e.trigger("source:ready",u),e.on("directive",(t,r)=>{this.processDirective(r,e,i)});try{e.parseHtml(t)}catch(e){if(e instanceof tA||e instanceof ij)this.reportError("parser-error",e.message,e.location);else throw e}}return this.report.save(e)}dumpEvents(e){let t=this.instantiateParser(),r=[];return t.on("*",(e,t)=>{"token"!==e&&r.push({event:e,data:t})}),e.forEach(e=>t.parseHtml(e)),r}dumpTokens(e){let t=new tE,r=[];for(let n of e)for(let e of t.tokenize(n)){let t=e.data[0]??"",n=e.location.filename,i=String(e.location.line),a=String(e.location.column);r.push({token:e7[e.type],data:t,location:`${n}:${i}:${a}`})}return r}dumpTree(e){var t=this.instantiateParser().parseHtml(e[0]);let r=[];return!function e(t,n,i,a){let s=a===(t.parent?t.parent.childElements.length:0)-1;if(t.parent){let e;r.push(`${i}${s?"└":"├"}\u2500\u2500 ${t.tagName}${(e="",t.id&&(e+=`#${t.id}`),t.hasAttribute("class")&&(e+=`.${t.classList.join(".")}`),e)}`)}else r.push("(root)");t.childElements.forEach((t,r)=>{let a=n>0?`${i}${s?" ":"│"}   `:"";e(t,n+1,a,r)})}(t,0,"",0),r}getRuleDocumentation({ruleId:e,context:t}){let r=this.config.getRules().get(e);if(!r)return null;{let[,n]=r;return this.instantiateRule(e,n).documentation(t)}}instantiateParser(){return new this.ParserClass(this.config)}processDirective(e,t,r){let n=e.data.split(",").map(e=>e.trim()).map(e=>r.rules[e]).filter(e=>!!e),i=e.optionsLocation??e.location;switch(e.action){case"enable":this.processEnableDirective(n,t);break;case"disable":this.processDisableDirective(n,t);break;case"disable-block":this.processDisableBlockDirective(r,n,t,e.data,i);break;case"disable-next":this.processDisableNextDirective(r,n,t,e.data,i)}}processEnableDirective(e,t){for(let t of e)t.setEnabled(!0),t.getSeverity()===ef.DISABLED&&t.setServerity(ef.ERROR);t.on("tag:start",(t,r)=>{r.target.enableRules(e.map(e=>e.name))})}processDisableDirective(e,t){for(let t of e)t.setEnabled(!1);t.on("tag:start",(t,r)=>{r.target.disableRules(e.map(e=>e.name))})}processDisableBlockDirective(e,t,r,n,i){let a=new Set(t.map(e=>
30e.name)),s=new Set(a),o=iF++,l=null;for(let e of t)e.block(o);let u=r.on("tag:start",(e,t)=>{l??=t.target.parent?.unique??null,t.target.blockRules(a,o)}),c=r.on("tag:end",(e,r)=>{let n=null===l,i=l===r.previous.unique;if(n||i)for(let e of(c(),u(),t))e.unblock(o)});r.on("rule:error",(e,t)=>{t.blockers.includes(o)&&s.delete(t.ruleId)}),r.on("parse:end",()=>{e.reportUnused(a,s,n,i)})}processDisableNextDirective(e,t,r,n,i){let a=new Set(t.map(e=>e.name)),s=new Set(a),o=iF++;for(let e of t)e.block(o);let l=r.on("tag:start",(e,t)=>{t.target.blockRules(a,o)});r.on("rule:error",(e,t)=>{t.blockers.includes(o)&&s.delete(t.ruleId)}),r.on("parse:end",()=>{e.reportUnused(a,s,n,i)}),r.once("tag:ready, tag:end, attr",()=>{l(),r.defer(()=>{for(let e of t)e.unblock(o)})})}initPlugins(e){for(let t of e.getPlugins())t.init&&t.init();return{availableRules:this.initRules(e)}}initRules(e){let t={};for(let r of e.getPlugins())for(let[e,n]of Object.entries(r.rules??{}))n&&(t[e]=n);return t}setupPlugins(e,t,r){let n=r.getEventHandler();for(let r of t.getPlugins())r.setup&&r.setup(e,n);return{rules:this.setupRules(t,r)}}setupRules(e,t){let r={};for(let[n,[i,a]]of e.getRules().entries())r[n]=this.loadRule(n,e,i,a,t,this.report);return r}loadRule(e,t,r,n,i,a){let s=t.getMetaTable(),o=this.instantiateRule(e,n);return o.name=e,o.init(i,a,r,s),o.setup&&o.setup(),o}instantiateRule(e,t){return this.availableRules[e]?new this.availableRules[e](t):this.missingRule(e)}missingRule(e){return new class extends eG{setup(){this.on("dom:load",()=>{this.report(null,`Definition for rule '${e}' was not found`)})}}}reportError(e,t,r){this.report.addManual(r.filename,{ruleId:e,severity:ef.ERROR,message:t,offset:r.offset,line:r.line,column:r.column,size:r.size,selector:()=>null})}}let iU={VERSION:1};function iG(e){let t=e.api??0;if(t!==iU.VERSION)throw new e3(`Transformer uses API version ${String(t)} but only version ${String(iU.VERSION)} is supported`)}function iB(e,t,r,n){let i=e.get(r);if(i)return i;{let i=function(e,t,r){try{let n=function(e,t,r){let n=/(.*):(.*)/.exec(t);if(n){let[,e,i]=n,a=r.find(t=>t.name===e);if(!a)throw new e3(`No plugin named "${e}" has been loaded`);if(!a.transformer)throw new e3("Plugin does not expose any transformers");if("function"==typeof a.transformer)throw new e3(`Transformer "${t}" refers to named transformer but plugin exposes only unnamed, use "${e}" instead.`);let s=a.transformer[i];if(!s)throw new e3(`Plugin "${e}" does not expose a transformer named "${i}".`);return s}let i=r.find(e=>e.name===t);if(i){if(!i.transformer)throw new e3("Plugin does not expose any transformers");if("function"!=typeof i.transformer){if(i.transformer.default)return i.transformer.default;throw new e3(`Transformer "${t}" refers to unnamed transformer but plugin exposes only named.`)}return i.transformer}var a={cache:!0};for(let r of e.filter(im)){let n=r.resolveTransformer(t,a);if(is(n))return ib(e,t,a);if(n)return n}throw new p(`Failed to load transformer from "${t}"`)}(e,t,r);if(is(n))return n.then(e=>(iG(e),e));return iG(n),n}catch(e){if(e instanceof e3)throw new e3(`Failed to load transformer "${t}": ${e.message}`,e);throw new e3(`Failed to load transformer "${t}"`,h(e))}}(t,r,n);return is(i)?i.then(t=>(e.set(r,t),t)):(e.set(r,i),i)}}function iV(e){return e&&"object"==typeof e&&Symbol.iterator in e?Array.from(e):[e]}let iW="Cannot use async transformer from sync function";async function iH(e,t,r,n){let{cache:i}=t,a=t.findTransformer(n??r.filename);if(!a)return Promise.resolve([r]);let s="import"===a.kind?await iB(i,e,a.name,t.getPlugins()):a.function,o="import"===a.kind?a.name:a.function.name;try{let n=await s.call({hasChain:e=>t.canTransform(e),chain:(r,n)=>iH(e,t,r,n)},r),i=await Promise.all(iV(n));for(let e of i)e.transformedBy??=[],e.transformedBy.push(o);return i}catch(t){let e=t instanceof Error?t.message:String(t);throw new m(`When transforming "${r.filename}": ${e}`,h(t))}}function iX(e,t,r,n){let{cache:i}=t,a=t.findTransformer(n??r.filename);if(!a)return[r];let s="import"===a.kind?iB(i,e,a.name,t.getPlugins()):a.function,o="import"===a.kind?a.name:a.function.name;if(is(s))throw new p(iW);try{let n=s.call({hasChain:e=>t.canTransform(e),chain:(r,n)=>iX(e,t,r,n)},r);if(is(n))throw new p(iW);let i=iV(n);if(i.some(is))throw new p(iW);for(let e of i)e.transformedBy??=[],e.transformedBy.push(o);return i}catch(t){let e=t instanceof Error?t.message:String(t);
30throw new m(`When transforming "${r.filename}": ${e}`,h(t))}}function iY(e,t,r,n){let i="/dev/stdin"!==r?r:0,a=n.readFileSync(i,{encoding:"utf8"}),s="string"==typeof a?a:a.toString("utf8");return iH(e,t,{data:s,filename:r,line:1,column:1,offset:0,originalData:s},r)}function iJ(e,t,r,n){let i="/dev/stdin"!==r?r:0,a=n.readFileSync(i,{encoding:"utf8"}),s="string"==typeof a?a:a.toString("utf8");return iX(e,t,{data:s,filename:r,line:1,column:1,offset:0,originalData:s},r)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.