forked from luozheao/setHost
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bundle.js
5 lines (5 loc) · 33.1 KB
/
bundle.js
1
2
3
4
5
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("http"),require("https"),require("url"),require("stream"),require("assert"),require("tty"),require("util"),require("fs"),require("net"),require("zlib"),require("path"),require("child_process")):"function"==typeof define&&define.amd?define(["http","https","url","stream","assert","tty","util","fs","net","zlib","path","child_process"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).getHost=t(e.http,e.https,e.url,e.stream,e.assert,e.tty,e.util,e.fs,e.net,e.zlib,e.path,e.child_process)}(this,function(e,t,r,n,o,s,i,a,u,c,f,d){"use strict";function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function l(r,n){return function(){for(var e=new Array(arguments.length),t=0;t<e.length;t++)e[t]=arguments[t];return r.apply(n,e)}}var m=p(e),g=p(t),y=p(r),n=p(n),h=p(o),b=p(s),v=p(i),_=p(a),w=p(u),x=p(c),R=p(f),E=p(d),O=Object.prototype.toString;function C(e){return"[object Array]"===O.call(e)}function k(e){return void 0===e}function A(e){return null!==e&&"object"==typeof e}function j(e){if("[object Object]"!==O.call(e))return!1;e=Object.getPrototypeOf(e);return null===e||e===Object.prototype}function B(e){return"[object Function]"===O.call(e)}function q(e,t){if(null!=e)if(C(e="object"!=typeof e?[e]:e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}var S={isArray:C,isArrayBuffer:function(e){return"[object ArrayBuffer]"===O.call(e)},isBuffer:function(e){return null!==e&&!k(e)&&null!==e.constructor&&!k(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:A,isPlainObject:j,isUndefined:k,isDate:function(e){return"[object Date]"===O.call(e)},isFile:function(e){return"[object File]"===O.call(e)},isBlob:function(e){return"[object Blob]"===O.call(e)},isFunction:B,isStream:function(e){return A(e)&&B(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:q,merge:function r(){var n={};function e(e,t){j(n[t])&&j(e)?n[t]=r(n[t],e):j(e)?n[t]=r({},e):C(e)?n[t]=e.slice():n[t]=e}for(var t=0,o=arguments.length;t<o;t++)q(arguments[t],e);return n},extend:function(r,e,n){return q(e,function(e,t){r[t]=n&&"function"==typeof e?l(e,n):e}),r},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")},stripBOM:function(e){return e=65279===e.charCodeAt(0)?e.slice(1):e}};function T(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function U(e,t,r){return t&&(r=r?r(t):S.isURLSearchParams(t)?t.toString():(n=[],S.forEach(t,function(e,t){null!=e&&(S.isArray(e)?t+="[]":e=[e],S.forEach(e,function(e){S.isDate(e)?e=e.toISOString():S.isObject(e)&&(e=JSON.stringify(e)),n.push(T(t)+"="+T(e))}))}),n.join("&")))&&(-1!==(t=e.indexOf("#"))&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+r),e;var n}function L(){this.handlers=[]}L.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},L.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},L.prototype.forEach=function(t){S.forEach(this.handlers,function(e){null!==e&&t(e)})};function N(t,r,e){return S.forEach(e,function(e){t=e(t,r)}),t}function D(e){return!(!e||!e.__CANCEL__)}function P(r,n){S.forEach(r,function(e,t){t!==n&&t.toUpperCase()===n.toUpperCase()&&(r[n]=e,delete r[t])})}function z(e,t,r,n,o){return e.config=t,r&&(e.code=r),e.request=n,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}function F(e,t,r,n,o){return e=new Error(e),z(e,t,r,n,o)}function M(e,t,r){var n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(F("Request failed with status code "+r.status,r.config,null,r.request,r)):e(r)}function H(e,t){return e&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)?(r=e,(e=t)?r.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):r):t;var r}var I,$,G,X=L,J=S.isStandardBrowserEnv()?{write:function(e,t,r,n,o,s){var i=[];i.push(e+"="+encodeURIComponent(t)),S.isNumber(r)&&i.push("expires="+new Date(r).toGMTString()),S.isString(n)&&i.push("path="+n),S.isString(o)&&i.push("domain="+o),!0===s&&i.push("secure"),document.cookie=i.join("; ")},read:function(e){e=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},W=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],Y=S.isStandardBrowserEnv()?($=/(msie|trident)/i.test(navigator.userAgent),G=document.createElement("a"),I=V(window.location.href),function(e){e=S.isString(e)?V(e):e;return e.protocol===I.protocol&&e.host===I.host}):function(){return!0};function V(e){return $&&(G.setAttribute("href",e),e=G.href),G.setAttribute("href",e),{href:G.href,protocol:G.protocol?G.protocol.replace(/:$/,""):"",host:G.host,search:G.search?G.search.replace(/^\?/,""):"",hash:G.hash?G.hash.replace(/^#/,""):"",hostname:G.hostname,port:G.port,pathname:"/"===G.pathname.charAt(0)?G.pathname:"/"+G.pathname}}function Z(a){return new Promise(function(o,s){var r=a.data,n=a.headers;S.isFormData(r)&&delete n["Content-Type"];var e,i=new XMLHttpRequest;a.auth&&(e=a.auth.username||"",t=a.auth.password?unescape(encodeURIComponent(a.auth.password)):"",n.Authorization="Basic "+btoa(e+":"+t));var t=H(a.baseURL,a.url);if(i.open(a.method.toUpperCase(),U(t,a.params,a.paramsSerializer),!0),i.timeout=a.timeout,i.onreadystatechange=function(){var t,r,n,e;i&&4===i.readyState&&(0!==i.status||i.responseURL&&0===i.responseURL.indexOf("file:"))&&(e="getAllResponseHeaders"in i?(e=i.getAllResponseHeaders(),n={},e&&S.forEach(e.split("\n"),function(e){r=e.indexOf(":"),t=S.trim(e.substr(0,r)).toLowerCase(),r=S.trim(e.substr(r+1)),t&&(n[t]&&0<=W.indexOf(t)||(n[t]="set-cookie"===t?(n[t]||[]).concat([r]):n[t]?n[t]+", "+r:r))}),n):null,e={data:a.responseType&&"text"!==a.responseType?i.response:i.responseText,status:i.status,statusText:i.statusText,headers:e,config:a,request:i},M(o,s,e),i=null)},i.onabort=function(){i&&(s(F("Request aborted",a,"ECONNABORTED",i)),i=null)},i.onerror=function(){s(F("Network Error",a,null,i)),i=null},i.ontimeout=function(){var e="timeout of "+a.timeout+"ms exceeded";a.timeoutErrorMessage&&(e=a.timeoutErrorMessage),s(F(e,a,"ECONNABORTED",i)),i=null},!S.isStandardBrowserEnv()||(t=(a.withCredentials||Y(t))&&a.xsrfCookieName?J.read(a.xsrfCookieName):void 0)&&(n[a.xsrfHeaderName]=t),"setRequestHeader"in i&&S.forEach(n,function(e,t){void 0===r&&"content-type"===t.toLowerCase()?delete n[t]:i.setRequestHeader(t,e)}),S.isUndefined(a.withCredentials)||(i.withCredentials=!!a.withCredentials),a.responseType)try{i.responseType=a.responseType}catch(e){if("json"!==a.responseType)throw e}"function"==typeof a.onDownloadProgress&&i.addEventListener("progress",a.onDownloadProgress),"function"==typeof a.onUploadProgress&&i.upload&&i.upload.addEventListener("progress",a.onUploadProgress),a.cancelToken&&a.cancelToken.promise.then(function(e){i&&(i.abort(),s(e),i=null)}),i.send(r=r||null)})}function K(e,t){return e(t={exports:{}},t.exports),t.exports}function Q(e,t){t=t||{};var r=typeof e;if("string"==r&&0<e.length)return function(e){if(!(100<(e=String(e)).length)){e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(e){var t=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*t;case"days":case"day":case"d":return t*te;case"hours":case"hour":case"hrs":case"hr":case"h":return t*ee;case"minutes":case"minute":case"mins":case"min":case"m":return 6e4*t;case"seconds":case"second":case"secs":case"sec":case"s":return 1e3*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}(e);if("number"==r&&!1===isNaN(e))return t.long?re(t=e,te,"day")||re(t,ee,"hour")||re(t,6e4,"minute")||re(t,1e3,"second")||t+" ms":function(e){if(te<=e)return Math.round(e/te)+"d";if(ee<=e)return Math.round(e/ee)+"h";if(6e4<=e)return Math.round(e/6e4)+"m";if(1e3<=e)return Math.round(e/1e3)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}var ee=36e5,te=864e5;function re(e,t,r){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+r:Math.ceil(e/t)+" "+r+"s"}var ne=K(function(e,i){var a;function t(e){function r(){if(r.enabled){var n=r,e=+new Date;n.diff=e-(a||e),n.prev=a,n.curr=e,a=e;for(var o=new Array(arguments.length),t=0;t<o.length;t++)o[t]=arguments[t];o[0]=i.coerce(o[0]),"string"!=typeof o[0]&&o.unshift("%O");var s=0;o[0]=o[0].replace(/%([a-zA-Z%])/g,function(e,t){if("%%"===e)return e;s++;var r=i.formatters[t];return"function"==typeof r&&(t=o[s],e=r.call(n,t),o.splice(s,1),s--),e}),i.formatArgs.call(n,o),(r.log||i.log||console.log.bind(console)).apply(n,o)}}return r.namespace=e,r.enabled=i.enabled(e),r.useColors=i.useColors(),r.color=function(e){var t,r=0;for(t in e)r=(r<<5)-r+e.charCodeAt(t),r|=0;return i.colors[Math.abs(r)%i.colors.length]}(e),"function"==typeof i.init&&i.init(r),r}(i=e.exports=t.debug=t.default=t).coerce=function(e){return e instanceof Error?e.stack||e.message:e},i.disable=function(){i.enable("")},i.enable=function(e){i.save(e),i.names=[],i.skips=[];for(var t=("string"==typeof e?e:"").split(/[\s,]+/),r=t.length,n=0;n<r;n++)t[n]&&("-"===(e=t[n].replace(/\*/g,".*?"))[0]?i.skips.push(new RegExp("^"+e.substr(1)+"$")):i.names.push(new RegExp("^"+e+"$")))},i.enabled=function(e){var t,r;for(t=0,r=i.skips.length;t<r;t++)if(i.skips[t].test(e))return!1;for(t=0,r=i.names.length;t<r;t++)if(i.names[t].test(e))return!0;return!1},i.humanize=Q,i.names=[],i.skips=[],i.formatters={}});ne.coerce,ne.disable,ne.enable,ne.enabled,ne.humanize,ne.names,ne.skips,ne.formatters;var oe=K(function(e,o){function t(){var e;try{e=o.storage.debug}catch(e){}return e=!e&&"undefined"!=typeof process&&"env"in process?process.env.DEBUG:e}(o=e.exports=ne).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},o.formatArgs=function(e){var t,r,n=this.useColors;e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+o.humanize(this.diff),n&&(n="color: "+this.color,e.splice(1,0,n,"color: inherit"),e[r=t=0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(t++,"%c"===e&&(r=t))}),e.splice(r,0,n))},o.save=function(e){try{null==e?o.storage.removeItem("debug"):o.storage.debug=e}catch(e){}},o.load=t,o.useColors=function(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)return!0;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&31<=parseInt(RegExp.$1,10)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},o.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),o.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],o.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},o.enable(t())});oe.log,oe.formatArgs,oe.save,oe.load,oe.useColors,oe.storage,oe.colors;var se=K(function(e,o){(o=e.exports=ne).init=function(e){e.inspectOpts={};for(var t=Object.keys(o.inspectOpts),r=0;r<t.length;r++)e.inspectOpts[t[r]]=o.inspectOpts[t[r]]},o.log=function(){return r.write(v.default.format.apply(v.default,arguments)+"\n")},o.formatArgs=function(e){var t=this.namespace;{var r,n;this.useColors?(r=this.color,n=" [3"+r+";1m"+t+" [0m",e[0]=n+e[0].split("\n").join("\n"+n),e.push("[3"+r+"m+"+o.humanize(this.diff)+"[0m")):e[0]=(new Date).toUTCString()+" "+t+" "+e[0]}},o.save=function(e){null==e?delete process.env.DEBUG:process.env.DEBUG=e},o.load=n,o.useColors=function(){return"colors"in o.inspectOpts?Boolean(o.inspectOpts.colors):b.default.isatty(t)},o.colors=[6,2,3,4,5,1],o.inspectOpts=Object.keys(process.env).filter(function(e){return/^debug_/i.test(e)}).reduce(function(e,t){var r=t.substring(6).toLowerCase().replace(/_([a-z])/g,function(e,t){return t.toUpperCase()}),t=process.env[t],t=!!/^(yes|on|true|enabled)$/i.test(t)||!/^(no|off|false|disabled)$/i.test(t)&&("null"===t?null:Number(t));return e[r]=t,e},{});var t=parseInt(process.env.DEBUG_FD,10)||2;1!==t&&2!==t&&v.default.deprecate(function(){},"except for stderr(2) and stdout(1), any other usage of DEBUG_FD is deprecated. Override debug.log if you want to use a different log function (https://git.io/debug_fd)")();var r=1===t?process.stdout:2===t?process.stderr:function(e){var t;switch(process.binding("tty_wrap").guessHandleType(e)){case"TTY":(t=new b.default.WriteStream(e))._type="tty",t._handle&&t._handle.unref&&t._handle.unref();break;case"FILE":var r=_.default;(t=new r.SyncWriteStream(e,{autoClose:!1}))._type="fs";break;case"PIPE":case"TCP":r=w.default;(t=new r.Socket({fd:e,readable:!1,writable:!0})).readable=!1,t.read=null,t._type="pipe",t._handle&&t._handle.unref&&t._handle.unref();break;default:throw new Error("Implement me. Unknown stream file type!")}return t.fd=e,t._isStdio=!0,t}(t);function n(){return process.env.DEBUG}o.formatters.o=function(e){return this.inspectOpts.colors=this.useColors,v.default.inspect(e,this.inspectOpts).split("\n").map(function(e){return e.trim()}).join(" ")},o.formatters.O=function(e){return this.inspectOpts.colors=this.useColors,v.default.inspect(e,this.inspectOpts)},o.enable(n())});se.init,se.log,se.formatArgs,se.save,se.load,se.useColors,se.colors,se.inspectOpts;function ie(){if(!ae)try{ae=ue("follow-redirects")}catch(e){ae=function(){}}ae.apply(null,arguments)}var ae,ue=K(function(e){"undefined"!=typeof process&&"renderer"===process.type?e.exports=oe:e.exports=se}),ce=y.default.URL,fe=n.default.Writable,de=Object.create(null);["abort","aborted","connect","error","socket","timeout"].forEach(function(n){de[n]=function(e,t,r){this._redirectable.emit(n,e,t,r)}});var pe=we("ERR_FR_REDIRECTION_FAILURE",""),le=we("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded"),he=we("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),me=we("ERR_STREAM_WRITE_AFTER_END","write after end");function ge(e,t){fe.call(this),this._sanitizeOptions(e),this._options=e,this._ended=!1,this._ending=!1,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],t&&this.on("response",t);var r=this;this._onNativeResponse=function(e){r._processResponse(e)},this._performRequest()}function ye(r){var s={maxRedirects:21,maxBodyLength:10485760},i={};return Object.keys(r).forEach(function(e){var o=e+":",t=i[o]=r[e],n=s[e]=Object.create(t);Object.defineProperties(n,{request:{value:function(t,e,r){if("string"==typeof t){var n=t;try{t=ve(new ce(n))}catch(e){t=y.default.parse(n)}}else t=ce&&t instanceof ce?ve(t):(r=e,e=t,{protocol:o});return"function"==typeof e&&(r=e,e=null),(e=Object.assign({maxRedirects:s.maxRedirects,maxBodyLength:s.maxBodyLength},t,e)).nativeProtocols=i,h.default.equal(e.protocol,o,"protocol mismatch"),ie("options",e),new ge(e,r)},configurable:!0,enumerable:!0,writable:!0},get:{value:function(e,t,r){return(r=n.request(e,t,r)).end(),r},configurable:!0,enumerable:!0,writable:!0}})}),s}function be(){}function ve(e){var t={protocol:e.protocol,hostname:e.hostname.startsWith("[")?e.hostname.slice(1,-1):e.hostname,hash:e.hash,search:e.search,pathname:e.pathname,path:e.pathname+e.search,href:e.href};return""!==e.port&&(t.port=Number(e.port)),t}function _e(e,t){var r,n;for(n in t)e.test(n)&&(r=t[n],delete t[n]);return r}function we(e,t){function r(e){Error.captureStackTrace(this,this.constructor),this.message=e||t}return((r.prototype=new Error).constructor=r).prototype.name="Error ["+e+"]",r.prototype.code=e,r}(ge.prototype=Object.create(fe.prototype)).abort=function(){this._currentRequest.removeAllListeners(),this._currentRequest.on("error",be),this._currentRequest.abort(),this.emit("abort"),this.removeAllListeners()},ge.prototype.write=function(e,t,r){if(this._ending)throw new me;if(!("string"==typeof e||"object"==typeof e&&"length"in e))throw new TypeError("data should be a string, Buffer or Uint8Array");"function"==typeof t&&(r=t,t=null),0!==e.length?this._requestBodyLength+e.length<=this._options.maxBodyLength?(this._requestBodyLength+=e.length,this._requestBodyBuffers.push({data:e,encoding:t}),this._currentRequest.write(e,t,r)):(this.emit("error",new he),this.abort()):r&&r()},ge.prototype.end=function(e,t,r){var n,o;"function"==typeof e?(r=e,e=t=null):"function"==typeof t&&(r=t,t=null),e?(o=(n=this)._currentRequest,this.write(e,t,function(){n._ended=!0,o.end(null,null,r)}),this._ending=!0):(this._ended=this._ending=!0,this._currentRequest.end(null,null,r))},ge.prototype.setHeader=function(e,t){this._options.headers[e]=t,this._currentRequest.setHeader(e,t)},ge.prototype.removeHeader=function(e){delete this._options.headers[e],this._currentRequest.removeHeader(e)},ge.prototype.setTimeout=function(e,t){var r=this;function n(){r._timeout&&clearTimeout(r._timeout),r._timeout=setTimeout(function(){r.emit("timeout"),o()},e)}function o(){clearTimeout(this._timeout),t&&r.removeListener("timeout",t),this.socket||r._currentRequest.removeListener("socket",n)}return t&&this.on("timeout",t),this.socket?n():this._currentRequest.once("socket",n),this.once("response",o),this.once("error",o),this},["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach(function(r){ge.prototype[r]=function(e,t){return this._currentRequest[r](e,t)}}),["aborted","connection","socket"].forEach(function(e){Object.defineProperty(ge.prototype,e,{get:function(){return this._currentRequest[e]}})}),ge.prototype._sanitizeOptions=function(e){var t;e.headers||(e.headers={}),e.host&&(e.hostname||(e.hostname=e.host),delete e.host),!e.pathname&&e.path&&((t=e.path.indexOf("?"))<0?e.pathname=e.path:(e.pathname=e.path.substring(0,t),e.search=e.path.substring(t)))},ge.prototype._performRequest=function(){var e,t=this._options.protocol,r=this._options.nativeProtocols[t];if(r){this._options.agents&&(e=t.substr(0,t.length-1),this._options.agent=this._options.agents[e]);var n,o,s,i,a=this._currentRequest=r.request(this._options,this._onNativeResponse);for(n in this._currentUrl=y.default.format(this._options),a._redirectable=this,de)n&&a.on(n,de[n]);this._isRedirect&&(o=0,i=(s=this)._requestBodyBuffers,function e(t){a===s._currentRequest&&(t?s.emit("error",t):o<i.length?(t=i[o++],a.finished||a.write(t.data,t.encoding,e)):s._ended&&a.end())}())}else this.emit("error",new TypeError("Unsupported protocol "+t))},ge.prototype._processResponse=function(e){var t=e.statusCode;this._options.trackRedirects&&this._redirects.push({url:this._currentUrl,headers:e.headers,statusCode:t});var r=e.headers.location;if(r&&!1!==this._options.followRedirects&&300<=t&&t<400)if(this._currentRequest.removeAllListeners(),this._currentRequest.on("error",be),this._currentRequest.abort(),e.destroy(),++this._redirectCount>this._options.maxRedirects)this.emit("error",new le);else{(301!==t&&302!==t||"POST"!==this._options.method)&&(303!==t||/^(?:GET|HEAD)$/.test(this._options.method))||(this._options.method="GET",this._requestBodyBuffers=[],_e(/^content-/i,this._options.headers));t=_e(/^host$/i,this._options.headers)||y.default.parse(this._currentUrl).hostname,r=y.default.resolve(this._currentUrl,r);ie("redirecting to",r),this._isRedirect=!0;r=y.default.parse(r);if(Object.assign(this._options,r),r.hostname!==t&&_e(/^authorization$/i,this._options.headers),"function"==typeof this._options.beforeRedirect){var n={headers:e.headers};try{this._options.beforeRedirect.call(null,this._options,n)}catch(e){return void this.emit("error",e)}this._sanitizeOptions(this._options)}try{this._performRequest()}catch(e){n=new pe("Redirected request failed: "+e.message);n.cause=e,this.emit("error",n)}}else e.responseUrl=this._currentUrl,e.redirects=this._redirects,this.emit("response",e),this._requestBodyBuffers=[]};n=ye({http:m.default,https:g.default});n.wrap=ye;var xe,Re="axios@0.21.1",Ee="sha1-IlY0gZYvTWvemnbVFu8OXTwJsrg=",Oe={},Ce={type:"tag",registry:!0,raw:"axios",name:"axios",escapedName:"axios",rawSpec:"",saveSpec:null,fetchSpec:"latest"},ke=["#USER"],Ae="https://registry.npm.taobao.org/axios/download/axios-0.21.1.tgz?cache=0&sync_timestamp=1608609215811&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Faxios%2Fdownload%2Faxios-0.21.1.tgz",je="22563481962f4d6bde9a76d516ef0e5d3c09b2b8",Be="F:\\源码学习之旅\\vite-demo",qe={name:"Matt Zabriskie"},Se={"./lib/adapters/http.js":"./lib/adapters/xhr.js"},Te={url:"https://github.com/axios/axios/issues"},Ue=[{path:"./dist/axios.min.js",threshold:"5kB"}],Le={"follow-redirects":"^1.10.0"},Ne="Promise based HTTP client for the browser and node.js",De={bundlesize:"^0.17.0",coveralls:"^3.0.0","es6-promise":"^4.2.4",grunt:"^1.0.2","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^20.1.0","grunt-karma":"^2.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^1.0.18","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1",karma:"^1.3.0","karma-chrome-launcher":"^2.2.0","karma-coverage":"^1.1.1","karma-firefox-launcher":"^1.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-opera-launcher":"^1.0.0","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^1.2.0","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.7","karma-webpack":"^1.7.0","load-grunt-tasks":"^3.5.2",minimist:"^1.2.0",mocha:"^5.2.0",sinon:"^4.5.0",typescript:"^2.8.1","url-search-params":"^0.10.0",webpack:"^1.13.1","webpack-dev-server":"^1.14.1"},Pe="https://github.com/axios/axios",ze="dist/axios.min.js",Fe=["xhr","http","ajax","promise","node"],Me="index.js",He={type:"git",url:"git+https://github.com/axios/axios.git"},Ie={build:"NODE_ENV=production grunt build",coveralls:"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",examples:"node ./examples/server.js",fix:"eslint --fix lib/**/*.js",postversion:"git push && git push --tags",preversion:"npm test",start:"node ./sandbox/server.js",test:"grunt test && bundlesize",version:"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json"},$e="./index.d.ts",Ge="dist/axios.min.js",Xe=(xe=Object.freeze({__proto__:null,_from:"axios",_id:Re,_inBundle:!1,_integrity:Ee,_location:"/axios",_phantomChildren:Oe,_requested:Ce,_requiredBy:ke,_resolved:Ae,_shasum:je,_spec:"axios",_where:Be,author:qe,browser:Se,bugs:Te,bundleDependencies:!1,bundlesize:Ue,dependencies:Le,deprecated:!1,description:Ne,devDependencies:De,homepage:Pe,jsdelivr:ze,keywords:Fe,license:"MIT",main:Me,name:"axios",repository:He,scripts:Ie,typings:$e,unpkg:Ge,version:"0.21.1",default:{_from:"axios",_id:Re,_inBundle:!1,_integrity:Ee,_location:"/axios",_phantomChildren:Oe,_requested:Ce,_requiredBy:ke,_resolved:Ae,_shasum:je,_spec:"axios",_where:Be,author:qe,browser:Se,bugs:Te,bundleDependencies:!1,bundlesize:Ue,dependencies:Le,deprecated:!1,description:Ne,devDependencies:De,homepage:Pe,jsdelivr:ze,keywords:Fe,license:"MIT",main:Me,name:"axios",repository:He,scripts:Ie,typings:$e,unpkg:Ge,version:"0.21.1"}}))&&xe.default||xe,Je=n.http,We=n.https,Ye=/https:?/;function Ve(h){return new Promise(function(t,r){function s(e){t(e)}function i(e){r(e)}var e=h.data,n=h.headers;if(n["User-Agent"]||n["user-agent"]||(n["User-Agent"]="axios/"+Xe.version),e&&!S.isStream(e)){if(!Buffer.isBuffer(e))if(S.isArrayBuffer(e))e=Buffer.from(new Uint8Array(e));else{if(!S.isString(e))return i(F("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",h));e=Buffer.from(e,"utf-8")}n["Content-Length"]=e.length}var o=void 0;h.auth&&(o=(h.auth.username||"")+":"+(h.auth.password||""));var a=H(h.baseURL,h.url),u=y.default.parse(a),c=u.protocol||"http:";(o=!o&&u.auth?((p=u.auth.split(":"))[0]||"")+":"+(p[1]||""):o)&&delete n.Authorization;var f=Ye.test(c),d=f?h.httpsAgent:h.httpAgent,a={path:U(u.path,h.params,h.paramsSerializer).replace(/^\?/,""),method:h.method.toUpperCase(),headers:n,agent:d,agents:{http:h.httpAgent,https:h.httpsAgent},auth:o};h.socketPath?a.socketPath=h.socketPath:(a.hostname=u.hostname,a.port=u.port);var p=h.proxy;p||!1===p||(n=c.slice(0,-1)+"_proxy",(d=process.env[n]||process.env[n.toUpperCase()])&&(o=y.default.parse(d),n=!0,(n=(d=process.env.no_proxy||process.env.NO_PROXY)?!d.split(",").map(function(e){return e.trim()}).some(function(e){return!!e&&("*"===e||("."===e[0]&&u.hostname.substr(u.hostname.length-e.length)===e||u.hostname===e))}):n)&&(p={host:o.hostname,port:o.port,protocol:o.protocol},o.auth&&(o=o.auth.split(":"),p.auth={username:o[0],password:o[1]})))),p&&(a.headers.host=u.hostname+(u.port?":"+u.port:""),function t(e,r,n){e.hostname=r.host,e.host=r.host,e.port=r.port,e.path=n,r.auth&&(n=Buffer.from(r.auth.username+":"+r.auth.password,"utf8").toString("base64"),e.headers["Proxy-Authorization"]="Basic "+n),e.beforeRedirect=function(e){e.headers.host=e.host,t(e,r,e.href)}}(a,p,c+"//"+u.hostname+(u.port?":"+u.port:"")+a.path));var p=f&&(!p||Ye.test(p.protocol)),p=h.transport||(0===h.maxRedirects?(p?g:m).default:(h.maxRedirects&&(a.maxRedirects=h.maxRedirects),p?We:Je));-1<h.maxBodyLength&&(a.maxBodyLength=h.maxBodyLength);var l=p.request(a,function(e){if(!l.aborted){var t=e,r=e.req||l;if(204!==e.statusCode&&"HEAD"!==r.method&&!1!==h.decompress)switch(e.headers["content-encoding"]){case"gzip":case"compress":case"deflate":t=t.pipe(x.default.createUnzip()),delete e.headers["content-encoding"]}var n,o={status:e.statusCode,statusText:e.statusMessage,headers:e.headers,config:h,request:r};"stream"===h.responseType?(o.data=t,M(s,i,o)):(n=[],t.on("data",function(e){n.push(e),-1<h.maxContentLength&&Buffer.concat(n).length>h.maxContentLength&&(t.destroy(),i(F("maxContentLength size of "+h.maxContentLength+" exceeded",h,null,r)))}),t.on("error",function(e){l.aborted||i(z(e,h,null,r))}),t.on("end",function(){var e=Buffer.concat(n);"arraybuffer"!==h.responseType&&(e=e.toString(h.responseEncoding),h.responseEncoding&&"utf8"!==h.responseEncoding||(e=S.stripBOM(e))),o.data=e,M(s,i,o)}))}});l.on("error",function(e){l.aborted&&"ERR_FR_TOO_MANY_REDIRECTS"!==e.code||i(z(e,h,null,l))}),h.timeout&&l.setTimeout(h.timeout,function(){l.abort(),i(F("timeout of "+h.timeout+"ms exceeded",h,"ECONNABORTED",l))}),h.cancelToken&&h.cancelToken.promise.then(function(e){l.aborted||(l.abort(),i(e))}),S.isStream(e)?e.on("error",function(e){i(z(e,h,null,l))}).pipe(l):l.end(e)})}var Ze={"Content-Type":"application/x-www-form-urlencoded"};function Ke(e,t){!S.isUndefined(e)&&S.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var Qe,et={adapter:("undefined"!=typeof XMLHttpRequest?Qe=Z:"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process)&&(Qe=Ve),Qe),transformRequest:[function(e,t){return P(t,"Accept"),P(t,"Content-Type"),S.isFormData(e)||S.isArrayBuffer(e)||S.isBuffer(e)||S.isStream(e)||S.isFile(e)||S.isBlob(e)?e:S.isArrayBufferView(e)?e.buffer:S.isURLSearchParams(e)?(Ke(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):S.isObject(e)?(Ke(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return 200<=e&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};S.forEach(["delete","get","head"],function(e){et.headers[e]={}}),S.forEach(["post","put","patch"],function(e){et.headers[e]=S.merge(Ze)});var tt=et;function rt(e){e.cancelToken&&e.cancelToken.throwIfRequested()}function nt(t){return rt(t),t.headers=t.headers||{},t.data=N(t.data,t.headers,t.transformRequest),t.headers=S.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),S.forEach(["delete","get","head","post","put","patch","common"],function(e){delete t.headers[e]}),(t.adapter||tt.adapter)(t).then(function(e){return rt(t),e.data=N(e.data,e.headers,t.transformResponse),e},function(e){return D(e)||(rt(t),e&&e.response&&(e.response.data=N(e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)})}function ot(t,r){r=r||{};var n={},e=["url","method","data"],o=["headers","auth","proxy","params"],s=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],i=["validateStatus"];function a(e,t){return S.isPlainObject(e)&&S.isPlainObject(t)?S.merge(e,t):S.isPlainObject(t)?S.merge({},t):S.isArray(t)?t.slice():t}function u(e){S.isUndefined(r[e])?S.isUndefined(t[e])||(n[e]=a(void 0,t[e])):n[e]=a(t[e],r[e])}S.forEach(e,function(e){S.isUndefined(r[e])||(n[e]=a(void 0,r[e]))}),S.forEach(o,u),S.forEach(s,function(e){S.isUndefined(r[e])?S.isUndefined(t[e])||(n[e]=a(void 0,t[e])):n[e]=a(void 0,r[e])}),S.forEach(i,function(e){e in r?n[e]=a(t[e],r[e]):e in t&&(n[e]=a(void 0,t[e]))});var c=e.concat(o).concat(s).concat(i),i=Object.keys(t).concat(Object.keys(r)).filter(function(e){return-1===c.indexOf(e)});return S.forEach(i,u),n}function st(e){this.defaults=e,this.interceptors={request:new X,response:new X}}st.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=ot(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[nt,void 0],r=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)r=r.then(t.shift(),t.shift());return r},st.prototype.getUri=function(e){return e=ot(this.defaults,e),U(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},S.forEach(["delete","get","head","options"],function(r){st.prototype[r]=function(e,t){return this.request(ot(t||{},{method:r,url:e,data:(t||{}).data}))}}),S.forEach(["post","put","patch"],function(n){st.prototype[n]=function(e,t,r){return this.request(ot(r||{},{method:n,url:e,data:t}))}});var it=st;function at(e){this.message=e}at.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},at.prototype.__CANCEL__=!0;var ut=at;function ct(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(e){t=e});var r=this;e(function(e){r.reason||(r.reason=new ut(e),t(r.reason))})}ct.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},ct.source=function(){var t;return{token:new ct(function(e){t=e}),cancel:t}};n=ct;function ft(e){var t=new it(e),e=l(it.prototype.request,t);return S.extend(e,it.prototype,t),S.extend(e,t),e}var dt=ft(tt);dt.Axios=it,dt.create=function(e){return ft(ot(dt.defaults,e))},dt.Cancel=ut,dt.CancelToken=n,dt.isCancel=D,dt.all=function(e){return Promise.all(e)},dt.spread=function(t){return function(e){return t.apply(null,e)}},dt.isAxiosError=function(e){return"object"==typeof e&&!0===e.isAxiosError};n=dt;n.default=dt;var pt=n;let lt=process.argv[2]||"C:\\Windows\\System32\\drivers\\etc";Promise.all([(async()=>{let e=await pt.get("https://github.com.ipaddress.com/");return[e.data.match(/(?<=\.com\/ipv4\/)[\d\.]+/g)[0],"github.com"]})(),(async()=>{let e=await pt.get("https://fastly.net.ipaddress.com/github.global.ssl.fastly.net");return[e.data.match(/(?<=\.com\/ipv4\/)[\d\.]+/g)[0],"github.global.ssl.fastly.net"]})(),(async()=>{let e=await pt.get("https://github.com.ipaddress.com/assets-cdn.github.com");var t=e.data.match(/(?<=\.com\/ipv4\/)[\d\.]+/g);return[...new Set(t)].map(e=>[e,"assets-cdn.github.com"])})()]).then(e=>{e=[e[0],e[1],...e[2]],e=ht(e);console.log(e),mt(e)});const ht=e=>{let t="";return e.forEach(e=>{t+=e[0]+" "+e[1]+"\n"}),t},mt=e=>{var t=R.default.join(lt,"hosts");let r=_.default.readFileSync(t,"utf-8"),n=e;e=`
#tag_start
${e}
#tag_end
`;n=-1<r.indexOf("#tag_start")?r.replace(/#tag_start[\s\S]+#tag_end/gi,e):r+e,_.default.writeFile(t,n,e=>{let t="";e?console.log(e):t=E.default.execSync("ipconfig /flushdns").toString().trim(),console.error(t?"修改host文件并刷新dns成功":"刷新dns失败")})};return{}});