'use strict';
import { metaErrorMessages } from '../../constants/meta-error-messages-constants.js';
import { createError } from '../../../../fd-toolbox/errors/errors.js';
import { setCoreCache, tryGetFromCoreCache } from '../../../../fd-toolbox/server/cachings/core-cache.js';
import { cacheKeys } from '../../../../fd-toolbox/constants/cache-keys.js';
import { first } from '../../../../fd-toolbox/server/collections/single-funcs.js';

var __defProp=Object['defineProperty'],__name=(_0x31f062,_0x1f5c54)=>__defProp(_0x31f062,'name',{'value':_0x1f5c54,'configurable':!![]});async function getResourceMetaIdServer(_0x58d348){const _0x5393d6=await getResourceNameToIdsServer();return _0x5393d6[_0x58d348];}__name(getResourceMetaIdServer,'getResourceMetaIdServer');async function saveResourceMetaIdToCacheServer(_0x9e8578,_0x36ac97){const _0x5a5fb4=await getResourceNameToIdsServer();_0x5a5fb4[_0x9e8578]=_0x36ac97,await setCoreCache(cacheKeys['resourceNameToIds'],_0x5a5fb4);}__name(saveResourceMetaIdToCacheServer,'saveResourceMetaIdToCacheServer');async function getResourceNameFromResourceMetaId(_0xe36b4f){const _0x248722=await getResourceNameToIdsServer(),_0x4babfe=Object['entries'](_0x248722)['find'](([,_0x118cfc])=>_0x118cfc===_0xe36b4f);if(_0x4babfe)return first(_0x4babfe);throw createError(metaErrorMessages['resourceMetaIdNotConverted']['replace']('{0}',_0xe36b4f));}__name(getResourceNameFromResourceMetaId,'getResourceNameFromResourceMetaId');async function getResourceNameToIdsServer(){const _0x18d9ab=await tryGetFromCoreCache(cacheKeys['resourceNameToIds'])??{};return _0x18d9ab;}__name(getResourceNameToIdsServer,'getResourceNameToIdsServer');

export { getResourceMetaIdServer, getResourceNameFromResourceMetaId, saveResourceMetaIdToCacheServer };
