import e from"../../../../../_virtual/index13.mjs";import{__require as r}from"../../utils/blockString.mjs";import{__require as i}from"../../utils/hasEmptyLine.mjs";import{__require as t}from"../../utils/isSingleLineString.mjs";import{__require as n}from"../../utils/namespace.mjs";import{__require as a}from"../../utils/optionsHaveException.mjs";import{__require as s}from"../../utils/optionsHaveIgnored.mjs";import{__require as l}from"../../utils/ruleUrl.mjs";import{__require as o}from"../../utils/validateTypes.mjs";var m,p;function u(){if(p)return m;p=1;const{utils:u}=e,f=r(),c=i(),d=t(),v=n(),b=a(),_=s(),w=l(),{isBoolean:x}=o(),g=v("dollar-variable-empty-line-before"),j=u.ruleMessages(g,{expected:"Expected an empty line before $-variable",rejected:"Unexpected empty line before $-variable"}),y={url:w(g),fixable:!0};function q(e,r,i){return(t,n)=>{if(!u.validateOptions(n,g,{actual:e,possible:["always","never"]},{actual:r,possible:{except:["first-nested","after-comment","after-dollar-variable"],ignore:["after-comment","inside-single-line-block","after-dollar-variable"],disableFix:x},optional:!0}))return;const a=(e,r,i)=>{e.raws.before=e.raws.before.replace(new RegExp(`^${r}`),i)};t.walkDecls(s=>{if(!k(s))return;if(s===t.first)return;if(_(r,"after-comment")&&s.prev()&&"comment"===s.prev().type)return;if(_(r,"inside-single-line-block")&&"root"!==s.parent.type&&d(f(s.parent)))return;if(_(r,"after-dollar-variable")&&s.prev()&&k(s.prev()))return;let l="always"===e;b(r,"first-nested")&&s===s.parent.first&&(l=!l),b(r,"after-comment")&&s.prev()&&"comment"===s.prev().type&&(l=!l),b(r,"after-dollar-variable")&&s.prev()&&k(s.prev())&&(l=!l);const o=s.raws.before;if(l===c(o))return;const m=r&&!0===r.disableFix;u.report({message:l?j.expected:j.rejected,node:s,result:n,ruleName:g,fix:m?void 0:()=>{return l&&!c(o)?(a(s,i.newline,i.newline+i.newline),void(b(r,"first-nested")&&(e=o,!e.includes(i.newline))&&a(s,"\\s+",i.newline+i.newline))):!l&&c(o)?(a(s,"\\n\\r\\n","\r\n"),void a(s,i.newline+i.newline,i.newline)):void 0;var e}})})}}function k(e){return e.prop&&"$"===e.prop[0]}return q.ruleName=g,q.messages=j,q.meta=y,m=q}export{u as __require};