import{isAtRule as e,isRule as t,isRoot as r}from"../../utils/typeGuards.mjs";import i from"../../utils/blockString.mjs";import s from"../../utils/fixEmptyLinesBefore.mjs";import o from"../../utils/hasEmptyLine.mjs";import n from"../../utils/isAfterComment.mjs";import m from"../../utils/isAfterStandardPropertyDeclaration.mjs";import a from"../../utils/isCustomProperty.mjs";import l from"../../utils/isFirstNested.mjs";import f from"../../utils/isFirstNodeOfRoot.mjs";import p from"../../utils/isSingleLineString.mjs";import u from"../../utils/isStandardSyntaxDeclaration.mjs";import c from"../../utils/optionsMatches.mjs";import d from"../../utils/report.mjs";import j from"../../utils/ruleMessages.mjs";import g from"../../utils/validateOptions.mjs";const y="declaration-empty-line-before",x=j(y,{expected:"Expected empty line before declaration",rejected:"Unexpected empty line before declaration"}),b=(j,b,w)=>(S,k)=>{g(k,y,{actual:j,possible:["always","never"]},{actual:b,possible:{except:["first-nested","after-comment","after-declaration"],ignore:["after-comment","after-declaration","first-nested","inside-single-line-block"]},optional:!0})&&S.walkDecls(g=>{const S=g.prop,N=g.parent;if(null==N)return;if(f(g))return;if(!e(N)&&!t(N)&&!r(N))return;if(!u(g))return;if(a(S))return;if(c(b,"ignore","after-comment")&&n(g))return;if(c(b,"ignore","after-declaration")&&m(g))return;if(c(b,"ignore","first-nested")&&l(g))return;if(c(b,"ignore","inside-single-line-block")&&p(i(N)))return;let h="always"===j;(c(b,"except","first-nested")&&l(g)||c(b,"except","after-comment")&&n(g)||c(b,"except","after-declaration")&&m(g))&&(h=!h);if(h===o(g.raws.before))return;const v=h?x.expected:x.rejected,A=h?"add":"remove";d({message:v,messageArgs:[],node:g,result:k,ruleName:y,fix:{apply:()=>s({node:g,newline:w.newline,action:A}),node:g.parent}})})};b.ruleName=y,b.messages=x,b.meta={url:"https://stylelint.io/user-guide/rules/declaration-empty-line-before",fixable:!0};export{b as default};