import e from"../../../../../_virtual/index19.mjs";import{declarationValueIndex as t}from"../../utils/nodeFieldIndices.mjs";import r from"../../utils/getDeclarationValue.mjs";import n from"../../utils/isStandardSyntaxValue.mjs";import s from"../../utils/report.mjs";import i from"../../utils/ruleMessages.mjs";import o from"../../utils/setDeclarationValue.mjs";import u from"../../utils/validateOptions.mjs";const l="hue-degree-notation",a=i(l,{expected:(e,t)=>`Expected "${e}" to be "${t}"`}),m=["hsl","hsla","hwb"],d=["lch","oklch"],c=new Set([...m,...d]),f=new RegExp(`\\b(?:${[...c].join("|")})\\(`,"i"),p=i=>(p,g)=>{u(g,l,{actual:i,possible:["angle","number"]})&&p.walkDecls(u=>{if(!f.test(u.value))return;const p=e(r(u));p.walk(r=>{if("function"!==r.type)return;const f=r.value.toLowerCase();if(!c.has(f))return;const x=function(e){const t=e.nodes.filter(({type:e})=>"word"===e||"function"===e),r=e.value.toLowerCase();if(m.includes(r))return t[0];if(d.includes(r))return t[2];return}(r);if(!x)return;const{value:b}=x;if(!n(b))return;const h=e.unit(b);if(!h)return;const j="deg"===h.unit.toLowerCase(),w=""===h.unit;if(!j&&!w)return;if("angle"===i&&j)return;if("number"===i&&w)return;const v="angle"===i?`${h.number}deg`:h.number,y=b,I=t(u);s({message:a.expected,messageArgs:[y,v],node:u,index:I+x.sourceIndex,endIndex:I+x.sourceEndIndex,result:g,ruleName:l,fix:{apply:()=>{x.value=v,o(u,p.toString())},node:u}})})})};p.ruleName=l,p.messages=a,p.meta={url:"https://stylelint.io/user-guide/rules/hue-degree-notation",fixable:!0};export{p as default};