nfets 0.0.20 → 0.0.22
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/build/{Release/xml_validator.node → addons/xml_validator-linux-x64/xml_validator-linux-x64.node} +0 -0
- package/build/addons/xml_validator-macos-arm64/xml_validator-macos-arm64.node +0 -0
- package/build/addons/xml_validator-win32-x64/xml_validator-win32-x64.node +0 -0
- package/dist/{chunk-D6GG2M7K.mjs → chunk-PZMLRTJG.mjs} +2 -1
- package/dist/chunk-SMZIOTOE.mjs +1 -0
- package/dist/{chunk-W6MRGYXP.mjs → chunk-WEMHPBTC.mjs} +1 -0
- package/dist/{chunk-MXBBYFAK.mjs → chunk-WN5TC3E5.mjs} +44 -43
- package/dist/core/index.cjs +44 -43
- package/dist/core/index.mjs +2 -1
- package/dist/index.cjs +51 -50
- package/dist/index.mjs +2 -1
- package/dist/nfe/index.cjs +51 -50
- package/dist/nfe/index.mjs +2 -1
- package/dist/{src-NRIPS2N7.mjs → src-B7B5NP75.mjs} +2 -1
- package/package.json +3 -3
- package/dist/chunk-I4KZJHBR.mjs +0 -0
package/dist/nfe/index.mjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n}from"../chunk-PZMLRTJG.mjs";import"../chunk-WN5TC3E5.mjs";import"../chunk-WEMHPBTC.mjs";export{c as AccessKeyBuilder,d as DefaultDetBuilderAggregator,e as DefaultTotalBuilderAggregator,i as NFCeDto,f as NFeDto,k as NfceQrcode,j as NfceRemoteTransmitter,n as NfceXmlBuilder,h as NfeAuthorizerPipeline,l as NfeDetXmlBuilder,g as NfeRemoteTransmitter,m as NfeXmlBuilder,a as TpEmis,b as directory};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import{a as s,b as te,c as b,d as E,e as Di,f as ht}from"./chunk-W6MRGYXP.mjs";import ee from"fs";import Bi from"crypto";import{EventEmitter as Ri}from"events";var Ii,ct,ut=b(()=>{"use strict";Ii=class extends Ri{static{s(this,"PersistentFile")}constructor({filepath:t,newFilename:i,originalFilename:r,mimetype:n,hashAlgorithm:a}){super(),this.lastModifiedDate=null,Object.assign(this,{filepath:t,newFilename:i,originalFilename:r,mimetype:n,hashAlgorithm:a}),this.size=0,this._writeStream=null,typeof this.hashAlgorithm=="string"?this.hash=Bi.createHash(this.hashAlgorithm):this.hash=null}open(){this._writeStream=ee.createWriteStream(this.filepath),this._writeStream.on("error",t=>{this.emit("error",t)})}toJSON(){let t={size:this.size,filepath:this.filepath,newFilename:this.newFilename,mimetype:this.mimetype,mtime:this.lastModifiedDate,length:this.length,originalFilename:this.originalFilename};return this.hash&&this.hash!==""&&(t.hash=this.hash),t}toString(){return`PersistentFile: ${this.newFilename}, Original: ${this.originalFilename}, Path: ${this.filepath}`}write(t,i){if(this.hash&&this.hash.update(t),this._writeStream.closed){i();return}this._writeStream.write(t,()=>{this.lastModifiedDate=new Date,this.size+=t.length,this.emit("progress",this.size),i()})}end(t){this.hash&&(this.hash=this.hash.digest("hex")),this._writeStream.end(()=>{this.emit("end"),t()})}destroy(){this._writeStream.destroy();let t=this.filepath;setTimeout(function(){ee.unlink(t,()=>{})},1)}},ct=Ii});import{createHash as Pi}from"crypto";import{EventEmitter as Hi}from"events";var Ui,ft,dt=b(()=>{"use strict";Ui=class extends Hi{static{s(this,"VolatileFile")}constructor({filepath:t,newFilename:i,originalFilename:r,mimetype:n,hashAlgorithm:a,createFileWriteStream:o}){super(),this.lastModifiedDate=null,Object.assign(this,{filepath:t,newFilename:i,originalFilename:r,mimetype:n,hashAlgorithm:a,createFileWriteStream:o}),this.size=0,this._writeStream=null,typeof this.hashAlgorithm=="string"?this.hash=Pi(this.hashAlgorithm):this.hash=null}open(){this._writeStream=this.createFileWriteStream(this),this._writeStream.on("error",t=>{this.emit("error",t)})}destroy(){this._writeStream.destroy()}toJSON(){let t={size:this.size,newFilename:this.newFilename,length:this.length,originalFilename:this.originalFilename,mimetype:this.mimetype};return this.hash&&this.hash!==""&&(t.hash=this.hash),t}toString(){return`VolatileFile: ${this.originalFilename}`}write(t,i){if(this.hash&&this.hash.update(t),this._writeStream.closed||this._writeStream.destroyed){i();return}this._writeStream.write(t,()=>{this.size+=t.length,this.emit("progress",this.size),i()})}end(t){this.hash&&(this.hash=this.hash.digest("hex")),this._writeStream.end(()=>{this.emit("end"),t()})}},ft=Ui});var Se=E(c=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0});c.toBig=c.shrSL=c.shrSH=c.rotrSL=c.rotrSH=c.rotrBL=c.rotrBH=c.rotr32L=c.rotr32H=c.rotlSL=c.rotlSH=c.rotlBL=c.rotlBH=c.add5L=c.add5H=c.add4L=c.add4H=c.add3L=c.add3H=void 0;c.add=ge;c.fromBig=mt;c.split=ie;var Y=BigInt(2**32-1),pt=BigInt(32);function mt(e,t=!1){return t?{h:Number(e&Y),l:Number(e>>pt&Y)}:{h:Number(e>>pt&Y)|0,l:Number(e&Y)|0}}s(mt,"fromBig");function ie(e,t=!1){let i=e.length,r=new Uint32Array(i),n=new Uint32Array(i);for(let a=0;a<i;a++){let{h:o,l}=mt(e[a],t);[r[a],n[a]]=[o,l]}return[r,n]}s(ie,"split");var re=s((e,t)=>BigInt(e>>>0)<<pt|BigInt(t>>>0),"toBig");c.toBig=re;var se=s((e,t,i)=>e>>>i,"shrSH");c.shrSH=se;var ne=s((e,t,i)=>e<<32-i|t>>>i,"shrSL");c.shrSL=ne;var oe=s((e,t,i)=>e>>>i|t<<32-i,"rotrSH");c.rotrSH=oe;var ae=s((e,t,i)=>e<<32-i|t>>>i,"rotrSL");c.rotrSL=ae;var le=s((e,t,i)=>e<<64-i|t>>>i-32,"rotrBH");c.rotrBH=le;var he=s((e,t,i)=>e>>>i-32|t<<64-i,"rotrBL");c.rotrBL=he;var ce=s((e,t)=>t,"rotr32H");c.rotr32H=ce;var ue=s((e,t)=>e,"rotr32L");c.rotr32L=ue;var fe=s((e,t,i)=>e<<i|t>>>32-i,"rotlSH");c.rotlSH=fe;var de=s((e,t,i)=>t<<i|e>>>32-i,"rotlSL");c.rotlSL=de;var pe=s((e,t,i)=>t<<i-32|e>>>64-i,"rotlBH");c.rotlBH=pe;var me=s((e,t,i)=>e<<i-32|t>>>64-i,"rotlBL");c.rotlBL=me;function ge(e,t,i,r){let n=(t>>>0)+(r>>>0);return{h:e+i+(n/2**32|0)|0,l:n|0}}s(ge,"add");var ye=s((e,t,i)=>(e>>>0)+(t>>>0)+(i>>>0),"add3L");c.add3L=ye;var _e=s((e,t,i,r)=>t+i+r+(e/2**32|0)|0,"add3H");c.add3H=_e;var be=s((e,t,i,r)=>(e>>>0)+(t>>>0)+(i>>>0)+(r>>>0),"add4L");c.add4L=be;var we=s((e,t,i,r,n)=>t+i+r+n+(e/2**32|0)|0,"add4H");c.add4H=we;var xe=s((e,t,i,r,n)=>(e>>>0)+(t>>>0)+(i>>>0)+(r>>>0)+(n>>>0),"add5L");c.add5L=xe;var Ee=s((e,t,i,r,n,a)=>t+i+r+n+a+(e/2**32|0)|0,"add5H");c.add5H=Ee;var Ni={fromBig:mt,split:ie,toBig:re,shrSH:se,shrSL:ne,rotrSH:oe,rotrSL:ae,rotrBH:le,rotrBL:he,rotr32H:ce,rotr32L:ue,rotlSH:fe,rotlSL:de,rotlBH:pe,rotlBL:me,add:ge,add3L:ye,add3H:_e,add4L:be,add4H:we,add5H:Ee,add5L:xe};c.default=Ni});var Ae=E(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.crypto=void 0;var O=te("crypto");X.crypto=O&&typeof O=="object"&&"webcrypto"in O?O.webcrypto:O&&typeof O=="object"&&"randomBytes"in O?O:void 0});var Re=E(h=>{"use strict";Object.defineProperty(h,"__esModule",{value:!0});h.wrapXOFConstructorWithOpts=h.wrapConstructorWithOpts=h.wrapConstructor=h.Hash=h.nextTick=h.swap32IfBE=h.byteSwapIfBE=h.swap8IfBE=h.isLE=void 0;h.isBytes=Te;h.anumber=gt;h.abytes=N;h.ahash=vi;h.aexists=Ci;h.aoutput=Mi;h.u8=zi;h.u32=ji;h.clean=$i;h.createView=Vi;h.rotr=qi;h.rotl=Wi;h.byteSwap=yt;h.byteSwap32=ke;h.bytesToHex=Xi;h.hexToBytes=Ji;h.asyncLoop=Qi;h.utf8ToBytes=_t;h.bytesToUtf8=Zi;h.toBytes=J;h.kdfInputToBytes=Gi;h.concatBytes=tr;h.checkOpts=er;h.createHasher=Oe;h.createOptHasher=De;h.createXOFer=Be;h.randomBytes=rr;var U=Ae();function Te(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}s(Te,"isBytes");function gt(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}s(gt,"anumber");function N(e,...t){if(!Te(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}s(N,"abytes");function vi(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");gt(e.outputLen),gt(e.blockLen)}s(vi,"ahash");function Ci(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}s(Ci,"aexists");function Mi(e,t){N(e);let i=t.outputLen;if(e.length<i)throw new Error("digestInto() expects output buffer of length at least "+i)}s(Mi,"aoutput");function zi(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}s(zi,"u8");function ji(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}s(ji,"u32");function $i(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}s($i,"clean");function Vi(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}s(Vi,"createView");function qi(e,t){return e<<32-t|e>>>t}s(qi,"rotr");function Wi(e,t){return e<<t|e>>>32-t>>>0}s(Wi,"rotl");h.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function yt(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}s(yt,"byteSwap");h.swap8IfBE=h.isLE?e=>e:e=>yt(e);h.byteSwapIfBE=h.swap8IfBE;function ke(e){for(let t=0;t<e.length;t++)e[t]=yt(e[t]);return e}s(ke,"byteSwap32");h.swap32IfBE=h.isLE?e=>e:ke;var Le=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Yi=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Xi(e){if(N(e),Le)return e.toHex();let t="";for(let i=0;i<e.length;i++)t+=Yi[e[i]];return t}s(Xi,"bytesToHex");var L={_0:48,_9:57,A:65,F:70,a:97,f:102};function Fe(e){if(e>=L._0&&e<=L._9)return e-L._0;if(e>=L.A&&e<=L.F)return e-(L.A-10);if(e>=L.a&&e<=L.f)return e-(L.a-10)}s(Fe,"asciiToBase16");function Ji(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(Le)return Uint8Array.fromHex(e);let t=e.length,i=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);let r=new Uint8Array(i);for(let n=0,a=0;n<i;n++,a+=2){let o=Fe(e.charCodeAt(a)),l=Fe(e.charCodeAt(a+1));if(o===void 0||l===void 0){let u=e[a]+e[a+1];throw new Error('hex string expected, got non-hex character "'+u+'" at index '+a)}r[n]=o*16+l}return r}s(Ji,"hexToBytes");var Ki=s(async()=>{},"nextTick");h.nextTick=Ki;async function Qi(e,t,i){let r=Date.now();for(let n=0;n<e;n++){i(n);let a=Date.now()-r;a>=0&&a<t||(await(0,h.nextTick)(),r+=a)}}s(Qi,"asyncLoop");function _t(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}s(_t,"utf8ToBytes");function Zi(e){return new TextDecoder().decode(e)}s(Zi,"bytesToUtf8");function J(e){return typeof e=="string"&&(e=_t(e)),N(e),e}s(J,"toBytes");function Gi(e){return typeof e=="string"&&(e=_t(e)),N(e),e}s(Gi,"kdfInputToBytes");function tr(...e){let t=0;for(let r=0;r<e.length;r++){let n=e[r];N(n),t+=n.length}let i=new Uint8Array(t);for(let r=0,n=0;r<e.length;r++){let a=e[r];i.set(a,n),n+=a.length}return i}s(tr,"concatBytes");function er(e,t){if(t!==void 0&&{}.toString.call(t)!=="[object Object]")throw new Error("options should be object or undefined");return Object.assign(e,t)}s(er,"checkOpts");var ir=class{static{s(this,"Hash")}};h.Hash=ir;function Oe(e){let t=s(r=>e().update(J(r)).digest(),"hashC"),i=e();return t.outputLen=i.outputLen,t.blockLen=i.blockLen,t.create=()=>e(),t}s(Oe,"createHasher");function De(e){let t=s((r,n)=>e(n).update(J(r)).digest(),"hashC"),i=e({});return t.outputLen=i.outputLen,t.blockLen=i.blockLen,t.create=r=>e(r),t}s(De,"createOptHasher");function Be(e){let t=s((r,n)=>e(n).update(J(r)).digest(),"hashC"),i=e({});return t.outputLen=i.outputLen,t.blockLen=i.blockLen,t.create=r=>e(r),t}s(Be,"createXOFer");h.wrapConstructor=Oe;h.wrapConstructorWithOpts=De;h.wrapXOFConstructorWithOpts=Be;function rr(e=32){if(U.crypto&&typeof U.crypto.getRandomValues=="function")return U.crypto.getRandomValues(new Uint8Array(e));if(U.crypto&&typeof U.crypto.randomBytes=="function")return Uint8Array.from(U.crypto.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}s(rr,"randomBytes")});var je=E(p=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});p.shake256=p.shake128=p.keccak_512=p.keccak_384=p.keccak_256=p.keccak_224=p.sha3_512=p.sha3_384=p.sha3_256=p.sha3_224=p.Keccak=void 0;p.keccakP=Ce;var M=Se(),w=Re(),sr=BigInt(0),C=BigInt(1),nr=BigInt(2),or=BigInt(7),ar=BigInt(256),lr=BigInt(113),He=[],Ue=[],Ne=[];for(let e=0,t=C,i=1,r=0;e<24;e++){[i,r]=[r,(2*i+3*r)%5],He.push(2*(5*r+i)),Ue.push((e+1)*(e+2)/2%64);let n=sr;for(let a=0;a<7;a++)t=(t<<C^(t>>or)*lr)%ar,t&nr&&(n^=C<<(C<<BigInt(a))-C);Ne.push(n)}var ve=(0,M.split)(Ne,!0),hr=ve[0],cr=ve[1],Ie=s((e,t,i)=>i>32?(0,M.rotlBH)(e,t,i):(0,M.rotlSH)(e,t,i),"rotlH"),Pe=s((e,t,i)=>i>32?(0,M.rotlBL)(e,t,i):(0,M.rotlSL)(e,t,i),"rotlL");function Ce(e,t=24){let i=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let o=0;o<10;o++)i[o]=e[o]^e[o+10]^e[o+20]^e[o+30]^e[o+40];for(let o=0;o<10;o+=2){let l=(o+8)%10,u=(o+2)%10,y=i[u],d=i[u+1],T=Ie(y,d,1)^i[l],_=Pe(y,d,1)^i[l+1];for(let S=0;S<50;S+=10)e[o+S]^=T,e[o+S+1]^=_}let n=e[2],a=e[3];for(let o=0;o<24;o++){let l=Ue[o],u=Ie(n,a,l),y=Pe(n,a,l),d=He[o];n=e[d],a=e[d+1],e[d]=u,e[d+1]=y}for(let o=0;o<50;o+=10){for(let l=0;l<10;l++)i[l]=e[o+l];for(let l=0;l<10;l++)e[o+l]^=~i[(l+2)%10]&i[(l+4)%10]}e[0]^=hr[r],e[1]^=cr[r]}(0,w.clean)(i)}s(Ce,"keccakP");var bt=class Me extends w.Hash{static{s(this,"Keccak")}constructor(t,i,r,n=!1,a=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=i,this.outputLen=r,this.enableXOF=n,this.rounds=a,(0,w.anumber)(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=(0,w.u32)(this.state)}clone(){return this._cloneInto()}keccak(){(0,w.swap32IfBE)(this.state32),Ce(this.state32,this.rounds),(0,w.swap32IfBE)(this.state32),this.posOut=0,this.pos=0}update(t){(0,w.aexists)(this),t=(0,w.toBytes)(t),(0,w.abytes)(t);let{blockLen:i,state:r}=this,n=t.length;for(let a=0;a<n;){let o=Math.min(i-this.pos,n-a);for(let l=0;l<o;l++)r[this.pos++]^=t[a++];this.pos===i&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:i,pos:r,blockLen:n}=this;t[r]^=i,(i&128)!==0&&r===n-1&&this.keccak(),t[n-1]^=128,this.keccak()}writeInto(t){(0,w.aexists)(this,!1),(0,w.abytes)(t),this.finish();let i=this.state,{blockLen:r}=this;for(let n=0,a=t.length;n<a;){this.posOut>=r&&this.keccak();let o=Math.min(r-this.posOut,a-n);t.set(i.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return(0,w.anumber)(t),this.xofInto(new Uint8Array(t))}digestInto(t){if((0,w.aoutput)(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,(0,w.clean)(this.state)}_cloneInto(t){let{blockLen:i,suffix:r,outputLen:n,rounds:a,enableXOF:o}=this;return t||(t=new Me(i,r,n,o,a)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=a,t.suffix=r,t.outputLen=n,t.enableXOF=o,t.destroyed=this.destroyed,t}};p.Keccak=bt;var D=s((e,t,i)=>(0,w.createHasher)(()=>new bt(t,e,i)),"gen");p.sha3_224=D(6,144,224/8);p.sha3_256=D(6,136,256/8);p.sha3_384=D(6,104,384/8);p.sha3_512=D(6,72,512/8);p.keccak_224=D(1,144,224/8);p.keccak_256=D(1,136,256/8);p.keccak_384=D(1,104,384/8);p.keccak_512=D(1,72,512/8);var ze=s((e,t,i)=>(0,w.createXOFer)((r={})=>new bt(t,e,r.dkLen===void 0?i:r.dkLen,!0)),"genShake");p.shake128=ze(31,168,128/8);p.shake256=ze(31,136,256/8)});var Ke=E((Fs,B)=>{"use strict";var{sha3_512:ur}=je(),Ve=24,z=32,wt=s((e=4,t=Math.random)=>{let i="";for(;i.length<e;)i=i+Math.floor(t()*36).toString(36);return i},"createEntropy");function qe(e){let t=8n,i=0n;for(let r of e.values()){let n=BigInt(r);i=(i<<t)+n}return i}s(qe,"bufToBigInt");var We=s((e="")=>qe(ur(e)).toString(36).slice(1),"hash"),$e=Array.from({length:26},(e,t)=>String.fromCharCode(t+97)),fr=s(e=>$e[Math.floor(e()*$e.length)],"randomLetter"),Ye=s(({globalObj:e=typeof global<"u"?global:typeof window<"u"?window:{},random:t=Math.random}={})=>{let i=Object.keys(e).toString(),r=i.length?i+wt(z,t):wt(z,t);return We(r).substring(0,z)},"createFingerprint"),Xe=s(e=>()=>e++,"createCounter"),dr=476782367,Je=s(({random:e=Math.random,counter:t=Xe(Math.floor(e()*dr)),length:i=Ve,fingerprint:r=Ye({random:e})}={})=>s(function(){let a=fr(e),o=Date.now().toString(36),l=t().toString(36),u=wt(i,e),y=`${o+u+l+r}`;return`${a+We(y).substring(1,i)}`},"cuid2"),"init"),pr=Je(),mr=s((e,{minLength:t=2,maxLength:i=z}={})=>{let r=e.length,n=/^[0-9a-z]+$/;try{if(typeof e=="string"&&r>=t&&r<=i&&n.test(e))return!0}finally{}return!1},"isCuid");B.exports.getConstants=()=>({defaultLength:Ve,bigLength:z});B.exports.init=Je;B.exports.createId=pr;B.exports.bufToBigInt=qe;B.exports.createCounter=Xe;B.exports.createFingerprint=Ye;B.exports.isCuid=mr});var Qe=E((ks,j)=>{"use strict";var{createId:gr,init:yr,getConstants:_r,isCuid:br}=Ke();j.exports.createId=gr;j.exports.init=yr;j.exports.getConstants=_r;j.exports.isCuid=br});var xt=E((Ls,Ge)=>{"use strict";Ge.exports=Ze;function Ze(e,t){if(e&&t)return Ze(e)(t);if(typeof e!="function")throw new TypeError("need wrapper function");return Object.keys(e).forEach(function(r){i[r]=e[r]}),i;function i(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];var a=e.apply(this,r),o=r[r.length-1];return typeof a=="function"&&a!==o&&Object.keys(o).forEach(function(l){a[l]=o[l]}),a}s(i,"wrapper")}s(Ze,"wrappy")});var si=E((Ds,ri)=>{"use strict";var K,wr=typeof setImmediate=="function";ri.exports=ei;function ei(e){F.length||(ii(),Et=!0),F[F.length]=e}s(ei,"rawAsap");var F=[],Et=!1,A=0,xr=1024;function ti(){for(;A<F.length;){var e=A;if(A=A+1,F[e].call(),A>xr){for(var t=0,i=F.length-A;t<i;t++)F[t]=F[t+A];F.length-=A,A=0}}F.length=0,A=0,Et=!1}s(ti,"flush");ei.requestFlush=ii;function ii(){var e=process.domain;e&&(K||(K=te("domain")),K.active=process.domain=null),Et&&wr?setImmediate(ti):process.nextTick(ti),e&&(K.active=process.domain=e)}s(ii,"requestFlush")});var li=E((Rs,ai)=>{"use strict";var ni=si(),St=[];ai.exports=Er;function Er(e){var t;St.length?t=St.pop():t=new oi,t.task=e,t.domain=process.domain,ni(t)}s(Er,"asap");function oi(){this.task=null,this.domain=null}s(oi,"RawTask");oi.prototype.call=function(){this.domain&&this.domain.enter();var e=!0;try{this.task.call(),e=!1,this.domain&&this.domain.exit()}finally{e&&ni.requestFlush(),this.task=null,this.domain=null,St.push(this)}}});var ui=E((Ps,ci)=>{"use strict";var Sr=xt();ci.exports=Sr(Ar);var hi=li();function Ar(e){var t=!0;return hi(function(){t=!1}),s(function(){var r=arguments,n=this;t?hi(function(){e.apply(n,r)}):e.apply(n,r)},"zalgoSafe")}s(Ar,"dezalgo")});var pi=E((Us,At)=>{"use strict";var fi=xt();At.exports=fi(Q);At.exports.strict=fi(di);Q.proto=Q(function(){Object.defineProperty(Function.prototype,"once",{value:s(function(){return Q(this)},"value"),configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:s(function(){return di(this)},"value"),configurable:!0})});function Q(e){var t=s(function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))},"f");return t.called=!1,t}s(Q,"once");function di(e){var t=s(function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},"f"),i=e.name||"Function wrapped with `once`";return t.onceError=i+" shouldn't be called more than once",t.called=!1,t}s(di,"onceStrict")});var $={};Di($,{aborted:()=>kt,biggerThanMaxFileSize:()=>zt,biggerThanTotalMaxFileSize:()=>Pt,cannotCreateDir:()=>$t,default:()=>m,filenameNotString:()=>Dt,malformedMultipart:()=>Nt,maxFieldsExceeded:()=>Rt,maxFieldsSizeExceeded:()=>Bt,maxFilesExceeded:()=>Mt,missingContentType:()=>Ut,missingMultipartBoundary:()=>vt,missingPlugin:()=>Ft,noEmptyFiles:()=>Ht,noParser:()=>Lt,pluginFailed:()=>jt,pluginFunction:()=>Tt,smallerThanMinFileSize:()=>It,uninitializedParser:()=>Ot,unknownTransferEncoding:()=>Ct});var Ft,Tt,kt,Lt,Ot,Dt,Bt,Rt,It,Pt,Ht,Ut,Nt,vt,Ct,Mt,zt,jt,$t,Fr,m,I=b(()=>{"use strict";Ft=1e3,Tt=1001,kt=1002,Lt=1003,Ot=1004,Dt=1005,Bt=1006,Rt=1007,It=1008,Pt=1009,Ht=1010,Ut=1011,Nt=1012,vt=1013,Ct=1014,Mt=1015,zt=1016,jt=1017,$t=1018,Fr=class extends Error{static{s(this,"FormidableError")}constructor(e,t,i=500){super(e),this.code=t,this.httpCode=i}},m=Fr});import{Transform as Tr}from"stream";var kr,Z,Vt=b(()=>{"use strict";kr=class extends Tr{static{s(this,"DummyParser")}constructor(t,i={}){super(),this.globalOptions={...i},this.incomingForm=t}_flush(t){this.incomingForm.ended=!0,this.incomingForm._maybeEnd(),t()}},Z=kr});import{Transform as Lr}from"stream";function Ir(e){return e|32}var x,f,mi,R,G,tt,Or,V,Dr,Br,Rr,gi,yi,q,et=b(()=>{"use strict";I();I();x=0,f={PARSER_UNINITIALIZED:x++,START:x++,START_BOUNDARY:x++,HEADER_FIELD_START:x++,HEADER_FIELD:x++,HEADER_VALUE_START:x++,HEADER_VALUE:x++,HEADER_VALUE_ALMOST_DONE:x++,HEADERS_ALMOST_DONE:x++,PART_DATA_START:x++,PART_DATA:x++,PART_END:x++,END:x++},mi=1,R={PART_BOUNDARY:mi,LAST_BOUNDARY:mi*=2},G=10,tt=13,Or=32,V=45,Dr=58,Br=97,Rr=122;s(Ir,"lower");gi={};Object.keys(f).forEach(e=>{gi[e]=f[e]});yi=class _i extends Lr{static{s(this,"MultipartParser")}constructor(t={}){super({readableObjectMode:!0}),this.boundary=null,this.boundaryChars=null,this.lookbehind=null,this.bufferLength=0,this.state=f.PARSER_UNINITIALIZED,this.globalOptions={...t},this.index=null,this.flags=0}_endUnexpected(){return new m(`MultipartParser.end(): stream ended unexpectedly: ${this.explain()}`,1012,400)}_flush(t){this.state===f.HEADER_FIELD_START&&this.index===0||this.state===f.PART_DATA&&this.index===this.boundary.length?(this._handleCallback("partEnd"),this._handleCallback("end"),t()):this.state!==f.END?t(this._endUnexpected()):t()}initWithBoundary(t){this.boundary=Buffer.from(`\r
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as s,b as te,c as b,d as E,e as Di,f as ht}from"./chunk-WEMHPBTC.mjs";import ee from"fs";import Bi from"crypto";import{EventEmitter as Ri}from"events";var Ii,ct,ut=b(()=>{"use strict";Ii=class extends Ri{static{s(this,"PersistentFile")}constructor({filepath:t,newFilename:i,originalFilename:r,mimetype:n,hashAlgorithm:a}){super(),this.lastModifiedDate=null,Object.assign(this,{filepath:t,newFilename:i,originalFilename:r,mimetype:n,hashAlgorithm:a}),this.size=0,this._writeStream=null,typeof this.hashAlgorithm=="string"?this.hash=Bi.createHash(this.hashAlgorithm):this.hash=null}open(){this._writeStream=ee.createWriteStream(this.filepath),this._writeStream.on("error",t=>{this.emit("error",t)})}toJSON(){let t={size:this.size,filepath:this.filepath,newFilename:this.newFilename,mimetype:this.mimetype,mtime:this.lastModifiedDate,length:this.length,originalFilename:this.originalFilename};return this.hash&&this.hash!==""&&(t.hash=this.hash),t}toString(){return`PersistentFile: ${this.newFilename}, Original: ${this.originalFilename}, Path: ${this.filepath}`}write(t,i){if(this.hash&&this.hash.update(t),this._writeStream.closed){i();return}this._writeStream.write(t,()=>{this.lastModifiedDate=new Date,this.size+=t.length,this.emit("progress",this.size),i()})}end(t){this.hash&&(this.hash=this.hash.digest("hex")),this._writeStream.end(()=>{this.emit("end"),t()})}destroy(){this._writeStream.destroy();let t=this.filepath;setTimeout(function(){ee.unlink(t,()=>{})},1)}},ct=Ii});import{createHash as Pi}from"crypto";import{EventEmitter as Hi}from"events";var Ui,ft,dt=b(()=>{"use strict";Ui=class extends Hi{static{s(this,"VolatileFile")}constructor({filepath:t,newFilename:i,originalFilename:r,mimetype:n,hashAlgorithm:a,createFileWriteStream:o}){super(),this.lastModifiedDate=null,Object.assign(this,{filepath:t,newFilename:i,originalFilename:r,mimetype:n,hashAlgorithm:a,createFileWriteStream:o}),this.size=0,this._writeStream=null,typeof this.hashAlgorithm=="string"?this.hash=Pi(this.hashAlgorithm):this.hash=null}open(){this._writeStream=this.createFileWriteStream(this),this._writeStream.on("error",t=>{this.emit("error",t)})}destroy(){this._writeStream.destroy()}toJSON(){let t={size:this.size,newFilename:this.newFilename,length:this.length,originalFilename:this.originalFilename,mimetype:this.mimetype};return this.hash&&this.hash!==""&&(t.hash=this.hash),t}toString(){return`VolatileFile: ${this.originalFilename}`}write(t,i){if(this.hash&&this.hash.update(t),this._writeStream.closed||this._writeStream.destroyed){i();return}this._writeStream.write(t,()=>{this.size+=t.length,this.emit("progress",this.size),i()})}end(t){this.hash&&(this.hash=this.hash.digest("hex")),this._writeStream.end(()=>{this.emit("end"),t()})}},ft=Ui});var Se=E(c=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0});c.toBig=c.shrSL=c.shrSH=c.rotrSL=c.rotrSH=c.rotrBL=c.rotrBH=c.rotr32L=c.rotr32H=c.rotlSL=c.rotlSH=c.rotlBL=c.rotlBH=c.add5L=c.add5H=c.add4L=c.add4H=c.add3L=c.add3H=void 0;c.add=ge;c.fromBig=mt;c.split=ie;var Y=BigInt(2**32-1),pt=BigInt(32);function mt(e,t=!1){return t?{h:Number(e&Y),l:Number(e>>pt&Y)}:{h:Number(e>>pt&Y)|0,l:Number(e&Y)|0}}s(mt,"fromBig");function ie(e,t=!1){let i=e.length,r=new Uint32Array(i),n=new Uint32Array(i);for(let a=0;a<i;a++){let{h:o,l}=mt(e[a],t);[r[a],n[a]]=[o,l]}return[r,n]}s(ie,"split");var re=s((e,t)=>BigInt(e>>>0)<<pt|BigInt(t>>>0),"toBig");c.toBig=re;var se=s((e,t,i)=>e>>>i,"shrSH");c.shrSH=se;var ne=s((e,t,i)=>e<<32-i|t>>>i,"shrSL");c.shrSL=ne;var oe=s((e,t,i)=>e>>>i|t<<32-i,"rotrSH");c.rotrSH=oe;var ae=s((e,t,i)=>e<<32-i|t>>>i,"rotrSL");c.rotrSL=ae;var le=s((e,t,i)=>e<<64-i|t>>>i-32,"rotrBH");c.rotrBH=le;var he=s((e,t,i)=>e>>>i-32|t<<64-i,"rotrBL");c.rotrBL=he;var ce=s((e,t)=>t,"rotr32H");c.rotr32H=ce;var ue=s((e,t)=>e,"rotr32L");c.rotr32L=ue;var fe=s((e,t,i)=>e<<i|t>>>32-i,"rotlSH");c.rotlSH=fe;var de=s((e,t,i)=>t<<i|e>>>32-i,"rotlSL");c.rotlSL=de;var pe=s((e,t,i)=>t<<i-32|e>>>64-i,"rotlBH");c.rotlBH=pe;var me=s((e,t,i)=>e<<i-32|t>>>64-i,"rotlBL");c.rotlBL=me;function ge(e,t,i,r){let n=(t>>>0)+(r>>>0);return{h:e+i+(n/2**32|0)|0,l:n|0}}s(ge,"add");var ye=s((e,t,i)=>(e>>>0)+(t>>>0)+(i>>>0),"add3L");c.add3L=ye;var _e=s((e,t,i,r)=>t+i+r+(e/2**32|0)|0,"add3H");c.add3H=_e;var be=s((e,t,i,r)=>(e>>>0)+(t>>>0)+(i>>>0)+(r>>>0),"add4L");c.add4L=be;var we=s((e,t,i,r,n)=>t+i+r+n+(e/2**32|0)|0,"add4H");c.add4H=we;var xe=s((e,t,i,r,n)=>(e>>>0)+(t>>>0)+(i>>>0)+(r>>>0)+(n>>>0),"add5L");c.add5L=xe;var Ee=s((e,t,i,r,n,a)=>t+i+r+n+a+(e/2**32|0)|0,"add5H");c.add5H=Ee;var Ni={fromBig:mt,split:ie,toBig:re,shrSH:se,shrSL:ne,rotrSH:oe,rotrSL:ae,rotrBH:le,rotrBL:he,rotr32H:ce,rotr32L:ue,rotlSH:fe,rotlSL:de,rotlBH:pe,rotlBL:me,add:ge,add3L:ye,add3H:_e,add4L:be,add4H:we,add5H:Ee,add5L:xe};c.default=Ni});var Ae=E(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.crypto=void 0;var O=te("crypto");X.crypto=O&&typeof O=="object"&&"webcrypto"in O?O.webcrypto:O&&typeof O=="object"&&"randomBytes"in O?O:void 0});var Re=E(h=>{"use strict";Object.defineProperty(h,"__esModule",{value:!0});h.wrapXOFConstructorWithOpts=h.wrapConstructorWithOpts=h.wrapConstructor=h.Hash=h.nextTick=h.swap32IfBE=h.byteSwapIfBE=h.swap8IfBE=h.isLE=void 0;h.isBytes=Te;h.anumber=gt;h.abytes=N;h.ahash=vi;h.aexists=Ci;h.aoutput=Mi;h.u8=zi;h.u32=ji;h.clean=$i;h.createView=Vi;h.rotr=qi;h.rotl=Wi;h.byteSwap=yt;h.byteSwap32=ke;h.bytesToHex=Xi;h.hexToBytes=Ji;h.asyncLoop=Qi;h.utf8ToBytes=_t;h.bytesToUtf8=Zi;h.toBytes=J;h.kdfInputToBytes=Gi;h.concatBytes=tr;h.checkOpts=er;h.createHasher=Oe;h.createOptHasher=De;h.createXOFer=Be;h.randomBytes=rr;var U=Ae();function Te(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}s(Te,"isBytes");function gt(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}s(gt,"anumber");function N(e,...t){if(!Te(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}s(N,"abytes");function vi(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");gt(e.outputLen),gt(e.blockLen)}s(vi,"ahash");function Ci(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}s(Ci,"aexists");function Mi(e,t){N(e);let i=t.outputLen;if(e.length<i)throw new Error("digestInto() expects output buffer of length at least "+i)}s(Mi,"aoutput");function zi(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}s(zi,"u8");function ji(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}s(ji,"u32");function $i(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}s($i,"clean");function Vi(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}s(Vi,"createView");function qi(e,t){return e<<32-t|e>>>t}s(qi,"rotr");function Wi(e,t){return e<<t|e>>>32-t>>>0}s(Wi,"rotl");h.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function yt(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}s(yt,"byteSwap");h.swap8IfBE=h.isLE?e=>e:e=>yt(e);h.byteSwapIfBE=h.swap8IfBE;function ke(e){for(let t=0;t<e.length;t++)e[t]=yt(e[t]);return e}s(ke,"byteSwap32");h.swap32IfBE=h.isLE?e=>e:ke;var Le=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Yi=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Xi(e){if(N(e),Le)return e.toHex();let t="";for(let i=0;i<e.length;i++)t+=Yi[e[i]];return t}s(Xi,"bytesToHex");var L={_0:48,_9:57,A:65,F:70,a:97,f:102};function Fe(e){if(e>=L._0&&e<=L._9)return e-L._0;if(e>=L.A&&e<=L.F)return e-(L.A-10);if(e>=L.a&&e<=L.f)return e-(L.a-10)}s(Fe,"asciiToBase16");function Ji(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(Le)return Uint8Array.fromHex(e);let t=e.length,i=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);let r=new Uint8Array(i);for(let n=0,a=0;n<i;n++,a+=2){let o=Fe(e.charCodeAt(a)),l=Fe(e.charCodeAt(a+1));if(o===void 0||l===void 0){let u=e[a]+e[a+1];throw new Error('hex string expected, got non-hex character "'+u+'" at index '+a)}r[n]=o*16+l}return r}s(Ji,"hexToBytes");var Ki=s(async()=>{},"nextTick");h.nextTick=Ki;async function Qi(e,t,i){let r=Date.now();for(let n=0;n<e;n++){i(n);let a=Date.now()-r;a>=0&&a<t||(await(0,h.nextTick)(),r+=a)}}s(Qi,"asyncLoop");function _t(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}s(_t,"utf8ToBytes");function Zi(e){return new TextDecoder().decode(e)}s(Zi,"bytesToUtf8");function J(e){return typeof e=="string"&&(e=_t(e)),N(e),e}s(J,"toBytes");function Gi(e){return typeof e=="string"&&(e=_t(e)),N(e),e}s(Gi,"kdfInputToBytes");function tr(...e){let t=0;for(let r=0;r<e.length;r++){let n=e[r];N(n),t+=n.length}let i=new Uint8Array(t);for(let r=0,n=0;r<e.length;r++){let a=e[r];i.set(a,n),n+=a.length}return i}s(tr,"concatBytes");function er(e,t){if(t!==void 0&&{}.toString.call(t)!=="[object Object]")throw new Error("options should be object or undefined");return Object.assign(e,t)}s(er,"checkOpts");var ir=class{static{s(this,"Hash")}};h.Hash=ir;function Oe(e){let t=s(r=>e().update(J(r)).digest(),"hashC"),i=e();return t.outputLen=i.outputLen,t.blockLen=i.blockLen,t.create=()=>e(),t}s(Oe,"createHasher");function De(e){let t=s((r,n)=>e(n).update(J(r)).digest(),"hashC"),i=e({});return t.outputLen=i.outputLen,t.blockLen=i.blockLen,t.create=r=>e(r),t}s(De,"createOptHasher");function Be(e){let t=s((r,n)=>e(n).update(J(r)).digest(),"hashC"),i=e({});return t.outputLen=i.outputLen,t.blockLen=i.blockLen,t.create=r=>e(r),t}s(Be,"createXOFer");h.wrapConstructor=Oe;h.wrapConstructorWithOpts=De;h.wrapXOFConstructorWithOpts=Be;function rr(e=32){if(U.crypto&&typeof U.crypto.getRandomValues=="function")return U.crypto.getRandomValues(new Uint8Array(e));if(U.crypto&&typeof U.crypto.randomBytes=="function")return Uint8Array.from(U.crypto.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}s(rr,"randomBytes")});var je=E(p=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});p.shake256=p.shake128=p.keccak_512=p.keccak_384=p.keccak_256=p.keccak_224=p.sha3_512=p.sha3_384=p.sha3_256=p.sha3_224=p.Keccak=void 0;p.keccakP=Ce;var M=Se(),w=Re(),sr=BigInt(0),C=BigInt(1),nr=BigInt(2),or=BigInt(7),ar=BigInt(256),lr=BigInt(113),He=[],Ue=[],Ne=[];for(let e=0,t=C,i=1,r=0;e<24;e++){[i,r]=[r,(2*i+3*r)%5],He.push(2*(5*r+i)),Ue.push((e+1)*(e+2)/2%64);let n=sr;for(let a=0;a<7;a++)t=(t<<C^(t>>or)*lr)%ar,t&nr&&(n^=C<<(C<<BigInt(a))-C);Ne.push(n)}var ve=(0,M.split)(Ne,!0),hr=ve[0],cr=ve[1],Ie=s((e,t,i)=>i>32?(0,M.rotlBH)(e,t,i):(0,M.rotlSH)(e,t,i),"rotlH"),Pe=s((e,t,i)=>i>32?(0,M.rotlBL)(e,t,i):(0,M.rotlSL)(e,t,i),"rotlL");function Ce(e,t=24){let i=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let o=0;o<10;o++)i[o]=e[o]^e[o+10]^e[o+20]^e[o+30]^e[o+40];for(let o=0;o<10;o+=2){let l=(o+8)%10,u=(o+2)%10,y=i[u],d=i[u+1],T=Ie(y,d,1)^i[l],_=Pe(y,d,1)^i[l+1];for(let S=0;S<50;S+=10)e[o+S]^=T,e[o+S+1]^=_}let n=e[2],a=e[3];for(let o=0;o<24;o++){let l=Ue[o],u=Ie(n,a,l),y=Pe(n,a,l),d=He[o];n=e[d],a=e[d+1],e[d]=u,e[d+1]=y}for(let o=0;o<50;o+=10){for(let l=0;l<10;l++)i[l]=e[o+l];for(let l=0;l<10;l++)e[o+l]^=~i[(l+2)%10]&i[(l+4)%10]}e[0]^=hr[r],e[1]^=cr[r]}(0,w.clean)(i)}s(Ce,"keccakP");var bt=class Me extends w.Hash{static{s(this,"Keccak")}constructor(t,i,r,n=!1,a=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=i,this.outputLen=r,this.enableXOF=n,this.rounds=a,(0,w.anumber)(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=(0,w.u32)(this.state)}clone(){return this._cloneInto()}keccak(){(0,w.swap32IfBE)(this.state32),Ce(this.state32,this.rounds),(0,w.swap32IfBE)(this.state32),this.posOut=0,this.pos=0}update(t){(0,w.aexists)(this),t=(0,w.toBytes)(t),(0,w.abytes)(t);let{blockLen:i,state:r}=this,n=t.length;for(let a=0;a<n;){let o=Math.min(i-this.pos,n-a);for(let l=0;l<o;l++)r[this.pos++]^=t[a++];this.pos===i&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:i,pos:r,blockLen:n}=this;t[r]^=i,(i&128)!==0&&r===n-1&&this.keccak(),t[n-1]^=128,this.keccak()}writeInto(t){(0,w.aexists)(this,!1),(0,w.abytes)(t),this.finish();let i=this.state,{blockLen:r}=this;for(let n=0,a=t.length;n<a;){this.posOut>=r&&this.keccak();let o=Math.min(r-this.posOut,a-n);t.set(i.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return(0,w.anumber)(t),this.xofInto(new Uint8Array(t))}digestInto(t){if((0,w.aoutput)(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,(0,w.clean)(this.state)}_cloneInto(t){let{blockLen:i,suffix:r,outputLen:n,rounds:a,enableXOF:o}=this;return t||(t=new Me(i,r,n,o,a)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=a,t.suffix=r,t.outputLen=n,t.enableXOF=o,t.destroyed=this.destroyed,t}};p.Keccak=bt;var D=s((e,t,i)=>(0,w.createHasher)(()=>new bt(t,e,i)),"gen");p.sha3_224=D(6,144,224/8);p.sha3_256=D(6,136,256/8);p.sha3_384=D(6,104,384/8);p.sha3_512=D(6,72,512/8);p.keccak_224=D(1,144,224/8);p.keccak_256=D(1,136,256/8);p.keccak_384=D(1,104,384/8);p.keccak_512=D(1,72,512/8);var ze=s((e,t,i)=>(0,w.createXOFer)((r={})=>new bt(t,e,r.dkLen===void 0?i:r.dkLen,!0)),"genShake");p.shake128=ze(31,168,128/8);p.shake256=ze(31,136,256/8)});var Ke=E((Fs,B)=>{"use strict";var{sha3_512:ur}=je(),Ve=24,z=32,wt=s((e=4,t=Math.random)=>{let i="";for(;i.length<e;)i=i+Math.floor(t()*36).toString(36);return i},"createEntropy");function qe(e){let t=8n,i=0n;for(let r of e.values()){let n=BigInt(r);i=(i<<t)+n}return i}s(qe,"bufToBigInt");var We=s((e="")=>qe(ur(e)).toString(36).slice(1),"hash"),$e=Array.from({length:26},(e,t)=>String.fromCharCode(t+97)),fr=s(e=>$e[Math.floor(e()*$e.length)],"randomLetter"),Ye=s(({globalObj:e=typeof global<"u"?global:typeof window<"u"?window:{},random:t=Math.random}={})=>{let i=Object.keys(e).toString(),r=i.length?i+wt(z,t):wt(z,t);return We(r).substring(0,z)},"createFingerprint"),Xe=s(e=>()=>e++,"createCounter"),dr=476782367,Je=s(({random:e=Math.random,counter:t=Xe(Math.floor(e()*dr)),length:i=Ve,fingerprint:r=Ye({random:e})}={})=>s(function(){let a=fr(e),o=Date.now().toString(36),l=t().toString(36),u=wt(i,e),y=`${o+u+l+r}`;return`${a+We(y).substring(1,i)}`},"cuid2"),"init"),pr=Je(),mr=s((e,{minLength:t=2,maxLength:i=z}={})=>{let r=e.length,n=/^[0-9a-z]+$/;try{if(typeof e=="string"&&r>=t&&r<=i&&n.test(e))return!0}finally{}return!1},"isCuid");B.exports.getConstants=()=>({defaultLength:Ve,bigLength:z});B.exports.init=Je;B.exports.createId=pr;B.exports.bufToBigInt=qe;B.exports.createCounter=Xe;B.exports.createFingerprint=Ye;B.exports.isCuid=mr});var Qe=E((ks,j)=>{"use strict";var{createId:gr,init:yr,getConstants:_r,isCuid:br}=Ke();j.exports.createId=gr;j.exports.init=yr;j.exports.getConstants=_r;j.exports.isCuid=br});var xt=E((Ls,Ge)=>{"use strict";Ge.exports=Ze;function Ze(e,t){if(e&&t)return Ze(e)(t);if(typeof e!="function")throw new TypeError("need wrapper function");return Object.keys(e).forEach(function(r){i[r]=e[r]}),i;function i(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];var a=e.apply(this,r),o=r[r.length-1];return typeof a=="function"&&a!==o&&Object.keys(o).forEach(function(l){a[l]=o[l]}),a}s(i,"wrapper")}s(Ze,"wrappy")});var si=E((Ds,ri)=>{"use strict";var K,wr=typeof setImmediate=="function";ri.exports=ei;function ei(e){F.length||(ii(),Et=!0),F[F.length]=e}s(ei,"rawAsap");var F=[],Et=!1,A=0,xr=1024;function ti(){for(;A<F.length;){var e=A;if(A=A+1,F[e].call(),A>xr){for(var t=0,i=F.length-A;t<i;t++)F[t]=F[t+A];F.length-=A,A=0}}F.length=0,A=0,Et=!1}s(ti,"flush");ei.requestFlush=ii;function ii(){var e=process.domain;e&&(K||(K=te("domain")),K.active=process.domain=null),Et&&wr?setImmediate(ti):process.nextTick(ti),e&&(K.active=process.domain=e)}s(ii,"requestFlush")});var li=E((Rs,ai)=>{"use strict";var ni=si(),St=[];ai.exports=Er;function Er(e){var t;St.length?t=St.pop():t=new oi,t.task=e,t.domain=process.domain,ni(t)}s(Er,"asap");function oi(){this.task=null,this.domain=null}s(oi,"RawTask");oi.prototype.call=function(){this.domain&&this.domain.enter();var e=!0;try{this.task.call(),e=!1,this.domain&&this.domain.exit()}finally{e&&ni.requestFlush(),this.task=null,this.domain=null,St.push(this)}}});var ui=E((Ps,ci)=>{"use strict";var Sr=xt();ci.exports=Sr(Ar);var hi=li();function Ar(e){var t=!0;return hi(function(){t=!1}),s(function(){var r=arguments,n=this;t?hi(function(){e.apply(n,r)}):e.apply(n,r)},"zalgoSafe")}s(Ar,"dezalgo")});var pi=E((Us,At)=>{"use strict";var fi=xt();At.exports=fi(Q);At.exports.strict=fi(di);Q.proto=Q(function(){Object.defineProperty(Function.prototype,"once",{value:s(function(){return Q(this)},"value"),configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:s(function(){return di(this)},"value"),configurable:!0})});function Q(e){var t=s(function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))},"f");return t.called=!1,t}s(Q,"once");function di(e){var t=s(function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},"f"),i=e.name||"Function wrapped with `once`";return t.onceError=i+" shouldn't be called more than once",t.called=!1,t}s(di,"onceStrict")});var $={};Di($,{aborted:()=>kt,biggerThanMaxFileSize:()=>zt,biggerThanTotalMaxFileSize:()=>Pt,cannotCreateDir:()=>$t,default:()=>m,filenameNotString:()=>Dt,malformedMultipart:()=>Nt,maxFieldsExceeded:()=>Rt,maxFieldsSizeExceeded:()=>Bt,maxFilesExceeded:()=>Mt,missingContentType:()=>Ut,missingMultipartBoundary:()=>vt,missingPlugin:()=>Ft,noEmptyFiles:()=>Ht,noParser:()=>Lt,pluginFailed:()=>jt,pluginFunction:()=>Tt,smallerThanMinFileSize:()=>It,uninitializedParser:()=>Ot,unknownTransferEncoding:()=>Ct});var Ft,Tt,kt,Lt,Ot,Dt,Bt,Rt,It,Pt,Ht,Ut,Nt,vt,Ct,Mt,zt,jt,$t,Fr,m,I=b(()=>{"use strict";Ft=1e3,Tt=1001,kt=1002,Lt=1003,Ot=1004,Dt=1005,Bt=1006,Rt=1007,It=1008,Pt=1009,Ht=1010,Ut=1011,Nt=1012,vt=1013,Ct=1014,Mt=1015,zt=1016,jt=1017,$t=1018,Fr=class extends Error{static{s(this,"FormidableError")}constructor(e,t,i=500){super(e),this.code=t,this.httpCode=i}},m=Fr});import{Transform as Tr}from"stream";var kr,Z,Vt=b(()=>{"use strict";kr=class extends Tr{static{s(this,"DummyParser")}constructor(t,i={}){super(),this.globalOptions={...i},this.incomingForm=t}_flush(t){this.incomingForm.ended=!0,this.incomingForm._maybeEnd(),t()}},Z=kr});import{Transform as Lr}from"stream";function Ir(e){return e|32}var x,f,mi,R,G,tt,Or,V,Dr,Br,Rr,gi,yi,q,et=b(()=>{"use strict";I();I();x=0,f={PARSER_UNINITIALIZED:x++,START:x++,START_BOUNDARY:x++,HEADER_FIELD_START:x++,HEADER_FIELD:x++,HEADER_VALUE_START:x++,HEADER_VALUE:x++,HEADER_VALUE_ALMOST_DONE:x++,HEADERS_ALMOST_DONE:x++,PART_DATA_START:x++,PART_DATA:x++,PART_END:x++,END:x++},mi=1,R={PART_BOUNDARY:mi,LAST_BOUNDARY:mi*=2},G=10,tt=13,Or=32,V=45,Dr=58,Br=97,Rr=122;s(Ir,"lower");gi={};Object.keys(f).forEach(e=>{gi[e]=f[e]});yi=class _i extends Lr{static{s(this,"MultipartParser")}constructor(t={}){super({readableObjectMode:!0}),this.boundary=null,this.boundaryChars=null,this.lookbehind=null,this.bufferLength=0,this.state=f.PARSER_UNINITIALIZED,this.globalOptions={...t},this.index=null,this.flags=0}_endUnexpected(){return new m(`MultipartParser.end(): stream ended unexpectedly: ${this.explain()}`,1012,400)}_flush(t){this.state===f.HEADER_FIELD_START&&this.index===0||this.state===f.PART_DATA&&this.index===this.boundary.length?(this._handleCallback("partEnd"),this._handleCallback("end"),t()):this.state!==f.END?t(this._endUnexpected()):t()}initWithBoundary(t){this.boundary=Buffer.from(`\r
|
|
2
3
|
--${t}`),this.lookbehind=Buffer.alloc(this.boundary.length+8),this.state=f.START,this.boundaryChars={};for(let i=0;i<this.boundary.length;i++)this.boundaryChars[this.boundary[i]]=!0}_handleCallback(t,i,r,n){r!==void 0&&r===n||this.push({name:t,buffer:i,start:r,end:n})}_transform(t,i,r){let n=0,a=this.index,{index:o,state:l,flags:u}=this,{lookbehind:y,boundary:d,boundaryChars:T}=this,_=d.length,S=_-1;this.bufferLength=t.length;let g=null,at=null,v=s((k,W)=>{this[`${k}Mark`]=typeof W=="number"?W:n},"setMark"),Gt=s(k=>{delete this[`${k}Mark`]},"clearMarkSymbol"),H=s((k,W)=>{let lt=`${k}Mark`;lt in this&&(W?(this._handleCallback(k,t,this[lt],n),Gt(k)):(this._handleCallback(k,t,this[lt],t.length),v(k,0)))},"dataCallback");for(n=0;n<this.bufferLength;n++)switch(g=t[n],l){case f.PARSER_UNINITIALIZED:r(this._endUnexpected());return;case f.START:o=0,l=f.START_BOUNDARY;case f.START_BOUNDARY:if(o===d.length-2){if(g===V)u|=R.LAST_BOUNDARY;else if(g!==tt){r(this._endUnexpected());return}o++;break}else if(o-1===d.length-2){if(u&R.LAST_BOUNDARY&&g===V)this._handleCallback("end"),l=f.END,u=0;else if(!(u&R.LAST_BOUNDARY)&&g===G)o=0,this._handleCallback("partBegin"),l=f.HEADER_FIELD_START;else{r(this._endUnexpected());return}break}g!==d[o+2]&&(o=-2),g===d[o+2]&&o++;break;case f.HEADER_FIELD_START:l=f.HEADER_FIELD,v("headerField"),o=0;case f.HEADER_FIELD:if(g===tt){Gt("headerField"),l=f.HEADERS_ALMOST_DONE;break}if(o++,g===V)break;if(g===Dr){if(o===1){r(this._endUnexpected());return}H("headerField",!0),l=f.HEADER_VALUE_START;break}if(at=Ir(g),at<Br||at>Rr){r(this._endUnexpected());return}break;case f.HEADER_VALUE_START:if(g===Or)break;v("headerValue"),l=f.HEADER_VALUE;case f.HEADER_VALUE:g===tt&&(H("headerValue",!0),this._handleCallback("headerEnd"),l=f.HEADER_VALUE_ALMOST_DONE);break;case f.HEADER_VALUE_ALMOST_DONE:if(g!==G){r(this._endUnexpected());return}l=f.HEADER_FIELD_START;break;case f.HEADERS_ALMOST_DONE:if(g!==G){r(this._endUnexpected());return}this._handleCallback("headersEnd"),l=f.PART_DATA_START;break;case f.PART_DATA_START:l=f.PART_DATA,v("partData");case f.PART_DATA:if(a=o,o===0){for(n+=S;n<this.bufferLength&&!(t[n]in T);)n+=_;n-=S,g=t[n]}if(o<d.length)d[o]===g?(o===0&&H("partData",!0),o++):o=0;else if(o===d.length)o++,g===tt?u|=R.PART_BOUNDARY:g===V?u|=R.LAST_BOUNDARY:o=0;else if(o-1===d.length)if(u&R.PART_BOUNDARY){if(o=0,g===G){u&=~R.PART_BOUNDARY,this._handleCallback("partEnd"),this._handleCallback("partBegin"),l=f.HEADER_FIELD_START;break}}else u&R.LAST_BOUNDARY&&g===V?(this._handleCallback("partEnd"),this._handleCallback("end"),l=f.END,u=0):o=0;o>0?y[o-1]=g:a>0&&(this._handleCallback("partData",y,0,a),a=0,v("partData"),n--);break;case f.END:break;default:r(this._endUnexpected());return}return H("headerField"),H("headerValue"),H("partData"),this.index=o,this.state=l,this.flags=u,r(),this.bufferLength}explain(){return`state = ${_i.stateToString(this.state)}`}};yi.stateToString=e=>{for(let t in f)if(f[t]===e)return t};q=Object.assign(yi,{STATES:gi})});import{PassThrough as Pr}from"stream";var Hr,qt,Wt=b(()=>{"use strict";Hr=class extends Pr{static{s(this,"OctetStreamParser")}constructor(t={}){super(),this.globalOptions={...t}}},qt=Hr});async function it(e,t){let i=this||e;return/octet-stream/i.test(i.headers["content-type"])&&await Nr.call(i,i,t),i}async function Nr(e,t){this.type=Ur;let i=this.headers["x-file-name"],r=this.headers["content-type"],n={originalFilename:i,mimetype:r},a=this._getNewName(n),o=this._joinDirectoryName(a),l=await this._newFile({newFilename:a,filepath:o,originalFilename:i,mimetype:r});this.emit("fileBegin",i,l),l.open(),this.openedFiles.push(l),this._flushing+=1,this._parser=new qt(this.options);let u=0;return this._parser.on("data",y=>{this.pause(),u+=1,l.write(y,()=>{u-=1,this.resume(),this.ended&&this._parser.emit("doneWritingFile")})}),this._parser.on("end",()=>{this._flushing-=1,this.ended=!0;let y=s(()=>{l.end(()=>{this.emit("file","file",l),this._maybeEnd()})},"done");u===0?y():this._parser.once("doneWritingFile",y)}),this}var Ur,bi=b(()=>{"use strict";Wt();Ur="octet-stream";s(it,"plugin");s(Nr,"init")});import{Transform as vr}from"stream";var Cr,Yt,Xt=b(()=>{"use strict";Cr=class extends vr{static{s(this,"QuerystringParser")}constructor(t={}){super({readableObjectMode:!0}),this.globalOptions={...t},this.buffer="",this.bufferLength=0}_transform(t,i,r){this.buffer+=t.toString("ascii"),this.bufferLength=this.buffer.length,r()}_flush(t){let i=new URLSearchParams(this.buffer);for(let[r,n]of i)this.push({key:r,value:n});this.buffer="",t()}},Yt=Cr});function rt(e,t){let i=this||e;return/urlencoded/i.test(i.headers["content-type"])&&zr.call(i,i,t),i}function zr(e,t){this.type=Mr;let i=new Yt(this.options);return i.on("data",({key:r,value:n})=>{this.emit("field",r,n)}),i.once("end",()=>{this.ended=!0,this._maybeEnd()}),this._parser=i,this}var Mr,wi=b(()=>{"use strict";Xt();Mr="urlencoded";s(rt,"plugin");s(zr,"init")});import{Stream as jr}from"stream";function st(e,t){let i=this||e;if(/multipart/i.test(i.headers["content-type"])){let n=i.headers["content-type"].match(/boundary=(?:"([^"]+)"|([^;]+))/i);if(n)Vr(n[1]||n[2]).call(i,i,t);else{let a=new m("bad content-type header, no multipart boundary",1013,400);i._error(a)}}return i}function Vr(e){return s(function(){this.type=$r;let i=new q(this.options),r,n,a;i.initWithBoundary(e),i.on("data",async({name:o,buffer:l,start:u,end:y})=>{if(o==="partBegin")a=new jr,a.readable=!0,a.headers={},a.name=null,a.originalFilename=null,a.mimetype=null,a.transferEncoding=this.options.encoding,a.transferBuffer="",r="",n="";else if(o==="headerField")r+=l.toString(this.options.encoding,u,y);else if(o==="headerValue")n+=l.toString(this.options.encoding,u,y);else if(o==="headerEnd"){r=r.toLowerCase(),a.headers[r]=n;let d=n.match(/\bname=("([^"]*)"|([^\(\)<>@,;:\\"\/\[\]\?=\{\}\s\t/]+))/i);r==="content-disposition"?(d&&(a.name=d[2]||d[3]||""),a.originalFilename=this._getFileName(n)):r==="content-type"?a.mimetype=n:r==="content-transfer-encoding"&&(a.transferEncoding=n.toLowerCase()),r="",n=""}else if(o==="headersEnd"){switch(a.transferEncoding){case"binary":case"7bit":case"8bit":case"utf-8":{let d=s(_=>{_.name==="partData"&&a.emit("data",_.buffer.slice(_.start,_.end))},"dataPropagation"),T=s(_=>{_.name==="partEnd"&&(a.emit("end"),i.off("data",d),i.off("data",T))},"dataStopPropagation");i.on("data",d),i.on("data",T);break}case"base64":{let d=s(_=>{if(_.name==="partData"){a.transferBuffer+=_.buffer.slice(_.start,_.end).toString("ascii");let S=parseInt(a.transferBuffer.length/4,10)*4;a.emit("data",Buffer.from(a.transferBuffer.substring(0,S),"base64")),a.transferBuffer=a.transferBuffer.substring(S)}},"dataPropagation"),T=s(_=>{_.name==="partEnd"&&(a.emit("data",Buffer.from(a.transferBuffer,"base64")),a.emit("end"),i.off("data",d),i.off("data",T))},"dataStopPropagation");i.on("data",d),i.on("data",T);break}default:return this._error(new m("unknown transfer-encoding",1014,501))}this._parser.pause(),await this.onPart(a),this._parser.resume()}else o==="end"&&(this.ended=!0,this._maybeEnd())}),this._parser=i},"initMultipart")}var $r,xi=b(()=>{"use strict";et();I();I();$r="multipart";s(st,"plugin");s(Vr,"createInitMultipart")});import{Transform as qr}from"stream";var Wr,Jt,Kt=b(()=>{"use strict";Wr=class extends qr{static{s(this,"JSONParser")}constructor(t={}){super({readableObjectMode:!0}),this.chunks=[],this.globalOptions={...t}}_transform(t,i,r){this.chunks.push(String(t)),r()}_flush(t){try{let i=JSON.parse(this.chunks.join(""));this.push(i)}catch(i){t(i);return}this.chunks=null,t()}},Jt=Wr});function nt(e,t){let i=this||e;return/json/i.test(i.headers["content-type"])&&Xr.call(i,i,t),i}function Xr(e,t){this.type=Yr;let i=new Jt(this.options);i.on("data",r=>{this.fields=r}),i.once("end",()=>{this.ended=!0,this._maybeEnd()}),this._parser=i}var Yr,Ei=b(()=>{"use strict";Kt();Yr="json";s(nt,"plugin");s(Xr,"init")});var Qt=b(()=>{"use strict";bi();wi();xi();Ei()});import{EventEmitter as Jr}from"events";import Kr from"fs/promises";import ot from"os";import P from"path";import{StringDecoder as Qr}from"string_decoder";function Si(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Ai,Fi,Ti,Zr,Gr,Zt,ts,es,is,rs,ki,Li=b(()=>{"use strict";Ai=ht(Qe(),1),Fi=ht(ui(),1),Ti=ht(pi(),1);I();ut();dt();Vt();et();Qt();Zr=`${process.env.NODE_ENV}-${ot.platform()}-${ot.hostname()}`,Gr=(0,Ai.init)({length:25,fingerprint:Zr.toLowerCase()}),Zt={maxFields:1e3,maxFieldsSize:20*1024*1024,maxFiles:1/0,maxFileSize:200*1024*1024,maxTotalFileSize:void 0,minFileSize:1,allowEmptyFiles:!1,createDirsFromUploads:!1,keepExtensions:!1,encoding:"utf-8",hashAlgorithm:!1,uploadDir:ot.tmpdir(),enabledPlugins:[it,rt,st,nt],fileWriteStreamHandler:null,defaultInvalidName:"invalid-name",filter(e){return!0},filename:void 0};s(Si,"hasOwnProp");ts=s(function(e){let t=Promise.resolve();return async function(...i){let r=t,n,a;return t=new Promise(function(o){a=o}),await r,n=e(...i),n.then(a).catch(a),n}},"decorateForceSequential"),es=ts(function(e){let t=P.dirname(e);return Kr.mkdir(t,{recursive:!0})}),is=s(e=>{let t=e.charCodeAt(0);return!(t===46||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122)},"invalidExtensionChar"),rs=class extends Jr{static{s(this,"IncomingForm")}constructor(t={}){super(),this.options={...Zt,...t},this.options.maxTotalFileSize||(this.options.maxTotalFileSize=this.options.maxFileSize);let i=P.resolve(this.options.uploadDir||this.options.uploaddir||ot.tmpdir());if(this.uploaddir=i,this.uploadDir=i,["error","headers","type","bytesExpected","bytesReceived","_parser","req"].forEach(r=>{this[r]=null}),this._setUpRename(),this._flushing=0,this._fieldsSize=0,this._totalFileSize=0,this._plugins=[],this.openedFiles=[],this.options.enabledPlugins=[].concat(this.options.enabledPlugins).filter(Boolean),this.options.enabledPlugins.length===0)throw new m("expect at least 1 enabled builtin plugin, see options.enabledPlugins",1e3);this.options.enabledPlugins.forEach(r=>{this.use(r)}),this._setUpMaxFields(),this._setUpMaxFiles(),this.ended=void 0,this.type=void 0}use(t){if(typeof t!="function")throw new m(".use: expect `plugin` to be a function",1001);return this._plugins.push(t.bind(this)),this}pause(){try{this.req.pause()}catch(t){return this.ended||this._error(t),!1}return!0}resume(){try{this.req.resume()}catch(t){return this.ended||this._error(t),!1}return!0}async parse(t,i){this.req=t;let r;if(!i){let o,l;r=new Promise((u,y)=>{o=u,l=y}),i=s((u,y,d)=>{u?l(u):o([y,d])},"cb")}let n=(0,Ti.default)((0,Fi.default)(i));this.fields={};let a={};return this.on("field",(o,l)=>{this.type==="multipart"||this.type==="urlencoded"?Si(this.fields,o)?this.fields[o].push(l):this.fields[o]=[l]:this.fields[o]=l}),this.on("file",(o,l)=>{Si(a,o)?a[o].push(l):a[o]=[l]}),this.on("error",o=>{n(o,this.fields,a)}),this.on("end",()=>{n(null,this.fields,a)}),await this.writeHeaders(t.headers),t.on("error",o=>{this._error(o)}).on("aborted",()=>{this.emit("aborted"),this._error(new m("Request aborted",1002))}).on("data",o=>{try{this.write(o)}catch(l){this._error(l)}}).on("end",()=>{this.error||this._parser&&this._parser.end()}),r||this}async writeHeaders(t){if(this.headers=t,this._parseContentLength(),await this._parseContentType(),!this._parser){this._error(new m("no parser found",1003,415));return}this._parser.once("error",i=>{this._error(i)})}write(t){return this.error?null:this._parser?(this.bytesReceived+=t.length,this.emit("progress",this.bytesReceived,this.bytesExpected),this._parser.write(t),this.bytesReceived):(this._error(new m("uninitialized parser",1004)),null)}onPart(t){return this._handlePart(t)}async _handlePart(t){if(t.originalFilename&&typeof t.originalFilename!="string"){this._error(new m("the part.originalFilename should be string when it exists",1005));return}if(!t.mimetype){let o="",l=new Qr(t.transferEncoding||this.options.encoding);t.on("data",u=>{if(this._fieldsSize+=u.length,this._fieldsSize>this.options.maxFieldsSize){this._error(new m(`options.maxFieldsSize (${this.options.maxFieldsSize} bytes) exceeded, received ${this._fieldsSize} bytes of field data`,1006,413));return}o+=l.write(u)}),t.on("end",()=>{this.emit("field",t.name,o)});return}if(!this.options.filter(t))return;this._flushing+=1;let i=0,r=this._getNewName(t),n=this._joinDirectoryName(r),a=await this._newFile({newFilename:r,filepath:n,originalFilename:t.originalFilename,mimetype:t.mimetype});a.on("error",o=>{this._error(o)}),this.emit("fileBegin",t.name,a),a.open(),this.openedFiles.push(a),t.on("data",o=>{if(this._totalFileSize+=o.length,i+=o.length,this._totalFileSize>this.options.maxTotalFileSize){this._error(new m(`options.maxTotalFileSize (${this.options.maxTotalFileSize} bytes) exceeded, received ${this._totalFileSize} bytes of file data`,1009,413));return}o.length!==0&&(this.pause(),a.write(o,()=>{this.resume()}))}),t.on("end",()=>{if(!this.options.allowEmptyFiles&&i===0){this._error(new m("options.allowEmptyFiles is false, file size should be greater than 0",1010,400));return}if(i<this.options.minFileSize){this._error(new m(`options.minFileSize (${this.options.minFileSize} bytes) inferior, received ${i} bytes of file data`,1008,400));return}if(i>this.options.maxFileSize){this._error(new m(`options.maxFileSize (${this.options.maxFileSize} bytes), received ${i} bytes of file data`,1016,413));return}a.end(()=>{this._flushing-=1,this.emit("file",t.name,a),this._maybeEnd()})})}async _parseContentType(){if(this.bytesExpected===0){this._parser=new Z(this,this.options);return}if(!this.headers["content-type"]){this._error(new m("bad content-type header, no content-type",1011,400));return}new Z(this,this.options);let t=[];await Promise.all(this._plugins.map(async(i,r)=>{let n=null;try{n=await i(this,this.options)||this}catch(a){let o=new m(`plugin on index ${r} failed with: ${a.message}`,1017,500);throw o.idx=r,o}Object.assign(this,n),this.emit("plugin",r,n)})),this.emit("pluginsResults",t)}_error(t,i="error"){this.error||this.ended||(this.req=null,this.error=t,this.emit(i,t),this.openedFiles.forEach(r=>{r.destroy()}))}_parseContentLength(){this.bytesReceived=0,this.headers["content-length"]?this.bytesExpected=parseInt(this.headers["content-length"],10):this.headers["transfer-encoding"]===void 0&&(this.bytesExpected=0),this.bytesExpected!==null&&this.emit("progress",this.bytesReceived,this.bytesExpected)}_newParser(){return new q(this.options)}async _newFile({filepath:t,originalFilename:i,mimetype:r,newFilename:n}){if(this.options.fileWriteStreamHandler)return new ft({newFilename:n,filepath:t,originalFilename:i,mimetype:r,createFileWriteStream:this.options.fileWriteStreamHandler,hashAlgorithm:this.options.hashAlgorithm});if(this.options.createDirsFromUploads)try{await es(t)}catch{this._error(new m("cannot create directory",1018,409))}return new ct({newFilename:n,filepath:t,originalFilename:i,mimetype:r,hashAlgorithm:this.options.hashAlgorithm})}_getFileName(t){let i=t.match(/\bfilename=("(.*?)"|([^()<>{}[\]@,;:"?=\s/\t]+))($|;\s)/i);if(!i)return null;let r=i[2]||i[3]||"",n=r.substr(r.lastIndexOf("\\")+1);return n=n.replace(/%22/g,'"'),n=n.replace(/&#([\d]{4});/g,(a,o)=>String.fromCharCode(o)),n}_getExtension(t){if(!t)return"";let i=P.basename(t),r=i.indexOf("."),n=i.lastIndexOf("."),a=P.extname(i);r!==n&&(a=i.slice(r));let o,l=Array.from(a).findIndex(is);return l===-1?o=a:o=a.substring(0,l),o==="."?"":o}_joinDirectoryName(t){let i=P.join(this.uploadDir,t);return i.startsWith(this.uploadDir)?i:P.join(this.uploadDir,this.options.defaultInvalidName)}_setUpRename(){typeof this.options.filename=="function"?this._getNewName=i=>{let r="",n=this.options.defaultInvalidName;return i.originalFilename&&({ext:r,name:n}=P.parse(i.originalFilename),this.options.keepExtensions!==!0&&(r="")),this.options.filename.call(this,n,r,i,this)}:this._getNewName=i=>{let r=Gr();if(i&&this.options.keepExtensions){let n=typeof i=="string"?i:i.originalFilename;return`${r}${this._getExtension(n)}`}return r}}_setUpMaxFields(){if(this.options.maxFields!==1/0){let t=0;this.on("field",()=>{t+=1,t>this.options.maxFields&&this._error(new m(`options.maxFields (${this.options.maxFields}) exceeded`,1007,413))})}}_setUpMaxFiles(){if(this.options.maxFiles!==1/0){let t=0;this.on("fileBegin",()=>{t+=1,t>this.options.maxFiles&&this._error(new m(`options.maxFiles (${this.options.maxFiles}) exceeded`,1015,413))})}}_maybeEnd(){!this.ended||this._flushing||this.error||(this.req=null,this.emit("end"))}},ki=rs});var Oi=b(()=>{"use strict";Kt();Vt();et();Wt();Xt()});var ss,Xn,Jn,ns=b(()=>{ut();dt();Li();Oi();Qt();I();ss=s((...e)=>new ki(...e),"formidable"),{enabledPlugins:Xn}=Zt,Jn=ss});ns();export{Z as DummyParser,ct as File,ki as Formidable,ki as IncomingForm,Jt as JSONParser,q as MultipartParser,qt as OctetStreamParser,qt as OctetstreamParser,ct as PersistentFile,Yt as QueryStringParser,Yt as QuerystringParser,ft as VolatileFile,Jn as default,Zt as defaultOptions,Xn as enabledPlugins,$ as errors,ss as formidable,nt as json,st as multipart,it as octetstream,rt as querystring};
|
|
3
4
|
/*! Bundled license information:
|
|
4
5
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nfets",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.22",
|
|
4
4
|
"description": "typescript libraries for Brazilian's SEFAZ standards",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.mjs",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"files": [
|
|
37
37
|
"dist",
|
|
38
|
-
"build/
|
|
38
|
+
"build/addons",
|
|
39
39
|
"packages/nfe/schemas"
|
|
40
40
|
],
|
|
41
41
|
"publishConfig": {
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"typescript": "^5.0.0"
|
|
87
87
|
},
|
|
88
88
|
"scripts": {
|
|
89
|
-
"build": "
|
|
89
|
+
"build": "pnpm --filter !@nfets/test build && tsup --config tsup.config.ts",
|
|
90
90
|
"test": "pnpm --filter @nfets/* test",
|
|
91
91
|
"typecheck": "pnpm --filter @nfets/* typecheck",
|
|
92
92
|
"test:coverage": "pnpm --filter @nfets/* test:coverage --coverageReporters=\"json-summary\""
|
package/dist/chunk-I4KZJHBR.mjs
DELETED
|
File without changes
|