/*
 * 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 RULE_NAME="oj-html-ko-databind";const SHORT="Jet elements should be used in place of Knockout 'data-bind' bindings";const DESCRIPTION="JET elements should be used in place of Knockout 'data-bind' bindings wherever possible.";function getName(){return RULE_NAME};function getShortDescription(){return SHORT};function getDescription(){return DESCRIPTION};function register(){return{"<data-bind=>":_onDataBind}};function _onDataBind(ruleCtx,attrName,attrValue){var aBindings,binding,i,x,suggest;attrValue=attrValue.trim();if(attrValue.length===0){return}attrValue=attrValue.toLowerCase();aBindings=attrValue.split(",");for(i=0;i<aBindings.length;i++){binding=aBindings[i].trim();x=binding.indexOf(":");if(x<0){continue}binding=binding.substring(0,x).trim();suggest=_getSuggested(binding);if(suggest){let issue=new ruleCtx.Issue("Knockout data-bind \""+binding+":\" binding found. Use of JET "+suggest+" recommended.");ruleCtx.reporter.addIssue(issue,ruleCtx)}}};function _getSuggested(binding){var suggest;if(binding==="foreach"){suggest="<oj-bind-for-each>"}else if(binding==="if"||binding==="ifnot"){suggest="<oj-if>"}else if(binding==="text"){suggest="<oj-bind-text>"}else if(binding==="css"){suggest=":class binding"}return suggest};module.exports={getName,getDescription,getShortDescription,register};