@angular-eslint/eslint-plugin-template 14.3.2-alpha.0 → 14.4.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,15 +1,2 @@
|
|
|
1
|
-
import type { ParseSourceSpan, TmplAstElement } from '@angular-eslint/bundled-angular-compiler';
|
|
2
|
-
import type { TSESLint, TSESTree } from '@typescript-eslint/utils';
|
|
3
1
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
4
|
-
export declare const createESLintRule: <TOptions extends readonly unknown[], TMessageIds extends string, TRuleListener extends
|
|
5
|
-
interface ParserServices {
|
|
6
|
-
convertNodeSourceSpanToLoc: (sourceSpan: ParseSourceSpan) => TSESTree.SourceLocation;
|
|
7
|
-
convertElementSourceSpanToLoc: (context: Readonly<TSESLint.RuleContext<string, readonly unknown[]>>, node: TmplAstElement) => TSESTree.SourceLocation;
|
|
8
|
-
}
|
|
9
|
-
export declare function getTemplateParserServices(context: Readonly<TSESLint.RuleContext<string, readonly unknown[]>>): ParserServices;
|
|
10
|
-
/**
|
|
11
|
-
* Utility for rule authors to ensure that their rule is correctly being used with @angular-eslint/template-parser
|
|
12
|
-
* If @angular-eslint/template-parser is not the configured parser when the function is invoked it will throw
|
|
13
|
-
*/
|
|
14
|
-
export declare function ensureTemplateParser(context: Readonly<TSESLint.RuleContext<string, readonly unknown[]>>): void;
|
|
15
|
-
export {};
|
|
2
|
+
export declare const createESLintRule: <TOptions extends readonly unknown[], TMessageIds extends string, TRuleListener extends import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener = import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>({ name, meta, ...rule }: Readonly<ESLintUtils.RuleWithMetaAndName<TOptions, TMessageIds, TRuleListener>>) => import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<TMessageIds, TOptions, TRuleListener>;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=require("path"),t=require("@typescript-eslint/type-utils"),n=require("typescript"),r=require("@typescript-eslint/utils"),a=require("@angular-eslint/bundled-angular-compiler"),o=require("aria-query");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=/*#__PURE__*/s(n);const i=new Map;var c={"extract-inline-html":{preprocess:function(n,r){const a=[n];if(!function(e,t){return!![".component.ts",".page.ts",".dialog.ts",".modal.ts",".popover.ts",".bottomsheet.ts",".snackbar.ts"].some(e=>t.endsWith(e))||!(!e.includes("Component")||!e.includes("@angular/core"))}(n,r))return a;try{const o=u.default.createSourceFile(r,n,u.default.ScriptTarget.Latest,!0),s=o.statements.filter(e=>u.default.isClassDeclaration(e));if(!s||!s.length)return a;const c=[];for(const e of s){const n=t.getDecorators(e);if(n)for(const e of n)u.default.isCallExpression(e.expression)&&u.default.isIdentifier(e.expression.expression)&&"Component"===e.expression.expression.text&&c.push(e)}if(!c||!c.length)return a;const l=[n];let p=0;for(const t of c){if(!u.default.isDecorator(t)||!u.default.isCallExpression(t.expression)||1!==t.expression.arguments.length)continue;const n=t.expression.arguments[0];if(!u.default.isObjectLiteralExpression(n))continue;const a=n.properties.find(e=>e&&e.name&&"template"===e.name.getText());if(n.properties.find(e=>e&&e.name&&"templateUrl"===e.name.getText())||!a)continue;if(!u.default.isPropertyAssignment(a))continue;let s;const c=a.initializer;if(u.default.isNoSubstitutionTemplateLiteral(c)&&(s=c.rawText),u.default.isTemplateExpression(c)&&(s=c.getText()),u.default.isStringLiteral(c)&&(s=c.text),!s)continue;const m=`inline-template-${e.basename(r)}-${++p}.component.html`,d=a.initializer.getStart(),f=a.initializer.getEnd();i.set(m,{range:[d,f],lineAndCharacter:{start:o.getLineAndCharacterOfPosition(d),end:o.getLineAndCharacterOfPosition(f)}}),l.push({text:s,filename:m})}return l}catch(e){return console.log(e),console.error("preprocess: ERROR could not parse @Component() metadata",r),a}},postprocess:function(t,n){const r=t[0];if(1===t.length)return r;const a=t.slice(1);return[...r,...a.flatMap((t,r)=>{const a=`inline-template-${e.basename(n)}-${++r}.component.html`,o=i.get(a);return o?t.map(e=>{if(e.line=e.line+o.lineAndCharacter.start.line,e.endLine=e.endLine+o.lineAndCharacter.start.line,e.fix){const t=o.range[0];e.fix.range=[t+e.fix.range[0],t+e.fix.range[1]]}return e}):[]})]},supportsAutofix:!0}};const l=e=>function({name:t,meta:n,defaultOptions:a,create:o}){return{meta:Object.assign(Object.assign({},n),{docs:Object.assign(Object.assign({},n.docs),{url:e(t)})}),defaultOptions:a,create(e){const t=r.ESLintUtils.applyDefault(a,e.options);return o(e,t)}}};l.withoutDocs=r.ESLintUtils.RuleCreator.withoutDocs;const p=l(e=>`https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin-template/docs/rules/${e}.md`);function m(e){return d(e),e.parserServices}function d(e){var t,n;if(null==(t=e.parserServices)||!t.convertNodeSourceSpanToLoc||null==(n=e.parserServices)||!n.convertElementSourceSpanToLoc)throw new Error("You have used a rule which requires '@angular-eslint/template-parser' to be used as the 'parser' in your ESLint config.")}const f=Symbol("PROPERTY_READ");function g(e){var t;const{details:n}=null!=(t=e.keySpan)?t:{};return n?e instanceof a.TmplAstBoundEvent?function({keySpan:{details:e},name:t}){return t===`${e}Change`}(e)?e.name:n:n.replace("attr.",""):e.name}function y({attributes:e,inputs:t},n){const r=[...e,...t].find(e=>g(e)===n);if("string"==typeof(null==r?void 0:r.value))return r.value;if(!((null==r?void 0:r.value)instanceof a.ASTWithSource))return null;if(r.value.ast instanceof a.LiteralArray)return r.value.ast.expressions;if(r.value.ast instanceof a.LiteralMap){const{keys:e,values:t}=r.value.ast;return e.reduce((e,n,r)=>e.set(n.key,t[r]),new Map)}return r.value.ast instanceof a.LiteralPrimitive?r.value.ast.value:f}var S=p({name:"accessibility-alt-text",meta:{type:"suggestion",docs:{description:"Enforces alternate text for elements which require the alt, aria-label, aria-labelledby attributes.",recommended:!1},schema:[],messages:{accessibilityAltText:"<{{element}}/> element must have a text alternative."}},defaultOptions:[],create(e){const t=m(e);return{"Element$1[name=/^(img|area|object|input)$/]"(n){if(!function(e){return"img"===e.name?function(e){return e.attributes.some(({name:e})=>b(e))||e.inputs.some(({name:e})=>b(e))}(e):"object"===e.name?function(e){let t=!1,n=!1;for(const r of e.attributes)t="title"===r.name,n=T(r.name);if(t||n)return!0;let r=!1,a=!1;for(const t of e.inputs)r="title"===t.name,a=T(t.name);return!(!r&&!a)||e.children.length>0&&!!e.children[0].value}(e):"area"===e.name?A(e):function(e){return"image"!==y(e,"type")||A(e)}(e)}(n)){const r=t.convertElementSourceSpanToLoc(e,n);e.report({loc:r,messageId:"accessibilityAltText",data:{element:n.name}})}}}}});function A(e){let t=!1,n=!1;for(const r of e.attributes)t=b(r.name),n=T(r.name);if(t||n)return!0;let r=!1,a=!1;for(const t of e.inputs)r=b(t.name),a=T(t.name);return r||a}function T(e){return"aria-label"===e||"aria-labelledby"===e}function b(e){return"alt"===e}var E="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function x(e){var t={exports:{}};return e(t,t.exports),t.exports}var h=x(function(e,t){var n,r;Object.defineProperty(t,"__esModule",{value:!0}),t.AST_TOKEN_TYPES=t.AST_NODE_TYPES=void 0,(n=t.AST_NODE_TYPES||(t.AST_NODE_TYPES={})).ArrayExpression="ArrayExpression",n.ArrayPattern="ArrayPattern",n.ArrowFunctionExpression="ArrowFunctionExpression",n.AssignmentExpression="AssignmentExpression",n.AssignmentPattern="AssignmentPattern",n.AwaitExpression="AwaitExpression",n.BinaryExpression="BinaryExpression",n.BlockStatement="BlockStatement",n.BreakStatement="BreakStatement",n.CallExpression="CallExpression",n.CatchClause="CatchClause",n.ChainExpression="ChainExpression",n.ClassBody="ClassBody",n.ClassDeclaration="ClassDeclaration",n.ClassExpression="ClassExpression",n.ConditionalExpression="ConditionalExpression",n.ContinueStatement="ContinueStatement",n.DebuggerStatement="DebuggerStatement",n.Decorator="Decorator",n.DoWhileStatement="DoWhileStatement",n.EmptyStatement="EmptyStatement",n.ExportAllDeclaration="ExportAllDeclaration",n.ExportDefaultDeclaration="ExportDefaultDeclaration",n.ExportNamedDeclaration="ExportNamedDeclaration",n.ExportSpecifier="ExportSpecifier",n.ExpressionStatement="ExpressionStatement",n.ForInStatement="ForInStatement",n.ForOfStatement="ForOfStatement",n.ForStatement="ForStatement",n.FunctionDeclaration="FunctionDeclaration",n.FunctionExpression="FunctionExpression",n.Identifier="Identifier",n.IfStatement="IfStatement",n.ImportAttribute="ImportAttribute",n.ImportDeclaration="ImportDeclaration",n.ImportDefaultSpecifier="ImportDefaultSpecifier",n.ImportExpression="ImportExpression",n.ImportNamespaceSpecifier="ImportNamespaceSpecifier",n.ImportSpecifier="ImportSpecifier",n.JSXAttribute="JSXAttribute",n.JSXClosingElement="JSXClosingElement",n.JSXClosingFragment="JSXClosingFragment",n.JSXElement="JSXElement",n.JSXEmptyExpression="JSXEmptyExpression",n.JSXExpressionContainer="JSXExpressionContainer",n.JSXFragment="JSXFragment",n.JSXIdentifier="JSXIdentifier",n.JSXMemberExpression="JSXMemberExpression",n.JSXNamespacedName="JSXNamespacedName",n.JSXOpeningElement="JSXOpeningElement",n.JSXOpeningFragment="JSXOpeningFragment",n.JSXSpreadAttribute="JSXSpreadAttribute",n.JSXSpreadChild="JSXSpreadChild",n.JSXText="JSXText",n.LabeledStatement="LabeledStatement",n.Literal="Literal",n.LogicalExpression="LogicalExpression",n.MemberExpression="MemberExpression",n.MetaProperty="MetaProperty",n.MethodDefinition="MethodDefinition",n.NewExpression="NewExpression",n.ObjectExpression="ObjectExpression",n.ObjectPattern="ObjectPattern",n.PrivateIdentifier="PrivateIdentifier",n.Program="Program",n.Property="Property",n.PropertyDefinition="PropertyDefinition",n.RestElement="RestElement",n.ReturnStatement="ReturnStatement",n.SequenceExpression="SequenceExpression",n.SpreadElement="SpreadElement",n.StaticBlock="StaticBlock",n.Super="Super",n.SwitchCase="SwitchCase",n.SwitchStatement="SwitchStatement",n.TaggedTemplateExpression="TaggedTemplateExpression",n.TemplateElement="TemplateElement",n.TemplateLiteral="TemplateLiteral",n.ThisExpression="ThisExpression",n.ThrowStatement="ThrowStatement",n.TryStatement="TryStatement",n.UnaryExpression="UnaryExpression",n.UpdateExpression="UpdateExpression",n.VariableDeclaration="VariableDeclaration",n.VariableDeclarator="VariableDeclarator",n.WhileStatement="WhileStatement",n.WithStatement="WithStatement",n.YieldExpression="YieldExpression",n.TSAbstractKeyword="TSAbstractKeyword",n.TSAbstractMethodDefinition="TSAbstractMethodDefinition",n.TSAbstractPropertyDefinition="TSAbstractPropertyDefinition",n.TSAnyKeyword="TSAnyKeyword",n.TSArrayType="TSArrayType",n.TSAsExpression="TSAsExpression",n.TSAsyncKeyword="TSAsyncKeyword",n.TSBigIntKeyword="TSBigIntKeyword",n.TSBooleanKeyword="TSBooleanKeyword",n.TSCallSignatureDeclaration="TSCallSignatureDeclaration",n.TSClassImplements="TSClassImplements",n.TSConditionalType="TSConditionalType",n.TSConstructorType="TSConstructorType",n.TSConstructSignatureDeclaration="TSConstructSignatureDeclaration",n.TSDeclareFunction="TSDeclareFunction",n.TSDeclareKeyword="TSDeclareKeyword",n.TSEmptyBodyFunctionExpression="TSEmptyBodyFunctionExpression",n.TSEnumDeclaration="TSEnumDeclaration",n.TSEnumMember="TSEnumMember",n.TSExportAssignment="TSExportAssignment",n.TSExportKeyword="TSExportKeyword",n.TSExternalModuleReference="TSExternalModuleReference",n.TSFunctionType="TSFunctionType",n.TSInstantiationExpression="TSInstantiationExpression",n.TSImportEqualsDeclaration="TSImportEqualsDeclaration",n.TSImportType="TSImportType",n.TSIndexedAccessType="TSIndexedAccessType",n.TSIndexSignature="TSIndexSignature",n.TSInferType="TSInferType",n.TSInterfaceBody="TSInterfaceBody",n.TSInterfaceDeclaration="TSInterfaceDeclaration",n.TSInterfaceHeritage="TSInterfaceHeritage",n.TSIntersectionType="TSIntersectionType",n.TSIntrinsicKeyword="TSIntrinsicKeyword",n.TSLiteralType="TSLiteralType",n.TSMappedType="TSMappedType",n.TSMethodSignature="TSMethodSignature",n.TSModuleBlock="TSModuleBlock",n.TSModuleDeclaration="TSModuleDeclaration",n.TSNamedTupleMember="TSNamedTupleMember",n.TSNamespaceExportDeclaration="TSNamespaceExportDeclaration",n.TSNeverKeyword="TSNeverKeyword",n.TSNonNullExpression="TSNonNullExpression",n.TSNullKeyword="TSNullKeyword",n.TSNumberKeyword="TSNumberKeyword",n.TSObjectKeyword="TSObjectKeyword",n.TSOptionalType="TSOptionalType",n.TSParameterProperty="TSParameterProperty",n.TSPrivateKeyword="TSPrivateKeyword",n.TSPropertySignature="TSPropertySignature",n.TSProtectedKeyword="TSProtectedKeyword",n.TSPublicKeyword="TSPublicKeyword",n.TSQualifiedName="TSQualifiedName",n.TSReadonlyKeyword="TSReadonlyKeyword",n.TSRestType="TSRestType",n.TSStaticKeyword="TSStaticKeyword",n.TSStringKeyword="TSStringKeyword",n.TSSymbolKeyword="TSSymbolKeyword",n.TSTemplateLiteralType="TSTemplateLiteralType",n.TSThisType="TSThisType",n.TSTupleType="TSTupleType",n.TSTypeAliasDeclaration="TSTypeAliasDeclaration",n.TSTypeAnnotation="TSTypeAnnotation",n.TSTypeAssertion="TSTypeAssertion",n.TSTypeLiteral="TSTypeLiteral",n.TSTypeOperator="TSTypeOperator",n.TSTypeParameter="TSTypeParameter",n.TSTypeParameterDeclaration="TSTypeParameterDeclaration",n.TSTypeParameterInstantiation="TSTypeParameterInstantiation",n.TSTypePredicate="TSTypePredicate",n.TSTypeQuery="TSTypeQuery",n.TSTypeReference="TSTypeReference",n.TSUndefinedKeyword="TSUndefinedKeyword",n.TSUnionType="TSUnionType",n.TSUnknownKeyword="TSUnknownKeyword",n.TSVoidKeyword="TSVoidKeyword",(r=t.AST_TOKEN_TYPES||(t.AST_TOKEN_TYPES={})).Boolean="Boolean",r.Identifier="Identifier",r.JSXIdentifier="JSXIdentifier",r.JSXText="JSXText",r.Keyword="Keyword",r.Null="Null",r.Numeric="Numeric",r.Punctuator="Punctuator",r.RegularExpression="RegularExpression",r.String="String",r.Template="Template",r.Block="Block",r.Line="Line"});Object.defineProperty(exports,"__esModule",{value:!0});var v={__proto__:null};Object.defineProperty(exports,"__esModule",{value:!0});var C={__proto__:null},F=x(function(e,t){var n=E&&E.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var a=Object.getOwnPropertyDescriptor(t,n);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,a)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),r=E&&E.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=E&&E.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)"default"!==a&&Object.prototype.hasOwnProperty.call(e,a)&&n(t,e,a);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.TSESTree=void 0,t.TSESTree=a(h)}),D=x(function(e,t){var n=E&&E.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var a=Object.getOwnPropertyDescriptor(t,n);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,a)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),r=E&&E.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.AST_TOKEN_TYPES=t.AST_NODE_TYPES=void 0,Object.defineProperty(t,"AST_NODE_TYPES",{enumerable:!0,get:function(){return h.AST_NODE_TYPES}}),Object.defineProperty(t,"AST_TOKEN_TYPES",{enumerable:!0,get:function(){return h.AST_TOKEN_TYPES}}),r(v,t),r(C,t),r(F,t)});function B({parent:e},t){for(;e&&e.type!==D.AST_NODE_TYPES.Program;){if(t(e))return e;e=e.parent}return null}function I(e){if(B(e,N)||function(e){const t=y(e,"style");if("string"!=typeof t)return!1;const n=t.replace(/[\s'"]/g,"");return n.includes("display:none")||n.includes("visibility:hidden")}(e)||function(e){const t=y(e,"ngStyle");return t instanceof Map&&("none"===t.get("display")||"hidden"===t.get("visibility"))}(e)||function(e){return"none"===y(e,"style.display")||"true"===String(y(e,"style.display.none"))||"hidden"===y(e,"style.visibility")||"true"===String(y(e,"style.visibility.hidden"))}(e)||w(e,"aria-hidden")||w(e,"hidden"))return!0;if("INPUT"!==e.name.toUpperCase())return!1;const t=y(e,"type");return"string"==typeof t&&"HIDDEN"===t.toUpperCase()}function w(e,t){const n=y(e,t);return""===n||"true"===String(n)}function N(e){return e instanceof a.TmplAstElement&&I(e)}const O=["aria-label","innerHtml","innerHTML","innerText","outerHTML","title"];var P=p({name:"accessibility-elements-content",meta:{type:"suggestion",docs:{description:"Ensures that the heading, anchor and button elements have content in it",recommended:!1},schema:[{additionalProperties:!1,properties:{allowList:{items:{type:"string"},type:"array",uniqueItems:!0}},type:"object"}],messages:{accessibilityElementsContent:"<{{element}}> should have content"}},defaultOptions:[{allowList:O}],create(e,[{allowList:t}]){const n=m(e);return{"Element$1[name=/^(a|button|h1|h2|h3|h4|h5|h6)$/][children.length=0]"(r){if(I(r))return;const{attributes:a,inputs:o,name:s,sourceSpan:u}=r,i=new Set([...O,...null!=t?t:[]]);if([...a,...o].map(({name:e})=>e).some(e=>i.has(e)))return;const c=n.convertNodeSourceSpanToLoc(u);e.report({loc:c,messageId:"accessibilityElementsContent",data:{element:s}})}}}});let L=null;function k(){var e;return null!=(e=L)?e:L=new Set(o.dom.keys())}let R=null,_=null,$=null,j=null;function q(){if(null===j){const e=[...o.roles.keys()];j=new Set(e.filter(e=>{const t=o.roles.get(e);return t&&!t.abstract&&"toolbar"!==e&&!t.superClass.some(e=>e.includes("widget"))}).concat("progressbar"))}return j}function K(e){return k().has(e.name)&&function(e){function t({attributes:t,name:n}){return e.name===n&&function(e,t){const n=[...t.attributes,...t.inputs];return e.every(e=>n.some(({name:n})=>"a"===t.name&&"routerLink"===n||e.name===n&&(!e.value||e.value===y(t,e.name))))}(null!=t?t:[],e)}return!!function(){if(null===_){const e=[...o.roles.keys()],t=[...o.elementRoles.entries()],n=new Set(e.filter(e=>{const t=o.roles.get(e);return t&&!t.abstract&&"progressbar"!==e&&t.superClass.some(e=>e.includes("widget"))}).concat("toolbar"));_=t.reduce((e,[t,r])=>e.concat([...r].every(e=>n.has(e))?t:[]),[])}return _}().some(t)||!function(){if(null===$){const e=[...o.elementRoles.entries()];$=e.reduce((e,[t,n])=>e.concat([...n].every(e=>q().has(e))?t:[]),[])}return $}().some(t)&&function(){if(null===R){const{AXObjects:e,elementAXObjects:t}=require("axobject-query"),n=new Set(Array.from(e.keys()).filter(t=>"widget"===e.get(t).type));R=[...t.entries()].reduce((e,[t,r])=>e.concat([...r].every(e=>n.has(e))?t:[]),[])}return R}().some(t)}(e)}const M=new Set(["none","presentation"]);function U(e){const t=y(e,"role");return"string"==typeof t&&M.has(t)}const X="accessibility-interactive-supports-focus";var J=p({name:X,meta:{type:"suggestion",docs:{description:"Ensures that elements with interactive handlers like `(click)` are focusable.",recommended:!1},schema:[],messages:{interactiveSupportsFocus:"Elements with interaction handlers must be focusable."}},defaultOptions:[],create:e=>({Element$1(t){const n=t.name;if(!k().has(n))return;const r=t.outputs.find(e=>"click"===e.name||e.name.startsWith("keyup")||e.name.startsWith("keydown")||e.name.startsWith("keypress"));if(!r||function(e){const t=[...e.attributes,...e.inputs].find(e=>"disabled"===g(e)),n=y(e,"disabled");return!((!t||void 0===n)&&"true"!==String(y(e,"aria-disabled")).toLowerCase())}(t)||I(t)||U(t))return;const a=[...t.attributes,...t.inputs].find(e=>"tabindex"===e.name);if(r&&!a&&!K(t)&&!function(e){return function(e){return q().has(y(e,"role"))}(e)}(t)&&!function(e){const t=[...e.attributes,...e.inputs].find(e=>"contenteditable"===g(e)),n=y(e,"contenteditable");return!!t&&(""===n||"true"===String(n).toLowerCase())}(t)){const n=m(e).convertNodeSourceSpanToLoc(t.sourceSpan);e.report({loc:n,messageId:"interactiveSupportsFocus"})}}})});function W(e,t){return function e({children:n}){return n.some(n=>n instanceof a.TmplAstElement&&(n.name===t||e(n)))}(e)}const Y={items:{type:"string"},type:"array",uniqueItems:!0},V=["button","input","meter","output","progress","select","textarea"],H=["for","htmlFor"],G=["label"];var z=p({name:"accessibility-label-for",meta:{deprecated:!0,replacedBy:["accessibility-label-has-associated-control"],type:"suggestion",docs:{description:"Ensures that a label element/component is associated with a form element",recommended:!1},schema:[{additionalProperties:!1,properties:{controlComponents:{...Y},labelAttributes:{...Y},labelComponents:{...Y}},type:"object"}],messages:{accessibilityLabelFor:"A label element/component must be associated with a form element"}},defaultOptions:[{controlComponents:V,labelAttributes:H,labelComponents:G}],create(e,[t]){const n=m(e),{controlComponents:r,labelAttributes:a,labelComponents:o}=function({controlComponents:e,labelAttributes:t,labelComponents:n}){return{controlComponents:new Set([...V,...null!=e?e:[]]),labelAttributes:new Set([...H,...null!=t?t:[]]),labelComponents:new Set([...G,...null!=n?n:[]])}}(t);var s;return{[`Element$1[name=${s=[...o],RegExp(`^(${s.join("|")})$`)}]`](t){const o=new Set([...t.attributes,...t.inputs].map(({name:e})=>e));if([...a].some(e=>o.has(e))||function(e,t){return Boolean([...e].some(e=>W(t,e)))}(r,t))return;const s=n.convertNodeSourceSpanToLoc(t.sourceSpan);e.report({loc:s,messageId:"accessibilityLabelFor"})}}}});const Q="accessibility-label-has-associated-control",Z=["input","meter","output","progress","select","textarea"],ee=[{inputs:["for","htmlFor"],selector:"label"}];var te=p({name:Q,meta:{type:"suggestion",docs:{description:"Ensures that a label element/component is associated with a form element",recommended:!1},schema:[{additionalProperties:!1,properties:{controlComponents:{items:{type:"string"},type:"array",uniqueItems:!0},labelComponents:{items:{additionalProperties:!1,properties:{inputs:{items:{type:"string"},type:"array",uniqueItems:!0},selector:{type:"string"}},required:["selector"],type:"object"},type:"array",uniqueItems:!0}},type:"object"}],messages:{accessibilityLabelHasAssociatedControl:"A label component must be associated with a form element"}},defaultOptions:[{controlComponents:Z,labelComponents:ee}],create(e,[{controlComponents:t,labelComponents:n}]){const r=m(e),a=new Set([...Z,...null!=t?t:[]]),o=[...ee,...null!=n?n:[]],s=o.map(({selector:e})=>e);return{[`Element$1[name=${RegExp(`^(${s.join("|")})$`)}]`](t){var n;const s=o.find(({selector:e})=>e===t.name);if(!s)return;const u=new Set([...t.attributes,...t.inputs].map(({name:e})=>e));if((null==(n=s.inputs)?void 0:n.some(e=>u.has(e)))||function(e,t){return Boolean([...e].some(e=>W(t,e)))}(a,t))return;const i=r.convertNodeSourceSpanToLoc(t.sourceSpan);e.report({loc:i,messageId:"accessibilityLabelHasAssociatedControl"})}}}});function ne(e){return RegExp(`^(${e.join("|")})$`)}let re=null,ae=null;const oe="accessibility-role-has-required-aria";var se=p({name:oe,meta:{type:"suggestion",docs:{description:"Ensures elements with ARIA roles have all required properties for that role.",recommended:!1},hasSuggestions:!0,schema:[],messages:{roleHasRequiredAria:'The {{element}} with role="{{role}}" does not have required ARIA properties: {{missingProps}}',suggestRemoveRole:"Remove role `{{role}}`"}},defaultOptions:[],create(e){const t=m(e);return{[`Element$1[name=${ne([...k()])}] > TextAttribute[name='role']`](n){const{value:r,sourceSpan:a}=n,{attributes:s,inputs:u,name:i}=n.parent,c=[...s,...u],l=o.roles.get(r),p=Object.keys((null==l?void 0:l.requiredProps)||{});if(!p.length)return;if(function(e,t,n){var r,a;if(null===re||null===ae){const{AXObjectRoles:e,elementAXObjects:t}=require("axobject-query");re=t,ae=e}return Array.from(null!=(r=null==(a=re)?void 0:a.keys())?r:[]).some(r=>{var a,o,s;return r.name===e&&(null!=(a=r.attributes)?a:[]).every(e=>n.find(t=>e.name===t.name&&e.value===t.value))&&(null==(o=re)||null==(s=o.get(r))?void 0:s.find(e=>{var n,r;return null==(n=ae)||null==(r=n.get(e))?void 0:r.find(e=>e.name===t)}))})}(i,r,c))return;const m=p.filter(e=>!c.find(t=>t.name===e)).join(", ");if(m){const n=t.convertNodeSourceSpanToLoc(a);e.report({loc:n,messageId:"roleHasRequiredAria",data:{element:i,role:r,missingProps:m},suggest:[{messageId:"suggestRemoveRole",data:{element:i,role:r,missingProps:m},fix:e=>e.removeRange([(null==a?void 0:a.start.offset)-1,null==a?void 0:a.end.offset])}]})}}}}}),ue=p({name:"accessibility-table-scope",meta:{type:"suggestion",docs:{description:"Ensures that the `scope` attribute is only used on the `<th>` element",recommended:!1},fixable:"code",schema:[],messages:{accessibilityTableScope:"The `scope` attribute should only be on the `<th>` element"}},defaultOptions:[],create(e){const t=m(e);return{[`Element$1[name=${ne([...k()].filter(e=>"th"!==e))}] > :matches(BoundAttribute, TextAttribute)[name='scope']`]({sourceSpan:n}){const r=t.convertNodeSourceSpanToLoc(n);e.report({loc:r,messageId:"accessibilityTableScope",fix:e=>e.removeRange([n.start.offset-1,n.end.offset])})}}}}),ie=p({name:"accessibility-valid-aria",meta:{type:"suggestion",docs:{description:"Ensures that correct ARIA attributes and respective values are used",recommended:!1},hasSuggestions:!0,schema:[],messages:{accessibilityValidAria:"The `{{attribute}}` is an invalid ARIA attribute",accessibilityValidAriaValue:"The `{{attribute}}` has an invalid value. Check the valid values at https://raw.githack.com/w3c/aria/stable/#roles",suggestRemoveInvalidAria:"Remove attribute `{{attribute}}`"}},defaultOptions:[],create(e){const t=m(e);return{[`Element$1[name=${ne([...k()])}] > :matches(BoundAttribute, TextAttribute)[name=/^aria-.+/]`](n){const{name:r,sourceSpan:s}=n,u=o.aria.get(r),i=t.convertNodeSourceSpanToLoc(s);if(!u)return void e.report({loc:i,messageId:"accessibilityValidAria",data:{attribute:r},suggest:[{messageId:"suggestRemoveInvalidAria",data:{attribute:r},fix:e=>e.removeRange([s.start.offset-1,s.end.offset])}]});const c=function(e){return e instanceof a.TmplAstBoundAttribute&&e.value instanceof a.ASTWithSource?e.value.ast:e}(n);(function(e){return!function(e){return e instanceof a.LiteralArray||e instanceof a.LiteralMap}(e)&&!function(e){return e instanceof a.LiteralPrimitive||e instanceof a.TmplAstTextAttribute}(e)})(c)||function({allowundefined:e,type:t,values:n},r){if(e&&le(r))return!0;switch(t){case"boolean":return ce(r);case"tristate":return ce(r)||le(r);case"id":case"idlist":return!0;case"integer":return a=r,!Number.isNaN(a)&&parseInt(Number(a))==a&&!Number.isNaN(parseInt(a,10));case"number":return function(e){return!Number.isNaN(Number.parseFloat(e))&&Number.isFinite(e)}(r);case"string":return function(e){return"string"==typeof e}(r);case"token":case"tokenlist":{const e=ce(r)?JSON.parse(r):r;return Boolean(null==n?void 0:n.includes(e))}}var a}(u,c.value)||e.report({loc:i,messageId:"accessibilityValidAriaValue",data:{attribute:r}})}}}});function ce(e){return"boolean"==typeof e||"false"===e||"true"===e}function le(e){return null==e}const pe={alphabetical:!1,order:["STRUCTURAL_DIRECTIVE","TEMPLATE_REFERENCE","ATTRIBUTE_BINDING","INPUT_BINDING","TWO_WAY_BINDING","OUTPUT_BINDING"]};var me=p({name:"attributes-order",meta:{type:"layout",docs:{description:"Ensures that HTML attributes and Angular bindings are sorted based on an expected order",recommended:!1},fixable:"code",schema:[{type:"object",properties:{alphabetical:{type:"boolean",default:pe.alphabetical},order:{type:"array",items:{enum:pe.order},default:pe.order,minItems:pe.order.length,uniqueItems:!0}},additionalProperties:!1}],messages:{attributesOrder:"The element's attributes/bindings did not match the expected order: expected {{expected}} instead of {{actual}}"}},defaultOptions:[pe],create(e,[{alphabetical:t,order:n}]){const r=m(e);function a(e){const t=r.convertNodeSourceSpanToLoc(e.sourceSpan);switch(e.orderType){case"STRUCTURAL_DIRECTIVE":return{start:{line:t.start.line,column:t.start.column-1},end:{line:t.end.line,column:t.end.column+1}};default:return t}}return{Element$1(r){const{attributes:o,inputs:s,outputs:u,references:i}=r,{extractedBananaBoxes:c,extractedInputs:l,extractedOutputs:p}=function(e,t){const n=e.filter(e=>!t.some(t=>xe(e,t))).map(ye),{extractedBananaBoxes:r,extractedOutputs:a}=t.reduce(({extractedBananaBoxes:t,extractedOutputs:n},r)=>{const a=e.find(e=>xe(e,r));return{extractedBananaBoxes:t.concat(a?Te(a):[]),extractedOutputs:n.concat(a?[]:Ae(r))}},{extractedBananaBoxes:[],extractedOutputs:[]});return{extractedBananaBoxes:r,extractedInputs:n,extractedOutputs:a}}(s.map(ye),u.map(Ae)),m=[...Ee(r),...o.map(ge),...i.map(be),...c,...l,...p];if(m.length<2)return;const d=[...m].sort(de),f=[...m].sort(function(e,t){return function(n,r){const a=fe(n,e)-fe(r,e);return t&&0===a?n.name>r.name?1:-1:a}}(n,t));let g;for(let e=0;e<d.length;e++){var y,S;d[e]!==f[e]&&(g=[null!=(y=null==(S=g)?void 0:S[0])?y:e,e])}if(g){const[t,n]=g,r=e.getSourceCode(),{start:o}=a(d[t]),{end:s}=a(d[n]),u={start:o,end:s},i=[ve(d[t]),Ce(d[n])];let c="",l=i[0];for(let e=t;e<=n;e++){const t=d[e],n=ve(t),a=Ce(t),o=f[e],s=ve(o),u=Ce(o);c+=r.text.slice(l,n),c+=r.text.slice(s,u),l=a}e.report({loc:u,messageId:"attributesOrder",data:{expected:f.slice(t,n+1).map(e=>`\`${he(e)}\``).join(", "),actual:d.slice(t,n+1).map(e=>`\`${he(e)}\``).join(", ")},fix:e=>e.replaceTextRange(i,c)})}}}}});function de(e,t){return e.sourceSpan.start.line===t.sourceSpan.start.line?e.sourceSpan.start.col-t.sourceSpan.start.col:e.sourceSpan.start.line-t.sourceSpan.start.line}function fe(e,t){return t.indexOf(e.orderType)}function ge(e){return{...e,orderType:"ATTRIBUTE_BINDING"}}function ye(e){return{...e,orderType:"INPUT_BINDING"}}function Se(e){return{...e,orderType:"STRUCTURAL_DIRECTIVE"}}function Ae(e){return{...e,orderType:"OUTPUT_BINDING"}}function Te(e){return{...e,orderType:"TWO_WAY_BINDING"}}function be(e){return{...e,orderType:"TEMPLATE_REFERENCE"}}function Ee(e){return function(e){return e instanceof a.TmplAstTemplate}(e.parent)?e.parent.templateAttrs.map(Se):[]}function xe(e,t){return e.sourceSpan.start===t.sourceSpan.start&&e.sourceSpan.end===t.sourceSpan.end}function he(e){switch(e.orderType){case"STRUCTURAL_DIRECTIVE":return`*${e.name}`;case"TEMPLATE_REFERENCE":return`#${e.name}`;case"INPUT_BINDING":return`[${e.name}]`;case"OUTPUT_BINDING":return`(${e.name})`;case"TWO_WAY_BINDING":return`[(${e.name})]`;default:return e.name}}function ve(e){switch(e.orderType){case"STRUCTURAL_DIRECTIVE":return e.sourceSpan.start.offset-1;default:return e.sourceSpan.start.offset}}function Ce(e){switch(e.orderType){case"STRUCTURAL_DIRECTIVE":return e.sourceSpan.end.offset+1;default:return e.sourceSpan.end.offset}}const Fe=/\[(.*)\]/;var De=p({name:"banana-in-box",meta:{type:"suggestion",docs:{description:"Ensures that the two-way data binding syntax is correct",recommended:"error"},fixable:"code",schema:[],messages:{bananaInBox:"Invalid binding syntax. Use [(expr)] instead"}},defaultOptions:[],create(e){const t=m(e),n=e.getSourceCode();return{BoundEvent({name:r,sourceSpan:a}){const o=r.match(Fe);if(!o)return;const s=t.convertNodeSourceSpanToLoc(a);e.report({messageId:"bananaInBox",loc:s,fix:e=>{const[,t]=o,a=`[(${t})]`,u=n.getIndexFromLoc(s.start);return e.replaceTextRange([u,u+r.length+2],a)}})}}}});const Be=["button","submit","reset"];var Ie=p({name:"button-has-type",meta:{type:"suggestion",docs:{description:"Ensures that a button has a valid type specified",recommended:!1},schema:[],messages:{missingType:"Type for <button> is missing",invalidType:'"{{type}}" can not be used as a type for <button>'}},defaultOptions:[],create(e){const t=m(e);return{"Element$1[name=button]"(n){(function({inputs:e,attributes:t}){return[...e,...t].some(({name:e})=>"type"===e)})(n)||e.report({loc:t.convertNodeSourceSpanToLoc(n.sourceSpan),messageId:"missingType"});const r=function(e){const t=e.attributes.find(({name:e,value:t})=>"type"===e&&!Be.includes(t));if(t)return{sourceSpan:t.sourceSpan,value:t.value};for(const{name:t,value:n,sourceSpan:r}of e.inputs)if("type"===t&&n instanceof a.ASTWithSource&&n.ast instanceof a.LiteralPrimitive&&!Be.includes(n.ast.value))return{value:n.ast.value,sourceSpan:r};return null}(n);null!=r&&e.report({loc:t.convertNodeSourceSpanToLoc(r.sourceSpan),messageId:"invalidType",data:{type:r.value}})}}}}),we=p({name:"click-events-have-key-events",meta:{type:"suggestion",docs:{description:"Ensures that the click event is accompanied with at least one key event keyup, keydown or keypress.",recommended:!1},schema:[],messages:{clickEventsHaveKeyEvents:"click must be accompanied by either keyup, keydown or keypress event for accessibility."}},defaultOptions:[],create:e=>({Element$1(t){if(!k().has(t.name))return;if(U(t)||I(t)||K(t))return;let n=!1,r=!1;for(const e of t.outputs)n=n||"click"===e.name,r=r||e.name.startsWith("keyup")||e.name.startsWith("keydown")||e.name.startsWith("keypress");if(!n||r)return;const a=m(e).convertNodeSourceSpanToLoc(t.sourceSpan);e.report({loc:a,messageId:"clickEventsHaveKeyEvents"})}})}),Ne=p({name:"conditional-complexity",meta:{type:"suggestion",docs:{description:"The conditional complexity should not exceed a rational limit",recommended:!1},schema:[{type:"object",properties:{maxComplexity:{minimum:1,type:"number"}},additionalProperties:!1}],messages:{conditionalComplexity:"The conditional complexity {{totalComplexity}} exceeds the defined limit {{maxComplexity}}"}},defaultOptions:[{maxComplexity:5}],create(e,[{maxComplexity:t}]){d(e);const n=e.getSourceCode();return{BoundAttribute(r){if(!r.value.source||r.value.ast instanceof a.Interpolation)return;const o=Le(Oe((Pe||(Pe=new a.Parser(new a.Lexer))).parseBinding(r.value.source,"",0).ast));if(o<=t)return;const{sourceSpan:{start:s,end:u}}=r.value;e.report({loc:{start:n.getLocFromIndex(s),end:n.getLocFromIndex(u)},messageId:"conditionalComplexity",data:{maxComplexity:t,totalComplexity:o}})},Interpolation({expressions:r}){for(const a of r){const r=Le(a);if(r<=t)continue;const{sourceSpan:{start:o,end:s}}=a;e.report({loc:{start:n.getLocFromIndex(o),end:n.getLocFromIndex(s)},messageId:"conditionalComplexity",data:{maxComplexity:t,totalComplexity:r}})}}}}});function Oe(e){return e instanceof a.BindingPipe?e.exp:e}let Pe=null;function Le(e){const t=Oe(e);if(!(t instanceof a.Binary||t instanceof a.Conditional))return 0;let n=1;return t instanceof a.Binary&&(t.left instanceof a.Binary&&(n+=Le(t.left)),t.right instanceof a.Binary&&(n+=Le(t.right))),t instanceof a.Conditional&&(n+=Le(t.condition)+Le(t.trueExp)+Le(t.falseExp)),n}var ke=p({name:"cyclomatic-complexity",meta:{type:"suggestion",docs:{description:"Checks cyclomatic complexity against a specified limit. It is a quantitative measure of the number of linearly independent paths through a program's source code",recommended:!1},schema:[{type:"object",properties:{maxComplexity:{type:"number",minimum:1}},additionalProperties:!1}],messages:{cyclomaticComplexity:"The cyclomatic complexity {{totalComplexity}} exceeds the defined limit {{maxComplexity}}"}},defaultOptions:[{maxComplexity:5}],create(e,[{maxComplexity:t}]){let n=0;const r=m(e);return{'BoundAttribute[name=/^(ngForOf|ngIf|ngSwitchCase)$/], TextAttribute[name="ngSwitchDefault"]'({sourceSpan:a}){if(n+=1,n<=t)return;const o=r.convertNodeSourceSpanToLoc(a);e.report({messageId:"cyclomaticComplexity",loc:o,data:{maxComplexity:t,totalComplexity:n}})}}}});const Re={allowNullOrUndefined:!1};var _e=p({name:"eqeqeq",meta:{type:"suggestion",docs:{description:"Requires `===` and `!==` in place of `==` and `!=`",recommended:"error"},hasSuggestions:!0,fixable:"code",schema:[{type:"object",properties:{allowNullOrUndefined:{type:"boolean",default:Re.allowNullOrUndefined}},additionalProperties:!1}],messages:{eqeqeq:"Expected `{{expectedOperation}}` but received `{{actualOperation}}`",suggestStrictEquality:"Replace `{{actualOperation}}` with `{{expectedOperation}}`"}},defaultOptions:[Re],create(e,[{allowNullOrUndefined:t}]){d(e);const n=e.getSourceCode();return{"Binary[operation=/^(==|!=)$/]"(r){const{left:a,operation:o,right:s,sourceSpan:{start:u,end:i}}=r;if(t&&(Ue(a)||Ue(s)))return;const c={actualOperation:o,expectedOperation:`${o}=`};e.report({loc:{start:n.getLocFromIndex(u),end:n.getLocFromIndex(i)},messageId:"eqeqeq",data:c,...Me(a)||Me(s)?{fix:e=>je({node:r,left:a,right:s,start:u,end:i,fixer:e})}:{suggest:[{messageId:"suggestStrictEquality",fix:e=>je({node:r,left:a,right:s,start:u,end:i,fixer:e}),data:c}]}})}}}});function $e({span:{start:e,end:t}}){return t-e}const je=({node:e,left:t,right:n,start:r,end:a,fixer:o})=>{var s;const{source:u}=null!=(s=B(e,qe))?s:{};return u?o.insertTextAfterRange([r+$e(t)+1,a-$e(n)-1],"="):null};function qe(e){return e instanceof a.ASTWithSource}function Ke(e){return e instanceof a.LiteralPrimitive}function Me(e){return Ke(e)&&"string"==typeof e.value&&(t=e.value,!(!Number.isNaN(Number.parseFloat(String(t)))&&Number.isFinite(Number(t))));var t}function Ue(e){return Ke(e)&&null==e.value}const Xe=/[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7C6\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB67\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,Je=new RegExp(`[^${Xe}]`),We=new Set(["charset","class","color","colspan","fill","formControlName","height","href","id","lang","ngClass","ngProjectAs","routerLink","src","stroke","stroke-width","style","svgIcon","tabindex","target","type","viewBox","width","xmlns"]),Ye={checkAttributes:!0,checkId:!0,checkDuplicateId:!0,checkText:!0,ignoreAttributes:[...We]},Ve="https://angular.io/guide/i18n",He=`${Ve}#mark-element-attributes-for-translations`,Ge=`${Ve}#mark-plurals-and-alternates-for-translation`,ze=`${Ve}#mark-text-for-translations`,Qe=`${Ve}#manage-marked-text-with-custom-ids`,Ze=`${Ve}#define-unique-custom-ids`,et=`${Ve}-common-prepare#i18n-metadata-for-translation`;var tt=p({name:"i18n",meta:{type:"suggestion",docs:{description:"Ensures following best practices for i18n. Checks for missing i18n attributes on elements and attributes containing texts. Can also check for texts without i18n attribute, elements that do not use custom ID (@@) feature and duplicate custom IDs",recommended:!1},fixable:"code",hasSuggestions:!0,schema:[{type:"object",properties:{boundTextAllowedPattern:{type:"string"},checkAttributes:{type:"boolean",default:Ye.checkAttributes},checkDuplicateId:{type:"boolean",default:Ye.checkDuplicateId},checkId:{type:"boolean",default:Ye.checkId},checkText:{type:"boolean",default:Ye.checkText},ignoreAttributes:{type:"array",items:{type:"string"},default:[...We]},ignoreTags:{type:"array",items:{type:"string"}},requireDescription:{type:"boolean",default:Ye.requireDescription}},additionalProperties:!1}],messages:{i18nAttribute:`Attribute "{{attributeName}}" has no corresponding i18n attribute. See more at ${He}`,i18nAttributeOnIcuOrText:`Each element containing text node should have an i18n attribute. See more at ${Ge} and ${ze}`,i18nCustomIdOnAttribute:`Missing custom ID on attribute "i18n-{{attributeName}}". See more at ${Qe}`,i18nCustomIdOnElement:`Missing custom ID on element. See more at ${Qe}`,i18nDuplicateCustomId:`Duplicate custom ID "@@{{customId}}". See more at ${Ze}`,suggestAddI18nAttribute:"Add the `i18n` attribute",i18nMissingDescription:`Missing i18n description on element. See more at ${et}`}},defaultOptions:[Ye],create(e,[{boundTextAllowedPattern:t,checkAttributes:n,checkId:r,checkDuplicateId:o,checkText:s,ignoreAttributes:u,ignoreTags:i,requireDescription:c}]){const l=m(e),p=e.getSourceCode(),d=t?new RegExp(t):Je,f=new Set([...We,...null!=u?u:[]]),g=new Set(i),y=new Map;return{...(r||c)&&{"Element$1[i18n]"(t){!function({i18n:{description:t,customId:n},name:a,parent:o,sourceSpan:s}){if(g.has(a)||rt(o))return;const u=l.convertNodeSourceSpanToLoc(s);if(r)if(at(n))e.report({messageId:"i18nCustomIdOnElement",loc:u});else{var i;const e=null!=(i=y.get(n))?i:[];y.set(n,[...e,s])}c&&at(t)&&e.report({messageId:"i18nMissingDescription",loc:u})}(t)}},...(n||r||c)&&{[`Element$1 > TextAttribute[value=${Xe}]`](t){!function({i18n:t,keySpan:a,name:o,parent:{name:s},sourceSpan:u,value:i}){if(g.has(s))return;const m=l.convertNodeSourceSpanToLoc(null!=a?a:u);if(t){const{customId:n,description:a}=t;if(r)if(at(n))e.report({messageId:"i18nCustomIdOnAttribute",loc:m,data:{attributeName:o}});else{var d;const e=null!=(d=y.get(n))?d:[];y.set(n,[...e,u])}c&&at(a)&&e.report({messageId:"i18nMissingDescription",loc:m,data:{attributeName:o}})}t||!n||function(e,t,n,r){return e.has(n)||e.has(`${t}[${n}]`)||at(r)||function(e){return"false"===e||"true"===e}(r)||function(e){const t=Number.parseFloat(e);return!Number.isNaN(t)&&Number.isFinite(t)}(r)}(f,s,o,i)||e.report({messageId:"i18nAttribute",loc:m,data:{attributeName:o},fix:e=>{const{end:t}=l.convertNodeSourceSpanToLoc(u),n=p.getIndexFromLoc(t);return e.insertTextAfterRange([n,n],` i18n-${o}`)}})}(t)}},...s&&{[`BoundText, Icu$1, Text$3[value=${Xe}]`](t){!function(t){var n;const{parent:r,sourceSpan:o}=t;if(t instanceof a.TmplAstBoundText&&function(e,{value:{ast:{strings:t}}}){const n=t.join("").trim();return!Xe.test(n)||e.test(n)}(d,t)||nt(r)&&(r.i18n||g.has(r.name)))return;const s=l.convertNodeSourceSpanToLoc(o),u=e=>function(e,t,n,r,a){return nt(a)?B(a,rt)?[]:function(e,t,{start:n},r){const a=e.getIndexFromLoc(n)+r.length+1;return t.insertTextAfterRange([a,a]," i18n")}(e,n,t.convertNodeSourceSpanToLoc(a.sourceSpan),a.name):function(e,t,{start:n,end:r}){const a=e.getIndexFromLoc(n),o=e.getIndexFromLoc(r);return[t.insertTextBeforeRange([a,a],"<ng-container i18n>"),t.insertTextAfterRange([o,o],"</ng-container>")]}(e,n,r)}(p,l,e,s,r);e.report({messageId:"i18nAttributeOnIcuOrText",loc:s,...null!=r&&null!=(n=r.children)&&n.filter(nt).length?{suggest:[{messageId:"suggestAddI18nAttribute",fix:u}]}:{fix:u}})}(t)}},"Program:exit"(){!function(){if(o)for(const[t,n]of y){if(n.length<=1)break;for(const r of n){const n=l.convertNodeSourceSpanToLoc(r);e.report({messageId:"i18nDuplicateCustomId",loc:n,data:{customId:t}})}}y.clear()}()}}}});function nt(e){return e instanceof a.TmplAstElement}function rt(e){return Boolean(nt(e)&&e.i18n)}function at(e){return!e||0===e.trim().length}const ot="https://www.w3.org/WAI/WCAG21/Understanding/keyboard";var st=p({name:"mouse-events-have-key-events",meta:{type:"suggestion",docs:{description:`Ensures that the mouse events \`mouseout\` and \`mouseover\` are accompanied by \`focus\` and \`blur\` events respectively. Coding for the keyboard is important for users with physical disabilities who cannot use a mouse, AT compatibility, and screenreader users. See more at ${ot}`,recommended:!1},schema:[],messages:{mouseEventsHaveKeyEvents:`\`{{mouseEvent}}\` must be accompanied by \`{{keyEvent}}\` for accessibility (${ot})`}},defaultOptions:[],create(e){const t=m(e),n=ne([...k()]);return[["blur","mouseout"],["focus","mouseover"]].reduce((r,[a,o])=>({...r,[`Element$1[name=${n}]:has(BoundEvent[name='${o}']):not(:has(BoundEvent[name='${a}']))`]({sourceSpan:n}){const r=t.convertNodeSourceSpanToLoc(n);e.report({loc:r,messageId:"mouseEventsHaveKeyEvents",data:{keyEvent:a,mouseEvent:o}})}}),{})}}),ut=p({name:"no-any",meta:{type:"suggestion",docs:{description:'The use of "$any" nullifies the compile-time benefits of Angular\'s type system',recommended:!1},hasSuggestions:!0,schema:[],messages:{noAny:'Avoid using "$any" in templates',suggestRemoveAny:"Remove $any"}},defaultOptions:[],create(e){d(e);const t=e.getSourceCode();return{'Call[receiver.name="$any"]'({receiver:n,sourceSpan:{end:r,start:o}}){if(!(n instanceof a.PropertyRead))return;if(!(n.receiver instanceof a.ThisReceiver||n.receiver instanceof a.ImplicitReceiver))return;const s=n.nameSpan;e.report({messageId:"noAny",loc:{start:t.getLocFromIndex(o),end:t.getLocFromIndex(r)},suggest:[{messageId:"suggestRemoveAny",fix:e=>[e.removeRange([s.start,s.end+1]),e.removeRange([r-1,r])]}]})}}}}),it=p({name:"no-autofocus",meta:{type:"suggestion",docs:{description:"Ensures that the `autofocus` attribute is not used",recommended:!1},fixable:"code",schema:[],messages:{noAutofocus:"The `autofocus` attribute should not be used, as it reduces usability and accessibility for users"}},defaultOptions:[],create(e){const t=m(e);return{[`Element$1[name=${ne([...k()])}] > :matches(BoundAttribute, TextAttribute)[name="autofocus"]`]({sourceSpan:n}){const r=t.convertNodeSourceSpanToLoc(n);e.report({loc:r,messageId:"noAutofocus",fix:e=>e.removeRange([n.start.offset-1,n.end.offset])})}}}}),ct=p({name:"no-call-expression",meta:{type:"suggestion",docs:{description:"Disallows calling expressions in templates, except for output handlers",recommended:!1},schema:[],messages:{noCallExpression:"Avoid calling expressions in templates"}},defaultOptions:[],create(e){d(e);const t=e.getSourceCode();return{'Call[receiver.name!="$any"]'(n){if(Boolean(B(n,lt)))return;const{sourceSpan:{start:r,end:a}}=n;e.report({loc:{start:t.getLocFromIndex(r),end:t.getLocFromIndex(a)},messageId:"noCallExpression"})}}}});function lt(e){return e instanceof a.TmplAstBoundEvent}var pt=p({name:"no-distracting-elements",meta:{type:"suggestion",docs:{description:"Enforces that no distracting elements are used",recommended:!1},fixable:"code",schema:[],messages:{noDistractingElements:"Do not use <{{element}}> elements as they can create visual accessibility issues and are deprecated"}},defaultOptions:[],create(e){const t=m(e);return{"Element$1[name=/^(blink|marquee)$/]"({name:n,sourceSpan:r}){const a=t.convertNodeSourceSpanToLoc(r);e.report({loc:a,messageId:"noDistractingElements",data:{element:n},fix:e=>e.removeRange([r.start.offset,r.end.offset])})}}}});const mt={allowTwoWayDataBinding:!0,ignore:[]};var dt=p({name:"no-duplicate-attributes",meta:{type:"problem",docs:{description:"Ensures that there are no duplicate input properties or output event listeners",recommended:!1},hasSuggestions:!0,schema:[{type:"object",properties:{allowTwoWayDataBinding:{type:"boolean",default:mt.allowTwoWayDataBinding,description:"Whether or not two-way data binding is allowed as an exception to the rule."},ignore:{type:"array",items:{type:"string"},uniqueItems:!0,default:mt.ignore,description:"Input or output properties for which duplicate presence is allowed as an exception to the rule."}},additionalProperties:!1}],messages:{noDuplicateAttributes:"Duplicate attribute `{{attributeName}}`",suggestRemoveAttribute:"Remove attribute `{{attributeName}}`"}},defaultOptions:[mt],create(e,[{allowTwoWayDataBinding:t,ignore:n}]){const r=m(e);return{Element$1({inputs:a,outputs:o,attributes:s}){const u=[...ft([...a,...s]),...ft(t?o.filter(e=>!a.some(t=>t.sourceSpan.start===e.sourceSpan.start&&t.sourceSpan.end===e.sourceSpan.end)):o)];(n&&n.length>0?u.filter(e=>!n.includes(g(e))):u).forEach(t=>{const n=r.convertNodeSourceSpanToLoc(t.sourceSpan),a={attributeName:g(t)};e.report({loc:n,messageId:"noDuplicateAttributes",data:a,suggest:[{messageId:"suggestRemoveAttribute",fix:e=>e.removeRange([n.start.column,n.end.column+1]),data:a}]})})}}}});function ft(e){return e.filter(t=>e.some(e=>e!==t&&g(e)===g(t)))}const gt={allowNgStyle:!1,allowBindToStyle:!1};var yt=p({name:"no-inline-styles",meta:{type:"suggestion",docs:{description:"Disallows the use of inline styles in HTML templates",recommended:!1},schema:[{type:"object",properties:{allowNgStyle:{type:"boolean",default:gt.allowNgStyle},allowBindToStyle:{type:"boolean",default:gt.allowBindToStyle}},additionalProperties:!1}],messages:{noInlineStyles:"<{{element}}/> element should not have inline styles via style attribute. Please use classes instead."}},defaultOptions:[gt],create(e,[{allowNgStyle:t,allowBindToStyle:n}]){const r=m(e);return{Element$1(a){let o=!1;if(t||n){const e=!t&&At(a),r=!n&&Tt(a);o=St(a)||e||r}else o=St(a)||At(a)||Tt(a);if(o){const t=r.convertElementSourceSpanToLoc(e,a);e.report({loc:t,messageId:"noInlineStyles",data:{element:a.name}})}}}}});function St(e){return e.attributes.some(({name:e})=>bt(e))||e.inputs.some(({name:e})=>bt(e))}function At(e){return e.inputs.some(({name:e})=>function(e){return"ngStyle"===e}(e))}function Tt(e){return e.inputs.some(({keySpan:e})=>function(e){return!(null==e||!e.details)&&e.details.includes("style.")}(e))}function bt(e){return"style"===e}var Et=p({name:"no-negated-async",meta:{type:"suggestion",docs:{description:"Ensures that async pipe results are not negated",recommended:"error"},hasSuggestions:!0,schema:[],messages:{noNegatedAsync:"Async pipe results should not be negated. Use `(observable | async) === false`, `(observable | async) === null`, or `(observable | async) === undefined` to check its value instead",suggestFalseComparison:"Compare with `false`",suggestNullComparison:"Compare with `null`",suggestUndefinedComparison:"Compare with `undefined`"}},defaultOptions:[],create(e){d(e);const t=e.getSourceCode();return{':not(PrefixNot) > PrefixNot > BindingPipe[name="async"]'({parent:{sourceSpan:{end:n,start:r}}}){e.report({messageId:"noNegatedAsync",loc:{start:t.getLocFromIndex(r),end:t.getLocFromIndex(n)},suggest:[{messageId:"suggestFalseComparison",textToInsert:" === false"},{messageId:"suggestNullComparison",textToInsert:" === null"},{messageId:"suggestUndefinedComparison",textToInsert:" === undefined"}].map(({messageId:e,textToInsert:t})=>({messageId:e,fix:e=>[e.removeRange([r,r+1]),e.insertTextAfterRange([n,n],t)]}))})}}}}),xt=p({name:"no-positive-tabindex",meta:{type:"suggestion",docs:{description:"Ensures that the `tabindex` attribute is not positive",recommended:!1},hasSuggestions:!0,schema:[],messages:{noPositiveTabindex:"The `tabindex` attribute should not be positive",suggestNonNegativeTabindex:'Use `tabindex="{{tabindex}}"`'}},defaultOptions:[],create(e){const t=m(e);return{[`Element$1[name=${ne([...k()])}] > BoundAttribute[name="tabindex"][value.ast.value>0], TextAttribute[name="tabindex"][value>0]`]({valueSpan:n}){const r=t.convertNodeSourceSpanToLoc(n);e.report({loc:r,messageId:"noPositiveTabindex",suggest:["-1","0"].map(e=>({messageId:"suggestNonNegativeTabindex",fix:t=>t.replaceTextRange([n.start.offset,n.end.offset],e),data:{tabindex:e}}))})}}}}),ht=p({name:"use-track-by-function",meta:{type:"suggestion",docs:{description:"Ensures trackBy function is used",recommended:!1},schema:[],messages:{useTrackByFunction:"Missing trackBy function in ngFor directive"}},defaultOptions:[],create(e){const t=m(e);return{'BoundAttribute.inputs[name="ngForOf"]'({parent:{inputs:n},sourceSpan:r}){if(n.some(vt))return;const a=t.convertNodeSourceSpanToLoc(r);e.report({messageId:"useTrackByFunction",loc:a})},'BoundAttribute.templateAttrs[name="ngForOf"]'({parent:{templateAttrs:n}}){if(n.some(vt))return;const{start:r}=t.convertNodeSourceSpanToLoc(n[0].sourceSpan),{end:a}=t.convertNodeSourceSpanToLoc(n[n.length-1].sourceSpan),o={start:{...r,column:r.column-1},end:{...a,column:a.column+1}};e.report({messageId:"useTrackByFunction",loc:o})}}}});function vt(e){return e instanceof a.TmplAstBoundAttribute&&"ngForTrackBy"===e.name}module.exports={configs:{all:{extends:"./configs/base.json",rules:{"@angular-eslint/template/accessibility-alt-text":"error","@angular-eslint/template/accessibility-elements-content":"error","@angular-eslint/template/accessibility-interactive-supports-focus":"error","@angular-eslint/template/accessibility-label-for":"error","@angular-eslint/template/accessibility-label-has-associated-control":"error","@angular-eslint/template/accessibility-role-has-required-aria":"error","@angular-eslint/template/accessibility-table-scope":"error","@angular-eslint/template/accessibility-valid-aria":"error","@angular-eslint/template/attributes-order":"error","@angular-eslint/template/banana-in-box":"error","@angular-eslint/template/button-has-type":"error","@angular-eslint/template/click-events-have-key-events":"error","@angular-eslint/template/conditional-complexity":"error","@angular-eslint/template/cyclomatic-complexity":"error","@angular-eslint/template/eqeqeq":"error","@angular-eslint/template/i18n":"error","@angular-eslint/template/mouse-events-have-key-events":"error","@angular-eslint/template/no-any":"error","@angular-eslint/template/no-autofocus":"error","@angular-eslint/template/no-call-expression":"error","@angular-eslint/template/no-distracting-elements":"error","@angular-eslint/template/no-duplicate-attributes":"error","@angular-eslint/template/no-inline-styles":"error","@angular-eslint/template/no-negated-async":"error","@angular-eslint/template/no-positive-tabindex":"error","@angular-eslint/template/use-track-by-function":"error"}},base:{parser:"@angular-eslint/template-parser",plugins:["@angular-eslint/template"]},recommended:{extends:"./configs/base.json",rules:{"@angular-eslint/template/banana-in-box":"error","@angular-eslint/template/eqeqeq":"error","@angular-eslint/template/no-negated-async":"error"}},"process-inline-templates":{parser:"@typescript-eslint/parser",parserOptions:{ecmaVersion:2020,sourceType:"module"},plugins:["@angular-eslint/template"],processor:"@angular-eslint/template/extract-inline-html"}},processors:c,rules:{"accessibility-alt-text":S,"accessibility-elements-content":P,[X]:J,"accessibility-label-for":z,[Q]:te,[oe]:se,"accessibility-table-scope":ue,"accessibility-valid-aria":ie,"attributes-order":me,"banana-in-box":De,"button-has-type":Ie,"conditional-complexity":Ne,"click-events-have-key-events":we,"cyclomatic-complexity":ke,eqeqeq:_e,i18n:tt,"mouse-events-have-key-events":st,"no-any":ut,"no-autofocus":it,"no-call-expression":ct,"no-distracting-elements":pt,"no-duplicate-attributes":dt,"no-inline-styles":yt,"no-negated-async":Et,"no-positive-tabindex":xt,"use-track-by-function":ht}};
|
|
1
|
+
var e=require("path"),t=require("@typescript-eslint/type-utils"),n=require("typescript"),r=require("@angular-eslint/utils"),a=require("@typescript-eslint/utils"),o=require("@angular-eslint/bundled-angular-compiler"),s=require("aria-query");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=/*#__PURE__*/i(n);const c=new Map;var l={"extract-inline-html":{preprocess:function(n,r){const a=[n];if(!function(e,t){return!![".component.ts",".page.ts",".dialog.ts",".modal.ts",".popover.ts",".bottomsheet.ts",".snackbar.ts"].some(e=>t.endsWith(e))||!(!e.includes("Component")||!e.includes("@angular/core"))}(n,r))return a;try{const o=u.default.createSourceFile(r,n,u.default.ScriptTarget.Latest,!0),s=o.statements.filter(e=>u.default.isClassDeclaration(e));if(!s||!s.length)return a;const i=[];for(const e of s){const n=t.getDecorators(e);if(n)for(const e of n)u.default.isCallExpression(e.expression)&&u.default.isIdentifier(e.expression.expression)&&"Component"===e.expression.expression.text&&i.push(e)}if(!i||!i.length)return a;const l=[n];let p=0;for(const t of i){if(!u.default.isDecorator(t)||!u.default.isCallExpression(t.expression)||1!==t.expression.arguments.length)continue;const n=t.expression.arguments[0];if(!u.default.isObjectLiteralExpression(n))continue;const a=n.properties.find(e=>e&&e.name&&"template"===e.name.getText());if(n.properties.find(e=>e&&e.name&&"templateUrl"===e.name.getText())||!a)continue;if(!u.default.isPropertyAssignment(a))continue;let s;const i=a.initializer;if(u.default.isNoSubstitutionTemplateLiteral(i)&&(s=i.rawText),u.default.isTemplateExpression(i)&&(s=i.getText()),u.default.isStringLiteral(i)&&(s=i.text),!s)continue;const m=`inline-template-${e.basename(r)}-${++p}.component.html`,d=a.initializer.getStart(),f=a.initializer.getEnd();c.set(m,{range:[d,f],lineAndCharacter:{start:o.getLineAndCharacterOfPosition(d),end:o.getLineAndCharacterOfPosition(f)}}),l.push({text:s,filename:m})}return l}catch(e){return console.log(e),console.error("preprocess: ERROR could not parse @Component() metadata",r),a}},postprocess:function(t,n){const r=t[0];if(1===t.length)return r;const a=t.slice(1);return[...r,...a.flatMap((t,r)=>{const a=`inline-template-${e.basename(n)}-${++r}.component.html`,o=c.get(a);return o?t.map(e=>{if(e.line=e.line+o.lineAndCharacter.start.line,e.endLine=e.endLine+o.lineAndCharacter.start.line,e.fix){const t=o.range[0];e.fix.range=[t+e.fix.range[0],t+e.fix.range[1]]}return e}):[]})]},supportsAutofix:!0}};const p=e=>function({name:t,meta:n,defaultOptions:r,create:o}){return{meta:Object.assign(Object.assign({},n),{docs:Object.assign(Object.assign({},n.docs),{url:e(t)})}),defaultOptions:r,create(e){const t=a.ESLintUtils.applyDefault(r,e.options);return o(e,t)}}};p.withoutDocs=a.ESLintUtils.RuleCreator.withoutDocs;const m=p(e=>`https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin-template/docs/rules/${e}.md`),d=Symbol("PROPERTY_READ");function f(e){var t;const{details:n}=null!=(t=e.keySpan)?t:{};return n?e instanceof o.TmplAstBoundEvent?function({keySpan:{details:e},name:t}){return t===`${e}Change`}(e)?e.name:n:n.replace("attr.",""):e.name}function g({attributes:e,inputs:t},n){const r=[...e,...t].find(e=>f(e)===n);if("string"==typeof(null==r?void 0:r.value))return r.value;if(!((null==r?void 0:r.value)instanceof o.ASTWithSource))return null;if(r.value.ast instanceof o.LiteralArray)return r.value.ast.expressions;if(r.value.ast instanceof o.LiteralMap){const{keys:e,values:t}=r.value.ast;return e.reduce((e,n,r)=>e.set(n.key,t[r]),new Map)}return r.value.ast instanceof o.LiteralPrimitive?r.value.ast.value:d}var y=m({name:"accessibility-alt-text",meta:{type:"suggestion",docs:{description:"Enforces alternate text for elements which require the alt, aria-label, aria-labelledby attributes.",recommended:!1},schema:[],messages:{accessibilityAltText:"<{{element}}/> element must have a text alternative."}},defaultOptions:[],create(e){const t=r.getTemplateParserServices(e);return{"Element$1[name=/^(img|area|object|input)$/]"(n){if(!function(e){return"img"===e.name?function(e){return e.attributes.some(({name:e})=>A(e))||e.inputs.some(({name:e})=>A(e))}(e):"object"===e.name?function(e){let t=!1,n=!1;for(const r of e.attributes)t="title"===r.name,n=T(r.name);if(t||n)return!0;let r=!1,a=!1;for(const t of e.inputs)r="title"===t.name,a=T(t.name);return!(!r&&!a)||e.children.length>0&&!!e.children[0].value}(e):"area"===e.name?S(e):function(e){return"image"!==g(e,"type")||S(e)}(e)}(n)){const r=t.convertElementSourceSpanToLoc(e,n);e.report({loc:r,messageId:"accessibilityAltText",data:{element:n.name}})}}}}});function S(e){let t=!1,n=!1;for(const r of e.attributes)t=A(r.name),n=T(r.name);if(t||n)return!0;let r=!1,a=!1;for(const t of e.inputs)r=A(t.name),a=T(t.name);return r||a}function T(e){return"aria-label"===e||"aria-labelledby"===e}function A(e){return"alt"===e}var b="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function E(e){var t={exports:{}};return e(t,t.exports),t.exports}var x=E(function(e,t){var n,r;Object.defineProperty(t,"__esModule",{value:!0}),t.AST_TOKEN_TYPES=t.AST_NODE_TYPES=void 0,(n=t.AST_NODE_TYPES||(t.AST_NODE_TYPES={})).ArrayExpression="ArrayExpression",n.ArrayPattern="ArrayPattern",n.ArrowFunctionExpression="ArrowFunctionExpression",n.AssignmentExpression="AssignmentExpression",n.AssignmentPattern="AssignmentPattern",n.AwaitExpression="AwaitExpression",n.BinaryExpression="BinaryExpression",n.BlockStatement="BlockStatement",n.BreakStatement="BreakStatement",n.CallExpression="CallExpression",n.CatchClause="CatchClause",n.ChainExpression="ChainExpression",n.ClassBody="ClassBody",n.ClassDeclaration="ClassDeclaration",n.ClassExpression="ClassExpression",n.ConditionalExpression="ConditionalExpression",n.ContinueStatement="ContinueStatement",n.DebuggerStatement="DebuggerStatement",n.Decorator="Decorator",n.DoWhileStatement="DoWhileStatement",n.EmptyStatement="EmptyStatement",n.ExportAllDeclaration="ExportAllDeclaration",n.ExportDefaultDeclaration="ExportDefaultDeclaration",n.ExportNamedDeclaration="ExportNamedDeclaration",n.ExportSpecifier="ExportSpecifier",n.ExpressionStatement="ExpressionStatement",n.ForInStatement="ForInStatement",n.ForOfStatement="ForOfStatement",n.ForStatement="ForStatement",n.FunctionDeclaration="FunctionDeclaration",n.FunctionExpression="FunctionExpression",n.Identifier="Identifier",n.IfStatement="IfStatement",n.ImportAttribute="ImportAttribute",n.ImportDeclaration="ImportDeclaration",n.ImportDefaultSpecifier="ImportDefaultSpecifier",n.ImportExpression="ImportExpression",n.ImportNamespaceSpecifier="ImportNamespaceSpecifier",n.ImportSpecifier="ImportSpecifier",n.JSXAttribute="JSXAttribute",n.JSXClosingElement="JSXClosingElement",n.JSXClosingFragment="JSXClosingFragment",n.JSXElement="JSXElement",n.JSXEmptyExpression="JSXEmptyExpression",n.JSXExpressionContainer="JSXExpressionContainer",n.JSXFragment="JSXFragment",n.JSXIdentifier="JSXIdentifier",n.JSXMemberExpression="JSXMemberExpression",n.JSXNamespacedName="JSXNamespacedName",n.JSXOpeningElement="JSXOpeningElement",n.JSXOpeningFragment="JSXOpeningFragment",n.JSXSpreadAttribute="JSXSpreadAttribute",n.JSXSpreadChild="JSXSpreadChild",n.JSXText="JSXText",n.LabeledStatement="LabeledStatement",n.Literal="Literal",n.LogicalExpression="LogicalExpression",n.MemberExpression="MemberExpression",n.MetaProperty="MetaProperty",n.MethodDefinition="MethodDefinition",n.NewExpression="NewExpression",n.ObjectExpression="ObjectExpression",n.ObjectPattern="ObjectPattern",n.PrivateIdentifier="PrivateIdentifier",n.Program="Program",n.Property="Property",n.PropertyDefinition="PropertyDefinition",n.RestElement="RestElement",n.ReturnStatement="ReturnStatement",n.SequenceExpression="SequenceExpression",n.SpreadElement="SpreadElement",n.StaticBlock="StaticBlock",n.Super="Super",n.SwitchCase="SwitchCase",n.SwitchStatement="SwitchStatement",n.TaggedTemplateExpression="TaggedTemplateExpression",n.TemplateElement="TemplateElement",n.TemplateLiteral="TemplateLiteral",n.ThisExpression="ThisExpression",n.ThrowStatement="ThrowStatement",n.TryStatement="TryStatement",n.UnaryExpression="UnaryExpression",n.UpdateExpression="UpdateExpression",n.VariableDeclaration="VariableDeclaration",n.VariableDeclarator="VariableDeclarator",n.WhileStatement="WhileStatement",n.WithStatement="WithStatement",n.YieldExpression="YieldExpression",n.TSAbstractKeyword="TSAbstractKeyword",n.TSAbstractMethodDefinition="TSAbstractMethodDefinition",n.TSAbstractPropertyDefinition="TSAbstractPropertyDefinition",n.TSAnyKeyword="TSAnyKeyword",n.TSArrayType="TSArrayType",n.TSAsExpression="TSAsExpression",n.TSAsyncKeyword="TSAsyncKeyword",n.TSBigIntKeyword="TSBigIntKeyword",n.TSBooleanKeyword="TSBooleanKeyword",n.TSCallSignatureDeclaration="TSCallSignatureDeclaration",n.TSClassImplements="TSClassImplements",n.TSConditionalType="TSConditionalType",n.TSConstructorType="TSConstructorType",n.TSConstructSignatureDeclaration="TSConstructSignatureDeclaration",n.TSDeclareFunction="TSDeclareFunction",n.TSDeclareKeyword="TSDeclareKeyword",n.TSEmptyBodyFunctionExpression="TSEmptyBodyFunctionExpression",n.TSEnumDeclaration="TSEnumDeclaration",n.TSEnumMember="TSEnumMember",n.TSExportAssignment="TSExportAssignment",n.TSExportKeyword="TSExportKeyword",n.TSExternalModuleReference="TSExternalModuleReference",n.TSFunctionType="TSFunctionType",n.TSInstantiationExpression="TSInstantiationExpression",n.TSImportEqualsDeclaration="TSImportEqualsDeclaration",n.TSImportType="TSImportType",n.TSIndexedAccessType="TSIndexedAccessType",n.TSIndexSignature="TSIndexSignature",n.TSInferType="TSInferType",n.TSInterfaceBody="TSInterfaceBody",n.TSInterfaceDeclaration="TSInterfaceDeclaration",n.TSInterfaceHeritage="TSInterfaceHeritage",n.TSIntersectionType="TSIntersectionType",n.TSIntrinsicKeyword="TSIntrinsicKeyword",n.TSLiteralType="TSLiteralType",n.TSMappedType="TSMappedType",n.TSMethodSignature="TSMethodSignature",n.TSModuleBlock="TSModuleBlock",n.TSModuleDeclaration="TSModuleDeclaration",n.TSNamedTupleMember="TSNamedTupleMember",n.TSNamespaceExportDeclaration="TSNamespaceExportDeclaration",n.TSNeverKeyword="TSNeverKeyword",n.TSNonNullExpression="TSNonNullExpression",n.TSNullKeyword="TSNullKeyword",n.TSNumberKeyword="TSNumberKeyword",n.TSObjectKeyword="TSObjectKeyword",n.TSOptionalType="TSOptionalType",n.TSParameterProperty="TSParameterProperty",n.TSPrivateKeyword="TSPrivateKeyword",n.TSPropertySignature="TSPropertySignature",n.TSProtectedKeyword="TSProtectedKeyword",n.TSPublicKeyword="TSPublicKeyword",n.TSQualifiedName="TSQualifiedName",n.TSReadonlyKeyword="TSReadonlyKeyword",n.TSRestType="TSRestType",n.TSStaticKeyword="TSStaticKeyword",n.TSStringKeyword="TSStringKeyword",n.TSSymbolKeyword="TSSymbolKeyword",n.TSTemplateLiteralType="TSTemplateLiteralType",n.TSThisType="TSThisType",n.TSTupleType="TSTupleType",n.TSTypeAliasDeclaration="TSTypeAliasDeclaration",n.TSTypeAnnotation="TSTypeAnnotation",n.TSTypeAssertion="TSTypeAssertion",n.TSTypeLiteral="TSTypeLiteral",n.TSTypeOperator="TSTypeOperator",n.TSTypeParameter="TSTypeParameter",n.TSTypeParameterDeclaration="TSTypeParameterDeclaration",n.TSTypeParameterInstantiation="TSTypeParameterInstantiation",n.TSTypePredicate="TSTypePredicate",n.TSTypeQuery="TSTypeQuery",n.TSTypeReference="TSTypeReference",n.TSUndefinedKeyword="TSUndefinedKeyword",n.TSUnionType="TSUnionType",n.TSUnknownKeyword="TSUnknownKeyword",n.TSVoidKeyword="TSVoidKeyword",(r=t.AST_TOKEN_TYPES||(t.AST_TOKEN_TYPES={})).Boolean="Boolean",r.Identifier="Identifier",r.JSXIdentifier="JSXIdentifier",r.JSXText="JSXText",r.Keyword="Keyword",r.Null="Null",r.Numeric="Numeric",r.Punctuator="Punctuator",r.RegularExpression="RegularExpression",r.String="String",r.Template="Template",r.Block="Block",r.Line="Line"});Object.defineProperty(exports,"__esModule",{value:!0});var h={__proto__:null};Object.defineProperty(exports,"__esModule",{value:!0});var v={__proto__:null},C=E(function(e,t){var n=b&&b.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var a=Object.getOwnPropertyDescriptor(t,n);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,a)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),r=b&&b.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=b&&b.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)"default"!==a&&Object.prototype.hasOwnProperty.call(e,a)&&n(t,e,a);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.TSESTree=void 0,t.TSESTree=a(x)}),F=E(function(e,t){var n=b&&b.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var a=Object.getOwnPropertyDescriptor(t,n);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,a)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),r=b&&b.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.AST_TOKEN_TYPES=t.AST_NODE_TYPES=void 0,Object.defineProperty(t,"AST_NODE_TYPES",{enumerable:!0,get:function(){return x.AST_NODE_TYPES}}),Object.defineProperty(t,"AST_TOKEN_TYPES",{enumerable:!0,get:function(){return x.AST_TOKEN_TYPES}}),r(h,t),r(v,t),r(C,t)});function D({parent:e},t){for(;e&&e.type!==F.AST_NODE_TYPES.Program;){if(t(e))return e;e=e.parent}return null}function B(e){if(D(e,w)||function(e){const t=g(e,"style");if("string"!=typeof t)return!1;const n=t.replace(/[\s'"]/g,"");return n.includes("display:none")||n.includes("visibility:hidden")}(e)||function(e){const t=g(e,"ngStyle");return t instanceof Map&&("none"===t.get("display")||"hidden"===t.get("visibility"))}(e)||function(e){return"none"===g(e,"style.display")||"true"===String(g(e,"style.display.none"))||"hidden"===g(e,"style.visibility")||"true"===String(g(e,"style.visibility.hidden"))}(e)||I(e,"aria-hidden")||I(e,"hidden"))return!0;if("INPUT"!==e.name.toUpperCase())return!1;const t=g(e,"type");return"string"==typeof t&&"HIDDEN"===t.toUpperCase()}function I(e,t){const n=g(e,t);return""===n||"true"===String(n)}function w(e){return e instanceof o.TmplAstElement&&B(e)}const N=["aria-label","innerHtml","innerHTML","innerText","outerHTML","title"];var P=m({name:"accessibility-elements-content",meta:{type:"suggestion",docs:{description:"Ensures that the heading, anchor and button elements have content in it",recommended:!1},schema:[{additionalProperties:!1,properties:{allowList:{items:{type:"string"},type:"array",uniqueItems:!0}},type:"object"}],messages:{accessibilityElementsContent:"<{{element}}> should have content"}},defaultOptions:[{allowList:N}],create(e,[{allowList:t}]){const n=r.getTemplateParserServices(e);return{"Element$1[name=/^(a|button|h1|h2|h3|h4|h5|h6)$/][children.length=0]"(r){if(B(r))return;const{attributes:a,inputs:o,name:s,sourceSpan:i}=r,u=new Set([...N,...null!=t?t:[]]);if([...a,...o].map(({name:e})=>e).some(e=>u.has(e)))return;const c=n.convertNodeSourceSpanToLoc(i);e.report({loc:c,messageId:"accessibilityElementsContent",data:{element:s}})}}}});let O=null;function L(){var e;return null!=(e=O)?e:O=new Set(s.dom.keys())}let k=null,R=null,_=null,$=null;function j(){if(null===$){const e=[...s.roles.keys()];$=new Set(e.filter(e=>{const t=s.roles.get(e);return t&&!t.abstract&&"toolbar"!==e&&!t.superClass.some(e=>e.includes("widget"))}).concat("progressbar"))}return $}function q(e){return L().has(e.name)&&function(e){function t({attributes:t,name:n}){return e.name===n&&function(e,t){const n=[...t.attributes,...t.inputs];return e.every(e=>n.some(({name:n})=>"a"===t.name&&"routerLink"===n||e.name===n&&(!e.value||e.value===g(t,e.name))))}(null!=t?t:[],e)}return!!function(){if(null===R){const e=[...s.roles.keys()],t=[...s.elementRoles.entries()],n=new Set(e.filter(e=>{const t=s.roles.get(e);return t&&!t.abstract&&"progressbar"!==e&&t.superClass.some(e=>e.includes("widget"))}).concat("toolbar"));R=t.reduce((e,[t,r])=>e.concat([...r].every(e=>n.has(e))?t:[]),[])}return R}().some(t)||!function(){if(null===_){const e=[...s.elementRoles.entries()];_=e.reduce((e,[t,n])=>e.concat([...n].every(e=>j().has(e))?t:[]),[])}return _}().some(t)&&function(){if(null===k){const{AXObjects:e,elementAXObjects:t}=require("axobject-query"),n=new Set(Array.from(e.keys()).filter(t=>"widget"===e.get(t).type));k=[...t.entries()].reduce((e,[t,r])=>e.concat([...r].every(e=>n.has(e))?t:[]),[])}return k}().some(t)}(e)}const K=new Set(["none","presentation"]);function M(e){const t=g(e,"role");return"string"==typeof t&&K.has(t)}const U="accessibility-interactive-supports-focus";var X=m({name:U,meta:{type:"suggestion",docs:{description:"Ensures that elements with interactive handlers like `(click)` are focusable.",recommended:!1},schema:[],messages:{interactiveSupportsFocus:"Elements with interaction handlers must be focusable."}},defaultOptions:[],create:e=>({Element$1(t){const n=t.name;if(!L().has(n))return;const a=t.outputs.find(e=>"click"===e.name||e.name.startsWith("keyup")||e.name.startsWith("keydown")||e.name.startsWith("keypress"));if(!a||function(e){const t=[...e.attributes,...e.inputs].find(e=>"disabled"===f(e)),n=g(e,"disabled");return!((!t||void 0===n)&&"true"!==String(g(e,"aria-disabled")).toLowerCase())}(t)||B(t)||M(t))return;const o=[...t.attributes,...t.inputs].find(e=>"tabindex"===e.name);if(a&&!o&&!q(t)&&!function(e){return function(e){return j().has(g(e,"role"))}(e)}(t)&&!function(e){const t=[...e.attributes,...e.inputs].find(e=>"contenteditable"===f(e)),n=g(e,"contenteditable");return!!t&&(""===n||"true"===String(n).toLowerCase())}(t)){const n=r.getTemplateParserServices(e).convertNodeSourceSpanToLoc(t.sourceSpan);e.report({loc:n,messageId:"interactiveSupportsFocus"})}}})});function J(e,t){return function e({children:n}){return n.some(n=>n instanceof o.TmplAstElement&&(n.name===t||e(n)))}(e)}const W={items:{type:"string"},type:"array",uniqueItems:!0},V=["button","input","meter","output","progress","select","textarea"],Y=["for","htmlFor"],H=["label"];var G=m({name:"accessibility-label-for",meta:{deprecated:!0,replacedBy:["accessibility-label-has-associated-control"],type:"suggestion",docs:{description:"Ensures that a label element/component is associated with a form element",recommended:!1},schema:[{additionalProperties:!1,properties:{controlComponents:{...W},labelAttributes:{...W},labelComponents:{...W}},type:"object"}],messages:{accessibilityLabelFor:"A label element/component must be associated with a form element"}},defaultOptions:[{controlComponents:V,labelAttributes:Y,labelComponents:H}],create(e,[t]){const n=r.getTemplateParserServices(e),{controlComponents:a,labelAttributes:o,labelComponents:s}=function({controlComponents:e,labelAttributes:t,labelComponents:n}){return{controlComponents:new Set([...V,...null!=e?e:[]]),labelAttributes:new Set([...Y,...null!=t?t:[]]),labelComponents:new Set([...H,...null!=n?n:[]])}}(t);var i;return{[`Element$1[name=${i=[...s],RegExp(`^(${i.join("|")})$`)}]`](t){const r=new Set([...t.attributes,...t.inputs].map(({name:e})=>e));if([...o].some(e=>r.has(e))||function(e,t){return Boolean([...e].some(e=>J(t,e)))}(a,t))return;const s=n.convertNodeSourceSpanToLoc(t.sourceSpan);e.report({loc:s,messageId:"accessibilityLabelFor"})}}}});const z="accessibility-label-has-associated-control",Q=["input","meter","output","progress","select","textarea"],Z=[{inputs:["for","htmlFor"],selector:"label"}];var ee=m({name:z,meta:{type:"suggestion",docs:{description:"Ensures that a label element/component is associated with a form element",recommended:!1},schema:[{additionalProperties:!1,properties:{controlComponents:{items:{type:"string"},type:"array",uniqueItems:!0},labelComponents:{items:{additionalProperties:!1,properties:{inputs:{items:{type:"string"},type:"array",uniqueItems:!0},selector:{type:"string"}},required:["selector"],type:"object"},type:"array",uniqueItems:!0}},type:"object"}],messages:{accessibilityLabelHasAssociatedControl:"A label component must be associated with a form element"}},defaultOptions:[{controlComponents:Q,labelComponents:Z}],create(e,[{controlComponents:t,labelComponents:n}]){const a=r.getTemplateParserServices(e),o=new Set([...Q,...null!=t?t:[]]),s=[...Z,...null!=n?n:[]],i=s.map(({selector:e})=>e);return{[`Element$1[name=${RegExp(`^(${i.join("|")})$`)}]`](t){var n;const r=s.find(({selector:e})=>e===t.name);if(!r)return;const i=new Set([...t.attributes,...t.inputs].map(({name:e})=>e));if((null==(n=r.inputs)?void 0:n.some(e=>i.has(e)))||function(e,t){return Boolean([...e].some(e=>J(t,e)))}(o,t))return;const u=a.convertNodeSourceSpanToLoc(t.sourceSpan);e.report({loc:u,messageId:"accessibilityLabelHasAssociatedControl"})}}}});function te(e){return RegExp(`^(${e.join("|")})$`)}let ne=null,re=null;const ae="accessibility-role-has-required-aria";var oe=m({name:ae,meta:{type:"suggestion",docs:{description:"Ensures elements with ARIA roles have all required properties for that role.",recommended:!1},hasSuggestions:!0,schema:[],messages:{roleHasRequiredAria:'The {{element}} with role="{{role}}" does not have required ARIA properties: {{missingProps}}',suggestRemoveRole:"Remove role `{{role}}`"}},defaultOptions:[],create(e){const t=r.getTemplateParserServices(e);return{[`Element$1[name=${te([...L()])}] > TextAttribute[name='role']`](n){const{value:r,sourceSpan:a}=n,{attributes:o,inputs:i,name:u}=n.parent,c=[...o,...i],l=s.roles.get(r),p=Object.keys((null==l?void 0:l.requiredProps)||{});if(!p.length)return;if(function(e,t,n){var r,a;if(null===ne||null===re){const{AXObjectRoles:e,elementAXObjects:t}=require("axobject-query");ne=t,re=e}return Array.from(null!=(r=null==(a=ne)?void 0:a.keys())?r:[]).some(r=>{var a,o,s;return r.name===e&&(null!=(a=r.attributes)?a:[]).every(e=>n.find(t=>e.name===t.name&&e.value===t.value))&&(null==(o=ne)||null==(s=o.get(r))?void 0:s.find(e=>{var n,r;return null==(n=re)||null==(r=n.get(e))?void 0:r.find(e=>e.name===t)}))})}(u,r,c))return;const m=p.filter(e=>!c.find(t=>t.name===e)).join(", ");if(m){const n=t.convertNodeSourceSpanToLoc(a);e.report({loc:n,messageId:"roleHasRequiredAria",data:{element:u,role:r,missingProps:m},suggest:[{messageId:"suggestRemoveRole",data:{element:u,role:r,missingProps:m},fix:e=>e.removeRange([(null==a?void 0:a.start.offset)-1,null==a?void 0:a.end.offset])}]})}}}}}),se=m({name:"accessibility-table-scope",meta:{type:"suggestion",docs:{description:"Ensures that the `scope` attribute is only used on the `<th>` element",recommended:!1},fixable:"code",schema:[],messages:{accessibilityTableScope:"The `scope` attribute should only be on the `<th>` element"}},defaultOptions:[],create(e){const t=r.getTemplateParserServices(e);return{[`Element$1[name=${te([...L()].filter(e=>"th"!==e))}] > :matches(BoundAttribute, TextAttribute)[name='scope']`]({sourceSpan:n}){const r=t.convertNodeSourceSpanToLoc(n);e.report({loc:r,messageId:"accessibilityTableScope",fix:e=>e.removeRange([n.start.offset-1,n.end.offset])})}}}}),ie=m({name:"accessibility-valid-aria",meta:{type:"suggestion",docs:{description:"Ensures that correct ARIA attributes and respective values are used",recommended:!1},hasSuggestions:!0,schema:[],messages:{accessibilityValidAria:"The `{{attribute}}` is an invalid ARIA attribute",accessibilityValidAriaValue:"The `{{attribute}}` has an invalid value. Check the valid values at https://raw.githack.com/w3c/aria/stable/#roles",suggestRemoveInvalidAria:"Remove attribute `{{attribute}}`"}},defaultOptions:[],create(e){const t=r.getTemplateParserServices(e);return{[`Element$1[name=${te([...L()])}] > :matches(BoundAttribute, TextAttribute)[name=/^aria-.+/]`](n){const{name:r,sourceSpan:a}=n,i=s.aria.get(r),u=t.convertNodeSourceSpanToLoc(a);if(!i)return void e.report({loc:u,messageId:"accessibilityValidAria",data:{attribute:r},suggest:[{messageId:"suggestRemoveInvalidAria",data:{attribute:r},fix:e=>e.removeRange([a.start.offset-1,a.end.offset])}]});const c=function(e){return e instanceof o.TmplAstBoundAttribute&&e.value instanceof o.ASTWithSource?e.value.ast:e}(n);(function(e){return!function(e){return e instanceof o.LiteralArray||e instanceof o.LiteralMap}(e)&&!function(e){return e instanceof o.LiteralPrimitive||e instanceof o.TmplAstTextAttribute}(e)})(c)||function({allowundefined:e,type:t,values:n},r){if(e&&ce(r))return!0;switch(t){case"boolean":return ue(r);case"tristate":return ue(r)||ce(r);case"id":case"idlist":return!0;case"integer":return a=r,!Number.isNaN(a)&&parseInt(Number(a))==a&&!Number.isNaN(parseInt(a,10));case"number":return function(e){return!Number.isNaN(Number.parseFloat(e))&&Number.isFinite(e)}(r);case"string":return function(e){return"string"==typeof e}(r);case"token":case"tokenlist":{const e=ue(r)?JSON.parse(r):r;return Boolean(null==n?void 0:n.includes(e))}}var a}(i,c.value)||e.report({loc:u,messageId:"accessibilityValidAriaValue",data:{attribute:r}})}}}});function ue(e){return"boolean"==typeof e||"false"===e||"true"===e}function ce(e){return null==e}const le={alphabetical:!1,order:["STRUCTURAL_DIRECTIVE","TEMPLATE_REFERENCE","ATTRIBUTE_BINDING","INPUT_BINDING","TWO_WAY_BINDING","OUTPUT_BINDING"]};var pe=m({name:"attributes-order",meta:{type:"layout",docs:{description:"Ensures that HTML attributes and Angular bindings are sorted based on an expected order",recommended:!1},fixable:"code",schema:[{type:"object",properties:{alphabetical:{type:"boolean",default:le.alphabetical},order:{type:"array",items:{enum:le.order},default:le.order,minItems:le.order.length,uniqueItems:!0}},additionalProperties:!1}],messages:{attributesOrder:"The element's attributes/bindings did not match the expected order: expected {{expected}} instead of {{actual}}"}},defaultOptions:[le],create(e,[{alphabetical:t,order:n}]){const a=r.getTemplateParserServices(e);function o(e){const t=a.convertNodeSourceSpanToLoc(e.sourceSpan);switch(e.orderType){case"STRUCTURAL_DIRECTIVE":return{start:{line:t.start.line,column:t.start.column-1},end:{line:t.end.line,column:t.end.column+1}};default:return t}}return{Element$1(r){const{attributes:a,inputs:s,outputs:i,references:u}=r,{extractedBananaBoxes:c,extractedInputs:l,extractedOutputs:p}=function(e,t){const n=e.filter(e=>!t.some(t=>Ee(e,t))).map(ge),{extractedBananaBoxes:r,extractedOutputs:a}=t.reduce(({extractedBananaBoxes:t,extractedOutputs:n},r)=>{const a=e.find(e=>Ee(e,r));return{extractedBananaBoxes:t.concat(a?Te(a):[]),extractedOutputs:n.concat(a?[]:Se(r))}},{extractedBananaBoxes:[],extractedOutputs:[]});return{extractedBananaBoxes:r,extractedInputs:n,extractedOutputs:a}}(s.map(ge),i.map(Se)),m=[...be(r),...a.map(fe),...u.map(Ae),...c,...l,...p];if(m.length<2)return;const d=[...m].sort(me),f=[...m].sort(function(e,t){return function(n,r){const a=de(n,e)-de(r,e);return t&&0===a?n.name>r.name?1:-1:a}}(n,t));let g;for(let e=0;e<d.length;e++){var y,S;d[e]!==f[e]&&(g=[null!=(y=null==(S=g)?void 0:S[0])?y:e,e])}if(g){const[t,n]=g,r=e.getSourceCode(),{start:a}=o(d[t]),{end:s}=o(d[n]),i={start:a,end:s},u=[he(d[t]),ve(d[n])];let c="",l=u[0];for(let e=t;e<=n;e++){const t=d[e],n=he(t),a=ve(t),o=f[e],s=he(o),i=ve(o);c+=r.text.slice(l,n),c+=r.text.slice(s,i),l=a}e.report({loc:i,messageId:"attributesOrder",data:{expected:f.slice(t,n+1).map(e=>`\`${xe(e)}\``).join(", "),actual:d.slice(t,n+1).map(e=>`\`${xe(e)}\``).join(", ")},fix:e=>e.replaceTextRange(u,c)})}}}}});function me(e,t){return e.sourceSpan.start.line===t.sourceSpan.start.line?e.sourceSpan.start.col-t.sourceSpan.start.col:e.sourceSpan.start.line-t.sourceSpan.start.line}function de(e,t){return t.indexOf(e.orderType)}function fe(e){return{...e,orderType:"ATTRIBUTE_BINDING"}}function ge(e){return{...e,orderType:"INPUT_BINDING"}}function ye(e){return{...e,orderType:"STRUCTURAL_DIRECTIVE"}}function Se(e){return{...e,orderType:"OUTPUT_BINDING"}}function Te(e){return{...e,orderType:"TWO_WAY_BINDING"}}function Ae(e){return{...e,orderType:"TEMPLATE_REFERENCE"}}function be(e){return function(e){return e instanceof o.TmplAstTemplate}(e.parent)?e.parent.templateAttrs.map(ye):[]}function Ee(e,t){return e.sourceSpan.start===t.sourceSpan.start&&e.sourceSpan.end===t.sourceSpan.end}function xe(e){switch(e.orderType){case"STRUCTURAL_DIRECTIVE":return`*${e.name}`;case"TEMPLATE_REFERENCE":return`#${e.name}`;case"INPUT_BINDING":return`[${e.name}]`;case"OUTPUT_BINDING":return`(${e.name})`;case"TWO_WAY_BINDING":return`[(${e.name})]`;default:return e.name}}function he(e){switch(e.orderType){case"STRUCTURAL_DIRECTIVE":return e.sourceSpan.start.offset-1;default:return e.sourceSpan.start.offset}}function ve(e){switch(e.orderType){case"STRUCTURAL_DIRECTIVE":return e.sourceSpan.end.offset+1;default:return e.sourceSpan.end.offset}}const Ce=/\[(.*)\]/;var Fe=m({name:"banana-in-box",meta:{type:"suggestion",docs:{description:"Ensures that the two-way data binding syntax is correct",recommended:"error"},fixable:"code",schema:[],messages:{bananaInBox:"Invalid binding syntax. Use [(expr)] instead"}},defaultOptions:[],create(e){const t=r.getTemplateParserServices(e),n=e.getSourceCode();return{BoundEvent({name:r,sourceSpan:a}){const o=r.match(Ce);if(!o)return;const s=t.convertNodeSourceSpanToLoc(a);e.report({messageId:"bananaInBox",loc:s,fix:e=>{const[,t]=o,a=`[(${t})]`,i=n.getIndexFromLoc(s.start);return e.replaceTextRange([i,i+r.length+2],a)}})}}}});const De=["button","submit","reset"];var Be=m({name:"button-has-type",meta:{type:"suggestion",docs:{description:"Ensures that a button has a valid type specified",recommended:!1},schema:[],messages:{missingType:"Type for <button> is missing",invalidType:'"{{type}}" can not be used as a type for <button>'}},defaultOptions:[],create(e){const t=r.getTemplateParserServices(e);return{"Element$1[name=button]"(n){(function({inputs:e,attributes:t}){return[...e,...t].some(({name:e})=>"type"===e)})(n)||e.report({loc:t.convertNodeSourceSpanToLoc(n.sourceSpan),messageId:"missingType"});const r=function(e){const t=e.attributes.find(({name:e,value:t})=>"type"===e&&!De.includes(t));if(t)return{sourceSpan:t.sourceSpan,value:t.value};for(const{name:t,value:n,sourceSpan:r}of e.inputs)if("type"===t&&n instanceof o.ASTWithSource&&n.ast instanceof o.LiteralPrimitive&&!De.includes(n.ast.value))return{value:n.ast.value,sourceSpan:r};return null}(n);null!=r&&e.report({loc:t.convertNodeSourceSpanToLoc(r.sourceSpan),messageId:"invalidType",data:{type:r.value}})}}}}),Ie=m({name:"click-events-have-key-events",meta:{type:"suggestion",docs:{description:"Ensures that the click event is accompanied with at least one key event keyup, keydown or keypress.",recommended:!1},schema:[],messages:{clickEventsHaveKeyEvents:"click must be accompanied by either keyup, keydown or keypress event for accessibility."}},defaultOptions:[],create:e=>({Element$1(t){if(!L().has(t.name))return;if(M(t)||B(t)||q(t))return;let n=!1,a=!1;for(const e of t.outputs)n=n||"click"===e.name,a=a||e.name.startsWith("keyup")||e.name.startsWith("keydown")||e.name.startsWith("keypress");if(!n||a)return;const o=r.getTemplateParserServices(e).convertNodeSourceSpanToLoc(t.sourceSpan);e.report({loc:o,messageId:"clickEventsHaveKeyEvents"})}})}),we=m({name:"conditional-complexity",meta:{type:"suggestion",docs:{description:"The conditional complexity should not exceed a rational limit",recommended:!1},schema:[{type:"object",properties:{maxComplexity:{minimum:1,type:"number"}},additionalProperties:!1}],messages:{conditionalComplexity:"The conditional complexity {{totalComplexity}} exceeds the defined limit {{maxComplexity}}"}},defaultOptions:[{maxComplexity:5}],create(e,[{maxComplexity:t}]){r.ensureTemplateParser(e);const n=e.getSourceCode();return{BoundAttribute(r){if(!r.value.source||r.value.ast instanceof o.Interpolation)return;const a=Oe(Ne((Pe||(Pe=new o.Parser(new o.Lexer))).parseBinding(r.value.source,"",0).ast));if(a<=t)return;const{sourceSpan:{start:s,end:i}}=r.value;e.report({loc:{start:n.getLocFromIndex(s),end:n.getLocFromIndex(i)},messageId:"conditionalComplexity",data:{maxComplexity:t,totalComplexity:a}})},Interpolation({expressions:r}){for(const a of r){const r=Oe(a);if(r<=t)continue;const{sourceSpan:{start:o,end:s}}=a;e.report({loc:{start:n.getLocFromIndex(o),end:n.getLocFromIndex(s)},messageId:"conditionalComplexity",data:{maxComplexity:t,totalComplexity:r}})}}}}});function Ne(e){return e instanceof o.BindingPipe?e.exp:e}let Pe=null;function Oe(e){const t=Ne(e);if(!(t instanceof o.Binary||t instanceof o.Conditional))return 0;let n=1;return t instanceof o.Binary&&(t.left instanceof o.Binary&&(n+=Oe(t.left)),t.right instanceof o.Binary&&(n+=Oe(t.right))),t instanceof o.Conditional&&(n+=Oe(t.condition)+Oe(t.trueExp)+Oe(t.falseExp)),n}var Le=m({name:"cyclomatic-complexity",meta:{type:"suggestion",docs:{description:"Checks cyclomatic complexity against a specified limit. It is a quantitative measure of the number of linearly independent paths through a program's source code",recommended:!1},schema:[{type:"object",properties:{maxComplexity:{type:"number",minimum:1}},additionalProperties:!1}],messages:{cyclomaticComplexity:"The cyclomatic complexity {{totalComplexity}} exceeds the defined limit {{maxComplexity}}"}},defaultOptions:[{maxComplexity:5}],create(e,[{maxComplexity:t}]){let n=0;const a=r.getTemplateParserServices(e);return{'BoundAttribute[name=/^(ngForOf|ngIf|ngSwitchCase)$/], TextAttribute[name="ngSwitchDefault"]'({sourceSpan:r}){if(n+=1,n<=t)return;const o=a.convertNodeSourceSpanToLoc(r);e.report({messageId:"cyclomaticComplexity",loc:o,data:{maxComplexity:t,totalComplexity:n}})}}}});const ke={allowNullOrUndefined:!1};var Re=m({name:"eqeqeq",meta:{type:"suggestion",docs:{description:"Requires `===` and `!==` in place of `==` and `!=`",recommended:"error"},hasSuggestions:!0,fixable:"code",schema:[{type:"object",properties:{allowNullOrUndefined:{type:"boolean",default:ke.allowNullOrUndefined}},additionalProperties:!1}],messages:{eqeqeq:"Expected `{{expectedOperation}}` but received `{{actualOperation}}`",suggestStrictEquality:"Replace `{{actualOperation}}` with `{{expectedOperation}}`"}},defaultOptions:[ke],create(e,[{allowNullOrUndefined:t}]){r.ensureTemplateParser(e);const n=e.getSourceCode();return{"Binary[operation=/^(==|!=)$/]"(r){const{left:a,operation:o,right:s,sourceSpan:{start:i,end:u}}=r;if(t&&(Me(a)||Me(s)))return;const c={actualOperation:o,expectedOperation:`${o}=`};e.report({loc:{start:n.getLocFromIndex(i),end:n.getLocFromIndex(u)},messageId:"eqeqeq",data:c,...Ke(a)||Ke(s)?{fix:e=>$e({node:r,left:a,right:s,start:i,end:u,fixer:e})}:{suggest:[{messageId:"suggestStrictEquality",fix:e=>$e({node:r,left:a,right:s,start:i,end:u,fixer:e}),data:c}]}})}}}});function _e({span:{start:e,end:t}}){return t-e}const $e=({node:e,left:t,right:n,start:r,end:a,fixer:o})=>{var s;const{source:i}=null!=(s=D(e,je))?s:{};return i?o.insertTextAfterRange([r+_e(t)+1,a-_e(n)-1],"="):null};function je(e){return e instanceof o.ASTWithSource}function qe(e){return e instanceof o.LiteralPrimitive}function Ke(e){return qe(e)&&"string"==typeof e.value&&(t=e.value,!(!Number.isNaN(Number.parseFloat(String(t)))&&Number.isFinite(Number(t))));var t}function Me(e){return qe(e)&&null==e.value}const Ue=/[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7C6\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB67\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,Xe=new RegExp(`[^${Ue}]`),Je=new Set(["charset","class","color","colspan","fill","formControlName","height","href","id","lang","ngClass","ngProjectAs","routerLink","src","stroke","stroke-width","style","svgIcon","tabindex","target","type","viewBox","width","xmlns"]),We={checkAttributes:!0,checkId:!0,checkDuplicateId:!0,checkText:!0,ignoreAttributes:[...Je]},Ve="https://angular.io/guide/i18n",Ye=`${Ve}#mark-element-attributes-for-translations`,He=`${Ve}#mark-plurals-and-alternates-for-translation`,Ge=`${Ve}#mark-text-for-translations`,ze=`${Ve}#manage-marked-text-with-custom-ids`,Qe=`${Ve}#define-unique-custom-ids`,Ze=`${Ve}-common-prepare#i18n-metadata-for-translation`;var et=m({name:"i18n",meta:{type:"suggestion",docs:{description:"Ensures following best practices for i18n. Checks for missing i18n attributes on elements and attributes containing texts. Can also check for texts without i18n attribute, elements that do not use custom ID (@@) feature and duplicate custom IDs",recommended:!1},fixable:"code",hasSuggestions:!0,schema:[{type:"object",properties:{boundTextAllowedPattern:{type:"string"},checkAttributes:{type:"boolean",default:We.checkAttributes},checkDuplicateId:{type:"boolean",default:We.checkDuplicateId},checkId:{type:"boolean",default:We.checkId},checkText:{type:"boolean",default:We.checkText},ignoreAttributes:{type:"array",items:{type:"string"},default:[...Je]},ignoreTags:{type:"array",items:{type:"string"}},requireDescription:{type:"boolean",default:We.requireDescription}},additionalProperties:!1}],messages:{i18nAttribute:`Attribute "{{attributeName}}" has no corresponding i18n attribute. See more at ${Ye}`,i18nAttributeOnIcuOrText:`Each element containing text node should have an i18n attribute. See more at ${He} and ${Ge}`,i18nCustomIdOnAttribute:`Missing custom ID on attribute "i18n-{{attributeName}}". See more at ${ze}`,i18nCustomIdOnElement:`Missing custom ID on element. See more at ${ze}`,i18nDuplicateCustomId:`Duplicate custom ID "@@{{customId}}". See more at ${Qe}`,suggestAddI18nAttribute:"Add the `i18n` attribute",i18nMissingDescription:`Missing i18n description on element. See more at ${Ze}`}},defaultOptions:[We],create(e,[{boundTextAllowedPattern:t,checkAttributes:n,checkId:a,checkDuplicateId:s,checkText:i,ignoreAttributes:u,ignoreTags:c,requireDescription:l}]){const p=r.getTemplateParserServices(e),m=e.getSourceCode(),d=t?new RegExp(t):Xe,f=new Set([...Je,...null!=u?u:[]]),g=new Set(c),y=new Map;return{...(a||l)&&{"Element$1[i18n]"(t){!function({i18n:{description:t,customId:n},name:r,parent:o,sourceSpan:s}){if(g.has(r)||nt(o))return;const i=p.convertNodeSourceSpanToLoc(s);if(a)if(rt(n))e.report({messageId:"i18nCustomIdOnElement",loc:i});else{var u;const e=null!=(u=y.get(n))?u:[];y.set(n,[...e,s])}l&&rt(t)&&e.report({messageId:"i18nMissingDescription",loc:i})}(t)}},...(n||a||l)&&{[`Element$1 > TextAttribute[value=${Ue}]`](t){!function({i18n:t,keySpan:r,name:o,parent:{name:s},sourceSpan:i,value:u}){if(g.has(s))return;const c=p.convertNodeSourceSpanToLoc(null!=r?r:i);if(t){const{customId:n,description:r}=t;if(a)if(rt(n))e.report({messageId:"i18nCustomIdOnAttribute",loc:c,data:{attributeName:o}});else{var d;const e=null!=(d=y.get(n))?d:[];y.set(n,[...e,i])}l&&rt(r)&&e.report({messageId:"i18nMissingDescription",loc:c,data:{attributeName:o}})}t||!n||function(e,t,n,r){return e.has(n)||e.has(`${t}[${n}]`)||rt(r)||function(e){return"false"===e||"true"===e}(r)||function(e){const t=Number.parseFloat(e);return!Number.isNaN(t)&&Number.isFinite(t)}(r)}(f,s,o,u)||e.report({messageId:"i18nAttribute",loc:c,data:{attributeName:o},fix:e=>{const{end:t}=p.convertNodeSourceSpanToLoc(i),n=m.getIndexFromLoc(t);return e.insertTextAfterRange([n,n],` i18n-${o}`)}})}(t)}},...i&&{[`BoundText, Icu$1, Text$3[value=${Ue}]`](t){!function(t){var n;const{parent:r,sourceSpan:a}=t;if(t instanceof o.TmplAstBoundText&&function(e,{value:{ast:{strings:t}}}){const n=t.join("").trim();return!Ue.test(n)||e.test(n)}(d,t)||tt(r)&&(r.i18n||g.has(r.name)))return;const s=p.convertNodeSourceSpanToLoc(a),i=e=>function(e,t,n,r,a){return tt(a)?D(a,nt)?[]:function(e,t,{start:n},r){const a=e.getIndexFromLoc(n)+r.length+1;return t.insertTextAfterRange([a,a]," i18n")}(e,n,t.convertNodeSourceSpanToLoc(a.sourceSpan),a.name):function(e,t,{start:n,end:r}){const a=e.getIndexFromLoc(n),o=e.getIndexFromLoc(r);return[t.insertTextBeforeRange([a,a],"<ng-container i18n>"),t.insertTextAfterRange([o,o],"</ng-container>")]}(e,n,r)}(m,p,e,s,r);e.report({messageId:"i18nAttributeOnIcuOrText",loc:s,...null!=r&&null!=(n=r.children)&&n.filter(tt).length?{suggest:[{messageId:"suggestAddI18nAttribute",fix:i}]}:{fix:i}})}(t)}},"Program:exit"(){!function(){if(s)for(const[t,n]of y){if(n.length<=1)break;for(const r of n){const n=p.convertNodeSourceSpanToLoc(r);e.report({messageId:"i18nDuplicateCustomId",loc:n,data:{customId:t}})}}y.clear()}()}}}});function tt(e){return e instanceof o.TmplAstElement}function nt(e){return Boolean(tt(e)&&e.i18n)}function rt(e){return!e||0===e.trim().length}const at="https://www.w3.org/WAI/WCAG21/Understanding/keyboard";var ot=m({name:"mouse-events-have-key-events",meta:{type:"suggestion",docs:{description:`Ensures that the mouse events \`mouseout\` and \`mouseover\` are accompanied by \`focus\` and \`blur\` events respectively. Coding for the keyboard is important for users with physical disabilities who cannot use a mouse, AT compatibility, and screenreader users. See more at ${at}`,recommended:!1},schema:[],messages:{mouseEventsHaveKeyEvents:`\`{{mouseEvent}}\` must be accompanied by \`{{keyEvent}}\` for accessibility (${at})`}},defaultOptions:[],create(e){const t=r.getTemplateParserServices(e),n=te([...L()]);return[["blur","mouseout"],["focus","mouseover"]].reduce((r,[a,o])=>({...r,[`Element$1[name=${n}]:has(BoundEvent[name='${o}']):not(:has(BoundEvent[name='${a}']))`]({sourceSpan:n}){const r=t.convertNodeSourceSpanToLoc(n);e.report({loc:r,messageId:"mouseEventsHaveKeyEvents",data:{keyEvent:a,mouseEvent:o}})}}),{})}}),st=m({name:"no-any",meta:{type:"suggestion",docs:{description:'The use of "$any" nullifies the compile-time benefits of Angular\'s type system',recommended:!1},hasSuggestions:!0,schema:[],messages:{noAny:'Avoid using "$any" in templates',suggestRemoveAny:"Remove $any"}},defaultOptions:[],create(e){r.ensureTemplateParser(e);const t=e.getSourceCode();return{'Call[receiver.name="$any"]'({receiver:n,sourceSpan:{end:r,start:a}}){if(!(n instanceof o.PropertyRead))return;if(!(n.receiver instanceof o.ThisReceiver||n.receiver instanceof o.ImplicitReceiver))return;const s=n.nameSpan;e.report({messageId:"noAny",loc:{start:t.getLocFromIndex(a),end:t.getLocFromIndex(r)},suggest:[{messageId:"suggestRemoveAny",fix:e=>[e.removeRange([s.start,s.end+1]),e.removeRange([r-1,r])]}]})}}}}),it=m({name:"no-autofocus",meta:{type:"suggestion",docs:{description:"Ensures that the `autofocus` attribute is not used",recommended:!1},fixable:"code",schema:[],messages:{noAutofocus:"The `autofocus` attribute should not be used, as it reduces usability and accessibility for users"}},defaultOptions:[],create(e){const t=r.getTemplateParserServices(e);return{[`Element$1[name=${te([...L()])}] > :matches(BoundAttribute, TextAttribute)[name="autofocus"]`]({sourceSpan:n}){const r=t.convertNodeSourceSpanToLoc(n);e.report({loc:r,messageId:"noAutofocus",fix:e=>e.removeRange([n.start.offset-1,n.end.offset])})}}}}),ut=m({name:"no-call-expression",meta:{type:"suggestion",docs:{description:"Disallows calling expressions in templates, except for output handlers",recommended:!1},schema:[],messages:{noCallExpression:"Avoid calling expressions in templates"}},defaultOptions:[],create(e){r.ensureTemplateParser(e);const t=e.getSourceCode();return{'Call[receiver.name!="$any"]'(n){if(Boolean(D(n,ct)))return;const{sourceSpan:{start:r,end:a}}=n;e.report({loc:{start:t.getLocFromIndex(r),end:t.getLocFromIndex(a)},messageId:"noCallExpression"})}}}});function ct(e){return e instanceof o.TmplAstBoundEvent}var lt=m({name:"no-distracting-elements",meta:{type:"suggestion",docs:{description:"Enforces that no distracting elements are used",recommended:!1},fixable:"code",schema:[],messages:{noDistractingElements:"Do not use <{{element}}> elements as they can create visual accessibility issues and are deprecated"}},defaultOptions:[],create(e){const t=r.getTemplateParserServices(e);return{"Element$1[name=/^(blink|marquee)$/]"({name:n,sourceSpan:r}){const a=t.convertNodeSourceSpanToLoc(r);e.report({loc:a,messageId:"noDistractingElements",data:{element:n},fix:e=>e.removeRange([r.start.offset,r.end.offset])})}}}});const pt={allowTwoWayDataBinding:!0,ignore:[]};var mt=m({name:"no-duplicate-attributes",meta:{type:"problem",docs:{description:"Ensures that there are no duplicate input properties or output event listeners",recommended:!1},hasSuggestions:!0,schema:[{type:"object",properties:{allowTwoWayDataBinding:{type:"boolean",default:pt.allowTwoWayDataBinding,description:"Whether or not two-way data binding is allowed as an exception to the rule."},ignore:{type:"array",items:{type:"string"},uniqueItems:!0,default:pt.ignore,description:"Input or output properties for which duplicate presence is allowed as an exception to the rule."}},additionalProperties:!1}],messages:{noDuplicateAttributes:"Duplicate attribute `{{attributeName}}`",suggestRemoveAttribute:"Remove attribute `{{attributeName}}`"}},defaultOptions:[pt],create(e,[{allowTwoWayDataBinding:t,ignore:n}]){const a=r.getTemplateParserServices(e);return{Element$1({inputs:r,outputs:o,attributes:s}){const i=[...dt([...r,...s]),...dt(t?o.filter(e=>!r.some(t=>t.sourceSpan.start===e.sourceSpan.start&&t.sourceSpan.end===e.sourceSpan.end)):o)];(n&&n.length>0?i.filter(e=>!n.includes(f(e))):i).forEach(t=>{const n=a.convertNodeSourceSpanToLoc(t.sourceSpan),r={attributeName:f(t)};e.report({loc:n,messageId:"noDuplicateAttributes",data:r,suggest:[{messageId:"suggestRemoveAttribute",fix:e=>e.removeRange([n.start.column,n.end.column+1]),data:r}]})})}}}});function dt(e){return e.filter(t=>e.some(e=>e!==t&&f(e)===f(t)))}const ft={allowNgStyle:!1,allowBindToStyle:!1};var gt=m({name:"no-inline-styles",meta:{type:"suggestion",docs:{description:"Disallows the use of inline styles in HTML templates",recommended:!1},schema:[{type:"object",properties:{allowNgStyle:{type:"boolean",default:ft.allowNgStyle},allowBindToStyle:{type:"boolean",default:ft.allowBindToStyle}},additionalProperties:!1}],messages:{noInlineStyles:"<{{element}}/> element should not have inline styles via style attribute. Please use classes instead."}},defaultOptions:[ft],create(e,[{allowNgStyle:t,allowBindToStyle:n}]){const a=r.getTemplateParserServices(e);return{Element$1(r){let o=!1;if(t||n){const e=!t&&St(r),a=!n&&Tt(r);o=yt(r)||e||a}else o=yt(r)||St(r)||Tt(r);if(o){const t=a.convertElementSourceSpanToLoc(e,r);e.report({loc:t,messageId:"noInlineStyles",data:{element:r.name}})}}}}});function yt(e){return e.attributes.some(({name:e})=>At(e))||e.inputs.some(({name:e})=>At(e))}function St(e){return e.inputs.some(({name:e})=>function(e){return"ngStyle"===e}(e))}function Tt(e){return e.inputs.some(({keySpan:e})=>function(e){return!(null==e||!e.details)&&e.details.includes("style.")}(e))}function At(e){return"style"===e}var bt=m({name:"no-negated-async",meta:{type:"suggestion",docs:{description:"Ensures that async pipe results are not negated",recommended:"error"},hasSuggestions:!0,schema:[],messages:{noNegatedAsync:"Async pipe results should not be negated. Use `(observable | async) === false`, `(observable | async) === null`, or `(observable | async) === undefined` to check its value instead",suggestFalseComparison:"Compare with `false`",suggestNullComparison:"Compare with `null`",suggestUndefinedComparison:"Compare with `undefined`"}},defaultOptions:[],create(e){r.ensureTemplateParser(e);const t=e.getSourceCode();return{':not(PrefixNot) > PrefixNot > BindingPipe[name="async"]'({parent:{sourceSpan:{end:n,start:r}}}){e.report({messageId:"noNegatedAsync",loc:{start:t.getLocFromIndex(r),end:t.getLocFromIndex(n)},suggest:[{messageId:"suggestFalseComparison",textToInsert:" === false"},{messageId:"suggestNullComparison",textToInsert:" === null"},{messageId:"suggestUndefinedComparison",textToInsert:" === undefined"}].map(({messageId:e,textToInsert:t})=>({messageId:e,fix:e=>[e.removeRange([r,r+1]),e.insertTextAfterRange([n,n],t)]}))})}}}}),Et=m({name:"no-positive-tabindex",meta:{type:"suggestion",docs:{description:"Ensures that the `tabindex` attribute is not positive",recommended:!1},hasSuggestions:!0,schema:[],messages:{noPositiveTabindex:"The `tabindex` attribute should not be positive",suggestNonNegativeTabindex:'Use `tabindex="{{tabindex}}"`'}},defaultOptions:[],create(e){const t=r.getTemplateParserServices(e);return{[`Element$1[name=${te([...L()])}] > BoundAttribute[name="tabindex"][value.ast.value>0], TextAttribute[name="tabindex"][value>0]`]({valueSpan:n}){const r=t.convertNodeSourceSpanToLoc(n);e.report({loc:r,messageId:"noPositiveTabindex",suggest:["-1","0"].map(e=>({messageId:"suggestNonNegativeTabindex",fix:t=>t.replaceTextRange([n.start.offset,n.end.offset],e),data:{tabindex:e}}))})}}}}),xt=m({name:"use-track-by-function",meta:{type:"suggestion",docs:{description:"Ensures trackBy function is used",recommended:!1},schema:[],messages:{useTrackByFunction:"Missing trackBy function in ngFor directive"}},defaultOptions:[],create(e){const t=r.getTemplateParserServices(e);return{'BoundAttribute.inputs[name="ngForOf"]'({parent:{inputs:n},sourceSpan:r}){if(n.some(ht))return;const a=t.convertNodeSourceSpanToLoc(r);e.report({messageId:"useTrackByFunction",loc:a})},'BoundAttribute.templateAttrs[name="ngForOf"]'({parent:{templateAttrs:n}}){if(n.some(ht))return;const{start:r}=t.convertNodeSourceSpanToLoc(n[0].sourceSpan),{end:a}=t.convertNodeSourceSpanToLoc(n[n.length-1].sourceSpan),o={start:{...r,column:r.column-1},end:{...a,column:a.column+1}};e.report({messageId:"useTrackByFunction",loc:o})}}}});function ht(e){return e instanceof o.TmplAstBoundAttribute&&"ngForTrackBy"===e.name}module.exports={configs:{all:{extends:"./configs/base.json",rules:{"@angular-eslint/template/accessibility-alt-text":"error","@angular-eslint/template/accessibility-elements-content":"error","@angular-eslint/template/accessibility-interactive-supports-focus":"error","@angular-eslint/template/accessibility-label-for":"error","@angular-eslint/template/accessibility-label-has-associated-control":"error","@angular-eslint/template/accessibility-role-has-required-aria":"error","@angular-eslint/template/accessibility-table-scope":"error","@angular-eslint/template/accessibility-valid-aria":"error","@angular-eslint/template/attributes-order":"error","@angular-eslint/template/banana-in-box":"error","@angular-eslint/template/button-has-type":"error","@angular-eslint/template/click-events-have-key-events":"error","@angular-eslint/template/conditional-complexity":"error","@angular-eslint/template/cyclomatic-complexity":"error","@angular-eslint/template/eqeqeq":"error","@angular-eslint/template/i18n":"error","@angular-eslint/template/mouse-events-have-key-events":"error","@angular-eslint/template/no-any":"error","@angular-eslint/template/no-autofocus":"error","@angular-eslint/template/no-call-expression":"error","@angular-eslint/template/no-distracting-elements":"error","@angular-eslint/template/no-duplicate-attributes":"error","@angular-eslint/template/no-inline-styles":"error","@angular-eslint/template/no-negated-async":"error","@angular-eslint/template/no-positive-tabindex":"error","@angular-eslint/template/use-track-by-function":"error"}},base:{parser:"@angular-eslint/template-parser",plugins:["@angular-eslint/template"]},recommended:{extends:"./configs/base.json",rules:{"@angular-eslint/template/banana-in-box":"error","@angular-eslint/template/eqeqeq":"error","@angular-eslint/template/no-negated-async":"error"}},"process-inline-templates":{parser:"@typescript-eslint/parser",parserOptions:{ecmaVersion:2020,sourceType:"module"},plugins:["@angular-eslint/template"],processor:"@angular-eslint/template/extract-inline-html"}},processors:l,rules:{"accessibility-alt-text":y,"accessibility-elements-content":P,[U]:X,"accessibility-label-for":G,[z]:ee,[ae]:oe,"accessibility-table-scope":se,"accessibility-valid-aria":ie,"attributes-order":pe,"banana-in-box":Fe,"button-has-type":Be,"conditional-complexity":we,"click-events-have-key-events":Ie,"cyclomatic-complexity":Le,eqeqeq:Re,i18n:et,"mouse-events-have-key-events":ot,"no-any":st,"no-autofocus":it,"no-call-expression":ut,"no-distracting-elements":lt,"no-duplicate-attributes":mt,"no-inline-styles":gt,"no-negated-async":bt,"no-positive-tabindex":Et,"use-track-by-function":xt}};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-eslint/eslint-plugin-template",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.4.1-alpha.0+2541da9",
|
|
4
4
|
"description": "ESLint plugin for Angular Templates",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -17,19 +17,19 @@
|
|
|
17
17
|
"LICENSE"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@angular-eslint/bundled-angular-compiler": "14.
|
|
20
|
+
"@angular-eslint/bundled-angular-compiler": "14.4.1-alpha.0+2541da9",
|
|
21
|
+
"@angular-eslint/utils": "14.4.1-alpha.0+2541da9",
|
|
21
22
|
"@typescript-eslint/type-utils": "5.43.0",
|
|
22
23
|
"@typescript-eslint/utils": "5.43.0",
|
|
23
24
|
"aria-query": "5.1.3",
|
|
24
25
|
"axobject-query": "3.1.1"
|
|
25
26
|
},
|
|
26
27
|
"devDependencies": {
|
|
27
|
-
"@angular-eslint/utils": "14.3.2-alpha.0+0273649",
|
|
28
28
|
"@types/aria-query": "5.0.1"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"eslint": "^7.0.0 || ^8.0.0",
|
|
32
32
|
"typescript": "*"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "2541da9e7b785720f1eba180cc6a9154212c3e5f"
|
|
35
35
|
}
|