1// [email protected] downloaded from https://ga.jspm.io/npm:@jspm/[email protected]/nodelibs/browser/https.js 2 3import{b as e,d as t}from"../../_/B-JI4xyp.js";import{d as r}from"../../_/Cu0WWfMI.js";import{p as o}from"../../_/I5E9Rhyf.js";import{h as n}from"../../_/MKtoJqcs.js";import"../../_/BmrxORgg.js";import"../../_/DIT-oeS_.js";var a={},s=false;var i=typeof globalThis!=="undefined"?globalThis:typeof self!=="undefined"?self:global;function dew$5(){if(s)return a;s=true;a.fetch=isFunction(i.fetch)&&isFunction(i.ReadableStream);a.writableStream=isFunction(i.WritableStream);a.abortController=isFunction(i.AbortController);var e;function getXHR(){if(e!==void 0)return e;if(i.XMLHttpRequest){e=new i.XMLHttpRequest;try{e.open("GET",i.XDomainRequest?"/":"https://example.com")}catch(t){e=null}}else e=null;return e}function checkTypeSupport(e){var t=getXHR();if(!t)return false;try{t.responseType=e;return t.responseType===e}catch(e){}return false}a.arraybuffer=a.fetch||checkTypeSupport("arraybuffer");a.msstream=!a.fetch&&checkTypeSupport("ms-stream");
3a.mozchunkedarraybuffer=!a.fetch&&checkTypeSupport("moz-chunked-arraybuffer");a.overrideMimeType=a.fetch||!!getXHR()&&isFunction(getXHR().overrideMimeType);function isFunction(e){return typeof e==="function"}e=null;return a}var u={},d=false;var c=typeof globalThis!=="undefined"?globalThis:typeof self!=="undefined"?self:global;function dew$4(){if(d)return u;d=true;var n=e.Buffer;var a=o;var s=dew$5();var i=t();var l=r();var f=u.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4};var p=u.IncomingMessage=function(e,t,r,o){var i=this||c;l.Readable.call(i);i._mode=r;i.headers={};i.rawHeaders=[];i.trailers={};i.rawTrailers=[];i.on("end",(function(){a.nextTick((function(){i.emit("close")}))}));if(r==="fetch"){i._fetchResponse=t;i.url=t.url;i.statusCode=t.status;i.statusMessage=t.statusText;t.headers.forEach((function(e,t){i.headers[t.toLowerCase()]=e;i.rawHeaders.push(t,e)}));if(s.writableStream){var u=new WritableStream({write:function(e){o(false);return new Promise((function(t,r){i._destroyed?r():i.push(n.from(e))?t():i._resumeFetch=t}))},close:function(){o(true);i._destroyed||i.push(null)},abort:function(e){o(true);i._destroyed||i.emit("error",e)}});try{t.body.pipeTo(u).catch((function(e){o(true);i._destroyed||i.emit("error",e)}));return}catch(m){}}var d=t.body.getReader();function read(){d.read().then((function(e){if(!i._destroyed){o(e.done);if(e.done)i.push(null);else{i.push(n.from(e.value));read()}}})).catch((function(e){o(true);i._destroyed||i.emit("error",e)}))}read()}else{i._xhr=e;i._pos=0;i.url=e.responseURL;i.statusCode=e.status;i.statusMessage=e.statusText;var f=e.getAllResponseHeaders().split(/\r?\n/);f.forEach((function(e){var t=e.match(/^([^:]+):\s*(.*)/);if(t){var r=t[1].toLowerCase();if(r==="set-cookie"){i.headers[r]===void 0&&(i.headers[r]=[]);i.headers[r].push(t[2])}else i.headers[r]!==void 0?i.headers[r]+=", "+t[2]:i.headers[r]=t[2];i.rawHeaders.push(t[1],t[2])}}));i._charset="x-user-defined";if(!s.overrideMimeType){var p=i.rawHeaders["mime-type"];if(p){var h=p.match(/;\s*charset=([^;])(;|$)/);h&&(i._charset=h[1].toLowerCase())}i._charset||(i._charset="utf-8")}}};i(p,l.Readable);p.prototype._read=function(){var e=this||c;var t=e._resumeFetch;if(t){e._resumeFetch=null;t()}};p.prototype._onXHRProgress=function(e){var t=this||c;var r=t._xhr;var o=null;switch(t._mode){case"text":o=r.responseText;if(o.length>t._pos){var a=o.substr(t._pos);if(t._charset==="x-user-defined"){var s=n.alloc(a.length);for(var i=0;i<a.length;i++)s[i]=a.charCodeAt(i)&255;t.push(s)}else t.push(a,t._charset);t._pos=o.length}break;case"arraybuffer":if(r.readyState!==f.DONE||!r.response)break;o=r.response;t.push(n.from(new Uint8Array(o)));break;case"moz-chunked-arraybuffer":o=r.response;if(r.readyState!==f.LOADING||!o)break;t.push(n.from(new Uint8Array(o)));break;case"ms-stream":o=r.response;if(r.readyState!==f.LOADING)break;var u=new c.MSStreamReader;u.onprogress=function(){if(u.result.byteLength>t._pos){t.push(n.from(new Uint8Array(u.result.slice(t._pos))));t._pos=u.result.byteLength}};u.onload=function(){e(true);t.push(null)};u.readAsArrayBuffer(o);break}if(t._xhr.readyState===f.DONE&&t._mode!=="ms-stream"){e(true);t.push(null)}};return u}var l={},f=false;var p=typeof globalThis!=="undefined"?globalThis:typeof self!=="undefined"?self:global;function dew$3(){if(f)return l;f=true;var n=e.Buffer;var a=o;var s=dew$5();var i=t();var u=dew$4();var d=r();var c=u.IncomingMessage;var h=u.readyStates;function decideMode(e,t){return s.fetch&&t?"fetch":s.mozchunkedarraybuffer?"moz-chunked-arraybuffer":s.msstream?"ms-stream":s.arraybuffer&&e?"arraybuffer":"text"}var m=l=function(e){var t=this||p;d.Writable.call(t);t._opts=e;t._body=[];t._headers={};e.auth&&t.setHeader("Authorization","Basic "+n.from(e.auth).toString("base64"));Object.keys(e.headers).forEach((function(r){t.setHeader(r,e.headers[r])}));var r;var o=true;if(e.mode==="disable-fetch"||"requestTimeout"in e&&!s.abortController){o=false;r=true}else if(e.mode==="prefer-streaming")r=false;else if(e.mode==="allow-wrong-content-type")r=!s.overrideMimeType;else{if(e.mode&&e.mode!=="default"&&e.mode!=="prefer-fast")throw new Error("Invalid value for opts.mode");r=true}t._mode=decideMode(r,o);t._fetchTimer=null;t._socketTimeout=null;t._socketTimer=null;t.on("finish",(function(){t._onFinish()}))};i(m,d.Writable);m.prototype.setHeader=function(e,t){var r=this||p;var o=e.toLowerCase();v.indexOf(o)===-1&&(r._headers[o]={name:e,value:t})};m.prototype.getHeader=function(e){var t=(this||p)._headers[e.toLowerCase()];return t?t.value:null};m.prototype.removeHeader=function(e){var t=this||p;delete t._headers[e.toLowerCase()]};m.prototype._onFinish=function(){var e=this||p;
3if(!e._destroyed){var t=e._opts;"timeout"in t&&t.timeout!==0&&e.setTimeout(t.timeout);var r=e._headers;var o=null;t.method!=="GET"&&t.method!=="HEAD"&&(o=new Blob(e._body,{type:(r["content-type"]||{}).value||""}));var n=[];Object.keys(r).forEach((function(e){var t=r[e].name;var o=r[e].value;Array.isArray(o)?o.forEach((function(e){n.push([t,e])})):n.push([t,o])}));if(e._mode==="fetch"){var i=null;if(s.abortController){var u=new AbortController;i=u.signal;e._fetchAbortController=u;"requestTimeout"in t&&t.requestTimeout!==0&&(e._fetchTimer=p.setTimeout((function(){e.emit("requestTimeout");e._fetchAbortController&&e._fetchAbortController.abort()}),t.requestTimeout))}p.fetch(e._opts.url,{method:e._opts.method,headers:n,body:o||void 0,mode:"cors",credentials:t.withCredentials?"include":"same-origin",signal:i}).then((function(t){e._fetchResponse=t;e._resetTimers(false);e._connect()}),(function(t){e._resetTimers(true);e._destroyed||e.emit("error",t)}))}else{var d=e._xhr=new p.XMLHttpRequest;try{d.open(e._opts.method,e._opts.url,true)}catch(t){a.nextTick((function(){e.emit("error",t)}));return}"responseType"in d&&(d.responseType=e._mode);"withCredentials"in d&&(d.withCredentials=!!t.withCredentials);e._mode==="text"&&"overrideMimeType"in d&&d.overrideMimeType("text/plain; charset=x-user-defined");if("requestTimeout"in t){d.timeout=t.requestTimeout;d.ontimeout=function(){e.emit("requestTimeout")}}n.forEach((function(e){d.setRequestHeader(e[0],e[1])}));e._response=null;d.onreadystatechange=function(){switch(d.readyState){case h.LOADING:case h.DONE:e._onXHRProgress();break}};e._mode==="moz-chunked-arraybuffer"&&(d.onprogress=function(){e._onXHRProgress()});d.onerror=function(){if(!e._destroyed){e._resetTimers(true);e.emit("error",new Error("XHR error"))}};try{d.send(o)}catch(t){a.nextTick((function(){e.emit("error",t)}));return}}}};function statusValid(e){try{var t=e.status;return t!==null&&t!==0}catch(e){return false}}m.prototype._onXHRProgress=function(){var e=this||p;e._resetTimers(false);if(statusValid(e._xhr)&&!e._destroyed){e._response||e._connect();e._response._onXHRProgress(e._resetTimers.bind(e))}};m.prototype._connect=function(){var e=this||p;if(!e._destroyed){e._response=new c(e._xhr,e._fetchResponse,e._mode,e._resetTimers.bind(e));e._response.on("error",(function(t){e.emit("error",t)}));e.emit("response",e._response)}};m.prototype._write=function(e,t,r){var o=this||p;o._body.push(e);r()};m.prototype._resetTimers=function(e){var t=this||p;p.clearTimeout(t._socketTimer);t._socketTimer=null;if(e){p.clearTimeout(t._fetchTimer);t._fetchTimer=null}else t._socketTimeout&&(t._socketTimer=p.setTimeout((function(){t.emit("timeout")}),t._socketTimeout))};m.prototype.abort=m.prototype.destroy=function(e){var t=this||p;t._destroyed=true;t._resetTimers(true);t._response&&(t._response._destroyed=true);t._xhr?t._xhr.abort():t._fetchAbortController&&t._fetchAbortController.abort();e&&t.emit("error",e)};m.prototype.end=function(e,t,r){var o=this||p;if(typeof e==="function"){r=e;e=void 0}d.Writable.prototype.end.call(o,e,t,r)};m.prototype.setTimeout=function(e,t){var r=this||p;t&&r.once("timeout",t);r._socketTimeout=e;r._resetTimers(false)};m.prototype.flushHeaders=function(){};m.prototype.setNoDelay=function(){};m.prototype.setSocketKeepAlive=function(){};var v=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"];return l}var h={},m=false;function dew$2(){if(m)return h;m=true;h=extend;var e=Object.prototype.hasOwnProperty;function extend(){var t={};for(var r=0;r<arguments.length;r++){var o=arguments[r];for(var n in o)e.call(o,n)&&(t[n]=o[n])}return t}return h}var v={},y=false;function dew$1(){if(y)return v;y=true;v={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Depen
3dency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"};return v}var _={},T=false;var g=typeof globalThis!=="undefined"?globalThis:typeof self!=="undefined"?self:global;function dew$6(){if(T)return _;T=true;var e=dew$3();var t=dew$4();var r=dew$2();var o=dew$1();var a=n;var s=_;s.request=function(t,o){t=typeof t==="string"?a.parse(t):r(t);var n=g.location.protocol.search(/^https?:$/)===-1?"http:":"";var s=t.protocol||n;var i=t.hostname||t.host;var u=t.port;var d=t.path||"/";i&&i.indexOf(":")!==-1&&(i="["+i+"]");t.url=(i?s+"//"+i:"")+(u?":"+u:"")+d;t.method=(t.method||"GET").toUpperCase();t.headers=t.headers||{};var c=new e(t);o&&c.on("response",o);return c};s.get=function get(e,t){var r=s.request(e,t);r.end();return r};s.ClientRequest=e;s.IncomingMessage=t.IncomingMessage;s.Agent=function(){};s.Agent.defaultMaxSockets=4;s.globalAgent=new s.Agent;s.STATUS_CODES=o;s.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"];return _}const b=dew$6();b.Agent;b.ClientRequest;b.IncomingMessage;b.METHODS;b.STATUS_CODES;b.get;b.globalAgent;b.request;var w={},R=false;var C=typeof globalThis!=="undefined"?globalThis:typeof self!=="undefined"?self:global;function dew(){if(R)return w;R=true;var e=b;var t=n;var r=w;for(var o in e)e.hasOwnProperty(o)&&(r[o]=e[o]);r.request=function(t,r){t=validateParams(t);return e.request.call(this||C,t,r)};r.get=function(t,r){t=validateParams(t);return e.get.call(this||C,t,r)};function validateParams(e){typeof e==="string"&&(e=t.parse(e));e.protocol||(e.protocol="https:");if(e.protocol!=="https:")throw new Error('Protocol "'+e.protocol+'" not supported. Expected "https:"');return e}return w}const E=dew();var S=E.Agent;var A=E.ClientRequest;var k=E.IncomingMessage;var H=E.METHODS;var M=E.STATUS_CODES;var O=E.get;var P=E.globalAgent;var q=E.request;export{S as Agent,A as ClientRequest,k as IncomingMessage,H as METHODS,M as STATUS_CODES,E as default,O as get,P as globalAgent,q as request}; 4
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.