UNPKG

vue-eslint-parser

Version:

The ESLint custom parser for `.vue` files.

1 lines 672 kB
{"version":3,"file":"index.cjs","names":["Evk","debug","escope","dependencyEspree","espree","DUMMY_PARENT","parseScript","getTagName","SVG_TAGS","DUMMY_PARENT","cursors.forward","cursors.backward","EventEmitter","parseScriptBase","services.define","HTMLTokenizer","HTMLParser","parseScript"],"sources":["../src/ast/errors.ts","../src/ast/nodes.ts","../src/ast/traverse.ts","../src/ast/index.ts","../src/utils/utils.ts","../src/common/lines-and-columns.ts","../src/common/location-calculator.ts","../src/common/debug.ts","../src/common/ast-utils.ts","../src/common/parser-object.ts","../src/common/parser-options.ts","../src/common/eslint-scope.ts","../src/common/espree.ts","../src/script-setup/parser-options.ts","../src/script/scope-analyzer.ts","../src/common/fix-locations.ts","../src/script/generic.ts","../src/script/index.ts","../src/common/token-utils.ts","../src/common/error-utils.ts","../src/template/index.ts","../src/html/util/attribute-names.ts","../src/html/util/tag-names.ts","../src/html/intermediate-tokenizer.ts","../src/html/parser.ts","../src/html/util/alternative-cr.ts","../src/html/util/entities.ts","../src/html/util/unicode.ts","../src/html/tokenizer.ts","../src/utils/memoize.ts","../src/external/node-event-generator.ts","../src/external/token-store/utils.ts","../src/external/token-store/cursors/cursor.ts","../src/external/token-store/cursors/backward-token-comment-cursor.ts","../src/external/token-store/cursors/backward-token-cursor.ts","../src/external/token-store/cursors/decorative-cursor.ts","../src/external/token-store/cursors/filter-cursor.ts","../src/external/token-store/cursors/forward-token-comment-cursor.ts","../src/external/token-store/cursors/forward-token-cursor.ts","../src/external/token-store/cursors/limit-cursor.ts","../src/external/token-store/cursors/skip-cursor.ts","../src/external/token-store/cursors/index.ts","../src/external/token-store/cursors/padded-token-cursor.ts","../src/external/token-store/index.ts","../src/sfc/custom-block/index.ts","../src/parser-services.ts","../src/script-setup/index.ts","../src/style/tokenizer.ts","../src/style/index.ts","../src/script-setup/scope-analyzer.ts","../package.json","../src/index.ts"],"sourcesContent":["/**\n * @author Toru Nagashima <https://github.com/mysticatea>\n * @copyright 2017 Toru Nagashima. All rights reserved.\n * See LICENSE file in root directory for full license.\n */\nimport type { Location } from \"./locations\"\n\n/**\n * Check whether the given value has acorn style location information.\n * @param x The value to check.\n * @returns `true` if the value has acorn style location information.\n */\nfunction isAcornStyleParseError(\n x: any,\n): x is { message: string; pos: number; loc: Location } {\n return (\n typeof x.message === \"string\" &&\n typeof x.pos === \"number\" &&\n typeof x.loc === \"object\" &&\n x.loc !== null &&\n typeof x.loc.line === \"number\" &&\n typeof x.loc.column === \"number\"\n )\n}\n\n/**\n * Check whether the given value is probably a TSError.\n * @param x The value to check.\n * @returns `true` if the given value is probably a TSError.\n */\nfunction isTSError(\n x: any,\n): x is { message: string; index: number; lineNumber: number; column: number } {\n return (\n !(x instanceof ParseError) &&\n typeof x.message === \"string\" &&\n typeof x.index === \"number\" &&\n typeof x.lineNumber === \"number\" &&\n typeof x.column === \"number\" &&\n x.name === \"TSError\"\n )\n}\n\n/**\n * HTML parse errors.\n */\nexport class ParseError extends SyntaxError {\n public code?: ErrorCode\n public index: number\n public lineNumber: number\n public column: number\n\n /**\n * Create new parser error object.\n * @param code The error code. See also: https://html.spec.whatwg.org/multipage/parsing.html#parse-errors\n * @param offset The offset number of this error.\n * @param line The line number of this error.\n * @param column The column number of this error.\n */\n public static fromCode(\n code: ErrorCode,\n offset: number,\n line: number,\n column: number,\n ): ParseError {\n return new ParseError(code, code, offset, line, column)\n }\n\n /**\n * Normalize the error object.\n * @param x The error object to normalize.\n */\n public static normalize(x: any): ParseError | null {\n if (isTSError(x)) {\n return new ParseError(\n x.message,\n undefined,\n x.index,\n x.lineNumber,\n x.column,\n )\n }\n if (ParseError.isParseError(x)) {\n return x\n }\n if (isAcornStyleParseError(x)) {\n return new ParseError(\n x.message,\n undefined,\n x.pos,\n x.loc.line,\n x.loc.column,\n )\n }\n return null\n }\n\n /**\n * Initialize this ParseError instance.\n * @param message The error message.\n * @param code The error code. See also: https://html.spec.whatwg.org/multipage/parsing.html#parse-errors\n * @param offset The offset number of this error.\n * @param line The line number of this error.\n * @param column The column number of this error.\n */\n public constructor(\n message: string,\n code: ErrorCode | undefined,\n offset: number,\n line: number,\n column: number,\n ) {\n super(message)\n this.code = code\n this.index = offset\n this.lineNumber = line\n this.column = column\n }\n\n /**\n * Type guard for ParseError.\n * @param x The value to check.\n * @returns `true` if the value has `message`, `pos`, `loc` properties.\n */\n public static isParseError(x: any): x is ParseError {\n return (\n x instanceof ParseError ||\n (typeof x.message === \"string\" &&\n typeof x.index === \"number\" &&\n typeof x.lineNumber === \"number\" &&\n typeof x.column === \"number\")\n )\n }\n}\n\n/**\n * The error codes of HTML syntax errors.\n * https://html.spec.whatwg.org/multipage/parsing.html#parse-errors\n */\nexport type ErrorCode =\n | \"abrupt-closing-of-empty-comment\"\n | \"absence-of-digits-in-numeric-character-reference\"\n | \"cdata-in-html-content\"\n | \"character-reference-outside-unicode-range\"\n | \"control-character-in-input-stream\"\n | \"control-character-reference\"\n | \"eof-before-tag-name\"\n | \"eof-in-cdata\"\n | \"eof-in-comment\"\n | \"eof-in-tag\"\n | \"incorrectly-closed-comment\"\n | \"incorrectly-opened-comment\"\n | \"invalid-first-character-of-tag-name\"\n | \"missing-attribute-value\"\n | \"missing-end-tag-name\"\n | \"missing-semicolon-after-character-reference\"\n | \"missing-whitespace-between-attributes\"\n | \"nested-comment\"\n | \"noncharacter-character-reference\"\n | \"noncharacter-in-input-stream\"\n | \"null-character-reference\"\n | \"surrogate-character-reference\"\n | \"surrogate-in-input-stream\"\n | \"unexpected-character-in-attribute-name\"\n | \"unexpected-character-in-unquoted-attribute-value\"\n | \"unexpected-equals-sign-before-attribute-name\"\n | \"unexpected-null-character\"\n | \"unexpected-question-mark-instead-of-tag-name\"\n | \"unexpected-solidus-in-tag\"\n | \"unknown-named-character-reference\"\n | \"end-tag-with-attributes\"\n | \"duplicate-attribute\"\n | \"end-tag-with-trailing-solidus\"\n | \"non-void-html-element-start-tag-with-trailing-solidus\"\n | \"x-invalid-end-tag\"\n | \"x-invalid-namespace\"\n | \"x-missing-interpolation-end\"\n// ---- Use RAWTEXT state for <script> elements instead ----\n// \"eof-in-script-html-comment-like-text\" |\n// ---- Use BOGUS_COMMENT state for DOCTYPEs instead ----\n// \"abrupt-doctype-public-identifier\" |\n// \"abrupt-doctype-system-identifier\" |\n// \"eof-in-doctype\" |\n// \"invalid-character-sequence-after-doctype-name\" |\n// \"missing-doctype-name\" |\n// \"missing-doctype-public-identifier\" |\n// \"missing-doctype-system-identifier\" |\n// \"missing-quote-before-doctype-public-identifier\" |\n// \"missing-quote-before-doctype-system-identifier\" |\n// \"missing-whitespace-after-doctype-public-keyword\" |\n// \"missing-whitespace-after-doctype-system-keyword\" |\n// \"missing-whitespace-before-doctype-name\" |\n// \"missing-whitespace-between-doctype-public-and-system-identifiers\" |\n// \"unexpected-character-after-doctype-system-identifier\" |\n","/**\n * @author Toru Nagashima <https://github.com/mysticatea>\n * @copyright 2017 Toru Nagashima. All rights reserved.\n * See LICENSE file in root directory for full license.\n */\nimport type { ScopeManager } from \"eslint-scope\"\nimport type { ParseError } from \"./errors\"\nimport type { HasLocation } from \"./locations\"\nimport type { Token } from \"./tokens\"\nimport type { TSESTree } from \"@typescript-eslint/utils\"\nimport type { ParserServices } from \"../parser-services\"\n\n//------------------------------------------------------------------------------\n// Common\n//------------------------------------------------------------------------------\n\n/**\n * Objects which have their parent.\n */\nexport interface HasParent {\n parent?: Node | null\n}\n\n/**\n * The union type for all nodes.\n */\nexport type Node =\n | ESLintNode\n | VNode\n | VForExpression\n | VOnExpression\n | VSlotScopeExpression\n | VGenericExpression\n | VFilterSequenceExpression\n | VFilter\n\n//------------------------------------------------------------------------------\n// Script\n//------------------------------------------------------------------------------\n\n/**\n * The union type for ESLint nodes.\n */\nexport type ESLintNode =\n | ESLintIdentifier\n | ESLintLiteral\n | ESLintProgram\n | ESLintSwitchCase\n | ESLintCatchClause\n | ESLintVariableDeclarator\n | ESLintStatement\n | ESLintExpression\n | ESLintProperty\n | ESLintAssignmentProperty\n | ESLintSuper\n | ESLintTemplateElement\n | ESLintSpreadElement\n | ESLintPattern\n | ESLintClassBody\n | ESLintMethodDefinition\n | ESLintPropertyDefinition\n | ESLintStaticBlock\n | ESLintPrivateIdentifier\n | ESLintModuleDeclaration\n | ESLintModuleSpecifier\n | ESLintImportExpression\n | ESLintLegacyRestProperty\n\n/**\n * The parsing result of ESLint custom parsers.\n */\nexport interface ESLintExtendedProgram {\n ast: ESLintProgram\n services?: ParserServices\n visitorKeys?: { [type: string]: string[] }\n scopeManager?: ScopeManager\n}\n\nexport interface ESLintProgram extends HasLocation, HasParent {\n type: \"Program\"\n sourceType: \"script\" | \"module\"\n body: (ESLintStatement | ESLintModuleDeclaration)[]\n templateBody?: VElement & HasConcreteInfo\n tokens?: Token[]\n comments?: Token[]\n errors?: ParseError[]\n}\n\nexport type ESLintStatement =\n | ESLintExpressionStatement\n | ESLintBlockStatement\n | ESLintEmptyStatement\n | ESLintDebuggerStatement\n | ESLintWithStatement\n | ESLintReturnStatement\n | ESLintLabeledStatement\n | ESLintBreakStatement\n | ESLintContinueStatement\n | ESLintIfStatement\n | ESLintSwitchStatement\n | ESLintThrowStatement\n | ESLintTryStatement\n | ESLintWhileStatement\n | ESLintDoWhileStatement\n | ESLintForStatement\n | ESLintForInStatement\n | ESLintForOfStatement\n | ESLintDeclaration\n\nexport interface ESLintEmptyStatement extends HasLocation, HasParent {\n type: \"EmptyStatement\"\n}\n\nexport interface ESLintBlockStatement extends HasLocation, HasParent {\n type: \"BlockStatement\"\n body: ESLintStatement[]\n}\n\nexport interface ESLintExpressionStatement extends HasLocation, HasParent {\n type: \"ExpressionStatement\"\n expression: ESLintExpression\n}\n\nexport interface ESLintIfStatement extends HasLocation, HasParent {\n type: \"IfStatement\"\n test: ESLintExpression\n consequent: ESLintStatement\n alternate: ESLintStatement | null\n}\n\nexport interface ESLintSwitchStatement extends HasLocation, HasParent {\n type: \"SwitchStatement\"\n discriminant: ESLintExpression\n cases: ESLintSwitchCase[]\n}\n\nexport interface ESLintSwitchCase extends HasLocation, HasParent {\n type: \"SwitchCase\"\n test: ESLintExpression | null\n consequent: ESLintStatement[]\n}\n\nexport interface ESLintWhileStatement extends HasLocation, HasParent {\n type: \"WhileStatement\"\n test: ESLintExpression\n body: ESLintStatement\n}\n\nexport interface ESLintDoWhileStatement extends HasLocation, HasParent {\n type: \"DoWhileStatement\"\n body: ESLintStatement\n test: ESLintExpression\n}\n\nexport interface ESLintForStatement extends HasLocation, HasParent {\n type: \"ForStatement\"\n init: ESLintVariableDeclaration | ESLintExpression | null\n test: ESLintExpression | null\n update: ESLintExpression | null\n body: ESLintStatement\n}\n\nexport interface ESLintForInStatement extends HasLocation, HasParent {\n type: \"ForInStatement\"\n left: ESLintVariableDeclaration | ESLintPattern\n right: ESLintExpression\n body: ESLintStatement\n}\n\nexport interface ESLintForOfStatement extends HasLocation, HasParent {\n type: \"ForOfStatement\"\n left: ESLintVariableDeclaration | ESLintPattern\n right: ESLintExpression\n body: ESLintStatement\n await: boolean\n}\n\nexport interface ESLintLabeledStatement extends HasLocation, HasParent {\n type: \"LabeledStatement\"\n label: ESLintIdentifier\n body: ESLintStatement\n}\n\nexport interface ESLintBreakStatement extends HasLocation, HasParent {\n type: \"BreakStatement\"\n label: ESLintIdentifier | null\n}\n\nexport interface ESLintContinueStatement extends HasLocation, HasParent {\n type: \"ContinueStatement\"\n label: ESLintIdentifier | null\n}\n\nexport interface ESLintReturnStatement extends HasLocation, HasParent {\n type: \"ReturnStatement\"\n argument: ESLintExpression | null\n}\n\nexport interface ESLintThrowStatement extends HasLocation, HasParent {\n type: \"ThrowStatement\"\n argument: ESLintExpression\n}\n\nexport interface ESLintTryStatement extends HasLocation, HasParent {\n type: \"TryStatement\"\n block: ESLintBlockStatement\n handler: ESLintCatchClause | null\n finalizer: ESLintBlockStatement | null\n}\n\nexport interface ESLintCatchClause extends HasLocation, HasParent {\n type: \"CatchClause\"\n param: ESLintPattern | null\n body: ESLintBlockStatement\n}\n\nexport interface ESLintWithStatement extends HasLocation, HasParent {\n type: \"WithStatement\"\n object: ESLintExpression\n body: ESLintStatement\n}\n\nexport interface ESLintDebuggerStatement extends HasLocation, HasParent {\n type: \"DebuggerStatement\"\n}\n\nexport type ESLintDeclaration =\n | ESLintFunctionDeclaration\n | ESLintVariableDeclaration\n | ESLintClassDeclaration\n\nexport interface ESLintFunctionDeclaration extends HasLocation, HasParent {\n type: \"FunctionDeclaration\"\n async: boolean\n generator: boolean\n id: ESLintIdentifier | null\n params: ESLintPattern[]\n body: ESLintBlockStatement\n}\n\nexport interface ESLintVariableDeclaration extends HasLocation, HasParent {\n type: \"VariableDeclaration\"\n kind: \"var\" | \"let\" | \"const\"\n declarations: ESLintVariableDeclarator[]\n}\n\nexport interface ESLintVariableDeclarator extends HasLocation, HasParent {\n type: \"VariableDeclarator\"\n id: ESLintPattern\n init: ESLintExpression | null\n}\n\nexport interface ESLintClassDeclaration extends HasLocation, HasParent {\n type: \"ClassDeclaration\"\n id: ESLintIdentifier | null\n superClass: ESLintExpression | null\n body: ESLintClassBody\n}\n\nexport interface ESLintClassBody extends HasLocation, HasParent {\n type: \"ClassBody\"\n body: (\n | ESLintMethodDefinition\n | ESLintPropertyDefinition\n | ESLintStaticBlock\n )[]\n}\n\nexport interface ESLintMethodDefinition extends HasLocation, HasParent {\n type: \"MethodDefinition\"\n kind: \"constructor\" | \"method\" | \"get\" | \"set\"\n computed: boolean\n static: boolean\n key: ESLintExpression | ESLintPrivateIdentifier\n value: ESLintFunctionExpression\n}\nexport interface ESLintPropertyDefinition extends HasLocation, HasParent {\n type: \"PropertyDefinition\"\n computed: boolean\n static: boolean\n key: ESLintExpression | ESLintPrivateIdentifier\n value: ESLintExpression | null\n}\n\nexport interface ESLintStaticBlock\n extends HasLocation, HasParent, Omit<ESLintBlockStatement, \"type\"> {\n type: \"StaticBlock\"\n body: ESLintStatement[]\n}\n\nexport interface ESLintPrivateIdentifier extends HasLocation, HasParent {\n type: \"PrivateIdentifier\"\n name: string\n}\n\nexport type ESLintModuleDeclaration =\n | ESLintImportDeclaration\n | ESLintExportNamedDeclaration\n | ESLintExportDefaultDeclaration\n | ESLintExportAllDeclaration\n\nexport type ESLintModuleSpecifier =\n | ESLintImportSpecifier\n | ESLintImportDefaultSpecifier\n | ESLintImportNamespaceSpecifier\n | ESLintExportSpecifier\n\nexport interface ESLintImportDeclaration extends HasLocation, HasParent {\n type: \"ImportDeclaration\"\n specifiers: (\n | ESLintImportSpecifier\n | ESLintImportDefaultSpecifier\n | ESLintImportNamespaceSpecifier\n )[]\n source: ESLintLiteral\n}\n\nexport interface ESLintImportSpecifier extends HasLocation, HasParent {\n type: \"ImportSpecifier\"\n imported: ESLintIdentifier | ESLintStringLiteral\n local: ESLintIdentifier\n}\n\nexport interface ESLintImportDefaultSpecifier extends HasLocation, HasParent {\n type: \"ImportDefaultSpecifier\"\n local: ESLintIdentifier\n}\n\nexport interface ESLintImportNamespaceSpecifier extends HasLocation, HasParent {\n type: \"ImportNamespaceSpecifier\"\n local: ESLintIdentifier\n}\n\nexport interface ESLintImportExpression extends HasLocation, HasParent {\n type: \"ImportExpression\"\n source: ESLintExpression\n}\n\nexport interface ESLintExportNamedDeclaration extends HasLocation, HasParent {\n type: \"ExportNamedDeclaration\"\n declaration?: ESLintDeclaration | null\n specifiers: ESLintExportSpecifier[]\n source?: ESLintLiteral | null\n}\n\nexport interface ESLintExportSpecifier extends HasLocation, HasParent {\n type: \"ExportSpecifier\"\n local: ESLintIdentifier | ESLintStringLiteral\n exported: ESLintIdentifier | ESLintStringLiteral\n}\n\nexport interface ESLintExportDefaultDeclaration extends HasLocation, HasParent {\n type: \"ExportDefaultDeclaration\"\n declaration: ESLintDeclaration | ESLintExpression\n}\n\nexport interface ESLintExportAllDeclaration extends HasLocation, HasParent {\n type: \"ExportAllDeclaration\"\n exported: ESLintIdentifier | ESLintStringLiteral | null\n source: ESLintLiteral\n}\n\nexport type ESLintExpression =\n | ESLintThisExpression\n | ESLintArrayExpression\n | ESLintObjectExpression\n | ESLintFunctionExpression\n | ESLintArrowFunctionExpression\n | ESLintYieldExpression\n | ESLintLiteral\n | ESLintUnaryExpression\n | ESLintUpdateExpression\n | ESLintBinaryExpression\n | ESLintAssignmentExpression\n | ESLintLogicalExpression\n | ESLintMemberExpression\n | ESLintConditionalExpression\n | ESLintCallExpression\n | ESLintNewExpression\n | ESLintSequenceExpression\n | ESLintTemplateLiteral\n | ESLintTaggedTemplateExpression\n | ESLintClassExpression\n | ESLintMetaProperty\n | ESLintIdentifier\n | ESLintAwaitExpression\n | ESLintChainExpression\n\nexport interface ESLintIdentifier extends HasLocation, HasParent {\n type: \"Identifier\"\n name: string\n}\ninterface ESLintLiteralBase extends HasLocation, HasParent {\n type: \"Literal\"\n value: string | boolean | null | number | RegExp | bigint\n raw: string\n regex?: {\n pattern: string\n flags: string\n }\n bigint?: string\n}\nexport interface ESLintStringLiteral extends ESLintLiteralBase {\n value: string\n regex?: undefined\n bigint?: undefined\n}\nexport interface ESLintBooleanLiteral extends ESLintLiteralBase {\n value: boolean\n regex?: undefined\n bigint?: undefined\n}\nexport interface ESLintNullLiteral extends ESLintLiteralBase {\n value: null\n regex?: undefined\n bigint?: undefined\n}\nexport interface ESLintNumberLiteral extends ESLintLiteralBase {\n value: number\n regex?: undefined\n bigint?: undefined\n}\nexport interface ESLintRegExpLiteral extends ESLintLiteralBase {\n value: null | RegExp\n regex: {\n pattern: string\n flags: string\n }\n bigint?: undefined\n}\nexport interface ESLintBigIntLiteral extends ESLintLiteralBase {\n value: null | bigint\n regex?: undefined\n bigint: string\n}\nexport type ESLintLiteral =\n | ESLintStringLiteral\n | ESLintBooleanLiteral\n | ESLintNullLiteral\n | ESLintNumberLiteral\n | ESLintRegExpLiteral\n | ESLintBigIntLiteral\n\nexport interface ESLintThisExpression extends HasLocation, HasParent {\n type: \"ThisExpression\"\n}\n\nexport interface ESLintArrayExpression extends HasLocation, HasParent {\n type: \"ArrayExpression\"\n elements: (ESLintExpression | ESLintSpreadElement)[]\n}\n\nexport interface ESLintObjectExpression extends HasLocation, HasParent {\n type: \"ObjectExpression\"\n properties: (\n | ESLintProperty\n | ESLintSpreadElement\n | ESLintLegacySpreadProperty\n )[]\n}\n\nexport interface ESLintProperty extends HasLocation, HasParent {\n type: \"Property\"\n kind: \"init\" | \"get\" | \"set\"\n method: boolean\n shorthand: boolean\n computed: boolean\n key: ESLintExpression\n value: ESLintExpression | ESLintPattern\n}\n\nexport interface ESLintFunctionExpression extends HasLocation, HasParent {\n type: \"FunctionExpression\"\n async: boolean\n generator: boolean\n id: ESLintIdentifier | null\n params: ESLintPattern[]\n body: ESLintBlockStatement\n}\n\nexport interface ESLintArrowFunctionExpression extends HasLocation, HasParent {\n type: \"ArrowFunctionExpression\"\n async: boolean\n generator: boolean\n id: ESLintIdentifier | null\n params: ESLintPattern[]\n body: ESLintBlockStatement | ESLintExpression\n}\n\nexport interface ESLintSequenceExpression extends HasLocation, HasParent {\n type: \"SequenceExpression\"\n expressions: ESLintExpression[]\n}\n\nexport interface ESLintUnaryExpression extends HasLocation, HasParent {\n type: \"UnaryExpression\"\n operator: \"-\" | \"+\" | \"!\" | \"~\" | \"typeof\" | \"void\" | \"delete\"\n prefix: boolean\n argument: ESLintExpression\n}\n\nexport interface ESLintBinaryExpression extends HasLocation, HasParent {\n type: \"BinaryExpression\"\n operator:\n | \"==\"\n | \"!=\"\n | \"===\"\n | \"!==\"\n | \"<\"\n | \"<=\"\n | \">\"\n | \">=\"\n | \"<<\"\n | \">>\"\n | \">>>\"\n | \"+\"\n | \"-\"\n | \"*\"\n | \"/\"\n | \"%\"\n | \"**\"\n | \"|\"\n | \"^\"\n | \"&\"\n | \"in\"\n | \"instanceof\"\n left: ESLintExpression | ESLintPrivateIdentifier\n right: ESLintExpression\n}\n\nexport interface ESLintAssignmentExpression extends HasLocation, HasParent {\n type: \"AssignmentExpression\"\n operator:\n | \"=\"\n | \"+=\"\n | \"-=\"\n | \"*=\"\n | \"/=\"\n | \"%=\"\n | \"**=\"\n | \"<<=\"\n | \">>=\"\n | \">>>=\"\n | \"|=\"\n | \"^=\"\n | \"&=\"\n | \"||=\"\n | \"&&=\"\n | \"??=\"\n left: ESLintPattern\n right: ESLintExpression\n}\n\nexport interface ESLintUpdateExpression extends HasLocation, HasParent {\n type: \"UpdateExpression\"\n operator: \"++\" | \"--\"\n argument: ESLintExpression\n prefix: boolean\n}\n\nexport interface ESLintLogicalExpression extends HasLocation, HasParent {\n type: \"LogicalExpression\"\n operator: \"||\" | \"&&\" | \"??\"\n left: ESLintExpression\n right: ESLintExpression\n}\n\nexport interface ESLintConditionalExpression extends HasLocation, HasParent {\n type: \"ConditionalExpression\"\n test: ESLintExpression\n alternate: ESLintExpression\n consequent: ESLintExpression\n}\n\nexport interface ESLintCallExpression extends HasLocation, HasParent {\n type: \"CallExpression\"\n optional: boolean\n callee: ESLintExpression | ESLintSuper\n arguments: (ESLintExpression | ESLintSpreadElement)[]\n}\n\nexport interface ESLintSuper extends HasLocation, HasParent {\n type: \"Super\"\n}\n\nexport interface ESLintNewExpression extends HasLocation, HasParent {\n type: \"NewExpression\"\n callee: ESLintExpression\n arguments: (ESLintExpression | ESLintSpreadElement)[]\n}\n\nexport interface ESLintMemberExpression extends HasLocation, HasParent {\n type: \"MemberExpression\"\n optional: boolean\n computed: boolean\n object: ESLintExpression | ESLintSuper\n property: ESLintExpression | ESLintPrivateIdentifier\n}\n\nexport interface ESLintYieldExpression extends HasLocation, HasParent {\n type: \"YieldExpression\"\n delegate: boolean\n argument: ESLintExpression | null\n}\n\nexport interface ESLintAwaitExpression extends HasLocation, HasParent {\n type: \"AwaitExpression\"\n argument: ESLintExpression\n}\n\nexport interface ESLintTemplateLiteral extends HasLocation, HasParent {\n type: \"TemplateLiteral\"\n quasis: ESLintTemplateElement[]\n expressions: ESLintExpression[]\n}\n\nexport interface ESLintTaggedTemplateExpression extends HasLocation, HasParent {\n type: \"TaggedTemplateExpression\"\n tag: ESLintExpression\n quasi: ESLintTemplateLiteral\n}\n\nexport interface ESLintTemplateElement extends HasLocation, HasParent {\n type: \"TemplateElement\"\n tail: boolean\n value: {\n cooked: string | null\n raw: string\n }\n}\n\nexport interface ESLintClassExpression extends HasLocation, HasParent {\n type: \"ClassExpression\"\n id: ESLintIdentifier | null\n superClass: ESLintExpression | null\n body: ESLintClassBody\n}\n\nexport interface ESLintMetaProperty extends HasLocation, HasParent {\n type: \"MetaProperty\"\n meta: ESLintIdentifier\n property: ESLintIdentifier\n}\n\nexport type ESLintPattern =\n | ESLintIdentifier\n | ESLintObjectPattern\n | ESLintArrayPattern\n | ESLintRestElement\n | ESLintAssignmentPattern\n | ESLintMemberExpression\n | ESLintLegacyRestProperty\n\nexport interface ESLintObjectPattern extends HasLocation, HasParent {\n type: \"ObjectPattern\"\n properties: (\n | ESLintAssignmentProperty\n | ESLintRestElement\n | ESLintLegacyRestProperty\n )[]\n}\n\nexport interface ESLintAssignmentProperty extends ESLintProperty {\n value: ESLintPattern\n kind: \"init\"\n method: false\n}\n\nexport interface ESLintArrayPattern extends HasLocation, HasParent {\n type: \"ArrayPattern\"\n elements: ESLintPattern[]\n}\n\nexport interface ESLintRestElement extends HasLocation, HasParent {\n type: \"RestElement\"\n argument: ESLintPattern\n}\n\nexport interface ESLintSpreadElement extends HasLocation, HasParent {\n type: \"SpreadElement\"\n argument: ESLintExpression\n}\n\nexport interface ESLintAssignmentPattern extends HasLocation, HasParent {\n type: \"AssignmentPattern\"\n left: ESLintPattern\n right: ESLintExpression\n}\n\nexport type ESLintChainElement = ESLintCallExpression | ESLintMemberExpression\n\nexport interface ESLintChainExpression extends HasLocation, HasParent {\n type: \"ChainExpression\"\n expression: ESLintChainElement\n}\n\n/**\n * Legacy for babel-eslint and espree.\n */\nexport interface ESLintLegacyRestProperty extends HasLocation, HasParent {\n type: \"RestProperty\" | \"ExperimentalRestProperty\"\n argument: ESLintPattern\n}\n\n/**\n * Legacy for babel-eslint and espree.\n */\nexport interface ESLintLegacySpreadProperty extends HasLocation, HasParent {\n type: \"SpreadProperty\" | \"ExperimentalSpreadProperty\"\n argument: ESLintExpression\n}\n\n//------------------------------------------------------------------------------\n// Template\n//------------------------------------------------------------------------------\n\n/**\n * Constants of namespaces.\n * @see https://infra.spec.whatwg.org/#namespaces\n */\nexport const NS = Object.freeze({\n HTML: \"http://www.w3.org/1999/xhtml\" as \"http://www.w3.org/1999/xhtml\",\n MathML: \"http://www.w3.org/1998/Math/MathML\" as \"http://www.w3.org/1998/Math/MathML\",\n SVG: \"http://www.w3.org/2000/svg\" as \"http://www.w3.org/2000/svg\",\n XLink: \"http://www.w3.org/1999/xlink\" as \"http://www.w3.org/1999/xlink\",\n XML: \"http://www.w3.org/XML/1998/namespace\" as \"http://www.w3.org/XML/1998/namespace\",\n XMLNS: \"http://www.w3.org/2000/xmlns/\" as \"http://www.w3.org/2000/xmlns/\",\n})\n\n/**\n * Type of namespaces.\n */\nexport type Namespace =\n | typeof NS.HTML\n | typeof NS.MathML\n | typeof NS.SVG\n | typeof NS.XLink\n | typeof NS.XML\n | typeof NS.XMLNS\n\n/**\n * Type of variable definitions.\n */\nexport interface Variable {\n id: ESLintIdentifier\n kind: \"v-for\" | \"scope\" | \"generic\"\n references: Reference[]\n}\n\n/**\n * Type of variable references.\n */\nexport interface Reference {\n id: ESLintIdentifier\n mode: \"rw\" | \"r\" | \"w\"\n variable: Variable | null\n\n // For typescript-eslint\n isValueReference?: boolean\n isTypeReference?: boolean\n}\n\n/**\n * The node of `v-for` directives.\n */\nexport interface VForExpression extends HasLocation, HasParent {\n type: \"VForExpression\"\n parent: VExpressionContainer\n left: ESLintPattern[]\n right: ESLintExpression\n}\n\n/**\n * The node of `v-on` directives.\n */\nexport interface VOnExpression extends HasLocation, HasParent {\n type: \"VOnExpression\"\n parent: VExpressionContainer\n body: ESLintStatement[]\n}\n\n/**\n * The node of `slot-scope` directives.\n */\nexport interface VSlotScopeExpression extends HasLocation, HasParent {\n type: \"VSlotScopeExpression\"\n parent: VExpressionContainer\n params: ESLintPattern[]\n}\n\n/**\n * The node of `generic` directives.\n */\nexport interface VGenericExpression extends HasLocation, HasParent {\n type: \"VGenericExpression\"\n parent: VExpressionContainer\n params: TSESTree.TSTypeParameterDeclaration[\"params\"]\n rawParams: string[]\n}\n\n/**\n * The node of a filter sequence which is separated by `|`.\n */\nexport interface VFilterSequenceExpression extends HasLocation, HasParent {\n type: \"VFilterSequenceExpression\"\n parent: VExpressionContainer\n expression: ESLintExpression\n filters: VFilter[]\n}\n\n/**\n * The node of a filter sequence which is separated by `|`.\n */\nexport interface VFilter extends HasLocation, HasParent {\n type: \"VFilter\"\n parent: VFilterSequenceExpression\n callee: ESLintIdentifier\n arguments: (ESLintExpression | ESLintSpreadElement)[]\n}\n\n/**\n * The union type of any nodes.\n */\nexport type VNode =\n | VAttribute\n | VDirective\n | VDirectiveKey\n | VDocumentFragment\n | VElement\n | VEndTag\n | VExpressionContainer\n | VIdentifier\n | VLiteral\n | VStartTag\n | VText\n\n/**\n * Text nodes.\n */\nexport interface VText extends HasLocation, HasParent {\n type: \"VText\"\n parent: VDocumentFragment | VElement\n value: string\n}\n\n/**\n * The node of JavaScript expression in text.\n * e.g. `{{ name }}`\n */\nexport interface VExpressionContainer extends HasLocation, HasParent {\n type: \"VExpressionContainer\"\n parent: VDocumentFragment | VElement | VDirective | VDirectiveKey\n expression:\n | ESLintExpression\n | VFilterSequenceExpression\n | VForExpression\n | VOnExpression\n | VSlotScopeExpression\n | VGenericExpression\n | null\n references: Reference[]\n}\n\n/**\n * Attribute name nodes.\n */\nexport interface VIdentifier extends HasLocation, HasParent {\n type: \"VIdentifier\"\n parent: VAttribute | VDirectiveKey\n name: string\n rawName: string\n}\n\n/**\n * Attribute name nodes.\n */\nexport interface VDirectiveKey extends HasLocation, HasParent {\n type: \"VDirectiveKey\"\n parent: VDirective\n name: VIdentifier\n argument: VExpressionContainer | VIdentifier | null\n modifiers: VIdentifier[]\n}\n\n/**\n * Attribute value nodes.\n */\nexport interface VLiteral extends HasLocation, HasParent {\n type: \"VLiteral\"\n parent: VAttribute\n value: string\n}\n\n/**\n * Static attribute nodes.\n */\nexport interface VAttribute extends HasLocation, HasParent {\n type: \"VAttribute\"\n parent: VStartTag\n directive: false\n key: VIdentifier\n value: VLiteral | null\n}\n\n/**\n * Directive nodes.\n */\nexport interface VDirective extends HasLocation, HasParent {\n type: \"VAttribute\"\n parent: VStartTag\n directive: true\n key: VDirectiveKey\n value: VExpressionContainer | null\n}\n\n/**\n * Start tag nodes.\n */\nexport interface VStartTag extends HasLocation, HasParent {\n type: \"VStartTag\"\n parent: VElement\n selfClosing: boolean\n attributes: (VAttribute | VDirective)[]\n}\n\n/**\n * End tag nodes.\n */\nexport interface VEndTag extends HasLocation, HasParent {\n type: \"VEndTag\"\n parent: VElement\n}\n\n/**\n * The property which has concrete information.\n */\nexport interface HasConcreteInfo {\n tokens: Token[]\n comments: Token[]\n errors: ParseError[]\n}\n\n/**\n * Element nodes.\n */\nexport interface VElement extends HasLocation, HasParent {\n type: \"VElement\"\n parent: VDocumentFragment | VElement\n namespace: Namespace\n name: string\n rawName: string\n startTag: VStartTag\n children: (VElement | VText | VExpressionContainer)[]\n endTag: VEndTag | null\n variables: Variable[]\n}\n\n/**\n * Root nodes.\n */\nexport interface VDocumentFragment\n extends HasLocation, HasParent, HasConcreteInfo {\n type: \"VDocumentFragment\"\n parent: null\n children: (VElement | VText | VExpressionContainer | VStyleElement)[]\n}\n\n/**\n * Style element nodes.\n */\nexport interface VStyleElement extends VElement {\n type: \"VElement\"\n name: \"style\"\n style: true\n children: (VText | VExpressionContainer)[]\n}\n","/**\n * @author Toru Nagashima <https://github.com/mysticatea>\n * @copyright 2017 Toru Nagashima. All rights reserved.\n * See LICENSE file in root directory for full license.\n */\nimport type { VisitorKeys } from \"eslint-visitor-keys\"\nimport * as Evk from \"eslint-visitor-keys\"\nimport type { Node } from \"./nodes\"\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\nexport const KEYS = Evk.unionWith({\n VAttribute: [\"key\", \"value\"],\n VDirectiveKey: [\"name\", \"argument\", \"modifiers\"],\n VDocumentFragment: [\"children\"],\n VElement: [\"startTag\", \"children\", \"endTag\"],\n VEndTag: [],\n VExpressionContainer: [\"expression\"],\n VFilter: [\"callee\", \"arguments\"],\n VFilterSequenceExpression: [\"expression\", \"filters\"],\n VForExpression: [\"left\", \"right\"],\n VIdentifier: [],\n VLiteral: [],\n VOnExpression: [\"body\"],\n VSlotScopeExpression: [\"params\"],\n VStartTag: [\"attributes\"],\n VText: [],\n VGenericExpression: [\"params\"],\n})\n\n/**\n * Check that the given key should be traversed or not.\n * @param key The key to check.\n * @param value The value of the key in the node.\n * @returns `true` if the key should be traversed.\n */\nfunction fallbackKeysFilter(key: string, value: any = null): boolean {\n return (\n key !== \"comments\" &&\n key !== \"leadingComments\" &&\n key !== \"loc\" &&\n key !== \"parent\" &&\n key !== \"range\" &&\n key !== \"tokens\" &&\n key !== \"trailingComments\" &&\n value !== null &&\n typeof value === \"object\" &&\n (typeof value.type === \"string\" || Array.isArray(value))\n )\n}\n\n/**\n * Get the keys of the given node to traverse it.\n * @param node The node to get.\n * @returns The keys to traverse.\n */\nexport function getFallbackKeys(node: Node): string[] {\n return Object.keys(node).filter((key) =>\n fallbackKeysFilter(key, node[key as keyof Node]),\n )\n}\n\n/**\n * Check wheather a given value is a node.\n * @param x The value to check.\n * @returns `true` if the value is a node.\n */\nfunction isNode(x: any): x is Node {\n return x !== null && typeof x === \"object\" && typeof x.type === \"string\"\n}\n\n/**\n * Traverse the given node.\n * @param node The node to traverse.\n * @param parent The parent node.\n * @param visitor The node visitor.\n */\nfunction traverse(node: Node, parent: Node | null, visitor: Visitor): void {\n let i = 0\n let j = 0\n\n visitor.enterNode(node, parent)\n\n const keys =\n (visitor.visitorKeys ?? KEYS)[node.type] ?? getFallbackKeys(node)\n for (i = 0; i < keys.length; ++i) {\n const child = (node as any)[keys[i]]\n\n if (Array.isArray(child)) {\n for (j = 0; j < child.length; ++j) {\n if (isNode(child[j])) {\n traverse(child[j], node, visitor)\n }\n }\n } else if (isNode(child)) {\n traverse(child, node, visitor)\n }\n }\n\n visitor.leaveNode(node, parent)\n}\n\n//------------------------------------------------------------------------------\n// Exports\n//------------------------------------------------------------------------------\n\nexport interface Visitor {\n visitorKeys?: VisitorKeys\n enterNode(node: Node, parent: Node | null): void\n leaveNode(node: Node, parent: Node | null): void\n}\n\n/**\n * Traverse the given AST tree.\n * @param node Root node to traverse.\n * @param visitor Visitor.\n */\nexport function traverseNodes(node: Node, visitor: Visitor): void {\n traverse(node, null, visitor)\n}\n","/**\n * @author Toru Nagashima <https://github.com/mysticatea>\n * @copyright 2017 Toru Nagashima. All rights reserved.\n * See LICENSE file in root directory for full license.\n */\n\nexport * from \"./errors\"\nexport * from \"./locations\"\nexport * from \"./nodes\"\nexport * from \"./tokens\"\nexport * from \"./traverse\"\n","/**\n * @see https://github.com/vuejs/vue-next/blob/48de8a42b7fed7a03f7f1ff5d53d6a704252cafe/packages/shared/src/index.ts#L109\n */\nexport function camelize(str: string) {\n return str.replace(/-(\\w)/gu, (_, c) => (c ? c.toUpperCase() : \"\"))\n}\n\n/**\n * A binary search implementation that finds the index at which `predicate`\n * stops returning `true` and starts returning `false` (consistently) when run\n * on the items of the array. It **assumes** that mapping the array via the\n * predicate results in the shape `[...true[], ...false[]]`. *For any other case\n * the result is unpredictable*.\n *\n * This is the base implementation of the `sortedIndex` functions which define\n * the predicate for the user, for common use-cases.\n *\n * It is similar to `findIndex`, but runs at O(logN), whereas the latter is\n * general purpose function which runs on any array and predicate, but runs at\n * O(N) time.\n *\n * MIT License | Copyright (c) 2018 remeda | https://remedajs.com/\n *\n * The implementation is copied from remeda package:\n * https://github.com/remeda/remeda/blob/df5fe74841c07bc356bbaa2c89bc7ba0cafafd0a/packages/remeda/src/internal/binarySearchCutoffIndex.ts#L15\n */\nfunction binarySearchCutoffIndex<T>(\n array: readonly T[],\n predicate: (value: T, index: number, data: readonly T[]) => boolean,\n): number {\n let lowIndex = 0\n let highIndex = array.length\n\n while (lowIndex < highIndex) {\n const pivotIndex = (lowIndex + highIndex) >>> 1\n const pivot = array[pivotIndex]\n\n if (predicate(pivot, pivotIndex, array)) {\n lowIndex = pivotIndex + 1\n } else {\n highIndex = pivotIndex\n }\n }\n\n return highIndex\n}\n\n/**\n * Find the insertion position (index) of an item in an array with items sorted\n * in ascending order; so that `splice(sortedIndex, 0, item)` would result in\n * maintaining the array's sort-ness. The array can contain duplicates.\n * If the item already exists in the array the index would be of the *last*\n * occurrence of the item.\n *\n * Runs in O(logN) time.\n *\n * @param item - The item to insert.\n * @returns Insertion index (In the range 0..data.length).\n * @signature\n * R.sortedLastIndex(item)(data)\n * @example\n * R.pipe(['a','a','b','c','c'], sortedLastIndex('c')) // => 5\n *\n * MIT License | Copyright (c) 2018 remeda | https://remedajs.com/\n *\n * The implementation is copied from remeda package:\n * https://github.com/remeda/remeda/blob/df5fe74841c07bc356bbaa2c89bc7ba0cafafd0a/packages/remeda/src/sortedLastIndex.ts#L51\n */\nexport function sortedLastIndex<T>(array: readonly T[], item: T): number {\n return binarySearchCutoffIndex(array, (pivot) => pivot <= item)\n}\n\n/**\n * Find the insertion position (index) of an item in an array with items sorted\n * in ascending order using a value function; so that\n * `splice(sortedIndex, 0, item)` would result in maintaining the arrays sort-\n * ness. The array can contain duplicates.\n * If the item already exists in the array the index would be of the *first*\n * occurrence of the item.\n *\n * Runs in O(logN) time.\n *\n * See also:\n * * `findIndex` - scans a possibly unsorted array in-order (linear search).\n * * `sortedIndex` - like this function, but doesn't take a callbackfn.\n * * `sortedLastIndexBy` - like this function, but finds the last suitable index.\n * * `sortedLastIndex` - like `sortedIndex`, but finds the last suitable index.\n * * `rankBy` - scans a possibly unsorted array in-order, returning the index based on a sorting criteria.\n *\n * @param data - The (ascending) sorted array.\n * @param item - The item to insert.\n * @param valueFunction - All comparisons would be performed on the result of\n * calling this function on each compared item. Preferably this function should\n * return a `number` or `string`. This function should be the same as the one\n * provided to sortBy to sort the array. The function is called exactly once on\n * each items that is compared against in the array, and once at the beginning\n * on `item`. When called on `item` the `index` argument is `undefined`.\n * @returns Insertion index (In the range 0..data.length).\n * @signature\n * R.sortedIndexBy(data, item, valueFunction)\n * @example\n * R.sortedIndexBy([{age:20},{age:22}],{age:21},prop('age')) // => 1\n *\n * MIT License | Copyright (c) 2018 remeda | https://remedajs.com/\n *\n * The implementation is copied from remeda package:\n * https://github.com/remeda/remeda/blob/df5fe74841c07bc356bbaa2c89bc7ba0cafafd0a/packages/remeda/src/sortedIndexBy.ts#L37\n */\nexport function sortedIndexBy<T>(\n array: readonly T[],\n item: T,\n valueFunction: (\n item: T,\n index: number | undefined,\n data: readonly T[],\n ) => number,\n): number {\n const value = valueFunction(item, undefined, array)\n\n return binarySearchCutoffIndex(\n array,\n (pivot, index) => valueFunction(pivot, index, array) < value,\n )\n}\n\n/**\n * Find the insertion position (index) of an item in an array with items sorted\n * in ascending order using a value function; so that\n * `splice(sortedIndex, 0, item)` would result in maintaining the arrays sort-\n * ness. The array can contain duplicates.\n * If the item already exists in the array the index would be of the *last*\n * occurrence of the item.\n *\n * Runs in O(logN) time.\n *\n * See also:\n * * `findIndex` - scans a possibly unsorted array in-order (linear search).\n * * `sortedLastIndex` - a simplified version of this function, without a callbackfn.\n * * `sortedIndexBy` - like this function, but returns the first suitable index.\n * * `sortedIndex` - like `sortedLastIndex` but without a callbackfn.\n * * `rankBy` - scans a possibly unsorted array in-order, returning the index based on a sorting criteria.\n *\n * @param data - The (ascending) sorted array.\n * @param item - The item to insert.\n * @param valueFunction - All comparisons would be performed on the result of\n * calling this function on each compared item. Preferably this function should\n * return a `number` or `string`. This function should be the same as the one\n * provided to sortBy to sort the array. The function is called exactly once on\n * each items that is compared against in the array, and once at the beginning\n * on `item`. When called on `item` the `index` argument is `undefined`.\n * @returns Insertion index (In the range 0..data.length).\n * @signature\n * R.sortedLastIndexBy(data, item, valueFunction)\n * @example\n * R.sortedLastIndexBy([{age:20},{age:22}],{age:21},prop('age')) // => 1\n *\n * MIT License | Copyright (c) 2018 remeda | https://remedajs.com/\n *\n * The implementation is copied from remeda package:\n * https://github.com/remeda/remeda/blob/df5fe74841c07bc356bbaa2c89bc7ba0cafafd0a/packages/remeda/src/sortedLastIndexBy.ts#L37\n */\nexport function sortedLastIndexBy<T>(\n array: readonly T[],\n item: T,\n valueFunction: (\n item: T,\n index: number | undefined,\n data: readonly T[],\n ) => number,\n): number {\n const value = valueFunction(item, undefined, array)\n\n return binarySearchCutoffIndex(\n array,\n (pivot, index) => valueFunction(pivot, index, array) <= value,\n )\n}\n\n/**\n * Creates a duplicate-free version of an array.\n *\n * This function takes an array and returns a new array containing only the unique values\n * from the original array, preserving the order of first occurrence.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array to process.\n * @returns {T[]} A new array with only unique values from the original array.\n *\n * @example\n * const array = [1, 2, 2, 3, 4, 4, 5];\n * const result = uniq(array);\n * // result will be [1, 2, 3, 4, 5]\n *\n * MIT © Viva Republica, Inc. | https://es-toolkit.dev/\n *\n * The implementation is copied from es-toolkit package:\n * https://github.com/toss/es-toolkit/blob/16709839f131269b84cdd96e9645df52648ccedf/src/array/uniq.ts#L16\n */\nexport function uniq<T>(arr: readonly T[]): T[] {\n return Array.from(new Set(arr))\n}\n\n/**\n * Returns the intersection of multiple arrays.\n *\n * This function takes multiple arrays and returns a new array containing the elements that are\n * present in all provided arrays. It effectively filters out any elements that are not found\n * in every array.\n *\n * @template T - The type of elements in the arrays.\n * @param {...(ArrayLike<T> | null | undefined)} arrays - The arrays to compare.\n * @returns {T[]} A new array containing the elements that are present in all arrays.\n *\n * @example\n * const array1 = [1, 2, 3, 4, 5];\n * const array2 = [3, 4, 5, 6, 7];\n * const result = intersection(array1, array2);\n * // result will be [3, 4, 5] since these elements are in both arrays.\n *\n * MIT © Viva Republica, Inc. | https://es-toolkit.dev/\n *\n * The implementation is copied from es-toolkit package:\n * https://github.com/toss/es-toolkit/blob/16709839f131269b84cdd96e9645df52648ccedf/src/compat/array/intersection.ts#L22\n * https://github.com/toss/es-toolkit/blob/16709839f131269b84cdd96e9645df52648ccedf/src/array/intersection.ts#L19\n */\nexport function intersection<T>(...arrays: (T[] | null | undefined)[]): T[] {\n if (arrays.length === 0) {\n return []\n }\n\n let result: T[] = uniq(arrays[0]!)\n\n for (let i = 1; i < arrays.length; i++) {\n const array = arrays[i]\n const secondSet = new Set(array)\n\n result = result.filter((item) => secondSet.has(item))\n }\n\n return result\n}\n\n/**\n * This function takes multiple arrays and returns a new array containing only the unique values\n * from all input arrays, preserving the order of their first occurrence.\n *\n * @template T - The type of elements in the arrays.\n * @param {Array<ArrayLike<T> | null | undefined>} arrays - The arrays to inspect.\n * @returns {T[]} Returns the new array of combined unique values.\n *\n * @example\n * // Returns [2, 1]\n * union([2], [1, 2]);\n *\n * @example\n * // Returns [2, 1, 3]\n * union([2], [1, 2], [2, 3]);\n *\n * @example\n * // Returns [1, 3, 2, [5], [4]] (does not deeply flatten nested arrays)\n * union([1, 3, 2], [1, [5]], [2, [4]]);\n *\n * @example\n * // Returns [0, 2, 1] (ignores non-array values like 3 and { '0': 1 })\n * union([0], 3, { '0': 1 }, null, [2, 1]);\n * @example\n * // Returns [0, 'a', 2, 1] (treats array-like object { 0: 'a', length: 1 } as a valid array)\n * union([0], { 0: 'a', length: 1 }, [2, 1]);\n *\n * MIT © Viva Republica, Inc. | https://es-toolkit.