"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.lowerNamingFunction = exports.upperNamingFunction = void 0;
const Naming_js_1 = require("../../Naming.js");
const Strings_js_1 = require("../../support/Strings.js");
const legalizeName = (0, Strings_js_1.legalizeCharacters)((cp) => (0, Strings_js_1.isAscii)(cp) && (0, Strings_js_1.isLetterOrUnderscoreOrDigit)(cp));
function haskellNameStyle(original, upper) {
    const words = (0, Strings_js_1.splitIntoWords)(original);
    return (0, Strings_js_1.combineWords)(words, legalizeName, upper ? Strings_js_1.firstUpperWordStyle : Strings_js_1.allLowerWordStyle, Strings_js_1.firstUpperWordStyle, upper ? Strings_js_1.allUpperWordStyle : Strings_js_1.allLowerWordStyle, Strings_js_1.allUpperWordStyle, "", Strings_js_1.isLetterOrUnderscore);
}
exports.upperNamingFunction = (0, Naming_js_1.funPrefixNamer)("upper", (n) => haskellNameStyle(n, true));
exports.lowerNamingFunction = (0, Naming_js_1.funPrefixNamer)("lower", (n) => haskellNameStyle(n, false));
