const require_runtime = require('../_virtual/_rolldown/runtime.js'); const require_index = require('../utils/index.js'); const require_casing = require('../utils/casing.js'); let node_path = require("node:path"); node_path = require_runtime.__toESM(node_path); //#region lib/rules/no-undef-components.ts /** * @author Yosuke Ota * See LICENSE file in root directory for full license. */ var import_utils = /* @__PURE__ */ require_runtime.__toESM(require_index.default); /** * `casing.camelCase()` converts the beginning to lowercase, * but does not convert the case of the beginning character when converting with Vue3. * @see https://github.com/vuejs/core/blob/ae4b0783d78670b6e942ae2a4e3ec6efbbffa158/packages/shared/src/index.ts#L105 */ function camelize(str) { return str.replaceAll(/-(\w)/g, (_, c) => c ? c.toUpperCase() : ""); } var DefinedInSetupComponents = class { /** * Component names */ names = /* @__PURE__ */ new Set(); addName(...names) { for (const name of names) this.names.add(name); } /** * @see https://github.com/vuejs/core/blob/ae4b0783d78670b6e942ae2a4e3ec6efbbffa158/packages/compiler-core/src/transforms/transformElement.ts#L334 */ isDefinedComponent(rawName) { if (this.names.has(rawName)) return true; const camelName = camelize(rawName); if (this.names.has(camelName)) return true; const pascalName = require_casing.capitalize(camelName); if (this.names.has(pascalName)) return true; const dotIndex = rawName.indexOf("."); if (dotIndex > 0 && this.isDefinedComponent(rawName.slice(0, dotIndex))) return true; return false; } }; var DefinedInOptionComponents = class { /** * Component names */ names = /* @__PURE__ */ new Set(); /** * Component names, transformed to kebab-case */ kebabCaseNames = /* @__PURE__ */ new Set(); addName(...names) { for (const name of names) { this.names.add(name); this.kebabCaseNames.add(require_casing.kebabCase(name)); } } isDefinedComponent(rawName) { if (this.names.has(rawName)) return true; const kebabCaseName = require_casing.kebabCase(rawName); if (this.kebabCaseNames.has(kebabCaseName) && !require_casing.isPascalCase(rawName)) return true; return false; } }; var no_undef_components_default = { meta: { type: "suggestion", docs: { description: "disallow use of undefined components in `