import e from"../../utils/getRuleSelector.mjs";import t from"../../utils/isStandardSyntaxRule.mjs";import s from"../../utils/isValidIdentifier.mjs";import r from"../../utils/parseSelector.mjs";import l from"../../utils/report.mjs";import o from"../../utils/ruleMessages.mjs";import u from"../../utils/validateOptions.mjs";const a="selector-attribute-quotes",i=o(a,{expected:e=>`Expected quotes around "${e}"`,rejected:e=>`Unexpected quotes around "${e}"`}),n=o=>(n,m)=>{u(m,a,{actual:o,possible:["always","never"]})&&n.walkRules(u=>{if(!t(u))return;const{selector:n}=u;if(!n.includes("[")||!n.includes("="))return;const c=r(e(u),m,u);if(!c)return;const d=(e,t)=>{const s=t.sourceIndex+t.offsetOf("value"),r=t.value||"",o=s+(t.raws.value??r).length;l({message:i[e],messageArgs:[r],index:s,endIndex:o,result:m,ruleName:a,node:u,fix:{apply:()=>{const s="expected"===e?'"':null;t.quoteMark=s,u.selector=c.toString()},node:u}})};c.walkAttributes(e=>{const{operator:t,value:r,quoted:l}=e;if(t&&r&&(l||"always"!==o||d("expected",e),l&&"never"===o)){if(!e.raws.value||!s(e.raws.value.slice(1,-1)))return;d("rejected",e)}})})};n.ruleName=a,n.messages=i,n.meta={url:"https://stylelint.io/user-guide/rules/selector-attribute-quotes",fixable:!0};export{n as default};