import{getDescription as e}from"./getDescription.mjs";import{isString as t}from"../../utils/validateType.mjs";function r(r){let p={},o=0;return r.forEach(r=>{let a=r;if(o+=1,"rules"===a&&(a={type:"rule"}),"rule"===a.type){p[a.type]||(p[a.type]=[]);let r={expectedPosition:o,description:e(a)};a.selector&&(r.selector=a.selector,t(a.selector)&&(r.selector=new RegExp(a.selector))),p[a.type].push(r)}if("at-rules"===a&&(a={type:"at-rule"}),"at-rule"===a.type){p[a.type]||(p[a.type]=[]);let r={expectedPosition:o,description:e(a)};a.name&&(r.name=a.name),a.parameter&&(r.parameter=a.parameter,t(a.parameter)&&(r.parameter=new RegExp(a.parameter))),void 0!==a.hasBlock&&(r.hasBlock=a.hasBlock),p[a.type].push(r)}t(a)&&(p[a]={expectedPosition:o,description:e(a)})}),p}export{r as createOrderInfo};