import e from"../../../stylelint/lib/index.mjs";import{isString as r}from"../../utils/validateType.mjs";import{addEmptyLineBefore as o}from"./addEmptyLineBefore.mjs";import{hasEmptyLineBefore as t}from"./hasEmptyLineBefore.mjs";import{removeEmptyLinesBefore as n}from"./removeEmptyLinesBefore.mjs";import{ruleName as i}from"./ruleName.mjs";import{messages as m}from"./messages.mjs";function a({firstPropData:a,secondPropData:s,propsCount:p,lastKnownSeparatedGroup:d,context:l,emptyLineBeforeUnspecified:f,emptyLineMinimumPropertyThreshold:u,primaryOption:y,result:B}){let L=Boolean(a.orderData),j=Boolean(s.orderData),D=L?a.orderData.separatedGroup:d,c=j?s.orderData.separatedGroup:d,h=L&&!j;if(j&&D!==c||h){let a=y.filter(e=>!r(e)),d=a[c-2]&&a[c-2].emptyLineBefore;h&&(d=f);let L=p<u,j="threshold"===d&&L;"always"!==d&&!("threshold"===d&&!L)||t(s.node)?("never"===d||j)&&t(s.node)&&e.utils.report({message:m.rejectedEmptyLineBefore(s.name),node:s.node,result:B,ruleName:i,fix:()=>{n(s.node,l.newline)}}):e.utils.report({message:m.expectedEmptyLineBefore(s.name),node:s.node,result:B,ruleName:i,fix:()=>{o(s.node,l.newline)}})}L&&j&&a.orderData.groupPosition===s.orderData.groupPosition&&s.orderData.noEmptyLineBeforeInsideGroup&&t(s.node)&&e.utils.report({message:m.rejectedEmptyLineBefore(s.name),node:s.node,result:B,ruleName:i,fix:()=>{n(s.node,l.newline)}})}export{a as checkEmptyLineBefore};