const fs = require('fs');
const path = require('path');

// 原版代码的字符串数组和解码函数
function _0x81f8() {
    const _0xb6f8e4 = (function () {
        return ['cursor', 'XenNcturgdsoIeKrHRBCjEhRpemLPbyB==', 'W7mXWPBdNJZdL1O', 'yXhcLSkQWPa', 'EubBWPfh', 'WRNcKNekna', 'sd/cJCkmWOpdIW', 'W7qLW7bCkW', 'bmkbESkVWPK', 'WRBcVmkNWOldNfpcM0FdTsi', 'W6OCW4hcNCoNCua', 'acLXq0C', 'WROrW7NcS1Gw', 'W6aWW6H5pHiGW6v/WQ5Tb8k2WQmwga', 'nJrJW6ddUmogvCkeaHHyWOu', 'W6ehWRGiW48yfINcRahcOmkZnI8NmuO', 'WRZdOmoxFCky', 'Cmk8w8okW4DEcb7cQSk3WRpdVCk4WQC2WR0kC8oXCmkAW57dV8op', 'uNDGWPHyWRLXnmk1qCkNWQOne8odW7jZW5CcW5SZWOWOW4a', 'W78KAJNdLG', 'eCkJFqBcTCk0W53dGtvUlYWRWQ3dJCkBW6pdJSo3eSozWP7cSItdLd1nW5VdTdxdMejrW6C', 'dCoWWRbuW4KE', 'W7qUWO3dJI/dMa', 'WOORW5pcPLC', 'WOuWW5NcNLa', 'c8owW6m/', 'WQddQrRcHSkW', 'c8opWPpcTaO', 'W4tcNw8cs8koi281W4/dMX0TW5VdU1HKWRrfWPJdHmkHWQWbnSkp', 'DCkzW68eeW', 'WOe6W6ZcPve', 'iCoZWRftW5W3amovWQSF', 'jCosWPfVW6yGn8oHWPe+W6VdHq', 'k391WRVdKq', 'fCoHWOXIFCooWOzTWRxcL3i', 'nGH1A2jK', 'W4OautxdLq', 'F0zDWQbx', 'eMeBzSoYDLRdOSkLoxKx', 'W5xdOCotW7/dHW', 'umohahq2dthcJLj8FxlcV8kD', 'ddDyWOhcRa', 'W5LoWRbMt8klWRj0wa', 'r8kgxb3dLG', 'W5bwWPFcVNW', 'W60MW7nB', 'W6yNWORdUa7dKvpcI34rW64MW6ZcR8oNW5VcR8koW4JdUq', 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msWQG6W54CkZFcPGRcQSkXoIiUlupdLai', 'uCoiefC0bWtcJW', 'iLlcSWRcJetcUSooECkonX/cLCkyzCkveq', 'WQ/dH8oMtG', 'Cb1PtSo6WPi8WQGhW5bpDa', 'kCo9u8orvCoCW6WRWRhcVIhdMspdLCoOWPJcU0VdGa', 'pCoSWOZcNdu', 'EIddICkOWOS', 'qvCHetpdOSo3ufrX', 'W6yPWO3dRZ7dNhpcHxeBW6G7W5K', 'WQShW67cK1iFWOD7iSogW4WHW4v2va'];
    }());
    _0x81f8 = function () { return _0xb6f8e4; };
    return _0x81f8();
}

// RC4解密函数
function _0x3fbb(_0x91e0a, _0x2e3a7e) {
    const _0x81f807 = _0x81f8();
    _0x3fbb = function (_0x3fbbba, _0x9d3c29) {
        _0x3fbbba = _0x3fbbba - 0x12e;
        let _0x54f284 = _0x81f807[_0x3fbbba];
        if (_0x3fbb['VKdPFb'] === undefined) {
            var _0x150010 = function (_0x44bb15) {
                const _0x1757ec = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';
                let _0x59a345 = '', _0x20995f = '';
                for (let _0x4d4001 = 0x0, _0x16ea18, _0xc3818f, _0x14ada7 = 0x0; _0xc3818f = _0x44bb15['charAt'](_0x14ada7++); ~_0xc3818f && (_0x16ea18 = _0x4d4001 % 0x4 ? _0x16ea18 * 0x40 + _0xc3818f : _0xc3818f, _0x4d4001++ % 0x4) ? _0x59a345 += String['fromCharCode'](0xff & _0x16ea18 >> (-0x2 * _0x4d4001 & 0x6)) : 0x0) {
                    _0xc3818f = _0x1757ec['indexOf'](_0xc3818f);
                }
                for (let _0x278428 = 0x0, _0x291cae = _0x59a345['length']; _0x278428 < _0x291cae; _0x278428++) {
                    _0x20995f += '%' + ('00' + _0x59a345['charCodeAt'](_0x278428)['toString'](0x10))['slice'](-0x2);
                }
                return decodeURIComponent(_0x20995f);
            };
            const _0x35b6f4 = function (_0x5cccfb, _0x200ec4) {
                let _0x50a88d = [], _0x3c7316 = 0x0, _0xf926c6, _0x44d71d = '';
                _0x5cccfb = _0x150010(_0x5cccfb);
                let _0x5c9dd8;
                for (_0x5c9dd8 = 0x0; _0x5c9dd8 < 0x100; _0x5c9dd8++) { _0x50a88d[_0x5c9dd8] = _0x5c9dd8; }
                for (_0x5c9dd8 = 0x0; _0x5c9dd8 < 0x100; _0x5c9dd8++) {
                    _0x3c7316 = (_0x3c7316 + _0x50a88d[_0x5c9dd8] + _0x200ec4['charCodeAt'](_0x5c9dd8 % _0x200ec4['length'])) % 0x100;
                    _0xf926c6 = _0x50a88d[_0x5c9dd8];
                    _0x50a88d[_0x5c9dd8] = _0x50a88d[_0x3c7316];
                    _0x50a88d[_0x3c7316] = _0xf926c6;
                }
                _0x5c9dd8 = 0x0; _0x3c7316 = 0x0;
                for (let _0x2683bc = 0x0; _0x2683bc < _0x5cccfb['length']; _0x2683bc++) {
                    _0x5c9dd8 = (_0x5c9dd8 + 0x1) % 0x100;
                    _0x3c7316 = (_0x3c7316 + _0x50a88d[_0x5c9dd8]) % 0x100;
                    _0xf926c6 = _0x50a88d[_0x5c9dd8];
                    _0x50a88d[_0x5c9dd8] = _0x50a88d[_0x3c7316];
                    _0x50a88d[_0x3c7316] = _0xf926c6;
                    _0x44d71d += String['fromCharCode'](_0x5cccfb['charCodeAt'](_0x2683bc) ^ _0x50a88d[(_0x50a88d[_0x5c9dd8] + _0x50a88d[_0x3c7316]) % 0x100]);
                }
                return _0x44d71d;
            };
            _0x3fbb['HlOQbT'] = _0x35b6f4;
            _0x3fbb['VKdPFb'] = true;
        }
        const _0x572ba4 = _0x81f807[0x0];
        const _0x1344b3 = _0x3fbbba + _0x572ba4;
        const _0x1c8a1f = undefined;
        _0x54f284 = _0x3fbb['HlOQbT'](_0x54f284, _0x9d3c29);
        return _0x54f284;
    };
    return _0x3fbb(_0x91e0a, _0x2e3a7e);
}

// 构建解码映射表
const decodeMap = {};
for (let i = 0x12e; i <= 0x1c8; i++) {
    const keys = ['egez', '%x%T', '1I3q', '4%)S', 'zF^s', ']$%b', 'nS#0', 'CAFj', 'i9F1', 'FaV!', 'xDiN', '@Xc6', '!D4Z', 'H%&^', 'csY!', 'Tn!E', 'E$^%', '3nFX', 'wvYe', 'CMPY', ')0X3', 'dpeu', 'Kfdi', 'kp3(', 'g547', 'gtUF', 'P#LQ', '*1hl', 'mBo%', 'pIfk', 'j#7G', 'fjkd', 'HShS', '0hHe', 'rI*M', 'yC20', ']8Ci', 'N$(9', '2T[v', '^UhV', 'z&uV', 'cY2P', 'h^2B', '3)@J', 'lC$h', 'T8iJ', '7*qP', 'FKQ]', 'T3[u'];
    for (const key of keys) {
        try {
            const decoded = _0x3fbb(i, key);
            if (decoded && typeof decoded === 'string' && decoded.length > 0) {
                decodeMap[`${i},${key}`] = decoded;
            }
        } catch (e) { }
    }
}

// 打印一些重要的解码结果
console.log('=== 解码结果 ===');
console.log('DEFAULT_API_URL:', _0x3fbb(0x18a, 'yC20'));
console.log('vscode:', _0x3fbb(0x151, 'pIfk'));
console.log('workspace:', _0x3fbb(0x177, ']8Ci'));
console.log('apiUrl:', _0x3fbb(0x15b, 'j#7G'));

// 关键解码
const apiUrl = _0x3fbb(0x18a, 'yC20');
console.log('\n原版API地址:', apiUrl);
console.log('需要替换为: https://api.aicode.edu.pl');
