nfets 0.0.27 → 0.0.35

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.
@@ -86,7 +86,7 @@ Actual: `+P.attribValue);else{var Xe=P.tag,Re=P.tags[P.tags.length-1]||P;Xe.ns==
86
86
 
87
87
  \r Response Body: `+m.data))},a,u)):(d9("Reading file: %s",r),Zhe.readFile(r,"utf8",(f,h)=>{f?s(f):(c=new nE(h,r,n),i[r]=c,c.WSDL_CACHE=i,c.onReady(s))})),c}o(v9,"open_wsdl")});var x9=Q(y9=>{"use strict";Object.defineProperty(y9,"__esModule",{value:!0})});var E9=Q(kt=>{"use strict";var w9=kt&&kt.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:o(function(){return e[t]},"get")}),Object.defineProperty(r,n,s)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),ape=kt&&kt.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),ope=kt&&kt.__importStar||(function(){var r=o(function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(n[n.length]=s);return n},r(e)},"ownKeys");return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),s=0;s<n.length;s++)n[s]!=="default"&&w9(t,e,n[s]);return ape(t,e),t}})(),upe=kt&&kt.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&w9(e,r,t)};Object.defineProperty(kt,"__esModule",{value:!0});kt.WSDL=kt.passwordDigest=kt.Server=kt.WSSecurityCertWithToken=kt.WSSecurityPlusCert=kt.WSSecurityCert=kt.WSSecurity=kt.NTLMSecurity=kt.ClientSSLSecurityPFX=kt.ClientSSLSecurity=kt.BearerSecurity=kt.BasicAuthSecurity=kt.HttpClient=kt.Client=kt.security=void 0;kt.createClient=b9;kt.createClientAsync=wpe;kt.listen=Spe;var cpe=G_(),lpe=ope(IB()),fpe=_B(),hpe=gc(),S9=XB();kt.security=lpe;var ppe=G_();Object.defineProperty(kt,"Client",{enumerable:!0,get:o(function(){return ppe.Client},"get")});var dpe=bb();Object.defineProperty(kt,"HttpClient",{enumerable:!0,get:o(function(){return dpe.HttpClient},"get")});var zo=IB();Object.defineProperty(kt,"BasicAuthSecurity",{enumerable:!0,get:o(function(){return zo.BasicAuthSecurity},"get")});Object.defineProperty(kt,"BearerSecurity",{enumerable:!0,get:o(function(){return zo.BearerSecurity},"get")});Object.defineProperty(kt,"ClientSSLSecurity",{enumerable:!0,get:o(function(){return zo.ClientSSLSecurity},"get")});Object.defineProperty(kt,"ClientSSLSecurityPFX",{enumerable:!0,get:o(function(){return zo.ClientSSLSecurityPFX},"get")});Object.defineProperty(kt,"NTLMSecurity",{enumerable:!0,get:o(function(){return zo.NTLMSecurity},"get")});Object.defineProperty(kt,"WSSecurity",{enumerable:!0,get:o(function(){return zo.WSSecurity},"get")});Object.defineProperty(kt,"WSSecurityCert",{enumerable:!0,get:o(function(){return zo.WSSecurityCert},"get")});Object.defineProperty(kt,"WSSecurityPlusCert",{enumerable:!0,get:o(function(){return zo.WSSecurityPlusCert},"get")});Object.defineProperty(kt,"WSSecurityCertWithToken",{enumerable:!0,get:o(function(){return zo.WSSecurityCertWithToken},"get")});var mpe=_B();Object.defineProperty(kt,"Server",{enumerable:!0,get:o(function(){return mpe.Server},"get")});var gpe=gc();Object.defineProperty(kt,"passwordDigest",{enumerable:!0,get:o(function(){return gpe.passwordDigest},"get")});upe(x9(),kt);var vpe=XB();Object.defineProperty(kt,"WSDL",{enumerable:!0,get:o(function(){return vpe.WSDL},"get")});function ype(r,e,t,n){e.has(r)?process.nextTick(()=>{n(null,e.get(r))}):t((s,i)=>{if(s)return n(s);e.set(r,i),n(null,i)})}o(ype,"getFromCache");function xpe(r,e,t){typeof e=="function"&&(t=e,e={});let n=o(s=>{(0,S9.open_wsdl)(r,e,s)},"openWsdl");if(e.disableCache===!0)n(t);else{let s;e.wsdlCache?s=e.wsdlCache:s=hpe.wsdlCacheSingleton,ype(r,s,n,t)}}o(xpe,"_requestWSDL");function b9(r,e,t,n){let s=n,i,a;typeof e=="function"?(i=e,s=t,a={}):typeof t=="function"&&(a=e,i=t,s=n),s=a.endpoint||s,xpe(r,a,(u,c)=>{i(u,c&&new cpe.Client(c,s,a))})}o(b9,"createClient");function wpe(r,e,t){return typeof e>"u"&&(e={}),new Promise((n,s)=>{b9(r,e,(i,a)=>{i&&s(i),n(a)},t)})}o(wpe,"createClientAsync");function Spe(r,e,t,n,s){let i,a,u="";typeof e=="object"&&!(e instanceof RegExp)?(i=e,a=i.path,t=i.services,n=i.xml,u=i.uri):(a=e,i={path:e,services:t,callback:s});let c=new S9.WSDL(n||t,u,i);return new fpe.Server(r,a,t,c,i)}o(Spe,"listen")});var aE=Q(YB=>{"use strict";(function(){YB.defaults={"0.1":{explicitCharkey:!1,trim:!0,normalize:!0,normalizeTags:!1,attrkey:"@",charkey:"#",explicitArray:!1,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!1,validator:null,xmlns:!1,explicitChildren:!1,childkey:"@@",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,emptyTag:""},"0.2":{explicitCharkey:!1,trim:!1,normalize:!1,normalizeTags:!1,attrkey:"$",charkey:"_",explicitArray:!0,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!0,validator:null,xmlns:!1,explicitChildren:!1,preserveChildrenOrder:!1,childkey:"$$",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,rootName:"root",xmldec:{version:"1.0",encoding:"UTF-8",standalone:!0},doctype:null,renderOpts:{pretty:!0,indent:" ",newline:`
88
88
  `},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}}}).call(YB)});var uo=Q((D9,Cc)=>{"use strict";(function(){var r,e,t,n,s,i,a,u=[].slice,c={}.hasOwnProperty;r=o(function(){var f,h,m,g,x,v;if(v=arguments[0],x=2<=arguments.length?u.call(arguments,1):[],s(Object.assign))Object.assign.apply(null,arguments);else for(f=0,m=x.length;f<m;f++)if(g=x[f],g!=null)for(h in g)c.call(g,h)&&(v[h]=g[h]);return v},"assign"),s=o(function(f){return!!f&&Object.prototype.toString.call(f)==="[object Function]"},"isFunction"),i=o(function(f){var h;return!!f&&((h=typeof f)=="function"||h==="object")},"isObject"),t=o(function(f){return s(Array.isArray)?Array.isArray(f):Object.prototype.toString.call(f)==="[object Array]"},"isArray"),n=o(function(f){var h;if(t(f))return!f.length;for(h in f)if(c.call(f,h))return!1;return!0},"isEmpty"),a=o(function(f){var h,m;return i(f)&&(m=Object.getPrototypeOf(f))&&(h=m.constructor)&&typeof h=="function"&&h instanceof h&&Function.prototype.toString.call(h)===Function.prototype.toString.call(Object)},"isPlainObject"),e=o(function(f){return s(f.valueOf)?f.valueOf():f},"getValue"),Cc.exports.assign=r,Cc.exports.isFunction=s,Cc.exports.isObject=i,Cc.exports.isArray=t,Cc.exports.isEmpty=n,Cc.exports.isPlainObject=a,Cc.exports.getValue=e}).call(D9)});var QB=Q((R9,O9)=>{"use strict";(function(){var r;O9.exports=r=(function(){function e(){}return o(e,"XMLDOMImplementation"),e.prototype.hasFeature=function(t,n){return!0},e.prototype.createDocumentType=function(t,n,s){throw new Error("This DOM method is not implemented.")},e.prototype.createDocument=function(t,n,s){throw new Error("This DOM method is not implemented.")},e.prototype.createHTMLDocument=function(t){throw new Error("This DOM method is not implemented.")},e.prototype.getFeature=function(t,n){throw new Error("This DOM method is not implemented.")},e})()}).call(R9)});var L9=Q((P9,k9)=>{"use strict";(function(){var r;k9.exports=r=(function(){function e(){}return o(e,"XMLDOMErrorHandler"),e.prototype.handleError=function(t){throw new Error(t)},e})()}).call(P9)});var j9=Q((V9,U9)=>{"use strict";(function(){var r;U9.exports=r=(function(){function e(t){this.arr=t||[]}return o(e,"XMLDOMStringList"),Object.defineProperty(e.prototype,"length",{get:o(function(){return this.arr.length},"get")}),e.prototype.item=function(t){return this.arr[t]||null},e.prototype.contains=function(t){return this.arr.indexOf(t)!==-1},e})()}).call(V9)});var q9=Q((F9,M9)=>{"use strict";(function(){var r,e,t;e=L9(),t=j9(),M9.exports=r=(function(){function n(){var s;this.defaultParams={"canonical-form":!1,"cdata-sections":!1,comments:!1,"datatype-normalization":!1,"element-content-whitespace":!0,entities:!0,"error-handler":new e,infoset:!0,"validate-if-schema":!1,namespaces:!0,"namespace-declarations":!0,"normalize-characters":!1,"schema-location":"","schema-type":"","split-cdata-sections":!0,validate:!1,"well-formed":!0},this.params=s=Object.create(this.defaultParams)}return o(n,"XMLDOMConfiguration"),Object.defineProperty(n.prototype,"parameterNames",{get:o(function(){return new t(Object.keys(this.defaultParams))},"get")}),n.prototype.getParameter=function(s){return this.params.hasOwnProperty(s)?this.params[s]:null},n.prototype.canSetParameter=function(s,i){return!0},n.prototype.setParameter=function(s,i){return i!=null?this.params[s]=i:delete this.params[s]},n})()}).call(F9)});var mn=Q((H9,K9)=>{"use strict";(function(){K9.exports={Element:1,Attribute:2,Text:3,CData:4,EntityReference:5,EntityDeclaration:6,ProcessingInstruction:7,Comment:8,Document:9,DocType:10,DocumentFragment:11,NotationDeclaration:12,Declaration:201,Raw:202,AttributeDeclaration:203,ElementDeclaration:204,Dummy:205}}).call(H9)});var ZB=Q(($9,X9)=>{"use strict";(function(){var r,e,t;r=mn(),t=di(),X9.exports=e=(function(){function n(s,i,a){if(this.parent=s,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),i==null)throw new Error("Missing attribute name. "+this.debugInfo(i));this.name=this.stringify.name(i),this.value=this.stringify.attValue(a),this.type=r.Attribute,this.isId=!1,this.schemaTypeInfo=null}return o(n,"XMLAttribute"),Object.defineProperty(n.prototype,"nodeType",{get:o(function(){return this.type},"get")}),Object.defineProperty(n.prototype,"ownerElement",{get:o(function(){return this.parent},"get")}),Object.defineProperty(n.prototype,"textContent",{get:o(function(){return this.value},"get"),set:o(function(s){return this.value=s||""},"set")}),Object.defineProperty(n.prototype,"namespaceURI",{get:o(function(){return""},"get")}),Object.defineProperty(n.prototype,"prefix",{get:o(function(){return""},"get")}),Object.defineProperty(n.prototype,"localName",{get:o(function(){return this.name},"get")}),Object.defineProperty(n.prototype,"specified",{get:o(function(){return!0},"get")}),n.prototype.clone=function(){return Object.create(this)},n.prototype.toString=function(s){return this.options.writer.attribute(this,this.options.writer.filterOptions(s))},n.prototype.debugInfo=function(s){return s=s||this.name,s==null?"parent: <"+this.parent.name+">":"attribute: {"+s+"}, parent: <"+this.parent.name+">"},n.prototype.isEqualNode=function(s){return!(s.namespaceURI!==this.namespaceURI||s.prefix!==this.prefix||s.localName!==this.localName||s.value!==this.value)},n})()}).call($9)});var oE=Q((G9,W9)=>{"use strict";(function(){var r;W9.exports=r=(function(){function e(t){this.nodes=t}return o(e,"XMLNamedNodeMap"),Object.defineProperty(e.prototype,"length",{get:o(function(){return Object.keys(this.nodes).length||0},"get")}),e.prototype.clone=function(){return this.nodes=null},e.prototype.getNamedItem=function(t){return this.nodes[t]},e.prototype.setNamedItem=function(t){var n;return n=this.nodes[t.nodeName],this.nodes[t.nodeName]=t,n||null},e.prototype.removeNamedItem=function(t){var n;return n=this.nodes[t],delete this.nodes[t],n||null},e.prototype.item=function(t){return this.nodes[Object.keys(this.nodes)[t]]||null},e.prototype.getNamedItemNS=function(t,n){throw new Error("This DOM method is not implemented.")},e.prototype.setNamedItemNS=function(t){throw new Error("This DOM method is not implemented.")},e.prototype.removeNamedItemNS=function(t,n){throw new Error("This DOM method is not implemented.")},e})()}).call(G9)});var uE=Q((z9,J9)=>{"use strict";(function(){var r,e,t,n,s,i,a,u,c,f=o(function(m,g){for(var x in g)h.call(g,x)&&(m[x]=g[x]);function v(){this.constructor=m}return o(v,"ctor"),v.prototype=g.prototype,m.prototype=new v,m.__super__=g.prototype,m},"extend"),h={}.hasOwnProperty;c=uo(),u=c.isObject,a=c.isFunction,i=c.getValue,s=di(),r=mn(),e=ZB(),n=oE(),J9.exports=t=(function(m){f(g,m);function g(x,v,w){var S,A,N,b;if(g.__super__.constructor.call(this,x),v==null)throw new Error("Missing element name. "+this.debugInfo());if(this.name=this.stringify.name(v),this.type=r.Element,this.attribs={},this.schemaTypeInfo=null,w!=null&&this.attribute(w),x.type===r.Document&&(this.isRoot=!0,this.documentObject=x,x.rootObject=this,x.children)){for(b=x.children,A=0,N=b.length;A<N;A++)if(S=b[A],S.type===r.DocType){S.name=this.name;break}}}return o(g,"XMLElement"),Object.defineProperty(g.prototype,"tagName",{get:o(function(){return this.name},"get")}),Object.defineProperty(g.prototype,"namespaceURI",{get:o(function(){return""},"get")}),Object.defineProperty(g.prototype,"prefix",{get:o(function(){return""},"get")}),Object.defineProperty(g.prototype,"localName",{get:o(function(){return this.name},"get")}),Object.defineProperty(g.prototype,"id",{get:o(function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},"get")}),Object.defineProperty(g.prototype,"className",{get:o(function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},"get")}),Object.defineProperty(g.prototype,"classList",{get:o(function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},"get")}),Object.defineProperty(g.prototype,"attributes",{get:o(function(){return(!this.attributeMap||!this.attributeMap.nodes)&&(this.attributeMap=new n(this.attribs)),this.attributeMap},"get")}),g.prototype.clone=function(){var x,v,w,S;w=Object.create(this),w.isRoot&&(w.documentObject=null),w.attribs={},S=this.attribs;for(v in S)h.call(S,v)&&(x=S[v],w.attribs[v]=x.clone());return w.children=[],this.children.forEach(function(A){var N;return N=A.clone(),N.parent=w,w.children.push(N)}),w},g.prototype.attribute=function(x,v){var w,S;if(x!=null&&(x=i(x)),u(x))for(w in x)h.call(x,w)&&(S=x[w],this.attribute(w,S));else a(v)&&(v=v.apply()),this.options.keepNullAttributes&&v==null?this.attribs[x]=new e(this,x,""):v!=null&&(this.attribs[x]=new e(this,x,v));return this},g.prototype.removeAttribute=function(x){var v,w,S;if(x==null)throw new Error("Missing attribute name. "+this.debugInfo());if(x=i(x),Array.isArray(x))for(w=0,S=x.length;w<S;w++)v=x[w],delete this.attribs[v];else delete this.attribs[x];return this},g.prototype.toString=function(x){return this.options.writer.element(this,this.options.writer.filterOptions(x))},g.prototype.att=function(x,v){return this.attribute(x,v)},g.prototype.a=function(x,v){return this.attribute(x,v)},g.prototype.getAttribute=function(x){return this.attribs.hasOwnProperty(x)?this.attribs[x].value:null},g.prototype.setAttribute=function(x,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getAttributeNode=function(x){return this.attribs.hasOwnProperty(x)?this.attribs[x]:null},g.prototype.setAttributeNode=function(x){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.removeAttributeNode=function(x){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getElementsByTagName=function(x){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getAttributeNS=function(x,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.setAttributeNS=function(x,v,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.removeAttributeNS=function(x,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getAttributeNodeNS=function(x,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.setAttributeNodeNS=function(x){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getElementsByTagNameNS=function(x,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.hasAttribute=function(x){return this.attribs.hasOwnProperty(x)},g.prototype.hasAttributeNS=function(x,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.setIdAttribute=function(x,v){return this.attribs.hasOwnProperty(x)?this.attribs[x].isId:v},g.prototype.setIdAttributeNS=function(x,v,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.setIdAttributeNode=function(x,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getElementsByTagName=function(x){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getElementsByTagNameNS=function(x,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getElementsByClassName=function(x){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.isEqualNode=function(x){var v,w,S;if(!g.__super__.isEqualNode.apply(this,arguments).isEqualNode(x)||x.namespaceURI!==this.namespaceURI||x.prefix!==this.prefix||x.localName!==this.localName||x.attribs.length!==this.attribs.length)return!1;for(v=w=0,S=this.attribs.length-1;0<=S?w<=S:w>=S;v=0<=S?++w:--w)if(!this.attribs[v].isEqualNode(x.attribs[v]))return!1;return!0},g})(s)}).call(z9)});var Bv=Q((Y9,Q9)=>{"use strict";(function(){var r,e,t=o(function(s,i){for(var a in i)n.call(i,a)&&(s[a]=i[a]);function u(){this.constructor=s}return o(u,"ctor"),u.prototype=i.prototype,s.prototype=new u,s.__super__=i.prototype,s},"extend"),n={}.hasOwnProperty;e=di(),Q9.exports=r=(function(s){t(i,s);function i(a){i.__super__.constructor.call(this,a),this.value=""}return o(i,"XMLCharacterData"),Object.defineProperty(i.prototype,"data",{get:o(function(){return this.value},"get"),set:o(function(a){return this.value=a||""},"set")}),Object.defineProperty(i.prototype,"length",{get:o(function(){return this.value.length},"get")}),Object.defineProperty(i.prototype,"textContent",{get:o(function(){return this.value},"get"),set:o(function(a){return this.value=a||""},"set")}),i.prototype.clone=function(){return Object.create(this)},i.prototype.substringData=function(a,u){throw new Error("This DOM method is not implemented."+this.debugInfo())},i.prototype.appendData=function(a){throw new Error("This DOM method is not implemented."+this.debugInfo())},i.prototype.insertData=function(a,u){throw new Error("This DOM method is not implemented."+this.debugInfo())},i.prototype.deleteData=function(a,u){throw new Error("This DOM method is not implemented."+this.debugInfo())},i.prototype.replaceData=function(a,u,c){throw new Error("This DOM method is not implemented."+this.debugInfo())},i.prototype.isEqualNode=function(a){return!(!i.__super__.isEqualNode.apply(this,arguments).isEqualNode(a)||a.data!==this.data)},i})(e)}).call(Y9)});var cE=Q((Z9,eq)=>{"use strict";(function(){var r,e,t,n=o(function(i,a){for(var u in a)s.call(a,u)&&(i[u]=a[u]);function c(){this.constructor=i}return o(c,"ctor"),c.prototype=a.prototype,i.prototype=new c,i.__super__=a.prototype,i},"extend"),s={}.hasOwnProperty;r=mn(),t=Bv(),eq.exports=e=(function(i){n(a,i);function a(u,c){if(a.__super__.constructor.call(this,u),c==null)throw new Error("Missing CDATA text. "+this.debugInfo());this.name="#cdata-section",this.type=r.CData,this.value=this.stringify.cdata(c)}return o(a,"XMLCData"),a.prototype.clone=function(){return Object.create(this)},a.prototype.toString=function(u){return this.options.writer.cdata(this,this.options.writer.filterOptions(u))},a})(t)}).call(Z9)});var lE=Q((tq,rq)=>{"use strict";(function(){var r,e,t,n=o(function(i,a){for(var u in a)s.call(a,u)&&(i[u]=a[u]);function c(){this.constructor=i}return o(c,"ctor"),c.prototype=a.prototype,i.prototype=new c,i.__super__=a.prototype,i},"extend"),s={}.hasOwnProperty;r=mn(),e=Bv(),rq.exports=t=(function(i){n(a,i);function a(u,c){if(a.__super__.constructor.call(this,u),c==null)throw new Error("Missing comment text. "+this.debugInfo());this.name="#comment",this.type=r.Comment,this.value=this.stringify.comment(c)}return o(a,"XMLComment"),a.prototype.clone=function(){return Object.create(this)},a.prototype.toString=function(u){return this.options.writer.comment(this,this.options.writer.filterOptions(u))},a})(e)}).call(tq)});var fE=Q((nq,sq)=>{"use strict";(function(){var r,e,t,n,s=o(function(a,u){for(var c in u)i.call(u,c)&&(a[c]=u[c]);function f(){this.constructor=a}return o(f,"ctor"),f.prototype=u.prototype,a.prototype=new f,a.__super__=u.prototype,a},"extend"),i={}.hasOwnProperty;n=uo().isObject,t=di(),r=mn(),sq.exports=e=(function(a){s(u,a);function u(c,f,h,m){var g;u.__super__.constructor.call(this,c),n(f)&&(g=f,f=g.version,h=g.encoding,m=g.standalone),f||(f="1.0"),this.type=r.Declaration,this.version=this.stringify.xmlVersion(f),h!=null&&(this.encoding=this.stringify.xmlEncoding(h)),m!=null&&(this.standalone=this.stringify.xmlStandalone(m))}return o(u,"XMLDeclaration"),u.prototype.toString=function(c){return this.options.writer.declaration(this,this.options.writer.filterOptions(c))},u})(t)}).call(nq)});var hE=Q((iq,aq)=>{"use strict";(function(){var r,e,t,n=o(function(i,a){for(var u in a)s.call(a,u)&&(i[u]=a[u]);function c(){this.constructor=i}return o(c,"ctor"),c.prototype=a.prototype,i.prototype=new c,i.__super__=a.prototype,i},"extend"),s={}.hasOwnProperty;t=di(),r=mn(),aq.exports=e=(function(i){n(a,i);function a(u,c,f,h,m,g){if(a.__super__.constructor.call(this,u),c==null)throw new Error("Missing DTD element name. "+this.debugInfo());if(f==null)throw new Error("Missing DTD attribute name. "+this.debugInfo(c));if(!h)throw new Error("Missing DTD attribute type. "+this.debugInfo(c));if(!m)throw new Error("Missing DTD attribute default. "+this.debugInfo(c));if(m.indexOf("#")!==0&&(m="#"+m),!m.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. "+this.debugInfo(c));if(g&&!m.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT. "+this.debugInfo(c));this.elementName=this.stringify.name(c),this.type=r.AttributeDeclaration,this.attributeName=this.stringify.name(f),this.attributeType=this.stringify.dtdAttType(h),g&&(this.defaultValue=this.stringify.dtdAttDefault(g)),this.defaultValueType=m}return o(a,"XMLDTDAttList"),a.prototype.toString=function(u){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions(u))},a})(t)}).call(iq)});var pE=Q((oq,uq)=>{"use strict";(function(){var r,e,t,n,s=o(function(a,u){for(var c in u)i.call(u,c)&&(a[c]=u[c]);function f(){this.constructor=a}return o(f,"ctor"),f.prototype=u.prototype,a.prototype=new f,a.__super__=u.prototype,a},"extend"),i={}.hasOwnProperty;n=uo().isObject,t=di(),r=mn(),uq.exports=e=(function(a){s(u,a);function u(c,f,h,m){if(u.__super__.constructor.call(this,c),h==null)throw new Error("Missing DTD entity name. "+this.debugInfo(h));if(m==null)throw new Error("Missing DTD entity value. "+this.debugInfo(h));if(this.pe=!!f,this.name=this.stringify.name(h),this.type=r.EntityDeclaration,!n(m))this.value=this.stringify.dtdEntityValue(m),this.internal=!0;else{if(!m.pubID&&!m.sysID)throw new Error("Public and/or system identifiers are required for an external entity. "+this.debugInfo(h));if(m.pubID&&!m.sysID)throw new Error("System identifier is required for a public external entity. "+this.debugInfo(h));if(this.internal=!1,m.pubID!=null&&(this.pubID=this.stringify.dtdPubID(m.pubID)),m.sysID!=null&&(this.sysID=this.stringify.dtdSysID(m.sysID)),m.nData!=null&&(this.nData=this.stringify.dtdNData(m.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo(h))}}return o(u,"XMLDTDEntity"),Object.defineProperty(u.prototype,"publicId",{get:o(function(){return this.pubID},"get")}),Object.defineProperty(u.prototype,"systemId",{get:o(function(){return this.sysID},"get")}),Object.defineProperty(u.prototype,"notationName",{get:o(function(){return this.nData||null},"get")}),Object.defineProperty(u.prototype,"inputEncoding",{get:o(function(){return null},"get")}),Object.defineProperty(u.prototype,"xmlEncoding",{get:o(function(){return null},"get")}),Object.defineProperty(u.prototype,"xmlVersion",{get:o(function(){return null},"get")}),u.prototype.toString=function(c){return this.options.writer.dtdEntity(this,this.options.writer.filterOptions(c))},u})(t)}).call(oq)});var dE=Q((cq,lq)=>{"use strict";(function(){var r,e,t,n=o(function(i,a){for(var u in a)s.call(a,u)&&(i[u]=a[u]);function c(){this.constructor=i}return o(c,"ctor"),c.prototype=a.prototype,i.prototype=new c,i.__super__=a.prototype,i},"extend"),s={}.hasOwnProperty;t=di(),r=mn(),lq.exports=e=(function(i){n(a,i);function a(u,c,f){if(a.__super__.constructor.call(this,u),c==null)throw new Error("Missing DTD element name. "+this.debugInfo());f||(f="(#PCDATA)"),Array.isArray(f)&&(f="("+f.join(",")+")"),this.name=this.stringify.name(c),this.type=r.ElementDeclaration,this.value=this.stringify.dtdElementValue(f)}return o(a,"XMLDTDElement"),a.prototype.toString=function(u){return this.options.writer.dtdElement(this,this.options.writer.filterOptions(u))},a})(t)}).call(cq)});var mE=Q((fq,hq)=>{"use strict";(function(){var r,e,t,n=o(function(i,a){for(var u in a)s.call(a,u)&&(i[u]=a[u]);function c(){this.constructor=i}return o(c,"ctor"),c.prototype=a.prototype,i.prototype=new c,i.__super__=a.prototype,i},"extend"),s={}.hasOwnProperty;t=di(),r=mn(),hq.exports=e=(function(i){n(a,i);function a(u,c,f){if(a.__super__.constructor.call(this,u),c==null)throw new Error("Missing DTD notation name. "+this.debugInfo(c));if(!f.pubID&&!f.sysID)throw new Error("Public or system identifiers are required for an external entity. "+this.debugInfo(c));this.name=this.stringify.name(c),this.type=r.NotationDeclaration,f.pubID!=null&&(this.pubID=this.stringify.dtdPubID(f.pubID)),f.sysID!=null&&(this.sysID=this.stringify.dtdSysID(f.sysID))}return o(a,"XMLDTDNotation"),Object.defineProperty(a.prototype,"publicId",{get:o(function(){return this.pubID},"get")}),Object.defineProperty(a.prototype,"systemId",{get:o(function(){return this.sysID},"get")}),a.prototype.toString=function(u){return this.options.writer.dtdNotation(this,this.options.writer.filterOptions(u))},a})(t)}).call(fq)});var gE=Q((pq,dq)=>{"use strict";(function(){var r,e,t,n,s,i,a,u,c,f=o(function(m,g){for(var x in g)h.call(g,x)&&(m[x]=g[x]);function v(){this.constructor=m}return o(v,"ctor"),v.prototype=g.prototype,m.prototype=new v,m.__super__=g.prototype,m},"extend"),h={}.hasOwnProperty;c=uo().isObject,u=di(),r=mn(),e=hE(),n=pE(),t=dE(),s=mE(),a=oE(),dq.exports=i=(function(m){f(g,m);function g(x,v,w){var S,A,N,b,E,C;if(g.__super__.constructor.call(this,x),this.type=r.DocType,x.children){for(b=x.children,A=0,N=b.length;A<N;A++)if(S=b[A],S.type===r.Element){this.name=S.name;break}}this.documentObject=x,c(v)&&(E=v,v=E.pubID,w=E.sysID),w==null&&(C=[v,w],w=C[0],v=C[1]),v!=null&&(this.pubID=this.stringify.dtdPubID(v)),w!=null&&(this.sysID=this.stringify.dtdSysID(w))}return o(g,"XMLDocType"),Object.defineProperty(g.prototype,"entities",{get:o(function(){var x,v,w,S,A;for(S={},A=this.children,v=0,w=A.length;v<w;v++)x=A[v],x.type===r.EntityDeclaration&&!x.pe&&(S[x.name]=x);return new a(S)},"get")}),Object.defineProperty(g.prototype,"notations",{get:o(function(){var x,v,w,S,A;for(S={},A=this.children,v=0,w=A.length;v<w;v++)x=A[v],x.type===r.NotationDeclaration&&(S[x.name]=x);return new a(S)},"get")}),Object.defineProperty(g.prototype,"publicId",{get:o(function(){return this.pubID},"get")}),Object.defineProperty(g.prototype,"systemId",{get:o(function(){return this.sysID},"get")}),Object.defineProperty(g.prototype,"internalSubset",{get:o(function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},"get")}),g.prototype.element=function(x,v){var w;return w=new t(this,x,v),this.children.push(w),this},g.prototype.attList=function(x,v,w,S,A){var N;return N=new e(this,x,v,w,S,A),this.children.push(N),this},g.prototype.entity=function(x,v){var w;return w=new n(this,!1,x,v),this.children.push(w),this},g.prototype.pEntity=function(x,v){var w;return w=new n(this,!0,x,v),this.children.push(w),this},g.prototype.notation=function(x,v){var w;return w=new s(this,x,v),this.children.push(w),this},g.prototype.toString=function(x){return this.options.writer.docType(this,this.options.writer.filterOptions(x))},g.prototype.ele=function(x,v){return this.element(x,v)},g.prototype.att=function(x,v,w,S,A){return this.attList(x,v,w,S,A)},g.prototype.ent=function(x,v){return this.entity(x,v)},g.prototype.pent=function(x,v){return this.pEntity(x,v)},g.prototype.not=function(x,v){return this.notation(x,v)},g.prototype.up=function(){return this.root()||this.documentObject},g.prototype.isEqualNode=function(x){return!(!g.__super__.isEqualNode.apply(this,arguments).isEqualNode(x)||x.name!==this.name||x.publicId!==this.publicId||x.systemId!==this.systemId)},g})(u)}).call(pq)});var vE=Q((mq,gq)=>{"use strict";(function(){var r,e,t,n=o(function(i,a){for(var u in a)s.call(a,u)&&(i[u]=a[u]);function c(){this.constructor=i}return o(c,"ctor"),c.prototype=a.prototype,i.prototype=new c,i.__super__=a.prototype,i},"extend"),s={}.hasOwnProperty;r=mn(),e=di(),gq.exports=t=(function(i){n(a,i);function a(u,c){if(a.__super__.constructor.call(this,u),c==null)throw new Error("Missing raw text. "+this.debugInfo());this.type=r.Raw,this.value=this.stringify.raw(c)}return o(a,"XMLRaw"),a.prototype.clone=function(){return Object.create(this)},a.prototype.toString=function(u){return this.options.writer.raw(this,this.options.writer.filterOptions(u))},a})(e)}).call(mq)});var yE=Q((vq,yq)=>{"use strict";(function(){var r,e,t,n=o(function(i,a){for(var u in a)s.call(a,u)&&(i[u]=a[u]);function c(){this.constructor=i}return o(c,"ctor"),c.prototype=a.prototype,i.prototype=new c,i.__super__=a.prototype,i},"extend"),s={}.hasOwnProperty;r=mn(),e=Bv(),yq.exports=t=(function(i){n(a,i);function a(u,c){if(a.__super__.constructor.call(this,u),c==null)throw new Error("Missing element text. "+this.debugInfo());this.name="#text",this.type=r.Text,this.value=this.stringify.text(c)}return o(a,"XMLText"),Object.defineProperty(a.prototype,"isElementContentWhitespace",{get:o(function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},"get")}),Object.defineProperty(a.prototype,"wholeText",{get:o(function(){var u,c,f;for(f="",c=this.previousSibling;c;)f=c.data+f,c=c.previousSibling;for(f+=this.data,u=this.nextSibling;u;)f=f+u.data,u=u.nextSibling;return f},"get")}),a.prototype.clone=function(){return Object.create(this)},a.prototype.toString=function(u){return this.options.writer.text(this,this.options.writer.filterOptions(u))},a.prototype.splitText=function(u){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.replaceWholeText=function(u){throw new Error("This DOM method is not implemented."+this.debugInfo())},a})(e)}).call(vq)});var xE=Q((xq,wq)=>{"use strict";(function(){var r,e,t,n=o(function(i,a){for(var u in a)s.call(a,u)&&(i[u]=a[u]);function c(){this.constructor=i}return o(c,"ctor"),c.prototype=a.prototype,i.prototype=new c,i.__super__=a.prototype,i},"extend"),s={}.hasOwnProperty;r=mn(),e=Bv(),wq.exports=t=(function(i){n(a,i);function a(u,c,f){if(a.__super__.constructor.call(this,u),c==null)throw new Error("Missing instruction target. "+this.debugInfo());this.type=r.ProcessingInstruction,this.target=this.stringify.insTarget(c),this.name=this.target,f&&(this.value=this.stringify.insValue(f))}return o(a,"XMLProcessingInstruction"),a.prototype.clone=function(){return Object.create(this)},a.prototype.toString=function(u){return this.options.writer.processingInstruction(this,this.options.writer.filterOptions(u))},a.prototype.isEqualNode=function(u){return!(!a.__super__.isEqualNode.apply(this,arguments).isEqualNode(u)||u.target!==this.target)},a})(e)}).call(xq)});var eD=Q((Sq,bq)=>{"use strict";(function(){var r,e,t,n=o(function(i,a){for(var u in a)s.call(a,u)&&(i[u]=a[u]);function c(){this.constructor=i}return o(c,"ctor"),c.prototype=a.prototype,i.prototype=new c,i.__super__=a.prototype,i},"extend"),s={}.hasOwnProperty;t=di(),r=mn(),bq.exports=e=(function(i){n(a,i);function a(u){a.__super__.constructor.call(this,u),this.type=r.Dummy}return o(a,"XMLDummy"),a.prototype.clone=function(){return Object.create(this)},a.prototype.toString=function(u){return""},a})(t)}).call(Sq)});var Cq=Q((Eq,Aq)=>{"use strict";(function(){var r;Aq.exports=r=(function(){function e(t){this.nodes=t}return o(e,"XMLNodeList"),Object.defineProperty(e.prototype,"length",{get:o(function(){return this.nodes.length||0},"get")}),e.prototype.clone=function(){return this.nodes=null},e.prototype.item=function(t){return this.nodes[t]||null},e})()}).call(Eq)});var Iq=Q((Nq,Tq)=>{"use strict";(function(){Tq.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}).call(Nq)});var di=Q((_q,Bq)=>{"use strict";(function(){var r,e,t,n,s,i,a,u,c,f,h,m,g,x,v,w,S,A,N,b={}.hasOwnProperty;N=uo(),A=N.isObject,S=N.isFunction,w=N.isEmpty,v=N.getValue,u=null,t=null,n=null,s=null,i=null,g=null,x=null,m=null,a=null,e=null,h=null,c=null,r=null,Bq.exports=f=(function(){function E(C){this.parent=C,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.value=null,this.children=[],this.baseURI=null,u||(u=uE(),t=cE(),n=lE(),s=fE(),i=gE(),g=vE(),x=yE(),m=xE(),a=eD(),e=mn(),h=Cq(),c=oE(),r=Iq())}return o(E,"XMLNode"),Object.defineProperty(E.prototype,"nodeName",{get:o(function(){return this.name},"get")}),Object.defineProperty(E.prototype,"nodeType",{get:o(function(){return this.type},"get")}),Object.defineProperty(E.prototype,"nodeValue",{get:o(function(){return this.value},"get")}),Object.defineProperty(E.prototype,"parentNode",{get:o(function(){return this.parent},"get")}),Object.defineProperty(E.prototype,"childNodes",{get:o(function(){return(!this.childNodeList||!this.childNodeList.nodes)&&(this.childNodeList=new h(this.children)),this.childNodeList},"get")}),Object.defineProperty(E.prototype,"firstChild",{get:o(function(){return this.children[0]||null},"get")}),Object.defineProperty(E.prototype,"lastChild",{get:o(function(){return this.children[this.children.length-1]||null},"get")}),Object.defineProperty(E.prototype,"previousSibling",{get:o(function(){var C;return C=this.parent.children.indexOf(this),this.parent.children[C-1]||null},"get")}),Object.defineProperty(E.prototype,"nextSibling",{get:o(function(){var C;return C=this.parent.children.indexOf(this),this.parent.children[C+1]||null},"get")}),Object.defineProperty(E.prototype,"ownerDocument",{get:o(function(){return this.document()||null},"get")}),Object.defineProperty(E.prototype,"textContent",{get:o(function(){var C,_,M,R,q;if(this.nodeType===e.Element||this.nodeType===e.DocumentFragment){for(q="",R=this.children,_=0,M=R.length;_<M;_++)C=R[_],C.textContent&&(q+=C.textContent);return q}else return null},"get"),set:o(function(C){throw new Error("This DOM method is not implemented."+this.debugInfo())},"set")}),E.prototype.setParent=function(C){var _,M,R,q,H;for(this.parent=C,C&&(this.options=C.options,this.stringify=C.stringify),q=this.children,H=[],M=0,R=q.length;M<R;M++)_=q[M],H.push(_.setParent(this));return H},E.prototype.element=function(C,_,M){var R,q,H,K,G,pe,le,ue,ee,he,we;if(pe=null,_===null&&M==null&&(ee=[{},null],_=ee[0],M=ee[1]),_==null&&(_={}),_=v(_),A(_)||(he=[_,M],M=he[0],_=he[1]),C!=null&&(C=v(C)),Array.isArray(C))for(H=0,le=C.length;H<le;H++)q=C[H],pe=this.element(q);else if(S(C))pe=this.element(C.apply());else if(A(C)){for(G in C)if(b.call(C,G))if(we=C[G],S(we)&&(we=we.apply()),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&G.indexOf(this.stringify.convertAttKey)===0)pe=this.attribute(G.substr(this.stringify.convertAttKey.length),we);else if(!this.options.separateArrayItems&&Array.isArray(we)&&w(we))pe=this.dummy();else if(A(we)&&w(we))pe=this.element(G);else if(!this.options.keepNullNodes&&we==null)pe=this.dummy();else if(!this.options.separateArrayItems&&Array.isArray(we))for(K=0,ue=we.length;K<ue;K++)q=we[K],R={},R[G]=q,pe=this.element(R);else A(we)?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&G.indexOf(this.stringify.convertTextKey)===0?pe=this.element(we):(pe=this.element(G),pe.element(we)):pe=this.element(G,we)}else!this.options.keepNullNodes&&M===null?pe=this.dummy():!this.options.ignoreDecorators&&this.stringify.convertTextKey&&C.indexOf(this.stringify.convertTextKey)===0?pe=this.text(M):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&C.indexOf(this.stringify.convertCDataKey)===0?pe=this.cdata(M):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&C.indexOf(this.stringify.convertCommentKey)===0?pe=this.comment(M):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&C.indexOf(this.stringify.convertRawKey)===0?pe=this.raw(M):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&C.indexOf(this.stringify.convertPIKey)===0?pe=this.instruction(C.substr(this.stringify.convertPIKey.length),M):pe=this.node(C,_,M);if(pe==null)throw new Error("Could not create any elements with: "+C+". "+this.debugInfo());return pe},E.prototype.insertBefore=function(C,_,M){var R,q,H,K,G;if(C?.type)return H=C,K=_,H.setParent(this),K?(q=children.indexOf(K),G=children.splice(q),children.push(H),Array.prototype.push.apply(children,G)):children.push(H),H;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(C));return q=this.parent.children.indexOf(this),G=this.parent.children.splice(q),R=this.parent.element(C,_,M),Array.prototype.push.apply(this.parent.children,G),R},E.prototype.insertAfter=function(C,_,M){var R,q,H;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(C));return q=this.parent.children.indexOf(this),H=this.parent.children.splice(q+1),R=this.parent.element(C,_,M),Array.prototype.push.apply(this.parent.children,H),R},E.prototype.remove=function(){var C,_;if(this.isRoot)throw new Error("Cannot remove the root element. "+this.debugInfo());return C=this.parent.children.indexOf(this),[].splice.apply(this.parent.children,[C,C-C+1].concat(_=[])),this.parent},E.prototype.node=function(C,_,M){var R,q;return C!=null&&(C=v(C)),_||(_={}),_=v(_),A(_)||(q=[_,M],M=q[0],_=q[1]),R=new u(this,C,_),M!=null&&R.text(M),this.children.push(R),R},E.prototype.text=function(C){var _;return A(C)&&this.element(C),_=new x(this,C),this.children.push(_),this},E.prototype.cdata=function(C){var _;return _=new t(this,C),this.children.push(_),this},E.prototype.comment=function(C){var _;return _=new n(this,C),this.children.push(_),this},E.prototype.commentBefore=function(C){var _,M,R;return M=this.parent.children.indexOf(this),R=this.parent.children.splice(M),_=this.parent.comment(C),Array.prototype.push.apply(this.parent.children,R),this},E.prototype.commentAfter=function(C){var _,M,R;return M=this.parent.children.indexOf(this),R=this.parent.children.splice(M+1),_=this.parent.comment(C),Array.prototype.push.apply(this.parent.children,R),this},E.prototype.raw=function(C){var _;return _=new g(this,C),this.children.push(_),this},E.prototype.dummy=function(){var C;return C=new a(this),C},E.prototype.instruction=function(C,_){var M,R,q,H,K;if(C!=null&&(C=v(C)),_!=null&&(_=v(_)),Array.isArray(C))for(H=0,K=C.length;H<K;H++)M=C[H],this.instruction(M);else if(A(C))for(M in C)b.call(C,M)&&(R=C[M],this.instruction(M,R));else S(_)&&(_=_.apply()),q=new m(this,C,_),this.children.push(q);return this},E.prototype.instructionBefore=function(C,_){var M,R,q;return R=this.parent.children.indexOf(this),q=this.parent.children.splice(R),M=this.parent.instruction(C,_),Array.prototype.push.apply(this.parent.children,q),this},E.prototype.instructionAfter=function(C,_){var M,R,q;return R=this.parent.children.indexOf(this),q=this.parent.children.splice(R+1),M=this.parent.instruction(C,_),Array.prototype.push.apply(this.parent.children,q),this},E.prototype.declaration=function(C,_,M){var R,q;return R=this.document(),q=new s(R,C,_,M),R.children.length===0?R.children.unshift(q):R.children[0].type===e.Declaration?R.children[0]=q:R.children.unshift(q),R.root()||R},E.prototype.dtd=function(C,_){var M,R,q,H,K,G,pe,le,ue,ee;for(R=this.document(),q=new i(R,C,_),ue=R.children,H=K=0,pe=ue.length;K<pe;H=++K)if(M=ue[H],M.type===e.DocType)return R.children[H]=q,q;for(ee=R.children,H=G=0,le=ee.length;G<le;H=++G)if(M=ee[H],M.isRoot)return R.children.splice(H,0,q),q;return R.children.push(q),q},E.prototype.up=function(){if(this.isRoot)throw new Error("The root node has no parent. Use doc() if you need to get the document object.");return this.parent},E.prototype.root=function(){var C;for(C=this;C;){if(C.type===e.Document)return C.rootObject;if(C.isRoot)return C;C=C.parent}},E.prototype.document=function(){var C;for(C=this;C;){if(C.type===e.Document)return C;C=C.parent}},E.prototype.end=function(C){return this.document().end(C)},E.prototype.prev=function(){var C;if(C=this.parent.children.indexOf(this),C<1)throw new Error("Already at the first node. "+this.debugInfo());return this.parent.children[C-1]},E.prototype.next=function(){var C;if(C=this.parent.children.indexOf(this),C===-1||C===this.parent.children.length-1)throw new Error("Already at the last node. "+this.debugInfo());return this.parent.children[C+1]},E.prototype.importDocument=function(C){var _;return _=C.root().clone(),_.parent=this,_.isRoot=!1,this.children.push(_),this},E.prototype.debugInfo=function(C){var _,M;return C=C||this.name,C==null&&!((_=this.parent)!=null&&_.name)?"":C==null?"parent: <"+this.parent.name+">":(M=this.parent)!=null&&M.name?"node: <"+C+">, parent: <"+this.parent.name+">":"node: <"+C+">"},E.prototype.ele=function(C,_,M){return this.element(C,_,M)},E.prototype.nod=function(C,_,M){return this.node(C,_,M)},E.prototype.txt=function(C){return this.text(C)},E.prototype.dat=function(C){return this.cdata(C)},E.prototype.com=function(C){return this.comment(C)},E.prototype.ins=function(C,_){return this.instruction(C,_)},E.prototype.doc=function(){return this.document()},E.prototype.dec=function(C,_,M){return this.declaration(C,_,M)},E.prototype.e=function(C,_,M){return this.element(C,_,M)},E.prototype.n=function(C,_,M){return this.node(C,_,M)},E.prototype.t=function(C){return this.text(C)},E.prototype.d=function(C){return this.cdata(C)},E.prototype.c=function(C){return this.comment(C)},E.prototype.r=function(C){return this.raw(C)},E.prototype.i=function(C,_){return this.instruction(C,_)},E.prototype.u=function(){return this.up()},E.prototype.importXMLBuilder=function(C){return this.importDocument(C)},E.prototype.replaceChild=function(C,_){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.removeChild=function(C){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.appendChild=function(C){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.hasChildNodes=function(){return this.children.length!==0},E.prototype.cloneNode=function(C){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.normalize=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.isSupported=function(C,_){return!0},E.prototype.hasAttributes=function(){return this.attribs.length!==0},E.prototype.compareDocumentPosition=function(C){var _,M;return _=this,_===C?0:this.document()!==C.document()?(M=r.Disconnected|r.ImplementationSpecific,Math.random()<.5?M|=r.Preceding:M|=r.Following,M):_.isAncestor(C)?r.Contains|r.Preceding:_.isDescendant(C)?r.Contains|r.Following:_.isPreceding(C)?r.Preceding:r.Following},E.prototype.isSameNode=function(C){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.lookupPrefix=function(C){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.isDefaultNamespace=function(C){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.lookupNamespaceURI=function(C){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.isEqualNode=function(C){var _,M,R;if(C.nodeType!==this.nodeType||C.children.length!==this.children.length)return!1;for(_=M=0,R=this.children.length-1;0<=R?M<=R:M>=R;_=0<=R?++M:--M)if(!this.children[_].isEqualNode(C.children[_]))return!1;return!0},E.prototype.getFeature=function(C,_){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.setUserData=function(C,_,M){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.getUserData=function(C){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.contains=function(C){return C?C===this||this.isDescendant(C):!1},E.prototype.isDescendant=function(C){var _,M,R,q,H;for(H=this.children,R=0,q=H.length;R<q;R++)if(_=H[R],C===_||(M=_.isDescendant(C),M))return!0;return!1},E.prototype.isAncestor=function(C){return C.isDescendant(this)},E.prototype.isPreceding=function(C){var _,M;return _=this.treePosition(C),M=this.treePosition(this),_===-1||M===-1?!1:_<M},E.prototype.isFollowing=function(C){var _,M;return _=this.treePosition(C),M=this.treePosition(this),_===-1||M===-1?!1:_>M},E.prototype.treePosition=function(C){var _,M;return M=0,_=!1,this.foreachTreeNode(this.document(),function(R){if(M++,!_&&R===C)return _=!0}),_?M:-1},E.prototype.foreachTreeNode=function(C,_){var M,R,q,H,K;for(C||(C=this.document()),H=C.children,R=0,q=H.length;R<q;R++){if(M=H[R],K=_(M))return K;if(K=this.foreachTreeNode(M,_),K)return K}},E})()}).call(_q)});var tD=Q((Dq,Rq)=>{"use strict";(function(){var r,e=o(function(n,s){return function(){return n.apply(s,arguments)}},"bind"),t={}.hasOwnProperty;Rq.exports=r=(function(){function n(s){this.assertLegalName=e(this.assertLegalName,this),this.assertLegalChar=e(this.assertLegalChar,this);var i,a,u;s||(s={}),this.options=s,this.options.version||(this.options.version="1.0"),a=s.stringify||{};for(i in a)t.call(a,i)&&(u=a[i],this[i]=u)}return o(n,"XMLStringifier"),n.prototype.name=function(s){return this.options.noValidation?s:this.assertLegalName(""+s||"")},n.prototype.text=function(s){return this.options.noValidation?s:this.assertLegalChar(this.textEscape(""+s||""))},n.prototype.cdata=function(s){return this.options.noValidation?s:(s=""+s||"",s=s.replace("]]>","]]]]><![CDATA[>"),this.assertLegalChar(s))},n.prototype.comment=function(s){if(this.options.noValidation)return s;if(s=""+s||"",s.match(/--/))throw new Error("Comment text cannot contain double-hypen: "+s);return this.assertLegalChar(s)},n.prototype.raw=function(s){return this.options.noValidation?s:""+s||""},n.prototype.attValue=function(s){return this.options.noValidation?s:this.assertLegalChar(this.attEscape(s=""+s||""))},n.prototype.insTarget=function(s){return this.options.noValidation?s:this.assertLegalChar(""+s||"")},n.prototype.insValue=function(s){if(this.options.noValidation)return s;if(s=""+s||"",s.match(/\?>/))throw new Error("Invalid processing instruction value: "+s);return this.assertLegalChar(s)},n.prototype.xmlVersion=function(s){if(this.options.noValidation)return s;if(s=""+s||"",!s.match(/1\.[0-9]+/))throw new Error("Invalid version number: "+s);return s},n.prototype.xmlEncoding=function(s){if(this.options.noValidation)return s;if(s=""+s||"",!s.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/))throw new Error("Invalid encoding: "+s);return this.assertLegalChar(s)},n.prototype.xmlStandalone=function(s){return this.options.noValidation?s:s?"yes":"no"},n.prototype.dtdPubID=function(s){return this.options.noValidation?s:this.assertLegalChar(""+s||"")},n.prototype.dtdSysID=function(s){return this.options.noValidation?s:this.assertLegalChar(""+s||"")},n.prototype.dtdElementValue=function(s){return this.options.noValidation?s:this.assertLegalChar(""+s||"")},n.prototype.dtdAttType=function(s){return this.options.noValidation?s:this.assertLegalChar(""+s||"")},n.prototype.dtdAttDefault=function(s){return this.options.noValidation?s:this.assertLegalChar(""+s||"")},n.prototype.dtdEntityValue=function(s){return this.options.noValidation?s:this.assertLegalChar(""+s||"")},n.prototype.dtdNData=function(s){return this.options.noValidation?s:this.assertLegalChar(""+s||"")},n.prototype.convertAttKey="@",n.prototype.convertPIKey="?",n.prototype.convertTextKey="#text",n.prototype.convertCDataKey="#cdata",n.prototype.convertCommentKey="#comment",n.prototype.convertRawKey="#raw",n.prototype.assertLegalChar=function(s){var i,a;if(this.options.noValidation)return s;if(i="",this.options.version==="1.0"){if(i=/[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,a=s.match(i))throw new Error("Invalid character in string: "+s+" at index "+a.index)}else if(this.options.version==="1.1"&&(i=/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,a=s.match(i)))throw new Error("Invalid character in string: "+s+" at index "+a.index);return s},n.prototype.assertLegalName=function(s){var i;if(this.options.noValidation)return s;if(this.assertLegalChar(s),i=/^([:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])([\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/,!s.match(i))throw new Error("Invalid character in name");return s},n.prototype.textEscape=function(s){var i;return this.options.noValidation?s:(i=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,s.replace(i,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\r/g,"&#xD;"))},n.prototype.attEscape=function(s){var i;return this.options.noValidation?s:(i=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,s.replace(i,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/\t/g,"&#x9;").replace(/\n/g,"&#xA;").replace(/\r/g,"&#xD;"))},n})()}).call(Dq)});var Dv=Q((Oq,Pq)=>{"use strict";(function(){Pq.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}).call(Oq)});var rD=Q((kq,Lq)=>{"use strict";(function(){var r,e,t,n,s,i,a,u,c,f,h,m,g,x,v,w,S,A={}.hasOwnProperty;S=uo().assign,r=mn(),c=fE(),f=gE(),t=cE(),n=lE(),m=uE(),x=vE(),v=yE(),g=xE(),h=eD(),s=hE(),i=dE(),a=pE(),u=mE(),e=Dv(),Lq.exports=w=(function(){function N(b){var E,C,_;b||(b={}),this.options=b,C=b.writer||{};for(E in C)A.call(C,E)&&(_=C[E],this["_"+E]=this[E],this[E]=_)}return o(N,"XMLWriterBase"),N.prototype.filterOptions=function(b){var E,C,_,M,R,q,H,K;return b||(b={}),b=S({},this.options,b),E={writer:this},E.pretty=b.pretty||!1,E.allowEmpty=b.allowEmpty||!1,E.indent=(C=b.indent)!=null?C:" ",E.newline=(_=b.newline)!=null?_:`
89
- `,E.offset=(M=b.offset)!=null?M:0,E.dontPrettyTextNodes=(R=(q=b.dontPrettyTextNodes)!=null?q:b.dontprettytextnodes)!=null?R:0,E.spaceBeforeSlash=(H=(K=b.spaceBeforeSlash)!=null?K:b.spacebeforeslash)!=null?H:"",E.spaceBeforeSlash===!0&&(E.spaceBeforeSlash=" "),E.suppressPrettyCount=0,E.user={},E.state=e.None,E},N.prototype.indent=function(b,E,C){var _;return!E.pretty||E.suppressPrettyCount?"":E.pretty&&(_=(C||0)+E.offset+1,_>0)?new Array(_).join(E.indent):""},N.prototype.endline=function(b,E,C){return!E.pretty||E.suppressPrettyCount?"":E.newline},N.prototype.attribute=function(b,E,C){var _;return this.openAttribute(b,E,C),_=" "+b.name+'="'+b.value+'"',this.closeAttribute(b,E,C),_},N.prototype.cdata=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C)+"<![CDATA[",E.state=e.InsideTag,_+=b.value,E.state=e.CloseTag,_+="]]>"+this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},N.prototype.comment=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C)+"<!-- ",E.state=e.InsideTag,_+=b.value,E.state=e.CloseTag,_+=" -->"+this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},N.prototype.declaration=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C)+"<?xml",E.state=e.InsideTag,_+=' version="'+b.version+'"',b.encoding!=null&&(_+=' encoding="'+b.encoding+'"'),b.standalone!=null&&(_+=' standalone="'+b.standalone+'"'),E.state=e.CloseTag,_+=E.spaceBeforeSlash+"?>",_+=this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},N.prototype.docType=function(b,E,C){var _,M,R,q,H;if(C||(C=0),this.openNode(b,E,C),E.state=e.OpenTag,q=this.indent(b,E,C),q+="<!DOCTYPE "+b.root().name,b.pubID&&b.sysID?q+=' PUBLIC "'+b.pubID+'" "'+b.sysID+'"':b.sysID&&(q+=' SYSTEM "'+b.sysID+'"'),b.children.length>0){for(q+=" [",q+=this.endline(b,E,C),E.state=e.InsideTag,H=b.children,M=0,R=H.length;M<R;M++)_=H[M],q+=this.writeChildNode(_,E,C+1);E.state=e.CloseTag,q+="]"}return E.state=e.CloseTag,q+=E.spaceBeforeSlash+">",q+=this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),q},N.prototype.element=function(b,E,C){var _,M,R,q,H,K,G,pe,le,ue,ee,he,we,Ke;C||(C=0),ue=!1,ee="",this.openNode(b,E,C),E.state=e.OpenTag,ee+=this.indent(b,E,C)+"<"+b.name,he=b.attribs;for(le in he)A.call(he,le)&&(_=he[le],ee+=this.attribute(_,E,C));if(R=b.children.length,q=R===0?null:b.children[0],R===0||b.children.every(function(Ae){return(Ae.type===r.Text||Ae.type===r.Raw)&&Ae.value===""}))E.allowEmpty?(ee+=">",E.state=e.CloseTag,ee+="</"+b.name+">"+this.endline(b,E,C)):(E.state=e.CloseTag,ee+=E.spaceBeforeSlash+"/>"+this.endline(b,E,C));else if(E.pretty&&R===1&&(q.type===r.Text||q.type===r.Raw)&&q.value!=null)ee+=">",E.state=e.InsideTag,E.suppressPrettyCount++,ue=!0,ee+=this.writeChildNode(q,E,C+1),E.suppressPrettyCount--,ue=!1,E.state=e.CloseTag,ee+="</"+b.name+">"+this.endline(b,E,C);else{if(E.dontPrettyTextNodes){for(we=b.children,H=0,G=we.length;H<G;H++)if(M=we[H],(M.type===r.Text||M.type===r.Raw)&&M.value!=null){E.suppressPrettyCount++,ue=!0;break}}for(ee+=">"+this.endline(b,E,C),E.state=e.InsideTag,Ke=b.children,K=0,pe=Ke.length;K<pe;K++)M=Ke[K],ee+=this.writeChildNode(M,E,C+1);E.state=e.CloseTag,ee+=this.indent(b,E,C)+"</"+b.name+">",ue&&E.suppressPrettyCount--,ee+=this.endline(b,E,C),E.state=e.None}return this.closeNode(b,E,C),ee},N.prototype.writeChildNode=function(b,E,C){switch(b.type){case r.CData:return this.cdata(b,E,C);case r.Comment:return this.comment(b,E,C);case r.Element:return this.element(b,E,C);case r.Raw:return this.raw(b,E,C);case r.Text:return this.text(b,E,C);case r.ProcessingInstruction:return this.processingInstruction(b,E,C);case r.Dummy:return"";case r.Declaration:return this.declaration(b,E,C);case r.DocType:return this.docType(b,E,C);case r.AttributeDeclaration:return this.dtdAttList(b,E,C);case r.ElementDeclaration:return this.dtdElement(b,E,C);case r.EntityDeclaration:return this.dtdEntity(b,E,C);case r.NotationDeclaration:return this.dtdNotation(b,E,C);default:throw new Error("Unknown XML node type: "+b.constructor.name)}},N.prototype.processingInstruction=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C)+"<?",E.state=e.InsideTag,_+=b.target,b.value&&(_+=" "+b.value),E.state=e.CloseTag,_+=E.spaceBeforeSlash+"?>",_+=this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},N.prototype.raw=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C),E.state=e.InsideTag,_+=b.value,E.state=e.CloseTag,_+=this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},N.prototype.text=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C),E.state=e.InsideTag,_+=b.value,E.state=e.CloseTag,_+=this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},N.prototype.dtdAttList=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C)+"<!ATTLIST",E.state=e.InsideTag,_+=" "+b.elementName+" "+b.attributeName+" "+b.attributeType,b.defaultValueType!=="#DEFAULT"&&(_+=" "+b.defaultValueType),b.defaultValue&&(_+=' "'+b.defaultValue+'"'),E.state=e.CloseTag,_+=E.spaceBeforeSlash+">"+this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},N.prototype.dtdElement=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C)+"<!ELEMENT",E.state=e.InsideTag,_+=" "+b.name+" "+b.value,E.state=e.CloseTag,_+=E.spaceBeforeSlash+">"+this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},N.prototype.dtdEntity=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C)+"<!ENTITY",E.state=e.InsideTag,b.pe&&(_+=" %"),_+=" "+b.name,b.value?_+=' "'+b.value+'"':(b.pubID&&b.sysID?_+=' PUBLIC "'+b.pubID+'" "'+b.sysID+'"':b.sysID&&(_+=' SYSTEM "'+b.sysID+'"'),b.nData&&(_+=" NDATA "+b.nData)),E.state=e.CloseTag,_+=E.spaceBeforeSlash+">"+this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},N.prototype.dtdNotation=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C)+"<!NOTATION",E.state=e.InsideTag,_+=" "+b.name,b.pubID&&b.sysID?_+=' PUBLIC "'+b.pubID+'" "'+b.sysID+'"':b.pubID?_+=' PUBLIC "'+b.pubID+'"':b.sysID&&(_+=' SYSTEM "'+b.sysID+'"'),E.state=e.CloseTag,_+=E.spaceBeforeSlash+">"+this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},N.prototype.openNode=function(b,E,C){},N.prototype.closeNode=function(b,E,C){},N.prototype.openAttribute=function(b,E,C){},N.prototype.closeAttribute=function(b,E,C){},N})()}).call(kq)});var wE=Q((Vq,Uq)=>{"use strict";(function(){var r,e,t=o(function(s,i){for(var a in i)n.call(i,a)&&(s[a]=i[a]);function u(){this.constructor=s}return o(u,"ctor"),u.prototype=i.prototype,s.prototype=new u,s.__super__=i.prototype,s},"extend"),n={}.hasOwnProperty;e=rD(),Uq.exports=r=(function(s){t(i,s);function i(a){i.__super__.constructor.call(this,a)}return o(i,"XMLStringWriter"),i.prototype.document=function(a,u){var c,f,h,m,g;for(u=this.filterOptions(u),m="",g=a.children,f=0,h=g.length;f<h;f++)c=g[f],m+=this.writeChildNode(c,u,0);return u.pretty&&m.slice(-u.newline.length)===u.newline&&(m=m.slice(0,-u.newline.length)),m},i})(e)}).call(Vq)});var nD=Q((jq,Fq)=>{"use strict";(function(){var r,e,t,n,s,i,a,u,c=o(function(h,m){for(var g in m)f.call(m,g)&&(h[g]=m[g]);function x(){this.constructor=h}return o(x,"ctor"),x.prototype=m.prototype,h.prototype=new x,h.__super__=m.prototype,h},"extend"),f={}.hasOwnProperty;u=uo().isPlainObject,t=QB(),e=q9(),s=di(),r=mn(),a=tD(),i=wE(),Fq.exports=n=(function(h){c(m,h);function m(g){m.__super__.constructor.call(this,null),this.name="#document",this.type=r.Document,this.documentURI=null,this.domConfig=new e,g||(g={}),g.writer||(g.writer=new i),this.options=g,this.stringify=new a(g)}return o(m,"XMLDocument"),Object.defineProperty(m.prototype,"implementation",{value:new t}),Object.defineProperty(m.prototype,"doctype",{get:o(function(){var g,x,v,w;for(w=this.children,x=0,v=w.length;x<v;x++)if(g=w[x],g.type===r.DocType)return g;return null},"get")}),Object.defineProperty(m.prototype,"documentElement",{get:o(function(){return this.rootObject||null},"get")}),Object.defineProperty(m.prototype,"inputEncoding",{get:o(function(){return null},"get")}),Object.defineProperty(m.prototype,"strictErrorChecking",{get:o(function(){return!1},"get")}),Object.defineProperty(m.prototype,"xmlEncoding",{get:o(function(){return this.children.length!==0&&this.children[0].type===r.Declaration?this.children[0].encoding:null},"get")}),Object.defineProperty(m.prototype,"xmlStandalone",{get:o(function(){return this.children.length!==0&&this.children[0].type===r.Declaration?this.children[0].standalone==="yes":!1},"get")}),Object.defineProperty(m.prototype,"xmlVersion",{get:o(function(){return this.children.length!==0&&this.children[0].type===r.Declaration?this.children[0].version:"1.0"},"get")}),Object.defineProperty(m.prototype,"URL",{get:o(function(){return this.documentURI},"get")}),Object.defineProperty(m.prototype,"origin",{get:o(function(){return null},"get")}),Object.defineProperty(m.prototype,"compatMode",{get:o(function(){return null},"get")}),Object.defineProperty(m.prototype,"characterSet",{get:o(function(){return null},"get")}),Object.defineProperty(m.prototype,"contentType",{get:o(function(){return null},"get")}),m.prototype.end=function(g){var x;return x={},g?u(g)&&(x=g,g=this.options.writer):g=this.options.writer,g.document(this,g.filterOptions(x))},m.prototype.toString=function(g){return this.options.writer.document(this,this.options.writer.filterOptions(g))},m.prototype.createElement=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createDocumentFragment=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createTextNode=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createComment=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createCDATASection=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createProcessingInstruction=function(g,x){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createAttribute=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createEntityReference=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getElementsByTagName=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.importNode=function(g,x){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createElementNS=function(g,x){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createAttributeNS=function(g,x){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getElementsByTagNameNS=function(g,x){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getElementById=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.adoptNode=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.normalizeDocument=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.renameNode=function(g,x,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getElementsByClassName=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createEvent=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createRange=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createNodeIterator=function(g,x,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createTreeWalker=function(g,x,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},m})(s)}).call(jq)});var Hq=Q((Mq,qq)=>{"use strict";(function(){var r,e,t,n,s,i,a,u,c,f,h,m,g,x,v,w,S,A,N,b,E,C,_,M,R={}.hasOwnProperty;M=uo(),C=M.isObject,E=M.isFunction,_=M.isPlainObject,b=M.getValue,r=mn(),m=nD(),x=uE(),n=cE(),s=lE(),w=vE(),N=yE(),v=xE(),f=fE(),h=gE(),i=hE(),u=pE(),a=dE(),c=mE(),t=ZB(),A=tD(),S=wE(),e=Dv(),qq.exports=g=(function(){function q(H,K,G){var pe;this.name="?xml",this.type=r.Document,H||(H={}),pe={},H.writer?_(H.writer)&&(pe=H.writer,H.writer=new S):H.writer=new S,this.options=H,this.writer=H.writer,this.writerOptions=this.writer.filterOptions(pe),this.stringify=new A(H),this.onDataCallback=K||function(){},this.onEndCallback=G||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return o(q,"XMLDocumentCB"),q.prototype.createChildNode=function(H){var K,G,pe,le,ue,ee,he,we;switch(H.type){case r.CData:this.cdata(H.value);break;case r.Comment:this.comment(H.value);break;case r.Element:pe={},he=H.attribs;for(G in he)R.call(he,G)&&(K=he[G],pe[G]=K.value);this.node(H.name,pe);break;case r.Dummy:this.dummy();break;case r.Raw:this.raw(H.value);break;case r.Text:this.text(H.value);break;case r.ProcessingInstruction:this.instruction(H.target,H.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+H.constructor.name)}for(we=H.children,ue=0,ee=we.length;ue<ee;ue++)le=we[ue],this.createChildNode(le),le.type===r.Element&&this.up();return this},q.prototype.dummy=function(){return this},q.prototype.node=function(H,K,G){var pe;if(H==null)throw new Error("Missing node name.");if(this.root&&this.currentLevel===-1)throw new Error("Document can only have one root node. "+this.debugInfo(H));return this.openCurrent(),H=b(H),K==null&&(K={}),K=b(K),C(K)||(pe=[K,G],G=pe[0],K=pe[1]),this.currentNode=new x(this,H,K),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,G!=null&&this.text(G),this},q.prototype.element=function(H,K,G){var pe,le,ue,ee,he,we;if(this.currentNode&&this.currentNode.type===r.DocType)this.dtdElement.apply(this,arguments);else if(Array.isArray(H)||C(H)||E(H))for(ee=this.options.noValidation,this.options.noValidation=!0,we=new m(this.options).element("TEMP_ROOT"),we.element(H),this.options.noValidation=ee,he=we.children,le=0,ue=he.length;le<ue;le++)pe=he[le],this.createChildNode(pe),pe.type===r.Element&&this.up();else this.node(H,K,G);return this},q.prototype.attribute=function(H,K){var G,pe;if(!this.currentNode||this.currentNode.children)throw new Error("att() can only be used immediately after an ele() call in callback mode. "+this.debugInfo(H));if(H!=null&&(H=b(H)),C(H))for(G in H)R.call(H,G)&&(pe=H[G],this.attribute(G,pe));else E(K)&&(K=K.apply()),this.options.keepNullAttributes&&K==null?this.currentNode.attribs[H]=new t(this,H,""):K!=null&&(this.currentNode.attribs[H]=new t(this,H,K));return this},q.prototype.text=function(H){var K;return this.openCurrent(),K=new N(this,H),this.onData(this.writer.text(K,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.cdata=function(H){var K;return this.openCurrent(),K=new n(this,H),this.onData(this.writer.cdata(K,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.comment=function(H){var K;return this.openCurrent(),K=new s(this,H),this.onData(this.writer.comment(K,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.raw=function(H){var K;return this.openCurrent(),K=new w(this,H),this.onData(this.writer.raw(K,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.instruction=function(H,K){var G,pe,le,ue,ee;if(this.openCurrent(),H!=null&&(H=b(H)),K!=null&&(K=b(K)),Array.isArray(H))for(G=0,ue=H.length;G<ue;G++)pe=H[G],this.instruction(pe);else if(C(H))for(pe in H)R.call(H,pe)&&(le=H[pe],this.instruction(pe,le));else E(K)&&(K=K.apply()),ee=new v(this,H,K),this.onData(this.writer.processingInstruction(ee,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this},q.prototype.declaration=function(H,K,G){var pe;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return pe=new f(this,H,K,G),this.onData(this.writer.declaration(pe,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.doctype=function(H,K,G){if(this.openCurrent(),H==null)throw new Error("Missing root node name.");if(this.root)throw new Error("dtd() must come before the root node.");return this.currentNode=new h(this,K,G),this.currentNode.rootNodeName=H,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},q.prototype.dtdElement=function(H,K){var G;return this.openCurrent(),G=new a(this,H,K),this.onData(this.writer.dtdElement(G,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.attList=function(H,K,G,pe,le){var ue;return this.openCurrent(),ue=new i(this,H,K,G,pe,le),this.onData(this.writer.dtdAttList(ue,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.entity=function(H,K){var G;return this.openCurrent(),G=new u(this,!1,H,K),this.onData(this.writer.dtdEntity(G,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.pEntity=function(H,K){var G;return this.openCurrent(),G=new u(this,!0,H,K),this.onData(this.writer.dtdEntity(G,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.notation=function(H,K){var G;return this.openCurrent(),G=new c(this,H,K),this.onData(this.writer.dtdNotation(G,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.up=function(){if(this.currentLevel<0)throw new Error("The document node has no parent.");return this.currentNode?(this.currentNode.children?this.closeNode(this.currentNode):this.openNode(this.currentNode),this.currentNode=null):this.closeNode(this.openTags[this.currentLevel]),delete this.openTags[this.currentLevel],this.currentLevel--,this},q.prototype.end=function(){for(;this.currentLevel>=0;)this.up();return this.onEnd()},q.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},q.prototype.openNode=function(H){var K,G,pe,le;if(!H.isOpen){if(!this.root&&this.currentLevel===0&&H.type===r.Element&&(this.root=H),G="",H.type===r.Element){this.writerOptions.state=e.OpenTag,G=this.writer.indent(H,this.writerOptions,this.currentLevel)+"<"+H.name,le=H.attribs;for(pe in le)R.call(le,pe)&&(K=le[pe],G+=this.writer.attribute(K,this.writerOptions,this.currentLevel));G+=(H.children?">":"/>")+this.writer.endline(H,this.writerOptions,this.currentLevel),this.writerOptions.state=e.InsideTag}else this.writerOptions.state=e.OpenTag,G=this.writer.indent(H,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+H.rootNodeName,H.pubID&&H.sysID?G+=' PUBLIC "'+H.pubID+'" "'+H.sysID+'"':H.sysID&&(G+=' SYSTEM "'+H.sysID+'"'),H.children?(G+=" [",this.writerOptions.state=e.InsideTag):(this.writerOptions.state=e.CloseTag,G+=">"),G+=this.writer.endline(H,this.writerOptions,this.currentLevel);return this.onData(G,this.currentLevel),H.isOpen=!0}},q.prototype.closeNode=function(H){var K;if(!H.isClosed)return K="",this.writerOptions.state=e.CloseTag,H.type===r.Element?K=this.writer.indent(H,this.writerOptions,this.currentLevel)+"</"+H.name+">"+this.writer.endline(H,this.writerOptions,this.currentLevel):K=this.writer.indent(H,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(H,this.writerOptions,this.currentLevel),this.writerOptions.state=e.None,this.onData(K,this.currentLevel),H.isClosed=!0},q.prototype.onData=function(H,K){return this.documentStarted=!0,this.onDataCallback(H,K+1)},q.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},q.prototype.debugInfo=function(H){return H==null?"":"node: <"+H+">"},q.prototype.ele=function(){return this.element.apply(this,arguments)},q.prototype.nod=function(H,K,G){return this.node(H,K,G)},q.prototype.txt=function(H){return this.text(H)},q.prototype.dat=function(H){return this.cdata(H)},q.prototype.com=function(H){return this.comment(H)},q.prototype.ins=function(H,K){return this.instruction(H,K)},q.prototype.dec=function(H,K,G){return this.declaration(H,K,G)},q.prototype.dtd=function(H,K,G){return this.doctype(H,K,G)},q.prototype.e=function(H,K,G){return this.element(H,K,G)},q.prototype.n=function(H,K,G){return this.node(H,K,G)},q.prototype.t=function(H){return this.text(H)},q.prototype.d=function(H){return this.cdata(H)},q.prototype.c=function(H){return this.comment(H)},q.prototype.r=function(H){return this.raw(H)},q.prototype.i=function(H,K){return this.instruction(H,K)},q.prototype.att=function(){return this.currentNode&&this.currentNode.type===r.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},q.prototype.a=function(){return this.currentNode&&this.currentNode.type===r.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},q.prototype.ent=function(H,K){return this.entity(H,K)},q.prototype.pent=function(H,K){return this.pEntity(H,K)},q.prototype.not=function(H,K){return this.notation(H,K)},q})()}).call(Mq)});var Xq=Q((Kq,$q)=>{"use strict";(function(){var r,e,t,n,s=o(function(a,u){for(var c in u)i.call(u,c)&&(a[c]=u[c]);function f(){this.constructor=a}return o(f,"ctor"),f.prototype=u.prototype,a.prototype=new f,a.__super__=u.prototype,a},"extend"),i={}.hasOwnProperty;r=mn(),n=rD(),e=Dv(),$q.exports=t=(function(a){s(u,a);function u(c,f){this.stream=c,u.__super__.constructor.call(this,f)}return o(u,"XMLStreamWriter"),u.prototype.endline=function(c,f,h){return c.isLastRootNode&&f.state===e.CloseTag?"":u.__super__.endline.call(this,c,f,h)},u.prototype.document=function(c,f){var h,m,g,x,v,w,S,A,N;for(S=c.children,m=g=0,v=S.length;g<v;m=++g)h=S[m],h.isLastRootNode=m===c.children.length-1;for(f=this.filterOptions(f),A=c.children,N=[],x=0,w=A.length;x<w;x++)h=A[x],N.push(this.writeChildNode(h,f,0));return N},u.prototype.attribute=function(c,f,h){return this.stream.write(u.__super__.attribute.call(this,c,f,h))},u.prototype.cdata=function(c,f,h){return this.stream.write(u.__super__.cdata.call(this,c,f,h))},u.prototype.comment=function(c,f,h){return this.stream.write(u.__super__.comment.call(this,c,f,h))},u.prototype.declaration=function(c,f,h){return this.stream.write(u.__super__.declaration.call(this,c,f,h))},u.prototype.docType=function(c,f,h){var m,g,x,v;if(h||(h=0),this.openNode(c,f,h),f.state=e.OpenTag,this.stream.write(this.indent(c,f,h)),this.stream.write("<!DOCTYPE "+c.root().name),c.pubID&&c.sysID?this.stream.write(' PUBLIC "'+c.pubID+'" "'+c.sysID+'"'):c.sysID&&this.stream.write(' SYSTEM "'+c.sysID+'"'),c.children.length>0){for(this.stream.write(" ["),this.stream.write(this.endline(c,f,h)),f.state=e.InsideTag,v=c.children,g=0,x=v.length;g<x;g++)m=v[g],this.writeChildNode(m,f,h+1);f.state=e.CloseTag,this.stream.write("]")}return f.state=e.CloseTag,this.stream.write(f.spaceBeforeSlash+">"),this.stream.write(this.endline(c,f,h)),f.state=e.None,this.closeNode(c,f,h)},u.prototype.element=function(c,f,h){var m,g,x,v,w,S,A,N,b,E;h||(h=0),this.openNode(c,f,h),f.state=e.OpenTag,this.stream.write(this.indent(c,f,h)+"<"+c.name),b=c.attribs;for(A in b)i.call(b,A)&&(m=b[A],this.attribute(m,f,h));if(x=c.children.length,v=x===0?null:c.children[0],x===0||c.children.every(function(C){return(C.type===r.Text||C.type===r.Raw)&&C.value===""}))f.allowEmpty?(this.stream.write(">"),f.state=e.CloseTag,this.stream.write("</"+c.name+">")):(f.state=e.CloseTag,this.stream.write(f.spaceBeforeSlash+"/>"));else if(f.pretty&&x===1&&(v.type===r.Text||v.type===r.Raw)&&v.value!=null)this.stream.write(">"),f.state=e.InsideTag,f.suppressPrettyCount++,N=!0,this.writeChildNode(v,f,h+1),f.suppressPrettyCount--,N=!1,f.state=e.CloseTag,this.stream.write("</"+c.name+">");else{for(this.stream.write(">"+this.endline(c,f,h)),f.state=e.InsideTag,E=c.children,w=0,S=E.length;w<S;w++)g=E[w],this.writeChildNode(g,f,h+1);f.state=e.CloseTag,this.stream.write(this.indent(c,f,h)+"</"+c.name+">")}return this.stream.write(this.endline(c,f,h)),f.state=e.None,this.closeNode(c,f,h)},u.prototype.processingInstruction=function(c,f,h){return this.stream.write(u.__super__.processingInstruction.call(this,c,f,h))},u.prototype.raw=function(c,f,h){return this.stream.write(u.__super__.raw.call(this,c,f,h))},u.prototype.text=function(c,f,h){return this.stream.write(u.__super__.text.call(this,c,f,h))},u.prototype.dtdAttList=function(c,f,h){return this.stream.write(u.__super__.dtdAttList.call(this,c,f,h))},u.prototype.dtdElement=function(c,f,h){return this.stream.write(u.__super__.dtdElement.call(this,c,f,h))},u.prototype.dtdEntity=function(c,f,h){return this.stream.write(u.__super__.dtdEntity.call(this,c,f,h))},u.prototype.dtdNotation=function(c,f,h){return this.stream.write(u.__super__.dtdNotation.call(this,c,f,h))},u})(n)}).call(Kq)});var Wq=Q((Gq,Nc)=>{"use strict";(function(){var r,e,t,n,s,i,a,u,c,f;f=uo(),u=f.assign,c=f.isFunction,t=QB(),n=nD(),s=Hq(),a=wE(),i=Xq(),r=mn(),e=Dv(),Nc.exports.create=function(h,m,g,x){var v,w;if(h==null)throw new Error("Root element needs a name.");return x=u({},m,g,x),v=new n(x),w=v.element(h),x.headless||(v.declaration(x),(x.pubID!=null||x.sysID!=null)&&v.dtd(x)),w},Nc.exports.begin=function(h,m,g){var x;return c(h)&&(x=[h,m],m=x[0],g=x[1],h={}),m?new s(h,m,g):new n(h)},Nc.exports.stringWriter=function(h){return new a(h)},Nc.exports.streamWriter=function(h,m){return new i(h,m)},Nc.exports.implementation=new t,Nc.exports.nodeType=r,Nc.exports.writerState=e}).call(Gq)});var zq=Q(sD=>{"use strict";(function(){"use strict";var r,e,t,n,s,i={}.hasOwnProperty;r=Wq(),e=aE().defaults,n=o(function(a){return typeof a=="string"&&(a.indexOf("&")>=0||a.indexOf(">")>=0||a.indexOf("<")>=0)},"requiresCDATA"),s=o(function(a){return"<![CDATA["+t(a)+"]]>"},"wrapCDATA"),t=o(function(a){return a.replace("]]>","]]]]><![CDATA[>")},"escapeCDATA"),sD.Builder=(function(){function a(u){var c,f,h;this.options={},f=e["0.2"];for(c in f)i.call(f,c)&&(h=f[c],this.options[c]=h);for(c in u)i.call(u,c)&&(h=u[c],this.options[c]=h)}return o(a,"Builder"),a.prototype.buildObject=function(u){var c,f,h,m,g;return c=this.options.attrkey,f=this.options.charkey,Object.keys(u).length===1&&this.options.rootName===e["0.2"].rootName?(g=Object.keys(u)[0],u=u[g]):g=this.options.rootName,h=(function(x){return function(v,w){var S,A,N,b,E,C;if(typeof w!="object")x.options.cdata&&n(w)?v.raw(s(w)):v.txt(w);else if(Array.isArray(w)){for(b in w)if(i.call(w,b)){A=w[b];for(E in A)N=A[E],v=h(v.ele(E),N).up()}}else for(E in w)if(i.call(w,E))if(A=w[E],E===c){if(typeof A=="object")for(S in A)C=A[S],v=v.att(S,C)}else if(E===f)x.options.cdata&&n(A)?v=v.raw(s(A)):v=v.txt(A);else if(Array.isArray(A))for(b in A)i.call(A,b)&&(N=A[b],typeof N=="string"?x.options.cdata&&n(N)?v=v.ele(E).raw(s(N)).up():v=v.ele(E,N).up():v=h(v.ele(E),N).up());else typeof A=="object"?v=h(v.ele(E),A).up():typeof A=="string"&&x.options.cdata&&n(A)?v=v.ele(E).raw(s(A)).up():(A==null&&(A=""),v=v.ele(E,A.toString()).up());return v}})(this),m=r.create(g,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),h(m,u).end(this.options.renderOpts)},a})()}).call(sD)});var Jq=Q(iD=>{"use strict";(function(){"use strict";iD.stripBOM=function(r){return r[0]==="\uFEFF"?r.substring(1):r}}).call(iD)});var aD=Q(yf=>{"use strict";(function(){"use strict";var r;r=new RegExp(/(?!xmlns)^.*:/),yf.normalize=function(e){return e.toLowerCase()},yf.firstCharLowerCase=function(e){return e.charAt(0).toLowerCase()+e.slice(1)},yf.stripPrefix=function(e){return e.replace(r,"")},yf.parseNumbers=function(e){return isNaN(e)||(e=e%1===0?parseInt(e,10):parseFloat(e)),e},yf.parseBooleans=function(e){return/^(?:true|false)$/i.test(e)&&(e=e.toLowerCase()==="true"),e}}).call(yf)});var Yq=Q(Jo=>{"use strict";(function(){"use strict";var r,e,t,n,s,i,a,u,c,f=o(function(g,x){return function(){return g.apply(x,arguments)}},"bind"),h=o(function(g,x){for(var v in x)m.call(x,v)&&(g[v]=x[v]);function w(){this.constructor=g}return o(w,"ctor"),w.prototype=x.prototype,g.prototype=new w,g.__super__=x.prototype,g},"extend"),m={}.hasOwnProperty;u=BB(),n=require("events"),r=Jq(),a=aD(),c=require("timers").setImmediate,e=aE().defaults,s=o(function(g){return typeof g=="object"&&g!=null&&Object.keys(g).length===0},"isEmpty"),i=o(function(g,x,v){var w,S,A;for(w=0,S=g.length;w<S;w++)A=g[w],x=A(x,v);return x},"processItem"),t=o(function(g,x,v){var w;return w=Object.create(null),w.value=v,w.writable=!0,w.enumerable=!0,w.configurable=!0,Object.defineProperty(g,x,w)},"defineProperty"),Jo.Parser=(function(g){h(x,g);function x(v){this.parseStringPromise=f(this.parseStringPromise,this),this.parseString=f(this.parseString,this),this.reset=f(this.reset,this),this.assignOrPush=f(this.assignOrPush,this),this.processAsync=f(this.processAsync,this);var w,S,A;if(!(this instanceof Jo.Parser))return new Jo.Parser(v);this.options={},S=e["0.2"];for(w in S)m.call(S,w)&&(A=S[w],this.options[w]=A);for(w in v)m.call(v,w)&&(A=v[w],this.options[w]=A);this.options.xmlns&&(this.options.xmlnskey=this.options.attrkey+"ns"),this.options.normalizeTags&&(this.options.tagNameProcessors||(this.options.tagNameProcessors=[]),this.options.tagNameProcessors.unshift(a.normalize)),this.reset()}return o(x,"Parser"),x.prototype.processAsync=function(){var v,w;try{return this.remaining.length<=this.options.chunkSize?(v=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(v),this.saxParser.close()):(v=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(v),c(this.processAsync))}catch(S){if(w=S,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(w)}},x.prototype.assignOrPush=function(v,w,S){return w in v?(v[w]instanceof Array||t(v,w,[v[w]]),v[w].push(S)):this.options.explicitArray?t(v,w,[S]):t(v,w,S)},x.prototype.reset=function(){var v,w,S,A;return this.removeAllListeners(),this.saxParser=u.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=(function(N){return function(b){if(N.saxParser.resume(),!N.saxParser.errThrown)return N.saxParser.errThrown=!0,N.emit("error",b)}})(this),this.saxParser.onend=(function(N){return function(){if(!N.saxParser.ended)return N.saxParser.ended=!0,N.emit("end",N.resultObject)}})(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,A=[],v=this.options.attrkey,w=this.options.charkey,this.saxParser.onopentag=(function(N){return function(b){var E,C,_,M,R;if(_={},_[w]="",!N.options.ignoreAttrs){R=b.attributes;for(E in R)m.call(R,E)&&(!(v in _)&&!N.options.mergeAttrs&&(_[v]={}),C=N.options.attrValueProcessors?i(N.options.attrValueProcessors,b.attributes[E],E):b.attributes[E],M=N.options.attrNameProcessors?i(N.options.attrNameProcessors,E):E,N.options.mergeAttrs?N.assignOrPush(_,M,C):t(_[v],M,C))}return _["#name"]=N.options.tagNameProcessors?i(N.options.tagNameProcessors,b.name):b.name,N.options.xmlns&&(_[N.options.xmlnskey]={uri:b.uri,local:b.local}),A.push(_)}})(this),this.saxParser.onclosetag=(function(N){return function(){var b,E,C,_,M,R,q,H,K,G;if(R=A.pop(),M=R["#name"],(!N.options.explicitChildren||!N.options.preserveChildrenOrder)&&delete R["#name"],R.cdata===!0&&(b=R.cdata,delete R.cdata),K=A[A.length-1],R[w].match(/^\s*$/)&&!b?(E=R[w],delete R[w]):(N.options.trim&&(R[w]=R[w].trim()),N.options.normalize&&(R[w]=R[w].replace(/\s{2,}/g," ").trim()),R[w]=N.options.valueProcessors?i(N.options.valueProcessors,R[w],M):R[w],Object.keys(R).length===1&&w in R&&!N.EXPLICIT_CHARKEY&&(R=R[w])),s(R)&&(typeof N.options.emptyTag=="function"?R=N.options.emptyTag():R=N.options.emptyTag!==""?N.options.emptyTag:E),N.options.validator!=null&&(G="/"+(function(){var pe,le,ue;for(ue=[],pe=0,le=A.length;pe<le;pe++)_=A[pe],ue.push(_["#name"]);return ue})().concat(M).join("/"),(function(){var pe;try{return R=N.options.validator(G,K&&K[M],R)}catch(le){return pe=le,N.emit("error",pe)}})()),N.options.explicitChildren&&!N.options.mergeAttrs&&typeof R=="object"){if(!N.options.preserveChildrenOrder)_={},N.options.attrkey in R&&(_[N.options.attrkey]=R[N.options.attrkey],delete R[N.options.attrkey]),!N.options.charsAsChildren&&N.options.charkey in R&&(_[N.options.charkey]=R[N.options.charkey],delete R[N.options.charkey]),Object.getOwnPropertyNames(R).length>0&&(_[N.options.childkey]=R),R=_;else if(K){K[N.options.childkey]=K[N.options.childkey]||[],q={};for(C in R)m.call(R,C)&&t(q,C,R[C]);K[N.options.childkey].push(q),delete R["#name"],Object.keys(R).length===1&&w in R&&!N.EXPLICIT_CHARKEY&&(R=R[w])}}return A.length>0?N.assignOrPush(K,M,R):(N.options.explicitRoot&&(H=R,R={},t(R,M,H)),N.resultObject=R,N.saxParser.ended=!0,N.emit("end",N.resultObject))}})(this),S=(function(N){return function(b){var E,C;if(C=A[A.length-1],C)return C[w]+=b,N.options.explicitChildren&&N.options.preserveChildrenOrder&&N.options.charsAsChildren&&(N.options.includeWhiteChars||b.replace(/\\n/g,"").trim()!=="")&&(C[N.options.childkey]=C[N.options.childkey]||[],E={"#name":"__text__"},E[w]=b,N.options.normalize&&(E[w]=E[w].replace(/\s{2,}/g," ").trim()),C[N.options.childkey].push(E)),C}})(this),this.saxParser.ontext=S,this.saxParser.oncdata=(function(N){return function(b){var E;if(E=S(b),E)return E.cdata=!0}})(this)},x.prototype.parseString=function(v,w){var S;w!=null&&typeof w=="function"&&(this.on("end",function(A){return this.reset(),w(null,A)}),this.on("error",function(A){return this.reset(),w(A)}));try{return v=v.toString(),v.trim()===""?(this.emit("end",null),!0):(v=r.stripBOM(v),this.options.async?(this.remaining=v,c(this.processAsync),this.saxParser):this.saxParser.write(v).close())}catch(A){if(S=A,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw S}else return this.emit("error",S),this.saxParser.errThrown=!0}},x.prototype.parseStringPromise=function(v){return new Promise((function(w){return function(S,A){return w.parseString(v,function(N,b){return N?A(N):S(b)})}})(this))},x})(n),Jo.parseString=function(g,x,v){var w,S,A;return v!=null?(typeof v=="function"&&(w=v),typeof x=="object"&&(S=x)):(typeof x=="function"&&(w=x),S={}),A=new Jo.Parser(S),A.parseString(g,w)},Jo.parseStringPromise=function(g,x){var v,w;return typeof x=="object"&&(v=x),w=new Jo.Parser(v),w.parseStringPromise(g)}}).call(Jo)});var Qq=Q(Yo=>{"use strict";(function(){"use strict";var r,e,t,n,s=o(function(a,u){for(var c in u)i.call(u,c)&&(a[c]=u[c]);function f(){this.constructor=a}return o(f,"ctor"),f.prototype=u.prototype,a.prototype=new f,a.__super__=u.prototype,a},"extend"),i={}.hasOwnProperty;e=aE(),r=zq(),t=Yq(),n=aD(),Yo.defaults=e.defaults,Yo.processors=n,Yo.ValidationError=(function(a){s(u,a);function u(c){this.message=c}return o(u,"ValidationError"),u})(Error),Yo.Builder=r.Builder,Yo.Parser=t.Parser,Yo.parseString=t.parseString,Yo.parseStringPromise=t.parseStringPromise}).call(Yo)});var bge={};IN(bge,{ASN1:()=>Pg,CanonicalizationMethod:()=>_N,Choice:()=>xge,Decimal:()=>Xl,DigestAlgorithm:()=>jw,EntitySigner:()=>DN,Environment:()=>mQ,IsDecimal:()=>VO,Left:()=>Mw,MemoryCacheAdapter:()=>MN,NFeTsError:()=>hn,NativeCertificateRepository:()=>XT,NullCacheAdapter:()=>Og,Right:()=>mg,SignatureAlgorithm:()=>ko,SignatureMethod:()=>Uw,SignatureNamespace:()=>Vw,Signer:()=>$l,SkipAllValidations:()=>vQ,SkipValidation:()=>gQ,SkipValidationMetadata:()=>wp,SoapRemoteTransmissionRepository:()=>WB,StateAcronyms:()=>dQ,StateCodeAcValidator:()=>jO,StateCodeAlValidator:()=>FO,StateCodeAmValidator:()=>MO,StateCodeApValidator:()=>qO,StateCodeBaValidator:()=>HO,StateCodeCeValidator:()=>KO,StateCodeDfValidator:()=>$O,StateCodeEsValidator:()=>XO,StateCodeGoValidator:()=>GO,StateCodeMaValidator:()=>WO,StateCodeMgValidator:()=>zO,StateCodeMsValidator:()=>JO,StateCodeMtValidator:()=>YO,StateCodePaValidator:()=>QO,StateCodePbValidator:()=>ZO,StateCodePeValidator:()=>eP,StateCodePiValidator:()=>tP,StateCodePrValidator:()=>rP,StateCodeRjValidator:()=>nP,StateCodeRnValidator:()=>sP,StateCodeRoValidator:()=>iP,StateCodeRrValidator:()=>aP,StateCodeRsValidator:()=>oP,StateCodeScValidator:()=>uP,StateCodeSeValidator:()=>cP,StateCodeSpValidator:()=>lP,StateCodeToValidator:()=>fP,StateCodes:()=>Sr,TransformDateString:()=>Sge,TransformDecimal:()=>wge,ValidateErrorsMetadata:()=>PN,Validates:()=>yQ,ValidationError:()=>BN,Xml2JsToolkit:()=>LO,XmlSigner:()=>RN,clearEmptyValues:()=>gg,left:()=>ks,leftFromError:()=>Mo,mapConstraintsToErrors:()=>kN,plainToInstance:()=>ON,right:()=>Ls,unreachable:()=>Fw});module.exports=pQ(bge);var Vw="http://www.w3.org/2000/09/xmldsig#",_N="http://www.w3.org/TR/2001/REC-xml-c14n-20010315",Uw=(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})({}),ko=(function(r){return r.SHA1="sha1",r.SHA256="sha256",r})({}),jw=(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 Sr={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"},dQ=Object.keys(Sr);var mQ={Production:"1",Homolog:"2"};var Ige={[Sr.AC]:"America/Rio_Branco",[Sr.AL]:"America/Maceio",[Sr.AM]:"America/Manaus",[Sr.AP]:"America/Belem",[Sr.BA]:"America/Bahia",[Sr.CE]:"America/Fortaleza",[Sr.DF]:"America/Sao_Paulo",[Sr.ES]:"America/Sao_Paulo",[Sr.GO]:"America/Sao_Paulo",[Sr.MA]:"America/Fortaleza",[Sr.MG]:"America/Sao_Paulo",[Sr.MS]:"America/Campo_Grande",[Sr.MT]:"America/Cuiaba",[Sr.PA]:"America/Belem",[Sr.PB]:"America/Fortaleza",[Sr.PE]:"America/Recife",[Sr.PI]:"America/Fortaleza",[Sr.PR]:"America/Sao_Paulo",[Sr.RJ]:"America/Sao_Paulo",[Sr.RN]:"America/Fortaleza",[Sr.RO]:"America/Porto_Velho",[Sr.RR]:"America/Boa_Vista",[Sr.RS]:"America/Sao_Paulo",[Sr.SC]:"America/Sao_Paulo",[Sr.SE]:"America/Maceio",[Sr.SP]:"America/Sao_Paulo",[Sr.TO]:"America/Araguaina"};var hn=class extends Error{static{o(this,"NFeTsError")}};var BN=class extends hn{static{o(this,"ValidationError")}};var dg={includeComments:!1,exclusive:!0};var Fw=o(r=>{throw new hn("Didn't expect to get here")},"unreachable");var $l=class{static{o(this,"Signer")}toolkit;certificateRepository;algorithm;canonical;constructor(e,t,n=ko.SHA1,s=dg){this.toolkit=e,this.certificateRepository=t,this.algorithm=n,this.canonical=s}assemble(e,t,n){let s=this.certificateRepository.getStringCertificate(n);return{$:{xmlns:Vw},SignedInfo:e,SignatureValue:t,KeyInfo:{X509Data:{X509Certificate:s}}}}signedInfo(e,t){return{CanonicalizationMethod:{$:{Algorithm:_N}},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:Vw},...e},{rootName:"SignedInfo"}),this.canonical);return await 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 ko.SHA256:return jw.SHA256;case ko.SHA1:return jw.SHA1;default:return Fw(this.algorithm)}}get signatureMethod(){switch(this.algorithm){case ko.SHA256:return Uw.RSA_SHA256;case ko.SHA1:return Uw.RSA_SHA1;default:return Fw(this.algorithm)}}};var Mw=class{static{o(this,"Left")}value;constructor(e){this.value=e}isLeft(){return!0}isRight(){return!1}},mg=class{static{o(this,"Right")}value;constructor(e){this.value=e}isLeft(){return!1}isRight(){return!0}},ks=o(r=>new Mw(r),"left"),Ls=o(r=>r===void 0?new mg(void 0):new mg(r),"right");var DN=class extends $l{static{o(this,"EntitySigner")}async sign(e,t,n){let{tag:s,mark:i}=t,{privateKey:a,certificate:u}=n;if(!e[s])return ks(new hn(`Node ${String(s)} not found`));let c=await this.toolkit.build(this.ns(e,s),{headless:!0,rootName:String(s),renderOpts:{pretty:!1}}),f=this.signedInfo(c,i),h=await this.signOrLeft(f,a);if(h.isLeft())return h;let m=e;return m.Signature=this.assemble(f,h.value,u),Ls(m)}ns(e,t){let n=e.$?.xmlns,{$:s,...i}=e[t],{xmlns:a,...u}=s??{};return{$:{xmlns:n,...u},...i}}};var RN=class extends $l{static{o(this,"XmlSigner")}async sign(e,t,n){let{tag:s,mark:i}=t,{privateKey:a,certificate:u}=n,c=this.toolkit.getNode(e,s);if(!c)return ks(new hn(`Node ${s} not found`));let f=this.signedInfo(c,i),h=await this.signOrLeft(f,a);if(h.isLeft())return h;let m=await this.toolkit.build(this.assemble(f,h.value,u),{rootName:"Signature"});return Ls(this.toolkit.appendNode(e,m))}};var Sve=require("reflect-metadata"),jk=require("class-validator");var gve=require("reflect-metadata");var wp="__SkipValidation__",gQ=o(()=>(r,e)=>{Reflect.defineMetadata(wp,!0,r,e.toString())},"SkipValidation"),vQ=o(()=>r=>{Reflect.defineMetadata(wp,!0,r)},"SkipAllValidations");var Uk=require("class-transformer");var gg=o(r=>{for(let[e,t]of Object.entries(r))typeof t>"u"&&delete r[e],t===""&&delete r[e],t&&typeof t=="object"&&gg(t)},"clearEmptyValues"),ON=o((r,e,t={})=>{let n=(0,Uk.plainToInstance)(e,r);return t.clearEmptyValues&&gg(n),n},"plainToInstance");var PN="__ValidateErrors__",kN=o((r,e)=>r.reduce((t,n)=>{if(n.children?.length)return t.concat(kN(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"),yQ=o(r=>(e,t,n)=>{let s=n.value;n.value=function(...i){let a=Reflect.getMetadata(wp,this.constructor);if(Reflect.getMetadata(wp,this.constructor.prototype,t.toString())===!0||a===!0)return s?.apply(this,i);let[c,...f]=i,h=ON(c,r),m=(0,jk.validateSync)(h,{whitelist:!0});if(gg(h),m.length){let g=Reflect.getMetadata(PN,this)??[];Reflect.defineMetadata(PN,g.concat(kN(m,s?.name)),this)}return s?.apply(this,[h,...f])}},"Validates");var ZOe=require("reflect-metadata");var Sp=9e15,qu=1e9,LN="0123456789abcdef",Kw="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",$w="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",VN={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Sp,maxE:Sp,crypto:!1},Hk,Lo,_t=!0,Gw="[DecimalError] ",Mu=Gw+"Invalid argument: ",Kk=Gw+"Precision limit exceeded",$k=Gw+"crypto unavailable",Xk="[object Decimal]",cs=Math.floor,Nn=Math.pow,xQ=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,wQ=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,SQ=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Gk=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,oa=1e7,St=7,bQ=9007199254740991,EQ=Kw.length-1,UN=$w.length-1,Oe={toStringTag:Xk};Oe.absoluteValue=Oe.abs=function(){var r=new this.constructor(this);return r.s<0&&(r.s=1),mt(r)};Oe.ceil=function(){return mt(new this.constructor(this),this.e+1,2)};Oe.clampedTo=Oe.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(Mu+e);return t=n.cmp(r),t<0?r:n.cmp(e)>0?e:new s(n)};Oe.comparedTo=Oe.cmp=function(r){var e,t,n,s,i=this,a=i.d,u=(r=new i.constructor(r)).d,c=i.s,f=r.s;if(!a||!u)return!c||!f?NaN:c!==f?c:a===u?0:!a^c<0?1:-1;if(!a[0]||!u[0])return a[0]?c:u[0]?-f:0;if(c!==f)return c;if(i.e!==r.e)return i.e>r.e^c<0?1:-1;for(n=a.length,s=u.length,e=0,t=n<s?n:s;e<t;++e)if(a[e]!==u[e])return a[e]>u[e]^c<0?1:-1;return n===s?0:n>s^c<0?1:-1};Oe.cosine=Oe.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())+St,n.rounding=1,t=AQ(n,Qk(n,t)),n.precision=r,n.rounding=e,mt(Lo==2||Lo==3?t.neg():t,r,e,!0)):new n(1):new n(NaN)};Oe.cubeRoot=Oe.cbrt=function(){var r,e,t,n,s,i,a,u,c,f,h=this,m=h.constructor;if(!h.isFinite()||h.isZero())return new m(h);for(_t=!1,i=h.s*Nn(h.s*h,1/3),!i||Math.abs(i)==1/0?(t=Xn(h.d),r=h.e,(i=(r-t.length+1)%3)&&(t+=i==1||i==-2?"0":"00"),i=Nn(t,1/3),r=cs((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 m(t),n.s=h.s):n=new m(i.toString()),a=(r=m.precision)+3;;)if(u=n,c=u.times(u).times(u),f=c.plus(h),n=_r(f.plus(h).times(u),f.plus(c),a+2,1),Xn(u.d).slice(0,a)===(t=Xn(n.d)).slice(0,a))if(t=t.slice(a-3,a+1),t=="9999"||!s&&t=="4999"){if(!s&&(mt(u,r+1,0),u.times(u).times(u).eq(h))){n=u;break}a+=4,s=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(mt(n,r+1,1),e=!n.times(n).times(n).eq(h));break}return _t=!0,mt(n,r,m.rounding,e)};Oe.decimalPlaces=Oe.dp=function(){var r,e=this.d,t=NaN;if(e){if(r=e.length-1,t=(r-cs(this.e/St))*St,r=e[r],r)for(;r%10==0;r/=10)t--;t<0&&(t=0)}return t};Oe.dividedBy=Oe.div=function(r){return _r(this,new this.constructor(r))};Oe.dividedToIntegerBy=Oe.divToInt=function(r){var e=this,t=e.constructor;return mt(_r(e,new t(r),0,1,1),t.precision,t.rounding)};Oe.equals=Oe.eq=function(r){return this.cmp(r)===0};Oe.floor=function(){return mt(new this.constructor(this),this.e+1,3)};Oe.greaterThan=Oe.gt=function(r){return this.cmp(r)>0};Oe.greaterThanOrEqualTo=Oe.gte=function(r){var e=this.cmp(r);return e==1||e===0};Oe.hyperbolicCosine=Oe.cosh=function(){var r,e,t,n,s,i=this,a=i.constructor,u=new a(1);if(!i.isFinite())return new a(i.s?1/0:NaN);if(i.isZero())return u;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/zw(4,r)).toString()):(r=16,e="2.3283064365386962890625e-10"),i=bp(a,1,i.times(e),new a(1),!0);for(var c,f=r,h=new a(8);f--;)c=i.times(i),i=u.minus(c.times(h.minus(c.times(h))));return mt(i,a.precision=t,a.rounding=n,!0)};Oe.hyperbolicSine=Oe.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=bp(i,2,s,s,!0);else{r=1.4*Math.sqrt(n),r=r>16?16:r|0,s=s.times(1/zw(5,r)),s=bp(i,2,s,s,!0);for(var a,u=new i(5),c=new i(16),f=new i(20);r--;)a=s.times(s),s=s.times(u.plus(a.times(c.times(a).plus(f))))}return i.precision=e,i.rounding=t,mt(s,e,t,!0)};Oe.hyperbolicTangent=Oe.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,_r(t.sinh(),t.cosh(),n.precision=r,n.rounding=e)):new n(t.s)};Oe.inverseCosine=Oe.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()?ka(e,n,s):new e(0):new e(NaN):r.isZero()?ka(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))};Oe.inverseHyperbolicCosine=Oe.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,_t=!1,t=t.times(t).minus(1).sqrt().plus(t),_t=!0,n.precision=r,n.rounding=e,t.ln()):new n(t)};Oe.inverseHyperbolicSine=Oe.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,_t=!1,t=t.times(t).plus(1).sqrt().plus(t),_t=!0,n.precision=r,n.rounding=e,t.ln())};Oe.inverseHyperbolicTangent=Oe.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?mt(new i(s),r,e,!0):(i.precision=t=n-s.e,s=_r(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)};Oe.inverseSine=Oe.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=ka(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)))};Oe.inverseTangent=Oe.atan=function(){var r,e,t,n,s,i,a,u,c,f=this,h=f.constructor,m=h.precision,g=h.rounding;if(f.isFinite()){if(f.isZero())return new h(f);if(f.abs().eq(1)&&m+4<=UN)return a=ka(h,m+4,g).times(.25),a.s=f.s,a}else{if(!f.s)return new h(NaN);if(m+4<=UN)return a=ka(h,m+4,g).times(.5),a.s=f.s,a}for(h.precision=u=m+10,h.rounding=1,t=Math.min(28,u/St+2|0),r=t;r;--r)f=f.div(f.times(f).plus(1).sqrt().plus(1));for(_t=!1,e=Math.ceil(u/St),n=1,c=f.times(f),a=new h(f),s=f;r!==-1;)if(s=s.times(c),i=a.minus(s.div(n+=2)),s=s.times(c),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)),_t=!0,mt(a,h.precision=m,h.rounding=g,!0)};Oe.isFinite=function(){return!!this.d};Oe.isInteger=Oe.isInt=function(){return!!this.d&&cs(this.e/St)>this.d.length-2};Oe.isNaN=function(){return!this.s};Oe.isNegative=Oe.isNeg=function(){return this.s<0};Oe.isPositive=Oe.isPos=function(){return this.s>0};Oe.isZero=function(){return!!this.d&&this.d[0]===0};Oe.lessThan=Oe.lt=function(r){return this.cmp(r)<0};Oe.lessThanOrEqualTo=Oe.lte=function(r){return this.cmp(r)<1};Oe.logarithm=Oe.log=function(r){var e,t,n,s,i,a,u,c,f=this,h=f.constructor,m=h.precision,g=h.rounding,x=5;if(r==null)r=new h(10),e=!0;else{if(r=new h(r),t=r.d,r.s<0||!t||!t[0]||r.eq(1))return new h(NaN);e=r.eq(10)}if(t=f.d,f.s<0||!t||!t[0]||f.eq(1))return new h(t&&!t[0]?-1/0:f.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(_t=!1,u=m+x,a=Fu(f,u),n=e?Xw(h,u+10):Fu(r,u),c=_r(a,n,u,1),vg(c.d,s=m,g))do if(u+=10,a=Fu(f,u),n=e?Xw(h,u+10):Fu(r,u),c=_r(a,n,u,1),!i){+Xn(c.d).slice(s+1,s+15)+1==1e14&&(c=mt(c,m+1,0));break}while(vg(c.d,s+=10,g));return _t=!0,mt(c,m,g)};Oe.minus=Oe.sub=function(r){var e,t,n,s,i,a,u,c,f,h,m,g,x=this,v=x.constructor;if(r=new v(r),!x.d||!r.d)return!x.s||!r.s?r=new v(NaN):x.d?r.s=-r.s:r=new v(r.d||x.s!==r.s?x:NaN),r;if(x.s!=r.s)return r.s=-r.s,x.plus(r);if(f=x.d,g=r.d,u=v.precision,c=v.rounding,!f[0]||!g[0]){if(g[0])r.s=-r.s;else if(f[0])r=new v(x);else return new v(c===3?-0:0);return _t?mt(r,u,c):r}if(t=cs(r.e/St),h=cs(x.e/St),f=f.slice(),i=h-t,i){for(m=i<0,m?(e=f,i=-i,a=g.length):(e=g,t=h,a=f.length),n=Math.max(Math.ceil(u/St),a)+2,i>n&&(i=n,e.length=1),e.reverse(),n=i;n--;)e.push(0);e.reverse()}else{for(n=f.length,a=g.length,m=n<a,m&&(a=n),n=0;n<a;n++)if(f[n]!=g[n]){m=f[n]<g[n];break}i=0}for(m&&(e=f,f=g,g=e,r.s=-r.s),a=f.length,n=g.length-a;n>0;--n)f[a++]=0;for(n=g.length;n>i;){if(f[--n]<g[n]){for(s=n;s&&f[--s]===0;)f[s]=oa-1;--f[s],f[n]+=oa}f[n]-=g[n]}for(;f[--a]===0;)f.pop();for(;f[0]===0;f.shift())--t;return f[0]?(r.d=f,r.e=Ww(f,t),_t?mt(r,u,c):r):new v(c===3?-0:0)};Oe.modulo=Oe.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]?mt(new n(t),n.precision,n.rounding):(_t=!1,n.modulo==9?(e=_r(t,r.abs(),0,3,1),e.s*=r.s):e=_r(t,r,0,n.modulo,1),e=e.times(r),_t=!0,t.minus(e))};Oe.naturalExponential=Oe.exp=function(){return jN(this)};Oe.naturalLogarithm=Oe.ln=function(){return Fu(this)};Oe.negated=Oe.neg=function(){var r=new this.constructor(this);return r.s=-r.s,mt(r)};Oe.plus=Oe.add=function(r){var e,t,n,s,i,a,u,c,f,h,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=new g(r.d||m.s===r.s?m:NaN)),r;if(m.s!=r.s)return r.s=-r.s,m.minus(r);if(f=m.d,h=r.d,u=g.precision,c=g.rounding,!f[0]||!h[0])return h[0]||(r=new g(m)),_t?mt(r,u,c):r;if(i=cs(m.e/St),n=cs(r.e/St),f=f.slice(),s=i-n,s){for(s<0?(t=f,s=-s,a=h.length):(t=h,n=i,a=f.length),i=Math.ceil(u/St),a=i>a?i+1:a+1,s>a&&(s=a,t.length=1),t.reverse();s--;)t.push(0);t.reverse()}for(a=f.length,s=h.length,a-s<0&&(s=a,t=h,h=f,f=t),e=0;s;)e=(f[--s]=f[s]+h[s]+e)/oa|0,f[s]%=oa;for(e&&(f.unshift(e),++n),a=f.length;f[--a]==0;)f.pop();return r.d=f,r.e=Ww(f,n),_t?mt(r,u,c):r};Oe.precision=Oe.sd=function(r){var e,t=this;if(r!==void 0&&r!==!!r&&r!==1&&r!==0)throw Error(Mu+r);return t.d?(e=Wk(t.d),r&&t.e+1>e&&(e=t.e+1)):e=NaN,e};Oe.round=function(){var r=this,e=r.constructor;return mt(new e(r),r.e+1,e.rounding)};Oe.sine=Oe.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())+St,n.rounding=1,t=NQ(n,Qk(n,t)),n.precision=r,n.rounding=e,mt(Lo>2?t.neg():t,r,e,!0)):new n(NaN)};Oe.squareRoot=Oe.sqrt=function(){var r,e,t,n,s,i,a=this,u=a.d,c=a.e,f=a.s,h=a.constructor;if(f!==1||!u||!u[0])return new h(!f||f<0&&(!u||u[0])?NaN:u?a:1/0);for(_t=!1,f=Math.sqrt(+a),f==0||f==1/0?(e=Xn(u),(e.length+c)%2==0&&(e+="0"),f=Math.sqrt(e),c=cs((c+1)/2)-(c<0||c%2),f==1/0?e="5e"+c:(e=f.toExponential(),e=e.slice(0,e.indexOf("e")+1)+c),n=new h(e)):n=new h(f.toString()),t=(c=h.precision)+3;;)if(i=n,n=i.plus(_r(a,i,t+2,1)).times(.5),Xn(i.d).slice(0,t)===(e=Xn(n.d)).slice(0,t))if(e=e.slice(t-3,t+1),e=="9999"||!s&&e=="4999"){if(!s&&(mt(i,c+1,0),i.times(i).eq(a))){n=i;break}t+=4,s=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(mt(n,c+1,1),r=!n.times(n).eq(a));break}return _t=!0,mt(n,c,h.rounding,r)};Oe.tangent=Oe.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=_r(t,new n(1).minus(t.times(t)).sqrt(),r+10,0),n.precision=r,n.rounding=e,mt(Lo==2||Lo==4?t.neg():t,r,e,!0)):new n(NaN)};Oe.times=Oe.mul=function(r){var e,t,n,s,i,a,u,c,f,h=this,m=h.constructor,g=h.d,x=(r=new m(r)).d;if(r.s*=h.s,!g||!g[0]||!x||!x[0])return new m(!r.s||g&&!g[0]&&!x||x&&!x[0]&&!g?NaN:!g||!x?r.s/0:r.s*0);for(t=cs(h.e/St)+cs(r.e/St),c=g.length,f=x.length,c<f&&(i=g,g=x,x=i,a=c,c=f,f=a),i=[],a=c+f,n=a;n--;)i.push(0);for(n=f;--n>=0;){for(e=0,s=c+n;s>n;)u=i[s]+x[n]*g[s-n-1]+e,i[s--]=u%oa|0,e=u/oa|0;i[s]=(i[s]+e)%oa|0}for(;!i[--a];)i.pop();return e?++t:i.shift(),r.d=i,r.e=Ww(i,t),_t?mt(r,m.precision,m.rounding):r};Oe.toBinary=function(r,e){return FN(this,2,r,e)};Oe.toDecimalPlaces=Oe.toDP=function(r,e){var t=this,n=t.constructor;return t=new n(t),r===void 0?t:(Vs(r,0,qu),e===void 0?e=n.rounding:Vs(e,0,8),mt(t,r+t.e+1,e))};Oe.toExponential=function(r,e){var t,n=this,s=n.constructor;return r===void 0?t=La(n,!0):(Vs(r,0,qu),e===void 0?e=s.rounding:Vs(e,0,8),n=mt(new s(n),r+1,e),t=La(n,!0,r+1)),n.isNeg()&&!n.isZero()?"-"+t:t};Oe.toFixed=function(r,e){var t,n,s=this,i=s.constructor;return r===void 0?t=La(s):(Vs(r,0,qu),e===void 0?e=i.rounding:Vs(e,0,8),n=mt(new i(s),r+s.e+1,e),t=La(n,!1,r+n.e+1)),s.isNeg()&&!s.isZero()?"-"+t:t};Oe.toFraction=function(r){var e,t,n,s,i,a,u,c,f,h,m,g,x=this,v=x.d,w=x.constructor;if(!v)return new w(x);if(f=t=new w(1),n=c=new w(0),e=new w(n),i=e.e=Wk(v)-x.e-1,a=i%St,e.d[0]=Nn(10,a<0?St+a:a),r==null)r=i>0?e:f;else{if(u=new w(r),!u.isInt()||u.lt(f))throw Error(Mu+u);r=u.gt(e)?i>0?e:f:u}for(_t=!1,u=new w(Xn(v)),h=w.precision,w.precision=i=v.length*St*2;m=_r(u,e,0,1,1),s=t.plus(m.times(n)),s.cmp(r)!=1;)t=n,n=s,s=f,f=c.plus(m.times(s)),c=s,s=e,e=u.minus(m.times(s)),u=s;return s=_r(r.minus(t),n,0,1,1),c=c.plus(s.times(f)),t=t.plus(s.times(n)),c.s=f.s=x.s,g=_r(f,n,i,1).minus(x).abs().cmp(_r(c,t,i,1).minus(x).abs())<1?[f,n]:[c,t],w.precision=h,_t=!0,g};Oe.toHexadecimal=Oe.toHex=function(r,e){return FN(this,16,r,e)};Oe.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:Vs(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]?(_t=!1,t=_r(t,r,0,e,1).times(r),_t=!0,mt(t)):(r.s=t.s,t=r),t};Oe.toNumber=function(){return+this};Oe.toOctal=function(r,e){return FN(this,8,r,e)};Oe.toPower=Oe.pow=function(r){var e,t,n,s,i,a,u=this,c=u.constructor,f=+(r=new c(r));if(!u.d||!r.d||!u.d[0]||!r.d[0])return new c(Nn(+u,f));if(u=new c(u),u.eq(1))return u;if(n=c.precision,i=c.rounding,r.eq(1))return mt(u,n,i);if(e=cs(r.e/St),e>=r.d.length-1&&(t=f<0?-f:f)<=bQ)return s=zk(c,u,t,n),r.s<0?new c(1).div(s):mt(s,n,i);if(a=u.s,a<0){if(e<r.d.length-1)return new c(NaN);if((r.d[e]&1)==0&&(a=1),u.e==0&&u.d[0]==1&&u.d.length==1)return u.s=a,u}return t=Nn(+u,f),e=t==0||!isFinite(t)?cs(f*(Math.log("0."+Xn(u.d))/Math.LN10+u.e+1)):new c(t+"").e,e>c.maxE+1||e<c.minE-1?new c(e>0?a/0:0):(_t=!1,c.rounding=u.s=1,t=Math.min(12,(e+"").length),s=jN(r.times(Fu(u,n+t)),n),s.d&&(s=mt(s,n+5,1),vg(s.d,n,i)&&(e=n+10,s=mt(jN(r.times(Fu(u,e+t)),e),e+5,1),+Xn(s.d).slice(n+1,n+15)+1==1e14&&(s=mt(s,n+1,0)))),s.s=a,_t=!0,c.rounding=i,mt(s,n,i))};Oe.toPrecision=function(r,e){var t,n=this,s=n.constructor;return r===void 0?t=La(n,n.e<=s.toExpNeg||n.e>=s.toExpPos):(Vs(r,1,qu),e===void 0?e=s.rounding:Vs(e,0,8),n=mt(new s(n),r,e),t=La(n,r<=n.e||n.e<=s.toExpNeg,r)),n.isNeg()&&!n.isZero()?"-"+t:t};Oe.toSignificantDigits=Oe.toSD=function(r,e){var t=this,n=t.constructor;return r===void 0?(r=n.precision,e=n.rounding):(Vs(r,1,qu),e===void 0?e=n.rounding:Vs(e,0,8)),mt(new n(t),r,e)};Oe.toString=function(){var r=this,e=r.constructor,t=La(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()&&!r.isZero()?"-"+t:t};Oe.truncated=Oe.trunc=function(){return mt(new this.constructor(this),this.e+1,1)};Oe.valueOf=Oe.toJSON=function(){var r=this,e=r.constructor,t=La(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()?"-"+t:t};function Xn(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=St-n.length,t&&(i+=ju(t)),i+=n;a=r[e],n=a+"",t=St-n.length,t&&(i+=ju(t))}else if(a===0)return"0";for(;a%10===0;)a/=10;return i+a}o(Xn,"digitsToString");function Vs(r,e,t){if(r!==~~r||r<e||r>t)throw Error(Mu+r)}o(Vs,"checkInt32");function vg(r,e,t,n){var s,i,a,u;for(i=r[0];i>=10;i/=10)--e;return--e<0?(e+=St,s=0):(s=Math.ceil((e+1)/St),e%=St),i=Nn(10,St-e),u=r[s]%i|0,n==null?e<3?(e==0?u=u/100|0:e==1&&(u=u/10|0),a=t<4&&u==99999||t>3&&u==49999||u==5e4||u==0):a=(t<4&&u+1==i||t>3&&u+1==i/2)&&(r[s+1]/i/100|0)==Nn(10,e-2)-1||(u==i/2||u==0)&&(r[s+1]/i/100|0)==0:e<4?(e==0?u=u/1e3|0:e==1?u=u/100|0:e==2&&(u=u/10|0),a=(n||t<4)&&u==9999||!n&&t>3&&u==4999):a=((n||t<4)&&u+1==i||!n&&t>3&&u+1==i/2)&&(r[s+1]/i/1e3|0)==Nn(10,e-3)-1,a}o(vg,"checkRoundingDigits");function qw(r,e,t){for(var n,s=[0],i,a=0,u=r.length;a<u;){for(i=s.length;i--;)s[i]*=e;for(s[0]+=LN.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()}o(qw,"convertBase");function AQ(r,e){var t,n,s;if(e.isZero())return e;n=e.d.length,n<32?(t=Math.ceil(n/3),s=(1/zw(4,t)).toString()):(t=16,s="2.3283064365386962890625e-10"),r.precision+=t,e=bp(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}o(AQ,"cosine");var _r=(function(){function r(n,s,i){var a,u=0,c=n.length;for(n=n.slice();c--;)a=n[c]*s+u,n[c]=a%i|0,u=a/i|0;return u&&n.unshift(u),n}o(r,"multiplyInteger");function e(n,s,i,a){var u,c;if(i!=a)c=i>a?1:-1;else for(u=c=0;u<i;u++)if(n[u]!=s[u]){c=n[u]>s[u]?1:-1;break}return c}o(e,"compare");function t(n,s,i,a){for(var u=0;i--;)n[i]-=u,u=n[i]<s[i]?1:0,n[i]=u*a+n[i]-s[i];for(;!n[0]&&n.length>1;)n.shift()}return o(t,"subtract"),function(n,s,i,a,u,c){var f,h,m,g,x,v,w,S,A,N,b,E,C,_,M,R,q,H,K,G,pe=n.constructor,le=n.s==s.s?1:-1,ue=n.d,ee=s.d;if(!ue||!ue[0]||!ee||!ee[0])return new pe(!n.s||!s.s||(ue?ee&&ue[0]==ee[0]:!ee)?NaN:ue&&ue[0]==0||!ee?le*0:le/0);for(c?(x=1,h=n.e-s.e):(c=oa,x=St,h=cs(n.e/x)-cs(s.e/x)),K=ee.length,q=ue.length,A=new pe(le),N=A.d=[],m=0;ee[m]==(ue[m]||0);m++);if(ee[m]>(ue[m]||0)&&h--,i==null?(_=i=pe.precision,a=pe.rounding):u?_=i+(n.e-s.e)+1:_=i,_<0)N.push(1),v=!0;else{if(_=_/x+2|0,m=0,K==1){for(g=0,ee=ee[0],_++;(m<q||g)&&_--;m++)M=g*c+(ue[m]||0),N[m]=M/ee|0,g=M%ee|0;v=g||m<q}else{for(g=c/(ee[0]+1)|0,g>1&&(ee=r(ee,g,c),ue=r(ue,g,c),K=ee.length,q=ue.length),R=K,b=ue.slice(0,K),E=b.length;E<K;)b[E++]=0;G=ee.slice(),G.unshift(0),H=ee[0],ee[1]>=c/2&&++H;do g=0,f=e(ee,b,K,E),f<0?(C=b[0],K!=E&&(C=C*c+(b[1]||0)),g=C/H|0,g>1?(g>=c&&(g=c-1),w=r(ee,g,c),S=w.length,E=b.length,f=e(w,b,S,E),f==1&&(g--,t(w,K<S?G:ee,S,c))):(g==0&&(f=g=1),w=ee.slice()),S=w.length,S<E&&w.unshift(0),t(b,w,E,c),f==-1&&(E=b.length,f=e(ee,b,K,E),f<1&&(g++,t(b,K<E?G:ee,E,c))),E=b.length):f===0&&(g++,b=[0]),N[m++]=g,f&&b[0]?b[E++]=ue[R]||0:(b=[ue[R]],E=1);while((R++<q||b[0]!==void 0)&&_--);v=b[0]!==void 0}N[0]||N.shift()}if(x==1)A.e=h,Hk=v;else{for(m=1,g=N[0];g>=10;g/=10)m++;A.e=m+h*x-1,mt(A,u?i+A.e+1:i,a,v)}return A}})();function mt(r,e,t,n){var s,i,a,u,c,f,h,m,g,x=r.constructor;e:if(e!=null){if(m=r.d,!m)return r;for(s=1,u=m[0];u>=10;u/=10)s++;if(i=e-s,i<0)i+=St,a=e,h=m[g=0],c=h/Nn(10,s-a-1)%10|0;else if(g=Math.ceil((i+1)/St),u=m.length,g>=u)if(n){for(;u++<=g;)m.push(0);h=c=0,s=1,i%=St,a=i-St+1}else break e;else{for(h=u=m[g],s=1;u>=10;u/=10)s++;i%=St,a=i-St+s,c=a<0?0:h/Nn(10,s-a-1)%10|0}if(n=n||e<0||m[g+1]!==void 0||(a<0?h:h%Nn(10,s-a-1)),f=t<4?(c||n)&&(t==0||t==(r.s<0?3:2)):c>5||c==5&&(t==4||n||t==6&&(i>0?a>0?h/Nn(10,s-a):0:m[g-1])%10&1||t==(r.s<0?8:7)),e<1||!m[0])return m.length=0,f?(e-=r.e+1,m[0]=Nn(10,(St-e%St)%St),r.e=-e||0):m[0]=r.e=0,r;if(i==0?(m.length=g,u=1,g--):(m.length=g+1,u=Nn(10,St-i),m[g]=a>0?(h/Nn(10,s-a)%Nn(10,a)|0)*u:0),f)for(;;)if(g==0){for(i=1,a=m[0];a>=10;a/=10)i++;for(a=m[0]+=u,u=1;a>=10;a/=10)u++;i!=u&&(r.e++,m[0]==oa&&(m[0]=1));break}else{if(m[g]+=u,m[g]!=oa)break;m[g--]=0,u=1}for(i=m.length;m[--i]===0;)m.pop()}return _t&&(r.e>x.maxE?(r.d=null,r.e=NaN):r.e<x.minE&&(r.e=0,r.d=[0])),r}o(mt,"finalise");function La(r,e,t){if(!r.isFinite())return Yk(r);var n,s=r.e,i=Xn(r.d),a=i.length;return e?(t&&(n=t-a)>0?i=i.charAt(0)+"."+i.slice(1)+ju(n):a>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(r.e<0?"e":"e+")+r.e):s<0?(i="0."+ju(-s-1)+i,t&&(n=t-a)>0&&(i+=ju(n))):s>=a?(i+=ju(s+1-a),t&&(n=t-s-1)>0&&(i=i+"."+ju(n))):((n=s+1)<a&&(i=i.slice(0,n)+"."+i.slice(n)),t&&(n=t-a)>0&&(s+1===a&&(i+="."),i+=ju(n))),i}o(La,"finiteToString");function Ww(r,e){var t=r[0];for(e*=St;t>=10;t/=10)e++;return e}o(Ww,"getBase10Exponent");function Xw(r,e,t){if(e>EQ)throw _t=!0,t&&(r.precision=t),Error(Kk);return mt(new r(Kw),e,1,!0)}o(Xw,"getLn10");function ka(r,e,t){if(e>UN)throw Error(Kk);return mt(new r($w),e,t,!0)}o(ka,"getPi");function Wk(r){var e=r.length-1,t=e*St+1;if(e=r[e],e){for(;e%10==0;e/=10)t--;for(e=r[0];e>=10;e/=10)t++}return t}o(Wk,"getPrecision");function ju(r){for(var e="";r--;)e+="0";return e}o(ju,"getZeroString");function zk(r,e,t,n){var s,i=new r(1),a=Math.ceil(n/St+4);for(_t=!1;;){if(t%2&&(i=i.times(e),Mk(i.d,a)&&(s=!0)),t=cs(t/2),t===0){t=i.d.length-1,s&&i.d[t]===0&&++i.d[t];break}e=e.times(e),Mk(e.d,a)}return _t=!0,i}o(zk,"intPow");function Fk(r){return r.d[r.d.length-1]&1}o(Fk,"isOdd");function Jk(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}o(Jk,"maxOrMin");function jN(r,e){var t,n,s,i,a,u,c,f=0,h=0,m=0,g=r.constructor,x=g.rounding,v=g.precision;if(!r.d||!r.d[0]||r.e>17)return new g(r.d?r.d[0]?r.s<0?0:1/0:1:r.s?r.s<0?0:r:NaN);for(e==null?(_t=!1,c=v):c=e,u=new g(.03125);r.e>-2;)r=r.times(u),m+=5;for(n=Math.log(Nn(2,m))/Math.LN10*2+5|0,c+=n,t=i=a=new g(1),g.precision=c;;){if(i=mt(i.times(r),c,1),t=t.times(++h),u=a.plus(_r(i,t,c,1)),Xn(u.d).slice(0,c)===Xn(a.d).slice(0,c)){for(s=m;s--;)a=mt(a.times(a),c,1);if(e==null)if(f<3&&vg(a.d,c-n,x,f))g.precision=c+=10,t=i=u=new g(1),h=0,f++;else return mt(a,g.precision=v,x,_t=!0);else return g.precision=v,a}a=u}}o(jN,"naturalExponential");function Fu(r,e){var t,n,s,i,a,u,c,f,h,m,g,x=1,v=10,w=r,S=w.d,A=w.constructor,N=A.rounding,b=A.precision;if(w.s<0||!S||!S[0]||!w.e&&S[0]==1&&S.length==1)return new A(S&&!S[0]?-1/0:w.s!=1?NaN:S?0:w);if(e==null?(_t=!1,h=b):h=e,A.precision=h+=v,t=Xn(S),n=t.charAt(0),Math.abs(i=w.e)<15e14){for(;n<7&&n!=1||n==1&&t.charAt(1)>3;)w=w.times(r),t=Xn(w.d),n=t.charAt(0),x++;i=w.e,n>1?(w=new A("0."+t),i++):w=new A(n+"."+t.slice(1))}else return f=Xw(A,h+2,b).times(i+""),w=Fu(new A(n+"."+t.slice(1)),h-v).plus(f),A.precision=b,e==null?mt(w,b,N,_t=!0):w;for(m=w,c=a=w=_r(w.minus(1),w.plus(1),h,1),g=mt(w.times(w),h,1),s=3;;){if(a=mt(a.times(g),h,1),f=c.plus(_r(a,new A(s),h,1)),Xn(f.d).slice(0,h)===Xn(c.d).slice(0,h))if(c=c.times(2),i!==0&&(c=c.plus(Xw(A,h+2,b).times(i+""))),c=_r(c,new A(x),h,1),e==null)if(vg(c.d,h-v,N,u))A.precision=h+=v,f=a=w=_r(m.minus(1),m.plus(1),h,1),g=mt(w.times(w),h,1),s=u=1;else return mt(c,A.precision=b,N,_t=!0);else return A.precision=b,c;c=f,s+=2}}o(Fu,"naturalLogarithm");function Yk(r){return String(r.s*r.s/0)}o(Yk,"nonFiniteToString");function Hw(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)%St,t<0&&(n+=St),n<s){for(n&&r.d.push(+e.slice(0,n)),s-=St;n<s;)r.d.push(+e.slice(n,n+=St));e=e.slice(n),n=St-e.length}else n-=s;for(;n--;)e+="0";r.d.push(+e),_t&&(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}o(Hw,"parseDecimal");function CQ(r,e){var t,n,s,i,a,u,c,f,h;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),Gk.test(e))return Hw(r,e)}else if(e==="Infinity"||e==="NaN")return+e||(r.s=NaN),r.e=NaN,r.d=null,r;if(wQ.test(e))t=16,e=e.toLowerCase();else if(xQ.test(e))t=2;else if(SQ.test(e))t=8;else throw Error(Mu+e);for(i=e.search(/p/i),i>0?(c=+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(".",""),u=e.length,i=u-i,s=zk(n,new n(t),i,i*2)),f=qw(e,t,oa),h=f.length-1,i=h;f[i]===0;--i)f.pop();return i<0?new n(r.s*0):(r.e=Ww(f,h),r.d=f,_t=!1,a&&(r=_r(r,s,u*4)),c&&(r=r.times(Math.abs(c)<54?Nn(2,c):Ep.pow(2,c))),_t=!0,r)}o(CQ,"parseOther");function NQ(r,e){var t,n=e.d.length;if(n<3)return e.isZero()?e:bp(r,2,e,e);t=1.4*Math.sqrt(n),t=t>16?16:t|0,e=e.times(1/zw(5,t)),e=bp(r,2,e,e);for(var s,i=new r(5),a=new r(16),u=new r(20);t--;)s=e.times(e),e=e.times(i.plus(s.times(a.times(s).minus(u))));return e}o(NQ,"sine");function bp(r,e,t,n,s){var i,a,u,c,f=1,h=r.precision,m=Math.ceil(h/St);for(_t=!1,c=t.times(t),u=new r(n);;){if(a=_r(u.times(c),new r(e++*e++),h,1),u=s?n.plus(a):n.minus(a),n=_r(a.times(c),new r(e++*e++),h,1),a=u.plus(n),a.d[m]!==void 0){for(i=m;a.d[i]===u.d[i]&&i--;);if(i==-1)break}i=u,u=n,n=a,a=i,f++}return _t=!0,a.d.length=m+1,a}o(bp,"taylorSeries");function zw(r,e){for(var t=r;--e;)t*=r;return t}o(zw,"tinyPow");function Qk(r,e){var t,n=e.s<0,s=ka(r,r.precision,1),i=s.times(.5);if(e=e.abs(),e.lte(i))return Lo=n?4:1,e;if(t=e.divToInt(s),t.isZero())Lo=n?3:2;else{if(e=e.minus(t.times(s)),e.lte(i))return Lo=Fk(t)?n?2:3:n?4:1,e;Lo=Fk(t)?n?1:4:n?3:2}return e.minus(s).abs()}o(Qk,"toLessThanHalfPi");function FN(r,e,t,n){var s,i,a,u,c,f,h,m,g,x=r.constructor,v=t!==void 0;if(v?(Vs(t,1,qu),n===void 0?n=x.rounding:Vs(n,0,8)):(t=x.precision,n=x.rounding),!r.isFinite())h=Yk(r);else{for(h=La(r),a=h.indexOf("."),v?(s=2,e==16?t=t*4-3:e==8&&(t=t*3-2)):s=e,a>=0&&(h=h.replace(".",""),g=new x(1),g.e=h.length-a,g.d=qw(La(g),10,s),g.e=g.d.length),m=qw(h,10,s),i=c=m.length;m[--c]==0;)m.pop();if(!m[0])h=v?"0p+0":"0";else{if(a<0?i--:(r=new x(r),r.d=m,r.e=i,r=_r(r,g,t,n,0,s),m=r.d,i=r.e,f=Hk),a=m[t],u=s/2,f=f||m[t+1]!==void 0,f=n<4?(a!==void 0||f)&&(n===0||n===(r.s<0?3:2)):a>u||a===u&&(n===4||f||n===6&&m[t-1]&1||n===(r.s<0?8:7)),m.length=t,f)for(;++m[--t]>s-1;)m[t]=0,t||(++i,m.unshift(1));for(c=m.length;!m[c-1];--c);for(a=0,h="";a<c;a++)h+=LN.charAt(m[a]);if(v){if(c>1)if(e==16||e==8){for(a=e==16?4:3,--c;c%a;c++)h+="0";for(m=qw(h,s,e),c=m.length;!m[c-1];--c);for(a=1,h="1.";a<c;a++)h+=LN.charAt(m[a])}else h=h.charAt(0)+"."+h.slice(1);h=h+(i<0?"p":"p+")+i}else if(i<0){for(;++i;)h="0"+h;h="0."+h}else if(++i>c)for(i-=c;i--;)h+="0";else i<c&&(h=h.slice(0,i)+"."+h.slice(i))}h=(e==16?"0x":e==2?"0b":e==8?"0o":"")+h}return r.s<0?"-"+h:h}o(FN,"toStringBinary");function Mk(r,e){if(r.length>e)return r.length=e,!0}o(Mk,"truncate");function TQ(r){return new this(r).abs()}o(TQ,"abs");function IQ(r){return new this(r).acos()}o(IQ,"acos");function _Q(r){return new this(r).acosh()}o(_Q,"acosh");function BQ(r,e){return new this(r).plus(e)}o(BQ,"add");function DQ(r){return new this(r).asin()}o(DQ,"asin");function RQ(r){return new this(r).asinh()}o(RQ,"asinh");function OQ(r){return new this(r).atan()}o(OQ,"atan");function PQ(r){return new this(r).atanh()}o(PQ,"atanh");function kQ(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=ka(this,i,1).times(e.s>0?.25:.75),t.s=r.s):!e.d||r.isZero()?(t=e.s<0?ka(this,n,s):new this(0),t.s=r.s):!r.d||e.isZero()?(t=ka(this,i,1).times(.5),t.s=r.s):e.s<0?(this.precision=i,this.rounding=1,t=this.atan(_r(r,e,i,1)),e=ka(this,i,1),this.precision=n,this.rounding=s,t=r.s<0?t.minus(e):t.plus(e)):t=this.atan(_r(r,e,i,1)),t}o(kQ,"atan2");function LQ(r){return new this(r).cbrt()}o(LQ,"cbrt");function VQ(r){return mt(r=new this(r),r.e+1,2)}o(VQ,"ceil");function UQ(r,e,t){return new this(r).clamp(e,t)}o(UQ,"clamp");function jQ(r){if(!r||typeof r!="object")throw Error(Gw+"Object expected");var e,t,n,s=r.defaults===!0,i=["precision",1,qu,"rounding",0,8,"toExpNeg",-Sp,0,"toExpPos",0,Sp,"maxE",0,Sp,"minE",-Sp,0,"modulo",0,9];for(e=0;e<i.length;e+=3)if(t=i[e],s&&(this[t]=VN[t]),(n=r[t])!==void 0)if(cs(n)===n&&n>=i[e+1]&&n<=i[e+2])this[t]=n;else throw Error(Mu+t+": "+n);if(t="crypto",s&&(this[t]=VN[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($k);else this[t]=!1;else throw Error(Mu+t+": "+n);return this}o(jQ,"config");function FQ(r){return new this(r).cos()}o(FQ,"cos");function MQ(r){return new this(r).cosh()}o(MQ,"cosh");function Zk(r){var e,t,n;function s(i){var a,u,c,f=this;if(!(f instanceof s))return new s(i);if(f.constructor=s,qk(i)){f.s=i.s,_t?!i.d||i.e>s.maxE?(f.e=NaN,f.d=null):i.e<s.minE?(f.e=0,f.d=[0]):(f.e=i.e,f.d=i.d.slice()):(f.e=i.e,f.d=i.d?i.d.slice():i.d);return}if(c=typeof i,c==="number"){if(i===0){f.s=1/i<0?-1:1,f.e=0,f.d=[0];return}if(i<0?(i=-i,f.s=-1):f.s=1,i===~~i&&i<1e7){for(a=0,u=i;u>=10;u/=10)a++;_t?a>s.maxE?(f.e=NaN,f.d=null):a<s.minE?(f.e=0,f.d=[0]):(f.e=a,f.d=[i]):(f.e=a,f.d=[i]);return}if(i*0!==0){i||(f.s=NaN),f.e=NaN,f.d=null;return}return Hw(f,i.toString())}if(c==="string")return(u=i.charCodeAt(0))===45?(i=i.slice(1),f.s=-1):(u===43&&(i=i.slice(1)),f.s=1),Gk.test(i)?Hw(f,i):CQ(f,i);if(c==="bigint")return i<0?(i=-i,f.s=-1):f.s=1,Hw(f,i.toString());throw Error(Mu+i)}if(o(s,"Decimal"),s.prototype=Oe,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=jQ,s.clone=Zk,s.isDecimal=qk,s.abs=TQ,s.acos=IQ,s.acosh=_Q,s.add=BQ,s.asin=DQ,s.asinh=RQ,s.atan=OQ,s.atanh=PQ,s.atan2=kQ,s.cbrt=LQ,s.ceil=VQ,s.clamp=UQ,s.cos=FQ,s.cosh=MQ,s.div=qQ,s.exp=HQ,s.floor=KQ,s.hypot=$Q,s.ln=XQ,s.log=GQ,s.log10=zQ,s.log2=WQ,s.max=JQ,s.min=YQ,s.mod=QQ,s.mul=ZQ,s.pow=eZ,s.random=tZ,s.round=rZ,s.sign=nZ,s.sin=sZ,s.sinh=iZ,s.sqrt=aZ,s.sub=oZ,s.sum=uZ,s.tan=cZ,s.tanh=lZ,s.trunc=fZ,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}o(Zk,"clone");function qQ(r,e){return new this(r).div(e)}o(qQ,"div");function HQ(r){return new this(r).exp()}o(HQ,"exp");function KQ(r){return mt(r=new this(r),r.e+1,3)}o(KQ,"floor");function $Q(){var r,e,t=new this(0);for(_t=!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 _t=!0,new this(1/0);t=e}return _t=!0,t.sqrt()}o($Q,"hypot");function qk(r){return r instanceof Ep||r&&r.toStringTag===Xk||!1}o(qk,"isDecimalInstance");function XQ(r){return new this(r).ln()}o(XQ,"ln");function GQ(r,e){return new this(r).log(e)}o(GQ,"log");function WQ(r){return new this(r).log(2)}o(WQ,"log2");function zQ(r){return new this(r).log(10)}o(zQ,"log10");function JQ(){return Jk(this,arguments,-1)}o(JQ,"max");function YQ(){return Jk(this,arguments,1)}o(YQ,"min");function QQ(r,e){return new this(r).mod(e)}o(QQ,"mod");function ZQ(r,e){return new this(r).mul(e)}o(ZQ,"mul");function eZ(r,e){return new this(r).pow(e)}o(eZ,"pow");function tZ(r){var e,t,n,s,i=0,a=new this(1),u=[];if(r===void 0?r=this.precision:Vs(r,1,qu),n=Math.ceil(r/St),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]:u[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):(u.push(s%1e7),i+=4);i=n/4}else throw Error($k);else for(;i<n;)u[i++]=Math.random()*1e7|0;for(n=u[--i],r%=St,n&&r&&(s=Nn(10,St-r),u[i]=(n/s|0)*s);u[i]===0;i--)u.pop();if(i<0)t=0,u=[0];else{for(t=-1;u[0]===0;t-=St)u.shift();for(n=1,s=u[0];s>=10;s/=10)n++;n<St&&(t-=St-n)}return a.e=t,a.d=u,a}o(tZ,"random");function rZ(r){return mt(r=new this(r),r.e+1,this.rounding)}o(rZ,"round");function nZ(r){return r=new this(r),r.d?r.d[0]?r.s:0*r.s:r.s||NaN}o(nZ,"sign");function sZ(r){return new this(r).sin()}o(sZ,"sin");function iZ(r){return new this(r).sinh()}o(iZ,"sinh");function aZ(r){return new this(r).sqrt()}o(aZ,"sqrt");function oZ(r,e){return new this(r).sub(e)}o(oZ,"sub");function uZ(){var r=0,e=arguments,t=new this(e[r]);for(_t=!1;t.s&&++r<e.length;)t=t.plus(e[r]);return _t=!0,mt(t,this.precision,this.rounding)}o(uZ,"sum");function cZ(r){return new this(r).tan()}o(cZ,"tan");function lZ(r){return new this(r).tanh()}o(lZ,"tanh");function fZ(r){return mt(r=new this(r),r.e+1,1)}o(fZ,"trunc");Oe[Symbol.for("nodejs.util.inspect.custom")]=Oe.toString;Oe[Symbol.toStringTag]="Decimal";var Ep=Oe.constructor=Zk(VN);Kw=new Ep(Kw);$w=new Ep($w);var Xl=class r extends Ep{static{o(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)}};var MN=class{static{o(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 $T=Cn(require("fs"),1),g8=Cn(require("path"),1),rf=Cn(require("crypto"),1),nf=Cn(m8(),1);var Wre=o(r=>!!r&&typeof r=="object"&&"message"in r,"hasMessageInRecord"),Mo=o(r=>typeof r=="string"?ks(new hn(r)):r instanceof Error?ks(new hn(r.message,{cause:r.cause})):Wre(r)?ks(new hn(r.message)):ks(new hn("unexpected error")),"leftFromError");var Og=class{static{o(this,"NullCacheAdapter")}async get(e){return Promise.resolve(null)}has(e){return Promise.resolve(!1)}set(e,t){return Promise.resolve(!0)}};var XT=class{static{o(this,"NativeCertificateRepository")}httpClient;cache;constructor(e,t=new Og){this.httpClient=e,this.cache=t}async read(e){try{let{password:t}=e,n=await this.getPfxBuffer(e);if(n.isLeft())return n;let s=nf.default.asn1.fromDer(n.value.toString("binary")),i=nf.default.pkcs12.pkcs12FromAsn1(s,t),{certBag:a,pkcs8ShroudedKeyBag:u}=nf.default.pki.oids,c=i.getBags({bagType:a}),f=i.getBags({bagType:u}),h=c[a];if(!h?.length)return ks(new hn("Cannot read certificate"));let[{cert:m},...g]=h;if(!m)return ks(new hn("Issuer Certificate not found"));let x=f[u]?.[0].key;if(!x)return ks(new hn("Certificate Private Key not found"));let v=g.reduce((b,{cert:E})=>(E&&b.push(new rf.default.X509Certificate(nf.default.pki.certificateToPem(E))),b),[]),w=nf.default.pki.privateKeyToPem(x),S=nf.default.pki.certificateToPem(m),A=rf.default.createPrivateKey(w),N=new rf.default.X509Certificate(S);return Ls({ca:v,password:t,privateKey:A,certificate:N})}catch(t){return Mo(t)}}async sign(e,t,n=ko.SHA1){try{let i=rf.default.sign(n,Buffer.from(e),{key:t,padding:rf.default.constants.RSA_PKCS1_PADDING}).toString("base64");return await Promise.resolve(Ls(i))}catch(s){return Promise.resolve(Mo(s))}}getCertificateInfo(e){return new Pg().extractCertificateInfo(e)}getStringCertificate(e){return e.raw.toString("base64")}getStringPrivateKey(e){try{return e.export({type:"pkcs8",format:"pem"}).toString()}catch{throw new hn("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 Ls(i);if(g8.default.isAbsolute(t)||$T.default.existsSync(t))return this.hitBufferOnCache(s,$T.default.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 Mo(a)}return this.hitBufferOnCache(s,Buffer.from(t,"base64"))}getCacheKey(e,t){return rf.default.createHash("sha256").update(`${e}.${t}`).digest("hex")}async hitBufferOnCache(e,t){return await this.cache.set(e,t),Ls(t)}isValidRemoteUrl(e){try{return new URL(e),!0}catch{return!1}}};var A9=require("crypto"),GB=require("https"),C9=Cn(E9(),1);var WB=class{static{o(this,"SoapRemoteTransmissionRepository")}toolkit;certificateRepository;constructor(e,t){this.toolkit=e,this.certificateRepository=t}setCertificate(e){return this.certificate=e,this}get httpsAgent(){let e={rejectUnauthorized:!1,secureOptions:A9.constants.SSL_OP_LEGACY_SERVER_CONNECT};if(!this.certificate)return new GB.Agent({...e});let{ca:t,password:n,certificate:s,privateKey:i}=this.certificate;return new GB.Agent({passphrase:n,cert:s.toString(),ca:t.map(a=>a.toString()),key:this.certificateRepository.getStringPrivateKey(i),...e})}get defaultSoapHeaders(){return{"Content-Type":"application/soap+xml; charset=utf-8"}}async send(e){try{let t=this.httpsAgent,n=await(0,C9.createClientAsync)(`${e.url}?wsdl`,{attributesKey:"$",wsdl_options:{httpsAgent:t}});e.payload.$={xmlns:n.wsdl.definitions.$targetNamespace,...e.payload.$};let s=await this.toolkit.build(e.payload,{headless:!0,renderOpts:{pretty:!1},rootName:e.root}),i=this.toolkit.getFirstNode(s)??"",a=e.xsd,u=await this.toolkit.validate(i,a);if(u.isLeft())return u;let[c]=await n[`${e.method}Async`]({_xml:s},{httpsAgent:t});return Ls(c)}catch(t){return Mo(t)}}};var iE=require("os"),Ki=require("path"),_v=require("fs");var JB=require("path"),zB=require("module"),sE=require("url");var bpe=typeof jest<"u"||process.env.JEST_WORKER_ID!==void 0,wd,N9=o(()=>{if(wd!==void 0)return wd;if(bpe){wd=void 0;return}try{wd=new Function("try { return import.meta.url; } catch { return undefined; }")()}catch{wd=void 0}return wd},"getImportMetaUrl"),T9=o(()=>{if(typeof require<"u")return require;let r=N9();if(r)return(0,zB.createRequire)(r);let e=(0,sE.pathToFileURL)((0,JB.resolve)(process.cwd(),"package.json")).href;return(0,zB.createRequire)(e)},"getRequireFn"),I9=o(()=>{if(typeof __filename<"u")return __filename;let r=N9();return r?(0,sE.fileURLToPath)(r):(0,JB.resolve)(process.cwd())},"getCurrentFile");var Iv=o(r=>T9()(r),"exportRequireModule"),_9=o(r=>{if(r=`${r}-${(0,iE.platform)()}-${(0,iE.arch)()}.node`,process.env.NFETS_ADDONS_DIR)return Iv((0,Ki.join)(process.env.NFETS_ADDONS_DIR,r));let e=I9(),t=(0,Ki.resolve)(e,"../../../../"),n=(0,Ki.join)(t,"build","addons",r);if((0,_v.existsSync)(n))return Iv(n);let s=e;for(let i=0;i<5;i++){let a=(0,Ki.join)(s,"build","addons",r);if((0,_v.existsSync)(a))return Iv(a);let u=(0,Ki.dirname)(s);if(u===s)break;s=u}s=e;for(let i=0;i<5;i++){let a=(0,Ki.join)(s,"build","Release",r);if((0,_v.existsSync)(a))return Iv(a);let u=(0,Ki.dirname)(s);if(u===s)break;s=u}s=e;for(let i=0;i<5;i++){let a=(0,Ki.join)(s,"node_modules","nfets","build","addons",r);if((0,_v.existsSync)(a))return Iv(a);let u=(0,Ki.dirname)(s);if(u===s)break;s=u}throw new Error(`Addon ${r} not found`)},"addon");var Epe=_9("xml_validator"),B9=Epe;var MK=Cn(require("crypto"),1),yge=Cn(Qq(),1);var Zq="application/xml";var jt;(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"})(jt||(jt={}));function Ape(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}o(Ape,"SelectNodesEx");function Cpe(r,e){let t=Sd("xpath").select;return t(e,r)}o(Cpe,"SelectNodesNode");var e7=typeof self<"u"?Ape:Cpe;function $i(r){r=r.replace(/\r\n/g,`
89
+ `,E.offset=(M=b.offset)!=null?M:0,E.dontPrettyTextNodes=(R=(q=b.dontPrettyTextNodes)!=null?q:b.dontprettytextnodes)!=null?R:0,E.spaceBeforeSlash=(H=(K=b.spaceBeforeSlash)!=null?K:b.spacebeforeslash)!=null?H:"",E.spaceBeforeSlash===!0&&(E.spaceBeforeSlash=" "),E.suppressPrettyCount=0,E.user={},E.state=e.None,E},N.prototype.indent=function(b,E,C){var _;return!E.pretty||E.suppressPrettyCount?"":E.pretty&&(_=(C||0)+E.offset+1,_>0)?new Array(_).join(E.indent):""},N.prototype.endline=function(b,E,C){return!E.pretty||E.suppressPrettyCount?"":E.newline},N.prototype.attribute=function(b,E,C){var _;return this.openAttribute(b,E,C),_=" "+b.name+'="'+b.value+'"',this.closeAttribute(b,E,C),_},N.prototype.cdata=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C)+"<![CDATA[",E.state=e.InsideTag,_+=b.value,E.state=e.CloseTag,_+="]]>"+this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},N.prototype.comment=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C)+"<!-- ",E.state=e.InsideTag,_+=b.value,E.state=e.CloseTag,_+=" -->"+this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},N.prototype.declaration=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C)+"<?xml",E.state=e.InsideTag,_+=' version="'+b.version+'"',b.encoding!=null&&(_+=' encoding="'+b.encoding+'"'),b.standalone!=null&&(_+=' standalone="'+b.standalone+'"'),E.state=e.CloseTag,_+=E.spaceBeforeSlash+"?>",_+=this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},N.prototype.docType=function(b,E,C){var _,M,R,q,H;if(C||(C=0),this.openNode(b,E,C),E.state=e.OpenTag,q=this.indent(b,E,C),q+="<!DOCTYPE "+b.root().name,b.pubID&&b.sysID?q+=' PUBLIC "'+b.pubID+'" "'+b.sysID+'"':b.sysID&&(q+=' SYSTEM "'+b.sysID+'"'),b.children.length>0){for(q+=" [",q+=this.endline(b,E,C),E.state=e.InsideTag,H=b.children,M=0,R=H.length;M<R;M++)_=H[M],q+=this.writeChildNode(_,E,C+1);E.state=e.CloseTag,q+="]"}return E.state=e.CloseTag,q+=E.spaceBeforeSlash+">",q+=this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),q},N.prototype.element=function(b,E,C){var _,M,R,q,H,K,G,pe,le,ue,ee,he,we,Ke;C||(C=0),ue=!1,ee="",this.openNode(b,E,C),E.state=e.OpenTag,ee+=this.indent(b,E,C)+"<"+b.name,he=b.attribs;for(le in he)A.call(he,le)&&(_=he[le],ee+=this.attribute(_,E,C));if(R=b.children.length,q=R===0?null:b.children[0],R===0||b.children.every(function(Ae){return(Ae.type===r.Text||Ae.type===r.Raw)&&Ae.value===""}))E.allowEmpty?(ee+=">",E.state=e.CloseTag,ee+="</"+b.name+">"+this.endline(b,E,C)):(E.state=e.CloseTag,ee+=E.spaceBeforeSlash+"/>"+this.endline(b,E,C));else if(E.pretty&&R===1&&(q.type===r.Text||q.type===r.Raw)&&q.value!=null)ee+=">",E.state=e.InsideTag,E.suppressPrettyCount++,ue=!0,ee+=this.writeChildNode(q,E,C+1),E.suppressPrettyCount--,ue=!1,E.state=e.CloseTag,ee+="</"+b.name+">"+this.endline(b,E,C);else{if(E.dontPrettyTextNodes){for(we=b.children,H=0,G=we.length;H<G;H++)if(M=we[H],(M.type===r.Text||M.type===r.Raw)&&M.value!=null){E.suppressPrettyCount++,ue=!0;break}}for(ee+=">"+this.endline(b,E,C),E.state=e.InsideTag,Ke=b.children,K=0,pe=Ke.length;K<pe;K++)M=Ke[K],ee+=this.writeChildNode(M,E,C+1);E.state=e.CloseTag,ee+=this.indent(b,E,C)+"</"+b.name+">",ue&&E.suppressPrettyCount--,ee+=this.endline(b,E,C),E.state=e.None}return this.closeNode(b,E,C),ee},N.prototype.writeChildNode=function(b,E,C){switch(b.type){case r.CData:return this.cdata(b,E,C);case r.Comment:return this.comment(b,E,C);case r.Element:return this.element(b,E,C);case r.Raw:return this.raw(b,E,C);case r.Text:return this.text(b,E,C);case r.ProcessingInstruction:return this.processingInstruction(b,E,C);case r.Dummy:return"";case r.Declaration:return this.declaration(b,E,C);case r.DocType:return this.docType(b,E,C);case r.AttributeDeclaration:return this.dtdAttList(b,E,C);case r.ElementDeclaration:return this.dtdElement(b,E,C);case r.EntityDeclaration:return this.dtdEntity(b,E,C);case r.NotationDeclaration:return this.dtdNotation(b,E,C);default:throw new Error("Unknown XML node type: "+b.constructor.name)}},N.prototype.processingInstruction=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C)+"<?",E.state=e.InsideTag,_+=b.target,b.value&&(_+=" "+b.value),E.state=e.CloseTag,_+=E.spaceBeforeSlash+"?>",_+=this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},N.prototype.raw=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C),E.state=e.InsideTag,_+=b.value,E.state=e.CloseTag,_+=this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},N.prototype.text=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C),E.state=e.InsideTag,_+=b.value,E.state=e.CloseTag,_+=this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},N.prototype.dtdAttList=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C)+"<!ATTLIST",E.state=e.InsideTag,_+=" "+b.elementName+" "+b.attributeName+" "+b.attributeType,b.defaultValueType!=="#DEFAULT"&&(_+=" "+b.defaultValueType),b.defaultValue&&(_+=' "'+b.defaultValue+'"'),E.state=e.CloseTag,_+=E.spaceBeforeSlash+">"+this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},N.prototype.dtdElement=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C)+"<!ELEMENT",E.state=e.InsideTag,_+=" "+b.name+" "+b.value,E.state=e.CloseTag,_+=E.spaceBeforeSlash+">"+this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},N.prototype.dtdEntity=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C)+"<!ENTITY",E.state=e.InsideTag,b.pe&&(_+=" %"),_+=" "+b.name,b.value?_+=' "'+b.value+'"':(b.pubID&&b.sysID?_+=' PUBLIC "'+b.pubID+'" "'+b.sysID+'"':b.sysID&&(_+=' SYSTEM "'+b.sysID+'"'),b.nData&&(_+=" NDATA "+b.nData)),E.state=e.CloseTag,_+=E.spaceBeforeSlash+">"+this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},N.prototype.dtdNotation=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C)+"<!NOTATION",E.state=e.InsideTag,_+=" "+b.name,b.pubID&&b.sysID?_+=' PUBLIC "'+b.pubID+'" "'+b.sysID+'"':b.pubID?_+=' PUBLIC "'+b.pubID+'"':b.sysID&&(_+=' SYSTEM "'+b.sysID+'"'),E.state=e.CloseTag,_+=E.spaceBeforeSlash+">"+this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},N.prototype.openNode=function(b,E,C){},N.prototype.closeNode=function(b,E,C){},N.prototype.openAttribute=function(b,E,C){},N.prototype.closeAttribute=function(b,E,C){},N})()}).call(kq)});var wE=Q((Vq,Uq)=>{"use strict";(function(){var r,e,t=o(function(s,i){for(var a in i)n.call(i,a)&&(s[a]=i[a]);function u(){this.constructor=s}return o(u,"ctor"),u.prototype=i.prototype,s.prototype=new u,s.__super__=i.prototype,s},"extend"),n={}.hasOwnProperty;e=rD(),Uq.exports=r=(function(s){t(i,s);function i(a){i.__super__.constructor.call(this,a)}return o(i,"XMLStringWriter"),i.prototype.document=function(a,u){var c,f,h,m,g;for(u=this.filterOptions(u),m="",g=a.children,f=0,h=g.length;f<h;f++)c=g[f],m+=this.writeChildNode(c,u,0);return u.pretty&&m.slice(-u.newline.length)===u.newline&&(m=m.slice(0,-u.newline.length)),m},i})(e)}).call(Vq)});var nD=Q((jq,Fq)=>{"use strict";(function(){var r,e,t,n,s,i,a,u,c=o(function(h,m){for(var g in m)f.call(m,g)&&(h[g]=m[g]);function x(){this.constructor=h}return o(x,"ctor"),x.prototype=m.prototype,h.prototype=new x,h.__super__=m.prototype,h},"extend"),f={}.hasOwnProperty;u=uo().isPlainObject,t=QB(),e=q9(),s=di(),r=mn(),a=tD(),i=wE(),Fq.exports=n=(function(h){c(m,h);function m(g){m.__super__.constructor.call(this,null),this.name="#document",this.type=r.Document,this.documentURI=null,this.domConfig=new e,g||(g={}),g.writer||(g.writer=new i),this.options=g,this.stringify=new a(g)}return o(m,"XMLDocument"),Object.defineProperty(m.prototype,"implementation",{value:new t}),Object.defineProperty(m.prototype,"doctype",{get:o(function(){var g,x,v,w;for(w=this.children,x=0,v=w.length;x<v;x++)if(g=w[x],g.type===r.DocType)return g;return null},"get")}),Object.defineProperty(m.prototype,"documentElement",{get:o(function(){return this.rootObject||null},"get")}),Object.defineProperty(m.prototype,"inputEncoding",{get:o(function(){return null},"get")}),Object.defineProperty(m.prototype,"strictErrorChecking",{get:o(function(){return!1},"get")}),Object.defineProperty(m.prototype,"xmlEncoding",{get:o(function(){return this.children.length!==0&&this.children[0].type===r.Declaration?this.children[0].encoding:null},"get")}),Object.defineProperty(m.prototype,"xmlStandalone",{get:o(function(){return this.children.length!==0&&this.children[0].type===r.Declaration?this.children[0].standalone==="yes":!1},"get")}),Object.defineProperty(m.prototype,"xmlVersion",{get:o(function(){return this.children.length!==0&&this.children[0].type===r.Declaration?this.children[0].version:"1.0"},"get")}),Object.defineProperty(m.prototype,"URL",{get:o(function(){return this.documentURI},"get")}),Object.defineProperty(m.prototype,"origin",{get:o(function(){return null},"get")}),Object.defineProperty(m.prototype,"compatMode",{get:o(function(){return null},"get")}),Object.defineProperty(m.prototype,"characterSet",{get:o(function(){return null},"get")}),Object.defineProperty(m.prototype,"contentType",{get:o(function(){return null},"get")}),m.prototype.end=function(g){var x;return x={},g?u(g)&&(x=g,g=this.options.writer):g=this.options.writer,g.document(this,g.filterOptions(x))},m.prototype.toString=function(g){return this.options.writer.document(this,this.options.writer.filterOptions(g))},m.prototype.createElement=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createDocumentFragment=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createTextNode=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createComment=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createCDATASection=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createProcessingInstruction=function(g,x){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createAttribute=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createEntityReference=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getElementsByTagName=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.importNode=function(g,x){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createElementNS=function(g,x){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createAttributeNS=function(g,x){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getElementsByTagNameNS=function(g,x){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getElementById=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.adoptNode=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.normalizeDocument=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.renameNode=function(g,x,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getElementsByClassName=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createEvent=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createRange=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createNodeIterator=function(g,x,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createTreeWalker=function(g,x,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},m})(s)}).call(jq)});var Hq=Q((Mq,qq)=>{"use strict";(function(){var r,e,t,n,s,i,a,u,c,f,h,m,g,x,v,w,S,A,N,b,E,C,_,M,R={}.hasOwnProperty;M=uo(),C=M.isObject,E=M.isFunction,_=M.isPlainObject,b=M.getValue,r=mn(),m=nD(),x=uE(),n=cE(),s=lE(),w=vE(),N=yE(),v=xE(),f=fE(),h=gE(),i=hE(),u=pE(),a=dE(),c=mE(),t=ZB(),A=tD(),S=wE(),e=Dv(),qq.exports=g=(function(){function q(H,K,G){var pe;this.name="?xml",this.type=r.Document,H||(H={}),pe={},H.writer?_(H.writer)&&(pe=H.writer,H.writer=new S):H.writer=new S,this.options=H,this.writer=H.writer,this.writerOptions=this.writer.filterOptions(pe),this.stringify=new A(H),this.onDataCallback=K||function(){},this.onEndCallback=G||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return o(q,"XMLDocumentCB"),q.prototype.createChildNode=function(H){var K,G,pe,le,ue,ee,he,we;switch(H.type){case r.CData:this.cdata(H.value);break;case r.Comment:this.comment(H.value);break;case r.Element:pe={},he=H.attribs;for(G in he)R.call(he,G)&&(K=he[G],pe[G]=K.value);this.node(H.name,pe);break;case r.Dummy:this.dummy();break;case r.Raw:this.raw(H.value);break;case r.Text:this.text(H.value);break;case r.ProcessingInstruction:this.instruction(H.target,H.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+H.constructor.name)}for(we=H.children,ue=0,ee=we.length;ue<ee;ue++)le=we[ue],this.createChildNode(le),le.type===r.Element&&this.up();return this},q.prototype.dummy=function(){return this},q.prototype.node=function(H,K,G){var pe;if(H==null)throw new Error("Missing node name.");if(this.root&&this.currentLevel===-1)throw new Error("Document can only have one root node. "+this.debugInfo(H));return this.openCurrent(),H=b(H),K==null&&(K={}),K=b(K),C(K)||(pe=[K,G],G=pe[0],K=pe[1]),this.currentNode=new x(this,H,K),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,G!=null&&this.text(G),this},q.prototype.element=function(H,K,G){var pe,le,ue,ee,he,we;if(this.currentNode&&this.currentNode.type===r.DocType)this.dtdElement.apply(this,arguments);else if(Array.isArray(H)||C(H)||E(H))for(ee=this.options.noValidation,this.options.noValidation=!0,we=new m(this.options).element("TEMP_ROOT"),we.element(H),this.options.noValidation=ee,he=we.children,le=0,ue=he.length;le<ue;le++)pe=he[le],this.createChildNode(pe),pe.type===r.Element&&this.up();else this.node(H,K,G);return this},q.prototype.attribute=function(H,K){var G,pe;if(!this.currentNode||this.currentNode.children)throw new Error("att() can only be used immediately after an ele() call in callback mode. "+this.debugInfo(H));if(H!=null&&(H=b(H)),C(H))for(G in H)R.call(H,G)&&(pe=H[G],this.attribute(G,pe));else E(K)&&(K=K.apply()),this.options.keepNullAttributes&&K==null?this.currentNode.attribs[H]=new t(this,H,""):K!=null&&(this.currentNode.attribs[H]=new t(this,H,K));return this},q.prototype.text=function(H){var K;return this.openCurrent(),K=new N(this,H),this.onData(this.writer.text(K,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.cdata=function(H){var K;return this.openCurrent(),K=new n(this,H),this.onData(this.writer.cdata(K,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.comment=function(H){var K;return this.openCurrent(),K=new s(this,H),this.onData(this.writer.comment(K,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.raw=function(H){var K;return this.openCurrent(),K=new w(this,H),this.onData(this.writer.raw(K,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.instruction=function(H,K){var G,pe,le,ue,ee;if(this.openCurrent(),H!=null&&(H=b(H)),K!=null&&(K=b(K)),Array.isArray(H))for(G=0,ue=H.length;G<ue;G++)pe=H[G],this.instruction(pe);else if(C(H))for(pe in H)R.call(H,pe)&&(le=H[pe],this.instruction(pe,le));else E(K)&&(K=K.apply()),ee=new v(this,H,K),this.onData(this.writer.processingInstruction(ee,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this},q.prototype.declaration=function(H,K,G){var pe;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return pe=new f(this,H,K,G),this.onData(this.writer.declaration(pe,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.doctype=function(H,K,G){if(this.openCurrent(),H==null)throw new Error("Missing root node name.");if(this.root)throw new Error("dtd() must come before the root node.");return this.currentNode=new h(this,K,G),this.currentNode.rootNodeName=H,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},q.prototype.dtdElement=function(H,K){var G;return this.openCurrent(),G=new a(this,H,K),this.onData(this.writer.dtdElement(G,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.attList=function(H,K,G,pe,le){var ue;return this.openCurrent(),ue=new i(this,H,K,G,pe,le),this.onData(this.writer.dtdAttList(ue,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.entity=function(H,K){var G;return this.openCurrent(),G=new u(this,!1,H,K),this.onData(this.writer.dtdEntity(G,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.pEntity=function(H,K){var G;return this.openCurrent(),G=new u(this,!0,H,K),this.onData(this.writer.dtdEntity(G,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.notation=function(H,K){var G;return this.openCurrent(),G=new c(this,H,K),this.onData(this.writer.dtdNotation(G,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.up=function(){if(this.currentLevel<0)throw new Error("The document node has no parent.");return this.currentNode?(this.currentNode.children?this.closeNode(this.currentNode):this.openNode(this.currentNode),this.currentNode=null):this.closeNode(this.openTags[this.currentLevel]),delete this.openTags[this.currentLevel],this.currentLevel--,this},q.prototype.end=function(){for(;this.currentLevel>=0;)this.up();return this.onEnd()},q.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},q.prototype.openNode=function(H){var K,G,pe,le;if(!H.isOpen){if(!this.root&&this.currentLevel===0&&H.type===r.Element&&(this.root=H),G="",H.type===r.Element){this.writerOptions.state=e.OpenTag,G=this.writer.indent(H,this.writerOptions,this.currentLevel)+"<"+H.name,le=H.attribs;for(pe in le)R.call(le,pe)&&(K=le[pe],G+=this.writer.attribute(K,this.writerOptions,this.currentLevel));G+=(H.children?">":"/>")+this.writer.endline(H,this.writerOptions,this.currentLevel),this.writerOptions.state=e.InsideTag}else this.writerOptions.state=e.OpenTag,G=this.writer.indent(H,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+H.rootNodeName,H.pubID&&H.sysID?G+=' PUBLIC "'+H.pubID+'" "'+H.sysID+'"':H.sysID&&(G+=' SYSTEM "'+H.sysID+'"'),H.children?(G+=" [",this.writerOptions.state=e.InsideTag):(this.writerOptions.state=e.CloseTag,G+=">"),G+=this.writer.endline(H,this.writerOptions,this.currentLevel);return this.onData(G,this.currentLevel),H.isOpen=!0}},q.prototype.closeNode=function(H){var K;if(!H.isClosed)return K="",this.writerOptions.state=e.CloseTag,H.type===r.Element?K=this.writer.indent(H,this.writerOptions,this.currentLevel)+"</"+H.name+">"+this.writer.endline(H,this.writerOptions,this.currentLevel):K=this.writer.indent(H,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(H,this.writerOptions,this.currentLevel),this.writerOptions.state=e.None,this.onData(K,this.currentLevel),H.isClosed=!0},q.prototype.onData=function(H,K){return this.documentStarted=!0,this.onDataCallback(H,K+1)},q.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},q.prototype.debugInfo=function(H){return H==null?"":"node: <"+H+">"},q.prototype.ele=function(){return this.element.apply(this,arguments)},q.prototype.nod=function(H,K,G){return this.node(H,K,G)},q.prototype.txt=function(H){return this.text(H)},q.prototype.dat=function(H){return this.cdata(H)},q.prototype.com=function(H){return this.comment(H)},q.prototype.ins=function(H,K){return this.instruction(H,K)},q.prototype.dec=function(H,K,G){return this.declaration(H,K,G)},q.prototype.dtd=function(H,K,G){return this.doctype(H,K,G)},q.prototype.e=function(H,K,G){return this.element(H,K,G)},q.prototype.n=function(H,K,G){return this.node(H,K,G)},q.prototype.t=function(H){return this.text(H)},q.prototype.d=function(H){return this.cdata(H)},q.prototype.c=function(H){return this.comment(H)},q.prototype.r=function(H){return this.raw(H)},q.prototype.i=function(H,K){return this.instruction(H,K)},q.prototype.att=function(){return this.currentNode&&this.currentNode.type===r.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},q.prototype.a=function(){return this.currentNode&&this.currentNode.type===r.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},q.prototype.ent=function(H,K){return this.entity(H,K)},q.prototype.pent=function(H,K){return this.pEntity(H,K)},q.prototype.not=function(H,K){return this.notation(H,K)},q})()}).call(Mq)});var Xq=Q((Kq,$q)=>{"use strict";(function(){var r,e,t,n,s=o(function(a,u){for(var c in u)i.call(u,c)&&(a[c]=u[c]);function f(){this.constructor=a}return o(f,"ctor"),f.prototype=u.prototype,a.prototype=new f,a.__super__=u.prototype,a},"extend"),i={}.hasOwnProperty;r=mn(),n=rD(),e=Dv(),$q.exports=t=(function(a){s(u,a);function u(c,f){this.stream=c,u.__super__.constructor.call(this,f)}return o(u,"XMLStreamWriter"),u.prototype.endline=function(c,f,h){return c.isLastRootNode&&f.state===e.CloseTag?"":u.__super__.endline.call(this,c,f,h)},u.prototype.document=function(c,f){var h,m,g,x,v,w,S,A,N;for(S=c.children,m=g=0,v=S.length;g<v;m=++g)h=S[m],h.isLastRootNode=m===c.children.length-1;for(f=this.filterOptions(f),A=c.children,N=[],x=0,w=A.length;x<w;x++)h=A[x],N.push(this.writeChildNode(h,f,0));return N},u.prototype.attribute=function(c,f,h){return this.stream.write(u.__super__.attribute.call(this,c,f,h))},u.prototype.cdata=function(c,f,h){return this.stream.write(u.__super__.cdata.call(this,c,f,h))},u.prototype.comment=function(c,f,h){return this.stream.write(u.__super__.comment.call(this,c,f,h))},u.prototype.declaration=function(c,f,h){return this.stream.write(u.__super__.declaration.call(this,c,f,h))},u.prototype.docType=function(c,f,h){var m,g,x,v;if(h||(h=0),this.openNode(c,f,h),f.state=e.OpenTag,this.stream.write(this.indent(c,f,h)),this.stream.write("<!DOCTYPE "+c.root().name),c.pubID&&c.sysID?this.stream.write(' PUBLIC "'+c.pubID+'" "'+c.sysID+'"'):c.sysID&&this.stream.write(' SYSTEM "'+c.sysID+'"'),c.children.length>0){for(this.stream.write(" ["),this.stream.write(this.endline(c,f,h)),f.state=e.InsideTag,v=c.children,g=0,x=v.length;g<x;g++)m=v[g],this.writeChildNode(m,f,h+1);f.state=e.CloseTag,this.stream.write("]")}return f.state=e.CloseTag,this.stream.write(f.spaceBeforeSlash+">"),this.stream.write(this.endline(c,f,h)),f.state=e.None,this.closeNode(c,f,h)},u.prototype.element=function(c,f,h){var m,g,x,v,w,S,A,N,b,E;h||(h=0),this.openNode(c,f,h),f.state=e.OpenTag,this.stream.write(this.indent(c,f,h)+"<"+c.name),b=c.attribs;for(A in b)i.call(b,A)&&(m=b[A],this.attribute(m,f,h));if(x=c.children.length,v=x===0?null:c.children[0],x===0||c.children.every(function(C){return(C.type===r.Text||C.type===r.Raw)&&C.value===""}))f.allowEmpty?(this.stream.write(">"),f.state=e.CloseTag,this.stream.write("</"+c.name+">")):(f.state=e.CloseTag,this.stream.write(f.spaceBeforeSlash+"/>"));else if(f.pretty&&x===1&&(v.type===r.Text||v.type===r.Raw)&&v.value!=null)this.stream.write(">"),f.state=e.InsideTag,f.suppressPrettyCount++,N=!0,this.writeChildNode(v,f,h+1),f.suppressPrettyCount--,N=!1,f.state=e.CloseTag,this.stream.write("</"+c.name+">");else{for(this.stream.write(">"+this.endline(c,f,h)),f.state=e.InsideTag,E=c.children,w=0,S=E.length;w<S;w++)g=E[w],this.writeChildNode(g,f,h+1);f.state=e.CloseTag,this.stream.write(this.indent(c,f,h)+"</"+c.name+">")}return this.stream.write(this.endline(c,f,h)),f.state=e.None,this.closeNode(c,f,h)},u.prototype.processingInstruction=function(c,f,h){return this.stream.write(u.__super__.processingInstruction.call(this,c,f,h))},u.prototype.raw=function(c,f,h){return this.stream.write(u.__super__.raw.call(this,c,f,h))},u.prototype.text=function(c,f,h){return this.stream.write(u.__super__.text.call(this,c,f,h))},u.prototype.dtdAttList=function(c,f,h){return this.stream.write(u.__super__.dtdAttList.call(this,c,f,h))},u.prototype.dtdElement=function(c,f,h){return this.stream.write(u.__super__.dtdElement.call(this,c,f,h))},u.prototype.dtdEntity=function(c,f,h){return this.stream.write(u.__super__.dtdEntity.call(this,c,f,h))},u.prototype.dtdNotation=function(c,f,h){return this.stream.write(u.__super__.dtdNotation.call(this,c,f,h))},u})(n)}).call(Kq)});var Wq=Q((Gq,Nc)=>{"use strict";(function(){var r,e,t,n,s,i,a,u,c,f;f=uo(),u=f.assign,c=f.isFunction,t=QB(),n=nD(),s=Hq(),a=wE(),i=Xq(),r=mn(),e=Dv(),Nc.exports.create=function(h,m,g,x){var v,w;if(h==null)throw new Error("Root element needs a name.");return x=u({},m,g,x),v=new n(x),w=v.element(h),x.headless||(v.declaration(x),(x.pubID!=null||x.sysID!=null)&&v.dtd(x)),w},Nc.exports.begin=function(h,m,g){var x;return c(h)&&(x=[h,m],m=x[0],g=x[1],h={}),m?new s(h,m,g):new n(h)},Nc.exports.stringWriter=function(h){return new a(h)},Nc.exports.streamWriter=function(h,m){return new i(h,m)},Nc.exports.implementation=new t,Nc.exports.nodeType=r,Nc.exports.writerState=e}).call(Gq)});var zq=Q(sD=>{"use strict";(function(){"use strict";var r,e,t,n,s,i={}.hasOwnProperty;r=Wq(),e=aE().defaults,n=o(function(a){return typeof a=="string"&&(a.indexOf("&")>=0||a.indexOf(">")>=0||a.indexOf("<")>=0)},"requiresCDATA"),s=o(function(a){return"<![CDATA["+t(a)+"]]>"},"wrapCDATA"),t=o(function(a){return a.replace("]]>","]]]]><![CDATA[>")},"escapeCDATA"),sD.Builder=(function(){function a(u){var c,f,h;this.options={},f=e["0.2"];for(c in f)i.call(f,c)&&(h=f[c],this.options[c]=h);for(c in u)i.call(u,c)&&(h=u[c],this.options[c]=h)}return o(a,"Builder"),a.prototype.buildObject=function(u){var c,f,h,m,g;return c=this.options.attrkey,f=this.options.charkey,Object.keys(u).length===1&&this.options.rootName===e["0.2"].rootName?(g=Object.keys(u)[0],u=u[g]):g=this.options.rootName,h=(function(x){return function(v,w){var S,A,N,b,E,C;if(typeof w!="object")x.options.cdata&&n(w)?v.raw(s(w)):v.txt(w);else if(Array.isArray(w)){for(b in w)if(i.call(w,b)){A=w[b];for(E in A)N=A[E],v=h(v.ele(E),N).up()}}else for(E in w)if(i.call(w,E))if(A=w[E],E===c){if(typeof A=="object")for(S in A)C=A[S],v=v.att(S,C)}else if(E===f)x.options.cdata&&n(A)?v=v.raw(s(A)):v=v.txt(A);else if(Array.isArray(A))for(b in A)i.call(A,b)&&(N=A[b],typeof N=="string"?x.options.cdata&&n(N)?v=v.ele(E).raw(s(N)).up():v=v.ele(E,N).up():v=h(v.ele(E),N).up());else typeof A=="object"?v=h(v.ele(E),A).up():typeof A=="string"&&x.options.cdata&&n(A)?v=v.ele(E).raw(s(A)).up():(A==null&&(A=""),v=v.ele(E,A.toString()).up());return v}})(this),m=r.create(g,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),h(m,u).end(this.options.renderOpts)},a})()}).call(sD)});var Jq=Q(iD=>{"use strict";(function(){"use strict";iD.stripBOM=function(r){return r[0]==="\uFEFF"?r.substring(1):r}}).call(iD)});var aD=Q(yf=>{"use strict";(function(){"use strict";var r;r=new RegExp(/(?!xmlns)^.*:/),yf.normalize=function(e){return e.toLowerCase()},yf.firstCharLowerCase=function(e){return e.charAt(0).toLowerCase()+e.slice(1)},yf.stripPrefix=function(e){return e.replace(r,"")},yf.parseNumbers=function(e){return isNaN(e)||(e=e%1===0?parseInt(e,10):parseFloat(e)),e},yf.parseBooleans=function(e){return/^(?:true|false)$/i.test(e)&&(e=e.toLowerCase()==="true"),e}}).call(yf)});var Yq=Q(Jo=>{"use strict";(function(){"use strict";var r,e,t,n,s,i,a,u,c,f=o(function(g,x){return function(){return g.apply(x,arguments)}},"bind"),h=o(function(g,x){for(var v in x)m.call(x,v)&&(g[v]=x[v]);function w(){this.constructor=g}return o(w,"ctor"),w.prototype=x.prototype,g.prototype=new w,g.__super__=x.prototype,g},"extend"),m={}.hasOwnProperty;u=BB(),n=require("events"),r=Jq(),a=aD(),c=require("timers").setImmediate,e=aE().defaults,s=o(function(g){return typeof g=="object"&&g!=null&&Object.keys(g).length===0},"isEmpty"),i=o(function(g,x,v){var w,S,A;for(w=0,S=g.length;w<S;w++)A=g[w],x=A(x,v);return x},"processItem"),t=o(function(g,x,v){var w;return w=Object.create(null),w.value=v,w.writable=!0,w.enumerable=!0,w.configurable=!0,Object.defineProperty(g,x,w)},"defineProperty"),Jo.Parser=(function(g){h(x,g);function x(v){this.parseStringPromise=f(this.parseStringPromise,this),this.parseString=f(this.parseString,this),this.reset=f(this.reset,this),this.assignOrPush=f(this.assignOrPush,this),this.processAsync=f(this.processAsync,this);var w,S,A;if(!(this instanceof Jo.Parser))return new Jo.Parser(v);this.options={},S=e["0.2"];for(w in S)m.call(S,w)&&(A=S[w],this.options[w]=A);for(w in v)m.call(v,w)&&(A=v[w],this.options[w]=A);this.options.xmlns&&(this.options.xmlnskey=this.options.attrkey+"ns"),this.options.normalizeTags&&(this.options.tagNameProcessors||(this.options.tagNameProcessors=[]),this.options.tagNameProcessors.unshift(a.normalize)),this.reset()}return o(x,"Parser"),x.prototype.processAsync=function(){var v,w;try{return this.remaining.length<=this.options.chunkSize?(v=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(v),this.saxParser.close()):(v=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(v),c(this.processAsync))}catch(S){if(w=S,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(w)}},x.prototype.assignOrPush=function(v,w,S){return w in v?(v[w]instanceof Array||t(v,w,[v[w]]),v[w].push(S)):this.options.explicitArray?t(v,w,[S]):t(v,w,S)},x.prototype.reset=function(){var v,w,S,A;return this.removeAllListeners(),this.saxParser=u.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=(function(N){return function(b){if(N.saxParser.resume(),!N.saxParser.errThrown)return N.saxParser.errThrown=!0,N.emit("error",b)}})(this),this.saxParser.onend=(function(N){return function(){if(!N.saxParser.ended)return N.saxParser.ended=!0,N.emit("end",N.resultObject)}})(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,A=[],v=this.options.attrkey,w=this.options.charkey,this.saxParser.onopentag=(function(N){return function(b){var E,C,_,M,R;if(_={},_[w]="",!N.options.ignoreAttrs){R=b.attributes;for(E in R)m.call(R,E)&&(!(v in _)&&!N.options.mergeAttrs&&(_[v]={}),C=N.options.attrValueProcessors?i(N.options.attrValueProcessors,b.attributes[E],E):b.attributes[E],M=N.options.attrNameProcessors?i(N.options.attrNameProcessors,E):E,N.options.mergeAttrs?N.assignOrPush(_,M,C):t(_[v],M,C))}return _["#name"]=N.options.tagNameProcessors?i(N.options.tagNameProcessors,b.name):b.name,N.options.xmlns&&(_[N.options.xmlnskey]={uri:b.uri,local:b.local}),A.push(_)}})(this),this.saxParser.onclosetag=(function(N){return function(){var b,E,C,_,M,R,q,H,K,G;if(R=A.pop(),M=R["#name"],(!N.options.explicitChildren||!N.options.preserveChildrenOrder)&&delete R["#name"],R.cdata===!0&&(b=R.cdata,delete R.cdata),K=A[A.length-1],R[w].match(/^\s*$/)&&!b?(E=R[w],delete R[w]):(N.options.trim&&(R[w]=R[w].trim()),N.options.normalize&&(R[w]=R[w].replace(/\s{2,}/g," ").trim()),R[w]=N.options.valueProcessors?i(N.options.valueProcessors,R[w],M):R[w],Object.keys(R).length===1&&w in R&&!N.EXPLICIT_CHARKEY&&(R=R[w])),s(R)&&(typeof N.options.emptyTag=="function"?R=N.options.emptyTag():R=N.options.emptyTag!==""?N.options.emptyTag:E),N.options.validator!=null&&(G="/"+(function(){var pe,le,ue;for(ue=[],pe=0,le=A.length;pe<le;pe++)_=A[pe],ue.push(_["#name"]);return ue})().concat(M).join("/"),(function(){var pe;try{return R=N.options.validator(G,K&&K[M],R)}catch(le){return pe=le,N.emit("error",pe)}})()),N.options.explicitChildren&&!N.options.mergeAttrs&&typeof R=="object"){if(!N.options.preserveChildrenOrder)_={},N.options.attrkey in R&&(_[N.options.attrkey]=R[N.options.attrkey],delete R[N.options.attrkey]),!N.options.charsAsChildren&&N.options.charkey in R&&(_[N.options.charkey]=R[N.options.charkey],delete R[N.options.charkey]),Object.getOwnPropertyNames(R).length>0&&(_[N.options.childkey]=R),R=_;else if(K){K[N.options.childkey]=K[N.options.childkey]||[],q={};for(C in R)m.call(R,C)&&t(q,C,R[C]);K[N.options.childkey].push(q),delete R["#name"],Object.keys(R).length===1&&w in R&&!N.EXPLICIT_CHARKEY&&(R=R[w])}}return A.length>0?N.assignOrPush(K,M,R):(N.options.explicitRoot&&(H=R,R={},t(R,M,H)),N.resultObject=R,N.saxParser.ended=!0,N.emit("end",N.resultObject))}})(this),S=(function(N){return function(b){var E,C;if(C=A[A.length-1],C)return C[w]+=b,N.options.explicitChildren&&N.options.preserveChildrenOrder&&N.options.charsAsChildren&&(N.options.includeWhiteChars||b.replace(/\\n/g,"").trim()!=="")&&(C[N.options.childkey]=C[N.options.childkey]||[],E={"#name":"__text__"},E[w]=b,N.options.normalize&&(E[w]=E[w].replace(/\s{2,}/g," ").trim()),C[N.options.childkey].push(E)),C}})(this),this.saxParser.ontext=S,this.saxParser.oncdata=(function(N){return function(b){var E;if(E=S(b),E)return E.cdata=!0}})(this)},x.prototype.parseString=function(v,w){var S;w!=null&&typeof w=="function"&&(this.on("end",function(A){return this.reset(),w(null,A)}),this.on("error",function(A){return this.reset(),w(A)}));try{return v=v.toString(),v.trim()===""?(this.emit("end",null),!0):(v=r.stripBOM(v),this.options.async?(this.remaining=v,c(this.processAsync),this.saxParser):this.saxParser.write(v).close())}catch(A){if(S=A,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw S}else return this.emit("error",S),this.saxParser.errThrown=!0}},x.prototype.parseStringPromise=function(v){return new Promise((function(w){return function(S,A){return w.parseString(v,function(N,b){return N?A(N):S(b)})}})(this))},x})(n),Jo.parseString=function(g,x,v){var w,S,A;return v!=null?(typeof v=="function"&&(w=v),typeof x=="object"&&(S=x)):(typeof x=="function"&&(w=x),S={}),A=new Jo.Parser(S),A.parseString(g,w)},Jo.parseStringPromise=function(g,x){var v,w;return typeof x=="object"&&(v=x),w=new Jo.Parser(v),w.parseStringPromise(g)}}).call(Jo)});var Qq=Q(Yo=>{"use strict";(function(){"use strict";var r,e,t,n,s=o(function(a,u){for(var c in u)i.call(u,c)&&(a[c]=u[c]);function f(){this.constructor=a}return o(f,"ctor"),f.prototype=u.prototype,a.prototype=new f,a.__super__=u.prototype,a},"extend"),i={}.hasOwnProperty;e=aE(),r=zq(),t=Yq(),n=aD(),Yo.defaults=e.defaults,Yo.processors=n,Yo.ValidationError=(function(a){s(u,a);function u(c){this.message=c}return o(u,"ValidationError"),u})(Error),Yo.Builder=r.Builder,Yo.Parser=t.Parser,Yo.parseString=t.parseString,Yo.parseStringPromise=t.parseStringPromise}).call(Yo)});var bge={};IN(bge,{ASN1:()=>Pg,CanonicalizationMethod:()=>_N,Choice:()=>xge,Decimal:()=>Xl,DigestAlgorithm:()=>jw,EntitySigner:()=>DN,Environment:()=>mQ,IsDecimal:()=>VO,Left:()=>Mw,MemoryCacheAdapter:()=>MN,NFeTsError:()=>hn,NativeCertificateRepository:()=>XT,NullCacheAdapter:()=>Og,Right:()=>mg,SignatureAlgorithm:()=>ko,SignatureMethod:()=>Uw,SignatureNamespace:()=>Vw,Signer:()=>$l,SkipAllValidations:()=>vQ,SkipValidation:()=>gQ,SkipValidationMetadata:()=>wp,SoapRemoteTransmissionRepository:()=>WB,StateAcronyms:()=>dQ,StateCodeAcValidator:()=>jO,StateCodeAlValidator:()=>FO,StateCodeAmValidator:()=>MO,StateCodeApValidator:()=>qO,StateCodeBaValidator:()=>HO,StateCodeCeValidator:()=>KO,StateCodeDfValidator:()=>$O,StateCodeEsValidator:()=>XO,StateCodeGoValidator:()=>GO,StateCodeMaValidator:()=>WO,StateCodeMgValidator:()=>zO,StateCodeMsValidator:()=>JO,StateCodeMtValidator:()=>YO,StateCodePaValidator:()=>QO,StateCodePbValidator:()=>ZO,StateCodePeValidator:()=>eP,StateCodePiValidator:()=>tP,StateCodePrValidator:()=>rP,StateCodeRjValidator:()=>nP,StateCodeRnValidator:()=>sP,StateCodeRoValidator:()=>iP,StateCodeRrValidator:()=>aP,StateCodeRsValidator:()=>oP,StateCodeScValidator:()=>uP,StateCodeSeValidator:()=>cP,StateCodeSpValidator:()=>lP,StateCodeToValidator:()=>fP,StateCodes:()=>Sr,TransformDateString:()=>Sge,TransformDecimal:()=>wge,ValidateErrorsMetadata:()=>PN,Validates:()=>yQ,ValidationError:()=>BN,Xml2JsToolkit:()=>LO,XmlSigner:()=>RN,clearEmptyValues:()=>gg,left:()=>ks,leftFromError:()=>Mo,mapConstraintsToErrors:()=>kN,plainToInstance:()=>ON,right:()=>Ls,unreachable:()=>Fw});module.exports=pQ(bge);var Vw="http://www.w3.org/2000/09/xmldsig#",_N="http://www.w3.org/TR/2001/REC-xml-c14n-20010315",Uw=(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})({}),ko=(function(r){return r.SHA1="sha1",r.SHA256="sha256",r})({}),jw=(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 Sr={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"},dQ=Object.keys(Sr);var mQ={Production:"1",Homolog:"2"};var Ige={[Sr.AC]:"America/Rio_Branco",[Sr.AL]:"America/Maceio",[Sr.AM]:"America/Manaus",[Sr.AP]:"America/Belem",[Sr.BA]:"America/Bahia",[Sr.CE]:"America/Fortaleza",[Sr.DF]:"America/Sao_Paulo",[Sr.ES]:"America/Sao_Paulo",[Sr.GO]:"America/Sao_Paulo",[Sr.MA]:"America/Fortaleza",[Sr.MG]:"America/Sao_Paulo",[Sr.MS]:"America/Campo_Grande",[Sr.MT]:"America/Cuiaba",[Sr.PA]:"America/Belem",[Sr.PB]:"America/Fortaleza",[Sr.PE]:"America/Recife",[Sr.PI]:"America/Fortaleza",[Sr.PR]:"America/Sao_Paulo",[Sr.RJ]:"America/Sao_Paulo",[Sr.RN]:"America/Fortaleza",[Sr.RO]:"America/Porto_Velho",[Sr.RR]:"America/Boa_Vista",[Sr.RS]:"America/Sao_Paulo",[Sr.SC]:"America/Sao_Paulo",[Sr.SE]:"America/Maceio",[Sr.SP]:"America/Sao_Paulo",[Sr.TO]:"America/Araguaina"};var hn=class extends Error{static{o(this,"NFeTsError")}};var BN=class extends hn{static{o(this,"ValidationError")}};var dg={includeComments:!1,exclusive:!0};var Fw=o(r=>{throw new hn("Didn't expect to get here")},"unreachable");var $l=class{static{o(this,"Signer")}toolkit;certificateRepository;algorithm;canonical;constructor(e,t,n=ko.SHA1,s=dg){this.toolkit=e,this.certificateRepository=t,this.algorithm=n,this.canonical=s}assemble(e,t,n){let s=this.certificateRepository.getStringCertificate(n);return{$:{xmlns:Vw},SignedInfo:e,SignatureValue:t,KeyInfo:{X509Data:{X509Certificate:s}}}}signedInfo(e,t){return{CanonicalizationMethod:{$:{Algorithm:_N}},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:Vw},...e},{rootName:"SignedInfo"}),this.canonical);return await 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 ko.SHA256:return jw.SHA256;case ko.SHA1:return jw.SHA1;default:return Fw(this.algorithm)}}get signatureMethod(){switch(this.algorithm){case ko.SHA256:return Uw.RSA_SHA256;case ko.SHA1:return Uw.RSA_SHA1;default:return Fw(this.algorithm)}}};var Mw=class{static{o(this,"Left")}value;constructor(e){this.value=e}isLeft(){return!0}isRight(){return!1}},mg=class{static{o(this,"Right")}value;constructor(e){this.value=e}isLeft(){return!1}isRight(){return!0}},ks=o(r=>new Mw(r),"left"),Ls=o(r=>r===void 0?new mg(void 0):new mg(r),"right");var DN=class extends $l{static{o(this,"EntitySigner")}async sign(e,t,n){let{tag:s,mark:i}=t,{privateKey:a,certificate:u}=n;if(!e[s])return ks(new hn(`Node ${String(s)} not found`));let c=await this.toolkit.build(this.ns(e,s),{headless:!0,rootName:String(s),renderOpts:{pretty:!1}}),f=this.signedInfo(c,i),h=await this.signOrLeft(f,a);if(h.isLeft())return h;let m=e;return m.Signature=this.assemble(f,h.value,u),Ls(m)}ns(e,t){let n=e.$?.xmlns,{$:s,...i}=e[t],{xmlns:a,...u}=s??{};return{$:{xmlns:n,...u},...i}}};var RN=class extends $l{static{o(this,"XmlSigner")}async sign(e,t,n){let{tag:s,mark:i}=t,{privateKey:a,certificate:u}=n,c=this.toolkit.getNode(e,s);if(!c)return ks(new hn(`Node ${s} not found`));let f=this.signedInfo(c,i),h=await this.signOrLeft(f,a);if(h.isLeft())return h;let m=await this.toolkit.build(this.assemble(f,h.value,u),{rootName:"Signature"});return Ls(this.toolkit.appendNode(e,m))}};var Sve=require("reflect-metadata"),jk=require("class-validator");var gve=require("reflect-metadata");var wp="__SkipValidation__",gQ=o(()=>(r,e)=>{Reflect.defineMetadata(wp,!0,r,e.toString())},"SkipValidation"),vQ=o(()=>r=>{Reflect.defineMetadata(wp,!0,r)},"SkipAllValidations");var Uk=require("class-transformer");var gg=o(r=>{for(let[e,t]of Object.entries(r))typeof t>"u"&&delete r[e],t===""&&delete r[e],t&&typeof t=="object"&&gg(t)},"clearEmptyValues"),ON=o((r,e,t={})=>{let n=(0,Uk.plainToInstance)(e,r);return t.clearEmptyValues&&gg(n),n},"plainToInstance");var PN="__ValidateErrors__",kN=o((r,e)=>r.reduce((t,n)=>{if(n.children?.length)return t.concat(kN(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"),yQ=o(r=>(e,t,n)=>{let s=n.value;n.value=function(...i){let a=Reflect.getMetadata(wp,this.constructor);if(Reflect.getMetadata(wp,this.constructor.prototype,t.toString())===!0||a===!0)return s?.apply(this,i);let[c,...f]=i,h=ON(c,r),m=(0,jk.validateSync)(h,{whitelist:!0});if(gg(h),m.length){let g=Reflect.getMetadata(PN,this)??[];Reflect.defineMetadata(PN,g.concat(kN(m,s?.name)),this)}return s?.apply(this,[h,...f])}},"Validates");var ZOe=require("reflect-metadata");var Sp=9e15,qu=1e9,LN="0123456789abcdef",Kw="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",$w="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",VN={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Sp,maxE:Sp,crypto:!1},Hk,Lo,_t=!0,Gw="[DecimalError] ",Mu=Gw+"Invalid argument: ",Kk=Gw+"Precision limit exceeded",$k=Gw+"crypto unavailable",Xk="[object Decimal]",cs=Math.floor,Nn=Math.pow,xQ=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,wQ=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,SQ=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Gk=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,oa=1e7,St=7,bQ=9007199254740991,EQ=Kw.length-1,UN=$w.length-1,Oe={toStringTag:Xk};Oe.absoluteValue=Oe.abs=function(){var r=new this.constructor(this);return r.s<0&&(r.s=1),mt(r)};Oe.ceil=function(){return mt(new this.constructor(this),this.e+1,2)};Oe.clampedTo=Oe.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(Mu+e);return t=n.cmp(r),t<0?r:n.cmp(e)>0?e:new s(n)};Oe.comparedTo=Oe.cmp=function(r){var e,t,n,s,i=this,a=i.d,u=(r=new i.constructor(r)).d,c=i.s,f=r.s;if(!a||!u)return!c||!f?NaN:c!==f?c:a===u?0:!a^c<0?1:-1;if(!a[0]||!u[0])return a[0]?c:u[0]?-f:0;if(c!==f)return c;if(i.e!==r.e)return i.e>r.e^c<0?1:-1;for(n=a.length,s=u.length,e=0,t=n<s?n:s;e<t;++e)if(a[e]!==u[e])return a[e]>u[e]^c<0?1:-1;return n===s?0:n>s^c<0?1:-1};Oe.cosine=Oe.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())+St,n.rounding=1,t=AQ(n,Qk(n,t)),n.precision=r,n.rounding=e,mt(Lo==2||Lo==3?t.neg():t,r,e,!0)):new n(1):new n(NaN)};Oe.cubeRoot=Oe.cbrt=function(){var r,e,t,n,s,i,a,u,c,f,h=this,m=h.constructor;if(!h.isFinite()||h.isZero())return new m(h);for(_t=!1,i=h.s*Nn(h.s*h,1/3),!i||Math.abs(i)==1/0?(t=Xn(h.d),r=h.e,(i=(r-t.length+1)%3)&&(t+=i==1||i==-2?"0":"00"),i=Nn(t,1/3),r=cs((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 m(t),n.s=h.s):n=new m(i.toString()),a=(r=m.precision)+3;;)if(u=n,c=u.times(u).times(u),f=c.plus(h),n=_r(f.plus(h).times(u),f.plus(c),a+2,1),Xn(u.d).slice(0,a)===(t=Xn(n.d)).slice(0,a))if(t=t.slice(a-3,a+1),t=="9999"||!s&&t=="4999"){if(!s&&(mt(u,r+1,0),u.times(u).times(u).eq(h))){n=u;break}a+=4,s=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(mt(n,r+1,1),e=!n.times(n).times(n).eq(h));break}return _t=!0,mt(n,r,m.rounding,e)};Oe.decimalPlaces=Oe.dp=function(){var r,e=this.d,t=NaN;if(e){if(r=e.length-1,t=(r-cs(this.e/St))*St,r=e[r],r)for(;r%10==0;r/=10)t--;t<0&&(t=0)}return t};Oe.dividedBy=Oe.div=function(r){return _r(this,new this.constructor(r))};Oe.dividedToIntegerBy=Oe.divToInt=function(r){var e=this,t=e.constructor;return mt(_r(e,new t(r),0,1,1),t.precision,t.rounding)};Oe.equals=Oe.eq=function(r){return this.cmp(r)===0};Oe.floor=function(){return mt(new this.constructor(this),this.e+1,3)};Oe.greaterThan=Oe.gt=function(r){return this.cmp(r)>0};Oe.greaterThanOrEqualTo=Oe.gte=function(r){var e=this.cmp(r);return e==1||e===0};Oe.hyperbolicCosine=Oe.cosh=function(){var r,e,t,n,s,i=this,a=i.constructor,u=new a(1);if(!i.isFinite())return new a(i.s?1/0:NaN);if(i.isZero())return u;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/zw(4,r)).toString()):(r=16,e="2.3283064365386962890625e-10"),i=bp(a,1,i.times(e),new a(1),!0);for(var c,f=r,h=new a(8);f--;)c=i.times(i),i=u.minus(c.times(h.minus(c.times(h))));return mt(i,a.precision=t,a.rounding=n,!0)};Oe.hyperbolicSine=Oe.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=bp(i,2,s,s,!0);else{r=1.4*Math.sqrt(n),r=r>16?16:r|0,s=s.times(1/zw(5,r)),s=bp(i,2,s,s,!0);for(var a,u=new i(5),c=new i(16),f=new i(20);r--;)a=s.times(s),s=s.times(u.plus(a.times(c.times(a).plus(f))))}return i.precision=e,i.rounding=t,mt(s,e,t,!0)};Oe.hyperbolicTangent=Oe.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,_r(t.sinh(),t.cosh(),n.precision=r,n.rounding=e)):new n(t.s)};Oe.inverseCosine=Oe.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()?ka(e,n,s):new e(0):new e(NaN):r.isZero()?ka(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))};Oe.inverseHyperbolicCosine=Oe.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,_t=!1,t=t.times(t).minus(1).sqrt().plus(t),_t=!0,n.precision=r,n.rounding=e,t.ln()):new n(t)};Oe.inverseHyperbolicSine=Oe.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,_t=!1,t=t.times(t).plus(1).sqrt().plus(t),_t=!0,n.precision=r,n.rounding=e,t.ln())};Oe.inverseHyperbolicTangent=Oe.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?mt(new i(s),r,e,!0):(i.precision=t=n-s.e,s=_r(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)};Oe.inverseSine=Oe.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=ka(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)))};Oe.inverseTangent=Oe.atan=function(){var r,e,t,n,s,i,a,u,c,f=this,h=f.constructor,m=h.precision,g=h.rounding;if(f.isFinite()){if(f.isZero())return new h(f);if(f.abs().eq(1)&&m+4<=UN)return a=ka(h,m+4,g).times(.25),a.s=f.s,a}else{if(!f.s)return new h(NaN);if(m+4<=UN)return a=ka(h,m+4,g).times(.5),a.s=f.s,a}for(h.precision=u=m+10,h.rounding=1,t=Math.min(28,u/St+2|0),r=t;r;--r)f=f.div(f.times(f).plus(1).sqrt().plus(1));for(_t=!1,e=Math.ceil(u/St),n=1,c=f.times(f),a=new h(f),s=f;r!==-1;)if(s=s.times(c),i=a.minus(s.div(n+=2)),s=s.times(c),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)),_t=!0,mt(a,h.precision=m,h.rounding=g,!0)};Oe.isFinite=function(){return!!this.d};Oe.isInteger=Oe.isInt=function(){return!!this.d&&cs(this.e/St)>this.d.length-2};Oe.isNaN=function(){return!this.s};Oe.isNegative=Oe.isNeg=function(){return this.s<0};Oe.isPositive=Oe.isPos=function(){return this.s>0};Oe.isZero=function(){return!!this.d&&this.d[0]===0};Oe.lessThan=Oe.lt=function(r){return this.cmp(r)<0};Oe.lessThanOrEqualTo=Oe.lte=function(r){return this.cmp(r)<1};Oe.logarithm=Oe.log=function(r){var e,t,n,s,i,a,u,c,f=this,h=f.constructor,m=h.precision,g=h.rounding,x=5;if(r==null)r=new h(10),e=!0;else{if(r=new h(r),t=r.d,r.s<0||!t||!t[0]||r.eq(1))return new h(NaN);e=r.eq(10)}if(t=f.d,f.s<0||!t||!t[0]||f.eq(1))return new h(t&&!t[0]?-1/0:f.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(_t=!1,u=m+x,a=Fu(f,u),n=e?Xw(h,u+10):Fu(r,u),c=_r(a,n,u,1),vg(c.d,s=m,g))do if(u+=10,a=Fu(f,u),n=e?Xw(h,u+10):Fu(r,u),c=_r(a,n,u,1),!i){+Xn(c.d).slice(s+1,s+15)+1==1e14&&(c=mt(c,m+1,0));break}while(vg(c.d,s+=10,g));return _t=!0,mt(c,m,g)};Oe.minus=Oe.sub=function(r){var e,t,n,s,i,a,u,c,f,h,m,g,x=this,v=x.constructor;if(r=new v(r),!x.d||!r.d)return!x.s||!r.s?r=new v(NaN):x.d?r.s=-r.s:r=new v(r.d||x.s!==r.s?x:NaN),r;if(x.s!=r.s)return r.s=-r.s,x.plus(r);if(f=x.d,g=r.d,u=v.precision,c=v.rounding,!f[0]||!g[0]){if(g[0])r.s=-r.s;else if(f[0])r=new v(x);else return new v(c===3?-0:0);return _t?mt(r,u,c):r}if(t=cs(r.e/St),h=cs(x.e/St),f=f.slice(),i=h-t,i){for(m=i<0,m?(e=f,i=-i,a=g.length):(e=g,t=h,a=f.length),n=Math.max(Math.ceil(u/St),a)+2,i>n&&(i=n,e.length=1),e.reverse(),n=i;n--;)e.push(0);e.reverse()}else{for(n=f.length,a=g.length,m=n<a,m&&(a=n),n=0;n<a;n++)if(f[n]!=g[n]){m=f[n]<g[n];break}i=0}for(m&&(e=f,f=g,g=e,r.s=-r.s),a=f.length,n=g.length-a;n>0;--n)f[a++]=0;for(n=g.length;n>i;){if(f[--n]<g[n]){for(s=n;s&&f[--s]===0;)f[s]=oa-1;--f[s],f[n]+=oa}f[n]-=g[n]}for(;f[--a]===0;)f.pop();for(;f[0]===0;f.shift())--t;return f[0]?(r.d=f,r.e=Ww(f,t),_t?mt(r,u,c):r):new v(c===3?-0:0)};Oe.modulo=Oe.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]?mt(new n(t),n.precision,n.rounding):(_t=!1,n.modulo==9?(e=_r(t,r.abs(),0,3,1),e.s*=r.s):e=_r(t,r,0,n.modulo,1),e=e.times(r),_t=!0,t.minus(e))};Oe.naturalExponential=Oe.exp=function(){return jN(this)};Oe.naturalLogarithm=Oe.ln=function(){return Fu(this)};Oe.negated=Oe.neg=function(){var r=new this.constructor(this);return r.s=-r.s,mt(r)};Oe.plus=Oe.add=function(r){var e,t,n,s,i,a,u,c,f,h,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=new g(r.d||m.s===r.s?m:NaN)),r;if(m.s!=r.s)return r.s=-r.s,m.minus(r);if(f=m.d,h=r.d,u=g.precision,c=g.rounding,!f[0]||!h[0])return h[0]||(r=new g(m)),_t?mt(r,u,c):r;if(i=cs(m.e/St),n=cs(r.e/St),f=f.slice(),s=i-n,s){for(s<0?(t=f,s=-s,a=h.length):(t=h,n=i,a=f.length),i=Math.ceil(u/St),a=i>a?i+1:a+1,s>a&&(s=a,t.length=1),t.reverse();s--;)t.push(0);t.reverse()}for(a=f.length,s=h.length,a-s<0&&(s=a,t=h,h=f,f=t),e=0;s;)e=(f[--s]=f[s]+h[s]+e)/oa|0,f[s]%=oa;for(e&&(f.unshift(e),++n),a=f.length;f[--a]==0;)f.pop();return r.d=f,r.e=Ww(f,n),_t?mt(r,u,c):r};Oe.precision=Oe.sd=function(r){var e,t=this;if(r!==void 0&&r!==!!r&&r!==1&&r!==0)throw Error(Mu+r);return t.d?(e=Wk(t.d),r&&t.e+1>e&&(e=t.e+1)):e=NaN,e};Oe.round=function(){var r=this,e=r.constructor;return mt(new e(r),r.e+1,e.rounding)};Oe.sine=Oe.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())+St,n.rounding=1,t=NQ(n,Qk(n,t)),n.precision=r,n.rounding=e,mt(Lo>2?t.neg():t,r,e,!0)):new n(NaN)};Oe.squareRoot=Oe.sqrt=function(){var r,e,t,n,s,i,a=this,u=a.d,c=a.e,f=a.s,h=a.constructor;if(f!==1||!u||!u[0])return new h(!f||f<0&&(!u||u[0])?NaN:u?a:1/0);for(_t=!1,f=Math.sqrt(+a),f==0||f==1/0?(e=Xn(u),(e.length+c)%2==0&&(e+="0"),f=Math.sqrt(e),c=cs((c+1)/2)-(c<0||c%2),f==1/0?e="5e"+c:(e=f.toExponential(),e=e.slice(0,e.indexOf("e")+1)+c),n=new h(e)):n=new h(f.toString()),t=(c=h.precision)+3;;)if(i=n,n=i.plus(_r(a,i,t+2,1)).times(.5),Xn(i.d).slice(0,t)===(e=Xn(n.d)).slice(0,t))if(e=e.slice(t-3,t+1),e=="9999"||!s&&e=="4999"){if(!s&&(mt(i,c+1,0),i.times(i).eq(a))){n=i;break}t+=4,s=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(mt(n,c+1,1),r=!n.times(n).eq(a));break}return _t=!0,mt(n,c,h.rounding,r)};Oe.tangent=Oe.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=_r(t,new n(1).minus(t.times(t)).sqrt(),r+10,0),n.precision=r,n.rounding=e,mt(Lo==2||Lo==4?t.neg():t,r,e,!0)):new n(NaN)};Oe.times=Oe.mul=function(r){var e,t,n,s,i,a,u,c,f,h=this,m=h.constructor,g=h.d,x=(r=new m(r)).d;if(r.s*=h.s,!g||!g[0]||!x||!x[0])return new m(!r.s||g&&!g[0]&&!x||x&&!x[0]&&!g?NaN:!g||!x?r.s/0:r.s*0);for(t=cs(h.e/St)+cs(r.e/St),c=g.length,f=x.length,c<f&&(i=g,g=x,x=i,a=c,c=f,f=a),i=[],a=c+f,n=a;n--;)i.push(0);for(n=f;--n>=0;){for(e=0,s=c+n;s>n;)u=i[s]+x[n]*g[s-n-1]+e,i[s--]=u%oa|0,e=u/oa|0;i[s]=(i[s]+e)%oa|0}for(;!i[--a];)i.pop();return e?++t:i.shift(),r.d=i,r.e=Ww(i,t),_t?mt(r,m.precision,m.rounding):r};Oe.toBinary=function(r,e){return FN(this,2,r,e)};Oe.toDecimalPlaces=Oe.toDP=function(r,e){var t=this,n=t.constructor;return t=new n(t),r===void 0?t:(Vs(r,0,qu),e===void 0?e=n.rounding:Vs(e,0,8),mt(t,r+t.e+1,e))};Oe.toExponential=function(r,e){var t,n=this,s=n.constructor;return r===void 0?t=La(n,!0):(Vs(r,0,qu),e===void 0?e=s.rounding:Vs(e,0,8),n=mt(new s(n),r+1,e),t=La(n,!0,r+1)),n.isNeg()&&!n.isZero()?"-"+t:t};Oe.toFixed=function(r,e){var t,n,s=this,i=s.constructor;return r===void 0?t=La(s):(Vs(r,0,qu),e===void 0?e=i.rounding:Vs(e,0,8),n=mt(new i(s),r+s.e+1,e),t=La(n,!1,r+n.e+1)),s.isNeg()&&!s.isZero()?"-"+t:t};Oe.toFraction=function(r){var e,t,n,s,i,a,u,c,f,h,m,g,x=this,v=x.d,w=x.constructor;if(!v)return new w(x);if(f=t=new w(1),n=c=new w(0),e=new w(n),i=e.e=Wk(v)-x.e-1,a=i%St,e.d[0]=Nn(10,a<0?St+a:a),r==null)r=i>0?e:f;else{if(u=new w(r),!u.isInt()||u.lt(f))throw Error(Mu+u);r=u.gt(e)?i>0?e:f:u}for(_t=!1,u=new w(Xn(v)),h=w.precision,w.precision=i=v.length*St*2;m=_r(u,e,0,1,1),s=t.plus(m.times(n)),s.cmp(r)!=1;)t=n,n=s,s=f,f=c.plus(m.times(s)),c=s,s=e,e=u.minus(m.times(s)),u=s;return s=_r(r.minus(t),n,0,1,1),c=c.plus(s.times(f)),t=t.plus(s.times(n)),c.s=f.s=x.s,g=_r(f,n,i,1).minus(x).abs().cmp(_r(c,t,i,1).minus(x).abs())<1?[f,n]:[c,t],w.precision=h,_t=!0,g};Oe.toHexadecimal=Oe.toHex=function(r,e){return FN(this,16,r,e)};Oe.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:Vs(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]?(_t=!1,t=_r(t,r,0,e,1).times(r),_t=!0,mt(t)):(r.s=t.s,t=r),t};Oe.toNumber=function(){return+this};Oe.toOctal=function(r,e){return FN(this,8,r,e)};Oe.toPower=Oe.pow=function(r){var e,t,n,s,i,a,u=this,c=u.constructor,f=+(r=new c(r));if(!u.d||!r.d||!u.d[0]||!r.d[0])return new c(Nn(+u,f));if(u=new c(u),u.eq(1))return u;if(n=c.precision,i=c.rounding,r.eq(1))return mt(u,n,i);if(e=cs(r.e/St),e>=r.d.length-1&&(t=f<0?-f:f)<=bQ)return s=zk(c,u,t,n),r.s<0?new c(1).div(s):mt(s,n,i);if(a=u.s,a<0){if(e<r.d.length-1)return new c(NaN);if((r.d[e]&1)==0&&(a=1),u.e==0&&u.d[0]==1&&u.d.length==1)return u.s=a,u}return t=Nn(+u,f),e=t==0||!isFinite(t)?cs(f*(Math.log("0."+Xn(u.d))/Math.LN10+u.e+1)):new c(t+"").e,e>c.maxE+1||e<c.minE-1?new c(e>0?a/0:0):(_t=!1,c.rounding=u.s=1,t=Math.min(12,(e+"").length),s=jN(r.times(Fu(u,n+t)),n),s.d&&(s=mt(s,n+5,1),vg(s.d,n,i)&&(e=n+10,s=mt(jN(r.times(Fu(u,e+t)),e),e+5,1),+Xn(s.d).slice(n+1,n+15)+1==1e14&&(s=mt(s,n+1,0)))),s.s=a,_t=!0,c.rounding=i,mt(s,n,i))};Oe.toPrecision=function(r,e){var t,n=this,s=n.constructor;return r===void 0?t=La(n,n.e<=s.toExpNeg||n.e>=s.toExpPos):(Vs(r,1,qu),e===void 0?e=s.rounding:Vs(e,0,8),n=mt(new s(n),r,e),t=La(n,r<=n.e||n.e<=s.toExpNeg,r)),n.isNeg()&&!n.isZero()?"-"+t:t};Oe.toSignificantDigits=Oe.toSD=function(r,e){var t=this,n=t.constructor;return r===void 0?(r=n.precision,e=n.rounding):(Vs(r,1,qu),e===void 0?e=n.rounding:Vs(e,0,8)),mt(new n(t),r,e)};Oe.toString=function(){var r=this,e=r.constructor,t=La(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()&&!r.isZero()?"-"+t:t};Oe.truncated=Oe.trunc=function(){return mt(new this.constructor(this),this.e+1,1)};Oe.valueOf=Oe.toJSON=function(){var r=this,e=r.constructor,t=La(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()?"-"+t:t};function Xn(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=St-n.length,t&&(i+=ju(t)),i+=n;a=r[e],n=a+"",t=St-n.length,t&&(i+=ju(t))}else if(a===0)return"0";for(;a%10===0;)a/=10;return i+a}o(Xn,"digitsToString");function Vs(r,e,t){if(r!==~~r||r<e||r>t)throw Error(Mu+r)}o(Vs,"checkInt32");function vg(r,e,t,n){var s,i,a,u;for(i=r[0];i>=10;i/=10)--e;return--e<0?(e+=St,s=0):(s=Math.ceil((e+1)/St),e%=St),i=Nn(10,St-e),u=r[s]%i|0,n==null?e<3?(e==0?u=u/100|0:e==1&&(u=u/10|0),a=t<4&&u==99999||t>3&&u==49999||u==5e4||u==0):a=(t<4&&u+1==i||t>3&&u+1==i/2)&&(r[s+1]/i/100|0)==Nn(10,e-2)-1||(u==i/2||u==0)&&(r[s+1]/i/100|0)==0:e<4?(e==0?u=u/1e3|0:e==1?u=u/100|0:e==2&&(u=u/10|0),a=(n||t<4)&&u==9999||!n&&t>3&&u==4999):a=((n||t<4)&&u+1==i||!n&&t>3&&u+1==i/2)&&(r[s+1]/i/1e3|0)==Nn(10,e-3)-1,a}o(vg,"checkRoundingDigits");function qw(r,e,t){for(var n,s=[0],i,a=0,u=r.length;a<u;){for(i=s.length;i--;)s[i]*=e;for(s[0]+=LN.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()}o(qw,"convertBase");function AQ(r,e){var t,n,s;if(e.isZero())return e;n=e.d.length,n<32?(t=Math.ceil(n/3),s=(1/zw(4,t)).toString()):(t=16,s="2.3283064365386962890625e-10"),r.precision+=t,e=bp(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}o(AQ,"cosine");var _r=(function(){function r(n,s,i){var a,u=0,c=n.length;for(n=n.slice();c--;)a=n[c]*s+u,n[c]=a%i|0,u=a/i|0;return u&&n.unshift(u),n}o(r,"multiplyInteger");function e(n,s,i,a){var u,c;if(i!=a)c=i>a?1:-1;else for(u=c=0;u<i;u++)if(n[u]!=s[u]){c=n[u]>s[u]?1:-1;break}return c}o(e,"compare");function t(n,s,i,a){for(var u=0;i--;)n[i]-=u,u=n[i]<s[i]?1:0,n[i]=u*a+n[i]-s[i];for(;!n[0]&&n.length>1;)n.shift()}return o(t,"subtract"),function(n,s,i,a,u,c){var f,h,m,g,x,v,w,S,A,N,b,E,C,_,M,R,q,H,K,G,pe=n.constructor,le=n.s==s.s?1:-1,ue=n.d,ee=s.d;if(!ue||!ue[0]||!ee||!ee[0])return new pe(!n.s||!s.s||(ue?ee&&ue[0]==ee[0]:!ee)?NaN:ue&&ue[0]==0||!ee?le*0:le/0);for(c?(x=1,h=n.e-s.e):(c=oa,x=St,h=cs(n.e/x)-cs(s.e/x)),K=ee.length,q=ue.length,A=new pe(le),N=A.d=[],m=0;ee[m]==(ue[m]||0);m++);if(ee[m]>(ue[m]||0)&&h--,i==null?(_=i=pe.precision,a=pe.rounding):u?_=i+(n.e-s.e)+1:_=i,_<0)N.push(1),v=!0;else{if(_=_/x+2|0,m=0,K==1){for(g=0,ee=ee[0],_++;(m<q||g)&&_--;m++)M=g*c+(ue[m]||0),N[m]=M/ee|0,g=M%ee|0;v=g||m<q}else{for(g=c/(ee[0]+1)|0,g>1&&(ee=r(ee,g,c),ue=r(ue,g,c),K=ee.length,q=ue.length),R=K,b=ue.slice(0,K),E=b.length;E<K;)b[E++]=0;G=ee.slice(),G.unshift(0),H=ee[0],ee[1]>=c/2&&++H;do g=0,f=e(ee,b,K,E),f<0?(C=b[0],K!=E&&(C=C*c+(b[1]||0)),g=C/H|0,g>1?(g>=c&&(g=c-1),w=r(ee,g,c),S=w.length,E=b.length,f=e(w,b,S,E),f==1&&(g--,t(w,K<S?G:ee,S,c))):(g==0&&(f=g=1),w=ee.slice()),S=w.length,S<E&&w.unshift(0),t(b,w,E,c),f==-1&&(E=b.length,f=e(ee,b,K,E),f<1&&(g++,t(b,K<E?G:ee,E,c))),E=b.length):f===0&&(g++,b=[0]),N[m++]=g,f&&b[0]?b[E++]=ue[R]||0:(b=[ue[R]],E=1);while((R++<q||b[0]!==void 0)&&_--);v=b[0]!==void 0}N[0]||N.shift()}if(x==1)A.e=h,Hk=v;else{for(m=1,g=N[0];g>=10;g/=10)m++;A.e=m+h*x-1,mt(A,u?i+A.e+1:i,a,v)}return A}})();function mt(r,e,t,n){var s,i,a,u,c,f,h,m,g,x=r.constructor;e:if(e!=null){if(m=r.d,!m)return r;for(s=1,u=m[0];u>=10;u/=10)s++;if(i=e-s,i<0)i+=St,a=e,h=m[g=0],c=h/Nn(10,s-a-1)%10|0;else if(g=Math.ceil((i+1)/St),u=m.length,g>=u)if(n){for(;u++<=g;)m.push(0);h=c=0,s=1,i%=St,a=i-St+1}else break e;else{for(h=u=m[g],s=1;u>=10;u/=10)s++;i%=St,a=i-St+s,c=a<0?0:h/Nn(10,s-a-1)%10|0}if(n=n||e<0||m[g+1]!==void 0||(a<0?h:h%Nn(10,s-a-1)),f=t<4?(c||n)&&(t==0||t==(r.s<0?3:2)):c>5||c==5&&(t==4||n||t==6&&(i>0?a>0?h/Nn(10,s-a):0:m[g-1])%10&1||t==(r.s<0?8:7)),e<1||!m[0])return m.length=0,f?(e-=r.e+1,m[0]=Nn(10,(St-e%St)%St),r.e=-e||0):m[0]=r.e=0,r;if(i==0?(m.length=g,u=1,g--):(m.length=g+1,u=Nn(10,St-i),m[g]=a>0?(h/Nn(10,s-a)%Nn(10,a)|0)*u:0),f)for(;;)if(g==0){for(i=1,a=m[0];a>=10;a/=10)i++;for(a=m[0]+=u,u=1;a>=10;a/=10)u++;i!=u&&(r.e++,m[0]==oa&&(m[0]=1));break}else{if(m[g]+=u,m[g]!=oa)break;m[g--]=0,u=1}for(i=m.length;m[--i]===0;)m.pop()}return _t&&(r.e>x.maxE?(r.d=null,r.e=NaN):r.e<x.minE&&(r.e=0,r.d=[0])),r}o(mt,"finalise");function La(r,e,t){if(!r.isFinite())return Yk(r);var n,s=r.e,i=Xn(r.d),a=i.length;return e?(t&&(n=t-a)>0?i=i.charAt(0)+"."+i.slice(1)+ju(n):a>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(r.e<0?"e":"e+")+r.e):s<0?(i="0."+ju(-s-1)+i,t&&(n=t-a)>0&&(i+=ju(n))):s>=a?(i+=ju(s+1-a),t&&(n=t-s-1)>0&&(i=i+"."+ju(n))):((n=s+1)<a&&(i=i.slice(0,n)+"."+i.slice(n)),t&&(n=t-a)>0&&(s+1===a&&(i+="."),i+=ju(n))),i}o(La,"finiteToString");function Ww(r,e){var t=r[0];for(e*=St;t>=10;t/=10)e++;return e}o(Ww,"getBase10Exponent");function Xw(r,e,t){if(e>EQ)throw _t=!0,t&&(r.precision=t),Error(Kk);return mt(new r(Kw),e,1,!0)}o(Xw,"getLn10");function ka(r,e,t){if(e>UN)throw Error(Kk);return mt(new r($w),e,t,!0)}o(ka,"getPi");function Wk(r){var e=r.length-1,t=e*St+1;if(e=r[e],e){for(;e%10==0;e/=10)t--;for(e=r[0];e>=10;e/=10)t++}return t}o(Wk,"getPrecision");function ju(r){for(var e="";r--;)e+="0";return e}o(ju,"getZeroString");function zk(r,e,t,n){var s,i=new r(1),a=Math.ceil(n/St+4);for(_t=!1;;){if(t%2&&(i=i.times(e),Mk(i.d,a)&&(s=!0)),t=cs(t/2),t===0){t=i.d.length-1,s&&i.d[t]===0&&++i.d[t];break}e=e.times(e),Mk(e.d,a)}return _t=!0,i}o(zk,"intPow");function Fk(r){return r.d[r.d.length-1]&1}o(Fk,"isOdd");function Jk(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}o(Jk,"maxOrMin");function jN(r,e){var t,n,s,i,a,u,c,f=0,h=0,m=0,g=r.constructor,x=g.rounding,v=g.precision;if(!r.d||!r.d[0]||r.e>17)return new g(r.d?r.d[0]?r.s<0?0:1/0:1:r.s?r.s<0?0:r:NaN);for(e==null?(_t=!1,c=v):c=e,u=new g(.03125);r.e>-2;)r=r.times(u),m+=5;for(n=Math.log(Nn(2,m))/Math.LN10*2+5|0,c+=n,t=i=a=new g(1),g.precision=c;;){if(i=mt(i.times(r),c,1),t=t.times(++h),u=a.plus(_r(i,t,c,1)),Xn(u.d).slice(0,c)===Xn(a.d).slice(0,c)){for(s=m;s--;)a=mt(a.times(a),c,1);if(e==null)if(f<3&&vg(a.d,c-n,x,f))g.precision=c+=10,t=i=u=new g(1),h=0,f++;else return mt(a,g.precision=v,x,_t=!0);else return g.precision=v,a}a=u}}o(jN,"naturalExponential");function Fu(r,e){var t,n,s,i,a,u,c,f,h,m,g,x=1,v=10,w=r,S=w.d,A=w.constructor,N=A.rounding,b=A.precision;if(w.s<0||!S||!S[0]||!w.e&&S[0]==1&&S.length==1)return new A(S&&!S[0]?-1/0:w.s!=1?NaN:S?0:w);if(e==null?(_t=!1,h=b):h=e,A.precision=h+=v,t=Xn(S),n=t.charAt(0),Math.abs(i=w.e)<15e14){for(;n<7&&n!=1||n==1&&t.charAt(1)>3;)w=w.times(r),t=Xn(w.d),n=t.charAt(0),x++;i=w.e,n>1?(w=new A("0."+t),i++):w=new A(n+"."+t.slice(1))}else return f=Xw(A,h+2,b).times(i+""),w=Fu(new A(n+"."+t.slice(1)),h-v).plus(f),A.precision=b,e==null?mt(w,b,N,_t=!0):w;for(m=w,c=a=w=_r(w.minus(1),w.plus(1),h,1),g=mt(w.times(w),h,1),s=3;;){if(a=mt(a.times(g),h,1),f=c.plus(_r(a,new A(s),h,1)),Xn(f.d).slice(0,h)===Xn(c.d).slice(0,h))if(c=c.times(2),i!==0&&(c=c.plus(Xw(A,h+2,b).times(i+""))),c=_r(c,new A(x),h,1),e==null)if(vg(c.d,h-v,N,u))A.precision=h+=v,f=a=w=_r(m.minus(1),m.plus(1),h,1),g=mt(w.times(w),h,1),s=u=1;else return mt(c,A.precision=b,N,_t=!0);else return A.precision=b,c;c=f,s+=2}}o(Fu,"naturalLogarithm");function Yk(r){return String(r.s*r.s/0)}o(Yk,"nonFiniteToString");function Hw(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)%St,t<0&&(n+=St),n<s){for(n&&r.d.push(+e.slice(0,n)),s-=St;n<s;)r.d.push(+e.slice(n,n+=St));e=e.slice(n),n=St-e.length}else n-=s;for(;n--;)e+="0";r.d.push(+e),_t&&(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}o(Hw,"parseDecimal");function CQ(r,e){var t,n,s,i,a,u,c,f,h;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),Gk.test(e))return Hw(r,e)}else if(e==="Infinity"||e==="NaN")return+e||(r.s=NaN),r.e=NaN,r.d=null,r;if(wQ.test(e))t=16,e=e.toLowerCase();else if(xQ.test(e))t=2;else if(SQ.test(e))t=8;else throw Error(Mu+e);for(i=e.search(/p/i),i>0?(c=+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(".",""),u=e.length,i=u-i,s=zk(n,new n(t),i,i*2)),f=qw(e,t,oa),h=f.length-1,i=h;f[i]===0;--i)f.pop();return i<0?new n(r.s*0):(r.e=Ww(f,h),r.d=f,_t=!1,a&&(r=_r(r,s,u*4)),c&&(r=r.times(Math.abs(c)<54?Nn(2,c):Ep.pow(2,c))),_t=!0,r)}o(CQ,"parseOther");function NQ(r,e){var t,n=e.d.length;if(n<3)return e.isZero()?e:bp(r,2,e,e);t=1.4*Math.sqrt(n),t=t>16?16:t|0,e=e.times(1/zw(5,t)),e=bp(r,2,e,e);for(var s,i=new r(5),a=new r(16),u=new r(20);t--;)s=e.times(e),e=e.times(i.plus(s.times(a.times(s).minus(u))));return e}o(NQ,"sine");function bp(r,e,t,n,s){var i,a,u,c,f=1,h=r.precision,m=Math.ceil(h/St);for(_t=!1,c=t.times(t),u=new r(n);;){if(a=_r(u.times(c),new r(e++*e++),h,1),u=s?n.plus(a):n.minus(a),n=_r(a.times(c),new r(e++*e++),h,1),a=u.plus(n),a.d[m]!==void 0){for(i=m;a.d[i]===u.d[i]&&i--;);if(i==-1)break}i=u,u=n,n=a,a=i,f++}return _t=!0,a.d.length=m+1,a}o(bp,"taylorSeries");function zw(r,e){for(var t=r;--e;)t*=r;return t}o(zw,"tinyPow");function Qk(r,e){var t,n=e.s<0,s=ka(r,r.precision,1),i=s.times(.5);if(e=e.abs(),e.lte(i))return Lo=n?4:1,e;if(t=e.divToInt(s),t.isZero())Lo=n?3:2;else{if(e=e.minus(t.times(s)),e.lte(i))return Lo=Fk(t)?n?2:3:n?4:1,e;Lo=Fk(t)?n?1:4:n?3:2}return e.minus(s).abs()}o(Qk,"toLessThanHalfPi");function FN(r,e,t,n){var s,i,a,u,c,f,h,m,g,x=r.constructor,v=t!==void 0;if(v?(Vs(t,1,qu),n===void 0?n=x.rounding:Vs(n,0,8)):(t=x.precision,n=x.rounding),!r.isFinite())h=Yk(r);else{for(h=La(r),a=h.indexOf("."),v?(s=2,e==16?t=t*4-3:e==8&&(t=t*3-2)):s=e,a>=0&&(h=h.replace(".",""),g=new x(1),g.e=h.length-a,g.d=qw(La(g),10,s),g.e=g.d.length),m=qw(h,10,s),i=c=m.length;m[--c]==0;)m.pop();if(!m[0])h=v?"0p+0":"0";else{if(a<0?i--:(r=new x(r),r.d=m,r.e=i,r=_r(r,g,t,n,0,s),m=r.d,i=r.e,f=Hk),a=m[t],u=s/2,f=f||m[t+1]!==void 0,f=n<4?(a!==void 0||f)&&(n===0||n===(r.s<0?3:2)):a>u||a===u&&(n===4||f||n===6&&m[t-1]&1||n===(r.s<0?8:7)),m.length=t,f)for(;++m[--t]>s-1;)m[t]=0,t||(++i,m.unshift(1));for(c=m.length;!m[c-1];--c);for(a=0,h="";a<c;a++)h+=LN.charAt(m[a]);if(v){if(c>1)if(e==16||e==8){for(a=e==16?4:3,--c;c%a;c++)h+="0";for(m=qw(h,s,e),c=m.length;!m[c-1];--c);for(a=1,h="1.";a<c;a++)h+=LN.charAt(m[a])}else h=h.charAt(0)+"."+h.slice(1);h=h+(i<0?"p":"p+")+i}else if(i<0){for(;++i;)h="0"+h;h="0."+h}else if(++i>c)for(i-=c;i--;)h+="0";else i<c&&(h=h.slice(0,i)+"."+h.slice(i))}h=(e==16?"0x":e==2?"0b":e==8?"0o":"")+h}return r.s<0?"-"+h:h}o(FN,"toStringBinary");function Mk(r,e){if(r.length>e)return r.length=e,!0}o(Mk,"truncate");function TQ(r){return new this(r).abs()}o(TQ,"abs");function IQ(r){return new this(r).acos()}o(IQ,"acos");function _Q(r){return new this(r).acosh()}o(_Q,"acosh");function BQ(r,e){return new this(r).plus(e)}o(BQ,"add");function DQ(r){return new this(r).asin()}o(DQ,"asin");function RQ(r){return new this(r).asinh()}o(RQ,"asinh");function OQ(r){return new this(r).atan()}o(OQ,"atan");function PQ(r){return new this(r).atanh()}o(PQ,"atanh");function kQ(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=ka(this,i,1).times(e.s>0?.25:.75),t.s=r.s):!e.d||r.isZero()?(t=e.s<0?ka(this,n,s):new this(0),t.s=r.s):!r.d||e.isZero()?(t=ka(this,i,1).times(.5),t.s=r.s):e.s<0?(this.precision=i,this.rounding=1,t=this.atan(_r(r,e,i,1)),e=ka(this,i,1),this.precision=n,this.rounding=s,t=r.s<0?t.minus(e):t.plus(e)):t=this.atan(_r(r,e,i,1)),t}o(kQ,"atan2");function LQ(r){return new this(r).cbrt()}o(LQ,"cbrt");function VQ(r){return mt(r=new this(r),r.e+1,2)}o(VQ,"ceil");function UQ(r,e,t){return new this(r).clamp(e,t)}o(UQ,"clamp");function jQ(r){if(!r||typeof r!="object")throw Error(Gw+"Object expected");var e,t,n,s=r.defaults===!0,i=["precision",1,qu,"rounding",0,8,"toExpNeg",-Sp,0,"toExpPos",0,Sp,"maxE",0,Sp,"minE",-Sp,0,"modulo",0,9];for(e=0;e<i.length;e+=3)if(t=i[e],s&&(this[t]=VN[t]),(n=r[t])!==void 0)if(cs(n)===n&&n>=i[e+1]&&n<=i[e+2])this[t]=n;else throw Error(Mu+t+": "+n);if(t="crypto",s&&(this[t]=VN[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($k);else this[t]=!1;else throw Error(Mu+t+": "+n);return this}o(jQ,"config");function FQ(r){return new this(r).cos()}o(FQ,"cos");function MQ(r){return new this(r).cosh()}o(MQ,"cosh");function Zk(r){var e,t,n;function s(i){var a,u,c,f=this;if(!(f instanceof s))return new s(i);if(f.constructor=s,qk(i)){f.s=i.s,_t?!i.d||i.e>s.maxE?(f.e=NaN,f.d=null):i.e<s.minE?(f.e=0,f.d=[0]):(f.e=i.e,f.d=i.d.slice()):(f.e=i.e,f.d=i.d?i.d.slice():i.d);return}if(c=typeof i,c==="number"){if(i===0){f.s=1/i<0?-1:1,f.e=0,f.d=[0];return}if(i<0?(i=-i,f.s=-1):f.s=1,i===~~i&&i<1e7){for(a=0,u=i;u>=10;u/=10)a++;_t?a>s.maxE?(f.e=NaN,f.d=null):a<s.minE?(f.e=0,f.d=[0]):(f.e=a,f.d=[i]):(f.e=a,f.d=[i]);return}if(i*0!==0){i||(f.s=NaN),f.e=NaN,f.d=null;return}return Hw(f,i.toString())}if(c==="string")return(u=i.charCodeAt(0))===45?(i=i.slice(1),f.s=-1):(u===43&&(i=i.slice(1)),f.s=1),Gk.test(i)?Hw(f,i):CQ(f,i);if(c==="bigint")return i<0?(i=-i,f.s=-1):f.s=1,Hw(f,i.toString());throw Error(Mu+i)}if(o(s,"Decimal"),s.prototype=Oe,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=jQ,s.clone=Zk,s.isDecimal=qk,s.abs=TQ,s.acos=IQ,s.acosh=_Q,s.add=BQ,s.asin=DQ,s.asinh=RQ,s.atan=OQ,s.atanh=PQ,s.atan2=kQ,s.cbrt=LQ,s.ceil=VQ,s.clamp=UQ,s.cos=FQ,s.cosh=MQ,s.div=qQ,s.exp=HQ,s.floor=KQ,s.hypot=$Q,s.ln=XQ,s.log=GQ,s.log10=zQ,s.log2=WQ,s.max=JQ,s.min=YQ,s.mod=QQ,s.mul=ZQ,s.pow=eZ,s.random=tZ,s.round=rZ,s.sign=nZ,s.sin=sZ,s.sinh=iZ,s.sqrt=aZ,s.sub=oZ,s.sum=uZ,s.tan=cZ,s.tanh=lZ,s.trunc=fZ,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}o(Zk,"clone");function qQ(r,e){return new this(r).div(e)}o(qQ,"div");function HQ(r){return new this(r).exp()}o(HQ,"exp");function KQ(r){return mt(r=new this(r),r.e+1,3)}o(KQ,"floor");function $Q(){var r,e,t=new this(0);for(_t=!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 _t=!0,new this(1/0);t=e}return _t=!0,t.sqrt()}o($Q,"hypot");function qk(r){return r instanceof Ep||r&&r.toStringTag===Xk||!1}o(qk,"isDecimalInstance");function XQ(r){return new this(r).ln()}o(XQ,"ln");function GQ(r,e){return new this(r).log(e)}o(GQ,"log");function WQ(r){return new this(r).log(2)}o(WQ,"log2");function zQ(r){return new this(r).log(10)}o(zQ,"log10");function JQ(){return Jk(this,arguments,-1)}o(JQ,"max");function YQ(){return Jk(this,arguments,1)}o(YQ,"min");function QQ(r,e){return new this(r).mod(e)}o(QQ,"mod");function ZQ(r,e){return new this(r).mul(e)}o(ZQ,"mul");function eZ(r,e){return new this(r).pow(e)}o(eZ,"pow");function tZ(r){var e,t,n,s,i=0,a=new this(1),u=[];if(r===void 0?r=this.precision:Vs(r,1,qu),n=Math.ceil(r/St),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]:u[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):(u.push(s%1e7),i+=4);i=n/4}else throw Error($k);else for(;i<n;)u[i++]=Math.random()*1e7|0;for(n=u[--i],r%=St,n&&r&&(s=Nn(10,St-r),u[i]=(n/s|0)*s);u[i]===0;i--)u.pop();if(i<0)t=0,u=[0];else{for(t=-1;u[0]===0;t-=St)u.shift();for(n=1,s=u[0];s>=10;s/=10)n++;n<St&&(t-=St-n)}return a.e=t,a.d=u,a}o(tZ,"random");function rZ(r){return mt(r=new this(r),r.e+1,this.rounding)}o(rZ,"round");function nZ(r){return r=new this(r),r.d?r.d[0]?r.s:0*r.s:r.s||NaN}o(nZ,"sign");function sZ(r){return new this(r).sin()}o(sZ,"sin");function iZ(r){return new this(r).sinh()}o(iZ,"sinh");function aZ(r){return new this(r).sqrt()}o(aZ,"sqrt");function oZ(r,e){return new this(r).sub(e)}o(oZ,"sub");function uZ(){var r=0,e=arguments,t=new this(e[r]);for(_t=!1;t.s&&++r<e.length;)t=t.plus(e[r]);return _t=!0,mt(t,this.precision,this.rounding)}o(uZ,"sum");function cZ(r){return new this(r).tan()}o(cZ,"tan");function lZ(r){return new this(r).tanh()}o(lZ,"tanh");function fZ(r){return mt(r=new this(r),r.e+1,1)}o(fZ,"trunc");Oe[Symbol.for("nodejs.util.inspect.custom")]=Oe.toString;Oe[Symbol.toStringTag]="Decimal";var Ep=Oe.constructor=Zk(VN);Kw=new Ep(Kw);$w=new Ep($w);var Xl=class r extends Ep{static{o(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)}};var MN=class{static{o(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 $T=Cn(require("fs"),1),g8=Cn(require("path"),1),rf=Cn(require("crypto"),1),nf=Cn(m8(),1);var Wre=o(r=>!!r&&typeof r=="object"&&"message"in r,"hasMessageInRecord"),Mo=o(r=>typeof r=="string"?ks(new hn(r)):r instanceof Error?ks(new hn(r.message,{cause:r.cause})):Wre(r)?ks(new hn(r.message)):ks(new hn("unexpected error")),"leftFromError");var Og=class{static{o(this,"NullCacheAdapter")}async get(e){return Promise.resolve(null)}has(e){return Promise.resolve(!1)}set(e,t){return Promise.resolve(!0)}};var XT=class{static{o(this,"NativeCertificateRepository")}httpClient;cache;constructor(e,t=new Og){this.httpClient=e,this.cache=t}async read(e){try{let{password:t}=e,n=await this.getPfxBuffer(e);if(n.isLeft())return n;let s=nf.default.asn1.fromDer(n.value.toString("binary")),i=nf.default.pkcs12.pkcs12FromAsn1(s,t),{certBag:a,pkcs8ShroudedKeyBag:u}=nf.default.pki.oids,c=i.getBags({bagType:a}),f=i.getBags({bagType:u}),h=c[a];if(!h?.length)return ks(new hn("Cannot read certificate"));let[{cert:m},...g]=h;if(!m)return ks(new hn("Issuer Certificate not found"));let x=f[u]?.[0].key;if(!x)return ks(new hn("Certificate Private Key not found"));let v=g.reduce((b,{cert:E})=>(E&&b.push(new rf.default.X509Certificate(nf.default.pki.certificateToPem(E))),b),[]),w=nf.default.pki.privateKeyToPem(x),S=nf.default.pki.certificateToPem(m),A=rf.default.createPrivateKey(w),N=new rf.default.X509Certificate(S);return Ls({ca:v,password:t,privateKey:A,certificate:N})}catch(t){return Mo(t)}}async sign(e,t,n=ko.SHA1){try{let i=rf.default.sign(n,Buffer.from(e),{key:t,padding:rf.default.constants.RSA_PKCS1_PADDING}).toString("base64");return await Promise.resolve(Ls(i))}catch(s){return Promise.resolve(Mo(s))}}getCertificateInfo(e){return new Pg().extractCertificateInfo(e)}getStringCertificate(e){return e.raw.toString("base64")}getStringPrivateKey(e){try{return e.export({type:"pkcs8",format:"pem"}).toString()}catch{throw new hn("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 Ls(i);if(g8.default.isAbsolute(t)||$T.default.existsSync(t))return this.hitBufferOnCache(s,$T.default.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 Mo(a)}return this.hitBufferOnCache(s,Buffer.from(t,"base64"))}getCacheKey(e,t){return rf.default.createHash("sha256").update(`${e}.${t}`).digest("hex")}async hitBufferOnCache(e,t){return await this.cache.set(e,t),Ls(t)}isValidRemoteUrl(e){try{return new URL(e),!0}catch{return!1}}};var A9=require("crypto"),GB=require("https"),C9=Cn(E9(),1);var WB=class{static{o(this,"SoapRemoteTransmissionRepository")}toolkit;certificateRepository;constructor(e,t){this.toolkit=e,this.certificateRepository=t}setCertificate(e){return this.certificate=e,this}get httpsAgent(){let e={rejectUnauthorized:!1,secureOptions:A9.constants.SSL_OP_LEGACY_SERVER_CONNECT};if(!this.certificate)return new GB.Agent({...e});let{ca:t,password:n,certificate:s,privateKey:i}=this.certificate;return new GB.Agent({passphrase:n,cert:s.toString(),ca:t.map(a=>a.toString()),key:this.certificateRepository.getStringPrivateKey(i),...e})}get defaultSoapHeaders(){return{"Content-Type":"application/soap+xml; charset=utf-8"}}async send(e){try{let t=this.httpsAgent,n=await(0,C9.createClientAsync)(`${e.url}?wsdl`,{attributesKey:"$",wsdl_options:{httpsAgent:t}});e.payload.$={xmlns:n.wsdl.definitions.$targetNamespace,...e.payload.$};let s=await this.toolkit.build(e.payload,{headless:!0,renderOpts:{pretty:!1},rootName:e.root}),i=this.toolkit.getFirstNode(s)??"",a=e.xsd,u=await this.toolkit.validate(i,a);if(u.isLeft())return u;let[c]=await n[`${e.method}Async`]({_xml:s},{httpsAgent:t});return Ls(c)}catch(t){return Mo(t)}}};var iE=require("os"),Ki=require("path"),_v=require("fs");var JB=require("path"),zB=require("module"),sE=require("url");var bpe=typeof jest<"u"||process.env.JEST_WORKER_ID!==void 0,wd,N9=o(()=>{if(wd!==void 0)return wd;if(bpe){wd=void 0;return}try{wd=new Function("try { return import.meta.url; } catch { return undefined; }")()}catch{wd=void 0}return wd},"getImportMetaUrl"),T9=o(()=>{if(typeof require<"u")return require;let r=N9();if(r)return(0,zB.createRequire)(r);let e=(0,sE.pathToFileURL)((0,JB.resolve)(process.cwd(),"package.json")).href;return(0,zB.createRequire)(e)},"getRequireFn"),I9=o(()=>{if(typeof __filename<"u")return __filename;let r=N9();return r?(0,sE.fileURLToPath)(r):(0,JB.resolve)(process.cwd())},"getCurrentFile");var Iv=o(r=>T9()(r),"exportRequireModule"),_9=o(r=>{r=`${r}.node`;let e=`${(0,iE.platform)()}-${(0,iE.arch)()}`;if(process.env.NFETS_ADDONS_DIR)return Iv((0,Ki.join)(process.env.NFETS_ADDONS_DIR,r));let t=I9(),n=(0,Ki.resolve)(t,"../../../../"),s=(0,Ki.join)(n,"build","addons",e,r);if((0,_v.existsSync)(s))return Iv(s);let i=t;for(let a=0;a<5;a++){let u=(0,Ki.join)(i,"build","addons",e,r);if((0,_v.existsSync)(u))return Iv(u);let c=(0,Ki.dirname)(i);if(c===i)break;i=c}i=t;for(let a=0;a<5;a++){let u=(0,Ki.join)(i,"node_modules","nfets","build","addons",e,r);if((0,_v.existsSync)(u))return Iv(u);let c=(0,Ki.dirname)(i);if(c===i)break;i=c}i=t;for(let a=0;a<5;a++){let u=(0,Ki.join)(i,"build","Release",r);if((0,_v.existsSync)(u))return Iv(u);let c=(0,Ki.dirname)(i);if(c===i)break;i=c}throw new Error(`Addon ${e}/${r} not found`)},"addon");var Epe=_9("xml_validator"),B9=Epe;var MK=Cn(require("crypto"),1),yge=Cn(Qq(),1);var Zq="application/xml";var jt;(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"})(jt||(jt={}));function Ape(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}o(Ape,"SelectNodesEx");function Cpe(r,e){let t=Sd("xpath").select;return t(e,r)}o(Cpe,"SelectNodesNode");var e7=typeof self<"u"?Ape:Cpe;function $i(r){r=r.replace(/\r\n/g,`
90
90
  `).replace(/\r/g,`
91
91
  `);let e;return typeof DOMParser<"u"?e=DOMParser:e=Sd("DOMParser"),new e().parseFromString(r,Zq)}o($i,"Parse");function co(r){let e;return typeof XMLSerializer<"u"?e=XMLSerializer:e=Sd("XMLSerializer"),new e().serializeToString(r)}o(co,"Stringify");function SE(r,e){let t=e7(r,e);return t&&t.length>0?t[0]:null}o(SE,"SelectSingleNode");function t7(r,e){return r&&r.nodeType===e}o(t7,"isNodeType");function mi(r){return t7(r,jt.Element)}o(mi,"isElement");function xf(r){return t7(r,jt.Document)}o(xf,"isDocument");var r7=new Map;function n7(r){for(let e in r)r7.set(e,r[e])}o(n7,"setNodeDependencies");function Sd(r){let e=r7.get(r);if(!e)throw new Error(`Node dependency not found: ${r}. Please use 'setNodeDependencies' to register it.`);return e}o(Sd,"getNodeDependency");var Rv="element",Ov="attribute",bE="content";var Npe=1e9;function oD(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}o(oD,"assign");function Ft(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=oD({},t.items)),t.target=e}}o(Ft,"XmlElement");function Gt(r={}){return(e,t)=>{let n=e.constructor,s=t;n.items||(n.items={}),n.target!==n&&(n.items=oD({},n.items)),n.target=e;let i;r.parser?i={parser:r.parser,required:r.required||!1,maxOccurs:r.maxOccurs||Npe,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,u=r.parser&&r.parser.namespaceURI;a[s]={...i,namespaceURI:r.namespaceURI||u||null,prefix:r.prefix||r.parser&&r.parser.prefix||null,localName:r.localName,type:Rv},i7(e,s,r)}}o(Gt,"XmlChildElement");function Lr(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=oD({},n.items)),n.target=e;let i=n.items;i[t]=r,i[t].type=Ov,i7(e,s,r)}}o(Lr,"XmlAttribute");function i7(r,e,t){let n=`_${e}`,s={set:o(function(i){this[n]!==i&&(this.element=null,this[n]=i)},"set"),get:o(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)}o(i7,"defineProperty");var Tc=class r{static{o(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 Tpe(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}o(Tpe,"printf");function Ipe(r,e){let t=r+"";for(;t.length<e;)t="0"+t;return t}o(Ipe,"padNum");var Me=class{static{o(this,"XmlError")}constructor(e,...t){this.prefix="XMLJS",this.code=e,this.name=this.constructor.name;let n=Tpe(gn[e],...t);this.message=`${this.prefix}${Ipe(e,4)}: ${n}`,this.stack=new Error(this.message).stack}},Te;(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"})(Te||(Te={}));var gn={};gn[Te.NONE]="No description";gn[Te.NULL_REFERENCE]="Null reference";gn[Te.NULL_PARAM]="'%1' has empty '%2' object";gn[Te.DECORATOR_NULL_PARAM]="Decorator '%1' has empty '%2' parameter";gn[Te.COLLECTION_LIMIT]="Collection of '%1' in element '%2' has wrong amount of items";gn[Te.METHOD_NOT_IMPLEMENTED]="Method is not implemented";gn[Te.METHOD_NOT_SUPPORTED]="Method is not supported";gn[Te.PARAM_REQUIRED]="Required parameter is missing '%1'";gn[Te.CONVERTER_UNSUPPORTED]="Converter is not supported";gn[Te.ELEMENT_MALFORMED]="Malformed element '%1'";gn[Te.ELEMENT_MISSING]="Element '%1' is missing in '%2'";gn[Te.ATTRIBUTE_MISSING]="Attribute '%1' is missing in '%2'";gn[Te.CONTENT_MISSING]="Content is missing in '%1'";gn[Te.CRYPTOGRAPHIC]="Cryptographic error: %1";gn[Te.CRYPTOGRAPHIC_NO_MODULE]="WebCrypto module is not found";gn[Te.CRYPTOGRAPHIC_UNKNOWN_TRANSFORM]="Unknown transform %1";gn[Te.ALGORITHM_NOT_SUPPORTED]="Algorithm is not supported '%1'";gn[Te.ALGORITHM_WRONG_NAME]="Algorithm wrong name in use '%1'";gn[Te.XML_EXCEPTION]="XML exception: %1";gn[Te.KEY_INFO_CLAUSE_NOT_SUPPORTED]="KeyInfoClause type '%1' is not supported";var Er=class{static{o(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 Me(Te.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 Me(Te.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 Me(Te.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 Me(Te.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 Xi={get:o(r=>{if(r)return Er.ToBase64(r)},"get"),set:o(r=>Er.FromBase64(r),"set")},Pv={get:o(r=>r?r.toString():"0","get"),set:o(r=>Number(r),"set")};var _pe="xml_root",zs=class r{static{o(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 Me(Te.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 Me(Te.ATTRIBUTE_MISSING,t,e.localName);return n}static GetElementById(e,t){if(e==null||t==null)return null;let n=null;return xf(e)&&(n=e.getElementById(t)),n==null&&(n=SE(e,`//*[@*[local-name()='Id']='${t}']`),n==null&&(n=SE(e,`//*[@*[local-name()='ID']='${t}']`),n==null&&(n=SE(e,`//*[@*[local-name()='id']='${t}']`)))),n}static CreateDocument(e=_pe,t=null,n=null){if(n&&!t)throw new Me(Te.PARAM_REQUIRED,"namespaceUri",`Prefix '${n}' requires namespaceUri`);let s="",i="",a="";n&&(s=n+":",i=":"+n),t&&(a=` xmlns${i}="${t}"`);let u=`${s}${e}`;return $i(`<${u}${a}></${u}>`)}static GetChildren(e,t,n){e=xf(e)?e.documentElement:e;let s=[];for(let i=0;i<e.childNodes.length;i++){let a=e.childNodes[i];mi(a)&&a.localName===t&&(a.namespaceURI===n||!n)&&s.push(a)}return s}static GetFirstChild(e,t,n){e=xf(e)?e.documentElement:e;for(let s=0;s<e.childNodes.length;s++){let i=e.childNodes[s];if(mi(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(mi(a)&&a.localName===t&&(a.namespaceURI===n||!n))return a}if(s)throw new Me(Te.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 u in i.items){if(!Object.prototype.hasOwnProperty.call(i.items,u))continue;let c=t[u],f=i.items[u];switch(f.type){case bE:{let h=f,m=h.converter?h.converter.get(c):c;if(h.required&&m==null)throw new Me(Te.CONTENT_MISSING,a);(h.defaultValue!==c||h.required)&&(s.textContent=m);break}case Ov:{let h=f,m=h.converter?h.converter.get(c):c;if(h.required&&m==null)throw new Me(Te.ATTRIBUTE_MISSING,h.localName,a);(h.defaultValue!==c||h.required)&&(h.namespaceURI?s.setAttributeNS(h.namespaceURI,h.localName||"",m):s.setAttribute(h.localName||"",m));break}case Rv:{let h=f,m=null;if(h.parser){if(h.required&&!c||h.minOccurs&&!c.Count){let g=c?.localName||h.localName;throw new Me(Te.ELEMENT_MISSING,g,a)}c&&(m=c.GetXml(c.element===void 0&&(h.required||c.Count)))}else{let g=h.converter?h.converter.get(c):c;if(h.required&&g===void 0)throw new Me(Te.ELEMENT_MISSING,h.localName,a);if(c!==h.defaultValue||h.required)if(h.namespaceURI?m=n.createElementNS(h.namespaceURI,`${h.prefix?h.prefix+":":""}${h.localName}`):m=n.createElement(`${h.prefix?h.prefix+":":""}${h.localName}`),Array.isArray(g))for(let x of g){let v=x instanceof r?x.GetXml(!0):x;v!==null&&m&&m.appendChild(v)}else if(g instanceof r){let x=g.GetXml(!0);x&&m&&m.appendChild(x)}else m&&(m.textContent=g)}if(m)if(h.noRoot){let g=[];for(let w=0;w<m.childNodes.length;w++){let S=m.childNodes.item(w);mi(S)&&g.push(S)}let x=h.minOccurs||0,v=h.maxOccurs||1/0;if(g.length<x||g.length>v)throw new Me(Te.COLLECTION_LIMIT,c.localName,i.localName);g.forEach(w=>s.appendChild(w.cloneNode(!0)))}else{if(m.childNodes.length<(h.minOccurs||0)||m.childNodes.length>(h.maxOccurs||1/0))throw new Me(Te.COLLECTION_LIMIT,c.localName,i.localName);s.appendChild(m)}break}}}return this.OnGetXml(s),this.element=s,s}LoadXml(e){let t,n=this;if(typeof e=="string"?t=$i(e).documentElement:t=e,!t)throw new Me(Te.PARAM_REQUIRED,"element");let s=this.GetStatic(),i=this.localName||"";if(!(t.localName===i&&t.namespaceURI==this.NamespaceURI))throw new Me(Te.ELEMENT_MALFORMED,i);if(s.items)for(let a in s.items){if(!Object.prototype.hasOwnProperty.call(s.items,a))continue;let u=s.items[a];switch(u.type){case bE:{let c=u;if(c.required&&!t.textContent)throw new Me(Te.CONTENT_MISSING,i);if(!t.textContent)n[a]=c.defaultValue;else{let f=c.converter?c.converter.set(t.textContent):t.textContent;n[a]=f}break}case Ov:{let c=u,f,h;if(!c.localName)throw new Me(Te.PARAM_REQUIRED,"localName");if(c.namespaceURI?(f=t.hasAttributeNS.bind(t,c.namespaceURI,c.localName),h=t.getAttributeNS.bind(t,c.namespaceURI,c.localName)):(f=t.hasAttribute.bind(t,c.localName),h=t.getAttribute.bind(t,c.localName)),c.required&&!f())throw new Me(Te.ATTRIBUTE_MISSING,c.localName,i);if(!f())n[a]=c.defaultValue;else{let m=h(),g=c.converter&&m?c.converter.set(m):m;n[a]=g}break}case Rv:{let c=u;if(c.noRoot){if(!c.parser)throw new Me(Te.XML_EXCEPTION,`Schema for '${c.localName}' with flag noRoot must have 'parser'`);let h=new c.parser;if(!(h instanceof bd))throw new Me(Te.XML_EXCEPTION,`Schema for '${c.localName}' with flag noRoot must have 'parser' like instance of XmlCollection`);h.OnLoadXml(t),delete h.element;let m=c.minOccurs||0,g=c.maxOccurs||1/0;if(h.Count<m||h.Count>g)throw new Me(Te.COLLECTION_LIMIT,c.parser.localName,i);n[a]=h;continue}let f=null;for(let h=0;h<t.childNodes.length;h++){let m=t.childNodes.item(h);if(!mi(m))continue;let g=m;if(g.localName===c.localName&&g.namespaceURI==c.namespaceURI){f=g;break}}if(c.required&&!f)throw new Me(Te.ELEMENT_MISSING,c.parser?c.parser.localName:c.localName,i);if(c.parser){if(f){let h=new c.parser;h.localName=c.localName,h.namespaceURI=c.namespaceURI,n[a]=h,h.LoadXml(f)}}else if(!f)n[a]=c.defaultValue;else{let h=f.textContent||"",m=c.converter?c.converter.set(h):h;n[a]=m}break}}}this.OnLoadXml(t),this.prefix=t.prefix||"",this.element=t}toString(){let e=this.GetXml();return e?co(e):""}GetElement(e,t=!0){if(!this.element)throw new Me(Te.NULL_PARAM,this.localName);return r.GetElement(this.element,e,t)}GetChildren(e,t){if(!this.element)throw new Me(Te.NULL_PARAM,this.localName);return r.GetChildren(this.element,e,t||this.NamespaceURI||void 0)}GetChild(e,t=!0){if(!this.element)throw new Me(Te.NULL_PARAM,this.localName);return r.GetChild(this.element,e,this.NamespaceURI||void 0,t)}GetFirstChild(e,t){if(!this.element)throw new Me(Te.NULL_PARAM,this.localName);return r.GetFirstChild(this.element,e,t)}GetAttribute(e,t,n=!0){if(!this.element)throw new Me(Te.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 u=this.CreateDocument();if(u)e=u;else throw new Me(Te.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 bd=class extends zs{static{o(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 Tc(this.GetIterator().map(e))}Filter(e){return new Tc(this.GetIterator().filter(e))}Sort(e){return new Tc(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 Me(Te.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(!(mi(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 Ed=class extends Tc{static{o(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 Bpe="[object ArrayBuffer]",dt=class lD{static{o(this,"BufferSourceConverter")}static isArrayBuffer(e){return Object.prototype.toString.call(e)===Bpe}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=lD.toUint8Array(e),s=lD.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 u=this.toUint8Array(a);s.set(u,i),i+=u.length}return e[e.length-1]instanceof Function?this.toView(s,e[e.length-1]):s.buffer}},cD="string",Dpe=/^[0-9a-f\s]+$/i,Rpe=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,Ope=/^[a-zA-Z0-9-_]+$/,a7=class{static{o(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=dt.toUint8Array(e),n="";for(let i=0;i<t.length;i++)n+=String.fromCharCode(t[i]);return decodeURIComponent(escape(n))}},lo=class{static{o(this,"Utf16Converter")}static toString(e,t=!1){let n=dt.toArrayBuffer(e),s=new DataView(n),i="";for(let a=0;a<n.byteLength;a+=2){let u=s.getUint16(a,t);i+=String.fromCharCode(u)}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}},Et=class Ad{static{o(this,"Convert")}static isHex(e){return typeof e===cD&&Dpe.test(e)}static isBase64(e){return typeof e===cD&&Rpe.test(e)}static isBase64Url(e){return typeof e===cD&&Ope.test(e)}static ToString(e,t="utf8"){let n=dt.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 lo.toString(n,!0);case"utf16":case"utf16be":return lo.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 lo.fromString(e,!0);case"utf16":case"utf16be":return lo.fromString(e);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToBase64(e){let t=dt.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(!Ad.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(!Ad.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=Ad.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.FromBinary(e);case"utf8":return a7.fromString(e);case"utf16":case"utf16be":return lo.fromString(e);case"utf16le":case"usc2":return lo.fromString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToUtf8String(e,t=Ad.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.ToBinary(e);case"utf8":return a7.toString(e);case"utf16":case"utf16be":return lo.toString(e);case"utf16le":case"usc2":return lo.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=dt.toUint8Array(e),n="";for(let s=0;s<t.length;s++)n+=String.fromCharCode(t[s]);return n}static ToHex(e){let t=dt.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(!Ad.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 lo.toString(e,t)}static FromUtf16String(e,t=!1){return lo.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,"")||""}};Et.DEFAULT_UTF8_ENCODING="utf8";function B(r,e,t){var n;return r instanceof Object&&(n=r[e])!==null&&n!==void 0?n:t}o(B,"getParametersValue");function EE(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()}o(EE,"bufferToHexCodes");function Qo(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}o(Qo,"utilFromBase");function ma(r,e,t=-1){let n=t,s=r,i=0,a=Math.pow(2,e);for(let u=1;u<8;u++){if(r<a){let c;if(n<0)c=new ArrayBuffer(u),i=u;else{if(n<u)return new ArrayBuffer(0);c=new ArrayBuffer(n),i=n}let f=new Uint8Array(c);for(let h=u-1;h>=0;h--){let m=Math.pow(2,h*e);f[i-h-1]=Math.floor(s/m),s-=f[i-h-1]*m}return c}a*=Math.pow(2,e)}return new ArrayBuffer(0)}o(ma,"utilToBase");function wf(...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}o(wf,"utilConcatBuf");function AE(...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}o(AE,"utilConcatView");function fD(){let r=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){let u=r[0]===255&&r[1]&128,c=r[0]===0&&(r[1]&128)===0;(u||c)&&this.warnings.push("Needlessly long format")}let e=new ArrayBuffer(this.valueHex.byteLength),t=new Uint8Array(e);for(let u=0;u<this.valueHex.byteLength;u++)t[u]=0;t[0]=r[0]&128;let n=Qo(t,8),s=new ArrayBuffer(this.valueHex.byteLength),i=new Uint8Array(s);for(let u=0;u<this.valueHex.byteLength;u++)i[u]=r[u];return i[0]&=127,Qo(i,8)-n}o(fD,"utilDecodeTC");function u7(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,u=ma(a,8,n),c=new Uint8Array(u);return c[0]|=128,u}let s=ma(e,8,n),i=new Uint8Array(s);if(i[0]&128){let a=s.slice(0),u=new Uint8Array(a);s=new ArrayBuffer(s.byteLength+1),i=new Uint8Array(s);for(let c=0;c<a.byteLength;c++)i[c+1]=u[c];i[0]=0}return s}t*=Math.pow(2,8)}return new ArrayBuffer(0)}o(u7,"utilEncodeTC");function Ic(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}o(Ic,"isEqualBuffer");function Js(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)}o(Js,"padNumber");var c7="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",l7="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=";function CE(r,e=!1,t=!1,n=!1){let s=0,i=0,a=0,u="",c=e?l7:c7;if(n){let f=0;for(let h=0;h<r.length;h++)if(r.charCodeAt(h)!==0){f=h;break}r=r.slice(f)}for(;s<r.length;){let f=r.charCodeAt(s++);s>=r.length&&(i=1);let h=r.charCodeAt(s++);s>=r.length&&(a=1);let m=r.charCodeAt(s++),g=f>>2,x=(f&3)<<4|h>>4,v=(h&15)<<2|m>>6,w=m&63;i===1?v=w=64:a===1&&(w=64),t?v===64?u+=`${c.charAt(g)}${c.charAt(x)}`:w===64?u+=`${c.charAt(g)}${c.charAt(x)}${c.charAt(v)}`:u+=`${c.charAt(g)}${c.charAt(x)}${c.charAt(v)}${c.charAt(w)}`:u+=`${c.charAt(g)}${c.charAt(x)}${c.charAt(v)}${c.charAt(w)}`}return u}o(CE,"toBase64");function Cd(r,e=!1,t=!1){let n=e?l7:c7;function s(c){for(let f=0;f<64;f++)if(n.charAt(f)===c)return f;return 64}o(s,"indexOf");function i(c){return c===64?0:c}o(i,"test");let a=0,u="";for(;a<r.length;){let c=s(r.charAt(a++)),f=a>=r.length?0:s(r.charAt(a++)),h=a>=r.length?0:s(r.charAt(a++)),m=a>=r.length?0:s(r.charAt(a++)),g=i(c)<<2|i(f)>>4,x=(i(f)&15)<<4|i(h)>>2,v=(i(h)&3)<<6|i(m);u+=String.fromCharCode(g),h!==64&&(u+=String.fromCharCode(x)),m!==64&&(u+=String.fromCharCode(v))}if(t){let c=u.length,f=-1;for(let h=c-1;h>=0;h--)if(u.charCodeAt(h)!==0){f=h;break}f!==-1?u=u.slice(0,f+1):u=""}return u}o(Cd,"fromBase64");function kv(r){let e="",t=new Uint8Array(r);for(let n of t)e+=String.fromCharCode(n);return e}o(kv,"arrayBufferToString");function Sf(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}o(Sf,"stringToArrayBuffer");var Ppe=Math.log(2);function f7(r){let e=Math.log(r)/Ppe,t=Math.floor(e),n=Math.round(e);return t===n?t:n}o(f7,"nearestPowerOf2");function De(r,e){for(let t of e)delete r[t]}o(De,"clearProps");function NE(){if(typeof BigInt>"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}o(NE,"assertBigInt");function mD(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}o(mD,"concat");function Zo(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)}o(Zo,"checkBufferParams");var gD=class{static{o(this,"ViewWriter")}constructor(){this.items=[]}write(e){this.items.push(e)}final(){return mD(this.items)}},Lv=[new Uint8Array([1])],p7="0123456789",hD="name",d7="valueHexView",kpe="isHexOnly",Lpe="idBlock",Vpe="tagClass",Upe="tagNumber",jpe="isConstructed",Fpe="fromBER",Mpe="toBER",qpe="local",Ys="",ga=new ArrayBuffer(0),TE=new Uint8Array(0),Uv="EndOfContent",g7="OCTET STRING",v7="BIT STRING";function eu(r){var e;return e=class extends r{static{o(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?dt.toUint8Array(i.valueHex):TE}fromBER(n,s,i){let a=n instanceof ArrayBuffer?new Uint8Array(n):n;if(!Zo(this,a,s,i))return-1;let u=s+i;return this.valueHexView=a.subarray(s,u),this.valueHexView.length?(this.blockLength=i,u):(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",ga)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:Et.ToHex(this.valueHexView)}}},e.NAME="hexBlock",e}o(eu,"HexBlock");var bf=class{static{o(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=Ys,warnings:n=[],valueBeforeDecode:s=TE}={}){this.blockLength=e,this.error=t,this.warnings=n,this.valueBeforeDecodeView=dt.toUint8Array(s)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:Et.ToHex(this.valueBeforeDecodeView)}}};bf.NAME="baseBlock";var Qs=class extends bf{static{o(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'")}};Qs.NAME="valueBlock";var y7=class extends eu(bf){static{o(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?dt.toUint8Array(e.valueHex):TE,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",ga}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=ma(this.tagNumber,7),i=new Uint8Array(s),a=s.byteLength,u=new Uint8Array(a+1);if(u[0]=t|31,!e){for(let c=0;c<a-1;c++)u[c+1]=i[c]|128;u[a]=i[a-1]}return u.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=dt.toUint8Array(e);if(!Zo(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 u=i[0]&31;if(u!==31)this.tagNumber=u,this.blockLength=1;else{let c=1,f=this.valueHexView=new Uint8Array(255),h=255;for(;i[c]&128;){if(f[c-1]=i[c]&127,c++,c>=i.length)return this.error="End of input reached before message was fully decoded",-1;if(c===h){h+=255;let g=new Uint8Array(h);for(let x=0;x<f.length;x++)g[x]=f[x];f=this.valueHexView=new Uint8Array(h)}}this.blockLength=c+1,f[c-1]=i[c]&127;let m=new Uint8Array(c);for(let g=0;g<c;g++)m[g]=f[g];f=this.valueHexView=new Uint8Array(c),f.set(m),this.blockLength<=9?this.tagNumber=Qo(f,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}}};y7.NAME="identificationBlock";var x7=class extends bf{static{o(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=dt.toUint8Array(e);if(!Zo(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 u=t+1,c=s.subarray(u,u+a);return c[a-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=Qo(c,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=ma(this.length,8);if(s.byteLength>127)return this.error="Too big length",ga;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}}};x7.NAME="lengthBlock";var ot={},Is=class extends bf{static{o(this,"BaseBlock")}constructor({name:e=Ys,optional:t=!1,primitiveSchema:n,...s}={},i){super(s),this.name=e,this.optional=t,n&&(this.primitiveSchema=n),this.idBlock=new y7(s),this.lenBlock=new x7(s),this.valueBlock=i?new i(s):new Qs(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 gD;t||w7(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?ga: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():Et.ToHex(this.toBER())}onAsciiEncoding(){let e=this.constructor.NAME,t=Et.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 Ic(t,n)}};Is.NAME="BaseBlock";function w7(r){var e;if(r instanceof ot.Constructed)for(let t of r.valueBlock.value)w7(t)&&(r.lenBlock.isIndefiniteForm=!0);return!!(!((e=r.lenBlock)===null||e===void 0)&&e.isIndefiniteForm)}o(w7,"prepareIndefiniteForm");var S7=class extends Is{static{o(this,"BaseStringBlock")}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}constructor({value:e=Ys,...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}'`}};S7.NAME="BaseStringBlock";var b7=class extends eu(Qs){static{o(this,"LocalPrimitiveValueBlock")}constructor({isHexOnly:e=!0,...t}={}){super(t),this.isHexOnly=e}};b7.NAME="PrimitiveValueBlock";var E7,gt=class extends Is{static{o(this,"Primitive")}constructor(e={}){super(e,b7),this.idBlock.isConstructed=!1}};E7=gt;ot.Primitive=E7;gt.NAME="PRIMITIVE";function Hpe(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}o(Hpe,"localChangeType");function jv(r,e=0,t=r.length){let n=e,s=new Is({},Qs),i=new bf;if(!Zo(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 u=s.idBlock.fromBER(r,e,t);if(s.idBlock.warnings.length&&s.warnings.concat(s.idBlock.warnings),u===-1)return s.error=s.idBlock.error,{offset:-1,result:s};if(e=u,t-=s.idBlock.blockLength,u=s.lenBlock.fromBER(r,e,t),s.lenBlock.warnings.length&&s.warnings.concat(s.lenBlock.warnings),u===-1)return s.error=s.lenBlock.error,{offset:-1,result:s};if(e=u,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 c=Is;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};c=ot.EndOfContent;break;case 1:c=ot.Boolean;break;case 2:c=ot.Integer;break;case 3:c=ot.BitString;break;case 4:c=ot.OctetString;break;case 5:c=ot.Null;break;case 6:c=ot.ObjectIdentifier;break;case 10:c=ot.Enumerated;break;case 12:c=ot.Utf8String;break;case 13:c=ot.RelativeObjectIdentifier;break;case 14:c=ot.TIME;break;case 15:return s.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:s};case 16:c=ot.Sequence;break;case 17:c=ot.Set;break;case 18:c=ot.NumericString;break;case 19:c=ot.PrintableString;break;case 20:c=ot.TeletexString;break;case 21:c=ot.VideotexString;break;case 22:c=ot.IA5String;break;case 23:c=ot.UTCTime;break;case 24:c=ot.GeneralizedTime;break;case 25:c=ot.GraphicString;break;case 26:c=ot.VisibleString;break;case 27:c=ot.GeneralString;break;case 28:c=ot.UniversalString;break;case 29:c=ot.CharacterString;break;case 30:c=ot.BmpString;break;case 31:c=ot.DATE;break;case 32:c=ot.TimeOfDay;break;case 33:c=ot.DateTime;break;case 34:c=ot.Duration;break;default:{let f=s.idBlock.isConstructed?new ot.Constructed:new ot.Primitive;f.idBlock=s.idBlock,f.lenBlock=s.lenBlock,f.warnings=s.warnings,s=f}}break;case 2:case 3:case 4:default:c=s.idBlock.isConstructed?ot.Constructed:ot.Primitive}return s=Hpe(s,c),u=s.fromBER(r,e,s.lenBlock.isIndefiniteForm?t:s.lenBlock.length),s.valueBeforeDecodeView=r.subarray(n,n+s.blockLength),{offset:u,result:s}}o(jv,"localFromBER");function Jr(r){if(!r.byteLength){let e=new Is({},Qs);return e.error="Input buffer has zero length",{offset:-1,result:e}}return jv(dt.toUint8Array(r).slice(),0,r.byteLength)}o(Jr,"fromBER");function Kpe(r,e){return r?1:e}o(Kpe,"checkLen");var _c=class extends Qs{static{o(this,"LocalConstructedValueBlock")}constructor({value:e=[],isIndefiniteForm:t=!1,...n}={}){super(n),this.value=e,this.isIndefiniteForm=t}fromBER(e,t,n){let s=dt.toUint8Array(e);if(!Zo(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(;Kpe(this.isIndefiniteForm,n)>0;){let a=jv(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===Uv)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===Uv?this.value.pop():this.warnings.push("No EndOfContent block encoded")),i}toBER(e,t){let n=t||new gD;for(let s=0;s<this.value.length;s++)this.value[s].toBER(e,n);return t?ga:n.final()}toJSON(){let e={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(let t of this.value)e.value.push(t.toJSON());return e}};_c.NAME="ConstructedValueBlock";var A7,oe=class extends Is{static{o(this,"Constructed")}constructor(e={}){super(e,_c),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(`
92
92
  `).map(s=>` ${s}`).join(`