// ── Core State & Helpers ──────────────────────────────────────────────
let currentConfig = null;
let currentDevice = 'desktop';
let tableColumns = [];
let isPageUnloading = false;
let allFieldsStates = {};

const pageTypes = ['list', 'add', 'edit', 'view', 'print', 'export', 'import', 'cards', 'search'];
const defaultFieldDefaults = { list: true, add: true, edit: true, view: true, print: false, export: false, import: false, cards: false, search: true };

function readPluginSettings(containerId) {
    const settings = {};
    document.querySelectorAll(`#${containerId} .plugin-setting`).forEach(el => {
        settings[el.dataset.key] = el.value;
    });
    return settings;
}

window.pageTypes = pageTypes;
window.defaultFieldDefaults = defaultFieldDefaults;
window.readPluginSettings = readPluginSettings;