@ienlab/cloud-functions-library 0.9.6 → 1.0.0-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__vite-browser-external-c_Pnnbav.mjs +25 -0
- package/dist/__vite-browser-external-icTJPY3u.js +1 -0
- package/dist/from-CGKydphu.js +4 -0
- package/dist/from-D3dnKIVz.mjs +2454 -0
- package/dist/index.d.ts +16 -17
- package/dist/index.js +49 -1
- package/dist/index.mjs +40120 -3
- package/dist/multipart-parser-Bd_iuhOs.js +2 -0
- package/dist/multipart-parser-D-9NRMvP.js +2 -0
- package/dist/multipart-parser-D5aOiPJs.mjs +149 -0
- package/dist/multipart-parser-SLKKVZku.mjs +149 -0
- package/dist/src-465bV1ib.js +3 -0
- package/dist/src-CKwZC3do.mjs +665 -0
- package/dist/src-DC-TnI7x.js +3 -0
- package/dist/src-DHa4ViES.mjs +665 -0
- package/package.json +16 -18
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const e=require("./__vite-browser-external-icTJPY3u.js"),t=require("./from-CGKydphu.js");var n,r=e.r((()=>{n=class extends Error{constructor(e,t){super(e),Error.captureStackTrace(this,this.constructor),this.type=t}get name(){return this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}}})),i,a=e.r((()=>{r(),i=class extends n{constructor(e,t,n){super(e,t),n&&(this.code=this.errno=n.code,this.erroredSysCall=n.syscall)}}})),o,s,c,l,u,d,f=e.r((()=>{o=Symbol.toStringTag,s=e=>typeof e==`object`&&typeof e.append==`function`&&typeof e.delete==`function`&&typeof e.get==`function`&&typeof e.getAll==`function`&&typeof e.has==`function`&&typeof e.set==`function`&&typeof e.sort==`function`&&e[o]===`URLSearchParams`,c=e=>e&&typeof e==`object`&&typeof e.arrayBuffer==`function`&&typeof e.type==`string`&&typeof e.stream==`function`&&typeof e.constructor==`function`&&/^(Blob|File)$/.test(e[o]),l=e=>typeof e==`object`&&(e[o]===`AbortSignal`||e[o]===`EventTarget`),u=(e,t)=>{let n=new URL(t).hostname,r=new URL(e).hostname;return n===r||n.endsWith(`.${r}`)},d=(e,t)=>new URL(t).protocol===new URL(e).protocol}));async function p(e){if(e[v].disturbed)throw TypeError(`body used already for: ${e.url}`);if(e[v].disturbed=!0,e[v].error)throw e[v].error;let{body:t}=e;if(t===null||!(t instanceof m.default))return g.Buffer.alloc(0);let r=[],a=0;try{for await(let n of t){if(e.size>0&&a+n.length>e.size){let n=new i(`content size at ${e.url} over limit: ${e.size}`,`max-size`);throw t.destroy(n),n}a+=n.length,r.push(n)}}catch(t){throw t instanceof n?t:new i(`Invalid response body while trying to fetch ${e.url}: ${t.message}`,`system`,t)}if(t.readableEnded===!0||t._readableState.ended===!0)try{return r.every(e=>typeof e==`string`)?g.Buffer.from(r.join(``)):g.Buffer.concat(r,a)}catch(t){throw new i(`Could not create Buffer from response body for ${e.url}: ${t.message}`,`system`,t)}else throw new i(`Premature close of server response while trying to fetch ${e.url}`)}var m,h,g,_,v,y,b,ee,x,te,S,C=e.r((()=>{m=e.o(e.t(),1),h=e.o(e.t(),1),g=e.o(e.t(),1),t.c(),t.i(),a(),r(),f(),_=(0,h.promisify)(m.default.pipeline),v=Symbol(`Body internals`),y=class{constructor(e,{size:r=0}={}){let a=null;e===null?e=null:s(e)?e=g.Buffer.from(e.toString()):c(e)||g.Buffer.isBuffer(e)||(h.types.isAnyArrayBuffer(e)?e=g.Buffer.from(e):ArrayBuffer.isView(e)?e=g.Buffer.from(e.buffer,e.byteOffset,e.byteLength):e instanceof m.default||(e instanceof t.n?(e=t.r(e),a=e.type.split(`=`)[1]):e=g.Buffer.from(String(e))));let o=e;g.Buffer.isBuffer(e)?o=m.default.Readable.from(e):c(e)&&(o=m.default.Readable.from(e.stream())),this[v]={body:e,stream:o,boundary:a,disturbed:!1,error:null},this.size=r,e instanceof m.default&&e.on(`error`,e=>{let t=e instanceof n?e:new i(`Invalid response body while trying to fetch ${this.url}: ${e.message}`,`system`,e);this[v].error=t})}get body(){return this[v].stream}get bodyUsed(){return this[v].disturbed}async arrayBuffer(){let{buffer:e,byteOffset:t,byteLength:n}=await p(this);return e.slice(t,t+n)}async formData(){let e=this.headers.get(`content-type`);if(e.startsWith(`application/x-www-form-urlencoded`)){let e=new t.n,n=new URLSearchParams(await this.text());for(let[t,r]of n)e.append(t,r);return e}let{toFormData:n}=await Promise.resolve().then(()=>require("./multipart-parser-Bd_iuhOs.js"));return n(this.body,e)}async blob(){let e=this.headers&&this.headers.get(`content-type`)||this[v].body&&this[v].body.type||``;return new t.s([await this.arrayBuffer()],{type:e})}async json(){let e=await this.text();return JSON.parse(e)}async text(){let e=await p(this);return new TextDecoder().decode(e)}buffer(){return p(this)}},y.prototype.buffer=(0,h.deprecate)(y.prototype.buffer,`Please use 'response.arrayBuffer()' instead of 'response.buffer()'`,`node-fetch#buffer`),Object.defineProperties(y.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:(0,h.deprecate)(()=>{},`data doesn't exist, use json(), text(), arrayBuffer(), or body instead`,`https://github.com/node-fetch/node-fetch/issues/1000 (response)`)}}),b=(e,t)=>{let n,r,{body:i}=e[v];if(e.bodyUsed)throw Error(`cannot clone body after it is used`);return i instanceof m.default&&typeof i.getBoundary!=`function`&&(n=new m.PassThrough({highWaterMark:t}),r=new m.PassThrough({highWaterMark:t}),i.pipe(n),i.pipe(r),e[v].stream=n,i=r),i},ee=(0,h.deprecate)(e=>e.getBoundary(),`form-data doesn't follow the spec and requires special treatment. Use alternative package`,`https://github.com/node-fetch/node-fetch/issues/1167`),x=(e,n)=>e===null?null:typeof e==`string`?`text/plain;charset=UTF-8`:s(e)?`application/x-www-form-urlencoded;charset=UTF-8`:c(e)?e.type||null:g.Buffer.isBuffer(e)||h.types.isAnyArrayBuffer(e)||ArrayBuffer.isView(e)?null:e instanceof t.n?`multipart/form-data; boundary=${n[v].boundary}`:e&&typeof e.getBoundary==`function`?`multipart/form-data;boundary=${ee(e)}`:e instanceof m.default?null:`text/plain;charset=UTF-8`,te=e=>{let{body:t}=e[v];return t===null?0:c(t)?t.size:g.Buffer.isBuffer(t)?t.length:t&&typeof t.getLengthSync==`function`&&t.hasKnownLength&&t.hasKnownLength()?t.getLengthSync():null},S=async(e,{body:t})=>{t===null?e.end():await _(t,e)}}));function ne(e=[]){return new O(e.reduce((e,t,n,r)=>(n%2==0&&e.push(r.slice(n,n+2)),e),[]).filter(([e,t])=>{try{return E(e),D(e,String(t)),!0}catch{return!1}}))}var w,T,E,D,O,k=e.r((()=>{w=e.o(e.t(),1),T=e.o(e.t(),1),E=typeof T.default.validateHeaderName==`function`?T.default.validateHeaderName:e=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test(e)){let t=TypeError(`Header name must be a valid HTTP token [${e}]`);throw Object.defineProperty(t,"code",{value:`ERR_INVALID_HTTP_TOKEN`}),t}},D=typeof T.default.validateHeaderValue==`function`?T.default.validateHeaderValue:(e,t)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(t)){let t=TypeError(`Invalid character in header content ["${e}"]`);throw Object.defineProperty(t,"code",{value:`ERR_INVALID_CHAR`}),t}},O=class e extends URLSearchParams{constructor(t){let n=[];if(t instanceof e){let e=t.raw();for(let[t,r]of Object.entries(e))n.push(...r.map(e=>[t,e]))}else if(t!=null)if(typeof t==`object`&&!w.types.isBoxedPrimitive(t)){let e=t[Symbol.iterator];if(e==null)n.push(...Object.entries(t));else{if(typeof e!=`function`)throw TypeError(`Header pairs must be iterable`);n=[...t].map(e=>{if(typeof e!=`object`||w.types.isBoxedPrimitive(e))throw TypeError(`Each header pair must be an iterable object`);return[...e]}).map(e=>{if(e.length!==2)throw TypeError(`Each header pair must be a name/value tuple`);return[...e]})}}else throw TypeError(`Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)`);return n=n.length>0?n.map(([e,t])=>(E(e),D(e,String(t)),[String(e).toLowerCase(),String(t)])):void 0,super(n),new Proxy(this,{get(e,t,n){switch(t){case`append`:case`set`:return(n,r)=>(E(n),D(n,String(r)),URLSearchParams.prototype[t].call(e,String(n).toLowerCase(),String(r)));case`delete`:case`has`:case`getAll`:return n=>(E(n),URLSearchParams.prototype[t].call(e,String(n).toLowerCase()));case`keys`:return()=>(e.sort(),new Set(URLSearchParams.prototype.keys.call(e)).keys());default:return Reflect.get(e,t,n)}}})}get[Symbol.toStringTag](){return this.constructor.name}toString(){return Object.prototype.toString.call(this)}get(e){let t=this.getAll(e);if(t.length===0)return null;let n=t.join(`, `);return/^content-encoding$/i.test(e)&&(n=n.toLowerCase()),n}forEach(e,t=void 0){for(let n of this.keys())Reflect.apply(e,t,[this.get(n),n,this])}*values(){for(let e of this.keys())yield this.get(e)}*entries(){for(let e of this.keys())yield[e,this.get(e)]}[Symbol.iterator](){return this.entries()}raw(){return[...this.keys()].reduce((e,t)=>(e[t]=this.getAll(t),e),{})}[Symbol.for(`nodejs.util.inspect.custom`)](){return[...this.keys()].reduce((e,t)=>{let n=this.getAll(t);return t===`host`?e[t]=n[0]:e[t]=n.length>1?n:n[0],e},{})}},Object.defineProperties(O.prototype,[`get`,`entries`,`forEach`,`values`].reduce((e,t)=>(e[t]={enumerable:!0},e),{}))})),A,j,M=e.r((()=>{A=new Set([301,302,303,307,308]),j=e=>A.has(e)})),N,P,re=e.r((()=>{k(),C(),M(),N=Symbol(`Response internals`),P=class e extends y{constructor(e=null,t={}){super(e,t);let n=t.status==null?200:t.status,r=new O(t.headers);if(e!==null&&!r.has(`Content-Type`)){let t=x(e,this);t&&r.append(`Content-Type`,t)}this[N]={type:`default`,url:t.url,status:n,statusText:t.statusText||``,headers:r,counter:t.counter,highWaterMark:t.highWaterMark}}get type(){return this[N].type}get url(){return this[N].url||``}get status(){return this[N].status}get ok(){return this[N].status>=200&&this[N].status<300}get redirected(){return this[N].counter>0}get statusText(){return this[N].statusText}get headers(){return this[N].headers}get highWaterMark(){return this[N].highWaterMark}clone(){return new e(b(this,this.highWaterMark),{type:this.type,url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected,size:this.size,highWaterMark:this.highWaterMark})}static redirect(t,n=302){if(!j(n))throw RangeError(`Failed to execute "redirect" on "response": Invalid status code`);return new e(null,{headers:{location:new URL(t).toString()},status:n})}static error(){let t=new e(null,{status:0,statusText:``});return t[N].type=`error`,t}static json(t=void 0,n={}){let r=JSON.stringify(t);if(r===void 0)throw TypeError(`data is not JSON serializable`);let i=new O(n&&n.headers);return i.has(`content-type`)||i.set(`content-type`,`application/json`),new e(r,{...n,headers:i})}get[Symbol.toStringTag](){return`Response`}},Object.defineProperties(P.prototype,{type:{enumerable:!0},url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}})})),F,ie=e.r((()=>{F=e=>{if(e.search)return e.search;let t=e.href.length-1,n=e.hash||(e.href[t]===`#`?`#`:``);return e.href[t-n.length]===`?`?`?`:``}}));function I(e,t=!1){return e==null||(e=new URL(e),/^(about|blob|data):$/.test(e.protocol))?`no-referrer`:(e.username=``,e.password=``,e.hash=``,t&&(e.pathname=``,e.search=``),e)}function ae(e){if(!z.has(e))throw TypeError(`Invalid referrerPolicy: ${e}`);return e}function oe(e){if(/^(http|ws)s:$/.test(e.protocol))return!0;let t=e.host.replace(/(^\[)|(]$)/g,``),n=(0,R.isIP)(t);return n===4&&/^127\./.test(t)||n===6&&/^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(t)?!0:e.host===`localhost`||e.host.endsWith(`.localhost`)?!1:e.protocol===`file:`}function L(e){return/^about:(blank|srcdoc)$/.test(e)||e.protocol===`data:`||/^(blob|filesystem):$/.test(e.protocol)?!0:oe(e)}function se(e,{referrerURLCallback:t,referrerOriginCallback:n}={}){if(e.referrer===`no-referrer`||e.referrerPolicy===``)return null;let r=e.referrerPolicy;if(e.referrer===`about:client`)return`no-referrer`;let i=e.referrer,a=I(i),o=I(i,!0);a.toString().length>4096&&(a=o),t&&(a=t(a)),n&&(o=n(o));let s=new URL(e.url);switch(r){case`no-referrer`:return`no-referrer`;case`origin`:return o;case`unsafe-url`:return a;case`strict-origin`:return L(a)&&!L(s)?`no-referrer`:o.toString();case`strict-origin-when-cross-origin`:return a.origin===s.origin?a:L(a)&&!L(s)?`no-referrer`:o;case`same-origin`:return a.origin===s.origin?a:`no-referrer`;case`origin-when-cross-origin`:return a.origin===s.origin?a:o;case`no-referrer-when-downgrade`:return L(a)&&!L(s)?`no-referrer`:a;default:throw TypeError(`Invalid referrerPolicy: ${r}`)}}function ce(e){let t=(e.get(`referrer-policy`)||``).split(/[,\s]+/),n=``;for(let e of t)e&&z.has(e)&&(n=e);return n}var R,z,B,V=e.r((()=>{R=e.o(e.t(),1),z=new Set([``,`no-referrer`,`no-referrer-when-downgrade`,`same-origin`,`origin`,`strict-origin`,`origin-when-cross-origin`,`strict-origin-when-cross-origin`,`unsafe-url`]),B=`strict-origin-when-cross-origin`})),H,U,W,G,K,q,J,le=e.r((()=>{H=e.o(e.t(),1),U=e.o(e.t(),1),k(),C(),f(),ie(),V(),W=Symbol(`Request internals`),G=e=>typeof e==`object`&&typeof e[W]==`object`,K=(0,U.deprecate)(()=>{},`.data is not a valid RequestInit property, use .body instead`,`https://github.com/node-fetch/node-fetch/issues/1000 (request)`),q=class e extends y{constructor(e,t={}){let n;if(G(e)?n=new URL(e.url):(n=new URL(e),e={}),n.username!==``||n.password!==``)throw TypeError(`${n} is an url with embedded credentials.`);let r=t.method||e.method||`GET`;if(/^(delete|get|head|options|post|put)$/i.test(r)&&(r=r.toUpperCase()),!G(t)&&`data`in t&&K(),(t.body!=null||G(e)&&e.body!==null)&&(r===`GET`||r===`HEAD`))throw TypeError(`Request with GET/HEAD method cannot have body`);let i=t.body?t.body:G(e)&&e.body!==null?b(e):null;super(i,{size:t.size||e.size||0});let a=new O(t.headers||e.headers||{});if(i!==null&&!a.has(`Content-Type`)){let e=x(i,this);e&&a.set(`Content-Type`,e)}let o=G(e)?e.signal:null;if(`signal`in t&&(o=t.signal),o!=null&&!l(o))throw TypeError(`Expected signal to be an instanceof AbortSignal or EventTarget`);let s=t.referrer==null?e.referrer:t.referrer;if(s===``)s=`no-referrer`;else if(s){let e=new URL(s);s=/^about:(\/\/)?client$/.test(e)?`client`:e}else s=void 0;this[W]={method:r,redirect:t.redirect||e.redirect||`follow`,headers:a,parsedURL:n,signal:o,referrer:s},this.follow=t.follow===void 0?e.follow===void 0?20:e.follow:t.follow,this.compress=t.compress===void 0?e.compress===void 0?!0:e.compress:t.compress,this.counter=t.counter||e.counter||0,this.agent=t.agent||e.agent,this.highWaterMark=t.highWaterMark||e.highWaterMark||16384,this.insecureHTTPParser=t.insecureHTTPParser||e.insecureHTTPParser||!1,this.referrerPolicy=t.referrerPolicy||e.referrerPolicy||``}get method(){return this[W].method}get url(){return(0,H.format)(this[W].parsedURL)}get headers(){return this[W].headers}get redirect(){return this[W].redirect}get signal(){return this[W].signal}get referrer(){if(this[W].referrer===`no-referrer`)return``;if(this[W].referrer===`client`)return`about:client`;if(this[W].referrer)return this[W].referrer.toString()}get referrerPolicy(){return this[W].referrerPolicy}set referrerPolicy(e){this[W].referrerPolicy=ae(e)}clone(){return new e(this)}get[Symbol.toStringTag](){return`Request`}},Object.defineProperties(q.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0},referrer:{enumerable:!0},referrerPolicy:{enumerable:!0}}),J=e=>{let{parsedURL:t}=e[W],n=new O(e[W].headers);n.has(`Accept`)||n.set(`Accept`,`*/*`);let r=null;if(e.body===null&&/^(post|put)$/i.test(e.method)&&(r=`0`),e.body!==null){let t=te(e);typeof t==`number`&&!Number.isNaN(t)&&(r=String(t))}r&&n.set(`Content-Length`,r),e.referrerPolicy===``&&(e.referrerPolicy=B),e.referrer&&e.referrer!==`no-referrer`?e[W].referrer=se(e):e[W].referrer=`no-referrer`,e[W].referrer instanceof URL&&n.set(`Referer`,e.referrer),n.has(`User-Agent`)||n.set(`User-Agent`,`node-fetch`),e.compress&&!n.has(`Accept-Encoding`)&&n.set(`Accept-Encoding`,`gzip, deflate, br`);let{agent:i}=e;typeof i==`function`&&(i=i(t));let a=F(t);return{parsedURL:t,options:{path:t.pathname+a,method:e.method,headers:n[Symbol.for(`nodejs.util.inspect.custom`)](),insecureHTTPParser:e.insecureHTTPParser,agent:i}}}})),Y,ue=e.r((()=>{r(),Y=class extends n{constructor(e,t=`aborted`){super(e,t)}}}));async function X(e,n){return new Promise((r,a)=>{let o=new q(e,n),{parsedURL:s,options:c}=J(o);if(!me.has(s.protocol))throw TypeError(`node-fetch cannot load ${e}. URL scheme "${s.protocol.replace(/:$/,``)}" is not supported.`);if(s.protocol===`data:`){let e=t.l(o.url);r(new P(e,{headers:{"Content-Type":e.typeFull}}));return}let l=(s.protocol===`https:`?pe.default:fe.default).request,{signal:f}=o,p=null,m=()=>{let e=new Y(`The operation was aborted.`);a(e),o.body&&o.body instanceof Q.default.Readable&&o.body.destroy(e),!(!p||!p.body)&&p.body.emit(`error`,e)};if(f&&f.aborted){m();return}let h=()=>{m(),_()},g=l(s.toString(),c);f&&f.addEventListener(`abort`,h);let _=()=>{g.abort(),f&&f.removeEventListener(`abort`,h)};g.on(`error`,e=>{a(new i(`request to ${o.url} failed, reason: ${e.message}`,`system`,e)),_()}),de(g,e=>{p&&p.body&&p.body.destroy(e)}),process.version<`v14`&&g.on(`socket`,e=>{let t;e.prependListener(`end`,()=>{t=e._eventsCount}),e.prependListener(`close`,n=>{if(p&&t<e._eventsCount&&!n){let e=Error(`Premature close`);e.code=`ERR_STREAM_PREMATURE_CLOSE`,p.body.emit(`error`,e)}})}),g.on(`response`,e=>{g.setTimeout(0);let t=ne(e.rawHeaders);if(j(e.statusCode)){let s=t.get(`Location`),c=null;try{c=s===null?null:new URL(s,o.url)}catch{if(o.redirect!==`manual`){a(new i(`uri requested responds with an invalid redirect URL: ${s}`,`invalid-redirect`)),_();return}}switch(o.redirect){case`error`:a(new i(`uri requested responds with a redirect, redirect mode is set to error: ${o.url}`,`no-redirect`)),_();return;case`manual`:break;case`follow`:{if(c===null)break;if(o.counter>=o.follow){a(new i(`maximum redirect reached at: ${o.url}`,`max-redirect`)),_();return}let s={headers:new O(o.headers),follow:o.follow,counter:o.counter+1,agent:o.agent,compress:o.compress,method:o.method,body:b(o),signal:o.signal,size:o.size,referrer:o.referrer,referrerPolicy:o.referrerPolicy};if(!u(o.url,c)||!d(o.url,c))for(let e of[`authorization`,`www-authenticate`,`cookie`,`cookie2`])s.headers.delete(e);if(e.statusCode!==303&&o.body&&n.body instanceof Q.default.Readable){a(new i(`Cannot follow redirect with body being a readable stream`,`unsupported-redirect`)),_();return}(e.statusCode===303||(e.statusCode===301||e.statusCode===302)&&o.method===`POST`)&&(s.method=`GET`,s.body=void 0,s.headers.delete(`content-length`));let l=ce(t);l&&(s.referrerPolicy=l),r(X(new q(c,s))),_();return}default:return a(TypeError(`Redirect option '${o.redirect}' is not a valid value of RequestRedirect`))}}f&&e.once(`end`,()=>{f.removeEventListener(`abort`,h)});let s=(0,Q.pipeline)(e,new Q.PassThrough,e=>{e&&a(e)});process.version<`v12.10`&&e.on(`aborted`,h);let c={url:o.url,status:e.statusCode,statusText:e.statusMessage,headers:t,size:o.size,counter:o.counter,highWaterMark:o.highWaterMark},l=t.get(`Content-Encoding`);if(!o.compress||o.method===`HEAD`||l===null||e.statusCode===204||e.statusCode===304){p=new P(s,c),r(p);return}let m={flush:Z.default.Z_SYNC_FLUSH,finishFlush:Z.default.Z_SYNC_FLUSH};if(l===`gzip`||l===`x-gzip`){s=(0,Q.pipeline)(s,Z.default.createGunzip(m),e=>{e&&a(e)}),p=new P(s,c),r(p);return}if(l===`deflate`||l===`x-deflate`){let t=(0,Q.pipeline)(e,new Q.PassThrough,e=>{e&&a(e)});t.once(`data`,e=>{s=(e[0]&15)==8?(0,Q.pipeline)(s,Z.default.createInflate(),e=>{e&&a(e)}):(0,Q.pipeline)(s,Z.default.createInflateRaw(),e=>{e&&a(e)}),p=new P(s,c),r(p)}),t.once(`end`,()=>{p||(p=new P(s,c),r(p))});return}if(l===`br`){s=(0,Q.pipeline)(s,Z.default.createBrotliDecompress(),e=>{e&&a(e)}),p=new P(s,c),r(p);return}p=new P(s,c),r(p)}),S(g,o).catch(a)})}function de(e,t){let n=$.Buffer.from(`0\r
|
|
2
|
+
\r
|
|
3
|
+
`),r=!1,i=!1,a;e.on(`response`,e=>{let{headers:t}=e;r=t[`transfer-encoding`]===`chunked`&&!t[`content-length`]}),e.on(`socket`,o=>{let s=()=>{if(r&&!i){let e=Error(`Premature close`);e.code=`ERR_STREAM_PREMATURE_CLOSE`,t(e)}},c=e=>{i=$.Buffer.compare(e.slice(-5),n)===0,!i&&a&&(i=$.Buffer.compare(a.slice(-3),n.slice(0,3))===0&&$.Buffer.compare(e.slice(-2),n.slice(3))===0),a=e};o.prependListener(`close`,s),o.on(`data`,c),e.on(`close`,()=>{o.removeListener(`close`,s),o.removeListener(`data`,c)})})}var fe,pe,Z,Q,$,me;e.r((()=>{fe=e.o(e.t(),1),pe=e.o(e.t(),1),Z=e.o(e.t(),1),Q=e.o(e.t(),1),$=e.o(e.t(),1),t.u(),C(),re(),k(),le(),a(),ue(),M(),t.i(),f(),V(),t.t(),me=new Set([`data:`,`http:`,`https:`])}))(),exports.default=X;
|