@ienlab/cloud-functions-library 0.9.6 → 1.0.0-dev.1

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.
@@ -0,0 +1,149 @@
1
+ import { r as e } from "./__vite-browser-external-C4yfM1ew.mjs";
2
+ import { a as t, i as n, n as r, t as i } from "./from-BPj5eOuj.mjs";
3
+ //#region node_modules/google-auth-library/node_modules/node-fetch/src/utils/multipart-parser.js
4
+ function a(e) {
5
+ let t = e.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);
6
+ if (!t) return;
7
+ let n = t[2] || t[3] || "", r = n.slice(n.lastIndexOf("\\") + 1);
8
+ return r = r.replace(/%22/g, "\""), r = r.replace(/&#(\d{4});/g, (e, t) => String.fromCharCode(t)), r;
9
+ }
10
+ async function o(e, n) {
11
+ if (!/multipart/i.test(n)) throw TypeError("Failed to fetch");
12
+ let i = n.match(/boundary=(?:"([^"]+)"|([^;]+))/i);
13
+ if (!i) throw TypeError("no or bad content-type header, no multipart boundary");
14
+ let o = new b(i[1] || i[2]), s, c, l, u, d, f, p = [], m = new r(), h = (e) => {
15
+ l += y.decode(e, { stream: !0 });
16
+ }, g = (e) => {
17
+ p.push(e);
18
+ }, _ = () => {
19
+ let e = new t(p, f, { type: d });
20
+ m.append(u, e);
21
+ }, v = () => {
22
+ m.append(u, l);
23
+ }, y = new TextDecoder("utf-8");
24
+ y.decode(), o.onPartBegin = function() {
25
+ o.onPartData = h, o.onPartEnd = v, s = "", c = "", l = "", u = "", d = "", f = null, p.length = 0;
26
+ }, o.onHeaderField = function(e) {
27
+ s += y.decode(e, { stream: !0 });
28
+ }, o.onHeaderValue = function(e) {
29
+ c += y.decode(e, { stream: !0 });
30
+ }, o.onHeaderEnd = function() {
31
+ if (c += y.decode(), s = s.toLowerCase(), s === "content-disposition") {
32
+ let e = c.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);
33
+ e && (u = e[2] || e[3] || ""), f = a(c), f && (o.onPartData = g, o.onPartEnd = _);
34
+ } else s === "content-type" && (d = c);
35
+ c = "", s = "";
36
+ };
37
+ for await (let t of e) o.write(t);
38
+ return o.end(), m;
39
+ }
40
+ var s, c, l, u, d, f, p, m, h, g, _, v, y, b;
41
+ //#endregion
42
+ e((() => {
43
+ i(), n(), s = 0, c = {
44
+ START_BOUNDARY: s++,
45
+ HEADER_FIELD_START: s++,
46
+ HEADER_FIELD: s++,
47
+ HEADER_VALUE_START: s++,
48
+ HEADER_VALUE: s++,
49
+ HEADER_VALUE_ALMOST_DONE: s++,
50
+ HEADERS_ALMOST_DONE: s++,
51
+ PART_DATA_START: s++,
52
+ PART_DATA: s++,
53
+ END: s++
54
+ }, l = 1, u = {
55
+ PART_BOUNDARY: l,
56
+ LAST_BOUNDARY: l *= 2
57
+ }, d = 10, f = 13, p = 32, m = 45, h = 58, g = 97, _ = 122, v = (e) => e | 32, y = () => {}, b = class {
58
+ constructor(e) {
59
+ this.index = 0, this.flags = 0, this.onHeaderEnd = y, this.onHeaderField = y, this.onHeadersEnd = y, this.onHeaderValue = y, this.onPartBegin = y, this.onPartData = y, this.onPartEnd = y, this.boundaryChars = {}, e = "\r\n--" + e;
60
+ let t = new Uint8Array(e.length);
61
+ for (let n = 0; n < e.length; n++) t[n] = e.charCodeAt(n), this.boundaryChars[t[n]] = !0;
62
+ this.boundary = t, this.lookbehind = new Uint8Array(this.boundary.length + 8), this.state = c.START_BOUNDARY;
63
+ }
64
+ write(e) {
65
+ let t = 0, n = e.length, r = this.index, { lookbehind: i, boundary: a, boundaryChars: o, index: s, state: l, flags: y } = this, b = this.boundary.length, x = b - 1, S = e.length, C, w, T = (e) => {
66
+ this[e + "Mark"] = t;
67
+ }, E = (e) => {
68
+ delete this[e + "Mark"];
69
+ }, D = (e, t, n, r) => {
70
+ (t === void 0 || t !== n) && this[e](r && r.subarray(t, n));
71
+ }, O = (n, r) => {
72
+ let i = n + "Mark";
73
+ i in this && (r ? (D(n, this[i], t, e), delete this[i]) : (D(n, this[i], e.length, e), this[i] = 0));
74
+ };
75
+ for (t = 0; t < n; t++) switch (C = e[t], l) {
76
+ case c.START_BOUNDARY:
77
+ if (s === a.length - 2) {
78
+ if (C === m) y |= u.LAST_BOUNDARY;
79
+ else if (C !== f) return;
80
+ s++;
81
+ break;
82
+ } else if (s - 1 == a.length - 2) {
83
+ if (y & u.LAST_BOUNDARY && C === m) l = c.END, y = 0;
84
+ else if (!(y & u.LAST_BOUNDARY) && C === d) s = 0, D("onPartBegin"), l = c.HEADER_FIELD_START;
85
+ else return;
86
+ break;
87
+ }
88
+ C !== a[s + 2] && (s = -2), C === a[s + 2] && s++;
89
+ break;
90
+ case c.HEADER_FIELD_START: l = c.HEADER_FIELD, T("onHeaderField"), s = 0;
91
+ case c.HEADER_FIELD:
92
+ if (C === f) {
93
+ E("onHeaderField"), l = c.HEADERS_ALMOST_DONE;
94
+ break;
95
+ }
96
+ if (s++, C === m) break;
97
+ if (C === h) {
98
+ if (s === 1) return;
99
+ O("onHeaderField", !0), l = c.HEADER_VALUE_START;
100
+ break;
101
+ }
102
+ if (w = v(C), w < g || w > _) return;
103
+ break;
104
+ case c.HEADER_VALUE_START:
105
+ if (C === p) break;
106
+ T("onHeaderValue"), l = c.HEADER_VALUE;
107
+ case c.HEADER_VALUE:
108
+ C === f && (O("onHeaderValue", !0), D("onHeaderEnd"), l = c.HEADER_VALUE_ALMOST_DONE);
109
+ break;
110
+ case c.HEADER_VALUE_ALMOST_DONE:
111
+ if (C !== d) return;
112
+ l = c.HEADER_FIELD_START;
113
+ break;
114
+ case c.HEADERS_ALMOST_DONE:
115
+ if (C !== d) return;
116
+ D("onHeadersEnd"), l = c.PART_DATA_START;
117
+ break;
118
+ case c.PART_DATA_START: l = c.PART_DATA, T("onPartData");
119
+ case c.PART_DATA:
120
+ if (r = s, s === 0) {
121
+ for (t += x; t < S && !(e[t] in o);) t += b;
122
+ t -= x, C = e[t];
123
+ }
124
+ if (s < a.length) a[s] === C ? (s === 0 && O("onPartData", !0), s++) : s = 0;
125
+ else if (s === a.length) s++, C === f ? y |= u.PART_BOUNDARY : C === m ? y |= u.LAST_BOUNDARY : s = 0;
126
+ else if (s - 1 === a.length) if (y & u.PART_BOUNDARY) {
127
+ if (s = 0, C === d) {
128
+ y &= ~u.PART_BOUNDARY, D("onPartEnd"), D("onPartBegin"), l = c.HEADER_FIELD_START;
129
+ break;
130
+ }
131
+ } else y & u.LAST_BOUNDARY && C === m ? (D("onPartEnd"), l = c.END, y = 0) : s = 0;
132
+ if (s > 0) i[s - 1] = C;
133
+ else if (r > 0) {
134
+ let e = new Uint8Array(i.buffer, i.byteOffset, i.byteLength);
135
+ D("onPartData", 0, r, e), r = 0, T("onPartData"), t--;
136
+ }
137
+ break;
138
+ case c.END: break;
139
+ default: throw Error(`Unexpected state entered: ${l}`);
140
+ }
141
+ O("onHeaderField"), O("onHeaderValue"), O("onPartData"), this.index = s, this.state = l, this.flags = y;
142
+ }
143
+ end() {
144
+ if (this.state === c.HEADER_FIELD_START && this.index === 0 || this.state === c.PART_DATA && this.index === this.boundary.length) this.onPartEnd();
145
+ else if (this.state !== c.END) throw Error("MultipartParser.end(): stream ended unexpectedly");
146
+ }
147
+ };
148
+ }))();
149
+ export { o as toFormData };
@@ -0,0 +1,2 @@
1
+ const e=require(`./__vite-browser-external-BrdF6Ba4.js`),t=require(`./from-jzy6jn2J.js`);function n(e){let t=e.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);if(!t)return;let n=t[2]||t[3]||``,r=n.slice(n.lastIndexOf(`\\`)+1);return r=r.replace(/%22/g,`"`),r=r.replace(/&#(\d{4});/g,(e,t)=>String.fromCharCode(t)),r}async function r(e,r){if(!/multipart/i.test(r))throw TypeError(`Failed to fetch`);let i=r.match(/boundary=(?:"([^"]+)"|([^;]+))/i);if(!i)throw TypeError(`no or bad content-type header, no multipart boundary`);let a=new _(i[1]||i[2]),o,s,c,l,u,d,f=[],p=new t.n,m=e=>{c+=y.decode(e,{stream:!0})},h=e=>{f.push(e)},g=()=>{let e=new t.a(f,d,{type:u});p.append(l,e)},v=()=>{p.append(l,c)},y=new TextDecoder(`utf-8`);y.decode(),a.onPartBegin=function(){a.onPartData=m,a.onPartEnd=v,o=``,s=``,c=``,l=``,u=``,d=null,f.length=0},a.onHeaderField=function(e){o+=y.decode(e,{stream:!0})},a.onHeaderValue=function(e){s+=y.decode(e,{stream:!0})},a.onHeaderEnd=function(){if(s+=y.decode(),o=o.toLowerCase(),o===`content-disposition`){let e=s.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);e&&(l=e[2]||e[3]||``),d=n(s),d&&(a.onPartData=h,a.onPartEnd=g)}else o===`content-type`&&(u=s);s=``,o=``};for await(let t of e)a.write(t);return a.end(),p}var i,a,o,s,c,l,u,d,f,p,m,h,g,_;e.r((()=>{t.t(),t.i(),i=0,a={START_BOUNDARY:i++,HEADER_FIELD_START:i++,HEADER_FIELD:i++,HEADER_VALUE_START:i++,HEADER_VALUE:i++,HEADER_VALUE_ALMOST_DONE:i++,HEADERS_ALMOST_DONE:i++,PART_DATA_START:i++,PART_DATA:i++,END:i++},o=1,s={PART_BOUNDARY:o,LAST_BOUNDARY:o*=2},c=10,l=13,u=32,d=45,f=58,p=97,m=122,h=e=>e|32,g=()=>{},_=class{constructor(e){this.index=0,this.flags=0,this.onHeaderEnd=g,this.onHeaderField=g,this.onHeadersEnd=g,this.onHeaderValue=g,this.onPartBegin=g,this.onPartData=g,this.onPartEnd=g,this.boundaryChars={},e=`\r
2
+ --`+e;let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n),this.boundaryChars[t[n]]=!0;this.boundary=t,this.lookbehind=new Uint8Array(this.boundary.length+8),this.state=a.START_BOUNDARY}write(e){let t=0,n=e.length,r=this.index,{lookbehind:i,boundary:o,boundaryChars:g,index:_,state:v,flags:y}=this,b=this.boundary.length,x=b-1,S=e.length,C,w,T=e=>{this[e+`Mark`]=t},E=e=>{delete this[e+`Mark`]},D=(e,t,n,r)=>{(t===void 0||t!==n)&&this[e](r&&r.subarray(t,n))},O=(n,r)=>{let i=n+`Mark`;i in this&&(r?(D(n,this[i],t,e),delete this[i]):(D(n,this[i],e.length,e),this[i]=0))};for(t=0;t<n;t++)switch(C=e[t],v){case a.START_BOUNDARY:if(_===o.length-2){if(C===d)y|=s.LAST_BOUNDARY;else if(C!==l)return;_++;break}else if(_-1==o.length-2){if(y&s.LAST_BOUNDARY&&C===d)v=a.END,y=0;else if(!(y&s.LAST_BOUNDARY)&&C===c)_=0,D(`onPartBegin`),v=a.HEADER_FIELD_START;else return;break}C!==o[_+2]&&(_=-2),C===o[_+2]&&_++;break;case a.HEADER_FIELD_START:v=a.HEADER_FIELD,T(`onHeaderField`),_=0;case a.HEADER_FIELD:if(C===l){E(`onHeaderField`),v=a.HEADERS_ALMOST_DONE;break}if(_++,C===d)break;if(C===f){if(_===1)return;O(`onHeaderField`,!0),v=a.HEADER_VALUE_START;break}if(w=h(C),w<p||w>m)return;break;case a.HEADER_VALUE_START:if(C===u)break;T(`onHeaderValue`),v=a.HEADER_VALUE;case a.HEADER_VALUE:C===l&&(O(`onHeaderValue`,!0),D(`onHeaderEnd`),v=a.HEADER_VALUE_ALMOST_DONE);break;case a.HEADER_VALUE_ALMOST_DONE:if(C!==c)return;v=a.HEADER_FIELD_START;break;case a.HEADERS_ALMOST_DONE:if(C!==c)return;D(`onHeadersEnd`),v=a.PART_DATA_START;break;case a.PART_DATA_START:v=a.PART_DATA,T(`onPartData`);case a.PART_DATA:if(r=_,_===0){for(t+=x;t<S&&!(e[t]in g);)t+=b;t-=x,C=e[t]}if(_<o.length)o[_]===C?(_===0&&O(`onPartData`,!0),_++):_=0;else if(_===o.length)_++,C===l?y|=s.PART_BOUNDARY:C===d?y|=s.LAST_BOUNDARY:_=0;else if(_-1===o.length)if(y&s.PART_BOUNDARY){if(_=0,C===c){y&=~s.PART_BOUNDARY,D(`onPartEnd`),D(`onPartBegin`),v=a.HEADER_FIELD_START;break}}else y&s.LAST_BOUNDARY&&C===d?(D(`onPartEnd`),v=a.END,y=0):_=0;if(_>0)i[_-1]=C;else if(r>0){let e=new Uint8Array(i.buffer,i.byteOffset,i.byteLength);D(`onPartData`,0,r,e),r=0,T(`onPartData`),t--}break;case a.END:break;default:throw Error(`Unexpected state entered: ${v}`)}O(`onHeaderField`),O(`onHeaderValue`),O(`onPartData`),this.index=_,this.state=v,this.flags=y}end(){if(this.state===a.HEADER_FIELD_START&&this.index===0||this.state===a.PART_DATA&&this.index===this.boundary.length)this.onPartEnd();else if(this.state!==a.END)throw Error(`MultipartParser.end(): stream ended unexpectedly`)}}}))(),exports.toFormData=r;
@@ -0,0 +1,2 @@
1
+ const e=require(`./__vite-browser-external-BrdF6Ba4.js`),t=require(`./from-jzy6jn2J.js`);function n(e){let t=e.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);if(!t)return;let n=t[2]||t[3]||``,r=n.slice(n.lastIndexOf(`\\`)+1);return r=r.replace(/%22/g,`"`),r=r.replace(/&#(\d{4});/g,(e,t)=>String.fromCharCode(t)),r}async function r(e,r){if(!/multipart/i.test(r))throw TypeError(`Failed to fetch`);let i=r.match(/boundary=(?:"([^"]+)"|([^;]+))/i);if(!i)throw TypeError(`no or bad content-type header, no multipart boundary`);let a=new _(i[1]||i[2]),o,s,c,l,u,d,f=[],p=new t.n,m=e=>{c+=y.decode(e,{stream:!0})},h=e=>{f.push(e)},g=()=>{let e=new t.a(f,d,{type:u});p.append(l,e)},v=()=>{p.append(l,c)},y=new TextDecoder(`utf-8`);y.decode(),a.onPartBegin=function(){a.onPartData=m,a.onPartEnd=v,o=``,s=``,c=``,l=``,u=``,d=null,f.length=0},a.onHeaderField=function(e){o+=y.decode(e,{stream:!0})},a.onHeaderValue=function(e){s+=y.decode(e,{stream:!0})},a.onHeaderEnd=function(){if(s+=y.decode(),o=o.toLowerCase(),o===`content-disposition`){let e=s.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);e&&(l=e[2]||e[3]||``),d=n(s),d&&(a.onPartData=h,a.onPartEnd=g)}else o===`content-type`&&(u=s);s=``,o=``};for await(let t of e)a.write(t);return a.end(),p}var i,a,o,s,c,l,u,d,f,p,m,h,g,_;e.r((()=>{t.t(),t.i(),i=0,a={START_BOUNDARY:i++,HEADER_FIELD_START:i++,HEADER_FIELD:i++,HEADER_VALUE_START:i++,HEADER_VALUE:i++,HEADER_VALUE_ALMOST_DONE:i++,HEADERS_ALMOST_DONE:i++,PART_DATA_START:i++,PART_DATA:i++,END:i++},o=1,s={PART_BOUNDARY:o,LAST_BOUNDARY:o*=2},c=10,l=13,u=32,d=45,f=58,p=97,m=122,h=e=>e|32,g=()=>{},_=class{constructor(e){this.index=0,this.flags=0,this.onHeaderEnd=g,this.onHeaderField=g,this.onHeadersEnd=g,this.onHeaderValue=g,this.onPartBegin=g,this.onPartData=g,this.onPartEnd=g,this.boundaryChars={},e=`\r
2
+ --`+e;let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n),this.boundaryChars[t[n]]=!0;this.boundary=t,this.lookbehind=new Uint8Array(this.boundary.length+8),this.state=a.START_BOUNDARY}write(e){let t=0,n=e.length,r=this.index,{lookbehind:i,boundary:o,boundaryChars:g,index:_,state:v,flags:y}=this,b=this.boundary.length,x=b-1,S=e.length,C,w,T=e=>{this[e+`Mark`]=t},E=e=>{delete this[e+`Mark`]},D=(e,t,n,r)=>{(t===void 0||t!==n)&&this[e](r&&r.subarray(t,n))},O=(n,r)=>{let i=n+`Mark`;i in this&&(r?(D(n,this[i],t,e),delete this[i]):(D(n,this[i],e.length,e),this[i]=0))};for(t=0;t<n;t++)switch(C=e[t],v){case a.START_BOUNDARY:if(_===o.length-2){if(C===d)y|=s.LAST_BOUNDARY;else if(C!==l)return;_++;break}else if(_-1==o.length-2){if(y&s.LAST_BOUNDARY&&C===d)v=a.END,y=0;else if(!(y&s.LAST_BOUNDARY)&&C===c)_=0,D(`onPartBegin`),v=a.HEADER_FIELD_START;else return;break}C!==o[_+2]&&(_=-2),C===o[_+2]&&_++;break;case a.HEADER_FIELD_START:v=a.HEADER_FIELD,T(`onHeaderField`),_=0;case a.HEADER_FIELD:if(C===l){E(`onHeaderField`),v=a.HEADERS_ALMOST_DONE;break}if(_++,C===d)break;if(C===f){if(_===1)return;O(`onHeaderField`,!0),v=a.HEADER_VALUE_START;break}if(w=h(C),w<p||w>m)return;break;case a.HEADER_VALUE_START:if(C===u)break;T(`onHeaderValue`),v=a.HEADER_VALUE;case a.HEADER_VALUE:C===l&&(O(`onHeaderValue`,!0),D(`onHeaderEnd`),v=a.HEADER_VALUE_ALMOST_DONE);break;case a.HEADER_VALUE_ALMOST_DONE:if(C!==c)return;v=a.HEADER_FIELD_START;break;case a.HEADERS_ALMOST_DONE:if(C!==c)return;D(`onHeadersEnd`),v=a.PART_DATA_START;break;case a.PART_DATA_START:v=a.PART_DATA,T(`onPartData`);case a.PART_DATA:if(r=_,_===0){for(t+=x;t<S&&!(e[t]in g);)t+=b;t-=x,C=e[t]}if(_<o.length)o[_]===C?(_===0&&O(`onPartData`,!0),_++):_=0;else if(_===o.length)_++,C===l?y|=s.PART_BOUNDARY:C===d?y|=s.LAST_BOUNDARY:_=0;else if(_-1===o.length)if(y&s.PART_BOUNDARY){if(_=0,C===c){y&=~s.PART_BOUNDARY,D(`onPartEnd`),D(`onPartBegin`),v=a.HEADER_FIELD_START;break}}else y&s.LAST_BOUNDARY&&C===d?(D(`onPartEnd`),v=a.END,y=0):_=0;if(_>0)i[_-1]=C;else if(r>0){let e=new Uint8Array(i.buffer,i.byteOffset,i.byteLength);D(`onPartData`,0,r,e),r=0,T(`onPartData`),t--}break;case a.END:break;default:throw Error(`Unexpected state entered: ${v}`)}O(`onHeaderField`),O(`onHeaderValue`),O(`onPartData`),this.index=_,this.state=v,this.flags=y}end(){if(this.state===a.HEADER_FIELD_START&&this.index===0||this.state===a.PART_DATA&&this.index===this.boundary.length)this.onPartEnd();else if(this.state!==a.END)throw Error(`MultipartParser.end(): stream ended unexpectedly`)}}}))(),exports.toFormData=r;
@@ -0,0 +1,149 @@
1
+ import { r as e } from "./__vite-browser-external-C4yfM1ew.mjs";
2
+ import { a as t, i as n, n as r, t as i } from "./from-BPj5eOuj.mjs";
3
+ //#region node_modules/gcp-metadata/node_modules/node-fetch/src/utils/multipart-parser.js
4
+ function a(e) {
5
+ let t = e.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);
6
+ if (!t) return;
7
+ let n = t[2] || t[3] || "", r = n.slice(n.lastIndexOf("\\") + 1);
8
+ return r = r.replace(/%22/g, "\""), r = r.replace(/&#(\d{4});/g, (e, t) => String.fromCharCode(t)), r;
9
+ }
10
+ async function o(e, n) {
11
+ if (!/multipart/i.test(n)) throw TypeError("Failed to fetch");
12
+ let i = n.match(/boundary=(?:"([^"]+)"|([^;]+))/i);
13
+ if (!i) throw TypeError("no or bad content-type header, no multipart boundary");
14
+ let o = new b(i[1] || i[2]), s, c, l, u, d, f, p = [], m = new r(), h = (e) => {
15
+ l += y.decode(e, { stream: !0 });
16
+ }, g = (e) => {
17
+ p.push(e);
18
+ }, _ = () => {
19
+ let e = new t(p, f, { type: d });
20
+ m.append(u, e);
21
+ }, v = () => {
22
+ m.append(u, l);
23
+ }, y = new TextDecoder("utf-8");
24
+ y.decode(), o.onPartBegin = function() {
25
+ o.onPartData = h, o.onPartEnd = v, s = "", c = "", l = "", u = "", d = "", f = null, p.length = 0;
26
+ }, o.onHeaderField = function(e) {
27
+ s += y.decode(e, { stream: !0 });
28
+ }, o.onHeaderValue = function(e) {
29
+ c += y.decode(e, { stream: !0 });
30
+ }, o.onHeaderEnd = function() {
31
+ if (c += y.decode(), s = s.toLowerCase(), s === "content-disposition") {
32
+ let e = c.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);
33
+ e && (u = e[2] || e[3] || ""), f = a(c), f && (o.onPartData = g, o.onPartEnd = _);
34
+ } else s === "content-type" && (d = c);
35
+ c = "", s = "";
36
+ };
37
+ for await (let t of e) o.write(t);
38
+ return o.end(), m;
39
+ }
40
+ var s, c, l, u, d, f, p, m, h, g, _, v, y, b;
41
+ //#endregion
42
+ e((() => {
43
+ i(), n(), s = 0, c = {
44
+ START_BOUNDARY: s++,
45
+ HEADER_FIELD_START: s++,
46
+ HEADER_FIELD: s++,
47
+ HEADER_VALUE_START: s++,
48
+ HEADER_VALUE: s++,
49
+ HEADER_VALUE_ALMOST_DONE: s++,
50
+ HEADERS_ALMOST_DONE: s++,
51
+ PART_DATA_START: s++,
52
+ PART_DATA: s++,
53
+ END: s++
54
+ }, l = 1, u = {
55
+ PART_BOUNDARY: l,
56
+ LAST_BOUNDARY: l *= 2
57
+ }, d = 10, f = 13, p = 32, m = 45, h = 58, g = 97, _ = 122, v = (e) => e | 32, y = () => {}, b = class {
58
+ constructor(e) {
59
+ this.index = 0, this.flags = 0, this.onHeaderEnd = y, this.onHeaderField = y, this.onHeadersEnd = y, this.onHeaderValue = y, this.onPartBegin = y, this.onPartData = y, this.onPartEnd = y, this.boundaryChars = {}, e = "\r\n--" + e;
60
+ let t = new Uint8Array(e.length);
61
+ for (let n = 0; n < e.length; n++) t[n] = e.charCodeAt(n), this.boundaryChars[t[n]] = !0;
62
+ this.boundary = t, this.lookbehind = new Uint8Array(this.boundary.length + 8), this.state = c.START_BOUNDARY;
63
+ }
64
+ write(e) {
65
+ let t = 0, n = e.length, r = this.index, { lookbehind: i, boundary: a, boundaryChars: o, index: s, state: l, flags: y } = this, b = this.boundary.length, x = b - 1, S = e.length, C, w, T = (e) => {
66
+ this[e + "Mark"] = t;
67
+ }, E = (e) => {
68
+ delete this[e + "Mark"];
69
+ }, D = (e, t, n, r) => {
70
+ (t === void 0 || t !== n) && this[e](r && r.subarray(t, n));
71
+ }, O = (n, r) => {
72
+ let i = n + "Mark";
73
+ i in this && (r ? (D(n, this[i], t, e), delete this[i]) : (D(n, this[i], e.length, e), this[i] = 0));
74
+ };
75
+ for (t = 0; t < n; t++) switch (C = e[t], l) {
76
+ case c.START_BOUNDARY:
77
+ if (s === a.length - 2) {
78
+ if (C === m) y |= u.LAST_BOUNDARY;
79
+ else if (C !== f) return;
80
+ s++;
81
+ break;
82
+ } else if (s - 1 == a.length - 2) {
83
+ if (y & u.LAST_BOUNDARY && C === m) l = c.END, y = 0;
84
+ else if (!(y & u.LAST_BOUNDARY) && C === d) s = 0, D("onPartBegin"), l = c.HEADER_FIELD_START;
85
+ else return;
86
+ break;
87
+ }
88
+ C !== a[s + 2] && (s = -2), C === a[s + 2] && s++;
89
+ break;
90
+ case c.HEADER_FIELD_START: l = c.HEADER_FIELD, T("onHeaderField"), s = 0;
91
+ case c.HEADER_FIELD:
92
+ if (C === f) {
93
+ E("onHeaderField"), l = c.HEADERS_ALMOST_DONE;
94
+ break;
95
+ }
96
+ if (s++, C === m) break;
97
+ if (C === h) {
98
+ if (s === 1) return;
99
+ O("onHeaderField", !0), l = c.HEADER_VALUE_START;
100
+ break;
101
+ }
102
+ if (w = v(C), w < g || w > _) return;
103
+ break;
104
+ case c.HEADER_VALUE_START:
105
+ if (C === p) break;
106
+ T("onHeaderValue"), l = c.HEADER_VALUE;
107
+ case c.HEADER_VALUE:
108
+ C === f && (O("onHeaderValue", !0), D("onHeaderEnd"), l = c.HEADER_VALUE_ALMOST_DONE);
109
+ break;
110
+ case c.HEADER_VALUE_ALMOST_DONE:
111
+ if (C !== d) return;
112
+ l = c.HEADER_FIELD_START;
113
+ break;
114
+ case c.HEADERS_ALMOST_DONE:
115
+ if (C !== d) return;
116
+ D("onHeadersEnd"), l = c.PART_DATA_START;
117
+ break;
118
+ case c.PART_DATA_START: l = c.PART_DATA, T("onPartData");
119
+ case c.PART_DATA:
120
+ if (r = s, s === 0) {
121
+ for (t += x; t < S && !(e[t] in o);) t += b;
122
+ t -= x, C = e[t];
123
+ }
124
+ if (s < a.length) a[s] === C ? (s === 0 && O("onPartData", !0), s++) : s = 0;
125
+ else if (s === a.length) s++, C === f ? y |= u.PART_BOUNDARY : C === m ? y |= u.LAST_BOUNDARY : s = 0;
126
+ else if (s - 1 === a.length) if (y & u.PART_BOUNDARY) {
127
+ if (s = 0, C === d) {
128
+ y &= ~u.PART_BOUNDARY, D("onPartEnd"), D("onPartBegin"), l = c.HEADER_FIELD_START;
129
+ break;
130
+ }
131
+ } else y & u.LAST_BOUNDARY && C === m ? (D("onPartEnd"), l = c.END, y = 0) : s = 0;
132
+ if (s > 0) i[s - 1] = C;
133
+ else if (r > 0) {
134
+ let e = new Uint8Array(i.buffer, i.byteOffset, i.byteLength);
135
+ D("onPartData", 0, r, e), r = 0, T("onPartData"), t--;
136
+ }
137
+ break;
138
+ case c.END: break;
139
+ default: throw Error(`Unexpected state entered: ${l}`);
140
+ }
141
+ O("onHeaderField"), O("onHeaderValue"), O("onPartData"), this.index = s, this.state = l, this.flags = y;
142
+ }
143
+ end() {
144
+ if (this.state === c.HEADER_FIELD_START && this.index === 0 || this.state === c.PART_DATA && this.index === this.boundary.length) this.onPartEnd();
145
+ else if (this.state !== c.END) throw Error("MultipartParser.end(): stream ended unexpectedly");
146
+ }
147
+ };
148
+ }))();
149
+ export { o as toFormData };
@@ -0,0 +1,3 @@
1
+ const e=require(`./__vite-browser-external-BrdF6Ba4.js`),t=require(`./dist-CkUzyZvx.js`),n=require(`./from-jzy6jn2J.js`);var r,i=e.r((()=>{r=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}}})),a,o=e.r((()=>{i(),a=class extends r{constructor(e,t,n){super(e,t),n&&(this.code=this.errno=n.code,this.erroredSysCall=n.syscall)}}})),s,c,l,u,d,f,p=e.r((()=>{s=Symbol.toStringTag,c=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[s]===`URLSearchParams`,l=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[s]),u=e=>typeof e==`object`&&(e[s]===`AbortSignal`||e[s]===`EventTarget`),d=(e,t)=>{let n=new URL(t).hostname,r=new URL(e).hostname;return n===r||n.endsWith(`.${r}`)},f=(e,t)=>new URL(t).protocol===new URL(e).protocol}));async function m(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 h.default))return _.Buffer.alloc(0);let n=[],i=0;try{for await(let r of t){if(e.size>0&&i+r.length>e.size){let n=new a(`content size at ${e.url} over limit: ${e.size}`,`max-size`);throw t.destroy(n),n}i+=r.length,n.push(r)}}catch(t){throw t instanceof r?t:new a(`Invalid response body while trying to fetch ${e.url}: ${t.message}`,`system`,t)}if(t.readableEnded===!0||t._readableState.ended===!0)try{return n.every(e=>typeof e==`string`)?_.Buffer.from(n.join(``)):_.Buffer.concat(n,i)}catch(t){throw new a(`Could not create Buffer from response body for ${e.url}: ${t.message}`,`system`,t)}else throw new a(`Premature close of server response while trying to fetch ${e.url}`)}var h,g,_,ee,v,y,b,te,x,S,C,w=e.r((()=>{h=e.o(e.t(),1),g=e.o(e.t(),1),_=e.o(e.t(),1),n.s(),n.i(),o(),i(),p(),ee=(0,g.promisify)(h.default.pipeline),v=Symbol(`Body internals`),y=class{constructor(e,{size:t=0}={}){let i=null;e===null?e=null:c(e)?e=_.Buffer.from(e.toString()):l(e)||_.Buffer.isBuffer(e)||(g.types.isAnyArrayBuffer(e)?e=_.Buffer.from(e):ArrayBuffer.isView(e)?e=_.Buffer.from(e.buffer,e.byteOffset,e.byteLength):e instanceof h.default||(e instanceof n.n?(e=n.r(e),i=e.type.split(`=`)[1]):e=_.Buffer.from(String(e))));let o=e;_.Buffer.isBuffer(e)?o=h.default.Readable.from(e):l(e)&&(o=h.default.Readable.from(e.stream())),this[v]={body:e,stream:o,boundary:i,disturbed:!1,error:null},this.size=t,e instanceof h.default&&e.on(`error`,e=>{let t=e instanceof r?e:new a(`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 m(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 n.n,t=new URLSearchParams(await this.text());for(let[n,r]of t)e.append(n,r);return e}let{toFormData:t}=await Promise.resolve().then(()=>require(`./multipart-parser-DOk5BsUv.js`));return t(this.body,e)}async blob(){let e=this.headers&&this.headers.get(`content-type`)||this[v].body&&this[v].body.type||``;return new n.o([await this.arrayBuffer()],{type:e})}async json(){let e=await this.text();return JSON.parse(e)}async text(){let e=await m(this);return new TextDecoder().decode(e)}buffer(){return m(this)}},y.prototype.buffer=(0,g.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,g.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 h.default&&typeof i.getBoundary!=`function`&&(n=new h.PassThrough({highWaterMark:t}),r=new h.PassThrough({highWaterMark:t}),i.pipe(n),i.pipe(r),e[v].stream=n,i=r),i},te=(0,g.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,t)=>e===null?null:typeof e==`string`?`text/plain;charset=UTF-8`:c(e)?`application/x-www-form-urlencoded;charset=UTF-8`:l(e)?e.type||null:_.Buffer.isBuffer(e)||g.types.isAnyArrayBuffer(e)||ArrayBuffer.isView(e)?null:e instanceof n.n?`multipart/form-data; boundary=${t[v].boundary}`:e&&typeof e.getBoundary==`function`?`multipart/form-data;boundary=${te(e)}`:e instanceof h.default?null:`text/plain;charset=UTF-8`,S=e=>{let{body:t}=e[v];return t===null?0:l(t)?t.size:_.Buffer.isBuffer(t)?t.length:t&&typeof t.getLengthSync==`function`&&t.hasKnownLength&&t.hasKnownLength()?t.getLengthSync():null},C=async(e,{body:t})=>{t===null?e.end():await ee(t,e)}}));function ne(e=[]){return new k(e.reduce((e,t,n,r)=>(n%2==0&&e.push(r.slice(n,n+2)),e),[]).filter(([e,t])=>{try{return D(e),O(e,String(t)),!0}catch{return!1}}))}var T,E,D,O,k,A=e.r((()=>{T=e.o(e.t(),1),E=e.o(e.t(),1),D=typeof E.default.validateHeaderName==`function`?E.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}},O=typeof E.default.validateHeaderValue==`function`?E.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}},k=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`&&!T.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`||T.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])=>(D(e),O(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)=>(D(n),O(n,String(r)),URLSearchParams.prototype[t].call(e,String(n).toLowerCase(),String(r)));case`delete`:case`has`:case`getAll`:return n=>(D(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(k.prototype,[`get`,`entries`,`forEach`,`values`].reduce((e,t)=>(e[t]={enumerable:!0},e),{}))})),j,M,re=e.r((()=>{j=new Set([301,302,303,307,308]),M=e=>j.has(e)})),N,P,ie=e.r((()=>{A(),w(),re(),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 k(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(!M(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 k(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,ae=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 oe(e){if(!z.has(e))throw TypeError(`Invalid referrerPolicy: ${e}`);return e}function se(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:se(e)}function ce(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 le(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,ue=e.r((()=>{H=e.o(e.t(),1),U=e.o(e.t(),1),A(),w(),p(),ae(),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 k(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&&!u(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=oe(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 k(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=S(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=ce(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,de=e.r((()=>{i(),Y=class extends r{constructor(e,t=`aborted`){super(e,t)}}}));async function X(e,n){return new Promise((r,i)=>{let o=new q(e,n),{parsedURL:s,options:c}=J(o);if(!he.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.t(o.url);r(new P(e,{headers:{"Content-Type":e.typeFull}}));return}let l=(s.protocol===`https:`?me.default:pe.default).request,{signal:u}=o,p=null,m=()=>{let e=new Y(`The operation was aborted.`);i(e),o.body&&o.body instanceof Q.default.Readable&&o.body.destroy(e),!(!p||!p.body)&&p.body.emit(`error`,e)};if(u&&u.aborted){m();return}let h=()=>{m(),_()},g=l(s.toString(),c);u&&u.addEventListener(`abort`,h);let _=()=>{g.abort(),u&&u.removeEventListener(`abort`,h)};g.on(`error`,e=>{i(new a(`request to ${o.url} failed, reason: ${e.message}`,`system`,e)),_()}),fe(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(M(e.statusCode)){let s=t.get(`Location`),c=null;try{c=s===null?null:new URL(s,o.url)}catch{if(o.redirect!==`manual`){i(new a(`uri requested responds with an invalid redirect URL: ${s}`,`invalid-redirect`)),_();return}}switch(o.redirect){case`error`:i(new a(`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){i(new a(`maximum redirect reached at: ${o.url}`,`max-redirect`)),_();return}let s={headers:new k(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(!d(o.url,c)||!f(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){i(new a(`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=le(t);l&&(s.referrerPolicy=l),r(X(new q(c,s))),_();return}default:return i(TypeError(`Redirect option '${o.redirect}' is not a valid value of RequestRedirect`))}}u&&e.once(`end`,()=>{u.removeEventListener(`abort`,h)});let s=(0,Q.pipeline)(e,new Q.PassThrough,e=>{e&&i(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&&i(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&&i(e)});t.once(`data`,e=>{s=(e[0]&15)==8?(0,Q.pipeline)(s,Z.default.createInflate(),e=>{e&&i(e)}):(0,Q.pipeline)(s,Z.default.createInflateRaw(),e=>{e&&i(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&&i(e)}),p=new P(s,c),r(p);return}p=new P(s,c),r(p)}),C(g,o).catch(i)})}function fe(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 pe,me,Z,Q,$,he;e.r((()=>{pe=e.o(e.t(),1),me=e.o(e.t(),1),Z=e.o(e.t(),1),Q=e.o(e.t(),1),$=e.o(e.t(),1),t.n(),w(),ie(),A(),ue(),o(),de(),re(),n.i(),p(),V(),n.t(),he=new Set([`data:`,`http:`,`https:`])}))(),exports.default=X;
@@ -0,0 +1,3 @@
1
+ const e=require(`./__vite-browser-external-BrdF6Ba4.js`),t=require(`./dist-CkUzyZvx.js`),n=require(`./from-jzy6jn2J.js`);var r,i=e.r((()=>{r=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}}})),a,o=e.r((()=>{i(),a=class extends r{constructor(e,t,n){super(e,t),n&&(this.code=this.errno=n.code,this.erroredSysCall=n.syscall)}}})),s,c,l,u,d,f,p=e.r((()=>{s=Symbol.toStringTag,c=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[s]===`URLSearchParams`,l=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[s]),u=e=>typeof e==`object`&&(e[s]===`AbortSignal`||e[s]===`EventTarget`),d=(e,t)=>{let n=new URL(t).hostname,r=new URL(e).hostname;return n===r||n.endsWith(`.${r}`)},f=(e,t)=>new URL(t).protocol===new URL(e).protocol}));async function m(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 h.default))return _.Buffer.alloc(0);let n=[],i=0;try{for await(let r of t){if(e.size>0&&i+r.length>e.size){let n=new a(`content size at ${e.url} over limit: ${e.size}`,`max-size`);throw t.destroy(n),n}i+=r.length,n.push(r)}}catch(t){throw t instanceof r?t:new a(`Invalid response body while trying to fetch ${e.url}: ${t.message}`,`system`,t)}if(t.readableEnded===!0||t._readableState.ended===!0)try{return n.every(e=>typeof e==`string`)?_.Buffer.from(n.join(``)):_.Buffer.concat(n,i)}catch(t){throw new a(`Could not create Buffer from response body for ${e.url}: ${t.message}`,`system`,t)}else throw new a(`Premature close of server response while trying to fetch ${e.url}`)}var h,g,_,ee,v,y,b,te,x,S,C,w=e.r((()=>{h=e.o(e.t(),1),g=e.o(e.t(),1),_=e.o(e.t(),1),n.s(),n.i(),o(),i(),p(),ee=(0,g.promisify)(h.default.pipeline),v=Symbol(`Body internals`),y=class{constructor(e,{size:t=0}={}){let i=null;e===null?e=null:c(e)?e=_.Buffer.from(e.toString()):l(e)||_.Buffer.isBuffer(e)||(g.types.isAnyArrayBuffer(e)?e=_.Buffer.from(e):ArrayBuffer.isView(e)?e=_.Buffer.from(e.buffer,e.byteOffset,e.byteLength):e instanceof h.default||(e instanceof n.n?(e=n.r(e),i=e.type.split(`=`)[1]):e=_.Buffer.from(String(e))));let o=e;_.Buffer.isBuffer(e)?o=h.default.Readable.from(e):l(e)&&(o=h.default.Readable.from(e.stream())),this[v]={body:e,stream:o,boundary:i,disturbed:!1,error:null},this.size=t,e instanceof h.default&&e.on(`error`,e=>{let t=e instanceof r?e:new a(`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 m(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 n.n,t=new URLSearchParams(await this.text());for(let[n,r]of t)e.append(n,r);return e}let{toFormData:t}=await Promise.resolve().then(()=>require(`./multipart-parser-D41wkGe-.js`));return t(this.body,e)}async blob(){let e=this.headers&&this.headers.get(`content-type`)||this[v].body&&this[v].body.type||``;return new n.o([await this.arrayBuffer()],{type:e})}async json(){let e=await this.text();return JSON.parse(e)}async text(){let e=await m(this);return new TextDecoder().decode(e)}buffer(){return m(this)}},y.prototype.buffer=(0,g.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,g.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 h.default&&typeof i.getBoundary!=`function`&&(n=new h.PassThrough({highWaterMark:t}),r=new h.PassThrough({highWaterMark:t}),i.pipe(n),i.pipe(r),e[v].stream=n,i=r),i},te=(0,g.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,t)=>e===null?null:typeof e==`string`?`text/plain;charset=UTF-8`:c(e)?`application/x-www-form-urlencoded;charset=UTF-8`:l(e)?e.type||null:_.Buffer.isBuffer(e)||g.types.isAnyArrayBuffer(e)||ArrayBuffer.isView(e)?null:e instanceof n.n?`multipart/form-data; boundary=${t[v].boundary}`:e&&typeof e.getBoundary==`function`?`multipart/form-data;boundary=${te(e)}`:e instanceof h.default?null:`text/plain;charset=UTF-8`,S=e=>{let{body:t}=e[v];return t===null?0:l(t)?t.size:_.Buffer.isBuffer(t)?t.length:t&&typeof t.getLengthSync==`function`&&t.hasKnownLength&&t.hasKnownLength()?t.getLengthSync():null},C=async(e,{body:t})=>{t===null?e.end():await ee(t,e)}}));function ne(e=[]){return new k(e.reduce((e,t,n,r)=>(n%2==0&&e.push(r.slice(n,n+2)),e),[]).filter(([e,t])=>{try{return D(e),O(e,String(t)),!0}catch{return!1}}))}var T,E,D,O,k,A=e.r((()=>{T=e.o(e.t(),1),E=e.o(e.t(),1),D=typeof E.default.validateHeaderName==`function`?E.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}},O=typeof E.default.validateHeaderValue==`function`?E.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}},k=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`&&!T.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`||T.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])=>(D(e),O(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)=>(D(n),O(n,String(r)),URLSearchParams.prototype[t].call(e,String(n).toLowerCase(),String(r)));case`delete`:case`has`:case`getAll`:return n=>(D(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(k.prototype,[`get`,`entries`,`forEach`,`values`].reduce((e,t)=>(e[t]={enumerable:!0},e),{}))})),j,M,re=e.r((()=>{j=new Set([301,302,303,307,308]),M=e=>j.has(e)})),N,P,ie=e.r((()=>{A(),w(),re(),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 k(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(!M(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 k(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,ae=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 oe(e){if(!z.has(e))throw TypeError(`Invalid referrerPolicy: ${e}`);return e}function se(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:se(e)}function ce(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 le(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,ue=e.r((()=>{H=e.o(e.t(),1),U=e.o(e.t(),1),A(),w(),p(),ae(),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 k(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&&!u(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=oe(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 k(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=S(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=ce(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,de=e.r((()=>{i(),Y=class extends r{constructor(e,t=`aborted`){super(e,t)}}}));async function X(e,n){return new Promise((r,i)=>{let o=new q(e,n),{parsedURL:s,options:c}=J(o);if(!he.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.t(o.url);r(new P(e,{headers:{"Content-Type":e.typeFull}}));return}let l=(s.protocol===`https:`?me.default:pe.default).request,{signal:u}=o,p=null,m=()=>{let e=new Y(`The operation was aborted.`);i(e),o.body&&o.body instanceof Q.default.Readable&&o.body.destroy(e),!(!p||!p.body)&&p.body.emit(`error`,e)};if(u&&u.aborted){m();return}let h=()=>{m(),_()},g=l(s.toString(),c);u&&u.addEventListener(`abort`,h);let _=()=>{g.abort(),u&&u.removeEventListener(`abort`,h)};g.on(`error`,e=>{i(new a(`request to ${o.url} failed, reason: ${e.message}`,`system`,e)),_()}),fe(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(M(e.statusCode)){let s=t.get(`Location`),c=null;try{c=s===null?null:new URL(s,o.url)}catch{if(o.redirect!==`manual`){i(new a(`uri requested responds with an invalid redirect URL: ${s}`,`invalid-redirect`)),_();return}}switch(o.redirect){case`error`:i(new a(`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){i(new a(`maximum redirect reached at: ${o.url}`,`max-redirect`)),_();return}let s={headers:new k(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(!d(o.url,c)||!f(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){i(new a(`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=le(t);l&&(s.referrerPolicy=l),r(X(new q(c,s))),_();return}default:return i(TypeError(`Redirect option '${o.redirect}' is not a valid value of RequestRedirect`))}}u&&e.once(`end`,()=>{u.removeEventListener(`abort`,h)});let s=(0,Q.pipeline)(e,new Q.PassThrough,e=>{e&&i(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&&i(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&&i(e)});t.once(`data`,e=>{s=(e[0]&15)==8?(0,Q.pipeline)(s,Z.default.createInflate(),e=>{e&&i(e)}):(0,Q.pipeline)(s,Z.default.createInflateRaw(),e=>{e&&i(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&&i(e)}),p=new P(s,c),r(p);return}p=new P(s,c),r(p)}),C(g,o).catch(i)})}function fe(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 pe,me,Z,Q,$,he;e.r((()=>{pe=e.o(e.t(),1),me=e.o(e.t(),1),Z=e.o(e.t(),1),Q=e.o(e.t(),1),$=e.o(e.t(),1),t.n(),w(),ie(),A(),ue(),o(),de(),re(),n.i(),p(),V(),n.t(),he=new Set([`data:`,`http:`,`https:`])}))(),exports.default=X;