window.getOriginalAssetName = function (displayName, context = 'cardName') {
    if (!displayName || !window.assetNameMapping) return displayName;

    for (const [originalName, mappings] of Object.entries(window.assetNameMapping)) {
        if (mappings && mappings[context] === displayName) {

            return originalName;
        }
    }


    return displayName;
};

// Get display name for a specific context (alertName, historyName, etc.)
window.getDisplayName = function (originalAssetName, context = 'cardName') {
    if (!originalAssetName || !window.assetNameMapping) return originalAssetName;

    const mapping = window.assetNameMapping[originalAssetName];
    if (mapping && mapping[context]) {
        return mapping[context];
    }

    // Fallback: return original name
    return originalAssetName;
};

// Specific helper for alert names
window.getAlertName = function (assetName) {
    return window.getDisplayName(assetName, 'alertName');
};

// Specific helper for history names
window.getHistoryName = function (assetName) {
    return window.getDisplayName(assetName, 'historyName');
};
