'use strict';
import { createError } from '../../../../fd-toolbox/errors/errors.js';
import { metaErrorMessages } from '../../constants/meta-error-messages-constants.js';
import { cacheKeys } from '../../../../fd-toolbox/constants/cache-keys.js';
import { resourceNames } from '../../../../fd-toolbox/resources/resource-names.js';
import { tryGetFromMemoryCache, setMemoryCache, memoryCacheHasKey } from '../../../../fd-toolbox/server/cachings/fd-memory-cache.js';

var __defProp=Object['defineProperty'],__name=(_0x11fe30,_0xcc39a4)=>__defProp(_0x11fe30,'name',{'value':_0xcc39a4,'configurable':!![]});async function getInternalResourceMeta(_0x5653bd,_0x1f1b00=!![]){const _0x125f8b=getResourceMetaCacheKey(_0x5653bd),_0x19a85e=tryGetFromMemoryCache(_0x125f8b);if(!_0x19a85e){if(_0x1f1b00)throw createError(metaErrorMessages['internalResourceMetaNotFound']['replace']('{0}',_0x125f8b));else return {};}return _0x19a85e;}__name(getInternalResourceMeta,'getInternalResourceMeta');async function setInternalResourceMeta(_0x15e7d5){setMemoryCache(getResourceMetaCacheKey(_0x15e7d5['name']),_0x15e7d5);}__name(setInternalResourceMeta,'setInternalResourceMeta');async function hasInternalResourceMeta(_0x9d1683){return memoryCacheHasKey(getResourceMetaCacheKey(_0x9d1683));}__name(hasInternalResourceMeta,'hasInternalResourceMeta');function getResourceMetaCacheKey(_0x1f83b5){return cacheKeys['internalResourceMeta']+'_'+_0x1f83b5['toLowerCase']();}__name(getResourceMetaCacheKey,'getResourceMetaCacheKey');async function getAllInternalResourceMetas(_0x58471c=Object['values'](resourceNames)){const _0x2f6fee={};for(const _0x224f57 of _0x58471c){const _0x202d43=await getInternalResourceMeta(_0x224f57,![]);Object['keys'](_0x202d43)['length']>-0x2693+0xd*-0x23b+0x4392&&(_0x2f6fee[_0x202d43['name']]=_0x202d43);}return _0x2f6fee;}__name(getAllInternalResourceMetas,'getAllInternalResourceMetas');

export { getAllInternalResourceMetas, getInternalResourceMeta, getResourceMetaCacheKey, hasInternalResourceMeta, setInternalResourceMeta };
