@accounter/client 0.0.6-alpha-20250714141056-adf384acdbad7fd97cbecd581a698dc01ea5554d → 0.0.6-alpha-20250714141136-0f27f8e8c943ccb2e0d85fe54dd84652fb8f84c2

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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @accounter/client
2
2
 
3
- ## 0.0.6-alpha-20250714141056-adf384acdbad7fd97cbecd581a698dc01ea5554d
3
+ ## 0.0.6-alpha-20250714141136-0f27f8e8c943ccb2e0d85fe54dd84652fb8f84c2
4
4
 
5
5
  ### Patch Changes
6
6
 
@@ -750,10 +750,10 @@ export default theme;`}function l9(e={},...t){const{breakpoints:n,mixins:r={},sp
750
750
  `))):he=ee.stylize("[Circular]","special")),T(de)){if(ue&&ae.match(/^\d+$/))return he;de=JSON.stringify(""+ae),de.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(de=de.slice(1,-1),de=ee.stylize(de,"name")):(de=de.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),de=ee.stylize(de,"string"))}return de+": "+he}function b(ee,Z,se){var re=ee.reduce(function(ae,ue){return ue.indexOf(`
751
751
  `)>=0,ae+ue.replace(/\u001b\[\d\d?m/g,"").length+1},0);return re>60?se[0]+(Z===""?"":Z+`
752
752
  `)+" "+ee.join(`,
753
- `)+" "+se[1]:se[0]+Z+" "+ee.join(", ")+" "+se[1]}e.types=con();function k(ee){return Array.isArray(ee)}e.isArray=k;function w(ee){return typeof ee=="boolean"}e.isBoolean=w;function _(ee){return ee===null}e.isNull=_;function C(ee){return ee==null}e.isNullOrUndefined=C;function N(ee){return typeof ee=="number"}e.isNumber=N;function j(ee){return typeof ee=="string"}e.isString=j;function O(ee){return typeof ee=="symbol"}e.isSymbol=O;function T(ee){return ee===void 0}e.isUndefined=T;function P(ee){return A(ee)&&L(ee)==="[object RegExp]"}e.isRegExp=P,e.types.isRegExp=P;function A(ee){return typeof ee=="object"&&ee!==null}e.isObject=A;function R(ee){return A(ee)&&L(ee)==="[object Date]"}e.isDate=R,e.types.isDate=R;function V(ee){return A(ee)&&(L(ee)==="[object Error]"||ee instanceof Error)}e.isError=V,e.types.isNativeError=V;function $(ee){return typeof ee=="function"}e.isFunction=$;function B(ee){return ee===null||typeof ee=="boolean"||typeof ee=="number"||typeof ee=="string"||typeof ee=="symbol"||typeof ee>"u"}e.isPrimitive=B,e.isBuffer=uon();function L(ee){return Object.prototype.toString.call(ee)}function M(ee){return ee<10?"0"+ee.toString(10):ee.toString(10)}var U=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function G(){var ee=new Date,Z=[M(ee.getHours()),M(ee.getMinutes()),M(ee.getSeconds())].join(":");return[ee.getDate(),U[ee.getMonth()],Z].join(" ")}e.log=function(){console.log("%s - %s",G(),e.format.apply(e,arguments))},e.inherits=bg(),e._extend=function(ee,Z){if(!Z||!A(Z))return ee;for(var se=Object.keys(Z),re=se.length;re--;)ee[se[re]]=Z[se[re]];return ee};function X(ee,Z){return Object.prototype.hasOwnProperty.call(ee,Z)}var Y=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;e.promisify=function(Z){if(typeof Z!="function")throw new TypeError('The "original" argument must be of type Function');if(Y&&Z[Y]){var se=Z[Y];if(typeof se!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(se,Y,{value:se,enumerable:!1,writable:!1,configurable:!0}),se}function se(){for(var re,ae,ue=new Promise(function(Q,q){re=Q,ae=q}),de=[],he=0;he<arguments.length;he++)de.push(arguments[he]);de.push(function(Q,q){Q?ae(Q):re(q)});try{Z.apply(this,de)}catch(Q){ae(Q)}return ue}return Object.setPrototypeOf(se,Object.getPrototypeOf(Z)),Y&&Object.defineProperty(se,Y,{value:se,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(se,n(Z))},e.promisify.custom=Y;function ie(ee,Z){if(!ee){var se=new Error("Promise was rejected with a falsy value");se.reason=ee,ee=se}return Z(ee)}function J(ee){if(typeof ee!="function")throw new TypeError('The "original" argument must be of type Function');function Z(){for(var se=[],re=0;re<arguments.length;re++)se.push(arguments[re]);var ae=se.pop();if(typeof ae!="function")throw new TypeError("The last argument must be of type Function");var ue=this,de=function(){return ae.apply(ue,arguments)};ee.apply(this,se).then(function(he){jn.nextTick(de.bind(null,null,he))},function(he){jn.nextTick(ie.bind(null,he,de))})}return Object.setPrototypeOf(Z,Object.getPrototypeOf(ee)),Object.defineProperties(Z,n(ee)),Z}e.callbackify=J}(s4)),s4}var f4,ige;function don(){if(ige)return f4;ige=1;function e(g,v){var b=Object.keys(g);if(Object.getOwnPropertySymbols){var k=Object.getOwnPropertySymbols(g);v&&(k=k.filter(function(w){return Object.getOwnPropertyDescriptor(g,w).enumerable})),b.push.apply(b,k)}return b}function t(g){for(var v=1;v<arguments.length;v++){var b=arguments[v]!=null?arguments[v]:{};v%2?e(Object(b),!0).forEach(function(k){n(g,k,b[k])}):Object.getOwnPropertyDescriptors?Object.defineProperties(g,Object.getOwnPropertyDescriptors(b)):e(Object(b)).forEach(function(k){Object.defineProperty(g,k,Object.getOwnPropertyDescriptor(b,k))})}return g}function n(g,v,b){return v=o(v),v in g?Object.defineProperty(g,v,{value:b,enumerable:!0,configurable:!0,writable:!0}):g[v]=b,g}function r(g,v){if(!(g instanceof v))throw new TypeError("Cannot call a class as a function")}function i(g,v){for(var b=0;b<v.length;b++){var k=v[b];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(g,o(k.key),k)}}function a(g,v,b){return v&&i(g.prototype,v),Object.defineProperty(g,"prototype",{writable:!1}),g}function o(g){var v=s(g,"string");return typeof v=="symbol"?v:String(v)}function s(g,v){if(typeof g!="object"||g===null)return g;var b=g[Symbol.toPrimitive];if(b!==void 0){var k=b.call(g,v);if(typeof k!="object")return k;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(g)}var l=VR(),u=l.Buffer,d=zBe(),f=d.inspect,m=f&&f.custom||"inspect";function p(g,v,b){u.prototype.copy.call(g,v,b)}return f4=function(){function g(){r(this,g),this.head=null,this.tail=null,this.length=0}return a(g,[{key:"push",value:function(b){var k={data:b,next:null};this.length>0?this.tail.next=k:this.head=k,this.tail=k,++this.length}},{key:"unshift",value:function(b){var k={data:b,next:this.head};this.length===0&&(this.tail=k),this.head=k,++this.length}},{key:"shift",value:function(){if(this.length!==0){var b=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,b}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(b){if(this.length===0)return"";for(var k=this.head,w=""+k.data;k=k.next;)w+=b+k.data;return w}},{key:"concat",value:function(b){if(this.length===0)return u.alloc(0);for(var k=u.allocUnsafe(b>>>0),w=this.head,_=0;w;)p(w.data,k,_),_+=w.data.length,w=w.next;return k}},{key:"consume",value:function(b,k){var w;return b<this.head.data.length?(w=this.head.data.slice(0,b),this.head.data=this.head.data.slice(b)):b===this.head.data.length?w=this.shift():w=k?this._getString(b):this._getBuffer(b),w}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(b){var k=this.head,w=1,_=k.data;for(b-=_.length;k=k.next;){var C=k.data,N=b>C.length?C.length:b;if(N===C.length?_+=C:_+=C.slice(0,b),b-=N,b===0){N===C.length?(++w,k.next?this.head=k.next:this.head=this.tail=null):(this.head=k,k.data=C.slice(N));break}++w}return this.length-=w,_}},{key:"_getBuffer",value:function(b){var k=u.allocUnsafe(b),w=this.head,_=1;for(w.data.copy(k),b-=w.data.length;w=w.next;){var C=w.data,N=b>C.length?C.length:b;if(C.copy(k,k.length-b,0,N),b-=N,b===0){N===C.length?(++_,w.next?this.head=w.next:this.head=this.tail=null):(this.head=w,w.data=C.slice(N));break}++_}return this.length-=_,k}},{key:m,value:function(b,k){return f(this,t(t({},k),{},{depth:0,customInspect:!1}))}}]),g}(),f4}var m4,age;function VBe(){if(age)return m4;age=1;function e(o,s){var l=this,u=this._readableState&&this._readableState.destroyed,d=this._writableState&&this._writableState.destroyed;return u||d?(s?s(o):o&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,jn.nextTick(i,this,o)):jn.nextTick(i,this,o)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(o||null,function(f){!s&&f?l._writableState?l._writableState.errorEmitted?jn.nextTick(n,l):(l._writableState.errorEmitted=!0,jn.nextTick(t,l,f)):jn.nextTick(t,l,f):s?(jn.nextTick(n,l),s(f)):jn.nextTick(n,l)}),this)}function t(o,s){i(o,s),n(o)}function n(o){o._writableState&&!o._writableState.emitClose||o._readableState&&!o._readableState.emitClose||o.emit("close")}function r(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function i(o,s){o.emit("error",s)}function a(o,s){var l=o._readableState,u=o._writableState;l&&l.autoDestroy||u&&u.autoDestroy?o.destroy(s):o.emit("error",s)}return m4={destroy:e,undestroy:r,errorOrDestroy:a},m4}var h4={},oge;function Q0(){if(oge)return h4;oge=1;function e(s,l){s.prototype=Object.create(l.prototype),s.prototype.constructor=s,s.__proto__=l}var t={};function n(s,l,u){u||(u=Error);function d(m,p,g){return typeof l=="string"?l:l(m,p,g)}var f=function(m){e(p,m);function p(g,v,b){return m.call(this,d(g,v,b))||this}return p}(u);f.prototype.name=u.name,f.prototype.code=s,t[s]=f}function r(s,l){if(Array.isArray(s)){var u=s.length;return s=s.map(function(d){return String(d)}),u>2?"one of ".concat(l," ").concat(s.slice(0,u-1).join(", "),", or ")+s[u-1]:u===2?"one of ".concat(l," ").concat(s[0]," or ").concat(s[1]):"of ".concat(l," ").concat(s[0])}else return"of ".concat(l," ").concat(String(s))}function i(s,l,u){return s.substr(0,l.length)===l}function a(s,l,u){return(u===void 0||u>s.length)&&(u=s.length),s.substring(u-l.length,u)===l}function o(s,l,u){return typeof u!="number"&&(u=0),u+l.length>s.length?!1:s.indexOf(l,u)!==-1}return n("ERR_INVALID_OPT_VALUE",function(s,l){return'The value "'+l+'" is invalid for option "'+s+'"'},TypeError),n("ERR_INVALID_ARG_TYPE",function(s,l,u){var d;typeof l=="string"&&i(l,"not ")?(d="must not be",l=l.replace(/^not /,"")):d="must be";var f;if(a(s," argument"))f="The ".concat(s," ").concat(d," ").concat(r(l,"type"));else{var m=o(s,".")?"property":"argument";f='The "'.concat(s,'" ').concat(m," ").concat(d," ").concat(r(l,"type"))}return f+=". Received type ".concat(typeof u),f},TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",function(s){return"The "+s+" method is not implemented"}),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",function(s){return"Cannot call "+s+" after a stream was destroyed"}),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",function(s){return"Unknown encoding: "+s},TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),h4.codes=t,h4}var p4,sge;function UBe(){if(sge)return p4;sge=1;var e=Q0().codes.ERR_INVALID_OPT_VALUE;function t(r,i,a){return r.highWaterMark!=null?r.highWaterMark:i?r[a]:null}function n(r,i,a,o){var s=t(i,o,a);if(s!=null){if(!(isFinite(s)&&Math.floor(s)===s)||s<0){var l=o?a:"highWaterMark";throw new e(l,s)}return Math.floor(s)}return r.objectMode?16:16*1024}return p4={getHighWaterMark:n},p4}var g4,lge;function fon(){if(lge)return g4;lge=1,g4=e;function e(n,r){if(t("noDeprecation"))return n;var i=!1;function a(){if(!i){if(t("throwDeprecation"))throw new Error(r);t("traceDeprecation")?console.trace(r):console.warn(r),i=!0}return n.apply(this,arguments)}return a}function t(n){try{if(!Ho.localStorage)return!1}catch{return!1}var r=Ho.localStorage[n];return r==null?!1:String(r).toLowerCase()==="true"}return g4}var v4,cge;function HBe(){if(cge)return v4;cge=1,v4=T;function e(re){var ae=this;this.next=null,this.entry=null,this.finish=function(){se(ae,re)}}var t;T.WritableState=j;var n={deprecate:fon()},r=BBe(),i=VR().Buffer,a=(typeof Ho<"u"?Ho:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function o(re){return i.from(re)}function s(re){return i.isBuffer(re)||re instanceof a}var l=VBe(),u=UBe(),d=u.getHighWaterMark,f=Q0().codes,m=f.ERR_INVALID_ARG_TYPE,p=f.ERR_METHOD_NOT_IMPLEMENTED,g=f.ERR_MULTIPLE_CALLBACK,v=f.ERR_STREAM_CANNOT_PIPE,b=f.ERR_STREAM_DESTROYED,k=f.ERR_STREAM_NULL_VALUES,w=f.ERR_STREAM_WRITE_AFTER_END,_=f.ERR_UNKNOWN_ENCODING,C=l.errorOrDestroy;bg()(T,r);function N(){}function j(re,ae,ue){t=t||Gy(),re=re||{},typeof ue!="boolean"&&(ue=ae instanceof t),this.objectMode=!!re.objectMode,ue&&(this.objectMode=this.objectMode||!!re.writableObjectMode),this.highWaterMark=d(this,re,"writableHighWaterMark",ue),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var de=re.decodeStrings===!1;this.decodeStrings=!de,this.defaultEncoding=re.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(he){M(ae,he)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=re.emitClose!==!1,this.autoDestroy=!!re.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}j.prototype.getBuffer=function(){for(var ae=this.bufferedRequest,ue=[];ae;)ue.push(ae),ae=ae.next;return ue},function(){try{Object.defineProperty(j.prototype,"buffer",{get:n.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var O;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(O=Function.prototype[Symbol.hasInstance],Object.defineProperty(T,Symbol.hasInstance,{value:function(ae){return O.call(this,ae)?!0:this!==T?!1:ae&&ae._writableState instanceof j}})):O=function(ae){return ae instanceof this};function T(re){t=t||Gy();var ae=this instanceof t;if(!ae&&!O.call(T,this))return new T(re);this._writableState=new j(re,this,ae),this.writable=!0,re&&(typeof re.write=="function"&&(this._write=re.write),typeof re.writev=="function"&&(this._writev=re.writev),typeof re.destroy=="function"&&(this._destroy=re.destroy),typeof re.final=="function"&&(this._final=re.final)),r.call(this)}T.prototype.pipe=function(){C(this,new v)};function P(re,ae){var ue=new w;C(re,ue),jn.nextTick(ae,ue)}function A(re,ae,ue,de){var he;return ue===null?he=new k:typeof ue!="string"&&!ae.objectMode&&(he=new m("chunk",["string","Buffer"],ue)),he?(C(re,he),jn.nextTick(de,he),!1):!0}T.prototype.write=function(re,ae,ue){var de=this._writableState,he=!1,Q=!de.objectMode&&s(re);return Q&&!i.isBuffer(re)&&(re=o(re)),typeof ae=="function"&&(ue=ae,ae=null),Q?ae="buffer":ae||(ae=de.defaultEncoding),typeof ue!="function"&&(ue=N),de.ending?P(this,ue):(Q||A(this,de,re,ue))&&(de.pendingcb++,he=V(this,de,Q,re,ae,ue)),he},T.prototype.cork=function(){this._writableState.corked++},T.prototype.uncork=function(){var re=this._writableState;re.corked&&(re.corked--,!re.writing&&!re.corked&&!re.bufferProcessing&&re.bufferedRequest&&X(this,re))},T.prototype.setDefaultEncoding=function(ae){if(typeof ae=="string"&&(ae=ae.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((ae+"").toLowerCase())>-1))throw new _(ae);return this._writableState.defaultEncoding=ae,this},Object.defineProperty(T.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function R(re,ae,ue){return!re.objectMode&&re.decodeStrings!==!1&&typeof ae=="string"&&(ae=i.from(ae,ue)),ae}Object.defineProperty(T.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function V(re,ae,ue,de,he,Q){if(!ue){var q=R(ae,de,he);de!==q&&(ue=!0,he="buffer",de=q)}var ve=ae.objectMode?1:de.length;ae.length+=ve;var be=ae.length<ae.highWaterMark;if(be||(ae.needDrain=!0),ae.writing||ae.corked){var Be=ae.lastBufferedRequest;ae.lastBufferedRequest={chunk:de,encoding:he,isBuf:ue,callback:Q,next:null},Be?Be.next=ae.lastBufferedRequest:ae.bufferedRequest=ae.lastBufferedRequest,ae.bufferedRequestCount+=1}else $(re,ae,!1,ve,de,he,Q);return be}function $(re,ae,ue,de,he,Q,q){ae.writelen=de,ae.writecb=q,ae.writing=!0,ae.sync=!0,ae.destroyed?ae.onwrite(new b("write")):ue?re._writev(he,ae.onwrite):re._write(he,Q,ae.onwrite),ae.sync=!1}function B(re,ae,ue,de,he){--ae.pendingcb,ue?(jn.nextTick(he,de),jn.nextTick(ee,re,ae),re._writableState.errorEmitted=!0,C(re,de)):(he(de),re._writableState.errorEmitted=!0,C(re,de),ee(re,ae))}function L(re){re.writing=!1,re.writecb=null,re.length-=re.writelen,re.writelen=0}function M(re,ae){var ue=re._writableState,de=ue.sync,he=ue.writecb;if(typeof he!="function")throw new g;if(L(ue),ae)B(re,ue,de,ae,he);else{var Q=Y(ue)||re.destroyed;!Q&&!ue.corked&&!ue.bufferProcessing&&ue.bufferedRequest&&X(re,ue),de?jn.nextTick(U,re,ue,Q,he):U(re,ue,Q,he)}}function U(re,ae,ue,de){ue||G(re,ae),ae.pendingcb--,de(),ee(re,ae)}function G(re,ae){ae.length===0&&ae.needDrain&&(ae.needDrain=!1,re.emit("drain"))}function X(re,ae){ae.bufferProcessing=!0;var ue=ae.bufferedRequest;if(re._writev&&ue&&ue.next){var de=ae.bufferedRequestCount,he=new Array(de),Q=ae.corkedRequestsFree;Q.entry=ue;for(var q=0,ve=!0;ue;)he[q]=ue,ue.isBuf||(ve=!1),ue=ue.next,q+=1;he.allBuffers=ve,$(re,ae,!0,ae.length,he,"",Q.finish),ae.pendingcb++,ae.lastBufferedRequest=null,Q.next?(ae.corkedRequestsFree=Q.next,Q.next=null):ae.corkedRequestsFree=new e(ae),ae.bufferedRequestCount=0}else{for(;ue;){var be=ue.chunk,Be=ue.encoding,le=ue.callback,z=ae.objectMode?1:be.length;if($(re,ae,!1,z,be,Be,le),ue=ue.next,ae.bufferedRequestCount--,ae.writing)break}ue===null&&(ae.lastBufferedRequest=null)}ae.bufferedRequest=ue,ae.bufferProcessing=!1}T.prototype._write=function(re,ae,ue){ue(new p("_write()"))},T.prototype._writev=null,T.prototype.end=function(re,ae,ue){var de=this._writableState;return typeof re=="function"?(ue=re,re=null,ae=null):typeof ae=="function"&&(ue=ae,ae=null),re!=null&&this.write(re,ae),de.corked&&(de.corked=1,this.uncork()),de.ending||Z(this,de,ue),this},Object.defineProperty(T.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function Y(re){return re.ending&&re.length===0&&re.bufferedRequest===null&&!re.finished&&!re.writing}function ie(re,ae){re._final(function(ue){ae.pendingcb--,ue&&C(re,ue),ae.prefinished=!0,re.emit("prefinish"),ee(re,ae)})}function J(re,ae){!ae.prefinished&&!ae.finalCalled&&(typeof re._final=="function"&&!ae.destroyed?(ae.pendingcb++,ae.finalCalled=!0,jn.nextTick(ie,re,ae)):(ae.prefinished=!0,re.emit("prefinish")))}function ee(re,ae){var ue=Y(ae);if(ue&&(J(re,ae),ae.pendingcb===0&&(ae.finished=!0,re.emit("finish"),ae.autoDestroy))){var de=re._readableState;(!de||de.autoDestroy&&de.endEmitted)&&re.destroy()}return ue}function Z(re,ae,ue){ae.ending=!0,ee(re,ae),ue&&(ae.finished?jn.nextTick(ue):re.once("finish",ue)),ae.ended=!0,re.writable=!1}function se(re,ae,ue){var de=re.entry;for(re.entry=null;de;){var he=de.callback;ae.pendingcb--,he(ue),de=de.next}ae.corkedRequestsFree.next=re}return Object.defineProperty(T.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(ae){this._writableState&&(this._writableState.destroyed=ae)}}),T.prototype.destroy=l.destroy,T.prototype._undestroy=l.undestroy,T.prototype._destroy=function(re,ae){ae(re)},v4}var y4,uge;function Gy(){if(uge)return y4;uge=1;var e=Object.keys||function(u){var d=[];for(var f in u)d.push(f);return d};y4=o;var t=qBe(),n=HBe();bg()(o,t);for(var r=e(n.prototype),i=0;i<r.length;i++){var a=r[i];o.prototype[a]||(o.prototype[a]=n.prototype[a])}function o(u){if(!(this instanceof o))return new o(u);t.call(this,u),n.call(this,u),this.allowHalfOpen=!0,u&&(u.readable===!1&&(this.readable=!1),u.writable===!1&&(this.writable=!1),u.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",s)))}Object.defineProperty(o.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(o.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(o.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function s(){this._writableState.ended||jn.nextTick(l,this)}function l(u){u.end()}return Object.defineProperty(o.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(d){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=d,this._writableState.destroyed=d)}}),y4}var b4={},xE={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var dge;function mon(){return dge||(dge=1,function(e,t){var n=VR(),r=n.Buffer;function i(o,s){for(var l in o)s[l]=o[l]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?e.exports=n:(i(n,t),t.Buffer=a);function a(o,s,l){return r(o,s,l)}a.prototype=Object.create(r.prototype),i(r,a),a.from=function(o,s,l){if(typeof o=="number")throw new TypeError("Argument must not be a number");return r(o,s,l)},a.alloc=function(o,s,l){if(typeof o!="number")throw new TypeError("Argument must be a number");var u=r(o);return s!==void 0?typeof l=="string"?u.fill(s,l):u.fill(s):u.fill(0),u},a.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return r(o)},a.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return n.SlowBuffer(o)}}(xE,xE.exports)),xE.exports}var fge;function mge(){if(fge)return b4;fge=1;var e=mon().Buffer,t=e.isEncoding||function(k){switch(k=""+k,k&&k.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function n(k){if(!k)return"utf8";for(var w;;)switch(k){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return k;default:if(w)return;k=(""+k).toLowerCase(),w=!0}}function r(k){var w=n(k);if(typeof w!="string"&&(e.isEncoding===t||!t(k)))throw new Error("Unknown encoding: "+k);return w||k}b4.StringDecoder=i;function i(k){this.encoding=r(k);var w;switch(this.encoding){case"utf16le":this.text=f,this.end=m,w=4;break;case"utf8":this.fillLast=l,w=4;break;case"base64":this.text=p,this.end=g,w=3;break;default:this.write=v,this.end=b;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(w)}i.prototype.write=function(k){if(k.length===0)return"";var w,_;if(this.lastNeed){if(w=this.fillLast(k),w===void 0)return"";_=this.lastNeed,this.lastNeed=0}else _=0;return _<k.length?w?w+this.text(k,_):this.text(k,_):w||""},i.prototype.end=d,i.prototype.text=u,i.prototype.fillLast=function(k){if(this.lastNeed<=k.length)return k.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);k.copy(this.lastChar,this.lastTotal-this.lastNeed,0,k.length),this.lastNeed-=k.length};function a(k){return k<=127?0:k>>5===6?2:k>>4===14?3:k>>3===30?4:k>>6===2?-1:-2}function o(k,w,_){var C=w.length-1;if(C<_)return 0;var N=a(w[C]);return N>=0?(N>0&&(k.lastNeed=N-1),N):--C<_||N===-2?0:(N=a(w[C]),N>=0?(N>0&&(k.lastNeed=N-2),N):--C<_||N===-2?0:(N=a(w[C]),N>=0?(N>0&&(N===2?N=0:k.lastNeed=N-3),N):0))}function s(k,w,_){if((w[0]&192)!==128)return k.lastNeed=0,"�";if(k.lastNeed>1&&w.length>1){if((w[1]&192)!==128)return k.lastNeed=1,"�";if(k.lastNeed>2&&w.length>2&&(w[2]&192)!==128)return k.lastNeed=2,"�"}}function l(k){var w=this.lastTotal-this.lastNeed,_=s(this,k);if(_!==void 0)return _;if(this.lastNeed<=k.length)return k.copy(this.lastChar,w,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);k.copy(this.lastChar,w,0,k.length),this.lastNeed-=k.length}function u(k,w){var _=o(this,k,w);if(!this.lastNeed)return k.toString("utf8",w);this.lastTotal=_;var C=k.length-(_-this.lastNeed);return k.copy(this.lastChar,0,C),k.toString("utf8",w,C)}function d(k){var w=k&&k.length?this.write(k):"";return this.lastNeed?w+"�":w}function f(k,w){if((k.length-w)%2===0){var _=k.toString("utf16le",w);if(_){var C=_.charCodeAt(_.length-1);if(C>=55296&&C<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=k[k.length-2],this.lastChar[1]=k[k.length-1],_.slice(0,-1)}return _}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=k[k.length-1],k.toString("utf16le",w,k.length-1)}function m(k){var w=k&&k.length?this.write(k):"";if(this.lastNeed){var _=this.lastTotal-this.lastNeed;return w+this.lastChar.toString("utf16le",0,_)}return w}function p(k,w){var _=(k.length-w)%3;return _===0?k.toString("base64",w):(this.lastNeed=3-_,this.lastTotal=3,_===1?this.lastChar[0]=k[k.length-1]:(this.lastChar[0]=k[k.length-2],this.lastChar[1]=k[k.length-1]),k.toString("base64",w,k.length-_))}function g(k){var w=k&&k.length?this.write(k):"";return this.lastNeed?w+this.lastChar.toString("base64",0,3-this.lastNeed):w}function v(k){return k.toString(this.encoding)}function b(k){return k&&k.length?this.write(k):""}return b4}var x4,hge;function cK(){if(hge)return x4;hge=1;var e=Q0().codes.ERR_STREAM_PREMATURE_CLOSE;function t(a){var o=!1;return function(){if(!o){o=!0;for(var s=arguments.length,l=new Array(s),u=0;u<s;u++)l[u]=arguments[u];a.apply(this,l)}}}function n(){}function r(a){return a.setHeader&&typeof a.abort=="function"}function i(a,o,s){if(typeof o=="function")return i(a,null,o);o||(o={}),s=t(s||n);var l=o.readable||o.readable!==!1&&a.readable,u=o.writable||o.writable!==!1&&a.writable,d=function(){a.writable||m()},f=a._writableState&&a._writableState.finished,m=function(){u=!1,f=!0,l||s.call(a)},p=a._readableState&&a._readableState.endEmitted,g=function(){l=!1,p=!0,u||s.call(a)},v=function(_){s.call(a,_)},b=function(){var _;if(l&&!p)return(!a._readableState||!a._readableState.ended)&&(_=new e),s.call(a,_);if(u&&!f)return(!a._writableState||!a._writableState.ended)&&(_=new e),s.call(a,_)},k=function(){a.req.on("finish",m)};return r(a)?(a.on("complete",m),a.on("abort",b),a.req?k():a.on("request",k)):u&&!a._writableState&&(a.on("end",d),a.on("close",d)),a.on("end",g),a.on("finish",m),o.error!==!1&&a.on("error",v),a.on("close",b),function(){a.removeListener("complete",m),a.removeListener("abort",b),a.removeListener("request",k),a.req&&a.req.removeListener("finish",m),a.removeListener("end",d),a.removeListener("close",d),a.removeListener("finish",m),a.removeListener("end",g),a.removeListener("error",v),a.removeListener("close",b)}}return x4=i,x4}var k4,pge;function hon(){if(pge)return k4;pge=1;var e;function t(_,C,N){return C=n(C),C in _?Object.defineProperty(_,C,{value:N,enumerable:!0,configurable:!0,writable:!0}):_[C]=N,_}function n(_){var C=r(_,"string");return typeof C=="symbol"?C:String(C)}function r(_,C){if(typeof _!="object"||_===null)return _;var N=_[Symbol.toPrimitive];if(N!==void 0){var j=N.call(_,C);if(typeof j!="object")return j;throw new TypeError("@@toPrimitive must return a primitive value.")}return(C==="string"?String:Number)(_)}var i=cK(),a=Symbol("lastResolve"),o=Symbol("lastReject"),s=Symbol("error"),l=Symbol("ended"),u=Symbol("lastPromise"),d=Symbol("handlePromise"),f=Symbol("stream");function m(_,C){return{value:_,done:C}}function p(_){var C=_[a];if(C!==null){var N=_[f].read();N!==null&&(_[u]=null,_[a]=null,_[o]=null,C(m(N,!1)))}}function g(_){jn.nextTick(p,_)}function v(_,C){return function(N,j){_.then(function(){if(C[l]){N(m(void 0,!0));return}C[d](N,j)},j)}}var b=Object.getPrototypeOf(function(){}),k=Object.setPrototypeOf((e={get stream(){return this[f]},next:function(){var C=this,N=this[s];if(N!==null)return Promise.reject(N);if(this[l])return Promise.resolve(m(void 0,!0));if(this[f].destroyed)return new Promise(function(P,A){jn.nextTick(function(){C[s]?A(C[s]):P(m(void 0,!0))})});var j=this[u],O;if(j)O=new Promise(v(j,this));else{var T=this[f].read();if(T!==null)return Promise.resolve(m(T,!1));O=new Promise(this[d])}return this[u]=O,O}},t(e,Symbol.asyncIterator,function(){return this}),t(e,"return",function(){var C=this;return new Promise(function(N,j){C[f].destroy(null,function(O){if(O){j(O);return}N(m(void 0,!0))})})}),e),b),w=function(C){var N,j=Object.create(k,(N={},t(N,f,{value:C,writable:!0}),t(N,a,{value:null,writable:!0}),t(N,o,{value:null,writable:!0}),t(N,s,{value:null,writable:!0}),t(N,l,{value:C._readableState.endEmitted,writable:!0}),t(N,d,{value:function(T,P){var A=j[f].read();A?(j[u]=null,j[a]=null,j[o]=null,T(m(A,!1))):(j[a]=T,j[o]=P)},writable:!0}),N));return j[u]=null,i(C,function(O){if(O&&O.code!=="ERR_STREAM_PREMATURE_CLOSE"){var T=j[o];T!==null&&(j[u]=null,j[a]=null,j[o]=null,T(O)),j[s]=O;return}var P=j[a];P!==null&&(j[u]=null,j[a]=null,j[o]=null,P(m(void 0,!0))),j[l]=!0}),C.on("readable",g.bind(null,j)),j};return k4=w,k4}var S4,gge;function pon(){return gge||(gge=1,S4=function(){throw new Error("Readable.from is not available in the browser")}),S4}var w4,vge;function qBe(){if(vge)return w4;vge=1,w4=P;var e;P.ReadableState=T,lK().EventEmitter;var t=function(q,ve){return q.listeners(ve).length},n=BBe(),r=VR().Buffer,i=(typeof Ho<"u"?Ho:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function a(Q){return r.from(Q)}function o(Q){return r.isBuffer(Q)||Q instanceof i}var s=zBe(),l;s&&s.debuglog?l=s.debuglog("stream"):l=function(){};var u=don(),d=VBe(),f=UBe(),m=f.getHighWaterMark,p=Q0().codes,g=p.ERR_INVALID_ARG_TYPE,v=p.ERR_STREAM_PUSH_AFTER_EOF,b=p.ERR_METHOD_NOT_IMPLEMENTED,k=p.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,w,_,C;bg()(P,n);var N=d.errorOrDestroy,j=["error","close","destroy","pause","resume"];function O(Q,q,ve){if(typeof Q.prependListener=="function")return Q.prependListener(q,ve);!Q._events||!Q._events[q]?Q.on(q,ve):Array.isArray(Q._events[q])?Q._events[q].unshift(ve):Q._events[q]=[ve,Q._events[q]]}function T(Q,q,ve){e=e||Gy(),Q=Q||{},typeof ve!="boolean"&&(ve=q instanceof e),this.objectMode=!!Q.objectMode,ve&&(this.objectMode=this.objectMode||!!Q.readableObjectMode),this.highWaterMark=m(this,Q,"readableHighWaterMark",ve),this.buffer=new u,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=Q.emitClose!==!1,this.autoDestroy=!!Q.autoDestroy,this.destroyed=!1,this.defaultEncoding=Q.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,Q.encoding&&(w||(w=mge().StringDecoder),this.decoder=new w(Q.encoding),this.encoding=Q.encoding)}function P(Q){if(e=e||Gy(),!(this instanceof P))return new P(Q);var q=this instanceof e;this._readableState=new T(Q,this,q),this.readable=!0,Q&&(typeof Q.read=="function"&&(this._read=Q.read),typeof Q.destroy=="function"&&(this._destroy=Q.destroy)),n.call(this)}Object.defineProperty(P.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(q){this._readableState&&(this._readableState.destroyed=q)}}),P.prototype.destroy=d.destroy,P.prototype._undestroy=d.undestroy,P.prototype._destroy=function(Q,q){q(Q)},P.prototype.push=function(Q,q){var ve=this._readableState,be;return ve.objectMode?be=!0:typeof Q=="string"&&(q=q||ve.defaultEncoding,q!==ve.encoding&&(Q=r.from(Q,q),q=""),be=!0),A(this,Q,q,!1,be)},P.prototype.unshift=function(Q){return A(this,Q,null,!0,!1)};function A(Q,q,ve,be,Be){l("readableAddChunk",q);var le=Q._readableState;if(q===null)le.reading=!1,M(Q,le);else{var z;if(Be||(z=V(le,q)),z)N(Q,z);else if(le.objectMode||q&&q.length>0)if(typeof q!="string"&&!le.objectMode&&Object.getPrototypeOf(q)!==r.prototype&&(q=a(q)),be)le.endEmitted?N(Q,new k):R(Q,le,q,!0);else if(le.ended)N(Q,new v);else{if(le.destroyed)return!1;le.reading=!1,le.decoder&&!ve?(q=le.decoder.write(q),le.objectMode||q.length!==0?R(Q,le,q,!1):X(Q,le)):R(Q,le,q,!1)}else be||(le.reading=!1,X(Q,le))}return!le.ended&&(le.length<le.highWaterMark||le.length===0)}function R(Q,q,ve,be){q.flowing&&q.length===0&&!q.sync?(q.awaitDrain=0,Q.emit("data",ve)):(q.length+=q.objectMode?1:ve.length,be?q.buffer.unshift(ve):q.buffer.push(ve),q.needReadable&&U(Q)),X(Q,q)}function V(Q,q){var ve;return!o(q)&&typeof q!="string"&&q!==void 0&&!Q.objectMode&&(ve=new g("chunk",["string","Buffer","Uint8Array"],q)),ve}P.prototype.isPaused=function(){return this._readableState.flowing===!1},P.prototype.setEncoding=function(Q){w||(w=mge().StringDecoder);var q=new w(Q);this._readableState.decoder=q,this._readableState.encoding=this._readableState.decoder.encoding;for(var ve=this._readableState.buffer.head,be="";ve!==null;)be+=q.write(ve.data),ve=ve.next;return this._readableState.buffer.clear(),be!==""&&this._readableState.buffer.push(be),this._readableState.length=be.length,this};var $=1073741824;function B(Q){return Q>=$?Q=$:(Q--,Q|=Q>>>1,Q|=Q>>>2,Q|=Q>>>4,Q|=Q>>>8,Q|=Q>>>16,Q++),Q}function L(Q,q){return Q<=0||q.length===0&&q.ended?0:q.objectMode?1:Q!==Q?q.flowing&&q.length?q.buffer.head.data.length:q.length:(Q>q.highWaterMark&&(q.highWaterMark=B(Q)),Q<=q.length?Q:q.ended?q.length:(q.needReadable=!0,0))}P.prototype.read=function(Q){l("read",Q),Q=parseInt(Q,10);var q=this._readableState,ve=Q;if(Q!==0&&(q.emittedReadable=!1),Q===0&&q.needReadable&&((q.highWaterMark!==0?q.length>=q.highWaterMark:q.length>0)||q.ended))return l("read: emitReadable",q.length,q.ended),q.length===0&&q.ended?ue(this):U(this),null;if(Q=L(Q,q),Q===0&&q.ended)return q.length===0&&ue(this),null;var be=q.needReadable;l("need readable",be),(q.length===0||q.length-Q<q.highWaterMark)&&(be=!0,l("length less than watermark",be)),q.ended||q.reading?(be=!1,l("reading or ended",be)):be&&(l("do read"),q.reading=!0,q.sync=!0,q.length===0&&(q.needReadable=!0),this._read(q.highWaterMark),q.sync=!1,q.reading||(Q=L(ve,q)));var Be;return Q>0?Be=ae(Q,q):Be=null,Be===null?(q.needReadable=q.length<=q.highWaterMark,Q=0):(q.length-=Q,q.awaitDrain=0),q.length===0&&(q.ended||(q.needReadable=!0),ve!==Q&&q.ended&&ue(this)),Be!==null&&this.emit("data",Be),Be};function M(Q,q){if(l("onEofChunk"),!q.ended){if(q.decoder){var ve=q.decoder.end();ve&&ve.length&&(q.buffer.push(ve),q.length+=q.objectMode?1:ve.length)}q.ended=!0,q.sync?U(Q):(q.needReadable=!1,q.emittedReadable||(q.emittedReadable=!0,G(Q)))}}function U(Q){var q=Q._readableState;l("emitReadable",q.needReadable,q.emittedReadable),q.needReadable=!1,q.emittedReadable||(l("emitReadable",q.flowing),q.emittedReadable=!0,jn.nextTick(G,Q))}function G(Q){var q=Q._readableState;l("emitReadable_",q.destroyed,q.length,q.ended),!q.destroyed&&(q.length||q.ended)&&(Q.emit("readable"),q.emittedReadable=!1),q.needReadable=!q.flowing&&!q.ended&&q.length<=q.highWaterMark,re(Q)}function X(Q,q){q.readingMore||(q.readingMore=!0,jn.nextTick(Y,Q,q))}function Y(Q,q){for(;!q.reading&&!q.ended&&(q.length<q.highWaterMark||q.flowing&&q.length===0);){var ve=q.length;if(l("maybeReadMore read 0"),Q.read(0),ve===q.length)break}q.readingMore=!1}P.prototype._read=function(Q){N(this,new b("_read()"))},P.prototype.pipe=function(Q,q){var ve=this,be=this._readableState;switch(be.pipesCount){case 0:be.pipes=Q;break;case 1:be.pipes=[be.pipes,Q];break;default:be.pipes.push(Q);break}be.pipesCount+=1,l("pipe count=%d opts=%j",be.pipesCount,q);var Be=(!q||q.end!==!1)&&Q!==jn.stdout&&Q!==jn.stderr,le=Be?W:Re;be.endEmitted?jn.nextTick(le):ve.once("end",le),Q.on("unpipe",z);function z(Le,Ke){l("onunpipe"),Le===ve&&Ke&&Ke.hasUnpiped===!1&&(Ke.hasUnpiped=!0,me())}function W(){l("onend"),Q.end()}var ne=ie(ve);Q.on("drain",ne);var te=!1;function me(){l("cleanup"),Q.removeListener("close",we),Q.removeListener("finish",Ne),Q.removeListener("drain",ne),Q.removeListener("error",Oe),Q.removeListener("unpipe",z),ve.removeListener("end",W),ve.removeListener("end",Re),ve.removeListener("data",fe),te=!0,be.awaitDrain&&(!Q._writableState||Q._writableState.needDrain)&&ne()}ve.on("data",fe);function fe(Le){l("ondata");var Ke=Q.write(Le);l("dest.write",Ke),Ke===!1&&((be.pipesCount===1&&be.pipes===Q||be.pipesCount>1&&he(be.pipes,Q)!==-1)&&!te&&(l("false write response, pause",be.awaitDrain),be.awaitDrain++),ve.pause())}function Oe(Le){l("onerror",Le),Re(),Q.removeListener("error",Oe),t(Q,"error")===0&&N(Q,Le)}O(Q,"error",Oe);function we(){Q.removeListener("finish",Ne),Re()}Q.once("close",we);function Ne(){l("onfinish"),Q.removeListener("close",we),Re()}Q.once("finish",Ne);function Re(){l("unpipe"),ve.unpipe(Q)}return Q.emit("pipe",ve),be.flowing||(l("pipe resume"),ve.resume()),Q};function ie(Q){return function(){var ve=Q._readableState;l("pipeOnDrain",ve.awaitDrain),ve.awaitDrain&&ve.awaitDrain--,ve.awaitDrain===0&&t(Q,"data")&&(ve.flowing=!0,re(Q))}}P.prototype.unpipe=function(Q){var q=this._readableState,ve={hasUnpiped:!1};if(q.pipesCount===0)return this;if(q.pipesCount===1)return Q&&Q!==q.pipes?this:(Q||(Q=q.pipes),q.pipes=null,q.pipesCount=0,q.flowing=!1,Q&&Q.emit("unpipe",this,ve),this);if(!Q){var be=q.pipes,Be=q.pipesCount;q.pipes=null,q.pipesCount=0,q.flowing=!1;for(var le=0;le<Be;le++)be[le].emit("unpipe",this,{hasUnpiped:!1});return this}var z=he(q.pipes,Q);return z===-1?this:(q.pipes.splice(z,1),q.pipesCount-=1,q.pipesCount===1&&(q.pipes=q.pipes[0]),Q.emit("unpipe",this,ve),this)},P.prototype.on=function(Q,q){var ve=n.prototype.on.call(this,Q,q),be=this._readableState;return Q==="data"?(be.readableListening=this.listenerCount("readable")>0,be.flowing!==!1&&this.resume()):Q==="readable"&&!be.endEmitted&&!be.readableListening&&(be.readableListening=be.needReadable=!0,be.flowing=!1,be.emittedReadable=!1,l("on readable",be.length,be.reading),be.length?U(this):be.reading||jn.nextTick(ee,this)),ve},P.prototype.addListener=P.prototype.on,P.prototype.removeListener=function(Q,q){var ve=n.prototype.removeListener.call(this,Q,q);return Q==="readable"&&jn.nextTick(J,this),ve},P.prototype.removeAllListeners=function(Q){var q=n.prototype.removeAllListeners.apply(this,arguments);return(Q==="readable"||Q===void 0)&&jn.nextTick(J,this),q};function J(Q){var q=Q._readableState;q.readableListening=Q.listenerCount("readable")>0,q.resumeScheduled&&!q.paused?q.flowing=!0:Q.listenerCount("data")>0&&Q.resume()}function ee(Q){l("readable nexttick read 0"),Q.read(0)}P.prototype.resume=function(){var Q=this._readableState;return Q.flowing||(l("resume"),Q.flowing=!Q.readableListening,Z(this,Q)),Q.paused=!1,this};function Z(Q,q){q.resumeScheduled||(q.resumeScheduled=!0,jn.nextTick(se,Q,q))}function se(Q,q){l("resume",q.reading),q.reading||Q.read(0),q.resumeScheduled=!1,Q.emit("resume"),re(Q),q.flowing&&!q.reading&&Q.read(0)}P.prototype.pause=function(){return l("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(l("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function re(Q){var q=Q._readableState;for(l("flow",q.flowing);q.flowing&&Q.read()!==null;);}P.prototype.wrap=function(Q){var q=this,ve=this._readableState,be=!1;Q.on("end",function(){if(l("wrapped end"),ve.decoder&&!ve.ended){var z=ve.decoder.end();z&&z.length&&q.push(z)}q.push(null)}),Q.on("data",function(z){if(l("wrapped data"),ve.decoder&&(z=ve.decoder.write(z)),!(ve.objectMode&&z==null)&&!(!ve.objectMode&&(!z||!z.length))){var W=q.push(z);W||(be=!0,Q.pause())}});for(var Be in Q)this[Be]===void 0&&typeof Q[Be]=="function"&&(this[Be]=function(W){return function(){return Q[W].apply(Q,arguments)}}(Be));for(var le=0;le<j.length;le++)Q.on(j[le],this.emit.bind(this,j[le]));return this._read=function(z){l("wrapped _read",z),be&&(be=!1,Q.resume())},this},typeof Symbol=="function"&&(P.prototype[Symbol.asyncIterator]=function(){return _===void 0&&(_=hon()),_(this)}),Object.defineProperty(P.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(P.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(P.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(q){this._readableState&&(this._readableState.flowing=q)}}),P._fromList=ae,Object.defineProperty(P.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function ae(Q,q){if(q.length===0)return null;var ve;return q.objectMode?ve=q.buffer.shift():!Q||Q>=q.length?(q.decoder?ve=q.buffer.join(""):q.buffer.length===1?ve=q.buffer.first():ve=q.buffer.concat(q.length),q.buffer.clear()):ve=q.buffer.consume(Q,q.decoder),ve}function ue(Q){var q=Q._readableState;l("endReadable",q.endEmitted),q.endEmitted||(q.ended=!0,jn.nextTick(de,q,Q))}function de(Q,q){if(l("endReadableNT",Q.endEmitted,Q.length),!Q.endEmitted&&Q.length===0&&(Q.endEmitted=!0,q.readable=!1,q.emit("end"),Q.autoDestroy)){var ve=q._writableState;(!ve||ve.autoDestroy&&ve.finished)&&q.destroy()}}typeof Symbol=="function"&&(P.from=function(Q,q){return C===void 0&&(C=pon()),C(P,Q,q)});function he(Q,q){for(var ve=0,be=Q.length;ve<be;ve++)if(Q[ve]===q)return ve;return-1}return w4}var _4,yge;function WBe(){if(yge)return _4;yge=1,_4=s;var e=Q0().codes,t=e.ERR_METHOD_NOT_IMPLEMENTED,n=e.ERR_MULTIPLE_CALLBACK,r=e.ERR_TRANSFORM_ALREADY_TRANSFORMING,i=e.ERR_TRANSFORM_WITH_LENGTH_0,a=Gy();bg()(s,a);function o(d,f){var m=this._transformState;m.transforming=!1;var p=m.writecb;if(p===null)return this.emit("error",new n);m.writechunk=null,m.writecb=null,f!=null&&this.push(f),p(d);var g=this._readableState;g.reading=!1,(g.needReadable||g.length<g.highWaterMark)&&this._read(g.highWaterMark)}function s(d){if(!(this instanceof s))return new s(d);a.call(this,d),this._transformState={afterTransform:o.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,d&&(typeof d.transform=="function"&&(this._transform=d.transform),typeof d.flush=="function"&&(this._flush=d.flush)),this.on("prefinish",l)}function l(){var d=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(f,m){u(d,f,m)}):u(this,null,null)}s.prototype.push=function(d,f){return this._transformState.needTransform=!1,a.prototype.push.call(this,d,f)},s.prototype._transform=function(d,f,m){m(new t("_transform()"))},s.prototype._write=function(d,f,m){var p=this._transformState;if(p.writecb=m,p.writechunk=d,p.writeencoding=f,!p.transforming){var g=this._readableState;(p.needTransform||g.needReadable||g.length<g.highWaterMark)&&this._read(g.highWaterMark)}},s.prototype._read=function(d){var f=this._transformState;f.writechunk!==null&&!f.transforming?(f.transforming=!0,this._transform(f.writechunk,f.writeencoding,f.afterTransform)):f.needTransform=!0},s.prototype._destroy=function(d,f){a.prototype._destroy.call(this,d,function(m){f(m)})};function u(d,f,m){if(f)return d.emit("error",f);if(m!=null&&d.push(m),d._writableState.length)throw new i;if(d._transformState.transforming)throw new r;return d.push(null)}return _4}var N4,bge;function gon(){if(bge)return N4;bge=1,N4=t;var e=WBe();bg()(t,e);function t(n){if(!(this instanceof t))return new t(n);e.call(this,n)}return t.prototype._transform=function(n,r,i){i(null,n)},N4}var C4,xge;function von(){if(xge)return C4;xge=1;var e;function t(m){var p=!1;return function(){p||(p=!0,m.apply(void 0,arguments))}}var n=Q0().codes,r=n.ERR_MISSING_ARGS,i=n.ERR_STREAM_DESTROYED;function a(m){if(m)throw m}function o(m){return m.setHeader&&typeof m.abort=="function"}function s(m,p,g,v){v=t(v);var b=!1;m.on("close",function(){b=!0}),e===void 0&&(e=cK()),e(m,{readable:p,writable:g},function(w){if(w)return v(w);b=!0,v()});var k=!1;return function(w){if(!b&&!k){if(k=!0,o(m))return m.abort();if(typeof m.destroy=="function")return m.destroy();v(w||new i("pipe"))}}}function l(m){m()}function u(m,p){return m.pipe(p)}function d(m){return!m.length||typeof m[m.length-1]!="function"?a:m.pop()}function f(){for(var m=arguments.length,p=new Array(m),g=0;g<m;g++)p[g]=arguments[g];var v=d(p);if(Array.isArray(p[0])&&(p=p[0]),p.length<2)throw new r("streams");var b,k=p.map(function(w,_){var C=_<p.length-1,N=_>0;return s(w,C,N,function(j){b||(b=j),j&&k.forEach(l),!C&&(k.forEach(l),v(b))})});return p.reduce(u)}return C4=f,C4}var E4,kge;function yon(){if(kge)return E4;kge=1,E4=n;var e=lK().EventEmitter,t=bg();t(n,e),n.Readable=qBe(),n.Writable=HBe(),n.Duplex=Gy(),n.Transform=WBe(),n.PassThrough=gon(),n.finished=cK(),n.pipeline=von(),n.Stream=n;function n(){e.call(this)}return n.prototype.pipe=function(r,i){var a=this;function o(p){r.writable&&r.write(p)===!1&&a.pause&&a.pause()}a.on("data",o);function s(){a.readable&&a.resume&&a.resume()}r.on("drain",s),!r._isStdio&&(!i||i.end!==!1)&&(a.on("end",u),a.on("close",d));var l=!1;function u(){l||(l=!0,r.end())}function d(){l||(l=!0,typeof r.destroy=="function"&&r.destroy())}function f(p){if(m(),e.listenerCount(this,"error")===0)throw p}a.on("error",f),r.on("error",f);function m(){a.removeListener("data",o),r.removeListener("drain",s),a.removeListener("end",u),a.removeListener("close",d),a.removeListener("error",f),r.removeListener("error",f),a.removeListener("end",m),a.removeListener("close",m),r.removeListener("close",m)}return a.on("end",m),a.on("close",m),r.on("close",m),r.emit("pipe",a),r},E4}var bon=yon();const GBe=function(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)};class kr extends Error{constructor(t,n,r,...i){Array.isArray(n)&&(n=n.join(" ").trim()),super(n),Error.captureStackTrace!==void 0&&Error.captureStackTrace(this,kr),this.code=t;for(const a of i)for(const o in a){const s=a[o];this[o]=On.isBuffer(s)?s.toString(r.encoding):s==null?s:JSON.parse(JSON.stringify(s))}}}const YBe=function(e){const t=[];for(let n=0,r=e.length;n<r;n++){const i=e[n];if(i==null||i===!1)t[n]={disabled:!0};else if(typeof i=="string")t[n]={name:i};else if(GBe(i)){if(typeof i.name!="string")throw new kr("CSV_OPTION_COLUMNS_MISSING_NAME",["Option columns missing name:",`property "name" is required at position ${n}`,"when column is an object literal"]);t[n]=i}else throw new kr("CSV_INVALID_COLUMN_DEFINITION",["Invalid column definition:","expect a string or a literal object,",`got ${JSON.stringify(i)} at position ${n}`])}return t};class Sge{constructor(t=100){this.size=t,this.length=0,this.buf=On.allocUnsafe(t)}prepend(t){if(On.isBuffer(t)){const n=this.length+t.length;if(n>=this.size&&(this.resize(),n>=this.size))throw Error("INVALID_BUFFER_STATE");const r=this.buf;this.buf=On.allocUnsafe(this.size),t.copy(this.buf,0),r.copy(this.buf,t.length),this.length+=t.length}else{const n=this.length++;n===this.size&&this.resize();const r=this.clone();this.buf[0]=t,r.copy(this.buf,1,0,n)}}append(t){const n=this.length++;n===this.size&&this.resize(),this.buf[n]=t}clone(){return On.from(this.buf.slice(0,this.length))}resize(){const t=this.length;this.size=this.size*2;const n=On.allocUnsafe(this.size);this.buf.copy(n,0,0,t),this.buf=n}toString(t){return t?this.buf.slice(0,this.length).toString(t):Uint8Array.prototype.slice.call(this.buf.slice(0,this.length))}toJSON(){return this.toString("utf8")}reset(){this.length=0}}const xon=12,kon=13,Son=10,won=32,_on=9,Non=function(e){return{bomSkipped:!1,bufBytesStart:0,castField:e.cast_function,commenting:!1,error:void 0,enabled:e.from_line===1,escaping:!1,escapeIsQuote:On.isBuffer(e.escape)&&On.isBuffer(e.quote)&&On.compare(e.escape,e.quote)===0,expectedRecordLength:Array.isArray(e.columns)?e.columns.length:void 0,field:new Sge(20),firstLineToHeaders:e.cast_first_line_to_header,needMoreDataSize:Math.max(e.comment!==null?e.comment.length:0,...e.delimiter.map(t=>t.length),e.quote!==null?e.quote.length:0),previousBuf:void 0,quoting:!1,stop:!1,rawBuffer:new Sge(100),record:[],recordHasError:!1,record_length:0,recordDelimiterMaxLength:e.record_delimiter.length===0?0:Math.max(...e.record_delimiter.map(t=>t.length)),trimChars:[On.from(" ",e.encoding)[0],On.from(" ",e.encoding)[0]],wasQuoting:!1,wasRowDelimiter:!1,timchars:[On.from(On.from([kon],"utf8").toString(),e.encoding),On.from(On.from([Son],"utf8").toString(),e.encoding),On.from(On.from([xon],"utf8").toString(),e.encoding),On.from(On.from([won],"utf8").toString(),e.encoding),On.from(On.from([_on],"utf8").toString(),e.encoding)]}},Con=function(e){return e.replace(/([A-Z])/g,function(t,n){return"_"+n.toLowerCase()})},wge=function(e){const t={};for(const r in e)t[Con(r)]=e[r];if(t.encoding===void 0||t.encoding===!0)t.encoding="utf8";else if(t.encoding===null||t.encoding===!1)t.encoding=null;else if(typeof t.encoding!="string"&&t.encoding!==null)throw new kr("CSV_INVALID_OPTION_ENCODING",["Invalid option encoding:","encoding must be a string or null to return a buffer,",`got ${JSON.stringify(t.encoding)}`],t);if(t.bom===void 0||t.bom===null||t.bom===!1)t.bom=!1;else if(t.bom!==!0)throw new kr("CSV_INVALID_OPTION_BOM",["Invalid option bom:","bom must be true,",`got ${JSON.stringify(t.bom)}`],t);if(t.cast_function=null,t.cast===void 0||t.cast===null||t.cast===!1||t.cast==="")t.cast=void 0;else if(typeof t.cast=="function")t.cast_function=t.cast,t.cast=!0;else if(t.cast!==!0)throw new kr("CSV_INVALID_OPTION_CAST",["Invalid option cast:","cast must be true or a function,",`got ${JSON.stringify(t.cast)}`],t);if(t.cast_date===void 0||t.cast_date===null||t.cast_date===!1||t.cast_date==="")t.cast_date=!1;else if(t.cast_date===!0)t.cast_date=function(r){const i=Date.parse(r);return isNaN(i)?r:new Date(i)};else if(typeof t.cast_date!="function")throw new kr("CSV_INVALID_OPTION_CAST_DATE",["Invalid option cast_date:","cast_date must be true or a function,",`got ${JSON.stringify(t.cast_date)}`],t);if(t.cast_first_line_to_header=null,t.columns===!0)t.cast_first_line_to_header=void 0;else if(typeof t.columns=="function")t.cast_first_line_to_header=t.columns,t.columns=!0;else if(Array.isArray(t.columns))t.columns=YBe(t.columns);else if(t.columns===void 0||t.columns===null||t.columns===!1)t.columns=!1;else throw new kr("CSV_INVALID_OPTION_COLUMNS",["Invalid option columns:","expect an array, a function or true,",`got ${JSON.stringify(t.columns)}`],t);if(t.group_columns_by_name===void 0||t.group_columns_by_name===null||t.group_columns_by_name===!1)t.group_columns_by_name=!1;else{if(t.group_columns_by_name!==!0)throw new kr("CSV_INVALID_OPTION_GROUP_COLUMNS_BY_NAME",["Invalid option group_columns_by_name:","expect an boolean,",`got ${JSON.stringify(t.group_columns_by_name)}`],t);if(t.columns===!1)throw new kr("CSV_INVALID_OPTION_GROUP_COLUMNS_BY_NAME",["Invalid option group_columns_by_name:","the `columns` mode must be activated."],t)}if(t.comment===void 0||t.comment===null||t.comment===!1||t.comment==="")t.comment=null;else if(typeof t.comment=="string"&&(t.comment=On.from(t.comment,t.encoding)),!On.isBuffer(t.comment))throw new kr("CSV_INVALID_OPTION_COMMENT",["Invalid option comment:","comment must be a buffer or a string,",`got ${JSON.stringify(t.comment)}`],t);if(t.comment_no_infix===void 0||t.comment_no_infix===null||t.comment_no_infix===!1)t.comment_no_infix=!1;else if(t.comment_no_infix!==!0)throw new kr("CSV_INVALID_OPTION_COMMENT",["Invalid option comment_no_infix:","value must be a boolean,",`got ${JSON.stringify(t.comment_no_infix)}`],t);const n=JSON.stringify(t.delimiter);if(Array.isArray(t.delimiter)||(t.delimiter=[t.delimiter]),t.delimiter.length===0)throw new kr("CSV_INVALID_OPTION_DELIMITER",["Invalid option delimiter:","delimiter must be a non empty string or buffer or array of string|buffer,",`got ${n}`],t);if(t.delimiter=t.delimiter.map(function(r){if(r==null||r===!1)return On.from(",",t.encoding);if(typeof r=="string"&&(r=On.from(r,t.encoding)),!On.isBuffer(r)||r.length===0)throw new kr("CSV_INVALID_OPTION_DELIMITER",["Invalid option delimiter:","delimiter must be a non empty string or buffer or array of string|buffer,",`got ${n}`],t);return r}),t.escape===void 0||t.escape===!0?t.escape=On.from('"',t.encoding):typeof t.escape=="string"?t.escape=On.from(t.escape,t.encoding):(t.escape===null||t.escape===!1)&&(t.escape=null),t.escape!==null&&!On.isBuffer(t.escape))throw new Error(`Invalid Option: escape must be a buffer, a string or a boolean, got ${JSON.stringify(t.escape)}`);if(t.from===void 0||t.from===null)t.from=1;else if(typeof t.from=="string"&&/\d+/.test(t.from)&&(t.from=parseInt(t.from)),Number.isInteger(t.from)){if(t.from<0)throw new Error(`Invalid Option: from must be a positive integer, got ${JSON.stringify(e.from)}`)}else throw new Error(`Invalid Option: from must be an integer, got ${JSON.stringify(t.from)}`);if(t.from_line===void 0||t.from_line===null)t.from_line=1;else if(typeof t.from_line=="string"&&/\d+/.test(t.from_line)&&(t.from_line=parseInt(t.from_line)),Number.isInteger(t.from_line)){if(t.from_line<=0)throw new Error(`Invalid Option: from_line must be a positive integer greater than 0, got ${JSON.stringify(e.from_line)}`)}else throw new Error(`Invalid Option: from_line must be an integer, got ${JSON.stringify(e.from_line)}`);if(t.ignore_last_delimiters===void 0||t.ignore_last_delimiters===null)t.ignore_last_delimiters=!1;else if(typeof t.ignore_last_delimiters=="number")t.ignore_last_delimiters=Math.floor(t.ignore_last_delimiters),t.ignore_last_delimiters===0&&(t.ignore_last_delimiters=!1);else if(typeof t.ignore_last_delimiters!="boolean")throw new kr("CSV_INVALID_OPTION_IGNORE_LAST_DELIMITERS",["Invalid option `ignore_last_delimiters`:","the value must be a boolean value or an integer,",`got ${JSON.stringify(t.ignore_last_delimiters)}`],t);if(t.ignore_last_delimiters===!0&&t.columns===!1)throw new kr("CSV_IGNORE_LAST_DELIMITERS_REQUIRES_COLUMNS",["The option `ignore_last_delimiters`","requires the activation of the `columns` option"],t);if(t.info===void 0||t.info===null||t.info===!1)t.info=!1;else if(t.info!==!0)throw new Error(`Invalid Option: info must be true, got ${JSON.stringify(t.info)}`);if(t.max_record_size===void 0||t.max_record_size===null||t.max_record_size===!1)t.max_record_size=0;else if(!(Number.isInteger(t.max_record_size)&&t.max_record_size>=0))if(typeof t.max_record_size=="string"&&/\d+/.test(t.max_record_size))t.max_record_size=parseInt(t.max_record_size);else throw new Error(`Invalid Option: max_record_size must be a positive integer, got ${JSON.stringify(t.max_record_size)}`);if(t.objname===void 0||t.objname===null||t.objname===!1)t.objname=void 0;else if(On.isBuffer(t.objname)){if(t.objname.length===0)throw new Error("Invalid Option: objname must be a non empty buffer");t.encoding===null||(t.objname=t.objname.toString(t.encoding))}else if(typeof t.objname=="string"){if(t.objname.length===0)throw new Error("Invalid Option: objname must be a non empty string")}else if(typeof t.objname!="number")throw new Error(`Invalid Option: objname must be a string or a buffer, got ${t.objname}`);if(t.objname!==void 0){if(typeof t.objname=="number"){if(t.columns!==!1)throw Error("Invalid Option: objname index cannot be combined with columns or be defined as a field")}else if(t.columns===!1)throw Error("Invalid Option: objname field must be combined with columns or be defined as an index")}if(t.on_record===void 0||t.on_record===null)t.on_record=void 0;else if(typeof t.on_record!="function")throw new kr("CSV_INVALID_OPTION_ON_RECORD",["Invalid option `on_record`:","expect a function,",`got ${JSON.stringify(t.on_record)}`],t);if(t.on_skip!==void 0&&t.on_skip!==null&&typeof t.on_skip!="function")throw new Error(`Invalid Option: on_skip must be a function, got ${JSON.stringify(t.on_skip)}`);if(t.quote===null||t.quote===!1||t.quote==="")t.quote=null;else if(t.quote===void 0||t.quote===!0?t.quote=On.from('"',t.encoding):typeof t.quote=="string"&&(t.quote=On.from(t.quote,t.encoding)),!On.isBuffer(t.quote))throw new Error(`Invalid Option: quote must be a buffer or a string, got ${JSON.stringify(t.quote)}`);if(t.raw===void 0||t.raw===null||t.raw===!1)t.raw=!1;else if(t.raw!==!0)throw new Error(`Invalid Option: raw must be true, got ${JSON.stringify(t.raw)}`);if(t.record_delimiter===void 0)t.record_delimiter=[];else if(typeof t.record_delimiter=="string"||On.isBuffer(t.record_delimiter)){if(t.record_delimiter.length===0)throw new kr("CSV_INVALID_OPTION_RECORD_DELIMITER",["Invalid option `record_delimiter`:","value must be a non empty string or buffer,",`got ${JSON.stringify(t.record_delimiter)}`],t);t.record_delimiter=[t.record_delimiter]}else if(!Array.isArray(t.record_delimiter))throw new kr("CSV_INVALID_OPTION_RECORD_DELIMITER",["Invalid option `record_delimiter`:","value must be a string, a buffer or array of string|buffer,",`got ${JSON.stringify(t.record_delimiter)}`],t);if(t.record_delimiter=t.record_delimiter.map(function(r,i){if(typeof r!="string"&&!On.isBuffer(r))throw new kr("CSV_INVALID_OPTION_RECORD_DELIMITER",["Invalid option `record_delimiter`:","value must be a string, a buffer or array of string|buffer",`at index ${i},`,`got ${JSON.stringify(r)}`],t);if(r.length===0)throw new kr("CSV_INVALID_OPTION_RECORD_DELIMITER",["Invalid option `record_delimiter`:","value must be a non empty string or buffer",`at index ${i},`,`got ${JSON.stringify(r)}`],t);return typeof r=="string"&&(r=On.from(r,t.encoding)),r}),typeof t.relax_column_count!="boolean")if(t.relax_column_count===void 0||t.relax_column_count===null)t.relax_column_count=!1;else throw new Error(`Invalid Option: relax_column_count must be a boolean, got ${JSON.stringify(t.relax_column_count)}`);if(typeof t.relax_column_count_less!="boolean")if(t.relax_column_count_less===void 0||t.relax_column_count_less===null)t.relax_column_count_less=!1;else throw new Error(`Invalid Option: relax_column_count_less must be a boolean, got ${JSON.stringify(t.relax_column_count_less)}`);if(typeof t.relax_column_count_more!="boolean")if(t.relax_column_count_more===void 0||t.relax_column_count_more===null)t.relax_column_count_more=!1;else throw new Error(`Invalid Option: relax_column_count_more must be a boolean, got ${JSON.stringify(t.relax_column_count_more)}`);if(typeof t.relax_quotes!="boolean")if(t.relax_quotes===void 0||t.relax_quotes===null)t.relax_quotes=!1;else throw new Error(`Invalid Option: relax_quotes must be a boolean, got ${JSON.stringify(t.relax_quotes)}`);if(typeof t.skip_empty_lines!="boolean")if(t.skip_empty_lines===void 0||t.skip_empty_lines===null)t.skip_empty_lines=!1;else throw new Error(`Invalid Option: skip_empty_lines must be a boolean, got ${JSON.stringify(t.skip_empty_lines)}`);if(typeof t.skip_records_with_empty_values!="boolean")if(t.skip_records_with_empty_values===void 0||t.skip_records_with_empty_values===null)t.skip_records_with_empty_values=!1;else throw new Error(`Invalid Option: skip_records_with_empty_values must be a boolean, got ${JSON.stringify(t.skip_records_with_empty_values)}`);if(typeof t.skip_records_with_error!="boolean")if(t.skip_records_with_error===void 0||t.skip_records_with_error===null)t.skip_records_with_error=!1;else throw new Error(`Invalid Option: skip_records_with_error must be a boolean, got ${JSON.stringify(t.skip_records_with_error)}`);if(t.rtrim===void 0||t.rtrim===null||t.rtrim===!1)t.rtrim=!1;else if(t.rtrim!==!0)throw new Error(`Invalid Option: rtrim must be a boolean, got ${JSON.stringify(t.rtrim)}`);if(t.ltrim===void 0||t.ltrim===null||t.ltrim===!1)t.ltrim=!1;else if(t.ltrim!==!0)throw new Error(`Invalid Option: ltrim must be a boolean, got ${JSON.stringify(t.ltrim)}`);if(t.trim===void 0||t.trim===null||t.trim===!1)t.trim=!1;else if(t.trim!==!0)throw new Error(`Invalid Option: trim must be a boolean, got ${JSON.stringify(t.trim)}`);if(t.trim===!0&&e.ltrim!==!1?t.ltrim=!0:t.ltrim!==!0&&(t.ltrim=!1),t.trim===!0&&e.rtrim!==!1?t.rtrim=!0:t.rtrim!==!0&&(t.rtrim=!1),t.to===void 0||t.to===null)t.to=-1;else if(typeof t.to=="string"&&/\d+/.test(t.to)&&(t.to=parseInt(t.to)),Number.isInteger(t.to)){if(t.to<=0)throw new Error(`Invalid Option: to must be a positive integer greater than 0, got ${JSON.stringify(e.to)}`)}else throw new Error(`Invalid Option: to must be an integer, got ${JSON.stringify(e.to)}`);if(t.to_line===void 0||t.to_line===null)t.to_line=-1;else if(typeof t.to_line=="string"&&/\d+/.test(t.to_line)&&(t.to_line=parseInt(t.to_line)),Number.isInteger(t.to_line)){if(t.to_line<=0)throw new Error(`Invalid Option: to_line must be a positive integer greater than 0, got ${JSON.stringify(e.to_line)}`)}else throw new Error(`Invalid Option: to_line must be an integer, got ${JSON.stringify(e.to_line)}`);return t},_ge=function(e){return e.every(t=>t==null||t.toString&&t.toString().trim()==="")},Eon=13,jon=10,wv={utf8:On.from([239,187,191]),utf16le:On.from([255,254])},Oon=function(e={}){const t={bytes:0,comment_lines:0,empty_lines:0,invalid_field_length:0,lines:1,records:0},n=wge(e);return{info:t,original_options:e,options:n,state:Non(n),__needMoreData:function(r,i,a){if(a)return!1;const{encoding:o,escape:s,quote:l}=this.options,{quoting:u,needMoreDataSize:d,recordDelimiterMaxLength:f}=this.state,m=i-r-1,p=Math.max(d,f===0?On.from(`\r
753
+ `)+" "+se[1]:se[0]+Z+" "+ee.join(", ")+" "+se[1]}e.types=con();function k(ee){return Array.isArray(ee)}e.isArray=k;function w(ee){return typeof ee=="boolean"}e.isBoolean=w;function _(ee){return ee===null}e.isNull=_;function C(ee){return ee==null}e.isNullOrUndefined=C;function N(ee){return typeof ee=="number"}e.isNumber=N;function j(ee){return typeof ee=="string"}e.isString=j;function O(ee){return typeof ee=="symbol"}e.isSymbol=O;function T(ee){return ee===void 0}e.isUndefined=T;function P(ee){return A(ee)&&L(ee)==="[object RegExp]"}e.isRegExp=P,e.types.isRegExp=P;function A(ee){return typeof ee=="object"&&ee!==null}e.isObject=A;function R(ee){return A(ee)&&L(ee)==="[object Date]"}e.isDate=R,e.types.isDate=R;function V(ee){return A(ee)&&(L(ee)==="[object Error]"||ee instanceof Error)}e.isError=V,e.types.isNativeError=V;function $(ee){return typeof ee=="function"}e.isFunction=$;function B(ee){return ee===null||typeof ee=="boolean"||typeof ee=="number"||typeof ee=="string"||typeof ee=="symbol"||typeof ee>"u"}e.isPrimitive=B,e.isBuffer=uon();function L(ee){return Object.prototype.toString.call(ee)}function M(ee){return ee<10?"0"+ee.toString(10):ee.toString(10)}var U=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function G(){var ee=new Date,Z=[M(ee.getHours()),M(ee.getMinutes()),M(ee.getSeconds())].join(":");return[ee.getDate(),U[ee.getMonth()],Z].join(" ")}e.log=function(){console.log("%s - %s",G(),e.format.apply(e,arguments))},e.inherits=bg(),e._extend=function(ee,Z){if(!Z||!A(Z))return ee;for(var se=Object.keys(Z),re=se.length;re--;)ee[se[re]]=Z[se[re]];return ee};function X(ee,Z){return Object.prototype.hasOwnProperty.call(ee,Z)}var Y=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;e.promisify=function(Z){if(typeof Z!="function")throw new TypeError('The "original" argument must be of type Function');if(Y&&Z[Y]){var se=Z[Y];if(typeof se!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(se,Y,{value:se,enumerable:!1,writable:!1,configurable:!0}),se}function se(){for(var re,ae,ue=new Promise(function(Q,q){re=Q,ae=q}),de=[],he=0;he<arguments.length;he++)de.push(arguments[he]);de.push(function(Q,q){Q?ae(Q):re(q)});try{Z.apply(this,de)}catch(Q){ae(Q)}return ue}return Object.setPrototypeOf(se,Object.getPrototypeOf(Z)),Y&&Object.defineProperty(se,Y,{value:se,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(se,n(Z))},e.promisify.custom=Y;function ie(ee,Z){if(!ee){var se=new Error("Promise was rejected with a falsy value");se.reason=ee,ee=se}return Z(ee)}function J(ee){if(typeof ee!="function")throw new TypeError('The "original" argument must be of type Function');function Z(){for(var se=[],re=0;re<arguments.length;re++)se.push(arguments[re]);var ae=se.pop();if(typeof ae!="function")throw new TypeError("The last argument must be of type Function");var ue=this,de=function(){return ae.apply(ue,arguments)};ee.apply(this,se).then(function(he){jn.nextTick(de.bind(null,null,he))},function(he){jn.nextTick(ie.bind(null,he,de))})}return Object.setPrototypeOf(Z,Object.getPrototypeOf(ee)),Object.defineProperties(Z,n(ee)),Z}e.callbackify=J}(s4)),s4}var f4,ige;function don(){if(ige)return f4;ige=1;function e(g,v){var b=Object.keys(g);if(Object.getOwnPropertySymbols){var k=Object.getOwnPropertySymbols(g);v&&(k=k.filter(function(w){return Object.getOwnPropertyDescriptor(g,w).enumerable})),b.push.apply(b,k)}return b}function t(g){for(var v=1;v<arguments.length;v++){var b=arguments[v]!=null?arguments[v]:{};v%2?e(Object(b),!0).forEach(function(k){n(g,k,b[k])}):Object.getOwnPropertyDescriptors?Object.defineProperties(g,Object.getOwnPropertyDescriptors(b)):e(Object(b)).forEach(function(k){Object.defineProperty(g,k,Object.getOwnPropertyDescriptor(b,k))})}return g}function n(g,v,b){return v=o(v),v in g?Object.defineProperty(g,v,{value:b,enumerable:!0,configurable:!0,writable:!0}):g[v]=b,g}function r(g,v){if(!(g instanceof v))throw new TypeError("Cannot call a class as a function")}function i(g,v){for(var b=0;b<v.length;b++){var k=v[b];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(g,o(k.key),k)}}function a(g,v,b){return v&&i(g.prototype,v),Object.defineProperty(g,"prototype",{writable:!1}),g}function o(g){var v=s(g,"string");return typeof v=="symbol"?v:String(v)}function s(g,v){if(typeof g!="object"||g===null)return g;var b=g[Symbol.toPrimitive];if(b!==void 0){var k=b.call(g,v);if(typeof k!="object")return k;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(g)}var l=VR(),u=l.Buffer,d=zBe(),f=d.inspect,m=f&&f.custom||"inspect";function p(g,v,b){u.prototype.copy.call(g,v,b)}return f4=function(){function g(){r(this,g),this.head=null,this.tail=null,this.length=0}return a(g,[{key:"push",value:function(b){var k={data:b,next:null};this.length>0?this.tail.next=k:this.head=k,this.tail=k,++this.length}},{key:"unshift",value:function(b){var k={data:b,next:this.head};this.length===0&&(this.tail=k),this.head=k,++this.length}},{key:"shift",value:function(){if(this.length!==0){var b=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,b}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(b){if(this.length===0)return"";for(var k=this.head,w=""+k.data;k=k.next;)w+=b+k.data;return w}},{key:"concat",value:function(b){if(this.length===0)return u.alloc(0);for(var k=u.allocUnsafe(b>>>0),w=this.head,_=0;w;)p(w.data,k,_),_+=w.data.length,w=w.next;return k}},{key:"consume",value:function(b,k){var w;return b<this.head.data.length?(w=this.head.data.slice(0,b),this.head.data=this.head.data.slice(b)):b===this.head.data.length?w=this.shift():w=k?this._getString(b):this._getBuffer(b),w}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(b){var k=this.head,w=1,_=k.data;for(b-=_.length;k=k.next;){var C=k.data,N=b>C.length?C.length:b;if(N===C.length?_+=C:_+=C.slice(0,b),b-=N,b===0){N===C.length?(++w,k.next?this.head=k.next:this.head=this.tail=null):(this.head=k,k.data=C.slice(N));break}++w}return this.length-=w,_}},{key:"_getBuffer",value:function(b){var k=u.allocUnsafe(b),w=this.head,_=1;for(w.data.copy(k),b-=w.data.length;w=w.next;){var C=w.data,N=b>C.length?C.length:b;if(C.copy(k,k.length-b,0,N),b-=N,b===0){N===C.length?(++_,w.next?this.head=w.next:this.head=this.tail=null):(this.head=w,w.data=C.slice(N));break}++_}return this.length-=_,k}},{key:m,value:function(b,k){return f(this,t(t({},k),{},{depth:0,customInspect:!1}))}}]),g}(),f4}var m4,age;function VBe(){if(age)return m4;age=1;function e(o,s){var l=this,u=this._readableState&&this._readableState.destroyed,d=this._writableState&&this._writableState.destroyed;return u||d?(s?s(o):o&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,jn.nextTick(i,this,o)):jn.nextTick(i,this,o)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(o||null,function(f){!s&&f?l._writableState?l._writableState.errorEmitted?jn.nextTick(n,l):(l._writableState.errorEmitted=!0,jn.nextTick(t,l,f)):jn.nextTick(t,l,f):s?(jn.nextTick(n,l),s(f)):jn.nextTick(n,l)}),this)}function t(o,s){i(o,s),n(o)}function n(o){o._writableState&&!o._writableState.emitClose||o._readableState&&!o._readableState.emitClose||o.emit("close")}function r(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function i(o,s){o.emit("error",s)}function a(o,s){var l=o._readableState,u=o._writableState;l&&l.autoDestroy||u&&u.autoDestroy?o.destroy(s):o.emit("error",s)}return m4={destroy:e,undestroy:r,errorOrDestroy:a},m4}var h4={},oge;function Q0(){if(oge)return h4;oge=1;function e(s,l){s.prototype=Object.create(l.prototype),s.prototype.constructor=s,s.__proto__=l}var t={};function n(s,l,u){u||(u=Error);function d(m,p,g){return typeof l=="string"?l:l(m,p,g)}var f=function(m){e(p,m);function p(g,v,b){return m.call(this,d(g,v,b))||this}return p}(u);f.prototype.name=u.name,f.prototype.code=s,t[s]=f}function r(s,l){if(Array.isArray(s)){var u=s.length;return s=s.map(function(d){return String(d)}),u>2?"one of ".concat(l," ").concat(s.slice(0,u-1).join(", "),", or ")+s[u-1]:u===2?"one of ".concat(l," ").concat(s[0]," or ").concat(s[1]):"of ".concat(l," ").concat(s[0])}else return"of ".concat(l," ").concat(String(s))}function i(s,l,u){return s.substr(0,l.length)===l}function a(s,l,u){return(u===void 0||u>s.length)&&(u=s.length),s.substring(u-l.length,u)===l}function o(s,l,u){return typeof u!="number"&&(u=0),u+l.length>s.length?!1:s.indexOf(l,u)!==-1}return n("ERR_INVALID_OPT_VALUE",function(s,l){return'The value "'+l+'" is invalid for option "'+s+'"'},TypeError),n("ERR_INVALID_ARG_TYPE",function(s,l,u){var d;typeof l=="string"&&i(l,"not ")?(d="must not be",l=l.replace(/^not /,"")):d="must be";var f;if(a(s," argument"))f="The ".concat(s," ").concat(d," ").concat(r(l,"type"));else{var m=o(s,".")?"property":"argument";f='The "'.concat(s,'" ').concat(m," ").concat(d," ").concat(r(l,"type"))}return f+=". Received type ".concat(typeof u),f},TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",function(s){return"The "+s+" method is not implemented"}),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",function(s){return"Cannot call "+s+" after a stream was destroyed"}),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",function(s){return"Unknown encoding: "+s},TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),h4.codes=t,h4}var p4,sge;function UBe(){if(sge)return p4;sge=1;var e=Q0().codes.ERR_INVALID_OPT_VALUE;function t(r,i,a){return r.highWaterMark!=null?r.highWaterMark:i?r[a]:null}function n(r,i,a,o){var s=t(i,o,a);if(s!=null){if(!(isFinite(s)&&Math.floor(s)===s)||s<0){var l=o?a:"highWaterMark";throw new e(l,s)}return Math.floor(s)}return r.objectMode?16:16*1024}return p4={getHighWaterMark:n},p4}var g4,lge;function fon(){if(lge)return g4;lge=1,g4=e;function e(n,r){if(t("noDeprecation"))return n;var i=!1;function a(){if(!i){if(t("throwDeprecation"))throw new Error(r);t("traceDeprecation")?console.trace(r):console.warn(r),i=!0}return n.apply(this,arguments)}return a}function t(n){try{if(!Ho.localStorage)return!1}catch{return!1}var r=Ho.localStorage[n];return r==null?!1:String(r).toLowerCase()==="true"}return g4}var v4,cge;function HBe(){if(cge)return v4;cge=1,v4=T;function e(re){var ae=this;this.next=null,this.entry=null,this.finish=function(){se(ae,re)}}var t;T.WritableState=j;var n={deprecate:fon()},r=BBe(),i=VR().Buffer,a=(typeof Ho<"u"?Ho:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function o(re){return i.from(re)}function s(re){return i.isBuffer(re)||re instanceof a}var l=VBe(),u=UBe(),d=u.getHighWaterMark,f=Q0().codes,m=f.ERR_INVALID_ARG_TYPE,p=f.ERR_METHOD_NOT_IMPLEMENTED,g=f.ERR_MULTIPLE_CALLBACK,v=f.ERR_STREAM_CANNOT_PIPE,b=f.ERR_STREAM_DESTROYED,k=f.ERR_STREAM_NULL_VALUES,w=f.ERR_STREAM_WRITE_AFTER_END,_=f.ERR_UNKNOWN_ENCODING,C=l.errorOrDestroy;bg()(T,r);function N(){}function j(re,ae,ue){t=t||Gy(),re=re||{},typeof ue!="boolean"&&(ue=ae instanceof t),this.objectMode=!!re.objectMode,ue&&(this.objectMode=this.objectMode||!!re.writableObjectMode),this.highWaterMark=d(this,re,"writableHighWaterMark",ue),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var de=re.decodeStrings===!1;this.decodeStrings=!de,this.defaultEncoding=re.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(he){M(ae,he)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=re.emitClose!==!1,this.autoDestroy=!!re.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}j.prototype.getBuffer=function(){for(var ae=this.bufferedRequest,ue=[];ae;)ue.push(ae),ae=ae.next;return ue},function(){try{Object.defineProperty(j.prototype,"buffer",{get:n.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var O;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(O=Function.prototype[Symbol.hasInstance],Object.defineProperty(T,Symbol.hasInstance,{value:function(ae){return O.call(this,ae)?!0:this!==T?!1:ae&&ae._writableState instanceof j}})):O=function(ae){return ae instanceof this};function T(re){t=t||Gy();var ae=this instanceof t;if(!ae&&!O.call(T,this))return new T(re);this._writableState=new j(re,this,ae),this.writable=!0,re&&(typeof re.write=="function"&&(this._write=re.write),typeof re.writev=="function"&&(this._writev=re.writev),typeof re.destroy=="function"&&(this._destroy=re.destroy),typeof re.final=="function"&&(this._final=re.final)),r.call(this)}T.prototype.pipe=function(){C(this,new v)};function P(re,ae){var ue=new w;C(re,ue),jn.nextTick(ae,ue)}function A(re,ae,ue,de){var he;return ue===null?he=new k:typeof ue!="string"&&!ae.objectMode&&(he=new m("chunk",["string","Buffer"],ue)),he?(C(re,he),jn.nextTick(de,he),!1):!0}T.prototype.write=function(re,ae,ue){var de=this._writableState,he=!1,Q=!de.objectMode&&s(re);return Q&&!i.isBuffer(re)&&(re=o(re)),typeof ae=="function"&&(ue=ae,ae=null),Q?ae="buffer":ae||(ae=de.defaultEncoding),typeof ue!="function"&&(ue=N),de.ending?P(this,ue):(Q||A(this,de,re,ue))&&(de.pendingcb++,he=V(this,de,Q,re,ae,ue)),he},T.prototype.cork=function(){this._writableState.corked++},T.prototype.uncork=function(){var re=this._writableState;re.corked&&(re.corked--,!re.writing&&!re.corked&&!re.bufferProcessing&&re.bufferedRequest&&X(this,re))},T.prototype.setDefaultEncoding=function(ae){if(typeof ae=="string"&&(ae=ae.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((ae+"").toLowerCase())>-1))throw new _(ae);return this._writableState.defaultEncoding=ae,this},Object.defineProperty(T.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function R(re,ae,ue){return!re.objectMode&&re.decodeStrings!==!1&&typeof ae=="string"&&(ae=i.from(ae,ue)),ae}Object.defineProperty(T.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function V(re,ae,ue,de,he,Q){if(!ue){var q=R(ae,de,he);de!==q&&(ue=!0,he="buffer",de=q)}var ve=ae.objectMode?1:de.length;ae.length+=ve;var be=ae.length<ae.highWaterMark;if(be||(ae.needDrain=!0),ae.writing||ae.corked){var Be=ae.lastBufferedRequest;ae.lastBufferedRequest={chunk:de,encoding:he,isBuf:ue,callback:Q,next:null},Be?Be.next=ae.lastBufferedRequest:ae.bufferedRequest=ae.lastBufferedRequest,ae.bufferedRequestCount+=1}else $(re,ae,!1,ve,de,he,Q);return be}function $(re,ae,ue,de,he,Q,q){ae.writelen=de,ae.writecb=q,ae.writing=!0,ae.sync=!0,ae.destroyed?ae.onwrite(new b("write")):ue?re._writev(he,ae.onwrite):re._write(he,Q,ae.onwrite),ae.sync=!1}function B(re,ae,ue,de,he){--ae.pendingcb,ue?(jn.nextTick(he,de),jn.nextTick(ee,re,ae),re._writableState.errorEmitted=!0,C(re,de)):(he(de),re._writableState.errorEmitted=!0,C(re,de),ee(re,ae))}function L(re){re.writing=!1,re.writecb=null,re.length-=re.writelen,re.writelen=0}function M(re,ae){var ue=re._writableState,de=ue.sync,he=ue.writecb;if(typeof he!="function")throw new g;if(L(ue),ae)B(re,ue,de,ae,he);else{var Q=Y(ue)||re.destroyed;!Q&&!ue.corked&&!ue.bufferProcessing&&ue.bufferedRequest&&X(re,ue),de?jn.nextTick(U,re,ue,Q,he):U(re,ue,Q,he)}}function U(re,ae,ue,de){ue||G(re,ae),ae.pendingcb--,de(),ee(re,ae)}function G(re,ae){ae.length===0&&ae.needDrain&&(ae.needDrain=!1,re.emit("drain"))}function X(re,ae){ae.bufferProcessing=!0;var ue=ae.bufferedRequest;if(re._writev&&ue&&ue.next){var de=ae.bufferedRequestCount,he=new Array(de),Q=ae.corkedRequestsFree;Q.entry=ue;for(var q=0,ve=!0;ue;)he[q]=ue,ue.isBuf||(ve=!1),ue=ue.next,q+=1;he.allBuffers=ve,$(re,ae,!0,ae.length,he,"",Q.finish),ae.pendingcb++,ae.lastBufferedRequest=null,Q.next?(ae.corkedRequestsFree=Q.next,Q.next=null):ae.corkedRequestsFree=new e(ae),ae.bufferedRequestCount=0}else{for(;ue;){var be=ue.chunk,Be=ue.encoding,le=ue.callback,z=ae.objectMode?1:be.length;if($(re,ae,!1,z,be,Be,le),ue=ue.next,ae.bufferedRequestCount--,ae.writing)break}ue===null&&(ae.lastBufferedRequest=null)}ae.bufferedRequest=ue,ae.bufferProcessing=!1}T.prototype._write=function(re,ae,ue){ue(new p("_write()"))},T.prototype._writev=null,T.prototype.end=function(re,ae,ue){var de=this._writableState;return typeof re=="function"?(ue=re,re=null,ae=null):typeof ae=="function"&&(ue=ae,ae=null),re!=null&&this.write(re,ae),de.corked&&(de.corked=1,this.uncork()),de.ending||Z(this,de,ue),this},Object.defineProperty(T.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function Y(re){return re.ending&&re.length===0&&re.bufferedRequest===null&&!re.finished&&!re.writing}function ie(re,ae){re._final(function(ue){ae.pendingcb--,ue&&C(re,ue),ae.prefinished=!0,re.emit("prefinish"),ee(re,ae)})}function J(re,ae){!ae.prefinished&&!ae.finalCalled&&(typeof re._final=="function"&&!ae.destroyed?(ae.pendingcb++,ae.finalCalled=!0,jn.nextTick(ie,re,ae)):(ae.prefinished=!0,re.emit("prefinish")))}function ee(re,ae){var ue=Y(ae);if(ue&&(J(re,ae),ae.pendingcb===0&&(ae.finished=!0,re.emit("finish"),ae.autoDestroy))){var de=re._readableState;(!de||de.autoDestroy&&de.endEmitted)&&re.destroy()}return ue}function Z(re,ae,ue){ae.ending=!0,ee(re,ae),ue&&(ae.finished?jn.nextTick(ue):re.once("finish",ue)),ae.ended=!0,re.writable=!1}function se(re,ae,ue){var de=re.entry;for(re.entry=null;de;){var he=de.callback;ae.pendingcb--,he(ue),de=de.next}ae.corkedRequestsFree.next=re}return Object.defineProperty(T.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(ae){this._writableState&&(this._writableState.destroyed=ae)}}),T.prototype.destroy=l.destroy,T.prototype._undestroy=l.undestroy,T.prototype._destroy=function(re,ae){ae(re)},v4}var y4,uge;function Gy(){if(uge)return y4;uge=1;var e=Object.keys||function(u){var d=[];for(var f in u)d.push(f);return d};y4=o;var t=qBe(),n=HBe();bg()(o,t);for(var r=e(n.prototype),i=0;i<r.length;i++){var a=r[i];o.prototype[a]||(o.prototype[a]=n.prototype[a])}function o(u){if(!(this instanceof o))return new o(u);t.call(this,u),n.call(this,u),this.allowHalfOpen=!0,u&&(u.readable===!1&&(this.readable=!1),u.writable===!1&&(this.writable=!1),u.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",s)))}Object.defineProperty(o.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(o.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(o.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function s(){this._writableState.ended||jn.nextTick(l,this)}function l(u){u.end()}return Object.defineProperty(o.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(d){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=d,this._writableState.destroyed=d)}}),y4}var b4={},xE={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var dge;function mon(){return dge||(dge=1,function(e,t){var n=VR(),r=n.Buffer;function i(o,s){for(var l in o)s[l]=o[l]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?e.exports=n:(i(n,t),t.Buffer=a);function a(o,s,l){return r(o,s,l)}a.prototype=Object.create(r.prototype),i(r,a),a.from=function(o,s,l){if(typeof o=="number")throw new TypeError("Argument must not be a number");return r(o,s,l)},a.alloc=function(o,s,l){if(typeof o!="number")throw new TypeError("Argument must be a number");var u=r(o);return s!==void 0?typeof l=="string"?u.fill(s,l):u.fill(s):u.fill(0),u},a.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return r(o)},a.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return n.SlowBuffer(o)}}(xE,xE.exports)),xE.exports}var fge;function mge(){if(fge)return b4;fge=1;var e=mon().Buffer,t=e.isEncoding||function(k){switch(k=""+k,k&&k.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function n(k){if(!k)return"utf8";for(var w;;)switch(k){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return k;default:if(w)return;k=(""+k).toLowerCase(),w=!0}}function r(k){var w=n(k);if(typeof w!="string"&&(e.isEncoding===t||!t(k)))throw new Error("Unknown encoding: "+k);return w||k}b4.StringDecoder=i;function i(k){this.encoding=r(k);var w;switch(this.encoding){case"utf16le":this.text=f,this.end=m,w=4;break;case"utf8":this.fillLast=l,w=4;break;case"base64":this.text=p,this.end=g,w=3;break;default:this.write=v,this.end=b;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(w)}i.prototype.write=function(k){if(k.length===0)return"";var w,_;if(this.lastNeed){if(w=this.fillLast(k),w===void 0)return"";_=this.lastNeed,this.lastNeed=0}else _=0;return _<k.length?w?w+this.text(k,_):this.text(k,_):w||""},i.prototype.end=d,i.prototype.text=u,i.prototype.fillLast=function(k){if(this.lastNeed<=k.length)return k.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);k.copy(this.lastChar,this.lastTotal-this.lastNeed,0,k.length),this.lastNeed-=k.length};function a(k){return k<=127?0:k>>5===6?2:k>>4===14?3:k>>3===30?4:k>>6===2?-1:-2}function o(k,w,_){var C=w.length-1;if(C<_)return 0;var N=a(w[C]);return N>=0?(N>0&&(k.lastNeed=N-1),N):--C<_||N===-2?0:(N=a(w[C]),N>=0?(N>0&&(k.lastNeed=N-2),N):--C<_||N===-2?0:(N=a(w[C]),N>=0?(N>0&&(N===2?N=0:k.lastNeed=N-3),N):0))}function s(k,w,_){if((w[0]&192)!==128)return k.lastNeed=0,"�";if(k.lastNeed>1&&w.length>1){if((w[1]&192)!==128)return k.lastNeed=1,"�";if(k.lastNeed>2&&w.length>2&&(w[2]&192)!==128)return k.lastNeed=2,"�"}}function l(k){var w=this.lastTotal-this.lastNeed,_=s(this,k);if(_!==void 0)return _;if(this.lastNeed<=k.length)return k.copy(this.lastChar,w,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);k.copy(this.lastChar,w,0,k.length),this.lastNeed-=k.length}function u(k,w){var _=o(this,k,w);if(!this.lastNeed)return k.toString("utf8",w);this.lastTotal=_;var C=k.length-(_-this.lastNeed);return k.copy(this.lastChar,0,C),k.toString("utf8",w,C)}function d(k){var w=k&&k.length?this.write(k):"";return this.lastNeed?w+"�":w}function f(k,w){if((k.length-w)%2===0){var _=k.toString("utf16le",w);if(_){var C=_.charCodeAt(_.length-1);if(C>=55296&&C<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=k[k.length-2],this.lastChar[1]=k[k.length-1],_.slice(0,-1)}return _}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=k[k.length-1],k.toString("utf16le",w,k.length-1)}function m(k){var w=k&&k.length?this.write(k):"";if(this.lastNeed){var _=this.lastTotal-this.lastNeed;return w+this.lastChar.toString("utf16le",0,_)}return w}function p(k,w){var _=(k.length-w)%3;return _===0?k.toString("base64",w):(this.lastNeed=3-_,this.lastTotal=3,_===1?this.lastChar[0]=k[k.length-1]:(this.lastChar[0]=k[k.length-2],this.lastChar[1]=k[k.length-1]),k.toString("base64",w,k.length-_))}function g(k){var w=k&&k.length?this.write(k):"";return this.lastNeed?w+this.lastChar.toString("base64",0,3-this.lastNeed):w}function v(k){return k.toString(this.encoding)}function b(k){return k&&k.length?this.write(k):""}return b4}var x4,hge;function cK(){if(hge)return x4;hge=1;var e=Q0().codes.ERR_STREAM_PREMATURE_CLOSE;function t(a){var o=!1;return function(){if(!o){o=!0;for(var s=arguments.length,l=new Array(s),u=0;u<s;u++)l[u]=arguments[u];a.apply(this,l)}}}function n(){}function r(a){return a.setHeader&&typeof a.abort=="function"}function i(a,o,s){if(typeof o=="function")return i(a,null,o);o||(o={}),s=t(s||n);var l=o.readable||o.readable!==!1&&a.readable,u=o.writable||o.writable!==!1&&a.writable,d=function(){a.writable||m()},f=a._writableState&&a._writableState.finished,m=function(){u=!1,f=!0,l||s.call(a)},p=a._readableState&&a._readableState.endEmitted,g=function(){l=!1,p=!0,u||s.call(a)},v=function(_){s.call(a,_)},b=function(){var _;if(l&&!p)return(!a._readableState||!a._readableState.ended)&&(_=new e),s.call(a,_);if(u&&!f)return(!a._writableState||!a._writableState.ended)&&(_=new e),s.call(a,_)},k=function(){a.req.on("finish",m)};return r(a)?(a.on("complete",m),a.on("abort",b),a.req?k():a.on("request",k)):u&&!a._writableState&&(a.on("end",d),a.on("close",d)),a.on("end",g),a.on("finish",m),o.error!==!1&&a.on("error",v),a.on("close",b),function(){a.removeListener("complete",m),a.removeListener("abort",b),a.removeListener("request",k),a.req&&a.req.removeListener("finish",m),a.removeListener("end",d),a.removeListener("close",d),a.removeListener("finish",m),a.removeListener("end",g),a.removeListener("error",v),a.removeListener("close",b)}}return x4=i,x4}var k4,pge;function hon(){if(pge)return k4;pge=1;var e;function t(_,C,N){return C=n(C),C in _?Object.defineProperty(_,C,{value:N,enumerable:!0,configurable:!0,writable:!0}):_[C]=N,_}function n(_){var C=r(_,"string");return typeof C=="symbol"?C:String(C)}function r(_,C){if(typeof _!="object"||_===null)return _;var N=_[Symbol.toPrimitive];if(N!==void 0){var j=N.call(_,C);if(typeof j!="object")return j;throw new TypeError("@@toPrimitive must return a primitive value.")}return(C==="string"?String:Number)(_)}var i=cK(),a=Symbol("lastResolve"),o=Symbol("lastReject"),s=Symbol("error"),l=Symbol("ended"),u=Symbol("lastPromise"),d=Symbol("handlePromise"),f=Symbol("stream");function m(_,C){return{value:_,done:C}}function p(_){var C=_[a];if(C!==null){var N=_[f].read();N!==null&&(_[u]=null,_[a]=null,_[o]=null,C(m(N,!1)))}}function g(_){jn.nextTick(p,_)}function v(_,C){return function(N,j){_.then(function(){if(C[l]){N(m(void 0,!0));return}C[d](N,j)},j)}}var b=Object.getPrototypeOf(function(){}),k=Object.setPrototypeOf((e={get stream(){return this[f]},next:function(){var C=this,N=this[s];if(N!==null)return Promise.reject(N);if(this[l])return Promise.resolve(m(void 0,!0));if(this[f].destroyed)return new Promise(function(P,A){jn.nextTick(function(){C[s]?A(C[s]):P(m(void 0,!0))})});var j=this[u],O;if(j)O=new Promise(v(j,this));else{var T=this[f].read();if(T!==null)return Promise.resolve(m(T,!1));O=new Promise(this[d])}return this[u]=O,O}},t(e,Symbol.asyncIterator,function(){return this}),t(e,"return",function(){var C=this;return new Promise(function(N,j){C[f].destroy(null,function(O){if(O){j(O);return}N(m(void 0,!0))})})}),e),b),w=function(C){var N,j=Object.create(k,(N={},t(N,f,{value:C,writable:!0}),t(N,a,{value:null,writable:!0}),t(N,o,{value:null,writable:!0}),t(N,s,{value:null,writable:!0}),t(N,l,{value:C._readableState.endEmitted,writable:!0}),t(N,d,{value:function(T,P){var A=j[f].read();A?(j[u]=null,j[a]=null,j[o]=null,T(m(A,!1))):(j[a]=T,j[o]=P)},writable:!0}),N));return j[u]=null,i(C,function(O){if(O&&O.code!=="ERR_STREAM_PREMATURE_CLOSE"){var T=j[o];T!==null&&(j[u]=null,j[a]=null,j[o]=null,T(O)),j[s]=O;return}var P=j[a];P!==null&&(j[u]=null,j[a]=null,j[o]=null,P(m(void 0,!0))),j[l]=!0}),C.on("readable",g.bind(null,j)),j};return k4=w,k4}var S4,gge;function pon(){return gge||(gge=1,S4=function(){throw new Error("Readable.from is not available in the browser")}),S4}var w4,vge;function qBe(){if(vge)return w4;vge=1,w4=P;var e;P.ReadableState=T,lK().EventEmitter;var t=function(q,ve){return q.listeners(ve).length},n=BBe(),r=VR().Buffer,i=(typeof Ho<"u"?Ho:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function a(Q){return r.from(Q)}function o(Q){return r.isBuffer(Q)||Q instanceof i}var s=zBe(),l;s&&s.debuglog?l=s.debuglog("stream"):l=function(){};var u=don(),d=VBe(),f=UBe(),m=f.getHighWaterMark,p=Q0().codes,g=p.ERR_INVALID_ARG_TYPE,v=p.ERR_STREAM_PUSH_AFTER_EOF,b=p.ERR_METHOD_NOT_IMPLEMENTED,k=p.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,w,_,C;bg()(P,n);var N=d.errorOrDestroy,j=["error","close","destroy","pause","resume"];function O(Q,q,ve){if(typeof Q.prependListener=="function")return Q.prependListener(q,ve);!Q._events||!Q._events[q]?Q.on(q,ve):Array.isArray(Q._events[q])?Q._events[q].unshift(ve):Q._events[q]=[ve,Q._events[q]]}function T(Q,q,ve){e=e||Gy(),Q=Q||{},typeof ve!="boolean"&&(ve=q instanceof e),this.objectMode=!!Q.objectMode,ve&&(this.objectMode=this.objectMode||!!Q.readableObjectMode),this.highWaterMark=m(this,Q,"readableHighWaterMark",ve),this.buffer=new u,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=Q.emitClose!==!1,this.autoDestroy=!!Q.autoDestroy,this.destroyed=!1,this.defaultEncoding=Q.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,Q.encoding&&(w||(w=mge().StringDecoder),this.decoder=new w(Q.encoding),this.encoding=Q.encoding)}function P(Q){if(e=e||Gy(),!(this instanceof P))return new P(Q);var q=this instanceof e;this._readableState=new T(Q,this,q),this.readable=!0,Q&&(typeof Q.read=="function"&&(this._read=Q.read),typeof Q.destroy=="function"&&(this._destroy=Q.destroy)),n.call(this)}Object.defineProperty(P.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(q){this._readableState&&(this._readableState.destroyed=q)}}),P.prototype.destroy=d.destroy,P.prototype._undestroy=d.undestroy,P.prototype._destroy=function(Q,q){q(Q)},P.prototype.push=function(Q,q){var ve=this._readableState,be;return ve.objectMode?be=!0:typeof Q=="string"&&(q=q||ve.defaultEncoding,q!==ve.encoding&&(Q=r.from(Q,q),q=""),be=!0),A(this,Q,q,!1,be)},P.prototype.unshift=function(Q){return A(this,Q,null,!0,!1)};function A(Q,q,ve,be,Be){l("readableAddChunk",q);var le=Q._readableState;if(q===null)le.reading=!1,M(Q,le);else{var z;if(Be||(z=V(le,q)),z)N(Q,z);else if(le.objectMode||q&&q.length>0)if(typeof q!="string"&&!le.objectMode&&Object.getPrototypeOf(q)!==r.prototype&&(q=a(q)),be)le.endEmitted?N(Q,new k):R(Q,le,q,!0);else if(le.ended)N(Q,new v);else{if(le.destroyed)return!1;le.reading=!1,le.decoder&&!ve?(q=le.decoder.write(q),le.objectMode||q.length!==0?R(Q,le,q,!1):X(Q,le)):R(Q,le,q,!1)}else be||(le.reading=!1,X(Q,le))}return!le.ended&&(le.length<le.highWaterMark||le.length===0)}function R(Q,q,ve,be){q.flowing&&q.length===0&&!q.sync?(q.awaitDrain=0,Q.emit("data",ve)):(q.length+=q.objectMode?1:ve.length,be?q.buffer.unshift(ve):q.buffer.push(ve),q.needReadable&&U(Q)),X(Q,q)}function V(Q,q){var ve;return!o(q)&&typeof q!="string"&&q!==void 0&&!Q.objectMode&&(ve=new g("chunk",["string","Buffer","Uint8Array"],q)),ve}P.prototype.isPaused=function(){return this._readableState.flowing===!1},P.prototype.setEncoding=function(Q){w||(w=mge().StringDecoder);var q=new w(Q);this._readableState.decoder=q,this._readableState.encoding=this._readableState.decoder.encoding;for(var ve=this._readableState.buffer.head,be="";ve!==null;)be+=q.write(ve.data),ve=ve.next;return this._readableState.buffer.clear(),be!==""&&this._readableState.buffer.push(be),this._readableState.length=be.length,this};var $=1073741824;function B(Q){return Q>=$?Q=$:(Q--,Q|=Q>>>1,Q|=Q>>>2,Q|=Q>>>4,Q|=Q>>>8,Q|=Q>>>16,Q++),Q}function L(Q,q){return Q<=0||q.length===0&&q.ended?0:q.objectMode?1:Q!==Q?q.flowing&&q.length?q.buffer.head.data.length:q.length:(Q>q.highWaterMark&&(q.highWaterMark=B(Q)),Q<=q.length?Q:q.ended?q.length:(q.needReadable=!0,0))}P.prototype.read=function(Q){l("read",Q),Q=parseInt(Q,10);var q=this._readableState,ve=Q;if(Q!==0&&(q.emittedReadable=!1),Q===0&&q.needReadable&&((q.highWaterMark!==0?q.length>=q.highWaterMark:q.length>0)||q.ended))return l("read: emitReadable",q.length,q.ended),q.length===0&&q.ended?ue(this):U(this),null;if(Q=L(Q,q),Q===0&&q.ended)return q.length===0&&ue(this),null;var be=q.needReadable;l("need readable",be),(q.length===0||q.length-Q<q.highWaterMark)&&(be=!0,l("length less than watermark",be)),q.ended||q.reading?(be=!1,l("reading or ended",be)):be&&(l("do read"),q.reading=!0,q.sync=!0,q.length===0&&(q.needReadable=!0),this._read(q.highWaterMark),q.sync=!1,q.reading||(Q=L(ve,q)));var Be;return Q>0?Be=ae(Q,q):Be=null,Be===null?(q.needReadable=q.length<=q.highWaterMark,Q=0):(q.length-=Q,q.awaitDrain=0),q.length===0&&(q.ended||(q.needReadable=!0),ve!==Q&&q.ended&&ue(this)),Be!==null&&this.emit("data",Be),Be};function M(Q,q){if(l("onEofChunk"),!q.ended){if(q.decoder){var ve=q.decoder.end();ve&&ve.length&&(q.buffer.push(ve),q.length+=q.objectMode?1:ve.length)}q.ended=!0,q.sync?U(Q):(q.needReadable=!1,q.emittedReadable||(q.emittedReadable=!0,G(Q)))}}function U(Q){var q=Q._readableState;l("emitReadable",q.needReadable,q.emittedReadable),q.needReadable=!1,q.emittedReadable||(l("emitReadable",q.flowing),q.emittedReadable=!0,jn.nextTick(G,Q))}function G(Q){var q=Q._readableState;l("emitReadable_",q.destroyed,q.length,q.ended),!q.destroyed&&(q.length||q.ended)&&(Q.emit("readable"),q.emittedReadable=!1),q.needReadable=!q.flowing&&!q.ended&&q.length<=q.highWaterMark,re(Q)}function X(Q,q){q.readingMore||(q.readingMore=!0,jn.nextTick(Y,Q,q))}function Y(Q,q){for(;!q.reading&&!q.ended&&(q.length<q.highWaterMark||q.flowing&&q.length===0);){var ve=q.length;if(l("maybeReadMore read 0"),Q.read(0),ve===q.length)break}q.readingMore=!1}P.prototype._read=function(Q){N(this,new b("_read()"))},P.prototype.pipe=function(Q,q){var ve=this,be=this._readableState;switch(be.pipesCount){case 0:be.pipes=Q;break;case 1:be.pipes=[be.pipes,Q];break;default:be.pipes.push(Q);break}be.pipesCount+=1,l("pipe count=%d opts=%j",be.pipesCount,q);var Be=(!q||q.end!==!1)&&Q!==jn.stdout&&Q!==jn.stderr,le=Be?W:Re;be.endEmitted?jn.nextTick(le):ve.once("end",le),Q.on("unpipe",z);function z(Le,Ke){l("onunpipe"),Le===ve&&Ke&&Ke.hasUnpiped===!1&&(Ke.hasUnpiped=!0,me())}function W(){l("onend"),Q.end()}var ne=ie(ve);Q.on("drain",ne);var te=!1;function me(){l("cleanup"),Q.removeListener("close",we),Q.removeListener("finish",Ne),Q.removeListener("drain",ne),Q.removeListener("error",Oe),Q.removeListener("unpipe",z),ve.removeListener("end",W),ve.removeListener("end",Re),ve.removeListener("data",fe),te=!0,be.awaitDrain&&(!Q._writableState||Q._writableState.needDrain)&&ne()}ve.on("data",fe);function fe(Le){l("ondata");var Ke=Q.write(Le);l("dest.write",Ke),Ke===!1&&((be.pipesCount===1&&be.pipes===Q||be.pipesCount>1&&he(be.pipes,Q)!==-1)&&!te&&(l("false write response, pause",be.awaitDrain),be.awaitDrain++),ve.pause())}function Oe(Le){l("onerror",Le),Re(),Q.removeListener("error",Oe),t(Q,"error")===0&&N(Q,Le)}O(Q,"error",Oe);function we(){Q.removeListener("finish",Ne),Re()}Q.once("close",we);function Ne(){l("onfinish"),Q.removeListener("close",we),Re()}Q.once("finish",Ne);function Re(){l("unpipe"),ve.unpipe(Q)}return Q.emit("pipe",ve),be.flowing||(l("pipe resume"),ve.resume()),Q};function ie(Q){return function(){var ve=Q._readableState;l("pipeOnDrain",ve.awaitDrain),ve.awaitDrain&&ve.awaitDrain--,ve.awaitDrain===0&&t(Q,"data")&&(ve.flowing=!0,re(Q))}}P.prototype.unpipe=function(Q){var q=this._readableState,ve={hasUnpiped:!1};if(q.pipesCount===0)return this;if(q.pipesCount===1)return Q&&Q!==q.pipes?this:(Q||(Q=q.pipes),q.pipes=null,q.pipesCount=0,q.flowing=!1,Q&&Q.emit("unpipe",this,ve),this);if(!Q){var be=q.pipes,Be=q.pipesCount;q.pipes=null,q.pipesCount=0,q.flowing=!1;for(var le=0;le<Be;le++)be[le].emit("unpipe",this,{hasUnpiped:!1});return this}var z=he(q.pipes,Q);return z===-1?this:(q.pipes.splice(z,1),q.pipesCount-=1,q.pipesCount===1&&(q.pipes=q.pipes[0]),Q.emit("unpipe",this,ve),this)},P.prototype.on=function(Q,q){var ve=n.prototype.on.call(this,Q,q),be=this._readableState;return Q==="data"?(be.readableListening=this.listenerCount("readable")>0,be.flowing!==!1&&this.resume()):Q==="readable"&&!be.endEmitted&&!be.readableListening&&(be.readableListening=be.needReadable=!0,be.flowing=!1,be.emittedReadable=!1,l("on readable",be.length,be.reading),be.length?U(this):be.reading||jn.nextTick(ee,this)),ve},P.prototype.addListener=P.prototype.on,P.prototype.removeListener=function(Q,q){var ve=n.prototype.removeListener.call(this,Q,q);return Q==="readable"&&jn.nextTick(J,this),ve},P.prototype.removeAllListeners=function(Q){var q=n.prototype.removeAllListeners.apply(this,arguments);return(Q==="readable"||Q===void 0)&&jn.nextTick(J,this),q};function J(Q){var q=Q._readableState;q.readableListening=Q.listenerCount("readable")>0,q.resumeScheduled&&!q.paused?q.flowing=!0:Q.listenerCount("data")>0&&Q.resume()}function ee(Q){l("readable nexttick read 0"),Q.read(0)}P.prototype.resume=function(){var Q=this._readableState;return Q.flowing||(l("resume"),Q.flowing=!Q.readableListening,Z(this,Q)),Q.paused=!1,this};function Z(Q,q){q.resumeScheduled||(q.resumeScheduled=!0,jn.nextTick(se,Q,q))}function se(Q,q){l("resume",q.reading),q.reading||Q.read(0),q.resumeScheduled=!1,Q.emit("resume"),re(Q),q.flowing&&!q.reading&&Q.read(0)}P.prototype.pause=function(){return l("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(l("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function re(Q){var q=Q._readableState;for(l("flow",q.flowing);q.flowing&&Q.read()!==null;);}P.prototype.wrap=function(Q){var q=this,ve=this._readableState,be=!1;Q.on("end",function(){if(l("wrapped end"),ve.decoder&&!ve.ended){var z=ve.decoder.end();z&&z.length&&q.push(z)}q.push(null)}),Q.on("data",function(z){if(l("wrapped data"),ve.decoder&&(z=ve.decoder.write(z)),!(ve.objectMode&&z==null)&&!(!ve.objectMode&&(!z||!z.length))){var W=q.push(z);W||(be=!0,Q.pause())}});for(var Be in Q)this[Be]===void 0&&typeof Q[Be]=="function"&&(this[Be]=function(W){return function(){return Q[W].apply(Q,arguments)}}(Be));for(var le=0;le<j.length;le++)Q.on(j[le],this.emit.bind(this,j[le]));return this._read=function(z){l("wrapped _read",z),be&&(be=!1,Q.resume())},this},typeof Symbol=="function"&&(P.prototype[Symbol.asyncIterator]=function(){return _===void 0&&(_=hon()),_(this)}),Object.defineProperty(P.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(P.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(P.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(q){this._readableState&&(this._readableState.flowing=q)}}),P._fromList=ae,Object.defineProperty(P.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function ae(Q,q){if(q.length===0)return null;var ve;return q.objectMode?ve=q.buffer.shift():!Q||Q>=q.length?(q.decoder?ve=q.buffer.join(""):q.buffer.length===1?ve=q.buffer.first():ve=q.buffer.concat(q.length),q.buffer.clear()):ve=q.buffer.consume(Q,q.decoder),ve}function ue(Q){var q=Q._readableState;l("endReadable",q.endEmitted),q.endEmitted||(q.ended=!0,jn.nextTick(de,q,Q))}function de(Q,q){if(l("endReadableNT",Q.endEmitted,Q.length),!Q.endEmitted&&Q.length===0&&(Q.endEmitted=!0,q.readable=!1,q.emit("end"),Q.autoDestroy)){var ve=q._writableState;(!ve||ve.autoDestroy&&ve.finished)&&q.destroy()}}typeof Symbol=="function"&&(P.from=function(Q,q){return C===void 0&&(C=pon()),C(P,Q,q)});function he(Q,q){for(var ve=0,be=Q.length;ve<be;ve++)if(Q[ve]===q)return ve;return-1}return w4}var _4,yge;function WBe(){if(yge)return _4;yge=1,_4=s;var e=Q0().codes,t=e.ERR_METHOD_NOT_IMPLEMENTED,n=e.ERR_MULTIPLE_CALLBACK,r=e.ERR_TRANSFORM_ALREADY_TRANSFORMING,i=e.ERR_TRANSFORM_WITH_LENGTH_0,a=Gy();bg()(s,a);function o(d,f){var m=this._transformState;m.transforming=!1;var p=m.writecb;if(p===null)return this.emit("error",new n);m.writechunk=null,m.writecb=null,f!=null&&this.push(f),p(d);var g=this._readableState;g.reading=!1,(g.needReadable||g.length<g.highWaterMark)&&this._read(g.highWaterMark)}function s(d){if(!(this instanceof s))return new s(d);a.call(this,d),this._transformState={afterTransform:o.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,d&&(typeof d.transform=="function"&&(this._transform=d.transform),typeof d.flush=="function"&&(this._flush=d.flush)),this.on("prefinish",l)}function l(){var d=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(f,m){u(d,f,m)}):u(this,null,null)}s.prototype.push=function(d,f){return this._transformState.needTransform=!1,a.prototype.push.call(this,d,f)},s.prototype._transform=function(d,f,m){m(new t("_transform()"))},s.prototype._write=function(d,f,m){var p=this._transformState;if(p.writecb=m,p.writechunk=d,p.writeencoding=f,!p.transforming){var g=this._readableState;(p.needTransform||g.needReadable||g.length<g.highWaterMark)&&this._read(g.highWaterMark)}},s.prototype._read=function(d){var f=this._transformState;f.writechunk!==null&&!f.transforming?(f.transforming=!0,this._transform(f.writechunk,f.writeencoding,f.afterTransform)):f.needTransform=!0},s.prototype._destroy=function(d,f){a.prototype._destroy.call(this,d,function(m){f(m)})};function u(d,f,m){if(f)return d.emit("error",f);if(m!=null&&d.push(m),d._writableState.length)throw new i;if(d._transformState.transforming)throw new r;return d.push(null)}return _4}var N4,bge;function gon(){if(bge)return N4;bge=1,N4=t;var e=WBe();bg()(t,e);function t(n){if(!(this instanceof t))return new t(n);e.call(this,n)}return t.prototype._transform=function(n,r,i){i(null,n)},N4}var C4,xge;function von(){if(xge)return C4;xge=1;var e;function t(m){var p=!1;return function(){p||(p=!0,m.apply(void 0,arguments))}}var n=Q0().codes,r=n.ERR_MISSING_ARGS,i=n.ERR_STREAM_DESTROYED;function a(m){if(m)throw m}function o(m){return m.setHeader&&typeof m.abort=="function"}function s(m,p,g,v){v=t(v);var b=!1;m.on("close",function(){b=!0}),e===void 0&&(e=cK()),e(m,{readable:p,writable:g},function(w){if(w)return v(w);b=!0,v()});var k=!1;return function(w){if(!b&&!k){if(k=!0,o(m))return m.abort();if(typeof m.destroy=="function")return m.destroy();v(w||new i("pipe"))}}}function l(m){m()}function u(m,p){return m.pipe(p)}function d(m){return!m.length||typeof m[m.length-1]!="function"?a:m.pop()}function f(){for(var m=arguments.length,p=new Array(m),g=0;g<m;g++)p[g]=arguments[g];var v=d(p);if(Array.isArray(p[0])&&(p=p[0]),p.length<2)throw new r("streams");var b,k=p.map(function(w,_){var C=_<p.length-1,N=_>0;return s(w,C,N,function(j){b||(b=j),j&&k.forEach(l),!C&&(k.forEach(l),v(b))})});return p.reduce(u)}return C4=f,C4}var E4,kge;function yon(){if(kge)return E4;kge=1,E4=n;var e=lK().EventEmitter,t=bg();t(n,e),n.Readable=qBe(),n.Writable=HBe(),n.Duplex=Gy(),n.Transform=WBe(),n.PassThrough=gon(),n.finished=cK(),n.pipeline=von(),n.Stream=n;function n(){e.call(this)}return n.prototype.pipe=function(r,i){var a=this;function o(p){r.writable&&r.write(p)===!1&&a.pause&&a.pause()}a.on("data",o);function s(){a.readable&&a.resume&&a.resume()}r.on("drain",s),!r._isStdio&&(!i||i.end!==!1)&&(a.on("end",u),a.on("close",d));var l=!1;function u(){l||(l=!0,r.end())}function d(){l||(l=!0,typeof r.destroy=="function"&&r.destroy())}function f(p){if(m(),e.listenerCount(this,"error")===0)throw p}a.on("error",f),r.on("error",f);function m(){a.removeListener("data",o),r.removeListener("drain",s),a.removeListener("end",u),a.removeListener("close",d),a.removeListener("error",f),r.removeListener("error",f),a.removeListener("end",m),a.removeListener("close",m),r.removeListener("close",m)}return a.on("end",m),a.on("close",m),r.on("close",m),r.emit("pipe",a),r},E4}var bon=yon();const GBe=function(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)};class kr extends Error{constructor(t,n,r,...i){Array.isArray(n)&&(n=n.join(" ").trim()),super(n),Error.captureStackTrace!==void 0&&Error.captureStackTrace(this,kr),this.code=t;for(const a of i)for(const o in a){const s=a[o];this[o]=On.isBuffer(s)?s.toString(r.encoding):s==null?s:JSON.parse(JSON.stringify(s))}}}const YBe=function(e){const t=[];for(let n=0,r=e.length;n<r;n++){const i=e[n];if(i==null||i===!1)t[n]={disabled:!0};else if(typeof i=="string")t[n]={name:i};else if(GBe(i)){if(typeof i.name!="string")throw new kr("CSV_OPTION_COLUMNS_MISSING_NAME",["Option columns missing name:",`property "name" is required at position ${n}`,"when column is an object literal"]);t[n]=i}else throw new kr("CSV_INVALID_COLUMN_DEFINITION",["Invalid column definition:","expect a string or a literal object,",`got ${JSON.stringify(i)} at position ${n}`])}return t};class Sge{constructor(t=100){this.size=t,this.length=0,this.buf=On.allocUnsafe(t)}prepend(t){if(On.isBuffer(t)){const n=this.length+t.length;if(n>=this.size&&(this.resize(),n>=this.size))throw Error("INVALID_BUFFER_STATE");const r=this.buf;this.buf=On.allocUnsafe(this.size),t.copy(this.buf,0),r.copy(this.buf,t.length),this.length+=t.length}else{const n=this.length++;n===this.size&&this.resize();const r=this.clone();this.buf[0]=t,r.copy(this.buf,1,0,n)}}append(t){const n=this.length++;n===this.size&&this.resize(),this.buf[n]=t}clone(){return On.from(this.buf.slice(0,this.length))}resize(){const t=this.length;this.size=this.size*2;const n=On.allocUnsafe(this.size);this.buf.copy(n,0,0,t),this.buf=n}toString(t){return t?this.buf.slice(0,this.length).toString(t):Uint8Array.prototype.slice.call(this.buf.slice(0,this.length))}toJSON(){return this.toString("utf8")}reset(){this.length=0}}const xon=12,kon=13,Son=10,won=32,_on=9,Non=function(e){return{bomSkipped:!1,bufBytesStart:0,castField:e.cast_function,commenting:!1,error:void 0,enabled:e.from_line===1,escaping:!1,escapeIsQuote:On.isBuffer(e.escape)&&On.isBuffer(e.quote)&&On.compare(e.escape,e.quote)===0,expectedRecordLength:Array.isArray(e.columns)?e.columns.length:void 0,field:new Sge(20),firstLineToHeaders:e.cast_first_line_to_header,needMoreDataSize:Math.max(e.comment!==null?e.comment.length:0,...e.delimiter.map(t=>t.length),e.quote!==null?e.quote.length:0),previousBuf:void 0,quoting:!1,stop:!1,rawBuffer:new Sge(100),record:[],recordHasError:!1,record_length:0,recordDelimiterMaxLength:e.record_delimiter.length===0?0:Math.max(...e.record_delimiter.map(t=>t.length)),trimChars:[On.from(" ",e.encoding)[0],On.from(" ",e.encoding)[0]],wasQuoting:!1,wasRowDelimiter:!1,timchars:[On.from(On.from([kon],"utf8").toString(),e.encoding),On.from(On.from([Son],"utf8").toString(),e.encoding),On.from(On.from([xon],"utf8").toString(),e.encoding),On.from(On.from([won],"utf8").toString(),e.encoding),On.from(On.from([_on],"utf8").toString(),e.encoding)]}},Con=function(e){return e.replace(/([A-Z])/g,function(t,n){return"_"+n.toLowerCase()})},wge=function(e){const t={};for(const r in e)t[Con(r)]=e[r];if(t.encoding===void 0||t.encoding===!0)t.encoding="utf8";else if(t.encoding===null||t.encoding===!1)t.encoding=null;else if(typeof t.encoding!="string"&&t.encoding!==null)throw new kr("CSV_INVALID_OPTION_ENCODING",["Invalid option encoding:","encoding must be a string or null to return a buffer,",`got ${JSON.stringify(t.encoding)}`],t);if(t.bom===void 0||t.bom===null||t.bom===!1)t.bom=!1;else if(t.bom!==!0)throw new kr("CSV_INVALID_OPTION_BOM",["Invalid option bom:","bom must be true,",`got ${JSON.stringify(t.bom)}`],t);if(t.cast_function=null,t.cast===void 0||t.cast===null||t.cast===!1||t.cast==="")t.cast=void 0;else if(typeof t.cast=="function")t.cast_function=t.cast,t.cast=!0;else if(t.cast!==!0)throw new kr("CSV_INVALID_OPTION_CAST",["Invalid option cast:","cast must be true or a function,",`got ${JSON.stringify(t.cast)}`],t);if(t.cast_date===void 0||t.cast_date===null||t.cast_date===!1||t.cast_date==="")t.cast_date=!1;else if(t.cast_date===!0)t.cast_date=function(r){const i=Date.parse(r);return isNaN(i)?r:new Date(i)};else if(typeof t.cast_date!="function")throw new kr("CSV_INVALID_OPTION_CAST_DATE",["Invalid option cast_date:","cast_date must be true or a function,",`got ${JSON.stringify(t.cast_date)}`],t);if(t.cast_first_line_to_header=void 0,t.columns===!0)t.cast_first_line_to_header=void 0;else if(typeof t.columns=="function")t.cast_first_line_to_header=t.columns,t.columns=!0;else if(Array.isArray(t.columns))t.columns=YBe(t.columns);else if(t.columns===void 0||t.columns===null||t.columns===!1)t.columns=!1;else throw new kr("CSV_INVALID_OPTION_COLUMNS",["Invalid option columns:","expect an array, a function or true,",`got ${JSON.stringify(t.columns)}`],t);if(t.group_columns_by_name===void 0||t.group_columns_by_name===null||t.group_columns_by_name===!1)t.group_columns_by_name=!1;else{if(t.group_columns_by_name!==!0)throw new kr("CSV_INVALID_OPTION_GROUP_COLUMNS_BY_NAME",["Invalid option group_columns_by_name:","expect an boolean,",`got ${JSON.stringify(t.group_columns_by_name)}`],t);if(t.columns===!1)throw new kr("CSV_INVALID_OPTION_GROUP_COLUMNS_BY_NAME",["Invalid option group_columns_by_name:","the `columns` mode must be activated."],t)}if(t.comment===void 0||t.comment===null||t.comment===!1||t.comment==="")t.comment=null;else if(typeof t.comment=="string"&&(t.comment=On.from(t.comment,t.encoding)),!On.isBuffer(t.comment))throw new kr("CSV_INVALID_OPTION_COMMENT",["Invalid option comment:","comment must be a buffer or a string,",`got ${JSON.stringify(t.comment)}`],t);if(t.comment_no_infix===void 0||t.comment_no_infix===null||t.comment_no_infix===!1)t.comment_no_infix=!1;else if(t.comment_no_infix!==!0)throw new kr("CSV_INVALID_OPTION_COMMENT",["Invalid option comment_no_infix:","value must be a boolean,",`got ${JSON.stringify(t.comment_no_infix)}`],t);const n=JSON.stringify(t.delimiter);if(Array.isArray(t.delimiter)||(t.delimiter=[t.delimiter]),t.delimiter.length===0)throw new kr("CSV_INVALID_OPTION_DELIMITER",["Invalid option delimiter:","delimiter must be a non empty string or buffer or array of string|buffer,",`got ${n}`],t);if(t.delimiter=t.delimiter.map(function(r){if(r==null||r===!1)return On.from(",",t.encoding);if(typeof r=="string"&&(r=On.from(r,t.encoding)),!On.isBuffer(r)||r.length===0)throw new kr("CSV_INVALID_OPTION_DELIMITER",["Invalid option delimiter:","delimiter must be a non empty string or buffer or array of string|buffer,",`got ${n}`],t);return r}),t.escape===void 0||t.escape===!0?t.escape=On.from('"',t.encoding):typeof t.escape=="string"?t.escape=On.from(t.escape,t.encoding):(t.escape===null||t.escape===!1)&&(t.escape=null),t.escape!==null&&!On.isBuffer(t.escape))throw new Error(`Invalid Option: escape must be a buffer, a string or a boolean, got ${JSON.stringify(t.escape)}`);if(t.from===void 0||t.from===null)t.from=1;else if(typeof t.from=="string"&&/\d+/.test(t.from)&&(t.from=parseInt(t.from)),Number.isInteger(t.from)){if(t.from<0)throw new Error(`Invalid Option: from must be a positive integer, got ${JSON.stringify(e.from)}`)}else throw new Error(`Invalid Option: from must be an integer, got ${JSON.stringify(t.from)}`);if(t.from_line===void 0||t.from_line===null)t.from_line=1;else if(typeof t.from_line=="string"&&/\d+/.test(t.from_line)&&(t.from_line=parseInt(t.from_line)),Number.isInteger(t.from_line)){if(t.from_line<=0)throw new Error(`Invalid Option: from_line must be a positive integer greater than 0, got ${JSON.stringify(e.from_line)}`)}else throw new Error(`Invalid Option: from_line must be an integer, got ${JSON.stringify(e.from_line)}`);if(t.ignore_last_delimiters===void 0||t.ignore_last_delimiters===null)t.ignore_last_delimiters=!1;else if(typeof t.ignore_last_delimiters=="number")t.ignore_last_delimiters=Math.floor(t.ignore_last_delimiters),t.ignore_last_delimiters===0&&(t.ignore_last_delimiters=!1);else if(typeof t.ignore_last_delimiters!="boolean")throw new kr("CSV_INVALID_OPTION_IGNORE_LAST_DELIMITERS",["Invalid option `ignore_last_delimiters`:","the value must be a boolean value or an integer,",`got ${JSON.stringify(t.ignore_last_delimiters)}`],t);if(t.ignore_last_delimiters===!0&&t.columns===!1)throw new kr("CSV_IGNORE_LAST_DELIMITERS_REQUIRES_COLUMNS",["The option `ignore_last_delimiters`","requires the activation of the `columns` option"],t);if(t.info===void 0||t.info===null||t.info===!1)t.info=!1;else if(t.info!==!0)throw new Error(`Invalid Option: info must be true, got ${JSON.stringify(t.info)}`);if(t.max_record_size===void 0||t.max_record_size===null||t.max_record_size===!1)t.max_record_size=0;else if(!(Number.isInteger(t.max_record_size)&&t.max_record_size>=0))if(typeof t.max_record_size=="string"&&/\d+/.test(t.max_record_size))t.max_record_size=parseInt(t.max_record_size);else throw new Error(`Invalid Option: max_record_size must be a positive integer, got ${JSON.stringify(t.max_record_size)}`);if(t.objname===void 0||t.objname===null||t.objname===!1)t.objname=void 0;else if(On.isBuffer(t.objname)){if(t.objname.length===0)throw new Error("Invalid Option: objname must be a non empty buffer");t.encoding===null||(t.objname=t.objname.toString(t.encoding))}else if(typeof t.objname=="string"){if(t.objname.length===0)throw new Error("Invalid Option: objname must be a non empty string")}else if(typeof t.objname!="number")throw new Error(`Invalid Option: objname must be a string or a buffer, got ${t.objname}`);if(t.objname!==void 0){if(typeof t.objname=="number"){if(t.columns!==!1)throw Error("Invalid Option: objname index cannot be combined with columns or be defined as a field")}else if(t.columns===!1)throw Error("Invalid Option: objname field must be combined with columns or be defined as an index")}if(t.on_record===void 0||t.on_record===null)t.on_record=void 0;else if(typeof t.on_record!="function")throw new kr("CSV_INVALID_OPTION_ON_RECORD",["Invalid option `on_record`:","expect a function,",`got ${JSON.stringify(t.on_record)}`],t);if(t.on_skip!==void 0&&t.on_skip!==null&&typeof t.on_skip!="function")throw new Error(`Invalid Option: on_skip must be a function, got ${JSON.stringify(t.on_skip)}`);if(t.quote===null||t.quote===!1||t.quote==="")t.quote=null;else if(t.quote===void 0||t.quote===!0?t.quote=On.from('"',t.encoding):typeof t.quote=="string"&&(t.quote=On.from(t.quote,t.encoding)),!On.isBuffer(t.quote))throw new Error(`Invalid Option: quote must be a buffer or a string, got ${JSON.stringify(t.quote)}`);if(t.raw===void 0||t.raw===null||t.raw===!1)t.raw=!1;else if(t.raw!==!0)throw new Error(`Invalid Option: raw must be true, got ${JSON.stringify(t.raw)}`);if(t.record_delimiter===void 0)t.record_delimiter=[];else if(typeof t.record_delimiter=="string"||On.isBuffer(t.record_delimiter)){if(t.record_delimiter.length===0)throw new kr("CSV_INVALID_OPTION_RECORD_DELIMITER",["Invalid option `record_delimiter`:","value must be a non empty string or buffer,",`got ${JSON.stringify(t.record_delimiter)}`],t);t.record_delimiter=[t.record_delimiter]}else if(!Array.isArray(t.record_delimiter))throw new kr("CSV_INVALID_OPTION_RECORD_DELIMITER",["Invalid option `record_delimiter`:","value must be a string, a buffer or array of string|buffer,",`got ${JSON.stringify(t.record_delimiter)}`],t);if(t.record_delimiter=t.record_delimiter.map(function(r,i){if(typeof r!="string"&&!On.isBuffer(r))throw new kr("CSV_INVALID_OPTION_RECORD_DELIMITER",["Invalid option `record_delimiter`:","value must be a string, a buffer or array of string|buffer",`at index ${i},`,`got ${JSON.stringify(r)}`],t);if(r.length===0)throw new kr("CSV_INVALID_OPTION_RECORD_DELIMITER",["Invalid option `record_delimiter`:","value must be a non empty string or buffer",`at index ${i},`,`got ${JSON.stringify(r)}`],t);return typeof r=="string"&&(r=On.from(r,t.encoding)),r}),typeof t.relax_column_count!="boolean")if(t.relax_column_count===void 0||t.relax_column_count===null)t.relax_column_count=!1;else throw new Error(`Invalid Option: relax_column_count must be a boolean, got ${JSON.stringify(t.relax_column_count)}`);if(typeof t.relax_column_count_less!="boolean")if(t.relax_column_count_less===void 0||t.relax_column_count_less===null)t.relax_column_count_less=!1;else throw new Error(`Invalid Option: relax_column_count_less must be a boolean, got ${JSON.stringify(t.relax_column_count_less)}`);if(typeof t.relax_column_count_more!="boolean")if(t.relax_column_count_more===void 0||t.relax_column_count_more===null)t.relax_column_count_more=!1;else throw new Error(`Invalid Option: relax_column_count_more must be a boolean, got ${JSON.stringify(t.relax_column_count_more)}`);if(typeof t.relax_quotes!="boolean")if(t.relax_quotes===void 0||t.relax_quotes===null)t.relax_quotes=!1;else throw new Error(`Invalid Option: relax_quotes must be a boolean, got ${JSON.stringify(t.relax_quotes)}`);if(typeof t.skip_empty_lines!="boolean")if(t.skip_empty_lines===void 0||t.skip_empty_lines===null)t.skip_empty_lines=!1;else throw new Error(`Invalid Option: skip_empty_lines must be a boolean, got ${JSON.stringify(t.skip_empty_lines)}`);if(typeof t.skip_records_with_empty_values!="boolean")if(t.skip_records_with_empty_values===void 0||t.skip_records_with_empty_values===null)t.skip_records_with_empty_values=!1;else throw new Error(`Invalid Option: skip_records_with_empty_values must be a boolean, got ${JSON.stringify(t.skip_records_with_empty_values)}`);if(typeof t.skip_records_with_error!="boolean")if(t.skip_records_with_error===void 0||t.skip_records_with_error===null)t.skip_records_with_error=!1;else throw new Error(`Invalid Option: skip_records_with_error must be a boolean, got ${JSON.stringify(t.skip_records_with_error)}`);if(t.rtrim===void 0||t.rtrim===null||t.rtrim===!1)t.rtrim=!1;else if(t.rtrim!==!0)throw new Error(`Invalid Option: rtrim must be a boolean, got ${JSON.stringify(t.rtrim)}`);if(t.ltrim===void 0||t.ltrim===null||t.ltrim===!1)t.ltrim=!1;else if(t.ltrim!==!0)throw new Error(`Invalid Option: ltrim must be a boolean, got ${JSON.stringify(t.ltrim)}`);if(t.trim===void 0||t.trim===null||t.trim===!1)t.trim=!1;else if(t.trim!==!0)throw new Error(`Invalid Option: trim must be a boolean, got ${JSON.stringify(t.trim)}`);if(t.trim===!0&&e.ltrim!==!1?t.ltrim=!0:t.ltrim!==!0&&(t.ltrim=!1),t.trim===!0&&e.rtrim!==!1?t.rtrim=!0:t.rtrim!==!0&&(t.rtrim=!1),t.to===void 0||t.to===null)t.to=-1;else if(typeof t.to=="string"&&/\d+/.test(t.to)&&(t.to=parseInt(t.to)),Number.isInteger(t.to)){if(t.to<=0)throw new Error(`Invalid Option: to must be a positive integer greater than 0, got ${JSON.stringify(e.to)}`)}else throw new Error(`Invalid Option: to must be an integer, got ${JSON.stringify(e.to)}`);if(t.to_line===void 0||t.to_line===null)t.to_line=-1;else if(typeof t.to_line=="string"&&/\d+/.test(t.to_line)&&(t.to_line=parseInt(t.to_line)),Number.isInteger(t.to_line)){if(t.to_line<=0)throw new Error(`Invalid Option: to_line must be a positive integer greater than 0, got ${JSON.stringify(e.to_line)}`)}else throw new Error(`Invalid Option: to_line must be an integer, got ${JSON.stringify(e.to_line)}`);return t},_ge=function(e){return e.every(t=>t==null||t.toString&&t.toString().trim()==="")},Eon=13,jon=10,wv={utf8:On.from([239,187,191]),utf16le:On.from([255,254])},Oon=function(e={}){const t={bytes:0,comment_lines:0,empty_lines:0,invalid_field_length:0,lines:1,records:0},n=wge(e);return{info:t,original_options:e,options:n,state:Non(n),__needMoreData:function(r,i,a){if(a)return!1;const{encoding:o,escape:s,quote:l}=this.options,{quoting:u,needMoreDataSize:d,recordDelimiterMaxLength:f}=this.state,m=i-r-1,p=Math.max(d,f===0?On.from(`\r
754
754
  `,o).length:f,u?(s===null?0:s.length)+l.length:0,u?l.length+f:0);return m<p},parse:function(r,i,a,o){const{bom:s,comment_no_infix:l,encoding:u,from_line:d,ltrim:f,max_record_size:m,raw:p,relax_quotes:g,rtrim:v,skip_empty_lines:b,to:k,to_line:w}=this.options;let{comment:_,escape:C,quote:N,record_delimiter:j}=this.options;const{bomSkipped:O,previousBuf:T,rawBuffer:P,escapeIsQuote:A}=this.state;let R;if(T===void 0)if(r===void 0){o();return}else R=r;else T!==void 0&&r===void 0?R=T:R=On.concat([T,r]);if(O===!1)if(s===!1)this.state.bomSkipped=!0;else if(R.length<3){if(i===!1){this.state.previousBuf=R;return}}else{for(const B in wv)if(wv[B].compare(R,0,wv[B].length)===0){const L=wv[B].length;this.state.bufBytesStart+=L,R=R.slice(L),this.options=wge({...this.original_options,encoding:B}),{comment:_,escape:C,quote:N}=this.options;break}this.state.bomSkipped=!0}const V=R.length;let $;for($=0;$<V&&!this.__needMoreData($,V,i);$++){if(this.state.wasRowDelimiter===!0&&(this.info.lines++,this.state.wasRowDelimiter=!1),w!==-1&&this.info.lines>w){this.state.stop=!0,o();return}this.state.quoting===!1&&j.length===0&&this.__autoDiscoverRecordDelimiter(R,$)&&(j=this.options.record_delimiter);const B=R[$];if(p===!0&&P.append(B),(B===Eon||B===jon)&&this.state.wasRowDelimiter===!1&&(this.state.wasRowDelimiter=!0),this.state.escaping===!0)this.state.escaping=!1;else{if(C!==null&&this.state.quoting===!0&&this.__isEscape(R,$,B)&&$+C.length<V)if(A){if(this.__isQuote(R,$+C.length)){this.state.escaping=!0,$+=C.length-1;continue}}else{this.state.escaping=!0,$+=C.length-1;continue}if(this.state.commenting===!1&&this.__isQuote(R,$))if(this.state.quoting===!0){const U=R[$+N.length],G=v&&this.__isCharTrimable(R,$+N.length),X=_!==null&&this.__compareBytes(_,R,$+N.length,U),Y=this.__isDelimiter(R,$+N.length,U),ie=j.length===0?this.__autoDiscoverRecordDelimiter(R,$+N.length):this.__isRecordDelimiter(U,R,$+N.length);if(C!==null&&this.__isEscape(R,$,B)&&this.__isQuote(R,$+C.length))$+=C.length-1;else if(!U||Y||ie||X||G){this.state.quoting=!1,this.state.wasQuoting=!0,$+=N.length-1;continue}else if(g===!1){const J=this.__error(new kr("CSV_INVALID_CLOSING_QUOTE",["Invalid Closing Quote:",`got "${String.fromCharCode(U)}"`,`at line ${this.info.lines}`,"instead of delimiter, record delimiter, trimable character","(if activated) or comment"],this.options,this.__infoField()));if(J!==void 0)return J}else this.state.quoting=!1,this.state.wasQuoting=!0,this.state.field.prepend(N),$+=N.length-1}else if(this.state.field.length!==0){if(g===!1){const U=this.__infoField(),G=Object.keys(wv).map(Y=>wv[Y].equals(this.state.field.toString())?Y:!1).filter(Boolean)[0],X=this.__error(new kr("INVALID_OPENING_QUOTE",["Invalid Opening Quote:",`a quote is found on field ${JSON.stringify(U.column)} at line ${U.lines}, value is ${JSON.stringify(this.state.field.toString(u))}`,G?`(${G} bom)`:void 0],this.options,U,{field:this.state.field}));if(X!==void 0)return X}}else{this.state.quoting=!0,$+=N.length-1;continue}if(this.state.quoting===!1){const U=this.__isRecordDelimiter(B,R,$);if(U!==0){if(this.state.commenting&&this.state.wasQuoting===!1&&this.state.record.length===0&&this.state.field.length===0)this.info.comment_lines++;else{if(this.state.enabled===!1&&this.info.lines+(this.state.wasRowDelimiter===!0?1:0)>=d){this.state.enabled=!0,this.__resetField(),this.__resetRecord(),$+=U-1;continue}if(b===!0&&this.state.wasQuoting===!1&&this.state.record.length===0&&this.state.field.length===0){this.info.empty_lines++,$+=U-1;continue}this.info.bytes=this.state.bufBytesStart+$;const Y=this.__onField();if(Y!==void 0)return Y;this.info.bytes=this.state.bufBytesStart+$+U;const ie=this.__onRecord(a);if(ie!==void 0)return ie;if(k!==-1&&this.info.records>=k){this.state.stop=!0,o();return}}this.state.commenting=!1,$+=U-1;continue}if(this.state.commenting)continue;if(_!==null&&(l===!1||this.state.record.length===0&&this.state.field.length===0)&&this.__compareBytes(_,R,$,B)!==0){this.state.commenting=!0;continue}const G=this.__isDelimiter(R,$,B);if(G!==0){this.info.bytes=this.state.bufBytesStart+$;const X=this.__onField();if(X!==void 0)return X;$+=G-1;continue}}}if(this.state.commenting===!1&&m!==0&&this.state.record_length+this.state.field.length>m)return this.__error(new kr("CSV_MAX_RECORD_SIZE",["Max Record Size:","record exceed the maximum number of tolerated bytes",`of ${m}`,`at line ${this.info.lines}`],this.options,this.__infoField()));const L=f===!1||this.state.quoting===!0||this.state.field.length!==0||!this.__isCharTrimable(R,$),M=v===!1||this.state.wasQuoting===!1;if(L===!0&&M===!0)this.state.field.append(B);else{if(v===!0&&!this.__isCharTrimable(R,$))return this.__error(new kr("CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE",["Invalid Closing Quote:","found non trimable byte after quote",`at line ${this.info.lines}`],this.options,this.__infoField()));L===!1&&($+=this.__isCharTrimable(R,$)-1);continue}}if(i===!0)if(this.state.quoting===!0){const B=this.__error(new kr("CSV_QUOTE_NOT_CLOSED",["Quote Not Closed:",`the parsing is finished with an opening quote at line ${this.info.lines}`],this.options,this.__infoField()));if(B!==void 0)return B}else if(this.state.wasQuoting===!0||this.state.record.length!==0||this.state.field.length!==0){this.info.bytes=this.state.bufBytesStart+$;const B=this.__onField();if(B!==void 0)return B;const L=this.__onRecord(a);if(L!==void 0)return L}else this.state.wasRowDelimiter===!0?this.info.empty_lines++:this.state.commenting===!0&&this.info.comment_lines++;else this.state.bufBytesStart+=$,this.state.previousBuf=R.slice($);this.state.wasRowDelimiter===!0&&(this.info.lines++,this.state.wasRowDelimiter=!1)},__onRecord:function(r){const{columns:i,group_columns_by_name:a,encoding:o,info:s,from:l,relax_column_count:u,relax_column_count_less:d,relax_column_count_more:f,raw:m,skip_records_with_empty_values:p}=this.options,{enabled:g,record:v}=this.state;if(g===!1)return this.__resetRecord();const b=v.length;if(i===!0){if(p===!0&&_ge(v)){this.__resetRecord();return}return this.__firstLineToColumns(v)}if(i===!1&&this.info.records===0&&(this.state.expectedRecordLength=b),b!==this.state.expectedRecordLength){const k=i===!1?new kr("CSV_RECORD_INCONSISTENT_FIELDS_LENGTH",["Invalid Record Length:",`expect ${this.state.expectedRecordLength},`,`got ${b} on line ${this.info.lines}`],this.options,this.__infoField(),{record:v}):new kr("CSV_RECORD_INCONSISTENT_COLUMNS",["Invalid Record Length:",`columns length is ${i.length},`,`got ${b} on line ${this.info.lines}`],this.options,this.__infoField(),{record:v});if(u===!0||d===!0&&b<this.state.expectedRecordLength||f===!0&&b>this.state.expectedRecordLength)this.info.invalid_field_length++,this.state.error=k;else{const w=this.__error(k);if(w)return w}}if(p===!0&&_ge(v)){this.__resetRecord();return}if(this.state.recordHasError===!0){this.__resetRecord(),this.state.recordHasError=!1;return}if(this.info.records++,l===1||this.info.records>=l){const{objname:k}=this.options;if(i!==!1){const w={};for(let _=0,C=v.length;_<C;_++)i[_]===void 0||i[_].disabled||(a===!0&&w[i[_].name]!==void 0?Array.isArray(w[i[_].name])?w[i[_].name]=w[i[_].name].concat(v[_]):w[i[_].name]=[w[i[_].name],v[_]]:w[i[_].name]=v[_]);if(m===!0||s===!0){const _=Object.assign({record:w},m===!0?{raw:this.state.rawBuffer.toString(o)}:{},s===!0?{info:this.__infoRecord()}:{}),C=this.__push(k===void 0?_:[w[k],_],r);if(C)return C}else{const _=this.__push(k===void 0?w:[w[k],w],r);if(_)return _}}else if(m===!0||s===!0){const w=Object.assign({record:v},m===!0?{raw:this.state.rawBuffer.toString(o)}:{},s===!0?{info:this.__infoRecord()}:{}),_=this.__push(k===void 0?w:[v[k],w],r);if(_)return _}else{const w=this.__push(k===void 0?v:[v[k],v],r);if(w)return w}}this.__resetRecord()},__firstLineToColumns:function(r){const{firstLineToHeaders:i}=this.state;try{const a=i===void 0?r:i.call(null,r);if(!Array.isArray(a))return this.__error(new kr("CSV_INVALID_COLUMN_MAPPING",["Invalid Column Mapping:","expect an array from column function,",`got ${JSON.stringify(a)}`],this.options,this.__infoField(),{headers:a}));const o=YBe(a);this.state.expectedRecordLength=o.length,this.options.columns=o,this.__resetRecord();return}catch(a){return a}},__resetRecord:function(){this.options.raw===!0&&this.state.rawBuffer.reset(),this.state.error=void 0,this.state.record=[],this.state.record_length=0},__onField:function(){const{cast:r,encoding:i,rtrim:a,max_record_size:o}=this.options,{enabled:s,wasQuoting:l}=this.state;if(s===!1)return this.__resetField();let u=this.state.field.toString(i);if(a===!0&&l===!1&&(u=u.trimRight()),r===!0){const[d,f]=this.__cast(u);if(d!==void 0)return d;u=f}this.state.record.push(u),o!==0&&typeof u=="string"&&(this.state.record_length+=u.length),this.__resetField()},__resetField:function(){this.state.field.reset(),this.state.wasQuoting=!1},__push:function(r,i){const{on_record:a}=this.options;if(a!==void 0){const o=this.__infoRecord();try{r=a.call(null,r,o)}catch(s){return s}if(r==null)return}i(r)},__cast:function(r){const{columns:i,relax_column_count:a}=this.options;if(Array.isArray(i)===!0&&a&&this.options.columns.length<=this.state.record.length)return[void 0,void 0];if(this.state.castField!==null)try{const s=this.__infoField();return[void 0,this.state.castField.call(null,r,s)]}catch(s){return[s]}if(this.__isFloat(r))return[void 0,parseFloat(r)];if(this.options.cast_date!==!1){const s=this.__infoField();return[void 0,this.options.cast_date.call(null,r,s)]}return[void 0,r]},__isCharTrimable:function(r,i){return((o,s)=>{const{timchars:l}=this.state;e:for(let u=0;u<l.length;u++){const d=l[u];for(let f=0;f<d.length;f++)if(d[f]!==o[s+f])continue e;return d.length}return 0})(r,i)},__isFloat:function(r){return r-parseFloat(r)+1>=0},__compareBytes:function(r,i,a,o){if(r[0]!==o)return 0;const s=r.length;for(let l=1;l<s;l++)if(r[l]!==i[a+l])return 0;return s},__isDelimiter:function(r,i,a){const{delimiter:o,ignore_last_delimiters:s}=this.options;if(s===!0&&this.state.record.length===this.options.columns.length-1)return 0;if(s!==!1&&typeof s=="number"&&this.state.record.length===s-1)return 0;e:for(let l=0;l<o.length;l++){const u=o[l];if(u[0]===a){for(let d=1;d<u.length;d++)if(u[d]!==r[i+d])continue e;return u.length}}return 0},__isRecordDelimiter:function(r,i,a){const{record_delimiter:o}=this.options,s=o.length;e:for(let l=0;l<s;l++){const u=o[l],d=u.length;if(u[0]===r){for(let f=1;f<d;f++)if(u[f]!==i[a+f])continue e;return u.length}}return 0},__isEscape:function(r,i,a){const{escape:o}=this.options;if(o===null)return!1;const s=o.length;if(o[0]===a){for(let l=0;l<s;l++)if(o[l]!==r[i+l])return!1;return!0}return!1},__isQuote:function(r,i){const{quote:a}=this.options;if(a===null)return!1;const o=a.length;for(let s=0;s<o;s++)if(a[s]!==r[i+s])return!1;return!0},__autoDiscoverRecordDelimiter:function(r,i){const{encoding:a}=this.options,o=[On.from(`\r
755
755
  `,a),On.from(`
756
- `,a),On.from("\r",a)];e:for(let s=0;s<o.length;s++){const l=o[s].length;for(let u=0;u<l;u++)if(o[s][u]!==r[i+u])continue e;return this.options.record_delimiter.push(o[s]),this.state.recordDelimiterMaxLength=o[s].length,o[s].length}return 0},__error:function(r){const{encoding:i,raw:a,skip_records_with_error:o}=this.options,s=typeof r=="string"?new Error(r):r;if(o){this.state.recordHasError=!0,this.options.on_skip!==void 0&&this.options.on_skip(s,a?this.state.rawBuffer.toString(i):void 0);return}else return s},__infoDataSet:function(){return{...this.info,columns:this.options.columns}},__infoRecord:function(){const{columns:r,raw:i,encoding:a}=this.options;return{...this.__infoDataSet(),error:this.state.error,header:r===!0,index:this.state.record.length,raw:i?this.state.rawBuffer.toString(a):void 0}},__infoField:function(){const{columns:r}=this.options,i=Array.isArray(r);return{...this.__infoRecord(),column:i===!0?r.length>this.state.record.length?r[this.state.record.length].name:null:this.state.record.length,quoting:this.state.wasQuoting}}}};class Don extends bon.Transform{constructor(t={}){super({readableObjectMode:!0,...t,encoding:null}),this.api=Oon({on_skip:(n,r)=>{this.emit("skip",n,r)},...t}),this.state=this.api.state,this.options=this.api.options,this.info=this.api.info}_transform(t,n,r){if(this.state.stop===!0)return;const i=this.api.parse(t,!1,a=>{this.push(a)},()=>{this.push(null),this.end(),this.on("end",this.destroy)});i!==void 0&&(this.state.stop=!0),r(i)}_flush(t){if(this.state.stop===!0)return;const n=this.api.parse(void 0,!0,r=>{this.push(r)},()=>{this.push(null),this.on("end",this.destroy)});t(n)}}const Ton=function(){let e,t,n;for(const i in arguments){const a=arguments[i],o=typeof a;if(e===void 0&&(typeof a=="string"||On.isBuffer(a)))e=a;else if(t===void 0&&GBe(a))t=a;else if(n===void 0&&o==="function")n=a;else throw new kr("CSV_INVALID_ARGUMENT",["Invalid argument:",`got ${JSON.stringify(a)} at index ${i}`],t||{})}const r=new Don(t);if(n){const i=t===void 0||t.objname===void 0?[]:{};r.on("readable",function(){let a;for(;(a=this.read())!==null;)t===void 0||t.objname===void 0?i.push(a):i[a[0]]=a[1]}),r.on("error",function(a){n(a,void 0,r.api.__infoDataSet())}),r.on("end",function(){n(void 0,i,r.api.__infoDataSet())})}if(e!==void 0){const i=function(){r.write(e),r.end()};typeof setImmediate=="function"?setImmediate(i):setTimeout(i,0)}return r},Pon=({form:e})=>{const[t,n]=x.useState(!1),r=x.useCallback(async i=>{const a=i.target.files?.[0];if(a){const o=Aon(a);let s=[];try{s=await Fon(a)}catch(l){console.error("Error parsing file:",l),je.error("Error",{description:"Error parsing file",duration:4e3,closeButton:!0})}s.length===0?je.error("Error",{description:"No records found in file",duration:4e3,closeButton:!0}):(e.setValue("issueMonth",o),e.setValue("generateDocumentsInfo",s),je.success("Success",{description:"CSV draft uploaded successfully",duration:4e3,closeButton:!0})),n(!1)}},[e]);return c.jsxs(I0,{children:[c.jsx($0,{children:c.jsxs(Ui,{open:t,onOpenChange:n,children:[c.jsx(_o,{asChild:!0,children:c.jsx(Te,{variant:"outline",className:"p-2",children:c.jsx(xpt,{size:20})})}),c.jsxs(Hi,{className:"w-[400px] max-w-screen-md",children:[c.jsx(Ua,{children:c.jsx(Ha,{children:"Upload documents generation draft"})}),c.jsx(Vn,{id:"documentsGenerationCsvDraft",type:"file",accept:".csv",onChange:r})]})]})}),c.jsx(L0,{children:c.jsx("p",{children:"Upload CSV draft"})})]})};function Aon(e){const n=e.name.match(/_(\d{4}_\d{2})/);if(n)return`${n[1].replace(/_/g,"-")}-15`}async function Fon(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=i=>{const a=i.target?.result;if(!a)return n(new Error("No content found in file"));const o=a.toString(),s=Ton(o,{columns:!1,skip_empty_lines:!0,trim:!0}),l=[];s.on("readable",()=>{let u;for(;(u=s.read())!==null;)if(!(!u||u[0]==="tid"))try{const d=Mon(u);l.push(d)}catch(d){n(d)}}),s.on("error",n),s.on("end",()=>{t(l)})},r.readAsText(e)})}const Ron=eo.object({amount:eo.object({raw:eo.number(),currency:eo.nativeEnum(ct)}).strict(),businessId:eo.string().uuid()}).strict();function Mon(e){if(e.length!==4)throw new Error("Invalid record length");const t=Ron.safeParse({amount:{raw:parseFloat(e[2]),currency:e[3]},businessId:e[0]});if(!t.success)throw new Error(`Invalid record: ${JSON.stringify(t.error.format())}`);return t.data}const Ion=({businessesData:e})=>{const{setFiltersContext:t}=x.useContext(Fr),n=bn({defaultValues:{generateDocumentsInfo:[],issueMonth:st(cje(new Date,1),"yyyy-MM-dd")}}),{issueDocuments:r}=Yan(),{fields:i,append:a,remove:o}=sg({control:n.control,name:"generateDocumentsInfo"}),s=n.watch("generateDocumentsInfo"),l=x.useMemo(()=>i.map((f,m)=>({...f,...s[m]})),[i,s]),u=x.useCallback(f=>{r(f)},[r]),d=x.useMemo(()=>e.filter(f=>!l.some(m=>m.businessId===f.originalBusiness.id)).sort((f,m)=>f.originalBusiness.name.localeCompare(m.originalBusiness.name)),[e,l]);return x.useEffect(()=>{t(c.jsxs("div",{className:"flex flex-row gap-x-5",children:[c.jsx(Xan,{form:n,businessesData:e}),c.jsx(Pon,{form:n})]}))},[n,e,t]),c.jsx("div",{className:"p-2",children:c.jsx(Xn,{...n,children:c.jsxs("form",{onSubmit:n.handleSubmit(u),children:[c.jsxs("div",{className:"flex gap-2 items-center mb-4",children:[c.jsx(Fa,{children:"Issue Month:"}),c.jsx(gt,{control:n.control,name:"issueMonth",render:({field:f,fieldState:m})=>c.jsxs(vt,{children:[c.jsx(Ct,{children:c.jsx(gu,{...f,value:f.value?new Date(f.value):new Date,onChange:p=>{const g=new Date(p.getFullYear(),p.getMonth(),15);n.setValue("issueMonth",st(g,"yyyy-MM-dd"))},error:m.error?.message,popoverProps:{withinPortal:!0}})}),c.jsx(Rt,{})]})})]}),c.jsxs($s,{children:[c.jsx(Ls,{children:c.jsxs(In,{children:[c.jsx(Rn,{children:"Name"}),c.jsx(Rn,{children:"Document"}),c.jsx(Rn,{children:"Amount"}),c.jsx(Rn,{children:"Currency"}),c.jsx(Rn,{children:"Remark"}),c.jsx(Rn,{children:"Recipients"}),c.jsx(Rn,{children:"Green Invoice ID"}),c.jsx(Rn,{children:"Local ID"}),c.jsx(Rn,{})]})}),c.jsx(Bs,{children:l.map((f,m)=>{const p=e.find(g=>g.originalBusiness.id===f.businessId);return p?c.jsxs(In,{children:[c.jsx(ot,{children:p.originalBusiness.name}),c.jsx(ot,{children:p.generatedDocumentType}),c.jsx(ot,{children:c.jsx(gt,{control:n.control,name:`generateDocumentsInfo.${m}.amount.raw`,render:({field:g})=>c.jsxs(vt,{children:[c.jsx(Id,{onValueChange:g.onChange,value:g.value??void 0,hideControls:!0,decimalScale:2}),c.jsx(Rt,{})]})})}),c.jsx(ot,{children:c.jsx(gt,{control:n.control,name:`generateDocumentsInfo.${m}.amount.currency`,render:({field:g})=>c.jsxs(vt,{children:[c.jsxs(Ad,{onValueChange:g.onChange,defaultValue:g.value,children:[c.jsx(Ct,{children:c.jsx(Rd,{children:c.jsx(Fd,{placeholder:"Select a recipient"})})}),c.jsx(Md,{children:Object.entries(ct).map(([v,b])=>c.jsx(iu,{value:b,children:v},v))})]}),c.jsx(Rt,{})]})})}),c.jsx(ot,{children:c.jsx("span",{className:"text-sm text-gray-500 whitespace-normal max-w-50",children:p.remark})}),c.jsx(ot,{children:c.jsx("div",{className:"flex flex-col",children:p.emails.map(g=>c.jsx("span",{className:"text-sm text-gray-500",children:g},g))})}),c.jsx(ot,{children:c.jsx("span",{className:"text-sm text-gray-500 whitespace-normal max-w-50",children:p.greenInvoiceId})}),c.jsx(ot,{children:c.jsx("span",{className:"text-sm text-gray-500 whitespace-normal max-w-50",children:f.id})}),c.jsx(ot,{children:c.jsx(Te,{variant:"secondary",onClick:()=>o(m),children:c.jsx(rg,{size:16})})})]},f.id):null})})]}),c.jsxs("div",{className:"flex justify-between items-center mt-4",children:[c.jsx(Kan,{greenInvoiceBusinesses:d,onAdd:a}),c.jsx(Tl,{onConfirm:n.handleSubmit(u),title:`Are you sure you want to issue ${l.length} documents?`,children:c.jsx(Te,{children:"Issue"})})]})]})})})},$on=()=>{const{setFiltersContext:e}=x.useContext(Fr),[{data:t,fetching:n}]=Dt({query:out});return x.useEffect(()=>{t||e(null)},[t,e]),n?c.jsx(No,{}):c.jsx(Ion,{businessesData:t?.greenInvoiceBusinesses??[]})};var j4,Nge;function ns(){if(Nge)return j4;Nge=1;var e=Array.isArray;return j4=e,j4}var O4,Cge;function KBe(){if(Cge)return O4;Cge=1;var e=typeof Ho=="object"&&Ho&&Ho.Object===Object&&Ho;return O4=e,O4}var D4,Ege;function Fu(){if(Ege)return D4;Ege=1;var e=KBe(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return D4=n,D4}var T4,jge;function g_(){if(jge)return T4;jge=1;var e=Fu(),t=e.Symbol;return T4=t,T4}var P4,Oge;function Lon(){if(Oge)return P4;Oge=1;var e=g_(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,i=e?e.toStringTag:void 0;function a(o){var s=n.call(o,i),l=o[i];try{o[i]=void 0;var u=!0}catch{}var d=r.call(o);return u&&(s?o[i]=l:delete o[i]),d}return P4=a,P4}var A4,Dge;function Bon(){if(Dge)return A4;Dge=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return A4=n,A4}var F4,Tge;function af(){if(Tge)return F4;Tge=1;var e=g_(),t=Lon(),n=Bon(),r="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function o(s){return s==null?s===void 0?i:r:a&&a in Object(s)?t(s):n(s)}return F4=o,F4}var R4,Pge;function of(){if(Pge)return R4;Pge=1;function e(t){return t!=null&&typeof t=="object"}return R4=e,R4}var M4,Age;function J0(){if(Age)return M4;Age=1;var e=af(),t=of(),n="[object Symbol]";function r(i){return typeof i=="symbol"||t(i)&&e(i)==n}return M4=r,M4}var I4,Fge;function uK(){if(Fge)return I4;Fge=1;var e=ns(),t=J0(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(a,o){if(e(a))return!1;var s=typeof a;return s=="number"||s=="symbol"||s=="boolean"||a==null||t(a)?!0:r.test(a)||!n.test(a)||o!=null&&a in Object(o)}return I4=i,I4}var $4,Rge;function Xm(){if(Rge)return $4;Rge=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return $4=e,$4}var L4,Mge;function dK(){if(Mge)return L4;Mge=1;var e=af(),t=Xm(),n="[object AsyncFunction]",r="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function o(s){if(!t(s))return!1;var l=e(s);return l==r||l==i||l==n||l==a}return L4=o,L4}var B4,Ige;function zon(){if(Ige)return B4;Ige=1;var e=Fu(),t=e["__core-js_shared__"];return B4=t,B4}var z4,$ge;function Von(){if($ge)return z4;$ge=1;var e=zon(),t=function(){var r=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}();function n(r){return!!t&&t in r}return z4=n,z4}var V4,Lge;function XBe(){if(Lge)return V4;Lge=1;var e=Function.prototype,t=e.toString;function n(r){if(r!=null){try{return t.call(r)}catch{}try{return r+""}catch{}}return""}return V4=n,V4}var U4,Bge;function Uon(){if(Bge)return U4;Bge=1;var e=dK(),t=Von(),n=Xm(),r=XBe(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,s=Object.prototype,l=o.toString,u=s.hasOwnProperty,d=RegExp("^"+l.call(u).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function f(m){if(!n(m)||t(m))return!1;var p=e(m)?d:a;return p.test(r(m))}return U4=f,U4}var H4,zge;function Hon(){if(zge)return H4;zge=1;function e(t,n){return t?.[n]}return H4=e,H4}var q4,Vge;function xg(){if(Vge)return q4;Vge=1;var e=Uon(),t=Hon();function n(r,i){var a=t(r,i);return e(a)?a:void 0}return q4=n,q4}var W4,Uge;function UR(){if(Uge)return W4;Uge=1;var e=xg(),t=e(Object,"create");return W4=t,W4}var G4,Hge;function qon(){if(Hge)return G4;Hge=1;var e=UR();function t(){this.__data__=e?e(null):{},this.size=0}return G4=t,G4}var Y4,qge;function Won(){if(qge)return Y4;qge=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return Y4=e,Y4}var K4,Wge;function Gon(){if(Wge)return K4;Wge=1;var e=UR(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function i(a){var o=this.__data__;if(e){var s=o[a];return s===t?void 0:s}return r.call(o,a)?o[a]:void 0}return K4=i,K4}var X4,Gge;function Yon(){if(Gge)return X4;Gge=1;var e=UR(),t=Object.prototype,n=t.hasOwnProperty;function r(i){var a=this.__data__;return e?a[i]!==void 0:n.call(a,i)}return X4=r,X4}var Z4,Yge;function Kon(){if(Yge)return Z4;Yge=1;var e=UR(),t="__lodash_hash_undefined__";function n(r,i){var a=this.__data__;return this.size+=this.has(r)?0:1,a[r]=e&&i===void 0?t:i,this}return Z4=n,Z4}var Q4,Kge;function Xon(){if(Kge)return Q4;Kge=1;var e=qon(),t=Won(),n=Gon(),r=Yon(),i=Kon();function a(o){var s=-1,l=o==null?0:o.length;for(this.clear();++s<l;){var u=o[s];this.set(u[0],u[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,Q4=a,Q4}var J4,Xge;function Zon(){if(Xge)return J4;Xge=1;function e(){this.__data__=[],this.size=0}return J4=e,J4}var e3,Zge;function fK(){if(Zge)return e3;Zge=1;function e(t,n){return t===n||t!==t&&n!==n}return e3=e,e3}var t3,Qge;function HR(){if(Qge)return t3;Qge=1;var e=fK();function t(n,r){for(var i=n.length;i--;)if(e(n[i][0],r))return i;return-1}return t3=t,t3}var n3,Jge;function Qon(){if(Jge)return n3;Jge=1;var e=HR(),t=Array.prototype,n=t.splice;function r(i){var a=this.__data__,o=e(a,i);if(o<0)return!1;var s=a.length-1;return o==s?a.pop():n.call(a,o,1),--this.size,!0}return n3=r,n3}var r3,eve;function Jon(){if(eve)return r3;eve=1;var e=HR();function t(n){var r=this.__data__,i=e(r,n);return i<0?void 0:r[i][1]}return r3=t,r3}var i3,tve;function esn(){if(tve)return i3;tve=1;var e=HR();function t(n){return e(this.__data__,n)>-1}return i3=t,i3}var a3,nve;function tsn(){if(nve)return a3;nve=1;var e=HR();function t(n,r){var i=this.__data__,a=e(i,n);return a<0?(++this.size,i.push([n,r])):i[a][1]=r,this}return a3=t,a3}var o3,rve;function qR(){if(rve)return o3;rve=1;var e=Zon(),t=Qon(),n=Jon(),r=esn(),i=tsn();function a(o){var s=-1,l=o==null?0:o.length;for(this.clear();++s<l;){var u=o[s];this.set(u[0],u[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,o3=a,o3}var s3,ive;function mK(){if(ive)return s3;ive=1;var e=xg(),t=Fu(),n=e(t,"Map");return s3=n,s3}var l3,ave;function nsn(){if(ave)return l3;ave=1;var e=Xon(),t=qR(),n=mK();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return l3=r,l3}var c3,ove;function rsn(){if(ove)return c3;ove=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return c3=e,c3}var u3,sve;function WR(){if(sve)return u3;sve=1;var e=rsn();function t(n,r){var i=n.__data__;return e(r)?i[typeof r=="string"?"string":"hash"]:i.map}return u3=t,u3}var d3,lve;function isn(){if(lve)return d3;lve=1;var e=WR();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return d3=t,d3}var f3,cve;function asn(){if(cve)return f3;cve=1;var e=WR();function t(n){return e(this,n).get(n)}return f3=t,f3}var m3,uve;function osn(){if(uve)return m3;uve=1;var e=WR();function t(n){return e(this,n).has(n)}return m3=t,m3}var h3,dve;function ssn(){if(dve)return h3;dve=1;var e=WR();function t(n,r){var i=e(this,n),a=i.size;return i.set(n,r),this.size+=i.size==a?0:1,this}return h3=t,h3}var p3,fve;function hK(){if(fve)return p3;fve=1;var e=nsn(),t=isn(),n=asn(),r=osn(),i=ssn();function a(o){var s=-1,l=o==null?0:o.length;for(this.clear();++s<l;){var u=o[s];this.set(u[0],u[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,p3=a,p3}var g3,mve;function ZBe(){if(mve)return g3;mve=1;var e=hK(),t="Expected a function";function n(r,i){if(typeof r!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var a=function(){var o=arguments,s=i?i.apply(this,o):o[0],l=a.cache;if(l.has(s))return l.get(s);var u=r.apply(this,o);return a.cache=l.set(s,u)||l,u};return a.cache=new(n.Cache||e),a}return n.Cache=e,g3=n,g3}var v3,hve;function lsn(){if(hve)return v3;hve=1;var e=ZBe(),t=500;function n(r){var i=e(r,function(o){return a.size===t&&a.clear(),o}),a=i.cache;return i}return v3=n,v3}var y3,pve;function csn(){if(pve)return y3;pve=1;var e=lsn(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(t,function(o,s,l,u){a.push(l?u.replace(n,"$1"):s||o)}),a});return y3=r,y3}var b3,gve;function pK(){if(gve)return b3;gve=1;function e(t,n){for(var r=-1,i=t==null?0:t.length,a=Array(i);++r<i;)a[r]=n(t[r],r,t);return a}return b3=e,b3}var x3,vve;function usn(){if(vve)return x3;vve=1;var e=g_(),t=pK(),n=ns(),r=J0(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function o(s){if(typeof s=="string")return s;if(n(s))return t(s,o)+"";if(r(s))return a?a.call(s):"";var l=s+"";return l=="0"&&1/s==-1/0?"-0":l}return x3=o,x3}var k3,yve;function QBe(){if(yve)return k3;yve=1;var e=usn();function t(n){return n==null?"":e(n)}return k3=t,k3}var S3,bve;function JBe(){if(bve)return S3;bve=1;var e=ns(),t=uK(),n=csn(),r=QBe();function i(a,o){return e(a)?a:t(a,o)?[a]:n(r(a))}return S3=i,S3}var w3,xve;function GR(){if(xve)return w3;xve=1;var e=J0();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return w3=t,w3}var _3,kve;function gK(){if(kve)return _3;kve=1;var e=JBe(),t=GR();function n(r,i){i=e(i,r);for(var a=0,o=i.length;r!=null&&a<o;)r=r[t(i[a++])];return a&&a==o?r:void 0}return _3=n,_3}var N3,Sve;function e4e(){if(Sve)return N3;Sve=1;var e=gK();function t(n,r,i){var a=n==null?void 0:e(n,r);return a===void 0?i:a}return N3=t,N3}var dsn=e4e();const yl=gr(dsn);var C3,wve;function fsn(){if(wve)return C3;wve=1;function e(t){return t==null}return C3=e,C3}var msn=fsn();const wr=gr(msn);var E3,_ve;function hsn(){if(_ve)return E3;_ve=1;var e=af(),t=ns(),n=of(),r="[object String]";function i(a){return typeof a=="string"||!t(a)&&n(a)&&e(a)==r}return E3=i,E3}var psn=hsn();const qp=gr(psn);var gsn=dK();const Gn=gr(gsn);var vsn=Xm();const eb=gr(vsn);var j3={exports:{}},Nr={};/**
756
+ `,a),On.from("\r",a)];e:for(let s=0;s<o.length;s++){const l=o[s].length;for(let u=0;u<l;u++)if(o[s][u]!==r[i+u])continue e;return this.options.record_delimiter.push(o[s]),this.state.recordDelimiterMaxLength=o[s].length,o[s].length}return 0},__error:function(r){const{encoding:i,raw:a,skip_records_with_error:o}=this.options,s=typeof r=="string"?new Error(r):r;if(o){if(this.state.recordHasError=!0,this.options.on_skip!==void 0)try{this.options.on_skip(s,a?this.state.rawBuffer.toString(i):void 0)}catch(l){return l}return}else return s},__infoDataSet:function(){return{...this.info,columns:this.options.columns}},__infoRecord:function(){const{columns:r,raw:i,encoding:a}=this.options;return{...this.__infoDataSet(),error:this.state.error,header:r===!0,index:this.state.record.length,raw:i?this.state.rawBuffer.toString(a):void 0}},__infoField:function(){const{columns:r}=this.options,i=Array.isArray(r);return{...this.__infoRecord(),column:i===!0?r.length>this.state.record.length?r[this.state.record.length].name:null:this.state.record.length,quoting:this.state.wasQuoting}}}};class Don extends bon.Transform{constructor(t={}){super({readableObjectMode:!0,...t,encoding:null}),this.api=Oon({on_skip:(n,r)=>{this.emit("skip",n,r)},...t}),this.state=this.api.state,this.options=this.api.options,this.info=this.api.info}_transform(t,n,r){if(this.state.stop===!0)return;const i=this.api.parse(t,!1,a=>{this.push(a)},()=>{this.push(null),this.end(),this.on("end",this.destroy)});i!==void 0&&(this.state.stop=!0),r(i)}_flush(t){if(this.state.stop===!0)return;const n=this.api.parse(void 0,!0,r=>{this.push(r)},()=>{this.push(null),this.on("end",this.destroy)});t(n)}}const Ton=function(){let e,t,n;for(const i in arguments){const a=arguments[i],o=typeof a;if(e===void 0&&(typeof a=="string"||On.isBuffer(a)))e=a;else if(t===void 0&&GBe(a))t=a;else if(n===void 0&&o==="function")n=a;else throw new kr("CSV_INVALID_ARGUMENT",["Invalid argument:",`got ${JSON.stringify(a)} at index ${i}`],t||{})}const r=new Don(t);if(n){const i=t===void 0||t.objname===void 0?[]:{};r.on("readable",function(){let a;for(;(a=this.read())!==null;)t===void 0||t.objname===void 0?i.push(a):i[a[0]]=a[1]}),r.on("error",function(a){n(a,void 0,r.api.__infoDataSet())}),r.on("end",function(){n(void 0,i,r.api.__infoDataSet())})}if(e!==void 0){const i=function(){r.write(e),r.end()};typeof setImmediate=="function"?setImmediate(i):setTimeout(i,0)}return r},Pon=({form:e})=>{const[t,n]=x.useState(!1),r=x.useCallback(async i=>{const a=i.target.files?.[0];if(a){const o=Aon(a);let s=[];try{s=await Fon(a)}catch(l){console.error("Error parsing file:",l),je.error("Error",{description:"Error parsing file",duration:4e3,closeButton:!0})}s.length===0?je.error("Error",{description:"No records found in file",duration:4e3,closeButton:!0}):(e.setValue("issueMonth",o),e.setValue("generateDocumentsInfo",s),je.success("Success",{description:"CSV draft uploaded successfully",duration:4e3,closeButton:!0})),n(!1)}},[e]);return c.jsxs(I0,{children:[c.jsx($0,{children:c.jsxs(Ui,{open:t,onOpenChange:n,children:[c.jsx(_o,{asChild:!0,children:c.jsx(Te,{variant:"outline",className:"p-2",children:c.jsx(xpt,{size:20})})}),c.jsxs(Hi,{className:"w-[400px] max-w-screen-md",children:[c.jsx(Ua,{children:c.jsx(Ha,{children:"Upload documents generation draft"})}),c.jsx(Vn,{id:"documentsGenerationCsvDraft",type:"file",accept:".csv",onChange:r})]})]})}),c.jsx(L0,{children:c.jsx("p",{children:"Upload CSV draft"})})]})};function Aon(e){const n=e.name.match(/_(\d{4}_\d{2})/);if(n)return`${n[1].replace(/_/g,"-")}-15`}async function Fon(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=i=>{const a=i.target?.result;if(!a)return n(new Error("No content found in file"));const o=a.toString(),s=Ton(o,{columns:!1,skip_empty_lines:!0,trim:!0}),l=[];s.on("readable",()=>{let u;for(;(u=s.read())!==null;)if(!(!u||u[0]==="tid"))try{const d=Mon(u);l.push(d)}catch(d){n(d)}}),s.on("error",n),s.on("end",()=>{t(l)})},r.readAsText(e)})}const Ron=eo.object({amount:eo.object({raw:eo.number(),currency:eo.nativeEnum(ct)}).strict(),businessId:eo.string().uuid()}).strict();function Mon(e){if(e.length!==4)throw new Error("Invalid record length");const t=Ron.safeParse({amount:{raw:parseFloat(e[2]),currency:e[3]},businessId:e[0]});if(!t.success)throw new Error(`Invalid record: ${JSON.stringify(t.error.format())}`);return t.data}const Ion=({businessesData:e})=>{const{setFiltersContext:t}=x.useContext(Fr),n=bn({defaultValues:{generateDocumentsInfo:[],issueMonth:st(cje(new Date,1),"yyyy-MM-dd")}}),{issueDocuments:r}=Yan(),{fields:i,append:a,remove:o}=sg({control:n.control,name:"generateDocumentsInfo"}),s=n.watch("generateDocumentsInfo"),l=x.useMemo(()=>i.map((f,m)=>({...f,...s[m]})),[i,s]),u=x.useCallback(f=>{r(f)},[r]),d=x.useMemo(()=>e.filter(f=>!l.some(m=>m.businessId===f.originalBusiness.id)).sort((f,m)=>f.originalBusiness.name.localeCompare(m.originalBusiness.name)),[e,l]);return x.useEffect(()=>{t(c.jsxs("div",{className:"flex flex-row gap-x-5",children:[c.jsx(Xan,{form:n,businessesData:e}),c.jsx(Pon,{form:n})]}))},[n,e,t]),c.jsx("div",{className:"p-2",children:c.jsx(Xn,{...n,children:c.jsxs("form",{onSubmit:n.handleSubmit(u),children:[c.jsxs("div",{className:"flex gap-2 items-center mb-4",children:[c.jsx(Fa,{children:"Issue Month:"}),c.jsx(gt,{control:n.control,name:"issueMonth",render:({field:f,fieldState:m})=>c.jsxs(vt,{children:[c.jsx(Ct,{children:c.jsx(gu,{...f,value:f.value?new Date(f.value):new Date,onChange:p=>{const g=new Date(p.getFullYear(),p.getMonth(),15);n.setValue("issueMonth",st(g,"yyyy-MM-dd"))},error:m.error?.message,popoverProps:{withinPortal:!0}})}),c.jsx(Rt,{})]})})]}),c.jsxs($s,{children:[c.jsx(Ls,{children:c.jsxs(In,{children:[c.jsx(Rn,{children:"Name"}),c.jsx(Rn,{children:"Document"}),c.jsx(Rn,{children:"Amount"}),c.jsx(Rn,{children:"Currency"}),c.jsx(Rn,{children:"Remark"}),c.jsx(Rn,{children:"Recipients"}),c.jsx(Rn,{children:"Green Invoice ID"}),c.jsx(Rn,{children:"Local ID"}),c.jsx(Rn,{})]})}),c.jsx(Bs,{children:l.map((f,m)=>{const p=e.find(g=>g.originalBusiness.id===f.businessId);return p?c.jsxs(In,{children:[c.jsx(ot,{children:p.originalBusiness.name}),c.jsx(ot,{children:p.generatedDocumentType}),c.jsx(ot,{children:c.jsx(gt,{control:n.control,name:`generateDocumentsInfo.${m}.amount.raw`,render:({field:g})=>c.jsxs(vt,{children:[c.jsx(Id,{onValueChange:g.onChange,value:g.value??void 0,hideControls:!0,decimalScale:2}),c.jsx(Rt,{})]})})}),c.jsx(ot,{children:c.jsx(gt,{control:n.control,name:`generateDocumentsInfo.${m}.amount.currency`,render:({field:g})=>c.jsxs(vt,{children:[c.jsxs(Ad,{onValueChange:g.onChange,defaultValue:g.value,children:[c.jsx(Ct,{children:c.jsx(Rd,{children:c.jsx(Fd,{placeholder:"Select a recipient"})})}),c.jsx(Md,{children:Object.entries(ct).map(([v,b])=>c.jsx(iu,{value:b,children:v},v))})]}),c.jsx(Rt,{})]})})}),c.jsx(ot,{children:c.jsx("span",{className:"text-sm text-gray-500 whitespace-normal max-w-50",children:p.remark})}),c.jsx(ot,{children:c.jsx("div",{className:"flex flex-col",children:p.emails.map(g=>c.jsx("span",{className:"text-sm text-gray-500",children:g},g))})}),c.jsx(ot,{children:c.jsx("span",{className:"text-sm text-gray-500 whitespace-normal max-w-50",children:p.greenInvoiceId})}),c.jsx(ot,{children:c.jsx("span",{className:"text-sm text-gray-500 whitespace-normal max-w-50",children:f.id})}),c.jsx(ot,{children:c.jsx(Te,{variant:"secondary",onClick:()=>o(m),children:c.jsx(rg,{size:16})})})]},f.id):null})})]}),c.jsxs("div",{className:"flex justify-between items-center mt-4",children:[c.jsx(Kan,{greenInvoiceBusinesses:d,onAdd:a}),c.jsx(Tl,{onConfirm:n.handleSubmit(u),title:`Are you sure you want to issue ${l.length} documents?`,children:c.jsx(Te,{children:"Issue"})})]})]})})})},$on=()=>{const{setFiltersContext:e}=x.useContext(Fr),[{data:t,fetching:n}]=Dt({query:out});return x.useEffect(()=>{t||e(null)},[t,e]),n?c.jsx(No,{}):c.jsx(Ion,{businessesData:t?.greenInvoiceBusinesses??[]})};var j4,Nge;function ns(){if(Nge)return j4;Nge=1;var e=Array.isArray;return j4=e,j4}var O4,Cge;function KBe(){if(Cge)return O4;Cge=1;var e=typeof Ho=="object"&&Ho&&Ho.Object===Object&&Ho;return O4=e,O4}var D4,Ege;function Fu(){if(Ege)return D4;Ege=1;var e=KBe(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return D4=n,D4}var T4,jge;function g_(){if(jge)return T4;jge=1;var e=Fu(),t=e.Symbol;return T4=t,T4}var P4,Oge;function Lon(){if(Oge)return P4;Oge=1;var e=g_(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,i=e?e.toStringTag:void 0;function a(o){var s=n.call(o,i),l=o[i];try{o[i]=void 0;var u=!0}catch{}var d=r.call(o);return u&&(s?o[i]=l:delete o[i]),d}return P4=a,P4}var A4,Dge;function Bon(){if(Dge)return A4;Dge=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return A4=n,A4}var F4,Tge;function af(){if(Tge)return F4;Tge=1;var e=g_(),t=Lon(),n=Bon(),r="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function o(s){return s==null?s===void 0?i:r:a&&a in Object(s)?t(s):n(s)}return F4=o,F4}var R4,Pge;function of(){if(Pge)return R4;Pge=1;function e(t){return t!=null&&typeof t=="object"}return R4=e,R4}var M4,Age;function J0(){if(Age)return M4;Age=1;var e=af(),t=of(),n="[object Symbol]";function r(i){return typeof i=="symbol"||t(i)&&e(i)==n}return M4=r,M4}var I4,Fge;function uK(){if(Fge)return I4;Fge=1;var e=ns(),t=J0(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(a,o){if(e(a))return!1;var s=typeof a;return s=="number"||s=="symbol"||s=="boolean"||a==null||t(a)?!0:r.test(a)||!n.test(a)||o!=null&&a in Object(o)}return I4=i,I4}var $4,Rge;function Xm(){if(Rge)return $4;Rge=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return $4=e,$4}var L4,Mge;function dK(){if(Mge)return L4;Mge=1;var e=af(),t=Xm(),n="[object AsyncFunction]",r="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function o(s){if(!t(s))return!1;var l=e(s);return l==r||l==i||l==n||l==a}return L4=o,L4}var B4,Ige;function zon(){if(Ige)return B4;Ige=1;var e=Fu(),t=e["__core-js_shared__"];return B4=t,B4}var z4,$ge;function Von(){if($ge)return z4;$ge=1;var e=zon(),t=function(){var r=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}();function n(r){return!!t&&t in r}return z4=n,z4}var V4,Lge;function XBe(){if(Lge)return V4;Lge=1;var e=Function.prototype,t=e.toString;function n(r){if(r!=null){try{return t.call(r)}catch{}try{return r+""}catch{}}return""}return V4=n,V4}var U4,Bge;function Uon(){if(Bge)return U4;Bge=1;var e=dK(),t=Von(),n=Xm(),r=XBe(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,s=Object.prototype,l=o.toString,u=s.hasOwnProperty,d=RegExp("^"+l.call(u).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function f(m){if(!n(m)||t(m))return!1;var p=e(m)?d:a;return p.test(r(m))}return U4=f,U4}var H4,zge;function Hon(){if(zge)return H4;zge=1;function e(t,n){return t?.[n]}return H4=e,H4}var q4,Vge;function xg(){if(Vge)return q4;Vge=1;var e=Uon(),t=Hon();function n(r,i){var a=t(r,i);return e(a)?a:void 0}return q4=n,q4}var W4,Uge;function UR(){if(Uge)return W4;Uge=1;var e=xg(),t=e(Object,"create");return W4=t,W4}var G4,Hge;function qon(){if(Hge)return G4;Hge=1;var e=UR();function t(){this.__data__=e?e(null):{},this.size=0}return G4=t,G4}var Y4,qge;function Won(){if(qge)return Y4;qge=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return Y4=e,Y4}var K4,Wge;function Gon(){if(Wge)return K4;Wge=1;var e=UR(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function i(a){var o=this.__data__;if(e){var s=o[a];return s===t?void 0:s}return r.call(o,a)?o[a]:void 0}return K4=i,K4}var X4,Gge;function Yon(){if(Gge)return X4;Gge=1;var e=UR(),t=Object.prototype,n=t.hasOwnProperty;function r(i){var a=this.__data__;return e?a[i]!==void 0:n.call(a,i)}return X4=r,X4}var Z4,Yge;function Kon(){if(Yge)return Z4;Yge=1;var e=UR(),t="__lodash_hash_undefined__";function n(r,i){var a=this.__data__;return this.size+=this.has(r)?0:1,a[r]=e&&i===void 0?t:i,this}return Z4=n,Z4}var Q4,Kge;function Xon(){if(Kge)return Q4;Kge=1;var e=qon(),t=Won(),n=Gon(),r=Yon(),i=Kon();function a(o){var s=-1,l=o==null?0:o.length;for(this.clear();++s<l;){var u=o[s];this.set(u[0],u[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,Q4=a,Q4}var J4,Xge;function Zon(){if(Xge)return J4;Xge=1;function e(){this.__data__=[],this.size=0}return J4=e,J4}var e3,Zge;function fK(){if(Zge)return e3;Zge=1;function e(t,n){return t===n||t!==t&&n!==n}return e3=e,e3}var t3,Qge;function HR(){if(Qge)return t3;Qge=1;var e=fK();function t(n,r){for(var i=n.length;i--;)if(e(n[i][0],r))return i;return-1}return t3=t,t3}var n3,Jge;function Qon(){if(Jge)return n3;Jge=1;var e=HR(),t=Array.prototype,n=t.splice;function r(i){var a=this.__data__,o=e(a,i);if(o<0)return!1;var s=a.length-1;return o==s?a.pop():n.call(a,o,1),--this.size,!0}return n3=r,n3}var r3,eve;function Jon(){if(eve)return r3;eve=1;var e=HR();function t(n){var r=this.__data__,i=e(r,n);return i<0?void 0:r[i][1]}return r3=t,r3}var i3,tve;function esn(){if(tve)return i3;tve=1;var e=HR();function t(n){return e(this.__data__,n)>-1}return i3=t,i3}var a3,nve;function tsn(){if(nve)return a3;nve=1;var e=HR();function t(n,r){var i=this.__data__,a=e(i,n);return a<0?(++this.size,i.push([n,r])):i[a][1]=r,this}return a3=t,a3}var o3,rve;function qR(){if(rve)return o3;rve=1;var e=Zon(),t=Qon(),n=Jon(),r=esn(),i=tsn();function a(o){var s=-1,l=o==null?0:o.length;for(this.clear();++s<l;){var u=o[s];this.set(u[0],u[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,o3=a,o3}var s3,ive;function mK(){if(ive)return s3;ive=1;var e=xg(),t=Fu(),n=e(t,"Map");return s3=n,s3}var l3,ave;function nsn(){if(ave)return l3;ave=1;var e=Xon(),t=qR(),n=mK();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return l3=r,l3}var c3,ove;function rsn(){if(ove)return c3;ove=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return c3=e,c3}var u3,sve;function WR(){if(sve)return u3;sve=1;var e=rsn();function t(n,r){var i=n.__data__;return e(r)?i[typeof r=="string"?"string":"hash"]:i.map}return u3=t,u3}var d3,lve;function isn(){if(lve)return d3;lve=1;var e=WR();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return d3=t,d3}var f3,cve;function asn(){if(cve)return f3;cve=1;var e=WR();function t(n){return e(this,n).get(n)}return f3=t,f3}var m3,uve;function osn(){if(uve)return m3;uve=1;var e=WR();function t(n){return e(this,n).has(n)}return m3=t,m3}var h3,dve;function ssn(){if(dve)return h3;dve=1;var e=WR();function t(n,r){var i=e(this,n),a=i.size;return i.set(n,r),this.size+=i.size==a?0:1,this}return h3=t,h3}var p3,fve;function hK(){if(fve)return p3;fve=1;var e=nsn(),t=isn(),n=asn(),r=osn(),i=ssn();function a(o){var s=-1,l=o==null?0:o.length;for(this.clear();++s<l;){var u=o[s];this.set(u[0],u[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,p3=a,p3}var g3,mve;function ZBe(){if(mve)return g3;mve=1;var e=hK(),t="Expected a function";function n(r,i){if(typeof r!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var a=function(){var o=arguments,s=i?i.apply(this,o):o[0],l=a.cache;if(l.has(s))return l.get(s);var u=r.apply(this,o);return a.cache=l.set(s,u)||l,u};return a.cache=new(n.Cache||e),a}return n.Cache=e,g3=n,g3}var v3,hve;function lsn(){if(hve)return v3;hve=1;var e=ZBe(),t=500;function n(r){var i=e(r,function(o){return a.size===t&&a.clear(),o}),a=i.cache;return i}return v3=n,v3}var y3,pve;function csn(){if(pve)return y3;pve=1;var e=lsn(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(t,function(o,s,l,u){a.push(l?u.replace(n,"$1"):s||o)}),a});return y3=r,y3}var b3,gve;function pK(){if(gve)return b3;gve=1;function e(t,n){for(var r=-1,i=t==null?0:t.length,a=Array(i);++r<i;)a[r]=n(t[r],r,t);return a}return b3=e,b3}var x3,vve;function usn(){if(vve)return x3;vve=1;var e=g_(),t=pK(),n=ns(),r=J0(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function o(s){if(typeof s=="string")return s;if(n(s))return t(s,o)+"";if(r(s))return a?a.call(s):"";var l=s+"";return l=="0"&&1/s==-1/0?"-0":l}return x3=o,x3}var k3,yve;function QBe(){if(yve)return k3;yve=1;var e=usn();function t(n){return n==null?"":e(n)}return k3=t,k3}var S3,bve;function JBe(){if(bve)return S3;bve=1;var e=ns(),t=uK(),n=csn(),r=QBe();function i(a,o){return e(a)?a:t(a,o)?[a]:n(r(a))}return S3=i,S3}var w3,xve;function GR(){if(xve)return w3;xve=1;var e=J0();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return w3=t,w3}var _3,kve;function gK(){if(kve)return _3;kve=1;var e=JBe(),t=GR();function n(r,i){i=e(i,r);for(var a=0,o=i.length;r!=null&&a<o;)r=r[t(i[a++])];return a&&a==o?r:void 0}return _3=n,_3}var N3,Sve;function e4e(){if(Sve)return N3;Sve=1;var e=gK();function t(n,r,i){var a=n==null?void 0:e(n,r);return a===void 0?i:a}return N3=t,N3}var dsn=e4e();const yl=gr(dsn);var C3,wve;function fsn(){if(wve)return C3;wve=1;function e(t){return t==null}return C3=e,C3}var msn=fsn();const wr=gr(msn);var E3,_ve;function hsn(){if(_ve)return E3;_ve=1;var e=af(),t=ns(),n=of(),r="[object String]";function i(a){return typeof a=="string"||!t(a)&&n(a)&&e(a)==r}return E3=i,E3}var psn=hsn();const qp=gr(psn);var gsn=dK();const Gn=gr(gsn);var vsn=Xm();const eb=gr(vsn);var j3={exports:{}},Nr={};/**
757
757
  * @license React
758
758
  * react-is.production.min.js
759
759
  *
package/dist/index.html CHANGED
@@ -5,7 +5,7 @@
5
5
  <link rel="icon" href="/icons/accounter-logo.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>Accounter</title>
8
- <script type="module" crossorigin src="/assets/index-7S3jmeKS.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-SprkaQoW.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-eRknOFHx.css">
10
10
  </head>
11
11
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@accounter/client",
3
- "version": "0.0.6-alpha-20250714141056-adf384acdbad7fd97cbecd581a698dc01ea5554d",
3
+ "version": "0.0.6-alpha-20250714141136-0f27f8e8c943ccb2e0d85fe54dd84652fb8f84c2",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -45,7 +45,7 @@
45
45
  "class-variance-authority": "0.7.1",
46
46
  "clsx": "2.1.1",
47
47
  "cmdk": "1.1.1",
48
- "csv-parse": "5.6.0",
48
+ "csv-parse": "6.0.0",
49
49
  "date-fns": "4.1.0",
50
50
  "dayjs": "1.11.13",
51
51
  "decimal.js": "10.6.0",