import*as e from"../../../../css-tree/lib/index.mjs";import r from"../../../../mdn-data/css/syntaxes.json.mjs";import t from"../../../../../_virtual/is-plain-object.mjs";import{__require as i}from"../../utils/typeGuards.mjs";import{__require as s}from"../../utils/declarationValueIndex.mjs";import{__require as n}from"../../utils/getDeclarationValue.mjs";import{__require as o}from"../../utils/isCustomPropertySet.mjs";import{__require as a}from"../../utils/isStandardSyntaxDeclaration.mjs";import{__require as u}from"../../utils/isStandardSyntaxProperty.mjs";import{__require as l}from"../../utils/isStandardSyntaxValue.mjs";import{__require as m}from"../../utils/matchesStringOrRegExp.mjs";import{__require as p}from"../../utils/atKeywords.mjs";import{__require as c}from"../../utils/validateObjectWithArrayProps.mjs";import f from"../../../../../_virtual/index13.mjs";import{__require as d}from"../../utils/validateTypes.mjs";import{__require as _}from"../../utils/sassValueParser/index.mjs";import{__require as y}from"../../utils/parseFunctionArguments.mjs";import{__require as x}from"../../utils/namespace.mjs";import{__require as g}from"../../utils/ruleUrl.mjs";var j,h;function v(){if(h)return j;h=1;const v=e,b=r,q=t,S=i(),w=s(),A=n(),P=o(),$=a(),k=u(),D=l(),O=m(),F=p(),M=c(),{utils:V}=f,{isFunctionCall:z}=d(),C=_(),{parseFunctionArguments:E}=y(),{isDollarVar:I,isIfStatement:N,isNestedProperty:R}=d(),Z=x(),B=g(),K=Z("declaration-property-value-no-unknown"),L=V.ruleMessages(K,{rejected:(e,r)=>`Unexpected unknown value "${r}" for property "${e}"`,rejectedParseError:(e,r)=>`Cannot parse property value "${r}" for property "${e}"`}),U={url:B(K)},G=/^syntax$/i;function T(e){for(const r of E(e)){if(z(r.value))return T(r.value);if(I(r.value))return!0}return!1}const W=["clamp","min","max","env"],H=["+","/","-","*","%"];function J(e,r){return(t,i)=>{if(!V.validateOptions(i,K,{actual:e},{actual:r,possible:{ignoreProperties:[M],propertiesSyntax:[q.isPlainObject],typesSyntax:[q.isPlainObject]},optional:!0}))return;const s=Array.from(Object.entries(r?.ignoreProperties??{})),n={"text-box-edge":"auto | [ text | cap | ex | ideographic | ideographic-ink ] [ text | alphabetic | ideographic | ideographic-ink ]?","text-box-trim":"none | trim-start | trim-end | trim-both","view-timeline":"[ <'view-timeline-name'> [ <'view-timeline-axis'> || <'view-timeline-inset'> ]? ]#",...r?.propertiesSyntax},o={"rgba()":"| rgba( <hex-color> , <alpha-value>? )",...r?.typesSyntax},a=new Map;t.walkAtRules("function",e=>{var r;W.push((r=e.params,[...r.matchAll(/(?:\s*([\w\-$]+)\s*)?\(/g)].flat())[1])}),t.walkAtRules(/^property$/i,e=>{const r=e.params.trim();if(r&&e.nodes&&P(r))for(const t of e.nodes)if(S.isDeclaration(t)&&G.test(t.prop)){const e=t.value.trim(),i=v.string.decode(e);if(i===e)continue;if("*"===i)continue;const s=`-stylelint${r}`;a.set(r,s),n[s]=i}});const u=v.fork({properties:n,types:o}).lexer;t.walkDecls(e=>{let{prop:r}=e;const{parent:t}=e,n=A(e).replace(/\n+\s+/," ");if(t.selector&&R(t.selector)||"decl"===t.type){let i=t,s=i.selector?i.selector.split(" ")?.filter(e=>":"===e[e.length-1])[0]:t.prop;for(r=String(e.prop);s&&"--"!==s.substring(0,2);)r=s.replace(":","")+"-"+r,i=i.parent,s=i.selector?i.selector.split(" ").filter(e=>":"===e[e.length-1])[0]:i.prop}if(/^-moz-initial$/i.test(n))return;if(!$(e))return;if(!k(r))return;if(!D(n))return;if(P(r)&&!a.has(r))return;if(((e,r)=>{const[,t]=s.find(([r])=>O(e,r))||[];return t&&O(r,t)})(r,n))return;if(n.match(/\$[A-Za-z0-9_-]+/)?.some(I))return;if(n.split(" ").some(e=>T(e)))return;if(n.split(" ").some(e=>Q(e)))return;let o;try{if(o=v.parse(n,{context:"value",positions:!0}),Q(o))return;if(l=o,Boolean(v.find(l,e=>"Function"===e.type&&["clamp","min","max","env"].includes(e.name))))return}catch(t){const s=w(e),o=s+n.length;if(N(n))return;if(T(n))return;const a=C({string:n}).map(e=>e.symbol);for(const e of a)if(H.includes(e))return;return void V.report({message:L.rejectedParseError(r,n),node:e,index:s,endIndex:o,result:i,ruleName:K})}var l;const{error:m}=t&&S.isAtRule(t)&&!F.nestingSupportedAtKeywords.has(t.name.toLowerCase())?u.matchAtruleDescriptor(t.name,r,o):u.matchProperty(a.get(r)??r,o);if(!m)return;if(!("mismatchLength"in m))return;const{name:p,rawMessage:c,loc:f}=m;if("SyntaxMatchError"!==p)return;if("Mismatch"!==c)return;const d=w(e),_=n.slice(f.start.offset,f.end.offset),y=C({string:n}).map(e=>e.symbol);for(const e of y)if(H.includes(e))return;V.report({message:L.rejected(r,_),node:e,index:d+f.start.offset,endIndex:d+f.end.offset,result:i,ruleName:K})})}}function Q(e){return Boolean(/[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+\(.*\)/g.test(e)||v.find(e,e=>"Function"===e.type&&(W.includes(e.name)||!b[e.name+"()"])))}return J.ruleName=K,J.messages=L,J.meta=U,j=J}export{v as __require};