/*
 * 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="ojc-html-button-defslot";const DESCRIPTION="There is no default slot for <oj-c-button>.  If it has been used to label the button, "+"the 'label' attribute should be used.";const SHORT_DESCRIPTION="There is no default slot for <oj-c-button>.";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(){return{"<oj-c-button>":this._onBtn}}_onBtn(ruleCtx){let nodes;if((nodes=ruleCtx.tagNode.children)&&nodes.length){for(let node of nodes){if(node.type==="tag"){if(!ruleCtx.utils.DomUtils.getAttribValue(node,"slot")){this._emitIssue(ruleCtx,1);return}}else if(node.type==="text"&&node.data.trim().length){this._emitIssue(ruleCtx,2);return}}}}_emitIssue(ruleCtx,msgType){let msg=msgType===1?"<oj-c-button> cannot use the default slot.":"<oj-c-button> cannot use the default slot as a label. Use the 'label' attribute.";let issue=new ruleCtx.Issue(msg);if(msgType===2){issue.setMsgKey(RULENAME+"_1")}ruleCtx.reporter.addIssue(issue,ruleCtx)}}module.exports=Rule;