@eslint-sukka/eslint-plugin-sukka-full 8.11.2 → 8.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +23 -15
- package/dist/index.d.ts +37 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1,28 +1,36 @@
|
|
|
1
|
-
"use strict";let e,t;var r,n,o,a,i,s,l,u=require("eslint-plugin-sukka"),p=require("node:assert/strict"),c=require("node:util/types"),d=require("node:path"),m=require("node:util"),f=require("eslint/use-at-your-own-risk");function g(e,t){if("string"==typeof t){let e=t;t=t=>t.type===e}for(;e;){if(t(e))return e;e=e.parent}}function y(e){return e?.type==="Identifier"||e?.type==="PrivateIdentifier"}function h(e){return e?.type==="MemberExpression"}function x(e){return e?.type==="AwaitExpression"}function b(e,t){return!!y(e)&&("function"==typeof t?t(e.name):Array.isArray(t)?t.includes(e.name):e.name===t)}function E(e,t){return e?.type==="Literal"&&(Array.isArray(t)?t.includes(e.value):"string"==typeof e.value&&t instanceof RegExp?t.test(e.value):e.value===t)}function D(e){return!!e&&["ArrowFunctionExpression","FunctionDeclaration","FunctionExpression"].includes(e.type)}function S(e,t){return e?.type==="Identifier"&&t?.type===e.type&&e.name===t.name}function v({create:e,defaultOptions:t,meta:r,name:n}){return r.docs&&!r.docs.url&&(r.docs.url=new URL(n,"https://dimensiondev.github.io/eslint-plugin/src/rules/").href),{create(r){var n,o;let a,i=(n=t,o=r.options,a=structuredClone(n),null==o||a.forEach((e,t)=>{if(void 0!==o[t]){let r=o[t];"object"!=typeof r||Array.isArray(r)||"object"!=typeof e||Array.isArray(e)?a[t]=r:a[t]=function e(t={},r={}){return Object.fromEntries([...new Set([...Object.keys(t),...Object.keys(r)])].map(n=>{let o=n in t,a=n in r,i=t[n],s=r[n];return[n,o&&a?"object"!=typeof i||Array.isArray(i)||"object"!=typeof s||Array.isArray(s)?s:e(i,s):o?i:s]}))}(e,r)}}),a);return e(r,i)},defaultOptions:t,meta:r,name:n}}function C(e){if(!e?.program)throw Error("see https://typescript-eslint.io/docs/linting/type-linting")}var A=v({name:"array/no-unneeded-flat-map",meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow `Array#flatMap((x) => x)` when simpler alternatives exist",recommended:"stylistic"},schema:[],messages:{invalid:"Disallow simple `Array#flatMap()` in array"}},defaultOptions:[],create:e=>({CallExpression(t){var r;if("MemberExpression"!==t.callee.type||!b(t.callee.property,"flatMap")||!(D(r=t.arguments[0])&&1===r.params.length&&"Identifier"===r.params[0].type&&r.body&&(S(r.params[0],r.body)||"BlockStatement"===r.body.type&&1===r.body.body.length&&"ReturnStatement"===r.body.body[0].type&&S(r.params[0],r.body.body[0].argument))))return;let{property:n}=t.callee;e.report({node:t,messageId:"invalid",*fix(e){yield e.replaceText(n,"flat"),yield*t.arguments.map(t=>e.remove(t))}})}})});let T=new Set(["href","pathname","search","hash","origin"]);var w=v({name:"browser/prefer-location-assign",meta:{type:"suggestion",fixable:"code",docs:{description:"Prefer `location.assign(...)` over `location.*`",recommended:"stylistic"},schema:[],messages:{instead:"Use `location.assign(...)` instead of `location.{{name}}`"}},defaultOptions:[],create:e=>({AssignmentExpression(t){let r=function(e,t){if(b(e,t))return e;for(;h(e);){if(b(e.property,t))return e;e=e.object}}(t.left,"location");if(!r)return;let n=I(r.parent);e.report({node:t,messageId:"instead",data:{name:n},fix:function(e,t,r){let n=I(t.parent);if(T.has(n??"href"))return n=>n.replaceText(r,`${e.getText(t)}.assign(${e.getText(r.right)})`)}(e.sourceCode,r,t)})}})});function I(e){if(h(e)&&y(e.property))return e.property.name}var F=v({name:"jsx/no-template-literal",meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow use template-literal in JSX",recommended:"stylistic"},schema:[],messages:{invalid:"Disallow use template-literal in JSX"}},defaultOptions:[],create:e=>({JSXExpressionContainer(t){if("TemplateLiteral"!==t.expression.type||t.parent?.type==="JSXAttribute")return;let{expression:r}=t;e.report({node:t,messageId:"invalid",fix(n){let o=[...r.expressions,...r.quasis];o.sort((e,t)=>e.range[0]-t.range[0]);let a=o.map(t=>"TemplateElement"===t.type?t.value.cooked:"{"+e.sourceCode.getText(t)+"}");return n.replaceText(t,a.join(""))}})}})}),j=v({name:"jsx/no-unneeded-nested",meta:{type:"suggestion",fixable:"code",docs:{description:"Reduce unneeded JSXFragment nested",recommended:"stylistic"},schema:[],messages:{invalid:"Reduce unneeded JSXFragment nested"}},defaultOptions:[],create(e){let t=e.sourceCode;return{JSXFragment(r){if(1!==r.children.length)return;let n=r.children[0];e.report({node:r,messageId:"invalid",*fix(e){"JSXExpressionContainer"===n.type?"JSXEmptyExpression"!==n.expression.type&&(yield e.replaceText(r,t.getText(n.expression))):yield e.replaceText(r,t.getText(n))}})}}}});let k=/^toLocale(?<name>Upper|Lower)Case$/g;var B=v({name:"string/no-locale-case",meta:{type:"problem",fixable:"code",docs:{description:"Disallow use `String#toLocale{Upper,Lower}Case()`",recommended:"recommended"},schema:[],messages:{instead:"Use `.to{{name}}Case(...)` instead of `.toLocale{{name}}Case()`"}},defaultOptions:[],create:e=>({CallExpression(t){if(t.arguments.length>0||!h(t.callee)||!y(t.callee.property))return;let{property:r}=t.callee,n=k.exec(r.name);n&&e.report({node:t,data:{name:n.groups?.name},messageId:"instead",fix:e=>e.replaceText(r,r.name.replaceAll("Locale",""))})}})}),P=v({name:"string/no-simple-template-literal",meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow simple template-literal",recommended:"stylistic"},schema:[],messages:{invalid:"Disallow simple template-literal"}},defaultOptions:[],create:e=>({TemplateLiteral(t){var r,n,o,a;let i=(r=e.sourceCode,(o=n=t,o.parent?.type!=="TaggedTemplateExpression"&&1===o.quasis.length&&!function({loc:e}){return!!e&&e.start.line!==e.end.line}(o.quasis[0])&&0===o.expressions.length)?e=>{let t=JSON.stringify(n.quasis[0].value.cooked),o=g(n,e=>"Property"===e.type&&e.key===n);return o?e.replaceText(o,`${t}: ${r.getText(o.value)}`):e.replaceText(n,t)}:2===(a=n).quasis.length&&a.quasis.every(({value:e})=>""===e.cooked)&&1===a.expressions.length?e=>e.replaceText(n,r.getText(n.expressions[0])):void 0);i&&e.report({node:t,messageId:"invalid",fix:i})}})});let $=/\P{ASCII}/u;function R(e,t){return{Program(r){for(let n of r.tokens??[]){let r=function(e){switch(e.type){case"String":case"Template":return e.value.slice(1,-1);case"Identifier":if(e.value.startsWith("#"))return e.value.slice(1);return e.value;case"PrivateIdentifier":case"JSXText":case"JSXIdentifier":return e.value;case"RegularExpression":return e.regex.pattern}return!1}(n);!1!==r&&e.test(r)&&t(n,"code")}for(let n of r.comments??[])e.test(n.value)&&t(n,"comment")}}}function L(e,t){switch(e.type){case"String":case"Template":return r=>{let n=e.value.slice(0,1),o=e.value.slice(-1),a=N(e.value.slice(1,-1),t);return r.replaceText(e,`${n}${a}${o}`)};case"JSXText":return r=>{let n=e.value.replace(t,e=>`&#x${M(e.codePointAt(0))};`);return r.replaceText(e,n)};case"RegularExpression":return r=>{let n=new Set(e.regex.flags);n.add("u");let o=new RegExp(N(e.regex.pattern,t),[...n].join(""));return r.replaceText(e,o.toString())}}}function N(e,t){return e.replace(t,e=>{let t=e.codePointAt(0);return t>65535?`\\u{${M(t)}}`:`\\u${M(t)}`})}function M(e){return e.toString(16).padStart(4,"0").toUpperCase()}v({name:"unicode/specific-set",meta:{type:"problem",fixable:"code",docs:{description:"Limit the range of literal characters"},schema:[{type:"object",properties:{pattern:{type:"string"},flags:{type:"string"},only:{type:"string",enum:["code","comment"]}},additionalProperties:!1}],messages:{illegal:"Illegal character detected"}},defaultOptions:[{pattern:$.source,flags:"u",only:void 0}],create(e,[{pattern:t,flags:r,only:n}]){let o=t?new RegExp(t,r):$;return R(o,(t,r)=>{if(n&&n!==r)return;let a=L(t,RegExp(o.source,"gu"));e.report({node:t,messageId:"illegal",fix:a})})}});let O=/[\u061C\u202A-\u202E\u2066-\u2069]/;var q=v({name:"unicode/no-bidi",meta:{type:"problem",fixable:"code",docs:{description:"Detect and stop Trojan Source attacks",recommended:"recommended"},schema:[],messages:{detected:"Detected potential trojan source attack with unicode bidi introduced in this {{kind}}: {{text}}."}},defaultOptions:[],create:e=>R(O,(t,r)=>{let n=RegExp(O.source,"gu"),o={kind:r,text:N(t.value,n)},a=L(t,n);e.report({node:t,data:o,messageId:"detected",fix:a})})});let U=(t=[/\u00AD\u034F\u061C\u17B4\u17B5\uFEFF\uFFFC/,/\u180B-\u180E/,/\u200B-\u200F/,/\u202A-\u202E/,/\u2060-\u206F/,/\uFE00-\uFE0F/,/\uFFF0-\uFFF8/,/\u{1D173}-\u{1D17A}/u,/\u{E0000}-\u{E007F}/u,/\u{E0100}-\u{E01EF}/u].map(e=>"string"==typeof e?e:e.source).join(""),RegExp(`[${t}]`,"u"));var _=v({name:"unicode/no-invisible",meta:{type:"problem",fixable:"code",docs:{description:"Disallow invisible characters",recommended:"recommended"},schema:[],messages:{illegal:"Illegal character detected"}},defaultOptions:[],create:e=>R(U,t=>{let r=L(t,RegExp(U.source,"gu"));e.report({node:t,messageId:"illegal",fix:r})})}),W=v({name:"no-redundant-variable",meta:{type:"problem",fixable:"code",docs:{description:"Disallow redundant variable",recommended:"stylistic"},schema:[],messages:{invalid:"Disallow Redundant Variable"}},defaultOptions:[],create:e=>({BlockStatement({body:t}){var r,n,o,a,i;let s=t.find(V);if(!s)return;let l=t[t.indexOf(s)-1];r=l,n=s,r&&"VariableDeclaration"===r.type&&1===r.declarations.length&&r.declarations.some(({init:e,id:t})=>null!==e&&S(n.argument,t))&&e.report({node:s,messageId:"invalid",fix:(o=e.sourceCode,a=l,i=s,e=>{var t;let{init:r,id:n}=a.declarations[0];if(!(r&&n&&i.argument))return null;let s=!x(t=r)||g(t,"TryStatement")?t:t.argument,l=(e=>{if(!n.typeAnnotation)return e;let t=o.getText(n.typeAnnotation.typeAnnotation);return`(${e}) as ${x(r)?`Promise<${t}>`:t}`})(o.getText(s));return[e.remove(a),e.replaceText(i.argument,l)]})})}})});function V(e){return"ReturnStatement"===e.type&&y(e.argument)}var z=v({name:"no-single-return",meta:{type:"suggestion",docs:{description:"Disallow single-return",recommended:"stylistic"},schema:[],messages:{invalid:"Disallow Single Return"}},defaultOptions:[],create:e=>({BlockStatement({parent:t,body:r}){if(!D(t))return;let n=function(e,t){let r=t.find(K);if(!r)return;let n=t.find(e=>{var t,n;return t=e,n=r,"VariableDeclaration"===t.type&&"const"!==t.kind&&t.declarations.some(({id:e})=>S(n.argument,e))});if(n)return e.sourceCode.getDeclaredVariables(n).find(({references:e})=>e.every(e=>e.isWriteOnly()||e.identifier.parent===r))}(e,r);for(let{identifier:t}of n?.references??[])t.parent&&e.report({node:t.parent,messageId:"invalid"})}})});function K(e){return"ReturnStatement"===e.type&&y(e.argument)}var G=v({name:"prefer-early-return",meta:{type:"problem",fixable:"code",docs:{description:"Prefer early returns over full-body conditional wrapping in function declarations",recommended:"stylistic"},schema:[{type:"object",properties:{maximumStatements:{type:"integer",minimum:0}},additionalProperties:!1}],messages:{prefer:"Prefer an early return to a conditionally-wrapped function body"}},defaultOptions:[{maximumStatements:0}],create:(e,[{maximumStatements:t}])=>({BlockStatement:function({body:r,parent:n}){var o,a;if(!D(n)||!(1===r.length&&function(e,t){if("IfStatement"!==e.type||null!==e.alternate)return!1;let{consequent:r}=e;return"ExpressionStatement"===r.type&&0===t||"BlockStatement"===r.type&&r.body.length>t}(r[0],t)))return;let i=(o=e,a=r[0],function*(e){var t;let r;if("IfStatement"!==a.type)return;let{test:n,consequent:i}=a;yield e.insertTextBefore(n,"!("),yield e.insertTextAfter(n,")"),yield e.replaceText(i,"return;");let s=(t=o.sourceCode.getText(i),r=t,"BlockStatement"===i.type?r.slice(1,-1):r);yield e.insertTextAfter(a,s)});e.report({node:r[0],messageId:"prefer",fix:i})}})}),J=v({name:"prefer-fetch",meta:{type:"problem",docs:{description:"Enforce fetch",recommended:"stylistic"},schema:[],messages:{callee:"Should use 'fetch' instead"}},defaultOptions:[],create:e=>({ImportDeclaration(t){let r=t.source.value;("axios"===r||"request"===r)&&e.report({node:t,messageId:"callee"})},NewExpression(t){var r;((function({callee:e}){return b(e,"XMLHttpRequest")})(t)||b((r=t).callee,"ActiveXObject")&&E(r.arguments[0],/xmlhttp/i))&&e.report({node:t,messageId:"callee"})},CallExpression(t){((function({callee:e}){let t="$http";return b(e,t)||h(e)&&b(e.object,t)})(t)||function({callee:e,parent:t}){let r=["$","jQuery"];return b(e,r)&&h(t)&&b(t.property,"load")||h(e)&&b(e.object,r)&&b(e.property,["ajax","get","post","getJSON","getScript"])}(t)||X(t,"axios")||X(t,"request"))&&e.report({node:t,messageId:"callee"})}})});function X(e,t){return b(e.callee,"require")&&E(e.arguments[0],t)}let Y=new Set(["setTimeout","setInterval","requestAnimationFrame","requestIdleCallback"]);var H=v({name:"prefer-timer-id",meta:{type:"problem",docs:{description:"Enforce best practice with timer function",recommended:"recommended"},schema:[],messages:{assign:"Timer id should assign to an identifier or member for cleaning up, `const timer = {{name}}(...);`",fix:"Assign timer id to a variable"},hasSuggestions:!0},defaultOptions:[],create:e=>({CallExpression(t){"Identifier"!==t.callee.type||!Y.has(t.callee.name)||function(e){if(!b(e.callee,"setTimeout"))return!1;let t=e.arguments[1];return!t||E(t,0)}(t)||t.parent?.type==="AssignmentExpression"&&t.parent.right===t||t.parent?.type==="VariableDeclarator"&&t.parent.init===t||e.report({node:t,messageId:"assign",data:{name:t.callee.name},suggest:[{messageId:"fix",fix:e=>e.insertTextBefore(t,"const timer = ")}]})}})}),Q=v({name:"string/no-unneeded-to-string",meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow `String#toString()` when simpler alternatives exist",recommended:"stylistic",requiresTypeChecking:!0},schema:[],messages:{invalid:"Disallow use `.toString()` in string"}},defaultOptions:[],create(e){C(e.sourceCode.parserServices);let{program:t,esTreeNodeToTSNodeMap:r}=e.sourceCode.parserServices,n=t.getTypeChecker();return{CallExpression(t){if("MemberExpression"!==t.callee.type)return;let{object:o,property:a}=t.callee;(b(a,"toString")||E(a,"toString"))&&function(e,t){let r=e.getTypeAtLocation(t);if(r.isStringLiteral()||"string"===e.typeToString(r))return!0;let n=r.getSymbol();return n&&"String"===e.symbolToString(n)}(n,r.get(o))&&e.report({node:a,messageId:"invalid",fix:r=>r.replaceText(t,e.sourceCode.getText(o))})}}}}),Z=v({name:"type/no-force-cast-via-top-type",meta:{type:"problem",docs:{description:"Disallowing cast a type `T` to unrelated or incompatible type `Q` via `T as any as Q`",recommended:"recommended"},schema:[],messages:{invalid:"Don't cast this expression to another type by `as {{type}} as T`"}},defaultOptions:[],create:e=>({TSAsExpression(t){var r,n;if("TSAnyKeyword"!==(r=t.typeAnnotation).type&&"TSUnknownKeyword"!==r.type||!((n=t.parent)&&"TSAsExpression"===n.type&&"TSTypeReference"===n.typeAnnotation.type))return;let o="TSAnyKeyword"===t.typeAnnotation.type?"any":"unknown";e.report({node:t,messageId:"invalid",data:{type:o}})}})});let ee=new Set(["BigInt","Boolean","Number","String","Symbol"]);var et=v({name:"type/no-wrapper-type-reference",meta:{type:"problem",fixable:"code",docs:{description:"Disallow wrapper type for type reference",recommended:"recommended"},schema:[],messages:{instead:"Use {{name}} instead"}},defaultOptions:[],create:e=>({TSTypeReference(t){if("Identifier"!==t.typeName.type||!ee.has(t.typeName.name))return;let r=t.typeName.name.toLowerCase();e.report({node:t,messageId:"instead",data:{name:r},fix:e=>e.replaceText(t.typeName,r)})}})}),er=v({name:"no-default-error",meta:{type:"problem",docs:{description:"Restrict the usage of default (unextended) error",recommended:"strict",requiresTypeChecking:!0},schema:[],messages:{invalid:"Default error object should not be used in this project"}},defaultOptions:[],create(e){C(e.sourceCode.parserServices);let{esTreeNodeToTSNodeMap:t,program:r}=e.sourceCode.parserServices,n=r.getTypeChecker();function o(r){"ErrorConstructor"===function(e,t){let r=e.getTypeAtLocation(t).getSymbol();if(!r?.valueDeclaration)return;let n=e.getTypeOfSymbolAtLocation(r,r.valueDeclaration);return e.typeToString(n)}(n,t.get(r))&&e.report({node:r,messageId:"invalid"})}return{ThrowStatement(e){e.argument&&o(e.argument)},NewExpression:o,CallExpression:o}}});let en={ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","body"],AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],AwaitExpression:["argument"],BinaryExpression:["left","right"],BlockStatement:["body"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ChainExpression:["expression"],ClassBody:["body"],ClassDeclaration:["id","superClass","body"],ClassExpression:["id","superClass","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExperimentalRestProperty:["argument"],ExperimentalSpreadProperty:["argument"],ExportAllDeclaration:["exported","source"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source"],ExportSpecifier:["exported","local"],ExpressionStatement:["expression"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],ForStatement:["init","test","update","body"],FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["local"],ImportExpression:["source"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["imported","local"],JSXAttribute:["name","value"],JSXClosingElement:["name"],JSXClosingFragment:[],JSXElement:["openingElement","children","closingElement"],JSXEmptyExpression:[],JSXExpressionContainer:["expression"],JSXFragment:["openingFragment","children","closingFragment"],JSXIdentifier:[],JSXMemberExpression:["object","property"],JSXNamespacedName:["namespace","name"],JSXOpeningElement:["name","attributes"],JSXOpeningFragment:[],JSXSpreadAttribute:["argument"],JSXSpreadChild:["expression"],JSXText:[],LabeledStatement:["label","body"],Literal:[],LogicalExpression:["left","right"],MemberExpression:["object","property"],MetaProperty:["meta","property"],MethodDefinition:["key","value"],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],PrivateIdentifier:[],Program:["body"],Property:["key","value"],PropertyDefinition:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],StaticBlock:["body"],Super:[],SwitchCase:["test","consequent"],SwitchStatement:["discriminant","cases"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]};for(let e of Object.keys(en))Object.freeze(en[e]);Object.freeze(en);let eo=new Set(["parent","leadingComments","trailingComments"]);function ea(e){return!eo.has(e)&&"_"!==e[0]}function ei(e,t){let r="",n=e;for("string"==typeof t?r=t:(r=t.name,n=function(e,t){let r=t.range[0],n=e,o=!1;do for(let e of(o=!1,n.childScopes)){let t=e.block.range;if(t[0]<=r&&r<t[1]){n=e,o=!0;break}}while(o);return n}(n,t));null!=n;){let e=n.set.get(r);if(null!=e)return e;n=n.upper}return null}function es(e,t){return"Punctuator"===e.type&&e.value===t}function el(e){return es(e,"=>")}function eu(e){return es(e,",")}function ep(e){return es(e,";")}function ec(e){return es(e,":")}function ed(e){return es(e,"(")}function em(e){return es(e,")")}function ef(e){return es(e,"{")}function eg(e){return["Block","Line","Shebang"].includes(e.type)}let ey=e=>!ep(e);function eh(e,t){let r=e.parent,n=null,o=null;if("ArrowFunctionExpression"===e.type){let r=t.getTokenBefore(e.body,el);n=r.loc.start,o=r.loc.end}else{var a,i;n=r&&("Property"===r.type||"MethodDefinition"===r.type||"PropertyDefinition"===r.type)?r.loc.start:e.loc.start,o=(a=e,i=t,a.id?i.getTokenAfter(a.id,ed):i.getFirstToken(a,ed)).loc.start}return{start:{...n},end:{...o}}}let ex="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},eb=Object.freeze(new Set(["Array","ArrayBuffer","BigInt","BigInt64Array","BigUint64Array","Boolean","DataView","Date","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","Float32Array","Float64Array","Function","Infinity","Int16Array","Int32Array","Int8Array","isFinite","isNaN","isPrototypeOf","JSON","Map","Math","NaN","Number","Object","parseFloat","parseInt","Promise","Proxy","Reflect","RegExp","Set","String","Symbol","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray","undefined","unescape","WeakMap","WeakSet"])),eE=new Set([Array.isArray,Array.of,Array.prototype.at,Array.prototype.concat,Array.prototype.entries,Array.prototype.every,Array.prototype.filter,Array.prototype.find,Array.prototype.findIndex,Array.prototype.flat,Array.prototype.includes,Array.prototype.indexOf,Array.prototype.join,Array.prototype.keys,Array.prototype.lastIndexOf,Array.prototype.slice,Array.prototype.some,Array.prototype.toString,Array.prototype.values,"function"==typeof BigInt?BigInt:void 0,Boolean,Date,Date.parse,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,escape,isFinite,isNaN,isPrototypeOf,Map,Map.prototype.entries,Map.prototype.get,Map.prototype.has,Map.prototype.keys,Map.prototype.values,...Object.getOwnPropertyNames(Math).filter(e=>"random"!==e).map(e=>Math[e]).filter(e=>"function"==typeof e),Number,Number.isFinite,Number.isNaN,Number.parseFloat,Number.parseInt,Number.prototype.toExponential,Number.prototype.toFixed,Number.prototype.toPrecision,Number.prototype.toString,Object,Object.entries,Object.is,Object.isExtensible,Object.isFrozen,Object.isSealed,Object.keys,Object.values,parseFloat,parseInt,RegExp,Set,Set.prototype.entries,Set.prototype.has,Set.prototype.keys,Set.prototype.values,String,String.fromCharCode,String.fromCodePoint,String.raw,String.prototype.at,String.prototype.charAt,String.prototype.charCodeAt,String.prototype.codePointAt,String.prototype.concat,String.prototype.endsWith,String.prototype.includes,String.prototype.indexOf,String.prototype.lastIndexOf,String.prototype.normalize,String.prototype.padEnd,String.prototype.padStart,String.prototype.slice,String.prototype.startsWith,String.prototype.substr,String.prototype.substring,String.prototype.toLowerCase,String.prototype.toString,String.prototype.toUpperCase,String.prototype.trim,String.prototype.trimEnd,String.prototype.trimLeft,String.prototype.trimRight,String.prototype.trimStart,Symbol.for,Symbol.keyFor,unescape].filter(e=>"function"==typeof e)),eD=new Set([Object.freeze,Object.preventExtensions,Object.seal]),eS=[[Map,new Set(["size"])],[RegExp,new Set(["dotAll","flags","global","hasIndices","ignoreCase","multiline","source","sticky","unicode"])],[Set,new Set(["size"])]];function ev(e,t){let r=[];for(let n=0;n<e.length;++n){let o=e[n];if(null==o)r.length=n+1;else if("SpreadElement"===o.type){let e=eA(o.argument,t);if(null==e)return null;r.push(...e.value)}else{let e=eA(o,t);if(null==e)return null;r.push(e.value)}}return r}let eC=Object.freeze({ArrayExpression(e,t){let r=ev(e.elements,t);return null!=r?{value:r}:null},AssignmentExpression:(e,t)=>"="===e.operator?eA(e.right,t):null,BinaryExpression(e,t){if("in"===e.operator||"instanceof"===e.operator)return null;let r=eA(e.left,t),n=eA(e.right,t);if(null!=r&&null!=n)switch(e.operator){case"==":return{value:r.value==n.value};case"!=":return{value:r.value!=n.value};case"===":return{value:r.value===n.value};case"!==":return{value:r.value!==n.value};case"<":return{value:r.value<n.value};case"<=":return{value:r.value<=n.value};case">":return{value:r.value>n.value};case">=":return{value:r.value>=n.value};case"<<":return{value:r.value<<n.value};case">>":return{value:r.value>>n.value};case">>>":return{value:r.value>>>n.value};case"+":return{value:r.value+n.value};case"-":return{value:r.value-n.value};case"*":return{value:r.value*n.value};case"/":return{value:r.value/n.value};case"%":return{value:r.value%n.value};case"**":return{value:r.value**n.value};case"|":return{value:r.value|n.value};case"^":return{value:r.value^n.value};case"&":return{value:r.value&n.value}}return null},CallExpression(e,t){let r=e.callee,n=ev(e.arguments,t);if(null!=n)if("MemberExpression"===r.type){if("PrivateIdentifier"===r.property.type)return null;let o=eA(r.object,t);if(null!=o){if(null==o.value&&(o.optional||e.optional))return{value:void 0,optional:!0};let a=eT(r,t);if(null!=a){let e=o.value,t=a.value;if(eE.has(e[t]))return{value:e[t](...n)};if(eD.has(e[t]))return{value:n[0]}}}}else{let o=eA(r,t);if(null!=o){if(null==o.value&&e.optional)return{value:void 0,optional:!0};let t=o.value;if(eE.has(t))return{value:t(...n)};if(eD.has(t))return{value:n[0]}}}return null},ConditionalExpression(e,t){let r=eA(e.test,t);return null!=r?r.value?eA(e.consequent,t):eA(e.alternate,t):null},ExpressionStatement:(e,t)=>eA(e.expression,t),Identifier(e,t){if(null!=t){let r=ei(t,e);if(null!=r){if(null!=r&&0===r.defs.length&&eb.has(r.name)&&r.name in ex)return{value:ex[r.name]};if(function(e){let t,r,n;if(1!==e.defs.length)return!1;let o=e.defs[0];return!!(o.parent&&"Variable"===o.type&&("const"===o.parent.kind||(r=(t=e.references).filter(e=>e.init).length,n=t.filter(e=>e.isReadOnly()).length,1===r&&n+r===t.length)))}(r)){let e=r.defs[0];if("Identifier"===e.node.id.type){let n=eA(e.node.init,t);return n&&"object"==typeof n.value&&null!==n.value&&function(e,t){for(let r of e.references){let e=r.identifier;for(;e&&e.parent&&"MemberExpression"===e.parent.type;)e=e.parent;if(e&&e.parent&&("AssignmentExpression"===e.parent.type&&e.parent.left===e||"UpdateExpression"===e.parent.type&&e.parent.argument===e||"CallExpression"===e.parent.type&&e.parent.callee===e&&"MemberExpression"===e.type&&function(e){if(null==e||null==e.value)return!1;let t=e.value;return"copyWithin"===t||"fill"===t||"pop"===t||"push"===t||"reverse"===t||"shift"===t||"sort"===t||"splice"===t||"unshift"===t}(eT(e,t))))return!0}return!1}(r,t)?null:n}}}}return null},Literal:e=>(null!=e.regex||null!=e.bigint)&&null==e.value?null:{value:e.value},LogicalExpression(e,t){let r=eA(e.left,t);if(null!=r){if("||"===e.operator&&!0==!!r.value||"&&"===e.operator&&!1==!!r.value||"??"===e.operator&&null!=r.value)return r;let n=eA(e.right,t);if(null!=n)return n}return null},MemberExpression(e,t){if("PrivateIdentifier"===e.property.type)return null;let r=eA(e.object,t);if(null!=r){if(null==r.value&&(r.optional||e.optional))return{value:void 0,optional:!0};let n=eT(e,t);if(null!=n){let e;if(null==(e=function(e,t){let r=e;for(;("object"==typeof r||"function"==typeof r)&&null!==r;){let e=Object.getOwnPropertyDescriptor(r,t);if(e)return e;r=Object.getPrototypeOf(r)}return null}(r.value,n.value))||null==e.get)return{value:r.value[n.value]};for(let[e,t]of eS)if(r.value instanceof e&&t.has(n.value))return{value:r.value[n.value]}}}return null},ChainExpression(e,t){let r=eA(e.expression,t);return null!=r?{value:r.value}:null},NewExpression(e,t){let r=eA(e.callee,t),n=ev(e.arguments,t);if(null!=r&&null!=n){let e=r.value;if(eE.has(e))return{value:new e(...n)}}return null},ObjectExpression(e,t){let r={};for(let n of e.properties)if("Property"===n.type){if("init"!==n.kind)return null;let e=eT(n,t),o=eA(n.value,t);if(null==e||null==o)return null;r[e.value]=o.value}else{if("SpreadElement"!==n.type&&"ExperimentalSpreadProperty"!==n.type)return null;let e=eA(n.argument,t);if(null==e)return null;Object.assign(r,e.value)}return{value:r}},SequenceExpression:(e,t)=>eA(e.expressions[e.expressions.length-1],t),TaggedTemplateExpression(e,t){let r=eA(e.tag,t),n=ev(e.quasi.expressions,t);if(null!=r&&null!=n){let t=r.value,o=e.quasi.quasis.map(e=>e.value.cooked);if(o.raw=e.quasi.quasis.map(e=>e.value.raw),t===String.raw)return{value:t(o,...n)}}return null},TemplateLiteral(e,t){let r=ev(e.expressions,t);if(null!=r){let t=e.quasis[0].value.cooked;for(let n=0;n<r.length;++n)t+=r[n],t+=e.quasis[n+1].value.cooked;return{value:t}}return null},UnaryExpression(e,t){if("delete"===e.operator)return null;if("void"===e.operator)return{value:void 0};let r=eA(e.argument,t);if(null!=r)switch(e.operator){case"-":return{value:-r.value};case"+":return{value:+r.value};case"!":return{value:!r.value};case"~":return{value:~r.value};case"typeof":return{value:typeof r.value}}return null},TSAsExpression:(e,t)=>eA(e.expression,t),TSSatisfiesExpression:(e,t)=>eA(e.expression,t),TSTypeAssertion:(e,t)=>eA(e.expression,t),TSNonNullExpression:(e,t)=>eA(e.expression,t),TSInstantiationExpression:(e,t)=>eA(e.expression,t)});function eA(e,t){return null!=e&&Object.hasOwnProperty.call(eC,e.type)?eC[e.type](e,t):null}function eT(e,t){let r="Property"===e.type?e.key:e.property;return e.computed?eA(r,t):"Identifier"===r.type?{value:r.name}:"Literal"===r.type?r.bigint?{value:r.bigint}:{value:String(r.value)}:null}function ew(e,t=null){try{return eA(e,t)}catch(e){return null}}function eI(e,t=null){if(e&&"Literal"===e.type&&null===e.value){if(e.regex)return`/${e.regex.pattern}/${e.regex.flags}`;if(e.bigint)return e.bigint}let r=ew(e,t);if(r)try{return String(r.value)}catch{}return null}function eF(e,t){switch(e.type){case"MemberExpression":if(e.computed)return eI(e.property,t);if("PrivateIdentifier"===e.property.type)break;return e.property.name;case"Property":case"MethodDefinition":case"PropertyDefinition":if(e.computed)return eI(e.key,t);if("Literal"===e.key.type)return String(e.key.value);if("PrivateIdentifier"===e.key.type)break;return e.key.name}return null}function ej(e,t){let r=e.parent;if(!r)return"";let n=[],o="Property"===r.type&&r.value===e,a="MethodDefinition"===r.type&&r.value===e,i="PropertyDefinition"===r.type&&r.value===e;if((a||i)&&(r.static&&n.push("static"),"PrivateIdentifier"===r.key.type&&n.push("private")),e.async&&n.push("async"),e.generator&&n.push("generator"),o||a){if("constructor"===r.kind)return"constructor";"get"===r.kind?n.push("getter"):"set"===r.kind?n.push("setter"):n.push("method")}else i?n.push("method"):("ArrowFunctionExpression"===e.type&&n.push("arrow"),n.push("function"));if(o||a||i)if("PrivateIdentifier"===r.key.type)n.push(`#${r.key.name}`);else{let e=eF(r);if(e)n.push(`'${e}'`);else if(t){let e=t.getText(r.key);e.includes("\n")||n.push(`[${e}]`)}}else e.id?n.push(`'${e.id.name}'`):"VariableDeclarator"===r.type&&r.id&&"Identifier"===r.id.type?n.push(`'${r.id.name}'`):("AssignmentExpression"===r.type||"AssignmentPattern"===r.type)&&r.left&&"Identifier"===r.left.type?n.push(`'${r.left.name}'`):"ExportDefaultDeclaration"===r.type&&r.declaration===e&&n.push("'default'");return n.join(" ")}let ek=Object.freeze(new Set(["==","!=","<","<=",">",">=","<<",">>",">>>","+","-","*","/","%","|","^","&","in"])),eB=Object.freeze(new Set(["-","+","!","~"]));function eP(e){return null!==e&&"object"==typeof e&&"string"==typeof e.type}let e$=Object.freeze(Object.assign(Object.create(null),{$visit(e,t,r){let{type:n}=e;return"function"==typeof this[n]?this[n](e,t,r):this.$visitChildren(e,t,r)},$visitChildren(e,t,r){let{type:n}=e;for(let o of r[n]||Object.keys(e).filter(ea)){let n=e[o];if(Array.isArray(n)){for(let e of n)if(eP(e)&&this.$visit(e,t,r))return!0}else if(eP(n)&&this.$visit(n,t,r))return!0}return!1},ArrowFunctionExpression:()=>!1,AssignmentExpression:()=>!0,AwaitExpression:()=>!0,BinaryExpression(e,t,r){return!!(t.considerImplicitTypeConversion&&ek.has(e.operator))&&("Literal"!==e.left.type||"Literal"!==e.right.type)||this.$visitChildren(e,t,r)},CallExpression:()=>!0,FunctionExpression:()=>!1,ImportExpression:()=>!0,MemberExpression(e,t,r){return!!t.considerGetters||!!t.considerImplicitTypeConversion&&!!e.computed&&"Literal"!==e.property.type||this.$visitChildren(e,t,r)},MethodDefinition(e,t,r){return!!t.considerImplicitTypeConversion&&!!e.computed&&"Literal"!==e.key.type||this.$visitChildren(e,t,r)},NewExpression:()=>!0,Property(e,t,r){return!!t.considerImplicitTypeConversion&&!!e.computed&&"Literal"!==e.key.type||this.$visitChildren(e,t,r)},PropertyDefinition(e,t,r){return!!t.considerImplicitTypeConversion&&!!e.computed&&"Literal"!==e.key.type||this.$visitChildren(e,t,r)},UnaryExpression(e,t,r){return!!("delete"===e.operator||t.considerImplicitTypeConversion&&eB.has(e.operator)&&"Literal"!==e.argument.type)||this.$visitChildren(e,t,r)},UpdateExpression:()=>!0,YieldExpression:()=>!0}));function eR(e,t,r={}){let{considerGetters:n=!1,considerImplicitTypeConversion:o=!1}=r;return e$.$visit(e,{considerGetters:n,considerImplicitTypeConversion:o},t.visitorKeys||en)}function eL(e,t,r){let n,o,a,i,s;if("number"==typeof e){if(n=0|e,o=t,a=r,!(n>=1))throw TypeError("'times' should be a positive integer.")}else n=1,o=e,a=t;if(null==o||null==o.parent||"CatchClause"===o.parent.type&&o.parent.param===o)return!1;i=s=o;do i=a.getTokenBefore(i),s=a.getTokenAfter(s);while(null!=i&&null!=s&&ed(i)&&em(s)&&i!==function(e,t){let r=e.parent;if(!r)return null;switch(r.type){case"CallExpression":case"NewExpression":if(1===r.arguments.length&&r.arguments[0]===e)return t.getTokenAfter(r.typeArguments||r.typeParameters||r.callee,ed);return null;case"DoWhileStatement":if(r.test===e)return t.getTokenAfter(r.body,ed);return null;case"IfStatement":case"WhileStatement":if(r.test===e)return t.getFirstToken(r,1);return null;case"ImportExpression":if(r.source===e)return t.getFirstToken(r,1);return null;case"SwitchStatement":if(r.discriminant===e)return t.getFirstToken(r,1);return null;case"WithStatement":if(r.object===e)return t.getFirstToken(r,1);return null;default:return null}}(o,a)&&--n>0);return 0===n}let eN=/^(?:Import|Export(?:All|Default|Named))Declaration$/u,eM=Function.call.bind(Object.hasOwnProperty),eO=Symbol("read"),eq=Symbol("call"),eU=Symbol("construct"),e_=Symbol("esm"),eW={require:{[eq]:!0}};function eV(e){return null==e||0!==e.defs.length||e.references.some(e=>e.isWrite())}class ez{constructor(e,t={}){let{mode:r="strict",globalObjectNames:n=["global","globalThis","self","window"]}=t;this.variableStack=[],this.globalScope=e,this.mode=r,this.globalObjectNames=n.slice(0)}*iterateGlobalReferences(e){for(let t of Object.keys(e)){let r=e[t],n=[t],o=this.globalScope.set.get(t);eV(o)||(yield*this._iterateVariableReferences(o,n,r,!0))}for(let t of this.globalObjectNames){let r=[],n=this.globalScope.set.get(t);eV(n)||(yield*this._iterateVariableReferences(n,r,e,!1))}}*iterateCjsReferences(e){for(let{node:t}of this.iterateGlobalReferences(eW)){let r=eI(t.arguments[0]);if(null==r||!eM(e,r))continue;let n=e[r],o=[r];n[eO]&&(yield{node:t,path:o,type:eO,info:n[eO]}),yield*this._iteratePropertyReferences(t,o,n)}}*iterateEsmReferences(e){for(let t of this.globalScope.block.body){if(!eN.test(t.type)||null==t.source)continue;let r=t.source.value;if(!eM(e,r))continue;let n=e[r],o=[r];if(n[eO]&&(yield{node:t,path:o,type:eO,info:n[eO]}),"ExportAllDeclaration"===t.type)for(let e of Object.keys(n)){let r=n[e];r[eO]&&(yield{node:t,path:o.concat(e),type:eO,info:r[eO]})}else for(let e of t.specifiers){let t=eM(n,e_),r=this._iterateImportReferences(e,o,t?n:"legacy"===this.mode?{default:n,...n}:{default:n});if(t)yield*r;else for(let e of r)e.path=e.path.filter(eK),(e.path.length>=2||e.type!==eO)&&(yield e)}}}*iteratePropertyReferences(e,t){yield*this._iteratePropertyReferences(e,[],t)}*_iterateVariableReferences(e,t,r,n){if(!this.variableStack.includes(e)){this.variableStack.push(e);try{for(let o of e.references){if(!o.isRead())continue;let e=o.identifier;n&&r[eO]&&(yield{node:e,path:t,type:eO,info:r[eO]}),yield*this._iteratePropertyReferences(e,t,r)}}finally{this.variableStack.pop()}}}*_iteratePropertyReferences(e,t,r){let n=e;for(;function(e){let t=e.parent;if(t)switch(t.type){case"ConditionalExpression":return t.consequent===e||t.alternate===e;case"LogicalExpression":case"ChainExpression":case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":case"TSNonNullExpression":case"TSInstantiationExpression":return!0;case"SequenceExpression":return t.expressions[t.expressions.length-1]===e}return!1}(n);)n=n.parent;let o=n.parent;if(o){if("MemberExpression"===o.type){if(o.object===n){let e=eF(o);if(null==e||!eM(r,e))return;t=t.concat(e);let n=r[e];n[eO]&&(yield{node:o,path:t,type:eO,info:n[eO]}),yield*this._iteratePropertyReferences(o,t,n)}return}if("CallExpression"===o.type){o.callee===n&&r[eq]&&(yield{node:o,path:t,type:eq,info:r[eq]});return}if("NewExpression"===o.type){o.callee===n&&r[eU]&&(yield{node:o,path:t,type:eU,info:r[eU]});return}if("AssignmentExpression"===o.type){o.right===n&&(yield*this._iterateLhsReferences(o.left,t,r),yield*this._iteratePropertyReferences(o,t,r));return}if("AssignmentPattern"===o.type){o.right===n&&(yield*this._iterateLhsReferences(o.left,t,r));return}"VariableDeclarator"===o.type&&o.init===n&&(yield*this._iterateLhsReferences(o.id,t,r))}}*_iterateLhsReferences(e,t,r){if("Identifier"===e.type){let n=ei(this.globalScope,e);null!=n&&(yield*this._iterateVariableReferences(n,t,r,!1));return}if("ObjectPattern"===e.type){for(let n of e.properties){let e=eF(n);if(null==e||!eM(r,e))continue;let o=t.concat(e),a=r[e];a[eO]&&(yield{node:n,path:o,type:eO,info:a[eO]}),yield*this._iterateLhsReferences(n.value,o,a)}return}"AssignmentPattern"===e.type&&(yield*this._iterateLhsReferences(e.left,t,r))}*_iterateImportReferences(e,t,r){let n=e.type;if("ImportSpecifier"===n||"ImportDefaultSpecifier"===n){let o="ImportDefaultSpecifier"===n?"default":"Identifier"===e.imported.type?e.imported.name:e.imported.value;if(!eM(r,o))return;t=t.concat(o);let a=r[o];a[eO]&&(yield{node:e,path:t,type:eO,info:a[eO]}),yield*this._iterateVariableReferences(ei(this.globalScope,e.local),t,a,!1);return}if("ImportNamespaceSpecifier"===n)return void(yield*this._iterateVariableReferences(ei(this.globalScope,e.local),t,r,!1));if("ExportSpecifier"===n){let n="Identifier"===e.local.type?e.local.name:e.local.value;if(!eM(r,n))return;t=t.concat(n);let o=r[n];o[eO]&&(yield{node:e,path:t,type:eO,info:o[eO]})}}}function eK(e,t){return 1!==t||"default"!==e}ez.READ=eO,ez.CALL=eq,ez.CONSTRUCT=eU,ez.ESM=e_;let eG=Symbol("SYNTAX_OPENING_PARENTHESIS_INITIAL_VALUE");function*eJ(e,t){if(!e||!e.parent||"CatchClause"===e.parent.type&&e.parent.param===e)return;let r=eG,n=[e,e];for(;n=function([e,t],r){let n=r.sourceCode.getTokenBefore(e);if(!n||!ed(n))return;let o=r.sourceCode.getTokenAfter(t);if(n&&em(o))return[n,o]}(n,t);){let[o]=n;if(r===eG&&(r=function(e,t){let{parent:r}=e;switch(r.type){case"CallExpression":case"NewExpression":if(1===r.arguments.length&&r.arguments[0]===e)return t.sourceCode.getTokenAfter(r.typeArguments??r.callee,ed);return;case"DoWhileStatement":if(r.test===e)return t.sourceCode.getTokenAfter(r.body,ed);return;case"IfStatement":case"WhileStatement":if(r.test===e)return t.sourceCode.getFirstToken(r,1);return;case"ImportExpression":if(r.source===e)return t.sourceCode.getFirstToken(r,1);return;case"SwitchStatement":if(r.discriminant===e)return t.sourceCode.getFirstToken(r,1);return;case"WithStatement":if(r.object===e)return t.sourceCode.getFirstToken(r,1)}}(e,t)),o===r)break;yield n}}let eX=new WeakMap;function eY(e,t){if(!e||!eX.has(e)){let r=[];for(let[n,o]of eJ(e,t))r.unshift(n),r.push(o);eX.set(e,r)}return eX.get(e)}function eH(e,t){let r=eY(e,t),[n]=t.sourceCode.getRange(r[0]??e),[,o]=t.sourceCode.getRange(r.at(-1)??e);return[n,o]}function eQ(e,t){let[r,n]=eH(e,t);return t.sourceCode.text.slice(r,n)}function eZ(e,t){if(eX.has(e))return eX.get(e).length>0;let r=eJ(e,t).next().done;return r&&eX.set(e,[]),!r}function e0(e,t){return e?.type==="Literal"&&e.value===t}let e1=e=>e?.type==="Literal"&&"string"==typeof e.value,e2=(e,t)=>e?.type==="Literal"&&"boolean"==typeof e.value&&(void 0===t||e.value===t),e3=e=>e1(e)?e.value:e?.type==="TemplateLiteral"&&0===e.expressions.length?e.quasis[0].value.cooked:void 0,e8=e=>"Literal"===e.type&&"number"==typeof e.value,e6=e=>"Literal"===e.type&&!!e.regex,e9=e=>e?.type==="Literal"&&"null"===e.raw,e5=e=>"Literal"===e.type&&!!e.bigint;function e4(e,t,r){if(!r.includes(e?.type))return!1;"string"==typeof t&&(t={names:[t]}),Array.isArray(t)&&(t={names:t});let{name:n,names:o,argumentsLength:a,minimumArguments:i,maximumArguments:s,allowSpreadElement:l,optional:u}={minimumArguments:0,maximumArguments:1/0,allowSpreadElement:!1,...t};if(n&&(o=[n]),!0===u&&e.optional!==u||!1===u&&e.optional||"number"==typeof a&&e.arguments.length!==a||0!==i&&e.arguments.length<i||Number.isFinite(s)&&e.arguments.length>s)return!1;if(!l){let t=Number.isFinite(s)?s:a;if("number"==typeof t&&e.arguments.some((e,r)=>"SpreadElement"===e.type&&r<t))return!1}return!Array.isArray(o)||!(o.length>0)||"Identifier"===e.callee.type&&!!o.includes(e.callee.name)}let e7=(e,t)=>e4(e,t,["CallExpression"]),te=(e,t)=>{if("boolean"==typeof t?.optional)throw TypeError("Cannot check node.optional in `isNewExpression`.");return e4(e,t,["NewExpression"])},tt=(e,t)=>e4(e,t,["CallExpression","NewExpression"]),tr=e=>"ExpressionStatement"===e.type&&"string"==typeof e.directive;function tn(e,t){let{type:r}=e;return"BlockStatement"===r?e.body.every(e=>tn(e,t)):!!("EmptyStatement"===r||t?.(e))}let to=e=>"ArrayExpression"===e.type&&0===e.elements.length,ta=e=>"ObjectExpression"===e.type&&0===e.properties.length;function ti(e){return"ExpressionStatement"===e.type||"ChainExpression"===e.type&&"ExpressionStatement"===e.parent.type}let ts=["FunctionDeclaration","FunctionExpression","ArrowFunctionExpression"];function tl(e){return ts.includes(e.type)}let tu=["DoWhileStatement","ForInStatement","ForOfStatement","ForStatement","WhileStatement"];function tp(e,t){if(e?.type!=="MemberExpression")return!1;"string"==typeof t&&(t={properties:[t]}),Array.isArray(t)&&(t={properties:t});let{property:r,properties:n,object:o,objects:a,optional:i,computed:s}={property:"",properties:[],object:"",...t};if(r&&(n=[r]),o&&(a=[o]),!0===i&&e.optional!==i||!1===i&&e.optional)return!1;if(Array.isArray(n)&&n.length>0){if("Identifier"!==e.property.type||!n.includes(e.property.name))return!1;s??=!1}return!(!0===s&&e.computed!==s||!1===s&&e.computed||Array.isArray(a)&&a.length>0&&("Identifier"!==e.object.type||!a.includes(e.object.name)))}function tc(e,t){"string"==typeof t&&(t={methods:[t]}),Array.isArray(t)&&(t={methods:t});let{optionalCall:r,optionalMember:n,method:o,methods:a}={method:"",methods:[],...t};return e7(e,{argumentsLength:t.argumentsLength,minimumArguments:t.minimumArguments,maximumArguments:t.maximumArguments,allowSpreadElement:t.allowSpreadElement,optional:r})&&tp(e.callee,{object:t.object,objects:t.objects,computed:t.computed,property:o,properties:a,optional:n})}function td(e){return e?.type==="UnaryExpression"&&"-"===e.operator&&e8(e.argument)&&1===e.argument.value}let tm=e=>e7(e,{name:"require",argumentsLength:1,optional:!1})&&e1(e.arguments[0]);function tf(e,t){let r=t.trim().split(".");for(let t=r.length-1;t>=0;t--){let n=r[t];if(!n)return!1;if(0===t)return"Identifier"===e.type&&e.name===n||"this"===n&&"ThisExpression"===e.type||"super"===n&&"Super"===e.type;if(1===t&&"MetaProperty"===e.type&&"Identifier"===e.property.type&&e.property.name===n){e=e.meta;continue}if("MemberExpression"===e.type&&!e.optional&&!e.computed&&"Identifier"===e.property.type&&e.property.name===n){e=e.object;continue}return!1}}function tg(e,t){return t.some(t=>tf(e,t))}function ty(e,t){return"TemplateLiteral"===e.type&&"TaggedTemplateExpression"===e.parent.type&&e.parent.quasi===e&&(!t||tg(e.parent.tag,t))}function th(e){return e?.type==="Identifier"&&"undefined"===e.name}let tx=(e,t)=>(function(e,t){let{object:r,property:n,properties:o}={property:"",properties:[],...t};if(!tp(e,{property:n,properties:o,optional:!1}))return;let a=e.object;return tp(a,{object:r,property:"prototype",optional:!1})||"Array"===r&&to(a)||"Object"===r&&ta(a)})(e,{...t,object:"Array"}),tb=e=>e?.type==="LogicalExpression"&&("&&"===e.operator||"||"===e.operator),tE=e=>e?.type==="UnaryExpression"&&"!"===e.operator,tD=e=>tE(e.parent)&&e.parent.argument===e,tS=(e,t)=>tv(e.parent,t)&&e.parent.arguments[0]===e,tv=(e,t)=>e?.type==="CallExpression"&&!e.optional&&"Identifier"===e.callee.type&&"Boolean"===e.callee.name&&1===e.arguments.length&&"SpreadElement"!==e.arguments[0].type&&((e,t)=>{let{sourceCode:r}=t;if(r.isGlobalReference(e))return!0;let n=ei(r.getScope(e),e);return!n||0===n.defs.length})(e.callee,t);function tC(e,t){return!!(tE(e)||tD(e)||tv(e,t)||tS(e,t))||!!tb(e.parent)&&tC(e.parent,t)}function tA(e){let t;return t=e.parent,!!(t?.type==="VExpressionContainer"&&"VAttribute"===t.parent.type&&t.parent.directive&&t.parent.value===t&&"VDirectiveKey"===t.parent.key.type&&"VIdentifier"===t.parent.key.name.type&&["if","else-if","show"].includes(t.parent.key.name.rawName)||["IfStatement","ConditionalExpression","WhileStatement","DoWhileStatement","ForStatement"].includes(e.parent.type)&&e.parent.test===e)||!!tb(e.parent)&&tA(e.parent)}function tT(e,{test:t,expected:r,ruleId:n}){if(t?.(e)||(r=(r=Array.isArray(r)?r:[r]).map(e=>"string"==typeof e?{value:e}:e),!t&&r.some(t=>Object.entries(t).every(([t,r])=>e[t]===r))))return;let o=`'${JSON.stringify({value:e.value,type:e.type})}'`;r=r.map(e=>`'${JSON.stringify(e)}'`).join(" or ");let a=`\`${n}\`: Unexpected token ${o}`,i=`https://github.com/sindresorhus/eslint-plugin-unicorn/issues/new?title=${encodeURIComponent(a)}`;throw Error(`Expected token ${r}, got ${o}.
|
|
2
|
-
Please open an issue at ${i}.`)}function tw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var tI=tw(function(){if(n)return r;n=1;let e={},t=e.hasOwnProperty,o=(e,r)=>{for(let n in e)t.call(e,n)&&r(n,e[n])},a=e=>"\\u"+("0000"+e).slice(-4),i=(e,t)=>{let r=e.toString(16);return t?r:r.toUpperCase()},s=e.toString,l=Array.isArray,u={"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},p=/[\\\b\f\n\r\t]/,c=/[0-9]/,d=/[\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,m=/([\uD800-\uDBFF][\uDC00-\uDFFF])|([\uD800-\uDFFF])|(['"`])|[^]/g,f=/([\uD800-\uDBFF][\uDC00-\uDFFF])|([\uD800-\uDFFF])|(['"`])|[^ !#-&\(-\[\]-_a-~]/g,g=(e,t)=>{let r,n,y=()=>{v=S,++t.indentLevel,S=t.indent.repeat(t.indentLevel)},h={escapeEverything:!1,minimal:!1,isScriptContext:!1,quotes:"single",wrap:!1,es6:!1,json:!1,compact:!0,lowercaseHex:!1,numbers:"decimal",indent:" ",indentLevel:0,__inline1__:!1,__inline2__:!1},x=t&&t.json;x&&(h.quotes="double",h.wrap=!0),"single"!=(!(P=t)||o(P,(e,t)=>{h[e]=t}),t=h).quotes&&"double"!=t.quotes&&"backtick"!=t.quotes&&(t.quotes="single");let b="double"==t.quotes?'"':"backtick"==t.quotes?"`":"'",E=t.compact,D=t.lowercaseHex,S=t.indent.repeat(t.indentLevel),v="",C=t.__inline1__,A=t.__inline2__,T=E?"":"\n",w=!0,I="binary"==t.numbers,F="octal"==t.numbers,j="decimal"==t.numbers,k="hexadecimal"==t.numbers;if(x&&e&&"function"==typeof e.toJSON&&(e=e.toJSON()),"string"!=typeof(n=e)&&"[object String]"!=s.call(n)){let n,a,i,u;if(n=e,"[object Map]"==s.call(n))return 0==e.size?"new Map()":(E||(t.__inline1__=!0,t.__inline2__=!1),"new Map("+g(Array.from(e),t)+")");if(a=e,"[object Set]"==s.call(a))return 0==e.size?"new Set()":"new Set("+g(Array.from(e),t)+")";if(i=e,"function"==typeof Buffer&&Buffer.isBuffer(i))return 0==e.length?"Buffer.from([])":"Buffer.from("+g(Array.from(e),t)+")";if(l(e)){r=[],t.wrap=!0,C&&(t.__inline1__=!1,t.__inline2__=!0),A||y();var B,P,$=e;let n=$.length,o=-1;for(;++o<n;){B=$[o],w=!1,A&&(t.__inline2__=!1),r.push((E||A?"":S)+g(B,t))}return w?"[]":A?"["+r.join(", ")+"]":"["+T+r.join(","+T)+T+(E?"":v)+"]"}if("number"==typeof(u=e)||"[object Number]"==s.call(u)||"bigint"==typeof e){let t;if(x)return JSON.stringify(Number(e));if(j)t=String(e);else if(k){let r=e.toString(16);D||(r=r.toUpperCase()),t="0x"+r}else I?t="0b"+e.toString(2):F&&(t="0o"+e.toString(8));return"bigint"==typeof e?t+"n":t}{let n;if("bigint"==typeof e)return x?JSON.stringify(Number(e)):e+"n";return(n=e,"[object Object]"==s.call(n))?(r=[],t.wrap=!0,y(),o(e,(e,n)=>{w=!1,r.push((E?"":S)+g(e,t)+":"+(E?"":" ")+g(n,t))}),w)?"{}":"{"+T+r.join(","+T)+T+(E?"":v)+"}":x?JSON.stringify(e)||"null":String(e)}}let R=t.escapeEverything?m:f;return r=e.replace(R,(e,r,n,o,s,l)=>{if(r){if(t.minimal)return r;let e=r.charCodeAt(0),n=r.charCodeAt(1);return t.es6?"\\u{"+i((e-55296)*1024+n-56320+65536,D)+"}":a(i(e,D))+a(i(n,D))}if(n)return a(i(n.charCodeAt(0),D));if("\0"==e&&!x&&!c.test(l.charAt(s+1)))return"\\0";if(o)return o==b||t.escapeEverything?"\\"+o:o;if(p.test(e))return u[e];if(t.minimal&&!d.test(e))return e;let m=i(e.charCodeAt(0),D);return x||m.length>2?a(m):"\\x"+("00"+m).slice(-2)}),"`"==b&&(r=r.replace(/\$\{/g,"\\${")),t.isScriptContext&&(r=r.replace(/<\/(script|style)/gi,"<\\/$1").replace(/<!--/g,x?"\\u003C!--":"\\x3C!--")),t.wrap&&(r=b+r+b),r};return g.version="3.0.2",r=g}());function tF(e,t="'"){if("string"!=typeof e)throw TypeError("Unexpected string.");return tI(e,{quotes:'"'===t?"double":"single",wrap:!0,es6:!0,minimal:!0,lowercaseHex:!1})}var tj={},tk={},tB={},tP=function(){var e,t;return i?tj:(i=1,Object.defineProperty(tj,"__esModule",{value:!0}),Object.defineProperty(tj,"isIdentifierChar",{enumerable:!0,get:function(){return e.isIdentifierChar}}),Object.defineProperty(tj,"isIdentifierName",{enumerable:!0,get:function(){return e.isIdentifierName}}),Object.defineProperty(tj,"isIdentifierStart",{enumerable:!0,get:function(){return e.isIdentifierStart}}),Object.defineProperty(tj,"isKeyword",{enumerable:!0,get:function(){return t.isKeyword}}),Object.defineProperty(tj,"isReservedWord",{enumerable:!0,get:function(){return t.isReservedWord}}),Object.defineProperty(tj,"isStrictBindOnlyReservedWord",{enumerable:!0,get:function(){return t.isStrictBindOnlyReservedWord}}),Object.defineProperty(tj,"isStrictBindReservedWord",{enumerable:!0,get:function(){return t.isStrictBindReservedWord}}),Object.defineProperty(tj,"isStrictReservedWord",{enumerable:!0,get:function(){return t.isStrictReservedWord}}),e=function(){if(o)return tk;o=1,Object.defineProperty(tk,"__esModule",{value:!0}),tk.isIdentifierChar=u,tk.isIdentifierName=function(e){let t=!0;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if((64512&n)==55296&&r+1<e.length){let t=e.charCodeAt(++r);(64512&t)==56320&&(n=65536+((1023&n)<<10)+(1023&t))}if(t){if(t=!1,!l(n))return!1}else if(!u(n))return!1}return!t},tk.isIdentifierStart=l;let e="\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ-ೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ--ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",t="\xb7̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ--ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",r=RegExp("["+e+"]"),n=RegExp("["+e+t+"]");e=t=null;let a=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,7,25,39,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,5,57,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,24,43,261,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7381,42,31,98,114,8702,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,208,30,2,2,2,1,2,6,3,4,10,1,225,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4381,3,5773,3,7472,16,621,2467,541,1507,4938,6,8489],i=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,78,5,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,199,7,137,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,55,9,266,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239];function s(e,t){let r=65536;for(let n=0,o=t.length;n<o&&!((r+=t[n])>e);n+=2)if((r+=t[n+1])>=e)return!0;return!1}function l(e){return e<65?36===e:e<=90||(e<97?95===e:e<=122||(e<=65535?e>=170&&r.test(String.fromCharCode(e)):s(e,a)))}function u(e){return e<48?36===e:e<58||!(e<65)&&(e<=90||(e<97?95===e:e<=122||(e<=65535?e>=170&&n.test(String.fromCharCode(e)):s(e,a)||s(e,i))))}return tk}(),t=function(){if(a)return tB;a=1,Object.defineProperty(tB,"__esModule",{value:!0}),tB.isKeyword=function(t){return e.has(t)},tB.isReservedWord=n,tB.isStrictBindOnlyReservedWord=i,tB.isStrictBindReservedWord=function(e,t){return o(e,t)||i(e)},tB.isStrictReservedWord=o;let e=new Set(["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"]),t=new Set(["implements","interface","let","package","private","protected","public","static","yield"]),r=new Set(["eval","arguments"]);function n(e,t){return t&&"await"===e||"enum"===e}function o(e,r){return n(e,r)||t.has(e)}function i(e){return r.has(e)}return tB}(),tj)}(),t$=tw(tP);function tR(e,t){for(;t;){let r=t.set.get(e);if(r)return r;t=t.upper}}let tL=e=>[e,...e.childScopes.flatMap(e=>tL(e))],tN=e=>[...new Set(tL(e).flatMap(({references:e})=>e))],{isIdentifierName:tM,isStrictReservedWord:tO,isKeyword:tq}=t$,tU=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","as","implements","interface","let","package","private","protected","public","static","yield","any","boolean","constructor","declare","get","module","require","number","set","string","symbol","type","from","of"]),t_=e=>"string"==typeof e&&!tq(e)&&!tO(e,!0)&&tM(e)&&"arguments"!==e&&!tU.has(e),tW=(e,t)=>t.every(t=>!(tR(e,t)||tN(t).some(({identifier:t,resolved:r})=>t?.name===e&&!r))),tV=()=>!0;function tz(e,t,r=tV){if(t_(e)||t_(e+="_")){for(;!tW(e,t)||!r(e,t);)e+="_";return e}}function tK(e,t){if(e.arguments.length>0)return!0;let{sourceCode:r}=t,[n,o]=r.getLastTokens(e,2);return ed(n)&&em(o)&&r.getRange(e.callee)[1]<r.getRange(e)[1]}function tG(e,t){let{sourceCode:r}=t,n=e.typeArguments??e.callee,o=r.getTokenAfter(n,ed),[a,i]=r.getLastTokens(e,2);return{openingParenthesisToken:o,closingParenthesisToken:i,trailingCommaToken:eu(a)?a:void 0}}function tJ(e,t,r=!0){let{sourceCode:n}=e,{openingParenthesisToken:o,closingParenthesisToken:a,trailingCommaToken:i}=tG(t,e),[,s]=n.getRange(o),[l]=n.getRange(r?a:i??a);return n.text.slice(s,l)}function tX(e){let t;switch(e?.type){case"MemberExpression":t=e.property;break;case"ChainExpression":return tX(e.expression);case"Property":case"MethodDefinition":t=e.key}if(t){if("Identifier"===t.type&&!e.computed)return t.name;let r=ew(t);if(!r)return;return String(r.value)}}function tY(e){return["ChainExpression","TSAsExpression","TSSatisfiesExpression","TSTypeAssertion","TSNonNullExpression"].includes(e.type)?tY(e.expression):e}function tH(e,t){if(e=tY(e),t=tY(t),e.type!==t.type)return!1;switch(e.type){case"Super":case"ThisExpression":return!0;case"Identifier":case"PrivateIdentifier":return e.name===t.name;case"Literal":var r,n;return r=e,n=t,r.regex||n.regex?!!(r.regex&&n.regex&&r.regex.pattern===n.regex.pattern&&r.regex.flags===n.regex.flags):r.bigint||n.bigint?r.bigint===n.bigint:r.value===n.value;case"MemberExpression":{let r=tX(e);if(void 0!==r)return tH(e.object,t.object)&&r===tX(t);return e.computed===t.computed&&tH(e.object,t.object)&&tH(e.property,t.property)}default:return!1}}let tQ=e=>null===e||"object"!=typeof e&&"function"!=typeof e,tZ=(e,t)=>{if(!e)return{value:void 0};let{sourceCode:r}=t,n=ew(e,r.getScope(e));if(n&&tQ(n.value))return{value:n.value}},t0=(e,t,r)=>{let n=tZ(e,r),o=tZ(t,r);if(n&&o){let e,t;return(e=n.value)===(t=o.value)||"number"==typeof e&&"number"==typeof t&&Number.isNaN(e)&&Number.isNaN(t)}return!!e&&!!t&&"Literal"!==e.type&&"Literal"!==t.type&&tH(e,t)},t1=(e,t)=>{let r=[],n=[];for(let o of e)o?.type!=="SpreadElement"&&(r.some(e=>t0(e,o,t))&&n.push(o),r.push(o));return n};function t2(e,t){let{sourceCode:r}=t,{start:{line:n,column:o}}=r.getLoc(e);return r.getLines()[n-1].slice(0,o).match(/\s*$/)[0]}function t3(e){let{sourceCode:t}=e,r=t.getAllComments?.();return r?.length?r:t.comments??[]}let t8=(e,t)=>Array.isArray(t)?t:e.sourceCode.getRange(t),t6=([e,t],[r,n])=>e>=r&&t<=n;function t9(e,t,r=[]){let{sourceCode:n}=e,o=t8(e,t),a=r.map(t=>t8(e,t));return t3(e).some(e=>{let t=n.getRange(e);return t6(t,o)&&a.every(e=>!t6(t,e))})}function t5(e,t){let{sourceCode:r}=e,n=r.getLoc(t).end.line;return r.getCommentsAfter(t).findLast(e=>r.getLoc(e).start.line===n)}function t4(e){return/\.(?:ts|mts|cts|tsx)$/i.test(e)}let t7=["Program","StyleSheet","Document","root"];function re(e,t){let{sourceCode:r}=e;return r.parserServices.getTemplateBodyTokenStore&&r.ast.templateBody&&r.getRange(r.ast.templateBody)[0]<=r.getRange(t)[0]&&r.getRange(t)[1]<=r.getRange(r.ast.templateBody)[1]?r.parserServices.getTemplateBodyTokenStore():r}let rt=({identifiers:e,references:t})=>[...new Set([...e,...t.map(({identifier:e})=>e)])];function rr(e){return("MemberExpression"===e.type||"CallExpression"===e.type)&&(!!e.optional||"MemberExpression"===e.type&&rr(e.object))}let rn=(e,t)=>{let{references:r=[]}=ei(e,t)||{};return r};function ro(e,t){if(t.block!==e)throw Error('"functionScope" should be the scope of "functionNode".');let{type:r,id:n}=e;return"ArrowFunctionExpression"!==r&&(!!(t.thisFound||rn(t,"arguments").some(({from:e})=>e===t))||!!n&&!!(rn(t,n).length>0))}let ra=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float16Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"],ri=new Set(["any","error","unknown"]),rs=new Set(["null","undefined"]),rl=e=>e.getSymbol()??e.aliasSymbol,ru=(e,t)=>e?.declarations?.some(e=>t.isSourceFileDefaultLibrary(e.getSourceFile()))??!1;function rp(e,t){try{return t.getBaseTypes(e)??e.getBaseTypes?.()??[]}catch{return[]}}let rc="target",rd="non-target",rm="unknown",rf=new Set(["ClassDeclaration","ClassExpression"]),rg=new Set(["FunctionDeclaration","FunctionExpression"]),ry=new Set(["ClassName","ImportBinding","TSEnumName","Type"]),rh=new Set(["TSBigIntKeyword","TSBooleanKeyword","TSNeverKeyword","TSNullKeyword","TSNumberKeyword","TSStringKeyword","TSSymbolKeyword","TSUndefinedKeyword","TSVoidKeyword","TSArrayType","TSLiteralType","TSTupleType","TSTypeLiteral","TSFunctionType","TSConstructorType"]),rx=(e,t)=>e.every(e=>e===rc)?rc:(t.treatMixedUnionAsNonTarget?e.includes(rd):e.every(e=>e===rd))?rd:rm,rb=e=>e.includes(rc)?rc:e.every(e=>e===rd)?rd:rm,rE=e=>{if("Identifier"===e.type)return e.name;if("TSQualifiedName"===e.type){let t=rE(e.left);return t?`${t}.${e.right.name}`:void 0}},rD=(e,t)=>{let r=t.typeReferenceAliases?.get(e);return t.targetTypeNames.has(e)||r&&t.targetTypeNames.has(r)?rc:t.nonTargetTypeNames?.has(e)?rd:rm};function rS(e,t,r,n=new Set){switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return rS(e.typeAnnotation,t,r,n);case"TSTypeOperator":return"readonly"===e.operator?rS(e.typeAnnotation,t,r,n):rm;case"TSTypeReference":return function e(t,r,n,o){var a,i;let s=rE(t.typeName);if(!s)return rm;if(!n.preferTypeReferenceDefinitions){let e=rD(s,n);if(e!==rm)return e}if(o.has(s))return rm;o.add(s);let l=((e,t)=>{for(;t;){let r=t.set.get(e)?.defs.find(e=>ry.has(e.type));if(r)return r;t=t.upper}})(s,r);if(!l)return o.delete(s),rD(s,n);let u=rm;return"Type"===l.type&&"TSTypeAliasDeclaration"===l.node.type?u=rS(l.node.typeAnnotation,r,n,o):"Type"===l.type&&"TSTypeParameter"===l.node.type?u=rS(l.node.constraint,r,n,o):"Type"===l.type&&"TSInterfaceDeclaration"===l.node.type?(a=l.node,u=0===a.extends.length?rd:rb(a.extends.map(t=>rE(t.expression)?e({typeName:t.expression},r,n,o):rm))):"ClassName"===l.type&&(i=l.node,u=i.superClass&&n.checkClassHeritage?"Identifier"!==i.superClass.type?rm:rC(i.superClass,r,n,o):rd),o.delete(s),u}(e,t,r,n);case"TSUnionType":return rx(e.types.map(e=>rS(e,t,r,n)),r);case"TSIntersectionType":return rb(e.types.map(e=>rS(e,t,r,n)));default:if(r.isTargetTypeAnnotation?.(e))return rc;return rh.has(e?.type)?rd:rm}}let rv=(e,t,r,n)=>e.superClass&&r.checkClassHeritage?rC(e.superClass,t,r,n):rd;function rC(e,t,r,n=new Set){if("Identifier"===e.type){let o=e.name;if(!r.checkClassHeritage)return rD(o,r);if(n.has(o))return rm;n.add(o);let a=((e,t)=>{for(;t;){let r=t.set.get(e);if(r)return r;t=t.upper}})(o,t),[i]=a?.defs??[],s=rm;return i?.type==="Variable"&&"const"===i.parent.kind&&i.node.id===i.name&&i.node.init?s=rC(i.node.init,t,r,n):i?.type==="ClassName"&&(s=rv(i.node,t,r,n)),n.delete(o),i?s:rD(o,r)}return rf.has(e.type)?rv(e,t,r,n):rm}let rA=(e,t,r)=>{let n=e.params.find(e=>"Identifier"===e.type&&"this"===e.name);return rS(n?.typeAnnotation,t.sourceCode.getScope(e),r)};function rT(e,t,r,n=new Set){if(!e)return rm;if("TSSatisfiesExpression"===e.type)return rT(e.expression,t,r,n);let o=t.sourceCode.getScope(e),a=rS(e.typeAnnotation,o,r);if(a!==rm)return a;let i=((e,t,r,n)=>{let o=t.sourceCode.getScope(e);switch(e.type){case"Identifier":return((e,t,r,n)=>{let o=ei(t.sourceCode.getScope(e),e);if(!o||n.has(o)||1!==o.defs.length)return rm;n.add(o);let[a]=o.defs,i=t.sourceCode.getScope(a.name),s=rS(a.name?.typeAnnotation,i,r),l=rm;return s!==rm?l=s:"Variable"===a.type&&"const"===a.parent.kind&&a.node.id===a.name&&a.node.init&&(l=rT(a.node.init,t,r,n)),n.delete(o),l})(e,t,r,n);case"ThisExpression":return r.checkClassSyntax?((e,t,r)=>{for(let{parent:n}=e;n;n=n.parent){if(rf.has(n.type))return rv(n,t.sourceCode.getScope(n),r);if("StaticBlock"===n.type||"PropertyDefinition"===n.type&&n.static)return rd;if(rg.has(n.type)){let e=rA(n,t,r);if(e!==rm)return e;if(n.parent?.type==="Property"&&n.parent.parent?.type==="ObjectExpression")return rd;if(n.parent?.type==="MethodDefinition"){if(n.parent.static)return rd;continue}break}}return rm})(e,t,r):rm;case"NewExpression":let a,i;return r.checkClassSyntax?(a=e.callee,rC(a,t.sourceCode.getScope(a),r,i)):rm;case"TSAsExpression":case"TSTypeAssertion":{let a=rS(e.typeAnnotation,o,r);return a===rm?rT(e.expression,t,r,n):a}case"TSNonNullExpression":case"ParenthesizedExpression":return rT(e.expression,t,r,n);case"SequenceExpression":return rT(e.expressions.at(-1),t,r,n);case"ConditionalExpression":return rx([rT(e.consequent,t,r,n),rT(e.alternate,t,r,n)],r);default:return rm}})(e,t,r,n);if(i!==rm)return i;if("Identifier"!==e.type){let t,n=(t=ew(e,o))?r.getStaticType?.(t.value,e)??rm:rm;if(n!==rm)return n}if(r.isTargetNode?.(e,t)||r.targetConstructorNames?.some(t=>te(e,{name:t}))||r.targetCallNames?.some(t=>e7(e,{name:t})))return rc;let s=((e,t,r)=>{let{parserServices:n}=t.sourceCode;if(!n?.program)return rm;try{let{program:t}=n;return function e(t,r,n,o){if(ri.has(t.intrinsicName))return rm;if(rs.has(t.intrinsicName))return rd;if(t.isTypeParameter?.()){let a=t.getConstraint();return a?e(a,r,n,o):rm}if(t.isUnion())return rx(t.types.map(t=>e(t,r,n,o)),o);if(t.isIntersection())return rb(t.types.map(t=>e(t,r,n,o)));if(o.isTargetType?.(t,r,n))return rc;let a=r.getBaseConstraintOfType(t);if(a&&a!==t)return e(a,r,n,o);if(o.checkClassHeritage&&rp(t,r).some(t=>e(t,r,n,o)===rc))return rc;if(t.intrinsicName)return rd;let i=rl(t);if(!i)return rm;let s=i.getName(),l=o.typeReferenceAliases?.get(s);return o.targetTypeNames.has(s)||l&&o.targetTypeNames.has(l)?rc:rd}(n.getTypeAtLocation(e),t.getTypeChecker(),t,r)}catch{return rm}})(e,t,r);return s!==rm?s:r.isNonTargetNode?.(e,t)?rd:rm}let rw=e=>(e={checkClassHeritage:!0,checkClassSyntax:!1,...e},{getType:(t,r,n)=>rT(t,r,{...e,...n}),isTarget:(t,r,n)=>rT(t,r,{...e,...n})===rc,isKnownNonTarget:(t,r,n)=>rT(t,r,{...e,...n})===rd}),rI=new Set(["ObjectExpression","FunctionExpression","ArrowFunctionExpression","ClassExpression","TemplateLiteral"]),rF=new Set([...ra,"Map","ReadonlyMap","WeakMap","Set","ReadonlySet","WeakSet"]),{isTarget:rj,isKnownNonTarget:rk}=rw({checkClassHeritage:!1,preferTypeReferenceDefinitions:!0,targetTypeNames:new Set(["Array","ReadonlyArray"]),nonTargetTypeNames:rF,targetCallNames:["Array"],targetConstructorNames:["Array"],isTargetNode:e=>"ArrayExpression"===e.type||tc(e,{object:"Array",methods:["from","of"],optionalCall:!1,optionalMember:!1}),isNonTargetNode:e=>"NewExpression"===e.type||rI.has(e.type),isTargetTypeAnnotation:e=>e?.type==="TSArrayType"||e?.type==="TSTupleType",isTargetType:(e,t)=>t.isArrayType(e)||t.isTupleType(e),getStaticType:(e,t)=>Array.isArray(e)?rc:"Identifier"===t.type||"MemberExpression"===t.type?rm:rd}),rB=new Set(["ArrayExpression","FunctionExpression","Literal","ObjectExpression","TemplateLiteral"]);function rP(e,t){return!rB.has(e.type)&&rk(e,t)}let{isTarget:r$}=(({name:e,aliases:t=[],checkConstructor:r=!0,...n})=>rw({...n,targetTypeNames:new Set([e]),typeReferenceAliases:new Map(t.map(t=>[t,e])),targetConstructorNames:r?[e]:void 0}))({name:"Set",aliases:["ReadonlySet"],getStaticType:e=>e instanceof Set?rc:rm}),rR=new Set(["CharacterData","Document","DocumentFragment","Element","HTMLElement","Node","SVGElement","Text"]),rL=new Set(["KeyboardEvent","React.KeyboardEvent"]),rN=new Set(["Event","MouseEvent","PointerEvent","React.MouseEvent","React.PointerEvent"]),{isKnownNonTarget:rM}=rw({targetTypeNames:rR,getStaticType:e=>{let{Node:t}=globalThis;return"function"==typeof t&&e instanceof t?rc:rm}}),{isKnownNonTarget:rO}=rw({targetTypeNames:rL,nonTargetTypeNames:rN}),rq=e=>("AssignmentExpression"===e.parent.type||"AssignmentPattern"===e.parent.type)&&e.parent.left===e||"UpdateExpression"===e.parent.type&&e.parent.argument===e||"ArrayPattern"===e.parent.type&&e.parent.elements.includes(e)||"RestElement"===e.parent.type&&e.parent.argument===e||"Property"===e.parent.type&&e.parent.value===e&&"ObjectPattern"===e.parent.parent.type&&e.parent.parent.properties.includes(e.parent)||"UnaryExpression"===e.parent.type&&"delete"===e.parent.operator&&e.parent.argument===e,rU=(e,t)=>"CallExpression"===e.type&&!e.optional&&"Identifier"===e.callee.type&&e.callee.name===t,r_=(e,t,r)=>"MemberExpression"===e.type&&!e.computed&&!e.optional&&"Identifier"===e.object.type&&e.object.name===t&&"Identifier"===e.property.type&&r.has(e.property.name),rW=new Set(["E","LN2","LN10","LOG2E","LOG10E","PI","SQRT1_2","SQRT2"]),rV=new Set(["abs","acos","acosh","asin","asinh","atan","atanh","atan2","cbrt","ceil","clz32","cos","cosh","exp","expm1","floor","fround","hypot","imul","log","log1p","log10","log2","max","min","pow","random","round","sign","sin","sinh","sqrt","tan","tanh","trunc"]),rz=new Set(["EPSILON","MAX_SAFE_INTEGER","MAX_VALUE","MIN_SAFE_INTEGER","MIN_VALUE","NaN","NEGATIVE_INFINITY","POSITIVE_INFINITY"]),rK=new Set(["parseFloat","parseInt"]),rG=e=>e?.type==="TSNumberKeyword"||e?.type==="TSLiteralType"&&e8(e.literal),rJ=new Set(["-","*","/","%","**","<<",">>","|","^","&"]);function rX(e,t){let r;if(e8(e)||r_(e,"Math",rW)||"CallExpression"===e.type&&!e.optional&&r_(e.callee,"Math",rV)||rU(e,"Number")||r_(e,"Number",rz)||"CallExpression"===e.type&&!e.optional&&r_(e.callee,"Number",rK)||rU(e,"parseInt")||rU(e,"parseFloat")||"MemberExpression"===e.type&&!e.computed&&!e.optional&&"Identifier"===e.property.type&&"length"===e.property.name)return!0;switch(e.type){case"AssignmentExpression":{let{operator:r}=e;if("="===r&&rX(e.right,t))return!0}case"BinaryExpression":{let{operator:r}=e;if("AssignmentExpression"===e.type&&(r=r.slice(0,-1)),"+"===r&&rX(e.left,t)&&rX(e.right,t)||">>>"===r||rJ.has(r)&&(rX(e.left,t)||rX(e.right,t)))return!0;break}case"UnaryExpression":{let{operator:r}=e;if("+"===r||("-"===r||"~"===r)&&rX(e.argument,t))return!0;break}case"UpdateExpression":if(rX(e.argument,t))return!0;break;case"ConditionalExpression":{let r=rX(e.consequent,t),n=rX(e.alternate,t);if(r&&n)return!0;let o=ew(e.test,t);if(null!==o&&(r&&o.value||n&&!o.value))return!0;break}case"SequenceExpression":if(rX(e.expressions.at(-1),t))return!0;break;case"Identifier":if((r=ei(t,e))&&r.defs.some(e=>rG(e.name?.typeAnnotation?.typeAnnotation)))return!0;break;case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":if(rG(e.typeAnnotation))return!0;break;case"TSNonNullExpression":if(rX(e.expression,t))return!0}return"number"==typeof ew(e,t)?.value}rw({targetTypeNames:new Set,targetCallNames:["Number"],isTargetTypeAnnotation:rG,isTargetType:e=>e.isNumberLiteral?.()||"number"===e.intrinsicName,getStaticType:e=>"number"==typeof e?rc:rm});let rY=new Set([">",">=","<","<=","==","===","!=","!==","in","instanceof"]),rH=new Set(["boolean","true","false"]),rQ=new Set(["isFinite","isNaN"]),rZ=new Map([["Array",new Set(["isArray"])],["ArrayBuffer",new Set(["isView"])],["Atomics",new Set(["isLockFree"])],["Number",new Set(["isFinite","isInteger","isNaN","isSafeInteger"])],["Object",new Set(["hasOwn","is","isExtensible","isFrozen","isSealed"])],["Reflect",new Set(["deleteProperty","has"])],["URL",new Set(["canParse"])]]),r0=new Map([["array",new Set(["every","includes","some"])],["map",new Set(["has"])],["regexp",new Set(["test"])],["set",new Set(["has","isDisjointFrom","isSubsetOf","isSupersetOf"])],["string",new Set(["endsWith","includes","isWellFormed","startsWith"])],["weakSet",new Set(["has"])]]),r1=new Map([["regexp",new Set(["dotAll","global","hasIndices","ignoreCase","multiline","sticky","unicode","unicodeSets"])]]);function r2(e,t){let{parserServices:r}=t.sourceCode;if(!r?.program)return!1;try{return function e(t,r){if(!t)return!1;if(t.isUnion?.())return t.types.every(t=>e(t,r));let n=r.getBaseConstraintOfType(t);return n&&n!==t?e(n,r):rH.has(r.typeToString(t))}(r.getTypeAtLocation(e),r.program.getTypeChecker())}catch{return!1}}function r3(e){if(e?.type==="Identifier")return e.name}function r8(e,t,r,n=new Set){switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return r8(e.typeAnnotation,t,r,n);case"TSBooleanKeyword":return!0;case"TSLiteralType":return"boolean"==typeof e.literal.value;case"TSTypeReference":return function(e,t,r,n){let o=r3(e.typeName);if(!o||n.has(o))return!1;n.add(o);let a=tR(o,r),[i]=a?.defs??[],s=i?.type==="Type"&&"TSTypeAliasDeclaration"===i.node.type&&r8(i.node.typeAnnotation,t,r,n);return n.delete(o),s}(e,t,r,n);case"TSTypePredicate":return!e.asserts;case"TSUnionType":return e.types.every(e=>r8(e,t,r,n));case"TypeAnnotation":return e.typeAnnotation?.type==="BooleanTypeAnnotation";default:return!1}}function r6(e,t,r=new Set){if(e.async||e.generator)return!1;let n=t.sourceCode.getScope(e);return!!r8(e.returnType,t,n)||!!e.body&&("BlockStatement"===e.body.type&&1===e.body.body.length&&"ReturnStatement"===e.body.body[0].type?r5(e.body.body[0].argument,t,r):"ArrowFunctionExpression"===e.type&&"BlockStatement"!==e.body.type&&r5(e.body,t,r))}function r9(e,t,r=new Set){switch(e?.type){case"ArrayExpression":return"array";case"Literal":return"string"==typeof e.value?"string":e.regex?"regexp":void 0;case"TemplateLiteral":return 0===e.expressions.length?"string":void 0;case"NewExpression":if("Identifier"===e.callee.type&&t.sourceCode.isGlobalReference(e.callee)){if("RegExp"===e.callee.name)return"regexp";if(["Map","WeakMap"].includes(e.callee.name))return"map";if("Set"===e.callee.name)return"set";if("WeakSet"===e.callee.name)return"weakSet"}return;case"Identifier":return function(e,t,r){let n=ei(t.sourceCode.getScope(e),e),[o]=n?.defs??[];if(!n||r.has(n)||1!==n.defs.length||"Variable"!==o.type||"const"!==o.parent.kind)return;r.add(n);let a=r9(o.node.init,t,r);return r.delete(n),a}(e,t,r);case"ParenthesizedExpression":case"TSNonNullExpression":case"TSAsExpression":case"TSTypeAssertion":case"TSSatisfiesExpression":return r9(e.expression,t,r)}}function r5(e,t,r=new Set){if(!e)return!1;let n=t.sourceCode.getScope(e);return!!r8(e.typeAnnotation,t,n)||"boolean"==typeof ew(e,t.sourceCode.getScope(e))?.value||(function(e,t,r){switch(e.type){case"Identifier":return function(e,t,r){if(!e||r.has(e)||1!==e.defs.length)return!1;r.add(e);let[n]=e.defs,o=t.sourceCode.getScope(n.name);if(n.name?.typeAnnotation)return r.delete(e),!n.name.optional&&r8(n.name.typeAnnotation,t,o);let a="Variable"===n.type&&"const"===n.parent.kind&&r5(n.node.init,t,r);if(!a&&"Parameter"===n.type){let e=n.name.parent;a="AssignmentPattern"===e.type&&e.left===n.name&&r5(e.right,t,r)}return r.delete(e),a}(ei(t.sourceCode.getScope(e),e),t,r)||r2(e,t);case"UnaryExpression":return["!","delete"].includes(e.operator);case"LogicalExpression":return r5(e.left,t,r)&&r5(e.right,t,r);case"BinaryExpression":return rY.has(e.operator);case"ConditionalExpression":return r5(e.consequent,t,r)&&r5(e.alternate,t,r);case"TSAsExpression":case"TSTypeAssertion":case"TSSatisfiesExpression":let n;return n=t.sourceCode.getScope(e),r8(e.typeAnnotation,t,n)||r5(e.expression,t,r);case"CallExpression":return!!(function(e,t){if("MemberExpression"!==e.callee.type||"Identifier"!==e.callee.object.type||!t.sourceCode.isGlobalReference(e.callee.object))return!1;let r=rZ.get(e.callee.object.name),n=eF(e.callee,t.sourceCode.getScope(e.callee));return!!r?.has(n)}(e,t)||function(e,t){if("MemberExpression"!==e.callee.type)return!1;let r=r0.get(r9(e.callee.object,t)),n=eF(e.callee,t.sourceCode.getScope(e.callee));return!!r?.has(n)}(e,t))||("Identifier"!==e.callee.type?r2(e,t):!!("Boolean"===e.callee.name&&t.sourceCode.isGlobalReference(e.callee)||rQ.has(e.callee.name)&&t.sourceCode.isGlobalReference(e.callee))||function(e,t,r=new Set){if(e?.type!=="Identifier")return!1;let n=ei(t.sourceCode.getScope(e),e);if(!n||r.has(n))return!1;r.add(n);let o=!1;if(n.defs.length>1&&n.defs.every(e=>"FunctionName"===e.type)){let e=n.defs.filter(e=>"TSDeclareFunction"===e.node.type),a=e.length>0?e:n.defs;o=n.references.every(e=>!e.writeExpr)&&a.every(e=>r6(e.node,t,r))}else if(1===n.defs.length){let[e]=n.defs,a=t.sourceCode.getScope(e.name);if(function e(t,r,n,o=new Set){switch(t?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return e(t.typeAnnotation,r,n,o);case"TSFunctionType":return r8(t.returnType,r,n,o);case"TSTypeReference":return function(t,r,n,o){let a=r3(t.typeName);if(!a||o.has(a))return!1;o.add(a);let i=tR(a,n),[s]=i?.defs??[],l=s?.type==="Type"&&("TSTypeAliasDeclaration"===s.node.type&&e(s.node.typeAnnotation,r,n,o)||"TSInterfaceDeclaration"===s.node.type&&s.node.body.body.filter(e=>"TSCallSignatureDeclaration"===e.type).every(e=>r8(e.returnType,r,n,o))&&s.node.body.body.some(e=>"TSCallSignatureDeclaration"===e.type));return o.delete(a),l}(t,r,n,o);case"TSUnionType":return t.types.every(t=>e(t,r,n,o));default:return!1}}(e.name?.typeAnnotation,t,a))o=!0;else{let a;"FunctionName"===e.type?n.references.every(e=>!e.writeExpr)&&(a=e.node):"Variable"===e.type&&"const"===e.parent.kind&&["ArrowFunctionExpression","FunctionExpression"].includes(e.node.init?.type)&&(a=e.node.init),o=!!a&&r6(a,t,r)}}return r.delete(n),o}(e.callee,t,r)||r2(e,t));case"MemberExpression":return function(e,t){if("MemberExpression"!==e.type||e.optional)return!1;let r=r1.get(r9(e.object,t)),n=eF(e,t.sourceCode.getScope(e));return!!r?.has(n)}(e,t)||void 0;default:switch(e.type){case"AwaitExpression":case"YieldExpression":case"TSNonNullExpression":case"ParenthesizedExpression":return r5(e.argument??e.expression,t,r);case"SequenceExpression":return r5(e.expressions.at(-1),t,r);case"AssignmentExpression":return"="===e.operator&&r5(e.right,t,r)}return}}(e,t,r)??r2(e,t))}let r4=new Set(["asIntN","asUintN"]),r7=e=>{switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return r7(e.typeAnnotation);case"TSBigIntKeyword":return!0;case"TSLiteralType":return e5(e.literal);default:return!1}},{isTarget:ne}=rw({targetTypeNames:new Set,targetCallNames:["BigInt"],isTargetNode:e=>e5(e)||rU(e,"BigInt")||"CallExpression"===e.type&&!e.optional&&r_(e.callee,"BigInt",r4),isTargetTypeAnnotation:r7,isTargetType:e=>e.isBigIntLiteral?.()||"bigint"===e.intrinsicName,getStaticType:e=>"bigint"==typeof e?rc:rm}),nt=new Set(["fromCharCode","fromCodePoint"]),nr=e=>{switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return nr(e.typeAnnotation);case"TSStringKeyword":return!0;case"TSLiteralType":return e1(e.literal);default:return!1}},{isTarget:nn,isKnownNonTarget:no}=rw({targetTypeNames:new Set,targetCallNames:["String"],isTargetNode:(e,t)=>{if(e1(e)||rU(e,"String")||"CallExpression"===e.type&&!e.optional&&r_(e.callee,"String",nt))return!0;switch(e.type){case"TemplateLiteral":return!0;case"UnaryExpression":return"typeof"===e.operator;case"BinaryExpression":return"+"===e.operator&&(na(e.left,t)||na(e.right,t));case"AssignmentExpression":if("="===e.operator)return na(e.right,t);return"+="===e.operator&&(na(e.left,t)||na(e.right,t));default:return!1}},isTargetTypeAnnotation:nr,isTargetType:e=>e.isStringLiteral?.()||"string"===e.intrinsicName,getStaticType:e=>"string"==typeof e?rc:rm});function na(e,t){return!!e&&(!!("TSSatisfiesExpression"===e.type&&nr(e.typeAnnotation)||nn(e,t))||"string"==typeof ew(e,t.sourceCode.getScope(e))?.value)}let ni=new Set(["ArrayExpression","ArrowFunctionExpression","ClassExpression","FunctionExpression","Literal","ObjectExpression","TemplateLiteral"]),ns=e=>ni.has(e.type)||th(e),nl=new Set(["ArrayExpression","BinaryExpression","ClassExpression","Literal","ObjectExpression","TemplateLiteral","UnaryExpression","UpdateExpression"]),nu=new Set(["AssignmentExpression","AwaitExpression","NewExpression","TaggedTemplateExpression","ThisExpression"]),np=e=>nl.has(e.type)||nu.has(e.type)||th(e)||e7(e)&&!tc(e,{method:"bind",optionalCall:!1,optionalMember:!1}),nc=(e,t)=>{if("ThisExpression"===e.type)return!0;if("FunctionDeclaration"===e.type||"FunctionExpression"===e.type)return!1;if("ClassDeclaration"===e.type||"ClassExpression"===e.type){if(e.superClass&&nc(e.superClass,t))return!0;for(let r of e.body.body)if(r.computed&&nc(r.key,t))return!0;return!1}let r=t[e.type];if(!r)return!1;for(let n of r){let r=e[n];if(r){if(Array.isArray(r)){for(let e of r)if(e&&nc(e,t))return!0;continue}if(nc(r,t))return!0}}return!1};function nd(e,t,r){let[n,o]=[e,t].map(e=>r.sourceCode.getLoc(e).start.line);return n===o}let nm=(e,t)=>"Identifier"===e.type&&"Identifier"===t.type&&e.name===t.name;function nf(e,t){return"Identifier"===e.type&&(t.sourceCode.isGlobalReference(e)||!ei(t.sourceCode.getScope(e),e))}let ng=(e,t,r)=>e&&t&&r.sourceCode.getRange(e)[0]===r.sourceCode.getRange(t)[0]&&r.sourceCode.getRange(e)[1]===r.sourceCode.getRange(t)[1],ny=(e,t)=>{let{type:r,local:n,imported:o}=e.parent;return"ImportSpecifier"===r&&ng(n,o,t)&&n===e},nh=new Set(["ArrayExpression","CallExpression","ChainExpression","Identifier","ImportExpression","Literal","MemberExpression","NewExpression","Super","TaggedTemplateExpression","TemplateLiteral","ThisExpression","TSNonNullExpression"]),nx=e=>"Property"===e.parent.type&&e.parent.shorthand&&e===e.parent.value,nb=e=>ti(e.parent),nE=new Set(["String","Null","Boolean","Numeric","RegularExpression"]),nD=new Set(["[","(","/","`","+","-","*",",","."]);function nS(e,t,r){if(""===r||r&&!nD.has(r.charAt(0))||!e)return!1;let{sourceCode:n}=t,{type:o,value:a}=e,i=n.getRange(e),s=n.getNodeByRangeIndex(i[0]);if("Punctuator"===o){if(";"===a)return!1;if("]"===a)return!0;if(")"===a){switch(s.type){case"IfStatement":if(n.getTokenBefore(s.consequent)===e)return!1;break;case"ForStatement":case"ForInStatement":case"ForOfStatement":case"WhileStatement":case"DoWhileStatement":case"WithStatement":if(s.body&&n.getTokenBefore(s.body)===e)return!1}return!0}}return!!nE.has(o)||("Template"===o?a.endsWith("`"):"ObjectExpression"===s.type||"Identifier"===o&&("of"!==a||"ForOfStatement"!==s.type)&&("await"!==a||"AwaitExpression"!==s.type))}let nv=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion"]),nC=e=>nv.has(e?.type);function nA(e){for(;nC(e);)e=e.expression;return e}let nT=e=>"type"===e.importKind||"type"===e.parent.importKind,nw=(e,t,r)=>r.sourceCode.getRange(e.name??e.node)[0]<=r.sourceCode.getRange(t)[0];function*nI(e){if("function"!=typeof e?.[Symbol.iterator])return void(yield e);for(let t of e)yield*nI(t)}class nF extends Error{name="FixAbortError"}let nj={abort(){throw new nF("Fix aborted.")}};function nk(e){return t=>{let r=nI(e(t,nj));try{return[...r]}catch(e){if(e instanceof nF)return;throw e}}}class nB{#e;#t=new Map;constructor(e){this.#e=e}#r(e,t){let r=this.#t;for(let n of e)r.has(n)?r.get(n).push(t):r.set(n,[t])}on(e,t){let r=Array.isArray(e)?e:[e];this.#r(r,t)}onExit(e,t){let r=Array.isArray(e)?e:[e];this.#r(r.map(e=>`${e}:exit`),t)}toEslintListeners(){let e={};for(let[t,r]of this.#t)e[t]=function(e,t){return(...r)=>{for(let n of nI(t(...r)))if(n){let t=function(e){let t={...e};return e.fix&&(t.fix=nk(e.fix)),Array.isArray(e.suggest)&&(t.suggest=e.suggest.map(t=>({...t,fix:nk(t.fix),data:{...e.data,...t.data}}))),t}(n);e.report(t)}}}(this.#e,function*(...e){for(let t of r)yield t(...e)});return e}}let nP=new Set;function n$(e){return nP.has(e)?e:t=>{let r=new nB(t),n=e(new Proxy(t,{get:(e,t,n)=>"on"===t||"onExit"===t?r[t].bind(r):Reflect.get(e,t,n)}));return p.equal(n,void 0,`[${t.id}] Rule \`create\` function should return \`undefined\`, please use \`context.on()\` instead of return listeners.`),r.toEslintListeners()}}function nR(e,t){var r;let{visitScriptBlock:n=!0}={},o=n$(e);return r=e=>{let t=o(e),{parserServices:r}=e.sourceCode;return r?.defineTemplateBodyVisitor?n?r.defineTemplateBodyVisitor(t,t):r.defineTemplateBodyVisitor(t):t},nP.add(r),r}function nL(e){return["AwaitExpression","AssignmentExpression","YieldExpression","SequenceExpression","TSAsExpression","TSTypeAssertion"].includes(e.type)}let nN=/^(?:0|0[0-7]*[89]\d*|[1-9](?:_?\d)*)$/u;function nM(e,t){switch(e.type){case"Identifier":case"MemberExpression":case"CallExpression":case"ChainExpression":case"TemplateLiteral":case"ThisExpression":case"ArrayExpression":case"FunctionExpression":return!1;case"NewExpression":return!tK(e,t);case"Literal":let r;if(e8(e)&&(r=e.raw,nN.test(r)))return!0;return!1;default:return!0}}function nO(e,t){return["UpdateExpression","BinaryExpression","LogicalExpression","ConditionalExpression","AssignmentExpression","ArrowFunctionExpression","YieldExpression","SequenceExpression"].includes(e.type)}function nq(e,{operator:t,property:r}){if(!r)throw Error("`property` is required.");return("LogicalExpression"!==e.type||e.operator!==t)&&!!(["AwaitExpression","BinaryExpression"].includes(e.type)||["LogicalExpression","ConditionalExpression","AssignmentExpression","ArrowFunctionExpression","YieldExpression","SequenceExpression"].includes(e.type))}var nU={exports:{}},n_=nU.exports,nW=tw(function(){return s?nU.exports:(s=1,nU.exports=function(){var e=[],t=[],r={},n={},o={};function a(e){return"string"==typeof e?RegExp("^"+e+"$","i"):e}function i(e,t){return e===t?t:e===e.toLowerCase()?t.toLowerCase():e===e.toUpperCase()?t.toUpperCase():e[0]===e[0].toUpperCase()?t.charAt(0).toUpperCase()+t.substr(1).toLowerCase():t.toLowerCase()}function s(e,t,n){if(!e.length||r.hasOwnProperty(e))return t;for(var o=n.length;o--;){var a=n[o];if(a[0].test(t))return function(e,t){return e.replace(t[0],function(r,n){var o,a,s=(o=t[1],a=arguments,o.replace(/\$(\d{1,2})/g,function(e,t){return a[t]||""}));return""===r?i(e[n-1],s):i(r,s)})}(t,a)}return t}function l(e,t,r){return function(n){var o=n.toLowerCase();return t.hasOwnProperty(o)?i(n,o):e.hasOwnProperty(o)?i(n,e[o]):s(o,n,r)}}function u(e,t,r,n){return function(n){var o=n.toLowerCase();return!!t.hasOwnProperty(o)||!e.hasOwnProperty(o)&&s(o,o,r)===o}}function p(e,t,r){var n=1===t?p.singular(e):p.plural(e);return(r?t+" ":"")+n}return p.plural=l(o,n,e),p.isPlural=u(o,n,e),p.singular=l(n,o,t),p.isSingular=u(n,o,t),p.addPluralRule=function(t,r){e.push([a(t),r])},p.addSingularRule=function(e,r){t.push([a(e),r])},p.addUncountableRule=function(e){if("string"==typeof e){r[e.toLowerCase()]=!0;return}p.addPluralRule(e,"$0"),p.addSingularRule(e,"$0")},p.addIrregularRule=function(e,t){t=t.toLowerCase(),o[e=e.toLowerCase()]=t,n[t]=e},[["I","we"],["me","us"],["he","they"],["she","they"],["them","them"],["myself","ourselves"],["yourself","yourselves"],["itself","themselves"],["herself","themselves"],["himself","themselves"],["themself","themselves"],["is","are"],["was","were"],["has","have"],["this","these"],["that","those"],["echo","echoes"],["dingo","dingoes"],["volcano","volcanoes"],["tornado","tornadoes"],["torpedo","torpedoes"],["genus","genera"],["viscus","viscera"],["stigma","stigmata"],["stoma","stomata"],["dogma","dogmata"],["lemma","lemmata"],["schema","schemata"],["anathema","anathemata"],["ox","oxen"],["axe","axes"],["die","dice"],["yes","yeses"],["foot","feet"],["eave","eaves"],["goose","geese"],["tooth","teeth"],["quiz","quizzes"],["human","humans"],["proof","proofs"],["carve","carves"],["valve","valves"],["looey","looies"],["thief","thieves"],["groove","grooves"],["pickaxe","pickaxes"],["passerby","passersby"]].forEach(function(e){return p.addIrregularRule(e[0],e[1])}),[[/s?$/i,"s"],[/[^\u0000-\u007F]$/i,"$0"],[/([^aeiou]ese)$/i,"$1"],[/(ax|test)is$/i,"$1es"],[/(alias|[^aou]us|t[lm]as|gas|ris)$/i,"$1es"],[/(e[mn]u)s?$/i,"$1s"],[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i,"$1"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1i"],[/(alumn|alg|vertebr)(?:a|ae)$/i,"$1ae"],[/(seraph|cherub)(?:im)?$/i,"$1im"],[/(her|at|gr)o$/i,"$1oes"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i,"$1a"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i,"$1a"],[/sis$/i,"ses"],[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i,"$1$2ves"],[/([^aeiouy]|qu)y$/i,"$1ies"],[/([^ch][ieo][ln])ey$/i,"$1ies"],[/(x|ch|ss|sh|zz)$/i,"$1es"],[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i,"$1ices"],[/\b((?:tit)?m|l)(?:ice|ouse)$/i,"$1ice"],[/(pe)(?:rson|ople)$/i,"$1ople"],[/(child)(?:ren)?$/i,"$1ren"],[/eaux$/i,"$0"],[/m[ae]n$/i,"men"],["thou","you"]].forEach(function(e){return p.addPluralRule(e[0],e[1])}),[[/s$/i,""],[/(ss)$/i,"$1"],[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i,"$1fe"],[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i,"$1f"],[/ies$/i,"y"],[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i,"$1ie"],[/\b(mon|smil)ies$/i,"$1ey"],[/\b((?:tit)?m|l)ice$/i,"$1ouse"],[/(seraph|cherub)im$/i,"$1"],[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i,"$1"],[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i,"$1sis"],[/(movie|twelve|abuse|e[mn]u)s$/i,"$1"],[/(test)(?:is|es)$/i,"$1is"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1us"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i,"$1um"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i,"$1on"],[/(alumn|alg|vertebr)ae$/i,"$1a"],[/(cod|mur|sil|vert|ind)ices$/i,"$1ex"],[/(matr|append)ices$/i,"$1ix"],[/(pe)(rson|ople)$/i,"$1rson"],[/(child)ren$/i,"$1"],[/(eau)x?$/i,"$1"],[/men$/i,"man"]].forEach(function(e){return p.addSingularRule(e[0],e[1])}),["adulthood","advice","agenda","aid","aircraft","alcohol","ammo","analytics","anime","athletics","audio","bison","blood","bream","buffalo","butter","carp","cash","chassis","chess","clothing","cod","commerce","cooperation","corps","debris","diabetes","digestion","elk","energy","equipment","excretion","expertise","firmware","flounder","fun","gallows","garbage","graffiti","hardware","headquarters","health","herpes","highjinks","homework","housework","information","jeans","justice","kudos","labour","literature","machinery","mackerel","mail","media","mews","moose","music","mud","manga","news","only","personnel","pike","plankton","pliers","police","pollution","premises","rain","research","rice","salmon","scissors","series","sewage","shambles","shrimp","software","species","staff","swine","tennis","traffic","transportation","trout","tuna","wealth","welfare","whiting","wildebeest","wildlife","you",/pok[eé]mon$/i,/[^aeiou]ese$/i,/deer$/i,/fish$/i,/measles$/i,/o[iu]s$/i,/pox$/i,/sheep$/i].forEach(p.addUncountableRule),p}(),nU.exports)}());function nV(e,t,r=0,n=0){let{sourceCode:o}=t,[a,i]=Array.isArray(e)?e:o.getRange(e);return{start:o.getLocFromIndex(a+r),end:o.getLocFromIndex(i+n)}}function nz(e,t,r){let{parent:n}=e;for(let o of t.sourceCode.visitorKeys[n.type]||Object.keys(n)){let t=n[o];if(t!==e&&Array.isArray(t)){let n=t.indexOf(e);if(-1!==n)return t[n+r]}}}let nK=(e,t)=>nz(e,t,-1),nG=(e,t)=>nz(e,t,1),nJ=e=>e.charAt(0).toUpperCase()+e.slice(1),nX=e=>e.charAt(0).toLowerCase()+e.slice(1),nY="too-deep",nH="should-parenthesized",nQ="prefer-event-target",nZ=new Set(["@angular/core","eventemitter3"]),n0=e=>"VariableDeclarator"===e.parent.type&&e.parent.id===e&&"VariableDeclaration"===e.parent.parent.type&&"const"===e.parent.parent.kind&&e.parent.parent.declarations.includes(e.parent);function n1(e){let t;return!!e&&(tm(e)?[t]=e.arguments:"AwaitExpression"===e.type&&"ImportExpression"===e.argument.type&&({source:t}=e.argument),!!(e1(t)&&nZ.has(t.value)))}let n2={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",186:";",187:"=",188:",",189:"-",190:".",191:"/",219:"[",220:"\\",221:"]",222:"'",224:"Meta"},n3="prefer-keyboard-event-key",n8="prefer-keyboard-event-key/suggestion",n6=new Set(["keyCode","charCode","which"]),n9=new Set(["onKeyDown","onKeyPress","onKeyUp"]),n5=e=>{var t;return e?.type==="TSTypeAnnotation"&&"TSTypeReference"===e.typeAnnotation.type&&("Identifier"===(t=e.typeAnnotation.typeName).type?"KeyboardEvent"===t.name:"TSQualifiedName"===t.type&&"Identifier"===t.left.type&&"React"===t.left.name&&"Identifier"===t.right.type&&"KeyboardEvent"===t.right.name)},n4=(e,t)=>{var r;let n,o=[],a="ArrowFunctionExpression"===t.type||"FunctionExpression"===t.type;for(let e of(a&&tc(t.parent,{method:"addEventListener",minimumArguments:2,optionalCall:!1,optionalMember:!1})&&t.parent.arguments[1]===t&&o.push({parameter:t.params[0],shouldAutofix:!0}),a&&"JSXExpressionContainer"===(r=t).parent.type&&r.parent.expression===r&&"JSXAttribute"===r.parent.parent.type&&r.parent.parent.value===r.parent&&"JSXAttribute"===(n=r.parent.parent).type&&"JSXIdentifier"===n.name.type&&n9.has(n.name.name)&&o.push({parameter:t.params[0],shouldAutofix:!1}),t.params))n5(e.typeAnnotation)&&o.push({parameter:e,shouldAutofix:!1});let i=e.sourceCode.getDeclaredVariables(t);return o.filter(({parameter:t})=>t&&!rO(t,e)).map(e=>({...e,references:i.find(t=>t.identifiers.includes(e.parameter))?.references}))},n7=(e,t)=>e?.parent?.type==="MemberExpression"&&e.parent.property===e&&!e.parent.computed&&e.parent.object===t,oe=(e,t)=>{let r=[];for(let n=t.parent;n;n=n.parent)tl(n)&&r.push(...n4(e,n));return r},ot=(e,{shouldAutofix:t})=>{let r=(e=>{var t;if(e.parent?.type!=="MemberExpression"||e.parent.property!==e)return;let r=((e,t)=>{let r=e;for(;r&&t;)t--,r=r.parent;if(0===t)return r})(e,3);if(!r||"IfStatement"!==r.type)return;let{type:n,operator:o,right:a}=r.test;if(!("BinaryExpression"===n&&r.test.left===e.parent&&("=="===o||"==="===o)&&e8(a)))return;let i=Object.hasOwn(n2,t=a.value)?n2[t]:Number.isSafeInteger(t)&&t>=0&&t<=1114111?String.fromCodePoint(t):void 0;if(i)return{key:i,right:a}})(e),n={messageId:n3,data:{name:e.name},node:e};if(!r)return n;let o=t=>[t.replaceText(e,"key"),t.replaceText(r.right,tF(r.key))];return t?n.fix=o:n.suggest=[{messageId:n8,data:{key:r.key},fix:o}],n},or=(e,{parameter:t})=>t?.type==="ObjectPattern"&&t.properties.includes(e.parent),on=(e,{references:t})=>{let r=((e,t,r=()=>!0)=>{let n=e;for(;n;){if(n.type===t&&r(n))return n;n=n.parent}})(e,"VariableDeclarator"),n=r?.init;return t&&r?.id===e.parent.parent&&t.some(e=>e.identifier===n)},oo="error",oa="suggestion";function*oi(e,t,r){for(let n of eY(e,r))yield t.remove(n)}function os(e,t,r,n){if("CallExpression"!==t.type)throw Error(`Unexpected node "${t.type}".`);let{sourceCode:o}=n,[a,i]=o.getLastTokens(t,2);return t.arguments.length>0&&(r=eu(a)?` ${r},`:`, ${r}`),e.insertTextBefore(i,r)}function ol(e,t,r){return e.removeRange(function(e,t){let r=e.parent,n=r.arguments.indexOf(e),o=eY(e,t),a=o[0]||e,i=o.at(-1)||e,{sourceCode:s}=t,[l]=s.getRange(a),[,u]=s.getRange(i);if(0!==n){let e=s.getTokenBefore(a);[l]=s.getRange(e)}if(1===r.arguments.length){let e=s.getTokenAfter(i);eu(e)&&([,u]=s.getRange(e))}return[l,u]}(t,r))}function ou(e,t,r,n){return e.replaceTextRange(eH(t,n),r)}function*op(e,t,r){if("ReturnStatement"!==t.type&&"ThrowStatement"!==t.type)return;let{sourceCode:n}=r,o=n.getFirstToken(t);yield e.insertTextAfter(o," (");let a=n.getLastToken(t);ep(a)?yield e.insertTextBefore(a,")"):yield e.insertTextAfter(t,")")}function oc(e,t,r){let n="object"==typeof e?t.sourceCode.getRange(e)[1]:e,[o]=t.sourceCode.text.slice(n).match(/^\s*/);return r.removeRange([n,n+o.length])}function*od(e,t,r){let n=t.sourceCode.getFirstToken(e);yield r.remove(n),yield oc(n,t,r),tK(e,t)||(yield r.insertTextAfter(e,"()")),nd(n,e.callee,t)||eZ(e,t)||(yield op(r,e.parent,t))}let om=({type:e,value:t})=>"Keyword"===e&&/^[a-z]*$/.test(t)||"Identifier"===e&&"of"===t||"Identifier"===e&&"await"===t;function*of(e,t,r){let{sourceCode:n}=r,o=eH(t,r),a=n.getTokenBefore({range:o},{includeComments:!0});a&&o[0]===n.getRange(a)[1]&&om(a)&&(yield e.insertTextAfter(a," "));let i=n.getTokenAfter({range:o},{includeComments:!0});i&&o[1]===n.getRange(i)[0]&&om(i)&&(yield e.insertTextBefore(i," "))}function*og(e,t,r){var n;yield of(r,e,t),yield r.insertTextBefore(e,"new ");let{callee:o}=e;!eZ(o,t)&&"MemberExpression"===(n=o).type&&function(e){let t=e.object,r=e.object.type;for(;"MemberExpression"===r;)r=(t=t.object).type;return"CallExpression"===r}(n)&&(yield r.insertTextBefore(o,"("),yield r.insertTextAfter(o,")"))}function oy(e,t,r,n){let[,o]=eH(t.object,r),[,a]=r.sourceCode.getRange(t);return e.replaceTextRange([o,a],n)}let oh=(e,t,r)=>oy(e,t,r,"");function*ox(e,t,r){let n=t.callee;yield oh(e,n,r);let[,o]=eH(n,r),[,a]=r.sourceCode.getRange(t);yield e.removeRange([o,a])}function ob(e,t,r,n=!1){let{sourceCode:o}=t,{lines:a}=o,i=e;if(n){let[t,r]=o.getLastTokens(e,2);ep(r)&&(i=t)}let s=o.getLoc(e).start,l=o.getLoc(i).end,u=a[s.line-1].slice(0,s.column),p=a[l.line-1].slice(l.column),[c]=o.getRange(e),[,d]=o.getRange(i);if(/^\s*$/.test(u)&&/^\s*$/.test(p))if(d+=p.length,0===c){let{text:e}=o;"\r"===e[d]&&"\n"===e[d+1]?d+=2:("\n"===e[d]||"\r"===e[d])&&d++}else c=Math.max(0,c-u.length-1);return r.removeRange([c,d])}function oE(e,t,r,n){if(nx(e)||"AssignmentPattern"===e.parent.type&&e.parent.left===e&&nx(e.parent))return n.replaceText(e,`${e.name}: ${t}`);if(ny(e,r))return n.replaceText(e,`${e.name} as ${t}`);if(((e,t)=>{let{type:r,local:n,exported:o}=e.parent;return"ExportSpecifier"===r&&ng(n,o,t)&&n===e})(e,r))return n.replaceText(e,`${t} as ${e.name}`);if(e.typeAnnotation){let{sourceCode:o}=r;return o.getCommentsInside(e).length>0?n.replaceText(o.getFirstToken(e),t):n.replaceTextRange([o.getRange(e)[0],o.getRange(e.typeAnnotation)[0]],`${t}${e.optional?"?":""}`)}return n.replaceText(e,t)}let oD=(e,t,r,n)=>rt(e).map(e=>oE(e,t,r,n)),oS=(e,t,r,n)=>{let{tail:o}=e,[a,i]=r.sourceCode.getRange(e);return n.replaceTextRange([a+1,i-(o?1:2)],t)};function*ov(e,t,r,n,o){for(let t of eY(e,o?{sourceCode:o}:n))yield ov(t,"",r,n,o);let{sourceCode:a}=n,[i,s]=a.getRange(e),[l]=a.text.slice(0,i).match(/\s*$/),[u]=l.match(/(?:\r?\n|\r)?/);i-=l.length,yield r.replaceTextRange([i,s],`${u}${t}`)}let oC="require-array-join-separator",oA="no-thenable-object",oT="no-thenable-export",ow="no-thenable-class",oI=(e,t)=>ew(e,t.sourceCode.getScope(e))?.value==="then",oF=(e,t)=>"then"===eF(e,t.sourceCode.getScope(e)),oj=[{selector:"ObjectExpression",*getNodes(e,t){for(let r of e.properties)"Property"===r.type&&oF(r,t)&&(yield r.key)},messageId:oA},{selectors:["PropertyDefinition","MethodDefinition"],*getNodes(e,t){"then"===eF(e,t.sourceCode.getScope(e))&&(yield e.key)},messageId:ow},{selector:"MemberExpression",*getNodes(e,t){"AssignmentExpression"===e.parent.type&&e.parent.left===e&&"then"===eF(e,t.sourceCode.getScope(e))&&(yield e.property)},messageId:oA},{selector:"CallExpression",*getNodes(e,t){if(!(tc(e,{objects:["Object","Reflect"],method:"defineProperty",minimumArguments:3,optionalCall:!1,optionalMember:!1})&&"SpreadElement"!==e.arguments[0].type))return;let[,r]=e.arguments;oI(r,t)&&(yield r)},messageId:oA},{selector:"CallExpression",*getNodes(e,t){if(tc(e,{object:"Object",method:"fromEntries",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&"ArrayExpression"===e.arguments[0].type){for(let r of e.arguments[0].elements)if(r?.type==="ArrayExpression"&&r.elements[0]&&"SpreadElement"!==r.elements[0].type){let[e]=r.elements;oI(e,t)&&(yield e)}}},messageId:oA},{selector:"Identifier",*getNodes(e){"then"===e.name&&"ExportSpecifier"===e.parent.type&&e.parent.exported===e&&(yield e)},messageId:oT},{selector:"Identifier",*getNodes(e){"then"===e.name&&("FunctionDeclaration"===e.parent.type||"ClassDeclaration"===e.parent.type)&&e.parent.id===e&&"ExportNamedDeclaration"===e.parent.parent.type&&e.parent.parent.declaration===e.parent&&(yield e)},messageId:oT},{selector:"VariableDeclaration",*getNodes(e,t){if("ExportNamedDeclaration"===e.parent.type&&e.parent.declaration===e)for(let r of t.sourceCode.getDeclaredVariables(e))"then"===r.name&&(yield*r.identifiers)},messageId:oT}],ok="no-invalid-remove-event-listener",oB="consistent-function-scoping",oP=(e,t)=>e&&t&&(e===t||e.block===t.block),o$=(e,t)=>e.some(e=>oP(e,t)),oR=["useState","useEffect","useContext","useReducer","useCallback","useMemo","useRef","useImperativeHandle","useLayoutEffect","useDebugValue"].flatMap(e=>[e,`React.${e}`]),oL=new Set(["DoWhileStatement","ForInStatement","ForOfStatement","ForStatement","WhileStatement"]),oN=e=>e?.type==="BlockStatement"&&oL.has(e.parent.type)&&e.parent.body===e,oM=new Set(["FunctionExpression","ArrowFunctionExpression"]),oO={create:e=>{let{checkArrowFunctions:t}=e.options[0],{sourceCode:r}=e,{scopeManager:n}=r;e.onExit(ts,e=>{if(("ArrowFunctionExpression"!==e.type||t)&&!function(e,t,r){let n,o,a,i=t.acquire(e);if(!i||(o=r.visitorKeys,"ArrowFunctionExpression"===e.type&&nc(e,o))||function(e){let t=e;for(;t.parent;){let{parent:e}=t;if("CallExpression"===e.type&&e.arguments[1]===t&&ts.includes(t.type)&&tg(e.callee,["jest.mock"]))return!0;t=e}return!1}(e))return!0;let s=e.parent;"VariableDeclarator"===s.type&&(s=s.parent),"VariableDeclaration"===s.type&&(s=s.parent),s?.type==="ReturnStatement"&&"ArrowFunctionExpression"===e.type&&(s=s.parent),s=function(e,t){if("ArrowFunctionExpression"===e.type&&"ArrowFunctionExpression"===t.type){let t=function(e){let t=e;for(;t&&"ArrowFunctionExpression"===t.type;)t=t.parent;return t}(e);t&&"ReturnStatement"===t.type&&"ReturnStatement"===(e=function(e){let t=e;for(;"ArrowFunctionExpression"===t.type;)t=t.parent;return t}(e)).type&&(e=e.parent)}return e}(s,e),s?.type==="BlockStatement"&&(n=s,s=s.parent);let l=t.acquire(s),u=function(e,t,r){let n=[];e&&n.push(e);let o=function(e){let t=[];for(;e?.type==="BlockStatement";){if(t.push(e),oN(e))return t;e=e.parent}return[]}(t);if(0===o.length)return n;let a=o.at(-1),i=r.acquire(a.parent);for(let e of(i&&n.push(i),o)){let t=r.acquire(e);t&&n.push(t)}return n}(l,n,t);return!!(0===u.length||u.some(e=>"global"===e.type)||l&&l.block?.parent?.callee&&tg(l.block.parent.callee,oR)||l&&(a=s,oM.has(a.type)&&"CallExpression"===a.parent.type&&a.parent.callee===a))||tN(i).map(({resolved:e})=>e).filter(Boolean).some(e=>e.references.some(e=>{if(o$(u,e.from))return!0;let{resolved:t}=e,[r]=t.defs;return(r?.type!=="FunctionName"||t.name!==r.name.name)&&o$(u,t.scope)})||e.defs.some(e=>o$(u,t.acquire(e.node)))||e.identifiers.some(e=>{if(!e.parent||"FunctionDeclaration"!==e.parent.type||t.acquire(e))return!1;let r=t.acquire(e.parent);return!(!r||oP(i,r))&&o$(u,r.upper)}))}(e,n,r))return{node:e,loc:eh(e,r),messageId:oB,data:{functionNameWithKind:ej(e,r)}}})},meta:{type:"suggestion",docs:{description:"Move function definitions to the highest possible scope.",recommended:!0},schema:[{type:"object",additionalProperties:!1,properties:{checkArrowFunctions:{type:"boolean",description:"Whether to check arrow functions."}}}],defaultOptions:[{checkArrowFunctions:!0}],messages:{[oB]:"Move {{functionNameWithKind}} to the outer scope."},languages:["js/js"]}},oq="error",oU="error-unknown",o_="suggestion";function oW(e,t,r){return function*(n){yield n.insertTextAfter(e.callee,`.${r}`),yield od(e,t,n)}}let oV="no-console-spaces",oz=e=>e.length>1&&" "===e.charAt(0)&&" "!==e.charAt(1),oK=e=>e.length>1&&" "===e.at(-1)&&" "!==e.at(-2),oG="no-empty-file",oJ={create:e=>{let{allowComments:t}=e.options[0];e.filename===e.physicalFilename&&(e.on("Program",r=>{if(r.templateBody)return;if(1===r.body.length&&"Document"===r.body[0].type){let{children:e}=r.body[0];if(e.some(e=>"Comment"!==e.type&&("Text"!==e.type||""!==e.value.trim()))||t&&e.some(e=>"Comment"===e.type))return;return{node:r,messageId:oG}}if(r.body.some(e=>!tn(e,tr)))return;let{sourceCode:n}=e,o=t3(e);if(0!==n.ast.tokens.length||0!==o.length||""===n.text.trim()){if(!o.some(e=>"Line"===e.type&&e.value.startsWith("/"))&&(!(t&&o.length>0&&o.every(e=>"Line"===e.type||"Block"===e.type))||0!==n.ast.tokens.length))return{node:r,messageId:oG}}}),e.on("StyleSheet",r=>{if(r.children.length>0)return;let n=t3(e);if(!t||!(n.length>0))return{node:r,messageId:oG}}),e.on("Document",r=>{if(r.parent?.type==="Program"||null!==r.body&&void 0!==r.body)return;let n=t3(e);if(!t||!(n.length>0))return{node:r,messageId:oG}}),e.on("root",e=>{if(!e.children.some(e=>!("html"===e.type&&/^<!--(?:(?!-->)[\s\S])*-->$/.test(e.value.trim())))&&(!t||!(e.children.length>0)))return{node:e,messageId:oG}}))},meta:{type:"suggestion",docs:{description:"Disallow empty files.",recommended:"unopinionated"},schema:[{type:"object",additionalProperties:!1,properties:{allowComments:{type:"boolean",description:"Whether to allow files that only contain comments."}}}],defaultOptions:[{allowComments:!1}],messages:{[oG]:"Empty files are not allowed."},languages:["js/js","css/css","html/html","json/json","json/jsonc","json/json5","markdown/commonmark","markdown/gfm"]}},oX="no-useless-fallback-in-spread";function oY(e,t,r){let n=eQ(e,r);return!eZ(e,r)&&nq(e,{operator:"&&",property:t})&&(n=`(${n})`),n}let oH={create:e=>{let{checkTernary:t}=e.options[0];e.on("ObjectExpression",t=>{if(ta(t)&&"LogicalExpression"===t.parent.type&&t.parent.right===t&&("||"===t.parent.operator||"??"===t.parent.operator)&&"SpreadElement"===t.parent.parent.type&&t.parent.parent.argument===t.parent&&"ObjectExpression"===t.parent.parent.parent.type&&t.parent.parent.parent.properties.includes(t.parent.parent))return{node:t,messageId:oX,*fix(r){let{sourceCode:n}=e,o=t.parent,{left:a}=o,i=eZ(a,e),[,s]=i?eH(a,e):n.getRange(a),[,l]=n.getRange(o);yield r.removeRange([s,l]),(i||"SequenceExpression"!==a.type)&&(yield oi(o,r,e))}}}),e.on("ConditionalExpression",r=>{if(!t)return;let{test:n,consequent:o,alternate:a,parent:i}=r;if(!("SpreadElement"===i.type&&i.argument===r&&"ObjectExpression"===i.parent.type&&i.parent.properties.includes(i)))return;let s=ta(a);if(s===ta(o))return;let l=s?o:a;if(s?!tH(n,l):!("UnaryExpression"===n.type&&"!"===n.operator&&n.prefix&&tH(n.argument,l)))return{node:s?a:o,messageId:oX,*fix(t,{abort:o}){if(e.sourceCode.getCommentsInside(r).length>0)return o();let a=s?oY(n,"left",e):function(e,t){if("UnaryExpression"===e.type&&"!"===e.operator&&e.prefix)return oY(e.argument,"left",t);let r=eQ(e,t);return!eZ(e,t)&&nO(e)&&(r=`(${r})`),`!${r}`}(n,e),i=oY(l,"right",e);yield t.replaceText(r,`${a} && ${i}`)}}})},meta:{type:"suggestion",docs:{description:"Disallow useless fallback when spreading in object literals.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{checkTernary:{type:"boolean",description:"Whether to check ternary expressions where one branch is an empty object."}}}],defaultOptions:[{checkTernary:!0}],messages:{[oX]:"The empty object is useless."},languages:["js/js"]}},oQ="zero-fraction",oZ="dangling-dot",o0="error",o1="suggestion",o2=Symbol.for("default"),o3=Symbol("NAMESPACE_SPECIFIER_NAME"),o8=e=>{switch(e.type){case"Identifier":return Symbol.for(e.name);case"Literal":return e.value}},o6=e=>"type"===e.exportKind||"type"===e.parent.exportKind;function*o9(e,t,r){switch(e.type){case"ImportSpecifier":case"ExportSpecifier":case"ImportDefaultSpecifier":case"ImportNamespaceSpecifier":return void(yield function*(e,t,r,n=!1){let o=e.parent,{specifiers:a}=o;if(1===a.length&&!n)return void(yield t.remove(o));let{sourceCode:i}=r;switch(e.type){case"ImportSpecifier":if(a.every(t=>e===t||e.type!==t.type)){let r=i.getTokenAfter(e,e=>"Identifier"===e.type&&"from"===e.value),n=a.some(e=>"ImportDefaultSpecifier"===e.type),o=i.getTokenBefore(e,n?eu:ef),[s]=i.getRange(o),[l]=i.getRange(r),u=i.getTokenBefore(o),p=i.getRange(u)[1]===s;yield t.replaceTextRange([s,l],p?" ":"");return}case"ExportSpecifier":case"ImportNamespaceSpecifier":case"ImportDefaultSpecifier":{yield t.remove(e);let r=i.getTokenAfter(e);eu(r)&&(yield t.remove(r))}}}(e,t,r));case"ImportDeclaration":case"ExportDefaultDeclaration":case"ExportNamedDeclaration":yield t.remove(e)}}function o5(e,t){let{sourceCode:r}=t,n=r.getTokenBefore(e.source,e=>"Identifier"===e.type&&"from"===e.value),[o]=r.getRange(n),[,a]=r.getRange(e);return r.text.slice(o,a)}let o4={create:function(e){let{sourceCode:t}=e,{checkUsedVariables:r}=e.options[0],n=new Set,o=[];e.on("ImportDeclaration",e=>{e.specifiers.length>0&&n.add(e)}),e.on("ExportNamedDeclaration",e=>{e1(e.source)&&o.push(e)}),e.on("Program:exit",function*(a){for(let i of n){let n=t.getDeclaredVariables(i);if(n.some(e=>1!==e.defs.length||e.defs[0].parent!==i)||(n=n.map(e=>{let r=function(e,t){let r=e.defs[0].node,n={node:r,declaration:r.parent,variable:e,isTypeImport:nT(r)};switch(r.type){case"ImportDefaultSpecifier":return{name:o2,text:"default",...n};case"ImportSpecifier":return{name:o8(r.imported),text:t.getText(r.imported),...n};case"ImportNamespaceSpecifier":return{name:o3,text:"*",...n}}}(e,t),n=function(e,t){let r=[];for(let{identifier:n}of e.variable.references){let o=function(e,t){let{parent:r}=e;switch(r.type){case"ExportDefaultDeclaration":return{node:r,name:o2,text:"default",isTypeExport:o6(r)};case"ExportSpecifier":return{node:r,name:o8(r.exported),text:t.getText(r.exported),isTypeExport:o6(r)};case"VariableDeclarator":if(r.init===e&&"Identifier"===r.id.type&&!r.id.typeAnnotation&&"VariableDeclaration"===r.parent.type&&"const"===r.parent.kind&&1===r.parent.declarations.length&&r.parent.declarations[0]===r&&"ExportNamedDeclaration"===r.parent.parent.type&&function(e,t){let r=t.getDeclaredVariables(e);if(1!==r.length)return!1;let[{identifiers:n,references:o}]=r;return 1===n.length&&n[0]===e.id&&1===o.length&&o[0].identifier===e.id}(r,t))return{node:r.parent.parent,name:Symbol.for(r.id.name),text:t.getText(r.id)}}}(n,t);o&&(e.name!==o3||o.name!==o2)&&r.push(o)}return r}(r,t);return{variable:e,imported:r,exports:n}}),!r&&n.some(({variable:e,exports:t})=>e.references.length!==t.length)))continue;let s=!r&&n.some(({variable:e})=>0===e.references.length);for(let{imported:t,exports:r}of n)for(let n of r){let r={node:n.node,messageId:o0,data:{exported:n.text}},i=function({context:e,imported:t,exported:r,exportDeclarations:n,program:o}){let a,i=t.declaration,s=i.source.value,l=t.isTypeImport||r.isTypeExport;return l&&(a=n.find(({source:e,exportKind:t})=>"type"===t&&e.value===s)),a||=n.find(({source:e,exportKind:t})=>"type"!==t&&e.value===s),function*(n){if(t.name===o3)yield n.insertTextAfter(o,`
|
|
3
|
-
export ${l?"type ":""}* as ${r.text} ${
|
|
4
|
-
export {${s}} ${o5(i,e)}`)}let s=r.isTypeExport&&!t.isTypeImport;1!==t.variable.references.length||s||(yield o9(t.node,n,e)),yield o9(r.node,n,e)}}({context:e,imported:t,exported:n,exportDeclarations:o,program:a});s?r.suggest=[{messageId:o1,fix:i}]:r.fix=i,yield r}}})},meta:{type:"suggestion",docs:{description:"Prefer `export…from` when re-exporting.",recommended:!0},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,properties:{checkUsedVariables:{type:"boolean",description:"Whether to check variables that are used in the module."}}}],defaultOptions:[{checkUsedVariables:!0}],messages:{[o0]:"Use `export…from` to re-export `{{exported}}`.",[o1]:"Switch to `export…from`."},languages:["js/js"]}},o7="prefer-native-coercion-functions",ae=new Set(["String","Number","BigInt","Boolean","Symbol"]),at=new Set(["every","filter","find","findLast","findIndex","findLastIndex","some"]),ar=(e,t)=>e?.type==="CallExpression"&&!e.optional&&"Identifier"===e.callee.type&&ae.has(e.callee.name)&&e.arguments[0]?.type==="Identifier"&&e.arguments[0].name===t,an=(e,t)=>{let r={[t]:!0};for(let t of e.split(".").toReversed())r={[t]:r};return r};class ao{#n={};#e;#o;#a;constructor({object:e,objects:t=[e],type:r=ez.READ,context:n,filter:o,handle:a}){for(let e of t)Object.assign(this.#n,an(e,r));this.#e=n,this.#o=o,this.#a=a}*#i(e,t){let r=t?.context??this.#e,n=t?.filter??this.#o,o=t?.handle??this.#a;for(let t of new ez(e).iterateGlobalReferences(this.#n)){if(n&&!n(t))continue;let e=o(t,r);yield e}}listen(e){let t=e?.context??this.#e;t.onExit("Program",r=>this.#i(t.sourceCode.getScope(r),e))}}Object.assign(ao,{READ:ez.READ,CALL:ez.CALL,CONSTRUCT:ez.CONSTRUCT});let aa="no-document-cookie",ai=new ao({object:"document.cookie",filter:({node:e})=>"AssignmentExpression"===e.parent.type&&e.parent.left===e,handle:({node:e})=>({node:e,messageId:aa})}),as=e=>[`webkit${e}`,`o${e.toLowerCase()}`,e.toLowerCase()],al=new Set(["click","rightclick","dblclick","auxclick","mousedown","mouseup","mouseover","mouseout","mousemove","mouseenter","mouseleave","mousecancel","selectionchange","selectstart","wheel","keypress","keydown","keyup","blur","focus","deactivate","focusin","focusout","change","reset","select","submit","input","propertychange","dragstart","drag","dragenter","dragover","dragleave","drop","dragend","touchstart","touchmove","touchend","touchcancel","beforeunload","consolemessage","contextmenu","devicechange","devicemotion","deviceorientation","DOMContentLoaded","error","help","load","losecapture","orientationchange","readystatechange","resize","scroll","unload","canplay","canplaythrough","durationchange","emptied","ended","loadeddata","loadedmetadata","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","sourceopen","sourceended","sourceclosed","abort","update","updatestart","updateend","hashchange","pagehide","pageshow","popstate","copy","paste","cut","beforecopy","beforecut","beforepaste","online","offline","message","connect","install","activate","fetch","foreignfetch","messageerror","statechange","updatefound","controllerchange",...as("AnimationStart"),...as("AnimationEnd"),...as("AnimationIteration"),...as("TransitionEnd"),"pointerdown","pointerup","pointercancel","pointermove","pointerover","pointerout","pointerenter","pointerleave","gotpointercapture","lostpointercapture","MSGestureChange","MSGestureEnd","MSGestureHold","MSGestureStart","MSGestureTap","MSGotPointerCapture","MSInertiaStart","MSLostPointerCapture","MSPointerCancel","MSPointerDown","MSPointerEnter","MSPointerHover","MSPointerLeave","MSPointerMove","MSPointerOut","MSPointerOver","MSPointerUp","text","textinput","textInput","compositionstart","compositionupdate","compositionend","beforeinput","exit","loadabort","loadcommit","loadredirect","loadstart","loadstop","responsive","sizechanged","unresponsive","visibilitychange","storage","DOMSubtreeModified","DOMNodeInserted","DOMNodeRemoved","DOMNodeRemovedFromDocument","DOMNodeInsertedIntoDocument","DOMAttrModified","DOMCharacterDataModified","beforeprint","afterprint","beforeinstallprompt","appinstalled","afterblur","beforeblur","cancel","close","dragexit","encrypted","fullscreenchange","invalid","toggle","search","open","show"]),au="prefer-add-event-listener",ap={create:e=>{let t,r,n=new Set(e.options[0].excludedPackages),o=new WeakMap;e.on("onCodePathStart",(e,t)=>{r={node:t,upper:r,returnsSomething:!1}}),e.on("onCodePathEnd",()=>{o.set(r.node,r.returnsSomething),r=r.upper}),e.on("CallExpression",e=>{tm(e)&&!t&&n.has(e.arguments[0].value)&&(t=!0)}),e.on("Literal",e=>{"ImportDeclaration"===e.parent.type&&!t&&n.has(e.value)&&(t=!0)}),e.on("ReturnStatement",e=>{r.returnsSomething||=!!e.argument}),e.on("AssignmentExpression:exit",r=>{let n;if(t)return;let{left:a,right:i,operator:s}=r;if("MemberExpression"!==a.type||a.computed)return;let l=a.property.name;if(!l||!l.startsWith("on"))return;let u=l.slice(2);if(!al.has(u))return;let p="addEventListener",c="";if(th(i)||e9(i))p="removeEventListener";else"beforeunload"===u&&("ArrowFunctionExpression"!==i.type&&"FunctionExpression"!==i.type||"BlockStatement"!==i.body.type||o.get(i))?c="Use `event.preventDefault(); event.returnValue = 'foo'` to trigger the prompt.":"message"===u?c="Note that there is difference between `SharedWorker#onmessage` and `SharedWorker#addEventListener('message')`.":"error"===u?c="Note that there is difference between `{window,element}.onerror` and `{window,element}.addEventListener('error')`.":"="!==s||"ExpressionStatement"!==r.parent.type||r.parent.expression!==r||np(i)||(n=t=>((e,t,r,n)=>{let{sourceCode:o}=t,a=n.property.name.slice(2),i=o.getText(n.object);eZ(n.object,t)&&(i=`(${i})`);let s=o.getText(r.right);eZ(r.right,t)&&(s=`(${s})`);let l=`${i}.addEventListener('${a}', ${s})`;return e.replaceText(r,l)})(t,e,r,a));return{node:a.property,messageId:au,data:{replacement:p,method:l,extra:c?` ${c}`:""},fix:n}})},meta:{type:"suggestion",docs:{description:"Prefer `.addEventListener()` and `.removeEventListener()` over `on`-functions.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{excludedPackages:{type:"array",items:{type:"string"},uniqueItems:!0,description:"Packages to exclude from checking."}}}],defaultOptions:[{excludedPackages:["koa","sax"]}],messages:{[au]:"Prefer `{{replacement}}` over `{{method}}`.{{extra}}"},languages:["js/js"]}},ac=new Set(["false","true"]),ad=(e,t)=>"BinaryExpression"===e.type&&"==="===e.operator&&(nm(e.left,t)||nm(e.right,t)),am=({type:e,name:t},r)=>"Identifier"===e&&t===r;function af({method:e,replacement:t,checkBooleanPredicate:r=!1}){let n=`prefer-${t}-over-${e}/`,o=`${n}error`,a=`${n}suggestion`;return{messages:{[o]:({findIndex:"Use `.indexOf()` instead of `.findIndex()` when looking for the index of an item.",findLastIndex:"Use `.lastIndexOf()` instead of `.findLastIndex() when looking for the index of an item.`",some:`Use \`.${t}()\` instead of \`.${e}()\` when checking value existence.`})[e],[a]:`Replace \`.${e}()\` with \`.${t}()\`.`},listen:function(n){let{sourceCode:i}=n,{scopeManager:s}=i;n.on("CallExpression",r=>{let l,u,p;if(!tc(r,{method:e,argumentsLength:1,optionalCall:!1})||!("ArrowFunctionExpression"===(p=r.arguments[0]).type&&!p.async&&1===p.params.length&&ad(p.body,p.params[0])||("ArrowFunctionExpression"===p.type||"FunctionExpression"===p.type)&&!p.async&&!p.generator&&1===p.params.length&&"BlockStatement"===p.body.type&&1===p.body.body.length&&"ReturnStatement"===p.body.body[0].type&&ad(p.body.body[0].argument,p.params[0]))||rP(r.callee.object,n))return;let[c]=r.arguments,d="BinaryExpression"===c.body.type?c.body:c.body.body[0].argument,[m]=c.params,{left:f,right:g}=d,{name:y}=m;if(am(f,y))l=g,u=f;else{if(!am(g,y))return;l=f,u=g}let h=s.acquire(c);if(!h||ei(h,m).references.some(({identifier:e})=>e!==u)||ro(c,h))return;let x=r.callee.property,b={node:x,messageId:o,suggest:[]},E=function*(e){let r=i.getText(l);eZ(l,n)&&!eZ(c,n)&&(r=`(${r})`),yield e.replaceText(x,t),yield e.replaceText(c,r)};return eR(l,i)?b.suggest.push({messageId:a,fix:E}):b.fix=E,b}),r&&i.parserServices?.program&&n.on("CallExpression",r=>{if(!tc(r,{method:e,argumentsLength:1,optionalCall:!1}))return;let[n]=r.arguments;if("ArrowFunctionExpression"!==n.type&&"FunctionExpression"!==n.type||1!==n.params.length||"Identifier"!==n.params[0].type)return;let[a]=n.params,{parserServices:l}=i,u=function(e,t){let r="ArrowFunctionExpression"!==e.type||e.async||1!==e.params.length||"BlockStatement"===e.body.type?"ArrowFunctionExpression"!==e.type&&"FunctionExpression"!==e.type||e.async||e.generator||1!==e.params.length||"BlockStatement"!==e.body.type||1!==e.body.body.length||"ReturnStatement"!==e.body.body[0].type?void 0:e.body.body[0].argument:e.body;if(r){if(nm(r,t))return r;if("CallExpression"===r.type&&!r.optional&&am(r.callee,"Boolean")&&1===r.arguments.length&&nm(r.arguments[0],t))return r.arguments[0]}}(n,a);if(!u||!function(e){if("boolean"===e.intrinsicName||"true"===e.intrinsicName)return!0;if(!e.isUnion())return!1;let t=e.types.map(e=>e.intrinsicName);return t.includes("true")&&t.every(e=>ac.has(e))}(l.getTypeAtLocation(a))||!function(e,t){if(e.isUnion())return!1;let r=t.program.getTypeChecker();return!!e.getProperty("includes")&&(r.isArrayType(e)||r.isTupleType(e))}(l.getTypeAtLocation(r.callee.object),l))return;let p=s.acquire(n);if(!p||ei(p,a).references.some(({identifier:e})=>e!==u)||ro(n,p))return;let c=r.callee.property;return{node:c,messageId:o,*fix(e,{abort:r}){i.getCommentsInside(n).length>0&&r(),yield e.replaceText(c,t),yield e.replaceText(n,"true")}}})}}}let ag=af({method:"findIndex",replacement:"indexOf"}),ay=af({method:"findLastIndex",replacement:"lastIndexOf"}),ah={create(e){ag.listen(e),ay.listen(e)},meta:{type:"suggestion",docs:{description:"Prefer `Array#{indexOf,lastIndexOf}()` over `Array#{findIndex,findLastIndex}()` when looking for the index of an item.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{...ag.messages,...ay.messages},languages:["js/js"]}},ax="error",ab="prefer-date",aE="prefer-date-now-over-methods",aD="prefer-date-now-over-number-data-object",aS=e=>te(e,{name:"Date",argumentsLength:0}),av=(e,t,r)=>({node:e,messageId:ab,*fix(t){yield t.replaceText(e,"Date.now()"),"UnaryExpression"===e.type&&(yield of(t,e,r))},...t}),{isIdentifierName:aC}=t$,aA="prefer-dataset",aT="prefer-attributes",aw=e=>`data-${e.replaceAll(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}`,aI=e=>tp(e,{property:"dataset"}),aF=e=>e.computed||"Identifier"!==e.property.type?e.computed&&e1(e.property)?e.property.value:void 0:e.property.name,aj=new Set(["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf","__proto__","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"]),ak=/[\s\u0000-\u001F"'/<=>]/,aB=e=>aj.has(e)||e.includes("-")||ak.test(e);function aP(e,t){let r=eQ(e,t);return!eZ(e,t.sourceCode)&&nM(e,t)?`(${r})`:r}let a$={create:e=>{let{preferAttributes:t}=e.options[0];if(t){let{sourceCode:t}=e,r=(r,n,o)=>{if(aB(n.value)||rM(o.object,e))return;let a=aP(o.object,e),i=o.optional?"?.":".",s=tF(aw(n.value),n.raw.charAt(0)),l=t9(e,r,[o.object])?void 0:n=>{let o=`${a}${i}hasAttribute(${s})`;return nS(t.getTokenBefore(r),e,o)&&(o=`;${o}`),n.replaceText(r,o)};return{node:r,messageId:aT,data:{method:"hasAttribute"},fix:l}};e.on("BinaryExpression",e=>{if("in"===e.operator&&e1(e.left)&&aI(e.right))return r(e,e.left,e.right)}),e.on("CallExpression",e=>tc(e,{object:"Object",method:"hasOwn",argumentsLength:2,optionalCall:!1,optionalMember:!1})&&aI(e.arguments[0])&&e1(e.arguments[1])?r(e,e.arguments[1],e.arguments[0]):tc(e,{method:"hasOwnProperty",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&aI(e.callee.object)&&e1(e.arguments[0])?r(e,e.arguments[0],e.callee.object):void 0),e.on("VariableDeclarator",t=>{let r;if(!(t.init&&aI(t.init)&&("ObjectPattern"===t.id.type||"Identifier"===t.id.type))||rM(t.init.object,e))return;let n=t.init;if("Identifier"===t.id.type)return{node:n,messageId:aT,data:{method:"getAttribute"},fix:function(e,t){let{sourceCode:r}=t,n=e.init,o=e.parent,[a]=r.getDeclaredVariables(e);if(!a)return;let i=function(e){let t=[];for(let r of e.references){if(r.init)continue;let{identifier:e}=r,n=e.parent;if(!("MemberExpression"===n.type&&n.object===e&&!n.optional))return;let o=aF(n);if(void 0===o||aB(o))return;let{parent:a}=n;if(rq(n)||"CallExpression"===a.type&&a.callee===n||"TaggedTemplateExpression"===a.type&&a.tag===n)return;t.push(n)}return t}(a);if(!(i&&i.length>0&&"const"===o.kind&&1===o.declarations.length&&!o.parent.type.startsWith("For")&&"ExportNamedDeclaration"!==o.parent.type&&"Identifier"===n.object.type&&function(e,t,r){let{sourceCode:n}=r,{name:o}=e.object,a=e=>ei(n.getScope(e),o),i=a(e.object),s=t.some(e=>a(e)!==i),l=!!i?.references.some(e=>e.isWrite()&&!e.init);return!s&&!l}(n,i,t)&&!t9(t,o)&&i.every(e=>!t9(t,e))))return;let s=aP(n.object,t);return function*(e){for(let r of(yield ob(o,t,e),i)){let t=r.computed?r.property.raw.charAt(0):void 0,n=tF(aw(aF(r)),t);yield e.replaceText(r,`${s}.getAttribute(${n})`)}}}(t,e)};let{properties:o}=t.id;if(o.some(e=>"Property"===e.type&&(e.computed||"Identifier"!==e.key.type?!e1(e.key)||aB(e.key.value):aB(e.key.name))))return;let a=t.parent,i=aP(n.object,e),s=n.optional?"?.":".";if(o.length>0&&1===a.declarations.length&&!a.parent.type.startsWith("For")&&"ExportNamedDeclaration"!==a.parent.type&&!t9(e,a,[n.object])&&o.every(e=>"Property"===e.type&&!e.computed&&"Identifier"===e.key.type&&"Identifier"===e.value.type)&&(1===o.length||"Identifier"===n.object.type)){let t=t2(a,e),n=o.map(e=>{let t=tF(aw(e.key.name),"'");return`${a.kind} ${e.value.name} = ${i}${s}getAttribute(${t})`});r=e=>e.replaceText(a,`${n.join(`;
|
|
5
|
-
${t}`)};`)}return{node:n,messageId:aT,data:{method:"getAttribute"},fix:r}}),e.on("MemberExpression",r=>{let n,{object:o}=r;if(!aI(o)||rM(o.object,e))return;let a=aF(r);if(void 0===a||aB(a)||r.optional)return;let i="ChainExpression"===r.parent.type?r.parent.parent:r.parent;if("CallExpression"===i.type&&i.callee===r||"TaggedTemplateExpression"===i.type&&i.tag===r||"UpdateExpression"===i.type||"AssignmentExpression"===i.type&&i.left===r&&"="!==i.operator)return;let s="AssignmentExpression"===i.type&&i.left===r,l="UnaryExpression"===i.type&&"delete"===i.operator;if(rq(r)&&!s&&!l)return;let u=aP(o.object,e),p=o.optional?"?.":".",c=r.computed?r.property.raw.charAt(0):void 0,d=tF(aw(a),c);return s&&nb(i)&&!t9(e,i,[o.object,i.right])?n=t=>t.replaceText(i,`${u}${p}setAttribute(${d}, ${eQ(i.right,e)})`):l&&ti(i.parent)&&!t9(e,i,[o.object])?n=r=>{let n=`${u}${p}removeAttribute(${d})`;return nS(t.getTokenBefore(i),e,n)&&(n=`;${n}`),r.replaceText(i,n)}:s||l||t9(e,r,[o.object])||(n=e=>e.replaceText(r,`${u}${p}getAttribute(${d})`)),{node:r,messageId:aT,data:{method:s?"setAttribute":l?"removeAttribute":"getAttribute"},fix:n}});return}e.on("CallExpression",t=>{if(!((tc(t,{method:"setAttribute",argumentsLength:2,optionalCall:!1,optionalMember:!1})||tc(t,{methods:["removeAttribute","hasAttribute"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||tc(t,{method:"getAttribute",argumentsLength:1,optionalCall:!1}))&&e1(t.arguments[0]))||rM(t.callee.object,e))return;let r=t.callee.property.name,n="ChainExpression"===t.parent.type?t.parent:t;if(("AwaitExpression"!==n.parent.type||n.parent.argument!==n||"getAttribute"!==r)&&t.arguments[0].value.toLowerCase().startsWith("data-"))return{node:t,messageId:aA,data:{method:r},fix:function(e,t){let r=e.callee.property.name;if("setAttribute"===r&&rr(e.callee)||"setAttribute"===r&&!nb(e)||"removeAttribute"===r&&!ti(e.parent))return;let n=[e.callee.object];if("setAttribute"===r&&n.push(e.arguments[1]),!t9(t,e,n))return n=>{let[o]=e.arguments,a=o.value.toLowerCase().slice(5).replaceAll(/-[a-z]/g,e=>e[1].toUpperCase()),i="",s=`${aP(e.callee.object,t)}${e.callee.optional?"?":""}.dataset`;switch(r){case"setAttribute":case"getAttribute":case"removeAttribute":i=aC(a)?`.${a}`:`[${tF(a,o.raw.charAt(0))}]`,i=`${s}${i}`,"setAttribute"===r?i+=` = ${eQ(e.arguments[1],t)}`:"removeAttribute"===r&&(i=`delete ${i}`);break;case"hasAttribute":i=`Object.hasOwn(${s}, ${tF(a,o.raw.charAt(0))})`}return n.replaceText(e,i)}}(t,e)}})},meta:{type:"suggestion",docs:{description:"Enforce consistent style for DOM element dataset access.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{preferAttributes:{type:"boolean",description:"Prefer attribute methods over named `.dataset` access."}}}],defaultOptions:[{preferAttributes:!1}],messages:{[aA]:"Prefer `.dataset` over `{{method}}(…)`.",[aT]:"Prefer `.{{method}}(…)` over `.dataset`."},languages:["js/js"]}},aR="prefer-modern-math-apis",aL=(e,t)=>"MemberExpression"===e.type&&!e.optional&&!e.computed&&"Identifier"===e.object.type&&"Math"===e.object.name&&"Identifier"===e.property.type&&e.property.name===t,aN=(e,t)=>"CallExpression"===e.type&&!e.optional&&aL(e.callee,t)&&1===e.arguments.length&&"SpreadElement"!==e.arguments[0].type;function aM({constantName:e,replacementMethod:t}){let r=`Math.${t}(…)`;return function(n,o){let a,i;if("BinaryExpression"!==n.type||"*"!==n.operator||(aN(n.left,"log")&&aL(n.right,e)?(a=n.left,i=`Math.log(…) * Math.${e}`):aN(n.right,"log")&&aL(n.left,e)&&(a=n.right,i=`Math.${e} * Math.log(…)`),!a))return;let[s]=a.arguments;return{node:n,messageId:aR,data:{replacement:r,description:i},fix:e=>e.replaceText(n,`Math.${t}(${eQ(s,o)})`)}}}function aO({constantName:e,replacementMethod:t}){let r={messageId:aR,data:{replacement:`Math.${t}(…)`,description:`Math.log(…) / Math.${e}`}};return function(n,o){if(!("BinaryExpression"===n.type&&"/"===n.operator&&aN(n.left,"log")&&aL(n.right,e)))return;let[a]=n.left.arguments;return{...r,node:n,fix:e=>e.replaceText(n,`Math.${t}(${eQ(a,o)})`)}}}let aq=[aM({constantName:"LOG10E",replacementMethod:"log10"}),aM({constantName:"LOG2E",replacementMethod:"log2"}),aO({constantName:"LN10",replacementMethod:"log10"}),aO({constantName:"LN2",replacementMethod:"log2"})],aU=e=>"BinaryExpression"===e.type&&"+"===e.operator?[e.left,e.right].flatMap(e=>aU(e)):[e],a_="number-literal-case",aW=(e,{hexadecimalValue:t})=>{let r=e.toLowerCase();return r.startsWith("0x")&&(r="0x"+r.slice(2)["lowercase"===t?"toLowerCase":"toUpperCase"]()),r},aV={create:nR(e=>{e.on("Literal",t=>{let{raw:r}=t,n=e.options[0]??{};n.hexadecimalValue??="uppercase";let o=r;if(e8(t)?o=aW(r,n):e5(t)&&(o=aW(r.slice(0,-1),n)+"n"),r!==o)return{node:t,messageId:a_,fix:e=>e.replaceText(t,o)}})}),meta:{type:"suggestion",docs:{description:"Enforce proper case for numeric literals.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{hexadecimalValue:{enum:["uppercase","lowercase"]}}}],defaultOptions:[{hexadecimalValue:"uppercase"}],messages:{[a_]:"Invalid number literal casing."},languages:["js/js"]}},az="error",aK="suggestion",aG={parseInt:!0,NaN:!0,Infinity:!0,isNaN:!1,isFinite:!1},aJ=e=>{let{parent:t}=e;return"UnaryExpression"===t.type&&"-"===t.operator&&t.argument===e};function aX(e,t){let{node:r,path:n}=e,[o]=n,{parent:a}=r,i=o;"Infinity"===o&&(i=aJ(r)?"NEGATIVE_INFINITY":"POSITIVE_INFINITY");let s={node:r,messageId:az,data:{description:o,property:i}};if("NEGATIVE_INFINITY"===i)return s.node=a,s.data.description="-Infinity",s.fix=function*(e){yield e.replaceText(a,"Number.NEGATIVE_INFINITY"),yield of(e,a,t)},s;let l=e=>oE(r,`Number.${i}`,t,e);return aG[o]||((e,t)=>{let{parent:r}=e;if("CallExpression"!==r.type||r.callee!==e||1!==r.arguments.length)return!1;let[n]=r.arguments;return"SpreadElement"!==n.type&&rX(n,t.sourceCode.getScope(e))})(r,t)?s.fix=l:s.suggest=[{messageId:aK,fix:l}],s}let aY={create:e=>{let{checkInfinity:t,checkNaN:r}=e.options[0];new ao({objects:Object.keys(aG).filter(e=>(!!t||"Infinity"!==e)&&(!!r||"NaN"!==e)),context:e,handle:aX,filter(t){let{node:r,path:n}=t,[o]=n;return!rq(r)&&!("Infinity"===o&&(e=>{if(!aJ(e))return!1;let{parent:t}=e,{parent:r}=t;return"UnaryExpression"===r.type&&"delete"===r.operator&&r.argument===t})(r))&&!("parseInt"===o&&function(e,t){let{parent:r}=e;if("CallExpression"!==r.type||r.callee!==e)return!1;let n=r.arguments[1];return!n||"SpreadElement"!==n.type&&ew(n,t.sourceCode.getScope(n))?.value===10}(r,e))}}).listen()},meta:{type:"suggestion",docs:{description:"Prefer `Number` static methods over global functions and optionally static properties over global constants.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,properties:{checkInfinity:{type:"boolean",description:"Whether to check usage of the global `Infinity`."},checkNaN:{type:"boolean",description:"Whether to check usage of the global `NaN`."}}}],defaultOptions:[{checkInfinity:!1,checkNaN:!1}],messages:{[az]:"Prefer `Number.{{property}}` over `{{description}}`.",[aK]:"Replace `{{description}}` with `Number.{{property}}`."},languages:["js/js"]}},aH="prefer-reflect-apply",aQ=(e,t)=>(e9(e)||"ThisExpression"===e.type)&&("ArrayExpression"===t.type||"Identifier"===t.type&&"arguments"===t.name),aZ=(e,t,r,n)=>`Reflect.apply(${e.getText(t)}, ${e.getText(r)}, ${e.getText(n)})`,a0="prefer-set-size";var a1={exports:{}};let{parse:a2}=tw(function(){var e,t,r,n;return l?a1.exports:(l=1,r=String.fromCodePoint||(e=String.fromCharCode,t=Math.floor,function(){var r,n,o=[],a=-1,i=arguments.length;if(!i)return"";for(var s="";++a<i;){var l=Number(arguments[a]);if(!isFinite(l)||l<0||l>1114111||t(l)!=l)throw RangeError("Invalid code point: "+l);l<=65535?o.push(l):(l-=65536,r=(l>>10)+55296,n=l%1024+56320,o.push(r,n)),(a+1==i||o.length>16384)&&(s+=e.apply(null,o),o.length=0)}return s}),n={parse:function(e,t,n){function o(t,r){return t.range[0]=r,t.raw=e.substring(r,t.range[1]),t}function a(t,r){return{type:"anchor",kind:t,range:[H-r,H],raw:e.substring(H-r,H)}}function i(t,r,n,o){return{type:"value",kind:t,codePoint:r,range:[n,o],raw:e.substring(n,o)}}function s(e,t,r,n){return n=n||0,i(e,t,H-(r.length+n),H)}function l(e){var t,r=e[0],n=r.charCodeAt(0);return Y&&1===r.length&&n>=55296&&n<=56319&&(t=h().charCodeAt(0))>=56320&&t<=57343?i("symbol",(n-55296)*1024+t-56320+65536,++H-2,H):i("symbol",n,H-1,H)}function u(t,r,n,o,a){return null==o&&(n=H-1,o=H),{type:"quantifier",min:t,max:r,greedy:!0,body:null,symbol:a,range:[n,o],raw:e.substring(n,o)}}function p(t,r,n,o){return{type:"characterClass",kind:t.kind,body:t.body,negative:r,range:[n,o],raw:e.substring(n,o)}}function c(t,r,n,o){return t.codePoint>r.codePoint&&W("invalid range in character class",t.raw+"-"+r.raw,n,o),{type:"characterClassRange",min:t,max:r,range:[n,o],raw:e.substring(n,o)}}function d(e){return"alternative"===e.type?e.body:[e]}function m(e){H+=e=e||1}function f(e){g(e)||W("character",e)}function g(t){var r=t.length;if(e.substring(H,H+r)===t)return m(r),t}function y(t){if(e[H]===t)return H++,t}function h(){return e[H]}function x(t){return e[H]===t}function b(t){return e[H+1]===t}function E(t){var r=e.substring(H).match(t);return r&&(H+=r[0].length),r}function D(){var t,r=[],n=H;for(r.push(S());y("|");)r.push(S());return 1===r.length?r[0]:{type:"disjunction",body:r,range:[n,t=H],raw:e.substring(n,t)}}function S(){for(var t,r,s=[],u=H;r=function(){if(H>=e.length||x("|")||x(")"))return null;var t,r=function(){switch(h()){case"^":return m(),a("start",1);case"$":return m(),a("end",1);case"\\":if(b("b"))return m(2),a("boundary",2);if(b("B"))return m(2),a("not-boundary",2);break;case"(":return v("(?=","lookahead","(?!","negativeLookahead");default:return}}();if(r){var s=H;if(t=A()||!1){if(!Y&&"group"===r.type)return t.body=d(r),o(t,r.range[0]),t;H=s,W("Expected atom")}return r}var u=function(){var t;switch(t=h()){case".":return m(),{type:"dot",range:[H-1,H],raw:"."};case"\\":if(m(),!(t=w())){if(!Y&&"c"==h())return i("symbol",92,H-1,H);W("atomEscape")}return t;case"[":return L();case"(":if(n.lookbehind&&(t=v("(?<=","lookbehind","(?<!","negativeLookbehind")))return t;if(n.namedGroups&&g("(?<")){var r,o,a,s,u,p=B();f(">");var c=C("normal",p.range[0]-3);return c.name=p,c}if(!n.modifiers||"(?"!==e.substring(H,H+2)||":"==e[H+2])return v("(?:","ignore","(","normal");return o=H,m(2),a=E(/^[sim]+/),y("-")&&":"!==h()?(r=E(/^[sim]+/))||W("Invalid flags for modifiers group"):a||W("Invalid flags for modifiers group"),((s=(a=a?a[0]:"")+(r=r?r[0]:"")).length>3||function(e){for(var t=0;t<e.length;){if(-1!=e.indexOf(e[t],t+1))return!0;t++}return!1}(s))&&W("flags cannot be duplicated for modifiers group"),y(":")||W("Invalid flags for modifiers group"),(u=C("ignore",o)).modifierFlags={enabling:a,disabling:r},u;case"]":case"}":if(!Y)return m(),l(t);break;case"^":case"$":case"*":case"+":case"?":case"{":case")":case"|":break;default:return m(),l(t)}}();if(u||(s=H,(t=A()||!1)&&(H=s,W("Expected atom")),!Y&&y("{")?u=l("{"):W("Expected atom")),t=A()||!1){var p=u.type,c=u.behavior;return"group"===p&&("negativeLookbehind"===c||"lookbehind"===c)&&W("Invalid quantifier","",t.range[0],t.range[1]),t.body=d(u),o(t,u.range[0]),t}return u}();)s.push(r);return 1===s.length?s[0]:{type:"alternative",body:s,range:[u,t=H],raw:e.substring(u,t)}}function v(e,t,r,n){var o,a=H;if(g(e))o=t;else{if(!g(r))return!1;o=n}return C(o,a)}function C(t,r){var n,o=D();o||W("Expected disjunction"),f(")");var a={type:"group",behavior:t,body:d(o),range:[r,n=H],raw:e.substring(r,n)};return"normal"==t&&K&&z++,a}function A(){var e,t,r,n,o=H;switch(h()){case"*":m(),e=u(0,void 0,void 0,void 0,"*");break;case"+":m(),e=u(1,void 0,void 0,void 0,"+");break;case"?":m(),e=u(0,1,void 0,void 0,"?");break;case"{":(n=E(/^\{(\d+)\}/))?e=u(t=parseInt(n[1],10),t,o,H):(n=E(/^\{(\d+),\}/))?e=u(t=parseInt(n[1],10),void 0,o,H):(n=E(/^\{(\d+),(\d+)\}/))&&((t=parseInt(n[1],10))>(r=parseInt(n[2],10))&&W("numbers out of order in {} quantifier","",o,H),e=u(t,r,o,H)),(t&&!Number.isSafeInteger(t)||r&&!Number.isSafeInteger(r))&&W("iterations outside JS safe integer range in quantifier","",o,H)}return e&&y("?")&&(e.greedy=!1,e.range[1]+=1),e}function T(t,r){if(r){var n,o;if("unicodeEscape"==t.kind&&(n=t.codePoint)>=55296&&n<=56319&&x("\\")&&b("u")){var a=H;H++;var i=w(!0);"unicodeEscape"==i.kind&&(o=i.codePoint)>=56320&&o<=57343?(t.kind="unicodeCodePointEscape",t.codePoint=(n-55296)*1024+o-56320+65536,t.range[1]=H,t.raw=e.substring(t.range[0],H)):H=a}}return t}n||(n={});function w(t){var r,a,i,u,p=H;switch(u=h()){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return function(t){var r,n,a=H;if(r=E(/^(?!0)\d+/)){var i,u,p=parseInt(n=r[0],10);if(p<=z&&!t)return u=H-1-(i=n).length,{type:"reference",matchIndex:parseInt(i,10),range:[u,H],raw:e.substring(u,H)};if(V.push(p),K?G=!0:I(a,H),m(-n.length),r=E(/^[0-7]{1,3}/))return s("octal",parseInt(r[0],8),r[0],1);var c=H;return o(r=l(E(/^[89]/)),c-1)}return!!(r=E(/^[0-7]{1,3}/))&&(("0"!==(n=r[0])&&I(a,H),/^0{1,3}$/.test(n))?s("null",0,"0",n.length):s("octal",parseInt(n,8),n,1))}(t);case"B":if(!t)return R();W("\\B not possible inside of CharacterClass","",p);break;case"b":if(t)return m(),s("singleEscape",8,"\\b");return R();case"c":if(t){if(!Y&&(i=E(/^c(\d)/)))return s("controlLetter",i[1]+16,i[1],2);else if(!Y&&g("c_"))return s("controlLetter",31,"_",2)}return j();case"d":case"D":case"w":case"W":case"s":case"S":return m(),{type:"characterClassEscape",value:u,range:[H-2,H],raw:e.substring(H-2,H)};case"k":return function(){if(n.namedGroups&&E(/^k<(?=.*?>)/)){var t,r=B();return f(">"),t=r.range[0]-3,{type:"reference",name:r,range:[t,H],raw:e.substring(t,H)}}}()||R();case"p":case"P":return a=H,!!(n.unicodePropertyEscape&&Y&&(r=E(/^([pP])\{([^}]+)\}/)))&&{type:"unicodePropertyEscape",negative:"P"===r[1],value:r[2],range:[a-1,H],raw:e.substring(a-1,H)}||R();case"-":if(t&&Y)return m(),s("singleEscape",45,"\\-");return R();default:return j()}}function I(e,t){Y&&W("Invalid decimal escape in unicode mode",null,e,t)}function F(e){var t;return(t=E(/^u([0-9a-fA-F]{4})/))?T(s("unicodeEscape",parseInt(t[1],16),t[1],2),e):e&&(t=E(/^u\{([0-9a-fA-F]+)\}/))?s("unicodeCodePointEscape",parseInt(t[1],16),t[1],4):void 0}function j(){var e,t=H;switch(h()){case"t":return m(),s("singleEscape",9,"\\t");case"n":return m(),s("singleEscape",10,"\\n");case"v":return m(),s("singleEscape",11,"\\v");case"f":return m(),s("singleEscape",12,"\\f");case"r":return m(),s("singleEscape",13,"\\r");case"c":if(e=E(/^c([a-zA-Z])/))return s("controlLetter",e[1].charCodeAt(0)%32,e[1],2);break;case"x":if(e=E(/^x([0-9a-fA-F]{2})/))return s("hexadecimalEscape",parseInt(e[1],16),e[1],2);break;case"u":if(e=F(Y))return(!e||e.codePoint>1114111)&&W("Invalid escape sequence",null,t,H),e}return R()}function k(t){var n=h(),o=H;if("\\"===n){m();var a=F(!0);return a&&t(a.codePoint)||W("Invalid escape sequence",null,o,H),r(a.codePoint)}var i=n.charCodeAt(0);if(i>=55296&&i<=56319){var s=(n+=e[H+1]).charCodeAt(1);s>=56320&&s<=57343&&(i=(i-55296)*1024+s-56320+65536)}if(t(i))return m(),i>65535&&m(),n}function B(){var t,r=H,n=k(P);for(n||W("Invalid identifier");t=k($);)n+=t;return{type:"identifier",value:n,range:[r,H],raw:e.substring(r,H)}}function P(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=128&&/[\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\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\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\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\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\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\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\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\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\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\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-\uAB69\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]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDDC0-\uDDF3\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD40-\uDD59\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDD4A-\uDD65\uDD6F-\uDD85\uDE80-\uDEA9\uDEB0\uDEB1\uDEC2-\uDEC7\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61\uDF80-\uDF89\uDF8B\uDF8E\uDF90-\uDFB5\uDFB7\uDFD1\uDFD3]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8\uDFC0-\uDFE0]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDB0-\uDDDB\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD80E\uD80F\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD1D]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDD40-\uDD6C\uDE40-\uDE7F\uDEA0-\uDEB8\uDEBB-\uDED3\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3\uDFF2-\uDFF6]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDDD0-\uDDED\uDDF0\uDEC0-\uDEDE\uDEE0-\uDEE2\uDEE4\uDEE5\uDEE7-\uDEED\uDEF0-\uDEF4\uDEFE\uDEFF\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/.test(r(e))}function $(e){return P(e)||e>=48&&e<=57||e>=128&&/[\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD801[\uDCA0-\uDCA9]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDD30-\uDD39\uDD40-\uDD49\uDD69-\uDD6D\uDEAB\uDEAC\uDEFA-\uDEFF\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC66-\uDC70\uDC73\uDC74\uDC7F-\uDC82\uDCB0-\uDCBA\uDCC2\uDCF0-\uDCF9\uDD00-\uDD02\uDD27-\uDD34\uDD36-\uDD3F\uDD45\uDD46\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDDC9-\uDDCC\uDDCE-\uDDD9\uDE2C-\uDE37\uDE3E\uDE41\uDEDF-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF3B\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74\uDFB8-\uDFC0\uDFC2\uDFC5\uDFC7-\uDFCA\uDFCC-\uDFD0\uDFD2\uDFE1\uDFE2]|\uD805[\uDC35-\uDC46\uDC50-\uDC59\uDC5E\uDCB0-\uDCC3\uDCD0-\uDCD9\uDDAF-\uDDB5\uDDB8-\uDDC0\uDDDC\uDDDD\uDE30-\uDE40\uDE50-\uDE59\uDEAB-\uDEB7\uDEC0-\uDEC9\uDED0-\uDEE3\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDC2C-\uDC3A\uDCE0-\uDCE9\uDD30-\uDD35\uDD37\uDD38\uDD3B-\uDD3E\uDD40\uDD42\uDD43\uDD50-\uDD59\uDDD1-\uDDD7\uDDDA-\uDDE0\uDDE4\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE3E\uDE47\uDE51-\uDE5B\uDE8A-\uDE99\uDF60-\uDF67\uDFF0-\uDFF9]|\uD807[\uDC2F-\uDC36\uDC38-\uDC3F\uDC50-\uDC59\uDC92-\uDCA7\uDCA9-\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD50-\uDD59\uDD8A-\uDD8E\uDD90\uDD91\uDD93-\uDD97\uDDA0-\uDDA9\uDDE0-\uDDE9\uDEF3-\uDEF6\uDF00\uDF01\uDF03\uDF34-\uDF3A\uDF3E-\uDF42\uDF50-\uDF5A]|\uD80D[\uDC40\uDC47-\uDC55]|\uD818[\uDD1E-\uDD39]|\uD81A[\uDE60-\uDE69\uDEC0-\uDEC9\uDEF0-\uDEF4\uDF30-\uDF36\uDF50-\uDF59]|\uD81B[\uDD70-\uDD79\uDF4F\uDF51-\uDF87\uDF8F-\uDF92\uDFE4\uDFF0\uDFF1]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDCF0-\uDCF9\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDC8F\uDD30-\uDD36\uDD40-\uDD49\uDEAE\uDEEC-\uDEF9]|\uD839[\uDCEC-\uDCF9\uDDEE\uDDEF\uDDF1-\uDDFA\uDEE3\uDEE6\uDEEE\uDEEF\uDEF5]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A\uDD50-\uDD59]|\uD83E[\uDFF0-\uDFF9]|\uDB40[\uDD00-\uDDEF]/.test(r(e))}function R(){var t,r=h();return Y&&/[\^$.*+?()\\[\]{}|/]/.test(r)||!Y&&"c"!==r?"k"===r&&n.lookbehind?null:s("identifier",(t=e.substring(H,H+=1)).charCodeAt(0),t,1):null}function L(){var e,t=H;return g("[^")?(e=N(),f("]"),p(e,!0,t,H)):y("[")?(e=N(),f("]"),p(e,!1,t,H)):null}function N(){var e,t;return x("]")?{kind:"union",body:[]}:X?function(){var e,t=[],r=O(!0);for(t.push(r),e="classRange"===r.type?"union":x("&")?"intersection":x("-")?"subtraction":"union";!x("]");)"intersection"===e?(f("&"),f("&"),x("&")&&W("&& cannot be followed by &. Wrap it in brackets: &&[&].")):"subtraction"===e&&(f("-"),f("-")),t.push(r=O("union"===e));return{kind:e,body:t}}():((t=M())||W("classAtom"),(e=x("]")?[t]:function e(t){if(x("-")&&!b("]")){r=t.range[0],m(),i=l("-"),(a=M())||W("classAtom"),n=H;var r,n,o,a,i,s,u=N();return(u||W("classContents"),"codePoint"in t&&"codePoint"in a?o=[c(t,a,r,n)]:Y?W("invalid character class"):o=[t,i,a],"empty"===u.type)?o:o.concat(u.body)}return(s=M())||W("classAtom"),(o=x("]")?s:e(s))||W("nonEmptyClassRangesNoDash"),[t].concat(o)}(t))||W("nonEmptyClassRanges"),{kind:"union",body:e})}function M(){return y("-")?l("-"):function(){var e;switch(e=h()){case"\\":if(m(),!(e=w(!0))){if(!Y&&"c"==h())return l("\\");W("classEscape")}return T(e,Y);case"]":case"-":break;default:return m(),l(e)}}()}function O(t){var r,n,o=H;if(y("\\"))if(g("q{"))return function(){var t,r=H-3,n=[];do n.push(function(){for(var t,r,n=[],o=H;r=q();)n.push(r);return{type:"classString",characters:n,range:[o,t=H],raw:e.substring(o,t)}}());while(y("|"));return f("}"),{type:"classStrings",strings:n,range:[r,t=H],raw:e.substring(r,t)}}();else if(n=w(!0))r=n;else{if(n=_())return n;W("Invalid escape","\\"+h(),o)}else if(n=U())r=n;else{if(n=L())return n;W("Invalid character",h())}if(t&&x("-")&&!b("-")){if(m(),n=q())return c(r,n,o,H);W("Invalid range end",h())}return r}function q(){if(y("\\")){var e,t=H;if(e=_())return e;W("Invalid escape","\\"+h(),t)}return U()}function U(){var e;if(E(/^(?:&&|!!|##|\$\$|%%|\*\*|\+\+|,,|\.\.|::|;;|<<|==|>>|\?\?|@@|\^\^|``|~~)/)&&W("Invalid set operation in character class"),e=E(/^[^()[\]{}/\-\\|]/))return l(e)}function _(){var e;if(y("b"))return s("singleEscape",8,"\\b");if(y("B"))W("\\B not possible inside of ClassContents","",H-2);else if(e=E(/^[&\-!#%,:;<=>@`~]/))return s("identifier",e[0].codePointAt(0),e[0]);else if(e=j())return e;else return null}function W(t,r,n,o){n=null==n?H:n,o=null==o?n:o;var a=Math.max(0,n-10),i=Math.min(o+10,e.length),s=" "+e.substring(a,i),l=" "+Array(n-a+1).join(" ")+"^";throw SyntaxError(t+" at position "+n+(r?": "+r:"")+"\n"+s+"\n"+l)}var V=[],z=0,K=!0,G=!1,J=-1!==(t||"").indexOf("u"),X=-1!==(t||"").indexOf("v"),Y=J||X,H=0;if(X&&!n.unicodeSet)throw Error('The "v" flag is only supported when the .unicodeSet option is enabled.');if(J&&X)throw Error('The "u" and "v" flags are mutually exclusive.');""===(e=String(e))&&(e="(?:)");var Q=D();return(Q.range[1]!==e.length&&W("Could not parse entire input - got stuck","",Q.range[1]),G=G||V.some(function(e){return e<=z}))?(H=0,K=!1,D()):Q}},a1.exports?a1.exports=n:window.regjsparser=n,a1.exports)}()),a3="method",a8="pattern",a6="split-join",a9=new Set(["i","y"]),a5=new Set(["anchor","reference"]),a4=e=>String.raw`\u{${e.toString(16)}}`;function a7(e){let{kind:t,codePoint:r,raw:n}=e;if("controlLetter"===t)return 13===r?String.raw`\r`:10===r?String.raw`\n`:9===r?String.raw`\t`:a4(r);if("null"===t||"octal"===t)return a4(r);let o=n;return(("identifier"===t||"symbol"===t&&n.length>1&&n.startsWith("\\"))&&(o=o.slice(1)),"'"===o||"\\"===o)?`\\${o}`:o}function ie(e){return"value"===e.type?a7(e):"characterClass"!==e.type||e.negative||1!==e.body.length||"value"!==e.body[0].type?"quantifier"===e.type&&1===e.min&&1===e.max||"group"===e.type&&"ignore"===e.behavior?it(e.body):void 0:a7(e.body[0])}function it(e){let t=[];for(let r of e){let e=ie(r);if(void 0===e)return;t.push(e)}return t.join("")}let ir=e=>{let{pattern:t,flags:r}=e.regex;try{return a2(t,r,{unicodePropertyEscape:r.includes("u"),unicodeSet:r.includes("v"),namedGroups:!0,lookbehind:!0})}catch{}},io=e=>{let t=0;for(let r of e)t+=ia(r);return t};function ia(e){return a5.has(e.type)?0:["value","dot","characterClass","characterClassEscape","unicodePropertyEscape"].includes(e.type)?1:"alternative"===e.type?io(e.body):"disjunction"===e.type?Math.min(...e.body.map(e=>ia(e))):"quantifier"===e.type?e.min*io(e.body):"group"===e.type&&"ignore"===e.behavior?io(e.body):0}let ii=e=>"group"===e.type&&"normal"===e.behavior||Array.isArray(e.body)&&e.body.some(e=>ii(e)),is=e=>e8(e)&&Number.isSafeInteger(e.value)&&e.value>=0,il=(e,t)=>{if("BinaryExpression"===e.type&&"+"===e.operator&&(tH(e.left,t)&&e0(e.right,1)||e0(e.left,1)&&tH(e.right,t)))return t},iu=e=>e8(e)?e.value:"UnaryExpression"===e.type&&"-"===e.operator?-iu(e.argument):void 0,ip=e=>e?.type==="MemberExpression"&&!1===e.computed&&"Identifier"===e.property.type&&"length"===e.property.name,ic="prefer-string-trim-start-end",id="no-unreadable-iife",im="suggestion",ig="throw-new-error",iy=/^(?:[A-Z][\da-z]*)*Error$/,ih="escape-uppercase",ix="escape-lowercase",ib=/(?<=(?:^|[^\\])(?:\\\\)*\\)(?<data>x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|u{[\dA-Fa-f]+})/g,iE=/(?<=(?:^|[^\\])(?:\\\\)*\\)(?<data>x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|u{[\dA-Fa-f]+}|c[A-Za-z])/g,iD=({node:e,original:t,regex:r=ib,lowercase:n,fix:o})=>{let a=t.replace(r,e=>e[0]+e.slice(1)[n?"toLowerCase":"toUpperCase"]());if(a!==t)return{node:e,messageId:n?ix:ih,fix:t=>o?o(t,a):t.replaceText(e,a)}},iS="prefer-unicode-code-point-escapes",iv="prefer-unicode-code-point-escapes/add-unicode-flag",iC=String.raw`\u{`,iA=/^[\da-f]$/iv,iT=/^[0-7]$/v,iw=/^[A-Za-z]$/v;function iI(e){return iT.test(e)}function iF(e,t){let r=0;for(let n=t-1;n>=0&&"\\"===e[n];n--)r++;return r%2==0}function ij(e,t){let r=0;for(let n=t-1;n>=0&&"\\"===e[n];n--)r++;return r%2==1}function ik(e,t,r){let n=e.slice(t,t+r);if(!(n.length!==r||[...n].some(e=>!iA.test(e))))return Number.parseInt(n,16)}function iB(e){return e>=55296&&e<=56319}function iP(e){return e>=56320&&e<=57343}function i$(e){return String.raw`\u{${e.toString(16).toUpperCase()}}`}function iR(e,{isRegex:t=!1,supportsNestedCharacterClasses:r=!1}={}){let n="",o=0,a=!1;for(let i=0;i<e.length;i++){let s=e[i],l=o>0;if(t&&"["===s&&(!l||r)&&!ij(e,i)){o++,n+=s;continue}if(t&&"]"===s&&l&&!ij(e,i)){o--,n+=s;continue}if("\\"!==s||!iF(e,i)){n+=s;continue}let u=function(e,t,{isRegex:r,isInCharacterClass:n}){return function(e,t){if("x"!==e[t+1])return;let r=ik(e,t+2,2);if(void 0!==r)return{end:t+4,replacement:i$(r)}}(e,t)??function(e,t,{allowSurrogatePair:r,allowSurrogate:n}){if("u"!==e[t+1]||"{"===e[t+2])return;let o=ik(e,t+2,4);if(void 0===o||!n&&(iB(o)||iP(o)))return;let a=t+6;if(r&&iB(o)&&"\\"===e[a]&&iF(e,a)&&"u"===e[a+1]){let t=ik(e,a+2,4);if(iP(t))return{end:a+6,replacement:i$((o-55296)*1024+(t-56320)+65536)}}return{end:t+6,replacement:i$(o)}}(e,t,{allowSurrogatePair:!n,allowSurrogate:!r||!n})??(r?function(e,t){let r=e[t+2];if("c"===e[t+1]&&iw.test(r))return{end:t+3,replacement:i$(r.toUpperCase().codePointAt(0)%32)}}(e,t):function(e,t){let r=e[t+1];if("0"===r&&!iI(e[t+2])||!iI(r))return;let n=r>="0"&&r<="3"?3:2,o=t+1;for(;o<t+1+n&&iI(e[o]);)o++;return{end:o,replacement:i$(Number.parseInt(e.slice(t+1,o),8))}}(e,t))}(e,i,{isRegex:t,isInCharacterClass:l});if(!u){n+=s;continue}n+=u.replacement,i=u.end-1,a=!0}return{fixed:n,hasReplacement:a}}function iL(e,t,r){let{fixed:n,hasReplacement:o}=iR(t);if(o)return{node:e,messageId:iS,fix:t=>r?r(t,n):t.replaceText(e,n)}}function iN(e){return e.includes("u")||e.includes("v")?e:`${e}u`}let iM=["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],iO=["Error","EvalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError","AggregateError","SuppressedError"],iq="missing-message",iU="message-is-empty-string",i_="message-is-not-a-string",iW=new Map([["AggregateError",1],["SuppressedError",2]]),iV=e=>"instanceof"===e.value&&"Keyword"===e.type,iz="no-instanceof-builtins",iK="switch-to-type-of",iG=new Set(["String","Number","Boolean","BigInt","Symbol"]),iJ=[...iO,"Map","Set","WeakMap","WeakRef","WeakSet","ArrayBuffer",...ra,"Object","RegExp","Promise","Proxy","DataView","Date","SharedArrayBuffer","FinalizationRegistry"],iX=(e,t)=>function*(r){let{left:n,right:o}=e,a=re(t,e),i=a.getTokenAfter(n,iV),{sourceCode:s}=t,l=s.getAncestors(e).findLast(e=>"VExpressionContainer"===e.type),u=l?'"'===s.getText(l)[0]?"'":'"':"'";yield of(r,e,t);let p=eH(n,{sourceCode:a});yield r.insertTextBeforeRange(p,"typeof "),yield r.replaceText(i,"===");let c=eH(o,{sourceCode:a});yield r.replaceTextRange(c,u+s.getText(o).toLowerCase()+u)},iY={create:nR(e=>{let{useErrorIsError:t=!1,strategy:r="loose",include:n=[],exclude:o=[]}=e.options[0]??{},a=new Set("strict"===r?[...iJ,...n]:n);e.on("BinaryExpression",r=>{let{right:n,operator:i}=r;if("instanceof"!==i||"Identifier"!==n.type||o.includes(n.name))return;let s=n.name,l={node:r,messageId:iz};if("Array"===s||"Error"===s&&t){let t="Array"===s?"Array.isArray":"Error.isError";return l.fix=function*(n){let{left:o,right:a}=r,i=re(e,r),s=i.getTokenAfter(o,iV);yield of(n,r,e);let l=eH(o,{sourceCode:i});yield n.insertTextBeforeRange(l,t+"("),yield n.insertTextAfterRange(l,")"),yield ov(s,"",n,e,i),yield ov(a,"",n,e,i)},l}return"Function"===s?(l.fix=iX(r,e),l):iG.has(s)?(l.suggest=[{messageId:iK,data:{type:s.toLowerCase()},fix:iX(r,e)}],l):a.has(s)?l:void 0})}),meta:{type:"problem",docs:{description:"Disallow `instanceof` with built-in objects",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",properties:{useErrorIsError:{type:"boolean"},strategy:{enum:["loose","strict"]},include:{type:"array",items:{type:"string"}},exclude:{type:"array",items:{type:"string"}}},additionalProperties:!1}],defaultOptions:[{useErrorIsError:!1,strategy:"loose",include:[],exclude:[]}],hasSuggestions:!0,messages:{[iz]:"Avoid using `instanceof` for type checking as it can lead to unreliable results.",[iK]:"Switch to `typeof … === '{{type}}'`."},languages:["js/js"]}},iH="prefer-type-error",iQ=new Set(["isArguments","isArray","isArrayBuffer","isArrayLike","isArrayLikeObject","isBigInt","isBoolean","isBuffer","isDate","isElement","isError","isFinite","isFunction","isInteger","isLength","isMap","isNaN","isNative","isNil","isNull","isNumber","isObject","isObjectLike","isPlainObject","isPrototypeOf","isRegExp","isSafeInteger","isSet","isString","isSymbol","isTypedArray","isUndefined","isView","isWeakMap","isWeakSet","isWindow","isXMLDoc"]),iZ=new Set(["isNaN","isFinite"]),i0=(e,t,r)=>void 0!==t&&t.arguments.length>0&&"Identifier"===e.type&&(!0===r&&iQ.has(e.name)||!1===r&&iZ.has(e.name)),i1=(e,t)=>!!i0(e.property,t,!0)||"MemberExpression"===e.object.type&&i1(e.object,t),i2=/^(?:[A-Z][\da-z]*)*Error$/,i3=e=>"UnaryExpression"===e.type&&"typeof"===e.operator,i8=(e,t)=>{switch(e.type){case"Identifier":return i0(e,t,!1);case"MemberExpression":return i1(e,t);case"CallExpression":return i8(e.callee,e);case"UnaryExpression":return"typeof"===e.operator||"!"===e.operator&&i8(e.argument);case"BinaryExpression":{let{operator:r,left:n,right:o}=e;if("instanceof"===r)return!("Identifier"===o.type?i2.test(o.name):"MemberExpression"===o.type&&!o.optional&&!o.computed&&"Identifier"===o.property.type&&i2.test(o.property.name));if((e=>{let{operator:t,left:r,right:n}=e;return("=="===t||"!="===t||"==="===t||"!=="===t)&&(i3(r)&&e0(n,"undefined")||i3(n)&&e0(r,"undefined"))})(e))return!1;return i8(n,t)||i8(o,t)}case"LogicalExpression":return i8(e.left,t)&&i8(e.right,t);default:return!1}},i6="consistentDestructuring",i9="consistentDestructuringSuggest",i5=new Set(["FunctionDeclaration","FunctionExpression","MethodDefinition","PropertyDefinition","AccessorProperty","StaticBlock","Program"]),i4=e=>{for(;e.parent;)if(e=e.parent,i5.has(e.type))return e},i7=e=>"Property"===e.type&&!e.computed&&"Identifier"===e.key.type,se=(e,t,r,n)=>{for(let o of e){if(o.key.name!==t)continue;let e=ei(n.getScope(o.value),o.value);if(e&&ei(r,o.value)===e)return o}},st=({declaration:e,memberExpressionNode:t,memberScope:r,memberRootIdentifier:n,memberRootVariable:o,memberThisScopeBoundary:a,memberExpressionWrites:i,sourceCode:s})=>{if(!((e,t,r)=>{let[,n]=r.getRange(e.object),[o]=r.getRange(t);return n<o})(e,t,s)||e.rootIdentifierName&&n?.name===e.rootIdentifierName&&o!==e.rootVariable||e.thisScopeBoundary&&a!==e.thisScopeBoundary||((e,t,r,n)=>{if(!e.rootVariable)return!1;let[,o]=n.getRange(e.object),[a]=n.getRange(t);return e.rootVariable.references.some(e=>{if(!e.isWrite())return!1;let[t]=n.getRange(e.identifier);return!(t<o)&&(e.from.variableScope!==r.variableScope||t<=a)})})(e,t,r,s)||(({declaration:e,memberExpressionNode:t,memberScope:r,memberExpressionWrites:n,sourceCode:o})=>{let[,a]=o.getRange(e.object),[i]=o.getRange(t),s=t.property.name,l=nA(t.object),u="Identifier"===l.type?l.name:void 0,p="Identifier"===l.type?ei(r,l):void 0,c="ThisExpression"===l.type?i4(l):void 0;return n.some(e=>e.propertyName===s&&e.rootIdentifierName===u&&e.rootVariable===p&&e.thisScopeBoundary===c&&(e.scope.variableScope!==r.variableScope||e.start>=a&&e.start<=i))})({declaration:e,memberExpressionNode:t,memberScope:r,memberExpressionWrites:i,sourceCode:s}))return!1;for(var l=r,u=e.scope;l;){if(l===u)return!0;l=l.upper}return!1},sr=(e,t,r)=>!!("BinaryExpression"===e.type&&"in"===e.operator&&e1(e.left))&&"Identifier"===t.property.type&&e.left.value===t.property.name&&r.getText(e.right)===r.getText(t.object)||"LogicalExpression"===e.type&&"&&"===e.operator&&(sr(e.left,t,r)||sr(e.right,t,r)),sn=(e,t,r,n)=>{switch(e.type){case"ConditionalExpression":case"IfStatement":return e.consequent===t&&sr(e.test,r,n);case"LogicalExpression":return"&&"===e.operator&&e.right===t&&sr(e.left,r,n);default:return!1}},so=e=>["AccessorProperty","FunctionDeclaration","MethodDefinition","PropertyDefinition"].includes(e.type),sa=["Object","Array","ArrayBuffer","DataView","Date","Error","Function","Map","WeakMap","Set","WeakSet","Promise","RegExp","SharedArrayBuffer","Proxy","WeakRef","FinalizationRegistry",...ra],si="error-date",ss="suggestion-date",sl=new ao({objects:["BigInt","Boolean","Number","String","Symbol"],type:ao.CONSTRUCT,handle:function(e,t){let{node:r,path:n}=e,[o]=n,a={node:r,messageId:"disallow",data:{name:o}};return"String"!==o&&"Boolean"!==o&&"Number"!==o&&(a.fix=e=>od(r,t,e)),a}}),su=new ao({objects:sa,type:ao.CALL,handle:function(e,t){let{node:r,path:n}=e,[o]=n;if("Object"===o){let{parent:e}=r;if("BinaryExpression"===e.type&&("==="===e.operator||"!=="===e.operator)&&(e.left===r||e.right===r))return}else if("Date"===o){function*a(e){yield e.replaceText(r,"String(new Date())"),yield of(e,r,t)}let e={node:r,messageId:si};return 0===t.sourceCode.getCommentsInside(r).length&&0===r.arguments.length?e.fix=a:e.suggest=[{messageId:ss,fix:a}],e}return{node:r,messageId:"enforce",data:{name:o},fix:e=>og(r,t,e)}}}),sp="error/array-push",sc="suggestion",sd=e=>tp(e,{property:"classList",computed:!1}),sm=e=>e.arguments.some(e=>"SpreadElement"===e.type),sf=[{description:"Array#push()",test:e=>tc(e,{method:"push",optionalCall:!1}),ignore:["stream.push","this.push","this.stream.push","process.stdin.push","process.stdout.push","process.stderr.push"]},{description:"Array#unshift()",test:e=>tc(e,{method:"unshift",optionalCall:!1}),keepSecondCall:!0,ignore:["stream.unshift","this.unshift","this.stream.unshift","process.stdin.unshift","process.stdout.unshift","process.stderr.unshift"]},{description:"Element#classList.add()",test:e=>tc(e,{method:"add",optionalCall:!1,optionalMember:!1})&&sd(e.callee.object)},{description:"Element#classList.remove()",test:e=>tc(e,{method:"remove",optionalCall:!1,optionalMember:!1})&&sd(e.callee.object)},{description:"importScripts()",test:e=>e7(e,{name:"importScripts"})}],sg={create:function(e){let{ignore:t}=e.options[0],{sourceCode:r}=e;e.on("CallExpression",function*(n){for(let{description:o,test:a,ignore:i=[],keepSecondCall:s=!1}of sf){if(!a(n))continue;let l=[...i,...t];if(tg(n.callee,l))continue;let u=function(e){let t=e.parent;return"ChainExpression"===t.type&&e===t.expression&&(t=t.parent),"ExpressionStatement"===t.type?t:void 0}(n);if(!u)continue;let p=nK(u,e);if(p?.type!=="ExpressionStatement")continue;let c=function(e){let{expression:t}=e;return"ChainExpression"===t.type?t.expression:t}(p);if(!a(c)||!tH(c.callee,n.callee))continue;let{shouldKeepSecondCall:d,shouldPrependSourceArguments:m,targetCall:f,sourceCall:g}=function(e,t,r){let n=r&&(!rr(t.callee)||rr(e.callee));return{shouldKeepSecondCall:n,shouldPrependSourceArguments:r&&!n,targetCall:n?t:e,sourceCall:n?e:t}}(c,n,s),y=g.arguments,h=r.getRange(p),x=r.getRange(u),b=d?[h[0],x[0]]:[h[1],x[1]],E=!d&&!ep(r.getLastToken(p))&&ep(r.getLastToken(u)),D=d&&nS(r.getTokenBefore(p),e,r.text.slice(x[0],x[0]+1)),S={node:"Identifier"===n.callee.type?n.callee:n.callee.property,messageId:sp,data:{description:o}},v=function*(t){if(y.length>0){let r=tJ(e,g,!m),{openingParenthesisToken:n,trailingCommaToken:o,closingParenthesisToken:a}=tG(f,e);m?yield t.insertTextAfter(n,f.arguments.length>0?`${r}, `:r):yield o?t.insertTextAfter(o,` ${r}`):t.insertTextBefore(a,f.arguments.length>0?`, ${r}`:r)}yield t.replaceTextRange(b,E||D?";":"")};!function(e,t){return e.getAllComments().some(r=>{let[n,o]=e.getRange(r);return n>=t[0]&&o<=t[1]})}(r,b)&&(function(e,t,r,n){let o=r?[...e.arguments,...t.arguments]:t.arguments;return r&&(sm(e)||sm(t))||r&&o.some(e=>null===ew(e,n.getScope(e)))||o.some(e=>eR(e,n))}(c,n,s,r)?S.suggest=[{messageId:sc,fix:v}]:S.fix=v),yield S}})},meta:{type:"suggestion",docs:{description:"Enforce combining multiple `Array#{push,unshift}()`, `Element#classList.{add,remove}()`, and `importScripts()` into one call.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,properties:{ignore:{type:"array",uniqueItems:!0,description:"Methods to ignore."}}}],defaultOptions:[{ignore:[]}],messages:{[sp]:"Do not call `{{description}}` multiple times.",[sc]:"Merge with previous one."},languages:["js/js"]}},sy="no-process-exit",sh=e=>e0(e,"node:worker_threads")||e0(e,"worker_threads"),sx="no-single-promise-in-promise-methods/error",sb="no-single-promise-in-promise-methods/unwrap",sE="no-single-promise-in-promise-methods/use-promise-resolve",sD=["all","any","race"],sS=(e,t)=>{let[r]=e.arguments[0].elements,n=eQ(r,t);return!eZ(r,t)&&["SequenceExpression","YieldExpression","ArrowFunctionExpression","ConditionalExpression","AssignmentExpression","LogicalExpression","BinaryExpression"].includes(r.type)&&(n=`(${n})`),n},sv=(e,t)=>e.getCommentsInside(t).length>0,sC=e=>"ArrayPattern"===e.type&&!e.typeAnnotation&&1===e.elements.length&&e.elements[0]?.type==="Identifier",sA="no-static-only-class",sT=({type:e,value:t})=>"Punctuator"===e&&"="===t,sw=e=>"PropertyDefinition"===e.type,sI="ignored-elements",sF="property-assignment",sj={create:e=>{let{sourceCode:t}=e,{maximumIgnoredElements:r}=e.options[0];e.on("ArrayPattern",n=>{let{elements:o,parent:a}=n;if(function(e){let t=0,r=0;for(let n of e)null===n?t=Math.max(t,++r):r=0;return t}(o)<=r)return;let i={node:n,messageId:sI},s=o.filter(e=>null!==e);if("VariableDeclarator"===a.type&&a.id===n&&null!==a.init&&1===s.length){let[r]=s;"AssignmentPattern"!==r.type&&(i.fix=function*(i){let s=o.indexOf(r),l="RestElement"===r.type,u=l?r.argument:r;yield i.replaceText(n,t.getText(u));let p=l?`.slice(${s})`:`[${s}]`,c=a.init;!eZ(c,e)&&nM(c,e)?(yield i.insertTextBefore(c,"("),yield i.insertTextAfter(a,`)${p}`)):yield i.insertTextAfter(a,p),yield of(i,n,e)})}return i}),e.on("MemberExpression",e=>{if(function e(t){let{parent:r}=t;if(r){if(nC(r)&&r.expression===t||"AssignmentPattern"===r.type&&r.left===t||"RestElement"===r.type&&r.argument===t)return e(r);if("Property"===r.type&&r.value===t&&"ObjectPattern"===r.parent.type)return r.parent;if("ObjectPattern"===r.type||"ArrayPattern"===r.type)return r}}(e)?.type==="ArrayPattern")return{node:e,messageId:sF}})},meta:{type:"suggestion",docs:{description:"Disallow unreadable array destructuring.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{maximumIgnoredElements:{type:"integer",minimum:0,description:"Maximum number of consecutive ignored elements allowed."}}}],defaultOptions:[{maximumIgnoredElements:1}],messages:{[sI]:"Array destructuring may not contain consecutive ignored values.",[sF]:"Do not assign destructured values to object properties."},languages:["js/js"]}},sk="spread-in-list",sB="iterable-to-array",sP="iterable-to-array-in-for-of",s$="iterable-to-array-in-yield-star",sR="spread-in-collection-constructor",sL="spread-in-object-assign",sN="clone-array",sM="suggestion/remove-object-assign-spread",sO=["Map","WeakMap","Set","WeakSet"],sq=["copyWithin","flat","slice","splice","toReversed","toSorted","toSpliced","with"],sU=[...sq,"filter","flatMap","map"],s_=e=>"ArrayExpression"===e.type&&1===e.elements.length&&e.elements[0]?.type==="SpreadElement",sW={ArrayExpression:"array literal",ObjectExpression:"object literal",CallExpression:"arguments",NewExpression:"arguments"};function*sV(e,t,r){let{sourceCode:n}=r,[o,a,i]=n.getFirstTokens(t,3);yield e.remove(o),yield e.remove(a);let[s,l]=n.getLastTokens(t,2);yield e.remove(l),eu(s)&&(yield e.remove(s));let{parent:u}=t;"ReturnStatement"!==u.type&&"ThrowStatement"!==u.type||u.argument!==t||nd(o,i,r)||eZ(t,r)?yield of(e,t,r):yield op(e,u,r)}let sz=(e,t)=>"CallExpression"===e.type&&"MemberExpression"===e.callee.type&&rk(e.callee.object,t),sK="no-useless-switch-case/error",sG="no-useless-switch-case/suggestion",sJ=e=>e.consequent.every(e=>tn(e)),sX=e=>th(e.test)||e9(e.test),sY=new Set(["CallExpression","MemberExpression"]),sH=e=>"MemberExpression"===(e=nA(e)).type?{...e,object:sH(e.object),property:e.computed?sH(e.property):e.property}:e,sQ=(e,t)=>tH(sH(e),sH(t)),sZ=e=>!!("ChainExpression"===e.type||sY.has(e.type)&&e.optional)||Object.entries(e).some(([e,t])=>"parent"!==e&&!!t&&(Array.isArray(t)?t.some(e=>e?.type&&sZ(e)):t.type&&sZ(t))),s0="no-useless-undefined",s1="no-useless-undefined/suggestion",s2=new Set(["is","equal","notEqual","strictEqual","notStrictEqual","propertyVal","notPropertyVal","not","include","property","toBe","toHaveBeenCalledWith","toContain","toContainEqual","toEqual","same","notSame","strictSame","strictNotSame"]),s3=e=>{for(;e;e=e.upper)if("function"===e.type)return e.block},s8={">=":{valid:!0,addend:0},">":{valid:!0,addend:-1},"<":{valid:!1,addend:0},"<=":{valid:!1,addend:-1}},s6={"<=":{valid:!0,addend:0},"<":{valid:!0,addend:-1},">":{valid:!1,addend:0},">=":{valid:!1,addend:-1}},s9={"<":{valid:!0,kind:"length"},"<=":{valid:!0,kind:"lengthMinusOne"},">=":{valid:!1,kind:"length"},">":{valid:!1,kind:"lengthMinusOne"}},s5={">":{valid:!0,kind:"length"},">=":{valid:!0,kind:"lengthMinusOne"},"<=":{valid:!1,kind:"length"},"<":{valid:!1,kind:"lengthMinusOne"}},s4=new Set(["<","<=",">",">="]);function s7(e){if(e8(e=nA(e)))return e.value;if("UnaryExpression"===e.type&&e.prefix&&("+"===e.operator||"-"===e.operator)){let t=s7(e.argument);if("number"==typeof t)return"-"===e.operator?-t:t}}function le(e,t,r,n){let o=e[t];if(o&&r===n+o.addend)return o.valid}function lt(e,t){return tp(e=nA(e),{property:"length",optional:!1,computed:!1})&&sQ(e.object,t)}function lr(e,t){return lt(e=nA(e),t)?"length":"BinaryExpression"===e.type&&"-"===e.operator&<(e.left,t)&&1===s7(e.right)?"lengthMinusOne":void 0}function ln(e,t,r){let n=e[t];if(n?.kind===r)return n.valid}let lo={create:e=>{let{sourceCode:t}=e,r=(e,r,n)=>{if(n){let r=s3(t.getScope(e));if(r?.returnType)return}return{node:e,messageId:s0,fix:r}},n=e.options[0];e.on("Identifier",o=>{if(!th(o))return;let{parent:a}=o;if("ReturnStatement"===a.type&&a.argument===o){let n=s3(t.getScope(o));if(n?.returnType&&n.returnType?.typeAnnotation?.type!=="TSUndefinedKeyword")return;return r(o,t=>ov(o,"",t,e))}if("YieldExpression"===a.type&&!a.delegate&&a.argument===o)return r(o,t=>ov(o,"",t,e));if(n.checkArrowFunctionBody&&"ArrowFunctionExpression"===a.type&&a.body===o)return r(o,t=>ov(o," {}",t,e),!0);if("VariableDeclarator"===a.type&&a.init===o&&"VariableDeclaration"===a.parent.type&&"const"!==a.parent.kind&&a.parent.declarations.includes(a)){let[,e]=t.getRange(a.id),[,n]=t.getRange(o);return r(o,t=>t.removeRange([e,n]),!0)}if("AssignmentPattern"===a.type&&a.right===o)return r(o,function*(r){let{left:n}=a,[,i]=t.getRange(n),[,s]=t.getRange(o);yield r.removeRange([i,s]),(n.typeAnnotation||t4(e.physicalFilename))&&!n.optional&&tl(a.parent)&&a.parent.params.includes(a)&&(yield n.typeAnnotation?r.insertTextBefore(n.typeAnnotation,"?"):r.insertTextAfter(n,"?"))},!0)}),e.on("ConditionalExpression",r=>{let n=th(r.consequent);if(n===th(r.alternate))return;let o=function(e,t){if(!(!tp(e=nA(e),{computed:!0,optional:!1})||sZ(e)||eR(e.object,t,{considerGetters:!0})||eR(e.property,t,{considerGetters:!0})))return{node:e,index:function(e){if("BinaryExpression"===(e=nA(e)).type&&"-"===e.operator){let t=s7(e.right);if(Number.isSafeInteger(t)&&t>0)return{node:e.left,offset:t}}return{node:e,offset:0}}(e.property)}}(n?r.alternate:r.consequent,t);if(!o||function(e,t){if(!("BinaryExpression"!==(e=nA(e)).type||!s4.has(e.operator)||sZ(e)))return function(e,t){let{operator:r,left:n,right:o}=e,a=s7(n),i=s7(o);return Number.isSafeInteger(i)&&sQ(n,t.node)?le(s8,r,i,t.offset):Number.isSafeInteger(a)&&sQ(o,t.node)?le(s6,r,a,t.offset):void 0}(e,t.index)??function(e,t){if(0!==t.index.offset)return;let{operator:r,left:n,right:o}=e,a=lr(o,t.node.object);if(a&&sQ(n,t.index.node))return ln(s9,r,a);let i=lr(n,t.node.object);if(i&&sQ(o,t.index.node))return ln(s5,r,i)}(e,t)}(r.test,o)!==!n)return;let a={node:n?r.consequent:r.alternate,messageId:s0};return 0===t.getCommentsInside(r).length&&(a.suggest=[{messageId:s1,fix(n){let a=t.getText(o.node),i=nS(t.getTokenBefore(r),e,a)?";":"";return n.replaceText(r,i+a)}}]),a}),!n.checkArguments||t4(e.physicalFilename)||e.on("CallExpression",t=>{var r;let n,o=t.arguments,a=o.at(-1);if(!(!th(a)||("Identifier"===(r=t.callee).type?n=r.name:"MemberExpression"===r.type&&!1===r.computed&&"Identifier"===r.property.type&&(n=r.property.name),s2.has(n)||"push"===n||"unshift"===n||"includes"===n||"add"===n||"has"===n||"delete"===n||"set"===n||"createContext"===n||/^set[A-Z]/v.test(n)||"useRef"===n||"ref"===n))&&(!(!t.optional&&"MemberExpression"===t.callee.type&&!t.callee.computed&&"Identifier"===t.callee.property.type&&"bind"===t.callee.property.name)||1===o.length))return{node:a,messageId:s0,fix:t=>ol(t,a,e)}})},meta:{type:"suggestion",docs:{description:"Disallow useless `undefined`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,properties:{checkArguments:{type:"boolean",description:"Whether to check function arguments."},checkArrowFunctionBody:{type:"boolean",description:"Whether to check arrow function bodies."}}}],defaultOptions:[{checkArguments:!0,checkArrowFunctionBody:!0}],messages:{[s0]:"Do not use useless `undefined`.",[s1]:"Use the indexed access directly."},languages:["js/js"]}},la="numeric-separators-style";function li(e,{minimumDigits:t,groupLength:r},n){let{length:o}=e;if(o<t)return e;let a=[];if(n)for(let t=0;t<o;t+=r){let n=Math.min(t+r,o);a.push(e.slice(t,n))}else for(let t=o;t>0;t-=r){let n=Math.max(t-r,0);a.unshift(e.slice(n,t))}return a.join("_")}let ls={binary:{minimumDigits:0,groupLength:4},octal:{minimumDigits:0,groupLength:4},hexadecimal:{minimumDigits:0,groupLength:2},number:{minimumDigits:5,groupLength:3,fractionGroupLength:1/0}},ll={create:e=>{let{onlyIfContainsSeparator:t,binary:r,octal:n,hexadecimal:o,number:a}=e.options[0],i={"0b":{onlyIfContainsSeparator:t,...r},"0o":{onlyIfContainsSeparator:t,...n},"0x":{onlyIfContainsSeparator:t,...o},"":{onlyIfContainsSeparator:t,...a}};e.on("Literal",e=>{let t,r;if(!(e8(e)||e5(e))||e8(e)&&/^0\d+$/.test(e.raw))return;let{raw:n}=e,o=n,a="";e5(e)&&(o=n.slice(0,-1),a="n");let s=o.replaceAll("_",""),{prefix:l,data:u}=(t="",r=s,/^0[box]/i.test(s)&&(t=s.slice(0,2),r=s.slice(2)),{prefix:t,data:r}),{onlyIfContainsSeparator:p}=i[l.toLowerCase()];if(p&&!n.includes("_"))return;let c=function(e,{prefix:t,data:r},n){let o=n[t.toLowerCase()];if(t)return t+li(r,o);let{number:a,mark:i,sign:s,power:l}=function(e){let{number:t,mark:r="",sign:n="",power:o=""}=e.match(/^(?<number>[\d._]*)(?:(?<mark>e)(?<sign>[+-])?(?<power>[\d_]+))?$/i).groups;return{number:t,mark:r,sign:n,power:o}}(e);return function(e,t){let{integer:r,dot:n,fractional:o}=function(e){let t=e.split("."),[r,n=""]=t;return{integer:r,dot:2===t.length?".":"",fractional:n}}(e);return li(r,t)+n+li(o,{...t,groupLength:t.fractionGroupLength},!0)}(a,o)+i+s+li(l,n[""])}(s,{prefix:l,data:u},i)+a;if(n!==c)return{node:e,messageId:la,fix:t=>t.replaceText(e,c)}})},meta:{type:"suggestion",docs:{description:"Enforce the style of numeric separators by correctly grouping digits.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{...Object.fromEntries(Object.keys(ls).map(e=>[e,(({withFraction:e=!1}={})=>({type:"object",additionalProperties:!1,properties:{onlyIfContainsSeparator:{type:"boolean",description:"Whether to only enforce the style if the number already contains a separator."},minimumDigits:{type:"integer",minimum:0,description:"The minimum number of digits before separators are enforced."},groupLength:{type:"integer",minimum:1,description:"The number of digits in each group."},...e&&{fractionGroupLength:{type:"integer",minimum:1,description:"The number of digits in each group after the decimal point. Defaults to no grouping."}}}}))({withFraction:"number"===e})])),onlyIfContainsSeparator:{type:"boolean",description:"Whether to only enforce the style if the number already contains a separator."}}}],defaultOptions:[{onlyIfContainsSeparator:!1,binary:ls.binary,octal:ls.octal,hexadecimal:ls.hexadecimal,number:ls.number}],messages:{[la]:"Invalid group length in numeric value."},languages:["js/js"]}},lu="error-zero-index",lp="error-shift",lc="error-pop",ld="error-at-zero",lm="error-at-minus-one",lf="error-destructuring-declaration",lg="error-destructuring-assignment",ly="error-variable",lh="suggest-nullish-coalescing-operator",lx="suggest-logical-or-operator",lb=(e,t,r)=>tc(e,{method:"filter",minimumArguments:1,maximumArguments:2,optionalCall:!1,...r})&&!rk(e.callee.object,t),lE=e=>e?"AssignmentExpression"===e.type?e:"VariableDeclarator"===e.type?{left:e.id,right:e.init}:{}:{};function*lD(e,t,r){let{left:n}=lE(e),[o]=n.elements,a=t.getText("AssignmentPattern"===o.type?o.left:o);yield r.replaceText(n,a),((e,t)=>{if("AssignmentExpression"!==e.type||eL(e,t))return!1;let{left:r}=lE(e),[n]=r.elements,{type:o}="AssignmentPattern"===n.type?n.left:n;return"ObjectExpression"===o||"ObjectPattern"===o})(e,t)&&(yield r.insertTextBefore(e,"("),yield r.insertTextAfter(e,")"))}let lS=e=>"AssignmentPattern"===lE(e).left.elements[0].type,lv=(e,t)=>{let r,n,{property:o}=lE(t).right.callee;return lS(t)?r=[{operator:"??",messageId:lh},{operator:"||",messageId:lx}].map(({messageId:r,operator:n})=>({messageId:r,*fix(r){yield r.replaceText(o,"find"),yield((e,t,r,n)=>{let{left:o,right:a}=lE(e),[i]=o.elements,s=i.right,l=t.getText(s);return(eL(s,t)||"LogicalExpression"===s.type&&(s.operator===n||"||"===n&&"??"===s.operator||"??"===n&&("||"===s.operator||"&&"===s.operator))||"ConditionalExpression"===s.type||"AssignmentExpression"===s.type||"YieldExpression"===s.type||"SequenceExpression"===s.type)&&(l=`(${l})`),r.insertTextAfter(a,` ${n} ${l}`)})(t,e,r,n),yield lD(t,e,r)}})):n=function*(r){yield r.replaceText(o,"find"),yield lD(t,e,r)},{fix:n,suggest:r}},lC=e=>"MemberExpression"===e.parent.type&&!0===e.parent.computed&&e.parent.object===e&&"Literal"===e.parent.property.type&&"0"===e.parent.property.raw,lA=e=>{let{left:t,right:r}=lE(e.parent);return t&&r&&r===e&&"ArrayPattern"===t.type&&1===t.elements.length&&t.elements[0]&&"RestElement"!==t.elements[0].type},lT={create:e=>{let{sourceCode:t}=e,{checkFromLast:r}=e.options[0];e.on("MemberExpression",t=>{if(t.computed&&"Literal"===t.property.type&&"0"===t.property.raw&&lb(t.object,e)&&!rq(t))return{node:t.object.callee.property,messageId:lu,fix:r=>[r.replaceText(t.object.callee.property,"find"),oh(r,t,e)]}}),e.on("CallExpression",t=>{if(tc(t,{method:"shift",argumentsLength:0,optionalCall:!1,optionalMember:!1})&&lb(t.callee.object,e))return{node:t.callee.object.callee.property,messageId:lp,fix:r=>[r.replaceText(t.callee.object.callee.property,"find"),...ox(r,t,e)]}}),e.on("VariableDeclarator",r=>{if("ArrayPattern"===r.id.type&&1===r.id.elements.length&&r.id.elements[0]&&"RestElement"!==r.id.elements[0].type&&lb(r.init,e,{optionalMember:!1}))return{node:r.init.callee.property,messageId:lf,...lv(t,r)}}),e.on("AssignmentExpression",r=>{if("ArrayPattern"===r.left.type&&1===r.left.elements.length&&r.left.elements[0]&&"RestElement"!==r.left.elements[0].type&&lb(r.right,e,{optionalMember:!1}))return{node:r.right.callee.property,messageId:lg,...lv(t,r)}}),e.on("VariableDeclarator",r=>{if(!("Identifier"===r.id.type&&lb(r.init,e,{optionalMember:!1})&&"VariableDeclaration"===r.parent.type&&r.parent.declarations.includes(r)&&("ExportNamedDeclaration"!==r.parent.parent.type||r.parent.parent.declaration!==r.parent)))return;let n=t.getScope(r),o=ei(n,r.id),a=rt(o).filter(e=>e!==r.id);if(0===a.length)return;let i=[],s=[];for(let e of a)if(lC(e))i.push(e.parent);else{if(!lA(e))return;s.push(e.parent)}let l={node:r.init.callee.property,messageId:ly};return s.every(e=>!lS(e))&&(l.fix=function*(a){yield a.replaceText(r.init.callee.property,"find");let l=(e=>{let t=nW.singular(e);if(t!==e)return t})(r.id.name);if(l){let r=tz(l,tL(n));yield oD(o,r,e,a),yield function*(e,t){yield e.insertTextBeforeRange(t,""),yield e.insertTextAfterRange(t,"")}(a,t.getRange(t.ast))}for(let t of i)yield oh(a,t,e);for(let e of s)yield lD(e,t,a)}),l}),e.on("CallExpression",t=>{if(tc(t,{method:"at",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&"Literal"===t.arguments[0].type&&"0"===t.arguments[0].raw&&lb(t.callee.object,e))return{node:t.callee.object.callee.property,messageId:ld,fix:r=>[r.replaceText(t.callee.object.callee.property,"find"),...ox(r,t,e)]}}),r&&(e.on("CallExpression",t=>{if(tc(t,{method:"pop",argumentsLength:0,optionalCall:!1,optionalMember:!1})&&lb(t.callee.object,e))return{node:t.callee.object.callee.property,messageId:lc,fix:r=>[r.replaceText(t.callee.object.callee.property,"findLast"),...ox(r,t,e)]}}),e.on("CallExpression",t=>{if(tc(t,{method:"at",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&"UnaryExpression"===t.arguments[0].type&&"-"===t.arguments[0].operator&&t.arguments[0].prefix&&"Literal"===t.arguments[0].argument.type&&"1"===t.arguments[0].argument.raw&&lb(t.callee.object,e))return{node:t.callee.object.callee.property,messageId:lm,fix:r=>[r.replaceText(t.callee.object.callee.property,"findLast"),...ox(r,t,e)]}}))},meta:{type:"suggestion",docs:{description:"Prefer `.find(…)` and `.findLast(…)` over the first or last element from `.filter(…)`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,properties:{checkFromLast:{type:"boolean",description:"Whether to also check for patterns that can be replaced with `findLast()`."}}}],defaultOptions:[{checkFromLast:!0}],messages:{[ly]:"Prefer `.find(…)` over `.filter(…)`.",[lu]:"Prefer `.find(…)` over `.filter(…)[0]`.",[ld]:"Prefer `.find(…)` over `.filter(…).at(0)`.",[lp]:"Prefer `.find(…)` over `.filter(…).shift()`.",[lc]:"Prefer `.findLast(…)` over `.filter(…).pop()`.",[lm]:"Prefer `.findLast(…)` over `.filter(…).at(-1)`.",[lf]:"Prefer `.find(…)` over destructuring `.filter(…)`.",[lg]:"Prefer `.find(…)` over destructuring `.filter(…)`.",[lh]:"Replace `.filter(…)` with `.find(…) ?? …`.",[lx]:"Replace `.filter(…)` with `.find(…) || …`."},languages:["js/js"]}},lw="prefer-array-flat-map",lI="prefer-array-flat-map/filter-flat-map",lF="prefer-array-flat-map/filter-flat-map-suggestion",lj=["React.Children","Children"],lk=new Set(["ArrowFunctionExpression","AssignmentExpression","ClassExpression","ConditionalExpression","FunctionExpression","ObjectExpression","SequenceExpression","TSAsExpression","TSNonNullExpression","TSSatisfiesExpression","TSTypeAssertion","YieldExpression"]),lB=e=>"ArrowFunctionExpression"===e.type&&!e.async&&!e.returnType&&!e.typeParameters&&1===e.params.length&&"Identifier"===e.params[0].type&&!e.params[0].optional&&!e.params[0].typeAnnotation&&"BlockStatement"!==e.body.type,lP="prefer-array-flat",l$={getArrayNode:e=>e.callee.object,isOptionalArray:e=>e.callee.optional,description:"Array#flatMap()",testFunction(e,t){if(!tc(e,{method:"flatMap",argumentsLength:1,optionalCall:!1}))return!1;let[r]=e.arguments;return"ArrowFunctionExpression"===r.type&&!r.async&&1===r.params.length&&nm(r.params[0],r.body)&&!lU(e.callee.object,t)}},lR={testFunction(e){if(!tc(e,{method:"reduce",argumentsLength:2,optionalCall:!1}))return!1;let[t,r]=e.arguments;if(!("ArrowFunctionExpression"===t.type&&!t.async&&2===t.params.length&&to(r)))return!1;let n=t.body,[o,a]=t.params;return tc(n,{method:"concat",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&nm(o,n.callee.object)&&nm(a,n.arguments[0])||"ArrayExpression"===n.type&&2===n.elements.length&&n.elements.every((e,r)=>e?.type==="SpreadElement"&&"Identifier"===e.argument.type&&nm(t.params[r],e.argument))},getArrayNode:e=>e.callee.object,isOptionalArray:e=>e.callee.optional,description:"Array#reduce()"},lL={testFunction:e=>tc(e,{method:"concat",argumentsLength:1,allowSpreadElement:!0,optionalCall:!1,optionalMember:!1})&&to(e.callee.object)&&"SpreadElement"===e.arguments[0].type,getArrayNode:e=>e.arguments[0].argument,description:"[].concat()"},lN={testFunction(e){if(!(tc(e,{methods:["apply","call"],argumentsLength:2,allowSpreadElement:!0,optionalCall:!1,optionalMember:!1})&&tx(e.callee.object,{property:"concat"})))return!1;let[t,r]=e.arguments;return to(t)&&("apply"===e.callee.property.name&&"SpreadElement"!==r.type||"call"===e.callee.property.name&&"SpreadElement"===r.type)},getArrayNode(e){let t=e.arguments[1];return"SpreadElement"===t.type?t.argument:t},description:"Array.prototype.concat()"},lM=["_.flatten","lodash.flatten","underscore.flatten"],lO=/^\p{Uppercase_Letter}/u,lq=(e,t)=>{if("Identifier"!==e.type)return;let r=ei(t.sourceCode.getScope(e),e);if(!r||1!==r.defs.length)return;let[n]=r.defs;if("Variable"===n.type&&"VariableDeclarator"===n.node.type&&"VariableDeclaration"===n.parent.type&&"const"===n.parent.kind)return n.node.init},lU=(e,t)=>{let r,n;return"Identifier"===e.type&&lO.test(e.name)&&(!(r=lq(e,t))||"ArrayExpression"!==r.type&&("NewExpression"!==r.type||"Identifier"!==r.callee.type||"Array"!==r.callee.name))||!!((n=lq(e,t))&&("ObjectExpression"===n.type||"Literal"===n.type||"TemplateLiteral"===n.type||"ArrowFunctionExpression"===n.type||"FunctionExpression"===n.type||"ClassExpression"===n.type||"NewExpression"===n.type&&"Identifier"===n.callee.type&&"Array"!==n.callee.name))},l_={create:function(e){let{functions:t}=e.options[0],r=[...t,...lM],n=[l$,lR,lL,lN,{testFunction:e=>e7(e,{argumentsLength:1,optional:!1})&&tg(e.callee,r),getArrayNode:e=>e.arguments[0],description:e=>`${r.find(t=>tf(e.callee,t)).trim()}()`}];e.on("CallExpression",function*(t){for(let{testFunction:r,description:o,getArrayNode:a,shouldSwitchToArray:i,isOptionalArray:s}of n){if(!r(t,e))continue;let n=a(t),l=s?.(t),u={description:"string"==typeof o?o:o(t)},p={node:t,messageId:lP,data:u},{sourceCode:c}=e;c.getCommentsInside(t).length===c.getCommentsInside(n).length&&(p.fix=function(e,t,r,n,o){return"function"==typeof n&&(n=n(e)),function*(a){let{sourceCode:i}=r,s=eQ(t,r);n?s=`[${s}]`:!eZ(t,i)&&nM(t,r)&&(s=`(${s})`),s+=`${o?"?":""}.flat()`,nS(i.getTokenBefore(e),r,s)&&(s=`;${s}`),yield a.replaceText(e,s),yield of(a,e,r)}}(t,n,e,i,l)),yield p}})},meta:{type:"suggestion",docs:{description:"Prefer `Array#flat()` over legacy techniques to flatten arrays.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{functions:{type:"array",uniqueItems:!0,description:"Additional functions to check."}}}],defaultOptions:[{functions:[]}],messages:{[lP]:"Prefer `Array#flat()` over `{{description}}` to flatten an array."},languages:["js/js"]}},lW="some",lV="some-suggestion",lz="filter",lK={create:nR(e=>{e.on("CallExpression",t=>{if(!tc(t,{methods:["find","findLast"],minimumArguments:1,maximumArguments:2,optionalCall:!1,optionalMember:!1})||t.typeArguments||t.typeParameters||rk(t.callee.object,e))return;let r="BinaryExpression"===t.parent.type&&t.parent.left===t&&(["!=","==","===","!=="].includes(t.parent.operator)&&th(t.parent.right)||("!="===t.parent.operator||"=="===t.parent.operator)&&e9(t.parent.right));if(!r&&!(tC(t,e)||tA(t)||function(e,t){if(!rj(e.callee.object,t))return!1;let r=e.parent;if("VariableDeclarator"!==r.type||r.init!==e||"Identifier"!==r.id.type||r.id.typeAnnotation||"VariableDeclaration"!==r.parent.type||"const"!==r.parent.kind||"ExportNamedDeclaration"===r.parent.parent.type&&r.parent.parent.declaration===r.parent)return!1;let[n]=t.sourceCode.getDeclaredVariables(r);if(!n||1!==n.identifiers.length||n.identifiers[0]!==r.id)return!1;let o=n.references.filter(e=>!e.init);return 0!==o.length&&o.every(e=>{let{identifier:r}=e;return e.isRead()&&(tC(r,t)||tA(r))})}(t,e)))return;let n=t.callee.property;return{node:n,messageId:lW,data:{method:n.name},suggest:[{messageId:lV,*fix(o){if(yield o.replaceText(n,"some"),!r)return;let{sourceCode:a}=e,i=eH(t,e);yield o.removeRange([i[1],a.getRange(t.parent)[1]]),"!="!==t.parent.operator&&"!=="!==t.parent.operator&&(yield o.insertTextBeforeRange(i,"!"))}}]}}),e.on("BinaryExpression",t=>{let{left:r,right:n,operator:o}=t;if(!(tc(r,{methods:["findIndex","findLastIndex"],argumentsLength:1,optionalCall:!1,optionalMember:!1})&&(["!==","!=",">","===","=="].includes(o)&&"UnaryExpression"===n.type&&"-"===n.operator&&n.argument&&"Literal"===n.argument.type&&1===n.argument.value||[">=","<"].includes(o)&&e0(n,0)))||rk(r.callee.object,e))return;let a=r.callee.property;return{node:a,messageId:lW,data:{method:a.name},*fix(n){["===","==","<"].includes(o)&&(yield n.insertTextBefore(t,"!")),yield n.replaceText(a,"some");let{sourceCode:i}=e,s=i.getTokenAfter(r,e=>"Punctuator"===e.type&&e.value===o),[l]=i.getRange(s),[,u]=i.getRange(t);yield n.removeRange([l,u])}}}),e.on("BinaryExpression",t=>{if(!((">"===t.operator||"!=="===t.operator)&&"Literal"===t.right.type&&"0"===t.right.raw&&tp(t.left,{property:"length",optional:!1})&&tc(t.left.object,{method:"filter",optionalCall:!1,optionalMember:!1})))return;let r=t.left.object,n=r.callee.object;if(rk(n,e)||"Identifier"===n.type&&n.name.startsWith("$"))return;let[o]=r.arguments;if(!o||np(o))return;let a=r.callee.property;return{node:a,messageId:lz,*fix(r){yield r.replaceText(a,"some");let{sourceCode:n}=e,o=t.left;yield oh(r,o,e),yield r.removeRange([eH(o,e)[1],n.getRange(t)[1]])}}})}),meta:{type:"suggestion",docs:{description:"Prefer `.some(…)` over `.filter(…).length` check and `.{find,findLast,findIndex,findLastIndex}(…)`.",recommended:"unopinionated"},fixable:"code",messages:{[lW]:"Prefer `.some(…)` over `.{{method}}(…)`.",[lV]:"Replace `.{{method}}(…)` with `.some(…)`.",[lz]:"Prefer `.some(…)` over non-zero length check from `.filter(…)`."},hasSuggestions:!0,languages:["js/js"]}},lG=(e,t)=>({node:e,messageId:`error/${e.name}`,suggest:[{messageId:`suggestion/${t}`,fix:r=>r.replaceText(e,t)}]}),lJ="preferDefaultParameters",lX="preferDefaultParametersSuggest",lY=(e,t)=>{if(!t)return!1;if("CallExpression"===t.type)return!0;for(let r of e.visitorKeys[t.type]){let n=t[r];if(Array.isArray(n)){for(let t of n)if(lY(e,t))return!0}else if(lY(e,n))return!0}return!1},lH="prefer-logical-operator-over-ternary/error",lQ="prefer-logical-operator-over-ternary/optional-chain-error",lZ="prefer-logical-operator-over-ternary/suggestion",l0="prefer-logical-operator-over-ternary/optional-chain-suggestion",l1=new Set(["==","==="]),l2=new Set(["!=","!=="]);function l3(e,t,r){if(tH(e,t))return!0;if(e.type!==t.type)return!1;switch(e.type){case"AwaitExpression":return l3(e.argument,t.argument,r);case"LogicalExpression":return e.operator===t.operator&&l3(e.left,t.left,r)&&l3(e.right,t.right,r);case"UnaryExpression":return e.operator===t.operator&&e.prefix===t.prefix&&l3(e.argument,t.argument,r);case"UpdateExpression":return!1}return r.getText(e)===r.getText(t)}function l8({context:e,conditionalExpression:t,left:r,right:n,operators:o=["??","||"]}){return{node:t,messageId:lH,suggest:o.map(o=>({messageId:lZ,data:{operator:o},fix:a=>(function({fixer:e,context:t,conditionalExpression:r,left:n,right:o,operator:a}){let{sourceCode:i}=t,s=[n,o].map((e,r)=>{let n=eZ(e,t),o=n?eQ(e,t):i.getText(e);return!n&&nq(e,{operator:a,property:0===r?"left":"right"})&&(o=`(${o})`),o}).join(` ${a} `);return nS(i.getTokenBefore(r),t,s)&&(s=`;${s}`),e.replaceText(r,s)})({fixer:a,context:e,conditionalExpression:t,left:r,right:n,operator:o})}))}}function l6(e){return e9(e)?"null":th(e)?"undefined":void 0}function l9(e){if("BinaryExpression"!==e.type||!l1.has(e.operator)&&!l2.has(e.operator))return;let t=l6(e.left),r=l6(e.right);if(!!t==!!r)return;let n=l1.has(e.operator);return{reference:t?e.right:e.left,kind:2===e.operator.length?"nullish":t??r,isTrueWhenNullish:n}}let l5=(e,t)=>"null"===e.kind&&"undefined"===t.kind||"undefined"===e.kind&&"null"===t.kind,l4="with-name",l7="without-name",ue="regexp-exec",ut="string-match",ur="string-search",un="suggestion",uo="string",ua="regexp",ui="other",us="string-or-other",ul="regexp-or-other",uu="unknown";function*up(e,{stringNode:t,methodNode:r,regexpNode:n},o){let{sourceCode:a}=o;yield e.replaceText(r,"test");let i=a.getText(t);eL(n,a)||"SequenceExpression"!==t.type||(i=`(${i})`),yield e.replaceText(n,i);let s=a.getText(n);!eL(t,a)&&nM(n,o)&&(s=`(${s})`),yield e.replaceText(t,s)}let uc=[{type:ue,test:e=>tc(e,{method:"exec",argumentsLength:1,optionalCall:!1,optionalMember:!1}),getNodes:e=>({stringNode:e.arguments[0],methodNode:e.callee.property,regexpNode:e.callee.object}),*fix(e,{methodNode:t}){yield e.replaceText(t,"test")}},{type:ut,test:e=>tc(e,{method:"match",argumentsLength:1,optionalCall:!1,optionalMember:!1}),getNodes:e=>({stringNode:e.callee.object,methodNode:e.callee.property,regexpNode:e.arguments[0]}),fix:up},{type:ur,test:e=>tc(e,{method:"search",argumentsLength:1,optionalCall:!1,optionalMember:!1}),getNodes:e=>({stringNode:e.callee.object,methodNode:e.callee.property,regexpNode:e.arguments[0]}),fix:up}],ud=e=>e6(e)||te(e,{name:"RegExp"}),um=e=>{if("[object RegExp]"===Object.prototype.toString.call(e))return e},uf=e=>{if(e.includes(uu))return uu;let t=new Set(e),r=t.has(uo)||t.has(us),n=t.has(ua)||t.has(ul);if(r&&n)return us;let o=t.has(ui)||t.has(us)||t.has(ul);return r?o?us:uo:n?o?ul:ua:ui},ug=e=>{let t=new Set(e);return t.has(uu)?uu:t.has(ua)?ua:t.has(uo)?uo:ui},uy=new Set(["TSBigIntKeyword","TSBooleanKeyword","TSNeverKeyword","TSNullKeyword","TSNumberKeyword","TSObjectKeyword","TSSymbolKeyword","TSUndefinedKeyword","TSVoidKeyword","TSArrayType","TSTypeLiteral","TSTupleType","TSFunctionType","TSConstructorType"]),uh=e=>{switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return uh(e.typeAnnotation);case"TSStringKeyword":return uo;case"TSLiteralType":return"Literal"===e.literal.type&&"string"==typeof e.literal.value?uo:ui;case"TSTypeReference":if("Identifier"!==e.typeName.type)return uu;if("String"===e.typeName.name)return uo;if("RegExp"===e.typeName.name)return ua;if("Array"===e.typeName.name||"ReadonlyArray"===e.typeName.name)return ui;return uu;case"TSUnionType":return uf(e.types.map(e=>uh(e)));case"TSIntersectionType":return ug(e.types.map(e=>uh(e)));default:return uy.has(e?.type)?ui:uu}},ux=(e,t)=>{let r,n;if(r=e,ri.has(r.intrinsicName)||(n=e=t.getNonNullableType(e),ri.has(n.intrinsicName)))return uu;if(e.isTypeParameter?.()){let r=e.getConstraint();return r?ux(r,t):uu}return e.isUnion()?uf(e.types.map(e=>ux(e,t))):e.isIntersection()?ug(e.types.map(e=>ux(e,t))):"string"===e.intrinsicName||e.isStringLiteral?.()?uo:"RegExp"===rl(e)?.getName()||rp(e,t).some(e=>ux(e,t)===ua)?ua:ui},ub=new Set(["ArrayExpression","ArrowFunctionExpression","ClassExpression","FunctionExpression","ObjectExpression"]);function uE(e,t,r=new Set){let n;if(ud(e))return ua;if(na(e,t))return uo;switch(e.type){case"Identifier":{let n=((e,t,r)=>{let{sourceCode:n}=t,o=ei(n.getScope(e),e);if(!o||r.has(o)||1!==o.defs.length)return uu;r.add(o);let[a]=o.defs,i=uh(a.name?.typeAnnotation),s=uu;return i!==uu?s=i:"Variable"===a.type&&"const"===a.parent.kind&&a.node.init&&(s=uE(a.node.init,t,r)),r.delete(o),s})(e,t,r);if(n!==uu)return n;break}case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":{let n=uh(e.typeAnnotation);return n===uu?uE(e.expression,t,r):n}case"TSNonNullExpression":case"ParenthesizedExpression":return uE(e.expression,t,r);case"SequenceExpression":return uE(e.expressions.at(-1),t,r);case"ConditionalExpression":return uf([uE(e.consequent,t,r),uE(e.alternate,t,r)])}let o=t.sourceCode.getScope(e),a=(n=ew(e,o))?"string"==typeof n.value?uo:um(n.value)?ua:void 0===n.value&&("Identifier"===e.type&&"undefined"===e.name||"UnaryExpression"===e.type&&"void"===e.operator)||null===n.value||["bigint","boolean","number","symbol"].includes(typeof n.value)?ui:uu:uu;return a!==uu?a:ub.has(e.type)?ui:((e,t)=>{let{parserServices:r}=t.sourceCode;if(!r?.program)return uu;try{let{program:t}=r;return ux(r.getTypeAtLocation(e),t.getTypeChecker())}catch{return uu}})(e,t)}let uD=(e,t)=>{let r;return"UnaryExpression"===(r=((e,t)=>{for(;;){if(tb(e.parent)||tv(e.parent,t)&&e.parent.arguments[0]===e){e=e.parent;continue}break}return e})(e,t)).parent.type&&"!"===r.parent.operator&&r.parent.argument===r},uS=(e,[t,r])=>e.getAllComments().some(n=>{let[o,a]=e.getRange(n);return o>=t&&a<=r}),uv=(e,t,r)=>[eH(t,r)[1],r.sourceCode.getRange(e.node)[1]],uC=e=>[{messageId:un,fix:e}],uA=e=>[ua,ul,ui].includes(e),uT=e=>[uo,us,ui].includes(e),uw=({type:e,stringType:t,regexpType:r})=>e===ue?uT(r)||uA(t):uA(t)||uT(r),uI=(e,t,r,{lengthCheck:n,searchCheck:o,callExpression:a,isRegExp:i,staticRegExp:s})=>{if(n){((e,t)=>{let{sourceCode:r}=t,n=[[eH(e.lengthNode.object,t)[1],r.getRange(e.lengthNode)[1]]];return e.comparisonLeftNode&&n.push([eH(e.comparisonLeftNode,t)[1],r.getRange(e.node)[1]]),n})(n,r).every(e=>!uS(r.sourceCode,e))&&(e.suggest=uC(t));return}if(!o||!uS(r.sourceCode,uv(o,a,r))){if((({searchCheck:e,isRegExp:t,staticRegExp:r})=>t||r?.global===!1&&(!e||!1===r.sticky))({searchCheck:o,isRegExp:i,staticRegExp:s})){e.fix=t;return}e.suggest=uC(t)}},uF={create:nR(e=>{e.on("CallExpression",function*(t){let r=((e,t)=>{let r,n="ChainExpression"===(r=e.parent).type?r.expression:r;if(!tp(n,{property:"length"})||n.object!==e)return;let o="ChainExpression"===n.parent.type?n.parent:n;if(uD(o,t))return;if(tC(o,t)||tA(o))return{lengthNode:n,node:o};let{parent:a}=o;if(a?.type==="BinaryExpression"&&a.left===o&&">"===a.operator&&e0(a.right,0)&&!uD(a,t)&&(tC(a,t)||tA(a)))return{lengthNode:n,node:a,comparisonLeftNode:o}})(t,e),n=(e=>{let{parent:t}=e;if(t?.type!=="BinaryExpression"||t.left!==e)return;let{operator:r,right:n}=t;return["!==","!=",">"].includes(r)&&td(n)||">="===r&&e0(n,0)?{node:t,negate:!1}:["===","=="].includes(r)&&td(n)||"<"===r&&e0(n,0)?{node:t,negate:!0}:void 0})(t);if(r||n||tC(t,e)||tA(t))for(let{type:o,test:a,getNodes:i,fix:s}of uc){if(o===ur!=!!n||!a(t))continue;let l=i(t),{methodNode:u,regexpNode:p}=l,c=e.sourceCode.getScope(p),d=ew(p,c),m=d?um(d.value):void 0,f=ud(p);if(uw({type:o,stringType:uE(l.stringNode,e),regexpType:uE(p,e)}))continue;let g={node:o===ue?u:t,messageId:o};uI(g,function*(o){for(let a of(r?(yield oh(o,r.lengthNode,e),r.comparisonLeftNode&&(yield o.removeRange([eH(r.comparisonLeftNode,e)[1],e.sourceCode.getRange(r.node)[1]]))):n&&(n.negate&&(yield o.insertTextBefore(n.node,"!")),yield o.removeRange(uv(n,t,e))),s(o,l,e)))yield a},e,{lengthCheck:r,searchCheck:n,callExpression:t,isRegExp:f,staticRegExp:m}),yield g}})}),meta:{type:"suggestion",docs:{description:"Prefer `RegExp#test()` over `String#match()`, `String#search()`, and `RegExp#exec()`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[ue]:"Prefer `.test(…)` over `.exec(…)`.",[ut]:"Prefer `RegExp#test(…)` over `String#match(…)`.",[ur]:"Prefer `RegExp#test(…)` over `String#search(…)` when checking for existence.",[un]:"Switch to `RegExp#test(…)`."},languages:["js/js"]}},uj="error",uk="suggestion",uB=0x100000000-1,uP=["copyWithin","fill","filter","flat","flatMap","map","reverse","sort","splice","toReversed","toSorted","toSpliced","with","split","toArray"],u$=["slice","concat"],uR=e=>tc(e.parent.parent,{method:"includes",optionalCall:!1,optionalMember:!1,argumentsLength:1})&&e.parent.object===e,uL=new Set(["ForOfStatement","ForStatement","ForInStatement","WhileStatement","DoWhileStatement","FunctionDeclaration","FunctionExpression","ArrowFunctionExpression"]),uN=(e,t,r=new Set)=>"ArrayExpression"===e.type||tt(e,{name:"Array",optional:!1})||tc(e,{object:"Array",methods:["from","of"],optionalCall:!1,optionalMember:!1})||tc(e,{methods:uP,optionalCall:!1,optionalMember:!1})||tc(e,{methods:u$,optionalCall:!1,optionalMember:!1})&&void 0===e3(e.callee.object)&&("Identifier"!==e.callee.object.type||((e,t,r=new Set)=>{if("Identifier"!==e.type)return!1;let n=ei(t,e);if(!n||r.has(n)||1!==n.defs.length)return!1;r.add(n);let[o]=n.defs;return"Variable"===o.type&&"const"===o.kind&&!!o.node.init&&uN(o.node.init,t,r)})(e.callee.object,t,r)),uM=e=>Number.isSafeInteger(e)&&e>=0&&e<=uB,uO=e=>e.some(e=>e?.type==="SpreadElement"),uq=(e,t,r)=>e.getCommentsInside(t).some(t=>{let n,o;return n=e.getRange(t),o=e.getRange(r),!(n[0]>=o[0])||!(n[1]<=o[1])}),uU=(e,t)=>(e?.type==="TSAsExpression"||e?.type==="TSTypeAssertion"||e?.type==="TSNonNullExpression")&&e.expression===t,u_=e=>{let{parent:t}=e;if(!("MemberExpression"===t.type&&t.object===e&&!t.computed&&!t.optional&&"Identifier"===t.property.type&&"length"===t.property.name)||(e=>{let t,r=e;for(;uU(r.parent,r);)r=r.parent;return rq(r)||("ForInStatement"===(t=r).parent.type||"ForOfStatement"===t.parent.type)&&t.parent.left===t})(t))return!1;let r=t.parent;return"CallExpression"!==r.type||r.callee!==t},uW=e=>{let t,r;return"ForOfStatement"===e.parent.type&&e.parent.right===e||(e=>{let{parent:t}=e;return"SpreadElement"===t.type&&t.argument===e&&["ArrayExpression","CallExpression","NewExpression"].includes(t.parent.type)})(e)||tc(t=e.parent.parent,{method:"forEach",optionalCall:!1,optionalMember:!1,argumentsLength:1})&&e.parent.object===e&&"ArrowFunctionExpression"===(r=t.arguments[0]).type&&1===r.params.length&&"RestElement"!==r.params[0].type},uV={create:e=>{let{minimumItems:t}=e.options[0],{sourceCode:r}=e;e.on("Identifier",n=>{let o,{parent:a}=n;if(!((e,t)=>{let{parent:r}=e;return"VariableDeclarator"===r.type&&r.id===e&&!!r.init&&"VariableDeclaration"===r.parent.type&&("ExportNamedDeclaration"!==r.parent.parent.type||r.parent.parent.declaration!==r.parent)&&uN(r.init,t.getScope(r.init))})(n,r))return;if(t>0){var i,s;let e=(i=a.init,s=r.getScope(a.init),"ArrayExpression"===i.type?uO(i.elements)?void 0:i.elements.length:tt(i,{name:"Array",optional:!1})?((e,t)=>{if(uO(e.arguments))return;if(1!==e.arguments.length)return e.arguments.length;let r=ew(e.arguments[0],t);if(!r)return;let{value:n}=r;return"number"!=typeof n?1:uM(n)?n:void 0})(i,s):tc(i,{object:"Array",method:"of",optionalCall:!1,optionalMember:!1})?uO(i.arguments)?void 0:i.arguments.length:tc(i,{object:"Array",method:"from",optionalCall:!1,optionalMember:!1})?((e,t)=>{let[r]=e.arguments;if(r&&"SpreadElement"!==r.type){if("ArrayExpression"===r.type)return uO(r.elements)?void 0:r.elements.length;if(void 0!==e3(r)){let e=ew(r,t);return"string"==typeof e?.value?[...e.value].length:void 0}return((e,t)=>{if("ObjectExpression"!==e.type||1!==e.properties.length)return;let[r]=e.properties;if((e=>{if("Property"!==e.type||e.computed)return!1;let{key:t}=e;return"Identifier"===t.type&&"length"===t.name||"Literal"===t.type&&"length"===t.value})(r)){let e=ew(r.value,t);return uM(e?.value)?e.value:void 0}})(r,t)}})(i,s):void 0);if(void 0===e||e<t)return}let l=ei(r.getScope(n),n);if(!l)return;let u=(e=>{let t=[],r=[],n=[];for(let o of e){if(uR(o)){t.push(o);continue}if(u_(o)){r.push(o),n.push(o);continue}if(uW(o)){n.push(o);continue}return}return{includes:t,lengths:r,extra:n}})(rt(l).filter(e=>e!==n));if(!u||0===u.includes.length||u.extra.length>0&&(o=a.init,!("ArrayExpression"===o.type&&!uO(o.elements)&&o.elements.every(Boolean)&&o.elements.every(t=>{let r;return(r=ew(t,e.sourceCode.getScope(t)))&&tQ(r.value)&&!Object.is(r.value,-0)}))||0!==t1(o.elements,e).length)||1===u.includes.length&&!((e,t)=>{let r=t.parent.parent.parent,{parent:n}=e.parent;for(;n&&n!==r;){if(uL.has(n.type))return!0;n=n.parent}return!1})(u.includes[0],n))return;let p={node:n,messageId:uj,data:{name:n.name}},c=n.typeAnnotation&&((e,t)=>{if("TSArrayType"===e.type){if(uq(t,e,e.elementType))return;return`Set<${t.getText(e.elementType)}>`}if("TSTypeOperator"===e.type&&"readonly"===e.operator&&"TSArrayType"===e.typeAnnotation.type){if(uq(t,e,e.typeAnnotation.elementType))return;return`ReadonlySet<${t.getText(e.typeAnnotation.elementType)}>`}if("TSTypeReference"!==e.type||"Identifier"!==e.typeName.type)return;let r=e.typeArguments??e.typeParameters;if(r?.params.length===1&&!uq(t,e,r)){if("Array"===e.typeName.name)return`Set${t.getText(r)}`;if("ReadonlyArray"===e.typeName.name)return`ReadonlySet${t.getText(r)}`}})(n.typeAnnotation.typeAnnotation,r),d=function*(e){for(let t of(c&&(yield e.replaceText(n.typeAnnotation.typeAnnotation,c)),yield e.insertTextBefore(n.parent.init,"new Set("),yield e.insertTextAfter(n.parent.init,")"),u.includes))yield e.replaceText(t.parent.property,"has");for(let t of u.lengths)yield e.replaceText(t.parent.property,"size")};return n.typeAnnotation&&!c?p.suggest=[{messageId:uk,fix:d}]:p.fix=d,p})},meta:{type:"suggestion",docs:{description:"Prefer `Set#has()` over `Array#includes()` when checking for existence or non-existence.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,properties:{minimumItems:{type:"integer",minimum:0,description:"The minimum known array size before `Set#has()` is enforced."}}}],defaultOptions:[{minimumItems:0}],messages:{[uj]:"`{{name}}` should be a `Set`, and use `{{name}}.has()` to check existence or non-existence.",[uk]:"Switch `{{name}}` to `Set`."},languages:["js/js"]}},uz=e=>tc(e.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&e.parent.arguments[0]===e&&e7(e.parent.callee.object,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1}),uK="prefer-string-raw",uG="unnecessary-string-raw";function uJ(e,t=""){return e.replaceAll(RegExp(String.raw`\\(?<escapedCharacter>[\\${t}])`,"g"),"$<escapedCharacter>")}let uX="prefer-switch",uY=(e,t)=>e===t||tH(e,t),uH=({left:e,right:t})=>[e,t].filter(e=>!("Literal"===e.type||th(e))),uQ=new Set(["WhileStatement","DoWhileStatement","ForStatement","ForOfStatement","ForInStatement","SwitchStatement"]),uZ=e=>{for(;e.parent;e=e.parent)if(uQ.has(e.type))return e},u0=(e,t,r)=>{let{sourceCode:n}=r;return n.getRange(e)[0]>=n.getRange(t)[0]&&n.getRange(e)[1]<=n.getRange(t)[1]},u1={create:e=>{let t={...e.options[0]},{sourceCode:r}=e,n=new Set,o=[],a=new Set;e.on("IfStatement",e=>{n.add(e)}),e.on("BreakStatement",e=>{e.label||o.push(e)}),e.on("Program:exit",function*(){for(let i of n){if(a.has(i))continue;let{discriminant:n,ifStatements:s}=function(e){let t,r=[];for(;e&&"IfStatement"===e.type;e=e.alternate){let{test:n}=e,o=function(e){let t=[e],r=[];for(;t.length>0;){if("LogicalExpression"===(e=t.pop()).type&&"||"===e.operator){t.push(e.right,e.left);continue}if("BinaryExpression"!==e.type||"==="!==e.operator)return[];r.push(e)}return r}(n);if(0===o.length)break;t||=uH(o[0]);let a=function(e,t){for(let{left:r,right:n}of e)if(0===(t=t.filter(e=>uY(e,r)||uY(e,n))).length)break;return t}(o,t);if(0===a.length)break;t=a,r.push({statement:e,compareExpressions:o})}return{ifStatements:r,discriminant:t&&t[0]}}(i);if(!n||s.length<t.minimumCases)continue;for(let{statement:e}of s)a.add(e);let l={loc:{start:r.getLoc(i).start,end:r.getLoc(i.consequent).start},messageId:uX};!eR(n,r)&&s.every(({statement:t})=>!function(e,t,r){for(let n of e){if(!u0(n,t,r))continue;let e=uZ(n);if(!e||u0(t,e,r))return!0}return!1}(o,t,e))&&(l.fix=function({discriminant:e,ifStatements:t},r,n){let{sourceCode:o}=r,a=o.getText(e);return function*(i){let s=t[0].statement,l=t2(s,r);yield i.insertTextBefore(s,`switch (${a}) {`);let u=t.at(-1).statement;if(u.alternate){let{alternate:e}=u;yield i.insertTextBefore(e,`
|
|
1
|
+
"use strict";let e,t;var r,n,o,a,i,s,l,u=require("eslint-plugin-sukka"),p=require("node:assert/strict"),c=require("node:util/types"),d=require("node:path"),m=require("node:util"),f=require("eslint/use-at-your-own-risk");function g(e,t){if("string"==typeof t){let e=t;t=t=>t.type===e}for(;e;){if(t(e))return e;e=e.parent}}function y(e){return e?.type==="Identifier"||e?.type==="PrivateIdentifier"}function h(e){return e?.type==="MemberExpression"}function x(e){return e?.type==="AwaitExpression"}function b(e,t){return!!y(e)&&("function"==typeof t?t(e.name):Array.isArray(t)?t.includes(e.name):e.name===t)}function E(e,t){return e?.type==="Literal"&&(Array.isArray(t)?t.includes(e.value):"string"==typeof e.value&&t instanceof RegExp?t.test(e.value):e.value===t)}function D(e){return!!e&&["ArrowFunctionExpression","FunctionDeclaration","FunctionExpression"].includes(e.type)}function S(e,t){return e?.type==="Identifier"&&t?.type===e.type&&e.name===t.name}function v({create:e,defaultOptions:t,meta:r,name:n}){return r.docs&&!r.docs.url&&(r.docs.url=new URL(n,"https://dimensiondev.github.io/eslint-plugin/src/rules/").href),{create(r){var n,o;let a,i=(n=t,o=r.options,a=structuredClone(n),null==o||a.forEach((e,t)=>{if(void 0!==o[t]){let r=o[t];"object"!=typeof r||Array.isArray(r)||"object"!=typeof e||Array.isArray(e)?a[t]=r:a[t]=function e(t={},r={}){return Object.fromEntries([...new Set([...Object.keys(t),...Object.keys(r)])].map(n=>{let o=n in t,a=n in r,i=t[n],s=r[n];return[n,o&&a?"object"!=typeof i||Array.isArray(i)||"object"!=typeof s||Array.isArray(s)?s:e(i,s):o?i:s]}))}(e,r)}}),a);return e(r,i)},defaultOptions:t,meta:r,name:n}}function C(e){if(!e?.program)throw Error("see https://typescript-eslint.io/docs/linting/type-linting")}var A=v({name:"array/no-unneeded-flat-map",meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow `Array#flatMap((x) => x)` when simpler alternatives exist",recommended:"stylistic"},schema:[],messages:{invalid:"Disallow simple `Array#flatMap()` in array"}},defaultOptions:[],create:e=>({CallExpression(t){var r;if("MemberExpression"!==t.callee.type||!b(t.callee.property,"flatMap")||!(D(r=t.arguments[0])&&1===r.params.length&&"Identifier"===r.params[0].type&&r.body&&(S(r.params[0],r.body)||"BlockStatement"===r.body.type&&1===r.body.body.length&&"ReturnStatement"===r.body.body[0].type&&S(r.params[0],r.body.body[0].argument))))return;let{property:n}=t.callee;e.report({node:t,messageId:"invalid",*fix(e){yield e.replaceText(n,"flat"),yield*t.arguments.map(t=>e.remove(t))}})}})});let T=new Set(["href","pathname","search","hash","origin"]);var w=v({name:"browser/prefer-location-assign",meta:{type:"suggestion",fixable:"code",docs:{description:"Prefer `location.assign(...)` over `location.*`",recommended:"stylistic"},schema:[],messages:{instead:"Use `location.assign(...)` instead of `location.{{name}}`"}},defaultOptions:[],create:e=>({AssignmentExpression(t){let r=function(e,t){if(b(e,t))return e;for(;h(e);){if(b(e.property,t))return e;e=e.object}}(t.left,"location");if(!r)return;let n=k(r.parent);e.report({node:t,messageId:"instead",data:{name:n},fix:function(e,t,r){let n=k(t.parent);if(T.has(n??"href"))return n=>n.replaceText(r,`${e.getText(t)}.assign(${e.getText(r.right)})`)}(e.sourceCode,r,t)})}})});function k(e){if(h(e)&&y(e.property))return e.property.name}var I=v({name:"jsx/no-template-literal",meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow use template-literal in JSX",recommended:"stylistic"},schema:[],messages:{invalid:"Disallow use template-literal in JSX"}},defaultOptions:[],create:e=>({JSXExpressionContainer(t){if("TemplateLiteral"!==t.expression.type||t.parent?.type==="JSXAttribute")return;let{expression:r}=t;e.report({node:t,messageId:"invalid",fix(n){let o=[...r.expressions,...r.quasis];o.sort((e,t)=>e.range[0]-t.range[0]);let a=o.map(t=>"TemplateElement"===t.type?t.value.cooked:"{"+e.sourceCode.getText(t)+"}");return n.replaceText(t,a.join(""))}})}})}),j=v({name:"jsx/no-unneeded-nested",meta:{type:"suggestion",fixable:"code",docs:{description:"Reduce unneeded JSXFragment nested",recommended:"stylistic"},schema:[],messages:{invalid:"Reduce unneeded JSXFragment nested"}},defaultOptions:[],create(e){let t=e.sourceCode;return{JSXFragment(r){if(1!==r.children.length)return;let n=r.children[0];e.report({node:r,messageId:"invalid",*fix(e){"JSXExpressionContainer"===n.type?"JSXEmptyExpression"!==n.expression.type&&(yield e.replaceText(r,t.getText(n.expression))):yield e.replaceText(r,t.getText(n))}})}}}});let F=/^toLocale(?<name>Upper|Lower)Case$/g;var B=v({name:"string/no-locale-case",meta:{type:"problem",fixable:"code",docs:{description:"Disallow use `String#toLocale{Upper,Lower}Case()`",recommended:"recommended"},schema:[],messages:{instead:"Use `.to{{name}}Case(...)` instead of `.toLocale{{name}}Case()`"}},defaultOptions:[],create:e=>({CallExpression(t){if(t.arguments.length>0||!h(t.callee)||!y(t.callee.property))return;let{property:r}=t.callee,n=F.exec(r.name);n&&e.report({node:t,data:{name:n.groups?.name},messageId:"instead",fix:e=>e.replaceText(r,r.name.replaceAll("Locale",""))})}})}),R=v({name:"string/no-simple-template-literal",meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow simple template-literal",recommended:"stylistic"},schema:[],messages:{invalid:"Disallow simple template-literal"}},defaultOptions:[],create:e=>({TemplateLiteral(t){var r,n,o,a;let i=(r=e.sourceCode,(o=n=t,o.parent?.type!=="TaggedTemplateExpression"&&1===o.quasis.length&&!function({loc:e}){return!!e&&e.start.line!==e.end.line}(o.quasis[0])&&0===o.expressions.length)?e=>{let t=JSON.stringify(n.quasis[0].value.cooked),o=g(n,e=>"Property"===e.type&&e.key===n);return o?e.replaceText(o,`${t}: ${r.getText(o.value)}`):e.replaceText(n,t)}:2===(a=n).quasis.length&&a.quasis.every(({value:e})=>""===e.cooked)&&1===a.expressions.length?e=>e.replaceText(n,r.getText(n.expressions[0])):void 0);i&&e.report({node:t,messageId:"invalid",fix:i})}})});let $=/\P{ASCII}/u;function P(e,t){return{Program(r){for(let n of r.tokens??[]){let r=function(e){switch(e.type){case"String":case"Template":return e.value.slice(1,-1);case"Identifier":if(e.value.startsWith("#"))return e.value.slice(1);return e.value;case"PrivateIdentifier":case"JSXText":case"JSXIdentifier":return e.value;case"RegularExpression":return e.regex.pattern}return!1}(n);!1!==r&&e.test(r)&&t(n,"code")}for(let n of r.comments??[])e.test(n.value)&&t(n,"comment")}}}function L(e,t){switch(e.type){case"String":case"Template":return r=>{let n=e.value.slice(0,1),o=e.value.slice(-1),a=N(e.value.slice(1,-1),t);return r.replaceText(e,`${n}${a}${o}`)};case"JSXText":return r=>{let n=e.value.replace(t,e=>`&#x${M(e.codePointAt(0))};`);return r.replaceText(e,n)};case"RegularExpression":return r=>{let n=new Set(e.regex.flags);n.add("u");let o=new RegExp(N(e.regex.pattern,t),[...n].join(""));return r.replaceText(e,o.toString())}}}function N(e,t){return e.replace(t,e=>{let t=e.codePointAt(0);return t>65535?`\\u{${M(t)}}`:`\\u${M(t)}`})}function M(e){return e.toString(16).padStart(4,"0").toUpperCase()}v({name:"unicode/specific-set",meta:{type:"problem",fixable:"code",docs:{description:"Limit the range of literal characters"},schema:[{type:"object",properties:{pattern:{type:"string"},flags:{type:"string"},only:{type:"string",enum:["code","comment"]}},additionalProperties:!1}],messages:{illegal:"Illegal character detected"}},defaultOptions:[{pattern:$.source,flags:"u",only:void 0}],create(e,[{pattern:t,flags:r,only:n}]){let o=t?new RegExp(t,r):$;return P(o,(t,r)=>{if(n&&n!==r)return;let a=L(t,RegExp(o.source,"gu"));e.report({node:t,messageId:"illegal",fix:a})})}});let O=/[\u061C\u202A-\u202E\u2066-\u2069]/;var q=v({name:"unicode/no-bidi",meta:{type:"problem",fixable:"code",docs:{description:"Detect and stop Trojan Source attacks",recommended:"recommended"},schema:[],messages:{detected:"Detected potential trojan source attack with unicode bidi introduced in this {{kind}}: {{text}}."}},defaultOptions:[],create:e=>P(O,(t,r)=>{let n=RegExp(O.source,"gu"),o={kind:r,text:N(t.value,n)},a=L(t,n);e.report({node:t,data:o,messageId:"detected",fix:a})})});let U=(t=[/\u00AD\u034F\u061C\u17B4\u17B5\uFEFF\uFFFC/,/\u180B-\u180E/,/\u200B-\u200F/,/\u202A-\u202E/,/\u2060-\u206F/,/\uFE00-\uFE0F/,/\uFFF0-\uFFF8/,/\u{1D173}-\u{1D17A}/u,/\u{E0000}-\u{E007F}/u,/\u{E0100}-\u{E01EF}/u].map(e=>"string"==typeof e?e:e.source).join(""),RegExp(`[${t}]`,"u"));var W=v({name:"unicode/no-invisible",meta:{type:"problem",fixable:"code",docs:{description:"Disallow invisible characters",recommended:"recommended"},schema:[],messages:{illegal:"Illegal character detected"}},defaultOptions:[],create:e=>P(U,t=>{let r=L(t,RegExp(U.source,"gu"));e.report({node:t,messageId:"illegal",fix:r})})}),_=v({name:"no-redundant-variable",meta:{type:"problem",fixable:"code",docs:{description:"Disallow redundant variable",recommended:"stylistic"},schema:[],messages:{invalid:"Disallow Redundant Variable"}},defaultOptions:[],create:e=>({BlockStatement({body:t}){var r,n,o,a,i;let s=t.find(V);if(!s)return;let l=t[t.indexOf(s)-1];r=l,n=s,r&&"VariableDeclaration"===r.type&&1===r.declarations.length&&r.declarations.some(({init:e,id:t})=>null!==e&&S(n.argument,t))&&e.report({node:s,messageId:"invalid",fix:(o=e.sourceCode,a=l,i=s,e=>{var t;let{init:r,id:n}=a.declarations[0];if(!(r&&n&&i.argument))return null;let s=!x(t=r)||g(t,"TryStatement")?t:t.argument,l=(e=>{if(!n.typeAnnotation)return e;let t=o.getText(n.typeAnnotation.typeAnnotation);return`(${e}) as ${x(r)?`Promise<${t}>`:t}`})(o.getText(s));return[e.remove(a),e.replaceText(i.argument,l)]})})}})});function V(e){return"ReturnStatement"===e.type&&y(e.argument)}var z=v({name:"no-single-return",meta:{type:"suggestion",docs:{description:"Disallow single-return",recommended:"stylistic"},schema:[],messages:{invalid:"Disallow Single Return"}},defaultOptions:[],create:e=>({BlockStatement({parent:t,body:r}){if(!D(t))return;let n=function(e,t){let r=t.find(K);if(!r)return;let n=t.find(e=>{var t,n;return t=e,n=r,"VariableDeclaration"===t.type&&"const"!==t.kind&&t.declarations.some(({id:e})=>S(n.argument,e))});if(n)return e.sourceCode.getDeclaredVariables(n).find(({references:e})=>e.every(e=>e.isWriteOnly()||e.identifier.parent===r))}(e,r);for(let{identifier:t}of n?.references??[])t.parent&&e.report({node:t.parent,messageId:"invalid"})}})});function K(e){return"ReturnStatement"===e.type&&y(e.argument)}var G=v({name:"prefer-early-return",meta:{type:"problem",fixable:"code",docs:{description:"Prefer early returns over full-body conditional wrapping in function declarations",recommended:"stylistic"},schema:[{type:"object",properties:{maximumStatements:{type:"integer",minimum:0}},additionalProperties:!1}],messages:{prefer:"Prefer an early return to a conditionally-wrapped function body"}},defaultOptions:[{maximumStatements:0}],create:(e,[{maximumStatements:t}])=>({BlockStatement:function({body:r,parent:n}){var o,a;if(!D(n)||!(1===r.length&&function(e,t){if("IfStatement"!==e.type||null!==e.alternate)return!1;let{consequent:r}=e;return"ExpressionStatement"===r.type&&0===t||"BlockStatement"===r.type&&r.body.length>t}(r[0],t)))return;let i=(o=e,a=r[0],function*(e){var t;let r;if("IfStatement"!==a.type)return;let{test:n,consequent:i}=a;yield e.insertTextBefore(n,"!("),yield e.insertTextAfter(n,")"),yield e.replaceText(i,"return;");let s=(t=o.sourceCode.getText(i),r=t,"BlockStatement"===i.type?r.slice(1,-1):r);yield e.insertTextAfter(a,s)});e.report({node:r[0],messageId:"prefer",fix:i})}})}),J=v({name:"prefer-fetch",meta:{type:"problem",docs:{description:"Enforce fetch",recommended:"stylistic"},schema:[],messages:{callee:"Should use 'fetch' instead"}},defaultOptions:[],create:e=>({ImportDeclaration(t){let r=t.source.value;("axios"===r||"request"===r)&&e.report({node:t,messageId:"callee"})},NewExpression(t){var r;((function({callee:e}){return b(e,"XMLHttpRequest")})(t)||b((r=t).callee,"ActiveXObject")&&E(r.arguments[0],/xmlhttp/i))&&e.report({node:t,messageId:"callee"})},CallExpression(t){((function({callee:e}){let t="$http";return b(e,t)||h(e)&&b(e.object,t)})(t)||function({callee:e,parent:t}){let r=["$","jQuery"];return b(e,r)&&h(t)&&b(t.property,"load")||h(e)&&b(e.object,r)&&b(e.property,["ajax","get","post","getJSON","getScript"])}(t)||X(t,"axios")||X(t,"request"))&&e.report({node:t,messageId:"callee"})}})});function X(e,t){return b(e.callee,"require")&&E(e.arguments[0],t)}let Y=new Set(["setTimeout","setInterval","requestAnimationFrame","requestIdleCallback"]);var H=v({name:"prefer-timer-id",meta:{type:"problem",docs:{description:"Enforce best practice with timer function",recommended:"recommended"},schema:[],messages:{assign:"Timer id should assign to an identifier or member for cleaning up, `const timer = {{name}}(...);`",fix:"Assign timer id to a variable"},hasSuggestions:!0},defaultOptions:[],create:e=>({CallExpression(t){"Identifier"!==t.callee.type||!Y.has(t.callee.name)||function(e){if(!b(e.callee,"setTimeout"))return!1;let t=e.arguments[1];return!t||E(t,0)}(t)||t.parent?.type==="AssignmentExpression"&&t.parent.right===t||t.parent?.type==="VariableDeclarator"&&t.parent.init===t||e.report({node:t,messageId:"assign",data:{name:t.callee.name},suggest:[{messageId:"fix",fix:e=>e.insertTextBefore(t,"const timer = ")}]})}})}),Z=v({name:"string/no-unneeded-to-string",meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow `String#toString()` when simpler alternatives exist",recommended:"stylistic",requiresTypeChecking:!0},schema:[],messages:{invalid:"Disallow use `.toString()` in string"}},defaultOptions:[],create(e){C(e.sourceCode.parserServices);let{program:t,esTreeNodeToTSNodeMap:r}=e.sourceCode.parserServices,n=t.getTypeChecker();return{CallExpression(t){if("MemberExpression"!==t.callee.type)return;let{object:o,property:a}=t.callee;(b(a,"toString")||E(a,"toString"))&&function(e,t){let r=e.getTypeAtLocation(t);if(r.isStringLiteral()||"string"===e.typeToString(r))return!0;let n=r.getSymbol();return n&&"String"===e.symbolToString(n)}(n,r.get(o))&&e.report({node:a,messageId:"invalid",fix:r=>r.replaceText(t,e.sourceCode.getText(o))})}}}}),Q=v({name:"type/no-force-cast-via-top-type",meta:{type:"problem",docs:{description:"Disallowing cast a type `T` to unrelated or incompatible type `Q` via `T as any as Q`",recommended:"recommended"},schema:[],messages:{invalid:"Don't cast this expression to another type by `as {{type}} as T`"}},defaultOptions:[],create:e=>({TSAsExpression(t){var r,n;if("TSAnyKeyword"!==(r=t.typeAnnotation).type&&"TSUnknownKeyword"!==r.type||!((n=t.parent)&&"TSAsExpression"===n.type&&"TSTypeReference"===n.typeAnnotation.type))return;let o="TSAnyKeyword"===t.typeAnnotation.type?"any":"unknown";e.report({node:t,messageId:"invalid",data:{type:o}})}})});let ee=new Set(["BigInt","Boolean","Number","String","Symbol"]);var et=v({name:"type/no-wrapper-type-reference",meta:{type:"problem",fixable:"code",docs:{description:"Disallow wrapper type for type reference",recommended:"recommended"},schema:[],messages:{instead:"Use {{name}} instead"}},defaultOptions:[],create:e=>({TSTypeReference(t){if("Identifier"!==t.typeName.type||!ee.has(t.typeName.name))return;let r=t.typeName.name.toLowerCase();e.report({node:t,messageId:"instead",data:{name:r},fix:e=>e.replaceText(t.typeName,r)})}})}),er=v({name:"no-default-error",meta:{type:"problem",docs:{description:"Restrict the usage of default (unextended) error",recommended:"strict",requiresTypeChecking:!0},schema:[],messages:{invalid:"Default error object should not be used in this project"}},defaultOptions:[],create(e){C(e.sourceCode.parserServices);let{esTreeNodeToTSNodeMap:t,program:r}=e.sourceCode.parserServices,n=r.getTypeChecker();function o(r){"ErrorConstructor"===function(e,t){let r=e.getTypeAtLocation(t).getSymbol();if(!r?.valueDeclaration)return;let n=e.getTypeOfSymbolAtLocation(r,r.valueDeclaration);return e.typeToString(n)}(n,t.get(r))&&e.report({node:r,messageId:"invalid"})}return{ThrowStatement(e){e.argument&&o(e.argument)},NewExpression:o,CallExpression:o}}});let en={ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","body"],AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],AwaitExpression:["argument"],BinaryExpression:["left","right"],BlockStatement:["body"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ChainExpression:["expression"],ClassBody:["body"],ClassDeclaration:["id","superClass","body"],ClassExpression:["id","superClass","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExperimentalRestProperty:["argument"],ExperimentalSpreadProperty:["argument"],ExportAllDeclaration:["exported","source"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source"],ExportSpecifier:["exported","local"],ExpressionStatement:["expression"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],ForStatement:["init","test","update","body"],FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["local"],ImportExpression:["source"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["imported","local"],JSXAttribute:["name","value"],JSXClosingElement:["name"],JSXClosingFragment:[],JSXElement:["openingElement","children","closingElement"],JSXEmptyExpression:[],JSXExpressionContainer:["expression"],JSXFragment:["openingFragment","children","closingFragment"],JSXIdentifier:[],JSXMemberExpression:["object","property"],JSXNamespacedName:["namespace","name"],JSXOpeningElement:["name","attributes"],JSXOpeningFragment:[],JSXSpreadAttribute:["argument"],JSXSpreadChild:["expression"],JSXText:[],LabeledStatement:["label","body"],Literal:[],LogicalExpression:["left","right"],MemberExpression:["object","property"],MetaProperty:["meta","property"],MethodDefinition:["key","value"],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],PrivateIdentifier:[],Program:["body"],Property:["key","value"],PropertyDefinition:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],StaticBlock:["body"],Super:[],SwitchCase:["test","consequent"],SwitchStatement:["discriminant","cases"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]};for(let e of Object.keys(en))Object.freeze(en[e]);Object.freeze(en);let eo=new Set(["parent","leadingComments","trailingComments"]);function ea(e){return!eo.has(e)&&"_"!==e[0]}function ei(e,t){let r="",n=e;for("string"==typeof t?r=t:(r=t.name,n=function(e,t){let r=t.range[0],n=e,o=!1;do for(let e of(o=!1,n.childScopes)){let t=e.block.range;if(t[0]<=r&&r<t[1]){n=e,o=!0;break}}while(o);return n}(n,t));null!=n;){let e=n.set.get(r);if(null!=e)return e;n=n.upper}return null}function es(e,t){return"Punctuator"===e.type&&e.value===t}function el(e){return es(e,"=>")}function eu(e){return es(e,",")}function ep(e){return es(e,";")}function ec(e){return es(e,":")}function ed(e){return es(e,"(")}function em(e){return es(e,")")}function ef(e){return es(e,"{")}function eg(e){return["Block","Line","Shebang"].includes(e.type)}let ey=e=>!ep(e);function eh(e,t){let r=e.parent,n=null,o=null;if("ArrowFunctionExpression"===e.type){let r=t.getTokenBefore(e.body,el);n=r.loc.start,o=r.loc.end}else{var a,i;n=r&&("Property"===r.type||"MethodDefinition"===r.type||"PropertyDefinition"===r.type)?r.loc.start:e.loc.start,o=(a=e,i=t,a.id?i.getTokenAfter(a.id,ed):i.getFirstToken(a,ed)).loc.start}return{start:{...n},end:{...o}}}let ex="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},eb=Object.freeze(new Set(["Array","ArrayBuffer","BigInt","BigInt64Array","BigUint64Array","Boolean","DataView","Date","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","Float32Array","Float64Array","Function","Infinity","Int16Array","Int32Array","Int8Array","isFinite","isNaN","isPrototypeOf","JSON","Map","Math","NaN","Number","Object","parseFloat","parseInt","Promise","Proxy","Reflect","RegExp","Set","String","Symbol","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray","undefined","unescape","WeakMap","WeakSet"])),eE=new Set([Array.isArray,Array.of,Array.prototype.at,Array.prototype.concat,Array.prototype.entries,Array.prototype.every,Array.prototype.filter,Array.prototype.find,Array.prototype.findIndex,Array.prototype.flat,Array.prototype.includes,Array.prototype.indexOf,Array.prototype.join,Array.prototype.keys,Array.prototype.lastIndexOf,Array.prototype.slice,Array.prototype.some,Array.prototype.toString,Array.prototype.values,"function"==typeof BigInt?BigInt:void 0,Boolean,Date,Date.parse,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,escape,isFinite,isNaN,isPrototypeOf,Map,Map.prototype.entries,Map.prototype.get,Map.prototype.has,Map.prototype.keys,Map.prototype.values,...Object.getOwnPropertyNames(Math).filter(e=>"random"!==e).map(e=>Math[e]).filter(e=>"function"==typeof e),Number,Number.isFinite,Number.isNaN,Number.parseFloat,Number.parseInt,Number.prototype.toExponential,Number.prototype.toFixed,Number.prototype.toPrecision,Number.prototype.toString,Object,Object.entries,Object.is,Object.isExtensible,Object.isFrozen,Object.isSealed,Object.keys,Object.values,parseFloat,parseInt,RegExp,Set,Set.prototype.entries,Set.prototype.has,Set.prototype.keys,Set.prototype.values,String,String.fromCharCode,String.fromCodePoint,String.raw,String.prototype.at,String.prototype.charAt,String.prototype.charCodeAt,String.prototype.codePointAt,String.prototype.concat,String.prototype.endsWith,String.prototype.includes,String.prototype.indexOf,String.prototype.lastIndexOf,String.prototype.normalize,String.prototype.padEnd,String.prototype.padStart,String.prototype.slice,String.prototype.startsWith,String.prototype.substr,String.prototype.substring,String.prototype.toLowerCase,String.prototype.toString,String.prototype.toUpperCase,String.prototype.trim,String.prototype.trimEnd,String.prototype.trimLeft,String.prototype.trimRight,String.prototype.trimStart,Symbol.for,Symbol.keyFor,unescape].filter(e=>"function"==typeof e)),eD=new Set([Object.freeze,Object.preventExtensions,Object.seal]),eS=[[Map,new Set(["size"])],[RegExp,new Set(["dotAll","flags","global","hasIndices","ignoreCase","multiline","source","sticky","unicode"])],[Set,new Set(["size"])]];function ev(e,t){let r=[];for(let n=0;n<e.length;++n){let o=e[n];if(null==o)r.length=n+1;else if("SpreadElement"===o.type){let e=eA(o.argument,t);if(null==e)return null;r.push(...e.value)}else{let e=eA(o,t);if(null==e)return null;r.push(e.value)}}return r}let eC=Object.freeze({ArrayExpression(e,t){let r=ev(e.elements,t);return null!=r?{value:r}:null},AssignmentExpression:(e,t)=>"="===e.operator?eA(e.right,t):null,BinaryExpression(e,t){if("in"===e.operator||"instanceof"===e.operator)return null;let r=eA(e.left,t),n=eA(e.right,t);if(null!=r&&null!=n)switch(e.operator){case"==":return{value:r.value==n.value};case"!=":return{value:r.value!=n.value};case"===":return{value:r.value===n.value};case"!==":return{value:r.value!==n.value};case"<":return{value:r.value<n.value};case"<=":return{value:r.value<=n.value};case">":return{value:r.value>n.value};case">=":return{value:r.value>=n.value};case"<<":return{value:r.value<<n.value};case">>":return{value:r.value>>n.value};case">>>":return{value:r.value>>>n.value};case"+":return{value:r.value+n.value};case"-":return{value:r.value-n.value};case"*":return{value:r.value*n.value};case"/":return{value:r.value/n.value};case"%":return{value:r.value%n.value};case"**":return{value:r.value**n.value};case"|":return{value:r.value|n.value};case"^":return{value:r.value^n.value};case"&":return{value:r.value&n.value}}return null},CallExpression(e,t){let r=e.callee,n=ev(e.arguments,t);if(null!=n)if("MemberExpression"===r.type){if("PrivateIdentifier"===r.property.type)return null;let o=eA(r.object,t);if(null!=o){if(null==o.value&&(o.optional||e.optional))return{value:void 0,optional:!0};let a=eT(r,t);if(null!=a){let e=o.value,t=a.value;if(eE.has(e[t]))return{value:e[t](...n)};if(eD.has(e[t]))return{value:n[0]}}}}else{let o=eA(r,t);if(null!=o){if(null==o.value&&e.optional)return{value:void 0,optional:!0};let t=o.value;if(eE.has(t))return{value:t(...n)};if(eD.has(t))return{value:n[0]}}}return null},ConditionalExpression(e,t){let r=eA(e.test,t);return null!=r?r.value?eA(e.consequent,t):eA(e.alternate,t):null},ExpressionStatement:(e,t)=>eA(e.expression,t),Identifier(e,t){if(null!=t){let r=ei(t,e);if(null!=r){if(null!=r&&0===r.defs.length&&eb.has(r.name)&&r.name in ex)return{value:ex[r.name]};if(function(e){let t,r,n;if(1!==e.defs.length)return!1;let o=e.defs[0];return!!(o.parent&&"Variable"===o.type&&("const"===o.parent.kind||(r=(t=e.references).filter(e=>e.init).length,n=t.filter(e=>e.isReadOnly()).length,1===r&&n+r===t.length)))}(r)){let e=r.defs[0];if("Identifier"===e.node.id.type){let n=eA(e.node.init,t);return n&&"object"==typeof n.value&&null!==n.value&&function(e,t){for(let r of e.references){let e=r.identifier;for(;e&&e.parent&&"MemberExpression"===e.parent.type;)e=e.parent;if(e&&e.parent&&("AssignmentExpression"===e.parent.type&&e.parent.left===e||"UpdateExpression"===e.parent.type&&e.parent.argument===e||"CallExpression"===e.parent.type&&e.parent.callee===e&&"MemberExpression"===e.type&&function(e){if(null==e||null==e.value)return!1;let t=e.value;return"copyWithin"===t||"fill"===t||"pop"===t||"push"===t||"reverse"===t||"shift"===t||"sort"===t||"splice"===t||"unshift"===t}(eT(e,t))))return!0}return!1}(r,t)?null:n}}}}return null},Literal:e=>(null!=e.regex||null!=e.bigint)&&null==e.value?null:{value:e.value},LogicalExpression(e,t){let r=eA(e.left,t);if(null!=r){if("||"===e.operator&&!0==!!r.value||"&&"===e.operator&&!1==!!r.value||"??"===e.operator&&null!=r.value)return r;let n=eA(e.right,t);if(null!=n)return n}return null},MemberExpression(e,t){if("PrivateIdentifier"===e.property.type)return null;let r=eA(e.object,t);if(null!=r){if(null==r.value&&(r.optional||e.optional))return{value:void 0,optional:!0};let n=eT(e,t);if(null!=n){let e;if(null==(e=function(e,t){let r=e;for(;("object"==typeof r||"function"==typeof r)&&null!==r;){let e=Object.getOwnPropertyDescriptor(r,t);if(e)return e;r=Object.getPrototypeOf(r)}return null}(r.value,n.value))||null==e.get)return{value:r.value[n.value]};for(let[e,t]of eS)if(r.value instanceof e&&t.has(n.value))return{value:r.value[n.value]}}}return null},ChainExpression(e,t){let r=eA(e.expression,t);return null!=r?{value:r.value}:null},NewExpression(e,t){let r=eA(e.callee,t),n=ev(e.arguments,t);if(null!=r&&null!=n){let e=r.value;if(eE.has(e))return{value:new e(...n)}}return null},ObjectExpression(e,t){let r={};for(let n of e.properties)if("Property"===n.type){if("init"!==n.kind)return null;let e=eT(n,t),o=eA(n.value,t);if(null==e||null==o)return null;r[e.value]=o.value}else{if("SpreadElement"!==n.type&&"ExperimentalSpreadProperty"!==n.type)return null;let e=eA(n.argument,t);if(null==e)return null;Object.assign(r,e.value)}return{value:r}},SequenceExpression:(e,t)=>eA(e.expressions[e.expressions.length-1],t),TaggedTemplateExpression(e,t){let r=eA(e.tag,t),n=ev(e.quasi.expressions,t);if(null!=r&&null!=n){let t=r.value,o=e.quasi.quasis.map(e=>e.value.cooked);if(o.raw=e.quasi.quasis.map(e=>e.value.raw),t===String.raw)return{value:t(o,...n)}}return null},TemplateLiteral(e,t){let r=ev(e.expressions,t);if(null!=r){let t=e.quasis[0].value.cooked;for(let n=0;n<r.length;++n)t+=r[n],t+=e.quasis[n+1].value.cooked;return{value:t}}return null},UnaryExpression(e,t){if("delete"===e.operator)return null;if("void"===e.operator)return{value:void 0};let r=eA(e.argument,t);if(null!=r)switch(e.operator){case"-":return{value:-r.value};case"+":return{value:+r.value};case"!":return{value:!r.value};case"~":return{value:~r.value};case"typeof":return{value:typeof r.value}}return null},TSAsExpression:(e,t)=>eA(e.expression,t),TSSatisfiesExpression:(e,t)=>eA(e.expression,t),TSTypeAssertion:(e,t)=>eA(e.expression,t),TSNonNullExpression:(e,t)=>eA(e.expression,t),TSInstantiationExpression:(e,t)=>eA(e.expression,t)});function eA(e,t){return null!=e&&Object.hasOwnProperty.call(eC,e.type)?eC[e.type](e,t):null}function eT(e,t){let r="Property"===e.type?e.key:e.property;return e.computed?eA(r,t):"Identifier"===r.type?{value:r.name}:"Literal"===r.type?r.bigint?{value:r.bigint}:{value:String(r.value)}:null}function ew(e,t=null){try{return eA(e,t)}catch(e){return null}}function ek(e,t=null){if(e&&"Literal"===e.type&&null===e.value){if(e.regex)return`/${e.regex.pattern}/${e.regex.flags}`;if(e.bigint)return e.bigint}let r=ew(e,t);if(r)try{return String(r.value)}catch{}return null}function eI(e,t){switch(e.type){case"MemberExpression":if(e.computed)return ek(e.property,t);if("PrivateIdentifier"===e.property.type)break;return e.property.name;case"Property":case"MethodDefinition":case"PropertyDefinition":if(e.computed)return ek(e.key,t);if("Literal"===e.key.type)return String(e.key.value);if("PrivateIdentifier"===e.key.type)break;return e.key.name}return null}function ej(e,t){let r=e.parent;if(!r)return"";let n=[],o="Property"===r.type&&r.value===e,a="MethodDefinition"===r.type&&r.value===e,i="PropertyDefinition"===r.type&&r.value===e;if((a||i)&&(r.static&&n.push("static"),"PrivateIdentifier"===r.key.type&&n.push("private")),e.async&&n.push("async"),e.generator&&n.push("generator"),o||a){if("constructor"===r.kind)return"constructor";"get"===r.kind?n.push("getter"):"set"===r.kind?n.push("setter"):n.push("method")}else i?n.push("method"):("ArrowFunctionExpression"===e.type&&n.push("arrow"),n.push("function"));if(o||a||i)if("PrivateIdentifier"===r.key.type)n.push(`#${r.key.name}`);else{let e=eI(r);if(e)n.push(`'${e}'`);else if(t){let e=t.getText(r.key);e.includes("\n")||n.push(`[${e}]`)}}else e.id?n.push(`'${e.id.name}'`):"VariableDeclarator"===r.type&&r.id&&"Identifier"===r.id.type?n.push(`'${r.id.name}'`):("AssignmentExpression"===r.type||"AssignmentPattern"===r.type)&&r.left&&"Identifier"===r.left.type?n.push(`'${r.left.name}'`):"ExportDefaultDeclaration"===r.type&&r.declaration===e&&n.push("'default'");return n.join(" ")}let eF=Object.freeze(new Set(["==","!=","<","<=",">",">=","<<",">>",">>>","+","-","*","/","%","|","^","&","in"])),eB=Object.freeze(new Set(["-","+","!","~"]));function eR(e){return null!==e&&"object"==typeof e&&"string"==typeof e.type}let e$=Object.freeze(Object.assign(Object.create(null),{$visit(e,t,r){let{type:n}=e;return"function"==typeof this[n]?this[n](e,t,r):this.$visitChildren(e,t,r)},$visitChildren(e,t,r){let{type:n}=e;for(let o of r[n]||Object.keys(e).filter(ea)){let n=e[o];if(Array.isArray(n)){for(let e of n)if(eR(e)&&this.$visit(e,t,r))return!0}else if(eR(n)&&this.$visit(n,t,r))return!0}return!1},ArrowFunctionExpression:()=>!1,AssignmentExpression:()=>!0,AwaitExpression:()=>!0,BinaryExpression(e,t,r){return!!(t.considerImplicitTypeConversion&&eF.has(e.operator))&&("Literal"!==e.left.type||"Literal"!==e.right.type)||this.$visitChildren(e,t,r)},CallExpression:()=>!0,FunctionExpression:()=>!1,ImportExpression:()=>!0,MemberExpression(e,t,r){return!!t.considerGetters||!!t.considerImplicitTypeConversion&&!!e.computed&&"Literal"!==e.property.type||this.$visitChildren(e,t,r)},MethodDefinition(e,t,r){return!!t.considerImplicitTypeConversion&&!!e.computed&&"Literal"!==e.key.type||this.$visitChildren(e,t,r)},NewExpression:()=>!0,Property(e,t,r){return!!t.considerImplicitTypeConversion&&!!e.computed&&"Literal"!==e.key.type||this.$visitChildren(e,t,r)},PropertyDefinition(e,t,r){return!!t.considerImplicitTypeConversion&&!!e.computed&&"Literal"!==e.key.type||this.$visitChildren(e,t,r)},UnaryExpression(e,t,r){return!!("delete"===e.operator||t.considerImplicitTypeConversion&&eB.has(e.operator)&&"Literal"!==e.argument.type)||this.$visitChildren(e,t,r)},UpdateExpression:()=>!0,YieldExpression:()=>!0}));function eP(e,t,r={}){let{considerGetters:n=!1,considerImplicitTypeConversion:o=!1}=r;return e$.$visit(e,{considerGetters:n,considerImplicitTypeConversion:o},t.visitorKeys||en)}function eL(e,t,r){let n,o,a,i,s;if("number"==typeof e){if(n=0|e,o=t,a=r,!(n>=1))throw TypeError("'times' should be a positive integer.")}else n=1,o=e,a=t;if(null==o||null==o.parent||"CatchClause"===o.parent.type&&o.parent.param===o)return!1;i=s=o;do i=a.getTokenBefore(i),s=a.getTokenAfter(s);while(null!=i&&null!=s&&ed(i)&&em(s)&&i!==function(e,t){let r=e.parent;if(!r)return null;switch(r.type){case"CallExpression":case"NewExpression":if(1===r.arguments.length&&r.arguments[0]===e)return t.getTokenAfter(r.typeArguments||r.typeParameters||r.callee,ed);return null;case"DoWhileStatement":if(r.test===e)return t.getTokenAfter(r.body,ed);return null;case"IfStatement":case"WhileStatement":if(r.test===e)return t.getFirstToken(r,1);return null;case"ImportExpression":if(r.source===e)return t.getFirstToken(r,1);return null;case"SwitchStatement":if(r.discriminant===e)return t.getFirstToken(r,1);return null;case"WithStatement":if(r.object===e)return t.getFirstToken(r,1);return null;default:return null}}(o,a)&&--n>0);return 0===n}let eN=/^(?:Import|Export(?:All|Default|Named))Declaration$/u,eM=Function.call.bind(Object.hasOwnProperty),eO=Symbol("read"),eq=Symbol("call"),eU=Symbol("construct"),eW=Symbol("esm"),e_={require:{[eq]:!0}};function eV(e){return null==e||0!==e.defs.length||e.references.some(e=>e.isWrite())}class ez{constructor(e,t={}){let{mode:r="strict",globalObjectNames:n=["global","globalThis","self","window"]}=t;this.variableStack=[],this.globalScope=e,this.mode=r,this.globalObjectNames=n.slice(0)}*iterateGlobalReferences(e){for(let t of Object.keys(e)){let r=e[t],n=[t],o=this.globalScope.set.get(t);eV(o)||(yield*this._iterateVariableReferences(o,n,r,!0))}for(let t of this.globalObjectNames){let r=[],n=this.globalScope.set.get(t);eV(n)||(yield*this._iterateVariableReferences(n,r,e,!1))}}*iterateCjsReferences(e){for(let{node:t}of this.iterateGlobalReferences(e_)){let r=ek(t.arguments[0]);if(null==r||!eM(e,r))continue;let n=e[r],o=[r];n[eO]&&(yield{node:t,path:o,type:eO,info:n[eO]}),yield*this._iteratePropertyReferences(t,o,n)}}*iterateEsmReferences(e){for(let t of this.globalScope.block.body){if(!eN.test(t.type)||null==t.source)continue;let r=t.source.value;if(!eM(e,r))continue;let n=e[r],o=[r];if(n[eO]&&(yield{node:t,path:o,type:eO,info:n[eO]}),"ExportAllDeclaration"===t.type)for(let e of Object.keys(n)){let r=n[e];r[eO]&&(yield{node:t,path:o.concat(e),type:eO,info:r[eO]})}else for(let e of t.specifiers){let t=eM(n,eW),r=this._iterateImportReferences(e,o,t?n:"legacy"===this.mode?{default:n,...n}:{default:n});if(t)yield*r;else for(let e of r)e.path=e.path.filter(eK),(e.path.length>=2||e.type!==eO)&&(yield e)}}}*iteratePropertyReferences(e,t){yield*this._iteratePropertyReferences(e,[],t)}*_iterateVariableReferences(e,t,r,n){if(!this.variableStack.includes(e)){this.variableStack.push(e);try{for(let o of e.references){if(!o.isRead())continue;let e=o.identifier;n&&r[eO]&&(yield{node:e,path:t,type:eO,info:r[eO]}),yield*this._iteratePropertyReferences(e,t,r)}}finally{this.variableStack.pop()}}}*_iteratePropertyReferences(e,t,r){let n=e;for(;function(e){let t=e.parent;if(t)switch(t.type){case"ConditionalExpression":return t.consequent===e||t.alternate===e;case"LogicalExpression":case"ChainExpression":case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":case"TSNonNullExpression":case"TSInstantiationExpression":return!0;case"SequenceExpression":return t.expressions[t.expressions.length-1]===e}return!1}(n);)n=n.parent;let o=n.parent;if(o){if("MemberExpression"===o.type){if(o.object===n){let e=eI(o);if(null==e||!eM(r,e))return;t=t.concat(e);let n=r[e];n[eO]&&(yield{node:o,path:t,type:eO,info:n[eO]}),yield*this._iteratePropertyReferences(o,t,n)}return}if("CallExpression"===o.type){o.callee===n&&r[eq]&&(yield{node:o,path:t,type:eq,info:r[eq]});return}if("NewExpression"===o.type){o.callee===n&&r[eU]&&(yield{node:o,path:t,type:eU,info:r[eU]});return}if("AssignmentExpression"===o.type){o.right===n&&(yield*this._iterateLhsReferences(o.left,t,r),yield*this._iteratePropertyReferences(o,t,r));return}if("AssignmentPattern"===o.type){o.right===n&&(yield*this._iterateLhsReferences(o.left,t,r));return}"VariableDeclarator"===o.type&&o.init===n&&(yield*this._iterateLhsReferences(o.id,t,r))}}*_iterateLhsReferences(e,t,r){if("Identifier"===e.type){let n=ei(this.globalScope,e);null!=n&&(yield*this._iterateVariableReferences(n,t,r,!1));return}if("ObjectPattern"===e.type){for(let n of e.properties){let e=eI(n);if(null==e||!eM(r,e))continue;let o=t.concat(e),a=r[e];a[eO]&&(yield{node:n,path:o,type:eO,info:a[eO]}),yield*this._iterateLhsReferences(n.value,o,a)}return}"AssignmentPattern"===e.type&&(yield*this._iterateLhsReferences(e.left,t,r))}*_iterateImportReferences(e,t,r){let n=e.type;if("ImportSpecifier"===n||"ImportDefaultSpecifier"===n){let o="ImportDefaultSpecifier"===n?"default":"Identifier"===e.imported.type?e.imported.name:e.imported.value;if(!eM(r,o))return;t=t.concat(o);let a=r[o];a[eO]&&(yield{node:e,path:t,type:eO,info:a[eO]}),yield*this._iterateVariableReferences(ei(this.globalScope,e.local),t,a,!1);return}if("ImportNamespaceSpecifier"===n)return void(yield*this._iterateVariableReferences(ei(this.globalScope,e.local),t,r,!1));if("ExportSpecifier"===n){let n="Identifier"===e.local.type?e.local.name:e.local.value;if(!eM(r,n))return;t=t.concat(n);let o=r[n];o[eO]&&(yield{node:e,path:t,type:eO,info:o[eO]})}}}function eK(e,t){return 1!==t||"default"!==e}ez.READ=eO,ez.CALL=eq,ez.CONSTRUCT=eU,ez.ESM=eW;let eG=Symbol("SYNTAX_OPENING_PARENTHESIS_INITIAL_VALUE");function*eJ(e,t){if(!e||!e.parent||"CatchClause"===e.parent.type&&e.parent.param===e)return;let r=eG,n=[e,e];for(;n=function([e,t],r){let n=r.sourceCode.getTokenBefore(e);if(!n||!ed(n))return;let o=r.sourceCode.getTokenAfter(t);if(n&&em(o))return[n,o]}(n,t);){let[o]=n;if(r===eG&&(r=function(e,t){let{parent:r}=e;switch(r.type){case"CallExpression":case"NewExpression":if(1===r.arguments.length&&r.arguments[0]===e)return t.sourceCode.getTokenAfter(r.typeArguments??r.callee,ed);return;case"DoWhileStatement":if(r.test===e)return t.sourceCode.getTokenAfter(r.body,ed);return;case"IfStatement":case"WhileStatement":if(r.test===e)return t.sourceCode.getFirstToken(r,1);return;case"ImportExpression":if(r.source===e)return t.sourceCode.getFirstToken(r,1);return;case"SwitchStatement":if(r.discriminant===e)return t.sourceCode.getFirstToken(r,1);return;case"WithStatement":if(r.object===e)return t.sourceCode.getFirstToken(r,1)}}(e,t)),o===r)break;yield n}}let eX=new WeakMap;function eY(e,t){if(!e||!eX.has(e)){let r=[];for(let[n,o]of eJ(e,t))r.unshift(n),r.push(o);eX.set(e,r)}return eX.get(e)}function eH(e,t){let r=eY(e,t),[n]=t.sourceCode.getRange(r[0]??e),[,o]=t.sourceCode.getRange(r.at(-1)??e);return[n,o]}function eZ(e,t){let[r,n]=eH(e,t);return t.sourceCode.text.slice(r,n)}function eQ(e,t){if(eX.has(e))return eX.get(e).length>0;let r=eJ(e,t).next().done;return r&&eX.set(e,[]),!r}function e0(e,t){return e?.type==="Literal"&&e.value===t}let e1=e=>e?.type==="Literal"&&"string"==typeof e.value,e2=(e,t)=>e?.type==="Literal"&&"boolean"==typeof e.value&&(void 0===t||e.value===t),e3=e=>e1(e)?e.value:e?.type==="TemplateLiteral"&&0===e.expressions.length?e.quasis[0].value.cooked:void 0,e8=e=>"Literal"===e.type&&"number"==typeof e.value,e6=e=>"Literal"===e.type&&!!e.regex,e9=e=>e?.type==="Literal"&&"null"===e.raw,e5=e=>"Literal"===e.type&&!!e.bigint;function e4(e,t,r){if(!r.includes(e?.type))return!1;"string"==typeof t&&(t={names:[t]}),Array.isArray(t)&&(t={names:t});let{name:n,names:o,argumentsLength:a,minimumArguments:i,maximumArguments:s,allowSpreadElement:l,optional:u}={minimumArguments:0,maximumArguments:1/0,allowSpreadElement:!1,...t};if(n&&(o=[n]),!0===u&&e.optional!==u||!1===u&&e.optional||"number"==typeof a&&e.arguments.length!==a||0!==i&&e.arguments.length<i||Number.isFinite(s)&&e.arguments.length>s)return!1;if(!l){let t=Number.isFinite(s)?s:a;if("number"==typeof t&&e.arguments.some((e,r)=>"SpreadElement"===e.type&&r<t))return!1}return!Array.isArray(o)||!(o.length>0)||"Identifier"===e.callee.type&&!!o.includes(e.callee.name)}let e7=(e,t)=>e4(e,t,["CallExpression"]),te=(e,t)=>{if("boolean"==typeof t?.optional)throw TypeError("Cannot check node.optional in `isNewExpression`.");return e4(e,t,["NewExpression"])},tt=(e,t)=>e4(e,t,["CallExpression","NewExpression"]),tr=e=>"ExpressionStatement"===e.type&&"string"==typeof e.directive;function tn(e,t){let{type:r}=e;return"BlockStatement"===r?e.body.every(e=>tn(e,t)):"EmptyStatement"===r||!!t?.(e)}let to=e=>"ArrayExpression"===e.type&&0===e.elements.length,ta=e=>"ObjectExpression"===e.type&&0===e.properties.length;function ti(e){return"ExpressionStatement"===e.type||"ChainExpression"===e.type&&"ExpressionStatement"===e.parent.type}let ts=["FunctionDeclaration","FunctionExpression","ArrowFunctionExpression"];function tl(e){return ts.includes(e.type)}let tu=["DoWhileStatement","ForInStatement","ForOfStatement","ForStatement","WhileStatement"];function tp(e){return tu.includes(e.type)}function tc(e,t){if(e?.type!=="MemberExpression")return!1;"string"==typeof t&&(t={properties:[t]}),Array.isArray(t)&&(t={properties:t});let{property:r,properties:n,object:o,objects:a,optional:i,computed:s}={property:"",properties:[],object:"",...t};if(r&&(n=[r]),o&&(a=[o]),!0===i&&e.optional!==i||!1===i&&e.optional)return!1;if(Array.isArray(n)&&n.length>0){if("Identifier"!==e.property.type||!n.includes(e.property.name))return!1;s??=!1}return!(!0===s&&e.computed!==s||!1===s&&e.computed||Array.isArray(a)&&a.length>0&&("Identifier"!==e.object.type||!a.includes(e.object.name)))}function td(e,t){"string"==typeof t&&(t={methods:[t]}),Array.isArray(t)&&(t={methods:t});let{optionalCall:r,optionalMember:n,method:o,methods:a}={method:"",methods:[],...t};return e7(e,{argumentsLength:t.argumentsLength,minimumArguments:t.minimumArguments,maximumArguments:t.maximumArguments,allowSpreadElement:t.allowSpreadElement,optional:r})&&tc(e.callee,{object:t.object,objects:t.objects,computed:t.computed,property:o,properties:a,optional:n})}function tm(e){return e?.type==="UnaryExpression"&&"-"===e.operator&&e8(e.argument)&&1===e.argument.value}let tf=e=>e7(e,{name:"require",argumentsLength:1,optional:!1})&&e1(e.arguments[0]);function tg(e,t){let r=t.trim().split(".");for(let t=r.length-1;t>=0;t--){let n=r[t];if(!n)return!1;if(0===t)return"Identifier"===e.type&&e.name===n||"this"===n&&"ThisExpression"===e.type||"super"===n&&"Super"===e.type;if(1===t&&"MetaProperty"===e.type&&"Identifier"===e.property.type&&e.property.name===n){e=e.meta;continue}if("MemberExpression"===e.type&&!e.optional&&!e.computed&&"Identifier"===e.property.type&&e.property.name===n){e=e.object;continue}return!1}}function ty(e,t){return t.some(t=>tg(e,t))}function th(e,t){return"TemplateLiteral"===e.type&&"TaggedTemplateExpression"===e.parent.type&&e.parent.quasi===e&&(!t||ty(e.parent.tag,t))}function tx(e){return e?.type==="Identifier"&&"undefined"===e.name}let tb=(e,t)=>(function(e,t){let{object:r,property:n,properties:o}={property:"",properties:[],...t};if(!tc(e,{property:n,properties:o,optional:!1}))return;let a=e.object;return tc(a,{object:r,property:"prototype",optional:!1})||"Array"===r&&to(a)||"Object"===r&&ta(a)})(e,{...t,object:"Array"}),tE=e=>e?.type==="LogicalExpression"&&("&&"===e.operator||"||"===e.operator),tD=e=>e?.type==="UnaryExpression"&&"!"===e.operator,tS=e=>tD(e.parent)&&e.parent.argument===e,tv=(e,t)=>tC(e.parent,t)&&e.parent.arguments[0]===e,tC=(e,t)=>e?.type==="CallExpression"&&!e.optional&&"Identifier"===e.callee.type&&"Boolean"===e.callee.name&&1===e.arguments.length&&"SpreadElement"!==e.arguments[0].type&&((e,t)=>{let{sourceCode:r}=t;if(r.isGlobalReference(e))return!0;let n=ei(r.getScope(e),e);return!n||0===n.defs.length})(e.callee,t);function tA(e,t){return!!(tD(e)||tS(e)||tC(e,t)||tv(e,t))||!!tE(e.parent)&&tA(e.parent,t)}function tT(e){let t;return t=e.parent,!!(t?.type==="VExpressionContainer"&&"VAttribute"===t.parent.type&&t.parent.directive&&t.parent.value===t&&"VDirectiveKey"===t.parent.key.type&&"VIdentifier"===t.parent.key.name.type&&["if","else-if","show"].includes(t.parent.key.name.rawName)||["IfStatement","ConditionalExpression","WhileStatement","DoWhileStatement","ForStatement"].includes(e.parent.type)&&e.parent.test===e)||!!tE(e.parent)&&tT(e.parent)}function tw(e,{test:t,expected:r,ruleId:n}){if(t?.(e)||(r=(r=Array.isArray(r)?r:[r]).map(e=>"string"==typeof e?{value:e}:e),!t&&r.some(t=>Object.entries(t).every(([t,r])=>e[t]===r))))return;let o=`'${JSON.stringify({value:e.value,type:e.type})}'`;r=r.map(e=>`'${JSON.stringify(e)}'`).join(" or ");let a=`\`${n}\`: Unexpected token ${o}`,i=`https://github.com/sindresorhus/eslint-plugin-unicorn/issues/new?title=${encodeURIComponent(a)}`;throw Error(`Expected token ${r}, got ${o}.
|
|
2
|
+
Please open an issue at ${i}.`)}function tk(e,t){if("AwaitExpression"===e.type||"YieldExpression"===e.type||"ForOfStatement"===e.type&&e.await)return!0;if(tl(e))return!1;for(let r of t[e.type]??[]){let n=e[r];for(let e of Array.isArray(n)?n:[n])if(e?.type&&tk(e,t))return!0}return!1}function tI(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var tj=tI(function(){if(n)return r;n=1;let e={},t=e.hasOwnProperty,o=(e,r)=>{for(let n in e)t.call(e,n)&&r(n,e[n])},a=e=>"\\u"+("0000"+e).slice(-4),i=(e,t)=>{let r=e.toString(16);return t?r:r.toUpperCase()},s=e.toString,l=Array.isArray,u={"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},p=/[\\\b\f\n\r\t]/,c=/[0-9]/,d=/[\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,m=/([\uD800-\uDBFF][\uDC00-\uDFFF])|([\uD800-\uDFFF])|(['"`])|[^]/g,f=/([\uD800-\uDBFF][\uDC00-\uDFFF])|([\uD800-\uDFFF])|(['"`])|[^ !#-&\(-\[\]-_a-~]/g,g=(e,t)=>{let r,n,y=()=>{v=S,++t.indentLevel,S=t.indent.repeat(t.indentLevel)},h={escapeEverything:!1,minimal:!1,isScriptContext:!1,quotes:"single",wrap:!1,es6:!1,json:!1,compact:!0,lowercaseHex:!1,numbers:"decimal",indent:" ",indentLevel:0,__inline1__:!1,__inline2__:!1},x=t&&t.json;x&&(h.quotes="double",h.wrap=!0),"single"!=(!(R=t)||o(R,(e,t)=>{h[e]=t}),t=h).quotes&&"double"!=t.quotes&&"backtick"!=t.quotes&&(t.quotes="single");let b="double"==t.quotes?'"':"backtick"==t.quotes?"`":"'",E=t.compact,D=t.lowercaseHex,S=t.indent.repeat(t.indentLevel),v="",C=t.__inline1__,A=t.__inline2__,T=E?"":"\n",w=!0,k="binary"==t.numbers,I="octal"==t.numbers,j="decimal"==t.numbers,F="hexadecimal"==t.numbers;if(x&&e&&"function"==typeof e.toJSON&&(e=e.toJSON()),"string"!=typeof(n=e)&&"[object String]"!=s.call(n)){let n,a,i,u;if(n=e,"[object Map]"==s.call(n))return 0==e.size?"new Map()":(E||(t.__inline1__=!0,t.__inline2__=!1),"new Map("+g(Array.from(e),t)+")");if(a=e,"[object Set]"==s.call(a))return 0==e.size?"new Set()":"new Set("+g(Array.from(e),t)+")";if(i=e,"function"==typeof Buffer&&Buffer.isBuffer(i))return 0==e.length?"Buffer.from([])":"Buffer.from("+g(Array.from(e),t)+")";if(l(e)){r=[],t.wrap=!0,C&&(t.__inline1__=!1,t.__inline2__=!0),A||y();var B,R,$=e;let n=$.length,o=-1;for(;++o<n;){B=$[o],w=!1,A&&(t.__inline2__=!1),r.push((E||A?"":S)+g(B,t))}return w?"[]":A?"["+r.join(", ")+"]":"["+T+r.join(","+T)+T+(E?"":v)+"]"}if("number"==typeof(u=e)||"[object Number]"==s.call(u)||"bigint"==typeof e){let t;if(x)return JSON.stringify(Number(e));if(j)t=String(e);else if(F){let r=e.toString(16);D||(r=r.toUpperCase()),t="0x"+r}else k?t="0b"+e.toString(2):I&&(t="0o"+e.toString(8));return"bigint"==typeof e?t+"n":t}{let n;if("bigint"==typeof e)return x?JSON.stringify(Number(e)):e+"n";return(n=e,"[object Object]"==s.call(n))?(r=[],t.wrap=!0,y(),o(e,(e,n)=>{w=!1,r.push((E?"":S)+g(e,t)+":"+(E?"":" ")+g(n,t))}),w)?"{}":"{"+T+r.join(","+T)+T+(E?"":v)+"}":x?JSON.stringify(e)||"null":String(e)}}let P=t.escapeEverything?m:f;return r=e.replace(P,(e,r,n,o,s,l)=>{if(r){if(t.minimal)return r;let e=r.charCodeAt(0),n=r.charCodeAt(1);return t.es6?"\\u{"+i((e-55296)*1024+n-56320+65536,D)+"}":a(i(e,D))+a(i(n,D))}if(n)return a(i(n.charCodeAt(0),D));if("\0"==e&&!x&&!c.test(l.charAt(s+1)))return"\\0";if(o)return o==b||t.escapeEverything?"\\"+o:o;if(p.test(e))return u[e];if(t.minimal&&!d.test(e))return e;let m=i(e.charCodeAt(0),D);return x||m.length>2?a(m):"\\x"+("00"+m).slice(-2)}),"`"==b&&(r=r.replace(/\$\{/g,"\\${")),t.isScriptContext&&(r=r.replace(/<\/(script|style)/gi,"<\\/$1").replace(/<!--/g,x?"\\u003C!--":"\\x3C!--")),t.wrap&&(r=b+r+b),r};return g.version="3.0.2",r=g}());function tF(e,t="'"){if("string"!=typeof e)throw TypeError("Unexpected string.");return tj(e,{quotes:'"'===t?"double":"single",wrap:!0,es6:!0,minimal:!0,lowercaseHex:!1})}var tB={},tR={},t$={},tP=function(){var e,t;return i?tB:(i=1,Object.defineProperty(tB,"__esModule",{value:!0}),Object.defineProperty(tB,"isIdentifierChar",{enumerable:!0,get:function(){return e.isIdentifierChar}}),Object.defineProperty(tB,"isIdentifierName",{enumerable:!0,get:function(){return e.isIdentifierName}}),Object.defineProperty(tB,"isIdentifierStart",{enumerable:!0,get:function(){return e.isIdentifierStart}}),Object.defineProperty(tB,"isKeyword",{enumerable:!0,get:function(){return t.isKeyword}}),Object.defineProperty(tB,"isReservedWord",{enumerable:!0,get:function(){return t.isReservedWord}}),Object.defineProperty(tB,"isStrictBindOnlyReservedWord",{enumerable:!0,get:function(){return t.isStrictBindOnlyReservedWord}}),Object.defineProperty(tB,"isStrictBindReservedWord",{enumerable:!0,get:function(){return t.isStrictBindReservedWord}}),Object.defineProperty(tB,"isStrictReservedWord",{enumerable:!0,get:function(){return t.isStrictReservedWord}}),e=function(){if(o)return tR;o=1,Object.defineProperty(tR,"__esModule",{value:!0}),tR.isIdentifierChar=u,tR.isIdentifierName=function(e){let t=!0;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if((64512&n)==55296&&r+1<e.length){let t=e.charCodeAt(++r);(64512&t)==56320&&(n=65536+((1023&n)<<10)+(1023&t))}if(t){if(t=!1,!l(n))return!1}else if(!u(n))return!1}return!t},tR.isIdentifierStart=l;let e="\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ-ೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ--ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",t="\xb7̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ--ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",r=RegExp("["+e+"]"),n=RegExp("["+e+t+"]");e=t=null;let a=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,7,25,39,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,5,57,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,24,43,261,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7381,42,31,98,114,8702,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,208,30,2,2,2,1,2,6,3,4,10,1,225,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4381,3,5773,3,7472,16,621,2467,541,1507,4938,6,8489],i=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,78,5,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,199,7,137,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,55,9,266,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239];function s(e,t){let r=65536;for(let n=0,o=t.length;n<o&&!((r+=t[n])>e);n+=2)if((r+=t[n+1])>=e)return!0;return!1}function l(e){return e<65?36===e:e<=90||(e<97?95===e:e<=122||(e<=65535?e>=170&&r.test(String.fromCharCode(e)):s(e,a)))}function u(e){return e<48?36===e:e<58||!(e<65)&&(e<=90||(e<97?95===e:e<=122||(e<=65535?e>=170&&n.test(String.fromCharCode(e)):s(e,a)||s(e,i))))}return tR}(),t=function(){if(a)return t$;a=1,Object.defineProperty(t$,"__esModule",{value:!0}),t$.isKeyword=function(t){return e.has(t)},t$.isReservedWord=n,t$.isStrictBindOnlyReservedWord=i,t$.isStrictBindReservedWord=function(e,t){return o(e,t)||i(e)},t$.isStrictReservedWord=o;let e=new Set(["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"]),t=new Set(["implements","interface","let","package","private","protected","public","static","yield"]),r=new Set(["eval","arguments"]);function n(e,t){return t&&"await"===e||"enum"===e}function o(e,r){return n(e,r)||t.has(e)}function i(e){return r.has(e)}return t$}(),tB)}(),tL=tI(tP);function tN(e,t){for(;t;){let r=t.set.get(e);if(r)return r;t=t.upper}}let tM=e=>[e,...e.childScopes.flatMap(e=>tM(e))],tO=e=>[...new Set(tM(e).flatMap(({references:e})=>e))],{isIdentifierName:tq,isStrictReservedWord:tU,isKeyword:tW}=tL,t_=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","as","implements","interface","let","package","private","protected","public","static","yield","any","boolean","constructor","declare","get","module","require","number","set","string","symbol","type","from","of"]),tV=e=>"string"==typeof e&&!tW(e)&&!tU(e,!0)&&tq(e)&&"arguments"!==e&&!t_.has(e),tz=(e,t)=>t.every(t=>!(tN(e,t)||tO(t).some(({identifier:t,resolved:r})=>t?.name===e&&!r))),tK=()=>!0;function tG(e,t,r=tK){if(tV(e)||tV(e+="_")){for(;!tz(e,t)||!r(e,t);)e+="_";return e}}function tJ(e,t){if(e.arguments.length>0)return!0;let{sourceCode:r}=t,[n,o]=r.getLastTokens(e,2);return ed(n)&&em(o)&&r.getRange(e.callee)[1]<r.getRange(e)[1]}function tX(e,t){let{sourceCode:r}=t,n=e.typeArguments??e.callee,o=r.getTokenAfter(n,ed),[a,i]=r.getLastTokens(e,2);return{openingParenthesisToken:o,closingParenthesisToken:i,trailingCommaToken:eu(a)?a:void 0}}function tY(e,t,r=!0){let{sourceCode:n}=e,{openingParenthesisToken:o,closingParenthesisToken:a,trailingCommaToken:i}=tX(t,e),[,s]=n.getRange(o),[l]=n.getRange(r?a:i??a);return n.text.slice(s,l)}function tH(e){let t;switch(e?.type){case"MemberExpression":t=e.property;break;case"ChainExpression":return tH(e.expression);case"Property":case"MethodDefinition":t=e.key}if(t){if("Identifier"===t.type&&!e.computed)return t.name;let r=ew(t);if(!r)return;return String(r.value)}}function tZ(e){return["ChainExpression","TSAsExpression","TSSatisfiesExpression","TSTypeAssertion","TSNonNullExpression"].includes(e.type)?tZ(e.expression):e}function tQ(e,t){if(e=tZ(e),t=tZ(t),e.type!==t.type)return!1;switch(e.type){case"Super":case"ThisExpression":return!0;case"Identifier":case"PrivateIdentifier":return e.name===t.name;case"Literal":var r,n;return r=e,n=t,r.regex||n.regex?!!(r.regex&&n.regex&&r.regex.pattern===n.regex.pattern&&r.regex.flags===n.regex.flags):r.bigint||n.bigint?r.bigint===n.bigint:r.value===n.value;case"MemberExpression":{let r=tH(e);if(void 0!==r)return tQ(e.object,t.object)&&r===tH(t);return e.computed===t.computed&&tQ(e.object,t.object)&&tQ(e.property,t.property)}default:return!1}}let t0=e=>null===e||"object"!=typeof e&&"function"!=typeof e,t1=(e,t)=>{if(!e)return{value:void 0};let{sourceCode:r}=t,n=ew(e,r.getScope(e));if(n&&t0(n.value))return{value:n.value}},t2=(e,t,r)=>{let n=t1(e,r),o=t1(t,r);if(n&&o){let e,t;return(e=n.value)===(t=o.value)||"number"==typeof e&&"number"==typeof t&&Number.isNaN(e)&&Number.isNaN(t)}return!!e&&!!t&&"Literal"!==e.type&&"Literal"!==t.type&&tQ(e,t)},t3=(e,t)=>{let r=[],n=[];for(let o of e)o?.type!=="SpreadElement"&&(r.some(e=>t2(e,o,t))&&n.push(o),r.push(o));return n};function t8(e,t){let{sourceCode:r}=t,{start:{line:n,column:o}}=r.getLoc(e);return r.getLines()[n-1].slice(0,o).match(/\s*$/)[0]}function t6(e){let{sourceCode:t}=e,r=t.getAllComments?.();return r?.length?r:t.comments??[]}let t9=(e,t)=>Array.isArray(t)?t:e.sourceCode.getRange(t),t5=([e,t],[r,n])=>e>=r&&t<=n;function t4(e,t,r=[]){let{sourceCode:n}=e,o=t9(e,t),a=r.map(t=>t9(e,t));return t6(e).some(e=>{let t=n.getRange(e);return t5(t,o)&&a.every(e=>!t5(t,e))})}function t7(e,t){let{sourceCode:r}=e,n=r.getLoc(t).end.line;return r.getCommentsAfter(t).findLast(e=>r.getLoc(e).start.line===n)}let re=(e,[t,r])=>{let{sourceCode:n}=e;return n.getAllComments().some(e=>{let[o,a]=n.getRange(e);return o>=t&&a<=r})},rt=new Set(["ClassDeclaration","FunctionDeclaration","TSEnumDeclaration","TSInterfaceDeclaration","TSModuleDeclaration","TSTypeAliasDeclaration"]),rr=e=>"VariableDeclaration"===e.type&&"var"!==e.kind||rt.has(e.type),rn=e=>rr(e)||"BlockStatement"===e.type&&e.body.some(e=>rr(e)),ro=(e,t)=>{let{sourceCode:r}=t;return r.getTokens(e).some(e=>r.getLoc(e).start.line!==r.getLoc(e).end.line)};function ra(e,t){if("Identifier"!==e.type)return;let r=ei(t.sourceCode.getScope(e),e);if(!r||1!==r.defs.length)return;let[n]=r.defs;if("Variable"===n.type&&"VariableDeclarator"===n.node.type&&"VariableDeclaration"===n.parent.type&&"const"===n.parent.kind)return n.node.init}function ri(e,t){let{sourceCode:r}=t,[,n]=eH(e.object,t);return[n,e.computed?r.getRange(r.getTokenBefore(e.property,e=>"["===e.value))[1]:r.getRange(e.property)[0]]}let rs=new Set(["depth","height","width"]);function rl(e){return tc(e,{properties:["length","size"],optional:!1})}function ru(e){return/\.(?:ts|mts|cts|tsx)$/i.test(e)}let rp=["Program","StyleSheet","Document","root"];function rc(e,t){let{sourceCode:r}=e;return r.parserServices.getTemplateBodyTokenStore&&r.ast.templateBody&&r.getRange(r.ast.templateBody)[0]<=r.getRange(t)[0]&&r.getRange(t)[1]<=r.getRange(r.ast.templateBody)[1]?r.parserServices.getTemplateBodyTokenStore():r}let rd=({identifiers:e,references:t})=>[...new Set([...e,...t.map(({identifier:e})=>e)])];function rm(e,t){if(!e)return!1;if("ThisExpression"===e.type||"Super"===e.type||"MetaProperty"===e.type&&"new"===e.meta.name&&"target"===e.property.name||"Identifier"===e.type&&"arguments"===e.name||"CallExpression"===e.type&&"Identifier"===e.callee.type&&"eval"===e.callee.name)return!0;for(let r of t[e.type]??[]){let n=e[r];if(Array.isArray(n)){for(let e of n)if(rm(e,t))return!0}else if(rm(n,t))return!0}return!1}let rf=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion"]),rg=e=>rf.has(e?.type);function ry(e){for(;rg(e);)e=e.expression;return e}function rh(e){let t;return(e=ry(e),e?.type==="ChainExpression")?rh(e.expression):(t=e,(t?.type==="MemberExpression"||t?.type==="CallExpression")&&(!!e.optional||("MemberExpression"===e.type?rh(e.object):rh(e.callee))))}let rx=(e,t)=>{let{references:r=[]}=ei(e,t)||{};return r};function rb(e,t){if(t.block!==e)throw Error('"functionScope" should be the scope of "functionNode".');let{type:r,id:n}=e;return"ArrowFunctionExpression"!==r&&(!!(t.thisFound||rx(t,"arguments").some(({from:e})=>e===t))||!!(n&&rx(t,n).length>0))}let rE=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float16Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"],rD=new Set(["any","error","unknown"]),rS=new Set(["null","undefined"]),rv=e=>e.getSymbol()??e.aliasSymbol,rC=(e,t)=>e?.declarations?.some(e=>t.isSourceFileDefaultLibrary(e.getSourceFile()))??!1;function rA(e,t){try{return t.getBaseTypes(e)??e.getBaseTypes?.()??[]}catch{return[]}}let rT="target",rw="non-target",rk="unknown",rI=new Set(["ClassDeclaration","ClassExpression"]),rj=new Set(["FunctionDeclaration","FunctionExpression"]),rF=new Set(["ClassName","ImportBinding","TSEnumName","Type"]),rB=new Set(["TSBigIntKeyword","TSBooleanKeyword","TSNeverKeyword","TSNullKeyword","TSNumberKeyword","TSStringKeyword","TSSymbolKeyword","TSUndefinedKeyword","TSVoidKeyword","TSArrayType","TSLiteralType","TSTupleType","TSTypeLiteral","TSFunctionType","TSConstructorType"]),rR=(e,t)=>e.every(e=>e===rT)?rT:(t.treatMixedUnionAsNonTarget?e.includes(rw):e.every(e=>e===rw))?rw:rk,r$=e=>e.includes(rT)?rT:e.every(e=>e===rw)?rw:rk,rP=e=>{if("Identifier"===e.type)return e.name;if("TSQualifiedName"===e.type){let t=rP(e.left);return t?`${t}.${e.right.name}`:void 0}},rL=(e,t)=>{let r=t.typeReferenceAliases?.get(e);return t.targetTypeNames.has(e)||r&&t.targetTypeNames.has(r)?rT:t.nonTargetTypeNames?.has(e)?rw:rk};function rN(e,t,r,n=new Set){switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return rN(e.typeAnnotation,t,r,n);case"TSTypeOperator":return"readonly"===e.operator?rN(e.typeAnnotation,t,r,n):rk;case"TSTypeReference":return function e(t,r,n,o){var a,i;let s=rP(t.typeName);if(!s)return rk;if(!n.preferTypeReferenceDefinitions){let e=rL(s,n);if(e!==rk)return e}if(o.has(s))return rk;o.add(s);let l=((e,t)=>{for(;t;){let r=t.set.get(e)?.defs.find(e=>rF.has(e.type));if(r)return r;t=t.upper}})(s,r);if(!l)return o.delete(s),rL(s,n);let u=rk;return"Type"===l.type&&"TSTypeAliasDeclaration"===l.node.type?u=rN(l.node.typeAnnotation,r,n,o):"Type"===l.type&&"TSTypeParameter"===l.node.type?u=rN(l.node.constraint,r,n,o):"Type"===l.type&&"TSInterfaceDeclaration"===l.node.type?(a=l.node,u=0===a.extends.length?rw:r$(a.extends.map(t=>rP(t.expression)?e({typeName:t.expression},r,n,o):rk))):"ClassName"===l.type&&(i=l.node,u=i.superClass&&n.checkClassHeritage?"Identifier"!==i.superClass.type?rk:rO(i.superClass,r,n,o):rw),o.delete(s),u}(e,t,r,n);case"TSUnionType":return rR(e.types.map(e=>rN(e,t,r,n)),r);case"TSIntersectionType":return r$(e.types.map(e=>rN(e,t,r,n)));default:if(r.isTargetTypeAnnotation?.(e))return rT;return rB.has(e?.type)?rw:rk}}let rM=(e,t,r,n)=>e.superClass&&r.checkClassHeritage?rO(e.superClass,t,r,n):rw;function rO(e,t,r,n=new Set){if("Identifier"===e.type){let o=e.name;if(!r.checkClassHeritage)return rL(o,r);if(n.has(o))return rk;n.add(o);let a=((e,t)=>{for(;t;){let r=t.set.get(e);if(r)return r;t=t.upper}})(o,t),[i]=a?.defs??[],s=rk;return i?.type==="Variable"&&"const"===i.parent.kind&&i.node.id===i.name&&i.node.init?s=rO(i.node.init,t,r,n):i?.type==="ClassName"&&(s=rM(i.node,t,r,n)),n.delete(o),i?s:rL(o,r)}return rI.has(e.type)?rM(e,t,r,n):rk}let rq=(e,t,r)=>{let n=e.params.find(e=>"Identifier"===e.type&&"this"===e.name);return rN(n?.typeAnnotation,t.sourceCode.getScope(e),r)};function rU(e,t,r,n=new Set){if(!e)return rk;if("TSSatisfiesExpression"===e.type)return rU(e.expression,t,r,n);let o=t.sourceCode.getScope(e),a=rN(e.typeAnnotation,o,r);if(a!==rk)return a;let i=((e,t,r,n)=>{let o=t.sourceCode.getScope(e);switch(e.type){case"Identifier":return((e,t,r,n)=>{let o=ei(t.sourceCode.getScope(e),e);if(!o||n.has(o)||1!==o.defs.length)return rk;n.add(o);let[a]=o.defs,i=t.sourceCode.getScope(a.name),s=rN(a.name?.typeAnnotation,i,r),l=rk;return s!==rk?l=s:"Variable"===a.type&&"const"===a.parent.kind&&a.node.id===a.name&&a.node.init&&(l=rU(a.node.init,t,r,n)),n.delete(o),l})(e,t,r,n);case"ThisExpression":return r.checkClassSyntax?((e,t,r)=>{for(let{parent:n}=e;n;n=n.parent){if(rI.has(n.type))return rM(n,t.sourceCode.getScope(n),r);if("StaticBlock"===n.type||"PropertyDefinition"===n.type&&n.static)return rw;if(rj.has(n.type)){let e=rq(n,t,r);if(e!==rk)return e;if(n.parent?.type==="Property"&&n.parent.parent?.type==="ObjectExpression")return rw;if(n.parent?.type==="MethodDefinition"){if(n.parent.static)return rw;continue}break}}return rk})(e,t,r):rk;case"NewExpression":let a,i;return r.checkClassSyntax?(a=e.callee,rO(a,t.sourceCode.getScope(a),r,i)):rk;case"TSAsExpression":case"TSTypeAssertion":{let a=rN(e.typeAnnotation,o,r);return a===rk?rU(e.expression,t,r,n):a}case"TSNonNullExpression":case"ParenthesizedExpression":return rU(e.expression,t,r,n);case"SequenceExpression":return rU(e.expressions.at(-1),t,r,n);case"ConditionalExpression":return rR([rU(e.consequent,t,r,n),rU(e.alternate,t,r,n)],r);default:return rk}})(e,t,r,n);if(i!==rk)return i;if("Identifier"!==e.type){let t,n=(t=ew(e,o))?r.getStaticType?.(t.value,e)??rk:rk;if(n!==rk)return n}if(r.isTargetNode?.(e,t)||r.targetConstructorNames?.some(t=>te(e,{name:t}))||r.targetCallNames?.some(t=>e7(e,{name:t})))return rT;let s=((e,t,r)=>{let{parserServices:n}=t.sourceCode;if(!n?.program)return rk;try{let{program:t}=n;return function e(t,r,n,o){if(rD.has(t.intrinsicName))return rk;if(rS.has(t.intrinsicName))return rw;if(t.isTypeParameter?.()){let a=t.getConstraint();return a?e(a,r,n,o):rk}if(t.isUnion())return rR(t.types.map(t=>e(t,r,n,o)),o);if(t.isIntersection())return r$(t.types.map(t=>e(t,r,n,o)));if(o.isTargetType?.(t,r,n))return rT;let a=r.getBaseConstraintOfType(t);if(a&&a!==t)return e(a,r,n,o);if(o.checkClassHeritage&&rA(t,r).some(t=>e(t,r,n,o)===rT))return rT;if(t.intrinsicName)return rw;let i=rv(t);if(!i)return rk;let s=i.getName(),l=o.typeReferenceAliases?.get(s);return o.targetTypeNames.has(s)||l&&o.targetTypeNames.has(l)?rT:rw}(n.getTypeAtLocation(e),t.getTypeChecker(),t,r)}catch{return rk}})(e,t,r);return s!==rk?s:r.isNonTargetNode?.(e,t)?rw:rk}let rW=e=>(e={checkClassHeritage:!0,checkClassSyntax:!1,...e},{getType:(t,r,n)=>rU(t,r,{...e,...n}),isTarget:(t,r,n)=>rU(t,r,{...e,...n})===rT,isKnownNonTarget:(t,r,n)=>rU(t,r,{...e,...n})===rw}),r_=({name:e,aliases:t=[],checkConstructor:r=!0,...n})=>rW({...n,targetTypeNames:new Set([e]),typeReferenceAliases:new Map(t.map(t=>[t,e])),targetConstructorNames:r?[e]:void 0}),rV=new Set(["ObjectExpression","FunctionExpression","ArrowFunctionExpression","ClassExpression","TemplateLiteral"]),rz=new Set([...rE,"Map","ReadonlyMap","WeakMap","Set","ReadonlySet","WeakSet"]),{isTarget:rK,isKnownNonTarget:rG}=rW({checkClassHeritage:!1,preferTypeReferenceDefinitions:!0,targetTypeNames:new Set(["Array","ReadonlyArray"]),nonTargetTypeNames:rz,targetCallNames:["Array"],targetConstructorNames:["Array"],isTargetNode:e=>"ArrayExpression"===e.type||td(e,{object:"Array",methods:["from","of"],optionalCall:!1,optionalMember:!1}),isNonTargetNode:e=>"NewExpression"===e.type||rV.has(e.type),isTargetTypeAnnotation:e=>e?.type==="TSArrayType"||e?.type==="TSTupleType",isTargetType:(e,t)=>t.isArrayType(e)||t.isTupleType(e),getStaticType:(e,t)=>Array.isArray(e)?rT:"Identifier"===t.type||"MemberExpression"===t.type?rk:rw}),rJ=new Set(["ArrayExpression","FunctionExpression","Literal","ObjectExpression","TemplateLiteral"]);function rX(e,t){return!rJ.has(e.type)&&rG(e,t)}let{isTarget:rY}=r_({name:"Set",aliases:["ReadonlySet"],getStaticType:e=>e instanceof Set?rT:rk}),{isTarget:rH}=r_({name:"Map",aliases:["ReadonlyMap"],getStaticType:e=>e instanceof Map?rT:rk}),rZ=new Set(["CharacterData","Document","DocumentFragment","Element","HTMLElement","Node","SVGElement","Text"]),rQ=new Set(["KeyboardEvent","React.KeyboardEvent"]),r0=new Set(["Event","MouseEvent","PointerEvent","React.MouseEvent","React.PointerEvent"]),{isKnownNonTarget:r1}=rW({targetTypeNames:rZ,getStaticType:e=>{let{Node:t}=globalThis;return"function"==typeof t&&e instanceof t?rT:rk}}),{isKnownNonTarget:r2}=rW({targetTypeNames:rQ,nonTargetTypeNames:r0}),r3=e=>("AssignmentExpression"===e.parent.type||"AssignmentPattern"===e.parent.type)&&e.parent.left===e||"UpdateExpression"===e.parent.type&&e.parent.argument===e||"ArrayPattern"===e.parent.type&&e.parent.elements.includes(e)||"RestElement"===e.parent.type&&e.parent.argument===e||"Property"===e.parent.type&&e.parent.value===e&&"ObjectPattern"===e.parent.parent.type&&e.parent.parent.properties.includes(e.parent)||"UnaryExpression"===e.parent.type&&"delete"===e.parent.operator&&e.parent.argument===e,r8=(e,t)=>"CallExpression"===e.type&&!e.optional&&"Identifier"===e.callee.type&&e.callee.name===t,r6=(e,t,r)=>"MemberExpression"===e.type&&!e.computed&&!e.optional&&"Identifier"===e.object.type&&e.object.name===t&&"Identifier"===e.property.type&&r.has(e.property.name),r9=new Set(["E","LN2","LN10","LOG2E","LOG10E","PI","SQRT1_2","SQRT2"]),r5=new Set(["abs","acos","acosh","asin","asinh","atan","atanh","atan2","cbrt","ceil","clz32","cos","cosh","exp","expm1","floor","fround","hypot","imul","log","log1p","log10","log2","max","min","pow","random","round","sign","sin","sinh","sqrt","tan","tanh","trunc"]),r4=new Set(["EPSILON","MAX_SAFE_INTEGER","MAX_VALUE","MIN_SAFE_INTEGER","MIN_VALUE","NaN","NEGATIVE_INFINITY","POSITIVE_INFINITY"]),r7=new Set(["parseFloat","parseInt"]),ne=e=>e?.type==="TSNumberKeyword"||e?.type==="TSLiteralType"&&e8(e.literal),nt=new Set(["-","*","/","%","**","<<",">>","|","^","&"]);function nr(e,t){let r;if(e8(e)||r6(e,"Math",r9)||"CallExpression"===e.type&&!e.optional&&r6(e.callee,"Math",r5)||r8(e,"Number")||r6(e,"Number",r4)||"CallExpression"===e.type&&!e.optional&&r6(e.callee,"Number",r7)||r8(e,"parseInt")||r8(e,"parseFloat")||"MemberExpression"===e.type&&!e.computed&&!e.optional&&"Identifier"===e.property.type&&"length"===e.property.name)return!0;switch(e.type){case"AssignmentExpression":{let{operator:r}=e;if("="===r&&nr(e.right,t))return!0}case"BinaryExpression":{let{operator:r}=e;if("AssignmentExpression"===e.type&&(r=r.slice(0,-1)),"+"===r&&nr(e.left,t)&&nr(e.right,t)||">>>"===r||nt.has(r)&&(nr(e.left,t)||nr(e.right,t)))return!0;break}case"UnaryExpression":{let{operator:r}=e;if("+"===r||("-"===r||"~"===r)&&nr(e.argument,t))return!0;break}case"UpdateExpression":if(nr(e.argument,t))return!0;break;case"ConditionalExpression":{let r=nr(e.consequent,t),n=nr(e.alternate,t);if(r&&n)return!0;let o=ew(e.test,t);if(null!==o&&(r&&o.value||n&&!o.value))return!0;break}case"SequenceExpression":if(nr(e.expressions.at(-1),t))return!0;break;case"Identifier":if((r=ei(t,e))&&r.defs.some(e=>ne(e.name?.typeAnnotation?.typeAnnotation)))return!0;break;case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":if(ne(e.typeAnnotation))return!0;break;case"TSNonNullExpression":if(nr(e.expression,t))return!0}return"number"==typeof ew(e,t)?.value}rW({targetTypeNames:new Set,targetCallNames:["Number"],isTargetTypeAnnotation:ne,isTargetType:e=>e.isNumberLiteral?.()||"number"===e.intrinsicName,getStaticType:e=>"number"==typeof e?rT:rk});let nn=new Set([">",">=","<","<=","==","===","!=","!==","in","instanceof"]),no=new Set(["boolean","true","false"]),na=new Set(["isFinite","isNaN"]),ni=new Map([["Array",new Set(["isArray"])],["ArrayBuffer",new Set(["isView"])],["Atomics",new Set(["isLockFree"])],["Number",new Set(["isFinite","isInteger","isNaN","isSafeInteger"])],["Object",new Set(["hasOwn","is","isExtensible","isFrozen","isSealed"])],["Reflect",new Set(["deleteProperty","has"])],["URL",new Set(["canParse"])]]),ns=new Map([["array",new Set(["every","includes","some"])],["map",new Set(["has"])],["regexp",new Set(["test"])],["set",new Set(["has","isDisjointFrom","isSubsetOf","isSupersetOf"])],["string",new Set(["endsWith","includes","isWellFormed","startsWith"])],["weakSet",new Set(["has"])]]),nl=new Map([["regexp",new Set(["dotAll","global","hasIndices","ignoreCase","multiline","sticky","unicode","unicodeSets"])]]);function nu(e,t){let{parserServices:r}=t.sourceCode;if(!r?.program)return!1;try{return function e(t,r){if(!t)return!1;if(t.isUnion?.())return t.types.every(t=>e(t,r));let n=r.getBaseConstraintOfType(t);return n&&n!==t?e(n,r):no.has(r.typeToString(t))}(r.getTypeAtLocation(e),r.program.getTypeChecker())}catch{return!1}}function np(e){if(e?.type==="Identifier")return e.name}function nc(e,t,r,n=new Set){switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return nc(e.typeAnnotation,t,r,n);case"TSBooleanKeyword":return!0;case"TSLiteralType":return"boolean"==typeof e.literal.value;case"TSTypeReference":return function(e,t,r,n){let o=np(e.typeName);if(!o||n.has(o))return!1;n.add(o);let a=tN(o,r),[i]=a?.defs??[],s=i?.type==="Type"&&"TSTypeAliasDeclaration"===i.node.type&&nc(i.node.typeAnnotation,t,r,n);return n.delete(o),s}(e,t,r,n);case"TSTypePredicate":return!e.asserts;case"TSUnionType":return e.types.every(e=>nc(e,t,r,n));case"TypeAnnotation":return e.typeAnnotation?.type==="BooleanTypeAnnotation";default:return!1}}function nd(e,t,r,n=new Set){switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return nd(e.typeAnnotation,t,r,n);case"TSFunctionType":return nc(e.returnType,t,r,n);case"TSTypeReference":return function(e,t,r,n){let o=np(e.typeName);if(!o||n.has(o))return!1;n.add(o);let a=tN(o,r),[i]=a?.defs??[],s=i?.type==="Type"&&("TSTypeAliasDeclaration"===i.node.type&&nd(i.node.typeAnnotation,t,r,n)||"TSInterfaceDeclaration"===i.node.type&&i.node.body.body.filter(e=>"TSCallSignatureDeclaration"===e.type).every(e=>nc(e.returnType,t,r,n))&&i.node.body.body.some(e=>"TSCallSignatureDeclaration"===e.type));return n.delete(o),s}(e,t,r,n);case"TSUnionType":return e.types.every(e=>nd(e,t,r,n));default:return!1}}function nm(e,t,r=new Set){if(e.async||e.generator)return!1;let n=t.sourceCode.getScope(e);return!!nc(e.returnType,t,n)||!!e.body&&("BlockStatement"===e.body.type&&1===e.body.body.length&&"ReturnStatement"===e.body.body[0].type?ny(e.body.body[0].argument,t,r):"ArrowFunctionExpression"===e.type&&"BlockStatement"!==e.body.type&&ny(e.body,t,r))}function nf(e,t,r=new Set){if(e?.type!=="Identifier")return!1;let n=ei(t.sourceCode.getScope(e),e);if(!n||r.has(n))return!1;r.add(n);let o=!1;if(n.defs.length>1&&n.defs.every(e=>"FunctionName"===e.type)){let e=n.defs.filter(e=>"TSDeclareFunction"===e.node.type),a=e.length>0?e:n.defs;o=n.references.every(e=>!e.writeExpr)&&a.every(e=>nm(e.node,t,r))}else if(1===n.defs.length){let[e]=n.defs,a=t.sourceCode.getScope(e.name);if(nd(e.name?.typeAnnotation,t,a))o=!0;else{let a;"FunctionName"===e.type?n.references.every(e=>!e.writeExpr)&&(a=e.node):"Variable"===e.type&&"const"===e.parent.kind&&["ArrowFunctionExpression","FunctionExpression"].includes(e.node.init?.type)&&(a=e.node.init),o=!!a&&nm(a,t,r)}}return r.delete(n),o}function ng(e,t,r=new Set){switch(e?.type){case"ArrayExpression":return"array";case"Literal":return"string"==typeof e.value?"string":e.regex?"regexp":void 0;case"TemplateLiteral":return 0===e.expressions.length?"string":void 0;case"NewExpression":if("Identifier"===e.callee.type&&t.sourceCode.isGlobalReference(e.callee)){if("RegExp"===e.callee.name)return"regexp";if(["Map","WeakMap"].includes(e.callee.name))return"map";if("Set"===e.callee.name)return"set";if("WeakSet"===e.callee.name)return"weakSet"}return;case"Identifier":return function(e,t,r){let n=ei(t.sourceCode.getScope(e),e),[o]=n?.defs??[];if(!n||r.has(n)||1!==n.defs.length||"Variable"!==o.type||"const"!==o.parent.kind)return;r.add(n);let a=ng(o.node.init,t,r);return r.delete(n),a}(e,t,r);case"ParenthesizedExpression":case"TSNonNullExpression":case"TSAsExpression":case"TSTypeAssertion":case"TSSatisfiesExpression":return ng(e.expression,t,r)}}function ny(e,t,r=new Set){if(!e)return!1;let n=t.sourceCode.getScope(e);return!!nc(e.typeAnnotation,t,n)||"boolean"==typeof ew(e,t.sourceCode.getScope(e))?.value||(function(e,t,r){switch(e.type){case"Identifier":return function(e,t,r){if(!e||r.has(e)||1!==e.defs.length)return!1;r.add(e);let[n]=e.defs,o=t.sourceCode.getScope(n.name);if(n.name?.typeAnnotation)return r.delete(e),!n.name.optional&&nc(n.name.typeAnnotation,t,o);let a="Variable"===n.type&&"const"===n.parent.kind&&ny(n.node.init,t,r);if(!a&&"Parameter"===n.type){let e=n.name.parent;a="AssignmentPattern"===e.type&&e.left===n.name&&ny(e.right,t,r)}return r.delete(e),a}(ei(t.sourceCode.getScope(e),e),t,r)||nu(e,t);case"UnaryExpression":return["!","delete"].includes(e.operator);case"LogicalExpression":return ny(e.left,t,r)&&ny(e.right,t,r);case"BinaryExpression":return nn.has(e.operator);case"ConditionalExpression":return ny(e.consequent,t,r)&&ny(e.alternate,t,r);case"TSAsExpression":case"TSTypeAssertion":case"TSSatisfiesExpression":let n;return n=t.sourceCode.getScope(e),nc(e.typeAnnotation,t,n)||ny(e.expression,t,r);case"CallExpression":return!!(function(e,t){if("MemberExpression"!==e.callee.type||"Identifier"!==e.callee.object.type||!t.sourceCode.isGlobalReference(e.callee.object))return!1;let r=ni.get(e.callee.object.name),n=eI(e.callee,t.sourceCode.getScope(e.callee));return!!r?.has(n)}(e,t)||function(e,t){if("MemberExpression"!==e.callee.type)return!1;let r=ns.get(ng(e.callee.object,t)),n=eI(e.callee,t.sourceCode.getScope(e.callee));return!!r?.has(n)}(e,t))||("Identifier"!==e.callee.type?nu(e,t):!!("Boolean"===e.callee.name&&t.sourceCode.isGlobalReference(e.callee)||na.has(e.callee.name)&&t.sourceCode.isGlobalReference(e.callee))||nf(e.callee,t,r)||nu(e,t));case"MemberExpression":return function(e,t){if("MemberExpression"!==e.type||e.optional)return!1;let r=nl.get(ng(e.object,t)),n=eI(e,t.sourceCode.getScope(e));return!!r?.has(n)}(e,t)||void 0;default:switch(e.type){case"AwaitExpression":case"YieldExpression":case"TSNonNullExpression":case"ParenthesizedExpression":return ny(e.argument??e.expression,t,r);case"SequenceExpression":return ny(e.expressions.at(-1),t,r);case"AssignmentExpression":return"="===e.operator&&ny(e.right,t,r)}return}}(e,t,r)??nu(e,t))}let nh=new Set(["asIntN","asUintN"]),nx=e=>{switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return nx(e.typeAnnotation);case"TSBigIntKeyword":return!0;case"TSLiteralType":return e5(e.literal);default:return!1}},{isTarget:nb}=rW({targetTypeNames:new Set,targetCallNames:["BigInt"],isTargetNode:e=>e5(e)||r8(e,"BigInt")||"CallExpression"===e.type&&!e.optional&&r6(e.callee,"BigInt",nh),isTargetTypeAnnotation:nx,isTargetType:e=>e.isBigIntLiteral?.()||"bigint"===e.intrinsicName,getStaticType:e=>"bigint"==typeof e?rT:rk}),nE=new Set(["fromCharCode","fromCodePoint"]),nD=e=>{switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return nD(e.typeAnnotation);case"TSStringKeyword":return!0;case"TSLiteralType":return e1(e.literal);default:return!1}},{isTarget:nS,isKnownNonTarget:nv}=rW({targetTypeNames:new Set,targetCallNames:["String"],isTargetNode:(e,t)=>{if(e1(e)||r8(e,"String")||"CallExpression"===e.type&&!e.optional&&r6(e.callee,"String",nE))return!0;switch(e.type){case"TemplateLiteral":return!0;case"UnaryExpression":return"typeof"===e.operator;case"BinaryExpression":return"+"===e.operator&&(nC(e.left,t)||nC(e.right,t));case"AssignmentExpression":if("="===e.operator)return nC(e.right,t);return"+="===e.operator&&(nC(e.left,t)||nC(e.right,t));default:return!1}},isTargetTypeAnnotation:nD,isTargetType:e=>e.isStringLiteral?.()||"string"===e.intrinsicName,getStaticType:e=>"string"==typeof e?rT:rk});function nC(e,t){return!!e&&(!!("TSSatisfiesExpression"===e.type&&nD(e.typeAnnotation)||nS(e,t))||"string"==typeof ew(e,t.sourceCode.getScope(e))?.value)}let nA=new Set(["ArrayExpression","ArrowFunctionExpression","ClassExpression","FunctionExpression","Literal","ObjectExpression","TemplateLiteral"]),nT=e=>nA.has(e.type)||tx(e),nw=new Set(["ArrayExpression","BinaryExpression","ClassExpression","Literal","ObjectExpression","TemplateLiteral","UnaryExpression","UpdateExpression"]),nk=new Set(["AssignmentExpression","AwaitExpression","NewExpression","TaggedTemplateExpression","ThisExpression"]),nI=e=>nw.has(e.type)||nk.has(e.type)||tx(e)||e7(e)&&!td(e,{method:"bind",optionalCall:!1,optionalMember:!1}),nj=(e,t)=>{if("ThisExpression"===e.type)return!0;if("FunctionDeclaration"===e.type||"FunctionExpression"===e.type)return!1;if("ClassDeclaration"===e.type||"ClassExpression"===e.type){if(e.superClass&&nj(e.superClass,t))return!0;for(let r of e.body.body)if(r.computed&&nj(r.key,t))return!0;return!1}let r=t[e.type];if(!r)return!1;for(let n of r){let r=e[n];if(r){if(Array.isArray(r)){for(let e of r)if(e&&nj(e,t))return!0;continue}if(nj(r,t))return!0}}return!1};function nF(e,t,r){let[n,o]=[e,t].map(e=>r.sourceCode.getLoc(e).start.line);return n===o}let nB=(e,t)=>"Identifier"===e.type&&"Identifier"===t.type&&e.name===t.name;function nR(e,t){return"Identifier"===e.type&&(t.sourceCode.isGlobalReference(e)||!ei(t.sourceCode.getScope(e),e))}let n$=(e,t,r)=>e&&t&&r.sourceCode.getRange(e)[0]===r.sourceCode.getRange(t)[0]&&r.sourceCode.getRange(e)[1]===r.sourceCode.getRange(t)[1],nP=(e,t)=>{let{type:r,local:n,imported:o}=e.parent;return"ImportSpecifier"===r&&n$(n,o,t)&&n===e},nL=new Set(["ArrayExpression","CallExpression","ChainExpression","Identifier","ImportExpression","Literal","MemberExpression","NewExpression","Super","TaggedTemplateExpression","TemplateLiteral","ThisExpression","TSNonNullExpression"]);function nN(e){return nL.has(e.type)}let nM=e=>"Property"===e.parent.type&&e.parent.shorthand&&e===e.parent.value,nO=e=>ti(e.parent),nq=new Set(["String","Null","Boolean","Numeric","RegularExpression"]),nU=new Set(["[","(","/","`","+","-","*",",","."]);function nW(e,t,r){if(""===r||r&&!nU.has(r.charAt(0))||!e)return!1;let{sourceCode:n}=t,{type:o,value:a}=e,i=n.getRange(e),s=n.getNodeByRangeIndex(i[0]);if("Punctuator"===o){if(";"===a)return!1;if("]"===a)return!0;if(")"===a){switch(s.type){case"IfStatement":if(n.getTokenBefore(s.consequent)===e)return!1;break;case"ForStatement":case"ForInStatement":case"ForOfStatement":case"WhileStatement":case"DoWhileStatement":case"WithStatement":if(s.body&&n.getTokenBefore(s.body)===e)return!1}return!0}}return!!nq.has(o)||("Template"===o?a.endsWith("`"):"ObjectExpression"===s.type||"Identifier"===o&&("of"!==a||"ForOfStatement"!==s.type)&&("await"!==a||"AwaitExpression"!==s.type))}let n_=e=>"type"===e.importKind||"type"===e.parent.importKind,nV=(e,t,r)=>r.sourceCode.getRange(e.name??e.node)[0]<=r.sourceCode.getRange(t)[0];function*nz(e){if("function"!=typeof e?.[Symbol.iterator])return void(yield e);for(let t of e)yield*nz(t)}class nK extends Error{name="FixAbortError"}let nG={abort(){throw new nK("Fix aborted.")}};function nJ(e){return t=>{let r=nz(e(t,nG));try{return[...r]}catch(e){if(e instanceof nK)return;throw e}}}class nX{#e;#t=new Map;constructor(e){this.#e=e}#r(e,t){let r=this.#t;for(let n of e)r.has(n)?r.get(n).push(t):r.set(n,[t])}on(e,t){let r=Array.isArray(e)?e:[e];this.#r(r,t)}onExit(e,t){let r=Array.isArray(e)?e:[e];this.#r(r.map(e=>`${e}:exit`),t)}toEslintListeners(){let e={};for(let[t,r]of this.#t)e[t]=function(e,t){return(...r)=>{for(let n of nz(t(...r))){if(!n)continue;let t=function(e){let t={...e};return e.fix&&(t.fix=nJ(e.fix)),Array.isArray(e.suggest)&&(t.suggest=e.suggest.map(t=>({...t,fix:nJ(t.fix),data:{...e.data,...t.data}}))),t}(n);e.report(t)}}}(this.#e,function*(...e){for(let t of r)yield t(...e)});return e}}let nY=new Set;function nH(e){return nY.has(e)?e:t=>{let r=new nX(t),n=e(new Proxy(t,{get:(e,t,n)=>"on"===t||"onExit"===t?r[t].bind(r):Reflect.get(e,t,n)}));return p.equal(n,void 0,`[${t.id}] Rule \`create\` function should return \`undefined\`, please use \`context.on()\` instead of return listeners.`),r.toEslintListeners()}}function nZ(e,t){var r;let{visitScriptBlock:n=!0}={},o=nH(e);return r=e=>{let t=o(e),{parserServices:r}=e.sourceCode;return r?.defineTemplateBodyVisitor?n?r.defineTemplateBodyVisitor(t,t):r.defineTemplateBodyVisitor(t):t},nY.add(r),r}function nQ(e){return["AwaitExpression","AssignmentExpression","YieldExpression","SequenceExpression","TSAsExpression","TSTypeAssertion"].includes(e.type)}let n0=/^(?:0|0[0-7]*[89]\d*|[1-9](?:_?\d)*)$/u;function n1(e){if(e8(e=ry(e)))return e.value;if("UnaryExpression"===e.type&&("+"===e.operator||"-"===e.operator)){let t=n1(e.argument);if("number"==typeof t)return"-"===e.operator?-t:t}}function n2(e,t){switch(e.type){case"Identifier":case"MemberExpression":case"CallExpression":case"ChainExpression":case"TemplateLiteral":case"ThisExpression":case"ArrayExpression":case"FunctionExpression":return!1;case"NewExpression":return!tJ(e,t);case"Literal":let r;return!!(e8(e)&&(r=e.raw,n0.test(r)));default:return!0}}let n3=new Set(["!","typeof","void","delete","~","+","-"]);function n8(e,t){if(!n3.has(t))throw Error("Unexpected operator");return["UpdateExpression","BinaryExpression","LogicalExpression","ConditionalExpression","AssignmentExpression","ArrowFunctionExpression","YieldExpression","SequenceExpression","TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion"].includes(e.type)}function n6(e,{operator:t,property:r}){if(!r)throw Error("`property` is required.");return("LogicalExpression"!==e.type||e.operator!==t)&&(!!["AwaitExpression","BinaryExpression"].includes(e.type)||["LogicalExpression","ConditionalExpression","AssignmentExpression","ArrowFunctionExpression","YieldExpression","SequenceExpression"].includes(e.type))}var n9={exports:{}},n5=n9.exports,n4=tI(function(){return s?n9.exports:(s=1,n9.exports=function(){var e=[],t=[],r={},n={},o={};function a(e){return"string"==typeof e?RegExp("^"+e+"$","i"):e}function i(e,t){return e===t?t:e===e.toLowerCase()?t.toLowerCase():e===e.toUpperCase()?t.toUpperCase():e[0]===e[0].toUpperCase()?t.charAt(0).toUpperCase()+t.substr(1).toLowerCase():t.toLowerCase()}function s(e,t,n){if(!e.length||r.hasOwnProperty(e))return t;for(var o=n.length;o--;){var a=n[o];if(a[0].test(t))return function(e,t){return e.replace(t[0],function(r,n){var o,a,s=(o=t[1],a=arguments,o.replace(/\$(\d{1,2})/g,function(e,t){return a[t]||""}));return""===r?i(e[n-1],s):i(r,s)})}(t,a)}return t}function l(e,t,r){return function(n){var o=n.toLowerCase();return t.hasOwnProperty(o)?i(n,o):e.hasOwnProperty(o)?i(n,e[o]):s(o,n,r)}}function u(e,t,r,n){return function(n){var o=n.toLowerCase();return!!t.hasOwnProperty(o)||!e.hasOwnProperty(o)&&s(o,o,r)===o}}function p(e,t,r){var n=1===t?p.singular(e):p.plural(e);return(r?t+" ":"")+n}return p.plural=l(o,n,e),p.isPlural=u(o,n,e),p.singular=l(n,o,t),p.isSingular=u(n,o,t),p.addPluralRule=function(t,r){e.push([a(t),r])},p.addSingularRule=function(e,r){t.push([a(e),r])},p.addUncountableRule=function(e){if("string"==typeof e){r[e.toLowerCase()]=!0;return}p.addPluralRule(e,"$0"),p.addSingularRule(e,"$0")},p.addIrregularRule=function(e,t){t=t.toLowerCase(),o[e=e.toLowerCase()]=t,n[t]=e},[["I","we"],["me","us"],["he","they"],["she","they"],["them","them"],["myself","ourselves"],["yourself","yourselves"],["itself","themselves"],["herself","themselves"],["himself","themselves"],["themself","themselves"],["is","are"],["was","were"],["has","have"],["this","these"],["that","those"],["echo","echoes"],["dingo","dingoes"],["volcano","volcanoes"],["tornado","tornadoes"],["torpedo","torpedoes"],["genus","genera"],["viscus","viscera"],["stigma","stigmata"],["stoma","stomata"],["dogma","dogmata"],["lemma","lemmata"],["schema","schemata"],["anathema","anathemata"],["ox","oxen"],["axe","axes"],["die","dice"],["yes","yeses"],["foot","feet"],["eave","eaves"],["goose","geese"],["tooth","teeth"],["quiz","quizzes"],["human","humans"],["proof","proofs"],["carve","carves"],["valve","valves"],["looey","looies"],["thief","thieves"],["groove","grooves"],["pickaxe","pickaxes"],["passerby","passersby"]].forEach(function(e){return p.addIrregularRule(e[0],e[1])}),[[/s?$/i,"s"],[/[^\u0000-\u007F]$/i,"$0"],[/([^aeiou]ese)$/i,"$1"],[/(ax|test)is$/i,"$1es"],[/(alias|[^aou]us|t[lm]as|gas|ris)$/i,"$1es"],[/(e[mn]u)s?$/i,"$1s"],[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i,"$1"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1i"],[/(alumn|alg|vertebr)(?:a|ae)$/i,"$1ae"],[/(seraph|cherub)(?:im)?$/i,"$1im"],[/(her|at|gr)o$/i,"$1oes"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i,"$1a"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i,"$1a"],[/sis$/i,"ses"],[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i,"$1$2ves"],[/([^aeiouy]|qu)y$/i,"$1ies"],[/([^ch][ieo][ln])ey$/i,"$1ies"],[/(x|ch|ss|sh|zz)$/i,"$1es"],[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i,"$1ices"],[/\b((?:tit)?m|l)(?:ice|ouse)$/i,"$1ice"],[/(pe)(?:rson|ople)$/i,"$1ople"],[/(child)(?:ren)?$/i,"$1ren"],[/eaux$/i,"$0"],[/m[ae]n$/i,"men"],["thou","you"]].forEach(function(e){return p.addPluralRule(e[0],e[1])}),[[/s$/i,""],[/(ss)$/i,"$1"],[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i,"$1fe"],[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i,"$1f"],[/ies$/i,"y"],[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i,"$1ie"],[/\b(mon|smil)ies$/i,"$1ey"],[/\b((?:tit)?m|l)ice$/i,"$1ouse"],[/(seraph|cherub)im$/i,"$1"],[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i,"$1"],[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i,"$1sis"],[/(movie|twelve|abuse|e[mn]u)s$/i,"$1"],[/(test)(?:is|es)$/i,"$1is"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1us"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i,"$1um"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i,"$1on"],[/(alumn|alg|vertebr)ae$/i,"$1a"],[/(cod|mur|sil|vert|ind)ices$/i,"$1ex"],[/(matr|append)ices$/i,"$1ix"],[/(pe)(rson|ople)$/i,"$1rson"],[/(child)ren$/i,"$1"],[/(eau)x?$/i,"$1"],[/men$/i,"man"]].forEach(function(e){return p.addSingularRule(e[0],e[1])}),["adulthood","advice","agenda","aid","aircraft","alcohol","ammo","analytics","anime","athletics","audio","bison","blood","bream","buffalo","butter","carp","cash","chassis","chess","clothing","cod","commerce","cooperation","corps","debris","diabetes","digestion","elk","energy","equipment","excretion","expertise","firmware","flounder","fun","gallows","garbage","graffiti","hardware","headquarters","health","herpes","highjinks","homework","housework","information","jeans","justice","kudos","labour","literature","machinery","mackerel","mail","media","mews","moose","music","mud","manga","news","only","personnel","pike","plankton","pliers","police","pollution","premises","rain","research","rice","salmon","scissors","series","sewage","shambles","shrimp","software","species","staff","swine","tennis","traffic","transportation","trout","tuna","wealth","welfare","whiting","wildebeest","wildlife","you",/pok[eé]mon$/i,/[^aeiou]ese$/i,/deer$/i,/fish$/i,/measles$/i,/o[iu]s$/i,/pox$/i,/sheep$/i].forEach(p.addUncountableRule),p}(),n9.exports)}());function n7(e,t,r=0,n=0){let{sourceCode:o}=t,[a,i]=Array.isArray(e)?e:o.getRange(e);return{start:o.getLocFromIndex(a+r),end:o.getLocFromIndex(i+n)}}function oe(e){let t=[],r=new WeakMap,n=new WeakMap,o=new WeakSet;return e.on("onCodePathStart",()=>{t.push(new Set)}),e.on("onCodePathEnd",()=>{t.pop()}),e.on("onCodePathSegmentStart",e=>{t.at(-1).add(e)}),e.on("onCodePathSegmentEnd",e=>{t.at(-1).delete(e)}),e.on("onUnreachableCodePathSegmentStart",e=>{t.at(-1).add(e)}),e.on("onUnreachableCodePathSegmentEnd",e=>{t.at(-1).delete(e)}),e.on("IfStatement",e=>{[...t.at(-1)].some(e=>e.reachable)&&o.add(e)}),e.onExit(["IfStatement > .consequent","IfStatement > .alternate"],e=>{r.set(e,new Set(t.at(-1)))}),e.onExit("IfStatement",e=>{let a=t.at(-1);for(let t of[e.consequent,e.alternate]){if(!t)continue;let i=r.get(t),s=!o.has(e)||!i||[...a].some(e=>e.prevSegments.some(e=>i.has(e)));n.set(t,!s)}}),e=>!!(e&&n.get(e))}function ot(e,t,r){let{parent:n}=e;for(let o of t.sourceCode.visitorKeys[n.type]||Object.keys(n)){let t=n[o];if(t!==e&&Array.isArray(t)){let n=t.indexOf(e);if(-1!==n)return t[n+r]}}}let or=(e,t)=>ot(e,t,-1),on=(e,t)=>ot(e,t,1),oo=e=>e.charAt(0).toUpperCase()+e.slice(1),oa=e=>e.charAt(0).toLowerCase()+e.slice(1),oi="too-deep",os="should-parenthesized",ol="prefer-event-target",ou=new Set(["@angular/core","eventemitter3"]),op=e=>"VariableDeclarator"===e.parent.type&&e.parent.id===e&&"VariableDeclaration"===e.parent.parent.type&&"const"===e.parent.parent.kind&&e.parent.parent.declarations.includes(e.parent);function oc(e){let t;return!!e&&(tf(e)?[t]=e.arguments:"AwaitExpression"===e.type&&"ImportExpression"===e.argument.type&&({source:t}=e.argument),!!(e1(t)&&ou.has(t.value)))}let od={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",186:";",187:"=",188:",",189:"-",190:".",191:"/",219:"[",220:"\\",221:"]",222:"'",224:"Meta"},om="prefer-keyboard-event-key",of="prefer-keyboard-event-key/suggestion",og=new Set(["keyCode","charCode","which"]),oy=new Set(["onKeyDown","onKeyPress","onKeyUp"]),oh=e=>{var t;return e?.type==="TSTypeAnnotation"&&"TSTypeReference"===e.typeAnnotation.type&&("Identifier"===(t=e.typeAnnotation.typeName).type?"KeyboardEvent"===t.name:"TSQualifiedName"===t.type&&"Identifier"===t.left.type&&"React"===t.left.name&&"Identifier"===t.right.type&&"KeyboardEvent"===t.right.name)},ox=(e,t)=>{var r;let n,o=[],a="ArrowFunctionExpression"===t.type||"FunctionExpression"===t.type;for(let e of(a&&td(t.parent,{method:"addEventListener",minimumArguments:2,optionalCall:!1,optionalMember:!1})&&t.parent.arguments[1]===t&&o.push({parameter:t.params[0],shouldAutofix:!0}),a&&"JSXExpressionContainer"===(r=t).parent.type&&r.parent.expression===r&&"JSXAttribute"===r.parent.parent.type&&r.parent.parent.value===r.parent&&"JSXAttribute"===(n=r.parent.parent).type&&"JSXIdentifier"===n.name.type&&oy.has(n.name.name)&&o.push({parameter:t.params[0],shouldAutofix:!1}),t.params))oh(e.typeAnnotation)&&o.push({parameter:e,shouldAutofix:!1});let i=e.sourceCode.getDeclaredVariables(t);return o.filter(({parameter:t})=>t&&!r2(t,e)).map(e=>({...e,references:i.find(t=>t.identifiers.includes(e.parameter))?.references}))},ob=(e,t)=>e?.parent?.type==="MemberExpression"&&e.parent.property===e&&!e.parent.computed&&e.parent.object===t,oE=(e,t)=>{let r=[];for(let n=t.parent;n;n=n.parent)tl(n)&&r.push(...ox(e,n));return r},oD=(e,{shouldAutofix:t})=>{let r=(e=>{var t;if(e.parent?.type!=="MemberExpression"||e.parent.property!==e)return;let r=((e,t)=>{let r=e;for(;r&&t;)t--,r=r.parent;if(0===t)return r})(e,3);if(!r||"IfStatement"!==r.type)return;let{type:n,operator:o,right:a}=r.test;if(!("BinaryExpression"===n&&r.test.left===e.parent&&("=="===o||"==="===o)&&e8(a)))return;let i=Object.hasOwn(od,t=a.value)?od[t]:Number.isSafeInteger(t)&&t>=0&&t<=1114111?String.fromCodePoint(t):void 0;if(i)return{key:i,right:a}})(e),n={messageId:om,data:{name:e.name},node:e};if(!r)return n;let o=t=>[t.replaceText(e,"key"),t.replaceText(r.right,tF(r.key))];return t?n.fix=o:n.suggest=[{messageId:of,data:{key:r.key},fix:o}],n},oS=(e,{parameter:t})=>t?.type==="ObjectPattern"&&t.properties.includes(e.parent),ov=(e,{references:t})=>{let r=((e,t,r=()=>!0)=>{let n=e;for(;n;){if(n.type===t&&r(n))return n;n=n.parent}})(e,"VariableDeclarator"),n=r?.init;return t&&r?.id===e.parent.parent&&t.some(e=>e.identifier===n)},oC="error",oA="suggestion";function*oT(e,t,r){for(let n of eY(e,r))yield t.remove(n)}function ow(e,t,r,n){if("CallExpression"!==t.type)throw Error(`Unexpected node "${t.type}".`);let{sourceCode:o}=n,[a,i]=o.getLastTokens(t,2);return t.arguments.length>0&&(r=eu(a)?` ${r},`:`, ${r}`),e.insertTextBefore(i,r)}function ok(e,t,r){return e.removeRange(function(e,t){let r=e.parent,n=r.arguments.indexOf(e),o=eY(e,t),a=o[0]||e,i=o.at(-1)||e,{sourceCode:s}=t,[l]=s.getRange(a),[,u]=s.getRange(i);if(0!==n){let e=s.getTokenBefore(a);[l]=s.getRange(e)}if(1===r.arguments.length){let e=s.getTokenAfter(i);eu(e)&&([,u]=s.getRange(e))}return[l,u]}(t,r))}function oI(e,t,r,n){return e.replaceTextRange(eH(t,n),r)}function oj(e,t,r,n){let o=eZ(r,n);return("MemberExpression"===t.parent.type&&t.parent.object===t?!n2(r,n):nN(r))||eQ(r,n)||(o=`(${o})`),o.startsWith("{")&&(o=`(${o})`),nW(n.sourceCode.getTokenBefore(t),n,o)&&(o=`;${o}`),e.replaceText(t,o)}function*oF(e,t,r){if("ReturnStatement"!==t.type&&"ThrowStatement"!==t.type)return;let{sourceCode:n}=r,o=n.getFirstToken(t);yield e.insertTextAfter(o," (");let a=n.getLastToken(t);ep(a)?yield e.insertTextBefore(a,")"):yield e.insertTextAfter(t,")")}function oB(e,t,r){let n="object"==typeof e?t.sourceCode.getRange(e)[1]:e,[o]=t.sourceCode.text.slice(n).match(/^\s*/);return r.removeRange([n,n+o.length])}function*oR(e,t,r){let n=t.sourceCode.getFirstToken(e);yield r.remove(n),yield oB(n,t,r),tJ(e,t)||(yield r.insertTextAfter(e,"()")),nF(n,e.callee,t)||eQ(e,t)||(yield oF(r,e.parent,t))}let o$=({type:e,value:t})=>"Keyword"===e&&/^[a-z]*$/.test(t)||"Identifier"===e&&"of"===t||"Identifier"===e&&"await"===t;function*oP(e,t,r){let{sourceCode:n}=r,o=eH(t,r),a=n.getTokenBefore({range:o},{includeComments:!0});a&&o[0]===n.getRange(a)[1]&&o$(a)&&(yield e.insertTextAfter(a," "));let i=n.getTokenAfter({range:o},{includeComments:!0});i&&o[1]===n.getRange(i)[0]&&o$(i)&&(yield e.insertTextBefore(i," "))}function*oL(e,t,r){var n;yield oP(r,e,t),yield r.insertTextBefore(e,"new ");let{callee:o}=e;!eQ(o,t)&&"MemberExpression"===(n=o).type&&function(e){let t=e.object,r=e.object.type;for(;"MemberExpression"===r;)r=(t=t.object).type;return"CallExpression"===r}(n)&&(yield r.insertTextBefore(o,"("),yield r.insertTextAfter(o,")"))}function oN(e,t,r,n){let[,o]=eH(t.object,r),[,a]=r.sourceCode.getRange(t);return e.replaceTextRange([o,a],n)}let oM=(e,t,r)=>oN(e,t,r,"");function*oO(e,t,r){let n=t.callee;yield oM(e,n,r);let[,o]=eH(n,r),[,a]=r.sourceCode.getRange(t);yield e.removeRange([o,a])}function oq(e,t,r,n=!1){let{sourceCode:o}=t,{lines:a}=o,i=e;if(n){let[t,r]=o.getLastTokens(e,2);ep(r)&&(i=t)}let s=o.getLoc(e).start,l=o.getLoc(i).end,u=a[s.line-1].slice(0,s.column),p=a[l.line-1].slice(l.column),[c]=o.getRange(e),[,d]=o.getRange(i);if(/^\s*$/.test(u)&&/^\s*$/.test(p))if(d+=p.length,0===c){let{text:e}=o;"\r"===e[d]&&"\n"===e[d+1]?d+=2:("\n"===e[d]||"\r"===e[d])&&d++}else c=Math.max(0,c-u.length-1);return r.removeRange([c,d])}function oU(e,t,r,n){if(nM(e)||"AssignmentPattern"===e.parent.type&&e.parent.left===e&&nM(e.parent))return n.replaceText(e,`${e.name}: ${t}`);if(nP(e,r))return n.replaceText(e,`${e.name} as ${t}`);if(((e,t)=>{let{type:r,local:n,exported:o}=e.parent;return"ExportSpecifier"===r&&n$(n,o,t)&&n===e})(e,r))return n.replaceText(e,`${t} as ${e.name}`);if(e.typeAnnotation){let{sourceCode:o}=r;return o.getCommentsInside(e).length>0?n.replaceText(o.getFirstToken(e),t):n.replaceTextRange([o.getRange(e)[0],o.getRange(e.typeAnnotation)[0]],`${t}${e.optional?"?":""}`)}return n.replaceText(e,t)}let oW=(e,t,r,n)=>rd(e).map(e=>oU(e,t,r,n)),o_=(e,t,r,n)=>{let{tail:o}=e,[a,i]=r.sourceCode.getRange(e);return n.replaceTextRange([a+1,i-(o?1:2)],t)};function*oV(e,t,r,n,o){for(let t of eY(e,o?{sourceCode:o}:n))yield oV(t,"",r,n,o);let{sourceCode:a}=n,[i,s]=a.getRange(e),[l]=a.text.slice(0,i).match(/\s*$/),[u]=l.match(/(?:\r?\n|\r)?/);i-=l.length,yield r.replaceTextRange([i,s],`${u}${t}`)}let oz="require-array-join-separator",oK="no-thenable-object",oG="no-thenable-export",oJ="no-thenable-class",oX=(e,t)=>ew(e,t.sourceCode.getScope(e))?.value==="then",oY=(e,t)=>{let r="MemberExpression"===e.type?e.property:e.key;return"Literal"===r.type?"then"===r.value:e.computed||"Identifier"!==r.type?"then"===eI(e,t.sourceCode.getScope(e)):"then"===r.name},oH=[{selector:"ObjectExpression",*getNodes(e,t){for(let r of e.properties)"Property"===r.type&&oY(r,t)&&(yield r.key)},messageId:oK},{selectors:["PropertyDefinition","MethodDefinition"],*getNodes(e,t){oY(e,t)&&(yield e.key)},messageId:oJ},{selector:"MemberExpression",*getNodes(e,t){"AssignmentExpression"===e.parent.type&&e.parent.left===e&&oY(e,t)&&(yield e.property)},messageId:oK},{selector:"CallExpression",*getNodes(e,t){if(!(td(e,{objects:["Object","Reflect"],method:"defineProperty",minimumArguments:3,optionalCall:!1,optionalMember:!1})&&"SpreadElement"!==e.arguments[0].type))return;let[,r]=e.arguments;oX(r,t)&&(yield r)},messageId:oK},{selector:"CallExpression",*getNodes(e,t){if(td(e,{object:"Object",method:"fromEntries",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&"ArrayExpression"===e.arguments[0].type)for(let r of e.arguments[0].elements){if(!(r?.type==="ArrayExpression"&&r.elements[0]&&"SpreadElement"!==r.elements[0].type))continue;let[e]=r.elements;oX(e,t)&&(yield e)}},messageId:oK},{selector:"Identifier",*getNodes(e){"then"===e.name&&"ExportSpecifier"===e.parent.type&&e.parent.exported===e&&(yield e)},messageId:oG},{selector:"Identifier",*getNodes(e){"then"===e.name&&("FunctionDeclaration"===e.parent.type||"ClassDeclaration"===e.parent.type)&&e.parent.id===e&&"ExportNamedDeclaration"===e.parent.parent.type&&e.parent.parent.declaration===e.parent&&(yield e)},messageId:oG},{selector:"VariableDeclaration",*getNodes(e,t){if("ExportNamedDeclaration"===e.parent.type&&e.parent.declaration===e)for(let r of t.sourceCode.getDeclaredVariables(e))"then"===r.name&&(yield*r.identifiers)},messageId:oG}],oZ="no-invalid-remove-event-listener",oQ="consistent-function-scoping",o0=(e,t)=>e&&t&&(e===t||e.block===t.block),o1=(e,t)=>e.some(e=>o0(e,t)),o2=["useState","useEffect","useContext","useReducer","useCallback","useMemo","useRef","useImperativeHandle","useLayoutEffect","useDebugValue"].flatMap(e=>[e,`React.${e}`]),o3=new Set(["DoWhileStatement","ForInStatement","ForOfStatement","ForStatement","WhileStatement"]),o8=e=>e?.type==="BlockStatement"&&o3.has(e.parent.type)&&e.parent.body===e,o6=new Set(["FunctionExpression","ArrowFunctionExpression"]),o9={create:e=>{let{checkArrowFunctions:t}=e.options[0],{sourceCode:r}=e,{scopeManager:n}=r;e.onExit(ts,e=>{if(("ArrowFunctionExpression"!==e.type||t)&&!function(e,t,r){let n,o,a,i=t.acquire(e);if(!i||(o=r.visitorKeys,"ArrowFunctionExpression"===e.type&&nj(e,o))||function(e){let t=e;for(;t.parent;){let{parent:e}=t;if("CallExpression"===e.type&&e.arguments[1]===t&&ts.includes(t.type)&&ty(e.callee,["jest.mock"]))return!0;t=e}return!1}(e))return!0;let s=e.parent;"VariableDeclarator"===s.type&&(s=s.parent),"VariableDeclaration"===s.type&&(s=s.parent),s?.type==="ReturnStatement"&&"ArrowFunctionExpression"===e.type&&(s=s.parent),s=function(e,t){if("ArrowFunctionExpression"===e.type&&"ArrowFunctionExpression"===t.type){let t=function(e){let t=e;for(;t&&"ArrowFunctionExpression"===t.type;)t=t.parent;return t}(e);t&&"ReturnStatement"===t.type&&"ReturnStatement"===(e=function(e){let t=e;for(;"ArrowFunctionExpression"===t.type;)t=t.parent;return t}(e)).type&&(e=e.parent)}return e}(s,e),s?.type==="BlockStatement"&&(n=s,s=s.parent);let l=t.acquire(s),u=function(e,t,r){let n=[];e&&n.push(e);let o=function(e){let t=[];for(;e?.type==="BlockStatement";){if(t.push(e),o8(e))return t;e=e.parent}return[]}(t);if(0===o.length)return n;let a=o.at(-1),i=r.acquire(a.parent);for(let e of(i&&n.push(i),o)){let t=r.acquire(e);t&&n.push(t)}return n}(l,n,t);return!!(0===u.length||u.some(e=>"global"===e.type)||l&&l.block?.parent?.callee&&ty(l.block.parent.callee,o2)||l&&(a=s,o6.has(a.type)&&"CallExpression"===a.parent.type&&a.parent.callee===a))||tO(i).map(({resolved:e})=>e).filter(Boolean).some(e=>e.references.some(e=>{if(o1(u,e.from))return!0;let{resolved:t}=e,[r]=t.defs;return(r?.type!=="FunctionName"||t.name!==r.name.name)&&o1(u,t.scope)})||e.defs.some(e=>o1(u,t.acquire(e.node)))||e.identifiers.some(e=>{if(!e.parent||"FunctionDeclaration"!==e.parent.type||t.acquire(e))return!1;let r=t.acquire(e.parent);return!(!r||o0(i,r))&&o1(u,r.upper)}))}(e,n,r))return{node:e,loc:eh(e,r),messageId:oQ,data:{functionNameWithKind:ej(e,r)}}})},meta:{type:"suggestion",docs:{description:"Move function definitions to the highest possible scope.",recommended:!0},schema:[{type:"object",additionalProperties:!1,properties:{checkArrowFunctions:{type:"boolean",description:"Whether to check arrow functions."}}}],defaultOptions:[{checkArrowFunctions:!0}],messages:{[oQ]:"Move {{functionNameWithKind}} to the outer scope."},languages:["js/js"]}},o5="error",o4="error-unknown",o7="suggestion";function ae(e,t,r){return function*(n){yield n.insertTextAfter(e.callee,`.${r}`),yield oR(e,t,n)}}let at="no-console-spaces",ar=e=>e.length>1&&" "===e.charAt(0)&&" "!==e.charAt(1),an=e=>e.length>1&&" "===e.at(-1)&&" "!==e.at(-2),ao="no-empty-file",aa={create:e=>{let{allowComments:t}=e.options[0];e.filename===e.physicalFilename&&(e.on("Program",r=>{if(r.templateBody)return;if(1===r.body.length&&"Document"===r.body[0].type){let{children:e}=r.body[0];if(e.some(e=>"Comment"!==e.type&&("Text"!==e.type||""!==e.value.trim()))||t&&e.some(e=>"Comment"===e.type))return;return{node:r,messageId:ao}}if(r.body.some(e=>!tn(e,tr)))return;let{sourceCode:n}=e,o=t6(e);if(0!==n.ast.tokens.length||0!==o.length||""===n.text.trim()){if(!o.some(e=>"Line"===e.type&&e.value.startsWith("/"))&&(!(t&&o.length>0&&o.every(e=>"Line"===e.type||"Block"===e.type))||0!==n.ast.tokens.length))return{node:r,messageId:ao}}}),e.on("StyleSheet",r=>{if(r.children.length>0)return;let n=t6(e);if(!t||!(n.length>0))return{node:r,messageId:ao}}),e.on("Document",r=>{if(r.parent?.type==="Program"||null!==r.body&&void 0!==r.body)return;let n=t6(e);if(!t||!(n.length>0))return{node:r,messageId:ao}}),e.on("root",e=>{if(!e.children.some(e=>!("html"===e.type&&/^<!--(?:(?!-->)[\s\S])*-->$/.test(e.value.trim())))&&(!t||!(e.children.length>0)))return{node:e,messageId:ao}}))},meta:{type:"suggestion",docs:{description:"Disallow empty files.",recommended:"unopinionated"},schema:[{type:"object",additionalProperties:!1,properties:{allowComments:{type:"boolean",description:"Whether to allow files that only contain comments."}}}],defaultOptions:[{allowComments:!1}],messages:{[ao]:"Empty files are not allowed."},languages:["js/js","css/css","html/html","json/json","json/jsonc","json/json5","markdown/commonmark","markdown/gfm"]}},ai="no-useless-fallback-in-spread",as="zero-fraction",al="dangling-dot",au="error",ap="suggestion",ac=Symbol.for("default"),ad=Symbol("NAMESPACE_SPECIFIER_NAME"),am=e=>{switch(e.type){case"Identifier":return Symbol.for(e.name);case"Literal":return e.value}},af=e=>"type"===e.exportKind||"type"===e.parent.exportKind;function*ag(e,t,r){switch(e.type){case"ImportSpecifier":case"ExportSpecifier":case"ImportDefaultSpecifier":case"ImportNamespaceSpecifier":return void(yield function*(e,t,r,n=!1){let o=e.parent,{specifiers:a}=o;if(1===a.length&&!n)return void(yield t.remove(o));let{sourceCode:i}=r;switch(e.type){case"ImportSpecifier":if(a.every(t=>e===t||e.type!==t.type)){let r=i.getTokenAfter(e,e=>"Identifier"===e.type&&"from"===e.value),n=a.some(e=>"ImportDefaultSpecifier"===e.type),o=i.getTokenBefore(e,n?eu:ef),[s]=i.getRange(o),[l]=i.getRange(r),u=i.getTokenBefore(o),p=i.getRange(u)[1]===s;yield t.replaceTextRange([s,l],p?" ":"");return}case"ExportSpecifier":case"ImportNamespaceSpecifier":case"ImportDefaultSpecifier":{yield t.remove(e);let r=i.getTokenAfter(e);eu(r)&&(yield t.remove(r))}}}(e,t,r));case"ImportDeclaration":case"ExportDefaultDeclaration":case"ExportNamedDeclaration":yield t.remove(e)}}function ay(e,t){let{sourceCode:r}=t,n=r.getTokenBefore(e.source,e=>"Identifier"===e.type&&"from"===e.value),[o]=r.getRange(n),[,a]=r.getRange(e);return r.text.slice(o,a)}let ah={create:function(e){let{sourceCode:t}=e,{checkUsedVariables:r}=e.options[0],n=new Set,o=[];e.on("ImportDeclaration",e=>{e.specifiers.length>0&&n.add(e)}),e.on("ExportNamedDeclaration",e=>{e1(e.source)&&o.push(e)}),e.on("Program:exit",function*(a){for(let i of n){let n=t.getDeclaredVariables(i);if(n.some(e=>1!==e.defs.length||e.defs[0].parent!==i)||(n=n.map(e=>{let r=function(e,t){let r=e.defs[0].node,n={node:r,declaration:r.parent,variable:e,isTypeImport:n_(r)};switch(r.type){case"ImportDefaultSpecifier":return{name:ac,text:"default",...n};case"ImportSpecifier":return{name:am(r.imported),text:t.getText(r.imported),...n};case"ImportNamespaceSpecifier":return{name:ad,text:"*",...n}}}(e,t),n=function(e,t){let r=[];for(let{identifier:n}of e.variable.references){let o=function(e,t){let{parent:r}=e;switch(r.type){case"ExportDefaultDeclaration":return{node:r,name:ac,text:"default",isTypeExport:af(r)};case"ExportSpecifier":return{node:r,name:am(r.exported),text:t.getText(r.exported),isTypeExport:af(r)};case"VariableDeclarator":if(r.init===e&&"Identifier"===r.id.type&&!r.id.typeAnnotation&&"VariableDeclaration"===r.parent.type&&"const"===r.parent.kind&&1===r.parent.declarations.length&&r.parent.declarations[0]===r&&"ExportNamedDeclaration"===r.parent.parent.type&&function(e,t){let r=t.getDeclaredVariables(e);if(1!==r.length)return!1;let[{identifiers:n,references:o}]=r;return 1===n.length&&n[0]===e.id&&1===o.length&&o[0].identifier===e.id}(r,t))return{node:r.parent.parent,name:Symbol.for(r.id.name),text:t.getText(r.id)}}}(n,t);o&&(e.name!==ad||o.name!==ac)&&r.push(o)}return r}(r,t);return{variable:e,imported:r,exports:n}}),!r&&n.some(({variable:e,exports:t})=>e.references.length!==t.length)))continue;let s=!r&&n.some(({variable:e})=>0===e.references.length);for(let{imported:t,exports:r}of n)for(let n of r){let r={node:n.node,messageId:au,data:{exported:n.text}},i=function({context:e,imported:t,exported:r,exportDeclarations:n,program:o}){let a,i=t.declaration,s=i.source.value,l=t.isTypeImport||r.isTypeExport;return l&&(a=n.find(({source:e,exportKind:t})=>"type"===t&&e.value===s)),a||=n.find(({source:e,exportKind:t})=>"type"!==t&&e.value===s),function*(n){if(t.name===ad)yield n.insertTextAfter(o,`
|
|
3
|
+
export ${l?"type ":""}* as ${r.text} ${ay(i,e)}`);else{let s=r.name===t.name?r.text:`${t.text} as ${r.text}`;if(l&&(!a||"type"!==a.exportKind)&&(s=`type ${s}`),a){let t=a.specifiers.at(-1);if(t)yield n.insertTextAfter(t,`, ${s}`);else{let t=e.sourceCode.getFirstToken(a,ef);yield n.insertTextAfter(t,s)}}else yield n.insertTextAfter(o,`
|
|
4
|
+
export {${s}} ${ay(i,e)}`)}let s=r.isTypeExport&&!t.isTypeImport;1!==t.variable.references.length||s||(yield ag(t.node,n,e)),yield ag(r.node,n,e)}}({context:e,imported:t,exported:n,exportDeclarations:o,program:a});s?r.suggest=[{messageId:ap,fix:i}]:r.fix=i,yield r}}})},meta:{type:"suggestion",docs:{description:"Prefer `export…from` when re-exporting.",recommended:!0},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,properties:{checkUsedVariables:{type:"boolean",description:"Whether to check variables that are used in the module."}}}],defaultOptions:[{checkUsedVariables:!0}],messages:{[au]:"Use `export…from` to re-export `{{exported}}`.",[ap]:"Switch to `export…from`."},languages:["js/js"]}},ax="prefer-native-coercion-functions",ab=new Set(["String","Number","BigInt","Boolean","Symbol"]),aE=new Set(["every","filter","find","findLast","findIndex","findLastIndex","some"]),aD=(e,t)=>e?.type==="CallExpression"&&!e.optional&&"Identifier"===e.callee.type&&ab.has(e.callee.name)&&e.arguments[0]?.type==="Identifier"&&e.arguments[0].name===t,aS=(e,t)=>{let r={[t]:!0};for(let t of e.split(".").toReversed())r={[t]:r};return r},av=(e,t)=>{for(let r of Reflect.ownKeys(t)){let n=t[r];"object"==typeof n?(e[r]??={},av(e[r],n)):e[r]=n}};class aC{#n={};#e;#o;#a;constructor({object:e,objects:t=[e],type:r=ez.READ,context:n,filter:o,handle:a}){for(let e of t)av(this.#n,aS(e,r));this.#e=n,this.#o=o,this.#a=a}*#i(e,t){let r=t?.context??this.#e,n=t?.filter??this.#o,o=t?.handle??this.#a;for(let t of new ez(e).iterateGlobalReferences(this.#n)){if(n&&!n(t))continue;let e=o(t,r);yield e}}listen(e){let t=e?.context??this.#e;t.onExit("Program",r=>this.#i(t.sourceCode.getScope(r),e))}}Object.assign(aC,{READ:ez.READ,CALL:ez.CALL,CONSTRUCT:ez.CONSTRUCT});let aA="no-document-cookie",aT=new aC({object:"document.cookie",filter:({node:e})=>"AssignmentExpression"===e.parent.type&&e.parent.left===e,handle:({node:e})=>({node:e,messageId:aA})}),aw=e=>[`webkit${e}`,`o${e.toLowerCase()}`,e.toLowerCase()],ak=new Set(["click","rightclick","dblclick","auxclick","mousedown","mouseup","mouseover","mouseout","mousemove","mouseenter","mouseleave","mousecancel","selectionchange","selectstart","wheel","keypress","keydown","keyup","blur","focus","deactivate","focusin","focusout","change","reset","select","submit","input","propertychange","dragstart","drag","dragenter","dragover","dragleave","drop","dragend","touchstart","touchmove","touchend","touchcancel","beforeunload","consolemessage","contextmenu","devicechange","devicemotion","deviceorientation","DOMContentLoaded","error","help","load","losecapture","orientationchange","readystatechange","resize","scroll","unload","canplay","canplaythrough","durationchange","emptied","ended","loadeddata","loadedmetadata","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","sourceopen","sourceended","sourceclosed","abort","update","updatestart","updateend","hashchange","pagehide","pageshow","popstate","copy","paste","cut","beforecopy","beforecut","beforepaste","online","offline","message","connect","install","activate","fetch","foreignfetch","messageerror","statechange","updatefound","controllerchange",...aw("AnimationStart"),...aw("AnimationEnd"),...aw("AnimationIteration"),...aw("TransitionEnd"),"pointerdown","pointerup","pointercancel","pointermove","pointerover","pointerout","pointerenter","pointerleave","gotpointercapture","lostpointercapture","MSGestureChange","MSGestureEnd","MSGestureHold","MSGestureStart","MSGestureTap","MSGotPointerCapture","MSInertiaStart","MSLostPointerCapture","MSPointerCancel","MSPointerDown","MSPointerEnter","MSPointerHover","MSPointerLeave","MSPointerMove","MSPointerOut","MSPointerOver","MSPointerUp","text","textinput","textInput","compositionstart","compositionupdate","compositionend","beforeinput","exit","loadabort","loadcommit","loadredirect","loadstart","loadstop","responsive","sizechanged","unresponsive","visibilitychange","storage","DOMSubtreeModified","DOMNodeInserted","DOMNodeRemoved","DOMNodeRemovedFromDocument","DOMNodeInsertedIntoDocument","DOMAttrModified","DOMCharacterDataModified","beforeprint","afterprint","beforeinstallprompt","appinstalled","afterblur","beforeblur","cancel","close","dragexit","encrypted","fullscreenchange","invalid","toggle","search","open","show"]),aI="prefer-add-event-listener",aj={create:e=>{let t,r,n=new Set(e.options[0].excludedPackages),o=new WeakMap;e.on("onCodePathStart",(e,t)=>{r={node:t,upper:r,returnsSomething:!1}}),e.on("onCodePathEnd",()=>{o.set(r.node,r.returnsSomething),r=r.upper}),e.on("CallExpression",e=>{tf(e)&&!t&&n.has(e.arguments[0].value)&&(t=!0)}),e.on("Literal",e=>{"ImportDeclaration"===e.parent.type&&!t&&n.has(e.value)&&(t=!0)}),e.on("ReturnStatement",e=>{r.returnsSomething||=!!e.argument}),e.on("AssignmentExpression:exit",r=>{let n;if(t)return;let{left:a,right:i,operator:s}=r;if("MemberExpression"!==a.type||a.computed)return;let l=a.property.name;if(!l||!l.startsWith("on"))return;let u=l.slice(2);if(!ak.has(u))return;let p="addEventListener",c="";if(tx(i)||e9(i))p="removeEventListener";else"beforeunload"===u&&("ArrowFunctionExpression"!==i.type&&"FunctionExpression"!==i.type||"BlockStatement"!==i.body.type||o.get(i))?c="Use `event.preventDefault(); event.returnValue = 'foo'` to trigger the prompt.":"message"===u?c="Note that there is difference between `SharedWorker#onmessage` and `SharedWorker#addEventListener('message')`.":"error"===u?c="Note that there is difference between `{window,element}.onerror` and `{window,element}.addEventListener('error')`.":"="!==s||"ExpressionStatement"!==r.parent.type||r.parent.expression!==r||nI(i)||(n=t=>((e,t,r,n)=>{let{sourceCode:o}=t,a=n.property.name.slice(2),i=o.getText(n.object);eQ(n.object,t)&&(i=`(${i})`);let s=o.getText(r.right);eQ(r.right,t)&&(s=`(${s})`);let l=`${i}.addEventListener('${a}', ${s})`;return e.replaceText(r,l)})(t,e,r,a));return{node:a.property,messageId:aI,data:{replacement:p,method:l,extra:c?` ${c}`:""},fix:n}})},meta:{type:"suggestion",docs:{description:"Prefer `.addEventListener()` and `.removeEventListener()` over `on`-functions.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{excludedPackages:{type:"array",items:{type:"string"},uniqueItems:!0,description:"Packages to exclude from checking."}}}],defaultOptions:[{excludedPackages:["koa","sax"]}],messages:{[aI]:"Prefer `{{replacement}}` over `{{method}}`.{{extra}}"},languages:["js/js"]}},aF=new Set(["false","true"]),aB=(e,t)=>"BinaryExpression"===e.type&&"==="===e.operator&&(nB(e.left,t)||nB(e.right,t)),aR=({type:e,name:t},r)=>"Identifier"===e&&t===r;function a$({method:e,replacement:t,checkBooleanPredicate:r=!1}){let n=`prefer-${t}-over-${e}/`,o=`${n}error`,a=`${n}suggestion`;return{messages:{[o]:({findIndex:"Use `.indexOf()` instead of `.findIndex()` when looking for the index of an item.",findLastIndex:"Use `.lastIndexOf()` instead of `.findLastIndex() when looking for the index of an item.`",some:`Use \`.${t}()\` instead of \`.${e}()\` when checking value existence.`})[e],[a]:`Replace \`.${e}()\` with \`.${t}()\`.`},listen:function(n){let{sourceCode:i}=n,{scopeManager:s}=i;n.on("CallExpression",r=>{let l,u,p;if(!td(r,{method:e,argumentsLength:1,optionalCall:!1})||!("ArrowFunctionExpression"===(p=r.arguments[0]).type&&!p.async&&1===p.params.length&&aB(p.body,p.params[0])||("ArrowFunctionExpression"===p.type||"FunctionExpression"===p.type)&&!p.async&&!p.generator&&1===p.params.length&&"BlockStatement"===p.body.type&&1===p.body.body.length&&"ReturnStatement"===p.body.body[0].type&&aB(p.body.body[0].argument,p.params[0]))||rX(r.callee.object,n))return;let[c]=r.arguments,d="BinaryExpression"===c.body.type?c.body:c.body.body[0].argument,[m]=c.params,{left:f,right:g}=d,{name:y}=m;if(aR(f,y))l=g,u=f;else{if(!aR(g,y))return;l=f,u=g}let h=s.acquire(c);if(!h||ei(h,m).references.some(({identifier:e})=>e!==u)||rb(c,h))return;let x=r.callee.property,b={node:x,messageId:o,suggest:[]},E=function*(e){let r=i.getText(l);eQ(l,n)&&!eQ(c,n)&&(r=`(${r})`),yield e.replaceText(x,t),yield e.replaceText(c,r)};return eP(l,i)?b.suggest.push({messageId:a,fix:E}):b.fix=E,b}),r&&i.parserServices?.program&&n.on("CallExpression",r=>{if(!td(r,{method:e,argumentsLength:1,optionalCall:!1}))return;let[n]=r.arguments;if("ArrowFunctionExpression"!==n.type&&"FunctionExpression"!==n.type||1!==n.params.length||"Identifier"!==n.params[0].type)return;let[a]=n.params,{parserServices:l}=i,u=function(e,t){let r="ArrowFunctionExpression"!==e.type||e.async||1!==e.params.length||"BlockStatement"===e.body.type?"ArrowFunctionExpression"!==e.type&&"FunctionExpression"!==e.type||e.async||e.generator||1!==e.params.length||"BlockStatement"!==e.body.type||1!==e.body.body.length||"ReturnStatement"!==e.body.body[0].type?void 0:e.body.body[0].argument:e.body;if(r){if(nB(r,t))return r;if("CallExpression"===r.type&&!r.optional&&aR(r.callee,"Boolean")&&1===r.arguments.length&&nB(r.arguments[0],t))return r.arguments[0]}}(n,a);if(!u||!function(e){if("boolean"===e.intrinsicName||"true"===e.intrinsicName)return!0;if(!e.isUnion())return!1;let t=e.types.map(e=>e.intrinsicName);return t.includes("true")&&t.every(e=>aF.has(e))}(l.getTypeAtLocation(a))||!function(e,t){if(e.isUnion())return!1;let r=t.program.getTypeChecker();return!!e.getProperty("includes")&&(r.isArrayType(e)||r.isTupleType(e))}(l.getTypeAtLocation(r.callee.object),l))return;let p=s.acquire(n);if(!p||ei(p,a).references.some(({identifier:e})=>e!==u)||rb(n,p))return;let c=r.callee.property;return{node:c,messageId:o,*fix(e,{abort:r}){i.getCommentsInside(n).length>0&&r(),yield e.replaceText(c,t),yield e.replaceText(n,"true")}}})}}}let aP=a$({method:"findIndex",replacement:"indexOf"}),aL=a$({method:"findLastIndex",replacement:"lastIndexOf"}),aN={create(e){aP.listen(e),aL.listen(e)},meta:{type:"suggestion",docs:{description:"Prefer `Array#{indexOf,lastIndexOf}()` over `Array#{findIndex,findLastIndex}()` when looking for the index of an item.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{...aP.messages,...aL.messages},languages:["js/js"]}},aM="error",aO="prefer-date",aq="prefer-date-now-over-methods",aU="prefer-date-now-over-number-data-object",aW=e=>te(e,{name:"Date",argumentsLength:0}),a_=(e,t,r)=>({node:e,messageId:aO,*fix(t){yield t.replaceText(e,"Date.now()"),"UnaryExpression"===e.type&&(yield oP(t,e,r))},...t}),{isIdentifierName:aV}=tL,az="prefer-dataset",aK="prefer-attributes",aG=e=>`data-${e.replaceAll(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}`,aJ=e=>tc(e,{property:"dataset"}),aX=e=>e.computed||"Identifier"!==e.property.type?e.computed&&e1(e.property)?e.property.value:void 0:e.property.name,aY=new Set(["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf","__proto__","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"]),aH=/[\s\u0000-\u001F"'/<=>]/,aZ=e=>aY.has(e)||e.includes("-")||aH.test(e);function aQ(e,t){let r=eZ(e,t);return!eQ(e,t.sourceCode)&&n2(e,t)?`(${r})`:r}let a0={create:e=>{let{preferAttributes:t}=e.options[0];if(t){let{sourceCode:t}=e,r=(r,n,o)=>{if(aZ(n.value)||r1(o.object,e))return;let a=aQ(o.object,e),i=o.optional?"?.":".",s=tF(aG(n.value),n.raw.charAt(0)),l=t4(e,r,[o.object])?void 0:n=>{let o=`${a}${i}hasAttribute(${s})`;return nW(t.getTokenBefore(r),e,o)&&(o=`;${o}`),n.replaceText(r,o)};return{node:r,messageId:aK,data:{method:"hasAttribute"},fix:l}};e.on("BinaryExpression",e=>{if("in"===e.operator&&e1(e.left)&&aJ(e.right))return r(e,e.left,e.right)}),e.on("CallExpression",e=>td(e,{object:"Object",method:"hasOwn",argumentsLength:2,optionalCall:!1,optionalMember:!1})&&aJ(e.arguments[0])&&e1(e.arguments[1])?r(e,e.arguments[1],e.arguments[0]):td(e,{method:"hasOwnProperty",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&aJ(e.callee.object)&&e1(e.arguments[0])?r(e,e.arguments[0],e.callee.object):void 0),e.on("VariableDeclarator",t=>{let r;if(!(t.init&&aJ(t.init)&&("ObjectPattern"===t.id.type||"Identifier"===t.id.type))||r1(t.init.object,e))return;let n=t.init;if("Identifier"===t.id.type)return{node:n,messageId:aK,data:{method:"getAttribute"},fix:function(e,t){let{sourceCode:r}=t,n=e.init,o=e.parent,[a]=r.getDeclaredVariables(e);if(!a)return;let i=function(e){let t=[];for(let r of e.references){if(r.init)continue;let{identifier:e}=r,n=e.parent;if(!("MemberExpression"===n.type&&n.object===e&&!n.optional))return;let o=aX(n);if(void 0===o||aZ(o))return;let{parent:a}=n;if(r3(n)||"CallExpression"===a.type&&a.callee===n||"TaggedTemplateExpression"===a.type&&a.tag===n)return;t.push(n)}return t}(a);if(!(i&&i.length>0&&"const"===o.kind&&1===o.declarations.length&&!o.parent.type.startsWith("For")&&"ExportNamedDeclaration"!==o.parent.type&&"Identifier"===n.object.type&&function(e,t,r){let{sourceCode:n}=r,{name:o}=e.object,a=e=>ei(n.getScope(e),o),i=a(e.object),s=t.some(e=>a(e)!==i),l=!!i?.references.some(e=>e.isWrite()&&!e.init);return!s&&!l}(n,i,t)&&!t4(t,o)&&i.every(e=>!t4(t,e))))return;let s=aQ(n.object,t);return function*(e){for(let r of(yield oq(o,t,e),i)){let t=r.computed?r.property.raw.charAt(0):void 0,n=tF(aG(aX(r)),t);yield e.replaceText(r,`${s}.getAttribute(${n})`)}}}(t,e)};let{properties:o}=t.id;if(o.some(e=>"Property"===e.type&&(e.computed||"Identifier"!==e.key.type?!e1(e.key)||aZ(e.key.value):aZ(e.key.name))))return;let a=t.parent,i=aQ(n.object,e),s=n.optional?"?.":".";if(o.length>0&&1===a.declarations.length&&!a.parent.type.startsWith("For")&&"ExportNamedDeclaration"!==a.parent.type&&!t4(e,a,[n.object])&&o.every(e=>"Property"===e.type&&!e.computed&&"Identifier"===e.key.type&&"Identifier"===e.value.type)&&(1===o.length||"Identifier"===n.object.type)){let t=t8(a,e),n=o.map(e=>{let t=tF(aG(e.key.name),"'");return`${a.kind} ${e.value.name} = ${i}${s}getAttribute(${t})`});r=e=>e.replaceText(a,`${n.join(`;
|
|
5
|
+
${t}`)};`)}return{node:n,messageId:aK,data:{method:"getAttribute"},fix:r}}),e.on("MemberExpression",r=>{let n,{object:o}=r;if(!aJ(o)||r1(o.object,e))return;let a=aX(r);if(void 0===a||aZ(a)||r.optional)return;let i="ChainExpression"===r.parent.type?r.parent.parent:r.parent;if("CallExpression"===i.type&&i.callee===r||"TaggedTemplateExpression"===i.type&&i.tag===r||"UpdateExpression"===i.type||"AssignmentExpression"===i.type&&i.left===r&&"="!==i.operator)return;let s="AssignmentExpression"===i.type&&i.left===r,l="UnaryExpression"===i.type&&"delete"===i.operator;if(r3(r)&&!s&&!l)return;let u=aQ(o.object,e),p=o.optional?"?.":".",c=r.computed?r.property.raw.charAt(0):void 0,d=tF(aG(a),c);return s&&nO(i)&&!t4(e,i,[o.object,i.right])?n=t=>t.replaceText(i,`${u}${p}setAttribute(${d}, ${eZ(i.right,e)})`):l&&ti(i.parent)&&!t4(e,i,[o.object])?n=r=>{let n=`${u}${p}removeAttribute(${d})`;return nW(t.getTokenBefore(i),e,n)&&(n=`;${n}`),r.replaceText(i,n)}:s||l||t4(e,r,[o.object])||(n=e=>e.replaceText(r,`${u}${p}getAttribute(${d})`)),{node:r,messageId:aK,data:{method:s?"setAttribute":l?"removeAttribute":"getAttribute"},fix:n}});return}e.on("CallExpression",t=>{if(!((td(t,{method:"setAttribute",argumentsLength:2,optionalCall:!1,optionalMember:!1})||td(t,{methods:["removeAttribute","hasAttribute"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||td(t,{method:"getAttribute",argumentsLength:1,optionalCall:!1}))&&e1(t.arguments[0]))||r1(t.callee.object,e))return;let r=t.callee.property.name,n="ChainExpression"===t.parent.type?t.parent:t;if(("AwaitExpression"!==n.parent.type||n.parent.argument!==n||"getAttribute"!==r)&&t.arguments[0].value.toLowerCase().startsWith("data-"))return{node:t,messageId:az,data:{method:r},fix:function(e,t){let r=e.callee.property.name;if("setAttribute"===r&&rh(e.callee)||"setAttribute"===r&&!nO(e)||"removeAttribute"===r&&!ti(e.parent))return;let n=[e.callee.object];if("setAttribute"===r&&n.push(e.arguments[1]),!t4(t,e,n))return n=>{let[o]=e.arguments,a=o.value.toLowerCase().slice(5).replaceAll(/-[a-z]/g,e=>e[1].toUpperCase()),i="",s=`${aQ(e.callee.object,t)}${e.callee.optional?"?":""}.dataset`;switch(r){case"setAttribute":case"getAttribute":case"removeAttribute":i=aV(a)?`.${a}`:`[${tF(a,o.raw.charAt(0))}]`,i=`${s}${i}`,"setAttribute"===r?i+=` = ${eZ(e.arguments[1],t)}`:"removeAttribute"===r&&(i=`delete ${i}`);break;case"hasAttribute":i=`Object.hasOwn(${s}, ${tF(a,o.raw.charAt(0))})`}return n.replaceText(e,i)}}(t,e)}})},meta:{type:"suggestion",docs:{description:"Enforce consistent style for DOM element dataset access.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{preferAttributes:{type:"boolean",description:"Prefer attribute methods over named `.dataset` access."}}}],defaultOptions:[{preferAttributes:!1}],messages:{[az]:"Prefer `.dataset` over `{{method}}(…)`.",[aK]:"Prefer `.{{method}}(…)` over `.dataset`."},languages:["js/js"]}},a1="prefer-modern-math-apis",a2=(e,t)=>"MemberExpression"===e.type&&!e.optional&&!e.computed&&"Identifier"===e.object.type&&"Math"===e.object.name&&"Identifier"===e.property.type&&e.property.name===t,a3=(e,t)=>"CallExpression"===e.type&&!e.optional&&a2(e.callee,t)&&1===e.arguments.length&&"SpreadElement"!==e.arguments[0].type;function a8({constantName:e,replacementMethod:t}){let r=`Math.${t}(…)`;return function(n,o){let a,i;if("BinaryExpression"!==n.type||"*"!==n.operator||(a3(n.left,"log")&&a2(n.right,e)?(a=n.left,i=`Math.log(…) * Math.${e}`):a3(n.right,"log")&&a2(n.left,e)&&(a=n.right,i=`Math.${e} * Math.log(…)`),!a))return;let[s]=a.arguments;return{node:n,messageId:a1,data:{replacement:r,description:i},fix:e=>e.replaceText(n,`Math.${t}(${eZ(s,o)})`)}}}function a6({constantName:e,replacementMethod:t}){let r={messageId:a1,data:{replacement:`Math.${t}(…)`,description:`Math.log(…) / Math.${e}`}};return function(n,o){if(!("BinaryExpression"===n.type&&"/"===n.operator&&a3(n.left,"log")&&a2(n.right,e)))return;let[a]=n.left.arguments;return{...r,node:n,fix:e=>e.replaceText(n,`Math.${t}(${eZ(a,o)})`)}}}let a9=[a8({constantName:"LOG10E",replacementMethod:"log10"}),a8({constantName:"LOG2E",replacementMethod:"log2"}),a6({constantName:"LN10",replacementMethod:"log10"}),a6({constantName:"LN2",replacementMethod:"log2"})],a5=e=>"BinaryExpression"===e.type&&"+"===e.operator?[e.left,e.right].flatMap(e=>a5(e)):[e],a4="number-literal-case",a7=(e,{hexadecimalValue:t})=>{let r=e.toLowerCase();return r.startsWith("0x")&&(r="0x"+r.slice(2)["lowercase"===t?"toLowerCase":"toUpperCase"]()),r},ie={create:nZ(e=>{e.on("Literal",t=>{let{raw:r}=t,n=e.options[0]??{};n.hexadecimalValue??="uppercase";let o=r;if(e8(t)?o=a7(r,n):e5(t)&&(o=a7(r.slice(0,-1),n)+"n"),r!==o)return{node:t,messageId:a4,fix:e=>e.replaceText(t,o)}})}),meta:{type:"suggestion",docs:{description:"Enforce proper case for numeric literals.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{hexadecimalValue:{enum:["uppercase","lowercase"]}}}],defaultOptions:[{hexadecimalValue:"uppercase"}],messages:{[a4]:"Invalid number literal casing."},languages:["js/js"]}},it="error",ir="suggestion",io={parseInt:!0,parseFloat:!0,NaN:!0,Infinity:!0,isNaN:!1,isFinite:!1},ia=e=>{let{parent:t}=e;return"UnaryExpression"===t.type&&"-"===t.operator&&t.argument===e};function ii(e,t){let{node:r,path:n}=e,[o]=n,{parent:a}=r,i=o;"Infinity"===o&&(i=ia(r)?"NEGATIVE_INFINITY":"POSITIVE_INFINITY");let s={node:r,messageId:it,data:{description:o,property:i}};if("NEGATIVE_INFINITY"===i)return s.node=a,s.data.description="-Infinity",s.fix=function*(e){yield e.replaceText(a,"Number.NEGATIVE_INFINITY"),yield oP(e,a,t)},s;let l=e=>oU(r,`Number.${i}`,t,e);return io[o]||((e,t)=>{let{parent:r}=e;if("CallExpression"!==r.type||r.callee!==e||1!==r.arguments.length)return!1;let[n]=r.arguments;return"SpreadElement"!==n.type&&nr(n,t.sourceCode.getScope(e))})(r,t)?s.fix=l:s.suggest=[{messageId:ir,fix:l}],s}let is={create:e=>{let{checkInfinity:t,checkNaN:r}=e.options[0];new aC({objects:Object.keys(io).filter(e=>(!!t||"Infinity"!==e)&&(r||"NaN"!==e)),context:e,handle:ii,filter(t){let{node:r,path:n}=t,[o]=n;return!r3(r)&&!("Infinity"===o&&(e=>{if(!ia(e))return!1;let{parent:t}=e,{parent:r}=t;return"UnaryExpression"===r.type&&"delete"===r.operator&&r.argument===t})(r))&&!("parseInt"===o&&function(e,t){let{parent:r}=e;if("CallExpression"!==r.type||r.callee!==e)return!1;let n=r.arguments[1];return!n||"SpreadElement"!==n.type&&ew(n,t.sourceCode.getScope(n))?.value===10}(r,e))}}).listen()},meta:{type:"suggestion",docs:{description:"Prefer `Number` static methods over global functions and optionally static properties over global constants.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,properties:{checkInfinity:{type:"boolean",description:"Whether to check usage of the global `Infinity`."},checkNaN:{type:"boolean",description:"Whether to check usage of the global `NaN`."}}}],defaultOptions:[{checkInfinity:!1,checkNaN:!1}],messages:{[it]:"Prefer `Number.{{property}}` over `{{description}}`.",[ir]:"Replace `{{description}}` with `Number.{{property}}`."},languages:["js/js"]}},il="prefer-reflect-apply",iu=(e,t)=>(e9(e)||"ThisExpression"===e.type)&&("ArrayExpression"===t.type||"Identifier"===t.type&&"arguments"===t.name),ip=(e,t,r,n)=>`Reflect.apply(${e.getText(t)}, ${e.getText(r)}, ${e.getText(n)})`,ic="prefer-set-size";var id={exports:{}},im=tI(function(){var e,t,r,n;return l?id.exports:(l=1,r=String.fromCodePoint||(e=String.fromCharCode,t=Math.floor,function(){var r,n,o=[],a=-1,i=arguments.length;if(!i)return"";for(var s="";++a<i;){var l=Number(arguments[a]);if(!isFinite(l)||l<0||l>1114111||t(l)!=l)throw RangeError("Invalid code point: "+l);l<=65535?o.push(l):(l-=65536,r=(l>>10)+55296,n=l%1024+56320,o.push(r,n)),(a+1==i||o.length>16384)&&(s+=e.apply(null,o),o.length=0)}return s}),n={parse:function(e,t,n){function o(t,r){return t.range[0]=r,t.raw=e.substring(r,t.range[1]),t}function a(t,r){return{type:"anchor",kind:t,range:[H-r,H],raw:e.substring(H-r,H)}}function i(t,r,n,o){return{type:"value",kind:t,codePoint:r,range:[n,o],raw:e.substring(n,o)}}function s(e,t,r,n){return n=n||0,i(e,t,H-(r.length+n),H)}function l(e){var t,r=e[0],n=r.charCodeAt(0);return Y&&1===r.length&&n>=55296&&n<=56319&&(t=h().charCodeAt(0))>=56320&&t<=57343?i("symbol",(n-55296)*1024+t-56320+65536,++H-2,H):i("symbol",n,H-1,H)}function u(t,r,n,o,a){return null==o&&(n=H-1,o=H),{type:"quantifier",min:t,max:r,greedy:!0,body:null,symbol:a,range:[n,o],raw:e.substring(n,o)}}function p(t,r,n,o){return{type:"characterClass",kind:t.kind,body:t.body,negative:r,range:[n,o],raw:e.substring(n,o)}}function c(t,r,n,o){return t.codePoint>r.codePoint&&_("invalid range in character class",t.raw+"-"+r.raw,n,o),{type:"characterClassRange",min:t,max:r,range:[n,o],raw:e.substring(n,o)}}function d(e){return"alternative"===e.type?e.body:[e]}function m(e){H+=e=e||1}function f(e){g(e)||_("character",e)}function g(t){var r=t.length;if(e.substring(H,H+r)===t)return m(r),t}function y(t){if(e[H]===t)return H++,t}function h(){return e[H]}function x(t){return e[H]===t}function b(t){return e[H+1]===t}function E(t){var r=e.substring(H).match(t);return r&&(H+=r[0].length),r}function D(){var t,r=[],n=H;for(r.push(S());y("|");)r.push(S());return 1===r.length?r[0]:{type:"disjunction",body:r,range:[n,t=H],raw:e.substring(n,t)}}function S(){for(var t,r,s=[],u=H;r=function(){if(H>=e.length||x("|")||x(")"))return null;var t,r=function(){switch(h()){case"^":return m(),a("start",1);case"$":return m(),a("end",1);case"\\":if(b("b"))return m(2),a("boundary",2);if(b("B"))return m(2),a("not-boundary",2);break;case"(":return v("(?=","lookahead","(?!","negativeLookahead");default:return}}();if(r){var s=H;if(t=A()||!1){if(!Y&&"group"===r.type)return t.body=d(r),o(t,r.range[0]),t;H=s,_("Expected atom")}return r}var u=function(){var t;switch(t=h()){case".":return m(),{type:"dot",range:[H-1,H],raw:"."};case"\\":if(m(),!(t=w())){if(!Y&&"c"==h())return i("symbol",92,H-1,H);_("atomEscape")}return t;case"[":return L();case"(":if(n.lookbehind&&(t=v("(?<=","lookbehind","(?<!","negativeLookbehind")))return t;if(n.namedGroups&&g("(?<")){var r,o,a,s,u,p=B();f(">");var c=C("normal",p.range[0]-3);return c.name=p,c}if(!n.modifiers||"(?"!==e.substring(H,H+2)||":"==e[H+2])return v("(?:","ignore","(","normal");return o=H,m(2),a=E(/^[sim]+/),y("-")&&":"!==h()?(r=E(/^[sim]+/))||_("Invalid flags for modifiers group"):a||_("Invalid flags for modifiers group"),((s=(a=a?a[0]:"")+(r=r?r[0]:"")).length>3||function(e){for(var t=0;t<e.length;){if(-1!=e.indexOf(e[t],t+1))return!0;t++}return!1}(s))&&_("flags cannot be duplicated for modifiers group"),y(":")||_("Invalid flags for modifiers group"),(u=C("ignore",o)).modifierFlags={enabling:a,disabling:r},u;case"]":case"}":if(!Y)return m(),l(t);break;case"^":case"$":case"*":case"+":case"?":case"{":case")":case"|":break;default:return m(),l(t)}}();if(u||(s=H,(t=A()||!1)&&(H=s,_("Expected atom")),!Y&&y("{")?u=l("{"):_("Expected atom")),t=A()||!1){var p=u.type,c=u.behavior;return"group"===p&&("negativeLookbehind"===c||"lookbehind"===c)&&_("Invalid quantifier","",t.range[0],t.range[1]),t.body=d(u),o(t,u.range[0]),t}return u}();)s.push(r);return 1===s.length?s[0]:{type:"alternative",body:s,range:[u,t=H],raw:e.substring(u,t)}}function v(e,t,r,n){var o,a=H;if(g(e))o=t;else{if(!g(r))return!1;o=n}return C(o,a)}function C(t,r){var n,o=D();o||_("Expected disjunction"),f(")");var a={type:"group",behavior:t,body:d(o),range:[r,n=H],raw:e.substring(r,n)};return"normal"==t&&K&&z++,a}function A(){var e,t,r,n,o=H;switch(h()){case"*":m(),e=u(0,void 0,void 0,void 0,"*");break;case"+":m(),e=u(1,void 0,void 0,void 0,"+");break;case"?":m(),e=u(0,1,void 0,void 0,"?");break;case"{":(n=E(/^\{(\d+)\}/))?e=u(t=parseInt(n[1],10),t,o,H):(n=E(/^\{(\d+),\}/))?e=u(t=parseInt(n[1],10),void 0,o,H):(n=E(/^\{(\d+),(\d+)\}/))&&((t=parseInt(n[1],10))>(r=parseInt(n[2],10))&&_("numbers out of order in {} quantifier","",o,H),e=u(t,r,o,H)),(t&&!Number.isSafeInteger(t)||r&&!Number.isSafeInteger(r))&&_("iterations outside JS safe integer range in quantifier","",o,H)}return e&&y("?")&&(e.greedy=!1,e.range[1]+=1),e}function T(t,r){if(r){var n,o;if("unicodeEscape"==t.kind&&(n=t.codePoint)>=55296&&n<=56319&&x("\\")&&b("u")){var a=H;H++;var i=w(!0);"unicodeEscape"==i.kind&&(o=i.codePoint)>=56320&&o<=57343?(t.kind="unicodeCodePointEscape",t.codePoint=(n-55296)*1024+o-56320+65536,t.range[1]=H,t.raw=e.substring(t.range[0],H)):H=a}}return t}n||(n={});function w(t){var r,a,i,u,p=H;switch(u=h()){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return function(t){var r,n,a=H;if(r=E(/^(?!0)\d+/)){var i,u,p=parseInt(n=r[0],10);if(p<=z&&!t)return u=H-1-(i=n).length,{type:"reference",matchIndex:parseInt(i,10),range:[u,H],raw:e.substring(u,H)};if(V.push(p),K?G=!0:k(a,H),m(-n.length),r=E(/^[0-7]{1,3}/))return s("octal",parseInt(r[0],8),r[0],1);var c=H;return o(r=l(E(/^[89]/)),c-1)}return!!(r=E(/^[0-7]{1,3}/))&&(("0"!==(n=r[0])&&k(a,H),/^0{1,3}$/.test(n))?s("null",0,"0",n.length):s("octal",parseInt(n,8),n,1))}(t);case"B":if(!t)return P();_("\\B not possible inside of CharacterClass","",p);break;case"b":if(t)return m(),s("singleEscape",8,"\\b");return P();case"c":if(t){if(!Y&&(i=E(/^c(\d)/)))return s("controlLetter",i[1]+16,i[1],2);else if(!Y&&g("c_"))return s("controlLetter",31,"_",2)}return j();case"d":case"D":case"w":case"W":case"s":case"S":return m(),{type:"characterClassEscape",value:u,range:[H-2,H],raw:e.substring(H-2,H)};case"k":return function(){if(n.namedGroups&&E(/^k<(?=.*?>)/)){var t,r=B();return f(">"),t=r.range[0]-3,{type:"reference",name:r,range:[t,H],raw:e.substring(t,H)}}}()||P();case"p":case"P":return a=H,!!(n.unicodePropertyEscape&&Y&&(r=E(/^([pP])\{([^}]+)\}/)))&&{type:"unicodePropertyEscape",negative:"P"===r[1],value:r[2],range:[a-1,H],raw:e.substring(a-1,H)}||P();case"-":if(t&&Y)return m(),s("singleEscape",45,"\\-");return P();default:return j()}}function k(e,t){Y&&_("Invalid decimal escape in unicode mode",null,e,t)}function I(e){var t;return(t=E(/^u([0-9a-fA-F]{4})/))?T(s("unicodeEscape",parseInt(t[1],16),t[1],2),e):e&&(t=E(/^u\{([0-9a-fA-F]+)\}/))?s("unicodeCodePointEscape",parseInt(t[1],16),t[1],4):void 0}function j(){var e,t=H;switch(h()){case"t":return m(),s("singleEscape",9,"\\t");case"n":return m(),s("singleEscape",10,"\\n");case"v":return m(),s("singleEscape",11,"\\v");case"f":return m(),s("singleEscape",12,"\\f");case"r":return m(),s("singleEscape",13,"\\r");case"c":if(e=E(/^c([a-zA-Z])/))return s("controlLetter",e[1].charCodeAt(0)%32,e[1],2);break;case"x":if(e=E(/^x([0-9a-fA-F]{2})/))return s("hexadecimalEscape",parseInt(e[1],16),e[1],2);break;case"u":if(e=I(Y))return(!e||e.codePoint>1114111)&&_("Invalid escape sequence",null,t,H),e}return P()}function F(t){var n=h(),o=H;if("\\"===n){m();var a=I(!0);return a&&t(a.codePoint)||_("Invalid escape sequence",null,o,H),r(a.codePoint)}var i=n.charCodeAt(0);if(i>=55296&&i<=56319){var s=(n+=e[H+1]).charCodeAt(1);s>=56320&&s<=57343&&(i=(i-55296)*1024+s-56320+65536)}if(t(i))return m(),i>65535&&m(),n}function B(){var t,r=H,n=F(R);for(n||_("Invalid identifier");t=F($);)n+=t;return{type:"identifier",value:n,range:[r,H],raw:e.substring(r,H)}}function R(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=128&&/[\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\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\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\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\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\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\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\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\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\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\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-\uAB69\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]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDDC0-\uDDF3\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD40-\uDD59\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDD4A-\uDD65\uDD6F-\uDD85\uDE80-\uDEA9\uDEB0\uDEB1\uDEC2-\uDEC7\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61\uDF80-\uDF89\uDF8B\uDF8E\uDF90-\uDFB5\uDFB7\uDFD1\uDFD3]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8\uDFC0-\uDFE0]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDB0-\uDDDB\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD80E\uD80F\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD1D]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDD40-\uDD6C\uDE40-\uDE7F\uDEA0-\uDEB8\uDEBB-\uDED3\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3\uDFF2-\uDFF6]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDDD0-\uDDED\uDDF0\uDEC0-\uDEDE\uDEE0-\uDEE2\uDEE4\uDEE5\uDEE7-\uDEED\uDEF0-\uDEF4\uDEFE\uDEFF\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/.test(r(e))}function $(e){return R(e)||e>=48&&e<=57||e>=128&&/[\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD801[\uDCA0-\uDCA9]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDD30-\uDD39\uDD40-\uDD49\uDD69-\uDD6D\uDEAB\uDEAC\uDEFA-\uDEFF\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC66-\uDC70\uDC73\uDC74\uDC7F-\uDC82\uDCB0-\uDCBA\uDCC2\uDCF0-\uDCF9\uDD00-\uDD02\uDD27-\uDD34\uDD36-\uDD3F\uDD45\uDD46\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDDC9-\uDDCC\uDDCE-\uDDD9\uDE2C-\uDE37\uDE3E\uDE41\uDEDF-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF3B\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74\uDFB8-\uDFC0\uDFC2\uDFC5\uDFC7-\uDFCA\uDFCC-\uDFD0\uDFD2\uDFE1\uDFE2]|\uD805[\uDC35-\uDC46\uDC50-\uDC59\uDC5E\uDCB0-\uDCC3\uDCD0-\uDCD9\uDDAF-\uDDB5\uDDB8-\uDDC0\uDDDC\uDDDD\uDE30-\uDE40\uDE50-\uDE59\uDEAB-\uDEB7\uDEC0-\uDEC9\uDED0-\uDEE3\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDC2C-\uDC3A\uDCE0-\uDCE9\uDD30-\uDD35\uDD37\uDD38\uDD3B-\uDD3E\uDD40\uDD42\uDD43\uDD50-\uDD59\uDDD1-\uDDD7\uDDDA-\uDDE0\uDDE4\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE3E\uDE47\uDE51-\uDE5B\uDE8A-\uDE99\uDF60-\uDF67\uDFF0-\uDFF9]|\uD807[\uDC2F-\uDC36\uDC38-\uDC3F\uDC50-\uDC59\uDC92-\uDCA7\uDCA9-\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD50-\uDD59\uDD8A-\uDD8E\uDD90\uDD91\uDD93-\uDD97\uDDA0-\uDDA9\uDDE0-\uDDE9\uDEF3-\uDEF6\uDF00\uDF01\uDF03\uDF34-\uDF3A\uDF3E-\uDF42\uDF50-\uDF5A]|\uD80D[\uDC40\uDC47-\uDC55]|\uD818[\uDD1E-\uDD39]|\uD81A[\uDE60-\uDE69\uDEC0-\uDEC9\uDEF0-\uDEF4\uDF30-\uDF36\uDF50-\uDF59]|\uD81B[\uDD70-\uDD79\uDF4F\uDF51-\uDF87\uDF8F-\uDF92\uDFE4\uDFF0\uDFF1]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDCF0-\uDCF9\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDC8F\uDD30-\uDD36\uDD40-\uDD49\uDEAE\uDEEC-\uDEF9]|\uD839[\uDCEC-\uDCF9\uDDEE\uDDEF\uDDF1-\uDDFA\uDEE3\uDEE6\uDEEE\uDEEF\uDEF5]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A\uDD50-\uDD59]|\uD83E[\uDFF0-\uDFF9]|\uDB40[\uDD00-\uDDEF]/.test(r(e))}function P(){var t,r=h();return Y&&/[\^$.*+?()\\[\]{}|/]/.test(r)||!Y&&"c"!==r?"k"===r&&n.lookbehind?null:s("identifier",(t=e.substring(H,H+=1)).charCodeAt(0),t,1):null}function L(){var e,t=H;return g("[^")?(e=N(),f("]"),p(e,!0,t,H)):y("[")?(e=N(),f("]"),p(e,!1,t,H)):null}function N(){var e,t;return x("]")?{kind:"union",body:[]}:X?function(){var e,t=[],r=O(!0);for(t.push(r),e="classRange"===r.type?"union":x("&")?"intersection":x("-")?"subtraction":"union";!x("]");)"intersection"===e?(f("&"),f("&"),x("&")&&_("&& cannot be followed by &. Wrap it in brackets: &&[&].")):"subtraction"===e&&(f("-"),f("-")),t.push(r=O("union"===e));return{kind:e,body:t}}():((t=M())||_("classAtom"),(e=x("]")?[t]:function e(t){if(x("-")&&!b("]")){r=t.range[0],m(),i=l("-"),(a=M())||_("classAtom"),n=H;var r,n,o,a,i,s,u=N();return(u||_("classContents"),"codePoint"in t&&"codePoint"in a?o=[c(t,a,r,n)]:Y?_("invalid character class"):o=[t,i,a],"empty"===u.type)?o:o.concat(u.body)}return(s=M())||_("classAtom"),(o=x("]")?s:e(s))||_("nonEmptyClassRangesNoDash"),[t].concat(o)}(t))||_("nonEmptyClassRanges"),{kind:"union",body:e})}function M(){return y("-")?l("-"):function(){var e;switch(e=h()){case"\\":if(m(),!(e=w(!0))){if(!Y&&"c"==h())return l("\\");_("classEscape")}return T(e,Y);case"]":case"-":break;default:return m(),l(e)}}()}function O(t){var r,n,o=H;if(y("\\"))if(g("q{"))return function(){var t,r=H-3,n=[];do n.push(function(){for(var t,r,n=[],o=H;r=q();)n.push(r);return{type:"classString",characters:n,range:[o,t=H],raw:e.substring(o,t)}}());while(y("|"));return f("}"),{type:"classStrings",strings:n,range:[r,t=H],raw:e.substring(r,t)}}();else if(n=w(!0))r=n;else{if(n=W())return n;_("Invalid escape","\\"+h(),o)}else if(n=U())r=n;else{if(n=L())return n;_("Invalid character",h())}if(t&&x("-")&&!b("-")){if(m(),n=q())return c(r,n,o,H);_("Invalid range end",h())}return r}function q(){if(y("\\")){var e,t=H;if(e=W())return e;_("Invalid escape","\\"+h(),t)}return U()}function U(){var e;if(E(/^(?:&&|!!|##|\$\$|%%|\*\*|\+\+|,,|\.\.|::|;;|<<|==|>>|\?\?|@@|\^\^|``|~~)/)&&_("Invalid set operation in character class"),e=E(/^[^()[\]{}/\-\\|]/))return l(e)}function W(){var e;if(y("b"))return s("singleEscape",8,"\\b");if(y("B"))_("\\B not possible inside of ClassContents","",H-2);else if(e=E(/^[&\-!#%,:;<=>@`~]/))return s("identifier",e[0].codePointAt(0),e[0]);else if(e=j())return e;else return null}function _(t,r,n,o){n=null==n?H:n,o=null==o?n:o;var a=Math.max(0,n-10),i=Math.min(o+10,e.length),s=" "+e.substring(a,i),l=" "+Array(n-a+1).join(" ")+"^";throw SyntaxError(t+" at position "+n+(r?": "+r:"")+"\n"+s+"\n"+l)}var V=[],z=0,K=!0,G=!1,J=-1!==(t||"").indexOf("u"),X=-1!==(t||"").indexOf("v"),Y=J||X,H=0;if(X&&!n.unicodeSet)throw Error('The "v" flag is only supported when the .unicodeSet option is enabled.');if(J&&X)throw Error('The "u" and "v" flags are mutually exclusive.');""===(e=String(e))&&(e="(?:)");var Z=D();return(Z.range[1]!==e.length&&_("Could not parse entire input - got stuck","",Z.range[1]),G=G||V.some(function(e){return e<=z}))?(H=0,K=!1,D()):Z}},id.exports?id.exports=n:window.regjsparser=n,id.exports)}());let ig=String.raw`\$&`,iy=new Set(String.raw`\^$.*+?()[]{}|/-`),{parse:ih}=im,ix="method",ib="pattern",iE="split-join",iD=new Set(["i","y"]),iS=new Set(["anchor","reference"]),iv=e=>String.raw`\u{${e.toString(16)}}`;function iC(e){let{kind:t,codePoint:r,raw:n}=e;if("controlLetter"===t)return 13===r?String.raw`\r`:10===r?String.raw`\n`:9===r?String.raw`\t`:iv(r);if("null"===t||"octal"===t)return iv(r);let o=n;return(("identifier"===t||"symbol"===t&&n.length>1&&n.startsWith("\\"))&&(o=o.slice(1)),"'"===o||"\\"===o)?`\\${o}`:o}function iA(e){return"value"===e.type?iC(e):"characterClass"!==e.type||e.negative||1!==e.body.length||"value"!==e.body[0].type?"quantifier"===e.type&&1===e.min&&1===e.max||"group"===e.type&&"ignore"===e.behavior?iT(e.body):void 0:iC(e.body[0])}function iT(e){let t=[];for(let r of e){let e=iA(r);if(void 0===e)return;t.push(e)}return t.join("")}let iw=e=>{let{pattern:t,flags:r}=e.regex;try{return ih(t,r,{unicodePropertyEscape:r.includes("u"),unicodeSet:r.includes("v"),namedGroups:!0,lookbehind:!0})}catch{}},ik=e=>{let t=0;for(let r of e)t+=iI(r);return t};function iI(e){return iS.has(e.type)?0:["value","dot","characterClass","characterClassEscape","unicodePropertyEscape"].includes(e.type)?1:"alternative"===e.type?ik(e.body):"disjunction"===e.type?Math.min(...e.body.map(e=>iI(e))):"quantifier"===e.type?e.min*ik(e.body):"group"===e.type&&"ignore"===e.behavior?ik(e.body):0}let ij=e=>"group"===e.type&&"normal"===e.behavior||Array.isArray(e.body)&&e.body.some(e=>ij(e)),iF=e=>e8(e)&&Number.isSafeInteger(e.value)&&e.value>=0,iB=(e,t)=>{if("BinaryExpression"===e.type&&"+"===e.operator&&(tQ(e.left,t)&&e0(e.right,1)||e0(e.left,1)&&tQ(e.right,t)))return t},iR=e=>e8(e)?e.value:"UnaryExpression"===e.type&&"-"===e.operator?-iR(e.argument):void 0,i$=e=>e?.type==="MemberExpression"&&!1===e.computed&&"Identifier"===e.property.type&&"length"===e.property.name,iP="prefer-string-trim-start-end",iL="no-unreadable-iife",iN="suggestion",iM="throw-new-error",iO=/^(?:[A-Z][\da-z]*)*Error$/,iq="escape-uppercase",iU="escape-lowercase",iW=/(?<=(?:^|[^\\])(?:\\\\)*\\)(?<data>x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|u{[\dA-Fa-f]+})/g,i_=/(?<=(?:^|[^\\])(?:\\\\)*\\)(?<data>x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|u{[\dA-Fa-f]+}|c[A-Za-z])/g,iV=({node:e,original:t,regex:r=iW,lowercase:n,fix:o})=>{let a=t.replace(r,e=>e[0]+e.slice(1)[n?"toLowerCase":"toUpperCase"]());if(a!==t)return{node:e,messageId:n?iU:iq,fix:t=>o?o(t,a):t.replaceText(e,a)}},iz="prefer-unicode-code-point-escapes",iK="prefer-unicode-code-point-escapes/add-unicode-flag",iG=String.raw`\u{`,iJ=/^[\da-f]$/iv,iX=/^[0-7]$/v,iY=/^[A-Za-z]$/v;function iH(e){return iX.test(e)}function iZ(e,t){let r=0;for(let n=t-1;n>=0&&"\\"===e[n];n--)r++;return r%2==0}function iQ(e,t){let r=0;for(let n=t-1;n>=0&&"\\"===e[n];n--)r++;return r%2==1}function i0(e,t,r){let n=e.slice(t,t+r);if(!(n.length!==r||[...n].some(e=>!iJ.test(e))))return Number.parseInt(n,16)}function i1(e){return e>=55296&&e<=56319}function i2(e){return e>=56320&&e<=57343}function i3(e){return String.raw`\u{${e.toString(16).toUpperCase()}}`}function i8(e,{isRegex:t=!1,supportsNestedCharacterClasses:r=!1}={}){let n="",o=0,a=!1;for(let i=0;i<e.length;i++){let s=e[i],l=o>0;if(t&&"["===s&&(!l||r)&&!iQ(e,i)){o++,n+=s;continue}if(t&&"]"===s&&l&&!iQ(e,i)){o--,n+=s;continue}if("\\"!==s||!iZ(e,i)){n+=s;continue}let u=function(e,t,{isRegex:r,isInCharacterClass:n}){return function(e,t){if("x"!==e[t+1])return;let r=i0(e,t+2,2);if(void 0!==r)return{end:t+4,replacement:i3(r)}}(e,t)??function(e,t,{allowSurrogatePair:r,allowSurrogate:n}){if("u"!==e[t+1]||"{"===e[t+2])return;let o=i0(e,t+2,4);if(void 0===o||!n&&(i1(o)||i2(o)))return;let a=t+6;if(r&&i1(o)&&"\\"===e[a]&&iZ(e,a)&&"u"===e[a+1]){let t=i0(e,a+2,4);if(i2(t))return{end:a+6,replacement:i3((o-55296)*1024+(t-56320)+65536)}}return{end:t+6,replacement:i3(o)}}(e,t,{allowSurrogatePair:!n,allowSurrogate:!r||!n})??(r?function(e,t){let r=e[t+2];if("c"===e[t+1]&&iY.test(r))return{end:t+3,replacement:i3(r.toUpperCase().codePointAt(0)%32)}}(e,t):function(e,t){let r=e[t+1];if("0"===r&&!iH(e[t+2])||!iH(r))return;let n=r>="0"&&r<="3"?3:2,o=t+1;for(;o<t+1+n&&iH(e[o]);)o++;return{end:o,replacement:i3(Number.parseInt(e.slice(t+1,o),8))}}(e,t))}(e,i,{isRegex:t,isInCharacterClass:l});if(!u){n+=s;continue}n+=u.replacement,i=u.end-1,a=!0}return{fixed:n,hasReplacement:a}}function i6(e,t,r){let{fixed:n,hasReplacement:o}=i8(t);if(o)return{node:e,messageId:iz,fix:t=>r?r(t,n):t.replaceText(e,n)}}function i9(e){return e.includes("u")||e.includes("v")?e:`${e}u`}let i5=["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],i4=["Error","EvalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError","AggregateError","SuppressedError"],i7="missing-message",se="message-is-empty-string",st="message-is-not-a-string",sr=new Map([["AggregateError",1],["SuppressedError",2]]),sn=e=>"instanceof"===e.value&&"Keyword"===e.type,so="no-instanceof-builtins",sa="switch-to-type-of",si=new Set(["String","Number","Boolean","BigInt","Symbol"]),ss=[...i4,"Map","Set","WeakMap","WeakRef","WeakSet","ArrayBuffer",...rE,"Object","RegExp","Promise","Proxy","DataView","Date","SharedArrayBuffer","FinalizationRegistry"],sl=(e,t)=>function*(r){let{left:n,right:o}=e,a=rc(t,e),i=a.getTokenAfter(n,sn),{sourceCode:s}=t,l=s.getAncestors(e).findLast(e=>"VExpressionContainer"===e.type),u=l?'"'===s.getText(l)[0]?"'":'"':"'";yield oP(r,e,t);let p=eH(n,{sourceCode:a});!eQ(n,t)&&n8(n,"typeof")?(yield r.insertTextBeforeRange(p,"typeof ("),yield r.insertTextAfterRange(p,")")):yield r.insertTextBeforeRange(p,"typeof "),yield r.replaceText(i,"===");let c=eH(o,{sourceCode:a});yield r.replaceTextRange(c,u+s.getText(o).toLowerCase()+u)},su={create:nZ(e=>{let{useErrorIsError:t=!1,strategy:r="loose",include:n=[],exclude:o=[]}=e.options[0]??{},a=new Set("strict"===r?[...ss,...n]:n);e.on("BinaryExpression",r=>{let{right:n,operator:i}=r;if("instanceof"!==i||"Identifier"!==n.type||o.includes(n.name))return;let s=n.name,l={node:r,messageId:so};if("Array"===s||"Error"===s&&t){let t="Array"===s?"Array.isArray":"Error.isError";return l.fix=function*(n){let{left:o,right:a}=r,i=rc(e,r),s=i.getTokenAfter(o,sn);yield oP(n,r,e);let l=eH(o,{sourceCode:i});yield n.insertTextBeforeRange(l,t+"("),yield n.insertTextAfterRange(l,")"),yield oV(s,"",n,e,i),yield oV(a,"",n,e,i)},l}return"Function"===s?(l.fix=sl(r,e),l):si.has(s)?(l.suggest=[{messageId:sa,data:{type:s.toLowerCase()},fix:sl(r,e)}],l):a.has(s)?l:void 0})}),meta:{type:"problem",docs:{description:"Disallow `instanceof` with built-in objects",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",properties:{useErrorIsError:{type:"boolean"},strategy:{enum:["loose","strict"]},include:{type:"array",items:{type:"string"}},exclude:{type:"array",items:{type:"string"}}},additionalProperties:!1}],defaultOptions:[{useErrorIsError:!1,strategy:"loose",include:[],exclude:[]}],hasSuggestions:!0,messages:{[so]:"Avoid using `instanceof` for type checking as it can lead to unreliable results.",[sa]:"Switch to `typeof … === '{{type}}'`."},languages:["js/js"]}},sp="prefer-type-error",sc=new Set(["isArguments","isArray","isArrayBuffer","isArrayLike","isArrayLikeObject","isBigInt","isBoolean","isBuffer","isDate","isElement","isError","isFinite","isFunction","isInteger","isLength","isMap","isNaN","isNative","isNil","isNull","isNumber","isObject","isObjectLike","isPlainObject","isPrototypeOf","isRegExp","isSafeInteger","isSet","isString","isSymbol","isTypedArray","isUndefined","isView","isWeakMap","isWeakSet","isWindow","isXMLDoc"]),sd=new Set(["isNaN","isFinite"]),sm=(e,t,r)=>void 0!==t&&t.arguments.length>0&&"Identifier"===e.type&&(!0===r&&sc.has(e.name)||!1===r&&sd.has(e.name)),sf=(e,t)=>!!sm(e.property,t,!0)||"MemberExpression"===e.object.type&&sf(e.object,t),sg=/^(?:[A-Z][\da-z]*)*Error$/,sy=e=>"UnaryExpression"===e.type&&"typeof"===e.operator,sh=(e,t)=>{switch(e.type){case"Identifier":return sm(e,t,!1);case"MemberExpression":return sf(e,t);case"CallExpression":return sh(e.callee,e);case"UnaryExpression":return"typeof"===e.operator||"!"===e.operator&&sh(e.argument);case"BinaryExpression":{let{operator:r,left:n,right:o}=e;if("instanceof"===r)return!("Identifier"===o.type?sg.test(o.name):"MemberExpression"===o.type&&!o.optional&&!o.computed&&"Identifier"===o.property.type&&sg.test(o.property.name));if((e=>{let{operator:t,left:r,right:n}=e;return("=="===t||"!="===t||"==="===t||"!=="===t)&&(sy(r)&&e0(n,"undefined")||sy(n)&&e0(r,"undefined"))})(e))return!1;return sh(n,t)||sh(o,t)}case"LogicalExpression":return sh(e.left,t)&&sh(e.right,t);default:return!1}},sx="consistentDestructuring",sb="consistentDestructuringSuggest",sE=new Set(["FunctionDeclaration","FunctionExpression","MethodDefinition","PropertyDefinition","AccessorProperty","StaticBlock","Program"]),sD=e=>{for(;e.parent;)if(e=e.parent,sE.has(e.type))return e},sS=e=>"Property"===e.type&&!e.computed&&"Identifier"===e.key.type,sv=(e,t,r,n)=>{for(let o of e){if(o.key.name!==t)continue;let e=ei(n.getScope(o.value),o.value);if(e&&ei(r,o.value)===e)return o}},sC=({declaration:e,memberExpressionNode:t,memberScope:r,memberRootIdentifier:n,memberRootVariable:o,memberThisScopeBoundary:a,memberExpressionWrites:i,sourceCode:s})=>{if(!((e,t,r)=>{let[,n]=r.getRange(e.object),[o]=r.getRange(t);return n<o})(e,t,s)||e.rootIdentifierName&&n?.name===e.rootIdentifierName&&o!==e.rootVariable||e.thisScopeBoundary&&a!==e.thisScopeBoundary||((e,t,r,n)=>{if(!e.rootVariable)return!1;let[,o]=n.getRange(e.object),[a]=n.getRange(t);return e.rootVariable.references.some(e=>{if(!e.isWrite())return!1;let[t]=n.getRange(e.identifier);return!(t<o)&&(e.from.variableScope!==r.variableScope||t<=a)})})(e,t,r,s)||(({declaration:e,memberExpressionNode:t,memberScope:r,memberExpressionWrites:n,sourceCode:o})=>{let[,a]=o.getRange(e.object),[i]=o.getRange(t),s=t.property.name,l=ry(t.object),u="Identifier"===l.type?l.name:void 0,p="Identifier"===l.type?ei(r,l):void 0,c="ThisExpression"===l.type?sD(l):void 0;return n.some(e=>e.propertyName===s&&e.rootIdentifierName===u&&e.rootVariable===p&&e.thisScopeBoundary===c&&(e.scope.variableScope!==r.variableScope||e.start>=a&&e.start<=i))})({declaration:e,memberExpressionNode:t,memberScope:r,memberExpressionWrites:i,sourceCode:s}))return!1;for(var l=r,u=e.scope;l;){if(l===u)return!0;l=l.upper}return!1},sA=(e,t,r)=>!!("BinaryExpression"===e.type&&"in"===e.operator&&e1(e.left))&&"Identifier"===t.property.type&&e.left.value===t.property.name&&r.getText(e.right)===r.getText(t.object)||"LogicalExpression"===e.type&&"&&"===e.operator&&(sA(e.left,t,r)||sA(e.right,t,r)),sT=(e,t,r,n)=>{switch(e.type){case"ConditionalExpression":case"IfStatement":return e.consequent===t&&sA(e.test,r,n);case"LogicalExpression":return"&&"===e.operator&&e.right===t&&sA(e.left,r,n);default:return!1}},sw=e=>["AccessorProperty","FunctionDeclaration","MethodDefinition","PropertyDefinition"].includes(e.type),sk=["Object","Array","ArrayBuffer","DataView","Date","Function","Map","WeakMap","Set","WeakSet","Promise","RegExp","SharedArrayBuffer","Proxy","WeakRef","FinalizationRegistry","DisposableStack","AsyncDisposableStack",...i4,...["Collator","DateTimeFormat","DisplayNames","DurationFormat","ListFormat","Locale","NumberFormat","PluralRules","RelativeTimeFormat","Segmenter"].map(e=>`Intl.${e}`),...["Duration","Instant","PlainDate","PlainDateTime","PlainMonthDay","PlainTime","PlainYearMonth","ZonedDateTime"].map(e=>`Temporal.${e}`),...["Module","Instance","Memory","Table","Global","Tag","Exception","CompileError","LinkError","RuntimeError"].map(e=>`WebAssembly.${e}`),...rE],sI=["Temporal.Now","WebAssembly","WebAssembly.JSTag"],sj="error-date",sF="suggestion-date";function sB(e){let{node:t}=e;return{node:t,messageId:"disallowCallOrNew",data:{name:e.path.join(".")}}}let sR=new aC({objects:["BigInt","Boolean","Number","String","Symbol"],type:aC.CONSTRUCT,handle:function(e,t){let{node:r}=e,n=e.path.join("."),o={node:r,messageId:"disallow",data:{name:n}};return"String"!==n&&"Boolean"!==n&&"Number"!==n&&(o.fix=e=>oR(r,t,e)),o}}),s$=new aC({objects:sk,type:aC.CALL,handle:function(e,t){let{node:r}=e;if(r.optional||rh(r.callee))return;let n=e.path.join(".");if("Object"===n){let{parent:e}=r;if("BinaryExpression"===e.type&&("==="===e.operator||"!=="===e.operator)&&(e.left===r||e.right===r))return}else if("Date"===n){function*o(e){yield e.replaceText(r,"String(new Date())"),yield oP(e,r,t)}let e={node:r,messageId:sj};return 0===t.sourceCode.getCommentsInside(r).length&&0===r.arguments.length?e.fix=o:e.suggest=[{messageId:sF,fix:o}],e}return{node:r,messageId:"enforce",data:{name:n},fix:e=>oL(r,t,e)}}}),sP=new aC({objects:sI,type:aC.CALL,handle:sB}),sL=new aC({objects:sI,type:aC.CONSTRUCT,handle:sB}),sN="error/array-push",sM="suggestion",sO=e=>tc(e,{property:"classList",computed:!1}),sq=e=>e.arguments.some(e=>"SpreadElement"===e.type),sU=[{description:"Array#push()",test:e=>td(e,{method:"push",optionalCall:!1}),ignore:["stream.push","this.push","this.stream.push","process.stdin.push","process.stdout.push","process.stderr.push"]},{description:"Array#unshift()",test:e=>td(e,{method:"unshift",optionalCall:!1}),keepSecondCall:!0,ignore:["stream.unshift","this.unshift","this.stream.unshift","process.stdin.unshift","process.stdout.unshift","process.stderr.unshift"]},{description:"Element#classList.add()",test:e=>td(e,{method:"add",optionalCall:!1,optionalMember:!1})&&sO(e.callee.object)},{description:"Element#classList.remove()",test:e=>td(e,{method:"remove",optionalCall:!1,optionalMember:!1})&&sO(e.callee.object)},{description:"importScripts()",test:e=>e7(e,{name:"importScripts"})}],sW={create:function(e){let{ignore:t}=e.options[0],{sourceCode:r}=e;e.on("CallExpression",function*(n){for(let{description:o,test:a,ignore:i=[],keepSecondCall:s=!1}of sU){if(!a(n))continue;let l=[...i,...t];if(ty(n.callee,l))continue;let u=function(e){let t=e.parent;return"ChainExpression"===t.type&&e===t.expression&&(t=t.parent),"ExpressionStatement"===t.type?t:void 0}(n);if(!u)continue;let p=or(u,e);if(p?.type!=="ExpressionStatement")continue;let c=function(e){let{expression:t}=e;return"ChainExpression"===t.type?t.expression:t}(p);if(!a(c)||!tQ(c.callee,n.callee))continue;let{shouldKeepSecondCall:d,shouldPrependSourceArguments:m,targetCall:f,sourceCall:g}=function(e,t,r){let n=r&&(!rh(t.callee)||rh(e.callee));return{shouldKeepSecondCall:n,shouldPrependSourceArguments:r&&!n,targetCall:n?t:e,sourceCall:n?e:t}}(c,n,s),y=g.arguments,h=r.getRange(p),x=r.getRange(u),b=d?[h[0],x[0]]:[h[1],x[1]],E=!d&&!ep(r.getLastToken(p))&&ep(r.getLastToken(u)),D=d&&nW(r.getTokenBefore(p),e,r.text.slice(x[0],x[0]+1)),S={node:"Identifier"===n.callee.type?n.callee:n.callee.property,messageId:sN,data:{description:o}},v=function*(t){if(y.length>0){let r=tY(e,g,!m),{openingParenthesisToken:n,trailingCommaToken:o,closingParenthesisToken:a}=tX(f,e);m?yield t.insertTextAfter(n,f.arguments.length>0?`${r}, `:r):yield o?t.insertTextAfter(o,` ${r}`):t.insertTextBefore(a,f.arguments.length>0?`, ${r}`:r)}yield t.replaceTextRange(b,E||D?";":"")};!function(e,t){return e.getAllComments().some(r=>{let[n,o]=e.getRange(r);return n>=t[0]&&o<=t[1]})}(r,b)&&(function(e,t,r,n){let o=r?[...e.arguments,...t.arguments]:t.arguments;return r&&(sq(e)||sq(t))||r&&o.some(e=>null===ew(e,n.getScope(e)))||o.some(e=>eP(e,n))}(c,n,s,r)?S.suggest=[{messageId:sM,fix:v}]:S.fix=v),yield S}})},meta:{type:"suggestion",docs:{description:"Enforce combining multiple `Array#{push,unshift}()`, `Element#classList.{add,remove}()`, and `importScripts()` into one call.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,properties:{ignore:{type:"array",uniqueItems:!0,description:"Methods to ignore."}}}],defaultOptions:[{ignore:[]}],messages:{[sN]:"Do not call `{{description}}` multiple times.",[sM]:"Merge with previous one."},languages:["js/js"]}},s_="no-process-exit",sV=e=>e0(e,"node:worker_threads")||e0(e,"worker_threads"),sz="no-single-promise-in-promise-methods/error",sK="no-single-promise-in-promise-methods/unwrap",sG="no-single-promise-in-promise-methods/use-promise-resolve",sJ=["all","any","race"],sX=(e,t)=>{let[r]=e.arguments[0].elements,n=eZ(r,t);return!eQ(r,t)&&["SequenceExpression","YieldExpression","ArrowFunctionExpression","ConditionalExpression","AssignmentExpression","LogicalExpression","BinaryExpression"].includes(r.type)&&(n=`(${n})`),n},sY=(e,t)=>e.getCommentsInside(t).length>0,sH=e=>"ArrayPattern"===e.type&&!e.typeAnnotation&&1===e.elements.length&&e.elements[0]?.type==="Identifier",sZ="no-static-only-class",sQ=({type:e,value:t})=>"Punctuator"===e&&"="===t,s0=e=>"PropertyDefinition"===e.type,s1="ignored-elements",s2="property-assignment",s3={create:e=>{let{sourceCode:t}=e,{maximumIgnoredElements:r}=e.options[0];e.on("ArrayPattern",n=>{let{elements:o,parent:a}=n;if(function(e){let t=0,r=0;for(let n of e)null===n?t=Math.max(t,++r):r=0;return t}(o)<=r)return;let i={node:n,messageId:s1},s=o.filter(e=>null!==e);if("VariableDeclarator"===a.type&&a.id===n&&null!==a.init&&1===s.length){let[r]=s;"AssignmentPattern"!==r.type&&(i.fix=function*(i){let s=o.indexOf(r),l="RestElement"===r.type,u=l?r.argument:r;yield i.replaceText(n,t.getText(u));let p=l?`.slice(${s})`:`[${s}]`,c=a.init;!eQ(c,e)&&n2(c,e)?(yield i.insertTextBefore(c,"("),yield i.insertTextAfter(a,`)${p}`)):yield i.insertTextAfter(a,p),yield oP(i,n,e)})}return i}),e.on("MemberExpression",e=>{if(function e(t){let{parent:r}=t;if(r){if(rg(r)&&r.expression===t||"AssignmentPattern"===r.type&&r.left===t||"RestElement"===r.type&&r.argument===t)return e(r);if("Property"===r.type&&r.value===t&&"ObjectPattern"===r.parent.type)return r.parent;if("ObjectPattern"===r.type||"ArrayPattern"===r.type)return r}}(e)?.type==="ArrayPattern")return{node:e,messageId:s2}})},meta:{type:"suggestion",docs:{description:"Disallow unreadable array destructuring.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{maximumIgnoredElements:{type:"integer",minimum:0,description:"Maximum number of consecutive ignored elements allowed."}}}],defaultOptions:[{maximumIgnoredElements:1}],messages:{[s1]:"Array destructuring may not contain consecutive ignored values.",[s2]:"Do not assign destructured values to object properties."},languages:["js/js"]}},s8="spread-in-list",s6="iterable-to-array",s9="iterable-to-array-in-for-of",s5="iterable-to-array-in-yield-star",s4="spread-in-collection-constructor",s7="spread-in-object-assign",le="clone-array",lt="suggestion/remove-object-assign-spread",lr=["Map","WeakMap","Set","WeakSet"],ln=["copyWithin","flat","slice","splice","toReversed","toSorted","toSpliced","with"],lo=[...ln,"filter","flatMap","map"],la=e=>"ArrayExpression"===e.type&&1===e.elements.length&&e.elements[0]?.type==="SpreadElement",li={ArrayExpression:"array literal",ObjectExpression:"object literal",CallExpression:"arguments",NewExpression:"arguments"};function*ls(e,t,r){let{sourceCode:n}=r,[o,a,i]=n.getFirstTokens(t,3);yield e.remove(o),yield e.remove(a);let[s,l]=n.getLastTokens(t,2);yield e.remove(l),eu(s)&&(yield e.remove(s));let{parent:u}=t;"ReturnStatement"!==u.type&&"ThrowStatement"!==u.type||u.argument!==t||nF(o,i,r)||eQ(t,r)?yield oP(e,t,r):yield oF(e,u,r)}let ll=(e,t)=>"CallExpression"===e.type&&"MemberExpression"===e.callee.type&&rG(e.callee.object,t),lu="no-useless-switch-case/error",lp="no-useless-switch-case/suggestion",lc=e=>e.consequent.every(e=>tn(e)),ld=e=>tx(e.test)||e9(e.test),lm=new Set(["CallExpression","MemberExpression"]),lf=new Set(["Identifier","MemberExpression","Super","ThisExpression"]),lg=e=>"MemberExpression"===(e=ry(e)).type?{...e,object:lg(e.object),property:e.computed?lg(e.property):e.property}:e,ly=(e,t)=>tQ(lg(e),lg(t)),lh=e=>lf.has(ry(e).type),lx=e=>!!("ChainExpression"===e.type||lm.has(e.type)&&e.optional)||Object.entries(e).some(([e,t])=>"parent"!==e&&!!t&&(Array.isArray(t)?t.some(e=>e?.type&&lx(e)):t.type&&lx(t))),lb="no-useless-undefined",lE="no-useless-undefined/suggestion",lD=new Set(["is","equal","notEqual","strictEqual","notStrictEqual","propertyVal","notPropertyVal","not","include","property","toBe","toHaveBeenCalledWith","toContain","toContainEqual","toEqual","same","notSame","strictSame","strictNotSame"]),lS=e=>{for(;e;e=e.upper)if("function"===e.type)return e.block},lv={">=":{valid:!0,addend:0},">":{valid:!0,addend:-1},"<":{valid:!1,addend:0},"<=":{valid:!1,addend:-1}},lC={"<=":{valid:!0,addend:0},"<":{valid:!0,addend:-1},">":{valid:!1,addend:0},">=":{valid:!1,addend:-1}},lA={"<":{valid:!0,kind:"length"},"<=":{valid:!0,kind:"lengthMinusOne"},">=":{valid:!1,kind:"length"},">":{valid:!1,kind:"lengthMinusOne"}},lT={">":{valid:!0,kind:"length"},">=":{valid:!0,kind:"lengthMinusOne"},"<=":{valid:!1,kind:"length"},"<":{valid:!1,kind:"lengthMinusOne"}},lw=new Set(["<","<=",">",">="]);function lk(e,t,r,n){let o=e[t];if(o&&r===n+o.addend)return o.valid}function lI(e,t){return tc(e=ry(e),{property:"length",optional:!1,computed:!1})&&ly(e.object,t)}function lj(e,t){return lI(e=ry(e),t)?"length":"BinaryExpression"===e.type&&"-"===e.operator&&lI(e.left,t)&&1===n1(e.right)?"lengthMinusOne":void 0}function lF(e,t,r){let n=e[t];if(n?.kind===r)return n.valid}let lB={create:e=>{let{sourceCode:t}=e,r=(e,r,n)=>{if(n){let r=lS(t.getScope(e));if(r?.returnType)return}return{node:e,messageId:lb,fix:r}},n=e.options[0];e.on("Identifier",o=>{if(!tx(o))return;let{parent:a}=o;if("ReturnStatement"===a.type&&a.argument===o){let n,a=lS(t.getScope(o));if(a?.returnType&&"TSUndefinedKeyword"!==(n=a.returnType?.typeAnnotation?.type)&&"TSVoidKeyword"!==n)return;return r(o,t=>oV(o,"",t,e))}if("YieldExpression"===a.type&&!a.delegate&&a.argument===o)return r(o,t=>oV(o,"",t,e));if(n.checkArrowFunctionBody&&"ArrowFunctionExpression"===a.type&&a.body===o)return r(o,t=>oV(o," {}",t,e),!0);if("VariableDeclarator"===a.type&&a.init===o&&"VariableDeclaration"===a.parent.type&&"const"!==a.parent.kind&&a.parent.declarations.includes(a)){let[,e]=t.getRange(a.id),[,n]=t.getRange(o);return r(o,t=>t.removeRange([e,n]))}if("AssignmentPattern"===a.type&&a.right===o)return r(o,function*(r){let{left:n}=a,[,i]=t.getRange(n),[,s]=t.getRange(o);yield r.removeRange([i,s]),(n.typeAnnotation||ru(e.physicalFilename))&&!n.optional&&tl(a.parent)&&a.parent.params.includes(a)&&(yield n.typeAnnotation?r.insertTextBefore(n.typeAnnotation,"?"):r.insertTextAfter(n,"?"))})}),e.on("ConditionalExpression",r=>{let n=tx(r.consequent);if(n===tx(r.alternate))return;let o=n?r.alternate:r.consequent,a=function(e,t){if(!(!tc(e=ry(e),{computed:!0,optional:!1})||lx(e)||eP(e.object,t,{considerGetters:!0})||eP(e.property,t,{considerGetters:!0})))return{node:e,index:function(e){if("BinaryExpression"===(e=ry(e)).type&&"-"===e.operator){let t=n1(e.right);if(Number.isSafeInteger(t)&&t>0)return{node:e.left,offset:t}}return{node:e,offset:0}}(e.property)}}(o,t);if(!a||function(e,t){if(!("BinaryExpression"!==(e=ry(e)).type||!lw.has(e.operator)||lx(e)))return function(e,t){let{operator:r,left:n,right:o}=e,a=n1(n),i=n1(o);return Number.isSafeInteger(i)&&ly(n,t.node)?lk(lv,r,i,t.offset):Number.isSafeInteger(a)&&ly(o,t.node)?lk(lC,r,a,t.offset):void 0}(e,t.index)??function(e,t){if(0!==t.index.offset)return;let{operator:r,left:n,right:o}=e,a=lj(o,t.node.object);if(a&&ly(n,t.index.node))return lF(lA,r,a);let i=lj(n,t.node.object);if(i&&ly(o,t.index.node))return lF(lT,r,i)}(e,t)}(r.test,a)!==!n)return;let i={node:n?r.consequent:r.alternate,messageId:lb};return 0===t.getCommentsInside(r).length&&(i.suggest=[{messageId:lE,fix(n){let a=t.getText(o),i=nW(t.getTokenBefore(r),e,a)?";":"";return n.replaceText(r,i+a)}}]),i}),!n.checkArguments||ru(e.physicalFilename)||e.on("CallExpression",t=>{var r;let n,o=t.arguments,a=o.at(-1);if(!(!tx(a)||("Identifier"===(r=t.callee).type?n=r.name:"MemberExpression"===r.type&&!1===r.computed&&"Identifier"===r.property.type&&(n=r.property.name),lD.has(n)||"push"===n||"unshift"===n||"includes"===n||"add"===n||"has"===n||"delete"===n||"set"===n||"createContext"===n||/^set[A-Z]/v.test(n)||"useRef"===n||"ref"===n))&&(!(!t.optional&&"MemberExpression"===t.callee.type&&!t.callee.computed&&"Identifier"===t.callee.property.type&&"bind"===t.callee.property.name)||1===o.length))return{node:a,messageId:lb,fix:t=>ok(t,a,e)}})},meta:{type:"suggestion",docs:{description:"Disallow useless `undefined`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,properties:{checkArguments:{type:"boolean",description:"Whether to check function arguments."},checkArrowFunctionBody:{type:"boolean",description:"Whether to check arrow function bodies."}}}],defaultOptions:[{checkArguments:!0,checkArrowFunctionBody:!0}],messages:{[lb]:"Do not use useless `undefined`.",[lE]:"Use the indexed access directly."},languages:["js/js"]}},lR="numeric-separators-style";function l$(e,{minimumDigits:t,groupLength:r},n){let{length:o}=e;if(o<t)return e;let a=[];if(n)for(let t=0;t<o;t+=r){let n=Math.min(t+r,o);a.push(e.slice(t,n))}else for(let t=o;t>0;t-=r){let n=Math.max(t-r,0);a.unshift(e.slice(n,t))}return a.join("_")}let lP={binary:{minimumDigits:0,groupLength:4},octal:{minimumDigits:0,groupLength:4},hexadecimal:{minimumDigits:0,groupLength:2},number:{minimumDigits:5,groupLength:3,fractionGroupLength:1/0}},lL={create:e=>{let{onlyIfContainsSeparator:t,binary:r,octal:n,hexadecimal:o,number:a}=e.options[0],i={"0b":{onlyIfContainsSeparator:t,...r},"0o":{onlyIfContainsSeparator:t,...n},"0x":{onlyIfContainsSeparator:t,...o},"":{onlyIfContainsSeparator:t,...a}};e.on("Literal",e=>{let t,r;if(!(e8(e)||e5(e))||e8(e)&&/^0\d+$/.test(e.raw))return;let{raw:n}=e,o=n,a="";e5(e)&&(o=n.slice(0,-1),a="n");let s=o.replaceAll("_",""),{prefix:l,data:u}=(t="",r=s,/^0[box]/i.test(s)&&(t=s.slice(0,2),r=s.slice(2)),{prefix:t,data:r}),{onlyIfContainsSeparator:p}=i[l.toLowerCase()];if(p&&!n.includes("_"))return;let c=function(e,{prefix:t,data:r},n){let o=n[t.toLowerCase()];if(t)return t+l$(r,o);let{number:a,mark:i,sign:s,power:l}=function(e){let{number:t,mark:r="",sign:n="",power:o=""}=e.match(/^(?<number>[\d._]*)(?:(?<mark>e)(?<sign>[+-])?(?<power>[\d_]+))?$/i).groups;return{number:t,mark:r,sign:n,power:o}}(e);return function(e,t){let{integer:r,dot:n,fractional:o}=function(e){let t=e.split("."),[r,n=""]=t;return{integer:r,dot:2===t.length?".":"",fractional:n}}(e);return l$(r,t)+n+l$(o,{...t,groupLength:t.fractionGroupLength},!0)}(a,o)+i+s+l$(l,n[""])}(s,{prefix:l,data:u},i)+a;if(n!==c)return{node:e,messageId:lR,fix:t=>t.replaceText(e,c)}})},meta:{type:"suggestion",docs:{description:"Enforce the style of numeric separators by correctly grouping digits.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{...Object.fromEntries(Object.keys(lP).map(e=>[e,(({withFraction:e=!1}={})=>({type:"object",additionalProperties:!1,properties:{onlyIfContainsSeparator:{type:"boolean",description:"Whether to only enforce the style if the number already contains a separator."},minimumDigits:{type:"integer",minimum:0,description:"The minimum number of digits before separators are enforced."},groupLength:{type:"integer",minimum:1,description:"The number of digits in each group."},...e&&{fractionGroupLength:{type:"integer",minimum:1,description:"The number of digits in each group after the decimal point. Defaults to no grouping."}}}}))({withFraction:"number"===e})])),onlyIfContainsSeparator:{type:"boolean",description:"Whether to only enforce the style if the number already contains a separator."}}}],defaultOptions:[{onlyIfContainsSeparator:!1,binary:lP.binary,octal:lP.octal,hexadecimal:lP.hexadecimal,number:lP.number}],messages:{[lR]:"Invalid group length in numeric value."},languages:["js/js"]}},lN="error-zero-index",lM="error-shift",lO="error-pop",lq="error-at-zero",lU="error-at-minus-one",lW="error-slice-minus-one",l_="error-destructuring-declaration",lV="error-destructuring-assignment",lz="error-variable",lK="suggest-nullish-coalescing-operator",lG="suggest-logical-or-operator",lJ=(e,t,r)=>td(e,{method:"filter",minimumArguments:1,maximumArguments:2,optionalCall:!1,...r})&&!rG(e.callee.object,t),lX=e=>"UnaryExpression"===e.type&&"-"===e.operator&&e.prefix&&"Literal"===e.argument.type&&"1"===e.argument.raw,lY=(e,t)=>td(e,{method:"slice",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&lX(e.arguments[0])&&lJ(e.callee.object,t),lH=e=>e?"AssignmentExpression"===e.type?e:"VariableDeclarator"===e.type?{left:e.id,right:e.init}:{}:{};function*lZ(e,t,r){let{left:n}=lH(e),[o]=n.elements,a=t.getText("AssignmentPattern"===o.type?o.left:o);yield r.replaceText(n,a),((e,t)=>{if("AssignmentExpression"!==e.type||eL(e,t))return!1;let{left:r}=lH(e),[n]=r.elements,{type:o}="AssignmentPattern"===n.type?n.left:n;return"ObjectExpression"===o||"ObjectPattern"===o})(e,t)&&(yield r.insertTextBefore(e,"("),yield r.insertTextAfter(e,")"))}let lQ=e=>"AssignmentPattern"===lH(e).left.elements[0].type,l0=(e,t)=>{let r,n,{property:o}=lH(t).right.callee;return lQ(t)?r=[{operator:"??",messageId:lK},{operator:"||",messageId:lG}].map(({messageId:r,operator:n})=>({messageId:r,*fix(r){yield r.replaceText(o,"find"),yield((e,t,r,n)=>{let{left:o,right:a}=lH(e),[i]=o.elements,s=i.right,l=t.getText(s);return(eL(s,t)||"LogicalExpression"===s.type&&(s.operator===n||"||"===n&&"??"===s.operator||"??"===n&&("||"===s.operator||"&&"===s.operator))||"ConditionalExpression"===s.type||"AssignmentExpression"===s.type||"YieldExpression"===s.type||"SequenceExpression"===s.type)&&(l=`(${l})`),r.insertTextAfter(a,` ${n} ${l}`)})(t,e,r,n),yield lZ(t,e,r)}})):n=function*(r){yield r.replaceText(o,"find"),yield lZ(t,e,r)},{fix:n,suggest:r}},l1=e=>"MemberExpression"===e.parent.type&&!0===e.parent.computed&&e.parent.object===e&&"Literal"===e.parent.property.type&&"0"===e.parent.property.raw,l2=e=>{let{left:t,right:r}=lH(e.parent);return t&&r&&r===e&&"ArrayPattern"===t.type&&1===t.elements.length&&t.elements[0]&&"RestElement"!==t.elements[0].type},l3={create:e=>{let{sourceCode:t}=e,{checkFromLast:r}=e.options[0];e.on("MemberExpression",t=>{if(t.computed&&"Literal"===t.property.type&&"0"===t.property.raw&&lJ(t.object,e)&&!r3(t))return{node:t.object.callee.property,messageId:lN,fix:r=>[r.replaceText(t.object.callee.property,"find"),oM(r,t,e)]}}),e.on("CallExpression",t=>{if(td(t,{method:"shift",argumentsLength:0,optionalCall:!1,optionalMember:!1})&&lJ(t.callee.object,e))return{node:t.callee.object.callee.property,messageId:lM,fix:r=>[r.replaceText(t.callee.object.callee.property,"find"),...oO(r,t,e)]}}),e.on("VariableDeclarator",r=>{if("ArrayPattern"===r.id.type&&1===r.id.elements.length&&r.id.elements[0]&&"RestElement"!==r.id.elements[0].type&&lJ(r.init,e,{optionalMember:!1}))return{node:r.init.callee.property,messageId:l_,...l0(t,r)}}),e.on("AssignmentExpression",r=>{if("ArrayPattern"===r.left.type&&1===r.left.elements.length&&r.left.elements[0]&&"RestElement"!==r.left.elements[0].type&&lJ(r.right,e,{optionalMember:!1}))return{node:r.right.callee.property,messageId:lV,...l0(t,r)}}),e.on("VariableDeclarator",r=>{if(!("Identifier"===r.id.type&&lJ(r.init,e,{optionalMember:!1})&&"VariableDeclaration"===r.parent.type&&r.parent.declarations.includes(r)&&("ExportNamedDeclaration"!==r.parent.parent.type||r.parent.parent.declaration!==r.parent)))return;let n=t.getScope(r),o=ei(n,r.id),a=rd(o).filter(e=>e!==r.id);if(0===a.length)return;let i=[],s=[];for(let e of a)if(l1(e))i.push(e.parent);else{if(!l2(e))return;s.push(e.parent)}let l={node:r.init.callee.property,messageId:lz};return s.every(e=>!lQ(e))&&(l.fix=function*(a){yield a.replaceText(r.init.callee.property,"find");let l=(e=>{let t=n4.singular(e);if(t!==e)return t})(r.id.name);if(l){let r=tG(l,tM(n));yield oW(o,r,e,a),yield function*(e,t){yield e.insertTextBeforeRange(t,""),yield e.insertTextAfterRange(t,"")}(a,t.getRange(t.ast))}for(let t of i)yield oM(a,t,e);for(let e of s)yield lZ(e,t,a)}),l}),e.on("CallExpression",t=>{if(td(t,{method:"at",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&"Literal"===t.arguments[0].type&&"0"===t.arguments[0].raw&&lJ(t.callee.object,e))return{node:t.callee.object.callee.property,messageId:lq,fix:r=>[r.replaceText(t.callee.object.callee.property,"find"),...oO(r,t,e)]}}),r&&(e.on("CallExpression",t=>{if(td(t,{method:"pop",argumentsLength:0,optionalCall:!1,optionalMember:!1})&&lJ(t.callee.object,e))return{node:t.callee.object.callee.property,messageId:lO,fix:r=>[r.replaceText(t.callee.object.callee.property,"findLast"),...oO(r,t,e)]}}),e.on("CallExpression",t=>{if(td(t,{method:"at",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&lX(t.arguments[0])&&lJ(t.callee.object,e))return{node:t.callee.object.callee.property,messageId:lU,fix:r=>[r.replaceText(t.callee.object.callee.property,"findLast"),...oO(r,t,e)]}}),e.on("MemberExpression",r=>{if(!(r.computed&&!r.optional&&"Literal"===r.property.type&&"0"===r.property.raw&&!r3(r)&&lY(r.object,e)))return;let n=r.object.callee.object;return{node:n.callee.property,messageId:lW,*fix(o,{abort:a}){if(re(e,[eH(n,e)[1],t.getRange(r)[1]]))return a();yield o.replaceText(n.callee.property,"findLast"),yield oO(o,r.object,e),yield oM(o,r,e)}}}),e.on("CallExpression",r=>{if(!(td(r,{methods:["pop","shift"],argumentsLength:0,optionalCall:!1,optionalMember:!1})&&lY(r.callee.object,e)))return;let n=r.callee.object.callee.object;return{node:n.callee.property,messageId:lW,*fix(o,{abort:a}){if(re(e,[eH(n,e)[1],t.getRange(r)[1]]))return a();yield o.replaceText(n.callee.property,"findLast"),yield oO(o,r.callee.object,e),yield oO(o,r,e)}}}))},meta:{type:"suggestion",docs:{description:"Prefer `.find(…)` and `.findLast(…)` over the first or last element from `.filter(…)`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,properties:{checkFromLast:{type:"boolean",description:"Whether to also check for patterns that can be replaced with `findLast()`."}}}],defaultOptions:[{checkFromLast:!0}],messages:{[lz]:"Prefer `.find(…)` over `.filter(…)`.",[lN]:"Prefer `.find(…)` over `.filter(…)[0]`.",[lq]:"Prefer `.find(…)` over `.filter(…).at(0)`.",[lM]:"Prefer `.find(…)` over `.filter(…).shift()`.",[lO]:"Prefer `.findLast(…)` over `.filter(…).pop()`.",[lU]:"Prefer `.findLast(…)` over `.filter(…).at(-1)`.",[lW]:"Prefer `.findLast(…)` over `.filter(…).slice(-1)`.",[l_]:"Prefer `.find(…)` over destructuring `.filter(…)`.",[lV]:"Prefer `.find(…)` over destructuring `.filter(…)`.",[lK]:"Replace `.filter(…)` with `.find(…) ?? …`.",[lG]:"Replace `.filter(…)` with `.find(…) || …`."},languages:["js/js"]}},l8="prefer-array-flat-map",l6="prefer-array-flat-map/filter-flat-map",l9="prefer-array-flat-map/filter-flat-map-suggestion",l5=["React.Children","Children"],l4=new Set(["ArrowFunctionExpression","AssignmentExpression","ClassExpression","ConditionalExpression","FunctionExpression","ObjectExpression","SequenceExpression","TSAsExpression","TSNonNullExpression","TSSatisfiesExpression","TSTypeAssertion","YieldExpression"]),l7=e=>"ArrowFunctionExpression"===e.type&&!e.async&&!e.returnType&&!e.typeParameters&&1===e.params.length&&"Identifier"===e.params[0].type&&!e.params[0].optional&&!e.params[0].typeAnnotation&&"BlockStatement"!==e.body.type,ue="prefer-array-flat",ut={getArrayNode:e=>e.callee.object,isOptionalArray:e=>e.callee.optional,description:"Array#flatMap()",testFunction(e,t){if(!td(e,{method:"flatMap",argumentsLength:1,optionalCall:!1}))return!1;let[r]=e.arguments;return"ArrowFunctionExpression"===r.type&&!r.async&&1===r.params.length&&nB(r.params[0],r.body)&&!us(e.callee.object,t)}},ur={testFunction(e){if(!td(e,{method:"reduce",argumentsLength:2,optionalCall:!1}))return!1;let[t,r]=e.arguments;if(!("ArrowFunctionExpression"===t.type&&!t.async&&2===t.params.length&&to(r)))return!1;let n=t.body,[o,a]=t.params;return td(n,{method:"concat",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&nB(o,n.callee.object)&&nB(a,n.arguments[0])||"ArrayExpression"===n.type&&2===n.elements.length&&n.elements.every((e,r)=>e?.type==="SpreadElement"&&"Identifier"===e.argument.type&&nB(t.params[r],e.argument))},getArrayNode:e=>e.callee.object,isOptionalArray:e=>e.callee.optional,description:"Array#reduce()"},un={testFunction:e=>td(e,{method:"concat",argumentsLength:1,allowSpreadElement:!0,optionalCall:!1,optionalMember:!1})&&to(e.callee.object)&&"SpreadElement"===e.arguments[0].type,getArrayNode:e=>e.arguments[0].argument,description:"[].concat()"},uo={testFunction(e){if(!(td(e,{methods:["apply","call"],argumentsLength:2,allowSpreadElement:!0,optionalCall:!1,optionalMember:!1})&&tb(e.callee.object,{property:"concat"})))return!1;let[t,r]=e.arguments;return to(t)&&("apply"===e.callee.property.name&&"SpreadElement"!==r.type||"call"===e.callee.property.name&&"SpreadElement"===r.type)},getArrayNode(e){let t=e.arguments[1];return"SpreadElement"===t.type?t.argument:t},description:"Array.prototype.concat()"},ua=["_.flatten","lodash.flatten","underscore.flatten"],ui=/^\p{Uppercase_Letter}/u,us=(e,t)=>{let r,n;return"Identifier"===e.type&&ui.test(e.name)&&(!(r=ra(e,t))||"ArrayExpression"!==r.type&&("NewExpression"!==r.type||"Identifier"!==r.callee.type||"Array"!==r.callee.name))||!!((n=ra(e,t))&&("ObjectExpression"===n.type||"Literal"===n.type||"TemplateLiteral"===n.type||"ArrowFunctionExpression"===n.type||"FunctionExpression"===n.type||"ClassExpression"===n.type||"NewExpression"===n.type&&"Identifier"===n.callee.type&&"Array"!==n.callee.name))},ul={create:function(e){let{functions:t}=e.options[0],r=[...t,...ua],n=[ut,ur,un,uo,{testFunction:e=>e7(e,{argumentsLength:1,optional:!1})&&ty(e.callee,r),getArrayNode:e=>e.arguments[0],description:e=>`${r.find(t=>tg(e.callee,t)).trim()}()`}];e.on("CallExpression",function*(t){for(let{testFunction:r,description:o,getArrayNode:a,shouldSwitchToArray:i,isOptionalArray:s}of n){if(!r(t,e))continue;let n=a(t),l=s?.(t),u={description:"string"==typeof o?o:o(t)},p={node:t,messageId:ue,data:u},{sourceCode:c}=e;c.getCommentsInside(t).length===c.getCommentsInside(n).length&&(p.fix=function(e,t,r,n,o){return"function"==typeof n&&(n=n(e)),function*(a){let{sourceCode:i}=r,s=eZ(t,r);n?s=`[${s}]`:!eQ(t,i)&&n2(t,r)&&(s=`(${s})`),s+=`${o?"?":""}.flat()`,nW(i.getTokenBefore(e),r,s)&&(s=`;${s}`),yield a.replaceText(e,s),yield oP(a,e,r)}}(t,n,e,i,l)),yield p}})},meta:{type:"suggestion",docs:{description:"Prefer `Array#flat()` over legacy techniques to flatten arrays.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{functions:{type:"array",uniqueItems:!0,description:"Additional functions to check."}}}],defaultOptions:[{functions:[]}],messages:{[ue]:"Prefer `Array#flat()` over `{{description}}` to flatten an array."},languages:["js/js"]}},uu="some",up="some-suggestion",uc="filter",ud={create:nZ(e=>{e.on("CallExpression",t=>{if(!td(t,{methods:["find","findLast"],minimumArguments:1,maximumArguments:2,optionalCall:!1,optionalMember:!1})||t.typeArguments||t.typeParameters||rG(t.callee.object,e))return;let r="BinaryExpression"===t.parent.type&&t.parent.left===t&&(["!=","==","===","!=="].includes(t.parent.operator)&&tx(t.parent.right)||("!="===t.parent.operator||"=="===t.parent.operator)&&e9(t.parent.right));if(!r&&!(tA(t,e)||tT(t)||function(e,t){if(!rK(e.callee.object,t))return!1;let r=e.parent;if("VariableDeclarator"!==r.type||r.init!==e||"Identifier"!==r.id.type||r.id.typeAnnotation||"VariableDeclaration"!==r.parent.type||"const"!==r.parent.kind||"ExportNamedDeclaration"===r.parent.parent.type&&r.parent.parent.declaration===r.parent)return!1;let[n]=t.sourceCode.getDeclaredVariables(r);if(!n||1!==n.identifiers.length||n.identifiers[0]!==r.id)return!1;let o=n.references.filter(e=>!e.init);return 0!==o.length&&o.every(e=>{let{identifier:r}=e;return e.isRead()&&(tA(r,t)||tT(r))})}(t,e)))return;let n=t.callee.property,o=r&&re(e,[eH(t,e)[1],e.sourceCode.getRange(t.parent)[1]]);return{node:n,messageId:uu,data:{method:n.name},suggest:o?void 0:[{messageId:up,*fix(o){if(yield o.replaceText(n,"some"),!r)return;let{sourceCode:a}=e,i=eH(t,e);yield o.removeRange([i[1],a.getRange(t.parent)[1]]),"!="!==t.parent.operator&&"!=="!==t.parent.operator&&(yield o.insertTextBeforeRange(i,"!"))}}]}}),e.on("BinaryExpression",t=>{let{left:r,right:n,operator:o}=t;if(!(td(r,{methods:["findIndex","findLastIndex"],argumentsLength:1,optionalCall:!1,optionalMember:!1})&&(["!==","!=",">","===","=="].includes(o)&&"UnaryExpression"===n.type&&"-"===n.operator&&n.argument&&"Literal"===n.argument.type&&1===n.argument.value||[">=","<"].includes(o)&&e0(n,0)))||rG(r.callee.object,e))return;let a=r.callee.property;return{node:a,messageId:uu,data:{method:a.name},*fix(n,{abort:i}){let{sourceCode:s}=e,l=s.getTokenAfter(r,e=>"Punctuator"===e.type&&e.value===o),[u]=s.getRange(l),[,p]=s.getRange(t);if(re(e,[u,p]))return i();["===","==","<"].includes(o)&&(yield n.insertTextBefore(t,"!")),yield n.replaceText(a,"some"),yield n.removeRange([u,p])}}}),e.on("BinaryExpression",t=>{if(!((">"===t.operator||"!=="===t.operator)&&"Literal"===t.right.type&&"0"===t.right.raw&&tc(t.left,{property:"length",optional:!1})&&td(t.left.object,{method:"filter",optionalCall:!1,optionalMember:!1})))return;let r=t.left.object,n=r.callee.object;if(rG(n,e)||"Identifier"===n.type&&n.name.startsWith("$"))return;let[o]=r.arguments;if(!o||nI(o))return;let a=r.callee.property;return{node:a,messageId:uc,*fix(n,{abort:o}){let{sourceCode:i}=e,s=t.left;if(re(e,[eH(r,e)[1],i.getRange(t)[1]]))return o();yield n.replaceText(a,"some"),yield oM(n,s,e),yield n.removeRange([eH(s,e)[1],i.getRange(t)[1]])}}})}),meta:{type:"suggestion",docs:{description:"Prefer `.some(…)` over `.filter(…).length` check and `.{find,findLast,findIndex,findLastIndex}(…)`.",recommended:"unopinionated"},fixable:"code",messages:{[uu]:"Prefer `.some(…)` over `.{{method}}(…)`.",[up]:"Replace `.{{method}}(…)` with `.some(…)`.",[uc]:"Prefer `.some(…)` over non-zero length check from `.filter(…)`."},hasSuggestions:!0,languages:["js/js"]}},um=(e,t)=>({node:e,messageId:`error/${e.name}`,suggest:[{messageId:`suggestion/${t}`,fix:r=>r.replaceText(e,t)}]}),uf="preferDefaultParameters",ug="preferDefaultParametersSuggest",uy=new Set(["CallExpression","NewExpression","ImportExpression","TaggedTemplateExpression"]),uh=(e,t)=>{if(!t)return!1;if(uy.has(t.type))return!0;for(let r of e.visitorKeys[t.type]){let n=t[r];if(Array.isArray(n)){for(let t of n)if(uh(e,t))return!0}else if(uh(e,n))return!0}return!1},ux="prefer-logical-operator-over-ternary/error",ub="prefer-logical-operator-over-ternary/optional-chain-error",uE="prefer-logical-operator-over-ternary/suggestion",uD="prefer-logical-operator-over-ternary/optional-chain-suggestion",uS=new Set(["==","==="]),uv=new Set(["!=","!=="]);function uC(e,t,r){if(tQ(e,t))return!0;if(e.type!==t.type)return!1;switch(e.type){case"AwaitExpression":return uC(e.argument,t.argument,r);case"LogicalExpression":return e.operator===t.operator&&uC(e.left,t.left,r)&&uC(e.right,t.right,r);case"UnaryExpression":return e.operator===t.operator&&e.prefix===t.prefix&&uC(e.argument,t.argument,r);case"UpdateExpression":return!1}return r.getText(e)===r.getText(t)}function uA({context:e,conditionalExpression:t,left:r,right:n,operators:o=["??","||"]}){return e.sourceCode.getCommentsInside(t).length>0?{node:t,messageId:ux}:{node:t,messageId:ux,suggest:o.map(o=>({messageId:uE,data:{operator:o},fix:a=>(function({fixer:e,context:t,conditionalExpression:r,left:n,right:o,operator:a}){let{sourceCode:i}=t,s=[n,o].map((e,r)=>{let n=eQ(e,t),o=n?eZ(e,t):i.getText(e);return!n&&n6(e,{operator:a,property:0===r?"left":"right"})&&(o=`(${o})`),o}).join(` ${a} `);return nW(i.getTokenBefore(r),t,s)&&(s=`;${s}`),e.replaceText(r,s)})({fixer:a,context:e,conditionalExpression:t,left:r,right:n,operator:o})}))}}function uT(e){return e9(e)?"null":tx(e)?"undefined":void 0}function uw(e){if("BinaryExpression"!==e.type||!uS.has(e.operator)&&!uv.has(e.operator))return;let t=uT(e.left),r=uT(e.right);if(!!t==!!r)return;let n=uS.has(e.operator);return{reference:t?e.right:e.left,kind:2===e.operator.length?"nullish":t??r,isTrueWhenNullish:n}}let uk=(e,t)=>"null"===e.kind&&"undefined"===t.kind||"undefined"===e.kind&&"null"===t.kind,uI="with-name",uj="without-name",uF="regexp-exec",uB="string-match",uR="string-search",u$="suggestion",uP="string",uL="regexp",uN="other",uM="string-or-other",uO="regexp-or-other",uq="unknown";function*uU(e,{stringNode:t,methodNode:r,regexpNode:n},o){let{sourceCode:a}=o;yield e.replaceText(r,"test");let i=a.getText(t);eL(n,a)||"SequenceExpression"!==t.type||(i=`(${i})`),yield e.replaceText(n,i);let s=a.getText(n);!eL(t,a)&&n2(n,o)&&(s=`(${s})`),yield e.replaceText(t,s)}let uW=[{type:uF,test:e=>td(e,{method:"exec",argumentsLength:1,optionalCall:!1,optionalMember:!1}),getNodes:e=>({stringNode:e.arguments[0],methodNode:e.callee.property,regexpNode:e.callee.object}),*fix(e,{methodNode:t}){yield e.replaceText(t,"test")}},{type:uB,test:e=>td(e,{method:"match",argumentsLength:1,optionalCall:!1,optionalMember:!1}),getNodes:e=>({stringNode:e.callee.object,methodNode:e.callee.property,regexpNode:e.arguments[0]}),fix:uU},{type:uR,test:e=>td(e,{method:"search",argumentsLength:1,optionalCall:!1,optionalMember:!1}),getNodes:e=>({stringNode:e.callee.object,methodNode:e.callee.property,regexpNode:e.arguments[0]}),fix:uU}],u_=e=>e6(e)||te(e,{name:"RegExp"}),uV=e=>{if("[object RegExp]"===Object.prototype.toString.call(e))return e},uz=e=>{if(e.includes(uq))return uq;let t=new Set(e),r=t.has(uP)||t.has(uM),n=t.has(uL)||t.has(uO);if(r&&n)return uM;let o=t.has(uN)||t.has(uM)||t.has(uO);return r?o?uM:uP:n?o?uO:uL:uN},uK=e=>{let t=new Set(e);return t.has(uq)?uq:t.has(uL)?uL:t.has(uP)?uP:uN},uG=new Set(["TSBigIntKeyword","TSBooleanKeyword","TSNeverKeyword","TSNullKeyword","TSNumberKeyword","TSObjectKeyword","TSSymbolKeyword","TSUndefinedKeyword","TSVoidKeyword","TSArrayType","TSTypeLiteral","TSTupleType","TSFunctionType","TSConstructorType"]),uJ=e=>{switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return uJ(e.typeAnnotation);case"TSStringKeyword":return uP;case"TSLiteralType":return"Literal"===e.literal.type&&"string"==typeof e.literal.value?uP:uN;case"TSTypeReference":if("Identifier"!==e.typeName.type)return uq;if("String"===e.typeName.name)return uP;if("RegExp"===e.typeName.name)return uL;if("Array"===e.typeName.name||"ReadonlyArray"===e.typeName.name)return uN;return uq;case"TSUnionType":return uz(e.types.map(e=>uJ(e)));case"TSIntersectionType":return uK(e.types.map(e=>uJ(e)));default:return uG.has(e?.type)?uN:uq}},uX=(e,t)=>{let r,n;if(r=e,rD.has(r.intrinsicName)||(n=e=t.getNonNullableType(e),rD.has(n.intrinsicName)))return uq;if(e.isTypeParameter?.()){let r=e.getConstraint();return r?uX(r,t):uq}return e.isUnion()?uz(e.types.map(e=>uX(e,t))):e.isIntersection()?uK(e.types.map(e=>uX(e,t))):"string"===e.intrinsicName||e.isStringLiteral?.()?uP:"RegExp"===rv(e)?.getName()||rA(e,t).some(e=>uX(e,t)===uL)?uL:uN},uY=new Set(["ArrayExpression","ArrowFunctionExpression","ClassExpression","FunctionExpression","ObjectExpression"]);function uH(e,t,r=new Set){let n;if(u_(e))return uL;if(nC(e,t))return uP;switch(e.type){case"Identifier":{let n=((e,t,r)=>{let{sourceCode:n}=t,o=ei(n.getScope(e),e);if(!o||r.has(o)||1!==o.defs.length)return uq;r.add(o);let[a]=o.defs,i=uJ(a.name?.typeAnnotation),s=uq;return i!==uq?s=i:"Variable"===a.type&&"const"===a.parent.kind&&a.node.init&&(s=uH(a.node.init,t,r)),r.delete(o),s})(e,t,r);if(n!==uq)return n;break}case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":{let n=uJ(e.typeAnnotation);return n===uq?uH(e.expression,t,r):n}case"TSNonNullExpression":case"ParenthesizedExpression":return uH(e.expression,t,r);case"SequenceExpression":return uH(e.expressions.at(-1),t,r);case"ConditionalExpression":return uz([uH(e.consequent,t,r),uH(e.alternate,t,r)])}let o=t.sourceCode.getScope(e),a=(n=ew(e,o))?"string"==typeof n.value?uP:uV(n.value)?uL:void 0===n.value&&("Identifier"===e.type&&"undefined"===e.name||"UnaryExpression"===e.type&&"void"===e.operator)||null===n.value||["bigint","boolean","number","symbol"].includes(typeof n.value)?uN:uq:uq;return a!==uq?a:uY.has(e.type)?uN:((e,t)=>{let{parserServices:r}=t.sourceCode;if(!r?.program)return uq;try{let{program:t}=r;return uX(r.getTypeAtLocation(e),t.getTypeChecker())}catch{return uq}})(e,t)}let uZ=(e,t)=>{let r;return"UnaryExpression"===(r=((e,t)=>{for(;;){if(tE(e.parent)||tC(e.parent,t)&&e.parent.arguments[0]===e){e=e.parent;continue}break}return e})(e,t)).parent.type&&"!"===r.parent.operator&&r.parent.argument===r},uQ=(e,[t,r])=>e.getAllComments().some(n=>{let[o,a]=e.getRange(n);return o>=t&&a<=r}),u0=(e,t,r)=>[eH(t,r)[1],r.sourceCode.getRange(e.node)[1]],u1=e=>[{messageId:u$,fix:e}],u2=e=>[uL,uO,uN].includes(e),u3=e=>[uP,uM,uN].includes(e),u8=({type:e,stringType:t,regexpType:r})=>e===uF?u3(r)||u2(t):u2(t)||u3(r),u6=(e,t,r,{lengthCheck:n,searchCheck:o,callExpression:a,isRegExp:i,staticRegExp:s})=>{if(n){((e,t)=>{let{sourceCode:r}=t,n=[[eH(e.lengthNode.object,t)[1],r.getRange(e.lengthNode)[1]]];return e.comparisonLeftNode&&n.push([eH(e.comparisonLeftNode,t)[1],r.getRange(e.node)[1]]),n})(n,r).every(e=>!uQ(r.sourceCode,e))&&(e.suggest=u1(t));return}if(!o||!uQ(r.sourceCode,u0(o,a,r))){if((({searchCheck:e,isRegExp:t,staticRegExp:r})=>t||r?.global===!1&&(!e||!1===r.sticky))({searchCheck:o,isRegExp:i,staticRegExp:s})){e.fix=t;return}e.suggest=u1(t)}},u9={create:nZ(e=>{e.on("CallExpression",function*(t){let r=((e,t)=>{let r,n="ChainExpression"===(r=e.parent).type?r.expression:r;if(!tc(n,{property:"length"})||n.object!==e)return;let o="ChainExpression"===n.parent.type?n.parent:n;if(uZ(o,t))return;if(tA(o,t)||tT(o))return{lengthNode:n,node:o};let{parent:a}=o;if(a?.type==="BinaryExpression"&&a.left===o&&">"===a.operator&&e0(a.right,0)&&!uZ(a,t)&&(tA(a,t)||tT(a)))return{lengthNode:n,node:a,comparisonLeftNode:o}})(t,e),n=(e=>{let{parent:t}=e;if(t?.type!=="BinaryExpression"||t.left!==e)return;let{operator:r,right:n}=t;return["!==","!=",">"].includes(r)&&tm(n)||">="===r&&e0(n,0)?{node:t,negate:!1}:["===","=="].includes(r)&&tm(n)||"<"===r&&e0(n,0)?{node:t,negate:!0}:void 0})(t);if(r||n||tA(t,e)||tT(t))for(let{type:o,test:a,getNodes:i,fix:s}of uW){if(o===uR!=!!n||!a(t))continue;let l=i(t),{methodNode:u,regexpNode:p}=l,c=e.sourceCode.getScope(p),d=ew(p,c),m=d?uV(d.value):void 0,f=u_(p);if(u8({type:o,stringType:uH(l.stringNode,e),regexpType:uH(p,e)}))continue;let g={node:o===uF?u:t,messageId:o};u6(g,function*(o){for(let a of(r?(yield oM(o,r.lengthNode,e),r.comparisonLeftNode&&(yield o.removeRange([eH(r.comparisonLeftNode,e)[1],e.sourceCode.getRange(r.node)[1]]))):n&&(n.negate&&(yield o.insertTextBefore(n.node,"!")),yield o.removeRange(u0(n,t,e))),s(o,l,e)))yield a},e,{lengthCheck:r,searchCheck:n,callExpression:t,isRegExp:f,staticRegExp:m}),yield g}})}),meta:{type:"suggestion",docs:{description:"Prefer `RegExp#test()` over `String#match()`, `String#search()`, and `RegExp#exec()`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[uF]:"Prefer `.test(…)` over `.exec(…)`.",[uB]:"Prefer `RegExp#test(…)` over `String#match(…)`.",[uR]:"Prefer `RegExp#test(…)` over `String#search(…)` when checking for existence.",[u$]:"Switch to `RegExp#test(…)`."},languages:["js/js"]}},u5="error",u4="suggestion",u7=0x100000000-1,pe=["copyWithin","fill","filter","flat","flatMap","map","reverse","sort","splice","toReversed","toSorted","toSpliced","with","split","toArray"],pt=["slice","concat"],pr=e=>td(e.parent.parent,{method:"includes",optionalCall:!1,optionalMember:!1,argumentsLength:1})&&e.parent.object===e,pn=new Set(["ForOfStatement","ForStatement","ForInStatement","WhileStatement","DoWhileStatement","FunctionDeclaration","FunctionExpression","ArrowFunctionExpression"]),po=(e,t,r=new Set)=>"ArrayExpression"===e.type||tt(e,{name:"Array",optional:!1})||td(e,{object:"Array",methods:["from","of"],optionalCall:!1,optionalMember:!1})||td(e,{methods:pe,optionalCall:!1,optionalMember:!1})||td(e,{methods:pt,optionalCall:!1,optionalMember:!1})&&void 0===e3(e.callee.object)&&("Identifier"!==e.callee.object.type||((e,t,r=new Set)=>{if("Identifier"!==e.type)return!1;let n=ei(t,e);if(!n||r.has(n)||1!==n.defs.length)return!1;r.add(n);let[o]=n.defs;return"Variable"===o.type&&"const"===o.kind&&!!o.node.init&&po(o.node.init,t,r)})(e.callee.object,t,r)),pa=e=>Number.isSafeInteger(e)&&e>=0&&e<=u7,pi=e=>e.some(e=>e?.type==="SpreadElement"),ps=(e,t,r)=>e.getCommentsInside(t).some(t=>{let n,o;return n=e.getRange(t),o=e.getRange(r),!(n[0]>=o[0])||!(n[1]<=o[1])}),pl=(e,t)=>(e?.type==="TSAsExpression"||e?.type==="TSTypeAssertion"||e?.type==="TSNonNullExpression")&&e.expression===t,pu=e=>{let{parent:t}=e;if(!("MemberExpression"===t.type&&t.object===e&&!t.computed&&!t.optional&&"Identifier"===t.property.type&&"length"===t.property.name)||(e=>{let t,r=e;for(;pl(r.parent,r);)r=r.parent;return r3(r)||("ForInStatement"===(t=r).parent.type||"ForOfStatement"===t.parent.type)&&t.parent.left===t})(t))return!1;let r=t.parent;return"CallExpression"!==r.type||r.callee!==t},pp=e=>{let t,r;return"ForOfStatement"===e.parent.type&&e.parent.right===e||(e=>{let{parent:t}=e;return"SpreadElement"===t.type&&t.argument===e&&["ArrayExpression","CallExpression","NewExpression"].includes(t.parent.type)})(e)||td(t=e.parent.parent,{method:"forEach",optionalCall:!1,optionalMember:!1,argumentsLength:1})&&e.parent.object===e&&"ArrowFunctionExpression"===(r=t.arguments[0]).type&&1===r.params.length&&"RestElement"!==r.params[0].type},pc={create:e=>{let{minimumItems:t}=e.options[0],{sourceCode:r}=e;e.on("Identifier",n=>{let o,{parent:a}=n;if(!((e,t)=>{let{parent:r}=e;return"VariableDeclarator"===r.type&&r.id===e&&!!r.init&&"VariableDeclaration"===r.parent.type&&("ExportNamedDeclaration"!==r.parent.parent.type||r.parent.parent.declaration!==r.parent)&&po(r.init,t.getScope(r.init))})(n,r))return;if(t>0){var i,s;let e=(i=a.init,s=r.getScope(a.init),"ArrayExpression"===i.type?pi(i.elements)?void 0:i.elements.length:tt(i,{name:"Array",optional:!1})?((e,t)=>{if(pi(e.arguments))return;if(1!==e.arguments.length)return e.arguments.length;let r=ew(e.arguments[0],t);if(!r)return;let{value:n}=r;return"number"!=typeof n?1:pa(n)?n:void 0})(i,s):td(i,{object:"Array",method:"of",optionalCall:!1,optionalMember:!1})?pi(i.arguments)?void 0:i.arguments.length:td(i,{object:"Array",method:"from",optionalCall:!1,optionalMember:!1})?((e,t)=>{let[r]=e.arguments;if(r&&"SpreadElement"!==r.type){if("ArrayExpression"===r.type)return pi(r.elements)?void 0:r.elements.length;if(void 0!==e3(r)){let e=ew(r,t);return"string"==typeof e?.value?[...e.value].length:void 0}return((e,t)=>{if("ObjectExpression"!==e.type||1!==e.properties.length)return;let[r]=e.properties;if((e=>{if("Property"!==e.type||e.computed)return!1;let{key:t}=e;return"Identifier"===t.type&&"length"===t.name||"Literal"===t.type&&"length"===t.value})(r)){let e=ew(r.value,t);return pa(e?.value)?e.value:void 0}})(r,t)}})(i,s):void 0);if(void 0===e||e<t)return}let l=ei(r.getScope(n),n);if(!l)return;let u=(e=>{let t=[],r=[],n=[];for(let o of e){if(pr(o)){t.push(o);continue}if(pu(o)){r.push(o),n.push(o);continue}if(pp(o)){n.push(o);continue}return}return{includes:t,lengths:r,extra:n}})(rd(l).filter(e=>e!==n));if(!u||0===u.includes.length||u.extra.length>0&&(o=a.init,!("ArrayExpression"===o.type&&!pi(o.elements)&&o.elements.every(Boolean)&&o.elements.every(t=>{let r;return(r=ew(t,e.sourceCode.getScope(t)))&&t0(r.value)&&!Object.is(r.value,-0)}))||0!==t3(o.elements,e).length)||1===u.includes.length&&!((e,t)=>{let r=t.parent.parent.parent,{parent:n}=e.parent;for(;n&&n!==r;){if(pn.has(n.type))return!0;n=n.parent}return!1})(u.includes[0],n))return;let p={node:n,messageId:u5,data:{name:n.name}},c=n.typeAnnotation&&((e,t)=>{if("TSArrayType"===e.type){if(ps(t,e,e.elementType))return;return`Set<${t.getText(e.elementType)}>`}if("TSTypeOperator"===e.type&&"readonly"===e.operator&&"TSArrayType"===e.typeAnnotation.type){if(ps(t,e,e.typeAnnotation.elementType))return;return`ReadonlySet<${t.getText(e.typeAnnotation.elementType)}>`}if("TSTypeReference"!==e.type||"Identifier"!==e.typeName.type)return;let r=e.typeArguments??e.typeParameters;if(r?.params.length===1&&!ps(t,e,r)){if("Array"===e.typeName.name)return`Set${t.getText(r)}`;if("ReadonlyArray"===e.typeName.name)return`ReadonlySet${t.getText(r)}`}})(n.typeAnnotation.typeAnnotation,r),d=function*(e){for(let t of(c&&(yield e.replaceText(n.typeAnnotation.typeAnnotation,c)),yield e.insertTextBefore(n.parent.init,"new Set("),yield e.insertTextAfter(n.parent.init,")"),u.includes))yield e.replaceText(t.parent.property,"has");for(let t of u.lengths)yield e.replaceText(t.parent.property,"size")};return n.typeAnnotation&&!c?p.suggest=[{messageId:u4,fix:d}]:p.fix=d,p})},meta:{type:"suggestion",docs:{description:"Prefer `Set#has()` over `Array#includes()` when checking for existence or non-existence.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,properties:{minimumItems:{type:"integer",minimum:0,description:"The minimum known array size before `Set#has()` is enforced."}}}],defaultOptions:[{minimumItems:0}],messages:{[u5]:"`{{name}}` should be a `Set`, and use `{{name}}.has()` to check existence or non-existence.",[u4]:"Switch `{{name}}` to `Set`."},languages:["js/js"]}},pd=e=>td(e.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&e.parent.arguments[0]===e&&e7(e.parent.callee.object,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1}),pm="prefer-string-raw",pf="unnecessary-string-raw";function pg(e,t=""){return e.replaceAll(RegExp(String.raw`\\(?<escapedCharacter>[\\${t}])`,"g"),"$<escapedCharacter>")}let py="prefer-switch",ph=(e,t)=>e===t||tQ(e,t),px=({left:e,right:t})=>[e,t].filter(e=>!("Literal"===e.type||tx(e))),pb=new Set(["WhileStatement","DoWhileStatement","ForStatement","ForOfStatement","ForInStatement","SwitchStatement"]),pE=e=>{for(;e.parent;e=e.parent)if(pb.has(e.type))return e},pD=(e,t,r)=>{let{sourceCode:n}=r;return n.getRange(e)[0]>=n.getRange(t)[0]&&n.getRange(e)[1]<=n.getRange(t)[1]},pS={create:e=>{let t={...e.options[0]},{sourceCode:r}=e,n=new Set,o=[],a=new Set;e.on("IfStatement",e=>{n.add(e)}),e.on("BreakStatement",e=>{e.label||o.push(e)}),e.on("Program:exit",function*(){for(let i of n){if(a.has(i))continue;let{discriminant:n,ifStatements:s}=function(e){let t,r=[];for(;e&&"IfStatement"===e.type;e=e.alternate){let{test:n}=e,o=function(e){let t=[e],r=[];for(;t.length>0;){if("LogicalExpression"===(e=t.pop()).type&&"||"===e.operator){t.push(e.right,e.left);continue}if("BinaryExpression"!==e.type||"==="!==e.operator)return[];r.push(e)}return r}(n);if(0===o.length)break;t||=px(o[0]);let a=function(e,t){for(let{left:r,right:n}of e)if(0===(t=t.filter(e=>ph(e,r)||ph(e,n))).length)break;return t}(o,t);if(0===a.length)break;t=a,r.push({statement:e,compareExpressions:o})}return{ifStatements:r,discriminant:t&&t[0]}}(i);if(!n||s.length<t.minimumCases)continue;for(let{statement:e}of s)a.add(e);let l={loc:{start:r.getLoc(i).start,end:r.getLoc(i.consequent).start},messageId:py};!eP(n,r)&&s.every(({statement:t})=>!function(e,t,r){for(let n of e){if(!pD(n,t,r))continue;let e=pE(n);if(!e||pD(t,e,r))return!0}return!1}(o,t,e))&&(l.fix=function({discriminant:e,ifStatements:t},r,n){let{sourceCode:o}=r,a=o.getText(e);return function*(i){let s=t[0].statement,l=t8(s,r);yield i.insertTextBefore(s,`switch (${a}) {`);let u=t.at(-1).statement;if(u.alternate){let{alternate:e}=u;yield i.insertTextBefore(e,`
|
|
6
6
|
${l}default: `)}else switch(n.emptyDefaultCase){case"no-default-comment":yield i.insertTextAfter(s,`
|
|
7
7
|
${l}// No default`);break;case"do-nothing-comment":yield i.insertTextAfter(s,`
|
|
8
8
|
${l}default:
|
|
9
9
|
${l}// Do nothing`)}for(let{statement:r,compareExpressions:n}of(yield i.insertTextAfter(s,`
|
|
10
|
-
${l}}`),t)){let{consequent:t,alternate:a}=r;if(a){let[,e]=o.getRange(t),[r]=o.getRange(a);yield i.removeRange([e,r])}let s=[o.getRange(r)[0],o.getRange(t)[0]];for(let{left:r,right:a}of(yield i.removeRange(s),n)){let n=
|
|
10
|
+
${l}}`),t)){let{consequent:t,alternate:a}=r;if(a){let[,e]=o.getRange(t),[r]=o.getRange(a);yield i.removeRange([e,r])}let s=[o.getRange(r)[0],o.getRange(t)[0]];for(let{left:r,right:a}of(yield i.removeRange(s),n)){let n=ph(r,e)?a:r,s=o.getText(n);yield i.insertTextBefore(t,`
|
|
11
11
|
${l}case ${s}: `)}(function e(t){switch(t.type){case"ReturnStatement":case"ThrowStatement":return!1;case"IfStatement":return!t.alternate||e(t.consequent)||e(t.alternate);case"BlockStatement":{let r=function e(t){let{body:r}=t;for(let t=r.length-1;t>=0;t--){let n=r[t];if("FunctionDeclaration"!==n.type&&"EmptyStatement"!==n.type){if("BlockStatement"===n.type){let t=e(n);if(t)return t;continue}return n}}}(t);return!r||e(r)}default:return!0}})(t)&&(yield function*(e,t,r,n){if("BlockStatement"===e.type){let o=r.getLastToken(e);yield t.insertTextBefore(o,`
|
|
12
12
|
${n}break;
|
|
13
13
|
${n}`)}else yield t.insertTextAfter(e,`
|
|
14
14
|
${n}break;`)}(t,i,o,l),yield function*(e,t,r){e&&"BlockStatement"!==e.type&&(yield t.insertTextBefore(e,`{
|
|
15
15
|
${r}`),yield t.insertTextAfter(e,`
|
|
16
|
-
${r}}`))}(t,i,l))}}}({discriminant:n,ifStatements:s},e,t)),yield l}})},meta:{type:"suggestion",docs:{description:"Prefer `switch` over multiple `else-if`.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{minimumCases:{type:"integer",minimum:2,description:"The minimum number of `if`/`else if` cases before suggesting a `switch` statement."},emptyDefaultCase:{enum:["no-default-comment","do-nothing-comment","no-default-case"],description:"How to handle an empty `default` case."}}}],defaultOptions:[{minimumCases:3,emptyDefaultCase:"no-default-comment"}],messages:{[
|
|
16
|
+
${r}}`))}(t,i,l))}}}({discriminant:n,ifStatements:s},e,t)),yield l}})},meta:{type:"suggestion",docs:{description:"Prefer `switch` over multiple `else-if`.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{minimumCases:{type:"integer",minimum:2,description:"The minimum number of `if`/`else if` cases before suggesting a `switch` statement."},emptyDefaultCase:{enum:["no-default-comment","do-nothing-comment","no-default-case"],description:"How to handle an empty `default` case."}}}],defaultOptions:[{minimumCases:3,emptyDefaultCase:"no-default-comment"}],messages:{[py]:"Use `switch` instead of multiple `else-if`."},languages:["js/js"]}},pv="require-number-to-fixed-digits-argument";function pC(e){let t=e.match(/^[ \t]*(?=\S)/gm);if(!t)return e;let r=1/0;for(let e of t)r=Math.min(r,e.length);return 0===r||r===1/0?e:e.replace(RegExp(`^[ \\t]{${r}}`,"gm"),"")}let pA=/^(?:( )+|\t+)/,pT="space";function pw(e,t){let r,n,o=new Map,a=0;for(let i of e.split(/\n/g)){if(!i)continue;let e=i.match(pA);if(null===e)a=0,r="";else{let i=e[0].length,s=e[1]?pT:"tab";if(t&&s===pT&&1===i)continue;s!==r&&(a=0),r=s;let l=1,u=0,p=i-a;if(a=i,0===p)l=0,u=1;else{let e=Math.abs(p);if(t&&s===pT&&1===e)continue;n=(s===pT?"s":"t")+String(e)}let c=o.get(n);o.set(n,void 0===c?[1,0]:[c[0]+l,c[1]+u])}}return o}function pk(e){let t;if("string"!=typeof e)throw TypeError("Expected a string");let r=pw(e,!0);0===r.size&&(r=pw(e,!1));let n=function(e){let t,r=0,n=0;for(let[o,[a,i]]of e)(a>r||a===r&&i>n)&&(r=a,n=i,t=o);return t}(r),o=0,a="";if(void 0!==n){var i,s;({type:t,amount:o}={type:"s"===n[0]?pT:"tab",amount:Number(n.slice(1))}),i=t,s=o,a=(i===pT?" ":" ").repeat(s)}return{amount:o,type:t,indent:a}}let pI="template-indent",pj=(e,t=new Set)=>e.map((e,r)=>t.has(r+1)||""===e.trim()?"":e).join("\n"),pF=[{type:"object",additionalProperties:!1,properties:{indent:{oneOf:[{type:"string",pattern:/^\s+$/.source,description:"Whitespace string to use as indentation."},{type:"integer",minimum:1,description:"Number of spaces to use as indentation."}],description:"The indentation to use inside the template literal."},tags:{type:"array",uniqueItems:!0,items:{type:"string"},description:"Tagged template names to check."},functions:{type:"array",uniqueItems:!0,items:{type:"string"},description:"Function names whose template literal arguments to check."},selectors:{type:"array",uniqueItems:!0,items:{type:"string"},description:"AST selectors for template literals to check."},comments:{type:"array",uniqueItems:!0,items:{type:"string"},description:"Comment patterns to mark template literals for checking."}}}],pB="no-await-in-promise-methods/error",pR="no-await-in-promise-methods/suggestion",p$=["all","allSettled","any","race"],pP="no-negation-in-equality-check/error",pL="no-negation-in-equality-check/suggestion",pN=new Set(["===","!==","==","!="]),pM=e=>"UnaryExpression"===e.type&&e.prefix&&"!"===e.operator;function pO(e,{methods:t,messageId:r}){e.on("CallExpression",n=>{if(!td(n,{methods:t,argumentsLength:2,optionalCall:!1}))return;let o=n.arguments[1],a=function(e,t){if("Identifier"===e.type&&"Infinity"===e.name)return"Infinity";if(tc(e,{object:"Number",property:"POSITIVE_INFINITY",computed:!1,optional:!1}))return"Number.POSITIVE_INFINITY";let r="ChainExpression"===e.type;if(r&&(e=e.expression),tc(e,{property:"length",computed:!1})&&tQ(t,e.object))return`${"Identifier"===t.type?t.name:"…"}${r?"?.":"."}length`}(o,n.callee.object);if(!a)return;let i=n.callee.property.name,s={description:a};return"splice"===i?s.argumentName="deleteCount":"toSpliced"===i&&(s.argumentName="skipCount"),{node:o,messageId:r,data:s,fix:t=>ok(t,o,e)}})}let pq="no-unnecessary-slice-end",pU="catch-error-name",pW={create:e=>{let t=e.options[0],{name:r}=t,n=t.ignore.map(e=>c.isRegExp(e)?e:RegExp(e,"u")),o=e=>e===r||n.some(t=>t.test(e))||e.endsWith(r)||e.endsWith(oo(r));e.on("Identifier",t=>{if(("CatchClause"!==t.parent.type||t.parent.param!==t)&&!(("FunctionExpression"===t.parent.type||"ArrowFunctionExpression"===t.parent.type)&&t.parent.params[0]===t&&(td(t.parent.parent,{method:"then",argumentsLength:2,optionalCall:!1})||td(t.parent.parent,{method:"catch",argumentsLength:1,optionalCall:!1}))&&t.parent.parent.arguments.at(-1)===t.parent))return;let n=t.name;if(o(n)||o(n.replaceAll(/_+$/g,"")))return;let a=ei(e.sourceCode.getScope(t),t);if(!a||"_"===n&&0===a.references.length)return;let i=tG(r,[a.scope,...a.references.map(({from:e})=>e)]),s={node:t,messageId:pU,data:{originalName:n,fixedName:i||r}};return i&&(s.fix=t=>oW(a,i,e,t)),s})},meta:{type:"suggestion",docs:{description:"Enforce a specific parameter name in catch clauses.",recommended:!0},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{name:{type:"string",description:"The expected name for the error variable."},ignore:{type:"array",uniqueItems:!0,description:"Patterns to ignore."}}}],defaultOptions:[{name:"error",ignore:[]}],messages:{[pU]:"The catch parameter `{{originalName}}` should be named `{{fixedName}}`."},languages:["js/js"]}},p_="invalidExport",pV="doNotPassMessageToSuper",pz="doNotAssignMessageWithoutSetter",pK="missingOptionsParameter",pG="invalidOptionsParameter",pJ="passMessageToSuper",pX="passOptionsToSuper",pY=/^(?:[A-Z][\da-z]*)*Error$/,pH=e=>`
|
|
17
17
|
name = '${e}';
|
|
18
|
-
`,pD=e=>{var t;let r=(t=e.superClass,t?.type==="Identifier"?t.name:t?.type!=="MemberExpression"||t.computed||"Identifier"!==t.property.type?void 0:t.property.name);return!!r&&pb.test(r)},pS=e=>"ExpressionStatement"===e.type&&"CallExpression"===e.expression.type&&tf(e.expression.callee,"super"),pv=(e,t)=>"ExpressionStatement"===e.type&&"AssignmentExpression"===e.expression.type&&"="===e.expression.operator&&tf(e.expression.left,`this.${t}`),pC=(e,t)=>({node:e,message:`The \`name\` property should be set to \`${t}\`.`}),pA=(e,t)=>e?.value&&e.value.value===t,pT=(e,t)=>"MethodDefinition"===e.type&&e.kind===t&&!e.static&&!e.computed&&"Identifier"===e.key.type&&"message"===e.key.name,pw=e=>e?.type==="Identifier"?e:e?.type==="AssignmentPattern"&&"Identifier"===e.left.type?e.left:void 0,pI=e=>pw(e)?.name==="options",pF=(e,t)=>{if("ThisExpression"===e.type||"Super"===e.type)return!0;for(let r of t[e.type]??[]){let n=e[r];if(n){if(Array.isArray(n)){if(n.some(e=>e&&pF(e,t)))return!0;continue}if(pF(n,t))return!0}}return!1},pj=e=>{let t=pw(e);return t.typeAnnotation?t.optional?"options?: ErrorOptions":"options: ErrorOptions":"options"},pk=(e,t,r)=>n=>{let o=t.arguments;if(0===o.length){let o=e.getTokenAfter(t.callee,e=>"("===e.value);return n.insertTextAfter(o,`${r}, options`)}if(1===o.length){let e;return"undefined"!==r&&(!(e=o[0])||th(e))?n.replaceText(o[0],`${r}, options`):n.insertTextAfter(o[0],", options")}},pB=(e,t)=>e?.type==="Identifier"&&e.name===t.name;function*pP(e,t){if(!pD(t)||null===t.id)return;let{name:r}=t.id,n=nJ(r).replace(/(?:error)?$/i,"Error");r!==n&&(yield{node:t.id,message:`Invalid class name, use \`${n}\`.`});let{body:o}=t.body,{sourceCode:a}=e,i=o.find(e=>"constructor"===e.kind),s=o.find(e=>"PropertyDefinition"===e.type&&!e.static&&!e.computed&&"Identifier"===e.key.type&&"name"===e.key.name);if(!i){if(pA(s,r))return;let e=a.getRange(t.body);yield{...pC(s?.value??t,r),fix:t=>s?.value?t.replaceText(s.value,`'${r}'`):s?t.replaceText(s,pE(r).trim()):t.insertTextAfterRange([e[0],e[0]+1],pE(r))};return}let l=o.some(e=>pT(e,"get")),u=o.some(e=>pT(e,"set"));yield*function*(e,t,r){let{sourceCode:n}=e,o=t.value.body;if(!o)return;let a=o.body,{hasMessageGetter:i,hasMessageSetter:s,checkOptions:l}=r,u=a.find(e=>pS(e)),p=a.findIndex(e=>pS(e)),c=a.findIndex(e=>pv(e,"message")),d=i||s,m=!1;if(u){let r;if(d&&!(!(r=u.expression.arguments[0])||th(r)))m=!0,yield{node:u,messageId:pm};else if(i&&!s&&-1!==c)m=!0,yield{node:a[c],messageId:pf};else if(!s&&-1!==c){let r=a[c];m=!0,yield{node:u,message:"Pass the error message to `super()` instead of setting `this.message`.",*fix(i){let s=r.expression.right,[l,d]=t.value.params,m=pw(l),f=1===t.value.params.length&&m&&!pI(l),g=f||pI(d);if(0===u.expression.arguments.length){if(c!==p+1||pF(s,n.visitorKeys))return;let[t]=n.getRange(u);yield i.insertTextAfterRange([t,t+6],g?`${eQ(s,e)}, options`:eQ(s,e))}else{let e;if(e=u.expression.arguments[0],n.getText(e)!==n.getText(s))return;g&&1===u.expression.arguments.length&&(yield i.insertTextAfter(u.expression.arguments[0],", options"))}f&&(yield i.insertTextAfter(l,`, ${pj(l)}`));let y=0===c?n.getRange(o)[0]:n.getRange(a[c-1])[1],[,h]=n.getRange(r);yield i.removeRange([y,h])}}}}else m=!0,yield{node:o,message:"Missing call to `super()` in constructor."};let f=function(e,t,r){let{name:n,nameProperty:o}=r,a=t.find(e=>pv(e,"name"));return a?"Literal"!==a.expression.right.type||a.expression.right.value!==n?pC(a.expression.right??e,n):void 0:pA(o,n)?void 0:pC(o?.value??e,n)}(o,a,r);if(f&&(yield f),!f&&l&&!m){let r=((e,t,r,n)=>{let o=t.value.params,a=o[0],i=pw(a);if(0===o.length||!i)return;let s=r.expression;if(pI(a)){if(!pI(s.arguments[1])){let t={node:s,messageId:px};return pB(s.arguments[0],i)||(t.fix=pk(e.sourceCode,s,"undefined")),t}return}let l=o[1],u=!n&&"message"===i.name,p=u?i.name:"undefined";if(!l)return{node:a,messageId:pg,fix:function*(r){let{sourceCode:n}=e,o=pk(n,s,p)(r);if(!o)return;let a=t.value.params[0];yield r.insertTextAfter(a,`, ${pj(a)}`),yield o}};if(!pI(l))return{node:l,messageId:py};if(u&&!pB(s.arguments[0],i)){let t;return{node:s,messageId:ph,fix:(t=e.sourceCode,e=>{let r,n=s.arguments;if(0===n.length){let r=t.getTokenAfter(s.callee,e=>"("===e.value);return e.insertTextAfter(r,`${p}, options`)}if(!(r=n[0])||th(r))return e.replaceText(n[0],1===n.length?`${p}, options`:p)})}}if(!pI(s.arguments[1]))return{node:s,messageId:px,fix:pk(e.sourceCode,s,p)}})(e,t,u,d);r&&(yield r)}}(e,i,{name:r,nameProperty:s,hasMessageGetter:l,hasMessageSetter:u,checkOptions:r===n})}let p$="no-lonely-if",pR=e=>"IfStatement"===e.type&&!e.alternate;function pL(e,t){let r={ifToken:t.getFirstToken(e),openingParenthesisToken:t.getFirstToken(e,1)},{consequent:n}=e;return r.closingParenthesisToken=t.getTokenBefore(n),"BlockStatement"===n.type&&(r.openingBraceToken=t.getFirstToken(n),r.closingBraceToken=t.getLastToken(n)),r}let pN=(e,t,r)=>r.text.slice(r.getRange(e)[1],r.getRange(t)[0]),pM=e=>e.trim()?e:"",pO=(e,t)=>/\s$/u.test(e)&&/^\s/u.test(t)?e+t.trimStart():e+t,pq=(e,t)=>pN(e.ifToken,e.openingParenthesisToken,t),pU=(e,t,r)=>{let n,o=pN(e.openingParenthesisToken,e.closingParenthesisToken,r);return eZ(e.test,t)?o:"LogicalExpression"===(n=e.test).type&&("||"===n.operator||"??"===n.operator)||"ConditionalExpression"===n.type||"AssignmentExpression"===n.type||"YieldExpression"===n.type||"SequenceExpression"===n.type?`(${o})`:o},p_="no-magic-array-flat-depth",pW="no-negated-condition",pV="identifier",pz="non-identifier",pK="prefer-negative-index",pG=new Map([["slice",{argumentsIndexes:[0,1],supportObjects:new Set(["Array","String","ArrayBuffer",...ra])}],["subarray",{argumentsIndexes:[0,1],supportObjects:new Set(ra)}],["splice",{argumentsIndexes:[0],supportObjects:new Set(["Array"])}],["toSpliced",{argumentsIndexes:[0],supportObjects:new Set(["Array"])}],["at",{argumentsIndexes:[0],supportObjects:new Set(["Array","String",...ra])}]]),pJ=e=>{let{type:t,property:r}=e;if("MemberExpression"===t&&"Identifier"===r.type)return r.name};var pX=["node:assert","assert","node:assert/strict","assert/strict","node:async_hooks","async_hooks","node:buffer","buffer","node:child_process","child_process","node:cluster","cluster","node:console","console","node:constants","constants","node:crypto","crypto","node:dgram","dgram","node:diagnostics_channel","diagnostics_channel","node:dns","dns","node:dns/promises","dns/promises","node:domain","domain","node:events","events","node:ffi","node:fs","fs","node:fs/promises","fs/promises","node:http","http","node:http2","http2","node:https","https","node:inspector","inspector","node:inspector/promises","inspector/promises","node:module","module","node:net","net","node:os","os","node:path","path","node:path/posix","path/posix","node:path/win32","path/win32","node:perf_hooks","perf_hooks","node:process","process","node:querystring","querystring","node:quic","node:readline","readline","node:readline/promises","readline/promises","node:repl","repl","node:sea","node:sqlite","node:stream","stream","node:stream/consumers","stream/consumers","node:stream/iter","stream/iter","node:stream/promises","stream/promises","node:stream/web","stream/web","node:string_decoder","string_decoder","node:test","node:test/reporters","node:timers","timers","node:timers/promises","timers/promises","node:tls","tls","node:trace_events","trace_events","node:tty","tty","node:url","url","node:util","util","node:util/types","util/types","node:v8","v8","node:vm","vm","node:wasi","wasi","node:worker_threads","worker_threads","node:zlib","zlib","node:zlib/iter","zlib/iter"];function pY(t){if("string"!=typeof t)throw TypeError("Expected a string");return(e??=new Set(pX)).has(t)}let pH="prefer-node-protocol",pQ="node:",pZ="consistent-date-clone/error",p0="no-accessor-recursion/error",p1=e=>"Identifier"===e.type||"PrivateIdentifier"===e.type,p2=(e,t)=>["type","name"].every(r=>e[r]===t[r]),p3=(e,t)=>"MemberExpression"===e.parent.type&&e.parent.object===e&&!e.parent.computed&&p1(e.parent.property)&&p2(e.parent.property,t.key),p8="error/calculate-dirname",p6="error/calculate-filename";function p9(e,{modules:t,functionName:r,sourceCode:n}){if(!e7(e,{optional:!1,argumentsLength:1}))return!1;let o=new Set;return function e(t,i){if("MemberExpression"===t.type)return!!("property"===i&&tp(t,{property:r,computed:!1,optional:!1}))&&e(t.object,"module");if("CallExpression"===t.type)return"module"===i&&tc(t,{object:"process",method:"getBuiltinModule",argumentsLength:1,optionalMember:!1,optionalCall:!1})&&a(t.arguments[0]);if("Identifier"!==t.type||o.has(t))return!1;o.add(t);let s=ei(n.getScope(t),t);return!!s&&1===s.defs.length&&function(t,n){if("ImportBinding"===t.type){if(!a(t.parent.source))return!1;let e=t.node;return"module"===n?e?.type==="ImportDefaultSpecifier"||e?.type==="ImportNamespaceSpecifier":e?.type==="ImportSpecifier"&&e.imported.name===r}return"Variable"===t.type&&function t(n,o){let{parent:a}=n;return"VariableDeclarator"===a.type?!!a.init&&a.id===n&&"VariableDeclaration"===a.parent.type&&"const"===a.parent.kind&&e(a.init,o):"Property"===a.type&&!!("property"===o&&a.value===n&&!a.computed&&"Identifier"===a.key.type&&a.key.name===r)&&t(a.parent,"module")}(t.name,n)}(s.defs[0],i)}(e.callee,"property");function a(e){return e?.type==="Literal"&&t.has(e.value)}}function p5(e,t){return p9(e,{modules:new Set(["url","node:url"]),functionName:"fileURLToPath",sourceCode:t})}function p4(e,t){return p9(e,{modules:new Set(["path","node:path"]),functionName:"dirname",sourceCode:t})}let p7="no-unnecessary-array-flat-depth",ce="no-unnecessary-array-splice-count",ct="no-useless-error-capture-stack-trace/error",cr="prefer-class-fields/error",cn="prefer-class-fields/suggestion",co="prefer-bigint-literals/error",ca="prefer-bigint-literals/suggestion",ci="prefer-classlist-toggle/error",cs="prefer-classlist-toggle/suggestion",cl=e=>tp(e,{property:"classList",computed:!1}),cu=(e,t,r)=>{let n={node:r??e,messageId:ci};return"IfStatement"===e.type||ti(e)||ti(e.parent)?n.fix=t:n.suggest=[{messageId:cs,fix:t}],n},cp=(e,t,r)=>{let{sourceCode:n}=t,o=eQ(e,t);return r?(!eZ(e,n)&&nO(e)&&(o=`(${o})`),o=`!${o}`):(eZ(e,n)||"SequenceExpression"!==e.type||(o=`(${o})`),o)},cc=(e,t)=>tc(e,{methods:t,argumentsLength:1,optionalCall:!1,optionalMember:!1})&&cl(e.callee.object),cd=(e,t)=>tH(e.callee.object,t.callee.object)&&tH(e.arguments[0],t.arguments[0]),cm=(e,t,r)=>t?("ChainExpression"===e.type&&(e=e.expression),cc(e,["contains"])&&cd(e,r))?e:void 0:"UnaryExpression"===e.type&&"!"===e.operator&&e.prefix?cm(e.argument,!t,r):void 0,cf="require-module-attributes",cg="error",cy="suggestion/array",ch="suggestion/object",cx="suggestion/object-assign",cb="suggestion/set",cE="suggestion/map",cD=(e,t,r)=>{let{sourceCode:n}=r,o=rt(e);return t.some(e=>{let t=n.getRange(e);return o.some(e=>{let[r,o]=n.getRange(e);return r>=t[0]&&o<=t[1]})})};function cS(e,t){if(!te(e,{names:t,maximumArguments:1}))return!1;let[r]=e.arguments;return!r||"ArrayExpression"===r.type}function*cv(e,t,r){let n=!ep(t.sourceCode.getTokenBefore(e));yield ob(e,t,r,n)}function cC(e,t,r,n){let{sourceCode:o}=e,[a,i]=o.getLastTokens(r,2),s=("ArrayExpression"===r.type?r.elements:r.properties).length>0&&!eu(a);return t.insertTextBefore(i,`${s?",":""} ${n}`)}function*cA({context:e,fixer:t,newExpression:r,elementsText:n,nextExpressionStatement:o}){if(tK(r,e)){let[o]=r.arguments;if(o)yield cC(e,t,o,n);else{let{openingParenthesisToken:o}=tK(r,e)?tG(r,e):{};yield t.insertTextAfter(o,`[${n}]`)}}else yield t.insertTextAfter(r,`([${n}])`);yield*cv(o,e,t)}let cT=[{testValue:e=>e?.type==="ArrayExpression",getProblematicNode({context:e,variable:t,nextExpressionStatement:r}){let n=r.expression;if(tc(n,{object:t.name,methods:["push","unshift"],optionalMember:!1,optionalCall:!1})&&n.arguments.length>0&&!cD(t,n.arguments,e))return n},getProblem(e,t){let{context:r,assignType:n,getFix:o}=t,{sourceCode:a}=r,i=e.callee,s=i.property,l={node:i,messageId:cg,data:{objectType:"array"}},u="unshift"===s.name,p=o(t,{callExpression:e,isPrepend:u});return e.arguments.some(e=>eR(e,a))?l.suggest=[{messageId:cy,fix:p,data:{operation:u?"Prepend":"Append",assignType:n}}]:l.fix=p,l},getFix:({context:e,valueNode:t,nextExpressionStatement:r},{callExpression:n,isPrepend:o})=>function*(a){let i=tJ(e,n,!1);yield o?a.insertTextAfter(e.sourceCode.getFirstToken(t),`${i}, `):cC(e,a,t,i),yield cv(r,e,a)}},{testValue:e=>e?.type==="ObjectExpression",getProblematicNode({context:e,variable:t,nextExpressionStatement:r}){let n=r.expression;if(!("AssignmentExpression"===n.type&&"="===n.operator&&tp(n.left,{object:t.name,optional:!1})))return;let o=n.right,a=n.left,{property:i}=a;if(!cD(t,a.computed?[i,o]:[o],e))return n},getProblem(e,t){let{context:r,assignType:n,getFix:o}=t,{sourceCode:a}=r,{left:i,right:s}=e,{property:l}=i,u=a.getTokenAfter(i,t=>"Punctuator"===t.type&&t.value===e.operator),p={node:e,loc:{start:a.getLoc(e).start,end:a.getLoc(u).end},messageId:cg,data:{objectType:"object"}},c=o(t,{assignmentExpression:e,memberExpression:i,property:l,value:s});return i.computed&&eR(l,a)||eR(s,a)?p.suggest=[{messageId:ch,data:{assignType:n},fix:c}]:p.fix=c,p},getFix:({context:e,valueNode:t,nextExpressionStatement:r},{memberExpression:n,property:o,value:a})=>function*(i){let s=eQ(o,e);n.computed&&(s=`[${s}]`);let l=eQ(a,e),u=`${s}: ${l},`,[p,c]=e.sourceCode.getLastTokens(t,2),d=t.properties.length>0&&!eu(p);yield i.insertTextBefore(c,`${d?",":""} ${u}`),yield cv(r,e,i)}},{testValue:e=>e?.type==="ObjectExpression",getProblematicNode({context:e,variable:t,nextExpressionStatement:r}){let n=r.expression;if(!tc(n,{object:"Object",method:"assign",minimumArguments:2,optionalMember:!1,optionalCall:!1}))return;let[o,a]=n.arguments;if(!("Identifier"!==o.type||o.name!==t.name||"SpreadElement"===a.type||cD(t,[a],e)))return n},getProblem(e,t){let{context:r,assignType:n,getFix:o}=t,{sourceCode:a}=r,[,i]=e.arguments,s={node:e.callee,messageId:cg,data:{objectType:"object"}},l=o(t,{callExpression:e,firstValue:i});return eR(i,a)?s.suggest=[{messageId:cx,data:{description:"ObjectExpression"===i.type?"Move properties to":"Spread properties in",assignType:n},fix:l}]:s.fix=l,s},getFix:({context:e,valueNode:t,nextExpressionStatement:r},{callExpression:n,firstValue:o})=>function*(a){let i;("ObjectExpression"===o.type?o.properties.length>0&&(i=function(e,t){let{sourceCode:r}=t,n=r.getFirstToken(e),[o,a]=r.getLastTokens(e,2),[,i]=r.getRange(n),[s]=r.getRange(eu(o)?o:a);return r.text.slice(i,s)}(o,e)):i=`...${eQ(o,e)}`,i&&(yield cC(e,a,t,i)),2!==n.arguments.length)?yield ol(a,o,e):yield cv(r,e,a)}},{testValue:e=>cS(e,["Set","WeakSet"]),getProblematicNode({context:e,variable:t,nextExpressionStatement:r}){let n=r.expression;if(("ChainExpression"===n.type&&(n=n.expression),tc(n,{object:t.name,method:"add",argumentsLength:1,optionalMember:!1,optionalCall:!1}))&&!cD(t,n.arguments,e))return n},getProblem(e,t){let{context:r,assignType:n,valueNode:o,getFix:a}=t,{sourceCode:i}=r,s={node:e.callee,messageId:cg,data:{objectType:`\`${o.callee.name}\``}},l=a(t,{callExpression:e,newExpression:o});return e.arguments.some(e=>eR(e,i))?s.suggest=[{messageId:cb,data:{assignType:n},fix:l}]:s.fix=l,s},getFix:({context:e,nextExpressionStatement:t},{callExpression:r,newExpression:n})=>o=>{let a=tJ(e,r,!1);return cA({context:e,fixer:o,newExpression:n,elementsText:a,nextExpressionStatement:t})}},{testValue:e=>cS(e,["Map","WeakMap"]),getProblematicNode({context:e,variable:t,nextExpressionStatement:r}){let n=r.expression;if(tc(n,{object:t.name,method:"set",argumentsLength:2,optionalCall:!1})&&!cD(t,n.arguments,e))return n},getProblem(e,t){let{context:r,assignType:n,valueNode:o,getFix:a}=t,{sourceCode:i}=r,s={node:e.callee,messageId:cg,data:{objectType:`\`${o.callee.name}\``}},l=a(t,{callExpression:e,newExpression:o});return e.arguments.some(e=>eR(e,i))?s.suggest=[{messageId:cE,data:{assignType:n},fix:l}]:s.fix=l,s},getFix:({context:e,nextExpressionStatement:t},{callExpression:r,newExpression:n})=>o=>{let a=tJ(e,r,!1);return cA({context:e,fixer:o,newExpression:n,elementsText:`[${a}]`,nextExpressionStatement:t})}}],cw="no-useless-collection-argument/error",cI="no-useless-collection-argument/suggestion",cF="prefer-response-static-json",cj=/([\p{Ll}\d])(\p{Lu})/gu,ck=/(\p{Lu})([\p{Lu}][\p{Ll}])/gu,cB=/(\d)\p{Ll}|(\p{L})\d/u,cP=/[^\p{L}\d]+/giu,c$="$1\0$2";function cR(e){let t=e.trim();t=(t=t.replace(cj,c$).replace(ck,c$)).replace(cP,"\0");let r=0,n=t.length;for(;"\0"===t.charAt(r);)r++;if(r===n)return[];for(;"\0"===t.charAt(n-1);)n--;return t.slice(r,n).split(/\0/g)}function cL(e){let t=cR(e);for(let e=0;e<t.length;e++){let r=t[e],n=cB.exec(r);if(n){let o=n.index+(n[1]??n[2]).length;t.splice(e,1,r.slice(0,o),r.slice(o))}}return t}function cN(e,t){let[r,n,o]=cW(e,t);return r+n.map(cq(t?.locale)).join(t?.delimiter??" ")+o}function cM(e,t){var r,n;let[o,a,i]=cW(e,t),s=cq(t?.locale),l=cU(t?.locale),u=t?.mergeAmbiguousCharacters?(r=s,n=l,e=>`${n(e[0])}${r(e.slice(1))}`):c_(s,l);return o+a.map((e,t)=>0===t?s(e):u(e,t)).join(t?.delimiter??"")+i}function cO(e,t){let[r,n,o]=cW(e,t),a=c_(cq(t?.locale),cU(t?.locale));return r+n.map(a).join("")+o}function cq(e){return!1===e?e=>e.toLowerCase():t=>t.toLocaleLowerCase(e)}function cU(e){return!1===e?e=>e.toUpperCase():t=>t.toLocaleUpperCase(e)}function c_(e,t){return(r,n)=>{let o=r[0];return(n>0&&o>="0"&&o<="9"?"_"+o:t(o))+e(r.slice(1))}}function cW(e,t={}){let r=t.split??(t.separateNumbers?cL:cR),n=t.prefixCharacters??"",o=t.suffixCharacters??"",a=0,i=e.length;for(;a<e.length;){let t=e.charAt(a);if(!n.includes(t))break;a++}for(;i>a;){let t=i-1,r=e.charAt(t);if(!o.includes(r))break;i=t}return[e.slice(0,a),r(e.slice(a,i)),e.slice(i)]}let cV="filename-case",cz="directory-case",cK="filename-extension",cG=e=>!/^[\w-]$/.test(e),cJ=new Set(["index.js","index.mjs","index.cjs","index.ts","index.tsx","index.vue"]),cX=new Intl.ListFormat("en-US",{type:"disjunction"}),cY=/^[\da-z]+$/i,cH=/^[A-Z]{3,}(?=\d*[A-Z](?:[a-z]|\d+[a-z]))/,cQ=e=>e>="0"&&e<="9",cZ=e=>e>="a"&&e<="z",c0=e=>e>="A"&&e<="Z",c1={camelCase:{fn:cM,name:"camel case"},camelCaseWithAcronyms:{fn:function(e){return!function(e){if(!cZ(e[0]))return!1;for(let t=1;t<e.length;t++){let r=e[t];if(cZ(r)||cQ(r))continue;if(!c0(r))return!1;let n=t;for(;c0(e[t+1]);)t++;if(t!==n){if(cZ(e[t+1])){t--;continue}for(;cQ(e[t+1]);)t++;if(t===e.length-1)return!0;if(!c0(e[t+1]))return!1}}return!0}(e)?cM(e):e},name:"camel case with acronyms"},kebabCase:{fn:function(e,t){return cN(e,{delimiter:"-",...t})},name:"kebab case"},snakeCase:{fn:function(e,t){return cN(e,{delimiter:"_",...t})},name:"snake case"},pascalCase:{fn:function(e){if(cY.test(e)){let t=cH.exec(e)?.[0],r=t&&e.slice(t.length);if(r&&cO(r)===r)return e}return cO(e)},name:"pascal case"}};function c2(e,t){return e.filter(({ignored:e})=>!e).every(({word:e})=>t.some(t=>t(e)===e))}function c3(e,t,{leading:r,trailing:n}){let{samples:o}=function(e,t=1/0){let r=e.reduce((e,{length:t})=>e*t,1),n=Array.from({length:Math.min(r,t)},(t,r)=>{let n=r,o=[];for(let t=e.length-1;t>=0;t--){let r=e[t],{length:a}=r,i=n%a;n=(n-i)/a,o.unshift(r[i])}return o});return{total:r,samples:n}}(e.map(({word:e,ignored:r})=>r?[e]:t.map(t=>t(e))));return[...new Set(o.map(e=>`${r}${e.join("")}${n}`))]}let c8=/^(?<leading>_+)(?<tailing>.*)$/;function c6(e){let t,{leading:r="",tailing:n=e}=(c8.exec(e)||{groups:{}}).groups,o=[];for(let e of n){let r=cG(e);t?.ignored===r?t.word+=e:(t={word:e,ignored:r},o.push(t))}return{leading:r,words:o}}function c9(e){let t;return t=e.map(e=>c1[e].name),cX.format(t)}let c5=[{description:"The rule options.",anyOf:[{properties:{case:{enum:["camelCase","camelCaseWithAcronyms","snakeCase","kebabCase","pascalCase"],description:"The filename and directory name case style."},ignore:{type:"array",uniqueItems:!0,description:"Path segment patterns to ignore."},multipleFileExtensions:{type:"boolean",description:"Whether to treat additional, dot-separated parts of a filename as file extensions."},checkDirectories:{type:"boolean",description:"Whether to check directory names."}},additionalProperties:!1},{properties:{cases:{properties:{camelCase:{type:"boolean",description:"Whether to allow camelCase filenames and directory names."},camelCaseWithAcronyms:{type:"boolean",description:"Whether to allow camelCase filenames and directory names with acronym segments."},snakeCase:{type:"boolean",description:"Whether to allow snake_case filenames and directory names."},kebabCase:{type:"boolean",description:"Whether to allow kebab-case filenames and directory names."},pascalCase:{type:"boolean",description:"Whether to allow PascalCase filenames and directory names."}},additionalProperties:!1,description:"The allowed filename and directory name case styles."},ignore:{type:"array",uniqueItems:!0,description:"Path segment patterns to ignore."},multipleFileExtensions:{type:"boolean",description:"Whether to treat additional, dot-separated parts of a filename as file extensions."},checkDirectories:{type:"boolean",description:"Whether to check directory names."}},additionalProperties:!1}]}],c4="consistent-template-literal-escape",c7="iterable-accepting",de="for-of",dt="yield-star",dr="spread",dn="iterator-method",da="iterable-accepting/suggestion",di="iterator-method/suggestion",ds=["every","find","forEach","some"],dl="reduce",du=e=>tc(e,{method:"toArray",argumentsLength:0,optionalCall:!1,optionalMember:!1}),dp="prefer-simple-condition-first",dc="prefer-simple-condition-first/suggestion";function dd(e){return"Identifier"===e.type||"Literal"===e.type||"UnaryExpression"===e.type&&("-"===e.operator||"+"===e.operator)&&"Literal"===e.argument.type&&"number"==typeof e.argument.value}function dm(e){return"Identifier"===e.type||("UnaryExpression"===e.type&&"!"===e.operator?dm(e.argument):"BinaryExpression"===e.type&&("==="===e.operator||"!=="===e.operator)?dd(e.left)&&dd(e.right)&&("Identifier"===e.left.type||"Identifier"===e.right.type):"LogicalExpression"===e.type&&dm(e.left)&&dm(e.right))}let df=new Set(["AssignmentExpression","UpdateExpression","TaggedTemplateExpression","AwaitExpression","YieldExpression","ImportExpression"]);function dg(e,t,{operator:r,property:n}){let o=eZ(e,t),a=o?eQ(e,t):t.sourceCode.getText(e);return!o&&nq(e,{operator:r,property:n})&&(a=`(${a})`),a}let dy="switch-case-break-position",dh=new Set(["BreakStatement","ReturnStatement","ContinueStatement","ThrowStatement"]),dx="first-child",db="first-element-child",dE="query-selector",dD="closest",dS="merge-query-selector",dv="suggestion-first-child",dC="suggestion-first-element-child",dA="suggestion-merge-query-selector",dT={method:"querySelector",argumentsLength:1,optionalCall:!1,optionalMember:!1},dw=(e,t)=>tp(e,{property:t,optional:!1,computed:!1}),dI=e=>"MemberExpression"===e.type&&!e.optional&&e.computed&&e8(e.property)&&Number.isSafeInteger(e.property.value)&&e.property.value>=0,dF=(e,t)=>t.getCommentsInside(e).length>0,dj=(e,t,r,n)=>{if(dF(e,n))return;let[,o]=n.getRange(e),[a]=n.getRange(e.object.property);return[{messageId:r,fix:e=>e.replaceTextRange([a,o],t)}]},dk=e=>tp(e,{property:"parentElement",optional:!1,computed:!1}),dB=e=>void 0!==e3(e),dP=e=>tc(e,dT),d$=new Set(["FunctionDeclaration","ClassDeclaration","TSTypeAliasDeclaration","TSInterfaceDeclaration","TSEnumDeclaration"]),dR=new Set(["AccessorProperty","MethodDefinition","PropertyDefinition","TSAbstractAccessorProperty","TSAbstractMethodDefinition","TSAbstractPropertyDefinition","TSMethodSignature","TSPropertySignature"]),dL=e=>{let t="";return"Variable"===e.type?t=e.node.init.arguments[0].value:"ImportBinding"===e.type&&(t=e.parent.source.value),!t.includes("node_modules")&&(t.startsWith(".")||t.startsWith("/"))},dN="consistent-compound-words/error",dM="consistent-compound-words/rename",{isIdentifierName:dO}=t$,dq={backGround:"background",callBack:"callback",checkBox:"checkbox",clipBoard:"clipboard",codeBase:"codebase",dataBase:"database",downLoad:"download",feedBack:"feedback",foreGround:"foreground",frameWork:"framework",headLine:"headline",keyBoard:"keyboard",keyFrame:"keyframe",lifeCycle:"lifecycle",metaData:"metadata",midPoint:"midpoint",nameSpace:"namespace",overRide:"override",passWord:"password",payLoad:"payload",placeHolder:"placeholder",preView:"preview",screenShot:"screenshot",sideBar:"sidebar",subClass:"subclass",subDirectory:"subdirectory",subDomain:"subdomain",subMenu:"submenu",subProcess:"subprocess",subString:"substring",subTree:"subtree",subType:"subtype",subTitle:"subtitle",timeOut:"timeout",timeStamp:"timestamp",toolBar:"toolbar",toolKit:"toolkit",toolTip:"tooltip",touchScreen:"touchscreen",unSubscribe:"unsubscribe",underScore:"underscore",upLoad:"upload",userName:"username",viewPort:"viewport",webCam:"webcam",webHook:"webhook",webSite:"website",weekEnd:"weekend",whiteSpace:"whitespace",wildCard:"wildcard",workFlow:"workflow",workSpace:"workspace"},dU=new Set(String.raw`\^$.*+?()[]{}|`),d_=e=>{let t="";for(let r of e)t+=dU.has(r)?`\\${r}`:r;return t},dW=String.raw`(?=$|[\d_$]|\p{Uppercase_Letter})`,dV=(e,{replacementRegExp:t,replacements:r,allowList:n})=>{if(!t||e===e.toUpperCase()||n.has(e))return;let o=e.replaceAll(t,e=>((e,t)=>{let r=t.get(e)??t.get(nX(e));if(r){let t;return(t=e[0])===t.toUpperCase()?nJ(r):nX(r)}})(e,r));if(o!==e)return o},dz=(e,t)=>({node:e,messageId:dN,data:{name:e.name,replacement:t}}),dK={type:"array",additionalItems:!1,items:[{type:"object",additionalProperties:!1,properties:{checkProperties:{type:"boolean",description:"Whether to check property names."},checkVariables:{type:"boolean",description:"Whether to check variable names."},checkDefaultAndNamespaceImports:{anyOf:[{type:"boolean"},{enum:["internal"]}],description:"Whether to check default and namespace import names."},checkShorthandImports:{anyOf:[{type:"boolean"},{enum:["internal"]}],description:"Whether to check shorthand import names."},checkShorthandProperties:{type:"boolean",description:"Whether to check shorthand property names."},extendDefaultReplacements:{type:"boolean",description:"Whether to extend the default replacements."},replacements:{$ref:"#/definitions/replacements",description:"Custom compound word replacements."},allowList:{$ref:"#/definitions/trueObject",description:"Custom allow list of names."}}}],definitions:{replacements:{type:"object",propertyNames:{minLength:1},additionalProperties:{anyOf:[{enum:[!1]},{type:"string",minLength:1}]}},trueObject:{type:"object",propertyNames:{minLength:1},additionalProperties:{enum:[!0]}}}},dG="no-blob-to-file",dJ="suggestion";function dX(e,t){let r=ei(t.sourceCode.getScope(e),e);return!r||0===r.defs.length}function dY(e,t){if(e?.type!=="Identifier")return;let r=ei(t.sourceCode.getScope(e),e),n=r?.defs[0],o=n?.node;if(n?.type==="Variable"&&"const"===n.kind&&o?.type==="VariableDeclarator")return o}let dH="no-canvas-to-image",dQ=e=>{for(;e?.type==="AwaitExpression";)e=e.argument;return e};function dZ(e,t){if(e=dQ(e),e?.type!=="Identifier")return e;let r=ei(t.getScope(e),e);if(!r||1!==r.identifiers.length||2!==r.references.length)return;let[n]=r.identifiers;if("VariableDeclarator"===n.parent.type&&n.parent.id===n&&"VariableDeclaration"===n.parent.parent.type&&"const"===n.parent.parent.kind&&!(t.getRange(n)[0]>t.getRange(e)[0]))return dQ(n.parent.init)}let d0=e=>e.toLowerCase().includes("canvas"),d1="replace-one-element",d2="insert-at-negative-one",d3="suggestion-replace-one-element",d8="suggestion-insert-at-negative-one";function d6(e){if(e8(e=nA(e)))return e.value;if("UnaryExpression"===e.type&&("+"===e.operator||"-"===e.operator)){let t=d6(e.argument);if("number"==typeof t)return"-"===e.operator?-t:t}}function d9(e){return"Identifier"===e.type||"ThisExpression"===e.type||"MemberExpression"===e.type&&!e.computed&&!e.optional&&d9(e.object)}let d5=(e,t)=>t.getCommentsInside(e).length>0,d4="no-duplicate-set-values",d7="first-match",me="id-selector",mt="length-check",mr="query-selector-all-nullish",mn="query-selector-undefined",mo=e=>tc(e,{method:"querySelector",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&!ns(e.callee.object),ma=e=>tc(e,{method:"querySelectorAll",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&!ns(e.callee.object),mi=e=>{let t,r;return t=e,r=ma,"MemberExpression"===t.type&&t.computed&&!t.optional&&r(t.object)&&e0(t.property,0)},ms=e=>{let t,r;return t=e,r=ma,tc(t,{methods:["at","item"],argumentsLength:1,optionalCall:!1,optionalMember:!1})&&r(t.callee.object)&&e0(t.arguments[0],0)},ml=e=>rq(e)||("ForInStatement"===e.parent.type||"ForOfStatement"===e.parent.type)&&e.parent.left===e,mu=(e,t,r,n)=>{let[,o]=eH(t,n),[,a]=r.getRange(e);return r.getAllComments().some(e=>{let[t,n]=r.getRange(e);return t>=o&&n<=a})},mp=(e,t,r)=>{if("Identifier"!==e.type)return;let n=ei(t.getScope(e),e);if(!n||1!==n.defs.length)return;let[o]=n.defs;if("Variable"===o.type&&"const"===o.parent.kind&&o.node.id===o.name&&r(o.node.init))return o.node.init},mc=(e,t)=>{let{sourceCode:r}=t;if(ma(e)?!e:!mp(e,r,ma))return;let{node:n,isNegative:o}=function(e,t){let r=!1;for(;;)if(tD(e))r=!r,e=e.parent;else if(tS(e,t))e=e.parent;else break;return{node:e,isNegative:r}}(e,t);if(!tA(n))return;let a=r.getText(e);return{node:e,messageId:mt,fix:((e,t,r)=>{let[n,o]=r.getRange(e),[a,i]=r.getRange(t);return r.getAllComments().some(e=>{let[t,s]=r.getRange(e);return t>=n&&s<=o&&(s<=a||t>=i)})})(n,e,r)?void 0:e=>e.replaceText(n,`${a}.length ${o?"=== 0":"> 0"}`)}},md=(e,t,r)=>({node:e,messageId:d7,*fix(n){yield n.replaceText(t.callee.property,"querySelector"),yield"MemberExpression"===e.type?oh(n,e,r):ox(n,e,r)}}),mm=(e,t)=>e9(e)||th(e)&&t.isGlobalReference(e),mf=(e,t,r)=>{let{left:n,operator:o,right:a}=e;return["==","===","!=","!=="].includes(o)?(t(n)?n:mp(n,r,t))&&mm(a,r)?{node:n,value:a}:(t(a)?a:mp(a,r,t))&&mm(n,r)?{node:a,value:n}:void 0:void 0},mg="no-invalid-file-input-accept/invalid",my="no-invalid-file-input-accept/static",mh="no-invalid-file-input-accept/normalize",mx=new Set(["audio/*","image/*","video/*"]),mb=new Map([["application/x-rar-compressed","application/vnd.rar"],["application/x-zip-compressed","application/zip"],["image/jpg","image/jpeg"],["image/svg","image/svg+xml"],["image/x-icon","image/vnd.microsoft.icon"]]),mE=/&(?:#\d+|#x[\da-f]+|[a-z][\da-z]*);/iv,mD=e=>{for(let t of e)if(""===t.trim()||","===t||"/"===t||"*"===t||"$"===t||"{"===t||"}"===t)return!0;return!1},mS=e=>{if(e.startsWith("."))return e.length>1&&!mD(e.slice(1))?{replacement:e.toLowerCase()}:{reason:"File extensions must start with `.` and cannot contain whitespace, commas, slashes, wildcards, or template markers."};if(!e.includes("/"))return e.length>0&&"."!==e[0]&&!mD(e)?{replacement:`.${e.toLowerCase()}`}:{reason:"File extensions must start with `.` and cannot contain whitespace, commas, slashes, wildcards, or template markers."};let t=e.toLowerCase();if(t.includes("*"))return mx.has(t)?{replacement:t}:{reason:"Wildcard MIME types must be `audio/*`, `image/*`, or `video/*`."};try{let{essence:t}=new m.MIMEType(e);return{replacement:mb.get(t)??t}}catch{return{reason:"MIME types must use valid `type/subtype` syntax."}}},mv=e=>{if("JSXIdentifier"===e.type)return e.name},mC=(e,t)=>e.attributes.find(e=>"JSXAttribute"===e.type&&mv(e.name)===t),mA=(e,t)=>{let r=e.sourceCode.getScope(t),n=ew(t,r)?.value;if("string"==typeof n)return n},mT=e=>">"===e||""===e.trim(),mw=(e,t,r)=>{for(;t<r&&""===e[t].trim();)t++;return t},mI=(e,t,r)=>t>=r||">"===e[t]||"/"===e[t]&&">"===e[t+1],mF=(e,t,r)=>{let n=t;for(;t<r&&""!==e[t].trim()&&"="!==e[t]&&">"!==e[t]&&("/"!==e[t]||">"!==e[t+1]);)t++;return{name:e.slice(n,t).toLowerCase(),index:t}},mj=(e,t,r)=>{let n='"'===e[t]||"'"===e[t]?e[t]:void 0;if(n){let o=t+1;for(t=o;t<r&&e[t]!==n;)t++;return{value:e.slice(o,t),valueRange:[o,t],isQuoted:!0,index:t+1}}let o=t;for(;t<r&&!mT(e[t]);)t++;return{value:e.slice(o,t),valueRange:[o,t],isQuoted:!1,index:t}},mk=(e,t,r)=>{let n=e.sourceCode.text,o=e.sourceCode.getRange(t.openStart)[1],a=e.sourceCode.getRange(t.openEnd)[1],i=o;for(;i<a&&(i=mw(n,i,a),!mI(n,i,a));){let e=mF(n,i,a);if(i=mw(n,e.index,a),"="!==n[i]){if(e.name===r)return{missing:!0};continue}i=mw(n,++i,a);let t=mj(n,i,a);if(i=t.index,e.name===r)return t}},mB=({valueInfo:e,fix:t})=>{if(e.missing)return{node:e.node,messageId:mg,data:{reason:"The `accept` attribute must have a value."}};if(e.dynamic)return{node:e.node,messageId:my};let r=(e=>{let t=e.split(","),r=new Set,n=[];for(let e of t){let t=e.trim();if(0===t.length)return{reason:"Empty entries are not allowed."};let o=mS(t);if(o.reason)return o;let{replacement:a}=o;r.has(a)||(r.add(a),n.push(a))}let o=n.join(", ");return o===e?{}:{replacement:o}})(e.value),n=r.replacement&&e.fixable&&(!e.isReplacementFixable||e.isReplacementFixable(r.replacement));return(({valueNode:e,checkResult:t,fix:r})=>{if(t.reason)return{node:e,messageId:mg,data:{reason:t.reason}};if(t.replacement){let n={node:e,messageId:mh,data:{replacement:t.replacement}};return r&&(n.fix=r),n}})({valueNode:e.node,checkResult:r,fix:n?t(r.replacement):void 0})},mP="after-await",m$="in-nested-function",mR=/^(?:e|event|evt|[a-z][\dA-Za-z]*Event)$/u,mL=e=>{for(let t=e.parent;t;t=t.parent)if(tl(t))return t},mN="no-unnecessary-nested-ternary";function mM(e,t,r){return r.getText(e)===r.getText(t)}function mO(e,t,r,n){let o=eQ(e,t);return!eZ(e,t)&&nq(e,{operator:r,property:n})&&(o=`(${o})`),o}function mq(e,t){let r=eQ(e,t);return!eZ(e,t)&&nL(e)&&(r=`(${r})`),r}function mU(e,t,r){let n={node:t,messageId:mN};return 0===e.sourceCode.getCommentsInside(t).length&&(n.fix=n=>n.replaceText(t,function({context:e,node:t,left:r,operator:n,right:o,consequent:a,alternate:i}){let{sourceCode:s}=e,l=[mO(r,e,n,"left"),mO(o,e,n,"right")].join(` ${n} `),u=`${l} ? ${mq(a,e)} : ${mq(i,e)}`;return nS(s.getTokenBefore(t),e,u)&&(u=`;${u}`),u}({context:e,node:t,...r}))),n}let m_="no-unused-array-method-return",mW=new Set(["at","concat","entries","every","filter","find","findIndex","findLast","findLastIndex","flat","flatMap","includes","indexOf","join","keys","lastIndexOf","map","some","slice","toReversed","toSorted","toSpliced","values","with"]),mV=/^\p{Uppercase_Letter}/v,mz=Symbol("uncertainValue"),mK=new Set(["BigInt","Boolean","Number","RegExp","String"]),mG=(e,t,r)=>"Identifier"===e.type&&e.name===t&&r.sourceCode.isGlobalReference(e),mJ="prefer-array-last-methods",mX="replace",mY=new Map([["find","findLast"],["findIndex","findLastIndex"],["indexOf","lastIndexOf"],["reduce","reduceRight"]]),mH=["reverse","toReversed"],mQ="prefer-math-abs",mZ=new Set([">",">=","<","<="]),m0={">":"<",">=":"<=","<":">","<=":">="},m1={">":"<",">=":"<="};function m2(e){return"TSBigIntKeyword"===e.type||"TSLiteralType"===e.type&&e5(e.literal)||"TSTypeAnnotation"===e.type&&m2(e.typeAnnotation)||"TSUnionType"===e.type&&e.types.some(e=>m2(e))||"TSIntersectionType"===e.type&&e.types.some(e=>m2(e))}function m3(e){return["TSAsExpression","TSTypeAssertion","TSNonNullExpression"].includes(e.type)?m3(e.expression):e}function m8(e){let t;return e5(e)||e7(e,{name:"BigInt",argumentsLength:1,optional:!1})||"UnaryExpression"===e.type&&"-"===e.operator&&m8(e.argument)||(t=function e(t){return"TSNonNullExpression"===t.type?e(t.expression):"TSAsExpression"===t.type||"TSTypeAssertion"===t.type?t.typeAnnotation:void 0}(e))&&m2(t)}function m6(e,t){return m8(e)||function(e,t){let r=m3(e);if("Identifier"!==r.type)return!1;let n=ei(t.sourceCode.getScope(r),r);return n?.defs.some(e=>"Parameter"===e.type?e.name.typeAnnotation&&m2(e.name.typeAnnotation)||"AssignmentPattern"===e.name.parent.type&&m8(e.name.parent.right):"Variable"===e.type&&(e.node.id.typeAnnotation&&m2(e.node.id.typeAnnotation)||e.node.init&&m8(e.node.init)))??!1}(e,t)}function m9(e,t){return"UnaryExpression"===e.type&&"-"===e.operator?tH(e.argument,t):"BinaryExpression"===e.type&&"-"===e.operator&&e0(e.left,0)?tH(e.right,t):"BinaryExpression"===e.type&&"*"===e.operator&&(tH(e.left,t)&&td(e.right)||td(e.left)&&tH(e.right,t))}function m5(e,t){if(!("BinaryExpression"!==e.type||!mZ.has(e.operator)||m6(e.left,t)||m6(e.right,t)))return">"===e.operator||">="===e.operator?{value:e.left,threshold:e.right,operator:e.operator}:{value:e.right,threshold:e.left,operator:m0[e.operator]}}function m4(e,t){if(!("BinaryExpression"!==e.type||!mZ.has(e.operator)||m6(e.left,t)||m6(e.right,t)))return"<"===e.operator||"<="===e.operator?{value:e.left,negativeThreshold:e.right,operator:e.operator}:{value:e.right,negativeThreshold:e.left,operator:m0[e.operator]}}function m7(e,t){let r=eQ(e,t);return"SequenceExpression"===e.type?`(${r})`:r}function fe(e,t,r){let n={node:e,messageId:mQ};return r&&!(t.sourceCode.getCommentsInside(e).length>0)&&(n.fix=r),n}function ft(e){return["Identifier","Literal","ThisExpression"].includes((e=m3(e)).type)}let fr="prefer-split-limit",fn=(e,t)=>{let r=ew(e,t.getScope(e));if(r&&Number.isSafeInteger(r.value)&&!(r.value<0))return r.value},fo=e=>{let t;return tc(e,{method:"split",argumentsLength:1})&&(e1(t=e.arguments[0])&&""!==t.value||e6(t))},fa=(e,t,r,n)=>({node:e,messageId:fr,fix:e=>os(e,t,String(r+1),n)}),fi="prefer-queue-microtask",fs={create:e=>{let{checkSetImmediate:t,checkSetTimeout:r}=e.options[0];e.on("MemberExpression",t=>{if(tp(t,{object:"process",property:"nextTick",computed:!1,optional:!1})&&nf(t.object,e)&&("CallExpression"!==t.parent.type||t.parent.callee!==t||!t.parent.optional))return{node:t.property,messageId:fi,data:{name:"process.nextTick()"},fix:((e,t)=>{let{parent:r}=e;if("CallExpression"===r.type&&r.callee===e&&1===r.arguments.length&&"SpreadElement"!==r.arguments[0].type&&!(t.sourceCode.getCommentsInside(e).length>0))return t=>t.replaceText(e,"queueMicrotask")})(t,e)}}),e.on("CallExpression",n=>{let o;return t&&"Identifier"===n.callee.type&&"setImmediate"===n.callee.name&&!n.optional&&n.arguments.length>0&&"SpreadElement"!==n.arguments[0].type&&!np(n.arguments[0])&&nb(n)&&nf(n.callee,e)?{node:n.callee,messageId:fi,data:{name:"setImmediate()"},fix:(e=>{if(1===e.arguments.length)return t=>t.replaceText(e.callee,"queueMicrotask")})(n)}:r&&"Identifier"===n.callee.type&&"setTimeout"===n.callee.name&&!n.optional&&n.arguments.length>=2&&"Literal"===(o=n.arguments[1]).type&&0===o.value&&"SpreadElement"!==n.arguments[0].type&&!np(n.arguments[0])&&nb(n)&&nf(n.callee,e)?{node:n.callee,messageId:fi,data:{name:"setTimeout()"},fix:((e,t)=>{if(2!==e.arguments.length)return;let r=((e,t)=>{let{sourceCode:r}=t,[,n]=e.arguments,o=r.getTokenBefore(n),a=r.getTokenAfter(n),i=a?.value===","?r.getTokenAfter(a):a,s=[r.getRange(o)[0],a?.value===","?r.getRange(a)[1]:r.getRange(n)[1]],l=[s[0],r.getRange(i)[0]];if(!r.getAllComments().some(e=>r.getRange(e)[0]>=l[0]&&r.getRange(e)[1]<=l[1]))return s})(e,t);if(r)return function*(t){yield t.replaceText(e.callee,"queueMicrotask"),yield t.removeRange(r)}})(n,e)}:void 0})},meta:{type:"suggestion",docs:{description:"Prefer `queueMicrotask()` over `process.nextTick()`, `setImmediate()`, and `setTimeout(…, 0)`.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{checkSetImmediate:{type:"boolean",description:"Whether to also check `setImmediate()`."},checkSetTimeout:{type:"boolean",description:"Whether to also check `setTimeout(…, 0)`."}}}],defaultOptions:[{checkSetImmediate:!1,checkSetTimeout:!1}],messages:{[fi]:"Prefer `queueMicrotask()` over `{{name}}`."},languages:["js/js"]}},fl="prefer-string-pad-start-end",fu="suggest-padding-method",fp=new Set(["ArrayExpression","ArrowFunctionExpression","ClassExpression","FunctionExpression","ObjectExpression"]),fc=(e,t)=>{let r,n=((e,t)=>{if("Identifier"!==e.type)return;let r=ei(t.sourceCode.getScope(e),e),n=r?.defs[0]?.node;return n?.type==="FunctionDeclaration"||n?.type==="ClassDeclaration"?n:n?.type==="VariableDeclarator"?n.init:void 0})(e,t);return(r=ew(e,t.sourceCode.getScope(e)))&&"string"!=typeof r.value||fp.has(e.type)||fp.has(n?.type)||n?.type==="FunctionDeclaration"||n?.type==="ClassDeclaration"},fd=(e,t)=>t.sourceCode.getCommentsInside(e).length>0,fm=e=>"Literal"===e.type&&"number"==typeof e.value,ff=e=>"Literal"===e.type&&"string"==typeof e.value||"TemplateLiteral"===e.type&&0===e.expressions.length,fg=({targetNode:e,targetLengthNode:t,paddingNode:r})=>"Identifier"===e.type&&fm(t)&&ff(r),fy=(e,t)=>{if(!tc(e,{method:"repeat",argumentsLength:1,optionalCall:!1,optionalMember:!1}))return;let r=e.callee.object,n=((e,t)=>{let r=ew(e,t.sourceCode.getScope(e));if("string"==typeof r?.value)return r.value})(r,t);if(n?.length===1)return{paddingNode:r,paddingString:n,widthNode:e.arguments[0]}},fh=(e,t)=>{let r,n=fy(e,t);if(!n)return;let{widthNode:o}=n;if("BinaryExpression"===o.type&&"-"===o.operator&&(r=o.right,r?.type==="MemberExpression"&&!1===r.computed&&"Identifier"===r.property.type&&"length"===r.property.name))return{...n,targetLengthNode:o.left,targetNode:o.right.object}},fx=({method:e,targetNode:t,targetLengthNode:r,paddingNode:n,paddingString:o},a)=>{let i=eQ(t,a),s=eQ(r,a),l=(({paddingNode:e,paddingString:t},r)=>" "===t?"":`, ${eQ(e,r)}`)({paddingNode:n,paddingString:o},a);return`${i}.${e}(${s}${l})`},fb=({node:e,method:t,replacement:r,context:n,canFix:o})=>{let a={node:e,messageId:fl,data:{method:t}};return o&&!fd(e,n)&&(a.fix=function(t){let o=nS(n.sourceCode.getTokenBefore(e),n,r)?";":"";return t.replaceText(e,`${o}${r}`)}),a},fE=({node:e,method:t,replacement:r,context:n,canSuggest:o})=>{let a={node:e,messageId:fl,data:{method:t}};return o&&!fd(e,n)&&(a.suggest=[{messageId:fu,data:{method:t},fix:t=>t.replaceText(e,r)}]),a},fD="require-css-escape",fS=["closest","matches","querySelector","querySelectorAll"],fv=e=>e.value.cooked,fC=(e,t)=>{let r,n="";for(let r of e.quasis.slice(0,t+1)){let e=fv(r);if(void 0===e)return!1;n+=e}if(!((r=n).lastIndexOf("[")>r.lastIndexOf("]")))return!1;for(let r of e.quasis.slice(t+1)){let e=fv(r);if(void 0===e)break;if(e.includes("]"))return!0}return!1},fA=e=>tc(e,{object:"CSS",method:"escape",argumentsLength:1,optionalCall:!1,optionalMember:!1}),fT=e=>t=>"SequenceExpression"===e.type?[t.insertTextBefore(e,"CSS.escape(("),t.insertTextAfter(e,"))")]:[t.insertTextBefore(e,"CSS.escape("),t.insertTextAfter(e,")")],fw={create:e=>{let{checkAllSelectors:t}=e.options[0];e.on("CallExpression",function*(e){if(!tc(e,{methods:fS,minimumArguments:1})||ns(e.callee.object))return;let[r]=e.arguments;if("TemplateLiteral"===r.type&&0!==r.expressions.length)for(let[e,n]of r.expressions.entries())!fA(n)&&(t||fC(r,e))&&(yield{node:n,messageId:fD,fix:fT(n)})})},meta:{type:"suggestion",docs:{description:"Require `CSS.escape()` for interpolated values in CSS selectors.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{checkAllSelectors:{type:"boolean",description:"Check all selector interpolations instead of only attribute selector interpolations."}}}],defaultOptions:[{checkAllSelectors:!1}],messages:{[fD]:"Use `CSS.escape()` for interpolated values in CSS selectors."},languages:["js/js"]}},fI="require-passive-events",fF=new Set(["touchstart","touchmove","touchenter","touchend","touchleave","wheel","mousewheel"]),fj=e=>e.computed||"Identifier"!==e.property.type?e1(e.property)?e.property.value:void 0:e.property.name,fk=e=>{var t,r;return"MemberExpression"===e.parent.type&&e.parent.object===e&&"MemberExpression"===(t=e.parent).type&&"preventDefault"===fj(t)&&("CallExpression"===(r=t).parent.type&&r.parent.callee===r?r.parent:"ChainExpression"===r.parent.type&&"CallExpression"===r.parent.parent.type&&r.parent.parent.callee===r.parent?r.parent.parent:void 0)},fB=e=>{if("MemberExpression"!==e.parent.type||e.parent.object!==e)return!1;let t=fj(e.parent);return t&&"preventDefault"!==t&&!rq((e=>{for(;"MemberExpression"===e.parent.type&&e.parent.object===e;)e=e.parent;return e})(e.parent))},fP="this",f$="class",fR="class-unavailable",fL="super",fN="super-class",fM="super-class-unavailable",fO="suggestion",fq=new Set(["PropertyDefinition","AccessorProperty","StaticBlock","ClassBody"]),fU=new Set(["TSAsExpression","TSInstantiationExpression","TSNonNullExpression","TSSatisfiesExpression","TSTypeAssertion"]),f_=e=>"MethodDefinition"===e.parent.type&&e.parent.value===e,fW=e=>"FunctionDeclaration"===e.type||"FunctionExpression"===e.type,fV=e=>{let t=e;for(let{parent:r}=e;r;t=r,r=r.parent)if("ArrowFunctionExpression"!==r.type){if(fW(r)&&!f_(r))return;if("MethodDefinition"===r.type)return r.static&&r.value===t?r:void 0;if(fq.has(r.type))return}},fz=e=>{if(e.id)return e.id;let{parent:t}=e;if("ClassExpression"===e.type&&"VariableDeclarator"===t.type&&t.init===e&&"Identifier"===t.id.type)return t.id},fK=(e,t,r)=>ei(e.getScope(t),t)===ei(e.getScope(r),r),fG=(e,t)=>"AssignmentExpression"===e.type&&e.left===t||"UpdateExpression"===e.type&&e.argument===t||"UnaryExpression"===e.type&&"delete"===e.operator&&e.argument===t||("ForInStatement"===e.type||"ForOfStatement"===e.type)&&e.left===t,fJ=e=>{let t;return(t=e.parent,fU.has(t.type)&&t.expression===e)?e.parent:void 0},fX=e=>{let{parent:t}=e;if("MemberExpression"===t.type&&t.object===e||"ChainExpression"===t.type&&t.expression===e)return t;let r=fJ(e);return r||("Property"===t.type&&t.value===e&&"ObjectPattern"===t.parent.type?t.parent:"ObjectPattern"===t.type&&t.properties.includes(e)||"ArrayPattern"===t.type&&t.elements.includes(e)||"AssignmentPattern"===t.type&&t.left===e||"RestElement"===t.type&&t.argument===e?t:void 0)},fY=e=>{let t=e;for(;t.parent;){if(fG(t.parent,t))return!0;let e=fX(t);if(!e)break;t=e}return!1},fH=e=>"MemberExpression"===e.parent.type&&e.parent.object===e,fQ=e=>{let t=e;for(;t.parent;){let e=fJ(t);if(!e)break;t=e}return t},fZ=e=>{let t=fQ(e);return"CallExpression"===t.parent.type&&t.parent.callee===t||"NewExpression"===t.parent.type&&t.parent.callee===t||"TaggedTemplateExpression"===t.parent.type&&t.parent.tag===t},f0=e=>{let t=fQ(e);return fH(t)&&"PrivateIdentifier"===t.parent.property.type},f1=e=>{let t=fQ(e);return"BinaryExpression"===t.parent.type&&"in"===t.parent.operator&&"PrivateIdentifier"===t.parent.left.type&&t.parent.right===t},f2=e=>e.superClass?.type==="Identifier"?e.superClass:void 0,f3=({node:e,messageId:t,source:r,replacement:n,name:o})=>({node:e,messageId:t,data:{name:o},suggest:[{messageId:fO,data:{source:r,replacement:n},fix:t=>t.replaceText("ChainExpression"===e.parent.type?e.parent:e,n)}]}),f8=(e,t,r)=>({node:e,messageId:t,data:{name:r}}),f6={create:e=>{let{sourceCode:t}=e,{preferThis:r,preferSuper:n}=e.options[0];e.on("ThisExpression",e=>{if(r||fY(e)||fZ(e)||f0(e)||f1(e))return;let t=fV(e);if(!t)return;let n=fz(t.parent.parent);return n?f3({node:e,messageId:f$,source:"this",replacement:n.name,name:n.name}):f8(e,fR)}),e.on("Super",e=>{if(n||fY(e))return;let t=fV(e);if(!t)return;let r=f2(t.parent.parent);return r?f3({node:e,messageId:fN,source:"super",replacement:r.name,name:r.name}):f8(e,fM)}),e.on("Identifier",o=>{if(!function(e,t=[]){if("Identifier"!==e.type)return!1;let r=Array.isArray(t)?t:[t];return(!(r.length>0)||!!r.includes(e.name))&&!function(e){let{parent:t}=e;switch(t.type){case"MemberExpression":return!t.computed&&t.property===e;case"FunctionDeclaration":case"FunctionExpression":return t.params.includes(e)||t.id===e;case"ArrowFunctionExpression":return t.params.includes(e);case"ClassDeclaration":case"ClassExpression":case"VariableDeclarator":case"TSDeclareFunction":case"TSEnumMember":case"TSTypeAliasDeclaration":return t.id===e;case"PropertyDefinition":case"MethodDefinition":return!t.computed&&t.key===e;case"Property":return!t.computed&&t.key===e&&("ObjectExpression"===t.parent.type||"ObjectPattern"===t.parent.type)&&t.parent.properties.includes(t)||t.value===e&&"ObjectPattern"===t.parent.type&&t.parent.properties.includes(t);case"ArrayPattern":return t.elements.includes(e);case"LabeledStatement":case"ContinueStatement":case"BreakStatement":return t.label===e;case"ImportDefaultSpecifier":case"ImportNamespaceSpecifier":return t.local===e;case"ExportAllDeclaration":return t.exported===e;case"ImportSpecifier":return t.local===e||t.imported===e;case"ExportSpecifier":return t.local===e||t.exported===e;case"TSIndexSignature":return t.parameters.includes(e);case"TSTypeParameter":return t.name===e;case"TSMappedType":case"TSPropertySignature":return t.key===e}return!1}(e)}(o)||(e=>{let t=e;for(;"TSQualifiedName"===t.parent.type;)t=t.parent;return"TSTypeReference"===t.parent.type&&t.parent.typeName===t||"TSTypeQuery"===t.parent.type&&t.parent.exprName===t})(o)||fY(o)||fZ(o)||f0(o)||f1(o))return;let a=fV(o);if(!a)return;let i=a.parent.parent;if(r){let e=fz(i);if(e&&o.name===e.name&&fK(t,o,e))return f3({node:o,messageId:fP,source:o.name,replacement:"this",name:o.name})}if(!n||!(fH(o)&&!o.parent.optional&&!fY(o.parent))||eZ(o,e))return;let s=f2(i);if(s&&o.name===s.name&&fK(t,o,s))return f3({node:o,messageId:fL,source:o.name,replacement:"super",name:o.name})})},meta:{type:"suggestion",docs:{description:"Enforce consistent class references in static methods.",recommended:!0},hasSuggestions:!0,schema:[{type:"object",properties:{preferThis:{type:"boolean",description:"Prefer `this` over the current class name in static methods."},preferSuper:{type:"boolean",description:"Prefer `super` over the superclass name in static methods."}},additionalProperties:!1}],defaultOptions:[{preferThis:!0,preferSuper:!0}],messages:{[fP]:"Use `this` instead of `{{name}}` in static methods.",[f$]:"Use `{{name}}` instead of `this` in static methods.",[fR]:"Use the class name instead of `this` in static methods.",[fL]:"Use `super` instead of `{{name}}` in static methods.",[fN]:"Use `{{name}}` instead of `super` in static methods.",[fM]:"Use the superclass name instead of `super` in static methods.",[fO]:"Replace `{{source}}` with `{{replacement}}`."},languages:["js/js"]}},f9="consistent-optional-chaining/remove-optional",f5="consistent-optional-chaining/use-optional",f4="consistent-optional-chaining/suggest-remove-optional",f7="consistent-optional-chaining/suggest-use-optional",ge=new Set(["Identifier","ThisExpression","Super"]);function gt(e){let t;for(;e!==t;)t=e,"ChainExpression"===(e=nA(e)).type&&(e=e.expression);return e}function gr(e){return"MemberExpression"===(e=gt(e)).type?e:void 0}function gn(e){return e=gt(e),!!ge.has(e.type)||"MemberExpression"===e.type&&gn(e.object)}function go(e,t){let{sourceCode:r}=t,[,n]=eH(e.object,t);return[n,e.computed?r.getRange(r.getTokenBefore(e.property,e=>"["===e.value))[1]:r.getRange(e.property)[0]]}function ga(e,t){let r=go(e,t);return!function(e,[t,r]){return e.getAllComments().some(n=>{let[o,a]=e.getRange(n);return o>=t&&a<=r})}(t.sourceCode,r)}function gi({memberExpression:e,context:t,fixer:r,replacement:n}){let o=go(e,t);return r.replaceTextRange(o,n)}function gs(e,t,r){return gi({memberExpression:e,context:t,fixer:r,replacement:e.computed?"[":"."})}let gl="always",gu="never",gp="missing-delay",gc="redundant-delay",gd=new Set(["setTimeout","setInterval"]),gm=new Set(["window","globalThis","global","self"]),gf=e=>e0(e,0)||"UnaryExpression"===e.type&&("+"===e.operator||"-"===e.operator)&&gf(e.argument),gg="negative-index",gy="length-index",gh=["entries","keys","values"],gx=["drop","filter","flatMap","map","take"],gb=["concat","from","zip","zipKeyed"],gE=e=>{for(;nC(e)||"ChainExpression"===e.type||"ParenthesizedExpression"===e.type;)e=e.expression;return e},gD="no-duplicate-loops",gS=["filter","map"],gv="no-declarations-before-early-exit",gC=e=>"VariableDeclaration"===e.type&&("let"===e.kind||"const"===e.kind);function gA(e){let t="BlockStatement"!==e.type?e:e.body.at(-1);return t?.type==="ReturnStatement"||t?.type==="ThrowStatement"||t?.type==="BreakStatement"||t?.type==="ContinueStatement"||t?.type==="IfStatement"&&t.alternate&&gA(t.consequent)&&gA(t.alternate)}let gT=e=>"use"===e||/^use[\dA-Z]/.test(e),gw=e=>!e||"Literal"===e.type||"TemplateLiteral"===e.type&&0===e.expressions.length,gI=(e,t,r)=>{let n="before"===r?e.getTokenBefore(t,{includeComments:!0}):e.getTokenAfter(t,{includeComments:!0});return n&&eg(n)},gF=(e,t)=>{let[r,n]=e.getRange(t);return new Set(tN(e.getScope(t)).filter(({identifier:t})=>{let[o,a]=e.getRange(t);return o>=r&&a<=n}).map(({identifier:e})=>e.name))};function*gj(e,t){for(let[r,n]of t.entries())if(gC(n)&&!n.declare){for(let[o,a]of t.entries())if(!(o<=r)&&function(e){if("IfStatement"!==e.type)return!1;let t=gA(e.consequent);return!!(e.alternate&&gA(e.alternate))!==t}(a)){for(let t of n.declarations){let i=function({sourceCode:e,declaration:t,declarator:r,guardStatement:n,declarationIndex:o,guardIndex:a}){var i;let s;if("Identifier"!==r.id.type||(e=>{if(e?.type!=="CallExpression")return!1;let{callee:t}=e;return"Identifier"===t.type?gT(t.name):"MemberExpression"===t.type&&!t.computed&&"Identifier"===t.object.type&&/^[A-Z]/.test(t.object.name)&&"Identifier"===t.property.type&&gT(t.property.name)})(r.init)||a>o+1&&!gw(r.init)||r.init&&(i=r.init,s=gF(e,n),[...gF(e,i)].some(e=>s.has(e)))&&(eR(r.init,e)||eR(n.test,e)))return;let[l]=e.getDeclaredVariables(r),u=l.references.filter(e=>!e.init&&!function(e){let t=e;for(;"TSQualifiedName"===t.parent.type;)t=t.parent;return"TSTypeQuery"===t.parent.type}(e.identifier));if(0===u.length)return;let[,p]=e.getRange(n);if(u.some(t=>e.getRange(t.identifier)[0]<p))return;let c={node:r.id,messageId:gv};return(({sourceCode:e,declaration:t,guardStatement:r,declarationIndex:n,guardIndex:o})=>o===n+1&&1===t.declarations.length&&gw(t.declarations[0].init)&&0===e.getCommentsInside(t).length&&!gI(e,t,"before")&&!gI(e,r,"after")&&!e.getTokensBetween(t,r,{includeComments:!0}).some(e=>eg(e)))({sourceCode:e,declaration:t,guardStatement:n,declarationIndex:o,guardIndex:a})&&(c.fix=function(e,t,r){let n=e.getText(t),o=e.getText(r),[a,i]=e.getRange(t),[s,l]=e.getRange(r),u=e.text.slice(i,s);return e=>e.replaceTextRange([a,l],`${o}${u}${n}`)}(e,t,n)),c}({sourceCode:e,declaration:n,declarator:t,guardStatement:a,declarationIndex:r,guardIndex:o});i&&(yield i)}break}}}let gk="no-optional-chaining-on-undeclared-variable",gB=e=>"Type"===e.type||"ImportBinding"===e.type&&nT(e.node);function gP(e){let t;for(;e!==t;)t=e,("ChainExpression"===(e=nA(e)).type||"TSInstantiationExpression"===e.type)&&(e=e.expression);return e}let g$="no-object-methods-with-collections/error",gR="no-object-methods-with-collections/suggestion",gL=new Set(["Map","ReadonlyMap"]),gN=new Set(["Set","ReadonlySet"]),gM=new Set([...gL,...gN]),gO=new Set(["entries","keys","values"]),gq=e=>new Set([e]),gU=e=>gM.has(e)?e:void 0,g_=new Set(["ClassDeclaration","TSEnumDeclaration","TSInterfaceDeclaration","TSTypeAliasDeclaration"]),gW=e=>{if(e&&g_.has(e.type))return e.id?.name},gV=(e,t)=>{let r=(e=>{for(;e.parent;)e=e.parent;return"Program"===e.type?e:void 0})(t);if(!r)return!1;for(let t of r.body){if("ImportDeclaration"===t.type){if(t.specifiers.some(t=>t.local.name===e))return!0;continue}if("ExportNamedDeclaration"===t.type||"ExportDefaultDeclaration"===t.type){if(gW(t.declaration)===e)return!0;continue}if(gW(t)===e)return!0}return!1},gz=e=>{let t=new Set;for(let r of e){if(!r)return;for(let e of r)t.add(e)}return t},gK=(e,t)=>{let r=ei(t.sourceCode.getScope(e),e);return!r||"global"===r.scope.type&&0===r.defs.length},gG=(e,t)=>{if(ri.has(e.intrinsicName))return;if(e.isUnion())return gz(e.types.map(e=>gG(e,t)));let r=rl(e);if(!(r?.declarations?.length>0&&r.declarations.every(e=>t.isSourceFileDefaultLibrary(e.getSourceFile()))))return;let n=r.getName(),o=n&&gU(n);return o&&gq(o)},gJ=(e,t)=>{switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return gJ(e.typeAnnotation);case"TSTypeOperator":return"readonly"===e.operator?gJ(e.typeAnnotation):void 0;case"TSTypeReference":{if("Identifier"!==e.typeName.type||gV(e.typeName.name,e))return;let t=gU(e.typeName.name);return t&&gq(t)}case"TSUnionType":return gz(e.types.map(e=>gJ(e)))}},gX=(e,t,r=new Set)=>((e,t)=>{let{parserServices:r}=t.sourceCode;if(r?.program)try{let{program:t}=r,n=gG(r.getTypeAtLocation(e),t);if(n&&!((e,t)=>{for(let r of e)if(gV(r,t))return!0;return!1})(n,e))return n}catch{}})(e,t)??((e,t,r)=>{if(te(e,{names:["Map","Set"]})&&gK(e.callee,t))return gq(e.callee.name);switch(e.type){case"Identifier":return((e,t,r)=>{let n=ei(t.sourceCode.getScope(e),e);if(!n||r.has(n)||1!==n.defs.length)return;r.add(n);let[o]=n.defs,a=gJ(o.name?.typeAnnotation);return a||("Variable"===o.type&&"const"===o.parent.kind&&o.node.init?gX(o.node.init,t,r):void 0)})(e,t,r);case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":return gJ(e.typeAnnotation)??gX(e.expression,t,r);case"TSNonNullExpression":case"ParenthesizedExpression":return gX(e.expression,t,r)}})(e,t,r),gY="no-subtraction-comparison/error",gH="no-subtraction-comparison/suggestion",gQ={">":"<",">=":"<=","<":">","<=":">=","===":"===","!==":"!==","==":"==","!=":"!="},gZ=new Set(Object.keys(gQ)),g0=new Set([">","<"]),g1=e=>"BinaryExpression"===e.type&&"-"===e.operator,g2=(e,t)=>{let r=ew(e,t)?.value;return"number"==typeof r&&Number.isFinite(r)},g3="no-unnecessary-global-this",g8=new Set(["TSAsExpression","TSInstantiationExpression","TSNonNullExpression","TSSatisfiesExpression","TSTypeAssertion"]),g6=e=>{for(;g8.has(e.parent.type)&&e.parent.expression===e;)e=e.parent;return e};function g9(e){return"CallExpression"===(e=g6(e)).parent.type&&e.parent.callee===e}let g5="computed-key",g4="nested-array",g7="deep-object",ye="property-assignment";function yt(e){let{parent:t}=e;if(t){if(nC(t)&&t.expression===e||"AssignmentPattern"===t.type&&t.left===e||"RestElement"===t.type&&t.argument===e)return yt(t);if("Property"===t.type&&t.value===e&&"ObjectPattern"===t.parent.type)return t.parent;if("ObjectPattern"===t.type||"ArrayPattern"===t.type)return t}}function yr(e){let t=0;for(;e;)"ObjectPattern"===e.type&&t++,e=yt(e);return t}let yn="no-useless-else",yo=new Set(["Program","BlockStatement","StaticBlock","SwitchCase"]),ya=new Set(["ReturnStatement","ThrowStatement","BreakStatement","ContinueStatement"]),yi=new Set(["[","(","/","`","+","-"]),ys=new Set(["ClassDeclaration","FunctionDeclaration","TSEnumDeclaration","TSInterfaceDeclaration","TSModuleDeclaration","TSTypeAliasDeclaration"]),yl=(e,t)=>{let r=e.text.lastIndexOf("\n",t-1)+1;return/^[\t ]*/.exec(e.text.slice(r,t))[0]},yu=e=>"VariableDeclaration"===e.type&&"var"!==e.kind||ys.has(e.type),yp=e=>!!ya.has(e.type)||("BlockStatement"===e.type?e.body.some(e=>yp(e)):!!("IfStatement"===e.type&&e.alternate&&yp(e.consequent)&&yp(e.alternate))),yc=e=>yi.has(e.value[0]),yd="no-useless-recursion",ym=new Set(["using","await using"]),yf=e=>e?.type==="VariableDeclaration"&&ym.has(e.kind),yg=e=>"ForStatement"===e.type?yf(e.init):"ForOfStatement"===e.type&&yf(e.left),yy="prefer-add-event-listener-options",yh="prefer-direct-iteration",yx="Array",yb="FormData",yE="URLSearchParams",yD=new Set([yx,"Map","Set",yb,yE,...ra]),yS=new Map([["ReadonlyArray",yx],["ReadonlyMap","Map"],["ReadonlySet","Set"]]),yv=new Map([[yx,["values"]],["Map",["entries"]],["Set",["values","keys"]],[yb,["entries"]],[yE,["entries"]],...ra.map(e=>[e,["values"]])]),yC=["Map","WeakMap","Set","WeakSet"],yA=["all","allSettled","any","race"],yT=new Set(["ArrayExpression","CallExpression","NewExpression"]),yw=e=>new Set([e]),yI=(e,t)=>tc(e,{objects:ra,methods:t,optionalCall:!1,optionalMember:!1}),yF=e=>yD.has(e)?e:yS.get(e),yj=e=>{let t=new Set;for(let r of e){if(!r)return;for(let e of r)t.add(e)}return t},yk=(e,t,r)=>{if("any"===e.intrinsicName||"unknown"===e.intrinsicName)return;if(e.isUnion())return yj(e.types.map(e=>yk(e,t,r)));if(t.isArrayType(e)||t.isTupleType(e))return yw(yx);let n=rl(e);if(!ru(n,r))return;let o=n.getName(),a=o&&yF(o);return a&&yw(a)},yB=e=>{switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return yB(e.typeAnnotation);case"TSArrayType":case"TSTupleType":return yw(yx);case"TSTypeOperator":return"readonly"===e.operator?yB(e.typeAnnotation):void 0;case"TSTypeReference":{if("Identifier"!==e.typeName.type)return;let t=yF(e.typeName.name);return t&&yw(t)}case"TSUnionType":return yj(e.types.map(e=>yB(e)))}},yP=(e,t,r=new Set)=>((e,t,r)=>{if("ArrayExpression"===e.type||te(e,{name:"Array"}))return yw(yx);if(te(e,{names:ra})||te(e,{names:["Map","Set",yb,yE]}))return yw(e.callee.name);if(e7(e,{name:"Array"})||tc(e,{object:"Array",methods:["from","of"],optionalCall:!1,optionalMember:!1}))return yw(yx);if(yI(e,["from","of"]))return yw(e.callee.object.name);switch(e.type){case"Identifier":return((e,t,r)=>{let n=ei(t.sourceCode.getScope(e),e);if(!n||r.has(n)||1!==n.defs.length)return;r.add(n);let[o]=n.defs,a=yB(o.name?.typeAnnotation);return a||("Variable"===o.type&&"const"===o.parent.kind&&o.node.init?yP(o.node.init,t,r):void 0)})(e,t,r);case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":return yB(e.typeAnnotation)??yP(e.expression,t,r);case"TSNonNullExpression":case"ParenthesizedExpression":return yP(e.expression,t,r)}})(e,t,r)??((e,t)=>{let{parserServices:r}=t.sourceCode;if(r?.program)try{let{program:t}=r;return yk(r.getTypeAtLocation(e),t.getTypeChecker(),t)}catch{}})(e,t),y$="prefer-number-is-safe-integer/error",yR="prefer-number-is-safe-integer/suggestion",yL="prefer-number-is-safe-integer/integer-check-error",yN="prefer-number-is-safe-integer/integer-check-suggestion",yM=["_","lodash","underscore"],yO=["floor","trunc"],yq=(e,t)=>{let r=ei(t.getScope(e),"Number");return!r||"global"===r.scope.type&&0===r.defs.length},yU=e=>{if("BinaryExpression"===e.type&&"%"===e.operator&&e0(e.right,1))return e.left},y_=(e,t)=>{if(tc(e,{object:"Math",methods:yO,argumentsLength:1,optionalCall:!1,optionalMember:!1,computed:!1})&&t.isGlobalReference(e.callee.object))return e.arguments[0]},{isIdentifierName:yW}=t$,yV="prefer-object-define-properties";function yz(e){if(e?.type!=="ExpressionStatement")return;let{expression:t}=e;if(tc(t,{object:"Object",method:"defineProperty",argumentsLength:3,optionalCall:!1,optionalMember:!1,computed:!1}))return t}let yK="prefer-object-destructuring-defaults",yG="prefer-object-destructuring-defaults/suggestion",yJ=new Set(Object.getOwnPropertyNames(Object.prototype)),yX={considerGetters:!0,considerImplicitTypeConversion:!0},yY=e=>"Property"===e.type&&"init"===e.kind&&!e.computed&&!e.method,yH=(e,t,r)=>tN(r.sourceCode.getScope(e)).some(n=>t.has(n.identifier.name)&&((e,t,r)=>{let[n,o]=r.getRange(e),[a,i]=r.getRange(t);return n>=a&&o<=i})(n.identifier,e,r.sourceCode)),yQ=(e,t,r)=>{let{sourceCode:n}=r,o=n.getText(e.node.value),a=eQ(t.value,r);return e.node.shorthand?`${o} = ${a}`:`${n.getText(e.node.key)}: ${o} = ${a}`},yZ="prefer-single-object-destructuring",y0=(e,t)=>{let r,n;if(!("VariableDeclaration"===t.type&&("const"===(r=t.kind)||"let"===r)&&!t.declare&&1===t.declarations.length))return;let[o]=t.declarations;if("ObjectPattern"===o.id.type&&!o.id.typeAnnotation&&(n=o.id).properties.length>0&&n.properties.every(e=>"Property"===e.type&&!e.computed&&"Identifier"===e.value.type)&&o.init?.type==="Identifier"&&((e,t)=>{let r=ei(e.getScope(t),t);if(!r||1!==r.defs.length)return!1;let[n]=r.defs;return"Variable"===n.type&&"VariableDeclarator"===n.node.type&&"VariableDeclaration"===n.parent.type&&!n.parent.declare&&"const"===n.parent.kind})(e,o.init))return{node:t,declarator:o,source:o.init.name}},y1=(e,t,r)=>{let n,o,a=y0(e,t),i=y0(e,r);if(!(a&&i&&a.node.kind===i.node.kind&&a.source===i.source&&0===e.getCommentsInside(a.node).length&&0===e.getCommentsInside(i.node).length&&(n=a.node,o=i.node,!e.getTokensBetween(n,o,{includeComments:!0}).some(e=>eg(e)))))return;let s=t=>t.properties.map(t=>e.getText(t)).join(", "),l=`${a.node.kind} {${s(a.declarator.id)}, ${s(i.declarator.id)}} = ${a.source};`;return{node:i.node,messageId:yZ,data:{source:a.source},fix:t=>t.replaceTextRange([e.getRange(a.node)[0],e.getRange(i.node)[1]],l)}};function*y2(e,t){for(let[r,n]of t.entries()){if(0===r)continue;let o=y1(e,t[r-1],n);o&&(yield o)}}let y3="prefer-smaller-scope",y8=new Set(["ArrowFunctionExpression","ClassDeclaration","ClassExpression","FunctionDeclaration","FunctionExpression","StaticBlock","WithStatement"]);function y6(e,t){let r=e.parent;for(;r&&r!==t;){if(y8.has(r.type))return!1;r=r.parent}return r===t}function y9(e,t,r){let n="before"===r?e.getTokenBefore(t,{includeComments:!0}):e.getTokenAfter(t,{includeComments:!0});return!!(n&&eg(n))}function y5(e,t){let r=e.getTokenBefore(t),n=e.getTokenAfter(t);return r?.value==="("&&n?.value===")"}let y4="prefer-single-array-predicate/error",y7="prefer-single-array-predicate/suggestion",he=new Map([["||","some"],["&&","every"]]),ht=new Set(["AssignmentExpression","ArrowFunctionExpression","ConditionalExpression","SequenceExpression","TSAsExpression","TSNonNullExpression","TSSatisfiesExpression","TSTypeAssertion","YieldExpression"]),hr="prefer-url-href",hn="non-url",ho="unknown",ha=new Set(["ClassName","ImportBinding","Type"]),hi=new Set(["any","error","unknown"]),hs=new Set(["node:url","url"]),hl=e=>ha.has(e.type),hu=(e,t,r,n)=>{for(;t;){let o=t.set.get(e);if(o?.defs.some(e=>nw(e,r,n)))return o;t=t.upper}},hp=e=>e.every(e=>"url"===e)?"url":!e.includes(ho)&&e.includes(hn)?hn:ho,hc=e=>{let t;if("ImportBinding"!==e.type)return!1;let{node:r,parent:n}=e;return t=n.source,hs.has(t.value)&&"ImportSpecifier"===r.type&&"Identifier"===r.imported.type&&"URL"===r.imported.name},hd=e=>"ImportBinding"===e.type&&("type"===e.parent.importKind||nT(e.node)),hm=e=>"Type"===e.type||hd(e),hf=e=>hc(e)&&!hd(e),hg=(e,t)=>{let r;return"NewExpression"===e.type&&(((e,t)=>{if("Identifier"!==e.type||"URL"!==e.name||((e,t,r,n)=>{for(;t;){let o=t.set.get(e);if(o?.defs.some(e=>!hm(e)&&nw(e,r,n)))return!0;t=t.upper}return!1})("URL",t.sourceCode.getScope(e),e,t))return!1;if(nf(e,t))return!0;let r=ei(t.sourceCode.getScope(e),e);return r?.defs.length>0&&r.defs.every(e=>hm(e))})(r=e.callee,t)||((e,t)=>{if("Identifier"!==e.type)return!1;let r=ei(t.sourceCode.getScope(e),e);return r?.defs.some(e=>hf(e))??!1})(r,t))},hy=(e,t)=>t.sourceCode.getScope(e.name??e.node),hh=(e,t,r,n=new Set)=>{switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return hh(e.typeAnnotation,t,r,n);case"TSTypeReference":return((e,t,r,n)=>{if("Identifier"!==e.typeName.type)return ho;let o=e.typeName.name,a=hu(o,r,e.typeName,t),[i]=a?.defs??[];if(!i)return"URL"!==o||((e,t)=>{for(;t;){let r=t.set.get(e);if(r?.defs.some(e=>hl(e)))return!0;t=t.upper}return!1})(o,r)?ho:"url";if(n.has(o))return ho;if(hc(i))return"url";n.add(o);let s=ho;return"Type"===i.type&&"TSTypeAliasDeclaration"===i.node.type?s=hh(i.node.typeAnnotation,t,hy(i,t),n):"Type"===i.type&&"TSTypeParameter"===i.node.type?s=ho:"ClassName"===i.type&&(s=hn),n.delete(o),s})(e,t,r,n);case"TSUnionType":return hp(e.types.map(e=>hh(e,t,r,n)));case"TSIntersectionType":return hp(e.types.map(e=>hh(e,t,r,n)));case"TSImportType":let o;return(o=e.source,hs.has(o.value)&&e.qualifier?.type==="Identifier"&&"URL"===e.qualifier.name)?"url":hn;default:return e?hn:ho}},hx=(e,t)=>{let{checker:r,context:n,node:o,program:a}=t;if(hi.has(e.intrinsicName)||e.isTypeParameter?.())return ho;let i=r.getBaseConstraintOfType(e);if(i&&i!==e)return hx(i,t);if(e.isUnion()||e.isIntersection())return hp(e.types.map(e=>hx(e,t)));let s=((e,t,r)=>{if(!/^[\w$]+$/.test(e))return ho;let n=hu(e,r.sourceCode.getScope(t),t,r),o=n?.defs.filter(e=>"Type"===e.type||"ClassName"===e.type||hc(e))??[];return 0===o.length?ho:o.every(e=>hc(e))?"url":hn})(r.typeToString(e),o,n);if(s!==ho)return s;let l=rl(e);return ru(l,a)&&"URL"===l.getName()?"url":hn},hb=(e,t)=>{let{parserServices:r}=t.sourceCode;if(!r?.program)return ho;try{let{program:n}=r;return hx(r.getTypeAtLocation(e),{checker:n.getTypeChecker(),context:t,node:e,program:n})}catch{return ho}};function hE(e,t,r=new Set){if(!e)return ho;let n=t.sourceCode.getScope(e);switch(e.type){case"Identifier":{let n=((e,t,r)=>{let n=ei(t.sourceCode.getScope(e),e);if(!n||r.has(n)||1!==n.defs.length)return ho;let[o]=n.defs;if(!nw(o,e,t))return ho;r.add(n);let a="Variable"===o.type&&"const"===o.parent.kind&&o.node.init?hE(o.node.init,t,r):ho,i=hh(o.name?.typeAnnotation,t,hy(o,t)),s=ho;return a!==ho?s=a:i!==ho&&(s=i),r.delete(n),s})(e,t,r);if(n!==ho)return n;break}case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":{let o=hh(e.typeAnnotation,t,n);return o===ho?hE(e.expression,t,r):o}case"TSNonNullExpression":case"ParenthesizedExpression":return hE(e.expression,t,r);case"SequenceExpression":return hE(e.expressions.at(-1),t,r);case"ConditionalExpression":return hp([hE(e.consequent,t,r),hE(e.alternate,t,r)])}if(hg(e,t))return"url";if("NewExpression"===e.type){if(((e,t)=>{if("Identifier"!==e.type)return!1;let r=ei(t.sourceCode.getScope(e),e);return r?.defs.some(e=>!hm(e)&&!hf(e))??!1})(e.callee,t))return hn;let r=hb(e,t);return r===ho?hn:r}let o=((e,t)=>{if("CallExpression"!==e.type||"Identifier"!==e.callee.type)return ho;let r=ei(t.sourceCode.getScope(e.callee),e.callee);if(r?.defs.length!==1)return ho;let[n]=r.defs;return hh(n.node.returnType,t,hy(n,t))})(e,t);return o!==ho?o:hb(e,t)}let hD=(e,t)=>{switch(e.type){case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":case"ParenthesizedExpression":case"TSNonNullExpression":return hD(e.expression,t);case"SequenceExpression":return hD(e.expressions.at(-1),t);case"ConditionalExpression":return hD(e.consequent,t)&&hD(e.alternate,t);case"NewExpression":return hg(e,t);default:return!1}},hS=(e,t)=>0===t.sourceCode.getCommentsInside(e).length,hv="require-proxy-trap-boolean-return",hC=new Set(["defineProperty","deleteProperty","has","isExtensible","preventExtensions","set","setPrototypeOf"]),hA=new Set(["ArrowFunctionExpression","FunctionDeclaration","FunctionExpression"]),hT=new Set([...hA,"DoWhileStatement","ForInStatement","ForOfStatement","ForStatement","SwitchStatement","WhileStatement"]),hw=new Set(["ArrayExpression","ArrowFunctionExpression","ClassExpression","FunctionExpression","NewExpression","ObjectExpression","TemplateLiteral","UpdateExpression"]),hI=new Set(["%","&","*","**","+","-","/","<<",">>",">>>","^","|"]),hF=(e,t)=>({node:e,messageId:hv,data:{name:t}}),hj=e=>{if(e)return hF(e.node,e.data.name)},hk=(e,t,r)=>{if("AssignmentExpression"===e.type)return"="===e.operator?hj(hk(e.right,t,r)):hF(e,t);if("ConditionalExpression"===e.type)return hk(e.consequent,t,r)??hk(e.alternate,t,r);if("LogicalExpression"===e.type)return hj(hk(e.left,t,r)??hk(e.right,t,r));if("SequenceExpression"===e.type)return hj(hk(e.expressions.at(-1),t,r));let n=((e,t)=>{let r=ew(e,t.getScope(e));if(null!==r&&"boolean"!=typeof r.value)return!!r.value})(e,r);if(void 0===n&&!(hw.has(e.type)||"UnaryExpression"===e.type&&"!"!==e.operator&&"delete"!==e.operator||"BinaryExpression"===e.type&&hI.has(e.operator)))return;let o=((e,t,r)=>{if(!(r.getCommentsInside(e).length>0)&&("Literal"===e.type&&!e.regex||"TemplateLiteral"===e.type&&0===e.expressions.length||"Identifier"===e.type&&"undefined"===e.name))return String(t)})(e,n,r);return{...hF(e,t),...o&&{fix:t=>t.replaceText(e,o)}}},hB=(e,t)=>{if("Property"!==e.type||"init"!==e.kind)return;let r=eF(e,t.getScope(e));if(hC.has(r)&&hA.has(e.value.type))return{name:r,functionNode:e.value}};function hP(e){return e.body.some(e=>"FunctionDeclaration"!==e.type&&function e(t){var r,n;switch(t.type){case"ReturnStatement":case"ThrowStatement":return!0;case"BlockStatement":return hP(t);case"IfStatement":return!!(t.alternate&&e(t.consequent)&&e(t.alternate));case"LabeledStatement":return e(t.body);case"SwitchStatement":return!(r=t).cases.every(e=>null!==e.test)&&r.cases.every((t,n)=>(function(t,r){for(let n of t.cases.slice(r))for(let t of n.consequent){if(function e(t){if(!t||"string"!=typeof t.type)return!1;if("BreakStatement"===t.type)return!0;if(hT.has(t.type))return!1;for(let[r,n]of Object.entries(t))if("parent"!==r){if(Array.isArray(n)){if(n.some(t=>e(t)))return!0;continue}if(e(n))return!0}return!1}(t))return!1;if(e(t))return!0}return!1})(r,n));case"TryStatement":return!!((n=t).finalizer&&hP(n.finalizer))||hP(n.block)&&(!n.handler||hP(n.handler.body));default:return!1}}(e))}let h$=({functionNode:e,name:t},r)=>{if(e.async||e.generator)return hF(e,t);if("BlockStatement"!==e.body.type)return hk(e.body,t,r);let n=[...function* e(t){if(t&&"string"==typeof t.type){if("ReturnStatement"===t.type)return void(yield t);if(!("BlockStatement"!==t.type&&hA.has(t.type))){for(let[r,n]of Object.entries(t))if("parent"!==r){if(Array.isArray(n)){for(let t of n)yield*e(t);continue}yield*e(n)}}}}(e.body)],o=hP(e.body);if(0===n.length){if(o)return;return hF(e,t)}for(let e of n){if(!e.argument)return hF(e,t);let n=hk(e.argument,t,r);if(n)return n}if(!o)return hF(e,t)},hR=f.builtinRules.get("logical-assignment-operators"),hL="convertIf",hN=e=>e.fix??e.suggest?.[0]?.fix;function hM(e){let t={...e};return delete t.fix,delete t.suggest,t}let hO={create:e=>{let{sourceCode:t}=e,r=Object.create(e,{report:{value(r){e.report(function(e,t){if("if"!==e.messageId||e.data?.operator!=="||="||"function"!=typeof hN(e))return e;if(t.getCommentsInside(e.node).length>0)return hM(e);let r=hN(e);return{...hM(e),suggest:[{messageId:hL,data:{operator:"||="},fix:r},{messageId:hL,data:{operator:"??="},fix:e=>r(new Proxy(e,{get(e,t){if("insertTextBefore"!==t){let r=Reflect.get(e,t,e);return"function"==typeof r?r.bind(e):r}return(t,r)=>e.insertTextBefore(t,"||"===r?"??":r)}}))}]}}(r,t))}}});for(let[t,n]of Object.entries(hR.create(r)))e.on(t,n)},meta:{type:hR.meta.type,docs:{description:hR.meta.docs.description,recommended:!0},fixable:hR.meta.fixable,hasSuggestions:hR.meta.hasSuggestions,schema:hR.meta.schema,defaultOptions:[hR.meta.defaultOptions[0]],messages:hR.meta.messages,languages:["js/js"]}},hq="no-useless-coercion",hU=new Map([["Boolean",{type:"boolean",isType:r5}],["String",{type:"string",isType:na}],["BigInt",{type:"bigint",isType:function(e,t){return!!e&&(!!("TSSatisfiesExpression"===e.type&&r7(e.typeAnnotation)||ne(e,t))||"bigint"==typeof ew(e,t.sourceCode.getScope(e))?.value)}}],["Number",{type:"number",isType:(e,t)=>rX(e,t.sourceCode.getScope(e))}]]),h_="no-useless-boolean-cast",hW=["every","filter","find","findIndex","findLast","findLastIndex","some"],hV="no-useless-continue",hz="no-useless-override",hK=e=>e.isUnion()?e.types.every(e=>hK(e)):"void"===e.intrinsicName||"undefined"===e.intrinsicName,hG=(e,t)=>{let{parserServices:r}=t.sourceCode;if(r?.program)try{return{type:r.getTypeAtLocation(e),checker:r.program.getTypeChecker()}}catch{}},hJ="prefer-has-check",hX=new Set(["Map","ReadonlyMap","WeakMap"]),hY=new Set(["Map","WeakMap"]),hH=new Set(["FormData","Headers","URLSearchParams"]),hQ=new Set(["Array","ReadonlyArray"]),hZ=new Set([...hY,...hH]),h0=new Set(["ClassName","ImportBinding","TSEnumName","Type"]),h1=new Set(["any","bigint","boolean","false","number","string","unknown","undefined","null","void"]),h2=new Set(["TSTypeAnnotation","TSParenthesizedType"]),h3=new Set(["TSAnyKeyword","TSNeverKeyword","TSUndefinedKeyword","TSUnknownKeyword","TSVoidKeyword"]),h8=new Set(["TSBigIntKeyword","TSBooleanKeyword","TSNumberKeyword","TSStringKeyword"]),h6=new Set(["TSArrayType","TSConstructorType","TSFunctionType","TSObjectKeyword","TSSymbolKeyword","TSTupleType"]),h9=new Set(["ArrayExpression","ArrowFunctionExpression","ClassExpression","FunctionExpression","NewExpression","ObjectExpression"]),h5=new Set(["ParenthesizedExpression","TSAsExpression","TSSatisfiesExpression","TSTypeAssertion","TSNonNullExpression"]),h4=e=>{for(;h5.has(e.type);)e=e.expression;return e},h7=e=>{if("Identifier"===e.type)return e.name;if("TSQualifiedName"===e.type){let t=h7(e.left);return t?`${t}.${e.right.name}`:void 0}},xe=e=>e.typeArguments?.params??e.typeParameters?.params??[],xt=(e,t)=>{for(;t;){let r=t.set.get(e)?.defs.find(e=>h0.has(e.type));if(r)return r;t=t.upper}},xr=e=>{if(e?.type==="Type"&&"TSTypeAliasDeclaration"===e.node.type&&0===xe(e.node).length)return e.node.typeAnnotation},xn=(e,t)=>{if(t.sourceCode.isGlobalReference(e))return!0;let r=ei(t.sourceCode.getScope(e),e);return!r||0===r.defs.length},xo=(e,t)=>th(e)&&xn(e,t)||"UnaryExpression"===e.type&&"void"===e.operator&&"Literal"===e.argument.type&&0===e.argument.value,xa=(e,t)=>hX.has(e)?{kind:"map",typeName:e,valueType:t}:hH.has(e)?{kind:"null-sentinel",typeName:e}:void 0,xi=(e,t,r=new Set)=>{switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return xi(e.typeAnnotation,t,r);case"TSTypeOperator":return"readonly"===e.operator?xi(e.typeAnnotation,t,r):void 0;case"TSTypeReference":{let n=h7(e.typeName);if(!n)return;if((hX.has(n)||hH.has(n))&&!xt(n,t))return xa(n,xe(e).at(-1));let o=((e,t,r)=>{if(!r.has(e))return r.add(e),xr(xt(e,t))})(n,t,r);return o?xi(o,t,r):void 0}}},xs=(e,t)=>{let r=t.sourceCode.getScope(e);return xi(e.typeAnnotation,r)},xl=(e,t,r=new Set)=>{let n=xs(e,t);if(n)return n;if(te(e=h4(e))&&"Identifier"===e.callee.type&&hZ.has(e.callee.name)&&xn(e.callee,t))return xa(e.callee.name);if("Identifier"!==e.type)return;let o=ei(t.sourceCode.getScope(e),e);if(!o||r.has(o)||1!==o.defs.length)return;r.add(o);let[a]=o.defs,i=xi(a.name?.typeAnnotation,t.sourceCode.getScope(a.name));return i||("Variable"===a.type&&"const"===a.parent.kind&&a.node.id===a.name&&a.node.init?xl(a.node.init,t,r):void 0)},xu=(e,t)=>{for(let r of[e,e.target]){if(!r)continue;let e=rl(r);if(ru(e,t))return e.getName()}},xp=(e,t,r)=>{if(ri.has(e.intrinsicName)||rs.has(e.intrinsicName))return;if(e.isUnion()){let n=e.types.map(e=>xp(e,t,r));if(1===new Set(n.map(e=>e?.typeName)).size){let[e]=n;if(e?.kind!=="map")return e;let r=n.map(e=>e?.valueType);return{...e,valueType:r.every(Boolean)?t.getUnionType(r):void 0}}if(n.every(e=>e?.kind==="map")){let e=n.map(e=>e.valueType);return{kind:"map",typeName:"Map",valueType:e.every(Boolean)?t.getUnionType(e):void 0}}return n.every(e=>e?.kind==="null-sentinel")?{kind:"null-sentinel",typeName:"null-sentinel"}:void 0}if(e.isIntersection())return e.types.map(e=>xp(e,t,r)).find(e=>e?.kind==="map");let n=xu(e,r);return xa(n,hX.has(n)?t.getTypeArguments(e).at(-1):void 0)},xc=(e,t)=>{let{parserServices:r}=t.sourceCode;if(r?.program)try{let{program:t}=r;return xp(r.getTypeAtLocation(e),t.getTypeChecker(),t)}catch{}},xd=(e,t)=>xc(e,t)??xl(e,t),xm=(e,t)=>"truthy"===t?!!e:"not-undefined"===t?void 0!==e:null!=e,xf=(e,t,r,n=new Set)=>{if(!e||h3.has(e.type))return!1;if(h2.has(e.type))return xf(e.typeAnnotation,t,r,n);if("TSTypeOperator"===e.type)return"readonly"===e.operator&&xf(e.typeAnnotation,t,r,n);if("TSUnionType"===e.type||"TSIntersectionType"===e.type)return e.types.every(e=>xf(e,t,r,n));if("TSNullKeyword"===e.type)return"not-undefined"===r;if(h8.has(e.type))return"truthy"!==r;if(h6.has(e.type))return!0;if("TSTypeLiteral"===e.type)return"truthy"!==r;if("TSLiteralType"===e.type){var o;let t="Literal"===(o=e.literal).type?o.value:"TemplateLiteral"===o.type&&0===o.expressions.length?o.quasis[0].value.cooked:"UnaryExpression"===o.type&&("-"===o.operator||"+"===o.operator)&&"Literal"===o.argument.type&&("number"==typeof o.argument.value||"bigint"==typeof o.argument.value)?"-"===o.operator?-o.argument.value:o.argument.value:void 0;return void 0!==t&&xm(t,r)}return"TSTypeReference"===e.type&&((e,t,r,n)=>{let o,a,i=h7(e.typeName);if(!i||n.has(i))return!1;n.add(i);let s=(a=xr(o=xt(i,t.sourceCode.getScope(e.typeName))))?{type:"alias",node:a}:o?.type==="ClassName"||o?.type==="Type"&&"TSInterfaceDeclaration"===o.node.type?{type:"object"}:void 0,l=!1;return s?.type==="alias"?l=xf(s.node,t,r,n):s?.type==="object"&&(l="truthy"!==r),n.delete(i),l})(e,t,r,n)},xg=(e,t)=>e.isTypeParameter?.()?e.getConstraint()??t.getBaseConstraintOfType(e):e,xy=(e,t,r)=>{if(ri.has(e.intrinsicName))return!1;let n=xg(e,t);return n&&n!==e?xy(n,t,r):!e.isTypeParameter?.()&&(e.isUnion()||e.isIntersection()?e.types.every(e=>xy(e,t,r)):!r.has(e.intrinsicName))},xh=(e,t,r)=>{if(ri.has(e.intrinsicName)||rs.has(e.intrinsicName))return!1;let n=xg(e,t);if(n&&n!==e)return xh(n,t,r);if(e.isUnion()||e.isIntersection())return e.types.every(e=>xh(e,t,r));if(h1.has(e.intrinsicName))return!1;if("true"===e.intrinsicName||"symbol"===e.intrinsicName)return!0;if(e.isStringLiteral?.())return e.value.length>0;if(e.isNumberLiteral?.())return 0!==e.value;if(e.isBigIntLiteral?.())return e.value.negative||"0"!==e.value.base10Value;let o=t.typeToString(e);return/^-?\d+n$/u.test(o)?!/^-?0n$/u.test(o):"object"===t.typeToString(e)||hQ.has(xu(e,r))||e.getCallSignatures().length>0||e.getConstructSignatures().length>0},xx=(e,t,r)=>{if(!te(e)||"Identifier"!==e.callee.type||!hY.has(e.callee.name)||!xn(e.callee,t))return;if(0===e.arguments.length)return!0;if(1!==e.arguments.length)return;let[n]=e.arguments;if("ArrayExpression"===n.type)return n.elements.every(e=>{var n;let o;return e?.type==="ArrayExpression"&&e.elements.length>=2&&e.elements[1]&&"SpreadElement"!==e.elements[1].type&&(n=e.elements[1],(o=ew(n,t.sourceCode.getScope(n)))?xm(o.value,r):!th(n)&&h9.has(n.type))})},xb=(e,t,r)=>{let n=xx(h4(e),t,r);if(void 0!==n)return n;let o=xc(e,t)?.valueType;if(o){let{program:e}=t.sourceCode.parserServices,n=e.getTypeChecker();if("truthy"===r?xh(o,n,e):"not-undefined"===r?xy(o,n,new Set(["undefined","void"])):xy(o,n,new Set(["undefined","void","null"])))return!0}return function e(t,r,n,o={}){let a,i=o.visitedVariables??new Set,s=o.checkConstructorValues??!0,l=xs(t,r);if(l?.kind==="map")return!!l.valueType&&xf(l.valueType,r,n);let u=((e,t,r,n)=>{if(!te(e)||"Identifier"!==e.callee.type||!hY.has(e.callee.name)||!xn(e.callee,t))return;if(n){let n=xx(e,t,r);if(void 0!==n)return n}let o=xe(e).at(-1);return!!o&&xf(o,t,r)})(t=h4(t),r,n,s);if(void 0!==u)return u;let p=((e,t,r)=>{if("Identifier"!==e.type)return;let n=ei(t.sourceCode.getScope(e),e);if(!(!n||r.has(n))&&1===n.defs.length)return n})(t,r,i);if(!p)return!1;i.add(p);let[c]=p.defs,d=(a=xi(c.name?.typeAnnotation,r.sourceCode.getScope(c.name)),a?.kind==="map"?!!a.valueType&&xf(a.valueType,r,n):"Variable"===c.type&&"const"===c.parent.kind&&c.node.id===c.name&&!!c.node.init&&e(c.node.init,r,n,{visitedVariables:i,checkConstructorValues:!1}));return i.delete(p),d}(e,t,r)},xE=e=>"Literal"===e.type&&null===e.value,xD={configs:{node:{name:"@eslint-sukka/eslint-plugin-sukka-full node preset",plugins:{get sukka(){return xD}},rules:{"sukka/unicorn/prefer-node-protocol":"error","sukka/unicorn/prefer-import-meta-properties":"error","no-process-exit":"off","sukka/unicorn/no-process-exit":"warn","no-buffer-constructor":"off","sukka/unicorn/no-new-buffer":"error"}},comment:{name:"@eslint-sukka/eslint-plugin-sukka-full comments preset",plugins:{get sukka(){return xD}},rules:{"sukka/ban-eslint-disable":["error","allow-with-description"]}},recommended:{...u.eslint_plugin_sukka.configs.recommended,plugins:{get sukka(){return xD}}},recommended_extra_with_typed_lint:{...u.eslint_plugin_sukka.configs.recommended_extra_with_typed_lint,plugins:{get sukka(){return xD}}},recommended_react:{...u.eslint_plugin_sukka.configs.recommended_react,plugins:{get sukka(){return xD}}}},rules:Object.assign(u.eslint_plugin_sukka.rules,{"array/no-unneeded-flat-map":A,"browser/prefer-location-assign":w,"jsx/no-template-literal":F,"jsx/no-unneeded-nested":j,"string/no-locale-case":B,"string/no-simple-template-literal":P,"unicode/no-bidi":q,"unicode/no-invisible":_,"no-redundant-variable":W,"no-single-return":z,"prefer-early-return":G,"prefer-fetch":J,"prefer-timer-id":H,"string/no-unneeded-to-string":Q,"type/no-force-cast-via-top-type":Z,"type/no-wrapper-type-reference":et,"no-default-error":er},Object.fromEntries(Object.entries({"unicorn/catch-error-name":pc,"unicorn/custom-error-definition":{create:e=>{e.on("ClassDeclaration",t=>pP(e,t)),e.on("AssignmentExpression",t=>{if("ClassExpression"===t.right.type)return pP(e,t.right)}),e.on("AssignmentExpression",e=>{if("MemberExpression"===e.left.type&&"Identifier"===e.left.object.type&&"exports"===e.left.object.name){let t=e.right;if("ClassExpression"!==t.type||!pD(t)||!t.id)return;let r=t.id.name;return e.left.property.name!==r?{node:e.left.property,messageId:pd,fix:t=>t.replaceText(e.left.property,r)}:void 0}})},meta:{type:"problem",docs:{description:"Enforce correct `Error` subclassing.",recommended:!1},fixable:"code",messages:{[pd]:"Exported error name should match error class",[pm]:"Do not pass the error message to `super()` when the class defines a `message` accessor.",[pf]:"Do not assign to `this.message` when the class defines a `message` getter without a setter.",[pg]:"Error constructors should accept `options` as the second parameter.",[py]:"Error constructors should use `options` as the second parameter.",[ph]:"Pass the error message to `super()` as the first argument.",[px]:"Pass `options` to `super()` as the second argument."},languages:["js/js"]}},"unicorn/no-nested-ternary":{create:e=>{e.on("ConditionalExpression",t=>{if([t.test,t.consequent,t.alternate].some(e=>"ConditionalExpression"===e.type))return;let{sourceCode:r}=e,n=r.getAncestors(t).toReversed(),o=n.findIndex(e=>"ConditionalExpression"!==e.type);return 1!==o||eZ(t,e)?o>1?{node:o>2?n[o-3]:t,messageId:nY}:void 0:{node:t,messageId:nH,fix:e=>[e.insertTextBefore(t,"("),e.insertTextAfter(t,")")]}})},meta:{type:"suggestion",docs:{description:"Disallow nested ternary expressions.",recommended:!0},fixable:"code",messages:{[nY]:"Do not nest ternary expressions.",[nH]:"Nested ternary expression should be parenthesized."},languages:["js/js"]}},"unicorn/prefer-event-target":{create:e=>{e.on("Identifier",t=>{if("EventEmitter"!==t.name||("ClassDeclaration"!==t.parent.type&&"ClassExpression"!==t.parent.type||t.parent.superClass!==t)&&("NewExpression"!==t.parent.type||t.parent.callee!==t))return;let r=e.sourceCode.getScope(t);if(!function(e){if(!e)return!1;let t=function(e,t){let r=e=>e.type===t;for(;e.parent;e=e.parent)if(r(e))return e}(e,"ImportDeclaration");return!!(nZ.has(t?.source.value)||"Property"===e.parent.type&&e.parent.value===e&&"Identifier"===e.parent.key.type&&"EventEmitter"===e.parent.key.name&&"ObjectPattern"===e.parent.parent.type&&e.parent.parent.properties.includes(e.parent)&&n0(e.parent.parent)&&n1(e.parent.parent.parent.init)||n0(e)&&tp(e.parent.init,{property:"EventEmitter",optional:!1,computed:!1})&&n1(e.parent.init.object))}(ei(r,t)?.defs[0]?.name))return{node:t,messageId:nQ}})},meta:{type:"suggestion",docs:{description:"Prefer `EventTarget` over `EventEmitter`.",recommended:"unopinionated"},messages:{[nQ]:"Prefer `EventTarget` over `EventEmitter`."},languages:["js/js"]}},"unicorn/prefer-keyboard-event-key":{create:e=>{e.on("Identifier",t=>{if(n6.has(t.name)){for(let r of oe(e,t))if(r.references?.some(e=>n7(t,e.identifier)))return ot(t,r)}}),e.on("Property",t=>{let r;if("Identifier"===t.key.type&&n6.has(t.key.name)&&"Property"===(r=t.key).parent.type&&r.parent.key===r&&"ObjectPattern"===r.parent.parent.type&&!r.parent.computed){for(let r of oe(e,t))if(on(t.key,r))return ot(t.key,r);for(let r of oe(e,t))if(or(t.key,r))return ot(t.key,r)}})},meta:{type:"suggestion",docs:{description:"Prefer `KeyboardEvent#key` over deprecated keyboard event properties.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[n3]:"Use `.key` instead of `.{{name}}`.",[n8]:"Use `.key` with `{{key}}`."},languages:["js/js"]}},"unicorn/prefer-text-content":{create:e=>{e.on("MemberExpression",t=>{if(!tp(t,{property:"innerText"})||rM(t.object,e))return;let r=t.property;return{node:r,messageId:oo,suggest:[{messageId:oa,fix:e=>e.replaceText(r,"textContent")}]}}),e.on("Identifier",t=>{if("innerText"===t.name&&"Property"===t.parent.type&&t.parent.key===t&&!t.parent.computed&&"init"===t.parent.kind&&"ObjectPattern"===t.parent.parent.type&&t.parent.parent.properties.includes(t.parent)&&!((e,t)=>{if(rM(e,t))return!0;let{parent:r}=e;return"VariableDeclarator"===r.type?r.id===e&&r.init&&rM(r.init,t):"AssignmentExpression"===r.type&&r.left===e&&rM(r.right,t)})(t.parent.parent,e))return{node:t,messageId:oo,suggest:[{messageId:oa,fix:e=>e.replaceText(t,t.parent.shorthand?"textContent: innerText":"textContent")}]}})},meta:{type:"suggestion",docs:{description:"Prefer `.textContent` over `.innerText`.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[oo]:"Prefer `.textContent` over `.innerText`.",[oa]:"Switch to `.textContent`."},languages:["js/js"]}},"unicorn/require-array-join-separator":{create:e=>{e.on("CallExpression",t=>{if(!(tc(t,{method:"join",argumentsLength:0,optionalCall:!1})||tc(t,{method:"call",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&tx(t.callee.object,{property:"join"}))||0===t.arguments.length&&rP(t.callee.object,e))return;let{sourceCode:r}=e,[n,o]=r.getLastTokens(t,2),a=1===t.arguments.length;return{loc:{start:r.getLoc(n)[a?"end":"start"],end:r.getLoc(o).end},messageId:oC,fix:r=>os(r,t,"','",e)}})},meta:{type:"suggestion",docs:{description:"Enforce using the separator argument with `Array#join()`.",recommended:"unopinionated"},fixable:"code",messages:{[oC]:"Missing the separator argument."},languages:["js/js"]}},"unicorn/no-thenable":{create:e=>{for(let{selector:t,selectors:r,messageId:n,getNodes:o}of oj)e.on(t??r,function*(t){for(let r of o(t,e))yield{node:r,messageId:n}})},meta:{type:"problem",docs:{description:"Disallow `then` property.",recommended:"unopinionated"},messages:{[oA]:"Do not add `then` to an object.",[oT]:"Do not export `then`.",[ow]:"Do not add `then` to a class."},languages:["js/js"]}},"unicorn/no-invalid-remove-event-listener":{create:e=>{e.on("CallExpression",t=>{if(!(tc(t,{method:"removeEventListener",minimumArguments:2,optionalCall:!1})&&"SpreadElement"!==t.arguments[0].type&&("FunctionExpression"===t.arguments[1].type||"ArrowFunctionExpression"===t.arguments[1].type||tc(t.arguments[1],{method:"bind",optionalCall:!1,optionalMember:!1}))))return;let[,r]=t.arguments;return["ArrowFunctionExpression","FunctionExpression"].includes(r.type)?{node:r,loc:eh(r,e.sourceCode),messageId:ok}:{node:r.callee.property,messageId:ok}})},meta:{type:"problem",docs:{description:"Prevent calling `EventTarget#removeEventListener()` with the result of an expression.",recommended:"unopinionated"},messages:{[ok]:"The listener argument should be a function reference."},languages:["js/js"]}},"unicorn/consistent-function-scoping":oO,"unicorn/no-new-buffer":{create:e=>{let{sourceCode:t}=e;e.on("NewExpression",r=>{if(!te(r,{name:"Buffer"}))return;let n=((e,t)=>{if(1!==e.length)return"from";let[r]=e;if("SpreadElement"===r.type)return;if("ArrayExpression"===r.type||"TemplateLiteral"===r.type)return"from";if(rX(r,t))return"alloc";let n=ew(r,t);if(n){let{value:e}=n;if("string"==typeof e||Array.isArray(e))return"from"}})(r.arguments,t.getScope(r));return n?{node:r,messageId:oq,data:{method:n},fix:oW(r,e,n)}:{node:r,messageId:oU,suggest:["from","alloc"].map(t=>({messageId:o_,data:{replacement:t},fix:oW(r,e,t)}))}})},meta:{type:"problem",docs:{description:"Enforce the use of `Buffer.from()` and `Buffer.alloc()` instead of the deprecated `new Buffer()`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[oq]:"`new Buffer()` is deprecated, use `Buffer.{{method}}()` instead.",[oU]:"`new Buffer()` is deprecated, use `Buffer.alloc()` or `Buffer.from()` instead.",[o_]:"Switch to `Buffer.{{replacement}}()`."},languages:["js/js"]}},"unicorn/no-console-spaces":{create:e=>{let{sourceCode:t}=e,r=(r,n,o)=>{let[a,i]=t.getRange(r),s="leading"===o?a+1:i-2,l=[s,s+1];return{loc:nV(l,e),messageId:oV,data:{method:n,position:o},fix:e=>e.removeRange(l)}};e.on("CallExpression",function*(e){if(!tc(e,{object:"console",methods:["log","debug","info","warn","error"],minimumArguments:1,optionalCall:!1,optionalMember:!1}))return;let n=e.callee.property.name,{arguments:o}=e,{length:a}=o;for(let[e,i]of o.entries()){if(!e1(i)&&"TemplateLiteral"!==i.type)continue;let o=t.getText(i).slice(1,-1);0!==e&&oz(o)&&(yield r(i,n,"leading")),e!==a-1&&oK(o)&&(yield r(i,n,"trailing"))}})},meta:{type:"suggestion",docs:{description:"Do not use leading/trailing space between `console.log` parameters.",recommended:"unopinionated"},fixable:"code",messages:{[oV]:"Do not use {{position}} space between `console.{{method}}` parameters."},languages:["js/js"]}},"unicorn/no-empty-file":oJ,"unicorn/no-useless-fallback-in-spread":oH,"unicorn/no-useless-length-check":{create:e=>{let t=[],r=new Set,n=new Set,o=new Set,a=new Set;e.on("BinaryExpression",e=>{if(!("BinaryExpression"===e.type&&"Literal"===e.right.type&&"0"===e.right.raw&&tp(e.left,{property:"length",optional:!1})&&tb(e.parent)))return;let{operator:t}=e;"==="===t?r.add(e):(">"===t||"!=="===t)&&n.add(e)}),e.on("CallExpression",t=>{tc(t,{optionalCall:!1,optionalMember:!1,computed:!1})&&"Identifier"===t.callee.property.type&&!rk(t.callee.object,e)&&("some"===t.callee.property.name?o.add(t):"every"===t.callee.property.name&&a.add(t))}),e.on("LogicalExpression",e=>{tb(e)&&t.push(e)}),e.on("Program:exit",function*(){let i=new Set(t.flatMap(e=>(function(e){let{operator:t}=e;return(function e(t){return[t.left,t.right].flatMap(r=>"LogicalExpression"===r.type&&r.operator===t.operator?e(r):[r])})(e).filter((e,i,s)=>(function({node:e,operator:t,siblings:i}){return"||"===t&&r.has(e)&&i.some(t=>a.has(t)&&tH(e.left.object,t.callee.object))||"&&"===t&&n.has(e)&&i.some(t=>o.has(t)&&tH(e.left.object,t.callee.object))})({node:e,operator:t,siblings:[s[i-1],s[i+1]].filter(Boolean)}))})(e))),{sourceCode:s}=e;for(let t of i)yield{loc:{start:s.getLoc(t.left.property).start,end:s.getLoc(t).end},messageId:r.has(t)?"zero":"non-zero",fix(r){let{left:n,right:o}=t.parent,a=eH(n,e),i=eH(o,e),s=[];return n===t?(s[0]=a[0],s[1]=i[0]):(s[0]=a[1],s[1]=i[1]),r.removeRange(s)}}})},meta:{type:"suggestion",docs:{description:"Disallow useless array length check.",recommended:"unopinionated"},fixable:"code",messages:{"non-zero":"The non-empty check is useless as `Array#some()` returns `false` for an empty array.",zero:"The empty check is useless as `Array#every()` returns `true` for an empty array."},languages:["js/js"]}},"unicorn/no-useless-promise-resolve-reject":{create:e=>{e.on("CallExpression",t=>{if(!(tc(t,{object:"Promise",methods:["resolve","reject"],optionalCall:!1,optionalMember:!1})&&("ArrowFunctionExpression"===t.parent.type&&t.parent.body===t||"ReturnStatement"===t.parent.type&&t.parent.argument===t||"YieldExpression"===t.parent.type&&!t.parent.delegate&&t.parent.argument===t)))return;let{functionNode:r,isInTryStatement:n}=function(e){let t,r=!1;for(;e;e=e.parent){if(tl(e)){t=e;break}"TryStatement"===e.type&&(r=!0)}return{functionNode:t,isInTryStatement:r}}(t);if(r&&(r.async||function(e){if("CallExpression"===e.parent.type&&"MemberExpression"===e.parent.callee.type&&!e.parent.callee.computed&&"Identifier"===e.parent.callee.property.type){let{callee:{property:t},arguments:r}=e.parent;if(1===r.length&&["then","catch","finally"].includes(t.name)&&r[0]===e||2===r.length&&"then"===t.name&&(r[0]===e||"SpreadElement"!==r[0].type&&r[1]===e))return!0}return!1}(r)))return function(e,t){let{callee:r,parent:n}=e,o=r.property.name;return{node:r,messageId:o,data:{type:"YieldExpression"===n.type?"yield":"return"},fix:t}}(t,function(e,t,r){if(e.arguments.length>1)return;let{callee:n,parent:o,arguments:a}=e,[i]=a;if(i?.type==="SpreadElement")return;let s="reject"===n.property.name,l="YieldExpression"===o.type;if(!s||!t&&(!l||"ExpressionStatement"===o.parent.type))return function(t){let n="ArrowFunctionExpression"===o.type,a=i?r.sourceCode.getText(i):"";if(i?.type==="SequenceExpression"&&(a=`(${a})`),s){if(a||="undefined",a=`throw ${a}`,l)return t.replaceTextRange(eH(o,r),a);if(a+=";",n)return a=`{ ${a} }`,t.replaceTextRange(eH(e,r),a)}else l?a=`yield${a?" ":""}${a}`:"ReturnStatement"===o.type?a=`return${a?" ":""}${a};`:(i?.type==="ObjectExpression"&&(a=`(${a})`),a||="{}");return t.replaceText(n?e:o,a)}}(t,n,e))})},meta:{type:"suggestion",docs:{description:"Disallow returning/yielding `Promise.resolve/reject()` in async functions or promise callbacks",recommended:"unopinionated"},fixable:"code",messages:{resolve:"Prefer `{{type}} value` over `{{type}} Promise.resolve(value)`.",reject:"Prefer `throw error` over `{{type}} Promise.reject(error)`."},languages:["js/js"]}},"unicorn/no-zero-fractions":{create:e=>{e.on("Literal",t=>{if(!e8(t))return;let{raw:r}=t,n=r.match(/^(?<before>[\d_]*)(?<dotAndFractions>\.[\d_]*)(?<after>.*)$/);if(!n)return;let{before:o,dotAndFractions:a,after:i}=n.groups,s=(o+a.replaceAll(/[.0_]+$/g,"")||"0")+i;if(s===r)return;let l="."===a,{sourceCode:u}=e,p=u.getRange(t)[0]+o.length+a.length;return{loc:nV([p-(r.length-s.length),p],e),messageId:l?oZ:oQ,*fix(r){let n=s;"MemberExpression"===t.parent.type&&t.parent.object===t&&nN.test(s)&&!eZ(t,e)&&(n=`(${n})`,nS(u.getTokenBefore(t),e,n)&&(n=`;${n}`)),yield r.replaceText(t,n),yield of(r,t,e)}}})},meta:{type:"suggestion",docs:{description:"Disallow number literals with zero fractions or dangling dots.",recommended:"unopinionated"},fixable:"code",messages:{[oQ]:"Don't use a zero fraction in the number.",[oZ]:"Don't use a dangling dot in the number."},languages:["js/js"]}},"unicorn/prefer-export-from":o4,"unicorn/prefer-native-coercion-functions":{create:e=>{e.on(ts,t=>{if(t.async||t.generator||t.returnType?.type==="TSTypeAnnotation"&&"TSTypePredicate"===t.returnType.typeAnnotation.type||0===t.params.length||"Identifier"!==t.params[0].type||("MethodDefinition"===t.parent.type&&("constructor"===t.parent.kind||"set"===t.parent.kind)||"Property"===t.parent.type&&"set"===t.parent.kind)&&t.parent.value===t)return;let r=function(e){if(("ArrowFunctionExpression"===e.type&&"Identifier"===e.body.type&&e.body.name===e.params[0].name||"BlockStatement"===e.body.type&&1===e.body.body.length&&"ReturnStatement"===e.body.body[0].type&&e.body.body[0].argument?.type==="Identifier"&&e.body.body[0].argument.name===e.params[0].name)&&"CallExpression"===e.parent.type&&!e.parent.optional&&e.parent.arguments[0]===e&&"MemberExpression"===e.parent.callee.type&&!e.parent.callee.computed&&!e.parent.callee.optional&&"Identifier"===e.parent.callee.property.type&&at.has(e.parent.callee.property.name))return{replacementFunction:"Boolean",fix:t=>t.replaceText(e,"Boolean")}}(t)||function(e){let t,r=(t=e.params[0].name,"ArrowFunctionExpression"===e.type&&ar(e.body,t)?e.body:"BlockStatement"===e.body.type&&1===e.body.body.length&&"ReturnStatement"===e.body.body[0].type&&ar(e.body.body[0].argument,t)?e.body.body[0].argument:void 0);if(!r)return;let{name:n}=r.callee,o={replacementFunction:n};return"FunctionDeclaration"===e.type||1!==r.arguments.length||(o.fix=t=>{let r=n;return"Property"===e.parent.type&&e.parent.method&&e.parent.value===e?r=`: ${r}`:"MethodDefinition"===e.parent.type&&(r=` = ${r};`),t.replaceText(e,r)}),o}(t);if(!r)return;let{sourceCode:n}=e,{replacementFunction:o,fix:a}=r;return r={node:t,loc:eh(t,n),messageId:o7,data:{functionNameWithKind:ej(t,n),replacementFunction:o}},!a||1!==t.params.length||n.getCommentsInside(t).length>0||(r.fix=a),r})},meta:{type:"suggestion",docs:{description:"Prefer using `String`, `Number`, `BigInt`, `Boolean`, and `Symbol` directly.",recommended:"unopinionated"},fixable:"code",messages:{[o7]:"{{functionNameWithKind}} is equivalent to `{{replacementFunction}}`. Use `{{replacementFunction}}` directly."},languages:["js/js"]}},"unicorn/no-document-cookie":{create(e){ai.listen({context:e})},meta:{type:"problem",docs:{description:"Do not use `document.cookie` directly.",recommended:"unopinionated"},messages:{[aa]:"Do not use `document.cookie` directly."},languages:["js/js"]}},"unicorn/prefer-add-event-listener":ap,"unicorn/prefer-array-index-of":ah,"unicorn/prefer-blob-reading-methods":{create:e=>{e.on("CallExpression",e=>{if(!tc(e,{methods:["readAsText","readAsArrayBuffer"],argumentsLength:1,optionalCall:!1,optionalMember:!1}))return;let t=e.callee.property,r=t.name;return{node:t,messageId:ax,data:{method:r,replacement:"readAsArrayBuffer"===r?"arrayBuffer":"text"}}})},meta:{type:"suggestion",docs:{description:"Prefer `Blob#arrayBuffer()` over `FileReader#readAsArrayBuffer(…)` and `Blob#text()` over `FileReader#readAsText(…)`.",recommended:"unopinionated"},messages:{[ax]:"Prefer `Blob#{{replacement}}()` over `FileReader#{{method}}(blob)`."},languages:["js/js"]}},"unicorn/prefer-date-now":{create:e=>{e.on("CallExpression",e=>{if(tc(e,{methods:["getTime","valueOf"],argumentsLength:0,optionalCall:!1,optionalMember:!1})&&aS(e.callee.object)){let t=e.callee.property;return av(e,{node:t,messageId:aE,data:{method:t.name}})}if(e7(e,{names:["Number","BigInt"],argumentsLength:1,optional:!1})&&aS(e.arguments[0])){let{name:t}=e.callee;return"Number"===t?av(e,{messageId:aD}):av(e.arguments[0])}}),e.on("UnaryExpression",t=>{if(("+"===t.operator||"-"===t.operator)&&aS(t.argument))return av("-"===t.operator?t.argument:t,{},e)}),e.on("AssignmentExpression",e=>{if(("-="===e.operator||"*="===e.operator||"/="===e.operator||"%="===e.operator||"**="===e.operator)&&aS(e.right))return av(e.right)}),e.on("BinaryExpression",function*(e){if("-"===e.operator||"*"===e.operator||"/"===e.operator||"%"===e.operator||"**"===e.operator)for(let t of[e.left,e.right])aS(t)&&(yield av(t))})},meta:{type:"suggestion",docs:{description:"Prefer `Date.now()` to get the number of milliseconds since the Unix Epoch.",recommended:"unopinionated"},fixable:"code",messages:{[ab]:"Prefer `Date.now()` over `new Date()`.",[aE]:"Prefer `Date.now()` over `Date#{{method}}()`.",[aD]:"Prefer `Date.now()` over `Number(new Date())`."},languages:["js/js"]}},"unicorn/dom-node-dataset":a$,"unicorn/prefer-modern-math-apis":{create:e=>{let t=[];e.on("CallExpression",t=>{if(!tc(t,{object:"Math",method:"sqrt",argumentsLength:1,optionalCall:!1,optionalMember:!1}))return;let r=aU(t.arguments[0]);if(r.some(e=>!("BinaryExpression"===e.type&&("*"===e.operator&&tH(e.left,e.right)||"**"===e.operator&&e0(e.right,2)))))return;let n=1===r.length?"abs":"hypot",o=new Set(1===r.length?[]:r.map(e=>e.parent));return{node:t.callee.property,messageId:aR,data:{replacement:`Math.${n}(…)`,description:"Math.sqrt(…)"},*fix(a){let{sourceCode:i}=e;for(let r of(yield a.replaceText(t.callee.property,n),o)){let t=i.getTokenAfter(r.left,e=>"Punctuator"===e.type&&"+"===e.value);yield ov(t,",",a,e),yield oi(r,a,e)}for(let t of r)yield a.removeRange([eH(t.left,e)[1],i.getRange(t)[1]])}}}),e.on("BinaryExpression",e=>{t.push(e)}),e.on("Program:exit",function*(){for(let r of t)for(let t of aq){let n=t(r,e);n&&(yield n)}})},meta:{type:"suggestion",docs:{description:"Prefer modern `Math` APIs over legacy patterns.",recommended:"unopinionated"},fixable:"code",messages:{[aR]:"Prefer `{{replacement}}` over `{{description}}`."},languages:["js/js"]}},"unicorn/number-literal-case":aV,"unicorn/prefer-number-properties":aY,"unicorn/prefer-reflect-apply":{create:e=>{e.on("CallExpression",t=>{if(!tc(t,{optionalCall:!1,optionalMember:!1})||"Literal"===t.callee.object.type||"ArrayExpression"===t.callee.object.type||"ObjectExpression"===t.callee.object.type)return;let{sourceCode:r}=e,n=((e,t)=>{if("apply"===eF(e.callee)&&2===e.arguments.length&&aQ(e.arguments[0],e.arguments[1]))return r=>r.replaceText(e,aZ(t,e.callee.object,e.arguments[0],e.arguments[1]))})(t,r)||((e,t)=>{if("call"===eF(e.callee)&&"apply"===eF(e.callee.object)&&"prototype"===eF(e.callee.object.object)&&e.callee.object.object.object?.type==="Identifier"&&"Function"===e.callee.object.object.object.name&&3===e.arguments.length&&aQ(e.arguments[1],e.arguments[2]))return r=>r.replaceText(e,aZ(t,e.arguments[0],e.arguments[1],e.arguments[2]))})(t,r);if(n)return{node:t,messageId:aH,fix:n}})},meta:{type:"suggestion",docs:{description:"Prefer `Reflect.apply()` over `Function#apply()`.",recommended:"unopinionated"},fixable:"code",messages:{[aH]:"Prefer `Reflect.apply()` over `Function#apply()`."},languages:["js/js"]}},"unicorn/prefer-set-size":{create:e=>{e.on("MemberExpression",t=>{var r;if(!tp(t,{property:"length",optional:!1}))return;let n="ArrayExpression"===(r=t.object).type&&1===r.elements.length&&r.elements[0]?.type==="SpreadElement"?r.elements[0].argument:tc(r,{object:"Array",method:"from",argumentsLength:1,optionalCall:!1,optionalMember:!1})?r.arguments[0]:void 0;if(n&&r$(n,e))return{node:t.property,messageId:a0,fix:function(e,t,r){let{sourceCode:n}=e,{object:o,property:a}=t;if(!(n.getCommentsInside(o).length>n.getCommentsInside(r).length))return function*(i){yield i.replaceText(a,"size"),yield i.replaceText(o,n.getText(r)),"ArrayExpression"===o.type&&(yield of(i,t,e))}}(e,t,n)}})},meta:{type:"suggestion",docs:{description:"Prefer using `Set#size` instead of `Array#length`.",recommended:"unopinionated"},fixable:"code",messages:{[a0]:"Prefer using `Set#size` instead of `Array#length`."},languages:["js/js"]}},"unicorn/prefer-string-replace-all":{create:e=>{e.on("CallExpression",t=>{let r=((e,t)=>{let r;if(!tc(e,{method:"join",argumentsLength:1,optionalCall:!1,optionalMember:!1})||!tc(e.callee.object,{method:"split",argumentsLength:1,optionalCall:!1,optionalMember:!1})||t.sourceCode.getCommentsInside(e).length>0)return;let n=e.callee.object;if(no(n.callee.object,t))return;let[o]=n.arguments,[a]=e.arguments,i=e3(o);if("string"==typeof i){if(0===i.length)return;r=tF(i)}else if(!(r=(e=>{if(!e6(e)||e.regex.flags.includes("y"))return;let t=ir(e);if(!t||ii(t)||0===ia(t))return;let{pattern:r,flags:n}=e.regex;return`/${r}/${n.includes("g")?n:`g${n}`}`})(o)))return;let s=e3(a);if("string"==typeof s)return`${eQ(n.callee.object,t)}.replaceAll(${r}, ${tF(s.replaceAll("$","$$$$"))})`})(t,e);if(r)return{node:t.callee.property,messageId:a6,fix:e=>e.replaceText(t,r)};if(!tc(t,{methods:["replace","replaceAll"],argumentsLength:2,optionalCall:!1}))return;let{arguments:n,callee:{property:o}}=t;if(no(t.callee.object,e))return;let[a]=n;if(!((e,t)=>{if(e6(e))return e.regex.flags.includes("g");if(te(e,{name:"RegExp"})&&e.arguments[0]?.type!=="SpreadElement"&&e.arguments[1]?.type==="Literal"&&"string"==typeof e.arguments[1].value)return e.arguments[1].value.includes("g");let r=ew(e,t);if(!r)return!1;let{value:n}=r;return"[object RegExp]"===Object.prototype.toString.call(n)&&n.global})(a,e.sourceCode.getScope(a)))return;let i=o.name,s=function(e){if(!e6(e))return;let t=ir(e);if(!t)return;let{flags:r}=e.regex;if(!function(e){if(!e.includes("g"))return!1;for(let t of e)if(a9.has(t))return!1;return!0}(r))return;let n="alternative"===t.type?it(t.body):ie(t);if(n)return"'"+n+"'"}(a);if("replaceAll"===i){if(!s)return;return{node:a,messageId:a8,data:{replacement:s.length<20?s:"a string literal"},fix:e=>e.replaceText(a,s)}}return{node:o,messageId:a3,*fix(e){yield e.insertTextAfter(o,"All"),s&&(yield e.replaceText(a,s))}}})},meta:{type:"suggestion",docs:{description:"Prefer `String#replaceAll()` over regex searches with the global flag and `String#split().join()`.",recommended:"unopinionated"},fixable:"code",messages:{[a3]:"Prefer `String#replaceAll()` over `String#replace()`.",[a8]:"This pattern can be replaced with {{replacement}}.",[a6]:"Prefer `String#replaceAll()` over `String#split().join()`."},languages:["js/js"]}},"unicorn/prefer-string-slice":{create:e=>{e.on("CallExpression",t=>{if(!tc(t,{methods:["substr","substring"]})||no(t.callee.object,e))return;let r=t.callee.property.name;if(!("substring"===r&&(e=>{if(!tc(e,{method:"substring",argumentsLength:2}))return;let[t,r]=e.arguments;if(is(t)&&is(r)&&1===Math.abs(t.value-r.value))return t.value<r.value?t:r;let n=(e=>{if("BinaryExpression"===e.type&&"-"===e.operator&&e0(e.right,1))return e.left})(t);return il(r,t)??(il(t,r)?r:void 0)??(n&&tH(n,r)?t:void 0)})(t)))return{node:t,messageId:r,*fix(n,{abort:o}){if(yield n.replaceText(t.callee.property,"slice"),0!==t.arguments.length){if(t.arguments.length>2||t.arguments.some(e=>"SpreadElement"===e.type))return o();yield("substr"===r?function*({node:e,fixer:t,context:r,abort:n}){let o=e.arguments,[a,i]=o;if(!i)return;let{sourceCode:s}=r,l=ew(a,s.getScope(e)),u=eH(i,r);if(l?.value===0){let n=((e,t,r)=>{let n,o,{sourceCode:a}=r;if(!("BinaryExpression"!==e.type||"-"!==e.operator||!(e8(n=e.right)&&Number.isSafeInteger(n.value)&&n.value>0)||!ip(e.left)||!("Identifier"===t.type||e1(t))||!tH(e.left.object,t)||(o=((e,t)=>{let[r,n]=eH(e,t),o=t.sourceCode.getTokenByRangeStart(r),a=t.sourceCode.getTokenBefore(o);return[t.sourceCode.getRange(a)[1],n]})(e,r),a.getAllComments().some(e=>{let t=a.getRange(e);return t[0]>=o[0]&&t[1]<=o[1]}))))return`-${e.right.raw}`})(i,e.callee.object,r);if(n)return void(yield ou(t,i,n,r));if(e8(i)||ip(i))return;let o=iu(i);return"number"==typeof o?void(yield ou(t,i,String(Math.max(0,o)),r)):(yield t.insertTextBeforeRange(u,"Math.max(0, "),void(yield t.insertTextAfterRange(u,")")))}if(o.every(e=>e8(e))){let e;return void(yield(e=String(a.value+i.value),ou(t,i,e,r)))}return n()}:function*({node:e,fixer:t,context:r,abort:n}){let[o,a]=e.arguments,i=o?iu(o):void 0;if(!a){if(ip(o))return;if(void 0!==i)return void(yield ou(t,o,String(Math.max(0,i)),r));let e=eH(o,r);return yield t.insertTextBeforeRange(e,"Math.max(0, "),void(yield t.insertTextAfterRange(e,")"))}let s=iu(a);if(void 0!==i&&void 0!==s){let e=[Math.max(0,i),Math.max(0,s)];i>s&&e.reverse(),e[0]!==i&&(yield ou(t,o,String(e[0]),r)),e[1]!==s&&(yield ou(t,a,String(e[1]),r));return}if(0===i||0===s){let e=eQ(o,r),n=eQ(a,r);yield ou(t,o,"0",r),yield ou(t,a,`Math.max(0, ${0===i?n:e})`,r);return}return n()})({node:t,fixer:n,context:e,abort:o})}}}})},meta:{type:"suggestion",docs:{description:"Prefer `String#slice()` over `String#substr()` and `String#substring()`.",recommended:"unopinionated"},fixable:"code",messages:{substr:"Prefer `String#slice()` over `String#substr()`.",substring:"Prefer `String#slice()` over `String#substring()`."},languages:["js/js"]}},"unicorn/prefer-string-trim-start-end":{create:e=>{e.on("CallExpression",t=>{if(!tc(t,{methods:["trimLeft","trimRight"],argumentsLength:0,optionalCall:!1})||no(t.callee.object,e))return;let r=t.callee.property,n=r.name,o="trimLeft"===n?"trimStart":"trimEnd";return{node:r,messageId:ic,data:{method:n,replacement:o},fix:e=>e.replaceText(r,o)}})},meta:{type:"suggestion",docs:{description:"Prefer `String#trimStart()` / `String#trimEnd()` over `String#trimLeft()` / `String#trimRight()`.",recommended:"unopinionated"},fixable:"code",messages:{[ic]:"Prefer `String#{{replacement}}()` over `String#{{method}}()`."},languages:["js/js"]}},"unicorn/no-unreadable-iife":{create:e=>{e.on("CallExpression",t=>{if("ArrowFunctionExpression"!==t.callee.type||"BlockStatement"===t.callee.body.type||!eZ(t.callee.body,e))return;let{body:r}=t.callee,n={node:t,loc:nV(eH(r,e),e),messageId:id};return!function(e,t){let{sourceCode:r}=t,[n,o]=eH(e,t),[a,i]=r.getRange(e);return r.getCommentsInside(e.parent).some(e=>{let[t,s]=r.getRange(e);return t>=n&&s<=o&&(t<a||s>i)})}(r,e)&&(n.suggest=[{messageId:im,fix:t=>t.replaceTextRange(eH(r,e),`{ return ${e.sourceCode.getText(r)}; }`)}]),n})},meta:{type:"suggestion",docs:{description:"Disallow unreadable IIFEs.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[id]:"IIFE with parenthesized arrow function body is considered unreadable.",[im]:"Use a block statement body."},languages:["js/js"]}},"unicorn/throw-new-error":{create:e=>{e.on("CallExpression",t=>{if("Decorator"===t.parent.type)return;let{callee:r}=t;if(("Identifier"===r.type&&iy.test(r.name)||"MemberExpression"===r.type&&!r.computed&&"Identifier"===r.property.type&&iy.test(r.property.name))&&!tp(r,{object:"Data",property:"TaggedError",computed:!1}))return{node:t,messageId:ig,fix:r=>og(t,e,r)}})},meta:{type:"suggestion",docs:{description:"Require `new` when creating an error.",recommended:"unopinionated"},fixable:"code",messages:{[ig]:"Use `new` when creating an error."},languages:["js/js"]}},"unicorn/escape-case":{create:e=>{let t="lowercase"===e.options[0];e.on("Literal",e=>{if(e1(e))return iD({node:e,original:e.raw,lowercase:t})}),e.on("Literal",e=>{if(e6(e))return iD({node:e,original:e.raw,regex:iE,lowercase:t})}),e.on("TemplateElement",r=>{if(!ty(r.parent))return iD({node:r,original:r.value.raw,lowercase:t,fix:(t,n)=>oS(r,n,e,t)})})},meta:{type:"suggestion",docs:{description:"Require escape sequences to use uppercase or lowercase values.",recommended:"unopinionated"},fixable:"code",schema:[{enum:["uppercase","lowercase"],description:"The case style for escape sequences."}],defaultOptions:["uppercase"],messages:{[ih]:"Use uppercase characters for the value of the escape sequence.",[ix]:"Use lowercase characters for the value of the escape sequence."},languages:["js/js"]}},"unicorn/prefer-unicode-code-point-escapes":{create:e=>{e.on("Literal",e=>e1(e)?iL(e,e.raw):e6(e)?function(e){let t,{raw:r}=e,{pattern:n,flags:o}=(t=r.lastIndexOf("/"),{pattern:r.slice(1,t),flags:r.slice(t+1)}),{fixed:a,hasReplacement:i}=iR(n,{isRegex:!0,supportsNestedCharacterClasses:o.includes("v")}),s=o.includes("u")||o.includes("v"),l=function(e){for(let t=0;t<e.length;t++)if(void 0!==function(e,t){var r;if(!e.startsWith(iC,t))return;let n=t+iC.length;for(;r=e[n],iA.test(r);)n++;if(n===t+iC.length||"}"!==e[n])return;let o=Number.parseInt(e.slice(t+iC.length,n),16);if(!(o>1114111))return o}(e,t)&&iF(e,t))return!0;return!1}(n);if(!i&&(s||!l))return;let u=`/${i?a:n}/${iN(o)}`;return s?{node:e,messageId:iS,fix:t=>t.replaceText(e,u)}:!function(e,t){try{return new RegExp(e,t),!0}catch{return!1}}(i?a:n,iN(o))?{node:e,messageId:iS}:{node:e,messageId:iS,suggest:[{messageId:iv,fix:t=>t.replaceText(e,u)}]}}(e):void 0),e.on("TemplateElement",t=>{if(!ty(t.parent))return iL(t,t.value.raw,(r,n)=>oS(t,n,e,r))})},meta:{type:"suggestion",docs:{description:"Prefer Unicode code point escapes over legacy escape sequences.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[iS]:"Prefer Unicode code point escapes.",[iv]:"Use Unicode code point escapes and add the `u` flag."},languages:["js/js"]}},"unicorn/prefer-prototype-methods":{create:function(e){let{sourceCode:t}=e,r=[];e.on("CallExpression",e=>{r.push(e)}),e.onExit("Program",function*(n){let o=new WeakMap;for(let{node:e,path:r}of new ez(t.getScope(n)).iterateGlobalReferences(Object.fromEntries(iM.map(e=>[e,{[ez.READ]:!0}]))))o.set(e,r);for(let t of r)yield function(e,{context:t,globalReferences:r}){let n;tc(e,{object:"Reflect",method:"apply",minimumArguments:1,optionalCall:!1,optionalMember:!1})?n=e.arguments[0]:tc(e,{methods:["apply","bind","call"],optionalCall:!1,optionalMember:!1})&&(n=e.callee.object);let{isGlobalReference:o,constructorName:a,methodName:i}=function(e,{context:t,globalReferences:r}){if(!e)return;if(r.has(e))return{isGlobalReference:!0,constructorName:"Object",methodName:r.get(e).at(-1)};if(!tp(e,{optional:!1}))return;let n=e.object;if(to(n)||ta(n))return{constructorName:"ArrayExpression"===n.type?"Array":"Object",methodName:eF(e,t.sourceCode.getScope(e))}}(n,{context:t,globalReferences:r})??{};if(a)return{node:n,messageId:i?"known-method":"unknown-method",data:{constructorName:a,methodName:i},*fix(r){if(o)return void(yield r.replaceText(n,`${a}.prototype.${i}`));if(tp(n)){let o=n.object;yield r.replaceText(o,`${a}.prototype`),("ArrayExpression"===o.type||"ObjectExpression"===o.type)&&(yield of(r,e,t))}}}}(t,{context:e,globalReferences:o})})},meta:{type:"suggestion",docs:{description:"Prefer borrowing methods from the prototype instead of the instance.",recommended:"unopinionated"},fixable:"code",messages:{"known-method":"Prefer using `{{constructorName}}.prototype.{{methodName}}`.","unknown-method":"Prefer using method from `{{constructorName}}.prototype`."},languages:["js/js"]}},"unicorn/error-message":{create:e=>{e.on(["CallExpression","NewExpression"],t=>{if(!(tt(t,{names:iO,optional:!1})&&e.sourceCode.isGlobalReference(t.callee)))return;let r=t.callee.name,n=iW.has(r)?iW.get(r):0,o=t.arguments;if(o.some((e,t)=>t<=n&&"SpreadElement"===e.type))return;let a=o[n];if(!a)return{node:t,messageId:iq,data:{constructorName:r}};if("ArrayExpression"===a.type||"ObjectExpression"===a.type)return{node:a,messageId:i_};let i=ew(a,e.sourceCode.getScope(a));if(!i)return;let{value:s}=i;return"string"!=typeof s?{node:a,messageId:i_}:""===s?{node:a,messageId:iU}:void 0})},meta:{type:"problem",docs:{description:"Enforce passing a `message` value when creating a built-in error.",recommended:"unopinionated"},messages:{[iq]:"Pass a message to the `{{constructorName}}` constructor.",[iU]:"Error message should not be an empty string.",[i_]:"Error message should be a string."},languages:["js/js"]}},"unicorn/no-instanceof-builtins":iY,"unicorn/prefer-type-error":{create:e=>{e.on("ThrowStatement",e=>{let t;if(!(te(e.argument,{name:"Error"})&&e.parent&&e.parent.body&&1===e.parent.body.length&&e.parent.parent&&"IfStatement"===(t=e.parent.parent).type&&i8(t.test)))return;let r=e.argument.callee;return{node:r,messageId:iH,fix:e=>e.insertTextBefore(r,"Type")}})},meta:{type:"suggestion",docs:{description:"Enforce throwing `TypeError` in type checking conditions.",recommended:"unopinionated"},fixable:"code",messages:{[iH]:"`new Error()` is too unspecific for a type check. Use `new TypeError()` instead."},languages:["js/js"]}},"unicorn/consistent-destructuring":{create:e=>{let{sourceCode:t}=e,r=new Map,n=[],o=[],a=e=>{let r=nA(e.object);if(e.computed||"Identifier"!==e.property.type||!["Identifier","ThisExpression"].includes(r.type))return;let n=t.getScope(e);o.push({propertyName:e.property.name,rootIdentifierName:"Identifier"===r.type?r.name:void 0,rootVariable:"Identifier"===r.type?ei(n,r):void 0,thisScopeBoundary:"ThisExpression"===r.type?i4(r):void 0,start:t.getRange(e)[0],scope:n})},i=e=>{switch(e.type){case"MemberExpression":a(e);break;case"AssignmentPattern":i(e.left);break;case"RestElement":i(e.argument);break;case"ObjectPattern":for(let t of e.properties)i("Property"===t.type?t.value:t.argument);break;case"ArrayPattern":for(let t of e.elements)t&&i(t)}};e.on("AssignmentExpression",e=>{i(e.left)}),e.on(["ForInStatement","ForOfStatement"],e=>{"VariableDeclaration"!==e.left.type&&i(e.left)}),e.on("UpdateExpression",e=>{"MemberExpression"===e.argument.type&&a(e.argument)}),e.on("UnaryExpression",e=>{"delete"===e.operator&&"MemberExpression"===e.argument.type&&a(e.argument)}),e.on("VariableDeclarator",e=>{let n;if(!("ObjectPattern"===e.id.type&&"const"===e.parent.kind&&e.init&&("Identifier"===(n=e.init).type||"ThisExpression"===n.type)))return;let o="Identifier"===e.init.type?e.init:void 0,a={scope:t.getScope(e),object:e.init,rootIdentifierName:o?.name,rootVariable:o&&ei(t.getScope(e),o),thisScopeBoundary:"ThisExpression"===e.init.type?i4(e.init):void 0,objectPattern:e.id},i=t.getText(e.init);r.set(i,[...r.get(i)??[],a])});let s=e=>{let n;if(e.computed||tt(e.parent)&&e.parent.callee===e||rq(e))return;let a=nA(e.object),i=r.get(t.getText(a));if(!i)return;let s=t.getScope(e),l="Identifier"===a.type?a:void 0,u=l&&ei(s,l),p="ThisExpression"===a.type?i4(a):void 0,c=t.getText(e.property);for(let r of i.toReversed())if(st({declaration:r,memberExpressionNode:e,memberScope:s,memberRootIdentifier:l,memberRootVariable:u,memberThisScopeBoundary:p,memberExpressionWrites:o,sourceCode:t})&&(n=se(r.objectPattern.properties.filter(e=>i7(e)&&"Identifier"===e.value.type),c,s,t)))break;if(!n||((e,t)=>{let r=e,{parent:n}=e;for(;n&&!so(n);){if(sn(n,r,e,t))return!0;r=n,n=n.parent}return!1})(e,t))return;if("MemberExpression"===e.parent.type)return{node:e,messageId:i6};let d=t.getText(e),m=n.value.name;return{node:e,messageId:i6,suggest:[{messageId:i9,data:{expression:d,property:m},fix:t=>t.replaceText(e,m)}]}};e.on("MemberExpression",e=>{n.push(e)}),e.onExit("Program",function*(){for(let e of n){let t=s(e);t&&(yield t)}})},meta:{type:"suggestion",docs:{description:"Use destructured variables over properties.",recommended:!1},hasSuggestions:!0,messages:{[i6]:"Use destructured variables over properties.",[i9]:"Replace `{{expression}}` with destructured property `{{property}}`."},languages:["js/js"]}},"unicorn/new-for-builtins":{create:e=>{sl.listen({context:e}),su.listen({context:e})},meta:{type:"suggestion",docs:{description:"Enforce the use of `new` for all builtins, except `String`, `Number`, `Boolean`, `Symbol` and `BigInt`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{enforce:"Use `new {{name}}()` instead of `{{name}}()`.",disallow:"Use `{{name}}()` instead of `new {{name}}()`.",[si]:"Use `String(new Date())` instead of `Date()`.",[ss]:"Switch to `String(new Date())`."},languages:["js/js"]}},"unicorn/prefer-single-call":sg,"unicorn/no-process-exit":{create:e=>{let t;if(0===e.sourceCode.lines[0].indexOf("#!"))return;let r=!1,n=[];e.on("CallExpression",e=>{tm(e)&&sh(e.arguments[0])&&(r=!0)}),e.on("ImportDeclaration",e=>{"Literal"===e.source.type&&sh(e.source)&&(r=!0)}),e.on("CallExpression",e=>{tc(e,{object:"process",methods:["on","once"],minimumArguments:1,optionalCall:!1,optionalMember:!1})&&(t=e)}),e.onExit("CallExpression",e=>{e===t&&(t=void 0)}),e.on("CallExpression",e=>{!t&&tc(e,{object:"process",method:"exit",optionalCall:!1,optionalMember:!1})&&n.push(e)}),e.onExit("Program",function*(){if(!r)for(let e of n)yield{node:e,messageId:sy}})},meta:{type:"suggestion",docs:{description:"Disallow `process.exit()`.",recommended:"unopinionated"},messages:{[sy]:"Only use `process.exit()` in CLI apps. Throw an error instead."},languages:["js/js"]}},"unicorn/no-static-only-class":{create:function(e){e.on(["ClassDeclaration","ClassExpression"],t=>{if(!(t.superClass||t.decorators&&t.decorators.length>0||"ClassBody"!==t.body.type||0===t.body.body.length||t.body.body.some(e=>!function(e){let{private:t,static:r,declare:n,readonly:o,accessibility:a,decorators:i,key:s}=e;return!(!sw(e)&&"MethodDefinition"!==e.type||!r||t||"PrivateIdentifier"===s.type||n||o||void 0!==a||Array.isArray(i)&&i.length>0)}(e))))return{node:t,loc:function(e,t){let{sourceCode:r}=t,{body:n}=e,o=r.getTokenBefore(n),{start:a}=r.getLoc(e),{end:i}=r.getLoc(o);return{start:a,end:i}}(t,e),messageId:sA,fix:function(e,t){let{type:r,id:n,body:o,declare:a,abstract:i,implements:s,parent:l}=e;if(a||i||Array.isArray(s)&&s.length>0||"ClassExpression"===r&&n)return;let u="ClassDeclaration"===e.type&&"ExportDefaultDeclaration"===e.parent.type&&e.parent.declaration===e;if(u&&n)return;let{sourceCode:p}=t;for(let e of o.body)if(sw(e)&&(e.typeAnnotation||e.value&&p.getText(e.value).includes("this")))return;return function*(n){let a=p.getFirstToken(e);if(tT(a,{expected:{type:"Keyword",value:"class"},ruleId:"no-static-only-class"}),u||"ClassExpression"===r)if("ClassExpression"===r&&"ReturnStatement"===l.type&&p.getLoc(o).start.line!==p.getLoc(l).start.line&&p.text.slice(p.getRange(a)[1],p.getRange(o)[0]).trim()){yield n.replaceText(a,"{");let e=p.getFirstToken(o);yield n.remove(e)}else yield n.replaceText(a,""),yield oc(a,t,n);else yield n.replaceText(a,"const"),yield n.insertTextBefore(o,"= "),yield n.insertTextAfter(o,";");for(let e of o.body)yield function*(e,t,r){let{sourceCode:n}=t,o=n.getFirstToken(e);tT(o,{expected:{type:"Keyword",value:"static"},ruleId:"no-static-only-class"}),yield r.remove(o),yield oc(o,t,r);let a=sw(e)?n.getLastToken(e):n.getTokenAfter(e),i=ep(a);if(sw(e)){let{key:t,value:o}=e;if(o){let e=n.getTokenAfter(t,sT);yield r.replaceText(e,":")}else i?yield r.insertTextBefore(a,": undefined"):yield r.insertTextAfter(e,": undefined")}yield i?r.replaceText(a,","):r.insertTextAfter(e,",")}(e,t,n)}}(t,e)}})},meta:{type:"suggestion",docs:{description:"Disallow classes that only have static members.",recommended:"unopinionated"},fixable:"code",messages:{[sA]:"Use an object instead of a class with only static members."},languages:["js/js"]}},"unicorn/no-unreadable-array-destructuring":sj,"unicorn/no-useless-spread":{create:e=>{let{sourceCode:t}=e;e.on(["ArrayExpression","ObjectExpression"],r=>{if(!("SpreadElement"===r.parent.type&&r.parent.argument===r&&("ObjectExpression"===r.type&&"ObjectExpression"===r.parent.parent.type&&r.parent.parent.properties.includes(r.parent)||"ArrayExpression"===r.type&&("ArrayExpression"===r.parent.parent.type&&r.parent.parent.elements.includes(r.parent)||tt(r.parent.parent)&&r.parent.parent.arguments.includes(r.parent)))))return;let n=r.parent,o=t.getFirstToken(n),a=n.parent.type,i={node:o,messageId:sk,data:{argumentType:"ArrayExpression"===r.type?"array":"object",parentDescription:sW[a]}};return"NewExpression"===a&&s_(r)&&te(n.parent,{names:sO,argumentsLength:1,allowSpreadElement:!0})?i:{...i,*fix(i){let s;yield i.remove(o),yield oi(r,i,e);let l=t.getFirstToken(r);yield i.remove(l);let[u,p]=t.getLastTokens(r,2);if(yield i.remove(p),eu(u)&&(yield i.remove(u)),to(r)||ta(r)){let e=t.getTokenAfter(n);eu(e)&&(yield i.remove(e))}if("CallExpression"===a||"NewExpression"===a)for(let[e,n]of(s=t.getFirstToken(r),r.elements.map((e,n,o)=>{if(n===o.length-1){let e=t.getLastToken(r,{skip:1});return eu(e)?e:void 0}let a=t.getTokenAfter(e||s,eu);return s=a,a})).entries())null===r.elements[e]&&(yield i.insertTextBefore(n,"undefined"))}}}),e.on("ObjectExpression",r=>{if(!("ObjectExpression"===r.type&&r.properties.length>0&&r.properties.every(e=>"SpreadElement"===e.type&&"ObjectExpression"!==e.argument.type)))return;let n=r.parent;if(!tc(n,{object:"Object",method:"assign",minimumArguments:2,optionalMember:!1,optionalCall:!1}))return;let o=n.arguments.indexOf(r),a=n.arguments.slice(0,o).some(e=>"SpreadElement"!==e.type);if(o<=0||!a)return;let i={node:t.getFirstToken(r.properties[0]),messageId:sL};return t.getCommentsInside(r).length>0?i:{...i,suggest:[{messageId:sM,fix:t=>t.replaceText(r,r.properties.map(t=>eQ(t.argument,e)).join(", "))}]}}),e.on("NewExpression",e=>{if(te(e,{names:sO,argumentsLength:1,allowSpreadElement:!0})&&"SpreadElement"===e.arguments[0].type&&"ArrayExpression"!==e.arguments[0].argument.type)return{node:e.arguments[0],messageId:sR,data:{constructorName:`new ${e.callee.name}(…)`}}}),e.on("ArrayExpression",t=>{if(!s_(t))return;let{parent:r}=t;if(!("ForOfStatement"===r.type&&r.right===t||"YieldExpression"===r.type&&r.delegate&&r.argument===t||(te(r,{names:sO,argumentsLength:1})||te(r,{names:ra,minimumArguments:1})||tc(r,{object:"Promise",methods:["all","allSettled","any","race"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||tc(r,{objects:["Array",...ra],method:"from",argumentsLength:1,optionalCall:!1,optionalMember:!1})||tc(r,{object:"Object",method:"fromEntries",argumentsLength:1,optionalCall:!1,optionalMember:!1}))&&r.arguments[0]===t))return;let n="",o=sB;switch(r.type){case"ForOfStatement":o=sP;break;case"YieldExpression":o=s$;break;case"NewExpression":n=`new ${r.callee.name}(…)`;break;case"CallExpression":n=`${r.callee.object.name}.${r.callee.property.name}(…)`}return{node:t,messageId:o,data:{parentDescription:n},fix:r=>sV(r,t,e)}}),e.on("ArrayExpression",t=>{if(!s_(t))return;let r=t.elements[0].argument,n=!!tc(r,{methods:sU,optionalCall:!1,optionalMember:!1})&&rj(r.callee.object,e)&&rj(r,e);if(!n&&!(!rk(r,e)&&(tc(r,{methods:sq,optionalCall:!1,optionalMember:!1})?!sz(r,e):tc(r,{method:"concat",optionalCall:!1,optionalMember:!1})?!("Identifier"===r.callee.object.type&&"Iterator"===r.callee.object.name||sz(r,e)):tc(r,{method:"split",optionalCall:!1,optionalMember:!1})||tc(r,{object:"Object",methods:["keys","values"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||"AwaitExpression"===r.type&&tc(r.argument,{object:"Promise",methods:["all","allSettled"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||tc(r,{object:"Array",methods:["from","of"],optionalCall:!1,optionalMember:!1})||te(r,{name:"Array"}))))return;let o={node:t,messageId:sN};return te(r,{name:"Array"})||tc(r,{method:"slice",optionalCall:!1,optionalMember:!1})&&!n?o:Object.assign(o,{fix:r=>sV(r,t,e)})})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary spread.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[sk]:"Spread an {{argumentType}} literal in {{parentDescription}} is unnecessary.",[sB]:"`{{parentDescription}}` accepts an iterable as an argument, it's unnecessary to convert to an array.",[sP]:"`for…of` can iterate over an iterable, it's unnecessary to convert to an array.",[s$]:"`yield*` can delegate to an iterable, it's unnecessary to convert to an array.",[sR]:"`{{constructorName}}` accepts a single iterable argument, spreading is misleading.",[sL]:"`Object.assign(…)` source object with only spread properties is unnecessary.",[sN]:"Unnecessarily cloning an array.",[sM]:"Remove the object literal wrapper."},languages:["js/js"]}},"unicorn/no-useless-switch-case":{create:e=>{let t=t4(e.physicalFilename);e.on("SwitchStatement",function*(r){let{cases:n}=r;if(!(n.length<2)&&null===n.at(-1).test)for(let r=n.length-2;r>=0;r--){let o=n[r];if(!sJ(o))break;t&&sX(o)||(yield{node:o,loc:function(e,t){let{sourceCode:r}=t,n=e.test||r.getFirstToken(e),o=r.getTokenAfter(n,ec);return{start:r.getLoc(e).start,end:r.getLoc(o).end}}(o,e),messageId:sK,suggest:[{messageId:sG,fix:e=>e.remove(o)}]})}})},meta:{type:"suggestion",docs:{description:"Disallow useless case in switch statements.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[sK]:"Useless case in switch statement.",[sG]:"Remove this case."},languages:["js/js"]}},"unicorn/no-useless-undefined":lo,"unicorn/numeric-separators-style":ll,"unicorn/prefer-array-find":lT,"unicorn/prefer-array-flat-map":{create:e=>{e.on("CallExpression",t=>{if(!(tc(t,{method:"flat",optionalCall:!1,optionalMember:!1})&&(0===t.arguments.length||1===t.arguments.length&&"Literal"===t.arguments[0].type&&"1"===t.arguments[0].raw)&&tc(t.callee.object,{method:"map",optionalCall:!1})))return;let r=t.callee.object;if(tg(r.callee.object,lj)||rP(r.callee.object,e))return;let{sourceCode:n}=e,o=r.callee.property,a=t9(e,t,[r])?void 0:function*(r){yield ox(r,t,e),yield r.replaceText(o,"flatMap")};return{node:t,loc:{start:n.getLoc(o).start,end:n.getLoc(t).end},messageId:lw,fix:a}}),e.on("CallExpression",t=>{if(!tc(t,{method:"flatMap",argumentsLength:1,optionalCall:!1,optionalMember:!1,computed:!1})||t.typeArguments||t.typeParameters)return;let r=t.callee.object;if(!tc(r,{method:"filter",argumentsLength:1,optionalCall:!1,optionalMember:!1,computed:!1})||r.typeArguments||r.typeParameters||function e(t){return"ChainExpression"===(t=nA(t)).type||("MemberExpression"===t.type?t.optional||e(t.object):"CallExpression"===t.type&&(t.optional||e(t.callee)))}(r.callee.object)||rk(r.callee.object,e))return;let{sourceCode:n}=e;if(n.getCommentsInside(t).length>0)return;let[o]=r.arguments,[a]=t.arguments;if(!lB(o)||!lB(a))return;let[i]=o.params,[s]=a.params;if(!nm(i,s))return;let l=function(e,t){if(eZ(e,t))return eQ(e,t);let r=t.sourceCode.getText(e);return nM(e,t)?`(${r})`:r}(r.callee.object,e),u=n.getText(i),p=function(e,t){if(eZ(e,t))return eQ(e,t);let r=t.sourceCode.getText(e);return lk.has(e.type)?`(${r})`:r}(o.body,e),c=function(e,t){if(eZ(e,t))return eQ(e,t);let r=t.sourceCode.getText(e);return nL(e)?`(${r})`:r}(a.body,e);return{node:t.callee.property,messageId:lI,suggest:[{messageId:lF,fix:e=>e.replaceText(t,`${l}.flatMap(${u} => ${p} ? ${c} : [])`)}]}})},meta:{type:"suggestion",docs:{description:"Prefer `.flatMap(…)` over `.map(…).flat()` and `.filter(…).flatMap(…)`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[lw]:"Prefer `.flatMap(…)` over `.map(…).flat()`.",[lI]:"Prefer a single `.flatMap(…)` over `.filter(…).flatMap(…)`.",[lF]:"Replace `.filter(…).flatMap(…)` with a single `.flatMap(…)`."},languages:["js/js"]}},"unicorn/prefer-array-flat":l_,"unicorn/prefer-array-some":lK,"unicorn/prefer-code-point":{create:e=>{e.on("CallExpression",e=>{if(tc(e,{method:"charCodeAt",optionalCall:!1}))return lG(e.callee.property,"codePointAt")}),e.on("MemberExpression",e=>{if(tp(e,{object:"String",property:"fromCharCode",optional:!1}))return lG(e.property,"fromCodePoint")})},meta:{type:"suggestion",docs:{description:"Prefer `String#codePointAt(…)` over `String#charCodeAt(…)` and `String.fromCodePoint(…)` over `String.fromCharCode(…)`.",recommended:"unopinionated"},hasSuggestions:!0,messages:{"error/charCodeAt":"Prefer `String#codePointAt()` over `String#charCodeAt()`.","error/fromCharCode":"Prefer `String.fromCodePoint()` over `String.fromCharCode()`.","suggestion/codePointAt":"Use `String#codePointAt()`.","suggestion/fromCodePoint":"Use `String.fromCodePoint()`."},languages:["js/js"]}},"unicorn/prefer-default-parameters":{create:e=>{let{sourceCode:t}=e,r=[],n=(e,n,o,a)=>{let i,s=r.at(-1);if(!s||!n||!o||"Identifier"!==n.type||"LogicalExpression"!==o.type||"||"!==o.operator&&"??"!==o.operator||"Identifier"!==o.left.type||"Literal"!==o.right.type)return;let{name:l}=n,{left:{name:u},right:{raw:p}}=o;if(a&&l!==u)return;let c=ei(t.getScope(e),u);if(!c)return;let{references:d}=c,{params:m}=s,f=m.find(e=>"Identifier"===e.type&&e.name===u);if(((e,t,r)=>{for(let n of t.body.body){if(n===r)break;if(lY(e,n))return!0}return!1})(t,s,e)||a&&d[0].identifier!==n||!a&&d.length>1||(i=m.at(-1),!f||f!==i))return;let g=((e,t)=>{if("ArrowFunctionExpression"!==t.type||t.params.length>1)return!1;let[r]=t.params,n=e.getTokenBefore(r),o=e.getTokenAfter(r);return!o||!n||"("!==n.value||")"!==o.value})(t,s)?`(${l} = ${p})`:`${l} = ${p}`;return{node:e,messageId:lJ,suggest:[{messageId:lX,fix:r=>[r.replaceText(f,g),((e,t,r)=>{let{line:n}=t.getLoc(r).start,{column:o}=t.getLoc(r).end,a=t.getText(r),i=t.lines[n-1];if(i.trim()===a)return e.removeRange([t.getIndexFromLoc({line:n,column:0}),t.getIndexFromLoc({line:n+1,column:0})]);if(" "===i[o]){let[n,o]=t.getRange(r);return e.removeRange([n,o+1])}return e.remove(r)})(r,t,e)]}]}};e.on(ts,e=>{r.push(e)}),e.onExit(ts,()=>{r.pop()}),e.on("AssignmentExpression",e=>{if("ExpressionStatement"===e.parent.type&&e.parent.expression===e)return n(e.parent,e.left,e.right,!0)}),e.on("VariableDeclarator",e=>{if("VariableDeclaration"===e.parent.type&&e.parent.declarations[0]===e)return n(e.parent,e.id,e.init,!1)})},meta:{type:"suggestion",docs:{description:"Prefer default parameters over reassignment.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[lJ]:"Prefer default parameters over reassignment.",[lX]:"Replace reassignment with default parameter."},languages:["js/js"]}},"unicorn/prefer-logical-operator-over-ternary":{create:e=>{let{sourceCode:t}=e;e.on("ConditionalExpression",r=>{let{test:n,consequent:o,alternate:a}=r,i=function(e,t){let{test:r,consequent:n,alternate:o}=e,a=function(e,t){let r=l9(e);if(r?.kind==="nullish")return r;if("LogicalExpression"!==e.type)return;let n=l9(e.left),o=l9(e.right);if(n&&o&&l3(n.reference,o.reference,t)){if("||"===e.operator&&n.isTrueWhenNullish&&o.isTrueWhenNullish&&l5(n,o))return{reference:n.reference,isTrueWhenNullish:!0};if("&&"===e.operator&&!n.isTrueWhenNullish&&!o.isTrueWhenNullish&&l5(n,o))return{reference:n.reference,isTrueWhenNullish:!1}}}(r,t.sourceCode);if(!a||t.sourceCode.getCommentsInside(e).length>0)return;let{reference:i}=a;if(a.isTrueWhenNullish&&l3(i,o,t.sourceCode))return l8({context:t,conditionalExpression:e,left:o,right:n,operators:["??"]});if(!a.isTrueWhenNullish&&l3(i,n,t.sourceCode))return l8({context:t,conditionalExpression:e,left:n,right:o,operators:["??"]});let s=a.isTrueWhenNullish?n:o,l=a.isTrueWhenNullish?o:n;if(!th(s)||!tp(l)||l.optional||!tH(nA(i),nA(l.object))||function(e){let t=e,{parent:r}=t;for(;nC(r)&&r.expression===t;)r=(t=r).parent;return"UnaryExpression"===r.type&&"delete"===r.operator&&r.argument===t||"CallExpression"===r.type&&r.callee===t||"TaggedTemplateExpression"===r.type&&r.tag===t}(e))return;let u=function(e,t){let{sourceCode:r}=t,n=function(e,t){let{sourceCode:r}=t,[,n]=eH(e.object,t);return[n,e.computed?r.getRange(r.getTokenBefore(e.property,e=>"["===e.value))[1]:r.getRange(e.property)[0]]}(e,t);if(function(e,[t,r]){return e.getAllComments().some(n=>{let[o,a]=e.getRange(n);return o>=t&&a<=r})}(r,n))return;let[o,a]=r.getRange(e),[i,s]=n;return r.text.slice(o,i)+(e.computed?"?.[":"?.")+r.text.slice(s,a)}(l,t);if(u)return{node:e,messageId:lQ,suggest:[{messageId:l0,fix(r){let n=u;return nS(t.sourceCode.getTokenBefore(e),t,n)&&(n=`;${n}`),r.replaceText(e,n)}}]}}(r,e);return i||(l3(n,o,t)?l8({context:e,conditionalExpression:r,left:n,right:a}):"UnaryExpression"===n.type&&"!"===n.operator&&n.prefix&&l3(n.argument,a,t)?l8({context:e,conditionalExpression:r,left:n.argument,right:o}):void 0)})},meta:{type:"suggestion",docs:{description:"Prefer using a logical operator over a ternary.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[lH]:"Prefer using a logical operator over a ternary.",[lQ]:"Prefer using optional chaining over a ternary.",[lZ]:"Switch to `{{operator}}` operator.",[l0]:"Switch to optional chaining."},languages:["js/js"]}},"unicorn/prefer-optional-catch-binding":{create:e=>{e.on("CatchClause",t=>{let r=t.param;if(!r)return;let{sourceCode:n}=e;if(n.getDeclaredVariables(r.parent).some(e=>e.references.length>0))return;let{type:o,name:a,parent:i}=r;return{node:r,messageId:"Identifier"===o?l4:l7,data:{name:a},*fix(e){let t=n.getTokenBefore(r);tT(t,{test:ed,expected:"(",ruleId:"prefer-optional-catch-binding"});let o=n.getTokenAfter(r);tT(o,{test:em,expected:")",ruleId:"prefer-optional-catch-binding"}),yield e.remove(t),yield e.remove(r),yield e.remove(o);let[,a]=n.getRange(o),[s]=n.getRange(i.body),l=n.text.slice(a,s),u=l.length-l.trimStart().length;0!==u&&(yield e.removeRange([a,a+u]))}}})},meta:{type:"suggestion",docs:{description:"Prefer omitting the `catch` binding parameter.",recommended:"unopinionated"},fixable:"code",messages:{[l4]:"Remove unused catch binding `{{name}}`.",[l7]:"Remove unused catch binding."},languages:["js/js"]}},"unicorn/prefer-regexp-test":uF,"unicorn/prefer-set-has":uV,"unicorn/prefer-string-raw":{create:e=>{e.on("Literal",t=>{if(!e1(t)||function(e){let{parent:t}=e,{type:r}=t;return tr(t)||["Property","PropertyDefinition","MethodDefinition","AccessorProperty"].includes(r)&&!t.computed&&t.key===e||["TSAbstractPropertyDefinition","TSAbstractMethodDefinition","TSAbstractAccessorProperty","TSPropertySignature"].includes(r)&&t.key===e||["ImportDeclaration","ExportNamedDeclaration","ExportAllDeclaration"].includes(r)&&t.source===e||"ImportAttribute"===r&&(t.key===e||t.value===e)||"ImportSpecifier"===r&&t.imported===e||"ExportSpecifier"===r&&(t.local===e||t.exported===e)||"ExportAllDeclaration"===r&&t.exported===e||"JSXAttribute"===r&&t.value===e||"TSEnumMember"===r&&(t.initializer===e||t.id===e)||"TSModuleDeclaration"===r&&t.id===e||"TSExternalModuleReference"===r&&t.expression===e||"TSLiteralType"===r&&t.literal===e||"TSImportType"===r&&t.source===e}(t)||uz(t))return;let{sourceCode:r}=e,{raw:n}=t;if("\\"===n.at(-2)||!n.includes("\\\\")||n.includes("`")||n.includes("${")||r.getLoc(t).start.line!==r.getLoc(t).end.line)return;let o=uJ(n.slice(1,-1),n.charAt(0));if(o===t.value)return{node:t,messageId:uK,*fix(r){yield of(r,t,e),yield r.replaceText(t,`String.raw\`${o}\``)}}}),e.on("TemplateLiteral",t=>{if(!("TaggedTemplateExpression"===t.parent.type&&t.parent.quasi===t||t.quasis.every(({value:{cooked:e,raw:t}})=>e===t)||t.quasis.some(({value:{cooked:e,raw:t}})=>"\\"===e.at(-1)||uJ(t)!==e)||uz(t)))return{node:t,messageId:uK,*fix(r){for(let n of(yield of(r,t,e),yield r.insertTextBefore(t,"String.raw"),t.quasis)){let{cooked:t,raw:o}=n.value;t!==o&&(yield oS(n,t,e,r))}}}}),e.on("TaggedTemplateExpression",t=>{let{quasi:r,tag:n,parent:o}=t,{sourceCode:a}=e;if(!tp(n,{object:"String",property:"raw",optional:!1})||!a.isGlobalReference(n.object)||r.quasis.some(e=>e.value.raw.includes("\\")))return;let i=a.getText(r),s=r.expressions.length>0||/\r?\n/.test(i)?i:`'${i.slice(1,-1).replaceAll("'",()=>String.raw`\'`)}'`;return{node:n,messageId:uG,*fix(r){let n=a.getTokenBefore(t);nS(n,e,s)&&(yield r.insertTextBefore(t,";")),"ReturnStatement"!==o.type&&"ThrowStatement"!==o.type||nd(n,t.quasi,e)||eZ(t,e)||(yield op(r,o,e)),"YieldExpression"!==o.type||o.delegate||o.argument!==t||nd(n,t.quasi,e)||eZ(t,e)||(yield r.insertTextBefore(t,"("),yield r.insertTextAfter(t,")")),yield r.replaceText(t.quasi,s),yield oi(t.tag,r,e),yield r.remove(t.tag)}}})},meta:{type:"suggestion",docs:{description:"Prefer using the `String.raw` tag to avoid escaping `\\`.",recommended:"unopinionated"},fixable:"code",messages:{[uK]:"`String.raw` should be used to avoid escaping `\\`.",[uG]:"Using `String.raw` is unnecessary as the string does not contain any `\\`."},languages:["js/js"]}},"unicorn/prefer-switch":u1,"unicorn/require-number-to-fixed-digits-argument":{create:e=>{e.on("CallExpression",t=>{if(!tc(t,{method:"toFixed",argumentsLength:0,optionalCall:!1})||"NewExpression"===t.callee.object.type)return;let{sourceCode:r}=e,[n,o]=r.getLastTokens(t,2);return{loc:{start:r.getLoc(n).start,end:r.getLoc(o).end},messageId:u2,fix:r=>os(r,t,"0",e)}})},meta:{type:"suggestion",docs:{description:"Enforce using the digits argument with `Number#toFixed()`.",recommended:"unopinionated"},fixable:"code",messages:{[u2]:"Missing the digits argument."},languages:["js/js"]}},"unicorn/template-indent":{create:e=>{let{sourceCode:t}=e,r={...e.options[0]},n=(e=>{let t=new Set,r=[e.ast];for(;r.length>0;){let n=r.pop();if(n){if("TemplateLiteral"===n.type){let{start:{line:r},end:{line:o}}=e.getLoc(n);for(let e=r+1;e<=o;e++)t.add(e)}for(let t of e.visitorKeys[n.type]??[]){let e=n[t];Array.isArray(e)?r.push(...e):r.push(e)}}}return t})(t);r.comments=r.comments.map(e=>e.toLowerCase());let o=new WeakSet,a=a=>{let i;if("TemplateLiteral"!==a.type||o.has(a))return;o.add(a);let s="__PLACEHOLDER__"+Math.random(),l=a.quasis.map(e=>t.getText(e).slice(1,e.tail?-1:-2)).join(s),u=l.match(/\r?\n/);if(!u)return;let p=u[0],c=t.getLoc(a),d=t.lines[c.start.line-1].match(/^(\s*)\S/),m=d?d[1]:"";i="string"==typeof r.indent?r.indent:"number"==typeof r.indent?" ".repeat(r.indent):((e,t,r,n)=>{if(""===r){let r;return u5(u7(e.lines,t)).indent||u5(u3(r=u7(n.split(/\r?\n/)))).indent||u5(r).indent||" "}return r.startsWith(" ")?" ":" "})(t,n,m,l);let f=u3(l).replaceAll(RegExp(`^${p}|${p}[ ]*$`,"g"),""),g=p+function(e,t=1,r={}){let{indent:n=" ",includeEmptyLines:o=!1}=r;if("string"!=typeof e)throw TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof e}\``);if("number"!=typeof t)throw TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof t}\``);if(t<0)throw RangeError(`Expected \`count\` to be at least 0, got \`${t}\``);if("string"!=typeof n)throw TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof n}\``);return 0===t?e:e.replace(o?/^/gm:/^(?!\s*$)/gm,n.repeat(t))}(f,1,{indent:m+i})+p+m;if(g!==l)return{node:a,messageId:u4,fix:t=>g.split(s).map((r,n)=>oS(a.quasis[n],r,e,t))}};e.on("TemplateLiteral",e=>{if((e=>{if(r.comments.length>0){let n=t.getTokenBefore(e,{includeComments:!0});if(n?.type==="Block"&&r.comments.includes(n.value.trim().toLowerCase()))return!0}return!!(uz(e)||r.tags.length>0&&ty(e,r.tags)||r.functions.length>0&&"CallExpression"===e.parent.type&&e.parent.arguments.includes(e)&&tg(e.parent.callee,r.functions))})(e))return a(e)}),e.on(r.selectors,e=>a(e))},meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation.",recommended:!0},fixable:"code",schema:pe,defaultOptions:[{tags:["outdent","dedent","gql","sql","html","styled"],functions:["dedent","stripIndent"],selectors:[],comments:["HTML","indent"]}],messages:{[u4]:"Templates should be properly indented."},languages:["js/js"]}},"unicorn/no-single-promise-in-promise-methods":{create:e=>{e.on("CallExpression",t=>{if(!(tc(t,{object:"Promise",methods:sD,optionalMember:!1,optionalCall:!1,argumentsLength:1})&&"ArrayExpression"===t.arguments[0].type&&1===t.arguments[0].elements.length&&t.arguments[0].elements[0]&&"SpreadElement"!==t.arguments[0].elements[0].type))return;let r=t.callee.property.name,n={node:t.arguments[0],messageId:sx,data:{method:r}},{sourceCode:o}=e;if("AwaitExpression"===t.parent.type&&t.parent.argument===t&&("all"!==r||ti(t.parent.parent)))return n.fix=r=>r.replaceText(t,sS(t,e)),n;return"all"===r?(n.fix=((e,t)=>{let{sourceCode:r}=t;if(sv(r,e))return;let n=e.parent;if("AwaitExpression"!==n.type||n.argument!==e)return;let o=(e=>{let{parent:t}=e;return"VariableDeclarator"===t.type&&t.init===e&&sC(t.id)?t.id:"AssignmentExpression"===t.type&&t.right===e&&sC(t.left)&&ti(t.parent)?t.left:void 0})(n);if(o){if(sv(r,o))return;return function*(n){yield n.replaceText(o,r.getText(o.elements[0])),yield n.replaceText(e,sS(e,t))}}let a=n.parent;if("MemberExpression"===a.type&&a.computed&&e0(a.property,0)&&a.object===n&&("VariableDeclarator"===a.parent.type&&a.parent.init===a||"AssignmentExpression"===a.parent.type&&a.parent.right===a)&&!sv(r,a))return r=>r.replaceText(a,`await ${sS(e,t)}`)})(t,e),n):(n.suggest=[{messageId:sb,fix:r=>{let[n]=t.arguments[0].elements,o=eQ(n,e);return eZ(n,e)||"Identifier"===n.type||"MemberExpression"===n.type||(o=`(${o})`),nS(e.sourceCode.getTokenBefore(t),e,o)&&(o=`;${o}`),r.replaceText(t,o)}},{messageId:sE,fix:function*(e){let r=t.callee.property;yield e.replaceText(r,"resolve");let[n]=t.arguments,a=o.getFirstToken(n),[i,s]=o.getLastTokens(n,2);yield e.remove(a),yield e.remove(s),eu(i)&&(yield e.remove(i))}}],n)})},meta:{type:"suggestion",docs:{description:"Disallow passing single-element arrays to `Promise` methods.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[sx]:"Wrapping single-element array with `Promise.{{method}}()` is unnecessary.",[sb]:"Use the value directly.",[sE]:"Switch to `Promise.resolve(…)`."},languages:["js/js"]}},"unicorn/no-await-in-promise-methods":{create:e=>{e.on("CallExpression",function*(t){if(tc(t,{object:"Promise",methods:pn,optionalMember:!1,optionalCall:!1,argumentsLength:1})&&"ArrayExpression"===t.arguments[0].type)for(let r of t.arguments[0].elements)r?.type==="AwaitExpression"&&(yield{node:r,messageId:pt,data:{method:t.callee.property.name},suggest:[{messageId:pr,*fix(t){let n=e.sourceCode.getFirstToken(r);yield t.remove(n),yield oc(n,e,t)}}]})})},meta:{type:"suggestion",docs:{description:"Disallow using `await` in `Promise` method parameters.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[pt]:"Promise in `Promise.{{method}}()` should not be awaited.",[pr]:"Remove `await`."},languages:["js/js"]}},"unicorn/no-negation-in-equality-check":{create:e=>{e.on("BinaryExpression",t=>{let{operator:r,left:n}=t;if(!("BinaryExpression"===t.type&&pi.has(t.operator)&&ps(n)&&!ps(n.argument)))return;let{sourceCode:o}=e,a=o.getFirstToken(n),i=`${r.startsWith("!")?"=":"!"}${r.slice(1)}`;return{node:a,messageId:po,suggest:[{messageId:pa,data:{operator:i},*fix(s){yield of(s,t,e);let l=o.getTokenAfter(a),{parent:u}=t;("ReturnStatement"===u.type||"ThrowStatement"===u.type)&&!eZ(t,e)&&(nd(o.getFirstToken(u),l,e)||(yield op(s,u,e))),yield s.remove(a),nS(o.getTokenBefore(a),e,l.value)&&(yield s.insertTextAfter(a,";"));let p=o.getTokenAfter(n,e=>"Punctuator"===e.type&&e.value===r);yield s.replaceText(p,i)}}]}})},meta:{type:"problem",docs:{description:"Disallow negated expression in equality check.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[po]:"Negated expression is not allowed in equality check.",[pa]:"Switch to '{{operator}}' check."},languages:["js/js"]}},"unicorn/no-unnecessary-slice-end":{create(e){pl(e,{methods:["slice"],messageId:pu})},meta:{type:"suggestion",docs:{description:"Disallow using `.length` or `Infinity` as the `end` argument of `{Array,String,TypedArray}#slice()`.",recommended:"unopinionated"},fixable:"code",messages:{[pu]:"Passing `{{description}}` as the `end` argument is unnecessary."},languages:["js/js"]}},"unicorn/no-lonely-if":{create:e=>{e.on("IfStatement",t=>{if(pR(t)&&("BlockStatement"===t.parent.type&&1===t.parent.body.length&&t.parent.body[0]===t&&pR(t.parent.parent)&&t.parent.parent.consequent===t.parent||pR(t.parent)&&t.parent.consequent===t))return{node:t,messageId:p$,fix:function(e,t){let{sourceCode:r}=t;return n=>{var o,a;let i=("BlockStatement"===e.parent.type?e.parent:e).parent,s={...i,...pL(i,r)},l={...e,...pL(e,r)},u=pq(s,r),p=pU(s,t,r),c=pO(pM(pq(l,r)),pU(l,t,r)),d=function(e,t,r,n){let o=[...n.getRange(e)];if("BlockStatement"===t.type)return o;let a=n.getLastToken(t);if(ey(a)){let t=n.getTokenAfter(e);t&&nS(a,r,t.value)&&(o[1]=n.getRange(t)[0])}return o}(i,l.consequent,t,r),m={outerConditionGap:s.openingBraceToken?pM(pN(s.closingParenthesisToken,s.openingBraceToken,r)):"",outerLeadingContent:s.openingBraceToken?pM(pN(s.openingBraceToken,l.ifToken,r)):pM(pN(s.closingParenthesisToken,l.ifToken,r)),outerTrailingContent:s.openingBraceToken?pM(pN(l,s.closingBraceToken,r)):""},f=(o=m.outerConditionGap,a=m.outerLeadingContent,o.trimStart().startsWith("//")?{leadingStatementText:pM(a).trimStart(),conditionSuffixText:o}:{leadingStatementText:pM(pO(o,a)).trimStart(),conditionSuffixText:""}),{leadingStatementText:g}=f,y=function({outerIfStatement:e,inner:t,replacementRange:r,sourceCode:n,consequentTextPieces:o,outerConditionGapTextPieces:a}){let{outerTrailingContent:i}=o,{conditionSuffixText:s}=a;if("BlockStatement"===t.consequent.type){let e=pN(t.closingParenthesisToken,t.openingBraceToken,n),r=pN(t.openingBraceToken,t.closingBraceToken,n);return`${s}${e}{${r}${i}}`}let l=pN(t.closingParenthesisToken,t.consequent,n),u=`${s}${l}${((e,t)=>{let[r,n]=t.getRange(e);return t.text.slice(r,n)})(t.consequent,n)}${i}`;return`${u}${((e,t,r)=>{let[,n]=r.getRange(e);if(t[1]===n)return"";let o=r.text.slice(n,t[1]);return""===o.trim()?o.includes("\n")?`;${o}`:";":`;${o}`})(e,r,n)}`}({outerIfStatement:i,inner:l,replacementRange:d,sourceCode:r,consequentTextPieces:m,outerConditionGapTextPieces:f});return n.replaceTextRange(d,`${g}if${u}(${p} && ${c})${y}`)}}(t,e)}})},meta:{type:"suggestion",docs:{description:"Disallow `if` statements as the only statement in `if` blocks without `else`.",recommended:"unopinionated"},fixable:"code",messages:{[p$]:"Unexpected `if` as the only statement in a `if` block without `else`."},languages:["js/js"]}},"unicorn/no-magic-array-flat-depth":{create:e=>{e.on("CallExpression",t=>{if(!tc(t,{method:"flat",argumentsLength:1,optionalCall:!1}))return;let[r]=t.arguments;if(!e8(r)||1===r.value)return;let{sourceCode:n}=e,{openingParenthesisToken:o,closingParenthesisToken:a}=tG(t,e);if(!n.commentsExistBetween(o,a))return{node:r,messageId:p_}})},meta:{type:"suggestion",docs:{description:"Disallow a magic number as the `depth` argument in `Array#flat(…).`",recommended:"unopinionated"},messages:{[p_]:"Magic number as depth is not allowed."},languages:["js/js"]}},"unicorn/no-negated-condition":{create:e=>{e.on(["IfStatement","ConditionalExpression"],t=>{if("IfStatement"===t.type&&(!t.alternate||"IfStatement"===t.alternate.type))return;let{test:r}=t;if("UnaryExpression"===r.type&&"!"===r.operator||"BinaryExpression"===r.type&&("!="===r.operator||"!=="===r.operator))return{node:r,messageId:pW,*fix(n){if(yield function*(e,t,r){let{sourceCode:n}=r,{test:o}=t;if("UnaryExpression"===o.type){let a=n.getFirstToken(o);"IfStatement"===t.type&&(yield oi(o.argument,e,r)),yield e.remove(a);return}let a=n.getTokenAfter(o.left,e=>"Punctuator"===e.type&&e.value===o.operator);yield e.replaceText(a,"="+a.value.slice(1))}(n,t,e),yield function*(e,t,r){let n="IfStatement"===t.type,[o,a]=[t.consequent,t.alternate].map(e=>{let t=eH(e,r),o=r.sourceCode.text.slice(...t);return n&&"BlockStatement"!==e.type&&(o=`{${o}}`),{range:t,text:o}});if(o.text===a.text)return;let{sourceCode:i}=r;yield e.replaceTextRange(i.getRange(o),a.text),yield e.replaceTextRange(i.getRange(a),o.text)}(n,t,e),"ConditionalExpression"!==t.type||"UnaryExpression"!==r.type)return;yield of(n,t,e);let{sourceCode:o}=e,{parent:a}=t,[i,s]=o.getFirstTokens(r,2);"ReturnStatement"!==a.type&&"ThrowStatement"!==a.type||a.argument!==t||nd(i,s,e)||eZ(t,e)||eZ(r,e)?nS(o.getTokenBefore(t),e,s.value)&&(yield n.insertTextBefore(t,";")):yield op(n,a,e)}}})},meta:{type:"suggestion",docs:{description:"Disallow negated conditions.",recommended:"unopinionated"},fixable:"code",messages:{[pW]:"Unexpected negated condition."},languages:["js/js"]}},"unicorn/no-object-as-default-parameter":{create:e=>{e.on("AssignmentPattern",e=>{if(!("ObjectExpression"===e.right.type&&e.right.properties.length>0&&tl(e.parent)&&e.parent.params.includes(e)))return;let{left:t,right:r}=e;return"Identifier"===t.type?{node:t,messageId:pV,data:{parameter:t.name}}:{node:r,messageId:pz}})},meta:{type:"problem",docs:{description:"Disallow the use of objects as default parameters.",recommended:"unopinionated"},messages:{[pV]:"Do not use an object literal as default for parameter `{{parameter}}`.",[pz]:"Do not use an object literal as default."},languages:["js/js"]}},"unicorn/prefer-negative-index":{create:e=>{e.on("CallExpression",t=>{if("MemberExpression"!==t.callee.type)return;let r=function(e){let{callee:t,arguments:r}=e,n=t.property.name,o=t.object,a=r;if(pG.has(n))return{method:n,target:o,argumentsNodes:a};if("call"!==n&&"apply"!==n||(n=pJ(t.object),!pG.has(n)))return;let i="apply"===t.property.name,{supportObjects:s}=pG.get(n),l=t.object.object;if(to(l)||"slice"===n&&e0(l,"")||"prototype"===pJ(l)&&"Identifier"===l.object.type&&s.has(l.object.name)){if([o]=r,i){let[,e]=r;if(!e||"ArrayExpression"!==e.type)return;a=e.elements}else a=r.slice(1);return{method:n,target:o,argumentsNodes:a}}}(t);if(!r)return;let{method:n,target:o,argumentsNodes:a}=r,{argumentsIndexes:i}=pG.get(n),s=i.map(e=>(function e(t,r){let n;if(!t)return;let{type:o,operator:a,left:i,right:s}=t=nA(t);if("BinaryExpression"!==o||"-"!==a||!(e8(n=nA(s))&&n.value>0))return;let l=nA(i);return"MemberExpression"===l.type&&!l.computed&&!l.optional&&"Identifier"===l.property.type&&"length"===l.property.name&&sQ(l.object,r)?i:e(i,r)})(a[e],o)).filter(Boolean);if(0!==s.length)return{node:t,messageId:pK,data:{method:n},*fix(t){for(let r of s)yield function(e,t,r){let[n,o]=eH(e,r);return t.removeRange([n,o+r.sourceCode.text.slice(o).match(/\S|$/).index])}(r,t,e)}}})},meta:{type:"suggestion",docs:{description:"Prefer negative index over `.length - index` when possible.",recommended:"unopinionated"},fixable:"code",messages:{[pK]:"Prefer negative index over length minus index for `{{method}}`."},languages:["js/js"]}},"unicorn/prefer-node-protocol":{create:e=>{e.on("Literal",t=>{if(!(["ImportDeclaration","ExportNamedDeclaration","ImportExpression","TSImportType"].includes(t.parent.type)&&t.parent.source===t||(tc(t.parent,{object:"process",method:"getBuiltinModule",argumentsLength:1,optionalCall:!1,optionalMember:!1})||tm(t.parent))&&t.parent.arguments[0]===t))return;let{value:r}=t;if(!("string"==typeof r&&!r.startsWith(pQ)&&pY(r)&&pY(`${pQ}${r}`)))return;let n=e.sourceCode.getRange(t)[0]+1;return{node:t,messageId:pH,data:{moduleName:r},fix:e=>e.insertTextAfterRange([n,n],pQ)}})},meta:{type:"suggestion",docs:{description:"Prefer using the `node:` protocol when importing Node.js builtin modules.",recommended:"unopinionated"},fixable:"code",messages:{[pH]:"Prefer `node:{{moduleName}}` over `{{moduleName}}`."},languages:["js/js"]}},"unicorn/consistent-date-clone":{create:e=>{e.on("NewExpression",t=>{if(!te(t,{name:"Date",argumentsLength:1}))return;let[r]=t.arguments;if(!tc(r,{method:"getTime",argumentsLength:0,optionalCall:!1,optionalMember:!1}))return;let{sourceCode:n}=e;return{node:r,loc:{start:n.getLoc(r.callee.property).start,end:n.getLoc(r).end},messageId:pZ,fix:t=>ox(t,r,e)}})},meta:{type:"suggestion",docs:{description:"Prefer passing `Date` directly to the constructor when cloning.",recommended:"unopinionated"},fixable:"code",messages:{[pZ]:"Unnecessary `.getTime()` call."},languages:["js/js"]}},"unicorn/no-accessor-recursion":{create:e=>{let{sourceCode:t}=e;e.on("ThisExpression",e=>{let r=((e,t)=>{for(let r=e.getScope(t);r;r=r.upper){if("class"===r.type)return;if("function"===r.type&&"ArrowFunctionExpression"!==r.block.type)return r}})(t,e);if(!r)return;let n=r.block.parent;if(["Property","MethodDefinition"].includes(n?.type)&&!n.computed&&["set","get"].includes(n.kind)&&p1(n.key)&&("get"===n.kind&&(p3(e,n)||"VariableDeclarator"===e.parent.type&&e.parent.init===e&&"ObjectPattern"===e.parent.id.type&&e.parent.id.properties.some(e=>"Property"===e.type&&!e.computed&&p2(e.key,n.key)))||"set"===n.kind&&((e,t)=>{if(!p3(e,t))return!1;let r=e.parent,{parent:n}=r;return("AssignmentExpression"===n.type||"AssignmentPattern"===n.type)&&n.left===r||"UpdateExpression"===n.type&&n.argument===r||"ArrayPattern"===n.type&&n.elements.includes(r)||"Property"===n.type&&n.value===r&&"ObjectPattern"===n.parent.type&&n.parent.properties.includes(r.parent)})(e,n)))return{node:e.parent,messageId:p0,data:{kind:n.kind}}})},meta:{type:"problem",docs:{description:"Disallow recursive access to `this` within getters and setters.",recommended:"unopinionated"},defaultOptions:[],messages:{[p0]:"Disallow recursive access to `this` within {{kind}}ters."},languages:["js/js"]}},"unicorn/prefer-import-meta-properties":{create:function(e){let{sourceCode:t}=e;e.on("MetaProperty",function*(e){if("MetaProperty"!==e.type||"import"!==e.meta.name||"meta"!==e.property.name)return;let r=e.parent;if(!tp(r,{properties:["url","filename"],computed:!1,optional:!1}))return;let n=r.property.name;if("url"===n){if(p5(r.parent,t)&&r.parent.arguments[0]===r)return void(yield a(r.parent,{reportFilenameNode:!0}));if(te(r.parent,{name:"URL",minimumArguments:1,maximumArguments:2})){var o;let e=r.parent,n=e.parent;if(1===e.arguments.length&&e.arguments[0]===r&&p5(n,t)&&n.arguments[0]===e)return void(yield a(n,{reportFilenameNode:!0}));2===e.arguments.length&&(o=e.arguments[0],o?.type==="Literal"&&("."===o.value||"./"===o.value))&&e.arguments[1]===r&&p5(n,t)&&n.arguments[0]===e&&(yield i(n,"dirname"))}return}function*a(e,{reportFilenameNode:r=!1}={}){let{parent:n}=e;if(p4(n,t)&&n.arguments[0]===e)return void(yield i(n,"dirname"));if(r&&(yield i(e,"filename")),"VariableDeclarator"!==n.type||n.init!==e||"Identifier"!==n.id.type||"VariableDeclaration"!==n.parent.type||"const"!==n.parent.kind)return;let o=ei(t.getScope(n.id),n.id);if(o)for(let e of o.references){if(!e.isReadOnly())continue;let{parent:r}=e.identifier;p4(r,t)&&r.arguments[0]===e.identifier&&(yield i(r,"dirname"))}}function i(e,t){return{node:e,messageId:"dirname"===t?p8:p6,fix:r=>r.replaceText(e,`import.meta.${t}`)}}"filename"===n&&(yield a(r))})},meta:{type:"suggestion",docs:{description:"Prefer `import.meta.{dirname,filename}` over legacy techniques for getting file paths.",recommended:!1},fixable:"code",messages:{[p8]:"Do not construct dirname.",[p6]:"Do not construct filename using `fileURLToPath()`."},languages:["js/js"]}},"unicorn/no-unnecessary-array-flat-depth":{create:e=>{e.on("CallExpression",t=>{if(!(tc(t,{method:"flat",argumentsLength:1,optionalCall:!1})&&e0(t.arguments[0],1)))return;let[r]=t.arguments;return{node:r,messageId:p7,fix:t=>ol(t,r,e)}})},meta:{type:"suggestion",docs:{description:"Disallow using `1` as the `depth` argument of `Array#flat()`.",recommended:"unopinionated"},fixable:"code",messages:{[p7]:"Passing `1` as the `depth` argument is unnecessary."},languages:["js/js"]}},"unicorn/no-unnecessary-array-splice-count":{create(e){pl(e,{methods:["splice","toSpliced"],messageId:ce})},meta:{type:"suggestion",docs:{description:"Disallow using `.length` or `Infinity` as the `deleteCount` or `skipCount` argument of `Array#{splice,toSpliced}()`.",recommended:"unopinionated"},fixable:"code",messages:{[ce]:"Passing `{{description}}` as the `{{argumentName}}` argument is unnecessary."},languages:["js/js"]}},"unicorn/no-useless-error-capture-stack-trace":{create:e=>{let t=[],r=[];e.on(["ClassDeclaration","ClassExpression"],e=>{t.push(e),r.push(e)}),e.onExit(["ClassDeclaration","ClassExpression"],()=>{t.pop(),r.pop()}),e.on(["FunctionDeclaration","FunctionExpression"],e=>{r.push(e)}),e.onExit(["FunctionDeclaration","FunctionExpression"],()=>{r.pop()}),e.on("CallExpression",n=>{let o,a=t.at(-1);if(!(a?.superClass&&"Identifier"===a.superClass.type&&iO.includes(a.superClass.name)&&e.sourceCode.isGlobalReference(a.superClass)&&(o=r.at(-1),o&&"MethodDefinition"===o.parent.type&&"constructor"===o.parent.kind&&o.parent.value===o&&a.body.body.includes(o.parent))&&tc(n,{object:"Error",method:"captureStackTrace",argumentsLength:2,optionalMember:!1})&&e.sourceCode.isGlobalReference(n.callee.object)))return;let[i,s]=n.arguments;if("ThisExpression"!==i.type||!((e,t,r)=>{if("MetaProperty"===e.type&&"Identifier"===e.meta.type&&"new"===e.meta.name&&"Identifier"===e.property.type&&"target"===e.property.name||tp(e,{property:"constructor",computed:!1,optional:!1})&&"ThisExpression"===e.object.type)return!0;if("Identifier"!==e.type||!t.id)return!1;let n=ei(r.sourceCode.getScope(e),e);return n&&1===n.defs.length&&"ClassName"===n.defs[0].type&&n.defs[0].node===t})(s,a,e))return;let l={node:n,messageId:ct},u="ChainExpression"===n.parent?n.parent.parent:n.parent;return"ExpressionStatement"===u.type&&"BlockStatement"===u.parent.type&&(l.fix=e=>e.remove(u)),l})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary `Error.captureStackTrace(…)`.",recommended:"unopinionated"},fixable:"code",messages:{[ct]:"Unnecessary `Error.captureStackTrace(…)` call."},languages:["js/js"]}},"unicorn/prefer-class-fields":{create:e=>{let{sourceCode:t}=e;e.on("ClassBody",r=>{let n=r.body.find(e=>"constructor"===e.kind&&!e.computed&&!e.static&&"MethodDefinition"===e.type&&"FunctionExpression"===e.value.type);if(!n)return;let o=n.value.body.body.find(e=>"EmptyStatement"!==e.type);if(!(o?.type==="ExpressionStatement"&&"AssignmentExpression"===o.expression.type&&"="===o.expression.operator&&"MemberExpression"===o.expression.left.type&&"ThisExpression"===o.expression.left.object.type&&!o.expression.left.computed&&["Identifier","PrivateIdentifier"].includes(o.expression.left.property.type)&&"Literal"===o.expression.right.type))return;let a=o.expression.left.property.name,i=o.expression.right.raw,s=o.expression.left.property.type,l=r.body.find(e=>"PropertyDefinition"===e.type&&!e.computed&&!e.static&&e.key.type===s&&e.key.name===a),u={node:o,messageId:cr};function*p(s){if(yield((e,t,r)=>{let{line:n}=t.getLoc(e).start,o=t.getText(e);return t.lines[n-1].trim()===o?r.removeRange([t.getIndexFromLoc({line:n,column:0}),t.getIndexFromLoc({line:n+1,column:0})]):r.remove(e)})(o,t,s),l){if(l.value)return void(yield s.replaceText(l.value,i));let e=` = ${i}`,r=t.getLastToken(l);return ep(r)?void(yield s.insertTextBefore(r,e)):void(yield s.insertTextAfter(l,`${e};`))}let u=t.getLastToken(r),p=t2(n,e),c=`${p}${a} = ${i};
|
|
18
|
+
`,pZ=e=>{var t;let r=(t=e.superClass,t?.type==="Identifier"?t.name:t?.type!=="MemberExpression"||t.computed||"Identifier"!==t.property.type?void 0:t.property.name);return!!r&&pY.test(r)},pQ=e=>"ExpressionStatement"===e.type&&"CallExpression"===e.expression.type&&tg(e.expression.callee,"super"),p0=(e,t)=>"ExpressionStatement"===e.type&&"AssignmentExpression"===e.expression.type&&"="===e.expression.operator&&tg(e.expression.left,`this.${t}`),p1=(e,t)=>({node:e,message:`The \`name\` property should be set to \`${t}\`.`}),p2=(e,t)=>e?.value&&e.value.value===t,p3=(e,t)=>"MethodDefinition"===e.type&&e.kind===t&&!e.static&&!e.computed&&"Identifier"===e.key.type&&"message"===e.key.name,p8=e=>e?.type==="Identifier"?e:e?.type==="AssignmentPattern"&&"Identifier"===e.left.type?e.left:void 0,p6=e=>p8(e)?.name==="options",p9=(e,t)=>{if("ThisExpression"===e.type||"Super"===e.type)return!0;for(let r of t[e.type]??[]){let n=e[r];if(n){if(Array.isArray(n)){if(n.some(e=>e&&p9(e,t)))return!0;continue}if(p9(n,t))return!0}}return!1},p5=e=>{let t=p8(e);return t.typeAnnotation?t.optional?"options?: ErrorOptions":"options: ErrorOptions":"options"},p4=(e,t,r)=>n=>{let o=t.arguments;if(0===o.length){let o=e.getTokenAfter(t.callee,e=>"("===e.value);return n.insertTextAfter(o,`${r}, options`)}if(1===o.length){let e;return"undefined"!==r&&(!(e=o[0])||tx(e))?n.replaceText(o[0],`${r}, options`):n.insertTextAfter(o[0],", options")}},p7=(e,t)=>e?.type==="Identifier"&&e.name===t.name;function*ce(e,t){if(!pZ(t)||null===t.id)return;let{name:r}=t.id,n=oo(r).replace(/(?:error)?$/i,"Error");r!==n&&(yield{node:t.id,message:`Invalid class name, use \`${n}\`.`});let{body:o}=t.body,{sourceCode:a}=e,i=o.find(e=>"constructor"===e.kind),s=o.find(e=>"PropertyDefinition"===e.type&&!e.static&&!e.computed&&"Identifier"===e.key.type&&"name"===e.key.name);if(!i){if(p2(s,r))return;let e=a.getRange(t.body);yield{...p1(s?.value??t,r),fix:t=>s?.value?t.replaceText(s.value,`'${r}'`):s?t.replaceText(s,pH(r).trim()):t.insertTextAfterRange([e[0],e[0]+1],pH(r))};return}let l=o.some(e=>p3(e,"get")),u=o.some(e=>p3(e,"set"));yield*function*(e,t,r){let{sourceCode:n}=e,o=t.value.body;if(!o)return;let a=o.body,{hasMessageGetter:i,hasMessageSetter:s,checkOptions:l}=r,u=a.find(e=>pQ(e)),p=a.findIndex(e=>pQ(e)),c=a.findIndex(e=>p0(e,"message")),d=i||s,m=!1;if(u){let r;if(d&&!(!(r=u.expression.arguments[0])||tx(r)))m=!0,yield{node:u,messageId:pV};else if(i&&!s&&-1!==c)m=!0,yield{node:a[c],messageId:pz};else if(!s&&-1!==c){let r=a[c];m=!0,yield{node:u,message:"Pass the error message to `super()` instead of setting `this.message`.",*fix(i){let s=r.expression.right,[l,d]=t.value.params,m=p8(l),f=1===t.value.params.length&&m&&!p6(l),g=f||p6(d);if(0===u.expression.arguments.length){if(c!==p+1||p9(s,n.visitorKeys))return;let[t]=n.getRange(u);yield i.insertTextAfterRange([t,t+6],g?`${eZ(s,e)}, options`:eZ(s,e))}else{let e;if(e=u.expression.arguments[0],n.getText(e)!==n.getText(s))return;g&&1===u.expression.arguments.length&&(yield i.insertTextAfter(u.expression.arguments[0],", options"))}f&&(yield i.insertTextAfter(l,`, ${p5(l)}`));let y=0===c?n.getRange(o)[0]:n.getRange(a[c-1])[1],[,h]=n.getRange(r);yield i.removeRange([y,h])}}}}else m=!0,yield{node:o,message:"Missing call to `super()` in constructor."};let f=function(e,t,r){let{name:n,nameProperty:o}=r,a=t.find(e=>p0(e,"name"));return a?"Literal"!==a.expression.right.type||a.expression.right.value!==n?p1(a.expression.right??e,n):void 0:p2(o,n)?void 0:p1(o?.value??e,n)}(o,a,r);if(f&&(yield f),!f&&l&&!m){let r=((e,t,r,n)=>{let o=t.value.params,a=o[0],i=p8(a);if(0===o.length||!i)return;let s=r.expression;if(p6(a)){if(!p6(s.arguments[1])){let t={node:s,messageId:pX};return p7(s.arguments[0],i)||(t.fix=p4(e.sourceCode,s,"undefined")),t}return}let l=o[1],u=!n&&"message"===i.name,p=u?i.name:"undefined";if(!l)return{node:a,messageId:pK,fix:function*(r){let{sourceCode:n}=e,o=p4(n,s,p)(r);if(!o)return;let a=t.value.params[0];yield r.insertTextAfter(a,`, ${p5(a)}`),yield o}};if(!p6(l))return{node:l,messageId:pG};if(u&&!p7(s.arguments[0],i)){let t;return{node:s,messageId:pJ,fix:(t=e.sourceCode,e=>{let r,n=s.arguments;if(0===n.length){let r=t.getTokenAfter(s.callee,e=>"("===e.value);return e.insertTextAfter(r,`${p}, options`)}if(!(r=n[0])||tx(r))return e.replaceText(n[0],1===n.length?`${p}, options`:p)})}}if(!p6(s.arguments[1]))return{node:s,messageId:pX,fix:p4(e.sourceCode,s,p)}})(e,t,u,d);r&&(yield r)}}(e,i,{name:r,nameProperty:s,hasMessageGetter:l,hasMessageSetter:u,checkOptions:r===n})}let ct="no-lonely-if",cr=e=>"IfStatement"===e.type&&!e.alternate;function cn(e,t){let r={ifToken:t.getFirstToken(e),openingParenthesisToken:t.getFirstToken(e,1)},{consequent:n}=e;return r.closingParenthesisToken=t.getTokenBefore(n),"BlockStatement"===n.type&&(r.openingBraceToken=t.getFirstToken(n),r.closingBraceToken=t.getLastToken(n)),r}let co=(e,t,r)=>r.text.slice(r.getRange(e)[1],r.getRange(t)[0]),ca=e=>e.trim()?e:"",ci=(e,t)=>/\s$/u.test(e)&&/^\s/u.test(t)?e+t.trimStart():e+t,cs=(e,t)=>co(e.ifToken,e.openingParenthesisToken,t),cl=(e,t,r)=>{let n,o=co(e.openingParenthesisToken,e.closingParenthesisToken,r);return eQ(e.test,t)?o:"LogicalExpression"===(n=e.test).type&&("||"===n.operator||"??"===n.operator)||"ConditionalExpression"===n.type||"AssignmentExpression"===n.type||"YieldExpression"===n.type||"SequenceExpression"===n.type?`(${o})`:o},cu="no-magic-array-flat-depth",cp="no-negated-condition",cc="identifier",cd="non-identifier",cm="prefer-negative-index",cf=new Map([["slice",{argumentsIndexes:[0,1],supportObjects:new Set(["Array","String","ArrayBuffer",...rE])}],["subarray",{argumentsIndexes:[0,1],supportObjects:new Set(rE)}],["splice",{argumentsIndexes:[0],supportObjects:new Set(["Array"])}],["toSpliced",{argumentsIndexes:[0],supportObjects:new Set(["Array"])}],["at",{argumentsIndexes:[0],supportObjects:new Set(["Array","String",...rE])}]]),cg=e=>{let{type:t,property:r}=e;if("MemberExpression"===t&&"Identifier"===r.type)return r.name};var cy=["node:assert","assert","node:assert/strict","assert/strict","node:async_hooks","async_hooks","node:buffer","buffer","node:child_process","child_process","node:cluster","cluster","node:console","console","node:constants","constants","node:crypto","crypto","node:dgram","dgram","node:diagnostics_channel","diagnostics_channel","node:dns","dns","node:dns/promises","dns/promises","node:domain","domain","node:events","events","node:ffi","node:fs","fs","node:fs/promises","fs/promises","node:http","http","node:http2","http2","node:https","https","node:inspector","inspector","node:inspector/promises","inspector/promises","node:module","module","node:net","net","node:os","os","node:path","path","node:path/posix","path/posix","node:path/win32","path/win32","node:perf_hooks","perf_hooks","node:process","process","node:querystring","querystring","node:quic","node:readline","readline","node:readline/promises","readline/promises","node:repl","repl","node:sea","node:sqlite","node:stream","stream","node:stream/consumers","stream/consumers","node:stream/iter","stream/iter","node:stream/promises","stream/promises","node:stream/web","stream/web","node:string_decoder","string_decoder","node:test","node:test/reporters","node:timers","timers","node:timers/promises","timers/promises","node:tls","tls","node:trace_events","trace_events","node:tty","tty","node:url","url","node:util","util","node:util/types","util/types","node:v8","v8","node:vm","vm","node:wasi","wasi","node:worker_threads","worker_threads","node:zlib","zlib","node:zlib/iter","zlib/iter"];function ch(t){if("string"!=typeof t)throw TypeError("Expected a string");return(e??=new Set(cy)).has(t)}let cx="prefer-node-protocol",cb="node:",cE="consistent-date-clone/error",cD="no-accessor-recursion/error",cS=e=>"Identifier"===e.type||"PrivateIdentifier"===e.type,cv=(e,t)=>["type","name"].every(r=>e[r]===t[r]),cC=(e,t)=>"MemberExpression"===e.parent.type&&e.parent.object===e&&!e.parent.computed&&cS(e.parent.property)&&cv(e.parent.property,t.key),cA="error/calculate-dirname",cT="error/calculate-filename";function cw(e,{modules:t,functionName:r,sourceCode:n}){if(!e7(e,{optional:!1,argumentsLength:1}))return!1;let o=new Set;return function e(t,i){if("MemberExpression"===t.type)return!!("property"===i&&tc(t,{property:r,computed:!1,optional:!1}))&&e(t.object,"module");if("CallExpression"===t.type)return"module"===i&&td(t,{object:"process",method:"getBuiltinModule",argumentsLength:1,optionalMember:!1,optionalCall:!1})&&a(t.arguments[0]);if("Identifier"!==t.type||o.has(t))return!1;o.add(t);let s=ei(n.getScope(t),t);return!!s&&1===s.defs.length&&function(t,n){if("ImportBinding"===t.type){if(!a(t.parent.source))return!1;let e=t.node;return"module"===n?e?.type==="ImportDefaultSpecifier"||e?.type==="ImportNamespaceSpecifier":e?.type==="ImportSpecifier"&&e.imported.name===r}return"Variable"===t.type&&function t(n,o){let{parent:a}=n;return"VariableDeclarator"===a.type?!!a.init&&a.id===n&&"VariableDeclaration"===a.parent.type&&"const"===a.parent.kind&&e(a.init,o):"Property"===a.type&&!!("property"===o&&a.value===n&&!a.computed&&"Identifier"===a.key.type&&a.key.name===r)&&t(a.parent,"module")}(t.name,n)}(s.defs[0],i)}(e.callee,"property");function a(e){return e?.type==="Literal"&&t.has(e.value)}}function ck(e,t){return cw(e,{modules:new Set(["url","node:url"]),functionName:"fileURLToPath",sourceCode:t})}function cI(e,t){return cw(e,{modules:new Set(["path","node:path"]),functionName:"dirname",sourceCode:t})}let cj="no-unnecessary-array-flat-depth",cF="no-unnecessary-array-splice-count",cB="no-useless-error-capture-stack-trace/error",cR="prefer-class-fields/error",c$="prefer-class-fields/suggestion",cP="prefer-bigint-literals/error",cL="prefer-bigint-literals/suggestion",cN="prefer-classlist-toggle/error",cM="prefer-classlist-toggle/suggestion",cO=e=>tc(e,{property:"classList",computed:!1}),cq=(e,t,r)=>{let n={node:r??e,messageId:cN};return"IfStatement"===e.type||ti(e)||ti(e.parent)?n.fix=t:n.suggest=[{messageId:cM,fix:t}],n},cU=(e,t,r)=>{let{sourceCode:n}=t,o=eZ(e,t);return r?(!eQ(e,n)&&n8(e,"!")&&(o=`(${o})`),o=`!${o}`):(eQ(e,n)||"SequenceExpression"!==e.type||(o=`(${o})`),o)},cW=(e,t)=>td(e,{methods:t,argumentsLength:1,optionalCall:!1,optionalMember:!1})&&cO(e.callee.object),c_=(e,t)=>tQ(e.callee.object,t.callee.object)&&tQ(e.arguments[0],t.arguments[0]),cV=(e,t,r)=>t?("ChainExpression"===e.type&&(e=e.expression),cW(e,["contains"])&&c_(e,r))?e:void 0:"UnaryExpression"===e.type&&"!"===e.operator&&e.prefix?cV(e.argument,!t,r):void 0,cz="require-module-attributes",cK="error",cG="suggestion/array",cJ="suggestion/object",cX="suggestion/object-assign",cY="suggestion/set",cH="suggestion/map",cZ=(e,t,r)=>{let{sourceCode:n}=r,o=rd(e);return t.some(e=>{let t=n.getRange(e);return o.some(e=>{let[r,o]=n.getRange(e);return r>=t[0]&&o<=t[1]})})};function cQ(e,t){if(!te(e,{names:t,maximumArguments:1}))return!1;let[r]=e.arguments;return!r||"ArrayExpression"===r.type}function*c0(e,t,r){let n=!ep(t.sourceCode.getTokenBefore(e));yield oq(e,t,r,n)}function c1(e,t,r,n){let{sourceCode:o}=e,[a,i]=o.getLastTokens(r,2),s=("ArrayExpression"===r.type?r.elements:r.properties).length>0&&!eu(a);return t.insertTextBefore(i,`${s?",":""} ${n}`)}function*c2({context:e,fixer:t,newExpression:r,elementsText:n,nextExpressionStatement:o}){if(tJ(r,e)){let[o]=r.arguments;if(o)yield c1(e,t,o,n);else{let{openingParenthesisToken:o}=tJ(r,e)?tX(r,e):{};yield t.insertTextAfter(o,`[${n}]`)}}else yield t.insertTextAfter(r,`([${n}])`);yield*c0(o,e,t)}let c3=[{testValue:e=>e?.type==="ArrayExpression",getProblematicNode({context:e,variable:t,nextExpressionStatement:r}){let n=r.expression;if(td(n,{object:t.name,methods:["push","unshift"],optionalMember:!1,optionalCall:!1})&&n.arguments.length>0&&!cZ(t,n.arguments,e))return n},getProblem(e,t){let{context:r,assignType:n,getFix:o}=t,{sourceCode:a}=r,i=e.callee,s=i.property,l={node:i,messageId:cK,data:{objectType:"array"}},u="unshift"===s.name,p=o(t,{callExpression:e,isPrepend:u});return e.arguments.some(e=>eP(e,a))?l.suggest=[{messageId:cG,fix:p,data:{operation:u?"Prepend":"Append",assignType:n}}]:l.fix=p,l},getFix:({context:e,valueNode:t,nextExpressionStatement:r},{callExpression:n,isPrepend:o})=>function*(a){let i=tY(e,n,!1);yield o?a.insertTextAfter(e.sourceCode.getFirstToken(t),`${i}, `):c1(e,a,t,i),yield c0(r,e,a)}},{testValue:e=>e?.type==="ObjectExpression",getProblematicNode({context:e,variable:t,nextExpressionStatement:r}){let n=r.expression;if(!("AssignmentExpression"===n.type&&"="===n.operator&&tc(n.left,{object:t.name,optional:!1})))return;let o=n.right,a=n.left,{property:i}=a;if(!cZ(t,a.computed?[i,o]:[o],e))return n},getProblem(e,t){let{context:r,assignType:n,getFix:o}=t,{sourceCode:a}=r,{left:i,right:s}=e,{property:l}=i,u=a.getTokenAfter(i,t=>"Punctuator"===t.type&&t.value===e.operator),p={node:e,loc:{start:a.getLoc(e).start,end:a.getLoc(u).end},messageId:cK,data:{objectType:"object"}},c=o(t,{assignmentExpression:e,memberExpression:i,property:l,value:s});return i.computed&&eP(l,a)||eP(s,a)?p.suggest=[{messageId:cJ,data:{assignType:n},fix:c}]:p.fix=c,p},getFix:({context:e,valueNode:t,nextExpressionStatement:r},{memberExpression:n,property:o,value:a})=>function*(i){let s=eZ(o,e);n.computed&&(s=`[${s}]`);let l=eZ(a,e),u=`${s}: ${l},`,[p,c]=e.sourceCode.getLastTokens(t,2),d=t.properties.length>0&&!eu(p);yield i.insertTextBefore(c,`${d?",":""} ${u}`),yield c0(r,e,i)}},{testValue:e=>e?.type==="ObjectExpression",getProblematicNode({context:e,variable:t,nextExpressionStatement:r}){let n=r.expression;if(!td(n,{object:"Object",method:"assign",minimumArguments:2,optionalMember:!1,optionalCall:!1}))return;let[o,a]=n.arguments;if(!("Identifier"!==o.type||o.name!==t.name||"SpreadElement"===a.type||cZ(t,[a],e)))return n},getProblem(e,t){let{context:r,assignType:n,getFix:o}=t,{sourceCode:a}=r,[,i]=e.arguments,s={node:e.callee,messageId:cK,data:{objectType:"object"}},l=o(t,{callExpression:e,firstValue:i});return eP(i,a)?s.suggest=[{messageId:cX,data:{description:"ObjectExpression"===i.type?"Move properties to":"Spread properties in",assignType:n},fix:l}]:s.fix=l,s},getFix:({context:e,valueNode:t,nextExpressionStatement:r},{callExpression:n,firstValue:o})=>function*(a){let i;("ObjectExpression"===o.type?o.properties.length>0&&(i=function(e,t){let{sourceCode:r}=t,n=r.getFirstToken(e),[o,a]=r.getLastTokens(e,2),[,i]=r.getRange(n),[s]=r.getRange(eu(o)?o:a);return r.text.slice(i,s)}(o,e)):i=`...${eZ(o,e)}`,i&&(yield c1(e,a,t,i)),2!==n.arguments.length)?yield ok(a,o,e):yield c0(r,e,a)}},{testValue:e=>cQ(e,["Set","WeakSet"]),getProblematicNode({context:e,variable:t,nextExpressionStatement:r}){let n=r.expression;if(("ChainExpression"===n.type&&(n=n.expression),td(n,{object:t.name,method:"add",argumentsLength:1,optionalMember:!1,optionalCall:!1}))&&!cZ(t,n.arguments,e))return n},getProblem(e,t){let{context:r,assignType:n,valueNode:o,getFix:a}=t,{sourceCode:i}=r,s={node:e.callee,messageId:cK,data:{objectType:`\`${o.callee.name}\``}},l=a(t,{callExpression:e,newExpression:o});return e.arguments.some(e=>eP(e,i))?s.suggest=[{messageId:cY,data:{assignType:n},fix:l}]:s.fix=l,s},getFix:({context:e,nextExpressionStatement:t},{callExpression:r,newExpression:n})=>o=>{let a=tY(e,r,!1);return c2({context:e,fixer:o,newExpression:n,elementsText:a,nextExpressionStatement:t})}},{testValue:e=>cQ(e,["Map","WeakMap"]),getProblematicNode({context:e,variable:t,nextExpressionStatement:r}){let n=r.expression;if(td(n,{object:t.name,method:"set",argumentsLength:2,optionalCall:!1})&&!cZ(t,n.arguments,e))return n},getProblem(e,t){let{context:r,assignType:n,valueNode:o,getFix:a}=t,{sourceCode:i}=r,s={node:e.callee,messageId:cK,data:{objectType:`\`${o.callee.name}\``}},l=a(t,{callExpression:e,newExpression:o});return e.arguments.some(e=>eP(e,i))?s.suggest=[{messageId:cH,data:{assignType:n},fix:l}]:s.fix=l,s},getFix:({context:e,nextExpressionStatement:t},{callExpression:r,newExpression:n})=>o=>{let a=tY(e,r,!1);return c2({context:e,fixer:o,newExpression:n,elementsText:`[${a}]`,nextExpressionStatement:t})}}],c8="no-useless-collection-argument/error",c6="no-useless-collection-argument/suggestion",c9="prefer-response-static-json",c5=/([\p{Ll}\d])(\p{Lu})/gu,c4=/(\p{Lu})([\p{Lu}][\p{Ll}])/gu,c7=/(\d)\p{Ll}|(\p{L})\d/u,de=/[^\p{L}\d]+/giu,dt="$1\0$2";function dr(e){let t=e.trim();t=(t=t.replace(c5,dt).replace(c4,dt)).replace(de,"\0");let r=0,n=t.length;for(;"\0"===t.charAt(r);)r++;if(r===n)return[];for(;"\0"===t.charAt(n-1);)n--;return t.slice(r,n).split(/\0/g)}function dn(e){let t=dr(e);for(let e=0;e<t.length;e++){let r=t[e],n=c7.exec(r);if(n){let o=n.index+(n[1]??n[2]).length;t.splice(e,1,r.slice(0,o),r.slice(o))}}return t}function da(e,t){let[r,n,o]=dc(e,t);return r+n.map(dl(t?.locale)).join(t?.delimiter??" ")+o}function di(e,t){var r,n;let[o,a,i]=dc(e,t),s=dl(t?.locale),l=du(t?.locale),u=t?.mergeAmbiguousCharacters?(r=s,n=l,e=>`${n(e[0])}${r(e.slice(1))}`):dp(s,l);return o+a.map((e,t)=>0===t?s(e):u(e,t)).join(t?.delimiter??"")+i}function ds(e,t){let[r,n,o]=dc(e,t),a=dp(dl(t?.locale),du(t?.locale));return r+n.map(a).join("")+o}function dl(e){return!1===e?e=>e.toLowerCase():t=>t.toLocaleLowerCase(e)}function du(e){return!1===e?e=>e.toUpperCase():t=>t.toLocaleUpperCase(e)}function dp(e,t){return(r,n)=>{let o=r[0];return(n>0&&o>="0"&&o<="9"?"_"+o:t(o))+e(r.slice(1))}}function dc(e,t={}){let r=t.split??(t.separateNumbers?dn:dr),n=t.prefixCharacters??"",o=t.suffixCharacters??"",a=0,i=e.length;for(;a<e.length;){let t=e.charAt(a);if(!n.includes(t))break;a++}for(;i>a;){let t=i-1,r=e.charAt(t);if(!o.includes(r))break;i=t}return[e.slice(0,a),r(e.slice(a,i)),e.slice(i)]}let dd="filename-case",dm="directory-case",df="filename-extension",dg=e=>!/^[\w-]$/.test(e),dy=new Set(["index.js","index.mjs","index.cjs","index.ts","index.tsx","index.vue"]),dh=new Intl.ListFormat("en-US",{type:"disjunction"}),dx=/^[\da-z]+$/i,db=/^[A-Z]{3,}(?=\d*[A-Z](?:[a-z]|\d+[a-z]))/,dE=e=>e>="0"&&e<="9",dD=e=>e>="a"&&e<="z",dS=e=>e>="A"&&e<="Z",dv={camelCase:{fn:di,name:"camel case"},camelCaseWithAcronyms:{fn:function(e){return!function(e){if(!dD(e[0]))return!1;for(let t=1;t<e.length;t++){let r=e[t];if(dD(r)||dE(r))continue;if(!dS(r))return!1;let n=t;for(;dS(e[t+1]);)t++;if(t!==n){if(dD(e[t+1])){t--;continue}for(;dE(e[t+1]);)t++;if(t===e.length-1)return!0;if(!dS(e[t+1]))return!1}}return!0}(e)?di(e):e},name:"camel case with acronyms"},kebabCase:{fn:function(e,t){return da(e,{delimiter:"-",...t})},name:"kebab case"},snakeCase:{fn:function(e,t){return da(e,{delimiter:"_",...t})},name:"snake case"},pascalCase:{fn:function(e){if(dx.test(e)){let t=db.exec(e)?.[0],r=t&&e.slice(t.length);if(r&&ds(r)===r)return e}return ds(e)},name:"pascal case"}};function dC(e,t){return e.filter(({ignored:e})=>!e).every(({word:e})=>t.some(t=>t(e)===e))}function dA(e,t,{leading:r,trailing:n}){let{samples:o}=function(e,t=1/0){let r=e.reduce((e,{length:t})=>e*t,1),n=Array.from({length:Math.min(r,t)},(t,r)=>{let n=r,o=[];for(let t=e.length-1;t>=0;t--){let r=e[t],{length:a}=r,i=n%a;n=(n-i)/a,o.unshift(r[i])}return o});return{total:r,samples:n}}(e.map(({word:e,ignored:r})=>r?[e]:t.map(t=>t(e))));return[...new Set(o.map(e=>`${r}${e.join("")}${n}`))]}let dT=/^(?<leading>_+)(?<tailing>.*)$/;function dw(e){let t,{leading:r="",tailing:n=e}=(dT.exec(e)||{groups:{}}).groups,o=[];for(let e of n){let r=dg(e);t?.ignored===r?t.word+=e:(t={word:e,ignored:r},o.push(t))}return{leading:r,words:o}}function dk(e){let t;return t=e.map(e=>dv[e].name),dh.format(t)}let dI=[{description:"The rule options.",anyOf:[{properties:{case:{enum:["camelCase","camelCaseWithAcronyms","snakeCase","kebabCase","pascalCase"],description:"The filename and directory name case style."},ignore:{type:"array",uniqueItems:!0,description:"Path segment patterns to ignore."},multipleFileExtensions:{type:"boolean",description:"Whether to treat additional, dot-separated parts of a filename as file extensions."},checkDirectories:{type:"boolean",description:"Whether to check directory names."}},additionalProperties:!1},{properties:{cases:{properties:{camelCase:{type:"boolean",description:"Whether to allow camelCase filenames and directory names."},camelCaseWithAcronyms:{type:"boolean",description:"Whether to allow camelCase filenames and directory names with acronym segments."},snakeCase:{type:"boolean",description:"Whether to allow snake_case filenames and directory names."},kebabCase:{type:"boolean",description:"Whether to allow kebab-case filenames and directory names."},pascalCase:{type:"boolean",description:"Whether to allow PascalCase filenames and directory names."}},additionalProperties:!1,description:"The allowed filename and directory name case styles."},ignore:{type:"array",uniqueItems:!0,description:"Path segment patterns to ignore."},multipleFileExtensions:{type:"boolean",description:"Whether to treat additional, dot-separated parts of a filename as file extensions."},checkDirectories:{type:"boolean",description:"Whether to check directory names."}},additionalProperties:!1}]}],dj="consistent-template-literal-escape",dF="iterable-accepting",dB="for-of",dR="yield-star",d$="spread",dP="iterator-method",dL="iterable-accepting/suggestion",dN="iterator-method/suggestion",dM=["every","find","forEach","some"],dO="reduce",dq=e=>td(e,{method:"toArray",argumentsLength:0,optionalCall:!1,optionalMember:!1}),dU="prefer-simple-condition-first",dW="prefer-simple-condition-first/suggestion";function d_(e){return"Identifier"===e.type||"Literal"===e.type||"UnaryExpression"===e.type&&("-"===e.operator||"+"===e.operator)&&"Literal"===e.argument.type&&"number"==typeof e.argument.value}function dV(e){return"Identifier"===e.type||("UnaryExpression"===e.type&&"!"===e.operator?dV(e.argument):"BinaryExpression"===e.type&&("==="===e.operator||"!=="===e.operator)?d_(e.left)&&d_(e.right)&&("Identifier"===e.left.type||"Identifier"===e.right.type):"LogicalExpression"===e.type&&dV(e.left)&&dV(e.right))}let dz=new Set(["AssignmentExpression","UpdateExpression","TaggedTemplateExpression","AwaitExpression","YieldExpression","ImportExpression"]);function dK(e,t,{operator:r,property:n}){let o=eQ(e,t),a=o?eZ(e,t):t.sourceCode.getText(e);return!o&&n6(e,{operator:r,property:n})&&(a=`(${a})`),a}let dG="switch-case-break-position",dJ=new Set(["BreakStatement","ReturnStatement","ContinueStatement","ThrowStatement"]),dX="first-child",dY="first-element-child",dH="query-selector",dZ="closest",dQ="merge-query-selector",d0="suggestion-first-child",d1="suggestion-first-element-child",d2="suggestion-merge-query-selector",d3={method:"querySelector",argumentsLength:1,optionalCall:!1,optionalMember:!1},d8=(e,t)=>tc(e,{property:t,optional:!1,computed:!1}),d6=e=>"MemberExpression"===e.type&&!e.optional&&e.computed&&e8(e.property)&&Number.isSafeInteger(e.property.value)&&e.property.value>=0,d9=(e,t)=>t.getCommentsInside(e).length>0,d5=(e,t,r,n)=>{let{sourceCode:o}=n;if(d9(e,o))return;let[,a]=eH(e.object,n),[,i]=o.getRange(e);return[{messageId:r,fix:r=>[r.replaceText(e.object.property,t),r.removeRange([a,i])]}]},d4=e=>tc(e,{property:"parentElement",optional:!1,computed:!1}),d7=e=>void 0!==e3(e),me=e=>td(e,d3),mt=new Set(["FunctionDeclaration","ClassDeclaration","TSTypeAliasDeclaration","TSInterfaceDeclaration","TSEnumDeclaration"]),mr=new Set(["AccessorProperty","MethodDefinition","PropertyDefinition","TSAbstractAccessorProperty","TSAbstractMethodDefinition","TSAbstractPropertyDefinition","TSMethodSignature","TSPropertySignature"]),mn=e=>{let t="";return"Variable"===e.type?t=e.node.init.arguments[0].value:"ImportBinding"===e.type&&(t=e.parent.source.value),!t.includes("node_modules")&&(t.startsWith(".")||t.startsWith("/"))},mo="consistent-compound-words/error",ma="consistent-compound-words/rename",{isIdentifierName:mi}=tL,ms={backGround:"background",callBack:"callback",checkBox:"checkbox",clipBoard:"clipboard",codeBase:"codebase",dataBase:"database",downLoad:"download",feedBack:"feedback",foreGround:"foreground",frameWork:"framework",headLine:"headline",keyBoard:"keyboard",keyFrame:"keyframe",lifeCycle:"lifecycle",metaData:"metadata",midPoint:"midpoint",nameSpace:"namespace",overRide:"override",passWord:"password",payLoad:"payload",placeHolder:"placeholder",preView:"preview",screenShot:"screenshot",sideBar:"sidebar",subClass:"subclass",subDirectory:"subdirectory",subDomain:"subdomain",subMenu:"submenu",subProcess:"subprocess",subString:"substring",subTree:"subtree",subType:"subtype",subTitle:"subtitle",timeOut:"timeout",timeStamp:"timestamp",toolBar:"toolbar",toolKit:"toolkit",toolTip:"tooltip",touchScreen:"touchscreen",unSubscribe:"unsubscribe",underScore:"underscore",upLoad:"upload",userName:"username",viewPort:"viewport",webCam:"webcam",webHook:"webhook",webSite:"website",weekEnd:"weekend",whiteSpace:"whitespace",wildCard:"wildcard",workFlow:"workflow",workSpace:"workspace"},ml=new Set(String.raw`\^$.*+?()[]{}|`),mu=e=>{let t="";for(let r of e)t+=ml.has(r)?`\\${r}`:r;return t},mp=String.raw`(?=$|[\d_$]|\p{Uppercase_Letter})`,mc=(e,{replacementRegExp:t,replacements:r,allowList:n})=>{if(!t||e===e.toUpperCase()||n.has(e))return;let o=e.replaceAll(t,e=>((e,t)=>{let r=t.get(e)??t.get(oa(e));if(r){let t;return(t=e[0])===t.toUpperCase()?oo(r):oa(r)}})(e,r));if(o!==e)return o},md=(e,t)=>({node:e,messageId:mo,data:{name:e.name,replacement:t}}),mm={type:"array",additionalItems:!1,items:[{type:"object",additionalProperties:!1,properties:{checkProperties:{type:"boolean",description:"Whether to check property names."},checkVariables:{type:"boolean",description:"Whether to check variable names."},checkDefaultAndNamespaceImports:{anyOf:[{type:"boolean"},{enum:["internal"]}],description:"Whether to check default and namespace import names."},checkShorthandImports:{anyOf:[{type:"boolean"},{enum:["internal"]}],description:"Whether to check shorthand import names."},checkShorthandProperties:{type:"boolean",description:"Whether to check shorthand property names."},extendDefaultReplacements:{type:"boolean",description:"Whether to extend the default replacements."},replacements:{$ref:"#/definitions/replacements",description:"Custom compound word replacements."},allowList:{$ref:"#/definitions/trueObject",description:"Custom allow list of names."}}}],definitions:{replacements:{type:"object",propertyNames:{minLength:1},additionalProperties:{anyOf:[{enum:[!1]},{type:"string",minLength:1}]}},trueObject:{type:"object",propertyNames:{minLength:1},additionalProperties:{enum:[!0]}}}},mf="no-blob-to-file",mg="suggestion";function my(e,t){let r=ei(t.sourceCode.getScope(e),e);return!r||0===r.defs.length}function mh(e,t){if(e?.type!=="Identifier")return;let r=ei(t.sourceCode.getScope(e),e),n=r?.defs[0],o=n?.node;if(n?.type==="Variable"&&"const"===n.kind&&o?.type==="VariableDeclarator")return o}let mx="no-canvas-to-image",mb=e=>{for(;e?.type==="AwaitExpression";)e=e.argument;return e};function mE(e,t){if(e=mb(e),e?.type!=="Identifier")return e;let r=ei(t.getScope(e),e);if(!r||1!==r.identifiers.length||2!==r.references.length)return;let[n]=r.identifiers;if("VariableDeclarator"===n.parent.type&&n.parent.id===n&&"VariableDeclaration"===n.parent.parent.type&&"const"===n.parent.parent.kind&&!(t.getRange(n)[0]>t.getRange(e)[0]))return mb(n.parent.init)}let mD=e=>e.toLowerCase().includes("canvas"),mS="replace-one-element",mv="insert-at-negative-one",mC="suggestion-replace-one-element",mA="suggestion-insert-at-negative-one";function mT(e){return"Identifier"===e.type||"ThisExpression"===e.type||"MemberExpression"===e.type&&!e.computed&&!e.optional&&mT(e.object)}let mw=(e,t)=>t.getCommentsInside(e).length>0,mk="no-duplicate-set-values",mI="first-match",mj="id-selector",mF="length-check",mB="query-selector-all-nullish",mR="query-selector-undefined",m$=e=>td(e,{method:"querySelector",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&!nT(e.callee.object),mP=e=>td(e,{method:"querySelectorAll",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&!nT(e.callee.object),mL=e=>{let t,r;return t=e,r=mP,"MemberExpression"===t.type&&t.computed&&!t.optional&&r(t.object)&&e0(t.property,0)},mN=e=>{let t,r;return t=e,r=mP,td(t,{methods:["at","item"],argumentsLength:1,optionalCall:!1,optionalMember:!1})&&r(t.callee.object)&&e0(t.arguments[0],0)},mM=e=>r3(e)||("ForInStatement"===e.parent.type||"ForOfStatement"===e.parent.type)&&e.parent.left===e,mO=(e,t,r,n)=>{let[,o]=eH(t,n),[,a]=r.getRange(e);return r.getAllComments().some(e=>{let[t,n]=r.getRange(e);return t>=o&&n<=a})},mq=(e,t,r)=>{if("Identifier"!==e.type)return;let n=ei(t.getScope(e),e);if(!n||1!==n.defs.length)return;let[o]=n.defs;if("Variable"===o.type&&"const"===o.parent.kind&&o.node.id===o.name&&r(o.node.init))return o.node.init},mU=(e,t)=>{let{sourceCode:r}=t,{node:n,isNegative:o}=function(e,t){let r=!1;for(;;)if(tS(e))r=!r,e=e.parent;else if(tv(e,t))e=e.parent;else break;return{node:e,isNegative:r}}(e,t);if(!tT(n)||(mP(e)?!e:!mq(e,r,mP)))return;let a=r.getText(e);return{node:e,messageId:mF,fix:((e,t,r)=>{let[n,o]=r.getRange(e),[a,i]=r.getRange(t);return r.getAllComments().some(e=>{let[t,s]=r.getRange(e);return t>=n&&s<=o&&(s<=a||t>=i)})})(n,e,r)?void 0:e=>e.replaceText(n,`${a}.length ${o?"=== 0":"> 0"}`)}},mW=(e,t,r)=>({node:e,messageId:mI,*fix(n){yield n.replaceText(t.callee.property,"querySelector"),yield"MemberExpression"===e.type?oM(n,e,r):oO(n,e,r)}}),m_=(e,t)=>e9(e)||tx(e)&&t.isGlobalReference(e),mV=(e,t,r)=>{let{left:n,operator:o,right:a}=e;return["==","===","!=","!=="].includes(o)?(t(n)?n:mq(n,r,t))&&m_(a,r)?{node:n,value:a}:(t(a)?a:mq(a,r,t))&&m_(n,r)?{node:a,value:n}:void 0:void 0},mz="no-invalid-file-input-accept/invalid",mK="no-invalid-file-input-accept/static",mG="no-invalid-file-input-accept/normalize",mJ=new Set(["audio/*","image/*","video/*"]),mX=new Map([["application/x-rar-compressed","application/vnd.rar"],["application/x-zip-compressed","application/zip"],["image/jpg","image/jpeg"],["image/svg","image/svg+xml"],["image/x-icon","image/vnd.microsoft.icon"]]),mY=/&(?:#\d+|#x[\da-f]+|[a-z][\da-z]*);/iv,mH=e=>{for(let t of e)if(""===t.trim()||","===t||"/"===t||"*"===t||"$"===t||"{"===t||"}"===t)return!0;return!1},mZ=e=>{if(e.startsWith("."))return e.length>1&&!mH(e.slice(1))?{replacement:e.toLowerCase()}:{reason:"File extensions must start with `.` and cannot contain whitespace, commas, slashes, wildcards, or template markers."};if(!e.includes("/"))return e.length>0&&"."!==e[0]&&!mH(e)?{replacement:`.${e.toLowerCase()}`}:{reason:"File extensions must start with `.` and cannot contain whitespace, commas, slashes, wildcards, or template markers."};let t=e.toLowerCase();if(t.includes("*"))return mJ.has(t)?{replacement:t}:{reason:"Wildcard MIME types must be `audio/*`, `image/*`, or `video/*`."};try{let{essence:t}=new m.MIMEType(e);return{replacement:mX.get(t)??t}}catch{return{reason:"MIME types must use valid `type/subtype` syntax."}}},mQ=e=>{if("JSXIdentifier"===e.type)return e.name},m0=(e,t)=>e.attributes.find(e=>"JSXAttribute"===e.type&&mQ(e.name)===t),m1=(e,t)=>{let r=e.sourceCode.getScope(t),n=ew(t,r)?.value;if("string"==typeof n)return n},m2=e=>">"===e||""===e.trim(),m3=(e,t,r)=>{for(;t<r&&""===e[t].trim();)t++;return t},m8=(e,t,r)=>t>=r||">"===e[t]||"/"===e[t]&&">"===e[t+1],m6=(e,t,r)=>{let n=t;for(;t<r&&""!==e[t].trim()&&"="!==e[t]&&">"!==e[t]&&("/"!==e[t]||">"!==e[t+1]);)t++;return{name:e.slice(n,t).toLowerCase(),index:t}},m9=(e,t,r)=>{let n='"'===e[t]||"'"===e[t]?e[t]:void 0;if(n){let o=t+1;for(t=o;t<r&&e[t]!==n;)t++;return{value:e.slice(o,t),valueRange:[o,t],isQuoted:!0,index:t+1}}let o=t;for(;t<r&&!m2(e[t]);)t++;return{value:e.slice(o,t),valueRange:[o,t],isQuoted:!1,index:t}},m5=(e,t,r)=>{let n=e.sourceCode.text,o=e.sourceCode.getRange(t.openStart)[1],a=e.sourceCode.getRange(t.openEnd)[1],i=o;for(;i<a&&(i=m3(n,i,a),!m8(n,i,a));){let e=m6(n,i,a);if(i=m3(n,e.index,a),"="!==n[i]){if(e.name===r)return{missing:!0};continue}i=m3(n,++i,a);let t=m9(n,i,a);if(i=t.index,e.name===r)return t}},m4=({valueInfo:e,fix:t})=>{if(e.missing)return{node:e.node,messageId:mz,data:{reason:"The `accept` attribute must have a value."}};if(e.dynamic)return{node:e.node,messageId:mK};let r=(e=>{let t=e.split(","),r=new Set,n=[];for(let e of t){let t=e.trim();if(0===t.length)return{reason:"Empty entries are not allowed."};let o=mZ(t);if(o.reason)return o;let{replacement:a}=o;r.has(a)||(r.add(a),n.push(a))}let o=n.join(", ");return o===e?{}:{replacement:o}})(e.value),n=r.replacement&&e.fixable&&(!e.isReplacementFixable||e.isReplacementFixable(r.replacement));return(({valueNode:e,checkResult:t,fix:r})=>{if(t.reason)return{node:e,messageId:mz,data:{reason:t.reason}};if(t.replacement){let n={node:e,messageId:mG,data:{replacement:t.replacement}};return r&&(n.fix=r),n}})({valueNode:e.node,checkResult:r,fix:n?t(r.replacement):void 0})},m7="after-suspension",fe="in-nested-function",ft=/^(?:e|event|evt|[a-z][\dA-Za-z]*Event)$/u,fr=e=>{for(let t=e.parent;t;t=t.parent)if(tl(t))return t},fn="no-unnecessary-nested-ternary";function fo(e,t,r){return r.getText(e)===r.getText(t)}function fa(e,t,r,n){let o=eZ(e,t);return!eQ(e,t)&&n6(e,{operator:r,property:n})&&(o=`(${o})`),o}function fi(e,t){let r=eZ(e,t);return!eQ(e,t)&&nQ(e)&&(r=`(${r})`),r}function fs(e,t,r){let n={node:t,messageId:fn};return 0===e.sourceCode.getCommentsInside(t).length&&(n.fix=n=>n.replaceText(t,function({context:e,node:t,left:r,operator:n,right:o,consequent:a,alternate:i}){let{sourceCode:s}=e,l=[fa(r,e,n,"left"),fa(o,e,n,"right")].join(` ${n} `),u=`${l} ? ${fi(a,e)} : ${fi(i,e)}`;return nW(s.getTokenBefore(t),e,u)&&(u=`;${u}`),u}({context:e,node:t,...r}))),n}let fl="no-unused-array-method-return",fu=new Set(["at","concat","entries","every","filter","find","findIndex","findLast","findLastIndex","flat","flatMap","includes","indexOf","join","keys","lastIndexOf","map","some","slice","toReversed","toSorted","toSpliced","values","with"]),fp=/^\p{Uppercase_Letter}/v,fc=Symbol("uncertainValue"),fd=new Set(["BigInt","Boolean","Number","RegExp","String"]),fm=(e,t,r)=>"Identifier"===e.type&&e.name===t&&r.sourceCode.isGlobalReference(e),ff="prefer-array-last-methods",fg="replace",fy=new Map([["find","findLast"],["findIndex","findLastIndex"],["indexOf","lastIndexOf"],["reduce","reduceRight"]]),fh=["reverse","toReversed"],fx="prefer-math-abs",fb=new Set([">",">=","<","<="]),fE={">":"<",">=":"<=","<":">","<=":">="},fD={">":"<",">=":"<="};function fS(e){return"TSBigIntKeyword"===e.type||"TSLiteralType"===e.type&&e5(e.literal)||"TSTypeAnnotation"===e.type&&fS(e.typeAnnotation)||"TSUnionType"===e.type&&e.types.some(e=>fS(e))||"TSIntersectionType"===e.type&&e.types.some(e=>fS(e))}function fv(e){return["TSAsExpression","TSTypeAssertion","TSNonNullExpression"].includes(e.type)?fv(e.expression):e}function fC(e){let t;return e5(e)||e7(e,{name:"BigInt",argumentsLength:1,optional:!1})||"UnaryExpression"===e.type&&"-"===e.operator&&fC(e.argument)||(t=function e(t){return"TSNonNullExpression"===t.type?e(t.expression):"TSAsExpression"===t.type||"TSTypeAssertion"===t.type?t.typeAnnotation:void 0}(e))&&fS(t)}function fA(e,t){return fC(e)||function(e,t){let r=fv(e);if("Identifier"!==r.type)return!1;let n=ei(t.sourceCode.getScope(r),r);return n?.defs.some(e=>"Parameter"===e.type?e.name.typeAnnotation&&fS(e.name.typeAnnotation)||"AssignmentPattern"===e.name.parent.type&&fC(e.name.parent.right):"Variable"===e.type&&(e.node.id.typeAnnotation&&fS(e.node.id.typeAnnotation)||e.node.init&&fC(e.node.init)))??!1}(e,t)}function fT(e,t){return"UnaryExpression"===e.type&&"-"===e.operator?tQ(e.argument,t):"BinaryExpression"===e.type&&"-"===e.operator&&e0(e.left,0)?tQ(e.right,t):"BinaryExpression"===e.type&&"*"===e.operator&&(tQ(e.left,t)&&tm(e.right)||tm(e.left)&&tQ(e.right,t))}function fw(e,t){if(!("BinaryExpression"!==e.type||!fb.has(e.operator)||fA(e.left,t)||fA(e.right,t)))return">"===e.operator||">="===e.operator?{value:e.left,threshold:e.right,operator:e.operator}:{value:e.right,threshold:e.left,operator:fE[e.operator]}}function fk(e,t){if(!("BinaryExpression"!==e.type||!fb.has(e.operator)||fA(e.left,t)||fA(e.right,t)))return"<"===e.operator||"<="===e.operator?{value:e.left,negativeThreshold:e.right,operator:e.operator}:{value:e.right,negativeThreshold:e.left,operator:fE[e.operator]}}function fI(e,t){let r=eZ(e,t);return"SequenceExpression"===e.type?`(${r})`:r}function fj(e,t,r){let n={node:e,messageId:fx};return r&&!(t.sourceCode.getCommentsInside(e).length>0)&&(n.fix=r),n}function fF(e){return["Identifier","Literal","ThisExpression"].includes((e=fv(e)).type)}let fB="prefer-split-limit",fR=(e,t)=>{let r=ew(e,t.getScope(e));if(r&&Number.isSafeInteger(r.value)&&!(r.value<0))return r.value},f$=e=>{let t;return td(e,{method:"split",argumentsLength:1})&&(e1(t=e.arguments[0])&&""!==t.value||e6(t))},fP=(e,t,r,n)=>({node:e,messageId:fB,fix:e=>ow(e,t,String(r+1),n)}),fL="prefer-queue-microtask",fN={create:e=>{let{checkSetImmediate:t,checkSetTimeout:r}=e.options[0];e.on("MemberExpression",t=>{if(tc(t,{object:"process",property:"nextTick",computed:!1,optional:!1})&&nR(t.object,e)&&("CallExpression"!==t.parent.type||t.parent.callee!==t||!t.parent.optional))return{node:t.property,messageId:fL,data:{name:"process.nextTick()"},fix:((e,t)=>{let{parent:r}=e;if("CallExpression"===r.type&&r.callee===e&&1===r.arguments.length&&"SpreadElement"!==r.arguments[0].type&&!(t.sourceCode.getCommentsInside(e).length>0))return t=>t.replaceText(e,"queueMicrotask")})(t,e)}}),e.on("CallExpression",n=>{let o;return t&&"Identifier"===n.callee.type&&"setImmediate"===n.callee.name&&!n.optional&&n.arguments.length>0&&"SpreadElement"!==n.arguments[0].type&&!nI(n.arguments[0])&&nO(n)&&nR(n.callee,e)?{node:n.callee,messageId:fL,data:{name:"setImmediate()"},fix:(e=>{if(1===e.arguments.length)return t=>t.replaceText(e.callee,"queueMicrotask")})(n)}:r&&"Identifier"===n.callee.type&&"setTimeout"===n.callee.name&&!n.optional&&n.arguments.length>=2&&"Literal"===(o=n.arguments[1]).type&&0===o.value&&"SpreadElement"!==n.arguments[0].type&&!nI(n.arguments[0])&&nO(n)&&nR(n.callee,e)?{node:n.callee,messageId:fL,data:{name:"setTimeout()"},fix:((e,t)=>{if(2!==e.arguments.length)return;let r=((e,t)=>{let{sourceCode:r}=t,[,n]=e.arguments,o=r.getTokenBefore(n),a=r.getTokenAfter(n),i=a?.value===","?r.getTokenAfter(a):a,s=[r.getRange(o)[0],a?.value===","?r.getRange(a)[1]:r.getRange(n)[1]];if(!re(t,[s[0],r.getRange(i)[0]]))return s})(e,t);if(r)return function*(t){yield t.replaceText(e.callee,"queueMicrotask"),yield t.removeRange(r)}})(n,e)}:void 0})},meta:{type:"suggestion",docs:{description:"Prefer `queueMicrotask()` over `process.nextTick()`, `setImmediate()`, and `setTimeout(…, 0)`.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{checkSetImmediate:{type:"boolean",description:"Whether to also check `setImmediate()`."},checkSetTimeout:{type:"boolean",description:"Whether to also check `setTimeout(…, 0)`."}}}],defaultOptions:[{checkSetImmediate:!1,checkSetTimeout:!1}],messages:{[fL]:"Prefer `queueMicrotask()` over `{{name}}`."},languages:["js/js"]}},fM="prefer-string-pad-start-end",fO="suggest-padding-method",fq=new Set(["ArrayExpression","ArrowFunctionExpression","ClassExpression","FunctionExpression","ObjectExpression"]),fU=(e,t)=>{let r,n=((e,t)=>{if("Identifier"!==e.type)return;let r=ei(t.sourceCode.getScope(e),e),n=r?.defs[0]?.node;return n?.type==="FunctionDeclaration"||n?.type==="ClassDeclaration"?n:n?.type==="VariableDeclarator"?n.init:void 0})(e,t);return(r=ew(e,t.sourceCode.getScope(e)))&&"string"!=typeof r.value||fq.has(e.type)||fq.has(n?.type)||n?.type==="FunctionDeclaration"||n?.type==="ClassDeclaration"},fW=(e,t)=>t.sourceCode.getCommentsInside(e).length>0,f_=e=>"Literal"===e.type&&"number"==typeof e.value,fV=e=>"Literal"===e.type&&"string"==typeof e.value||"TemplateLiteral"===e.type&&0===e.expressions.length,fz=({targetNode:e,targetLengthNode:t,paddingNode:r})=>"Identifier"===e.type&&f_(t)&&fV(r),fK=(e,t)=>{if(!td(e,{method:"repeat",argumentsLength:1,optionalCall:!1,optionalMember:!1}))return;let r=e.callee.object,n=((e,t)=>{let r=ew(e,t.sourceCode.getScope(e));if("string"==typeof r?.value)return r.value})(r,t);if(n?.length===1)return{paddingNode:r,paddingString:n,widthNode:e.arguments[0]}},fG=(e,t)=>{let r,n=fK(e,t);if(!n)return;let{widthNode:o}=n;if("BinaryExpression"===o.type&&"-"===o.operator&&(r=o.right,r?.type==="MemberExpression"&&!1===r.computed&&"Identifier"===r.property.type&&"length"===r.property.name))return{...n,targetLengthNode:o.left,targetNode:o.right.object}},fJ=({method:e,targetNode:t,targetLengthNode:r,paddingNode:n,paddingString:o},a)=>{let i=eZ(t,a),s=eZ(r,a),l=(({paddingNode:e,paddingString:t},r)=>" "===t?"":`, ${eZ(e,r)}`)({paddingNode:n,paddingString:o},a);return`${i}.${e}(${s}${l})`},fX=({node:e,method:t,replacement:r,context:n,canFix:o})=>{let a={node:e,messageId:fM,data:{method:t}};return o&&!fW(e,n)&&(a.fix=function(t){let o=nW(n.sourceCode.getTokenBefore(e),n,r)?";":"";return t.replaceText(e,`${o}${r}`)}),a},fY=({node:e,method:t,replacement:r,context:n,canSuggest:o})=>{let a={node:e,messageId:fM,data:{method:t}};return o&&!fW(e,n)&&(a.suggest=[{messageId:fO,data:{method:t},fix:t=>t.replaceText(e,r)}]),a},fH="require-css-escape",fZ=["closest","matches","querySelector","querySelectorAll"],fQ=e=>e.value.cooked,f0=(e,t)=>{let r,n="";for(let r of e.quasis.slice(0,t+1)){let e=fQ(r);if(void 0===e)return!1;n+=e}if(!((r=n).lastIndexOf("[")>r.lastIndexOf("]")))return!1;for(let r of e.quasis.slice(t+1)){let e=fQ(r);if(void 0===e)break;if(e.includes("]"))return!0}return!1},f1=e=>td(e,{object:"CSS",method:"escape",argumentsLength:1,optionalCall:!1,optionalMember:!1}),f2=e=>t=>"SequenceExpression"===e.type?[t.insertTextBefore(e,"CSS.escape(("),t.insertTextAfter(e,"))")]:[t.insertTextBefore(e,"CSS.escape("),t.insertTextAfter(e,")")],f3={create:e=>{let{checkAllSelectors:t}=e.options[0];e.on("CallExpression",function*(e){if(!td(e,{methods:fZ,minimumArguments:1})||nT(e.callee.object))return;let[r]=e.arguments;if("TemplateLiteral"===r.type&&0!==r.expressions.length)for(let[e,n]of r.expressions.entries())!f1(n)&&(t||f0(r,e))&&(yield{node:n,messageId:fH,fix:f2(n)})})},meta:{type:"suggestion",docs:{description:"Require `CSS.escape()` for interpolated values in CSS selectors.",recommended:"unopinionated"},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{checkAllSelectors:{type:"boolean",description:"Check all selector interpolations instead of only attribute selector interpolations."}}}],defaultOptions:[{checkAllSelectors:!1}],messages:{[fH]:"Use `CSS.escape()` for interpolated values in CSS selectors."},languages:["js/js"]}},f8="require-passive-events",f6=new Set(["touchstart","touchmove","touchenter","touchend","touchleave","wheel","mousewheel"]),f9=e=>e.computed||"Identifier"!==e.property.type?e1(e.property)?e.property.value:void 0:e.property.name,f5=e=>{var t,r;return"MemberExpression"===e.parent.type&&e.parent.object===e&&"MemberExpression"===(t=e.parent).type&&"preventDefault"===f9(t)&&("CallExpression"===(r=t).parent.type&&r.parent.callee===r?r.parent:"ChainExpression"===r.parent.type&&"CallExpression"===r.parent.parent.type&&r.parent.parent.callee===r.parent?r.parent.parent:void 0)},f4=e=>{if("MemberExpression"!==e.parent.type||e.parent.object!==e)return!1;let t=f9(e.parent);return t&&"preventDefault"!==t&&!r3((e=>{for(;"MemberExpression"===e.parent.type&&e.parent.object===e;)e=e.parent;return e})(e.parent))},f7="this",ge="class",gt="class-unavailable",gr="super",gn="super-class",go="super-class-unavailable",ga="suggestion",gi=new Set(["PropertyDefinition","AccessorProperty","StaticBlock","ClassBody"]),gs=new Set(["TSAsExpression","TSInstantiationExpression","TSNonNullExpression","TSSatisfiesExpression","TSTypeAssertion"]),gl=e=>"MethodDefinition"===e.parent.type&&e.parent.value===e,gu=e=>"FunctionDeclaration"===e.type||"FunctionExpression"===e.type,gp=e=>{let t=e;for(let{parent:r}=e;r;t=r,r=r.parent)if("ArrowFunctionExpression"!==r.type){if(gu(r)&&!gl(r))return;if("MethodDefinition"===r.type)return r.static&&r.value===t?r:void 0;if(gi.has(r.type))return}},gc=e=>{if(e.id)return e.id;let{parent:t}=e;if("ClassExpression"===e.type&&"VariableDeclarator"===t.type&&t.init===e&&"Identifier"===t.id.type)return t.id},gd=(e,t,r)=>ei(e.getScope(t),t)===ei(e.getScope(r),r),gm=(e,t,r)=>ei(e.getScope(t),r.name)===ei(e.getScope(r),r),gf=(e,t)=>"AssignmentExpression"===e.type&&e.left===t||"UpdateExpression"===e.type&&e.argument===t||"UnaryExpression"===e.type&&"delete"===e.operator&&e.argument===t||("ForInStatement"===e.type||"ForOfStatement"===e.type)&&e.left===t,gg=e=>{let t;return(t=e.parent,gs.has(t.type)&&t.expression===e)?e.parent:void 0},gy=e=>{let{parent:t}=e;if("MemberExpression"===t.type&&t.object===e||"ChainExpression"===t.type&&t.expression===e)return t;let r=gg(e);return r||("Property"===t.type&&t.value===e&&"ObjectPattern"===t.parent.type?t.parent:"ObjectPattern"===t.type&&t.properties.includes(e)||"ArrayPattern"===t.type&&t.elements.includes(e)||"AssignmentPattern"===t.type&&t.left===e||"RestElement"===t.type&&t.argument===e?t:void 0)},gh=e=>{let t=e;for(;t.parent;){if(gf(t.parent,t))return!0;let e=gy(t);if(!e)break;t=e}return!1},gx=e=>"MemberExpression"===e.parent.type&&e.parent.object===e,gb=e=>{let t=e;for(;t.parent;){let e=gg(t);if(!e)break;t=e}return t},gE=e=>{let t=gb(e);return"CallExpression"===t.parent.type&&t.parent.callee===t||"NewExpression"===t.parent.type&&t.parent.callee===t||"TaggedTemplateExpression"===t.parent.type&&t.parent.tag===t},gD=e=>{let t=gb(e);return gx(t)&&"PrivateIdentifier"===t.parent.property.type},gS=e=>{let t=gb(e);return"BinaryExpression"===t.parent.type&&"in"===t.parent.operator&&"PrivateIdentifier"===t.parent.left.type&&t.parent.right===t},gv=e=>e.superClass?.type==="Identifier"?e.superClass:void 0,gC=({node:e,messageId:t,source:r,replacement:n,name:o})=>({node:e,messageId:t,data:{name:o},suggest:[{messageId:ga,data:{source:r,replacement:n},fix:t=>t.replaceText("ChainExpression"===e.parent.type?e.parent:e,n)}]}),gA=(e,t,r)=>({node:e,messageId:t,data:{name:r}}),gT={create:e=>{let{sourceCode:t}=e,{preferThis:r,preferSuper:n}=e.options[0];e.on("ThisExpression",e=>{if(r||gh(e)||gE(e)||gD(e)||gS(e))return;let n=gp(e);if(!n)return;let o=gc(n.parent.parent);return o&&gm(t,e,o)?gC({node:e,messageId:ge,source:"this",replacement:o.name,name:o.name}):gA(e,gt)}),e.on("Super",e=>{if(n||gh(e))return;let r=gp(e);if(!r)return;let o=gv(r.parent.parent);return o&&gm(t,e,o)?gC({node:e,messageId:gn,source:"super",replacement:o.name,name:o.name}):gA(e,go)}),e.on("Identifier",o=>{if(!function(e,t=[]){if("Identifier"!==e.type)return!1;let r=Array.isArray(t)?t:[t];return(!(r.length>0)||!!r.includes(e.name))&&!function(e){let{parent:t}=e;switch(t.type){case"MemberExpression":return!t.computed&&t.property===e;case"FunctionDeclaration":case"FunctionExpression":return t.params.includes(e)||t.id===e;case"ArrowFunctionExpression":return t.params.includes(e);case"ClassDeclaration":case"ClassExpression":case"VariableDeclarator":case"TSDeclareFunction":case"TSEnumMember":case"TSTypeAliasDeclaration":return t.id===e;case"PropertyDefinition":case"MethodDefinition":return!t.computed&&t.key===e;case"Property":return!t.computed&&t.key===e&&("ObjectExpression"===t.parent.type||"ObjectPattern"===t.parent.type)&&t.parent.properties.includes(t)||t.value===e&&"ObjectPattern"===t.parent.type&&t.parent.properties.includes(t);case"ArrayPattern":return t.elements.includes(e);case"LabeledStatement":case"ContinueStatement":case"BreakStatement":return t.label===e;case"ImportDefaultSpecifier":case"ImportNamespaceSpecifier":return t.local===e;case"ExportAllDeclaration":return t.exported===e;case"ImportSpecifier":return t.local===e||t.imported===e;case"ExportSpecifier":return t.local===e||t.exported===e;case"TSIndexSignature":return t.parameters.includes(e);case"TSTypeParameter":return t.name===e;case"TSMappedType":case"TSPropertySignature":return t.key===e}return!1}(e)}(o)||(e=>{let t=e;for(;"TSQualifiedName"===t.parent.type;)t=t.parent;return"TSTypeReference"===t.parent.type&&t.parent.typeName===t||"TSTypeQuery"===t.parent.type&&t.parent.exprName===t})(o)||gh(o)||gE(o)||gD(o)||gS(o))return;let a=gp(o);if(!a)return;let i=a.parent.parent;if(r){let e=gc(i);if(e&&o.name===e.name&&gd(t,o,e))return gC({node:o,messageId:f7,source:o.name,replacement:"this",name:o.name})}if(!n||!(gx(o)&&!o.parent.optional&&!gh(o.parent))||eQ(o,e))return;let s=gv(i);if(s&&o.name===s.name&&gd(t,o,s))return gC({node:o,messageId:gr,source:o.name,replacement:"super",name:o.name})})},meta:{type:"suggestion",docs:{description:"Enforce consistent class references in static methods.",recommended:!0},hasSuggestions:!0,schema:[{type:"object",properties:{preferThis:{type:"boolean",description:"Prefer `this` over the current class name in static methods."},preferSuper:{type:"boolean",description:"Prefer `super` over the superclass name in static methods."}},additionalProperties:!1}],defaultOptions:[{preferThis:!0,preferSuper:!0}],messages:{[f7]:"Use `this` instead of `{{name}}` in static methods.",[ge]:"Use `{{name}}` instead of `this` in static methods.",[gt]:"Use the class name instead of `this` in static methods.",[gr]:"Use `super` instead of `{{name}}` in static methods.",[gn]:"Use `{{name}}` instead of `super` in static methods.",[go]:"Use the superclass name instead of `super` in static methods.",[ga]:"Replace `{{source}}` with `{{replacement}}`."},languages:["js/js"]}},gw="consistent-optional-chaining/remove-optional",gk="consistent-optional-chaining/use-optional",gI="consistent-optional-chaining/suggest-remove-optional",gj="consistent-optional-chaining/suggest-use-optional",gF=new Set(["Identifier","ThisExpression","Super"]);function gB(e){let t;for(;e!==t;)t=e,"ChainExpression"===(e=ry(e)).type&&(e=e.expression);return e}function gR(e){return"MemberExpression"===(e=gB(e)).type?e:void 0}function g$(e){return e=gB(e),!!gF.has(e.type)||"MemberExpression"===e.type&&g$(e.object)}function gP(e,t){let r=ri(e,t);return!re(t,r)}function gL({memberExpression:e,context:t,fixer:r,replacement:n}){let o=ri(e,t);return r.replaceTextRange(o,n)}function gN(e,t,r){return gL({memberExpression:e,context:t,fixer:r,replacement:e.computed?"[":"."})}let gM="always",gO="never",gq="missing-delay",gU="redundant-delay",gW=new Set(["setTimeout","setInterval"]),g_=new Set(["window","globalThis","global","self"]),gV=e=>e0(e,0)||"UnaryExpression"===e.type&&("+"===e.operator||"-"===e.operator)&&gV(e.argument),gz="negative-index",gK="length-index",gG=["entries","keys","values"],gJ=["drop","filter","flatMap","map","take"],gX=["concat","from","zip","zipKeyed"],gY=e=>{for(;rg(e)||"ChainExpression"===e.type||"ParenthesizedExpression"===e.type;)e=e.expression;return e},gH="no-duplicate-loops",gZ=["filter","map"],gQ="no-declarations-before-early-exit",g0=e=>"VariableDeclaration"===e.type&&("let"===e.kind||"const"===e.kind),g1=e=>"use"===e||/^use[\dA-Z]/.test(e),g2=e=>!e||"Literal"===e.type||"TemplateLiteral"===e.type&&0===e.expressions.length,g3=(e,t,r)=>{let n="before"===r?e.getTokenBefore(t,{includeComments:!0}):e.getTokenAfter(t,{includeComments:!0});return n&&eg(n)},g8=(e,t)=>{let[r,n]=e.getRange(t);return new Set(tO(e.getScope(t)).filter(({identifier:t})=>{let[o,a]=e.getRange(t);return o>=r&&a<=n}).map(({identifier:e})=>e.name))};function*g6(e,t,r){let n;for(let[o,a]of t.entries())if(g0(a)&&!a.declare){n??=t.map(e=>{var t,n;return(t=e,n=r,"IfStatement"!==t.type||n(t.consequent)===(!!t.alternate&&n(t.alternate)))?void 0:e});for(let r=o+1;r<t.length;r++){let t=n[r];if(t){for(let n of a.declarations){let i=function({sourceCode:e,declaration:t,declarator:r,guardStatement:n,declarationIndex:o,guardIndex:a}){var i;let s;if("Identifier"!==r.id.type||(e=>{if(e?.type!=="CallExpression")return!1;let{callee:t}=e;return"Identifier"===t.type?g1(t.name):"MemberExpression"===t.type&&!t.computed&&"Identifier"===t.object.type&&/^[A-Z]/.test(t.object.name)&&"Identifier"===t.property.type&&g1(t.property.name)})(r.init)||r.init&&tk(r.init,e.visitorKeys)||a>o+1&&!g2(r.init)||r.init&&(i=r.init,s=g8(e,n),[...g8(e,i)].some(e=>s.has(e)))&&(eP(r.init,e)||eP(n.test,e)))return;let[l]=e.getDeclaredVariables(r),u=l.references.filter(e=>!e.init&&!function(e){let t=e;for(;"TSQualifiedName"===t.parent.type;)t=t.parent;return"TSTypeQuery"===t.parent.type}(e.identifier));if(0===u.length)return;let[,p]=e.getRange(n);if(u.some(t=>e.getRange(t.identifier)[0]<p))return;let c={node:r.id,messageId:gQ};return(({sourceCode:e,declaration:t,guardStatement:r,declarationIndex:n,guardIndex:o})=>o===n+1&&1===t.declarations.length&&g2(t.declarations[0].init)&&0===e.getCommentsInside(t).length&&!g3(e,t,"before")&&!g3(e,r,"after")&&!e.getTokensBetween(t,r,{includeComments:!0}).some(e=>eg(e)))({sourceCode:e,declaration:t,guardStatement:n,declarationIndex:o,guardIndex:a})&&(c.fix=function(e,t,r){let n=e.getText(t),o=e.getText(r),[a,i]=e.getRange(t),[s,l]=e.getRange(r),u=e.text.slice(i,s);return e=>e.replaceTextRange([a,l],`${o}${u}${n}`)}(e,t,n)),c}({sourceCode:e,declaration:a,declarator:n,guardStatement:t,declarationIndex:o,guardIndex:r});i&&(yield i)}break}}}}let g9="no-optional-chaining-on-undeclared-variable",g5=e=>"Type"===e.type||"ImportBinding"===e.type&&n_(e.node);function g4(e){let t;for(;e!==t;)t=e,("ChainExpression"===(e=ry(e)).type||"TSInstantiationExpression"===e.type)&&(e=e.expression);return e}let g7="no-object-methods-with-collections/error",ye="no-object-methods-with-collections/suggestion",yt=new Set(["Map","ReadonlyMap"]),yr=new Set(["Set","ReadonlySet"]),yn=new Set([...yt,...yr]),yo=new Set(["entries","keys","values"]),ya=e=>new Set([e]),yi=e=>yn.has(e)?e:void 0,ys=new Set(["ClassDeclaration","TSEnumDeclaration","TSInterfaceDeclaration","TSTypeAliasDeclaration"]),yl=e=>{if(e&&ys.has(e.type))return e.id?.name},yu=(e,t)=>{let r=(e=>{for(;e.parent;)e=e.parent;return"Program"===e.type?e:void 0})(t);if(!r)return!1;for(let t of r.body){if("ImportDeclaration"===t.type){if(t.specifiers.some(t=>t.local.name===e))return!0;continue}if("ExportNamedDeclaration"===t.type||"ExportDefaultDeclaration"===t.type){if(yl(t.declaration)===e)return!0;continue}if(yl(t)===e)return!0}return!1},yp=e=>{let t=new Set;for(let r of e){if(!r)return;for(let e of r)t.add(e)}return t},yc=(e,t)=>{let r=ei(t.sourceCode.getScope(e),e);return!r||"global"===r.scope.type&&0===r.defs.length},yd=(e,t)=>{if(rD.has(e.intrinsicName))return;if(e.isUnion())return yp(e.types.map(e=>yd(e,t)));let r=rv(e);if(!(r?.declarations?.length>0&&r.declarations.every(e=>t.isSourceFileDefaultLibrary(e.getSourceFile()))))return;let n=r.getName(),o=n&&yi(n);return o&&ya(o)},ym=(e,t)=>{switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return ym(e.typeAnnotation);case"TSTypeOperator":return"readonly"===e.operator?ym(e.typeAnnotation):void 0;case"TSTypeReference":{if("Identifier"!==e.typeName.type||yu(e.typeName.name,e))return;let t=yi(e.typeName.name);return t&&ya(t)}case"TSUnionType":return yp(e.types.map(e=>ym(e)))}},yf=(e,t,r=new Set)=>((e,t)=>{let{parserServices:r}=t.sourceCode;if(r?.program)try{let{program:t}=r,n=yd(r.getTypeAtLocation(e),t);if(n&&!((e,t)=>{for(let r of e)if(yu(r,t))return!0;return!1})(n,e))return n}catch{}})(e,t)??((e,t,r)=>{if(te(e,{names:["Map","Set"]})&&yc(e.callee,t))return ya(e.callee.name);switch(e.type){case"Identifier":return((e,t,r)=>{let n=ei(t.sourceCode.getScope(e),e);if(!n||r.has(n)||1!==n.defs.length)return;r.add(n);let[o]=n.defs,a=ym(o.name?.typeAnnotation);return a||("Variable"===o.type&&"const"===o.parent.kind&&o.node.init?yf(o.node.init,t,r):void 0)})(e,t,r);case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":return ym(e.typeAnnotation)??yf(e.expression,t,r);case"TSNonNullExpression":case"ParenthesizedExpression":return yf(e.expression,t,r)}})(e,t,r),yg="no-subtraction-comparison/error",yy="no-subtraction-comparison/suggestion",yh={">":"<",">=":"<=","<":">","<=":">=","===":"===","!==":"!==","==":"==","!=":"!="},yx=new Set(Object.keys(yh)),yb=new Set([">","<"]),yE=e=>"BinaryExpression"===e.type&&"-"===e.operator,yD=(e,t)=>{let r=ew(e,t)?.value;return"number"==typeof r&&Number.isFinite(r)},yS="no-unnecessary-global-this",yv=new Set(["TSAsExpression","TSInstantiationExpression","TSNonNullExpression","TSSatisfiesExpression","TSTypeAssertion"]),yC=e=>{for(;yv.has(e.parent.type)&&e.parent.expression===e;)e=e.parent;return e};function yA(e){return"CallExpression"===(e=yC(e)).parent.type&&e.parent.callee===e}let yT="computed-key",yw="nested-array",yk="deep-object",yI="property-assignment";function yj(e){let{parent:t}=e;if(t){if(rg(t)&&t.expression===e||"AssignmentPattern"===t.type&&t.left===e||"RestElement"===t.type&&t.argument===e)return yj(t);if("Property"===t.type&&t.value===e&&"ObjectPattern"===t.parent.type)return t.parent;if("ObjectPattern"===t.type||"ArrayPattern"===t.type)return t}}function yF(e){let t=0;for(;e;)"ObjectPattern"===e.type&&t++,e=yj(e);return t}let yB="no-useless-else",yR=new Set(["Program","BlockStatement","StaticBlock","SwitchCase"]),y$=new Set(["[","(","/","`","+","-"]),yP=(e,t)=>{let r=e.text.lastIndexOf("\n",t-1)+1;return/^[\t ]*/.exec(e.text.slice(r,t))[0]},yL=e=>y$.has(e.value[0]),yN="no-useless-recursion",yM=new Set(["using","await using"]),yO=e=>e?.type==="VariableDeclaration"&&yM.has(e.kind),yq=e=>"ForStatement"===e.type?yO(e.init):"ForOfStatement"===e.type&&yO(e.left),yU="prefer-add-event-listener-options",yW="prefer-direct-iteration",y_="Array",yV="FormData",yz="URLSearchParams",yK=new Set([y_,"Map","Set",yV,yz,...rE]),yG=new Map([["ReadonlyArray",y_],["ReadonlyMap","Map"],["ReadonlySet","Set"]]),yJ=new Map([[y_,["values"]],["Map",["entries"]],["Set",["values","keys"]],[yV,["entries"]],[yz,["entries"]],...rE.map(e=>[e,["values"]])]),yX=["Map","WeakMap","Set","WeakSet"],yY=["all","allSettled","any","race"],yH=new Set(["ArrayExpression","CallExpression","NewExpression"]),yZ=e=>new Set([e]),yQ=(e,t)=>td(e,{objects:rE,methods:t,optionalCall:!1,optionalMember:!1}),y0=e=>yK.has(e)?e:yG.get(e),y1=e=>{let t=new Set;for(let r of e){if(!r)return;for(let e of r)t.add(e)}return t},y2=(e,t,r)=>{if("any"===e.intrinsicName||"unknown"===e.intrinsicName)return;if(e.isUnion())return y1(e.types.map(e=>y2(e,t,r)));if(t.isArrayType(e)||t.isTupleType(e))return yZ(y_);let n=rv(e);if(!rC(n,r))return;let o=n.getName(),a=o&&y0(o);return a&&yZ(a)},y3=e=>{switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return y3(e.typeAnnotation);case"TSArrayType":case"TSTupleType":return yZ(y_);case"TSTypeOperator":return"readonly"===e.operator?y3(e.typeAnnotation):void 0;case"TSTypeReference":{if("Identifier"!==e.typeName.type)return;let t=y0(e.typeName.name);return t&&yZ(t)}case"TSUnionType":return y1(e.types.map(e=>y3(e)))}},y8=(e,t,r=new Set)=>((e,t,r)=>{if("ArrayExpression"===e.type||te(e,{name:"Array"}))return yZ(y_);if(te(e,{names:rE})||te(e,{names:["Map","Set",yV,yz]}))return yZ(e.callee.name);if(e7(e,{name:"Array"})||td(e,{object:"Array",methods:["from","of"],optionalCall:!1,optionalMember:!1}))return yZ(y_);if(yQ(e,["from","of"]))return yZ(e.callee.object.name);switch(e.type){case"Identifier":return((e,t,r)=>{let n=ei(t.sourceCode.getScope(e),e);if(!n||r.has(n)||1!==n.defs.length)return;r.add(n);let[o]=n.defs,a=y3(o.name?.typeAnnotation);return a||("Variable"===o.type&&"const"===o.parent.kind&&o.node.init?y8(o.node.init,t,r):void 0)})(e,t,r);case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":return y3(e.typeAnnotation)??y8(e.expression,t,r);case"TSNonNullExpression":case"ParenthesizedExpression":return y8(e.expression,t,r)}})(e,t,r)??((e,t)=>{let{parserServices:r}=t.sourceCode;if(r?.program)try{let{program:t}=r;return y2(r.getTypeAtLocation(e),t.getTypeChecker(),t)}catch{}})(e,t),y6="prefer-number-is-safe-integer/error",y9="prefer-number-is-safe-integer/suggestion",y5="prefer-number-is-safe-integer/integer-check-error",y4="prefer-number-is-safe-integer/integer-check-suggestion",y7=["_","lodash","underscore"],he=["floor","trunc"],ht=(e,t)=>{let r=ei(t.getScope(e),"Number");return!r||"global"===r.scope.type&&0===r.defs.length},hr=e=>{if("BinaryExpression"===e.type&&"%"===e.operator&&e0(e.right,1))return e.left},hn=(e,t)=>{if(td(e,{object:"Math",methods:he,argumentsLength:1,optionalCall:!1,optionalMember:!1,computed:!1})&&t.isGlobalReference(e.callee.object))return e.arguments[0]},{isIdentifierName:ho}=tL,ha="prefer-object-define-properties";function hi(e){if(e?.type!=="ExpressionStatement")return;let{expression:t}=e;if(td(t,{object:"Object",method:"defineProperty",argumentsLength:3,optionalCall:!1,optionalMember:!1,computed:!1}))return t}let hs="prefer-object-destructuring-defaults",hl="prefer-object-destructuring-defaults/suggestion",hu=new Set(Object.getOwnPropertyNames(Object.prototype)),hp={considerGetters:!0,considerImplicitTypeConversion:!0},hc=e=>"Property"===e.type&&"init"===e.kind&&!e.computed&&!e.method,hd=(e,t,r)=>tO(r.sourceCode.getScope(e)).some(n=>t.has(n.identifier.name)&&((e,t,r)=>{let[n,o]=r.getRange(e),[a,i]=r.getRange(t);return n>=a&&o<=i})(n.identifier,e,r.sourceCode)),hm=(e,t,r)=>{let{sourceCode:n}=r,o=n.getText(e.node.value),a=eZ(t.value,r);return e.node.shorthand?`${o} = ${a}`:`${n.getText(e.node.key)}: ${o} = ${a}`},hf="prefer-single-object-destructuring",hg=(e,t)=>{let r,n;if(!("VariableDeclaration"===t.type&&("const"===(r=t.kind)||"let"===r)&&!t.declare&&1===t.declarations.length))return;let[o]=t.declarations;if("ObjectPattern"===o.id.type&&!o.id.typeAnnotation&&(n=o.id).properties.length>0&&n.properties.every(e=>"Property"===e.type&&!e.computed&&"Identifier"===e.value.type)&&o.init?.type==="Identifier"&&((e,t)=>{let r=ei(e.getScope(t),t);if(!r||1!==r.defs.length)return!1;let[n]=r.defs;return"Variable"===n.type&&"VariableDeclarator"===n.node.type&&"VariableDeclaration"===n.parent.type&&!n.parent.declare&&"const"===n.parent.kind})(e,o.init))return{node:t,declarator:o,source:o.init.name}},hy=(e,t,r)=>{let n,o,a=hg(e,t),i=hg(e,r);if(!(a&&i&&a.node.kind===i.node.kind&&a.source===i.source&&0===e.getCommentsInside(a.node).length&&0===e.getCommentsInside(i.node).length&&(n=a.node,o=i.node,!e.getTokensBetween(n,o,{includeComments:!0}).some(e=>eg(e)))))return;let s=t=>t.properties.map(t=>e.getText(t)).join(", "),l=`${a.node.kind} {${s(a.declarator.id)}, ${s(i.declarator.id)}} = ${a.source};`;return{node:i.node,messageId:hf,data:{source:a.source},fix:t=>t.replaceTextRange([e.getRange(a.node)[0],e.getRange(i.node)[1]],l)}};function*hh(e,t){for(let[r,n]of t.entries()){if(0===r)continue;let o=hy(e,t[r-1],n);o&&(yield o)}}let hx="prefer-smaller-scope",hb=new Set(["ArrowFunctionExpression","ClassDeclaration","ClassExpression","FunctionDeclaration","FunctionExpression","StaticBlock","WithStatement"]);function hE(e,t){let r=e.parent;for(;r&&r!==t;){if(hb.has(r.type))return!1;r=r.parent}return r===t}function hD(e,t,r){let n="before"===r?e.getTokenBefore(t,{includeComments:!0}):e.getTokenAfter(t,{includeComments:!0});return!!(n&&eg(n))}function hS(e,t){let r=e.getTokenBefore(t),n=e.getTokenAfter(t);return r?.value==="("&&n?.value===")"}let hv="prefer-single-array-predicate/error",hC="prefer-single-array-predicate/suggestion",hA=new Map([["||","some"],["&&","every"]]),hT=new Set(["AssignmentExpression","ArrowFunctionExpression","ConditionalExpression","SequenceExpression","TSAsExpression","TSNonNullExpression","TSSatisfiesExpression","TSTypeAssertion","YieldExpression"]),hw="prefer-url-href",hk="non-url",hI="unknown",hj=new Set(["ClassName","ImportBinding","Type"]),hF=new Set(["any","error","unknown"]),hB=new Set(["node:url","url"]),hR=e=>hj.has(e.type),h$=(e,t,r,n)=>{for(;t;){let o=t.set.get(e);if(o?.defs.some(e=>nV(e,r,n)))return o;t=t.upper}},hP=e=>e.every(e=>"url"===e)?"url":!e.includes(hI)&&e.includes(hk)?hk:hI,hL=e=>{let t;if("ImportBinding"!==e.type)return!1;let{node:r,parent:n}=e;return t=n.source,hB.has(t.value)&&"ImportSpecifier"===r.type&&"Identifier"===r.imported.type&&"URL"===r.imported.name},hN=e=>"ImportBinding"===e.type&&("type"===e.parent.importKind||n_(e.node)),hM=e=>"Type"===e.type||hN(e),hO=e=>hL(e)&&!hN(e),hq=(e,t)=>{let r;return"NewExpression"===e.type&&(((e,t)=>{if("Identifier"!==e.type||"URL"!==e.name||((e,t,r,n)=>{for(;t;){let o=t.set.get(e);if(o?.defs.some(e=>!hM(e)&&nV(e,r,n)))return!0;t=t.upper}return!1})("URL",t.sourceCode.getScope(e),e,t))return!1;if(nR(e,t))return!0;let r=ei(t.sourceCode.getScope(e),e);return r?.defs.length>0&&r.defs.every(e=>hM(e))})(r=e.callee,t)||((e,t)=>{if("Identifier"!==e.type)return!1;let r=ei(t.sourceCode.getScope(e),e);return r?.defs.some(e=>hO(e))??!1})(r,t))},hU=(e,t)=>t.sourceCode.getScope(e.name??e.node),hW=(e,t,r,n=new Set)=>{switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return hW(e.typeAnnotation,t,r,n);case"TSTypeReference":return((e,t,r,n)=>{if("Identifier"!==e.typeName.type)return hI;let o=e.typeName.name,a=h$(o,r,e.typeName,t),[i]=a?.defs??[];if(!i)return"URL"!==o||((e,t)=>{for(;t;){let r=t.set.get(e);if(r?.defs.some(e=>hR(e)))return!0;t=t.upper}return!1})(o,r)?hI:"url";if(n.has(o))return hI;if(hL(i))return"url";n.add(o);let s=hI;return"Type"===i.type&&"TSTypeAliasDeclaration"===i.node.type?s=hW(i.node.typeAnnotation,t,hU(i,t),n):"Type"===i.type&&"TSTypeParameter"===i.node.type?s=hI:"ClassName"===i.type&&(s=hk),n.delete(o),s})(e,t,r,n);case"TSUnionType":return hP(e.types.map(e=>hW(e,t,r,n)));case"TSIntersectionType":return hP(e.types.map(e=>hW(e,t,r,n)));case"TSImportType":let o;return(o=e.source,hB.has(o.value)&&e.qualifier?.type==="Identifier"&&"URL"===e.qualifier.name)?"url":hk;default:return e?hk:hI}},h_=(e,t)=>{let{checker:r,context:n,node:o,program:a}=t;if(hF.has(e.intrinsicName)||e.isTypeParameter?.())return hI;let i=r.getBaseConstraintOfType(e);if(i&&i!==e)return h_(i,t);if(e.isUnion()||e.isIntersection())return hP(e.types.map(e=>h_(e,t)));let s=((e,t,r)=>{if(!/^[\w$]+$/.test(e))return hI;let n=h$(e,r.sourceCode.getScope(t),t,r),o=n?.defs.filter(e=>"Type"===e.type||"ClassName"===e.type||hL(e))??[];return 0===o.length?hI:o.every(e=>hL(e))?"url":hk})(r.typeToString(e),o,n);if(s!==hI)return s;let l=rv(e);return rC(l,a)&&"URL"===l.getName()?"url":hk},hV=(e,t)=>{let{parserServices:r}=t.sourceCode;if(!r?.program)return hI;try{let{program:n}=r;return h_(r.getTypeAtLocation(e),{checker:n.getTypeChecker(),context:t,node:e,program:n})}catch{return hI}};function hz(e,t,r=new Set){if(!e)return hI;let n=t.sourceCode.getScope(e);switch(e.type){case"Identifier":{let n=((e,t,r)=>{let n=ei(t.sourceCode.getScope(e),e);if(!n||r.has(n)||1!==n.defs.length)return hI;let[o]=n.defs;if(!nV(o,e,t))return hI;r.add(n);let a="Variable"===o.type&&"const"===o.parent.kind&&o.node.init?hz(o.node.init,t,r):hI,i=hW(o.name?.typeAnnotation,t,hU(o,t)),s=hI;return a!==hI?s=a:i!==hI&&(s=i),r.delete(n),s})(e,t,r);if(n!==hI)return n;break}case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":{let o=hW(e.typeAnnotation,t,n);return o===hI?hz(e.expression,t,r):o}case"TSNonNullExpression":case"ParenthesizedExpression":return hz(e.expression,t,r);case"SequenceExpression":return hz(e.expressions.at(-1),t,r);case"ConditionalExpression":return hP([hz(e.consequent,t,r),hz(e.alternate,t,r)])}if(hq(e,t))return"url";if("NewExpression"===e.type){if(((e,t)=>{if("Identifier"!==e.type)return!1;let r=ei(t.sourceCode.getScope(e),e);return r?.defs.some(e=>!hM(e)&&!hO(e))??!1})(e.callee,t))return hk;let r=hV(e,t);return r===hI?hk:r}let o=((e,t)=>{if("CallExpression"!==e.type||"Identifier"!==e.callee.type)return hI;let r=ei(t.sourceCode.getScope(e.callee),e.callee);if(r?.defs.length!==1)return hI;let[n]=r.defs;return hW(n.node.returnType,t,hU(n,t))})(e,t);return o!==hI?o:hV(e,t)}let hK=(e,t)=>{switch(e.type){case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":case"ParenthesizedExpression":case"TSNonNullExpression":return hK(e.expression,t);case"SequenceExpression":return hK(e.expressions.at(-1),t);case"ConditionalExpression":return hK(e.consequent,t)&&hK(e.alternate,t);case"NewExpression":return hq(e,t);default:return!1}},hG=(e,t)=>0===t.sourceCode.getCommentsInside(e).length,hJ="require-proxy-trap-boolean-return",hX=new Set(["defineProperty","deleteProperty","has","isExtensible","preventExtensions","set","setPrototypeOf"]),hY=new Set(["ArrowFunctionExpression","FunctionDeclaration","FunctionExpression"]),hH=new Set(["ArrayExpression","ArrowFunctionExpression","ClassExpression","FunctionExpression","NewExpression","ObjectExpression","TemplateLiteral","UpdateExpression"]),hZ=new Set(["%","&","*","**","+","-","/","<<",">>",">>>","^","|"]),hQ=(e,t)=>({node:e,messageId:hJ,data:{name:t}}),h0=e=>{if(e)return hQ(e.node,e.data.name)},h1=(e,t,r)=>{if("AssignmentExpression"===e.type)return"="===e.operator?h0(h1(e.right,t,r)):hQ(e,t);if("ConditionalExpression"===e.type)return h1(e.consequent,t,r)??h1(e.alternate,t,r);if("LogicalExpression"===e.type)return h0(h1(e.left,t,r)??h1(e.right,t,r));if("SequenceExpression"===e.type)return h0(h1(e.expressions.at(-1),t,r));let n=((e,t)=>{let r=ew(e,t.getScope(e));if(null!==r&&"boolean"!=typeof r.value)return!!r.value})(e,r);if(void 0===n&&!(hH.has(e.type)||"UnaryExpression"===e.type&&"!"!==e.operator&&"delete"!==e.operator||"BinaryExpression"===e.type&&hZ.has(e.operator)))return;let o=((e,t,r)=>{if(!(r.getCommentsInside(e).length>0)&&("Literal"===e.type&&!e.regex||"TemplateLiteral"===e.type&&0===e.expressions.length||"Identifier"===e.type&&"undefined"===e.name))return String(t)})(e,n,r);return{...hQ(e,t),...o&&{fix:t=>t.replaceText(e,o)}}},h2=(e,t)=>{if("Property"!==e.type||"init"!==e.kind)return;let r=eI(e,t.getScope(e));if(hX.has(r)&&hY.has(e.value.type))return{name:r,functionNode:e.value}},h3=({functionNode:e,name:t},r,n)=>{if(e.async||e.generator)return hQ(e,t);if("BlockStatement"!==e.body.type)return h1(e.body,t,r);let o=[...function* e(t){if(t&&"string"==typeof t.type){if("ReturnStatement"===t.type)return void(yield t);if(!("BlockStatement"!==t.type&&hY.has(t.type))){for(let[r,n]of Object.entries(t))if("parent"!==r){if(Array.isArray(n)){for(let t of n)yield*e(t);continue}yield*e(n)}}}}(e.body)],a=n.get(e)??!1;if(0===o.length){if(a)return;return hQ(e,t)}for(let e of o){if(!e.argument)return hQ(e,t);let n=h1(e.argument,t,r);if(n)return n}if(!a)return hQ(e,t)},h8=f.builtinRules.get("logical-assignment-operators"),h6="ifNullish",h9="convertIf",h5={...h8.meta.messages,[h6]:"'if' statement can be replaced with a logical operator assignment with operator ||= or ??=."},h4=e=>e.fix??e.suggest?.[0]?.fix,h7={create:e=>{let{sourceCode:t}=e,r=Object.create(e,{report:{value(r){e.report(function(e,t){let r;if("if"!==e.messageId||e.data?.operator!=="||="||"function"!=typeof h4(e))return e;let n={...(r={...e},delete r.fix,delete r.suggest,r),messageId:h6};if(t.getCommentsInside(e.node).length>0)return n;let o=h4(e);return{...n,suggest:[{messageId:h9,data:{operator:"||="},fix:o},{messageId:h9,data:{operator:"??="},fix:e=>o(new Proxy(e,{get(e,t){if("insertTextBefore"!==t){let r=Reflect.get(e,t,e);return"function"==typeof r?r.bind(e):r}return(t,r)=>e.insertTextBefore(t,"||"===r?"??":r)}}))}]}}(r,t))}}});for(let[t,n]of Object.entries(h8.create(r)))e.on(t,n)},meta:{type:h8.meta.type,docs:{description:h8.meta.docs.description,recommended:!0},fixable:h8.meta.fixable,hasSuggestions:h8.meta.hasSuggestions,schema:h8.meta.schema,defaultOptions:[h8.meta.defaultOptions?.[0]],messages:h5,languages:["js/js"]}},xe="no-useless-coercion",xt=new Map([["Boolean",{type:"boolean",isType:ny}],["String",{type:"string",isType:nC}],["BigInt",{type:"bigint",isType:function(e,t){return!!e&&(!!("TSSatisfiesExpression"===e.type&&nx(e.typeAnnotation)||nb(e,t))||"bigint"==typeof ew(e,t.sourceCode.getScope(e))?.value)}}],["Number",{type:"number",isType:(e,t)=>nr(e,t.sourceCode.getScope(e))}]]),xr=e=>"Literal"===e.type&&""===e.value,xn="no-useless-boolean-cast",xo=["every","filter","find","findIndex","findLast","findLastIndex","some"],xa="no-useless-continue",xi="no-useless-override",xs=e=>e.isUnion()?e.types.every(e=>xs(e)):"void"===e.intrinsicName||"undefined"===e.intrinsicName,xl=(e,t)=>{let{parserServices:r}=t.sourceCode;if(r?.program)try{return{type:r.getTypeAtLocation(e),checker:r.program.getTypeChecker()}}catch{}},xu="prefer-has-check",xp=new Set(["Map","ReadonlyMap","WeakMap"]),xc=new Set(["Map","WeakMap"]),xd=new Set(["FormData","Headers","URLSearchParams"]),xm=new Set(["Array","ReadonlyArray"]),xf=new Set([...xc,...xd]),xg=new Set(["ClassName","ImportBinding","TSEnumName","Type"]),xy=new Set(["any","bigint","boolean","false","number","string","unknown","undefined","null","void"]),xh=new Set(["TSTypeAnnotation","TSParenthesizedType"]),xx=new Set(["TSAnyKeyword","TSNeverKeyword","TSUndefinedKeyword","TSUnknownKeyword","TSVoidKeyword"]),xb=new Set(["TSBigIntKeyword","TSBooleanKeyword","TSNumberKeyword","TSStringKeyword"]),xE=new Set(["TSArrayType","TSConstructorType","TSFunctionType","TSObjectKeyword","TSSymbolKeyword","TSTupleType"]),xD=new Set(["ArrayExpression","ArrowFunctionExpression","ClassExpression","FunctionExpression","NewExpression","ObjectExpression"]),xS=new Set(["ParenthesizedExpression","TSAsExpression","TSSatisfiesExpression","TSTypeAssertion","TSNonNullExpression"]),xv=e=>{for(;xS.has(e.type);)e=e.expression;return e},xC=e=>{if("Identifier"===e.type)return e.name;if("TSQualifiedName"===e.type){let t=xC(e.left);return t?`${t}.${e.right.name}`:void 0}},xA=e=>e.typeArguments?.params??e.typeParameters?.params??[],xT=(e,t)=>{for(;t;){let r=t.set.get(e)?.defs.find(e=>xg.has(e.type));if(r)return r;t=t.upper}},xw=e=>{if(e?.type==="Type"&&"TSTypeAliasDeclaration"===e.node.type&&0===xA(e.node).length)return e.node.typeAnnotation},xk=(e,t)=>{if(t.sourceCode.isGlobalReference(e))return!0;let r=ei(t.sourceCode.getScope(e),e);return!r||0===r.defs.length},xI=(e,t)=>tx(e)&&xk(e,t)||"UnaryExpression"===e.type&&"void"===e.operator&&"Literal"===e.argument.type&&0===e.argument.value,xj=(e,t)=>xp.has(e)?{kind:"map",typeName:e,valueType:t}:xd.has(e)?{kind:"null-sentinel",typeName:e}:void 0,xF=(e,t,r=new Set)=>{switch(e?.type){case"TSTypeAnnotation":case"TSParenthesizedType":return xF(e.typeAnnotation,t,r);case"TSTypeOperator":return"readonly"===e.operator?xF(e.typeAnnotation,t,r):void 0;case"TSTypeReference":{let n=xC(e.typeName);if(!n)return;if((xp.has(n)||xd.has(n))&&!xT(n,t))return xj(n,xA(e).at(-1));let o=((e,t,r)=>{if(!r.has(e))return r.add(e),xw(xT(e,t))})(n,t,r);return o?xF(o,t,r):void 0}}},xB=(e,t)=>{let r=t.sourceCode.getScope(e);return xF(e.typeAnnotation,r)},xR=(e,t,r=new Set)=>{let n=xB(e,t);if(n)return n;if(te(e=xv(e))&&"Identifier"===e.callee.type&&xf.has(e.callee.name)&&xk(e.callee,t))return xj(e.callee.name);if("Identifier"!==e.type)return;let o=ei(t.sourceCode.getScope(e),e);if(!o||r.has(o)||1!==o.defs.length)return;r.add(o);let[a]=o.defs,i=xF(a.name?.typeAnnotation,t.sourceCode.getScope(a.name));return i||("Variable"===a.type&&"const"===a.parent.kind&&a.node.id===a.name&&a.node.init?xR(a.node.init,t,r):void 0)},x$=(e,t)=>{for(let r of[e,e.target]){if(!r)continue;let e=rv(r);if(rC(e,t))return e.getName()}},xP=(e,t,r)=>{if(rD.has(e.intrinsicName)||rS.has(e.intrinsicName))return;if(e.isUnion()){let n=e.types.map(e=>xP(e,t,r));if(1===new Set(n.map(e=>e?.typeName)).size){let[e]=n;if(e?.kind!=="map")return e;let r=n.map(e=>e?.valueType);return{...e,valueType:r.every(Boolean)?t.getUnionType(r):void 0}}if(n.every(e=>e?.kind==="map")){let e=n.map(e=>e.valueType);return{kind:"map",typeName:"Map",valueType:e.every(Boolean)?t.getUnionType(e):void 0}}return n.every(e=>e?.kind==="null-sentinel")?{kind:"null-sentinel",typeName:"null-sentinel"}:void 0}if(e.isIntersection())return e.types.map(e=>xP(e,t,r)).find(e=>e?.kind==="map");let n=x$(e,r);return xj(n,xp.has(n)?t.getTypeArguments(e).at(-1):void 0)},xL=(e,t)=>{let{parserServices:r}=t.sourceCode;if(r?.program)try{let{program:t}=r;return xP(r.getTypeAtLocation(e),t.getTypeChecker(),t)}catch{}},xN=(e,t)=>xL(e,t)??xR(e,t),xM=(e,t)=>"truthy"===t?!!e:"not-undefined"===t?void 0!==e:null!=e,xO=(e,t,r,n=new Set)=>{if(!e||xx.has(e.type))return!1;if(xh.has(e.type))return xO(e.typeAnnotation,t,r,n);if("TSTypeOperator"===e.type)return"readonly"===e.operator&&xO(e.typeAnnotation,t,r,n);if("TSUnionType"===e.type||"TSIntersectionType"===e.type)return e.types.every(e=>xO(e,t,r,n));if("TSNullKeyword"===e.type)return"not-undefined"===r;if(xb.has(e.type))return"truthy"!==r;if(xE.has(e.type))return!0;if("TSTypeLiteral"===e.type)return"truthy"!==r;if("TSLiteralType"===e.type){var o;let t="Literal"===(o=e.literal).type?o.value:"TemplateLiteral"===o.type&&0===o.expressions.length?o.quasis[0].value.cooked:"UnaryExpression"===o.type&&("-"===o.operator||"+"===o.operator)&&"Literal"===o.argument.type&&("number"==typeof o.argument.value||"bigint"==typeof o.argument.value)?"-"===o.operator?-o.argument.value:o.argument.value:void 0;return void 0!==t&&xM(t,r)}return"TSTypeReference"===e.type&&((e,t,r,n)=>{let o,a,i=xC(e.typeName);if(!i||n.has(i))return!1;n.add(i);let s=(a=xw(o=xT(i,t.sourceCode.getScope(e.typeName))))?{type:"alias",node:a}:o?.type==="ClassName"||o?.type==="Type"&&"TSInterfaceDeclaration"===o.node.type?{type:"object"}:void 0,l=!1;return s?.type==="alias"?l=xO(s.node,t,r,n):s?.type==="object"&&(l="truthy"!==r),n.delete(i),l})(e,t,r,n)},xq=(e,t)=>e.isTypeParameter?.()?e.getConstraint()??t.getBaseConstraintOfType(e):e,xU=(e,t,r)=>{if(rD.has(e.intrinsicName))return!1;let n=xq(e,t);return n&&n!==e?xU(n,t,r):!e.isTypeParameter?.()&&(e.isUnion()||e.isIntersection()?e.types.every(e=>xU(e,t,r)):!r.has(e.intrinsicName))},xW=(e,t,r)=>{if(rD.has(e.intrinsicName)||rS.has(e.intrinsicName))return!1;let n=xq(e,t);if(n&&n!==e)return xW(n,t,r);if(e.isUnion()||e.isIntersection())return e.types.every(e=>xW(e,t,r));if(xy.has(e.intrinsicName))return!1;if("true"===e.intrinsicName||"symbol"===e.intrinsicName)return!0;if(e.isStringLiteral?.())return e.value.length>0;if(e.isNumberLiteral?.())return 0!==e.value;if(e.isBigIntLiteral?.())return e.value.negative||"0"!==e.value.base10Value;let o=t.typeToString(e);return/^-?\d+n$/u.test(o)?!/^-?0n$/u.test(o):"object"===t.typeToString(e)||xm.has(x$(e,r))||e.getCallSignatures().length>0||e.getConstructSignatures().length>0},x_=(e,t,r)=>{if(!te(e)||"Identifier"!==e.callee.type||!xc.has(e.callee.name)||!xk(e.callee,t))return;if(0===e.arguments.length)return!0;if(1!==e.arguments.length)return;let[n]=e.arguments;if("ArrayExpression"===n.type)return n.elements.every(e=>{var n;let o;return e?.type==="ArrayExpression"&&e.elements.length>=2&&e.elements[1]&&"SpreadElement"!==e.elements[1].type&&(n=e.elements[1],(o=ew(n,t.sourceCode.getScope(n)))?xM(o.value,r):!tx(n)&&xD.has(n.type))})},xV=(e,t,r)=>{let n=x_(xv(e),t,r);if(void 0!==n)return n;let o=xL(e,t)?.valueType;if(o){let{program:e}=t.sourceCode.parserServices,n=e.getTypeChecker();if("truthy"===r?xW(o,n,e):"not-undefined"===r?xU(o,n,new Set(["undefined","void"])):xU(o,n,new Set(["undefined","void","null"])))return!0}return function e(t,r,n,o={}){let a,i=o.visitedVariables??new Set,s=o.checkConstructorValues??!0,l=xB(t,r);if(l?.kind==="map")return!!l.valueType&&xO(l.valueType,r,n);let u=((e,t,r,n)=>{if(!te(e)||"Identifier"!==e.callee.type||!xc.has(e.callee.name)||!xk(e.callee,t))return;if(n){let n=x_(e,t,r);if(void 0!==n)return n}let o=xA(e).at(-1);return!!o&&xO(o,t,r)})(t=xv(t),r,n,s);if(void 0!==u)return u;let p=((e,t,r)=>{if("Identifier"!==e.type)return;let n=ei(t.sourceCode.getScope(e),e);if(!(!n||r.has(n))&&1===n.defs.length)return n})(t,r,i);if(!p)return!1;i.add(p);let[c]=p.defs,d=(a=xF(c.name?.typeAnnotation,r.sourceCode.getScope(c.name)),a?.kind==="map"?!!a.valueType&&xO(a.valueType,r,n):"Variable"===c.type&&"const"===c.parent.kind&&c.node.id===c.name&&!!c.node.init&&e(c.node.init,r,n,{visitedVariables:i,checkConstructorValues:!1}));return i.delete(p),d}(e,t,r)},xz=e=>"Literal"===e.type&&null===e.value,xK="logical",xG="ternary",xJ="consistent-conditional-object-spread",xX=new Set(["==","==="]),xY=new Set(["!=","!=="]),xH=e=>"SpreadElement"===e.parent.type&&e.parent.argument===e&&"ObjectExpression"===e.parent.parent.type&&e.parent.parent.properties.includes(e.parent);function xZ(e,t,r){if(tQ(e,t))return!0;if(e.type!==t.type)return!1;switch(e.type){case"AwaitExpression":return xZ(e.argument,t.argument,r);case"LogicalExpression":return e.operator===t.operator&&xZ(e.left,t.left,r)&&xZ(e.right,t.right,r);case"UnaryExpression":return e.operator===t.operator&&e.prefix===t.prefix&&xZ(e.argument,t.argument,r);case"UpdateExpression":return!1}return r.getText(e)===r.getText(t)}function xQ(e){return e9(e)?"null":tx(e)?"undefined":void 0}function x0(e){if("BinaryExpression"!==e.type||!xX.has(e.operator)&&!xY.has(e.operator))return;let t=xQ(e.left),r=xQ(e.right);if(!!t!=!!r)return{reference:t?e.right:e.left,kind:2===e.operator.length?"nullish":t??r,isTrueWhenNullish:xX.has(e.operator)}}let x1=(e,t)=>"null"===e.kind&&"undefined"===t.kind||"undefined"===e.kind&&"null"===t.kind;function x2(e,t){let r=x0(e);if(r?.kind==="nullish")return r;if("LogicalExpression"!==e.type)return;let n=x0(e.left),o=x0(e.right);if(n&&o&&xZ(n.reference,o.reference,t)){if("||"===e.operator&&n.isTrueWhenNullish&&o.isTrueWhenNullish&&x1(n,o))return{reference:n.reference,isTrueWhenNullish:!0};if("&&"===e.operator&&!n.isTrueWhenNullish&&!o.isTrueWhenNullish&&x1(n,o))return{reference:n.reference,isTrueWhenNullish:!1}}}function x3(e,t,r){let n=eZ(e,r);return!eQ(e,r)&&n6(e,{operator:"&&",property:t})&&(n=`(${n})`),n}function x8(e,t){let r=eZ(e,t);return!eQ(e,t)&&nQ(e)&&(r=`(${r})`),r}let x6="default-export-style/inline",x9="default-export-style/separate",x5="default-export-style/suggestion-inline",x4="default-export-style/suggestion-separate",x7="inline",be="separate",bt="ignore",br="class",bn="function",bo=()=>({enum:[x7,be,bt]}),ba=(e,t)=>e?.type==="ExportDefaultDeclaration"&&"Identifier"===e.declaration.type&&e.declaration.name===t,bi=e=>e.id?.name,bs=e=>{switch(e.type){case"ClassDeclaration":return br;case"FunctionDeclaration":return bn}},bl=e=>e===br?"classes":"functions",bu=(e,t)=>{let[,r]=e.sourceCode.getRange(t),n=e.sourceCode.getLoc(t).end.line;return t6(e).some(t=>e.sourceCode.getRange(t)[0]>=r&&e.sourceCode.getLoc(t).start.line===n)},bp=(e,t)=>ei(e,t)?.references.some(e=>!e.init&&e.isWrite())??!1,bc=e=>!!e&&!!(e.type.startsWith("TS")||e.typeAnnotation||e.typeParameters||e.returnType||e.implements?.length>0||e.superTypeArguments||e.accessibility||e.readonly||e.override||e.definite||e.optional&&"MemberExpression"!==e.type&&"CallExpression"!==e.type||e.abstract||e.declare||e.decorators?.length>0),bd=(e,t)=>{if(bc(e))return!0;for(let r of t[e.type]??[]){let n=e[r];if(Array.isArray(n)){if(n.some(e=>e?.type&&bd(e,t)))return!0;continue}if(n?.type&&bd(n,t))return!0}return!1},bm=(e,t)=>e.params.every(e=>!rm(e,t.sourceCode.visitorKeys)),bf=(e,t,r)=>ei(e,t)?.references.some(e=>!e.init&&e.identifier!==r)??!1,bg=(e,t)=>{let r=bi(e);if(r){let t=bs(e);return t&&{kind:t,name:r,declaration:e}}let n=((e,t)=>{if("VariableDeclaration"!==e.type||"const"!==e.kind||1!==e.declarations.length)return;let[r]=e.declarations;if(!("Identifier"!==r.id.type||bc(r.id)||r.init?.type!=="ArrowFunctionExpression"||bd(r.init,t.sourceCode.visitorKeys)))return r})(e,t);if(n)return{kind:bn,name:n.id.name,declaration:e,functionNode:n.init}},by=(e,t)=>e.params.map(e=>t.getText(e)).join(", "),bh=({context:e,declaration:t,exportDeclaration:r,name:n,scope:o,rangeStartNode:a=t})=>{if(!(e.sourceCode.getCommentsInside(r).length>e.sourceCode.getCommentsInside(t).length||bf(o,t.id,"Identifier"===r.declaration.type?r.declaration:void 0))&&"FunctionDeclaration"===t.type&&!t.generator&&!bd(t,e.sourceCode.visitorKeys)&&0===e.sourceCode.getCommentsInside(t).length&&bm(t,e)&&!rm(t.body,e.sourceCode.visitorKeys))return[{messageId:x4,fix:o=>o.replaceTextRange([e.sourceCode.getRange(a)[0],e.sourceCode.getRange(r)[1]],`const ${n} = ${t.async?"async ":""}(${by(t,e.sourceCode)}) => ${e.sourceCode.getText(t.body)};
|
|
19
|
+
export default ${n};`)}]},bx=({context:e,declaration:t,exportDeclaration:r,expectedStyle:n,kind:o,name:a,scope:i})=>{if(!(n===bt||((e,t,r)=>{let[,n]=e.sourceCode.getRange(t),[o]=e.sourceCode.getRange(r);return t6(e).some(t=>{let[r,a]=e.sourceCode.getRange(t);return r>=n&&a<=o})})(e,t,r)||bp(i,r.declaration))&&(o!==bn||"FunctionDeclaration"!==t.type||!t.generator)&&!(o===bn&&"FunctionDeclaration"===t.type&&bd(t,e.sourceCode.visitorKeys))){if(n===x7)return"VariableDeclaration"===t.type?{node:r,messageId:x6,data:{kind:o},suggest:(({context:e,declaration:t,exportDeclaration:r,name:n,scope:o})=>{let[{id:a,init:i}]=t.declarations;if(!(e.sourceCode.getCommentsInside(r).length>0||bu(e,r)||e.sourceCode.getCommentsInside(t).length>e.sourceCode.getCommentsInside(i).length||bf(o,a,r.declaration))&&"ArrowFunctionExpression"===i.type&&!bd(i,e.sourceCode.visitorKeys)&&0===e.sourceCode.getCommentsInside(i).length&&bm(i,e)&&!rm(i.body,e.sourceCode.visitorKeys))return[{messageId:x5,data:{kind:bn},fix:o=>o.replaceTextRange([e.sourceCode.getRange(t)[0],e.sourceCode.getRange(r)[1]],`export default ${i.async?"async ":""}function ${n}(${by(i,e.sourceCode)}) ${"BlockStatement"===i.body.type?e.sourceCode.getText(i.body):`{ return ${eZ(i.body,e)}; }`}`)}]})({context:e,declaration:t,exportDeclaration:r,name:a,scope:i})}:o===br&&bd(t,e.sourceCode.visitorKeys)?void 0:e.sourceCode.getCommentsInside(r).length>0||bu(e,r)?{node:r,messageId:x6,data:{kind:o}}:{node:r,messageId:x6,data:{kind:o},fix:function*(n){yield n.insertTextBefore(t,"export default "),yield n.removeRange([e.sourceCode.getRange(t)[1],e.sourceCode.getRange(r)[1]])}};if(n===be&&o===bn&&"FunctionDeclaration"===t.type)return{node:r,messageId:x9,data:{kind:o,style:"const arrow function"},suggest:bh({context:e,declaration:t,exportDeclaration:r,name:a,scope:i})}}},bb=({context:e,exportDeclaration:t,expectedStyle:r,kind:n})=>{let{declaration:o}=t,a=bi(o),i=e.sourceCode.getScope(t);if(!(!a||r===bt||r===x7||bp(i,a)||n===bn&&(o.generator||bd(o,e.sourceCode.visitorKeys)))){if(n===bn)return{node:t,messageId:x9,data:{kind:n,style:"const arrow function"},suggest:bh({context:e,declaration:o,exportDeclaration:t,name:a,scope:i,rangeStartNode:t})};if(!(n===br&&bd(o,e.sourceCode.visitorKeys)))return e.sourceCode.getCommentsInside(t).length>e.sourceCode.getCommentsInside(o).length?{node:t,messageId:x9,data:{kind:n,style:"class declaration"}}:{node:t,messageId:x9,data:{kind:n,style:"class declaration"},fix:r=>{let{declaration:n}=t;return r.replaceText(t,`${e.sourceCode.getText(n)}
|
|
20
|
+
export default ${n.id.name};`)}}}},bE={create:e=>{let t=e.options[0];e.on("Program",r=>{for(let[n,o]of r.body.entries()){if("ExportDefaultDeclaration"===o.type){let{declaration:r}=o,n=bs(r),a=bi(r);if(!n||!a)continue;let i=bb({context:e,exportDeclaration:o,expectedStyle:t[bl(n)],kind:n});if(i)return i;continue}let a=r.body[n+1],i=bg(o,e);if(!i||!ba(a,i.name))continue;let s=bx({context:e,exportDeclaration:a,expectedStyle:t[bl(i.kind)],scope:e.sourceCode.getScope(a),...i});if(s)return s}})},meta:{type:"suggestion",docs:{description:"Enforce consistent default export declarations.",recommended:!0},fixable:"code",hasSuggestions:!0,schema:[{type:"object",properties:{functions:bo(),classes:bo()},additionalProperties:!1}],defaultOptions:[{functions:x7,classes:x7}],messages:{[x6]:"Prefer declaring this default-exported {{kind}} inline.",[x9]:"Prefer declaring this default-exported {{kind}} as a separate {{style}}.",[x5]:"Use an inline default {{kind}} declaration.",[x4]:"Use a separate const arrow function default export."},languages:["js/js"]}};function bD(e){for(;;){let t=ry(e);if(t!==e){e=t;continue}if(e?.type!=="ParenthesizedExpression")return e;e=e.expression}}function bS(e,t){return ei(t.sourceCode.getScope(e),e)}let bv="no-array-concat-in-loop",bC="no-array-front-mutation",bA=["stream.unshift","this.unshift","this.stream.unshift","process.stdin.unshift","process.stdout.unshift","process.stderr.unshift"],bT="no-array-sort-for-min-max/error",bw="no-array-sort-for-min-max/suggestion",bk=e=>e8(e)&&0===e.value,bI=(e,t)=>{if(!td(e,{methods:["sort","toSorted"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||rG(e.callee.object,t)||rh(e.callee.object))return;let[r]=e.arguments,n=(e=>{if(!tl(e)||e.async||e.generator||2!==e.params.length||e.params.some(e=>"Identifier"!==e.type))return;let t=ry((e=>{if("BlockStatement"!==e.body.type)return e.body;if(1!==e.body.body.length)return;let[t]=e.body.body;if("ReturnStatement"===t.type)return t.argument})(e));if(t?.type!=="BinaryExpression"||"-"!==t.operator)return;let[r,n]=e.params;if(r.name!==n.name){if(tQ(t.left,r)&&tQ(t.right,n))return"ascending";if(tQ(t.left,n)&&tQ(t.right,r))return"descending"}})(r);if(n)return{direction:n,node:e.callee.object}},bj=(e,t,r,n)=>{var o,a,i;let s=(o=t.direction,"first"===r?"ascending"===o?"min":"max":"ascending"===o?"max":"min"),l={node:e,messageId:bT,data:{method:s,extreme:"min"===s?"minimum":"maximum"}};if("Super"!==t.node.type&&0===n.sourceCode.getCommentsInside(e).length){let r,o=(a=t.node,i=n.sourceCode,r=nN(a)?i.getText(a):`(${i.getText(a)})`,`Math.${s}(...${r})`);l.suggest=[{messageId:bw,data:{replacement:o},fix:t=>t.replaceText(e,o)}]}return l},bF="no-boolean-sort-comparator",bB="no-boolean-sort-comparator/suggestion",bR=new Set(["sort","toSorted"]),b$=new Set([">",">=","<","<="]),bP=(e,t,r,n)=>(e=ry(e),t=ry(t),"Identifier"===e.type&&"Identifier"===t.type)?e.name===r.name&&t.name===n.name||e.name===n.name&&t.name===r.name:"MemberExpression"===e.type&&"MemberExpression"===t.type&&e.computed===t.computed&&(e.computed?!!tQ(e.property,t.property):e.property.name===t.property.name)&&bP(e.object,t.object,r,n),bL=(e,t)=>{for(;rg(e);){if(e.typeAnnotation&&nd(e.typeAnnotation,t,t.sourceCode.getScope(e)))return!0;e=e.expression}return!1},bN="no-chained-comparison/error",bM="no-chained-comparison/suggestion",bO=new Set(["<",">","<=",">="]),bq=new Set(["===","!==","==","!="]),bU=new Set([...bO,...bq]),bW=e=>"BinaryExpression"===e.type&&bU.has(e.operator),b_="no-constant-zero-expression/error",bV="no-constant-zero-expression/suggestion",bz="no-duplicate-logical-operands",bK="no-duplicate-logical-operands/suggestion",bG=new Set(["Identifier","ThisExpression","Literal"]),bJ=new Set(["Identifier","ThisExpression"]),bX=e=>{if(lx(e=ry(e)))return!1;switch(e.type){case"Identifier":case"Super":case"ThisExpression":return!0;case"MemberExpression":var t;return bX(e.object)&&(!e.computed||(t=ry(t=e.property),bG.has(t.type)));default:return!1}},bY="no-impossible-length-comparison",bH={"<":">","<=":">=",">":"<",">=":"<=","===":"===","!==":"!==","==":"==","!=":"!="},bZ="no-invalid-character-comparison",bQ=new Set(["==","===","!=","!=="]),b0=(e,t)=>!!(td(e,{method:"charAt",maximumArguments:1,optionalCall:!1,optionalMember:!1})&&nC(e.callee.object,t)||td(e,{method:"at",maximumArguments:1,optionalCall:!1,optionalMember:!1})&&nC(e.callee.object,t))||"MemberExpression"===e.type&&e.computed&&!e.optional&&(e=>{if(e8(e))return!0;if(!e1(e))return!1;let t=Number(e.value);return Number.isSafeInteger(t)&&t>=0&&String(t)===e.value})(e.property)&&nC(e.object,t),b1="no-loop-iterable-mutation",b2=["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"],b3=["add","clear","delete"],b8=["clear","delete","set"],b6={array:new Set(b2),set:new Set(b3),map:new Set(b8),unknown:new Set([...b2,...b3,...b8])},b9=new Set(["entries","keys","values"]),b5=new Set(["ArrowFunctionExpression","ClassDeclaration","ClassExpression","FunctionDeclaration","FunctionExpression"]);function b4(e,t){return rK(e,t)?"array":rY(e,t)?"set":rH(e,t)?"map":void 0}function b7(e){return"VariableDeclaration"===e.left.type?e.left.declarations[0].id:e.left}function Ee(e){return"Identifier"===(e=ry(e)).type?e:void 0}function Et(e){if("ArrayPattern"!==(e=ry(e)).type)return;let[t]=e.elements;return t&&Ee(t)}function Er(e,t){if(lx(e=ry(e)))return;if(lh(e))return{collectionKind:b4(e,t),reference:e,method:"direct"};if("CallExpression"!==e.type||"MemberExpression"!==e.callee.type||e.arguments.length>0)return;let r=eI(e.callee,t.sourceCode.getScope(e.callee));if(!(!b9.has(r)||lx(e.callee.object))&&lh(e.callee.object))return{collectionKind:b4(e.callee.object,t),reference:e.callee.object,method:r}}function En(e,t){let r=b7(e);return"keys"===t.method?Ee(r):"entries"===t.method||"direct"===t.method&&"set"!==t.collectionKind?Et(r):void 0}function Eo(e,t){let r,n;if("VariableDeclaration"!==e.left.type||"const"!==e.left.kind)return{collectionKind:t.collectionKind,iterable:t.reference,loopBody:e.body};let o=(r=b7(e),"entries"===t.method?Et(r):"direct"!==t.method||"map"!==t.collectionKind?Ee(r):void 0),a=En(e,t),i=(n=b7(e),"set"===t.collectionKind&&("direct"===t.method||"values"===t.method)?Ee(n):"direct"===t.method&&"map"!==t.collectionKind?Ee(n)??Et(n):En(e,t));return{addArgumentIdentifier:o,collectionKind:t.collectionKind,deleteArgumentIdentifier:i,iterable:t.reference,loopBody:e.body,setKeyIdentifier:a}}function*Ea(e){"Identifier"===(e=ry(e)).type?yield e:"MemberExpression"===e.type&&(yield*Ea(e.object),e.computed&&(yield*Ea(e.property)))}function Ei(e,t,r){if(!ly(e,t))return!1;let n=[...Ea(e)],o=[...Ea(t)];return n.length!==o.length||0===n.length?n.length===o.length:n.every((e,t)=>{var n;let a,i;return n=o[t],a=ei(r.sourceCode.getScope(e),e),i=ei(r.sourceCode.getScope(n),n),a||i?a===i:e.name===n.name})}function Es(e,t,r){let[n]=e.arguments;return!!(t&&n&&Ei(n,t,r))}function El(e,t,r,n){return"add"===r&&Es(e,t.addArgumentIdentifier,n)||"set"===r&&Es(e,t.setKeyIdentifier,n)}let Eu="no-selector-as-dom-name",Ep=["add","remove","contains","toggle","replace"],Ec=/^[#.]-?[A-Z_a-z][\w-]*$/u,Ed=new Set([".","#"]),Em=e=>Ed.has(e?.[0]),Ef=e=>e3(e)??("TemplateLiteral"===e.type&&e.quasis[0].value.cooked),Eg=(e,t,r,n)=>({node:e,messageId:Eu,fix:((e,t,r,n)=>{let o=((e,t)=>{let[r]=t.getRange(e);return[r+1,r+2]})(e,n);if(t.startsWith(r)&&n.text[o[0]]===r){if("TemplateLiteral"===e.type&&e.expressions.length>0){if(1!==e.expressions.length||e.quasis[0].value.cooked!==r||""!==e.quasis[1].value.cooked)return;return e=>e.removeRange(o)}if(Ec.test(t))return e=>e.removeRange(o)}})(e,t,r,n)}),Ey=(e,t)=>e.map(e=>({node:e,expectedPrefix:t})),Eh="no-useless-compound-assignment/error",Ex="no-useless-compound-assignment/remove",Eb="no-useless-compound-assignment/replace",EE=new Map([["+=",0],["-=",0],["*=",1],["/=",1],["**=",1]]),ED="no-useless-delete-check",ES="removeCheck",Ev={considerGetters:!0},EC=new Set(["Map","Set","WeakMap","WeakSet"]),EA=new Set(["ArrayExpression","ArrowFunctionExpression","ClassExpression","FunctionExpression","ObjectExpression"]),ET=new Set(["ClassName","FunctionName"]),Ew=new Set(["TSConstructorType","TSFunctionType","TSObjectKeyword"]),Ek=e=>null!==e&&("object"==typeof e||"function"==typeof e),EI=e=>!!Ew.has(e?.type)||e?.type==="TSUnionType"&&e.types.every(e=>EI(e)),Ej=(e,t)=>{if("Identifier"!==e.type)return!1;let r=ei(t.sourceCode.getScope(e),e);return r?.defs.some(e=>ET.has(e.type))??!1},EF=(e,t)=>{let r=ew(e,t.sourceCode.getScope(e));return r&&"symbol"!=typeof r.value&&!Ek(r.value)?String(r.value):void 0},EB=(e,t)=>{let r=ew(e,t.sourceCode.getScope(e));if(r)return Ek(r.value);let n=ra(ry(e),t);if(n){let e=ry(n),r=ew(e,t.sourceCode.getScope(e));if(r)return Ek(r.value);if(EA.has(e.type))return!0}return!Ej(ry(e),t)&&EI(((e,t)=>{if("Identifier"!==(e=ry(e)).type)return;let r=ei(t.sourceCode.getScope(e),e);return r?.defs[0]?.name?.typeAnnotation?.typeAnnotation??e.typeAnnotation?.typeAnnotation})(e,t))},ER=(e,t)=>!eP(e,t.sourceCode,Ev),E$=(e,t)=>td(e,{method:t,argumentsLength:1,computed:!1,optionalCall:!1,optionalMember:!1,allowSpreadElement:!1}),EP=(e,t,r)=>n=>{if(re(r,r.sourceCode.getRange(e)))return;let o=r.sourceCode.getText(t.parent);return o.trimEnd().endsWith(";")||(o+=";"),nW(r.sourceCode.getTokenBefore(e),r,o)&&(o=`;${o}`),n.replaceText(e,o)},EL="no-useless-logical-operand",EN=new Map([["&&",!0],["||",!1]]),EM=new Map([["&&",!1],["||",!0]]),EO=new Set(["FunctionExpression","ClassExpression","ObjectExpression"]),Eq="prefer-boolean-return",EU=new Set(["==","!=","===","!==","<","<=",">",">=","in","instanceof"]);function EW(e){if(e){if("BlockStatement"===e.type){let t=e.body.filter(({type:e})=>"EmptyStatement"!==e);if(1===t.length)return EW(t[0])}return e}}let E_=e=>{if(e?.type==="ReturnStatement"&&e.argument?.type==="Literal"&&"boolean"==typeof e.argument.value)return e.argument.value};function EV(e,t){switch(e.type){case"Literal":return"boolean"==typeof e.value;case"UnaryExpression":return["!","delete"].includes(e.operator);case"BinaryExpression":return EU.has(e.operator);case"LogicalExpression":return EV(e.left,t)&&EV(e.right,t);case"CallExpression":return tC(e,t)||"CallExpression"===e.type&&!e.optional&&"MemberExpression"===e.callee.type&&!e.callee.optional&&!e.callee.computed&&"Identifier"===e.callee.object.type&&"Array"===e.callee.object.name&&t.sourceCode.isGlobalReference(e.callee.object)&&"Identifier"===e.callee.property.type&&"isArray"===e.callee.property.name;default:return!1}}let Ez="prefer-continue",EK=new Set(["ClassDeclaration","FunctionDeclaration","TSEnumDeclaration","TSInterfaceDeclaration","TSModuleDeclaration","TSTypeAliasDeclaration"]),EG=new Set(["const","let"]),EJ=(e,t)=>{let r=e.text.lastIndexOf("\n",t-1)+1;return/^[\t ]*/.exec(e.text.slice(r,t))[0]},EX=(e,[t,r],n)=>{let[o,a]=n.getRange(e);return o>=t&&a<=r},EY=e=>"VariableDeclaration"===e.type&&"var"!==e.kind&&!EG.has(e.kind)||EK.has(e.type),EH=(e,t)=>{let r=t.getTokenAfter(t.getFirstToken(e)),n=t.getTokenBefore(e.consequent);return[t.getRange(r)[1],t.getRange(n)[0]]},EZ=(e,t)=>{if(e7(e,{name:"eval",optional:!1}))return!0;for(let r of t.visitorKeys[e.type]??[]){let n=e[r];if(Array.isArray(n)){for(let e of n)if(e&&EZ(e,t))return!0;continue}if(n&&EZ(n,t))return!0}return!1},EQ={create:e=>{let{maximumStatements:t}=e.options[0];e.on(tu,r=>{if("BlockStatement"!==r.body.type||1!==r.body.body.length)return;let[n]=r.body.body;if("IfStatement"!==n.type||n.alternate||("EmptyStatement"===n.consequent.type?0:"BlockStatement"===n.consequent.type?n.consequent.body.length:1)<=t)return;let o=((e,t)=>{if(((e,t)=>{let r,n,{sourceCode:o}=t;return((e,t)=>{let{sourceCode:r}=t,{consequent:n}=e;return!(EY(n)||"BlockStatement"===n.type&&n.body.some(e=>EY(e)))&&((e,t)=>{var r;let n=(r=e.consequent,"BlockStatement"!==r.type?[]:r.body.flatMap(e=>"VariableDeclaration"===e.type&&EG.has(e.kind)?t.getDeclaredVariables(e):[]));if(0===n.length)return!0;let o=new Set(n.map(e=>e.name));return!EZ(e.test,t)&&!((e,t,r)=>{let[n,o]=t.getRange(e),a=e=>e.references.some(e=>{let[a,i]=t.getRange(e.identifier);return a>=n&&i<=o&&r.has(e.identifier.name)&&!(e.resolved&&e.resolved.identifiers.some(e=>EX(e,[n,o],t)))})||e.childScopes.some(e=>a(e));return a(t.getScope(e))})(e.test,t,o)})(e,r)&&!ro(n,t)})(e,t)&&(r=EH(e,o),n=o.getRange(e.consequent),!o.getCommentsInside(e).some(e=>!EX(e,r,o)&&!EX(e,n,o)))&&!("BlockStatement"!==e.consequent.type&&o.getText(e.consequent).includes("\n"))&&0===o.getCommentsAfter(e).length})(e,t))return r=>r.replaceText(e,((e,t)=>{let{sourceCode:r}=t,n=EJ(r,r.getRange(e)[0]),o=((e,t)=>{let r,n,{sourceCode:o}=t;if(r=EH(e,o),n=o.getRange(e.test),o.getCommentsInside(e).some(e=>EX(e,r,o)&&!EX(e,n,o))){let t=o.text.slice(...EH(e,o)).trimStart();return`!(${t})`}return((e,t)=>{let{sourceCode:r}=t;if("UnaryExpression"===e.type&&"!"===e.operator&&e.prefix){let n=r.getFirstToken(e),o=r.getRange(n),a=r.getRange(e),i=r.getRange(e.argument);return r.getCommentsInside(e).some(e=>r.getRange(e)[0]>=o[1]&&r.getRange(e)[1]<=i[0])?r.text.slice(o[1],a[1]).trim():eZ(e.argument,t)}let n=r.getText(e);return n8(e,"!")?`!(${n})`:`!${n}`})(e.test,t)})(e,t),a=((e,t)=>{let{consequent:r}=e;return"BlockStatement"===r.type?((e,t,r)=>{let n=r.getFirstToken(e),o=r.getLastToken(e),a=r.text.slice(r.getRange(n)[1],r.getRange(o)[0]);if(!a.includes("\n")){let e=a.trim();return e?`${EJ(r,r.getRange(t)[0])}${e}`:""}let i=a.split("\n");if(i[0]?.trim()===""&&i.shift(),i.at(-1)?.trim()===""&&i.pop(),0===i.length)return"";let s=r.getTokenAfter(n,{includeComments:!0}),l=EJ(r,r.getRange(t)[0]),u=s&&s!==o?EJ(r,r.getRange(s)[0]):`${l} `;return i.map(e=>""===e.trim()?"":e.startsWith(u)?`${l}${e.slice(u.length)}`:`${l}${e.trimStart()}`).join("\n")})(r,e,t):`${EJ(t,t.getRange(e)[0])}${t.getText(r).trim()}`})(e,r);return`if (${o}) {
|
|
21
|
+
${n} continue;
|
|
22
|
+
${n}}
|
|
23
|
+
|
|
24
|
+
${a}`})(e,t))})(n,e);return{node:n,messageId:Ez,...o&&{fix:o}}})},meta:{type:"suggestion",docs:{description:"Prefer early continues over whole-loop conditional wrapping.",recommended:!0},fixable:"code",schema:[{type:"object",additionalProperties:!1,properties:{maximumStatements:{type:"integer",minimum:0,description:"Maximum number of statements allowed in a whole-loop conditional wrapper."}}}],defaultOptions:[{maximumStatements:1}],messages:{[Ez]:"Prefer an early continue over wrapping the whole loop body in an `if` statement."},languages:["js/js"]}},E0="prefer-flat-math-min-max",E1=["min","max"],E2=(e,t)=>td(e,{object:"Math",method:t,optionalCall:!1,optionalMember:!1}),E3=(e,t)=>{let r=[];for(let n of e.arguments){if(E2(n,t)){r.push(...E3(n,t));continue}r.push(n)}return r},E8="prefer-hoisting-branch-code/start",E6="prefer-hoisting-branch-code/end",E9="prefer-hoisting-branch-code/suggestion",E5=new Set(["await using","using"]);function E4(e,t){if("TaggedTemplateExpression"===e.type||eP(e,t))return!0;for(let r of t.visitorKeys[e.type]??[]){let n=e[r];if(Array.isArray(n)){for(let e of n)if(e&&E4(e,t))return!0;continue}if(n&&E4(n,t))return!0}return!1}let E7=(e,t)=>{let r=t.getTokens(e),n=r.at(-1);return n?.type==="Punctuator"&&";"===n.value?r.slice(0,-1):r},De=(e,t,r)=>{let n=E7(e,r),o=E7(t,r);return 0!==n.length&&n.length===o.length&&n.every((e,t)=>e.type===o[t].type&&e.value===o[t].value)};function Dt(e,{leading:t,trailing:r,isStart:n},o){let{sourceCode:a}=o,{body:i}=e;if(n){let[e]=a.getRange(i[0]),[r]=a.getRange(i[t]);return[e,r]}let[,s]=a.getRange(i[i.length-r-1]),[,l]=a.getRange(i.at(-1));return[s,l]}function Dr({ifStatement:e,blocks:t,leading:r,trailing:n,isStart:o},a){var i;let{sourceCode:s}=a,l=t[0].body,u=o?l.slice(0,r):l.slice(l.length-n),p=u.every(e=>!rn(e))&&function(e){let{parent:t}=e;return["Program","BlockStatement","StaticBlock","SwitchCase"].includes(t.type)}(e)&&!((i={leading:r,trailing:n,isStart:o}).isStart&&((e,t)=>{let{sourceCode:r}=t,[n]=r.getRange(e),o=r.getTokenBefore(e);return re(t,[o?r.getRange(o)[1]:0,n])})(e,a)||!i.isStart&&((e,t)=>{let{sourceCode:r}=t,n=r.getCommentsAfter(e)[0];return!!(n&&r.getLoc(n).start.line===r.getLoc(e).end.line)})(e,a)||t.some(e=>{let{sourceCode:t}=a,[r]=t.getRange(e),[n]=t.getRange(e.body[0]);if(i.isStart&&re(a,[r+1,n]))return!0;if(!i.isStart){let[,r]=t.getRange(e.body.at(-1)),[,n]=t.getRange(e);if(re(a,[r,n-1]))return!0}return re(a,Dt(e,i,a))}))&&(o||t.every(e=>!function(e,t,r){let{sourceCode:n}=r,{body:o}=e,[a]=n.getRange(o[o.length-t]),[i,s]=n.getRange(e);for(let t of n.getScope(e).variables){let[e]=t.defs;if(!e||e.parent?.type==="VariableDeclaration"&&"var"===e.parent.kind)continue;let[r]=n.getRange(e.name);if(!(r<=i)&&!(r>=a)){if(e.parent?.type==="VariableDeclaration"&&E5.has(e.parent.kind))return!0;for(let e of t.references){let[t]=n.getRange(e.identifier);if(t>=a&&t<=s)return!0}}}return!1}(e,n,a))),c={loc:{start:s.getLoc(u[0]).start,end:s.getLoc(u.at(-1)).end},messageId:o?E8:E6};if(p){let i=function({ifStatement:e,blocks:t,leading:r,trailing:n,isStart:o},a){let{sourceCode:i}=a,s=t8(e,a),l=o?r:n,u=t[0].body,p=o?u.slice(0,l):u.slice(u.length-l),c=function(e,t,r){let{sourceCode:n}=r,[o]=n.getRange(e[0]),[,a]=n.getRange(e.at(-1)),i=n.text.slice(o,a),s=t8(e[0],r);return s===t?i:i.split("\n").map((e,r)=>0===r?e:e.startsWith(s)?`${t}${e.slice(s.length)}`:e).join("\n")}(p,s,a);return function*(l){if(o){let t=i.getTokenBefore(e),r=t&&nW(t,a,c)?";":"";yield l.insertTextBefore(e,`${r}${c}
|
|
25
|
+
${s}`)}else{let t=i.getLastToken(p.at(-1)),r=i.getTokenAfter(e),n=r&&nW(t,a,r.value)?";":"";yield l.insertTextAfter(e,`
|
|
26
|
+
${s}${c}${n}`)}for(let e of t)yield l.removeRange(Dt(e,{leading:r,trailing:n,isStart:o},a))}}({ifStatement:e,blocks:t,leading:r,trailing:n,isStart:o},a);!o||function(e,t){for(let r=e;r?.type==="IfStatement";r=r.alternate)if(E4(r.test,t))return!1;return!0}(e,s)&&u.every(e=>"ExpressionStatement"===e.type&&!E4(e,s))?c.fix=i:c.suggest=[{messageId:E9,fix:i}]}return c}let{parse:Dn}=im,Do="prefer-single-replace",Da=new Set(["g","m","s"]),Di=new Map([["\\",String.raw`\\`],["]",String.raw`\]`],["\n",String.raw`\n`],["\r",String.raw`\r`],[" ",String.raw`\t`],["\f",String.raw`\f`],["\v",String.raw`\v`],["\u2028",String.raw`\u2028`],["\u2029",String.raw`\u2029`]]);function Ds(e){if(!td(e,{methods:["replace","replaceAll"],argumentsLength:2,optionalCall:!1,optionalMember:!1,computed:!1}))return;let[t]=e.arguments;if(e1(t)){if("replaceAll"!==e.callee.property.name)return;return 1===t.value.length?t.value:void 0}if(e6(t))return function({pattern:e,flags:t}){let r;if(t.includes("g")){for(let e of t)if(!Da.has(e))return;try{r=Dn(e,t,{namedGroups:!0,lookbehind:!0})}catch{return}return function e(t){return"value"===t.type?String.fromCodePoint(t.codePoint):("alternative"!==t.type||1!==t.body.length)&&("characterClass"!==t.type||t.negative||1!==t.body.length)?void 0:e(t.body[0])}(r)}}(t.regex)}let Dl={configs:{node:{name:"@eslint-sukka/eslint-plugin-sukka-full node preset",plugins:{get sukka(){return Dl}},rules:{"sukka/unicorn/prefer-node-protocol":"error","sukka/unicorn/prefer-import-meta-properties":"error","no-process-exit":"off","sukka/unicorn/no-process-exit":"warn","no-buffer-constructor":"off","sukka/unicorn/no-new-buffer":"error"}},comment:{name:"@eslint-sukka/eslint-plugin-sukka-full comments preset",plugins:{get sukka(){return Dl}},rules:{"sukka/ban-eslint-disable":["error","allow-with-description"]}},recommended:{...u.eslint_plugin_sukka.configs.recommended,plugins:{get sukka(){return Dl}},rules:{...u.eslint_plugin_sukka.configs.recommended.rules,"sukka/prefer-single-boolean-return":"off","sukka/array/no-unneeded-flat-map":"error","sukka/browser/prefer-location-assign":"warn","sukka/jsx/no-template-literal":"error","sukka/jsx/no-unneeded-nested":"error","sukka/string/no-locale-case":"warn","sukka/string/no-simple-template-literal":"error","sukka/unicode/no-bidi":"warn","sukka/unicode/no-invisible":"warn","sukka/no-redundant-variable":"error","sukka/no-single-return":"warn","sukka/prefer-early-return":["error",{maximumStatements:16}],"sukka/prefer-fetch":"error","sukka/prefer-timer-id":"warn"}},recommended_unicorn:{name:"@eslint-sukka/eslint-plugin-sukka-full recommended unicorn preset",plugins:{get sukka(){return Dl}},rules:{"sukka/unicorn/no-lonely-if":"error","sukka/unicorn/no-negated-condition":"warn","sukka/unicorn/catch-error-name":["error",{ignore:[/^(?:e|err|error|\w+Err|\w+Error)[\d_]?$/]}],"sukka/unicorn/custom-error-definition":"error","sukka/unicorn/require-array-join-separator":"warn","sukka/unicorn/no-thenable":"error","sukka/unicorn/no-invalid-remove-event-listener":"error","sukka/unicorn/consistent-function-scoping":"warn","sukka/unicorn/prefer-event-target":"warn","sukka/unicorn/prefer-keyboard-event-key":"warn","sukka/unicorn/prefer-text-content":"warn","sukka/unicorn/no-console-spaces":"warn","sukka/unicorn/no-empty-file":"warn","sukka/unicorn/no-useless-fallback-in-spread":"warn","sukka/unicorn/no-useless-length-check":"warn","sukka/unicorn/no-useless-promise-resolve-reject":"warn","sukka/unicorn/no-zero-fractions":"warn","sukka/unicorn/prefer-export-from":["warn",{checkUsedVariables:!1}],"sukka/unicorn/prefer-native-coercion-functions":"warn","sukka/unicorn/prefer-negative-index":"warn","sukka/unicorn/no-document-cookie":"error","sukka/unicorn/prefer-add-event-listener":"warn","sukka/unicorn/prefer-array-index-of":"warn","sukka/unicorn/prefer-blob-reading-methods":"warn","sukka/unicorn/prefer-date-now":"warn","sukka/unicorn/dom-node-dataset":"warn","sukka/unicorn/prefer-modern-math-apis":"warn","sukka/unicorn/number-literal-case":"error","sukka/unicorn/prefer-number-properties":["warn",{checkInfinity:!1}],"sukka/unicorn/prefer-reflect-apply":"warn","sukka/unicorn/prefer-set-size":"warn","sukka/unicorn/prefer-string-replace-all":"warn","sukka/unicorn/prefer-string-slice":"warn","sukka/unicorn/prefer-string-trim-start-end":"warn","sukka/unicorn/no-unreadable-iife":"warn","sukka/unicorn/throw-new-error":"warn","sukka/unicorn/escape-case":"warn","sukka/unicorn/prefer-unicode-code-point-escapes":"warn","sukka/unicorn/prefer-prototype-methods":"warn","sukka/unicorn/error-message":"error","sukka/unicorn/no-instanceof-builtins":["error",{strategy:"loose"}],"sukka/unicorn/prefer-type-error":"error","sukka/unicorn/consistent-destructuring":"warn","sukka/unicorn/new-for-builtins":"warn","sukka/unicorn/prefer-single-call":"warn","sukka/unicorn/no-static-only-class":"warn","sukka/unicorn/no-unreadable-array-destructuring":"error","sukka/unicorn/no-useless-spread":"error","sukka/unicorn/no-useless-switch-case":"warn","sukka/unicorn/no-useless-undefined":["error",{checkArguments:!1}],"sukka/unicorn/numeric-separators-style":["warn",{onlyIfContainsSeparator:!1,number:{minimumDigits:7,groupLength:3},binary:{minimumDigits:9,groupLength:4},octal:{minimumDigits:9,groupLength:4},hexadecimal:{minimumDigits:5,groupLength:2}}],"sukka/unicorn/prefer-array-find":"warn","sukka/unicorn/prefer-array-flat-map":"warn","sukka/unicorn/prefer-array-flat":"warn","sukka/unicorn/prefer-array-some":"warn","sukka/unicorn/prefer-code-point":"warn","sukka/unicorn/prefer-default-parameters":"warn","sukka/unicorn/prefer-logical-operator-over-ternary":"warn","sukka/unicorn/prefer-optional-catch-binding":"error","sukka/unicorn/prefer-regexp-test":"warn","sukka/unicorn/prefer-set-has":"error","sukka/unicorn/prefer-switch":"warn","sukka/unicorn/require-number-to-fixed-digits-argument":"warn","sukka/unicorn/prefer-string-raw":"warn","sukka/unicorn/no-single-promise-in-promise-methods":"error","sukka/unicorn/no-await-in-promise-methods":"error","sukka/unicorn/no-magic-array-flat-depth":"error","sukka/unicorn/no-object-as-default-parameter":"error","sukka/unicorn/template-indent":["warn",{tags:["outdent","dedent","gql","sql","html","styled","css"],functions:["dedent","stripIndent","strip_indent","stripTags","striptags","strip_tags","stripHtml","stripHTML","strip_html"],selectors:[],comments:["HTML","html","CSS","css","indent"]}],"sukka/unicorn/no-negation-in-equality-check":"error","sukka/unicorn/no-unnecessary-slice-end":"error","sukka/unicorn/consistent-date-clone":"error","sukka/unicorn/no-accessor-recursion":"error","sukka/unicorn/no-unnecessary-array-flat-depth":"error","sukka/unicorn/no-unnecessary-array-splice-count":"error","sukka/unicorn/no-useless-error-capture-stack-trace":"error","sukka/unicorn/prefer-class-fields":"error","sukka/unicorn/prefer-bigint-literals":"error","sukka/unicorn/prefer-classlist-toggle":"warn","sukka/unicorn/require-module-attributes":"error","sukka/unicorn/no-immediate-mutation":"error","sukka/unicorn/no-useless-collection-argument":"error","sukka/unicorn/prefer-response-static-json":"error","sukka/unicorn/consistent-template-literal-escape":"error","sukka/unicorn/no-useless-iterator-to-array":"error","sukka/unicorn/prefer-simple-condition-first":"error","sukka/unicorn/switch-case-break-position":"error","sukka/unicorn/better-dom-traversing":"warn","sukka/unicorn/no-blob-to-file":"error","sukka/unicorn/no-canvas-to-image":"warn","sukka/unicorn/no-confusing-array-splice":"error","sukka/unicorn/no-duplicate-set-values":"error","sukka/unicorn/no-incorrect-query-selector":"error","sukka/unicorn/no-invalid-file-input-accept":"error","sukka/unicorn/no-late-current-target-access":"error","sukka/unicorn/no-unused-array-method-return":"error","sukka/unicorn/prefer-array-last-methods":"warn","sukka/unicorn/prefer-math-abs":"warn","sukka/unicorn/prefer-split-limit":"warn","sukka/unicorn/prefer-queue-microtask":"warn","sukka/unicorn/prefer-string-pad-start-end":"warn","sukka/unicorn/require-css-escape":"error","sukka/unicorn/require-passive-events":"warn","sukka/unicorn/class-reference-in-static-methods":"warn","sukka/unicorn/consistent-optional-chaining":"error","sukka/unicorn/explicit-timer-delay":"warn","sukka/unicorn/no-confusing-array-with":"error","sukka/unicorn/no-duplicate-loops":"warn","sukka/unicorn/no-declarations-before-early-exit":"warn","sukka/unicorn/no-optional-chaining-on-undeclared-variable":"error","sukka/unicorn/no-object-methods-with-collections":"error","sukka/unicorn/no-subtraction-comparison":"warn","sukka/unicorn/no-unnecessary-global-this":"warn","sukka/unicorn/no-useless-else":"error","sukka/unicorn/no-useless-recursion":"error","sukka/unicorn/prefer-add-event-listener-options":"warn","sukka/unicorn/prefer-direct-iteration":"warn","sukka/unicorn/prefer-number-is-safe-integer":"warn","sukka/unicorn/prefer-object-define-properties":"warn","sukka/unicorn/prefer-object-destructuring-defaults":"warn","sukka/unicorn/prefer-single-object-destructuring":"warn","sukka/unicorn/prefer-smaller-scope":"warn","sukka/unicorn/prefer-single-array-predicate":"warn","sukka/unicorn/prefer-url-href":"warn","sukka/unicorn/require-proxy-trap-boolean-return":"error","sukka/unicorn/logical-assignment-operators":"error","sukka/unicorn/no-useless-coercion":"error","sukka/unicorn/no-useless-boolean-cast":"warn","sukka/unicorn/no-useless-continue":"error","sukka/unicorn/no-useless-override":"error","sukka/unicorn/prefer-has-check":"warn","sukka/unicorn/consistent-conditional-object-spread":"error","sukka/unicorn/no-boolean-sort-comparator":"error","sukka/unicorn/no-chained-comparison":"error","sukka/unicorn/no-constant-zero-expression":"error","sukka/unicorn/no-duplicate-logical-operands":"error","sukka/unicorn/no-impossible-length-comparison":"error","sukka/unicorn/no-invalid-character-comparison":"error","sukka/unicorn/no-loop-iterable-mutation":"error","sukka/unicorn/no-selector-as-dom-name":"error","sukka/unicorn/no-array-concat-in-loop":"error","sukka/unicorn/no-array-front-mutation":"warn","sukka/unicorn/no-array-sort-for-min-max":"warn","sukka/unicorn/no-useless-compound-assignment":"warn","sukka/unicorn/no-useless-delete-check":"warn","sukka/unicorn/no-useless-logical-operand":"error","sukka/unicorn/prefer-boolean-return":"warn","sukka/unicorn/prefer-continue":"warn","sukka/unicorn/prefer-flat-math-min-max":"warn","sukka/unicorn/prefer-hoisting-branch-code":"warn","sukka/unicorn/prefer-single-replace":"warn"}},stylistic_unicorn:{name:"@eslint-sukka/eslint-plugin-sukka-full stylistic unicorn preset",plugins:{get sukka(){return Dl}},rules:{"sukka/unicorn/no-nested-ternary":"warn","sukka/unicorn/filename-case":["error",{cases:{kebabCase:!0,snakeCase:!0},ignore:[/fixtures/i,/^_/,/^\./,/rc$/i,/\.(md|json|yaml|toml|yml|ini|conf|jsonc|json5)$/i]}],"sukka/unicorn/no-unnecessary-nested-ternary":"error","sukka/unicorn/no-unreadable-object-destructuring":"error","sukka/unicorn/consistent-compound-words":"warn","sukka/unicorn/default-export-style":"warn"}},recommended_extra_with_typed_lint:{...u.eslint_plugin_sukka.configs.recommended_extra_with_typed_lint,plugins:{get sukka(){return Dl}},rules:{...u.eslint_plugin_sukka.configs.recommended_extra_with_typed_lint.rules,"sukka/string/no-unneeded-to-string":"error","sukka/type/no-force-cast-via-top-type":"error","sukka/type/no-wrapper-type-reference":"error","sukka/no-default-error":"off"}},recommended_react:{...u.eslint_plugin_sukka.configs.recommended_react,plugins:{get sukka(){return Dl}}}},rules:Object.assign(u.eslint_plugin_sukka.rules,{"array/no-unneeded-flat-map":A,"browser/prefer-location-assign":w,"jsx/no-template-literal":I,"jsx/no-unneeded-nested":j,"string/no-locale-case":B,"string/no-simple-template-literal":R,"unicode/no-bidi":q,"unicode/no-invisible":W,"no-redundant-variable":_,"no-single-return":z,"prefer-early-return":G,"prefer-fetch":J,"prefer-timer-id":H,"string/no-unneeded-to-string":Z,"type/no-force-cast-via-top-type":Q,"type/no-wrapper-type-reference":et,"no-default-error":er},Object.fromEntries(Object.entries({"unicorn/catch-error-name":pW,"unicorn/custom-error-definition":{create:e=>{e.on("ClassDeclaration",t=>ce(e,t)),e.on("AssignmentExpression",t=>{if("ClassExpression"===t.right.type)return ce(e,t.right)}),e.on("AssignmentExpression",e=>{if("MemberExpression"===e.left.type&&"Identifier"===e.left.object.type&&"exports"===e.left.object.name){let t=e.right;if("ClassExpression"!==t.type||!pZ(t)||!t.id)return;let r=t.id.name;return e.left.property.name!==r?{node:e.left.property,messageId:p_,fix:t=>t.replaceText(e.left.property,r)}:void 0}})},meta:{type:"problem",docs:{description:"Enforce correct `Error` subclassing.",recommended:!1},fixable:"code",messages:{[p_]:"Exported error name should match error class",[pV]:"Do not pass the error message to `super()` when the class defines a `message` accessor.",[pz]:"Do not assign to `this.message` when the class defines a `message` getter without a setter.",[pK]:"Error constructors should accept `options` as the second parameter.",[pG]:"Error constructors should use `options` as the second parameter.",[pJ]:"Pass the error message to `super()` as the first argument.",[pX]:"Pass `options` to `super()` as the second argument."},languages:["js/js"]}},"unicorn/no-nested-ternary":{create:e=>{e.on("ConditionalExpression",t=>{if([t.test,t.consequent,t.alternate].some(e=>"ConditionalExpression"===e.type))return;let{sourceCode:r}=e,n=r.getAncestors(t).toReversed(),o=n.findIndex(e=>"ConditionalExpression"!==e.type);return 1!==o||eQ(t,e)?o>1?{node:o>2?n[o-3]:t,messageId:oi}:void 0:{node:t,messageId:os,fix:e=>[e.insertTextBefore(t,"("),e.insertTextAfter(t,")")]}})},meta:{type:"suggestion",docs:{description:"Disallow nested ternary expressions.",recommended:!0},fixable:"code",messages:{[oi]:"Do not nest ternary expressions.",[os]:"Nested ternary expression should be parenthesized."},languages:["js/js"]}},"unicorn/prefer-event-target":{create:e=>{e.on("Identifier",t=>{if("EventEmitter"!==t.name||("ClassDeclaration"!==t.parent.type&&"ClassExpression"!==t.parent.type||t.parent.superClass!==t)&&("NewExpression"!==t.parent.type||t.parent.callee!==t))return;let r=e.sourceCode.getScope(t);if(!function(e){if(!e)return!1;let t=function(e,t){let r=e=>e.type===t;for(;e.parent;e=e.parent)if(r(e))return e}(e,"ImportDeclaration");return!!(ou.has(t?.source.value)||"Property"===e.parent.type&&e.parent.value===e&&"Identifier"===e.parent.key.type&&"EventEmitter"===e.parent.key.name&&"ObjectPattern"===e.parent.parent.type&&e.parent.parent.properties.includes(e.parent)&&op(e.parent.parent)&&oc(e.parent.parent.parent.init))||!!(op(e)&&tc(e.parent.init,{property:"EventEmitter",optional:!1,computed:!1})&&oc(e.parent.init.object))}(ei(r,t)?.defs[0]?.name))return{node:t,messageId:ol}})},meta:{type:"suggestion",docs:{description:"Prefer `EventTarget` over `EventEmitter`.",recommended:"unopinionated"},messages:{[ol]:"Prefer `EventTarget` over `EventEmitter`."},languages:["js/js"]}},"unicorn/prefer-keyboard-event-key":{create:e=>{e.on("Identifier",t=>{if(og.has(t.name)){for(let r of oE(e,t))if(r.references?.some(e=>ob(t,e.identifier)))return oD(t,r)}}),e.on("Property",t=>{let r;if("Identifier"===t.key.type&&og.has(t.key.name)&&"Property"===(r=t.key).parent.type&&r.parent.key===r&&"ObjectPattern"===r.parent.parent.type&&!r.parent.computed){for(let r of oE(e,t))if(ov(t.key,r))return oD(t.key,r);for(let r of oE(e,t))if(oS(t.key,r))return oD(t.key,r)}})},meta:{type:"suggestion",docs:{description:"Prefer `KeyboardEvent#key` over deprecated keyboard event properties.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[om]:"Use `.key` instead of `.{{name}}`.",[of]:"Use `.key` with `{{key}}`."},languages:["js/js"]}},"unicorn/prefer-text-content":{create:e=>{e.on("MemberExpression",t=>{if(!tc(t,{property:"innerText"})||r1(t.object,e))return;let r=t.property;return{node:r,messageId:oC,suggest:[{messageId:oA,fix:e=>e.replaceText(r,"textContent")}]}}),e.on("Identifier",t=>{if("innerText"===t.name&&"Property"===t.parent.type&&t.parent.key===t&&!t.parent.computed&&"init"===t.parent.kind&&"ObjectPattern"===t.parent.parent.type&&t.parent.parent.properties.includes(t.parent)&&!((e,t)=>{if(r1(e,t))return!0;let{parent:r}=e;return"VariableDeclarator"===r.type?r.id===e&&r.init&&r1(r.init,t):"AssignmentExpression"===r.type&&r.left===e&&r1(r.right,t)})(t.parent.parent,e))return{node:t,messageId:oC,suggest:[{messageId:oA,fix:e=>e.replaceText(t,t.parent.shorthand?"textContent: innerText":"textContent")}]}})},meta:{type:"suggestion",docs:{description:"Prefer `.textContent` over `.innerText`.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[oC]:"Prefer `.textContent` over `.innerText`.",[oA]:"Switch to `.textContent`."},languages:["js/js"]}},"unicorn/require-array-join-separator":{create:e=>{e.on("CallExpression",t=>{if(!(td(t,{method:"join",argumentsLength:0,optionalCall:!1})||td(t,{method:"call",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&tb(t.callee.object,{property:"join"}))||0===t.arguments.length&&rX(t.callee.object,e))return;let{sourceCode:r}=e,[n,o]=r.getLastTokens(t,2),a=1===t.arguments.length;return{loc:{start:r.getLoc(n)[a?"end":"start"],end:r.getLoc(o).end},messageId:oz,fix:r=>ow(r,t,"','",e)}})},meta:{type:"suggestion",docs:{description:"Enforce using the separator argument with `Array#join()`.",recommended:"unopinionated"},fixable:"code",messages:{[oz]:"Missing the separator argument."},languages:["js/js"]}},"unicorn/no-thenable":{create:e=>{for(let{selector:t,selectors:r,messageId:n,getNodes:o}of oH)e.on(t??r,function*(t){for(let r of o(t,e))yield{node:r,messageId:n}})},meta:{type:"problem",docs:{description:"Disallow `then` property.",recommended:"unopinionated"},messages:{[oK]:"Do not add `then` to an object.",[oG]:"Do not export `then`.",[oJ]:"Do not add `then` to a class."},languages:["js/js"]}},"unicorn/no-invalid-remove-event-listener":{create:e=>{e.on("CallExpression",t=>{if(!(td(t,{method:"removeEventListener",minimumArguments:2,optionalCall:!1})&&"SpreadElement"!==t.arguments[0].type&&("FunctionExpression"===t.arguments[1].type||"ArrowFunctionExpression"===t.arguments[1].type||td(t.arguments[1],{method:"bind",optionalCall:!1,optionalMember:!1}))))return;let[,r]=t.arguments;return["ArrowFunctionExpression","FunctionExpression"].includes(r.type)?{node:r,loc:eh(r,e.sourceCode),messageId:oZ}:{node:r.callee.property,messageId:oZ}})},meta:{type:"problem",docs:{description:"Prevent calling `EventTarget#removeEventListener()` with the result of an expression.",recommended:"unopinionated"},messages:{[oZ]:"The listener argument should be a function reference."},languages:["js/js"]}},"unicorn/consistent-function-scoping":o9,"unicorn/no-new-buffer":{create:e=>{let{sourceCode:t}=e;e.on("NewExpression",r=>{if(!te(r,{name:"Buffer"}))return;let n=((e,t)=>{if(1!==e.length)return"from";let[r]=e;if("SpreadElement"===r.type)return;if("ArrayExpression"===r.type||"TemplateLiteral"===r.type)return"from";if(nr(r,t))return"alloc";let n=ew(r,t);if(n){let{value:e}=n;if("string"==typeof e||Array.isArray(e))return"from"}})(r.arguments,t.getScope(r));return n?{node:r,messageId:o5,data:{method:n},fix:ae(r,e,n)}:{node:r,messageId:o4,suggest:["from","alloc"].map(t=>({messageId:o7,data:{replacement:t},fix:ae(r,e,t)}))}})},meta:{type:"problem",docs:{description:"Enforce the use of `Buffer.from()` and `Buffer.alloc()` instead of the deprecated `new Buffer()`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[o5]:"`new Buffer()` is deprecated, use `Buffer.{{method}}()` instead.",[o4]:"`new Buffer()` is deprecated, use `Buffer.alloc()` or `Buffer.from()` instead.",[o7]:"Switch to `Buffer.{{replacement}}()`."},languages:["js/js"]}},"unicorn/no-console-spaces":{create:e=>{let{sourceCode:t}=e,r=(r,n,o)=>{let[a,i]=t.getRange(r),s="leading"===o?a+1:i-2,l=[s,s+1];return{loc:n7(l,e),messageId:at,data:{method:n,position:o},fix:e=>e.removeRange(l)}};e.on("CallExpression",function*(e){if(!td(e,{object:"console",methods:["log","debug","info","warn","error"],minimumArguments:1,optionalCall:!1,optionalMember:!1}))return;let n=e.callee.property.name,{arguments:o}=e,{length:a}=o;for(let[e,i]of o.entries()){if(!e1(i)&&"TemplateLiteral"!==i.type)continue;let o=t.getText(i).slice(1,-1);0!==e&&ar(o)&&(yield r(i,n,"leading")),e!==a-1&&an(o)&&(yield r(i,n,"trailing"))}})},meta:{type:"suggestion",docs:{description:"Do not use leading/trailing space between `console.log` parameters.",recommended:"unopinionated"},fixable:"code",messages:{[at]:"Do not use {{position}} space between `console.{{method}}` parameters."},languages:["js/js"]}},"unicorn/no-empty-file":aa,"unicorn/no-useless-fallback-in-spread":{create:e=>{e.on("ObjectExpression",t=>{if(ta(t)&&"LogicalExpression"===t.parent.type&&t.parent.right===t&&("||"===t.parent.operator||"??"===t.parent.operator)&&"SpreadElement"===t.parent.parent.type&&t.parent.parent.argument===t.parent&&"ObjectExpression"===t.parent.parent.parent.type&&t.parent.parent.parent.properties.includes(t.parent.parent))return{node:t,messageId:ai,*fix(r,{abort:n}){let{sourceCode:o}=e,a=t.parent;if(o.getCommentsInside(a).length>0)return n();let{left:i}=a,s=eQ(i,e),[,l]=s?eH(i,e):o.getRange(i),[,u]=o.getRange(a);yield r.removeRange([l,u]),(s||"SequenceExpression"!==i.type)&&(yield oT(a,r,e))}}})},meta:{type:"suggestion",docs:{description:"Disallow useless fallback when spreading in object literals.",recommended:"unopinionated"},fixable:"code",messages:{[ai]:"The empty object is useless."},languages:["js/js"]}},"unicorn/no-useless-length-check":{create:e=>{let t=[],r=new Set,n=new Set,o=new Set,a=new Set;e.on("BinaryExpression",e=>{if(!("BinaryExpression"===e.type&&"Literal"===e.right.type&&"0"===e.right.raw&&tc(e.left,{property:"length",optional:!1})&&tE(e.parent)))return;let{operator:t}=e;"==="===t?r.add(e):(">"===t||"!=="===t)&&n.add(e)}),e.on("CallExpression",t=>{td(t,{optionalCall:!1,optionalMember:!1,computed:!1})&&"Identifier"===t.callee.property.type&&!rG(t.callee.object,e)&&("some"===t.callee.property.name?o.add(t):"every"===t.callee.property.name&&a.add(t))}),e.on("LogicalExpression",e=>{tE(e)&&t.push(e)}),e.on("Program:exit",function*(){let i=new Set(t.flatMap(e=>(function(e){let{operator:t}=e;return(function e(t){return[t.left,t.right].flatMap(r=>"LogicalExpression"===r.type&&r.operator===t.operator?e(r):[r])})(e).filter((e,i,s)=>(function({node:e,operator:t,siblings:i}){return"||"===t&&r.has(e)&&i.some(t=>a.has(t)&&tQ(e.left.object,t.callee.object))||"&&"===t&&n.has(e)&&i.some(t=>o.has(t)&&tQ(e.left.object,t.callee.object))})({node:e,operator:t,siblings:[s[i-1],s[i+1]].filter(Boolean)}))})(e))),{sourceCode:s}=e;for(let t of i)yield{loc:{start:s.getLoc(t.left.property).start,end:s.getLoc(t).end},messageId:r.has(t)?"zero":"non-zero",fix(r){let{left:n,right:o}=t.parent,a=eH(n,e),i=eH(o,e),s=[];return n===t?(s[0]=a[0],s[1]=i[0]):(s[0]=a[1],s[1]=i[1]),r.removeRange(s)}}})},meta:{type:"suggestion",docs:{description:"Disallow useless array length check.",recommended:"unopinionated"},fixable:"code",messages:{"non-zero":"The non-empty check is useless as `Array#some()` returns `false` for an empty array.",zero:"The empty check is useless as `Array#every()` returns `true` for an empty array."},languages:["js/js"]}},"unicorn/no-useless-promise-resolve-reject":{create:e=>{e.on("CallExpression",t=>{if(!(td(t,{object:"Promise",methods:["resolve","reject"],optionalCall:!1,optionalMember:!1})&&("ArrowFunctionExpression"===t.parent.type&&t.parent.body===t||"ReturnStatement"===t.parent.type&&t.parent.argument===t||"YieldExpression"===t.parent.type&&!t.parent.delegate&&t.parent.argument===t)))return;let{functionNode:r,isInTryStatement:n}=function(e){let t,r=!1;for(;e;e=e.parent){if(tl(e)){t=e;break}"TryStatement"===e.type&&(r=!0)}return{functionNode:t,isInTryStatement:r}}(t);if(r&&(r.async||function(e){if("CallExpression"===e.parent.type&&"MemberExpression"===e.parent.callee.type&&!e.parent.callee.computed&&"Identifier"===e.parent.callee.property.type){let{callee:{property:t},arguments:r}=e.parent;if(1===r.length&&["then","catch","finally"].includes(t.name)&&r[0]===e||2===r.length&&"then"===t.name&&(r[0]===e||"SpreadElement"!==r[0].type&&r[1]===e))return!0}return!1}(r)))return function(e,t){let{callee:r,parent:n}=e,o=r.property.name;return{node:r,messageId:o,data:{type:"YieldExpression"===n.type?"yield":"return"},fix:t}}(t,function(e,t,r){if(e.arguments.length>1)return;let{callee:n,parent:o,arguments:a}=e,[i]=a;if(i?.type==="SpreadElement")return;let s="reject"===n.property.name,l="YieldExpression"===o.type;if(!s||!t&&(!l||"ExpressionStatement"===o.parent.type))return function(t){let n="ArrowFunctionExpression"===o.type,a=i?r.sourceCode.getText(i):"";if(i?.type==="SequenceExpression"&&(a=`(${a})`),s){if(a||="undefined",a=`throw ${a}`,l)return t.replaceTextRange(eH(o,r),a);if(a+=";",n)return a=`{ ${a} }`,t.replaceTextRange(eH(e,r),a)}else l?a=`yield${a?" ":""}${a}`:"ReturnStatement"===o.type?a=`return${a?" ":""}${a};`:(i?.type==="ObjectExpression"&&(a=`(${a})`),a||="{}");return t.replaceText(n?e:o,a)}}(t,n,e))})},meta:{type:"suggestion",docs:{description:"Disallow returning/yielding `Promise.resolve/reject()` in async functions or promise callbacks",recommended:"unopinionated"},fixable:"code",messages:{resolve:"Prefer `{{type}} value` over `{{type}} Promise.resolve(value)`.",reject:"Prefer `throw error` over `{{type}} Promise.reject(error)`."},languages:["js/js"]}},"unicorn/no-zero-fractions":{create:e=>{e.on("Literal",t=>{if(!e8(t))return;let{raw:r}=t,n=r.match(/^(?<before>[\d_]*)(?<dotAndFractions>\.[\d_]*)(?<after>.*)$/);if(!n)return;let{before:o,dotAndFractions:a,after:i}=n.groups,s=(o+a.replaceAll(/[.0_]+$/g,"")||"0")+i;if(s===r)return;let l="."===a,{sourceCode:u}=e,p=u.getRange(t)[0]+o.length+a.length;return{loc:n7([p-(r.length-s.length),p],e),messageId:l?al:as,*fix(r){let n=s;"MemberExpression"===t.parent.type&&t.parent.object===t&&n0.test(s)&&!eQ(t,e)&&(n=`(${n})`,nW(u.getTokenBefore(t),e,n)&&(n=`;${n}`)),yield r.replaceText(t,n),yield oP(r,t,e)}}})},meta:{type:"suggestion",docs:{description:"Disallow number literals with zero fractions or dangling dots.",recommended:"unopinionated"},fixable:"code",messages:{[as]:"Don't use a zero fraction in the number.",[al]:"Don't use a dangling dot in the number."},languages:["js/js"]}},"unicorn/prefer-export-from":ah,"unicorn/prefer-native-coercion-functions":{create:e=>{e.on(ts,t=>{if(t.async||t.generator||t.returnType?.type==="TSTypeAnnotation"&&"TSTypePredicate"===t.returnType.typeAnnotation.type||0===t.params.length||"Identifier"!==t.params[0].type||("MethodDefinition"===t.parent.type&&("constructor"===t.parent.kind||"set"===t.parent.kind)||"Property"===t.parent.type&&"set"===t.parent.kind)&&t.parent.value===t)return;let r=function(e){if(("ArrowFunctionExpression"===e.type&&"Identifier"===e.body.type&&e.body.name===e.params[0].name||"BlockStatement"===e.body.type&&1===e.body.body.length&&"ReturnStatement"===e.body.body[0].type&&e.body.body[0].argument?.type==="Identifier"&&e.body.body[0].argument.name===e.params[0].name)&&"CallExpression"===e.parent.type&&!e.parent.optional&&e.parent.arguments[0]===e&&"MemberExpression"===e.parent.callee.type&&!e.parent.callee.computed&&!e.parent.callee.optional&&"Identifier"===e.parent.callee.property.type&&aE.has(e.parent.callee.property.name))return{replacementFunction:"Boolean",fix:t=>t.replaceText(e,"Boolean")}}(t)||function(e){let t,r=(t=e.params[0].name,"ArrowFunctionExpression"===e.type&&aD(e.body,t)?e.body:"BlockStatement"===e.body.type&&1===e.body.body.length&&"ReturnStatement"===e.body.body[0].type&&aD(e.body.body[0].argument,t)?e.body.body[0].argument:void 0);if(!r)return;let{name:n}=r.callee,o={replacementFunction:n};return"FunctionDeclaration"===e.type||1!==r.arguments.length||(o.fix=t=>{let r=n;return"Property"===e.parent.type&&e.parent.method&&e.parent.value===e?r=`: ${r}`:"MethodDefinition"===e.parent.type&&(r=` = ${r};`),t.replaceText(e,r)}),o}(t);if(!r)return;let{sourceCode:n}=e,{replacementFunction:o,fix:a}=r;return r={node:t,loc:eh(t,n),messageId:ax,data:{functionNameWithKind:ej(t,n),replacementFunction:o}},!a||1!==t.params.length||n.getCommentsInside(t).length>0||(r.fix=a),r})},meta:{type:"suggestion",docs:{description:"Prefer using `String`, `Number`, `BigInt`, `Boolean`, and `Symbol` directly.",recommended:"unopinionated"},fixable:"code",messages:{[ax]:"{{functionNameWithKind}} is equivalent to `{{replacementFunction}}`. Use `{{replacementFunction}}` directly."},languages:["js/js"]}},"unicorn/no-document-cookie":{create(e){aT.listen({context:e})},meta:{type:"problem",docs:{description:"Do not use `document.cookie` directly.",recommended:"unopinionated"},messages:{[aA]:"Do not use `document.cookie` directly."},languages:["js/js"]}},"unicorn/prefer-add-event-listener":aj,"unicorn/prefer-array-index-of":aN,"unicorn/prefer-blob-reading-methods":{create:e=>{e.on("CallExpression",e=>{if(!td(e,{methods:["readAsText","readAsArrayBuffer"],argumentsLength:1,optionalCall:!1,optionalMember:!1}))return;let t=e.callee.property,r=t.name;return{node:t,messageId:aM,data:{method:r,replacement:"readAsArrayBuffer"===r?"arrayBuffer":"text"}}})},meta:{type:"suggestion",docs:{description:"Prefer `Blob#arrayBuffer()` over `FileReader#readAsArrayBuffer(…)` and `Blob#text()` over `FileReader#readAsText(…)`.",recommended:"unopinionated"},messages:{[aM]:"Prefer `Blob#{{replacement}}()` over `FileReader#{{method}}(blob)`."},languages:["js/js"]}},"unicorn/prefer-date-now":{create:e=>{e.on("CallExpression",e=>{if(td(e,{methods:["getTime","valueOf"],argumentsLength:0,optionalCall:!1,optionalMember:!1})&&aW(e.callee.object)){let t=e.callee.property;return a_(e,{node:t,messageId:aq,data:{method:t.name}})}if(e7(e,{names:["Number","BigInt"],argumentsLength:1,optional:!1})&&aW(e.arguments[0])){let{name:t}=e.callee;return"Number"===t?a_(e,{messageId:aU}):a_(e.arguments[0])}}),e.on("UnaryExpression",t=>{if(("+"===t.operator||"-"===t.operator)&&aW(t.argument))return a_("-"===t.operator?t.argument:t,{},e)}),e.on("AssignmentExpression",e=>{if(("-="===e.operator||"*="===e.operator||"/="===e.operator||"%="===e.operator||"**="===e.operator)&&aW(e.right))return a_(e.right)}),e.on("BinaryExpression",function*(e){if("-"===e.operator||"*"===e.operator||"/"===e.operator||"%"===e.operator||"**"===e.operator)for(let t of[e.left,e.right])aW(t)&&(yield a_(t))})},meta:{type:"suggestion",docs:{description:"Prefer `Date.now()` to get the number of milliseconds since the Unix Epoch.",recommended:"unopinionated"},fixable:"code",messages:{[aO]:"Prefer `Date.now()` over `new Date()`.",[aq]:"Prefer `Date.now()` over `Date#{{method}}()`.",[aU]:"Prefer `Date.now()` over `Number(new Date())`."},languages:["js/js"]}},"unicorn/dom-node-dataset":a0,"unicorn/prefer-modern-math-apis":{create:e=>{let t=[];e.on("CallExpression",t=>{if(!td(t,{object:"Math",method:"sqrt",argumentsLength:1,optionalCall:!1,optionalMember:!1}))return;let r=a5(t.arguments[0]);if(r.some(e=>!("BinaryExpression"===e.type&&("*"===e.operator&&tQ(e.left,e.right)||"**"===e.operator&&e0(e.right,2)))))return;let n=1===r.length?"abs":"hypot",o=new Set(1===r.length?[]:r.map(e=>e.parent));return{node:t.callee.property,messageId:a1,data:{replacement:`Math.${n}(…)`,description:"Math.sqrt(…)"},*fix(a){let{sourceCode:i}=e;for(let r of(yield a.replaceText(t.callee.property,n),o)){let t=i.getTokenAfter(r.left,e=>"Punctuator"===e.type&&"+"===e.value);yield oV(t,",",a,e),yield oT(r,a,e)}for(let t of r)yield a.removeRange([eH(t.left,e)[1],i.getRange(t)[1]])}}}),e.on("BinaryExpression",e=>{t.push(e)}),e.on("Program:exit",function*(){for(let r of t)for(let t of a9){let n=t(r,e);n&&(yield n)}})},meta:{type:"suggestion",docs:{description:"Prefer modern `Math` APIs over legacy patterns.",recommended:"unopinionated"},fixable:"code",messages:{[a1]:"Prefer `{{replacement}}` over `{{description}}`."},languages:["js/js"]}},"unicorn/number-literal-case":ie,"unicorn/prefer-number-properties":is,"unicorn/prefer-reflect-apply":{create:e=>{e.on("CallExpression",t=>{if(!td(t,{optionalCall:!1,optionalMember:!1})||"Literal"===t.callee.object.type||"ArrayExpression"===t.callee.object.type||"ObjectExpression"===t.callee.object.type)return;let{sourceCode:r}=e,n=((e,t)=>{if("apply"===eI(e.callee)&&2===e.arguments.length&&iu(e.arguments[0],e.arguments[1]))return r=>r.replaceText(e,ip(t,e.callee.object,e.arguments[0],e.arguments[1]))})(t,r)||((e,t)=>{if("call"===eI(e.callee)&&"apply"===eI(e.callee.object)&&"prototype"===eI(e.callee.object.object)&&e.callee.object.object.object?.type==="Identifier"&&"Function"===e.callee.object.object.object.name&&3===e.arguments.length&&iu(e.arguments[1],e.arguments[2]))return r=>r.replaceText(e,ip(t,e.arguments[0],e.arguments[1],e.arguments[2]))})(t,r);if(n)return{node:t,messageId:il,fix:n}})},meta:{type:"suggestion",docs:{description:"Prefer `Reflect.apply()` over `Function#apply()`.",recommended:"unopinionated"},fixable:"code",messages:{[il]:"Prefer `Reflect.apply()` over `Function#apply()`."},languages:["js/js"]}},"unicorn/prefer-set-size":{create:e=>{e.on("MemberExpression",t=>{var r;if(!tc(t,{property:"length",optional:!1}))return;let n="ArrayExpression"===(r=t.object).type&&1===r.elements.length&&r.elements[0]?.type==="SpreadElement"?r.elements[0].argument:td(r,{object:"Array",method:"from",argumentsLength:1,optionalCall:!1,optionalMember:!1})?r.arguments[0]:void 0;if(n&&rY(n,e))return{node:t.property,messageId:ic,fix:function(e,t,r){let{sourceCode:n}=e,{object:o,property:a}=t;if(!(n.getCommentsInside(o).length>n.getCommentsInside(r).length))return function*(i){yield i.replaceText(a,"size");let s=n.getText(r);n2(r,e)&&(s=`(${s})`),yield i.replaceText(o,s),"ArrayExpression"===o.type&&(yield oP(i,t,e))}}(e,t,n)}})},meta:{type:"suggestion",docs:{description:"Prefer using `Set#size` instead of `Array#length`.",recommended:"unopinionated"},fixable:"code",messages:{[ic]:"Prefer using `Set#size` instead of `Array#length`."},languages:["js/js"]}},"unicorn/prefer-string-replace-all":{create:e=>{e.on("CallExpression",t=>{let r,n,o=((e,t)=>{let r;if(!td(e,{method:"join",argumentsLength:1,optionalCall:!1,optionalMember:!1})||!td(e.callee.object,{method:"split",argumentsLength:1,optionalCall:!1,optionalMember:!1})||t.sourceCode.getCommentsInside(e).length>0)return;let n=e.callee.object;if(nv(n.callee.object,t))return;let[o]=n.arguments,[a]=e.arguments,i=e3(o);if("string"==typeof i){if(0===i.length)return;r=tF(i)}else if(!(r=(e=>{if(!e6(e)||e.regex.flags.includes("y"))return;let t=iw(e);if(!t||ij(t)||0===iI(t))return;let{pattern:r,flags:n}=e.regex;return`/${r}/${n.includes("g")?n:`g${n}`}`})(o)))return;let s=e3(a);if("string"==typeof s)return`${eZ(n.callee.object,t)}.replaceAll(${r}, ${tF(s.replaceAll("$","$$$$"))})`})(t,e);if(o)return{node:t.callee.property,messageId:iE,fix:e=>e.replaceText(t,o)};if(!td(t,{methods:["replace","replaceAll"],argumentsLength:2,optionalCall:!1})||td(t,{method:"replace",argumentsLength:2,optionalCall:!1,optionalMember:!1})&&e6(r=t.arguments[0])&&r.regex.flags.includes("g")&&!r.regex.flags.includes("y")&&(e=>{if(!e.startsWith("[")||!e.endsWith("]")||e.startsWith("[^"))return;let t=new Set,r=e.slice(1,-1);for(let e=0;e<r.length;e++){let n=r[e],o=!1;if("\\"===n&&(n=r[++e],o=!0,!n)||"-"===n&&!o&&0!==e&&e!==r.length-1||"]"===n&&!o&&0!==e||!iy.has(n))return;t.add(n)}return t})(r.regex.pattern)?.size>=8&&e1(n=t.arguments[1])&&n.value===ig)return;let{arguments:a,callee:{property:i}}=t;if(nv(t.callee.object,e))return;let[s]=a;if(!((e,t)=>{if(e6(e))return e.regex.flags.includes("g");if(te(e,{name:"RegExp"})&&e.arguments[0]?.type!=="SpreadElement"&&e.arguments[1]?.type==="Literal"&&"string"==typeof e.arguments[1].value)return e.arguments[1].value.includes("g");let r=ew(e,t);if(!r)return!1;let{value:n}=r;return"[object RegExp]"===Object.prototype.toString.call(n)&&n.global})(s,e.sourceCode.getScope(s)))return;let l=i.name,u=function(e){if(!e6(e))return;let t=iw(e);if(!t)return;let{flags:r}=e.regex;if(!function(e){if(!e.includes("g"))return!1;for(let t of e)if(iD.has(t))return!1;return!0}(r))return;let n="alternative"===t.type?iT(t.body):iA(t);if(n)return"'"+n+"'"}(s);if("replaceAll"===l){if(!u)return;return{node:s,messageId:ib,data:{replacement:u.length<20?u:"a string literal"},fix:e=>e.replaceText(s,u)}}return{node:i,messageId:ix,*fix(e){yield e.insertTextAfter(i,"All"),u&&(yield e.replaceText(s,u))}}})},meta:{type:"suggestion",docs:{description:"Prefer `String#replaceAll()` over regex searches with the global flag and `String#split().join()`.",recommended:"unopinionated"},fixable:"code",messages:{[ix]:"Prefer `String#replaceAll()` over `String#replace()`.",[ib]:"This pattern can be replaced with {{replacement}}.",[iE]:"Prefer `String#replaceAll()` over `String#split().join()`."},languages:["js/js"]}},"unicorn/prefer-string-slice":{create:e=>{e.on("CallExpression",t=>{if(!td(t,{methods:["substr","substring"]})||nv(t.callee.object,e))return;let r=t.callee.property.name;if(!("substring"===r&&(e=>{if(!td(e,{method:"substring",argumentsLength:2}))return;let[t,r]=e.arguments;if(iF(t)&&iF(r)&&1===Math.abs(t.value-r.value))return t.value<r.value?t:r;let n=(e=>{if("BinaryExpression"===e.type&&"-"===e.operator&&e0(e.right,1))return e.left})(t);return iB(r,t)??(iB(t,r)?r:void 0)??(n&&tQ(n,r)?t:void 0)})(t)))return{node:t,messageId:r,*fix(n,{abort:o}){if(yield n.replaceText(t.callee.property,"slice"),0!==t.arguments.length){if(t.arguments.length>2||t.arguments.some(e=>"SpreadElement"===e.type))return o();yield("substr"===r?function*({node:e,fixer:t,context:r,abort:n}){let o=e.arguments,[a,i]=o;if(!i)return;let{sourceCode:s}=r,l=ew(a,s.getScope(e)),u=eH(i,r);if(l?.value===0){let n=((e,t,r)=>{let n,o,{sourceCode:a}=r;if(!("BinaryExpression"!==e.type||"-"!==e.operator||!(e8(n=e.right)&&Number.isSafeInteger(n.value)&&n.value>0)||!i$(e.left)||!("Identifier"===t.type||e1(t))||!tQ(e.left.object,t)||(o=((e,t)=>{let[r,n]=eH(e,t),o=t.sourceCode.getTokenByRangeStart(r),a=t.sourceCode.getTokenBefore(o);return[t.sourceCode.getRange(a)[1],n]})(e,r),a.getAllComments().some(e=>{let t=a.getRange(e);return t[0]>=o[0]&&t[1]<=o[1]}))))return`-${e.right.raw}`})(i,e.callee.object,r);if(n)return void(yield oI(t,i,n,r));if(e8(i)||i$(i))return;let o=iR(i);return"number"==typeof o?void(yield oI(t,i,String(Math.max(0,o)),r)):(yield t.insertTextBeforeRange(u,"Math.max(0, "),void(yield t.insertTextAfterRange(u,")")))}if(o.every(e=>e8(e))){let e;return void(yield(e=String(a.value+i.value),oI(t,i,e,r)))}return n()}:function*({node:e,fixer:t,context:r,abort:n}){let[o,a]=e.arguments,i=o?iR(o):void 0;if(!a){if(i$(o))return;if(void 0!==i)return void(yield oI(t,o,String(Math.max(0,i)),r));let e=eH(o,r);return yield t.insertTextBeforeRange(e,"Math.max(0, "),void(yield t.insertTextAfterRange(e,")"))}let s=iR(a);if(void 0!==i&&void 0!==s){let e=[Math.max(0,i),Math.max(0,s)];i>s&&e.reverse(),e[0]!==i&&(yield oI(t,o,String(e[0]),r)),e[1]!==s&&(yield oI(t,a,String(e[1]),r));return}if(0===i||0===s){let e=eZ(o,r),n=eZ(a,r);yield oI(t,o,"0",r),yield oI(t,a,`Math.max(0, ${0===i?n:e})`,r);return}return n()})({node:t,fixer:n,context:e,abort:o})}}}})},meta:{type:"suggestion",docs:{description:"Prefer `String#slice()` over `String#substr()` and `String#substring()`.",recommended:"unopinionated"},fixable:"code",messages:{substr:"Prefer `String#slice()` over `String#substr()`.",substring:"Prefer `String#slice()` over `String#substring()`."},languages:["js/js"]}},"unicorn/prefer-string-trim-start-end":{create:e=>{e.on("CallExpression",t=>{if(!td(t,{methods:["trimLeft","trimRight"],argumentsLength:0,optionalCall:!1})||nv(t.callee.object,e))return;let r=t.callee.property,n=r.name,o="trimLeft"===n?"trimStart":"trimEnd";return{node:r,messageId:iP,data:{method:n,replacement:o},fix:e=>e.replaceText(r,o)}})},meta:{type:"suggestion",docs:{description:"Prefer `String#trimStart()` / `String#trimEnd()` over `String#trimLeft()` / `String#trimRight()`.",recommended:"unopinionated"},fixable:"code",messages:{[iP]:"Prefer `String#{{replacement}}()` over `String#{{method}}()`."},languages:["js/js"]}},"unicorn/no-unreadable-iife":{create:e=>{e.on("CallExpression",t=>{if("ArrowFunctionExpression"!==t.callee.type||"BlockStatement"===t.callee.body.type||!eQ(t.callee.body,e))return;let{body:r}=t.callee,n={node:t,loc:n7(eH(r,e),e),messageId:iL};return!function(e,t){let{sourceCode:r}=t,[n,o]=eH(e,t),[a,i]=r.getRange(e);return r.getCommentsInside(e.parent).some(e=>{let[t,s]=r.getRange(e);return t>=n&&s<=o&&(t<a||s>i)})}(r,e)&&(n.suggest=[{messageId:iN,fix:t=>t.replaceTextRange(eH(r,e),`{ return ${e.sourceCode.getText(r)}; }`)}]),n})},meta:{type:"suggestion",docs:{description:"Disallow unreadable IIFEs.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[iL]:"IIFE with parenthesized arrow function body is considered unreadable.",[iN]:"Use a block statement body."},languages:["js/js"]}},"unicorn/throw-new-error":{create:e=>{e.on("CallExpression",t=>{if("Decorator"===t.parent.type)return;let{callee:r}=t;if(!(t.optional||rh(r))&&("Identifier"===r.type&&iO.test(r.name)||"MemberExpression"===r.type&&!r.computed&&"Identifier"===r.property.type&&iO.test(r.property.name))&&!tc(r,{object:"Data",property:"TaggedError",computed:!1}))return{node:t,messageId:iM,fix:r=>oL(t,e,r)}})},meta:{type:"suggestion",docs:{description:"Require `new` when creating an error.",recommended:"unopinionated"},fixable:"code",messages:{[iM]:"Use `new` when creating an error."},languages:["js/js"]}},"unicorn/escape-case":{create:e=>{let t="lowercase"===e.options[0];e.on("Literal",e=>{if(e1(e))return iV({node:e,original:e.raw,lowercase:t})}),e.on("Literal",e=>{if(e6(e))return iV({node:e,original:e.raw,regex:i_,lowercase:t})}),e.on("TemplateElement",r=>{if(!th(r.parent))return iV({node:r,original:r.value.raw,lowercase:t,fix:(t,n)=>o_(r,n,e,t)})})},meta:{type:"suggestion",docs:{description:"Require escape sequences to use uppercase or lowercase values.",recommended:"unopinionated"},fixable:"code",schema:[{enum:["uppercase","lowercase"],description:"The case style for escape sequences."}],defaultOptions:["uppercase"],messages:{[iq]:"Use uppercase characters for the value of the escape sequence.",[iU]:"Use lowercase characters for the value of the escape sequence."},languages:["js/js"]}},"unicorn/prefer-unicode-code-point-escapes":{create:e=>{e.on("Literal",e=>e1(e)?i6(e,e.raw):e6(e)?function(e){let t,{raw:r}=e,{pattern:n,flags:o}=(t=r.lastIndexOf("/"),{pattern:r.slice(1,t),flags:r.slice(t+1)}),{fixed:a,hasReplacement:i}=i8(n,{isRegex:!0,supportsNestedCharacterClasses:o.includes("v")}),s=o.includes("u")||o.includes("v"),l=function(e){for(let t=0;t<e.length;t++)if(void 0!==function(e,t){var r;if(!e.startsWith(iG,t))return;let n=t+iG.length;for(;r=e[n],iJ.test(r);)n++;if(n===t+iG.length||"}"!==e[n])return;let o=Number.parseInt(e.slice(t+iG.length,n),16);if(!(o>1114111))return o}(e,t)&&iZ(e,t))return!0;return!1}(n);if(!i&&(s||!l))return;let u=`/${i?a:n}/${i9(o)}`;return s?{node:e,messageId:iz,fix:t=>t.replaceText(e,u)}:!function(e,t){try{return new RegExp(e,t),!0}catch{return!1}}(i?a:n,i9(o))?{node:e,messageId:iz}:{node:e,messageId:iz,suggest:[{messageId:iK,fix:t=>t.replaceText(e,u)}]}}(e):void 0),e.on("TemplateElement",t=>{if(!th(t.parent))return i6(t,t.value.raw,(r,n)=>o_(t,n,e,r))})},meta:{type:"suggestion",docs:{description:"Prefer Unicode code point escapes over legacy escape sequences.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[iz]:"Prefer Unicode code point escapes.",[iK]:"Use Unicode code point escapes and add the `u` flag."},languages:["js/js"]}},"unicorn/prefer-prototype-methods":{create:function(e){let{sourceCode:t}=e,r=[];e.on("CallExpression",e=>{r.push(e)}),e.onExit("Program",function*(n){let o=new WeakMap;for(let{node:e,path:r}of new ez(t.getScope(n)).iterateGlobalReferences(Object.fromEntries(i5.map(e=>[e,{[ez.READ]:!0}]))))o.set(e,r);for(let t of r)yield function(e,{context:t,globalReferences:r}){let n;td(e,{object:"Reflect",method:"apply",minimumArguments:1,optionalCall:!1,optionalMember:!1})?n=e.arguments[0]:td(e,{methods:["apply","bind","call"],optionalCall:!1,optionalMember:!1})&&(n=e.callee.object);let{isGlobalReference:o,constructorName:a,methodName:i}=function(e,{context:t,globalReferences:r}){if(!e)return;if(r.has(e))return{isGlobalReference:!0,constructorName:"Object",methodName:r.get(e).at(-1)};if(!tc(e,{optional:!1}))return;let n=e.object;if(to(n)||ta(n))return{constructorName:"ArrayExpression"===n.type?"Array":"Object",methodName:eI(e,t.sourceCode.getScope(e))}}(n,{context:t,globalReferences:r})??{};if(a)return{node:n,messageId:i?"known-method":"unknown-method",data:{constructorName:a,methodName:i},*fix(r){if(o)return void(yield r.replaceText(n,`${a}.prototype.${i}`));if(tc(n)){let o=n.object;yield r.replaceText(o,`${a}.prototype`),("ArrayExpression"===o.type||"ObjectExpression"===o.type)&&(yield oP(r,e,t))}}}}(t,{context:e,globalReferences:o})})},meta:{type:"suggestion",docs:{description:"Prefer borrowing methods from the prototype instead of the instance.",recommended:"unopinionated"},fixable:"code",messages:{"known-method":"Prefer using `{{constructorName}}.prototype.{{methodName}}`.","unknown-method":"Prefer using method from `{{constructorName}}.prototype`."},languages:["js/js"]}},"unicorn/error-message":{create:e=>{e.on(["CallExpression","NewExpression"],t=>{if(!(tt(t,{names:i4,optional:!1})&&e.sourceCode.isGlobalReference(t.callee)))return;let r=t.callee.name,n=sr.has(r)?sr.get(r):0,o=t.arguments;if(o.some((e,t)=>t<=n&&"SpreadElement"===e.type))return;let a=o[n];if(!a)return{node:t,messageId:i7,data:{constructorName:r}};if("ArrayExpression"===a.type||"ObjectExpression"===a.type)return{node:a,messageId:st};let i=ew(a,e.sourceCode.getScope(a));if(!i)return;let{value:s}=i;return"string"!=typeof s?{node:a,messageId:st}:""===s?{node:a,messageId:se}:void 0})},meta:{type:"problem",docs:{description:"Enforce passing a `message` value when creating a built-in error.",recommended:"unopinionated"},messages:{[i7]:"Pass a message to the `{{constructorName}}` constructor.",[se]:"Error message should not be an empty string.",[st]:"Error message should be a string."},languages:["js/js"]}},"unicorn/no-instanceof-builtins":su,"unicorn/prefer-type-error":{create:e=>{e.on("ThrowStatement",e=>{let t;if(!(te(e.argument,{name:"Error"})&&e.parent&&e.parent.body&&1===e.parent.body.length&&e.parent.parent&&"IfStatement"===(t=e.parent.parent).type&&sh(t.test)))return;let r=e.argument.callee;return{node:r,messageId:sp,fix:e=>e.insertTextBefore(r,"Type")}})},meta:{type:"suggestion",docs:{description:"Enforce throwing `TypeError` in type checking conditions.",recommended:"unopinionated"},fixable:"code",messages:{[sp]:"`new Error()` is too unspecific for a type check. Use `new TypeError()` instead."},languages:["js/js"]}},"unicorn/consistent-destructuring":{create:e=>{let{sourceCode:t}=e,r=new Map,n=[],o=[],a=e=>{let r=ry(e.object);if(e.computed||"Identifier"!==e.property.type||!["Identifier","ThisExpression"].includes(r.type))return;let n=t.getScope(e);o.push({propertyName:e.property.name,rootIdentifierName:"Identifier"===r.type?r.name:void 0,rootVariable:"Identifier"===r.type?ei(n,r):void 0,thisScopeBoundary:"ThisExpression"===r.type?sD(r):void 0,start:t.getRange(e)[0],scope:n})},i=e=>{switch(e.type){case"MemberExpression":a(e);break;case"AssignmentPattern":i(e.left);break;case"RestElement":i(e.argument);break;case"ObjectPattern":for(let t of e.properties)i("Property"===t.type?t.value:t.argument);break;case"ArrayPattern":for(let t of e.elements)t&&i(t)}};e.on("AssignmentExpression",e=>{i(e.left)}),e.on(["ForInStatement","ForOfStatement"],e=>{"VariableDeclaration"!==e.left.type&&i(e.left)}),e.on("UpdateExpression",e=>{"MemberExpression"===e.argument.type&&a(e.argument)}),e.on("UnaryExpression",e=>{"delete"===e.operator&&"MemberExpression"===e.argument.type&&a(e.argument)}),e.on("VariableDeclarator",e=>{let n;if(!("ObjectPattern"===e.id.type&&"const"===e.parent.kind&&e.init&&("Identifier"===(n=e.init).type||"ThisExpression"===n.type)))return;let o="Identifier"===e.init.type?e.init:void 0,a={scope:t.getScope(e),object:e.init,rootIdentifierName:o?.name,rootVariable:o&&ei(t.getScope(e),o),thisScopeBoundary:"ThisExpression"===e.init.type?sD(e.init):void 0,objectPattern:e.id},i=t.getText(e.init);r.set(i,[...r.get(i)??[],a])});let s=e=>{let n;if(e.computed||tt(e.parent)&&e.parent.callee===e||"TaggedTemplateExpression"===e.parent.type&&e.parent.tag===e||r3(e))return;let a=ry(e.object),i=r.get(t.getText(a));if(!i)return;let s=t.getScope(e),l="Identifier"===a.type?a:void 0,u=l&&ei(s,l),p="ThisExpression"===a.type?sD(a):void 0,c=t.getText(e.property);for(let r of i.toReversed())if(sC({declaration:r,memberExpressionNode:e,memberScope:s,memberRootIdentifier:l,memberRootVariable:u,memberThisScopeBoundary:p,memberExpressionWrites:o,sourceCode:t})&&(n=sv(r.objectPattern.properties.filter(e=>sS(e)&&"Identifier"===e.value.type),c,s,t)))break;if(!n||((e,t)=>{let r=e,{parent:n}=e;for(;n&&!sw(n);){if(sT(n,r,e,t))return!0;r=n,n=n.parent}return!1})(e,t))return;if("MemberExpression"===e.parent.type)return{node:e,messageId:sx};let d=t.getText(e),m=n.value.name;return{node:e,messageId:sx,suggest:[{messageId:sb,data:{expression:d,property:m},fix:t=>t.replaceText(e,m)}]}};e.on("MemberExpression",e=>{n.push(e)}),e.onExit("Program",function*(){for(let e of n){let t=s(e);t&&(yield t)}})},meta:{type:"suggestion",docs:{description:"Use destructured variables over properties.",recommended:!1},hasSuggestions:!0,messages:{[sx]:"Use destructured variables over properties.",[sb]:"Replace `{{expression}}` with destructured property `{{property}}`."},languages:["js/js"]}},"unicorn/new-for-builtins":{create:e=>{sR.listen({context:e}),s$.listen({context:e}),sP.listen({context:e}),sL.listen({context:e})},meta:{type:"suggestion",docs:{description:"Enforce correct use of `new` for builtin constructors.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{enforce:"Use `new {{name}}()` instead of `{{name}}()`.",disallow:"Use `{{name}}()` instead of `new {{name}}()`.",disallowCallOrNew:"`{{name}}` is not a function or constructor.",[sj]:"Use `String(new Date())` instead of `Date()`.",[sF]:"Switch to `String(new Date())`."},languages:["js/js"]}},"unicorn/prefer-single-call":sW,"unicorn/no-process-exit":{create:e=>{if(0===e.sourceCode.lines[0].indexOf("#!"))return;let t=0,r=!1,n=[],o=e=>td(e,{object:"process",methods:["on","once"],minimumArguments:1,optionalCall:!1,optionalMember:!1});e.on("CallExpression",e=>{tf(e)&&sV(e.arguments[0])&&(r=!0)}),e.on("ImportDeclaration",e=>{"Literal"===e.source.type&&sV(e.source)&&(r=!0)}),e.on("CallExpression",e=>{o(e)&&t++}),e.onExit("CallExpression",e=>{o(e)&&t--}),e.on("CallExpression",e=>{0===t&&td(e,{object:"process",method:"exit",optionalCall:!1,optionalMember:!1})&&n.push(e)}),e.onExit("Program",function*(){if(!r)for(let e of n)yield{node:e,messageId:s_}})},meta:{type:"suggestion",docs:{description:"Disallow `process.exit()`.",recommended:"unopinionated"},messages:{[s_]:"Only use `process.exit()` in CLI apps. Throw an error instead."},languages:["js/js"]}},"unicorn/no-static-only-class":{create:function(e){e.on(["ClassDeclaration","ClassExpression"],t=>{if(!(t.superClass||t.decorators&&t.decorators.length>0||"ClassBody"!==t.body.type||0===t.body.body.length||t.body.body.some(e=>!function(e){let{private:t,static:r,declare:n,readonly:o,accessibility:a,decorators:i,key:s}=e;return!(!s0(e)&&"MethodDefinition"!==e.type||!r||t||"PrivateIdentifier"===s.type||n||o||void 0!==a||Array.isArray(i)&&i.length>0)}(e))))return{node:t,loc:function(e,t){let{sourceCode:r}=t,{body:n}=e,o=r.getTokenBefore(n),{start:a}=r.getLoc(e),{end:i}=r.getLoc(o);return{start:a,end:i}}(t,e),messageId:sZ,fix:function(e,t){let{type:r,id:n,body:o,declare:a,abstract:i,implements:s,parent:l}=e;if(a||i||Array.isArray(s)&&s.length>0||"ClassExpression"===r&&n)return;let u="ClassDeclaration"===e.type&&"ExportDefaultDeclaration"===e.parent.type&&e.parent.declaration===e;if(u&&n)return;let{sourceCode:p}=t;for(let e of o.body)if(s0(e)&&(e.typeAnnotation||e.value&&p.getText(e.value).includes("this")))return;return function*(n){let a=p.getFirstToken(e);if(tw(a,{expected:{type:"Keyword",value:"class"},ruleId:"no-static-only-class"}),u||"ClassExpression"===r)if("ClassExpression"===r&&"ReturnStatement"===l.type&&p.getLoc(o).start.line!==p.getLoc(l).start.line&&p.text.slice(p.getRange(a)[1],p.getRange(o)[0]).trim()){yield n.replaceText(a,"{");let e=p.getFirstToken(o);yield n.remove(e)}else yield n.replaceText(a,""),yield oB(a,t,n);else yield n.replaceText(a,"const"),yield n.insertTextBefore(o,"= "),yield n.insertTextAfter(o,";");for(let e of o.body)yield function*(e,t,r){let{sourceCode:n}=t,o=n.getFirstToken(e);tw(o,{expected:{type:"Keyword",value:"static"},ruleId:"no-static-only-class"}),yield r.remove(o),yield oB(o,t,r);let a=s0(e)?n.getLastToken(e):n.getTokenAfter(e),i=ep(a);if(s0(e)){let{key:t,value:o}=e;if(o){let e=n.getTokenAfter(t,sQ);yield r.replaceText(e,":")}else i?yield r.insertTextBefore(a,": undefined"):yield r.insertTextAfter(e,": undefined")}yield i?r.replaceText(a,","):r.insertTextAfter(e,",")}(e,t,n)}}(t,e)}})},meta:{type:"suggestion",docs:{description:"Disallow classes that only have static members.",recommended:"unopinionated"},fixable:"code",messages:{[sZ]:"Use an object instead of a class with only static members."},languages:["js/js"]}},"unicorn/no-unreadable-array-destructuring":s3,"unicorn/no-useless-spread":{create:e=>{let{sourceCode:t}=e;e.on(["ArrayExpression","ObjectExpression"],r=>{if(!("SpreadElement"===r.parent.type&&r.parent.argument===r&&("ObjectExpression"===r.type&&"ObjectExpression"===r.parent.parent.type&&r.parent.parent.properties.includes(r.parent)||"ArrayExpression"===r.type&&("ArrayExpression"===r.parent.parent.type&&r.parent.parent.elements.includes(r.parent)||tt(r.parent.parent)&&r.parent.parent.arguments.includes(r.parent)))))return;let n=r.parent,o=t.getFirstToken(n),a=n.parent.type,i={node:o,messageId:s8,data:{argumentType:"ArrayExpression"===r.type?"array":"object",parentDescription:li[a]}};return"NewExpression"===a&&la(r)&&te(n.parent,{names:lr,argumentsLength:1,allowSpreadElement:!0})?i:{...i,*fix(i){let s;yield i.remove(o),yield oT(r,i,e);let l=t.getFirstToken(r);yield i.remove(l);let[u,p]=t.getLastTokens(r,2);if(yield i.remove(p),eu(u)&&(yield i.remove(u)),to(r)||ta(r)){let e=t.getTokenAfter(n);eu(e)&&(yield i.remove(e))}if("CallExpression"===a||"NewExpression"===a)for(let[e,n]of(s=t.getFirstToken(r),r.elements.map((e,n,o)=>{if(n===o.length-1){let e=t.getLastToken(r,{skip:1});return eu(e)?e:void 0}let a=t.getTokenAfter(e||s,eu);return s=a,a})).entries())null===r.elements[e]&&(yield i.insertTextBefore(n,"undefined"))}}}),e.on("ObjectExpression",r=>{if(!("ObjectExpression"===r.type&&r.properties.length>0&&r.properties.every(e=>"SpreadElement"===e.type&&"ObjectExpression"!==e.argument.type)))return;let n=r.parent;if(!td(n,{object:"Object",method:"assign",minimumArguments:2,optionalMember:!1,optionalCall:!1}))return;let o=n.arguments.indexOf(r),a=n.arguments.slice(0,o).some(e=>"SpreadElement"!==e.type);if(o<=0||!a)return;let i={node:t.getFirstToken(r.properties[0]),messageId:s7};return t.getCommentsInside(r).length>0?i:{...i,suggest:[{messageId:lt,fix:t=>t.replaceText(r,r.properties.map(t=>eZ(t.argument,e)).join(", "))}]}}),e.on("NewExpression",e=>{if(te(e,{names:lr,argumentsLength:1,allowSpreadElement:!0})&&"SpreadElement"===e.arguments[0].type&&"ArrayExpression"!==e.arguments[0].argument.type)return{node:e.arguments[0],messageId:s4,data:{constructorName:`new ${e.callee.name}(…)`}}}),e.on("ArrayExpression",t=>{if(!la(t))return;let{parent:r}=t;if(!("ForOfStatement"===r.type&&r.right===t||"YieldExpression"===r.type&&r.delegate&&r.argument===t||(te(r,{names:lr,argumentsLength:1})||te(r,{names:rE,minimumArguments:1})||td(r,{object:"Promise",methods:["all","allSettled","any","race"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||td(r,{objects:["Array",...rE],method:"from",argumentsLength:1,optionalCall:!1,optionalMember:!1})||td(r,{object:"Object",method:"fromEntries",argumentsLength:1,optionalCall:!1,optionalMember:!1}))&&r.arguments[0]===t))return;let n="",o=s6;switch(r.type){case"ForOfStatement":o=s9;break;case"YieldExpression":o=s5;break;case"NewExpression":n=`new ${r.callee.name}(…)`;break;case"CallExpression":n=`${r.callee.object.name}.${r.callee.property.name}(…)`}return{node:t,messageId:o,data:{parentDescription:n},fix:r=>ls(r,t,e)}}),e.on("ArrayExpression",t=>{if(!la(t))return;let r=t.elements[0].argument,n=!!td(r,{methods:lo,optionalCall:!1,optionalMember:!1})&&rK(r.callee.object,e)&&rK(r,e);if(!n&&!(!rG(r,e)&&(td(r,{methods:ln,optionalCall:!1,optionalMember:!1})?!ll(r,e):td(r,{method:"concat",optionalCall:!1,optionalMember:!1})?!("Identifier"===r.callee.object.type&&"Iterator"===r.callee.object.name||ll(r,e)):td(r,{method:"split",optionalCall:!1,optionalMember:!1})||td(r,{object:"Object",methods:["keys","values"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||"AwaitExpression"===r.type&&td(r.argument,{object:"Promise",methods:["all","allSettled"],argumentsLength:1,optionalCall:!1,optionalMember:!1})||td(r,{object:"Array",methods:["from","of"],optionalCall:!1,optionalMember:!1})||te(r,{name:"Array"}))))return;let o={node:t,messageId:le};return te(r,{name:"Array"})||td(r,{method:"slice",optionalCall:!1,optionalMember:!1})&&!n?o:Object.assign(o,{fix:r=>ls(r,t,e)})})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary spread.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[s8]:"Spread an {{argumentType}} literal in {{parentDescription}} is unnecessary.",[s6]:"`{{parentDescription}}` accepts an iterable as an argument, it's unnecessary to convert to an array.",[s9]:"`for…of` can iterate over an iterable, it's unnecessary to convert to an array.",[s5]:"`yield*` can delegate to an iterable, it's unnecessary to convert to an array.",[s4]:"`{{constructorName}}` accepts a single iterable argument, spreading is misleading.",[s7]:"`Object.assign(…)` source object with only spread properties is unnecessary.",[le]:"Unnecessarily cloning an array.",[lt]:"Remove the object literal wrapper."},languages:["js/js"]}},"unicorn/no-useless-switch-case":{create:e=>{let t=ru(e.physicalFilename);e.on("SwitchStatement",function*(r){let{cases:n}=r;if(!(n.length<2)&&null===n.at(-1).test)for(let r=n.length-2;r>=0;r--){let o=n[r];if(!lc(o))break;t&&ld(o)||(yield{node:o,loc:function(e,t){let{sourceCode:r}=t,n=e.test||r.getFirstToken(e),o=r.getTokenAfter(n,ec);return{start:r.getLoc(e).start,end:r.getLoc(o).end}}(o,e),messageId:lu,suggest:[{messageId:lp,fix:e=>e.remove(o)}]})}})},meta:{type:"suggestion",docs:{description:"Disallow useless case in switch statements.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[lu]:"Useless case in switch statement.",[lp]:"Remove this case."},languages:["js/js"]}},"unicorn/no-useless-undefined":lB,"unicorn/numeric-separators-style":lL,"unicorn/prefer-array-find":l3,"unicorn/prefer-array-flat-map":{create:e=>{e.on("CallExpression",t=>{if(!(td(t,{method:"flat",optionalCall:!1,optionalMember:!1})&&(0===t.arguments.length||1===t.arguments.length&&"Literal"===t.arguments[0].type&&"1"===t.arguments[0].raw)&&td(t.callee.object,{method:"map",optionalCall:!1})))return;let r=t.callee.object;if(ty(r.callee.object,l5)||rX(r.callee.object,e))return;let{sourceCode:n}=e,o=r.callee.property,a=t4(e,t,[r])||t.typeArguments||t.typeParameters||r.typeArguments||r.typeParameters?void 0:function*(r){yield oO(r,t,e),yield r.replaceText(o,"flatMap")};return{node:t,loc:{start:n.getLoc(o).start,end:n.getLoc(t).end},messageId:l8,fix:a}}),e.on("CallExpression",t=>{if(!td(t,{method:"flatMap",argumentsLength:1,optionalCall:!1,optionalMember:!1,computed:!1})||t.typeArguments||t.typeParameters)return;let r=t.callee.object;if(!td(r,{method:"filter",argumentsLength:1,optionalCall:!1,optionalMember:!1,computed:!1})||r.typeArguments||r.typeParameters||rh(r.callee.object)||rG(r.callee.object,e))return;let{sourceCode:n}=e;if(n.getCommentsInside(t).length>0)return;let[o]=r.arguments,[a]=t.arguments;if(!l7(o)||!l7(a))return;let[i]=o.params,[s]=a.params;if(!nB(i,s))return;let l=function(e,t){if(eQ(e,t))return eZ(e,t);let r=t.sourceCode.getText(e);return n2(e,t)?`(${r})`:r}(r.callee.object,e),u=n.getText(i),p=function(e,t){if(eQ(e,t))return eZ(e,t);let r=t.sourceCode.getText(e);return l4.has(e.type)?`(${r})`:r}(o.body,e),c=function(e,t){if(eQ(e,t))return eZ(e,t);let r=t.sourceCode.getText(e);return nQ(e)?`(${r})`:r}(a.body,e);return{node:t.callee.property,messageId:l6,suggest:[{messageId:l9,fix:e=>e.replaceText(t,`${l}.flatMap(${u} => ${p} ? ${c} : [])`)}]}})},meta:{type:"suggestion",docs:{description:"Prefer `.flatMap(…)` over `.map(…).flat()` and `.filter(…).flatMap(…)`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[l8]:"Prefer `.flatMap(…)` over `.map(…).flat()`.",[l6]:"Prefer a single `.flatMap(…)` over `.filter(…).flatMap(…)`.",[l9]:"Replace `.filter(…).flatMap(…)` with a single `.flatMap(…)`."},languages:["js/js"]}},"unicorn/prefer-array-flat":ul,"unicorn/prefer-array-some":ud,"unicorn/prefer-code-point":{create:e=>{e.on("CallExpression",e=>{if(td(e,{method:"charCodeAt",optionalCall:!1}))return um(e.callee.property,"codePointAt")}),e.on("MemberExpression",e=>{if(tc(e,{object:"String",property:"fromCharCode",optional:!1}))return um(e.property,"fromCodePoint")})},meta:{type:"suggestion",docs:{description:"Prefer `String#codePointAt(…)` over `String#charCodeAt(…)` and `String.fromCodePoint(…)` over `String.fromCharCode(…)`.",recommended:"unopinionated"},hasSuggestions:!0,messages:{"error/charCodeAt":"Prefer `String#codePointAt()` over `String#charCodeAt()`.","error/fromCharCode":"Prefer `String.fromCodePoint()` over `String.fromCharCode()`.","suggestion/codePointAt":"Use `String#codePointAt()`.","suggestion/fromCodePoint":"Use `String.fromCodePoint()`."},languages:["js/js"]}},"unicorn/prefer-default-parameters":{create:e=>{let{sourceCode:t}=e,r=[],n=(e,n,o,a)=>{let i,s=r.at(-1);if(!s||!n||!o||"Identifier"!==n.type||"LogicalExpression"!==o.type||"||"!==o.operator&&"??"!==o.operator||"Identifier"!==o.left.type||"Literal"!==o.right.type)return;let{name:l}=n,{left:{name:u},right:{raw:p}}=o;if(a&&l!==u)return;let c=ei(t.getScope(e),u);if(!c)return;let{references:d}=c,{params:m}=s,f=m.find(e=>"Identifier"===e.type&&e.name===u);if(((e,t,r)=>{for(let n of t.body.body){if(n===r)break;if(uh(e,n))return!0}return!1})(t,s,e)||a&&d[0].identifier!==n||!a&&d.length>1||(i=m.at(-1),!f||f!==i))return;let g=((e,t)=>{if("ArrowFunctionExpression"!==t.type||t.params.length>1)return!1;let[r]=t.params,n=e.getTokenBefore(r),o=e.getTokenAfter(r);return!o||!n||"("!==n.value||")"!==o.value})(t,s)?`(${l} = ${p})`:`${l} = ${p}`;return{node:e,messageId:uf,suggest:[{messageId:ug,fix:r=>[r.replaceText(f,g),((e,t,r)=>{let{line:n}=t.getLoc(r).start,{column:o}=t.getLoc(r).end,a=t.getText(r),i=t.lines[n-1];if(i.trim()===a)return e.removeRange([t.getIndexFromLoc({line:n,column:0}),t.getIndexFromLoc({line:n+1,column:0})]);if(" "===i[o]){let[n,o]=t.getRange(r);return e.removeRange([n,o+1])}return e.remove(r)})(r,t,e)]}]}};e.on(ts,e=>{r.push(e)}),e.onExit(ts,()=>{r.pop()}),e.on("AssignmentExpression",e=>{if("ExpressionStatement"===e.parent.type&&e.parent.expression===e)return n(e.parent,e.left,e.right,!0)}),e.on("VariableDeclarator",e=>{if("VariableDeclaration"===e.parent.type&&e.parent.declarations[0]===e)return n(e.parent,e.id,e.init,!1)})},meta:{type:"suggestion",docs:{description:"Prefer default parameters over reassignment.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[uf]:"Prefer default parameters over reassignment.",[ug]:"Replace reassignment with default parameter."},languages:["js/js"]}},"unicorn/prefer-logical-operator-over-ternary":{create:e=>{let{sourceCode:t}=e;e.on("ConditionalExpression",r=>{let{test:n,consequent:o,alternate:a}=r,i=function(e,t){let{test:r,consequent:n,alternate:o}=e,a=function(e,t){let r=uw(e);if(r?.kind==="nullish")return r;if("LogicalExpression"!==e.type)return;let n=uw(e.left),o=uw(e.right);if(n&&o&&uC(n.reference,o.reference,t)){if("||"===e.operator&&n.isTrueWhenNullish&&o.isTrueWhenNullish&&uk(n,o))return{reference:n.reference,isTrueWhenNullish:!0};if("&&"===e.operator&&!n.isTrueWhenNullish&&!o.isTrueWhenNullish&&uk(n,o))return{reference:n.reference,isTrueWhenNullish:!1}}}(r,t.sourceCode);if(!a||t.sourceCode.getCommentsInside(e).length>0)return;let{reference:i}=a;if(a.isTrueWhenNullish&&uC(i,o,t.sourceCode))return uA({context:t,conditionalExpression:e,left:o,right:n,operators:["??"]});if(!a.isTrueWhenNullish&&uC(i,n,t.sourceCode))return uA({context:t,conditionalExpression:e,left:n,right:o,operators:["??"]});let s=a.isTrueWhenNullish?n:o,l=a.isTrueWhenNullish?o:n;if(!tx(s)||!tc(l)||l.optional||!tQ(ry(i),ry(l.object))||function(e){let t=e,{parent:r}=t;for(;rg(r)&&r.expression===t;)r=(t=r).parent;return"UnaryExpression"===r.type&&"delete"===r.operator&&r.argument===t||"CallExpression"===r.type&&r.callee===t||"TaggedTemplateExpression"===r.type&&r.tag===t}(e))return;let u=function(e,t){let{sourceCode:r}=t,n=ri(e,t);if(re(t,n))return;let[o,a]=r.getRange(e),[i,s]=n;return r.text.slice(o,i)+(e.computed?"?.[":"?.")+r.text.slice(s,a)}(l,t);if(u)return{node:e,messageId:ub,suggest:[{messageId:uD,fix(r){let n=u;return nW(t.sourceCode.getTokenBefore(e),t,n)&&(n=`;${n}`),r.replaceText(e,n)}}]}}(r,e);return i||(uC(n,o,t)?uA({context:e,conditionalExpression:r,left:n,right:a}):"UnaryExpression"===n.type&&"!"===n.operator&&n.prefix&&uC(n.argument,a,t)?uA({context:e,conditionalExpression:r,left:n.argument,right:o}):void 0)})},meta:{type:"suggestion",docs:{description:"Prefer using a logical operator over a ternary.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[ux]:"Prefer using a logical operator over a ternary.",[ub]:"Prefer using optional chaining over a ternary.",[uE]:"Switch to `{{operator}}` operator.",[uD]:"Switch to optional chaining."},languages:["js/js"]}},"unicorn/prefer-optional-catch-binding":{create:e=>{e.on("CatchClause",t=>{let r=t.param;if(!r)return;let{sourceCode:n}=e;if(n.getDeclaredVariables(r.parent).some(e=>e.references.length>0))return;let{type:o,name:a,parent:i}=r,s=n.getCommentsInside(r).length>0;return{node:r,messageId:"Identifier"===o?uI:uj,data:{name:a},fix:s?void 0:function*(e){let t=n.getTokenBefore(r);tw(t,{test:ed,expected:"(",ruleId:"prefer-optional-catch-binding"});let o=n.getTokenAfter(r);tw(o,{test:em,expected:")",ruleId:"prefer-optional-catch-binding"}),yield e.remove(t),yield e.remove(r),yield e.remove(o);let[,a]=n.getRange(o),[s]=n.getRange(i.body),l=n.text.slice(a,s),u=l.length-l.trimStart().length;0!==u&&(yield e.removeRange([a,a+u]))}}})},meta:{type:"suggestion",docs:{description:"Prefer omitting the `catch` binding parameter.",recommended:"unopinionated"},fixable:"code",messages:{[uI]:"Remove unused catch binding `{{name}}`.",[uj]:"Remove unused catch binding."},languages:["js/js"]}},"unicorn/prefer-regexp-test":u9,"unicorn/prefer-set-has":pc,"unicorn/prefer-string-raw":{create:e=>{e.on("Literal",t=>{if(!e1(t)||function(e){let{parent:t}=e,{type:r}=t;return tr(t)||["Property","PropertyDefinition","MethodDefinition","AccessorProperty"].includes(r)&&!t.computed&&t.key===e||["TSAbstractPropertyDefinition","TSAbstractMethodDefinition","TSAbstractAccessorProperty","TSPropertySignature"].includes(r)&&t.key===e||["ImportDeclaration","ExportNamedDeclaration","ExportAllDeclaration"].includes(r)&&t.source===e||"ImportAttribute"===r&&(t.key===e||t.value===e)||"ImportSpecifier"===r&&t.imported===e||"ExportSpecifier"===r&&(t.local===e||t.exported===e)||"ExportAllDeclaration"===r&&t.exported===e||"JSXAttribute"===r&&t.value===e||"TSEnumMember"===r&&(t.initializer===e||t.id===e)||"TSModuleDeclaration"===r&&t.id===e||"TSExternalModuleReference"===r&&t.expression===e||"TSLiteralType"===r&&t.literal===e||"TSImportType"===r&&t.source===e}(t)||pd(t))return;let{sourceCode:r}=e,{raw:n}=t;if("\\"===n.at(-2)||!n.includes("\\\\")||n.includes("`")||n.includes("${")||r.getLoc(t).start.line!==r.getLoc(t).end.line)return;let o=pg(n.slice(1,-1),n.charAt(0));if(o===t.value)return{node:t,messageId:pm,*fix(r){yield oP(r,t,e),yield r.replaceText(t,`String.raw\`${o}\``)}}}),e.on("TemplateLiteral",t=>{if(!("TaggedTemplateExpression"===t.parent.type&&t.parent.quasi===t||t.quasis.every(({value:{cooked:e,raw:t}})=>e===t)||t.quasis.some(({value:{cooked:e,raw:t}})=>"\\"===e.at(-1)||pg(t)!==e)||pd(t)))return{node:t,messageId:pm,*fix(r){for(let n of(yield oP(r,t,e),yield r.insertTextBefore(t,"String.raw"),t.quasis)){let{cooked:t,raw:o}=n.value;t!==o&&(yield o_(n,t,e,r))}}}}),e.on("TaggedTemplateExpression",t=>{let{quasi:r,tag:n,parent:o}=t,{sourceCode:a}=e;if(!tc(n,{object:"String",property:"raw",optional:!1})||!a.isGlobalReference(n.object)||r.quasis.some(e=>e.value.raw.includes("\\")))return;let i=a.getText(r),s=r.expressions.length>0||/\r?\n/.test(i)?i:`'${i.slice(1,-1).replaceAll("'",()=>String.raw`\'`)}'`;return{node:n,messageId:pf,*fix(r){let n=a.getTokenBefore(t);nW(n,e,s)&&(yield r.insertTextBefore(t,";")),"ReturnStatement"!==o.type&&"ThrowStatement"!==o.type||nF(n,t.quasi,e)||eQ(t,e)||(yield oF(r,o,e)),"YieldExpression"!==o.type||o.delegate||o.argument!==t||nF(n,t.quasi,e)||eQ(t,e)||(yield r.insertTextBefore(t,"("),yield r.insertTextAfter(t,")")),yield r.replaceText(t.quasi,s),yield oT(t.tag,r,e),yield r.remove(t.tag)}}})},meta:{type:"suggestion",docs:{description:"Prefer using the `String.raw` tag to avoid escaping `\\`.",recommended:"unopinionated"},fixable:"code",messages:{[pm]:"`String.raw` should be used to avoid escaping `\\`.",[pf]:"Using `String.raw` is unnecessary as the string does not contain any `\\`."},languages:["js/js"]}},"unicorn/prefer-switch":pS,"unicorn/require-number-to-fixed-digits-argument":{create:e=>{e.on("CallExpression",t=>{if(!td(t,{method:"toFixed",argumentsLength:0,optionalCall:!1})||"NewExpression"===t.callee.object.type)return;let{sourceCode:r}=e,[n,o]=r.getLastTokens(t,2);return{loc:{start:r.getLoc(n).start,end:r.getLoc(o).end},messageId:pv,fix:r=>ow(r,t,"0",e)}})},meta:{type:"suggestion",docs:{description:"Enforce using the digits argument with `Number#toFixed()`.",recommended:"unopinionated"},fixable:"code",messages:{[pv]:"Missing the digits argument."},languages:["js/js"]}},"unicorn/template-indent":{create:e=>{let{sourceCode:t}=e,r={...e.options[0]},n=(e=>{let t=new Set,r=[e.ast];for(;r.length>0;){let n=r.pop();if(n){if("TemplateLiteral"===n.type){let{start:{line:r},end:{line:o}}=e.getLoc(n);for(let e=r+1;e<=o;e++)t.add(e)}for(let t of e.visitorKeys[n.type]??[]){let e=n[t];Array.isArray(e)?r.push(...e):r.push(e)}}}return t})(t);r.comments=r.comments.map(e=>e.toLowerCase());let o=new WeakSet,a=a=>{let i;if("TemplateLiteral"!==a.type||o.has(a))return;o.add(a);let s="__PLACEHOLDER__"+Math.random(),l=a.quasis.map(e=>t.getText(e).slice(1,e.tail?-1:-2)).join(s),u=l.match(/\r?\n/);if(!u)return;let p=u[0],c=t.getLoc(a),d=t.lines[c.start.line-1].match(/^(\s*)\S/),m=d?d[1]:"";i="string"==typeof r.indent?r.indent:"number"==typeof r.indent?" ".repeat(r.indent):((e,t,r,n)=>{if(""===r){let r;return pk(pj(e.lines,t)).indent||pk(pC(r=pj(n.split(/\r?\n/)))).indent||pk(r).indent||" "}return r.startsWith(" ")?" ":" "})(t,n,m,l);let f=pC(l).replaceAll(RegExp(`^${p}|${p}[ ]*$`,"g"),""),g=p+function(e,t=1,r={}){let{indent:n=" ",includeEmptyLines:o=!1}=r;if("string"!=typeof e)throw TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof e}\``);if("number"!=typeof t)throw TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof t}\``);if(t<0)throw RangeError(`Expected \`count\` to be at least 0, got \`${t}\``);if("string"!=typeof n)throw TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof n}\``);return 0===t?e:e.replace(o?/^/gm:/^(?!\s*$)/gm,n.repeat(t))}(f,1,{indent:m+i})+p+m;if(g!==l)return{node:a,messageId:pI,fix:t=>g.split(s).map((r,n)=>o_(a.quasis[n],r,e,t))}};e.on("TemplateLiteral",e=>{if((e=>{if(r.comments.length>0){let n=t.getTokenBefore(e,{includeComments:!0});if(n?.type==="Block"&&r.comments.includes(n.value.trim().toLowerCase()))return!0}return!!(pd(e)||r.tags.length>0&&th(e,r.tags))||!!(r.functions.length>0&&"CallExpression"===e.parent.type&&e.parent.arguments.includes(e)&&ty(e.parent.callee,r.functions))})(e))return a(e)}),e.on(r.selectors,e=>a(e))},meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation.",recommended:!0},fixable:"code",schema:pF,defaultOptions:[{tags:["outdent","dedent","gql","sql","html","styled"],functions:["dedent","stripIndent"],selectors:[],comments:["HTML","indent"]}],messages:{[pI]:"Templates should be properly indented."},languages:["js/js"]}},"unicorn/no-single-promise-in-promise-methods":{create:e=>{e.on("CallExpression",t=>{if(!(td(t,{object:"Promise",methods:sJ,optionalMember:!1,optionalCall:!1,argumentsLength:1})&&"ArrayExpression"===t.arguments[0].type&&1===t.arguments[0].elements.length&&t.arguments[0].elements[0]&&"SpreadElement"!==t.arguments[0].elements[0].type))return;let r=t.callee.property.name,n={node:t.arguments[0],messageId:sz,data:{method:r}},{sourceCode:o}=e;if("AwaitExpression"===t.parent.type&&t.parent.argument===t&&("all"!==r||ti(t.parent.parent)))return n.fix=r=>r.replaceText(t,sX(t,e)),n;return"all"===r?(n.fix=((e,t)=>{let{sourceCode:r}=t;if(sY(r,e))return;let n=e.parent;if("AwaitExpression"!==n.type||n.argument!==e)return;let o=(e=>{let{parent:t}=e;return"VariableDeclarator"===t.type&&t.init===e&&sH(t.id)?t.id:"AssignmentExpression"===t.type&&t.right===e&&sH(t.left)&&ti(t.parent)?t.left:void 0})(n);if(o){if(sY(r,o))return;return function*(n){yield n.replaceText(o,r.getText(o.elements[0])),yield n.replaceText(e,sX(e,t))}}let a=n.parent;if("MemberExpression"===a.type&&a.computed&&e0(a.property,0)&&a.object===n&&("VariableDeclarator"===a.parent.type&&a.parent.init===a||"AssignmentExpression"===a.parent.type&&a.parent.right===a)&&!sY(r,a))return r=>r.replaceText(a,`await ${sX(e,t)}`)})(t,e),n):(n.suggest=[{messageId:sK,fix:r=>{let[n]=t.arguments[0].elements,o=eZ(n,e);return eQ(n,e)||"Identifier"===n.type||"MemberExpression"===n.type||(o=`(${o})`),nW(e.sourceCode.getTokenBefore(t),e,o)&&(o=`;${o}`),r.replaceText(t,o)}},{messageId:sG,fix:function*(e){let r=t.callee.property;yield e.replaceText(r,"resolve");let[n]=t.arguments,a=o.getFirstToken(n),[i,s]=o.getLastTokens(n,2);yield e.remove(a),yield e.remove(s),eu(i)&&(yield e.remove(i))}}],n)})},meta:{type:"suggestion",docs:{description:"Disallow passing single-element arrays to `Promise` methods.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[sz]:"Wrapping single-element array with `Promise.{{method}}()` is unnecessary.",[sK]:"Use the value directly.",[sG]:"Switch to `Promise.resolve(…)`."},languages:["js/js"]}},"unicorn/no-await-in-promise-methods":{create:e=>{e.on("CallExpression",function*(t){if(td(t,{object:"Promise",methods:p$,optionalMember:!1,optionalCall:!1,argumentsLength:1})&&"ArrayExpression"===t.arguments[0].type)for(let r of t.arguments[0].elements)r?.type==="AwaitExpression"&&(yield{node:r,messageId:pB,data:{method:t.callee.property.name},suggest:[{messageId:pR,*fix(t){let n=e.sourceCode.getFirstToken(r);yield t.remove(n),yield oB(n,e,t)}}]})})},meta:{type:"suggestion",docs:{description:"Disallow using `await` in `Promise` method parameters.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[pB]:"Promise in `Promise.{{method}}()` should not be awaited.",[pR]:"Remove `await`."},languages:["js/js"]}},"unicorn/no-negation-in-equality-check":{create:e=>{e.on("BinaryExpression",t=>{let{operator:r,left:n}=t;if(!("BinaryExpression"===t.type&&pN.has(t.operator)&&pM(n)&&!pM(n.argument)))return;let{sourceCode:o}=e,a=o.getFirstToken(n),i=`${r.startsWith("!")?"=":"!"}${r.slice(1)}`;return{node:a,messageId:pP,suggest:[{messageId:pL,data:{operator:i},*fix(s){yield oP(s,t,e);let l=o.getTokenAfter(a),{parent:u}=t;("ReturnStatement"===u.type||"ThrowStatement"===u.type)&&!eQ(t,e)&&(nF(o.getFirstToken(u),l,e)||(yield oF(s,u,e))),yield s.remove(a),nW(o.getTokenBefore(a),e,l.value)&&(yield s.insertTextAfter(a,";"));let p=o.getTokenAfter(n,e=>"Punctuator"===e.type&&e.value===r);yield s.replaceText(p,i)}}]}})},meta:{type:"problem",docs:{description:"Disallow negated expression in equality check.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[pP]:"Negated expression is not allowed in equality check.",[pL]:"Switch to '{{operator}}' check."},languages:["js/js"]}},"unicorn/no-unnecessary-slice-end":{create(e){pO(e,{methods:["slice"],messageId:pq})},meta:{type:"suggestion",docs:{description:"Disallow using `.length` or `Infinity` as the `end` argument of `{Array,String,TypedArray}#slice()`.",recommended:"unopinionated"},fixable:"code",messages:{[pq]:"Passing `{{description}}` as the `end` argument is unnecessary."},languages:["js/js"]}},"unicorn/no-lonely-if":{create:e=>{e.on("IfStatement",t=>{if(cr(t)&&("BlockStatement"===t.parent.type&&1===t.parent.body.length&&t.parent.body[0]===t&&cr(t.parent.parent)&&t.parent.parent.consequent===t.parent||cr(t.parent)&&t.parent.consequent===t))return{node:t,messageId:ct,fix:function(e,t){let{sourceCode:r}=t;return n=>{var o,a;let i=("BlockStatement"===e.parent.type?e.parent:e).parent,s={...i,...cn(i,r)},l={...e,...cn(e,r)},u=cs(s,r),p=cl(s,t,r),c=ci(ca(cs(l,r)),cl(l,t,r)),d=function(e,t,r,n){let o=[...n.getRange(e)];if("BlockStatement"===t.type)return o;let a=n.getLastToken(t);if(ey(a)){let t=n.getTokenAfter(e);t&&nW(a,r,t.value)&&(o[1]=n.getRange(t)[0])}return o}(i,l.consequent,t,r),m={outerConditionGap:s.openingBraceToken?ca(co(s.closingParenthesisToken,s.openingBraceToken,r)):"",outerLeadingContent:s.openingBraceToken?ca(co(s.openingBraceToken,l.ifToken,r)):ca(co(s.closingParenthesisToken,l.ifToken,r)),outerTrailingContent:s.openingBraceToken?ca(co(l,s.closingBraceToken,r)):""},f=(o=m.outerConditionGap,a=m.outerLeadingContent,o.trimStart().startsWith("//")?{leadingStatementText:ca(a).trimStart(),conditionSuffixText:o}:{leadingStatementText:ca(ci(o,a)).trimStart(),conditionSuffixText:""}),{leadingStatementText:g}=f,y=function({outerIfStatement:e,inner:t,replacementRange:r,sourceCode:n,consequentTextPieces:o,outerConditionGapTextPieces:a}){let{outerTrailingContent:i}=o,{conditionSuffixText:s}=a;if("BlockStatement"===t.consequent.type){let e=co(t.closingParenthesisToken,t.openingBraceToken,n),r=co(t.openingBraceToken,t.closingBraceToken,n);return`${s}${e}{${r}${i}}`}let l=co(t.closingParenthesisToken,t.consequent,n),u=`${s}${l}${((e,t)=>{let[r,n]=t.getRange(e);return t.text.slice(r,n)})(t.consequent,n)}${i}`;return`${u}${((e,t,r)=>{let[,n]=r.getRange(e);if(t[1]===n)return"";let o=r.text.slice(n,t[1]);return""===o.trim()?o.includes("\n")?`;${o}`:";":`;${o}`})(e,r,n)}`}({outerIfStatement:i,inner:l,replacementRange:d,sourceCode:r,consequentTextPieces:m,outerConditionGapTextPieces:f});return n.replaceTextRange(d,`${g}if${u}(${p} && ${c})${y}`)}}(t,e)}})},meta:{type:"suggestion",docs:{description:"Disallow `if` statements as the only statement in `if` blocks without `else`.",recommended:"unopinionated"},fixable:"code",messages:{[ct]:"Unexpected `if` as the only statement in a `if` block without `else`."},languages:["js/js"]}},"unicorn/no-magic-array-flat-depth":{create:e=>{e.on("CallExpression",t=>{if(!td(t,{method:"flat",argumentsLength:1,optionalCall:!1}))return;let[r]=t.arguments;if(!e8(r)||1===r.value)return;let{sourceCode:n}=e,{openingParenthesisToken:o,closingParenthesisToken:a}=tX(t,e);if(!n.commentsExistBetween(o,a))return{node:r,messageId:cu}})},meta:{type:"suggestion",docs:{description:"Disallow a magic number as the `depth` argument in `Array#flat(…).`",recommended:"unopinionated"},messages:{[cu]:"Magic number as depth is not allowed."},languages:["js/js"]}},"unicorn/no-negated-condition":{create:e=>{e.on(["IfStatement","ConditionalExpression"],t=>{if("IfStatement"===t.type&&(!t.alternate||"IfStatement"===t.alternate.type))return;let{test:r}=t;if("UnaryExpression"===r.type&&"!"===r.operator||"BinaryExpression"===r.type&&("!="===r.operator||"!=="===r.operator))return{node:r,messageId:cp,*fix(n){if(yield function*(e,t,r){let{sourceCode:n}=r,{test:o}=t;if("UnaryExpression"===o.type){let a=n.getFirstToken(o);"IfStatement"===t.type&&(yield oT(o.argument,e,r)),yield e.remove(a);return}let a=n.getTokenAfter(o.left,e=>"Punctuator"===e.type&&e.value===o.operator);yield e.replaceText(a,"="+a.value.slice(1))}(n,t,e),yield function*(e,t,r){let n="IfStatement"===t.type,[o,a]=[t.consequent,t.alternate].map(e=>{let t=eH(e,r),o=r.sourceCode.text.slice(...t);return n&&"BlockStatement"!==e.type&&(o=`{${o}}`),{range:t,text:o}});if(o.text===a.text)return;let{sourceCode:i}=r;yield e.replaceTextRange(i.getRange(o),a.text),yield e.replaceTextRange(i.getRange(a),o.text)}(n,t,e),"ConditionalExpression"!==t.type||"UnaryExpression"!==r.type)return;yield oP(n,t,e);let{sourceCode:o}=e,{parent:a}=t,[i,s]=o.getFirstTokens(r,2);"ReturnStatement"!==a.type&&"ThrowStatement"!==a.type||a.argument!==t||nF(i,s,e)||eQ(t,e)||eQ(r,e)?nW(o.getTokenBefore(t),e,s.value)&&(yield n.insertTextBefore(t,";")):yield oF(n,a,e)}}})},meta:{type:"suggestion",docs:{description:"Disallow negated conditions.",recommended:"unopinionated"},fixable:"code",messages:{[cp]:"Unexpected negated condition."},languages:["js/js"]}},"unicorn/no-object-as-default-parameter":{create:e=>{e.on("AssignmentPattern",e=>{if(!("ObjectExpression"===e.right.type&&e.right.properties.length>0&&tl(e.parent)&&e.parent.params.includes(e)))return;let{left:t,right:r}=e;return"Identifier"===t.type?{node:t,messageId:cc,data:{parameter:t.name}}:{node:r,messageId:cd}})},meta:{type:"problem",docs:{description:"Disallow the use of objects as default parameters.",recommended:"unopinionated"},messages:{[cc]:"Do not use an object literal as default for parameter `{{parameter}}`.",[cd]:"Do not use an object literal as default."},languages:["js/js"]}},"unicorn/prefer-negative-index":{create:e=>{e.on("CallExpression",t=>{if("MemberExpression"!==t.callee.type)return;let r=function(e){let{callee:t,arguments:r}=e,n=t.property.name,o=t.object,a=r;if(cf.has(n))return{method:n,target:o,argumentsNodes:a};if("call"!==n&&"apply"!==n||(n=cg(t.object),!cf.has(n)))return;let i="apply"===t.property.name,{supportObjects:s}=cf.get(n),l=t.object.object;if(to(l)||"slice"===n&&e0(l,"")||"prototype"===cg(l)&&"Identifier"===l.object.type&&s.has(l.object.name)){if([o]=r,i){let[,e]=r;if(!e||"ArrayExpression"!==e.type)return;a=e.elements}else a=r.slice(1);return{method:n,target:o,argumentsNodes:a}}}(t);if(!r)return;let{method:n,target:o,argumentsNodes:a}=r,{argumentsIndexes:i}=cf.get(n),s=i.map(e=>(function e(t,r){let n;if(!t)return;let{type:o,operator:a,left:i,right:s}=t=ry(t);if("BinaryExpression"!==o||"-"!==a||!(e8(n=ry(s))&&n.value>0))return;let l=ry(i);return"MemberExpression"===l.type&&!l.computed&&!l.optional&&"Identifier"===l.property.type&&"length"===l.property.name&&ly(l.object,r)?i:e(i,r)})(a[e],o)).filter(Boolean);if(0!==s.length)return{node:t,messageId:cm,data:{method:n},*fix(t){for(let r of s)yield function(e,t,r){let[n,o]=eH(e,r);return t.removeRange([n,o+r.sourceCode.text.slice(o).match(/\S|$/).index])}(r,t,e)}}})},meta:{type:"suggestion",docs:{description:"Prefer negative index over `.length - index` when possible.",recommended:"unopinionated"},fixable:"code",messages:{[cm]:"Prefer negative index over length minus index for `{{method}}`."},languages:["js/js"]}},"unicorn/prefer-node-protocol":{create:e=>{e.on("Literal",t=>{if(!(["ImportDeclaration","ExportNamedDeclaration","ExportAllDeclaration","ImportExpression","TSImportType"].includes(t.parent.type)&&t.parent.source===t||(td(t.parent,{object:"process",method:"getBuiltinModule",argumentsLength:1,optionalCall:!1,optionalMember:!1})||tf(t.parent))&&t.parent.arguments[0]===t))return;let{value:r}=t;if(!("string"==typeof r&&!r.startsWith(cb)&&ch(r)&&ch(`${cb}${r}`)))return;let n=e.sourceCode.getRange(t)[0]+1;return{node:t,messageId:cx,data:{moduleName:r},fix:e=>e.insertTextAfterRange([n,n],cb)}})},meta:{type:"suggestion",docs:{description:"Prefer using the `node:` protocol when importing Node.js builtin modules.",recommended:"unopinionated"},fixable:"code",messages:{[cx]:"Prefer `node:{{moduleName}}` over `{{moduleName}}`."},languages:["js/js"]}},"unicorn/consistent-date-clone":{create:e=>{e.on("NewExpression",t=>{if(!te(t,{name:"Date",argumentsLength:1}))return;let[r]=t.arguments;if(!td(r,{method:"getTime",argumentsLength:0,optionalCall:!1,optionalMember:!1}))return;let{sourceCode:n}=e;return{node:r,loc:{start:n.getLoc(r.callee.property).start,end:n.getLoc(r).end},messageId:cE,fix:t=>oO(t,r,e)}})},meta:{type:"suggestion",docs:{description:"Prefer passing `Date` directly to the constructor when cloning.",recommended:"unopinionated"},fixable:"code",messages:{[cE]:"Unnecessary `.getTime()` call."},languages:["js/js"]}},"unicorn/no-accessor-recursion":{create:e=>{let{sourceCode:t}=e;e.on("ThisExpression",e=>{let r=((e,t)=>{for(let r=e.getScope(t);r;r=r.upper){if("class"===r.type)return;if("function"===r.type&&"ArrowFunctionExpression"!==r.block.type)return r}})(t,e);if(!r)return;let n=r.block.parent;if(["Property","MethodDefinition"].includes(n?.type)&&!n.computed&&["set","get"].includes(n.kind)&&cS(n.key)&&("get"===n.kind&&(cC(e,n)||"VariableDeclarator"===e.parent.type&&e.parent.init===e&&"ObjectPattern"===e.parent.id.type&&e.parent.id.properties.some(e=>"Property"===e.type&&!e.computed&&cv(e.key,n.key)))||"set"===n.kind&&((e,t)=>{if(!cC(e,t))return!1;let r=e.parent,{parent:n}=r;return("AssignmentExpression"===n.type||"AssignmentPattern"===n.type)&&n.left===r||"UpdateExpression"===n.type&&n.argument===r||"ArrayPattern"===n.type&&n.elements.includes(r)||"RestElement"===n.type&&n.argument===r||("ForOfStatement"===n.type||"ForInStatement"===n.type)&&n.left===r||"Property"===n.type&&n.value===r&&"ObjectPattern"===n.parent.type&&n.parent.properties.includes(r.parent)})(e,n)))return{node:e.parent,messageId:cD,data:{kind:n.kind}}})},meta:{type:"problem",docs:{description:"Disallow recursive access to `this` within getters and setters.",recommended:"unopinionated"},defaultOptions:[],messages:{[cD]:"Disallow recursive access to `this` within {{kind}}ters."},languages:["js/js"]}},"unicorn/prefer-import-meta-properties":{create:function(e){let{sourceCode:t}=e;e.on("MetaProperty",function*(e){if("MetaProperty"!==e.type||"import"!==e.meta.name||"meta"!==e.property.name)return;let r=e.parent;if(!tc(r,{properties:["url","filename"],computed:!1,optional:!1}))return;let n=r.property.name;if("url"===n){if(ck(r.parent,t)&&r.parent.arguments[0]===r)return void(yield a(r.parent,{reportFilenameNode:!0}));if(te(r.parent,{name:"URL",minimumArguments:1,maximumArguments:2})){var o;let e=r.parent,n=e.parent;if(1===e.arguments.length&&e.arguments[0]===r&&ck(n,t)&&n.arguments[0]===e)return void(yield a(n,{reportFilenameNode:!0}));2===e.arguments.length&&(o=e.arguments[0],o?.type==="Literal"&&("."===o.value||"./"===o.value))&&e.arguments[1]===r&&ck(n,t)&&n.arguments[0]===e&&(yield i(n,"dirname"))}return}function*a(e,{reportFilenameNode:r=!1}={}){let{parent:n}=e;if(cI(n,t)&&n.arguments[0]===e)return void(yield i(n,"dirname"));if(r&&(yield i(e,"filename")),"VariableDeclarator"!==n.type||n.init!==e||"Identifier"!==n.id.type||"VariableDeclaration"!==n.parent.type||"const"!==n.parent.kind)return;let o=ei(t.getScope(n.id),n.id);if(o)for(let e of o.references){if(!e.isReadOnly())continue;let{parent:r}=e.identifier;cI(r,t)&&r.arguments[0]===e.identifier&&(yield i(r,"dirname"))}}function i(e,t){return{node:e,messageId:"dirname"===t?cA:cT,fix:r=>r.replaceText(e,`import.meta.${t}`)}}"filename"===n&&(yield a(r))})},meta:{type:"suggestion",docs:{description:"Prefer `import.meta.{dirname,filename}` over legacy techniques for getting file paths.",recommended:!1},fixable:"code",messages:{[cA]:"Do not construct dirname.",[cT]:"Do not construct filename using `fileURLToPath()`."},languages:["js/js"]}},"unicorn/no-unnecessary-array-flat-depth":{create:e=>{e.on("CallExpression",t=>{if(!(td(t,{method:"flat",argumentsLength:1,optionalCall:!1})&&e0(t.arguments[0],1)))return;let[r]=t.arguments;return{node:r,messageId:cj,fix:t=>ok(t,r,e)}})},meta:{type:"suggestion",docs:{description:"Disallow using `1` as the `depth` argument of `Array#flat()`.",recommended:"unopinionated"},fixable:"code",messages:{[cj]:"Passing `1` as the `depth` argument is unnecessary."},languages:["js/js"]}},"unicorn/no-unnecessary-array-splice-count":{create(e){pO(e,{methods:["splice","toSpliced"],messageId:cF})},meta:{type:"suggestion",docs:{description:"Disallow using `.length` or `Infinity` as the `deleteCount` or `skipCount` argument of `Array#{splice,toSpliced}()`.",recommended:"unopinionated"},fixable:"code",messages:{[cF]:"Passing `{{description}}` as the `{{argumentName}}` argument is unnecessary."},languages:["js/js"]}},"unicorn/no-useless-error-capture-stack-trace":{create:e=>{let t=[],r=[];e.on(["ClassDeclaration","ClassExpression"],e=>{t.push(e),r.push(e)}),e.onExit(["ClassDeclaration","ClassExpression"],()=>{t.pop(),r.pop()}),e.on(["FunctionDeclaration","FunctionExpression"],e=>{r.push(e)}),e.onExit(["FunctionDeclaration","FunctionExpression"],()=>{r.pop()}),e.on("CallExpression",n=>{let o,a=t.at(-1);if(!(a?.superClass&&"Identifier"===a.superClass.type&&i4.includes(a.superClass.name)&&e.sourceCode.isGlobalReference(a.superClass)&&(o=r.at(-1),o&&"MethodDefinition"===o.parent.type&&"constructor"===o.parent.kind&&o.parent.value===o&&a.body.body.includes(o.parent))&&td(n,{object:"Error",method:"captureStackTrace",argumentsLength:2,optionalMember:!1})&&e.sourceCode.isGlobalReference(n.callee.object)))return;let[i,s]=n.arguments;if("ThisExpression"!==i.type||!((e,t,r)=>{if("MetaProperty"===e.type&&"Identifier"===e.meta.type&&"new"===e.meta.name&&"Identifier"===e.property.type&&"target"===e.property.name||tc(e,{property:"constructor",computed:!1,optional:!1})&&"ThisExpression"===e.object.type)return!0;if("Identifier"!==e.type||!t.id)return!1;let n=ei(r.sourceCode.getScope(e),e);return n&&1===n.defs.length&&"ClassName"===n.defs[0].type&&n.defs[0].node===t})(s,a,e))return;let l={node:n,messageId:cB},u="ChainExpression"===n.parent.type?n.parent.parent:n.parent;return"ExpressionStatement"===u.type&&"BlockStatement"===u.parent.type&&(l.fix=e=>e.remove(u)),l})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary `Error.captureStackTrace(…)`.",recommended:"unopinionated"},fixable:"code",messages:{[cB]:"Unnecessary `Error.captureStackTrace(…)` call."},languages:["js/js"]}},"unicorn/prefer-class-fields":{create:e=>{let{sourceCode:t}=e;e.on("ClassBody",r=>{let n=r.body.find(e=>"constructor"===e.kind&&!e.computed&&!e.static&&"MethodDefinition"===e.type&&"FunctionExpression"===e.value.type);if(!n)return;let o=n.value.body.body.find(e=>"EmptyStatement"!==e.type);if(!(o?.type==="ExpressionStatement"&&"AssignmentExpression"===o.expression.type&&"="===o.expression.operator&&"MemberExpression"===o.expression.left.type&&"ThisExpression"===o.expression.left.object.type&&!o.expression.left.computed&&["Identifier","PrivateIdentifier"].includes(o.expression.left.property.type)&&"Literal"===o.expression.right.type))return;let a=o.expression.left.property.name,i=o.expression.right.raw,s=o.expression.left.property.type,l=r.body.find(e=>"PropertyDefinition"===e.type&&!e.computed&&!e.static&&e.key.type===s&&e.key.name===a),u={node:o,messageId:cR};function*p(s){if(yield((e,t,r)=>{let{line:n}=t.getLoc(e).start,o=t.getText(e);return t.lines[n-1].trim()===o?r.removeRange([t.getIndexFromLoc({line:n,column:0}),t.getIndexFromLoc({line:n+1,column:0})]):r.remove(e)})(o,t,s),l){if(l.value)return void(yield s.replaceText(l.value,i));let e=` = ${i}`,r=t.getLastToken(l);return ep(r)?void(yield s.insertTextBefore(r,e)):void(yield s.insertTextAfter(l,`${e};`))}let u=t.getLastToken(r),p=t8(n,e),c=`${p}${a} = ${i};
|
|
19
27
|
`;"\n"!==t.getText()[t.getRange(u)[0]-1]&&(c=`
|
|
20
|
-
${c}`);let d=r.body.at(-1);"PropertyDefinition"===d.type&&";"!==t.getLastToken(d).value&&(c=`;${c}`),yield s.insertTextBefore(u,c)}return l?.value?u.suggest=[{messageId:cn,fix:p}]:u.fix=p,u})},meta:{type:"suggestion",docs:{description:"Prefer class field declarations over `this` assignments in constructors.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[cr]:"Prefer class field declaration over `this` assignment in constructor for static values.",[cn]:"Encountered same-named class field declaration and `this` assignment in constructor. Replace the class field declaration with the value from `this` assignment."},languages:["js/js"]}},"unicorn/prefer-bigint-literals":{create:e=>{e.on("CallExpression",t=>{if(!e7(t,{name:"BigInt",argumentsLength:1,optional:!1}))return;let[r]=t.arguments,n=function(e){let t,r;if(e1(e)){let t,r=e.raw.slice(1,-1);try{t=BigInt(r)}catch{return}let n=0n===t?"0":r.trim();return n.startsWith("+")&&(n=n.slice(1).trim()),{shouldUseSuggestion:r.includes("+"),text:`${n}n`,bigint:t}}let n=!1,o=!1;for(;"UnaryExpression"===e.type&&e.prefix;)if("+"===e.operator)n=!0,e=e.argument;else{if("-"!==e.operator)return;o=!o,e=e.argument}let{value:a,raw:i}=e;if(Number.isInteger(a)){try{t=BigInt(a)}catch{return}return(e=>{let t=e.raw.replaceAll("_","").toLowerCase();if(t.includes("."))return!1;let{value:r}=e;for(let{prefix:e,base:n}of[{prefix:"0b",base:2},{prefix:"0o",base:8},{prefix:"0x",base:16}])if(t.startsWith(e))return t.slice(2)===r.toString(n);return!t.includes("e")&&t===String(r)})(e)?r=`${i}n`:(r=`${t}n`,n=!0),o&&0n!==t&&(r=`-${r}`,t=-t),{shouldUseSuggestion:n,text:r,bigint:t}}}(r);if(!n)return;let o={node:t,messageId:co},{shouldUseSuggestion:a,text:i,bigint:s}=n,l=r=>{let n=i;return!eZ(t,e)&&s<0n&&(n=`(${n})`,nS(e.sourceCode.getTokenBefore(t),e,n)&&(n=`;${n}`)),r.replaceText(t,n)};return a||e.sourceCode.getCommentsInside(t).length>0?o.suggest=[{messageId:ca,data:{replacement:i.length<20?`\`${i}\``:"a bigint literal"},fix:l}]:o.fix=l,o})},meta:{type:"suggestion",docs:{description:"Prefer `BigInt` literals over the constructor.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[co]:"Prefer using bigint literal over `BigInt(…)`.",[ca]:"Replace with {{replacement}}."},languages:["js/js"]}},"unicorn/prefer-classlist-toggle":{create:e=>{let{sourceCode:t}=e;e.on(["IfStatement","ConditionalExpression"],r=>{let n=[r.consequent,r.alternate].map(e=>{if(e)return"BlockStatement"===e.type&&1===e.body.length&&(e=e.body[0]),"ExpressionStatement"===e.type&&(e=e.expression),"ChainExpression"===e.type&&(e=e.expression),e});if(n.some(e=>!cc(e,["add","remove"])))return;let[o,a]=n;if(o.callee.property.name!==a.callee.property.name&&cd(o,a))return cu(r,function*(n){let i=eQ(o.callee.object.object,e),s=eQ(o.arguments[0],e),l="ConditionalExpression"===r.type,u="remove"===o.callee.property.name,p=r.test,c=cm(p,u,o),d=c?"":cp(p,e,u),m=o.callee.object.optional||a.callee.object.optional||c?.callee.object.optional,f=`${i}${m?"?":""}.classList.toggle(${s}${d?`, ${d}`:""})`;l||(f+=";"),nS(t.getTokenBefore(r),e,f)&&(f=`;${f}`),yield n.replaceText(r,f),l&&(yield of(n,r,e))})}),e.on("ConditionalExpression",t=>{let r=[t.consequent,t.alternate];if(!(r.every(e=>e1(e)&&("add"===e.value||"remove"===e.value))&&r[0].value!==r[1].value&&"MemberExpression"===t.parent.type&&t.parent.computed&&!t.parent.optional&&t.parent.property===t&&cl(t.parent.object)&&e7(t.parent.parent,{optional:!1,argumentsLength:1})&&t.parent.parent.callee===t.parent))return;let n=t.parent,o=n.parent;return cu(o,function*(r){let a="remove"===t.consequent.value,i=t.test,s=cm(i,a,o)?"":cp(i,e,a);s&&(yield r.insertTextAfter(o.arguments[0],`, ${s}`)),yield oy(r,n,e,".toggle")},t)})},meta:{type:"suggestion",docs:{description:"Prefer using `Element#classList.toggle()` to toggle class names.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[ci]:"Prefer using `Element#classList.toggle()` to toggle class names.",[cs]:"Replace with `Element#classList.toggle()`."},languages:["js/js"]}},"unicorn/require-module-attributes":{create:e=>{let{sourceCode:t}=e;e.on(["ImportDeclaration","ExportNamedDeclaration","ExportAllDeclaration"],e=>{let{source:r,attributes:n}=e;if(!r||Array.isArray(n)&&n.length>0)return;let o=t.getTokenAfter(r);if(o?.type!=="Keyword"||"with"!==o.value)return;let a=t.getTokenAfter(o),i=t.getTokenAfter(a);return{node:e,loc:{start:t.getLoc(a).start,end:t.getLoc(i).end},messageId:cf,data:{type:"ImportDeclaration"===e.type?"import statement":"export statement"},fix:e=>[o,i,a].map(t=>e.remove(t))}}),e.on("ImportExpression",r=>{let{options:n}=r;if(n?.type!=="ObjectExpression")return;let o=n.properties.find(e=>"Property"===e.type&&!e.method&&!e.shorthand&&!e.computed&&"init"===e.kind&&("Identifier"===e.key.type&&"with"===e.key.name||"Literal"===e.key.type&&"with"===e.key.value)&&ta(e.value)),a=0===n.properties.length||o&&1===n.properties.length?n:o;if(!a)return;let i="Property"===a.type;return{node:o?.value??a,messageId:cf,data:{type:"import expression"},fix:r=>i?function*(e,t,r){let{sourceCode:n}=r;for(let r of n.getTokens(t))yield e.remove(r);let o=n.getTokenAfter(t);if(eu(o))yield e.remove(o);else{let{properties:r}=t.parent;if(r.length>1&&r.at(-1)===t){let r=n.getTokenBefore(t);yield e.remove(r)}}}(r,a,e):[t.getTokenBefore(a,eu),...t.getTokens(a),...eY(a,e)].map(e=>r.remove(e))}})},meta:{type:"suggestion",docs:{description:"Require non-empty module attributes for imports and exports",recommended:"unopinionated"},fixable:"code",messages:{[cf]:"{{type}} with empty attribute list is not allowed."},languages:["js/js"]}},"unicorn/no-immediate-mutation":{create:e=>{for(let t of cT)e.on(["VariableDeclarator","AssignmentExpression"],r=>(function(e,t,{testValue:r,getProblematicNode:n,getProblem:o,getFix:a}){let i,s="AssignmentExpression"===t.type,[l,u]=(s?["left","right"]:["id","init"]).map(e=>t[e]);if(!("Identifier"===l.type&&r(u)))return;let p=t.parent;if(!(s&&"="===t.operator&&"ExpressionStatement"===p.type&&p.expression===t||!s&&"VariableDeclaration"===(i=t.parent).type&&i.declarations.at(-1)===t))return;let c=nG(p,e);if(c?.type!=="ExpressionStatement")return;let d="VariableDeclarator"===t.type?e.sourceCode.getDeclaredVariables(t).find(e=>1===e.defs.length&&e.defs[0].name===t.id):ei(e.sourceCode.getScope(t),t.left.name);if(!d)return;let m={context:e,variable:d,variableNode:l,valueNode:u,statement:p,nextExpressionStatement:c,assignType:s?"assignment":"declaration",getFix:a},f=n(m);if(f)return o(f,m)})(e,r,t))},meta:{type:"suggestion",docs:{description:"Disallow immediate mutation after variable assignment.",recommended:!0},fixable:"code",hasSuggestions:!0,messages:{[cg]:"Immediate mutation on {{objectType}} is not allowed.",[cy]:"{{operation}} the elements to the {{assignType}}.",[ch]:"Move this property to the {{assignType}}.",[cx]:"{{description}} the {{assignType}}.",[cb]:"Move the element to the {{assignType}}.",[cE]:"Move the entry to the {{assignType}}."},languages:["js/js"]}},"unicorn/no-useless-collection-argument":{create:e=>{e.on("NewExpression",t=>{var r;let n;if(!te(t,{names:["Set","Map","WeakSet","WeakMap"],argumentsLength:1}))return;let[o]=t.arguments,a="LogicalExpression"===o.type&&"??"===o.operator,i=a?o.right:o,s=to(r=i)?"empty array":e0(r,"")?"empty string":e9(r)?"`null`":th(r)?"`undefined`":void 0;if(!s)return;let l=!1;if(a)n=function*(t){let{sourceCode:r}=e,n=i.parent,{left:o}=n,a=eZ(o,e),[,s]=a?eH(o,e):r.getRange(o),[,l]=r.getRange(n);yield t.removeRange([s,l]),(a||"SequenceExpression"!==o.type)&&(yield oi(n,t,e))};else e.sourceCode.getCommentsInside(i).length>0&&(l=!0),n=t=>ol(t,i,e);let u={node:i,messageId:cw,data:{description:s}};return l?u.suggest=[{messageId:cI,fix:n}]:u.fix=n,u})},meta:{type:"suggestion",docs:{description:"Disallow useless values or fallbacks in `Set`, `Map`, `WeakSet`, or `WeakMap`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[cw]:"The {{description}} is useless.",[cI]:"Remove the {{description}}"},languages:["js/js"]}},"unicorn/prefer-response-static-json":{create:e=>{e.on("NewExpression",t=>{if(!te(t,{name:"Response",minimumArguments:1}))return;let[r]=t.arguments;if(tc(r,{object:"JSON",method:"stringify",argumentsLength:1,optionalCall:!1,optionalMember:!1}))return{node:r.callee,messageId:cF,*fix(n){yield n.insertTextAfter(t.callee,".json"),yield od(t,e,n);let[o]=r.arguments,a=eH(r,e),i=eH(o,e);yield n.removeRange([a[0],i[0]]),yield n.removeRange([i[1],a[1]]),!eZ(t,e)&&eZ(t.callee,e)&&nS(e.sourceCode.getTokenBefore(t),e,"(")&&(yield n.insertTextBefore(t,";"))}}})},meta:{type:"suggestion",docs:{description:"Prefer `Response.json()` over `new Response(JSON.stringify())`.",recommended:"unopinionated"},fixable:"code",messages:{[cF]:"Prefer using `Response.json(…)` over `JSON.stringify()`."},languages:["js/js"]}},"unicorn/filename-case":{create:e=>{let t=e.physicalFilename;if("<input>"===t||"<text>"===t)return;let r=e.options[0]||{},n=function(e){if(e.case)return[e.case];if(e.cases){let t=Object.keys(e.cases).filter(t=>e.cases[t]);return t.length>0?t:["kebabCase"]}return["kebabCase"]}(r),o=(r.ignore||[]).map(e=>c.isRegExp(e)?e:RegExp(e,"u")),a=!1!==r.multipleFileExtensions,i=!1!==r.checkDirectories,s=n.map(e=>c1[e].fn);e.on(t7,r=>{if("Document"!==r.type||r.parent?.type!=="Program")return(()=>{var r;let l,u,p=(r=e.cwd,""===(l=d.relative(r,d.resolve(r,t)))||".."===l||l.startsWith(`..${d.sep}`)||d.isAbsolute(l)?[d.basename(t)]:l.split(d.sep).filter(e=>"."!==e)),{basename:c,filename:m,middle:f,extension:g}=function(e,{multipleFileExtensions:t}){let r=d.extname(e),n=d.basename(e,r),o={basename:n+r,filename:n,middle:"",extension:r};if(t){let[e]=n.split(".");Object.assign(o,{filename:e,middle:n.slice(e.length)})}return o}(p.at(-1),{multipleFileExtensions:a});if(p.some(e=>o.some(t=>t.test(e))))return;if(i)for(let e of p.slice(0,-1)){let t=function(e,t,r){let n,{leading:o,words:a}=c6(e);if(e.startsWith("$")||c2(a,r))return;let i=c3(a,r,{leading:o,trailing:""});return{loc:{column:0,line:1},messageId:cz,data:{directory:e,chosenCases:c9(t),renamedDirectories:(n=i.map(e=>`\`${e}\``),cX.format(n))}}}(e,n,s);if(t)return t}if(cJ.has(c))return;let{leading:y,words:h}=c6(m);if(m.startsWith("$")||c2(h,s))return g!==g.toLowerCase()?{loc:{column:0,line:1},messageId:cK,data:{filename:m+f+g.toLowerCase(),extension:g}}:void 0;let x=c3(h,s,{leading:y,trailing:f+g.toLowerCase()});return{loc:{column:0,line:1},messageId:cV,data:{chosenCases:c9(n),renamedFilenames:(u=x.map(e=>`\`${e}\``),cX.format(u))}}})()})},meta:{type:"suggestion",docs:{description:"Enforce a case style for filenames and directory names.",recommended:!0},schema:c5,defaultOptions:[],messages:{[cV]:"Filename is not in {{chosenCases}}. Rename it to {{renamedFilenames}}.",[cz]:"Directory name `{{directory}}` is not in {{chosenCases}}. Rename it to {{renamedDirectories}}.",[cK]:"File extension `{{extension}}` is not in lowercase. Rename it to `{{filename}}`."},languages:["*"]}},"unicorn/consistent-template-literal-escape":{create:e=>{e.on("TemplateElement",t=>{if(ty(t.parent))return;let{raw:r}=t.value,n=r.replaceAll(/(?<=(?:^|[^\\])(?:\\\\)*)\\?\$\\{/g,"\\${");if(r!==n)return{node:t,messageId:c4,fix:r=>oS(t,n,e,r)}})},meta:{type:"suggestion",docs:{description:"Enforce consistent style for escaping `${` in template literals.",recommended:!0},fixable:"code",messages:{[c4]:"Use `\\${` instead of `$\\{` to escape in template literals."},languages:["js/js"]}},"unicorn/no-useless-iterator-to-array":{create:e=>{e.on("NewExpression",t=>{if(!(te(t,{names:["Map","WeakMap","Set","WeakSet"],argumentsLength:1})||te(t,{names:ra,minimumArguments:1}))||!du(t.arguments[0]))return;let r=t.arguments[0];return{node:r.callee.property,messageId:c7,data:{description:`new ${t.callee.name}(…)`},fix:t=>ox(t,r,e)}}),e.on("CallExpression",t=>{if((tc(t,{objects:["Array",...ra],method:"from",minimumArguments:1,optionalCall:!1,optionalMember:!1})||tc(t,{object:"Object",method:"fromEntries",minimumArguments:1,optionalCall:!1,optionalMember:!1}))&&du(t.arguments[0])){let r=t.arguments[0];return{node:r.callee.property,messageId:c7,data:{description:`${t.callee.object.name}.${t.callee.property.name}(…)`},fix:t=>ox(t,r,e)}}if(tc(t,{object:"Promise",methods:["all","allSettled","any","race"],argumentsLength:1,optionalCall:!1,optionalMember:!1})&&du(t.arguments[0])){let r=t.arguments[0];return{node:r.callee.property,messageId:c7,data:{description:`${t.callee.object.name}.${t.callee.property.name}(…)`},suggest:[{messageId:da,fix:t=>ox(t,r,e)}]}}if((tc(t,{methods:ds,maximumArguments:1,optionalCall:!1,optionalMember:!1})||tc(t,{method:dl,argumentsLength:2,optionalCall:!1,optionalMember:!1}))&&du(t.callee.object)){let r=t.arguments[0],n=t.callee.property.name===dl;if(r&&("ArrowFunctionExpression"===r.type||"FunctionExpression"===r.type)&&r.params.length>(n?3:2))return;let o=t.callee.object;return{node:o.callee.property,messageId:dn,data:{method:t.callee.property.name},suggest:[{messageId:di,data:{method:t.callee.property.name},fix:t=>ox(t,o,e)}]}}}),e.on("ForOfStatement",t=>{if(du(t.right))return{node:t.right.callee.property,messageId:de,fix:r=>ox(r,t.right,e)}}),e.on("YieldExpression",t=>{if(t.delegate&&du(t.argument))return{node:t.argument.callee.property,messageId:dt,fix:r=>ox(r,t.argument,e)}}),e.on("SpreadElement",t=>{if(!du(t.argument))return;let{parent:r}=t;if("ArrayExpression"===r.type||"CallExpression"===r.type||"NewExpression"===r.type)return{node:t.argument.callee.property,messageId:dr,fix:r=>ox(r,t.argument,e)}})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary `.toArray()` on iterators.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[c7]:"`{{description}}` accepts an iterable, `.toArray()` is unnecessary.",[de]:"`for…of` can iterate over an iterable, `.toArray()` is unnecessary.",[dt]:"`yield*` can delegate to an iterable, `.toArray()` is unnecessary.",[dr]:"Spread works on iterables, `.toArray()` is unnecessary.",[dn]:"`Iterator` has a `.{{method}}()` method, `.toArray()` is unnecessary.",[da]:"Remove `.toArray()`.",[di]:"Remove `.toArray()` and use `Iterator#{{method}}()`."},languages:["js/js"]}},"unicorn/prefer-simple-condition-first":{create:e=>{let{sourceCode:t}=e;e.on("LogicalExpression",r=>{if("&&"!==r.operator&&"||"!==r.operator||!dm(r.right)||dm(r.left)||"ConditionalExpression"!==r.left.type||!function e(t){let{parent:r}=t;return!!r&&("IfStatement"===r.type&&r.test===t||"WhileStatement"===r.type&&r.test===t||"DoWhileStatement"===r.type&&r.test===t||"ForStatement"===r.type&&r.test===t||"ConditionalExpression"===r.type&&r.test===t||"UnaryExpression"===r.type&&"!"===r.operator||"LogicalExpression"===r.type&&e(r))}(r)||function e(t){if(!t||"object"!=typeof t)return!1;if(df.has(t.type)||"MemberExpression"===t.type||"BinaryExpression"===t.type&&("in"===t.operator||"instanceof"===t.operator))return!0;for(let[r,n]of Object.entries(t))if("parent"!==r){if(Array.isArray(n)){if(n.some(t=>e(t)))return!0}else if(n&&"string"==typeof n.type&&e(n))return!0}return!1}(r.left)||function e(t){if(!t||"object"!=typeof t)return!1;if("CallExpression"===t.type||"NewExpression"===t.type)return!0;for(let[r,n]of Object.entries(t))if("parent"!==r){if(Array.isArray(n)){if(n.some(t=>e(t)))return!0}else if(n&&"string"==typeof n.type&&e(n))return!0}return!1}(r.left))return;let n=dg(r.right,e,{operator:r.operator,property:"left"}),o=dg(r.left,e,{operator:r.operator,property:"right"}),a=t.getTokensBetween(r.left,r.right,{includeComments:!0}).some(e=>eg(e))?void 0:t=>t.replaceTextRange([eH(r.left,e)[0],eH(r.right,e)[1]],`${n} ${r.operator} ${o}`);return"LogicalExpression"===r.left.type&&r.left.operator===r.operator?{node:r,loc:t.getLoc(r.right),messageId:dp,data:{operator:r.operator},...a&&{suggest:[{messageId:dc,fix:a}]}}:{node:r,loc:t.getLoc(r.right),messageId:dp,data:{operator:r.operator},...a&&{fix:a}}})},meta:{type:"suggestion",docs:{description:"Prefer simple conditions first in logical expressions.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[dp]:"Prefer simple condition first in `{{operator}}` expression.",[dc]:"Swap conditions."},languages:["js/js"]}},"unicorn/switch-case-break-position":{create:e=>{let{sourceCode:t}=e;e.on("SwitchCase",r=>{let{consequent:n}=r;if(n.length<2)return;let o=n.at(-1);if(!dh.has(o.type))return;let a=n.slice(0,-1);if(1!==a.length||"BlockStatement"!==a[0].type)return;let i=a[0];if(0===i.body.length)return;let s=function(e){switch(e.type){case"BreakStatement":return"break";case"ReturnStatement":return"return";case"ContinueStatement":return"continue";case"ThrowStatement":return"throw"}}(o);return{node:o,loc:t.getLoc(o),messageId:dy,data:{keyword:s},..."ReturnStatement"!==o.type&&"ThrowStatement"!==o.type&&{*fix(r){let n=t.getLastToken(i);if(t.getTokensBetween(n,o,{includeComments:!0}).some(e=>eg(e)))return;let a=t.getLoc(i);if(a.start.line===a.end.line||t5(e,o))return;let s=i.body.at(-1),l=t.getText(o),u=t2(s,e),p=t.getTokenBefore(n,{includeComments:!0});yield r.insertTextAfter(p,`
|
|
21
|
-
${u}${l}`);let c=t.getRange(n)[1],d=t.getRange(o)[1];yield r.removeRange([c,d])}}}})},meta:{type:"layout",docs:{description:"Enforce consistent `break`/`return`/`continue`/`throw` position in `case` clauses.",recommended:!0},fixable:"code",messages:{[dy]:"Move `{{keyword}}` inside the block statement."},languages:["js/js"]}},"unicorn/better-dom-traversing":{create:e=>{let{sourceCode:t}=e;e.on("MemberExpression",e=>{let r,n=(e=>{if(dI(e)){if(dw(e.object,"childNodes"))return"childNodes";if(dw(e.object,"children"))return"children"}})(e);if(!n||ns(e.object.object)||"children"===n&&dw(r=e.object,"children")&&("Identifier"===r.object.type&&"props"===r.object.name||tp(r.object,{property:"props",optional:!1,computed:!1}))||e.parent?.type==="MemberExpression"&&e.parent.object===e&&dw(e.parent,"children")&&dI(e.parent.parent))return;let o=e.property.value;return"childNodes"===n&&0===o?{node:e,messageId:dx,suggest:dj(e,"firstChild",dv,t)}:"children"===n&&0===o?{node:e,messageId:db,suggest:dj(e,"firstElementChild",dC,t)}:"children"===n?{node:e,messageId:dE}:void 0}),e.on("MemberExpression",e=>{if(!(!dk(e)||!dk(e.object)||!(!dk(e.parent)||e.parent.object!==e)||ns((e=>{for(;dk(e);)e=e.object;return e})(e))))return{node:e,messageId:dD}}),e.on("CallExpression",t=>{if(!dP(t)||t.parent?.type==="MemberExpression"&&t.parent.object===t&&t.parent.parent?.callee===t.parent&&dP(t.parent.parent)&&dB(t.parent.parent.arguments[0])||(e=>{for(;e.parent?.type==="MemberExpression"&&e.parent.object===e||e.parent?.type==="CallExpression"&&e.parent.callee===e;)e=e.parent;return e.parent?.type==="ChainExpression"})(t))return;let r=(e=>{let t=[];for(;dP(e);){let[r]=e.arguments;if(!dB(r))break;t.push(e),e=e.callee.object}if(t.length<2||"ChainExpression"===e.type||ns(e))return;let r=[];for(let e of t)r.unshift(e3(e.arguments[0]));return{root:e,selectors:r,quoteNode:t.at(-1).arguments[0]}})(t);if(r)return{node:t,messageId:dS,suggest:((e,t,r)=>{let n,o,{sourceCode:a}=r;if(dF(e,a)||!t.selectors.every(e=>!e.includes(",")&&!e.includes(":scope")))return;let i=eQ(t.root,r),s=`${"Identifier"===(n=t.root).type&&"document"===n.name||"MemberExpression"===n.type&&!n.computed&&"Identifier"===n.object.type&&["globalThis","window"].includes(n.object.name)&&"Identifier"===n.property.type&&"document"===n.property.name?"":":scope "}${t.selectors.join(" ")}`,l=`${i}.querySelector(${tF(s,"Literal"===(o=t.quoteNode).type&&o.raw.startsWith('"')?'"':"'")})`;return[{messageId:dA,fix:t=>t.replaceText(e,l)}]})(t,r,e)}})},meta:{type:"suggestion",docs:{description:"Prefer better DOM traversal APIs.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[dx]:"Prefer `.firstChild` over `.childNodes[0]`.",[db]:"Prefer `.firstElementChild` over `.children[0]`.",[dE]:"Consider `.querySelector()` over positional child traversal.",[dD]:"Consider `.closest()` over chaining `.parentElement`.",[dS]:"Consider merging chained `.querySelector()` calls.",[dv]:"Switch to `.firstChild`.",[dC]:"Switch to `.firstElementChild`.",[dA]:"Merge the `.querySelector()` calls."},languages:["js/js"]}},"unicorn/consistent-compound-words":{create:e=>{let t=(({checkProperties:e=!1,checkVariables:t=!0,checkDefaultAndNamespaceImports:r="internal",checkShorthandImports:n="internal",checkShorthandProperties:o=!1,extendDefaultReplacements:a=!0,replacements:i={},allowList:s={}}={})=>{let l=new Map(Object.entries(a?{...dq,...i}:i).filter(([,e])=>!1!==e));return{checkProperties:e,checkVariables:t,checkDefaultAndNamespaceImports:r,checkShorthandImports:n,checkShorthandProperties:o,replacements:l,replacementRegExp:l.size>0?(e=>{let t=[],r=[];for(let n of e.keys())t.push(d_(n)),r.push(d_(nJ(n)));return RegExp(`(?:^(?:${t.join("|")})|(?:${r.join("|")}))${dW}`,"gv")})(l):void 0,allowList:new Set(Object.keys(s))}})(e.options[0]),r=new WeakMap,n=new WeakMap,o=(e,t)=>t.every(t=>{let r=n.get(t);return!r||!r.has(e)}),a=e=>{if((e=>{if(1!==e.defs.length)return!1;let[t]=e.defs;return"ClassName"===t.type})(e)){if("class"===e.scope.type){let[t]=e.defs,n=r.get(t.name);return n?i({name:e.name,scope:e.scope,defs:e.defs,identifiers:e.identifiers,references:[...e.references,...n.references]}):i(e)}let[t]=e.defs;return void r.set(t.name,e)}return i(e)},i=r=>{var a;if(0===r.defs.length)return;let[i]=r.defs;if(!(!("ImportDefaultSpecifier"===(a=i.name).parent.type&&a.parent.local===a||"ImportNamespaceSpecifier"===a.parent.type&&a.parent.local===a||"ImportSpecifier"===a.parent.type&&a.parent.local===a&&"Identifier"===a.parent.imported.type&&"default"===a.parent.imported.name||"VariableDeclarator"===a.parent.type&&a.parent.id===a&&tm(a.parent.init))&&1||t.checkDefaultAndNamespaceImports&&("internal"!==t.checkDefaultAndNamespaceImports||dL(i)))||!(!ny(i.name,e)||t.checkShorthandImports&&("internal"!==t.checkShorthandImports||dL(i)))||!t.checkShorthandProperties&&nx(i.name))return;let s=dV(r.name,t);if(!s)return;let l=[...r.references.map(e=>e.from),r.scope],u=dO(s)?tz(s,l,o):void 0,p=dz(i.name,u??s);if(u&&rt(r).every(e=>!("VariableDeclarator"===e.parent.type&&e.parent.id===e?"VariableDeclaration"===e.parent.parent.type&&"ExportNamedDeclaration"===e.parent.parent.parent.type:!!d$.has(e.parent.type)&&e.parent.id===e&&"ExportNamedDeclaration"===e.parent.parent.type)&&"JSXIdentifier"!==e.type)&&r.references.every(e=>!e.vueUsedInTemplate)){for(let e of l)n.has(e)||n.set(e,new Set),n.get(e).add(u);p.suggest=[{messageId:dM,data:{replacement:u},fix:t=>oD(r,u,e,t)}]}e.report(p)},s=e=>{for(let t of e.variables)a(t)},l=r=>{if(!t.checkProperties||"__proto__"===r.name)return;let n=dV(r.name,t);if(!n||"ExportSpecifier"===r.parent.type||(t.checkVariables||("TSParameterProperty"===r.parent.type?r.parent.parameter!==r:"AssignmentPattern"!==r.parent.type||r.parent.left!==r||"TSParameterProperty"!==r.parent.parent.type||r.parent.parent.parameter!==r.parent))&&!("MemberExpression"===r.parent.type&&r.parent.property===r&&!r.parent.computed&&("AssignmentExpression"===r.parent.parent.type&&r.parent.parent.left===r.parent||"UpdateExpression"===r.parent.parent.type&&r.parent.parent.argument===r.parent)||"Property"===r.parent.type&&r.parent.key===r&&!r.parent.computed&&!r.parent.shorthand&&"ObjectExpression"===r.parent.parent.type||"ExportSpecifier"===r.parent.type&&r.parent.exported===r&&r.parent.local!==r||dR.has(r.parent.type)&&r.parent.key===r&&!r.parent.computed))return;let o=dz(r,n);e.report(o)};e.on("Identifier",l),e.on("PrivateIdentifier",l),e.on("Program:exit",r=>{if(t.checkVariables)for(let t of tL(e.sourceCode.getScope(r)))s(t)})},meta:{type:"suggestion",docs:{description:"Enforce consistent spelling of compound words in identifiers.",recommended:"unopinionated"},hasSuggestions:!0,schema:dK,defaultOptions:[{}],messages:{[dN]:"Prefer `{{replacement}}` over `{{name}}`.",[dM]:"Rename to `{{replacement}}`."},languages:["js/js"]}},"unicorn/no-blob-to-file":{create:e=>{e.on("VariableDeclarator",t=>(function(e,t){let{sourceCode:r}=t,{id:n,init:o}=e;if("Identifier"!==n.type||"VariableDeclaration"!==e.parent.type||"const"!==e.parent.kind||1!==e.parent.declarations.length||"Program"!==e.parent.parent.type&&"BlockStatement"!==e.parent.parent.type)return;let a=function(e,t){if(!te(e,{name:"File",minimumArguments:2,maximumArguments:2})||!dX(e.callee,t))return;let[r]=e.arguments,[,n]=e.arguments;if("ArrayExpression"!==r.type||1!==r.elements.length||r.elements[0]?.type==="SpreadElement"||void 0===e3(n))return;let[o]=r.elements;if(function(e,t,r){let n=dY(e,r);if(!n||r.sourceCode.getRange(n)[0]>r.sourceCode.getRange(t)[0])return!1;let o=n.init;return(te(o,{name:"Blob",maximumArguments:1})||te(o,{name:"File",minimumArguments:2,maximumArguments:2}))&&dX(o.callee,r)}(o,e,t))return o}(o,t);if(!a)return;let i=ei(r.getScope(n),n);if(!i)return;let s=rt(i).filter(e=>e!==n);if(1!==s.length)return;let[l]=s,u=function(e,t){let r,{parent:n}=e;return tc(n,{object:"URL",method:"createObjectURL",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&n.arguments[0]===e&&dX(n.callee.object,t)?{call:n,kind:"blobArgument"}:tc(n,{methods:["append","set"],minimumArguments:2,maximumArguments:3,optionalCall:!1,optionalMember:!1})&&n.arguments[1]===e&&(r=dY(n.callee.object,t)?.init,te(r,{name:"FormData",argumentsLength:0})&&dX(r.callee,t))?{call:n,kind:"formData"}:void 0}(l,t);if(!u)return;let p=function(e){let[,t]=e.arguments;return t}(o);if(!(!function(e,t,r){if("Identifier"!==e.type)return!0;let{sourceCode:n}=r;return ei(n.getScope(e),e)===ei(n.getScope(t),e)}(a,l,t)||function(e,t){let{sourceCode:r}=t;return r.getCommentsInside(e).length>0||r.getCommentsBefore(e).some(t=>r.getLoc(t).end.line===r.getLoc(e).start.line||r.getLoc(t).end.line===r.getLoc(e).start.line-1)||t5(t,e)}(e.parent,t))&&("formData"!==u.kind||2!==u.call.arguments.length||p))return{node:o,messageId:dG,suggest:[{messageId:dJ,*fix(n){yield ob(e.parent,t,n),yield n.replaceText(l,r.getText(a)),"formData"===u.kind&&2===u.call.arguments.length&&(yield n.insertTextAfter(l,`, ${r.getText(p)}`))}}]}})(t,e))},meta:{type:"suggestion",docs:{description:"Disallow unnecessary `Blob` to `File` conversion.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[dG]:"Use the original `Blob` instead of converting it to a `File`.",[dJ]:"Replace the `File` with the original `Blob`."},languages:["js/js"]}},"unicorn/no-canvas-to-image":{create:e=>{let{sourceCode:t}=e;e.on("CallExpression",e=>{var r,n,o;if(!tc(e,{method:"drawImage",minimumArguments:1,optionalCall:!1,optionalMember:!1}))return;let[a]=e.arguments;if("SpreadElement"!==a.type&&(r=dZ(a,t),r?.type==="CallExpression"&&!r.optional&&"Identifier"===r.callee.type&&"loadImage"===r.callee.name&&r.arguments.length>0&&"SpreadElement"!==r.arguments[0].type&&tc(n=r.arguments[0],{method:"toDataURL",optionalCall:!1,optionalMember:!1})&&("Identifier"===(o=n.callee.object).type?d0(o.name):"MemberExpression"===o.type&&!o.computed&&"Identifier"===o.property.type&&d0(o.property.name))))return{node:a,messageId:dH}}),e.on("CallExpression",e=>{if(!tc(e,{method:"putImageData",minimumArguments:1,optionalCall:!1,optionalMember:!1}))return;let[r]=e.arguments;if("SpreadElement"!==r.type&&tc(dZ(r,t),{method:"getImageData",optionalCall:!1,optionalMember:!1}))return{node:r,messageId:dH}})},meta:{type:"suggestion",docs:{description:"Prefer drawing canvases directly instead of converting them to images.",recommended:"unopinionated"},messages:{[dH]:"Prefer drawing the canvas directly with `drawImage()`."},languages:["js/js"]}},"unicorn/no-confusing-array-splice":{create:e=>{e.on("CallExpression",t=>{if(!tc(t,{methods:["splice","toSpliced"],argumentsLength:3,optionalCall:!1,optionalMember:!1}))return;let r=function([e,t]){let r=function(e){let t=d6(e);if("number"==typeof t)return Math.max(Math.trunc(t),0)}(t);return 1===r?d1:-1===Math.trunc(d6(e))&&0===r?d2:void 0}(t.arguments);if(!r)return;let n={node:t.callee.property,messageId:r,data:{method:t.callee.property.name}},o=function(e,t,r){let{sourceCode:n}=r,{object:o,property:a}=e.callee,[i,,s]=e.arguments,l=a.name,u=eQ(o,r),p=n.getText(i),c=n.getText(s);if(t===d1){if(d5(e,n))return;if("toSpliced"===l){var d,m;if(0>Math.trunc(d6(i))||(d=i,m=o,d=nA(d),m=nA(m),"MemberExpression"===d.type&&!d.optional&&!d.computed&&"Identifier"===d.property.type&&"length"===d.property.name&&sQ(d.object,m)))return;return{messageId:d3,fix:t=>t.replaceText(e,`${u}.with(${p}, ${c})`)}}return"ExpressionStatement"===e.parent.type&&d9(o)&&(d6(i)??0)>=0?{messageId:d3,fix:t=>t.replaceText(e,`${u}[${p}] = ${c}`)}:void 0}if(t===d2&&d9(o)&&!d5(i,n))return{messageId:d8,fix:e=>e.replaceText(i,`Math.max(${u}.length - 1, 0)`)}}(t,r,e);return o&&(n.suggest=[o]),n})},meta:{type:"suggestion",docs:{description:"Disallow confusing uses of `Array#{splice,toSpliced}()`.",recommended:!0},hasSuggestions:!0,messages:{[d1]:"Prefer a direct element replacement instead of `{{method}}()`.",[d2]:"Avoid using `{{method}}()` to insert at `-1`.",[d3]:"Use direct element replacement.",[d8]:"Resolve the insertion index explicitly."},languages:["js/js"]}},"unicorn/no-duplicate-set-values":{create:e=>{let{sourceCode:t}=e;e.on("NewExpression",r=>{if(!te(r,{name:"Set",argumentsLength:1}))return;let[n]=r.arguments;if("ArrayExpression"===n.type)return t1(n.elements,e).map(e=>({node:e??n,messageId:d4,data:{value:e?t.getText(e):"undefined"}}))})},meta:{type:"suggestion",docs:{description:"Disallow duplicate values in `Set` constructor array literals.",recommended:!0},messages:{[d4]:"Remove duplicate value `{{value}}` from the Set."},languages:["js/js"]}},"unicorn/no-incorrect-query-selector":{create:e=>{let{sourceCode:t}=e;e.on("MemberExpression",r=>{if(!mi(r)||ml(r))return;let n=r.object;if(!mu(r,n,t,e))return md(r,n,e)}),e.on("CallExpression",r=>{let n;if(ms(r)){if(ml(r))return;let n=r.callee.object;if(mu(r,n,t,e))return;return md(r,n,e)}let o=mc(r,e);if(o)return o;if(ma(r)&&!(mi(n=r.parent)||ms(n)||"MemberExpression"===r.parent.type&&r.parent.object===r&&ms(r.parent.parent))){let e;if(e=e3(r.arguments[0]),/^#[\-A-Z_a-z][\w\-]*$/v.test(e))return{node:r.callee.property,messageId:me}}}),e.on("BinaryExpression",r=>((e,t)=>{let{sourceCode:r}=t;if(mf(e,ma,r))return{node:e,messageId:mr}})(r,e)??((e,t)=>{let r=mf(e,mo,t);if(r&&("==="===e.operator||"!=="===e.operator)&&th(r.value))return{node:e,messageId:mn}})(r,t)),e.on("Identifier",t=>mc(t,e))},meta:{type:"suggestion",docs:{description:"Disallow incorrect `querySelector()` and `querySelectorAll()` usage.",recommended:!0},fixable:"code",schema:[],messages:{[d7]:"Prefer `.querySelector()` when only the first match is used.",[me]:"Prefer `.querySelector()` for a simple ID selector.",[mt]:"Check `.length` instead of the `NodeList` object itself.",[mr]:"Check `.length` instead of comparing the `NodeList` object with `null` or `undefined`.",[mn]:"Compare the result of `.querySelector()` with `null` instead of `undefined`."},languages:["js/js"]}},"unicorn/no-invalid-file-input-accept":{create:e=>{e.on("JSXOpeningElement",t=>{if("input"!==mv(t.name))return;let r=((e,t)=>{if(t?.value){if(e1(t.value))return t.value.value;if("JSXExpressionContainer"===t.value.type)return mA(e,t.value.expression)}})(e,mC(t,"type"));if(r?.toLowerCase()!=="file")return;let n=mC(t,"accept");if(!n)return;let o=((e,t)=>{if(!t.value)return{node:t,missing:!0};if(e1(t.value))return{node:t.value,value:t.value.value,fixable:!0};if("JSXExpressionContainer"!==t.value.type)return{node:t.value,dynamic:!0};let r=mA(e,t.value.expression);return void 0===r?{node:t.value,dynamic:!0}:{node:t.value,value:r,fixable:!1}})(e,n);return mB({valueInfo:o,fix:t=>r=>{let n;return n=o.node,r.replaceTextRange([e.sourceCode.getRange(n)[0]+1,e.sourceCode.getRange(n)[1]-1],t)}})}),e.on("Tag",t=>{if("input"!==t.name.toLowerCase())return;let r=mk(e,t,"type")?.value;if(r?.toLowerCase()!=="file")return;let n=((e,t,r)=>{let n=mk(e,t,r);if(!n)return;let o=t.attributes.find(e=>"Attribute"===e.type&&e.key?.value?.toLowerCase()===r);return n.missing?{node:o??t,missing:!0}:o?.value?.parts?.length>0?{node:o.value,dynamic:!0}:mE.test(n.value)?void 0:{node:o?.value??t,value:n.value,fixable:!0,valueRange:n.valueRange,isReplacementFixable:e=>n.isQuoted||!/\s/v.test(e)}})(e,t,"accept");if(n)return mB({valueInfo:n,fix:e=>t=>t.replaceTextRange(n.valueRange,e)})})},meta:{type:"problem",docs:{description:"Disallow invalid `accept` values on file inputs.",recommended:!1},fixable:"code",messages:{[mg]:"Invalid file input `accept` value: {{reason}}",[my]:"The file input `accept` value must be static.",[mh]:"Prefer `{{replacement}}` as the file input `accept` value."},languages:["js/js","html/html"]}},"unicorn/no-late-current-target-access":{create:e=>{let{sourceCode:t}=e,r=new Set,n=e=>{let t=mL(e);t&&r.add(t)},o=(e,r)=>{if("AwaitExpression"===e.type||"ForOfStatement"===e.type&&e.await)return!0;if(e!==r&&tl(e))return!1;for(let n of t.visitorKeys[e.type]??[]){let t=e[n];if(Array.isArray(t)){for(let e of t)if(e&&o(e,r))return!0;continue}if(t&&o(t,r))return!0}return!1},a=(e,t)=>{switch(e.type){case"ForStatement":return[e.test,e.update,e.body].includes(t);case"ForInStatement":case"ForOfStatement":return t!==e.right;case"DoWhileStatement":case"WhileStatement":return!0;default:return!1}};e.onExit("AwaitExpression",n),e.onExit("ForOfStatement",e=>{e.await&&n(e)}),e.on("MemberExpression",e=>{if("Identifier"!==e.object.type||!tp(e,{property:"currentTarget"})||!mR.test(e.object.name))return;let n=ei(t.getScope(e.object),e.object),i=n?.defs.find(({type:e})=>"Parameter"===e);if(!i)return;let s=i.node,l=mL(e)!==s;if(l||r.has(s)||((e,t)=>{for(let r=e,n=e.parent;n&&n!==t;r=n,n=n.parent)if(a(n,r)&&o(n,t))return!0;return!1})(e,s))return{node:e,messageId:l?m$:mP,data:{name:e.object.name}}})},meta:{type:"problem",docs:{description:"Disallow accessing `event.currentTarget` after the synchronous event dispatch has finished.",recommended:!0},messages:{[mP]:"`{{name}}.currentTarget` is `null` after `await`. It is only set during synchronous event dispatch; save it to a variable beforehand.",[m$]:"`{{name}}.currentTarget` is `null` inside this nested function. It is only set during synchronous event dispatch; save it to a variable in the outer function."},languages:["js/js"]}},"unicorn/no-unnecessary-nested-ternary":{create:e=>{let{sourceCode:t}=e;e.on("ConditionalExpression",r=>{let{test:n,consequent:o,alternate:a}=r;return"ConditionalExpression"===o.type&&mM(o.alternate,a,t)?mU(e,r,{left:n,operator:"&&",right:o.test,consequent:o.consequent,alternate:o.alternate}):"ConditionalExpression"===a.type&&mM(o,a.consequent,t)?mU(e,r,{left:n,operator:"||",right:a.test,consequent:o,alternate:a.alternate}):void 0})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary nested ternary expressions.",recommended:"unopinionated"},fixable:"code",schema:[],messages:{[mN]:"Do not use unnecessary nested ternary expressions."},languages:["js/js"]}},"unicorn/no-unused-array-method-return":{create:e=>{e.on("CallExpression",t=>{var r,n;let o,a,i="MemberExpression"===t.callee.type?eF(r=t.callee,e.sourceCode.getScope(r)):void 0;if(!(!mW.has(i)||!(e=>{for(;;){if(nb(e))return!0;let{parent:t}=e;if("ForStatement"===t.type&&(t.init===e||t.update===e))return!0;if("ChainExpression"!==t.type&&"AwaitExpression"!==t.type&&"TSAsExpression"!==t.type&&"TSTypeAssertion"!==t.type&&"TSNonNullExpression"!==t.type&&"TSSatisfiesExpression"!==t.type)return!1;e=t}})(t)||(n=function e(t,r,n=new Set){if(!t||t===mz||n.has(t))return t;if(n.add(t),"Identifier"===t.type){let o=function(e,t){let r=function(e,t){if("Identifier"===e.type)return ei(t.sourceCode.getScope(e),e)}(e,t);if(!r)return;if(1!==r.defs.length||function(e,t,r){if(!e)return!1;let[n]=r.sourceCode.getRange(t);return e.references.some(e=>!e.init&&e.isWrite()&&r.sourceCode.getRange(e.identifier)[0]<n)}(r,e,t))return mz;let[n]=r.defs;return"Variable"===n.type&&"VariableDeclarator"===n.node.type&&"Identifier"===n.node.id.type&&n.node.id.name===e.name&&n.node.init&&"VariableDeclaration"===n.parent.type?n.node.init:mz}(t,r);return o===mz?o:void 0===o?t:e(o,r,n)}if(["ChainExpression","TSNonNullExpression","TSSatisfiesExpression"].includes(t.type))return e(t.expression,r,n);if("MemberExpression"===t.type)return mz;if("TSAsExpression"===t.type||"TSTypeAssertion"===t.type){let{typeAnnotation:e}=t;return"TSTypeOperator"===e.type&&"readonly"===e.operator&&(e=e.typeAnnotation),"TSArrayType"===e.type||"TSTypeReference"===e.type&&"Identifier"===e.typeName.type&&("Array"===e.typeName.name||"ReadonlyArray"===e.typeName.name)?t:mz}return t}(n=t.callee.object,e))===mz||((e,t)=>mG(e,"undefined",t)||"ObjectExpression"===e.type||"Literal"===e.type||"TemplateLiteral"===e.type||"ArrowFunctionExpression"===e.type||"FunctionExpression"===e.type||"ClassExpression"===e.type||"NewExpression"===e.type&&"Identifier"===e.callee.type&&!mG(e.callee,"Array",t)||"CallExpression"===e.type&&"Identifier"===e.callee.type&&mK.has(e.callee.name)&&t.sourceCode.isGlobalReference(e.callee))(n,e)||"Identifier"===(o=n).type&&mV.test(o.name)&&!("ArrayExpression"===(a=n).type||("CallExpression"===a.type||"NewExpression"===a.type)&&mG(a.callee,"Array",e))))return{node:t.callee.property,messageId:m_,data:{method:i}}})},meta:{type:"suggestion",docs:{description:"Disallow ignoring the return value of selected array methods.",recommended:"unopinionated"},messages:{[m_]:"Do not ignore the return value of `.{{method}}(…)`."},languages:["js/js"]}},"unicorn/prefer-array-last-methods":{create:e=>{let{sourceCode:t}=e;e.on("CallExpression",r=>{if(!tc(r,{methods:mY.keys().toArray(),optionalCall:!1,optionalMember:!1}))return;let n=r.callee.object;if(!tc(n,{methods:mH,argumentsLength:0,optionalCall:!1,optionalMember:!1}))return;let o=r.callee.property.name,a=mY.get(o),i={method:o,replacement:a,reversingMethod:n.callee.property.name},s={node:r.callee.property,messageId:mJ,data:i};return 0===t.getCommentsInside(r).length&&(s.suggest=[{messageId:mX,data:i,*fix(t){yield t.replaceText(r.callee.property,a),yield ox(t,n,e)}}]),s})},meta:{type:"suggestion",docs:{description:"Prefer last-oriented array methods over `Array#reverse()` or `Array#toReversed()` followed by a method.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[mJ]:"Prefer `Array#{{replacement}}()` over `Array#{{reversingMethod}}().{{method}}()`.",[mX]:"Replace `.{{reversingMethod}}().{{method}}()` with `.{{replacement}}()`."},languages:["js/js"]}},"unicorn/prefer-math-abs":{create:e=>{e.on("ConditionalExpression",t=>{let r=function(e,t){let r=function(e,t){if(!("BinaryExpression"!==e.type||!mZ.has(e.operator)||m6(e.left,t)||m6(e.right,t))){if(e0(e.right,0))return{value:e.left,operator:e.operator};if(e0(e.left,0))return{value:e.right,operator:m0[e.operator]}}}(e.test,t);if(!r)return;let{value:n,operator:o}=r,{consequent:a,alternate:i}=e;if(("<"===o||"<="===o)&&m9(a,n)&&tH(i,n)||(">"===o||">="===o)&&tH(a,n)&&m9(i,n))return n}(t,e);if(!r)return;let n=ft(r)?function*(n){yield of(n,t,e),yield n.replaceText(t,`Math.abs(${m7(r,e)})`)}:void 0;return fe(t,e,n)}),e.on("LogicalExpression",t=>{let r=function(e,t){if("||"!==e.operator)return;let r=m5(e.left,t),n=m4(e.right,t);if(r&&n&&tH(r.value,n.value)&&m1[r.operator]===n.operator&&m9(n.negativeThreshold,r.threshold))return{value:r.value,threshold:r.threshold,operator:r.operator};let o=m5(e.right,t),a=m4(e.left,t);if(o&&a&&tH(o.value,a.value)&&m1[o.operator]===a.operator&&m9(a.negativeThreshold,o.threshold))return{value:o.value,threshold:o.threshold,operator:o.operator}}(t,e);if(!r)return;let{value:n,threshold:o,operator:a}=r,i=ft(n)&&ft(o)?function*(r){yield of(r,t,e),yield r.replaceText(t,`Math.abs(${m7(n,e)}) ${a} ${eQ(o,e)}`)}:void 0;return fe(t,e,i)})},meta:{type:"suggestion",docs:{description:"Prefer `Math.abs()` over manual absolute value expressions and symmetric range checks.",recommended:"unopinionated"},fixable:"code",messages:{[mQ]:"Prefer `Math.abs()` to simplify this expression."},languages:["js/js"]}},"unicorn/prefer-split-limit":{create:e=>{let{sourceCode:t}=e;e.on("MemberExpression",r=>{if(!r.computed||!fo(r.object)||rq(r))return;let n=fn(r.property,t);if(void 0!==n)return fa(r,r.object,n,e)}),e.on("CallExpression",r=>{if(!tc(r,{method:"at",argumentsLength:1}))return;let{object:n}=r.callee;if(!tp(r.callee)||!fo(n))return;let o=fn(r.arguments[0],t);if(void 0!==o)return fa(r,n,o,e)})},meta:{type:"suggestion",docs:{description:"Prefer `String#split()` with a limit.",recommended:"unopinionated"},fixable:"code",messages:{[fr]:"Prefer `String#split()` with a limit."},languages:["js/js"]}},"unicorn/prefer-queue-microtask":fs,"unicorn/prefer-string-pad-start-end":{create:e=>{e.on("BinaryExpression",t=>((e,t)=>{if("+"!==e.operator)return;let r=fh(e.left,t);if(r&&tH(e.right,r.targetNode)&&!fc(e.right,t)){let n=fg({targetNode:e.right,targetLengthNode:r.targetLengthNode,paddingNode:r.paddingNode});return fb({node:e,method:"padStart",replacement:n&&fx({method:"padStart",targetNode:e.right,...r},t),context:t,canFix:n})}let n=fh(e.right,t);if(n&&tH(e.left,n.targetNode)&&!fc(e.left,t)){let r=fg({targetNode:e.left,targetLengthNode:n.targetLengthNode,paddingNode:n.paddingNode});return fb({node:e,method:"padEnd",replacement:r&&fx({method:"padEnd",targetNode:e.left,...n},t),context:t,canFix:r})}})(t,e)),e.on("CallExpression",t=>((e,t)=>{if(!tc(e,{method:"slice",minimumArguments:1,maximumArguments:2,optionalCall:!1,optionalMember:!1})||"BinaryExpression"!==e.callee.object.type||"+"!==e.callee.object.operator)return;let{object:r}=e.callee,[n,o]=e.arguments,a=fy(r.left,t),i=(e=>{if(e?.type==="UnaryExpression"&&"-"===e.operator)return e.argument})(n);if(1===e.arguments.length&&a&&i&&fm(a.widthNode)&&tH(a.widthNode,i)&&"Identifier"===r.right.type&&!fc(r.right,t)){let n=ff(a.paddingNode);return fE({node:e,method:"padStart",replacement:fx({method:"padStart",targetNode:r.right,targetLengthNode:a.widthNode,...a},t),context:t,canSuggest:n})}let s=fy(r.right,t);if(2===e.arguments.length&&s&&fm(n)&&0===n.value&&fm(s.widthNode)&&tH(s.widthNode,o)&&"Identifier"===r.left.type&&!fc(r.left,t)){let n=ff(s.paddingNode);return fE({node:e,method:"padEnd",replacement:fx({method:"padEnd",targetNode:r.left,targetLengthNode:s.widthNode,...s},t),context:t,canSuggest:n})}})(t,e))},meta:{type:"suggestion",docs:{description:"Prefer `String#padStart()` and `String#padEnd()` over manual string padding.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[fl]:"Prefer `String#{{method}}()` over manual string padding.",[fu]:"Replace with `String#{{method}}()`."},languages:["js/js"]}},"unicorn/require-css-escape":fw,"unicorn/require-passive-events":{create:e=>{e.on("CallExpression",t=>{if(!tc(t,{method:"addEventListener",minimumArguments:2,maximumArguments:3,optionalCall:!1,optionalMember:!1}))return;let[r,n,o]=t.arguments;if(!e1(r)||!fF.has(r.value)||"ArrowFunctionExpression"!==n.type&&"FunctionExpression"!==n.type||!((e,t)=>{let r;if(r=t.sourceCode,"FunctionExpression"===e.type&&tL(r.getScope(e)).some(t=>((e,t)=>{let r=e.block;for(;r&&r!==t;){if("FunctionDeclaration"===r.type||"FunctionExpression"===r.type)return!1;r=r.parent}return r===t})(t,e)&&t.references.some(({identifier:e})=>"arguments"===e.name)))return!1;let[n]=e.params;if(!n)return!0;if("Identifier"!==n.type)return!1;let o=t.sourceCode.getDeclaredVariables(e).find(e=>e.defs[0]?.name===n);if(!o)return!1;for(let{identifier:e}of o.references)if(fk(e)||!fB(e))return!1;return!0})(n,e))return;let a=((e,t,r)=>{if(!r){let e;return{fix:(e=t.arguments[1],t=>t.insertTextAfter(e,", {passive: true}"))}}if(e2(r,!0)||e2(r,!1))return{fix:e=>e.replaceText(r,e2(r,!0)?"{capture: true, passive: true}":"{passive: true}")};if("ObjectExpression"!==r.type||r.properties.some(e=>"SpreadElement"===e.type||e.computed))return;let n=r.properties.findLast(e=>"Property"===e.type&&"passive"===(e=>{if(!e.computed){if("Identifier"===e.key.type)return e.key.name;if(e1(e.key))return e.key.value}})(e));if(!n)return{fix:((e,t)=>{let r=e.properties.at(-1);if(!r)return!1;let n=t.getLastToken(e);return t.getTokensBetween(r,n,{includeComments:!0}).some(e=>"Block"===e.type||"Line"===e.type)})(r,e.sourceCode)?void 0:t=>{let{sourceCode:n}=e;if(0===r.properties.length)return t.replaceText(r,"{passive: true}");let o=r.properties.at(-1);if(n.getLoc(r).start.line===n.getLoc(r).end.line)return t.insertTextAfter(o,", passive: true");let a=n.getTokenAfter(o),i=t2(o,e);return","===a.value?t.insertTextAfter(a,`
|
|
28
|
+
${c}`);let d=r.body.at(-1);"PropertyDefinition"===d.type&&";"!==t.getLastToken(d).value&&(c=`;${c}`),yield s.insertTextBefore(u,c)}return l?.value?u.suggest=[{messageId:c$,fix:p}]:u.fix=p,u})},meta:{type:"suggestion",docs:{description:"Prefer class field declarations over `this` assignments in constructors.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[cR]:"Prefer class field declaration over `this` assignment in constructor for static values.",[c$]:"Encountered same-named class field declaration and `this` assignment in constructor. Replace the class field declaration with the value from `this` assignment."},languages:["js/js"]}},"unicorn/prefer-bigint-literals":{create:e=>{e.on("CallExpression",t=>{if(!e7(t,{name:"BigInt",argumentsLength:1,optional:!1}))return;let[r]=t.arguments,n=function(e){let t,r;if(e1(e)){let t,r=e.raw.slice(1,-1);try{t=BigInt(r)}catch{return}let n=0n===t?"0":r.trim();return n.startsWith("+")&&(n=n.slice(1).trim()),{shouldUseSuggestion:r.includes("+"),text:`${n}n`,bigint:t}}let n=!1,o=!1;for(;"UnaryExpression"===e.type&&e.prefix;)if("+"===e.operator)n=!0,e=e.argument;else{if("-"!==e.operator)return;o=!o,e=e.argument}let{value:a,raw:i}=e;if(Number.isInteger(a)){try{t=BigInt(a)}catch{return}return(e=>{let t=e.raw.replaceAll("_","").toLowerCase();if(t.includes("."))return!1;let{value:r}=e;for(let{prefix:e,base:n}of[{prefix:"0b",base:2},{prefix:"0o",base:8},{prefix:"0x",base:16}])if(t.startsWith(e))return t.slice(2)===r.toString(n);return!t.includes("e")&&t===String(r)})(e)?r=`${i}n`:(r=`${t}n`,n=!0),o&&0n!==t&&(r=`-${r}`,t=-t),{shouldUseSuggestion:n,text:r,bigint:t}}}(r);if(!n)return;let o={node:t,messageId:cP},{shouldUseSuggestion:a,text:i,bigint:s}=n,l=r=>{let n=i;return!eQ(t,e)&&s<0n&&(n=`(${n})`,nW(e.sourceCode.getTokenBefore(t),e,n)&&(n=`;${n}`)),r.replaceText(t,n)};return a||e.sourceCode.getCommentsInside(t).length>0?o.suggest=[{messageId:cL,data:{replacement:i.length<20?`\`${i}\``:"a bigint literal"},fix:l}]:o.fix=l,o})},meta:{type:"suggestion",docs:{description:"Prefer `BigInt` literals over the constructor.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[cP]:"Prefer using bigint literal over `BigInt(…)`.",[cL]:"Replace with {{replacement}}."},languages:["js/js"]}},"unicorn/prefer-classlist-toggle":{create:e=>{let{sourceCode:t}=e;e.on(["IfStatement","ConditionalExpression"],r=>{let n=[r.consequent,r.alternate].map(e=>{if(e)return"BlockStatement"===e.type&&1===e.body.length&&(e=e.body[0]),"ExpressionStatement"===e.type&&(e=e.expression),"ChainExpression"===e.type&&(e=e.expression),e});if(n.some(e=>!cW(e,["add","remove"])))return;let[o,a]=n;if(o.callee.property.name!==a.callee.property.name&&c_(o,a))return cq(r,function*(n){let i=eZ(o.callee.object.object,e),s=eZ(o.arguments[0],e),l="ConditionalExpression"===r.type,u="remove"===o.callee.property.name,p=r.test,c=cV(p,u,o),d=c?"":cU(p,e,u),m=o.callee.object.optional||a.callee.object.optional||c?.callee.object.optional,f=`${i}${m?"?":""}.classList.toggle(${s}${d?`, ${d}`:""})`;l||(f+=";"),nW(t.getTokenBefore(r),e,f)&&(f=`;${f}`),yield n.replaceText(r,f),l&&(yield oP(n,r,e))})}),e.on("ConditionalExpression",t=>{let r=[t.consequent,t.alternate];if(!(r.every(e=>e1(e)&&("add"===e.value||"remove"===e.value))&&r[0].value!==r[1].value&&"MemberExpression"===t.parent.type&&t.parent.computed&&!t.parent.optional&&t.parent.property===t&&cO(t.parent.object)&&e7(t.parent.parent,{optional:!1,argumentsLength:1})&&t.parent.parent.callee===t.parent))return;let n=t.parent,o=n.parent;return cq(o,function*(r){let a="remove"===t.consequent.value,i=t.test,s=cV(i,a,o)?"":cU(i,e,a);s&&(yield r.insertTextAfter(o.arguments[0],`, ${s}`)),yield oN(r,n,e,".toggle")},t)})},meta:{type:"suggestion",docs:{description:"Prefer using `Element#classList.toggle()` to toggle class names.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[cN]:"Prefer using `Element#classList.toggle()` to toggle class names.",[cM]:"Replace with `Element#classList.toggle()`."},languages:["js/js"]}},"unicorn/require-module-attributes":{create:e=>{let{sourceCode:t}=e;e.on(["ImportDeclaration","ExportNamedDeclaration","ExportAllDeclaration"],e=>{let{source:r,attributes:n}=e;if(!r||Array.isArray(n)&&n.length>0)return;let o=t.getTokenAfter(r);if(o?.type!=="Keyword"||"with"!==o.value)return;let a=t.getTokenAfter(o),i=t.getTokenAfter(a);return{node:e,loc:{start:t.getLoc(a).start,end:t.getLoc(i).end},messageId:cz,data:{type:"ImportDeclaration"===e.type?"import statement":"export statement"},fix:e=>[o,i,a].map(t=>e.remove(t))}}),e.on("ImportExpression",r=>{let{options:n}=r;if(n?.type!=="ObjectExpression")return;let o=n.properties.find(e=>"Property"===e.type&&!e.method&&!e.shorthand&&!e.computed&&"init"===e.kind&&("Identifier"===e.key.type&&"with"===e.key.name||"Literal"===e.key.type&&"with"===e.key.value)&&ta(e.value)),a=0===n.properties.length||o&&1===n.properties.length?n:o;if(!a)return;let i="Property"===a.type;return{node:o?.value??a,messageId:cz,data:{type:"import expression"},fix:r=>i?function*(e,t,r){let{sourceCode:n}=r;for(let r of n.getTokens(t))yield e.remove(r);let o=n.getTokenAfter(t);if(eu(o))yield e.remove(o);else{let{properties:r}=t.parent;if(r.length>1&&r.at(-1)===t){let r=n.getTokenBefore(t);yield e.remove(r)}}}(r,a,e):[t.getTokenBefore(a,eu),...t.getTokens(a),...eY(a,e)].map(e=>r.remove(e))}})},meta:{type:"suggestion",docs:{description:"Require non-empty module attributes for imports and exports",recommended:"unopinionated"},fixable:"code",messages:{[cz]:"{{type}} with empty attribute list is not allowed."},languages:["js/js"]}},"unicorn/no-immediate-mutation":{create:e=>{for(let t of c3)e.on(["VariableDeclarator","AssignmentExpression"],r=>(function(e,t,{testValue:r,getProblematicNode:n,getProblem:o,getFix:a}){let i,s="AssignmentExpression"===t.type,[l,u]=(s?["left","right"]:["id","init"]).map(e=>t[e]);if(!("Identifier"===l.type&&r(u)))return;let p=t.parent;if(!(s&&"="===t.operator&&"ExpressionStatement"===p.type&&p.expression===t||!s&&"VariableDeclaration"===(i=t.parent).type&&i.declarations.at(-1)===t))return;let c=on(p,e);if(c?.type!=="ExpressionStatement")return;let d="VariableDeclarator"===t.type?e.sourceCode.getDeclaredVariables(t).find(e=>1===e.defs.length&&e.defs[0].name===t.id):ei(e.sourceCode.getScope(t),t.left.name);if(!d)return;let m={context:e,variable:d,variableNode:l,valueNode:u,statement:p,nextExpressionStatement:c,assignType:s?"assignment":"declaration",getFix:a},f=n(m);if(f)return o(f,m)})(e,r,t))},meta:{type:"suggestion",docs:{description:"Disallow immediate mutation after variable assignment.",recommended:!0},fixable:"code",hasSuggestions:!0,messages:{[cK]:"Immediate mutation on {{objectType}} is not allowed.",[cG]:"{{operation}} the elements to the {{assignType}}.",[cJ]:"Move this property to the {{assignType}}.",[cX]:"{{description}} the {{assignType}}.",[cY]:"Move the element to the {{assignType}}.",[cH]:"Move the entry to the {{assignType}}."},languages:["js/js"]}},"unicorn/no-useless-collection-argument":{create:e=>{e.on("NewExpression",t=>{var r;let n;if(!te(t,{names:["Set","Map","WeakSet","WeakMap"],argumentsLength:1}))return;let[o]=t.arguments,a="LogicalExpression"===o.type&&"??"===o.operator,i=a?o.right:o,s=to(r=i)?"empty array":e0(r,"")?"empty string":e9(r)?"`null`":tx(r)?"`undefined`":void 0;if(!s)return;let l=!1;if(a)n=function*(t){let{sourceCode:r}=e,n=i.parent,{left:o}=n,a=eQ(o,e),[,s]=a?eH(o,e):r.getRange(o),[,l]=r.getRange(n);yield t.removeRange([s,l]),(a||"SequenceExpression"!==o.type)&&(yield oT(n,t,e))};else e.sourceCode.getCommentsInside(i).length>0&&(l=!0),n=t=>ok(t,i,e);let u={node:i,messageId:c8,data:{description:s}};return l?u.suggest=[{messageId:c6,fix:n}]:u.fix=n,u})},meta:{type:"suggestion",docs:{description:"Disallow useless values or fallbacks in `Set`, `Map`, `WeakSet`, or `WeakMap`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[c8]:"The {{description}} is useless.",[c6]:"Remove the {{description}}"},languages:["js/js"]}},"unicorn/prefer-response-static-json":{create:e=>{e.on("NewExpression",t=>{if(!te(t,{name:"Response",minimumArguments:1}))return;let[r]=t.arguments;if(td(r,{object:"JSON",method:"stringify",argumentsLength:1,optionalCall:!1,optionalMember:!1}))return{node:r.callee,messageId:c9,*fix(n){yield n.insertTextAfter(t.callee,".json"),yield oR(t,e,n);let[o]=r.arguments,a=eH(r,e),i=eH(o,e);yield n.removeRange([a[0],i[0]]),yield n.removeRange([i[1],a[1]]),!eQ(t,e)&&eQ(t.callee,e)&&nW(e.sourceCode.getTokenBefore(t),e,"(")&&(yield n.insertTextBefore(t,";"))}}})},meta:{type:"suggestion",docs:{description:"Prefer `Response.json()` over `new Response(JSON.stringify())`.",recommended:"unopinionated"},fixable:"code",messages:{[c9]:"Prefer using `Response.json(…)` over `JSON.stringify()`."},languages:["js/js"]}},"unicorn/filename-case":{create:e=>{let t=e.physicalFilename;if("<input>"===t||"<text>"===t)return;let r=e.options[0]||{},n=function(e){if(e.case)return[e.case];if(e.cases){let t=Object.keys(e.cases).filter(t=>e.cases[t]);return t.length>0?t:["kebabCase"]}return["kebabCase"]}(r),o=(r.ignore||[]).map(e=>c.isRegExp(e)?e:RegExp(e,"u")),a=!1!==r.multipleFileExtensions,i=!1!==r.checkDirectories,s=n.map(e=>dv[e].fn);e.on(rp,r=>{if("Document"!==r.type||r.parent?.type!=="Program")return(()=>{var r;let l,u,p=(r=e.cwd,""===(l=d.relative(r,d.resolve(r,t)))||".."===l||l.startsWith(`..${d.sep}`)||d.isAbsolute(l)?[d.basename(t)]:l.split(d.sep).filter(e=>"."!==e)),{basename:c,filename:m,middle:f,extension:g}=function(e,{multipleFileExtensions:t}){let r=d.extname(e),n=d.basename(e,r),o={basename:n+r,filename:n,middle:"",extension:r};if(t){let[e]=n.split(".");Object.assign(o,{filename:e,middle:n.slice(e.length)})}return o}(p.at(-1),{multipleFileExtensions:a});if(p.some(e=>o.some(t=>t.test(e))))return;if(i)for(let e of p.slice(0,-1)){let t=function(e,t,r){let n,{leading:o,words:a}=dw(e);if(e.startsWith("$")||dC(a,r))return;let i=dA(a,r,{leading:o,trailing:""});return{loc:{column:0,line:1},messageId:dm,data:{directory:e,chosenCases:dk(t),renamedDirectories:(n=i.map(e=>`\`${e}\``),dh.format(n))}}}(e,n,s);if(t)return t}if(dy.has(c))return;let{leading:y,words:h}=dw(m);if(m.startsWith("$")||dC(h,s))return g!==g.toLowerCase()?{loc:{column:0,line:1},messageId:df,data:{filename:m+f+g.toLowerCase(),extension:g}}:void 0;let x=dA(h,s,{leading:y,trailing:f+g.toLowerCase()});return{loc:{column:0,line:1},messageId:dd,data:{chosenCases:dk(n),renamedFilenames:(u=x.map(e=>`\`${e}\``),dh.format(u))}}})()})},meta:{type:"suggestion",docs:{description:"Enforce a case style for filenames and directory names.",recommended:!0},schema:dI,defaultOptions:[],messages:{[dd]:"Filename is not in {{chosenCases}}. Rename it to {{renamedFilenames}}.",[dm]:"Directory name `{{directory}}` is not in {{chosenCases}}. Rename it to {{renamedDirectories}}.",[df]:"File extension `{{extension}}` is not in lowercase. Rename it to `{{filename}}`."},languages:["*"]}},"unicorn/consistent-template-literal-escape":{create:e=>{e.on("TemplateElement",t=>{if(th(t.parent))return;let{raw:r}=t.value,n=r.replaceAll(/(?<=(?:^|[^\\])(?:\\\\)*)\\?\$\\{/g,"\\${");if(r!==n)return{node:t,messageId:dj,fix:r=>o_(t,n,e,r)}})},meta:{type:"suggestion",docs:{description:"Enforce consistent style for escaping `${` in template literals.",recommended:!0},fixable:"code",messages:{[dj]:"Use `\\${` instead of `$\\{` to escape in template literals."},languages:["js/js"]}},"unicorn/no-useless-iterator-to-array":{create:e=>{e.on("NewExpression",t=>{if(!(te(t,{names:["Map","WeakMap","Set","WeakSet"],argumentsLength:1})||te(t,{names:rE,minimumArguments:1}))||!dq(t.arguments[0]))return;let r=t.arguments[0];return{node:r.callee.property,messageId:dF,data:{description:`new ${t.callee.name}(…)`},fix:t=>oO(t,r,e)}}),e.on("CallExpression",t=>{if((td(t,{objects:["Array",...rE],method:"from",minimumArguments:1,optionalCall:!1,optionalMember:!1})||td(t,{object:"Object",method:"fromEntries",minimumArguments:1,optionalCall:!1,optionalMember:!1}))&&dq(t.arguments[0])){let r=t.arguments[0];return{node:r.callee.property,messageId:dF,data:{description:`${t.callee.object.name}.${t.callee.property.name}(…)`},fix:t=>oO(t,r,e)}}if(td(t,{object:"Promise",methods:["all","allSettled","any","race"],argumentsLength:1,optionalCall:!1,optionalMember:!1})&&dq(t.arguments[0])){let r=t.arguments[0];return{node:r.callee.property,messageId:dF,data:{description:`${t.callee.object.name}.${t.callee.property.name}(…)`},suggest:[{messageId:dL,fix:t=>oO(t,r,e)}]}}if((td(t,{methods:dM,maximumArguments:1,optionalCall:!1,optionalMember:!1})||td(t,{method:dO,argumentsLength:2,optionalCall:!1,optionalMember:!1}))&&dq(t.callee.object)){let r=t.arguments[0],n=t.callee.property.name===dO;if(r&&("ArrowFunctionExpression"===r.type||"FunctionExpression"===r.type)&&r.params.length>(n?3:2))return;let o=t.callee.object;return{node:o.callee.property,messageId:dP,data:{method:t.callee.property.name},suggest:[{messageId:dN,data:{method:t.callee.property.name},fix:t=>oO(t,o,e)}]}}}),e.on("ForOfStatement",t=>{if(dq(t.right))return{node:t.right.callee.property,messageId:dB,fix:r=>oO(r,t.right,e)}}),e.on("YieldExpression",t=>{if(t.delegate&&dq(t.argument))return{node:t.argument.callee.property,messageId:dR,fix:r=>oO(r,t.argument,e)}}),e.on("SpreadElement",t=>{if(!dq(t.argument))return;let{parent:r}=t;if("ArrayExpression"===r.type||"CallExpression"===r.type||"NewExpression"===r.type)return{node:t.argument.callee.property,messageId:d$,fix:r=>oO(r,t.argument,e)}})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary `.toArray()` on iterators.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[dF]:"`{{description}}` accepts an iterable, `.toArray()` is unnecessary.",[dB]:"`for…of` can iterate over an iterable, `.toArray()` is unnecessary.",[dR]:"`yield*` can delegate to an iterable, `.toArray()` is unnecessary.",[d$]:"Spread works on iterables, `.toArray()` is unnecessary.",[dP]:"`Iterator` has a `.{{method}}()` method, `.toArray()` is unnecessary.",[dL]:"Remove `.toArray()`.",[dN]:"Remove `.toArray()` and use `Iterator#{{method}}()`."},languages:["js/js"]}},"unicorn/prefer-simple-condition-first":{create:e=>{let{sourceCode:t}=e;e.on("LogicalExpression",r=>{if("&&"!==r.operator&&"||"!==r.operator||!dV(r.right)||dV(r.left)||"ConditionalExpression"!==r.left.type||!function e(t){let{parent:r}=t;return!!r&&("IfStatement"===r.type&&r.test===t||"WhileStatement"===r.type&&r.test===t||"DoWhileStatement"===r.type&&r.test===t||"ForStatement"===r.type&&r.test===t||"ConditionalExpression"===r.type&&r.test===t||"UnaryExpression"===r.type&&"!"===r.operator||"LogicalExpression"===r.type&&e(r))}(r)||function e(t){if(!t||"object"!=typeof t)return!1;if(dz.has(t.type)||"MemberExpression"===t.type||"BinaryExpression"===t.type&&("in"===t.operator||"instanceof"===t.operator))return!0;for(let[r,n]of Object.entries(t))if("parent"!==r){if(Array.isArray(n)){if(n.some(t=>e(t)))return!0}else if(n&&"string"==typeof n.type&&e(n))return!0}return!1}(r.left)||function e(t){if(!t||"object"!=typeof t)return!1;if("CallExpression"===t.type||"NewExpression"===t.type)return!0;for(let[r,n]of Object.entries(t))if("parent"!==r){if(Array.isArray(n)){if(n.some(t=>e(t)))return!0}else if(n&&"string"==typeof n.type&&e(n))return!0}return!1}(r.left))return;let n=dK(r.right,e,{operator:r.operator,property:"left"}),o=dK(r.left,e,{operator:r.operator,property:"right"}),a=t.getTokensBetween(r.left,r.right,{includeComments:!0}).some(e=>eg(e))?void 0:t=>t.replaceTextRange([eH(r.left,e)[0],eH(r.right,e)[1]],`${n} ${r.operator} ${o}`);return"LogicalExpression"===r.left.type&&r.left.operator===r.operator?{node:r,loc:t.getLoc(r.right),messageId:dU,data:{operator:r.operator},...a&&{suggest:[{messageId:dW,fix:a}]}}:{node:r,loc:t.getLoc(r.right),messageId:dU,data:{operator:r.operator},...a&&{fix:a}}})},meta:{type:"suggestion",docs:{description:"Prefer simple conditions first in logical expressions.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[dU]:"Prefer simple condition first in `{{operator}}` expression.",[dW]:"Swap conditions."},languages:["js/js"]}},"unicorn/switch-case-break-position":{create:e=>{let{sourceCode:t}=e;e.on("SwitchCase",r=>{let{consequent:n}=r;if(n.length<2)return;let o=n.at(-1);if(!dJ.has(o.type))return;let a=n.slice(0,-1);if(1!==a.length||"BlockStatement"!==a[0].type)return;let i=a[0];if(0===i.body.length)return;let s=function(e){switch(e.type){case"BreakStatement":return"break";case"ReturnStatement":return"return";case"ContinueStatement":return"continue";case"ThrowStatement":return"throw"}}(o);return{node:o,loc:t.getLoc(o),messageId:dG,data:{keyword:s},..."ReturnStatement"!==o.type&&"ThrowStatement"!==o.type&&{*fix(r){let n=t.getLastToken(i);if(t.getTokensBetween(n,o,{includeComments:!0}).some(e=>eg(e)))return;let a=t.getLoc(i);if(a.start.line===a.end.line||t7(e,o))return;let s=i.body.at(-1),l=t.getText(o),u=t8(s,e),p=t.getTokenBefore(n,{includeComments:!0});yield r.insertTextAfter(p,`
|
|
29
|
+
${u}${l}`);let c=t.getRange(n)[1],d=t.getRange(o)[1];yield r.removeRange([c,d])}}}})},meta:{type:"layout",docs:{description:"Enforce consistent `break`/`return`/`continue`/`throw` position in `case` clauses.",recommended:!0},fixable:"code",messages:{[dG]:"Move `{{keyword}}` inside the block statement."},languages:["js/js"]}},"unicorn/better-dom-traversing":{create:e=>{e.on("MemberExpression",t=>{let r,n=(e=>{if(d6(e)){if(d8(e.object,"childNodes"))return"childNodes";if(d8(e.object,"children"))return"children"}})(t);if(!n||nT(t.object.object)||"children"===n&&d8(r=t.object,"children")&&("Identifier"===r.object.type&&"props"===r.object.name||tc(r.object,{property:"props",optional:!1,computed:!1}))||t.parent?.type==="MemberExpression"&&t.parent.object===t&&d8(t.parent,"children")&&d6(t.parent.parent))return;let o=t.property.value;return"childNodes"===n&&0===o?{node:t,messageId:dX,suggest:d5(t,"firstChild",d0,e)}:"children"===n&&0===o?{node:t,messageId:dY,suggest:d5(t,"firstElementChild",d1,e)}:"children"===n?{node:t,messageId:dH}:void 0}),e.on("MemberExpression",e=>{if(!(!d4(e)||!d4(e.object)||!(!d4(e.parent)||e.parent.object!==e)||nT((e=>{for(;d4(e);)e=e.object;return e})(e))))return{node:e,messageId:dZ}}),e.on("CallExpression",t=>{if(!me(t)||t.parent?.type==="MemberExpression"&&t.parent.object===t&&t.parent.parent?.callee===t.parent&&me(t.parent.parent)&&d7(t.parent.parent.arguments[0])||(e=>{for(;e.parent?.type==="MemberExpression"&&e.parent.object===e||e.parent?.type==="CallExpression"&&e.parent.callee===e;)e=e.parent;return e.parent?.type==="ChainExpression"})(t))return;let r=(e=>{let t=[];for(;me(e);){let[r]=e.arguments;if(!d7(r))break;t.push(e),e=e.callee.object}if(t.length<2||"ChainExpression"===e.type||nT(e))return;let r=[];for(let e of t)r.unshift(e3(e.arguments[0]));return{root:e,selectors:r,quoteNode:t.at(-1).arguments[0]}})(t);if(r)return{node:t,messageId:dQ,suggest:((e,t,r)=>{let n,o,{sourceCode:a}=r;if(d9(e,a)||!t.selectors.every(e=>!e.includes(",")&&!e.includes(":scope")))return;let i=eZ(t.root,r),s=`${"Identifier"===(n=t.root).type&&"document"===n.name||"MemberExpression"===n.type&&!n.computed&&"Identifier"===n.object.type&&["globalThis","window"].includes(n.object.name)&&"Identifier"===n.property.type&&"document"===n.property.name?"":":scope "}${t.selectors.join(" ")}`,l=`${i}.querySelector(${tF(s,"Literal"===(o=t.quoteNode).type&&o.raw.startsWith('"')?'"':"'")})`;return[{messageId:d2,fix:t=>t.replaceText(e,l)}]})(t,r,e)}})},meta:{type:"suggestion",docs:{description:"Prefer better DOM traversal APIs.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[dX]:"Prefer `.firstChild` over `.childNodes[0]`.",[dY]:"Prefer `.firstElementChild` over `.children[0]`.",[dH]:"Consider `.querySelector()` over positional child traversal.",[dZ]:"Consider `.closest()` over chaining `.parentElement`.",[dQ]:"Consider merging chained `.querySelector()` calls.",[d0]:"Switch to `.firstChild`.",[d1]:"Switch to `.firstElementChild`.",[d2]:"Merge the `.querySelector()` calls."},languages:["js/js"]}},"unicorn/consistent-compound-words":{create:e=>{let t=(({checkProperties:e=!1,checkVariables:t=!0,checkDefaultAndNamespaceImports:r="internal",checkShorthandImports:n="internal",checkShorthandProperties:o=!1,extendDefaultReplacements:a=!0,replacements:i={},allowList:s={}}={})=>{let l=new Map(Object.entries(a?{...ms,...i}:i).filter(([,e])=>!1!==e));return{checkProperties:e,checkVariables:t,checkDefaultAndNamespaceImports:r,checkShorthandImports:n,checkShorthandProperties:o,replacements:l,replacementRegExp:l.size>0?(e=>{let t=[],r=[];for(let n of e.keys())t.push(mu(n)),r.push(mu(oo(n)));return RegExp(`(?:^(?:${t.join("|")})|(?:${r.join("|")}))${mp}`,"gv")})(l):void 0,allowList:new Set(Object.keys(s))}})(e.options[0]),r=new WeakMap,n=new WeakMap,o=(e,t)=>t.every(t=>{let r=n.get(t);return!r||!r.has(e)}),a=e=>{if((e=>{if(1!==e.defs.length)return!1;let[t]=e.defs;return"ClassName"===t.type})(e)){if("class"===e.scope.type){let[t]=e.defs,n=r.get(t.name);return n?i({name:e.name,scope:e.scope,defs:e.defs,identifiers:e.identifiers,references:[...e.references,...n.references]}):i(e)}let[t]=e.defs;return void r.set(t.name,e)}return i(e)},i=r=>{var a;if(0===r.defs.length)return;let i=mc(r.name,t);if(!i)return;let[s]=r.defs;if(!(!("ImportDefaultSpecifier"===(a=s.name).parent.type&&a.parent.local===a||"ImportNamespaceSpecifier"===a.parent.type&&a.parent.local===a||"ImportSpecifier"===a.parent.type&&a.parent.local===a&&"Identifier"===a.parent.imported.type&&"default"===a.parent.imported.name||"VariableDeclarator"===a.parent.type&&a.parent.id===a&&tf(a.parent.init))||t.checkDefaultAndNamespaceImports&&("internal"!==t.checkDefaultAndNamespaceImports||mn(s)))||!(!nP(s.name,e)||t.checkShorthandImports&&("internal"!==t.checkShorthandImports||mn(s)))||!t.checkShorthandProperties&&nM(s.name))return;let l=[...r.references.map(e=>e.from),r.scope],u=mi(i)?tG(i,l,o):void 0,p=md(s.name,u??i);if(u&&rd(r).every(e=>!("VariableDeclarator"===e.parent.type&&e.parent.id===e?"VariableDeclaration"===e.parent.parent.type&&"ExportNamedDeclaration"===e.parent.parent.parent.type:!!mt.has(e.parent.type)&&e.parent.id===e&&"ExportNamedDeclaration"===e.parent.parent.type)&&"JSXIdentifier"!==e.type)&&r.references.every(e=>!e.vueUsedInTemplate)){for(let e of l)n.has(e)||n.set(e,new Set),n.get(e).add(u);p.suggest=[{messageId:ma,data:{replacement:u},fix:t=>oW(r,u,e,t)}]}e.report(p)},s=e=>{for(let t of e.variables)a(t)},l=r=>{if(!t.checkProperties||"__proto__"===r.name)return;let n=mc(r.name,t);if(!n||"ExportSpecifier"===r.parent.type||(t.checkVariables||("TSParameterProperty"===r.parent.type?r.parent.parameter!==r:"AssignmentPattern"!==r.parent.type||r.parent.left!==r||"TSParameterProperty"!==r.parent.parent.type||r.parent.parent.parameter!==r.parent))&&!("MemberExpression"===r.parent.type&&r.parent.property===r&&!r.parent.computed&&("AssignmentExpression"===r.parent.parent.type&&r.parent.parent.left===r.parent||"UpdateExpression"===r.parent.parent.type&&r.parent.parent.argument===r.parent)||"Property"===r.parent.type&&r.parent.key===r&&!r.parent.computed&&!r.parent.shorthand&&"ObjectExpression"===r.parent.parent.type||"ExportSpecifier"===r.parent.type&&r.parent.exported===r&&r.parent.local!==r||mr.has(r.parent.type)&&r.parent.key===r&&!r.parent.computed))return;let o=md(r,n);e.report(o)};e.on("Identifier",l),e.on("PrivateIdentifier",l),e.on("Program:exit",r=>{if(t.checkVariables)for(let t of tM(e.sourceCode.getScope(r)))s(t)})},meta:{type:"suggestion",docs:{description:"Enforce consistent spelling of compound words in identifiers.",recommended:"unopinionated"},hasSuggestions:!0,schema:mm,defaultOptions:[{}],messages:{[mo]:"Prefer `{{replacement}}` over `{{name}}`.",[ma]:"Rename to `{{replacement}}`."},languages:["js/js"]}},"unicorn/no-blob-to-file":{create:e=>{e.on("VariableDeclarator",t=>(function(e,t){let{sourceCode:r}=t,{id:n,init:o}=e;if("Identifier"!==n.type||"VariableDeclaration"!==e.parent.type||"const"!==e.parent.kind||1!==e.parent.declarations.length||"Program"!==e.parent.parent.type&&"BlockStatement"!==e.parent.parent.type)return;let a=function(e,t){if(!te(e,{name:"File",minimumArguments:2,maximumArguments:2})||!my(e.callee,t))return;let[r]=e.arguments,[,n]=e.arguments;if("ArrayExpression"!==r.type||1!==r.elements.length||r.elements[0]?.type==="SpreadElement"||void 0===e3(n))return;let[o]=r.elements;if(function(e,t,r){let n=mh(e,r);if(!n||r.sourceCode.getRange(n)[0]>r.sourceCode.getRange(t)[0])return!1;let o=n.init;return(te(o,{name:"Blob",maximumArguments:1})||te(o,{name:"File",minimumArguments:2,maximumArguments:2}))&&my(o.callee,r)}(o,e,t))return o}(o,t);if(!a)return;let i=ei(r.getScope(n),n);if(!i)return;let s=rd(i).filter(e=>e!==n);if(1!==s.length)return;let[l]=s,u=function(e,t){let r,{parent:n}=e;return td(n,{object:"URL",method:"createObjectURL",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&n.arguments[0]===e&&my(n.callee.object,t)?{call:n,kind:"blobArgument"}:td(n,{methods:["append","set"],minimumArguments:2,maximumArguments:3,optionalCall:!1,optionalMember:!1})&&n.arguments[1]===e&&(r=mh(n.callee.object,t)?.init,te(r,{name:"FormData",argumentsLength:0})&&my(r.callee,t))?{call:n,kind:"formData"}:void 0}(l,t);if(!u)return;let p=function(e){let[,t]=e.arguments;return t}(o);if(!(!function(e,t,r){if("Identifier"!==e.type)return!0;let{sourceCode:n}=r;return ei(n.getScope(e),e)===ei(n.getScope(t),e)}(a,l,t)||function(e,t){let{sourceCode:r}=t;return r.getCommentsInside(e).length>0||r.getCommentsBefore(e).some(t=>r.getLoc(t).end.line===r.getLoc(e).start.line||r.getLoc(t).end.line===r.getLoc(e).start.line-1)||t7(t,e)}(e.parent,t))&&("formData"!==u.kind||2!==u.call.arguments.length||p))return{node:o,messageId:mf,suggest:[{messageId:mg,*fix(n){yield oq(e.parent,t,n),yield n.replaceText(l,r.getText(a)),"formData"===u.kind&&2===u.call.arguments.length&&(yield n.insertTextAfter(l,`, ${r.getText(p)}`))}}]}})(t,e))},meta:{type:"suggestion",docs:{description:"Disallow unnecessary `Blob` to `File` conversion.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[mf]:"Use the original `Blob` instead of converting it to a `File`.",[mg]:"Replace the `File` with the original `Blob`."},languages:["js/js"]}},"unicorn/no-canvas-to-image":{create:e=>{let{sourceCode:t}=e;e.on("CallExpression",e=>{var r,n,o;if(!td(e,{method:"drawImage",minimumArguments:1,optionalCall:!1,optionalMember:!1}))return;let[a]=e.arguments;if("SpreadElement"!==a.type&&(r=mE(a,t),r?.type==="CallExpression"&&!r.optional&&"Identifier"===r.callee.type&&"loadImage"===r.callee.name&&r.arguments.length>0&&"SpreadElement"!==r.arguments[0].type&&td(n=r.arguments[0],{method:"toDataURL",optionalCall:!1,optionalMember:!1})&&("Identifier"===(o=n.callee.object).type?mD(o.name):"MemberExpression"===o.type&&!o.computed&&"Identifier"===o.property.type&&mD(o.property.name))))return{node:a,messageId:mx}}),e.on("CallExpression",e=>{if(!td(e,{method:"putImageData",minimumArguments:1,optionalCall:!1,optionalMember:!1}))return;let[r]=e.arguments;if("SpreadElement"!==r.type&&td(mE(r,t),{method:"getImageData",optionalCall:!1,optionalMember:!1}))return{node:r,messageId:mx}})},meta:{type:"suggestion",docs:{description:"Prefer drawing canvases directly instead of converting them to images.",recommended:"unopinionated"},messages:{[mx]:"Prefer drawing the canvas directly with `drawImage()`."},languages:["js/js"]}},"unicorn/no-confusing-array-splice":{create:e=>{e.on("CallExpression",t=>{if(!td(t,{methods:["splice","toSpliced"],argumentsLength:3,optionalCall:!1,optionalMember:!1}))return;let r=function([e,t]){let r=function(e){let t=n1(e);if("number"==typeof t)return Math.max(Math.trunc(t),0)}(t);return 1===r?mS:-1===Math.trunc(n1(e))&&0===r?mv:void 0}(t.arguments);if(!r)return;let n={node:t.callee.property,messageId:r,data:{method:t.callee.property.name}},o=function(e,t,r){let{sourceCode:n}=r,{object:o,property:a}=e.callee,[i,,s]=e.arguments,l=a.name,u=eZ(o,r),p=n.getText(i),c=n.getText(s);if(t===mS){if(mw(e,n))return;if("toSpliced"===l){var d,m;if(0>Math.trunc(n1(i))||(d=i,m=o,d=ry(d),m=ry(m),"MemberExpression"===d.type&&!d.optional&&!d.computed&&"Identifier"===d.property.type&&"length"===d.property.name&&ly(d.object,m)))return;return{messageId:mC,fix:t=>t.replaceText(e,`${u}.with(${p}, ${c})`)}}return"ExpressionStatement"===e.parent.type&&mT(o)&&(n1(i)??0)>=0?{messageId:mC,fix:t=>t.replaceText(e,`${u}[${p}] = ${c}`)}:void 0}if(t===mv&&mT(o)&&!mw(i,n))return{messageId:mA,fix:e=>e.replaceText(i,`Math.max(${u}.length - 1, 0)`)}}(t,r,e);return o&&(n.suggest=[o]),n})},meta:{type:"suggestion",docs:{description:"Disallow confusing uses of `Array#{splice,toSpliced}()`.",recommended:!0},hasSuggestions:!0,messages:{[mS]:"Prefer a direct element replacement instead of `{{method}}()`.",[mv]:"Avoid using `{{method}}()` to insert at `-1`.",[mC]:"Use direct element replacement.",[mA]:"Resolve the insertion index explicitly."},languages:["js/js"]}},"unicorn/no-duplicate-set-values":{create:e=>{let{sourceCode:t}=e;e.on("NewExpression",r=>{if(!te(r,{name:"Set",argumentsLength:1}))return;let[n]=r.arguments;if("ArrayExpression"===n.type)return t3(n.elements,e).map(e=>({node:e??n,messageId:mk,data:{value:e?t.getText(e):"undefined"}}))})},meta:{type:"suggestion",docs:{description:"Disallow duplicate values in `Set` constructor array literals.",recommended:!0},messages:{[mk]:"Remove duplicate value `{{value}}` from the Set."},languages:["js/js"]}},"unicorn/no-incorrect-query-selector":{create:e=>{let{sourceCode:t}=e;e.on("MemberExpression",r=>{if(!mL(r)||mM(r))return;let n=r.object;if(!mO(r,n,t,e))return mW(r,n,e)}),e.on("CallExpression",r=>{let n;if(mN(r)){if(mM(r))return;let n=r.callee.object;if(mO(r,n,t,e))return;return mW(r,n,e)}let o=mU(r,e);if(o)return o;if(mP(r)&&!(mL(n=r.parent)||mN(n)||"MemberExpression"===r.parent.type&&r.parent.object===r&&mN(r.parent.parent))){let e;if(e=e3(r.arguments[0]),/^#[\-A-Z_a-z][\w\-]*$/v.test(e))return{node:r.callee.property,messageId:mj}}}),e.on("BinaryExpression",r=>((e,t)=>{let{sourceCode:r}=t;if(mV(e,mP,r))return{node:e,messageId:mB}})(r,e)??((e,t)=>{let r=mV(e,m$,t);if(r&&("==="===e.operator||"!=="===e.operator)&&tx(r.value))return{node:e,messageId:mR}})(r,t)),e.on("Identifier",t=>mU(t,e))},meta:{type:"suggestion",docs:{description:"Disallow incorrect `querySelector()` and `querySelectorAll()` usage.",recommended:!0},fixable:"code",schema:[],messages:{[mI]:"Prefer `.querySelector()` when only the first match is used.",[mj]:"Prefer `.querySelector()` for a simple ID selector.",[mF]:"Check `.length` instead of the `NodeList` object itself.",[mB]:"Check `.length` instead of comparing the `NodeList` object with `null` or `undefined`.",[mR]:"Compare the result of `.querySelector()` with `null` instead of `undefined`."},languages:["js/js"]}},"unicorn/no-invalid-file-input-accept":{create:e=>{e.on("JSXOpeningElement",t=>{if("input"!==mQ(t.name))return;let r=((e,t)=>{if(t?.value){if(e1(t.value))return t.value.value;if("JSXExpressionContainer"===t.value.type)return m1(e,t.value.expression)}})(e,m0(t,"type"));if(r?.toLowerCase()!=="file")return;let n=m0(t,"accept");if(!n)return;let o=((e,t)=>{if(!t.value)return{node:t,missing:!0};if(e1(t.value))return{node:t.value,value:t.value.value,fixable:!0};if("JSXExpressionContainer"!==t.value.type)return{node:t.value,dynamic:!0};let r=m1(e,t.value.expression);return void 0===r?{node:t.value,dynamic:!0}:{node:t.value,value:r,fixable:!1}})(e,n);return m4({valueInfo:o,fix:t=>r=>{let n;return n=o.node,r.replaceTextRange([e.sourceCode.getRange(n)[0]+1,e.sourceCode.getRange(n)[1]-1],t)}})}),e.on("Tag",t=>{if("input"!==t.name.toLowerCase())return;let r=m5(e,t,"type")?.value;if(r?.toLowerCase()!=="file")return;let n=((e,t,r)=>{let n=m5(e,t,r);if(!n)return;let o=t.attributes.find(e=>"Attribute"===e.type&&e.key?.value?.toLowerCase()===r);return n.missing?{node:o??t,missing:!0}:o?.value?.parts?.length>0?{node:o.value,dynamic:!0}:mY.test(n.value)?void 0:{node:o?.value??t,value:n.value,fixable:!0,valueRange:n.valueRange,isReplacementFixable:e=>n.isQuoted||!/\s/v.test(e)}})(e,t,"accept");if(n)return m4({valueInfo:n,fix:e=>t=>t.replaceTextRange(n.valueRange,e)})})},meta:{type:"problem",docs:{description:"Disallow invalid `accept` values on file inputs.",recommended:!1},fixable:"code",messages:{[mz]:"Invalid file input `accept` value: {{reason}}",[mK]:"The file input `accept` value must be static.",[mG]:"Prefer `{{replacement}}` as the file input `accept` value."},languages:["js/js","html/html"]}},"unicorn/no-late-current-target-access":{create:e=>{let{sourceCode:t}=e,r=new Set,n=e=>{let t=fr(e);t&&r.add(t)},o=(e,t)=>{switch(e.type){case"ForStatement":return[e.test,e.update,e.body].includes(t);case"ForInStatement":case"ForOfStatement":return t!==e.right;case"DoWhileStatement":case"WhileStatement":return!0;default:return!1}};e.onExit("AwaitExpression",n),e.onExit("YieldExpression",n),e.onExit("ForOfStatement",e=>{e.await&&n(e)}),e.on("MemberExpression",e=>{if("Identifier"!==e.object.type||!tc(e,{property:"currentTarget"})||!ft.test(e.object.name))return;let n=ei(t.getScope(e.object),e.object),a=n?.defs.find(({type:e})=>"Parameter"===e);if(!a)return;let i=a.node,s=fr(e)!==i;if(s||r.has(i)||((e,r)=>{for(let n=e,a=e.parent;a&&a!==r;n=a,a=a.parent)if(o(a,n)&&tk(a,t.visitorKeys))return!0;return!1})(e,i))return{node:e,messageId:s?fe:m7,data:{name:e.object.name}}})},meta:{type:"problem",docs:{description:"Disallow accessing `event.currentTarget` after the synchronous event dispatch has finished.",recommended:!0},messages:{[m7]:"`{{name}}.currentTarget` is `null` after the handler suspends. It is only set during synchronous event dispatch; save it to a variable beforehand.",[fe]:"`{{name}}.currentTarget` is `null` inside this nested function. It is only set during synchronous event dispatch; save it to a variable in the outer function."},languages:["js/js"]}},"unicorn/no-unnecessary-nested-ternary":{create:e=>{let{sourceCode:t}=e;e.on("ConditionalExpression",r=>{let{test:n,consequent:o,alternate:a}=r;return"ConditionalExpression"===o.type&&fo(o.alternate,a,t)?fs(e,r,{left:n,operator:"&&",right:o.test,consequent:o.consequent,alternate:o.alternate}):"ConditionalExpression"===a.type&&fo(o,a.consequent,t)?fs(e,r,{left:n,operator:"||",right:a.test,consequent:o,alternate:a.alternate}):void 0})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary nested ternary expressions.",recommended:"unopinionated"},fixable:"code",schema:[],messages:{[fn]:"Do not use unnecessary nested ternary expressions."},languages:["js/js"]}},"unicorn/no-unused-array-method-return":{create:e=>{e.on("CallExpression",t=>{var r,n;let o,a,i="MemberExpression"===t.callee.type?eI(r=t.callee,e.sourceCode.getScope(r)):void 0;if(!(!fu.has(i)||!(e=>{for(;;){if(nO(e))return!0;let{parent:t}=e;if("ForStatement"===t.type&&(t.init===e||t.update===e))return!0;if("ChainExpression"!==t.type&&"AwaitExpression"!==t.type&&"TSAsExpression"!==t.type&&"TSTypeAssertion"!==t.type&&"TSNonNullExpression"!==t.type&&"TSSatisfiesExpression"!==t.type)return!1;e=t}})(t)||(n=function e(t,r,n=new Set){if(!t||t===fc||n.has(t))return t;if(n.add(t),"Identifier"===t.type){let o=function(e,t){let r=function(e,t){if("Identifier"===e.type)return ei(t.sourceCode.getScope(e),e)}(e,t);if(!r)return;if(1!==r.defs.length||function(e,t,r){if(!e)return!1;let[n]=r.sourceCode.getRange(t);return e.references.some(e=>!e.init&&e.isWrite()&&r.sourceCode.getRange(e.identifier)[0]<n)}(r,e,t))return fc;let[n]=r.defs;return"Variable"===n.type&&"VariableDeclarator"===n.node.type&&"Identifier"===n.node.id.type&&n.node.id.name===e.name&&n.node.init&&"VariableDeclaration"===n.parent.type?n.node.init:fc}(t,r);return o===fc?o:void 0===o?t:e(o,r,n)}if(["ChainExpression","TSNonNullExpression","TSSatisfiesExpression"].includes(t.type))return e(t.expression,r,n);if("MemberExpression"===t.type)return fc;if("TSAsExpression"===t.type||"TSTypeAssertion"===t.type){let{typeAnnotation:e}=t;return"TSTypeOperator"===e.type&&"readonly"===e.operator&&(e=e.typeAnnotation),"TSArrayType"===e.type||"TSTypeReference"===e.type&&"Identifier"===e.typeName.type&&("Array"===e.typeName.name||"ReadonlyArray"===e.typeName.name)?t:fc}return t}(n=t.callee.object,e))===fc||((e,t)=>fm(e,"undefined",t)||"ObjectExpression"===e.type||"Literal"===e.type||"TemplateLiteral"===e.type||"ArrowFunctionExpression"===e.type||"FunctionExpression"===e.type||"ClassExpression"===e.type||"NewExpression"===e.type&&"Identifier"===e.callee.type&&!fm(e.callee,"Array",t)||"CallExpression"===e.type&&"Identifier"===e.callee.type&&fd.has(e.callee.name)&&t.sourceCode.isGlobalReference(e.callee))(n,e)||"Identifier"===(o=n).type&&fp.test(o.name)&&!("ArrayExpression"===(a=n).type||("CallExpression"===a.type||"NewExpression"===a.type)&&fm(a.callee,"Array",e))))return{node:t.callee.property,messageId:fl,data:{method:i}}})},meta:{type:"suggestion",docs:{description:"Disallow ignoring the return value of selected array methods.",recommended:"unopinionated"},messages:{[fl]:"Do not ignore the return value of `.{{method}}(…)`."},languages:["js/js"]}},"unicorn/prefer-array-last-methods":{create:e=>{let{sourceCode:t}=e;e.on("CallExpression",r=>{if(!td(r,{methods:fy.keys().toArray(),optionalCall:!1,optionalMember:!1}))return;let n=r.callee.object;if(!td(n,{methods:fh,argumentsLength:0,optionalCall:!1,optionalMember:!1}))return;let o=r.callee.property.name,a=fy.get(o),i={method:o,replacement:a,reversingMethod:n.callee.property.name},s={node:r.callee.property,messageId:ff,data:i};return 0===t.getCommentsInside(r).length&&(s.suggest=[{messageId:fg,data:i,*fix(t){yield t.replaceText(r.callee.property,a),yield oO(t,n,e)}}]),s})},meta:{type:"suggestion",docs:{description:"Prefer last-oriented array methods over `Array#reverse()` or `Array#toReversed()` followed by a method.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[ff]:"Prefer `Array#{{replacement}}()` over `Array#{{reversingMethod}}().{{method}}()`.",[fg]:"Replace `.{{reversingMethod}}().{{method}}()` with `.{{replacement}}()`."},languages:["js/js"]}},"unicorn/prefer-math-abs":{create:e=>{e.on("ConditionalExpression",t=>{let r=function(e,t){let r=function(e,t){if(!("BinaryExpression"!==e.type||!fb.has(e.operator)||fA(e.left,t)||fA(e.right,t))){if(e0(e.right,0))return{value:e.left,operator:e.operator};if(e0(e.left,0))return{value:e.right,operator:fE[e.operator]}}}(e.test,t);if(!r)return;let{value:n,operator:o}=r,{consequent:a,alternate:i}=e;if(("<"===o||"<="===o)&&fT(a,n)&&tQ(i,n)||(">"===o||">="===o)&&tQ(a,n)&&fT(i,n))return n}(t,e);if(!r)return;let n=fF(r)?function*(n){yield oP(n,t,e),yield n.replaceText(t,`Math.abs(${fI(r,e)})`)}:void 0;return fj(t,e,n)}),e.on("LogicalExpression",t=>{let r=function(e,t){if("||"!==e.operator)return;let r=fw(e.left,t),n=fk(e.right,t);if(r&&n&&tQ(r.value,n.value)&&fD[r.operator]===n.operator&&fT(n.negativeThreshold,r.threshold))return{value:r.value,threshold:r.threshold,operator:r.operator};let o=fw(e.right,t),a=fk(e.left,t);if(o&&a&&tQ(o.value,a.value)&&fD[o.operator]===a.operator&&fT(a.negativeThreshold,o.threshold))return{value:o.value,threshold:o.threshold,operator:o.operator}}(t,e);if(!r)return;let{value:n,threshold:o,operator:a}=r,i=fF(n)&&fF(o)?function*(r){yield oP(r,t,e),yield r.replaceText(t,`Math.abs(${fI(n,e)}) ${a} ${eZ(o,e)}`)}:void 0;return fj(t,e,i)})},meta:{type:"suggestion",docs:{description:"Prefer `Math.abs()` over manual absolute value expressions and symmetric range checks.",recommended:"unopinionated"},fixable:"code",messages:{[fx]:"Prefer `Math.abs()` to simplify this expression."},languages:["js/js"]}},"unicorn/prefer-split-limit":{create:e=>{let{sourceCode:t}=e;e.on("MemberExpression",r=>{if(!r.computed||!f$(r.object)||r3(r))return;let n=fR(r.property,t);if(void 0!==n)return fP(r,r.object,n,e)}),e.on("CallExpression",r=>{if(!td(r,{method:"at",argumentsLength:1}))return;let{object:n}=r.callee;if(!tc(r.callee)||!f$(n))return;let o=fR(r.arguments[0],t);if(void 0!==o)return fP(r,n,o,e)})},meta:{type:"suggestion",docs:{description:"Prefer `String#split()` with a limit.",recommended:"unopinionated"},fixable:"code",messages:{[fB]:"Prefer `String#split()` with a limit."},languages:["js/js"]}},"unicorn/prefer-queue-microtask":fN,"unicorn/prefer-string-pad-start-end":{create:e=>{e.on("BinaryExpression",t=>((e,t)=>{if("+"!==e.operator)return;let r=fG(e.left,t);if(r&&tQ(e.right,r.targetNode)&&!fU(e.right,t)){let n=fz({targetNode:e.right,targetLengthNode:r.targetLengthNode,paddingNode:r.paddingNode});return fX({node:e,method:"padStart",replacement:n&&fJ({method:"padStart",targetNode:e.right,...r},t),context:t,canFix:n})}let n=fG(e.right,t);if(n&&tQ(e.left,n.targetNode)&&!fU(e.left,t)){let r=fz({targetNode:e.left,targetLengthNode:n.targetLengthNode,paddingNode:n.paddingNode});return fX({node:e,method:"padEnd",replacement:r&&fJ({method:"padEnd",targetNode:e.left,...n},t),context:t,canFix:r})}})(t,e)),e.on("CallExpression",t=>((e,t)=>{if(!td(e,{method:"slice",minimumArguments:1,maximumArguments:2,optionalCall:!1,optionalMember:!1})||"BinaryExpression"!==e.callee.object.type||"+"!==e.callee.object.operator)return;let{object:r}=e.callee,[n,o]=e.arguments,a=fK(r.left,t),i=(e=>{if(e?.type==="UnaryExpression"&&"-"===e.operator)return e.argument})(n);if(1===e.arguments.length&&a&&i&&f_(a.widthNode)&&tQ(a.widthNode,i)&&"Identifier"===r.right.type&&!fU(r.right,t)){let n=fV(a.paddingNode);return fY({node:e,method:"padStart",replacement:fJ({method:"padStart",targetNode:r.right,targetLengthNode:a.widthNode,...a},t),context:t,canSuggest:n})}let s=fK(r.right,t);if(2===e.arguments.length&&s&&f_(n)&&0===n.value&&f_(s.widthNode)&&tQ(s.widthNode,o)&&"Identifier"===r.left.type&&!fU(r.left,t)){let n=fV(s.paddingNode);return fY({node:e,method:"padEnd",replacement:fJ({method:"padEnd",targetNode:r.left,targetLengthNode:s.widthNode,...s},t),context:t,canSuggest:n})}})(t,e))},meta:{type:"suggestion",docs:{description:"Prefer `String#padStart()` and `String#padEnd()` over manual string padding.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[fM]:"Prefer `String#{{method}}()` over manual string padding.",[fO]:"Replace with `String#{{method}}()`."},languages:["js/js"]}},"unicorn/require-css-escape":f3,"unicorn/require-passive-events":{create:e=>{e.on("CallExpression",t=>{if(!td(t,{method:"addEventListener",minimumArguments:2,maximumArguments:3,optionalCall:!1,optionalMember:!1}))return;let[r,n,o]=t.arguments;if(!e1(r)||!f6.has(r.value)||"ArrowFunctionExpression"!==n.type&&"FunctionExpression"!==n.type||!((e,t)=>{let r;if(r=t.sourceCode,"FunctionExpression"===e.type&&tM(r.getScope(e)).some(t=>((e,t)=>{let r=e.block;for(;r&&r!==t;){if("FunctionDeclaration"===r.type||"FunctionExpression"===r.type)return!1;r=r.parent}return r===t})(t,e)&&t.references.some(({identifier:e})=>"arguments"===e.name)))return!1;let[n]=e.params;if(!n)return!0;if("Identifier"!==n.type)return!1;let o=t.sourceCode.getDeclaredVariables(e).find(e=>e.defs[0]?.name===n);if(!o)return!1;for(let{identifier:e}of o.references)if(f5(e)||!f4(e))return!1;return!0})(n,e))return;let a=((e,t,r)=>{if(!r){let r;return{fix:(r=t.arguments[1],t=>t.insertTextAfterRange(eH(r,e),", {passive: true}"))}}if(e2(r,!0)||e2(r,!1))return{fix:e=>e.replaceText(r,e2(r,!0)?"{capture: true, passive: true}":"{passive: true}")};if("ObjectExpression"!==r.type||r.properties.some(e=>"SpreadElement"===e.type||e.computed))return;let n=r.properties.findLast(e=>"Property"===e.type&&"passive"===(e=>{if(!e.computed){if("Identifier"===e.key.type)return e.key.name;if(e1(e.key))return e.key.value}})(e));if(!n)return{fix:((e,t)=>{let r=e.properties.at(-1);if(!r)return!1;let n=t.getLastToken(e);return t.getTokensBetween(r,n,{includeComments:!0}).some(e=>"Block"===e.type||"Line"===e.type)})(r,e.sourceCode)?void 0:t=>{let{sourceCode:n}=e;if(0===r.properties.length)return t.replaceText(r,"{passive: true}");let o=r.properties.at(-1);if(n.getLoc(r).start.line===n.getLoc(r).end.line)return t.insertTextAfter(o,", passive: true");let a=n.getTokenAfter(o),i=t8(o,e);return","===a.value?t.insertTextAfter(a,`
|
|
22
30
|
${i}passive: true,`):t.insertTextAfter(o,`,
|
|
23
|
-
${i}passive: true`)}};if(e2(n.value,!1))return{fix:e=>e.replaceText(n.value,"true")}})(e,t,o);if(a)return{node:r,messageId:fI,...a}})},meta:{type:"suggestion",docs:{description:"Require passive event listeners for high-frequency events.",recommended:"unopinionated"},fixable:"code",messages:{[fI]:"Use `{passive: true}` for this high-frequency event listener."},languages:["js/js"]}},"unicorn/class-reference-in-static-methods":f6,"unicorn/consistent-optional-chaining":{create:e=>{e.on("LogicalExpression",t=>(function(e,t){let{left:r,operator:n,right:o}=e,a=gr(r),i=gr(o);if(!a||!i)return;let s=gt(a.object),l=gt(i.object);if(gn(s)&&gn(l)&&tH(s,l)){if("&&"===n&&i.optional)return{node:i,messageId:f9,...ga(i,t)&&{suggest:[{messageId:f4,fix:e=>gs(i,t,e)}]}};if("||"===n&&a.optional!==i.optional)return i.optional?{node:i,messageId:f9,...ga(i,t)&&{suggest:[{messageId:f4,fix:e=>gs(i,t,e)}]}}:{node:i,messageId:f5,...ga(i,t)&&{suggest:[{messageId:f7,fix:e=>gi({memberExpression:i,context:t,fixer:e,replacement:i.computed?"?.[":"?."})}]}}}})(t,e))},meta:{type:"suggestion",docs:{description:"Enforce consistent optional chaining for same-base member access.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[f9]:"Remove unnecessary optional chaining.",[f5]:"Use optional chaining consistently.",[f4]:"Remove optional chaining.",[f7]:"Use optional chaining."},languages:["js/js"]}},"unicorn/explicit-timer-delay":{create:e=>{let t=e.options[0],{sourceCode:r}=e;e.on("CallExpression",n=>{if(n.optional)return;let{isTimer:o,name:a}=((e,t)=>{let{callee:r}=e;if("Identifier"===r.type&&gd.has(r.name)&&t.isGlobalReference(r))return{isTimer:!0,name:r.name};if("MemberExpression"===r.type&&!r.computed&&"Identifier"===r.property.type&&gd.has(r.property.name)){let{object:e}=r;if("Identifier"===e.type&&gm.has(e.name)&&t.isGlobalReference(e))return{isTimer:!0,name:r.property.name}}return{isTimer:!1}})(n,r);if(!o)return;let{arguments:i}=n,s=i.length>=2;if(t===gl&&!s){if(0===i.length)return;let[t]=i;if(1===i.length&&t?.type==="SpreadElement")return;return{node:n,messageId:gp,data:{name:a},fix:r=>r.insertTextAfterRange(eH(t,e),", 0")}}if(t===gu&&2===i.length){let t=i[1];if(gf(t))return{node:t,messageId:gc,data:{name:a},fix(r){let[n]=i,[,o]=eH(n,e),[,a]=eH(t,e);return r.removeRange([o,a])}}}})},meta:{type:"suggestion",docs:{description:"Enforce or disallow explicit `delay` argument for `setTimeout()` and `setInterval()`.",recommended:"unopinionated"},fixable:"code",schema:[{enum:[gl,gu],description:"Whether to always require an explicit `delay` argument, or disallow an explicit `0` delay."}],defaultOptions:[gl],messages:{[gp]:"`{{name}}` should have an explicit delay argument.",[gc]:"`{{name}}` should not have an explicit delay of `0`."},languages:["js/js"]}},"unicorn/no-confusing-array-with":{create:e=>{e.on("CallExpression",e=>{var t,r,n,o;if(!tc(e,{method:"with",minimumArguments:1,optionalCall:!1,optionalMember:!1}))return;let{object:a}=e.callee,[i]=e.arguments,s=(t=i,r=a,0>Math.trunc(function e(t){if(e8(t=nA(t)))return t.value;if("UnaryExpression"===t.type&&("+"===t.operator||"-"===t.operator)){let r=e(t.argument);if("number"==typeof r)return"-"===t.operator?-r:r}}(t))?gg:(n=t,o=r,n=nA(n),o=nA(o),"MemberExpression"===n.type&&!n.optional&&!n.computed&&"Identifier"===n.property.type&&"length"===n.property.name&&sQ(n.object,o))?gy:void 0);if(s)return{node:e.callee.property,messageId:s}})},meta:{type:"suggestion",docs:{description:"Disallow confusing uses of `Array#with()`.",recommended:!0},schema:[],messages:{[gg]:"Avoid using a negative index with `Array#with()`.",[gy]:"Avoid using `.length` as the index in `Array#with()`."},languages:["js/js"]}},"unicorn/no-duplicate-loops":{create:e=>{e.on("ForOfStatement",t=>{let r=gE(t.right);if(tc(r,{methods:gS,minimumArguments:1,optionalCall:!1,optionalMember:!1,computed:!1})&&!function e(t,r){let n,o,a;return n=t=gE(t),tc(n,{methods:gb,optionalCall:!1,optionalMember:!1,computed:!1})&&((e,t)=>{if("Identifier"===(e=gE(e)).type)return"Iterator"===e.name&&t.sourceCode.isGlobalReference(e);if("MemberExpression"!==e.type||e.optional||e.computed||"Identifier"!==e.property.type||"Iterator"!==e.property.name)return!1;let r=gE(e.object);return"Identifier"===r.type&&"globalThis"===r.name&&t.sourceCode.isGlobalReference(r)})(n.callee.object,r)||tc(o=t,{methods:gh,argumentsLength:0,optionalCall:!1,optionalMember:!1,computed:!1})||tc(o,{method:"matchAll",argumentsLength:1,optionalCall:!1,optionalMember:!1,computed:!1})||tc(a=t,{methods:gx,minimumArguments:1,optionalCall:!1,optionalMember:!1,computed:!1})&&e(a.callee.object,r)}(r.callee.object,e))return{node:r.callee.property,messageId:gD,data:{loopKind:t.await?"for await…of":"for…of",method:r.callee.property.name}}})},meta:{type:"suggestion",docs:{description:"Disallow `.map()` and `.filter()` in `for…of` and `for await…of` loop headers.",recommended:!0},messages:{[gD]:"Do not use `.{{method}}()` directly in a `{{loopKind}}` loop header. It creates an intermediate array before the loop."},languages:["js/js"]}},"unicorn/no-declarations-before-early-exit":{create:e=>{let{sourceCode:t}=e;e.on("Program",e=>gj(t,e.body)),e.on("BlockStatement",e=>gj(t,e.body))},meta:{type:"suggestion",docs:{description:"Disallow declarations before conditional early exits when they are only used after the exit.",recommended:"unopinionated"},fixable:"code",schema:[],messages:{[gv]:"Move this declaration after the early exit."},languages:["js/js"]}},"unicorn/no-optional-chaining-on-undeclared-variable":{create:e=>{let t=new WeakSet;e.on("ChainExpression",r=>{let n=function(e,t){let r=function e(t){return"MemberExpression"===(t=gP(t)).type?e(t.object)??(t.optional?t.object:void 0):"CallExpression"===t.type?e(t.callee)??(t.optional?t.callee:void 0):void 0}(e.expression);if(!r)return;let n=function(e){for(e=gP(e);"MemberExpression"===e.type;)e=gP(e.object);return"Identifier"===e.type?e:void 0}(r);if(n&&function(e,t){let r=t.sourceCode.getScope(e);for(;r;){let t=r.set.get(e.name);if(t&&(0===t.defs.length||t.defs.some(e=>!gB(e))))return!1;r=r.upper}return!0}(n,t))return n}(r,e);if(!(!n||t.has(n)))return t.add(n),{node:n,messageId:gk,data:{name:n.name}}})},meta:{type:"problem",docs:{description:"Disallow optional chaining on undeclared variables.",recommended:!0},schema:[],messages:{[gk]:"Optional chaining on undeclared variable `{{name}}` throws a ReferenceError."},languages:["js/js"]}},"unicorn/no-object-methods-with-collections":{create:e=>{e.on("CallExpression",t=>((e,t)=>{let r,{callee:n}=e;if(1!==e.arguments.length||e.optional||"MemberExpression"!==n.type||n.optional||n.computed||"Identifier"!==n.object.type||"Object"!==n.object.name||!gK(n.object,t)||"Identifier"!==n.property.type||!gO.has(n.property.name))return;let[o]=e.arguments,a=((e,t)=>{let r=gX(e,t);if(!r?.size)return;let n=!1,o=!1;for(let e of r){if(gL.has(e)){n=!0;continue}if(gN.has(e)){o=!0;continue}return}if(!n||!o)return n?"Map":"Set"})(o,t);if(!a)return;let i=n.property.name,s=`${(r=eQ(o,t),nM(o,t)?`(${r})`:r)}.${i}()`,l={node:n.property,messageId:g$,data:{method:i,type:a}};return 0===t.sourceCode.getCommentsInside(e).length&&(l.suggest=[{messageId:gR,data:{replacement:s},fix:t=>t.replaceText(e,`Array.from(${s})`)}]),l})(t,e))},meta:{type:"problem",docs:{description:"Disallow `Object` methods with `Map` or `Set`.",recommended:!0},hasSuggestions:!0,messages:{[g$]:"`Object.{{method}}()` does not return {{type}} contents.",[gR]:"Use `Array.from({{replacement}})`."},languages:["js/js"]}},"unicorn/no-subtraction-comparison":{create:e=>{let{sourceCode:t}=e;e.on("BinaryExpression",r=>{let n,o;if(!gZ.has(r.operator))return;if(e0(r.right,0)&&g1(r.left))n=r.left,o=r.operator;else{if(!(e0(r.left,0)&&g1(r.right)))return;n=r.right,o=gQ[r.operator]}let a={node:r,messageId:gY};if(t.getCommentsInside(r).length>0)return a;let{left:i,right:s}=n,l=`${eQ(i,e)} ${o} ${eQ(s,e)}`,u=e=>e.replaceText(r,l),p=t.getScope(r);return(g0.has(o)?rX(i,p)&&rX(s,p):g2(i,p)&&g2(s,p))?a.fix=u:a.suggest=[{messageId:gH,data:{replacement:l},fix:u}],a})},meta:{type:"suggestion",docs:{description:"Prefer comparing values directly over subtracting and comparing to `0`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[gY]:"Prefer comparing the values directly over comparing the difference with `0`.",[gH]:"Replace with `{{replacement}}`."},languages:["js/js"]}},"unicorn/no-unnecessary-global-this":{create:e=>{e.on("MemberExpression",t=>{var r,n,o;let a,i,s=function(e){for(;g8.has(e.type);)e=e.expression;return e}(t.object),l=g6(t);if("Identifier"!==s.type||"globalThis"!==s.name||!nf(s,e)||rq(r=l)||("ForInStatement"===(a=r).parent.type||"ForOfStatement"===a.parent.type)&&a.parent.left===a||rr(n=t)||("MemberExpression"===(n=g6(n)).parent.type||"CallExpression"===n.parent.type)&&n.parent.optional&&(n.parent.object===n||n.parent.callee===n))return;let u=t.computed?e1(t.property)?t.property.value:"TemplateLiteral"===t.property.type&&0===t.property.expressions.length?t.property.quasis[0].value.cooked:void 0:t.property.name;if("string"!=typeof u||!tP.isIdentifierName(u)||tP.isKeyword(u)||tP.isReservedWord(u,!0)||tP.isStrictReservedWord(u,!0)||"eval"===u&&g9(t)||(i=ei(e.sourceCode.getScope(t),u),i?.scope.type!=="global"||0!==i.defs.length))return;let p={node:t,messageId:g3,data:{name:u}};return g9(t)||"TaggedTemplateExpression"===(o=g6(o=t)).parent.type&&o.parent.tag===o||0!==e.sourceCode.getCommentsInside(t).length||(p.fix=e=>e.replaceText(t,u)),p})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary `globalThis` references.",recommended:"unopinionated"},fixable:"code",schema:[],messages:{[g3]:"Use `{{name}}` directly instead of `globalThis.{{name}}`."},languages:["js/js"]}},"unicorn/no-unreadable-object-destructuring":{create:e=>{e.on("Property",e=>{if("ObjectPattern"===e.parent.type&&e.computed)return{node:e,messageId:g5}}),e.on("ArrayPattern",e=>{if(0!==yr(e))return{node:e,messageId:g4}}),e.on("ObjectPattern",e=>{if(3===yr(e))return{node:e,messageId:g7}}),e.on("MemberExpression",e=>{if(yt(e)?.type==="ObjectPattern")return{node:e,messageId:ye}})},meta:{type:"suggestion",docs:{description:"Disallow unreadable object destructuring.",recommended:"unopinionated"},schema:[],messages:{[g5]:"Do not use computed keys in object destructuring.",[g4]:"Do not use array destructuring inside object destructuring.",[g7]:"Do not use object destructuring deeper than two levels.",[ye]:"Do not assign destructured values to object properties."},languages:["js/js"]}},"unicorn/no-useless-else":{create:e=>{e.on("IfStatement",t=>{if(!(t.alternate&&yo.has(t.parent.type)&&yp(t.consequent)))return;let r=e.sourceCode.getTokenBefore(t.alternate);return{node:t.alternate,loc:e.sourceCode.getLoc(r),messageId:yn,fix:r=>{let{sourceCode:n}=e,{alternate:o,consequent:a}=t;if(yu(o)||"BlockStatement"===o.type&&o.body.some(e=>yu(e))||"BlockStatement"===o.type&&n.getTokens(o).some(e=>n.getLoc(e).start.line!==n.getLoc(e).end.line)||!((e,t)=>{let{sourceCode:r}=t,{alternate:n,consequent:o}=e,a="BlockStatement"===n.type?r.getTokenAfter(r.getFirstToken(n)):r.getFirstToken(n);if(!a)return!0;let i=r.getLastToken(o);if("BlockStatement"!==o.type&&";"!==i.value&&(nS(i,t,a.value)||yc(a))||((e,t)=>{let r=t.getTokenAfter(e);if(r&&t.getLoc(e).end.line===t.getLoc(r).start.line)return!0;let n=t.getCommentsAfter(e)[0];return!!(n&&t.getLoc(e).end.line===t.getLoc(n).start.line)})(n,r))return!1;let s="BlockStatement"===n.type?r.getTokenBefore(r.getLastToken(n)):r.getLastToken(n),l=r.getTokenAfter(n);return!(s&&";"!==s.value&&l&&(nS(s,t,l.value)||yc(l)))})(t,e))return;let i=[n.getRange(a)[1],n.getRange(o)[1]];if(!((e,[t,r])=>e.getAllComments().some(n=>{let[o,a]=e.getRange(n);return o>=t&&a<=r}))(n,[i[0],n.getRange(o)[0]]))return r.replaceTextRange(i,((e,t)=>{let{alternate:r}=e;if("BlockStatement"===r.type)return((e,t,r)=>{let n=r.getFirstToken(e),o=r.getLastToken(e),a=r.text.slice(r.getRange(n)[1],r.getRange(o)[0]);if(!a.includes("\n")){let e=a.trim();return e?`
|
|
24
|
-
${
|
|
25
|
-
${i.map(e=>""===e.trim()?"":e.startsWith(u)?`${l}${e.slice(u.length)}`:`${l}${e.trimStart()}`).join("\n")}`})(r,e,t);let n=
|
|
26
|
-
${n}${t.getText(r)}`})(
|
|
31
|
+
${i}passive: true`)}};if(e2(n.value,!1))return{fix:e=>e.replaceText(n.value,"true")}})(e,t,o);if(a)return{node:r,messageId:f8,...a}})},meta:{type:"suggestion",docs:{description:"Require passive event listeners for high-frequency events.",recommended:"unopinionated"},fixable:"code",messages:{[f8]:"Use `{passive: true}` for this high-frequency event listener."},languages:["js/js"]}},"unicorn/class-reference-in-static-methods":gT,"unicorn/consistent-optional-chaining":{create:e=>{e.on("LogicalExpression",t=>(function(e,t){let{left:r,operator:n,right:o}=e,a=gR(r),i=gR(o);if(!a||!i)return;let s=gB(a.object),l=gB(i.object);if(g$(s)&&g$(l)&&tQ(s,l)){if("&&"===n&&i.optional)return{node:i,messageId:gw,...gP(i,t)&&{suggest:[{messageId:gI,fix:e=>gN(i,t,e)}]}};if("||"===n&&a.optional!==i.optional)return i.optional?{node:i,messageId:gw,...gP(i,t)&&{suggest:[{messageId:gI,fix:e=>gN(i,t,e)}]}}:{node:i,messageId:gk,...gP(i,t)&&{suggest:[{messageId:gj,fix:e=>gL({memberExpression:i,context:t,fixer:e,replacement:i.computed?"?.[":"?."})}]}}}})(t,e))},meta:{type:"suggestion",docs:{description:"Enforce consistent optional chaining for same-base member access.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[gw]:"Remove unnecessary optional chaining.",[gk]:"Use optional chaining consistently.",[gI]:"Remove optional chaining.",[gj]:"Use optional chaining."},languages:["js/js"]}},"unicorn/explicit-timer-delay":{create:e=>{let t=e.options[0],{sourceCode:r}=e;e.on("CallExpression",n=>{if(n.optional)return;let{isTimer:o,name:a}=((e,t)=>{let{callee:r}=e;if("Identifier"===r.type&&gW.has(r.name)&&t.isGlobalReference(r))return{isTimer:!0,name:r.name};if("MemberExpression"===r.type&&!r.computed&&"Identifier"===r.property.type&&gW.has(r.property.name)){let{object:e}=r;if("Identifier"===e.type&&g_.has(e.name)&&t.isGlobalReference(e))return{isTimer:!0,name:r.property.name}}return{isTimer:!1}})(n,r);if(!o)return;let{arguments:i}=n,s=i.length>=2;if(t===gM&&!s){if(0===i.length)return;let[t]=i;if(1===i.length&&t?.type==="SpreadElement")return;return{node:n,messageId:gq,data:{name:a},fix:r=>r.insertTextAfterRange(eH(t,e),", 0")}}if(t===gO&&2===i.length){let t=i[1];if(gV(t))return{node:t,messageId:gU,data:{name:a},fix(r){let[n]=i,[,o]=eH(n,e),[,a]=eH(t,e);return r.removeRange([o,a])}}}})},meta:{type:"suggestion",docs:{description:"Enforce or disallow explicit `delay` argument for `setTimeout()` and `setInterval()`.",recommended:"unopinionated"},fixable:"code",schema:[{enum:[gM,gO],description:"Whether to always require an explicit `delay` argument, or disallow an explicit `0` delay."}],defaultOptions:[gM],messages:{[gq]:"`{{name}}` should have an explicit delay argument.",[gU]:"`{{name}}` should not have an explicit delay of `0`."},languages:["js/js"]}},"unicorn/no-confusing-array-with":{create:e=>{e.on("CallExpression",e=>{var t,r,n,o;if(!td(e,{method:"with",minimumArguments:1,optionalCall:!1,optionalMember:!1}))return;let{object:a}=e.callee,[i]=e.arguments,s=(t=i,r=a,0>Math.trunc(n1(t))?gz:(n=t,o=r,n=ry(n),o=ry(o),"MemberExpression"===n.type&&!n.optional&&!n.computed&&"Identifier"===n.property.type&&"length"===n.property.name&&ly(n.object,o))?gK:void 0);if(s)return{node:e.callee.property,messageId:s}})},meta:{type:"suggestion",docs:{description:"Disallow confusing uses of `Array#with()`.",recommended:!0},schema:[],messages:{[gz]:"Avoid using a negative index with `Array#with()`.",[gK]:"Avoid using `.length` as the index in `Array#with()`."},languages:["js/js"]}},"unicorn/no-duplicate-loops":{create:e=>{e.on("ForOfStatement",t=>{let r=gY(t.right);if(td(r,{methods:gZ,minimumArguments:1,optionalCall:!1,optionalMember:!1,computed:!1})&&!function e(t,r){let n,o,a;return n=t=gY(t),td(n,{methods:gX,optionalCall:!1,optionalMember:!1,computed:!1})&&((e,t)=>{if("Identifier"===(e=gY(e)).type)return"Iterator"===e.name&&t.sourceCode.isGlobalReference(e);if("MemberExpression"!==e.type||e.optional||e.computed||"Identifier"!==e.property.type||"Iterator"!==e.property.name)return!1;let r=gY(e.object);return"Identifier"===r.type&&"globalThis"===r.name&&t.sourceCode.isGlobalReference(r)})(n.callee.object,r)||td(o=t,{methods:gG,argumentsLength:0,optionalCall:!1,optionalMember:!1,computed:!1})||td(o,{method:"matchAll",argumentsLength:1,optionalCall:!1,optionalMember:!1,computed:!1})||td(a=t,{methods:gJ,minimumArguments:1,optionalCall:!1,optionalMember:!1,computed:!1})&&e(a.callee.object,r)}(r.callee.object,e))return{node:r.callee.property,messageId:gH,data:{loopKind:t.await?"for await…of":"for…of",method:r.callee.property.name}}})},meta:{type:"suggestion",docs:{description:"Disallow `.map()` and `.filter()` in `for…of` and `for await…of` loop headers.",recommended:!0},messages:{[gH]:"Do not use `.{{method}}()` directly in a `{{loopKind}}` loop header. It creates an intermediate array before the loop."},languages:["js/js"]}},"unicorn/no-declarations-before-early-exit":{create:e=>{let{sourceCode:t}=e,r=oe(e);e.onExit("Program",e=>g6(t,e.body,r)),e.onExit("BlockStatement",e=>g6(t,e.body,r))},meta:{type:"suggestion",docs:{description:"Disallow declarations before conditional early exits when they are only used after the exit.",recommended:"unopinionated"},fixable:"code",schema:[],messages:{[gQ]:"Move this declaration after the early exit."},languages:["js/js"]}},"unicorn/no-optional-chaining-on-undeclared-variable":{create:e=>{let t=new WeakSet;e.on("ChainExpression",r=>{let n=function(e,t){let r=function e(t){return"MemberExpression"===(t=g4(t)).type?e(t.object)??(t.optional?t.object:void 0):"CallExpression"===t.type?e(t.callee)??(t.optional?t.callee:void 0):void 0}(e.expression);if(!r)return;let n=function(e){for(e=g4(e);"MemberExpression"===e.type;)e=g4(e.object);return"Identifier"===e.type?e:void 0}(r);if(n&&function(e,t){let r=t.sourceCode.getScope(e);for(;r;){let t=r.set.get(e.name);if(t&&(0===t.defs.length||t.defs.some(e=>!g5(e))))return!1;r=r.upper}return!0}(n,t))return n}(r,e);if(!(!n||t.has(n)))return t.add(n),{node:n,messageId:g9,data:{name:n.name}}})},meta:{type:"problem",docs:{description:"Disallow optional chaining on undeclared variables.",recommended:!0},schema:[],messages:{[g9]:"Optional chaining on undeclared variable `{{name}}` throws a ReferenceError."},languages:["js/js"]}},"unicorn/no-object-methods-with-collections":{create:e=>{e.on("CallExpression",t=>((e,t)=>{let r,{callee:n}=e;if(1!==e.arguments.length||e.optional||"MemberExpression"!==n.type||n.optional||n.computed||"Identifier"!==n.object.type||"Object"!==n.object.name||!yc(n.object,t)||"Identifier"!==n.property.type||!yo.has(n.property.name))return;let[o]=e.arguments,a=((e,t)=>{let r=yf(e,t);if(!r?.size)return;let n=!1,o=!1;for(let e of r){if(yt.has(e)){n=!0;continue}if(yr.has(e)){o=!0;continue}return}if(!n||!o)return n?"Map":"Set"})(o,t);if(!a)return;let i=n.property.name,s=`${(r=eZ(o,t),n2(o,t)?`(${r})`:r)}.${i}()`,l={node:n.property,messageId:g7,data:{method:i,type:a}};return 0===t.sourceCode.getCommentsInside(e).length&&(l.suggest=[{messageId:ye,data:{replacement:s},fix:t=>t.replaceText(e,`Array.from(${s})`)}]),l})(t,e))},meta:{type:"problem",docs:{description:"Disallow `Object` methods with `Map` or `Set`.",recommended:!0},hasSuggestions:!0,messages:{[g7]:"`Object.{{method}}()` does not return {{type}} contents.",[ye]:"Use `Array.from({{replacement}})`."},languages:["js/js"]}},"unicorn/no-subtraction-comparison":{create:e=>{let{sourceCode:t}=e;e.on("BinaryExpression",r=>{let n,o;if(!yx.has(r.operator))return;if(e0(r.right,0)&&yE(r.left))n=r.left,o=r.operator;else{if(!(e0(r.left,0)&&yE(r.right)))return;n=r.right,o=yh[r.operator]}let a={node:r,messageId:yg};if(t.getCommentsInside(r).length>0)return a;let{left:i,right:s}=n,l=`${eZ(i,e)} ${o} ${eZ(s,e)}`,u=e=>e.replaceText(r,l),p=t.getScope(r);return(yb.has(o)?nr(i,p)&&nr(s,p):yD(i,p)&&yD(s,p))?a.fix=u:a.suggest=[{messageId:yy,data:{replacement:l},fix:u}],a})},meta:{type:"suggestion",docs:{description:"Prefer comparing values directly over subtracting and comparing to `0`.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,messages:{[yg]:"Prefer comparing the values directly over comparing the difference with `0`.",[yy]:"Replace with `{{replacement}}`."},languages:["js/js"]}},"unicorn/no-unnecessary-global-this":{create:e=>{e.on("MemberExpression",t=>{var r,n,o;let a,i,s=function(e){for(;yv.has(e.type);)e=e.expression;return e}(t.object),l=yC(t);if("Identifier"!==s.type||"globalThis"!==s.name||!nR(s,e)||r3(r=l)||("ForInStatement"===(a=r).parent.type||"ForOfStatement"===a.parent.type)&&a.parent.left===a||rh(n=t)||("MemberExpression"===(n=yC(n)).parent.type||"CallExpression"===n.parent.type)&&n.parent.optional&&(n.parent.object===n||n.parent.callee===n))return;let u=t.computed?e1(t.property)?t.property.value:"TemplateLiteral"===t.property.type&&0===t.property.expressions.length?t.property.quasis[0].value.cooked:void 0:t.property.name;if("string"!=typeof u||!tP.isIdentifierName(u)||tP.isKeyword(u)||tP.isReservedWord(u,!0)||tP.isStrictReservedWord(u,!0)||"eval"===u&&yA(t)||(i=ei(e.sourceCode.getScope(t),u),i?.scope.type!=="global"||0!==i.defs.length))return;let p={node:t,messageId:yS,data:{name:u}};return yA(t)||"TaggedTemplateExpression"===(o=yC(o=t)).parent.type&&o.parent.tag===o||0!==e.sourceCode.getCommentsInside(t).length||(p.fix=e=>e.replaceText(t,u)),p})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary `globalThis` references.",recommended:"unopinionated"},fixable:"code",schema:[],messages:{[yS]:"Use `{{name}}` directly instead of `globalThis.{{name}}`."},languages:["js/js"]}},"unicorn/no-unreadable-object-destructuring":{create:e=>{e.on("Property",e=>{if("ObjectPattern"===e.parent.type&&e.computed)return{node:e,messageId:yT}}),e.on("ArrayPattern",e=>{if(0!==yF(e))return{node:e,messageId:yw}}),e.on("ObjectPattern",e=>{if(3===yF(e))return{node:e,messageId:yk}}),e.on("MemberExpression",e=>{if(yj(e)?.type==="ObjectPattern")return{node:e,messageId:yI}})},meta:{type:"suggestion",docs:{description:"Disallow unreadable object destructuring.",recommended:"unopinionated"},schema:[],messages:{[yT]:"Do not use computed keys in object destructuring.",[yw]:"Do not use array destructuring inside object destructuring.",[yk]:"Do not use object destructuring deeper than two levels.",[yI]:"Do not assign destructured values to object properties."},languages:["js/js"]}},"unicorn/no-useless-else":{create:e=>{let{sourceCode:t}=e,r=oe(e);e.onExit("IfStatement",n=>{if(!(n.alternate&&yR.has(n.parent.type)&&r(n.consequent)))return;let o=t.getTokenBefore(n.alternate);return{node:n.alternate,loc:t.getLoc(o),messageId:yB,fix:t=>{let{sourceCode:r}=e,{alternate:o,consequent:a}=n;if(rn(o)||"BlockStatement"===o.type&&ro(o,e)||!((e,t)=>{let{sourceCode:r}=t,{alternate:n,consequent:o}=e,a="BlockStatement"===n.type?r.getTokenAfter(r.getFirstToken(n)):r.getFirstToken(n);if(!a)return!0;let i=r.getLastToken(o);if("BlockStatement"!==o.type&&";"!==i.value&&(nW(i,t,a.value)||yL(a))||((e,t)=>{let r=t.getTokenAfter(e);if(r&&t.getLoc(e).end.line===t.getLoc(r).start.line)return!0;let n=t.getCommentsAfter(e)[0];return!!(n&&t.getLoc(e).end.line===t.getLoc(n).start.line)})(n,r))return!1;let s="BlockStatement"===n.type?r.getTokenBefore(r.getLastToken(n)):r.getLastToken(n),l=r.getTokenAfter(n);return!(s&&";"!==s.value&&l&&(nW(s,t,l.value)||yL(l)))})(n,e))return;let i=[r.getRange(a)[1],r.getRange(o)[1]];if(!re(e,[i[0],r.getRange(o)[0]]))return t.replaceTextRange(i,((e,t)=>{let{alternate:r}=e;if("BlockStatement"===r.type)return((e,t,r)=>{let n=r.getFirstToken(e),o=r.getLastToken(e),a=r.text.slice(r.getRange(n)[1],r.getRange(o)[0]);if(!a.includes("\n")){let e=a.trim();return e?`
|
|
32
|
+
${yP(r,r.getRange(t)[0])}${e}`:""}let i=a.split("\n");if(i[0]?.trim()===""&&i.shift(),i.at(-1)?.trim()===""&&i.pop(),0===i.length)return"";let s=r.getTokenAfter(n,{includeComments:!0}),l=yP(r,r.getRange(t)[0]),u=s&&s!==o?yP(r,r.getRange(s)[0]):l;return`
|
|
33
|
+
${i.map(e=>""===e.trim()?"":e.startsWith(u)?`${l}${e.slice(u.length)}`:`${l}${e.trimStart()}`).join("\n")}`})(r,e,t);let n=yP(t,t.getRange(e)[0]);return`
|
|
34
|
+
${n}${t.getText(r)}`})(n,r))}}})},meta:{type:"suggestion",docs:{description:"Disallow `else` after a statement that exits.",recommended:!0},fixable:"code",messages:{[yB]:"Unexpected `else` after a statement that exits."},languages:["js/js"]}},"unicorn/no-useless-recursion":{create:e=>{let{sourceCode:t}=e;e.on("ReturnStatement",e=>{if(((e,t)=>{var r;let n,{argument:o}=e;if(o?.type!=="CallExpression"||o.optional||"Identifier"!==o.callee.type)return!1;let a=(e=>{for(;e;e=e.parent)if(tl(e))return e})(e);return!!(a?.id&&!a.generator&&!((e,t)=>{for(;e&&e!==t;e=e.parent)if("TryStatement"===e.type)return!0;return!1})(e,a)&&!((e,t)=>{for(;e&&e!==t;e=e.parent){if(yq(e))return!0;if(e.parent?.type!=="BlockStatement")continue;let t=e.parent.body.indexOf(e);if(e.parent.body.slice(0,t).some(e=>yO(e)))return!0}return!1})(e,a)&&o.callee.name===a.id.name&&(r=o.callee,n=ei(t.getScope(r),r),n?.identifiers.includes(a.id)))})(e,t))return{node:e.argument.callee,messageId:yN}})},meta:{type:"suggestion",docs:{description:"Disallow simple recursive function calls that can be replaced with a loop.",recommended:!0},messages:{[yN]:"Use a loop instead of this recursive function call."},languages:["js/js"]}},"unicorn/prefer-add-event-listener-options":{create:e=>{e.on("CallExpression",e=>{if(!td(e,{method:"addEventListener",argumentsLength:3,optionalCall:!1,optionalMember:!1}))return;let t=e.arguments[2];if(!e2(t))return;let r=`{capture: ${t.value}}`;return{node:t,messageId:yU,data:{value:String(t.value),replacement:r},fix:e=>e.replaceText(t,r)}})},meta:{type:"suggestion",docs:{description:"Prefer an options object over a boolean in `.addEventListener()`.",recommended:"unopinionated"},fixable:"code",messages:{[yU]:"Prefer `{{replacement}}` over `{{value}}`."},languages:["js/js"]}},"unicorn/prefer-direct-iteration":{create:e=>{e.on("CallExpression",t=>{if(!td(t,{methods:["entries","keys","values"],argumentsLength:0,optionalCall:!1,optionalMember:!1})||!(e=>{let{parent:t}=e;if("ForOfStatement"===t.type&&t.right===e||"YieldExpression"===t.type&&t.delegate&&t.argument===e||"SpreadElement"===t.type&&t.argument===e&&(e=>{let{parent:t}=e;return yH.has(t.type)})(t))return!0;if("NewExpression"===t.type)return 1===t.arguments.length&&t.arguments[0]===e&&(te(t,{names:yX,argumentsLength:1})||te(t,{names:rE,argumentsLength:1}));if("CallExpression"===t.type)return t.arguments[0]===e&&(td(t,{object:"Array",method:"from",minimumArguments:1,optionalCall:!1,optionalMember:!1})||yQ(t,["from"])||td(t,{object:"Object",method:"fromEntries",minimumArguments:1,optionalCall:!1,optionalMember:!1})||td(t,{object:"Promise",methods:yY,argumentsLength:1,optionalCall:!1,optionalMember:!1}));return!1})(t))return;let r=t.callee.property.name;if(((e,t)=>{if(!t?.size)return!1;for(let r of t){let t=yJ.get(r);if(!t?.includes(e))return!1}return!0})(r,y8(t.callee.object,e)))return{node:t.callee.property,messageId:yW,data:{method:r},fix:((e,t)=>{if(!(t.sourceCode.getCommentsInside(e).length>0))return r=>oO(r,e,t)})(t,e)}})},meta:{type:"suggestion",docs:{description:"Prefer direct iteration over default iterator method calls.",recommended:"unopinionated"},fixable:"code",messages:{[yW]:"Prefer direct iteration instead of `.{{method}}()`."},languages:["js/js"]}},"unicorn/prefer-number-is-safe-integer":{create:e=>{let{sourceCode:t}=e,r=(e,r)=>{let n,o={node:e,messageId:y5};return n=t.getRange(r),t.getCommentsInside(e).some(e=>{let r=t.getRange(e);return r[0]<n[0]||r[1]>n[1]})||(o.suggest=[{messageId:y4,fix:n=>{let o;return n.replaceText(e,`Number.isSafeInteger(${(o=t.getText(r),"SequenceExpression"===r.type?`(${o})`:o)})`)}}]),o};e.on("CallExpression",e=>{if(td(e,{object:"Number",method:"isInteger",optionalCall:!1,optionalMember:!1,computed:!1})&&t.isGlobalReference(e.callee.object))return{node:e.callee.property,messageId:y6,suggest:[{messageId:y9,fix:t=>t.replaceText(e.callee.property,"isSafeInteger")}]};let n=(e=>{if(td(e,{objects:y7,methods:["isInteger","isSafeInteger"],argumentsLength:1,optionalCall:!1,optionalMember:!1,computed:!1}))return e.arguments[0]})(e);if(n&&ht(e,t))return r(e,n)}),e.on("BinaryExpression",e=>{let n=(e=>{if("==="===e.operator){if(e0(e.right,0))return hr(e.left);if(e0(e.left,0))return hr(e.right)}})(e)??((e,t)=>{if("==="!==e.operator)return;let r=hn(e.left,t);if(r&&tQ(r,e.right))return r;let n=hn(e.right,t);if(n&&tQ(n,e.left))return n})(e,t);if(n&&ht(e,t))return r(e,n)})},meta:{type:"suggestion",docs:{description:"Prefer `Number.isSafeInteger()` over integer checks.",recommended:!0},hasSuggestions:!0,messages:{[y6]:"Prefer `Number.isSafeInteger()` over `Number.isInteger()`.",[y9]:"Replace `Number.isInteger()` with `Number.isSafeInteger()`.",[y5]:"Prefer `Number.isSafeInteger()` over this integer check.",[y4]:"Replace this integer check with `Number.isSafeInteger()`."},languages:["js/js"]}},"unicorn/prefer-object-define-properties":{create:e=>{let{sourceCode:t}=e;e.on("ExpressionStatement",r=>{let n=hi(r);if(!n)return;let o=hi(or(r,e));if(o&&tQ(o.arguments[0],n.arguments[0]))return;let a=[r],i=[n],s=on(r,e);for(;;){let t=hi(s);if(!t||!tQ(n.arguments[0],t.arguments[0]))break;a.push(s),i.push(t),s=on(s,e)}if(i.length<2)return;let l={node:n.callee.property,messageId:ha},u=[t.getRange(a[0])[0],t.getRange(a.at(-1))[1]];return function(e,t){let r=new Set,n=[];for(let o of e){let e=o.arguments[1],a=function(e,t){let r=ew(e,t.getScope(e));if(r)return"symbol"==typeof r.value?r.value:String(r.value)}(e,t);if(void 0===a){if(n.some(t=>tQ(t,e)))return!0;n.push(e);continue}if(r.has(a))return!0;r.add(a)}return!1}(i,t)||t.getAllComments().some(e=>{let[r,n]=t.getRange(e);return r>=u[0]&&n<=u[1]})||(l.fix=function(e,t,r){let{sourceCode:n}=r,o=e[0],a=e.at(-1),i=t8(o,r),s=`${i} `,l=n.getText(t[0].arguments[0]),u=t.map(e=>{let t=function(e,t){let r=t.getText(e);if("Literal"===e.type){if("string"==typeof e.value)return"__proto__"===e.value?`[${r}]`:ho(e.value)?e.value:r;if("number"==typeof e.value)return r}return`[${r}]`}(e.arguments[1],n),r=n.getText(e.arguments[2]).replaceAll("\n","\n ");return`${s}${t}: ${r},`}).join("\n");return e=>e.replaceTextRange([n.getRange(o)[0],n.getRange(a)[1]],`Object.defineProperties(${l}, {
|
|
27
35
|
${u}
|
|
28
|
-
${i}});`)}(a,i,e)),l})},meta:{type:"suggestion",docs:{description:"Prefer `Object.defineProperties()` over multiple `Object.defineProperty()` calls.",recommended:"unopinionated"},fixable:"code",schema:[],messages:{[yV]:"Prefer `Object.defineProperties()` over multiple `Object.defineProperty()` calls."},languages:["js/js"]}},"unicorn/prefer-object-destructuring-defaults":{create:e=>{e.on("VariableDeclarator",t=>{let{id:r,init:n}=t;if("ObjectPattern"!==r.type||n?.type!=="ObjectExpression"||0!==e.sourceCode.getCommentsInside(t).length)return;let o=((e,t)=>{if(e.typeAnnotation)return;let r=[];for(let n of e.properties){if(!(yY(n)&&"Identifier"===n.value.type))return;let e=eF(n,t.sourceCode.getScope(n));if(null===e||yJ.has(e))return;r.push({node:n,name:e})}return r})(r,e),a=((e,t)=>{let{properties:r}=e,n=r.at(-1);if(n?.type!=="SpreadElement"||eR(n.argument,t.sourceCode,yX))return;let o=new Map;for(let e of r.slice(0,-1)){if(!yY(e)||eR(e.value,t.sourceCode,yX))return;let r=eF(e,t.sourceCode.getScope(e));if(null===r||o.has(r))return;o.set(r,e)}return{defaultProperties:o,spreadElement:n}})(n,e);if(!o||0===o.length||!a)return;let{defaultProperties:i,spreadElement:s}=a;if(o.length!==i.size)return;let l=new Set(o.map(e=>e.node.value.name)),u=[];for(let t of o){let r=i.get(t.name);if(!r||yH(r.value,l,e))return;u.push(yQ(t,r,e))}return{node:t,messageId:yK,suggest:[{messageId:yG,fix:r=>r.replaceText(t,`{${u.join(", ")}} = {${e.sourceCode.getText(s)}}`)}]}})},meta:{type:"suggestion",docs:{description:"Prefer object destructuring defaults over default object literals with spread.",recommended:!0},hasSuggestions:!0,schema:[],messages:{[yK]:"Prefer object destructuring defaults over default object literals with spread.",[yG]:"Use object destructuring defaults."},languages:["js/js"]}},"unicorn/prefer-single-object-destructuring":{create:e=>{let{sourceCode:t}=e;e.on("Program",e=>y2(t,e.body)),e.on(["BlockStatement","StaticBlock"],e=>y2(t,e.body)),e.on("SwitchCase",e=>y2(t,e.consequent))},meta:{type:"suggestion",docs:{description:"Prefer a single object destructuring declaration per local const source.",recommended:!0},fixable:"code",schema:[],messages:{[yZ]:"Prefer a single object destructuring declaration from `{{source}}`."},languages:["js/js"]}},"unicorn/prefer-smaller-scope":{create:e=>{let{sourceCode:t}=e;e.on("VariableDeclaration",e=>(function(e,t){if(!(e.parent&&("Program"===e.parent.type||"BlockStatement"===e.parent.type)&&"let"===e.kind&&1===e.declarations.length&&"Identifier"===e.declarations[0].id.type&&!e.declarations[0].init))return;let[r]=e.declarations,[n]=t.getDeclaredVariables(r),o=n.references.filter(e=>!e.init),a=o.filter(e=>e.isWrite());if(1!==a.length||o.every(e=>!e.isRead()))return;let i=function(e){let{identifier:t}=e,r=t.parent;if("AssignmentExpression"!==r.type||"="!==r.operator||r.left!==t||"ExpressionStatement"!==r.parent.type)return;let n=r.parent,o=n.parent;if("BlockStatement"===o.type)return{assignmentExpression:r,assignmentStatement:n,block:o}}(a[0]);if(!i)return;let{assignmentExpression:s,assignmentStatement:l,block:u}=i,[,p]=t.getRange(e),[c,d]=t.getRange(l);if(!y6(u,e.parent)||function e(t,r){if("WithStatement"===t.type||"CallExpression"===t.type&&"Identifier"===t.callee.type&&"eval"===t.callee.name)return!0;for(let n of r[t.type]??[]){let o=t[n];if(Array.isArray(o)){if(o.some(t=>t&&e(t,r)))return!0}else if(o&&e(o,r))return!0}return!1}(e.parent,t.visitorKeys)||c<p||o.some(e=>!y6(e.identifier,u))||o.some(e=>e.isRead()&&t.getRange(e.identifier)[0]<d))return;let m={node:r.id,messageId:y3,data:{name:r.id.name}};return r.id.typeAnnotation||y5(t,s)&&"SequenceExpression"===s.right.type||t.getCommentsInside(e).length>0||t.getCommentsInside(l).length>0||y9(t,e,"before")||y9(t,e,"after")||y9(t,l,"before")||y9(t,l,"after")||(m.fix=function({sourceCode:e,declaration:t,assignmentExpression:r,assignmentStatement:n,name:o}){return function*(a){yield ob(t,{sourceCode:e},a);let i=`const ${o} = `;if(y5(e,r))return void(yield a.replaceText(n,`${i}${e.getText(r.right)};`));let[s]=e.getRange(r),[l]=e.getRange(r.right);yield a.replaceTextRange([s,l],i)}}({sourceCode:t,declaration:e,assignmentExpression:s,assignmentStatement:l,name:r.id.name})),m})(e,t))},meta:{type:"suggestion",docs:{description:"Prefer declaring variables in the smallest possible scope.",recommended:!0},fixable:"code",schema:[],messages:{[y3]:"Move `{{name}}` into the block where it is used."},languages:["js/js"]}},"unicorn/prefer-single-array-predicate":{create:e=>{e.on("LogicalExpression",t=>{if("LogicalExpression"===t.parent.type&&t.parent.operator===t.operator)return;let r=he.get(t.operator);if(!r||e.sourceCode.getCommentsInside(t).length>0)return;let n=(function e(t,r){return"LogicalExpression"!==t.type||t.operator!==r?[t]:[...e(t.left,r),...e(t.right,r)]})(t,t.operator).map(t=>(function(e,t,r){if(!tc(e,{method:t,argumentsLength:1,optionalCall:!1,optionalMember:!1})||e.typeArguments||e.typeParameters)return;let{object:n}=e.callee;if(rk(n,r))return;let o=function(e){if("ArrowFunctionExpression"===e.type&&!e.async&&!e.returnType&&!e.typeParameters&&1===e.params.length&&"Identifier"===e.params[0].type&&"BlockStatement"!==e.body.type)return{parameter:e.params[0],body:e.body}}(e.arguments[0]);if(o){var a;let t;return{node:e,object:n,callback:{...o,parameterText:(a=o.parameter,t=r.sourceCode.getText(a),a.typeAnnotation||a.optional?`(${t})`:t)}}}})(t,r,e));if(!(n.length<2||n.includes(void 0)||n.some(e=>{let t;return t=n[0],!tH(t.object,e.object)||t.callback.parameterText!==e.callback.parameterText})))return{node:t,messageId:y4,data:{method:r},suggest:[{messageId:y7,data:{method:r},fix:r=>r.replaceText(t,function(e,t,r){let{sourceCode:n}=r,[o]=e,{callback:a}=o,i=e.map(({callback:e})=>(function(e,t,r){var n,o;if(eZ(e,r))return eQ(e,r);let a=r.sourceCode.getText(e);return(n=e,o=t,"LogicalExpression"===n.type?n.operator!==o&&("||"!==o||"&&"!==n.operator):ht.has(n.type))?`(${a})`:a})(e.body,t,r)).join(` ${t} `);return`${n.getText(o.node.callee)}(${a.parameterText} => ${i})`}(n,t.operator,e))}]}})},meta:{type:"suggestion",docs:{description:"Prefer a single `Array#some()` or `Array#every()` with a combined predicate.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[y4]:"Prefer a single `Array#{{method}}()` with a combined predicate.",[y7]:"Merge predicates into one `Array#{{method}}()` call."},languages:["js/js"]}},"unicorn/prefer-url-href":{create:e=>{e.on("CallExpression",t=>{if(tc(t,{method:"toString",argumentsLength:0,optionalCall:!1,optionalMember:!1,computed:!1})&&"url"===hE(t.callee.object,e)){let r={node:t.callee.property,messageId:hr};return hS(t,e)&&!eZ(t.callee,e)&&hD(t.callee.object,e)&&(r.fix=r=>r.replaceTextRange([e.sourceCode.getRange(t.callee.property)[0],e.sourceCode.getRange(t)[1]],"href")),r}if(!(e7(t,{name:"String",argumentsLength:1,optional:!1})&&nf(t.callee,e)))return;let[r]=t.arguments;if("url"!==hE(r,e))return;let n={node:t.callee,messageId:hr};return hS(t,e)&&hD(r,e)&&(n.fix=n=>{let o,a,i;return n.replaceText(t,(o=eQ(r,e),a=!eZ(r,e)&&nM(r,e)?`(${o})`:o,i=`${a}.href`,(nS(e.sourceCode.getTokenBefore(r.parent),e,i)?";":"")+i))}),n})},meta:{type:"suggestion",docs:{description:"Prefer `URL#href` over stringifying a `URL`.",recommended:"unopinionated"},fixable:"code",messages:{[hr]:"Prefer `URL#href` over stringifying a `URL`."},languages:["js/js"]}},"unicorn/require-proxy-trap-boolean-return":{create:e=>{let{sourceCode:t}=e;function*r(e){let r;if(!(te(r=e,{name:"Proxy",argumentsLength:2})||tc(r,{object:"Proxy",method:"revocable",argumentsLength:2,optionalCall:!1,optionalMember:!1,computed:!1})))return;let n=e.arguments[1];if("ObjectExpression"===n.type)for(let e of n.properties){let r=hB(e,t);if(!r)continue;let n=h$(r,t);n&&(yield n)}}e.on("CallExpression",r),e.on("NewExpression",r)},meta:{type:"problem",docs:{description:"Require boolean-returning Proxy traps to return booleans.",recommended:"unopinionated"},fixable:"code",messages:{[hv]:"Proxy trap `{{name}}` should return a boolean."},languages:["js/js"]}},"unicorn/logical-assignment-operators":hO,"unicorn/no-useless-coercion":{create:e=>{let{sourceCode:t}=e;e.on("CallExpression",r=>{if(r.optional||"Identifier"!==r.callee.type||1!==r.arguments.length||"SpreadElement"===r.arguments[0].type)return;let{name:n}=r.callee,o=hU.get(n);if(!o||!nf(r.callee,e))return;let[a]=r.arguments;if(o.isType(a,e))return{node:r,messageId:hq,data:{name:n,type:o.type},*fix(n,{abort:o}){let i;if(t.getCommentsInside(r).length>0)return o();yield(i=eQ(a,e),("MemberExpression"===r.parent.type&&r.parent.object===r?nM(a,e):!nh.has(a.type))&&!eZ(a,e)&&(i=`(${i})`),i.startsWith("{")&&(i=`(${i})`),nS(e.sourceCode.getTokenBefore(r),e,i)&&(i=`;${i}`),n.replaceText(r,i))}}})},meta:{type:"suggestion",docs:{description:"Disallow useless type coercions of values that are already of the target type.",recommended:"unopinionated"},fixable:"code",messages:{[hq]:"`{{name}}()` is unnecessary because the value is already a {{type}}."},languages:["js/js"]}},"unicorn/no-useless-boolean-cast":{create:e=>{let{sourceCode:t}=e;e.on("CallExpression",r=>{if(!tc(r,{methods:hW,minimumArguments:1,maximumArguments:2,optionalCall:!1,optionalMember:!1}))return;let[n]=r.arguments;if(!tl(n))return;let o=function(e){if(!e.async&&!e.generator&&!e.returnType){if("ArrowFunctionExpression"===e.type&&"BlockStatement"!==e.body.type)return e.body;if("BlockStatement"===e.body.type&&1===e.body.body.length&&"ReturnStatement"===e.body.body[0].type)return e.body.body[0].argument}}(n);if(!tv(o,e)||t.getCommentsInside(o).length>0)return;let[a]=o.arguments;if(!(n.params[0]?.type==="Identifier"&&nm(n.params[0],a)))return{node:o,messageId:h_,data:{method:r.callee.property.name},fix(e){let r,i=t.getText(a);return"ArrowFunctionExpression"===n.type&&n.body===o&&(r=i,"SequenceExpression"===a.type||r.trimStart().startsWith("{"))&&(i=`(${i})`),e.replaceText(o,i)}}})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary `Boolean()` casts in array predicate callbacks.",recommended:"unopinionated"},fixable:"code",messages:{[h_]:"`Boolean()` is unnecessary in `Array#{{method}}()` callbacks."},languages:["js/js"]}},"unicorn/no-useless-continue":{create:e=>{e.on("ContinueStatement",t=>{if(!t.label&&(e=>{if("BlockStatement"!==e.parent.type)return!1;let t=e;for(;;){let{parent:e}=t;if("BlockStatement"===e.type){if(e.body.at(-1)!==t)return!1;t=e;continue}if("IfStatement"===e.type&&(e.consequent===t||e.alternate===t)){t=e;continue}return tu.includes(e.type)&&e.body===t}})(t))return{node:t,messageId:hV,fix:r=>ob(t,e,r)}})},meta:{type:"suggestion",docs:{description:"Disallow useless `continue` statements.",recommended:"unopinionated"},fixable:"code",messages:{[hV]:"Unnecessary `continue` statement."},languages:["js/js"]}},"unicorn/no-useless-override":{create:e=>{let{sourceCode:t}=e;e.on("MethodDefinition",r=>{let n;if("method"!==r.kind||r.accessibility||r.optional||r.decorators?.length>0||r.value.params.some(e=>e.decorators?.length>0))return;let{value:o}=r;if("FunctionExpression"!==o.type||!o.body||o.generator||!r.parent.parent.superClass)return;let a=function(e,t){let r,n,o,{value:a}=e;if(1!==a.body.body.length)return;let[i]=a.body.body;if("ReturnStatement"===i.type?r=i.argument:"ExpressionStatement"===i.type&&(r=i.expression),r?.type!=="CallExpression"||r.optional)return;let{callee:s}=r;if("MemberExpression"!==s.type||s.optional||"Super"!==s.object.type)return;let l=t.getScope(r),u=eF(e,l);if("string"==typeof u&&eF(s,l)===u&&(n=r.arguments,o=a.params,n.length===o.length&&o.every((e,t)=>{let r=n[t];return"Identifier"===e.type?"Identifier"===r.type&&r.name===e.name:"RestElement"===e.type&&"Identifier"===e.argument.type&&"SpreadElement"===r.type&&"Identifier"===r.argument.type&&r.argument.name===e.argument.name})))return{callExpression:r,name:u,isReturned:"ReturnStatement"===i.type}}(r,t);if(!a)return;let{callExpression:i,name:s,isReturned:l}=a;if(n=t.getScope(r),!r.parent.body.some(e=>e!==r&&"MethodDefinition"===e.type&&"method"===e.kind&&e.static===r.static&&null===e.value.body&&eF(e,n)===s)){if(l){let t;if(o.async&&(void 0===(t=hG(i,e))||!0!==function e(t,r){let n;if(n=t=r.getNonNullableType(t),!ri.has(n.intrinsicName)){if(t.isUnion()){let n=t.types.map(t=>e(t,r));return!!n.every(Boolean)||!n.every(e=>!1===e)&&void 0}return void 0!==r.getPromisedTypeOfPromise(t)}}(t.type,t.checker)))return}else{let t;if(o.async||!(void 0!==(t=hG(i,e))&&hK(t.type)))return}return{node:r.key,messageId:hz,data:{superCall:t.getText(i.callee)},*fix(n,{abort:o}){if(t.getCommentsInside(r).length>0)return o();yield ov(r,"",n,e)}}}})},meta:{type:"suggestion",docs:{description:"Disallow useless overrides of class methods.",recommended:"unopinionated"},fixable:"code",messages:{[hz]:"Useless override; this method only forwards to `{{superCall}}(…)`."},languages:["js/js"]}},"unicorn/prefer-has-check":{create:e=>{e.on("CallExpression",t=>((e,t)=>{if(!tc(e,{method:"get",argumentsLength:1,computed:!1,optionalCall:!1,optionalMember:!1,allowSpreadElement:!1}))return;let r=(e=>{let t=(e=>{for(;h5.has(e.parent?.type)&&e.parent.expression===e;)e=e.parent;return e})(e),{parent:r}=t;if(r?.type==="BinaryExpression"&&["!==","===","!=","=="].includes(r.operator)){if(r.left===t)return{node:r,operator:r.operator,value:r.right};if(r.right===t)return{node:r,operator:r.operator,value:r.left}}})(e);if(r){let n,o;if(t.sourceCode.getCommentsInside(e).length>0)return;let a=((e,t,r)=>{let n=xd(e.callee.object,r);if(!n)return;let o="!="===t.operator||"=="===t.operator;if("null-sentinel"===n.kind)return o&&xo(t.value,r)?{missingType:"undefined"}:{missingType:"null"};if("map"===n.kind){if(xo(t.value,r)&&xb(e.callee.object,r,o?"not-nullish":"not-undefined"))return{missingType:"undefined"};if(xE(t.value)&&o&&xb(e.callee.object,r,"not-nullish"))return{missingType:"nullish"}}})(e,r,t);if(!a||(n=r.value,o=a.missingType,"undefined"===o?!xo(n,t):!xE(n)))return;return{node:e.callee.property,messageId:hJ,fix:((e,t,r)=>{var n;let o;if(r.sourceCode.getCommentsInside(t.node).length>r.sourceCode.getCommentsInside(e).length)return;let a=`${(({operator:e})=>"!=="===e||"!="===e)(t)?"":"!"}${(o=eQ(n=e.callee.object,r),!eZ(n,r)&&nM(n,r)?`(${o})`:o)}.has(${((e,t)=>{let[r]=e.arguments;return t.sourceCode.getText(r)})(e,r)})`;return e=>e.replaceText(t.node,a)})(e,r,t)}}if((tC(e,t)||tA(e))&&xd(e.callee.object,t)?.kind==="map"&&xb(e.callee.object,t,"truthy")){if(t.sourceCode.getCommentsInside(e).length>0)return;return{node:e.callee.property,messageId:hJ,fix:t=>t.replaceText(e.callee.property,"has")}}})(t,e))},meta:{type:"suggestion",docs:{description:"Prefer `.has()` when checking existence.",recommended:"unopinionated"},fixable:"code",messages:{[hJ]:"Prefer `.has(…)` when checking existence."},languages:["js/js"]}}}).map(([e,t])=>{let r;return[e,{meta:{schema:[],...t.meta,docs:{...t.meta.docs,url:(r=d.basename(e,".js"),`https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v67.0.0/docs/rules/${r}.md`)}},create:n$(t.create)}]})))};module.exports=xD;
|
|
36
|
+
${i}});`)}(a,i,e)),l})},meta:{type:"suggestion",docs:{description:"Prefer `Object.defineProperties()` over multiple `Object.defineProperty()` calls.",recommended:"unopinionated"},fixable:"code",schema:[],messages:{[ha]:"Prefer `Object.defineProperties()` over multiple `Object.defineProperty()` calls."},languages:["js/js"]}},"unicorn/prefer-object-destructuring-defaults":{create:e=>{e.on("VariableDeclarator",t=>{let{id:r,init:n}=t;if("ObjectPattern"!==r.type||n?.type!=="ObjectExpression"||0!==e.sourceCode.getCommentsInside(t).length)return;let o=((e,t)=>{if(e.typeAnnotation)return;let r=[];for(let n of e.properties){if(!(hc(n)&&"Identifier"===n.value.type))return;let e=eI(n,t.sourceCode.getScope(n));if(null===e||hu.has(e))return;r.push({node:n,name:e})}return r})(r,e),a=((e,t)=>{let{properties:r}=e,n=r.at(-1);if(n?.type!=="SpreadElement"||eP(n.argument,t.sourceCode,hp))return;let o=new Map;for(let e of r.slice(0,-1)){if(!hc(e)||eP(e.value,t.sourceCode,hp))return;let r=eI(e,t.sourceCode.getScope(e));if(null===r||o.has(r))return;o.set(r,e)}return{defaultProperties:o,spreadElement:n}})(n,e);if(!o||0===o.length||!a)return;let{defaultProperties:i,spreadElement:s}=a;if(o.length!==i.size)return;let l=new Set(o.map(e=>e.node.value.name)),u=[];for(let t of o){let r=i.get(t.name);if(!r||hd(r.value,l,e))return;u.push(hm(t,r,e))}return{node:t,messageId:hs,suggest:[{messageId:hl,fix:r=>r.replaceText(t,`{${u.join(", ")}} = {${e.sourceCode.getText(s)}}`)}]}})},meta:{type:"suggestion",docs:{description:"Prefer object destructuring defaults over default object literals with spread.",recommended:!0},hasSuggestions:!0,schema:[],messages:{[hs]:"Prefer object destructuring defaults over default object literals with spread.",[hl]:"Use object destructuring defaults."},languages:["js/js"]}},"unicorn/prefer-single-object-destructuring":{create:e=>{let{sourceCode:t}=e;e.on("Program",e=>hh(t,e.body)),e.on(["BlockStatement","StaticBlock"],e=>hh(t,e.body)),e.on("SwitchCase",e=>hh(t,e.consequent))},meta:{type:"suggestion",docs:{description:"Prefer a single object destructuring declaration per local const source.",recommended:!0},fixable:"code",schema:[],messages:{[hf]:"Prefer a single object destructuring declaration from `{{source}}`."},languages:["js/js"]}},"unicorn/prefer-smaller-scope":{create:e=>{let{sourceCode:t}=e;e.on("VariableDeclaration",e=>(function(e,t){if(!(e.parent&&("Program"===e.parent.type||"BlockStatement"===e.parent.type)&&"let"===e.kind&&1===e.declarations.length&&"Identifier"===e.declarations[0].id.type&&!e.declarations[0].init))return;let[r]=e.declarations,[n]=t.getDeclaredVariables(r),o=n.references.filter(e=>!e.init),a=o.filter(e=>e.isWrite());if(1!==a.length||o.every(e=>!e.isRead()))return;let i=function(e){let{identifier:t}=e,r=t.parent;if("AssignmentExpression"!==r.type||"="!==r.operator||r.left!==t||"ExpressionStatement"!==r.parent.type)return;let n=r.parent,o=n.parent;if("BlockStatement"===o.type)return{assignmentExpression:r,assignmentStatement:n,block:o}}(a[0]);if(!i)return;let{assignmentExpression:s,assignmentStatement:l,block:u}=i,[,p]=t.getRange(e),[c,d]=t.getRange(l);if(!hE(u,e.parent)||function e(t,r){if("WithStatement"===t.type||"CallExpression"===t.type&&"Identifier"===t.callee.type&&"eval"===t.callee.name)return!0;for(let n of r[t.type]??[]){let o=t[n];if(Array.isArray(o)){if(o.some(t=>t&&e(t,r)))return!0}else if(o&&e(o,r))return!0}return!1}(e.parent,t.visitorKeys)||c<p||o.some(e=>!hE(e.identifier,u))||o.some(e=>e.isRead()&&t.getRange(e.identifier)[0]<d))return;let m={node:r.id,messageId:hx,data:{name:r.id.name}};return r.id.typeAnnotation||hS(t,s)&&"SequenceExpression"===s.right.type||t.getCommentsInside(e).length>0||t.getCommentsInside(l).length>0||hD(t,e,"before")||hD(t,e,"after")||hD(t,l,"before")||hD(t,l,"after")||(m.fix=function({sourceCode:e,declaration:t,assignmentExpression:r,assignmentStatement:n,name:o}){return function*(a){yield oq(t,{sourceCode:e},a);let i=`const ${o} = `;if(hS(e,r))return void(yield a.replaceText(n,`${i}${e.getText(r.right)};`));let[s]=e.getRange(r),[l]=e.getRange(r.right);yield a.replaceTextRange([s,l],i)}}({sourceCode:t,declaration:e,assignmentExpression:s,assignmentStatement:l,name:r.id.name})),m})(e,t))},meta:{type:"suggestion",docs:{description:"Prefer declaring variables in the smallest possible scope.",recommended:!0},fixable:"code",schema:[],messages:{[hx]:"Move `{{name}}` into the block where it is used."},languages:["js/js"]}},"unicorn/prefer-single-array-predicate":{create:e=>{e.on("LogicalExpression",t=>{if("LogicalExpression"===t.parent.type&&t.parent.operator===t.operator)return;let r=hA.get(t.operator);if(!r||e.sourceCode.getCommentsInside(t).length>0)return;let n=(function e(t,r){return"LogicalExpression"!==t.type||t.operator!==r?[t]:[...e(t.left,r),...e(t.right,r)]})(t,t.operator).map(t=>(function(e,t,r){if(!td(e,{method:t,argumentsLength:1,optionalCall:!1,optionalMember:!1})||e.typeArguments||e.typeParameters)return;let{object:n}=e.callee;if(rG(n,r))return;let o=function(e){if("ArrowFunctionExpression"===e.type&&!e.async&&!e.returnType&&!e.typeParameters&&1===e.params.length&&"Identifier"===e.params[0].type&&"BlockStatement"!==e.body.type)return{parameter:e.params[0],body:e.body}}(e.arguments[0]);if(o){var a;let t;return{node:e,object:n,callback:{...o,parameterText:(a=o.parameter,t=r.sourceCode.getText(a),a.typeAnnotation||a.optional?`(${t})`:t)}}}})(t,r,e));if(!(n.length<2||n.includes(void 0)||n.some(e=>{let t;return t=n[0],!tQ(t.object,e.object)||t.callback.parameterText!==e.callback.parameterText})))return{node:t,messageId:hv,data:{method:r},suggest:[{messageId:hC,data:{method:r},fix:r=>r.replaceText(t,function(e,t,r){let{sourceCode:n}=r,[o]=e,{callback:a}=o,i=e.map(({callback:e})=>(function(e,t,r){var n,o;if(eQ(e,r))return eZ(e,r);let a=r.sourceCode.getText(e);return(n=e,o=t,"LogicalExpression"===n.type?n.operator!==o&&("||"!==o||"&&"!==n.operator):hT.has(n.type))?`(${a})`:a})(e.body,t,r)).join(` ${t} `);return`${n.getText(o.node.callee)}(${a.parameterText} => ${i})`}(n,t.operator,e))}]}})},meta:{type:"suggestion",docs:{description:"Prefer a single `Array#some()` or `Array#every()` with a combined predicate.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[hv]:"Prefer a single `Array#{{method}}()` with a combined predicate.",[hC]:"Merge predicates into one `Array#{{method}}()` call."},languages:["js/js"]}},"unicorn/prefer-url-href":{create:e=>{e.on("CallExpression",t=>{if(td(t,{method:"toString",argumentsLength:0,optionalCall:!1,optionalMember:!1,computed:!1})&&"url"===hz(t.callee.object,e)){let r={node:t.callee.property,messageId:hw};return hG(t,e)&&!eQ(t.callee,e)&&hK(t.callee.object,e)&&(r.fix=r=>r.replaceTextRange([e.sourceCode.getRange(t.callee.property)[0],e.sourceCode.getRange(t)[1]],"href")),r}if(!(e7(t,{name:"String",argumentsLength:1,optional:!1})&&nR(t.callee,e)))return;let[r]=t.arguments;if("url"!==hz(r,e))return;let n={node:t.callee,messageId:hw};return hG(t,e)&&hK(r,e)&&(n.fix=n=>{let o,a,i;return n.replaceText(t,(o=eZ(r,e),a=!eQ(r,e)&&n2(r,e)?`(${o})`:o,i=`${a}.href`,(nW(e.sourceCode.getTokenBefore(r.parent),e,i)?";":"")+i))}),n})},meta:{type:"suggestion",docs:{description:"Prefer `URL#href` over stringifying a `URL`.",recommended:"unopinionated"},fixable:"code",messages:{[hw]:"Prefer `URL#href` over stringifying a `URL`."},languages:["js/js"]}},"unicorn/require-proxy-trap-boolean-return":{create:e=>{let{sourceCode:t}=e,r=new WeakMap,n=[];function*o(e){let n;if(!(te(n=e,{name:"Proxy",argumentsLength:2})||td(n,{object:"Proxy",method:"revocable",argumentsLength:2,optionalCall:!1,optionalMember:!1,computed:!1})))return;let o=e.arguments[1];if("ObjectExpression"===o.type)for(let e of o.properties){let n=h2(e,t);if(!n)continue;let o=h3(n,t,r);o&&(yield o)}}e.on("onCodePathStart",()=>{n.push(new Set)}),e.on("onCodePathEnd",()=>{n.pop()}),e.on("onCodePathSegmentStart",e=>{n.at(-1).add(e)}),e.on("onCodePathSegmentEnd",e=>{n.at(-1).delete(e)}),e.on("onUnreachableCodePathSegmentStart",e=>{n.at(-1).add(e)}),e.on("onUnreachableCodePathSegmentEnd",e=>{n.at(-1).delete(e)}),e.onExit("BlockStatement",e=>{if(!(hY.has(e.parent?.type)&&e.parent.body===e))return;let t=[...n.at(-1)].every(e=>!e.reachable);r.set(e.parent,t)}),e.onExit("CallExpression",o),e.onExit("NewExpression",o)},meta:{type:"problem",docs:{description:"Require boolean-returning Proxy traps to return booleans.",recommended:"unopinionated"},fixable:"code",messages:{[hJ]:"Proxy trap `{{name}}` should return a boolean."},languages:["js/js"]}},"unicorn/logical-assignment-operators":h7,"unicorn/no-useless-coercion":{create:e=>{let{sourceCode:t}=e,r=(r,n,o,a)=>({node:r,messageId:xe,data:{description:o,type:a},*fix(o,{abort:a}){if(t.getCommentsInside(r).length>0)return a();yield oj(o,r,n,e)}});e.on("CallExpression",t=>{if(t.optional||"Identifier"!==t.callee.type||1!==t.arguments.length||"SpreadElement"===t.arguments[0].type)return;let{name:n}=t.callee,o=xt.get(n);if(!o||!nR(t.callee,e))return;let[a]=t.arguments;if(o.isType(a,e))return r(t,a,`\`${n}()\``,o.type)}),e.on("UnaryExpression",e=>{if("+"===e.operator&&nr(e.argument,t.getScope(e.argument)))return r(e,e.argument,"`+`","number")}),e.on("BinaryExpression",t=>{let n;if("+"!==t.operator)return;let{left:o,right:a}=t;if(xr(a)&&nC(o,e))n=o;else{if(!(xr(o)&&nC(a,e)))return;n=a}return r(t,n,"Concatenation with `''`","string")}),e.on("CallExpression",t=>{let{callee:n}=t;if(!t.optional&&!(t.arguments.length>0)&&"MemberExpression"===n.type&&!n.optional&&!n.computed&&"Identifier"===n.property.type&&"toString"===n.property.name&&nC(n.object,e))return r(t,n.object,"`.toString()`","string")})},meta:{type:"suggestion",docs:{description:"Disallow useless type coercions of values that are already of the target type.",recommended:"unopinionated"},fixable:"code",messages:{[xe]:"{{description}} is unnecessary because the value is already a {{type}}."},languages:["js/js"]}},"unicorn/no-useless-boolean-cast":{create:e=>{let{sourceCode:t}=e;e.on("CallExpression",r=>{if(!td(r,{methods:xo,minimumArguments:1,maximumArguments:2,optionalCall:!1,optionalMember:!1}))return;let[n]=r.arguments;if(!tl(n))return;let o=function(e){if(!e.async&&!e.generator&&!e.returnType){if("ArrowFunctionExpression"===e.type&&"BlockStatement"!==e.body.type)return e.body;if("BlockStatement"===e.body.type&&1===e.body.body.length&&"ReturnStatement"===e.body.body[0].type)return e.body.body[0].argument}}(n);if(!tC(o,e)||t.getCommentsInside(o).length>0)return;let[a]=o.arguments;if(!(n.params[0]?.type==="Identifier"&&nB(n.params[0],a)))return{node:o,messageId:xn,data:{method:r.callee.property.name},fix(e){let r,i=t.getText(a);return"ArrowFunctionExpression"===n.type&&n.body===o&&(r=i,"SequenceExpression"===a.type||r.trimStart().startsWith("{"))&&(i=`(${i})`),e.replaceText(o,i)}}})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary `Boolean()` casts in array predicate callbacks.",recommended:"unopinionated"},fixable:"code",messages:{[xn]:"`Boolean()` is unnecessary in `Array#{{method}}()` callbacks."},languages:["js/js"]}},"unicorn/no-useless-continue":{create:e=>{e.on("ContinueStatement",t=>{if(!t.label&&(e=>{if("BlockStatement"!==e.parent.type)return!1;let t=e;for(;;){let{parent:e}=t;if("BlockStatement"===e.type){if(e.body.at(-1)!==t)return!1;t=e;continue}if("IfStatement"===e.type&&(e.consequent===t||e.alternate===t)){t=e;continue}return tp(e)&&e.body===t}})(t))return{node:t,messageId:xa,fix:r=>oq(t,e,r)}})},meta:{type:"suggestion",docs:{description:"Disallow useless `continue` statements.",recommended:"unopinionated"},fixable:"code",messages:{[xa]:"Unnecessary `continue` statement."},languages:["js/js"]}},"unicorn/no-useless-override":{create:e=>{let{sourceCode:t}=e;e.on("MethodDefinition",r=>{let n;if("method"!==r.kind||r.accessibility||r.optional||r.decorators?.length>0||r.value.params.some(e=>e.decorators?.length>0))return;let{value:o}=r;if("FunctionExpression"!==o.type||!o.body||o.generator||!r.parent.parent.superClass)return;let a=function(e,t){let r,n,o,{value:a}=e;if(1!==a.body.body.length)return;let[i]=a.body.body;if("ReturnStatement"===i.type?r=i.argument:"ExpressionStatement"===i.type&&(r=i.expression),r?.type!=="CallExpression"||r.optional)return;let{callee:s}=r;if("MemberExpression"!==s.type||s.optional||"Super"!==s.object.type)return;let l=t.getScope(r),u=eI(e,l);if("string"==typeof u&&eI(s,l)===u&&(n=r.arguments,o=a.params,n.length===o.length&&o.every((e,t)=>{let r=n[t];return"Identifier"===e.type?"Identifier"===r.type&&r.name===e.name:"RestElement"===e.type&&"Identifier"===e.argument.type&&"SpreadElement"===r.type&&"Identifier"===r.argument.type&&r.argument.name===e.argument.name})))return{callExpression:r,name:u,isReturned:"ReturnStatement"===i.type}}(r,t);if(!a)return;let{callExpression:i,name:s,isReturned:l}=a;if(n=t.getScope(r),!r.parent.body.some(e=>e!==r&&"MethodDefinition"===e.type&&"method"===e.kind&&e.static===r.static&&null===e.value.body&&eI(e,n)===s)){if(l){let t;if(o.async&&(void 0===(t=xl(i,e))||!0!==function e(t,r){let n;if(n=t=r.getNonNullableType(t),!rD.has(n.intrinsicName)){if(t.isUnion()){let n=t.types.map(t=>e(t,r));return!!n.every(Boolean)||!n.every(e=>!1===e)&&void 0}return void 0!==r.getPromisedTypeOfPromise(t)}}(t.type,t.checker)))return}else{let t;if(o.async||!(void 0!==(t=xl(i,e))&&xs(t.type)))return}return{node:r.key,messageId:xi,data:{superCall:t.getText(i.callee)},*fix(n,{abort:o}){if(t.getCommentsInside(r).length>0)return o();yield oV(r,"",n,e)}}}})},meta:{type:"suggestion",docs:{description:"Disallow useless overrides of class methods.",recommended:"unopinionated"},fixable:"code",messages:{[xi]:"Useless override; this method only forwards to `{{superCall}}(…)`."},languages:["js/js"]}},"unicorn/prefer-has-check":{create:e=>{e.on("CallExpression",t=>((e,t)=>{if(!td(e,{method:"get",argumentsLength:1,computed:!1,optionalCall:!1,optionalMember:!1,allowSpreadElement:!1}))return;let r=(e=>{let t=(e=>{for(;xS.has(e.parent?.type)&&e.parent.expression===e;)e=e.parent;return e})(e),{parent:r}=t;if(r?.type==="BinaryExpression"&&["!==","===","!=","=="].includes(r.operator)){if(r.left===t)return{node:r,operator:r.operator,value:r.right};if(r.right===t)return{node:r,operator:r.operator,value:r.left}}})(e);if(r){let n,o;if(t.sourceCode.getCommentsInside(e).length>0)return;let a=((e,t,r)=>{let n=xN(e.callee.object,r);if(!n)return;let o="!="===t.operator||"=="===t.operator;if("null-sentinel"===n.kind)return o&&xI(t.value,r)?{missingType:"undefined"}:{missingType:"null"};if("map"===n.kind){if(xI(t.value,r)&&xV(e.callee.object,r,o?"not-nullish":"not-undefined"))return{missingType:"undefined"};if(xz(t.value)&&o&&xV(e.callee.object,r,"not-nullish"))return{missingType:"nullish"}}})(e,r,t);if(!a||(n=r.value,o=a.missingType,"undefined"===o?!xI(n,t):!xz(n)))return;return{node:e.callee.property,messageId:xu,fix:((e,t,r)=>{var n;let o;if(r.sourceCode.getCommentsInside(t.node).length>r.sourceCode.getCommentsInside(e).length)return;let a=`${(({operator:e})=>"!=="===e||"!="===e)(t)?"":"!"}${(o=eZ(n=e.callee.object,r),!eQ(n,r)&&n2(n,r)?`(${o})`:o)}.has(${((e,t)=>{let[r]=e.arguments;return t.sourceCode.getText(r)})(e,r)})`;return e=>e.replaceText(t.node,a)})(e,r,t)}}if((tA(e,t)||tT(e))&&xN(e.callee.object,t)?.kind==="map"&&xV(e.callee.object,t,"truthy")){if(t.sourceCode.getCommentsInside(e).length>0)return;return{node:e.callee.property,messageId:xu,fix:t=>t.replaceText(e.callee.property,"has")}}})(t,e))},meta:{type:"suggestion",docs:{description:"Prefer `.has()` when checking existence.",recommended:"unopinionated"},fixable:"code",messages:{[xu]:"Prefer `.has(…)` when checking existence."},languages:["js/js"]}},"unicorn/consistent-conditional-object-spread":{create:e=>{e.options[0]===xG?e.on("LogicalExpression",t=>{if(xH(t)){if("&&"!==t.operator||ta(t.right)||xZ(t.left,t.right,e.sourceCode))return;let r=x2(t.left,e.sourceCode);if(r&&!r.isTrueWhenNullish&&xZ(r.reference,t.right,e.sourceCode))return;let n=x8(t.left,e),o=x8(t.right,e);return{node:t,messageId:xJ,data:{expectedStyle:"ternary"},*fix(r,{abort:a}){if(e.sourceCode.getCommentsInside(t).length>0)return a();yield r.replaceText(t,`${n} ? ${o} : {}`)}}}}):e.on("ConditionalExpression",t=>{if(xH(t))return function(e,t){let{test:r,consequent:n,alternate:o}=e,a=ta(o);if(a===ta(n))return;let i=a?n:o,s=x2(r,t.sourceCode),l=t.sourceCode.getCommentsInside(e).length>0;if((a?xZ(r,i,t.sourceCode):"UnaryExpression"===r.type&&"!"===r.operator&&r.prefix&&xZ(r.argument,i,t.sourceCode))||s&&!l&&(s.isTrueWhenNullish?!a:a)&&xZ(s.reference,i,t.sourceCode))return;let u=a?x3(r,"left",t):function(e,t){if("UnaryExpression"===e.type&&"!"===e.operator&&e.prefix)return x3(e.argument,"left",t);let r=eZ(e,t);return!eQ(e,t)&&n8(e,"!")&&(r=`(${r})`),`!${r}`}(r,t),p=x3(i,"right",t);return{node:e,messageId:xJ,data:{expectedStyle:"logical"},*fix(t,{abort:r}){if(l)return r();yield t.replaceText(e,`${u} && ${p}`)}}}(t,e)})},meta:{type:"suggestion",docs:{description:"Enforce consistent conditional object spread style.",recommended:!0},fixable:"code",schema:[{description:"The conditional object spread style to enforce.",enum:[xK,xG]}],defaultOptions:[xK],messages:{[xJ]:"Prefer {{expectedStyle}} conditional object spreads."},languages:["js/js"]}},"unicorn/default-export-style":bE,"unicorn/no-array-concat-in-loop":{create:e=>{e.on("AssignmentExpression",t=>{let r=function(e,t){var r;if("="!==e.operator)return;let n="Identifier"===e.left.type?e.left:void 0,o=bD(e.right);if(!n||!td(o,{method:"concat",minimumArguments:1,optionalCall:!1,optionalMember:!1,computed:!1}))return;let a=(r=bD(r=o.callee.object),r?.type==="Identifier"?r:void 0),i=bS(n,t);if(!a||!i||i!==bS(a,t)||!function(e){let[t]=e?.defs??[];if(!t||1!==e.defs.length||"global"===e.scope.type||"Variable"!==t.type||"Identifier"!==t.node.id.type||"let"!==t.parent.kind&&"var"!==t.parent.kind)return!1;let r=t.node.init&&bD(t.node.init);return!!(r&&to(r))}(i))return;let s=function(e,t){for(let r of t.sourceCode.getAncestors(e).toReversed()){if(tl(r))return;if(tp(r))return r}}(e,t),[l]=i.defs;if(!(!s||function(e,t,r){let[n,o]=r.sourceCode.getRange(e),[a,i]=r.sourceCode.getRange(t);return n>=a&&o<=i}(l.node,s.body,t)))return{callExpression:o,property:o.callee.property}}(t,e);if(r)return{node:r.property,messageId:bv}})},meta:{type:"suggestion",docs:{description:"Disallow array accumulation with `Array#concat()` in loops.",recommended:!0},schema:[],messages:{[bv]:"Do not use `Array#concat()` to accumulate an array in a loop."},languages:["js/js"]}},"unicorn/no-array-front-mutation":{create:e=>{e.on("CallExpression",t=>{if(!td(t,{methods:["shift","unshift"],optionalCall:!1,computed:!1}))return;let{object:r,property:n}=t.callee,{name:o}=n;if(!("unshift"===o&&ty(t.callee,bA)||rX(r,e)))return{node:n,messageId:bC,data:{method:o}}})},meta:{type:"suggestion",docs:{description:"Disallow front-of-array mutation.",recommended:!1},schema:[],messages:{[bC]:"Avoid front-of-array mutation with `Array#{{method}}()`."},languages:["js/js"]}},"unicorn/no-array-sort-for-min-max":{create:e=>{e.on("MemberExpression",t=>{if(!t.computed||t.optional||!bk(t.property)||r3(t)||("ForInStatement"===t.parent.type||"ForOfStatement"===t.parent.type)&&t.parent.left===t)return;let r=bI(t.object,e);if(r)return bj(t,r,"first",e)}),e.on("CallExpression",t=>{let r;if(!td(t,{method:"at",argumentsLength:1,optionalCall:!1,optionalMember:!1}))return;let[n]=t.arguments;if(bk(n)?r="first":tm(n)&&(r="last"),!r||r3(t))return;let o=bI(t.callee.object,e);if(o)return bj(t,o,r,e)})},meta:{type:"suggestion",docs:{description:"Disallow sorting arrays to get the minimum or maximum value.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[bT]:"Use `Math.{{method}}()` instead of sorting to get the {{extreme}} value.",[bw]:"Replace with `{{replacement}}`."},languages:["js/js"]}},"unicorn/no-boolean-sort-comparator":{create:e=>{e.on("CallExpression",t=>{if(!(e7(t,{minimumArguments:1})&&"MemberExpression"===t.callee.type&&bR.has(eI(t.callee,e.sourceCode.getScope(t.callee))))||rG(t.callee.object,e))return;let[r]=t.arguments;if("SpreadElement"!==r.type){let t=ry(r);if(tl(t)){let n=(e=>{if("BlockStatement"!==e.body.type)return e.body;if(1!==e.body.body.length)return;let[t]=e.body.body;if("ReturnStatement"===t.type)return t.argument})(t);if(!nm(t,e)&&!bL(r,e))return;return{node:r,messageId:bF,suggest:r===t?((e,t,r)=>{var n;if(!t||2!==e.params.length||e.params.some(e=>"Identifier"!==e.type)||e.params.some(e=>e.typeAnnotation)||e.params.some(e=>e.optional)||e.typeParameters||e.returnType||r.sourceCode.getCommentsInside(e).length>0)return;let[o,a]=e.params;if(o.name===a.name)return;let i="BinaryExpression"===(n=ry(n=t)).type&&b$.has(n.operator)?n:void 0;if(!i||rg(i.left)||rg(i.right)||!bP(i.left,i.right,o,a))return;let[s,l]=">"===i.operator||">="===i.operator?[i.left,i.right]:[i.right,i.left],u=`(${o.name}, ${a.name}) => ${r.sourceCode.getText(s)} - ${r.sourceCode.getText(l)}`;return[{messageId:bB,data:{replacement:u},fix:t=>t.replaceText(e,u)}]})(t,n,e):void 0}}return nf(t,e)||function(e,t){if("Identifier"===e.type)return("Boolean"===e.name||na.has(e.name))&&t.sourceCode.isGlobalReference(e);if("MemberExpression"!==e.type||e.optional||"Identifier"!==e.object.type||!t.sourceCode.isGlobalReference(e.object))return!1;let r=ni.get(e.object.name),n=eI(e,t.sourceCode.getScope(e));return!!r?.has(n)}(t,e)||bL(r,e)?{node:r,messageId:bF}:void 0}})},meta:{type:"problem",docs:{description:"Disallow boolean-returning sort comparators.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[bF]:"Do not return a boolean from a sort comparator.",[bB]:"Replace with `{{replacement}}`."},languages:["js/js"]}},"unicorn/no-chained-comparison":{create:e=>{let{sourceCode:t}=e;e.on("BinaryExpression",r=>{let n;if(!bU.has(r.operator))return;let o=bW(r.left)?r.left:r.right;if(!bW(o))return;let a=o===r.left,i=a?r.right:r.left;if(bq.has(r.operator)&&ny(i,e))return;let s={node:r,messageId:bN},l=bO.has(o.operator)===bO.has(r.operator)&&("Literal"!==(n=r.right).type||"boolean"!=typeof n.value);if(a&&l&&!bW(r.right)&&!bW(o.left)&&((e,t)=>{if(eQ(e,t))return!0;let{parent:r}=e;return"BinaryExpression"!==r.type&&("LogicalExpression"!==r.type||"??"!==r.operator)})(r,e)&&!eP(o.right,t)&&0===t.getCommentsInside(r).length){let n=`${t.getText(r.left)} && ${eZ(o.right,e)} ${r.operator} ${eZ(r.right,e)}`;s.suggest=[{messageId:bM,data:{replacement:n},fix:e=>e.replaceText(r,n)}]}return s})},meta:{type:"problem",docs:{description:"Disallow chained comparisons such as `a < b < c`.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[bN]:"Comparison operators cannot be chained. The inner comparison evaluates to a boolean, which is then compared instead of the operands.",[bM]:"Replace with `{{replacement}}`."},languages:["js/js"]}},"unicorn/no-constant-zero-expression":{create:e=>{let{sourceCode:t}=e;e.on("BinaryExpression",e=>{if(!(e=>{switch(e.operator){case"*":case"&":return e0(e.left,0)||e0(e.right,0);case"/":return e0(e.left,0);default:return!1}})(e))return;let r={node:e,messageId:b_},n=ew(e,t.getScope(e));return n&&Object.is(n.value,0)&&0===t.getCommentsInside(e).length&&(r.suggest=[{messageId:bV,fix:t=>t.replaceText(e,"0")}]),r})},meta:{type:"problem",docs:{description:"Disallow arithmetic and bitwise operations that always evaluate to `0`.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[b_]:"This operation always evaluates to `0` (or `-0`/`NaN`), which is likely a mistake.",[bV]:"Replace this expression with `0`."},languages:["js/js"]}},"unicorn/no-duplicate-logical-operands":{create:e=>{e.on("LogicalExpression",t=>{let r,n;if("&&"!==t.operator&&"||"!==t.operator)return;let o="LogicalExpression"===t.left.type&&t.left.operator===t.operator?t.left.right:t.left;if((e=>{for(let t=e.parent;t;t=t.parent)if("WithStatement"===t.type)return!0;return!1})(t)||!bX(o)||!bX(t.right)||!ly(o,t.right))return;let a={node:t.right,messageId:bz};if(r=t.left,!e.sourceCode.getCommentsInside(t).every(t=>((e,t,r)=>{let[n,o]=r.sourceCode.getRange(e),[a,i]=eH(t,r);return n>=a&&o<=i})(t,r,e)))return a;let i=eZ(t.left,e),s=e=>e.replaceText(t,i);return bJ.has(o.type)&&(n=t.right,bJ.has(n.type))?{...a,fix:s}:{...a,suggest:[{messageId:bK,fix:s}]}})},meta:{type:"problem",docs:{description:"Disallow adjacent duplicate operands in logical expressions.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,schema:[],messages:{[bz]:"This operand duplicates the left operand.",[bK]:"Remove the duplicate operand."},languages:["js/js"]}},"unicorn/no-impossible-length-comparison":{create:e=>{e.on("BinaryExpression",t=>{let r,n,o,a;if(!Object.hasOwn(bH,t.operator))return;let i=(r=ry(t.left),n=ry(t.right),rl(r)?{memberExpression:r,operator:t.operator,value:ew(n,e.sourceCode.getScope(n))?.value}:rl(n)?{memberExpression:n,operator:bH[t.operator],value:ew(r,e.sourceCode.getScope(r))?.value}:void 0);if(!i)return;let{memberExpression:s}=i;if("ThisExpression"===(o=ry(s.object)).type||"Super"===o.type||function e(t){return!!("ChainExpression"===(t=ry(t)).type||rh(t))||("MemberExpression"===t.type?e(t.object):"CallExpression"===t.type&&e(t.callee))}(s.object)||(a=ew(s,e.sourceCode.getScope(s)))&&(!Number.isSafeInteger(a.value)||a.value<0)||function({node:e,lengthOrSizeNode:t}){let r=function(e){for(;tE(e.parent)&&"&&"===e.parent.operator;)e=e.parent;return e}(e);return"LogicalExpression"===r.type&&"&&"===r.operator&&(function e(t){return[t.left,t.right].flatMap(r=>"LogicalExpression"===r.type&&r.operator===t.operator?e(r):[r])})(r).some(r=>r!==e&&tc(r,{computed:!1,optional:!1})&&"Identifier"===r.property.type&&rs.has(r.property.name)&&tQ(r.object,t.object))}({node:t,lengthOrSizeNode:s}))return;let l=function({operator:e,value:t}){if("number"==typeof t&&Number.isFinite(t))switch(e){case"<":return!(t<=0)&&void 0;case"<=":case"===":case"==":return!(t<0)&&void 0;case">":case"!==":case"!=":return t<0||void 0;case">=":return t<=0||void 0}}(i);if(void 0!==l)return{node:t,messageId:bY,data:{property:s.property.name,result:String(l)}}})},meta:{type:"problem",docs:{description:"Disallow impossible comparisons against `.length` or `.size`.",recommended:"unopinionated"},messages:{[bY]:"This comparison is always {{result}} because `.{{property}}` is always a non-negative integer."},languages:["js/js"]}},"unicorn/no-invalid-character-comparison":{create:e=>{e.on("BinaryExpression",t=>{if(bQ.has(t.operator))for(let[r,n]of[[t.left,t.right],[t.right,t.left]]){let o=e3(n);if(void 0!==o&&o.length>1&&b0(r,e)){let e="!=="===t.operator||"!="===t.operator;return{node:t,messageId:bZ,data:{string:o,result:e?"true":"false"}}}}})},meta:{type:"problem",docs:{description:"Disallow comparing a single character from a string to a multi-character string.",recommended:"unopinionated"},schema:[],messages:{[bZ]:"A single character can never equal the multi-character string `{{string}}`, so this comparison is always {{result}}."},languages:["js/js"]}},"unicorn/no-loop-iterable-mutation":{create:e=>{let t=new WeakSet,r=oe(e);e.onExit("ForOfStatement",n=>{if(n.await)return;let o=Er(n.right,e);if(o)return function* e(t,r,n,o){if(b5.has(t.type))return;let a=n;if("ForOfStatement"===t.type&&!t.await){let e=Er(t.right,o);e&&Ei(e.reference,r.iterable,o)&&(a=Eo(t,e))}if("CallExpression"===t.type){let e=function(e,t,r,n){if("MemberExpression"!==e.callee.type)return;let{addArgumentIdentifier:o,deleteArgumentIdentifier:a,iterable:i,reportedCallExpressions:s,setKeyIdentifier:l}=t,{object:u,property:p}=e.callee,c=eI(e.callee,n.sourceCode.getScope(e.callee));if(!(!b6[t.collectionKind??"unknown"].has(c)||!Ei(u,i,n)||"delete"===c&&Es(e,a,n)||El(e,{addArgumentIdentifier:o,setKeyIdentifier:l},c,n)&&!function e(t,r,n){let o=function(e){let t=e;for(;t.parent&&"BlockStatement"!==t.parent.type&&"SwitchCase"!==t.parent.type;)t=t.parent;if(t.parent)return{parent:t.parent,statement:t,statements:"SwitchCase"===t.parent.type?t.parent.consequent:t.parent.body}}(t);if(!o)return!1;let{statement:a,statements:i}=o,s=i.indexOf(a);return!!i.slice(0,s).some(e=>(function e(t,r,n){let o=function(e){if("ExpressionStatement"!==e.type)return;let t=ry(e.expression);return"CallExpression"===t.type?t:void 0}(t);if(o)return"MemberExpression"===o.callee.type&&"delete"===eI(o.callee,n.sourceCode.getScope(o.callee))&&Ei(o.callee.object,r.iterable,n)&&Es(o,r.deleteArgumentIdentifier,n);return"BlockStatement"===t.type?t.body.some(t=>e(t,r,n)):"IfStatement"===t.type&&(!r.branchAlwaysExits(t.consequent)&&e(t.consequent,r,n)||t.alternate&&!r.branchAlwaysExits(t.alternate)&&e(t.alternate,r,n))})(e,r,n))||o.parent!==r.loopBody&&e(o.parent,r,n)}(e,t,n)||r&&El(e,r,c,n))&&!s.has(e))return s.add(e),{node:p,messageId:b1,data:{iterable:n.sourceCode.getText(i)}}}(t,r,n,o);e&&(yield e)}for(let n of o.sourceCode.visitorKeys[t.type]??[]){let i=t[n];if(Array.isArray(i)){for(let t of i)t&&(yield*e(t,r,a,o));continue}i&&(yield*e(i,r,a,o))}}(n.body,{branchAlwaysExits:r,...Eo(n,o),reportedCallExpressions:t},void 0,e)})},meta:{type:"problem",docs:{description:"Disallow mutating a loop iterable during iteration.",recommended:!0},schema:[],messages:{[b1]:"Do not mutate `{{iterable}}` while iterating over it."},languages:["js/js"]}},"unicorn/no-selector-as-dom-name":{create:e=>{let{sourceCode:t}=e;e.on("CallExpression",function*(e){for(let{node:r,expectedPrefix:n}of(e=>{if(td(e,{methods:Ep})&&tc(e.callee.object,{property:"classList",computed:!1})&&!nT(ry(e.callee.object.object))){let t=e.callee.property.name;return"add"===t||"remove"===t?Ey(e.arguments,"."):"replace"===t?e.arguments[0]?.type==="SpreadElement"?[]:Ey(e.arguments.slice(0,2),"."):Ey(e.arguments.slice(0,1),".")}if(td(e,{methods:["getElementById","getElementsByClassName"],argumentsLength:1})&&!nT(ry(e.callee.object))){let t="getElementById"===e.callee.property.name?"#":".";return Ey(e.arguments,t)}return[]})(e)){if("SpreadElement"===r.type)continue;let e=ry(r),o=Ef(e);Em(o)&&(yield Eg(e,o,n,t))}})},meta:{type:"problem",docs:{description:"Disallow selector syntax in DOM names.",recommended:!0},fixable:"code",messages:{[Eu]:"Do not use selector syntax in DOM names."},languages:["js/js"]}},"unicorn/no-useless-compound-assignment":{create:e=>{let{sourceCode:t}=e;e.on("AssignmentExpression",r=>{if(!EE.has(r.operator)||!e8(r.right)||r.right.value!==EE.get(r.operator))return;let n={operator:r.operator,value:r.right.raw};if(t.getCommentsInside(r).length>0)return{node:r,messageId:Eh,data:n};let{parent:o}=r;if("ExpressionStatement"===o.type&&["Program","BlockStatement","StaticBlock","SwitchCase"].includes(o.parent.type))return{node:r,messageId:Eh,data:n,suggest:[{messageId:Ex,fix:t=>oq(o,e,t)}]};let a=t.getText(r.left);return{node:r,messageId:Eh,data:n,suggest:[{messageId:Eb,data:{left:a},fix:e=>e.replaceText(r,a)}]}})},meta:{type:"suggestion",docs:{description:"Disallow useless compound assignments such as `x += 0`.",recommended:"unopinionated"},hasSuggestions:!0,messages:{[Eh]:"This compound assignment is useless as `{{operator}} {{value}}` does not change the value.",[Ex]:"Remove the useless assignment.",[Eb]:"Replace the useless assignment with `{{left}}`."},languages:["js/js"]}},"unicorn/no-useless-delete-check":{create:e=>{e.on("IfStatement",t=>{let r=function(e,t){if(e.alternate||"IfStatement"===e.parent.type&&e.parent.alternate===e)return;let r=(e=>{if("BlockStatement"===e.type){if(1!==e.body.length)return;e=e.body[0]}return"ExpressionStatement"===e.type?e.expression:void 0})(e.consequent);if(r)return"UnaryExpression"===r.type&&"delete"===r.operator?function(e,t,r){let n,{test:o}=e,{argument:a}=t;if("BinaryExpression"===o.type&&"in"===o.operator&&"MemberExpression"===a.type&&!a.optional&&tQ(o.right,a.object)&&EB(o.right,r)&&ER(o.left,r)&&ER(o.right,r)&&(!a.computed||ER(a.property,r))){if(a.computed)n=((e,t,r)=>{if(tQ(e,t))return!((e,t)=>{var r;let n;if(EB(e,t)||Ej(ry(e),t))return!0;let o=ra(ry(e),t);if(!o)return!1;let a=ry(o);return"NewExpression"===a.type||"CallExpression"===(r="ChainExpression"===(n=r=a).type?n.expression:n).type&&void 0===EF(r,t)})(e,r);let n=EF(e,r),o=EF(t,r);return void 0!==n&&n===o})(o.left,a.property,r);else{let e=eI(a,r.sourceCode.getScope(a));n=null!==e&&e===EF(o.left,r)}return n?{suggest:[{messageId:ES,fix:EP(e,t,r)}]}:void 0}}(e,r,t):function(e,t,r){let{test:n}=e;if(E$(n,"has")&&E$(t,"delete")&&((e,t)=>{let r;if("Identifier"!==(e=ry(e)).type)return!1;let n=ra(e,t);if(!n)return!1;let o=ry(n);return"NewExpression"===o.type&&(r=o.callee,"Identifier"===r.type&&EC.has(r.name)&&t.sourceCode.isGlobalReference(r))})(n.callee.object,r)&&tQ(n.callee.object,t.callee.object)&&tQ(n.arguments[0],t.arguments[0])&&ER(n.arguments[0],r))return{fix:EP(e,t,r)}}(e,r,t)}(t,e);if(r)return{node:t.test,messageId:ED,fix:r.fix,suggest:r.suggest}})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary existence checks before deletion.",recommended:"unopinionated"},fixable:"code",hasSuggestions:!0,schema:[],messages:{[ED]:"The existence check before deletion is unnecessary.",[ES]:"Remove the existence check."},languages:["js/js"]}},"unicorn/no-useless-logical-operand":{create:e=>{e.on("LogicalExpression",t=>{if(!EN.has(t.operator)||"LogicalExpression"===t.parent.type&&t.parent.operator===t.operator)return;let r=function(e,t){let r,n,{operator:o}=e,a=function e(t,r){return"LogicalExpression"===t.type&&t.operator===r?[...e(t.left,r),...e(t.right,r)]:[t]}(e,o),i=(r=EM.get(o),e2(a[0],r)?a[0]:void 0);if(i)return{target:i,replacementOperands:[i]};let s=(n=EN.get(o),a.filter((e,r)=>e2(e,n)&&function(e,t,r){var n;if(t<e.length-1)return!0;let o=e.slice(0,-1);return tA(n=e[t].parent,r)||tT(n)||o.every(e=>ny(e,r))}(a,r,t)));if(0===s.length)return;let l=a.filter(e=>!s.includes(e));return{target:s[0],replacementOperands:0===l.length?[s.at(-1)]:l}}(t,e);if(!r)return;let{target:n,replacementOperands:o}=r;if(1===o.length&&e1(ry(o[0]))&&function(e){let{parent:t}=e;if("ExpressionStatement"!==t.type||t.expression!==e)return!1;let r=t.parent,n=r.parent;if("Program"!==r.type&&!("BlockStatement"===r.type&&tl(n)))return!1;let o=r.body.indexOf(t);return r.body.slice(0,o).every(e=>"string"==typeof e.directive)}(t))return;let a={node:n,messageId:EL,data:{operator:t.operator}};return e.sourceCode.getCommentsInside(t).length>0||(1===o.length?a.fix=r=>oj(r,t,o[0],e):a.fix=r=>{var n;let a;return r.replaceText(t,(n=t.operator,a=o.map((t,r)=>{let o,a;return o=eQ(t,e),a=eZ(t,e),!o&&n6(t,{operator:n,property:0===r?"left":"right"})&&(a=`(${a})`),0===r&&!o&&EO.has(ry(t).type)&&(a=`(${a})`),a}).join(` ${n} `),nW(e.sourceCode.getTokenBefore(t),e,a)?`;${a}`:a))}),a})},meta:{type:"suggestion",docs:{description:"Disallow unnecessary operands in logical expressions involving boolean literals.",recommended:"unopinionated"},fixable:"code",schema:[],messages:{[EL]:"Simplify this `{{operator}}` expression."},languages:["js/js"]}},"unicorn/prefer-boolean-return":{create:e=>{let{sourceCode:t}=e;function r(n,o,a,i=t.getRange(n)){let s;if(!o||!a||"ConditionalExpression"===n.test.type)return;let l=E_(o),u=E_(a);if(void 0===l||void 0===u||l===u)return;let p={node:n,messageId:Eq},c=!l,d=t.getCommentsInside(n).length>0||t.getCommentsInside(a).length>0||t7(e,a),m=!c&&!EV(n.test,e)&&!!(s=ei(t.getScope(n),"Boolean"))&&0!==s.defs.length;return d||m?p:{...p,fix:t=>t.replaceTextRange(i,`return ${function(t,r){let n=eZ(t,e);if(r)return n8(t,"!")?`!(${n})`:`!${n}`;if(EV(t,e))return n;let o="SequenceExpression"===t.type?`(${n})`:n;return`Boolean(${o})`}(n.test,c)};`)}}e.on("IfStatement",n=>{if(!n.alternate){let o=on(n,e);if(!o||"ReturnStatement"!==o.type)return;let a=r(n,EW(n.consequent),o,[t.getRange(n)[0],t.getRange(o)[1]]);return a?.fix&&t.getTokensBetween(n,o,{includeComments:!0}).some(e=>"Block"===e.type||"Line"===e.type)?{node:n,messageId:Eq}:a}return r(n,EW(n.consequent),EW(n.alternate))})},meta:{type:"suggestion",docs:{description:"Prefer directly returning boolean expressions over `if` statements.",recommended:"unopinionated"},fixable:"code",schema:[],messages:{[Eq]:"Return the boolean expression directly."},languages:["js/js"]}},"unicorn/prefer-continue":EQ,"unicorn/prefer-flat-math-min-max":{create:e=>{let{sourceCode:t}=e;e.on("CallExpression",e=>{let r=(e=>{for(let t of E1)if(E2(e,t))return t})(e);if(!(!r||!e.arguments.some(e=>E2(e,r))||((e,t)=>{let{parent:r}=e;return E2(r,t)&&r.arguments.includes(e)})(e,r)))return{node:e,messageId:E0,data:{method:r},*fix(n,{abort:o}){if(t.getCommentsInside(e).length>0)return o();let a=t.getText(e.callee),i=E3(e,r).map(e=>t.getText(e)).join(", ");yield n.replaceText(e,`${a}(${i})`)}}})},meta:{type:"suggestion",docs:{description:"Prefer flat `Math.min()` and `Math.max()` calls over nested calls.",recommended:"unopinionated"},fixable:"code",schema:[],messages:{[E0]:"Prefer a flat `Math.{{method}}()` call instead of nested calls."},languages:["js/js"]}},"unicorn/prefer-hoisting-branch-code":{create:e=>{e.on("IfStatement",t=>(function*(e,t){if("IfStatement"===e.parent.type&&e.parent.alternate===e)return;let r=function(e){let t=[],r=e;for(;r?.type==="IfStatement";r=r.alternate)t.push(r.consequent);if(r)return t.push(r),t}(e);if(!r||r.some(e=>"BlockStatement"!==e.type))return;let{sourceCode:n}=t,{leading:o,trailing:a,minLength:i}=function(e,t){let r=Math.min(...e.map(e=>e.length)),n=0;for(;n<r&&e.every(r=>De(r[n],e[0][n],t));)n++;let o=0;for(;n+o<r&&e.every(r=>De(r.at(-1-o),e[0].at(-1-o),t));)o++;return{leading:n,trailing:o,minLength:r}}(r.map(e=>e.body),n);0===o&&0===a||!(o+a>=i)&&(o>0&&(yield Dr({ifStatement:e,blocks:r,leading:o,trailing:a,isStart:!0},t)),a>0&&(yield Dr({ifStatement:e,blocks:r,leading:o,trailing:a,isStart:!1},t)))})(t,e))},meta:{type:"suggestion",docs:{description:"Prefer moving code shared by all branches of an `if` statement out of the branches.",recommended:!0},fixable:"code",hasSuggestions:!0,messages:{[E8]:"These branches start with the same code. Move it before the `if` statement.",[E6]:"These branches end with the same code. Move it after the `if` statement.",[E9]:"Move the shared code out of the branches."},languages:["js/js"]}},"unicorn/prefer-single-replace":{create:e=>{let{sourceCode:t}=e;e.on("CallExpression",r=>{if(void 0===Ds(r))return;let n=r.arguments[1];if(!e1(n))return;let o=n.value;if(o.includes("$`")||o.includes("$'"))return;let a=e=>void 0!==Ds(e)&&e1(e.arguments[1])&&e.arguments[1].value===o,{parent:i}=r;if("MemberExpression"===i.type&&i.object===r&&"CallExpression"===i.parent.type&&i.parent.callee===i&&a(i.parent))return;let s=[],l=r;for(;a(l);)s.push(Ds(l)),l=l.callee.object;if(s.length<2)return;let u=l;s.reverse();let p=[...new Set(s)];if(p.some(e=>o.includes(e)))return;let c={node:r,messageId:Do};if(0===t.getCommentsInside(r).length){let t=p.map((e,t)=>(function(e,t,r){if(Di.has(e))return Di.get(e);if("^"===e)return t?String.raw`\^`:"^";if("-"===e)return t||r?"-":String.raw`\-`;let n=e.codePointAt(0);return n<32||127===n?String.raw`\x${n.toString(16).toUpperCase().padStart(2,"0")}`:e})(e,0===t,t===p.length-1)).join(""),o=eZ(u,e),a=eZ(n,e);c.fix=e=>e.replaceText(r,`${o}.replaceAll(/[${t}]/g, ${a})`)}return c})},meta:{type:"suggestion",docs:{description:"Enforce combining multiple single-character replacements into a single `String#replaceAll()` with a regular expression.",recommended:"unopinionated"},fixable:"code",messages:{[Do]:"Combine these single-character replacements into a single `replaceAll()` with a regular expression."},languages:["js/js"]}}}).map(([e,t])=>{let r;return[e,{meta:{schema:[],...t.meta,docs:{...t.meta.docs,url:(r=d.basename(e,".js"),`https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v68.0.0/docs/rules/${r}.md`)}},create:nH(t.create)}]})))};module.exports=Dl;
|