/*
 * 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-nav-tab-nointeractive";const HELP="The <template> 'itemTemplate' slot in <oj-tab-bar> and <oj-navigation-list> must not contain interactive tags. "+"That is, content other than <li>, &lt;a>, <div>, &lt;span>, <oj-badge>, text, <oj-bind-text>, <oj-bind-if>, "+"<oj-bind-for-each>, or <oj-if>.";const SHORT_DESCRIPTION="The <template> 'itemTemplate' slot in <oj-tab-bar> and <oj-navigation-list> must not contain interactive tags.";const TEMPLATE="template";const SLOT_ITEMTEMPLATE="itemTemplate";const SLOT="slot";const NODE_TAG="tag";const NODE_TEXT="text";const OK_TAGS=["li","a","div","span","oj-bind-text","oj-badge","oj-bind-if","oj-bind-for-each","oj-if","template"];class Rule{getName(){return RULENAME}getDescription(){return HELP}getShortDescription(){return SHORT_DESCRIPTION}register(){this._okList=new Set(OK_TAGS);this._mismatches=[];return{"<oj-tab-bar>":this._onWComp,"<oj-navigation-list>":this._onWComp}}_onWComp(ruleCtx){var template;if(template=this._getChildTemplate(ruleCtx.tagNode)){this._mismatches.length=0;this._checkNonAcceptableChildren(ruleCtx,template);if(this._mismatches.length){this._emitIssue(ruleCtx)}}}_getChildTemplate(node){var childs,i,child;if((childs=node.children)&&childs.length){for(i=0;i<childs.length;i++){child=childs[i];if(child.type===NODE_TAG){if(child.name===TEMPLATE&&_hasItemTemplateSlot(child)){return child}}}}return null}_checkNonAcceptableChildren(ruleCtx,node){var childs,child,i;if((childs=node.children)&&childs.length){for(i=0;i<childs.length;i++){child=childs[i];if(child.type===NODE_TAG){if(this._okList.has(child.name)){this._checkNonAcceptableChildren(ruleCtx,child);continue}}else if(child.type===NODE_TEXT){continue}if(!this._mismatches.includes(child.name)){this._mismatches.push(child.name)}}}}_emitIssue(ruleCtx){var msg,list,issue;list="('"+this._mismatches.join("', '")+"')";msg=`<${ruleCtx.tagNode.name}> contains interactive content in its <template slot="itemTemplate"> : ${list}`;issue=new ruleCtx.Issue(msg);ruleCtx.reporter.addIssue(issue,ruleCtx)}}function _hasItemTemplateSlot(template){var attribs,attrib;if(attribs=template.attribs){for(attrib in attribs){if(attrib===SLOT&&attribs[attrib]===SLOT_ITEMTEMPLATE){return true}}}return false};module.exports=Rule;