/*
 * Copyright (c) 2018, 2026, 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-html-btn-display-icon";const DESCRIPTION="If a legacy <oj-button> does not specify a 'label' attribute, and its default slot is not used, "+"it should specify attribute 'display=\"icons\"'.";const SHORT_DESCRIPTION="<oj-button> and no 'label' and no use of default slot requires '\"display=\"icons\"'.";const ISSUE_MSG="<oj-button> with no 'label' and an unused default slot requires 'display=\"icons\"'.";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(){return{"<oj-button>":this._onLegacyBtn}}_onLegacyBtn(ruleCtx){var node=ruleCtx.tagNode;if(!this._hasAttrib(node,"label")){if(!this._usesDefaultSlot(node)){if(!(this._hasAttrib(node,"display")==="icons")){ruleCtx.reporter.addIssue(new ruleCtx.Issue(ISSUE_MSG),ruleCtx)}}}}_usesDefaultSlot(node){var childs,child,i,ret=false;if(childs=node.children){for(i=0;i<childs.length;i++){child=childs[i];if(child.type==="tag"||child.type==="text"&&child.data.trim().length!==0){ret=true;break}}}return ret}_hasAttrib(node,name){var val;return node.attribs&&(val=node.attribs[name])?val:null}}module.exports=Rule;