module.exports=(()=>{vare={626:(e,t,n)=>{"use strict";constr=n(671);consto=n(747);consti=n(605);consts=n(211);constu=n(622);consta=n(254);constc=n(544);constl=n(191);constf=n(835);constp=n(669);consth=n(184);constm="amphtml-validator";functionhasPrefix(e,t){returne.indexOf(t)==0}functionisHttpOrHttpsUrl(e){returnhasPrefix(e,"http://")||hasPrefix(e,"https://")}functionreadFromFile(e){returnnewc(function(t,n){o.readFile(e,"utf8",function(e,r){if(e){n(e)}else{t(r.trim())}})})}functionreadFromReadable(e,t){returnnewc(function(n,r){consto=[];t.setEncoding("utf8");t.on("data",function(e){o.push(e)});t.on("end",function(){n(o.join(""))});t.on("error",function(t){r(newError("Could not read from "+e+" - "+t.message))})})}functionreadFromStdin(){returnreadFromReadable("stdin",process.stdin).then(function(e){process.stdin.resume();returne})}functionreadFromUrl(e,t){returnnewc(function(n,r){consto=hasPrefix(e,"http://")?i:s;constu=o.request(e,function(t){if(t.statusCode!==200){t.resume();r(newError("Unable to fetch "+e+" - HTTP Status "+t.statusCode))}else{n(t)}});u.setHeader("User-Agent",t);u.on("error",function(t){r(newError("Unable to fetch "+e+" - "+t.message))});u.end()}).then(readFromReadable.bind(null,e))}functionValidationResult(){this.status="UNKNOWN";this.errors=[]}functionValidationError(){this.severity="UNKNOWN_SEVERITY";this.line=1;this.col=0;this.message="";this.specUrl=null;this.code="UNKNOWN_CODE";this.params=[]}functionValidator(e){this.sandbox=h.createContext();try{newh.Script(e).runInContext(this.sandbox)}catch(e){thrownewError("Could not instantiate validator.js - "+e.message)}}Validator.prototype.validateString=function(e,t){constn=this.sandbox.amp.validator.validateString(e,t);constr=newValidationResult;r.status=n.status;for(lete=0;e<n.errors.length;e++){constt=n.errors[e];consto=newValidationError;o.severity=t.severity;o.line=t.line;o.col=t.col;o.message=this.sandbox.amp.validator.renderErrorMessage(t);o.specUrl=t.specUrl;o.code=t.code;o.params=t.params;r.errors.push(o)}returnr};constd={};functiongetInstance(e,t){constn=e||"https://cdn.ampproject.org/v0/validator.js";constr=t||m;if(d.hasOwnProperty(n)){returnc.resolve(d[n])}consto=isHttpOrHttpsUrl(n)?readFromUrl(n,r):readFromFile(n);returno.then(function(e){lett;try{t=newValidator(e)}catch(e){throwe}d[n]=t;returnt})}t.getInstance=getInstance;functionnewInstance(e){returnnewValidator(e)}t.newInstance=newInstance;functionlogValidationResult(e,t,n){if(t.status==="PASS"){process.stdout.write(e+": "+(n?r.green("PASS"):"PASS")+"\n")}for(leto=0;o<t.errors.length;o++){consti=t.errors[o];lets=e+":"+i.line+":"+i.col+" ";if(n){s+=(i.severity==="ERROR"?r.red:r.magenta)(i.message)}else{s+=i.message}if(i.specUrl){s+=" (see "+i.specUrl+")"}process.stderr.write(s+"\n")}}functionmain(){a.usage("[options] <fileOrUrlOrMinus...>\n\n"+' Validates the files or urls provided as arguments. If "-" is\n'+" specified, reads from stdin instead.").option("--validator_js <fileOrUrl>","The Validator Javascript.\n"+" Latest published version by default, or\n"+" dist/validator_minified.js (built with build.py)\n"+" for development.","https://cdn.ampproject.org/v0/validator.js").option("--user-agent <userAgent>","User agent string to use in requests.",m).option("--html_format <AMP|AMP4ADS|AMP4EMAIL>","The input format to be validated.\n"+" AMP by default.","AMP").option("--format <color|text|json>","How to format the output.\n"+' "color" displays errors/warnings/success in\n'+" red/orange/green.\n"+' "text" avoids color (e.g., useful in terminals not\n'+" supporting color).\n"+' "json" emits json corresponding to the ValidationResult\n'+" message in validator.proto.","color").parse(process.argv);if(a.args.length===0){a.outputHelp();process.exit(1)}if(a.html_format!=="AMP"&&a.html_format!=="AMP4ADS"&&a.html_format!=="AMP4EMAIL"){process.stderr.write('--html_format must be set to "AMP", "AMP4ADS", or "AMP4EMAIL".\n',function(){process.exit(1)})}if(a.format!=="color"&&a.format!=="text"&&a.fo