import e from"../../../../../_virtual/index13.mjs";import{__require as r}from"../../../../postcss-value-parser/lib/index.mjs";import{__require as t}from"../../utils/getAtRuleParams.mjs";import{__require as s}from"../../utils/namespace.mjs";import{__require as n}from"../../utils/ruleUrl.mjs";var u,a;function o(){if(a)return u;a=1;const{utils:o}=e,i=r(),l=t(),p=s(),m=n(),c=p("no-duplicate-load-rules"),f=o.ruleMessages(c,{rejected:e=>`Unexpected duplicate load rule ${e}`}),d={url:m(c)};function g(e){return(r,t)=>{if(!o.validateOptions(t,c,{actual:e}))return;const s={},n=new RegExp(/\s+(as|with|show|hide)\s+\(?[^;]*\)?/g);r.walkAtRules(/^(forward|import|use)$/i,e=>{const[r,...u]=i(l("forward"!==e.name?{...e,params:e.params.replace(n,"")}:e)).nodes;if(!r)return;const a="function"===r.type&&"url"===r.value&&r.nodes[0]?r.nodes[0].value:r.value,p=function(e){if(!e.length)return[];const r=" ",t=[],s=[];let n=[];for(const r of e)if("space"!==r.type&&"comment"!==r.type){if(!s.length){if("function"===r.type&&("supports"===r.value||"layer"===r.value)){t.push(h(r));continue}if("word"===r.type&&"layer"===r.value){t.push(h(r));continue}}"div"!==r.type||","!==r.value?n.push(r):(s.push(h(n)),n=[])}n.length&&s.push(h(n));if(s.length&&!t.length)return s;if(!s.length&&t.length)return[t.join(r)];const u=t.join(r);return s.map(e=>u+r+e)}(u),m=e.name.toLowerCase();let d=s[m]?.[a];(p.length?p.some(e=>d&&d.includes(e)):d)?o.report({message:f.rejected,messageArgs:[a],node:e,result:t,ruleName:c,word:e.toString()}):(d||(s[m]||(s[m]={}),d=s[m][a]=[]),d.push(...p))})}}function h(e){return i.stringify(e).replace(/\s/g,"")}return g.ruleName=c,g.messages=f,g.meta=d,u=g}export{o as __require};