import e from"../../../../../_virtual/index19.mjs";import{atRuleRegexes as t}from"../../utils/regexes.mjs";import r from"../../utils/getAtRuleParams.mjs";import s from"../../utils/isUrlFunction.mjs";import u from"../../utils/report.mjs";import o from"../../utils/ruleMessages.mjs";import i from"../../utils/validateOptions.mjs";const n="no-duplicate-at-import-rules",l=o(n,{rejected:e=>`Unexpected duplicate @import rule ${e}`}),m=o=>(m,a)=>{if(!i(a,n,{actual:o}))return;const c={};m.walkAtRules(t.importName,t=>{const[o,...i]=e(r(t)).nodes;if(!o)return;const m=s(o)&&o.nodes[0]?o.nodes[0].value:o.value,f=function(e){if(!e.length)return[];const t=" ",r=[],s=[];let u=[];for(const t of e)if("space"!==t.type&&"comment"!==t.type){if(!s.length){if("function"===t.type&&("supports"===t.value||"layer"===t.value)){r.push(p(t));continue}if("word"===t.type&&"layer"===t.value){r.push(p(t));continue}}"div"!==t.type||","!==t.value?u.push(t):(s.push(p(u)),u=[])}u.length&&s.push(p(u));if(s.length&&!r.length)return s;if(!s.length&&r.length)return[r.join(t)];const o=r.join(t);return s.map(e=>o+t+e)}(i);let g=c[m];(f.length?f.some(e=>g&&g.includes(e)):g)?u({message:l.rejected,messageArgs:[m],node:t,result:a,ruleName:n,word:t.toString()}):(g||(g=c[m]=[]),g.push(...f))})};function p(t){return e.stringify(t).replace(/\s/g,"")}m.ruleName=n,m.messages=l,m.meta={url:"https://stylelint.io/user-guide/rules/no-duplicate-at-import-rules"};export{m as default};