import e from"../../../stylelint/lib/index.mjs";import t from"../../../../_virtual/sortNode.mjs";import{checkOrder as i}from"./checkOrder.mjs";import{getOrderData as o}from"./getOrderData.mjs";import{ruleName as r}from"./ruleName.mjs";import{messages as n}from"./messages.mjs";function s({node:s,orderInfo:m,primaryOption:d,result:p,unspecified:c}){let f=!1;function l(t){let d=[];s.each(function(s){if("comment"===s.type)return;let f=o(m,s),l={node:s,description:f.description,expectedPosition:f.expectedPosition};d.push(l);let u=d.at(-2);if(!u)return;let a=u;if(!u.expectedPosition){let e=d.slice(0,-1).reverse().find(e=>Boolean(e.expectedPosition));e&&(a=e)}i({firstNodeData:a,secondNodeData:l,unspecified:c})||e.utils.report({message:n.expected(l.description,a.description),node:s,result:p,ruleName:r,fix:t})})}l(function(){if(f)return;t(s,d),f=!0,l()})}export{s as checkNode};