/*
 * SDK Pullenti Unitext, version 4.33, fabruary 2026. Copyright (c) 2013-2026, Pullenti. All rights reserved. 
 * Non-Commercial Freeware and Commercial Software. 
 * This class is generated using the converter UniSharping (www.unisharping.ru) from Pullenti C# project. 
 * The latest version of the code is available on the site www.pullenti.ru
 */

const Hashtable = require("./../unisharp/Hashtable");

/**
 * Тип Newline или Pagebreak (например, в случае PDF некоторые переходы ошибочны)
 */
class WhitespaceType {

    constructor(val, str) {
        this.m_val = val;
        this.m_str = str;
    }
    toString() {
        return this.m_str;
    }
    value() {
        return this.m_val;
    }
    static of(val) {
        if(val instanceof WhitespaceType) 
            return val;
        if(typeof val === 'string' || val instanceof String) {
            val = val.toUpperCase();
            if(WhitespaceType.mapStringToEnum.containsKey(val))
                return WhitespaceType.mapStringToEnum.get(val);
            return null;
        }
        if(WhitespaceType.mapIntToEnum.containsKey(val))
            return WhitespaceType.mapIntToEnum.get(val);
        let it = new WhitespaceType(val, val.toString());
        WhitespaceType.mapIntToEnum.put(val, it);
        WhitespaceType.mapStringToEnum.put(val.toString(), it);
        return it;
    }
    static isDefined(val) {
        return WhitespaceType.m_Keys.indexOf(val) >= 0;
    }
    static getValues() {
        return WhitespaceType.m_Values;
    }
    static static_constructor() {
        WhitespaceType.mapIntToEnum = new Hashtable();
        WhitespaceType.mapStringToEnum = new Hashtable();
        WhitespaceType.ORIGINAL = new WhitespaceType(0, "ORIGINAL");
        WhitespaceType.mapIntToEnum.put(WhitespaceType.ORIGINAL.value(), WhitespaceType.ORIGINAL); 
        WhitespaceType.mapStringToEnum.put(WhitespaceType.ORIGINAL.m_str.toUpperCase(), WhitespaceType.ORIGINAL); 
        WhitespaceType.ONESPACE = new WhitespaceType(1, "ONESPACE");
        WhitespaceType.mapIntToEnum.put(WhitespaceType.ONESPACE.value(), WhitespaceType.ONESPACE); 
        WhitespaceType.mapStringToEnum.put(WhitespaceType.ONESPACE.m_str.toUpperCase(), WhitespaceType.ONESPACE); 
        WhitespaceType.IGNORABLE = new WhitespaceType(2, "IGNORABLE");
        WhitespaceType.mapIntToEnum.put(WhitespaceType.IGNORABLE.value(), WhitespaceType.IGNORABLE); 
        WhitespaceType.mapStringToEnum.put(WhitespaceType.IGNORABLE.m_str.toUpperCase(), WhitespaceType.IGNORABLE); 
        WhitespaceType.SOFT = new WhitespaceType(3, "SOFT");
        WhitespaceType.mapIntToEnum.put(WhitespaceType.SOFT.value(), WhitespaceType.SOFT); 
        WhitespaceType.mapStringToEnum.put(WhitespaceType.SOFT.m_str.toUpperCase(), WhitespaceType.SOFT); 
        WhitespaceType.m_Values = Array.from(WhitespaceType.mapIntToEnum.values);
        WhitespaceType.m_Keys = Array.from(WhitespaceType.mapIntToEnum.keys);
    }
}


WhitespaceType.static_constructor();

module.exports = WhitespaceType