/*
 * 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 PREFIX=["jet","jaf","ojc","jetvdom","vdom","jetwc","jetwco","csp","wdt","spoc"];const RP_PREFIX=["ojc","jetvdom","vdom","csp","jetwc","jetwco","spoc","wdt"];const RULES_JSON="rules.json";var _rDir;var _rpDir;function getPackMetadata(nd,appCtx){var prefix,o,i;var _packs={};_init(nd,appCtx);for(i=0;i<PREFIX.length;i++){prefix=PREFIX[i];if(o=_loadRulesJson(RP_PREFIX.includes(prefix)?_rpDir:_rDir,prefix,nd,appCtx)){_packs[o.prefix]=o.rjson}else{_packs=null;break}}return _packs};function getPrefixes(){return PREFIX};function getRulepackFolderPrefixes(){return RP_PREFIX};function _loadRulesJson(dir,prefix,nd,appCtx){var rjson,fp;fp=nd.path.join(dir,prefix,RULES_JSON);if(appCtx.fsUtils.fileExists(fp)){rjson=nd.jsonLoader.load(fp,nd,m=>{appCtx.error(m)},true,appCtx.utils)}else{appCtx.error(`Internal error: rule manifest for ${prefix} not found`);return null}if(rjson){return{prefix:prefix,rjson:rjson}}};function _init(nd){_rDir=nd.path.join(__dirname,"../rules");_rpDir=nd.path.join(__dirname,"../rulepacks")};module.exports={getPackMetadata,getPrefixes,getRulepackFolderPrefixes};