"use strict";exports.id=8795,exports.ids=[8795],exports.modules={8795:(a,b,c)=>{c.d(b,{toFormData:()=>m});var d=c(30933),e=c(13924);let f=0,g={START_BOUNDARY:f++,HEADER_FIELD_START:f++,HEADER_FIELD:f++,HEADER_VALUE_START:f++,HEADER_VALUE:f++,HEADER_VALUE_ALMOST_DONE:f++,HEADERS_ALMOST_DONE:f++,PART_DATA_START:f++,PART_DATA:f++,END:f++},h=1,i=2,j=a=>32|a,k=()=>{};class l{constructor(a){this.index=0,this.flags=0,this.onHeaderEnd=k,this.onHeaderField=k,this.onHeadersEnd=k,this.onHeaderValue=k,this.onPartBegin=k,this.onPartData=k,this.onPartEnd=k,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=g.START_BOUNDARY}write(a){let b,c,d=0,e=a.length,f=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<e;d++)switch(b=a[d],o){case g.START_BOUNDARY:if(n===l.length-2){if(45===b)p|=i;else if(13!==b)return;n++;break}if(n-1==l.length-2){if(p&i&&45===b)o=g.END,p=0;else{if(p&i||10!==b)return;n=0,v("onPartBegin"),o=g.HEADER_FIELD_START}break}b!==l[n+2]&&(n=-2),b===l[n+2]&&n++;break;case g.HEADER_FIELD_START:o=g.HEADER_FIELD,t("onHeaderField"),n=0;case g.HEADER_FIELD:if(13===b){u("onHeaderField"),o=g.HEADERS_ALMOST_DONE;break}if(n++,45===b)break;if(58===b){if(1===n)return;w("onHeaderField",!0),o=g.HEADER_VALUE_START;break}if((c=j(b))<97||c>122)return;break;case g.HEADER_VALUE_START:if(32===b)break;t("onHeaderValue"),o=g.HEADER_VALUE;case g.HEADER_VALUE:13===b&&(w("onHeaderValue",!0),v("onHeaderEnd"),o=g.HEADER_VALUE_ALMOST_DONE);break;case g.HEADER_VALUE_ALMOST_DONE:if(10!==b)return;o=g.HEADER_FIELD_START;break;case g.HEADERS_ALMOST_DONE:if(10!==b)return;v("onHeadersEnd"),o=g.PART_DATA_START;break;case g.PART_DATA_START:o=g.PART_DATA,t("onPartData");case g.PART_DATA:if(f=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|=h:45===b?p|=i:n=0;else if(n-1===l.length)if(p&h){if(n=0,10===b){p&=~h,v("onPartEnd"),v("onPartBegin"),o=g.HEADER_FIELD_START;break}}else p&i&&45===b?(v("onPartEnd"),o=g.END,p=0):n=0;n>0?k[n-1]=b:f>0&&(v("onPartData",0,f,new Uint8Array(k.buffer,k.byteOffset,k.byteLength)),f=0,t("onPartData"),d--);break;case g.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===g.HEADER_FIELD_START&&0===this.index||this.state===g.PART_DATA&&this.index===this.boundary.length)this.onPartEnd();else if(this.state!==g.END)throw Error("MultipartParser.end(): stream ended unexpectedly")}}async function m(a,b){let c,f,g,h,i,j;if(!/multipart/i.test(b))throw TypeError("Failed to fetch");let k=b.match(/boundary=(?:"([^"]+)"|([^;]+))/i);if(!k)throw TypeError("no or bad content-type header, no multipart boundary");let m=new l(k[1]||k[2]),n=[],o=new e.fS,p=a=>{g+=t.decode(a,{stream:!0})},q=a=>{n.push(a)},r=()=>{let a=new d.ZH(n,j,{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,c="",f="",g="",h="",i="",j=null,n.length=0},m.onHeaderField=function(a){c+=t.decode(a,{stream:!0})},m.onHeaderValue=function(a){f+=t.decode(a,{stream:!0})},m.onHeaderEnd=function(){if(f+=t.decode(),"content-disposition"===(c=c.toLowerCase())){let a=f.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);a&&(h=a[2]||a[3]||""),(j=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"===c&&(i=f);f="",c=""},a))m.write(b);return m.end(),o}}};