{"version":3,"file":"util.get-declaration-position.mjs","sources":["../../../../../src/rules/css/grouped-declarations/util.get-declaration-position.ts"],"sourcesContent":["import type { TSESTree } from \"@typescript-eslint/utils\";\nimport type { Declaration } from \"postcss\";\n\n/**\n * Consolidates postcss node position into an eslint compatible position,\n * taking the entire source file into account\n */\nexport function getDeclarationPosition(\n  node: TSESTree.Node,\n  declaration: Declaration | undefined,\n  optionalEndDeclaration?: Declaration | undefined,\n): Readonly<TSESTree.SourceLocation> | undefined {\n  const startDeclaration = declaration;\n  const endDeclaration = optionalEndDeclaration ?? declaration;\n\n  if (!startDeclaration?.source?.start || !endDeclaration?.source?.end) {\n    return;\n  }\n\n  const loc = {\n    start: {\n      column: startDeclaration.source.start.column - 1,\n      line: node.loc.start.line - 1 + startDeclaration.source.start.line,\n    },\n    end: {\n      column: endDeclaration.source.end.column - 1,\n      line: node.loc.start.line - 1 + endDeclaration.source.end.line,\n    },\n  };\n\n  return loc;\n}\n"],"names":[],"mappings":"AAOO,SAAS,sBAAA,CACd,IAAA,EACA,WAAA,EACA,sBAAA,EAC+C;AAC/C,EAAA,MAAM,gBAAA,GAAmB,WAAA;AACzB,EAAA,MAAM,iBAAiB,sBAAA,IAA0B,WAAA;AAEjD,EAAA,IAAI,CAAC,gBAAA,EAAkB,MAAA,EAAQ,SAAS,CAAC,cAAA,EAAgB,QAAQ,GAAA,EAAK;AACpE,IAAA;AAAA,EACF;AAEA,EAAA,MAAM,GAAA,GAAM;AAAA,IACV,KAAA,EAAO;AAAA,MACL,MAAA,EAAQ,gBAAA,CAAiB,MAAA,CAAO,KAAA,CAAM,MAAA,GAAS,CAAA;AAAA,MAC/C,IAAA,EAAM,KAAK,GAAA,CAAI,KAAA,CAAM,OAAO,CAAA,GAAI,gBAAA,CAAiB,OAAO,KAAA,CAAM;AAAA,KAChE;AAAA,IACA,GAAA,EAAK;AAAA,MACH,MAAA,EAAQ,cAAA,CAAe,MAAA,CAAO,GAAA,CAAI,MAAA,GAAS,CAAA;AAAA,MAC3C,IAAA,EAAM,KAAK,GAAA,CAAI,KAAA,CAAM,OAAO,CAAA,GAAI,cAAA,CAAe,OAAO,GAAA,CAAI;AAAA;AAC5D,GACF;AAEA,EAAA,OAAO,GAAA;AACT;;;;"}