text: #!/usr/bin/env node
  const yargs=require("yargs"),{hideBin}=require("yargs/helpers"),clipboardy=require("clipboardy"),{writeFileSync}=require("fs"),path=require("path"),htmlInlineExternal=require("./html-inline-external.js"),{argv}=yargs(hideBin(process.argv)),ARGUMENTS={SRC:"src",DEST:"dest",PRETTY:"pretty",MINIFY:"minify",TAGS:"tags",COPY:"copy"},DEFAULT_TAGS_TO_RESOLVE="script,link,img",getWarning=a=>b=>a&&console.warn(`[Warning] ${b}`),writeToFile=(a="compiled.html",b)=>{console.log(`[Log] Wrote to file ${a}`),writeFileSync(path.resolve(process.cwd(),a.trim()),b)},validate=()=>{const a=getWarning(argv[ARGUMENTS.DEST]);argv[ARGUMENTS.SRC]&&"string"==typeof argv[ARGUMENTS.SRC]||(console.error("[Error] Missing --src argument, Please pass path to source file."),process.exit(1)),"boolean"==typeof argv[ARGUMENTS.TAGS]&&a(`Invalid tags passed, Fallback : [${DEFAULT_TAGS_TO_RESOLVE}]  would be processed.`)};async function main(){const{src:a,dest:b,tags:c,pretty:d,copy:e,minify:f}=argv;validate();try{const g=await htmlInlineExternal({src:a,dest:b,pretty:d,tags:c&&c.trim().split(","),copy:e,minify:f});if(e)try{clipboardy.writeSync(g),console.log("[Log]: Copied to clipboard.")}catch(a){console.warn("[Error]: Failed to write into clipboard."),writeToFile(b,g)}else b?writeToFile(b,g):console.log(g)}catch(a){console.error("[Error]: Unexpected Error",a)}}main();