[ML] (error) Monitoring.lua: ...a Games Launcher\bin\arizona\moonloader\lib\encoding.lua:60: assertion failed!
stack traceback:
	[C]: in function 'assert'
	...a Games Launcher\bin\arizona\moonloader\lib\encoding.lua:60: in function 'u8'
	...ona Games Launcher\bin\arizona\moonloader\Monitoring.lua:55: in function 'OnDrawFrame'
	...zona Games Launcher\bin\arizona\moonloader\lib\imgui.lua:1378: in function <...zona Games Launcher\bin\arizona\moonloader\lib\imgui.lua:1367>
[ML] (error) Monitoring.lua: Script died due to an error. (0E8EFD74)
```lua
local imgui = require'imgui'
local cef = require'lib.CEF Events'
local encoding = require'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
local monitoring = {
    enabled = false,
    paused = false,
    filter = '',
    packets = {},
    max_packets = 200,
    auto_scroll = true,
    show_window = imgui.ImBool(true),
}

-- Добавление пакета в историю
local function add_packet(direction, data)
    if #monitoring.packets >= monitoring.max_packets then table.remove(monitoring.packets, 1) end
    table.insert(monitoring.packets, {
        time = os.date('%H:%M:%S'),
        direction = direction,
        size = #data,
        data = data,
    })
end

-- Колбеки для CEF
cef.addOnDisplayCEFCallback(function(str) if monitoring.enabled and not monitoring.paused then add_packet('IN', str) end end)
cef.addOnSendCEFCallback(function(str) if monitoring.enabled and not monitoring.paused then add_packet('OUT', str) end end)
-- Фильтрация пакетов
local function is_packet_visible(packet)
    if monitoring.filter == '' then return true end
    return packet.data:lower():find(monitoring.filter:lower(), 1, true) ~= nil
end

-- Копировать в буфер обмена
local function copy_to_clipboard(text)
    setClipboardText(text)
end

-- ImGui окно
function imgui.OnDrawFrame()
    if not monitoring.show_window.v then return end
    imgui.SetNextWindowSize(imgui.ImVec2(700, 400), imgui.Cond.FirstUseEver)
    if imgui.Begin(u8'Мониторинг CEF', monitoring.show_window) then
        -- Панель управления
        if imgui.Button(monitoring.enabled and u8'Остановить' or u8'Начать мониторинг', imgui.ImVec2(150, 0)) then monitoring.enabled = not monitoring.enabled end
        imgui.SameLine()
        if imgui.Button(monitoring.paused and u8'Продолжить' or u8'Пауза', imgui.ImVec2(100, 0)) then monitoring.paused = not monitoring.paused end
        imgui.SameLine()
        if imgui.Button(u8'Очистить', imgui.ImVec2(80, 0)) then monitoring.packets = {} end
        imgui.SameLine()
        imgui.Checkbox(u8'Автопрокрутка', imgui.ImBool(monitoring.auto_scroll))
        imgui.SameLine()
        imgui.Text(u8('Всего: %d', #monitoring.packets))
        -- Фильтр
        imgui.PushItemWidth(200)
        local changed, filter = imgui.InputText(u8' Фильтр', monitoring.filter, 128)
        if changed then monitoring.filter = filter end
        imgui.PopItemWidth()
        imgui.Separator()
        -- Таблица пакетов
        if imgui.BeginChild('packets', imgui.ImVec2(0, -40), true) then
            imgui.Columns(5, 'packets_columns', true)
            imgui.Text(u8'Время')
            imgui.NextColumn()
            imgui.Text(u8'Тип')
            imgui.NextColumn()
            imgui.Text(u8'Размер')
            imgui.NextColumn()
            imgui.Text(u8'Данные (обрезано)')
            imgui.NextColumn()
            imgui.Text(u8'Действия')
            imgui.NextColumn()
            imgui.Separator()
            local scroll_to_bottom = false
            for i, packet in ipairs(monitoring.packets) do
                if is_packet_visible(packet) then
                    imgui.Text(packet.time)
                    imgui.NextColumn()
                    imgui.Text(packet.direction)
                    imgui.NextColumn()
                    imgui.Text(tostring(packet.size))
                    imgui.NextColumn()
                    local preview = packet.data:gsub('[\r\n]', ' '):sub(1, 80)
                    imgui.Text(preview)
                    imgui.NextColumn()
                    if imgui.SmallButton(u8('Подробнее##' .. i)) then packet.show_details = not packet.show_details end
                    imgui.SameLine()
                    if imgui.SmallButton(u8('Копировать##' .. i)) then copy_to_clipboard(packet.data) end
                    imgui.NextColumn()
                    if packet.show_details then
                        imgui.Columns(1)
                        imgui.TextColored(imgui.ImVec4(0.8, 0.8, 1, 1), u8'Детали пакета:')
                        imgui.TextWrapped(u8('Время: %s\nТип: %s\nРазмер: %d\nДанные:\n%s', packet.time, packet.direction, packet.size, packet.data))
                        imgui.Separator()
                        imgui.Columns(5)
                    end

                    if monitoring.auto_scroll then scroll_to_bottom = true end
                end
            end

            imgui.Columns(1)
            if scroll_to_bottom then imgui.SetScrollHereY(1.0) end
        end

        imgui.EndChild()
    end

    imgui.End()
end

function toggle_monitoring_window()
    monitoring.show_window.v = not monitoring.show_window.v
    if monitoring.show_window.v then
        imgui.Process = true -- Всегда включаем процессинг ImGui при открытии окна
    end
end

function main()
    while not isSampAvailable() do
        wait(0)
    end

    sampRegisterChatCommand('cefmon', toggle_monitoring_window)
    while true do
        wait(0)
    end
end
```