/*
 * 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");
const RefOutArgWrapper = require("./../../../unisharp/RefOutArgWrapper");
const StringBuilder = require("./../../../unisharp/StringBuilder");

class WebdingsHelper {
    
    static getUnicode(code) {
        let res = '\0';
        let wrapres172 = new RefOutArgWrapper();
        let inoutres173 = WebdingsHelper.m_Convert.tryGetValue(code, wrapres172);
        res = wrapres172.value;
        if (inoutres173) 
            return res;
        else 
            return String.fromCharCode(0);
    }
    
    static getUnicodeString(str) {
        let res = new StringBuilder();
        for (const c of str) {
            let ch = WebdingsHelper.getUnicode(c.charCodeAt(0));
            if (ch !== (String.fromCharCode(0))) 
                res.append(ch);
            else 
                res.append("?");
        }
        return res.toString();
    }
    
    static static_constructor() {
        WebdingsHelper.m_Convert = new Hashtable();
        let data = new Int32Array([0x33, 9204, 0x34, 9205, 0x35, 9206, 0x36, 9207, 0x37, 9194, 0x38, 9193, 0x39, 9198, 0x3A, 9197, 0x3B, 9208, 0x3C, 9209, 0x3D, 9210, 0x60, 11156, 0x61, 10004, 0x63, 9633, 0x67, 9632, 0x6E, 9899, 0x73, 10067, 0x77, 9971, 0x79, 8854, 0x7C, 124, 0x87, 9975, 0x98, 10031, 0xD9, 9729, 0xE8, 9413, 0xE9, 9855]);
        for (let i = 0; i < (data.length - 1); i += 2) {
            if (data[i] < 0xFFFF) {
                if (!WebdingsHelper.m_Convert.containsKey(data[i])) {
                    let cod = data[i + 1] & 0xFFFF;
                    WebdingsHelper.m_Convert.put(data[i], String.fromCharCode(cod));
                }
            }
        }
    }
}


WebdingsHelper.static_constructor();

module.exports = WebdingsHelper