module.exports=[691144,a=>{"use strict";a.i(181856);var b=a.i(784511),c=a.i(468455);let d=0,e={START_BOUNDARY:d++,HEADER_FIELD_START:d++,HEADER_FIELD:d++,HEADER_VALUE_START:d++,HEADER_VALUE:d++,HEADER_VALUE_ALMOST_DONE:d++,HEADERS_ALMOST_DONE:d++,PART_DATA_START:d++,PART_DATA:d++,END:d++},f=1,g=2,h=a=>32|a,i=()=>{};class j{constructor(a){this.index=0,this.flags=0,this.onHeaderEnd=i,this.onHeaderField=i,this.onHeadersEnd=i,this.onHeaderValue=i,this.onPartBegin=i,this.onPartData=i,this.onPartEnd=i,this.boundaryChars={};const b=new Uint8Array((a="\r\n--"+a).length);for(let c=0;c<a.length;c++)b[c]=a.charCodeAt(c),this.boundaryChars[b[c]]=!0;this.boundary=b,this.lookbehind=new Uint8Array(this.boundary.length+8),this.state=e.START_BOUNDARY}write(a){let b,c,d=0,i=a.length,j=this.index,{lookbehind:k,boundary:l,boundaryChars:m,index:n,state:o,flags:p}=this,q=this.boundary.length,r=q-1,s=a.length,t=a=>{this[a+"Mark"]=d},u=a=>{delete this[a+"Mark"]},v=(a,b,c,d)=>{(void 0===b||b!==c)&&this[a](d&&d.subarray(b,c))},w=(b,c)=>{let e=b+"Mark";e in this&&(c?(v(b,this[e],d,a),delete this[e]):(v(b,this[e],a.length,a),this[e]=0))};for(d=0;d<i;d++)switch(b=a[d],o){case e.START_BOUNDARY:if(n===l.length-2){if(45===b)p|=g;else if(13!==b)return;n++;break}if(n-1==l.length-2){if(p&g&&45===b)o=e.END,p=0;else{if(p&g||10!==b)return;n=0,v("onPartBegin"),o=e.HEADER_FIELD_START}break}b!==l[n+2]&&(n=-2),b===l[n+2]&&n++;break;case e.HEADER_FIELD_START:o=e.HEADER_FIELD,t("onHeaderField"),n=0;case e.HEADER_FIELD:if(13===b){u("onHeaderField"),o=e.HEADERS_ALMOST_DONE;break}if(n++,45===b)break;if(58===b){if(1===n)return;w("onHeaderField",!0),o=e.HEADER_VALUE_START;break}if((c=h(b))<97||c>122)return;break;case e.HEADER_VALUE_START:if(32===b)break;t("onHeaderValue"),o=e.HEADER_VALUE;case e.HEADER_VALUE:13===b&&(w("onHeaderValue",!0),v("onHeaderEnd"),o=e.HEADER_VALUE_ALMOST_DONE);break;case e.HEADER_VALUE_ALMOST_DONE:if(10!==b)return;o=e.HEADER_FIELD_START;break;case e.HEADERS_ALMOST_DONE:if(10!==b)return;v("onHeadersEnd"),o=e.PART_DATA_START;break;case e.PART_DATA_START:o=e.PART_DATA,t("onPartData");case e.PART_DATA:if(j=n,0===n){for(d+=r;d<s&&!(a[d]in m);)d+=q;d-=r,b=a[d]}if(n<l.length)l[n]===b?(0===n&&w("onPartData",!0),n++):n=0;else if(n===l.length)n++,13===b?p|=f:45===b?p|=g:n=0;else if(n-1===l.length)if(p&f){if(n=0,10===b){p&=~f,v("onPartEnd"),v("onPartBegin"),o=e.HEADER_FIELD_START;break}}else p&g&&45===b?(v("onPartEnd"),o=e.END,p=0):n=0;n>0?k[n-1]=b:j>0&&(v("onPartData",0,j,new Uint8Array(k.buffer,k.byteOffset,k.byteLength)),j=0,t("onPartData"),d--);break;case e.END:break;default:throw Error(`Unexpected state entered: ${o}`)}w("onHeaderField"),w("onHeaderValue"),w("onPartData"),this.index=n,this.state=o,this.flags=p}end(){if(this.state===e.HEADER_FIELD_START&&0===this.index||this.state===e.PART_DATA&&this.index===this.boundary.length)this.onPartEnd();else if(this.state!==e.END)throw Error("MultipartParser.end(): stream ended unexpectedly")}}async function k(a,d){let e,f,g,h,i,k;if(!/multipart/i.test(d))throw TypeError("Failed to fetch");let l=d.match(/boundary=(?:"([^"]+)"|([^;]+))/i);if(!l)throw TypeError("no or bad content-type header, no multipart boundary");let m=new j(l[1]||l[2]),n=[],o=new c.FormData,p=a=>{g+=t.decode(a,{stream:!0})},q=a=>{n.push(a)},r=()=>{let a=new b.File(n,k,{type:i});o.append(h,a)},s=()=>{o.append(h,g)},t=new TextDecoder("utf-8");for await(let b of(t.decode(),m.onPartBegin=function(){m.onPartData=p,m.onPartEnd=s,e="",f="",g="",h="",i="",k=null,n.length=0},m.onHeaderField=function(a){e+=t.decode(a,{stream:!0})},m.onHeaderValue=function(a){f+=t.decode(a,{stream:!0})},m.onHeaderEnd=function(){if(f+=t.decode(),"content-disposition"===(e=e.toLowerCase())){let a=f.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);a&&(h=a[2]||a[3]||""),(k=function(a){let b=a.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);if(!b)return;let c=b[2]||b[3]||"",d=c.slice(c.lastIndexOf("\\")+1);return(d=d.replace(/%22/g,'"')).replace(/&#(\d{4});/g,(a,b)=>String.fromCharCode(b))}(f))&&(m.onPartData=q,m.onPartEnd=r)}else"content-type"===e&&(i=f);f="",e=""},a))m.write(b);return m.end(),o}a.s(["toFormData",()=>k])}];

//# sourceMappingURL=node_modules_node-fetch_src_utils_multipart-parser_431de5b8.js.map