'use strict';
import { readFileSync } from 'node:fs';
import { fileExtensions } from '../../base-repo/app-constants/internal-system-constants.js';

var __defProp=Object['defineProperty'],__name=(_0x1e2850,_0x185ab5)=>__defProp(_0x1e2850,'name',{'value':_0x185ab5,'configurable':!![]});const dirnameConstant='dirname',filenameConstant='fileURLToPath',dirnamePolyfill='const\x20__dirname\x20=\x20dirname(__filename);\x0a',filenamePolyfill='const\x20__filename\x20=\x20fileURLToPath(import.meta.url);\x0a',dirnameImport='import\x20{\x20dirname\x20}\x20from\x20\x22path\x22;\x0a',filenameImport='import\x20{\x20fileURLToPath\x20}\x20from\x20\x22url\x22;\x0a',filenameDefinition='const\x20__filename\x20=\x20fileURLToPath$1(import.meta.url);',esbuildFilename='const\x20__filename\x20=\x20fileURLToPath(import.meta.url);',pluginName='define-dirname',chunkType='chunk';function defineDirname(){return {'name':pluginName,'generateBundle'(_0x5c6f3e,_0x4b147d){for(const _0x157969 of Object['keys'](_0x4b147d)){const _0x5574c9=_0x4b147d[_0x157969];let _0x217616='';_0x5574c9['type']===chunkType&&(_0x5574c9['code']=_0x5574c9['code']['replaceAll'](filenameDefinition,''),_0x217616+=filenamePolyfill,_0x217616+=dirnamePolyfill,_0x5574c9['code']=_0x217616+_0x5574c9['code']);}}};}__name(defineDirname,'defineDirname');function defineDirnameEsbuild(){return {'name':pluginName,'setup'(_0x15162a){_0x15162a['onLoad']({'filter':/\.ts$/},async _0x2e043a=>{let _0x1eaadf='',_0x248e96=readFileSync(_0x2e043a['path'],'utf8');if(!_0x248e96['includes'](dirnameConstant))_0x1eaadf+=dirnameImport;return _0x1eaadf+=filenameImport,_0x248e96=_0x248e96['replaceAll'](esbuildFilename,''),_0x1eaadf+=filenamePolyfill,_0x1eaadf+=dirnamePolyfill,_0x248e96=_0x1eaadf+_0x248e96,{'contents':_0x248e96,'loader':fileExtensions['ts']['slice'](0x26*-0x4f+-0x33c+0xef7)};});}};}__name(defineDirnameEsbuild,'defineDirnameEsbuild');

export { defineDirname, defineDirnameEsbuild };
