import { createClientFields } from '../../fields/config/client.js';
import { deepCopyObjectSimple } from '../../utilities/deepCopyObject.js';
const serverOnlyProperties = [
    'hooks',
    'access',
    'endpoints',
    'custom'
];
const serverOnlyGlobalAdminProperties = [
    'hidden'
];
export const createClientGlobalConfig = ({ defaultIDType, global, i18n })=>{
    const clientGlobal = deepCopyObjectSimple(global);
    clientGlobal.fields = createClientFields({
        clientFields: clientGlobal?.fields || [],
        defaultIDType,
        fields: global.fields,
        i18n
    });
    serverOnlyProperties.forEach((key)=>{
        if (key in clientGlobal) {
            delete clientGlobal[key];
        }
    });
    if (!clientGlobal.admin) {
        clientGlobal.admin = {};
    }
    serverOnlyGlobalAdminProperties.forEach((key)=>{
        if (key in clientGlobal.admin) {
            delete clientGlobal.admin[key];
        }
    });
    if (global.admin.preview) {
        clientGlobal.admin.preview = true;
    }
    clientGlobal.admin.components = null;
    if ('livePreview' in clientGlobal.admin && clientGlobal.admin.livePreview && 'url' in clientGlobal.admin.livePreview) {
        delete clientGlobal.admin.livePreview.url;
    }
    return clientGlobal;
};
export const createClientGlobalConfigs = ({ defaultIDType, globals, i18n })=>{
    const clientGlobals = new Array(globals.length);
    for(let i = 0; i < globals.length; i++){
        const global = globals[i];
        clientGlobals[i] = createClientGlobalConfig({
            defaultIDType,
            global,
            i18n
        });
    }
    return clientGlobals;
};

//# sourceMappingURL=client.js.map