"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.doCompress=doCompress;const config_1=require("../../../../../config/config"),customError_1=require("../../../../../utils/customError"),terser=()=>require("terser"),babelCodeFrame=()=>require("babel-code-frame");async function doCompress(e,r){const{code:o,map:s}=r,c=s?{includeSources:!0,content:"string"==typeof s?JSON.parse(s):s,filename:e}:{includeSources:!0,content:void 0,filename:e},t=require("terser").minify(o,{toplevel:!0,compress:{drop_console:!1,drop_debugger:!1},sourceMap:c});if(t.error){const r=t.error,s=`file: ${e}\n ${t.error.message}\n ${require("babel-code-frame")(o,r.line,r.col>0?r.col:1)}`;throw(0,customError_1.makeCustomError)(s,config_1.UGLIFY_JS_ERR,e)}return{code:t.code,map:t.map}}