/*
 * Copyright (c) 2018, 2025, Oracle and/or its affiliates.
 * Licensed under The Universal Permissive License (UPL), Version 1.0
 * as shown at https://oss.oracle.com/licenses/upl/
 */
const RULENAME="oj-css-bp-border-color";const DESCRIPTION="Use of CSS 'border' color is discouraged  - use the JET border classes";const SHORT_DESCRIPTION="Use of CSS 'border' color is discouraged  - use the JET border classes";const BORDER_COLOR_PROPS=["border-bottom-color","border-color","border-left-color","border-right-color","border-top-color"];class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(regCtx){this._CssUtils=regCtx.utils.CssUtils;return{"css-rule":this._onRule,"style":this._onStyle}}_onRule(ruleCtx,rule){var block,decl,issue,i;block=rule.block.children;for(i=0;i<block.length;i++){decl=block[i];if(decl.type==="Declaration"&&_isBorderColorProp(decl.property)&&!_isCssVar(decl)){issue=new ruleCtx.Issue(`Use of CSS '${decl.property}' is discouraged - best practices: replace with JET border classes`);issue.setPosition(this._CssUtils.getPosition(ruleCtx,decl.loc));ruleCtx.reporter.addIssue(issue,ruleCtx)}}}_onStyle(ruleCtx,attr,value){var prop,issue,s,x,i;for(i=0;i<value.length;i++){s=value[i];x=s.indexOf(":");if(x>=0){prop=s.substring(0,x).trimEnd();if(BORDER_COLOR_PROPS.includes(prop)){issue=new ruleCtx.Issue(`use of '${prop}' property ('style' attribute) is discouraged - best practices: replace with JET border classes`);issue.setMsgKey(RULENAME+"_1");ruleCtx.reporter.addIssue(issue,ruleCtx)}}}}}function _isBorderColorProp(prop){return BORDER_COLOR_PROPS.includes(prop)};function _isCssVar(decl){var c,v;c=decl.value.children;if(c){v=c[0];return v.name==="var"}return false};module.exports=Rule;