nfets 0.0.135 → 0.0.137

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.
@@ -55,7 +55,15 @@ declare class ValidationError extends NFeTsError {
55
55
 
56
56
  declare const ValidateErrorsMetadata = "__ValidateErrors__";
57
57
  declare const mapConstraintsToErrors: (errors: ValidationError$1[], parent?: string) => string[];
58
- declare const Validates: <T extends object>(klass: new () => T) => (_target: object, property: string | symbol, descriptor: TypedPropertyDescriptor<(payload: T, ...args: any[]) => any>) => void;
58
+ interface ValidatesOptions {
59
+ each?: boolean;
60
+ }
61
+ type ValidatesPayload<T, O extends ValidatesOptions> = O extends {
62
+ each: true;
63
+ } ? T[] : T;
64
+ declare const Validates: <T extends object, const O extends ValidatesOptions = {
65
+ each: false;
66
+ }>(klass: new () => T, options?: O) => (_target: object, property: string | symbol, descriptor: TypedPropertyDescriptor<(payload: ValidatesPayload<T, O>, ...args: any[]) => any>) => void;
59
67
 
60
68
  declare const SkipValidationMetadata = "__SkipValidation__";
61
69
  declare const SkipValidation: () => MethodDecorator;
@@ -356,4 +364,4 @@ declare const search: <T>(target: string, { onFound, onNotFound, }: {
356
364
 
357
365
  declare const unreachable: (_: never) => never;
358
366
 
359
- export { ASN1, BuilderOptions, CacheAdapter, CanonicalizeOptions, CertificateRepository, Choice, type ChoiceOptions, Client, ColorValue, Decimal, DecimalValue, DocumentOptions, Either, ExtractReturnType, HttpClient, ImageOptions, IsDecimal, Left, MemoryCacheAdapter, NFeTsError, NativeCertificateRepository, NullCacheAdapter, Once, ParserOptions, PdfBuilder, PdfkitPdfBuilder, ReadCertificateRequest, ReadCertificateResponse, RemoteTransmissionRepository, Right, RowBuilderFunction, RowOptions, RuleValue, SendTransmissionPayload, SignatureAlgorithm, SignerRepository, SkipAllValidations, SkipValidation, SkipValidationMetadata, SoapRemoteTransmissionRepository, StateCodeAcValidator, StateCodeAlValidator, StateCodeAmValidator, StateCodeApValidator, StateCodeBaValidator, StateCodeCeValidator, StateCodeDfValidator, StateCodeEsValidator, StateCodeGoValidator, StateCodeMaValidator, StateCodeMgValidator, StateCodeMsValidator, StateCodeMtValidator, StateCodePaValidator, StateCodePbValidator, StateCodePeValidator, StateCodePiValidator, StateCodePrValidator, StateCodeRjValidator, StateCodeRnValidator, StateCodeRoValidator, StateCodeRrValidator, StateCodeRsValidator, StateCodeScValidator, StateCodeSeValidator, StateCodeSpValidator, StateCodeToValidator, type StrategyPattern, TableOptionsWithData, TextOptions, TransformDateString, TransformDecimal, type TransformDecimalArgs, type TransformToDateStringArgs, TransmissionError, TransmissionHostNotFoundError, TransmissionTimeoutError, TupleOfLength, ValidateErrorsMetadata, Validates, ValidationError, Xml2JsToolkit, XmlToolkit, clearEmptyValues, fixUtf8Mojibake, leftFromError, leftFromTransmissionError, mapConstraintsToErrors, mapTransmissionError, normalizeTransmissionStrings, plainToInstance, search, _default as timezones, unreachable };
367
+ export { ASN1, BuilderOptions, CacheAdapter, CanonicalizeOptions, CertificateRepository, Choice, type ChoiceOptions, Client, ColorValue, Decimal, DecimalValue, DocumentOptions, Either, ExtractReturnType, HttpClient, ImageOptions, IsDecimal, Left, MemoryCacheAdapter, NFeTsError, NativeCertificateRepository, NullCacheAdapter, Once, ParserOptions, PdfBuilder, PdfkitPdfBuilder, ReadCertificateRequest, ReadCertificateResponse, RemoteTransmissionRepository, Right, RowBuilderFunction, RowOptions, RuleValue, SendTransmissionPayload, SignatureAlgorithm, SignerRepository, SkipAllValidations, SkipValidation, SkipValidationMetadata, SoapRemoteTransmissionRepository, StateCodeAcValidator, StateCodeAlValidator, StateCodeAmValidator, StateCodeApValidator, StateCodeBaValidator, StateCodeCeValidator, StateCodeDfValidator, StateCodeEsValidator, StateCodeGoValidator, StateCodeMaValidator, StateCodeMgValidator, StateCodeMsValidator, StateCodeMtValidator, StateCodePaValidator, StateCodePbValidator, StateCodePeValidator, StateCodePiValidator, StateCodePrValidator, StateCodeRjValidator, StateCodeRnValidator, StateCodeRoValidator, StateCodeRrValidator, StateCodeRsValidator, StateCodeScValidator, StateCodeSeValidator, StateCodeSpValidator, StateCodeToValidator, type StrategyPattern, TableOptionsWithData, TextOptions, TransformDateString, TransformDecimal, type TransformDecimalArgs, type TransformToDateStringArgs, TransmissionError, TransmissionHostNotFoundError, TransmissionTimeoutError, TupleOfLength, ValidateErrorsMetadata, Validates, type ValidatesOptions, ValidationError, Xml2JsToolkit, XmlToolkit, clearEmptyValues, fixUtf8Mojibake, leftFromError, leftFromTransmissionError, mapConstraintsToErrors, mapTransmissionError, normalizeTransmissionStrings, plainToInstance, search, _default as timezones, unreachable };
@@ -55,7 +55,15 @@ declare class ValidationError extends NFeTsError {
55
55
 
56
56
  declare const ValidateErrorsMetadata = "__ValidateErrors__";
57
57
  declare const mapConstraintsToErrors: (errors: ValidationError$1[], parent?: string) => string[];
58
- declare const Validates: <T extends object>(klass: new () => T) => (_target: object, property: string | symbol, descriptor: TypedPropertyDescriptor<(payload: T, ...args: any[]) => any>) => void;
58
+ interface ValidatesOptions {
59
+ each?: boolean;
60
+ }
61
+ type ValidatesPayload<T, O extends ValidatesOptions> = O extends {
62
+ each: true;
63
+ } ? T[] : T;
64
+ declare const Validates: <T extends object, const O extends ValidatesOptions = {
65
+ each: false;
66
+ }>(klass: new () => T, options?: O) => (_target: object, property: string | symbol, descriptor: TypedPropertyDescriptor<(payload: ValidatesPayload<T, O>, ...args: any[]) => any>) => void;
59
67
 
60
68
  declare const SkipValidationMetadata = "__SkipValidation__";
61
69
  declare const SkipValidation: () => MethodDecorator;
@@ -356,4 +364,4 @@ declare const search: <T>(target: string, { onFound, onNotFound, }: {
356
364
 
357
365
  declare const unreachable: (_: never) => never;
358
366
 
359
- export { ASN1, BuilderOptions, CacheAdapter, CanonicalizeOptions, CertificateRepository, Choice, type ChoiceOptions, Client, ColorValue, Decimal, DecimalValue, DocumentOptions, Either, ExtractReturnType, HttpClient, ImageOptions, IsDecimal, Left, MemoryCacheAdapter, NFeTsError, NativeCertificateRepository, NullCacheAdapter, Once, ParserOptions, PdfBuilder, PdfkitPdfBuilder, ReadCertificateRequest, ReadCertificateResponse, RemoteTransmissionRepository, Right, RowBuilderFunction, RowOptions, RuleValue, SendTransmissionPayload, SignatureAlgorithm, SignerRepository, SkipAllValidations, SkipValidation, SkipValidationMetadata, SoapRemoteTransmissionRepository, StateCodeAcValidator, StateCodeAlValidator, StateCodeAmValidator, StateCodeApValidator, StateCodeBaValidator, StateCodeCeValidator, StateCodeDfValidator, StateCodeEsValidator, StateCodeGoValidator, StateCodeMaValidator, StateCodeMgValidator, StateCodeMsValidator, StateCodeMtValidator, StateCodePaValidator, StateCodePbValidator, StateCodePeValidator, StateCodePiValidator, StateCodePrValidator, StateCodeRjValidator, StateCodeRnValidator, StateCodeRoValidator, StateCodeRrValidator, StateCodeRsValidator, StateCodeScValidator, StateCodeSeValidator, StateCodeSpValidator, StateCodeToValidator, type StrategyPattern, TableOptionsWithData, TextOptions, TransformDateString, TransformDecimal, type TransformDecimalArgs, type TransformToDateStringArgs, TransmissionError, TransmissionHostNotFoundError, TransmissionTimeoutError, TupleOfLength, ValidateErrorsMetadata, Validates, ValidationError, Xml2JsToolkit, XmlToolkit, clearEmptyValues, fixUtf8Mojibake, leftFromError, leftFromTransmissionError, mapConstraintsToErrors, mapTransmissionError, normalizeTransmissionStrings, plainToInstance, search, _default as timezones, unreachable };
367
+ export { ASN1, BuilderOptions, CacheAdapter, CanonicalizeOptions, CertificateRepository, Choice, type ChoiceOptions, Client, ColorValue, Decimal, DecimalValue, DocumentOptions, Either, ExtractReturnType, HttpClient, ImageOptions, IsDecimal, Left, MemoryCacheAdapter, NFeTsError, NativeCertificateRepository, NullCacheAdapter, Once, ParserOptions, PdfBuilder, PdfkitPdfBuilder, ReadCertificateRequest, ReadCertificateResponse, RemoteTransmissionRepository, Right, RowBuilderFunction, RowOptions, RuleValue, SendTransmissionPayload, SignatureAlgorithm, SignerRepository, SkipAllValidations, SkipValidation, SkipValidationMetadata, SoapRemoteTransmissionRepository, StateCodeAcValidator, StateCodeAlValidator, StateCodeAmValidator, StateCodeApValidator, StateCodeBaValidator, StateCodeCeValidator, StateCodeDfValidator, StateCodeEsValidator, StateCodeGoValidator, StateCodeMaValidator, StateCodeMgValidator, StateCodeMsValidator, StateCodeMtValidator, StateCodePaValidator, StateCodePbValidator, StateCodePeValidator, StateCodePiValidator, StateCodePrValidator, StateCodeRjValidator, StateCodeRnValidator, StateCodeRoValidator, StateCodeRrValidator, StateCodeRsValidator, StateCodeScValidator, StateCodeSeValidator, StateCodeSpValidator, StateCodeToValidator, type StrategyPattern, TableOptionsWithData, TextOptions, TransformDateString, TransformDecimal, type TransformDecimalArgs, type TransformToDateStringArgs, TransmissionError, TransmissionHostNotFoundError, TransmissionTimeoutError, TupleOfLength, ValidateErrorsMetadata, Validates, type ValidatesOptions, ValidationError, Xml2JsToolkit, XmlToolkit, clearEmptyValues, fixUtf8Mojibake, leftFromError, leftFromTransmissionError, mapConstraintsToErrors, mapTransmissionError, normalizeTransmissionStrings, plainToInstance, search, _default as timezones, unreachable };
@@ -79,9 +79,9 @@ Actual: `+O.attribValue);else{var ke=O.tag,R=O.tags[O.tags.length-1]||O;ke.ns===
79
79
  `&&p!==" "&&p!=="\r")return f;f++,s()}return-1}u(i,"skipBlanks");function a(){return r.substring(t)}u(a,"substringFromIndex");function o(f){return r.substring(t,t+f.length)===f}u(o,"substringStartsWith");function l(f){return r.substring(t,t+f.length).toUpperCase()===f.toUpperCase()}u(l,"substringStartsWithCaseInsensitive");function c(f){var p=bt.reg("^",f),d=p.exec(a());return d?(s(d[0].length),d[0]):null}return u(c,"getMatch"),{char:n,getIndex:u(function(){return t},"getIndex"),getMatch:c,getSource:u(function(){return r},"getSource"),skip:s,skipBlanks:i,substringFromIndex:a,substringStartsWith:o,substringStartsWithCaseInsensitive:l}}u(tV,"parseUtils");function DZ(r,e){function t(o,l){var c=bt.PI.exec(o.substringFromIndex());return c?c[1].toLowerCase()==="xml"?l.fatalError("xml declaration is only allowed at the start of the document, but found at position "+o.getIndex()):(o.skip(c[0].length),c[0]):l.fatalError("processing instruction is not well-formed at position "+o.getIndex())}u(t,"parsePI");var n=r.getSource();if(r.char()==="["){r.skip(1);for(var s=r.getIndex();r.getIndex()<n.length;){if(r.skipBlanks(),r.char()==="]"){var i=n.substring(s,r.getIndex());return r.skip(1),i}var a=null;if(r.char()==="<"&&r.char(1)==="!")switch(r.char(2)){case"E":r.char(3)==="L"?a=r.getMatch(bt.elementdecl):r.char(3)==="N"&&(a=r.getMatch(bt.EntityDecl));break;case"A":a=r.getMatch(bt.AttlistDecl);break;case"N":a=r.getMatch(bt.NotationDecl);break;case"-":a=r.getMatch(bt.Comment);break}else if(r.char()==="<"&&r.char(1)==="?")a=t(r,e);else if(r.char()==="%")a=r.getMatch(bt.PEReference);else return e.fatalError("Error detected in Markup declaration");if(!a)return e.fatalError("Error in internal subset at position "+r.getIndex())}return e.fatalError("doctype internal subset is not well-formed, missing ]")}}u(DZ,"parseDoctypeInternalSubset");function rV(r,e,t,n,s){var i=tV(r,e);switch(s?i.char(2).toUpperCase():i.char(2)){case"-":var a=i.getMatch(bt.Comment);return a?(t.comment(a,bt.COMMENT_START.length,a.length-bt.COMMENT_START.length-bt.COMMENT_END.length),i.getIndex()):n.fatalError("comment is not well-formed at position "+i.getIndex());case"[":var o=i.getMatch(bt.CDSect);return o?!s&&!t.currentElement?n.fatalError("CDATA outside of element"):(t.startCDATA(),t.characters(o,bt.CDATA_START.length,o.length-bt.CDATA_START.length-bt.CDATA_END.length),t.endCDATA(),i.getIndex()):n.fatalError("Invalid CDATA starting at position "+e);case"D":{if(t.doc&&t.doc.documentElement)return n.fatalError("Doctype not allowed inside or after documentElement at position "+i.getIndex());if(s?!i.substringStartsWithCaseInsensitive(bt.DOCTYPE_DECL_START):!i.substringStartsWith(bt.DOCTYPE_DECL_START))return n.fatalError("Expected "+bt.DOCTYPE_DECL_START+" at position "+i.getIndex());if(i.skip(bt.DOCTYPE_DECL_START.length),i.skipBlanks()<1)return n.fatalError("Expected whitespace after "+bt.DOCTYPE_DECL_START+" at position "+i.getIndex());var l={name:void 0,publicId:void 0,systemId:void 0,internalSubset:void 0};if(l.name=i.getMatch(bt.Name),!l.name)return n.fatalError("doctype name missing or contains unexpected characters at position "+i.getIndex());if(s&&l.name.toLowerCase()!=="html"&&n.warning("Unexpected DOCTYPE in HTML document at position "+i.getIndex()),i.skipBlanks(),i.substringStartsWith(bt.PUBLIC)||i.substringStartsWith(bt.SYSTEM)){var c=bt.ExternalID_match.exec(i.substringFromIndex());if(!c)return n.fatalError("doctype external id is not well-formed at position "+i.getIndex());c.groups.SystemLiteralOnly!==void 0?l.systemId=c.groups.SystemLiteralOnly:(l.systemId=c.groups.SystemLiteral,l.publicId=c.groups.PubidLiteral),i.skip(c[0].length)}else if(s&&i.substringStartsWithCaseInsensitive(bt.SYSTEM)){if(i.skip(bt.SYSTEM.length),i.skipBlanks()<1)return n.fatalError("Expected whitespace after "+bt.SYSTEM+" at position "+i.getIndex());if(l.systemId=i.getMatch(bt.ABOUT_LEGACY_COMPAT_SystemLiteral),!l.systemId)return n.fatalError("Expected "+bt.ABOUT_LEGACY_COMPAT+" in single or double quotes after "+bt.SYSTEM+" at position "+i.getIndex())}return s&&l.systemId&&!bt.ABOUT_LEGACY_COMPAT_SystemLiteral.test(l.systemId)&&n.warning("Unexpected doctype.systemId in HTML document at position "+i.getIndex()),s||(i.skipBlanks(),l.internalSubset=DZ(i,n)),i.skipBlanks(),i.char()!==">"?n.fatalError("doctype not terminated with > at position "+i.getIndex()):(i.skip(1),t.startDTD(l.name,l.publicId,l.systemId,l.internalSubset),t.endDTD(),i.getIndex())}default:return n.fatalError('Not well-formed XML starting with "<!" at position '+e)}}u(rV,"parseDoctypeCommentOrCData");function BZ(r,e,t,n){var s=r.substring(e).match(bt.PI);if(!s)return n.fatalError("Invalid processing instruction starting at position "+e);if(s[1].toLowerCase()==="xml"){if(e>0)return n.fatalError("processing instruction at position "+e+" is an xml declaration which is only at the start of the document");if(!bt.XMLDecl.test(r.substring(e)))return n.fatalError("xml declaration is not well-formed")}return t.processingInstruction(s[1],s[2]),e+s[0].length}u(BZ,"parseProcessingInstruction");function nV(){this.attributeNames=Object.create(null)}u(nV,"ElementAttributes");nV.prototype={setTagName:u(function(r){if(!bt.QName_exact.test(r))throw new Error("invalid tagName:"+r);this.tagName=r},"setTagName"),addValue:u(function(r,e,t){if(!bt.QName_exact.test(r))throw new Error("invalid attribute:"+r);this.attributeNames[r]=this.length,this[this.length++]={qName:r,value:e,offset:t}},"addValue"),length:0,getLocalName:u(function(r){return this[r].localName},"getLocalName"),getLocator:u(function(r){return this[r].locator},"getLocator"),getQName:u(function(r){return this[r].qName},"getQName"),getURI:u(function(r){return this[r].uri},"getURI"),getValue:u(function(r){return this[r].value},"getValue")};aA.XMLReader=ZL;aA.parseUtils=tV;aA.parseDoctypeCommentOrCData=rV});var fV=le(zd=>{"use strict";var ff=lf(),RZ=SI(),OZ=vy(),iV=GL(),_Z=sV(),PZ=RZ.DOMImplementation,kZ=ff.hasDefaultHTMLNamespace,LZ=ff.isHTMLMimeType,VZ=ff.isValidMimeType,uV=ff.MIME_TYPE,CI=ff.NAMESPACE,aV=OZ.ParseError,FZ=_Z.XMLReader;function lV(r){return r.replace(/\r[\n\u0085]/g,`
80
80
  `).replace(/[\r\u0085\u2028\u2029]/g,`
81
81
  `)}u(lV,"normalizeLineEndings");function cV(r){if(r=r||{},r.locator===void 0&&(r.locator=!0),this.assign=r.assign||ff.assign,this.domHandler=r.domHandler||uA,this.onError=r.onError||r.errorHandler,r.errorHandler&&typeof r.errorHandler!="function")throw new TypeError("errorHandler object is no longer supported, switch to onError!");r.errorHandler&&r.errorHandler("warning","The `errorHandler` option has been deprecated, use `onError` instead!",this),this.normalizeLineEndings=r.normalizeLineEndings||lV,this.locator=!!r.locator,this.xmlns=this.assign(Object.create(null),r.xmlns)}u(cV,"DOMParser");cV.prototype.parseFromString=function(r,e){if(!VZ(e))throw new TypeError('DOMParser.parseFromString: the provided mimeType "'+e+'" is not valid.');var t=this.assign(Object.create(null),this.xmlns),n=iV.XML_ENTITIES,s=t[""]||null;kZ(e)?(n=iV.HTML_ENTITIES,s=CI.HTML):e===uV.XML_SVG_IMAGE&&(s=CI.SVG),t[""]=s,t.xml=t.xml||CI.XML;var i=new this.domHandler({mimeType:e,defaultNamespace:s,onError:this.onError}),a=this.locator?{}:void 0;this.locator&&i.setDocumentLocator(a);var o=new FZ;o.errorHandler=i,o.domBuilder=i;var l=!ff.isHTMLMimeType(e);return l&&typeof r!="string"&&o.errorHandler.fatalError("source is not a string"),o.parse(this.normalizeLineEndings(String(r)),t,n),i.doc.documentElement||o.errorHandler.fatalError("missing root element"),i.doc};function uA(r){var e=r||{};this.mimeType=e.mimeType||uV.XML_APPLICATION,this.defaultNamespace=e.defaultNamespace||null,this.cdata=!1,this.currentElement=void 0,this.doc=void 0,this.locator=void 0,this.onError=e.onError}u(uA,"DOMHandler");function Wd(r,e){e.lineNumber=r.lineNumber,e.columnNumber=r.columnNumber}u(Wd,"position");uA.prototype={startDocument:u(function(){var r=new PZ;this.doc=LZ(this.mimeType)?r.createHTMLDocument(!1):r.createDocument(this.defaultNamespace,"")},"startDocument"),startElement:u(function(r,e,t,n){var s=this.doc,i=s.createElementNS(r,t||e),a=n.length;oA(this,i),this.currentElement=i,this.locator&&Wd(this.locator,i);for(var o=0;o<a;o++){var r=n.getURI(o),l=n.getValue(o),t=n.getQName(o),c=s.createAttributeNS(r,t);this.locator&&Wd(n.getLocator(o),c),c.value=c.nodeValue=l,i.setAttributeNode(c)}},"startElement"),endElement:u(function(r,e,t){this.currentElement=this.currentElement.parentNode},"endElement"),startPrefixMapping:u(function(r,e){},"startPrefixMapping"),endPrefixMapping:u(function(r){},"endPrefixMapping"),processingInstruction:u(function(r,e){var t=this.doc.createProcessingInstruction(r,e);this.locator&&Wd(this.locator,t),oA(this,t)},"processingInstruction"),ignorableWhitespace:u(function(r,e,t){},"ignorableWhitespace"),characters:u(function(r,e,t){if(r=oV.apply(this,arguments),r){if(this.cdata)var n=this.doc.createCDATASection(r);else var n=this.doc.createTextNode(r);this.currentElement?this.currentElement.appendChild(n):/^\s*$/.test(r)&&this.doc.appendChild(n),this.locator&&Wd(this.locator,n)}},"characters"),skippedEntity:u(function(r){},"skippedEntity"),endDocument:u(function(){this.doc.normalize()},"endDocument"),setDocumentLocator:u(function(r){r&&(r.lineNumber=0),this.locator=r},"setDocumentLocator"),comment:u(function(r,e,t){r=oV.apply(this,arguments);var n=this.doc.createComment(r);this.locator&&Wd(this.locator,n),oA(this,n)},"comment"),startCDATA:u(function(){this.cdata=!0},"startCDATA"),endCDATA:u(function(){this.cdata=!1},"endCDATA"),startDTD:u(function(r,e,t,n){var s=this.doc.implementation;if(s&&s.createDocumentType){var i=s.createDocumentType(r,e,t,n);this.locator&&Wd(this.locator,i),oA(this,i),this.doc.doctype=i}},"startDTD"),reportError:u(function(r,e){if(typeof this.onError=="function")try{this.onError(r,e,this)}catch(t){throw new aV("Reporting "+r+' "'+e+'" caused '+t,this.locator)}else console.error("[xmldom "+r+"] "+e,UZ(this.locator))},"reportError"),warning:u(function(r){this.reportError("warning",r)},"warning"),error:u(function(r){this.reportError("error",r)},"error"),fatalError:u(function(r){throw this.reportError("fatalError",r),new aV(r,this.locator)},"fatalError")};function UZ(r){if(r)return`
82
- @#[line:`+r.lineNumber+",col:"+r.columnNumber+"]"}u(UZ,"_locator");function oV(r,e,t){return typeof r=="string"?r.substr(e,t):r.length>=e+t||e?new java.lang.String(r,e,t)+"":r}u(oV,"_toString");"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(r){uA.prototype[r]=function(){return null}});function oA(r,e){r.currentElement?r.currentElement.appendChild(e):r.doc.appendChild(e)}u(oA,"appendElement");function MZ(r){if(r==="error")throw"onErrorStopParsing"}u(MZ,"onErrorStopParsing");function jZ(){throw"onWarningStopParsing"}u(jZ,"onWarningStopParsing");zd.__DOMHandler=uA;zd.DOMParser=cV;zd.normalizeLineEndings=lV;zd.onErrorStopParsing=MZ;zd.onWarningStopParsing=jZ});var hV=le(Xt=>{"use strict";var Jd=lf();Xt.assign=Jd.assign;Xt.hasDefaultHTMLNamespace=Jd.hasDefaultHTMLNamespace;Xt.isHTMLMimeType=Jd.isHTMLMimeType;Xt.isValidMimeType=Jd.isValidMimeType;Xt.MIME_TYPE=Jd.MIME_TYPE;Xt.NAMESPACE=Jd.NAMESPACE;var lA=vy();Xt.DOMException=lA.DOMException;Xt.DOMExceptionName=lA.DOMExceptionName;Xt.ExceptionCode=lA.ExceptionCode;Xt.ParseError=lA.ParseError;var en=SI();Xt.Attr=en.Attr;Xt.CDATASection=en.CDATASection;Xt.CharacterData=en.CharacterData;Xt.Comment=en.Comment;Xt.Document=en.Document;Xt.DocumentFragment=en.DocumentFragment;Xt.DocumentType=en.DocumentType;Xt.DOMImplementation=en.DOMImplementation;Xt.Element=en.Element;Xt.Entity=en.Entity;Xt.EntityReference=en.EntityReference;Xt.LiveNodeList=en.LiveNodeList;Xt.NamedNodeMap=en.NamedNodeMap;Xt.Node=en.Node;Xt.NodeList=en.NodeList;Xt.Notation=en.Notation;Xt.ProcessingInstruction=en.ProcessingInstruction;Xt.Text=en.Text;Xt.XMLSerializer=en.XMLSerializer;var cA=fV();Xt.DOMParser=cA.DOMParser;Xt.normalizeLineEndings=cA.normalizeLineEndings;Xt.onErrorStopParsing=cA.onErrorStopParsing;Xt.onWarningStopParsing=cA.onWarningStopParsing});var hA="http://www.w3.org/2000/09/xmldsig#",II="http://www.w3.org/TR/2001/REC-xml-c14n-20010315",pA=(function(r){return r.RSA_SHA1="http://www.w3.org/2000/09/xmldsig#rsa-sha1",r.RSA_SHA256="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256",r})({}),no=(function(r){return r.SHA1="sha1",r.SHA256="sha256",r})({}),dA=(function(r){return r.SHA1="http://www.w3.org/2000/09/xmldsig#sha1",r.SHA256="http://www.w3.org/2001/04/xmlenc#sha256",r})({});var nr={AC:"12",AL:"27",AM:"13",AP:"16",BA:"29",CE:"23",DF:"53",ES:"32",GO:"52",MA:"21",MG:"31",MS:"50",MT:"51",PA:"15",PB:"25",PE:"26",PI:"22",PR:"41",RJ:"33",RN:"24",RO:"11",RR:"14",RS:"43",SC:"42",SE:"28",SP:"35",TO:"17"},zZ=Object.keys(nr);var YZ={Production:"1",Homolog:"2"};var t6={[nr.AC]:"America/Rio_Branco",[nr.AL]:"America/Maceio",[nr.AM]:"America/Manaus",[nr.AP]:"America/Belem",[nr.BA]:"America/Bahia",[nr.CE]:"America/Fortaleza",[nr.DF]:"America/Sao_Paulo",[nr.ES]:"America/Sao_Paulo",[nr.GO]:"America/Sao_Paulo",[nr.MA]:"America/Fortaleza",[nr.MG]:"America/Sao_Paulo",[nr.MS]:"America/Campo_Grande",[nr.MT]:"America/Cuiaba",[nr.PA]:"America/Belem",[nr.PB]:"America/Fortaleza",[nr.PE]:"America/Recife",[nr.PI]:"America/Fortaleza",[nr.PR]:"America/Sao_Paulo",[nr.RJ]:"America/Sao_Paulo",[nr.RN]:"America/Fortaleza",[nr.RO]:"America/Porto_Velho",[nr.RR]:"America/Boa_Vista",[nr.RS]:"America/Sao_Paulo",[nr.SC]:"America/Sao_Paulo",[nr.SE]:"America/Maceio",[nr.SP]:"America/Sao_Paulo",[nr.TO]:"America/Araguaina"};var Mt=class extends Error{static{u(this,"NFeTsError")}};var _y=class extends Mt{static{u(this,"TransmissionError")}},Yu=class extends _y{static{u(this,"TransmissionHostNotFoundError")}},Qu=class extends _y{static{u(this,"TransmissionTimeoutError")}};var DI=class extends Mt{static{u(this,"ValidationError")}};var Zd={includeComments:!1,exclusive:!0};var mA=u(r=>{throw new Mt("Didn't expect to get here")},"unreachable");var pf=class{static{u(this,"Signer")}toolkit;certificateRepository;algorithm;canonical;constructor(e,t,n=no.SHA1,s=Zd){this.toolkit=e,this.certificateRepository=t,this.algorithm=n,this.canonical=s}assemble(e,t,n){let s=this.certificateRepository.getStringCertificate(n);return{$:{xmlns:hA},SignedInfo:e,SignatureValue:t,KeyInfo:{X509Data:{X509Certificate:s}}}}signedInfo(e,t){return{CanonicalizationMethod:{$:{Algorithm:II}},SignatureMethod:{$:{Algorithm:this.signatureMethod}},Reference:{$:{URI:`#${this.toolkit.getAttribute(e,t)}`},Transforms:this.transforms,DigestMethod:{$:{Algorithm:this.digestAlgorithm}},DigestValue:this.digest(e)}}}digest(e){return this.toolkit.digest(e,this.algorithm,this.canonical)}async signOrLeft(e,t){let n=this.toolkit.canonicalize(await this.toolkit.build({$:{xmlns:hA},...e},{rootName:"SignedInfo"}),this.canonical);return this.certificateRepository.sign(n,t,this.algorithm)}get transforms(){return{Transform:[{$:{Algorithm:"http://www.w3.org/2000/09/xmldsig#enveloped-signature"}},{$:{Algorithm:"http://www.w3.org/TR/2001/REC-xml-c14n-20010315"}}]}}get digestAlgorithm(){switch(this.algorithm){case no.SHA256:return dA.SHA256;case no.SHA1:return dA.SHA1;default:return mA(this.algorithm)}}get signatureMethod(){switch(this.algorithm){case no.SHA256:return pA.RSA_SHA256;case no.SHA1:return pA.RSA_SHA1;default:return mA(this.algorithm)}}};var gA=class{static{u(this,"Left")}value;constructor(e){this.value=e}isLeft(){return!0}isRight(){return!1}},Py=class{static{u(this,"Right")}value;constructor(e){this.value=e}isLeft(){return!1}isRight(){return!0}},zt=u(r=>new gA(r),"left"),Gr=u(r=>r===void 0?new Py(void 0):new Py(r),"right");var BI=class extends pf{static{u(this,"EntitySigner")}async sign(e,t,n){let{tag:s,mark:i}=t,{certificate:a}=n;if(!e[s])return zt(new Mt(`Node ${String(s)} not found`));let o=await this.toolkit.build(this.ns(e,s),{headless:!0,rootName:String(s),renderOpts:{pretty:!1}}),l=this.signedInfo(o,i),c=await this.signOrLeft(l,n);if(c.isLeft())return c;let f=e;return f.Signature=this.assemble(l,c.value,a),Gr(f)}ns(e,t){let n=e.$?.xmlns,{$:s,...i}=e[t],{xmlns:a,...o}=s??{};return{$:{xmlns:n,...o},...i}}};var RI=class extends pf{static{u(this,"XmlSigner")}async sign(e,t,n){let{tag:s,mark:i}=t,{certificate:a}=n,o=this.toolkit.getNode(e,s);if(!o)return zt(new Mt(`Node ${s} not found`));let l=this.signedInfo(o,i),c=await this.signOrLeft(l,n);if(c.isLeft())return c;let f=await this.toolkit.build(this.assemble(l,c.value,a),{rootName:"Signature"});return Gr(this.toolkit.appendNode(e,f))}};import"reflect-metadata";import{validateSync as n6}from"class-validator";import"reflect-metadata";var e0="__SkipValidation__",Gee=u(()=>(r,e)=>{Reflect.defineMetadata(e0,!0,r,e.toString())},"SkipValidation"),Wee=u(()=>r=>{Reflect.defineMetadata(e0,!0,r)},"SkipAllValidations");import{plainToInstance as r6}from"class-transformer";var ky=u(r=>{for(let[e,t]of Object.entries(r))typeof t>"u"&&delete r[e],t===""&&delete r[e],t&&typeof t=="object"&&ky(t)},"clearEmptyValues"),OI=u((r,e,t={})=>{let n=r6(e,r);return t.clearEmptyValues&&ky(n),n},"plainToInstance");var _I="__ValidateErrors__",PI=u((r,e)=>r.reduce((t,n)=>{if(n.children?.length)return t.concat(PI(n.children,e?`${e}.${n.property}`:n.property));let s=Object.values(n.constraints??{}).map(i=>e?`${e}.${i}`:i).join(", ");return s?t.concat(s):t},[]),"mapConstraintsToErrors"),ste=u(r=>(e,t,n)=>{let s=n.value;s!=null&&(n.value=function(...i){let a=Reflect.getMetadata(e0,this.constructor);if(Reflect.getMetadata(e0,this.constructor.prototype,t.toString())===!0||a===!0)return s.apply(this,i);let[l,...c]=i;if(!l)return s.apply(this,i);let f=OI(l,r),p=n6(f,{whitelist:!0});if(ky(f),p.length){let d=Reflect.getMetadata(_I,this)??[];Reflect.defineMetadata(_I,d.concat(PI(p,s.name)),this)}return s.apply(this,[f,...c])})},"Validates");import"reflect-metadata";var df=9e15,oo=1e9,yA="0123456789abcdef",Fy="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Uy="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",vA={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-df,maxE:df,crypto:!1},FI,ia,gt=!0,jy="[DecimalError] ",ao=jy+"Invalid argument: ",UI=jy+"Precision limit exceeded",MI=jy+"crypto unavailable",jI="[object Decimal]",In=Math.floor,Wr=Math.pow,s6=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,i6=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,a6=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,qI=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Ys=1e7,lt=7,o6=9007199254740991,u6=Fy.length-1,EA=Uy.length-1,Ce={toStringTag:jI};Ce.absoluteValue=Ce.abs=function(){var r=new this.constructor(this);return r.s<0&&(r.s=1),rt(r)};Ce.ceil=function(){return rt(new this.constructor(this),this.e+1,2)};Ce.clampedTo=Ce.clamp=function(r,e){var t,n=this,s=n.constructor;if(r=new s(r),e=new s(e),!r.s||!e.s)return new s(NaN);if(r.gt(e))throw Error(ao+e);return t=n.cmp(r),t<0?r:n.cmp(e)>0?e:new s(n)};Ce.comparedTo=Ce.cmp=function(r){var e,t,n,s,i=this,a=i.d,o=(r=new i.constructor(r)).d,l=i.s,c=r.s;if(!a||!o)return!l||!c?NaN:l!==c?l:a===o?0:!a^l<0?1:-1;if(!a[0]||!o[0])return a[0]?l:o[0]?-c:0;if(l!==c)return l;if(i.e!==r.e)return i.e>r.e^l<0?1:-1;for(n=a.length,s=o.length,e=0,t=n<s?n:s;e<t;++e)if(a[e]!==o[e])return a[e]>o[e]^l<0?1:-1;return n===s?0:n>s^l<0?1:-1};Ce.cosine=Ce.cos=function(){var r,e,t=this,n=t.constructor;return t.d?t.d[0]?(r=n.precision,e=n.rounding,n.precision=r+Math.max(t.e,t.sd())+lt,n.rounding=1,t=l6(n,GI(n,t)),n.precision=r,n.rounding=e,rt(ia==2||ia==3?t.neg():t,r,e,!0)):new n(1):new n(NaN)};Ce.cubeRoot=Ce.cbrt=function(){var r,e,t,n,s,i,a,o,l,c,f=this,p=f.constructor;if(!f.isFinite()||f.isZero())return new p(f);for(gt=!1,i=f.s*Wr(f.s*f,1/3),!i||Math.abs(i)==1/0?(t=gn(f.d),r=f.e,(i=(r-t.length+1)%3)&&(t+=i==1||i==-2?"0":"00"),i=Wr(t,1/3),r=In((r+1)/3)-(r%3==(r<0?-1:2)),i==1/0?t="5e"+r:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+r),n=new p(t),n.s=f.s):n=new p(i.toString()),a=(r=p.precision)+3;;)if(o=n,l=o.times(o).times(o),c=l.plus(f),n=cr(c.plus(f).times(o),c.plus(l),a+2,1),gn(o.d).slice(0,a)===(t=gn(n.d)).slice(0,a))if(t=t.slice(a-3,a+1),t=="9999"||!s&&t=="4999"){if(!s&&(rt(o,r+1,0),o.times(o).times(o).eq(f))){n=o;break}a+=4,s=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(rt(n,r+1,1),e=!n.times(n).times(n).eq(f));break}return gt=!0,rt(n,r,p.rounding,e)};Ce.decimalPlaces=Ce.dp=function(){var r,e=this.d,t=NaN;if(e){if(r=e.length-1,t=(r-In(this.e/lt))*lt,r=e[r],r)for(;r%10==0;r/=10)t--;t<0&&(t=0)}return t};Ce.dividedBy=Ce.div=function(r){return cr(this,new this.constructor(r))};Ce.dividedToIntegerBy=Ce.divToInt=function(r){var e=this,t=e.constructor;return rt(cr(e,new t(r),0,1,1),t.precision,t.rounding)};Ce.equals=Ce.eq=function(r){return this.cmp(r)===0};Ce.floor=function(){return rt(new this.constructor(this),this.e+1,3)};Ce.greaterThan=Ce.gt=function(r){return this.cmp(r)>0};Ce.greaterThanOrEqualTo=Ce.gte=function(r){var e=this.cmp(r);return e==1||e===0};Ce.hyperbolicCosine=Ce.cosh=function(){var r,e,t,n,s,i=this,a=i.constructor,o=new a(1);if(!i.isFinite())return new a(i.s?1/0:NaN);if(i.isZero())return o;t=a.precision,n=a.rounding,a.precision=t+Math.max(i.e,i.sd())+4,a.rounding=1,s=i.d.length,s<32?(r=Math.ceil(s/3),e=(1/Hy(4,r)).toString()):(r=16,e="2.3283064365386962890625e-10"),i=mf(a,1,i.times(e),new a(1),!0);for(var l,c=r,f=new a(8);c--;)l=i.times(i),i=o.minus(l.times(f.minus(l.times(f))));return rt(i,a.precision=t,a.rounding=n,!0)};Ce.hyperbolicSine=Ce.sinh=function(){var r,e,t,n,s=this,i=s.constructor;if(!s.isFinite()||s.isZero())return new i(s);if(e=i.precision,t=i.rounding,i.precision=e+Math.max(s.e,s.sd())+4,i.rounding=1,n=s.d.length,n<3)s=mf(i,2,s,s,!0);else{r=1.4*Math.sqrt(n),r=r>16?16:r|0,s=s.times(1/Hy(5,r)),s=mf(i,2,s,s,!0);for(var a,o=new i(5),l=new i(16),c=new i(20);r--;)a=s.times(s),s=s.times(o.plus(a.times(l.times(a).plus(c))))}return i.precision=e,i.rounding=t,rt(s,e,t,!0)};Ce.hyperbolicTangent=Ce.tanh=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+7,n.rounding=1,cr(t.sinh(),t.cosh(),n.precision=r,n.rounding=e)):new n(t.s)};Ce.inverseCosine=Ce.acos=function(){var r=this,e=r.constructor,t=r.abs().cmp(1),n=e.precision,s=e.rounding;return t!==-1?t===0?r.isNeg()?yi(e,n,s):new e(0):new e(NaN):r.isZero()?yi(e,n+4,s).times(.5):(e.precision=n+6,e.rounding=1,r=new e(1).minus(r).div(r.plus(1)).sqrt().atan(),e.precision=n,e.rounding=s,r.times(2))};Ce.inverseHyperbolicCosine=Ce.acosh=function(){var r,e,t=this,n=t.constructor;return t.lte(1)?new n(t.eq(1)?0:NaN):t.isFinite()?(r=n.precision,e=n.rounding,n.precision=r+Math.max(Math.abs(t.e),t.sd())+4,n.rounding=1,gt=!1,t=t.times(t).minus(1).sqrt().plus(t),gt=!0,n.precision=r,n.rounding=e,t.ln()):new n(t)};Ce.inverseHyperbolicSine=Ce.asinh=function(){var r,e,t=this,n=t.constructor;return!t.isFinite()||t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+2*Math.max(Math.abs(t.e),t.sd())+6,n.rounding=1,gt=!1,t=t.times(t).plus(1).sqrt().plus(t),gt=!0,n.precision=r,n.rounding=e,t.ln())};Ce.inverseHyperbolicTangent=Ce.atanh=function(){var r,e,t,n,s=this,i=s.constructor;return s.isFinite()?s.e>=0?new i(s.abs().eq(1)?s.s/0:s.isZero()?s:NaN):(r=i.precision,e=i.rounding,n=s.sd(),Math.max(n,r)<2*-s.e-1?rt(new i(s),r,e,!0):(i.precision=t=n-s.e,s=cr(s.plus(1),new i(1).minus(s),t+r,1),i.precision=r+4,i.rounding=1,s=s.ln(),i.precision=r,i.rounding=e,s.times(.5))):new i(NaN)};Ce.inverseSine=Ce.asin=function(){var r,e,t,n,s=this,i=s.constructor;return s.isZero()?new i(s):(e=s.abs().cmp(1),t=i.precision,n=i.rounding,e!==-1?e===0?(r=yi(i,t+4,n).times(.5),r.s=s.s,r):new i(NaN):(i.precision=t+6,i.rounding=1,s=s.div(new i(1).minus(s.times(s)).sqrt().plus(1)).atan(),i.precision=t,i.rounding=n,s.times(2)))};Ce.inverseTangent=Ce.atan=function(){var r,e,t,n,s,i,a,o,l,c=this,f=c.constructor,p=f.precision,d=f.rounding;if(c.isFinite()){if(c.isZero())return new f(c);if(c.abs().eq(1)&&p+4<=EA)return a=yi(f,p+4,d).times(.25),a.s=c.s,a}else{if(!c.s)return new f(NaN);if(p+4<=EA)return a=yi(f,p+4,d).times(.5),a.s=c.s,a}for(f.precision=o=p+10,f.rounding=1,t=Math.min(28,o/lt+2|0),r=t;r;--r)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(gt=!1,e=Math.ceil(o/lt),n=1,l=c.times(c),a=new f(c),s=c;r!==-1;)if(s=s.times(l),i=a.minus(s.div(n+=2)),s=s.times(l),a=i.plus(s.div(n+=2)),a.d[e]!==void 0)for(r=e;a.d[r]===i.d[r]&&r--;);return t&&(a=a.times(2<<t-1)),gt=!0,rt(a,f.precision=p,f.rounding=d,!0)};Ce.isFinite=function(){return!!this.d};Ce.isInteger=Ce.isInt=function(){return!!this.d&&In(this.e/lt)>this.d.length-2};Ce.isNaN=function(){return!this.s};Ce.isNegative=Ce.isNeg=function(){return this.s<0};Ce.isPositive=Ce.isPos=function(){return this.s>0};Ce.isZero=function(){return!!this.d&&this.d[0]===0};Ce.lessThan=Ce.lt=function(r){return this.cmp(r)<0};Ce.lessThanOrEqualTo=Ce.lte=function(r){return this.cmp(r)<1};Ce.logarithm=Ce.log=function(r){var e,t,n,s,i,a,o,l,c=this,f=c.constructor,p=f.precision,d=f.rounding,m=5;if(r==null)r=new f(10),e=!0;else{if(r=new f(r),t=r.d,r.s<0||!t||!t[0]||r.eq(1))return new f(NaN);e=r.eq(10)}if(t=c.d,c.s<0||!t||!t[0]||c.eq(1))return new f(t&&!t[0]?-1/0:c.s!=1?NaN:t?0:1/0);if(e)if(t.length>1)i=!0;else{for(s=t[0];s%10===0;)s/=10;i=s!==1}if(gt=!1,o=p+m,a=io(c,o),n=e?My(f,o+10):io(r,o),l=cr(a,n,o,1),t0(l.d,s=p,d))do if(o+=10,a=io(c,o),n=e?My(f,o+10):io(r,o),l=cr(a,n,o,1),!i){+gn(l.d).slice(s+1,s+15)+1==1e14&&(l=rt(l,p+1,0));break}while(t0(l.d,s+=10,d));return gt=!0,rt(l,p,d)};Ce.minus=Ce.sub=function(r){var e,t,n,s,i,a,o,l,c,f,p,d,m=this,g=m.constructor;if(r=new g(r),!m.d||!r.d)return!m.s||!r.s?r=new g(NaN):m.d?r.s=-r.s:r=new g(r.d||m.s!==r.s?m:NaN),r;if(m.s!=r.s)return r.s=-r.s,m.plus(r);if(c=m.d,d=r.d,o=g.precision,l=g.rounding,!c[0]||!d[0]){if(d[0])r.s=-r.s;else if(c[0])r=new g(m);else return new g(l===3?-0:0);return gt?rt(r,o,l):r}if(t=In(r.e/lt),f=In(m.e/lt),c=c.slice(),i=f-t,i){for(p=i<0,p?(e=c,i=-i,a=d.length):(e=d,t=f,a=c.length),n=Math.max(Math.ceil(o/lt),a)+2,i>n&&(i=n,e.length=1),e.reverse(),n=i;n--;)e.push(0);e.reverse()}else{for(n=c.length,a=d.length,p=n<a,p&&(a=n),n=0;n<a;n++)if(c[n]!=d[n]){p=c[n]<d[n];break}i=0}for(p&&(e=c,c=d,d=e,r.s=-r.s),a=c.length,n=d.length-a;n>0;--n)c[a++]=0;for(n=d.length;n>i;){if(c[--n]<d[n]){for(s=n;s&&c[--s]===0;)c[s]=Ys-1;--c[s],c[n]+=Ys}c[n]-=d[n]}for(;c[--a]===0;)c.pop();for(;c[0]===0;c.shift())--t;return c[0]?(r.d=c,r.e=qy(c,t),gt?rt(r,o,l):r):new g(l===3?-0:0)};Ce.modulo=Ce.mod=function(r){var e,t=this,n=t.constructor;return r=new n(r),!t.d||!r.s||r.d&&!r.d[0]?new n(NaN):!r.d||t.d&&!t.d[0]?rt(new n(t),n.precision,n.rounding):(gt=!1,n.modulo==9?(e=cr(t,r.abs(),0,3,1),e.s*=r.s):e=cr(t,r,0,n.modulo,1),e=e.times(r),gt=!0,t.minus(e))};Ce.naturalExponential=Ce.exp=function(){return wA(this)};Ce.naturalLogarithm=Ce.ln=function(){return io(this)};Ce.negated=Ce.neg=function(){var r=new this.constructor(this);return r.s=-r.s,rt(r)};Ce.plus=Ce.add=function(r){var e,t,n,s,i,a,o,l,c,f,p=this,d=p.constructor;if(r=new d(r),!p.d||!r.d)return!p.s||!r.s?r=new d(NaN):p.d||(r=new d(r.d||p.s===r.s?p:NaN)),r;if(p.s!=r.s)return r.s=-r.s,p.minus(r);if(c=p.d,f=r.d,o=d.precision,l=d.rounding,!c[0]||!f[0])return f[0]||(r=new d(p)),gt?rt(r,o,l):r;if(i=In(p.e/lt),n=In(r.e/lt),c=c.slice(),s=i-n,s){for(s<0?(t=c,s=-s,a=f.length):(t=f,n=i,a=c.length),i=Math.ceil(o/lt),a=i>a?i+1:a+1,s>a&&(s=a,t.length=1),t.reverse();s--;)t.push(0);t.reverse()}for(a=c.length,s=f.length,a-s<0&&(s=a,t=f,f=c,c=t),e=0;s;)e=(c[--s]=c[s]+f[s]+e)/Ys|0,c[s]%=Ys;for(e&&(c.unshift(e),++n),a=c.length;c[--a]==0;)c.pop();return r.d=c,r.e=qy(c,n),gt?rt(r,o,l):r};Ce.precision=Ce.sd=function(r){var e,t=this;if(r!==void 0&&r!==!!r&&r!==1&&r!==0)throw Error(ao+r);return t.d?(e=HI(t.d),r&&t.e+1>e&&(e=t.e+1)):e=NaN,e};Ce.round=function(){var r=this,e=r.constructor;return rt(new e(r),r.e+1,e.rounding)};Ce.sine=Ce.sin=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+Math.max(t.e,t.sd())+lt,n.rounding=1,t=f6(n,GI(n,t)),n.precision=r,n.rounding=e,rt(ia>2?t.neg():t,r,e,!0)):new n(NaN)};Ce.squareRoot=Ce.sqrt=function(){var r,e,t,n,s,i,a=this,o=a.d,l=a.e,c=a.s,f=a.constructor;if(c!==1||!o||!o[0])return new f(!c||c<0&&(!o||o[0])?NaN:o?a:1/0);for(gt=!1,c=Math.sqrt(+a),c==0||c==1/0?(e=gn(o),(e.length+l)%2==0&&(e+="0"),c=Math.sqrt(e),l=In((l+1)/2)-(l<0||l%2),c==1/0?e="5e"+l:(e=c.toExponential(),e=e.slice(0,e.indexOf("e")+1)+l),n=new f(e)):n=new f(c.toString()),t=(l=f.precision)+3;;)if(i=n,n=i.plus(cr(a,i,t+2,1)).times(.5),gn(i.d).slice(0,t)===(e=gn(n.d)).slice(0,t))if(e=e.slice(t-3,t+1),e=="9999"||!s&&e=="4999"){if(!s&&(rt(i,l+1,0),i.times(i).eq(a))){n=i;break}t+=4,s=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(rt(n,l+1,1),r=!n.times(n).eq(a));break}return gt=!0,rt(n,l,f.rounding,r)};Ce.tangent=Ce.tan=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+10,n.rounding=1,t=t.sin(),t.s=1,t=cr(t,new n(1).minus(t.times(t)).sqrt(),r+10,0),n.precision=r,n.rounding=e,rt(ia==2||ia==4?t.neg():t,r,e,!0)):new n(NaN)};Ce.times=Ce.mul=function(r){var e,t,n,s,i,a,o,l,c,f=this,p=f.constructor,d=f.d,m=(r=new p(r)).d;if(r.s*=f.s,!d||!d[0]||!m||!m[0])return new p(!r.s||d&&!d[0]&&!m||m&&!m[0]&&!d?NaN:!d||!m?r.s/0:r.s*0);for(t=In(f.e/lt)+In(r.e/lt),l=d.length,c=m.length,l<c&&(i=d,d=m,m=i,a=l,l=c,c=a),i=[],a=l+c,n=a;n--;)i.push(0);for(n=c;--n>=0;){for(e=0,s=l+n;s>n;)o=i[s]+m[n]*d[s-n-1]+e,i[s--]=o%Ys|0,e=o/Ys|0;i[s]=(i[s]+e)%Ys|0}for(;!i[--a];)i.pop();return e?++t:i.shift(),r.d=i,r.e=qy(i,t),gt?rt(r,p.precision,p.rounding):r};Ce.toBinary=function(r,e){return SA(this,2,r,e)};Ce.toDecimalPlaces=Ce.toDP=function(r,e){var t=this,n=t.constructor;return t=new n(t),r===void 0?t:($n(r,0,oo),e===void 0?e=n.rounding:$n(e,0,8),rt(t,r+t.e+1,e))};Ce.toExponential=function(r,e){var t,n=this,s=n.constructor;return r===void 0?t=vi(n,!0):($n(r,0,oo),e===void 0?e=s.rounding:$n(e,0,8),n=rt(new s(n),r+1,e),t=vi(n,!0,r+1)),n.isNeg()&&!n.isZero()?"-"+t:t};Ce.toFixed=function(r,e){var t,n,s=this,i=s.constructor;return r===void 0?t=vi(s):($n(r,0,oo),e===void 0?e=i.rounding:$n(e,0,8),n=rt(new i(s),r+s.e+1,e),t=vi(n,!1,r+n.e+1)),s.isNeg()&&!s.isZero()?"-"+t:t};Ce.toFraction=function(r){var e,t,n,s,i,a,o,l,c,f,p,d,m=this,g=m.d,S=m.constructor;if(!g)return new S(m);if(c=t=new S(1),n=l=new S(0),e=new S(n),i=e.e=HI(g)-m.e-1,a=i%lt,e.d[0]=Wr(10,a<0?lt+a:a),r==null)r=i>0?e:c;else{if(o=new S(r),!o.isInt()||o.lt(c))throw Error(ao+o);r=o.gt(e)?i>0?e:c:o}for(gt=!1,o=new S(gn(g)),f=S.precision,S.precision=i=g.length*lt*2;p=cr(o,e,0,1,1),s=t.plus(p.times(n)),s.cmp(r)!=1;)t=n,n=s,s=c,c=l.plus(p.times(s)),l=s,s=e,e=o.minus(p.times(s)),o=s;return s=cr(r.minus(t),n,0,1,1),l=l.plus(s.times(c)),t=t.plus(s.times(n)),l.s=c.s=m.s,d=cr(c,n,i,1).minus(m).abs().cmp(cr(l,t,i,1).minus(m).abs())<1?[c,n]:[l,t],S.precision=f,gt=!0,d};Ce.toHexadecimal=Ce.toHex=function(r,e){return SA(this,16,r,e)};Ce.toNearest=function(r,e){var t=this,n=t.constructor;if(t=new n(t),r==null){if(!t.d)return t;r=new n(1),e=n.rounding}else{if(r=new n(r),e===void 0?e=n.rounding:$n(e,0,8),!t.d)return r.s?t:r;if(!r.d)return r.s&&(r.s=t.s),r}return r.d[0]?(gt=!1,t=cr(t,r,0,e,1).times(r),gt=!0,rt(t)):(r.s=t.s,t=r),t};Ce.toNumber=function(){return+this};Ce.toOctal=function(r,e){return SA(this,8,r,e)};Ce.toPower=Ce.pow=function(r){var e,t,n,s,i,a,o=this,l=o.constructor,c=+(r=new l(r));if(!o.d||!r.d||!o.d[0]||!r.d[0])return new l(Wr(+o,c));if(o=new l(o),o.eq(1))return o;if(n=l.precision,i=l.rounding,r.eq(1))return rt(o,n,i);if(e=In(r.e/lt),e>=r.d.length-1&&(t=c<0?-c:c)<=o6)return s=KI(l,o,t,n),r.s<0?new l(1).div(s):rt(s,n,i);if(a=o.s,a<0){if(e<r.d.length-1)return new l(NaN);if((r.d[e]&1)==0&&(a=1),o.e==0&&o.d[0]==1&&o.d.length==1)return o.s=a,o}return t=Wr(+o,c),e=t==0||!isFinite(t)?In(c*(Math.log("0."+gn(o.d))/Math.LN10+o.e+1)):new l(t+"").e,e>l.maxE+1||e<l.minE-1?new l(e>0?a/0:0):(gt=!1,l.rounding=o.s=1,t=Math.min(12,(e+"").length),s=wA(r.times(io(o,n+t)),n),s.d&&(s=rt(s,n+5,1),t0(s.d,n,i)&&(e=n+10,s=rt(wA(r.times(io(o,e+t)),e),e+5,1),+gn(s.d).slice(n+1,n+15)+1==1e14&&(s=rt(s,n+1,0)))),s.s=a,gt=!0,l.rounding=i,rt(s,n,i))};Ce.toPrecision=function(r,e){var t,n=this,s=n.constructor;return r===void 0?t=vi(n,n.e<=s.toExpNeg||n.e>=s.toExpPos):($n(r,1,oo),e===void 0?e=s.rounding:$n(e,0,8),n=rt(new s(n),r,e),t=vi(n,r<=n.e||n.e<=s.toExpNeg,r)),n.isNeg()&&!n.isZero()?"-"+t:t};Ce.toSignificantDigits=Ce.toSD=function(r,e){var t=this,n=t.constructor;return r===void 0?(r=n.precision,e=n.rounding):($n(r,1,oo),e===void 0?e=n.rounding:$n(e,0,8)),rt(new n(t),r,e)};Ce.toString=function(){var r=this,e=r.constructor,t=vi(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()&&!r.isZero()?"-"+t:t};Ce.truncated=Ce.trunc=function(){return rt(new this.constructor(this),this.e+1,1)};Ce.valueOf=Ce.toJSON=function(){var r=this,e=r.constructor,t=vi(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()?"-"+t:t};function gn(r){var e,t,n,s=r.length-1,i="",a=r[0];if(s>0){for(i+=a,e=1;e<s;e++)n=r[e]+"",t=lt-n.length,t&&(i+=so(t)),i+=n;a=r[e],n=a+"",t=lt-n.length,t&&(i+=so(t))}else if(a===0)return"0";for(;a%10===0;)a/=10;return i+a}u(gn,"digitsToString");function $n(r,e,t){if(r!==~~r||r<e||r>t)throw Error(ao+r)}u($n,"checkInt32");function t0(r,e,t,n){var s,i,a,o;for(i=r[0];i>=10;i/=10)--e;return--e<0?(e+=lt,s=0):(s=Math.ceil((e+1)/lt),e%=lt),i=Wr(10,lt-e),o=r[s]%i|0,n==null?e<3?(e==0?o=o/100|0:e==1&&(o=o/10|0),a=t<4&&o==99999||t>3&&o==49999||o==5e4||o==0):a=(t<4&&o+1==i||t>3&&o+1==i/2)&&(r[s+1]/i/100|0)==Wr(10,e-2)-1||(o==i/2||o==0)&&(r[s+1]/i/100|0)==0:e<4?(e==0?o=o/1e3|0:e==1?o=o/100|0:e==2&&(o=o/10|0),a=(n||t<4)&&o==9999||!n&&t>3&&o==4999):a=((n||t<4)&&o+1==i||!n&&t>3&&o+1==i/2)&&(r[s+1]/i/1e3|0)==Wr(10,e-3)-1,a}u(t0,"checkRoundingDigits");function Ly(r,e,t){for(var n,s=[0],i,a=0,o=r.length;a<o;){for(i=s.length;i--;)s[i]*=e;for(s[0]+=yA.indexOf(r.charAt(a++)),n=0;n<s.length;n++)s[n]>t-1&&(s[n+1]===void 0&&(s[n+1]=0),s[n+1]+=s[n]/t|0,s[n]%=t)}return s.reverse()}u(Ly,"convertBase");function l6(r,e){var t,n,s;if(e.isZero())return e;n=e.d.length,n<32?(t=Math.ceil(n/3),s=(1/Hy(4,t)).toString()):(t=16,s="2.3283064365386962890625e-10"),r.precision+=t,e=mf(r,1,e.times(s),new r(1));for(var i=t;i--;){var a=e.times(e);e=a.times(a).minus(a).times(8).plus(1)}return r.precision-=t,e}u(l6,"cosine");var cr=(function(){function r(n,s,i){var a,o=0,l=n.length;for(n=n.slice();l--;)a=n[l]*s+o,n[l]=a%i|0,o=a/i|0;return o&&n.unshift(o),n}u(r,"multiplyInteger");function e(n,s,i,a){var o,l;if(i!=a)l=i>a?1:-1;else for(o=l=0;o<i;o++)if(n[o]!=s[o]){l=n[o]>s[o]?1:-1;break}return l}u(e,"compare");function t(n,s,i,a){for(var o=0;i--;)n[i]-=o,o=n[i]<s[i]?1:0,n[i]=o*a+n[i]-s[i];for(;!n[0]&&n.length>1;)n.shift()}return u(t,"subtract"),function(n,s,i,a,o,l){var c,f,p,d,m,g,S,y,w,C,E,v,A,b,U,D,B,V,F,j,se=n.constructor,Y=n.s==s.s?1:-1,ne=n.d,W=s.d;if(!ne||!ne[0]||!W||!W[0])return new se(!n.s||!s.s||(ne?W&&ne[0]==W[0]:!W)?NaN:ne&&ne[0]==0||!W?Y*0:Y/0);for(l?(m=1,f=n.e-s.e):(l=Ys,m=lt,f=In(n.e/m)-In(s.e/m)),F=W.length,B=ne.length,w=new se(Y),C=w.d=[],p=0;W[p]==(ne[p]||0);p++);if(W[p]>(ne[p]||0)&&f--,i==null?(b=i=se.precision,a=se.rounding):o?b=i+(n.e-s.e)+1:b=i,b<0)C.push(1),g=!0;else{if(b=b/m+2|0,p=0,F==1){for(d=0,W=W[0],b++;(p<B||d)&&b--;p++)U=d*l+(ne[p]||0),C[p]=U/W|0,d=U%W|0;g=d||p<B}else{for(d=l/(W[0]+1)|0,d>1&&(W=r(W,d,l),ne=r(ne,d,l),F=W.length,B=ne.length),D=F,E=ne.slice(0,F),v=E.length;v<F;)E[v++]=0;j=W.slice(),j.unshift(0),V=W[0],W[1]>=l/2&&++V;do d=0,c=e(W,E,F,v),c<0?(A=E[0],F!=v&&(A=A*l+(E[1]||0)),d=A/V|0,d>1?(d>=l&&(d=l-1),S=r(W,d,l),y=S.length,v=E.length,c=e(S,E,y,v),c==1&&(d--,t(S,F<y?j:W,y,l))):(d==0&&(c=d=1),S=W.slice()),y=S.length,y<v&&S.unshift(0),t(E,S,v,l),c==-1&&(v=E.length,c=e(W,E,F,v),c<1&&(d++,t(E,F<v?j:W,v,l))),v=E.length):c===0&&(d++,E=[0]),C[p++]=d,c&&E[0]?E[v++]=ne[D]||0:(E=[ne[D]],v=1);while((D++<B||E[0]!==void 0)&&b--);g=E[0]!==void 0}C[0]||C.shift()}if(m==1)w.e=f,FI=g;else{for(p=1,d=C[0];d>=10;d/=10)p++;w.e=p+f*m-1,rt(w,o?i+w.e+1:i,a,g)}return w}})();function rt(r,e,t,n){var s,i,a,o,l,c,f,p,d,m=r.constructor;e:if(e!=null){if(p=r.d,!p)return r;for(s=1,o=p[0];o>=10;o/=10)s++;if(i=e-s,i<0)i+=lt,a=e,f=p[d=0],l=f/Wr(10,s-a-1)%10|0;else if(d=Math.ceil((i+1)/lt),o=p.length,d>=o)if(n){for(;o++<=d;)p.push(0);f=l=0,s=1,i%=lt,a=i-lt+1}else break e;else{for(f=o=p[d],s=1;o>=10;o/=10)s++;i%=lt,a=i-lt+s,l=a<0?0:f/Wr(10,s-a-1)%10|0}if(n=n||e<0||p[d+1]!==void 0||(a<0?f:f%Wr(10,s-a-1)),c=t<4?(l||n)&&(t==0||t==(r.s<0?3:2)):l>5||l==5&&(t==4||n||t==6&&(i>0?a>0?f/Wr(10,s-a):0:p[d-1])%10&1||t==(r.s<0?8:7)),e<1||!p[0])return p.length=0,c?(e-=r.e+1,p[0]=Wr(10,(lt-e%lt)%lt),r.e=-e||0):p[0]=r.e=0,r;if(i==0?(p.length=d,o=1,d--):(p.length=d+1,o=Wr(10,lt-i),p[d]=a>0?(f/Wr(10,s-a)%Wr(10,a)|0)*o:0),c)for(;;)if(d==0){for(i=1,a=p[0];a>=10;a/=10)i++;for(a=p[0]+=o,o=1;a>=10;a/=10)o++;i!=o&&(r.e++,p[0]==Ys&&(p[0]=1));break}else{if(p[d]+=o,p[d]!=Ys)break;p[d--]=0,o=1}for(i=p.length;p[--i]===0;)p.pop()}return gt&&(r.e>m.maxE?(r.d=null,r.e=NaN):r.e<m.minE&&(r.e=0,r.d=[0])),r}u(rt,"finalise");function vi(r,e,t){if(!r.isFinite())return $I(r);var n,s=r.e,i=gn(r.d),a=i.length;return e?(t&&(n=t-a)>0?i=i.charAt(0)+"."+i.slice(1)+so(n):a>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(r.e<0?"e":"e+")+r.e):s<0?(i="0."+so(-s-1)+i,t&&(n=t-a)>0&&(i+=so(n))):s>=a?(i+=so(s+1-a),t&&(n=t-s-1)>0&&(i=i+"."+so(n))):((n=s+1)<a&&(i=i.slice(0,n)+"."+i.slice(n)),t&&(n=t-a)>0&&(s+1===a&&(i+="."),i+=so(n))),i}u(vi,"finiteToString");function qy(r,e){var t=r[0];for(e*=lt;t>=10;t/=10)e++;return e}u(qy,"getBase10Exponent");function My(r,e,t){if(e>u6)throw gt=!0,t&&(r.precision=t),Error(UI);return rt(new r(Fy),e,1,!0)}u(My,"getLn10");function yi(r,e,t){if(e>EA)throw Error(UI);return rt(new r(Uy),e,t,!0)}u(yi,"getPi");function HI(r){var e=r.length-1,t=e*lt+1;if(e=r[e],e){for(;e%10==0;e/=10)t--;for(e=r[0];e>=10;e/=10)t++}return t}u(HI,"getPrecision");function so(r){for(var e="";r--;)e+="0";return e}u(so,"getZeroString");function KI(r,e,t,n){var s,i=new r(1),a=Math.ceil(n/lt+4);for(gt=!1;;){if(t%2&&(i=i.times(e),LI(i.d,a)&&(s=!0)),t=In(t/2),t===0){t=i.d.length-1,s&&i.d[t]===0&&++i.d[t];break}e=e.times(e),LI(e.d,a)}return gt=!0,i}u(KI,"intPow");function kI(r){return r.d[r.d.length-1]&1}u(kI,"isOdd");function XI(r,e,t){for(var n,s,i=new r(e[0]),a=0;++a<e.length;){if(s=new r(e[a]),!s.s){i=s;break}n=i.cmp(s),(n===t||n===0&&i.s===t)&&(i=s)}return i}u(XI,"maxOrMin");function wA(r,e){var t,n,s,i,a,o,l,c=0,f=0,p=0,d=r.constructor,m=d.rounding,g=d.precision;if(!r.d||!r.d[0]||r.e>17)return new d(r.d?r.d[0]?r.s<0?0:1/0:1:r.s?r.s<0?0:r:NaN);for(e==null?(gt=!1,l=g):l=e,o=new d(.03125);r.e>-2;)r=r.times(o),p+=5;for(n=Math.log(Wr(2,p))/Math.LN10*2+5|0,l+=n,t=i=a=new d(1),d.precision=l;;){if(i=rt(i.times(r),l,1),t=t.times(++f),o=a.plus(cr(i,t,l,1)),gn(o.d).slice(0,l)===gn(a.d).slice(0,l)){for(s=p;s--;)a=rt(a.times(a),l,1);if(e==null)if(c<3&&t0(a.d,l-n,m,c))d.precision=l+=10,t=i=o=new d(1),f=0,c++;else return rt(a,d.precision=g,m,gt=!0);else return d.precision=g,a}a=o}}u(wA,"naturalExponential");function io(r,e){var t,n,s,i,a,o,l,c,f,p,d,m=1,g=10,S=r,y=S.d,w=S.constructor,C=w.rounding,E=w.precision;if(S.s<0||!y||!y[0]||!S.e&&y[0]==1&&y.length==1)return new w(y&&!y[0]?-1/0:S.s!=1?NaN:y?0:S);if(e==null?(gt=!1,f=E):f=e,w.precision=f+=g,t=gn(y),n=t.charAt(0),Math.abs(i=S.e)<15e14){for(;n<7&&n!=1||n==1&&t.charAt(1)>3;)S=S.times(r),t=gn(S.d),n=t.charAt(0),m++;i=S.e,n>1?(S=new w("0."+t),i++):S=new w(n+"."+t.slice(1))}else return c=My(w,f+2,E).times(i+""),S=io(new w(n+"."+t.slice(1)),f-g).plus(c),w.precision=E,e==null?rt(S,E,C,gt=!0):S;for(p=S,l=a=S=cr(S.minus(1),S.plus(1),f,1),d=rt(S.times(S),f,1),s=3;;){if(a=rt(a.times(d),f,1),c=l.plus(cr(a,new w(s),f,1)),gn(c.d).slice(0,f)===gn(l.d).slice(0,f))if(l=l.times(2),i!==0&&(l=l.plus(My(w,f+2,E).times(i+""))),l=cr(l,new w(m),f,1),e==null)if(t0(l.d,f-g,C,o))w.precision=f+=g,c=a=S=cr(p.minus(1),p.plus(1),f,1),d=rt(S.times(S),f,1),s=o=1;else return rt(l,w.precision=E,C,gt=!0);else return w.precision=E,l;l=c,s+=2}}u(io,"naturalLogarithm");function $I(r){return String(r.s*r.s/0)}u($I,"nonFiniteToString");function Vy(r,e){var t,n,s;for((t=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(t<0&&(t=n),t+=+e.slice(n+1),e=e.substring(0,n)):t<0&&(t=e.length),n=0;e.charCodeAt(n)===48;n++);for(s=e.length;e.charCodeAt(s-1)===48;--s);if(e=e.slice(n,s),e){if(s-=n,r.e=t=t-n-1,r.d=[],n=(t+1)%lt,t<0&&(n+=lt),n<s){for(n&&r.d.push(+e.slice(0,n)),s-=lt;n<s;)r.d.push(+e.slice(n,n+=lt));e=e.slice(n),n=lt-e.length}else n-=s;for(;n--;)e+="0";r.d.push(+e),gt&&(r.e>r.constructor.maxE?(r.d=null,r.e=NaN):r.e<r.constructor.minE&&(r.e=0,r.d=[0]))}else r.e=0,r.d=[0];return r}u(Vy,"parseDecimal");function c6(r,e){var t,n,s,i,a,o,l,c,f;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),qI.test(e))return Vy(r,e)}else if(e==="Infinity"||e==="NaN")return+e||(r.s=NaN),r.e=NaN,r.d=null,r;if(i6.test(e))t=16,e=e.toLowerCase();else if(s6.test(e))t=2;else if(a6.test(e))t=8;else throw Error(ao+e);for(i=e.search(/p/i),i>0?(l=+e.slice(i+1),e=e.substring(2,i)):e=e.slice(2),i=e.indexOf("."),a=i>=0,n=r.constructor,a&&(e=e.replace(".",""),o=e.length,i=o-i,s=KI(n,new n(t),i,i*2)),c=Ly(e,t,Ys),f=c.length-1,i=f;c[i]===0;--i)c.pop();return i<0?new n(r.s*0):(r.e=qy(c,f),r.d=c,gt=!1,a&&(r=cr(r,s,o*4)),l&&(r=r.times(Math.abs(l)<54?Wr(2,l):gf.pow(2,l))),gt=!0,r)}u(c6,"parseOther");function f6(r,e){var t,n=e.d.length;if(n<3)return e.isZero()?e:mf(r,2,e,e);t=1.4*Math.sqrt(n),t=t>16?16:t|0,e=e.times(1/Hy(5,t)),e=mf(r,2,e,e);for(var s,i=new r(5),a=new r(16),o=new r(20);t--;)s=e.times(e),e=e.times(i.plus(s.times(a.times(s).minus(o))));return e}u(f6,"sine");function mf(r,e,t,n,s){var i,a,o,l,c=1,f=r.precision,p=Math.ceil(f/lt);for(gt=!1,l=t.times(t),o=new r(n);;){if(a=cr(o.times(l),new r(e++*e++),f,1),o=s?n.plus(a):n.minus(a),n=cr(a.times(l),new r(e++*e++),f,1),a=o.plus(n),a.d[p]!==void 0){for(i=p;a.d[i]===o.d[i]&&i--;);if(i==-1)break}i=o,o=n,n=a,a=i,c++}return gt=!0,a.d.length=p+1,a}u(mf,"taylorSeries");function Hy(r,e){for(var t=r;--e;)t*=r;return t}u(Hy,"tinyPow");function GI(r,e){var t,n=e.s<0,s=yi(r,r.precision,1),i=s.times(.5);if(e=e.abs(),e.lte(i))return ia=n?4:1,e;if(t=e.divToInt(s),t.isZero())ia=n?3:2;else{if(e=e.minus(t.times(s)),e.lte(i))return ia=kI(t)?n?2:3:n?4:1,e;ia=kI(t)?n?1:4:n?3:2}return e.minus(s).abs()}u(GI,"toLessThanHalfPi");function SA(r,e,t,n){var s,i,a,o,l,c,f,p,d,m=r.constructor,g=t!==void 0;if(g?($n(t,1,oo),n===void 0?n=m.rounding:$n(n,0,8)):(t=m.precision,n=m.rounding),!r.isFinite())f=$I(r);else{for(f=vi(r),a=f.indexOf("."),g?(s=2,e==16?t=t*4-3:e==8&&(t=t*3-2)):s=e,a>=0&&(f=f.replace(".",""),d=new m(1),d.e=f.length-a,d.d=Ly(vi(d),10,s),d.e=d.d.length),p=Ly(f,10,s),i=l=p.length;p[--l]==0;)p.pop();if(!p[0])f=g?"0p+0":"0";else{if(a<0?i--:(r=new m(r),r.d=p,r.e=i,r=cr(r,d,t,n,0,s),p=r.d,i=r.e,c=FI),a=p[t],o=s/2,c=c||p[t+1]!==void 0,c=n<4?(a!==void 0||c)&&(n===0||n===(r.s<0?3:2)):a>o||a===o&&(n===4||c||n===6&&p[t-1]&1||n===(r.s<0?8:7)),p.length=t,c)for(;++p[--t]>s-1;)p[t]=0,t||(++i,p.unshift(1));for(l=p.length;!p[l-1];--l);for(a=0,f="";a<l;a++)f+=yA.charAt(p[a]);if(g){if(l>1)if(e==16||e==8){for(a=e==16?4:3,--l;l%a;l++)f+="0";for(p=Ly(f,s,e),l=p.length;!p[l-1];--l);for(a=1,f="1.";a<l;a++)f+=yA.charAt(p[a])}else f=f.charAt(0)+"."+f.slice(1);f=f+(i<0?"p":"p+")+i}else if(i<0){for(;++i;)f="0"+f;f="0."+f}else if(++i>l)for(i-=l;i--;)f+="0";else i<l&&(f=f.slice(0,i)+"."+f.slice(i))}f=(e==16?"0x":e==2?"0b":e==8?"0o":"")+f}return r.s<0?"-"+f:f}u(SA,"toStringBinary");function LI(r,e){if(r.length>e)return r.length=e,!0}u(LI,"truncate");function h6(r){return new this(r).abs()}u(h6,"abs");function p6(r){return new this(r).acos()}u(p6,"acos");function d6(r){return new this(r).acosh()}u(d6,"acosh");function m6(r,e){return new this(r).plus(e)}u(m6,"add");function g6(r){return new this(r).asin()}u(g6,"asin");function y6(r){return new this(r).asinh()}u(y6,"asinh");function v6(r){return new this(r).atan()}u(v6,"atan");function E6(r){return new this(r).atanh()}u(E6,"atanh");function w6(r,e){r=new this(r),e=new this(e);var t,n=this.precision,s=this.rounding,i=n+4;return!r.s||!e.s?t=new this(NaN):!r.d&&!e.d?(t=yi(this,i,1).times(e.s>0?.25:.75),t.s=r.s):!e.d||r.isZero()?(t=e.s<0?yi(this,n,s):new this(0),t.s=r.s):!r.d||e.isZero()?(t=yi(this,i,1).times(.5),t.s=r.s):e.s<0?(this.precision=i,this.rounding=1,t=this.atan(cr(r,e,i,1)),e=yi(this,i,1),this.precision=n,this.rounding=s,t=r.s<0?t.minus(e):t.plus(e)):t=this.atan(cr(r,e,i,1)),t}u(w6,"atan2");function S6(r){return new this(r).cbrt()}u(S6,"cbrt");function A6(r){return rt(r=new this(r),r.e+1,2)}u(A6,"ceil");function C6(r,e,t){return new this(r).clamp(e,t)}u(C6,"clamp");function b6(r){if(!r||typeof r!="object")throw Error(jy+"Object expected");var e,t,n,s=r.defaults===!0,i=["precision",1,oo,"rounding",0,8,"toExpNeg",-df,0,"toExpPos",0,df,"maxE",0,df,"minE",-df,0,"modulo",0,9];for(e=0;e<i.length;e+=3)if(t=i[e],s&&(this[t]=vA[t]),(n=r[t])!==void 0)if(In(n)===n&&n>=i[e+1]&&n<=i[e+2])this[t]=n;else throw Error(ao+t+": "+n);if(t="crypto",s&&(this[t]=vA[t]),(n=r[t])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[t]=!0;else throw Error(MI);else this[t]=!1;else throw Error(ao+t+": "+n);return this}u(b6,"config");function x6(r){return new this(r).cos()}u(x6,"cos");function N6(r){return new this(r).cosh()}u(N6,"cosh");function WI(r){var e,t,n;function s(i){var a,o,l,c=this;if(!(c instanceof s))return new s(i);if(c.constructor=s,VI(i)){c.s=i.s,gt?!i.d||i.e>s.maxE?(c.e=NaN,c.d=null):i.e<s.minE?(c.e=0,c.d=[0]):(c.e=i.e,c.d=i.d.slice()):(c.e=i.e,c.d=i.d?i.d.slice():i.d);return}if(l=typeof i,l==="number"){if(i===0){c.s=1/i<0?-1:1,c.e=0,c.d=[0];return}if(i<0?(i=-i,c.s=-1):c.s=1,i===~~i&&i<1e7){for(a=0,o=i;o>=10;o/=10)a++;gt?a>s.maxE?(c.e=NaN,c.d=null):a<s.minE?(c.e=0,c.d=[0]):(c.e=a,c.d=[i]):(c.e=a,c.d=[i]);return}if(i*0!==0){i||(c.s=NaN),c.e=NaN,c.d=null;return}return Vy(c,i.toString())}if(l==="string")return(o=i.charCodeAt(0))===45?(i=i.slice(1),c.s=-1):(o===43&&(i=i.slice(1)),c.s=1),qI.test(i)?Vy(c,i):c6(c,i);if(l==="bigint")return i<0?(i=-i,c.s=-1):c.s=1,Vy(c,i.toString());throw Error(ao+i)}if(u(s,"Decimal"),s.prototype=Ce,s.ROUND_UP=0,s.ROUND_DOWN=1,s.ROUND_CEIL=2,s.ROUND_FLOOR=3,s.ROUND_HALF_UP=4,s.ROUND_HALF_DOWN=5,s.ROUND_HALF_EVEN=6,s.ROUND_HALF_CEIL=7,s.ROUND_HALF_FLOOR=8,s.EUCLID=9,s.config=s.set=b6,s.clone=WI,s.isDecimal=VI,s.abs=h6,s.acos=p6,s.acosh=d6,s.add=m6,s.asin=g6,s.asinh=y6,s.atan=v6,s.atanh=E6,s.atan2=w6,s.cbrt=S6,s.ceil=A6,s.clamp=C6,s.cos=x6,s.cosh=N6,s.div=T6,s.exp=I6,s.floor=D6,s.hypot=B6,s.ln=R6,s.log=O6,s.log10=P6,s.log2=_6,s.max=k6,s.min=L6,s.mod=V6,s.mul=F6,s.pow=U6,s.random=M6,s.round=j6,s.sign=q6,s.sin=H6,s.sinh=K6,s.sqrt=X6,s.sub=$6,s.sum=G6,s.tan=W6,s.tanh=z6,s.trunc=J6,r===void 0&&(r={}),r&&r.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<n.length;)r.hasOwnProperty(t=n[e++])||(r[t]=this[t]);return s.config(r),s}u(WI,"clone");function T6(r,e){return new this(r).div(e)}u(T6,"div");function I6(r){return new this(r).exp()}u(I6,"exp");function D6(r){return rt(r=new this(r),r.e+1,3)}u(D6,"floor");function B6(){var r,e,t=new this(0);for(gt=!1,r=0;r<arguments.length;)if(e=new this(arguments[r++]),e.d)t.d&&(t=t.plus(e.times(e)));else{if(e.s)return gt=!0,new this(1/0);t=e}return gt=!0,t.sqrt()}u(B6,"hypot");function VI(r){return r instanceof gf||r&&r.toStringTag===jI||!1}u(VI,"isDecimalInstance");function R6(r){return new this(r).ln()}u(R6,"ln");function O6(r,e){return new this(r).log(e)}u(O6,"log");function _6(r){return new this(r).log(2)}u(_6,"log2");function P6(r){return new this(r).log(10)}u(P6,"log10");function k6(){return XI(this,arguments,-1)}u(k6,"max");function L6(){return XI(this,arguments,1)}u(L6,"min");function V6(r,e){return new this(r).mod(e)}u(V6,"mod");function F6(r,e){return new this(r).mul(e)}u(F6,"mul");function U6(r,e){return new this(r).pow(e)}u(U6,"pow");function M6(r){var e,t,n,s,i=0,a=new this(1),o=[];if(r===void 0?r=this.precision:$n(r,1,oo),n=Math.ceil(r/lt),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(n));i<n;)s=e[i],s>=429e7?e[i]=crypto.getRandomValues(new Uint32Array(1))[0]:o[i++]=s%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(n*=4);i<n;)s=e[i]+(e[i+1]<<8)+(e[i+2]<<16)+((e[i+3]&127)<<24),s>=214e7?crypto.randomBytes(4).copy(e,i):(o.push(s%1e7),i+=4);i=n/4}else throw Error(MI);else for(;i<n;)o[i++]=Math.random()*1e7|0;for(n=o[--i],r%=lt,n&&r&&(s=Wr(10,lt-r),o[i]=(n/s|0)*s);o[i]===0;i--)o.pop();if(i<0)t=0,o=[0];else{for(t=-1;o[0]===0;t-=lt)o.shift();for(n=1,s=o[0];s>=10;s/=10)n++;n<lt&&(t-=lt-n)}return a.e=t,a.d=o,a}u(M6,"random");function j6(r){return rt(r=new this(r),r.e+1,this.rounding)}u(j6,"round");function q6(r){return r=new this(r),r.d?r.d[0]?r.s:0*r.s:r.s||NaN}u(q6,"sign");function H6(r){return new this(r).sin()}u(H6,"sin");function K6(r){return new this(r).sinh()}u(K6,"sinh");function X6(r){return new this(r).sqrt()}u(X6,"sqrt");function $6(r,e){return new this(r).sub(e)}u($6,"sub");function G6(){var r=0,e=arguments,t=new this(e[r]);for(gt=!1;t.s&&++r<e.length;)t=t.plus(e[r]);return gt=!0,rt(t,this.precision,this.rounding)}u(G6,"sum");function W6(r){return new this(r).tan()}u(W6,"tan");function z6(r){return new this(r).tanh()}u(z6,"tanh");function J6(r){return rt(r=new this(r),r.e+1,1)}u(J6,"trunc");Ce[Symbol.for("nodejs.util.inspect.custom")]=Ce.toString;Ce[Symbol.toStringTag]="Decimal";var gf=Ce.constructor=WI(vA);Fy=new gf(Fy);Uy=new gf(Uy);var yf=class r extends gf{static{u(this,"Decimal")}static from(e){return new r(e)}static newOrZero(e){return e===void 0?r.from(0):r.from(e)}static newOrUndefined(e){if(e!==void 0)return r.from(e)}};import Y6 from"pdfkit";var zI=class r{static{u(this,"PdfkitPdfBuilder")}defaults={autoFirstPage:!1};doc=new Y6(this.defaults);constructor(e){e&&this.configure(e)}static new(e){return new r(e)}configure(e){return this.doc.options={...this.doc.options,...e},this}pipe(e){return this.doc.pipe(e),this}end(){return this.doc.end()}restore(){return this.doc.restore(),this}save(){return this.doc.save(),this}stroke(e){return this.doc.stroke(e),this}page(e){return this.doc.addPage(e),this}table(e){return this.doc.table(e),this}text(e,t){let{x:n,y:s,...i}=t??{};return n||s?(this.doc.text(e,n,s,i),this):(this.doc.text(e,t),this)}fontSize(e){return this.doc.fontSize(e),this}font(e,t,n){return typeof t=="string"?(this.doc.font(e,t,n),this):typeof t=="number"?(this.doc.font(e,t),this):(this.doc.font(e),this)}image(e,t,n,s){return typeof t=="number"&&typeof n=="number"?(this.doc.image(e,t,n,s),this):(this.doc.image(e,t),this)}rect(e,t,n,s){return this.doc.rect(e,t,n,s),this}path(e){return this.doc.path(e),this}translate(e,t){return this.doc.translate(e,t),this}scale(e,t){return this.doc.scale(e,t),this}fill(e,t){return this.doc.fill(e,t),this}pageWidth(){return this.doc.page.width}pageHeight(){return this.doc.page.height}heightOfString(e,t){return this.doc.heightOfString(e,t)}widthOfString(e,t){return this.doc.widthOfString(e,t)}pageMargins(){return this.doc.page.margins}currentLineHeight(e){return this.doc.currentLineHeight(e)}x(){return this.doc.x}y(){return this.doc.y}moveDown(e){return this.doc.moveDown(e),this}row(e,...t){let n,s;typeof e=="function"?(n={},s=[e,...t]):(n=e??{},s=t),n.columns??=1;let i=this.y(),a=n.right??0,o=n.left??0,l=n.gap??0,c=this.pageWidth(),f=c-o-a-l*(n.columns-1);n.size??=Array(n.columns).fill(12/n.columns);let p=[];for(let d=0;d<n.columns;d++){let m=n.size[d]/12;p[d]=f*m}for(let d=0,m=o;d<n.columns;d++){let g=d===n.columns-1,S=p[d];if(g&&n.columns>1){let C=c-a-m;C>0&&Math.abs(C-S)>.01&&(S=C)}let y={y:i,x:m,width:S};s[d](y),m+=S,l>0&&!g&&(m+=l)}return this}};var JI=class{static{u(this,"MemoryCacheAdapter")}cache=new Map;async get(e){return Promise.resolve(this.cache.get(e)??null)}has(e){return Promise.resolve(this.cache.has(e))}set(e,t){return this.cache.set(e,t),Promise.resolve(!0)}};var So=Ry(hR(),1);import J9 from"os";import SR from"fs";import Y9 from"path";import v0 from"crypto";var L9=u(r=>!!r&&typeof r=="object"&&"message"in r,"hasMessageInRecord"),ds=u(r=>typeof r=="string"?zt(new Mt(r)):r instanceof Error?zt(new Mt(r.message,{cause:r.cause})):L9(r)?zt(new Mt(r.message)):zt(new Mt("unexpected error")),"leftFromError");var Av=class{static{u(this,"NullCacheAdapter")}async get(e){return Promise.resolve(null)}has(e){return Promise.resolve(!1)}set(e,t){return Promise.resolve(!0)}};import{arch as q9,platform as ER}from"os";import{dirname as H9,join as K9,resolve as X9,normalize as $9,delimiter as G9}from"path";import{resolve as dR}from"path";import{createRequire as pR}from"module";import{fileURLToPath as V9,pathToFileURL as F9}from"url";var U9=typeof jest<"u"||process.env.JEST_WORKER_ID!==void 0,_f,mR=u(()=>{if(_f!==void 0)return _f;if(U9){_f=void 0;return}try{_f=new Function("try { return import.meta.url; } catch { return undefined; }")()}catch{_f=void 0}return _f},"getImportMetaUrl"),gR=u(()=>{if(typeof ot<"u")return ot;let r=mR();if(r)return pR(r);let e=F9(dR(process.cwd(),"package.json")).href;return pR(e)},"getRequireFn"),yR=u(()=>{if(typeof __filename<"u")return __filename;let r=mR();return r?V9(r):dR(process.cwd())},"getCurrentFile");import{dirname as Cv,resolve as ul}from"path";import{existsSync as Pf}from"fs";var vR=u(()=>typeof process<"u"&&typeof process.versions<"u"&&"electron"in process.versions,"isElectron"),M9=u(()=>{if(!vR())return null;try{let e=ot("electron").app;if(e?.getAppPath&&typeof e.getAppPath=="function")return{getAppPath:e.getAppPath}}catch{}return null},"getElectronApp"),j9=u(()=>{if(!vR())return null;let r=process;if(r.resourcesPath)return r.resourcesPath;let e=M9();if(e)try{let t=e.getAppPath();if(typeof t=="string")return Cv(t.replace(/\.asar$/,""))}catch{}return null},"getElectronResourcesPath"),bC=u((r,{onFound:e,onNotFound:t})=>{let n=j9();if(n){let c=ul(n,"node_modules","nfets",r);if(Pf(c))return e(c);let f=ul(n,"app.asar.unpacked","node_modules","nfets",r);if(Pf(f))return e(f)}let s=yR(),i=s.includes(".asar")?process.cwd():s,a=ul(i,"../../../../"),o=ul(a,r);if(Pf(o))return e(o);let l=i;for(let c=0;c<5;c++){let f=ul(l,r);if(Pf(f))return e(f);let p=Cv(l);if(p===l)break;l=p}l=i;for(let c=0;c<5;c++){let f=ul(l,"node_modules","nfets",r);if(Pf(f))return e(f);let p=Cv(l);if(p===l)break;l=p}l=i;for(let c=0;c<5;c++){let f=ul(l,r.replace(/^build\//,"Release/"));if(Pf(f))return e(f);let p=Cv(l);if(p===l)break;l=p}return t()},"search");var W9=u(r=>{let e=r.replace(/^\\\\\?\\/,"");return X9($9(e))},"normalizePath"),z9=u(r=>{ER()==="win32"&&(process.env.PATH=`${H9(r)}${G9}${process.env.PATH}`)},"addAddonDirToPath"),xC=u(r=>{let e=W9(r);return z9(e),gR()(e)},"exportRequireModule"),kf=u(r=>{if(r=`${r}.node`,process.env.NFETS_ADDONS_DIR)return xC(K9(process.env.NFETS_ADDONS_DIR,r));let e=`${ER()}-${q9()}`;try{return bC(`build/addons/${e}/${r}`,{onFound:u(t=>xC(t),"onFound"),onNotFound:u(()=>{throw new Error(`Addon ${e}/${r} not found`)},"onNotFound")})}catch{return bC(`build/Release/${r}`,{onFound:u(t=>xC(t),"onFound"),onNotFound:u(()=>{throw new Error(`Addon ${e}/${r} not found`)},"onNotFound")})}},"addon");var wo=class{static{u(this,"ASN1")}extractCertificateInfo(e){let n=e.subject.split(`
83
- `).reduce((i,a)=>{let[o,l]=a.split("=").map(c=>c.trim());return!o||!l?i:i.set(o,l)},new Map),s=this.oid("2.16.76.1.3.1",e.raw);return{CNPJ:this.oid("2.16.76.1.3.3",e.raw),CPF:s,CN:n.get("CN"),O:n.get("O"),OU:n.get("OU"),ST:n.get("ST"),L:n.get("L"),C:n.get("C")}}oid(e,t){let n=this.marker(e),s=t.indexOf(n);if(s===-1)return;let i=[t.subarray(0,s),t.subarray(s)];if(i.length<=1)return;let o=i[0].subarray(-4),l=o.subarray(-2);o[0]===48?l=o:o[1]===48&&(l=o.subarray(-3));let c=Buffer.concat([l,n,i[1]]),f=this.length(c),p=n.length,d=c.subarray(2+p,2+p+f),m=d.length-l.length-2;if(m<=0||m>d.length)return;let S=d.subarray(-m).toString("utf8");return S.substring(Buffer.from(S).findIndex((y,w)=>S.charCodeAt(w)>=32&&S.charCodeAt(w)<=126))}length(e){return e.length<2?0:e[1]<=127?e[1]:Buffer.from([e[1]&15]).reduce((t,n)=>t<<8|n,0)}marker(e){let t=e.split("."),n=t.slice(2).reduce((s,i)=>{let a=this.base128(s,Number.parseInt(i,10),!0);return s.length=0,s.push(...a),s},[]);return Buffer.from([6,n.length+1,40*Number.parseInt(t[0],10)+Number.parseInt(t[1],10),...n])}base128(e,t,n){let s=[...e];if(t>127){let a=this.base128(e,Math.floor(t/128),!1);a.length=0,s.push(...a)}let i=t%128;return n?s.push(i):s.push(128|i),s}};var bv=class{static{u(this,"WincryptSignerRepository")}async sign(e,t,n){try{let s=kf("wincrypt_certificate_store"),i=new wo,{CN:a}=i.extractCertificateInfo(t.certificate),o=await s.sign(a??"",Buffer.from(e),n),l=Buffer.from(o).toString("base64");return await Promise.resolve(Gr(l))}catch(s){return Promise.resolve(ds(s))}}};import wR from"crypto";var xv=class{static{u(this,"CryptoSignerRepository")}async sign(e,t,n){try{if(!t.privateKey)return zt(new Mt("Certificate private key not found"));let i=wR.sign(n,Buffer.from(e),{key:t.privateKey,padding:wR.constants.RSA_PKCS1_PADDING}).toString("base64");return await Promise.resolve(Gr(i))}catch(s){return Promise.resolve(ds(s))}}};var AR=class{static{u(this,"NativeCertificateRepository")}httpClient;cache;signer;constructor(e,t=new Av,n=J9.platform()==="win32"?new bv:new xv){this.httpClient=e,this.cache=t,this.signer=n}async read(e){try{let{password:t,pfxPathOrBase64:n,publicCertDerBase64:s}=e,i=s?.trim(),a=n?.trim();if(i&&a)return zt(new Mt("Use either pfxPathOrBase64 or publicCertDerBase64, not both"));if(i)try{let w=Buffer.from(i,"base64"),C=new v0.X509Certificate(w);return Gr({ca:[],password:t,certificate:C,privateKey:void 0})}catch(w){return ds(w)}if(!a)return zt(new Mt("Certificate path (pfxPathOrBase64) is required"));let o=await this.getPfxBuffer({...e,pfxPathOrBase64:a});if(o.isLeft())return o;let l=So.default.asn1.fromDer(o.value.toString("binary")),c=So.default.pkcs12.pkcs12FromAsn1(l,t),{certBag:f}=So.default.pki.oids,d=c.getBags({bagType:f})[f];if(!d?.length)return zt(new Mt("Cannot read certificate"));let[{cert:m},...g]=d;if(!m)return zt(new Mt("Issuer Certificate not found"));let S=g.reduce((w,{cert:C})=>(C&&w.push(new v0.X509Certificate(So.default.pki.certificateToPem(C))),w),[]),y=new v0.X509Certificate(So.default.pki.certificateToPem(m));return Gr({ca:S,password:t,certificate:y,privateKey:this.getPrivateKey(c)})}catch(t){return ds(t)}}getPrivateKey(e){let{pkcs8ShroudedKeyBag:t}=So.default.pki.oids,s=e.getBags({bagType:t})[t]?.[0]?.key;if(s)return v0.createPrivateKey(So.default.pki.privateKeyToPem(s))}async sign(e,t,n=no.SHA1){return this.signer.sign(e,t,n)}getCertificateInfo(e){return new wo().extractCertificateInfo(e)}getStringCertificate(e){return e.raw.toString("base64")}getStringPrivateKey(e){try{return e.export({type:"pkcs8",format:"pem"})}catch{throw new Mt("Cannot extract private key")}}async getPfxBuffer(e){let{pfxPathOrBase64:t,password:n}=e,s=this.getCacheKey(t,n),i=await this.cache.get(s);if(i)return Gr(i);if(Y9.isAbsolute(t)||SR.existsSync(t))return this.hitBufferOnCache(s,SR.readFileSync(t));if(this.isValidRemoteUrl(t))try{let a=await this.httpClient.get(t,{responseType:"arraybuffer"});return await this.hitBufferOnCache(s,Buffer.from(a.data))}catch(a){return ds(a)}return this.hitBufferOnCache(s,Buffer.from(t,"base64"))}getCacheKey(e,t){return v0.createHash("sha256").update(`${e}.${t}`).digest("hex")}async hitBufferOnCache(e,t){return await this.cache.set(e,t),Gr(t)}isValidRemoteUrl(e){try{return new URL(e),!0}catch{return!1}}};import eW from"os";import NC from"dayjs";import Q9 from"dayjs/plugin/utc.js";import Z9 from"dayjs/plugin/timezone.js";NC.extend(Q9);NC.extend(Z9);var Lf=NC;var G3=Ry(q3(),1);import{constants as tW}from"crypto";import{Agent as mx}from"https";var VG=new Set(["ENOTFOUND","EAI_AGAIN","EAI_FAIL","EAI_NONAME"]),FG=new Set(["ETIMEDOUT","ESOCKETTIMEDOUT","ECONNABORTED"]),UG=new Set(["ECONNREFUSED","ENETUNREACH","EHOSTUNREACH","EPIPE"]),MG=new Set([12002,12152,12175]),jG=new Set([12007]),qG=new Set([12029,12030]),HG=/Failed to send request\. Error: (\d+)/i,KG=u(r=>!!r&&typeof r=="object"&&"message"in r,"hasMessage"),XG=u(r=>{if(!r||typeof r!="object"||!("code"in r))return;let{code:e}=r;return typeof e=="string"?e:void 0},"getCode"),$G=u(r=>{if(!r||typeof r!="object"||!("hostname"in r))return;let{hostname:e}=r;return typeof e=="string"?e:void 0},"getHostname"),px=u(r=>{if(typeof r=="string")return r;if(r instanceof Error||KG(r))return r.message},"getMessage"),H3=u(r=>{let e=r.toLowerCase();return e.includes("timeout")||e.includes("timed out")||e.includes("time-out")||e.includes("read econnreset")},"isTimeoutMessage"),GG=u(r=>/getaddrinfo\s+ENOTFOUND/i.test(r)||/\bENOTFOUND\b/i.test(r),"isHostNotFoundMessage"),WG=u(r=>{let e=HG.exec(r);if(!e)return;let t=Number(e[1]);return Number.isFinite(t)?t:void 0},"getWinHttpErrorCode"),zG=u(r=>{let e=[],t=new Set,n=r;for(;n!=null&&!t.has(n);){if(t.add(n),e.push(n),n instanceof AggregateError)for(let i of n.errors)t.has(i)||e.push(i);n=n instanceof Error?n.cause:void 0}return e},"collectErrorChain"),ko=u(r=>r instanceof Error?{cause:r}:void 0,"errorOptions"),JG=u(r=>{let e=zG(r),t=px(r)??e.map(px).find(s=>!!s);for(let s of e){let i=XG(s);if(i&&VG.has(i))return zt(new Yu(t??`Host not found (${$G(s)??i})`,ko(r)));if(i&&FG.has(i))return zt(new Qu(t??"Transmission timeout",ko(r)));if(i&&UG.has(i))return zt(new Yu(t??`Connection failed (${i})`,ko(r)));let a=px(s);if(a&&H3(a))return zt(new Qu(a,ko(r)))}if(!t)return ds(r);let n=WG(t);if(n!==void 0){if(MG.has(n))return zt(new Qu(t,ko(r)));if(jG.has(n)||qG.has(n))return zt(new Yu(t,ko(r)))}return GG(t)?zt(new Yu(t,ko(r))):H3(t)?zt(new Qu(t,ko(r))):ds(r)},"mapTransmissionError"),K3=u(r=>JG(r),"leftFromTransmissionError");var YG=/Ã[\u0080-\u00BF]/;function QG(r){if(!YG.test(r))return r;let e=Buffer.from(r,"latin1").toString("utf8");return e.includes("\uFFFD")?r:e}u(QG,"fixUtf8Mojibake");function dx(r){if(typeof r=="string")return QG(r);if(Array.isArray(r))return r.map(e=>dx(e));if(r!==null&&typeof r=="object"){let e={};for(let[t,n]of Object.entries(r))e[t]=dx(n);return e}return r}u(dx,"normalizeValue");function X3(r){return dx(r)}u(X3,"normalizeTransmissionStrings");import ZG from"os";var L2=class r{static{u(this,"WinHttpClient")}certificate;interceptors={request:{use:u(()=>0,"use"),eject:u(()=>{},"eject"),clear:u(()=>{},"clear")},response:{use:u(()=>0,"use"),eject:u(()=>{},"eject"),clear:u(()=>{},"clear")}};defaults={headers:{}};constructor(e){this.certificate=e}parseRequestHeaders(e){return e?Object.entries(e).filter(([t,n])=>n!=null).map(([t,n])=>`${t}: ${Array.isArray(n)?n.join(", "):String(n)}`).join(ZG.EOL):""}parseRequestBody(e){return e?Buffer.isBuffer(e)?e:typeof e=="string"?Buffer.from(e,"utf8"):Array.isArray(e)?Buffer.concat(e):Buffer.from(JSON.stringify(e),"utf8"):Buffer.from("")}parseResponseHeaders(e){return e?e.split(`\r
84
- `).reduce((t,n)=>{if(!n.trim()||n.startsWith("HTTP/"))return t;let[s,i]=n.split(":").map(a=>a.trim());return t[s]=i,t},{}):{}}parseResponseBody(e){return e?Buffer.isBuffer(e)?e.toString("utf8"):e:""}async request(e){let t=e.url??"",n=(e.method??"GET").toUpperCase(),s=kf("winhttp_ssl_client"),{CN:i}=new wo().extractCertificateInfo(this.certificate.certificate),a=await s.request(i??"",n,t,{headers:this.parseRequestHeaders(e.headers),body:this.parseRequestBody(e.data),timeout:e.timeout});return{status:a.statusCode,data:this.parseResponseBody(a.body),statusText:this.getStatusText(a.statusCode),headers:this.parseResponseHeaders(a.headers),config:e,request:{}}}get(e,t){return this.request({...t,method:"GET",url:e})}post(e,t,n){return this.request({...n,method:"POST",url:e,data:t})}put(e,t,n){return this.request({...n,method:"PUT",url:e,data:t})}patch(e,t,n){return this.request({...n,method:"PATCH",url:e,data:t})}delete(e,t){return this.request({...t,method:"DELETE",url:e})}head(e,t){return this.request({...t,method:"HEAD",url:e})}options(e,t){return this.request({...t,method:"OPTIONS",url:e})}getUri(e){if(!e?.url)return"";try{return new URL(e.url).toString()}catch{return e.url}}static create(e){let t=new r(e),n=t.request.bind(t);return Object.setPrototypeOf(n,r.prototype),Object.assign(n,t),n}getStatusText(e){return{200:"OK",201:"Created",202:"Accepted",204:"No Content",400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable"}[e]??"Unknown"}};var $3=class{static{u(this,"SoapRemoteTransmissionRepository")}toolkit;certificateRepository;constructor(e,t){this.toolkit=e,this.certificateRepository=t}setCertificate(e){return this.certificate=e,this}validateCertificatePeriod(){if(!this.certificate)return Gr(void 0);let{certificate:e}=this.certificate,t=new Date;return t>new Date(e.validTo)?zt(new Mt(`Certificado expirado (${Lf(e.validTo).format("DD/MM/YYYY")}). Renove o certificado.`)):t<new Date(e.validFrom)?zt(new Mt(`O certificado ainda n\xE3o est\xE1 v\xE1lido (${Lf(e.validFrom).format("DD/MM/YYYY")}).`)):Gr(void 0)}get httpsAgent(){let e={rejectUnauthorized:!1,secureOptions:tW.SSL_OP_LEGACY_SERVER_CONNECT};if(!this.certificate)return new mx({...e});let{ca:t,password:n,certificate:s,privateKey:i}=this.certificate;return i?new mx({passphrase:n,cert:s.toString(),ca:t.map(a=>a.toString()),key:this.certificateRepository.getStringPrivateKey(i),...e}):new mx({...e})}get defaultSoapHeaders(){return{"Content-Type":"application/soap+xml; charset=utf-8"}}getDefaultRequest(e){let t=TI.create({timeout:e.timeout});return t.defaults.httpsAgent=this.httpsAgent,t}request(e){if(eW.platform()==="win32")try{return this.certificate?L2.create(this.certificate):this.getDefaultRequest({timeout:e.timeout})}catch{return this.getDefaultRequest({timeout:e.timeout})}return this.getDefaultRequest({timeout:e.timeout})}async send(e){let t=this.validateCertificatePeriod();if(t.isLeft())return t;try{let n=this.request({timeout:e.timeout}),s=await(0,G3.createClientAsync)(`${e.url}?wsdl`,{request:n,endpoint:e.url,attributesKey:"$",wsdl_options:{request:n,timeout:e.timeout},forceSoap12Headers:!0});e.payload.$={xmlns:s.wsdl.definitions.$targetNamespace,...e.payload.$};let i=await this.toolkit.build(e.payload,{headless:!0,renderOpts:{pretty:!1},rootName:e.root}),a=this.toolkit.getFirstNode(i)??"",o=e.xsd,l=await this.toolkit.validate(a,o);if(l.isLeft())return l;let c=`${e.method}Async`;if(typeof s[c]!="function"){let p=Object.keys(s).filter(d=>d.endsWith("Async"));return zt(new Mt(`M\xE9todo SOAP "${c}" n\xE3o encontrado em ${e.url}. Dispon\xEDveis: ${p.join(", ")||"nenhum"}`))}let[f]=await s[c]({_xml:i},{request:n,timeout:e.timeout});return Gr(X3(f))}catch(n){return K3(n)}}};var rW=kf("xml_validator"),W3=rW;var HZ=Ry(yk(),1);import qZ from"crypto";var vk="application/xml";var St;(function(r){r[r.None=0]="None",r[r.Element=1]="Element",r[r.Attribute=2]="Attribute",r[r.Text=3]="Text",r[r.CDATA=4]="CDATA",r[r.EntityReference=5]="EntityReference",r[r.Entity=6]="Entity",r[r.ProcessingInstruction=7]="ProcessingInstruction",r[r.Comment=8]="Comment",r[r.Document=9]="Document",r[r.DocumentType=10]="DocumentType",r[r.DocumentFragment=11]="DocumentFragment",r[r.Notation=12]="Notation",r[r.Whitespace=13]="Whitespace",r[r.SignificantWhitespace=14]="SignificantWhitespace",r[r.EndElement=15]="EndElement",r[r.EndEntity=16]="EndEntity",r[r.XmlDeclaration=17]="XmlDeclaration"})(St||(St={}));function nW(r,e){let t=r.ownerDocument==null?r:r.ownerDocument,n=document.createNSResolver(r.ownerDocument==null?r.documentElement:r.ownerDocument.documentElement),s=t.evaluate(e,r,n,XPathResult.ANY_TYPE,null),i=[],a;for(;a=s.iterateNext();)i.push(a);return i}u(nW,"SelectNodesEx");function sW(r,e){let t=ih("xpath").select;return t(e,r)}u(sW,"SelectNodesNode");var Ek=typeof self<"u"?nW:sW;function z0(r){r=r.replace(/\r\n/g,`
82
+ @#[line:`+r.lineNumber+",col:"+r.columnNumber+"]"}u(UZ,"_locator");function oV(r,e,t){return typeof r=="string"?r.substr(e,t):r.length>=e+t||e?new java.lang.String(r,e,t)+"":r}u(oV,"_toString");"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(r){uA.prototype[r]=function(){return null}});function oA(r,e){r.currentElement?r.currentElement.appendChild(e):r.doc.appendChild(e)}u(oA,"appendElement");function MZ(r){if(r==="error")throw"onErrorStopParsing"}u(MZ,"onErrorStopParsing");function jZ(){throw"onWarningStopParsing"}u(jZ,"onWarningStopParsing");zd.__DOMHandler=uA;zd.DOMParser=cV;zd.normalizeLineEndings=lV;zd.onErrorStopParsing=MZ;zd.onWarningStopParsing=jZ});var hV=le(Xt=>{"use strict";var Jd=lf();Xt.assign=Jd.assign;Xt.hasDefaultHTMLNamespace=Jd.hasDefaultHTMLNamespace;Xt.isHTMLMimeType=Jd.isHTMLMimeType;Xt.isValidMimeType=Jd.isValidMimeType;Xt.MIME_TYPE=Jd.MIME_TYPE;Xt.NAMESPACE=Jd.NAMESPACE;var lA=vy();Xt.DOMException=lA.DOMException;Xt.DOMExceptionName=lA.DOMExceptionName;Xt.ExceptionCode=lA.ExceptionCode;Xt.ParseError=lA.ParseError;var en=SI();Xt.Attr=en.Attr;Xt.CDATASection=en.CDATASection;Xt.CharacterData=en.CharacterData;Xt.Comment=en.Comment;Xt.Document=en.Document;Xt.DocumentFragment=en.DocumentFragment;Xt.DocumentType=en.DocumentType;Xt.DOMImplementation=en.DOMImplementation;Xt.Element=en.Element;Xt.Entity=en.Entity;Xt.EntityReference=en.EntityReference;Xt.LiveNodeList=en.LiveNodeList;Xt.NamedNodeMap=en.NamedNodeMap;Xt.Node=en.Node;Xt.NodeList=en.NodeList;Xt.Notation=en.Notation;Xt.ProcessingInstruction=en.ProcessingInstruction;Xt.Text=en.Text;Xt.XMLSerializer=en.XMLSerializer;var cA=fV();Xt.DOMParser=cA.DOMParser;Xt.normalizeLineEndings=cA.normalizeLineEndings;Xt.onErrorStopParsing=cA.onErrorStopParsing;Xt.onWarningStopParsing=cA.onWarningStopParsing});var hA="http://www.w3.org/2000/09/xmldsig#",II="http://www.w3.org/TR/2001/REC-xml-c14n-20010315",pA=(function(r){return r.RSA_SHA1="http://www.w3.org/2000/09/xmldsig#rsa-sha1",r.RSA_SHA256="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256",r})({}),no=(function(r){return r.SHA1="sha1",r.SHA256="sha256",r})({}),dA=(function(r){return r.SHA1="http://www.w3.org/2000/09/xmldsig#sha1",r.SHA256="http://www.w3.org/2001/04/xmlenc#sha256",r})({});var nr={AC:"12",AL:"27",AM:"13",AP:"16",BA:"29",CE:"23",DF:"53",ES:"32",GO:"52",MA:"21",MG:"31",MS:"50",MT:"51",PA:"15",PB:"25",PE:"26",PI:"22",PR:"41",RJ:"33",RN:"24",RO:"11",RR:"14",RS:"43",SC:"42",SE:"28",SP:"35",TO:"17"},zZ=Object.keys(nr);var YZ={Production:"1",Homolog:"2"};var t6={[nr.AC]:"America/Rio_Branco",[nr.AL]:"America/Maceio",[nr.AM]:"America/Manaus",[nr.AP]:"America/Belem",[nr.BA]:"America/Bahia",[nr.CE]:"America/Fortaleza",[nr.DF]:"America/Sao_Paulo",[nr.ES]:"America/Sao_Paulo",[nr.GO]:"America/Sao_Paulo",[nr.MA]:"America/Fortaleza",[nr.MG]:"America/Sao_Paulo",[nr.MS]:"America/Campo_Grande",[nr.MT]:"America/Cuiaba",[nr.PA]:"America/Belem",[nr.PB]:"America/Fortaleza",[nr.PE]:"America/Recife",[nr.PI]:"America/Fortaleza",[nr.PR]:"America/Sao_Paulo",[nr.RJ]:"America/Sao_Paulo",[nr.RN]:"America/Fortaleza",[nr.RO]:"America/Porto_Velho",[nr.RR]:"America/Boa_Vista",[nr.RS]:"America/Sao_Paulo",[nr.SC]:"America/Sao_Paulo",[nr.SE]:"America/Maceio",[nr.SP]:"America/Sao_Paulo",[nr.TO]:"America/Araguaina"};var Mt=class extends Error{static{u(this,"NFeTsError")}};var _y=class extends Mt{static{u(this,"TransmissionError")}},Yu=class extends _y{static{u(this,"TransmissionHostNotFoundError")}},Qu=class extends _y{static{u(this,"TransmissionTimeoutError")}};var DI=class extends Mt{static{u(this,"ValidationError")}};var Zd={includeComments:!1,exclusive:!0};var mA=u(r=>{throw new Mt("Didn't expect to get here")},"unreachable");var pf=class{static{u(this,"Signer")}toolkit;certificateRepository;algorithm;canonical;constructor(e,t,n=no.SHA1,s=Zd){this.toolkit=e,this.certificateRepository=t,this.algorithm=n,this.canonical=s}assemble(e,t,n){let s=this.certificateRepository.getStringCertificate(n);return{$:{xmlns:hA},SignedInfo:e,SignatureValue:t,KeyInfo:{X509Data:{X509Certificate:s}}}}signedInfo(e,t){return{CanonicalizationMethod:{$:{Algorithm:II}},SignatureMethod:{$:{Algorithm:this.signatureMethod}},Reference:{$:{URI:`#${this.toolkit.getAttribute(e,t)}`},Transforms:this.transforms,DigestMethod:{$:{Algorithm:this.digestAlgorithm}},DigestValue:this.digest(e)}}}digest(e){return this.toolkit.digest(e,this.algorithm,this.canonical)}async signOrLeft(e,t){let n=this.toolkit.canonicalize(await this.toolkit.build({$:{xmlns:hA},...e},{rootName:"SignedInfo"}),this.canonical);return this.certificateRepository.sign(n,t,this.algorithm)}get transforms(){return{Transform:[{$:{Algorithm:"http://www.w3.org/2000/09/xmldsig#enveloped-signature"}},{$:{Algorithm:"http://www.w3.org/TR/2001/REC-xml-c14n-20010315"}}]}}get digestAlgorithm(){switch(this.algorithm){case no.SHA256:return dA.SHA256;case no.SHA1:return dA.SHA1;default:return mA(this.algorithm)}}get signatureMethod(){switch(this.algorithm){case no.SHA256:return pA.RSA_SHA256;case no.SHA1:return pA.RSA_SHA1;default:return mA(this.algorithm)}}};var gA=class{static{u(this,"Left")}value;constructor(e){this.value=e}isLeft(){return!0}isRight(){return!1}},Py=class{static{u(this,"Right")}value;constructor(e){this.value=e}isLeft(){return!1}isRight(){return!0}},zt=u(r=>new gA(r),"left"),Gr=u(r=>r===void 0?new Py(void 0):new Py(r),"right");var BI=class extends pf{static{u(this,"EntitySigner")}async sign(e,t,n){let{tag:s,mark:i}=t,{certificate:a}=n;if(!e[s])return zt(new Mt(`Node ${String(s)} not found`));let o=await this.toolkit.build(this.ns(e,s),{headless:!0,rootName:String(s),renderOpts:{pretty:!1}}),l=this.signedInfo(o,i),c=await this.signOrLeft(l,n);if(c.isLeft())return c;let f=e;return f.Signature=this.assemble(l,c.value,a),Gr(f)}ns(e,t){let n=e.$?.xmlns,{$:s,...i}=e[t],{xmlns:a,...o}=s??{};return{$:{xmlns:n,...o},...i}}};var RI=class extends pf{static{u(this,"XmlSigner")}async sign(e,t,n){let{tag:s,mark:i}=t,{certificate:a}=n,o=this.toolkit.getNode(e,s);if(!o)return zt(new Mt(`Node ${s} not found`));let l=this.signedInfo(o,i),c=await this.signOrLeft(l,n);if(c.isLeft())return c;let f=await this.toolkit.build(this.assemble(l,c.value,a),{rootName:"Signature"});return Gr(this.toolkit.appendNode(e,f))}};import"reflect-metadata";import{validateSync as n6}from"class-validator";import"reflect-metadata";var e0="__SkipValidation__",Gee=u(()=>(r,e)=>{Reflect.defineMetadata(e0,!0,r,e.toString())},"SkipValidation"),Wee=u(()=>r=>{Reflect.defineMetadata(e0,!0,r)},"SkipAllValidations");import{plainToInstance as r6}from"class-transformer";var ky=u(r=>{for(let[e,t]of Object.entries(r))typeof t>"u"&&delete r[e],t===""&&delete r[e],t&&typeof t=="object"&&ky(t)},"clearEmptyValues"),OI=u((r,e,t={})=>{let n=r6(e,r);return t.clearEmptyValues&&ky(n),n},"plainToInstance");var _I="__ValidateErrors__",PI=u((r,e)=>r.reduce((t,n)=>{if(n.children?.length)return t.concat(PI(n.children,e?`${e}.${n.property}`:n.property));let s=Object.values(n.constraints??{}).map(i=>e?`${e}.${i}`:i).join(", ");return s?t.concat(s):t},[]),"mapConstraintsToErrors"),ste=u((r,e)=>(t,n,s)=>{let i=s.value;if(i==null)return;let a=u((o,l,c)=>{let f=OI(l,r),p=n6(f,{whitelist:!0});if(ky(f),p.length){let d=Reflect.getMetadata(_I,o)??[];Reflect.defineMetadata(_I,d.concat(PI(p,c)),o)}return f},"validate");s.value=function(...o){let l=Reflect.getMetadata(e0,this.constructor);if(Reflect.getMetadata(e0,this.constructor.prototype,n.toString())===!0||l===!0)return i.apply(this,o);let[f,...p]=o;if(!f)return i.apply(this,o);let d=e?.each&&Array.isArray(f)?f.map((m,g)=>a(this,m,`${i.name}.${g}`)):a(this,f,i.name);return i.apply(this,[d,...p])}},"Validates");import"reflect-metadata";var df=9e15,oo=1e9,yA="0123456789abcdef",Fy="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Uy="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",vA={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-df,maxE:df,crypto:!1},FI,ia,gt=!0,jy="[DecimalError] ",ao=jy+"Invalid argument: ",UI=jy+"Precision limit exceeded",MI=jy+"crypto unavailable",jI="[object Decimal]",In=Math.floor,Wr=Math.pow,s6=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,i6=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,a6=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,qI=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Ys=1e7,lt=7,o6=9007199254740991,u6=Fy.length-1,EA=Uy.length-1,Ce={toStringTag:jI};Ce.absoluteValue=Ce.abs=function(){var r=new this.constructor(this);return r.s<0&&(r.s=1),rt(r)};Ce.ceil=function(){return rt(new this.constructor(this),this.e+1,2)};Ce.clampedTo=Ce.clamp=function(r,e){var t,n=this,s=n.constructor;if(r=new s(r),e=new s(e),!r.s||!e.s)return new s(NaN);if(r.gt(e))throw Error(ao+e);return t=n.cmp(r),t<0?r:n.cmp(e)>0?e:new s(n)};Ce.comparedTo=Ce.cmp=function(r){var e,t,n,s,i=this,a=i.d,o=(r=new i.constructor(r)).d,l=i.s,c=r.s;if(!a||!o)return!l||!c?NaN:l!==c?l:a===o?0:!a^l<0?1:-1;if(!a[0]||!o[0])return a[0]?l:o[0]?-c:0;if(l!==c)return l;if(i.e!==r.e)return i.e>r.e^l<0?1:-1;for(n=a.length,s=o.length,e=0,t=n<s?n:s;e<t;++e)if(a[e]!==o[e])return a[e]>o[e]^l<0?1:-1;return n===s?0:n>s^l<0?1:-1};Ce.cosine=Ce.cos=function(){var r,e,t=this,n=t.constructor;return t.d?t.d[0]?(r=n.precision,e=n.rounding,n.precision=r+Math.max(t.e,t.sd())+lt,n.rounding=1,t=l6(n,GI(n,t)),n.precision=r,n.rounding=e,rt(ia==2||ia==3?t.neg():t,r,e,!0)):new n(1):new n(NaN)};Ce.cubeRoot=Ce.cbrt=function(){var r,e,t,n,s,i,a,o,l,c,f=this,p=f.constructor;if(!f.isFinite()||f.isZero())return new p(f);for(gt=!1,i=f.s*Wr(f.s*f,1/3),!i||Math.abs(i)==1/0?(t=gn(f.d),r=f.e,(i=(r-t.length+1)%3)&&(t+=i==1||i==-2?"0":"00"),i=Wr(t,1/3),r=In((r+1)/3)-(r%3==(r<0?-1:2)),i==1/0?t="5e"+r:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+r),n=new p(t),n.s=f.s):n=new p(i.toString()),a=(r=p.precision)+3;;)if(o=n,l=o.times(o).times(o),c=l.plus(f),n=cr(c.plus(f).times(o),c.plus(l),a+2,1),gn(o.d).slice(0,a)===(t=gn(n.d)).slice(0,a))if(t=t.slice(a-3,a+1),t=="9999"||!s&&t=="4999"){if(!s&&(rt(o,r+1,0),o.times(o).times(o).eq(f))){n=o;break}a+=4,s=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(rt(n,r+1,1),e=!n.times(n).times(n).eq(f));break}return gt=!0,rt(n,r,p.rounding,e)};Ce.decimalPlaces=Ce.dp=function(){var r,e=this.d,t=NaN;if(e){if(r=e.length-1,t=(r-In(this.e/lt))*lt,r=e[r],r)for(;r%10==0;r/=10)t--;t<0&&(t=0)}return t};Ce.dividedBy=Ce.div=function(r){return cr(this,new this.constructor(r))};Ce.dividedToIntegerBy=Ce.divToInt=function(r){var e=this,t=e.constructor;return rt(cr(e,new t(r),0,1,1),t.precision,t.rounding)};Ce.equals=Ce.eq=function(r){return this.cmp(r)===0};Ce.floor=function(){return rt(new this.constructor(this),this.e+1,3)};Ce.greaterThan=Ce.gt=function(r){return this.cmp(r)>0};Ce.greaterThanOrEqualTo=Ce.gte=function(r){var e=this.cmp(r);return e==1||e===0};Ce.hyperbolicCosine=Ce.cosh=function(){var r,e,t,n,s,i=this,a=i.constructor,o=new a(1);if(!i.isFinite())return new a(i.s?1/0:NaN);if(i.isZero())return o;t=a.precision,n=a.rounding,a.precision=t+Math.max(i.e,i.sd())+4,a.rounding=1,s=i.d.length,s<32?(r=Math.ceil(s/3),e=(1/Hy(4,r)).toString()):(r=16,e="2.3283064365386962890625e-10"),i=mf(a,1,i.times(e),new a(1),!0);for(var l,c=r,f=new a(8);c--;)l=i.times(i),i=o.minus(l.times(f.minus(l.times(f))));return rt(i,a.precision=t,a.rounding=n,!0)};Ce.hyperbolicSine=Ce.sinh=function(){var r,e,t,n,s=this,i=s.constructor;if(!s.isFinite()||s.isZero())return new i(s);if(e=i.precision,t=i.rounding,i.precision=e+Math.max(s.e,s.sd())+4,i.rounding=1,n=s.d.length,n<3)s=mf(i,2,s,s,!0);else{r=1.4*Math.sqrt(n),r=r>16?16:r|0,s=s.times(1/Hy(5,r)),s=mf(i,2,s,s,!0);for(var a,o=new i(5),l=new i(16),c=new i(20);r--;)a=s.times(s),s=s.times(o.plus(a.times(l.times(a).plus(c))))}return i.precision=e,i.rounding=t,rt(s,e,t,!0)};Ce.hyperbolicTangent=Ce.tanh=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+7,n.rounding=1,cr(t.sinh(),t.cosh(),n.precision=r,n.rounding=e)):new n(t.s)};Ce.inverseCosine=Ce.acos=function(){var r=this,e=r.constructor,t=r.abs().cmp(1),n=e.precision,s=e.rounding;return t!==-1?t===0?r.isNeg()?yi(e,n,s):new e(0):new e(NaN):r.isZero()?yi(e,n+4,s).times(.5):(e.precision=n+6,e.rounding=1,r=new e(1).minus(r).div(r.plus(1)).sqrt().atan(),e.precision=n,e.rounding=s,r.times(2))};Ce.inverseHyperbolicCosine=Ce.acosh=function(){var r,e,t=this,n=t.constructor;return t.lte(1)?new n(t.eq(1)?0:NaN):t.isFinite()?(r=n.precision,e=n.rounding,n.precision=r+Math.max(Math.abs(t.e),t.sd())+4,n.rounding=1,gt=!1,t=t.times(t).minus(1).sqrt().plus(t),gt=!0,n.precision=r,n.rounding=e,t.ln()):new n(t)};Ce.inverseHyperbolicSine=Ce.asinh=function(){var r,e,t=this,n=t.constructor;return!t.isFinite()||t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+2*Math.max(Math.abs(t.e),t.sd())+6,n.rounding=1,gt=!1,t=t.times(t).plus(1).sqrt().plus(t),gt=!0,n.precision=r,n.rounding=e,t.ln())};Ce.inverseHyperbolicTangent=Ce.atanh=function(){var r,e,t,n,s=this,i=s.constructor;return s.isFinite()?s.e>=0?new i(s.abs().eq(1)?s.s/0:s.isZero()?s:NaN):(r=i.precision,e=i.rounding,n=s.sd(),Math.max(n,r)<2*-s.e-1?rt(new i(s),r,e,!0):(i.precision=t=n-s.e,s=cr(s.plus(1),new i(1).minus(s),t+r,1),i.precision=r+4,i.rounding=1,s=s.ln(),i.precision=r,i.rounding=e,s.times(.5))):new i(NaN)};Ce.inverseSine=Ce.asin=function(){var r,e,t,n,s=this,i=s.constructor;return s.isZero()?new i(s):(e=s.abs().cmp(1),t=i.precision,n=i.rounding,e!==-1?e===0?(r=yi(i,t+4,n).times(.5),r.s=s.s,r):new i(NaN):(i.precision=t+6,i.rounding=1,s=s.div(new i(1).minus(s.times(s)).sqrt().plus(1)).atan(),i.precision=t,i.rounding=n,s.times(2)))};Ce.inverseTangent=Ce.atan=function(){var r,e,t,n,s,i,a,o,l,c=this,f=c.constructor,p=f.precision,d=f.rounding;if(c.isFinite()){if(c.isZero())return new f(c);if(c.abs().eq(1)&&p+4<=EA)return a=yi(f,p+4,d).times(.25),a.s=c.s,a}else{if(!c.s)return new f(NaN);if(p+4<=EA)return a=yi(f,p+4,d).times(.5),a.s=c.s,a}for(f.precision=o=p+10,f.rounding=1,t=Math.min(28,o/lt+2|0),r=t;r;--r)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(gt=!1,e=Math.ceil(o/lt),n=1,l=c.times(c),a=new f(c),s=c;r!==-1;)if(s=s.times(l),i=a.minus(s.div(n+=2)),s=s.times(l),a=i.plus(s.div(n+=2)),a.d[e]!==void 0)for(r=e;a.d[r]===i.d[r]&&r--;);return t&&(a=a.times(2<<t-1)),gt=!0,rt(a,f.precision=p,f.rounding=d,!0)};Ce.isFinite=function(){return!!this.d};Ce.isInteger=Ce.isInt=function(){return!!this.d&&In(this.e/lt)>this.d.length-2};Ce.isNaN=function(){return!this.s};Ce.isNegative=Ce.isNeg=function(){return this.s<0};Ce.isPositive=Ce.isPos=function(){return this.s>0};Ce.isZero=function(){return!!this.d&&this.d[0]===0};Ce.lessThan=Ce.lt=function(r){return this.cmp(r)<0};Ce.lessThanOrEqualTo=Ce.lte=function(r){return this.cmp(r)<1};Ce.logarithm=Ce.log=function(r){var e,t,n,s,i,a,o,l,c=this,f=c.constructor,p=f.precision,d=f.rounding,m=5;if(r==null)r=new f(10),e=!0;else{if(r=new f(r),t=r.d,r.s<0||!t||!t[0]||r.eq(1))return new f(NaN);e=r.eq(10)}if(t=c.d,c.s<0||!t||!t[0]||c.eq(1))return new f(t&&!t[0]?-1/0:c.s!=1?NaN:t?0:1/0);if(e)if(t.length>1)i=!0;else{for(s=t[0];s%10===0;)s/=10;i=s!==1}if(gt=!1,o=p+m,a=io(c,o),n=e?My(f,o+10):io(r,o),l=cr(a,n,o,1),t0(l.d,s=p,d))do if(o+=10,a=io(c,o),n=e?My(f,o+10):io(r,o),l=cr(a,n,o,1),!i){+gn(l.d).slice(s+1,s+15)+1==1e14&&(l=rt(l,p+1,0));break}while(t0(l.d,s+=10,d));return gt=!0,rt(l,p,d)};Ce.minus=Ce.sub=function(r){var e,t,n,s,i,a,o,l,c,f,p,d,m=this,g=m.constructor;if(r=new g(r),!m.d||!r.d)return!m.s||!r.s?r=new g(NaN):m.d?r.s=-r.s:r=new g(r.d||m.s!==r.s?m:NaN),r;if(m.s!=r.s)return r.s=-r.s,m.plus(r);if(c=m.d,d=r.d,o=g.precision,l=g.rounding,!c[0]||!d[0]){if(d[0])r.s=-r.s;else if(c[0])r=new g(m);else return new g(l===3?-0:0);return gt?rt(r,o,l):r}if(t=In(r.e/lt),f=In(m.e/lt),c=c.slice(),i=f-t,i){for(p=i<0,p?(e=c,i=-i,a=d.length):(e=d,t=f,a=c.length),n=Math.max(Math.ceil(o/lt),a)+2,i>n&&(i=n,e.length=1),e.reverse(),n=i;n--;)e.push(0);e.reverse()}else{for(n=c.length,a=d.length,p=n<a,p&&(a=n),n=0;n<a;n++)if(c[n]!=d[n]){p=c[n]<d[n];break}i=0}for(p&&(e=c,c=d,d=e,r.s=-r.s),a=c.length,n=d.length-a;n>0;--n)c[a++]=0;for(n=d.length;n>i;){if(c[--n]<d[n]){for(s=n;s&&c[--s]===0;)c[s]=Ys-1;--c[s],c[n]+=Ys}c[n]-=d[n]}for(;c[--a]===0;)c.pop();for(;c[0]===0;c.shift())--t;return c[0]?(r.d=c,r.e=qy(c,t),gt?rt(r,o,l):r):new g(l===3?-0:0)};Ce.modulo=Ce.mod=function(r){var e,t=this,n=t.constructor;return r=new n(r),!t.d||!r.s||r.d&&!r.d[0]?new n(NaN):!r.d||t.d&&!t.d[0]?rt(new n(t),n.precision,n.rounding):(gt=!1,n.modulo==9?(e=cr(t,r.abs(),0,3,1),e.s*=r.s):e=cr(t,r,0,n.modulo,1),e=e.times(r),gt=!0,t.minus(e))};Ce.naturalExponential=Ce.exp=function(){return wA(this)};Ce.naturalLogarithm=Ce.ln=function(){return io(this)};Ce.negated=Ce.neg=function(){var r=new this.constructor(this);return r.s=-r.s,rt(r)};Ce.plus=Ce.add=function(r){var e,t,n,s,i,a,o,l,c,f,p=this,d=p.constructor;if(r=new d(r),!p.d||!r.d)return!p.s||!r.s?r=new d(NaN):p.d||(r=new d(r.d||p.s===r.s?p:NaN)),r;if(p.s!=r.s)return r.s=-r.s,p.minus(r);if(c=p.d,f=r.d,o=d.precision,l=d.rounding,!c[0]||!f[0])return f[0]||(r=new d(p)),gt?rt(r,o,l):r;if(i=In(p.e/lt),n=In(r.e/lt),c=c.slice(),s=i-n,s){for(s<0?(t=c,s=-s,a=f.length):(t=f,n=i,a=c.length),i=Math.ceil(o/lt),a=i>a?i+1:a+1,s>a&&(s=a,t.length=1),t.reverse();s--;)t.push(0);t.reverse()}for(a=c.length,s=f.length,a-s<0&&(s=a,t=f,f=c,c=t),e=0;s;)e=(c[--s]=c[s]+f[s]+e)/Ys|0,c[s]%=Ys;for(e&&(c.unshift(e),++n),a=c.length;c[--a]==0;)c.pop();return r.d=c,r.e=qy(c,n),gt?rt(r,o,l):r};Ce.precision=Ce.sd=function(r){var e,t=this;if(r!==void 0&&r!==!!r&&r!==1&&r!==0)throw Error(ao+r);return t.d?(e=HI(t.d),r&&t.e+1>e&&(e=t.e+1)):e=NaN,e};Ce.round=function(){var r=this,e=r.constructor;return rt(new e(r),r.e+1,e.rounding)};Ce.sine=Ce.sin=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+Math.max(t.e,t.sd())+lt,n.rounding=1,t=f6(n,GI(n,t)),n.precision=r,n.rounding=e,rt(ia>2?t.neg():t,r,e,!0)):new n(NaN)};Ce.squareRoot=Ce.sqrt=function(){var r,e,t,n,s,i,a=this,o=a.d,l=a.e,c=a.s,f=a.constructor;if(c!==1||!o||!o[0])return new f(!c||c<0&&(!o||o[0])?NaN:o?a:1/0);for(gt=!1,c=Math.sqrt(+a),c==0||c==1/0?(e=gn(o),(e.length+l)%2==0&&(e+="0"),c=Math.sqrt(e),l=In((l+1)/2)-(l<0||l%2),c==1/0?e="5e"+l:(e=c.toExponential(),e=e.slice(0,e.indexOf("e")+1)+l),n=new f(e)):n=new f(c.toString()),t=(l=f.precision)+3;;)if(i=n,n=i.plus(cr(a,i,t+2,1)).times(.5),gn(i.d).slice(0,t)===(e=gn(n.d)).slice(0,t))if(e=e.slice(t-3,t+1),e=="9999"||!s&&e=="4999"){if(!s&&(rt(i,l+1,0),i.times(i).eq(a))){n=i;break}t+=4,s=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(rt(n,l+1,1),r=!n.times(n).eq(a));break}return gt=!0,rt(n,l,f.rounding,r)};Ce.tangent=Ce.tan=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+10,n.rounding=1,t=t.sin(),t.s=1,t=cr(t,new n(1).minus(t.times(t)).sqrt(),r+10,0),n.precision=r,n.rounding=e,rt(ia==2||ia==4?t.neg():t,r,e,!0)):new n(NaN)};Ce.times=Ce.mul=function(r){var e,t,n,s,i,a,o,l,c,f=this,p=f.constructor,d=f.d,m=(r=new p(r)).d;if(r.s*=f.s,!d||!d[0]||!m||!m[0])return new p(!r.s||d&&!d[0]&&!m||m&&!m[0]&&!d?NaN:!d||!m?r.s/0:r.s*0);for(t=In(f.e/lt)+In(r.e/lt),l=d.length,c=m.length,l<c&&(i=d,d=m,m=i,a=l,l=c,c=a),i=[],a=l+c,n=a;n--;)i.push(0);for(n=c;--n>=0;){for(e=0,s=l+n;s>n;)o=i[s]+m[n]*d[s-n-1]+e,i[s--]=o%Ys|0,e=o/Ys|0;i[s]=(i[s]+e)%Ys|0}for(;!i[--a];)i.pop();return e?++t:i.shift(),r.d=i,r.e=qy(i,t),gt?rt(r,p.precision,p.rounding):r};Ce.toBinary=function(r,e){return SA(this,2,r,e)};Ce.toDecimalPlaces=Ce.toDP=function(r,e){var t=this,n=t.constructor;return t=new n(t),r===void 0?t:($n(r,0,oo),e===void 0?e=n.rounding:$n(e,0,8),rt(t,r+t.e+1,e))};Ce.toExponential=function(r,e){var t,n=this,s=n.constructor;return r===void 0?t=vi(n,!0):($n(r,0,oo),e===void 0?e=s.rounding:$n(e,0,8),n=rt(new s(n),r+1,e),t=vi(n,!0,r+1)),n.isNeg()&&!n.isZero()?"-"+t:t};Ce.toFixed=function(r,e){var t,n,s=this,i=s.constructor;return r===void 0?t=vi(s):($n(r,0,oo),e===void 0?e=i.rounding:$n(e,0,8),n=rt(new i(s),r+s.e+1,e),t=vi(n,!1,r+n.e+1)),s.isNeg()&&!s.isZero()?"-"+t:t};Ce.toFraction=function(r){var e,t,n,s,i,a,o,l,c,f,p,d,m=this,g=m.d,S=m.constructor;if(!g)return new S(m);if(c=t=new S(1),n=l=new S(0),e=new S(n),i=e.e=HI(g)-m.e-1,a=i%lt,e.d[0]=Wr(10,a<0?lt+a:a),r==null)r=i>0?e:c;else{if(o=new S(r),!o.isInt()||o.lt(c))throw Error(ao+o);r=o.gt(e)?i>0?e:c:o}for(gt=!1,o=new S(gn(g)),f=S.precision,S.precision=i=g.length*lt*2;p=cr(o,e,0,1,1),s=t.plus(p.times(n)),s.cmp(r)!=1;)t=n,n=s,s=c,c=l.plus(p.times(s)),l=s,s=e,e=o.minus(p.times(s)),o=s;return s=cr(r.minus(t),n,0,1,1),l=l.plus(s.times(c)),t=t.plus(s.times(n)),l.s=c.s=m.s,d=cr(c,n,i,1).minus(m).abs().cmp(cr(l,t,i,1).minus(m).abs())<1?[c,n]:[l,t],S.precision=f,gt=!0,d};Ce.toHexadecimal=Ce.toHex=function(r,e){return SA(this,16,r,e)};Ce.toNearest=function(r,e){var t=this,n=t.constructor;if(t=new n(t),r==null){if(!t.d)return t;r=new n(1),e=n.rounding}else{if(r=new n(r),e===void 0?e=n.rounding:$n(e,0,8),!t.d)return r.s?t:r;if(!r.d)return r.s&&(r.s=t.s),r}return r.d[0]?(gt=!1,t=cr(t,r,0,e,1).times(r),gt=!0,rt(t)):(r.s=t.s,t=r),t};Ce.toNumber=function(){return+this};Ce.toOctal=function(r,e){return SA(this,8,r,e)};Ce.toPower=Ce.pow=function(r){var e,t,n,s,i,a,o=this,l=o.constructor,c=+(r=new l(r));if(!o.d||!r.d||!o.d[0]||!r.d[0])return new l(Wr(+o,c));if(o=new l(o),o.eq(1))return o;if(n=l.precision,i=l.rounding,r.eq(1))return rt(o,n,i);if(e=In(r.e/lt),e>=r.d.length-1&&(t=c<0?-c:c)<=o6)return s=KI(l,o,t,n),r.s<0?new l(1).div(s):rt(s,n,i);if(a=o.s,a<0){if(e<r.d.length-1)return new l(NaN);if((r.d[e]&1)==0&&(a=1),o.e==0&&o.d[0]==1&&o.d.length==1)return o.s=a,o}return t=Wr(+o,c),e=t==0||!isFinite(t)?In(c*(Math.log("0."+gn(o.d))/Math.LN10+o.e+1)):new l(t+"").e,e>l.maxE+1||e<l.minE-1?new l(e>0?a/0:0):(gt=!1,l.rounding=o.s=1,t=Math.min(12,(e+"").length),s=wA(r.times(io(o,n+t)),n),s.d&&(s=rt(s,n+5,1),t0(s.d,n,i)&&(e=n+10,s=rt(wA(r.times(io(o,e+t)),e),e+5,1),+gn(s.d).slice(n+1,n+15)+1==1e14&&(s=rt(s,n+1,0)))),s.s=a,gt=!0,l.rounding=i,rt(s,n,i))};Ce.toPrecision=function(r,e){var t,n=this,s=n.constructor;return r===void 0?t=vi(n,n.e<=s.toExpNeg||n.e>=s.toExpPos):($n(r,1,oo),e===void 0?e=s.rounding:$n(e,0,8),n=rt(new s(n),r,e),t=vi(n,r<=n.e||n.e<=s.toExpNeg,r)),n.isNeg()&&!n.isZero()?"-"+t:t};Ce.toSignificantDigits=Ce.toSD=function(r,e){var t=this,n=t.constructor;return r===void 0?(r=n.precision,e=n.rounding):($n(r,1,oo),e===void 0?e=n.rounding:$n(e,0,8)),rt(new n(t),r,e)};Ce.toString=function(){var r=this,e=r.constructor,t=vi(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()&&!r.isZero()?"-"+t:t};Ce.truncated=Ce.trunc=function(){return rt(new this.constructor(this),this.e+1,1)};Ce.valueOf=Ce.toJSON=function(){var r=this,e=r.constructor,t=vi(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()?"-"+t:t};function gn(r){var e,t,n,s=r.length-1,i="",a=r[0];if(s>0){for(i+=a,e=1;e<s;e++)n=r[e]+"",t=lt-n.length,t&&(i+=so(t)),i+=n;a=r[e],n=a+"",t=lt-n.length,t&&(i+=so(t))}else if(a===0)return"0";for(;a%10===0;)a/=10;return i+a}u(gn,"digitsToString");function $n(r,e,t){if(r!==~~r||r<e||r>t)throw Error(ao+r)}u($n,"checkInt32");function t0(r,e,t,n){var s,i,a,o;for(i=r[0];i>=10;i/=10)--e;return--e<0?(e+=lt,s=0):(s=Math.ceil((e+1)/lt),e%=lt),i=Wr(10,lt-e),o=r[s]%i|0,n==null?e<3?(e==0?o=o/100|0:e==1&&(o=o/10|0),a=t<4&&o==99999||t>3&&o==49999||o==5e4||o==0):a=(t<4&&o+1==i||t>3&&o+1==i/2)&&(r[s+1]/i/100|0)==Wr(10,e-2)-1||(o==i/2||o==0)&&(r[s+1]/i/100|0)==0:e<4?(e==0?o=o/1e3|0:e==1?o=o/100|0:e==2&&(o=o/10|0),a=(n||t<4)&&o==9999||!n&&t>3&&o==4999):a=((n||t<4)&&o+1==i||!n&&t>3&&o+1==i/2)&&(r[s+1]/i/1e3|0)==Wr(10,e-3)-1,a}u(t0,"checkRoundingDigits");function Ly(r,e,t){for(var n,s=[0],i,a=0,o=r.length;a<o;){for(i=s.length;i--;)s[i]*=e;for(s[0]+=yA.indexOf(r.charAt(a++)),n=0;n<s.length;n++)s[n]>t-1&&(s[n+1]===void 0&&(s[n+1]=0),s[n+1]+=s[n]/t|0,s[n]%=t)}return s.reverse()}u(Ly,"convertBase");function l6(r,e){var t,n,s;if(e.isZero())return e;n=e.d.length,n<32?(t=Math.ceil(n/3),s=(1/Hy(4,t)).toString()):(t=16,s="2.3283064365386962890625e-10"),r.precision+=t,e=mf(r,1,e.times(s),new r(1));for(var i=t;i--;){var a=e.times(e);e=a.times(a).minus(a).times(8).plus(1)}return r.precision-=t,e}u(l6,"cosine");var cr=(function(){function r(n,s,i){var a,o=0,l=n.length;for(n=n.slice();l--;)a=n[l]*s+o,n[l]=a%i|0,o=a/i|0;return o&&n.unshift(o),n}u(r,"multiplyInteger");function e(n,s,i,a){var o,l;if(i!=a)l=i>a?1:-1;else for(o=l=0;o<i;o++)if(n[o]!=s[o]){l=n[o]>s[o]?1:-1;break}return l}u(e,"compare");function t(n,s,i,a){for(var o=0;i--;)n[i]-=o,o=n[i]<s[i]?1:0,n[i]=o*a+n[i]-s[i];for(;!n[0]&&n.length>1;)n.shift()}return u(t,"subtract"),function(n,s,i,a,o,l){var c,f,p,d,m,g,S,y,w,C,E,v,A,b,U,D,B,V,F,j,se=n.constructor,Y=n.s==s.s?1:-1,ne=n.d,W=s.d;if(!ne||!ne[0]||!W||!W[0])return new se(!n.s||!s.s||(ne?W&&ne[0]==W[0]:!W)?NaN:ne&&ne[0]==0||!W?Y*0:Y/0);for(l?(m=1,f=n.e-s.e):(l=Ys,m=lt,f=In(n.e/m)-In(s.e/m)),F=W.length,B=ne.length,w=new se(Y),C=w.d=[],p=0;W[p]==(ne[p]||0);p++);if(W[p]>(ne[p]||0)&&f--,i==null?(b=i=se.precision,a=se.rounding):o?b=i+(n.e-s.e)+1:b=i,b<0)C.push(1),g=!0;else{if(b=b/m+2|0,p=0,F==1){for(d=0,W=W[0],b++;(p<B||d)&&b--;p++)U=d*l+(ne[p]||0),C[p]=U/W|0,d=U%W|0;g=d||p<B}else{for(d=l/(W[0]+1)|0,d>1&&(W=r(W,d,l),ne=r(ne,d,l),F=W.length,B=ne.length),D=F,E=ne.slice(0,F),v=E.length;v<F;)E[v++]=0;j=W.slice(),j.unshift(0),V=W[0],W[1]>=l/2&&++V;do d=0,c=e(W,E,F,v),c<0?(A=E[0],F!=v&&(A=A*l+(E[1]||0)),d=A/V|0,d>1?(d>=l&&(d=l-1),S=r(W,d,l),y=S.length,v=E.length,c=e(S,E,y,v),c==1&&(d--,t(S,F<y?j:W,y,l))):(d==0&&(c=d=1),S=W.slice()),y=S.length,y<v&&S.unshift(0),t(E,S,v,l),c==-1&&(v=E.length,c=e(W,E,F,v),c<1&&(d++,t(E,F<v?j:W,v,l))),v=E.length):c===0&&(d++,E=[0]),C[p++]=d,c&&E[0]?E[v++]=ne[D]||0:(E=[ne[D]],v=1);while((D++<B||E[0]!==void 0)&&b--);g=E[0]!==void 0}C[0]||C.shift()}if(m==1)w.e=f,FI=g;else{for(p=1,d=C[0];d>=10;d/=10)p++;w.e=p+f*m-1,rt(w,o?i+w.e+1:i,a,g)}return w}})();function rt(r,e,t,n){var s,i,a,o,l,c,f,p,d,m=r.constructor;e:if(e!=null){if(p=r.d,!p)return r;for(s=1,o=p[0];o>=10;o/=10)s++;if(i=e-s,i<0)i+=lt,a=e,f=p[d=0],l=f/Wr(10,s-a-1)%10|0;else if(d=Math.ceil((i+1)/lt),o=p.length,d>=o)if(n){for(;o++<=d;)p.push(0);f=l=0,s=1,i%=lt,a=i-lt+1}else break e;else{for(f=o=p[d],s=1;o>=10;o/=10)s++;i%=lt,a=i-lt+s,l=a<0?0:f/Wr(10,s-a-1)%10|0}if(n=n||e<0||p[d+1]!==void 0||(a<0?f:f%Wr(10,s-a-1)),c=t<4?(l||n)&&(t==0||t==(r.s<0?3:2)):l>5||l==5&&(t==4||n||t==6&&(i>0?a>0?f/Wr(10,s-a):0:p[d-1])%10&1||t==(r.s<0?8:7)),e<1||!p[0])return p.length=0,c?(e-=r.e+1,p[0]=Wr(10,(lt-e%lt)%lt),r.e=-e||0):p[0]=r.e=0,r;if(i==0?(p.length=d,o=1,d--):(p.length=d+1,o=Wr(10,lt-i),p[d]=a>0?(f/Wr(10,s-a)%Wr(10,a)|0)*o:0),c)for(;;)if(d==0){for(i=1,a=p[0];a>=10;a/=10)i++;for(a=p[0]+=o,o=1;a>=10;a/=10)o++;i!=o&&(r.e++,p[0]==Ys&&(p[0]=1));break}else{if(p[d]+=o,p[d]!=Ys)break;p[d--]=0,o=1}for(i=p.length;p[--i]===0;)p.pop()}return gt&&(r.e>m.maxE?(r.d=null,r.e=NaN):r.e<m.minE&&(r.e=0,r.d=[0])),r}u(rt,"finalise");function vi(r,e,t){if(!r.isFinite())return $I(r);var n,s=r.e,i=gn(r.d),a=i.length;return e?(t&&(n=t-a)>0?i=i.charAt(0)+"."+i.slice(1)+so(n):a>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(r.e<0?"e":"e+")+r.e):s<0?(i="0."+so(-s-1)+i,t&&(n=t-a)>0&&(i+=so(n))):s>=a?(i+=so(s+1-a),t&&(n=t-s-1)>0&&(i=i+"."+so(n))):((n=s+1)<a&&(i=i.slice(0,n)+"."+i.slice(n)),t&&(n=t-a)>0&&(s+1===a&&(i+="."),i+=so(n))),i}u(vi,"finiteToString");function qy(r,e){var t=r[0];for(e*=lt;t>=10;t/=10)e++;return e}u(qy,"getBase10Exponent");function My(r,e,t){if(e>u6)throw gt=!0,t&&(r.precision=t),Error(UI);return rt(new r(Fy),e,1,!0)}u(My,"getLn10");function yi(r,e,t){if(e>EA)throw Error(UI);return rt(new r(Uy),e,t,!0)}u(yi,"getPi");function HI(r){var e=r.length-1,t=e*lt+1;if(e=r[e],e){for(;e%10==0;e/=10)t--;for(e=r[0];e>=10;e/=10)t++}return t}u(HI,"getPrecision");function so(r){for(var e="";r--;)e+="0";return e}u(so,"getZeroString");function KI(r,e,t,n){var s,i=new r(1),a=Math.ceil(n/lt+4);for(gt=!1;;){if(t%2&&(i=i.times(e),LI(i.d,a)&&(s=!0)),t=In(t/2),t===0){t=i.d.length-1,s&&i.d[t]===0&&++i.d[t];break}e=e.times(e),LI(e.d,a)}return gt=!0,i}u(KI,"intPow");function kI(r){return r.d[r.d.length-1]&1}u(kI,"isOdd");function XI(r,e,t){for(var n,s,i=new r(e[0]),a=0;++a<e.length;){if(s=new r(e[a]),!s.s){i=s;break}n=i.cmp(s),(n===t||n===0&&i.s===t)&&(i=s)}return i}u(XI,"maxOrMin");function wA(r,e){var t,n,s,i,a,o,l,c=0,f=0,p=0,d=r.constructor,m=d.rounding,g=d.precision;if(!r.d||!r.d[0]||r.e>17)return new d(r.d?r.d[0]?r.s<0?0:1/0:1:r.s?r.s<0?0:r:NaN);for(e==null?(gt=!1,l=g):l=e,o=new d(.03125);r.e>-2;)r=r.times(o),p+=5;for(n=Math.log(Wr(2,p))/Math.LN10*2+5|0,l+=n,t=i=a=new d(1),d.precision=l;;){if(i=rt(i.times(r),l,1),t=t.times(++f),o=a.plus(cr(i,t,l,1)),gn(o.d).slice(0,l)===gn(a.d).slice(0,l)){for(s=p;s--;)a=rt(a.times(a),l,1);if(e==null)if(c<3&&t0(a.d,l-n,m,c))d.precision=l+=10,t=i=o=new d(1),f=0,c++;else return rt(a,d.precision=g,m,gt=!0);else return d.precision=g,a}a=o}}u(wA,"naturalExponential");function io(r,e){var t,n,s,i,a,o,l,c,f,p,d,m=1,g=10,S=r,y=S.d,w=S.constructor,C=w.rounding,E=w.precision;if(S.s<0||!y||!y[0]||!S.e&&y[0]==1&&y.length==1)return new w(y&&!y[0]?-1/0:S.s!=1?NaN:y?0:S);if(e==null?(gt=!1,f=E):f=e,w.precision=f+=g,t=gn(y),n=t.charAt(0),Math.abs(i=S.e)<15e14){for(;n<7&&n!=1||n==1&&t.charAt(1)>3;)S=S.times(r),t=gn(S.d),n=t.charAt(0),m++;i=S.e,n>1?(S=new w("0."+t),i++):S=new w(n+"."+t.slice(1))}else return c=My(w,f+2,E).times(i+""),S=io(new w(n+"."+t.slice(1)),f-g).plus(c),w.precision=E,e==null?rt(S,E,C,gt=!0):S;for(p=S,l=a=S=cr(S.minus(1),S.plus(1),f,1),d=rt(S.times(S),f,1),s=3;;){if(a=rt(a.times(d),f,1),c=l.plus(cr(a,new w(s),f,1)),gn(c.d).slice(0,f)===gn(l.d).slice(0,f))if(l=l.times(2),i!==0&&(l=l.plus(My(w,f+2,E).times(i+""))),l=cr(l,new w(m),f,1),e==null)if(t0(l.d,f-g,C,o))w.precision=f+=g,c=a=S=cr(p.minus(1),p.plus(1),f,1),d=rt(S.times(S),f,1),s=o=1;else return rt(l,w.precision=E,C,gt=!0);else return w.precision=E,l;l=c,s+=2}}u(io,"naturalLogarithm");function $I(r){return String(r.s*r.s/0)}u($I,"nonFiniteToString");function Vy(r,e){var t,n,s;for((t=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(t<0&&(t=n),t+=+e.slice(n+1),e=e.substring(0,n)):t<0&&(t=e.length),n=0;e.charCodeAt(n)===48;n++);for(s=e.length;e.charCodeAt(s-1)===48;--s);if(e=e.slice(n,s),e){if(s-=n,r.e=t=t-n-1,r.d=[],n=(t+1)%lt,t<0&&(n+=lt),n<s){for(n&&r.d.push(+e.slice(0,n)),s-=lt;n<s;)r.d.push(+e.slice(n,n+=lt));e=e.slice(n),n=lt-e.length}else n-=s;for(;n--;)e+="0";r.d.push(+e),gt&&(r.e>r.constructor.maxE?(r.d=null,r.e=NaN):r.e<r.constructor.minE&&(r.e=0,r.d=[0]))}else r.e=0,r.d=[0];return r}u(Vy,"parseDecimal");function c6(r,e){var t,n,s,i,a,o,l,c,f;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),qI.test(e))return Vy(r,e)}else if(e==="Infinity"||e==="NaN")return+e||(r.s=NaN),r.e=NaN,r.d=null,r;if(i6.test(e))t=16,e=e.toLowerCase();else if(s6.test(e))t=2;else if(a6.test(e))t=8;else throw Error(ao+e);for(i=e.search(/p/i),i>0?(l=+e.slice(i+1),e=e.substring(2,i)):e=e.slice(2),i=e.indexOf("."),a=i>=0,n=r.constructor,a&&(e=e.replace(".",""),o=e.length,i=o-i,s=KI(n,new n(t),i,i*2)),c=Ly(e,t,Ys),f=c.length-1,i=f;c[i]===0;--i)c.pop();return i<0?new n(r.s*0):(r.e=qy(c,f),r.d=c,gt=!1,a&&(r=cr(r,s,o*4)),l&&(r=r.times(Math.abs(l)<54?Wr(2,l):gf.pow(2,l))),gt=!0,r)}u(c6,"parseOther");function f6(r,e){var t,n=e.d.length;if(n<3)return e.isZero()?e:mf(r,2,e,e);t=1.4*Math.sqrt(n),t=t>16?16:t|0,e=e.times(1/Hy(5,t)),e=mf(r,2,e,e);for(var s,i=new r(5),a=new r(16),o=new r(20);t--;)s=e.times(e),e=e.times(i.plus(s.times(a.times(s).minus(o))));return e}u(f6,"sine");function mf(r,e,t,n,s){var i,a,o,l,c=1,f=r.precision,p=Math.ceil(f/lt);for(gt=!1,l=t.times(t),o=new r(n);;){if(a=cr(o.times(l),new r(e++*e++),f,1),o=s?n.plus(a):n.minus(a),n=cr(a.times(l),new r(e++*e++),f,1),a=o.plus(n),a.d[p]!==void 0){for(i=p;a.d[i]===o.d[i]&&i--;);if(i==-1)break}i=o,o=n,n=a,a=i,c++}return gt=!0,a.d.length=p+1,a}u(mf,"taylorSeries");function Hy(r,e){for(var t=r;--e;)t*=r;return t}u(Hy,"tinyPow");function GI(r,e){var t,n=e.s<0,s=yi(r,r.precision,1),i=s.times(.5);if(e=e.abs(),e.lte(i))return ia=n?4:1,e;if(t=e.divToInt(s),t.isZero())ia=n?3:2;else{if(e=e.minus(t.times(s)),e.lte(i))return ia=kI(t)?n?2:3:n?4:1,e;ia=kI(t)?n?1:4:n?3:2}return e.minus(s).abs()}u(GI,"toLessThanHalfPi");function SA(r,e,t,n){var s,i,a,o,l,c,f,p,d,m=r.constructor,g=t!==void 0;if(g?($n(t,1,oo),n===void 0?n=m.rounding:$n(n,0,8)):(t=m.precision,n=m.rounding),!r.isFinite())f=$I(r);else{for(f=vi(r),a=f.indexOf("."),g?(s=2,e==16?t=t*4-3:e==8&&(t=t*3-2)):s=e,a>=0&&(f=f.replace(".",""),d=new m(1),d.e=f.length-a,d.d=Ly(vi(d),10,s),d.e=d.d.length),p=Ly(f,10,s),i=l=p.length;p[--l]==0;)p.pop();if(!p[0])f=g?"0p+0":"0";else{if(a<0?i--:(r=new m(r),r.d=p,r.e=i,r=cr(r,d,t,n,0,s),p=r.d,i=r.e,c=FI),a=p[t],o=s/2,c=c||p[t+1]!==void 0,c=n<4?(a!==void 0||c)&&(n===0||n===(r.s<0?3:2)):a>o||a===o&&(n===4||c||n===6&&p[t-1]&1||n===(r.s<0?8:7)),p.length=t,c)for(;++p[--t]>s-1;)p[t]=0,t||(++i,p.unshift(1));for(l=p.length;!p[l-1];--l);for(a=0,f="";a<l;a++)f+=yA.charAt(p[a]);if(g){if(l>1)if(e==16||e==8){for(a=e==16?4:3,--l;l%a;l++)f+="0";for(p=Ly(f,s,e),l=p.length;!p[l-1];--l);for(a=1,f="1.";a<l;a++)f+=yA.charAt(p[a])}else f=f.charAt(0)+"."+f.slice(1);f=f+(i<0?"p":"p+")+i}else if(i<0){for(;++i;)f="0"+f;f="0."+f}else if(++i>l)for(i-=l;i--;)f+="0";else i<l&&(f=f.slice(0,i)+"."+f.slice(i))}f=(e==16?"0x":e==2?"0b":e==8?"0o":"")+f}return r.s<0?"-"+f:f}u(SA,"toStringBinary");function LI(r,e){if(r.length>e)return r.length=e,!0}u(LI,"truncate");function h6(r){return new this(r).abs()}u(h6,"abs");function p6(r){return new this(r).acos()}u(p6,"acos");function d6(r){return new this(r).acosh()}u(d6,"acosh");function m6(r,e){return new this(r).plus(e)}u(m6,"add");function g6(r){return new this(r).asin()}u(g6,"asin");function y6(r){return new this(r).asinh()}u(y6,"asinh");function v6(r){return new this(r).atan()}u(v6,"atan");function E6(r){return new this(r).atanh()}u(E6,"atanh");function w6(r,e){r=new this(r),e=new this(e);var t,n=this.precision,s=this.rounding,i=n+4;return!r.s||!e.s?t=new this(NaN):!r.d&&!e.d?(t=yi(this,i,1).times(e.s>0?.25:.75),t.s=r.s):!e.d||r.isZero()?(t=e.s<0?yi(this,n,s):new this(0),t.s=r.s):!r.d||e.isZero()?(t=yi(this,i,1).times(.5),t.s=r.s):e.s<0?(this.precision=i,this.rounding=1,t=this.atan(cr(r,e,i,1)),e=yi(this,i,1),this.precision=n,this.rounding=s,t=r.s<0?t.minus(e):t.plus(e)):t=this.atan(cr(r,e,i,1)),t}u(w6,"atan2");function S6(r){return new this(r).cbrt()}u(S6,"cbrt");function A6(r){return rt(r=new this(r),r.e+1,2)}u(A6,"ceil");function C6(r,e,t){return new this(r).clamp(e,t)}u(C6,"clamp");function b6(r){if(!r||typeof r!="object")throw Error(jy+"Object expected");var e,t,n,s=r.defaults===!0,i=["precision",1,oo,"rounding",0,8,"toExpNeg",-df,0,"toExpPos",0,df,"maxE",0,df,"minE",-df,0,"modulo",0,9];for(e=0;e<i.length;e+=3)if(t=i[e],s&&(this[t]=vA[t]),(n=r[t])!==void 0)if(In(n)===n&&n>=i[e+1]&&n<=i[e+2])this[t]=n;else throw Error(ao+t+": "+n);if(t="crypto",s&&(this[t]=vA[t]),(n=r[t])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[t]=!0;else throw Error(MI);else this[t]=!1;else throw Error(ao+t+": "+n);return this}u(b6,"config");function x6(r){return new this(r).cos()}u(x6,"cos");function N6(r){return new this(r).cosh()}u(N6,"cosh");function WI(r){var e,t,n;function s(i){var a,o,l,c=this;if(!(c instanceof s))return new s(i);if(c.constructor=s,VI(i)){c.s=i.s,gt?!i.d||i.e>s.maxE?(c.e=NaN,c.d=null):i.e<s.minE?(c.e=0,c.d=[0]):(c.e=i.e,c.d=i.d.slice()):(c.e=i.e,c.d=i.d?i.d.slice():i.d);return}if(l=typeof i,l==="number"){if(i===0){c.s=1/i<0?-1:1,c.e=0,c.d=[0];return}if(i<0?(i=-i,c.s=-1):c.s=1,i===~~i&&i<1e7){for(a=0,o=i;o>=10;o/=10)a++;gt?a>s.maxE?(c.e=NaN,c.d=null):a<s.minE?(c.e=0,c.d=[0]):(c.e=a,c.d=[i]):(c.e=a,c.d=[i]);return}if(i*0!==0){i||(c.s=NaN),c.e=NaN,c.d=null;return}return Vy(c,i.toString())}if(l==="string")return(o=i.charCodeAt(0))===45?(i=i.slice(1),c.s=-1):(o===43&&(i=i.slice(1)),c.s=1),qI.test(i)?Vy(c,i):c6(c,i);if(l==="bigint")return i<0?(i=-i,c.s=-1):c.s=1,Vy(c,i.toString());throw Error(ao+i)}if(u(s,"Decimal"),s.prototype=Ce,s.ROUND_UP=0,s.ROUND_DOWN=1,s.ROUND_CEIL=2,s.ROUND_FLOOR=3,s.ROUND_HALF_UP=4,s.ROUND_HALF_DOWN=5,s.ROUND_HALF_EVEN=6,s.ROUND_HALF_CEIL=7,s.ROUND_HALF_FLOOR=8,s.EUCLID=9,s.config=s.set=b6,s.clone=WI,s.isDecimal=VI,s.abs=h6,s.acos=p6,s.acosh=d6,s.add=m6,s.asin=g6,s.asinh=y6,s.atan=v6,s.atanh=E6,s.atan2=w6,s.cbrt=S6,s.ceil=A6,s.clamp=C6,s.cos=x6,s.cosh=N6,s.div=T6,s.exp=I6,s.floor=D6,s.hypot=B6,s.ln=R6,s.log=O6,s.log10=P6,s.log2=_6,s.max=k6,s.min=L6,s.mod=V6,s.mul=F6,s.pow=U6,s.random=M6,s.round=j6,s.sign=q6,s.sin=H6,s.sinh=K6,s.sqrt=X6,s.sub=$6,s.sum=G6,s.tan=W6,s.tanh=z6,s.trunc=J6,r===void 0&&(r={}),r&&r.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<n.length;)r.hasOwnProperty(t=n[e++])||(r[t]=this[t]);return s.config(r),s}u(WI,"clone");function T6(r,e){return new this(r).div(e)}u(T6,"div");function I6(r){return new this(r).exp()}u(I6,"exp");function D6(r){return rt(r=new this(r),r.e+1,3)}u(D6,"floor");function B6(){var r,e,t=new this(0);for(gt=!1,r=0;r<arguments.length;)if(e=new this(arguments[r++]),e.d)t.d&&(t=t.plus(e.times(e)));else{if(e.s)return gt=!0,new this(1/0);t=e}return gt=!0,t.sqrt()}u(B6,"hypot");function VI(r){return r instanceof gf||r&&r.toStringTag===jI||!1}u(VI,"isDecimalInstance");function R6(r){return new this(r).ln()}u(R6,"ln");function O6(r,e){return new this(r).log(e)}u(O6,"log");function _6(r){return new this(r).log(2)}u(_6,"log2");function P6(r){return new this(r).log(10)}u(P6,"log10");function k6(){return XI(this,arguments,-1)}u(k6,"max");function L6(){return XI(this,arguments,1)}u(L6,"min");function V6(r,e){return new this(r).mod(e)}u(V6,"mod");function F6(r,e){return new this(r).mul(e)}u(F6,"mul");function U6(r,e){return new this(r).pow(e)}u(U6,"pow");function M6(r){var e,t,n,s,i=0,a=new this(1),o=[];if(r===void 0?r=this.precision:$n(r,1,oo),n=Math.ceil(r/lt),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(n));i<n;)s=e[i],s>=429e7?e[i]=crypto.getRandomValues(new Uint32Array(1))[0]:o[i++]=s%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(n*=4);i<n;)s=e[i]+(e[i+1]<<8)+(e[i+2]<<16)+((e[i+3]&127)<<24),s>=214e7?crypto.randomBytes(4).copy(e,i):(o.push(s%1e7),i+=4);i=n/4}else throw Error(MI);else for(;i<n;)o[i++]=Math.random()*1e7|0;for(n=o[--i],r%=lt,n&&r&&(s=Wr(10,lt-r),o[i]=(n/s|0)*s);o[i]===0;i--)o.pop();if(i<0)t=0,o=[0];else{for(t=-1;o[0]===0;t-=lt)o.shift();for(n=1,s=o[0];s>=10;s/=10)n++;n<lt&&(t-=lt-n)}return a.e=t,a.d=o,a}u(M6,"random");function j6(r){return rt(r=new this(r),r.e+1,this.rounding)}u(j6,"round");function q6(r){return r=new this(r),r.d?r.d[0]?r.s:0*r.s:r.s||NaN}u(q6,"sign");function H6(r){return new this(r).sin()}u(H6,"sin");function K6(r){return new this(r).sinh()}u(K6,"sinh");function X6(r){return new this(r).sqrt()}u(X6,"sqrt");function $6(r,e){return new this(r).sub(e)}u($6,"sub");function G6(){var r=0,e=arguments,t=new this(e[r]);for(gt=!1;t.s&&++r<e.length;)t=t.plus(e[r]);return gt=!0,rt(t,this.precision,this.rounding)}u(G6,"sum");function W6(r){return new this(r).tan()}u(W6,"tan");function z6(r){return new this(r).tanh()}u(z6,"tanh");function J6(r){return rt(r=new this(r),r.e+1,1)}u(J6,"trunc");Ce[Symbol.for("nodejs.util.inspect.custom")]=Ce.toString;Ce[Symbol.toStringTag]="Decimal";var gf=Ce.constructor=WI(vA);Fy=new gf(Fy);Uy=new gf(Uy);var yf=class r extends gf{static{u(this,"Decimal")}static from(e){return new r(e)}static newOrZero(e){return e===void 0?r.from(0):r.from(e)}static newOrUndefined(e){if(e!==void 0)return r.from(e)}};import Y6 from"pdfkit";var zI=class r{static{u(this,"PdfkitPdfBuilder")}defaults={autoFirstPage:!1};doc=new Y6(this.defaults);constructor(e){e&&this.configure(e)}static new(e){return new r(e)}configure(e){return this.doc.options={...this.doc.options,...e},this}pipe(e){return this.doc.pipe(e),this}end(){return this.doc.end()}restore(){return this.doc.restore(),this}save(){return this.doc.save(),this}stroke(e){return this.doc.stroke(e),this}page(e){return this.doc.addPage(e),this}table(e){return this.doc.table(e),this}text(e,t){let{x:n,y:s,...i}=t??{};return n||s?(this.doc.text(e,n,s,i),this):(this.doc.text(e,t),this)}fontSize(e){return this.doc.fontSize(e),this}font(e,t,n){return typeof t=="string"?(this.doc.font(e,t,n),this):typeof t=="number"?(this.doc.font(e,t),this):(this.doc.font(e),this)}image(e,t,n,s){return typeof t=="number"&&typeof n=="number"?(this.doc.image(e,t,n,s),this):(this.doc.image(e,t),this)}rect(e,t,n,s){return this.doc.rect(e,t,n,s),this}path(e){return this.doc.path(e),this}translate(e,t){return this.doc.translate(e,t),this}scale(e,t){return this.doc.scale(e,t),this}fill(e,t){return this.doc.fill(e,t),this}pageWidth(){return this.doc.page.width}pageHeight(){return this.doc.page.height}heightOfString(e,t){return this.doc.heightOfString(e,t)}widthOfString(e,t){return this.doc.widthOfString(e,t)}pageMargins(){return this.doc.page.margins}currentLineHeight(e){return this.doc.currentLineHeight(e)}x(){return this.doc.x}y(){return this.doc.y}moveDown(e){return this.doc.moveDown(e),this}row(e,...t){let n,s;typeof e=="function"?(n={},s=[e,...t]):(n=e??{},s=t),n.columns??=1;let i=this.y(),a=n.right??0,o=n.left??0,l=n.gap??0,c=this.pageWidth(),f=c-o-a-l*(n.columns-1);n.size??=Array(n.columns).fill(12/n.columns);let p=[];for(let d=0;d<n.columns;d++){let m=n.size[d]/12;p[d]=f*m}for(let d=0,m=o;d<n.columns;d++){let g=d===n.columns-1,S=p[d];if(g&&n.columns>1){let C=c-a-m;C>0&&Math.abs(C-S)>.01&&(S=C)}let y={y:i,x:m,width:S};s[d](y),m+=S,l>0&&!g&&(m+=l)}return this}};var JI=class{static{u(this,"MemoryCacheAdapter")}cache=new Map;async get(e){return Promise.resolve(this.cache.get(e)??null)}has(e){return Promise.resolve(this.cache.has(e))}set(e,t){return this.cache.set(e,t),Promise.resolve(!0)}};var So=Ry(hR(),1);import J9 from"os";import SR from"fs";import Y9 from"path";import v0 from"crypto";var L9=u(r=>!!r&&typeof r=="object"&&"message"in r,"hasMessageInRecord"),ds=u(r=>typeof r=="string"?zt(new Mt(r)):r instanceof Error?zt(new Mt(r.message,{cause:r.cause})):L9(r)?zt(new Mt(r.message)):zt(new Mt("unexpected error")),"leftFromError");var Av=class{static{u(this,"NullCacheAdapter")}async get(e){return Promise.resolve(null)}has(e){return Promise.resolve(!1)}set(e,t){return Promise.resolve(!0)}};import{arch as q9,platform as ER}from"os";import{dirname as H9,join as K9,resolve as X9,normalize as $9,delimiter as G9}from"path";import{resolve as dR}from"path";import{createRequire as pR}from"module";import{fileURLToPath as V9,pathToFileURL as F9}from"url";var U9=typeof jest<"u"||process.env.JEST_WORKER_ID!==void 0,_f,mR=u(()=>{if(_f!==void 0)return _f;if(U9){_f=void 0;return}try{_f=new Function("try { return import.meta.url; } catch { return undefined; }")()}catch{_f=void 0}return _f},"getImportMetaUrl"),gR=u(()=>{if(typeof ot<"u")return ot;let r=mR();if(r)return pR(r);let e=F9(dR(process.cwd(),"package.json")).href;return pR(e)},"getRequireFn"),yR=u(()=>{if(typeof __filename<"u")return __filename;let r=mR();return r?V9(r):dR(process.cwd())},"getCurrentFile");import{dirname as Cv,resolve as ul}from"path";import{existsSync as Pf}from"fs";var vR=u(()=>typeof process<"u"&&typeof process.versions<"u"&&"electron"in process.versions,"isElectron"),M9=u(()=>{if(!vR())return null;try{let e=ot("electron").app;if(e?.getAppPath&&typeof e.getAppPath=="function")return{getAppPath:e.getAppPath}}catch{}return null},"getElectronApp"),j9=u(()=>{if(!vR())return null;let r=process;if(r.resourcesPath)return r.resourcesPath;let e=M9();if(e)try{let t=e.getAppPath();if(typeof t=="string")return Cv(t.replace(/\.asar$/,""))}catch{}return null},"getElectronResourcesPath"),bC=u((r,{onFound:e,onNotFound:t})=>{let n=j9();if(n){let c=ul(n,"node_modules","nfets",r);if(Pf(c))return e(c);let f=ul(n,"app.asar.unpacked","node_modules","nfets",r);if(Pf(f))return e(f)}let s=yR(),i=s.includes(".asar")?process.cwd():s,a=ul(i,"../../../../"),o=ul(a,r);if(Pf(o))return e(o);let l=i;for(let c=0;c<5;c++){let f=ul(l,r);if(Pf(f))return e(f);let p=Cv(l);if(p===l)break;l=p}l=i;for(let c=0;c<5;c++){let f=ul(l,"node_modules","nfets",r);if(Pf(f))return e(f);let p=Cv(l);if(p===l)break;l=p}l=i;for(let c=0;c<5;c++){let f=ul(l,r.replace(/^build\//,"Release/"));if(Pf(f))return e(f);let p=Cv(l);if(p===l)break;l=p}return t()},"search");var W9=u(r=>{let e=r.replace(/^\\\\\?\\/,"");return X9($9(e))},"normalizePath"),z9=u(r=>{ER()==="win32"&&(process.env.PATH=`${H9(r)}${G9}${process.env.PATH}`)},"addAddonDirToPath"),xC=u(r=>{let e=W9(r);return z9(e),gR()(e)},"exportRequireModule"),kf=u(r=>{if(r=`${r}.node`,process.env.NFETS_ADDONS_DIR)return xC(K9(process.env.NFETS_ADDONS_DIR,r));let e=`${ER()}-${q9()}`;try{return bC(`build/addons/${e}/${r}`,{onFound:u(t=>xC(t),"onFound"),onNotFound:u(()=>{throw new Error(`Addon ${e}/${r} not found`)},"onNotFound")})}catch{return bC(`build/Release/${r}`,{onFound:u(t=>xC(t),"onFound"),onNotFound:u(()=>{throw new Error(`Addon ${e}/${r} not found`)},"onNotFound")})}},"addon");var wo=class{static{u(this,"ASN1")}extractCertificateInfo(e){let n=e.subject.split(`
83
+ `).reduce((i,a)=>{let[o,l]=a.split("=").map(c=>c.trim());return!o||!l?i:i.set(o,l)},new Map),s=this.oid("2.16.76.1.3.1",e.raw);return{CNPJ:this.oid("2.16.76.1.3.3",e.raw),CPF:s,CN:n.get("CN"),O:n.get("O"),OU:n.get("OU"),ST:n.get("ST"),L:n.get("L"),C:n.get("C")}}oid(e,t){let n=this.marker(e),s=t.indexOf(n);if(s===-1)return;let i=[t.subarray(0,s),t.subarray(s)];if(i.length<=1)return;let o=i[0].subarray(-4),l=o.subarray(-2);o[0]===48?l=o:o[1]===48&&(l=o.subarray(-3));let c=Buffer.concat([l,n,i[1]]),f=this.length(c),p=n.length,d=c.subarray(2+p,2+p+f),m=d.length-l.length-2;if(m<=0||m>d.length)return;let S=d.subarray(-m).toString("utf8");return S.substring(Buffer.from(S).findIndex((y,w)=>S.charCodeAt(w)>=32&&S.charCodeAt(w)<=126))}length(e){return e.length<2?0:e[1]<=127?e[1]:Buffer.from([e[1]&15]).reduce((t,n)=>t<<8|n,0)}marker(e){let t=e.split("."),n=t.slice(2).reduce((s,i)=>{let a=this.base128(s,Number.parseInt(i,10),!0);return s.length=0,s.push(...a),s},[]);return Buffer.from([6,n.length+1,40*Number.parseInt(t[0],10)+Number.parseInt(t[1],10),...n])}base128(e,t,n){let s=[...e];if(t>127){let a=this.base128(e,Math.floor(t/128),!1);a.length=0,s.push(...a)}let i=t%128;return n?s.push(i):s.push(128|i),s}};var bv=class{static{u(this,"WincryptSignerRepository")}async sign(e,t,n){try{let s=kf("wincrypt_certificate_store"),i=new wo,{CN:a}=i.extractCertificateInfo(t.certificate),o=await s.sign(a??"",Buffer.from(e),n,Buffer.from(t.certificate.raw)),l=Buffer.from(o).toString("base64");return await Promise.resolve(Gr(l))}catch(s){return Promise.resolve(ds(s))}}};import wR from"crypto";var xv=class{static{u(this,"CryptoSignerRepository")}async sign(e,t,n){try{if(!t.privateKey)return zt(new Mt("Certificate private key not found"));let i=wR.sign(n,Buffer.from(e),{key:t.privateKey,padding:wR.constants.RSA_PKCS1_PADDING}).toString("base64");return await Promise.resolve(Gr(i))}catch(s){return Promise.resolve(ds(s))}}};var AR=class{static{u(this,"NativeCertificateRepository")}httpClient;cache;signer;constructor(e,t=new Av,n=J9.platform()==="win32"?new bv:new xv){this.httpClient=e,this.cache=t,this.signer=n}async read(e){try{let{password:t,pfxPathOrBase64:n,publicCertDerBase64:s}=e,i=s?.trim(),a=n?.trim();if(i&&a)return zt(new Mt("Use either pfxPathOrBase64 or publicCertDerBase64, not both"));if(i)try{let w=Buffer.from(i,"base64"),C=new v0.X509Certificate(w);return Gr({ca:[],password:t,certificate:C,privateKey:void 0})}catch(w){return ds(w)}if(!a)return zt(new Mt("Certificate path (pfxPathOrBase64) is required"));let o=await this.getPfxBuffer({...e,pfxPathOrBase64:a});if(o.isLeft())return o;let l=So.default.asn1.fromDer(o.value.toString("binary")),c=So.default.pkcs12.pkcs12FromAsn1(l,t),{certBag:f}=So.default.pki.oids,d=c.getBags({bagType:f})[f];if(!d?.length)return zt(new Mt("Cannot read certificate"));let[{cert:m},...g]=d;if(!m)return zt(new Mt("Issuer Certificate not found"));let S=g.reduce((w,{cert:C})=>(C&&w.push(new v0.X509Certificate(So.default.pki.certificateToPem(C))),w),[]),y=new v0.X509Certificate(So.default.pki.certificateToPem(m));return Gr({ca:S,password:t,certificate:y,privateKey:this.getPrivateKey(c)})}catch(t){return ds(t)}}getPrivateKey(e){let{pkcs8ShroudedKeyBag:t}=So.default.pki.oids,s=e.getBags({bagType:t})[t]?.[0]?.key;if(s)return v0.createPrivateKey(So.default.pki.privateKeyToPem(s))}async sign(e,t,n=no.SHA1){return this.signer.sign(e,t,n)}getCertificateInfo(e){return new wo().extractCertificateInfo(e)}getStringCertificate(e){return e.raw.toString("base64")}getStringPrivateKey(e){try{return e.export({type:"pkcs8",format:"pem"})}catch{throw new Mt("Cannot extract private key")}}async getPfxBuffer(e){let{pfxPathOrBase64:t,password:n}=e,s=this.getCacheKey(t,n),i=await this.cache.get(s);if(i)return Gr(i);if(Y9.isAbsolute(t)||SR.existsSync(t))return this.hitBufferOnCache(s,SR.readFileSync(t));if(this.isValidRemoteUrl(t))try{let a=await this.httpClient.get(t,{responseType:"arraybuffer"});return await this.hitBufferOnCache(s,Buffer.from(a.data))}catch(a){return ds(a)}return this.hitBufferOnCache(s,Buffer.from(t,"base64"))}getCacheKey(e,t){return v0.createHash("sha256").update(`${e}.${t}`).digest("hex")}async hitBufferOnCache(e,t){return await this.cache.set(e,t),Gr(t)}isValidRemoteUrl(e){try{return new URL(e),!0}catch{return!1}}};import eW from"os";import NC from"dayjs";import Q9 from"dayjs/plugin/utc.js";import Z9 from"dayjs/plugin/timezone.js";NC.extend(Q9);NC.extend(Z9);var Lf=NC;var G3=Ry(q3(),1);import{constants as tW}from"crypto";import{Agent as mx}from"https";var VG=new Set(["ENOTFOUND","EAI_AGAIN","EAI_FAIL","EAI_NONAME"]),FG=new Set(["ETIMEDOUT","ESOCKETTIMEDOUT","ECONNABORTED"]),UG=new Set(["ECONNREFUSED","ENETUNREACH","EHOSTUNREACH","EPIPE"]),MG=new Set([12002,12152,12175]),jG=new Set([12007]),qG=new Set([12029,12030]),HG=/Failed to send request\. Error: (\d+)/i,KG=u(r=>!!r&&typeof r=="object"&&"message"in r,"hasMessage"),XG=u(r=>{if(!r||typeof r!="object"||!("code"in r))return;let{code:e}=r;return typeof e=="string"?e:void 0},"getCode"),$G=u(r=>{if(!r||typeof r!="object"||!("hostname"in r))return;let{hostname:e}=r;return typeof e=="string"?e:void 0},"getHostname"),px=u(r=>{if(typeof r=="string")return r;if(r instanceof Error||KG(r))return r.message},"getMessage"),H3=u(r=>{let e=r.toLowerCase();return e.includes("timeout")||e.includes("timed out")||e.includes("time-out")||e.includes("read econnreset")},"isTimeoutMessage"),GG=u(r=>/getaddrinfo\s+ENOTFOUND/i.test(r)||/\bENOTFOUND\b/i.test(r),"isHostNotFoundMessage"),WG=u(r=>{let e=HG.exec(r);if(!e)return;let t=Number(e[1]);return Number.isFinite(t)?t:void 0},"getWinHttpErrorCode"),zG=u(r=>{let e=[],t=new Set,n=r;for(;n!=null&&!t.has(n);){if(t.add(n),e.push(n),n instanceof AggregateError)for(let i of n.errors)t.has(i)||e.push(i);n=n instanceof Error?n.cause:void 0}return e},"collectErrorChain"),ko=u(r=>r instanceof Error?{cause:r}:void 0,"errorOptions"),JG=u(r=>{let e=zG(r),t=px(r)??e.map(px).find(s=>!!s);for(let s of e){let i=XG(s);if(i&&VG.has(i))return zt(new Yu(t??`Host not found (${$G(s)??i})`,ko(r)));if(i&&FG.has(i))return zt(new Qu(t??"Transmission timeout",ko(r)));if(i&&UG.has(i))return zt(new Yu(t??`Connection failed (${i})`,ko(r)));let a=px(s);if(a&&H3(a))return zt(new Qu(a,ko(r)))}if(!t)return ds(r);let n=WG(t);if(n!==void 0){if(MG.has(n))return zt(new Qu(t,ko(r)));if(jG.has(n)||qG.has(n))return zt(new Yu(t,ko(r)))}return GG(t)?zt(new Yu(t,ko(r))):H3(t)?zt(new Qu(t,ko(r))):ds(r)},"mapTransmissionError"),K3=u(r=>JG(r),"leftFromTransmissionError");var YG=/Ã[\u0080-\u00BF]/;function QG(r){if(!YG.test(r))return r;let e=Buffer.from(r,"latin1").toString("utf8");return e.includes("\uFFFD")?r:e}u(QG,"fixUtf8Mojibake");function dx(r){if(typeof r=="string")return QG(r);if(Array.isArray(r))return r.map(e=>dx(e));if(r!==null&&typeof r=="object"){let e={};for(let[t,n]of Object.entries(r))e[t]=dx(n);return e}return r}u(dx,"normalizeValue");function X3(r){return dx(r)}u(X3,"normalizeTransmissionStrings");import ZG from"os";var L2=class r{static{u(this,"WinHttpClient")}certificate;interceptors={request:{use:u(()=>0,"use"),eject:u(()=>{},"eject"),clear:u(()=>{},"clear")},response:{use:u(()=>0,"use"),eject:u(()=>{},"eject"),clear:u(()=>{},"clear")}};defaults={headers:{}};constructor(e){this.certificate=e}parseRequestHeaders(e){return e?Object.entries(e).filter(([t,n])=>n!=null).map(([t,n])=>`${t}: ${Array.isArray(n)?n.join(", "):String(n)}`).join(ZG.EOL):""}parseRequestBody(e){return e?Buffer.isBuffer(e)?e:typeof e=="string"?Buffer.from(e,"utf8"):Array.isArray(e)?Buffer.concat(e):Buffer.from(JSON.stringify(e),"utf8"):Buffer.from("")}parseResponseHeaders(e){return e?e.split(`\r
84
+ `).reduce((t,n)=>{if(!n.trim()||n.startsWith("HTTP/"))return t;let[s,i]=n.split(":").map(a=>a.trim());return t[s]=i,t},{}):{}}parseResponseBody(e){return e?Buffer.isBuffer(e)?e.toString("utf8"):e:""}async request(e){let t=e.url??"",n=(e.method??"GET").toUpperCase(),s=kf("winhttp_ssl_client"),{CN:i}=new wo().extractCertificateInfo(this.certificate.certificate),a=await s.request(i??"",n,t,{headers:this.parseRequestHeaders(e.headers),body:this.parseRequestBody(e.data),timeout:e.timeout,certificateDer:Buffer.from(this.certificate.certificate.raw)});return{status:a.statusCode,data:this.parseResponseBody(a.body),statusText:this.getStatusText(a.statusCode),headers:this.parseResponseHeaders(a.headers),config:e,request:{}}}get(e,t){return this.request({...t,method:"GET",url:e})}post(e,t,n){return this.request({...n,method:"POST",url:e,data:t})}put(e,t,n){return this.request({...n,method:"PUT",url:e,data:t})}patch(e,t,n){return this.request({...n,method:"PATCH",url:e,data:t})}delete(e,t){return this.request({...t,method:"DELETE",url:e})}head(e,t){return this.request({...t,method:"HEAD",url:e})}options(e,t){return this.request({...t,method:"OPTIONS",url:e})}getUri(e){if(!e?.url)return"";try{return new URL(e.url).toString()}catch{return e.url}}static create(e){let t=new r(e),n=t.request.bind(t);return Object.setPrototypeOf(n,r.prototype),Object.assign(n,t),n}getStatusText(e){return{200:"OK",201:"Created",202:"Accepted",204:"No Content",400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable"}[e]??"Unknown"}};var $3=class{static{u(this,"SoapRemoteTransmissionRepository")}toolkit;certificateRepository;constructor(e,t){this.toolkit=e,this.certificateRepository=t}setCertificate(e){return this.certificate=e,this}validateCertificatePeriod(){if(!this.certificate)return Gr(void 0);let{certificate:e}=this.certificate,t=new Date;return t>new Date(e.validTo)?zt(new Mt(`Certificado expirado (${Lf(e.validTo).format("DD/MM/YYYY")}). Renove o certificado.`)):t<new Date(e.validFrom)?zt(new Mt(`O certificado ainda n\xE3o est\xE1 v\xE1lido (${Lf(e.validFrom).format("DD/MM/YYYY")}).`)):Gr(void 0)}get httpsAgent(){let e={rejectUnauthorized:!1,secureOptions:tW.SSL_OP_LEGACY_SERVER_CONNECT};if(!this.certificate)return new mx({...e});let{ca:t,password:n,certificate:s,privateKey:i}=this.certificate;return i?new mx({passphrase:n,cert:s.toString(),ca:t.map(a=>a.toString()),key:this.certificateRepository.getStringPrivateKey(i),...e}):new mx({...e})}get defaultSoapHeaders(){return{"Content-Type":"application/soap+xml; charset=utf-8"}}getDefaultRequest(e){let t=TI.create({timeout:e.timeout});return t.defaults.httpsAgent=this.httpsAgent,t}request(e){if(eW.platform()==="win32")try{return this.certificate?L2.create(this.certificate):this.getDefaultRequest({timeout:e.timeout})}catch{return this.getDefaultRequest({timeout:e.timeout})}return this.getDefaultRequest({timeout:e.timeout})}async send(e){let t=this.validateCertificatePeriod();if(t.isLeft())return t;try{let n=this.request({timeout:e.timeout}),s=await(0,G3.createClientAsync)(`${e.url}?wsdl`,{request:n,endpoint:e.url,attributesKey:"$",wsdl_options:{request:n,timeout:e.timeout},forceSoap12Headers:!0});e.payload.$={xmlns:s.wsdl.definitions.$targetNamespace,...e.payload.$};let i=await this.toolkit.build(e.payload,{headless:!0,renderOpts:{pretty:!1},rootName:e.root}),a=this.toolkit.getFirstNode(i)??"",o=e.xsd,l=await this.toolkit.validate(a,o);if(l.isLeft())return l;let c=`${e.method}Async`;if(typeof s[c]!="function"){let p=Object.keys(s).filter(d=>d.endsWith("Async"));return zt(new Mt(`M\xE9todo SOAP "${c}" n\xE3o encontrado em ${e.url}. Dispon\xEDveis: ${p.join(", ")||"nenhum"}`))}let[f]=await s[c]({_xml:i},{request:n,timeout:e.timeout});return Gr(X3(f))}catch(n){return K3(n)}}};var rW=kf("xml_validator"),W3=rW;var HZ=Ry(yk(),1);import qZ from"crypto";var vk="application/xml";var St;(function(r){r[r.None=0]="None",r[r.Element=1]="Element",r[r.Attribute=2]="Attribute",r[r.Text=3]="Text",r[r.CDATA=4]="CDATA",r[r.EntityReference=5]="EntityReference",r[r.Entity=6]="Entity",r[r.ProcessingInstruction=7]="ProcessingInstruction",r[r.Comment=8]="Comment",r[r.Document=9]="Document",r[r.DocumentType=10]="DocumentType",r[r.DocumentFragment=11]="DocumentFragment",r[r.Notation=12]="Notation",r[r.Whitespace=13]="Whitespace",r[r.SignificantWhitespace=14]="SignificantWhitespace",r[r.EndElement=15]="EndElement",r[r.EndEntity=16]="EndEntity",r[r.XmlDeclaration=17]="XmlDeclaration"})(St||(St={}));function nW(r,e){let t=r.ownerDocument==null?r:r.ownerDocument,n=document.createNSResolver(r.ownerDocument==null?r.documentElement:r.ownerDocument.documentElement),s=t.evaluate(e,r,n,XPathResult.ANY_TYPE,null),i=[],a;for(;a=s.iterateNext();)i.push(a);return i}u(nW,"SelectNodesEx");function sW(r,e){let t=ih("xpath").select;return t(e,r)}u(sW,"SelectNodesNode");var Ek=typeof self<"u"?nW:sW;function z0(r){r=r.replace(/\r\n/g,`
85
85
  `).replace(/\r/g,`
86
86
  `);let e;return typeof DOMParser<"u"?e=DOMParser:e=ih("DOMParser"),new e().parseFromString(r,vk)}u(z0,"Parse");function sh(r){let e;return typeof XMLSerializer<"u"?e=XMLSerializer:e=ih("XMLSerializer"),new e().serializeToString(r)}u(sh,"Stringify");function Z2(r,e){let t=Ek(r,e);return t&&t.length>0?t[0]:null}u(Z2,"SelectSingleNode");function wk(r,e){return r&&r.nodeType===e}u(wk,"isNodeType");function ys(r){return wk(r,St.Element)}u(ys,"isElement");function Al(r){return wk(r,St.Document)}u(Al,"isDocument");var Sk=new Map;function Ak(r){for(let e in r)Sk.set(e,r[e])}u(Ak,"setNodeDependencies");function ih(r){let e=Sk.get(r);if(!e)throw new Error(`Node dependency not found: ${r}. Please use 'setNodeDependencies' to register it.`);return e}u(ih,"getNodeDependency");var J0="element",Y0="attribute",eE="content";var iW=1e9;function Nx(r,...e){let t=r;for(let n=0;n<e.length;n++){let s=e[n];for(let i in s)Object.prototype.hasOwnProperty.call(s,i)&&(t[i]=s[i])}return t}u(Nx,"assign");function At(r){return e=>{let t=e;t.localName=r.localName||t.name,t.namespaceURI=r.namespaceURI||t.namespaceURI||null,t.prefix=r.prefix||t.prefix||null,t.parser=r.parser||t.parser,t.target!==t&&(t.items=Nx({},t.items)),t.target=e}}u(At,"XmlElement");function Rt(r={}){return(e,t)=>{let n=e.constructor,s=t;n.items||(n.items={}),n.target!==n&&(n.items=Nx({},n.items)),n.target=e;let i;r.parser?i={parser:r.parser,required:r.required||!1,maxOccurs:r.maxOccurs||iW,minOccurs:r.minOccurs===void 0?0:r.minOccurs,noRoot:r.noRoot||!1}:i={namespaceURI:r.namespaceURI||null,required:r.required||!1,prefix:r.prefix||null,defaultValue:r.defaultValue,converter:r.converter,noRoot:r.noRoot||!1},r.localName=r.localName||r.parser&&r.parser.localName||s;let a=n.items,o=r.parser&&r.parser.namespaceURI;a[s]={...i,namespaceURI:r.namespaceURI||o||null,prefix:r.prefix||r.parser&&r.parser.prefix||null,localName:r.localName,type:J0},bk(e,s,r)}}u(Rt,"XmlChildElement");function gr(r={required:!1,namespaceURI:null}){return(e,t)=>{let n=e.constructor,s=t;r.localName||(r.localName=t),n.items||(n.items={}),n.target!==n&&(n.items=Nx({},n.items)),n.target=e;let i=n.items;i[t]=r,i[t].type=Y0,bk(e,s,r)}}u(gr,"XmlAttribute");function bk(r,e,t){let n=`_${e}`,s={set:u(function(i){this[n]!==i&&(this.element=null,this[n]=i)},"set"),get:u(function(){if(this[n]===void 0){let i=t.defaultValue;t.parser&&(i=new t.parser,i.localName=t.localName),this[n]=i}return this[n]},"get")};Object.defineProperty(r,n,{writable:!0,enumerable:!1}),Object.defineProperty(r,e,s)}u(bk,"defineProperty");var Fo=class r{static{u(this,"Collection")}constructor(e){this.items=[],e&&(this.items=e)}get Count(){return this.items.length}Item(e){return this.items[e]||null}Add(e){this.items.push(e)}Pop(){return this.items.pop()}RemoveAt(e){this.items=this.items.filter((t,n)=>n!==e)}Clear(){this.items=[]}GetIterator(){return this.items}ForEach(e){this.GetIterator().forEach(e)}Map(e){return new r(this.GetIterator().map(e))}Filter(e){return new r(this.GetIterator().filter(e))}Sort(e){return new r(this.GetIterator().sort(e))}Every(e){return this.GetIterator().every(e)}Some(e){return this.GetIterator().some(e)}IsEmpty(){return this.Count===0}};function aW(r,...e){let t=r.replace(/%([1-9]\d*)/g,(n,s)=>{let i=parseInt(s,10)-1;return e[i]!==void 0?e[i]:""});return t=t.replace(/%%/g,"%"),t}u(aW,"printf");function oW(r,e){let t=r+"";for(;t.length<e;)t="0"+t;return t}u(oW,"padNum");var Re=class{static{u(this,"XmlError")}constructor(e,...t){this.prefix="XMLJS",this.code=e,this.name=this.constructor.name;let n=aW(jr[e],...t);this.message=`${this.prefix}${oW(e,4)}: ${n}`,this.stack=new Error(this.message).stack}},ve;(function(r){r[r.NONE=0]="NONE",r[r.NULL_REFERENCE=1]="NULL_REFERENCE",r[r.NULL_PARAM=2]="NULL_PARAM",r[r.DECORATOR_NULL_PARAM=3]="DECORATOR_NULL_PARAM",r[r.COLLECTION_LIMIT=4]="COLLECTION_LIMIT",r[r.METHOD_NOT_IMPLEMENTED=5]="METHOD_NOT_IMPLEMENTED",r[r.METHOD_NOT_SUPPORTED=6]="METHOD_NOT_SUPPORTED",r[r.PARAM_REQUIRED=7]="PARAM_REQUIRED",r[r.CONVERTER_UNSUPPORTED=8]="CONVERTER_UNSUPPORTED",r[r.ELEMENT_MALFORMED=9]="ELEMENT_MALFORMED",r[r.ELEMENT_MISSING=10]="ELEMENT_MISSING",r[r.ATTRIBUTE_MISSING=11]="ATTRIBUTE_MISSING",r[r.CONTENT_MISSING=12]="CONTENT_MISSING",r[r.CRYPTOGRAPHIC=13]="CRYPTOGRAPHIC",r[r.CRYPTOGRAPHIC_NO_MODULE=14]="CRYPTOGRAPHIC_NO_MODULE",r[r.CRYPTOGRAPHIC_UNKNOWN_TRANSFORM=15]="CRYPTOGRAPHIC_UNKNOWN_TRANSFORM",r[r.ALGORITHM_NOT_SUPPORTED=16]="ALGORITHM_NOT_SUPPORTED",r[r.ALGORITHM_WRONG_NAME=17]="ALGORITHM_WRONG_NAME",r[r.XML_EXCEPTION=18]="XML_EXCEPTION",r[r.KEY_INFO_CLAUSE_NOT_SUPPORTED=19]="KEY_INFO_CLAUSE_NOT_SUPPORTED"})(ve||(ve={}));var jr={};jr[ve.NONE]="No description";jr[ve.NULL_REFERENCE]="Null reference";jr[ve.NULL_PARAM]="'%1' has empty '%2' object";jr[ve.DECORATOR_NULL_PARAM]="Decorator '%1' has empty '%2' parameter";jr[ve.COLLECTION_LIMIT]="Collection of '%1' in element '%2' has wrong amount of items";jr[ve.METHOD_NOT_IMPLEMENTED]="Method is not implemented";jr[ve.METHOD_NOT_SUPPORTED]="Method is not supported";jr[ve.PARAM_REQUIRED]="Required parameter is missing '%1'";jr[ve.CONVERTER_UNSUPPORTED]="Converter is not supported";jr[ve.ELEMENT_MALFORMED]="Malformed element '%1'";jr[ve.ELEMENT_MISSING]="Element '%1' is missing in '%2'";jr[ve.ATTRIBUTE_MISSING]="Attribute '%1' is missing in '%2'";jr[ve.CONTENT_MISSING]="Content is missing in '%1'";jr[ve.CRYPTOGRAPHIC]="Cryptographic error: %1";jr[ve.CRYPTOGRAPHIC_NO_MODULE]="WebCrypto module is not found";jr[ve.CRYPTOGRAPHIC_UNKNOWN_TRANSFORM]="Unknown transform %1";jr[ve.ALGORITHM_NOT_SUPPORTED]="Algorithm is not supported '%1'";jr[ve.ALGORITHM_WRONG_NAME]="Algorithm wrong name in use '%1'";jr[ve.XML_EXCEPTION]="XML exception: %1";jr[ve.KEY_INFO_CLAUSE_NOT_SUPPORTED]="KeyInfoClause type '%1' is not supported";var tr=class{static{u(this,"Convert")}static ToString(e,t="utf8"){let n=new Uint8Array(e);switch(t.toLowerCase()){case"utf8":return this.ToUtf8String(n);case"binary":return this.ToBinary(n);case"hex":return this.ToHex(n);case"base64":return this.ToBase64(n);case"base64url":return this.ToBase64Url(n);default:throw new Re(ve.CONVERTER_UNSUPPORTED)}}static FromString(e,t="utf8"){switch(t.toLowerCase()){case"utf8":return this.FromUtf8String(e);case"binary":return this.FromBinary(e);case"hex":return this.FromHex(e);case"base64":return this.FromBase64(e);case"base64url":return this.FromBase64Url(e);default:throw new Re(ve.CONVERTER_UNSUPPORTED)}}static ToBase64(e){if(typeof btoa<"u"){let t=this.ToString(e,"binary");return btoa(t)}else{if(typeof Buffer<"u")return Buffer.from(e).toString("base64");throw new Re(ve.CONVERTER_UNSUPPORTED)}}static FromBase64(e){if(e=e.replace(/\n/g,"").replace(/\r/g,"").replace(/\t/g,"").replace(/\s/g,""),typeof atob<"u")return this.FromBinary(atob(e));if(typeof Buffer<"u")return new Uint8Array(Buffer.from(e,"base64"));throw new Re(ve.CONVERTER_UNSUPPORTED)}static FromBase64Url(e){return this.FromBase64(this.Base64Padding(e.replace(/-/g,"+").replace(/_/g,"/")))}static ToBase64Url(e){return this.ToBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}static FromUtf8String(e){let t=unescape(encodeURIComponent(e)),n=new Uint8Array(t.length);for(let s=0;s<t.length;s++)n[s]=t.charCodeAt(s);return n}static ToUtf8String(e){let t=String.fromCharCode.apply(null,e);return decodeURIComponent(escape(t))}static FromBinary(e){let t=e.length,n=new Uint8Array(t);for(let s=0;s<t;s++)n[s]=e.charCodeAt(s);return n}static ToBinary(e){let t="";for(let n=0;n<e.length;n++)t=t+String.fromCharCode(e[n]);return t}static ToHex(e){let n=[];for(let s=0;s<e.length;s++){let i=e[s].toString(16);n.push(i.length===1?"0"+i:i)}return n.join("")}static FromHex(e){let t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n=n+2){let s=e.slice(n,n+2);t[n/2]=parseInt(s,16)}return t}static ToDateTime(e){return new Date(e)}static FromDateTime(e){return e.toISOString()}static Base64Padding(e){let t=4-e.length%4;if(t<4)for(let n=0;n<t;n++)e+="=";return e}};var Vs={get:u(r=>{if(r)return tr.ToBase64(r)},"get"),set:u(r=>tr.FromBase64(r),"set")},Q0={get:u(r=>r?r.toString():"0","get"),set:u(r=>Number(r),"set")};var uW="xml_root",rs=class r{static{u(this,"XmlObject")}static LoadXml(e){let t=new this;return t.LoadXml(e),t}static GetElement(e,t,n=!0){let s=e.getElementsByTagName(t);if(n&&s.length===0)throw new Re(ve.ELEMENT_MISSING,t,e.localName);return s[0]||null}static GetAttribute(e,t,n,s=!0){if(e.hasAttribute(t))return e.getAttribute(t);if(s)throw new Re(ve.ATTRIBUTE_MISSING,t,e.localName);return n}static GetElementById(e,t){if(e==null||t==null)return null;let n=null;return Al(e)&&(n=e.getElementById(t)),n==null&&(n=Z2(e,`//*[@*[local-name()='Id']='${t}']`),n==null&&(n=Z2(e,`//*[@*[local-name()='ID']='${t}']`),n==null&&(n=Z2(e,`//*[@*[local-name()='id']='${t}']`)))),n}static CreateDocument(e=uW,t=null,n=null){if(n&&!t)throw new Re(ve.PARAM_REQUIRED,"namespaceUri",`Prefix '${n}' requires namespaceUri`);let s="",i="",a="";n&&(s=n+":",i=":"+n),t&&(a=` xmlns${i}="${t}"`);let o=`${s}${e}`;return z0(`<${o}${a}></${o}>`)}static GetChildren(e,t,n){e=Al(e)?e.documentElement:e;let s=[];for(let i=0;i<e.childNodes.length;i++){let a=e.childNodes[i];ys(a)&&a.localName===t&&(a.namespaceURI===n||!n)&&s.push(a)}return s}static GetFirstChild(e,t,n){e=Al(e)?e.documentElement:e;for(let s=0;s<e.childNodes.length;s++){let i=e.childNodes[s];if(ys(i)&&i.localName===t&&(i.namespaceURI===n||!n))return i}return null}static GetChild(e,t,n,s=!0){for(let i=0;i<e.childNodes.length;i++){let a=e.childNodes[i];if(ys(a)&&a.localName===t&&(a.namespaceURI===n||!n))return a}if(s)throw new Re(ve.ELEMENT_MISSING,t,e.localName);return null}constructor(e={}){if(this.prefix=this.GetStatic().prefix||null,this.localName=this.GetStatic().localName,this.namespaceURI=this.GetStatic().namespaceURI,e)for(let[t,n]of Object.entries(e))n!==void 0&&(this[t]=n)}get Element(){return this.element}get Prefix(){return this.prefix}set Prefix(e){this.prefix=e}get LocalName(){return this.localName||""}get NamespaceURI(){return this.namespaceURI||null}HasChanged(){let e=this.GetStatic();if(e.items)for(let t in e.items){if(!Object.prototype.hasOwnProperty.call(e.items,t))continue;let n=e.items[t],s=this[t];if(n.parser&&s&&s.HasChanged())return!0}return this.element===null}GetXml(e){if(!(e||this.HasChanged()))return this.element||null;let t=this,n=this.CreateDocument(),s=this.CreateElement(),i=this.GetStatic(),a=this.localName||"";if(i.items)for(let o in i.items){if(!Object.prototype.hasOwnProperty.call(i.items,o))continue;let l=t[o],c=i.items[o];switch(c.type){case eE:{let f=c,p=f.converter?f.converter.get(l):l;if(f.required&&p==null)throw new Re(ve.CONTENT_MISSING,a);(f.defaultValue!==l||f.required)&&(s.textContent=p);break}case Y0:{let f=c,p=f.converter?f.converter.get(l):l;if(f.required&&p==null)throw new Re(ve.ATTRIBUTE_MISSING,f.localName,a);(f.defaultValue!==l||f.required)&&(f.namespaceURI?s.setAttributeNS(f.namespaceURI,f.localName||"",p):s.setAttribute(f.localName||"",p));break}case J0:{let f=c,p=null;if(f.parser){if(f.required&&!l||f.minOccurs&&!l.Count){let d=l?.localName||f.localName;throw new Re(ve.ELEMENT_MISSING,d,a)}l&&(p=l.GetXml(l.element===void 0&&(f.required||l.Count)))}else{let d=f.converter?f.converter.get(l):l;if(f.required&&d===void 0)throw new Re(ve.ELEMENT_MISSING,f.localName,a);if(l!==f.defaultValue||f.required)if(f.namespaceURI?p=n.createElementNS(f.namespaceURI,`${f.prefix?f.prefix+":":""}${f.localName}`):p=n.createElement(`${f.prefix?f.prefix+":":""}${f.localName}`),Array.isArray(d))for(let m of d){let g=m instanceof r?m.GetXml(!0):m;g!==null&&p&&p.appendChild(g)}else if(d instanceof r){let m=d.GetXml(!0);m&&p&&p.appendChild(m)}else p&&(p.textContent=d)}if(p)if(f.noRoot){let d=[];for(let S=0;S<p.childNodes.length;S++){let y=p.childNodes.item(S);ys(y)&&d.push(y)}let m=f.minOccurs||0,g=f.maxOccurs||1/0;if(d.length<m||d.length>g)throw new Re(ve.COLLECTION_LIMIT,l.localName,i.localName);d.forEach(S=>s.appendChild(S.cloneNode(!0)))}else{if(p.childNodes.length<(f.minOccurs||0)||p.childNodes.length>(f.maxOccurs||1/0))throw new Re(ve.COLLECTION_LIMIT,l.localName,i.localName);s.appendChild(p)}break}}}return this.OnGetXml(s),this.element=s,s}LoadXml(e){let t,n=this;if(typeof e=="string"?t=z0(e).documentElement:t=e,!t)throw new Re(ve.PARAM_REQUIRED,"element");let s=this.GetStatic(),i=this.localName||"";if(!(t.localName===i&&t.namespaceURI==this.NamespaceURI))throw new Re(ve.ELEMENT_MALFORMED,i);if(s.items)for(let a in s.items){if(!Object.prototype.hasOwnProperty.call(s.items,a))continue;let o=s.items[a];switch(o.type){case eE:{let l=o;if(l.required&&!t.textContent)throw new Re(ve.CONTENT_MISSING,i);if(!t.textContent)n[a]=l.defaultValue;else{let c=l.converter?l.converter.set(t.textContent):t.textContent;n[a]=c}break}case Y0:{let l=o,c,f;if(!l.localName)throw new Re(ve.PARAM_REQUIRED,"localName");if(l.namespaceURI?(c=t.hasAttributeNS.bind(t,l.namespaceURI,l.localName),f=t.getAttributeNS.bind(t,l.namespaceURI,l.localName)):(c=t.hasAttribute.bind(t,l.localName),f=t.getAttribute.bind(t,l.localName)),l.required&&!c())throw new Re(ve.ATTRIBUTE_MISSING,l.localName,i);if(!c())n[a]=l.defaultValue;else{let p=f(),d=l.converter&&p?l.converter.set(p):p;n[a]=d}break}case J0:{let l=o;if(l.noRoot){if(!l.parser)throw new Re(ve.XML_EXCEPTION,`Schema for '${l.localName}' with flag noRoot must have 'parser'`);let f=new l.parser;if(!(f instanceof ah))throw new Re(ve.XML_EXCEPTION,`Schema for '${l.localName}' with flag noRoot must have 'parser' like instance of XmlCollection`);f.OnLoadXml(t),delete f.element;let p=l.minOccurs||0,d=l.maxOccurs||1/0;if(f.Count<p||f.Count>d)throw new Re(ve.COLLECTION_LIMIT,l.parser.localName,i);n[a]=f;continue}let c=null;for(let f=0;f<t.childNodes.length;f++){let p=t.childNodes.item(f);if(!ys(p))continue;let d=p;if(d.localName===l.localName&&d.namespaceURI==l.namespaceURI){c=d;break}}if(l.required&&!c)throw new Re(ve.ELEMENT_MISSING,l.parser?l.parser.localName:l.localName,i);if(l.parser){if(c){let f=new l.parser;f.localName=l.localName,f.namespaceURI=l.namespaceURI,n[a]=f,f.LoadXml(c)}}else if(!c)n[a]=l.defaultValue;else{let f=c.textContent||"",p=l.converter?l.converter.set(f):f;n[a]=p}break}}}this.OnLoadXml(t),this.prefix=t.prefix||"",this.element=t}toString(){let e=this.GetXml();return e?sh(e):""}GetElement(e,t=!0){if(!this.element)throw new Re(ve.NULL_PARAM,this.localName);return r.GetElement(this.element,e,t)}GetChildren(e,t){if(!this.element)throw new Re(ve.NULL_PARAM,this.localName);return r.GetChildren(this.element,e,t||this.NamespaceURI||void 0)}GetChild(e,t=!0){if(!this.element)throw new Re(ve.NULL_PARAM,this.localName);return r.GetChild(this.element,e,this.NamespaceURI||void 0,t)}GetFirstChild(e,t){if(!this.element)throw new Re(ve.NULL_PARAM,this.localName);return r.GetFirstChild(this.element,e,t)}GetAttribute(e,t,n=!0){if(!this.element)throw new Re(ve.NULL_PARAM,this.localName);return r.GetAttribute(this.element,e,t,n)}IsEmpty(){return this.Element===void 0}OnLoadXml(e){}GetStatic(){return this.constructor}GetPrefix(){return this.Prefix?this.prefix+":":""}OnGetXml(e){}CreateElement(e,t,n=null,s=null){if(!e){let o=this.CreateDocument();if(o)e=o;else throw new Re(ve.XML_EXCEPTION,"Document not created")}t=t||this.localName,n=n||this.NamespaceURI,s=s||this.prefix;let i=(s?`${s}:`:"")+t,a=n&&e?e.createElementNS(n,i):e?.createElement(i);return e&&a&&e.importNode(a,!0),a}CreateDocument(){return r.CreateDocument(this.localName,this.NamespaceURI,this.Prefix)}};var ah=class extends rs{static{u(this,"XmlCollection")}constructor(){super(...arguments),this.MaxOccurs=Number.MAX_VALUE,this.MinOccurs=0,this.items=[]}HasChanged(){let e=super.HasChanged(),t=this.Some(n=>n.HasChanged());return e||t}get Count(){return this.items.length}Item(e){return this.items[e]||null}Add(e){this.items.push(e),this.element=null}Pop(){return this.element=null,this.items.pop()}RemoveAt(e){this.items=this.items.filter((t,n)=>n!==e),this.element=null}Clear(){this.items=[],this.element=null}GetIterator(){return this.items}ForEach(e){this.GetIterator().forEach(e)}Map(e){return new Fo(this.GetIterator().map(e))}Filter(e){return new Fo(this.GetIterator().filter(e))}Sort(e){return new Fo(this.GetIterator().sort(e))}Every(e){return this.GetIterator().every(e)}Some(e){return this.GetIterator().some(e)}IsEmpty(){return this.Count===0}OnGetXml(e){for(let t of this.GetIterator()){let n=t.GetXml();n&&e.appendChild(n)}}OnLoadXml(e){let t=this.GetStatic();if(!t.parser)throw new Re(ve.XML_EXCEPTION,`${t.localName} doesn't have required 'parser' in @XmlElement`);for(let n=0;n<e.childNodes.length;n++){let s=e.childNodes.item(n);if(!(ys(s)&&s.localName===t.parser.localName&&s.namespaceURI==t.namespaceURI))continue;let i=s,a=new t.parser;a.LoadXml(i),this.Add(a)}}};var oh=class extends Fo{static{u(this,"NamespaceManager")}Add(e){e.prefix=e.prefix||"",e.namespace=e.namespace||"",super.Add(e)}GetPrefix(e,t=this.Count-1){let n=this.Count-1;e=e||"",t>n&&(t=n);for(let s=t;s>=0;s--){let i=this.items[s];if(i.prefix===e)return i}return null}GetNamespace(e,t=this.Count-1){let n=this.Count-1;e=e||"",t>n&&(t=n);for(let s=t;s>=0;s--){let i=this.items[s];if(i.namespace===e)return i}return null}};var lW="[object ArrayBuffer]",tt=class Dx{static{u(this,"BufferSourceConverter")}static isArrayBuffer(e){return Object.prototype.toString.call(e)===lW}static toArrayBuffer(e){return this.isArrayBuffer(e)?e:e.byteLength===e.buffer.byteLength||e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:this.toUint8Array(e.buffer).slice(e.byteOffset,e.byteOffset+e.byteLength).buffer}static toUint8Array(e){return this.toView(e,Uint8Array)}static toView(e,t){if(e.constructor===t)return e;if(this.isArrayBuffer(e))return new t(e);if(this.isArrayBufferView(e))return new t(e.buffer,e.byteOffset,e.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(e){return this.isArrayBufferView(e)||this.isArrayBuffer(e)}static isArrayBufferView(e){return ArrayBuffer.isView(e)||e&&this.isArrayBuffer(e.buffer)}static isEqual(e,t){let n=Dx.toUint8Array(e),s=Dx.toUint8Array(t);if(n.length!==s.byteLength)return!1;for(let i=0;i<n.length;i++)if(n[i]!==s[i])return!1;return!0}static concat(...e){let t;Array.isArray(e[0])&&!(e[1]instanceof Function)||Array.isArray(e[0])&&e[1]instanceof Function?t=e[0]:e[e.length-1]instanceof Function?t=e.slice(0,e.length-1):t=e;let n=0;for(let a of t)n+=a.byteLength;let s=new Uint8Array(n),i=0;for(let a of t){let o=this.toUint8Array(a);s.set(o,i),i+=o.length}return e[e.length-1]instanceof Function?this.toView(s,e[e.length-1]):s.buffer}},Ix="string",cW=/^[0-9a-f\s]+$/i,fW=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,hW=/^[a-zA-Z0-9-_]+$/,xk=class{static{u(this,"Utf8Converter")}static fromString(e){let t=unescape(encodeURIComponent(e)),n=new Uint8Array(t.length);for(let s=0;s<t.length;s++)n[s]=t.charCodeAt(s);return n.buffer}static toString(e){let t=tt.toUint8Array(e),n="";for(let i=0;i<t.length;i++)n+=String.fromCharCode(t[i]);return decodeURIComponent(escape(n))}},Fi=class{static{u(this,"Utf16Converter")}static toString(e,t=!1){let n=tt.toArrayBuffer(e),s=new DataView(n),i="";for(let a=0;a<n.byteLength;a+=2){let o=s.getUint16(a,t);i+=String.fromCharCode(o)}return i}static fromString(e,t=!1){let n=new ArrayBuffer(e.length*2),s=new DataView(n);for(let i=0;i<e.length;i++)s.setUint16(i*2,e.charCodeAt(i),t);return n}},ct=class uh{static{u(this,"Convert")}static isHex(e){return typeof e===Ix&&cW.test(e)}static isBase64(e){return typeof e===Ix&&fW.test(e)}static isBase64Url(e){return typeof e===Ix&&hW.test(e)}static ToString(e,t="utf8"){let n=tt.toUint8Array(e);switch(t.toLowerCase()){case"utf8":return this.ToUtf8String(n);case"binary":return this.ToBinary(n);case"hex":return this.ToHex(n);case"base64":return this.ToBase64(n);case"base64url":return this.ToBase64Url(n);case"utf16le":return Fi.toString(n,!0);case"utf16":case"utf16be":return Fi.toString(n);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromString(e,t="utf8"){if(!e)return new ArrayBuffer(0);switch(t.toLowerCase()){case"utf8":return this.FromUtf8String(e);case"binary":return this.FromBinary(e);case"hex":return this.FromHex(e);case"base64":return this.FromBase64(e);case"base64url":return this.FromBase64Url(e);case"utf16le":return Fi.fromString(e,!0);case"utf16":case"utf16be":return Fi.fromString(e);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToBase64(e){let t=tt.toUint8Array(e);if(typeof btoa<"u"){let n=this.ToString(t,"binary");return btoa(n)}else return Buffer.from(t).toString("base64")}static FromBase64(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!uh.isBase64(t))throw new TypeError("Argument 'base64Text' is not Base64 encoded");return typeof atob<"u"?this.FromBinary(atob(t)):new Uint8Array(Buffer.from(t,"base64")).buffer}static FromBase64Url(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!uh.isBase64Url(t))throw new TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(t.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(e){return this.ToBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(e,t=uh.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.FromBinary(e);case"utf8":return xk.fromString(e);case"utf16":case"utf16be":return Fi.fromString(e);case"utf16le":case"usc2":return Fi.fromString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToUtf8String(e,t=uh.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.ToBinary(e);case"utf8":return xk.toString(e);case"utf16":case"utf16be":return Fi.toString(e);case"utf16le":case"usc2":return Fi.toString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromBinary(e){let t=e.length,n=new Uint8Array(t);for(let s=0;s<t;s++)n[s]=e.charCodeAt(s);return n.buffer}static ToBinary(e){let t=tt.toUint8Array(e),n="";for(let s=0;s<t.length;s++)n+=String.fromCharCode(t[s]);return n}static ToHex(e){let t=tt.toUint8Array(e),n="",s=t.length;for(let i=0;i<s;i++){let a=t[i];a<16&&(n+="0"),n+=a.toString(16)}return n}static FromHex(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!uh.isHex(t))throw new TypeError("Argument 'hexString' is not HEX encoded");t.length%2&&(t=`0${t}`);let n=new Uint8Array(t.length/2);for(let s=0;s<t.length;s=s+2){let i=t.slice(s,s+2);n[s/2]=parseInt(i,16)}return n.buffer}static ToUtf16String(e,t=!1){return Fi.toString(e,t)}static FromUtf16String(e,t=!1){return Fi.fromString(e,t)}static Base64Padding(e){let t=4-e.length%4;if(t<4)for(let n=0;n<t;n++)e+="=";return e}static formatString(e){return e?.replace(/[\n\r\t ]/g,"")||""}};ct.DEFAULT_UTF8_ENCODING="utf8";function T(r,e,t){var n;return r instanceof Object&&(n=r[e])!==null&&n!==void 0?n:t}u(T,"getParametersValue");function tE(r,e=0,t=r.byteLength-e,n=!1){let s="";for(let i of new Uint8Array(r,e,t)){let a=i.toString(16).toUpperCase();a.length===1&&(s+="0"),s+=a,n&&(s+=" ")}return s.trim()}u(tE,"bufferToHexCodes");function Sa(r,e){let t=0;if(r.length===1)return r[0];for(let n=r.length-1;n>=0;n--)t+=r[r.length-1-n]*Math.pow(2,e*n);return t}u(Sa,"utilFromBase");function ri(r,e,t=-1){let n=t,s=r,i=0,a=Math.pow(2,e);for(let o=1;o<8;o++){if(r<a){let l;if(n<0)l=new ArrayBuffer(o),i=o;else{if(n<o)return new ArrayBuffer(0);l=new ArrayBuffer(n),i=n}let c=new Uint8Array(l);for(let f=o-1;f>=0;f--){let p=Math.pow(2,f*e);c[i-f-1]=Math.floor(s/p),s-=c[i-f-1]*p}return l}a*=Math.pow(2,e)}return new ArrayBuffer(0)}u(ri,"utilToBase");function Cl(...r){let e=0,t=0;for(let i of r)e+=i.byteLength;let n=new ArrayBuffer(e),s=new Uint8Array(n);for(let i of r)s.set(new Uint8Array(i),t),t+=i.byteLength;return n}u(Cl,"utilConcatBuf");function rE(...r){let e=0,t=0;for(let i of r)e+=i.length;let n=new ArrayBuffer(e),s=new Uint8Array(n);for(let i of r)s.set(i,t),t+=i.length;return s}u(rE,"utilConcatView");function Bx(){let r=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){let o=r[0]===255&&r[1]&128,l=r[0]===0&&(r[1]&128)===0;(o||l)&&this.warnings.push("Needlessly long format")}let e=new ArrayBuffer(this.valueHex.byteLength),t=new Uint8Array(e);for(let o=0;o<this.valueHex.byteLength;o++)t[o]=0;t[0]=r[0]&128;let n=Sa(t,8),s=new ArrayBuffer(this.valueHex.byteLength),i=new Uint8Array(s);for(let o=0;o<this.valueHex.byteLength;o++)i[o]=r[o];return i[0]&=127,Sa(i,8)-n}u(Bx,"utilDecodeTC");function Tk(r){let e=r<0?r*-1:r,t=128;for(let n=1;n<8;n++){if(e<=t){if(r<0){let a=t-e,o=ri(a,8,n),l=new Uint8Array(o);return l[0]|=128,o}let s=ri(e,8,n),i=new Uint8Array(s);if(i[0]&128){let a=s.slice(0),o=new Uint8Array(a);s=new ArrayBuffer(s.byteLength+1),i=new Uint8Array(s);for(let l=0;l<a.byteLength;l++)i[l+1]=o[l];i[0]=0}return s}t*=Math.pow(2,8)}return new ArrayBuffer(0)}u(Tk,"utilEncodeTC");function Uo(r,e){if(r.byteLength!==e.byteLength)return!1;let t=new Uint8Array(r),n=new Uint8Array(e);for(let s=0;s<t.length;s++)if(t[s]!==n[s])return!1;return!0}u(Uo,"isEqualBuffer");function ns(r,e){let t=r.toString(10);if(e<t.length)return"";let n=e-t.length,s=new Array(n);for(let a=0;a<n;a++)s[a]="0";return s.join("").concat(t)}u(ns,"padNumber");var Ik="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Dk="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=";function nE(r,e=!1,t=!1,n=!1){let s=0,i=0,a=0,o="",l=e?Dk:Ik;if(n){let c=0;for(let f=0;f<r.length;f++)if(r.charCodeAt(f)!==0){c=f;break}r=r.slice(c)}for(;s<r.length;){let c=r.charCodeAt(s++);s>=r.length&&(i=1);let f=r.charCodeAt(s++);s>=r.length&&(a=1);let p=r.charCodeAt(s++),d=c>>2,m=(c&3)<<4|f>>4,g=(f&15)<<2|p>>6,S=p&63;i===1?g=S=64:a===1&&(S=64),t?g===64?o+=`${l.charAt(d)}${l.charAt(m)}`:S===64?o+=`${l.charAt(d)}${l.charAt(m)}${l.charAt(g)}`:o+=`${l.charAt(d)}${l.charAt(m)}${l.charAt(g)}${l.charAt(S)}`:o+=`${l.charAt(d)}${l.charAt(m)}${l.charAt(g)}${l.charAt(S)}`}return o}u(nE,"toBase64");function lh(r,e=!1,t=!1){let n=e?Dk:Ik;function s(l){for(let c=0;c<64;c++)if(n.charAt(c)===l)return c;return 64}u(s,"indexOf");function i(l){return l===64?0:l}u(i,"test");let a=0,o="";for(;a<r.length;){let l=s(r.charAt(a++)),c=a>=r.length?0:s(r.charAt(a++)),f=a>=r.length?0:s(r.charAt(a++)),p=a>=r.length?0:s(r.charAt(a++)),d=i(l)<<2|i(c)>>4,m=(i(c)&15)<<4|i(f)>>2,g=(i(f)&3)<<6|i(p);o+=String.fromCharCode(d),f!==64&&(o+=String.fromCharCode(m)),p!==64&&(o+=String.fromCharCode(g))}if(t){let l=o.length,c=-1;for(let f=l-1;f>=0;f--)if(o.charCodeAt(f)!==0){c=f;break}c!==-1?o=o.slice(0,c+1):o=""}return o}u(lh,"fromBase64");function Z0(r){let e="",t=new Uint8Array(r);for(let n of t)e+=String.fromCharCode(n);return e}u(Z0,"arrayBufferToString");function bl(r){let e=r.length,t=new ArrayBuffer(e),n=new Uint8Array(t);for(let s=0;s<e;s++)n[s]=r.charCodeAt(s);return t}u(bl,"stringToArrayBuffer");var pW=Math.log(2);function Bk(r){let e=Math.log(r)/pW,t=Math.floor(e),n=Math.round(e);return t===n?t:n}u(Bk,"nearestPowerOf2");function Se(r,e){for(let t of e)delete r[t]}u(Se,"clearProps");function sE(){if(typeof BigInt>"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}u(sE,"assertBigInt");function Px(r){let e=0,t=0;for(let s=0;s<r.length;s++){let i=r[s];e+=i.byteLength}let n=new Uint8Array(e);for(let s=0;s<r.length;s++){let i=r[s];n.set(new Uint8Array(i),t),t+=i.byteLength}return n.buffer}u(Px,"concat");function Aa(r,e,t,n){return e instanceof Uint8Array?e.byteLength?t<0?(r.error="Wrong parameter: inputOffset less than zero",!1):n<0?(r.error="Wrong parameter: inputLength less than zero",!1):e.byteLength-t-n<0?(r.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):!0:(r.error="Wrong parameter: inputBuffer has zero length",!1):(r.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}u(Aa,"checkBufferParams");var kx=class{static{u(this,"ViewWriter")}constructor(){this.items=[]}write(e){this.items.push(e)}final(){return Px(this.items)}},em=[new Uint8Array([1])],Ok="0123456789",Rx="name",_k="valueHexView",dW="isHexOnly",mW="idBlock",gW="tagClass",yW="tagNumber",vW="isConstructed",EW="fromBER",wW="toBER",SW="local",ss="",Ui=new ArrayBuffer(0),iE=new Uint8Array(0),rm="EndOfContent",kk="OCTET STRING",Lk="BIT STRING";function Ca(r){var e;return e=class extends r{static{u(this,"Some")}get valueHex(){return this.valueHexView.slice().buffer}set valueHex(n){this.valueHexView=new Uint8Array(n)}constructor(...n){var s;super(...n);let i=n[0]||{};this.isHexOnly=(s=i.isHexOnly)!==null&&s!==void 0?s:!1,this.valueHexView=i.valueHex?tt.toUint8Array(i.valueHex):iE}fromBER(n,s,i){let a=n instanceof ArrayBuffer?new Uint8Array(n):n;if(!Aa(this,a,s,i))return-1;let o=s+i;return this.valueHexView=a.subarray(s,o),this.valueHexView.length?(this.blockLength=i,o):(this.warnings.push("Zero buffer length"),s)}toBER(n=!1){return this.isHexOnly?n?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.byteLength===this.valueHexView.buffer.byteLength?this.valueHexView.buffer:this.valueHexView.slice().buffer:(this.error="Flag 'isHexOnly' is not set, abort",Ui)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:ct.ToHex(this.valueHexView)}}},e.NAME="hexBlock",e}u(Ca,"HexBlock");var xl=class{static{u(this,"LocalBaseBlock")}static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(e){this.valueBeforeDecodeView=new Uint8Array(e)}constructor({blockLength:e=0,error:t=ss,warnings:n=[],valueBeforeDecode:s=iE}={}){this.blockLength=e,this.error=t,this.warnings=n,this.valueBeforeDecodeView=tt.toUint8Array(s)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:ct.ToHex(this.valueBeforeDecodeView)}}};xl.NAME="baseBlock";var is=class extends xl{static{u(this,"ValueBlock")}fromBER(e,t,n){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(e,t){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}};is.NAME="valueBlock";var Vk=class extends Ca(xl){static{u(this,"LocalIdentificationBlock")}constructor({idBlock:e={}}={}){var t,n,s,i;super(),e?(this.isHexOnly=(t=e.isHexOnly)!==null&&t!==void 0?t:!1,this.valueHexView=e.valueHex?tt.toUint8Array(e.valueHex):iE,this.tagClass=(n=e.tagClass)!==null&&n!==void 0?n:-1,this.tagNumber=(s=e.tagNumber)!==null&&s!==void 0?s:-1,this.isConstructed=(i=e.isConstructed)!==null&&i!==void 0?i:!1):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(e=!1){let t=0;switch(this.tagClass){case 1:t|=0;break;case 2:t|=64;break;case 3:t|=128;break;case 4:t|=192;break;default:return this.error="Unknown tag class",Ui}if(this.isConstructed&&(t|=32),this.tagNumber<31&&!this.isHexOnly){let s=new Uint8Array(1);if(!e){let i=this.tagNumber;i&=31,t|=i,s[0]=t}return s.buffer}if(!this.isHexOnly){let s=ri(this.tagNumber,7),i=new Uint8Array(s),a=s.byteLength,o=new Uint8Array(a+1);if(o[0]=t|31,!e){for(let l=0;l<a-1;l++)o[l+1]=i[l]|128;o[a]=i[a-1]}return o.buffer}let n=new Uint8Array(this.valueHexView.byteLength+1);if(n[0]=t|31,!e){let s=this.valueHexView;for(let i=0;i<s.length-1;i++)n[i+1]=s[i]|128;n[this.valueHexView.byteLength]=s[s.length-1]}return n.buffer}fromBER(e,t,n){let s=tt.toUint8Array(e);if(!Aa(this,s,t,n))return-1;let i=s.subarray(t,t+n);if(i.length===0)return this.error="Zero buffer length",-1;switch(i[0]&192){case 0:this.tagClass=1;break;case 64:this.tagClass=2;break;case 128:this.tagClass=3;break;case 192:this.tagClass=4;break;default:return this.error="Unknown tag class",-1}this.isConstructed=(i[0]&32)===32,this.isHexOnly=!1;let o=i[0]&31;if(o!==31)this.tagNumber=o,this.blockLength=1;else{let l=1,c=this.valueHexView=new Uint8Array(255),f=255;for(;i[l]&128;){if(c[l-1]=i[l]&127,l++,l>=i.length)return this.error="End of input reached before message was fully decoded",-1;if(l===f){f+=255;let d=new Uint8Array(f);for(let m=0;m<c.length;m++)d[m]=c[m];c=this.valueHexView=new Uint8Array(f)}}this.blockLength=l+1,c[l-1]=i[l]&127;let p=new Uint8Array(l);for(let d=0;d<l;d++)p[d]=c[d];c=this.valueHexView=new Uint8Array(l),c.set(p),this.blockLength<=9?this.tagNumber=Sa(c,7):(this.isHexOnly=!0,this.warnings.push("Tag too long, represented as hex-coded"))}if(this.tagClass===1&&this.isConstructed)switch(this.tagNumber){case 1:case 2:case 5:case 6:case 9:case 13:case 14:case 23:case 24:case 31:case 32:case 33:case 34:return this.error="Constructed encoding used for primitive type",-1}return t+this.blockLength}toJSON(){return{...super.toJSON(),tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed}}};Vk.NAME="identificationBlock";var Fk=class extends xl{static{u(this,"LocalLengthBlock")}constructor({lenBlock:e={}}={}){var t,n,s;super(),this.isIndefiniteForm=(t=e.isIndefiniteForm)!==null&&t!==void 0?t:!1,this.longFormUsed=(n=e.longFormUsed)!==null&&n!==void 0?n:!1,this.length=(s=e.length)!==null&&s!==void 0?s:0}fromBER(e,t,n){let s=tt.toUint8Array(e);if(!Aa(this,s,t,n))return-1;let i=s.subarray(t,t+n);if(i.length===0)return this.error="Zero buffer length",-1;if(i[0]===255)return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=i[0]===128,this.isIndefiniteForm)return this.blockLength=1,t+this.blockLength;if(this.longFormUsed=!!(i[0]&128),this.longFormUsed===!1)return this.length=i[0],this.blockLength=1,t+this.blockLength;let a=i[0]&127;if(a>8)return this.error="Too big integer",-1;if(a+1>i.length)return this.error="End of input reached before message was fully decoded",-1;let o=t+1,l=s.subarray(o,o+a);return l[a-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=Sa(l,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=a+1,t+this.blockLength}toBER(e=!1){let t,n;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return t=new ArrayBuffer(1),e===!1&&(n=new Uint8Array(t),n[0]=128),t;if(this.longFormUsed){let s=ri(this.length,8);if(s.byteLength>127)return this.error="Too big length",Ui;if(t=new ArrayBuffer(s.byteLength+1),e)return t;let i=new Uint8Array(s);n=new Uint8Array(t),n[0]=s.byteLength|128;for(let a=0;a<s.byteLength;a++)n[a+1]=i[a];return t}return t=new ArrayBuffer(1),e===!1&&(n=new Uint8Array(t),n[0]=this.length),t}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}};Fk.NAME="lengthBlock";var Ge={},qn=class extends xl{static{u(this,"BaseBlock")}constructor({name:e=ss,optional:t=!1,primitiveSchema:n,...s}={},i){super(s),this.name=e,this.optional=t,n&&(this.primitiveSchema=n),this.idBlock=new Vk(s),this.lenBlock=new Fk(s),this.valueBlock=i?new i(s):new is(s)}fromBER(e,t,n){let s=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return s===-1?(this.error=this.valueBlock.error,s):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),s)}toBER(e,t){let n=t||new kx;t||Uk(this);let s=this.idBlock.toBER(e);if(n.write(s),this.lenBlock.isIndefiniteForm)n.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(e,n),n.write(new ArrayBuffer(2));else{let i=this.valueBlock.toBER(e);this.lenBlock.length=i.byteLength;let a=this.lenBlock.toBER(e);n.write(a),n.write(i)}return t?Ui:n.final()}toJSON(){let e={...super.toJSON(),idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional};return this.primitiveSchema&&(e.primitiveSchema=this.primitiveSchema.toJSON()),e}toString(e="ascii"){return e==="ascii"?this.onAsciiEncoding():ct.ToHex(this.toBER())}onAsciiEncoding(){let e=this.constructor.NAME,t=ct.ToHex(this.valueBlock.valueBeforeDecodeView);return`${e} : ${t}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;let t=this.toBER(),n=e.toBER();return Uo(t,n)}};qn.NAME="BaseBlock";function Uk(r){var e;if(r instanceof Ge.Constructed)for(let t of r.valueBlock.value)Uk(t)&&(r.lenBlock.isIndefiniteForm=!0);return!!(!((e=r.lenBlock)===null||e===void 0)&&e.isIndefiniteForm)}u(Uk,"prepareIndefiniteForm");var Mk=class extends qn{static{u(this,"BaseStringBlock")}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}constructor({value:e=ss,...t}={},n){super(t,n),e&&this.fromString(e)}fromBER(e,t,n){let s=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return s===-1?(this.error=this.valueBlock.error,s):(this.fromBuffer(this.valueBlock.valueHexView),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),s)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}};Mk.NAME="BaseStringBlock";var jk=class extends Ca(is){static{u(this,"LocalPrimitiveValueBlock")}constructor({isHexOnly:e=!0,...t}={}){super(t),this.isHexOnly=e}};jk.NAME="PrimitiveValueBlock";var qk,nt=class extends qn{static{u(this,"Primitive")}constructor(e={}){super(e,jk),this.idBlock.isConstructed=!1}};qk=nt;Ge.Primitive=qk;nt.NAME="PRIMITIVE";function AW(r,e){if(r instanceof e)return r;let t=new e;return t.idBlock=r.idBlock,t.lenBlock=r.lenBlock,t.warnings=r.warnings,t.valueBeforeDecodeView=r.valueBeforeDecodeView,t}u(AW,"localChangeType");function nm(r,e=0,t=r.length){let n=e,s=new qn({},is),i=new xl;if(!Aa(i,r,e,t))return s.error=i.error,{offset:-1,result:s};if(!r.subarray(e,e+t).length)return s.error="Zero buffer length",{offset:-1,result:s};let o=s.idBlock.fromBER(r,e,t);if(s.idBlock.warnings.length&&s.warnings.concat(s.idBlock.warnings),o===-1)return s.error=s.idBlock.error,{offset:-1,result:s};if(e=o,t-=s.idBlock.blockLength,o=s.lenBlock.fromBER(r,e,t),s.lenBlock.warnings.length&&s.warnings.concat(s.lenBlock.warnings),o===-1)return s.error=s.lenBlock.error,{offset:-1,result:s};if(e=o,t-=s.lenBlock.blockLength,!s.idBlock.isConstructed&&s.lenBlock.isIndefiniteForm)return s.error="Indefinite length form used for primitive encoding form",{offset:-1,result:s};let l=qn;switch(s.idBlock.tagClass){case 1:if(s.idBlock.tagNumber>=37&&s.idBlock.isHexOnly===!1)return s.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:s};switch(s.idBlock.tagNumber){case 0:if(s.idBlock.isConstructed&&s.lenBlock.length>0)return s.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:s};l=Ge.EndOfContent;break;case 1:l=Ge.Boolean;break;case 2:l=Ge.Integer;break;case 3:l=Ge.BitString;break;case 4:l=Ge.OctetString;break;case 5:l=Ge.Null;break;case 6:l=Ge.ObjectIdentifier;break;case 10:l=Ge.Enumerated;break;case 12:l=Ge.Utf8String;break;case 13:l=Ge.RelativeObjectIdentifier;break;case 14:l=Ge.TIME;break;case 15:return s.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:s};case 16:l=Ge.Sequence;break;case 17:l=Ge.Set;break;case 18:l=Ge.NumericString;break;case 19:l=Ge.PrintableString;break;case 20:l=Ge.TeletexString;break;case 21:l=Ge.VideotexString;break;case 22:l=Ge.IA5String;break;case 23:l=Ge.UTCTime;break;case 24:l=Ge.GeneralizedTime;break;case 25:l=Ge.GraphicString;break;case 26:l=Ge.VisibleString;break;case 27:l=Ge.GeneralString;break;case 28:l=Ge.UniversalString;break;case 29:l=Ge.CharacterString;break;case 30:l=Ge.BmpString;break;case 31:l=Ge.DATE;break;case 32:l=Ge.TimeOfDay;break;case 33:l=Ge.DateTime;break;case 34:l=Ge.Duration;break;default:{let c=s.idBlock.isConstructed?new Ge.Constructed:new Ge.Primitive;c.idBlock=s.idBlock,c.lenBlock=s.lenBlock,c.warnings=s.warnings,s=c}}break;case 2:case 3:case 4:default:l=s.idBlock.isConstructed?Ge.Constructed:Ge.Primitive}return s=AW(s,l),o=s.fromBER(r,e,s.lenBlock.isIndefiniteForm?t:s.lenBlock.length),s.valueBeforeDecodeView=r.subarray(n,n+s.blockLength),{offset:o,result:s}}u(nm,"localFromBER");function Nr(r){if(!r.byteLength){let e=new qn({},is);return e.error="Input buffer has zero length",{offset:-1,result:e}}return nm(tt.toUint8Array(r).slice(),0,r.byteLength)}u(Nr,"fromBER");function CW(r,e){return r?1:e}u(CW,"checkLen");var Mo=class extends is{static{u(this,"LocalConstructedValueBlock")}constructor({value:e=[],isIndefiniteForm:t=!1,...n}={}){super(n),this.value=e,this.isIndefiniteForm=t}fromBER(e,t,n){let s=tt.toUint8Array(e);if(!Aa(this,s,t,n))return-1;if(this.valueBeforeDecodeView=s.subarray(t,t+n),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),t;let i=t;for(;CW(this.isIndefiniteForm,n)>0;){let a=nm(s,i,n);if(a.offset===-1)return this.error=a.result.error,this.warnings.concat(a.result.warnings),-1;if(i=a.offset,this.blockLength+=a.result.blockLength,n-=a.result.blockLength,this.value.push(a.result),this.isIndefiniteForm&&a.result.constructor.NAME===rm)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===rm?this.value.pop():this.warnings.push("No EndOfContent block encoded")),i}toBER(e,t){let n=t||new kx;for(let s=0;s<this.value.length;s++)this.value[s].toBER(e,n);return t?Ui:n.final()}toJSON(){let e={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(let t of this.value)e.value.push(t.toJSON());return e}};Mo.NAME="ConstructedValueBlock";var Hk,ee=class extends qn{static{u(this,"Constructed")}constructor(e={}){super(e,Mo),this.idBlock.isConstructed=!0}fromBER(e,t,n){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;let s=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return s===-1?(this.error=this.valueBlock.error,s):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),s)}onAsciiEncoding(){let e=[];for(let n of this.valueBlock.value)e.push(n.toString("ascii").split(`
87
87
  `).map(s=>` ${s}`).join(`
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { B as BuilderOptions, W as CacheAdapter, b as CanonicalizationMethod, s as CanonicalizeOptions, J as CellOptions, C as CertificateInfo, Y as CertificateRepository, m as Client, A as ColorValue, D as DecimalValue, ag as DeepPartial, e as DigestAlgorithm, y as DocumentOptions, ab as Either, a9 as EntitySigner, E as Environment, j as EnvironmentCode, o as ExtractReturnType, Z as HeaderValue, a3 as HttpClient, $ as HttpClientHeaders, a2 as HttpResponse, I as ImageOptions, K as KnownKeys, ac as Left, x as NFeTsError, N as Namespaced, L as PDFTableObject, P as ParserOptions, V as PdfBuilder, R as ReadCertificateRequest, a as ReadCertificateResponse, a4 as RemoteTransmissionRepository, u as RenderOptions, a1 as RequestConfig, a0 as ResponseType, ad as Right, U as RowBuilderFunction, O as RowBuilderOptions, Q as RowOptions, F as RuleValue, n as SendTransmissionPayload, l as Signature, d as SignatureAlgorithm, c as SignatureMethod, S as SignatureNamespace, a6 as SignedEntity, k as SignedInfo, a8 as Signer, a5 as SignerOptions, a7 as SignerRepository, i as StateAcronym, g as StateAcronyms, h as StateCode, f as StateCodes, G as TableOptions, H as TableOptionsWithData, z as TextOptions, T as Transforms, q as Transmitter, p as TransmitterOptions, M as TupleOfLength, ah as UnionToIntersection, X as XmlDeclarationAttributes, aa as XmlSigner, w as XmlToolkit, _ as _TupleOfLength, t as defaultBuilderOptions, r as defaultCanonicalizeOptions, v as defaultParserOptions, ae as left, af as right } from './types-BlTnVW8U.cjs';
2
- export { ASN1, Choice, ChoiceOptions, Decimal, IsDecimal, MemoryCacheAdapter, NativeCertificateRepository, NullCacheAdapter, Once, PdfkitPdfBuilder, SkipAllValidations, SkipValidation, SkipValidationMetadata, SoapRemoteTransmissionRepository, StateCodeAcValidator, StateCodeAlValidator, StateCodeAmValidator, StateCodeApValidator, StateCodeBaValidator, StateCodeCeValidator, StateCodeDfValidator, StateCodeEsValidator, StateCodeGoValidator, StateCodeMaValidator, StateCodeMgValidator, StateCodeMsValidator, StateCodeMtValidator, StateCodePaValidator, StateCodePbValidator, StateCodePeValidator, StateCodePiValidator, StateCodePrValidator, StateCodeRjValidator, StateCodeRnValidator, StateCodeRoValidator, StateCodeRrValidator, StateCodeRsValidator, StateCodeScValidator, StateCodeSeValidator, StateCodeSpValidator, StateCodeToValidator, StrategyPattern, TransformDateString, TransformDecimal, TransformDecimalArgs, TransformToDateStringArgs, TransmissionError, TransmissionHostNotFoundError, TransmissionTimeoutError, ValidateErrorsMetadata, Validates, ValidationError, Xml2JsToolkit, clearEmptyValues, fixUtf8Mojibake, leftFromError, leftFromTransmissionError, mapConstraintsToErrors, mapTransmissionError, normalizeTransmissionStrings, plainToInstance, search, timezones, unreachable } from './core/index.cjs';
2
+ export { ASN1, Choice, ChoiceOptions, Decimal, IsDecimal, MemoryCacheAdapter, NativeCertificateRepository, NullCacheAdapter, Once, PdfkitPdfBuilder, SkipAllValidations, SkipValidation, SkipValidationMetadata, SoapRemoteTransmissionRepository, StateCodeAcValidator, StateCodeAlValidator, StateCodeAmValidator, StateCodeApValidator, StateCodeBaValidator, StateCodeCeValidator, StateCodeDfValidator, StateCodeEsValidator, StateCodeGoValidator, StateCodeMaValidator, StateCodeMgValidator, StateCodeMsValidator, StateCodeMtValidator, StateCodePaValidator, StateCodePbValidator, StateCodePeValidator, StateCodePiValidator, StateCodePrValidator, StateCodeRjValidator, StateCodeRnValidator, StateCodeRoValidator, StateCodeRrValidator, StateCodeRsValidator, StateCodeScValidator, StateCodeSeValidator, StateCodeSpValidator, StateCodeToValidator, StrategyPattern, TransformDateString, TransformDecimal, TransformDecimalArgs, TransformToDateStringArgs, TransmissionError, TransmissionHostNotFoundError, TransmissionTimeoutError, ValidateErrorsMetadata, Validates, ValidatesOptions, ValidationError, Xml2JsToolkit, clearEmptyValues, fixUtf8Mojibake, leftFromError, leftFromTransmissionError, mapConstraintsToErrors, mapTransmissionError, normalizeTransmissionStrings, plainToInstance, search, timezones, unreachable } from './core/index.cjs';
3
3
  export { default as dateToolkit } from 'dayjs';
4
4
  export { AccessKey, AccessKeyBuilder, AgropecuarioBuilder, AssembleDetXmlBuilder, AssembleNfeBuilder, AsynchronousAutorizacaoResponse, AutXMLBuilder, AutorizacaoPayload, AutorizacaoRequest, AutorizacaoResponse, AvulsaBuilder, Builder, CanaBuilder, CobrBuilder, CofinsBuilder, CofinsStBuilder, CompraBuilder, ConsultStatusPayload, ConsultStatusRequest, ConsultStatusResponse, ConsultaCadastroPayload, ConsultaCadastroRequest, ConsultaCadastroResponse, ConsultaProtocoloPayload, ConsultaProtocoloRequest, ConsultaProtocoloResponse, ContingencyOptions, DFeReferenciadoBuilder, DanfceDefaultPdfDocument, DanfceReducedPdfDocument, DefaultDetBuilderAggregator, DefaultSchema, DefaultTotalBuilderAggregator, DestBuilder, DetBuilder, DetBuilderAggregator, DetEventoCancelamento, DetGroupBuilder, EmitBuilder, EntregaBuilder, EventoCancelamento, EventoCstatToCancelRegister, EventoCstatToProtocol, EventoItem, EventoItemAttributes, EventoLotePayload, EventoLoteResponse, EventoPayload, EventoRequest, EventoResponse, ExportaBuilder, ICMS, ICMS00, ICMS02, ICMS10, ICMS15, ICMS20, ICMS30, ICMS40, ICMS51, ICMS53, ICMS60, ICMS61, ICMS70, ICMS90, ICMSPart, ICMSSN, ICMSSN101, ICMSSN102, ICMSSN201, ICMSSN202, ICMSSN500, ICMSSN900, ICMSST, ICMSStandard, IIBuilder, INfeDetXmlBuilder, INfeXmlBuilder, IbsCbsTotBuilder, IbscbsBuilder, IcmsBuilder, IcmsIpiBuilder, IcmsOrIssQnBuilder, IcmsufdestBuilder, IdeBuilder, ImpostoBuilder, InfAdicBuilder, InfEvento, InfEventoAttributes, InfIntermedBuilder, InfInut, InfInutAttributes, InfNFeBuilder, InfPAABuilder, InfProt, InfRespTecBuilder, InfSolicNFFBuilder, InutCstatToProtocol, InutNFeAttributes, InutilizacaoPayload, InutilizacaoRequest, InutilizacaoResponse, IsBuilder, IsTotBuilder, IssIpiBuilder, IssQnBuilder, NFCe, NFCeDto, NFCeProc, NFe, NFeAttributes, NFeDto, NFeProc, NFeProcAttributes, NfceAuthorizerPipeline, NfceCancelPipeline, NfceConsultProtocoloPipeline, NfceConsultStatusPipeline, NfceContingencyXmlAuthorizerPipeline, NfceQrcode, NfceQrcodeOptions, NfceQrcodeOptions200, NfceQrcodeOptions300, NfceQrcodeOptionsBase, NfceRemoteClient, NfceRemoteTransmitter, NfceTransmitter, NfceTransmitterOptions, NfceVoidRangePipeline, NfceXmlBuilder, NfceXmlBuilderPipeline, NfeAuthorizationResponsePipeline, NfeAuthorizerPayload, NfeAuthorizerPipeline, NfeCancelPipeline, NfeComplements, NfeConsultProtocoloPipeline, NfeConsultStatusPipeline, NfeCstatToProtocol, NfeDetXmlBuilder, NfeRemoteClient, NfeRemoteTransmitter, NfeTransmitter, NfeTransmitterOptions, NfeVoidRangePipeline, NfeXmlBuilder, NfeXmlBuilderPipeline, OptionalSharedImpostoBuilder, PL_009, PL_010, PagBuilder, PipelineAuthorizerResponse, PipelineEventResponse, PipelineInutilizacaoResponse, PisBuilder, PisStBuilder, ProcEventoNFe, ProcInutNFe, ProdBuilder, ProtNFe, ProtNFeAttributes, RetAutorizacaoPayload, RetAutorizacaoRequest, RetAutorizacaoResponse, RetCancNFe, RetEvento, RetEventoItem, RetInutNFe, RetiradaBuilder, Schema, SynchronousAutorizacaoResponse, TotalBuilder, TotalBuilderAggregator, TotalIncrementHost, TpEmis, TpEvent, TranspBuilder, VItemBuilder, VerifiedAccessKey, VoidRangePayload, XmlValidationError, schemas } from './nfe/index.cjs';
5
5
  import 'node:stream';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { B as BuilderOptions, W as CacheAdapter, b as CanonicalizationMethod, s as CanonicalizeOptions, J as CellOptions, C as CertificateInfo, Y as CertificateRepository, m as Client, A as ColorValue, D as DecimalValue, ag as DeepPartial, e as DigestAlgorithm, y as DocumentOptions, ab as Either, a9 as EntitySigner, E as Environment, j as EnvironmentCode, o as ExtractReturnType, Z as HeaderValue, a3 as HttpClient, $ as HttpClientHeaders, a2 as HttpResponse, I as ImageOptions, K as KnownKeys, ac as Left, x as NFeTsError, N as Namespaced, L as PDFTableObject, P as ParserOptions, V as PdfBuilder, R as ReadCertificateRequest, a as ReadCertificateResponse, a4 as RemoteTransmissionRepository, u as RenderOptions, a1 as RequestConfig, a0 as ResponseType, ad as Right, U as RowBuilderFunction, O as RowBuilderOptions, Q as RowOptions, F as RuleValue, n as SendTransmissionPayload, l as Signature, d as SignatureAlgorithm, c as SignatureMethod, S as SignatureNamespace, a6 as SignedEntity, k as SignedInfo, a8 as Signer, a5 as SignerOptions, a7 as SignerRepository, i as StateAcronym, g as StateAcronyms, h as StateCode, f as StateCodes, G as TableOptions, H as TableOptionsWithData, z as TextOptions, T as Transforms, q as Transmitter, p as TransmitterOptions, M as TupleOfLength, ah as UnionToIntersection, X as XmlDeclarationAttributes, aa as XmlSigner, w as XmlToolkit, _ as _TupleOfLength, t as defaultBuilderOptions, r as defaultCanonicalizeOptions, v as defaultParserOptions, ae as left, af as right } from './types-BlTnVW8U.js';
2
- export { ASN1, Choice, ChoiceOptions, Decimal, IsDecimal, MemoryCacheAdapter, NativeCertificateRepository, NullCacheAdapter, Once, PdfkitPdfBuilder, SkipAllValidations, SkipValidation, SkipValidationMetadata, SoapRemoteTransmissionRepository, StateCodeAcValidator, StateCodeAlValidator, StateCodeAmValidator, StateCodeApValidator, StateCodeBaValidator, StateCodeCeValidator, StateCodeDfValidator, StateCodeEsValidator, StateCodeGoValidator, StateCodeMaValidator, StateCodeMgValidator, StateCodeMsValidator, StateCodeMtValidator, StateCodePaValidator, StateCodePbValidator, StateCodePeValidator, StateCodePiValidator, StateCodePrValidator, StateCodeRjValidator, StateCodeRnValidator, StateCodeRoValidator, StateCodeRrValidator, StateCodeRsValidator, StateCodeScValidator, StateCodeSeValidator, StateCodeSpValidator, StateCodeToValidator, StrategyPattern, TransformDateString, TransformDecimal, TransformDecimalArgs, TransformToDateStringArgs, TransmissionError, TransmissionHostNotFoundError, TransmissionTimeoutError, ValidateErrorsMetadata, Validates, ValidationError, Xml2JsToolkit, clearEmptyValues, fixUtf8Mojibake, leftFromError, leftFromTransmissionError, mapConstraintsToErrors, mapTransmissionError, normalizeTransmissionStrings, plainToInstance, search, timezones, unreachable } from './core/index.js';
2
+ export { ASN1, Choice, ChoiceOptions, Decimal, IsDecimal, MemoryCacheAdapter, NativeCertificateRepository, NullCacheAdapter, Once, PdfkitPdfBuilder, SkipAllValidations, SkipValidation, SkipValidationMetadata, SoapRemoteTransmissionRepository, StateCodeAcValidator, StateCodeAlValidator, StateCodeAmValidator, StateCodeApValidator, StateCodeBaValidator, StateCodeCeValidator, StateCodeDfValidator, StateCodeEsValidator, StateCodeGoValidator, StateCodeMaValidator, StateCodeMgValidator, StateCodeMsValidator, StateCodeMtValidator, StateCodePaValidator, StateCodePbValidator, StateCodePeValidator, StateCodePiValidator, StateCodePrValidator, StateCodeRjValidator, StateCodeRnValidator, StateCodeRoValidator, StateCodeRrValidator, StateCodeRsValidator, StateCodeScValidator, StateCodeSeValidator, StateCodeSpValidator, StateCodeToValidator, StrategyPattern, TransformDateString, TransformDecimal, TransformDecimalArgs, TransformToDateStringArgs, TransmissionError, TransmissionHostNotFoundError, TransmissionTimeoutError, ValidateErrorsMetadata, Validates, ValidatesOptions, ValidationError, Xml2JsToolkit, clearEmptyValues, fixUtf8Mojibake, leftFromError, leftFromTransmissionError, mapConstraintsToErrors, mapTransmissionError, normalizeTransmissionStrings, plainToInstance, search, timezones, unreachable } from './core/index.js';
3
3
  export { default as dateToolkit } from 'dayjs';
4
4
  export { AccessKey, AccessKeyBuilder, AgropecuarioBuilder, AssembleDetXmlBuilder, AssembleNfeBuilder, AsynchronousAutorizacaoResponse, AutXMLBuilder, AutorizacaoPayload, AutorizacaoRequest, AutorizacaoResponse, AvulsaBuilder, Builder, CanaBuilder, CobrBuilder, CofinsBuilder, CofinsStBuilder, CompraBuilder, ConsultStatusPayload, ConsultStatusRequest, ConsultStatusResponse, ConsultaCadastroPayload, ConsultaCadastroRequest, ConsultaCadastroResponse, ConsultaProtocoloPayload, ConsultaProtocoloRequest, ConsultaProtocoloResponse, ContingencyOptions, DFeReferenciadoBuilder, DanfceDefaultPdfDocument, DanfceReducedPdfDocument, DefaultDetBuilderAggregator, DefaultSchema, DefaultTotalBuilderAggregator, DestBuilder, DetBuilder, DetBuilderAggregator, DetEventoCancelamento, DetGroupBuilder, EmitBuilder, EntregaBuilder, EventoCancelamento, EventoCstatToCancelRegister, EventoCstatToProtocol, EventoItem, EventoItemAttributes, EventoLotePayload, EventoLoteResponse, EventoPayload, EventoRequest, EventoResponse, ExportaBuilder, ICMS, ICMS00, ICMS02, ICMS10, ICMS15, ICMS20, ICMS30, ICMS40, ICMS51, ICMS53, ICMS60, ICMS61, ICMS70, ICMS90, ICMSPart, ICMSSN, ICMSSN101, ICMSSN102, ICMSSN201, ICMSSN202, ICMSSN500, ICMSSN900, ICMSST, ICMSStandard, IIBuilder, INfeDetXmlBuilder, INfeXmlBuilder, IbsCbsTotBuilder, IbscbsBuilder, IcmsBuilder, IcmsIpiBuilder, IcmsOrIssQnBuilder, IcmsufdestBuilder, IdeBuilder, ImpostoBuilder, InfAdicBuilder, InfEvento, InfEventoAttributes, InfIntermedBuilder, InfInut, InfInutAttributes, InfNFeBuilder, InfPAABuilder, InfProt, InfRespTecBuilder, InfSolicNFFBuilder, InutCstatToProtocol, InutNFeAttributes, InutilizacaoPayload, InutilizacaoRequest, InutilizacaoResponse, IsBuilder, IsTotBuilder, IssIpiBuilder, IssQnBuilder, NFCe, NFCeDto, NFCeProc, NFe, NFeAttributes, NFeDto, NFeProc, NFeProcAttributes, NfceAuthorizerPipeline, NfceCancelPipeline, NfceConsultProtocoloPipeline, NfceConsultStatusPipeline, NfceContingencyXmlAuthorizerPipeline, NfceQrcode, NfceQrcodeOptions, NfceQrcodeOptions200, NfceQrcodeOptions300, NfceQrcodeOptionsBase, NfceRemoteClient, NfceRemoteTransmitter, NfceTransmitter, NfceTransmitterOptions, NfceVoidRangePipeline, NfceXmlBuilder, NfceXmlBuilderPipeline, NfeAuthorizationResponsePipeline, NfeAuthorizerPayload, NfeAuthorizerPipeline, NfeCancelPipeline, NfeComplements, NfeConsultProtocoloPipeline, NfeConsultStatusPipeline, NfeCstatToProtocol, NfeDetXmlBuilder, NfeRemoteClient, NfeRemoteTransmitter, NfeTransmitter, NfeTransmitterOptions, NfeVoidRangePipeline, NfeXmlBuilder, NfeXmlBuilderPipeline, OptionalSharedImpostoBuilder, PL_009, PL_010, PagBuilder, PipelineAuthorizerResponse, PipelineEventResponse, PipelineInutilizacaoResponse, PisBuilder, PisStBuilder, ProcEventoNFe, ProcInutNFe, ProdBuilder, ProtNFe, ProtNFeAttributes, RetAutorizacaoPayload, RetAutorizacaoRequest, RetAutorizacaoResponse, RetCancNFe, RetEvento, RetEventoItem, RetInutNFe, RetiradaBuilder, Schema, SynchronousAutorizacaoResponse, TotalBuilder, TotalBuilderAggregator, TotalIncrementHost, TpEmis, TpEvent, TranspBuilder, VItemBuilder, VerifiedAccessKey, VoidRangePayload, XmlValidationError, schemas } from './nfe/index.js';
5
5
  import 'node:stream';